File tree Expand file tree Collapse file tree
packages/opencode/src/tool Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export const TaskTool = Tool.define("task", async (ctx) => {
6464 if ( ! agent ) throw new Error ( `Unknown agent type: ${ params . subagent_type } is not a valid agent type` )
6565
6666 const hasTaskPermission = agent . permission . some ( ( rule ) => rule . permission === "task" )
67+ const hasTodoWritePermission = agent . permission . some ( ( rule ) => rule . permission === "todowrite" )
6768
6869 const session = await iife ( async ( ) => {
6970 if ( params . task_id ) {
@@ -75,11 +76,15 @@ export const TaskTool = Tool.define("task", async (ctx) => {
7576 parentID : ctx . sessionID ,
7677 title : params . description + ` (@${ agent . name } subagent)` ,
7778 permission : [
78- {
79- permission : "todowrite" ,
80- pattern : "*" ,
81- action : "deny" ,
82- } ,
79+ ...( hasTodoWritePermission
80+ ? [ ]
81+ : [
82+ {
83+ permission : "todowrite" as const ,
84+ pattern : "*" as const ,
85+ action : "deny" as const ,
86+ } ,
87+ ] ) ,
8388 ...( hasTaskPermission
8489 ? [ ]
8590 : [
@@ -131,7 +136,7 @@ export const TaskTool = Tool.define("task", async (ctx) => {
131136 } ,
132137 agent : agent . name ,
133138 tools : {
134- todowrite : false ,
139+ ... ( hasTodoWritePermission ? { } : { todowrite : false } ) ,
135140 ...( hasTaskPermission ? { } : { task : false } ) ,
136141 ...Object . fromEntries ( ( config . experimental ?. primary_tools ?? [ ] ) . map ( ( t ) => [ t , false ] ) ) ,
137142 } ,
You can’t perform that action at this time.
0 commit comments