This repository was archived by the owner on Feb 19, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-26
lines changed
packages/opencode/src/cli/cmd Expand file tree Collapse file tree 1 file changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ export const RunCommand = cmd({
165165 }
166166
167167 let text = ""
168+ const messageID = Identifier . ascending ( "message" )
168169
169170 Bus . subscribe ( MessageV2 . Event . PartUpdated , async ( evt ) => {
170171 if ( evt . properties . part . sessionID !== session . id ) return
@@ -223,35 +224,34 @@ export const RunCommand = cmd({
223224 UI . error ( err )
224225 } )
225226
226- if ( args . command ) {
227- await SessionPrompt . command ( {
228- messageID : Identifier . ascending ( "message" ) ,
227+ const result = await ( async ( ) => {
228+ if ( args . command ) {
229+ return await SessionPrompt . command ( {
230+ messageID,
231+ sessionID : session . id ,
232+ agent : agent . name ,
233+ model : providerID + "/" + modelID ,
234+ command : args . command ,
235+ arguments : message ,
236+ } )
237+ }
238+ return await SessionPrompt . prompt ( {
229239 sessionID : session . id ,
240+ messageID,
241+ model : {
242+ providerID,
243+ modelID,
244+ } ,
230245 agent : agent . name ,
231- model : providerID + "/" + modelID ,
232- command : args . command ,
233- arguments : message ,
246+ parts : [
247+ {
248+ id : Identifier . ascending ( "part" ) ,
249+ type : "text" ,
250+ text : message ,
251+ } ,
252+ ] ,
234253 } )
235- return
236- }
237-
238- const messageID = Identifier . ascending ( "message" )
239- const result = await SessionPrompt . prompt ( {
240- sessionID : session . id ,
241- messageID,
242- model : {
243- providerID,
244- modelID,
245- } ,
246- agent : agent . name ,
247- parts : [
248- {
249- id : Identifier . ascending ( "part" ) ,
250- type : "text" ,
251- text : message ,
252- } ,
253- ] ,
254- } )
254+ } ) ( )
255255
256256 const isPiped = ! process . stdout . isTTY
257257 if ( isPiped ) {
You can’t perform that action at this time.
0 commit comments