clearotron 0.5.0 → 0.5.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +2 -2
- package/INSTALL.md +351 -308
- 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 +647 -352
- package/bin/start.mjs +213 -66
- package/bin/update.mjs +26 -13
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +1 -1
- package/docs/PORTAL.md +2 -2
- package/docs/architecture/02-architecture.md +3 -3
- package/docs/architecture/04-configuration-reference.md +2 -3
- package/docs/architecture/05-config-governance.md +1 -1
- package/docs/architecture/06-operations-runbook.md +1 -1
- package/driver/CHANGELOG.md +91 -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/jx-turn.mjs +10 -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/how-it-runs.mjs +103 -0
- 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 +99 -9
- 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 +111 -37
- package/driver/runner.mjs +9 -16
- 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 +435 -81
- package/driver/systemd/README.md +2 -2
- package/driver/unit-environment.mjs +19 -0
- package/driver/verify-knockout.mjs +175 -39
- package/driver/verify.mjs +10 -9
- package/mcp-server/CHANGELOG.md +8 -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/lib/runs.mjs +7 -2
- 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-fPqAU0sx.js} +237 -231
- 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 +8 -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 +24 -0
- package/shared/scope.mjs +8 -1
- package/shared/server-units.mjs +37 -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,19 +115,20 @@ 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";
|
|
120
123
|
import { mcpOriginFor } from "../shared/lane-address.mjs"; // — one author for the origin
|
|
121
|
-
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
|
|
122
125
|
// — the door --background now INSTALLS, and the one authority for the settings
|
|
123
126
|
// it refuses to start without. (Until 2026-09-03 this import read "the one unit --background may
|
|
124
127
|
// tolerate and never manage"; settled point 2 superseded that.)
|
|
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
|
|
@@ -158,10 +161,8 @@ const REPO = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
|
158
161
|
const ENV_PATH = envLocalPath({ repoRoot: REPO }); // resolved, never composed: one resolver, so moving this file later is one line
|
|
159
162
|
/** Where `render-units.mjs --apply` installs, and therefore where "this box is a server" is visible. */
|
|
160
163
|
export const UNIT_DIR = join(homedir(), ".config", "systemd", "user");
|
|
161
|
-
/** The shipped units that make this box a server
|
|
162
|
-
export
|
|
163
|
-
"clearotron-portal.service", "clearotron-mcp-face.service", "prelim-driver.service",
|
|
164
|
-
]);
|
|
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 };
|
|
165
166
|
/**
|
|
166
167
|
* Which of the shipped units are installed on this box.
|
|
167
168
|
*
|
|
@@ -405,6 +406,45 @@ export function clientDoorDownLines({ host, port, exited }) {
|
|
|
405
406
|
];
|
|
406
407
|
}
|
|
407
408
|
|
|
409
|
+
/**
|
|
410
|
+
* 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.
|
|
411
|
+
* 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
|
|
412
|
+
* 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
|
|
413
|
+
* 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
|
|
414
|
+
* fresh-demo test names it. ABOVE THE MAIN BLOCK, which reads them before any line below it has run.
|
|
415
|
+
*/
|
|
416
|
+
export const DEMO_ROUTINE_LINES = [
|
|
417
|
+
/^auth ON — /,
|
|
418
|
+
/^key path: none configured /,
|
|
419
|
+
/^roster: \d+ customer\(s\) from /,
|
|
420
|
+
/^This is `clearotron demo`: /,
|
|
421
|
+
/^listening on http:\/\//,
|
|
422
|
+
/^audit log: /,
|
|
423
|
+
/^trigger lane: the engine door takes an access key, and this portal holds one\.$/,
|
|
424
|
+
/^trigger lane: ops token sub=/,
|
|
425
|
+
/^settings surface ON — /,
|
|
426
|
+
/^saved searches ON — /,
|
|
427
|
+
/^brief reading OFF — this is the demo/,
|
|
428
|
+
/^local sign-in: no credential at /,
|
|
429
|
+
/^ {2}Its passphrase is in the box printed below;/,
|
|
430
|
+
/^API-KEY door — /,
|
|
431
|
+
/^client ACCOUNT access ON — /,
|
|
432
|
+
/^stopping — issued keys SURVIVE this stop/,
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* 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
|
|
437
|
+
* 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.
|
|
438
|
+
*/
|
|
439
|
+
export const DEMO_ALARM = /⚠|\bWARN(?:ING)?\b|\bFATAL\b|\bERROR\b|\bMISSING\b/;
|
|
440
|
+
export function demoLineOnScreen(line) {
|
|
441
|
+
const s = String(line ?? "");
|
|
442
|
+
if (!s.trim()) return false;
|
|
443
|
+
if (DEMO_ALARM.test(s)) return true;
|
|
444
|
+
const tagged = /^\[[\w-]+\] (.*)$/.exec(s);
|
|
445
|
+
return !(tagged && DEMO_ROUTINE_LINES.some((re) => re.test(tagged[1])));
|
|
446
|
+
}
|
|
447
|
+
|
|
408
448
|
export function resolvePorts(env = {}) {
|
|
409
449
|
const one = (name, dflt) => {
|
|
410
450
|
const raw = String(env[name] ?? "").trim();
|
|
@@ -698,25 +738,9 @@ const unitTypeOf = (u) => {
|
|
|
698
738
|
return (readFileSync(join(REPO, "driver", "systemd", u), "utf8").match(/^Type=(\w+)/m)?.[1] ?? "simple").toLowerCase();
|
|
699
739
|
} catch { return "simple"; }
|
|
700
740
|
};
|
|
701
|
-
//
|
|
702
|
-
//
|
|
703
|
-
|
|
704
|
-
// stay MANAGED, or the carve below reads them as foreign, concludes the box is a real server, and the
|
|
705
|
-
// flag refuses on exactly the boxes it previously worked on — "making the flag unrunnable exactly once
|
|
706
|
-
// it has worked", which is the failure its own comment records being found by driving it twice.
|
|
707
|
-
//
|
|
708
|
-
// 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:714` renames
|
|
710
|
-
// `<id>.json` to the lock path and only one racer wins — so this is not double-execution. What it does
|
|
711
|
-
// cost is the admission cap: counts are serial per queue while queues drain concurrently, so two
|
|
712
|
-
// claimers can overshoot a per-account cap by a bounded one per queue. A bounded overshoot is not a
|
|
713
|
-
// reason to leave a retired unit running when disarming it is one call.
|
|
714
|
-
// EMPTY, AND KEPT RATHER THAN DELETED. The retired path-watcher/timer units it named are gone from the
|
|
715
|
-
// tree, so naming them here would describe files this repo does not ship — which is exactly what the
|
|
716
|
-
// "every retired unit is a unit this repo actually ships" check refuses. The export stays because the
|
|
717
|
-
// next retirement wants somewhere to go, and an empty list is a statement that nothing is currently
|
|
718
|
-
// retired-but-shipped.
|
|
719
|
-
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 };
|
|
720
744
|
|
|
721
745
|
export const BACKGROUND_EXCLUDED = Object.freeze({
|
|
722
746
|
// ── `clearotron-client-mcp.service` LEFT THIS TABLE ON 2026-09-03, AND SAYING SO IS THE POINT ────
|
|
@@ -1023,7 +1047,12 @@ if (isMain) {
|
|
|
1023
1047
|
// Declining the worker is a real posture, not a debug switch: someone who wants the old separation —
|
|
1024
1048
|
// order here, drain deliberately over there — keeps it with this flag, and the closing block tells them
|
|
1025
1049
|
// exactly how to drain when they do.
|
|
1026
|
-
|
|
1050
|
+
//
|
|
1051
|
+
// NOT IN A DEMO. A demo's orders resolve to reports it already has and never reach the queue, so a
|
|
1052
|
+
// worker there drains nothing the portal puts in it. What it would drain is a job an assistant queued
|
|
1053
|
+
// through the connect line this command prints, and it would run that job on whatever engine this
|
|
1054
|
+
// machine is signed in to: a real clearance, paid for, started from the demo.
|
|
1055
|
+
const wantWorker = !argv.includes("--no-worker") && !argv.includes("--demo");
|
|
1027
1056
|
const wantBackground = argv.includes("--background");
|
|
1028
1057
|
// ON WINDOWS THERE IS NO BACKGROUND FORM: it is systemd units. Answered here, before anything is written
|
|
1029
1058
|
// or systemctl is called, in the owner's sentence and nothing else, so no `start:` prefix either.
|
|
@@ -1068,10 +1097,10 @@ if (isMain) {
|
|
|
1068
1097
|
// reads the box as a server and refuses — making the flag unrunnable exactly once it has worked.
|
|
1069
1098
|
// The carve is narrow on purpose: every installed unit must be one this flag manages (or the client
|
|
1070
1099
|
// door `clearotron connect` manages). A box carrying anything else — the deploy timer, the outbox
|
|
1071
|
-
// lane — is a real server, and the refusal below is still the right answer for it.
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
const backgroundRefresh = wantBackground && installed
|
|
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);
|
|
1075
1104
|
if (installed.length && !backgroundRefresh)
|
|
1076
1105
|
fatal(`This box has the services installed — ${installed.join(", ")} in ${UNIT_DIR}.\n`
|
|
1077
1106
|
+ " Its configuration is those units' EnvironmentFile, not this checkout's .env, and they are\n"
|
|
@@ -1386,12 +1415,12 @@ if (isMain) {
|
|
|
1386
1415
|
//
|
|
1387
1416
|
// Three conditions, and each is a different reason:
|
|
1388
1417
|
// · 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;
|
|
1418
|
+
// · the reader did not state this port, so no one is addressed to it. A port set by its variable or
|
|
1419
|
+
// by `--port` is a stated address and is refused exactly as before;
|
|
1391
1420
|
// · nothing fronts these doors, so nothing outside resolves to the old number.
|
|
1392
1421
|
// With any of those false the refusal below fires unchanged, which is the whole of the previous
|
|
1393
1422
|
// behaviour kept intact underneath this.
|
|
1394
|
-
if (code === "EADDRINUSE" && key && !fronted.length && !String(process.env[portVar] ?? "").trim()) {
|
|
1423
|
+
if (code === "EADDRINUSE" && key && !fronted.length && !portFlag && !String(process.env[portVar] ?? "").trim()) {
|
|
1395
1424
|
const next = await nextFreePort(port, async (p) => (await probe(p)) === null, { claimed: claimedPorts });
|
|
1396
1425
|
// NULL IS NOT A FALLBACK. Nothing free in range means the reader is told the truth about the
|
|
1397
1426
|
// port they asked for, rather than sent to one this could not prove was free either.
|
|
@@ -1562,8 +1591,8 @@ if (isMain) {
|
|
|
1562
1591
|
// revocation list is a door that cannot be revoked from, and starting it anyway is the failure
|
|
1563
1592
|
// this whole finding is about — the run must not continue "successfully" into that state.
|
|
1564
1593
|
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
|
-
+ "
|
|
1594
|
+
+ " The client door reads this file on every key check. Without it, this install cannot check whether\n"
|
|
1595
|
+
+ " keys have been revoked, so it would refuse all of them.");
|
|
1567
1596
|
}
|
|
1568
1597
|
}
|
|
1569
1598
|
|
|
@@ -2234,6 +2263,15 @@ if (isMain) {
|
|
|
2234
2263
|
const children = [];
|
|
2235
2264
|
let stopping = false;
|
|
2236
2265
|
|
|
2266
|
+
// 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
|
|
2267
|
+
// screen keeps every line but a healthy start's routine ones (`demoLineOnScreen`), and a service that stops answering has its
|
|
2268
|
+
// last lines put on the screen before the sentence that points at them, so nothing that explains a failure stays only in the file.
|
|
2269
|
+
const DEMO_STARTUP_LOG = DEMO ? join(paths.base, "startup.log") : null;
|
|
2270
|
+
const fileDemoLine = (line) => {
|
|
2271
|
+
try { appendFileSync(DEMO_STARTUP_LOG, `${line}\n`); } catch { process.stderr.write(`${line}\n`); return; }
|
|
2272
|
+
if (demoLineOnScreen(line)) process.stderr.write(`${line}\n`);
|
|
2273
|
+
};
|
|
2274
|
+
const showFiledTail = (rec) => { if (DEMO) for (const line of rec.tail) process.stderr.write(`${line}\n`); };
|
|
2237
2275
|
const start = (name, script, env, { args = [], fatal = true, clientDoor = false } = {}) => {
|
|
2238
2276
|
const child = spawn(process.execPath, [join(REPO, script), ...args], {
|
|
2239
2277
|
cwd: REPO,
|
|
@@ -2254,7 +2292,10 @@ if (isMain) {
|
|
|
2254
2292
|
// stderr holds the whole of it — and leaving it alone keeps the child's terminal detection and any
|
|
2255
2293
|
// progress rendering intact. Piping a stream costs the child its TTY, so only the stream that has to
|
|
2256
2294
|
// be read is piped.
|
|
2257
|
-
|
|
2295
|
+
// A DEMO FILES ITS SERVICES' ROUTINE LINES (owner's words, 2026-11-06): its first screen is the progress, the sign-in, the
|
|
2296
|
+
// connect line and how to stop, and a reader met nineteen developer lines above the passphrase box. Both streams are read,
|
|
2297
|
+
// every line goes to the startup file, and any line but a healthy start's routine ones still reaches the screen.
|
|
2298
|
+
stdio: ["ignore", DEMO ? "pipe" : "inherit", "pipe"],
|
|
2258
2299
|
env: childProcessEnv(process.env, env),
|
|
2259
2300
|
});
|
|
2260
2301
|
// The last lines of that child's stderr, forwarded on as they arrive so nothing is delayed or
|
|
@@ -2269,12 +2310,22 @@ if (isMain) {
|
|
|
2269
2310
|
const keep = (line) => { if (line.trim()) tail.push(line); while (tail.length > 12) tail.shift(); };
|
|
2270
2311
|
child.stderr?.setEncoding("utf8");
|
|
2271
2312
|
child.stderr?.on("data", (chunk) => {
|
|
2272
|
-
process.stderr.write(chunk);
|
|
2313
|
+
if (!DEMO) process.stderr.write(chunk);
|
|
2273
2314
|
const parts = (pending + String(chunk)).split("\n");
|
|
2274
2315
|
pending = parts.pop() ?? "";
|
|
2275
|
-
for (const line of parts) keep(line);
|
|
2316
|
+
for (const line of parts) { keep(line); if (DEMO) fileDemoLine(line); }
|
|
2276
2317
|
});
|
|
2277
|
-
child.stderr?.on("end", () => { keep(pending); pending = ""; });
|
|
2318
|
+
child.stderr?.on("end", () => { keep(pending); if (DEMO && pending) fileDemoLine(pending); pending = ""; });
|
|
2319
|
+
if (DEMO) {
|
|
2320
|
+
let out = "";
|
|
2321
|
+
child.stdout?.setEncoding("utf8");
|
|
2322
|
+
child.stdout?.on("data", (chunk) => {
|
|
2323
|
+
const parts = (out + String(chunk)).split("\n");
|
|
2324
|
+
out = parts.pop() ?? "";
|
|
2325
|
+
for (const line of parts) fileDemoLine(line);
|
|
2326
|
+
});
|
|
2327
|
+
child.stdout?.on("end", () => { if (out) fileDemoLine(out); out = ""; });
|
|
2328
|
+
}
|
|
2278
2329
|
const rec = { name, script, child, alive: true, tail };
|
|
2279
2330
|
children.push(rec);
|
|
2280
2331
|
child.on("exit", (code, signal) => {
|
|
@@ -2332,7 +2383,7 @@ if (isMain) {
|
|
|
2332
2383
|
if (DEMO && !READER_BASE && !DEMO_KEEP) {
|
|
2333
2384
|
try {
|
|
2334
2385
|
rmSync(paths.base, { recursive: true, force: true });
|
|
2335
|
-
say(`\n The demo removed everything it created: ${paths.base} is gone
|
|
2386
|
+
say(`\n The demo removed everything it created: ${paths.base} is gone.`);
|
|
2336
2387
|
} catch (e) {
|
|
2337
2388
|
// A FAILED CLEANUP IS SAID, NOT SWALLOWED. The promise this prints is the one thing a reader
|
|
2338
2389
|
// cannot check for themselves once the window closes.
|
|
@@ -2346,6 +2397,10 @@ if (isMain) {
|
|
|
2346
2397
|
|
|
2347
2398
|
// Ctrl-C, and whatever a terminal or a parent supervisor sends. Both land on the same teardown, and
|
|
2348
2399
|
// the `stopping` flag is what stops an orderly stop being reported as a crash.
|
|
2400
|
+
// A THROW BELOW WOULD END THIS PROCESS WITH ITS DOORS STILL UP: each child is in its own process group, so
|
|
2401
|
+
// nothing else stops them. Everything that can go wrong from here goes through the same teardown.
|
|
2402
|
+
for (const event of ["uncaughtException", "unhandledRejection"])
|
|
2403
|
+
process.on(event, (e) => { err(`\nstart: ${String(e?.stack ?? e?.message ?? e)}\n`); void shutdown(1); });
|
|
2349
2404
|
process.on("SIGINT", () => { void shutdown(0); });
|
|
2350
2405
|
process.on("SIGTERM", () => { void shutdown(0); });
|
|
2351
2406
|
for (const sig of windowCloseSignals()) process.on(sig, () => { void shutdown(0); });
|
|
@@ -2360,11 +2415,16 @@ if (isMain) {
|
|
|
2360
2415
|
}
|
|
2361
2416
|
};
|
|
2362
2417
|
|
|
2418
|
+
if (DEMO) {
|
|
2419
|
+
// THIS START'S LINES ONLY: a folder the reader named keeps its file between demos, and the line below points at this one.
|
|
2420
|
+
try { writeFileSync(DEMO_STARTUP_LOG, ""); } catch { /* each line then shows on the screen instead */ }
|
|
2421
|
+
say(` Startup details are in \`${DEMO_STARTUP_LOG}\`.`);
|
|
2422
|
+
}
|
|
2363
2423
|
// The face first: the portal reads its trigger key's posture at boot and logs what the lane is capped
|
|
2364
2424
|
// to, so having the far end already listening keeps that line honest rather than optimistic.
|
|
2365
2425
|
const mcp = start("the engine door", "mcp-server/http-server.mjs", envs.mcp);
|
|
2366
2426
|
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); }
|
|
2427
|
+
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
2428
|
await new Promise(() => {}); // its exit handler is already tearing down
|
|
2369
2429
|
}
|
|
2370
2430
|
|
|
@@ -2418,10 +2478,13 @@ if (isMain) {
|
|
|
2418
2478
|
// Structurally excluded rather than filtered: the union cannot carry a key the object never had.
|
|
2419
2479
|
const mintedPassphrase = credentialExisted ? null : newPassphrase();
|
|
2420
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.
|
|
2421
2483
|
const portal = start("the portal", "driver/portal-service.mjs",
|
|
2422
|
-
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()}`] : [] });
|
|
2423
2486
|
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); }
|
|
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); }
|
|
2425
2488
|
await new Promise(() => {});
|
|
2426
2489
|
}
|
|
2427
2490
|
|
|
@@ -2484,10 +2547,14 @@ if (isMain) {
|
|
|
2484
2547
|
const clientDoorAnswered = clientDoor ? await healthy(`http://${HOST}:${ports.client}/healthz`, clientDoor) : false;
|
|
2485
2548
|
|
|
2486
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.
|
|
2487
2554
|
|
|
2488
2555
|
say("");
|
|
2489
2556
|
say(` Open ${envs.url}`);
|
|
2490
|
-
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}`);
|
|
2491
2558
|
say("");
|
|
2492
2559
|
// ── TWO DOORS, TWO AUDIENCES, BOTH NAMED ( — F26) ─────────────────────────
|
|
2493
2560
|
//
|
|
@@ -2515,7 +2582,7 @@ if (isMain) {
|
|
|
2515
2582
|
if (adoptedClientDoor)
|
|
2516
2583
|
say(` Already running as ${CLIENT_DOOR_UNIT}; this start kept it, so existing keys still work.`);
|
|
2517
2584
|
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") })}`);
|
|
2585
|
+
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
2586
|
} else {
|
|
2520
2587
|
// A door that exited printed why; one still up when the wait ran out printed nothing, and is not sent there.
|
|
2521
2588
|
for (const line of clientDoorDownLines({ host: HOST, port: ports.client, exited: clientDoor?.child?.exitCode !== null })) say(line);
|
|
@@ -2531,7 +2598,9 @@ if (isMain) {
|
|
|
2531
2598
|
try {
|
|
2532
2599
|
const forget = recordRunning({ pid: process.pid, demo: DEMO, base: paths.base, url: envs.url, host: HOST,
|
|
2533
2600
|
ports: { portal: ports.portal, mcp: ports.mcp, client: doorRunning ? ports.client : null },
|
|
2534
|
-
|
|
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() });
|
|
2535
2604
|
process.on("exit", forget);
|
|
2536
2605
|
} catch (e) {
|
|
2537
2606
|
say(` (\`status\` will not see this start: its record could not be written — ${String(e?.message ?? e)})`);
|
|
@@ -2596,13 +2665,20 @@ if (isMain) {
|
|
|
2596
2665
|
for (const line of laterStartLines({ user, reset, credentialPath: credentialNow, source: signIn?.source ?? "install", record })) say(line);
|
|
2597
2666
|
}
|
|
2598
2667
|
say("");
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2668
|
+
// A DEMO STARTS NOTHING, so it is not told that confirming commits money: it runs no worker, and the
|
|
2669
|
+
// portal resolves every order to a report it already has (driver/portal-service.mjs, `if (demo)`).
|
|
2670
|
+
if (DEMO) {
|
|
2671
|
+
say(" Ordering a clearance from the portal opens the finished example for that search: every search");
|
|
2672
|
+
say(" here resolves to a report that already exists. Nothing is started and nothing is charged.");
|
|
2673
|
+
} else if (worker) {
|
|
2674
|
+
// ASKED OF THE ENVIRONMENT THE WORKER WAS HANDED, by the runner's own order-time test: an order is refused
|
|
2675
|
+
// there until the install can search, and this line said an order starts a run whatever the install held.
|
|
2676
|
+
const cannot = missingRequirements(childProcessEnv(process.env, envs.worker), await runTables()).atOrder;
|
|
2677
|
+
for (const line of orderingLines({ missing: whatIsMissing(cannot), install: invoke("install"), doctor: invoke("doctor"), file: envFileRead() })) say(line);
|
|
2602
2678
|
} else {
|
|
2603
2679
|
say(" Ordering a clearance from the portal puts the job in the queue and shows it there with its");
|
|
2604
2680
|
say(" position. You started with --no-worker, so nothing is draining it: run");
|
|
2605
|
-
say("
|
|
2681
|
+
say(` ${invoke("run-queue")} --watch`);
|
|
2606
2682
|
say(" in another terminal when you want the queued work done.");
|
|
2607
2683
|
}
|
|
2608
2684
|
say("");
|
|
@@ -2623,22 +2699,20 @@ if (isMain) {
|
|
|
2623
2699
|
// install inside WSL can be reached from Windows and from inside the distribution, by two different
|
|
2624
2700
|
// commands; printing one of them unheaded is how a reader pastes the wrong one. The target is read
|
|
2625
2701
|
// here and passed, because this module is pure by design and reads no environment of its own.
|
|
2626
|
-
const
|
|
2702
|
+
const offered = stdioConnectOffer({ workDir: paths.workspace, reportsDir: paths.pool, wsl: wslTarget(), demo: DEMO, ...(demoProgramRoot ? { installRoot: demoProgramRoot } : {}) });
|
|
2703
|
+
const claudeProgram = resolveEngineProgram(claudeEngine());
|
|
2704
|
+
const connect = connectLinesNamingClaude(offered, claudeProgram);
|
|
2627
2705
|
// "one line" IS DELETED RATHER THAN MADE CONDITIONAL. Under WSL two lines are printed, one per side,
|
|
2628
2706
|
// and the count was never the point of the sentence — what it promises is no address and no sign-in,
|
|
2629
2707
|
// which is true on both sides and on every other install.
|
|
2630
2708
|
say(" Connect your assistant to this install — no address and no sign-in:");
|
|
2631
2709
|
say("");
|
|
2710
|
+
for (const line of connectPrerequisiteLines({ demo: DEMO, program: claudeProgram })) say(line);
|
|
2632
2711
|
// THE HEADINGS COME WITH THE PAIR, from the composer. Nothing is written here: the page prints these
|
|
2633
2712
|
// 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("");
|
|
2713
|
+
for (const line of connectScreen(connect)) say(line);
|
|
2714
|
+
// The owner's words, 2026-11-06.
|
|
2715
|
+
if (DEMO) { say(` Another assistant? Run \`${demoConnectCommand({ prefix: invocationPrefix(), base: paths.base })}\` in a second terminal and pick it.`); say(""); }
|
|
2642
2716
|
// ── WHERE TO TYPE THE THINGS JUST PRINTED ( — F31) ───────────────────────
|
|
2643
2717
|
//
|
|
2644
2718
|
// This block prints commands and then HOLDS THE TERMINAL in the foreground, so not one of them can be
|
|
@@ -2688,6 +2762,79 @@ export function demoBaseIsTheReaders({ baseGiven = false, ownBase = false, base
|
|
|
2688
2762
|
return !(ownBase && base && demoDefault && base === demoDefault); // handed over, and it IS the default
|
|
2689
2763
|
}
|
|
2690
2764
|
|
|
2765
|
+
/**
|
|
2766
|
+
* The engine whose program is the `claude` the connect lines run. A function, not a constant: the command
|
|
2767
|
+
* body above runs while this module is still loading, before a constant declared down here exists.
|
|
2768
|
+
*/
|
|
2769
|
+
function claudeEngine() { return Object.keys(ENGINE_BINARIES).find((k) => ENGINE_BINARIES[k].fallback === "claude"); }
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* The connect lines, naming the Claude program setup installed when that is the copy this machine runs.
|
|
2773
|
+
*
|
|
2774
|
+
* Setup installs Claude into its own engines folder, which is not on PATH, and the lines said `claude mcp
|
|
2775
|
+
* add …` and `claude mcp list`: a command the reader's shell does not have (measured on a published beta,
|
|
2776
|
+
* after setup had installed it). `namingProgram` is the rewrite setup's own sign-in line uses, and it
|
|
2777
|
+
* changes nothing for a copy on PATH. UNDER WSL ONLY THE ROW RUN INSIDE LINUX is rewritten: the Windows
|
|
2778
|
+
* row runs Windows' own `claude`. The check line is said per row there when the two differ (`verify` on each).
|
|
2779
|
+
* `program` is what resolveEngineProgram answers ({ source, resolved }). PURE.
|
|
2780
|
+
*/
|
|
2781
|
+
export function connectLinesNamingClaude(connect, program) {
|
|
2782
|
+
const spec = ENGINE_BINARIES[claudeEngine()];
|
|
2783
|
+
const name = (text) => namingProgram(text, spec, { source: program?.source ?? null, path: program?.resolved ?? null });
|
|
2784
|
+
if (connect.variants) return { ...connect,
|
|
2785
|
+
variants: connect.variants.map((v) => (v.heading === WSL_ROW_HEADINGS.insideWsl
|
|
2786
|
+
? { ...v, text: name(v.text), verify: name(connect.verify) } : { ...v, verify: connect.verify })) };
|
|
2787
|
+
return { ...connect, command: name(connect.command), verify: name(connect.verify) };
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
/**
|
|
2791
|
+
* What a demo says before its connect line when this machine has no Claude program. The line runs Claude Code,
|
|
2792
|
+
* and printed alone it failed as "claude: command not found" on a machine without it; the owner's words
|
|
2793
|
+
* (2026-11-06). A real install's setup offers the program, so it is not told this. `program` is what
|
|
2794
|
+
* resolveEngineProgram answers for Claude. PURE.
|
|
2795
|
+
*/
|
|
2796
|
+
export function connectPrerequisiteLines({ demo = false, program = null } = {}) {
|
|
2797
|
+
if (!demo || program?.resolved) return [];
|
|
2798
|
+
return fitTo(96, "This needs Claude Code, and this machine does not have it. Install Claude Code, then run the line below.")
|
|
2799
|
+
.map((l) => ` ${l}`);
|
|
2800
|
+
}
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* The lines under "Connect your assistant": each row, then the check line once, or under each row when the
|
|
2804
|
+
* rows' checks differ. PURE.
|
|
2805
|
+
*/
|
|
2806
|
+
export function connectScreen(connect) {
|
|
2807
|
+
const perRow = Boolean(connect.variants?.some((v) => v.verify && v.verify !== connect.verify));
|
|
2808
|
+
const rows = connect.variants
|
|
2809
|
+
? connect.variants.flatMap((v) => [` ${v.heading}`, ` ${v.text}`, ...(v.hint ? [` ${v.hint}`] : []),
|
|
2810
|
+
...(perRow ? [` Check it: ${v.verify}`] : []), ""])
|
|
2811
|
+
: [` ${connect.command}`, ""];
|
|
2812
|
+
return perRow ? rows : [...rows, ` Check it: ${connect.verify}`, ""];
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
/**
|
|
2816
|
+
* What a terminal start says about ordering when it runs a worker. `missing` is what the install lacks for a
|
|
2817
|
+
* search, in the phrases the portal uses (whatIsMissing), or "" when it lacks nothing. An install that cannot
|
|
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.
|
|
2825
|
+
*/
|
|
2826
|
+
export function orderingLines({ missing = "", install = "clearotron install", doctor = "clearotron doctor", file = null } = {}) {
|
|
2827
|
+
if (!missing) {
|
|
2828
|
+
return [" Ordering a clearance from the portal starts it. The portal prices the run and asks you to",
|
|
2829
|
+
" confirm before anything is spent — that confirmation is the moment money is committed."];
|
|
2830
|
+
}
|
|
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}`);
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2691
2838
|
/**
|
|
2692
2839
|
* A sentence broken at spaces into lines of at most `width` characters, for the framed box. The withheld
|
|
2693
2840
|
* 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/CLIENT-MCP.md
CHANGED
|
@@ -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
|
|
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
|
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
|
|