@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.
- package/AGENTS_INSTALL.md +19 -1
- package/README.md +37 -33
- package/SPONSORS.md +5 -1
- package/bin/ocx.mjs +1 -1
- package/gui/dist/assets/{App-C1hGwaN1.css → App-COo8Yopd.css} +1 -1
- package/gui/dist/assets/App-g3Cm2xhZ.js +59 -0
- package/gui/dist/assets/Tray-BMDkAiXy.js +1 -0
- package/gui/dist/assets/brand-mark-nr3ziR-T.js +1 -0
- package/gui/dist/assets/index-Bziu8gTy.css +2 -0
- package/gui/dist/assets/index-OYzhQUNP.js +94 -0
- package/gui/dist/assets/{segment-thumb-features-fYEMxBaW.js → segment-thumb-features-DKCVUUTi.js} +1 -1
- package/gui/dist/classic/assets/App-CgPBKUP-.js +58 -0
- package/gui/dist/classic/assets/{Tray-BqZueZOx.js → Tray-BedmOsE7.js} +1 -1
- package/gui/dist/classic/assets/index-BR-HhNrp.js +94 -0
- package/gui/dist/classic/assets/quota-summary-CXKhvSmQ.js +1 -0
- package/gui/dist/classic/index.html +1 -1
- package/gui/dist/index.html +2 -2
- package/native/ocx-child/Cargo.lock +215 -0
- package/native/ocx-child/Cargo.toml +31 -0
- package/native/ocx-child/src/cli.rs +1901 -0
- package/native/ocx-child/src/codex_home.rs +429 -0
- package/native/ocx-child/src/codex_settings.rs +231 -0
- package/native/ocx-child/src/daemon.rs +363 -0
- package/native/ocx-child/src/http_wire.rs +619 -0
- package/native/ocx-child/src/journal.rs +977 -0
- package/native/ocx-child/src/lib.rs +22 -0
- package/native/ocx-child/src/main.rs +9 -0
- package/native/ocx-child/src/parity.rs +102 -0
- package/native/ocx-child/src/platform.rs +1487 -0
- package/native/ocx-child/src/relay.rs +1288 -0
- package/native/ocx-child/src/relay_auth.rs +166 -0
- package/native/ocx-child/src/routes.rs +236 -0
- package/native/ocx-child/src/state.rs +190 -0
- package/native/ocx-child/src/test_hooks.rs +58 -0
- package/native/ocx-child/src/toml_surgeon.rs +1156 -0
- package/package.json +8 -2
- package/src/adapters/anthropic-image-normalize.ts +1 -1
- package/src/adapters/anthropic.ts +28 -2
- package/src/adapters/claude-cli/adapter.ts +5 -25
- package/src/adapters/claude-cli/instruction-images.ts +31 -0
- package/src/adapters/claude-cli/stable-replay.ts +42 -14
- package/src/adapters/claude-cli/usage-admission.ts +53 -64
- package/src/adapters/client-fingerprint.ts +1 -1
- package/src/adapters/coding-agent/protocol.ts +1 -1
- package/src/adapters/devin/live-models.ts +3 -0
- package/src/adapters/google-http.ts +3 -0
- package/src/adapters/google-vertex-key-project.ts +10 -2
- package/src/adapters/google.ts +40 -8
- package/src/adapters/kiro/usage.ts +3 -13
- package/src/adapters/openai-chat/mistral-image-limit.ts +28 -15
- package/src/adapters/openai-chat-images.ts +100 -0
- package/src/adapters/openai-chat.ts +6 -9
- package/src/adapters/openai-responses/passthrough.ts +5 -2
- package/src/adapters/openai-responses/request-strips.ts +32 -0
- package/src/adapters/openai-responses/tool-schema.ts +9 -4
- package/src/chat/inbound.ts +1 -1
- package/src/claude/auth-detect.ts +26 -8
- package/src/claude/inbound-content-options.ts +18 -3
- package/src/claude/inbound.ts +5 -2
- package/src/cli/bundled-bun-diagnostic.ts +91 -0
- package/src/cli/capabilities-agents-routing.ts +2 -2
- package/src/cli/capabilities-observe-system.ts +60 -0
- package/src/cli/combo-input.ts +6 -0
- package/src/cli/combo-result.ts +1 -1
- package/src/cli/combo.ts +4 -0
- package/src/cli/config-command.ts +16 -2
- package/src/cli/connect.ts +12 -10
- package/src/cli/dispatch.ts +4 -0
- package/src/cli/doctor.ts +11 -0
- package/src/cli/help.ts +1 -0
- package/src/cli/init.ts +4 -0
- package/src/cli/link-enrollment.ts +152 -25
- package/src/cli/link-local-control.ts +49 -0
- package/src/cli/link.ts +37 -10
- package/src/cli/provider-lifecycle-runtime.ts +4 -2
- package/src/cli/registry.ts +13 -0
- package/src/cli/star-prompt.ts +2 -0
- package/src/cli/status.ts +1 -1
- package/src/cli/telemetry-profile.ts +206 -0
- package/src/cli/telemetry.ts +260 -0
- package/src/client/hub-relay.ts +26 -0
- package/src/client/machine-api.ts +3 -0
- package/src/clients/config-export/t3code.ts +44 -5
- package/src/clients/omo-role-models.ts +1 -1
- package/src/codex/catalog/bundled.ts +44 -2
- package/src/codex/runtime.ts +12 -0
- package/src/codex/shim-restore-lock.ts +67 -30
- package/src/combos/types.ts +21 -1
- package/src/config/atomic-write.ts +24 -1
- package/src/config/diagnostics.ts +15 -0
- package/src/config/live-reconcile.ts +17 -0
- package/src/config/load-degrade.ts +16 -0
- package/src/config/provider-validation.ts +29 -0
- package/src/config/schema/config-schema.ts +24 -0
- package/src/config/schema/leaf-validators.ts +17 -0
- package/src/config/telemetry-carry.ts +30 -0
- package/src/config.ts +13 -1
- package/src/generated/compatibility-version.json +422 -170
- package/src/generated/model-metadata.ts +3 -3
- package/src/integrations/aside-profiles.ts +7 -1
- package/src/integrations/owned-refresh.ts +9 -2
- package/src/lab/artifacts/secure-fs.ts +12 -11
- package/src/lab/fabric/scratch.ts +11 -9
- package/src/lab/public/community.ts +2 -3
- package/src/lab/public/file-safety.ts +18 -20
- package/src/lab/public/mutation-lock.ts +109 -337
- package/src/lab/public/private-file.ts +4 -3
- package/src/lib/bun-runtime-preflight.ts +1 -1
- package/src/lib/codex-catalog-read-only.ts +122 -0
- package/src/lib/config-ownership.ts +56 -18
- package/src/lib/errors.ts +11 -0
- package/src/lib/gcp-adc.ts +167 -48
- package/src/lib/jsonc.ts +4 -2
- package/src/lib/local-control-socket.ts +88 -0
- package/src/lib/privacy.ts +15 -0
- package/src/lib/provider-client-headers.ts +3 -0
- package/src/lib/token-estimate.ts +13 -2
- package/src/link/child-binary-source.ts +228 -0
- package/src/link/ephemeral-child.ts +45 -0
- package/src/link/remote-plant.ts +306 -0
- package/src/link/remote-windows.ts +59 -5
- package/src/link/ssh-argv.ts +71 -8
- package/src/link/status-projection.ts +2 -0
- package/src/link/store.ts +5 -1
- package/src/oauth/anthropic-model-quota.ts +12 -0
- package/src/oauth/anthropic-routing.ts +11 -4
- package/src/oauth/claude-keychain-read.ts +165 -0
- package/src/oauth/kiro-iam-identity-center.ts +4 -1
- package/src/oauth/local-token-detect.ts +14 -17
- package/src/protocols/envelope.ts +20 -2
- package/src/providers/api-key-selection.ts +8 -2
- package/src/providers/claude-cli-identity.ts +9 -3
- package/src/providers/claude-cli-usage-state.ts +93 -0
- package/src/providers/claude-cli-usage.ts +3 -2
- package/src/providers/github-copilot-auto.ts +25 -5
- package/src/providers/meta-muse-plan-refusal.ts +94 -0
- package/src/providers/model-rename-fields.ts +3 -0
- package/src/providers/quota/anthropic-family-headers.ts +8 -1
- package/src/providers/quota/anthropic-usage-windows.ts +49 -2
- package/src/providers/quota/vendor-probes-key.ts +23 -4
- package/src/providers/quota/vendor-probes-oauth.ts +59 -0
- package/src/providers/quota/workbuddy.ts +2 -2
- package/src/providers/quota-types.ts +7 -0
- package/src/providers/quota.ts +25 -18
- package/src/providers/registry/entries-core.ts +7 -4
- package/src/providers/registry/entries-extended.ts +42 -8
- package/src/providers/registry/model-ids.ts +1 -0
- package/src/providers/registry/model-seeds.ts +10 -2
- package/src/providers/registry/types.ts +6 -0
- package/src/providers/resolved-model-policy.ts +4 -0
- package/src/providers/routed-config.ts +30 -3
- package/src/providers/stale-no-vision-seed-migration.ts +7 -0
- package/src/providers/vertex-environment-authority.ts +50 -0
- package/src/providers/workbuddy-credit-balance.ts +38 -6
- package/src/quota-pool/assemble.ts +14 -6
- package/src/responses/retained-compaction.ts +31 -5
- package/src/router.ts +1 -0
- package/src/server/adapter-resolve.ts +11 -6
- package/src/server/audio-dictation.ts +21 -7
- package/src/server/auth-cors.ts +19 -0
- package/src/server/background-lifecycle.ts +71 -0
- package/src/server/chat-completions.ts +2 -0
- package/src/server/claude-messages.ts +30 -3
- package/src/server/index/live-sideband.ts +15 -1
- package/src/server/index/local-control-listener.ts +515 -0
- package/src/server/index/optional-listeners.ts +21 -1
- package/src/server/index/serve-options.ts +4 -3
- package/src/server/index/websocket-handler.ts +2 -0
- package/src/server/index.ts +3 -0
- package/src/server/management/combo-routes.ts +6 -1
- package/src/server/management/context.ts +1 -0
- package/src/server/management/link-child-preflight.ts +74 -0
- package/src/server/management/link-enrollment.ts +190 -25
- package/src/server/management/link-route-state.ts +6 -1
- package/src/server/management/link-routes.ts +27 -9
- package/src/server/management/model-rows.ts +4 -0
- package/src/server/management/oauth-account-routes.ts +9 -4
- package/src/server/management/provider-overwrite-carry.ts +9 -2
- package/src/server/management/provider-routes.ts +14 -0
- package/src/server/management/provider-thinking-display-patch.ts +54 -0
- package/src/server/management/route-registry.ts +7 -0
- package/src/server/management/session-routes.ts +4 -1
- package/src/server/management/telemetry-routes.ts +37 -0
- package/src/server/management/usage-aggregate-cache.ts +290 -67
- package/src/server/management-api.ts +11 -2
- package/src/server/messages-native-preflight.ts +166 -0
- package/src/server/messages-native.ts +143 -43
- package/src/server/messages-shared.ts +14 -0
- package/src/server/proxy-liveness.ts +99 -6
- package/src/server/request-log-conversation.ts +18 -2
- package/src/server/request-log.ts +7 -2
- package/src/server/responses/adapter-continuation.ts +1 -0
- package/src/server/responses/adapter-dispatch.ts +11 -28
- package/src/server/responses/adapter-failure-message.ts +68 -0
- package/src/server/responses/combo-stream-preflight.ts +14 -2
- package/src/server/responses/compact.ts +13 -1
- package/src/server/responses/core-auth.ts +26 -5
- package/src/server/responses/core-codex-account.ts +8 -1
- package/src/server/responses/core-combo-failure.ts +6 -1
- package/src/server/responses/core-combo-native.ts +150 -37
- package/src/server/responses/core-combo.ts +15 -9
- package/src/server/responses/core-normalize.ts +1 -0
- package/src/server/responses/core-options.ts +7 -1
- package/src/server/responses/core-pipeline.ts +21 -1
- package/src/server/responses/fetch-helpers.ts +5 -0
- package/src/server/responses/opengateway-completion-guard.ts +7 -3
- package/src/server/responses/passthrough-delivery.ts +8 -1
- package/src/server/responses/passthrough-error.ts +22 -0
- package/src/server/responses/request-prepare.ts +7 -1
- package/src/server/responses/request-transport.ts +28 -5
- package/src/server/responses/run-turn-execution.ts +13 -0
- package/src/server/sse-frame-buffer.ts +5 -0
- package/src/server/ws-bridge.ts +10 -0
- package/src/service/launchd.ts +78 -4
- package/src/telemetry/aggregate.ts +348 -0
- package/src/telemetry/consent.ts +128 -0
- package/src/telemetry/contract.ts +403 -0
- package/src/telemetry/disclosure.ts +19 -0
- package/src/telemetry/install-id.ts +226 -0
- package/src/telemetry/payload.ts +129 -0
- package/src/telemetry/profile/client.ts +150 -0
- package/src/telemetry/profile/contract.ts +288 -0
- package/src/telemetry/profile/disclosure.ts +14 -0
- package/src/telemetry/profile/paths.ts +13 -0
- package/src/telemetry/profile/routes.ts +99 -0
- package/src/telemetry/profile/service.ts +234 -0
- package/src/telemetry/profile/state.ts +189 -0
- package/src/telemetry/profile/sync.ts +276 -0
- package/src/telemetry/routes.ts +183 -0
- package/src/telemetry/scheduler.ts +386 -0
- package/src/telemetry/sender.ts +97 -0
- package/src/telemetry/state.ts +334 -0
- package/src/types/combo-jev-effort-mode.ts +11 -0
- package/src/types/config.ts +3 -0
- package/src/types/provider.ts +11 -1
- package/src/types/request.ts +2 -0
- package/src/types/telemetry.ts +15 -0
- package/src/types/wire.ts +10 -0
- package/src/types.ts +5 -0
- package/src/update/index.ts +7 -1
- package/src/update/minisign.d.mts +17 -0
- package/src/update/minisign.mjs +88 -0
- package/src/update/signed-supply.d.mts +59 -0
- package/src/update/signed-supply.mjs +289 -0
- package/src/update/trust-root.json +38 -0
- package/src/update/update-bounded-json.d.mts +4 -0
- package/src/update/update-bounded-json.mjs +113 -0
- package/src/update/update-bytes.d.mts +2 -0
- package/src/update/update-bytes.mjs +23 -0
- package/src/update/update-candidate-id.d.mts +2 -0
- package/src/update/update-candidate-id.mjs +23 -0
- package/src/update/update-checkpoint-codec.d.mts +33 -0
- package/src/update/update-checkpoint-codec.mjs +217 -0
- package/src/update/update-contracts.d.mts +24 -0
- package/src/update/update-contracts.mjs +207 -0
- package/src/update/update-signature-threshold.d.mts +12 -0
- package/src/update/update-signature-threshold.mjs +47 -0
- package/src/update/update-signed-version.d.mts +5 -0
- package/src/update/update-signed-version.mjs +25 -0
- package/src/update/update-trust-anchor.d.mts +2 -0
- package/src/update/update-trust-anchor.mjs +2 -0
- package/src/usage/cache-diagnostic.ts +195 -50
- package/src/usage/expected-prices.ts +20 -2
- package/src/usage/filter-index.ts +1469 -0
- package/src/usage/ledger-scanner.ts +245 -4
- package/src/usage/source-filter.ts +10 -2
- package/src/usage/summary.ts +16 -0
- package/src/web-search/parse.ts +265 -38
- package/gui/dist/assets/App-BepstgEN.js +0 -59
- package/gui/dist/assets/Tray-BinxbEZo.js +0 -1
- package/gui/dist/assets/brand-mark-wzPe3R-J.js +0 -1
- package/gui/dist/assets/index-C-9X2yaI.js +0 -94
- package/gui/dist/assets/index-bnUWypyz.css +0 -2
- package/gui/dist/classic/assets/App-DX88_GCW.js +0 -58
- package/gui/dist/classic/assets/index-fSP71pLB.js +0 -94
- 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
|
-
|
|
206
|
-
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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 = [
|
|
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
|
-
|
|
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
|
+
}
|