@bitkyc08/opencodex 2.100.3 → 2.100.4
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/AGENTS_INSTALL.md +23 -1
- package/bin/ocx.mjs +8 -1
- package/gui/dist/assets/{App-Dnb6VMsP.js → App-DcpyI78f.js} +20 -19
- package/gui/dist/assets/{Tray-BV4ms9U9.js → Tray-CzjPJprT.js} +1 -1
- package/gui/dist/assets/brand-mark-BTIi7e69.js +1 -0
- package/gui/dist/assets/index-DJxM-imn.css +2 -0
- package/gui/dist/assets/index-DVgU6S3y.js +138 -0
- package/gui/dist/assets/{segment-thumb-features-DXSidY6D.js → segment-thumb-features-Bn6Y-g3R.js} +1 -1
- package/gui/dist/classic/assets/{App-DA-scMPq.js → App-eYJAyNHM.js} +19 -18
- package/gui/dist/classic/assets/{Tray-BrHaVRAq.js → Tray-xHMYxLkV.js} +1 -1
- package/gui/dist/classic/assets/index-DSaVRW4F.js +138 -0
- package/gui/dist/classic/assets/quota-summary-DyzHlkFl.js +1 -0
- package/gui/dist/classic/index.html +1 -1
- package/gui/dist/index.html +2 -2
- package/native/ocx-child/src/cli.rs +5 -3
- package/native/ocx-child/src/codex_home.rs +1 -0
- package/package.json +2 -2
- package/src/adapters/anthropic/per-message-effort.ts +296 -0
- package/src/adapters/anthropic.ts +3 -0
- package/src/adapters/claude-cli/adapter.ts +1 -0
- package/src/adapters/devin/cloud-direct/chat.ts +71 -14
- package/src/adapters/google-errors.ts +14 -2
- package/src/adapters/qoder/adapter.ts +9 -1
- package/src/adapters/zed.ts +4 -2
- package/src/claude/desktop-remote-store.ts +60 -10
- package/src/cli/account-api.ts +4 -0
- package/src/cli/account-auth.ts +30 -2
- package/src/cli/account-extended.ts +33 -2
- package/src/cli/capabilities-access-remote.ts +3 -3
- package/src/cli/capabilities-accounts.ts +3 -3
- package/src/cli/capabilities-base.ts +11 -6
- package/src/cli/capabilities-observe-system.ts +2 -2
- package/src/cli/claude.ts +3 -3
- package/src/cli/disconnect-runtime.ts +16 -6
- package/src/cli/dispatch.ts +7 -1
- package/src/cli/index.ts +2 -2
- package/src/cli/link-apply-restart.ts +4 -2
- package/src/cli/link-routes.ts +4 -1
- package/src/cli/link.ts +5 -4
- package/src/cli/preflight-exemptions.ts +3 -0
- package/src/cli/registry.ts +5 -2
- package/src/cli/resolve.ts +23 -8
- package/src/cli/restart-failure.ts +11 -1
- package/src/cli/runtime-api.ts +4 -0
- package/src/cli/status.ts +4 -1
- package/src/cli/system-command.ts +1 -1
- package/src/cli/system-restart-client.ts +9 -3
- package/src/cli/system-settings-parity.ts +2 -1
- package/src/client/connect.ts +63 -9
- package/src/client/desktop-refusal.ts +38 -0
- package/src/client/lifecycle-lock.ts +29 -4
- package/src/client/runtime-restart.ts +27 -15
- package/src/client/runtime.ts +4 -2
- package/src/client/state.ts +14 -0
- package/src/codex/account-pause.ts +4 -0
- package/src/codex/account-runtime-state.ts +4 -0
- package/src/codex/auth-api/main-account-probe.ts +3 -1
- package/src/codex/auth-api/main-hard-lock-refusal-read.ts +172 -0
- package/src/codex/auth-context.ts +40 -2
- package/src/codex/catalog/build-entries.ts +10 -0
- package/src/codex/catalog/derive-entry.ts +7 -0
- package/src/codex/catalog/reserve-warn.ts +7 -5
- package/src/codex/catalog/reserve.ts +4 -3
- package/src/codex/catalog/retained-sync.ts +2 -0
- package/src/codex/catalog/routed-defaults.ts +35 -0
- package/src/codex/convergence.ts +2 -0
- package/src/codex/loopback-target.ts +22 -8
- package/src/codex/main-account.ts +88 -29
- package/src/codex/native-main-auth-file.ts +14 -0
- package/src/codex/native-main-credentials.ts +270 -0
- package/src/codex/native-main-owner.ts +3 -0
- package/src/codex/native-main-refresh-mode.ts +14 -1
- package/src/codex/quota.ts +63 -14
- package/src/combos/failover.ts +12 -1
- package/src/combos/index.ts +5 -0
- package/src/combos/resolve.ts +115 -19
- package/src/config/diagnostics.ts +3 -0
- package/src/config/live-reconcile.ts +6 -3
- package/src/config/load-degrade.ts +2 -0
- package/src/config/persisted-mutation.ts +2 -2
- package/src/config/persisted-projections.ts +18 -0
- package/src/config/process-state.ts +4 -3
- package/src/config/reserve-capability.ts +96 -0
- package/src/config/schema/config-schema.ts +6 -0
- package/src/config/schema/leaf-validators.ts +2 -0
- package/src/config/schema/routed-catalog-defaults.ts +49 -0
- package/src/config.ts +7 -7
- package/src/desktop-update/acquire.ts +202 -0
- package/src/desktop-update/cli.ts +168 -0
- package/src/desktop-update/drain.ts +40 -0
- package/src/desktop-update/headless.ts +285 -0
- package/src/desktop-update/image.ts +85 -0
- package/src/desktop-update/install.ts +53 -0
- package/src/desktop-update/msi.ts +72 -0
- package/src/desktop-update/release.ts +128 -0
- package/src/desktop-update/runtime.ts +155 -0
- package/src/desktop-update/staging.ts +118 -0
- package/src/desktop-update/trust.ts +45 -0
- package/src/generated/compatibility-version.json +246 -130
- package/src/images/fulfill-video.ts +3 -3
- package/src/images/loop.ts +6 -2
- package/src/images/plan.ts +147 -11
- package/src/images/types.ts +13 -4
- package/src/images/xai-video-client.ts +72 -10
- package/src/lib/gcp-adc.ts +48 -4
- package/src/lib/offline-resend.ts +150 -0
- package/src/lib/paced-stream.ts +3 -3
- package/src/lib/provider-outbound.ts +17 -6
- package/src/lib/request-failure-model.ts +2 -0
- package/src/lib/response-body-inactivity.ts +23 -1
- package/src/lib/upstream-retry.ts +38 -5
- package/src/link/explicit-route.ts +4 -4
- package/src/link/remote-windows.ts +79 -31
- package/src/link/residual-recovery.ts +20 -8
- package/src/messaging/budget.ts +23 -5
- package/src/messaging/rpc.ts +4 -4
- package/src/oauth/antigravity-risk.ts +126 -0
- package/src/oauth/generic-account-failover.ts +89 -18
- package/src/oauth/generic-session-affinity.ts +10 -3
- package/src/oauth/login-cli.ts +35 -1
- package/src/oauth/pool-kernel.ts +3 -3
- package/src/providers/anthropic-billing-refusal.ts +27 -3
- package/src/providers/google-vertex-model-discovery.ts +6 -1
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/quota/workbuddy.ts +6 -2
- package/src/providers/workbuddy-credit-balance.ts +125 -16
- package/src/responses/effort-history.ts +732 -0
- package/src/routing/history/integrity.ts +41 -4
- package/src/server/auth-cors.ts +13 -3
- package/src/server/codex-model-list.ts +2 -1
- package/src/server/direct-local-http.ts +26 -3
- package/src/server/index/link-listener.ts +20 -14
- package/src/server/index/serve-options.ts +1 -0
- package/src/server/index.ts +3 -2
- package/src/server/link-turn.ts +17 -5
- package/src/server/management/config-routes.ts +39 -3
- package/src/server/management/link-child-preflight.ts +1 -1
- package/src/server/management/link-route-edit.ts +20 -1
- package/src/server/management/oauth-account-routes.ts +22 -5
- package/src/server/management/provider-overwrite-carry.ts +3 -0
- package/src/server/management/provider-routes.ts +4 -4
- package/src/server/management/static-catalog-probe.ts +33 -0
- package/src/server/proxy-liveness.ts +54 -9
- package/src/server/relay.ts +6 -1
- package/src/server/request-log-conversation.ts +2 -2
- package/src/server/request-log.ts +5 -1
- package/src/server/reserve-capability-startup.ts +32 -0
- package/src/server/responses/adapter-delivery.ts +2 -0
- package/src/server/responses/adapter-dispatch.ts +31 -10
- package/src/server/responses/antigravity-fault-rotation.ts +24 -0
- package/src/server/responses/antigravity-validation-refusal.ts +43 -6
- package/src/server/responses/combo-selection-keepalive.ts +254 -0
- package/src/server/responses/core-combo.ts +24 -9
- package/src/server/responses/core-errors.ts +9 -6
- package/src/server/responses/core-options.ts +8 -0
- package/src/server/responses/core.ts +21 -0
- package/src/server/responses/estimated-usage.ts +115 -0
- package/src/server/responses/jev-model-invoke.ts +7 -2
- package/src/server/responses/passthrough-completion.ts +6 -3
- package/src/server/responses/passthrough-delivery.ts +47 -8
- package/src/server/responses/passthrough-dispatch.ts +3 -0
- package/src/server/responses/request-prepare.ts +9 -5
- package/src/server/responses/sidecar-execution.ts +5 -0
- package/src/service/desktop-supervision.d.mts +2 -0
- package/src/service/desktop-supervision.mjs +5 -0
- package/src/stall-timeout.ts +11 -0
- package/src/types/config.ts +15 -92
- package/src/types/provider.ts +13 -0
- package/src/types/request.ts +19 -0
- package/src/types/routed-catalog-defaults.ts +17 -0
- package/src/types/routing-profile.ts +90 -0
- package/src/types.ts +1 -0
- package/src/update/index.ts +1 -1
- package/src/usage/log.ts +14 -4
- package/src/usage/telemetry-contract.ts +1 -0
- package/src/web-search/passthrough-bridge.ts +7 -0
- package/gui/dist/assets/brand-mark-XOLJbomA.js +0 -1
- package/gui/dist/assets/index-DCdXsMyZ.js +0 -105
- package/gui/dist/assets/index-DQtCRNAw.css +0 -2
- package/gui/dist/classic/assets/index-BqOaGLf5.js +0 -105
- package/gui/dist/classic/assets/quota-summary-Dy5_wfTT.js +0 -1
|
@@ -163,7 +163,12 @@ import { registerTurn, unregisterTurn, trackStreamLifetime } from "../lifecycle"
|
|
|
163
163
|
import { relaySseEagerBounded } from "../relay-eager";
|
|
164
164
|
import { readBoundedResponseBody } from "../../lib/bounded-body";
|
|
165
165
|
import { idleDeadline } from "../../lib/abort";
|
|
166
|
-
import { resolveStallTimeoutMs } from "../../stall-timeout";
|
|
166
|
+
import { explicitStallTimeoutMs, resolveStallTimeoutMs } from "../../stall-timeout";
|
|
167
|
+
import { guardResponseBodyInactivity, isResponseBodyInactivityGuarded } from "../../lib/response-body-inactivity";
|
|
168
|
+
import {
|
|
169
|
+
createEstimatedUsagePayloadRewrite, ESTIMATED_USAGE_HEADER, estimatedUsageJson, estimatesMissingUsage,
|
|
170
|
+
} from "./estimated-usage";
|
|
171
|
+
import { estimateInputTokens } from "./input-admission";
|
|
167
172
|
import { formatErrorResponse } from "../../bridge";
|
|
168
173
|
import {
|
|
169
174
|
httpStatusFromTerminalError,
|
|
@@ -470,6 +475,11 @@ export async function deliverPassthroughResponse(
|
|
|
470
475
|
} = nativeExchange;
|
|
471
476
|
const { commitReasoningReplayServingRoute, recordTerminalOutcomes } = responseEffects;
|
|
472
477
|
const { parsed, subagentQuotaFailureModel, clientRequestedStream, translatorBudget } = requestState;
|
|
478
|
+
// #7427: opt-in estimated usage for a provider that omits it. Client-facing only; the request log,
|
|
479
|
+
// spend and quota read the provider's original body.
|
|
480
|
+
const estimateUsage = estimatesMissingUsage(route.provider, options);
|
|
481
|
+
let usageInputEstimate: number | undefined;
|
|
482
|
+
const inputEstimate = (): number => usageInputEstimate ??= estimateInputTokens(parsed, route.modelId, route.provider);
|
|
473
483
|
const { openAiSidecar } = sidecarState;
|
|
474
484
|
const { requestBindings } = transportState;
|
|
475
485
|
|
|
@@ -741,18 +751,26 @@ export async function deliverPassthroughResponse(
|
|
|
741
751
|
});
|
|
742
752
|
// Capture the binding that actually served the first leg, after its permitted reselection.
|
|
743
753
|
const webSearchBridgeBinding = requestBindings.get(nativeExchange.request);
|
|
754
|
+
// #8206: an explicit stallTimeoutSec bounds silence on the native upstream body for every
|
|
755
|
+
// streaming relay. Unset keeps this relay without a clock; the canonical JSON fold keeps
|
|
756
|
+
// its own deadlines, and reset selection already guarded the bodies it published.
|
|
757
|
+
const nativeSseStallMs = canonicalBufferedJson || isResponseBodyInactivityGuarded(upstreamResponse)
|
|
758
|
+
? 0 : explicitStallTimeoutMs(config.stallTimeoutSec);
|
|
759
|
+
const nativeSseBody = nativeSseStallMs > 0
|
|
760
|
+
? guardResponseBodyInactivity(upstreamResponse, upstream.signal, nativeSseStallMs, { explicitBudget: true }).response.body!
|
|
761
|
+
: upstreamResponse.body;
|
|
744
762
|
// Repair must observe the raw first leg before the bridge suppresses an intercepted search
|
|
745
763
|
// lifecycle. Otherwise a provider that leaves that complete call open never arms repair's
|
|
746
764
|
// grace timer, so the bridge cannot execute the search or begin its continuation.
|
|
747
765
|
let passthroughSseBody = terminalRepairPolicy
|
|
748
766
|
? relayResponsesSseWithTerminalRepair(
|
|
749
|
-
|
|
767
|
+
nativeSseBody,
|
|
750
768
|
upstream,
|
|
751
769
|
terminalRepairPolicy,
|
|
752
770
|
translatorBudget,
|
|
753
771
|
options.responsesTerminalRepairScheduler, logCtx,
|
|
754
772
|
)
|
|
755
|
-
:
|
|
773
|
+
: nativeSseBody;
|
|
756
774
|
passthroughSseBody = webSearchBridgePlan
|
|
757
775
|
? createPassthroughWebSearchBridgeStream({
|
|
758
776
|
plan: webSearchBridgePlan,
|
|
@@ -784,17 +802,24 @@ export async function deliverPassthroughResponse(
|
|
|
784
802
|
);
|
|
785
803
|
// The same provider can leave a complete continuation open without a terminal, which
|
|
786
804
|
// stalls the bridge's decide loop exactly like the first leg — so every leg gets the
|
|
787
|
-
// same repair, not only the intercepted first one.
|
|
788
|
-
if (!
|
|
805
|
+
// same repair and the same explicit silence clock, not only the intercepted first one.
|
|
806
|
+
if (!continuation.ok || !continuation.body) return continuation;
|
|
807
|
+
// A continuation is a fresh upstream body: guard it from the explicit budget even when
|
|
808
|
+
// reset selection already guarded the first leg (and so left nativeSseStallMs at 0).
|
|
809
|
+
const continuationStallMs = explicitStallTimeoutMs(config.stallTimeoutSec);
|
|
810
|
+
const guardedContinuation = continuationStallMs > 0
|
|
811
|
+
? guardResponseBodyInactivity(continuation, upstream.signal, continuationStallMs, { explicitBudget: true }).response
|
|
812
|
+
: continuation;
|
|
813
|
+
if (!terminalRepairPolicy) return guardedContinuation;
|
|
789
814
|
return new Response(
|
|
790
815
|
relayResponsesSseWithTerminalRepair(
|
|
791
|
-
|
|
816
|
+
guardedContinuation.body!,
|
|
792
817
|
upstream,
|
|
793
818
|
terminalRepairPolicy,
|
|
794
819
|
translatorBudget,
|
|
795
820
|
options.responsesTerminalRepairScheduler, logCtx,
|
|
796
821
|
),
|
|
797
|
-
|
|
822
|
+
guardedContinuation,
|
|
798
823
|
);
|
|
799
824
|
},
|
|
800
825
|
execute: createPassthroughWebSearchBridgeExecutor(webSearchBridgePlan, {
|
|
@@ -981,7 +1006,12 @@ export async function deliverPassthroughResponse(
|
|
|
981
1006
|
(!canonicalBufferedJson || !options.comboAttempt) && isLocalCodexImageClient(req.headers, options.admission?.kind, options.inboundWire)
|
|
982
1007
|
? createHostedImageDisplayRewrite()
|
|
983
1008
|
: undefined,
|
|
1009
|
+
// Last, so it sees the response the client receives; never on the canonical JSON fold.
|
|
1010
|
+
estimateUsage && !canonicalBufferedJson
|
|
1011
|
+
? payloadRewriteAsBlockRewrite(createEstimatedUsagePayloadRewrite(inputEstimate, route.modelId))
|
|
1012
|
+
: undefined,
|
|
984
1013
|
].filter((rewrite): rewrite is NonNullable<typeof rewrite> => rewrite !== undefined);
|
|
1014
|
+
if (estimateUsage && !canonicalBufferedJson) headers.set(ESTIMATED_USAGE_HEADER, "when-missing");
|
|
985
1015
|
const clientBlockRewrite = blockRewrites.length > 0
|
|
986
1016
|
? composeSseBlockRewrites(...blockRewrites)
|
|
987
1017
|
: undefined;
|
|
@@ -1209,7 +1239,7 @@ export async function deliverPassthroughResponse(
|
|
|
1209
1239
|
}
|
|
1210
1240
|
|
|
1211
1241
|
const relayPlatform = relayPlatformForTests ?? process.platform;
|
|
1212
|
-
//
|
|
1242
|
+
// Every relayed Remote Link turn reads its upstream only as its client drains (#8601), feature switch or not;
|
|
1213
1243
|
// every other request keeps the relays' read-ahead below. Its chunks travel in slices, and the paced mark makes the
|
|
1214
1244
|
// tee, the eager relay and every stage after them read one slice at a time as the client asks (src/lib/paced-stream.ts).
|
|
1215
1245
|
if (linkTurnPacesReads(logCtx)) passthroughSseBody = markPacedStream(sliceChunks(passthroughSseBody, LINK_PACED_SLICE_BYTES));
|
|
@@ -1507,6 +1537,15 @@ export async function deliverPassthroughResponse(
|
|
|
1507
1537
|
throw error;
|
|
1508
1538
|
} finally { imageDisplay.dispose?.(); }
|
|
1509
1539
|
}
|
|
1540
|
+
if (estimateUsage && upstreamResponse.ok) {
|
|
1541
|
+
const estimated = estimatedUsageJson(clientJson, inputEstimate(), route.modelId);
|
|
1542
|
+
if (estimated !== undefined) {
|
|
1543
|
+
clientJson = estimated;
|
|
1544
|
+
headers.set(ESTIMATED_USAGE_HEADER, "true");
|
|
1545
|
+
// The request-log finalizer parses the delivered body again; keep the estimate out of it.
|
|
1546
|
+
logCtx.usageEstimatedForClient = true;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1510
1549
|
// #875: the transport-neutral reliability policy forced a bounded JSON
|
|
1511
1550
|
// upstream for a client that asked for SSE. Reframe the completed JSON
|
|
1512
1551
|
// as the canonical terminal SSE sequence (created → output_item.done →
|
|
@@ -139,6 +139,7 @@ import { classifyTransportFailureKind, transportErrorCode } from "../../lib/upst
|
|
|
139
139
|
import { captureAccountAutoPauseAttempt, wasAccountAutoPaused, wasPermanentAccountRefusal } from "../../oauth/account-auto-pause";
|
|
140
140
|
import { codexFailureWindowOutcomeMeta, recordCodexUpstreamOutcome } from "../../codex/routing";
|
|
141
141
|
import { describeUpstreamConnectFailure } from "./upstream-error";
|
|
142
|
+
import { createProviderOfflineResendWait } from "../../lib/offline-resend";
|
|
142
143
|
import type { OpaqueBlobRecoveryGuard } from "./core-opaque-recovery";
|
|
143
144
|
import {
|
|
144
145
|
rateLimitRetryPolicyFor,
|
|
@@ -1047,6 +1048,8 @@ export async function preparePassthroughExchange(
|
|
|
1047
1048
|
// by `onPhysicalDispatch`; a reporter as well would count them twice.
|
|
1048
1049
|
...(receiptMode ? {} : { onSendsConsumed: initialAccounting.report }),
|
|
1049
1050
|
claimAmbiguousResend: claimPreHeaderResend,
|
|
1051
|
+
// A combo fails over to another member instead of waiting once per target.
|
|
1052
|
+
offlineWait: options.comboAttempt ? undefined : createProviderOfflineResendWait(route.providerName, route.provider, request.url, config.offlineResendWaitSec),
|
|
1050
1053
|
},
|
|
1051
1054
|
);
|
|
1052
1055
|
} catch (err) {
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
unreadableEncryptedAgentTaskResponse,
|
|
28
28
|
} from "./core-errors";
|
|
29
29
|
import { parseSyntheticRowId } from "../fast-row";
|
|
30
|
-
import { resolveComboId, comboIdFromRawBody,
|
|
30
|
+
import { resolveComboId, comboIdFromRawBody, comboExclusion, NoAvailableComboTargetsError, pickComboTarget } from "../../combos";
|
|
31
31
|
import { INTERCEPT_TARGET_UNAVAILABLE_CODE, interceptTargetUnavailableResponse, resolveChosenTarget, resolveShadowCallTarget } from "./shadow-target-availability";
|
|
32
32
|
import {
|
|
33
33
|
MEMORY_MODEL_TARGET_UNAVAILABLE_CODE,
|
|
@@ -190,6 +190,7 @@ import {
|
|
|
190
190
|
|
|
191
191
|
import { redactHostedImageDisplayPaths } from "../responses-hosted-image-display";
|
|
192
192
|
import { eagerCodexToolCatalogSurface, warnEagerCodexToolCatalog } from "./codex-tool-catalog";
|
|
193
|
+
import { codexTurnStartsNewHistory } from "../../adapters/anthropic/per-message-effort";
|
|
193
194
|
|
|
194
195
|
/** Policy-routing evidence. The direct lane's settings-only body has no conversation to scan. */
|
|
195
196
|
function routeEvidence(options: Pick<HandleResponsesOptions, "directRequest">, parsed: OcxParsedRequest): PolicyRequestEvidence {
|
|
@@ -553,6 +554,8 @@ export async function prepareResponsesRequest(
|
|
|
553
554
|
parsed._anthropicInbound = true;
|
|
554
555
|
if (parsed.options.textFormat?.type === "json_schema") parsed._structuredOutputConformance = true;
|
|
555
556
|
}
|
|
557
|
+
// Codex's own "new" turn metadata, for the experimental Anthropic perMessageEffort option (#6895).
|
|
558
|
+
parsed._codexNewHistory = codexTurnStartsNewHistory(body, req.headers, options.inboundTransport);
|
|
556
559
|
parsed._promptCacheKeyIsSharedCohort = options.promptCacheKeyIsSharedCohort;
|
|
557
560
|
// The body may have been rebuilt since the inbound observation (previous-response
|
|
558
561
|
// expansion); alias the parsed raw body to the same draft so the outbound
|
|
@@ -736,7 +739,7 @@ export async function prepareResponsesRequest(
|
|
|
736
739
|
});
|
|
737
740
|
if (!pick) {
|
|
738
741
|
throw new NoAvailableComboTargetsError(candidate.combo.comboId,
|
|
739
|
-
|
|
742
|
+
comboExclusion(config, candidate.combo.comboId, target => !target.metered));
|
|
740
743
|
}
|
|
741
744
|
const routed = routeConcreteModel(config, `${pick.target.provider}/${pick.target.model}`);
|
|
742
745
|
candidate = { ...routed, combo: pick, routeKind: "combo", routeReason: routed.routeReason === "blocked-model-redirect" ? "blocked-model-redirect" : "combo-pick" };
|
|
@@ -903,7 +906,7 @@ export async function prepareResponsesRequest(
|
|
|
903
906
|
if (policyRefusal) return policyRefusal;
|
|
904
907
|
if (err instanceof AdmissionModelDeniedError) return admissionModelDeniedResponse(projectAdmissionModelDeniedLog(err, logCtx));
|
|
905
908
|
if (err instanceof NoAvailableComboTargetsError) {
|
|
906
|
-
return comboUnavailable(err.comboId, undefined, err.
|
|
909
|
+
return comboUnavailable(err.comboId, undefined, err.exclusion);
|
|
907
910
|
}
|
|
908
911
|
if (err instanceof NoEligiblePolicyCandidateError) {
|
|
909
912
|
// Persist the evaluation trace (per-candidate exclusions + the
|
|
@@ -1123,7 +1126,7 @@ export async function prepareResponsesRequest(
|
|
|
1123
1126
|
if (policyRefusal) return policyRefusal;
|
|
1124
1127
|
if (err instanceof AdmissionModelDeniedError) return admissionModelDeniedResponse(projectAdmissionModelDeniedLog(err, logCtx));
|
|
1125
1128
|
if (err instanceof NoAvailableComboTargetsError) {
|
|
1126
|
-
return comboUnavailable(err.comboId, undefined, err.
|
|
1129
|
+
return comboUnavailable(err.comboId, undefined, err.exclusion);
|
|
1127
1130
|
}
|
|
1128
1131
|
if (err instanceof NoEligiblePolicyCandidateError) {
|
|
1129
1132
|
logCtx.routeDecision = err.trace;
|
|
@@ -1199,6 +1202,7 @@ export async function prepareResponsesRequest(
|
|
|
1199
1202
|
"_reasoningReplayScope",
|
|
1200
1203
|
"_nativeReasoningRetention",
|
|
1201
1204
|
"_cursorIsolateConversation",
|
|
1205
|
+
"_codexNewHistory",
|
|
1202
1206
|
];
|
|
1203
1207
|
for (const key of kept) {
|
|
1204
1208
|
if (parsed[key] !== undefined) {
|
|
@@ -1347,7 +1351,7 @@ export async function prepareResponsesRequest(
|
|
|
1347
1351
|
if (policyRefusal) return policyRefusal;
|
|
1348
1352
|
if (err instanceof AdmissionModelDeniedError) return admissionModelDeniedResponse(projectAdmissionModelDeniedLog(err, logCtx));
|
|
1349
1353
|
if (err instanceof NoAvailableComboTargetsError) {
|
|
1350
|
-
return comboUnavailable(err.comboId, undefined, err.
|
|
1354
|
+
return comboUnavailable(err.comboId, undefined, err.exclusion);
|
|
1351
1355
|
}
|
|
1352
1356
|
if (err instanceof NoEligiblePolicyCandidateError) {
|
|
1353
1357
|
logCtx.routeDecision = err.trace;
|
|
@@ -62,6 +62,7 @@ import { trackStreamLifetime } from "../lifecycle";
|
|
|
62
62
|
import { isAntigravityRawValidationRefusal } from "./antigravity-validation-refusal";
|
|
63
63
|
import { createSidecarSendBudget } from "./sidecar-send-budget";
|
|
64
64
|
import { stripReplayedSearchPairs } from "../../web-search/sidecar-search-replay";
|
|
65
|
+
import { settleAnthropicPerMessageEffort, shareAnthropicPerMessageEffortTurn } from "../../adapters/anthropic/per-message-effort";
|
|
65
66
|
|
|
66
67
|
/** One responsibility of the Responses request pipeline; state owners are explicit. */
|
|
67
68
|
export async function executeResponsesSidecars(
|
|
@@ -238,6 +239,8 @@ export async function executeResponsesSidecars(
|
|
|
238
239
|
// Replayed search pairs call the synthetic web_search tool only the sidecar declares (#7269).
|
|
239
240
|
if (!wsPlan) stripReplayedSearchPairs(parsed);
|
|
240
241
|
const vidPlan = !routedCompaction ? await planVideoBridge(config, parsed, route.provider) : undefined;
|
|
242
|
+
// Hosted loops rebuild per iteration from spread copies; they share one per-message effort turn (#6895).
|
|
243
|
+
if (wsPlan || imgPlan || vidPlan) shareAnthropicPerMessageEffortTurn(parsed);
|
|
241
244
|
const canRunWebSearch = !!wsPlan && !transportState.adapter.runTurn;
|
|
242
245
|
let sidecarOutputStarted = false;
|
|
243
246
|
const sidecarHasCommittedOutput = () => sidecarOutputStarted
|
|
@@ -624,6 +627,7 @@ export async function executeResponsesSidecars(
|
|
|
624
627
|
escapeMemoryCitationTags: inboundWire !== "chat" && inboundWire !== "anthropic",
|
|
625
628
|
onCompletedResponse: (response, providerState) => {
|
|
626
629
|
if (!options.abortSignal?.aborted) thinkingRecovery.rememberSuccess(response);
|
|
630
|
+
settleAnthropicPerMessageEffort(parsed, response, transportState.adapter.name);
|
|
627
631
|
const served = transportState.replayOAuthCredentialSnapshot;
|
|
628
632
|
if (route.providerName === "kiro" && response.status === "completed" && served
|
|
629
633
|
&& noteKiroServedSuccess(served.accountId, served.generation)) persistKiroAccountState();
|
|
@@ -766,6 +770,7 @@ export async function executeResponsesSidecars(
|
|
|
766
770
|
retryOn429Policy: route.providerName === "kiro" && isGenericOAuthFailoverEnabled(config, "kiro")
|
|
767
771
|
? null : rateLimitRetryPolicyFor(route.provider),
|
|
768
772
|
onCompletedResponse: response => {
|
|
773
|
+
settleAnthropicPerMessageEffort(parsed, response, transportState.adapter.name);
|
|
769
774
|
const served = transportState.replayOAuthCredentialSnapshot;
|
|
770
775
|
if (route.providerName === "kiro" && response.status === "completed" && served
|
|
771
776
|
&& noteKiroServedSuccess(served.accountId, served.generation)) persistKiroAccountState();
|
|
@@ -47,6 +47,8 @@ export const procfs: ProcReader;
|
|
|
47
47
|
export function processIdentity(pid: number, execute?: DesktopSupervisionDeps["run"], onExecutable?: (path: string) => void):
|
|
48
48
|
{ parent: number; executable: string } | null;
|
|
49
49
|
export function windowsPowerShellPath(resolveSystemDirectory?: () => string): string;
|
|
50
|
+
/** Trusted Windows system directory (GetSystemDirectoryW on Bun); throws off Windows. */
|
|
51
|
+
export function trustedWindowsSystemDirectory(): string;
|
|
50
52
|
/** Pure consistency check over loaded-module paths; throws unless exactly one well-formed
|
|
51
53
|
* namesake per KnownDLL shares one parent directory. Exported for tests. */
|
|
52
54
|
export function windowsSystemDirectoryFromSharedObjects(loaded: unknown): string;
|
|
@@ -102,6 +102,11 @@ function resolveWindowsSystemDirectory() {
|
|
|
102
102
|
return (windowsSystemDirectoryCache = directory);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/** The trusted system directory, for callers that run another system binary (msiexec). */
|
|
106
|
+
export function trustedWindowsSystemDirectory() {
|
|
107
|
+
return resolveWindowsSystemDirectory();
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
function resolveWindowsSystemDirectoryViaFfi() {
|
|
106
111
|
const { dlopen, ptr } = createRequire(import.meta.url)("bun:ffi");
|
|
107
112
|
const lib = dlopen("kernel32.dll", { GetSystemDirectoryW: { args: ["ptr", "u32"], returns: "u32" } });
|
package/src/stall-timeout.ts
CHANGED
|
@@ -44,6 +44,17 @@ export function resolveStallTimeoutMs(configuredSec: number | undefined, options
|
|
|
44
44
|
return resolveStallTimeoutSec(configuredSec, options) * 1_000;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The operator's explicit positive stall budget in milliseconds, or `0` when the budget is unset or
|
|
49
|
+
* non-positive. Native Responses SSE relays arm their silence clock from this value only (#8206):
|
|
50
|
+
* an explicit value applies to local and public upstreams alike, and leaving the field unset keeps
|
|
51
|
+
* that relay without a silence clock, as it was before the budget was enforced there.
|
|
52
|
+
*/
|
|
53
|
+
export function explicitStallTimeoutMs(configuredSec: number | undefined): number {
|
|
54
|
+
if (typeof configuredSec !== "number" || !Number.isFinite(configuredSec) || configuredSec <= 0) return 0;
|
|
55
|
+
return resolveStallTimeoutMs(configuredSec);
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
/** Header-arrival (connect) deadline applied to public upstreams when the operator sets none. */
|
|
48
59
|
export const DEFAULT_CONNECT_TIMEOUT_MS = 200_000;
|
|
49
60
|
|
package/src/types/config.ts
CHANGED
|
@@ -7,9 +7,15 @@ import type { MultiAgentMode } from "./multi-agent";
|
|
|
7
7
|
import type { OcxTelemetryConfig } from "./telemetry";
|
|
8
8
|
import type { OcxClaudeCodeToolLoadingConfig } from "./claude-tool-loading";
|
|
9
9
|
import type { OcxLinkHomeConfig, OcxLinkTransportConfig } from "./link";
|
|
10
|
+
import type { OcxRoutingProfileConfig } from "./routing-profile";
|
|
10
11
|
export type { AnthropicAccountPoolConfig, AnthropicModelRoute, OcxAccountPoolRotationStrategy, OcxAccountPoolQuotaWindow } from "./anthropic-account-pool";
|
|
11
12
|
export type { OcxFallbackConfig, OcxFallbackDeviceConfig, OcxFallbackKind, OcxFallbackSwitches } from "./fallback";
|
|
12
13
|
export type { OcxClaudeCodeToolLoadingConfig } from "./claude-tool-loading";
|
|
14
|
+
export type {
|
|
15
|
+
OcxRoutingUnknownEvidenceMode, OcxRoutingProfileCandidate, OcxRoutingProfileRequirements, OcxRoutingProfileOptimize,
|
|
16
|
+
OcxRoutingUnknownCostCapMode, OcxRoutingProfileLimits, OcxRoutingProfileUnknownEvidence,
|
|
17
|
+
OcxRoutingProfileCompatibilitySuite, OcxRoutingProfileCompatibility, OcxRoutingProfileConfig,
|
|
18
|
+
} from "./routing-profile";
|
|
13
19
|
|
|
14
20
|
/** Public inference API exposure. Responses and Chat Completions are always served. */
|
|
15
21
|
export interface OcxApiSurfacesConfig {
|
|
@@ -855,10 +861,10 @@ export interface OcxConfig extends OcxLinkHomeConfig {
|
|
|
855
861
|
* Unknown windows use maxTokens alone; overflow is archived locally with a path notice.
|
|
856
862
|
* Native and opaque compaction output keep their existing protocols. */
|
|
857
863
|
reasoningRetention?: { enabled?: boolean; maxContextPercent?: number; maxTokens?: number };
|
|
858
|
-
|
|
859
|
-
nativeReasoningRetention?: { modelSwitch?: boolean; accountSwitch?: boolean };
|
|
864
|
+
nativeReasoningRetention?: { modelSwitch?: boolean; accountSwitch?: boolean }; // canonical ChatGPT reasoning replay allowances; both default off
|
|
860
865
|
/** Per-root fan-out ceilings (src/lib/workflow-budget.ts); omitted fields keep 8 / 256 / 64. */
|
|
861
866
|
workflowBudget?: { maxConcurrentChildren?: number; maxPhysicalSends?: number; maxDistinctChildren?: number };
|
|
867
|
+
routedCatalogDefaults?: import("./routed-catalog-defaults").OcxRoutedCatalogDefaultsConfig; // #6872; provider/model declarations win
|
|
862
868
|
/** Explicit opt-in; resumes Observe only using an existing trusted certificate and endpoints. */
|
|
863
869
|
desktopCompatibility?: { startOnProxyStart: boolean };
|
|
864
870
|
/**
|
|
@@ -1068,6 +1074,7 @@ export interface OcxConfig extends OcxLinkHomeConfig {
|
|
|
1068
1074
|
* can hold the connection silent for minutes on a large prompt before the first header arrives.
|
|
1069
1075
|
*/
|
|
1070
1076
|
connectTimeoutMs?: number;
|
|
1077
|
+
/** Opt-in (#7958): seconds (max 300) to wait for DNS after a pre-connect failure, then resend once. Unset or 0 is off. */ offlineResendWaitSec?: number;
|
|
1071
1078
|
/** Graceful shutdown drain timeout (ms). Active turns are aborted after this deadline. Default 5000. */
|
|
1072
1079
|
shutdownTimeoutMs?: number;
|
|
1073
1080
|
/** Advertise supports_websockets so Codex opens the WS endpoint. Default false; set true to opt in. */ websockets?: boolean;
|
|
@@ -1103,6 +1110,10 @@ export interface OcxConfig extends OcxLinkHomeConfig {
|
|
|
1103
1110
|
* non-loopback binds, whose admission token contract is unchanged.
|
|
1104
1111
|
*/
|
|
1105
1112
|
codexDesktopAuthless?: boolean;
|
|
1113
|
+
/** Luna Reserve (#4961): seeded once from `codexDesktopAuthless`, then independent (absent = off). Grants no entitlement. */
|
|
1114
|
+
codexReserveEnabled?: boolean;
|
|
1115
|
+
/** Internal marker recording that one-time seed. */
|
|
1116
|
+
codexReserveMigration?: number;
|
|
1106
1117
|
/**
|
|
1107
1118
|
* Opt into Codex-owned client compaction while keeping OpenCodex routing. On an authenticated
|
|
1108
1119
|
* loopback bind, inject the dedicated `opencodex` model provider instead of overriding the
|
|
@@ -1574,96 +1585,6 @@ export interface OcxComboConfig {
|
|
|
1574
1585
|
sessionPin?: import("../combos/jev-session-pin-config").JevSessionPinConfig | null;
|
|
1575
1586
|
}
|
|
1576
1587
|
|
|
1577
|
-
export type OcxRoutingUnknownEvidenceMode = "allow" | "penalize" | "exclude";
|
|
1578
|
-
|
|
1579
|
-
export interface OcxRoutingProfileCandidate {
|
|
1580
|
-
provider: string;
|
|
1581
|
-
model: string;
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
export interface OcxRoutingProfileRequirements {
|
|
1585
|
-
/** Minimum model context window in tokens. */
|
|
1586
|
-
minContextWindow?: number;
|
|
1587
|
-
/** Minimum remaining quota headroom fraction (0..1). */
|
|
1588
|
-
minQuotaHeadroom?: number;
|
|
1589
|
-
tools?: boolean;
|
|
1590
|
-
imageInput?: boolean;
|
|
1591
|
-
structuredOutput?: boolean;
|
|
1592
|
-
reasoningEffort?: string;
|
|
1593
|
-
serviceTier?: string;
|
|
1594
|
-
localOnly?: boolean;
|
|
1595
|
-
remoteAllowed?: boolean;
|
|
1596
|
-
/** Special encrypted Codex task readability (ChatGPT forward pool). */
|
|
1597
|
-
encryptedCodexTasks?: boolean;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
export interface OcxRoutingProfileOptimize {
|
|
1601
|
-
latency?: number;
|
|
1602
|
-
health?: number;
|
|
1603
|
-
cost?: number;
|
|
1604
|
-
quota?: number;
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
/**
|
|
1608
|
-
* Policy for the hard cost ceiling when a candidate has no finite cost
|
|
1609
|
-
* estimate. `"allow"` (default) preserves the documented dry-run contract:
|
|
1610
|
-
* the cap only excludes evidence known to exceed it, and the candidate's
|
|
1611
|
-
* `cost.capOutcome` is `"unknown-allowed"`. `"exclude"` makes the ceiling
|
|
1612
|
-
* fail-closed (`cost-limit-unknown` + `capOutcome: "unknown-excluded"`).
|
|
1613
|
-
*/
|
|
1614
|
-
export type OcxRoutingUnknownCostCapMode = "allow" | "exclude";
|
|
1615
|
-
|
|
1616
|
-
export interface OcxRoutingProfileLimits {
|
|
1617
|
-
/** Hard per-request estimated-cost ceiling in USD. */
|
|
1618
|
-
maxEstimatedCostUsd?: number;
|
|
1619
|
-
/**
|
|
1620
|
-
* How `maxEstimatedCostUsd` behaves when the estimate is unknown.
|
|
1621
|
-
* Defaults to `"allow"` (eligible + `cost.capOutcome: "unknown-allowed"`);
|
|
1622
|
-
* opt in to `"exclude"` for a true hard ceiling.
|
|
1623
|
-
*/
|
|
1624
|
-
onUnknownCost?: OcxRoutingUnknownCostCapMode;
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
export interface OcxRoutingProfileUnknownEvidence {
|
|
1628
|
-
capability?: OcxRoutingUnknownEvidenceMode;
|
|
1629
|
-
health?: OcxRoutingUnknownEvidenceMode;
|
|
1630
|
-
quota?: OcxRoutingUnknownEvidenceMode;
|
|
1631
|
-
cost?: OcxRoutingUnknownEvidenceMode;
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
export interface OcxRoutingProfileCompatibilitySuite {
|
|
1635
|
-
suiteId: string;
|
|
1636
|
-
evidenceLayer: "protocol_conformance" | "live_route_compatibility";
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
export interface OcxRoutingProfileCompatibility {
|
|
1640
|
-
requiredSuites?: OcxRoutingProfileCompatibilitySuite[];
|
|
1641
|
-
minStatus?: "PROBED" | "VERIFIED";
|
|
1642
|
-
maxEvidenceAgeMs?: number;
|
|
1643
|
-
unknownEvidence?: OcxRoutingUnknownEvidenceMode;
|
|
1644
|
-
degradedEvidence?: OcxRoutingUnknownEvidenceMode;
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
export interface OcxRoutingProfileConfig {
|
|
1648
|
-
/**
|
|
1649
|
-
* Explicit candidate allowlist (`provider/model` refs). No implicit
|
|
1650
|
-
* expansion in v1.
|
|
1651
|
-
*/
|
|
1652
|
-
candidates: OcxRoutingProfileCandidate[];
|
|
1653
|
-
/** Optional public model name replacing the default `policy/<id>` slug. */
|
|
1654
|
-
alias?: string;
|
|
1655
|
-
/** Hard requirements evaluated before scoring. */
|
|
1656
|
-
require?: OcxRoutingProfileRequirements;
|
|
1657
|
-
/** Optimization weights; normalized deterministically. */
|
|
1658
|
-
optimize?: OcxRoutingProfileOptimize;
|
|
1659
|
-
limits?: OcxRoutingProfileLimits;
|
|
1660
|
-
/** How unknown evidence is handled per dimension. */
|
|
1661
|
-
unknownEvidence?: OcxRoutingProfileUnknownEvidence;
|
|
1662
|
-
/** Optional Compatibility Lab policy (CL-06). */
|
|
1663
|
-
compatibility?: OcxRoutingProfileCompatibility;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
1588
|
export interface OcxTokenGuardianConfig {
|
|
1668
1589
|
/** Global kill-switch. Default false — the guardian does nothing unless explicitly enabled. */
|
|
1669
1590
|
enabled?: boolean;
|
|
@@ -1702,6 +1623,8 @@ export interface OcxImagesConfig {
|
|
|
1702
1623
|
artifactsKeepCount?: number;
|
|
1703
1624
|
/** Master switch for the video bridge. Default false — must be explicitly opted in. */
|
|
1704
1625
|
videoBridgeEnabled?: boolean;
|
|
1626
|
+
/** Optional API-key provider that serves `video_gen` (its own baseUrl and key). Unset keeps xAI; an unusable value fails closed. */
|
|
1627
|
+
videoProvider?: string;
|
|
1705
1628
|
/** Model for xAI video generation. Default "grok-imagine-video". */
|
|
1706
1629
|
videoBridgeModel?: string;
|
|
1707
1630
|
/** Max video-gen rounds before forced-final. Default 2 (video is slower than image). */
|
package/src/types/provider.ts
CHANGED
|
@@ -964,6 +964,11 @@ export interface OcxProviderConfig {
|
|
|
964
964
|
* buffered JSON reconstructed from upstream SSE; ordinary upstream JSON is unchanged.
|
|
965
965
|
*/
|
|
966
966
|
messagePhaseInference?: boolean;
|
|
967
|
+
/**
|
|
968
|
+
* Opt-in (#7427): on a native Responses route, add estimated `usage` to a completed response the
|
|
969
|
+
* provider sent without one, marked by `x-opencodex-usage-estimated`. Never used for cost, spend or quota.
|
|
970
|
+
*/
|
|
971
|
+
estimateMissingUsage?: boolean;
|
|
967
972
|
/**
|
|
968
973
|
* Opt-in hosted-web-search bridge for this KEY-auth Responses passthrough provider (#3761).
|
|
969
974
|
* Absent or disabled leaves the passthrough byte-identical to today.
|
|
@@ -1213,6 +1218,14 @@ export interface OcxProviderConfig {
|
|
|
1213
1218
|
* the `advisor-tool-2026-03-01` beta too. `false`: never forwarded, even first-party.
|
|
1214
1219
|
*/
|
|
1215
1220
|
forwardAdvisorTool?: boolean;
|
|
1221
|
+
/**
|
|
1222
|
+
* Experimental, default off (#6895). On an `anthropic`-adapter provider that sends to
|
|
1223
|
+
* `api.anthropic.com` with an API key, a Codex conversation that changes reasoning effort keeps
|
|
1224
|
+
* the top-level `output_config.effort` at its first turn's value and sends each change as an
|
|
1225
|
+
* effort-only system message (beta `mid-conversation-output-config-2026-07-01`), so the prompt
|
|
1226
|
+
* cache survives the change. Any turn the history cannot prove is sent exactly as without it.
|
|
1227
|
+
*/
|
|
1228
|
+
perMessageEffort?: boolean;
|
|
1216
1229
|
/**
|
|
1217
1230
|
* Model ids that do NOT accept image inputs. The proxy gives them "eyes" via the vision sidecar:
|
|
1218
1231
|
* attached images are described by a gpt vision model and replaced with text before the call.
|
package/src/types/request.ts
CHANGED
|
@@ -221,6 +221,14 @@ export interface OcxParsedRequest {
|
|
|
221
221
|
* provider-private continuation caches again on every later turn.
|
|
222
222
|
*/
|
|
223
223
|
_contextCompactionBoundary?: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Codex's own per-turn metadata for this request says `history_initialization: "New"` (HTTP header,
|
|
226
|
+
* or a WebSocket frame's own `client_metadata`). Read once in request preparation; the experimental
|
|
227
|
+
* Anthropic `perMessageEffort` option takes it as the new-transcript receipt (#6895).
|
|
228
|
+
*/
|
|
229
|
+
_codexNewHistory?: boolean;
|
|
230
|
+
/** This turn's per-message effort bookkeeping (src/adapters/anthropic/per-message-effort.ts). */
|
|
231
|
+
_perMessageEffort?: PerMessageEffortTurn;
|
|
224
232
|
/**
|
|
225
233
|
* Core-owned registration slot for the optional advisor subsystem (src/advisor). Set per request
|
|
226
234
|
* by the sidecar planner, never at module load: the core Responses path only sees this
|
|
@@ -563,6 +571,17 @@ export interface OcxUrlCitation {
|
|
|
563
571
|
title?: string;
|
|
564
572
|
}
|
|
565
573
|
|
|
574
|
+
/**
|
|
575
|
+
* One turn's per-message effort state (#6895). Spread copies of the parsed request share it, so a
|
|
576
|
+
* rebuild of the same turn is seen as a second build.
|
|
577
|
+
*/
|
|
578
|
+
export interface PerMessageEffortTurn {
|
|
579
|
+
/** The pending decision this turn owns, until it commits or is abandoned. */
|
|
580
|
+
token?: string;
|
|
581
|
+
generation: string;
|
|
582
|
+
builds: number;
|
|
583
|
+
}
|
|
584
|
+
|
|
566
585
|
/**
|
|
567
586
|
* Canonical usage convention (devlog/260711_claude_inbound/070):
|
|
568
587
|
* - `inputTokens` is the TOTAL prompt size, INCLUDING cache reads and cache writes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator defaults for routed Codex catalog rows (#6872), stored as top-level
|
|
3
|
+
* `routedCatalogDefaults` in config.json. Every field is optional: omission keeps the derived
|
|
4
|
+
* value and explicit `false` stays `false`. Concrete provider/model declarations still win, and
|
|
5
|
+
* a row without verbosity support never carries `default_verbosity`. Validation lives in
|
|
6
|
+
* src/config/schema/routed-catalog-defaults.ts; derivation in src/codex/catalog/routed-defaults.ts.
|
|
7
|
+
*/
|
|
8
|
+
export interface OcxRoutedCatalogDefaultsConfig {
|
|
9
|
+
/** Serialized as `include_skills_usage_instructions`. */
|
|
10
|
+
includeSkillsUsageInstructions?: boolean;
|
|
11
|
+
/** Serialized as `include_apps_usage_instructions`. */
|
|
12
|
+
includeAppsUsageInstructions?: boolean;
|
|
13
|
+
/** Serialized as `include_plugin_usage_instructions`. */
|
|
14
|
+
includePluginUsageInstructions?: boolean;
|
|
15
|
+
/** Serialized as `default_verbosity`; applies only to rows that support verbosity, and never turns support on. */
|
|
16
|
+
defaultVerbosity?: "low" | "medium" | "high";
|
|
17
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** Routing-profile configuration types (`routingProfiles` in config.json). */
|
|
2
|
+
|
|
3
|
+
export type OcxRoutingUnknownEvidenceMode = "allow" | "penalize" | "exclude";
|
|
4
|
+
|
|
5
|
+
export interface OcxRoutingProfileCandidate {
|
|
6
|
+
provider: string;
|
|
7
|
+
model: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface OcxRoutingProfileRequirements {
|
|
11
|
+
/** Minimum model context window in tokens. */
|
|
12
|
+
minContextWindow?: number;
|
|
13
|
+
/** Minimum remaining quota headroom fraction (0..1). */
|
|
14
|
+
minQuotaHeadroom?: number;
|
|
15
|
+
tools?: boolean;
|
|
16
|
+
imageInput?: boolean;
|
|
17
|
+
structuredOutput?: boolean;
|
|
18
|
+
reasoningEffort?: string;
|
|
19
|
+
serviceTier?: string;
|
|
20
|
+
localOnly?: boolean;
|
|
21
|
+
remoteAllowed?: boolean;
|
|
22
|
+
/** Special encrypted Codex task readability (ChatGPT forward pool). */
|
|
23
|
+
encryptedCodexTasks?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface OcxRoutingProfileOptimize {
|
|
27
|
+
latency?: number;
|
|
28
|
+
health?: number;
|
|
29
|
+
cost?: number;
|
|
30
|
+
quota?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Policy for the hard cost ceiling when a candidate has no finite cost
|
|
35
|
+
* estimate. `"allow"` (default) preserves the documented dry-run contract:
|
|
36
|
+
* the cap only excludes evidence known to exceed it, and the candidate's
|
|
37
|
+
* `cost.capOutcome` is `"unknown-allowed"`. `"exclude"` makes the ceiling
|
|
38
|
+
* fail-closed (`cost-limit-unknown` + `capOutcome: "unknown-excluded"`).
|
|
39
|
+
*/
|
|
40
|
+
export type OcxRoutingUnknownCostCapMode = "allow" | "exclude";
|
|
41
|
+
|
|
42
|
+
export interface OcxRoutingProfileLimits {
|
|
43
|
+
/** Hard per-request estimated-cost ceiling in USD. */
|
|
44
|
+
maxEstimatedCostUsd?: number;
|
|
45
|
+
/**
|
|
46
|
+
* How `maxEstimatedCostUsd` behaves when the estimate is unknown.
|
|
47
|
+
* Defaults to `"allow"` (eligible + `cost.capOutcome: "unknown-allowed"`);
|
|
48
|
+
* opt in to `"exclude"` for a true hard ceiling.
|
|
49
|
+
*/
|
|
50
|
+
onUnknownCost?: OcxRoutingUnknownCostCapMode;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface OcxRoutingProfileUnknownEvidence {
|
|
54
|
+
capability?: OcxRoutingUnknownEvidenceMode;
|
|
55
|
+
health?: OcxRoutingUnknownEvidenceMode;
|
|
56
|
+
quota?: OcxRoutingUnknownEvidenceMode;
|
|
57
|
+
cost?: OcxRoutingUnknownEvidenceMode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface OcxRoutingProfileCompatibilitySuite {
|
|
61
|
+
suiteId: string;
|
|
62
|
+
evidenceLayer: "protocol_conformance" | "live_route_compatibility";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface OcxRoutingProfileCompatibility {
|
|
66
|
+
requiredSuites?: OcxRoutingProfileCompatibilitySuite[];
|
|
67
|
+
minStatus?: "PROBED" | "VERIFIED";
|
|
68
|
+
maxEvidenceAgeMs?: number;
|
|
69
|
+
unknownEvidence?: OcxRoutingUnknownEvidenceMode;
|
|
70
|
+
degradedEvidence?: OcxRoutingUnknownEvidenceMode;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface OcxRoutingProfileConfig {
|
|
74
|
+
/**
|
|
75
|
+
* Explicit candidate allowlist (`provider/model` refs). No implicit
|
|
76
|
+
* expansion in v1.
|
|
77
|
+
*/
|
|
78
|
+
candidates: OcxRoutingProfileCandidate[];
|
|
79
|
+
/** Optional public model name replacing the default `policy/<id>` slug. */
|
|
80
|
+
alias?: string;
|
|
81
|
+
/** Hard requirements evaluated before scoring. */
|
|
82
|
+
require?: OcxRoutingProfileRequirements;
|
|
83
|
+
/** Optimization weights; normalized deterministically. */
|
|
84
|
+
optimize?: OcxRoutingProfileOptimize;
|
|
85
|
+
limits?: OcxRoutingProfileLimits;
|
|
86
|
+
/** How unknown evidence is handled per dimension. */
|
|
87
|
+
unknownEvidence?: OcxRoutingProfileUnknownEvidence;
|
|
88
|
+
/** Optional Compatibility Lab policy (CL-06). */
|
|
89
|
+
compatibility?: OcxRoutingProfileCompatibility;
|
|
90
|
+
}
|
package/src/types.ts
CHANGED
package/src/update/index.ts
CHANGED
|
@@ -76,7 +76,7 @@ export const PKG = "@bitkyc08/opencodex";
|
|
|
76
76
|
const HERE = dirname(fileURLToPath(import.meta.url)); // .../opencodex/src/update
|
|
77
77
|
|
|
78
78
|
export type Installer = DetectedInstall | "standalone";
|
|
79
|
-
export const STANDALONE_UPDATE_HINT = "Update via OpenCodex Desktop (Check for Updates…) or reinstall the standalone binary from GitHub Releases.";
|
|
79
|
+
export const STANDALONE_UPDATE_HINT = "Update via OpenCodex Desktop (Check for Updates…), on a Windows Desktop installation from a terminal or remote session with 'ocx update --desktop', or reinstall the standalone binary from GitHub Releases.";
|
|
80
80
|
export type Channel = "latest" | "preview";
|
|
81
81
|
export type InstallOwnership = PackageInstallOwnership | { installer: "standalone" };
|
|
82
82
|
export type { MiseInstallOwner };
|