From adcb951d5d0e5cd0a7201aed919caf3a9d0ea5c4 Mon Sep 17 00:00:00 2001 From: can1357 Date: Sat, 27 Jun 2026 02:07:14 +0200 Subject: [PATCH] feat(ai): add system message schema and include it in messageSchema union --- .../ai/src/providers/anthropic-messages-server-schema.ts | 7 ++++++- packages/tui/test/terminal-capabilities.test.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/ai/src/providers/anthropic-messages-server-schema.ts b/packages/ai/src/providers/anthropic-messages-server-schema.ts index 7aec825f0..0835883b0 100644 --- a/packages/ai/src/providers/anthropic-messages-server-schema.ts +++ b/packages/ai/src/providers/anthropic-messages-server-schema.ts @@ -135,12 +135,17 @@ export const userMessageSchema = type({ content: type("string").or(userContentBlockSchema.array()), }); +export const systemMessageSchema = type({ + role: "'system'", + content: type("string").or(systemBlockSchema.array()), +}); + export const assistantMessageSchema = type({ role: "'assistant'", content: type("string").or(assistantContentBlockSchema.array()), }); -export const messageSchema = userMessageSchema.or(assistantMessageSchema); +export const messageSchema = userMessageSchema.or(assistantMessageSchema).or(systemMessageSchema); // ─── Tools ───────────────────────────────────────────────────────────────── diff --git a/packages/tui/test/terminal-capabilities.test.ts b/packages/tui/test/terminal-capabilities.test.ts index 9c30b4907..ef853f63b 100644 --- a/packages/tui/test/terminal-capabilities.test.ts +++ b/packages/tui/test/terminal-capabilities.test.ts @@ -112,7 +112,11 @@ describe("Warp terminal capabilities", () => { }); it("resolves the process-wide Warp terminal id and image protocol from TERM_PROGRAM", async () => { - const env: Record = { ...Bun.env, TERM_PROGRAM: "WarpTerminal", COLORTERM: "truecolor" }; + const env: Record = { + ...Bun.env, + TERM_PROGRAM: "WarpTerminal", + COLORTERM: "truecolor", + }; for (const key of [ "PI_FORCE_IMAGE_PROTOCOL", "WSL_DISTRO_NAME",