@yansigit/opencodex 2.32.0 → 2.33.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 +2 -2
- package/gui/dist/assets/index-DKLr4LTE.js +102 -0
- package/gui/dist/assets/index-DrSQdTRd.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +6 -5
- package/src/adapters/anthropic.ts +20 -6
- package/src/adapters/azure.ts +20 -4
- package/src/adapters/base.ts +3 -1
- package/src/adapters/command-code.ts +40 -7
- package/src/adapters/cursor/live-transport.ts +1 -1
- package/src/adapters/cursor/protobuf-events.ts +158 -7
- package/src/adapters/cursor/protobuf-request.ts +33 -15
- package/src/adapters/cursor/request-builder.ts +4 -3
- package/src/adapters/cursor/tool-definitions.ts +27 -1
- package/src/adapters/cursor/types.ts +4 -3
- package/src/adapters/cursor.ts +9 -0
- package/src/adapters/google-antigravity-replay.ts +2 -2
- package/src/adapters/google-antigravity-wire.ts +7 -0
- package/src/adapters/google-errors.ts +6 -2
- package/src/adapters/google-http.ts +30 -7
- package/src/adapters/google-truncation.ts +5 -0
- package/src/adapters/google-wire-compiler.ts +38 -6
- package/src/adapters/google.ts +148 -26
- package/src/adapters/kiro-tools.ts +20 -9
- package/src/adapters/openai-chat.ts +9 -0
- package/src/adapters/openai-responses.ts +1 -1
- package/src/bridge.ts +112 -9
- package/src/claude/context-windows.ts +16 -9
- package/src/cli/doctor.ts +2 -2
- package/src/cli/index.ts +9 -2
- package/src/cli/provider.ts +6 -0
- package/src/cli/status.ts +23 -0
- package/src/codex/auth-api.ts +4 -2
- package/src/codex/autostart-health.ts +16 -0
- package/src/codex/catalog/aggregation.ts +12 -12
- package/src/codex/catalog/effort.ts +18 -3
- package/src/codex/catalog/metadata.ts +27 -1
- package/src/codex/catalog/model-metadata.ts +39 -12
- package/src/codex/catalog/parsing.ts +38 -27
- package/src/codex/catalog/provider-fetch.ts +198 -133
- package/src/codex/catalog/sync.ts +1 -1
- package/src/codex/convergence.ts +5 -0
- package/src/codex/shim.ts +56 -3
- package/src/config/provider-validation.ts +37 -0
- package/src/config.ts +78 -2
- package/src/generated/compatibility-version.json +120 -96
- package/src/images/loop.ts +37 -6
- package/src/lib/azure-identity.ts +154 -0
- package/src/lib/debug.ts +42 -0
- package/src/lib/errors.ts +14 -0
- package/src/lib/provider-outbound.ts +45 -33
- package/src/lib/provider-tls-profile.ts +309 -0
- package/src/lib/proxy-env.ts +49 -0
- package/src/lib/redact.ts +10 -1
- package/src/oauth/antigravity-routing.ts +282 -236
- package/src/oauth/callback-server.ts +22 -2
- package/src/oauth/command-code.ts +5 -16
- package/src/oauth/google-antigravity.ts +42 -5
- package/src/oauth/index.ts +15 -3
- package/src/oauth/kimi.ts +9 -1
- package/src/oauth/open-browser-choice.ts +26 -0
- package/src/oauth/store.ts +6 -0
- package/src/providers/antigravity-quota.ts +3 -1
- package/src/providers/api-keys.ts +2 -1
- package/src/providers/auto-compact-budget.ts +65 -0
- package/src/providers/derive.ts +4 -0
- package/src/providers/key-failover.ts +5 -1
- package/src/providers/openai-tiers.ts +5 -0
- package/src/providers/provider-id-rewrite.ts +1 -0
- package/src/providers/quota.ts +59 -13
- package/src/providers/registry.ts +3 -1
- package/src/providers/request-pacing.ts +33 -6
- package/src/providers/xai-transport.ts +21 -0
- package/src/responses/google-provider-options.ts +36 -0
- package/src/responses/namespace-tool-compat.ts +84 -4
- package/src/responses/parser.ts +11 -0
- package/src/responses/provider-opaque-metadata.ts +3 -3
- package/src/responses/schema.ts +37 -0
- package/src/responses/state.ts +94 -4
- package/src/router.ts +8 -2
- package/src/server/auth-cors.ts +28 -0
- package/src/server/images.ts +19 -35
- package/src/server/management/agent-settings-routes.ts +205 -15
- package/src/server/management/combo-routes.ts +6 -0
- package/src/server/management/config-routes.ts +31 -5
- package/src/server/management/model-rows.ts +4 -0
- package/src/server/management/oauth-account-routes.ts +25 -4
- package/src/server/management/provider-routes.ts +113 -15
- package/src/server/management/routing-profile-routes.ts +3 -0
- package/src/server/request-log.ts +21 -0
- package/src/server/responses/agent-task-recovery.ts +1 -1
- package/src/server/responses/compact.ts +30 -1
- package/src/server/responses/core.ts +359 -153
- package/src/server/responses/empty-completion-guard.ts +35 -6
- package/src/server/responses/fetch-helpers.ts +18 -5
- package/src/server/responses/v2-native-parent-override.ts +59 -0
- package/src/server/responses/ws-upstream.ts +75 -2
- package/src/server/responses-undeclared-tool-guard.ts +90 -8
- package/src/service.ts +1 -1
- package/src/types/config.ts +16 -1
- package/src/types/provider.ts +16 -0
- package/src/types/request.ts +28 -0
- package/src/types/tools.ts +27 -0
- package/src/types.ts +6 -0
- package/src/web-search/gemini-executor.ts +6 -4
- package/src/web-search/loop.ts +42 -6
- package/gui/dist/assets/index-BG43zwVe.js +0 -102
- package/gui/dist/assets/index-CiSI-jrP.css +0 -1
|
@@ -31,7 +31,8 @@ import { redactSecretString } from "../../lib/redact";
|
|
|
31
31
|
import upstreamModelsSnapshot from "../data/upstream-models.json";
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
import { NATIVE_OPENAI_CONTEXT_OVERRIDES, SUPPORTED_NATIVE_OPENAI_SLUGS, UPSTREAM_NATIVE_ENTRIES, isNativeOpenAiCapabilityAliasModel, nativeMultiAgentVersion, nativeOpenAiContextWindow, nativeOpenAiMaxInputTokens, type NativeContextLimitsInput } from "./metadata";
|
|
34
|
+
import { NATIVE_OPENAI_CONTEXT_OVERRIDES, SUPPORTED_NATIVE_OPENAI_SLUGS, UPSTREAM_NATIVE_ENTRIES, isNativeOpenAiCapabilityAliasModel, nativeMultiAgentVersion, nativeOpenAiAutoCompactTokenLimit, nativeOpenAiContextWindow, nativeOpenAiMaxInputTokens, type NativeContextLimitsInput } from "./metadata";
|
|
35
|
+
import { clampAutoCompactTokenLimit } from "../../providers/auto-compact-budget";
|
|
35
36
|
import { trustedAccountBoundNativeCatalogSlug } from "./account-models";
|
|
36
37
|
import { CODEX_NATIVE_ALIAS_CATALOG_KIND } from "./kinds";
|
|
37
38
|
|
|
@@ -113,6 +114,8 @@ export interface CatalogModel {
|
|
|
113
114
|
maxInputTokens?: number;
|
|
114
115
|
/** Generated `maxTokens` and live output limits; never treated as context. */
|
|
115
116
|
maxOutputTokens?: number;
|
|
117
|
+
/** Soft client compaction threshold; hard context/input limits remain authoritative. */
|
|
118
|
+
autoCompactTokenLimit?: number;
|
|
116
119
|
contextCap?: number;
|
|
117
120
|
contextCapped?: boolean;
|
|
118
121
|
/** Pre-cap discovered window for Models UI copy when a cap lowered it. */
|
|
@@ -307,22 +310,6 @@ export function isNativeOpenAiEntry(entry: RawEntry): boolean {
|
|
|
307
310
|
return typeof entry.slug === "string" && !entry.slug.includes("/");
|
|
308
311
|
}
|
|
309
312
|
|
|
310
|
-
/**
|
|
311
|
-
* Auto-compaction threshold for a native row.
|
|
312
|
-
*
|
|
313
|
-
* The usual rule is 90% of the window, but a row whose input ceiling sits below that has to
|
|
314
|
-
* clamp to the ceiling instead — otherwise the client keeps filling until upstream answers
|
|
315
|
-
* `context_length_exceeded` and compaction never gets a chance to run. Native GPT-5.6 no
|
|
316
|
-
* longer trips this (922,000 window, 829,800 at 90%), but the routed and API-key rows carry
|
|
317
|
-
* the same family at a 1,050,000 window where 90% would be 945,000 — past the ceiling.
|
|
318
|
-
*/
|
|
319
|
-
function nativeAutoCompactLimit(contextWindow: number, maxInputTokens: number | undefined, contextCap?: number): number {
|
|
320
|
-
const ninety = Math.floor(contextWindow * 0.9);
|
|
321
|
-
if (typeof maxInputTokens !== "number" || maxInputTokens <= 0) return ninety;
|
|
322
|
-
const cappedMaxInput = applyProviderContextCap(maxInputTokens, contextCap) ?? maxInputTokens;
|
|
323
|
-
return Math.min(ninety, cappedMaxInput, contextWindow);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
313
|
/**
|
|
327
314
|
* Narrow any already-resolved native window by the user levers.
|
|
328
315
|
*
|
|
@@ -348,6 +335,9 @@ export function applyNativeOpenAiContextOverride(entry: RawEntry, limits?: Nativ
|
|
|
348
335
|
?? (isNativeOpenAiEntry(entry) ? entry.slug as string : undefined);
|
|
349
336
|
if (!nativeSlug) return;
|
|
350
337
|
const override = NATIVE_OPENAI_CONTEXT_OVERRIDES[nativeSlug];
|
|
338
|
+
// Captured before any override/cap rewrites the row: a retained compaction threshold only
|
|
339
|
+
// describes the window it arrived with.
|
|
340
|
+
const incomingContextWindow = typeof entry.context_window === "number" ? entry.context_window : undefined;
|
|
351
341
|
if (override) {
|
|
352
342
|
// Read the effective values through the accessors rather than re-deriving them from the
|
|
353
343
|
// static table: this function used to apply only the provider cap, so a per-model window
|
|
@@ -355,11 +345,6 @@ export function applyNativeOpenAiContextOverride(entry: RawEntry, limits?: Nativ
|
|
|
355
345
|
if (typeof override.contextWindow === "number") {
|
|
356
346
|
const contextWindow = nativeOpenAiContextWindow(nativeSlug, limits) ?? override.contextWindow;
|
|
357
347
|
entry.context_window = contextWindow;
|
|
358
|
-
entry.auto_compact_token_limit = nativeAutoCompactLimit(
|
|
359
|
-
contextWindow,
|
|
360
|
-
nativeOpenAiMaxInputTokens(nativeSlug, limits) ?? override.maxInputTokens,
|
|
361
|
-
undefined,
|
|
362
|
-
);
|
|
363
348
|
}
|
|
364
349
|
if (typeof override.maxContextWindow === "number") {
|
|
365
350
|
const maxContextWindow = narrowNativeMaxContextWindow(nativeSlug, override.maxContextWindow, limits);
|
|
@@ -374,17 +359,43 @@ export function applyNativeOpenAiContextOverride(entry: RawEntry, limits?: Nativ
|
|
|
374
359
|
const cappedContext = narrowNativeMaxContextWindow(nativeSlug, currentContext, limits);
|
|
375
360
|
if (cappedContext !== currentContext && typeof cappedContext === "number") {
|
|
376
361
|
entry.context_window = cappedContext;
|
|
377
|
-
entry.auto_compact_token_limit = nativeAutoCompactLimit(
|
|
378
|
-
cappedContext,
|
|
379
|
-
nativeOpenAiMaxInputTokens(nativeSlug, limits) ?? override?.maxInputTokens,
|
|
380
|
-
undefined,
|
|
381
|
-
);
|
|
382
362
|
}
|
|
383
363
|
const currentMax = typeof entry.max_context_window === "number" ? entry.max_context_window : undefined;
|
|
384
364
|
const cappedMax = narrowNativeMaxContextWindow(nativeSlug, currentMax, limits);
|
|
385
365
|
if (cappedMax !== currentMax) {
|
|
386
366
|
entry.max_context_window = cappedMax;
|
|
387
367
|
}
|
|
368
|
+
const effectiveContext = typeof entry.context_window === "number" && entry.context_window > 0
|
|
369
|
+
? entry.context_window
|
|
370
|
+
: undefined;
|
|
371
|
+
if (effectiveContext !== undefined) {
|
|
372
|
+
const derivedAutoCompactTokenLimit = nativeOpenAiAutoCompactTokenLimit(nativeSlug, limits);
|
|
373
|
+
// Only trust a retained threshold that still describes THIS window. When sync corrects the
|
|
374
|
+
// window, the old number is an artifact of the old one: a 115_200 limit retained from a
|
|
375
|
+
// 128k row would pin a corrected 272k model to 42% of its real window and compact every
|
|
376
|
+
// long turn early. Lower-is-policy still holds whenever the window is unchanged.
|
|
377
|
+
const retainedDescribesCurrentContext = incomingContextWindow === undefined
|
|
378
|
+
|| incomingContextWindow === effectiveContext;
|
|
379
|
+
const retainedAutoCompactTokenLimit = retainedDescribesCurrentContext
|
|
380
|
+
&& isNativeOpenAiEntry(entry)
|
|
381
|
+
&& typeof entry.auto_compact_token_limit === "number"
|
|
382
|
+
&& Number.isSafeInteger(entry.auto_compact_token_limit)
|
|
383
|
+
&& entry.auto_compact_token_limit > 0
|
|
384
|
+
? entry.auto_compact_token_limit
|
|
385
|
+
: undefined;
|
|
386
|
+
// A smaller threshold retained from Codex is policy evidence too. Configuration may
|
|
387
|
+
// lower it further, but catalog sync must never replace it with a larger default.
|
|
388
|
+
const loweringAutoCompactTokenLimit = retainedAutoCompactTokenLimit === undefined
|
|
389
|
+
? derivedAutoCompactTokenLimit
|
|
390
|
+
: derivedAutoCompactTokenLimit === undefined
|
|
391
|
+
? retainedAutoCompactTokenLimit
|
|
392
|
+
: Math.min(retainedAutoCompactTokenLimit, derivedAutoCompactTokenLimit);
|
|
393
|
+
entry.auto_compact_token_limit = clampAutoCompactTokenLimit(
|
|
394
|
+
effectiveContext,
|
|
395
|
+
nativeOpenAiMaxInputTokens(nativeSlug, limits) ?? override?.maxInputTokens,
|
|
396
|
+
loweringAutoCompactTokenLimit,
|
|
397
|
+
);
|
|
398
|
+
}
|
|
388
399
|
}
|
|
389
400
|
|
|
390
401
|
export function ensureStrictCatalogFields(
|