mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-09 10:54:59 +01:00
fix: type 'reasoning' was provided without its required following item (#2633)
This commit is contained in:
@@ -109,6 +109,7 @@ export namespace MessageV2 {
|
||||
type: z.literal("text"),
|
||||
text: z.string(),
|
||||
synthetic: z.boolean().optional(),
|
||||
metadata: z.record(z.string(), z.any()).optional(),
|
||||
time: z
|
||||
.object({
|
||||
start: z.number(),
|
||||
@@ -138,6 +139,7 @@ export namespace MessageV2 {
|
||||
callID: z.string(),
|
||||
tool: z.string(),
|
||||
state: ToolState,
|
||||
metadata: z.record(z.string(), z.any()).optional(),
|
||||
}).meta({
|
||||
ref: "ToolPart",
|
||||
})
|
||||
@@ -519,6 +521,7 @@ export namespace MessageV2 {
|
||||
{
|
||||
type: "text",
|
||||
text: part.text,
|
||||
providerMetadata: part.metadata,
|
||||
},
|
||||
]
|
||||
if (part.type === "step-start")
|
||||
@@ -536,6 +539,7 @@ export namespace MessageV2 {
|
||||
toolCallId: part.callID,
|
||||
input: part.state.input,
|
||||
output: part.state.time.compacted ? "[Old tool result content cleared]" : part.state.output,
|
||||
callProviderMetadata: part.metadata,
|
||||
},
|
||||
]
|
||||
if (part.state.status === "error")
|
||||
|
||||
@@ -873,7 +873,6 @@ export namespace SessionPrompt {
|
||||
if (value.id in reasoningMap) {
|
||||
const part = reasoningMap[value.id]
|
||||
part.text = part.text.trimEnd()
|
||||
|
||||
part.time = {
|
||||
...part.time,
|
||||
end: Date.now(),
|
||||
@@ -891,6 +890,7 @@ export namespace SessionPrompt {
|
||||
type: "tool",
|
||||
tool: value.toolName,
|
||||
callID: value.id,
|
||||
metadata: value.providerMetadata,
|
||||
state: {
|
||||
status: "pending",
|
||||
},
|
||||
@@ -910,6 +910,7 @@ export namespace SessionPrompt {
|
||||
const part = await Session.updatePart({
|
||||
...match,
|
||||
tool: value.toolName,
|
||||
metadata: match.metadata,
|
||||
state: {
|
||||
status: "running",
|
||||
input: value.input,
|
||||
@@ -1016,6 +1017,7 @@ export namespace SessionPrompt {
|
||||
sessionID: assistantMsg.sessionID,
|
||||
type: "text",
|
||||
text: "",
|
||||
metadata: value.providerMetadata,
|
||||
time: {
|
||||
start: Date.now(),
|
||||
},
|
||||
@@ -1025,6 +1027,7 @@ export namespace SessionPrompt {
|
||||
case "text-delta":
|
||||
if (currentText) {
|
||||
currentText.text += value.text
|
||||
if (value.providerMetadata) currentText.metadata = value.providerMetadata
|
||||
if (currentText.text) await Session.updatePart(currentText)
|
||||
}
|
||||
break
|
||||
@@ -1032,6 +1035,7 @@ export namespace SessionPrompt {
|
||||
case "text-end":
|
||||
if (currentText) {
|
||||
currentText.text = currentText.text.trimEnd()
|
||||
if (value.providerMetadata) currentText.metadata = value.providerMetadata
|
||||
currentText.time = {
|
||||
start: Date.now(),
|
||||
end: Date.now(),
|
||||
|
||||
Reference in New Issue
Block a user