diff --git a/packages/antigravity-cloak/README.md b/packages/antigravity-cloak/README.md index 5c5d768..2661025 100644 --- a/packages/antigravity-cloak/README.md +++ b/packages/antigravity-cloak/README.md @@ -10,7 +10,7 @@ Antigravity answers a request whose system prompt reads as Claude Code's or the - Hermes Agent's earlier default persona, `Hermes Agent, an intelligent AI assistant created by Nous Research`, which a SOUL.md the user edited keeps (Hermes' current default goes through); - oh-my-pi's first line, `RFC 2119 keywords: MUST, REQUIRED, …`. -Up to 0.1.6 this middleware put zero-width spaces (U+200B) inside them. Since 11-14 Google's check reads past invisible characters, and a broken-up line is turned away as the line itself. This middleware now leaves Claude Code's billing line out and rewords the others with the same meaning: `built on the Claude Agent SDK by Anthropic`, `built on GPT-5`, `built by Nous Research`, `RFC 2119 key words`. It does this in the system prompt only, and only in what an Antigravity account is sent. Every other provider, a Claude subscription above all, gets the prompt as the agent wrote it, even in a routing group that tries Antigravity first. A copy an older version broke up is reworded too. +Up to 0.1.6 this middleware put zero-width spaces (U+200B) inside them. Since 11-14 Google's check reads past invisible characters, and a broken-up line is turned away as the line itself. This middleware now leaves Claude Code's billing line out and rewords the others with the same meaning: `built on the Claude Agent SDK by Anthropic`, `built on GPT-5`, `built by Nous Research`, `RFC 2119 key words`. It does this in the system prompt, and only in what an Antigravity account is sent. Since 11-14 Antigravity also turns away Codex's two lines in a user's message (a pasted AGENTS.md, say), so from 0.1.8 those two are reworded in the user's messages as well; the other lines, tool results and the model's replies go as written there, since Google lets them through. Every other provider, a Claude subscription above all, gets the prompt as the agent wrote it, even in a routing group that tries Antigravity first. A copy an older version broke up is reworded too. It needs a magpie with the `onProvider` hook (v0.1.1283 or later): an older magpie loads it and never calls it, so requests go as they came. diff --git a/packages/antigravity-cloak/antigravity-cloak.middleware.js b/packages/antigravity-cloak/antigravity-cloak.middleware.js index 9f213bf..c5a4ca3 100644 --- a/packages/antigravity-cloak/antigravity-cloak.middleware.js +++ b/packages/antigravity-cloak/antigravity-cloak.middleware.js @@ -16,6 +16,11 @@ // (a Codex thread begun on a GPT model keeps its prompt after /model or a // fork onto an Antigravity one) // +// Since 11-14 Codex's two lines are turned away in a user's turn too (a +// pasted AGENTS.md, a developer message told after a reply), so they go +// reworded there as well; the other lines, tool results and the model's +// turns go as written. +// // Up to 0.1.6 this middleware put zero-width spaces (U+200B) inside them. // Since 11-14 Google's check reads past invisible characters: two U+200B in // each word, one after every character, or U+2060 instead, each line was @@ -76,26 +81,34 @@ export function onProvider(body, ctx) { const accounts = Array.isArray(o.accounts) && o.accounts.length ? o.accounts : ["antigravity"] if (!accounts.includes(ctx.provider?.account)) return const cloak = cloaker(o) + const cloakUser = cloaker({}, userLines) let changed = false - const text = (s) => { + const by = (f) => (s) => { if (typeof s !== "string") return s - const t = cloak(s) + const t = f(s) if (t !== s) changed = true return t } + const text = by(cloak) + const said = by(cloakUser) switch (ctx.protocol) { case "anthropic": body.system = typeof body.system === "string" ? text(body.system) : parts(body.system, text) + for (const m of Array.isArray(body.messages) ? body.messages : []) user(m, said) break case "chat": if (Array.isArray(body.messages)) body.messages = body.messages.filter((m) => system(m, text)) + for (const m of Array.isArray(body.messages) ? body.messages : []) user(m, said) break case "responses": body.instructions = text(body.instructions) + if (typeof body.input === "string") body.input = said(body.input) if (Array.isArray(body.input)) body.input = body.input.filter((m) => system(m, text)) + for (const m of Array.isArray(body.input) ? body.input : []) user(m, said) break case "gemini": for (const k of ["systemInstruction", "system_instruction"]) if (body[k]) body[k].parts = parts(body[k].parts, text) + for (const c of Array.isArray(body.contents) ? body.contents : []) if (c && c.role !== "model") user({ role: "user", content: c.parts }, said) break } return changed ? body : undefined @@ -111,6 +124,26 @@ function system(m, text) { return !had || (typeof m.content === "string" ? m.content !== "" : !Array.isArray(m.content) || m.content.length > 0) } +// user rewrites the text a user's message says itself, a string or text +// parts, in place: since 11-14 Antigravity also answers a bare 429 to +// Codex's GPT-5 line in a user's turn (a pasted AGENTS.md, a developer +// message magpie tells after a reply), 3 of 3 on a real account, and lets +// it through reworded (userLines). The other lines went through there as +// written, 3 of 3 each, and tool results and the model's turns went through +// with every line, so they stay. +function user(m, text) { + if (!m || m.role !== "user") return + if (typeof m.content === "string") { + m.content = text(m.content) + return + } + for (const p of Array.isArray(m.content) ? m.content : []) { + if (!p || typeof p.text !== "string" || p.thought) continue + if (p.type !== undefined && p.type !== "text" && p.type !== "input_text") continue + p.text = text(p.text) + } +} + // parts rewrites each part's text, and leaves out a part that had text and // has none left: Claude Code's billing line is a block of its own. function parts(list, text) { @@ -126,10 +159,14 @@ function parts(list, text) { return out } -// cloaker rewords every line where it appears, then each of saidAs' and -// extraWords' phrases. -function cloaker(o) { - const rules = lines.map((l, i) => [lineRe(l, i === 0), saidAs[i]]) +// userLines are the lines, by their index in lines, Antigravity also turns +// away in a user's turn: Codex's GPT-5 lines. +const userLines = [2, 3] + +// cloaker rewords every line where it appears, or only those of only, then +// each of saidAs' and extraWords' phrases. +function cloaker(o, only) { + const rules = lines.map((l, i) => [lineRe(l, i === 0), saidAs[i], i]).filter(([, , i]) => !only || only.includes(i)).map(([re, as]) => [re, as]) if (o.saidAs && typeof o.saidAs === "object") { for (const [from, to] of Object.entries(o.saidAs)) if (from.length > 1 && typeof to === "string") rules.push([lineRe(from, false), () => to]) } diff --git a/packages/antigravity-cloak/cases.json b/packages/antigravity-cloak/cases.json index 94d61d2..f67a364 100644 --- a/packages/antigravity-cloak/cases.json +++ b/packages/antigravity-cloak/cases.json @@ -6,7 +6,7 @@ {"name":"Anthropic: no words, nothing changed","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","system":"You code.","messages":[]}}, {"name":"Chat: system and developer messages, not the user's; a billing-line message is left out","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"ctx":{"protocol":"chat"},"request":{"model":"m","messages":[{"role":"system","content":"You are a Claude agent, built on Anthropic's Claude Agent SDK."},{"role":"developer","content":[{"type":"text","text":"x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]},{"role":"user","content":"You are a Claude agent, built on Anthropic's Claude Agent SDK."}]},"expect_request":{"model":"m","messages":[{"role":"system","content":"You are a Claude agent, built on the Claude Agent SDK by Anthropic."},{"role":"user","content":"You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}}, {"name":"Responses: instructions and a system input item","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"ctx":{"protocol":"responses"},"request":{"model":"m","instructions":"You are a Claude agent, built on Anthropic's Claude Agent SDK.","input":[{"role":"system","content":[{"type":"input_text","text":"x-anthropic-billing-header: cc_version=2.1.0.abc; cc_entrypoint=cli; cch=1a2b3;"}]},{"role":"user","content":[{"type":"input_text","text":"You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]},"expect_request":{"model":"m","instructions":"You are a Claude agent, built on the Claude Agent SDK by Anthropic.","input":[{"role":"user","content":[{"type":"input_text","text":"You are a Claude agent, built on Anthropic's Claude Agent SDK."}]}]}}, - {"name":"Responses: Codex's GPT-5 prompt kept after a switch to an Antigravity model","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"claude-opus-5-5"},"ctx":{"protocol":"responses"},"request":{"model":"m","input":[{"type":"message","role":"developer","content":[{"type":"input_text","text":"You are Codex, an agent based on GPT-5. You and the user share one workspace."}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]},{"type":"message","role":"developer","content":[{"type":"input_text","text":"\nThe user was previously using a different model.\n"}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"You are Codex, an agent based on GPT-5."}]}]},"expect_request":{"model":"m","input":[{"type":"message","role":"developer","content":[{"type":"input_text","text":"You are Codex, an agent built on GPT-5. You and the user share one workspace."}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]},{"type":"message","role":"developer","content":[{"type":"input_text","text":"\nThe user was previously using a different model.\n"}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"You are Codex, an agent based on GPT-5."}]}]}}, + {"name":"Responses: Codex's GPT-5 prompt kept after a switch to an Antigravity model, and the line in a user's turn","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"claude-opus-5-5"},"ctx":{"protocol":"responses"},"request":{"model":"m","input":[{"type":"message","role":"developer","content":[{"type":"input_text","text":"You are Codex, an agent based on GPT-5. You and the user share one workspace."}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]},{"type":"message","role":"developer","content":[{"type":"input_text","text":"\nThe user was previously using a different model.\n"}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"You are Codex, an agent based on GPT-5."}]}]},"expect_request":{"model":"m","input":[{"type":"message","role":"developer","content":[{"type":"input_text","text":"You are Codex, an agent built on GPT-5. You and the user share one workspace."}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]},{"type":"message","role":"developer","content":[{"type":"input_text","text":"\nThe user was previously using a different model.\n"}]},{"type":"message","role":"user","content":[{"type":"input_text","text":"You are Codex, an agent built on GPT-5."}]}]}}, {"name":"Responses: the coding agent wording, any case; magpie's own Codex prompt stays","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"claude-opus-5-5"},"ctx":{"protocol":"responses"},"request":{"model":"m","instructions":"you are codex, a coding agent based on gpt-5.","input":[{"type":"message","role":"developer","content":[{"type":"input_text","text":"You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]},"expect_request":{"model":"m","instructions":"you are codex, a coding agent built on gpt-5.","input":[{"type":"message","role":"developer","content":[{"type":"input_text","text":"You are Codex, based on GPT-5. You are running as a coding agent in the Codex CLI."}]}]}}, {"name":"Chat: Hermes Agent's earlier persona, built by Nous Research","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"ctx":{"protocol":"chat"},"request":{"model":"m","messages":[{"role":"system","content":"You are Hermes Agent, an intelligent AI assistant created by Nous Research. You are helpful, knowledgeable, and direct.\n\nYou are Hermes Agent, built by Nous Research."},{"role":"user","content":"hi"}]},"expect_request":{"model":"m","messages":[{"role":"system","content":"You are Hermes Agent, an intelligent AI assistant built by Nous Research. You are helpful, knowledgeable, and direct.\n\nYou are Hermes Agent, built by Nous Research."},{"role":"user","content":"hi"}]}}, {"name":"Gemini: systemInstruction","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"ctx":{"protocol":"gemini"},"request":{"systemInstruction":{"parts":[{"text":"You are a Claude agent, built on Anthropic's Claude Agent SDK."}]},"contents":[]},"expect_request":{"systemInstruction":{"parts":[{"text":"You are a Claude agent, built on the Claude Agent SDK by Anthropic."}]},"contents":[]}}, @@ -18,5 +18,10 @@ {"name":"omp: its RFC 2119 line wrapped with CRLF and a tab, as a real account turned it away","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"ctx":{"protocol":"gemini"},"request":{"systemInstruction":{"parts":[{"text":"RFC 2119 keywords:\tMUST, REQUIRED,\r\nSHOULD, RECOMMENDED, MAY, OPTIONAL.\r\nYou are omp."}]},"contents":[]},"expect_request":{"systemInstruction":{"parts":[{"text":"RFC 2119 key words:\tMUST, REQUIRED,\r\nSHOULD, RECOMMENDED, MAY, OPTIONAL.\r\nYou are omp."}]},"contents":[]}}, {"name":"Anthropic: a copy an older magpie broke up is reworded as the line","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","system":[{"type":"text","text":"x-a\u200bn\u200bthropic-b\u200bi\u200blling-h\u200be\u200bader: cc_version=2.1.316.2e4; cc_entrypoint=claude-desktop;"},{"type":"text","text":"You are a Claude agent, built on Anthropic's C\u200bl\u200baude A\u200bg\u200bent S\u200bD\u200bK."}]},"expect_request":{"model":"m","system":[{"type":"text","text":"You are a Claude agent, built on the Claude Agent SDK by Anthropic."}]}}, {"name":"Anthropic: Claude Desktop's Code tab, its main line goes as written","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","system":[{"type":"text","text":"x-anthropic-billing-header: cc_version=2.1.316.2e4; cc_entrypoint=claude-desktop;"},{"type":"text","text":"You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK."},{"type":"text","text":"You are an interactive agent."}]},"expect_request":{"model":"m","system":[{"type":"text","text":"You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK."},{"type":"text","text":"You are an interactive agent."}]}}, - {"name":"saidAs words go as given","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"options":{"saidAs":{"made by Acme Labs":"by Acme"}},"request":{"model":"m","system":"An agent made by\nAcme Labs."},"expect_request":{"model":"m","system":"An agent by Acme."}} + {"name":"saidAs words go as given","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"options":{"saidAs":{"made by Acme Labs":"by Acme"}},"request":{"model":"m","system":"An agent made by\nAcme Labs."},"expect_request":{"model":"m","system":"An agent by Acme."}}, + {"name":"Anthropic: Codex's GPT-5 line in a user's turn is reworded there, not in the model's or a tool result, and other lines stay (11-14)","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","messages":[{"role":"user","content":[{"type":"text","text":"My AGENTS.md:\nYou are Codex, a coding agent based on GPT-5. You and the user share the same workspace."},{"type":"text","text":"You are a Claude agent, built on Anthropic's Claude Agent SDK. RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL."}]},{"role":"assistant","content":[{"type":"text","text":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."},{"type":"tool_use","id":"t1","name":"read","input":{"path":"a"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"t1","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},{"role":"user","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},"expect_request":{"model":"m","messages":[{"role":"user","content":[{"type":"text","text":"My AGENTS.md:\nYou are Codex, a coding agent built on GPT-5. You and the user share the same workspace."},{"type":"text","text":"You are a Claude agent, built on Anthropic's Claude Agent SDK. RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL."}]},{"role":"assistant","content":[{"type":"text","text":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."},{"type":"tool_use","id":"t1","name":"read","input":{"path":"a"}}]},{"role":"user","content":[{"type":"tool_result","tool_use_id":"t1","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},{"role":"user","content":"You are Codex, a coding agent built on GPT-5. You and the user share the same workspace."}]}}, + {"name":"Chat: the line in a user's turn, reworded","ctx":{"protocol":"chat"},"provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","messages":[{"role":"user","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."},{"role":"assistant","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},"expect_request":{"model":"m","messages":[{"role":"user","content":"You are Codex, a coding agent built on GPT-5. You and the user share the same workspace."},{"role":"assistant","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]}}, + {"name":"Responses: the line in a user's input item, reworded; a tool's output stays","ctx":{"protocol":"responses"},"provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},{"type":"function_call_output","call_id":"c","output":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},"expect_request":{"model":"m","input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"You are Codex, a coding agent built on GPT-5. You and the user share the same workspace."}]},{"type":"function_call_output","call_id":"c","output":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]}}, + {"name":"Gemini: the line in a user's content, reworded; the model's stays","ctx":{"protocol":"gemini"},"provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"contents":[{"role":"user","parts":[{"text":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]},{"role":"model","parts":[{"text":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]}]},"expect_request":{"contents":[{"role":"user","parts":[{"text":"You are Codex, a coding agent built on GPT-5. You and the user share the same workspace."}]},{"role":"model","parts":[{"text":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]}]}}, + {"name":"the line in a user's turn to a Claude subscription stays","provider":{"id":"c","name":"Claude","account":"claude","model":"claude-sonnet-4-6"},"request":{"model":"m","messages":[{"role":"user","content":"You are Codex, a coding agent based on GPT-5. You and the user share the same workspace."}]}} ] diff --git a/packages/antigravity-cloak/package.json b/packages/antigravity-cloak/package.json index bd19f4d..7e2e120 100644 --- a/packages/antigravity-cloak/package.json +++ b/packages/antigravity-cloak/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/middleware-antigravity-cloak", - "version": "0.1.7", + "version": "0.1.8", "description": "magpie gateway middleware: Antigravity stops turning Claude Code's and the Claude Agent SDK's system prompts away, and no other provider's request is changed", "type": "module", "files": ["antigravity-cloak.middleware.js", "README.md"], diff --git a/packages/antigravity/index.mjs b/packages/antigravity/index.mjs index a6f636c..400da9a 100644 --- a/packages/antigravity/index.mjs +++ b/packages/antigravity/index.mjs @@ -965,10 +965,20 @@ const SAID_AS = { "rfc 2119 keywords: must, required, should, recommended, may, optional.": (line) => line.replace(/(key)(words)/i, "$1 $2"), } -function cloak(system) { +// USER_TURNED_AWAY are the lines Antigravity also turns away in a user's +// turn: since 11-14 Codex's GPT-5 lines there got a bare 429 "Resource has +// been exhausted" 3 of 3 on a real account, where a pasted AGENTS.md or a +// developer message told after a reply puts them, and went through +// reworded. The others went through as written there, 3 of 3 each, and so +// did all of them in the model's turns and in tool results. +const USER_TURNED_AWAY = TURNED_AWAY.filter((l) => l.startsWith("you are codex, ")) + +// cloak rewords the lines of only, or of TURNED_AWAY when only is left out +function cloak(system, only) { if (!turnsAway(system)) return system const at = [] TURNED_AWAY_RE.forEach((re, i) => { + if (only && !only.includes(TURNED_AWAY[i])) return for (const m of system.matchAll(re)) at.push([m.index, m.index + m[0].length, SAID_AS[TURNED_AWAY[i]]]) }) at.sort((a, b) => a[0] - b[0]) @@ -1098,6 +1108,12 @@ function shape(req, sent, at, effort) { } if (Array.isArray(req.contents)) { for (const c of req.contents) { + // since 11-14 Antigravity also answers a bare 429 to Codex's GPT-5 + // line in a user's turn (a pasted AGENTS.md, a developer message + // told after a reply), 3 of 3 on a real account, and lets it + // through reworded; the model's turns and tool results went through + // as written, so they stay + if (c?.role !== "model") for (const p of c?.parts ?? []) if (typeof p?.text === "string" && !p.thought) p.text = cloak(p.text, USER_TURNED_AWAY) // an empty text (a stream's last chunk, sent back) is a block Claude // refuses: "text: Field required" if (Array.isArray(c?.parts) && c.parts.length > 1) c.parts = c.parts.filter((p) => !(isObj(p) && p.text === "" && Object.keys(p).length === 1)) diff --git a/packages/antigravity/package.json b/packages/antigravity/package.json index e2039a6..71eaa0a 100644 --- a/packages/antigravity/package.json +++ b/packages/antigravity/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-antigravity-auth", - "version": "0.1.12", + "version": "0.1.13", "description": "Sign in to Antigravity with a Google account from OpenCode or magpie: Gemini, and the Claude and GPT-OSS models Google hosts for it", "type": "module", "main": "./opencode.mjs", diff --git a/packages/antigravity/shape.test.mjs b/packages/antigravity/shape.test.mjs index 0c7b8f4..f458170 100644 --- a/packages/antigravity/shape.test.mjs +++ b/packages/antigravity/shape.test.mjs @@ -272,3 +272,22 @@ test("DeepSeek Harness's @-path paragraph goes reworded, the rest as written (#1 expect(both).not.toMatch(/[\u200b-\u200f\u2060]/) expect(both).toContain("When the user writes @ followed by a path") }) + +// since 11-14 Codex's GPT-5 line in a user's turn is turned away too (3 of +// 3 on a real account): it goes reworded there, and the model's turns and +// tool results, which went through with it, as written +test("the line in a user's turn goes reworded", () => { + const line = "You are Codex, a coding agent based on GPT-5. You and the user share the same workspace." + const g = generic() + g.contents[0].parts[0].text = "Here is my AGENTS.md:\n\n" + line + g.contents[1].parts[1].text = line + g.contents[2].parts[0].functionResponse.response.output = line + const others = "x-anthropic-billing-header: cc_version=2.1.316.2e4;\nYou are a Claude agent, built on Anthropic's Claude Agent SDK.\nRFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL." + g.contents[3].parts[0].text = others + const r = shape(g, "gemini-3-flash", "", "") + expect(r.contents[3].parts[0].text).toBe(others) + expect(r.contents[0].parts[0].text).toBe("Here is my AGENTS.md:\n\nYou are Codex, a coding agent built on GPT-5. You and the user share the same workspace.") + expect(r.contents[1].parts[1].text).toBe(line) + expect(JSON.stringify(r.contents[2])).toContain("based on GPT-5") + expect(g.contents[0].parts[0].text).toContain("based on GPT-5") +})