@bitkyc08/opencodex 2.100.6 → 2.100.7-preview.20261120.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/gui/dist/assets/App-Te21Q-Fv.js +65 -0
- package/gui/dist/assets/App-hklyKJR5.css +1 -0
- package/gui/dist/assets/{Tray-CVqm4S4W.js → Tray-Bto-DJ6b.js} +1 -1
- package/gui/dist/assets/brand-mark-CCRs3Ywg.js +1 -0
- package/gui/dist/assets/index-B85uU8rK.css +2 -0
- package/gui/dist/assets/index-Befqr0m8.js +138 -0
- package/gui/dist/assets/{segment-thumb-features-COdzmORE.js → segment-thumb-features-CKFf9DaQ.js} +1 -1
- package/gui/dist/classic/assets/App-BPkhxI3i.js +64 -0
- package/gui/dist/classic/assets/App-DSivR528.css +1 -0
- package/gui/dist/classic/assets/{Tray-BDlcOLDK.js → Tray-CSRN8p3a.js} +1 -1
- package/gui/dist/classic/assets/index-BHM1aTF8.js +138 -0
- package/gui/dist/classic/assets/usage-companion-chart-DC8ve7g8.js +1 -0
- package/gui/dist/classic/index.html +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +2 -2
- package/src/adapters/coding-agent/process-tree.ts +30 -0
- package/src/adapters/coding-agent/profile.ts +1 -1
- package/src/adapters/coding-agent/turn.ts +2 -9
- package/src/adapters/command-code-decision-guard.ts +25 -0
- package/src/adapters/cursor/catalog.ts +14 -0
- package/src/adapters/cursor/effort-map.ts +3 -0
- package/src/adapters/google-usage.ts +28 -0
- package/src/adapters/google.ts +9 -26
- package/src/adapters/qoder/adapter.ts +197 -13
- package/src/adapters/registry.ts +13 -0
- package/src/adapters/step-cli/adapter.ts +401 -0
- package/src/adapters/step-cli/constants.ts +11 -0
- package/src/adapters/step-cli/conversation.ts +159 -0
- package/src/adapters/step-cli/env.ts +49 -0
- package/src/adapters/step-cli/errors.ts +76 -0
- package/src/adapters/step-cli/events.ts +227 -0
- package/src/adapters/step-cli/profiles.ts +134 -0
- package/src/adapters/step-cli/projection.ts +242 -0
- package/src/adapters/step-cli/registry.ts +181 -0
- package/src/adapters/step-cli/session-pool.ts +225 -0
- package/src/adapters/step-cli/session.ts +842 -0
- package/src/adapters/step-cli/stdio-frames.ts +330 -0
- package/src/adapters/step-cli/tool-bridge.ts +92 -0
- package/src/cli/claude.ts +5 -2
- package/src/client/link-management-relay.ts +11 -0
- package/src/client/machine-listener.ts +6 -2
- package/src/codex/account-label.ts +1 -1
- package/src/codex/catalog/gather-capture.ts +2 -1
- package/src/codex/catalog/metadata.ts +48 -2
- package/src/codex/catalog/model-hints.ts +19 -5
- package/src/codex/catalog/model-visibility.ts +4 -7
- package/src/codex/catalog/native-ultrafast.ts +8 -6
- package/src/generated/compatibility-version.json +137 -61
- package/src/generated/model-metadata.ts +1 -1
- package/src/lib/client-error-body.ts +2 -0
- package/src/lib/messages-error-body.ts +3 -1
- package/src/lib/optional-shutdown-hooks.ts +55 -5
- package/src/lib/process-control.ts +3 -2
- package/src/lib/shutdown-budget.ts +5 -0
- package/src/link/remote-platform.ts +24 -9
- package/src/link/ssh-argv.ts +8 -2
- package/src/link/ssh-runner.ts +15 -2
- package/src/oauth/m365-copilot-web-session.ts +28 -4
- package/src/protocols/dto.ts +24 -12
- package/src/protocols/settings.ts +20 -16
- package/src/protocols/shadow.ts +2 -3
- package/src/protocols/trace.ts +24 -2
- package/src/providers/command-code-decision-models.ts +65 -0
- package/src/providers/quota.ts +4 -4
- package/src/providers/registry/entries-core.ts +18 -7
- package/src/providers/registry/entries-extended.ts +41 -0
- package/src/providers/registry/model-seeds.ts +42 -0
- package/src/providers/resolved-model-policy-merge.ts +8 -0
- package/src/providers/resolved-model-policy.ts +185 -165
- package/src/providers/slug-codec.ts +5 -0
- package/src/server/chat-native-eligibility.ts +5 -0
- package/src/server/credential-recovery-attempt.ts +2 -2
- package/src/server/gemini-inbound.ts +15 -11
- package/src/server/gemini-native-catalog.ts +27 -2
- package/src/server/gemini-native-wire.ts +71 -6
- package/src/server/gemini-native.ts +129 -34
- package/src/server/index/gemini-routes.ts +6 -1
- package/src/server/lifecycle.ts +2 -1
- package/src/server/management/agent-settings-routes.ts +26 -28
- package/src/server/management/api-access.ts +5 -3
- package/src/server/management/protocol-routes.ts +3 -1
- package/src/server/management/protocol-settings-patch.ts +25 -10
- package/src/server/management/shared.ts +20 -5
- package/src/server/messages-native-eligibility.ts +4 -0
- package/src/server/messages-native-tool-guard.ts +18 -5
- package/src/server/request-log-generation-window.ts +7 -2
- package/src/server/responses/command-code-decision-refusal.ts +24 -0
- package/src/server/responses/compact.ts +2 -2
- package/src/server/responses/core-combo.ts +18 -3
- package/src/server/responses/core-pipeline.ts +6 -0
- package/src/server/responses/sidecar-execution.ts +10 -7
- package/src/types/config.ts +2 -0
- package/src/usage/expected-prices.ts +17 -0
- package/src/usage/telemetry-contract.ts +3 -0
- package/gui/dist/assets/App-BI8LQ7Qk.css +0 -1
- package/gui/dist/assets/App-CsZ1Gr7S.js +0 -60
- package/gui/dist/assets/brand-mark-BebhnAtV.js +0 -1
- package/gui/dist/assets/index-BtwVlpeQ.css +0 -2
- package/gui/dist/assets/index-CEeMegqE.js +0 -138
- package/gui/dist/classic/assets/App-BJgUWNJ8.js +0 -59
- package/gui/dist/classic/assets/App-CoiVLRW3.css +0 -1
- package/gui/dist/classic/assets/index-B9Jgli_W.js +0 -138
- package/gui/dist/classic/assets/usage-companion-chart-vbzDcND0.js +0 -1
|
@@ -123,9 +123,21 @@ export function clampObservedModelLimits(
|
|
|
123
123
|
...(maxOutputTokens !== undefined ? { maxOutputTokens } : {}),
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
+
type PerModelPolicyInput = Pick<ResolveModelPolicyInput, "modelId" | "modelCapabilities" | "inboundWire" | "effectiveAlias" | "effectiveAliasSource">;
|
|
127
|
+
type ProviderPolicyInput = Omit<ResolveModelPolicyInput, keyof PerModelPolicyInput>;
|
|
128
|
+
|
|
126
129
|
export function resolveModelPolicy(input: ResolveModelPolicyInput): ResolvedModelPolicy {
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
return prepareProviderPolicy(input)(input);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Batch projection for captured catalog providers; the capture already owns registry enrichment. */
|
|
134
|
+
export function prepareModelPolicy(input: Pick<ProviderPolicyInput, "providerName" | "provider" | "effectiveAuth" | "transportMatchedRegistry"> & { transportMatchedRegistry: false }) {
|
|
135
|
+
return prepareProviderPolicy({ ...input, provider: recursivelyFreeze(detachedClone(input.provider)) });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function prepareProviderPolicy(shared: ProviderPolicyInput): (modelInput: PerModelPolicyInput) => ResolvedModelPolicy {
|
|
139
|
+
const entry = shared.transportMatchedRegistry ? shared.registryEntry : undefined;
|
|
140
|
+
const provider = shared.provider;
|
|
129
141
|
const providerPolicy: Partial<StaticProviderPolicyShape> = {};
|
|
130
142
|
const providerProvenance: Partial<Record<StaticProviderPolicyField, StaticPolicySource>> = {};
|
|
131
143
|
const [baseUrl, baseUrlSource] = resolvedBaseUrl(entry, provider);
|
|
@@ -154,11 +166,11 @@ export function resolveModelPolicy(input: ResolveModelPolicyInput): ResolvedMode
|
|
|
154
166
|
putScalar("apiKeyTransport", entry?.apiKeyTransport);
|
|
155
167
|
const [headers, headersSource] = staticHeaders(entry?.staticHeaders, provider.headers);
|
|
156
168
|
put("headers", headers, headersSource);
|
|
157
|
-
const resolvedAuthMode =
|
|
169
|
+
const resolvedAuthMode = shared.effectiveAuth?.authMode
|
|
158
170
|
?? (entry?.authKind === "forward" || entry?.authKind === "oauth"
|
|
159
171
|
? entry.authKind
|
|
160
172
|
: provider.authMode === "forward" ? undefined : provider.authMode ?? entry?.authKind);
|
|
161
|
-
put("authMode", resolvedAuthMode,
|
|
173
|
+
put("authMode", resolvedAuthMode, shared.effectiveAuth
|
|
162
174
|
? "captured-auth"
|
|
163
175
|
: entry?.authKind === "forward" || entry?.authKind === "oauth" ? "registry"
|
|
164
176
|
: provider.authMode !== undefined ? "operator" : entry ? "registry" : "unknown");
|
|
@@ -186,7 +198,7 @@ export function resolveModelPolicy(input: ResolveModelPolicyInput): ResolvedMode
|
|
|
186
198
|
] as const) putScalar(key, entry?.[key] as StaticProviderPolicyShape[typeof key] | undefined);
|
|
187
199
|
// Operator-only display policy; no registry entry declares it (#8363).
|
|
188
200
|
put("thinkingDisplay", provider.thinkingDisplay, provider.thinkingDisplay !== undefined ? "operator" : "unknown");
|
|
189
|
-
const legacyClinePassLadder = entry !== undefined &&
|
|
201
|
+
const legacyClinePassLadder = entry !== undefined && shared.providerName === "cline-pass"
|
|
190
202
|
&& provider.reasoningWireFormat === "gateway-object"
|
|
191
203
|
&& sameStringArray(provider.reasoningEfforts, ["low"]);
|
|
192
204
|
put("reasoningEfforts", legacyClinePassLadder ? entry?.reasoningEfforts : provider.reasoningEfforts ?? entry?.reasoningEfforts,
|
|
@@ -194,7 +206,7 @@ export function resolveModelPolicy(input: ResolveModelPolicyInput): ResolvedMode
|
|
|
194
206
|
put("chatServiceTier", provider.chatServiceTier ?? keyAuthDefaults?.chatServiceTier ?? entry?.chatServiceTier,
|
|
195
207
|
provider.chatServiceTier !== undefined ? "operator" : keyAuthDefaults?.chatServiceTier !== undefined ? "registry" : entry?.chatServiceTier !== undefined ? "registry" : "unknown");
|
|
196
208
|
// The Fast switch overrides every capability source; see providerFastSwitchOff.
|
|
197
|
-
const fastOff = fastSwitchOff(provider,
|
|
209
|
+
const fastOff = fastSwitchOff(provider, shared.registryEntry);
|
|
198
210
|
if (fastOff) put("supportsServiceTier", false, provider.fastEnabled === false ? "operator" : "registry");
|
|
199
211
|
else put("supportsServiceTier", provider.supportsServiceTier ?? keyAuthDefaults?.supportsServiceTier ?? entry?.supportsServiceTier,
|
|
200
212
|
provider.supportsServiceTier !== undefined ? "operator" : keyAuthDefaults?.supportsServiceTier !== undefined ? "registry" : entry?.supportsServiceTier !== undefined ? "registry" : "unknown");
|
|
@@ -227,7 +239,7 @@ export function resolveModelPolicy(input: ResolveModelPolicyInput): ResolvedMode
|
|
|
227
239
|
put("modelCapabilities", mergeReasoningModelCapabilities(entry?.modelCapabilities, provider.modelCapabilities),
|
|
228
240
|
provider.modelCapabilities !== undefined ? "operator-capability" : entry?.modelCapabilities !== undefined ? "registry" : "unknown");
|
|
229
241
|
for (const key of ["modelContextWindows", "modelMaxInputTokens"] as const) {
|
|
230
|
-
const [value, source] =
|
|
242
|
+
const [value, source] = shared.providerName === "openai-apikey"
|
|
231
243
|
? positiveCapMap(entry?.[key], provider[key])
|
|
232
244
|
: mapFill(entry?.[key], provider[key]);
|
|
233
245
|
put(key, value, source);
|
|
@@ -284,163 +296,171 @@ export function resolveModelPolicy(input: ResolveModelPolicyInput): ResolvedMode
|
|
|
284
296
|
(providerPolicy.modelReasoningEffortMap ??= {})[directModel] = {};
|
|
285
297
|
}
|
|
286
298
|
}
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
?
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
? {
|
|
371
|
-
: {}),
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
? {
|
|
375
|
-
: {}),
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
modelProvenance.
|
|
299
|
+
const frozenProvider = recursivelyFreeze(providerPolicy) as ResolvedProviderStaticPolicy;
|
|
300
|
+
const frozenProviderProvenance = Object.freeze(providerProvenance);
|
|
301
|
+
return modelInput => resolvePreparedModel({ ...shared, ...modelInput });
|
|
302
|
+
|
|
303
|
+
function resolvePreparedModel(input: ResolveModelPolicyInput): ResolvedModelPolicy {
|
|
304
|
+
const modelValue = <T>(record: Readonly<Record<string, T>> | undefined): T | undefined =>
|
|
305
|
+
legacyModelValue(record, input.modelId);
|
|
306
|
+
const modelSource = <T>(operator: Readonly<Record<string, T>> | undefined, registry: Readonly<Record<string, T>> | undefined): StaticPolicySource =>
|
|
307
|
+
legacyModelSource(operator, registry, input.modelId);
|
|
308
|
+
const modelOrProviderSource = <T>(
|
|
309
|
+
operatorMap: Readonly<Record<string, T>> | undefined, registryMap: Readonly<Record<string, T>> | undefined,
|
|
310
|
+
operatorDefault: T | undefined, registryDefault: T | undefined,
|
|
311
|
+
): StaticPolicySource => {
|
|
312
|
+
const exact = modelSource(operatorMap, registryMap);
|
|
313
|
+
return exact !== "unknown" ? exact : operatorDefault !== undefined ? "operator" : registryDefault !== undefined ? "registry" : "unknown";
|
|
314
|
+
};
|
|
315
|
+
const configuredAdapter = provider.modelAdapters?.[input.modelId];
|
|
316
|
+
const pin = pinnedWireAdapter(input.providerName, input.modelId, provider);
|
|
317
|
+
const normalizedModelId = input.modelId.trim().toLowerCase();
|
|
318
|
+
const registryWire = wireDefault(entry?.modelWireDefaults?.[normalizedModelId], provider, entry,
|
|
319
|
+
input.inboundWire ?? "responses", resolvedAuthMode);
|
|
320
|
+
const explicitWire = configuredAdapter && MODEL_ADAPTER_OVERRIDE_ALLOWED.has(configuredAdapter)
|
|
321
|
+
? configuredAdapter
|
|
322
|
+
: undefined;
|
|
323
|
+
const providerAdapter = providerPolicy.adapter ?? provider.adapter;
|
|
324
|
+
const effectiveProviderForWire = resolvedAuthMode === provider.authMode
|
|
325
|
+
? provider
|
|
326
|
+
: { ...provider, authMode: resolvedAuthMode };
|
|
327
|
+
const canonicalForward = isCanonicalOpenAiForwardProvider(effectiveProviderForWire);
|
|
328
|
+
const adapter = pin
|
|
329
|
+
?? (!canonicalForward ? explicitWire ?? registryWire : undefined)
|
|
330
|
+
?? providerAdapter;
|
|
331
|
+
const adapterSource: StaticPolicySource = pin
|
|
332
|
+
? "hard-pin"
|
|
333
|
+
: explicitWire && !canonicalForward
|
|
334
|
+
? "operator"
|
|
335
|
+
: registryWire && !canonicalForward
|
|
336
|
+
? "registry"
|
|
337
|
+
: "provider-default";
|
|
338
|
+
const declaredModalities = input.modelCapabilities?.inputModalities;
|
|
339
|
+
const capabilityModalities = Array.isArray(declaredModalities) && declaredModalities.length > 0
|
|
340
|
+
? [...declaredModalities]
|
|
341
|
+
: undefined;
|
|
342
|
+
const exactContextWindow = modelValue(providerPolicy.modelContextWindows);
|
|
343
|
+
const familyContextWindow = providerPolicy.adapter === "anthropic"
|
|
344
|
+
? anthropicFamilyContextWindow(providerPolicy.modelContextWindows, input.modelId)
|
|
345
|
+
: undefined;
|
|
346
|
+
const modelContextWindow = exactContextWindow ?? familyContextWindow ?? providerPolicy.contextWindow;
|
|
347
|
+
const exactMaxInputTokens = modelValue(providerPolicy.modelMaxInputTokens);
|
|
348
|
+
const modelMaxInputTokens = exactMaxInputTokens !== undefined && modelContextWindow !== undefined
|
|
349
|
+
? Math.min(exactMaxInputTokens, modelContextWindow)
|
|
350
|
+
: exactMaxInputTokens;
|
|
351
|
+
const exactMaxOutputTokens = modelValue(providerPolicy.modelMaxOutputTokens);
|
|
352
|
+
const modelMaxOutputTokens = exactMaxOutputTokens ?? providerPolicy.defaultMaxOutputTokens;
|
|
353
|
+
const reasoningCapabilities = reasoningCapabilitiesFromConfig({
|
|
354
|
+
...providerPolicy,
|
|
355
|
+
adapter: providerPolicy.adapter ?? provider.adapter,
|
|
356
|
+
baseUrl: providerPolicy.baseUrl ?? provider.baseUrl,
|
|
357
|
+
// Reasoning reads only this model's declaration; keep the other axes without cloning the roster.
|
|
358
|
+
...(input.modelCapabilities ? { modelCapabilities: { [input.modelId]: {
|
|
359
|
+
...declaredModelCapabilities(providerPolicy.modelCapabilities, input.modelId),
|
|
360
|
+
...input.modelCapabilities,
|
|
361
|
+
} } } : {}),
|
|
362
|
+
}, input.modelId);
|
|
363
|
+
const modelReasoningEfforts = reasoningCapabilities.supportsReasoningEffort === false ? []
|
|
364
|
+
: modelValue(providerPolicy.modelReasoningEfforts) ?? providerPolicy.reasoningEfforts;
|
|
365
|
+
const modelSupportsReasoningSummaries = modelValue(providerPolicy.modelSupportsReasoningSummaries)
|
|
366
|
+
?? (modelValue(providerPolicy.modelReasoningSummaryDelivery) !== undefined ? true : undefined);
|
|
367
|
+
const modelSupportsVerbosity = modelValue(providerPolicy.modelSupportsVerbosity) ?? providerPolicy.supportsVerbosity;
|
|
368
|
+
const modelSupportsServiceTier = fastOff
|
|
369
|
+
? false
|
|
370
|
+
: modelValue(providerPolicy.modelSupportsServiceTier) ?? providerPolicy.supportsServiceTier;
|
|
371
|
+
const modelSupportsResponsesCustomTools = input.modelCapabilities?.responsesCustomTools
|
|
372
|
+
?? providerPolicy.supportsResponsesCustomTools;
|
|
373
|
+
const model: ResolvedPerModelStaticPolicy = {
|
|
374
|
+
adapter,
|
|
375
|
+
...reasoningCapabilities,
|
|
376
|
+
...(modelContextWindow !== undefined ? { contextWindow: modelContextWindow } : {}),
|
|
377
|
+
...(capabilityModalities ?? modelValue(providerPolicy.modelInputModalities) !== undefined
|
|
378
|
+
? { inputModalities: capabilityModalities ?? modelValue(providerPolicy.modelInputModalities) }
|
|
379
|
+
: {}),
|
|
380
|
+
...(modelMaxInputTokens !== undefined ? { maxInputTokens: modelMaxInputTokens } : {}),
|
|
381
|
+
...(modelMaxOutputTokens !== undefined ? { maxOutputTokens: modelMaxOutputTokens } : {}),
|
|
382
|
+
...(modelReasoningEfforts !== undefined ? { reasoningEfforts: modelReasoningEfforts } : {}),
|
|
383
|
+
...(reasoningCapabilities.supportsReasoningEffort !== false && modelValue(providerPolicy.modelDefaultReasoningEfforts) !== undefined ? { defaultReasoningEffort: modelValue(providerPolicy.modelDefaultReasoningEfforts) } : {}),
|
|
384
|
+
...(modelSupportsReasoningSummaries !== undefined ? { supportsReasoningSummaries: modelSupportsReasoningSummaries } : {}),
|
|
385
|
+
...(modelSupportsVerbosity !== undefined ? { supportsVerbosity: modelSupportsVerbosity } : {}),
|
|
386
|
+
...(modelSupportsServiceTier !== undefined ? { supportsServiceTier: modelSupportsServiceTier } : {}),
|
|
387
|
+
...(modelSupportsResponsesCustomTools !== undefined ? { supportsResponsesCustomTools: modelSupportsResponsesCustomTools } : {}),
|
|
388
|
+
...(modelSupportsServiceTier === true && entry?.fastTierDescription !== undefined
|
|
389
|
+
? { fastTierDescription: entry.fastTierDescription }
|
|
390
|
+
: {}),
|
|
391
|
+
...(entry?.directReasoningEffortModels?.includes(input.modelId) ? { directReasoningEffort: true } : {}),
|
|
392
|
+
...(entry?.modelResponsesUpstreamStreaming?.[normalizedModelId] !== undefined
|
|
393
|
+
? { responsesUpstreamStreaming: entry.modelResponsesUpstreamStreaming[normalizedModelId] }
|
|
394
|
+
: {}),
|
|
395
|
+
...(entry?.modelResponsesTerminalRepair?.[normalizedModelId] !== undefined
|
|
396
|
+
? { responsesTerminalRepair: entry.modelResponsesTerminalRepair[normalizedModelId] }
|
|
397
|
+
: {}),
|
|
398
|
+
};
|
|
399
|
+
const modelProvenance: Partial<Record<keyof ResolvedPerModelStaticPolicy, StaticPolicySource>> = {
|
|
400
|
+
adapter: adapterSource,
|
|
401
|
+
};
|
|
402
|
+
for (const field of REASONING_CAPABILITY_FIELDS) {
|
|
403
|
+
modelProvenance[field] = reasoningCapabilities[field] === undefined ? "unknown"
|
|
404
|
+
: modelInList(provider.noReasoningModels, input.modelId) ? "operator"
|
|
405
|
+
: modelInList(entry?.noReasoningModels, input.modelId) ? "registry"
|
|
406
|
+
: input.modelCapabilities?.[field] !== undefined || declaredModelCapabilities(provider.modelCapabilities, input.modelId)?.[field] !== undefined
|
|
407
|
+
? "operator-capability" : declaredModelCapabilities(entry?.modelCapabilities, input.modelId)?.[field] !== undefined ? "registry" : "operator";
|
|
408
|
+
}
|
|
409
|
+
modelProvenance.contextWindow = modelOrProviderSource(provider.modelContextWindows, entry?.modelContextWindows, provider.contextWindow, entry?.contextWindow);
|
|
410
|
+
if (modelProvenance.contextWindow === "unknown" && familyContextWindow !== undefined) {
|
|
411
|
+
modelProvenance.contextWindow = anthropicFamilyContextWindow(provider.modelContextWindows, input.modelId) !== undefined
|
|
412
|
+
? "operator"
|
|
413
|
+
: "registry";
|
|
414
|
+
}
|
|
415
|
+
modelProvenance.inputModalities = capabilityModalities
|
|
416
|
+
? "operator-capability"
|
|
417
|
+
: modelSource(provider.modelInputModalities, entry?.modelInputModalities);
|
|
418
|
+
modelProvenance.maxInputTokens = modelSource(provider.modelMaxInputTokens, entry?.modelMaxInputTokens);
|
|
419
|
+
modelProvenance.maxOutputTokens = modelOrProviderSource(
|
|
420
|
+
provider.modelMaxOutputTokens,
|
|
421
|
+
entry?.modelMaxOutputTokens,
|
|
422
|
+
provider.defaultMaxOutputTokens,
|
|
423
|
+
entry?.defaultMaxOutputTokens,
|
|
424
|
+
);
|
|
425
|
+
modelProvenance.reasoningEfforts = modelOrProviderSource(provider.modelReasoningEfforts, entry?.modelReasoningEfforts, provider.reasoningEfforts, entry?.reasoningEfforts);
|
|
426
|
+
modelProvenance.defaultReasoningEffort = modelSource(
|
|
427
|
+
provider.modelDefaultReasoningEfforts,
|
|
428
|
+
entry?.modelDefaultReasoningEfforts,
|
|
429
|
+
);
|
|
430
|
+
modelProvenance.supportsReasoningSummaries = modelSource(provider.modelSupportsReasoningSummaries, entry?.modelSupportsReasoningSummaries);
|
|
431
|
+
if (modelProvenance.supportsReasoningSummaries === "unknown" && modelValue(provider.modelReasoningSummaryDelivery) !== undefined) {
|
|
432
|
+
modelProvenance.supportsReasoningSummaries = "operator";
|
|
433
|
+
}
|
|
434
|
+
modelProvenance.supportsVerbosity = modelOrProviderSource(provider.modelSupportsVerbosity, entry?.modelSupportsVerbosity, provider.supportsVerbosity, entry?.supportsVerbosity);
|
|
435
|
+
const exactServiceTierSource = modelSource(provider.modelSupportsServiceTier, registryServiceTierDefaults);
|
|
436
|
+
modelProvenance.supportsServiceTier = !fastOff && exactServiceTierSource !== "unknown" ? exactServiceTierSource
|
|
437
|
+
: providerProvenance.supportsServiceTier ?? "unknown";
|
|
438
|
+
modelProvenance.supportsResponsesCustomTools = input.modelCapabilities?.responsesCustomTools !== undefined
|
|
439
|
+
? "operator-capability"
|
|
440
|
+
: providerProvenance.supportsResponsesCustomTools ?? "unknown";
|
|
441
|
+
modelProvenance.responsesUpstreamStreaming = model.responsesUpstreamStreaming === undefined ? "unknown" : "registry";
|
|
442
|
+
modelProvenance.responsesTerminalRepair = model.responsesTerminalRepair === undefined ? "unknown" : "registry";
|
|
443
|
+
modelProvenance.fastTierDescription = model.fastTierDescription === undefined ? "unknown" : "registry";
|
|
444
|
+
modelProvenance.directReasoningEffort = model.directReasoningEffort === undefined ? "unknown" : "registry";
|
|
445
|
+
const alias = input.effectiveAlias !== undefined
|
|
446
|
+
? input.effectiveAlias
|
|
447
|
+
: provider.alias !== undefined
|
|
448
|
+
? provider.alias
|
|
449
|
+
: entry?.alias;
|
|
450
|
+
const aliasSource: StaticPolicySource = input.effectiveAlias !== undefined
|
|
451
|
+
? input.effectiveAliasSource ?? "operator"
|
|
452
|
+
: provider.alias !== undefined
|
|
453
|
+
? "operator"
|
|
454
|
+
: entry?.alias !== undefined ? "registry" : "unknown";
|
|
455
|
+
return Object.freeze({
|
|
456
|
+
version: 1 as const,
|
|
457
|
+
providerName: input.providerName,
|
|
458
|
+
modelId: input.modelId,
|
|
459
|
+
transportMatchedRegistry: entry !== undefined,
|
|
460
|
+
...(alias !== undefined ? { effectiveAlias: alias } : {}),
|
|
461
|
+
provider: frozenProvider,
|
|
462
|
+
model: recursivelyFreeze(detachedClone(model)),
|
|
463
|
+
provenance: Object.freeze({ alias: aliasSource, provider: frozenProviderProvenance, model: Object.freeze(modelProvenance) }),
|
|
464
|
+
});
|
|
414
465
|
}
|
|
415
|
-
modelProvenance.supportsVerbosity = modelOrProviderSource(provider.modelSupportsVerbosity, entry?.modelSupportsVerbosity, provider.supportsVerbosity, entry?.supportsVerbosity);
|
|
416
|
-
const exactServiceTierSource = modelSource(provider.modelSupportsServiceTier, registryServiceTierDefaults);
|
|
417
|
-
modelProvenance.supportsServiceTier = !fastOff && exactServiceTierSource !== "unknown" ? exactServiceTierSource
|
|
418
|
-
: providerProvenance.supportsServiceTier ?? "unknown";
|
|
419
|
-
modelProvenance.supportsResponsesCustomTools = input.modelCapabilities?.responsesCustomTools !== undefined
|
|
420
|
-
? "operator-capability"
|
|
421
|
-
: providerProvenance.supportsResponsesCustomTools ?? "unknown";
|
|
422
|
-
modelProvenance.responsesUpstreamStreaming = model.responsesUpstreamStreaming === undefined ? "unknown" : "registry";
|
|
423
|
-
modelProvenance.responsesTerminalRepair = model.responsesTerminalRepair === undefined ? "unknown" : "registry";
|
|
424
|
-
modelProvenance.fastTierDescription = model.fastTierDescription === undefined ? "unknown" : "registry";
|
|
425
|
-
modelProvenance.directReasoningEffort = model.directReasoningEffort === undefined ? "unknown" : "registry";
|
|
426
|
-
const alias = input.effectiveAlias !== undefined
|
|
427
|
-
? input.effectiveAlias
|
|
428
|
-
: provider.alias !== undefined
|
|
429
|
-
? provider.alias
|
|
430
|
-
: entry?.alias;
|
|
431
|
-
const aliasSource: StaticPolicySource = input.effectiveAlias !== undefined
|
|
432
|
-
? input.effectiveAliasSource ?? "operator"
|
|
433
|
-
: provider.alias !== undefined
|
|
434
|
-
? "operator"
|
|
435
|
-
: entry?.alias !== undefined ? "registry" : "unknown";
|
|
436
|
-
return recursivelyFreeze(detachedClone({
|
|
437
|
-
version: 1 as const,
|
|
438
|
-
providerName: input.providerName,
|
|
439
|
-
modelId: input.modelId,
|
|
440
|
-
transportMatchedRegistry: entry !== undefined,
|
|
441
|
-
...(alias !== undefined ? { effectiveAlias: alias } : {}),
|
|
442
|
-
provider: providerPolicy as ResolvedProviderStaticPolicy,
|
|
443
|
-
model,
|
|
444
|
-
provenance: { alias: aliasSource, provider: providerProvenance, model: modelProvenance },
|
|
445
|
-
}));
|
|
446
466
|
}
|
|
@@ -85,6 +85,11 @@ export function slugEquals(stored: string, provider: string, id: string): boolea
|
|
|
85
85
|
return stored === `${provider}/${id}` || stored === routedSlug(provider, id);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/** The same raw-or-encoded match as slugEquals, using a caller's existing index. */
|
|
89
|
+
export function hasRoutedSlug(slugs: ReadonlySet<string>, provider: string, id: string): boolean {
|
|
90
|
+
return slugs.has(`${provider}/${id}`) || (id.includes("/") && slugs.has(routedSlug(provider, id)));
|
|
91
|
+
}
|
|
92
|
+
|
|
88
93
|
/** Stable key for the exact equivalence relation used by catalog/config slug matching. */
|
|
89
94
|
export function slugEquivalenceKey(slug: string): string {
|
|
90
95
|
const slash = slug.indexOf("/");
|
|
@@ -4,6 +4,7 @@ import type { ProtocolReasonCode } from "../protocols/contract";
|
|
|
4
4
|
import type { RouteResult } from "../router";
|
|
5
5
|
import type { OcxConfig } from "../types";
|
|
6
6
|
import { isModelTextOnly, requiresVisionPreprocessing } from "../vision";
|
|
7
|
+
import { isCommandCodeDecisionRoute } from "../providers/command-code-decision-models";
|
|
7
8
|
|
|
8
9
|
type Rec = Record<string, unknown>;
|
|
9
10
|
|
|
@@ -22,6 +23,7 @@ export type NativeChatDeclineReason = Extract<
|
|
|
22
23
|
| "vision-preprocessing"
|
|
23
24
|
| "hosted-tool"
|
|
24
25
|
| "opaque-state-stripped"
|
|
26
|
+
| "compatibility-reject"
|
|
25
27
|
>;
|
|
26
28
|
|
|
27
29
|
/**
|
|
@@ -36,6 +38,9 @@ export function nativeChatDeclineReason(
|
|
|
36
38
|
): NativeChatDeclineReason | undefined {
|
|
37
39
|
const provider = route.provider;
|
|
38
40
|
if (provider.adapter !== "openai-chat") return "cross-wire-ir";
|
|
41
|
+
// Command Code's System One decision models are not chat models (#8997). The native lane would
|
|
42
|
+
// forward the body verbatim; the translated path refuses it at the adapter guard before a send.
|
|
43
|
+
if (isCommandCodeDecisionRoute(provider, route.modelId)) return "compatibility-reject";
|
|
39
44
|
if (provider.authMode !== undefined && provider.authMode !== "key" && provider.authMode !== "local") return "auth-mode-not-native";
|
|
40
45
|
// Combo and policy execution own multi-candidate retries in the Responses pipeline.
|
|
41
46
|
if (route.combo || route.routeKind === "combo" || route.routeKind === "policy") return "combo-or-policy-route";
|
|
@@ -18,8 +18,8 @@ export function sealCredentialRefusal(logCtx: RequestLogContext, status: number,
|
|
|
18
18
|
type AttemptSendProvider = Parameters<typeof noteProviderAttemptSend>[2];
|
|
19
19
|
type AttemptSendRecovery = Parameters<typeof noteProviderAttemptSend>[4];
|
|
20
20
|
|
|
21
|
-
/** Open
|
|
22
|
-
export function
|
|
21
|
+
/** Open an attempt at its first physical send and count each send against it. */
|
|
22
|
+
export function noteCredentialAttemptSend(
|
|
23
23
|
logCtx: RequestLogContext, route: { providerName: string; modelId: string }, provider: AttemptSendProvider, recovery?: AttemptSendRecovery,
|
|
24
24
|
): void {
|
|
25
25
|
const { providerName, modelId } = route;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* /v1beta|v1/models/{model}:generateContent|streamGenerateContent (countTokens and the embed
|
|
4
4
|
* methods answer 501).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* provider routes, generation is translated into an internal Chat Completions request handled by
|
|
6
|
+
* Like the Ollama inbound (./ollama-inbound), the catalog starts with configured
|
|
7
|
+
* provider routes. Unless the native leg applies, generation is translated into an internal Chat Completions request handled by
|
|
8
8
|
* the ordinary Chat path, and this handler owns the final request-log row. Errors use the Gemini
|
|
9
9
|
* `{ error: { code, message, status } }` body with a fixed message chosen by HTTP status.
|
|
10
10
|
*/
|
|
@@ -21,7 +21,7 @@ import { estimateInputTokens } from "./responses/input-admission";
|
|
|
21
21
|
import type { DataPlaneAdmission } from "./auth-cors";
|
|
22
22
|
import { resolveAdmissionModelScope, routeAllowedByScope } from "./admission-model-scope";
|
|
23
23
|
import type { GeminiMethod } from "./gemini-native-paths";
|
|
24
|
-
import { geminiNativeCatalogAliases, geminiNativeCatalogLookup } from "./gemini-native-catalog";
|
|
24
|
+
import { geminiNativeCatalogAliases, geminiNativeCatalogLookup, geminiNativeDiscoveredRoutes } from "./gemini-native-catalog";
|
|
25
25
|
import {
|
|
26
26
|
applyLocalRefusalCode,
|
|
27
27
|
commitCancelled,
|
|
@@ -66,10 +66,11 @@ export function toGeminiRefusal(response: Response): Response {
|
|
|
66
66
|
return applyLocalRefusalCode(geminiError(parts.status, parts.message, parts.retryAfter), parts.localRefusalCode);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
function geminiCatalogRoutes(config: OcxConfig, req: Request) {
|
|
70
|
+
const configured = listOllamaRoutes(config, req);
|
|
71
|
+
const selectors = new Set(configured.map(row => row.selector));
|
|
72
|
+
const discovered = geminiNativeDiscoveredRoutes(config, req).filter(row => !selectors.has(row.selector));
|
|
73
|
+
return [...configured, ...discovered];
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
/** Token limits from configuration first, then generated model metadata; omitted when unknown. */
|
|
@@ -96,16 +97,19 @@ const modelResource = (config: OcxConfig, row: { selector: string; route: RouteR
|
|
|
96
97
|
});
|
|
97
98
|
|
|
98
99
|
export function handleGeminiModels(config: OcxConfig, req: Request, admission: DataPlaneAdmission): Response {
|
|
99
|
-
const
|
|
100
|
-
const
|
|
100
|
+
const scope = resolveAdmissionModelScope(config, admission);
|
|
101
|
+
const candidates = geminiCatalogRoutes(config, req);
|
|
102
|
+
const rows = candidates.filter(row => routeAllowedByScope(scope, row.route));
|
|
103
|
+
// A key can allow a concrete effort tier while excluding its source family.
|
|
104
|
+
const aliases = geminiNativeCatalogAliases(config, req, candidates, scope);
|
|
101
105
|
return Response.json({ models: [...rows, ...aliases].map(row => modelResource(config, row)) });
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
function findGeminiCatalogRow(config: OcxConfig, req: Request, admission: DataPlaneAdmission, model: string) {
|
|
105
|
-
const row = findOllamaRoute(config, model, req);
|
|
109
|
+
const row = findOllamaRoute(config, model, req) ?? geminiNativeDiscoveredRoutes(config, req, model)[0];
|
|
106
110
|
const scope = resolveAdmissionModelScope(config, admission);
|
|
107
111
|
if (row && routeAllowedByScope(scope, row.route)) return row;
|
|
108
|
-
return geminiNativeCatalogLookup(config, req, model, () =>
|
|
112
|
+
return geminiNativeCatalogLookup(config, req, model, () => geminiCatalogRoutes(config, req), scope);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
export function handleGeminiModel(config: OcxConfig, req: Request, admission: DataPlaneAdmission, model: string): Response {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { getStaleCached } from "../codex/model-cache";
|
|
2
|
+
import { filterCatalogVisibleModels } from "../codex/catalog/model-visibility";
|
|
1
3
|
import { resolveProtocolSettings } from "../protocols/settings";
|
|
2
4
|
import { resolveAntigravityEffortWireModel } from "../providers/antigravity-models";
|
|
5
|
+
import { slugEquals } from "../providers/slug-codec";
|
|
3
6
|
import { effectiveGoogleMode } from "../providers/registry";
|
|
4
7
|
import type { RouteResult } from "../router";
|
|
5
8
|
import type { OcxConfig } from "../types";
|
|
@@ -35,7 +38,7 @@ export function nativeGeminiDestination(config: OcxConfig, req: Request, selecto
|
|
|
35
38
|
|
|
36
39
|
/** A native alias must route to the same wire ID and pass scope under its own resolved destination. */
|
|
37
40
|
function allowedWireAlias(config: OcxConfig, req: Request, alias: string, scope?: AdmissionModelScope): CatalogRow | undefined {
|
|
38
|
-
if (!GEMINI_MODEL.test(alias)) return undefined;
|
|
41
|
+
if (!GEMINI_MODEL.test(alias) || nativeModelDisabled(config, alias)) return undefined;
|
|
39
42
|
const destination = resolveNativeDestination(config, req, alias);
|
|
40
43
|
if (destination?.wireModel !== alias || !routeAllowedByScope(scope, destination.route)) return undefined;
|
|
41
44
|
return { selector: alias, route: destination.route };
|
|
@@ -43,6 +46,27 @@ function allowedWireAlias(config: OcxConfig, req: Request, alias: string, scope?
|
|
|
43
46
|
|
|
44
47
|
type CatalogRow = { selector: string; route: RouteResult };
|
|
45
48
|
|
|
49
|
+
/** Read the same accepted provider roster as the other catalogs; do not start discovery here. */
|
|
50
|
+
export function geminiNativeDiscoveredRoutes(config: OcxConfig, req: Request, selector?: string): CatalogRow[] {
|
|
51
|
+
const provider = config.providers[PROVIDER];
|
|
52
|
+
if (!resolveProtocolSettings(config).rollout.geminiNativeAntigravity
|
|
53
|
+
|| !provider || provider.disabled === true || provider.liveModels === false
|
|
54
|
+
|| (selector !== undefined && !selector.startsWith(`${PROVIDER}/`))) return [];
|
|
55
|
+
const cached = getStaleCached(PROVIDER) ?? [];
|
|
56
|
+
const models = filterCatalogVisibleModels(cached.filter(model =>
|
|
57
|
+
model.provider === PROVIDER && GEMINI_MODEL.test(model.id)), config);
|
|
58
|
+
return models.flatMap(({ id }) => {
|
|
59
|
+
const qualified = `${PROVIDER}/${id}`;
|
|
60
|
+
if (selector !== undefined && selector !== qualified) return [];
|
|
61
|
+
const destination = resolveNativeDestination(config, req, qualified);
|
|
62
|
+
return destination?.route.modelId === id ? [{ selector: qualified, route: destination.route }] : [];
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function nativeModelDisabled(config: OcxConfig, modelId: string): boolean {
|
|
67
|
+
return config.disabledModels?.some(slug => slugEquals(slug, PROVIDER, modelId)) ?? false;
|
|
68
|
+
}
|
|
69
|
+
|
|
46
70
|
export function geminiNativeCatalogLookup(
|
|
47
71
|
config: OcxConfig, req: Request, alias: string, rows: () => readonly CatalogRow[], scope?: AdmissionModelScope,
|
|
48
72
|
): CatalogRow | undefined {
|
|
@@ -52,7 +76,8 @@ export function geminiNativeCatalogLookup(
|
|
|
52
76
|
}
|
|
53
77
|
|
|
54
78
|
function advertisedWireModels(config: OcxConfig, route: RouteResult): string[] {
|
|
55
|
-
|
|
79
|
+
if (route.providerName !== PROVIDER || nativeModelDisabled(config, route.modelId)) return [];
|
|
80
|
+
return [undefined, "low", "medium", "high", "xhigh"].flatMap(effort => nativeWireModel(config, route, effort) ?? []);
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
export function geminiNativeCatalogAliases(
|