@bitkyc08/opencodex 2.99.0 → 2.100.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/AGENTS_INSTALL.md +19 -1
  2. package/README.md +37 -33
  3. package/SPONSORS.md +5 -1
  4. package/bin/ocx.mjs +1 -1
  5. package/gui/dist/assets/{App-C1hGwaN1.css → App-COo8Yopd.css} +1 -1
  6. package/gui/dist/assets/App-g3Cm2xhZ.js +59 -0
  7. package/gui/dist/assets/Tray-BMDkAiXy.js +1 -0
  8. package/gui/dist/assets/brand-mark-nr3ziR-T.js +1 -0
  9. package/gui/dist/assets/index-Bziu8gTy.css +2 -0
  10. package/gui/dist/assets/index-OYzhQUNP.js +94 -0
  11. package/gui/dist/assets/{segment-thumb-features-fYEMxBaW.js → segment-thumb-features-DKCVUUTi.js} +1 -1
  12. package/gui/dist/classic/assets/App-CgPBKUP-.js +58 -0
  13. package/gui/dist/classic/assets/{Tray-BqZueZOx.js → Tray-BedmOsE7.js} +1 -1
  14. package/gui/dist/classic/assets/index-BR-HhNrp.js +94 -0
  15. package/gui/dist/classic/assets/quota-summary-CXKhvSmQ.js +1 -0
  16. package/gui/dist/classic/index.html +1 -1
  17. package/gui/dist/index.html +2 -2
  18. package/native/ocx-child/Cargo.lock +215 -0
  19. package/native/ocx-child/Cargo.toml +31 -0
  20. package/native/ocx-child/src/cli.rs +1901 -0
  21. package/native/ocx-child/src/codex_home.rs +429 -0
  22. package/native/ocx-child/src/codex_settings.rs +231 -0
  23. package/native/ocx-child/src/daemon.rs +363 -0
  24. package/native/ocx-child/src/http_wire.rs +619 -0
  25. package/native/ocx-child/src/journal.rs +977 -0
  26. package/native/ocx-child/src/lib.rs +22 -0
  27. package/native/ocx-child/src/main.rs +9 -0
  28. package/native/ocx-child/src/parity.rs +102 -0
  29. package/native/ocx-child/src/platform.rs +1487 -0
  30. package/native/ocx-child/src/relay.rs +1288 -0
  31. package/native/ocx-child/src/relay_auth.rs +166 -0
  32. package/native/ocx-child/src/routes.rs +236 -0
  33. package/native/ocx-child/src/state.rs +190 -0
  34. package/native/ocx-child/src/test_hooks.rs +58 -0
  35. package/native/ocx-child/src/toml_surgeon.rs +1156 -0
  36. package/package.json +8 -2
  37. package/src/adapters/anthropic-image-normalize.ts +1 -1
  38. package/src/adapters/anthropic.ts +28 -2
  39. package/src/adapters/claude-cli/adapter.ts +5 -25
  40. package/src/adapters/claude-cli/instruction-images.ts +31 -0
  41. package/src/adapters/claude-cli/stable-replay.ts +42 -14
  42. package/src/adapters/claude-cli/usage-admission.ts +53 -64
  43. package/src/adapters/client-fingerprint.ts +1 -1
  44. package/src/adapters/coding-agent/protocol.ts +1 -1
  45. package/src/adapters/devin/live-models.ts +3 -0
  46. package/src/adapters/google-http.ts +3 -0
  47. package/src/adapters/google-vertex-key-project.ts +10 -2
  48. package/src/adapters/google.ts +40 -8
  49. package/src/adapters/kiro/usage.ts +3 -13
  50. package/src/adapters/openai-chat/mistral-image-limit.ts +28 -15
  51. package/src/adapters/openai-chat-images.ts +100 -0
  52. package/src/adapters/openai-chat.ts +6 -9
  53. package/src/adapters/openai-responses/passthrough.ts +5 -2
  54. package/src/adapters/openai-responses/request-strips.ts +32 -0
  55. package/src/adapters/openai-responses/tool-schema.ts +9 -4
  56. package/src/chat/inbound.ts +1 -1
  57. package/src/claude/auth-detect.ts +26 -8
  58. package/src/claude/inbound-content-options.ts +18 -3
  59. package/src/claude/inbound.ts +5 -2
  60. package/src/cli/bundled-bun-diagnostic.ts +91 -0
  61. package/src/cli/capabilities-agents-routing.ts +2 -2
  62. package/src/cli/capabilities-observe-system.ts +60 -0
  63. package/src/cli/combo-input.ts +6 -0
  64. package/src/cli/combo-result.ts +1 -1
  65. package/src/cli/combo.ts +4 -0
  66. package/src/cli/config-command.ts +16 -2
  67. package/src/cli/connect.ts +12 -10
  68. package/src/cli/dispatch.ts +4 -0
  69. package/src/cli/doctor.ts +11 -0
  70. package/src/cli/help.ts +1 -0
  71. package/src/cli/init.ts +4 -0
  72. package/src/cli/link-enrollment.ts +152 -25
  73. package/src/cli/link-local-control.ts +49 -0
  74. package/src/cli/link.ts +37 -10
  75. package/src/cli/provider-lifecycle-runtime.ts +4 -2
  76. package/src/cli/registry.ts +13 -0
  77. package/src/cli/star-prompt.ts +2 -0
  78. package/src/cli/status.ts +1 -1
  79. package/src/cli/telemetry-profile.ts +206 -0
  80. package/src/cli/telemetry.ts +260 -0
  81. package/src/client/hub-relay.ts +26 -0
  82. package/src/client/machine-api.ts +3 -0
  83. package/src/clients/config-export/t3code.ts +44 -5
  84. package/src/clients/omo-role-models.ts +1 -1
  85. package/src/codex/catalog/bundled.ts +44 -2
  86. package/src/codex/runtime.ts +12 -0
  87. package/src/codex/shim-restore-lock.ts +67 -30
  88. package/src/combos/types.ts +21 -1
  89. package/src/config/atomic-write.ts +24 -1
  90. package/src/config/diagnostics.ts +15 -0
  91. package/src/config/live-reconcile.ts +17 -0
  92. package/src/config/load-degrade.ts +16 -0
  93. package/src/config/provider-validation.ts +29 -0
  94. package/src/config/schema/config-schema.ts +24 -0
  95. package/src/config/schema/leaf-validators.ts +17 -0
  96. package/src/config/telemetry-carry.ts +30 -0
  97. package/src/config.ts +13 -1
  98. package/src/generated/compatibility-version.json +422 -170
  99. package/src/generated/model-metadata.ts +3 -3
  100. package/src/integrations/aside-profiles.ts +7 -1
  101. package/src/integrations/owned-refresh.ts +9 -2
  102. package/src/lab/artifacts/secure-fs.ts +12 -11
  103. package/src/lab/fabric/scratch.ts +11 -9
  104. package/src/lab/public/community.ts +2 -3
  105. package/src/lab/public/file-safety.ts +18 -20
  106. package/src/lab/public/mutation-lock.ts +109 -337
  107. package/src/lab/public/private-file.ts +4 -3
  108. package/src/lib/bun-runtime-preflight.ts +1 -1
  109. package/src/lib/codex-catalog-read-only.ts +122 -0
  110. package/src/lib/config-ownership.ts +56 -18
  111. package/src/lib/errors.ts +11 -0
  112. package/src/lib/gcp-adc.ts +167 -48
  113. package/src/lib/jsonc.ts +4 -2
  114. package/src/lib/local-control-socket.ts +88 -0
  115. package/src/lib/privacy.ts +15 -0
  116. package/src/lib/provider-client-headers.ts +3 -0
  117. package/src/lib/token-estimate.ts +13 -2
  118. package/src/link/child-binary-source.ts +228 -0
  119. package/src/link/ephemeral-child.ts +45 -0
  120. package/src/link/remote-plant.ts +306 -0
  121. package/src/link/remote-windows.ts +59 -5
  122. package/src/link/ssh-argv.ts +71 -8
  123. package/src/link/status-projection.ts +2 -0
  124. package/src/link/store.ts +5 -1
  125. package/src/oauth/anthropic-model-quota.ts +12 -0
  126. package/src/oauth/anthropic-routing.ts +11 -4
  127. package/src/oauth/claude-keychain-read.ts +165 -0
  128. package/src/oauth/kiro-iam-identity-center.ts +4 -1
  129. package/src/oauth/local-token-detect.ts +14 -17
  130. package/src/protocols/envelope.ts +20 -2
  131. package/src/providers/api-key-selection.ts +8 -2
  132. package/src/providers/claude-cli-identity.ts +9 -3
  133. package/src/providers/claude-cli-usage-state.ts +93 -0
  134. package/src/providers/claude-cli-usage.ts +3 -2
  135. package/src/providers/github-copilot-auto.ts +25 -5
  136. package/src/providers/meta-muse-plan-refusal.ts +94 -0
  137. package/src/providers/model-rename-fields.ts +3 -0
  138. package/src/providers/quota/anthropic-family-headers.ts +8 -1
  139. package/src/providers/quota/anthropic-usage-windows.ts +49 -2
  140. package/src/providers/quota/vendor-probes-key.ts +23 -4
  141. package/src/providers/quota/vendor-probes-oauth.ts +59 -0
  142. package/src/providers/quota/workbuddy.ts +2 -2
  143. package/src/providers/quota-types.ts +7 -0
  144. package/src/providers/quota.ts +25 -18
  145. package/src/providers/registry/entries-core.ts +7 -4
  146. package/src/providers/registry/entries-extended.ts +42 -8
  147. package/src/providers/registry/model-ids.ts +1 -0
  148. package/src/providers/registry/model-seeds.ts +10 -2
  149. package/src/providers/registry/types.ts +6 -0
  150. package/src/providers/resolved-model-policy.ts +4 -0
  151. package/src/providers/routed-config.ts +30 -3
  152. package/src/providers/stale-no-vision-seed-migration.ts +7 -0
  153. package/src/providers/vertex-environment-authority.ts +50 -0
  154. package/src/providers/workbuddy-credit-balance.ts +38 -6
  155. package/src/quota-pool/assemble.ts +14 -6
  156. package/src/responses/retained-compaction.ts +31 -5
  157. package/src/router.ts +1 -0
  158. package/src/server/adapter-resolve.ts +11 -6
  159. package/src/server/audio-dictation.ts +21 -7
  160. package/src/server/auth-cors.ts +19 -0
  161. package/src/server/background-lifecycle.ts +71 -0
  162. package/src/server/chat-completions.ts +2 -0
  163. package/src/server/claude-messages.ts +30 -3
  164. package/src/server/index/live-sideband.ts +15 -1
  165. package/src/server/index/local-control-listener.ts +515 -0
  166. package/src/server/index/optional-listeners.ts +21 -1
  167. package/src/server/index/serve-options.ts +4 -3
  168. package/src/server/index/websocket-handler.ts +2 -0
  169. package/src/server/index.ts +3 -0
  170. package/src/server/management/combo-routes.ts +6 -1
  171. package/src/server/management/context.ts +1 -0
  172. package/src/server/management/link-child-preflight.ts +74 -0
  173. package/src/server/management/link-enrollment.ts +190 -25
  174. package/src/server/management/link-route-state.ts +6 -1
  175. package/src/server/management/link-routes.ts +27 -9
  176. package/src/server/management/model-rows.ts +4 -0
  177. package/src/server/management/oauth-account-routes.ts +9 -4
  178. package/src/server/management/provider-overwrite-carry.ts +9 -2
  179. package/src/server/management/provider-routes.ts +14 -0
  180. package/src/server/management/provider-thinking-display-patch.ts +54 -0
  181. package/src/server/management/route-registry.ts +7 -0
  182. package/src/server/management/session-routes.ts +4 -1
  183. package/src/server/management/telemetry-routes.ts +37 -0
  184. package/src/server/management/usage-aggregate-cache.ts +290 -67
  185. package/src/server/management-api.ts +11 -2
  186. package/src/server/messages-native-preflight.ts +166 -0
  187. package/src/server/messages-native.ts +143 -43
  188. package/src/server/messages-shared.ts +14 -0
  189. package/src/server/proxy-liveness.ts +99 -6
  190. package/src/server/request-log-conversation.ts +18 -2
  191. package/src/server/request-log.ts +7 -2
  192. package/src/server/responses/adapter-continuation.ts +1 -0
  193. package/src/server/responses/adapter-dispatch.ts +11 -28
  194. package/src/server/responses/adapter-failure-message.ts +68 -0
  195. package/src/server/responses/combo-stream-preflight.ts +14 -2
  196. package/src/server/responses/compact.ts +13 -1
  197. package/src/server/responses/core-auth.ts +26 -5
  198. package/src/server/responses/core-codex-account.ts +8 -1
  199. package/src/server/responses/core-combo-failure.ts +6 -1
  200. package/src/server/responses/core-combo-native.ts +150 -37
  201. package/src/server/responses/core-combo.ts +15 -9
  202. package/src/server/responses/core-normalize.ts +1 -0
  203. package/src/server/responses/core-options.ts +7 -1
  204. package/src/server/responses/core-pipeline.ts +21 -1
  205. package/src/server/responses/fetch-helpers.ts +5 -0
  206. package/src/server/responses/opengateway-completion-guard.ts +7 -3
  207. package/src/server/responses/passthrough-delivery.ts +8 -1
  208. package/src/server/responses/passthrough-error.ts +22 -0
  209. package/src/server/responses/request-prepare.ts +7 -1
  210. package/src/server/responses/request-transport.ts +28 -5
  211. package/src/server/responses/run-turn-execution.ts +13 -0
  212. package/src/server/sse-frame-buffer.ts +5 -0
  213. package/src/server/ws-bridge.ts +10 -0
  214. package/src/service/launchd.ts +78 -4
  215. package/src/telemetry/aggregate.ts +348 -0
  216. package/src/telemetry/consent.ts +128 -0
  217. package/src/telemetry/contract.ts +403 -0
  218. package/src/telemetry/disclosure.ts +19 -0
  219. package/src/telemetry/install-id.ts +226 -0
  220. package/src/telemetry/payload.ts +129 -0
  221. package/src/telemetry/profile/client.ts +150 -0
  222. package/src/telemetry/profile/contract.ts +288 -0
  223. package/src/telemetry/profile/disclosure.ts +14 -0
  224. package/src/telemetry/profile/paths.ts +13 -0
  225. package/src/telemetry/profile/routes.ts +99 -0
  226. package/src/telemetry/profile/service.ts +234 -0
  227. package/src/telemetry/profile/state.ts +189 -0
  228. package/src/telemetry/profile/sync.ts +276 -0
  229. package/src/telemetry/routes.ts +183 -0
  230. package/src/telemetry/scheduler.ts +386 -0
  231. package/src/telemetry/sender.ts +97 -0
  232. package/src/telemetry/state.ts +334 -0
  233. package/src/types/combo-jev-effort-mode.ts +11 -0
  234. package/src/types/config.ts +3 -0
  235. package/src/types/provider.ts +11 -1
  236. package/src/types/request.ts +2 -0
  237. package/src/types/telemetry.ts +15 -0
  238. package/src/types/wire.ts +10 -0
  239. package/src/types.ts +5 -0
  240. package/src/update/index.ts +7 -1
  241. package/src/update/minisign.d.mts +17 -0
  242. package/src/update/minisign.mjs +88 -0
  243. package/src/update/signed-supply.d.mts +59 -0
  244. package/src/update/signed-supply.mjs +289 -0
  245. package/src/update/trust-root.json +38 -0
  246. package/src/update/update-bounded-json.d.mts +4 -0
  247. package/src/update/update-bounded-json.mjs +113 -0
  248. package/src/update/update-bytes.d.mts +2 -0
  249. package/src/update/update-bytes.mjs +23 -0
  250. package/src/update/update-candidate-id.d.mts +2 -0
  251. package/src/update/update-candidate-id.mjs +23 -0
  252. package/src/update/update-checkpoint-codec.d.mts +33 -0
  253. package/src/update/update-checkpoint-codec.mjs +217 -0
  254. package/src/update/update-contracts.d.mts +24 -0
  255. package/src/update/update-contracts.mjs +207 -0
  256. package/src/update/update-signature-threshold.d.mts +12 -0
  257. package/src/update/update-signature-threshold.mjs +47 -0
  258. package/src/update/update-signed-version.d.mts +5 -0
  259. package/src/update/update-signed-version.mjs +25 -0
  260. package/src/update/update-trust-anchor.d.mts +2 -0
  261. package/src/update/update-trust-anchor.mjs +2 -0
  262. package/src/usage/cache-diagnostic.ts +195 -50
  263. package/src/usage/expected-prices.ts +20 -2
  264. package/src/usage/filter-index.ts +1469 -0
  265. package/src/usage/ledger-scanner.ts +245 -4
  266. package/src/usage/source-filter.ts +10 -2
  267. package/src/usage/summary.ts +16 -0
  268. package/src/web-search/parse.ts +265 -38
  269. package/gui/dist/assets/App-BepstgEN.js +0 -59
  270. package/gui/dist/assets/Tray-BinxbEZo.js +0 -1
  271. package/gui/dist/assets/brand-mark-wzPe3R-J.js +0 -1
  272. package/gui/dist/assets/index-C-9X2yaI.js +0 -94
  273. package/gui/dist/assets/index-bnUWypyz.css +0 -2
  274. package/gui/dist/classic/assets/App-DX88_GCW.js +0 -58
  275. package/gui/dist/classic/assets/index-fSP71pLB.js +0 -94
  276. package/gui/dist/classic/assets/quota-summary-y2fl0WBv.js +0 -1
@@ -2,6 +2,7 @@ import { probe, confirmHost, apply } from "./link-enrollment";
2
2
  import { fail, pairedSession, auth, port, isRecord, exactBody, runnerFor, readStoreFor, writeStoreFor, knownHostsFile, issueKey, revokeKeyIdempotent, compensateNewLink, type LinkRouteState } from "./link-route-state";
3
3
  export type { LinkRouteState, PendingLinkHost, ConfirmedLinkHost, LinkRouteListener } from "./link-route-state";
4
4
  import { requireRemotePlatform } from "../../link/remote-platform";
5
+ import { purgeDisconnectRemote } from "../../link/remote-plant";
5
6
  import { assertSshAlias, buildExecArgv, remoteOcxArgv } from "../../link/ssh-argv";
6
7
  import { clearCompensationFailed, compensationPath, readCompensation } from "../../link/compensation";
7
8
  import { loadHostCandidates } from "../../link/ssh-config";
@@ -9,6 +10,7 @@ import { newLinkId, type LinkStore } from "../../link/store";
9
10
  import { sshFailureHint, sshRunnerErrorHint } from "../../link/ssh-runner";
10
11
  import { attachLinkPeers, attachLinkTunnelDiagnostics, projectLinkStatus, type LinkStatusDto } from "../../link/status-projection";
11
12
  import { homeLinkChildParity } from "../../link/child-parity";
13
+ import { codexSettingsDigest, projectHomeCodexSettings } from "../../link/codex-settings";
12
14
  import { localLinkPeer } from "../../link/compatibility";
13
15
  import { packageVersion } from "../../lib/package-version";
14
16
  import { buildPeerFeatures } from "../../remote/features";
@@ -161,7 +163,7 @@ async function handleJoin(ctx: ManagementContext, state: LinkRouteState): Promis
161
163
  runner: runnerFor(ctx),
162
164
  knownHostsFile: knownHostsFile(ctx),
163
165
  scheduleRestart: () => { acceptSystemRestart(); },
164
- ...(confirmed ? { confirmedHost: confirmed } : {}),
166
+ ...(confirmed && confirmed.runtimeKind !== "missing" && confirmed.ocxVersion !== null ? { confirmedHost: confirmed } : {}),
165
167
  };
166
168
  const result = await (overrides.joinHome ?? joinHome)(deps, { alias: body.alias });
167
169
  return Response.json({ linkId: result.linkId, alias: body.alias, restarting: true }, { status: 202 });
@@ -202,8 +204,16 @@ async function remove(ctx: ManagementContext, state: LinkRouteState, id: string)
202
204
  const record = current.links.find(link => link.id === id);
203
205
  if (!record) return fail("link_not_found", "The link was not found.", 404);
204
206
  const body = await readManagementJsonBodyOr(ctx.req, {});
205
- if (!isRecord(body) || Object.keys(body).some(key => key !== "force") || (body.force !== undefined && typeof body.force !== "boolean")) return fail("invalid_body", "force must be a boolean.", 400);
206
- const force = body.force === true;
207
+ const payload = body === null ? {} : body;
208
+ if (!isRecord(payload)
209
+ || Object.keys(payload).some(key => key !== "force" && key !== "purge")
210
+ || (payload.force !== undefined && typeof payload.force !== "boolean")
211
+ || (payload.purge !== undefined && typeof payload.purge !== "boolean")
212
+ || (payload.force === true && payload.purge === true)) {
213
+ return fail("invalid_body", "force and purge must be booleans and cannot both be true.", 400);
214
+ }
215
+ const force = payload.force === true;
216
+ const purge = payload.purge === true;
207
217
  const release = state.supervisor.holdLink?.(id);
208
218
  try {
209
219
  await state.supervisor.stopLink(id);
@@ -220,10 +230,18 @@ async function remove(ctx: ManagementContext, state: LinkRouteState, id: string)
220
230
  try {
221
231
  const runner = runnerFor(ctx);
222
232
  const platform = record.remotePlatform ?? await requireRemotePlatform(runner, record.alias, knownHostsFile(ctx));
223
- const result = await runner.run(buildExecArgv({ alias: record.alias, argv: remoteOcxArgv(["disconnect"], platform), knownHostsFile: knownHostsFile(ctx) }), { timeoutMs: 30_000 });
224
- if (result.code !== 0) {
225
- await restartTunnel();
226
- return fail("remote_disconnect_failed", "The remote client could not be disconnected.", 502, sshFailureHint(result.stderr));
233
+ if (purge) {
234
+ const purged = await purgeDisconnectRemote(runner, record.alias, knownHostsFile(ctx), platform, record.childKind);
235
+ if (!purged.ok) {
236
+ await restartTunnel();
237
+ return fail(purged.code, purged.message, purged.status, purged.hint);
238
+ }
239
+ } else {
240
+ const result = await runner.run(buildExecArgv({ alias: record.alias, argv: remoteOcxArgv(["disconnect"], platform), knownHostsFile: knownHostsFile(ctx) }), { timeoutMs: 30_000 });
241
+ if (result.code !== 0) {
242
+ await restartTunnel();
243
+ return fail("remote_disconnect_failed", "The remote client could not be disconnected.", 502, sshFailureHint(result.stderr));
244
+ }
227
245
  }
228
246
  } catch (error) {
229
247
  await restartTunnel();
@@ -297,8 +315,8 @@ export async function handleLinkRoutes(ctx: ManagementContext, suppliedState?: L
297
315
  // A dashboard session also learns why it cannot join as a Child. The admin-token answer stays
298
316
  // the exact K16 document that `ocx link status` validates key by key.
299
317
  const denial = ctx.principal === "gui-session" ? joinDenied(ctx) : null;
300
- const body: LinkStatusDto & { joinAvailable?: boolean; joinDenied?: LinkJoinDenied | null } = ctx.principal === "gui-session"
301
- ? { ...dto, joinAvailable: denial === null, joinDenied: denial } : dto;
318
+ const body: LinkStatusDto & { joinAvailable?: boolean; joinDenied?: LinkJoinDenied | null; homeCodexSettingsDigest?: string } = ctx.principal === "gui-session"
319
+ ? { ...dto, joinAvailable: denial === null, joinDenied: denial, homeCodexSettingsDigest: codexSettingsDigest(projectHomeCodexSettings(ctx.config, packageVersion("0.0.0")).settings) } : dto;
302
320
  return Response.json(body, { headers: { "cache-control": "no-store" } });
303
321
  }
304
322
  if (url.pathname === "/api/link/candidates" && req.method === "GET") {
@@ -348,12 +348,16 @@ export async function listManagementModelRows(
348
348
  const native: ManagementModelRow[] = [...nativeRows, ...accountNativeRows].map(row => {
349
349
  const reasoningEfforts = nativeReasoningEfforts(row.metadataSlug).filter(isVisionReasoningEffort);
350
350
  const defaultReasoningEffort = nativeDefaultReasoningEffort(row.metadataSlug);
351
+ const labels = config.providers.openai?.modelDisplayNames;
352
+ const displayName = row.slug === row.metadataSlug && labels && Object.hasOwn(labels, row.slug)
353
+ ? labels[row.slug]?.trim() : undefined;
351
354
  return {
352
355
  provider: "openai",
353
356
  id: row.slug,
354
357
  namespaced: row.slug,
355
358
  disabled: row.disabled,
356
359
  native: true,
360
+ ...(displayName ? { displayName, displayNameOverride: displayName, displayNameSource: "operator" as const } : {}),
357
361
  reasoningEfforts,
358
362
  ...(defaultReasoningEffort ? { defaultReasoningEffort } : {}),
359
363
  inputModalities: nativeInputModalities(row.slug),
@@ -40,7 +40,7 @@ import { OAuthMutationBusyError, removeCredential } from "../../oauth/store";
40
40
  import { cancelKiroDeviceLogin, kiroDeviceConfigBaseline, selectKiroDeviceProfile, startKiroDeviceLogin, statusKiroDeviceLogin, type KiroDeviceMethod } from "../../oauth/kiro-device-login";
41
41
  import { parseKiroIamOptions } from "../../oauth/kiro-iam-identity-center";
42
42
  import { providerDestinationResolvedError } from "../../lib/destination-policy";
43
- import { emailMaskingEnabled, maskedAccountLabel } from "../../lib/privacy";
43
+ import { accountDisplayLabel, emailMaskingEnabled, maskedAccountLabel } from "../../lib/privacy";
44
44
  import { reconcileLiveStateStores } from "../../lib/state-store-registrations";
45
45
  import { enrichProviderFromCatalog, listKeyLoginProviders } from "../../oauth/key-providers";
46
46
  import { deriveProviderPresets } from "../../providers/derive";
@@ -497,7 +497,8 @@ export async function handleOauthAccountRoutes(ctx: ManagementContext): Promise<
497
497
  }
498
498
 
499
499
  // Multiauth account management: list a provider's logged-in accounts, switch the active
500
- // one, or remove one. Emails are masked; tokens never leave the store.
500
+ // one, or remove one. Emails and accountLabel follow privacy.maskEmails, maskedLabel is always
501
+ // masked, and tokens never leave the store.
501
502
  if (url.pathname === "/api/oauth/accounts" && req.method === "GET") {
502
503
  const provider = (url.searchParams.get("provider") ?? "").trim().toLowerCase();
503
504
  if (!isPublicOAuthProvider(provider)) return jsonResponse({ error: "unknown oauth provider" }, 400);
@@ -516,7 +517,8 @@ export async function handleOauthAccountRoutes(ctx: ManagementContext): Promise<
516
517
  } = await import("../../oauth/health");
517
518
  const projectAccounts = () => {
518
519
  const set = getAccountSet(provider);
519
- const current = getLoginStatus(provider, emailMaskingEnabled(config));
520
+ const maskEmails = emailMaskingEnabled(config);
521
+ const current = getLoginStatus(provider, maskEmails);
520
522
  return {
521
523
  ...(provider === "anthropic2" ? { provider } : {}), activeAccountId: current.activeAccountId ?? null,
522
524
  accounts: (current.accounts ?? []).map(summary => {
@@ -528,7 +530,10 @@ export async function handleOauthAccountRoutes(ctx: ManagementContext): Promise<
528
530
  reauthReason: summary.needsReauth === true ? "refresh_failed" : undefined,
529
531
  });
530
532
  const maskedLabel = maskedAccountLabel(full?.credential.email);
531
- return { ...summary, ...(maskedLabel ? { maskedLabel } : {}), ...oauthAccountHealthFields(provider, summary.id, health), quotaMode,
533
+ // `maskedLabel` stays masked for tray surfaces; `accountLabel` follows privacy.maskEmails.
534
+ const accountLabel = accountDisplayLabel(full?.credential.email, maskEmails);
535
+ return { ...summary, ...(maskedLabel ? { maskedLabel } : {}), ...(accountLabel ? { accountLabel } : {}),
536
+ ...oauthAccountHealthFields(provider, summary.id, health), quotaMode,
532
537
  ...(supportsPause ? { paused: full?.paused === true, ...(full?.pauseDetails ? { pauseDetails: full.pauseDetails } : {}) } : {}),
533
538
  ...(isAnthropicOAuthInstance(provider) && supportsPause ? { autoSwitchThresholdOverride: full?.autoSwitchThresholdOverride ?? null,
534
539
  effectiveAutoSwitchThreshold: effectiveAnthropicAccountThresholdForInstance(provider as AnthropicInstanceId, config, full),
@@ -60,7 +60,13 @@ export const PROVIDER_COMPAT_CARRY_FIELDS = [
60
60
  ...RETRY_POLICY_FIELDS,
61
61
  ] as const satisfies readonly (keyof OcxProviderConfig)[];
62
62
 
63
- export const PROVIDER_DISPLAY_CARRY_FIELDS = ["hideRawReasoning"] as const satisfies readonly (keyof OcxProviderConfig)[];
63
+ export const PROVIDER_DISPLAY_CARRY_FIELDS = [
64
+ "hideRawReasoning",
65
+ // The Anthropic thinking display policy (#8363) is operator configuration the dashboard form
66
+ // cannot send either, so an unrelated save must not silently return the model to the default.
67
+ "thinkingDisplay",
68
+ "modelThinkingDisplay",
69
+ ] as const satisfies readonly (keyof OcxProviderConfig)[];
64
70
 
65
71
  export type ProviderCompatCarryField = typeof PROVIDER_COMPAT_CARRY_FIELDS[number];
66
72
  type ProviderDisplayCarryField = typeof PROVIDER_DISPLAY_CARRY_FIELDS[number];
@@ -131,7 +137,8 @@ export function carryProviderCompatFields(
131
137
  for (const field of PROVIDER_DISPLAY_CARRY_FIELDS) {
132
138
  if (sample.submitted.has(field)) continue;
133
139
  const stored = live[field];
134
- if (stored !== undefined) target[field] = stored;
140
+ // Copy maps rather than alias them, like the compatibility settings below.
141
+ if (stored !== undefined) target[field] = stored !== null && typeof stored === "object" ? structuredClone(stored) : stored;
135
142
  }
136
143
  if (!providerOverwriteKeepsDestination(candidate, live, sample)) return;
137
144
  for (const field of PROVIDER_COMPAT_CARRY_FIELDS) {
@@ -120,6 +120,7 @@ import {
120
120
  } from "../auth-cors";
121
121
  import { providerCatalogCapabilityConfigError } from "./provider-capability-config";
122
122
  import { providerEmptyToolOutputConfigError } from "../../config/provider-validation";
123
+ import { applyThinkingDisplayPatchFields } from "./provider-thinking-display-patch";
123
124
  import { applySystemEnvToggle } from "../system-env";
124
125
  import {
125
126
  LOCAL_PROVIDER_RELOAD_NAME_HEADER,
@@ -383,6 +384,14 @@ function applyProviderPatchFields(
383
384
  else delete next.defaultModel;
384
385
  touched = true;
385
386
  }
387
+ for (const field of ["project", "location"] as const) {
388
+ if (!Object.hasOwn(rawBody, field)) continue;
389
+ const value = rawBody[field];
390
+ if (typeof value !== "string") return { error: `${field} must be a string` };
391
+ if (value.trim()) next[field] = value.trim();
392
+ else delete next[field];
393
+ touched = true;
394
+ }
386
395
  if (Object.hasOwn(rawBody, "authMode")) {
387
396
  if (typeof rawBody.authMode !== "string") return { error: "authMode must be a string" };
388
397
  const mode = rawBody.authMode.trim();
@@ -680,6 +689,11 @@ function applyProviderPatchFields(
680
689
  }
681
690
  touched = true;
682
691
  }
692
+ if (Object.hasOwn(rawBody, "thinkingDisplay") || Object.hasOwn(rawBody, "modelThinkingDisplay")) {
693
+ const displayError = applyThinkingDisplayPatchFields(next, rawBody);
694
+ if (displayError) return displayError;
695
+ touched = true;
696
+ }
683
697
  if (Object.hasOwn(rawBody, "noStructuredOutputModels")) {
684
698
  const value = rawBody.noStructuredOutputModels;
685
699
  if (value === null) {
@@ -0,0 +1,54 @@
1
+ import type { OcxProviderConfig } from "../../types";
2
+ import { thinkingDisplayConfigError } from "../../config/provider-validation";
3
+ import { isPlainRecord } from "./shared";
4
+
5
+ type ThinkingDisplay = NonNullable<OcxProviderConfig["thinkingDisplay"]>;
6
+
7
+ /**
8
+ * Apply the `thinkingDisplay` / `modelThinkingDisplay` PATCH mask (#8363).
9
+ *
10
+ * Split out of provider-routes.ts, which sits under the 2,000-line file-size threshold; the
11
+ * behaviour stays identical to the sibling per-model map patches there. A model entry of
12
+ * `null` deletes one key, `null` on the whole map clears it, and provider-level `null` or ""
13
+ * clears the scalar.
14
+ */
15
+ export function applyThinkingDisplayPatchFields(
16
+ next: OcxProviderConfig,
17
+ rawBody: Record<string, unknown>,
18
+ ): { error: string } | null {
19
+ if (Object.hasOwn(rawBody, "thinkingDisplay")) {
20
+ const value = rawBody.thinkingDisplay;
21
+ if (value === null || value === "") {
22
+ delete next.thinkingDisplay;
23
+ } else {
24
+ const error = thinkingDisplayConfigError(value);
25
+ if (error) return { error };
26
+ next.thinkingDisplay = value as ThinkingDisplay;
27
+ }
28
+ }
29
+ if (Object.hasOwn(rawBody, "modelThinkingDisplay")) {
30
+ const value = rawBody.modelThinkingDisplay;
31
+ if (value === null) {
32
+ delete next.modelThinkingDisplay;
33
+ } else {
34
+ if (!isPlainRecord(value)) return { error: "modelThinkingDisplay must be a plain object or null" };
35
+ const merged = Object.assign(
36
+ Object.create(null) as Record<string, ThinkingDisplay>,
37
+ next.modelThinkingDisplay ?? {},
38
+ );
39
+ for (const [model, policy] of Object.entries(value as Record<string, unknown>)) {
40
+ if (!model.trim()) return { error: "modelThinkingDisplay keys must be nonblank model ids" };
41
+ if (policy === null) delete merged[model];
42
+ else {
43
+ const entryError = thinkingDisplayConfigError(policy, `modelThinkingDisplay.${JSON.stringify(model)}`);
44
+ if (entryError) return { error: entryError };
45
+ merged[model] = policy as ThinkingDisplay;
46
+ }
47
+ }
48
+ if (Object.keys(merged).length > 0) next.modelThinkingDisplay = merged;
49
+ else delete next.modelThinkingDisplay;
50
+ }
51
+ }
52
+ return null;
53
+ }
54
+
@@ -451,6 +451,13 @@ export const MANAGEMENT_ROUTES: readonly ManagementRoute[] = [
451
451
  { method: "GET", path: "/api/system/memory", module: "server/management/system-routes", mutates: false },
452
452
  { method: "GET", path: "/api/system/windows-replace-retries", module: "server/management/system-routes", mutates: false },
453
453
  { method: "POST", path: "/api/system/restart", module: "server/management/system-routes", mutates: true },
454
+ // server/management/telemetry-routes
455
+ { method: "GET", path: "/api/telemetry", module: "server/management/telemetry-routes", mutates: false },
456
+ { method: "PUT", path: "/api/telemetry", module: "server/management/telemetry-routes", mutates: true, exempt: { reason: "session-only", why: "User-consent boundary in AGENTS_INSTALL.md: changing telemetry consent over HTTP requires a human dashboard session; CLI callers use ocx telemetry enable/disable." } },
457
+ { method: "GET", path: "/api/telemetry/profile", module: "server/management/telemetry-routes", mutates: false },
458
+ { method: "POST", path: "/api/telemetry/profile", module: "server/management/telemetry-routes", mutates: true, exempt: { reason: "session-only", why: "User-consent boundary in AGENTS_INSTALL.md: connecting a public profile over HTTP requires a human dashboard session; CLI callers use ocx telemetry profile connect in an interactive terminal." } },
459
+ { method: "DELETE", path: "/api/telemetry/profile", module: "server/management/telemetry-routes", mutates: true },
460
+ { method: "GET", path: "/api/telemetry/profile/rank", module: "server/management/telemetry-routes", mutates: false },
454
461
  // --- Further routes an equality scan of their own file cannot see. ---
455
462
  // Each carries `mechanism`; the reconciliation test counts these separately.
456
463
  { method: "GET", path: "/api/storage", module: "server/management/storage-log-guard-routes", mutates: false, mechanism: "negated-guard" },
@@ -1,12 +1,15 @@
1
1
  import { jsonResponse } from "../auth-cors";
2
2
  import type { ManagementContext } from "./context";
3
3
 
4
+ /** The Remember enrollment route; the management Origin gate names its refusal reason (#8338). */
5
+ export const SESSION_REMEMBER_PATH = "/api/session/remember";
6
+
4
7
  export function handleSessionRoutes(ctx: ManagementContext): Response | null {
5
8
  if (ctx.url.pathname === "/api/session/remember" && ctx.req.method === "POST") {
6
9
  if (ctx.principal !== "admin-token") return jsonResponse({ error: "Admin token required" }, 403, ctx.req, ctx.config);
7
10
  try {
8
11
  const remembered = ctx.sessionControl?.rememberDevice?.(ctx.req, ctx.config);
9
- if (!remembered) return jsonResponse({ error: "Remember requires a direct HTTPS dashboard (or loopback) and matching Origin" }, 403, ctx.req, ctx.config);
12
+ if (!remembered) return jsonResponse({ error: "Remember requires a direct HTTPS dashboard (or loopback) and matching Origin", code: "remember_requires_direct_origin" }, 403, ctx.req, ctx.config);
10
13
  const response = jsonResponse({ session: remembered.session, device: remembered.device }, 200, ctx.req, ctx.config);
11
14
  response.headers.set("Set-Cookie", remembered.cookie);
12
15
  response.headers.set("Cache-Control", "no-store");
@@ -0,0 +1,37 @@
1
+ import type { ManagementContext } from "./context";
2
+ import {
3
+ handleGetTelemetryRoute,
4
+ handlePutTelemetryRoute,
5
+ } from "../../telemetry/routes";
6
+
7
+ export async function handleTelemetryRoutes(ctx: ManagementContext): Promise<Response | null> {
8
+ const { req, url } = ctx;
9
+ if (url.pathname.startsWith("/api/telemetry/profile")) {
10
+ return handleTelemetryProfileRoutes(ctx);
11
+ }
12
+ if (url.pathname === "/api/telemetry" && req.method === "GET") {
13
+ return handleGetTelemetryRoute(ctx);
14
+ }
15
+ if (url.pathname === "/api/telemetry" && req.method === "PUT") {
16
+ return handlePutTelemetryRoute(ctx);
17
+ }
18
+ return null;
19
+ }
20
+
21
+ /** The opt-in public profile; its handlers load only when one of these paths is requested. */
22
+ async function handleTelemetryProfileRoutes(ctx: ManagementContext): Promise<Response | null> {
23
+ const { req, url } = ctx;
24
+ if (url.pathname === "/api/telemetry/profile" && req.method === "GET") {
25
+ return (await import("../../telemetry/profile/routes")).handleGetProfileRoute(ctx);
26
+ }
27
+ if (url.pathname === "/api/telemetry/profile" && req.method === "POST") {
28
+ return (await import("../../telemetry/profile/routes")).handlePostProfileRoute(ctx);
29
+ }
30
+ if (url.pathname === "/api/telemetry/profile" && req.method === "DELETE") {
31
+ return (await import("../../telemetry/profile/routes")).handleDeleteProfileRoute(ctx);
32
+ }
33
+ if (url.pathname === "/api/telemetry/profile/rank" && req.method === "GET") {
34
+ return (await import("../../telemetry/profile/routes")).handleGetProfileRankRoute(ctx);
35
+ }
36
+ return null;
37
+ }