@bitkyc08/opencodex 2.100.3 → 2.100.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/AGENTS_INSTALL.md +23 -1
  2. package/bin/ocx.mjs +8 -1
  3. package/gui/dist/assets/{App-Dnb6VMsP.js → App-DcpyI78f.js} +20 -19
  4. package/gui/dist/assets/{Tray-BV4ms9U9.js → Tray-CzjPJprT.js} +1 -1
  5. package/gui/dist/assets/brand-mark-BTIi7e69.js +1 -0
  6. package/gui/dist/assets/index-DJxM-imn.css +2 -0
  7. package/gui/dist/assets/index-DVgU6S3y.js +138 -0
  8. package/gui/dist/assets/{segment-thumb-features-DXSidY6D.js → segment-thumb-features-Bn6Y-g3R.js} +1 -1
  9. package/gui/dist/classic/assets/{App-DA-scMPq.js → App-eYJAyNHM.js} +19 -18
  10. package/gui/dist/classic/assets/{Tray-BrHaVRAq.js → Tray-xHMYxLkV.js} +1 -1
  11. package/gui/dist/classic/assets/index-DSaVRW4F.js +138 -0
  12. package/gui/dist/classic/assets/quota-summary-DyzHlkFl.js +1 -0
  13. package/gui/dist/classic/index.html +1 -1
  14. package/gui/dist/index.html +2 -2
  15. package/native/ocx-child/src/cli.rs +5 -3
  16. package/native/ocx-child/src/codex_home.rs +1 -0
  17. package/package.json +2 -2
  18. package/src/adapters/anthropic/per-message-effort.ts +296 -0
  19. package/src/adapters/anthropic.ts +3 -0
  20. package/src/adapters/claude-cli/adapter.ts +1 -0
  21. package/src/adapters/devin/cloud-direct/chat.ts +71 -14
  22. package/src/adapters/google-errors.ts +14 -2
  23. package/src/adapters/qoder/adapter.ts +9 -1
  24. package/src/adapters/zed.ts +4 -2
  25. package/src/claude/desktop-remote-store.ts +60 -10
  26. package/src/cli/account-api.ts +4 -0
  27. package/src/cli/account-auth.ts +30 -2
  28. package/src/cli/account-extended.ts +33 -2
  29. package/src/cli/capabilities-access-remote.ts +3 -3
  30. package/src/cli/capabilities-accounts.ts +3 -3
  31. package/src/cli/capabilities-base.ts +11 -6
  32. package/src/cli/capabilities-observe-system.ts +2 -2
  33. package/src/cli/claude.ts +3 -3
  34. package/src/cli/disconnect-runtime.ts +16 -6
  35. package/src/cli/dispatch.ts +7 -1
  36. package/src/cli/index.ts +2 -2
  37. package/src/cli/link-apply-restart.ts +4 -2
  38. package/src/cli/link-routes.ts +4 -1
  39. package/src/cli/link.ts +5 -4
  40. package/src/cli/preflight-exemptions.ts +3 -0
  41. package/src/cli/registry.ts +5 -2
  42. package/src/cli/resolve.ts +23 -8
  43. package/src/cli/restart-failure.ts +11 -1
  44. package/src/cli/runtime-api.ts +4 -0
  45. package/src/cli/status.ts +4 -1
  46. package/src/cli/system-command.ts +1 -1
  47. package/src/cli/system-restart-client.ts +9 -3
  48. package/src/cli/system-settings-parity.ts +2 -1
  49. package/src/client/connect.ts +63 -9
  50. package/src/client/desktop-refusal.ts +38 -0
  51. package/src/client/lifecycle-lock.ts +29 -4
  52. package/src/client/runtime-restart.ts +27 -15
  53. package/src/client/runtime.ts +4 -2
  54. package/src/client/state.ts +14 -0
  55. package/src/codex/account-pause.ts +4 -0
  56. package/src/codex/account-runtime-state.ts +4 -0
  57. package/src/codex/auth-api/main-account-probe.ts +3 -1
  58. package/src/codex/auth-api/main-hard-lock-refusal-read.ts +172 -0
  59. package/src/codex/auth-context.ts +40 -2
  60. package/src/codex/catalog/build-entries.ts +10 -0
  61. package/src/codex/catalog/derive-entry.ts +7 -0
  62. package/src/codex/catalog/reserve-warn.ts +7 -5
  63. package/src/codex/catalog/reserve.ts +4 -3
  64. package/src/codex/catalog/retained-sync.ts +2 -0
  65. package/src/codex/catalog/routed-defaults.ts +35 -0
  66. package/src/codex/convergence.ts +2 -0
  67. package/src/codex/loopback-target.ts +22 -8
  68. package/src/codex/main-account.ts +88 -29
  69. package/src/codex/native-main-auth-file.ts +14 -0
  70. package/src/codex/native-main-credentials.ts +270 -0
  71. package/src/codex/native-main-owner.ts +3 -0
  72. package/src/codex/native-main-refresh-mode.ts +14 -1
  73. package/src/codex/quota.ts +63 -14
  74. package/src/combos/failover.ts +12 -1
  75. package/src/combos/index.ts +5 -0
  76. package/src/combos/resolve.ts +115 -19
  77. package/src/config/diagnostics.ts +3 -0
  78. package/src/config/live-reconcile.ts +6 -3
  79. package/src/config/load-degrade.ts +2 -0
  80. package/src/config/persisted-mutation.ts +2 -2
  81. package/src/config/persisted-projections.ts +18 -0
  82. package/src/config/process-state.ts +4 -3
  83. package/src/config/reserve-capability.ts +96 -0
  84. package/src/config/schema/config-schema.ts +6 -0
  85. package/src/config/schema/leaf-validators.ts +2 -0
  86. package/src/config/schema/routed-catalog-defaults.ts +49 -0
  87. package/src/config.ts +7 -7
  88. package/src/desktop-update/acquire.ts +202 -0
  89. package/src/desktop-update/cli.ts +168 -0
  90. package/src/desktop-update/drain.ts +40 -0
  91. package/src/desktop-update/headless.ts +285 -0
  92. package/src/desktop-update/image.ts +85 -0
  93. package/src/desktop-update/install.ts +53 -0
  94. package/src/desktop-update/msi.ts +72 -0
  95. package/src/desktop-update/release.ts +128 -0
  96. package/src/desktop-update/runtime.ts +155 -0
  97. package/src/desktop-update/staging.ts +118 -0
  98. package/src/desktop-update/trust.ts +45 -0
  99. package/src/generated/compatibility-version.json +246 -130
  100. package/src/images/fulfill-video.ts +3 -3
  101. package/src/images/loop.ts +6 -2
  102. package/src/images/plan.ts +147 -11
  103. package/src/images/types.ts +13 -4
  104. package/src/images/xai-video-client.ts +72 -10
  105. package/src/lib/gcp-adc.ts +48 -4
  106. package/src/lib/offline-resend.ts +150 -0
  107. package/src/lib/paced-stream.ts +3 -3
  108. package/src/lib/provider-outbound.ts +17 -6
  109. package/src/lib/request-failure-model.ts +2 -0
  110. package/src/lib/response-body-inactivity.ts +23 -1
  111. package/src/lib/upstream-retry.ts +38 -5
  112. package/src/link/explicit-route.ts +4 -4
  113. package/src/link/remote-windows.ts +79 -31
  114. package/src/link/residual-recovery.ts +20 -8
  115. package/src/messaging/budget.ts +23 -5
  116. package/src/messaging/rpc.ts +4 -4
  117. package/src/oauth/antigravity-risk.ts +126 -0
  118. package/src/oauth/generic-account-failover.ts +89 -18
  119. package/src/oauth/generic-session-affinity.ts +10 -3
  120. package/src/oauth/login-cli.ts +35 -1
  121. package/src/oauth/pool-kernel.ts +3 -3
  122. package/src/providers/anthropic-billing-refusal.ts +27 -3
  123. package/src/providers/google-vertex-model-discovery.ts +6 -1
  124. package/src/providers/model-rename-fields.ts +2 -0
  125. package/src/providers/quota/workbuddy.ts +6 -2
  126. package/src/providers/workbuddy-credit-balance.ts +125 -16
  127. package/src/responses/effort-history.ts +732 -0
  128. package/src/routing/history/integrity.ts +41 -4
  129. package/src/server/auth-cors.ts +13 -3
  130. package/src/server/codex-model-list.ts +2 -1
  131. package/src/server/direct-local-http.ts +26 -3
  132. package/src/server/index/link-listener.ts +20 -14
  133. package/src/server/index/serve-options.ts +1 -0
  134. package/src/server/index.ts +3 -2
  135. package/src/server/link-turn.ts +17 -5
  136. package/src/server/management/config-routes.ts +39 -3
  137. package/src/server/management/link-child-preflight.ts +1 -1
  138. package/src/server/management/link-route-edit.ts +20 -1
  139. package/src/server/management/oauth-account-routes.ts +22 -5
  140. package/src/server/management/provider-overwrite-carry.ts +3 -0
  141. package/src/server/management/provider-routes.ts +4 -4
  142. package/src/server/management/static-catalog-probe.ts +33 -0
  143. package/src/server/proxy-liveness.ts +54 -9
  144. package/src/server/relay.ts +6 -1
  145. package/src/server/request-log-conversation.ts +2 -2
  146. package/src/server/request-log.ts +5 -1
  147. package/src/server/reserve-capability-startup.ts +32 -0
  148. package/src/server/responses/adapter-delivery.ts +2 -0
  149. package/src/server/responses/adapter-dispatch.ts +31 -10
  150. package/src/server/responses/antigravity-fault-rotation.ts +24 -0
  151. package/src/server/responses/antigravity-validation-refusal.ts +43 -6
  152. package/src/server/responses/combo-selection-keepalive.ts +254 -0
  153. package/src/server/responses/core-combo.ts +24 -9
  154. package/src/server/responses/core-errors.ts +9 -6
  155. package/src/server/responses/core-options.ts +8 -0
  156. package/src/server/responses/core.ts +21 -0
  157. package/src/server/responses/estimated-usage.ts +115 -0
  158. package/src/server/responses/jev-model-invoke.ts +7 -2
  159. package/src/server/responses/passthrough-completion.ts +6 -3
  160. package/src/server/responses/passthrough-delivery.ts +47 -8
  161. package/src/server/responses/passthrough-dispatch.ts +3 -0
  162. package/src/server/responses/request-prepare.ts +9 -5
  163. package/src/server/responses/sidecar-execution.ts +5 -0
  164. package/src/service/desktop-supervision.d.mts +2 -0
  165. package/src/service/desktop-supervision.mjs +5 -0
  166. package/src/stall-timeout.ts +11 -0
  167. package/src/types/config.ts +15 -92
  168. package/src/types/provider.ts +13 -0
  169. package/src/types/request.ts +19 -0
  170. package/src/types/routed-catalog-defaults.ts +17 -0
  171. package/src/types/routing-profile.ts +90 -0
  172. package/src/types.ts +1 -0
  173. package/src/update/index.ts +1 -1
  174. package/src/usage/log.ts +14 -4
  175. package/src/usage/telemetry-contract.ts +1 -0
  176. package/src/web-search/passthrough-bridge.ts +7 -0
  177. package/gui/dist/assets/brand-mark-XOLJbomA.js +0 -1
  178. package/gui/dist/assets/index-DCdXsMyZ.js +0 -105
  179. package/gui/dist/assets/index-DQtCRNAw.css +0 -2
  180. package/gui/dist/classic/assets/index-BqOaGLf5.js +0 -105
  181. package/gui/dist/classic/assets/quota-summary-Dy5_wfTT.js +0 -1
@@ -223,8 +223,11 @@ function encodeChatMessagePrompt(
223
223
  signature?: string;
224
224
  signatureType?: string;
225
225
  isError?: boolean;
226
+ sanitizeDataSurfaces?: boolean;
226
227
  },
227
228
  ): Buffer {
229
+ const data = (s: string): string =>
230
+ opts?.sanitizeDataSurfaces ? sanitizeTextForCognition(s) : s;
228
231
  const textParts = content.filter((p): p is { type: 'text'; text: string } => p.type === 'text');
229
232
  const imageParts = content.filter((p): p is { type: 'image'; mimeType: string; base64Data: string; caption?: string } => p.type === 'image');
230
233
  const joined = textParts.map((p) => p.text).join('\n');
@@ -232,7 +235,7 @@ function encodeChatMessagePrompt(
232
235
  // #1 message_id. The verified turn-1 capture stamps one on every prompt.
233
236
  encodeString(1, crypto.randomUUID()),
234
237
  encodeVarintField(2, source),
235
- encodeString(3, joined),
238
+ encodeString(3, data(joined)),
236
239
  ];
237
240
  // Tool-result message: attach the id of the call this result answers.
238
241
  // Without it, the model can't pair multi-tool conversations.
@@ -245,20 +248,31 @@ function encodeChatMessagePrompt(
245
248
  // Assistant message with tool_calls: encode each as a ChatToolCall.
246
249
  if (opts?.toolCalls && opts.toolCalls.length > 0) {
247
250
  for (const tc of opts.toolCalls) {
248
- parts.push(encodeMessage(6, encodeChatToolCall(tc)));
251
+ // #2 name + #1 id are identifiers — only the #3 arguments_json is a
252
+ // data surface a user can quote blocklisted text into.
253
+ parts.push(encodeMessage(6, encodeChatToolCall({ ...tc, arguments: data(tc.arguments) })));
249
254
  }
250
255
  }
251
256
  for (const img of imageParts) {
252
- parts.push(encodeMessage(10, encodeImageData(img)));
257
+ parts.push(encodeMessage(10, encodeImageData({
258
+ ...img,
259
+ caption: img.caption === undefined ? undefined : data(img.caption),
260
+ })));
253
261
  }
254
262
  // Reasoning replay. This adapter used to assert that Cognition has no
255
263
  // reasoning-replay field and drop the assistant's own thinking, so a
256
264
  // reasoning model restarted its chain on every turn of a tool loop. Two
257
265
  // independent clients of the same service write it here: #11 thinking,
258
266
  // #12 signature, #18 signature_type on the assistant prompt.
259
- if (opts?.thinking) parts.push(encodeString(11, opts.thinking));
260
- if (opts?.signature) parts.push(encodeString(12, opts.signature));
261
- if (opts?.signatureType) parts.push(encodeString(18, opts.signatureType));
267
+ const thinking = opts?.thinking === undefined ? undefined : data(opts.thinking);
268
+ if (thinking) parts.push(encodeString(11, thinking));
269
+ // A signature can only attest the original thinking. Rewritten text uses
270
+ // unsigned replay; unchanged text (including signature-only turns) keeps
271
+ // the original signature and type without altering the stored history.
272
+ if (thinking === opts?.thinking) {
273
+ if (opts?.signature) parts.push(encodeString(12, opts.signature));
274
+ if (opts?.signatureType) parts.push(encodeString(18, opts.signatureType));
275
+ }
262
276
  return Buffer.concat(parts);
263
277
  }
264
278
 
@@ -551,6 +565,15 @@ interface BuildArgs {
551
565
  requestId: bigint;
552
566
  triggerId: string;
553
567
  tools?: ToolDef[];
568
+ /**
569
+ * Opt-in: also run the Cognition blocklist rewrite over *data* surfaces —
570
+ * prompt text (#3), tool-call arguments (#6.3), image captions (#10.3) and
571
+ * replayed thinking (#11). Off by default: a rewrite inside literal content
572
+ * silently changes what the model sees, so callers who prefer a refusal over
573
+ * altered history keep the default. Enabled by the
574
+ * OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES env var at the call site.
575
+ */
576
+ sanitizeDataSurfaces?: boolean;
554
577
  /** Default 5 = CHAT_MESSAGE_REQUEST_TYPE_CASCADE (matches captured LS body). */
555
578
  requestType?: number;
556
579
  completionOpts?: {
@@ -632,15 +655,31 @@ const MAX_TOOL_DESC_LEN = 6998;
632
655
  * for "whether to allow", verified live to clear the filter while preserving
633
656
  * the instruction's meaning.
634
657
  *
635
- * Scope note: the sanitizer only ever touches *instruction surfaces* —
636
- * tool descriptions and the #2 system prompt, where a meaning-preserving
637
- * reword loses nothing. It deliberately does NOT touch data fields:
638
- * message text (#3), replayed thinking (#11), and tool-call arguments
639
- * (#6.3) carry literal content (patches, exact needles, quoted file bytes)
658
+ * Entries five and six are more Codex CLI boilerplate, isolated by live
659
+ * bisection on a denied thread: "Codex refers to the open-source agentic
660
+ * coding interface" (the CLI's identity sentence — once Cognition listed it,
661
+ * every request from a Codex CLI client was refused) and "Don't output ANSI
662
+ * escape codes directly — the CLI renderer applies them" (a formatting
663
+ * bullet). Matching is flexible on case, whitespace, the open-source hyphen,
664
+ * and the Don't apostrophe; each rewrite swaps one required word.
665
+ *
666
+ * Scope note: by default the sanitizer only ever touches *instruction
667
+ * surfaces* — tool descriptions and the #2 system prompt, where a
668
+ * meaning-preserving reword loses nothing. Data fields — message text (#3),
669
+ * replayed thinking (#11), image captions (#10.3), and tool-call arguments
670
+ * (#6.3) — carry literal content (patches, exact needles, quoted file bytes)
640
671
  * where a rewrite would silently change what the model did or sees. If a
641
672
  * blocklisted phrase reaches the cloud inside one of those, the request is
642
- * refused and the caller sees the upstream `permission_denied` — which is
643
- * the correct failure, better than corrupting the data.
673
+ * refused and the caller sees the upstream `permission_denied`.
674
+ *
675
+ * That refusal is the correct failure for short histories, but a long thread
676
+ * keeps resending its earlier turns, so one quoted trigger phrase anywhere
677
+ * in the history (e.g. a tool description pasted into the transcript, or a
678
+ * mid-conversation system block Codex injected) permanently refuses every
679
+ * subsequent request. Operators who would rather have the rewrites applied
680
+ * to data surfaces than lose the thread can set
681
+ * `OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES=1` — it is opt-in precisely
682
+ * because rewriting literal history changes what the model is told.
644
683
  */
645
684
  const COGNITION_BLOCKLIST_REWRITES: ReadonlyArray<[RegExp, string]> = [
646
685
  [/\bTakes a task_id parameter identifying the task\b/g, "Accepts a task_id parameter identifying the task"],
@@ -656,6 +695,14 @@ const COGNITION_BLOCKLIST_REWRITES: ReadonlyArray<[RegExp, string]> = [
656
695
  /\basking\s+the\s+user\s+if\s+they\s+want\s+to\s+allow\s+the\s+action\s+in\s+`?justification`?\s+parameter\b/gi,
657
696
  "asking the user whether to allow the action in the `justification` parameter",
658
697
  ],
698
+ [
699
+ /\bCodex\s+refers\s+to\s+the\s+open[-\s]?source\s+agentic\s+coding\s+interface\b/gi,
700
+ "Codex refers to the open-source agentic coding tool",
701
+ ],
702
+ [
703
+ /\bDon[\u0060'’]?t\s+output\s+ANSI\s+escape\s+codes\s+directly\s*[—-]\s*the\s+CLI\s+renderer\s+applies\s+them\b/gi,
704
+ "Don’t emit ANSI escape codes directly — the CLI renderer applies them",
705
+ ],
659
706
  ];
660
707
 
661
708
  function sanitizeTextForCognition(text: string): string {
@@ -742,6 +789,7 @@ function buildGetChatMessageRequest(args: BuildArgs): Buffer {
742
789
  signature: m.role === 'assistant' ? m.signature : undefined,
743
790
  signatureType: m.role === 'assistant' ? m.signature_type : undefined,
744
791
  isError: m.role === 'tool' ? m.is_error : undefined,
792
+ sanitizeDataSurfaces: args.sanitizeDataSurfaces,
745
793
  },
746
794
  ),
747
795
  ),
@@ -1232,6 +1280,11 @@ export async function* streamChatEvents(req: CloudChatRequest): AsyncGenerator<C
1232
1280
  const userJwt = process.env.OPENCODEX_DEVIN_SEND_USER_JWT === "1"
1233
1281
  ? await getCachedUserJwt(req.apiKey, host, req.signal)
1234
1282
  : undefined;
1283
+ // Opt-in: extend the blocklist rewrite to data surfaces too. Default keeps
1284
+ // history byte-exact; setting this trades a possible meaning-preserving
1285
+ // rewrite inside quoted content for not having the whole request refused
1286
+ // when a long thread's history happens to contain a trigger phrase.
1287
+ const sanitizeDataSurfaces = process.env.OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES === "1";
1235
1288
 
1236
1289
  // Pre-flight: consult the per-account model catalog. Cognition's cloud
1237
1290
  // returns an opaque `permission_denied: "an internal error occurred (trace
@@ -1270,6 +1323,7 @@ export async function* streamChatEvents(req: CloudChatRequest): AsyncGenerator<C
1270
1323
  modelUid: req.modelUid,
1271
1324
  messages: req.messages,
1272
1325
  tools: req.tools,
1326
+ sanitizeDataSurfaces,
1273
1327
  cascadeId: sessionIds.cascadeId,
1274
1328
  sessionId: sessionIds.sessionId,
1275
1329
  trajectoryId: req.trajectoryId,
@@ -1639,7 +1693,10 @@ export async function* streamChatEvents(req: CloudChatRequest): AsyncGenerator<C
1639
1693
  const enriched =
1640
1694
  `Cognition denied this request (permission_denied). If tool descriptions ` +
1641
1695
  `are present, a blocklisted phrase may have triggered this — see the ` +
1642
- `COGNITION_BLOCKLIST_REWRITES table in cloud-direct/chat.ts. ` +
1696
+ `COGNITION_BLOCKLIST_REWRITES table in cloud-direct/chat.ts. A phrase ` +
1697
+ `quoted inside history data (message text, thinking, tool-call args) can ` +
1698
+ `also trip it; OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES=1 extends the ` +
1699
+ `rewrite to those surfaces at the cost of altering quoted content. ` +
1643
1700
  `(cloud trace ID: ${trailerError.traceId ?? 'n/a'})`;
1644
1701
  throw new CloudChatError(
1645
1702
  enriched,
@@ -2,6 +2,17 @@ import { parseUpstreamJsonPayload, safeUpstreamErrorString, sanitizeUpstreamErro
2
2
  import { isLocationUnsupportedMessage } from "../lib/errors";
3
3
 
4
4
  export const ANTIGRAVITY_VALIDATION_REQUIRED_PREFIX = "Antigravity account validation required (VALIDATION_REQUIRED)";
5
+ /** Leading words of every normalized Antigravity 403 that is not a validation demand (see `classifyGoogle`). */
6
+ export const ANTIGRAVITY_ACCESS_DENIED_PREFIX = "Antigravity access denied";
7
+ /** Leading words of a normalized Antigravity refusal whose text names the credential itself. */
8
+ export const ANTIGRAVITY_AUTH_FAILED_PREFIX = "Antigravity authentication failed";
9
+ /**
10
+ * Written right after a normalized prefix only when the response carried Google's structured
11
+ * `error.status: "PERMISSION_DENIED"`. Message wording alone never produces it, so a reader of the
12
+ * normalized string can tell a refusal Google attributed to the account from a proxy page or an
13
+ * enum-less envelope that merely says "expired".
14
+ */
15
+ export const GOOGLE_PERMISSION_DENIED_SUFFIX = " (PERMISSION_DENIED)";
5
16
 
6
17
  function hasAntigravityValidationReason(payloadText: string): boolean {
7
18
  const payload = parseUpstreamJsonPayload(payloadText);
@@ -77,13 +88,14 @@ function classifyGoogle(label: string, status: number | undefined, enumStatus: s
77
88
  return `${label} rate limit exceeded`;
78
89
  }
79
90
  if (status === 401 || enumStatus === "UNAUTHENTICATED" || lower.includes("unauthenticated") || lower.includes("invalid authentication") || lower.includes("expired")) {
80
- return `${label} authentication failed`;
91
+ // Keep the enum here too: the access-denial recovery accepts this wording only under it.
92
+ return `${label} authentication failed${enumStatus === "PERMISSION_DENIED" ? GOOGLE_PERMISSION_DENIED_SUFFIX : ""}`;
81
93
  }
82
94
  // Keep Google's explicit enum in the normalized text. Responses/combo handling receives
83
95
  // only this string, so dropping it would let location wording override the authoritative
84
96
  // permission reason during downstream classification.
85
97
  if (enumStatus === "PERMISSION_DENIED") {
86
- return `${label} access denied (PERMISSION_DENIED)`;
98
+ return `${label} access denied${GOOGLE_PERMISSION_DENIED_SUFFIX}`;
87
99
  }
88
100
  if (status === 403 || lower.includes("permission_denied") || lower.includes("permission denied") || lower.includes("access denied")) {
89
101
  return `${label} access denied`;
@@ -63,7 +63,14 @@ export function buildQoderChildEnv(profile: QoderProfile, apiKey: string, system
63
63
  ...(systemPrompt ? { [promptEnv]: systemPrompt } : {}) };
64
64
  }
65
65
 
66
- /** Disable Qoder's built-in tools; only a request-scoped MCP catalog can be exposed. */
66
+ /**
67
+ * Disable Qoder's built-in tools; only a request-scoped MCP catalog can be exposed.
68
+ *
69
+ * MCP lazy loading is switched off inline (#8704). Qoder defaults it on when no setting names it,
70
+ * and then calls its own `mcp_get`/`mcp_call`/`mcp_list` wrappers instead of the catalog tools,
71
+ * which the undeclared-tool guard rightly refuses. `--settings` is an explicit flag, so it
72
+ * still applies while `--setting-sources ""` keeps every settings file out.
73
+ */
67
74
  export function buildQoderArgs(parsed: OcxParsedRequest, provider: OcxProviderConfig): string[] {
68
75
  const args = [
69
76
  "-p",
@@ -74,6 +81,7 @@ export function buildQoderArgs(parsed: OcxParsedRequest, provider: OcxProviderCo
74
81
  "--setting-sources", "",
75
82
  "--max-turns", "1",
76
83
  "--no-session-persistence",
84
+ "--settings", JSON.stringify({ mcp: { lazyLoad: false } }),
77
85
  "--model", parsed.modelId,
78
86
  ];
79
87
  const effort = mapReasoningEffort(provider, parsed.modelId, parsed.options.reasoning);
@@ -168,9 +168,11 @@ export function zedEventStream(
168
168
  const output = new TransformStream<Uint8Array, Uint8Array>({
169
169
  transform(chunk, controller) {
170
170
  if (finished) return;
171
- buffer += decoder.decode(chunk, { stream: true });
171
+ const decoded = decoder.decode(chunk, { stream: true });
172
+ buffer += decoded;
172
173
  let start = 0;
173
- let newline = buffer.indexOf("\n", start);
174
+ // A drained suffix has no newline; only new text can complete a frame.
175
+ let newline = decoded.includes("\n") ? buffer.indexOf("\n", start) : -1;
174
176
  while (newline >= 0 && !finished) {
175
177
  processLine(buffer.slice(start, newline), controller);
176
178
  start = newline + 1;
@@ -1,8 +1,8 @@
1
- import { existsSync } from "node:fs";
1
+ import { existsSync, rmdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { readConfigDiagnostics, withConfigMutationLockSync } from "../config";
4
4
  import { assertClientLifecycleHeld, type ClientLifecycleHeld } from "../client/lifecycle-lock";
5
- import { readServiceApiTokenState, serviceApiTokenFingerprint } from "../lib/service-secrets";
5
+ import { readServiceApiTokenState, serviceApiTokenBackupPath, serviceApiTokenFingerprint } from "../lib/service-secrets";
6
6
  import { assertDesktop3pModelsValid } from "./desktop-3p-guard";
7
7
  import { profilePath } from "./desktop-3p-library";
8
8
  import type { Desktop3pConfigMode, Desktop3pModelEntry } from "./desktop-3p";
@@ -50,35 +50,62 @@ function recordedGenerations(io: StoreIO, owner: DesktopRemoteOwner): string[] {
50
50
  ...(bundle.state?.pending ? [bundle.state.pending.tokenFingerprint] : [])];
51
51
  }
52
52
 
53
+ /**
54
+ * Why an inspection answered conflict or unsafe, and the file or folder it was looking at, so a
55
+ * refusal can name both. The step that failed decides the reason; nothing here changes the verdict.
56
+ */
57
+ export type DesktopStoreInspectReason =
58
+ | "root_without_state" | "store_unreadable" | "store_other_connection" | "library_unreadable"
59
+ | "profile_missing" | "profile_edited" | "profile_ambiguous" | "token_unreadable" | "connection_changed" | "unknown";
60
+
53
61
  export function inspectRemoteDesktopStore(owner: DesktopRemoteOwner): {
54
62
  kind: "absent" | "active" | "pending" | "restored" | "legacy_current_connection" | "conflict" | "unsafe";
55
- /** Set for the one refusal a person can clear: the store folder exists with nothing in it OpenCodex reads. */
56
- reason?: "root_without_state";
63
+ /** Set with conflict and unsafe. */
64
+ reason?: DesktopStoreInspectReason;
57
65
  path?: string;
58
66
  } {
67
+ let site: { reason: DesktopStoreInspectReason; path?: string } = { reason: "unknown" };
59
68
  try {
60
69
  parseOwner(owner);
61
- const io = new StoreIO(), bundle = loadBundle(io);
70
+ site = { reason: "store_unreadable" };
71
+ const io = new StoreIO();
72
+ site.path = storePaths().root;
73
+ const bundle = loadBundle(io);
62
74
  if (bundle.state?.phase === "cleaned") {
63
75
  const terminal = receipt(io);
64
76
  if (terminal?.phase === "complete" && sameOwner(bundle.state.owner, terminal.owner) && !sameOwner(owner, terminal.owner)) return { kind: "absent" };
65
77
  }
78
+ site = { reason: "store_other_connection", path: bundle.paths.state };
66
79
  requireOwner(bundle, owner);
67
80
  if (bundle.state) {
68
81
  if (bundle.state.phase === "prepared" || bundle.state.pending) return { kind: "pending" };
69
82
  if (bundle.state.phase === "cleaned") return { kind: "restored" };
83
+ site = { reason: "library_unreadable", path: bundle.paths.library };
70
84
  const meta = metadata(io, bundle.paths.library);
71
85
  selectedFile(io, bundle.paths.library, meta.value);
72
- if (!meta.value.entries.some(e => e.id === bundle.state!.targetId && e.name === "opencodex")) return { kind: "conflict" };
73
- const file = io.read(profilePath(bundle.paths.library, bundle.state.targetId));
74
- if (projectionHash(file?.value ?? null) !== bundle.state.lastProjectionHash) return { kind: "conflict" };
86
+ if (!meta.value.entries.some(e => e.id === bundle.state!.targetId && e.name === "opencodex")) {
87
+ return { kind: "conflict", reason: "profile_missing", path: bundle.paths.library };
88
+ }
89
+ const target = profilePath(bundle.paths.library, bundle.state.targetId);
90
+ site.path = target;
91
+ const file = io.read(target);
92
+ if (projectionHash(file?.value ?? null) !== bundle.state.lastProjectionHash) return { kind: "conflict", reason: "profile_edited", path: target };
75
93
  return { kind: bundle.state.phase === "restored" ? "restored" : "active" };
76
94
  }
77
95
  if (existsSync(bundle.paths.root) && !receipt(io)) return { kind: "unsafe", reason: "root_without_state", path: bundle.paths.root };
78
- const legacy = locateLegacy(io, owner, serviceGenerations());
96
+ site = { reason: "token_unreadable", path: serviceApiTokenBackupPath() };
97
+ const generations = serviceGenerations();
98
+ site = { reason: "profile_ambiguous", path: bundle.paths.library };
99
+ const legacy = locateLegacy(io, owner, generations);
100
+ site = { reason: "connection_changed" };
79
101
  if (legacy) currentConnection(owner);
80
102
  return { kind: legacy ? "legacy_current_connection" : "absent" };
81
- } catch (error) { return { kind: error instanceof DesktopStoreError && error.reason === "conflict" ? "conflict" : "unsafe" }; }
103
+ } catch (error) {
104
+ const conflict = error instanceof DesktopStoreError && error.reason === "conflict";
105
+ // Only an ambiguous match is a conflict in the legacy scan; an unreadable list is not.
106
+ const reason = site.reason === "profile_ambiguous" && !conflict ? "library_unreadable" : site.reason;
107
+ return { kind: conflict ? "conflict" : "unsafe", reason, ...(site.path ? { path: site.path } : {}) };
108
+ }
82
109
  }
83
110
 
84
111
  export function applyRemoteDesktopStore(held: ClientLifecycleHeld, options: {
@@ -247,6 +274,29 @@ export function writeDesktopDisconnectReceipt(held: ClientLifecycleHeld, expecte
247
274
  }
248
275
  }
249
276
 
277
+ /**
278
+ * Remove a disconnect receipt that never passed `prepared`, and its folder when the receipt was all
279
+ * it held. Compare-and-delete: a receipt another run advanced or replaced is left alone.
280
+ */
281
+ export function removeDesktopDisconnectReceipt(held: ClientLifecycleHeld, expected: DesktopDisconnectReceipt): void {
282
+ assertClientLifecycleHeld(held);
283
+ try {
284
+ withConfigMutationLockSync(() => {
285
+ if (parseDisconnect(expected).phase !== "prepared") throw new DesktopStoreError("conflict");
286
+ const io = new StoreIO(), paths = storePaths();
287
+ const file = io.read(paths.disconnect, 64 * 1024, true);
288
+ if (!file || canonical(parseDisconnect(file.value)) !== canonical(expected)) throw new DesktopStoreError("conflict");
289
+ io.remove(paths.disconnect, file);
290
+ // Not recursive: a folder that still holds Claude Desktop state stays, and that state
291
+ // explains itself to the next inspection. An empty one would read as a leftover.
292
+ try { rmdirSync(paths.root); } catch { /* not empty, or already gone */ }
293
+ });
294
+ } catch (error) {
295
+ throw new Error(error instanceof DesktopStoreError && error.reason === "conflict"
296
+ ? "desktop_disconnect_receipt_conflict" : "desktop_disconnect_receipt_unsafe");
297
+ }
298
+ }
299
+
250
300
  export function inspectRemoteDesktopCleanup():
251
301
  | { kind: "absent" } | { kind: "active" | "restored" | "pending"; owner: DesktopRemoteOwner } | { kind: "unsafe" } {
252
302
  try {
@@ -90,7 +90,11 @@ export interface StageLeaseClock {
90
90
  clearTimeout(timer: ReturnType<typeof setTimeout>): void;
91
91
  }
92
92
 
93
+ import type { AntigravityRiskSeams } from "../oauth/antigravity-risk";
94
+
93
95
  export interface AccountDeps {
96
+ /** Test seams for the Google Antigravity acknowledgement (agent detection, prompt visibility). */
97
+ antigravityRisk?: AntigravityRiskSeams;
94
98
  /** Test injection: skip findLiveProxy and call the API at this base URL. */
95
99
  baseUrl?: string;
96
100
  fetchImpl?: typeof fetch;
@@ -5,6 +5,14 @@ import { modelSelectionGuidance, modelSelectionNextSteps } from "./model-selecti
5
5
  import { warnIfCodexCatalogRefreshPending } from "./account-catalog-refresh";
6
6
  import { isCodexResetCreditOperationId } from "../codex/reset-credit-recovery";
7
7
  import { BROWSER_LAUNCH_FAILED_NOTICE } from "../lib/browser-launch-notice";
8
+ import {
9
+ ANTIGRAVITY_RISK_ACK_FIELD,
10
+ ANTIGRAVITY_RISK_CLI_FLAG,
11
+ antigravityRiskDecisionMessage,
12
+ requiresAntigravityRiskAcknowledgement,
13
+ resolveAntigravityRiskAcknowledgement,
14
+ } from "../oauth/antigravity-risk";
15
+ import { isAgentDriven } from "./agent-driven";
8
16
  import {
9
17
  RuntimeApiError,
10
18
  CliUsageError,
@@ -39,7 +47,7 @@ function writeStdoutFully(text: string): void {
39
47
  }
40
48
 
41
49
  const USAGE = `Usage:
42
- ocx account login <provider> [--id <account-id>] [--reauth] [--device] [--method builder-id|google|github] [--open-browser on|off] [--add-account on|off] [--code -] [--no-wait] [--json]
50
+ ocx account login <provider> [--id <account-id>] [--reauth] [--device] [--method builder-id|google|github] [--open-browser on|off] [--add-account on|off] [--code -] [--no-wait] [--json] [--accept-antigravity-risk]
43
51
  ocx account code <provider> [--flow <flow-id>] [--json] (reads the code from stdin)
44
52
  ocx account cancel <provider> [--flow <flow-id>] [--json] (--flow required for codex)
45
53
  ocx account reset-credits <account-id|main> [--consume --yes [--operation-id <uuid>]] [--json]
@@ -223,8 +231,11 @@ async function login(argv: string[], deps: RuntimeApiDeps): Promise<number | voi
223
231
  const suppliedCode = takeOptionWithSyntax(args, "--code");
224
232
  const openBrowser = loginBoolean(args, "--open-browser");
225
233
  const addAccount = loginBoolean(args, "--add-account");
234
+ const acceptAntigravityRisk = takeFlag(args, ANTIGRAVITY_RISK_CLI_FLAG);
226
235
  if (provider && !isValidProviderName(provider)) throw new CliUsageError("invalid provider name", USAGE);
227
236
  if (!provider) throw new CliUsageError("provider is required", USAGE);
237
+ const antigravityRisk = requiresAntigravityRiskAcknowledgement(provider);
238
+ if (acceptAntigravityRisk && !antigravityRisk) throw new CliUsageError(`${ANTIGRAVITY_RISK_CLI_FLAG} only applies to google-antigravity`, USAGE);
228
239
  if (method !== undefined) {
229
240
  if (provider !== "kiro" || !["builder-id", "google", "github"].includes(method)) {
230
241
  throw new CliUsageError("--method requires kiro and builder-id, google, or github", USAGE);
@@ -250,6 +261,23 @@ async function login(argv: string[], deps: RuntimeApiDeps): Promise<number | voi
250
261
  if (addAccount !== undefined && (reauth || CODEX_NAMES.has(provider))) throw new CliUsageError("--add-account is only valid for fresh provider OAuth login", USAGE);
251
262
  if (openBrowser !== undefined && (device || DEVICE_NATIVE_PROVIDERS.has(provider))) throw new CliUsageError("--open-browser is not supported for device login", USAGE);
252
263
  if (!CODEX_NAMES.has(provider) && id && !reauth) throw new CliUsageError("--id is only valid with --reauth for provider OAuth accounts", USAGE);
264
+ // Antigravity can get the Google account disabled: warn and get an answer before anything
265
+ // else touches stdin or the proxy. A refusal here sends no request at all.
266
+ if (antigravityRisk) {
267
+ const decision = await resolveAntigravityRiskAcknowledgement({
268
+ flag: acceptAntigravityRisk,
269
+ // The question goes to stderr, so a redirected stderr is not a terminal a person can answer.
270
+ interactive: (deps.stdinImpl ?? process.stdin).isTTY === true
271
+ && (deps.antigravityRisk?.promptVisible ?? (() => process.stderr.isTTY === true))(),
272
+ agentDriven: (deps.antigravityRisk?.agentDriven ?? isAgentDriven)(),
273
+ warn: text => console.error(text),
274
+ ask: async question => {
275
+ process.stderr.write(question);
276
+ return await readSecretLine(deps, "confirmation");
277
+ },
278
+ });
279
+ if (decision !== "accepted") throw new CliUsageError(antigravityRiskDecisionMessage(decision));
280
+ }
253
281
  // Only resolve when --code was actually given: a plain `ocx account login`
254
282
  // opens the browser flow and polls, and must not block on stdin.
255
283
  const code = await resolveCode(suppliedCode, deps, false);
@@ -346,7 +374,7 @@ async function login(argv: string[], deps: RuntimeApiDeps): Promise<number | voi
346
374
 
347
375
  const start = publicLoginStart(await runtimeRequest<unknown>("/api/oauth/login", {
348
376
  method: "POST", redirect: "error",
349
- body: JSON.stringify({ provider, addAccount: addAccount ?? !reauth, ...(device && DEVICE_OPT_IN_PROVIDERS.has(provider) ? { device: true } : {}), ...(openBrowser === undefined ? {} : { openBrowser }), ...(reauth && id ? { accountId: id, reauth: true } : {}) }),
377
+ body: JSON.stringify({ provider, addAccount: addAccount ?? !reauth, ...(device && DEVICE_OPT_IN_PROVIDERS.has(provider) ? { device: true } : {}), ...(openBrowser === undefined ? {} : { openBrowser }), ...(reauth && id ? { accountId: id, reauth: true } : {}), ...(antigravityRisk ? { [ANTIGRAVITY_RISK_ACK_FIELD]: true } : {}) }),
350
378
  }, pinned));
351
379
  const xaiDevice = provider === "xai" && device;
352
380
  if (xaiDevice && (!start.flowId?.trim() || !start.url?.trim() || !start.deviceCode?.trim())) {
@@ -4,7 +4,15 @@ import { anthropicProviderIdentityError, cmdAnthropicAccountThreshold } from "./
4
4
  import { isReservedCodexAccountWord, reportCodexAccountTargetError, resolveCodexAccountTarget } from "./account-target";
5
5
  import { hasPassiveAccountQuota } from "../providers/quota";
6
6
  import { isWeeklyAllowancePercent } from "../providers/quota-types";
7
- import { terminalSafeText } from "./runtime-api";
7
+ import { readSecretLine, terminalSafeText } from "./runtime-api";
8
+ import {
9
+ ANTIGRAVITY_RISK_ACK_FIELD,
10
+ ANTIGRAVITY_RISK_CLI_FLAG,
11
+ ANTIGRAVITY_RISK_REFUSAL_CODE,
12
+ antigravityRiskDecisionMessage,
13
+ resolveAntigravityRiskAcknowledgement,
14
+ } from "../oauth/antigravity-risk";
15
+ import { isAgentDriven } from "./agent-driven";
8
16
  import { closeSync, openSync, readSync, readFileSync, statSync } from "node:fs";
9
17
  import {
10
18
  MAX_ACCOUNT_PRIORITY,
@@ -558,6 +566,7 @@ export async function cmdImport(args: string[], deps: AccountDeps): Promise<numb
558
566
  const formatArg = flagValue(args, "--format");
559
567
  const fileArg = flagValue(args, "--file");
560
568
  const fromStdin = flag(args, "--stdin");
569
+ const acceptRisk = flag(args, ANTIGRAVITY_RISK_CLI_FLAG);
561
570
  const provider = args.shift();
562
571
 
563
572
  // Admission happens before source I/O. In particular, an inline JSON positional argument is
@@ -576,6 +585,25 @@ export async function cmdImport(args: string[], deps: AccountDeps): Promise<numb
576
585
  return usage("Error: choose exactly one bounded source: --file <path> or --stdin");
577
586
  }
578
587
 
588
+ // Before reading the document: an imported Antigravity credential carries the same account
589
+ // risk as a fresh login. With --stdin the document owns stdin, so only the flag can accept.
590
+ const stdinInput: AccountStdin = deps.stdinImpl ?? process.stdin;
591
+ const decision = await resolveAntigravityRiskAcknowledgement({
592
+ flag: acceptRisk,
593
+ interactive: !fromStdin && stdinInput.isTTY === true
594
+ && (deps.antigravityRisk?.promptVisible ?? (() => process.stderr.isTTY === true))(),
595
+ agentDriven: (deps.antigravityRisk?.agentDriven ?? isAgentDriven)(),
596
+ warn: text => console.error(text),
597
+ ask: async question => {
598
+ process.stderr.write(question);
599
+ return await readSecretLine(deps, "confirmation");
600
+ },
601
+ });
602
+ if (decision !== "accepted") {
603
+ console.error(antigravityRiskDecisionMessage(decision));
604
+ return 1;
605
+ }
606
+
579
607
  let source: string;
580
608
  try {
581
609
  source = hasFile ? readBoundedImportFile(fileArg.value!) : await readBoundedImportStdin(deps);
@@ -611,6 +639,7 @@ export async function cmdImport(args: string[], deps: AccountDeps): Promise<numb
611
639
  provider,
612
640
  format: formatArg.value,
613
641
  document,
642
+ [ANTIGRAVITY_RISK_ACK_FIELD]: true,
614
643
  }, { signal: controller.signal });
615
644
  } finally {
616
645
  clearTimeout(timer);
@@ -621,7 +650,9 @@ export async function cmdImport(args: string[], deps: AccountDeps): Promise<numb
621
650
  return 1;
622
651
  }
623
652
  if (response.status !== 200) {
624
- if (IMPORT_CODES.has(response.json.code as AccountImportCode)) {
653
+ if (response.json.code === ANTIGRAVITY_RISK_REFUSAL_CODE) {
654
+ console.error(`Error: ${ANTIGRAVITY_RISK_REFUSAL_CODE}`);
655
+ } else if (IMPORT_CODES.has(response.json.code as AccountImportCode)) {
625
656
  console.error(`Error: ${response.json.code as AccountImportCode}`);
626
657
  } else {
627
658
  console.error(`Error: import_request_failed (status ${response.status})`);
@@ -257,7 +257,7 @@ export const ACCESS_REMOTE_CAPABILITIES: readonly Capability[] = [
257
257
  flags: [{ name: "--link-id", value: "string", required: true, summary: "Home-initiated link id." }, { name: "--route", value: "string", required: true, summary: "SSH host alias or destination of the new route." },
258
258
  { name: "--position", value: "number", summary: "Index in the list; by default just before the alias, so direct routes come first and the alias stays last." }, { name: "--json", value: "boolean", summary: "Emit {linkId, pin, routes} as JSON." }],
259
259
  mutates: true, json: "payload",
260
- details: ["The Home first checks that its link known_hosts file trusts only the link's recorded key for the alias (every entry for it, in any case or hashed by an older release, carries that key), then connects over the new route with strict checking against that one key and stores the route only if the same machine answers. Refusals: route_unproven with a cause (hostkey, auth, forward, transient), pin_mismatch, trust_file_unexpected, link_changed, pin_changed, route_exists, route_limit (8 routes), link_operation_in_progress (removal or a Child job holds the link). Exit 5 on a refusal, 4 for an unknown link, 1 when the routes were stored but the running proxy did not apply them (routes_stored_reload_failed; ocx link routes --link-id <id> reads what was stored).", "Adding a route does not move a running tunnel; the Home tries the list in order from the next connection on (ocx link reconnect starts one now). Requires loopback admin authority on the Home."],
260
+ details: ["The Home first checks that its link known_hosts file trusts only the link's recorded key for the alias (every entry for it, in any case or hashed by an older release, carries that key), then connects over the new route with strict checking against that one key and stores the route only if the same machine answers. Refusals: route_unproven with a cause (hostkey, auth, forward, transient), pin_mismatch, trust_file_unexpected, link_changed, pin_changed, route_exists, route_limit (8 routes), link_operation_in_progress (removal or a Child job holds the link), link_retirement_pending (an unfinished removal of the link holds it; finish that revoke first). Exit 5 on a refusal, 4 for an unknown link, 1 when the routes were stored but the running proxy did not apply them (routes_stored_reload_failed; ocx link routes --link-id <id> reads what was stored).", "Adding a route does not move a running tunnel; the Home tries the list in order from the next connection on (ocx link reconnect starts one now). Requires loopback admin authority on the Home."],
261
261
  },
262
262
  {
263
263
  command: ["link", "routes", "remove"], summary: "Remove an SSH route from a Home-initiated link.",
@@ -265,7 +265,7 @@ export const ACCESS_REMOTE_CAPABILITIES: readonly Capability[] = [
265
265
  routes: [{ method: "POST", path: "/api/link/{id}/routes" }],
266
266
  flags: [{ name: "--link-id", value: "string", required: true, summary: "Home-initiated link id." }, { name: "--route", value: "string", required: true, summary: "Route to remove." }, { name: "--json", value: "boolean", summary: "Emit {linkId, pin, routes} as JSON." }],
267
267
  mutates: true, json: "payload",
268
- details: ["The alias is the link's pin and cannot be removed (route_is_pin). Removing the route the tunnel uses restarts the tunnel on the remaining list; removing the last extra route returns the link to one route. Exit 4 for an unknown link or route (link_not_found, route_not_found), 5 on a refusal (route_is_pin, link_operation_in_progress), 1 when the routes were stored but the running proxy did not apply them (routes_stored_reload_failed). Requires loopback admin authority on the Home."],
268
+ details: ["The alias is the link's pin and cannot be removed (route_is_pin). Removing the route the tunnel uses restarts the tunnel on the remaining list; removing the last extra route returns the link to one route. Exit 4 for an unknown link or route (link_not_found, route_not_found), 5 on a refusal (route_is_pin, link_operation_in_progress, link_retirement_pending: an unfinished removal of the link holds it), 1 when the routes were stored but the running proxy did not apply them (routes_stored_reload_failed). Requires loopback admin authority on the Home."],
269
269
  },
270
270
  {
271
271
  command: ["link", "routes", "order"], summary: "Reorder a Home-initiated link's SSH routes.",
@@ -273,7 +273,7 @@ export const ACCESS_REMOTE_CAPABILITIES: readonly Capability[] = [
273
273
  routes: [{ method: "POST", path: "/api/link/{id}/routes" }],
274
274
  flags: [{ name: "--link-id", value: "string", required: true, summary: "Home-initiated link id." }, { name: "--routes", value: "string", required: true, summary: "The current routes, comma separated, in the new order." }, { name: "--json", value: "boolean", summary: "Emit {linkId, pin, routes} as JSON." }],
275
275
  mutates: true, json: "payload",
276
- details: ["The list must name exactly the current routes (route_order_mismatch otherwise), so no route enters unproven. A reorder does not move a running tunnel. Requires loopback admin authority on the Home."],
276
+ details: ["The list must name exactly the current routes (route_order_mismatch otherwise), so no route enters unproven. While an unfinished removal of the link holds it, the reorder is refused (link_retirement_pending); finish that revoke first. A reorder does not move a running tunnel. Requires loopback admin authority on the Home."],
277
277
  },
278
278
  {
279
279
  command: ["link", "operations"], summary: "List or read the enrollments and revokes journalled under an operation id.",
@@ -86,10 +86,10 @@ export const ACCOUNT_CAPABILITIES: readonly Capability[] = [
86
86
  },
87
87
  {
88
88
  command: ["account", "import"], summary: "Import Google Antigravity accounts from a bounded Cockpit Tools document.",
89
- usage: "ocx account import google-antigravity --format cockpit-tools (--file <path>|--stdin) [--json]",
89
+ usage: "ocx account import google-antigravity --format cockpit-tools (--file <path>|--stdin) [--accept-antigravity-risk] [--json]",
90
90
  routes: [{ method: "POST", path: "/api/oauth/accounts/import" }],
91
- flags: [{ name: "--format", value: "string", required: true, summary: "Only cockpit-tools is supported." }, { name: "--file", value: "string", summary: "Bounded source document; exclusive with --stdin." }, { name: "--stdin", value: "boolean", summary: "Read the document from non-TTY stdin." }, { name: "--json", value: "boolean", summary: "Emit sanitized per-record import outcomes." }], mutates: true, json: "envelope",
92
- details: ["Human-controlled credential handoff: choose exactly one source. Unsupported providers/formats are refused before source I/O. Partial failures or unsupported records return nonzero; do not echo the document."],
91
+ flags: [{ name: "--format", value: "string", required: true, summary: "Only cockpit-tools is supported." }, { name: "--file", value: "string", summary: "Bounded source document; exclusive with --stdin." }, { name: "--stdin", value: "boolean", summary: "Read the document from non-TTY stdin." }, { name: "--accept-antigravity-risk", value: "boolean", summary: "Accept the Google account-ban risk without the y/N prompt; required with --stdin." }, { name: "--json", value: "boolean", summary: "Emit sanitized per-record import outcomes." }], mutates: true, json: "envelope",
92
+ details: ["Human-controlled credential handoff: choose exactly one source. Unsupported providers/formats are refused before source I/O. Partial failures or unsupported records return nonzero; do not echo the document.", "Prints the Antigravity account-ban warning before reading the source; --file on a terminal asks y/N, otherwise --accept-antigravity-risk is required. Agent-driven runs are refused even with the flag (AGENTS_INSTALL.md)."],
93
93
  },
94
94
  {
95
95
  command: ["account","reauth"],