@jbkjr/relay 0.0.0-stage → 1.2.2

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 (296) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSES/Apache-2.0.txt +201 -0
  3. package/LICENSES/README.md +19 -0
  4. package/LICENSES/codex-NOTICE.txt +6 -0
  5. package/README.md +393 -2
  6. package/SECURITY.md +145 -0
  7. package/adapters/briefs/claude.md +43 -0
  8. package/adapters/briefs/codex.md +56 -0
  9. package/adapters/briefs/models.json +33 -0
  10. package/adapters/build.mjs +8 -0
  11. package/adapters/claude/.claude-plugin/marketplace.json +13 -0
  12. package/adapters/claude/relay/.claude-plugin/plugin.json +5 -0
  13. package/adapters/claude/relay/agents/codex.md +21 -0
  14. package/adapters/claude/relay/agents/operator.md +21 -0
  15. package/adapters/claude/relay/skills/ask/SKILL.md +20 -0
  16. package/adapters/claude/relay/skills/chat/SKILL.md +13 -0
  17. package/adapters/claude/relay/skills/delegate/SKILL.md +21 -0
  18. package/adapters/claude/relay/skills/discuss/SKILL.md +19 -0
  19. package/adapters/claude/relay/skills/review/SKILL.md +21 -0
  20. package/adapters/claude/relay/skills/tree/SKILL.md +10 -0
  21. package/adapters/claude/relay/skills/write-for-codex/SKILL.md +78 -0
  22. package/adapters/codex/.agents/plugins/marketplace.json +20 -0
  23. package/adapters/codex/AGENTS.snippet.md +5 -0
  24. package/adapters/codex/relay/.codex-plugin/plugin.json +6 -0
  25. package/adapters/codex/relay/skills/relay-ask/SKILL.md +20 -0
  26. package/adapters/codex/relay/skills/relay-chat/SKILL.md +13 -0
  27. package/adapters/codex/relay/skills/relay-delegate/SKILL.md +21 -0
  28. package/adapters/codex/relay/skills/relay-discuss/SKILL.md +19 -0
  29. package/adapters/codex/relay/skills/relay-review/SKILL.md +21 -0
  30. package/adapters/codex/relay/skills/relay-tree/SKILL.md +10 -0
  31. package/adapters/codex/relay/skills/relay-write-for-claude/SKILL.md +66 -0
  32. package/adapters/generate.mjs +124 -0
  33. package/bin/relay +59 -0
  34. package/codex-pin.json +12 -0
  35. package/dist/backends/acp.js +1424 -0
  36. package/dist/backends/claude.js +890 -0
  37. package/dist/backends/cli-version.js +112 -0
  38. package/dist/backends/codex-app.js +1539 -0
  39. package/dist/backends/codex-daybreak.js +75 -0
  40. package/dist/backends/codex-env.js +656 -0
  41. package/dist/backends/codex-network.js +304 -0
  42. package/dist/backends/codex-pin.js +345 -0
  43. package/dist/backends/codex-shell-policy.js +182 -0
  44. package/dist/backends/codex-stage2.js +998 -0
  45. package/dist/backends/codex-subagents.js +47 -0
  46. package/dist/backends/codex.js +641 -0
  47. package/dist/backends/copilot.js +246 -0
  48. package/dist/backends/env.js +147 -0
  49. package/dist/backends/gemini.js +607 -0
  50. package/dist/backends/grok.js +337 -0
  51. package/dist/backends/index.js +8 -0
  52. package/dist/backends/native-temp.js +187 -0
  53. package/dist/backends/never-admission.js +90 -0
  54. package/dist/backends/run.js +67 -0
  55. package/dist/backends/stream.js +230 -0
  56. package/dist/backends/tool-discovery.js +15 -0
  57. package/dist/backends/types.js +264 -0
  58. package/dist/build-info.json +5 -0
  59. package/dist/cli.js +344 -0
  60. package/dist/confine/bridge.js +113 -0
  61. package/dist/confine/broker-core.js +76 -0
  62. package/dist/confine/broker-http.js +650 -0
  63. package/dist/confine/broker-names.js +9 -0
  64. package/dist/confine/broker.js +258 -0
  65. package/dist/confine/canary.js +380 -0
  66. package/dist/confine/diagnostics.js +122 -0
  67. package/dist/confine/gemini-tools-main.js +8 -0
  68. package/dist/confine/gemini-tools.js +181 -0
  69. package/dist/confine/hardlinks.js +58 -0
  70. package/dist/confine/harness-config.js +16 -0
  71. package/dist/confine/index.js +117 -0
  72. package/dist/confine/leases.js +217 -0
  73. package/dist/confine/paths.js +6 -0
  74. package/dist/confine/peer.js +115 -0
  75. package/dist/confine/port-policy.js +8 -0
  76. package/dist/confine/ports.js +365 -0
  77. package/dist/confine/private-root.js +208 -0
  78. package/dist/confine/probe-stage2.js +501 -0
  79. package/dist/confine/probe.js +1109 -0
  80. package/dist/confine/proxy.js +783 -0
  81. package/dist/confine/sbcheck.js +208 -0
  82. package/dist/confine/seatbelt-never.js +41 -0
  83. package/dist/confine/seatbelt-stage2.js +139 -0
  84. package/dist/confine/seatbelt.js +1129 -0
  85. package/dist/confine/sockets.js +36 -0
  86. package/dist/confine/turn-probe.js +19 -0
  87. package/dist/confine/turn.js +86 -0
  88. package/dist/core/adoption.js +124 -0
  89. package/dist/core/api-keys.js +423 -0
  90. package/dist/core/approvals.js +740 -0
  91. package/dist/core/build-identity.js +248 -0
  92. package/dist/core/caller.js +749 -0
  93. package/dist/core/calls.js +102 -0
  94. package/dist/core/claude-settings.js +1045 -0
  95. package/dist/core/config.js +453 -0
  96. package/dist/core/context.js +186 -0
  97. package/dist/core/db.js +753 -0
  98. package/dist/core/dispatch.js +110 -0
  99. package/dist/core/env-broker.js +505 -0
  100. package/dist/core/env-policy.js +182 -0
  101. package/dist/core/escalation-authority.js +76 -0
  102. package/dist/core/escalation-contract.js +13 -0
  103. package/dist/core/escalation-person-path.js +131 -0
  104. package/dist/core/escalation-policy.js +79 -0
  105. package/dist/core/escalation-runtime.js +135 -0
  106. package/dist/core/escalation-state.js +42 -0
  107. package/dist/core/escalations.js +191 -0
  108. package/dist/core/events.js +235 -0
  109. package/dist/core/executables.js +147 -0
  110. package/dist/core/extensions.js +645 -0
  111. package/dist/core/families.js +204 -0
  112. package/dist/core/git.js +657 -0
  113. package/dist/core/identity.js +113 -0
  114. package/dist/core/liveness.js +68 -0
  115. package/dist/core/mediated-network-provider.js +81 -0
  116. package/dist/core/never-checkpoint.js +76 -0
  117. package/dist/core/never-coverage.js +97 -0
  118. package/dist/core/never-network.js +49 -0
  119. package/dist/core/never-policy.js +302 -0
  120. package/dist/core/never-proxy-policy.js +109 -0
  121. package/dist/core/never-schema.js +61 -0
  122. package/dist/core/never-tools.js +56 -0
  123. package/dist/core/notices.js +48 -0
  124. package/dist/core/ops.js +959 -0
  125. package/dist/core/outcome.js +224 -0
  126. package/dist/core/params.js +32 -0
  127. package/dist/core/presence.js +174 -0
  128. package/dist/core/procs.js +546 -0
  129. package/dist/core/prompts.js +363 -0
  130. package/dist/core/protected-config.js +238 -0
  131. package/dist/core/raw-network.js +192 -0
  132. package/dist/core/redact.js +152 -0
  133. package/dist/core/refusal.js +33 -0
  134. package/dist/core/relay-command.js +310 -0
  135. package/dist/core/reported.js +3 -0
  136. package/dist/core/restart-overlay.js +651 -0
  137. package/dist/core/retention.js +1135 -0
  138. package/dist/core/secrets.js +329 -0
  139. package/dist/core/session-token.js +175 -0
  140. package/dist/core/session.js +744 -0
  141. package/dist/core/shell.js +2 -0
  142. package/dist/core/shipped-pin.js +47 -0
  143. package/dist/core/shown.js +42 -0
  144. package/dist/core/slots.js +67 -0
  145. package/dist/core/stage2-executors.js +453 -0
  146. package/dist/core/stage2-switch.js +5 -0
  147. package/dist/core/steering.js +149 -0
  148. package/dist/core/storage.js +358 -0
  149. package/dist/core/toml.js +175 -0
  150. package/dist/core/views.js +324 -0
  151. package/dist/core/wait.js +114 -0
  152. package/dist/core/wake.js +207 -0
  153. package/dist/core/watch.js +247 -0
  154. package/dist/core/worktree.js +213 -0
  155. package/dist/hosts/claude-desktop.js +274 -0
  156. package/dist/hosts/claude.js +249 -0
  157. package/dist/hosts/codex.js +345 -0
  158. package/dist/hosts/desktop-shared.js +20 -0
  159. package/dist/hosts/index.js +11 -0
  160. package/dist/hosts/types.js +4 -0
  161. package/dist/install/basics.js +18 -0
  162. package/dist/install/claude-init.js +133 -0
  163. package/dist/install/common.js +655 -0
  164. package/dist/install/doctor.js +635 -0
  165. package/dist/install/qualify-codex.js +205 -0
  166. package/dist/install.js +524 -0
  167. package/dist/mcp/elicit.js +209 -0
  168. package/dist/mcp/gateway.js +218 -0
  169. package/dist/mcp/host.js +253 -0
  170. package/dist/mcp/server.js +1124 -0
  171. package/dist/mcp/stdio.js +37 -0
  172. package/dist/modes/discussion.js +393 -0
  173. package/dist/modes/review.js +722 -0
  174. package/dist/native/relay-sbcheck +0 -0
  175. package/dist/targets/briefs.js +86 -0
  176. package/dist/targets/claude.js +94 -0
  177. package/dist/targets/codex.js +66 -0
  178. package/dist/targets/copilot.js +93 -0
  179. package/dist/targets/gemini.js +119 -0
  180. package/dist/targets/grok.js +126 -0
  181. package/dist/targets/index.js +192 -0
  182. package/dist/targets/types.js +18 -0
  183. package/dist/targets/verified.js +35 -0
  184. package/dist/worker.js +113 -0
  185. package/docs/UPGRADING.md +1518 -0
  186. package/docs/pinned-codex.md +333 -0
  187. package/experiments/stage2-redteam/lib/oracles.mjs +214 -0
  188. package/experiments/stage2-redteam/lib/report.mjs +35 -0
  189. package/npm-shrinkwrap.json +1632 -0
  190. package/package.json +82 -4
  191. package/scripts/codex-qualify/codex-pin-store.mjs +353 -0
  192. package/scripts/codex-qualify/codex-qualifier-process.mjs +265 -0
  193. package/scripts/codex-qualify/codex-qualifier.example.json +5 -0
  194. package/scripts/codex-qualify/codex-qualifier.mjs +281 -0
  195. package/scripts/codex-qualify/codex-shipped-pin.mjs +158 -0
  196. package/scripts/codex-qualify/codex-stage2-pin.mjs +48 -0
  197. package/scripts/codex-qualify/codex-stage2.mjs +2381 -0
  198. package/scripts/codex-qualify/install-codex-qualifier.mjs +98 -0
  199. package/scripts/codex-qualify/main-module.mjs +14 -0
  200. package/scripts/codex-qualify/relay-codex-qualifier.plist +37 -0
  201. package/scripts/codex-qualify/scratch-env.mjs +31 -0
  202. package/scripts/codex-qualify/session.mjs +96 -0
  203. package/scripts/codex-qualify/stage2-escalation-cases.mjs +125 -0
  204. package/test/codex-permissions.test.ts +875 -0
  205. package/test/fixtures/boundary-probes.mjs +17 -0
  206. package/test/fixtures/denial-stream-host.mjs +7 -0
  207. package/test/fixtures/families.json +246 -0
  208. package/test/fixtures/install-snapshots/claude-desktop-foreign.txt +158 -0
  209. package/test/fixtures/install-snapshots/claude-desktop-fresh.txt +101 -0
  210. package/test/fixtures/install-snapshots/claude-desktop-installed.txt +161 -0
  211. package/test/fixtures/install-snapshots/claude-foreign.txt +133 -0
  212. package/test/fixtures/install-snapshots/claude-fresh.txt +77 -0
  213. package/test/fixtures/install-snapshots/claude-installed.txt +133 -0
  214. package/test/fixtures/install-snapshots/codex-foreign.txt +159 -0
  215. package/test/fixtures/install-snapshots/codex-fresh.txt +107 -0
  216. package/test/fixtures/install-snapshots/codex-installed.txt +161 -0
  217. package/test/fixtures/link-parent.mjs +6 -0
  218. package/test/fixtures/mediated-command.cjs +72 -0
  219. package/test/fixtures/native-skill-isolation.json +280 -0
  220. package/test/fixtures/pinned-codex-app-server.mjs +25 -0
  221. package/test/fixtures/qualified-ext-adapters.mjs +36 -0
  222. package/test/fixtures/refusals/README.md +52 -0
  223. package/test/fixtures/refusals/claude-source-result.json +7 -0
  224. package/test/fixtures/refusals/openai-app-capacity.json +24 -0
  225. package/test/fixtures/refusals/openai-app-cyberPolicy.json +24 -0
  226. package/test/fixtures/refusals/openai-gpt-6-astra-max.json +12 -0
  227. package/test/fixtures/refusals/openai-gpt-6.1-sol-xhigh.json +12 -0
  228. package/test/fixtures/refusals/openai-review-capacity.json +24 -0
  229. package/test/fixtures/relay-0.2.0.sql +57 -0
  230. package/test/fixtures/relay-0.9.1.gen.mjs +212 -0
  231. package/test/fixtures/relay-0.9.1.sql +340 -0
  232. package/test/fixtures/slow-boundary-probes.mjs +37 -0
  233. package/test/fixtures/stable-surfaces/config.json +1122 -0
  234. package/test/fixtures/stable-surfaces/escalation.json +128 -0
  235. package/test/fixtures/stable-surfaces/events.json +37 -0
  236. package/test/fixtures/stable-surfaces/gemini-native-resume.json +4 -0
  237. package/test/fixtures/stable-surfaces/inbox.jsonl +2 -0
  238. package/test/fixtures/stable-surfaces/notice.txt +1 -0
  239. package/test/fixtures/stable-surfaces/refusal-item.json +28 -0
  240. package/test/fixtures/stable-surfaces/refusal-review.json +23 -0
  241. package/test/fixtures/stable-surfaces/registry.json +49 -0
  242. package/test/fixtures/stable-surfaces/tools-desktop.json +575 -0
  243. package/test/fixtures/stable-surfaces/tools.json +716 -0
  244. package/test/fixtures/stable-surfaces/usage.txt +46 -0
  245. package/test/fixtures/stage2-acp-native.mjs +138 -0
  246. package/test/fixtures/stage2-app-server.mjs +23 -0
  247. package/test/fixtures/stage2-catalog.json +91 -0
  248. package/test/fixtures/stage2-hostile-web.mjs +35 -0
  249. package/test/fixtures/stage2-native-network.mjs +62 -0
  250. package/test/fixtures/stage2-worker.ts +87 -0
  251. package/test/fixtures/status-views/expected.json +7825 -0
  252. package/test/fixtures/status-views/registries.json +1 -0
  253. package/test/fixtures/steering.json +209 -0
  254. package/test/helpers.ts +740 -0
  255. package/test/host-env.ts +7 -0
  256. package/test/keychain-decoy.ts +197 -0
  257. package/test/live-scope.ts +44 -0
  258. package/test/mediated-network.test.ts +192 -0
  259. package/test/mediated-proxy.test.ts +264 -0
  260. package/test/native-temp-alias.ts +10 -0
  261. package/test/never-policy.test.ts +629 -0
  262. package/test/never-tools.test.ts +136 -0
  263. package/test/process-home.ts +18 -0
  264. package/test/proxy.test.ts +531 -0
  265. package/test/restart-overlay-live.test.ts +85 -0
  266. package/test/restart-overlay-profile.test.ts +66 -0
  267. package/test/restart-overlay.test.ts +416 -0
  268. package/test/stable-surfaces.test.ts +249 -0
  269. package/test/stage2-escalation-live.test.ts +544 -0
  270. package/test/stage2-escalation-qualification.test.ts +170 -0
  271. package/test/stage2-escalation.test.ts +747 -0
  272. package/test/stage2-executor.test.ts +849 -0
  273. package/test/stage2-grant.test.ts +603 -0
  274. package/test/stage2-native-live.test.ts +647 -0
  275. package/test/stage2-network-decisions.test.ts +70 -0
  276. package/test/stage2-probe.test.ts +845 -0
  277. package/test/stage2-standing-live.test.ts +203 -0
  278. package/test/stubs/broker-host.mjs +59 -0
  279. package/test/stubs/broker-peer.mjs +20 -0
  280. package/test/stubs/confined-harness.mjs +91 -0
  281. package/test/stubs/ext-broken-server.mjs +2 -0
  282. package/test/stubs/ext-odd-server.mjs +21 -0
  283. package/test/stubs/ext-server.mjs +31 -0
  284. package/test/stubs/fake-host-cli.mjs +218 -0
  285. package/test/stubs/procargs.mjs +30 -0
  286. package/test/stubs/stub-acp +4 -0
  287. package/test/stubs/stub-agent.mjs +322 -0
  288. package/test/stubs/stub-claude +4 -0
  289. package/test/stubs/stub-codex +4 -0
  290. package/test/stubs/targets/acp.mjs +307 -0
  291. package/test/stubs/targets/claude.mjs +149 -0
  292. package/test/stubs/targets/codex.mjs +479 -0
  293. package/test/stubs/targets/gemini.mjs +604 -0
  294. package/test/temp-root.ts +11 -0
  295. package/test/wp4-adapters.test.ts +353 -0
  296. package/test/wp4-interlock.test.ts +136 -0
@@ -0,0 +1,524 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { canonical, configPath, consultHome, DEFAULT_CONFIG, expandHome, harnessHome, relayCodexHome, relayCodexPinStore, relayHome, worktreesHome, } from "./core/config.js";
5
+ import { installBackupsPath, installRecordPath, localConfigPath, mcpFile } from "./core/protected-config.js";
6
+ import { defaultKeyDir } from "./core/api-keys.js";
7
+ import { nativeTempAlias, nativeTempRoot, privateStateRoot } from "./confine/private-root.js";
8
+ import { db, registryBackup, registryVersion, SCHEMA_VERSION } from "./core/db.js";
9
+ import { codexHomeProblem, codexHomeStatus, codexLoginCommand, prepareCodexHome, shippedPinPackageRoot } from "./backends/codex-pin.js";
10
+ import { readShippedPin } from "./core/shipped-pin.js";
11
+ import { desktopEntryUnderOldName } from "./hosts/claude-desktop.js";
12
+ import { DESKTOP_ENTRY, DESKTOP_OLD_ENTRY } from "./hosts/desktop-shared.js";
13
+ import { hostDef, HOST_IDS, HOSTS, isHost } from "./hosts/index.js";
14
+ import { config, installKind, isRelayLauncher, LAUNCHER, linkPath, loadRecord, note, onPath, recordFile, reinstallCommand, requireRecord, saveRecord, say, sh, Stop, unusedName, usageError, errText, } from "./install/common.js";
15
+ // install and uninstall (doctor is in install/doctor.ts). What they share is in install/common.ts,
16
+ // and each host's own part (its registration, its plugin kit, its doctor lines) in src/hosts/.
17
+ export { usageError };
18
+ /**
19
+ * ~/.local/bin/relay is relay's if it is a symlink to the launcher of a relay checkout, or to the
20
+ * target relay's own record says it linked. A target that merely ends in bin/relay is not enough:
21
+ * uv and pipx link a tool of that name the same way. A file there is someone's program and is
22
+ * never deleted.
23
+ */
24
+ function linkState(run) {
25
+ const link = linkPath();
26
+ let st;
27
+ let target = "";
28
+ try {
29
+ st = fs.lstatSync(link, { throwIfNoEntry: false });
30
+ if (st?.isSymbolicLink())
31
+ target = fs.readlinkSync(link);
32
+ }
33
+ catch (err) {
34
+ throw new Stop(`${link} cannot be examined (${errText(err)}).`);
35
+ }
36
+ if (!st)
37
+ return { state: "absent" };
38
+ if (!st.isSymbolicLink())
39
+ return { state: "foreign", note: st.isDirectory() ? "a directory" : "a file, not a symbolic link" };
40
+ if (target === LAUNCHER)
41
+ return { state: "identical" };
42
+ const own = target === run.record.link?.target || isRelayLauncher(path.resolve(path.dirname(link), target));
43
+ return own ? { state: "own", target } : { state: "foreign", note: `a symbolic link to ${target}` };
44
+ }
45
+ /** Puts `relay` on PATH by linking ~/.local/bin/relay to the launcher. */
46
+ function planLink(run) {
47
+ const link = linkPath();
48
+ const st = linkState(run);
49
+ const problems = st.state === "foreign" && !run.force
50
+ ? [`${link} exists and is not relay's link (it is ${st.note}), so relay will not replace it. Move it away, or run this again with --force (it is renamed, never deleted), or with --no-link to install without putting \`relay\` on PATH.`]
51
+ : [];
52
+ return {
53
+ problems,
54
+ apply() {
55
+ // The host's own commands have run since the link was looked at. It is looked at again.
56
+ const now = linkState(run);
57
+ if (now.state !== st.state || (now.state === "own" && st.state === "own" && now.target !== st.target)) {
58
+ throw new Stop(`${link} changed while relay was working, so it was left as it is. Run this again.`);
59
+ }
60
+ if (st.state === "identical")
61
+ return void note(run, "link", { action: "kept", what: `${link} already pointed at ${LAUNCHER}`, backup: null, undo: `rm ${sh([link])}` });
62
+ let backup = null;
63
+ if (st.state === "foreign") {
64
+ for (let n = 0; fs.lstatSync((backup = unusedName(`${link}.bak-relay`, n)), { throwIfNoEntry: false }); n++)
65
+ ;
66
+ say(`$ mv ${sh([link, backup])}`);
67
+ }
68
+ say(`$ ln -s${st.state === "own" ? "fn" : ""} ${sh([LAUNCHER, link])}`);
69
+ if (run.write) {
70
+ const tmp = `${link}.relay-${process.pid}.tmp`;
71
+ let moved = false;
72
+ try {
73
+ fs.mkdirSync(path.dirname(link), { recursive: true });
74
+ if (backup) {
75
+ fs.renameSync(link, backup);
76
+ moved = true;
77
+ }
78
+ if (st.state === "own") {
79
+ // Relay's own link is replaced in one step.
80
+ fs.rmSync(tmp, { force: true });
81
+ fs.symlinkSync(LAUNCHER, tmp);
82
+ fs.renameSync(tmp, link);
83
+ }
84
+ else {
85
+ // Nothing should be there now. Made directly, the link fails instead of replacing anything that is.
86
+ fs.symlinkSync(LAUNCHER, link);
87
+ }
88
+ }
89
+ catch (err) {
90
+ fs.rmSync(tmp, { force: true });
91
+ let where = "it is as it was";
92
+ if (moved && backup) {
93
+ // Put back only into an empty place: whatever appeared there meanwhile is not relay's to replace.
94
+ try {
95
+ if (fs.lstatSync(link, { throwIfNoEntry: false }))
96
+ throw new Error("occupied");
97
+ fs.renameSync(backup, link);
98
+ }
99
+ catch {
100
+ where = `what was there is now at ${backup}`;
101
+ }
102
+ }
103
+ throw new Stop(`${link} could not be linked to ${LAUNCHER} (${errText(err)}); ${where}.`);
104
+ }
105
+ }
106
+ note(run, "link", {
107
+ action: st.state === "absent" ? "added" : "replaced",
108
+ what: `linked ${link} to ${LAUNCHER}${st.state === "own" ? ` (it pointed at ${st.target})` : backup ? ` (what was there is now ${backup})` : ""}`,
109
+ backup,
110
+ undo: st.state === "own" ? `ln -sfn ${sh([st.target, link])}` : backup ? `rm ${sh([link])} && mv ${sh([backup, link])}` : `rm ${sh([link])}`,
111
+ });
112
+ },
113
+ };
114
+ }
115
+ /** Whether relay is still registered with the other hosts, as far as can be told without changing anything. */
116
+ function registeredElsewhere(except) {
117
+ return HOSTS.filter((h) => h.id !== except).map((h) => ({ host: h.id, state: h.registered() }));
118
+ }
119
+ /** Removes ~/.local/bin/relay when it is relay's link and either the user asked or no host uses relay any more. */
120
+ function planUnlink(run, asked) {
121
+ return {
122
+ problems: [],
123
+ apply() {
124
+ const link = linkPath();
125
+ const st = linkState(run);
126
+ if (st.state === "absent")
127
+ return;
128
+ if (st.state === "foreign")
129
+ return void say(`# left alone: ${link} is not relay's link (it is ${st.note})`);
130
+ if (!asked) {
131
+ const rest = registeredElsewhere(run.host);
132
+ const names = (state) => rest.filter((r) => r.state === state).map((r) => hostDef(r.host).name).join(" and ");
133
+ const why = names("registered") ? `relay is still registered with ${names("registered")}` : names("unknown") ? `relay could not tell whether it is still registered with ${names("unknown")}` : "";
134
+ if (why)
135
+ return void say(`# kept ${link}: ${why}. To remove it as well, add --remove-link, or: rm ${sh([link])}`);
136
+ }
137
+ say(`$ rm ${sh([link])}`);
138
+ if (run.write) {
139
+ try {
140
+ fs.unlinkSync(link);
141
+ }
142
+ catch (err) {
143
+ throw new Stop(`${link} could not be removed (${errText(err)}).`);
144
+ }
145
+ }
146
+ note(run, "link", { action: "removed", what: `removed the link ${link}`, backup: null, undo: `ln -s ${sh([st.state === "own" ? st.target : LAUNCHER, link])}` });
147
+ },
148
+ };
149
+ }
150
+ // The commands
151
+ function hostArgs(verb, args, flags) {
152
+ const hosts = args.filter((a) => !a.startsWith("-"));
153
+ const unknown = args.filter((a) => a.startsWith("-") && !flags.includes(a));
154
+ if (unknown.length || hosts.length !== 1 || !isHost(hosts[0])) {
155
+ usageError(`${unknown.length ? `relay ${verb}: unknown option ${unknown.join(" ")}\n` : ""}usage: relay ${verb} <${HOST_IDS.join("|")}> ${flags.map((f) => `[${f}]`).join(" ")}`);
156
+ return null;
157
+ }
158
+ return { host: hosts[0], has: (flag) => args.includes(flag) };
159
+ }
160
+ const planHost = (run) => hostDef(run.host).plan(run);
161
+ /**
162
+ * Says why a run stopped, and what it had changed by then. Relay does not roll a half-finished
163
+ * run back by itself: undoing through the same CLI that just failed could make things worse.
164
+ * It gives the exact command that reverses each change it made, and keeps them in the record.
165
+ */
166
+ function stopped(run, err) {
167
+ // An error relay did not foresee still gets the account of what was changed before it.
168
+ console.error(`\nrelay ${run.verb} ${run.host}: ${err instanceof Stop ? err.message : `unexpected error: ${err instanceof Error ? err.stack : String(err)}`}`);
169
+ if (!run.write)
170
+ console.error("\nNothing was changed (this was a dry run, and with --write it would have stopped here too).");
171
+ else if (!run.made.length)
172
+ console.error("\nNothing was changed.");
173
+ else {
174
+ console.error("\nBefore that, this run had already:");
175
+ run.made.forEach((c, i) => {
176
+ console.error(` ${i + 1}. ${c.what}`);
177
+ if (c.backup)
178
+ console.error(` what was there before is saved at ${c.backup} (to consult; do not copy it back over a file that has changed since)`);
179
+ if (c.undo)
180
+ console.error(` to undo: ${c.undo}`);
181
+ });
182
+ console.error(`\nRelay has not undone these. Either fix the problem and run the same command again (steps already done are skipped), or undo them with the commands above${run.verb === "install" ? `, or remove the host registration with: ${reinstallCommand("uninstall", run.host)} (this does not undo a registry migration)` : ""}.`);
183
+ console.error(run.recorded ? `The same list is kept in ${recordFile()}.` : `Keep this list: relay's installation record (${recordFile()}) does not have all of it.`);
184
+ }
185
+ process.exitCode = 1;
186
+ }
187
+ /**
188
+ * A registry left by an earlier relay is backed up next to itself and then migrated, before any
189
+ * host is changed, so that going back to that relay is a matter of restoring the backup
190
+ * (docs/UPGRADING.md). Opening it does both (db()); a dry run only says so. One written by a newer
191
+ * relay stops the install.
192
+ */
193
+ function upgradeRegistry(run) {
194
+ let found;
195
+ try {
196
+ found = registryVersion();
197
+ }
198
+ catch (err) {
199
+ throw new Stop(`relay's registry in ${relayHome()} cannot be read (${errText(err)}).`);
200
+ }
201
+ if (!found || found.version === SCHEMA_VERSION)
202
+ return;
203
+ if (found.version > SCHEMA_VERSION)
204
+ throw new Stop(`relay's registry ${found.file} was written by a newer relay (schema version ${found.version}; this ${installKind()} knows up to ${SCHEMA_VERSION}). Install that relay instead, or restore the registry backup it made; see docs/UPGRADING.md.`);
205
+ if (!run.write)
206
+ return void say(`# relay's registry ${found.file} is from an earlier relay (schema version ${found.version}); with --write it is backed up next to itself and then migrated`);
207
+ try {
208
+ db();
209
+ }
210
+ catch (err) {
211
+ throw new Stop(errText(err));
212
+ }
213
+ const backup = registryBackup();
214
+ note(run, "registry", {
215
+ action: "replaced",
216
+ what: `migrated the registry ${found.file} from schema ${found.version} to ${SCHEMA_VERSION}`,
217
+ file: found.file,
218
+ backup,
219
+ undo: `stop every relay process, then follow docs/UPGRADING.md (Rollback) to archive the migrated registry and its WAL/SHM files, restore ${backup ? sh([backup]) : "the pre-migration backup made by the other relay process"} as ${sh([found.file])}, and verify PRAGMA user_version is ${found.version}; uninstall does not restore the registry`,
220
+ });
221
+ say(`# relay's registry ${found.file} was from an earlier relay: backed up to ${registryBackup() ?? "(nothing: another relay process migrated it at the same moment and made the backup)"} and migrated. To go back to the earlier relay, restore that backup (docs/UPGRADING.md).`);
222
+ }
223
+ export async function install(args) {
224
+ const a = hostArgs("install", args, ["--write", "--force", "--no-link"]);
225
+ if (!a)
226
+ return;
227
+ const run = { verb: "install", host: a.host, write: a.has("--write"), force: a.has("--force"), record: { version: 1, hosts: {} }, made: [] };
228
+ try {
229
+ run.record = loadRecord();
230
+ const plans = [planHost(run), ...(a.has("--no-link") ? [] : [planLink(run)])];
231
+ const problems = plans.flatMap((p) => p.problems);
232
+ if (problems.length)
233
+ throw new Stop(problems.join("\n\n"));
234
+ const known = run.record.hosts[run.host];
235
+ const rec = (run.record.hosts[run.host] = { launcher: LAUNCHER, complete: known?.complete ?? false, at: known?.at ?? new Date().toISOString(), resources: known?.resources ?? {} });
236
+ if (run.write)
237
+ requireRecord(true);
238
+ upgradeRegistry(run);
239
+ for (const p of plans)
240
+ p.apply();
241
+ const nothing = `\nNothing to do: relay is already installed for ${hostDef(run.host).name} from this ${installKind()}.`;
242
+ if (!run.write) {
243
+ say(run.made.length ? "\nNothing was changed. Re-run with --write to apply." : nothing);
244
+ if (run.host === "codex")
245
+ for (const l of [codexPinPlan(), codexHomePlan()])
246
+ if (l)
247
+ say(l);
248
+ return;
249
+ }
250
+ if (run.made.length || !known?.complete)
251
+ rec.at = new Date().toISOString();
252
+ rec.complete = true;
253
+ saveRecord(run.record);
254
+ say(run.made.length ? `\nrelay is installed for ${hostDef(run.host).name}. What was changed is recorded in ${recordFile()}.` : nothing);
255
+ if (hostDef(run.host).afterChange && run.made.length)
256
+ say(hostDef(run.host).afterChange);
257
+ // The desktop app's entry under its earlier name hides this registration in the app's Code tab, however recently either was installed.
258
+ if (run.host === "claude" && desktopEntryUnderOldName()) {
259
+ say(`\nNote: relay's entry in the Claude desktop app still has its earlier name, ${DESKTOP_OLD_ENTRY}, which in the app's Code tab sessions hides the relay registered here. Rename it to ${DESKTOP_ENTRY}: quit the app, then ${reinstallCommand("install", "claude-desktop")}`);
260
+ }
261
+ // Codex's registration is in place; relay's own Codex (its pin and home) is checked next, and a
262
+ // failure there ends the install with an error, after the rest is said.
263
+ const notReady = run.host === "codex" ? [await codexPinStep(), codexHomeStep()].filter((p) => !!p) : [];
264
+ const bin = path.dirname(linkPath());
265
+ if (!a.has("--no-link") && !onPath(bin))
266
+ say(`\nNote: ${bin} is not on your PATH, so the \`relay\` command will not be found. Add it, for zsh with:\n echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc\nUntil then, ${LAUNCHER} is the same command.`);
267
+ if (notReady.length) {
268
+ console.error(`\nrelay install codex: registered, but Codex is not ready: ${notReady.join("; ")}. Fix that and run this again (the registration is kept).`);
269
+ process.exitCode = 1;
270
+ }
271
+ }
272
+ catch (err) {
273
+ stopped(run, err);
274
+ }
275
+ }
276
+ /** A LaunchAgent plist that runs relay's Codex qualifier (scripts/codex-qualify/install-codex-qualifier.mjs isQualifierAgent). */
277
+ const QUALIFIER_AGENT = /<string>[^<]*\/scripts\/(?:codex-qualify|release-watch)\/codex-qualifier\.mjs<\/string>\s*<string>[^<]*<\/string>\s*<string>--run<\/string>/;
278
+ function qualifierAgents() {
279
+ const dir = path.join(os.homedir(), "Library", "LaunchAgents");
280
+ let names = [];
281
+ try {
282
+ names = fs.readdirSync(dir).filter((n) => n.endsWith(".plist")).sort();
283
+ }
284
+ catch {
285
+ return [];
286
+ }
287
+ return names.map((n) => path.join(dir, n)).filter((file) => {
288
+ try {
289
+ return fs.lstatSync(file).isFile() && QUALIFIER_AGENT.test(fs.readFileSync(file, "utf8"));
290
+ }
291
+ catch {
292
+ return false;
293
+ }
294
+ });
295
+ }
296
+ /**
297
+ * What uninstall leaves alone, and how to remove it by hand. None of it is deleted automatically: it
298
+ * can hold the user's work and logins. `rm -rf` is suggested only for a directory relay named itself
299
+ * (its default location, or one it derived from RELAY_HOME). A directory the user named (RELAY_HOME,
300
+ * RELAY_WORKTREES, RELAY_CONFIG's directory, targets.codex.*) could be their home or hold their own
301
+ * files: for those, relay names its own files there instead.
302
+ */
303
+ function leftBehind() {
304
+ const home = os.homedir();
305
+ const there = (p) => (fs.existsSync(p) || isLink(p) ? "" : " (not present)");
306
+ const same = (a, b) => canonical(a) === canonical(b);
307
+ let cfg = DEFAULT_CONFIG;
308
+ let cfgNote = "";
309
+ try {
310
+ cfg = config();
311
+ }
312
+ catch (err) {
313
+ cfgNote = ` (relay's config does not load, ${errText(err)}, so these are the default locations)`;
314
+ }
315
+ const items = [];
316
+ const dir = (p, what, relayNamed, namedBy, credential) => items.push({
317
+ path: p, what, credential,
318
+ remove: relayNamed ? [`rm -rf ${sh([p])}`] : [`# ${p} is a directory you named (${namedBy}): relay does not suggest deleting it whole. Delete what relay keeps there, or the directory if you made it only for relay.`],
319
+ });
320
+ const state = relayHome();
321
+ dir(state, "relay's state: the registry of runs, logs, the prompts sent and the transcripts", same(state, path.join(home, ".local", "state", "relay")), "RELAY_HOME");
322
+ const trees = worktreesHome();
323
+ dir(trees, "the worktrees of write jobs", !process.env.RELAY_WORKTREES || same(trees, path.join(home, ".local", "share", "relay", "worktrees")), "RELAY_WORKTREES");
324
+ const consults = consultHome();
325
+ dir(consults, "the directories questions without a project were asked in", true, "");
326
+ const harness = harnessHome();
327
+ dir(harness, "the state of the harnesses relay confines itself (each item's Copilot, Grok or Gemini home)", true, "");
328
+ // The config's directory: relay's own by default; otherwise only relay's files in it.
329
+ const cfgDir = path.dirname(configPath());
330
+ const local = localConfigPath();
331
+ if (same(cfgDir, path.join(home, ".config", "relay"))) {
332
+ items.push({ path: cfgDir, what: "your relay configuration, its local settings (local.json), the installation record and what install saved", remove: [`rm -rf ${sh([cfgDir])}`] });
333
+ }
334
+ else {
335
+ const files = [configPath(), installRecordPath(), mcpFile()];
336
+ const backups = installBackupsPath();
337
+ items.push({
338
+ path: [...files, backups].join(", "), what: `your relay configuration, the installation record and what install saved, in ${cfgDir}, a directory you named (${process.env.RELAY_CONFIG ? "RELAY_CONFIG" : "RELAY_HOME"}); only these files are relay's`,
339
+ remove: [`rm -f ${sh(files)}`, `rm -rf ${sh([backups])}`],
340
+ });
341
+ items.push({ path: local, what: "relay's local settings (which API key file each key-only target reads)", remove: [`rm -f ${sh([local])}`] });
342
+ }
343
+ // Relay's Codex: its own home (with the login relay's jobs use) and the pin store's read-only trees.
344
+ const codexHome = relayCodexHome(cfg);
345
+ const codexHomeOwn = same(codexHome, expandHome("~/.local/share/relay-codex-home")) || (fs.existsSync(codexHome) && !codexHomeProblem(cfg));
346
+ dir(codexHome, "relay's Codex home: the Codex login relay's jobs run on, and their Codex sessions", codexHomeOwn, "targets.codex.home", "holds a login (auth.json)");
347
+ const store = relayCodexPinStore(cfg);
348
+ const storeOwn = same(store, expandHome("~/.local/share/relay-codex-pins"));
349
+ items.push({
350
+ path: store, what: "relay's pinned Codex releases (sealed read-only, so they are made writable first) and the qualifier's results",
351
+ remove: storeOwn ? [`chmod -R u+w ${sh([store])} && rm -rf ${sh([store])}`] : [`# ${store} is a directory you named (targets.codex.pin_store): relay does not suggest deleting it whole. Make relay's trees there writable (chmod -R u+w) and delete them, or the directory if you made it only for relay.`],
352
+ });
353
+ const keys = defaultKeyDir();
354
+ items.push({ path: keys, what: "the API key files relay hands a key-only target (Gemini); local.json can name a key file elsewhere, which is yours to delete", credential: "holds API keys", remove: [`rm -rf ${sh([keys])}`] });
355
+ // Relay's private sockets and short temp links, and the Codex qualifier's scratch runs.
356
+ const privateRoot = privateStateRoot(), tempRoot = nativeTempRoot(), alias = nativeTempAlias();
357
+ items.push({ path: privateRoot, what: "relay's private sockets and per-turn state", remove: [`rm -rf ${sh([privateRoot])}`] });
358
+ items.push({ path: tempRoot, what: "the short temp directories relay gives Claude's turns", remove: [`rm -rf ${sh([tempRoot])}`] });
359
+ // Named by user id, not home: listed only when it is there and this home's.
360
+ let aliasTarget = null;
361
+ try {
362
+ aliasTarget = fs.readlinkSync(alias);
363
+ }
364
+ catch { /* absent, or not a link */ }
365
+ if (aliasTarget === tempRoot)
366
+ items.push({ path: alias, what: `a link to ${tempRoot}, made for a long home directory`, remove: [`rm -f ${sh([alias])}`] });
367
+ const scratch = path.join(home, ".rsm", "q");
368
+ items.push({ path: scratch, what: "the Codex qualifier's scratch runs", remove: [`chmod -R u+w ${sh([scratch])} && rm -rf ${sh([scratch])}`] });
369
+ const agents = qualifierAgents();
370
+ const agentLogs = path.join(home, "Library", "Logs", "relay-codex-qualifier");
371
+ const unload = agents.length
372
+ ? agents.flatMap((plist) => [`launchctl bootout gui/$(id -u)/${path.basename(plist, ".plist")}`, `rm -f ${sh([plist])}`]).concat(`rm -rf ${sh([agentLogs])}`)
373
+ : [`# none found in ~/Library/LaunchAgents; if you installed one under another name: launchctl bootout gui/$(id -u)/<label>, then delete its plist and ${agentLogs}`];
374
+ const out = [
375
+ "",
376
+ `Not removed, because it can hold your work or your logins${cfgNote}:`,
377
+ ...items.flatMap((i) => [` ${i.path}${i.path.includes(", ") ? "" : there(i.path)}${i.credential ? ` [${i.credential}]` : ""}`, ` ${i.what}`]),
378
+ ...agents.map((plist) => ` ${plist}\n the Codex qualifier's LaunchAgent (with its logs in ${agentLogs})`),
379
+ " in each repository relay ran a write job in: the line `.relay/` in .git/info/exclude, and any relay/* branches",
380
+ "",
381
+ "To remove them by hand, in this order:",
382
+ ` 1. ${sh([LAUNCHER, "clean"])}`,
383
+ " First, while the state directory is still there. It commits work left in finished jobs' worktrees to",
384
+ " their branches, removes those worktrees, and deletes relay/* branches that are already merged. It lists",
385
+ " the unmerged branches it kept, so no work is lost.",
386
+ " 2. In each of those repositories: `git branch --list 'relay/*'` shows what is left. Merge what you want,",
387
+ " delete the rest with `git branch -D <branch>`, and delete the line `.relay/` from .git/info/exclude.",
388
+ " 3. Stop the Codex qualifier's LaunchAgent, if you installed it:",
389
+ ...unload.map((l) => ` ${l}`),
390
+ " 4. Then the rest, after checking each: the ones marked above hold credentials.",
391
+ ...items.flatMap((i) => i.remove.map((l) => ` ${l}`)),
392
+ ];
393
+ return out.join("\n");
394
+ }
395
+ const isLink = (p) => { try {
396
+ return fs.lstatSync(p).isSymbolicLink();
397
+ }
398
+ catch {
399
+ return false;
400
+ } };
401
+ export function uninstall(args) {
402
+ const a = hostArgs("uninstall", args, ["--write", "--force", "--remove-link"]);
403
+ if (!a)
404
+ return;
405
+ const run = { verb: "uninstall", host: a.host, write: a.has("--write"), force: a.has("--force"), record: { version: 1, hosts: {} }, made: [] };
406
+ try {
407
+ run.record = loadRecord();
408
+ // Where install left a record, it says what relay put in place and what it saved. What is
409
+ // removed is still decided by looking: an entry is taken out only if it is relay's now.
410
+ const rec = run.record.hosts[run.host];
411
+ if (rec) {
412
+ say(`# installed ${rec.at.slice(0, 10)} from ${rec.launcher}${rec.complete ? "" : " (that install did not finish)"}, according to ${recordFile()}`);
413
+ for (const c of Object.values(rec.resources))
414
+ if (c.backup)
415
+ say(`# saved at install, for you to consult: ${c.backup}`);
416
+ }
417
+ else
418
+ say(`# no installation record for ${hostDef(run.host).name}; going by what is installed`);
419
+ const plans = [planHost(run), planUnlink(run, a.has("--remove-link"))];
420
+ const problems = plans.flatMap((p) => p.problems);
421
+ if (problems.length)
422
+ throw new Stop(problems.join("\n\n"));
423
+ if (run.write)
424
+ requireRecord(false);
425
+ for (const p of plans)
426
+ p.apply();
427
+ if (run.write) {
428
+ delete run.record.hosts[run.host];
429
+ saveRecord(run.record);
430
+ }
431
+ say(!run.made.length ? `\nNothing to do: nothing of relay's was found in ${hostDef(run.host).name}.` : run.write ? `\nrelay's entries are removed from ${hostDef(run.host).name}.` : "\nNothing was changed. Re-run with --write to apply.");
432
+ if (hostDef(run.host).afterChange && run.made.length)
433
+ say(hostDef(run.host).afterChange);
434
+ say(leftBehind());
435
+ }
436
+ catch (err) {
437
+ stopped(run, err);
438
+ }
439
+ }
440
+ /**
441
+ * After `install codex --write`: put this release's shipped Codex pin in place, so that Codex works
442
+ * without a local qualification (decision 18). Never over a pin qualified on this Mac; a git
443
+ * checkout ships no pin and is told to run `relay qualify-codex`. Not part of the install record:
444
+ * the pin store is relay's state, which uninstall leaves alone.
445
+ */
446
+ async function codexPinStep() {
447
+ const { placeShippedPin, qualifyCodexDefaults, relayVerdict } = await import("./install/qualify-codex.js");
448
+ const deps = qualifyCodexDefaults();
449
+ say("\nCodex pin:");
450
+ // No launched-agent check here (that one opens relay's registry, which install must not create):
451
+ // the pin store is write-denied to every agent relay launches, so a launched install fails to write it.
452
+ const placed = await placeShippedPin(deps, { replaceLocal: false });
453
+ let cfg;
454
+ try {
455
+ cfg = deps.config();
456
+ }
457
+ catch (err) {
458
+ return `relay's config does not load (${errText(err)})`;
459
+ }
460
+ const pinned = relayVerdict(cfg, say);
461
+ if (placed === "busy" || placed === "failed")
462
+ return "this release's shipped Codex pin was not put in place (see Codex pin above)";
463
+ // Expected, and said above: a checkout ships no pin (relay qualify-codex makes one), and pinned: false runs no pin.
464
+ if (!pinned && placed !== "none" && cfg.targets.codex.pinned !== false)
465
+ return "relay finds no qualified Codex pin it would run (see Codex pin above)";
466
+ return null;
467
+ }
468
+ /**
469
+ * After `install codex --write`: make relay's Codex home if it is not there yet, as a Codex turn
470
+ * would (prepareCodexHome: a private directory holding the config.toml relay writes each turn), so
471
+ * that the one-time `codex login` there has a home to sign into. Codex refuses a CODEX_HOME that does
472
+ * not exist, and a login made before relay's config.toml is in place could go to another credential
473
+ * store than the file relay's turns read. Relay's state, like the pin store: not in the install record.
474
+ */
475
+ function codexHomeStep() {
476
+ let cfg;
477
+ try {
478
+ cfg = config();
479
+ }
480
+ catch (err) {
481
+ say(`\nCodex home: not made (relay's config does not load: ${errText(err)})`);
482
+ return `relay's config does not load (${errText(err)})`;
483
+ }
484
+ const before = codexHomeStatus(cfg);
485
+ try {
486
+ prepareCodexHome(cfg);
487
+ }
488
+ catch (err) {
489
+ say(`\nCodex home: relay could not make ${before.home}: ${errText(err)}`);
490
+ return `relay's Codex home is not usable (see Codex home above)`;
491
+ }
492
+ say(`\nCodex home: ${before.home} (${before.present ? "already there" : "made"}; relay runs Codex with this home, not ~/.codex).`);
493
+ // Not a failure: only the person can sign in, and this says how.
494
+ if (codexHomeStatus(cfg).login !== "present")
495
+ say(`Sign Codex in there once:\n ${codexLoginCommand(cfg)}`);
496
+ return null;
497
+ }
498
+ /** What a dry run of `install codex` would do about relay's Codex home. */
499
+ function codexHomePlan() {
500
+ let cfg;
501
+ try {
502
+ cfg = config();
503
+ }
504
+ catch {
505
+ return "";
506
+ }
507
+ const state = codexHomeStatus(cfg);
508
+ if (state.problem)
509
+ return `# with --write, relay would not make or change its Codex home, and install would end with an error: ${state.problem}`;
510
+ return state.present ? "" : `# with --write, it would also make relay's Codex home, ${state.home}, for the one-time codex login there`;
511
+ }
512
+ /** What a dry run of `install codex` would do about the pin. */
513
+ function codexPinPlan() {
514
+ let shipped;
515
+ try {
516
+ shipped = readShippedPin(shippedPinPackageRoot());
517
+ }
518
+ catch (err) {
519
+ return `# this relay's shipped Codex pin is not valid (${errText(err)})`;
520
+ }
521
+ return shipped
522
+ ? `# with --write, it would also put this release's shipped Codex pin in place (Codex ${shipped.codex.version}, downloaded from npm and verified), unless a pin you qualified on this Mac is current`
523
+ : "# this relay ships no Codex pin: after installing, run relay qualify-codex once";
524
+ }