@bitkyc08/opencodex 2.99.0-preview.20261108 → 2.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-CitvEefy.js +59 -0
- package/gui/dist/assets/Tray-CeKVWQyB.js +1 -0
- package/gui/dist/assets/{brand-mark-DpiBmFGI.js → brand-mark-M92UnxX2.js} +1 -1
- package/gui/dist/assets/index-BP47do6-.js +94 -0
- package/gui/dist/assets/index-DmDooSAG.css +2 -0
- package/gui/dist/assets/{segment-thumb-features-JcszQ18T.js → segment-thumb-features-CcxZBnxv.js} +1 -1
- package/gui/dist/classic/assets/App-aYgIQMxI.js +58 -0
- package/gui/dist/classic/assets/{Tray-5v86r9Az.js → Tray-D8jfUXpQ.js} +1 -1
- package/gui/dist/classic/assets/index-CfGqHooN.js +94 -0
- package/gui/dist/classic/assets/quota-summary-R-ih7OlS.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.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/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-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 +405 -153
- 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 +49 -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/claude-keychain-read.ts +165 -0
- 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-usage-state.ts +93 -0
- 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/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.ts +25 -18
- package/src/providers/registry/entries-core.ts +7 -4
- package/src/providers/registry/entries-extended.ts +39 -7
- package/src/providers/registry/model-seeds.ts +10 -2
- 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/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/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 +244 -38
- package/gui/dist/assets/App-CWz0areF.js +0 -59
- package/gui/dist/assets/Tray-BosDoskm.js +0 -1
- package/gui/dist/assets/index-CAxjGWkm.js +0 -94
- package/gui/dist/assets/index-bnUWypyz.css +0 -2
- package/gui/dist/classic/assets/App-BOEsFmiN.js +0 -58
- package/gui/dist/classic/assets/index-ClZ_zZ77.js +0 -94
- package/gui/dist/classic/assets/quota-summary-xwvDtvu7.js +0 -1
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { lstatSync, mkdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { isatty } from "node:tty";
|
|
4
|
+
import { getConfigDir, mutatePersistedConfig, readConfigDiagnostics } from "../config";
|
|
5
|
+
import { atomicWriteFileNoFollow } from "../config/atomic-write";
|
|
6
|
+
import { withConfigDirHardeningSettled } from "../config/paths";
|
|
7
|
+
import { recordOwnedConfigPath } from "../lib/config-ownership";
|
|
8
|
+
import { resolveTelemetryStatus } from "../telemetry/consent";
|
|
9
|
+
import { TELEMETRY_DISCLOSURE_HEADING, TELEMETRY_DISCLOSURE_POINTS } from "../telemetry/disclosure";
|
|
10
|
+
import { deleteTelemetryInstallId } from "../telemetry/install-id";
|
|
11
|
+
import { buildTelemetryStatusSnapshot, type TelemetryStatusSnapshot } from "../telemetry/routes";
|
|
12
|
+
import {
|
|
13
|
+
clearPendingTelemetryDecision,
|
|
14
|
+
recordPendingTelemetryDecision,
|
|
15
|
+
withPendingTelemetryDecision,
|
|
16
|
+
} from "../telemetry/scheduler";
|
|
17
|
+
import type { OcxTelemetryConfig, OcxTelemetryDecision } from "../types";
|
|
18
|
+
import { currentVersion } from "../update/index";
|
|
19
|
+
import { isAgentDriven } from "./agent-driven";
|
|
20
|
+
import { interactiveConfirm } from "./interactive-confirm";
|
|
21
|
+
import {
|
|
22
|
+
CliUsageError,
|
|
23
|
+
printData,
|
|
24
|
+
rejectArgs,
|
|
25
|
+
runCliAction,
|
|
26
|
+
runtimeRequest,
|
|
27
|
+
takeFlag,
|
|
28
|
+
type RuntimeApiDeps,
|
|
29
|
+
} from "./runtime-api";
|
|
30
|
+
|
|
31
|
+
const USAGE = `Usage:
|
|
32
|
+
ocx telemetry [status] [--json]
|
|
33
|
+
ocx telemetry enable [--json]
|
|
34
|
+
ocx telemetry disable [--json]
|
|
35
|
+
ocx telemetry profile [status|connect|disconnect] [--json]`;
|
|
36
|
+
|
|
37
|
+
export const TELEMETRY_DEFERRAL_FILE = ".telemetry-deferred";
|
|
38
|
+
const DEFERRAL_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
39
|
+
|
|
40
|
+
export const TELEMETRY_CLI_DISCLOSURE_LINES = Object.freeze([
|
|
41
|
+
` ${TELEMETRY_DISCLOSURE_HEADING}`,
|
|
42
|
+
...TELEMETRY_DISCLOSURE_POINTS.map(point => ` • ${point}`),
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
export function printTelemetryDisclosure(): void {
|
|
46
|
+
console.log(TELEMETRY_CLI_DISCLOSURE_LINES.join("\n"));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function isTelemetryDeferralCurrent(record: string | null, version: string, now: number): boolean {
|
|
50
|
+
if (!record) return false;
|
|
51
|
+
const match = /^(\S+)\s+(\S+)\s*$/.exec(record.trim());
|
|
52
|
+
if (!match) return false;
|
|
53
|
+
const at = Date.parse(match[1]!);
|
|
54
|
+
if (Number.isNaN(at)) return false;
|
|
55
|
+
const age = now - at;
|
|
56
|
+
if (version !== "?" && match[2] === version) return age >= 0;
|
|
57
|
+
return age >= 0 && age < DEFERRAL_MAX_AGE_MS;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface TelemetryPromptTestDeps {
|
|
61
|
+
interactiveConfirm?: typeof interactiveConfirm;
|
|
62
|
+
isTty?: () => boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let promptDepsForTests: TelemetryPromptTestDeps | null = null;
|
|
66
|
+
|
|
67
|
+
export function setTelemetryPromptDepsForTests(deps: TelemetryPromptTestDeps | null): void {
|
|
68
|
+
promptDepsForTests = deps;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isInteractiveTty(): boolean {
|
|
72
|
+
try {
|
|
73
|
+
return promptDepsForTests?.isTty ? promptDepsForTests.isTty() : Boolean(isatty(0) && isatty(1));
|
|
74
|
+
} catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function persistTelemetryDecision(decision: OcxTelemetryDecision): Promise<void> {
|
|
80
|
+
const nowIso = new Date().toISOString();
|
|
81
|
+
const dir = getConfigDir();
|
|
82
|
+
const mutate = () =>
|
|
83
|
+
mutatePersistedConfig(fresh => {
|
|
84
|
+
const prev = fresh.telemetry;
|
|
85
|
+
const next: OcxTelemetryConfig = {
|
|
86
|
+
decision,
|
|
87
|
+
decidedAt: nowIso,
|
|
88
|
+
noticeShownAt: prev?.noticeShownAt ?? nowIso,
|
|
89
|
+
};
|
|
90
|
+
const changed = JSON.stringify(prev) !== JSON.stringify(next);
|
|
91
|
+
fresh.telemetry = next;
|
|
92
|
+
return { changed, value: next };
|
|
93
|
+
});
|
|
94
|
+
const outcome = await withConfigDirHardeningSettled(dir, () => mutate());
|
|
95
|
+
if (outcome.status === "unavailable" && outcome.reason === "missing") {
|
|
96
|
+
// A fresh install has no config.json yet; the Windows installer's opt-out arrives exactly
|
|
97
|
+
// then. Creating the config would make `ocx init` skip setup, so hold the decision in
|
|
98
|
+
// telemetry-state.json; it applies until a decision is written into the config.
|
|
99
|
+
recordPendingTelemetryDecision({ decision, decidedAt: nowIso, noticeShownAt: nowIso }, dir);
|
|
100
|
+
} else if (outcome.status === "unavailable") {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`Cannot update telemetry configuration: config.json is ${outcome.reason}. Fix or restore config.json before retrying.`,
|
|
103
|
+
);
|
|
104
|
+
} else {
|
|
105
|
+
clearPendingTelemetryDecision(dir);
|
|
106
|
+
}
|
|
107
|
+
if (decision === "declined") {
|
|
108
|
+
deleteTelemetryInstallId(dir);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* One-time telemetry consent prompt for interactive starts (`ocx start`, `ocx service install`,
|
|
114
|
+
* `ocx init`). Under an agent-driven session, non-TTY, or `OCX_SERVICE=1`, prints a one-line
|
|
115
|
+
* notice at most once per version and records neither `noticeShownAt` nor `decision`.
|
|
116
|
+
*/
|
|
117
|
+
export async function maybeShowTelemetryPrompt(): Promise<void> {
|
|
118
|
+
try {
|
|
119
|
+
const diagnostics = readConfigDiagnostics({ passive: true });
|
|
120
|
+
const status = resolveTelemetryStatus(withPendingTelemetryDecision(diagnostics.config), process.env);
|
|
121
|
+
if (status.envOverride !== null || status.decision !== null || status.noticeShownAt !== null) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const isTty = isInteractiveTty();
|
|
125
|
+
const dir = getConfigDir();
|
|
126
|
+
if (isAgentDriven() || !isTty || Boolean(process.env.OCX_SERVICE)) {
|
|
127
|
+
const deferralPath = join(dir, TELEMETRY_DEFERRAL_FILE);
|
|
128
|
+
let record: string | null = null;
|
|
129
|
+
try {
|
|
130
|
+
const stat = lstatSync(deferralPath);
|
|
131
|
+
if (stat.isFile() && !stat.isSymbolicLink() && stat.size <= 1024) {
|
|
132
|
+
record = readFileSync(deferralPath, "utf8");
|
|
133
|
+
}
|
|
134
|
+
} catch { /* best-effort */ }
|
|
135
|
+
const version = currentVersion();
|
|
136
|
+
if (isTelemetryDeferralCurrent(record, version, Date.now())) return;
|
|
137
|
+
console.log(
|
|
138
|
+
" ℹ️ Anonymous telemetry is awaiting human consent (run 'ocx telemetry status' or open the dashboard; disable anytime with 'ocx telemetry disable' or OCX_TELEMETRY=0).",
|
|
139
|
+
);
|
|
140
|
+
try {
|
|
141
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
142
|
+
recordOwnedConfigPath(dir, deferralPath);
|
|
143
|
+
atomicWriteFileNoFollow(deferralPath, `${new Date().toISOString()} ${version}\n`);
|
|
144
|
+
} catch { /* best-effort */ }
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
printTelemetryDisclosure();
|
|
148
|
+
const ask = promptDepsForTests?.interactiveConfirm ?? interactiveConfirm;
|
|
149
|
+
const yes = await ask({
|
|
150
|
+
question: "\n Share anonymous usage statistics? [Y/n]",
|
|
151
|
+
defaultYes: true,
|
|
152
|
+
});
|
|
153
|
+
await persistTelemetryDecision(yes ? "accepted" : "declined");
|
|
154
|
+
} catch {
|
|
155
|
+
/* never disrupt startup or setup */
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function formatStatusLines(snapshot: TelemetryStatusSnapshot): string[] {
|
|
160
|
+
return [
|
|
161
|
+
`Telemetry: ${snapshot.effective ? "enabled" : "disabled"} (${snapshot.reason})`,
|
|
162
|
+
`Decision: ${snapshot.decision ?? "undecided"}`,
|
|
163
|
+
...(snapshot.envOverride ? [`Environment override: ${snapshot.envOverride}`] : []),
|
|
164
|
+
`Install channel: ${snapshot.installChannel}`,
|
|
165
|
+
`Last sent day: ${snapshot.lastSentDay ?? "never"}`,
|
|
166
|
+
...(snapshot.stateUnreadable
|
|
167
|
+
? ["Sending paused: telemetry-state.json cannot be read. Choosing again (ocx telemetry enable or disable) rebuilds it."]
|
|
168
|
+
: []),
|
|
169
|
+
`Preview eligible: ${snapshot.previewEligible ? "yes" : "no"}`,
|
|
170
|
+
snapshot.previewEligible
|
|
171
|
+
? `Preview (${snapshot.preview.day}, next eligible send):`
|
|
172
|
+
: `Preview (${snapshot.preview.day}, sample only — not eligible to send):`,
|
|
173
|
+
JSON.stringify(snapshot.preview, null, 2),
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async function readLiveOrLocalSnapshot(deps: RuntimeApiDeps): Promise<TelemetryStatusSnapshot> {
|
|
178
|
+
try {
|
|
179
|
+
return await runtimeRequest("/api/telemetry", {}, deps) as TelemetryStatusSnapshot;
|
|
180
|
+
} catch {
|
|
181
|
+
const config = readConfigDiagnostics({ passive: true }).config;
|
|
182
|
+
return await buildTelemetryStatusSnapshot(config);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export async function handleTelemetryCommand(argv: string[], deps: RuntimeApiDeps = {}): Promise<number> {
|
|
187
|
+
const args = [...argv];
|
|
188
|
+
const wantsJson = takeFlag(args, "--json");
|
|
189
|
+
const sub = (args.shift() ?? "status").toLowerCase();
|
|
190
|
+
if (sub === "profile") {
|
|
191
|
+
if (args.includes("--json")) {
|
|
192
|
+
return runCliAction(async () => { throw new CliUsageError("telemetry flags may only be specified once", USAGE); });
|
|
193
|
+
}
|
|
194
|
+
const { handleTelemetryProfileCommand } = await import("./telemetry-profile");
|
|
195
|
+
return handleTelemetryProfileCommand(args, wantsJson, deps);
|
|
196
|
+
}
|
|
197
|
+
if (sub === "enable") {
|
|
198
|
+
if (isAgentDriven()) {
|
|
199
|
+
const error = {
|
|
200
|
+
ok: false,
|
|
201
|
+
code: "agent_consent_required",
|
|
202
|
+
error:
|
|
203
|
+
"Refused: telemetry consent must be enabled by a human user in their own interactive terminal or in the dashboard (Proxy details).",
|
|
204
|
+
};
|
|
205
|
+
if (wantsJson) console.log(JSON.stringify(error, null, 2));
|
|
206
|
+
else console.error(`${error.code}: ${error.error}`);
|
|
207
|
+
return 1;
|
|
208
|
+
}
|
|
209
|
+
if (Boolean(process.env.OCX_SERVICE) || !isInteractiveTty()) {
|
|
210
|
+
const error = {
|
|
211
|
+
ok: false,
|
|
212
|
+
code: "tty_required",
|
|
213
|
+
error:
|
|
214
|
+
"Refused: 'ocx telemetry enable' requires an interactive human terminal (TTY stdin and stdout, not OCX_SERVICE). Enable telemetry in an interactive terminal or in the dashboard (Proxy details).",
|
|
215
|
+
};
|
|
216
|
+
if (wantsJson) console.log(JSON.stringify(error, null, 2));
|
|
217
|
+
else console.error(`${error.code}: ${error.error}`);
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return runCliAction(async () => {
|
|
222
|
+
if (args.includes("--json")) {
|
|
223
|
+
throw new CliUsageError("telemetry flags may only be specified once", USAGE);
|
|
224
|
+
}
|
|
225
|
+
if (sub === "status") {
|
|
226
|
+
rejectArgs(args, USAGE);
|
|
227
|
+
const snapshot = await readLiveOrLocalSnapshot(deps);
|
|
228
|
+
printData(snapshot, wantsJson, formatStatusLines(snapshot));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
if (sub === "enable") {
|
|
232
|
+
rejectArgs(args, USAGE);
|
|
233
|
+
printTelemetryDisclosure();
|
|
234
|
+
const ask = promptDepsForTests?.interactiveConfirm ?? interactiveConfirm;
|
|
235
|
+
const yes = await ask({
|
|
236
|
+
question: "\n Share anonymous usage statistics? [Y/n]",
|
|
237
|
+
defaultYes: true,
|
|
238
|
+
});
|
|
239
|
+
if (!yes) {
|
|
240
|
+
throw new Error("Telemetry enable cancelled: confirmation was declined.");
|
|
241
|
+
}
|
|
242
|
+
await persistTelemetryDecision("accepted");
|
|
243
|
+
const snapshot = await buildTelemetryStatusSnapshot(readConfigDiagnostics({ passive: true }).config);
|
|
244
|
+
printData({ ok: true, ...snapshot }, wantsJson, ["Anonymous telemetry enabled."]);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (sub === "disable") {
|
|
248
|
+
rejectArgs(args, USAGE);
|
|
249
|
+
await persistTelemetryDecision("declined");
|
|
250
|
+
const snapshot = await buildTelemetryStatusSnapshot(readConfigDiagnostics({ passive: true }).config);
|
|
251
|
+
printData({ ok: true, ...snapshot }, wantsJson, [
|
|
252
|
+
"Anonymous telemetry disabled and local telemetry identifier removed.",
|
|
253
|
+
]);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
throw new CliUsageError(`unknown telemetry command ${sub}`, USAGE);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const TELEMETRY_USAGE = USAGE;
|
package/src/client/hub-relay.ts
CHANGED
|
@@ -10,6 +10,8 @@ export const HUB_RELAY_REQUEST_BODY_MAX_BYTES = 4 * 1024 * 1024;
|
|
|
10
10
|
export const HUB_RELAY_RESPONSE_BODY_MAX_BYTES = 16 * 1024 * 1024;
|
|
11
11
|
export const HUB_RELAY_DEFAULT_TIMEOUT_MS = 15_000;
|
|
12
12
|
export const HUB_RELAY_HEADER_MAX_BYTES = 64 * 1024;
|
|
13
|
+
export const HUB_RELAY_EXPECTED_TARGET_HEADER = "x-opencodex-expected-target";
|
|
14
|
+
export const HUB_RELAY_EXPECTED_TARGET_MAX_BYTES = 512;
|
|
13
15
|
|
|
14
16
|
const ALLOWED_METHODS = new Set(["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"]);
|
|
15
17
|
const REQUEST_HEADERS = new Set([
|
|
@@ -90,6 +92,12 @@ function canonicalOrigin(value: string): string | null {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
95
|
+
/** A canonical HTTP(S) origin, no userinfo/path/query/fragment/trailing slash. */
|
|
96
|
+
function canonicalExpectedOrigin(value: string): string | null {
|
|
97
|
+
const origin = canonicalOrigin(value);
|
|
98
|
+
return origin && value === origin ? origin : null;
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
function relayDestination(suffix: string, target: HubRelayTarget, method: string): URL | null {
|
|
94
102
|
const origin = canonicalOrigin(target.managementUrl);
|
|
95
103
|
const browserOrigin = canonicalOrigin(target.browserOrigin);
|
|
@@ -234,6 +242,24 @@ export async function relayHubManagementRequest(
|
|
|
234
242
|
const requestHeaderValidation = validateHubRelayRequestHeaders([...req.headers]);
|
|
235
243
|
if (!requestHeaderValidation.ok) return relayError(400, "hub relay request headers refused");
|
|
236
244
|
|
|
245
|
+
// The expected-target claim is checked against the same immutable target snapshot used
|
|
246
|
+
// for forwarding, before the body is read. Absence keeps the legacy caller contract.
|
|
247
|
+
const expectedTarget = req.headers.get(HUB_RELAY_EXPECTED_TARGET_HEADER);
|
|
248
|
+
if (expectedTarget !== null) {
|
|
249
|
+
if (expectedTarget.includes(",") || new TextEncoder().encode(expectedTarget).byteLength > HUB_RELAY_EXPECTED_TARGET_MAX_BYTES) {
|
|
250
|
+
return relayError(400, "invalid_expected_target");
|
|
251
|
+
}
|
|
252
|
+
const claimed = canonicalExpectedOrigin(expectedTarget);
|
|
253
|
+
const current = canonicalOrigin(target.managementUrl);
|
|
254
|
+
if (!claimed || !current) return relayError(400, "invalid_expected_target");
|
|
255
|
+
if (claimed !== current) {
|
|
256
|
+
return new Response(JSON.stringify({ error: "target_changed" }), {
|
|
257
|
+
status: 409,
|
|
258
|
+
headers: { "Content-Type": "application/json", "Cache-Control": "no-store" },
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
237
263
|
let body: Uint8Array<ArrayBuffer> | null;
|
|
238
264
|
try {
|
|
239
265
|
body = method === "GET" || method === "HEAD"
|
|
@@ -15,6 +15,8 @@ export interface MachineStatusV1 {
|
|
|
15
15
|
sharedBase: string;
|
|
16
16
|
sharedServerOrigin: string;
|
|
17
17
|
managementTransport: "direct" | "relay";
|
|
18
|
+
/** Present when this listener's relay can check an expected target before forwarding. */
|
|
19
|
+
relayTargetCheck?: "expected-target-v1";
|
|
18
20
|
apiKeyId: string;
|
|
19
21
|
protocolVersion: 1;
|
|
20
22
|
connectedAt: string;
|
|
@@ -69,6 +71,7 @@ function statusPayload(req: Request, state: OcxClientConnectionConfig, deps: Mac
|
|
|
69
71
|
sharedBase: relay ? `${machineBase}/api/machine/hub-relay` : state.managementUrl,
|
|
70
72
|
sharedServerOrigin: linkMode ? machineBase : state.managementUrl,
|
|
71
73
|
managementTransport: relay ? "relay" : state.managementTransport,
|
|
74
|
+
...(relay && !linkMode ? { relayTargetCheck: "expected-target-v1" as const } : {}),
|
|
72
75
|
apiKeyId: state.apiKeyId,
|
|
73
76
|
protocolVersion: state.protocolVersion,
|
|
74
77
|
connectedAt: state.connectedAt,
|
|
@@ -4,7 +4,7 @@ import { PROXY_MARKER } from "../../claude/auth-detect";
|
|
|
4
4
|
import { isLoopbackHostname, shouldInjectApiAuthHeader } from "../../codex/loopback-target";
|
|
5
5
|
import { resolveApiSurfaceSettings } from "../../protocols/settings";
|
|
6
6
|
import { absoluteClientPath, ClientPathError } from "../client-path";
|
|
7
|
-
import type { ExportContext, ManagedContribution, OpencodeLaunchEnv } from "./contracts";
|
|
7
|
+
import type { ExportContext, ExportModel, ManagedContribution, OpencodeLaunchEnv } from "./contracts";
|
|
8
8
|
import { OPENCODE_PROVIDER_ID } from "./constants";
|
|
9
9
|
import { normalizeExportModels, singleFragment } from "./model-metadata";
|
|
10
10
|
|
|
@@ -45,16 +45,28 @@ export interface T3CodeEnvironmentVariable {
|
|
|
45
45
|
sensitive: false;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** T3 Code's `ModelCapabilities`: the options a thread or subagent may select for this model. */
|
|
49
|
+
export interface T3CodeModelCapabilities {
|
|
50
|
+
optionDescriptors: {
|
|
51
|
+
id: "effort";
|
|
52
|
+
label: string;
|
|
53
|
+
type: "select";
|
|
54
|
+
options: { id: string; label: string; isDefault?: true }[];
|
|
55
|
+
}[];
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
/** One T3 Code `CustomModelEntry`: the slug is sent verbatim as the Claude model id. */
|
|
49
59
|
export interface T3CodeCustomModel {
|
|
50
60
|
slug: string;
|
|
51
61
|
name: string;
|
|
62
|
+
capabilities?: T3CodeModelCapabilities;
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
/** The `providerInstances.opencodex` value opencodex owns in T3 Code's settings.json. */
|
|
55
66
|
export interface T3CodeProviderInstance {
|
|
56
67
|
driver: "claudeAgent";
|
|
57
68
|
displayName: string;
|
|
69
|
+
accentColor: string;
|
|
58
70
|
environment: T3CodeEnvironmentVariable[];
|
|
59
71
|
config: { customModels: T3CodeCustomModel[] };
|
|
60
72
|
}
|
|
@@ -92,6 +104,7 @@ function t3codeDocument(ctx: ExportContext): T3CodeGeneratedConfig {
|
|
|
92
104
|
[OPENCODE_PROVIDER_ID]: {
|
|
93
105
|
driver: "claudeAgent",
|
|
94
106
|
displayName: "opencodex",
|
|
107
|
+
accentColor: T3CODE_ACCENT_COLOR,
|
|
95
108
|
environment: [
|
|
96
109
|
variable("ANTHROPIC_BASE_URL", origin),
|
|
97
110
|
variable("ANTHROPIC_AUTH_TOKEN", PROXY_MARKER),
|
|
@@ -99,16 +112,42 @@ function t3codeDocument(ctx: ExportContext): T3CodeGeneratedConfig {
|
|
|
99
112
|
variable("CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST", "1"),
|
|
100
113
|
],
|
|
101
114
|
config: {
|
|
102
|
-
customModels: models.map(model =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
115
|
+
customModels: models.map(model => {
|
|
116
|
+
const capabilities = t3codeCapabilities(model);
|
|
117
|
+
return {
|
|
118
|
+
slug: model.namespaced,
|
|
119
|
+
name: model.displayName || model.namespaced,
|
|
120
|
+
...(capabilities ? { capabilities } : {}),
|
|
121
|
+
};
|
|
122
|
+
}),
|
|
106
123
|
},
|
|
107
124
|
},
|
|
108
125
|
},
|
|
109
126
|
};
|
|
110
127
|
}
|
|
111
128
|
|
|
129
|
+
/** Tints the instance's badge. T3 Code picks the icon from the driver, so this is all that sets it apart from Claude. */
|
|
130
|
+
const T3CODE_ACCENT_COLOR = "#a6a6a6";
|
|
131
|
+
|
|
132
|
+
/** The efforts Claude Code's `--effort` accepts, labelled the way T3 Code labels its built-in models. */
|
|
133
|
+
const T3CODE_EFFORT_LABELS: Readonly<Record<string, string>> = {
|
|
134
|
+
low: "Low", medium: "Medium", high: "High", xhigh: "Extra High", max: "Max",
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* T3 Code rejects any option a custom model does not declare, so a model exported without
|
|
139
|
+
* this cannot be started with an effort at all. A model with no usable effort declares nothing.
|
|
140
|
+
*/
|
|
141
|
+
function t3codeCapabilities(model: ExportModel): T3CodeModelCapabilities | undefined {
|
|
142
|
+
if (model.supportsReasoningEffort === false) return undefined;
|
|
143
|
+
const options = (model.reasoningEfforts ?? []).flatMap(id => {
|
|
144
|
+
const label = T3CODE_EFFORT_LABELS[id];
|
|
145
|
+
if (!label) return [];
|
|
146
|
+
return [{ id, label, ...(id === model.defaultReasoningEffort ? { isDefault: true as const } : {}) }];
|
|
147
|
+
});
|
|
148
|
+
return options.length ? { optionDescriptors: [{ id: "effort", label: "Reasoning", type: "select", options }] } : undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
112
151
|
/** Refuses any listener that needs an admission header: T3 Code would send only the marker. */
|
|
113
152
|
export function buildT3CodeClientConfig(ctx: ExportContext): T3CodeGeneratedConfig {
|
|
114
153
|
if (shouldInjectApiAuthHeader(ctx.config) || !isLoopbackHostname(new URL(ctx.baseUrl).hostname)) {
|
|
@@ -76,7 +76,7 @@ function load(path: string): Loaded {
|
|
|
76
76
|
}
|
|
77
77
|
if (hasJsoncComments(text)) return { kind: "comments" };
|
|
78
78
|
try {
|
|
79
|
-
const doc = parseJsonc(text
|
|
79
|
+
const doc = parseJsonc(text);
|
|
80
80
|
return isObject(doc) ? { kind: "document", text, doc } : { kind: "invalid" };
|
|
81
81
|
} catch {
|
|
82
82
|
return { kind: "invalid" };
|
|
@@ -38,6 +38,7 @@ import { retainedNativeInheritanceTemplate } from "./native-template";
|
|
|
38
38
|
import type { RawCatalog, RawEntry } from "./parsing";
|
|
39
39
|
import { isSpawnableCodexCandidate } from "../exec-invocation";
|
|
40
40
|
import { validatedCodexExecInvocation, validatedCodexExecInvocationAsync } from "../exec-boundary";
|
|
41
|
+
import { macCodexAppCommands } from "../mac-app-bundle";
|
|
41
42
|
import { isPlainObject } from "../../lib/plain-data";
|
|
42
43
|
import {
|
|
43
44
|
parsePersistedCodexRuntime,
|
|
@@ -47,10 +48,12 @@ import {
|
|
|
47
48
|
codexRuntimeSelectionIdentity,
|
|
48
49
|
codexRuntimeStateEpoch,
|
|
49
50
|
execCodexFileAsync,
|
|
51
|
+
codexRuntimeIsUnresolved,
|
|
50
52
|
} from "../runtime";
|
|
51
53
|
import type {
|
|
52
54
|
DeepReadonly,
|
|
53
55
|
EffortClampDiagnostic,
|
|
56
|
+
ResolveCodexRuntimeResult,
|
|
54
57
|
ResolvedCodexRuntime,
|
|
55
58
|
} from "../runtime";
|
|
56
59
|
import type {
|
|
@@ -188,6 +191,12 @@ export interface BundledCatalogDeps {
|
|
|
188
191
|
/** Already-observed source for server clamping; null never triggers a probe. */
|
|
189
192
|
observedCatalog?: ReadonlyRawCatalog | null;
|
|
190
193
|
commandCandidates?: () => string[];
|
|
194
|
+
/**
|
|
195
|
+
* The resolver selection `commandCandidates` came from, when the caller resolved first. Only an
|
|
196
|
+
* unresolved selection lets the macOS probe add the ChatGPT.app CLI (#8360); without it, injected
|
|
197
|
+
* candidates are probed as given.
|
|
198
|
+
*/
|
|
199
|
+
selectedRuntime?: Pick<ResolvedCodexRuntime, "source" | "version">;
|
|
191
200
|
execFileSync?: ExecFile;
|
|
192
201
|
execFile?: (...args: Parameters<ExecFile>) => Promise<string>;
|
|
193
202
|
onEffortClamp?: (diagnostic: EffortClampDiagnostic) => void;
|
|
@@ -332,6 +341,39 @@ function bundledRuntimeDeps(deps: BundledCatalogDeps) {
|
|
|
332
341
|
};
|
|
333
342
|
}
|
|
334
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Candidates for the bundled-catalog probe.
|
|
346
|
+
*
|
|
347
|
+
* When discovery finds no Codex CLI it answers with the bare `codex` sentinel, so the probe
|
|
348
|
+
* asks a command that does not exist while a real CLI sits inside ChatGPT.app. Discovery only
|
|
349
|
+
* offers that app candidate after classifying the bundle's XML `Info.plist` identity, so a
|
|
350
|
+
* bundle it cannot classify (a binary plist, or an identity assertion that moved with an app
|
|
351
|
+
* update) left `ocx connect status` reporting `unverified` on a macOS Child whose only Codex
|
|
352
|
+
* was the bundled CLI (#8360).
|
|
353
|
+
*
|
|
354
|
+
* The known app locations are therefore added after a bare sentinel. This list grants no
|
|
355
|
+
* trust: every execution still passes the app-bundle signature and ownership gate in
|
|
356
|
+
* `exec-boundary.ts`, so an unverifiable bundle yields `null` rather than an invented ladder.
|
|
357
|
+
* Windows needs no entry here because its Codex App install root under LOCALAPPDATA is already
|
|
358
|
+
* enumerated by `installedCodexCandidates` in `runtime.ts`.
|
|
359
|
+
*/
|
|
360
|
+
function bundledCatalogCandidates(
|
|
361
|
+
deps: BundledCatalogDeps,
|
|
362
|
+
resolved: ResolveCodexRuntimeResult | null,
|
|
363
|
+
): string[] {
|
|
364
|
+
const candidates = deps.commandCandidates?.() ?? [resolved!.runtime.command];
|
|
365
|
+
// An explicit empty list asks for no probe at all.
|
|
366
|
+
if (candidates.length === 0) return candidates;
|
|
367
|
+
if ((deps.platform ?? process.platform) !== "darwin") return candidates;
|
|
368
|
+
// Decide from the resolver's own result, not from the command's shape: a bare command that ran
|
|
369
|
+
// (a PATH fallback or a bare CODEX_CLI_PATH) is the operator's runtime, and borrowing the app's
|
|
370
|
+
// catalog for it would report a ladder that runtime may reject.
|
|
371
|
+
const selection = resolved?.runtime ?? deps.selectedRuntime;
|
|
372
|
+
if (!selection || !codexRuntimeIsUnresolved(selection)) return candidates;
|
|
373
|
+
const exists = deps.existsSync ?? existsSync;
|
|
374
|
+
return [...candidates, ...macCodexAppCommands(deps).filter(command => exists(command))];
|
|
375
|
+
}
|
|
376
|
+
|
|
335
377
|
function* bundledCatalogSteps(
|
|
336
378
|
candidates: string[],
|
|
337
379
|
cacheKey: string | null,
|
|
@@ -390,7 +432,7 @@ export function loadBundledCodexCatalog(deps: BundledCatalogDeps = {}): Readonly
|
|
|
390
432
|
const useCache = !deps.commandCandidates && !deps.execFileSync && !deps.execFile && !deps.configDir && !deps.env;
|
|
391
433
|
const resolved = deps.commandCandidates ? null : resolveAndPersistCodexRuntime(bundledRuntimeDeps(deps));
|
|
392
434
|
const inputs = codexRuntimeSelectionIdentity(bundledRuntimeDeps(deps));
|
|
393
|
-
const steps = bundledCatalogSteps(deps
|
|
435
|
+
const steps = bundledCatalogSteps(bundledCatalogCandidates(deps, resolved),
|
|
394
436
|
useCache ? bundledRuntimeKey(resolved!.runtime) : null,
|
|
395
437
|
() => inputs === codexRuntimeSelectionIdentity(bundledRuntimeDeps(deps)));
|
|
396
438
|
let step = steps.next();
|
|
@@ -449,7 +491,7 @@ export function loadBundledCodexCatalogAsync(
|
|
|
449
491
|
const runtimeEpoch = codexRuntimeStateEpoch();
|
|
450
492
|
const current = () => active() && runtimeEpoch === codexRuntimeStateEpoch()
|
|
451
493
|
&& flight.inputs === codexRuntimeSelectionIdentity(runtimeDeps);
|
|
452
|
-
const steps = bundledCatalogSteps(deps
|
|
494
|
+
const steps = bundledCatalogSteps(bundledCatalogCandidates(deps, resolved),
|
|
453
495
|
useCache ? bundledRuntimeKey(resolved!.runtime) : null, current, false);
|
|
454
496
|
let step = steps.next();
|
|
455
497
|
while (!step.done) {
|
package/src/codex/runtime.ts
CHANGED
|
@@ -55,6 +55,18 @@ export interface EffortClampDiagnostic {
|
|
|
55
55
|
readonly affectedModels: readonly string[];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* True for the selection the resolver returns when no candidate ran: the bare `codex` fallback
|
|
60
|
+
* with no version. A probed candidate always carries the version it parsed, so a bare command
|
|
61
|
+
* that actually ran (a bare CODEX_CLI_PATH or shim, or the bare fallback itself) is not this
|
|
62
|
+
* sentinel. Deferred resolution (`probeVersion: false`) gives every candidate a null version and
|
|
63
|
+
* so cannot be told apart here; the bundled-catalog probe, `ocx connect` and `ocx status` all
|
|
64
|
+
* resolve with probing.
|
|
65
|
+
*/
|
|
66
|
+
export function codexRuntimeIsUnresolved(runtime: Pick<ResolvedCodexRuntime, "source" | "version">): boolean {
|
|
67
|
+
return runtime.source === "fallback" && runtime.version === null;
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
export interface ResolveCodexRuntimeResult {
|
|
59
71
|
readonly runtime: ResolvedCodexRuntime;
|
|
60
72
|
readonly failures: readonly RuntimeProbeFailure[];
|