@bitkyc08/opencodex 2.24.0 → 2.24.2
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/gui/dist/assets/{index-CFqJKF2L.js → index-DW-DYWmz.js} +17 -17
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/claude/context-windows.ts +2 -2
- package/src/claude/desktop-3p.ts +6 -6
- package/src/claude/model-info.ts +2 -2
- package/src/cli/claude-desktop.ts +2 -3
- package/src/codex/catalog/metadata.ts +29 -10
- package/src/codex/catalog/provider-fetch.ts +16 -10
- package/src/codex/catalog-admission.ts +5 -3
- package/src/codex/catalog.ts +1 -1
- package/src/codex/injected-marker.ts +9 -3
- package/src/codex/user-identity.ts +88 -6
- package/src/generated/compatibility-version.json +26 -26
- package/src/grok/sync.ts +2 -4
- package/src/lab/projection/rebuild.ts +36 -18
- package/src/lib/windows-elevation.ts +10 -1
- package/src/lib/windows-secret-acl.ts +49 -19
- package/src/routing/capability.ts +5 -6
- package/src/server/index.ts +3 -4
- package/src/server/management/agent-settings-routes.ts +5 -5
- package/src/server/management/config-routes.ts +2 -2
- package/src/server/management/context.ts +2 -0
- package/src/server/management/native-integration-routes.ts +3 -3
- package/src/server/management/shared.ts +4 -4
- package/src/server/management-api.ts +2 -2
- package/src/server/responses/core.ts +2 -1
- package/src/server/responses/input-admission.ts +13 -10
- package/src/server/system-env.ts +3 -3
|
@@ -192,11 +192,11 @@ export interface GrokCandidateModel {
|
|
|
192
192
|
* from the same two sources as the sync so the two can never disagree.
|
|
193
193
|
*/
|
|
194
194
|
export async function fetchGrokCandidateModels(config: OcxConfig): Promise<GrokCandidateModel[]> {
|
|
195
|
-
const { filterCatalogVisibleModels, nativeOpenAiContextWindow, visibleNativeSlugs } = await import("../../codex/catalog");
|
|
195
|
+
const { filterCatalogVisibleModels, nativeContextLimits, nativeOpenAiContextWindow, visibleNativeSlugs } = await import("../../codex/catalog");
|
|
196
196
|
const routed = filterCatalogVisibleModels(await fetchAllModels(config), config);
|
|
197
197
|
return [
|
|
198
198
|
...visibleNativeSlugs(config).map(id => {
|
|
199
|
-
const contextWindow = nativeOpenAiContextWindow(id,
|
|
199
|
+
const contextWindow = nativeOpenAiContextWindow(id, nativeContextLimits(config));
|
|
200
200
|
return { id, native: true, ...(contextWindow !== undefined ? { contextWindow } : {}) };
|
|
201
201
|
}),
|
|
202
202
|
...routed.map(m => ({
|
|
@@ -221,7 +221,7 @@ export function stripRegistryOnlyStaticHeaders(name: string, provider: OcxProvid
|
|
|
221
221
|
|
|
222
222
|
/** Shared Desktop profile DTO builder for the management API and CLI. */
|
|
223
223
|
export async function buildClaudeDesktopState(config: OcxConfig, stored?: OcxClaudeDesktopProfile) {
|
|
224
|
-
const { filterCatalogVisibleModels, nativeOpenAiContextWindow, desktopVisibleNativeSlugs } = await import("../../codex/catalog");
|
|
224
|
+
const { filterCatalogVisibleModels, nativeContextLimits, nativeOpenAiContextWindow, desktopVisibleNativeSlugs } = await import("../../codex/catalog");
|
|
225
225
|
const { DESKTOP_SUPPORTS_1M_THRESHOLD } = await import("../../claude/desktop-3p");
|
|
226
226
|
const { reconcileDesktopProfile, renderDesktopProfile } = await import("../../claude/desktop-profile");
|
|
227
227
|
const routed = filterCatalogVisibleModels(await fetchAllModels(config), config);
|
|
@@ -229,7 +229,7 @@ export async function buildClaudeDesktopState(config: OcxConfig, stored?: OcxCla
|
|
|
229
229
|
// Native rows carry their real context window from the same accessor the Grok sync
|
|
230
230
|
// uses — otherwise Sol's 372k and gpt-5.5's 272k render as blank on Desktop.
|
|
231
231
|
...desktopVisibleNativeSlugs(config).map(id => {
|
|
232
|
-
const contextWindow = nativeOpenAiContextWindow(id,
|
|
232
|
+
const contextWindow = nativeOpenAiContextWindow(id, nativeContextLimits(config));
|
|
233
233
|
return { route: `native/${id}`, label: `${id} (native)`,
|
|
234
234
|
...(contextWindow !== undefined ? { contextWindow } : {}) };
|
|
235
235
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import type { CatalogModel } from "../codex/catalog";
|
|
4
|
-
import { catalogModelSlug, invalidateCodexModelsCache, nativeModelRows, uniqueCatalogModelsForPublicList } from "../codex/catalog";
|
|
4
|
+
import { catalogModelSlug, invalidateCodexModelsCache, nativeContextLimits, nativeModelRows, uniqueCatalogModelsForPublicList } from "../codex/catalog";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_SUBAGENT_MODELS,
|
|
7
7
|
codexAutoStartEnabled,
|
|
@@ -205,7 +205,7 @@ export async function handleManagementAPI(
|
|
|
205
205
|
import("../claude/context-windows"),
|
|
206
206
|
import("../codex/catalog"),
|
|
207
207
|
]);
|
|
208
|
-
injectClaudeAgentDefs(config, buildClaudeContextWindows([...visibleNativeSlugs(config)], models,
|
|
208
|
+
injectClaudeAgentDefs(config, buildClaudeContextWindows([...visibleNativeSlugs(config)], models, nativeContextLimits(config)));
|
|
209
209
|
} catch {
|
|
210
210
|
// Keep routes available through a provider-discovery blip. A later
|
|
211
211
|
// launch-time sync restores any context markers missing from this pass.
|
|
@@ -2,6 +2,7 @@ import type { Server } from "bun";
|
|
|
2
2
|
import { bridgeToResponsesSSE, buildResponseJSON, formatErrorResponse, type ResponsesTerminalStatus } from "../../bridge";
|
|
3
3
|
import { formatPassthroughUpstreamError } from "./passthrough-error";
|
|
4
4
|
import { checkInputAdmission } from "./input-admission";
|
|
5
|
+
import { nativeContextLimits } from "../../codex/catalog";
|
|
5
6
|
import { describeUpstreamConnectFailure } from "./upstream-error";
|
|
6
7
|
import {
|
|
7
8
|
getConfigPath,
|
|
@@ -1994,7 +1995,7 @@ async function handleResponsesInner(
|
|
|
1994
1995
|
// refusing the turn that shrinks the context would deadlock the client against the very
|
|
1995
1996
|
// limit this gate reports — it would be told to compact and then denied the compaction.
|
|
1996
1997
|
if (parsed._compactionRequest !== true) {
|
|
1997
|
-
const inputAdmission = checkInputAdmission(parsed, route.provider, route.providerName, parsed.modelId,
|
|
1998
|
+
const inputAdmission = checkInputAdmission(parsed, route.provider, route.providerName, parsed.modelId, nativeContextLimits(config));
|
|
1998
1999
|
if (!inputAdmission.admitted) {
|
|
1999
2000
|
// #1524: this is a LOCAL preflight refusal, not an upstream verdict. A policy or combo
|
|
2000
2001
|
// fallback must be able to skip this candidate and try one whose context window fits,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* catches the pathological case and stays out of the way otherwise. Every uncertainty
|
|
11
11
|
* resolves toward admitting.
|
|
12
12
|
*/
|
|
13
|
-
import { nativeOpenAiContextWindow, nativeOpenAiMaxInputTokens } from "../../codex/catalog/metadata";
|
|
13
|
+
import { nativeOpenAiContextWindow, nativeOpenAiMaxInputTokens, type NativeContextLimitsInput } from "../../codex/catalog/metadata";
|
|
14
14
|
import { estimateTokens } from "../../lib/token-estimate";
|
|
15
15
|
import { isCanonicalOpenAiForwardProvider, OPENAI_CODEX_PROVIDER_ID } from "../../providers/openai-tiers";
|
|
16
16
|
import type { OcxContentPart, OcxParsedRequest, OcxProviderConfig } from "../../types";
|
|
@@ -131,7 +131,7 @@ export function resolveInputCeiling(
|
|
|
131
131
|
modelId: string,
|
|
132
132
|
// Operator cap for the canonical native provider. Passed in rather than read from a
|
|
133
133
|
// config here so this stays pure: no filesystem, no catalog, no registry scan.
|
|
134
|
-
nativeContextCap?:
|
|
134
|
+
nativeContextCap?: NativeContextLimitsInput,
|
|
135
135
|
): number | null {
|
|
136
136
|
const configured = positive(provider.modelContextWindows?.[modelId]) ?? positive(provider.contextWindow);
|
|
137
137
|
|
|
@@ -143,15 +143,18 @@ export function resolveInputCeiling(
|
|
|
143
143
|
const canonicalNativeBare = providerName === OPENAI_CODEX_PROVIDER_ID
|
|
144
144
|
&& isCanonicalOpenAiForwardProvider(provider)
|
|
145
145
|
&& !modelId.includes("/");
|
|
146
|
-
const
|
|
147
|
-
?
|
|
146
|
+
const nativeLimits = canonicalNativeBare && configured !== null
|
|
147
|
+
? {
|
|
148
|
+
...(typeof nativeContextCap === "number" ? { cap: nativeContextCap } : (nativeContextCap ?? {})),
|
|
149
|
+
modelWindows: { [modelId]: configured },
|
|
150
|
+
}
|
|
151
|
+
: nativeContextCap;
|
|
152
|
+
const native = canonicalNativeBare
|
|
153
|
+
? positive(nativeOpenAiContextWindow(modelId, nativeLimits))
|
|
148
154
|
: null;
|
|
149
|
-
|
|
150
|
-
// window: a 1,050,000 override must not raise the gate above the 922,000 the upstream
|
|
151
|
-
// actually accepts. Computed independently of `configured` for exactly that reason.
|
|
152
|
-
const nativeMaxInput = canonicalNativeBare ? positive(nativeOpenAiMaxInputTokens(modelId, nativeContextCap)) : null;
|
|
155
|
+
const nativeMaxInput = canonicalNativeBare ? positive(nativeOpenAiMaxInputTokens(modelId, nativeLimits)) : null;
|
|
153
156
|
|
|
154
|
-
const window =
|
|
157
|
+
const window = canonicalNativeBare ? native : configured;
|
|
155
158
|
// modelMaxInputTokens is an input-only cap, so it can only tighten the window.
|
|
156
159
|
const configuredMaxInput = positive(provider.modelMaxInputTokens?.[modelId]);
|
|
157
160
|
const limits = [window, configuredMaxInput, nativeMaxInput].filter((v): v is number => v !== null);
|
|
@@ -168,7 +171,7 @@ export function checkInputAdmission(
|
|
|
168
171
|
provider: OcxProviderConfig,
|
|
169
172
|
providerName: string,
|
|
170
173
|
modelId: string,
|
|
171
|
-
nativeContextCap?:
|
|
174
|
+
nativeContextCap?: NativeContextLimitsInput,
|
|
172
175
|
): InputAdmissionResult {
|
|
173
176
|
const ceiling = resolveInputCeiling(provider, providerName, modelId, nativeContextCap);
|
|
174
177
|
if (ceiling === null) return { admitted: true, estimatedTokens: 0, ceiling: null };
|
package/src/server/system-env.ts
CHANGED
|
@@ -237,12 +237,12 @@ function rollbackInjectedKeys(port: number, injectedKeys: string[]): void {
|
|
|
237
237
|
async function computeEffectiveModelEnv(config: OcxConfig, auto?: AutoContextMode): Promise<{ modelEnv: Record<string, string>; windows: Record<string, number> }> {
|
|
238
238
|
const { boundedContextWindows, buildClaudeContextWindows, effectiveModelEnv } = await import("../claude/context-windows");
|
|
239
239
|
const windows = await boundedContextWindows(async () => {
|
|
240
|
-
const { gatherRoutedModels, visibleNativeSlugs } = await import("../codex/catalog");
|
|
240
|
+
const { gatherRoutedModels, nativeContextLimits, visibleNativeSlugs } = await import("../codex/catalog");
|
|
241
241
|
try {
|
|
242
|
-
return buildClaudeContextWindows([...visibleNativeSlugs(config)], await gatherRoutedModels(config),
|
|
242
|
+
return buildClaudeContextWindows([...visibleNativeSlugs(config)], await gatherRoutedModels(config), nativeContextLimits(config));
|
|
243
243
|
} catch (error) {
|
|
244
244
|
if (error && typeof error === "object" && (error as { code?: unknown }).code === "catalog_busy") {
|
|
245
|
-
return buildClaudeContextWindows([...visibleNativeSlugs(config)], [],
|
|
245
|
+
return buildClaudeContextWindows([...visibleNativeSlugs(config)], [], nativeContextLimits(config));
|
|
246
246
|
}
|
|
247
247
|
throw error;
|
|
248
248
|
}
|