@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.
Files changed (360) hide show
  1. package/bin/ocx.mjs +47 -8
  2. package/gui/dist/assets/App-CJZoq-uF.js +58 -0
  3. package/gui/dist/assets/{Tray-BuLy7hL1.js → Tray-BWQPcgZn.js} +1 -1
  4. package/gui/dist/assets/index-DRe8Hhfz.css +1 -0
  5. package/gui/dist/assets/index-Xfct8owH.js +94 -0
  6. package/gui/dist/assets/quota-summary-DxToX1rV.js +1 -0
  7. package/gui/dist/index.html +2 -2
  8. package/gui/dist/provider-icons/workbuddy-color.svg +29 -0
  9. package/package.json +8 -7
  10. package/src/adapters/anthropic.ts +28 -5
  11. package/src/adapters/coding-agent/batch-dispatcher.ts +122 -0
  12. package/src/adapters/coding-agent/profile.ts +54 -16
  13. package/src/adapters/coding-agent/turn.ts +30 -2
  14. package/src/adapters/command-code.ts +114 -7
  15. package/src/adapters/cursor/native-exec-fs.ts +11 -9
  16. package/src/adapters/devin/live-models.ts +4 -0
  17. package/src/adapters/google-vertex-endpoint.ts +9 -1
  18. package/src/adapters/google-vertex-key-project.ts +223 -0
  19. package/src/adapters/google-wire-compiler.ts +1 -2
  20. package/src/adapters/google.ts +13 -3
  21. package/src/adapters/kiro/reasoning.ts +2 -0
  22. package/src/adapters/kiro-refusal.ts +6 -1
  23. package/src/adapters/kiro-wire.ts +1 -1
  24. package/src/adapters/openai-chat/messages.ts +8 -2
  25. package/src/adapters/openai-chat/passthrough.ts +35 -14
  26. package/src/adapters/openai-chat/reasoning-replay.ts +27 -16
  27. package/src/adapters/openai-chat/reasoning-wire.ts +117 -8
  28. package/src/adapters/openai-chat/required-tool-result.ts +64 -0
  29. package/src/adapters/openai-chat/tool-name-registry.ts +3 -1
  30. package/src/adapters/openai-chat.ts +9 -10
  31. package/src/adapters/openai-responses/passthrough.ts +7 -4
  32. package/src/adapters/openai-responses/reasoning.ts +13 -0
  33. package/src/adapters/openai-responses/request-strips.ts +60 -0
  34. package/src/adapters/qoder/adapter.ts +129 -8
  35. package/src/adapters/qoder/scaffold-guard.ts +5 -0
  36. package/src/adapters/reasoning-controls.ts +16 -0
  37. package/src/adapters/registry.ts +5 -0
  38. package/src/adapters/tool-call-id.ts +1 -3
  39. package/src/adapters/workbuddy-schema.ts +61 -0
  40. package/src/adapters/workbuddy.ts +68 -0
  41. package/src/bridge/errors.ts +27 -0
  42. package/src/bridge/response-json.ts +1 -1
  43. package/src/bridge/sse.ts +1 -1
  44. package/src/bridge.ts +1 -1
  45. package/src/chat/inbound.ts +4 -1
  46. package/src/chat/outbound.ts +20 -6
  47. package/src/chat/reasoning-details.ts +28 -5
  48. package/src/claude/desktop-first-party.ts +54 -4
  49. package/src/claude/desktop-picker.ts +11 -8
  50. package/src/claude/first-party-settings.ts +3 -1
  51. package/src/claude/inbound.ts +2 -1
  52. package/src/claude/intercept/local-ca.ts +2 -1
  53. package/src/claude/intercept/picker-ca-cleanup.ts +4 -2
  54. package/src/claude/intercept/picker-ca-startup.ts +3 -1
  55. package/src/claude/intercept/picker-models.ts +6 -3
  56. package/src/claude/intercept/picker-runtime.ts +3 -2
  57. package/src/claude/intercept/runtime.ts +6 -3
  58. package/src/claude/model-info.ts +31 -8
  59. package/src/cli/account-api.ts +11 -0
  60. package/src/cli/capabilities-agents-routing.ts +3 -3
  61. package/src/cli/capabilities-base.ts +7 -1
  62. package/src/cli/capabilities-observe-system.ts +10 -0
  63. package/src/cli/claude-desktop.ts +9 -8
  64. package/src/cli/claude.ts +3 -2
  65. package/src/cli/codex-cli-update.ts +8 -0
  66. package/src/cli/codex-shim-autorestore.ts +9 -0
  67. package/src/cli/combo-result.ts +13 -0
  68. package/src/cli/combo-stats.ts +3 -0
  69. package/src/cli/combo.ts +83 -41
  70. package/src/cli/cross-home-owner.ts +13 -1
  71. package/src/cli/dispatch.ts +25 -6
  72. package/src/cli/ensure-desired-integrations.ts +8 -6
  73. package/src/cli/export-command.ts +4 -1
  74. package/src/cli/help.ts +2 -1
  75. package/src/cli/index.ts +45 -45
  76. package/src/cli/integration-plan-dto.ts +4 -0
  77. package/src/cli/launcher-context.ts +49 -2
  78. package/src/cli/link.ts +45 -32
  79. package/src/cli/opencode.ts +20 -9
  80. package/src/cli/provider.ts +2 -1
  81. package/src/cli/registry.ts +6 -4
  82. package/src/cli/root.ts +9 -0
  83. package/src/cli/status.ts +59 -1
  84. package/src/cli/stop-restore.ts +113 -0
  85. package/src/cli/sync-expectation.ts +60 -0
  86. package/src/cli/uninstall-integrations.ts +41 -7
  87. package/src/cli/usage-compare.ts +68 -12
  88. package/src/client/connect.ts +40 -3
  89. package/src/client/link-home.ts +10 -1
  90. package/src/client/link-ingress.ts +1 -1
  91. package/src/client/link-readiness.ts +97 -0
  92. package/src/client/link-relay-transport.ts +79 -11
  93. package/src/client/link-relay.ts +74 -15
  94. package/src/client/link-tunnel.ts +45 -18
  95. package/src/client/machine-api.ts +3 -1
  96. package/src/client/machine-listener.ts +20 -2
  97. package/src/client/runtime.ts +20 -2
  98. package/src/client/sync-expectation.ts +118 -0
  99. package/src/clients/config-export/agent-clients.ts +96 -0
  100. package/src/clients/config-export/contracts.ts +25 -7
  101. package/src/clients/config-export/qoder.ts +38 -23
  102. package/src/clients/config-export/reasoning-metadata.ts +55 -8
  103. package/src/clients/config-export.ts +12 -0
  104. package/src/clients/lazycodex.ts +7 -2
  105. package/src/clients/reasoning-controls.ts +49 -0
  106. package/src/codex/account-store.ts +17 -3
  107. package/src/codex/app-server-restart-service.ts +6 -5
  108. package/src/codex/auth-api/account-identity.ts +14 -0
  109. package/src/codex/auth-api/account-list.ts +29 -2
  110. package/src/codex/auth-api/http.ts +13 -0
  111. package/src/codex/auth-api/main-account-probe.ts +2 -2
  112. package/src/codex/auth-api/pool-mode-gate.ts +16 -3
  113. package/src/codex/auth-api/pool-quota-probe.ts +15 -0
  114. package/src/codex/auth-context.ts +15 -12
  115. package/src/codex/catalog/build-entries.ts +22 -0
  116. package/src/codex/catalog/configured-tiers.ts +70 -0
  117. package/src/codex/catalog/effort.ts +52 -11
  118. package/src/codex/catalog/gather-capture.ts +5 -2
  119. package/src/codex/catalog/heal-observation.ts +155 -13
  120. package/src/codex/catalog/metadata.ts +6 -0
  121. package/src/codex/catalog/model-hints.ts +60 -11
  122. package/src/codex/catalog/model-visibility.ts +3 -2
  123. package/src/codex/catalog/native-models.ts +18 -3
  124. package/src/codex/catalog/parsing.ts +10 -8
  125. package/src/codex/catalog/pinned-models.ts +2 -1
  126. package/src/codex/catalog/provider-models.ts +18 -13
  127. package/src/codex/catalog/retained-sync.ts +2 -1
  128. package/src/codex/catalog/routed-gather.ts +19 -20
  129. package/src/codex/catalog/write-audit.ts +3 -2
  130. package/src/codex/catalog-self-heal.ts +43 -23
  131. package/src/codex/chatgpt-refresh-failure.ts +6 -2
  132. package/src/codex/cli-install-provenance.ts +418 -0
  133. package/src/codex/cli-installation-targets.ts +5 -1
  134. package/src/codex/cli-update-plan.ts +43 -16
  135. package/src/codex/collision-identity.ts +30 -5
  136. package/src/codex/convergence.ts +4 -3
  137. package/src/codex/data/roster-pinned-models.json +177 -1
  138. package/src/codex/desired-state.ts +6 -1
  139. package/src/codex/desktop-app/picker-freshness.ts +10 -8
  140. package/src/codex/desktop-compatibility/installed-build.ts +88 -12
  141. package/src/codex/desktop-compatibility/runtime.ts +29 -5
  142. package/src/codex/desktop-compatibility/usage-activation.ts +2 -1
  143. package/src/codex/desktop-compatibility/usage-controller.ts +9 -1
  144. package/src/codex/desktop-compatibility/windows-certificate-trust.ts +46 -12
  145. package/src/codex/inject/config-toml.ts +0 -18
  146. package/src/codex/inject/plan.ts +18 -3
  147. package/src/codex/inject/remove.ts +6 -2
  148. package/src/codex/inject.ts +1 -1
  149. package/src/codex/journal.ts +61 -1
  150. package/src/codex/model-entitlements.ts +1 -1
  151. package/src/codex/native-main-owner.ts +27 -1
  152. package/src/codex/native-profile-store.ts +2 -1
  153. package/src/codex/pool-credit-policy.ts +35 -1
  154. package/src/codex/pool-refresh-backoff.ts +3 -1
  155. package/src/codex/quota-types.ts +3 -0
  156. package/src/codex/quota.ts +24 -4
  157. package/src/codex/role-auto-assign.ts +6 -2
  158. package/src/codex/subagent-defaults.ts +49 -4
  159. package/src/codex/user-identity.ts +35 -6
  160. package/src/codex/windows-current-sid.ts +162 -0
  161. package/src/combos/failover.ts +17 -2
  162. package/src/combos/jev-decision-contract.ts +22 -1
  163. package/src/combos/jev-quota-activation.ts +5 -1
  164. package/src/combos/jev-quota-route.ts +1 -1
  165. package/src/combos/jev-quota.ts +9 -1
  166. package/src/combos/jev-service-exchange.ts +3 -1
  167. package/src/combos/jev-session-pin-config.ts +51 -0
  168. package/src/combos/jev.ts +101 -9
  169. package/src/combos/resolve.ts +45 -1
  170. package/src/combos/types.ts +43 -0
  171. package/src/config/load-degrade.ts +5 -0
  172. package/src/config/paths.ts +19 -3
  173. package/src/config/pending-teardown.ts +22 -1
  174. package/src/config/provider-validation.ts +22 -4
  175. package/src/config/removed-opencode-free.ts +11 -0
  176. package/src/config/schema/leaf-validators.ts +6 -0
  177. package/src/generated/compatibility-version.json +467 -311
  178. package/src/generated/model-metadata.ts +5 -5
  179. package/src/images/loop.ts +16 -2
  180. package/src/integrations/catalog-refresh.ts +1 -1
  181. package/src/integrations/hermes-profiles.ts +251 -0
  182. package/src/integrations/merge.ts +8 -0
  183. package/src/integrations/mutation-plan.ts +19 -4
  184. package/src/integrations/registry.ts +5 -0
  185. package/src/integrations/state.ts +36 -1
  186. package/src/integrations/writer.ts +18 -4
  187. package/src/lib/bun-path-runtime.mjs +2 -1
  188. package/src/lib/decision-quota-sink.ts +10 -0
  189. package/src/lib/errors.ts +62 -0
  190. package/src/lib/eventstream-decoder.ts +81 -37
  191. package/src/lib/opaque-proxy-tunnel.ts +32 -8
  192. package/src/lib/pinned-http.ts +35 -2
  193. package/src/lib/process-control.ts +13 -1
  194. package/src/lib/socks5-fetch.ts +59 -64
  195. package/src/lib/socks5-upload-waiter.ts +50 -0
  196. package/src/lib/sse-decoder.ts +7 -2
  197. package/src/lib/state-store-sweeper.ts +40 -14
  198. package/src/lib/translator-budget.ts +4 -4
  199. package/src/lib/upstream-retry.ts +4 -1
  200. package/src/lib/windows-native-principal-worker.ts +14 -0
  201. package/src/lib/windows-native-principal.ts +188 -0
  202. package/src/lib/windows-secret-acl.ts +39 -3
  203. package/src/lib/windows-user-principal.ts +62 -18
  204. package/src/link/diagnostics.ts +193 -0
  205. package/src/link/relay-auth.ts +6 -0
  206. package/src/link/ssh-config.ts +35 -3
  207. package/src/link/status-projection.ts +39 -0
  208. package/src/link/supervisor.ts +45 -12
  209. package/src/link/tunnel-history.ts +109 -0
  210. package/src/link/tunnel-state.ts +80 -17
  211. package/src/messaging/remote-files.ts +24 -1
  212. package/src/oauth/generic-account-failover.ts +91 -7
  213. package/src/oauth/index.ts +15 -0
  214. package/src/oauth/model-discovery-auth.ts +5 -0
  215. package/src/oauth/store.ts +4 -1
  216. package/src/oauth/token-guardian.ts +7 -0
  217. package/src/oauth/types.ts +9 -0
  218. package/src/oauth/workbuddy.ts +139 -0
  219. package/src/providers/account-quota-disk.ts +12 -4
  220. package/src/providers/antigravity-quota-identity.ts +37 -0
  221. package/src/providers/base-url-choices.ts +8 -5
  222. package/src/providers/codebuddy-models.ts +6 -0
  223. package/src/providers/codex-capacity.ts +3 -1
  224. package/src/providers/derive.ts +51 -3
  225. package/src/providers/kiro-models.ts +3 -0
  226. package/src/providers/mimo-thinking.ts +12 -0
  227. package/src/providers/model-discovery.ts +2 -0
  228. package/src/providers/model-rename-fields.ts +2 -0
  229. package/src/providers/model-rename-migration.ts +10 -0
  230. package/src/providers/openai-sidecar-credit.ts +2 -2
  231. package/src/providers/quota/account-cache.ts +3 -2
  232. package/src/providers/quota/antigravity.ts +25 -14
  233. package/src/providers/quota/report-cache.ts +13 -4
  234. package/src/providers/quota/vendor-probes-key.ts +60 -0
  235. package/src/providers/quota/workbuddy.ts +83 -0
  236. package/src/providers/quota-decision-antigravity.ts +64 -0
  237. package/src/providers/quota-decision-publication.ts +11 -0
  238. package/src/providers/quota-decision-snapshot.ts +21 -4
  239. package/src/providers/quota-types.ts +2 -0
  240. package/src/providers/quota.ts +3 -1
  241. package/src/providers/reasoning-capabilities.ts +76 -0
  242. package/src/providers/registry/entries-core.ts +23 -12
  243. package/src/providers/registry/entries-extended.ts +83 -27
  244. package/src/providers/registry/model-ids.ts +5 -0
  245. package/src/providers/registry/model-seeds.ts +120 -56
  246. package/src/providers/registry/types.ts +29 -2
  247. package/src/providers/resolved-model-policy.ts +30 -10
  248. package/src/providers/routed-config.ts +24 -1
  249. package/src/providers/stale-model-roster-migration.ts +123 -18
  250. package/src/providers/workbuddy-credit-balance.ts +81 -0
  251. package/src/providers/workbuddy-models.ts +37 -0
  252. package/src/providers/workbuddy.ts +60 -0
  253. package/src/remote-control/workspace-pi-runtime.ts +11 -6
  254. package/src/responses/compaction-summary.ts +45 -0
  255. package/src/responses/muse-tool-name-alias.ts +1 -2
  256. package/src/responses/parser.ts +3 -2
  257. package/src/responses/reasoning-replay-cache.ts +18 -14
  258. package/src/responses/schema.ts +1 -0
  259. package/src/responses/thought-signature-replay.ts +10 -2
  260. package/src/router.ts +2 -0
  261. package/src/routing/analytics.ts +2 -3
  262. package/src/routing/capability.ts +8 -2
  263. package/src/routing/fallback-policy.ts +3 -3
  264. package/src/routing/history/ingest.ts +28 -3
  265. package/src/server/auth-cors.ts +4 -2
  266. package/src/server/chat-completions.ts +21 -1
  267. package/src/server/chat-native-eligibility.ts +7 -0
  268. package/src/server/chat-native-reasoning.ts +24 -7
  269. package/src/server/chat-native.ts +13 -2
  270. package/src/server/claude-messages.ts +3 -0
  271. package/src/server/direct-local-http.ts +5 -2
  272. package/src/server/effort-policy.ts +5 -1
  273. package/src/server/index/link-relay-sessions.ts +9 -5
  274. package/src/server/index/live-sideband.ts +18 -15
  275. package/src/server/index/optional-listeners.ts +4 -0
  276. package/src/server/index/serve-options.ts +5 -4
  277. package/src/server/local-management-read-client.ts +3 -1
  278. package/src/server/management/agent-settings-routes.ts +27 -15
  279. package/src/server/management/combo-routes.ts +14 -4
  280. package/src/server/management/config-routes.ts +2 -2
  281. package/src/server/management/decision-discovery.ts +12 -2
  282. package/src/server/management/hermes-profile-routes.ts +156 -0
  283. package/src/server/management/integration-routes.ts +85 -24
  284. package/src/server/management/link-routes.ts +5 -2
  285. package/src/server/management/model-routes.ts +2 -2
  286. package/src/server/management/model-row-export-metadata.ts +25 -6
  287. package/src/server/management/model-rows.ts +15 -20
  288. package/src/server/management/native-integration-routes.ts +11 -8
  289. package/src/server/management/provider-routes.ts +1 -1
  290. package/src/server/management/route-registry.ts +4 -0
  291. package/src/server/management-api.ts +5 -0
  292. package/src/server/models-capabilities.ts +21 -3
  293. package/src/server/port-reclaim.ts +51 -9
  294. package/src/server/request-log-conversation.ts +49 -0
  295. package/src/server/request-log.ts +2 -0
  296. package/src/server/responses/adapter-delivery.ts +11 -1
  297. package/src/server/responses/adapter-dispatch.ts +2 -2
  298. package/src/server/responses/anthropic-thinking-recovery.ts +1 -0
  299. package/src/server/responses/codex-ws-exchange.ts +39 -9
  300. package/src/server/responses/codex-ws-session.ts +38 -4
  301. package/src/server/responses/codex-ws-wire.ts +6 -1
  302. package/src/server/responses/combo-required-tool-contract.ts +103 -0
  303. package/src/server/responses/combo-stream-preflight.ts +8 -1
  304. package/src/server/responses/compact.ts +14 -5
  305. package/src/server/responses/context-overflow.ts +8 -1
  306. package/src/server/responses/core-combo-failure.ts +10 -0
  307. package/src/server/responses/core-combo.ts +74 -44
  308. package/src/server/responses/core-lifetime.ts +5 -2
  309. package/src/server/responses/core-normalize.ts +17 -4
  310. package/src/server/responses/core-opaque-recovery.ts +1 -0
  311. package/src/server/responses/core-options.ts +7 -0
  312. package/src/server/responses/core-replay.ts +2 -1
  313. package/src/server/responses/jev-combo-choice.ts +39 -0
  314. package/src/server/responses/jev-session-pin.ts +203 -0
  315. package/src/server/responses/main-hard-lock-routing.ts +60 -44
  316. package/src/server/responses/passthrough-delivery.ts +44 -2
  317. package/src/server/responses/policy-fallback.ts +6 -1
  318. package/src/server/responses/request-compression.ts +12 -7
  319. package/src/server/responses/request-prepare.ts +32 -7
  320. package/src/server/responses/request-sidecar-auth.ts +2 -0
  321. package/src/server/responses/request-transport.ts +25 -6
  322. package/src/server/responses/response-effects.ts +22 -10
  323. package/src/server/responses/run-turn-execution.ts +2 -4
  324. package/src/server/responses/sidecar-execution.ts +13 -7
  325. package/src/server/responses-phase-inference.ts +267 -0
  326. package/src/server/sse-payload-rewrite.ts +14 -1
  327. package/src/server/stop-teardown.ts +36 -1
  328. package/src/server/ws-bridge.ts +1 -1
  329. package/src/service/definition.ts +20 -8
  330. package/src/service/desktop-supervision.d.mts +7 -4
  331. package/src/service/desktop-supervision.mjs +90 -13
  332. package/src/service/ownership-mutation-lease.mjs +21 -7
  333. package/src/types/config.ts +14 -2
  334. package/src/types/provider.ts +29 -7
  335. package/src/types/request.ts +11 -0
  336. package/src/types/wire.ts +1 -0
  337. package/src/types.ts +1 -0
  338. package/src/update/bind-probe.ts +29 -0
  339. package/src/update/codex-cli-update-launch-policy.d.mts +9 -0
  340. package/src/update/codex-cli-update-launch-policy.mjs +30 -0
  341. package/src/update/job.ts +10 -29
  342. package/src/update/npm-install-job.ps1 +173 -0
  343. package/src/update/npm-install.mjs +70 -0
  344. package/src/update/stop-contract.d.mts +1 -0
  345. package/src/update/stop-contract.mjs +14 -0
  346. package/src/update/stop-decision.d.mts +1 -1
  347. package/src/update/stop-decision.mjs +13 -3
  348. package/src/update/teardown-handover.ts +166 -0
  349. package/src/update/transactional-install.d.mts +14 -3
  350. package/src/update/transactional-install.mjs +33 -7
  351. package/src/usage/expected-prices.ts +64 -31
  352. package/src/usage/jev-stats.ts +54 -14
  353. package/src/usage/timeline.ts +19 -9
  354. package/src/vision/eligibility.ts +15 -5
  355. package/src/vision/plan.ts +2 -2
  356. package/src/web-search/loop.ts +16 -2
  357. package/gui/dist/assets/App-nZ34cR5G.js +0 -58
  358. package/gui/dist/assets/index-DGXS51sp.js +0 -94
  359. package/gui/dist/assets/index-DPeB9HpV.css +0 -1
  360. package/gui/dist/assets/quota-summary-DO1Sx5TM.js +0 -1
@@ -15,6 +15,8 @@ import {
15
15
  handleAsideProfileRoutes, asideJournalResponse, asideRestoreResponse,
16
16
  asideJournalDeleteResponse, type AsideProfileRouteOptions,
17
17
  } from "./aside-profile-routes";
18
+ import { hermesProfileListResponse, hermesRequestScope, scopeHermesProfileRequest } from "./hermes-profile-routes";
19
+ import { HermesProfileError } from "../../integrations/hermes-profiles";
18
20
  import type { IntegrationIO } from "../../integrations/config-io";
19
21
  import { createClineIO } from "../../integrations/cline-io";
20
22
  import { matchesOperationResult } from "../../integrations/journal";
@@ -79,6 +81,8 @@ export type IntegrationStateEnvelope = {
79
81
  models: Array<{ model: string; label: string; efforts: string[] }>;
80
82
  defaults: Record<string, string>;
81
83
  };
84
+ /** The Hermes profile a profile-scoped read describes (#7674). */
85
+ hermesProfile?: string;
82
86
  } & IntegrationStateRecord;
83
87
 
84
88
  export interface IntegrationStateListEnvelope {
@@ -181,6 +185,37 @@ function pathOverrides(): { env?: NodeJS.ProcessEnv; home?: string } {
181
185
  };
182
186
  }
183
187
 
188
+ /** A selected Hermes profile's environment and explicit target; nothing for any other request. */
189
+ function scopedPathOverrides(ctx: ManagementContext, clientId: IntegrationClientId): Pick<IntegrationWriteInput, "env" | "home" | "resolvedPaths"> {
190
+ const scope = clientId === "hermes" ? hermesRequestScope(ctx.req) : undefined;
191
+ return scope?.resolvedPaths ? { ...pathOverrides(), env: scope.env, resolvedPaths: { ...scope.resolvedPaths } } : pathOverrides();
192
+ }
193
+
194
+ /** Flight keys carry the profile, so a second profile is busy instead of joining the first one's write. */
195
+ function scopedFlightKey(ctx: ManagementContext, key: string): string {
196
+ const scope = hermesRequestScope(ctx.req);
197
+ return scope?.resolvedPaths ? `hermes-profile:${scope.profile.name}:${key}` : key;
198
+ }
199
+
200
+ /** A Hermes-scoped request may only ever see Hermes operations. */
201
+ function outsideHermesScope(ctx: ManagementContext, clientId: IntegrationClientId): boolean {
202
+ return hermesRequestScope(ctx.req) !== undefined && clientId !== "hermes";
203
+ }
204
+
205
+ /** The selected profile's boundary, as a writer refusal; null when it holds or nothing is pinned. */
206
+ function hermesBoundaryRefusal(ctx: ManagementContext): WriteRefused | null {
207
+ const scope = hermesRequestScope(ctx.req);
208
+ try {
209
+ scope?.assertBoundary();
210
+ return null;
211
+ } catch (error) {
212
+ return {
213
+ ok: false, reason: "unsafe", state: "unsafe", clientId: "hermes",
214
+ message: error instanceof Error ? error.message : "Hermes profile cannot be changed safely",
215
+ };
216
+ }
217
+ }
218
+
184
219
  function isPlainRecord(value: unknown): value is Record<string, unknown> {
185
220
  return typeof value === "object" && value !== null && !Array.isArray(value);
186
221
  }
@@ -221,8 +256,10 @@ export function setIntegrationMutationFlightTestHooks(
221
256
  * while handing the writer a separate default store, so a test could not bind
222
257
  * the whole operation to a temp root (A-gate round 12).
223
258
  */
224
- function integrationStore(): IntegrationStateStore {
225
- return integrationMutationTestHooks?.store ?? createIntegrationStateStore();
259
+ function integrationStore(ctx?: ManagementContext): IntegrationStateStore {
260
+ // A selected Hermes profile owns its own store; every other request keeps the root.
261
+ return (ctx ? hermesRequestScope(ctx.req)?.store : undefined)
262
+ ?? integrationMutationTestHooks?.store ?? createIntegrationStateStore();
226
263
  }
227
264
 
228
265
  function asideOptions(ctx: ManagementContext): AsideProfileRouteOptions {
@@ -256,7 +293,7 @@ async function buildIntegrationWriteInput(
256
293
  ...(droidReasoningDefaults === undefined ? {} : { droidReasoningDefaults: { ...droidReasoningDefaults } }),
257
294
  store,
258
295
  io: integrationMutationTestHooks?.io,
259
- ...pathOverrides(),
296
+ ...scopedPathOverrides(ctx, clientId),
260
297
  };
261
298
  }
262
299
 
@@ -288,7 +325,7 @@ async function buildIntegrationPreviewInput(
288
325
  ...(droidReasoningDefaults === undefined ? {} : { droidReasoningDefaults: { ...droidReasoningDefaults } }),
289
326
  store,
290
327
  io: integrationMutationTestHooks?.io,
291
- ...pathOverrides(),
328
+ ...scopedPathOverrides(ctx, clientId),
292
329
  },
293
330
  };
294
331
  }
@@ -328,7 +365,7 @@ function restoreClientScopeResponse(ctx: ManagementContext, opId: string, expect
328
365
  if (expectedClientId === undefined) return null;
329
366
  if (typeof expectedClientId !== "string" || !isIntegrationClientId(expectedClientId)) return invalidClientResponse(ctx);
330
367
  try {
331
- const operation = integrationStore().findOperation(opId);
368
+ const operation = integrationStore(ctx).findOperation(opId);
332
369
  if (!operation) return jsonResponse({ error: "integration operation not found", code: "integration_operation_not_found", opId }, 404, ctx.req, ctx.config);
333
370
  if (operation.clientId !== expectedClientId) return jsonResponse({ error: "integration operation belongs to a different client", code: "integration_client_mismatch" }, 409, ctx.req, ctx.config);
334
371
  return null;
@@ -455,6 +492,10 @@ function stalePlanGuard(
455
492
  }
456
493
 
457
494
  function internalErrorResponse(error: unknown, ctx: ManagementContext): Response {
495
+ // A selected Hermes profile whose boundary stopped holding is a refusal, not a server fault.
496
+ if (error instanceof HermesProfileError) {
497
+ return jsonResponse({ error: error.message, code: error.code, clientId: "hermes" }, error.status, ctx.req, ctx.config);
498
+ }
458
499
  return jsonResponse({
459
500
  error: error instanceof Error ? error.message : String(error),
460
501
  code: "integration_internal_error",
@@ -563,12 +604,14 @@ async function handleJournalDelete(ctx: ManagementContext): Promise<Response> {
563
604
  code: "invalid_op_id",
564
605
  }, 400, req, ctx.config);
565
606
  }
566
- const aside = await asideJournalDeleteResponse(ctx, opId, asideOptions(ctx));
567
- if (aside) return aside;
607
+ if (!hermesRequestScope(ctx.req)) {
608
+ const aside = await asideJournalDeleteResponse(ctx, opId, asideOptions(ctx));
609
+ if (aside) return aside;
610
+ }
568
611
  try {
569
- const store = integrationStore();
612
+ const store = integrationStore(ctx);
570
613
  const operation = store.findOperation(opId);
571
- if (!operation) {
614
+ if (!operation || outsideHermesScope(ctx, operation.clientId)) {
572
615
  // Already retired, or never existed. Both are 404: the tombstone hides
573
616
  // the row from findOperation, so a double-click is idempotent here
574
617
  // rather than a second deletion of something.
@@ -625,6 +668,17 @@ async function handleJournalDelete(ctx: ManagementContext): Promise<Response> {
625
668
  }
626
669
 
627
670
  export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<Response | null> {
671
+ const hermesBase = { store: integrationStore(), ...pathOverrides() };
672
+ const hermesProfiles = await hermesProfileListResponse(ctx, hermesBase, () => loadExportModels(ctx.config),
673
+ (scope, models) => readIntegrationState({
674
+ clientId: "hermes", models, config: ctx.config,
675
+ port: managementInferencePort(ctx), store: scope?.store ?? hermesBase.store, ...pathOverrides(),
676
+ ...(scope?.resolvedPaths ? { env: scope.env, resolvedPaths: { ...scope.resolvedPaths } } : {}),
677
+ }));
678
+ if (hermesProfiles) return hermesProfiles;
679
+ const hermesScoped = scopeHermesProfileRequest(ctx, hermesBase);
680
+ if (hermesScoped instanceof Response) return hermesScoped;
681
+ if (hermesScoped) ctx = hermesScoped;
628
682
  const { req, url } = ctx;
629
683
  const profileOptions = asideOptions(ctx);
630
684
  const aside = await handleAsideProfileRoutes(ctx, profileOptions);
@@ -673,10 +727,10 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
673
727
  if (requestedClient !== null && !isIntegrationClientId(requestedClient)) {
674
728
  return invalidClientResponse(ctx);
675
729
  }
676
- const asideJournal = await asideJournalResponse(ctx, requestedClient, profileOptions);
730
+ const asideJournal = hermesRequestScope(req) ? null : await asideJournalResponse(ctx, requestedClient, profileOptions);
677
731
  if (asideJournal) return asideJournal;
678
732
  try {
679
- const store = integrationStore();
733
+ const store = integrationStore(ctx);
680
734
  const storedOperations = store.listOperations(requestedClient ?? undefined);
681
735
  const newestByClient = new Map<IntegrationClientId, string>();
682
736
  for (const operation of storedOperations) {
@@ -770,6 +824,9 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
770
824
  if (previewClient === "aside") {
771
825
  return jsonResponse({ error: "Use the canonical Aside profile path", code: "invalid_aside_profile_path" }, 400, req, ctx.config);
772
826
  }
827
+ if (outsideHermesScope(ctx, previewClient as IntegrationClientId)) {
828
+ return jsonResponse({ error: "A Hermes profile plan must name the Hermes client", code: "invalid_hermes_profile" }, 400, req, ctx.config);
829
+ }
773
830
  const operation = parsed.operation;
774
831
  if (operation !== "apply" && operation !== "overwrite" && operation !== "disable") {
775
832
  return jsonResponse({
@@ -781,7 +838,7 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
781
838
  if (droidDefaults instanceof Response) return droidDefaults;
782
839
  try {
783
840
  const captured = await buildIntegrationPreviewInput(
784
- previewClient as IntegrationClientId, ctx, integrationStore(), droidDefaults,
841
+ previewClient as IntegrationClientId, ctx, integrationStore(ctx), droidDefaults,
785
842
  );
786
843
  if (!captured) return previewUnavailableResponse(ctx);
787
844
  if (droidDefaults !== undefined) {
@@ -808,14 +865,14 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
808
865
  const scopeResponse = restoreClientScopeResponse(ctx, opId, parsed.expectedClientId, url.pathname === "/api/client-integrations/commandcode/restore/preview" ? "commandcode" : undefined);
809
866
  if (scopeResponse) return scopeResponse;
810
867
  try {
811
- const store = integrationStore();
868
+ const store = integrationStore(ctx);
812
869
  const operation = store.findOperation(opId);
813
870
  /*
814
871
  * Answered as "not found" rather than by reading the row back to the caller. A preview is
815
872
  * reached before any confirmation, so it is the cheapest place to probe journal contents,
816
873
  * and it declines to be one.
817
874
  */
818
- if (!operation) {
875
+ if (!operation || outsideHermesScope(ctx, operation.clientId)) {
819
876
  return jsonResponse({
820
877
  error: "integration operation not found",
821
878
  code: "integration_operation_not_found",
@@ -871,7 +928,8 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
871
928
  }
872
929
  // The binding travels with the request. Dropping it here routed a bound Aside restore into
873
930
  // the unbound path, which executed the mutation while its confirmation went unexamined.
874
- const asideRestore = await asideRestoreResponse(ctx, {
931
+ // A Hermes-scoped restore never delegates: its operation lives in the selected Hermes store.
932
+ const asideRestore = hermesRequestScope(req) ? null : await asideRestoreResponse(ctx, {
875
933
  opId,
876
934
  confirmDrift,
877
935
  ...(parsed.operation === undefined ? {} : { operation: parsed.operation }),
@@ -880,9 +938,9 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
880
938
  if (asideRestore) return asideRestore;
881
939
  let restoreClientId: IntegrationClientId | undefined;
882
940
  try {
883
- const store = integrationStore();
941
+ const store = integrationStore(ctx);
884
942
  const operation = store.findOperation(opId);
885
- if (!operation) {
943
+ if (!operation || outsideHermesScope(ctx, operation.clientId)) {
886
944
  return jsonResponse({
887
945
  error: "integration operation not found",
888
946
  code: "integration_operation_not_found",
@@ -921,11 +979,12 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
921
979
  };
922
980
  const result = await runIntegrationMutationFlight(
923
981
  operation.clientId,
924
- `restore:${opId}:${confirmDrift}`,
982
+ scopedFlightKey(ctx, `restore:${opId}:${confirmDrift}`),
925
983
  writeInput.io?.now ?? Date.now,
926
984
  () => restoreIntegrationCoordinated(restoreInput, {
927
985
  lockSeams: integrationMutationTestHooks?.lockSeams,
928
986
  ...(restoreGuard ? { revalidate: restoreGuard.revalidate } : {}),
987
+ restoreGuard: () => hermesBoundaryRefusal(ctx),
929
988
  }),
930
989
  );
931
990
  const restoreStale = restoreGuard?.response();
@@ -967,8 +1026,9 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
967
1026
 
968
1027
  if (req.method === "GET") {
969
1028
  try {
970
- const input = await buildIntegrationWriteInput(requestedClient, ctx, integrationStore());
1029
+ const input = await buildIntegrationWriteInput(requestedClient, ctx, integrationStore(ctx));
971
1030
  const state = readIntegrationState(input);
1031
+ const scope = hermesRequestScope(req);
972
1032
  // Detection runs only for the client that needs it: `defaults` is a
973
1033
  // process spawn, and no other client's read should pay for it.
974
1034
  const envelope: IntegrationStateEnvelope = requestedClient === "raycast"
@@ -981,7 +1041,7 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
981
1041
  defaults: readOwnedDroidReasoningDefaults(input),
982
1042
  },
983
1043
  }
984
- : state;
1044
+ : scope ? { ...state, hermesProfile: scope.profile.name } : state;
985
1045
  return jsonResponse(envelope, 200, req, ctx.config);
986
1046
  } catch (error) {
987
1047
  return internalErrorResponse(error, ctx);
@@ -1040,11 +1100,11 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
1040
1100
  */
1041
1101
  const boundToggle = binding === "none"
1042
1102
  ? null
1043
- : await buildIntegrationPreviewInput(requestedClient, ctx, integrationStore(), droidDefaults);
1103
+ : await buildIntegrationPreviewInput(requestedClient, ctx, integrationStore(ctx), droidDefaults);
1044
1104
  if (binding !== "none" && boundToggle === null) return previewUnavailableResponse(ctx);
1045
1105
  const input = boundToggle
1046
1106
  ? boundToggle.input
1047
- : await buildIntegrationWriteInput(requestedClient, ctx, integrationStore(), droidDefaults);
1107
+ : await buildIntegrationWriteInput(requestedClient, ctx, integrationStore(ctx), droidDefaults);
1048
1108
  if (droidDefaults !== undefined) {
1049
1109
  const invalid = validateDroidReasoningDefaults(input.models, droidDefaults);
1050
1110
  if (invalid) return invalidDroidDefaultsResponse(ctx, invalid);
@@ -1052,7 +1112,7 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
1052
1112
  const guard = binding === "none" ? null : stalePlanGuard(
1053
1113
  requestedClient,
1054
1114
  ctx,
1055
- integrationStore(),
1115
+ integrationStore(ctx),
1056
1116
  { operation: binding.operation },
1057
1117
  binding.fingerprint,
1058
1118
  boundToggle === null ? null : boundToggle.identity,
@@ -1060,12 +1120,13 @@ export async function handleIntegrationRoutes(ctx: ManagementContext): Promise<R
1060
1120
  );
1061
1121
  const result = await runIntegrationMutationFlight(
1062
1122
  requestedClient,
1063
- parsed.enabled ? (parsed.overwriteConflict === true ? "overwrite" : "apply") : "disable",
1123
+ scopedFlightKey(ctx, parsed.enabled ? (parsed.overwriteConflict === true ? "overwrite" : "apply") : "disable"),
1064
1124
  input.io?.now ?? Date.now,
1065
1125
  () => {
1066
1126
  const options = {
1067
1127
  lockSeams: integrationMutationTestHooks?.lockSeams,
1068
1128
  ...(guard ? { revalidate: guard.revalidate } : {}),
1129
+ guard: () => hermesBoundaryRefusal(ctx),
1069
1130
  };
1070
1131
  if (!parsed.enabled) return disableIntegrationCoordinated(input, options);
1071
1132
  return parsed.overwriteConflict === true
@@ -6,7 +6,7 @@ import { clearCompensationFailed, compensationPath, readCompensation } from "../
6
6
  import { loadHostCandidates } from "../../link/ssh-config";
7
7
  import { newLinkId, type LinkStore } from "../../link/store";
8
8
  import { sshFailureHint, sshRunnerErrorHint } from "../../link/ssh-runner";
9
- import { attachLinkPeers, projectLinkStatus, type LinkStatusDto } from "../../link/status-projection";
9
+ import { attachLinkPeers, attachLinkTunnelDiagnostics, projectLinkStatus, type LinkStatusDto } from "../../link/status-projection";
10
10
  import { homeLinkChildParity } from "../../link/child-parity";
11
11
  import { localLinkPeer } from "../../link/compatibility";
12
12
  import { packageVersion } from "../../lib/package-version";
@@ -268,8 +268,9 @@ export async function handleLinkRoutes(ctx: ManagementContext, suppliedState?: L
268
268
  if (denied) return denied;
269
269
  const store = readStoreFor(ctx);
270
270
  const listenerStatus = state.listener.status();
271
+ const supervisorStates = state.supervisor.status();
271
272
  const dto: LinkStatusDto = projectLinkStatus(
272
- store, state.supervisor.status(), listenerStatus, ctx.config, readCompensation(),
273
+ store, supervisorStates, listenerStatus, ctx.config, readCompensation(),
273
274
  ctx.config.runtimeRole === "client" ? clientLinkTunnelStatus() : null,
274
275
  ctx.config.runtimeRole === "client" && ctx.config.client?.link ? clientLinkStatusIdentity(ctx.config.client.link.linkId) : null,
275
276
  linkId => homeLinkChildParity.get(linkId),
@@ -288,6 +289,8 @@ export async function handleLinkRoutes(ctx: ManagementContext, suppliedState?: L
288
289
  attachLinkPeers(dto, localLinkPeer(packageVersion("0.0.0"), buildPeerFeatures()),
289
290
  linkId => state.listener.peerObservation?.(linkId) ?? { observed: null, refused: null });
290
291
  }
292
+ // The same opt-in for each Home-initiated tunnel's retry progress and last failure cause.
293
+ if (url.searchParams.get("diagnostics") === "1") attachLinkTunnelDiagnostics(dto, supervisorStates);
291
294
  // A dashboard session also learns why it cannot join as a Child. The admin-token answer stays
292
295
  // the exact K16 document that `ocx link status` validates key by key.
293
296
  const denial = ctx.principal === "gui-session" ? joinDenied(ctx) : null;
@@ -561,9 +561,9 @@ export async function handleModelRoutes(ctx: ManagementContext): Promise<Respons
561
561
  if (!(error instanceof ClientPathError)) throw error;
562
562
  return jsonResponse({ error: error.message }, 400, req, config);
563
563
  }
564
- if ((requested === "raycast" || requested === "droid" || requested === "qoder") && shouldInjectApiAuthHeader(config)) {
564
+ if ((requested === "raycast" || requested === "droid" || requested === "qoder" || requested === "qoder-cn" || requested === "workbuddy" || requested === "workbuddy-ai") && shouldInjectApiAuthHeader(config)) {
565
565
  return jsonResponse({
566
- error: `${requested === "droid" ? "Factory Droid" : requested === "qoder" ? "Qoder" : "Raycast"} export requires an unauthenticated loopback destination; this listener requires an admission header the client cannot supply.`,
566
+ error: `${requested === "droid" ? "Factory Droid" : requested.startsWith("qoder") ? "Qoder" : requested.startsWith("workbuddy") ? "WorkBuddy" : "Raycast"} export requires an unauthenticated loopback destination; this listener requires an admission header the client cannot supply.`,
567
567
  reason: "non_loopback",
568
568
  }, 400, req, config);
569
569
  }
@@ -16,6 +16,7 @@
16
16
  * and config already in hand.
17
17
  */
18
18
  import { enrichProviderFromRegistry } from "../../providers/derive";
19
+ import { reasoningCapabilitiesFromConfig } from "../../providers/reasoning-capabilities";
19
20
  import { modelRecordValue } from "../../reasoning-effort";
20
21
  import { configuredReasoningSummarySupport } from "../../codex/catalog/model-hints";
21
22
  import type { CatalogModel } from "../../codex/catalog";
@@ -87,24 +88,42 @@ export function customRowExportMetadata(
87
88
  // same reader the materializer uses answers from the provider config, so both paths agree.
88
89
  const supportsReasoningSummaries = catalogRow?.supportsReasoningSummaries
89
90
  ?? configuredReasoningSummarySupport(provider, source.id);
91
+ // The effective ladder below already includes custom overrides; do not derive new axes
92
+ // from a provider-wide legacy ladder that a custom row may explicitly have cleared.
93
+ const configured = enriched === undefined ? undefined : reasoningCapabilitiesFromConfig({
94
+ ...enriched, modelReasoningEfforts: undefined, reasoningEfforts: undefined,
95
+ }, source.id);
96
+ const supportsThinkingToggle = configured?.supportsThinkingToggle === false ? false
97
+ : catalogRow?.supportsThinkingToggle ?? configured?.supportsThinkingToggle;
98
+ const supportsReasoningEffort = configured?.supportsReasoningEffort === false ? false
99
+ : catalogRow?.supportsReasoningEffort ?? configured?.supportsReasoningEffort;
100
+ const defaultThinkingEnabled = configured?.defaultThinkingEnabled === false ? false
101
+ : catalogRow?.defaultThinkingEnabled ?? configured?.defaultThinkingEnabled;
102
+ const supportsReasoning = configured?.supportsReasoning === false ? false : catalogRow?.supportsReasoning
103
+ ?? configured?.supportsReasoning
104
+ ?? knownReasoningSupport({ reasoningEfforts: effectiveReasoningEfforts, supportsReasoningSummaries,
105
+ supportsThinkingToggle, supportsReasoningEffort });
106
+ const reasoningEfforts = supportsReasoningEffort === false || supportsReasoning === false
107
+ ? (effectiveReasoningEfforts === undefined ? undefined : []) : effectiveReasoningEfforts;
90
108
  const defaultReasoningEffort = declaredDefaultWithin(
91
- effectiveReasoningEfforts,
92
- defaultEffort(source, catalogRow, provider),
109
+ reasoningEfforts,
110
+ supportsReasoningEffort === false || supportsReasoning === false ? undefined : defaultEffort(source, catalogRow, provider),
93
111
  );
94
112
  return {
95
113
  ...(contextWindow !== undefined ? { contextWindow } : {}),
96
114
  ...(catalogRow?.maxInputTokens !== undefined ? { maxInputTokens: catalogRow.maxInputTokens } : {}),
97
115
  ...(catalogRow?.maxOutputTokens !== undefined ? { maxTokens: catalogRow.maxOutputTokens } : {}),
98
116
  ...(inputModalities !== undefined ? { inputModalities: [...inputModalities] } : {}),
99
- ...(effectiveReasoningEfforts !== undefined ? { reasoningEfforts: [...effectiveReasoningEfforts] } : {}),
117
+ ...(reasoningEfforts !== undefined ? { reasoningEfforts: [...reasoningEfforts] } : {}),
118
+ ...(supportsThinkingToggle !== undefined ? { supportsThinkingToggle } : {}),
119
+ ...(supportsReasoningEffort !== undefined ? { supportsReasoningEffort } : {}),
120
+ ...(defaultThinkingEnabled !== undefined ? { defaultThinkingEnabled } : {}),
100
121
  ...(defaultReasoningEffort !== undefined ? { defaultReasoningEffort } : {}),
101
122
  ...(knownToolsSupport({
102
123
  capabilities: catalogRow?.capabilities,
103
124
  parallelToolCalls: catalogRow?.parallelToolCalls,
104
125
  }) === true ? { supportsTools: true } : {}),
105
- ...(knownReasoningSupport({ reasoningEfforts: effectiveReasoningEfforts, supportsReasoningSummaries }) === true
106
- ? { supportsReasoning: true }
107
- : {}),
126
+ ...(typeof supportsReasoning === "boolean" ? { supportsReasoning } : {}),
108
127
  ...(supportsReasoningSummaries !== undefined ? { supportsReasoningSummaries } : {}),
109
128
  };
110
129
  }
@@ -39,6 +39,7 @@ import {
39
39
  type ExportModel,
40
40
  } from "../../clients/config-export/contracts";
41
41
  import { customRowExportMetadata } from "./model-row-export-metadata";
42
+ import { resolveExportReasoningAxes } from "../../clients/config-export/reasoning-metadata";
42
43
  import { providerContextCap } from "../../providers/context-cap";
43
44
  import { isVisionReasoningEffort, modelRecordValue, sanitizeCodexReasoningEfforts } from "../../reasoning-effort";
44
45
  import { routedSlug, slugEquals } from "../../providers/slug-codec";
@@ -104,9 +105,9 @@ export type ManagementModelRow = Partial<CatalogModel> & {
104
105
  */
105
106
  supportsTools?: boolean;
106
107
  /**
107
- * True when a canonical source positively asserts reasoning (a non-empty effective ladder
108
- * or delivered reasoning summaries). Absent means unknown, never "cannot reason": an empty
109
- * ladder only says the effort is not adjustable.
108
+ * A canonical source's explicit capability, or positive evidence from reasoning efforts
109
+ * or delivered summaries. Absent means unknown; an empty ladder alone says only that
110
+ * effort is not adjustable, not that the model cannot reason.
110
111
  */
111
112
  supportsReasoning?: boolean;
112
113
  /**
@@ -460,9 +461,11 @@ export async function listManagementModelRows(
460
461
  const routed = m.provider !== "combo";
461
462
  // Resolved once each: the spread below used to evaluate the same helpers again for the guard.
462
463
  const reasoningEfforts = routed
463
- ? effectiveModelReasoningEfforts(config, m.provider, m.id, m.reasoningEfforts, catalogLadders)
464
+ ? m.supportsReasoningEffort === false || m.supportsReasoning === false ? []
465
+ : effectiveModelReasoningEfforts(config, m.provider, m.id, m.reasoningEfforts, catalogLadders)
464
466
  : undefined;
465
467
  const defaultReasoningEffort = routed
468
+ && m.supportsReasoningEffort !== false && m.supportsReasoning !== false
466
469
  ? effectiveModelDefaultReasoningEffort(config, m.provider, m.id, m.defaultReasoningEffort, reasoningEfforts)
467
470
  : undefined;
468
471
  const inputModalitiesDeclared = routed ? declaredModelInputModalities(config, m.provider, m.id) : undefined;
@@ -524,10 +527,7 @@ export async function listManagementModelRows(
524
527
  });
525
528
  const supportsReasoning = row.exportMetadata?.supportsReasoning
526
529
  ?? row.supportsReasoning
527
- ?? knownReasoningSupport({
528
- reasoningEfforts: row.reasoningEfforts,
529
- supportsReasoningSummaries: row.supportsReasoningSummaries,
530
- });
530
+ ?? knownReasoningSupport(row);
531
531
  return {
532
532
  ...row,
533
533
  // One shared definition with the request path: the GUI must not re-derive consumer
@@ -560,14 +560,8 @@ export function toExportModel(row: ManagementModelRow): ExportModel {
560
560
  const maxTokens = effective?.maxTokens ?? row.maxOutputTokens;
561
561
  const maxInputTokens = effective?.maxInputTokens ?? row.maxInputTokens;
562
562
  const inputModalities = effective?.inputModalities ?? row.inputModalities;
563
- const reasoningEfforts = effective?.reasoningEfforts ?? row.reasoningEfforts;
564
- // The projection is the authority on the default. When it exists, an absent default means
565
- // NO declared default — falling back to the row would reintroduce the picker's synthetic
566
- // medium/low value, which is exactly what this projection exists to keep out of exports.
567
- // Rows without a projection (native-era shapes, hand-built rows) keep the row's own value.
568
- const defaultReasoningEffort = effective !== undefined
569
- ? effective.defaultReasoningEffort
570
- : row.defaultReasoningEffort;
563
+ const { supportsThinkingToggle, supportsReasoningEffort, defaultThinkingEnabled,
564
+ reasoningEfforts, defaultReasoningEffort } = resolveExportReasoningAxes(effective, row);
571
565
  const supportsReasoningSummaries = effective?.supportsReasoningSummaries ?? row.supportsReasoningSummaries;
572
566
  // Projection first, then the row's own explicit boolean (an external producer may state
573
567
  // false, which is evidence), and only then derivation from positive evidence.
@@ -580,10 +574,8 @@ export function toExportModel(row: ManagementModelRow): ExportModel {
580
574
  });
581
575
  const supportsReasoning = effective?.supportsReasoning
582
576
  ?? row.supportsReasoning
583
- ?? knownReasoningSupport({
584
- reasoningEfforts: row.reasoningEfforts,
585
- supportsReasoningSummaries: row.supportsReasoningSummaries,
586
- });
577
+ ?? knownReasoningSupport({ ...row, supportsThinkingToggle, supportsReasoningEffort,
578
+ reasoningEfforts, supportsReasoningSummaries });
587
579
  return {
588
580
  namespaced: row.namespaced,
589
581
  provider: row.provider,
@@ -597,6 +589,9 @@ export function toExportModel(row: ManagementModelRow): ExportModel {
597
589
  ...(inputModalities ? { inputModalities } : {}),
598
590
  // An empty array is a declaration ("no rungs"), and `[]` is truthy: it survives here.
599
591
  ...(reasoningEfforts ? { reasoningEfforts } : {}),
592
+ ...(typeof supportsThinkingToggle === "boolean" ? { supportsThinkingToggle } : {}),
593
+ ...(typeof supportsReasoningEffort === "boolean" ? { supportsReasoningEffort } : {}),
594
+ ...(typeof defaultThinkingEnabled === "boolean" ? { defaultThinkingEnabled } : {}),
600
595
  ...(defaultReasoningEffort ? { defaultReasoningEffort } : {}),
601
596
  // An explicit false is evidence and survives; only derivation is true-or-nothing.
602
597
  ...(typeof supportsTools === "boolean" ? { supportsTools } : {}),
@@ -30,14 +30,15 @@ import { providerContextCap } from "../../providers/context-cap";
30
30
  import { OPENAI_CODEX_PROVIDER_ID } from "../../providers/openai-tiers";
31
31
  import { inspectDesktop3pConfigLibrary, removeDesktop3pStandardPivot, writeDesktop3pConfig } from "../../claude/desktop-3p";
32
32
  import {
33
- applyDesktopFirstParty,
33
+ applyDesktopFirstParty, withFirstPartySecretsSettled,
34
34
  captureDesktopFirstPartyRollback,
35
35
  inspectDesktopFirstParty,
36
36
  observeClaudeDesktopMode,
37
37
  recordClaudeDesktopMode,
38
- removeDesktopFirstParty,
38
+ removeDesktopFirstParty, removeDesktopFirstPartySettled,
39
39
  resolveClaudeDesktopApplyMode,
40
40
  type ClaudeDesktopMode,
41
+ type InterceptSecretDiagnostic,
41
42
  } from "../../claude/desktop-first-party";
42
43
  import { FIRST_PARTY_ACCOUNT_RISK } from "../../claude/desktop-risk";
43
44
  import type { DesktopPickerStatus } from "../../claude/desktop-picker";
@@ -49,6 +50,7 @@ import { grokConfigPath } from "../../grok/status";
49
50
  import { assertNativeTeardownOwned } from "../../integrations/native/ownership-preflight";
50
51
  import type { CodexNativeRestoreResult } from "../../codex/inject";
51
52
  import type { OcxConfig } from "../../types";
53
+ import { getConfigDir, withConfigDirHardeningSettled } from "../../config/paths";
52
54
  import { jsonResponse } from "../auth-cors";
53
55
  import { readManagementJsonBody, rethrowManagementBodyTooLarge } from "./body";
54
56
  import { managementInferencePort, type ManagementContext } from "./context";
@@ -108,6 +110,7 @@ export interface NativeRefusalEnvelope {
108
110
  /** Present on every post-commit refusal; absent only for pre-commit refusals. */
109
111
  desiredEnabled?: boolean;
110
112
  residualPaths?: string[];
113
+ diagnostic?: InterceptSecretDiagnostic;
111
114
  }
112
115
 
113
116
  export type NativePostCommitRefusalEnvelope = Omit<NativeRefusalEnvelope, "desiredEnabled"> & {
@@ -133,7 +136,7 @@ function postCommitRefusal(
133
136
  clientId: NativeIntegrationClientId,
134
137
  reason: NativeRefusalReason,
135
138
  message: string,
136
- extra: Pick<NativePostCommitRefusalEnvelope, "desiredEnabled" | "residualPaths">,
139
+ extra: Pick<NativePostCommitRefusalEnvelope, "desiredEnabled" | "residualPaths" | "diagnostic">,
137
140
  ): Response {
138
141
  return jsonResponse({
139
142
  error: status >= 500 ? "native integration change failed" : "native integration change refused",
@@ -717,7 +720,7 @@ async function handleClaudeDesktopToggle(ctx: ManagementContext): Promise<Respon
717
720
  // Picker mode goes first: stop terminating claude.ai, drop its profile and trust.
718
721
  return await runPickerTransition(current, async ops => {
719
722
  const pickerOff = await ops.disableLocked({ persist: false });
720
- const firstPartyRemoved = removeDesktopFirstParty(loadConfig());
723
+ const firstPartyRemoved = await removeDesktopFirstPartySettled(loadConfig);
721
724
  if (!firstPartyRemoved.ok) {
722
725
  return postCommitRefusal(409, "claude-desktop", "write_failed",
723
726
  `Claude Code settings could not be read (${firstPartyRemoved.path}); the first-party proxy env was left in place.`, { desiredEnabled });
@@ -755,17 +758,17 @@ async function handleClaudeDesktopToggle(ctx: ManagementContext): Promise<Respon
755
758
  // The whole switch runs under the picker lock, in today's order: env first, then gateway cleanup.
756
759
  return await runPickerTransition(current, async ops => {
757
760
  const rollback = captureDesktopFirstPartyRollback(current);
758
- const applied = applyDesktopFirstParty(current);
761
+ const applied = await withFirstPartySecretsSettled(getConfigDir(), () => applyDesktopFirstParty(current));
759
762
  if (!applied.ok) {
760
763
  const reason = applied.reason === "foreign_env" || applied.reason === "intercept_disabled" ? applied.reason : "write_failed";
761
764
  return postCommitRefusal(applied.reason === "unreadable" || applied.reason === "ca_unavailable" ? 500 : 409, "claude-desktop", reason,
762
- firstPartyRefusalMessage(applied.reason, applied.path), { desiredEnabled });
765
+ firstPartyRefusalMessage(applied.reason, applied.path), { desiredEnabled, ...(applied.diagnostic ? { diagnostic: applied.diagnostic } : {}) });
763
766
  }
764
767
  const library = inspectDesktop3pConfigLibrary({ appliedFingerprint: fingerprint });
765
768
  let gatewayRemoved = false;
766
769
  if (library.kind === "gateway_ours" || library.kind === "gateway_drifted") {
767
770
  const removed = (ctx.deps.removeDesktop3pStandardPivot ?? removeDesktop3pStandardPivot)({ appliedFingerprint: fingerprint, replaceWhileEnabled: true });
768
- if (!removed.ok && !removed.changed && applied.changed && !rollback()) {
771
+ if (!removed.ok && !removed.changed && applied.changed && !await withConfigDirHardeningSettled(getConfigDir(), rollback)) {
769
772
  return postCommitRefusal(500, "claude-desktop", "write_failed",
770
773
  "Gateway cleanup and first-party settings rollback did not complete.", { desiredEnabled });
771
774
  }
@@ -830,7 +833,7 @@ async function handleClaudeDesktopToggle(ctx: ManagementContext): Promise<Respon
830
833
  if (!result.written) return postCommitRefusal(500, "claude-desktop", "write_failed", "Claude Desktop apply failed.", { desiredEnabled: latestDesiredEnabled });
831
834
  const committed = persistCommittedDesktopGateway(ctx.config, latest.claudeCode?.desktopProfile, result.fingerprint);
832
835
  const stateWarning = committed.ok ? "" : " The committed gateway mode/profile state was not saved.";
833
- const removed = removeDesktopFirstParty(loadConfig());
836
+ const removed = await removeDesktopFirstPartySettled(loadConfig);
834
837
  if (!removed.ok) return postCommitRefusal(500, "claude-desktop", "write_failed", "Gateway applied, but first-party settings cleanup did not complete." + stateWarning, { desiredEnabled: latestDesiredEnabled });
835
838
  return jsonResponse({
836
839
  ok: true, clientId: "claude-desktop", changed: true, state: "current", desiredEnabled: latestDesiredEnabled,
@@ -1726,7 +1726,7 @@ export async function handleProviderRoutes(ctx: ManagementContext): Promise<Resp
1726
1726
  return jsonResponse({ ok: false, latencyMs: 0, error: "Antigravity project unavailable — re-run `ocx login google-antigravity`" });
1727
1727
  }
1728
1728
  const { method, url: modelsUrl, headers } = buildModelsRequest(prov, apiKey, name, {
1729
- oauthApiBaseUrl: snapshot?.apiBaseUrl,
1729
+ oauthApiBaseUrl: snapshot?.apiBaseUrl, workbuddy: snapshot?.workbuddy,
1730
1730
  });
1731
1731
  const discovery = resolveProviderModelDiscovery(name, prov);
1732
1732
  const started = Date.now();
@@ -53,6 +53,8 @@ export type ExemptionReason =
53
53
  | "dead"
54
54
  /** Desktop shell internal display-state POST; the CLI has no app updater state to publish. */
55
55
  | "desktop-internal"
56
+ /** Dashboard-only discovery for an interaction the CLI does not expose. */
57
+ | "gui-only"
56
58
  /**
57
59
  * A verb is owed but belongs to a later work-phase. BOUNDED: requires `owner` and
58
60
  * `ownerDoc`, and the parity test asserts that tracked doc exists and names the route.
@@ -95,6 +97,7 @@ export interface ManagementRoute {
95
97
  /** Every reachable management route. */
96
98
  export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
97
99
  // server/management-api
100
+ { method: "GET", path: "/api/stop", module: "server/management-api", mutates: false },
98
101
  { method: "POST", path: "/api/stop", module: "server/management-api", mutates: true },
99
102
  // codex/auth-api
100
103
  { method: "GET", path: "/api/codex-auth/preserve-signed-in", module: "codex/auth-api/routes", mutates: false },
@@ -444,6 +447,7 @@ export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
444
447
  { method: "GET", path: "/api/system/codex-app-server", module: "server/management/system-routes", mutates: false, mechanism: "path-constant" },
445
448
  { method: "POST", path: "/api/system/codex-restart", module: "server/management/system-routes", mutates: true, mechanism: "path-constant" },
446
449
  { method: "POST", path: "/api/providers/reload", module: "server/management/provider-routes", mutates: true, mechanism: "path-constant", exempt: { reason: "capability-principal", why: "Gated on the local-provider-reload-capability principal (provider-routes.ts:467), not an operator action." } },
450
+ { method: "GET", path: "/api/client-integrations/hermes/profiles", module: "server/management/hermes-profile-routes", mutates: false, mechanism: "path-constant", exempt: { reason: "gui-only", why: "The dashboard discovers selectable Hermes profiles; the CLI intentionally has no Hermes profile selector." } },
447
451
  { method: "GET", path: "/api/client-integrations/{clientId}", module: "server/management/integration-routes", mutates: false, mechanism: "prefix-decode" },
448
452
  { method: "PUT", path: "/api/client-integrations/{clientId}", module: "server/management/integration-routes", mutates: true, mechanism: "prefix-decode" },
449
453
  { method: "GET", path: "/api/request-history/{id}", module: "server/management/request-history-routes", mutates: false, mechanism: "slice" },
@@ -411,6 +411,11 @@ export async function handleManagementAPI(
411
411
  }
412
412
  if (routed) return routed;
413
413
 
414
+ if (url.pathname === "/api/stop" && req.method === "GET") {
415
+ const response = jsonResponse((await import("./stop-teardown")).stopCapabilities(), 200, req, config);
416
+ response.headers.set("Cache-Control", "no-store");
417
+ return response;
418
+ }
414
419
  if (url.pathname === "/api/stop" && req.method === "POST") {
415
420
  const { installedServiceRespawnRisk, stopServiceIfInstalledDetailed, isServiceOwnershipError } = await import("../service");
416
421
  // `ocx stop` performs its own shared teardown AFTER verifying the scheduler did not