diff --git a/packages/agy-cli/README.en.md b/packages/agy-cli/README.en.md
index 44b8afa..8b0d224 100644
--- a/packages/agy-cli/README.en.md
+++ b/packages/agy-cli/README.en.md
@@ -239,8 +239,10 @@ start of the first prompt.
Antigravity answers a 429 "Resource has been exhausted" to a few system
prompt lines whatever quota is left (Claude Code's billing line, the Claude
Agent SDK, Codex and Hermes Agent identities, oh-my-pi's RFC 2119 line). The
-plugin breaks each of them up with zero-width spaces before agy sends it, as
-the Antigravity provider does (`cloak.mjs`). Should such a 429 still come
+plugin breaks each of them up with zero-width spaces before agy sends it, and
+sends oh-my-pi's line as "RFC 2119 key words: …" (a broken-up copy of it was
+still turned away now and then), as the Antigravity provider does
+(`cloak.mjs`). Should such a 429 still come
back, it is reported as a 400 about the prompt, not as a quota.
DeepSeek Harness's paragraph on `@` paths ("Tokens prefixed with @ are
diff --git a/packages/agy-cli/README.md b/packages/agy-cli/README.md
index 8a05b45..f001192 100644
--- a/packages/agy-cli/README.md
+++ b/packages/agy-cli/README.md
@@ -181,7 +181,7 @@ magpie quota refresh agy-cli --json
Antigravity 对几行系统提示词(Claude Code 的计费行、Claude Agent SDK、Codex 和 Hermes Agent
的身份句、oh-my-pi 的 RFC 2119 行)不论余量多少都回 429 "Resource has been exhausted"。插件在
-agy 发出之前用零宽空格把这几行拆开,和 Antigravity 提供商的做法一样(`cloak.mjs`)。如果仍然
+agy 发出之前用零宽空格把这几行拆开,oh-my-pi 那行改成 "RFC 2119 key words: …" 发出(拆开的那行仍会时不时被拒),和 Antigravity 提供商的做法一样(`cloak.mjs`)。如果仍然
回了这样的 429,会报成针对提示词的 400,而不是额度用完。
DeepSeek Harness 的 `@` 路径说明段("Tokens prefixed with @ are paths…")也和 Antigravity 提供商一样
diff --git a/packages/agy-cli/cloak.mjs b/packages/agy-cli/cloak.mjs
index 0d73ce2..d968c94 100644
--- a/packages/agy-cli/cloak.mjs
+++ b/packages/agy-cli/cloak.mjs
@@ -25,36 +25,52 @@ export const TURNED_AWAY = [
const ZW = ""
-export function turnsAway(system) {
- const low = String(system ?? "").toLowerCase()
- return TURNED_AWAY.some((l) => low.includes(l))
+// lineRe matches line in any case and with any run of white space between
+// its words, as Google's check does (a line break, a tab, two spaces or a
+// no-break space for one space; packages/antigravity's lineRe). \s takes no
+// zero-width space, so a line already broken up isn't matched again.
+const lineRe = (line) => new RegExp(line.split(" ").map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\s+"), "gi")
+const TURNED_AWAY_RE = TURNED_AWAY.map(lineRe)
+const has = (s, re) => {
+ re.lastIndex = 0
+ const yes = re.test(s)
+ re.lastIndex = 0
+ return yes
}
+const said = (system, line) => has(system, TURNED_AWAY_RE[TURNED_AWAY.indexOf(line)])
-const asciiLower = (s) => s.replace(/[A-Z]/g, (c) => c.toLowerCase())
+export function turnsAway(system) {
+ const s = String(system ?? "")
+ return TURNED_AWAY_RE.some((re) => has(s, re))
+}
// breakUp puts a zero-width space after the first and after the second
// character of every run of three or more letters or digits in a line.
// One after the first letter only stopped working on 11-11.
const breakUp = (line) => line.replace(/[A-Za-z0-9]{3,}/g, (w) => w[0] + ZW + w[1] + ZW + w.slice(2))
+// SAID_AS are the lines no zero-width space gets through reliably, each
+// with how it goes instead: a rewording that keeps its meaning. omp's
+// RFC 2119 line, broken up as the others are (or after every character,
+// or with U+2060 or a soft hyphen), was still turned away 1 to 3 times in
+// 10 on a real account on 11-14, while "key words", the RFC's own term,
+// went through 10 times in 10 (eric_li8983 on X).
+const SAID_AS = {
+ "rfc 2119 keywords: must, required, should, recommended, may, optional.": (line) => line.replace(/(key)(words)/i, "$1 $2"),
+}
+
export function cloak(system) {
if (typeof system !== "string" || !turnsAway(system)) return system
- const low = asciiLower(system)
const at = []
- for (const line of TURNED_AWAY) {
- for (let i = 0; ; ) {
- const j = low.indexOf(line, i)
- if (j < 0) break
- at.push([j, j + line.length])
- i = j + line.length
- }
- }
+ TURNED_AWAY_RE.forEach((re, i) => {
+ for (const m of system.matchAll(re)) at.push([m.index, m.index + m[0].length, SAID_AS[TURNED_AWAY[i]] ?? breakUp])
+ })
at.sort((a, b) => a[0] - b[0])
let out = ""
let prev = 0
- for (const [from, to] of at) {
+ for (const [from, to, as] of at) {
if (from < prev) continue
- out += system.slice(prev, from) + breakUp(system.slice(from, to))
+ out += system.slice(prev, from) + as(system.slice(from, to))
prev = to
}
return out + system.slice(prev)
@@ -90,12 +106,12 @@ const HERMES_HINT =
"Antigravity answers this 429 to Hermes Agent's earlier default persona (its SOUL.md) whatever quota is left, so it is not a quota and waiting won't help; Hermes' current default persona goes through, so put it in SOUL.md, or use another provider for these chats"
const RFC_HINT =
- "Antigravity answers this 429 to the line \"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\" that starts oh-my-pi (omp)'s system prompt, and to any prompt that has it, whatever quota is left, so it is not a quota and waiting won't help; magpie breaks that line up before it goes, so this one came from a copy of it that was worded another way"
+ "Antigravity answers this 429 to the line \"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\" that starts oh-my-pi (omp)'s system prompt, and to any prompt that has it, whatever quota is left, so it is not a quota and waiting won't help; magpie sends that line as \"RFC 2119 key words: …\", which goes through, so this one came from a copy of it that was worded another way"
export function hint(system) {
- const low = String(system ?? "").toLowerCase()
- if (low.includes("rfc 2119 keywords: must, required, should, recommended, may, optional.")) return RFC_HINT
- if (low.includes("you are codex, an agent based on gpt-5") || low.includes("you are codex, a coding agent based on gpt-5")) return CODEX_HINT
- if (low.includes("hermes agent, an intelligent ai assistant created by nous research")) return HERMES_HINT
+ system = String(system ?? "")
+ if (said(system, "rfc 2119 keywords: must, required, should, recommended, may, optional.")) return RFC_HINT
+ if (said(system, "you are codex, an agent based on gpt-5") || said(system, "you are codex, a coding agent based on gpt-5")) return CODEX_HINT
+ if (said(system, "hermes agent, an intelligent ai assistant created by nous research")) return HERMES_HINT
return HINT
}
diff --git a/packages/agy-cli/cloak.test.mjs b/packages/agy-cli/cloak.test.mjs
index 1b62ba8..607bce1 100644
--- a/packages/agy-cli/cloak.test.mjs
+++ b/packages/agy-cli/cloak.test.mjs
@@ -15,14 +15,18 @@ const samples = [
"You are Hermes Agent, an intelligent AI assistant created by Nous Research.",
"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\n\nYou are omp.",
"Two: RFC 2119 KEYWORDS: must, required, should, recommended, may, optional. and x-anthropic-billing-header: x",
+ "RFC 2119 keywords: MUST, REQUIRED,\r\nSHOULD, RECOMMENDED, MAY, OPTIONAL.\r\n",
+ "\nRFC 2119\nkeywords:\tMUST, REQUIRED, SHOULD, RECOMMENDED, MAY,\u00a0OPTIONAL.\n",
+ "You are Hermes Agent, an intelligent\nAI assistant created by Nous Research.",
+ "RFC 2119 keywords: MUST,REQUIRED,SHOULD,RECOMMENDED,MAY,OPTIONAL.",
"Nothing to see here; Claude Agent SDK alone is fine.",
"",
]
-test("every turned-away line is broken up, and the model still reads it", () => {
+test("every turned-away line is broken up or reworded, and the model still reads it", () => {
for (const s of samples) {
const out = cloak(s)
- expect(out.replaceAll(ZW, "")).toBe(s)
+ expect(out.replaceAll(ZW, "").replace(/key words/i, (m) => m.replace(" ", ""))).toBe(s)
if (turnsAway(s)) {
expect(out).not.toBe(s)
expect(turnsAway(out)).toBe(false)
@@ -31,10 +35,20 @@ test("every turned-away line is broken up, and the model still reads it", () =>
}
}
expect(cloak("RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.")).toBe(
- `R${ZW}F${ZW}C 2${ZW}1${ZW}19 k${ZW}e${ZW}ywords: M${ZW}U${ZW}ST, R${ZW}E${ZW}QUIRED, S${ZW}H${ZW}OULD, R${ZW}E${ZW}COMMENDED, M${ZW}A${ZW}Y, O${ZW}P${ZW}TIONAL.`,
+ "RFC 2119 key words: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
)
})
+test("a turned-away line wrapped or widened by white space is broken up too", () => {
+ for (const s of [samples[7], samples[8], samples[9]]) {
+ expect(turnsAway(s)).toBe(true)
+ expect(cloak(s)).not.toBe(s)
+ expect(turnsAway(cloak(s))).toBe(false)
+ }
+ expect(hint(samples[8])).toContain("oh-my-pi (omp)")
+ expect(turnsAway(samples[10])).toBe(false)
+})
+
test("agy-cli and antigravity break up and explain the same lines", () => {
for (const line of TURNED_AWAY) {
expect(antigravity.turnsAway(line)).toBe(true)
diff --git a/packages/agy-cli/package.json b/packages/agy-cli/package.json
index 76ddc54..27408ed 100644
--- a/packages/agy-cli/package.json
+++ b/packages/agy-cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-agy-cli-auth",
- "version": "0.1.39",
+ "version": "0.1.40",
"description": "Magpie/OpenCode model provider that connects your local agy CLI through the Agent Client Protocol (agy acp), so Antigravity subscription models run through the real CLI",
"type": "module",
"main": "./opencode.mjs",
diff --git a/packages/agy-cli/test/smoke.mjs b/packages/agy-cli/test/smoke.mjs
index ccef1a5..f2b0691 100644
--- a/packages/agy-cli/test/smoke.mjs
+++ b/packages/agy-cli/test/smoke.mjs
@@ -1364,14 +1364,15 @@ for (const [title, tools, want, name] of [
const rfc = "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL."
const sdk = "You are a Claude agent, built on Anthropic's Claude Agent SDK."
const system = `${rfc}\nx-anthropic-billing-header: cc_version=2.1.0; cch=1;\n${sdk}\nCLOAK-MARKER`
- const plain = (text) => String(text ?? "").replaceAll(zw, "")
+ // omp's line goes as RFC 2119's own "key words", the others broken up
+ const plain = (text) => String(text ?? "").replaceAll(zw, "").replaceAll("RFC 2119 key words:", "RFC 2119 keywords:")
const body = { model, system, messages: [{ role: "user", content: "cloak session instructions" }] }
const events = (await readSSE(await callFetch(body))).events
const init = inits().at(-1)
const sent = init.systemAppend ?? ""
check("#980 a turned-away line is broken up in the session instructions",
sent.includes("CLOAK-MARKER") && !sent.includes(rfc) && !sent.includes("x-anthropic-billing-header") && !sent.includes("Claude Agent SDK") &&
- sent.includes("R" + zw + "F" + zw + "C 2" + zw + "1" + zw + "19") && sent.includes("C" + zw + "l" + zw + "aude A" + zw + "g" + zw + "ent S" + zw + "D" + zw + "K") &&
+ sent.includes("RFC 2119 key words: MUST,") && sent.includes("C" + zw + "l" + zw + "aude A" + zw + "g" + zw + "ent S" + zw + "D" + zw + "K") &&
plain(sent).includes(system), JSON.stringify(sent))
const convId = init.convId
const before = inits().length
diff --git a/packages/antigravity-cloak/antigravity-cloak.middleware.js b/packages/antigravity-cloak/antigravity-cloak.middleware.js
index 89a81bc..aa64ca8 100644
--- a/packages/antigravity-cloak/antigravity-cloak.middleware.js
+++ b/packages/antigravity-cloak/antigravity-cloak.middleware.js
@@ -18,7 +18,9 @@
// each. This middleware puts one after the first letter of each word in
// what Antigravity alone is sent (onProvider, ctx.provider.account): every
// other provider, a Claude subscription above all, gets the prompt as the
-// agent wrote it. The model reads the words as before.
+// agent wrote it. The model reads the words as before. omp's line goes as
+// "RFC 2119 key words: …" instead (saidAs): broken up, Google still turned
+// it away now and then.
//
// {"extraWords": [], "accounts": ["antigravity"], "off": false}
//
@@ -32,6 +34,15 @@ export const words = ["x-anthropic-billing-header", "Claude Agent SDK", "You are
const zwsp = ""
+// saidAs are the words no zero-width space gets through reliably, each with
+// how it goes instead, a rewording that keeps its meaning: omp's line broken
+// up was still turned away 1 to 3 times in 10 on a real account on 11-14,
+// whatever the invisible character, while "key words", RFC 2119's own term,
+// went through 10 times in 10.
+const saidAs = {
+ "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.": (m) => m.replace(/(key)(words)/i, "$1 $2"),
+}
+
export function onProvider(body, ctx) {
const o = ctx.options || {}
if (o.off) return
@@ -80,11 +91,17 @@ function parts(list, text) {
// run of three or more letters or digits in it. One after the first letter
// only stopped working on 11-11, when Google turned
// "x\u200b-anthropic-billing-header" and "C\u200blaude Agent SDK" away again.
+//
+// A word matches with any run of white space where it has a space: Google's
+// check read omp's line wrapped after "REQUIRED," or with a tab or a no-break
+// space for a space as it read the line itself (a real account, 11-14).
function cloaker(list) {
- const res = list.map((w) => new RegExp(w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "gi"))
+ const res = list.map((w) => new RegExp(w.split(" ").map((p) => p.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\s+"), "gi"))
const two = (m) => m.replace(/[A-Za-z0-9]{3,}/g, (w) => w[0] + zwsp + w[1] + zwsp + w.slice(2))
return (s) => {
- for (const re of res) s = s.replace(re, two)
+ list.forEach((w, i) => {
+ s = s.replace(res[i], saidAs[w] ?? two)
+ })
return s
}
}
diff --git a/packages/antigravity-cloak/cases.json b/packages/antigravity-cloak/cases.json
index 4958aae..d9db27b 100644
--- a/packages/antigravity-cloak/cases.json
+++ b/packages/antigravity-cloak/cases.json
@@ -14,5 +14,6 @@
{"name": "accounts says which subscriptions", "provider": {"id": "g", "name": "Gemini", "account": "gemini", "model": "m"}, "options": {"accounts": ["gemini"]}, "request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}, "expect_request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's C\u200bl\u200baude A\u200bg\u200bent S\u200bD\u200bK."}},
{"name": "off leaves it", "provider": {"id": "7c1958d885953cd3", "name": "Antigravity", "account": "antigravity", "model": "gemini-3-flash"}, "options": {"off": true}, "request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}},
{"name": "onRequest isn't there: before routing nothing is changed", "request": {"model": "m", "system": "You are a Claude agent, built on Anthropic's Claude Agent SDK."}},
- {"name":"omp: its RFC 2119 line, to Antigravity","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","system":[{"type":"text","text":"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL. `NEVER` = `MUST NOT`."}],"messages":[{"role":"user","content":"hi"}]},"expect_request":{"model":"m","system":[{"type":"text","text":"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL. `NEVER` = `MUST NOT`."}],"messages":[{"role":"user","content":"hi"}]}}
+ {"name":"omp: its RFC 2119 line, to Antigravity","provider":{"id":"7c1958d885953cd3","name":"Antigravity","account":"antigravity","model":"gemini-3-flash"},"request":{"model":"m","system":[{"type":"text","text":"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL. `NEVER` = `MUST NOT`."}],"messages":[{"role":"user","content":"hi"}]},"expect_request":{"model":"m","system":[{"type":"text","text":"RFC 2119 key words: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL. `NEVER` = `MUST NOT`."}],"messages":[{"role":"user","content":"hi"}]}},
+ {"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": []}}
]
diff --git a/packages/antigravity-cloak/package.json b/packages/antigravity-cloak/package.json
index 46fbfbb..4d9c850 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.5",
+ "version": "0.1.6",
"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/README.md b/packages/antigravity/README.md
index 3ec06cc..7d0b6f0 100644
--- a/packages/antigravity/README.md
+++ b/packages/antigravity/README.md
@@ -88,7 +88,8 @@ The plugin also changes the request itself, as the built-in did:
- **System prompt:** lines Antigravity turns away (Claude Code's billing
header, Codex's and Hermes Agent's own prompts, omp's RFC 2119 line) are broken up with a
- zero-width space.
+ zero-width space; omp's line goes as "RFC 2119 key words: …", since a
+ broken-up copy of it was still turned away now and then.
DeepSeek Harness's paragraph on `@` paths ("Tokens prefixed with @ are
paths…") goes reworded with the same meaning: word for word, it got most
`gemini-4-argon` answers fast, without thinking and shallow (#1028).
diff --git a/packages/antigravity/index.mjs b/packages/antigravity/index.mjs
index 5cf9350..06c4d8d 100644
--- a/packages/antigravity/index.mjs
+++ b/packages/antigravity/index.mjs
@@ -910,12 +910,24 @@ const TURNED_AWAY = [
const ZW = ""
-const turnsAway = (system) => {
- const low = system.toLowerCase()
- return TURNED_AWAY.some((l) => low.includes(l))
+// lineRe matches line in any case and with any run of white space between
+// its words: Google's check reads a line break, a tab, two spaces or a
+// no-break space where the line has one space, and turned omp's line away
+// wrapped after "REQUIRED," or after "RFC 2119" as it did on one line, while
+// a missing period, a space dropped after a comma or the words in another
+// order went through (a real account, 11-14). JavaScript's \s takes no
+// zero-width space, so a line already broken up isn't matched again.
+const lineRe = (line) => new RegExp(line.split(" ").map((w) => w.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("\\s+"), "gi")
+const TURNED_AWAY_RE = TURNED_AWAY.map(lineRe)
+const has = (s, re) => {
+ re.lastIndex = 0
+ const yes = re.test(s)
+ re.lastIndex = 0
+ return yes
}
+const said = (system, line) => has(system, TURNED_AWAY_RE[TURNED_AWAY.indexOf(line)])
-const asciiLower = (s) => s.replace(/[A-Z]/g, (c) => c.toLowerCase())
+const turnsAway = (system) => TURNED_AWAY_RE.some((re) => has(system, re))
// breakUp puts a zero-width space after the first and after the second
// character of every run of three or more letters or digits in a line.
@@ -924,24 +936,28 @@ const asciiLower = (s) => s.replace(/[A-Z]/g, (c) => c.toLowerCase())
// Agent SDK" away again, and answered each word broken twice.
const breakUp = (line) => line.replace(/[A-Za-z0-9]{3,}/g, (w) => w[0] + ZW + w[1] + ZW + w.slice(2))
+// SAID_AS are the lines no zero-width space gets through reliably, each
+// with how it goes instead: a rewording that keeps its meaning. omp's
+// RFC 2119 line, broken up as the others are (or after every character,
+// or with U+2060 or a soft hyphen), was still turned away 1 to 3 times in
+// 10 on a real account on 11-14, while "key words", the RFC's own term,
+// went through 10 times in 10 (eric_li8983 on X).
+const SAID_AS = {
+ "rfc 2119 keywords: must, required, should, recommended, may, optional.": (line) => line.replace(/(key)(words)/i, "$1 $2"),
+}
+
function cloak(system) {
if (!turnsAway(system)) return system
- const low = asciiLower(system)
const at = []
- for (const line of TURNED_AWAY) {
- for (let i = 0; ; ) {
- const j = low.indexOf(line, i)
- if (j < 0) break
- at.push([j, j + line.length])
- i = j + line.length
- }
- }
+ TURNED_AWAY_RE.forEach((re, i) => {
+ for (const m of system.matchAll(re)) at.push([m.index, m.index + m[0].length, SAID_AS[TURNED_AWAY[i]] ?? breakUp])
+ })
at.sort((a, b) => a[0] - b[0])
let out = ""
let prev = 0
- for (const [from, to] of at) {
+ for (const [from, to, as] of at) {
if (from < prev) continue
- out += system.slice(prev, from) + breakUp(system.slice(from, to))
+ out += system.slice(prev, from) + as(system.slice(from, to))
prev = to
}
return out + system.slice(prev)
@@ -955,13 +971,12 @@ const HERMES_HINT =
"Antigravity answers this 429 to Hermes Agent's earlier default persona (its SOUL.md) whatever quota is left, so it is not a quota and waiting won't help; Hermes' current default persona goes through, so put it in SOUL.md, or use another provider for these chats"
const RFC_HINT =
- "Antigravity answers this 429 to the line \"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\" that starts oh-my-pi (omp)'s system prompt, and to any prompt that has it, whatever quota is left, so it is not a quota and waiting won't help; magpie breaks that line up before it goes, so this one came from a copy of it that was worded another way"
+ "Antigravity answers this 429 to the line \"RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\" that starts oh-my-pi (omp)'s system prompt, and to any prompt that has it, whatever quota is left, so it is not a quota and waiting won't help; magpie sends that line as \"RFC 2119 key words: …\", which goes through, so this one came from a copy of it that was worded another way"
function hint(system) {
- const low = system.toLowerCase()
- if (low.includes("rfc 2119 keywords: must, required, should, recommended, may, optional.")) return RFC_HINT
- if (low.includes("you are codex, an agent based on gpt-5") || low.includes("you are codex, a coding agent based on gpt-5")) return CODEX_HINT
- if (low.includes("hermes agent, an intelligent ai assistant created by nous research")) return HERMES_HINT
+ if (said(system, "rfc 2119 keywords: must, required, should, recommended, may, optional.")) return RFC_HINT
+ if (said(system, "you are codex, an agent based on gpt-5") || said(system, "you are codex, a coding agent based on gpt-5")) return CODEX_HINT
+ if (said(system, "hermes agent, an intelligent ai assistant created by nous research")) return HERMES_HINT
return HINT
}
diff --git a/packages/antigravity/package.json b/packages/antigravity/package.json
index 0ecea42..1d6d0f8 100644
--- a/packages/antigravity/package.json
+++ b/packages/antigravity/package.json
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-antigravity-auth",
- "version": "0.1.10",
+ "version": "0.1.11",
"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/requests.test.mjs b/packages/antigravity/requests.test.mjs
index 1e757a9..af6eae7 100644
--- a/packages/antigravity/requests.test.mjs
+++ b/packages/antigravity/requests.test.mjs
@@ -84,6 +84,7 @@ test("a 429 to a turned-away system prompt is a 400, not a quota", async () => {
["You are Codex, a coding agent based on GPT-5.", "Codex's own system prompt"],
["You are Hermes Agent, an intelligent AI assistant created by Nous Research.", "Hermes Agent's earlier default persona"],
["RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.\n\n§ Role", "oh-my-pi (omp)'s system prompt"],
+ ["RFC 2119 keywords: MUST, REQUIRED,\r\nSHOULD, RECOMMENDED, MAY, OPTIONAL.\r\n\r\n§ Role", "oh-my-pi (omp)'s system prompt"],
]) {
const res = await f(URL_("gemini-3-flash"), { method: "POST", body: ask("hi", { systemInstruction: { parts: [{ text: sys }] } }) })
expect(res.status).toBe(400)
diff --git a/packages/antigravity/shape.test.mjs b/packages/antigravity/shape.test.mjs
index e5b382c..71c6ea0 100644
--- a/packages/antigravity/shape.test.mjs
+++ b/packages/antigravity/shape.test.mjs
@@ -100,16 +100,58 @@ test("a tool's images follow every response, for Claude", () => {
expect(shape(g, "gemini-3-flash", "", "").contents[2].parts.length).toBe(5)
})
-test("omp's RFC 2119 line is broken up, as the real account turned it away", () => {
+test("omp's RFC 2119 line goes as RFC 2119's own \"key words\", as the real account turned it away", () => {
const line = "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL."
const sys = line + " `NEVER` = `MUST NOT`; `AVOID` = `SHOULD NOT`.\n\n§ Role"
const out = cloak(sys)
- expect(out).not.toBe(sys)
- expect(out.replaceAll("\u200b", "")).toBe(sys)
- expect(out).toContain("R\u200bF\u200bC 2\u200b1\u200b19 k\u200be\u200bywords: M\u200bU\u200bST,")
+ // a zero-width break of this line was turned away 1 to 3 times in 10 on
+ // 11-14; "key words" went through 10 of 10
+ expect(out).toBe(sys.replace("keywords", "key words"))
+ expect(out).not.toContain("\u200b")
expect(cloak("RFC 2119 keywords: MUST")).toBe("RFC 2119 keywords: MUST")
})
+// omp 18.20.0's first line, byte for byte (src/prompts/system/system-prompt.md),
+// and the copies of it a real account turned away on 11-14 although no
+// space in them is a single space: wrapped after "REQUIRED," with LF or
+// CRLF, wrapped after "RFC 2119", indented, a tab, two spaces, a no-break
+// space. The same account answered the line without its period, with no
+// space after a comma, or in another order, so those go as written.
+const OMP_LINE = "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL. `NEVER` = `MUST NOT`; `AVOID` = `SHOULD NOT`."
+const OMP_COPIES = [
+ "RFC 2119 keywords: MUST, REQUIRED,\nSHOULD, RECOMMENDED, MAY, OPTIONAL.",
+ "RFC 2119 keywords: MUST, REQUIRED,\r\nSHOULD, RECOMMENDED, MAY, OPTIONAL.\r\n",
+ "RFC 2119\nkeywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
+ "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY,\n OPTIONAL.",
+ "RFC 2119 keywords:\tMUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
+ "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
+ "RFC\u00a02119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
+]
+const OMP_PASSED = [
+ "RFC 2119 keywords: MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL",
+ "RFC 2119 keywords: MUST,REQUIRED,SHOULD,RECOMMENDED,MAY,OPTIONAL.",
+ "RFC 2119 keywords: MUST, SHOULD, MAY, REQUIRED, RECOMMENDED, OPTIONAL.",
+ "RFC 2119 applies to MUST, REQUIRED, SHOULD, RECOMMENDED, MAY, OPTIONAL.",
+]
+
+test("omp's line is reworded wherever white space wraps or widens it", () => {
+ const { turnsAway, hint } = _internal
+ for (const line of [OMP_LINE, ...OMP_COPIES]) {
+ const sys = "\n" + line + "\n\n\n§ Role"
+ const out = cloak(sys)
+ expect(out).toBe(sys.replace("keywords", "key words"))
+ expect(turnsAway(out)).toBe(false)
+ expect(hint(sys)).toContain("oh-my-pi (omp)")
+ // every white space stays as it was
+ expect(shape({ systemInstruction: { parts: [{ text: sys }] }, contents: [] }, "gemini-3-flash", "", "").systemInstruction.parts[0].text).toBe(out)
+ }
+ for (const line of OMP_PASSED) expect(cloak(line)).toBe(line)
+ // the other lines take white space the same way (Hermes' and Codex's
+ // were turned away wrapped and with a tab on the same account)
+ expect(cloak("You are Hermes Agent, an intelligent\nAI assistant created by Nous Research.")).toContain("i\u200bn\u200btelligent\nAI a\u200bs\u200bsistant")
+ expect(cloak("You are Codex, an agent\tbased on GPT-5.")).toContain("a\u200bg\u200bent\tb\u200ba\u200bsed")
+})
+
test("the lines Antigravity turns away are broken up", () => {
const sys = "x-anthropic-billing-header: cc_version=2\nYou are Claude Code, built on Anthropic's Claude Agent SDK.\nhi"
const out = cloak(sys)