@bitkyc08/opencodex 2.94.0 → 2.95.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gui/dist/assets/App-8yedBkhm.js +58 -0
- package/gui/dist/assets/App-B4j-Txmb.css +1 -0
- package/gui/dist/assets/{Tray-CZatQdoF.js → Tray-erSMzxPG.js} +1 -1
- package/gui/dist/assets/index-D7DCm5eQ.js +94 -0
- package/gui/dist/assets/quota-summary-BK4VuQNc.js +1 -0
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapters/anthropic.ts +10 -3
- package/src/adapters/command-code-project-context.ts +3 -3
- package/src/adapters/kiro/adapter.ts +4 -1
- package/src/adapters/kiro/stream.ts +1 -0
- package/src/adapters/kiro-events.ts +1 -0
- package/src/adapters/openai-chat/messages.ts +20 -7
- package/src/adapters/openai-chat/passthrough.ts +4 -2
- package/src/adapters/openai-chat/single-system.ts +24 -0
- package/src/adapters/openai-responses/muse-tool-catalog.ts +87 -0
- package/src/adapters/openai-responses/passthrough.ts +42 -7
- package/src/adapters/openai-responses/prompt-cache.ts +3 -1
- package/src/adapters/openai-responses/request-strips.ts +23 -4
- package/src/adapters/openai-responses/tool-output-recovery.ts +21 -8
- package/src/adapters/openai-responses/tool-schema.ts +20 -8
- package/src/adapters/opencode-go-additional-tools.ts +39 -6
- package/src/adapters/routed-agent-messages.ts +3 -0
- package/src/adapters/xai-web-search.ts +6 -3
- package/src/adapters/zed-additional-tools.ts +7 -7
- package/src/adapters/zed.ts +1 -6
- package/src/advisor/consult.ts +22 -10
- package/src/advisor/runtime.ts +10 -4
- package/src/bridge/max-output-completion.ts +41 -0
- package/src/bridge/response-json.ts +9 -4
- package/src/bridge/sse.ts +13 -2
- package/src/chatgpt/app-server-shim/bundle-trust-policy.ts +5 -0
- package/src/chatgpt/app-server-shim/launcher.ts +40 -6
- package/src/claude/compatibility.ts +5 -1
- package/src/claude/desktop-3p.ts +27 -6
- package/src/claude/desktop-model-visibility.ts +141 -0
- package/src/claude/desktop-remote-store-io.ts +8 -8
- package/src/claude/inbound-content-options.ts +11 -1
- package/src/claude/intercept/proxy-auth.ts +16 -16
- package/src/cli/account-main.ts +3 -2
- package/src/cli/capabilities-provider-models.ts +7 -0
- package/src/cli/chatgpt-command.ts +1 -1
- package/src/cli/codex-launcher.ts +20 -8
- package/src/cli/codex-shim-autorestore.ts +19 -1
- package/src/cli/dispatch.ts +6 -6
- package/src/cli/doctor.ts +5 -5
- package/src/cli/index.ts +4 -9
- package/src/cli/init.ts +2 -2
- package/src/cli/internal-command.ts +29 -2
- package/src/cli/provider-cc-switch-import.ts +185 -0
- package/src/cli/provider.ts +5 -0
- package/src/cli/registry.ts +1 -0
- package/src/cli/restart-scope.ts +2 -2
- package/src/cli/root.ts +6 -6
- package/src/cli/stop-approval.ts +15 -1
- package/src/cli/v2.ts +69 -19
- package/src/client/machine-api.ts +2 -2
- package/src/clients/config-export.ts +14 -3
- package/src/codex/account-cooldown-response.ts +18 -0
- package/src/codex/app-server-restart-service.ts +2 -2
- package/src/codex/auth-api/login-flow.ts +2 -2
- package/src/codex/auth-api/pool-quota-probe.ts +2 -2
- package/src/codex/auth-context.ts +4 -4
- package/src/codex/catalog/bundled.ts +10 -3
- package/src/codex/catalog/metadata.ts +4 -5
- package/src/codex/catalog/native-omission.ts +28 -0
- package/src/codex/catalog/native-template.ts +58 -0
- package/src/codex/catalog/parsing.ts +3 -29
- package/src/codex/catalog/provider-models.ts +2 -1
- package/src/codex/catalog/retained-sync.ts +15 -5
- package/src/codex/catalog/write-audit.ts +18 -18
- package/src/codex/cli-install-provenance.ts +46 -45
- package/src/codex/cli-update-artifacts.ts +8 -6
- package/src/codex/cli-update-job-store-windows.ts +99 -27
- package/src/codex/cli-update-job-worker.ts +3 -11
- package/src/codex/cli-update-recovery.ts +54 -8
- package/src/codex/cli-update-selection-gate.ts +74 -4
- package/src/codex/cli-windows-plan-provenance.ts +37 -19
- package/src/codex/codex-home-owner.ts +9 -8
- package/src/codex/convergence.ts +13 -3
- package/src/codex/coordinator-doctor.ts +14 -8
- package/src/codex/desktop-app/handoff.ts +1 -1
- package/src/codex/desktop-app-restart.ts +11 -1
- package/src/codex/exec-boundary.ts +26 -5
- package/src/codex/history-provider.ts +11 -10
- package/src/codex/inject/bounded-config-reader.ts +14 -13
- package/src/codex/main-account.ts +6 -6
- package/src/codex/native-main-lock-file.ts +13 -12
- package/src/codex/native-residue.ts +18 -14
- package/src/codex/orca-auth-source.ts +8 -7
- package/src/codex/quota-types.ts +5 -0
- package/src/codex/quota.ts +49 -7
- package/src/codex/role-auto-assign.ts +50 -26
- package/src/codex/role-capability.ts +160 -0
- package/src/codex/role-sizing.ts +24 -6
- package/src/codex/routing/cooldown-math.ts +3 -2
- package/src/codex/runtime.ts +43 -3
- package/src/codex/shim-fingerprint.ts +11 -9
- package/src/codex/shim-inspect.ts +3 -2
- package/src/codex/shim-restore-lock.ts +11 -14
- package/src/codex/shim-state-file.ts +22 -14
- package/src/codex/shim-wrapper-write.ts +7 -6
- package/src/codex/shim.ts +25 -2
- package/src/codex/transition-state.ts +5 -4
- package/src/combos/failover.ts +43 -4
- package/src/config/atomic-write.ts +38 -7
- package/src/config/diagnostics.ts +3 -0
- package/src/config/initialize.ts +6 -6
- package/src/config/load-degrade.ts +2 -0
- package/src/config/process-state.ts +23 -5
- package/src/config/salvage.ts +1 -0
- package/src/config/schema/config-schema.ts +29 -1
- package/src/config/schema/leaf-validators.ts +7 -0
- package/src/config/schema/workflow-budget.ts +43 -0
- package/src/config/tracked-runtime-inspection.ts +188 -0
- package/src/generated/compatibility-version.json +313 -213
- package/src/integrations/aside-profile-context.ts +1 -1
- package/src/integrations/droid-settings.ts +4 -4
- package/src/integrations/hermes-profiles.ts +3 -3
- package/src/lib/bounded-file-read.ts +3 -9
- package/src/lib/bun-runtime-preflight.ts +9 -8
- package/src/lib/file-identity.ts +15 -0
- package/src/lib/local-chat-completion.ts +8 -6
- package/src/lib/local-destinations.ts +32 -3
- package/src/lib/redact-folding.ts +9 -0
- package/src/lib/spend-pool-alias-validation.ts +6 -6
- package/src/lib/state-store-registrations.ts +2 -0
- package/src/lib/test-home-guard.ts +37 -9
- package/src/lib/windows-secret-acl.ts +47 -29
- package/src/lib/workflow-budget-config.ts +39 -0
- package/src/local-credentials/generation.ts +6 -2
- package/src/local-credentials/inventory.ts +132 -8
- package/src/messaging/remote-forward-failure.ts +35 -0
- package/src/messaging/remote-ports.ts +27 -5
- package/src/messaging/remote-process.ts +30 -4
- package/src/messaging/remote-tunnels.ts +80 -15
- package/src/oauth/antigravity-discovery-diagnostics.ts +65 -0
- package/src/oauth/google-antigravity.ts +23 -10
- package/src/oauth/index.ts +2 -0
- package/src/oauth/kiro-device-login.ts +87 -30
- package/src/oauth/kiro-iam-identity-center.ts +107 -0
- package/src/oauth/store.ts +9 -7
- package/src/providers/account-quota-disk.ts +18 -4
- package/src/providers/cc-switch-import-bytes.ts +991 -0
- package/src/providers/cc-switch-import-source.ts +1083 -0
- package/src/providers/cc-switch-import.ts +942 -0
- package/src/providers/derive.ts +6 -0
- package/src/providers/model-discovery-diagnostic.ts +4 -0
- package/src/providers/model-discovery.ts +4 -4
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/model-rename-migration.ts +41 -6
- package/src/providers/quota/report-cache.ts +17 -4
- package/src/providers/quota.ts +2 -2
- package/src/providers/reasoning-metadata.ts +31 -15
- package/src/providers/registry/entries-core.ts +1 -1
- package/src/providers/registry/entries-extended.ts +1 -1
- package/src/providers/registry/model-ids.ts +1 -0
- package/src/providers/registry/model-seeds.ts +2 -1
- package/src/providers/registry/types.ts +3 -1
- package/src/providers/resolved-model-policy.ts +2 -2
- package/src/providers/routed-config.ts +2 -0
- package/src/providers/stale-model-roster-migration.ts +5 -1
- package/src/providers/xai-transport.ts +4 -4
- package/src/remote-control/workspace-codex-runtime.ts +2 -2
- package/src/remote-control/workspace-executor.ts +14 -13
- package/src/responses/custom-tool-compat.ts +2 -1
- package/src/responses/item-provenance.ts +79 -0
- package/src/responses/namespace-tool-compat.ts +21 -3
- package/src/router.ts +21 -2
- package/src/routing/analytics.ts +3 -5
- package/src/routing/fallback-policy.ts +7 -3
- package/src/routing/health.ts +5 -3
- package/src/routing/history/build-file.ts +6 -0
- package/src/routing/history/indexer.ts +158 -31
- package/src/routing/history/ingest.ts +1 -1
- package/src/routing/history/integrity.ts +208 -0
- package/src/routing/history/rebuild-job.ts +20 -6
- package/src/routing/history/rebuild-protocol.ts +2 -1
- package/src/routing/history/rebuild-worker.ts +18 -0
- package/src/routing/history/sqlite-errors.ts +9 -0
- package/src/server/admission-model-scope.ts +21 -4
- package/src/server/advisor-admission-scope.ts +29 -0
- package/src/server/auth-cors.ts +5 -2
- package/src/server/capture-admission-policy.ts +91 -0
- package/src/server/chat-completions.ts +33 -7
- package/src/server/claude-messages.ts +90 -2
- package/src/server/codex-model-list.ts +2 -1
- package/src/server/configured-credentials.ts +5 -0
- package/src/server/index/serve-options.ts +12 -2
- package/src/server/index/websocket-handler.ts +3 -0
- package/src/server/management/agent-settings-routes.ts +34 -9
- package/src/server/management/codex-agent-role-routes.ts +1 -0
- package/src/server/management/codex-role-auto-assign.ts +50 -6
- package/src/server/management/config-routes.ts +15 -4
- package/src/server/management/context.ts +3 -0
- package/src/server/management/native-integration-routes.ts +22 -0
- package/src/server/management/oauth-account-routes.ts +20 -4
- package/src/server/management/provider-overwrite-carry.ts +21 -0
- package/src/server/management/provider-routes.ts +3 -1
- package/src/server/management/route-registry.ts +2 -0
- package/src/server/management/shared.ts +17 -1
- package/src/server/management/workflow-budget-routes.ts +70 -3
- package/src/server/messages-native-eligibility.ts +6 -5
- package/src/server/messages-native-scope.ts +6 -1
- package/src/server/messages-shared.ts +57 -17
- package/src/server/persistent-gui-session.ts +4 -4
- package/src/server/request-log.ts +30 -2
- package/src/server/responses/adapter-delivery.ts +4 -0
- package/src/server/responses/advisor-plan-slot.ts +4 -0
- package/src/server/responses/advisor-slot.ts +73 -46
- package/src/server/responses/codex-auth-error.ts +5 -1
- package/src/server/responses/combo-required-tool-contract.ts +27 -0
- package/src/server/responses/compact.ts +4 -1
- package/src/server/responses/core-combo-failure.ts +2 -0
- package/src/server/responses/core-combo.ts +66 -5
- package/src/server/responses/core-lifetime.ts +4 -0
- package/src/server/responses/core-options.ts +9 -0
- package/src/server/responses/core.ts +2 -0
- package/src/server/responses/jev-model-invoke.ts +4 -2
- package/src/server/responses/passthrough-dispatch.ts +5 -4
- package/src/server/responses/policy-fallback.ts +2 -0
- package/src/server/responses/request-prepare.ts +4 -5
- package/src/server/responses/request-send-budget.ts +2 -1
- package/src/server/responses/request-sidecar-auth.ts +1 -0
- package/src/server/responses/request-transport.ts +2 -3
- package/src/server/responses/run-turn-execution.ts +4 -0
- package/src/server/responses/sidecar-execution.ts +21 -5
- package/src/server/responses-snapshot-repair.ts +18 -4
- package/src/server/responses-undeclared-tool-guard.ts +4 -0
- package/src/server/workflow-refusal.ts +2 -1
- package/src/service/state-lock.ts +12 -11
- package/src/service-manager-probe.ts +53 -8
- package/src/types/admission-policy.ts +13 -0
- package/src/types/config.ts +25 -0
- package/src/types/provider.ts +10 -0
- package/src/types/request.ts +7 -0
- package/src/types.ts +1 -0
- package/src/update/job.ts +20 -0
- package/src/update/worker-launch.ts +71 -1
- package/src/usage/log.ts +25 -4
- package/src/vision/index.ts +2 -0
- package/src/vision/plan.ts +4 -0
- package/src/vision/routed-describe.ts +38 -23
- package/src/web-search/loop.ts +104 -9
- package/src/web-search/parse.ts +10 -2
- package/gui/dist/assets/App-DMps4OLk.css +0 -1
- package/gui/dist/assets/App-DmvwlhQq.js +0 -58
- package/gui/dist/assets/index-3EPO_KbX.js +0 -94
- package/gui/dist/assets/quota-summary-BHvWg9mi.js +0 -1
|
@@ -3,6 +3,7 @@ import { NativeInjectionChannel } from "../responses/native-injection";
|
|
|
3
3
|
import { NativeSteeringChannel, NativeSteeringError } from "../responses/native-steering";
|
|
4
4
|
import { createNativeSteeringLogObserver } from "../responses/native-steering-log";
|
|
5
5
|
import { reasoningArchiveErrorResponse } from "../responses/reasoning-archive-error";
|
|
6
|
+
import { captureAdmissionPolicy } from "../capture-admission-policy";
|
|
6
7
|
import type { Server, ServerWebSocket } from "bun";
|
|
7
8
|
import {
|
|
8
9
|
LIVE_SIDEBAND_UPSTREAM_OPEN_TIMEOUT_MS,
|
|
@@ -303,6 +304,7 @@ export function createWebsocketHandler(
|
|
|
303
304
|
}
|
|
304
305
|
|
|
305
306
|
// Only a genuinely admitted turn may receive steering or continuations.
|
|
307
|
+
const advisorAdmissionPolicy = captureAdmissionPolicy(config, ws.data.admission);
|
|
306
308
|
const finishActivity = ws.data.responsesActivity?.beginTurn(frame.input);
|
|
307
309
|
ws.data.nativeControl = nativeControl;
|
|
308
310
|
const payload: Record<string, unknown> = { ...frame };
|
|
@@ -343,6 +345,7 @@ export function createWebsocketHandler(
|
|
|
343
345
|
try {
|
|
344
346
|
let terminalRecorder: ((status: ResponsesTerminalStatus, httpStatusOverride?: number) => void) | undefined;
|
|
345
347
|
const response = await handleResponses(req, config, logCtx, {
|
|
348
|
+
advisorAdmissionPolicy,
|
|
346
349
|
...(wsAdmission ? { admission: wsAdmission } : {}),
|
|
347
350
|
forceEmptyResponseId: true,
|
|
348
351
|
inboundTransport: "websocket",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { prepareClaudeCodePatch } from "./claude-code-settings-patch";
|
|
2
|
+
import { beginCodexCliSelectionParentWriteAsync, withCodexCliSelectionParentWriteAsync,
|
|
3
|
+
CodexCliSelectionMutationBusyError, type CodexCliSelectionAsyncParentWrite } from "../../codex/cli-update-selection-gate";
|
|
2
4
|
import { readConfigForAdmittedMutation } from "../../config/persisted-mutation";
|
|
3
5
|
import { mirrorDesiredEnabledOntoSnapshot, persistDesktopModeField, persistDesktopProfileField } from "./claude-desktop-config-writers";
|
|
4
6
|
import { getConfigDir as configRoot, withConfigDirHardeningSettled as settleConfigRoot } from "../../config/paths";
|
|
@@ -205,6 +207,7 @@ export async function injectionModelView(config: OcxConfig, routed: readonly Cat
|
|
|
205
207
|
export async function handleAgentSettingsRoutes(ctx: ManagementContext): Promise<Response | null> {
|
|
206
208
|
try { return await handleAgentSettingsRoutesImpl(ctx); }
|
|
207
209
|
catch (error) {
|
|
210
|
+
if (error instanceof CodexCliSelectionMutationBusyError) return jsonResponse({ error: error.message, retryable: true }, 503);
|
|
208
211
|
if (!(error instanceof WindowsSecretAclSettleTimeoutError)) throw error;
|
|
209
212
|
return jsonResponse({ error: "Could not save settings", code: "write_failed", diagnostic: { stage: "ca", cause: "ETIMEDOUT" } }, 500);
|
|
210
213
|
}
|
|
@@ -402,10 +405,8 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
402
405
|
// repeats this check, but doing it here prevents an earlier flag/mode/agents
|
|
403
406
|
// write from landing before an unsupported runtime returns 502.
|
|
404
407
|
if (wantsModeHintText && body.multiAgentModeHintText !== null
|
|
405
|
-
&& probeCodexSupportsModeHint
|
|
406
|
-
return jsonResponse({
|
|
407
|
-
error: `writing multiAgentModeHintText failed: ${MODE_HINT_UNSUPPORTED_ERROR}`,
|
|
408
|
-
}, 502);
|
|
408
|
+
&& await withCodexCliSelectionParentWriteAsync(probeCodexSupportsModeHint, { signal: req.signal }) === false) {
|
|
409
|
+
return jsonResponse({ error: `writing multiAgentModeHintText failed: ${MODE_HINT_UNSUPPORTED_ERROR}` }, 502);
|
|
409
410
|
}
|
|
410
411
|
const warnings: string[] = [];
|
|
411
412
|
let requestedFlag: boolean | undefined;
|
|
@@ -428,8 +429,13 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
428
429
|
return jsonResponse({ error: configWriteLockFailureMessage(configWriteLock), retryable: configWriteLock.error === "locked" }, 502);
|
|
429
430
|
}
|
|
430
431
|
const heldWriteLock = configWriteLock !== null && configWriteLock.ok ? configWriteLock.handle : undefined;
|
|
432
|
+
let selectionWrite: CodexCliSelectionAsyncParentWrite | undefined;
|
|
431
433
|
try {
|
|
432
|
-
|
|
434
|
+
if (wantsFlag || wantsMode || wantsThreads || wantsKeepNative || (wantsModeHintText && body.multiAgentModeHintText !== null)) {
|
|
435
|
+
selectionWrite = await beginCodexCliSelectionParentWriteAsync({ signal: req.signal });
|
|
436
|
+
if (!selectionWrite.entered) return jsonResponse({ error: "codex_cli_selection_busy", retryable: true }, 503);
|
|
437
|
+
}
|
|
438
|
+
const commit = () => {
|
|
433
439
|
const currentPlan = readModePlan();
|
|
434
440
|
if (currentPlan instanceof Response) return currentPlan;
|
|
435
441
|
const { effectiveMode } = currentPlan;
|
|
@@ -497,9 +503,11 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
497
503
|
}
|
|
498
504
|
}
|
|
499
505
|
return null;
|
|
500
|
-
}
|
|
506
|
+
};
|
|
507
|
+
const writeRefusal = await settleConfigRoot(configRoot(), () => selectionWrite ? selectionWrite.commit(commit) : commit());
|
|
501
508
|
if (writeRefusal) return writeRefusal;
|
|
502
509
|
} finally {
|
|
510
|
+
selectionWrite?.exit();
|
|
503
511
|
if (heldWriteLock) releaseConfigWriteLock(heldWriteLock);
|
|
504
512
|
}
|
|
505
513
|
// Derived from fresh post-write readers (readConfigText is uncached): upstream
|
|
@@ -558,9 +566,9 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
558
566
|
let toggle = deps.toggleDefaultModeRequestUserInput;
|
|
559
567
|
if (!toggle) {
|
|
560
568
|
try {
|
|
561
|
-
const {
|
|
569
|
+
const { codexFeaturesInvocationAsync, runCodexFeaturesCommand } = await import("../../cli/v2");
|
|
562
570
|
const action = body.enabled ? "enable" : "disable";
|
|
563
|
-
const invocation =
|
|
571
|
+
const invocation = await codexFeaturesInvocationAsync(action, DEFAULT_MODE_REQUEST_USER_INPUT_FEATURE_KEY, process.platform, { requireAvailable: true });
|
|
564
572
|
toggle = (_enabled, env, validate) => runCodexFeaturesCommand(action, DEFAULT_MODE_REQUEST_USER_INPUT_FEATURE_KEY, env, validate, invocation);
|
|
565
573
|
} catch (error) {
|
|
566
574
|
return jsonResponse({ error: `default_mode_request_user_input toggle failed: ${error instanceof Error ? error.message : String(error)}` }, 502);
|
|
@@ -972,13 +980,19 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
972
980
|
}
|
|
973
981
|
}
|
|
974
982
|
if (url.pathname === "/api/claude-desktop" && req.method === "PUT") {
|
|
975
|
-
let body: { profile?: unknown };
|
|
983
|
+
let body: { profile?: unknown; visibility?: unknown };
|
|
976
984
|
try { body = await readManagementJsonBody(req); } catch (error) { rethrowManagementBodyTooLarge(error); return jsonResponse({ error: "invalid JSON body" }, 400); }
|
|
977
985
|
try {
|
|
978
986
|
const { parseDesktopProfile, preserveDesktopAppliedState, reconcileDesktopProfile, sameProfileContent } = await import("../../claude/desktop-profile");
|
|
979
987
|
const parsed = parseDesktopProfile(body.profile);
|
|
980
988
|
const initial = loadConfig();
|
|
981
989
|
const current = await buildClaudeDesktopState(initial);
|
|
990
|
+
// #7702: absent keeps the stored selection, null clears it (list every model).
|
|
991
|
+
const { parseDesktopModelVisibility, desktopRouteVisible, readDesktopModelVisibility, sameDesktopModelVisibility } = await import("../../claude/desktop-model-visibility");
|
|
992
|
+
const visibility = body.visibility === undefined || body.visibility === null ? body.visibility : parseDesktopModelVisibility(body.visibility);
|
|
993
|
+
if (visibility && !current.models.some(model => model.available && desktopRouteVisible(visibility, model.route))) {
|
|
994
|
+
throw new Error("Claude Desktop needs at least one visible available model");
|
|
995
|
+
}
|
|
982
996
|
const availableRoutes = new Set(current.models.filter(item => item.available).map(item => item.route));
|
|
983
997
|
for (const route of Object.keys(parsed.assignments)) {
|
|
984
998
|
if (!current.profile.assignments[route] && !availableRoutes.has(route)) {
|
|
@@ -1012,10 +1026,15 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
1012
1026
|
|| (latest && expectedProfile && !sameProfileContent(latest, expectedProfile))) {
|
|
1013
1027
|
return { changed: false, value: null };
|
|
1014
1028
|
}
|
|
1029
|
+
if (visibility !== undefined && !sameDesktopModelVisibility(
|
|
1030
|
+
readDesktopModelVisibility(persisted.claudeCode), readDesktopModelVisibility(initial.claudeCode),
|
|
1031
|
+
)) return { changed: false, value: null };
|
|
1015
1032
|
persisted.claudeCode = {
|
|
1016
1033
|
...(persisted.claudeCode ?? {}),
|
|
1017
1034
|
desktopProfile: preserveDesktopAppliedState(latest ?? current.profile, rebuilt),
|
|
1018
1035
|
};
|
|
1036
|
+
if (visibility) persisted.claudeCode.desktopModelVisibility = visibility;
|
|
1037
|
+
else if (visibility === null) delete persisted.claudeCode.desktopModelVisibility;
|
|
1019
1038
|
return { changed: true, value: structuredClone(persisted.claudeCode) };
|
|
1020
1039
|
});
|
|
1021
1040
|
if (outcome.status !== "unavailable" && outcome.value !== null) {
|
|
@@ -1028,6 +1047,10 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
1028
1047
|
desktopProfile: structuredClone(outcome.value.desktopProfile),
|
|
1029
1048
|
};
|
|
1030
1049
|
}
|
|
1050
|
+
if (visibility !== undefined && config.claudeCode) {
|
|
1051
|
+
if (outcome.value?.desktopModelVisibility) config.claudeCode.desktopModelVisibility = structuredClone(outcome.value.desktopModelVisibility);
|
|
1052
|
+
else delete config.claudeCode.desktopModelVisibility;
|
|
1053
|
+
}
|
|
1031
1054
|
}
|
|
1032
1055
|
return outcome;
|
|
1033
1056
|
});
|
|
@@ -1383,6 +1406,8 @@ async function handleAgentSettingsRoutesImpl(ctx: ManagementContext): Promise<Re
|
|
|
1383
1406
|
savedFingerprint,
|
|
1384
1407
|
onDiskFingerprint: observed.fingerprint ?? null,
|
|
1385
1408
|
configPath: observed.selectedProfilePath,
|
|
1409
|
+
// The list Desktop runs now (#7702), so the dashboard can count and diff against it.
|
|
1410
|
+
appliedModels: gatewayApplied ? (await import("../../claude/desktop-model-visibility")).readAppliedDesktopModels(observed.selectedProfilePath) : null,
|
|
1386
1411
|
stale,
|
|
1387
1412
|
// Tri-state by ID match, independent of profile health: null =
|
|
1388
1413
|
// undeterminable (no/unreadable metadata or no appliedId); a readable
|
|
@@ -82,6 +82,7 @@ export async function handleCodexAgentRoleRoutes(ctx: ManagementContext): Promis
|
|
|
82
82
|
...(typeof body?.model === "string" ? { sizingModel: body.model } : {}),
|
|
83
83
|
fetchAllModels: deps.fetchAllModels ?? fetchAllModels,
|
|
84
84
|
...(deps.completeCodexRoleSizing ? { completeRoleSizing: deps.completeCodexRoleSizing } : {}),
|
|
85
|
+
...(deps.loadCodexRoleCapability ? { loadCapability: deps.loadCodexRoleCapability } : {}),
|
|
85
86
|
}), 200, req, config);
|
|
86
87
|
} catch (error) {
|
|
87
88
|
if (error instanceof NoSizingModelError) {
|
|
@@ -9,6 +9,8 @@ import { join } from "node:path";
|
|
|
9
9
|
import type { OcxConfig } from "../../types";
|
|
10
10
|
import type { CatalogModel } from "../../codex/catalog";
|
|
11
11
|
import type { RoleModelCandidate } from "../../codex/role-auto-assign";
|
|
12
|
+
import type { LoadCapability } from "../../codex/role-capability";
|
|
13
|
+
import type { SizingDomain } from "../../codex/role-sizing";
|
|
12
14
|
|
|
13
15
|
export interface RoleSizingCall {
|
|
14
16
|
readonly model: string;
|
|
@@ -118,11 +120,13 @@ export async function proposeCodexRoleModels(options: {
|
|
|
118
120
|
sizingModel?: string;
|
|
119
121
|
fetchAllModels: (config: OcxConfig) => Promise<CatalogModel[]>;
|
|
120
122
|
completeRoleSizing?: CompleteRoleSizing;
|
|
123
|
+
loadCapability?: LoadCapability;
|
|
121
124
|
}) {
|
|
122
|
-
const [roles, sizing, assign, { readConfiguredDefaultModel }] = await Promise.all([
|
|
125
|
+
const [roles, sizing, assign, capability, { readConfiguredDefaultModel }] = await Promise.all([
|
|
123
126
|
import("../../codex/agent-role-models"),
|
|
124
127
|
import("../../codex/role-sizing"),
|
|
125
128
|
import("../../codex/role-auto-assign"),
|
|
129
|
+
import("../../codex/role-capability"),
|
|
126
130
|
import("../../codex/catalog/parsing"),
|
|
127
131
|
]);
|
|
128
132
|
const sizingModel = resolveSizingModel(options.sizingModel, readConfiguredDefaultModel);
|
|
@@ -159,15 +163,55 @@ export async function proposeCodexRoleModels(options: {
|
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
const candidates = await roleModelCandidates(options.config, await options.fetchAllModels(options.config));
|
|
167
|
+
const classified = assign.classifyRoleModelCandidates(candidates, options.config.codexRoleTiers);
|
|
168
|
+
// Measured capability is a better tier signal than price, and its absence is not an error: a
|
|
169
|
+
// failed read leaves every role on price rank and says so.
|
|
170
|
+
const domains = new Set([...outcomes.values()].flatMap(outcome => "sizing" in outcome ? [outcome.sizing.domain] : []));
|
|
171
|
+
let table: import("../../codex/role-capability").CapabilityTable | null = null;
|
|
172
|
+
let capabilityError: string | null = null;
|
|
173
|
+
if (domains.size > 0) {
|
|
174
|
+
try {
|
|
175
|
+
table = await (options.loadCapability ?? capability.loadCapabilityTable)(options.config);
|
|
176
|
+
} catch {
|
|
177
|
+
capabilityError = "the measured capability source could not be read";
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const classifiedByDomain = new Map<SizingDomain, ReturnType<typeof assign.classifyRoleModelCandidates>>();
|
|
181
|
+
for (const domain of domains) {
|
|
182
|
+
const scores = table?.domains[domain];
|
|
183
|
+
if (!scores) continue;
|
|
184
|
+
const measured = new Map(candidates.flatMap(candidate => {
|
|
185
|
+
const score = scores.get(capability.candidateModelKey(candidate.model));
|
|
186
|
+
return score === undefined ? [] : [[candidate.model, score] as const];
|
|
187
|
+
}));
|
|
188
|
+
classifiedByDomain.set(domain, assign.classifyRoleModelCandidates(candidates, options.config.codexRoleTiers, measured));
|
|
189
|
+
}
|
|
166
190
|
return {
|
|
167
191
|
sizingModel,
|
|
168
192
|
sizingError,
|
|
169
|
-
proposals: assign.buildRoleProposals(roleRows, outcomes, classified),
|
|
193
|
+
proposals: assign.buildRoleProposals(roleRows, outcomes, classified, classifiedByDomain),
|
|
170
194
|
candidates: classified.map(({ model, tier, tierSource, unitPrice }) => ({ model, tier, tierSource, unitPrice })),
|
|
195
|
+
capability: capabilityReport(table?.source ?? null, table, capabilityError, classifiedByDomain),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** The attribution and per-domain tiers; raw scores only from a source whose terms allow it. */
|
|
200
|
+
function capabilityReport(
|
|
201
|
+
source: import("../../codex/role-capability").CapabilitySource | null,
|
|
202
|
+
table: import("../../codex/role-capability").CapabilityTable | null,
|
|
203
|
+
error: string | null,
|
|
204
|
+
classifiedByDomain: ReadonlyMap<SizingDomain, ReturnType<typeof import("../../codex/role-auto-assign").classifyRoleModelCandidates>>,
|
|
205
|
+
) {
|
|
206
|
+
return {
|
|
207
|
+
name: source?.name ?? null,
|
|
208
|
+
url: source?.url ?? null,
|
|
209
|
+
license: source?.license ?? null,
|
|
210
|
+
publishedAt: table?.publishedAt ?? null,
|
|
211
|
+
error: error ?? table?.fallbackReason ?? null,
|
|
212
|
+
domains: Object.fromEntries([...classifiedByDomain].map(([domain, list]) => [domain,
|
|
213
|
+
list.filter(candidate => candidate.tierSource === "measured")
|
|
214
|
+
.map(({ model, tier, score }) => (source?.redistributable ? { model, tier, score } : { model, tier }))])),
|
|
171
215
|
};
|
|
172
216
|
}
|
|
173
217
|
|
|
@@ -972,11 +972,22 @@ async function handleConfigRoutesImpl(ctx: ManagementContext): Promise<Response
|
|
|
972
972
|
// Resolve the systemd-scope launcher before spawning: the first request
|
|
973
973
|
// would otherwise run up to four sequential five-second probes inside
|
|
974
974
|
// spawnSync on the shared event loop.
|
|
975
|
-
const { resolveSystemdRunAsync } = await import("../../update/worker-launch");
|
|
975
|
+
const { resolveSystemdRunAsync, dashboardRestartRefusal } = await import("../../update/worker-launch");
|
|
976
976
|
const systemdRun = process.platform === "linux" && process.env.INVOCATION_ID
|
|
977
977
|
? await resolveSystemdRunAsync()
|
|
978
978
|
: undefined;
|
|
979
|
-
|
|
979
|
+
const restart = body.restart !== false;
|
|
980
|
+
// Refuse before any package mutation, with or without restart: the update stops the proxy
|
|
981
|
+
// first, so a worker that dies with the service cgroup, or a restart aimed at a unit that
|
|
982
|
+
// does not own this proxy, leaves the dashboard down (#7967).
|
|
983
|
+
// Only an update that would actually run is refused; an unavailable update or a source
|
|
984
|
+
// checkout keeps its own refusal from startUpdateJob.
|
|
985
|
+
if (checked.canUpdate) {
|
|
986
|
+
const { TASK } = await import("../../service/state");
|
|
987
|
+
const refusal = (deps.dashboardRestartRefusal ?? dashboardRestartRefusal)({ systemdRun, unitName: TASK });
|
|
988
|
+
if (refusal) return jsonResponse({ error: refusal, code: "update_restart_unsupervised" }, 409);
|
|
989
|
+
}
|
|
990
|
+
return jsonResponse({ ok: true, job: startUpdateJob(channel, restart, {
|
|
980
991
|
checkForUpdateFn: () => checked,
|
|
981
992
|
spawnWorkerFn: (jobId, runChannel, runRestart) =>
|
|
982
993
|
spawnGuiUpdateWorker(jobId, runChannel, runRestart, { resolveSystemdRun: () => systemdRun }),
|
|
@@ -990,8 +1001,8 @@ async function handleConfigRoutesImpl(ctx: ManagementContext): Promise<Response
|
|
|
990
1001
|
}
|
|
991
1002
|
|
|
992
1003
|
if (url.pathname === "/api/update/status" && req.method === "GET") {
|
|
993
|
-
const {
|
|
994
|
-
const job =
|
|
1004
|
+
const { readUpdateJobForStatus } = await import("../../update/job");
|
|
1005
|
+
const job = readUpdateJobForStatus(url.searchParams.get("jobId"));
|
|
995
1006
|
if (!job) return jsonResponse({ error: "update job not found" }, 404);
|
|
996
1007
|
return jsonResponse({ ok: true, job });
|
|
997
1008
|
}
|
|
@@ -59,6 +59,8 @@ export interface ManagementApiDeps {
|
|
|
59
59
|
/** Read-only process-local aggregate metrics; absent keeps the scrape route unavailable. */
|
|
60
60
|
requestMetrics?: RequestMetricsSnapshotter;
|
|
61
61
|
checkPackageUpdate?: (channel: Channel) => Promise<UpdateCheckResult>;
|
|
62
|
+
/** Test seam for the dashboard restart supervisor check (src/update/worker-launch.ts). */
|
|
63
|
+
dashboardRestartRefusal?: typeof import("../../update/worker-launch").dashboardRestartRefusal;
|
|
62
64
|
remoteWorkspaceHub?: RemoteWorkspaceHubApi;
|
|
63
65
|
remoteWorkspaceSessions?: RemoteWorkspaceSessionsApi;
|
|
64
66
|
/** The listener retains and awaits teardown only after this optional subsystem activates. */
|
|
@@ -91,6 +93,7 @@ export interface ManagementApiDeps {
|
|
|
91
93
|
fetchAllModels?: (config: OcxConfig) => Promise<CatalogModel[]>;
|
|
92
94
|
/** Codex role auto-assign's one sizing model call; route tests answer it without a provider. */
|
|
93
95
|
completeCodexRoleSizing?: import("./codex-role-auto-assign").CompleteRoleSizing;
|
|
96
|
+
loadCodexRoleCapability?: import("../../codex/role-capability").LoadCapability;
|
|
94
97
|
/**
|
|
95
98
|
* Writer seam for the Grok toggle: lets a test place the file in any state
|
|
96
99
|
* between the pre-write recheck and the write itself (the r8 post-inspection
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readConfigForAdmittedMutation } from "../../config/persisted-mutation";
|
|
2
|
+
import { ConfigWritePublishedError } from "../../config/persist-unlocked";
|
|
2
3
|
import { getConfigDir as configRoot, withConfigDirHardeningSettled as settleConfigRoot } from "../../config/paths";
|
|
3
4
|
import { WindowsSecretAclSettleTimeoutError } from "../../lib/windows-secret-acl";
|
|
4
5
|
import { mirrorDesiredEnabledOntoSnapshot } from "./claude-desktop-config-writers";
|
|
@@ -949,6 +950,9 @@ export async function handleNativeIntegrationRoutes(ctx: ManagementContext): Pro
|
|
|
949
950
|
|
|
950
951
|
const enabled = body.enabled;
|
|
951
952
|
if (claudeCodeEnabled(config) === enabled) {
|
|
953
|
+
// Re-run the same reconcile on a repeated OFF: definitions left behind by an older
|
|
954
|
+
// version that never pruned on disable are removed the next time the user says off.
|
|
955
|
+
if (!enabled) await ctx.syncClaudeAgentDefsBestEffort?.();
|
|
952
956
|
return jsonResponse({
|
|
953
957
|
ok: true, clientId: "claude", changed: false,
|
|
954
958
|
state: enabled ? "current" : "absent",
|
|
@@ -963,6 +967,10 @@ export async function handleNativeIntegrationRoutes(ctx: ManagementContext): Pro
|
|
|
963
967
|
* sentinel the next startServer would silently convert a user's Auto auth mode into
|
|
964
968
|
* a sticky manual subscription — a failure that surfaces nowhere near this route.
|
|
965
969
|
*/
|
|
970
|
+
// Kept so a failed save leaves the shared in-memory config matching disk: otherwise a
|
|
971
|
+
// retry on the same object would read the unsaved value, take the repeated-OFF branch
|
|
972
|
+
// and prune agents while the persisted integration is still on.
|
|
973
|
+
const previousBlock = config.claudeCode === undefined ? undefined : structuredClone(config.claudeCode);
|
|
966
974
|
commitClaudeCodeBlock(config, { ...(config.claudeCode ?? {}), enabled });
|
|
967
975
|
|
|
968
976
|
/*
|
|
@@ -973,6 +981,11 @@ export async function handleNativeIntegrationRoutes(ctx: ManagementContext): Pro
|
|
|
973
981
|
try {
|
|
974
982
|
persist(config);
|
|
975
983
|
} catch (error) {
|
|
984
|
+
// A published write already put the new value on disk; only an unpublished one rolls back.
|
|
985
|
+
if (!(error instanceof ConfigWritePublishedError)) {
|
|
986
|
+
if (previousBlock === undefined) delete config.claudeCode;
|
|
987
|
+
else config.claudeCode = previousBlock;
|
|
988
|
+
}
|
|
976
989
|
if (isConfigLockError(error)) {
|
|
977
990
|
return isLockContention(error)
|
|
978
991
|
? refusal(409, "claude", "config_busy",
|
|
@@ -983,6 +996,15 @@ export async function handleNativeIntegrationRoutes(ctx: ManagementContext): Pro
|
|
|
983
996
|
throw error;
|
|
984
997
|
}
|
|
985
998
|
|
|
999
|
+
/*
|
|
1000
|
+
* The generated ~/.claude/agents/ocx-*.md definitions route through this proxy; a
|
|
1001
|
+
* native Claude Code session that still loads them after OFF follows their
|
|
1002
|
+
* placeholder model (issue #7968). Prune them now instead of waiting for a later
|
|
1003
|
+
* launch or startup sync; the disabled reconcile removes only marker-owned regular
|
|
1004
|
+
* files and needs no model discovery. ON keeps its existing launch/startup sync.
|
|
1005
|
+
*/
|
|
1006
|
+
if (!enabled) await ctx.syncClaudeAgentDefsBestEffort?.();
|
|
1007
|
+
|
|
986
1008
|
let interceptReason = enabled && interceptStartRefusal(ctx) ? "intercept_start_forbidden" : null;
|
|
987
1009
|
if (enabled && !interceptReason) {
|
|
988
1010
|
const outcome = await ensureManagementClaudeIntercept(ctx);
|
|
@@ -37,7 +37,8 @@ import {
|
|
|
37
37
|
waitForLoginSettled,
|
|
38
38
|
} from "../../oauth";
|
|
39
39
|
import { OAuthMutationBusyError, removeCredential } from "../../oauth/store";
|
|
40
|
-
import { cancelKiroDeviceLogin, kiroDeviceConfigBaseline, startKiroDeviceLogin, statusKiroDeviceLogin, type KiroDeviceMethod } from "../../oauth/kiro-device-login";
|
|
40
|
+
import { cancelKiroDeviceLogin, kiroDeviceConfigBaseline, selectKiroDeviceProfile, startKiroDeviceLogin, statusKiroDeviceLogin, type KiroDeviceMethod } from "../../oauth/kiro-device-login";
|
|
41
|
+
import { parseKiroIamOptions } from "../../oauth/kiro-iam-identity-center";
|
|
41
42
|
import { providerDestinationResolvedError } from "../../lib/destination-policy";
|
|
42
43
|
import { emailMaskingEnabled } from "../../lib/privacy";
|
|
43
44
|
import { reconcileLiveStateStores } from "../../lib/state-store-registrations";
|
|
@@ -259,7 +260,7 @@ export async function handleOauthAccountRoutes(ctx: ManagementContext): Promise<
|
|
|
259
260
|
// the provider's loopback callback server (inside this process) captures the redirect in the
|
|
260
261
|
// background, then the credential is persisted. The GUI opens the URL and polls /api/oauth/status.
|
|
261
262
|
if (url.pathname === "/api/oauth/login" && req.method === "POST") {
|
|
262
|
-
const body = await readManagementJsonBodyOr(req, {}) as { provider?: string; addAccount?: boolean; accountId?: string; reauth?: boolean; openBrowser?: unknown; method?: unknown; mode?: unknown };
|
|
263
|
+
const body = await readManagementJsonBodyOr(req, {}) as { provider?: string; addAccount?: boolean; accountId?: string; reauth?: boolean; openBrowser?: unknown; method?: unknown; mode?: unknown; startUrl?: unknown; region?: unknown; flowId?: unknown; profileArn?: unknown };
|
|
263
264
|
const provider = (body.provider ?? "").trim().toLowerCase();
|
|
264
265
|
if (!isPublicOAuthProvider(provider)) return jsonResponse({ error: "unknown oauth provider" }, 400);
|
|
265
266
|
// Omitted mode is the localhost-callback flow this route has always run.
|
|
@@ -282,13 +283,28 @@ export async function handleOauthAccountRoutes(ctx: ManagementContext): Promise<
|
|
|
282
283
|
const reauth = body.reauth === true || Boolean(accountId);
|
|
283
284
|
if (provider === "kiro") {
|
|
284
285
|
if (reauth && !accountId) return jsonResponse({ error: "Kiro reauth requires an accountId" }, 400);
|
|
286
|
+
if (body.flowId !== undefined) {
|
|
287
|
+
if (reauth || body.method !== undefined || typeof body.flowId !== "string" || body.flowId.length > 128
|
|
288
|
+
|| typeof body.profileArn !== "string" || body.profileArn.length > 256) return jsonResponse({ error: "invalid Kiro profile selection" }, 400);
|
|
289
|
+
const owner = principal ?? "admin-token";
|
|
290
|
+
const baseline = kiroDeviceConfigBaseline(body.flowId, owner);
|
|
291
|
+
const status = await selectKiroDeviceProfile(body.flowId, owner, body.profileArn);
|
|
292
|
+
if (!status) return jsonResponse({ error: "unknown Kiro profile selection" }, 404);
|
|
293
|
+
if (status.state === "done") {
|
|
294
|
+
reconcileLiveConfigFromDisk(config, baseline ?? structuredClone(config));
|
|
295
|
+
reconcileLiveStateStores();
|
|
296
|
+
}
|
|
297
|
+
return jsonResponse(status);
|
|
298
|
+
}
|
|
285
299
|
if (body.method !== undefined) {
|
|
286
|
-
if (body.method !== "builder-id" && body.method !== "google" && body.method !== "github") {
|
|
300
|
+
if (body.method !== "builder-id" && body.method !== "google" && body.method !== "github" && body.method !== "iam-identity-center") {
|
|
287
301
|
return jsonResponse({ error: "invalid Kiro device method" }, 400);
|
|
288
302
|
}
|
|
289
303
|
if (reauth) return jsonResponse({ error: "native_login_is_add_only" }, 400);
|
|
304
|
+
const iam = body.method === "iam-identity-center" ? parseKiroIamOptions(body) : undefined;
|
|
305
|
+
if (body.method === "iam-identity-center" && !iam) return jsonResponse({ error: "invalid Kiro IAM portal or region" }, 400);
|
|
290
306
|
try {
|
|
291
|
-
return jsonResponse(await startKiroDeviceLogin(body.method as KiroDeviceMethod, principal ?? "admin-token", readConfigDiagnostics().config));
|
|
307
|
+
return jsonResponse(await startKiroDeviceLogin(body.method as KiroDeviceMethod, principal ?? "admin-token", readConfigDiagnostics().config, iam));
|
|
292
308
|
} catch {
|
|
293
309
|
return jsonResponse({ error: "Kiro device login could not start" }, 409);
|
|
294
310
|
}
|
|
@@ -51,8 +51,10 @@ const RETRY_POLICY_VALIDATORS = {
|
|
|
51
51
|
export const PROVIDER_COMPAT_CARRY_FIELDS = [
|
|
52
52
|
"preserveReasoningContentModels",
|
|
53
53
|
"preserveResponsesReasoningContent",
|
|
54
|
+
"promoteAdditionalTools",
|
|
54
55
|
"requiresReasoningPlaceholderModels",
|
|
55
56
|
"foldDeveloperRoleToSystem",
|
|
57
|
+
"singleLeadingSystemMessage",
|
|
56
58
|
"reasoningWireFormat",
|
|
57
59
|
"omitReasoningEffortWithToolsModels",
|
|
58
60
|
...RETRY_POLICY_FIELDS,
|
|
@@ -159,10 +161,15 @@ export function providerCompatFieldConfigError(provider: Record<string, unknown>
|
|
|
159
161
|
}
|
|
160
162
|
const fold = provider.foldDeveloperRoleToSystem;
|
|
161
163
|
if (fold !== undefined && typeof fold !== "boolean") return "foldDeveloperRoleToSystem must be a boolean";
|
|
164
|
+
if (provider.singleLeadingSystemMessage !== undefined && typeof provider.singleLeadingSystemMessage !== "boolean") {
|
|
165
|
+
return "singleLeadingSystemMessage must be a boolean";
|
|
166
|
+
}
|
|
162
167
|
const hideRawReasoning = provider.hideRawReasoning;
|
|
163
168
|
if (hideRawReasoning !== undefined && typeof hideRawReasoning !== "boolean") return "hideRawReasoning must be a boolean";
|
|
164
169
|
const preserveResponses = provider.preserveResponsesReasoningContent;
|
|
165
170
|
if (preserveResponses !== undefined && typeof preserveResponses !== "boolean") return "preserveResponsesReasoningContent must be a boolean";
|
|
171
|
+
const promoteAdditionalTools = provider.promoteAdditionalTools;
|
|
172
|
+
if (promoteAdditionalTools !== undefined && typeof promoteAdditionalTools !== "boolean") return "promoteAdditionalTools must be a boolean";
|
|
166
173
|
const wire = provider.reasoningWireFormat;
|
|
167
174
|
if (wire !== undefined && !PROVIDER_REASONING_WIRE_FORMATS.includes(wire as never)) {
|
|
168
175
|
return `reasoningWireFormat must be one of: ${PROVIDER_REASONING_WIRE_FORMATS.join(", ")}`;
|
|
@@ -200,6 +207,13 @@ export function applyProviderCompatPatchFields(
|
|
|
200
207
|
else return { error: "foldDeveloperRoleToSystem must be a boolean" };
|
|
201
208
|
touched = true;
|
|
202
209
|
}
|
|
210
|
+
if (Object.hasOwn(rawBody, "singleLeadingSystemMessage")) {
|
|
211
|
+
const value = rawBody.singleLeadingSystemMessage;
|
|
212
|
+
if (value === null) delete next.singleLeadingSystemMessage;
|
|
213
|
+
else if (typeof value === "boolean") next.singleLeadingSystemMessage = value;
|
|
214
|
+
else return { error: "singleLeadingSystemMessage must be a boolean" };
|
|
215
|
+
touched = true;
|
|
216
|
+
}
|
|
203
217
|
if (Object.hasOwn(rawBody, "hideRawReasoning")) {
|
|
204
218
|
const value = rawBody.hideRawReasoning;
|
|
205
219
|
if (value === null) delete next.hideRawReasoning;
|
|
@@ -214,6 +228,13 @@ export function applyProviderCompatPatchFields(
|
|
|
214
228
|
else return { error: "preserveResponsesReasoningContent must be a boolean" };
|
|
215
229
|
touched = true;
|
|
216
230
|
}
|
|
231
|
+
if (Object.hasOwn(rawBody, "promoteAdditionalTools")) {
|
|
232
|
+
const value = rawBody.promoteAdditionalTools;
|
|
233
|
+
if (value === null) delete next.promoteAdditionalTools;
|
|
234
|
+
else if (typeof value === "boolean") next.promoteAdditionalTools = value;
|
|
235
|
+
else return { error: "promoteAdditionalTools must be a boolean" };
|
|
236
|
+
touched = true;
|
|
237
|
+
}
|
|
217
238
|
if (Object.hasOwn(rawBody, "inferContextWindow")) {
|
|
218
239
|
const value = rawBody.inferContextWindow;
|
|
219
240
|
if (value === null) delete next.inferContextWindow;
|
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
import { shadowInterceptProviderDependency } from "./shadow-call-validation";
|
|
64
64
|
import { deriveProviderPresets, providerConfigSeed } from "../../providers/derive";
|
|
65
65
|
import { initializeProviderModelSelection } from "../../providers/initial-model-selection";
|
|
66
|
+
import { invalidModelDiscoveryHint } from "../../providers/model-discovery-diagnostic";
|
|
66
67
|
import { effectiveGoogleMode, providerCodexAccountMode, providerMatchesRegistryTransport } from "../../providers/registry";
|
|
67
68
|
import {
|
|
68
69
|
extractModelEnvelopeRows,
|
|
@@ -907,6 +908,7 @@ export async function handleProviderRoutes(ctx: ManagementContext): Promise<Resp
|
|
|
907
908
|
hasHeaders: !!p.headers && Object.keys(p.headers).length > 0,
|
|
908
909
|
allowPrivateNetwork: p.allowPrivateNetwork === true,
|
|
909
910
|
preserveResponsesReasoningContent: p.preserveResponsesReasoningContent,
|
|
911
|
+
promoteAdditionalTools: p.promoteAdditionalTools,
|
|
910
912
|
liveModels: p.liveModels !== false,
|
|
911
913
|
requestPacing: p.requestPacing,
|
|
912
914
|
models: p.models ?? [],
|
|
@@ -1802,7 +1804,7 @@ export async function handleProviderRoutes(ctx: ManagementContext): Promise<Resp
|
|
|
1802
1804
|
latencyMs,
|
|
1803
1805
|
error: extracted.reason === "too_many_models"
|
|
1804
1806
|
? `upstream /models exceeded the ${discovery.maxModels}-row model limit`
|
|
1805
|
-
:
|
|
1807
|
+
: `upstream /models returned an unexpected shape${invalidModelDiscoveryHint("diagnostic" in extracted && typeof extracted.diagnostic === "string" ? extracted.diagnostic : undefined)}`,
|
|
1806
1808
|
});
|
|
1807
1809
|
}
|
|
1808
1810
|
const models = ccaModels?.length ?? ("items" in extracted! ? extracted!.items.length : extracted!.rows.length);
|
|
@@ -396,6 +396,8 @@ export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
|
|
|
396
396
|
{ method: "PATCH", path: "/api/protocols/settings", module: "server/management/protocol-routes", mutates: true },
|
|
397
397
|
{ method: "GET", path: "/api/workflow-budget", module: "server/management/workflow-budget-routes", mutates: false, exempt: { reason: "deferred-verb", why: "Reading a root's live budget is owed a CLI verb -- an operator staring at a 429 is usually already in a terminal -- but the ledger is process memory with no local transport to read it through, so the verb has to be an HTTP call the CLI does not yet make.", owner: "260915_workflow_budget_window wfc", ownerDoc: "devlog/_fin/260915_workflow_budget_window/030_wfc_diff_plan.md" } },
|
|
398
398
|
{ method: "POST", path: "/api/workflow-budget/clear", module: "server/management/workflow-budget-routes", mutates: true, exempt: { reason: "deferred-verb", why: "Clearing one root is owed the same verb as the read above and for the same reason. It is deliberately not shipped as a verb in this work-phase: the read comes first, because an operator who cannot see which ceiling fired has no basis for deciding to forgive it.", owner: "260915_workflow_budget_window wfc", ownerDoc: "devlog/_fin/260915_workflow_budget_window/030_wfc_diff_plan.md" } },
|
|
399
|
+
{ method: "GET", path: "/api/workflow-budget/settings", module: "server/management/workflow-budget-routes", mutates: false, exempt: { reason: "local-transport", why: "The CLI reads the same workflowBudget block through ocx config get; the route only adds the built-in defaults and bounds the dashboard draws." } },
|
|
400
|
+
{ method: "PUT", path: "/api/workflow-budget/settings", module: "server/management/workflow-budget-routes", mutates: true, exempt: { reason: "deferred-verb", why: "A dedicated live CLI verb for the ceilings is deferred with the other workflow-budget verbs; ocx config set/unset edits the same block on disk and the running proxy picks it up on restart.", owner: "260915_workflow_budget_window wfc", ownerDoc: "devlog/_fin/260915_workflow_budget_window/030_wfc_diff_plan.md" } },
|
|
399
401
|
// server/management/request-history-routes
|
|
400
402
|
{ method: "GET", path: "/api/request-history", module: "server/management/request-history-routes", mutates: false },
|
|
401
403
|
// server/management/routing-analytics-routes
|
|
@@ -254,6 +254,7 @@ export function requestLogDto(
|
|
|
254
254
|
): Record<string, unknown> {
|
|
255
255
|
return {
|
|
256
256
|
...entry,
|
|
257
|
+
...(entry.attemptNormalizationDropped === true ? { attemptNormalizationDropped: true } : {}),
|
|
257
258
|
...resendVerdict(entry),
|
|
258
259
|
displayMetrics: {
|
|
259
260
|
tokPerSecond: tokPerSecondResult(entry),
|
|
@@ -409,10 +410,14 @@ export async function buildClaudeDesktopState(config: OcxConfig, stored?: OcxCla
|
|
|
409
410
|
for (const id of desktopVisibleNativeSlugs(config)) {
|
|
410
411
|
effortByRoute.set(`native/${id}`, true);
|
|
411
412
|
}
|
|
413
|
+
const { desktopRouteVisible, filterDesktopModelsByVisibility, readDesktopModelVisibility } = await import("../../claude/desktop-model-visibility");
|
|
414
|
+
const visibility = readDesktopModelVisibility(config.claudeCode);
|
|
412
415
|
const models = Object.keys(profile.assignments).sort().map(route => ({
|
|
413
416
|
route,
|
|
414
417
|
label: modelByRoute.get(route)?.label ?? route,
|
|
415
418
|
available: available.has(route),
|
|
419
|
+
// Desktop list membership (#7702), separate from the tier assignment below.
|
|
420
|
+
visible: desktopRouteVisible(visibility, route),
|
|
416
421
|
...(modelByRoute.get(route)?.contextWindow ? { contextWindow: modelByRoute.get(route)!.contextWindow } : {}),
|
|
417
422
|
effortSupported: effortByRoute.get(route) ?? false,
|
|
418
423
|
// Read-only view of the 1M capability the written Desktop config already emits,
|
|
@@ -420,10 +425,21 @@ export async function buildClaudeDesktopState(config: OcxConfig, stored?: OcxCla
|
|
|
420
425
|
supports1m: routeSupportsOneMillion(route, modelByRoute.get(route)?.contextWindow),
|
|
421
426
|
assignment: profile.assignments[route]!,
|
|
422
427
|
}));
|
|
428
|
+
const rendered = renderDesktopProfile(profile, profileModels);
|
|
429
|
+
const selected = filterDesktopModelsByVisibility(
|
|
430
|
+
rendered.map(model => ({ ...model, anthropicFamilyTier: model.family })),
|
|
431
|
+
rendered.map(model => model.route),
|
|
432
|
+
visibility,
|
|
433
|
+
);
|
|
434
|
+
// Match the writer's empty-selection fallback without changing the saved intent.
|
|
435
|
+
const listed = selected.length > 0 ? selected : rendered;
|
|
423
436
|
return {
|
|
424
437
|
profile,
|
|
425
438
|
models,
|
|
426
|
-
rendered
|
|
439
|
+
rendered,
|
|
440
|
+
visibility: visibility ?? null,
|
|
441
|
+
// What the next apply writes, including generateDesktop3pModels' empty-selection fallback.
|
|
442
|
+
listed: listed.map(({ route, name, label, family, isFamilyDefault }) => ({ route, name, label, family, isFamilyDefault: !!isFamilyDefault })),
|
|
427
443
|
port: config.port,
|
|
428
444
|
};
|
|
429
445
|
}
|