@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
package/src/codex/inject.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
CodexWriteConflictError,
|
|
20
20
|
DEFAULT_INJECT_LOCK_TIMEOUT_MS,
|
|
21
21
|
recomputeInjectWitness,
|
|
22
|
+
recordCodexNativeTransactionProvenance,
|
|
22
23
|
restoreCodexPreImages,
|
|
23
24
|
} from "./inject-coordination";
|
|
24
25
|
import { readIntegrationRecord } from "./integration-record";
|
|
@@ -966,6 +967,7 @@ export async function injectCodexConfig(
|
|
|
966
967
|
const coordinated = await withCodexWriteLock(
|
|
967
968
|
{
|
|
968
969
|
timeoutMs: options.lockTimeoutMs ?? DEFAULT_INJECT_LOCK_TIMEOUT_MS,
|
|
970
|
+
...(eligibility.kind === "adopt" ? { adoption: { direction: "apply" as const } } : {}),
|
|
969
971
|
admitted: { authoritySnapshotId: witness.comparisonId },
|
|
970
972
|
readAdmissionUnderLock: () => ({
|
|
971
973
|
authoritySnapshotId: recomputeInjectWitness({
|
|
@@ -1032,6 +1034,7 @@ export async function injectCodexConfig(
|
|
|
1032
1034
|
}
|
|
1033
1035
|
return {
|
|
1034
1036
|
kind: "applied" as const,
|
|
1037
|
+
preImages,
|
|
1035
1038
|
/*
|
|
1036
1039
|
* The receipt the terminal update matches on. The transition commits
|
|
1037
1040
|
* when the callback returns, so this pair is what the post-job
|
|
@@ -1049,6 +1052,10 @@ export async function injectCodexConfig(
|
|
|
1049
1052
|
if (coordinated.status !== "acquired") {
|
|
1050
1053
|
return codexInjectLockOutcome(coordinated);
|
|
1051
1054
|
}
|
|
1055
|
+
recordCodexNativeTransactionProvenance(
|
|
1056
|
+
coordinated.value.preImages,
|
|
1057
|
+
coordinated.value.receipt.currentTxId,
|
|
1058
|
+
);
|
|
1052
1059
|
transitionReceipt = coordinated.value.receipt;
|
|
1053
1060
|
}
|
|
1054
1061
|
// Legacy mode still forward-tags history so re-tagged threads stay listable. Design B needs
|
|
@@ -1560,13 +1567,14 @@ export async function restoreNativeCodexAsync(
|
|
|
1560
1567
|
let config: CodexRestoreConfigResult;
|
|
1561
1568
|
let transitionReceipt: { nativeGeneration: number; currentTxId: string } | undefined;
|
|
1562
1569
|
|
|
1563
|
-
if (eligibility.kind === "coordinated") {
|
|
1570
|
+
if (eligibility.kind === "coordinated" || eligibility.kind === "adopt") {
|
|
1564
1571
|
// The restore has no candidate bytes to witness; freshness comes from the
|
|
1565
1572
|
// filesystem reads and the desired-state re-read performed under the lock.
|
|
1566
1573
|
const witness = { authoritySnapshotId: "codex-native-restore" };
|
|
1567
1574
|
const coordinated = await withCodexWriteLock(
|
|
1568
1575
|
{
|
|
1569
1576
|
timeoutMs: DEFAULT_INJECT_LOCK_TIMEOUT_MS,
|
|
1577
|
+
...(eligibility.kind === "adopt" ? { adoption: { direction: "remove" as const } } : {}),
|
|
1570
1578
|
admitted: witness,
|
|
1571
1579
|
readAdmissionUnderLock: () => witness,
|
|
1572
1580
|
},
|
|
@@ -1602,6 +1610,7 @@ export async function restoreNativeCodexAsync(
|
|
|
1602
1610
|
}
|
|
1603
1611
|
return {
|
|
1604
1612
|
config: restored,
|
|
1613
|
+
preImages,
|
|
1605
1614
|
receipt: {
|
|
1606
1615
|
nativeGeneration: ctx.expectation.nativeAfter,
|
|
1607
1616
|
currentTxId: ctx.expectation.txId,
|
|
@@ -1620,6 +1629,10 @@ export async function restoreNativeCodexAsync(
|
|
|
1620
1629
|
: `Codex configuration was not restored: ${coordinated.message}`,
|
|
1621
1630
|
};
|
|
1622
1631
|
} else {
|
|
1632
|
+
recordCodexNativeTransactionProvenance(
|
|
1633
|
+
coordinated.value.preImages,
|
|
1634
|
+
coordinated.value.receipt.currentTxId,
|
|
1635
|
+
);
|
|
1623
1636
|
config = coordinated.value.config;
|
|
1624
1637
|
transitionReceipt = coordinated.value.receipt;
|
|
1625
1638
|
}
|
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
|
|
12
12
|
const IMMUTABLE_READONLY_FLAGS = constants.SQLITE_OPEN_READONLY | constants.SQLITE_OPEN_URI;
|
|
13
13
|
const KNOWN_LOG_LEVELS = new Set(["TRACE", "DEBUG", "INFO", "WARN", "ERROR"]);
|
|
14
|
+
// The issue reporter measured a ~1 GB database taking 17.3s for GROUP BY level
|
|
15
|
+
// alone; skipping all row aggregates above 64 MiB reduced /api/storage to 628ms.
|
|
16
|
+
const MAX_SYNCHRONOUS_METRICS_DATABASE_BYTES = 64 * 1024 * 1024;
|
|
14
17
|
|
|
15
18
|
interface CurrentLogColumn {
|
|
16
19
|
name: string;
|
|
@@ -115,6 +118,10 @@ export interface CodexLogGuardInspection {
|
|
|
115
118
|
reclaim: CodexLogGuardCapability;
|
|
116
119
|
};
|
|
117
120
|
metrics: CodexLogGuardMetrics | null;
|
|
121
|
+
metricsSkipped: null | {
|
|
122
|
+
reason: "database_too_large";
|
|
123
|
+
thresholdBytes: number;
|
|
124
|
+
};
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
interface ColumnRow {
|
|
@@ -167,9 +174,8 @@ function fileSize(path: string): number {
|
|
|
167
174
|
* repeated stalls without ever serving stale numbers: any write changes the WAL
|
|
168
175
|
* and invalidates the entry.
|
|
169
176
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* tracked separately.
|
|
177
|
+
* Memoization bounds repeat cost. The database-size gate below separately bounds
|
|
178
|
+
* cold request-thread work by omitting these aggregates for large databases.
|
|
173
179
|
*/
|
|
174
180
|
type InspectionCacheEntry = {
|
|
175
181
|
key: string;
|
|
@@ -233,6 +239,7 @@ function unavailableInspection(): CodexLogGuardInspection {
|
|
|
233
239
|
reclaim: unavailable,
|
|
234
240
|
},
|
|
235
241
|
metrics: null,
|
|
242
|
+
metricsSkipped: null,
|
|
236
243
|
};
|
|
237
244
|
}
|
|
238
245
|
|
|
@@ -425,6 +432,7 @@ function inspectCodexLogsUncached(deps: CodexSqliteHomeDeps = {}): CodexLogGuard
|
|
|
425
432
|
...common,
|
|
426
433
|
schema,
|
|
427
434
|
metrics: null,
|
|
435
|
+
metricsSkipped: null,
|
|
428
436
|
capabilities: {
|
|
429
437
|
inspection: { state: "supported" },
|
|
430
438
|
protection: mutation,
|
|
@@ -440,6 +448,7 @@ function inspectCodexLogsUncached(deps: CodexSqliteHomeDeps = {}): CodexLogGuard
|
|
|
440
448
|
...common,
|
|
441
449
|
schema,
|
|
442
450
|
metrics: null,
|
|
451
|
+
metricsSkipped: null,
|
|
443
452
|
capabilities: {
|
|
444
453
|
inspection: { state: "supported" },
|
|
445
454
|
protection: mutation,
|
|
@@ -458,6 +467,7 @@ function inspectCodexLogsUncached(deps: CodexSqliteHomeDeps = {}): CodexLogGuard
|
|
|
458
467
|
...common,
|
|
459
468
|
schema,
|
|
460
469
|
metrics: null,
|
|
470
|
+
metricsSkipped: null,
|
|
461
471
|
capabilities: {
|
|
462
472
|
inspection: { state: "supported" },
|
|
463
473
|
protection: mutation,
|
|
@@ -476,10 +486,17 @@ function inspectCodexLogsUncached(deps: CodexSqliteHomeDeps = {}): CodexLogGuard
|
|
|
476
486
|
? { state: "compatible" }
|
|
477
487
|
: { state: "unsupported", reason: "unknown_schema" };
|
|
478
488
|
const mutation = capabilityFor(schema);
|
|
489
|
+
const metricsSkipped = files.databaseBytes > MAX_SYNCHRONOUS_METRICS_DATABASE_BYTES
|
|
490
|
+
? {
|
|
491
|
+
reason: "database_too_large" as const,
|
|
492
|
+
thresholdBytes: MAX_SYNCHRONOUS_METRICS_DATABASE_BYTES,
|
|
493
|
+
}
|
|
494
|
+
: null;
|
|
479
495
|
return {
|
|
480
496
|
...common,
|
|
481
497
|
schema,
|
|
482
|
-
metrics: readMetrics(db, columns),
|
|
498
|
+
metrics: metricsSkipped === null ? readMetrics(db, columns) : null,
|
|
499
|
+
metricsSkipped,
|
|
483
500
|
capabilities: {
|
|
484
501
|
inspection: { state: "supported" },
|
|
485
502
|
protection: mutation,
|
|
@@ -496,6 +513,7 @@ function inspectCodexLogsUncached(deps: CodexSqliteHomeDeps = {}): CodexLogGuard
|
|
|
496
513
|
...common,
|
|
497
514
|
schema,
|
|
498
515
|
metrics: null,
|
|
516
|
+
metricsSkipped: null,
|
|
499
517
|
capabilities: {
|
|
500
518
|
inspection: { state: "supported" },
|
|
501
519
|
protection: mutation,
|
|
@@ -40,6 +40,10 @@ export interface CodexModelEntitlementResolveOptions {
|
|
|
40
40
|
readonly now?: number;
|
|
41
41
|
/** Test-only credential seam; production callers enumerate local main + Pool credentials. */
|
|
42
42
|
readonly credentials?: readonly CodexModelEntitlementCredentialSnapshot[];
|
|
43
|
+
/** Test-only seam for proving lifecycle exclusions happen before credential reads. */
|
|
44
|
+
readonly credentialSnapshot?: typeof accountCredentialSnapshot;
|
|
45
|
+
/** Accounts whose credentials must not be read while another lifecycle owns them. */
|
|
46
|
+
readonly excludeAccountIds?: ReadonlySet<string>;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
const accountModelsCache = new Map<string, CachedAccountModels>();
|
|
@@ -252,9 +256,12 @@ export async function resolveCodexModelEntitlements(
|
|
|
252
256
|
): Promise<CodexModelEntitlementSnapshot> {
|
|
253
257
|
const now = options.now ?? Date.now();
|
|
254
258
|
const fetcher = options.fetcher ?? fetch;
|
|
259
|
+
const allowedAccountIds = candidateAccountIds(config)
|
|
260
|
+
.filter(accountId => !options.excludeAccountIds?.has(accountId));
|
|
261
|
+
const credentialSnapshot = options.credentialSnapshot ?? accountCredentialSnapshot;
|
|
255
262
|
const credentials = options.credentials
|
|
256
|
-
? [...options.credentials]
|
|
257
|
-
: (await Promise.all(
|
|
263
|
+
? [...options.credentials].filter(credential => !options.excludeAccountIds?.has(credential.accountId))
|
|
264
|
+
: (await Promise.all(allowedAccountIds.map(credentialSnapshot)))
|
|
258
265
|
.filter((value): value is CodexModelEntitlementCredentialSnapshot => value !== null);
|
|
259
266
|
const results = await Promise.all(credentials.map(async credential => ({
|
|
260
267
|
credential,
|