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 @@ -55,6 +55,8 @@ export const TaskTool = Tool.defineEffect(
5555
5656 const canTask = next . permission . some ( ( rule ) => rule . permission === id )
5757 const canTodo = next . permission . some ( ( rule ) => rule . permission === "todowrite" )
58+ const canPlanExit = next . permission . some ( ( rule ) => rule . permission === "plan_exit" )
59+ const canPlanEnter = next . permission . some ( ( rule ) => rule . permission === "plan_enter" )
5860
5961 const taskID = params . task_id
6062 const session = taskID
@@ -79,6 +81,24 @@ export const TaskTool = Tool.defineEffect(
7981 action : "deny" as const ,
8082 } ,
8183 ] ) ,
84+ ...( canPlanExit
85+ ? [ ]
86+ : [
87+ {
88+ permission : "plan_exit" as const ,
89+ pattern : "*" as const ,
90+ action : "deny" as const ,
91+ } ,
92+ ] ) ,
93+ ...( canPlanEnter
94+ ? [ ]
95+ : [
96+ {
97+ permission : "plan_enter" as const ,
98+ pattern : "*" as const ,
99+ action : "deny" as const ,
100+ } ,
101+ ] ) ,
82102 ...( canTask
83103 ? [ ]
84104 : [
@@ -137,6 +157,8 @@ export const TaskTool = Tool.defineEffect(
137157 agent : next . name ,
138158 tools : {
139159 ...( canTodo ? { } : { todowrite : false } ) ,
160+ plan_exit : false ,
161+ plan_enter : false ,
140162 ...( canTask ? { } : { task : false } ) ,
141163 ...Object . fromEntries ( ( cfg . experimental ?. primary_tools ?? [ ] ) . map ( ( item ) => [ item , false ] ) ) ,
142164 } ,
You can’t perform that action at this time.
0 commit comments