clearotron 0.5.1-beta.0 → 0.5.1-beta.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.
package/INSTALL.md CHANGED
@@ -147,9 +147,11 @@ testing, or while a stable is being prepared; it built and the suite passed, and
147
147
  register through it.
148
148
 
149
149
  **npm's global form works too**, where npm's global directory is yours to write:
150
- `npm install -g clearotron`, then `npx clearotron install`. On a Linux Node from the distribution or
150
+ `npm install -g clearotron`, then `npx clearotron install`. For the beta,
151
+ `npm install -g clearotron@beta`, then `clearotron install`. On a Linux Node from the distribution or
151
152
  NodeSource that directory is `/usr`, owned by root, and npm refuses with `EACCES`. Do not answer that
152
- with `sudo`; install under your home instead: `npm install -g clearotron --prefix ~/.local`.
153
+ with `sudo`; install under your home instead: `npm install -g clearotron --prefix ~/.local`, or
154
+ `npm install -g clearotron@beta --prefix ~/.local` for the beta, then `~/.local/bin/clearotron install`.
153
155
 
154
156
  **Upgrade production to stables only.** What each channel promises and how often one is cut:
155
157
  **[docs/RELEASES.md](docs/RELEASES.md)**.
@@ -191,15 +193,19 @@ Read the list before you delete anything: one of these directories holds your re
191
193
  background services, `clearotron stop` stops them and removes their unit files. `clearotron status` says
192
194
  which of the two you have.
193
195
 
194
- **The program.** Installed globally, `npm rm -g clearotron` removes it. Installed by `clearotron install`,
195
- it lives in two places under `~/.local`:
196
+ **The program.** Installed by `clearotron install`, or with
197
+ `npm install -g clearotron --prefix ~/.local`, it lives in two places under `~/.local`:
196
198
 
197
199
  ```
198
200
  ~/.local/lib/node_modules/clearotron
199
201
  ~/.local/bin/clearotron
200
202
  ```
201
203
 
202
- Installed from a packaged tarball, it is in the folder §2 had you create, `~/app`: delete that folder.
204
+ `npm rm -g --prefix ~/.local clearotron` removes both. Without the prefix, npm looks in its own global
205
+ directory, finds nothing, and prints "up to date". Installed with `npm install -g clearotron` and no
206
+ prefix, `npm rm -g clearotron` removes the program. Installed from a packaged tarball, it is in the
207
+ folder §2 had you create, `~/app`: delete that folder. On those two routes setup also put the
208
+ `clearotron` command in `~/.local/bin/clearotron`: delete that file too.
203
209
 
204
210
  **The reasoning program, if setup installed it.** Setup puts Claude Code or the Codex CLI in one folder,
205
211
  `~/.local/share/clearotron/engines`, or where `CLEAROTRON_ENGINES_DIR` points. Delete the folder to
@@ -264,6 +270,11 @@ configuration differ; to change one, change it in both. It is not the
264
270
  same file as `~/.config/clearotron/.env`, which configures the product when you run it yourself. Delete
265
271
  both, or you leave a file of credentials in your home for services that no longer exist.
266
272
 
273
+ **Codex's working folders, on a Codex install.** Clearotron runs each Codex turn in a folder of its own
274
+ under `~/.cache/clearotron/codex-homes` (under `$XDG_CACHE_HOME` when that is set, and
275
+ `%LOCALAPPDATA%\clearotron` on Windows). A turn's folder goes when the turn ends; the folder that holds
276
+ them stays. Delete `~/.cache/clearotron` to remove it.
277
+
267
278
  Nothing else on the machine is ours: no system-wide files, no services outside your own user, and nothing
268
279
  in `/etc`, `/usr` or `/var`.
269
280
 
@@ -968,7 +979,7 @@ set:
968
979
 
969
980
  The client connector is the door a company's assistant talks to, and it
970
981
  is **part of the product** rather than something a deployment invents. A reader who reaches the
971
- Use-your-AI page and finds Connect buttons that do nothing has been failed by the install, not by
982
+ Connect your AI page and finds Connect buttons that do nothing has been failed by the install, not by
972
983
  their own integration work.
973
984
 
974
985
  **Two shapes, and the line between them is what your assistant can do — not where it runs.** Ruling
@@ -997,9 +1008,9 @@ So an install behind `ssh -L` or an editor's port forward serves shape 1 perfect
997
1008
  shape 2 at all, however the reader reaches the portal. `clearotron connect` says so plainly rather
998
1009
  than printing an address that will be rejected.
999
1010
 
1000
- **The address is set once, at install.** `npx clearotron install` asks for it — *"the address companies'
1001
- assistants reach this install at"* — and writes `CLEAROTRON_CLIENT_MCP_URL`, which is the single value the
1002
- Use-your-AI page, a report's Ask-your-AI control and `doctor` all read. Leave it empty on a local
1011
+ **The address is set once, at install.** `npx clearotron install` asks for it — *"Optional: the public connector
1012
+ address"* — and writes `CLEAROTRON_CLIENT_MCP_URL`, which is the single value the
1013
+ Connect your AI page, a report's Ask AI control and `doctor` all read. Leave it empty on a local
1003
1014
  install: every one of those surfaces then shows its honest empty state, which is correct for a machine
1004
1015
  with no public address. Changing it later is editing that one setting and restarting.
1005
1016
 
@@ -1342,7 +1353,7 @@ there. On the repository route "the project" is the checkout; on the packaged ro
1342
1353
  you ran `npm init` in — and on that route `clearotron` IS a dependency, so `npx` finds it in
1343
1354
  `node_modules/.bin` exactly as the paragraph above describes.
1344
1355
 
1345
- **`clearotron install` (§3) puts the short form on your `PATH`**, and every command after it in this
1356
+ **`clearotron install` (§2) puts the short form on your `PATH`**, and every command after it in this
1346
1357
  document uses that form. Use it rather than a fresh `npx clearotron`: `npx` resolves whichever version npm
1347
1358
  picks at that moment — the stable, unless you name a channel — and does not hand over to the copy the
1348
1359
  install placed. You can stop typing `npx` after it:
package/bin/onboard.mjs CHANGED
@@ -74,7 +74,7 @@ import { invocationForm } from "../shared/invocation.mjs"; // — and WHY that
74
74
  import { foreignPageHint } from "../shared/invocation.mjs";
75
75
  import { standFrom } from "../shared/invocation.mjs"; // is this tree one npm replaces?
76
76
  import { installShim } from "../shared/verb-shim.mjs"; // — the verb goes on PATH
77
- import { relocationPlan } from "../shared/permanent-install.mjs"; // — and the program out of npx's cache
77
+ import { relocationPlan, channelPackage, ownVersion, permanentPrefix } from "../shared/permanent-install.mjs"; // — and the program out of npx's cache
78
78
  import { isWsl } from "../shared/wsl.mjs"; // — one answer to "is this WSL", shared with the connect lines
79
79
  import { styleFor, banner } from "../shared/tty-style.mjs"; // — weight where the meaning is
80
80
  import { bracketAsciiCells, BRAND } from "../shared/brand.mjs"; // F18 — the mark, from the geometry the SVG already uses
@@ -1031,11 +1031,18 @@ const isExec = (p) => { try { accessSync(p, constants.X_OK); return statSync(p).
1031
1031
  * and the portal reports what the engine saw then. No sign-in command is named here: no copy can run in
1032
1032
  * demo mode, so none can be named, and setup names the one that signs in the copy it proves. `command` is
1033
1033
  * the setup command as the reader can type it from here.
1034
+ *
1035
+ * WITH NO AI CHOSEN, `engSpec` is null and the first line names no one AI's program: setup asks which AI
1036
+ * to use before it offers to install anything, so naming the code's default AI's vendor described a
1037
+ * program the reader may never pick.
1034
1038
  */
1035
1039
  export function leaveDemoAdvice(engSpec, { platform = process.platform, command = reachableCommand("install"),
1036
1040
  startCommand = reachableCommand("start") } = {}) {
1037
- const first = `To leave demo: run \`${command}\`. It offers to install ${engSpec.vendor}'s CLI if this machine has none, `
1038
- + "asks how it is paid for, and proves it with one turn; if the CLI is not signed in, it names the command that signs it in.";
1041
+ const first = engSpec
1042
+ ? `To leave demo: run \`${command}\`. It offers to install ${engSpec.vendor}'s CLI if this machine has none, `
1043
+ + "asks how it is paid for, and proves it with one turn; if the CLI is not signed in, it names the command that signs it in."
1044
+ : `To leave demo: run \`${command}\`. It asks which AI to use, offers to install that AI's program if this machine has none, `
1045
+ + "asks how it is paid for, and proves it with one turn; if the program is not signed in, it names the command that signs it in.";
1039
1046
  // WINDOWS HAS NO BACKGROUND FORM, so the second line there names the one restart it has: the window.
1040
1047
  if (platform === "win32") {
1041
1048
  return [first, "If Clearotron is already running, close its window and start it again: it reads the settings setup writes when it starts."];
@@ -1561,6 +1568,21 @@ export function readOwnProcesses(repo, { table = processTable() } = {}) {
1561
1568
  // The closing line of a check whose engine probe ran a test turn: the turn's AI program writes its own files
1562
1569
  // under ~/.claude and ~/.cache, so "Nothing was written" was true of this command and not of the turn.
1563
1570
  const TURN_KEPT_ITS_FILES = "Clearotron wrote nothing; the AI program's test turn keeps its own files.";
1571
+ /**
1572
+ * What setup says when it is cancelled, after "setup: ". It said "Nothing was written." every time, and by
1573
+ * then it may have installed its own copy under the reader's home (`copy`, from npx), the AI's program into
1574
+ * the engines folder (`engine`), or both, and a test turn may have left the AI program's own files
1575
+ * (`turnRan`). The settings file is only ever written at the end, so that part stays true, and the line
1576
+ * says what does stay. "Nothing was written." is kept for the cancel where it is still true.
1577
+ */
1578
+ export function cancelledLine({ copy = null, engine = null, turnRan = false } = {}) {
1579
+ if (!copy && !engine) return `cancelled. ${turnRan ? TURN_KEPT_ITS_FILES : "Nothing was written."}`;
1580
+ const stays = copy && engine
1581
+ ? `clearotron ${copy.version} stays installed in ${copy.prefix}, and ${engine.vendor}'s CLI in ${engine.dir}.`
1582
+ : copy ? `clearotron ${copy.version} stays installed in ${copy.prefix}.`
1583
+ : `${engine.vendor}'s CLI stays installed in ${engine.dir}.`;
1584
+ return `cancelled. No settings were written. ${stays}${turnRan ? " The AI program's test turn keeps its own files." : ""}`;
1585
+ }
1564
1586
  export async function runCheck() {
1565
1587
  say("\n Trademark clearance engine — configuration check\n");
1566
1588
  // Whether the engine probe's turn started the AI program (TURN_KEPT_ITS_FILES); one refused first did not.
@@ -1725,20 +1747,28 @@ export async function runCheck() {
1725
1747
  // prints every line about them. `engineJudged` is that section's own condition: it judges nothing when
1726
1748
  // the units' environment cannot be read, or when CLEAROTRON_AI names no engine this driver ships.
1727
1749
  const engineJudged = serviceKnown && !(engSel && !engSpec);
1750
+ // WITH NO AI CHOSEN THERE IS NO ENGINE TO JUDGE. `engineId` falls back to the code's default, and the
1751
+ // default is not a choice: every search is refused until one is made (run-requirements.mjs, the engine row
1752
+ // of `runRequirements`). Everything this section read off that default described an AI nobody chose: a
1753
+ // machine with only Codex was told no `claude` was on its PATH, a ticked billing line named the default's
1754
+ // subscription, and --probe-engine spent a turn proving the default and called the install ready. Measured
1755
+ // on a fresh install of 0.5.1-beta.0, 2026-11-07. So the program, the probe and the billing are read
1756
+ // only for an AI that is chosen, and a machine with none is in demo mode: nothing it has chosen can run.
1757
+ const engineChosen = engineJudged && !!engSel;
1728
1758
  // — through `effective`, so the engine binary is found under whichever spelling is set. Read
1729
1759
  // literally, this reported a configured binary as missing on any install the wizard had written.
1730
- const binEff = engineJudged ? engineRead(engSpec.env, [engSpec.env]) : null;
1760
+ const binEff = engineChosen ? engineRead(engSpec.env, [engSpec.env]) : null;
1731
1761
  // The engine's own fallback word is the default spelled out (resolveEngineProgram), so a setting of
1732
1762
  // `claude` is not a configuration that can be wrong: it asks PATH, then the copy Clearotron installed.
1733
- const binSet = engineJudged && !!binEff && String(binEff.v).trim() !== engSpec.fallback;
1734
- const binSetting = engineJudged ? (binEff?.v || engSpec.fallback) : null;
1735
- const bin = engineJudged ? resolveEngineBin(binSetting, { engine: engineId, env: engineEnvOf() }) : null;
1763
+ const binSet = engineChosen && !!binEff && String(binEff.v).trim() !== engSpec.fallback;
1764
+ const binSetting = engineChosen ? (binEff?.v || engSpec.fallback) : null;
1765
+ const bin = engineChosen ? resolveEngineBin(binSetting, { engine: engineId, env: engineEnvOf() }) : null;
1736
1766
  // How the mode is read, and why its environment is normalised first, is the Engine section's note
1737
1767
  // WHICH MODE THIS INSTALL IS IN.
1738
- const invEnv = engineJudged
1768
+ const invEnv = engineChosen
1739
1769
  ? engineEnvOf(["CLEAROTRON_AI", ...Object.values(ENGINE_BINARIES).flatMap((x) => [x.env, x.authEnv, x.apiKeyEnv])].filter(Boolean))
1740
1770
  : null;
1741
- const installMode = engineJudged ? engineMode(engineInventory(invEnv)) : null;
1771
+ const installMode = !engineJudged ? null : engineChosen ? engineMode(engineInventory(invEnv)) : ENGINE_MODES.DEMO;
1742
1772
  // THE COMMAND THE READER CAN TYPE FROM HERE, as the demo line names its own. A bare `clearotron` is not
1743
1773
  // on PATH for an install run from npx, and now that the engine program comes with the install this is
1744
1774
  // the line most installs see first. The opening prints it when it leads and the Engine section prints
@@ -1858,11 +1888,18 @@ export async function runCheck() {
1858
1888
  // searches and that the order-time answer does not cover.
1859
1889
  const missingWords = serviceKnown && atOrder.length ? whatIsMissing(atOrder) : "";
1860
1890
  const leadIsTheRefusal = !hosted && missingWords !== "";
1861
- const turnLeads = PROBE_ENGINE && serviceKnown && atOrder.length === 0 && engineJudged && bin.executable && !bin.relative;
1891
+ const turnLeads = PROBE_ENGINE && serviceKnown && atOrder.length === 0 && engineChosen && bin.executable && !bin.relative;
1862
1892
  const signInLineLeads = !leadIsTheRefusal && !PROBE_ENGINE && signInLine !== null;
1863
1893
  // ONE LINE, AS EVERY LINE BELOW IS, and the terminal wraps it. Wrapped here at spaces, it broke the command
1864
1894
  // apart wherever the install's path made a long word: `cd <path> && npx clearotron install` on three lines.
1865
- if (leadIsTheRefusal) say(` ${cannotSearchYet(missingWords, invoke("install"))}`);
1895
+ //
1896
+ // AND IT SAYS TO RUN `start` AGAIN ONLY WHILE ONE RUNS THAT SETUP REACHES. A foreground `clearotron start` reads
1897
+ // its settings file when it starts, so after setup it must be run again; with none running, setup is the whole
1898
+ // remedy. A demo's start reads no install's settings, and a start whose record names no settings file read
1899
+ // none, so setup does not reach either. The record is the one `clearotron status` reads; `start` writes `envFile`.
1900
+ const { readRunning } = await import(pathToFileURL(join(REPO, "shared", "running-start.mjs")).href);
1901
+ const startRunning = leadIsTheRefusal && readRunning().some((r) => !r.demo && typeof r.envFile === "string" && r.envFile !== "");
1902
+ if (leadIsTheRefusal) say(` ${cannotSearchYet(missingWords, invoke("install"), startRunning ? { kind: "start" } : null)}`);
1866
1903
  else {
1867
1904
  let turn = null;
1868
1905
  if (turnLeads) {
@@ -2050,23 +2087,36 @@ export async function runCheck() {
2050
2087
  // box that may be running codex — so it reported the wrong variable and could pass for the wrong
2051
2088
  // reason. Which engine is configured comes first now, and the binary is checked through THAT engine's
2052
2089
  // variable.
2090
+ // The mode of a machine that cannot start a search, said by both branches below that reach it.
2091
+ const demoModeLine = () => "MODE: demo — everything works except starting a NEW search. The example report, its audit trail "
2092
+ + `and the MCP connection are live right now; \`${reachableCommand("demo")}\` needs no engine.`;
2053
2093
  if (!serviceKnown) {
2054
2094
  info("the units' environment could not be read, so which AI the services run is not judged here — a failure to look, not a finding");
2055
2095
  } else if (engSel && !engSpec) {
2056
2096
  problem(`CLEAROTRON_AI="${engSel.v}" (${engSel.from}) is not an engine this driver ships — one of: `
2057
2097
  + `${Object.keys(ENGINE_BINARIES).join(", ")}. The run refuses on this by itself (gateway.selectEngine); `
2058
2098
  + "nothing can be checked here until it names an adapter.");
2059
- } else {
2060
- if (engSel) ok(`${engineId} (${engSel.from}) — ${engSpec.label}`);
2099
+ } else if (!engSel) {
2061
2100
  // WHAT THE ORDER-TIME CHECK SAYS, NOT WHAT THE CODE FALLS BACK TO. Every search is refused while the
2062
2101
  // services lack this (run-requirements.mjs, `runRequirements`, the engine row), whatever the default
2063
2102
  // below checks. Naming that default here read as "nothing to do", a few lines above "Will a search
2064
2103
  // run?" listing this very setting (measured on a fresh install of a beta, 2026-11-04). Asked of the
2065
2104
  // services' own reading (servicesRead), as that section asks it: on a machine with units, their file
2066
2105
  // may hold the value this command's file does not, and then no search is refused over it.
2067
- else if (serviceKnown && !servicesRead("CLEAROTRON_AI")) info(`CLEAROTRON_AI is not set, so no AI is chosen, `
2106
+ const noAiChosen = !servicesRead("CLEAROTRON_AI");
2107
+ if (noAiChosen) info(`CLEAROTRON_AI is not set, so no AI is chosen, `
2068
2108
  + `and a search is refused until one is. \`${invoke("install")}\` asks which AI to use.`);
2069
2109
  else info(`CLEAROTRON_AI is not set — the code default is ${DEFAULT_ENGINE_ID}, and one engine serves every stage of every run on this machine`);
2110
+ // AND NOTHING BELOW IT IS READ OFF THE DEFAULT (engineChosen, above the opening): no program, no payment
2111
+ // and no turn, which would all describe an AI nobody chose. The machine is in demo mode, and the way out
2112
+ // is the demo's own advice. With no AI chosen it names no one AI's program; where the services hold an
2113
+ // AI this command's file does not, it keeps the words it had.
2114
+ info(demoModeLine());
2115
+ for (const line of leaveDemoAdvice(noAiChosen ? null : engSpec)) info(line);
2116
+ // ASKED TO PROBE with no AI chosen, it says why it did not, where it used to print nothing at all.
2117
+ if (PROBE_ENGINE && noAiChosen) info(`not probed — no AI is chosen. \`${invoke("install")}\` asks which AI to use.`);
2118
+ } else {
2119
+ ok(`${engineId} (${engSel.from}) — ${engSpec.label}`);
2070
2120
 
2071
2121
  // The line between an ABSENCE and a MISCONFIGURATION. Nothing set and no binary on PATH is a fresh
2072
2122
  // machine — reported, not failed. A variable that names something wrong is a configuration that
@@ -2159,8 +2209,7 @@ export async function runCheck() {
2159
2209
  //
2160
2210
  // `invEnv` and `installMode` are read that way above the opening, which needs the mode for its sign-in line.
2161
2211
  if (installMode === ENGINE_MODES.DEMO) {
2162
- info("MODE: demo — everything works except starting a NEW search. The example report, its audit trail "
2163
- + `and the MCP connection are live right now; \`${reachableCommand("demo")}\` needs no engine.`);
2212
+ info(demoModeLine());
2164
2213
  // NAMES THE COMMAND, AND THE RESTART. The settings page says both now, and a doctor that named
2165
2214
  // the program but not how to install it — or that left out the restart, which is what actually
2166
2215
  // unsticks a reader who has just installed it — would be the third opinion this issue exists to
@@ -3807,6 +3856,17 @@ export async function runCheck() {
3807
3856
  // back. Exported so the test drives the options this file uses; above the call below, which reads it.
3808
3857
  export const SETUP_READLINE = Object.freeze({ terminal: true, historySize: 0 });
3809
3858
 
3859
+ /**
3860
+ * What setup says when it cannot move out of npx's cache, and the install that lasts, ON THIS CHANNEL.
3861
+ * `npm install -g clearotron` installs the stable, so on a beta it named the other channel.
3862
+ */
3863
+ export function stuckInNpxCacheNote(skip, pkg = channelPackage()) {
3864
+ return [
3865
+ `\n Note: this is running from npm's temporary npx cache and cannot be moved out of it here (${skip}).`,
3866
+ ` It will stop working when npm cleans that cache. \`npm install -g ${pkg}\` installs it permanently.\n`,
3867
+ ];
3868
+ }
3869
+
3810
3870
  if (!isEntrypoint(import.meta.url)) {
3811
3871
  // imported, not run — do nothing else
3812
3872
  } else {
@@ -3860,10 +3920,7 @@ if (move && !move.skip && process.env.CLEAROTRON_RELOCATED !== "1") {
3860
3920
  const moved = spawnSync(process.execPath, [move.entry, "install", ...process.argv.slice(2)], { stdio: "inherit", env });
3861
3921
  process.exit(moved.status ?? 1);
3862
3922
  }
3863
- if (move?.skip) {
3864
- console.error(`\n Note: this is running from npm's temporary npx cache and cannot be moved out of it here (${move.skip}).`);
3865
- console.error(" It will stop working when npm cleans that cache. `npm install -g clearotron` installs it permanently.\n");
3866
- }
3923
+ if (move?.skip) for (const line of stuckInNpxCacheNote(move.skip)) console.error(line);
3867
3924
 
3868
3925
  // A credential typed at a prompt is echoed by the terminal and then sits in scrollback, in tmux history,
3869
3926
  // in whatever the reader pastes into a bug report. So the echo is muted while a secret is being typed:
@@ -3981,10 +4038,17 @@ const choose = async (q, options, def = 0, after = []) => {
3981
4038
 
3982
4039
  const candidate = {};
3983
4040
  let aborted = null;
4041
+ // WHAT SETUP HAS ALREADY PUT ON THE MACHINE, for the line a cancel prints (cancelledLine). Run from npx, the
4042
+ // copy this process runs from was installed by the process that started it, under the same prefix.
4043
+ const installedCopy = process.env.CLEAROTRON_RELOCATED === "1" ? { version: ownVersion(), prefix: permanentPrefix() } : null;
4044
+ let installedEngine = null;
4045
+ let setupTurnRan = false;
3984
4046
  try {
3985
4047
  say("\n Trademark clearance engine — setup\n");
3986
4048
  say(" One question at a time. Enter takes the default in brackets.");
3987
- say(" Nothing is written until each credential you give has been checked, except a paid register key: checking it would cost you, so it is written on your word.\n");
4049
+ // "No setting", not "Nothing": by the end of a cancelled setup its own copy, the AI's program and a test
4050
+ // turn's files may be on the machine (cancelledLine), and only the settings wait for the checks.
4051
+ say(" No setting is written until each credential you give has been checked, except a paid register key: checking it would cost you, so it is written on your word.\n");
3988
4052
 
3989
4053
  // ── BEFORE YOU START, derived from what the product declares it needs ──────
3990
4054
  //
@@ -4100,6 +4164,7 @@ try {
4100
4164
  if (r.error) problem(`could not run it: ${r.error.message}`);
4101
4165
  else if (r.status !== 0) warn(`that command exited ${r.status ?? "on a signal"} — checking anyway, since its exit code is not what settles this.`);
4102
4166
  bin = resolveEngineBin(eng.fallback, { engine: pick.id });
4167
+ if (bin.source === "installed") installedEngine = { vendor: eng.vendor, dir };
4103
4168
  if (bin.executable && !bin.relative) { if (bin.source === "installed") ok(`installed: ${bin.path}`); }
4104
4169
  else warn(cannotRunLine(eng, bin, ""));
4105
4170
  // RESOLVED WITH THE ENGINE'S DEFAULT WORD, NOT THE SETTING IN FORCE. The line above the offer promised
@@ -4242,6 +4307,8 @@ try {
4242
4307
  say(" Running one turn…");
4243
4308
  // Read on every try, so a setting the reader fixes in the file between tries is the one the next turn uses.
4244
4309
  const v = await probeEngineTurn(proofTurn({ engineId: pick.id, eng, bin, authEnv, settings: settingsInForce() }));
4310
+ // A turn refused before it started the program left no files of the program's own (runCheck's runTurn).
4311
+ if (v.ok || v.basis !== "config") setupTurnRan = true;
4245
4312
  if (v.ok) {
4246
4313
  ok(`${eng.product} completed a turn on ${PAYS_WITH[authPick.id]} — binary, credential, billing mode and model access all work.`);
4247
4314
  const served = servedLine(v);
@@ -4340,8 +4407,9 @@ try {
4340
4407
 
4341
4408
  // 4 ── register provider
4342
4409
  say("\n Register provider");
4343
- say(" This decides which register gets searched, and which vendor gets billed. There is no default in");
4344
- say(" the engine — it refuses to guess.");
4410
+ // "(default)" below is the answer Enter picks, so the line says what the engine does with none: it refuses.
4411
+ say(" This decides which register gets searched, and which vendor gets billed. Every search refuses");
4412
+ say(" until one is set.");
4345
4413
  // THE LAST ROW IS NOT A REGISTER, as on the AI question, and with the same words. Leaving the register
4346
4414
  // unset was reachable only by picking a vendor and skipping its credential, so a reader who meant "none
4347
4415
  // yet" had to pretend to choose one. Choosing it takes the branch a skipped credential reaches below.
@@ -4954,10 +5022,11 @@ try {
4954
5022
  } catch (e) {
4955
5023
  if (!aborted) {
4956
5024
  muted = false;
4957
- // Ctrl-D / a closed stdin lands here. It is not a crash and must not read like one — and nothing has
4958
- // been written at any point before the single atomic rename at the end.
4959
- const msg = /Ctrl\+D|closed|aborted/i.test(String(e?.message ?? e))
4960
- ? "cancelled. Nothing was written."
5025
+ // Ctrl-C, Ctrl-D or a closed stdin lands here. It is not a crash and must not read like one. No setting
5026
+ // has been written before the single atomic rename at the end, but setup's own copy, the AI's program
5027
+ // and a test turn's files may already be on the machine, and the line names each one that is.
5028
+ const msg = /Ctrl\+[CD]|closed|aborted/i.test(String(e?.message ?? e))
5029
+ ? cancelledLine({ copy: installedCopy, engine: installedEngine, turnRan: setupTurnRan })
4961
5030
  : String(e?.message ?? e);
4962
5031
  console.error(`\nsetup: ${msg}\n`);
4963
5032
  rl.close();
package/bin/start.mjs CHANGED
@@ -121,7 +121,7 @@ import { wslTarget } from "../shared/wsl.mjs"; // — and which distribution a
121
121
  import { ensureDemoProgram } from "../shared/permanent-install.mjs"; // — a demo from npx keeps its own copy
122
122
  import { mergeEnvFile } from "../shared/env-file-merge.mjs";
123
123
  import { mcpOriginFor } from "../shared/lane-address.mjs"; // — one author for the origin
124
- import { SERVER_INSTALL_SET, unitsToRestartOnRefresh, unitHealthVerdict } from "../shared/server-units.mjs"; // — one authority, two callers
124
+ import { SERVER_INSTALL_SET, SERVER_UNITS, BACKGROUND_RETIRED, aBackgroundStartRefreshes, unitsToRestartOnRefresh, unitHealthVerdict } from "../shared/server-units.mjs"; // — one authority, two callers
125
125
  // — the door --background now INSTALLS, and the one authority for the settings
126
126
  // it refuses to start without. (Until 2026-09-03 this import read "the one unit --background may
127
127
  // tolerate and never manage"; settled point 2 superseded that.)
@@ -161,10 +161,8 @@ const REPO = join(dirname(fileURLToPath(import.meta.url)), "..");
161
161
  const ENV_PATH = envLocalPath({ repoRoot: REPO }); // resolved, never composed: one resolver, so moving this file later is one line
162
162
  /** Where `render-units.mjs --apply` installs, and therefore where "this box is a server" is visible. */
163
163
  export const UNIT_DIR = join(homedir(), ".config", "systemd", "user");
164
- /** The shipped units that make this box a server. A door unit alone is enough; so is the drain. */
165
- export const SERVER_UNITS = Object.freeze([
166
- "clearotron-portal.service", "clearotron-mcp-face.service", "prelim-driver.service",
167
- ]);
164
+ /** The shipped units that make this box a server, from the one module that lists units (shared/server-units.mjs). */
165
+ export { SERVER_UNITS };
168
166
  /**
169
167
  * Which of the shipped units are installed on this box.
170
168
  *
@@ -740,25 +738,9 @@ const unitTypeOf = (u) => {
740
738
  return (readFileSync(join(REPO, "driver", "systemd", u), "utf8").match(/^Type=(\w+)/m)?.[1] ?? "simple").toLowerCase();
741
739
  } catch { return "simple"; }
742
740
  };
743
- // ── UNITS THIS FLAG ONCE INSTALLED AND NOW RETIRES ─────────────────────────────
744
- //
745
- // A box that ran `--background` before the retirement HAS these three installed and enabled. They must
746
- // stay MANAGED, or the carve below reads them as foreign, concludes the box is a real server, and the
747
- // flag refuses on exactly the boxes it previously worked on — "making the flag unrunnable exactly once
748
- // it has worked", which is the failure its own comment records being found by driving it twice.
749
- //
750
- // AND THEY MUST BE DISARMED, not merely unpinned. The worker drains continuously; leaving the timer
751
- // armed puts a second claimant on the queue. The claim itself is atomic — `claimAndPrep` in runner.mjs renames
752
- // `<id>.json` to the lock path and only one racer wins — so this is not double-execution. What it does
753
- // cost is the admission cap: counts are serial per queue while queues drain concurrently, so two
754
- // claimers can overshoot a per-account cap by a bounded one per queue. A bounded overshoot is not a
755
- // reason to leave a retired unit running when disarming it is one call.
756
- // EMPTY, AND KEPT RATHER THAN DELETED. The retired path-watcher/timer units it named are gone from the
757
- // tree, so naming them here would describe files this repo does not ship — which is exactly what the
758
- // "every retired unit is a unit this repo actually ships" check refuses. The export stays because the
759
- // next retirement wants somewhere to go, and an empty list is a statement that nothing is currently
760
- // retired-but-shipped.
761
- export const BACKGROUND_RETIRED = Object.freeze([]);
741
+ // The units this flag once installed and now retires: kept MANAGED, and disarmed below. The list, and why it
742
+ // is kept although empty, are in shared/server-units.mjs, beside the rule that reads it (aBackgroundStartRefreshes).
743
+ export { BACKGROUND_RETIRED };
762
744
 
763
745
  export const BACKGROUND_EXCLUDED = Object.freeze({
764
746
  // ── `clearotron-client-mcp.service` LEFT THIS TABLE ON 2026-09-03, AND SAYING SO IS THE POINT ────
@@ -1115,10 +1097,10 @@ if (isMain) {
1115
1097
  // reads the box as a server and refuses — making the flag unrunnable exactly once it has worked.
1116
1098
  // The carve is narrow on purpose: every installed unit must be one this flag manages (or the client
1117
1099
  // door `clearotron connect` manages). A box carrying anything else — the deploy timer, the outbox
1118
- // lane — is a real server, and the refusal below is still the right answer for it.
1119
- const managed = new Set([...BACKGROUND_UNITS, ...BACKGROUND_RETIRED, CLIENT_DOOR_UNIT]);
1120
- const foreign = installed.filter((u) => !managed.has(u));
1121
- const backgroundRefresh = wantBackground && installed.length > 0 && foreign.length === 0;
1100
+ // lane — is a real server, and the refusal below is still the right answer for it. The rule is
1101
+ // aBackgroundStartRefreshes (shared/server-units.mjs), which the portal's refusal asks too. The client door
1102
+ // is one of BACKGROUND_UNITS, and the detector never names it.
1103
+ const backgroundRefresh = wantBackground && aBackgroundStartRefreshes(installed);
1122
1104
  if (installed.length && !backgroundRefresh)
1123
1105
  fatal(`This box has the services installed — ${installed.join(", ")} in ${UNIT_DIR}.\n`
1124
1106
  + " Its configuration is those units' EnvironmentFile, not this checkout's .env, and they are\n"
@@ -2496,8 +2478,11 @@ if (isMain) {
2496
2478
  // Structurally excluded rather than filtered: the union cannot carry a key the object never had.
2497
2479
  const mintedPassphrase = credentialExisted ? null : newPassphrase();
2498
2480
 
2481
+ // THE FILE THIS COMMAND READ GOES TO THE PORTAL TOO, as it goes to the worker: the portal's refusal of an order
2482
+ // names it as what to reload (driver/how-it-runs.mjs, the `start` state). No file read, no flag.
2499
2483
  const portal = start("the portal", "driver/portal-service.mjs",
2500
- mintedPassphrase ? { ...envs.portal, PORTAL_LOCAL_PASSPHRASE: mintedPassphrase } : envs.portal);
2484
+ mintedPassphrase ? { ...envs.portal, PORTAL_LOCAL_PASSPHRASE: mintedPassphrase } : envs.portal,
2485
+ { args: envFileRead() ? [`--start-env-file=${envFileRead()}`] : [] });
2501
2486
  if (!await healthy(`http://${HOST}:${ports.portal}/portal/health`, portal)) {
2502
2487
  if (portal.alive) { showFiledTail(portal); err(`\nstart: the portal did not answer on ${HOST}:${ports.portal} within 30s — its output above says why.\n`); await shutdown(1); }
2503
2488
  await new Promise(() => {});
@@ -2562,10 +2547,14 @@ if (isMain) {
2562
2547
  const clientDoorAnswered = clientDoor ? await healthy(`http://${HOST}:${ports.client}/healthz`, clientDoor) : false;
2563
2548
 
2564
2549
  // ── 6. one URL ─────────────────────────────────────────────────────────────────────────────────────
2550
+ //
2551
+ // THE HINT IS SAID ONCE. A first start frames the address again below, with the passphrase, and that
2552
+ // frame carries the hint for the reader who acts on the frame alone. Printed here as well, the same two
2553
+ // lines appeared twice in one screen of output, a dozen lines apart.
2565
2554
 
2566
2555
  say("");
2567
2556
  say(` Open ${envs.url}`);
2568
- for (const line of foreignPageHint(DEMO ? "demo" : "start", ports.portal)) say(` ${line}`);
2557
+ if (!mintedPassphrase) for (const line of foreignPageHint(DEMO ? "demo" : "start", ports.portal)) say(` ${line}`);
2569
2558
  say("");
2570
2559
  // ── TWO DOORS, TWO AUDIENCES, BOTH NAMED ( — F26) ─────────────────────────
2571
2560
  //
@@ -2609,7 +2598,9 @@ if (isMain) {
2609
2598
  try {
2610
2599
  const forget = recordRunning({ pid: process.pid, demo: DEMO, base: paths.base, url: envs.url, host: HOST,
2611
2600
  ports: { portal: ports.portal, mcp: ports.mcp, client: doorRunning ? ports.client : null },
2612
- startedAt: new Date().toISOString() });
2601
+ // The settings file this start read, or null when it read none: doctor tells a reader to run it again
2602
+ // after setup only when setup writes what it reads.
2603
+ envFile: envFileRead(), startedAt: new Date().toISOString() });
2613
2604
  process.on("exit", forget);
2614
2605
  } catch (e) {
2615
2606
  say(` (\`status\` will not see this start: its record could not be written — ${String(e?.message ?? e)})`);
@@ -2683,7 +2674,7 @@ if (isMain) {
2683
2674
  // ASKED OF THE ENVIRONMENT THE WORKER WAS HANDED, by the runner's own order-time test: an order is refused
2684
2675
  // there until the install can search, and this line said an order starts a run whatever the install held.
2685
2676
  const cannot = missingRequirements(childProcessEnv(process.env, envs.worker), await runTables()).atOrder;
2686
- for (const line of orderingLines({ missing: whatIsMissing(cannot), install: invoke("install") })) say(line);
2677
+ for (const line of orderingLines({ missing: whatIsMissing(cannot), install: invoke("install"), doctor: invoke("doctor"), file: envFileRead() })) say(line);
2687
2678
  } else {
2688
2679
  say(" Ordering a clearance from the portal puts the job in the queue and shows it there with its");
2689
2680
  say(" position. You started with --no-worker, so nothing is draining it: run");
@@ -2824,16 +2815,24 @@ export function connectScreen(connect) {
2824
2815
  /**
2825
2816
  * What a terminal start says about ordering when it runs a worker. `missing` is what the install lacks for a
2826
2817
  * search, in the phrases the portal uses (whatIsMissing), or "" when it lacks nothing. An install that cannot
2827
- * search has its orders refused, so it is told that, in the owner's words (2026-11-06), and not that an order
2828
- * starts a run.
2818
+ * search has its orders refused, so it is told that, in the owner's words, and not that an order starts a run.
2819
+ *
2820
+ * AND HOW TO RELOAD THIS COMMAND (2026-11-07). It reads its settings once, when it starts, so after setup it must
2821
+ * be run again. `file` is the settings file it read, or would have on a fresh install (envFileRead()); null when
2822
+ * it read none, because it was told not to or a service manager started it. Then setup does not reach it, and
2823
+ * the reader sets each setting in the environment it runs in. `install` and `doctor` are the commands as the
2824
+ * reader types them. PURE.
2829
2825
  */
2830
- export function orderingLines({ missing = "", install = "clearotron install" } = {}) {
2826
+ export function orderingLines({ missing = "", install = "clearotron install", doctor = "clearotron doctor", file = null } = {}) {
2831
2827
  if (!missing) {
2832
2828
  return [" Ordering a clearance from the portal starts it. The portal prices the run and asks you to",
2833
2829
  " confirm before anything is spent — that confirmation is the moment money is committed."];
2834
2830
  }
2835
- return fitTo(96, `Ordering a clearance from the portal is refused until this install can run a search: ${missing}. `
2836
- + `Run \`${install}\` in a terminal to set it up.`).map((l) => ` ${l}`);
2831
+ const head = `Ordering a clearance from the portal is refused until this install can run a search: ${missing}.`;
2832
+ const reload = file
2833
+ ? `Run \`${install}\` in a terminal to set it up, then stop this command with Ctrl-C and run it again: it reads the settings setup writes when it starts.`
2834
+ : `This command read no environment file of its own: set each missing setting in the environment it runs in, then stop it and run it again. \`${doctor}\` names each setting.`;
2835
+ return fitTo(96, `${head} ${reload}`).map((l) => ` ${l}`);
2837
2836
  }
2838
2837
 
2839
2838
  /**
package/build-info.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "commit": "2a6008ae59d38921b6f31541a36e300981185b78",
3
- "version": "0.5.1-beta.0"
2
+ "commit": "bf3f6a3d607144e92e4dd0213d612ea845582096",
3
+ "version": "0.5.1-beta.2"
4
4
  }
@@ -229,7 +229,7 @@ template, and a placeholder that looks configured is worse than unset.**
229
229
  4. At your edge: confirm the client hostname resolves to that port and that the **client** Access app
230
230
  fronts it — not the staff one. Enrol the addresses of each company's people on that app's policy.
231
231
  5. `CLEAROTRON_CLIENT_MCP_URL` must be set for the portal process too, or `/portal/api/mcp-access` answers
232
- `{url:null}` and the Use-your-AI screen correctly shows its empty state.
232
+ `{url:null}` and the Connect your AI page correctly shows its empty state.
233
233
 
234
234
  The client connector address is served **live**: `/portal/api/mcp-access` reads `CLEAROTRON_CLIENT_MCP_URL`
235
235
  at request time, so a change reaches every screen that shows it on the next load — no re-render involved. The
@@ -353,7 +353,7 @@ cannot be read as one list.
353
353
  | `PERPLEXITY_API_KEY` | Marketplace grid research server. |
354
354
  | `EUIPO_CLIENT_ID` / `EUIPO_CLIENT_SECRET` / `EUIPO_ENVIRONMENT` | EUIPO OAuth2 client-credentials; environment defaults to **sandbox** — production requires an explicit set. |
355
355
  | `CLEAROTRON_MCP_URL` | Staff "Ask your AI" connector base, baked into the report at render — there is one report, and `portal-report.mjs` strips the block for non-staff readers at serve time. Fails closed → link omitted when unset. |
356
- | `CLEAROTRON_CLIENT_MCP_URL` | The client connector's "Ask your AI" base address, served LIVE by the portal's `/portal/api/mcp-access` (the Use-your-AI screen) — set it on the portal unit, or the screen shows its (correct) empty state. The render no longer reads it: the baked block is the staff connector above. Fails closed → `{url:null}` when unset. **Never pin a placeholder value:** the fail-closed branch keys on the var being EMPTY, so a placeholder host defeats the guard and hands out a dead connector address. |
356
+ | `CLEAROTRON_CLIENT_MCP_URL` | The client connector's "Ask your AI" base address, served LIVE by the portal's `/portal/api/mcp-access` (the Connect your AI page) — set it on the portal unit, or the screen shows its (correct) empty state. The render no longer reads it: the baked block is the staff connector above. Fails closed → `{url:null}` when unset. **Never pin a placeholder value:** the fail-closed branch keys on the var being EMPTY, so a placeholder host defeats the guard and hands out a dead connector address. |
357
357
  | `CLIENT_MCP_ACCOUNT_ACCESS` | `1` admits the signed-in principal from outside your staff (kind `account`) on the client MCP surface: no token, scoped to the companies the CF-verified email is granted. Off by default. Set WITHOUT `CLEAROTRON_ACCESS_FILE` ⇒ fatal start (`accountsForEmail` answers `"*"` with no guest list, and an unscoped wildcard must never be admitted). See `docs/CLIENT-MCP.md` — enabling this for a company with no `runCaps.dailyRuns` lets it start paid searches all day. |
358
358
 
359
359
  ### Scrub guard
@@ -0,0 +1,21 @@
1
+ <!-- SPDX-License-Identifier: AGPL-3.0-only -->
2
+ <!-- Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md -->
3
+
4
+ **0.5.1**
5
+
6
+ **What changed**
7
+ - **Knockout.** A Knockout now reads the register the way a clearance does. It narrows a crowd by the client's goods, classes and markets, and reads in full each list it selects. The report lists a name's filings before its web use, and can give different risk bands to different groups of classes.
8
+ - **Install and setup.** The install documents and the program now agree. Setup explains signing in, and can continue without an AI.
9
+ - **Portal.** An install that cannot run a search says so before a search is filled in. Progress steps are renamed and the stop dialog is clearer.
10
+ - **Audit workbook.** A part of a report that could not be completed is now listed as not completed.
11
+
12
+ The full list is in the release notes.
13
+
14
+ **How it was tested**
15
+ - Built from 0.5.1-beta.2.
16
+ - Automated test suites on Linux and Windows, and an install check on macOS.
17
+ - Live Knockout searches on both supported AI engines, checked against a lawyer's report.
18
+ - A fresh install by a new user, following only the published instructions.
19
+
20
+ **Known limits**
21
+ - No lawyer has reviewed this version's ratings. Some names are rated higher than the lawyer's report.
@@ -1,5 +1,25 @@
1
1
  # clearotron-driver
2
2
 
3
+ ## 0.5.1-beta.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed: A Knockout again checks the web use of at most three owners per name, instead of every owner it marks.
8
+
9
+ ## 0.5.1-beta.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Fixed: On a beta, the setup and check commands the portal names now install and run the beta, not the stable release.
14
+ - Fixed: With no AI chosen, the portal no longer offers to read a brief with an AI nobody chose, and `clearotron start` says why it is off.
15
+ - Fixed: Cancelling setup now says what it had already installed, instead of saying nothing was written.
16
+ - Fixed: With no AI chosen, `clearotron doctor` no longer reports the program, billing or sign-in of an AI nobody chose, and `--probe-engine` spends no turn.
17
+ - Fixed: In the demo, New clearance offers Review search again, and an order opens the finished example without asking whether to leave the page.
18
+ - Fixed: The install guide now gives the beta's global install, a removal command that removes the program, and the folder Codex's turns leave behind.
19
+ - Fixed: When an install cannot search yet, the portal, `clearotron start` and the run's log now say where the missing settings go and what to restart.
20
+ - Fixed: Setup's register question no longer says there is no default beside the answer Enter picks.
21
+ - Fixed: The portal no longer shows "[object Object]" on a company's profile, sends requests that fail before a company is picked, or prints its address hint twice.
22
+
3
23
  ## 0.5.1-beta.0
4
24
 
5
25
  ### Patch Changes
@@ -37,8 +37,9 @@
37
37
  // replaces — today's lanes are simply skipped or billed elsewhere on codex — and it is a real gap, so
38
38
  // `truncationObservable` rides every result and a reader can tell which kind of `ok` they are holding.
39
39
 
40
- import { ENGINE_BINARIES, DEFAULT_ENGINE_ID, engineAdapterSpecifier } from "../driver.config.mjs";
40
+ import { ENGINE_BINARIES, engineAdapterSpecifier } from "../driver.config.mjs";
41
41
  import { resolveAuthMode } from "./auth.mjs";
42
+ import { whatIsMissing } from "../run-requirements.mjs"; // — the order-time gate's words for an AI nobody has chosen
42
43
 
43
44
  /** The driver's tier vocabulary, not a wire model id (engine/CONTRACT.md §3) — the cheap rung on both. */
44
45
  export const JX_TIER = "haiku";
@@ -132,7 +133,14 @@ export async function makeJxTurnRunner({
132
133
  // Names the lane in the one message a caller shows a human when the configuration refuses.
133
134
  lane = "the jx lanes",
134
135
  } = {}) {
135
- const id = String(env.CLEAROTRON_AI || DEFAULT_ENGINE_ID).trim().toLowerCase();
136
+ // NO AI CHOSEN IS NOT THE DEFAULT AI. With CLEAROTRON_AI unset this door resolved the code's default, so an
137
+ // install with no AI chosen got a turn runner on that AI's program, billed to whatever it was signed in to:
138
+ // the portal booted "brief reading ON — engine=anthropic-agent", and Describe-it would have spent a turn
139
+ // there (measured on a fresh install of 0.5.1-beta.0, 2026-11-07). A search with no AI chosen is refused at
140
+ // order time, before a lane could ask; the portal's reader asks at boot. So the door refuses here, in the
141
+ // order-time gate's own words, and reads the setting as that gate reads it: blank is not chosen.
142
+ if (!String(env.CLEAROTRON_AI ?? "").trim()) return { error: whatIsMissing([{ about: "ai" }]) };
143
+ const id = String(env.CLEAROTRON_AI).trim().toLowerCase();
136
144
  if (!ENGINE_BINARIES[id]) return { error: `CLEAROTRON_AI=${id} is not an engine this driver ships` };
137
145
 
138
146
  let auth;