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/QUICKSTART.md
CHANGED
|
@@ -12,7 +12,11 @@ of its own and calls nothing on your behalf.
|
|
|
12
12
|
|---|---|---|
|
|
13
13
|
| A reasoning program | Every stage runs as a headless turn of it | [Claude Code](https://claude.com/claude-code) (`claude`) or the Codex CLI (`codex`). Setup installs it if the machine has none. Sign in with the program setup installed (doctor prints its path), or with `claude` or `codex login` if the machine has its own |
|
|
14
14
|
| A register | Sets what the search reaches, and what it costs | [Signa](https://signa.so) — one key, self-serve, US + EU + WIPO and ten more offices |
|
|
15
|
-
| Web research | Covers the open web and the marketplaces | [Perplexity](https://www.perplexity.ai) |
|
|
15
|
+
| Web research | Covers the open web and the marketplaces. The three clearance searches need it; a Knockout search runs without it | [Perplexity](https://www.perplexity.ai) |
|
|
16
|
+
|
|
17
|
+
Only the native-language investigation of China, Hong Kong, Taiwan or Macau uses a fourth,
|
|
18
|
+
[SerpAPI](https://serpapi.com): it searches the Chinese marketplaces through Baidu. Without its key,
|
|
19
|
+
`SERPAPI_API_KEY`, those marketplaces come back as a disclosed gap.
|
|
16
20
|
|
|
17
21
|
The register is the one with a real choice in it. EUIPO and a local USPTO index cost nothing and
|
|
18
22
|
reach one office each; Signa is the recommended paid route and the fastest to a real clearance.
|
|
@@ -36,6 +40,9 @@ clearotron doctor --probe-engine
|
|
|
36
40
|
`clearotron` it installed. If `~/.local/bin` is not on your `PATH` yet, type `~/.local/bin/clearotron`. Installing with npm's own global form
|
|
37
41
|
instead is covered in [INSTALL.md](INSTALL.md) §2.
|
|
38
42
|
|
|
43
|
+
That installs the stable release. For the newest beta, run `npx clearotron@beta install` instead;
|
|
44
|
+
[docs/RELEASES.md](docs/RELEASES.md) says what each one promises.
|
|
45
|
+
|
|
39
46
|
`doctor` is the one to read. It checks that the reasoning program is there, on `PATH` or as the copy
|
|
40
47
|
setup installed; that it is signed in, by running a turn rather than by finding the executable; and
|
|
41
48
|
that your register credential resolves. An executable that is signed out passes every other check and
|
|
@@ -66,13 +73,14 @@ prove the install works. Delete that line and the territories decide instead —
|
|
|
66
73
|
you a full country search, the deepest of the four, with case law on. Narrowing the scope orders
|
|
67
74
|
**more** work, not less.
|
|
68
75
|
|
|
69
|
-
**
|
|
76
|
+
**Clearotron quotes 5 to 10 minutes for a knockout search, and 1.5 to 2.5 hours for the other three.** Every finished
|
|
70
77
|
stage stays on disk, so a run survives interruption and a resume re-runs only what is missing.
|
|
71
78
|
|
|
72
79
|
## Then
|
|
73
80
|
|
|
74
81
|
- See it before you buy anything: `npx clearotron demo` replays a finished clearance with no account, no
|
|
75
|
-
key and no network.
|
|
76
|
-
-
|
|
82
|
+
key and no network. `npx clearotron@beta demo` replays the beta's.
|
|
83
|
+
- What the four searches are, and what each promises:
|
|
84
|
+
[docs/architecture/01-product-overview.md](docs/architecture/01-product-overview.md#what-it-does).
|
|
77
85
|
- Everything else — configuration, the config store, the portal, access control:
|
|
78
86
|
[INSTALL.md](INSTALL.md).
|
package/README.md
CHANGED
|
@@ -28,15 +28,17 @@ machine: no gateway, no platform, and nothing about the names you are clearing r
|
|
|
28
28
|
npx clearotron demo
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
That fetches the published package —
|
|
31
|
+
That fetches the published package — npx asks before it downloads it — then replays finished
|
|
32
32
|
clearances into a local portal and prints the portal's address and the passphrase to sign in with. Open
|
|
33
|
-
the address in your browser. No sign-up, no credentials, no network calls to us.
|
|
33
|
+
the address in your browser. No sign-up, no credentials, no network calls to us. The demo opens three
|
|
34
|
+
ports, 18860, 18861 and 18862; `npx clearotron demo --port <n>` opens n, n+1 and n+2 instead.
|
|
34
35
|
|
|
35
36
|
The demo runs for as long as that window stays open, and removes everything it made when you close it —
|
|
36
|
-
|
|
37
|
-
sample reports after closing the window, run `npx clearotron demo --keep`; it prints the
|
|
38
|
-
that removes the folder when you are done with it. `npx clearotron demo --once` publishes the
|
|
39
|
-
exits, and keeps the folder the same way.
|
|
37
|
+
only npm's own copy of the package stays, in its cache, and running it again later starts clean. If you
|
|
38
|
+
want to keep the sample reports after closing the window, run `npx clearotron demo --keep`; it prints the
|
|
39
|
+
one command that removes the folder when you are done with it. `npx clearotron demo --once` publishes the
|
|
40
|
+
reports and exits, and keeps the folder the same way. A demo started over a folder either of those left
|
|
41
|
+
keeps it too, and says how to remove it.
|
|
40
42
|
|
|
41
43
|
**Then install it.**
|
|
42
44
|
|
|
@@ -63,6 +65,9 @@ something worth testing:
|
|
|
63
65
|
npx clearotron@beta install
|
|
64
66
|
```
|
|
65
67
|
|
|
68
|
+
The same form shows the beta's demo, `npx clearotron@beta demo`; plain `npx clearotron demo` shows the
|
|
69
|
+
stable's.
|
|
70
|
+
|
|
66
71
|
What each channel promises, and when a stable is cut: [docs/RELEASES.md](docs/RELEASES.md). If you are not
|
|
67
72
|
sure, the first command is the one you want.
|
|
68
73
|
|
|
@@ -110,7 +115,7 @@ clearotron run --job my-job.json
|
|
|
110
115
|
|
|
111
116
|
- **A reasoning CLI does the thinking.** Every stage runs as a headless turn of the [Claude CLI](https://claude.com/claude-code) (`claude`) or the Codex CLI (`codex`); setup installs it if the machine has none. `CLEAROTRON_AI_BILLING` chooses what pays: your signed-in subscription, an API key, or your own Google, Microsoft or Amazon cloud account. Whichever pays, the CLI is what runs — there is no path that calls the model directly.
|
|
112
117
|
- **One register credential sets coverage and cost.** `CLEAROTRON_DATABASE` has no default — a run refuses rather than picking a vendor for you. EUIPO and a local USPTO index cost nothing; Clarivate, Signa and Corsearch are subscriptions. [The six, and what each reaches](providers/README.md).
|
|
113
|
-
- **One research key.** `PERPLEXITY_API_KEY` covers the open web and the marketplaces.
|
|
118
|
+
- **One research key, and one more for Chinese marketplaces.** `PERPLEXITY_API_KEY` covers the open web and the marketplaces. The three clearance searches refuse without it at the door, before a register stage has spent. A Knockout search runs without it and states on the report that the open-web half did not run. Only the native-language investigation of China, Hong Kong, Taiwan or Macau uses `SERPAPI_API_KEY`: it searches the Chinese marketplaces through Baidu. Without it, those marketplaces come back as a disclosed gap.
|
|
114
119
|
- **A run takes hours, and survives interruption.** Every finished stage stays on disk; a resume re-runs only what is missing, and a run parked on a provider cap continues by itself.
|
|
115
120
|
- **A finished run is queryable.** An MCP server lets Claude, ChatGPT or your editor read and question
|
|
116
121
|
any completed run in plain language: a trusted local **stdio** face, and an authenticated
|
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -173,7 +173,7 @@ will be liable to anyone for any damages related to this
|
|
|
173
173
|
software or this license, under any kind of legal claim.***
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
## @modelcontextprotocol/sdk@1.32.
|
|
176
|
+
## @modelcontextprotocol/sdk@1.32.2
|
|
177
177
|
|
|
178
178
|
- **Licence declared:** `MIT`
|
|
179
179
|
- **Repository:** https://github.com/modelcontextprotocol/typescript-sdk
|
|
@@ -2781,7 +2781,7 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
|
2781
2781
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
2782
2782
|
```
|
|
2783
2783
|
|
|
2784
|
-
## jose@6.2.
|
|
2784
|
+
## jose@6.2.14
|
|
2785
2785
|
|
|
2786
2786
|
- **Licence declared:** `MIT`
|
|
2787
2787
|
- **Repository:** panva/jose
|
|
@@ -5085,7 +5085,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
5085
5085
|
THE SOFTWARE.
|
|
5086
5086
|
```
|
|
5087
5087
|
|
|
5088
|
-
## react@19.3.
|
|
5088
|
+
## react@19.3.1
|
|
5089
5089
|
|
|
5090
5090
|
- **Licence declared:** `MIT`
|
|
5091
5091
|
- **Repository:** https://github.com/react/react
|
|
@@ -5115,7 +5115,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
5115
5115
|
SOFTWARE.
|
|
5116
5116
|
```
|
|
5117
5117
|
|
|
5118
|
-
## react-dom@19.3.
|
|
5118
|
+
## react-dom@19.3.1
|
|
5119
5119
|
|
|
5120
5120
|
- **Licence declared:** `MIT`
|
|
5121
5121
|
- **Repository:** https://github.com/react/react
|
package/bin/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# bin/
|
|
2
2
|
|
|
3
|
-
The five commands that take an install from
|
|
3
|
+
The five commands that take an install from nothing to a running product. They are not the only
|
|
4
4
|
runnable files in the tree — `driver/runner.mjs` drains the queue, and `scripts/` holds the guards and
|
|
5
5
|
probes CI runs — but they are the ones to start from.
|
|
6
6
|
|
|
@@ -20,20 +20,23 @@ and is what you want when you are working in this tree.
|
|
|
20
20
|
| `signa-sync.mjs` | — | `node bin/signa-sync.mjs` | One vendor read (`GET /v1/offices`, paged). Needs `SIGNA_API_KEY`. |
|
|
21
21
|
|
|
22
22
|
`example.mjs` replays `demo` through the ordinary publisher into `~/trademark-demo/pool` and
|
|
23
|
-
serves it on `127.0.0.1:18860
|
|
24
|
-
|
|
23
|
+
serves it on `127.0.0.1:18860`, with its engine door and client door on 18861 and 18862. Every path
|
|
24
|
+
the demo pool could collide with is checked by realpath and by containment before anything is written,
|
|
25
|
+
because a demo runs on deployed machines too.
|
|
25
26
|
|
|
26
27
|
`onboard.mjs` validates each answer through the door the engine itself uses before it persists anything,
|
|
27
28
|
and the engine check is a real turn through the adapter's own spawn path. `--check` is the free half: it
|
|
28
29
|
reports what this machine is configured for and writes nothing. Add `--probe-engine` to spend the turn
|
|
29
30
|
deliberately.
|
|
30
31
|
|
|
31
|
-
`start.mjs` is a supervisor. It starts
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
`start.mjs` is a supervisor. It starts four children. `driver/portal-service.mjs` (the portal, default
|
|
33
|
+
port 18802) and `mcp-server/http-server.mjs` (the engine door the portal's Start button calls, default
|
|
34
|
+
18790) are fatal: if either exits, it says which and stops the rest. `mcp-server/http-server-client.mjs`
|
|
35
|
+
(the client door an assistant connects to, default 18811) is non-fatal, and is left to its own unit when
|
|
36
|
+
that unit is already up. The fourth, `driver/runner.mjs --watch`, drains the queue, so ordering a
|
|
37
|
+
clearance from the portal runs it. That child is **non-fatal** too: an install with no worker is a
|
|
38
|
+
supported state (`--no-worker`), so a worker that dies leaves the portal serving and says what to
|
|
39
|
+
restart, rather than taking the install down.
|
|
37
40
|
|
|
38
41
|
That is where hours of model time and vendor calls are spent, and the consent for it is the portal's own
|
|
39
42
|
review dialog — which prices the run and takes the confirmation — not this file.
|
|
@@ -52,8 +55,8 @@ each office's own `status`, and a failed sync exits non-zero with the existing s
|
|
|
52
55
|
## Where to start
|
|
53
56
|
|
|
54
57
|
`example.mjs` (172 lines) is the shortest complete path through the system: frozen example, ordinary
|
|
55
|
-
publisher, local pool, loopback server. Then read the header of `start.mjs` for why the
|
|
56
|
-
|
|
58
|
+
publisher, local pool, loopback server. Then read the header of `start.mjs` for why the portal and the
|
|
59
|
+
engine door are separate processes, and what each of those two doors demands of a caller.
|
|
57
60
|
|
|
58
61
|
The long install path is in [`../INSTALL.md`](../INSTALL.md), and the index `uspto-sync` builds is in
|
|
59
62
|
[`../providers/uspto-local/README.md`](../providers/uspto-local/README.md).
|
package/bin/clearotron.mjs
CHANGED
|
@@ -72,7 +72,7 @@ export const SUMMARY = {
|
|
|
72
72
|
install: "configure this install — one question at a time, nothing written until each answer checks out",
|
|
73
73
|
doctor: "report what this machine is configured for. Writes nothing, calls nobody",
|
|
74
74
|
demo: "replay a finished example clearance and serve it. No keys, no model, no account",
|
|
75
|
-
start: "start the product — the portal
|
|
75
|
+
start: "start the product — the portal, the engine door, the client door and the worker — and print one address to open",
|
|
76
76
|
stop: "stop the background product and give the box back — connect's door is not touched",
|
|
77
77
|
status: "is the product up, and on which ports. Reads; changes nothing",
|
|
78
78
|
connect: "connect the assistant you already use — pick it by name and get the one thing it needs",
|
package/bin/connect.mjs
CHANGED
|
@@ -47,9 +47,12 @@ import { execFileSync } from "node:child_process";
|
|
|
47
47
|
import { createServer } from "node:net";
|
|
48
48
|
import { CONNECT_CLIENTS, WHERE_FLAG, clientById, leadRouteFor, plainStep, whatItNeeds } from "../shared/connect-clients.mjs";
|
|
49
49
|
import { stdioConnectFor, STDIO_SHAPES } from "../shared/stdio-connect.mjs";
|
|
50
|
+
import { claudeNamer } from "../driver/engine/probe.mjs"; // names the copy setup installed, which is not on PATH
|
|
50
51
|
import { isWsl, wslTarget } from "../shared/wsl.mjs"; // — and which distribution a row should start the server in
|
|
51
52
|
import { defaultDenylistPath, clientDoorAddress, clientDoorPort, clientDoorState, enablePlan, applyEnablePlan, describeChange, recordConnectKey, CLIENT_DOOR_UNIT, demoTokenSecretPath, keyPurposeLine, demoConnectCommand } from "../shared/client-door.mjs";
|
|
52
53
|
import { readRunning } from "../shared/running-start.mjs";
|
|
54
|
+
import { installPaths } from "./start.mjs"; // — one owner for a demo's layout, as `key` reads it
|
|
55
|
+
import { demoProgramPlan } from "../shared/permanent-install.mjs";
|
|
53
56
|
import { readLocalCredential, passphraseResetCommand, INSTALL_CREDENTIAL_FILE } from "../driver/portal-local-auth.mjs";
|
|
54
57
|
import { invocationPrefix } from "../shared/invocation.mjs";
|
|
55
58
|
import { BRAND } from "../shared/brand.mjs";
|
|
@@ -212,6 +215,7 @@ function deploymentHas(env = process.env) {
|
|
|
212
215
|
stdioRoutes: Object.fromEntries(Object.keys(STDIO_SHAPES).map((shape) =>
|
|
213
216
|
[shape, stdioConnectFor(shape, { workDir: env.CLEAROTRON_WORK_DIR || null, reportsDir: env.CLEAROTRON_REPORTS_DIR || null, wsl: wslTarget({ env }) })])),
|
|
214
217
|
wsl: isWsl({ env }),
|
|
218
|
+
nameClaude: claudeNamer(env),
|
|
215
219
|
// WHERE THE DOOR BINDS — not an address handed to any assistant. It is the loopback address the
|
|
216
220
|
// unit listens on, and `enablePlan` needs it to write the unit. It used to be passed to the
|
|
217
221
|
// resolver as `localAddress` and served to Cowork as somewhere to connect, which is the false
|
|
@@ -658,6 +662,41 @@ function printSteps(offer, key) {
|
|
|
658
662
|
}
|
|
659
663
|
}
|
|
660
664
|
|
|
665
|
+
/**
|
|
666
|
+
* What a demo has to offer an assistant on this machine: every stdio shape, resolved once against the demo's own folders and
|
|
667
|
+
* flag. The program is the demo's own copy where it has one, as the demo's start names it; otherwise the one running this.
|
|
668
|
+
*/
|
|
669
|
+
function demoHave(at) {
|
|
670
|
+
const paths = installPaths(at);
|
|
671
|
+
const plan = demoProgramPlan({ base: at });
|
|
672
|
+
const program = plan?.current ? { installRoot: plan.root } : {};
|
|
673
|
+
return {
|
|
674
|
+
stdioRoutes: Object.fromEntries(Object.keys(STDIO_SHAPES).map((shape) =>
|
|
675
|
+
[shape, stdioConnectFor(shape, { ...program, workDir: paths.workspace, reportsDir: paths.pool, wsl: wslTarget(), demo: true })])),
|
|
676
|
+
wsl: isWsl(),
|
|
677
|
+
nameClaude: claudeNamer(),
|
|
678
|
+
demo: true,
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/** THE QUESTION, IN THE READER'S WORDS: which assistant they want to use, the one thing they know for certain. */
|
|
683
|
+
async function askWhichAssistant() {
|
|
684
|
+
say("");
|
|
685
|
+
say(" Which assistant do you want to use?");
|
|
686
|
+
say("");
|
|
687
|
+
CONNECT_CLIENTS.forEach((c, n) => say(` ${n + 1}) ${c.name}`));
|
|
688
|
+
say("");
|
|
689
|
+
requireInteractive({ verb: "connect" });
|
|
690
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
691
|
+
let chosen = null;
|
|
692
|
+
try {
|
|
693
|
+
const answer = (await rl.question(` 1-${CONNECT_CLIENTS.length}: `)).trim();
|
|
694
|
+
chosen = CONNECT_CLIENTS[Number(answer) - 1] ?? clientById(answer);
|
|
695
|
+
} finally { rl.close(); }
|
|
696
|
+
if (!chosen) { console.error("connect: not one of the listed assistants."); process.exit(2); }
|
|
697
|
+
return chosen;
|
|
698
|
+
}
|
|
699
|
+
|
|
661
700
|
/**
|
|
662
701
|
* ── A RUNNING DEMO, NAMED BY ITS FOLDER (owner, 2026-09-19) ─────────────────────────────────────────
|
|
663
702
|
*
|
|
@@ -671,17 +710,30 @@ function printSteps(offer, key) {
|
|
|
671
710
|
* The address route's steps are not printed. They are written for a door behind a sign-in service,
|
|
672
711
|
* reached over the web, and a demo's door is on this machine and takes the key instead.
|
|
673
712
|
*/
|
|
674
|
-
async function connectDemo({ base, dryRun,
|
|
713
|
+
async function connectDemo({ base, dryRun, client = null, route = null, running = readRunning(), ask = askWhichAssistant } = {}) {
|
|
675
714
|
const at = resolve(base);
|
|
676
715
|
const prefix = invocationPrefix();
|
|
677
|
-
say("");
|
|
678
|
-
if (clientName) { say(` ${clientName}`); say(""); }
|
|
679
716
|
const demo = running.find((r) => r.demo && resolve(String(r.base ?? "")) === at);
|
|
680
717
|
if (!demo) {
|
|
718
|
+
say("");
|
|
681
719
|
say(` Not available here — no demo is running from ${at}.`);
|
|
682
720
|
say(` What would change it: start it with \`${prefix}clearotron demo --base ${/\s/.test(at) ? `"${at}"` : at}\`, then run this again.`);
|
|
683
721
|
return 1;
|
|
684
722
|
}
|
|
723
|
+
// ── EACH ASSISTANT ITS OWN FORM, BOUND TO THE DEMO (design, 2026-11-05) ─────────────────────────────
|
|
724
|
+
//
|
|
725
|
+
// The demo's start names Claude Code's line only, so a reader with another assistant had nothing to run.
|
|
726
|
+
// This asks which assistant, as the plain command does, and hands it the form its row already has, bound
|
|
727
|
+
// to the demo: its own program, work folder, reports folder and demo flag, under the demo's own server
|
|
728
|
+
// name, so a real install's connection beside it is left as it is. The key route above is `--where
|
|
729
|
+
// elsewhere`, which the demo's client-door line names.
|
|
730
|
+
if (route !== "public-http") {
|
|
731
|
+
const chosen = client ?? await ask();
|
|
732
|
+
const have = demoHave(at);
|
|
733
|
+
return await render(whatItNeeds(chosen, have, "disk"), have, { dryRun, running: { env: {}, known: false } });
|
|
734
|
+
}
|
|
735
|
+
say("");
|
|
736
|
+
if (client) { say(` ${client.name}`); say(""); }
|
|
685
737
|
if (!demo.ports?.client) {
|
|
686
738
|
say(` Not available here — the demo running from ${at} has no client door open.`);
|
|
687
739
|
say(" What would change it: stop the demo and start it again; its output says why the door did not start.");
|
|
@@ -731,7 +783,8 @@ async function main() {
|
|
|
731
783
|
say(" internet, with a key made for you now");
|
|
732
784
|
say(" --list the assistants this build knows");
|
|
733
785
|
say(" --dry-run say what would change, change nothing");
|
|
734
|
-
say(" --base <dir> a running demo's folder:
|
|
786
|
+
say(" --base <dir> a running demo's folder: connect your assistant to that demo. With");
|
|
787
|
+
say(" --where elsewhere, mint a key for its client door, and print both");
|
|
735
788
|
say(" --allow-checkout-move");
|
|
736
789
|
say(" write this checkout's path even though services are running from");
|
|
737
790
|
say(" another one. Every unit's ExecStart follows that value, so the ones");
|
|
@@ -747,19 +800,26 @@ async function main() {
|
|
|
747
800
|
process.exit(2);
|
|
748
801
|
}
|
|
749
802
|
const dryRun = argv.includes("--dry-run");
|
|
750
|
-
const b = argv.indexOf("--base");
|
|
751
|
-
if (b >= 0) {
|
|
752
|
-
const base = argv[b + 1];
|
|
753
|
-
if (!base || base.startsWith("--")) { console.error("connect: --base needs the demo's folder."); process.exit(2); }
|
|
754
|
-
const c = argv.indexOf("--client");
|
|
755
|
-
return await connectDemo({ base, dryRun, clientName: c >= 0 ? clientById(argv[c + 1])?.name ?? null : null });
|
|
756
|
-
}
|
|
757
803
|
const w = argv.indexOf("--where");
|
|
758
804
|
if (w >= 0 && !Object.hasOwn(WHERE_FLAG, argv[w + 1] ?? "")) {
|
|
759
805
|
console.error(`connect: --where takes one of: ${Object.keys(WHERE_FLAG).join(", ")}`);
|
|
760
806
|
process.exit(2);
|
|
761
807
|
}
|
|
762
808
|
let route = w >= 0 ? WHERE_FLAG[argv[w + 1]] : null;
|
|
809
|
+
const b = argv.indexOf("--base");
|
|
810
|
+
if (b >= 0) {
|
|
811
|
+
const base = argv[b + 1];
|
|
812
|
+
if (!base || base.startsWith("--")) { console.error("connect: --base needs the demo's folder."); process.exit(2); }
|
|
813
|
+
// `--list` NEEDS NO ANSWER, as the refusal for a missing terminal says, so it is answered here too.
|
|
814
|
+
if (argv.includes("--list")) { for (const x of CONNECT_CLIENTS) say(` ${x.id.padEnd(16)} ${x.name}`); return 0; }
|
|
815
|
+
const c = argv.indexOf("--client");
|
|
816
|
+
const named = c >= 0 ? clientById(argv[c + 1]) : null;
|
|
817
|
+
if (c >= 0 && !named) {
|
|
818
|
+
console.error(`connect: no such assistant "${argv[c + 1]}". One of: ${CONNECT_CLIENTS.map((x) => x.id).join(", ")}`);
|
|
819
|
+
process.exit(2);
|
|
820
|
+
}
|
|
821
|
+
return await connectDemo({ base, dryRun, client: named, route });
|
|
822
|
+
}
|
|
763
823
|
// F40 — reason about the RUNNING product from the units' own environment, not this CLI's env file.
|
|
764
824
|
const running = runningEnv();
|
|
765
825
|
const have = deploymentHas(running.env);
|
|
@@ -787,20 +847,8 @@ async function main() {
|
|
|
787
847
|
}
|
|
788
848
|
|
|
789
849
|
if (!chosen) {
|
|
790
|
-
//
|
|
791
|
-
|
|
792
|
-
say("");
|
|
793
|
-
say(" Which assistant do you want to use?");
|
|
794
|
-
say("");
|
|
795
|
-
CONNECT_CLIENTS.forEach((c, n) => say(` ${n + 1}) ${c.name}`));
|
|
796
|
-
say("");
|
|
797
|
-
requireInteractive({ verb: "connect" });
|
|
798
|
-
const rl = createInterface({ input: stdin, output: stdout });
|
|
799
|
-
try {
|
|
800
|
-
const answer = (await rl.question(` 1-${CONNECT_CLIENTS.length}: `)).trim();
|
|
801
|
-
chosen = CONNECT_CLIENTS[Number(answer) - 1] ?? clientById(answer);
|
|
802
|
-
} finally { rl.close(); }
|
|
803
|
-
if (!chosen) { console.error("connect: not one of the listed assistants."); process.exit(2); }
|
|
850
|
+
// Not "which transport", not "is this deployment hosted": which assistant (askWhichAssistant).
|
|
851
|
+
chosen = await askWhichAssistant();
|
|
804
852
|
// THE SECOND QUESTION, ASKED ONLY WHEN IT HAS TWO ANSWERS — the page's own, in the terminal's words.
|
|
805
853
|
// Where only one route is served here, asking would offer a choice whose other half cannot work.
|
|
806
854
|
const both = ["disk", "public-http"].filter((r) => whatItNeeds(chosen, have, r)?.served);
|
package/bin/example.mjs
CHANGED
|
@@ -211,6 +211,8 @@ const contains = (parent, child) => parent === child || child.startsWith(parent.
|
|
|
211
211
|
// path, and is REFUSED with the portal, because publishing into one directory while serving another is
|
|
212
212
|
// a demo that shows a reader an empty archive and says nothing about why.
|
|
213
213
|
const demoBase = resolve(flag("--base") ?? join(homedir(), "trademark-demo"));
|
|
214
|
+
// READ BEFORE ANYTHING BELOW MAKES IT: a folder an earlier `--once` or `--keep` left is kept on exit.
|
|
215
|
+
const baseExisted = existsSync(demoBase);
|
|
214
216
|
if (flag("--pool") && !has("--once")) die(
|
|
215
217
|
"demo: --pool is for --once, which publishes and exits.",
|
|
216
218
|
"",
|
|
@@ -422,12 +424,12 @@ function strayFromAnOlderDemo() {
|
|
|
422
424
|
// control greyed with the reason at it. Re-implementing that here is how there came to be two portals
|
|
423
425
|
// in the first place, so this hands over rather than copies. The dev cockpit keeps its job as a
|
|
424
426
|
// contributor tool; it simply stops being what `demo` opens.
|
|
425
|
-
const startArgs = demoStartArgs({ demoBase, readerBase: flag("--base") != null, keep: has("--keep"),
|
|
427
|
+
const startArgs = demoStartArgs({ demoBase, readerBase: flag("--base") != null, baseExisted, keep: has("--keep"),
|
|
426
428
|
port: flag("--port"), noOpen: has("--no-open") });
|
|
427
429
|
|
|
428
430
|
// ONLY WHEN THE FOLDER WILL OUTLIVE THE WINDOW. The demo removes what it made when it stops, and the
|
|
429
431
|
// supervisor's banner says so; printing a removal command here as well told the reader the opposite.
|
|
430
|
-
if (flag("--base") != null || has("--keep")) console.log(` Removing this demo later is one directory: ${removeDirectory(demoBase)}`);
|
|
432
|
+
if (flag("--base") != null || has("--keep") || baseExisted) console.log(` Removing this demo later is one directory: ${removeDirectory(demoBase)}`);
|
|
431
433
|
strayFromAnOlderDemo();
|
|
432
434
|
console.log("");
|
|
433
435
|
|