@bitkyc08/opencodex 2.91.0 → 2.93.0-preview.20261027
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/bin/ocx.mjs +47 -8
- package/gui/dist/assets/App-CJZoq-uF.js +58 -0
- package/gui/dist/assets/{Tray-BuLy7hL1.js → Tray-BWQPcgZn.js} +1 -1
- package/gui/dist/assets/index-DRe8Hhfz.css +1 -0
- package/gui/dist/assets/index-Xfct8owH.js +94 -0
- package/gui/dist/assets/quota-summary-DxToX1rV.js +1 -0
- package/gui/dist/index.html +2 -2
- package/gui/dist/provider-icons/workbuddy-color.svg +29 -0
- package/package.json +8 -7
- package/src/adapters/anthropic.ts +28 -5
- package/src/adapters/coding-agent/batch-dispatcher.ts +122 -0
- package/src/adapters/coding-agent/profile.ts +54 -16
- package/src/adapters/coding-agent/turn.ts +30 -2
- package/src/adapters/command-code.ts +114 -7
- package/src/adapters/cursor/native-exec-fs.ts +11 -9
- package/src/adapters/devin/live-models.ts +4 -0
- package/src/adapters/google-vertex-endpoint.ts +9 -1
- package/src/adapters/google-vertex-key-project.ts +223 -0
- package/src/adapters/google-wire-compiler.ts +1 -2
- package/src/adapters/google.ts +13 -3
- package/src/adapters/kiro/reasoning.ts +2 -0
- package/src/adapters/kiro-refusal.ts +6 -1
- package/src/adapters/kiro-wire.ts +1 -1
- package/src/adapters/openai-chat/messages.ts +8 -2
- package/src/adapters/openai-chat/passthrough.ts +35 -14
- package/src/adapters/openai-chat/reasoning-replay.ts +27 -16
- package/src/adapters/openai-chat/reasoning-wire.ts +117 -8
- package/src/adapters/openai-chat/required-tool-result.ts +64 -0
- package/src/adapters/openai-chat/tool-name-registry.ts +3 -1
- package/src/adapters/openai-chat.ts +9 -10
- package/src/adapters/openai-responses/passthrough.ts +7 -4
- package/src/adapters/openai-responses/reasoning.ts +13 -0
- package/src/adapters/openai-responses/request-strips.ts +60 -0
- package/src/adapters/qoder/adapter.ts +129 -8
- package/src/adapters/qoder/scaffold-guard.ts +5 -0
- package/src/adapters/reasoning-controls.ts +16 -0
- package/src/adapters/registry.ts +5 -0
- package/src/adapters/tool-call-id.ts +1 -3
- package/src/adapters/workbuddy-schema.ts +61 -0
- package/src/adapters/workbuddy.ts +68 -0
- package/src/bridge/errors.ts +27 -0
- package/src/bridge/response-json.ts +1 -1
- package/src/bridge/sse.ts +1 -1
- package/src/bridge.ts +1 -1
- package/src/chat/inbound.ts +4 -1
- package/src/chat/outbound.ts +20 -6
- package/src/chat/reasoning-details.ts +28 -5
- package/src/claude/desktop-first-party.ts +54 -4
- package/src/claude/desktop-picker.ts +11 -8
- package/src/claude/first-party-settings.ts +3 -1
- package/src/claude/inbound.ts +2 -1
- package/src/claude/intercept/local-ca.ts +2 -1
- package/src/claude/intercept/picker-ca-cleanup.ts +4 -2
- package/src/claude/intercept/picker-ca-startup.ts +3 -1
- package/src/claude/intercept/picker-models.ts +6 -3
- package/src/claude/intercept/picker-runtime.ts +3 -2
- package/src/claude/intercept/runtime.ts +6 -3
- package/src/claude/model-info.ts +31 -8
- package/src/cli/account-api.ts +11 -0
- package/src/cli/capabilities-agents-routing.ts +3 -3
- package/src/cli/capabilities-base.ts +7 -1
- package/src/cli/capabilities-observe-system.ts +10 -0
- package/src/cli/claude-desktop.ts +9 -8
- package/src/cli/claude.ts +3 -2
- package/src/cli/codex-cli-update.ts +8 -0
- package/src/cli/codex-shim-autorestore.ts +9 -0
- package/src/cli/combo-result.ts +13 -0
- package/src/cli/combo-stats.ts +3 -0
- package/src/cli/combo.ts +83 -41
- package/src/cli/cross-home-owner.ts +13 -1
- package/src/cli/dispatch.ts +25 -6
- package/src/cli/ensure-desired-integrations.ts +8 -6
- package/src/cli/export-command.ts +4 -1
- package/src/cli/help.ts +2 -1
- package/src/cli/index.ts +45 -45
- package/src/cli/integration-plan-dto.ts +4 -0
- package/src/cli/launcher-context.ts +49 -2
- package/src/cli/link.ts +45 -32
- package/src/cli/opencode.ts +20 -9
- package/src/cli/provider.ts +2 -1
- package/src/cli/registry.ts +6 -4
- package/src/cli/root.ts +9 -0
- package/src/cli/status.ts +59 -1
- package/src/cli/stop-restore.ts +113 -0
- package/src/cli/sync-expectation.ts +60 -0
- package/src/cli/uninstall-integrations.ts +41 -7
- package/src/cli/usage-compare.ts +68 -12
- package/src/client/connect.ts +40 -3
- package/src/client/link-home.ts +10 -1
- package/src/client/link-ingress.ts +1 -1
- package/src/client/link-readiness.ts +97 -0
- package/src/client/link-relay-transport.ts +79 -11
- package/src/client/link-relay.ts +74 -15
- package/src/client/link-tunnel.ts +45 -18
- package/src/client/machine-api.ts +3 -1
- package/src/client/machine-listener.ts +20 -2
- package/src/client/runtime.ts +20 -2
- package/src/client/sync-expectation.ts +118 -0
- package/src/clients/config-export/agent-clients.ts +96 -0
- package/src/clients/config-export/contracts.ts +25 -7
- package/src/clients/config-export/qoder.ts +38 -23
- package/src/clients/config-export/reasoning-metadata.ts +55 -8
- package/src/clients/config-export.ts +12 -0
- package/src/clients/lazycodex.ts +7 -2
- package/src/clients/reasoning-controls.ts +49 -0
- package/src/codex/account-store.ts +17 -3
- package/src/codex/app-server-restart-service.ts +6 -5
- package/src/codex/auth-api/account-identity.ts +14 -0
- package/src/codex/auth-api/account-list.ts +29 -2
- package/src/codex/auth-api/http.ts +13 -0
- package/src/codex/auth-api/main-account-probe.ts +2 -2
- package/src/codex/auth-api/pool-mode-gate.ts +16 -3
- package/src/codex/auth-api/pool-quota-probe.ts +15 -0
- package/src/codex/auth-context.ts +15 -12
- package/src/codex/catalog/build-entries.ts +22 -0
- package/src/codex/catalog/configured-tiers.ts +70 -0
- package/src/codex/catalog/effort.ts +52 -11
- package/src/codex/catalog/gather-capture.ts +5 -2
- package/src/codex/catalog/heal-observation.ts +155 -13
- package/src/codex/catalog/metadata.ts +6 -0
- package/src/codex/catalog/model-hints.ts +60 -11
- package/src/codex/catalog/model-visibility.ts +3 -2
- package/src/codex/catalog/native-models.ts +18 -3
- package/src/codex/catalog/parsing.ts +10 -8
- package/src/codex/catalog/pinned-models.ts +2 -1
- package/src/codex/catalog/provider-models.ts +18 -13
- package/src/codex/catalog/retained-sync.ts +2 -1
- package/src/codex/catalog/routed-gather.ts +19 -20
- package/src/codex/catalog/write-audit.ts +3 -2
- package/src/codex/catalog-self-heal.ts +43 -23
- package/src/codex/chatgpt-refresh-failure.ts +6 -2
- package/src/codex/cli-install-provenance.ts +418 -0
- package/src/codex/cli-installation-targets.ts +5 -1
- package/src/codex/cli-update-plan.ts +43 -16
- package/src/codex/collision-identity.ts +30 -5
- package/src/codex/convergence.ts +4 -3
- package/src/codex/data/roster-pinned-models.json +177 -1
- package/src/codex/desired-state.ts +6 -1
- package/src/codex/desktop-app/picker-freshness.ts +10 -8
- package/src/codex/desktop-compatibility/installed-build.ts +88 -12
- package/src/codex/desktop-compatibility/runtime.ts +29 -5
- package/src/codex/desktop-compatibility/usage-activation.ts +2 -1
- package/src/codex/desktop-compatibility/usage-controller.ts +9 -1
- package/src/codex/desktop-compatibility/windows-certificate-trust.ts +46 -12
- package/src/codex/inject/config-toml.ts +0 -18
- package/src/codex/inject/plan.ts +18 -3
- package/src/codex/inject/remove.ts +6 -2
- package/src/codex/inject.ts +1 -1
- package/src/codex/journal.ts +61 -1
- package/src/codex/model-entitlements.ts +1 -1
- package/src/codex/native-main-owner.ts +27 -1
- package/src/codex/native-profile-store.ts +2 -1
- package/src/codex/pool-credit-policy.ts +35 -1
- package/src/codex/pool-refresh-backoff.ts +3 -1
- package/src/codex/quota-types.ts +3 -0
- package/src/codex/quota.ts +24 -4
- package/src/codex/role-auto-assign.ts +6 -2
- package/src/codex/subagent-defaults.ts +49 -4
- package/src/codex/user-identity.ts +35 -6
- package/src/codex/windows-current-sid.ts +162 -0
- package/src/combos/failover.ts +17 -2
- package/src/combos/jev-decision-contract.ts +22 -1
- package/src/combos/jev-quota-activation.ts +5 -1
- package/src/combos/jev-quota-route.ts +1 -1
- package/src/combos/jev-quota.ts +9 -1
- package/src/combos/jev-service-exchange.ts +3 -1
- package/src/combos/jev-session-pin-config.ts +51 -0
- package/src/combos/jev.ts +101 -9
- package/src/combos/resolve.ts +45 -1
- package/src/combos/types.ts +43 -0
- package/src/config/load-degrade.ts +5 -0
- package/src/config/paths.ts +19 -3
- package/src/config/pending-teardown.ts +22 -1
- package/src/config/provider-validation.ts +22 -4
- package/src/config/removed-opencode-free.ts +11 -0
- package/src/config/schema/leaf-validators.ts +6 -0
- package/src/generated/compatibility-version.json +467 -311
- package/src/generated/model-metadata.ts +5 -5
- package/src/images/loop.ts +16 -2
- package/src/integrations/catalog-refresh.ts +1 -1
- package/src/integrations/hermes-profiles.ts +251 -0
- package/src/integrations/merge.ts +8 -0
- package/src/integrations/mutation-plan.ts +19 -4
- package/src/integrations/registry.ts +5 -0
- package/src/integrations/state.ts +36 -1
- package/src/integrations/writer.ts +18 -4
- package/src/lib/bun-path-runtime.mjs +2 -1
- package/src/lib/decision-quota-sink.ts +10 -0
- package/src/lib/errors.ts +62 -0
- package/src/lib/eventstream-decoder.ts +81 -37
- package/src/lib/opaque-proxy-tunnel.ts +32 -8
- package/src/lib/pinned-http.ts +35 -2
- package/src/lib/process-control.ts +13 -1
- package/src/lib/socks5-fetch.ts +59 -64
- package/src/lib/socks5-upload-waiter.ts +50 -0
- package/src/lib/sse-decoder.ts +7 -2
- package/src/lib/state-store-sweeper.ts +40 -14
- package/src/lib/translator-budget.ts +4 -4
- package/src/lib/upstream-retry.ts +4 -1
- package/src/lib/windows-native-principal-worker.ts +14 -0
- package/src/lib/windows-native-principal.ts +188 -0
- package/src/lib/windows-secret-acl.ts +39 -3
- package/src/lib/windows-user-principal.ts +62 -18
- package/src/link/diagnostics.ts +193 -0
- package/src/link/relay-auth.ts +6 -0
- package/src/link/ssh-config.ts +35 -3
- package/src/link/status-projection.ts +39 -0
- package/src/link/supervisor.ts +45 -12
- package/src/link/tunnel-history.ts +109 -0
- package/src/link/tunnel-state.ts +80 -17
- package/src/messaging/remote-files.ts +24 -1
- package/src/oauth/generic-account-failover.ts +91 -7
- package/src/oauth/index.ts +15 -0
- package/src/oauth/model-discovery-auth.ts +5 -0
- package/src/oauth/store.ts +4 -1
- package/src/oauth/token-guardian.ts +7 -0
- package/src/oauth/types.ts +9 -0
- package/src/oauth/workbuddy.ts +139 -0
- package/src/providers/account-quota-disk.ts +12 -4
- package/src/providers/antigravity-quota-identity.ts +37 -0
- package/src/providers/base-url-choices.ts +8 -5
- package/src/providers/codebuddy-models.ts +6 -0
- package/src/providers/codex-capacity.ts +3 -1
- package/src/providers/derive.ts +51 -3
- package/src/providers/kiro-models.ts +3 -0
- package/src/providers/mimo-thinking.ts +12 -0
- package/src/providers/model-discovery.ts +2 -0
- package/src/providers/model-rename-fields.ts +2 -0
- package/src/providers/model-rename-migration.ts +10 -0
- package/src/providers/openai-sidecar-credit.ts +2 -2
- package/src/providers/quota/account-cache.ts +3 -2
- package/src/providers/quota/antigravity.ts +25 -14
- package/src/providers/quota/report-cache.ts +13 -4
- package/src/providers/quota/vendor-probes-key.ts +60 -0
- package/src/providers/quota/workbuddy.ts +83 -0
- package/src/providers/quota-decision-antigravity.ts +64 -0
- package/src/providers/quota-decision-publication.ts +11 -0
- package/src/providers/quota-decision-snapshot.ts +21 -4
- package/src/providers/quota-types.ts +2 -0
- package/src/providers/quota.ts +3 -1
- package/src/providers/reasoning-capabilities.ts +76 -0
- package/src/providers/registry/entries-core.ts +23 -12
- package/src/providers/registry/entries-extended.ts +83 -27
- package/src/providers/registry/model-ids.ts +5 -0
- package/src/providers/registry/model-seeds.ts +120 -56
- package/src/providers/registry/types.ts +29 -2
- package/src/providers/resolved-model-policy.ts +30 -10
- package/src/providers/routed-config.ts +24 -1
- package/src/providers/stale-model-roster-migration.ts +123 -18
- package/src/providers/workbuddy-credit-balance.ts +81 -0
- package/src/providers/workbuddy-models.ts +37 -0
- package/src/providers/workbuddy.ts +60 -0
- package/src/remote-control/workspace-pi-runtime.ts +11 -6
- package/src/responses/compaction-summary.ts +45 -0
- package/src/responses/muse-tool-name-alias.ts +1 -2
- package/src/responses/parser.ts +3 -2
- package/src/responses/reasoning-replay-cache.ts +18 -14
- package/src/responses/schema.ts +1 -0
- package/src/responses/thought-signature-replay.ts +10 -2
- package/src/router.ts +2 -0
- package/src/routing/analytics.ts +2 -3
- package/src/routing/capability.ts +8 -2
- package/src/routing/fallback-policy.ts +3 -3
- package/src/routing/history/ingest.ts +28 -3
- package/src/server/auth-cors.ts +4 -2
- package/src/server/chat-completions.ts +21 -1
- package/src/server/chat-native-eligibility.ts +7 -0
- package/src/server/chat-native-reasoning.ts +24 -7
- package/src/server/chat-native.ts +13 -2
- package/src/server/claude-messages.ts +3 -0
- package/src/server/direct-local-http.ts +5 -2
- package/src/server/effort-policy.ts +5 -1
- package/src/server/index/link-relay-sessions.ts +9 -5
- package/src/server/index/live-sideband.ts +18 -15
- package/src/server/index/optional-listeners.ts +4 -0
- package/src/server/index/serve-options.ts +5 -4
- package/src/server/local-management-read-client.ts +3 -1
- package/src/server/management/agent-settings-routes.ts +27 -15
- package/src/server/management/combo-routes.ts +14 -4
- package/src/server/management/config-routes.ts +2 -2
- package/src/server/management/decision-discovery.ts +12 -2
- package/src/server/management/hermes-profile-routes.ts +156 -0
- package/src/server/management/integration-routes.ts +85 -24
- package/src/server/management/link-routes.ts +5 -2
- package/src/server/management/model-routes.ts +2 -2
- package/src/server/management/model-row-export-metadata.ts +25 -6
- package/src/server/management/model-rows.ts +15 -20
- package/src/server/management/native-integration-routes.ts +11 -8
- package/src/server/management/provider-routes.ts +1 -1
- package/src/server/management/route-registry.ts +4 -0
- package/src/server/management-api.ts +5 -0
- package/src/server/models-capabilities.ts +21 -3
- package/src/server/port-reclaim.ts +51 -9
- package/src/server/request-log-conversation.ts +49 -0
- package/src/server/request-log.ts +2 -0
- package/src/server/responses/adapter-delivery.ts +11 -1
- package/src/server/responses/adapter-dispatch.ts +2 -2
- package/src/server/responses/anthropic-thinking-recovery.ts +1 -0
- package/src/server/responses/codex-ws-exchange.ts +39 -9
- package/src/server/responses/codex-ws-session.ts +38 -4
- package/src/server/responses/codex-ws-wire.ts +6 -1
- package/src/server/responses/combo-required-tool-contract.ts +103 -0
- package/src/server/responses/combo-stream-preflight.ts +8 -1
- package/src/server/responses/compact.ts +14 -5
- package/src/server/responses/context-overflow.ts +8 -1
- package/src/server/responses/core-combo-failure.ts +10 -0
- package/src/server/responses/core-combo.ts +74 -44
- package/src/server/responses/core-lifetime.ts +5 -2
- package/src/server/responses/core-normalize.ts +17 -4
- package/src/server/responses/core-opaque-recovery.ts +1 -0
- package/src/server/responses/core-options.ts +7 -0
- package/src/server/responses/core-replay.ts +2 -1
- package/src/server/responses/jev-combo-choice.ts +39 -0
- package/src/server/responses/jev-session-pin.ts +203 -0
- package/src/server/responses/main-hard-lock-routing.ts +60 -44
- package/src/server/responses/passthrough-delivery.ts +44 -2
- package/src/server/responses/policy-fallback.ts +6 -1
- package/src/server/responses/request-compression.ts +12 -7
- package/src/server/responses/request-prepare.ts +32 -7
- package/src/server/responses/request-sidecar-auth.ts +2 -0
- package/src/server/responses/request-transport.ts +25 -6
- package/src/server/responses/response-effects.ts +22 -10
- package/src/server/responses/run-turn-execution.ts +2 -4
- package/src/server/responses/sidecar-execution.ts +13 -7
- package/src/server/responses-phase-inference.ts +267 -0
- package/src/server/sse-payload-rewrite.ts +14 -1
- package/src/server/stop-teardown.ts +36 -1
- package/src/server/ws-bridge.ts +1 -1
- package/src/service/definition.ts +20 -8
- package/src/service/desktop-supervision.d.mts +7 -4
- package/src/service/desktop-supervision.mjs +90 -13
- package/src/service/ownership-mutation-lease.mjs +21 -7
- package/src/types/config.ts +14 -2
- package/src/types/provider.ts +29 -7
- package/src/types/request.ts +11 -0
- package/src/types/wire.ts +1 -0
- package/src/types.ts +1 -0
- package/src/update/bind-probe.ts +29 -0
- package/src/update/codex-cli-update-launch-policy.d.mts +9 -0
- package/src/update/codex-cli-update-launch-policy.mjs +30 -0
- package/src/update/job.ts +10 -29
- package/src/update/npm-install-job.ps1 +173 -0
- package/src/update/npm-install.mjs +70 -0
- package/src/update/stop-contract.d.mts +1 -0
- package/src/update/stop-contract.mjs +14 -0
- package/src/update/stop-decision.d.mts +1 -1
- package/src/update/stop-decision.mjs +13 -3
- package/src/update/teardown-handover.ts +166 -0
- package/src/update/transactional-install.d.mts +14 -3
- package/src/update/transactional-install.mjs +33 -7
- package/src/usage/expected-prices.ts +64 -31
- package/src/usage/jev-stats.ts +54 -14
- package/src/usage/timeline.ts +19 -9
- package/src/vision/eligibility.ts +15 -5
- package/src/vision/plan.ts +2 -2
- package/src/web-search/loop.ts +16 -2
- package/gui/dist/assets/App-nZ34cR5G.js +0 -58
- package/gui/dist/assets/index-DGXS51sp.js +0 -94
- package/gui/dist/assets/index-DPeB9HpV.css +0 -1
- package/gui/dist/assets/quota-summary-DO1Sx5TM.js +0 -1
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
* into Claude Code's settings keeps `first-party` (observeClaudeDesktopMode), so moving the default
|
|
20
20
|
* to gateway never flips a working Desktop under the operator.
|
|
21
21
|
*/
|
|
22
|
-
import { getConfigDir } from "../config/paths";
|
|
22
|
+
import { getConfigDir, withConfigDirHardeningSettled } from "../config/paths";
|
|
23
|
+
import { WindowsSecretAclSettleTimeoutError } from "../lib/windows-secret-acl";
|
|
23
24
|
import { join } from "node:path";
|
|
24
25
|
import type { OcxConfig } from "../types";
|
|
25
26
|
import { claudeConfigDir } from "./auth-detect";
|
|
@@ -211,9 +212,35 @@ export function observeClaudeDesktopMode(
|
|
|
211
212
|
return observed;
|
|
212
213
|
}
|
|
213
214
|
|
|
215
|
+
const SECRET_FAILURE_CAUSES = ["EACCES", "EPERM", "ENOENT", "EEXIST", "EIO", "EBUSY", "ETIMEDOUT",
|
|
216
|
+
"EICACLS", "EACLIDENTITY", "local_ca_path_unsafe", "client_lifecycle_busy", "client_lifecycle_lock_failed",
|
|
217
|
+
"claude_intercept_proxy_token_invalid", "Error", "TypeError", "RangeError", "unknown"] as const;
|
|
218
|
+
export interface InterceptSecretDiagnostic {
|
|
219
|
+
stage: "ca" | "token";
|
|
220
|
+
cause: typeof SECRET_FAILURE_CAUSES[number];
|
|
221
|
+
}
|
|
222
|
+
function secretFailureCause(error: unknown): InterceptSecretDiagnostic["cause"] {
|
|
223
|
+
const code = error instanceof Error && "code" in error ? error.code : undefined;
|
|
224
|
+
// Allowlist labels, never arbitrary messages, paths, ACL stdout, or error-supplied names.
|
|
225
|
+
for (const allowed of SECRET_FAILURE_CAUSES) if (code === allowed) return allowed;
|
|
226
|
+
for (const allowed of ["TypeError", "RangeError", "Error"] as const)
|
|
227
|
+
if (error instanceof Error && error.name === allowed) return allowed;
|
|
228
|
+
return "unknown";
|
|
229
|
+
}
|
|
214
230
|
export type DesktopFirstPartyApplyResult =
|
|
215
231
|
| { ok: true; changed: boolean; path: string; env: ClaudeInterceptEnv; proxyPort: number }
|
|
216
|
-
| { ok: false; reason: "intercept_disabled" | "ca_unavailable" | "unreadable" | "foreign_env"; path: string };
|
|
232
|
+
| { ok: false; reason: "intercept_disabled" | "ca_unavailable" | "unreadable" | "foreign_env"; path: string; diagnostic?: InterceptSecretDiagnostic };
|
|
233
|
+
|
|
234
|
+
/** Async apply/reconcile boundaries translate admission timeout into the existing refusal. */
|
|
235
|
+
export async function withFirstPartySecretsSettled<T>(configDir: string, prepare: () => T):
|
|
236
|
+
Promise<T | Extract<DesktopFirstPartyApplyResult, { ok: false }>> {
|
|
237
|
+
try { return await withConfigDirHardeningSettled(configDir, prepare); }
|
|
238
|
+
catch (error) {
|
|
239
|
+
if (!(error instanceof WindowsSecretAclSettleTimeoutError)) throw error;
|
|
240
|
+
return { ok: false, reason: "ca_unavailable", path: claudeInterceptCaCertPath(configDir),
|
|
241
|
+
diagnostic: { stage: "ca", cause: "ETIMEDOUT" } };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
217
244
|
|
|
218
245
|
/**
|
|
219
246
|
* Write the first-party env into Claude Code's settings. Creates the local CA first so the
|
|
@@ -226,11 +253,15 @@ export function applyDesktopFirstParty(
|
|
|
226
253
|
const opencodexConfigDir = options.opencodexConfigDir ?? getConfigDir();
|
|
227
254
|
if (!claudeInterceptEnabled(config)) return { ok: false, reason: "intercept_disabled", path: "" };
|
|
228
255
|
let target: DesktopFirstPartyTarget;
|
|
256
|
+
let stage: InterceptSecretDiagnostic["stage"] = "ca";
|
|
229
257
|
try {
|
|
230
258
|
ensureLocalInterceptCa(opencodexConfigDir);
|
|
259
|
+
stage = "token";
|
|
231
260
|
target = desktopFirstPartyTarget(config, opencodexConfigDir);
|
|
232
|
-
} catch {
|
|
233
|
-
|
|
261
|
+
} catch (error) {
|
|
262
|
+
const diagnostic = { stage, cause: secretFailureCause(error) };
|
|
263
|
+
console.warn(`[claude-intercept] secret preparation failed: stage=${diagnostic.stage} cause=${diagnostic.cause}`);
|
|
264
|
+
return { ok: false, reason: "ca_unavailable", path: claudeInterceptCaCertPath(opencodexConfigDir), diagnostic };
|
|
234
265
|
}
|
|
235
266
|
const written = applyClaudeInterceptSettings(target.env, options.claudeConfigDir);
|
|
236
267
|
if (!written.ok) return { ok: false, reason: written.reason, path: written.path };
|
|
@@ -248,3 +279,22 @@ export function removeDesktopFirstParty(
|
|
|
248
279
|
const caCertPath = claudeInterceptCaCertPath(options.opencodexConfigDir ?? getConfigDir());
|
|
249
280
|
return removeClaudeInterceptSettings(caCertPath, options.claudeConfigDir);
|
|
250
281
|
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Remove Desktop's first-party env once ACL work overlapping the Claude settings home settles.
|
|
285
|
+
* A `CLAUDE_CONFIG_DIR` nested in the opencodex home shares the config-root hardening flight, so
|
|
286
|
+
* the credential-bearing settings rewrite gets the same admission as other intercept secrets.
|
|
287
|
+
* The config is read inside the same synchronous turn. A settle timeout refuses without writing.
|
|
288
|
+
*/
|
|
289
|
+
export async function removeDesktopFirstPartySettled(
|
|
290
|
+
readConfig: () => Pick<OcxConfig, "claudeCode" | "runtimeRole">,
|
|
291
|
+
options: DesktopFirstPartyOptions = {},
|
|
292
|
+
remove: typeof removeDesktopFirstParty = removeDesktopFirstParty,
|
|
293
|
+
): Promise<ReturnType<typeof removeDesktopFirstParty>> {
|
|
294
|
+
const dir = options.claudeConfigDir ?? claudeConfigDir();
|
|
295
|
+
try { return await withConfigDirHardeningSettled(dir, () => remove(readConfig(), options)); }
|
|
296
|
+
catch (error) {
|
|
297
|
+
if (!(error instanceof WindowsSecretAclSettleTimeoutError)) throw error;
|
|
298
|
+
return { ok: false, reason: "unreadable", path: join(dir, "settings.json") };
|
|
299
|
+
}
|
|
300
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { OcxConfig } from "../types";
|
|
8
8
|
import { claudeDesktopIntegrationEnabled } from "../codex/desired-state";
|
|
9
|
-
import { getConfigDir } from "../config/paths";
|
|
9
|
+
import { getConfigDir, withConfigDirHardeningSettled } from "../config/paths";
|
|
10
10
|
import { readFileSync, existsSync } from "node:fs";
|
|
11
11
|
import { acceptsPickerAuthority, pickerCaCertPath, pickerCaFingerprints, ensurePickerCa, issuePickerLeaf, pickerLeafCertPath, publishedPickerCaSha256 } from "./intercept/picker-ca";
|
|
12
12
|
import { inspectPickerTrust, trustPickerCa, untrustPickerCa } from "./intercept/picker-trust";
|
|
@@ -222,7 +222,7 @@ export function createDesktopPickerController(deps: DesktopPickerControllerDeps)
|
|
|
222
222
|
if (first) return refuse(first);
|
|
223
223
|
if (options.persist) {
|
|
224
224
|
try {
|
|
225
|
-
if (!deps.persistPreference(true)) return refuse("mode_not_committed");
|
|
225
|
+
if (!await withConfigDirHardeningSettled(deps.configDir, () => deps.persistPreference(true))) return refuse("mode_not_committed");
|
|
226
226
|
} catch { return refuse("mode_not_committed"); }
|
|
227
227
|
}
|
|
228
228
|
const second = check(deps.readConfig(), true);
|
|
@@ -237,12 +237,12 @@ export function createDesktopPickerController(deps: DesktopPickerControllerDeps)
|
|
|
237
237
|
try {
|
|
238
238
|
const ca = deps.persistentAuthority
|
|
239
239
|
? await preparePersistentPickerAuthority({ configDir: deps.configDir, store: deps.persistentAuthority.store, security: deps.security, platform })
|
|
240
|
-
: ensurePickerCa(deps.configDir);
|
|
240
|
+
: await withConfigDirHardeningSettled(deps.configDir, () => ensurePickerCa(deps.configDir));
|
|
241
241
|
// The CLI path gates trust on the same profile check; a published root whose bytes do not
|
|
242
242
|
// match the profile this process mints must not reach the keychain through the server
|
|
243
243
|
// path either, even when a live peer published it.
|
|
244
244
|
if (!acceptsPickerAuthority(ca.certPem)) return refuse("ca_unverified");
|
|
245
|
-
issuePickerLeaf(ca, deps.configDir);
|
|
245
|
+
await withConfigDirHardeningSettled(deps.configDir, () => issuePickerLeaf(ca, deps.configDir));
|
|
246
246
|
caPath = pickerCaCertPath(deps.configDir);
|
|
247
247
|
caSha1 = pickerCaFingerprints(ca.certPem).sha1;
|
|
248
248
|
let trust = await inspectPickerTrust(pickerLeafCertPath(deps.configDir), caSha1, deps.security, platform);
|
|
@@ -268,7 +268,10 @@ export function createDesktopPickerController(deps: DesktopPickerControllerDeps)
|
|
|
268
268
|
const compensationFailed = (trustedByAttempt || options.callerAddedTrust === true) && !(await compensateTrust(true));
|
|
269
269
|
return withTrustFailure({ ...runtimeStatus(trust), reason: "proxy_unavailable" }, compensationFailed);
|
|
270
270
|
}
|
|
271
|
-
const applied =
|
|
271
|
+
const applied = await withConfigDirHardeningSettled(deps.configDir, () =>
|
|
272
|
+
check(deps.readConfig(), true) || deps.proxyPort() !== proxyPort
|
|
273
|
+
? { ok: false as const, reason: "write_failed" }
|
|
274
|
+
: applyProfile({ ...profileOptions(deps), proxyPort }));
|
|
272
275
|
if (!applied.ok) {
|
|
273
276
|
const compensationFailed = (trustedByAttempt || options.callerAddedTrust === true) && !(await compensateTrust(true));
|
|
274
277
|
return withTrustFailure({ ...runtimeStatus(trust), reason: "profile_failed", residual: ["profile"] }, compensationFailed);
|
|
@@ -288,11 +291,11 @@ export function createDesktopPickerController(deps: DesktopPickerControllerDeps)
|
|
|
288
291
|
const residual: string[] = [];
|
|
289
292
|
try { deps.runtime.disarm(); } catch { residual.push("runtime"); }
|
|
290
293
|
if (options.persist) {
|
|
291
|
-
try { if (!deps.persistPreference(false)) residual.push("preference"); }
|
|
294
|
+
try { if (!await withConfigDirHardeningSettled(deps.configDir, () => deps.persistPreference(false))) residual.push("preference"); }
|
|
292
295
|
catch { residual.push("preference"); }
|
|
293
296
|
}
|
|
294
297
|
try {
|
|
295
|
-
const removed = removeProfile(profileOptions(deps));
|
|
298
|
+
const removed = await withConfigDirHardeningSettled(deps.configDir, () => removeProfile(profileOptions(deps)));
|
|
296
299
|
if (!removed.ok) residual.push("profile");
|
|
297
300
|
} catch { residual.push("profile"); }
|
|
298
301
|
// Trust goes only once Desktop no longer selects the picker profile: a selected profile without
|
|
@@ -332,7 +335,7 @@ export async function removeDesktopPickerArtifacts(options: { configDir?: string
|
|
|
332
335
|
const platform = options.platform ?? process.platform;
|
|
333
336
|
const residual: string[] = [];
|
|
334
337
|
try {
|
|
335
|
-
const removed = removeDesktopPickerProfile({ configDir, ...(platform ? { platform } : {}) });
|
|
338
|
+
const removed = await withConfigDirHardeningSettled(configDir, () => removeDesktopPickerProfile({ configDir, ...(platform ? { platform } : {}) }));
|
|
336
339
|
if (!removed.ok) residual.push("profile");
|
|
337
340
|
} catch { residual.push("profile"); }
|
|
338
341
|
let released = false;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
resolveClaudeDesktopMode,
|
|
10
10
|
type ClaudeDesktopModeObservation,
|
|
11
11
|
type DesktopFirstPartyOptions,
|
|
12
|
+
type DesktopFirstPartyApplyResult,
|
|
12
13
|
} from "./desktop-first-party";
|
|
13
14
|
import { claudeInterceptCaCertPath } from "./intercept/local-ca";
|
|
14
15
|
import { invalidateClaudeCodeServedCatalog } from "./intercept/cli-catalog";
|
|
@@ -39,8 +40,9 @@ export function firstPartyDesired(
|
|
|
39
40
|
|
|
40
41
|
export type ClaudeFirstPartyReconcileResult =
|
|
41
42
|
| { ok: true; action: "applied" | "removed" | "unchanged"; changed: boolean; path: string }
|
|
42
|
-
| { ok: false
|
|
43
|
+
| Extract<DesktopFirstPartyApplyResult, { ok: false }>;
|
|
43
44
|
|
|
45
|
+
// Synchronous leaf: async callers wrap reconciliation in withConfigDirHardeningSettled.
|
|
44
46
|
export function reconcileClaudeFirstPartySettings(
|
|
45
47
|
config: Pick<OcxConfig, "claudeCode" | "port" | "runtimeRole" | "clientIntegrations">,
|
|
46
48
|
desired: ClaudeFirstPartyDesired,
|
package/src/claude/inbound.ts
CHANGED
|
@@ -631,9 +631,10 @@ function applyAnthropicSettings(
|
|
|
631
631
|
// think by default, omission means thinking is ON, sharing the caller's max_tokens (#545).
|
|
632
632
|
// `none` is the effort disable sentinel. It is not a valid OpenAI summary
|
|
633
633
|
// value, so do not attach the similarly named internal catalog sentinel.
|
|
634
|
-
body.reasoning = { effort: "none" };
|
|
634
|
+
body.reasoning = { effort: "none", enabled: false };
|
|
635
635
|
} else if (isRec(thinking) || outputConfigEffort !== undefined) {
|
|
636
636
|
const reasoning: Rec = { summary: isRec(thinking) && thinking.display === "omitted" ? "none" : "auto" };
|
|
637
|
+
if (isRec(thinking) && thinking.type === "enabled") reasoning.enabled = true;
|
|
637
638
|
if (outputConfigEffort !== undefined) {
|
|
638
639
|
// Adaptive wire: /effort arrives as output_config.effort (devlog 080).
|
|
639
640
|
reasoning.effort = outputConfigEffort;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash, generateKeyPairSync, createPrivateKey, createPublicKey, sign, X509Certificate, type KeyObject } from "node:crypto";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { withConfigDirHardeningSettled } from "../../config/paths";
|
|
3
4
|
import { withLocalCaPublication, type LocalCaFiles } from "./local-ca-files";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -371,7 +372,7 @@ export function ensureLocalInterceptCa(configDir: string): LocalInterceptCa {
|
|
|
371
372
|
* contention, before binding listeners, without blocking the main event loop. */
|
|
372
373
|
export async function ensureLocalInterceptCaForStartup(configDir: string): Promise<LocalInterceptCa> {
|
|
373
374
|
for (let attempt = 0; ; attempt += 1) {
|
|
374
|
-
try { return ensureLocalInterceptCa(configDir); }
|
|
375
|
+
try { return await withConfigDirHardeningSettled(configDir, () => ensureLocalInterceptCa(configDir)); }
|
|
375
376
|
catch (error) {
|
|
376
377
|
if (attempt >= 49 || !(error instanceof Error)
|
|
377
378
|
|| !("code" in error) || error.code !== "client_lifecycle_busy") throw error;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { withConfigDirHardeningSettled } from "../../config/paths";
|
|
4
5
|
import {
|
|
5
6
|
acknowledgePendingPickerCaUntrust,
|
|
6
7
|
pendingPickerCaHasLivePublishedOwner,
|
|
@@ -16,7 +17,7 @@ export async function drainPendingPickerCaUntrust(
|
|
|
16
17
|
): Promise<boolean> {
|
|
17
18
|
const pending = readPendingPickerCaUntrust(configDir);
|
|
18
19
|
if (!pending) return true;
|
|
19
|
-
if (pendingPickerCaHasLivePublishedOwner(configDir, pending)) return false;
|
|
20
|
+
if (await withConfigDirHardeningSettled(configDir, () => pendingPickerCaHasLivePublishedOwner(configDir, pending))) return false;
|
|
20
21
|
|
|
21
22
|
const privateDir = mkdtempSync(join(tmpdir(), "ocx-picker-untrust-"));
|
|
22
23
|
try {
|
|
@@ -24,7 +25,8 @@ export async function drainPendingPickerCaUntrust(
|
|
|
24
25
|
writeFileSync(publicCopy, pending.certPem, { mode: 0o600 });
|
|
25
26
|
const result = await untrustPickerCa(publicCopy, pending.sha1, security, platform);
|
|
26
27
|
if (!result.ok) return false;
|
|
27
|
-
|
|
28
|
+
// OS untrust yielded: a new parent flight may have started since the owner inspection.
|
|
29
|
+
return await withConfigDirHardeningSettled(configDir, () => acknowledgePendingPickerCaUntrust(configDir, pending, result));
|
|
28
30
|
} finally {
|
|
29
31
|
rmSync(privateDir, { recursive: true, force: true });
|
|
30
32
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ensurePickerCa, type PickerCa } from "./picker-ca";
|
|
2
|
+
import { withConfigDirHardeningSettled } from "../../config/paths";
|
|
2
3
|
import { drainPendingPickerCaUntrust } from "./picker-ca-cleanup";
|
|
3
4
|
import type { PickerCaStore } from "./picker-ca-store";
|
|
4
5
|
import type { SecurityRunner } from "./picker-trust";
|
|
@@ -11,7 +12,8 @@ export async function preparePersistentPickerAuthority(options: {
|
|
|
11
12
|
if (!supportsDesktopPicker(options.platform)) throw new Error("picker_ca_unsupported_platform");
|
|
12
13
|
const drain = () => drainPendingPickerCaUntrust(options.configDir, options.security, options.platform);
|
|
13
14
|
if (!await drain()) throw new Error("picker_ca_pending_untrust");
|
|
14
|
-
const ca =
|
|
15
|
+
const ca = await withConfigDirHardeningSettled(options.configDir, () =>
|
|
16
|
+
ensurePickerCa(options.configDir, { rotation: "startup", persistent: true, store: options.store }));
|
|
15
17
|
if (!await drain()) throw new Error("picker_ca_pending_untrust");
|
|
16
18
|
return ca;
|
|
17
19
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname } from "node:path";
|
|
7
|
+
import { withConfigDirHardeningSettled } from "../../config/paths";
|
|
7
8
|
import { nativeOpenAiContextWindow, type NativeContextLimitsInput } from "../../codex/catalog";
|
|
8
9
|
import type { OcxClaudeDesktopProfile } from "../../types";
|
|
9
10
|
import { aliasForRoute, claudeCodeNativeAlias } from "../alias";
|
|
@@ -137,9 +138,11 @@ export function createPickerModelSnapshot(
|
|
|
137
138
|
const models = build(await load());
|
|
138
139
|
const next = { models, builtAt: Date.now() };
|
|
139
140
|
if (persistPath) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
await withConfigDirHardeningSettled(dirname(persistPath), () => {
|
|
142
|
+
mkdirSync(dirname(persistPath), { recursive: true, mode: 0o700 });
|
|
143
|
+
writeFileSync(persistPath, JSON.stringify(next), { encoding: "utf8", mode: 0o600 });
|
|
144
|
+
chmodSync(persistPath, 0o600);
|
|
145
|
+
});
|
|
143
146
|
}
|
|
144
147
|
snapshot = next;
|
|
145
148
|
} catch { /* Keep the last good snapshot when discovery or persistence fails. */ }
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { join } from "node:path";
|
|
17
17
|
import type { OcxConfig } from "../../types";
|
|
18
|
+
import { withConfigDirHardeningSettled } from "../../config/paths";
|
|
18
19
|
import type { ClaudeDesktopMode } from "../desktop-first-party";
|
|
19
20
|
import { supportsDesktopPicker } from "../desktop-picker-platform";
|
|
20
21
|
import type { TunnelDecision } from "./connect-proxy";
|
|
@@ -170,8 +171,8 @@ export function createPickerRuntime(options: CreatePickerRuntimeOptions): Picker
|
|
|
170
171
|
if (!ca || !leaf || !caSha1) {
|
|
171
172
|
ca = options.persistentAuthority
|
|
172
173
|
? await preparePersistentPickerAuthority({ configDir: options.configDir, store: options.persistentAuthority.store, security: options.security, platform })
|
|
173
|
-
: ensurePickerCa(options.configDir);
|
|
174
|
-
leaf = issuePickerLeaf(ca
|
|
174
|
+
: await withConfigDirHardeningSettled(options.configDir, () => ensurePickerCa(options.configDir));
|
|
175
|
+
leaf = await withConfigDirHardeningSettled(options.configDir, () => issuePickerLeaf(ca!, options.configDir));
|
|
175
176
|
caSha1 = pickerCaFingerprints(ca.certPem).sha1;
|
|
176
177
|
}
|
|
177
178
|
return { ca, leaf, sha1: caSha1 };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Server } from "bun";
|
|
2
2
|
import { supportsDesktopPicker } from "../desktop-picker-platform";
|
|
3
3
|
import type { OcxConfig } from "../../types";
|
|
4
|
-
import { getConfigDir } from "../../config/paths";
|
|
4
|
+
import { getConfigDir, withConfigDirHardeningSettled } from "../../config/paths";
|
|
5
|
+
import { claudeConfigDir } from "../auth-detect";
|
|
5
6
|
import type { DesktopPickerController } from "../desktop-picker";
|
|
6
7
|
import type { ClaudeFirstPartyDesired } from "../first-party-settings";
|
|
7
8
|
import { classifyInterceptClient, interceptRouteFor } from "./client-class";
|
|
@@ -149,7 +150,7 @@ export async function startClaudeIntercept<T>(options: StartClaudeInterceptOptio
|
|
|
149
150
|
const configDir = options.configDir ?? getConfigDir();
|
|
150
151
|
const ca = await ensureLocalInterceptCaForStartup(configDir);
|
|
151
152
|
const startProxy = options.startProxy ?? startConnectProxy;
|
|
152
|
-
const authToken = ensureClaudeInterceptProxyToken(configDir);
|
|
153
|
+
const authToken = await withConfigDirHardeningSettled(configDir, () => ensureClaudeInterceptProxyToken(configDir));
|
|
153
154
|
const leaf = issueLocalInterceptLeaf(ca, CLAUDE_INTERCEPT_HOSTS);
|
|
154
155
|
const listener = startClaudeInterceptListener<T>({
|
|
155
156
|
leaf,
|
|
@@ -179,7 +180,9 @@ export async function startClaudeIntercept<T>(options: StartClaudeInterceptOptio
|
|
|
179
180
|
// fixed-port bind leaves settings untouched; an ephemeral test binder never publishes :0
|
|
180
181
|
// or a probed port another process can steal. Only stale, owned env blocks are rewritten.
|
|
181
182
|
try {
|
|
182
|
-
|
|
183
|
+
// Fresh admission after the bind await: a nested CLAUDE_CONFIG_DIR shares the config-root flight.
|
|
184
|
+
await withConfigDirHardeningSettled(claudeConfigDir(), () =>
|
|
185
|
+
migrateClaudeInterceptSettings(buildClaudeInterceptEnv(proxy.port, claudeInterceptCaCertPath(configDir), authToken)));
|
|
183
186
|
} catch (error) {
|
|
184
187
|
// Ensure/apply retries a skipped migration; upgraded clients otherwise keep hitting 407.
|
|
185
188
|
console.warn(`[claude-intercept] settings migration skipped: ${error instanceof Error ? error.message : String(error)}`);
|
package/src/claude/model-info.ts
CHANGED
|
@@ -45,8 +45,23 @@ function effortCapability(ladder: readonly string[]) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
function modelCapabilities(
|
|
49
|
-
|
|
48
|
+
function modelCapabilities(
|
|
49
|
+
ladder: readonly string[],
|
|
50
|
+
imageInput: boolean,
|
|
51
|
+
thinkingCapabilities?: Pick<CatalogModel, "supportsReasoning" | "supportsThinkingToggle" | "supportsReasoningEffort">,
|
|
52
|
+
) {
|
|
53
|
+
const reasoningSupported = thinkingCapabilities?.supportsReasoning !== false;
|
|
54
|
+
const discoveredEffort = effortCapability(ladder);
|
|
55
|
+
const effort = reasoningSupported && thinkingCapabilities?.supportsReasoningEffort !== false
|
|
56
|
+
? discoveredEffort
|
|
57
|
+
: effortCapability([]);
|
|
58
|
+
// Keep the old ladder projection only while the relevant axis is unknown. An explicit
|
|
59
|
+
// toggle proves `enabled`; a usable effort rung proves `adaptive`; neither implies the other.
|
|
60
|
+
// This lets clients select MiMo's enabled-only switch without inventing effort.
|
|
61
|
+
const adaptive = effort.supported;
|
|
62
|
+
const enabled = reasoningSupported && (thinkingCapabilities?.supportsThinkingToggle === true
|
|
63
|
+
|| (thinkingCapabilities?.supportsThinkingToggle === undefined && effort.supported));
|
|
64
|
+
const thinkingSupported = thinkingCapabilities?.supportsReasoning ?? (adaptive || enabled);
|
|
50
65
|
return {
|
|
51
66
|
batch: cap(false),
|
|
52
67
|
citations: cap(false),
|
|
@@ -57,12 +72,12 @@ function modelCapabilities(ladder: readonly string[], imageInput: boolean) {
|
|
|
57
72
|
clear_tool_uses_20250919: null,
|
|
58
73
|
compact_20260112: null,
|
|
59
74
|
},
|
|
60
|
-
effort
|
|
75
|
+
effort,
|
|
61
76
|
image_input: cap(imageInput),
|
|
62
77
|
pdf_input: cap(false),
|
|
63
78
|
structured_outputs: cap(false),
|
|
64
|
-
thinking:
|
|
65
|
-
? { supported: true, types: { adaptive: cap(
|
|
79
|
+
thinking: thinkingSupported
|
|
80
|
+
? { supported: true, types: { adaptive: cap(adaptive), enabled: cap(enabled) } }
|
|
66
81
|
: { supported: false, types: { adaptive: cap(false), enabled: cap(false) } },
|
|
67
82
|
};
|
|
68
83
|
}
|
|
@@ -88,13 +103,21 @@ export interface AnthropicModelInfo {
|
|
|
88
103
|
description?: string;
|
|
89
104
|
}
|
|
90
105
|
|
|
91
|
-
function modelInfo(
|
|
106
|
+
function modelInfo(
|
|
107
|
+
id: string,
|
|
108
|
+
displayName: string,
|
|
109
|
+
ladder: readonly string[],
|
|
110
|
+
imageInput: boolean,
|
|
111
|
+
contextWindow?: number,
|
|
112
|
+
description?: string,
|
|
113
|
+
thinkingCapabilities?: Pick<CatalogModel, "supportsReasoning" | "supportsThinkingToggle" | "supportsReasoningEffort">,
|
|
114
|
+
): AnthropicModelInfo {
|
|
92
115
|
return {
|
|
93
116
|
id,
|
|
94
117
|
display_name: displayName,
|
|
95
118
|
type: "model",
|
|
96
119
|
created_at: MODEL_INFO_CREATED_AT,
|
|
97
|
-
capabilities: modelCapabilities(ladder, imageInput),
|
|
120
|
+
capabilities: modelCapabilities(ladder, imageInput, thinkingCapabilities),
|
|
98
121
|
max_input_tokens: typeof contextWindow === "number" && contextWindow > 0 ? contextWindow : null,
|
|
99
122
|
max_tokens: null,
|
|
100
123
|
...(description === undefined ? {} : { description }),
|
|
@@ -242,7 +265,7 @@ export function buildAnthropicModelInfos(
|
|
|
242
265
|
: m.maxInputTokens)
|
|
243
266
|
: undefined;
|
|
244
267
|
const description = idStyle === "readable" ? `Routed by OpenCodex to ${m.provider}/${listedModelId}` : undefined;
|
|
245
|
-
const info = modelInfo(id, `${listedModelId} (${m.provider})`, ladder, imageInput, routedMaxInput ?? m.contextWindow, description);
|
|
268
|
+
const info = modelInfo(id, `${listedModelId} (${m.provider})`, ladder, imageInput, routedMaxInput ?? m.contextWindow, description, m);
|
|
246
269
|
out.push(info);
|
|
247
270
|
// Anthropic passthrough guard (audit 021 #3): never auto-widen canonical claude
|
|
248
271
|
// routes — only a genuine >=1M window earns the variant row there.
|
package/src/cli/account-api.ts
CHANGED
|
@@ -23,6 +23,9 @@ export interface AccountRow {
|
|
|
23
23
|
provider: string;
|
|
24
24
|
type: AccountType;
|
|
25
25
|
id: string;
|
|
26
|
+
slotId?: string;
|
|
27
|
+
slotKind?: "native-main" | "pool";
|
|
28
|
+
upstreamAccountKey?: string;
|
|
26
29
|
label?: string;
|
|
27
30
|
email?: string;
|
|
28
31
|
/**
|
|
@@ -329,6 +332,9 @@ export interface ProviderQuotaReportDto {
|
|
|
329
332
|
|
|
330
333
|
interface CodexAccountDto {
|
|
331
334
|
id: string;
|
|
335
|
+
slotId?: string;
|
|
336
|
+
slotKind?: "native-main" | "pool";
|
|
337
|
+
upstreamAccountKey?: string;
|
|
332
338
|
alias?: string;
|
|
333
339
|
email?: string;
|
|
334
340
|
plan?: string;
|
|
@@ -401,6 +407,11 @@ export async function fetchCodexRows(
|
|
|
401
407
|
provider: "openai",
|
|
402
408
|
type: "codex" as const,
|
|
403
409
|
id: a.id,
|
|
410
|
+
slotId: a.id,
|
|
411
|
+
slotKind: a.id === "__main__" ? "native-main" as const : "pool" as const,
|
|
412
|
+
...(a.slotId === a.id && typeof a.upstreamAccountKey === "string"
|
|
413
|
+
&& /^uai1_[0-9a-f]{64}$/.test(a.upstreamAccountKey)
|
|
414
|
+
? { upstreamAccountKey: a.upstreamAccountKey } : {}),
|
|
404
415
|
label: a.alias ?? a.plan ?? a.email,
|
|
405
416
|
email: a.email,
|
|
406
417
|
plan: a.plan,
|
|
@@ -385,13 +385,13 @@ export const AGENT_ROUTING_CAPABILITIES: readonly Capability[] = [
|
|
|
385
385
|
},
|
|
386
386
|
{
|
|
387
387
|
command: ["combo","set"],
|
|
388
|
-
usage: "ocx combo set <id> [--targets <provider/model[:weight],...> | --targets-file <FILE|->] [--strategy <failover|round-robin|random|least-used|reset-window|jev>] [--sticky <1-100|->] [--effort <low|medium|high|xhigh|max|ultra|->] [--effort-mode <fallback|force|->] [--alias <name|->] [--native-alias [on|off]] [--allow-metered-targets <on|off>] [--display-name <label|->] [--description <text|->] [--decision-provider <provider|-> | --decision-model <route|->] [--decision-timeout <ms|->] [--decision-quota-signals <on|off|->] [--decision-quota-tiers <JSON|->] [--rename-from <id>] [--image-input <auto|disabled>] [--reasoning-effort-mode <strict|adaptive>] [--json]",
|
|
388
|
+
usage: "ocx combo set <id> [--targets <provider/model[:weight],...> | --targets-file <FILE|->] [--strategy <failover|round-robin|random|least-used|reset-window|jev>] [--sticky <1-100|->] [--cooldown-reprobe <on|off>] [--cooldown-reprobe-interval <ms>] [--effort <low|medium|high|xhigh|max|ultra|->] [--effort-mode <fallback|force|->] [--alias <name|->] [--native-alias [on|off]] [--allow-metered-targets <on|off>] [--display-name <label|->] [--description <text|->] [--decision-provider <provider|-> | --decision-model <route|->] [--decision-timeout <ms|->] [--decision-quota-signals <on|off|->] [--decision-quota-tiers <JSON|->] [--session-pin <duration|->] [--rename-from <id>] [--image-input <auto|disabled>] [--reasoning-effort-mode <strict|adaptive>] [--json]",
|
|
389
389
|
summary: "Create, update or rename a combo.",
|
|
390
390
|
routes: [{"method":"GET","path":"/api/combos"},{"method":"PUT","path":"/api/combos"}],
|
|
391
|
-
flags: [{"name":"--allow-metered-targets","value":"string","summary":"on grants operator consent to metered targets only on a loopback-only proxy; off clears it."},{"name":"--targets","value":"string","summary":"Ordered provider/model[:weight] list; required for creation."},{"name":"--strategy","value":"string","summary":"Routing strategy."},{"name":"--sticky","value":"string","summary":"Round-robin limit 1-100; - resets."},{"name":"--effort","value":"string","summary":"Default effort; - clears."},{"name":"--effort-mode","value":"string","summary":"fallback or force; - resets to fallback."},{"name":"--alias","value":"string","summary":"Alias; - clears."},{"name":"--display-name","value":"string","summary":"Label; - clears."},{"name":"--description","value":"string","summary":"Catalog row description; - clears."},{"name":"--decision-provider","value":"string","summary":"JEV provider; - clears."},{"name":"--decision-model","value":"string","summary":"JEV route; - clears; exclusive with provider."},{"name":"--decision-timeout","value":"string","summary":"JEV deadline 1000-120000 ms; - clears."},{"name":"--decision-quota-signals","value":"string","summary":"JEV advisory quota on/off; - clears."},{"name":"--decision-quota-tiers","value":"string","summary":"Partial JSON thresholds; - clears."},{"name":"--rename-from","value":"string","summary":"Existing combo ID to rename."},{"name":"--json","value":"boolean","summary":"Emit structured JSON."},{"name":"--native-alias","value":"string","summary":"Bare legacy flag means on; explicit on/off preserves presence, including false."},{"name":"--targets-file","value":"string","summary":"Bounded ordered target JSON array, exclusive with --targets; preserves effort/profile/last-resort metadata."},{"name":"--image-input","value":"string","summary":"auto or disabled; explicit auto clears the previous disabled choice."},{"name":"--reasoning-effort-mode","value":"string","summary":"strict or adaptive, distinct from --effort-mode fallback/force."}],
|
|
391
|
+
flags: [{"name":"--allow-metered-targets","value":"string","summary":"on grants operator consent to metered targets only on a loopback-only proxy; off clears it."},{"name":"--targets","value":"string","summary":"Ordered provider/model[:weight] list; required for creation."},{"name":"--strategy","value":"string","summary":"Routing strategy."},{"name":"--sticky","value":"string","summary":"Round-robin limit 1-100; - resets."},{"name":"--cooldown-reprobe","value":"string","summary":"Opt into one recovery pass when all eligible targets cool; off by default."},{"name":"--cooldown-reprobe-interval","value":"string","summary":"Minimum interval between recovery passes in ms (1000..86400000); default 300000."},{"name":"--effort","value":"string","summary":"Default effort; - clears."},{"name":"--effort-mode","value":"string","summary":"fallback or force; - resets to fallback."},{"name":"--alias","value":"string","summary":"Alias; - clears."},{"name":"--display-name","value":"string","summary":"Label; - clears."},{"name":"--description","value":"string","summary":"Catalog row description; - clears."},{"name":"--decision-provider","value":"string","summary":"JEV provider; - clears."},{"name":"--decision-model","value":"string","summary":"JEV route; - clears; exclusive with provider."},{"name":"--decision-timeout","value":"string","summary":"JEV deadline 1000-120000 ms; - clears."},{"name":"--decision-quota-signals","value":"string","summary":"JEV advisory quota on/off; - clears."},{"name":"--decision-quota-tiers","value":"string","summary":"Partial JSON thresholds; - clears."},{"name":"--session-pin","value":"string","summary":"JEV session pin idle window 1m-24h (90s, 20m, 1h); - clears."},{"name":"--rename-from","value":"string","summary":"Existing combo ID to rename."},{"name":"--json","value":"boolean","summary":"Emit structured JSON."},{"name":"--native-alias","value":"string","summary":"Bare legacy flag means on; explicit on/off preserves presence, including false."},{"name":"--targets-file","value":"string","summary":"Bounded ordered target JSON array, exclusive with --targets; preserves effort/profile/last-resort metadata."},{"name":"--image-input","value":"string","summary":"auto or disabled; explicit auto clears the previous disabled choice."},{"name":"--reasoning-effort-mode","value":"string","summary":"strict or adaptive, distinct from --effort-mode fallback/force."}],
|
|
392
392
|
mutates: true,
|
|
393
393
|
json: "payload",
|
|
394
|
-
details: ["create and update are aliases of set. Existing fields are read before writing; --targets replaces targets.","force overrides valid client effort and may increase cost and latency.","Only the implemented target grammar is supported; full GUI target metadata and routing-profile writes are separate tasks.","New file/flag conflicts refuse before transport. Partial edits preserve target metadata; explicit false/default values override server carry. Turning a native alias off may also require clearing its incompatible alias.","Read/merge/write uses one target and remains an upsert without revision CAS. Saved-but-incomplete catalog outcomes return nonzero with their receipt."],
|
|
394
|
+
details: ["create and update are aliases of set. Existing fields are read before writing; --targets replaces targets. Without --strategy an existing combo keeps its stored strategy and JEV policy; a new combo defaults to failover.","force overrides valid client effort and may increase cost and latency.","Only the implemented target grammar is supported; full GUI target metadata and routing-profile writes are separate tasks.","New file/flag conflicts refuse before transport. Partial edits preserve target metadata; explicit false/default values override server carry. Turning a native alias off may also require clearing its incompatible alias.","Read/merge/write uses one target and remains an upsert without revision CAS. Saved-but-incomplete catalog outcomes return nonzero with their receipt."],
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
397
|
command: ["combo", "remove"],
|
|
@@ -738,10 +738,16 @@ export const CAPABILITIES: readonly Capability[] = [
|
|
|
738
738
|
{ name: "--restart-codex", value: "boolean", summary: "Restart the Codex app-servers and fully quit and relaunch the Codex desktop app after a catalog, cache, or changed configuration write, on macOS, Linux and Windows." },
|
|
739
739
|
{ name: "--restart-app-server-only", value: "boolean", summary: "Restart only the Codex app-servers and leave the desktop app running; wins over --restart-codex when both are given." },
|
|
740
740
|
{ name: "--restart-desktop-app", value: "boolean", summary: "Deprecated alias of --restart-codex." },
|
|
741
|
+
{ name: "--expect-link", value: "string", summary: "Sync only when this machine is a connected Remote Link Child of this link id; otherwise exit 5 with nothing changed." },
|
|
742
|
+
{ name: "--expect-hub-key", value: "string", summary: "Sync only when this machine is a hub client connected with this API key id; otherwise exit 5 with nothing changed." },
|
|
741
743
|
],
|
|
742
744
|
mutates: true,
|
|
743
745
|
json: "none",
|
|
744
|
-
details: [
|
|
746
|
+
details: [
|
|
747
|
+
"The Aside refresh uses the live server; other catalog synchronization also performs local work.",
|
|
748
|
+
"--expect-link/--expect-hub-key are checked under the lock that selects the sync path. A mismatch writes nothing, never falls back to local providers, exits 5, and ends stderr with {\"phase\":\"child_link_mismatch\"|\"hub_client_mismatch\",\"reason\":...}; reasons are disconnected, invalid_state, disconnect_pending, pending_operation, hub_client, link_client, other_link and other_key. Usage errors exit 2.",
|
|
749
|
+
],
|
|
750
|
+
usage: "ocx sync [--expect-link <linkId> | --expect-hub-key <apiKeyId>] [--restart-codex] [--restart-app-server-only]",
|
|
745
751
|
},
|
|
746
752
|
{
|
|
747
753
|
command: ["agent","subagents","force"],
|
|
@@ -2,6 +2,16 @@ import type { Capability } from "./capability-types";
|
|
|
2
2
|
|
|
3
3
|
/** Verified existing handlers only; local operations never claim management routes. */
|
|
4
4
|
export const OBSERVE_SYSTEM_CAPABILITIES: readonly Capability[] = [
|
|
5
|
+
{
|
|
6
|
+
command: ["stop"],
|
|
7
|
+
usage: "ocx stop [--json]",
|
|
8
|
+
summary: "Stop the proxy; preserve connected-client integrations, restore native Codex config for standalone owners.",
|
|
9
|
+
routes: [{ method: "GET", path: "/api/stop" }, { method: "POST", path: "/api/stop" }],
|
|
10
|
+
flags: [{ name: "--json", value: "boolean", summary: "Emit one structured stop summary; human output moves to stderr." }],
|
|
11
|
+
mutates: true,
|
|
12
|
+
json: "envelope",
|
|
13
|
+
details: ["Connected clients verify runtime preservation support before stopping; unavailable or unsupported live targets refuse without stopping the service. Proven-stopped clients remain successful when the manager is inactive.", "Siblings and connected clients preserve shared integrations. Standalone owners restore native Codex configuration and remove the managed Grok block.", "JSON uses ocx-stop/1 and retains the same exit codes: 0, 1, 79 (history cleanup incomplete), 80 (teardown deferred)."],
|
|
14
|
+
},
|
|
5
15
|
{"command": ["logs", "filter"], "summary": "Select a bounded log snapshot with dashboard filters.", "usage": "ocx logs filter [--surface <all|codex|claude|grok>] [--model <id>] [--provider <name>] [--status <all|success|errors>] [--time-window <all|15m|1h|24h>] [--min-tok-per-sec <n>] [--max-tok-per-sec <n>] [--intercepted-only] [--protocol-mode <all|native|translated|legacy-bridge|blocked|none>] [--conversation <id>] [--scan-limit <1-2000>] [--limit <1-2000>] [--json|--jsonl]", "routes": [{"method": "GET", "path": "/api/logs"}], "flags": [{"name": "--surface", "value": "string", "summary": "all | codex | claude | grok."}, {"name": "--model", "value": "string", "summary": "Case-insensitive exact identity across requested, resolved, served and attempted models."}, {"name": "--provider", "value": "string", "summary": "Case-insensitive provider or failover attempt identity."}, {"name": "--status", "value": "string", "summary": "all | success (200-299) | errors (400-599)."}, {"name": "--time-window", "value": "string", "summary": "all | 15m | 1h | 24h, relative to observation time."}, {"name": "--min-tok-per-sec", "value": "number", "summary": "Inclusive minimum observed token speed."}, {"name": "--max-tok-per-sec", "value": "number", "summary": "Exclusive maximum observed token speed."}, {"name": "--intercepted-only", "value": "boolean", "summary": "Rows carrying an observed rewrite marker."}, {"name": "--protocol-mode", "value": "string", "summary": "all | native | translated | legacy-bridge | blocked | none."}, {"name": "--conversation", "value": "string", "summary": "Conversation ID or stored hash."}, {"name": "--conversationId", "value": "string", "summary": "Alias of --conversation."}, {"name": "--scan-limit", "value": "number", "summary": "1-2000 raw rows inspected; default 2000."}, {"name": "--limit", "value": "number", "summary": "1-2000 matching rows returned; default 200."}, {"name": "--json", "value": "boolean", "summary": "Versioned view with filters, cursor and observed-window counts."}, {"name": "--jsonl", "value": "boolean", "summary": "Matching rows only; exclusive with --json."}], "mutates": false, "json": "envelope", "details": ["One snapshot: filters run locally over the raw server window before the output limit. No follow/events; existing logs behavior remains available.", "JSON schemaVersion1 reports scanLimit, loaded, matched, returned and limit for this observed window only. Cursor is not a resumable filter token.", "Empty matches succeed; malformed, refused, oversized or unavailable responses fail. SIGINT130/SIGTERM143 preserve cancellation."]},
|
|
6
16
|
{"command": ["observe", "logs", "filter"], "summary": "Select a bounded log snapshot with dashboard filters.", "usage": "ocx observe logs filter [--surface <all|codex|claude|grok>] [--model <id>] [--provider <name>] [--status <all|success|errors>] [--time-window <all|15m|1h|24h>] [--min-tok-per-sec <n>] [--max-tok-per-sec <n>] [--intercepted-only] [--protocol-mode <all|native|translated|legacy-bridge|blocked|none>] [--conversation <id>] [--scan-limit <1-2000>] [--limit <1-2000>] [--json|--jsonl]", "routes": [{"method": "GET", "path": "/api/logs"}], "flags": [{"name": "--surface", "value": "string", "summary": "all | codex | claude | grok."}, {"name": "--model", "value": "string", "summary": "Case-insensitive exact identity across requested, resolved, served and attempted models."}, {"name": "--provider", "value": "string", "summary": "Case-insensitive provider or failover attempt identity."}, {"name": "--status", "value": "string", "summary": "all | success (200-299) | errors (400-599)."}, {"name": "--time-window", "value": "string", "summary": "all | 15m | 1h | 24h, relative to observation time."}, {"name": "--min-tok-per-sec", "value": "number", "summary": "Inclusive minimum observed token speed."}, {"name": "--max-tok-per-sec", "value": "number", "summary": "Exclusive maximum observed token speed."}, {"name": "--intercepted-only", "value": "boolean", "summary": "Rows carrying an observed rewrite marker."}, {"name": "--protocol-mode", "value": "string", "summary": "all | native | translated | legacy-bridge | blocked | none."}, {"name": "--conversation", "value": "string", "summary": "Conversation ID or stored hash."}, {"name": "--conversationId", "value": "string", "summary": "Alias of --conversation."}, {"name": "--scan-limit", "value": "number", "summary": "1-2000 raw rows inspected; default 2000."}, {"name": "--limit", "value": "number", "summary": "1-2000 matching rows returned; default 200."}, {"name": "--json", "value": "boolean", "summary": "Versioned view with filters, cursor and observed-window counts."}, {"name": "--jsonl", "value": "boolean", "summary": "Matching rows only; exclusive with --json."}], "mutates": false, "json": "envelope", "details": ["One snapshot: filters run locally over the raw server window before the output limit. No follow/events; existing logs behavior remains available.", "JSON schemaVersion1 reports scanLimit, loaded, matched, returned and limit for this observed window only. Cursor is not a resumable filter token.", "Empty matches succeed; malformed, refused, oversized or unavailable responses fail. SIGINT130/SIGTERM143 preserve cancellation."]},
|
|
7
17
|
{"command": ["companion", "usage"], "summary": "Read today and 30-day totals using saved companion filters.", "usage": "ocx companion usage [--json]", "routes": [{"method": "GET", "path": "/api/companion/settings"}, {"method": "GET", "path": "/api/usage"}], "flags": [{"name": "--json", "value": "boolean", "summary": "Versioned filtered ranges, settings provenance and partial status."}], "mutates": false, "json": "envelope", "details": ["Reads saved settings then two usage ranges on the same runtime; this is not an atomic snapshot. No connected-client management relay or local fallback.", "Preserves null/default/corrupt settings provenance, missing measurements and incomplete reports. Filters follow saved model and hidden-provider preferences.", "Any unavailable range yields partial:true and exit1 while preserving the other result. Both available yields exit0 even when incomplete. SIGINT130/SIGTERM143 emit no late report."]},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { recordCommittedDesktopGateway } from "../claude/desktop-gateway-state";
|
|
2
2
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import { getConfigDir } from "../config/paths";
|
|
4
|
+
import { getConfigDir, withConfigDirHardeningSettled } from "../config/paths";
|
|
5
5
|
import { loadConfig, mutatePersistedConfig, withConfigMutationLockSync } from "../config";
|
|
6
6
|
import { claudeDesktopIntegrationEnabledNow, setIntegrationEnabled } from "../codex/desired-state";
|
|
7
7
|
import { readClientConnectionState, assertClientConnectionUnchanged, assertNoClientDisconnectPending, type ClientConnectionState } from "../client/state";
|
|
@@ -19,12 +19,12 @@ import {
|
|
|
19
19
|
} from "../claude/desktop-profile";
|
|
20
20
|
import { inspectDesktop3pConfigLibrary, removeDesktop3pStandardPivot, writeDesktop3pConfig, type Desktop3pConfigMode, parseDesktop3pModeArgs } from "../claude/desktop-3p";
|
|
21
21
|
import {
|
|
22
|
-
applyDesktopFirstParty,
|
|
22
|
+
applyDesktopFirstParty, withFirstPartySecretsSettled,
|
|
23
23
|
captureDesktopFirstPartyRollback,
|
|
24
24
|
isClaudeDesktopMode,
|
|
25
25
|
observeClaudeDesktopMode,
|
|
26
26
|
recordClaudeDesktopMode,
|
|
27
|
-
removeDesktopFirstParty,
|
|
27
|
+
removeDesktopFirstParty, removeDesktopFirstPartySettled,
|
|
28
28
|
resolveClaudeDesktopMode,
|
|
29
29
|
resolveClaudeDesktopApplyMode,
|
|
30
30
|
type ClaudeDesktopModeObservation,
|
|
@@ -99,6 +99,7 @@ type DesktopApplyResult = {
|
|
|
99
99
|
warning?: string;
|
|
100
100
|
picker?: DesktopPickerStatus;
|
|
101
101
|
delegated?: boolean;
|
|
102
|
+
diagnostic?: import("../claude/desktop-first-party").InterceptSecretDiagnostic;
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
type PickerRouteResponse = {
|
|
@@ -155,7 +156,7 @@ async function trustPickerLocally(
|
|
|
155
156
|
): Promise<{ ok: true; callerAddedTrust: boolean; caPath: string; sha1: string } | { ok: false; reason: string }> {
|
|
156
157
|
try {
|
|
157
158
|
const configDir = getConfigDir();
|
|
158
|
-
const paths = pickerTrustPaths(deps, configDir);
|
|
159
|
+
const paths = await withConfigDirHardeningSettled(configDir, () => pickerTrustPaths(deps, configDir));
|
|
159
160
|
if (!acceptsPickerAuthority(paths.certPem)) return { ok: false, reason: "ca_unverified" };
|
|
160
161
|
if (!deps.ensurePickerCaImpl) {
|
|
161
162
|
// The bytes in ca.pem are only safe to trust when they match the authority the running
|
|
@@ -426,14 +427,14 @@ async function applyFirstPartyDesktop(
|
|
|
426
427
|
// Establish the replacement before deleting the working gateway. A refused
|
|
427
428
|
// cleanup restores only our managed env keys, preserving unrelated settings.
|
|
428
429
|
const rollback = captureDesktopFirstPartyRollback(config);
|
|
429
|
-
const applied = applyDesktopFirstParty(config);
|
|
430
|
-
if (!applied.ok) return { ok: false, path: applied.path, reason: applied.reason };
|
|
430
|
+
const applied = await withFirstPartySecretsSettled(getConfigDir(), () => applyDesktopFirstParty(config));
|
|
431
|
+
if (!applied.ok) return { ok: false, path: applied.path, reason: applied.reason, ...(applied.diagnostic ? { diagnostic: applied.diagnostic } : {}) };
|
|
431
432
|
const appliedFingerprint = config.claudeCode?.desktopProfile?.appliedFingerprint ?? null;
|
|
432
433
|
const library = inspectDesktop3pConfigLibrary({ appliedFingerprint });
|
|
433
434
|
if (library.kind === "gateway_ours" || library.kind === "gateway_drifted") {
|
|
434
435
|
const removed = removeDesktop3pStandardPivot({ appliedFingerprint, replaceWhileEnabled: true });
|
|
435
436
|
if (!removed.ok) {
|
|
436
|
-
const restored = removed.changed || !applied.changed ||
|
|
437
|
+
const restored = removed.changed || !applied.changed || await withConfigDirHardeningSettled(getConfigDir(), rollback);
|
|
437
438
|
const modeSaved = !removed.changed || saveDesktopMode("first-party", deps);
|
|
438
439
|
const warning = [restored ? "" : "first-party settings rollback did not complete",
|
|
439
440
|
modeSaved ? "" : "first-party is active but its mode marker was not saved"].filter(Boolean).join("; ");
|
|
@@ -462,7 +463,7 @@ export async function applyDesktop(
|
|
|
462
463
|
const modeSaved = saveDesktopMode("gateway", deps);
|
|
463
464
|
const warning = [result.warning, modeSaved ? "" : "desktop mode marker was not saved"].filter(Boolean).join(" ");
|
|
464
465
|
// The gateway mode is committed before retiring first-party settings.
|
|
465
|
-
const removed =
|
|
466
|
+
const removed = await removeDesktopFirstPartySettled(loadConfig);
|
|
466
467
|
if (!removed.ok) return { ok: false, path: removed.path, reason: "first_party_settings_unreadable",
|
|
467
468
|
warning: ["gateway applied; first-party cleanup remains incomplete", warning].filter(Boolean).join(" ") };
|
|
468
469
|
if (removed.retainedFor === "cli") {
|
package/src/cli/claude.ts
CHANGED
|
@@ -32,7 +32,7 @@ import { DEFAULT_CATALOG_PATH } from "../codex/paths";
|
|
|
32
32
|
import { readFileSync } from "node:fs";
|
|
33
33
|
import { join } from "node:path";
|
|
34
34
|
import { aliasForNative, aliasForRoute, legacyAliasForNative, legacyAliasForRoute } from "../claude/alias";
|
|
35
|
-
import { desktop3pAlias, isRealDesktop3pModelId, resolveDesktop3pAlias } from "../claude/desktop-3p";
|
|
35
|
+
import { desktop3pAlias, isRealDesktop3pModelId, legacyDesktop3pAlias, resolveDesktop3pAlias } from "../claude/desktop-3p";
|
|
36
36
|
import { desktopProfileWireAlias, legacyDesktopProfileWireAlias } from "../claude/desktop-profile";
|
|
37
37
|
import { inspectDesktopFirstParty } from "../claude/desktop-first-party";
|
|
38
38
|
import { isClaudeInterceptProxyUrl, type ClaudeInterceptSettingsState } from "../claude/intercept/settings";
|
|
@@ -633,7 +633,8 @@ export function nativeClaudeModelIds(config: OcxConfig): string[] {
|
|
|
633
633
|
const alias = assignments[route]!.alias;
|
|
634
634
|
const slash = route.indexOf("/");
|
|
635
635
|
return [alias, desktopProfileWireAlias(alias), legacyDesktopProfileWireAlias(alias),
|
|
636
|
-
desktop3pAlias(route.slice(0, slash), route.slice(slash + 1))
|
|
636
|
+
desktop3pAlias(route.slice(0, slash), route.slice(slash + 1)),
|
|
637
|
+
legacyDesktop3pAlias(route.slice(0, slash), route.slice(slash + 1))];
|
|
637
638
|
}));
|
|
638
639
|
// The configured default is a genuine declaration too: the catalog seeds it for static
|
|
639
640
|
// providers, so it must be recognized here even without a server registry.
|