fix: fix type errors - add metadata to ClineMessage, fix getResponseId method name

This commit is contained in:
Hannes Rudolph 2025-12-09 18:49:05 -07:00
parent f988dee5ca
commit f138361e87
2 changed files with 13 additions and 1 deletions

View file

@ -279,6 +279,18 @@ export const clineMessageSchema = z.object({
isProtected: z.boolean().optional(),
apiProtocol: z.union([z.literal("openai"), z.literal("anthropic")]).optional(),
isAnswered: z.boolean().optional(),
/**
* Optional metadata for API request tracking.
* Used for background mode status display.
*/
metadata: z
.object({
background: z.boolean().optional(),
backgroundStatus: z
.enum(["queued", "in_progress", "reconnecting", "polling", "completed", "failed", "canceled"])
.optional(),
})
.optional(),
})
export type ClineMessage = z.infer<typeof clineMessageSchema>

View file

@ -1703,7 +1703,7 @@ describe("OpenAI Native streaming metadata tracking", () => {
expect(chunks).toContainEqual({ type: "text", text: "A" })
expect(chunks).toContainEqual({ type: "reasoning", text: "B" })
expect(handler.getLastSequenceNumber()).toBe(3)
expect(handler.getLastResponseId()).toBe("resp_123")
expect(handler.getResponseId()).toBe("resp_123")
})
})