worktrust 0.11.9 → 0.11.10
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/CHANGELOG.md +24 -0
- package/LICENSE +3 -0
- package/README.md +18 -12
- package/cli-look.mjs +192 -0
- package/cli-menu-remote.mjs +31 -7
- package/cli-menu.mjs +28 -14
- package/engine-release.json +1 -1
- package/log-session.mjs +6 -169
- package/package-release.json +1 -1
- package/package.json +3 -1
- package/remote-adapter-claude-code.mjs +30 -4
- package/remote-adapter-terminal.mjs +4 -3
- package/remote-cli.mjs +22 -44
- package/remote-connections.mjs +55 -1
- package/remote-pairing.mjs +42 -4
- package/remote-qr.mjs +40 -15
- package/remote-run.mjs +7 -5
- package/remote-store.mjs +10 -0
- package/session-readers.mjs +202 -0
- package/worktrust.mjs +57 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
The WorkTrust CLI, newest first. What the tool is and how to use it: [README.md](README.md).
|
|
4
4
|
|
|
5
|
+
## 0.11.10: one scan to connect, a look before you sign in, and no release from a phone
|
|
6
|
+
|
|
7
|
+
**One QR connects a computer.** `npx -y worktrust remote app` draws one code. Scanned in the WorkTrust app (Scan ›
|
|
8
|
+
Connect agent, or Add connection), it approves this computer with your authenticator code and links that phone in the
|
|
9
|
+
same pass. The button says so ("Approve and link this phone"), and a computer you link while another is already linked is
|
|
10
|
+
not chosen for you. A code opened with the phone's camera or in a browser only approves; the phone is linked by a second
|
|
11
|
+
code a moment later. The printed link no longer carries the pairing secret (`--show-link` prints it whole), and
|
|
12
|
+
`--no-pair` links nothing. Remote Agent uses WorkTrust's gateway by default, so `remote pair` and the service work on a
|
|
13
|
+
computer approved without `--gateway`, where they said "no gateway" before. Every QR is drawn more compactly: about a
|
|
14
|
+
sixth fewer lines for the pairing code.
|
|
15
|
+
|
|
16
|
+
**Look at this computer.** `npx worktrust look`, the first row before you sign in, counts what your AI apps recorded
|
|
17
|
+
here: sessions per app, the first and last day, or that a store could not be read. It sends nothing, writes nothing and
|
|
18
|
+
makes no network call. Then you connect and send them, or preserve them here.
|
|
19
|
+
|
|
20
|
+
**No release from a phone.** A session steered from your phone can no longer run a ship script, a deploy script, `psql`
|
|
21
|
+
or a release through `gh`, whatever your own desk settings allow; this computer's keyboard keeps every one of them.
|
|
22
|
+
|
|
23
|
+
**Clearer lines and a steady screen.** Check this computer says which files its test count reads (a file once per
|
|
24
|
+
stretch) and how many stretches are not classed. A window resized while the menu is open no longer clears a command's
|
|
25
|
+
output above it, such as a QR you still need. When Remote Agent is part of Premium for an account, the menu says so and
|
|
26
|
+
offers the upgrade page; the summary names the account type. The licence names whom to contact for any use it does not
|
|
27
|
+
allow. Nothing it measures changes: the measure rules stay 4.
|
|
28
|
+
|
|
5
29
|
## 0.11.9: a first menu, one row per item, and nothing you can do twice
|
|
6
30
|
|
|
7
31
|
**A short menu until this computer is connected.** `npx -y worktrust` on a computer that is not connected yet opens
|
package/LICENSE
CHANGED
|
@@ -91,6 +91,9 @@ Nothing in this licence restricts what mandatory law allows a lawful user of a
|
|
|
91
91
|
computer program to do, including the acts permitted by Articles 5 and 6 of
|
|
92
92
|
Directive 2009/24/EC as implemented in the Dutch Copyright Act (Auteurswet).
|
|
93
93
|
|
|
94
|
+
For any use this licence does not allow, including commercial use of the code
|
|
95
|
+
itself, contact Oravita B.V. by email at hello@worktrust.io.
|
|
96
|
+
|
|
94
97
|
4. Ownership and all rights reserved
|
|
95
98
|
|
|
96
99
|
The Software is licensed, not sold. Oravita B.V. (WorkTrust) retains all right,
|
package/README.md
CHANGED
|
@@ -24,8 +24,9 @@ hiring instrument.
|
|
|
24
24
|
npx -y worktrust
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
In your own terminal this opens the menu. On a computer that is not connected yet it is a short one:
|
|
28
|
-
computer, Preserve evidence, Help.
|
|
27
|
+
In your own terminal this opens the menu. On a computer that is not connected yet it is a short one: Look at this
|
|
28
|
+
computer, Connect this computer, Preserve evidence, Help. Look lists, per AI app, the sessions its own files hold here and
|
|
29
|
+
their first and last day; it reads only, and sends and keeps nothing. Connect shows the plan, asks, and you approve the computer in your browser with your
|
|
29
30
|
own account and second factor; the moment that succeeds, the full menu is there. The `-y` answers npm's own question in
|
|
30
31
|
advance: without it npm may ask `Ok to proceed?` before WorkTrust starts.
|
|
31
32
|
|
|
@@ -66,15 +67,16 @@ computer in WorkTrust under Sources, Devices. More under [Undo](#undo).
|
|
|
66
67
|
On a computer that is not connected yet:
|
|
67
68
|
|
|
68
69
|
```
|
|
69
|
-
WorkTrust CLI 0.11.
|
|
70
|
+
WorkTrust CLI 0.11.10
|
|
70
71
|
Not connected yet
|
|
71
72
|
|
|
72
|
-
> 1
|
|
73
|
-
2
|
|
74
|
-
3
|
|
75
|
-
4
|
|
73
|
+
> 1 Look at this computer npx worktrust look
|
|
74
|
+
2 Connect this computer npx worktrust connect
|
|
75
|
+
3 Preserve evidence › npx worktrust preserve …
|
|
76
|
+
4 Help · all commands npx worktrust help
|
|
77
|
+
5 Quit q
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
Reads what your AI apps recorded here. Nothing is sent.
|
|
78
80
|
|
|
79
81
|
↑/↓ move · Enter open · Esc quit · 1-9 jump
|
|
80
82
|
```
|
|
@@ -82,13 +84,13 @@ On a computer that is not connected yet:
|
|
|
82
84
|
Once it is connected (80 columns; on a wide terminal each row's sentence stands on the row itself, as a fourth column):
|
|
83
85
|
|
|
84
86
|
```
|
|
85
|
-
WorkTrust CLI 0.11.
|
|
87
|
+
WorkTrust CLI 0.11.10
|
|
86
88
|
Account you@example.com
|
|
87
89
|
This computer imac · connected since 2026-11-03
|
|
88
90
|
Remote Agent approved, 2 connections
|
|
89
91
|
Sharing session hook on · AI apps on (7) · Remote Agent approved
|
|
90
92
|
|
|
91
|
-
1 Update WorkTrust · up to date (0.11.
|
|
93
|
+
1 Update WorkTrust · up to date (0.11.10) npx worktrust update
|
|
92
94
|
> 2 Check this computer npx worktrust
|
|
93
95
|
3 Remote Agent › npx worktrust remote …
|
|
94
96
|
4 Import earlier history › npx worktrust history …
|
|
@@ -124,6 +126,7 @@ there is no menu and nothing waits for a key.
|
|
|
124
126
|
| `npx worktrust history` | Sends this computer's earlier sessions as history. `--rebuild` measures them again, `--export <path>` reads a ChatGPT or Claude export, `--from-archive` and `--from-folder <dir>` read your own copies. Always shows the plan and asks. |
|
|
125
127
|
| `npx worktrust disconnect` | Takes WorkTrust out of every AI app here. Asks first. |
|
|
126
128
|
| `npx worktrust status` | Shows what is connected here. It only reads. |
|
|
129
|
+
| `npx worktrust look` | Shows what your AI apps recorded here: per app the sessions and their first and last day. Reads only; nothing is sent or kept, and no account is needed. |
|
|
127
130
|
| `npx worktrust project` | Sets a folder's mode: exclude (nothing read), confidential (hours and tokens count; no name, branch, path or commit is sent) or normal. `project list` shows them. |
|
|
128
131
|
| `npx worktrust remote` | Remote Agent: `app` or `web` approve this computer, `pair` links a phone, then `status`, `pause`, `resume`, `disable`, `connections`, `disconnect`, `projects`, `roots` and `modes`. |
|
|
129
132
|
| `npx worktrust mcp off` | Hours only: the WorkTrust door out of every AI app here. The session hook keeps measuring. |
|
|
@@ -730,7 +733,8 @@ Off until you run `npx worktrust remote app` (or `remote web`) at this keyboard;
|
|
|
730
733
|
that scanned it is confirmed; one that typed the code instead waits for `npx worktrust remote phones confirm`.
|
|
731
734
|
- Two roads to approve the computer's key: `npx worktrust remote app` shows the approval as a QR code here (no browser);
|
|
732
735
|
the WorkTrust app scans it and you approve with your authenticator code. `npx worktrust remote web` opens the approval
|
|
733
|
-
page in your browser. Both
|
|
736
|
+
page in your browser. Both use WorkTrust's gateway unless `--gateway` chooses another, and take `--device`; `remote
|
|
737
|
+
enable` (0.11.6 and before) is gone since 0.11.7.
|
|
734
738
|
- `projects add <folder>` grants a folder (its real path; never your home folder, the disk's root or a folder holding
|
|
735
739
|
keys, keychains, browser profiles or wallets). A phone starts agents only in granted folders, several at once (four by
|
|
736
740
|
default).
|
|
@@ -769,7 +773,7 @@ Off until you run `npx worktrust remote app` (or `remote web`) at this keyboard;
|
|
|
769
773
|
instead (off by default). A PIN reset in WorkTrust removes every browser link; phones keep theirs.
|
|
770
774
|
|
|
771
775
|
Remote needs Node 22.4 or later (the Python package bundles one). It connects to the WorkTrust gateway
|
|
772
|
-
(`wss://remote.worktrust.io`, live since 2026-11-09).
|
|
776
|
+
(`wss://remote.worktrust.io`, live since 2026-11-09), by default for everyone since 0.11.10.
|
|
773
777
|
|
|
774
778
|
## Requirements
|
|
775
779
|
|
|
@@ -791,6 +795,8 @@ with or without an account; every other feature is for WorkTrust account holders
|
|
|
791
795
|
only be installed and evaluated. The archives and files the CLI makes from your own data are yours.
|
|
792
796
|
Version 1.1 of the licence applies from 0.10.39; 0.10.18 to 0.10.38 were published under version 1.0; versions up to and
|
|
793
797
|
including 0.10.17 were published under the MIT licence and stay under it.
|
|
798
|
+
For any use the licence does not allow, including commercial use of the code itself, contact Oravita B.V. by email at
|
|
799
|
+
hello@worktrust.io.
|
|
794
800
|
|
|
795
801
|
## Release signatures and the limits of verification
|
|
796
802
|
|
package/cli-look.mjs
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LOOK AT THIS COMPUTER (`npx worktrust look`, CLI 0.11.10; owner, 2026-11-14): the first thing a person can do, before any
|
|
3
|
+
* account. Per AI app the readers know, how many SESSIONS its own files on this computer hold, and the first and the last
|
|
4
|
+
* day; a total line. COUNTS ONLY: sessions, apps, days. No hours, no level, no score, no tokens: hours are measured by
|
|
5
|
+
* WorkTrust from what the hook sends, and a figure counted here would differ from the verified one.
|
|
6
|
+
*
|
|
7
|
+
* It finds and reads sessions with the hook's own readers (session-readers.mjs, transcript-readers.mjs,
|
|
8
|
+
* session-databases.mjs), an excluded project skipped before a file is opened, exactly as the hook skips it. A session is a
|
|
9
|
+
* session file (or a database client's session) with at least one timestamped turn; a day is a UTC date, as the hook cuts
|
|
10
|
+
* days. Three states per app, never two: none found; found N (and how many could not be read); could not read. An app that
|
|
11
|
+
* is not on this computer is left out.
|
|
12
|
+
*
|
|
13
|
+
* IT WRITES NOTHING AND SENDS NOTHING: no key, no file, no cache, no consent record, no network call
|
|
14
|
+
* (scripts/test-cli-look.mjs runs it with every file write and every network function made to throw).
|
|
15
|
+
*
|
|
16
|
+
* measuredLines (0.11.10): the lines `Check this computer` prints from the hook's --evidence-summary, pure so a test reads
|
|
17
|
+
* them; what the two misleading lines count is now said in their words.
|
|
18
|
+
*/
|
|
19
|
+
import { readdirSync, statSync } from "node:fs";
|
|
20
|
+
import { createRequire } from "node:module";
|
|
21
|
+
import { homedir } from "node:os";
|
|
22
|
+
import { join } from "node:path";
|
|
23
|
+
import { projectModeOf, readProjectModes } from "./project-modes.mjs";
|
|
24
|
+
import { READ_FAILURES, sessionFinders, transcriptLines } from "./session-readers.mjs";
|
|
25
|
+
|
|
26
|
+
const readers = (await import("./transcript-readers.mjs").catch(() => null)) ?? {};
|
|
27
|
+
const databases = (await import("./session-databases.mjs").catch(() => null)) ?? {};
|
|
28
|
+
const localModels = (await import("./session-local-models.mjs").catch(() => null)) ?? {};
|
|
29
|
+
|
|
30
|
+
const isDir = (path) => { try { return statSync(path).isDirectory(); } catch { return false; } };
|
|
31
|
+
/** A folder that is there and cannot be listed: its app's sessions could not be read. */
|
|
32
|
+
const unlistable = (path) => { if (!isDir(path)) return false; try { readdirSync(path); return false; } catch { return true; } };
|
|
33
|
+
/** Whether this Node can open the database clients' stores (node:sqlite, Node 22.5+), asked without opening one. */
|
|
34
|
+
const sqliteHere = () => { const warn = process.emitWarning; try { process.emitWarning = () => {}; createRequire(import.meta.url)("node:sqlite"); return true; } catch { return false; } finally { process.emitWarning = warn; } };
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The apps the readers know, in the order the table shows them. `here`: whether the app is on this computer (its own folder);
|
|
38
|
+
* `roots`: the folders whose listing must work for its sessions to be read; `database`: read through node:sqlite.
|
|
39
|
+
*/
|
|
40
|
+
const homesOf = (fn) => (typeof fn === "function" ? fn() : []);
|
|
41
|
+
export const LOOK_APPS = [
|
|
42
|
+
{ key: "claude", name: "Claude Code", here: () => isDir(join(homedir(), ".claude")), roots: () => [join(homedir(), ".claude", "projects")] },
|
|
43
|
+
{ key: "codex", name: "Codex", here: () => isDir(join(homedir(), ".codex")), roots: () => [join(homedir(), ".codex", "sessions")] },
|
|
44
|
+
{ key: "antigravity", name: "Antigravity", here: () => Boolean(readers.antigravityHere?.()), roots: () => homesOf(readers.antigravityRoots).map((root) => join(root, "brain")) },
|
|
45
|
+
{ key: "cursor", name: "Cursor", database: true, here: () => homesOf(databases.cursorHomes).some(isDir) },
|
|
46
|
+
{ key: "copilot", name: "Copilot in VS Code", database: true, here: () => homesOf(databases.copilotHomes).some(isDir) },
|
|
47
|
+
{ key: "gemini-cli", name: "Gemini CLI", database: true, here: () => homesOf(databases.geminiHomes).some((home) => isDir(join(home, "tmp"))) },
|
|
48
|
+
{ key: "opencode", name: "OpenCode", database: true, here: () => homesOf(databases.opencodeHomes).some(isDir) },
|
|
49
|
+
{ key: "hermes", name: "Hermes Agent", database: true, here: () => Boolean(databases.hermesHere?.()) },
|
|
50
|
+
{ key: "goose", name: "Goose", database: true, here: () => homesOf(databases.gooseHomes).some(isDir) },
|
|
51
|
+
{ key: "openclaw", name: "OpenClaw", database: true, here: () => isDir(process.env.OPENCLAW_STATE_DIR || join(homedir(), ".openclaw")) },
|
|
52
|
+
{ key: "ollama", name: "Ollama", database: true, here: () => homesOf(localModels.ollamaHomes).some(isDir) },
|
|
53
|
+
{ key: "open-webui", name: "Open WebUI", database: true, here: () => homesOf(localModels.openWebuiHomes).some(isDir) },
|
|
54
|
+
];
|
|
55
|
+
/** A found session's app, by the id the finders give it: Claude Code's carry no prefix, every other client's names it. */
|
|
56
|
+
const appOf = (id) => /^([a-z][a-z-]*):/.exec(String(id))?.[1] ?? "claude";
|
|
57
|
+
const dayOf = (ms) => new Date(ms).toISOString().slice(0, 10);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* What the AI apps on this computer recorded: { apps: [{ key, name, state, sessions, unreadable, first, last, why }], total }.
|
|
61
|
+
* `state`: "none" | "found" | "unreadable". `progress(name)` is told each app as its sessions are read. Reads only.
|
|
62
|
+
*/
|
|
63
|
+
export function lookAt({ progress = null } = {}) {
|
|
64
|
+
const present = LOOK_APPS.filter((app) => { try { return app.here(); } catch { return false; } });
|
|
65
|
+
const rows = new Map(present.map((app) => [app.key, { key: app.key, name: app.name, state: "none", sessions: 0, unreadable: 0, first: null, last: null, why: null }]));
|
|
66
|
+
const modes = readProjectModes(), excluded = (path) => projectModeOf(path, modes) === "exclude";
|
|
67
|
+
const { CODEX_ROLLOUT = /(?!)/, codexIdOf = (file) => String(file).split(/[\\/]/).at(-1).replace(/\.jsonl$/, ""), antigravityIdOf = (file) => String(file).split(/[\\/]/).at(-4), codexLines, codexRolloutFiles = function* () {}, codexCwd = () => null, ANTIGRAVITY_TRANSCRIPT = /(?!)/, antigravityLines, antigravityRoots = () => [], antigravityTranscripts = function* () {}, antigravityContext = () => ({}) } = readers;
|
|
68
|
+
const { DATABASE_SESSION = /(?!)/, databaseLines = () => null, databaseSessions = function* () {}, databaseStores = () => [] } = databases;
|
|
69
|
+
const DATABASE_CLIENTS = LOOK_APPS.filter((app) => app.database).map((app) => app.key);
|
|
70
|
+
const finders = sessionFinders({ value: () => undefined, excluded, DATABASE_CLIENTS, codexRolloutFiles, codexCwd, codexIdOf, antigravityRoots, antigravityTranscripts, antigravityContext, databaseSessions });
|
|
71
|
+
const parsedLines = transcriptLines({ DATABASE_SESSION, databaseLines, CODEX_ROLLOUT, codexLines, ANTIGRAVITY_TRANSCRIPT, antigravityIdOf, antigravityLines, antigravityContext });
|
|
72
|
+
// A folder that is there and cannot be listed is an app that could not be read (the walks pass it over in silence).
|
|
73
|
+
for (const app of present) if ((app.roots?.() ?? []).some(unlistable)) rows.get(app.key).why = "folder";
|
|
74
|
+
// The database clients need node:sqlite; a store the local-model readers opened and could not read is said by them.
|
|
75
|
+
const sqlite = sqliteHere();
|
|
76
|
+
for (const app of present) if (app.database && !sqlite) rows.get(app.key).why = "node";
|
|
77
|
+
for (const store of (() => { try { return sqlite ? databaseStores() : []; } catch { return []; } })()) if (store?.state && store.state !== "read" && rows.has(store.client)) rows.get(store.client).why ??= "store";
|
|
78
|
+
const walk = rows.get("claude")?.why === "folder" ? finders.codexRollouts() : finders.allTranscripts();
|
|
79
|
+
let current = null;
|
|
80
|
+
for (const { id, file } of walk) {
|
|
81
|
+
const key = appOf(id), row = rows.get(key);
|
|
82
|
+
if (!row) continue; // an app the table does not show (none today): never counted under another's name
|
|
83
|
+
if (key !== current) { current = key; progress?.(row.name); }
|
|
84
|
+
const failedBefore = READ_FAILURES.n;
|
|
85
|
+
let first = Infinity, last = -Infinity, lines = null;
|
|
86
|
+
try { lines = parsedLines(file); } catch { lines = null; }
|
|
87
|
+
if (lines) { try { for (const line of lines) { if (!line?.timestamp || (line.type !== "user" && line.type !== "assistant")) continue; const at = Date.parse(line.timestamp); if (Number.isFinite(at)) { if (at < first) first = at; if (at > last) last = at; } } } catch { READ_FAILURES.n += 1; } }
|
|
88
|
+
if (READ_FAILURES.n > failedBefore || (!lines && DATABASE_SESSION.test(file))) { row.unreadable += 1; continue; }
|
|
89
|
+
if (!lines) continue; // a file gone between the walk and the read is no session
|
|
90
|
+
if (first === Infinity) continue; // no timestamped turn: nothing was recorded in it
|
|
91
|
+
row.sessions += 1;
|
|
92
|
+
if (!row.first || dayOf(first) < row.first) row.first = dayOf(first);
|
|
93
|
+
if (!row.last || dayOf(last) > row.last) row.last = dayOf(last);
|
|
94
|
+
}
|
|
95
|
+
const apps = [...rows.values()].map((row) => ({ ...row, state: row.sessions > 0 ? "found" : row.unreadable > 0 || row.why ? "unreadable" : "none" }));
|
|
96
|
+
const found = apps.filter((row) => row.sessions > 0);
|
|
97
|
+
const total = { sessions: found.reduce((n, row) => n + row.sessions, 0), apps: found.length, first: found.map((row) => row.first).sort()[0] ?? null, last: found.map((row) => row.last).sort().at(-1) ?? null };
|
|
98
|
+
return { apps, total };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const WHY = { node: "needs Node 22.5+", folder: "folder not readable", store: "database locked or unknown" };
|
|
102
|
+
const plural = (n, one, many) => `${n.toLocaleString("en-US")} ${n === 1 ? one : many}`;
|
|
103
|
+
|
|
104
|
+
/** The table, as lines. `columns`: the terminal's width; below 64 a row's days go to a line of their own. Pure. */
|
|
105
|
+
export function lookLines({ apps, total }, { columns = 80 } = {}) {
|
|
106
|
+
// A sentence wraps at the terminal's width, two spaces in, as the menu's fixed line does.
|
|
107
|
+
const said = (text) => text.split(" ").reduce((lines, word) => { const last = lines.at(-1); if (last && last.length + 1 + word.length <= columns - 3) lines[lines.length - 1] = `${last} ${word}`; else lines.push(word); return lines; }, []).map((line) => ` ${line}`);
|
|
108
|
+
const out = ["", ...said("What your AI apps recorded on this computer. Nothing was sent or kept."), ""];
|
|
109
|
+
if (apps.length === 0) return [...out, ...said("No AI app this CLI reads was found on this computer."), ""];
|
|
110
|
+
const nameCol = Math.max(...apps.map((row) => row.name.length), "Total".length);
|
|
111
|
+
const state = (row) => (row.state === "found" ? `${plural(row.sessions, "session", "sessions")}${row.unreadable ? ` · ${row.unreadable} could not be read` : ""}` : row.state === "none" ? "none found" : `could not read${row.why ? ` (${WHY[row.why]})` : ""}`);
|
|
112
|
+
const days = (row) => (row.first ? (row.first === row.last ? row.first : `${row.first} to ${row.last}`) : "");
|
|
113
|
+
const totalSaid = total.sessions ? `${plural(total.sessions, "session", "sessions")} in ${plural(total.apps, "app", "apps")}` : "no sessions found";
|
|
114
|
+
const stateCol = Math.max(totalSaid.length, ...apps.map((row) => state(row).length));
|
|
115
|
+
const narrow = 2 + nameCol + 3 + stateCol + 3 + "2026-01-01 to 2026-01-01".length > columns - 1;
|
|
116
|
+
const row = (name, said, span) => (narrow ? [` ${name.padEnd(nameCol)} ${said}`, ...(span ? [` ${"".padEnd(nameCol)} ${span}`] : [])] : [` ${name.padEnd(nameCol)} ${span ? said.padEnd(stateCol) : said}${span ? ` ${span}` : ""}`]);
|
|
117
|
+
for (const app of apps) out.push(...row(app.name, state(app), days(app)));
|
|
118
|
+
out.push("", ...row("Total", totalSaid, days(total)));
|
|
119
|
+
out.push("", ...said("Sessions and days only: WorkTrust measures the hours when you send them."));
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* THE MEASURED SUMMARY OF `Check this computer` (0.8.3; words corrected 0.11.10 from the owner's own output): one line per
|
|
125
|
+
* evidence group, from the hook's --evidence-summary JSON. Pure. Two lines said less than they count:
|
|
126
|
+
* · the changed files are, per stretch, every path of every commit in that repository during the stretch's window, any
|
|
127
|
+
* author, generated files and lockfiles included (or its uncommitted files when nothing was committed), a file counted
|
|
128
|
+
* once per stretch and again in the next: the line now says so;
|
|
129
|
+
* · the complexity classes come from the derived record, which not every stretch has: the stretches without one are said.
|
|
130
|
+
*/
|
|
131
|
+
export function measuredLines(m) {
|
|
132
|
+
if (!m || !m.stretches) return [" Measured here, last 30 days: no finished work stretch yet."];
|
|
133
|
+
const of = (part, whole, one, many) => `${part} of ${whole} ${whole === 1 ? one : many}`;
|
|
134
|
+
const out = ["", ` Measured here, last 30 days: ${m.stretches} work stretch${m.stretches === 1 ? "" : "es"} (the hours are WorkTrust's: see the app)`];
|
|
135
|
+
if (m.delivered) out.push(` verified before delivery ${of(m.verified_first, m.delivered, "stretch that delivered", "stretches that delivered")}`);
|
|
136
|
+
if (m.failures) out.push(` recovered failures ${of(m.recovered, m.failures, "failed tool call", "failed tool calls")} (${m.blind_retries} retried unchanged)`);
|
|
137
|
+
if (m.steers) out.push(` steering that worked ${of(m.effective_steers, m.steers, "time you stepped in", "times you stepped in")}`);
|
|
138
|
+
if (m.refused || m.guard_denied) out.push(` refused ${m.refused} by you · ${m.guard_denied} by a guard`);
|
|
139
|
+
if (m.planned) out.push(` planned ${m.planned} stretch${m.planned === 1 ? "" : "es"} with a to-do list`);
|
|
140
|
+
if (m.files) out.push(` tests among changed files ${of(m.test_files, m.files, "file", "files")}, a file once per stretch`, " (any author's commits in the stretch's window)");
|
|
141
|
+
const tiers = Object.entries(m.complexity ?? {}).sort(), classed = tiers.reduce((n, [, count]) => n + (Number(count) || 0), 0);
|
|
142
|
+
const classes = ` task complexity ${tiers.map(([tier, n]) => `${tier} ${n}`).join(" · ")}`, unclassed = m.stretches > classed ? `${m.stretches - classed} not classed` : null;
|
|
143
|
+
// The stretches without a class are said on the line, or under it where 80 columns would cut it.
|
|
144
|
+
if (tiers.length) out.push(...(!unclassed ? [classes] : classes.length + 3 + unclassed.length <= 79 ? [`${classes} · ${unclassed}`] : [classes, `${" ".repeat(31)}${unclassed}`]));
|
|
145
|
+
out.push(" Sent with each stretch as kinds and counts, never text. Keep your own copy: npx worktrust@latest preserve");
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* WHAT TO DO WITH IT (owner, 2026-11-14): a short list in the menu's own renderer under the table. Not connected: connect
|
|
151
|
+
* (the existing flow, which offers the past once after the sign-in); connected: send them as earlier history (it asks
|
|
152
|
+
* first). Preserve needs no account. Each names the command it runs, as every menu row does.
|
|
153
|
+
*/
|
|
154
|
+
export function lookItems(connected = false) {
|
|
155
|
+
return [
|
|
156
|
+
connected
|
|
157
|
+
? { label: "Send these to your WorkTrust account", hint: "npx worktrust history", info: "Sends them as earlier history. Shows a plan, asks first.", args: ["history"] }
|
|
158
|
+
: { label: "Connect and send these to your WorkTrust account", hint: "npx worktrust connect", info: "Asks before it writes; your browser signs in to WorkTrust.", args: ["connect"] },
|
|
159
|
+
{ label: "Preserve them here as evidence ›", hint: "npx worktrust preserve", info: "Keep your AI history here. No account; nothing is sent.", preserve: true },
|
|
160
|
+
{ label: "← Back", hint: "Esc", back: true },
|
|
161
|
+
];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** The menu's Look row (cli-menu.mjs firstItems): the `look` command as a child, no key waited for, then the list. */
|
|
165
|
+
export async function lookMenu(term, io, levels) {
|
|
166
|
+
const menu = await import("./cli-menu.mjs");
|
|
167
|
+
const code = await menu.runShown(term, io, ["look"], null, { pause: false });
|
|
168
|
+
if (code !== 0) { term.write(`\n ! It ended with a message above. ${menu.muted("Press any key for the menu.")}\n`); const k = await term.anyKey(); return !(k.ctrl && k.name === "c"); }
|
|
169
|
+
const picked = await menu.choose(term, { title: "What next", items: lookItems(false) });
|
|
170
|
+
if (picked === "quit") return false;
|
|
171
|
+
if (picked === "back" || picked.item.back) return true;
|
|
172
|
+
return picked.item.preserve ? levels.preserveMenu(term, io, []) : menu.runShown(term, io, picked.item.args);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The same list after `npx worktrust look` in a person's own terminal (worktrust.mjs asks menuWanted first). Ctrl+C while a
|
|
177
|
+
* command it started runs is that command's; the list's own Ctrl+C and Esc leave. → the exit code of what it ran, else 0.
|
|
178
|
+
* `term` and `levels` are this process's terminal and the menu's deeper levels unless a test hands its own.
|
|
179
|
+
*/
|
|
180
|
+
export async function lookNext(io, { connected = false, term: given = null, levels: deeper = null } = {}) {
|
|
181
|
+
const menu = await import("./cli-menu.mjs"), levels = deeper ?? (await import("./cli-menu-remote.mjs"));
|
|
182
|
+
const term = given ?? menu.createTerminal(), hold = () => {};
|
|
183
|
+
process.on("SIGINT", hold);
|
|
184
|
+
try {
|
|
185
|
+
term.enter();
|
|
186
|
+
const picked = await menu.choose(term, { title: "What next", items: lookItems(connected) });
|
|
187
|
+
if (picked === "quit" || picked === "back" || picked.item.back) return 0;
|
|
188
|
+
if (picked.item.preserve) { await levels.preserveMenu(term, io, []); return 0; }
|
|
189
|
+
term.erase(); term.restore();
|
|
190
|
+
return await io.runCli(picked.item.args);
|
|
191
|
+
} finally { term.erase(); term.restore(); process.off("SIGINT", hold); }
|
|
192
|
+
}
|
package/cli-menu-remote.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
11
|
import { join } from "node:path";
|
|
12
|
-
import { choose, remoteState, runShown, typed } from "./cli-menu.mjs";
|
|
12
|
+
import { choose, muted, remoteState, runShown, typed } from "./cli-menu.mjs";
|
|
13
13
|
import { makeProjectsFolder, pickFolder, pickerCommand, suggestedFolders } from "./folder-picker.mjs";
|
|
14
14
|
import { connections } from "./remote-connections.mjs";
|
|
15
15
|
import { loadIdentity, loadProjects, loadRoots, loadSettings } from "./remote-store.mjs";
|
|
@@ -164,8 +164,17 @@ export function approval() { try { return Boolean(loadIdentity()); } catch { ret
|
|
|
164
164
|
* computer's remote keys (remote-cli.mjs needPaired, remote-settings.mjs applyRules), and no phone can be linked, so there
|
|
165
165
|
* is no connection to list and nothing to pause. Allowed modes is a local setting and Status only reads: both stay.
|
|
166
166
|
* APPROVED: Link a phone first, and approving again stays (new keys). NOT KNOWN: every row can be chosen and the title says so.
|
|
167
|
+
*
|
|
168
|
+
* PART OF PREMIUM (owner, 2026-11-14; docs/remote-agents/ISSUER.md §12): when WorkTrust itself answered `premium_required`
|
|
169
|
+
* (`access`, from api/cli/door: the switch on and the account Free), the first row is "Upgrade to Premium ›" and every other
|
|
170
|
+
* row stays visible and cannot be chosen (the one disabled-row mechanism). Any other answer, or none, is the list as above.
|
|
167
171
|
*/
|
|
168
|
-
export function remoteItems(approved, paused, act = {}) {
|
|
172
|
+
export function remoteItems(approved, paused, act = {}, access = null) {
|
|
173
|
+
if (access === "premium_required") return [
|
|
174
|
+
{ label: "Upgrade to Premium ›", hint: act.upgradeHint ?? undefined, info: "Remote Agent is part of Premium. Opens the upgrade page.", run: act.upgrade },
|
|
175
|
+
...remoteItems(approved, paused).filter((item) => !item.back).map((item) => ({ label: item.label, hint: item.hint, info: item.info, disabled: true, quiet: "Part of Premium: upgrade first.", note: { text: "Premium", tone: "dim" } })),
|
|
176
|
+
BACK,
|
|
177
|
+
];
|
|
169
178
|
const wait = approved === false ? { disabled: true, quiet: "Approve this computer first.", note: { text: "not yet", tone: "dim" } } : {};
|
|
170
179
|
const approve = { label: approved ? "Approved ✓ · approve again ›" : "Approve this computer ›", hint: approved ? "npx worktrust remote app --repair" : "npx worktrust remote app | web", info: approved ? "Approve again: new keys, and linked phones link again." : "Needed once: your account allows steering this computer.", run: act.approve };
|
|
171
180
|
const link = { label: "Link a phone (QR here)", hint: "npx worktrust remote pair", info: "Shows a QR that links a phone to this computer.", run: act.link, ...wait };
|
|
@@ -181,16 +190,30 @@ export function remoteItems(approved, paused, act = {}) {
|
|
|
181
190
|
];
|
|
182
191
|
}
|
|
183
192
|
|
|
193
|
+
/**
|
|
194
|
+
* "Upgrade to Premium ›" (owner, 2026-11-14): the address WorkTrust answered, opened in the browser AND printed, for a
|
|
195
|
+
* terminal without one (SSH). No address: where to find it in words. The account is asked again at the next read.
|
|
196
|
+
*/
|
|
197
|
+
export async function showUpgrade(term, io, url) {
|
|
198
|
+
term.write(url ? `\n Upgrade to Premium: ${url}\n It opens in your browser; on another device, open the address above.\n` : "\n Upgrade to Premium in WorkTrust: Settings › Plan & billing.\n");
|
|
199
|
+
if (url) io.openUrl?.(url);
|
|
200
|
+
term.write(` ${muted("Press any key for the menu.")}\n`);
|
|
201
|
+
const k = await term.anyKey();
|
|
202
|
+
return !(k.ctrl && k.name === "c");
|
|
203
|
+
}
|
|
204
|
+
|
|
184
205
|
/** Remote Agent ›. The rows are read again after every command, so an approval made here opens the other steps at once. */
|
|
185
|
-
export function remoteMenu(term, io, header) {
|
|
186
|
-
|
|
206
|
+
export async function remoteMenu(term, io, header) {
|
|
207
|
+
let state = (await io.state?.()) ?? null; // the account's answer (plan, remoteAccess, upgrade), read again after every command below
|
|
208
|
+
const reading = { ...io, state: async () => (state = (await io.state?.()) ?? null) };
|
|
209
|
+
const title = () => (state?.remoteAccess === "premium_required" ? "Remote Agent · part of Premium" : approval() === null ? "Remote Agent · its state could not be read" : "Remote Agent");
|
|
187
210
|
return level(term, header, title, () => {
|
|
188
211
|
const approved = approval(), paused = (() => { try { return loadSettings().paused !== null; } catch { return false; } })();
|
|
189
212
|
// The two roads; one that leaves this computer approved returns to the list above, which now opens on Link a phone.
|
|
190
213
|
const road = (which) => async () => ((await runShown(term, io, ["remote", which, ...(approved ? ["--repair"] : [])])) === false ? false : approved === false && approval() === true ? "back" : true);
|
|
191
214
|
return remoteItems(approved, paused, {
|
|
192
215
|
approve: () => level(term, header, approved ? "Approve this computer again (new keys)" : "Approve this computer", () => [
|
|
193
|
-
{ label: "With the WorkTrust app", hint: `npx worktrust remote app${approved ? " --repair" : ""}`, info: "
|
|
216
|
+
{ label: "With the WorkTrust app", hint: `npx worktrust remote app${approved ? " --repair" : ""}`, info: "One QR: the app approves and links this phone.", run: road("app") },
|
|
194
217
|
{ label: "In the browser", hint: `npx worktrust remote web${approved ? " --repair" : ""}`, info: "Opens WorkTrust in your browser, where you approve.", run: road("web") },
|
|
195
218
|
BACK,
|
|
196
219
|
], io),
|
|
@@ -198,8 +221,9 @@ export function remoteMenu(term, io, header) {
|
|
|
198
221
|
projects: () => projectsMenu(term, io, header), roots: () => rootsMenu(term, io, header), modes: () => modesMenu(term, io, header), connections: () => connectionsMenu(term, io, header),
|
|
199
222
|
pause: () => runShown(term, io, ["remote", paused ? "resume" : "pause"]),
|
|
200
223
|
status: () => runShown(term, io, ["remote", "status"]),
|
|
201
|
-
|
|
202
|
-
|
|
224
|
+
upgrade: () => showUpgrade(term, io, state?.upgrade ?? null), upgradeHint: state?.upgrade ? String(state.upgrade).replace(/^https?:\/\//, "") : undefined,
|
|
225
|
+
}, state?.remoteAccess ?? null);
|
|
226
|
+
}, reading);
|
|
203
227
|
}
|
|
204
228
|
|
|
205
229
|
export function historyMenu(term, io, header) {
|
package/cli-menu.mjs
CHANGED
|
@@ -51,8 +51,8 @@ export const muted = (text) => paint.dim(text);
|
|
|
51
51
|
* key and each return from a command left one more copy. Now draw() remembers how many lines the menu took and the next
|
|
52
52
|
* draw goes the cursor up that many, clears to the end of the screen and writes the new lines, in ONE write (no flicker).
|
|
53
53
|
* erase() takes the menu's own lines away before anything else speaks (a command's output, a question), so what stays in
|
|
54
|
-
* the scrollback is what happened, never a menu. A resize
|
|
55
|
-
* the
|
|
54
|
+
* the scrollback is what happened, never a menu. A resize takes the menu's own counted lines away and draws it once more;
|
|
55
|
+
* nothing above the menu (a command's output, a QR still waiting to be scanned) is ever cleared or written over. No line ever wraps: draw() cuts each to the terminal's width.
|
|
56
56
|
*/
|
|
57
57
|
export function createTerminal(input = process.stdin, output = process.stdout) {
|
|
58
58
|
let raw = false, drawn = 0;
|
|
@@ -60,7 +60,11 @@ export function createTerminal(input = process.stdin, output = process.stdout) {
|
|
|
60
60
|
const up = () => (drawn > 0 ? `\x1b[${drawn}A\r\x1b[J` : "");
|
|
61
61
|
const draw = (lines) => { const { columns } = size(); output.write(`${up()}${lines.map((line) => clip(line, columns - 1)).join("\n")}\n`); drawn = lines.length; };
|
|
62
62
|
const erase = () => { if (drawn > 0) output.write(up()); drawn = 0; };
|
|
63
|
-
|
|
63
|
+
// A RESIZE TAKES ONLY THE MENU'S OWN LINES (owner, 2026-11-14: a QR cut off halfway). It cleared the visible screen from its
|
|
64
|
+
// top (`ESC[H ESC[J`), and with it whatever a command had printed above the menu. Every line is clipped to the width, so a
|
|
65
|
+
// narrower terminal can only fold the menu into MORE rows than `drawn`: going up `drawn` rows lands inside the menu at worst
|
|
66
|
+
// (an old line may stay above the new menu), never in the output above it.
|
|
67
|
+
const reset = () => erase();
|
|
64
68
|
/** Text that is not the menu (a reason, a result): the menu's lines go first, and the next draw starts below it. */
|
|
65
69
|
const write = (text) => { erase(); output.write(text); };
|
|
66
70
|
const enter = () => { emitKeypressEvents(input); if (input.isTTY && !raw) { input.setRawMode(true); raw = true; } input.resume(); output.write("\x1b[?25l"); };
|
|
@@ -169,15 +173,17 @@ let busy = false;
|
|
|
169
173
|
/**
|
|
170
174
|
* Run one direct command with the terminal handed over, then wait for a key before the menu comes back. The menu's own
|
|
171
175
|
* lines are taken away first, so the scrollback reads: the command, its output, how it ended. The menu is then drawn once
|
|
172
|
-
* below (the next draw starts fresh).
|
|
176
|
+
* below (the next draw starts fresh). `pause: false` (0.11.10, look): no key is waited for and the code comes back, so a
|
|
177
|
+
* list can follow the command's output at once.
|
|
173
178
|
*/
|
|
174
|
-
export async function runShown(term, io, args, label = null) {
|
|
179
|
+
export async function runShown(term, io, args, label = null, { pause = true } = {}) {
|
|
175
180
|
term.restore();
|
|
176
181
|
busy = true;
|
|
177
182
|
term.write(` ${muted(`› npx worktrust ${args.join(" ")}`.trimEnd())}${label ? ` ${label}` : ""}\n\n`);
|
|
178
183
|
let code = 1;
|
|
179
184
|
try { code = await io.runCli(args); } catch { code = 1; } finally { busy = false; }
|
|
180
185
|
term.enter();
|
|
186
|
+
if (!pause) return code;
|
|
181
187
|
term.write(`\n ${code === 0 ? paint.green("✓ Done.") : paint.yellow("! It ended with a message above.")} ${muted("Press any key for the menu.")}\n`);
|
|
182
188
|
const k = await term.anyKey();
|
|
183
189
|
return !(k.ctrl && k.name === "c");
|
|
@@ -228,23 +234,30 @@ export function headerLines(state) {
|
|
|
228
234
|
return [
|
|
229
235
|
title,
|
|
230
236
|
row("Account", state.account ?? "not recorded: run Check this computer"),
|
|
237
|
+
row("Account type", PLAN_WORDS[state.plan] ?? "not known"), // the server's answer (api/cli/door), never guessed here
|
|
231
238
|
row("This computer", `${host.length > 28 ? `${host.slice(0, 27)}…` : host} · connected since ${/^\d{4}-\d{2}-\d{2}/.test(String(state.since ?? "")) ? String(state.since).slice(0, 10) : "-"}`),
|
|
232
|
-
row("Remote Agent", remote.links === null || ["not set up", "off"].includes(remote.word) ? remote.word : `${remote.word}, ${remote.links} connection${remote.links === 1 ? "" : "s"}`),
|
|
239
|
+
row("Remote Agent", `${remote.links === null || ["not set up", "off"].includes(remote.word) ? remote.word : `${remote.word}, ${remote.links} connection${remote.links === 1 ? "" : "s"}`}${state.remoteAccess === "premium_required" ? " · needs Premium" : ""}`),
|
|
233
240
|
row("Sharing", `session hook ${known(state.hook, "on", "not installed")} · AI apps ${state.door === "off" ? "off" : state.door === "on" ? `on${Number.isInteger(state.apps) ? ` (${state.apps})` : ""}` : "not known"} · Remote Agent ${remote.word === "not set up" ? "off" : remote.word}`),
|
|
234
241
|
];
|
|
235
242
|
}
|
|
236
243
|
|
|
244
|
+
/** The account's plan in words (owner, 2026-11-14), as WorkTrust answered it; anything else, or no answer, is "not known". */
|
|
245
|
+
const PLAN_WORDS = { free: "Free", premium: "Premium" };
|
|
237
246
|
const HELP = (open) => ({ label: "Help · all commands", hint: "npx worktrust help", info: "Lists all commands. npx -y worktrust skips npm's question.", run: () => open(["help"]) });
|
|
238
247
|
const QUIT = { label: "Quit", hint: "q", info: "Leaves the menu. Nothing keeps running.", quit: true };
|
|
239
248
|
const PRESERVE = (sub, info) => ({ label: "Preserve evidence ›", hint: "npx worktrust preserve …", info, run: () => sub.preserve?.() });
|
|
249
|
+
/** 0.11.10 (owner, 2026-11-14): the first row before sign-in; the table, then what to do with it (cli-look.mjs lookMenu). */
|
|
250
|
+
const LOOK = (sub) => ({ label: "Look at this computer", hint: "npx worktrust look", info: "Reads what your AI apps recorded here. Nothing is sent.", run: () => sub.look?.() });
|
|
240
251
|
|
|
241
252
|
/**
|
|
242
253
|
* THE FIRST MENU (0.11.9, owner 2026-11-14): what a computer that is not connected can do, and nothing that needs a
|
|
243
254
|
* connected one (no Update, Remote Agent, Import, AI apps switch, Status, Disconnect). Preserve needs no account, no key
|
|
244
|
-
* and no network at any of its levels (preserve.mjs; worktrust.mjs loads no key for it), so all of it stays.
|
|
255
|
+
* and no network at any of its levels (preserve.mjs; worktrust.mjs loads no key for it), so all of it stays. 0.11.10: Look at this computer comes
|
|
256
|
+
* first, the table of what the AI apps recorded here (`look`, reads only), then Connect or Preserve with it.
|
|
245
257
|
*/
|
|
246
258
|
export function firstItems(open = () => true, sub = {}) {
|
|
247
259
|
return [
|
|
260
|
+
LOOK(sub),
|
|
248
261
|
{ label: "Connect this computer", hint: "npx worktrust connect", info: "Asks before it writes; your browser signs in to WorkTrust.", run: () => open(["connect"]) },
|
|
249
262
|
PRESERVE(sub, "Keep your AI history here. No account; nothing is sent."),
|
|
250
263
|
HELP(open), QUIT,
|
|
@@ -253,9 +266,9 @@ export function firstItems(open = () => true, sub = {}) {
|
|
|
253
266
|
|
|
254
267
|
/** Why the first menu still stands after Connect ran, in one line, by how the command ended (0 without a key: a No or a dry run). */
|
|
255
268
|
export function connectReason(code) {
|
|
256
|
-
if (code === 0) return "Connect stopped before the sign-in; nothing was written.
|
|
257
|
-
if (code === 130) return "Connect was cancelled; this computer is not connected.
|
|
258
|
-
return "Connect ended with the message above; not connected.
|
|
269
|
+
if (code === 0) return "Connect stopped before the sign-in; nothing was written. 2 tries again.";
|
|
270
|
+
if (code === 130) return "Connect was cancelled; this computer is not connected. 2 tries again.";
|
|
271
|
+
return "Connect ended with the message above; not connected. 2 tries again.";
|
|
259
272
|
}
|
|
260
273
|
|
|
261
274
|
/**
|
|
@@ -277,7 +290,8 @@ export function topItems(state, open = () => true, sub = {}) {
|
|
|
277
290
|
// Node before 22.4 has no WebSocket (0.11.8): the item stays, says why, and Enter opens the ways forward, not the levels.
|
|
278
291
|
state.remoteBlocked
|
|
279
292
|
? { label: "Remote Agent", note: { text: "needs Node 22.4+", tone: "yellow" }, hint: "npx worktrust remote …", info: REMOTE_NEEDS, run: () => open(["remote"]) }
|
|
280
|
-
|
|
293
|
+
// REMOTE AGENT IS PART OF PREMIUM (owner, 2026-11-14): only the server's own `premium_required` locks it; the row stays.
|
|
294
|
+
: { label: "Remote Agent ›", hint: "npx worktrust remote …", run: () => sub.remote?.(), ...(state.remoteAccess === "premium_required" ? { note: { text: "Premium", tone: "yellow" }, info: "Part of Premium. Enter shows how to upgrade." } : { info: "Steer this computer's agents from your phone." }) },
|
|
281
295
|
{ label: "Import earlier history ›", hint: "npx worktrust history …", info: "Send earlier sessions as history. Each way asks first.", run: () => sub.history?.() },
|
|
282
296
|
PRESERVE(sub, "Keep your AI history on this computer. Nothing is sent."),
|
|
283
297
|
{ label: "Sharing ›", hint: "npx worktrust mcp …", info: "What this computer sends, and the switches for it.", run: () => sub.sharing?.() },
|
|
@@ -296,13 +310,13 @@ export async function menuLoop(term, io, levels) {
|
|
|
296
310
|
let last = null, state = null; // the command the top level ran last and how it ended; this computer's state as last read
|
|
297
311
|
const read = async () => (state = { ...(await busyWith("Reading this computer's state", () => io.state())), remoteBlocked: typeof globalThis.WebSocket !== "function" });
|
|
298
312
|
// A deeper level reads the state again after each of its commands (inner.state), so the head above it is true at once.
|
|
299
|
-
const inner = { runCli: (args) => io.runCli(args), state: read };
|
|
313
|
+
const inner = { runCli: (args) => io.runCli(args), state: read, openUrl: (url) => io.openUrl?.(url) };
|
|
300
314
|
for (;;) {
|
|
301
315
|
await read();
|
|
302
316
|
const why = !state.connected && last?.args[0] === "connect" ? connectReason(last.code) : null;
|
|
303
317
|
const header = () => [...headerLines(state), ...(why ? [` ${paint.yellow(`! ${why}`)}`] : [])];
|
|
304
318
|
const open = (args) => { const ran = { args, code: 1 }; last = ran; return runShown(term, { runCli: async (given) => (ran.code = await io.runCli(given)) }, args); };
|
|
305
|
-
const items = topItems(state, open, Object.fromEntries(["remote", "history", "preserve", "sharing"].map((name) => [name, () => levels[`${name}Menu`](term, inner, header)])));
|
|
319
|
+
const items = topItems(state, open, { ...Object.fromEntries(["remote", "history", "preserve", "sharing"].map((name) => [name, () => levels[`${name}Menu`](term, inner, header)])), look: async () => (await import("./cli-look.mjs")).lookMenu(term, inner, levels) });
|
|
306
320
|
const picked = await choose(term, { header, items, top: true });
|
|
307
321
|
if (picked === "quit" || picked === "back" || picked.item.quit) break;
|
|
308
322
|
last = null;
|
|
@@ -310,7 +324,7 @@ export async function menuLoop(term, io, levels) {
|
|
|
310
324
|
}
|
|
311
325
|
}
|
|
312
326
|
|
|
313
|
-
/** The top of the menu. `io`: { runCli(args) → Promise<code>, state() → { version, installed, latest, latestKnown, account, connected, door, host, since, hook, apps } }. */
|
|
327
|
+
/** The top of the menu. `io`: { runCli(args) → Promise<code>, state() → { version, installed, latest, latestKnown, account, connected, door, host, since, hook, apps, plan, remoteAccess, upgrade }, openUrl(url) }. */
|
|
314
328
|
// (remoteBlocked is added here: whether this Node lacks the WebSocket Remote Agent needs.)
|
|
315
329
|
export async function runMenu(io) {
|
|
316
330
|
paint = coloursFor(process.stdout);
|
package/engine-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","cli-colour.mjs":"fa16b61ad179999c5c5365255182acf69bcba1eb5f5ce7b0e1e18c11f56130ae","cli-menu-remote.mjs":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","cli-colour.mjs":"fa16b61ad179999c5c5365255182acf69bcba1eb5f5ce7b0e1e18c11f56130ae","cli-look.mjs":"1bcc1314f53a4b886d19ac7a4eb4010b5e86d9e00b8e880ccbcd43f515c6dfd9","cli-menu-remote.mjs":"8e933adf5c849f28cd1fcec879ff8480794a15d34a6be25585e68454d8512bf6","cli-menu.mjs":"67928264a9cb7fcf4a4bb2ee546cba1eee36c180ea76bd669834c33d9508fc89","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"06b0ecbc222087160dc64c0b302391631e8e799038364c317c6cd28449c5044d","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","folder-picker.mjs":"daeb379626d5716f91f588064c6b4083618279320c006c177960cc93f056d96a","git-commits.mjs":"af0ed45a2a42c8e17cabfb3649a2f524dbf80230f8a6ec1c6b775fed7d34dc9c","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"171f4abb0d603d58446129e007de9e9dc0f707bde33b1b4481a134376ed301c8","node-guide.mjs":"5bf52c5028b07a80ec4d41be365eb025dfce74328f41f928a26ce6737b1f9cc4","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","project-modes.mjs":"ada26e68297fbeb90e4e91d75a90fd2d7cc107b999a9702840675b5a7529463e","remote-adapter-claude-code.mjs":"d0558bb123a29a934db1bf8162e7c3f37e8ccde4c502178d47e9b4cbb3a0491b","remote-adapter-codex.mjs":"d2fd6c61d9e3c4a45e9b10da1aa3c15d45c86629d6456e4a8d25ad95b13eb209","remote-adapter-opencode.mjs":"ddd7f3ec0b4ba92f4744453d60fda338b63550e3ec7b23fa3acc668df1d64eb7","remote-adapter-terminal.mjs":"c047a362474abb90b7968b8a624358af40a989ad137166a03bc955409ff1dc82","remote-admin.mjs":"ac4d434c0a374159b27accac3fdd0324ff96ffe32227fba054cc62d00e58d35b","remote-agent-switch.mjs":"7ff5448f29f05a47d7298d730b21243a1bcf8a215b434a0c7fbf5f3cb0889041","remote-approval-bridge.mjs":"092f17b7969e4f35bea064315d04dcde1faa6a3fd3e737dcc05aece82c7a37c4","remote-approvals.mjs":"63847226e398f9eb5b8d3989ba2b2436fbedd898385eb5f2f63bbdf07fbe6852","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-cdp.mjs":"70e333a1ebe845e872cc3a703a0a507391f8ce59640bdbd662bdad55eeff216b","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"fa3ada1e8845855789d61daac8c69853d81dcde25dfbffc223d6fed17c7efa94","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-connections.mjs":"1863863930f6df968084571be16c2382fbb0ba3ae64e26a9f9c90a7f9bf0b157","remote-countdown.mjs":"85cf2d01fe5ca49895e08a3d5de346bb5e4a8dd31b9fda3fd9f9534d9e1e47cf","remote-daemon.mjs":"94d4896b0e1203f7a5bc7224a6221a36f4c20be89caee78b3ab37b9b6a2dac1d","remote-endorse.mjs":"89eda4883567176703e01e44d83e987271bc2a6134e108f517b3b213719a21f9","remote-inventory.mjs":"a8245604d41373819738eaf06ec1d2242cb5f7b2e60aa316f31d2f8742b8c70d","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-live-preview.mjs":"faa70f9260ac05037204c2a0c3facf4ffe42f68408948390b341b453a2932289","remote-opencode-events.mjs":"3108375501ead2c2c78bce1435cc2a9fe6d2af1d7ff1fb42e12ff3e0f5d9af9c","remote-opencode-session.mjs":"681b201d833a7d7d025122b3a79663bcdc0a989aefd39d8018a28113d8810caf","remote-pairing.mjs":"f42bfb9c0b19ba3363c7b1c3d98cbd01c2bc7856acd763bf9e8ee53fefeccf2a","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"16ea015ad5de3c357bce730ea8ea98571dc981d8591fb5156b1941b2c557a381","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"ec8c530ad3e880bca21a4d4078ecd68b6aaafcc442b50087127868d952034d5f","remote-protocol.mjs":"93f8c2031895d4e01006a1951d7c0e79ef71b86b2777eed5dfa966ab131e446d","remote-qr.mjs":"73e7743c33e35b1b01d6df3260e876beab419179265aa201a101596b4a813d86","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"5dce92062a4e5073b17860223bf1fc7362a23c620d81c8df535b8a580f590fe8","remote-screen-approvals.mjs":"c43ab286d36a38d17639d155782ffa017f1a9b6806a09b82ed0142a1290b6000","remote-screen-push.mjs":"4ee8bd48d24b2c87581e9f33d8354a86381f7febd82f89ed509a7a87c1442608","remote-screen-states.mjs":"7c3c86a584bebf52461f3cab39c05ea2a13910061704d48fc622956e842940f7","remote-service.mjs":"a3a5502e0f6f43b04e37ee778f43d88f4c219776439cfed0d8fa0b511e0c9637","remote-session-list.mjs":"494fdbe20f0542806ac6c42ad149c52e2d3ace23a3a7567f96dc7e80d092c727","remote-sessions.mjs":"1efb7869cef6090cbbeae15ff1e5ffe99dca3742f9c245686d6758bb705587d6","remote-settings.mjs":"ca16f39416a457bd5ceb1df847596e1b4bcd2894310eb6514664a619dee4981f","remote-steered.mjs":"d7afde92c62c87abbdb84b0cfea2eea4752e90a2e453e52a54812c4fe0395190","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"592a87f0ab8f53cc8eee1318a309310e27cb01d4549caebad6d51c3fad1b75ac","remote-terminal-cli.mjs":"82a048b75e412d0b6db076afbb84cab7c754dec72b6c8b6af4d4906b38e988a7","remote-terminal-sessions.mjs":"6ab51824890a18768d23cedc499f3840b2b02a8ed651463c1fe2d74dd352a361","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"a16ffbc50ccc0e78f370ebe07f871d1a80f1977472e478e3599e7abfdc90c1b7","session-local-models.mjs":"bacd38ff8dd3056b552982ec52eb57c7b8ca86e1a46cd4cba30fc340e3e28fd4","session-readers.mjs":"05974f8dc97844f011cb409789f52089b5f21d37848ed1490e640caf4eab92e6","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"4e6b36faf58082ab6531345bf56115957322786dcfd2263dba7536ef2534ccea"},"format":"worktrust-package/1","kind":"engine","version":"0.11.10"},"signature":"DSgN6BM_8GBDweufi6IkqxgVmXGmynQMcH7M4COB1DygIaOSAFW5itgWL-gNV642IEpRXT9zea6qdn__NJibDg"}
|