Browse Source

fix(effect): reuse task tool id

Kit Langton 4 months ago
parent
commit
5e54c54134
2 changed files with 7 additions and 3 deletions
  1. 6 2
      packages/opencode/src/session/prompt.ts
  2. 1 1
      packages/opencode/src/tool/task.ts

+ 6 - 2
packages/opencode/src/session/prompt.ts

@@ -600,7 +600,11 @@ NOTE: At any point in time through this workflow you should feel free to ask the
           subagent_type: task.agent,
           command: task.command,
         }
-        yield* plugin.trigger("tool.execute.before", { tool: "task", sessionID, callID: part.id }, { args: taskArgs })
+        yield* plugin.trigger(
+          "tool.execute.before",
+          { tool: TaskTool.id, sessionID, callID: part.id },
+          { args: taskArgs },
+        )
 
         const taskAgent = yield* agents.get(task.agent)
         if (!taskAgent) {
@@ -679,7 +683,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
 
         yield* plugin.trigger(
           "tool.execute.after",
-          { tool: "task", sessionID, callID: part.id, args: taskArgs },
+          { tool: TaskTool.id, sessionID, callID: part.id, args: taskArgs },
           result,
         )
 

+ 1 - 1
packages/opencode/src/tool/task.ts

@@ -181,7 +181,7 @@ export const TaskDescription: Tool.DynamicDescription = (agent) =>
     const items = yield* Effect.promise(() =>
       Agent.list().then((items) => items.filter((item) => item.mode !== "primary")),
     )
-    const filtered = items.filter((item) => Permission.evaluate("task", item.name, agent.permission).action !== "deny")
+    const filtered = items.filter((item) => Permission.evaluate(id, item.name, agent.permission).action !== "deny")
     const list = filtered.toSorted((a, b) => a.name.localeCompare(b.name))
     const description = list
       .map(