@yansigit/opencodex 2.33.0 → 2.35.0
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/README.md +3 -3
- package/gui/dist/assets/index-BjCaHxdz.js +112 -0
- package/gui/dist/assets/index-DLkXOXLC.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/adapters/anthropic.ts +79 -2
- package/src/adapters/command-code.ts +141 -23
- package/src/adapters/cursor/call-id.ts +44 -0
- package/src/adapters/cursor/checkpoint-store.ts +15 -10
- package/src/adapters/cursor/discovery.ts +60 -2
- package/src/adapters/cursor/effort-map.ts +79 -1
- package/src/adapters/cursor/envelope-echo.ts +162 -0
- package/src/adapters/cursor/live-models.ts +7 -2
- package/src/adapters/cursor/live-transport.ts +17 -1
- package/src/adapters/cursor/message-mapper.ts +4 -1
- package/src/adapters/cursor/native-exec-fs.ts +13 -12
- package/src/adapters/cursor/native-exec-network.ts +3 -5
- package/src/adapters/cursor/native-exec-policy.ts +47 -0
- package/src/adapters/cursor/native-exec-shell.ts +116 -31
- package/src/adapters/cursor/native-exec.ts +38 -10
- package/src/adapters/cursor/protobuf-events.ts +28 -2
- package/src/adapters/cursor/protobuf-request.ts +93 -41
- package/src/adapters/cursor/request-builder.ts +39 -10
- package/src/adapters/cursor/tool-definitions.ts +27 -3
- package/src/adapters/cursor/tool-result-normalize.ts +51 -6
- package/src/adapters/cursor/types.ts +23 -4
- package/src/adapters/cursor.ts +170 -29
- package/src/adapters/google-aistudio-parser.ts +49 -0
- package/src/adapters/google-antigravity-replay.ts +105 -25
- package/src/adapters/google-antigravity-wire.ts +5 -0
- package/src/adapters/google-errors.ts +41 -12
- package/src/adapters/google-http.ts +12 -11
- package/src/adapters/google.ts +219 -36
- package/src/adapters/image.ts +1 -1
- package/src/adapters/kiro-constants.ts +15 -0
- package/src/adapters/kiro-tools.ts +43 -15
- package/src/adapters/kiro.ts +54 -9
- package/src/adapters/openai-chat.ts +286 -242
- package/src/adapters/openai-responses.ts +335 -24
- package/src/adapters/run-turn-queue.ts +36 -1
- package/src/adapters/tool-catalog-nudge.ts +2 -2
- package/src/adapters/xai-tool-schema.ts +436 -0
- package/src/bridge.ts +67 -26
- package/src/chat/inbound.ts +29 -1
- package/src/chat/outbound.ts +15 -7
- package/src/claude/agents-inject.ts +8 -1
- package/src/claude/outbound.ts +10 -8
- package/src/cli/account-api.ts +27 -7
- package/src/cli/account-extended.ts +10 -3
- package/src/cli/account.ts +29 -5
- package/src/cli/alias.ts +66 -0
- package/src/cli/claude.ts +26 -1
- package/src/cli/dispatch.ts +13 -1
- package/src/cli/help.ts +1 -0
- package/src/cli/index.ts +6 -1
- package/src/cli/init.ts +1 -0
- package/src/cli/models-runtime.ts +95 -0
- package/src/cli/models.ts +13 -7
- package/src/cli/provider-runtime.ts +16 -2
- package/src/cli/registry.ts +6 -1
- package/src/cli/telemetry-commands.ts +25 -0
- package/src/cli/v2.ts +34 -10
- package/src/codex/account-pause.ts +2 -1
- package/src/codex/account-priority.ts +3 -2
- package/src/codex/app-server-processes.ts +80 -6
- package/src/codex/auth-api.ts +48 -8
- package/src/codex/auth-context.ts +21 -18
- package/src/codex/catalog/aggregation.ts +6 -0
- package/src/codex/catalog/model-metadata.ts +13 -1
- package/src/codex/catalog/native-models.ts +5 -2
- package/src/codex/catalog/parsing.ts +16 -0
- package/src/codex/catalog/provider-fetch.ts +20 -3
- package/src/codex/catalog/sync.ts +127 -2
- package/src/codex/catalog.ts +1 -1
- package/src/codex/codex-write-lock.ts +3 -1
- package/src/codex/convergence-types.ts +1 -1
- package/src/codex/convergence.ts +22 -2
- package/src/codex/desired-state.ts +2 -2
- package/src/codex/desktop-app-restart.ts +18 -5
- package/src/codex/inject-coordination.ts +83 -0
- package/src/codex/inject.ts +14 -1
- package/src/codex/log-guard/inspect.ts +22 -4
- package/src/codex/model-entitlements.ts +9 -2
- package/src/codex/prompt-layers.ts +371 -25
- package/src/codex/prompt-text-probe.ts +238 -0
- package/src/codex/quota.ts +123 -18
- package/src/codex/routing.ts +9 -0
- package/src/codex/subagent-model-fallback.ts +198 -27
- package/src/codex/transition-state.ts +107 -8
- package/src/combos/types.ts +10 -0
- package/src/compatibility/openai-responses.ts +33 -1
- package/src/config/autonomous-remediation.ts +21 -0
- package/src/config/provider-validation.ts +14 -0
- package/src/config/rebase-provenance.ts +68 -0
- package/src/config.ts +191 -17
- package/src/generated/compatibility-version.json +279 -159
- package/src/generated/model-metadata.ts +3 -0
- package/src/images/loop.ts +5 -4
- package/src/lab/conformance/fixtures/protocol-v1-cases.json +1 -1
- package/src/lab/fabric/producer-child.ts +1 -1
- package/src/lib/config-ownership.ts +20 -0
- package/src/lib/errors.ts +11 -2
- package/src/lib/package-tree-integrity.ts +101 -0
- package/src/oauth/aistudio-credentials.ts +65 -0
- package/src/oauth/aistudio-native-daemon.ts +116 -0
- package/src/oauth/aistudio-session-sync.ts +95 -0
- package/src/oauth/generic-account-failover.ts +231 -0
- package/src/oauth/google-aistudio-auth.ts +98 -0
- package/src/oauth/index.ts +57 -5
- package/src/oauth/key-providers.ts +18 -1
- package/src/oauth/kiro.ts +45 -0
- package/src/oauth/login-cli.ts +65 -1
- package/src/oauth/types.ts +15 -0
- package/src/providers/codex-capacity.ts +5 -2
- package/src/providers/command-code-efforts.ts +38 -6
- package/src/providers/context-cap.ts +4 -3
- package/src/providers/default-aliases.ts +65 -0
- package/src/providers/derive.ts +29 -1
- package/src/providers/fastwire.ts +7 -1
- package/src/providers/model-presets.ts +119 -0
- package/src/providers/new-model-policy.ts +146 -0
- package/src/providers/provider-id-rewrite.ts +2 -1
- package/src/providers/quota.ts +157 -46
- package/src/providers/registry.ts +184 -71
- package/src/providers/slug-codec.ts +52 -0
- package/src/responses/code-mode-helper-compat.ts +50 -0
- package/src/responses/custom-tool-compat.ts +34 -10
- package/src/responses/parser.ts +4 -0
- package/src/responses/schema.ts +5 -1
- package/src/responses/thought-signature-replay.ts +17 -0
- package/src/router.ts +43 -2
- package/src/routing/account-pool/cooldown.ts +8 -0
- package/src/routing/account-pool/index.ts +1 -0
- package/src/routing/analytics.ts +1 -0
- package/src/routing/quota.ts +10 -0
- package/src/server/auth-cors.ts +24 -0
- package/src/server/chat-completions.ts +26 -16
- package/src/server/chat-native-sse.ts +3 -3
- package/src/server/chat-native.ts +30 -11
- package/src/server/claude-messages.ts +1 -1
- package/src/server/effort-policy.ts +16 -0
- package/src/server/index.ts +180 -14
- package/src/server/lifecycle.ts +52 -1
- package/src/server/management/agent-settings-routes.ts +31 -15
- package/src/server/management/codex-prompt-routes.ts +570 -0
- package/src/server/management/combo-routes.ts +2 -1
- package/src/server/management/config-routes.ts +27 -9
- package/src/server/management/context.ts +9 -0
- package/src/server/management/logs-usage-routes.ts +11 -5
- package/src/server/management/model-routes.ts +266 -0
- package/src/server/management/oauth-account-routes.ts +13 -3
- package/src/server/management/provider-routes.ts +137 -3
- package/src/server/management/routing-profile-routes.ts +2 -2
- package/src/server/management-api.ts +2 -0
- package/src/server/port-reclaim.ts +19 -1
- package/src/server/relay-eager.ts +147 -20
- package/src/server/relay.ts +251 -19
- package/src/server/request-log-conversation.ts +33 -0
- package/src/server/request-log.ts +48 -21
- package/src/server/responses/collaboration.ts +42 -5
- package/src/server/responses/combo-stream-preflight.ts +10 -3
- package/src/server/responses/core.ts +575 -140
- package/src/server/responses/empty-completion-guard.ts +35 -0
- package/src/server/responses/fetch-helpers.ts +14 -6
- package/src/server/responses/input-admission.ts +3 -1
- package/src/server/responses/passthrough-error.ts +33 -9
- package/src/server/responses/policy-fallback.ts +1 -1
- package/src/server/responses/responses-field-backfill.ts +105 -13
- package/src/server/responses/ws-upstream.ts +35 -5
- package/src/server/responses-custom-tool-repair.ts +52 -7
- package/src/server/responses-terminal-repair.ts +25 -4
- package/src/server/sse-frame-buffer.ts +31 -4
- package/src/server/ws-bridge.ts +14 -2
- package/src/smoke/fingerprint-cache.ts +133 -0
- package/src/smoke/live-scenarios.ts +33 -0
- package/src/smoke/runner.ts +119 -0
- package/src/telemetry/dispatcher.ts +44 -0
- package/src/telemetry/fingerprint.ts +24 -0
- package/src/telemetry/hook.ts +43 -0
- package/src/telemetry/ledger.ts +54 -0
- package/src/telemetry/types.ts +23 -0
- package/src/types/config.ts +66 -14
- package/src/types/provider.ts +79 -1
- package/src/types/request.ts +18 -10
- package/src/types/tools.ts +30 -11
- package/src/types.ts +1 -0
- package/src/usage/command-code-manifest.ts +116 -0
- package/src/usage/cost.ts +2 -2
- package/src/usage/expected-prices.ts +126 -24
- package/src/usage/log.ts +18 -8
- package/src/usage/summary.ts +34 -12
- package/src/web-search/exa-executor.ts +40 -9
- package/src/web-search/index.ts +16 -8
- package/src/web-search/loop.ts +5 -4
- package/gui/dist/assets/index-DKLr4LTE.js +0 -102
- package/gui/dist/assets/index-DrSQdTRd.css +0 -1
|
@@ -2,6 +2,7 @@ import type { Server } from "bun";
|
|
|
2
2
|
import { bridgeToResponsesSSE, buildResponseJSON, formatErrorResponse, type ResponsesTerminalStatus } from "../../bridge";
|
|
3
3
|
import {
|
|
4
4
|
getConfigPath,
|
|
5
|
+
loadConfig,
|
|
5
6
|
multiAgentGuidanceEnabled,
|
|
6
7
|
resolveEnvValue,
|
|
7
8
|
} from "../../config";
|
|
@@ -10,6 +11,7 @@ import { buildCompactV1Output, COMPACT_PROMPT, decodeCompactionSummary, extractC
|
|
|
10
11
|
import { FORWARD_HEADERS, sanitizeReasoningInputContent } from "../../adapters/openai-responses";
|
|
11
12
|
import { expandPreviousResponseInput, previousResponseProviderState, rememberResponseState } from "../../responses/state";
|
|
12
13
|
import { routeModel } from "../../router";
|
|
14
|
+
import type { RawEntry } from "../../codex/catalog/parsing";
|
|
13
15
|
import {
|
|
14
16
|
advanceComboAfterFailure,
|
|
15
17
|
comboDefaultEffort,
|
|
@@ -245,15 +247,47 @@ export async function resolveEffectiveSubagentRoster(
|
|
|
245
247
|
surface: SpawnAgentSurface,
|
|
246
248
|
): Promise<EffectiveSubagentRoster> {
|
|
247
249
|
const { effectiveSubagentRoster } = await import("../../codex/catalog");
|
|
248
|
-
return effectiveSubagentRoster(configuredModels, surface);
|
|
250
|
+
return effectiveSubagentRoster(configuredModels, surface, await freshSubagentCatalogEntries());
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The persisted Codex catalog, with native context metadata re-derived from the CURRENT config.
|
|
255
|
+
*
|
|
256
|
+
* The subagent roster reads the catalog FILE, which is only as fresh as the last sync. A row
|
|
257
|
+
* written before the operator widened the native window keeps its old `context_window`, so a
|
|
258
|
+
* child was planning and compacting against a narrower budget than its parent — measured at
|
|
259
|
+
* 272,000 x 95% = 258,400 while the request path resolved 922,000 (#2574).
|
|
260
|
+
*
|
|
261
|
+
* Re-applying the override is cheap and idempotent: it is the same function the writer uses,
|
|
262
|
+
* so a fresh catalog is unchanged and a stale one is repaired in memory rather than silently
|
|
263
|
+
* believed. It does not rewrite the file — the row on disk stays whatever the last sync wrote,
|
|
264
|
+
* and `ocx sync` remains what refreshes it.
|
|
265
|
+
*/
|
|
266
|
+
async function freshSubagentCatalogEntries(): Promise<RawEntry[]> {
|
|
267
|
+
const { readCatalog, readCodexCatalogPath, nativeContextLimits } = await import("../../codex/catalog");
|
|
268
|
+
const { applyNativeOpenAiContextOverride } = await import("../../codex/catalog/parsing");
|
|
269
|
+
const entries = readCatalog(readCodexCatalogPath())?.models ?? [];
|
|
270
|
+
if (entries.length === 0) return [];
|
|
271
|
+
let limits: ReturnType<typeof nativeContextLimits>;
|
|
272
|
+
try {
|
|
273
|
+
limits = nativeContextLimits(loadConfig());
|
|
274
|
+
} catch {
|
|
275
|
+
// An unreadable config must not cost the caller its roster; serve the file as written.
|
|
276
|
+
return entries;
|
|
277
|
+
}
|
|
278
|
+
return entries.map(entry => {
|
|
279
|
+
const clone = { ...entry };
|
|
280
|
+
applyNativeOpenAiContextOverride(clone, limits);
|
|
281
|
+
return clone;
|
|
282
|
+
});
|
|
249
283
|
}
|
|
250
284
|
|
|
251
285
|
/** Reuse one parsed catalog snapshot across every roster projection for this request. */
|
|
252
286
|
async function createRequestScopedSubagentRosterResolver(): Promise<NonNullable<
|
|
253
287
|
MultiAgentGuidanceDeps["resolveEffectiveSubagentRoster"]
|
|
254
288
|
>> {
|
|
255
|
-
const { effectiveSubagentRoster
|
|
256
|
-
const catalogEntries =
|
|
289
|
+
const { effectiveSubagentRoster } = await import("../../codex/catalog");
|
|
290
|
+
const catalogEntries = await freshSubagentCatalogEntries();
|
|
257
291
|
return (configuredModels, surface) =>
|
|
258
292
|
effectiveSubagentRoster(configuredModels, surface, catalogEntries);
|
|
259
293
|
}
|
|
@@ -390,7 +424,10 @@ export async function multiAgentGuidanceText(
|
|
|
390
424
|
+ "use only models listed for this collaboration surface. "
|
|
391
425
|
+ "When setting either override, set fork_turns to \"none\" "
|
|
392
426
|
+ "(or a positive turn count such as \"3\"; full-history forks reject overrides) "
|
|
393
|
-
+ "and make the task message self-contained."
|
|
427
|
+
+ "and make the task message self-contained. "
|
|
428
|
+
+ "When specifying model overrides, omit agent_type or use \"worker\" to prevent enforcing locked default models. "
|
|
429
|
+
+ "Subagent exec runs in a pure V8 isolate without require('fs'); "
|
|
430
|
+
+ "escape nested template literals in tools.apply_patch to prevent JavaScript syntax errors (e.g., write \\` and \\\${var}).";
|
|
394
431
|
let preferredText = "";
|
|
395
432
|
if (preferred) {
|
|
396
433
|
preferredText = ` Preferred sub-agent: model "${preferred.model}"`
|
|
@@ -426,7 +463,7 @@ export async function multiAgentGuidanceText(
|
|
|
426
463
|
|
|
427
464
|
|
|
428
465
|
|
|
429
|
-
export const V2_GUIDANCE_CHAR_BUDGET =
|
|
466
|
+
export const V2_GUIDANCE_CHAR_BUDGET = 1200;
|
|
430
467
|
|
|
431
468
|
export function applyInjectionPlaceholders(prompt: string, model?: string, effort?: string, roster?: string, fallback?: string, roles?: string): string {
|
|
432
469
|
return prompt
|
|
@@ -4,6 +4,12 @@ import { createSseInspector } from "../relay";
|
|
|
4
4
|
import { MAX_CLIENT_SSE_FRAME_BYTES } from "../sse-frame-buffer";
|
|
5
5
|
|
|
6
6
|
const COMBO_STREAM_PREFLIGHT_MAX_BYTES = MAX_CLIENT_SSE_FRAME_BYTES;
|
|
7
|
+
// Keep retained object count proportional to the same byte budget used by the
|
|
8
|
+
// shared SSE framer. Tiny or empty upstream reads must not bypass the byte cap.
|
|
9
|
+
const COMBO_STREAM_PREFLIGHT_MAX_CHUNKS = Math.max(
|
|
10
|
+
1,
|
|
11
|
+
Math.ceil(COMBO_STREAM_PREFLIGHT_MAX_BYTES / 1024),
|
|
12
|
+
);
|
|
7
13
|
|
|
8
14
|
const PRE_OUTPUT_CONTROL_EVENTS = new Set([
|
|
9
15
|
"response.created",
|
|
@@ -105,8 +111,8 @@ export type ComboStreamPreflightResult =
|
|
|
105
111
|
/**
|
|
106
112
|
* Buffer a combo child's downstream SSE only until the request becomes unsafe to
|
|
107
113
|
* replay or reaches a terminal. This owns exactly one body reader. The aggregate
|
|
108
|
-
* buffer is capped; hitting
|
|
109
|
-
* memory or guessing that replay is safe.
|
|
114
|
+
* buffer is capped by bytes and retained chunks; hitting either cap commits the
|
|
115
|
+
* current target instead of growing memory or guessing that replay is safe.
|
|
110
116
|
*/
|
|
111
117
|
export async function preflightComboStreamResponse(
|
|
112
118
|
response: Response,
|
|
@@ -161,7 +167,8 @@ export async function preflightComboStreamResponse(
|
|
|
161
167
|
return { kind: "failed", response: failedTerminalResponse(response, failedPayload, logCtx) };
|
|
162
168
|
}
|
|
163
169
|
if (next.done || terminalStatus !== undefined || outputCommitted
|
|
164
|
-
|| bufferedBytes >= COMBO_STREAM_PREFLIGHT_MAX_BYTES
|
|
170
|
+
|| bufferedBytes >= COMBO_STREAM_PREFLIGHT_MAX_BYTES
|
|
171
|
+
|| buffered.length >= COMBO_STREAM_PREFLIGHT_MAX_CHUNKS) {
|
|
165
172
|
return { kind: "accepted", response: replayBufferedResponse(response, reader, buffered) };
|
|
166
173
|
}
|
|
167
174
|
}
|