mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-24 19:24:22 +01:00
fix: run cmd json format when running command (#2926)
This commit is contained in:
@@ -165,6 +165,7 @@ export const RunCommand = cmd({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let text = ""
|
let text = ""
|
||||||
|
const messageID = Identifier.ascending("message")
|
||||||
|
|
||||||
Bus.subscribe(MessageV2.Event.PartUpdated, async (evt) => {
|
Bus.subscribe(MessageV2.Event.PartUpdated, async (evt) => {
|
||||||
if (evt.properties.part.sessionID !== session.id) return
|
if (evt.properties.part.sessionID !== session.id) return
|
||||||
@@ -223,20 +224,18 @@ export const RunCommand = cmd({
|
|||||||
UI.error(err)
|
UI.error(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const result = await (async () => {
|
||||||
if (args.command) {
|
if (args.command) {
|
||||||
await SessionPrompt.command({
|
return await SessionPrompt.command({
|
||||||
messageID: Identifier.ascending("message"),
|
messageID,
|
||||||
sessionID: session.id,
|
sessionID: session.id,
|
||||||
agent: agent.name,
|
agent: agent.name,
|
||||||
model: providerID + "/" + modelID,
|
model: providerID + "/" + modelID,
|
||||||
command: args.command,
|
command: args.command,
|
||||||
arguments: message,
|
arguments: message,
|
||||||
})
|
})
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return await SessionPrompt.prompt({
|
||||||
const messageID = Identifier.ascending("message")
|
|
||||||
const result = await SessionPrompt.prompt({
|
|
||||||
sessionID: session.id,
|
sessionID: session.id,
|
||||||
messageID,
|
messageID,
|
||||||
model: {
|
model: {
|
||||||
@@ -252,6 +251,7 @@ export const RunCommand = cmd({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
})()
|
||||||
|
|
||||||
const isPiped = !process.stdout.isTTY
|
const isPiped = !process.stdout.isTTY
|
||||||
if (isPiped) {
|
if (isPiped) {
|
||||||
|
|||||||
Reference in New Issue
Block a user