worktrust 0.10.38 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -18
- package/README.md +46 -2
- package/SECURITY.md +25 -0
- package/engine-release.json +1 -1
- package/log-session.mjs +6 -6
- package/package-release.json +1 -1
- package/package.json +35 -2
- package/remote-adapter-claude-code.mjs +111 -0
- package/remote-adapter-codex.mjs +119 -0
- package/remote-approval-bridge.mjs +122 -0
- package/remote-approvals.mjs +124 -0
- package/remote-attachments.mjs +129 -0
- package/remote-changes.mjs +94 -0
- package/remote-claude-events.mjs +212 -0
- package/remote-claude-progress.mjs +328 -0
- package/remote-cli.mjs +325 -0
- package/remote-coalesce.mjs +40 -0
- package/remote-codex-events.mjs +153 -0
- package/remote-daemon.mjs +205 -0
- package/remote-inventory.mjs +132 -0
- package/remote-journal.mjs +155 -0
- package/remote-pairing.mjs +104 -0
- package/remote-pipeline-config.mjs +177 -0
- package/remote-pipeline-parsers.mjs +121 -0
- package/remote-pipeline.mjs +234 -0
- package/remote-policy.mjs +199 -0
- package/remote-preview.mjs +146 -0
- package/remote-projects.mjs +87 -0
- package/remote-protocol.mjs +3881 -0
- package/remote-qr.mjs +175 -0
- package/remote-release-plans.mjs +88 -0
- package/remote-releases.mjs +297 -0
- package/remote-run.mjs +174 -0
- package/remote-service.mjs +101 -0
- package/remote-session-list.mjs +25 -0
- package/remote-sessions.mjs +348 -0
- package/remote-steered.mjs +114 -0
- package/remote-steering.mjs +97 -0
- package/remote-store.mjs +123 -0
- package/remote-transport.mjs +88 -0
- package/worktrust.mjs +11 -4
package/LICENSE
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
WorkTrust CLI Licence
|
|
2
2
|
|
|
3
|
-
Version 1.
|
|
4
|
-
Status: draft, subject to legal review.
|
|
3
|
+
Version 1.1, in force from WorkTrust CLI version 0.10.39 (7 November 2026).
|
|
5
4
|
|
|
6
|
-
Copyright (c) 2026
|
|
5
|
+
Copyright (c) 2026 Oravita B.V. (WorkTrust), registered with the Dutch Chamber of
|
|
7
6
|
Commerce (KvK) under number 98076051. All rights reserved.
|
|
8
7
|
|
|
9
8
|
1. What this licence covers
|
|
10
9
|
|
|
11
10
|
"The Software" means the WorkTrust command-line tool in every form in which
|
|
12
|
-
|
|
11
|
+
Oravita B.V. distributes it: the "worktrust" package on npm, the "worktrust"
|
|
13
12
|
package on PyPI, the scripts served from worktrust.io, the WorkTrust preservation
|
|
14
13
|
kit, and the files these install on a computer (including the WorkTrust mod for
|
|
15
|
-
Claude Code), together with their documentation
|
|
16
|
-
|
|
14
|
+
Claude Code), together with their documentation and their source code wherever
|
|
15
|
+
it is published, including the public repository github.com/fhomey/worktrust-cli
|
|
16
|
+
and any copy or fork of it. "You" means the person or organisation that obtains,
|
|
17
|
+
reads, installs or runs the Software.
|
|
18
|
+
|
|
19
|
+
By downloading, installing, running or reading the source code of the Software,
|
|
20
|
+
you accept this licence. If you do not accept it, do none of these things.
|
|
17
21
|
|
|
18
22
|
2. What you may do
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
Oravita B.V. grants the licences below free of charge. Each is non-exclusive,
|
|
21
25
|
non-transferable, non-sublicensable and revocable, and covers installing and
|
|
22
26
|
running the unmodified Software on computers you own or control.
|
|
23
27
|
|
|
@@ -40,10 +44,12 @@ running the unmodified Software on computers you own or control.
|
|
|
40
44
|
Software and run it to evaluate it.
|
|
41
45
|
|
|
42
46
|
You may make the copies needed to install and run the Software and a reasonable
|
|
43
|
-
number of backup copies. You may read the source code
|
|
44
|
-
what the Software does on your computer
|
|
45
|
-
to report a security problem as described in SECURITY.md. Being
|
|
46
|
-
source code gives you no other right
|
|
47
|
+
number of backup copies. You may read the source code for one purpose only: to
|
|
48
|
+
understand and check what the Software does on your computer. You may test it on
|
|
49
|
+
your own computer to report a security problem as described in SECURITY.md. Being
|
|
50
|
+
able to read the source code gives you no other right, and a copy or fork made on
|
|
51
|
+
a code-hosting platform (such as the fork that GitHub's terms allow on a public
|
|
52
|
+
repository) gives no right to use the code at all.
|
|
47
53
|
|
|
48
54
|
3. What you may not do
|
|
49
55
|
|
|
@@ -61,7 +67,23 @@ Except as section 2 allows or mandatory law permits, you may not:
|
|
|
61
67
|
f. remove or change any copyright notice, this licence or any other notice in
|
|
62
68
|
the Software; or
|
|
63
69
|
g. present a modified or rebuilt copy as the Software or as an official
|
|
64
|
-
WorkTrust release
|
|
70
|
+
WorkTrust release;
|
|
71
|
+
h. use the Software, its source code, its documentation, or anything you
|
|
72
|
+
learned from reading them, as a model, reference, template or starting point
|
|
73
|
+
for any software, product or service other than the WorkTrust service. This
|
|
74
|
+
includes reimplementing, porting, translating or rewriting it in another
|
|
75
|
+
programming language; reproducing its structure, sequence and organisation,
|
|
76
|
+
its protocols, message formats or interfaces; and giving it to another
|
|
77
|
+
person or to an AI system to do any of these things;
|
|
78
|
+
i. use any of the above to design, build, operate or improve a platform,
|
|
79
|
+
product or service of your own or of anyone else, whether or not it
|
|
80
|
+
competes with WorkTrust; or
|
|
81
|
+
j. allow or help anyone else to do anything this section forbids.
|
|
82
|
+
|
|
83
|
+
The Software may only be used for the WorkTrust service, in the ways section 2
|
|
84
|
+
describes. The restrictions in this section are contractual obligations: they
|
|
85
|
+
apply also where copyright alone would not prevent the act, and they bind anyone
|
|
86
|
+
who obtains the source code, from any source.
|
|
65
87
|
|
|
66
88
|
Nothing in this licence restricts what mandatory law allows a lawful user of a
|
|
67
89
|
computer program to do, including the acts permitted by Articles 5 and 6 of
|
|
@@ -69,20 +91,22 @@ Directive 2009/24/EC as implemented in the Dutch Copyright Act (Auteurswet).
|
|
|
69
91
|
|
|
70
92
|
4. Ownership and all rights reserved
|
|
71
93
|
|
|
72
|
-
The Software is licensed, not sold.
|
|
94
|
+
The Software is licensed, not sold. Oravita B.V. (WorkTrust) retains all right,
|
|
73
95
|
title and interest in the Software and keeps all rights that this licence does
|
|
74
96
|
not expressly grant. This licence grants no right to the name WorkTrust, its
|
|
75
97
|
logos or other marks.
|
|
76
98
|
|
|
77
99
|
The archives, reports and other files the Software produces from your own data
|
|
78
|
-
belong to you. This licence gives
|
|
100
|
+
belong to you. This licence gives Oravita B.V. no right to them; what you send to
|
|
79
101
|
the WorkTrust service is governed by the service's terms and privacy statement.
|
|
80
102
|
|
|
81
103
|
5. Earlier versions
|
|
82
104
|
|
|
83
105
|
Versions of the Software up to and including 0.10.17 were published under the MIT
|
|
84
106
|
licence. Those versions remain available under that licence for those versions
|
|
85
|
-
only.
|
|
107
|
+
only. Versions 0.10.18 up to and including 0.10.38 were published under version
|
|
108
|
+
1.0 of this licence. This version 1.1 applies to version 0.10.39 and every later
|
|
109
|
+
version.
|
|
86
110
|
|
|
87
111
|
6. Third-party components
|
|
88
112
|
|
|
@@ -103,10 +127,11 @@ https://worktrust.io/privacy. This licence grants no right to the service.
|
|
|
103
127
|
|
|
104
128
|
8. Termination
|
|
105
129
|
|
|
106
|
-
This licence ends automatically if you breach it.
|
|
130
|
+
This licence ends automatically if you breach it. Oravita B.V. may also end it by
|
|
107
131
|
notice, for example when it ends the WorkTrust service. When it ends, you must
|
|
108
132
|
stop using the Software and delete every copy you hold. Sections 3, 4, 9, 10 and
|
|
109
|
-
11 survive termination.
|
|
133
|
+
11 survive termination. A breach of section 3 entitles Oravtia B.V. to every remedy the
|
|
134
|
+
law provides, including an injunction and compensation for its damage.
|
|
110
135
|
|
|
111
136
|
9. No warranty
|
|
112
137
|
|
|
@@ -117,7 +142,7 @@ without interruption.
|
|
|
117
142
|
|
|
118
143
|
10. Limitation of liability
|
|
119
144
|
|
|
120
|
-
To the fullest extent the law allows,
|
|
145
|
+
To the fullest extent the law allows, Oravita B.V. is not liable for any damage
|
|
121
146
|
arising from or in connection with the Software or its use, whether in contract,
|
|
122
147
|
tort or otherwise, including loss of data, profit or business. This does not
|
|
123
148
|
limit liability for intent or deliberate recklessness, or any liability that
|
package/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# worktrust
|
|
2
2
|
|
|
3
|
+
## 0.11.0: steer your own agents from your phone
|
|
4
|
+
|
|
5
|
+
`npx worktrust remote` pairs this computer with the WorkTrust app and lets the phone steer the coding agents that run
|
|
6
|
+
here (Claude Code and Codex): start a chat in a project, choose the agent and its model from the ones this computer
|
|
7
|
+
reports, send photos and files into the project's inbox (at most 25 MB a file), approve what the agent asks, and follow
|
|
8
|
+
its work. Everything between the phone and this computer is sealed end to end; the relay passes it without reading it.
|
|
9
|
+
The local agent plans its own work with three tools on its session (a release, its tasks, their state and estimate), so
|
|
10
|
+
the phone's Status shows one table of what runs, what waits ("after release 22") and what ended. A session reports its
|
|
11
|
+
active time, the background jobs an agent left running, and, inside a git worktree, the repository it belongs to. A
|
|
12
|
+
local preview renders a dev server you allowed, as desktop, tablet or phone, with this computer's own browser. A phone
|
|
13
|
+
app from before this version cannot read what 0.11.0 sends: update both. What is measured for the passport is unchanged:
|
|
14
|
+
remote-steered sessions never count as your hours, and the measure rules stay 3.
|
|
15
|
+
|
|
3
16
|
## 0.10.38: an export says what it can about its own clock
|
|
4
17
|
|
|
5
18
|
`npx worktrust history --export` now sends, beside each run's timeline, the facts WorkTrust checks to tell an edited
|
|
@@ -697,6 +710,34 @@ does not offer its earlier work. Other retained files and your local evidence ar
|
|
|
697
710
|
automatic server or archive erasure.
|
|
698
711
|
Then revoke the key in WorkTrust: Sources → Devices → this computer → Revoke.
|
|
699
712
|
|
|
713
|
+
## Remote agents: steer this computer's agents from your phone (`npx worktrust remote`, not yet released)
|
|
714
|
+
|
|
715
|
+
Off until you run `npx worktrust remote enable` at this keyboard; an AI agent's shell is refused every `remote` command
|
|
716
|
+
except `status`.
|
|
717
|
+
|
|
718
|
+
- `enable` makes a REMOTE key pair for this computer (Ed25519 and X25519, files of mode 0600 in `~/.worktrust/remote/`),
|
|
719
|
+
never the measurement key, and has it approved in WorkTrust with your second factor; then it starts a service while you
|
|
720
|
+
are logged in (launchd on macOS, a systemd user unit on Linux, linger off; on Windows `npx worktrust remote run` in a
|
|
721
|
+
terminal) and draws a QR code for the WorkTrust app. `pair` draws a new one: five minutes, one phone, once. A phone
|
|
722
|
+
that scanned it is confirmed; one that typed the code instead waits for `npx worktrust remote phones confirm`.
|
|
723
|
+
- `projects add <folder>` grants a folder (its real path; never your home folder, the disk's root or a folder holding
|
|
724
|
+
keys, keychains, browser profiles or wallets). A phone starts agents only in granted folders, several at once (four by
|
|
725
|
+
default).
|
|
726
|
+
- From a phone you may approve: a file edit inside the project, a test, build or lint command from a short reviewed list,
|
|
727
|
+
and a message an agent sends through a connector, shown whole (channel, every recipient, subject, text, attachment
|
|
728
|
+
names). Everything else is decided at this keyboard or not at all: installs from the network, `git push`, deploys,
|
|
729
|
+
deleting outside the project, reading secret files, any "always allow". It is denied on this computer, and the phone is
|
|
730
|
+
told why.
|
|
731
|
+
- One outbound connection to the WorkTrust gateway, end-to-end encrypted: the gateway relays sealed messages and reads no
|
|
732
|
+
prompt, file, path, output or model name. No port is opened on this computer.
|
|
733
|
+
- A session steered from a phone is never your AI Hours: the service records it in `~/.worktrust/remote/steered.jsonl`
|
|
734
|
+
before the agent starts, and the session hook sends it as an agent run (`session_kind` headless, `steered_from`
|
|
735
|
+
remote).
|
|
736
|
+
- `status`, `pause`, `resume`, `disable` (the hard off; `--forget` also deletes the remote keys), `phones`, `projects`.
|
|
737
|
+
|
|
738
|
+
Remote needs Node 22.4 or later (the Python package bundles one). The production gateway is not live yet; nothing
|
|
739
|
+
connects until one is set.
|
|
740
|
+
|
|
700
741
|
## Requirements
|
|
701
742
|
|
|
702
743
|
Node 18 or later for the base CLI. SQLite session readers require Node 22.5 or later with `node:sqlite`;
|
|
@@ -709,11 +750,14 @@ Security reports: see [SECURITY.md](SECURITY.md).
|
|
|
709
750
|
|
|
710
751
|
## Licence
|
|
711
752
|
|
|
712
|
-
Use is allowed under the WorkTrust CLI Licence; copying, modifying or redistributing the
|
|
753
|
+
Use is allowed under the WorkTrust CLI Licence, for the WorkTrust service only; copying, modifying or redistributing the
|
|
754
|
+
code is not, and neither is using it, or what you learned from reading it, as a model for any other product or
|
|
755
|
+
platform (rewriting, porting or translating it included). See LICENSE.
|
|
713
756
|
The licence is free of charge. `preserve` (with `--apply`, `--archive`, `--verify` and `--summary`) is for everyone,
|
|
714
757
|
with or without an account; every other feature is for WorkTrust account holders, and without an account the rest may
|
|
715
758
|
only be installed and evaluated. The archives and files the CLI makes from your own data are yours.
|
|
716
|
-
|
|
759
|
+
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
|
|
760
|
+
including 0.10.17 were published under the MIT licence and stay under it.
|
|
717
761
|
|
|
718
762
|
## Release signatures and the limits of verification
|
|
719
763
|
|
package/SECURITY.md
CHANGED
|
@@ -209,6 +209,31 @@ the platform keeps only the listed keys, from a CLI key alone, and shows them to
|
|
|
209
209
|
`worktrust mod remove` and `worktrust disconnect` take it out of the settings and delete the plugin
|
|
210
210
|
and its counts.
|
|
211
211
|
|
|
212
|
+
## Remote agents (`npx worktrust remote`, not yet released)
|
|
213
|
+
|
|
214
|
+
What it is: standing remote execution of AI agents on this computer, steered from a confirmed phone. Its limits:
|
|
215
|
+
|
|
216
|
+
- Separate key, separate audience. The remote keys (`~/.worktrust/remote/remote-keys.json`, 0600) are not the measurement
|
|
217
|
+
key and no remote module reads the measurement credentials (`scripts/check-remote-cli.mjs` refuses one that names them).
|
|
218
|
+
Bindings are verified against issuer keys pinned in the release; a test-only issuer key is honoured only for a gateway on
|
|
219
|
+
this computer's loopback.
|
|
220
|
+
- Controllers are confirmed here. A phone becomes a controller by scanning the QR this terminal draws (its secret proves
|
|
221
|
+
it saw this screen and is mixed into the first handshake) or by a typed code confirmed at this keyboard. The issuer alone
|
|
222
|
+
cannot add a controller. `remote phones remove` drops one at once.
|
|
223
|
+
- The gateway reads no content: commands and events are sealed between the phone and this computer (XChaCha20-Poly1305
|
|
224
|
+
under keys from an authenticated X25519 handshake). The gateway sees ids, message types, times and size classes.
|
|
225
|
+
- At most once. Every command is written to `~/.worktrust/remote/journal.jsonl` and flushed to disk before an agent runs; a
|
|
226
|
+
repeat is answered from the journal, and a command an interrupted daemon left mid-way is closed as failed, never run again.
|
|
227
|
+
- Approvals are classified on this computer. Only project edits, the reviewed test, build and lint commands, and outward
|
|
228
|
+
messages shown whole can be approved from a phone, each by a signed decision bound to the exact action, single use,
|
|
229
|
+
five minutes at most; offline or no answer is a denial. Claude Code also gets deny rules for pushes, installs, deploys
|
|
230
|
+
and secret reads, and loads only your user settings, so a repository's own rules or hooks do not apply remotely.
|
|
231
|
+
- What it does not stop: an approved test command runs the project's own test code, which can do what that code does;
|
|
232
|
+
grant only folders whose code you trust. The phone's keys are on the phone: until you revoke it, whoever unlocks it can
|
|
233
|
+
steer agents within these rules. macOS asks for folder access per program, so the access you grant the service's `node`
|
|
234
|
+
covers every script that `node` runs.
|
|
235
|
+
- Hours. A remote-steered session is never your AI Hours (see README).
|
|
236
|
+
|
|
212
237
|
## Python distribution and explicit agent observations
|
|
213
238
|
|
|
214
239
|
The official [PyPI package](https://pypi.org/project/worktrust/) runs the same measurement
|
package/engine-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"179baf829eda488bab3f17ae6917473ec01d0d6346f47de7bc144351274f19c8","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"179baf829eda488bab3f17ae6917473ec01d0d6346f47de7bc144351274f19c8","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"eb3bc0972bc30788521a492e136ed792d8265e0c5b8aede81fec4f3e071a25d0","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","remote-adapter-claude-code.mjs":"fe11c7fd37b570404e90fe53c11b471c2b5f114e8616bcdc281792cb000ecaf4","remote-adapter-codex.mjs":"44c41bc92a12ea6aa2232d67ba4a02f335aaea1429816e9a9e3eb3911a97cb3a","remote-approval-bridge.mjs":"9661bb2d698aed1c788246506e842dfaa4507d5357e454bf67b5b4b65da1621d","remote-approvals.mjs":"c033f36d261b3a5be552c9b02f92f30bd7217c8a1a55116fb514acb61e198c6f","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"85a6b26e332f6b89584edfa58bff6d753918cc391ca62bb02b9f344b0508db37","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-daemon.mjs":"c22eec13da604d262c116a7a389555dae8a3b68fd9de7df44dad178f3ea0ec63","remote-inventory.mjs":"d5a1c0180bab5c0522e73c913876050b9b36eb9ed06a8fa0e8e258ce54b67282","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-pairing.mjs":"ae03427b6510e52da08aaf9387d5e08516ee25380c7efa420432f4e1e936a7c5","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"aacf7578537021ab3849095bb1f58f0ed12c453c6ca2ab1352a1716fb13b0ca4","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"d07997167d1f51139ff010c8753639e48c5cd33688568459e184eabb12bfff84","remote-protocol.mjs":"f0beb91750397d1c6f0042fe716413cf8027684a84d4ed17bccee996cc5e2544","remote-qr.mjs":"b80e2b4a5bc020cf6ed92e91d06b327cb5197de1c35b3445a0fc2c7a3bf1ab3f","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"914af621d768abd126adda479f5ee7d52f3ed93c17897ab184c7116980b299e2","remote-service.mjs":"1b9d4ecf99b667f2ab7c78fe1dfd5cf507cbb36c5bcad15bfa2a88c313ae758e","remote-session-list.mjs":"0fc1e9df7997e28c8c9a63d3ae63347120fa91238b82ee05c1041b1e9d297ebd","remote-sessions.mjs":"24e24d0e574c40049edd7ae11d4cc98965f2a962bbd59c642a0ea7d6b74f5171","remote-steered.mjs":"fbbd3685a8cd497ae03235d258e2116e2129aac19046759fb2468fe79911f0b3","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"c68fd7b55d857cd4c06d0e53a5989c4f20e7f8e7add5e18443b3c16d864cabd1","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"b9fe20d7445205bdbf4cf2eaaf9cc770dad01e23d41e644b04930ca34e10426d","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"5321c67b7bb0699780a155d87473a4975ef81e47deada06f7d5b5bde9a973f98"},"format":"worktrust-package/1","kind":"engine","version":"0.11.0"},"signature":"XUqwPAZcSahQg_tFdNCH6CNIf6IB_pas98SfH_-aNjmJQLNIcRk07tpLiUc31LhKXbUsyuEzQ8sO7eHrKUYQBQ"}
|
package/log-session.mjs
CHANGED
|
@@ -66,7 +66,7 @@ import { dirname, join, resolve, sep } from "node:path";
|
|
|
66
66
|
import { fileURLToPath } from "node:url";
|
|
67
67
|
import { createHash, createHmac, createPrivateKey, createPublicKey, randomBytes, sign as cryptoSign } from "node:crypto";
|
|
68
68
|
|
|
69
|
-
import { moduleArgs, moduleExecutable, readPrivateFile, createPrivateFile } from "./package-integrity.mjs";
|
|
69
|
+
import { moduleArgs, moduleExecutable, readPrivateFile, createPrivateFile } from "./package-integrity.mjs"; import { remoteSteeredOf } from "./remote-steered.mjs"; // 2026-11-07: a day steered from a phone is measured headless, steered_from "remote", never the person's hours (owner decision 1)
|
|
70
70
|
|
|
71
71
|
async function main() {
|
|
72
72
|
const args = process.argv.slice(2), NODE_FLAGS = process.versions.node === "26.5.0" ? ["--no-concurrent-sparkplug"] : [];
|
|
@@ -244,7 +244,7 @@ const { stackOfFiles = () => [], displayStackOfFiles = () => [] } = (await impor
|
|
|
244
244
|
const EXPORT_PATHS = []; for (let i = 0; i < args.length; i += 1) if (args[i] === "--export" && args[i + 1]) EXPORT_PATHS.push(args[i + 1]);
|
|
245
245
|
const DATABASE_CLIENTS = ["hermes", "goose", "opencode", "openclaw", "cursor", "copilot", "gemini-cli"]; // the registry's keys, the name each line carries (0.10.35: Gemini CLI)
|
|
246
246
|
const LIVE_SOURCE = new RegExp(`^(codex|antigravity|${DATABASE_CLIENTS.join("|")}):`); // a sweep entry's id → the client it names (every database client, 0.6.16)
|
|
247
|
-
const READER_FILES = ["history-outbox.mjs", "transcript-readers.mjs", "session-databases.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "claude-mod.mjs"]; // 0.7.4: the derived record travels with the hook; 0.10.10: the export reader; 0.10.11: the stack rules; 0.10.15: the mod
|
|
247
|
+
const READER_FILES = ["history-outbox.mjs", "transcript-readers.mjs", "session-databases.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "stack-rules.mjs", "claude-mod.mjs", "remote-steered.mjs"]; // 0.7.4: the derived record travels with the hook; 0.10.10: the export reader; 0.10.11: the stack rules; 0.10.15: the mod
|
|
248
248
|
/** The roots this machine's transcripts live under; a test names its own. */
|
|
249
249
|
const claudeRoot = () => value("transcript-root") ?? join(homedir(), ".claude", "projects");
|
|
250
250
|
const codexRoot = () => { const given = value("codex-root"); if (given) return given.replace(/^~(?=\/|$)/, homedir()); return value("transcript-root") ? null : join(homedir(), ".codex", "sessions"); };
|
|
@@ -516,7 +516,7 @@ function stretchesOf(file, since, saved = null) {
|
|
|
516
516
|
messages.sort((a, b) => a.at - b.at);
|
|
517
517
|
const byDay = byDayOf(messages);
|
|
518
518
|
const agents = agentsByDay(file, since), session = kind.kind();
|
|
519
|
-
return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, ofDay]) => { const stretch = measure(cwd, ofDay,
|
|
519
|
+
return [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, ofDay]) => { const remote = remoteSteeredOf(file, ofDay), kindOf = remote ? "headless" : session; const stretch = measure(cwd, ofDay, kindOf); return stretch && { ...stretch, ref: stretchRef(file, day), steered: remote ? "remote" : steered, session: kindOf, agents: agents.get(day) ?? null, live: liveOf(file, day) }; }).filter(Boolean);
|
|
520
520
|
}
|
|
521
521
|
/** stretchesOf for a Claude Code transcript, from its read position when `saved` holds a usable one; `positionAt(t)` on the list is the position to keep. */
|
|
522
522
|
function claudeStretchesOf(file, since, saved) {
|
|
@@ -548,7 +548,7 @@ function claudeStretchesOf(file, since, saved) {
|
|
|
548
548
|
const byDay = byDayOf(messages), positions = {};
|
|
549
549
|
const agents = agentsByDay(file, since, saved?.a ?? null, positions), session = kind.kind();
|
|
550
550
|
subs = positions;
|
|
551
|
-
stretches = [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, ofDay]) => { const stretch = measure(cwd, ofDay,
|
|
551
|
+
stretches = [...byDay.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([day, ofDay]) => { const remote = remoteSteeredOf(file, ofDay), kindOf = remote ? "headless" : session; const stretch = measure(cwd, ofDay, kindOf); return stretch && { ...stretch, ref: stretchRef(file, day), steered: remote ? "remote" : steered, session: kindOf, agents: agents.get(day) ?? null, live: liveOf(file, day) }; }).filter(Boolean);
|
|
552
552
|
}
|
|
553
553
|
// A read that failed keeps no position: the next run reads the file whole.
|
|
554
554
|
if (!at.failed && at.end !== undefined && carry !== null) {
|
|
@@ -1335,7 +1335,7 @@ function historyEntries(floor = null, all = false) {
|
|
|
1335
1335
|
// The live window belongs to the hook: a stretch that log_work may still report is not history.
|
|
1336
1336
|
if (!all && Date.now() - last < WINDOW_HOURS * 3600_000) continue;
|
|
1337
1337
|
// The same measure as a live day (seconds, layers, tokens, turns, model); history differs only in the door it goes through.
|
|
1338
|
-
const stretch = { ...measure(cwd, messages,
|
|
1338
|
+
const remote = remoteSteeredOf(file, messages), kindOf = remote ? "headless" : session; const stretch = { ...measure(cwd, messages, kindOf), ref: stretchRef(file, day), steered: remote ? "remote" : steered, session: kindOf, agents: agents.get(day) ?? null, live: liveOf(file, day) };
|
|
1339
1339
|
// ONE LINE PER PROCESS PER DAY (0.10.33), as live: an autonomous run joins its process's day, sent below as one line.
|
|
1340
1340
|
if (isProcessRun(stretch)) {
|
|
1341
1341
|
const key = processKey(CODEX_ROLLOUT.test(file) ? "codex" : ANTIGRAVITY_TRANSCRIPT.test(file) ? "antigravity" : DATABASE_SESSION.test(file) ? file.slice(0, file.indexOf(":")) : null, stretch, false);
|
|
@@ -1478,7 +1478,7 @@ function folderEntries(given) {
|
|
|
1478
1478
|
report.stretches += 1;
|
|
1479
1479
|
if (present.has(ref) || seen.has(ref)) { report.skipped += 1; continue; }
|
|
1480
1480
|
seen.add(ref);
|
|
1481
|
-
const rest = payloadFor({ ...measure(cwd, messages), ref, steered: null, agents: null });
|
|
1481
|
+
const remote = remoteSteeredOf(file, messages), rest = payloadFor({ ...measure(cwd, messages, remote ? "headless" : null), ref, steered: remote ? "remote" : null, session: remote ? "headless" : null, agents: null }); // a copied steered session stays out of the person's hours (P2-d)
|
|
1482
1482
|
const entry = { ...rest, title: rest.layer ? `AI-assisted work from a copied session folder · ${rest.layer}` : "AI-assisted work from a copied session folder", ...(rest.timeline ? { duration_basis: "reconstructed" } : {}) };
|
|
1483
1483
|
if (client !== "claude") entrySource.set(entry, client);
|
|
1484
1484
|
entryFile.set(entry, { file, from: firstOf(messages), folder: null });
|
package/package-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"b38ea343eb95892d4164274be4184d6e34eade9d4c454e1dcf8bc7735736425e","README.md":"5d3761035c4ef5efcfc91cfa0a2a6294c73aef402f8c111a721018ca11f86b82","SECURITY.md":"69f654b8101ab49821b8eb54b631f0a028035149c727953dc7d609faa2a9b2e0","chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"179baf829eda488bab3f17ae6917473ec01d0d6346f47de7bc144351274f19c8","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","engine-release.json":"03f37811391bbb10ee5996995e11bb140c69adff29ffc9780cdcf2fa4c88f579","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"eb3bc0972bc30788521a492e136ed792d8265e0c5b8aede81fec4f3e071a25d0","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","package.json":"385eab3ba728f06a484b92d0093625f0de0596a93abfd301c18a6f878f36ee1c","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","remote-adapter-claude-code.mjs":"fe11c7fd37b570404e90fe53c11b471c2b5f114e8616bcdc281792cb000ecaf4","remote-adapter-codex.mjs":"44c41bc92a12ea6aa2232d67ba4a02f335aaea1429816e9a9e3eb3911a97cb3a","remote-approval-bridge.mjs":"9661bb2d698aed1c788246506e842dfaa4507d5357e454bf67b5b4b65da1621d","remote-approvals.mjs":"c033f36d261b3a5be552c9b02f92f30bd7217c8a1a55116fb514acb61e198c6f","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"85a6b26e332f6b89584edfa58bff6d753918cc391ca62bb02b9f344b0508db37","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-daemon.mjs":"c22eec13da604d262c116a7a389555dae8a3b68fd9de7df44dad178f3ea0ec63","remote-inventory.mjs":"d5a1c0180bab5c0522e73c913876050b9b36eb9ed06a8fa0e8e258ce54b67282","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-pairing.mjs":"ae03427b6510e52da08aaf9387d5e08516ee25380c7efa420432f4e1e936a7c5","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"aacf7578537021ab3849095bb1f58f0ed12c453c6ca2ab1352a1716fb13b0ca4","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"d07997167d1f51139ff010c8753639e48c5cd33688568459e184eabb12bfff84","remote-protocol.mjs":"f0beb91750397d1c6f0042fe716413cf8027684a84d4ed17bccee996cc5e2544","remote-qr.mjs":"b80e2b4a5bc020cf6ed92e91d06b327cb5197de1c35b3445a0fc2c7a3bf1ab3f","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"914af621d768abd126adda479f5ee7d52f3ed93c17897ab184c7116980b299e2","remote-service.mjs":"1b9d4ecf99b667f2ab7c78fe1dfd5cf507cbb36c5bcad15bfa2a88c313ae758e","remote-session-list.mjs":"0fc1e9df7997e28c8c9a63d3ae63347120fa91238b82ee05c1041b1e9d297ebd","remote-sessions.mjs":"24e24d0e574c40049edd7ae11d4cc98965f2a962bbd59c642a0ea7d6b74f5171","remote-steered.mjs":"fbbd3685a8cd497ae03235d258e2116e2129aac19046759fb2468fe79911f0b3","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"c68fd7b55d857cd4c06d0e53a5989c4f20e7f8e7add5e18443b3c16d864cabd1","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"b9fe20d7445205bdbf4cf2eaaf9cc770dad01e23d41e644b04930ca34e10426d","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"5321c67b7bb0699780a155d87473a4975ef81e47deada06f7d5b5bde9a973f98"},"format":"worktrust-package/1","kind":"npm","version":"0.11.0"},"signature":"nhkweQcjZafacdx-z25thk9gfupt1ky7I1lOGsosm9vJWmUB9A825pL3FIgAKDWf5HRu4EFTYVV0i52ujpyzAw"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worktrust",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Couple this computer to WorkTrust: approve a code in your browser, and every AI app here reports what you built. Metadata only, no dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,40 @@
|
|
|
42
42
|
"credential-vault.mjs",
|
|
43
43
|
"credential-vault-scripts.mjs",
|
|
44
44
|
"self-update.mjs",
|
|
45
|
-
"history-progress.mjs"
|
|
45
|
+
"history-progress.mjs",
|
|
46
|
+
"remote-protocol.mjs",
|
|
47
|
+
"remote-store.mjs",
|
|
48
|
+
"remote-policy.mjs",
|
|
49
|
+
"remote-journal.mjs",
|
|
50
|
+
"remote-steered.mjs",
|
|
51
|
+
"remote-inventory.mjs",
|
|
52
|
+
"remote-claude-events.mjs",
|
|
53
|
+
"remote-claude-progress.mjs",
|
|
54
|
+
"remote-attachments.mjs",
|
|
55
|
+
"remote-preview.mjs",
|
|
56
|
+
"remote-coalesce.mjs",
|
|
57
|
+
"remote-steering.mjs",
|
|
58
|
+
"remote-codex-events.mjs",
|
|
59
|
+
"remote-adapter-codex.mjs",
|
|
60
|
+
"remote-projects.mjs",
|
|
61
|
+
"remote-pipeline-config.mjs",
|
|
62
|
+
"remote-pipeline-parsers.mjs",
|
|
63
|
+
"remote-pipeline.mjs",
|
|
64
|
+
"remote-releases.mjs",
|
|
65
|
+
"remote-release-plans.mjs",
|
|
66
|
+
"remote-adapter-claude-code.mjs",
|
|
67
|
+
"remote-approval-bridge.mjs",
|
|
68
|
+
"remote-approvals.mjs",
|
|
69
|
+
"remote-sessions.mjs",
|
|
70
|
+
"remote-session-list.mjs",
|
|
71
|
+
"remote-changes.mjs",
|
|
72
|
+
"remote-daemon.mjs",
|
|
73
|
+
"remote-transport.mjs",
|
|
74
|
+
"remote-run.mjs",
|
|
75
|
+
"remote-service.mjs",
|
|
76
|
+
"remote-pairing.mjs",
|
|
77
|
+
"remote-qr.mjs",
|
|
78
|
+
"remote-cli.mjs"
|
|
46
79
|
],
|
|
47
80
|
"engines": {
|
|
48
81
|
"node": ">=18"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE CLAUDE CODE ADAPTER, STRUCTURED (2026-11-07). One managed process per remote session:
|
|
3
|
+
*
|
|
4
|
+
* claude -p --input-format stream-json --output-format stream-json --verbose
|
|
5
|
+
* --permission-mode <the mode its help lists for "ask", or plan>
|
|
6
|
+
* --permission-prompt-tool mcp__worktrust_remote__approve --mcp-config <this session's file>
|
|
7
|
+
* [--model <a model the computer listed>] (--session-id <uuid chosen here> | --resume <the agent's own id>)
|
|
8
|
+
*
|
|
9
|
+
* in the granted project folder, in a process group of its own. Every argument comes from this file and the closed start
|
|
10
|
+
* options the computer checked again (checkStart); no text from the phone becomes an argument except a resume id that is
|
|
11
|
+
* a UUID. Prompts go in as stream-json user messages; Claude Code takes one turn at a time, so a prompt (or a steer) that
|
|
12
|
+
* arrives mid-turn waits for the next turn and is accepted only when that turn begins. There is no pause: Claude Code has
|
|
13
|
+
* none, the report says so, and a pause is refused. Stop interrupts the group (SIGINT), then ends it (SIGTERM, SIGKILL).
|
|
14
|
+
* The approval tool is remote-approval-bridge.mjs, started by Claude Code itself from the MCP config written here.
|
|
15
|
+
*/
|
|
16
|
+
import { spawn } from "node:child_process";
|
|
17
|
+
import { writeFileSync, rmSync } from "node:fs";
|
|
18
|
+
|
|
19
|
+
export const APPROVAL_TOOL = "mcp__worktrust_remote__approve";
|
|
20
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
21
|
+
export const isClaudeSessionId = (value) => typeof value === "string" && UUID.test(value);
|
|
22
|
+
|
|
23
|
+
/** The command line, from closed options only. Throws on anything else: nothing unchecked is passed through. */
|
|
24
|
+
/**
|
|
25
|
+
* WHAT A REMOTE SESSION MAY NEVER DO, AS CLAUDE CODE'S OWN DENY RULES (review 2026-11-07, P1-c). The person's allow rules
|
|
26
|
+
* and a repository's committed settings apply before the permission-prompt tool is asked, so a phone prompt could otherwise
|
|
27
|
+
* push, install or deploy with no approval at all. Deny beats allow in Claude Code, so these are passed with
|
|
28
|
+
* --disallowedTools; and --setting-sources user keeps a granted repository's own rules and hooks out of a remote session.
|
|
29
|
+
*/
|
|
30
|
+
export const REMOTE_DENY = Object.freeze([
|
|
31
|
+
"Bash(git push:*)", "Bash(git push)", "Bash(git remote:*)", "Bash(npm install:*)", "Bash(npm i:*)", "Bash(npm ci:*)", "Bash(npm publish:*)", "Bash(npm exec:*)",
|
|
32
|
+
"Bash(pnpm add:*)", "Bash(pnpm install:*)", "Bash(pnpm i:*)", "Bash(pnpm dlx:*)", "Bash(pnpm publish:*)", "Bash(yarn add:*)", "Bash(yarn install:*)", "Bash(yarn dlx:*)",
|
|
33
|
+
"Bash(npx:*)", "Bash(bunx:*)", "Bash(bun add:*)", "Bash(bun install:*)", "Bash(pip install:*)", "Bash(pip3 install:*)", "Bash(pipx:*)", "Bash(uv pip:*)", "Bash(poetry add:*)",
|
|
34
|
+
"Bash(brew:*)", "Bash(curl:*)", "Bash(wget:*)", "Bash(gem install:*)", "Bash(cargo install:*)", "Bash(go install:*)", "Bash(go get:*)",
|
|
35
|
+
"Bash(vercel:*)", "Bash(netlify:*)", "Bash(fly:*)", "Bash(flyctl:*)", "Bash(firebase:*)", "Bash(heroku:*)", "Bash(wrangler:*)", "Bash(kubectl:*)", "Bash(helm:*)", "Bash(terraform:*)", "Bash(pulumi:*)", "Bash(eas:*)",
|
|
36
|
+
"Bash(rm -rf:*)", "Bash(sudo:*)", "Read(**/.env)", "Read(**/.env.*)", "Read(~/.ssh/**)", "Read(**/*.pem)", "Read(**/*.key)", "Read(~/.aws/**)", "Read(~/.worktrust/**)",
|
|
37
|
+
"Edit(~/.worktrust/**)", "Write(~/.worktrust/**)", "Edit(**/.env)", "Edit(**/.env.*)",
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
/** The planning tools of the session's own MCP server (remote-approval-bridge.mjs): they only write a plan, so no prompt. */
|
|
41
|
+
export const PLAN_TOOLS = Object.freeze(["mcp__worktrust_remote__plan_release", "mcp__worktrust_remote__plan_task", "mcp__worktrust_remote__plan_list"]);
|
|
42
|
+
/** The one line the session's system prompt gains (owner, 2026-11-08: the agent arranges its own work). */
|
|
43
|
+
export const PLAN_HINT = "WorkTrust remote: plan multi-step work with plan_release and report each task with plan_task; the person follows it on their phone.";
|
|
44
|
+
|
|
45
|
+
export function claudeArgs({ features, mode, model, resume, sessionRef, mcpConfig }) {
|
|
46
|
+
if (mode !== "ask" && mode !== "plan") throw new Error("the protocol offers the ask and plan modes only");
|
|
47
|
+
const permission = mode === "plan" ? features.planMode : features.askMode;
|
|
48
|
+
if (!permission) throw new Error("this Claude Code offers no such permission mode");
|
|
49
|
+
if (resume !== null && !isClaudeSessionId(resume)) throw new Error("a resume id is Claude Code's own session uuid");
|
|
50
|
+
if (resume === null && !isClaudeSessionId(sessionRef)) throw new Error("a new session needs its uuid");
|
|
51
|
+
if (model !== null && (typeof model !== "string" || model.startsWith("-") || !/^[A-Za-z0-9._:@\[\]-]{1,128}$/.test(model))) throw new Error("not a model name");
|
|
52
|
+
if (!features.disallowed || !features.settingSources) throw new Error("this Claude Code cannot take deny rules or limit its setting sources");
|
|
53
|
+
// --replay-user-messages: Claude Code echoes each user message as it reads it (isReplay), which is how a live steer is
|
|
54
|
+
// known to have entered the running turn (remote-steering.mjs; measured on 2.1.286: at the next tool boundary).
|
|
55
|
+
return ["-p", "--input-format", "stream-json", "--output-format", "stream-json", "--verbose", ...(features.replay ? ["--replay-user-messages"] : []), "--permission-mode", permission, "--setting-sources", "user", "--disallowedTools", ...REMOTE_DENY,
|
|
56
|
+
...(features.allowed ? ["--allowedTools", ...PLAN_TOOLS] : []), ...(features.appendPrompt ? ["--append-system-prompt", PLAN_HINT] : []),
|
|
57
|
+
"--permission-prompt-tool", APPROVAL_TOOL, "--mcp-config", mcpConfig, ...(features.partial ? ["--include-partial-messages"] : []), ...(model ? ["--model", model] : []), ...(resume ? ["--resume", resume] : ["--session-id", sessionRef])];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The session's MCP config: our bridge only, its socket and its one-time token. Mode 0600, removed with the session. */
|
|
61
|
+
export function writeMcpConfig(file, { node, bridge, socket, token }) {
|
|
62
|
+
writeFileSync(file, JSON.stringify({ mcpServers: { worktrust_remote: { command: node, args: [bridge], env: { WORKTRUST_REMOTE_APPROVAL_SOCKET: socket, WORKTRUST_REMOTE_APPROVAL_TOKEN: token } } } }), { mode: 0o600 });
|
|
63
|
+
return file;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A user message on stdin, as Claude Code's stream-json input reads it. */
|
|
67
|
+
export const userMessage = (text) => `${JSON.stringify({ type: "user", message: { role: "user", content: [{ type: "text", text }] } })}\n`;
|
|
68
|
+
|
|
69
|
+
export function startClaude({ file, cwd, env, args, onLine, onExit, onNoise = () => {} }) {
|
|
70
|
+
const child = spawn(file, args, { cwd, env, stdio: ["pipe", "pipe", "pipe"], detached: process.platform !== "win32", windowsHide: true });
|
|
71
|
+
let buffer = "", exited = false, interrupts = 0;
|
|
72
|
+
child.stdout.setEncoding("utf8");
|
|
73
|
+
child.stdout.on("data", (chunk) => {
|
|
74
|
+
buffer += chunk;
|
|
75
|
+
if (buffer.length > 16 * 1024 * 1024) { buffer = ""; onNoise("line too long"); return; }
|
|
76
|
+
let end;
|
|
77
|
+
while ((end = buffer.indexOf("\n")) >= 0) {
|
|
78
|
+
const raw = buffer.slice(0, end); buffer = buffer.slice(end + 1);
|
|
79
|
+
if (!raw.trim()) continue;
|
|
80
|
+
let line = null;
|
|
81
|
+
try { line = JSON.parse(raw); } catch { onNoise("not JSON"); continue; }
|
|
82
|
+
onLine(line);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
child.stderr.on("data", () => onNoise("stderr")); // never logged: it may hold the agent's words
|
|
86
|
+
child.stdin.on("error", () => {});
|
|
87
|
+
const exit = new Promise((resolve) => child.on("exit", (code, signal) => { exited = true; onExit({ code, signal }); resolve({ code, signal }); }));
|
|
88
|
+
child.on("error", () => { if (!exited) { exited = true; onExit({ code: null, signal: null, error: true }); } });
|
|
89
|
+
const signal = (sig) => { try { if (process.platform === "win32") child.kill(sig); else process.kill(-child.pid, sig); } catch { /* gone */ } };
|
|
90
|
+
return {
|
|
91
|
+
pid: child.pid,
|
|
92
|
+
alive: () => !exited,
|
|
93
|
+
write: (text) => { if (!exited) child.stdin.write(userMessage(text)); },
|
|
94
|
+
/**
|
|
95
|
+
* End the running turn and keep the session: stream-json's control request (measured on 2.1.286: the turn ends
|
|
96
|
+
* error_during_execution about 0.3 s later, the process stays, the next user message runs as a new turn).
|
|
97
|
+
*/
|
|
98
|
+
interrupt: async () => { if (exited) return false; interrupts += 1; child.stdin.write(`${JSON.stringify({ type: "control_request", request_id: `wt_interrupt_${interrupts}`, request: { subtype: "interrupt" } })}\n`); return true; },
|
|
99
|
+
/** Interrupt, then end, the whole process group; resolves when it is gone. */
|
|
100
|
+
async stop(graceMs = 3000) {
|
|
101
|
+
if (exited) return;
|
|
102
|
+
for (const sig of ["SIGINT", "SIGTERM", "SIGKILL"]) {
|
|
103
|
+
signal(sig);
|
|
104
|
+
if (await Promise.race([exit.then(() => true), new Promise((r) => setTimeout(() => r(false), graceMs))])) return;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
close: () => { try { child.stdin.end(); } catch { /* closed */ } },
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const removeQuietly = (file) => rmSync(file, { force: true });
|