clearotron 0.5.0 → 0.5.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +2 -2
- package/INSTALL.md +334 -302
- package/QUICKSTART.md +12 -4
- package/README.md +12 -7
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/bin/README.md +14 -11
- package/bin/clearotron.mjs +1 -1
- package/bin/connect.mjs +73 -25
- package/bin/example.mjs +4 -2
- package/bin/onboard.mjs +562 -336
- package/bin/start.mjs +184 -36
- package/bin/update.mjs +26 -13
- package/build-info.json +2 -2
- package/docs/PORTAL.md +2 -2
- package/docs/architecture/02-architecture.md +3 -3
- package/docs/architecture/04-configuration-reference.md +1 -2
- package/docs/architecture/05-config-governance.md +1 -1
- package/docs/architecture/06-operations-runbook.md +1 -1
- package/driver/CHANGELOG.md +77 -0
- package/driver/README.md +2 -2
- package/driver/config-inventory.mjs +20 -11
- package/driver/contract-e3-backlog.mjs +27 -27
- package/driver/contract-e3-baseline.json +2 -2
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/degraded-parts.mjs +67 -3
- package/driver/dev-portal.mjs +1 -1
- package/driver/digest-queue.mjs +5 -5
- package/driver/driver.config.mjs +9 -9
- package/driver/engine/CONTRACT.md +1 -1
- package/driver/engine/anthropic-agent.mjs +4 -2
- package/driver/engine/mcp/band-server.mjs +1 -21
- package/driver/engine/mcp/clarivate-propose-tool.mjs +26 -0
- package/driver/engine/mcp/clarivate-server.mjs +2 -18
- package/driver/engine/mcp/fixture-register-server.mjs +33 -0
- package/driver/engine/mcp/gather-config.mjs +48 -7
- package/driver/engine/mcp/recording-server.mjs +206 -14
- package/driver/engine/mcp/supplemental.mjs +4 -2
- package/driver/engine/openai-agent.mjs +3 -1
- package/driver/engine/probe.mjs +10 -0
- package/driver/filing-goods.mjs +95 -0
- package/driver/findings-model.mjs +3 -0
- package/driver/gateway.mjs +42 -40
- package/driver/knockout-assess-record.mjs +54 -4
- package/driver/knockout-correction-record.mjs +342 -0
- package/driver/knockout-frame-record.mjs +4 -2
- package/driver/knockout-register-read.mjs +705 -0
- package/driver/knockout-register-record.mjs +222 -0
- package/driver/knockout-review-record.mjs +96 -25
- package/driver/narrative-refutation-record.mjs +87 -1
- package/driver/order-tables.mjs +23 -0
- package/driver/owner-use-check.mjs +5 -2
- package/driver/package.json +1 -1
- package/driver/partial-payload-baseline.json +8 -0
- package/driver/pipeline-knockout.mjs +506 -313
- package/driver/pipeline.mjs +179 -86
- package/driver/portal-local-auth.mjs +7 -1
- package/driver/portal-service.mjs +62 -6
- package/driver/progress.mjs +2 -2
- package/driver/publish/index.mjs +18 -21
- package/driver/publish/knockout.mjs +40 -18
- package/driver/publish/render-knockout.mjs +40 -27
- package/driver/publish/report-dates.mjs +43 -0
- package/driver/recall-reconciliation.mjs +2 -2
- package/driver/record-goods.mjs +50 -9
- package/driver/register-count.mjs +12 -59
- package/driver/register-fixture-marker.mjs +22 -0
- package/driver/register-plan.mjs +48 -0
- package/driver/register-records.mjs +84 -266
- package/driver/register-taint.mjs +2 -2
- package/driver/repair-composers.mjs +15 -8
- package/driver/result-noun-fields.mjs +6 -2
- package/driver/run-requirements.mjs +54 -4
- package/driver/runner.mjs +4 -13
- package/driver/skills/clearance-register/providers/clarivate.md +2 -2
- package/driver/skills/knockout-assess/SKILL.md +101 -100
- package/driver/skills/knockout-frame/SKILL.md +3 -1
- package/driver/skills/knockout-register-read/SKILL.md +77 -0
- package/driver/stages-knockout.mjs +159 -98
- package/driver/stages.mjs +4 -2
- package/driver/suite-census.json +389 -71
- package/driver/systemd/README.md +2 -2
- package/driver/verify-knockout.mjs +175 -39
- package/driver/verify.mjs +10 -9
- package/mcp-server/CHANGELOG.md +4 -0
- package/mcp-server/CONNECT.md +4 -0
- package/mcp-server/demo-mode.mjs +6 -0
- package/mcp-server/lib/demo-texts.mjs +38 -0
- package/mcp-server/lib/http-handler.mjs +7 -1
- package/mcp-server/lib/knockout.mjs +3 -2
- package/mcp-server/lib/options.mjs +3 -1
- package/mcp-server/lib/plan.mjs +6 -1
- package/mcp-server/mint-token.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/serve.mjs +11 -0
- package/mcp-server/server.mjs +13 -5
- package/package.json +1 -1
- package/portal-ui/dist/assets/{index-D2wrw9cH.css → index-AtB9ZpDH.css} +29 -0
- package/portal-ui/dist/assets/{index-DcLbvFmQ.js → index-C1oE78Wk.js} +161 -195
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +4 -4
- package/providers/README.md +4 -4
- package/providers/_shared/execute-plan.mjs +45 -1
- package/providers/_shared/term-shape.mjs +1 -1
- package/providers/clarivate/src/capabilities.js +7 -6
- package/providers/clarivate/src/core.js +11 -7
- package/providers/clarivate/src/wider-list.js +104 -0
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/capabilities.js +0 -9
- package/scripts/e2e-first-time.mjs +8 -7
- package/scripts/freeze-example-run.mjs +2 -2
- package/scripts/settings-render-check.mjs +5 -3
- package/scripts/test-run.mjs +8 -2
- package/shared/client-door.mjs +11 -8
- package/shared/connect-clients.mjs +10 -4
- package/shared/demo-connection.mjs +43 -0
- package/shared/demo-start-args.mjs +7 -2
- package/shared/invocation.mjs +18 -3
- package/shared/permanent-install.mjs +14 -0
- package/shared/scope.mjs +8 -1
- package/shared/stdio-connect.mjs +43 -21
- package/shared/trigger-lane.mjs +7 -0
- package/shared/tty-style.mjs +21 -5
package/bin/start.mjs
CHANGED
|
@@ -21,12 +21,14 @@
|
|
|
21
21
|
//
|
|
22
22
|
// ── ONE PROCESS OR SEVERAL? SEVERAL, AND THIS IS THE LIST ────────────────────────────────────────────
|
|
23
23
|
//
|
|
24
|
-
// This file is a SUPERVISOR. It starts
|
|
24
|
+
// This file is a SUPERVISOR. It starts four child processes and nothing else:
|
|
25
25
|
//
|
|
26
|
-
// driver/portal-service.mjs
|
|
27
|
-
// mcp-server/http-server.mjs
|
|
26
|
+
// driver/portal-service.mjs the product: the UI, the API, the sign-in, the config surface.
|
|
27
|
+
// mcp-server/http-server.mjs the engine door the portal's Start button calls over real MCP.
|
|
28
|
+
// mcp-server/http-server-client.mjs the client door an assistant connects to. Not fatal if it exits.
|
|
29
|
+
// driver/runner.mjs --watch the worker that runs what is ordered, unless --no-worker.
|
|
28
30
|
//
|
|
29
|
-
//
|
|
31
|
+
// MORE SERVICES WERE THE ALTERNATIVE, and the reason there are not is not taste. The portal
|
|
30
32
|
// ALREADY constructs profile-service and recipe-service in-process (portal-service.mjs — "profile-service
|
|
31
33
|
// is constructed IN-PROCESS rather than called over HTTP"), running the same routers, the same
|
|
32
34
|
// validators and the same git-commit path with the portal's own verified identity as the author. So two
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
// stays a separate process for the reason the hosted deployment keeps it one: it pulls the MCP
|
|
39
41
|
// Streamable-HTTP transport (undici) that nothing else in the portal needs.
|
|
40
42
|
//
|
|
41
|
-
// A CRASH IS REPORTED, NEVER ABSORBED. If
|
|
43
|
+
// A CRASH IS REPORTED, NEVER ABSORBED. If a fatal child exits while this command is running, that is
|
|
42
44
|
// named on stderr — which one, and with what code — and everything else is stopped. A supervisor that
|
|
43
45
|
// let one child die and left the other serving would turn a dead trigger lane into a red panel in the
|
|
44
46
|
// browser, which is the shape of failure this whole command exists to remove.
|
|
@@ -84,7 +86,7 @@ import { writeSecretFile } from "../shared/secret-file.mjs"; // one atomic wri
|
|
|
84
86
|
// below: to COMPOSE the units' environment and to GUARD it before this command reports success. The
|
|
85
87
|
// tables are handed in rather than imported by it, because the register table lives in a CLI entry and
|
|
86
88
|
// the driver must not point at `bin/`.
|
|
87
|
-
import { runRequiredNames, missingRequirements, CLOUD_ROUTES } from "../driver/run-requirements.mjs";
|
|
89
|
+
import { runRequiredNames, missingRequirements, whatIsMissing, CLOUD_ROUTES } from "../driver/run-requirements.mjs";
|
|
88
90
|
import { CLOUD_SWITCH, cloudsSwitchedOn } from "../driver/engine/auth.mjs"; // a switch compared the way the program reads it: on or off
|
|
89
91
|
import { ENGINE_BINARIES, DEFAULT_ENGINE_ID as RUN_DEFAULT_ENGINE, resolveEngineProgram } from "../driver/driver.config.mjs";
|
|
90
92
|
import { spawnsDetached, killWindowsTreesNow } from "../driver/engine/engine-spawn.mjs"; // Windows has no process group to stop
|
|
@@ -113,7 +115,8 @@ export async function runTables() {
|
|
|
113
115
|
}
|
|
114
116
|
import { spawn, spawnSync, execFileSync } from "node:child_process";
|
|
115
117
|
import { storeInRepo, storeOutsideRepoMessage, storeCommitRefusal, storeCommitEnv } from "../shared/store-in-repo.mjs"; //
|
|
116
|
-
import { stdioConnectOffer } from "../shared/stdio-connect.mjs";
|
|
118
|
+
import { stdioConnectOffer, WSL_ROW_HEADINGS } from "../shared/stdio-connect.mjs";
|
|
119
|
+
import { namingProgram } from "../driver/engine/probe.mjs"; // the bare `claude` rewritten to the copy setup installed
|
|
117
120
|
import { wslTarget } from "../shared/wsl.mjs"; // — and which distribution a row should start the server in
|
|
118
121
|
import { ensureDemoProgram } from "../shared/permanent-install.mjs"; // — a demo from npx keeps its own copy
|
|
119
122
|
import { mergeEnvFile } from "../shared/env-file-merge.mjs";
|
|
@@ -125,7 +128,7 @@ import { SERVER_INSTALL_SET, unitsToRestartOnRefresh, unitHealthVerdict } from "
|
|
|
125
128
|
import { defaultDenylistPath, denylistPathFor, denylistFor, ensureDenylistFile, CLIENT_DOOR_UNIT, enablePlan, clientDoorPort, demoTokenSecret, demoTokenSecretPath, keyIssueCommand, demoConnectCommand } from "../shared/client-door.mjs"; // — one owner for the revocation list's path
|
|
126
129
|
import { createServer } from "node:net";
|
|
127
130
|
import { listenErrorMessage, nextFreePort } from "../shared/listen.mjs";
|
|
128
|
-
import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
131
|
+
import { chmodSync, copyFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync, appendFileSync } from "node:fs";
|
|
129
132
|
import { randomBytes } from "node:crypto";
|
|
130
133
|
import { invocationPrefix, invoke, reachableCommand, foreignPageHint } from "../shared/invocation.mjs"; // — the banner names the verb
|
|
131
134
|
// RE-EXPORTED, NOT RE-DECLARED. The sentence moved to a module that imports nothing of ours, because
|
|
@@ -405,6 +408,45 @@ export function clientDoorDownLines({ host, port, exited }) {
|
|
|
405
408
|
];
|
|
406
409
|
}
|
|
407
410
|
|
|
411
|
+
/**
|
|
412
|
+
* THE LINES A HEALTHY DEMO'S SERVICES PRINT AS THEY COME UP, measured on a fresh demo (2026-11-06), each as its service tags it.
|
|
413
|
+
* Only these go to the startup file alone. A FILTER THAT LISTS WHAT TO SHOW WOULD HIDE A FAILURE IT DID NOT FORESEE: a door that
|
|
414
|
+
* cannot read its roster, or a sign-in that is unavailable, says so in a line with no FATAL or WARNING in it. So the list is of
|
|
415
|
+
* what may be filed, and every other line stays on the screen as well. A new routine line shows until it is added here; the
|
|
416
|
+
* fresh-demo test names it. ABOVE THE MAIN BLOCK, which reads them before any line below it has run.
|
|
417
|
+
*/
|
|
418
|
+
export const DEMO_ROUTINE_LINES = [
|
|
419
|
+
/^auth ON — /,
|
|
420
|
+
/^key path: none configured /,
|
|
421
|
+
/^roster: \d+ customer\(s\) from /,
|
|
422
|
+
/^This is `clearotron demo`: /,
|
|
423
|
+
/^listening on http:\/\//,
|
|
424
|
+
/^audit log: /,
|
|
425
|
+
/^trigger lane: the engine door takes an access key, and this portal holds one\.$/,
|
|
426
|
+
/^trigger lane: ops token sub=/,
|
|
427
|
+
/^settings surface ON — /,
|
|
428
|
+
/^saved searches ON — /,
|
|
429
|
+
/^brief reading OFF — this is the demo/,
|
|
430
|
+
/^local sign-in: no credential at /,
|
|
431
|
+
/^ {2}Its passphrase is in the box printed below;/,
|
|
432
|
+
/^API-KEY door — /,
|
|
433
|
+
/^client ACCOUNT access ON — /,
|
|
434
|
+
/^stopping — issued keys SURVIVE this stop/,
|
|
435
|
+
];
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Whether a demo service's line belongs on the screen as well as in the startup file. A line with no service tag (the rest of
|
|
439
|
+
* a refusal, a stack trace) or with an alarm in it always shows; a tagged routine line does not; a blank line does not. PURE.
|
|
440
|
+
*/
|
|
441
|
+
export const DEMO_ALARM = /⚠|\bWARN(?:ING)?\b|\bFATAL\b|\bERROR\b|\bMISSING\b/;
|
|
442
|
+
export function demoLineOnScreen(line) {
|
|
443
|
+
const s = String(line ?? "");
|
|
444
|
+
if (!s.trim()) return false;
|
|
445
|
+
if (DEMO_ALARM.test(s)) return true;
|
|
446
|
+
const tagged = /^\[[\w-]+\] (.*)$/.exec(s);
|
|
447
|
+
return !(tagged && DEMO_ROUTINE_LINES.some((re) => re.test(tagged[1])));
|
|
448
|
+
}
|
|
449
|
+
|
|
408
450
|
export function resolvePorts(env = {}) {
|
|
409
451
|
const one = (name, dflt) => {
|
|
410
452
|
const raw = String(env[name] ?? "").trim();
|
|
@@ -706,7 +748,7 @@ const unitTypeOf = (u) => {
|
|
|
706
748
|
// it has worked", which is the failure its own comment records being found by driving it twice.
|
|
707
749
|
//
|
|
708
750
|
// AND THEY MUST BE DISARMED, not merely unpinned. The worker drains continuously; leaving the timer
|
|
709
|
-
// armed puts a second claimant on the queue. The claim itself is atomic — `runner.mjs
|
|
751
|
+
// armed puts a second claimant on the queue. The claim itself is atomic — `claimAndPrep` in runner.mjs renames
|
|
710
752
|
// `<id>.json` to the lock path and only one racer wins — so this is not double-execution. What it does
|
|
711
753
|
// cost is the admission cap: counts are serial per queue while queues drain concurrently, so two
|
|
712
754
|
// claimers can overshoot a per-account cap by a bounded one per queue. A bounded overshoot is not a
|
|
@@ -1023,7 +1065,12 @@ if (isMain) {
|
|
|
1023
1065
|
// Declining the worker is a real posture, not a debug switch: someone who wants the old separation —
|
|
1024
1066
|
// order here, drain deliberately over there — keeps it with this flag, and the closing block tells them
|
|
1025
1067
|
// exactly how to drain when they do.
|
|
1026
|
-
|
|
1068
|
+
//
|
|
1069
|
+
// NOT IN A DEMO. A demo's orders resolve to reports it already has and never reach the queue, so a
|
|
1070
|
+
// worker there drains nothing the portal puts in it. What it would drain is a job an assistant queued
|
|
1071
|
+
// through the connect line this command prints, and it would run that job on whatever engine this
|
|
1072
|
+
// machine is signed in to: a real clearance, paid for, started from the demo.
|
|
1073
|
+
const wantWorker = !argv.includes("--no-worker") && !argv.includes("--demo");
|
|
1027
1074
|
const wantBackground = argv.includes("--background");
|
|
1028
1075
|
// ON WINDOWS THERE IS NO BACKGROUND FORM: it is systemd units. Answered here, before anything is written
|
|
1029
1076
|
// or systemctl is called, in the owner's sentence and nothing else, so no `start:` prefix either.
|
|
@@ -1386,12 +1433,12 @@ if (isMain) {
|
|
|
1386
1433
|
//
|
|
1387
1434
|
// Three conditions, and each is a different reason:
|
|
1388
1435
|
// · the address is genuinely taken — anything else is not this case;
|
|
1389
|
-
// · the reader did not state this port, so no one is addressed to it.
|
|
1390
|
-
// a stated address and is refused exactly as before;
|
|
1436
|
+
// · the reader did not state this port, so no one is addressed to it. A port set by its variable or
|
|
1437
|
+
// by `--port` is a stated address and is refused exactly as before;
|
|
1391
1438
|
// · nothing fronts these doors, so nothing outside resolves to the old number.
|
|
1392
1439
|
// With any of those false the refusal below fires unchanged, which is the whole of the previous
|
|
1393
1440
|
// behaviour kept intact underneath this.
|
|
1394
|
-
if (code === "EADDRINUSE" && key && !fronted.length && !String(process.env[portVar] ?? "").trim()) {
|
|
1441
|
+
if (code === "EADDRINUSE" && key && !fronted.length && !portFlag && !String(process.env[portVar] ?? "").trim()) {
|
|
1395
1442
|
const next = await nextFreePort(port, async (p) => (await probe(p)) === null, { claimed: claimedPorts });
|
|
1396
1443
|
// NULL IS NOT A FALLBACK. Nothing free in range means the reader is told the truth about the
|
|
1397
1444
|
// port they asked for, rather than sent to one this could not prove was free either.
|
|
@@ -1562,8 +1609,8 @@ if (isMain) {
|
|
|
1562
1609
|
// revocation list is a door that cannot be revoked from, and starting it anyway is the failure
|
|
1563
1610
|
// this whole finding is about — the run must not continue "successfully" into that state.
|
|
1564
1611
|
fatal(`could not use the revocation list at ${denylist} (${String(e?.message ?? e)}).\n`
|
|
1565
|
-
+ " The client door reads this file on every key check
|
|
1566
|
-
+ "
|
|
1612
|
+
+ " The client door reads this file on every key check. Without it, this install cannot check whether\n"
|
|
1613
|
+
+ " keys have been revoked, so it would refuse all of them.");
|
|
1567
1614
|
}
|
|
1568
1615
|
}
|
|
1569
1616
|
|
|
@@ -2234,6 +2281,15 @@ if (isMain) {
|
|
|
2234
2281
|
const children = [];
|
|
2235
2282
|
let stopping = false;
|
|
2236
2283
|
|
|
2284
|
+
// THE DEMO'S STARTUP FILE, in the demo's own folder, so removing the demo removes it. Every service line is written to it; the
|
|
2285
|
+
// screen keeps every line but a healthy start's routine ones (`demoLineOnScreen`), and a service that stops answering has its
|
|
2286
|
+
// last lines put on the screen before the sentence that points at them, so nothing that explains a failure stays only in the file.
|
|
2287
|
+
const DEMO_STARTUP_LOG = DEMO ? join(paths.base, "startup.log") : null;
|
|
2288
|
+
const fileDemoLine = (line) => {
|
|
2289
|
+
try { appendFileSync(DEMO_STARTUP_LOG, `${line}\n`); } catch { process.stderr.write(`${line}\n`); return; }
|
|
2290
|
+
if (demoLineOnScreen(line)) process.stderr.write(`${line}\n`);
|
|
2291
|
+
};
|
|
2292
|
+
const showFiledTail = (rec) => { if (DEMO) for (const line of rec.tail) process.stderr.write(`${line}\n`); };
|
|
2237
2293
|
const start = (name, script, env, { args = [], fatal = true, clientDoor = false } = {}) => {
|
|
2238
2294
|
const child = spawn(process.execPath, [join(REPO, script), ...args], {
|
|
2239
2295
|
cwd: REPO,
|
|
@@ -2254,7 +2310,10 @@ if (isMain) {
|
|
|
2254
2310
|
// stderr holds the whole of it — and leaving it alone keeps the child's terminal detection and any
|
|
2255
2311
|
// progress rendering intact. Piping a stream costs the child its TTY, so only the stream that has to
|
|
2256
2312
|
// be read is piped.
|
|
2257
|
-
|
|
2313
|
+
// A DEMO FILES ITS SERVICES' ROUTINE LINES (owner's words, 2026-11-06): its first screen is the progress, the sign-in, the
|
|
2314
|
+
// connect line and how to stop, and a reader met nineteen developer lines above the passphrase box. Both streams are read,
|
|
2315
|
+
// every line goes to the startup file, and any line but a healthy start's routine ones still reaches the screen.
|
|
2316
|
+
stdio: ["ignore", DEMO ? "pipe" : "inherit", "pipe"],
|
|
2258
2317
|
env: childProcessEnv(process.env, env),
|
|
2259
2318
|
});
|
|
2260
2319
|
// The last lines of that child's stderr, forwarded on as they arrive so nothing is delayed or
|
|
@@ -2269,12 +2328,22 @@ if (isMain) {
|
|
|
2269
2328
|
const keep = (line) => { if (line.trim()) tail.push(line); while (tail.length > 12) tail.shift(); };
|
|
2270
2329
|
child.stderr?.setEncoding("utf8");
|
|
2271
2330
|
child.stderr?.on("data", (chunk) => {
|
|
2272
|
-
process.stderr.write(chunk);
|
|
2331
|
+
if (!DEMO) process.stderr.write(chunk);
|
|
2273
2332
|
const parts = (pending + String(chunk)).split("\n");
|
|
2274
2333
|
pending = parts.pop() ?? "";
|
|
2275
|
-
for (const line of parts) keep(line);
|
|
2334
|
+
for (const line of parts) { keep(line); if (DEMO) fileDemoLine(line); }
|
|
2276
2335
|
});
|
|
2277
|
-
child.stderr?.on("end", () => { keep(pending); pending = ""; });
|
|
2336
|
+
child.stderr?.on("end", () => { keep(pending); if (DEMO && pending) fileDemoLine(pending); pending = ""; });
|
|
2337
|
+
if (DEMO) {
|
|
2338
|
+
let out = "";
|
|
2339
|
+
child.stdout?.setEncoding("utf8");
|
|
2340
|
+
child.stdout?.on("data", (chunk) => {
|
|
2341
|
+
const parts = (out + String(chunk)).split("\n");
|
|
2342
|
+
out = parts.pop() ?? "";
|
|
2343
|
+
for (const line of parts) fileDemoLine(line);
|
|
2344
|
+
});
|
|
2345
|
+
child.stdout?.on("end", () => { if (out) fileDemoLine(out); out = ""; });
|
|
2346
|
+
}
|
|
2278
2347
|
const rec = { name, script, child, alive: true, tail };
|
|
2279
2348
|
children.push(rec);
|
|
2280
2349
|
child.on("exit", (code, signal) => {
|
|
@@ -2332,7 +2401,7 @@ if (isMain) {
|
|
|
2332
2401
|
if (DEMO && !READER_BASE && !DEMO_KEEP) {
|
|
2333
2402
|
try {
|
|
2334
2403
|
rmSync(paths.base, { recursive: true, force: true });
|
|
2335
|
-
say(`\n The demo removed everything it created: ${paths.base} is gone
|
|
2404
|
+
say(`\n The demo removed everything it created: ${paths.base} is gone.`);
|
|
2336
2405
|
} catch (e) {
|
|
2337
2406
|
// A FAILED CLEANUP IS SAID, NOT SWALLOWED. The promise this prints is the one thing a reader
|
|
2338
2407
|
// cannot check for themselves once the window closes.
|
|
@@ -2346,6 +2415,10 @@ if (isMain) {
|
|
|
2346
2415
|
|
|
2347
2416
|
// Ctrl-C, and whatever a terminal or a parent supervisor sends. Both land on the same teardown, and
|
|
2348
2417
|
// the `stopping` flag is what stops an orderly stop being reported as a crash.
|
|
2418
|
+
// A THROW BELOW WOULD END THIS PROCESS WITH ITS DOORS STILL UP: each child is in its own process group, so
|
|
2419
|
+
// nothing else stops them. Everything that can go wrong from here goes through the same teardown.
|
|
2420
|
+
for (const event of ["uncaughtException", "unhandledRejection"])
|
|
2421
|
+
process.on(event, (e) => { err(`\nstart: ${String(e?.stack ?? e?.message ?? e)}\n`); void shutdown(1); });
|
|
2349
2422
|
process.on("SIGINT", () => { void shutdown(0); });
|
|
2350
2423
|
process.on("SIGTERM", () => { void shutdown(0); });
|
|
2351
2424
|
for (const sig of windowCloseSignals()) process.on(sig, () => { void shutdown(0); });
|
|
@@ -2360,11 +2433,16 @@ if (isMain) {
|
|
|
2360
2433
|
}
|
|
2361
2434
|
};
|
|
2362
2435
|
|
|
2436
|
+
if (DEMO) {
|
|
2437
|
+
// THIS START'S LINES ONLY: a folder the reader named keeps its file between demos, and the line below points at this one.
|
|
2438
|
+
try { writeFileSync(DEMO_STARTUP_LOG, ""); } catch { /* each line then shows on the screen instead */ }
|
|
2439
|
+
say(` Startup details are in \`${DEMO_STARTUP_LOG}\`.`);
|
|
2440
|
+
}
|
|
2363
2441
|
// The face first: the portal reads its trigger key's posture at boot and logs what the lane is capped
|
|
2364
2442
|
// to, so having the far end already listening keeps that line honest rather than optimistic.
|
|
2365
2443
|
const mcp = start("the engine door", "mcp-server/http-server.mjs", envs.mcp);
|
|
2366
2444
|
if (!await healthy(`http://${HOST}:${ports.mcp}/healthz`, mcp)) {
|
|
2367
|
-
if (mcp.alive) { err(`\nstart: the engine door did not answer on ${HOST}:${ports.mcp} within 30s — its output above says why.\n`); await shutdown(1); }
|
|
2445
|
+
if (mcp.alive) { showFiledTail(mcp); err(`\nstart: the engine door did not answer on ${HOST}:${ports.mcp} within 30s — its output above says why.\n`); await shutdown(1); }
|
|
2368
2446
|
await new Promise(() => {}); // its exit handler is already tearing down
|
|
2369
2447
|
}
|
|
2370
2448
|
|
|
@@ -2421,7 +2499,7 @@ if (isMain) {
|
|
|
2421
2499
|
const portal = start("the portal", "driver/portal-service.mjs",
|
|
2422
2500
|
mintedPassphrase ? { ...envs.portal, PORTAL_LOCAL_PASSPHRASE: mintedPassphrase } : envs.portal);
|
|
2423
2501
|
if (!await healthy(`http://${HOST}:${ports.portal}/portal/health`, portal)) {
|
|
2424
|
-
if (portal.alive) { err(`\nstart: the portal did not answer on ${HOST}:${ports.portal} within 30s — its output above says why.\n`); await shutdown(1); }
|
|
2502
|
+
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); }
|
|
2425
2503
|
await new Promise(() => {});
|
|
2426
2504
|
}
|
|
2427
2505
|
|
|
@@ -2515,7 +2593,7 @@ if (isMain) {
|
|
|
2515
2593
|
if (adoptedClientDoor)
|
|
2516
2594
|
say(` Already running as ${CLIENT_DOOR_UNIT}; this start kept it, so existing keys still work.`);
|
|
2517
2595
|
else
|
|
2518
|
-
say(` It refuses every caller until a key is issued: ${DEMO ? demoConnectCommand({ prefix: invocationPrefix(), base: paths.base }) : keyIssueCommand({ prefix: invocationPrefix(), demo: DEMO, user, base: paths.base, defaultBase: join(homedir(), "trademark") })}`);
|
|
2596
|
+
say(` It refuses every caller until a key is issued: ${DEMO ? demoConnectCommand({ prefix: invocationPrefix(), base: paths.base, where: "elsewhere" }) : keyIssueCommand({ prefix: invocationPrefix(), demo: DEMO, user, base: paths.base, defaultBase: join(homedir(), "trademark") })}`);
|
|
2519
2597
|
} else {
|
|
2520
2598
|
// A door that exited printed why; one still up when the wait ran out printed nothing, and is not sent there.
|
|
2521
2599
|
for (const line of clientDoorDownLines({ host: HOST, port: ports.client, exited: clientDoor?.child?.exitCode !== null })) say(line);
|
|
@@ -2596,13 +2674,20 @@ if (isMain) {
|
|
|
2596
2674
|
for (const line of laterStartLines({ user, reset, credentialPath: credentialNow, source: signIn?.source ?? "install", record })) say(line);
|
|
2597
2675
|
}
|
|
2598
2676
|
say("");
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2677
|
+
// A DEMO STARTS NOTHING, so it is not told that confirming commits money: it runs no worker, and the
|
|
2678
|
+
// portal resolves every order to a report it already has (driver/portal-service.mjs, `if (demo)`).
|
|
2679
|
+
if (DEMO) {
|
|
2680
|
+
say(" Ordering a clearance from the portal opens the finished example for that search: every search");
|
|
2681
|
+
say(" here resolves to a report that already exists. Nothing is started and nothing is charged.");
|
|
2682
|
+
} else if (worker) {
|
|
2683
|
+
// ASKED OF THE ENVIRONMENT THE WORKER WAS HANDED, by the runner's own order-time test: an order is refused
|
|
2684
|
+
// there until the install can search, and this line said an order starts a run whatever the install held.
|
|
2685
|
+
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);
|
|
2602
2687
|
} else {
|
|
2603
2688
|
say(" Ordering a clearance from the portal puts the job in the queue and shows it there with its");
|
|
2604
2689
|
say(" position. You started with --no-worker, so nothing is draining it: run");
|
|
2605
|
-
say("
|
|
2690
|
+
say(` ${invoke("run-queue")} --watch`);
|
|
2606
2691
|
say(" in another terminal when you want the queued work done.");
|
|
2607
2692
|
}
|
|
2608
2693
|
say("");
|
|
@@ -2623,22 +2708,20 @@ if (isMain) {
|
|
|
2623
2708
|
// install inside WSL can be reached from Windows and from inside the distribution, by two different
|
|
2624
2709
|
// commands; printing one of them unheaded is how a reader pastes the wrong one. The target is read
|
|
2625
2710
|
// here and passed, because this module is pure by design and reads no environment of its own.
|
|
2626
|
-
const
|
|
2711
|
+
const offered = stdioConnectOffer({ workDir: paths.workspace, reportsDir: paths.pool, wsl: wslTarget(), demo: DEMO, ...(demoProgramRoot ? { installRoot: demoProgramRoot } : {}) });
|
|
2712
|
+
const claudeProgram = resolveEngineProgram(claudeEngine());
|
|
2713
|
+
const connect = connectLinesNamingClaude(offered, claudeProgram);
|
|
2627
2714
|
// "one line" IS DELETED RATHER THAN MADE CONDITIONAL. Under WSL two lines are printed, one per side,
|
|
2628
2715
|
// and the count was never the point of the sentence — what it promises is no address and no sign-in,
|
|
2629
2716
|
// which is true on both sides and on every other install.
|
|
2630
2717
|
say(" Connect your assistant to this install — no address and no sign-in:");
|
|
2631
2718
|
say("");
|
|
2719
|
+
for (const line of connectPrerequisiteLines({ demo: DEMO, program: claudeProgram })) say(line);
|
|
2632
2720
|
// THE HEADINGS COME WITH THE PAIR, from the composer. Nothing is written here: the page prints these
|
|
2633
2721
|
// same two words above these same two commands, and a second author is how the two surfaces drift.
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
}
|
|
2637
|
-
say(` ${connect.command}`);
|
|
2638
|
-
say("");
|
|
2639
|
-
}
|
|
2640
|
-
say(` Check it: ${connect.verify}`);
|
|
2641
|
-
say("");
|
|
2722
|
+
for (const line of connectScreen(connect)) say(line);
|
|
2723
|
+
// The owner's words, 2026-11-06.
|
|
2724
|
+
if (DEMO) { say(` Another assistant? Run \`${demoConnectCommand({ prefix: invocationPrefix(), base: paths.base })}\` in a second terminal and pick it.`); say(""); }
|
|
2642
2725
|
// ── WHERE TO TYPE THE THINGS JUST PRINTED ( — F31) ───────────────────────
|
|
2643
2726
|
//
|
|
2644
2727
|
// This block prints commands and then HOLDS THE TERMINAL in the foreground, so not one of them can be
|
|
@@ -2688,6 +2771,71 @@ export function demoBaseIsTheReaders({ baseGiven = false, ownBase = false, base
|
|
|
2688
2771
|
return !(ownBase && base && demoDefault && base === demoDefault); // handed over, and it IS the default
|
|
2689
2772
|
}
|
|
2690
2773
|
|
|
2774
|
+
/**
|
|
2775
|
+
* The engine whose program is the `claude` the connect lines run. A function, not a constant: the command
|
|
2776
|
+
* body above runs while this module is still loading, before a constant declared down here exists.
|
|
2777
|
+
*/
|
|
2778
|
+
function claudeEngine() { return Object.keys(ENGINE_BINARIES).find((k) => ENGINE_BINARIES[k].fallback === "claude"); }
|
|
2779
|
+
|
|
2780
|
+
/**
|
|
2781
|
+
* The connect lines, naming the Claude program setup installed when that is the copy this machine runs.
|
|
2782
|
+
*
|
|
2783
|
+
* Setup installs Claude into its own engines folder, which is not on PATH, and the lines said `claude mcp
|
|
2784
|
+
* add …` and `claude mcp list`: a command the reader's shell does not have (measured on a published beta,
|
|
2785
|
+
* after setup had installed it). `namingProgram` is the rewrite setup's own sign-in line uses, and it
|
|
2786
|
+
* changes nothing for a copy on PATH. UNDER WSL ONLY THE ROW RUN INSIDE LINUX is rewritten: the Windows
|
|
2787
|
+
* row runs Windows' own `claude`. The check line is said per row there when the two differ (`verify` on each).
|
|
2788
|
+
* `program` is what resolveEngineProgram answers ({ source, resolved }). PURE.
|
|
2789
|
+
*/
|
|
2790
|
+
export function connectLinesNamingClaude(connect, program) {
|
|
2791
|
+
const spec = ENGINE_BINARIES[claudeEngine()];
|
|
2792
|
+
const name = (text) => namingProgram(text, spec, { source: program?.source ?? null, path: program?.resolved ?? null });
|
|
2793
|
+
if (connect.variants) return { ...connect,
|
|
2794
|
+
variants: connect.variants.map((v) => (v.heading === WSL_ROW_HEADINGS.insideWsl
|
|
2795
|
+
? { ...v, text: name(v.text), verify: name(connect.verify) } : { ...v, verify: connect.verify })) };
|
|
2796
|
+
return { ...connect, command: name(connect.command), verify: name(connect.verify) };
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
/**
|
|
2800
|
+
* What a demo says before its connect line when this machine has no Claude program. The line runs Claude Code,
|
|
2801
|
+
* and printed alone it failed as "claude: command not found" on a machine without it; the owner's words
|
|
2802
|
+
* (2026-11-06). A real install's setup offers the program, so it is not told this. `program` is what
|
|
2803
|
+
* resolveEngineProgram answers for Claude. PURE.
|
|
2804
|
+
*/
|
|
2805
|
+
export function connectPrerequisiteLines({ demo = false, program = null } = {}) {
|
|
2806
|
+
if (!demo || program?.resolved) return [];
|
|
2807
|
+
return fitTo(96, "This needs Claude Code, and this machine does not have it. Install Claude Code, then run the line below.")
|
|
2808
|
+
.map((l) => ` ${l}`);
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
/**
|
|
2812
|
+
* The lines under "Connect your assistant": each row, then the check line once, or under each row when the
|
|
2813
|
+
* rows' checks differ. PURE.
|
|
2814
|
+
*/
|
|
2815
|
+
export function connectScreen(connect) {
|
|
2816
|
+
const perRow = Boolean(connect.variants?.some((v) => v.verify && v.verify !== connect.verify));
|
|
2817
|
+
const rows = connect.variants
|
|
2818
|
+
? connect.variants.flatMap((v) => [` ${v.heading}`, ` ${v.text}`, ...(v.hint ? [` ${v.hint}`] : []),
|
|
2819
|
+
...(perRow ? [` Check it: ${v.verify}`] : []), ""])
|
|
2820
|
+
: [` ${connect.command}`, ""];
|
|
2821
|
+
return perRow ? rows : [...rows, ` Check it: ${connect.verify}`, ""];
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
/**
|
|
2825
|
+
* What a terminal start says about ordering when it runs a worker. `missing` is what the install lacks for a
|
|
2826
|
+
* 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.
|
|
2829
|
+
*/
|
|
2830
|
+
export function orderingLines({ missing = "", install = "clearotron install" } = {}) {
|
|
2831
|
+
if (!missing) {
|
|
2832
|
+
return [" Ordering a clearance from the portal starts it. The portal prices the run and asks you to",
|
|
2833
|
+
" confirm before anything is spent — that confirmation is the moment money is committed."];
|
|
2834
|
+
}
|
|
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}`);
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2691
2839
|
/**
|
|
2692
2840
|
* A sentence broken at spaces into lines of at most `width` characters, for the framed box. The withheld
|
|
2693
2841
|
* lines come from the portal's composer, written for a log line of any length; inside the frame they are
|
package/bin/update.mjs
CHANGED
|
@@ -60,7 +60,7 @@ import { isEntrypoint } from "../shared/is-entrypoint.mjs"; // — one entry-p
|
|
|
60
60
|
import { readEnvFile } from "./onboard.mjs";
|
|
61
61
|
import { invoke, invocationPrefix } from "../shared/invocation.mjs"; // — name a command the reader can actually type
|
|
62
62
|
import { rebuildIfStale } from "../shared/bundle-rebuild.mjs"; // a pull cannot update an untracked bundle
|
|
63
|
-
import { packagedUpdate } from "../shared/permanent-install.mjs"; // — a packaged install updates at its own prefix
|
|
63
|
+
import { packagedUpdate, packagedUpdateCommand } from "../shared/permanent-install.mjs"; // — a packaged install updates at its own prefix
|
|
64
64
|
import { installShim, inspectShim, shimPath } from "../shared/verb-shim.mjs"; // — npm's link replaces the launcher
|
|
65
65
|
|
|
66
66
|
const REPO = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
@@ -130,8 +130,9 @@ function atRisk(entries) {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
function reportRefusal(risky) {
|
|
134
|
-
|
|
133
|
+
export function reportRefusal(risky, { checkout = isGitCheckout() } = {}) {
|
|
134
|
+
const folder = checkout ? "the checkout" : "the install's own folder";
|
|
135
|
+
say(`\n UPDATE REFUSED — this install keeps its configuration inside ${folder}.\n`);
|
|
135
136
|
for (const e of risky) {
|
|
136
137
|
say(` ${e.name}=${e.value} (${e.from})`);
|
|
137
138
|
say(` ${e.what} live here, inside ${resolve(REPO)}.`);
|
|
@@ -151,8 +152,8 @@ function reportRefusal(risky) {
|
|
|
151
152
|
}
|
|
152
153
|
say("");
|
|
153
154
|
}
|
|
154
|
-
say(
|
|
155
|
-
say(
|
|
155
|
+
say(` Move them out of ${folder}, then update. Nothing here has been changed.\n`);
|
|
156
|
+
say(` For each variable above, choose a directory outside ${folder} and move its contents:`);
|
|
156
157
|
say("");
|
|
157
158
|
say(" mkdir -p <somewhere-outside>");
|
|
158
159
|
say(" mv <the-path-above> <somewhere-outside>/");
|
|
@@ -223,13 +224,23 @@ function runInCheckout(cmd, args) {
|
|
|
223
224
|
* The usage text, printed for --help. Kept next to the parser rather than derived from this file's
|
|
224
225
|
* header comment: the header is developer-facing, and the reader who types --help is not.
|
|
225
226
|
*/
|
|
227
|
+
export function updateUsage({ checkout = isGitCheckout(), P = invocationPrefix() } = {}) {
|
|
228
|
+
const head = [`\n ${P}clearotron update — bring this install up to date.\n`];
|
|
229
|
+
const help = ` ${P}clearotron update --help this text. Changes nothing.\n`;
|
|
230
|
+
if (checkout) return [...head,
|
|
231
|
+
` ${P}clearotron update pull, reinstall, and report what moved`, help,
|
|
232
|
+
" It runs `git pull --ff-only` then `npm ci`, and REFUSES before touching anything if this",
|
|
233
|
+
" install keeps its configuration store inside the checkout.\n"];
|
|
234
|
+
return [...head,
|
|
235
|
+
` ${P}clearotron update install the newest version`, help,
|
|
236
|
+
" On a package install on Linux or macOS it installs the newest stable, or for a beta install the",
|
|
237
|
+
" newest beta or stable, whichever is later; on Windows it names the npm command to run instead.",
|
|
238
|
+
" It refuses over a configuration store kept inside the install's own folder, and it refuses while",
|
|
239
|
+
" a run is queued or in flight.\n"];
|
|
240
|
+
}
|
|
241
|
+
|
|
226
242
|
function usage() {
|
|
227
|
-
const
|
|
228
|
-
say(`\n ${P}clearotron update — bring this install up to date.\n`);
|
|
229
|
-
say(` ${P}clearotron update pull, reinstall, and report what moved`);
|
|
230
|
-
say(` ${P}clearotron update --help this text. Changes nothing.\n`);
|
|
231
|
-
say(" It runs `git pull --ff-only` then `npm ci`, and REFUSES before touching anything if this");
|
|
232
|
-
say(" install keeps its configuration store inside the checkout.\n");
|
|
243
|
+
for (const line of updateUsage()) say(line);
|
|
233
244
|
}
|
|
234
245
|
|
|
235
246
|
/**
|
|
@@ -291,7 +302,7 @@ export async function update(argv = process.argv.slice(2)) {
|
|
|
291
302
|
console.error("\n This install is not a git checkout, so there is nothing to pull.");
|
|
292
303
|
console.error(" It was installed from a package rather than cloned, which is the ordinary way.");
|
|
293
304
|
console.error("\n Update it the way it was installed:\n");
|
|
294
|
-
console.error(
|
|
305
|
+
console.error(` ${packagedUpdateCommand()}\n`);
|
|
295
306
|
console.error(" Nothing was touched.");
|
|
296
307
|
return 4;
|
|
297
308
|
}
|
|
@@ -317,7 +328,9 @@ export async function update(argv = process.argv.slice(2)) {
|
|
|
317
328
|
for (const q of holds.queued) console.error(` queued ${q.id}`);
|
|
318
329
|
for (const c of holds.claimed) console.error(` claimed ${c.id} pid ${c.pid ?? "unknown"}`);
|
|
319
330
|
for (const sl of holds.slots) console.error(` slot ${sl.file} pid ${sl.pid}`);
|
|
320
|
-
console.error(
|
|
331
|
+
console.error(packaged
|
|
332
|
+
? "\n An update replaces the program's files under whatever is running. Nothing was touched."
|
|
333
|
+
: "\n `npm ci` rebuilds node_modules under whatever is running. Nothing was touched.");
|
|
321
334
|
console.error(" Wait for the queue to empty, or clear it, and run this again.\n");
|
|
322
335
|
return 4;
|
|
323
336
|
}
|
package/build-info.json
CHANGED
package/docs/PORTAL.md
CHANGED
|
@@ -100,9 +100,9 @@ and handed every caller the same synthetic address. **Both switches are deleted*
|
|
|
100
100
|
`PORTAL_DEV_EMAIL`. Local mode replaces them with a real sign-in.
|
|
101
101
|
|
|
102
102
|
**Use `clearotron start`.** It is the documented way to run this product on one machine
|
|
103
|
-
([INSTALL.md](../INSTALL.md) §
|
|
103
|
+
([INSTALL.md](../INSTALL.md) §5) and it assembles everything below for you: the portal, the MCP face the Start button
|
|
104
104
|
calls, a minted ops key, the grants file, the saved-search store and the data-plane paths — one command,
|
|
105
|
-
one URL, `Ctrl-C` stops
|
|
105
|
+
one URL, `Ctrl-C` stops everything it started. Nothing here needs an `*_AUTH_DISABLED` variable, and the
|
|
106
106
|
launcher sets the MCP face's pair to `0` so it cannot inherit one.
|
|
107
107
|
|
|
108
108
|
What that command starts, for anyone who needs to drive the portal on its own:
|
|
@@ -54,7 +54,7 @@ flowchart TB
|
|
|
54
54
|
PIPE["pipeline.mjs<br/>stage sequence · gates · clamps · recovery"]
|
|
55
55
|
STG["stages.mjs<br/>per-stage table: tier · timeout · output · validator · skills"]
|
|
56
56
|
GWM["gateway.mjs — runStage()<br/>retry ladder · file-truth gate · fail taxonomy"]
|
|
57
|
-
ENG["engine seam (CLEAROTRON_AI)<br/>anthropic-agent
|
|
57
|
+
ENG["engine seam (CLEAROTRON_AI)<br/>anthropic-agent | openai-agent"]
|
|
58
58
|
SKL["skills/ — stage methodology (doctrine)"]
|
|
59
59
|
PROF["profiles/ — per-company bundles"]
|
|
60
60
|
PUB["publish/ — report · audit workbook · pool"]
|
|
@@ -234,8 +234,8 @@ it, not one inherited dormant.
|
|
|
234
234
|
throws, so a run refuses at start rather than calling a vendor nobody chose. The clearance pipeline
|
|
235
235
|
consumes two provider verbs directly — `recordFetch` (screen-gate, senior-rights, citation-closure
|
|
236
236
|
code fetches) and `executePlan` (pure-code re-execution of dictated plan slices during fan-in and
|
|
237
|
-
reopen repairs); the knockout lane it dispatches into adds `countHits
|
|
238
|
-
verbs run with no model in the data path, and every shipped adapter implements all four. On top of
|
|
237
|
+
reopen repairs); the knockout lane it dispatches into adds `countHits`, and the house-mark check adds
|
|
238
|
+
`listRecords`, so four verbs run with no model in the data path, and every shipped adapter implements all four. On top of
|
|
239
239
|
those sit the gather tools the engine exposes to sweep stages. Adapter anatomy and the verification
|
|
240
240
|
checklist for a new register estate: [08](08-development-guide.md).
|
|
241
241
|
|
|
@@ -187,7 +187,7 @@ timeout shot, warm patch, backoff), the lane-wedge re-dispatch, and the rate-lim
|
|
|
187
187
|
|
|
188
188
|
| Setting | Values | Effect |
|
|
189
189
|
|---|---|---|
|
|
190
|
-
| `CLEAROTRON_AI` | `anthropic-agent`
|
|
190
|
+
| `CLEAROTRON_AI` | `anthropic-agent` \| `openai-agent` | Compute engine (a registered provider adapter). `anthropic-agent` = `claude -p`; `openai-agent` = `codex exec` (both off-gateway, same normalized contract). An **unregistered** value — a typo, or the gateway-runtime adapter removed in the extraction — **fails loud**: no silent wrong-provider run. Production default is unchanged. |
|
|
191
191
|
| `CLEAROTRON_AI_BILLING` | `subscription` (default) \| `api-key` \| `cloud` | Billing mode for the selected engine. ONE variable for both, and only the LIVE engine's setting is read — it fills each engine's billing knob, and the engine that is not selected is never consulted. **`anthropic-agent`:** subscription **deletes `ANTHROPIC_API_KEY` from the child env** so `claude -p` uses OAuth subscription credentials (a present key would override them); `api-key` keeps the key — the scale setting and standing fallback; **`cloud`** bills Claude per use through the reader's own cloud account, named by the Claude program's own switch — `CLAUDE_CODE_USE_VERTEX`, `CLAUDE_CODE_USE_FOUNDRY` or `CLAUDE_CODE_USE_BEDROCK`, or `ANTHROPIC_BASE_URL` alone for a gateway (see the credentials table below) — and deletes `ANTHROPIC_API_KEY` as subscription does. **`openai-agent`:** subscription seeds `auth.json` into the per-run `CODEX_HOME` from `CLEAROTRON_OPENAI_AUTH_FILE` (default `~/.codex/auth.json`) and strips API keys; `api-key` keeps `CODEX_API_KEY`; `cloud` is refused. **Fail-loud, never a guess, never the subscription in its place:** `api-key` with no `ANTHROPIC_API_KEY` / `CODEX_API_KEY` throws; on `anthropic-agent`, `cloud` with two switches on, or with none and no `ANTHROPIC_BASE_URL`, throws, and so does a switch left on under `subscription` or `api-key`, because the program bills that cloud whatever this says; a value that is none of the three throws on both engines. `clearotron start` and `clearotron doctor` report each refusal against the settings the services read, naming a value that is not a billing mode by its setting and never quoting it, and the runner refuses the search when it is ordered, before anything is spent. The resolved mode is stamped on every stage telemetry row (`engine`, `authMode`, `apiBilled`, and `cloud`, null when no cloud bills), and the attempt row also carries `providerReported`, the program's own word for who served the turn. |
|
|
192
192
|
| `CLEAROTRON_CLAUDE_PATH` · `CLEAROTRON_CODEX_PATH` | `claude` / `codex` on `PATH`, then the copy Clearotron installed | The engine binary to spawn, ONE PER ENGINE: `CLEAROTRON_CLAUDE_PATH` under `anthropic-agent`, `CLEAROTRON_CODEX_PATH` under `openai-agent`. Only the live engine's is read, and a machine that runs both sets both — they were one variable until it met a machine needing two different paths. A path set here must be **absolute**: stage subprocesses run with cwd set to the run directory, so a relative path does not resolve there, and `clearotron doctor` refuses one. **Unset**, or set to the bare word `claude` / `codex` (which means the same), the engine uses the program on `PATH` when the machine has one, and otherwise the copy Clearotron installed in `~/.local/share/clearotron/engines`: `clearotron install` offers to put the chosen engine's program there (`@anthropic-ai/claude-code` or `@openai/codex`, this platform's build only), and `clearotron update` refreshes it. Nothing is bundled into the package. A value naming anything else is used as given and never falls back. `clearotron doctor` says which copy it found, and its version when npm installed that copy. |
|
|
193
193
|
| `CLEAROTRON_OPENAI_AUTH_FILE` | `~/.codex/auth.json` | The credentials file seeded into the per-run `CODEX_HOME` under subscription billing. Was exempted from the August 2026 rename as an `openai-agent` internal rather than an install-surface name; a decision of 2026-09-04 **reversed that exemption** and renamed the whole namespace, so it carries the house prefix like everything else. One spelling, no exceptions. |
|
|
@@ -243,7 +243,6 @@ deployment may override (verify live values per deployment).
|
|
|
243
243
|
| `CLEAROTRON_STOP_GRACE_MS` | 60000 | Grace after first SIGTERM before exit(1). |
|
|
244
244
|
| `CLEAROTRON_MAX_CLAIM_AGE_MS` | 172800000 (48 h; 0 disables) | Hard ceiling on a claim's age (from the `.pid` sidecar mtime) — beyond it, re-claim regardless of liveness. |
|
|
245
245
|
| `CLEAROTRON_KNOCKOUT_VARIANT_CAP` | unset (⇒ the lane's own cap) | Ceiling on variants a knockout screens per name. Set only to bound an unusually wide batch; absent means the lane decides. |
|
|
246
|
-
| `CLEAROTRON_KNOCKOUT_RECORD_CAP` | unset (⇒ the lane's own cap) | Ceiling on records a knockout fetches per hit. Same shape as the variant cap: absent is the normal state. |
|
|
247
246
|
| `CLEAROTRON_SIGNA_ANSWER_MEMORY` | `off` | On the Signa register, whether a run reuses an answer it already holds instead of asking again. `off` asks every time. `watch` also asks every time, and records whether a held answer would have matched. `on` reuses held answers. |
|
|
248
247
|
| `CLEAROTRON_CLARIVATE_ANSWER_MEMORY` | `on` | On the Clarivate register, whether a run reuses a count, a search, an owner lookup or a record it already holds instead of asking again. `off` asks every time. |
|
|
249
248
|
|
|
@@ -158,7 +158,7 @@ structural, or dev seam); [dev] = dev/test seam, never set in prod.
|
|
|
158
158
|
|
|
159
159
|
### 5.2 Engine & models — T3
|
|
160
160
|
|
|
161
|
-
`CLEAROTRON_AI` (anthropic-agent | openai-agent
|
|
161
|
+
`CLEAROTRON_AI` (anthropic-agent | openai-agent), `CLEAROTRON_AI_BILLING`
|
|
162
162
|
(subscription|api-key|cloud; cloud is Claude only), `CLEAROTRON_CODEX_PATH`,
|
|
163
163
|
`CLEAROTRON_OPENAI_AUTH_FILE`, `CLEAROTRON_OPENAI_MODEL_JUDGMENT` / `CLEAROTRON_OPENAI_MODEL_SWEEP` /
|
|
164
164
|
`CLEAROTRON_OPENAI_MODEL_CHEAP` (gpt-6.1-sol / gpt-6.1-terra / gpt-6-luna),
|
|
@@ -272,7 +272,7 @@ Copy it, point `CLEAROTRON_ACCESS_FILE` at your copy, sign in as one of its addr
|
|
|
272
272
|
exactly that organisation's companies. Then delete it and write your own — it names nobody real, which also
|
|
273
273
|
means it grants nothing you have.
|
|
274
274
|
|
|
275
|
-
`clearotron start` (§
|
|
275
|
+
`clearotron start` (§5) writes an empty roster (`{"tenants": {}}`) into its state directory: your own staff
|
|
276
276
|
address is admitted, nobody else is enrolled, and enforcement is already on.
|
|
277
277
|
|
|
278
278
|
### Ops tokens — a credential for the verbs that spend
|