@bitkyc08/opencodex 2.100.3 → 2.100.5-preview.20261118.1
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.
- package/AGENTS_INSTALL.md +23 -1
- package/bin/ocx.mjs +8 -1
- package/gui/dist/assets/{App-Dnb6VMsP.js → App-BiOGtxDS.js} +21 -20
- package/gui/dist/assets/{Tray-BV4ms9U9.js → Tray-BwsMejUO.js} +1 -1
- package/gui/dist/assets/brand-mark-BY1dgACL.js +1 -0
- package/gui/dist/assets/{index-DCdXsMyZ.js → index-CwHSKMdG.js} +46 -13
- package/gui/dist/assets/index-DJxM-imn.css +2 -0
- package/gui/dist/assets/{segment-thumb-features-DXSidY6D.js → segment-thumb-features-Bds9Hb_7.js} +1 -1
- package/gui/dist/classic/assets/{App-DA-scMPq.js → App-CGLOiqQL.js} +20 -19
- package/gui/dist/classic/assets/{Tray-BrHaVRAq.js → Tray-Da4r2O70.js} +1 -1
- package/gui/dist/classic/assets/{index-BqOaGLf5.js → index-CvoKXKL9.js} +46 -13
- package/gui/dist/classic/assets/quota-summary-DvqzfCmr.js +1 -0
- package/gui/dist/classic/index.html +1 -1
- package/gui/dist/index.html +2 -2
- package/native/ocx-child/src/cli.rs +5 -3
- package/native/ocx-child/src/codex_home.rs +1 -0
- package/native/ocx-child/src/link_ws.rs +24 -19
- package/native/ocx-child/src/link_ws_frame.rs +136 -50
- package/package.json +3 -3
- package/src/adapters/anthropic/per-message-effort.ts +296 -0
- package/src/adapters/anthropic-input-schema.ts +270 -0
- package/src/adapters/anthropic.ts +4 -63
- package/src/adapters/claude-cli/adapter.ts +1 -0
- package/src/adapters/command-code-tool-text.ts +9 -1
- package/src/adapters/command-code.ts +18 -2
- package/src/adapters/devin/cloud-direct/chat.ts +95 -14
- package/src/adapters/devin/live-models.ts +11 -1
- package/src/adapters/google-errors.ts +14 -2
- package/src/adapters/kiro/reasoning.ts +3 -0
- package/src/adapters/kiro-tools.ts +14 -9
- package/src/adapters/openai-responses/passthrough.ts +3 -1
- package/src/adapters/openai-responses/request-strips.ts +1 -0
- package/src/adapters/qoder/adapter.ts +9 -1
- package/src/adapters/tool-catalog-nudge.ts +1 -1
- package/src/adapters/zed.ts +4 -2
- package/src/claude/chat-tool-dispatch.ts +4 -1
- package/src/claude/desktop-remote-store.ts +60 -10
- package/src/cli/account-api.ts +4 -0
- package/src/cli/account-auth.ts +30 -2
- package/src/cli/account-extended.ts +33 -2
- package/src/cli/capabilities-access-remote.ts +3 -3
- package/src/cli/capabilities-accounts.ts +3 -3
- package/src/cli/capabilities-base.ts +11 -6
- package/src/cli/capabilities-observe-system.ts +2 -2
- package/src/cli/claude.ts +3 -3
- package/src/cli/disconnect-runtime.ts +16 -6
- package/src/cli/dispatch.ts +7 -1
- package/src/cli/index.ts +2 -2
- package/src/cli/link-apply-restart.ts +4 -2
- package/src/cli/link-routes.ts +4 -1
- package/src/cli/link.ts +5 -4
- package/src/cli/logout-command.ts +23 -4
- package/src/cli/preflight-exemptions.ts +3 -0
- package/src/cli/provider.ts +3 -2
- package/src/cli/registry.ts +5 -2
- package/src/cli/resolve.ts +23 -8
- package/src/cli/restart-failure.ts +11 -1
- package/src/cli/runtime-api.ts +4 -0
- package/src/cli/status.ts +4 -1
- package/src/cli/system-command.ts +1 -1
- package/src/cli/system-restart-client.ts +9 -3
- package/src/cli/system-settings-parity.ts +2 -1
- package/src/client/connect.ts +73 -11
- package/src/client/desktop-refusal.ts +38 -0
- package/src/client/lifecycle-lock.ts +29 -4
- package/src/client/runtime-restart.ts +27 -15
- package/src/client/runtime.ts +4 -2
- package/src/client/state.ts +14 -0
- package/src/clients/config-export.ts +12 -7
- package/src/codex/account-lifecycle.ts +3 -1
- package/src/codex/account-pause.ts +4 -0
- package/src/codex/account-runtime-state.ts +4 -0
- package/src/codex/auth-api/main-account-probe.ts +3 -1
- package/src/codex/auth-api/main-hard-lock-refusal-read.ts +172 -0
- package/src/codex/auth-context.ts +40 -2
- package/src/codex/catalog/build-entries.ts +10 -0
- package/src/codex/catalog/derive-entry.ts +7 -0
- package/src/codex/catalog/metadata.ts +8 -0
- package/src/codex/catalog/native-models.ts +16 -6
- package/src/codex/catalog/pinned-models.ts +1 -0
- package/src/codex/catalog/provider-models.ts +5 -5
- package/src/codex/catalog/reserve-warn.ts +7 -5
- package/src/codex/catalog/reserve.ts +4 -3
- package/src/codex/catalog/retained-sync.ts +2 -0
- package/src/codex/catalog/routed-defaults.ts +35 -0
- package/src/codex/catalog-auto-refresh.ts +13 -2
- package/src/codex/config-drift-heal.ts +40 -12
- package/src/codex/config-write-lock.ts +39 -1
- package/src/codex/convergence.ts +2 -0
- package/src/codex/data/roster-pinned-models.json +346 -1
- package/src/codex/inject/config-write-section.ts +39 -1
- package/src/codex/inject/plan.ts +10 -8
- package/src/codex/inject/remove.ts +21 -19
- package/src/codex/inject/restore.ts +5 -1
- package/src/codex/inject-coordination.ts +58 -7
- package/src/codex/inject.ts +10 -12
- package/src/codex/journal-config-restore.ts +42 -0
- package/src/codex/journal.ts +62 -8
- package/src/codex/loopback-target.ts +22 -8
- package/src/codex/main-account.ts +94 -30
- package/src/codex/native-main-auth-file.ts +14 -0
- package/src/codex/native-main-credentials.ts +276 -0
- package/src/codex/native-main-owner.ts +3 -0
- package/src/codex/native-main-refresh-mode.ts +14 -1
- package/src/codex/quota.ts +63 -14
- package/src/combos/failover.ts +195 -1
- package/src/combos/index.ts +5 -0
- package/src/combos/resolve.ts +115 -19
- package/src/config/diagnostics.ts +3 -0
- package/src/config/live-reconcile.ts +6 -3
- package/src/config/load-degrade.ts +2 -0
- package/src/config/persisted-mutation.ts +2 -2
- package/src/config/persisted-projections.ts +18 -0
- package/src/config/process-state.ts +4 -3
- package/src/config/reserve-capability.ts +96 -0
- package/src/config/schema/config-schema.ts +6 -0
- package/src/config/schema/leaf-validators.ts +2 -0
- package/src/config/schema/routed-catalog-defaults.ts +49 -0
- package/src/config/subagent-models.ts +20 -12
- package/src/config.ts +7 -7
- package/src/desktop-update/acquire.ts +202 -0
- package/src/desktop-update/cli.ts +168 -0
- package/src/desktop-update/drain.ts +40 -0
- package/src/desktop-update/headless.ts +285 -0
- package/src/desktop-update/image.ts +85 -0
- package/src/desktop-update/install.ts +53 -0
- package/src/desktop-update/msi.ts +72 -0
- package/src/desktop-update/release.ts +128 -0
- package/src/desktop-update/runtime.ts +155 -0
- package/src/desktop-update/staging.ts +118 -0
- package/src/desktop-update/trust.ts +45 -0
- package/src/generated/compatibility-version.json +327 -195
- package/src/generated/model-metadata.ts +3 -3
- package/src/images/fulfill-video.ts +3 -3
- package/src/images/loop.ts +6 -2
- package/src/images/plan.ts +147 -11
- package/src/images/types.ts +13 -4
- package/src/images/xai-video-client.ts +72 -10
- package/src/lib/client-error-body.ts +6 -0
- package/src/lib/developer-role-rejection.ts +15 -0
- package/src/lib/gcp-adc.ts +48 -4
- package/src/lib/offline-resend.ts +150 -0
- package/src/lib/paced-stream.ts +3 -3
- package/src/lib/provider-outbound.ts +17 -6
- package/src/lib/request-failure-model.ts +2 -0
- package/src/lib/response-body-inactivity.ts +23 -1
- package/src/lib/upstream-retry.ts +39 -6
- package/src/link/explicit-route.ts +4 -4
- package/src/link/remote-windows.ts +79 -31
- package/src/link/residual-recovery.ts +20 -8
- package/src/messaging/budget.ts +23 -5
- package/src/messaging/remote-ports.ts +22 -10
- package/src/messaging/rpc.ts +4 -4
- package/src/oauth/antigravity-risk.ts +126 -0
- package/src/oauth/credential-siblings.ts +32 -0
- package/src/oauth/generic-account-failover.ts +113 -30
- package/src/oauth/generic-session-affinity.ts +10 -3
- package/src/oauth/index.ts +22 -14
- package/src/oauth/login-cli.ts +35 -1
- package/src/oauth/pool-kernel.ts +3 -3
- package/src/oauth/store.ts +38 -7
- package/src/providers/anthropic-billing-refusal.ts +27 -3
- package/src/providers/anthropic-reset-grants.ts +4 -0
- package/src/providers/claude-cli-usage.ts +2 -0
- package/src/providers/codebuddy-models.ts +11 -0
- package/src/providers/google-vertex-model-discovery.ts +49 -15
- package/src/providers/kiro-models.ts +5 -0
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/quota/workbuddy.ts +6 -2
- package/src/providers/registry/entries-core.ts +9 -3
- package/src/providers/registry/entries-extended.ts +20 -9
- package/src/providers/registry/model-seeds.ts +4 -1
- package/src/providers/stale-context-window-migration.ts +2 -0
- package/src/providers/workbuddy-credit-balance.ts +125 -16
- package/src/responses/citation-markers.ts +26 -23
- package/src/responses/effort-history.ts +732 -0
- package/src/routing/history/integrity.ts +41 -4
- package/src/server/auth-cors.ts +13 -3
- package/src/server/codex-model-list.ts +2 -1
- package/src/server/direct-local-http.ts +26 -3
- package/src/server/index/link-listener.ts +20 -14
- package/src/server/index/serve-options.ts +1 -0
- package/src/server/index.ts +3 -2
- package/src/server/link-turn.ts +17 -5
- package/src/server/management/config-routes.ts +39 -3
- package/src/server/management/link-child-preflight.ts +1 -1
- package/src/server/management/link-enrollment.ts +3 -3
- package/src/server/management/link-route-edit.ts +20 -1
- package/src/server/management/link-route-request.ts +11 -5
- package/src/server/management/oauth-account-routes.ts +43 -13
- package/src/server/management/provider-credential-release.ts +44 -0
- package/src/server/management/provider-overwrite-carry.ts +3 -0
- package/src/server/management/provider-routes.ts +12 -12
- package/src/server/management/static-catalog-probe.ts +33 -0
- package/src/server/management/usage-aggregate-cache.ts +6 -3
- package/src/server/messages-native.ts +16 -2
- package/src/server/proxy-liveness.ts +54 -9
- package/src/server/relay.ts +6 -1
- package/src/server/request-log-conversation.ts +8 -4
- package/src/server/request-log-failure-detail.ts +26 -9
- package/src/server/request-log.ts +5 -1
- package/src/server/reserve-capability-startup.ts +32 -0
- package/src/server/responses/adapter-continuation.ts +59 -25
- package/src/server/responses/adapter-delivery.ts +2 -0
- package/src/server/responses/adapter-dispatch.ts +39 -18
- package/src/server/responses/antigravity-fault-rotation.ts +24 -0
- package/src/server/responses/antigravity-validation-refusal.ts +43 -6
- package/src/server/responses/codex-tool-catalog.ts +47 -10
- package/src/server/responses/combo-selection-keepalive.ts +254 -0
- package/src/server/responses/combo-session-recall.ts +26 -1
- package/src/server/responses/combo-stream-preflight.ts +35 -26
- package/src/server/responses/core-combo-failure.ts +6 -0
- package/src/server/responses/core-combo-native.ts +2 -1
- package/src/server/responses/core-combo.ts +67 -28
- package/src/server/responses/core-errors.ts +9 -6
- package/src/server/responses/core-options.ts +10 -0
- package/src/server/responses/core.ts +21 -0
- package/src/server/responses/estimated-usage.ts +115 -0
- package/src/server/responses/input-admission.ts +41 -3
- package/src/server/responses/jev-model-invoke.ts +7 -2
- package/src/server/responses/passthrough-completion.ts +6 -3
- package/src/server/responses/passthrough-delivery.ts +47 -8
- package/src/server/responses/passthrough-dispatch.ts +3 -0
- package/src/server/responses/request-prepare.ts +9 -5
- package/src/server/responses/request-send-budget.ts +1 -1
- package/src/server/responses/request-transport.ts +10 -2
- package/src/server/responses/sidecar-execution.ts +11 -4
- package/src/service/desktop-supervision.d.mts +2 -0
- package/src/service/desktop-supervision.mjs +5 -0
- package/src/service/windows-checked-stop-live.ts +28 -5
- package/src/stall-timeout.ts +11 -0
- package/src/types/config.ts +15 -92
- package/src/types/provider.ts +13 -0
- package/src/types/request.ts +23 -3
- package/src/types/routed-catalog-defaults.ts +17 -0
- package/src/types/routing-profile.ts +90 -0
- package/src/types.ts +1 -0
- package/src/update/index.ts +1 -1
- package/src/usage/expected-prices.ts +35 -0
- package/src/usage/ledger-scanner.ts +44 -10
- package/src/usage/log.ts +14 -4
- package/src/usage/telemetry-contract.ts +1 -0
- package/src/web-search/loop.ts +20 -2
- package/src/web-search/parse.ts +2 -12
- package/src/web-search/passthrough-bridge.ts +7 -0
- package/src/web-search/sources.ts +13 -0
- package/gui/dist/assets/brand-mark-XOLJbomA.js +0 -1
- package/gui/dist/assets/index-DQtCRNAw.css +0 -2
- package/gui/dist/classic/assets/quota-summary-Dy5_wfTT.js +0 -1
|
@@ -39,6 +39,12 @@ export const MAX_HELD_TOOL_TEXT_BYTES = 64 * 1024;
|
|
|
39
39
|
export interface CommandCodeDeclaredTool {
|
|
40
40
|
freeform: boolean;
|
|
41
41
|
schema: Record<string, unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* The caller's original schema when `schema` is a normalized wire view of it. The wire view
|
|
44
|
+
* flattens root alternatives lossily, so restored arguments must satisfy both; a declared
|
|
45
|
+
* schema the restored-value validator cannot evaluate (a `$ref`, say) fails closed.
|
|
46
|
+
*/
|
|
47
|
+
declaredSchema?: Record<string, unknown>;
|
|
42
48
|
}
|
|
43
49
|
export type CommandCodeDeclaredTools = ReadonlyMap<string, CommandCodeDeclaredTool>;
|
|
44
50
|
|
|
@@ -226,7 +232,9 @@ export function salvagedArguments(markup: ToolCallMarkup, tool: CommandCodeDecla
|
|
|
226
232
|
output[key] = decoded;
|
|
227
233
|
}
|
|
228
234
|
if (required.some(key => !Object.hasOwn(output, key))) return undefined;
|
|
229
|
-
|
|
235
|
+
if (!validatesRestoredValue(output, tool.schema)) return undefined;
|
|
236
|
+
if (tool.declaredSchema !== undefined && !validatesRestoredValue(output, tool.declaredSchema)) return undefined;
|
|
237
|
+
return JSON.stringify(output);
|
|
230
238
|
}
|
|
231
239
|
|
|
232
240
|
interface TextBlock {
|
|
@@ -14,6 +14,7 @@ import { configuredReasoningEfforts, modelRecordValue } from "../reasoning-effor
|
|
|
14
14
|
import { commandCodeReasoningEfforts, refreshCommandCodeReasoningEfforts } from "../providers/command-code-efforts";
|
|
15
15
|
import { identifyRoutedModel } from "./identity";
|
|
16
16
|
import { buildNonOpenAIToolCatalogNudgeForTools } from "./tool-catalog-nudge";
|
|
17
|
+
import { normalizeAnthropicInputSchema } from "./anthropic-input-schema";
|
|
17
18
|
import { parseDataUrl } from "./image";
|
|
18
19
|
import { createAdapterPhysicalSend } from "./physical-send";
|
|
19
20
|
import { SendBudgetExhaustedError } from "../lib/upstream-retry";
|
|
@@ -26,10 +27,25 @@ import {
|
|
|
26
27
|
import { CommandCodeToolTextFilter, type CommandCodeDeclaredTools } from "./command-code-tool-text";
|
|
27
28
|
import { EMPTY_COMMAND_CODE_PROJECT_CONTEXT, loadCommandCodeProjectContext } from "./command-code-project-context";
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Text-call recovery matches markup against the schema the model was shown (`wireTools`), so a
|
|
32
|
+
* root-composed tool keeps the top-level `properties` its markup names. Definitions are dropped
|
|
33
|
+
* because the restored-value validator accepts no `$ref`: a reference left in the normalized
|
|
34
|
+
* schema still fails closed there. The original schema is validated too (`declaredSchema`),
|
|
35
|
+
* because the wire view flattens root alternatives and would otherwise admit calls the tool
|
|
36
|
+
* itself rejects.
|
|
37
|
+
*/
|
|
38
|
+
function recoverySchema(tool: OcxTool): Record<string, unknown> {
|
|
39
|
+
const { $defs: _defs, definitions: _definitions, ...schema } = normalizeAnthropicInputSchema(tool.parameters);
|
|
40
|
+
return schema;
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
function declaredTools(tools: OcxTool[]): CommandCodeDeclaredTools {
|
|
30
44
|
return new Map(tools.map(tool => [
|
|
31
45
|
namespacedToolName(tool.namespace, tool.name),
|
|
32
|
-
|
|
46
|
+
tool.freeform === true
|
|
47
|
+
? { freeform: true, schema: tool.parameters }
|
|
48
|
+
: { freeform: false, schema: recoverySchema(tool), declaredSchema: tool.parameters },
|
|
33
49
|
]));
|
|
34
50
|
}
|
|
35
51
|
|
|
@@ -207,7 +223,7 @@ function wireTools(tools: OcxTool[]): Array<Record<string, unknown>> {
|
|
|
207
223
|
return tools.map(tool => ({
|
|
208
224
|
name: namespacedToolName(tool.namespace, tool.name),
|
|
209
225
|
description: tool.description,
|
|
210
|
-
input_schema: tool.parameters,
|
|
226
|
+
input_schema: normalizeAnthropicInputSchema(tool.parameters),
|
|
211
227
|
}));
|
|
212
228
|
}
|
|
213
229
|
|
|
@@ -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
|
-
|
|
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(
|
|
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
|
-
|
|
260
|
-
if (
|
|
261
|
-
|
|
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,41 @@ 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
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
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
|
+
* The three #8558 entries (Claude Code system prompt) are whole sentences
|
|
667
|
+
* Claude Code itself sends in its system prompt: "You are a Claude agent,
|
|
668
|
+
* built on Anthropic's Claude Agent SDK", the dual-use security-tools bullet,
|
|
669
|
+
* and "Claude Code is available as a CLI in the terminal…". Each one alone
|
|
670
|
+
* was refused with `permission_denied` against a live account, every
|
|
671
|
+
* sub-phrase passed, and lowercasing, a missing comma or a doubled space was
|
|
672
|
+
* still refused — so they match like the Codex entries (case-insensitive,
|
|
673
|
+
* flexible whitespace, optional commas) and every rewrite keeps the original
|
|
674
|
+
* authorization/safety meaning.
|
|
675
|
+
*
|
|
676
|
+
* Scope note: by default the sanitizer only ever touches *instruction
|
|
677
|
+
* surfaces* — tool descriptions and the #2 system prompt, where a
|
|
678
|
+
* meaning-preserving reword loses nothing. Data fields — message text (#3),
|
|
679
|
+
* replayed thinking (#11), image captions (#10.3), and tool-call arguments
|
|
680
|
+
* (#6.3) — carry literal content (patches, exact needles, quoted file bytes)
|
|
640
681
|
* where a rewrite would silently change what the model did or sees. If a
|
|
641
682
|
* blocklisted phrase reaches the cloud inside one of those, the request is
|
|
642
|
-
* refused and the caller sees the upstream `permission_denied
|
|
643
|
-
*
|
|
683
|
+
* refused and the caller sees the upstream `permission_denied`.
|
|
684
|
+
*
|
|
685
|
+
* That refusal is the correct failure for short histories, but a long thread
|
|
686
|
+
* keeps resending its earlier turns, so one quoted trigger phrase anywhere
|
|
687
|
+
* in the history (e.g. a tool description pasted into the transcript, or a
|
|
688
|
+
* mid-conversation system block Codex injected) permanently refuses every
|
|
689
|
+
* subsequent request. Operators who would rather have the rewrites applied
|
|
690
|
+
* to data surfaces than lose the thread can set
|
|
691
|
+
* `OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES=1` — it is opt-in precisely
|
|
692
|
+
* because rewriting literal history changes what the model is told.
|
|
644
693
|
*/
|
|
645
694
|
const COGNITION_BLOCKLIST_REWRITES: ReadonlyArray<[RegExp, string]> = [
|
|
646
695
|
[/\bTakes a task_id parameter identifying the task\b/g, "Accepts a task_id parameter identifying the task"],
|
|
@@ -656,6 +705,28 @@ const COGNITION_BLOCKLIST_REWRITES: ReadonlyArray<[RegExp, string]> = [
|
|
|
656
705
|
/\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
706
|
"asking the user whether to allow the action in the `justification` parameter",
|
|
658
707
|
],
|
|
708
|
+
[
|
|
709
|
+
/\bCodex\s+refers\s+to\s+the\s+open[-\s]?source\s+agentic\s+coding\s+interface\b/gi,
|
|
710
|
+
"Codex refers to the open-source agentic coding tool",
|
|
711
|
+
],
|
|
712
|
+
[
|
|
713
|
+
/\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,
|
|
714
|
+
"Don’t emit ANSI escape codes directly — the CLI renderer applies them",
|
|
715
|
+
],
|
|
716
|
+
// #8558: Claude Code system prompt. Matched like the Codex entries:
|
|
717
|
+
// case-insensitive, flexible whitespace, optional commas.
|
|
718
|
+
[
|
|
719
|
+
/\bYou\s+are\s+a\s+Claude\s+agent,?\s+built\s+on\s+Anthropic['’]?s\s+Claude\s+Agent\s+SDK\b/gi,
|
|
720
|
+
"You are a Claude agent, built on Anthropic's Claude Agent Toolkit",
|
|
721
|
+
],
|
|
722
|
+
[
|
|
723
|
+
/\bDual-use\s+security\s+tools\s+\(C2\s+frameworks,?\s+credential\s+testing,?\s+exploit\s+development\)\s+require\s+clear\s+authorization\s+context:\s+pentesting\s+engagements,?\s+CTF\s+competitions,?\s+security\s+research,?\s+or\s+defensive\s+use\s+cases\b/gi,
|
|
724
|
+
"Dual-purpose security tools (C2 frameworks, credential testing, exploit development) need clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases",
|
|
725
|
+
],
|
|
726
|
+
[
|
|
727
|
+
/\bClaude\s+Code\s+is\s+available\s+as\s+a\s+CLI\s+in\s+the\s+terminal,?\s+desktop\s+app\s+\(Mac\/Windows\),?\s+web\s+app\s+\(claude\.ai\/code\),?\s+and\s+IDE\s+extensions\s+\(VS\s+Code,?\s+JetBrains\)/gi,
|
|
728
|
+
"Claude Code ships as a CLI in the terminal, desktop app (Mac/Windows), web app (claude.ai/code), and IDE extensions (VS Code, JetBrains)",
|
|
729
|
+
],
|
|
659
730
|
];
|
|
660
731
|
|
|
661
732
|
function sanitizeTextForCognition(text: string): string {
|
|
@@ -742,6 +813,7 @@ function buildGetChatMessageRequest(args: BuildArgs): Buffer {
|
|
|
742
813
|
signature: m.role === 'assistant' ? m.signature : undefined,
|
|
743
814
|
signatureType: m.role === 'assistant' ? m.signature_type : undefined,
|
|
744
815
|
isError: m.role === 'tool' ? m.is_error : undefined,
|
|
816
|
+
sanitizeDataSurfaces: args.sanitizeDataSurfaces,
|
|
745
817
|
},
|
|
746
818
|
),
|
|
747
819
|
),
|
|
@@ -1232,6 +1304,11 @@ export async function* streamChatEvents(req: CloudChatRequest): AsyncGenerator<C
|
|
|
1232
1304
|
const userJwt = process.env.OPENCODEX_DEVIN_SEND_USER_JWT === "1"
|
|
1233
1305
|
? await getCachedUserJwt(req.apiKey, host, req.signal)
|
|
1234
1306
|
: undefined;
|
|
1307
|
+
// Opt-in: extend the blocklist rewrite to data surfaces too. Default keeps
|
|
1308
|
+
// history byte-exact; setting this trades a possible meaning-preserving
|
|
1309
|
+
// rewrite inside quoted content for not having the whole request refused
|
|
1310
|
+
// when a long thread's history happens to contain a trigger phrase.
|
|
1311
|
+
const sanitizeDataSurfaces = process.env.OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES === "1";
|
|
1235
1312
|
|
|
1236
1313
|
// Pre-flight: consult the per-account model catalog. Cognition's cloud
|
|
1237
1314
|
// returns an opaque `permission_denied: "an internal error occurred (trace
|
|
@@ -1270,6 +1347,7 @@ export async function* streamChatEvents(req: CloudChatRequest): AsyncGenerator<C
|
|
|
1270
1347
|
modelUid: req.modelUid,
|
|
1271
1348
|
messages: req.messages,
|
|
1272
1349
|
tools: req.tools,
|
|
1350
|
+
sanitizeDataSurfaces,
|
|
1273
1351
|
cascadeId: sessionIds.cascadeId,
|
|
1274
1352
|
sessionId: sessionIds.sessionId,
|
|
1275
1353
|
trajectoryId: req.trajectoryId,
|
|
@@ -1639,7 +1717,10 @@ export async function* streamChatEvents(req: CloudChatRequest): AsyncGenerator<C
|
|
|
1639
1717
|
const enriched =
|
|
1640
1718
|
`Cognition denied this request (permission_denied). If tool descriptions ` +
|
|
1641
1719
|
`are present, a blocklisted phrase may have triggered this — see the ` +
|
|
1642
|
-
`COGNITION_BLOCKLIST_REWRITES table in cloud-direct/chat.ts. ` +
|
|
1720
|
+
`COGNITION_BLOCKLIST_REWRITES table in cloud-direct/chat.ts. A phrase ` +
|
|
1721
|
+
`quoted inside history data (message text, thinking, tool-call args) can ` +
|
|
1722
|
+
`also trip it; OPENCODEX_DEVIN_SANITIZE_DATA_SURFACES=1 extends the ` +
|
|
1723
|
+
`rewrite to those surfaces at the cost of altering quoted content. ` +
|
|
1643
1724
|
`(cloud trace ID: ${trailerError.traceId ?? 'n/a'})`;
|
|
1644
1725
|
throw new CloudChatError(
|
|
1645
1726
|
enriched,
|
|
@@ -29,6 +29,9 @@ export const DEVIN_STATIC_MODELS = [
|
|
|
29
29
|
"gpt-6-1-sol",
|
|
30
30
|
// 261027 preemptive: GPT-6.1 Terra (mirrors Devin's GPT-6.1 Sol seed; uid unverified).
|
|
31
31
|
"gpt-6-1-terra",
|
|
32
|
+
// 261118 preemptive: GPT-6.2 Sol and Astra (mirror Devin's GPT-6.1 Sol seed; uids unverified).
|
|
33
|
+
"gpt-6-2-sol",
|
|
34
|
+
"gpt-6-2-astra",
|
|
32
35
|
"claude-opus-4-8",
|
|
33
36
|
// 261110: Claude Fable 5.2 (docs.devin.ai/desktop/models; uid claude-fable-5-2-<effort>).
|
|
34
37
|
"claude-fable-5-2",
|
|
@@ -58,7 +61,11 @@ export const DEVIN_STATIC_MODELS = [
|
|
|
58
61
|
* number over from the model's original vendor.
|
|
59
62
|
*/
|
|
60
63
|
export const DEVIN_MODEL_CONTEXT_WINDOWS: Record<string, number> = {
|
|
61
|
-
|
|
64
|
+
// 261112: live catalog context_window 850_000; a real turn completed at 754,971 total.
|
|
65
|
+
"swe-2": 850_000,
|
|
66
|
+
// 261112: live catalog also advertises 850_000, but observed turns terminate at
|
|
67
|
+
// totalTokens 262,140 -- the serving bound is ~256KiB, not the catalog figure.
|
|
68
|
+
"swe-2-flash": 262_000,
|
|
62
69
|
"swe-1-7": 262_000,
|
|
63
70
|
"swe-1-7-lightning": 202_752,
|
|
64
71
|
"swe-1-6": 200_000,
|
|
@@ -72,6 +79,9 @@ export const DEVIN_MODEL_CONTEXT_WINDOWS: Record<string, number> = {
|
|
|
72
79
|
"gpt-6-1-sol": 1_000_000,
|
|
73
80
|
// 261027 preemptive: GPT-6.1 Terra (unmeasured; mirrors Devin's GPT-6.1 Sol window).
|
|
74
81
|
"gpt-6-1-terra": 1_000_000,
|
|
82
|
+
// 261118 preemptive: GPT-6.2 Sol and Astra (unmeasured; mirror Devin's GPT-6.1 Sol window).
|
|
83
|
+
"gpt-6-2-sol": 1_000_000,
|
|
84
|
+
"gpt-6-2-astra": 1_000_000,
|
|
75
85
|
"claude-opus-4-8": 1_000_000,
|
|
76
86
|
// 260923: read from the live catalog (devin/claude-opus-5-5 context_length 1_000_000).
|
|
77
87
|
"claude-opus-5-5": 1_000_000,
|
|
@@ -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
|
-
|
|
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
|
|
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`;
|
|
@@ -30,6 +30,9 @@ export const KIRO_NATIVE_EFFORT_FIELDS: Record<string, "reasoning" | "output_con
|
|
|
30
30
|
"gpt-6.1-sol": "reasoning",
|
|
31
31
|
// 261027 preemptive: GPT-6.1 Terra (mirrors GPT-6.1 Sol; see kiro-models.ts).
|
|
32
32
|
"gpt-6.1-terra": "reasoning",
|
|
33
|
+
// 261118 preemptive: GPT-6.2 Sol and Astra (mirror GPT-6.1 Sol; see kiro-models.ts).
|
|
34
|
+
"gpt-6.2-sol": "reasoning",
|
|
35
|
+
"gpt-6.2-astra": "reasoning",
|
|
33
36
|
// Claude models whose output_config.effort was accepted by a live probe on 2026-11-07, at every
|
|
34
37
|
// ladder rung except xhigh on the 4.6 pair. Haiku 4.5, Opus 4.5 and Sonnet 4.5 reject the field
|
|
35
38
|
// (HTTP 400). The probe covered these nine ids individually; no other Claude id was measured, so
|
|
@@ -89,10 +89,16 @@ function rejectAllExcept(accepted: readonly string[]): ReadonlySet<string> {
|
|
|
89
89
|
// that total as 28, one fewer than the 29 keys its own list names; the accepted keys, not the
|
|
90
90
|
// stated count, are what the exception below encodes. Its two 5.5 probes explicitly name only
|
|
91
91
|
// pattern and maximum.
|
|
92
|
+
// opus-5.5 also keeps the keys the Claude Desktop and Claude Code catalogs carry: five days of
|
|
93
|
+
// production traffic sent all of them unstripped, 10,565 HTTP 200 and no ValidationException.
|
|
92
94
|
// Other keywords and model ids retain the default strip until supported by evidence.
|
|
95
|
+
const KIRO_OPUS_55_ACCEPTED_SCHEMA_KEYS = [
|
|
96
|
+
"$schema", "additionalProperties", "pattern", "format", "minLength", "maxLength",
|
|
97
|
+
"minimum", "maximum", "exclusiveMinimum", "minItems", "maxItems", "propertyNames",
|
|
98
|
+
] as const;
|
|
93
99
|
const KIRO_SCHEMA_KEY_EXCEPTIONS: ReadonlyMap<string, ReadonlySet<string>> = new Map([
|
|
94
100
|
["claude-opus-4.5", NO_SCHEMA_KEYS],
|
|
95
|
-
["claude-opus-5.5", rejectAllExcept(
|
|
101
|
+
["claude-opus-5.5", rejectAllExcept(KIRO_OPUS_55_ACCEPTED_SCHEMA_KEYS)],
|
|
96
102
|
["claude-sonnet-5.5", rejectAllExcept(["pattern", "maximum"])],
|
|
97
103
|
]);
|
|
98
104
|
|
|
@@ -282,14 +288,13 @@ export function convertKiroToolContext(
|
|
|
282
288
|
const filled: unknown[] = [];
|
|
283
289
|
for (const entry of candidates) {
|
|
284
290
|
if (entry === reserved) continue;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
) break;
|
|
291
|
+
if (!unbounded) {
|
|
292
|
+
// Measure the projected FINAL array only while enforcing a budget. Repeatedly copying
|
|
293
|
+
// the admitted prefix would make an unbounded catalog quadratic even without measuring it.
|
|
294
|
+
const projected = reserved ? [...filled, entry.converted, reserved.converted] : [...filled, entry.converted];
|
|
295
|
+
if (projected.length > MAX_KIRO_TOOL_COUNT
|
|
296
|
+
|| serializedToolCatalogBytes(projected) > MAX_KIRO_TOOL_CATALOG_BYTES) break;
|
|
297
|
+
}
|
|
293
298
|
filled.push(entry.converted);
|
|
294
299
|
admitted.add(entry.index);
|
|
295
300
|
}
|
|
@@ -360,13 +360,15 @@ export function createResponsesPassthroughAdapter(provider: OcxProviderConfig):
|
|
|
360
360
|
outBody = injectXaiResponsesXSearch(outBody, provider, parsed._replayPrefixLen);
|
|
361
361
|
// xAI, Meta, Azure and Kimi Code (#8075) answer 400 for `output.encrypted_content`
|
|
362
362
|
// instead of ignoring it; Codex Desktop asks for it on every turn (#7878).
|
|
363
|
+
// Go multiplexes backends with different include support (#8702). Use its exact
|
|
364
|
+
// destination's common compatibility policy rather than a model-name allowlist.
|
|
363
365
|
// Azure also rejects this exact include entry, including on plain Responses routes.
|
|
364
366
|
const isAzureResponses = provider.adapter === "azure" || provider.adapter === "azure-openai"
|
|
365
367
|
|| new URL(url).hostname.toLowerCase().endsWith(".openai.azure.com");
|
|
366
368
|
const arkKimi = !forward && provider.arkKimiResponsesModels?.includes(parsed.modelId);
|
|
367
369
|
if (arkKimi) outBody = stripArkKimiOrphanCipher(outBody);
|
|
368
370
|
if (isXaiResponsesDestination(provider) || isMetaAiResponsesDestination(url) || isAzureResponses
|
|
369
|
-
|| isKimiCodingResponsesHttpsUrl(url) || arkKimi) {
|
|
371
|
+
|| isKimiCodingResponsesHttpsUrl(url) || arkKimi || isOpenCodeGoResponsesUrl(url)) {
|
|
370
372
|
outBody = stripUnsupportedOutputInclude(outBody);
|
|
371
373
|
}
|
|
372
374
|
// xAI and explicitly classified compatible gateways reject these OpenAI web_search
|
|
@@ -9,6 +9,7 @@ import { stripOpenAiOnlyWebSearchFields } from "./web-search";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Codex requests output.encrypted_content, which xAI, Meta, Azure and Kimi Code reject with HTTP 400.
|
|
12
|
+
* OpenCode Go uses the same compatibility policy because some of its Responses backends reject it.
|
|
12
13
|
* The caller gates this on the destination. Preserve reasoning.encrypted_content
|
|
13
14
|
* for stateless replay and leave unknown or malformed values for upstream validation.
|
|
14
15
|
*/
|
|
@@ -63,7 +63,14 @@ export function buildQoderChildEnv(profile: QoderProfile, apiKey: string, system
|
|
|
63
63
|
...(systemPrompt ? { [promptEnv]: systemPrompt } : {}) };
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/**
|
|
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);
|
|
@@ -119,7 +119,7 @@ export function buildNonOpenAIToolCatalogNudgeFromNames(
|
|
|
119
119
|
"Valid tool names for this turn are exactly " + quoteNames(names) + ".",
|
|
120
120
|
"These listed names are the complete top-level tool-call surface for this turn.",
|
|
121
121
|
"Call only listed names with their listed argument keys; do not invent, translate, or rename tools.",
|
|
122
|
-
"
|
|
122
|
+
"References to other functions in text do not add callable functions.",
|
|
123
123
|
verifiedCodeModeExecName
|
|
124
124
|
? "`" + verifiedCodeModeExecName + "` is Codex code mode: its body is JavaScript evaluated in a V8 isolate. Nested helpers are called INSIDE that body as `await tools.<name>(...)`, for example `await tools.exec_command({cmd: \"ls\"})` or `await tools.codex_app__list_threads({})`. Absence from the top-level catalog or from `" + verifiedCodeModeExecName + "`'s description is not absence: deferred helpers stay callable on `tools.<name>`. Discover them from the isolate global `ALL_TOOLS`, not `tools.ALL_TOOLS`. Do not skip an available nested helper because it is omitted from the listed top-level names. " + CODE_MODE_RESULT_ECHO_SENTENCE + " Nested `tools.apply_patch(input)` is host-executed: the string must begin exactly with `*** Begin Patch` and end with `*** End Patch`, each marker line being three asterisks, one space, the two words, then end of line with no further asterisks. OpenCodex does not rewrite JavaScript inside exec, so extra asterisks on a marker line are rejected by Codex before the file is touched. " + CODE_MODE_HOST_CONTRACT_SENTENCE
|
|
125
125
|
: "If a listed tool exposes nested helpers such as a tools.* API, call the listed parent tool and use those helpers only inside that tool's input.",
|
package/src/adapters/zed.ts
CHANGED
|
@@ -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
|
-
|
|
171
|
+
const decoded = decoder.decode(chunk, { stream: true });
|
|
172
|
+
buffer += decoded;
|
|
172
173
|
let start = 0;
|
|
173
|
-
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderAdapter } from "../adapters/base";
|
|
2
|
-
import { isAllowedToolChoice, type AdapterEvent, type OcxAssistantContentPart, type OcxContentPart, type OcxMessage, type OcxParsedRequest, type OcxTool } from "../types";
|
|
2
|
+
import { isAllowedToolChoice, toolRestrictsCallers, type AdapterEvent, type OcxAssistantContentPart, type OcxContentPart, type OcxMessage, type OcxParsedRequest, type OcxTool } from "../types";
|
|
3
3
|
import { isRec, type Rec } from "./inbound-records";
|
|
4
4
|
import { readClientToolDiscovery } from "./inbound-tool-loading";
|
|
5
5
|
|
|
@@ -62,6 +62,9 @@ function appendText(content: string | OcxContentPart[], text: string): string |
|
|
|
62
62
|
export function projectChatToolDispatch(parsed: OcxParsedRequest, raw: Rec): ChatToolDispatchProjection | null {
|
|
63
63
|
const tools = parsed.context.tools;
|
|
64
64
|
if (!Array.isArray(tools)) return null;
|
|
65
|
+
// Keep caller restrictions visible to the final adapter guard; the dispatcher cannot
|
|
66
|
+
// preserve them by moving a restricted declaration into ToolSearch result text.
|
|
67
|
+
if (tools.some(toolRestrictsCallers)) return null;
|
|
65
68
|
|
|
66
69
|
const declared = new Map<string, OcxTool>();
|
|
67
70
|
for (const tool of tools) {
|
|
@@ -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
|
|
56
|
-
reason?:
|
|
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
|
-
|
|
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"))
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
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) {
|
|
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 {
|
package/src/cli/account-api.ts
CHANGED
|
@@ -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;
|