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 @@ -30,12 +30,24 @@ export const PlanExitTool = Tool.define(
3030 execute : ( _params : { } , ctx : Tool . Context ) =>
3131 Effect . gen ( function * ( ) {
3232 const info = yield * session . get ( ctx . sessionID )
33- const plan = path . relative ( Instance . worktree , Session . plan ( info ) )
33+ const abs = Session . plan ( info )
34+ const plan = path . relative ( Instance . worktree , abs )
35+ const content = yield * Effect . promise ( ( ) =>
36+ Bun . file ( abs )
37+ . text ( )
38+ . catch ( ( ) => "" ) ,
39+ )
40+ if ( ! content . trim ( ) )
41+ return {
42+ title : "Plan is empty" ,
43+ output : "The plan file is empty. Write the plan first before calling plan_exit." ,
44+ metadata : { } ,
45+ }
3446 const answers = yield * question . ask ( {
3547 sessionID : ctx . sessionID ,
3648 questions : [
3749 {
38- question : `Plan at ${ plan } is complete. Would you like to switch to the build agent and start implementing?` ,
50+ question : `Plan at ${ plan } is complete. Would you like to switch to the build agent and start implementing?\n\n---\n\n ${ content } ` ,
3951 header : "Build Agent" ,
4052 custom : false ,
4153 options : [
You can’t perform that action at this time.
0 commit comments