mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-24 14:55:19 +00:00
fix test
This commit is contained in:
@@ -515,8 +515,10 @@ export namespace MessageV2 {
|
||||
state: "output-available",
|
||||
toolCallId: part.callID,
|
||||
input: part.state.input,
|
||||
// For compacted results, use plain string so SDK serializes as text type
|
||||
// For normal results, pass object so toModelOutput can convert attachments to media parts
|
||||
output: part.state.time.compacted
|
||||
? { output: "[Old tool result content cleared]", attachments: undefined }
|
||||
? "[Old tool result content cleared]"
|
||||
: { output: part.state.output, attachments: part.state.attachments },
|
||||
callProviderMetadata: part.metadata,
|
||||
})
|
||||
|
||||
@@ -716,7 +716,9 @@ export namespace SessionPrompt {
|
||||
)
|
||||
return result
|
||||
},
|
||||
toModelOutput(result: { output: string; attachments?: MessageV2.FilePart[] }) {
|
||||
toModelOutput(result: string | { output: string; attachments?: MessageV2.FilePart[] }) {
|
||||
// Handle compacted results (plain string)
|
||||
if (typeof result === "string") return { type: "text", value: result }
|
||||
if (!result.attachments?.length) return { type: "text", value: result.output }
|
||||
return {
|
||||
type: "content",
|
||||
@@ -814,7 +816,9 @@ export namespace SessionPrompt {
|
||||
content: result.content, // directly return content to preserve ordering when outputting to model
|
||||
}
|
||||
}
|
||||
item.toModelOutput = (result: { output: string; attachments?: MessageV2.FilePart[] }) => {
|
||||
item.toModelOutput = (result: string | { output: string; attachments?: MessageV2.FilePart[] }) => {
|
||||
// Handle compacted results (plain string)
|
||||
if (typeof result === "string") return { type: "text", value: result }
|
||||
if (!result.attachments?.length) return { type: "text", value: result.output }
|
||||
return {
|
||||
type: "content",
|
||||
|
||||
Reference in New Issue
Block a user