@tnunamak/dalan 0.7.0 → 0.8.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/CHANGELOG.md +30 -0
- package/CONTRIBUTING.md +4 -0
- package/PROTOCOL.md +2 -0
- package/README.md +68 -28
- package/bin/dalan.mjs +1 -1
- package/bin/dot-worker.mjs +13 -2
- package/contracts/adapter-qualification.schema.json +170 -0
- package/docs/chatgpt-worker-onboarding.md +1 -1
- package/docs/local-agent-requester.md +46 -0
- package/docs/manual-setup.md +1 -1
- package/docs/operations.md +2 -2
- package/docs/service-setup.md +40 -17
- package/docs/setup-reference.md +1 -1
- package/docs/t3-question-relationship.md +43 -0
- package/docs/t3-reverse-control.md +12 -8
- package/docs/t3-wake-fence-r4.md +42 -0
- package/docs/test-suite-isolation.md +204 -0
- package/docs/worker-clients.md +3 -1
- package/package.json +5 -2
- package/qualification/README.md +13 -0
- package/qualification/mcp.json +121 -0
- package/qualification/protocol-v0.json +127 -0
- package/src/admin-socket.mjs +2 -1
- package/src/answer-journal.mjs +200 -0
- package/src/auth-check.mjs +8 -2
- package/src/cli-help.mjs +4 -3
- package/src/destinations/index.mjs +6 -0
- package/src/destinations/none.mjs +3 -0
- package/src/destinations/t3.mjs +63 -6
- package/src/execution.mjs +20 -2
- package/src/follow-current.mjs +4 -2
- package/src/gozar-routes.mjs +4 -3
- package/src/host-budget.mjs +17 -11
- package/src/host-execution-policy.mjs +2 -2
- package/src/host-stop-reverify.mjs +6 -4
- package/src/integrator.mjs +3 -1
- package/src/server.mjs +62 -12
- package/src/service-launchd.mjs +28 -8
- package/src/service-migrate-workers.mjs +12 -2
- package/src/service.mjs +52 -16
- package/src/store.mjs +77 -14
- package/src/submission-policy.mjs +8 -4
- package/src/t3.mjs +21 -2
- package/src/tool-registry.mjs +54 -8
- package/src/workers.mjs +4 -3
- package/src/workspace.mjs +94 -15
package/docs/service-setup.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Install Dalan once to keep your MCP agent connected to your Mac or Linux computer. You do not need to run the trial first.
|
|
4
4
|
|
|
5
|
-
Before you begin, install Node.js 24 or newer and Tailscale with Funnel enabled. Your agent's account must allow custom MCP connectors. The commands below are the same on macOS and Linux.
|
|
5
|
+
Before you begin, install Node.js 24 or newer and Tailscale with Funnel enabled. Your agent's account must allow custom MCP connectors. The basic install commands below are the same on macOS and Linux; forwarding to a non-loopback target is Linux-only.
|
|
6
6
|
|
|
7
7
|
**Tailscale prerequisite.** `--route tailscale` publishes through Tailscale Funnel, which your tailnet administrator must allow (a `funnel` entry in the tailnet access controls; HTTPS and MagicDNS must be on too). If Funnel is not allowed, Dalan stops before it publishes anything and tells you which setup step is missing, or prints Tailscale's own refusal. Enable Funnel once at <https://tailscale.com/kb/1223/funnel>, then run the command again. Other routes need no Tailscale setting; `dalan setup` lists them.
|
|
8
8
|
|
|
@@ -46,15 +46,15 @@ The authentication check tests the public route and sign-in flow, not whether an
|
|
|
46
46
|
|
|
47
47
|
### More workers and advanced setup
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
To configure several workers, repeat the flag in the install command, for example `dalan service install --worker assistant --worker reviewer --route tailscale`, and pair each separately. A worker name starts with a lowercase letter, uses lowercase letters, digits, hyphens or underscores, and is at most 32 characters; `pool` and `unknown` are reserved.
|
|
50
50
|
|
|
51
51
|
### Pairing details
|
|
52
52
|
|
|
53
|
-
A client on this computer with a loopback callback needs `--confirm-redirect` with the exact redirect that `pending` shows; see [worker pairing](manual-setup.md#worker-setup). A worker on another computer follows [Native client on a remote HTTPS bridge](worker-clients.md#native-client-on-a-remote-https-bridge). Then run [submit, finish and read the result](manual-setup.md#submit-finish-and-read-the-result) with `--worker
|
|
53
|
+
A client on this computer with a loopback callback needs `--confirm-redirect` with the exact redirect that `pending` shows; see [worker pairing](manual-setup.md#worker-setup). A worker on another computer follows [Native client on a remote HTTPS bridge](worker-clients.md#native-client-on-a-remote-https-bridge). Then run [submit, finish and read the result](manual-setup.md#submit-finish-and-read-the-result) with `--worker` set to your worker's name.
|
|
54
54
|
|
|
55
|
-
Where the README and manual setup use the trial worker `local`, use your service's `NAME`:
|
|
55
|
+
Where the README and manual setup use the trial worker `local`, use your service's worker name as `NAME`:
|
|
56
56
|
|
|
57
|
-
- Submission:
|
|
57
|
+
- Submission: pass `--worker NAME` to `dalan submit` for the first job and for every repository job.
|
|
58
58
|
- Repository grants: `dalan worker allow NAME OWNER/REPO` and `dalan worker list NAME --json`.
|
|
59
59
|
|
|
60
60
|
`wait`, `get` and `decide` select the job by request ID and take no worker flag.
|
|
@@ -63,13 +63,13 @@ The rest of this guide covers advanced routes, migration, updates and removal. N
|
|
|
63
63
|
|
|
64
64
|
### An existing reverse proxy
|
|
65
65
|
|
|
66
|
-
If you already serve a stable HTTPS address through your own reverse proxy, register that address with Gozar instead of asking Gozar for a new route:
|
|
66
|
+
If you already serve a stable HTTPS address through your own reverse proxy, register that address with Gozar, the tool Dalan uses to publish its public route, instead of asking Gozar for a new route. This command is a template. Replace `PUBLIC_HOST` with your proxy's public hostname, `PORT` with a free local port number for Dalan to listen on, and `TARGET_IP:TARGET_PORT` with the IPv4 address and port your proxy forwards to, such as `127.0.0.1:8787` (a hostname is refused):
|
|
67
67
|
|
|
68
68
|
```sh
|
|
69
|
-
dalan service install --worker
|
|
69
|
+
dalan service install --worker assistant --public-url https://PUBLIC_HOST --port PORT --target TARGET_IP:TARGET_PORT
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
Gozar records and verifies an origin-to-target route that your reverse proxy already serves; it does not edit the proxy. Prepare the proxy first so the public origin forwards to the address in `--target`. Preserve the public `Host` header. The bridge rejects requests with another Host, including requests that try to replace it with `X-Forwarded-Host`. TLS ends at the proxy. Keep the secret path out of proxy logs.
|
|
72
|
+
Gozar records and verifies an origin-to-target route that your reverse proxy already serves; it does not edit the proxy. Prepare the proxy first so the public origin forwards to the address in `--target`, an IPv4 address and port such as `192.168.1.20:8792`. Preserve the public `Host` header. The bridge rejects requests with another Host, including requests that try to replace it with `X-Forwarded-Host`. TLS ends at the proxy. Keep the secret path out of proxy logs.
|
|
73
73
|
|
|
74
74
|
The proxy must forward these routes without removing their prefixes, methods, query strings, authorization headers or cookies:
|
|
75
75
|
|
|
@@ -83,31 +83,31 @@ The proxy must forward these routes without removing their prefixes, methods, qu
|
|
|
83
83
|
| `/signal/*` | Answers wake hooks when configured. |
|
|
84
84
|
| `/.well-known/gozar/service` | Answers the Gozar check, with its query string. |
|
|
85
85
|
|
|
86
|
-
An unauthenticated request to `/admin` on the public origin must return 404. The Dalan process listens on `127.0.0.1:PORT`.
|
|
86
|
+
An unauthenticated request to `/admin` on the public origin must return 404. The Dalan process listens on `127.0.0.1:PORT`. On Linux, when the target is another address on this computer, pass `--lan-port N`; the service then opens the target address and forwards it to the loopback listener. Use a distinct non-wildcard address, not 0.0.0.0, which collides with loopback. macOS refuses other targets: use `--target 127.0.0.1:PORT` with the same port as `--port`. If Gozar runs on this computer and reaches loopback directly, use `--target 127.0.0.1:PORT`. Challenge verification binds the receiving socket port to the declared target port. Translating to a different numeric port needs an explicit, trusted `--verify-cmd COMMAND`. If the origin filters the Gozar verifier by source IP, pass the same option. Install succeeds only when Gozar returns a verified route.
|
|
87
87
|
|
|
88
88
|
### Migrate an older bridge
|
|
89
89
|
|
|
90
|
-
For existing installations, create the new home and copy each worker's repository allowlist.
|
|
90
|
+
For existing installations, create the new home and copy each worker's repository allowlist. Change the `--source` path if your old bridge keeps `workers.json` elsewhere:
|
|
91
91
|
|
|
92
92
|
```sh
|
|
93
93
|
dalan service migrate-workers \
|
|
94
94
|
--home "$HOME/.local/share/dalan-service" \
|
|
95
|
-
--source "$HOME/.config/dot-bridge/workers.json"
|
|
96
|
-
--source "$HOME/OLD_BRIDGE_TWO/.config/dot-bridge/workers.json" \
|
|
97
|
-
--source "$HOME/OLD_BRIDGE_THREE/.config/dot-bridge/workers.json"
|
|
95
|
+
--source "$HOME/.config/dot-bridge/workers.json"
|
|
98
96
|
```
|
|
99
97
|
|
|
98
|
+
Add one `--source PATH` per further old bridge home, replacing `PATH` with that home's `workers.json`.
|
|
99
|
+
|
|
100
100
|
The helper reads the source files without changing them. If an older home has no `workers.json`, it can read the adjacent `workers-repos.json` migration journal. It preserves worker names and repository allowlists, and copies supported worker capabilities and guidance. It does not copy OAuth registrations, tokens, jobs or results. The new bridge starts with `default_execution: none`. Workspace access defaults to denied; add `--workspace-worker NAME` for each worker that needs an explicit workspace grant. This option records the owner's grant; it does not require an earlier audit record. Existing explicit `workspaceAllowed` and T3 capability settings are retained. Destination declarations are copied, but old destination approvals bind old jobs and connections, so each new job requires a fresh approval.
|
|
101
101
|
|
|
102
102
|
Optionally pass `--source-db PATH` for each old job database. The helper opens it read-only and writes a private `service-migration.json` checklist containing active subscription counts, callback origins and destination approval counts. It omits callback paths, query strings, signing secrets and encrypted records. This checklist grants no authority. Re-enrol every connector, call `events/subscribe` with a fresh signing key, and approve each new destination revision. Without `--source-db`, the checklist still records those required steps but has no old subscription inventory. For a brand-new bridge, skip migration and pass `--worker NAME` once for each worker instead; those initial workers have empty repository allowlists, no capabilities, and no host execution.
|
|
103
103
|
|
|
104
104
|
### Move from a trial to a service
|
|
105
105
|
|
|
106
|
-
A service needs a fresh home; do not point it at a trial home. To keep trial results, save them first while `dalan try` still runs: with `DALAN_HOME` set to the trial home that `try` printed, run `dalan inbox --all --json` to list request IDs, then `dalan get REQUEST_ID --json > result-REQUEST_ID.json` for each result you want. Then stop the trial with Ctrl-C, install the service, and pair the worker again. Pairing replaces the worker client's old connection; remove the old entry first with `codex mcp remove NAME` or `claude mcp remove --scope user NAME
|
|
106
|
+
A service needs a fresh home; do not point it at a trial home. To keep trial results, save them first while `dalan try` still runs: with `DALAN_HOME` set to the trial home that `try` printed, run `dalan inbox --all --json` to list request IDs, then `dalan get REQUEST_ID --json > result-REQUEST_ID.json` for each result you want, replacing `REQUEST_ID` with each ID. Then stop the trial with Ctrl-C, install the service, and pair the worker again. Pairing replaces the worker client's old connection; remove the old entry first with `codex mcp remove NAME` or `claude mcp remove --scope user NAME`, where `NAME` is the connector name you gave the client.
|
|
107
107
|
|
|
108
108
|
### Keep the service running
|
|
109
109
|
|
|
110
|
-
On Linux the service starts when the systemd user manager starts. Without lingering, that may be your first login after a reboot. If the bridge must start before login, ask an administrator to run `loginctl enable-linger USER`
|
|
110
|
+
On Linux the service starts when the systemd user manager starts. Without lingering, that may be your first login after a reboot. If the bridge must start before login, ask an administrator to run `loginctl enable-linger USER`, replacing `USER` with the account that owns the bridge; install does not check or warn about it. On macOS the LaunchAgent starts when you log in and stops when you log out, so it does not run unattended after a reboot until someone logs in.
|
|
111
111
|
|
|
112
112
|
`--write-units-only` writes the service files without initializing the bridge home, starting the service or calling Gozar. It is for offline inspection; run the normal install to finish setup.
|
|
113
113
|
|
|
@@ -132,7 +132,7 @@ A schedule or hook in the worker's vendor tool is outside Dalan's supported path
|
|
|
132
132
|
|
|
133
133
|
## Service updates
|
|
134
134
|
|
|
135
|
-
New installs enable a daily update check
|
|
135
|
+
New installs enable a daily update check: a systemd user timer on Linux (daily, up to one hour of random delay) and a launchd agent on macOS (every day at a fixed minute between 03:00 and 03:59 that depends on the home). On Linux, a missed run can run when the user manager next starts. On macOS, a check missed while the Mac is shut down or you are logged out is not caught up at the next login; run `dalan service update --check` yourself or wait for the next scheduled check. Installation with `--no-auto-update` disables the timer; `--auto-update` explicitly enables it. Reinstalling preserves the saved choice unless you pass one of those flags. On Linux, the timer needs your systemd user manager to run; it does not configure login lingering.
|
|
136
136
|
|
|
137
137
|
```sh
|
|
138
138
|
dalan service update --check
|
|
@@ -142,7 +142,7 @@ dalan service auto-update off
|
|
|
142
142
|
dalan service auto-update on
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
The home defaults to `~/.local/share/dalan-service` and Dalan remembers it; pass `--home DIR` only to select a different one. `service status` shows the selected version, saved automatic-update preference and last update result.
|
|
145
|
+
The home defaults to `~/.local/share/dalan-service` and Dalan remembers it; pass `--home DIR` only to select a different one. `service status` shows the selected version, saved automatic-update preference and last update result. On Linux, use `systemctl --user list-timers` to inspect the actual timer schedule. Turning updates off prevents future starts; it does not cancel an update already running. Preference changes refuse while an update holds the home lock. A release that was rolled back is recorded and skipped on later runs, including the timer; `dalan service update --retry` tries it again, and a newer or republished release is attempted normally. `service status` shows it as `failed_release`.
|
|
146
146
|
|
|
147
147
|
`--check` queries the public npm registry for the latest stable `@tnunamak/dalan` version and reports availability without installation or restart. A normal update installs the exact release under `HOME/versions/<version>`, with npm integrity checks and install scripts disabled. The registry's integrity value binds the downloaded bytes to its metadata; it is not an independent publisher signature. The original package must remain available until the first successful update. Later starts use the selected package through `HOME/current`.
|
|
148
148
|
|
|
@@ -160,6 +160,29 @@ While a switch is in progress, the restarted candidate refuses every worker call
|
|
|
160
160
|
|
|
161
161
|
A service installed by 0.6.0 or 0.6.1 is adopted by its first `dalan service update` with no other step: Dalan reads the package path and node binary from the service unit, keeps that node binary, and leaves the original package in place until a later update succeeds. To turn on the daily timer for such a service, run `dalan service auto-update on`, or enroll it the long way: install the current Dalan package, then repeat its original `dalan service install` command with the same home, origin, port and target. Enrollment preserves keys and worker grants, changes the unit's package path and restarts it. Its timer stays off unless you pass `--auto-update` or run `service auto-update on`. A modified unit is refused for inspection. These update commands cover the service made by `dalan service install`; services from the older setup script are not enrolled automatically.
|
|
162
162
|
|
|
163
|
+
### Living with updates
|
|
164
|
+
|
|
165
|
+
**What a daily run does.** It looks up the latest stable release. With none newer, it changes nothing. With a newer one whose tool list matches, it installs, checks and switches by itself, and restarts the service. With a changed tool list, it stages the release and stops: the running version keeps serving jobs, and nothing switches until you run `dalan service update --yes`. Each later daily run repeats the check and leaves it staged, until you approve or a newer release replaces it.
|
|
166
|
+
|
|
167
|
+
**Find out that an update waits.** Dalan sends no notice. Run:
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
dalan service status --json
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
In `last_result`, `outcome` is `connector_refresh_required` for a staged release (`candidate_version` names it), `rolled_back` or `rollback_failed` after a failed switch, `failed` when an update stops before or during the switch, `update_available` after a check finds a newer release, `skipped_failed_release` when the timer passes over a rolled-back release, and `up_to_date` when none is waiting. A top-level `failed_release` names a release that Dalan will not retry on its own.
|
|
174
|
+
|
|
175
|
+
**Approve and refresh.** Run `dalan service update --yes`, then refresh the connector in each hosted client before you send new jobs. Until you do, the client may still offer the old tool list.
|
|
176
|
+
|
|
177
|
+
- ChatGPT: open the Dalan connector and select **Refresh**, then test in a new conversation.
|
|
178
|
+
- Claude Code, Codex CLI and other clients: restart the client session so that it lists the tools again. If the new tools still do not appear, remove and re-add the connector as in [worker clients](worker-clients.md).
|
|
179
|
+
|
|
180
|
+
**Pause or check.** `dalan service auto-update off` stops the daily run; `dalan service auto-update on` restores it. `dalan service update --check` reports whether a newer release exists and records the answer in `last_result`; it installs nothing. Inspect the schedule with `systemctl --user list-timers` on Linux, or `launchctl list | grep -- -update` on macOS (the label is `org.dalan.<service>-update`).
|
|
181
|
+
|
|
182
|
+
**Roll back by hand.** Dalan has no command that returns to an earlier version after a successful update. Only a failed switch rolls back, and it does so by itself. `dalan service update --retry` retries a release that was rolled back; it does not restore an older one. To go back after a bad update, run `dalan service auto-update off` so the timer does not switch again, then follow [upgrade and rollback](operations.md#upgrade-and-rollback): stop the service, restore compatible state, and run the older code. Do not edit `HOME/current` by hand.
|
|
183
|
+
|
|
184
|
+
The `dalan` command on your PATH runs the version the service uses. Set `DALAN_NO_FOLLOW=1` to use the installed copy instead.
|
|
185
|
+
|
|
163
186
|
## Remove the service
|
|
164
187
|
|
|
165
188
|
```sh
|
package/docs/setup-reference.md
CHANGED
|
@@ -35,7 +35,7 @@ The table lists the common commands. Run `dalan help --all` to see every command
|
|
|
35
35
|
| `dalan inbox --all --json` | Finds receipts across requester sessions without marking results read. Covers the last 72 hours unless you pass `--since`. |
|
|
36
36
|
| `dalan note REQUEST_ID "text"` | Appends a job-specific message. |
|
|
37
37
|
| `dalan questions REQUEST_ID --json` | Lists identified questions when the selected catalog supports them. |
|
|
38
|
-
| `dalan answer REQUEST_ID QUESTION_ID "text"` | Answers an identified question; an ordinary note does not answer it. |
|
|
38
|
+
| `dalan answer REQUEST_ID QUESTION_ID "text"` | Answers an identified question; an ordinary note does not answer it. The attempt is saved under `receipts/` first, so after a crash or a lost reply, run the same command again: the answer reaches the worker once. A different text for the same question is refused. |
|
|
39
39
|
| `dalan artifact ARTIFACT_ID --output PATH` | Downloads a sealed artifact after get or wait records its owning request. PATH must not exist; its directory must. |
|
|
40
40
|
| `dalan decide REQUEST_ID accepted` | Records a review decision. Other choices are `applied`, `useful_no_change`, `useful_negative` and `not_useful`. |
|
|
41
41
|
| `dalan apply REQUEST_ID --dir CHECKOUT` | Verifies and applies a returned patch, then records `applied`. |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# A question can outlive its parent's run
|
|
2
|
+
|
|
3
|
+
Run `node scripts/question-relationship-e2e.mjs` from the repository root. This standalone acceptance test runs the same worker conversation twice: an owner using the CLI with `--deliver none` and `dalan wait`, and an owner using a T3 destination. It uses an isolated HOME, a real server process, real SQLite transactions and authenticated MCP worker calls. The deterministic demo worker is the script's `worker` function; it calls the real claim, question, renewal, consumption and finish handlers. No model or live T3 service runs.
|
|
4
|
+
|
|
5
|
+
The parent finishes its run before the worker asks whether to return JSON or plain text. The question remains identified as `Q` on the job. The CLI owner discovers it through `dalan wait` (exit 3), then lists it through `dalan questions`. The T3 owner receives one question notification on its bound thread. Two scheduler passes must not produce a duplicate.
|
|
6
|
+
|
|
7
|
+
The owner selects JSON. The test prepares the answer through R5's `prepare(job, questionId, text)` journal interface, sends it through `send(prepared)` to the real admin handler, and deliberately loses the committed reply. The saved attempt remains prepared. The worker renews its claim, advancing the job's revision past the answer. The test kills the server with SIGKILL and starts another process against the same database. `dalan answer` must resend the original key, revision and text, return the original receipt, and leave the revision unchanged. `reconcile(job, questionId)` confirms the journal's committed state. There must still be one answer receipt and one answered event.
|
|
8
|
+
|
|
9
|
+
The worker explicitly consumes the answer before it finishes. The CLI owner receives the finished state through `dalan wait`; it produces no T3 message. The T3 destination delivers one result notice to the bound parent thread. The report itself remains in Dalan for the owner to fetch.
|
|
10
|
+
|
|
11
|
+
A second job exercises interruption. While the parent's latest run is `interrupted`, the worker asks a question. Dalan must hold its wake. Starting a new parent run releases exactly one question notice. After the answer is consumed, the parent is interrupted again before the worker finishes. The report must remain stored, with no result notice sent during interruption. A new parent run releases exactly one result notice. The test counts messages added after each resume, so an early, incorrect send cannot satisfy the resume assertion. With no destination, leaving the result unread preserves it until a later `dalan wait`.
|
|
12
|
+
|
|
13
|
+
A follow-up is submitted with a fresh job ID and claim. It starts with no questions and does not change the earlier report. Continuing the relationship does not reopen terminal work.
|
|
14
|
+
|
|
15
|
+
## Responsibility boundary
|
|
16
|
+
|
|
17
|
+
T3 owns the parent thread, runs, lifecycle projection, admission of a new continuation, and stable acceptance of a message dispatch. Its destination adapter supplies an opaque generation and continuation-admission decision through `readGeneration` and `canAdmitContinuation`. Dalan stores that generation without interpreting the host's schema. T3 decides when a person has resumed the parent. Dalan does not choose the answer or start a reasoning model.
|
|
18
|
+
|
|
19
|
+
Dalan owns job and question identity, owner capabilities, claims, revisions, answer receipts, answer consumption, reports and durable notification state. The requester-side answer journal preserves the exact attempted command in `receipts/<job>.answers/<qid>.json`. Dalan's T3 adapter reads the host lifecycle before delivery, holds ineligible wakes, and releases them when the parent becomes eligible. The same core question and result flow works with the CLI and no destination.
|
|
20
|
+
|
|
21
|
+
The T3 side of this test uses the existing `t3code` stub pattern and `startT3ResultFixture` receiver. It proves Dalan's behavior against the supplied host metadata and dispatch receipts. It does not prove a live T3 stop/resume journey, hosted-worker activation, or an exact stop-versus-interrupt distinction. In the R6 contract, `interrupted` is held conservatively.
|
|
22
|
+
|
|
23
|
+
## Dependencies and baseline
|
|
24
|
+
|
|
25
|
+
Assertions inside `cut()` record a failure and allow later cuts to continue. An assertion or operation that fails outside `cut()` aborts the remaining cuts for that requester mode and is recorded as a `trace infrastructure` failure. The script still attempts the next requester mode, and either kind of failure produces a nonzero exit. R5 and R6 are now merged, so the journal is required and the trace runs in the default suite. The table records the original main baseline at `4d2abf19`, before those dependencies merged.
|
|
26
|
+
|
|
27
|
+
| Cut | Main baseline |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| Question after parent run ended | Pass, both requesters |
|
|
30
|
+
| One question wake with repeated scheduler passes | Pass, both requesters |
|
|
31
|
+
| Journal and CLI replay after SIGKILL and revision advance | Waits on R5, both requesters |
|
|
32
|
+
| One answer receipt and answered event | Pass, both requesters |
|
|
33
|
+
| `consume_answer` | Pass, both requesters |
|
|
34
|
+
| Finish and result only to eligible parent | Pass, both requesters |
|
|
35
|
+
| Interrupted parent holds question wake | CLI passes; T3 waits on R6 |
|
|
36
|
+
| Held question delivered once after resume | CLI passes; T3 waits on R6 |
|
|
37
|
+
| Result retained while parent stopped | Pass, both requesters |
|
|
38
|
+
| Interrupted parent holds result wake | CLI passes; T3 waits on R6 |
|
|
39
|
+
| Held result delivered once after resume | CLI passes; T3 waits on R6 |
|
|
40
|
+
| Follow-up is a new job | Pass, both requesters |
|
|
41
|
+
| Destination generation/admission interface | T3 waits on R6 |
|
|
42
|
+
|
|
43
|
+
The test is registered in `scripts/test-segments.json`; its temporary test-listing exemption has been removed. Promotion to conformance traces T43+ comes afterward.
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# Reverse T3 control for workers
|
|
2
2
|
|
|
3
|
-
With `DALAN_ENABLE_T3_TOOLS=1`, the bridge exposes a small T3 thread wrapper (list, read, create, send, wait and set) through its existing OAuth MCP connection. The wrapper uses `t3code --json --origin http://127.0.0.1:3773` with argument arrays.
|
|
3
|
+
With `DALAN_ENABLE_T3_TOOLS=1`, the bridge exposes a small T3 thread wrapper (list, read, create, send, wait and set) through its existing OAuth MCP connection. The wrapper uses `t3code --json --origin http://127.0.0.1:3773` with argument arrays. All MCP workers have job-scoped authority, including the legacy local principal. The tool registry provisions default grants for the six thread tools once per worker. A NULL `tool_grants.scope` derives the allowed threads at call time from the worker's live claimed jobs with T3 destinations. Claims must match the authenticated subject, remain active and unexpired, and belong to a claimed assignment. A missing or unparseable persisted lease deadline is expired, even when a same-boot monotonic deadline exists. Built-in authentication also checks the holding connection; external OAuth has no connection ID to fence. Jobs with delivery `none` grant no thread. An operator may narrow a grant through the admin socket's existing `/tools` grant action with `scope: {"threads":["THREAD_ID"]}`; this intersects live destinations. An empty set denies every thread. Repeating a grant without `scope` preserves its existing scope; explicit `scope:null` restores the job-derived default. The six `t3_thread_*` names are reserved for internal authority records. An older ordinary registration with one of those names causes startup to refuse before provisioning grants; the operator must remove or rename that registration first. Revoke, disable and remove use the existing registry operations. Restart does not restore revoked grants. No token or worker tool schema changes. Migration 69 follows migrations 67 and 68. The real-Store migration test verifies 68 → 69 and an unchanged reopen at 69.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Discovery filters the raw thread list before compaction, totals, project summaries and audit IDs. Read, wait, send and set refuse threads outside the live grant. Scoped workers cannot create arbitrary threads because those threads have no claimed destination. Capability, OAuth scope, input validation and audit admission still apply. `notify_owner` retains its independent notification policy.
|
|
6
|
+
|
|
7
|
+
The linearization point for send/set is the synchronous registry and live-claim read after module loading and immediately before CLI dispatch, with no intervening await. A revoke committed before this read prevents dispatch; a revoke after dispatch cannot retract an external effect, and a successful CLI write keeps its success receipt. List, read and wait also recheck authority after their awaited CLI result, so a revoke during a wait refuses its result. The next send/set always checks again and never inherits the wait's authority.
|
|
8
|
+
|
|
9
|
+
There is no separate bridge owner execution path for these T3 operations: the legacy `principal.local` shortcut resolves to the default worker and receives the same job fence. Owner registry management remains on the private admin socket; it does not execute T3 thread operations. The tools remain off by default; advertising them requires `DALAN_ENABLE_T3_TOOLS=1` and calling them requires the worker's `t3` capability. The underlying CLI uses its administrative T3 session, so these server-side checks are the worker boundary.
|
|
6
10
|
|
|
7
11
|
| MCP tool | Scope | Operation |
|
|
8
12
|
| --- | --- | --- |
|
|
9
13
|
| `t3_thread_list` | `dalan.read` | List threads, optionally by project or directory and status. |
|
|
10
|
-
| `t3_thread_read` | `dalan.read` | Read a bounded transcript by exact thread ID. |
|
|
11
|
-
| `t3_thread_create` | `dalan.work` |
|
|
12
|
-
| `t3_thread_send` | `dalan.work` | Send to
|
|
14
|
+
| `t3_thread_read` | `dalan.read` | Read a bounded transcript by exact granted thread ID. |
|
|
15
|
+
| `t3_thread_create` | `dalan.work` | Refused for workers: a new thread has no claimed destination. |
|
|
16
|
+
| `t3_thread_send` | `dalan.work` | Send to a granted thread; `wakeSettled` wakes a settled one. |
|
|
13
17
|
| `t3_thread_wait` | `dalan.read` | Wait at most 120 seconds for a turn; returns partial state on timeout. |
|
|
14
18
|
| `t3_thread_set` | `dalan.work` | Change a thread's provider, model, effort, permission or mode. |
|
|
15
19
|
| `notify_owner` | `dalan.work` | Publish a short message through the configured ntfy alerts path. |
|
|
@@ -32,7 +36,7 @@ An ambiguous publish leaves a pending key that cannot be sent again automaticall
|
|
|
32
36
|
|
|
33
37
|
- `threads`: the newest threads by `updatedAt` (descending; ties by `id`), at most 50 (`THREAD_LIST_LIMIT`) and at most 16000 bytes of serialized entries (`THREAD_LIST_BUDGET`; thread IDs can be 328 characters long). The first thread is always shown.
|
|
34
38
|
- Each entry has `id`, `title` (at most 120 characters, clipped with `…`), `projectId`, `status`, `runStatus`, `updatedAt`, `latestUserMessageAt` and `pendingRuntimeRequest` (boolean). `activityRunStatus` is present only when it is set. `branch` and `worktreePath` are present only when they are at most 80 characters.
|
|
35
|
-
- `total` (all threads that matched the filter), `shown`, `truncated` (`total > shown`).
|
|
39
|
+
- `total` (all granted threads that matched the filter), `shown`, `truncated` (`total > shown`).
|
|
36
40
|
- `projects`: `{id,title,count}` for the projects of all matched threads, most threads first, at most 20; `projects_total` is present when there are more.
|
|
37
41
|
- `hint`: "narrow with projectId or cwd; full paging after a catalog update". Paging needs a new input field, which is a catalog change.
|
|
38
42
|
|
|
@@ -57,7 +61,7 @@ Do not trigger a ChatGPT reconnect from the bridge host. The connector's current
|
|
|
57
61
|
|
|
58
62
|
## Standing instruction for worker
|
|
59
63
|
|
|
60
|
-
> You can inspect the owner's T3 threads through this connector. Use `t3_thread_list` and `t3_thread_read`. They
|
|
64
|
+
> You can inspect the owner's T3 threads through this connector. Use `t3_thread_list` and `t3_thread_read`. They show only threads granted by your live claimed jobs; exact IDs are limited to 128 characters. Use `notify_owner` for a short out-of-band alert that does not start a T3 turn. Send assignment questions to the exact owner thread. Mark blockers with optional `progress.blocker:true` or start the note with `BLOCKED:` / `QUESTION:` so the bridge forwards them once if you forget. The owner can leave a lightweight message with `dalan tell`; it emits an event, but whether that starts a run depends on your client. Find it in `list_pending`, read it with `get`, and call `ack_message` after reading it. It is a message, not an assignment. `run_check` can return `{check_run_id,status:"running"}`; poll `workspace_result` for completion. Upload sealed evidence with `artifact_chunk` in any claimed assignment. Call `list_tools` first to learn the other tools you may use, then run them with `call_tool_read` or `call_tool_write`. All T3 tool calls are audited.
|
|
61
65
|
|
|
62
66
|
## After adding or changing tools
|
|
63
67
|
|
|
@@ -76,7 +80,7 @@ The workspace install and check phases both run in a sandbox with its own networ
|
|
|
76
80
|
|
|
77
81
|
## Who may hold the t3 capability
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
Pairing a client never grants the `t3` capability; the bridge reads it from the owner's `workers.json`. Workers also require registry grants and a live claimed T3 destination, as described above. Modern catalogs advertise the same names to every worker; a worker without the capability receives a denied and audited result when it calls them. With the tools on, startup prints a notice naming each worker that holds the capability.
|
|
80
84
|
|
|
81
85
|
## Adding abilities without a Refresh
|
|
82
86
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# T3 wake fence: what T3 exposes about a stopped parent
|
|
2
|
+
|
|
3
|
+
Dalan wakes a parent T3 thread when a worker asks a question or finishes. A wake is a plain user message. This note records what T3 reports about a thread after a normal finish, an interrupt and a stop, and how Dalan uses it.
|
|
4
|
+
|
|
5
|
+
## Measurements (R4 probe)
|
|
6
|
+
|
|
7
|
+
Date 2026-11-15. T3 server `0.1.10-nightly.20261113.4643.1`, orchestrator protocol 2, `t3code` CLI 0.3.0. One throwaway thread in the scratch project, a cheap model, low effort, six short turns. The thread was renamed, archived and settled afterwards. Each value is a field of `t3code --json threads inspect` under `data.thread`.
|
|
8
|
+
|
|
9
|
+
| State | `status` | `runStatus` | `activeRun` | `latestRun.status` |
|
|
10
|
+
| --- | --- | --- | --- | --- |
|
|
11
|
+
| Normal finish | `active` | `completed` | `null` | `completed` |
|
|
12
|
+
| Running | `active` | `running` | set | `running` |
|
|
13
|
+
| After `threads interrupt` | `active` | `interrupted` | `null` | `interrupted` |
|
|
14
|
+
| After stop (MCP `t3_thread_interrupt` with `stop:true`) | `active` | `interrupted` | `null` | `interrupted` |
|
|
15
|
+
|
|
16
|
+
1. **Stop and interrupt look the same.** The two inspect payloads differ only in run ordinal and timestamps. No readable field tells a stop from an interrupt. T3 has no `stopped` status, so the old `stopped` fixture was invented.
|
|
17
|
+
2. **A plain send after stop starts a new run.** A `message.dispatch` with a fresh command id (the same path as `src/t3-transport.mjs`) moved the thread from run 5 `interrupted` to run 6 `completed`. A Dalan wake therefore resurrects a stopped parent.
|
|
18
|
+
3. **A resend with the same command id is one dispatch.** Sending the same `commandId` and `messageId` again returned the same `sequence` and left the thread at run 6. A resend with a different body and the same ids also returned the same `sequence` and made no new run. The CLI path (`t3code threads send`) draws a random command id, so it has no such protection.
|
|
19
|
+
|
|
20
|
+
The thread states are copied into `scripts/fixtures/t3-r4-thread-states.mjs`. The e2e and adapter tests use them.
|
|
21
|
+
|
|
22
|
+
## Decision
|
|
23
|
+
|
|
24
|
+
Measurement 2 says a wake can resurrect a stopped parent. Measurement 1 says nothing separates stop from interrupt. So Dalan treats a latest run in `interrupted`, `cancelled` or `canceled` as held, and does not send the wake. A latest run in any status other than `completed`, `running` or `failed` is held too, with the reason `latest run status "<status>" is not recognized` in the wait queue, so a status T3 adds later waits and says why. This also holds back a wake for a parent that the user only interrupted. That is the conservative over-fence, chosen over waking a stopped parent. A `failed` run is not held: it errored on its own, and a wake that starts a new run is how a crashed or usage-limited parent resumes. The probe recorded a user stop and a user interrupt as `interrupted`, never as `failed`.
|
|
25
|
+
|
|
26
|
+
`interrupted` is treated as held until the parent resumes. Held wakes stay in the durable wait queue and in `dalan inbox`. They are not dropped, and a restart keeps them. A timer (`DALAN_T3_HELD_RECHECK_MS`, default 15 s) inspects each held wake's parent. When the parent is active again with no held reason, which means a new run with a higher ordinal started, the wake goes back to its original kind (`blocker` or `t3`) and the next drain sends it once, through the stable-ID path. A resend after that is deduped by T3. A question that its job's result superseded is not released. The original kind is kept in `notifications.held_kind`, a nullable column added by migration 68.
|
|
27
|
+
|
|
28
|
+
Dalan also records the parent generation when a job is submitted: thread id, environment id, latest run id and run ordinal. The T3 destination writes it with `capture()` as one opaque string in `assignments.parent_generation`, and reads it with `readGeneration()`. The Store keeps the string and never parses it, so the core has no T3 columns. `canAdmitContinuation(row)` is the fence: a wake is held if the thread or environment changed, or if the latest ordinal went down. All three methods are on the destination interface (`src/destinations/index.mjs`); the `none` destination records nothing and always admits. The column and `held_kind` arrive together in migration 68, after the question-purpose column of 67.
|
|
29
|
+
|
|
30
|
+
Blocker and question wakes now use the stable-id path that result wakes use. Their command id comes from the job id and notification id, so a resend after a lost ack is one dispatch (measurement 3). The question text is quoted as data in the wake message.
|
|
31
|
+
|
|
32
|
+
## Not claimed
|
|
33
|
+
|
|
34
|
+
- The fence is not atomic. Dalan checks, then sends. A parent that is stopped between the check and the send is still woken.
|
|
35
|
+
- A parent that was stopped and then resumed by its user looks eligible. A resumed run is a newer run, and Dalan cannot tell that from a normal finish.
|
|
36
|
+
- Wakes that go through the CLI path (watch and break notices) have no stable id.
|
|
37
|
+
- Result text is not framed as untrusted data. Only question text is.
|
|
38
|
+
- Jobs created from the policy queue have no recorded generation. The ordinal check is skipped for them. The held-status check still applies.
|
|
39
|
+
|
|
40
|
+
## Upstream ask
|
|
41
|
+
|
|
42
|
+
One field would close the first two gaps: a monotonic `stopSeq` on the thread, raised by `thread.stop` only, plus an optional `ifStopSeq` guard on `message.dispatch` that rejects the send when the counter moved. With it, Dalan could record `stopSeq` at submit, send with the guard, and drop the over-fence for plain interrupts. Dalan does not patch T3 for this.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Test-suite resource census
|
|
2
|
+
|
|
3
|
+
The ordered commands in `scripts/test-segments.json` are the audit boundary. The suite owns mutable state below private, randomly allocated roots. Tests may allocate more private children. Code, installed dependencies, system binaries, and kernel metadata remain shared read-only inputs. Real systemd checks share the user manager but use a distinct unit name per suite.
|
|
4
|
+
|
|
5
|
+
## Confirmed failures
|
|
6
|
+
|
|
7
|
+
| Failure | Shared resource or race | Correction and evidence |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `persistent-setup-test.mjs`, `install-inbox-test.mjs` | The setup mutex defaults to one lock per Unix user (`scripts/worker-bridge-setup.mjs:198`, `:918`). Separate HOME/TMPDIR values do not relocate that default. | The runner exports one private `DALAN_SETUP_LOCK_DIR` to every segment (`scripts/test-segments.mjs:32`). Two concurrent unmodified persistent fixtures produced one pass and one lock failure; both passed with separate overrides. |
|
|
10
|
+
| Both verifier segments, filter-safety, worktree-filter-context | The integrator's restricted child environment omitted `DALAN_HOST_CHECK_UNIT_SUFFIX`, so every suite's child used the fixed production unit (`src/integrator.mjs:132`). | Forward that existing seam only from non-production test invocations; the restricted test child is explicitly test-mode. A production-mode child ignores an inherited suffix and uses the fixed service name. Two verifier copies with different parent suffixes reproduced one failure before forwarding; both passed afterward. |
|
|
11
|
+
| Optional host regrant journey | Its conformance adapter also constructs an environment explicitly (`scripts/conformance/adapter-dot-bridge.mjs:141`). | Preserve the suite suffix there too. This optional journey currently refuses before its host check because the fixture has no worker repository policy; that independent refusal was not changed. |
|
|
12
|
+
| Host-budget production-name regression | The regression itself temporarily unset the suffix and started the shared production unit (`scripts/host-budgets-test.mjs:162`). | Intercept systemd spawn to assert the exact unsuffixed argument. Real concurrent admission/cancellation tests use only suite-owned units (`scripts/host-budgets-test.mjs:184`). Production still defaults to one active envelope per user. |
|
|
13
|
+
| `workspace-policy-held-claim-e2e.mjs` | This is an intra-fixture race: its own lease sweeper may abandon the expired claim before cleanup calls `abandon` again (`scripts/workspace-policy-held-claim-e2e.mjs:128`, `src/store.mjs:2710`). | Force the real sweep before cleanup and cancel the fixture request, which accepts queued or claimed state. The forced-sweep control failed with “no active claim” before this change and passed after it. The SIGTERM log is the fixture's own finally cleanup (`:49`). |
|
|
14
|
+
|
|
15
|
+
Two concurrent seven-segment reproductions covered persistent setup, inbox installation, both verifier entries, both filter fixtures, and the held-claim workspace fixture. Both reported seven passes and no skips.
|
|
16
|
+
|
|
17
|
+
The first full pair also exposed a budget-result ordering race: the outer supervisor can report CPU exhaustion, then its child sees EOF and reports an interruption. `src/host-budget.mjs` now remembers the observed CPU violation while retaining later usage and phase details. A synthetic trusted-pipe regression (`scripts/host-budgets-test.mjs`) fails before this change and passes afterward. Kernel limits and production reservation behavior are unchanged.
|
|
18
|
+
|
|
19
|
+
## Resource ownership
|
|
20
|
+
|
|
21
|
+
| Resource | Access sites | Isolation / shared-read contract |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| Home scratch, databases, receipts, repo caches, owner configuration, downloads | `src/paths.mjs`; all home call sites indexed below; integrator fixtures at `scripts/integrator-verifier-test.mjs:12`, `integrator-filter-safety-test.mjs:12`, `integrator-worktree-filter-context-test.mjs:12` | Runner allocates a private HOME below the original home scratch directory and pre-creates its `.tmp` (`scripts/test-segments.mjs:28`). Keeping HOME outside `/tmp` preserves prepared-cache ancestor checks; temporary files and sockets still use a short TMPDIR. Explicit fixture HOMEs are already random children. No fixture writes the operator's real HOME. |
|
|
24
|
+
| XDG config/data/state/cache | `scripts/worker-bridge-setup.mjs:228`, `src/test-support/fixture-env.mjs:10` | Runner clears inherited XDG base-directory overrides so defaults follow each fixture's HOME (`scripts/test-segments.mjs:38`). Helpers that set explicit XDG directories put them under their private fixture HOME. |
|
|
25
|
+
| Temporary files, SQLite files, Unix admin sockets | `src/admin-socket.mjs`; `scripts/mcp-schema-conformance-test.mjs:21`; `scripts/test-segments.mjs:30` | Suite-private TMPDIR and DOT_BRIDGE_TEST_TMP; fixture mkdtemp children. Short roots keep socket addresses within the platform limit. Schema fixture's long-path fallback also uses mkdtemp, never a fixed socket leaf. |
|
|
26
|
+
| Setup SQLite mutex | `scripts/worker-bridge-setup.mjs:198`, `:918`; `scripts/persistent-setup-test.mjs:300` | One suite-private override directory. Tests of a specific lock use their own fixture directory. Production's per-user default is unchanged. |
|
|
27
|
+
| systemd units / cgroups / host-stop records | `src/host-budget.mjs:79`, `src/host-stop-reverify.mjs:37`; `scripts/host-budgets-test.mjs`; `scripts/require-integrator-host-budget.mjs:16` | Suite unit suffix is retained through non-production test child environments. Production-mode host checks always use the fixed unit name, even if a test suffix is inherited. Cleanup and re-verification address the unit from that run's receipt. Unsuffixed naming is tested with spawn interception, never a live shared unit. |
|
|
28
|
+
| User systemd bus and runtime directory | `src/integrator.mjs:135`; `scripts/regrant-effects-e2e.mjs:117` | XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS remain host inputs so real kernel-budget checks can run. The manager is shared; every mutable unit/cgroup/receipt is owned by one suite. No global stop or unit enumeration assertion is used. |
|
|
29
|
+
| npm cache and user configuration | `scripts/test-segments.mjs:33`; `src/prepared-node-modules.mjs:103` | Runner redirects npm_config_cache. User configuration defaults follow private HOME. Installed dependency files are immutable test inputs; fixture package operations use private repositories. |
|
|
30
|
+
| Git repositories, refs, worktrees, hooks, filter configuration | `src/integrator.mjs:86`; `scripts/integrator-worktree-filter-context-test.mjs:72`; `scripts/mirror-fetch-test.mjs:18` | Mutable repositories and worktrees live below private fixture roots. Source checkout and its Git metadata are read inputs. GIT_CONFIG_GLOBAL defaults to `/dev/null` (`scripts/test-segments.mjs:24`); an explicit caller override is an intentional read input. The mirror canaries at `scripts/mirror-fetch-test.mjs:133` now read suite HOME. |
|
|
31
|
+
| TCP listeners and OAuth issuer URLs | `src/test-support/port.mjs:11`, `:38`; `scripts/builtin-as-e2e.mjs:119`; `scripts/workspace-policy-held-claim-e2e.mjs:30` | Servers bind 0 and read the actual bound port, or retry the complete configured startup after EADDRINUSE. The production trial searches a range and retries bind failures; shutdown assertions inspect the fixture's private admin socket (`scripts/dalan-try-test.mjs:74`). |
|
|
32
|
+
| Fixed setup ports such as 18792 and 18805 | `scripts/persistent-setup-test.mjs:49`, `:302`; `scripts/install-inbox-test.mjs:154` | These are generated configuration / negative assertion data. Fake systemctl and launchctl never execute the generated server command (`scripts/persistent-setup-test.mjs:20`, `:377`). Setup invokes only `dalan init` (`scripts/worker-bridge-setup.mjs:355`), so these ports are not bound. |
|
|
33
|
+
| PIDs, process groups, kill markers | `scripts/test-segments.mjs:42`; `scripts/host-budgets-test.mjs:125`; `scripts/conformance/adapter-dot-bridge.mjs:167` | OS-assigned IDs, owned child handles/groups, or random marker strings. Fault injection targets only that fixture's processes; no pkill/killall or shared tmux server is used. |
|
|
34
|
+
| OS account home, binaries, `/proc`, `/sys/fs/cgroup`, libraries | `scripts/worker-bridge-setup.mjs:89`; `scripts/require-host-sandbox.mjs:10`; `scripts/host-budgets-test.mjs:146` | Shared identity/read-only readiness, process or sandbox-security inputs. Account lookup is used for safety checks; setup tests name explicit fixture homes. Cgroup mutations belong to the suite-specific systemd unit. Denied paths in `scripts/workspace-e2e.mjs:20` are sandbox test inputs. |
|
|
35
|
+
| External routes, catalogs, workers, service managers | `src/test-support/gozar-fake.mjs`; `src/test-support/public-host-fetch.mjs`; `scripts/persistent-setup-test.mjs:20` | Ordinary suite uses local fake providers, loopback fixtures, and service-manager shims. Live/archived journeys remain opt-in and explicitly skipped when not configured. No live bridge/catalog mutation is part of this proof. |
|
|
36
|
+
|
|
37
|
+
Signal handlers and final cleanup are registered before suite allocation. The suite HOME and temporary root are removed only after the active segment's process group has settled, including handled interrupts. If stop confirmation fails, the runner retains HOME, TMPDIR, setup-lock state and skip reports, then prints `SUITE ROOTS RETAINED` with their paths, the process group, and observable surviving PIDs. Stop only those owned processes and confirm their exit before deleting the retained roots. A SIGKILL cannot run finally cleanup; the caller must track and remove both owned roots afterward.
|
|
38
|
+
|
|
39
|
+
## Home-access census index
|
|
40
|
+
|
|
41
|
+
This is a conservative source inventory of every explicit `homedir()` and `userInfo()` call in scripts and first-party source (including optional/manual helpers). The runner's private HOME covers homedir defaults; account-home lookups remain read-only safety checks. Generated paths, mock strings, and guest denial probes do not mean the host path is written. The table above records the runtime classification rather than treating every literal as a listener or mutable shared file.
|
|
42
|
+
|
|
43
|
+
| File | Lines |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `scripts/acp-prose-check-test.mjs` | 10, 109 |
|
|
46
|
+
| `scripts/adapter-conformance-test.mjs` | 19, 20 |
|
|
47
|
+
| `scripts/admin-socket-path-test.mjs` | 35 |
|
|
48
|
+
| `scripts/admission-measure-test.mjs` | 8 |
|
|
49
|
+
| `scripts/admission-measure.mjs` | 84 |
|
|
50
|
+
| `scripts/answer-journal-e2e.mjs` | 20, 23 |
|
|
51
|
+
| `scripts/as-encrypted-storage-test.mjs` | 8 |
|
|
52
|
+
| `scripts/as-key-publication-test.mjs` | 26 |
|
|
53
|
+
| `scripts/auth-repository-security-test.mjs` | 15 |
|
|
54
|
+
| `scripts/backup-recipe-test.mjs` | 28 |
|
|
55
|
+
| `scripts/builtin-as-code-lifetime-test.mjs` | 12 |
|
|
56
|
+
| `scripts/builtin-as-complete-crash-test.mjs` | 14 |
|
|
57
|
+
| `scripts/builtin-as-e2e.mjs` | 25 |
|
|
58
|
+
| `scripts/builtin-as-exposure-test.mjs` | 15 |
|
|
59
|
+
| `scripts/builtin-as-owner-test.mjs` | 52 |
|
|
60
|
+
| `scripts/builtin-as-race-test.mjs` | 14 |
|
|
61
|
+
| `scripts/builtin-as-static-client-test.mjs` | 15 |
|
|
62
|
+
| `scripts/builtin-claim-admission-e2e.mjs` | 15 |
|
|
63
|
+
| `scripts/catalog-v2-test.mjs` | 12 |
|
|
64
|
+
| `scripts/check-readiness-lifecycle-test.mjs` | 9 |
|
|
65
|
+
| `scripts/child-registry-inspection-test.mjs` | 8 |
|
|
66
|
+
| `scripts/claim-binding-followups-e2e.mjs` | 19 |
|
|
67
|
+
| `scripts/claim-expiry-guidance-test.mjs` | 6 |
|
|
68
|
+
| `scripts/claim-fence-await-race-e2e.mjs` | 23 |
|
|
69
|
+
| `scripts/claim-metadata-redaction-test.mjs` | 32 |
|
|
70
|
+
| `scripts/claim-statechart-fixture.mjs` | 7 |
|
|
71
|
+
| `scripts/cleanup-nonblocking-e2e.mjs` | 11 |
|
|
72
|
+
| `scripts/conformance/adapter-dot-bridge.mjs` | 109, 110 |
|
|
73
|
+
| `scripts/conformance/native-authority-test.mjs` | 22 |
|
|
74
|
+
| `scripts/conformance/service-bootstrap.mjs` | 6 |
|
|
75
|
+
| `scripts/daily-selfcheck.mjs` | 26 |
|
|
76
|
+
| `scripts/dalan-mcp-test.mjs` | 17 |
|
|
77
|
+
| `scripts/dalan-setup-test.mjs` | 13 |
|
|
78
|
+
| `scripts/dalan-try-hosted-test.mjs` | 30 |
|
|
79
|
+
| `scripts/dalan-try-test.mjs` | 21 |
|
|
80
|
+
| `scripts/deadman-publication-crash-test.mjs` | 9 |
|
|
81
|
+
| `scripts/deadman-readonly-status-test.mjs` | 10 |
|
|
82
|
+
| `scripts/doctor-auth-test.mjs` | 15 |
|
|
83
|
+
| `scripts/generic-client-journey-e2e.mjs` | 16 |
|
|
84
|
+
| `scripts/generic-profile-test.mjs` | 12 |
|
|
85
|
+
| `scripts/gozar-migration-e2e.mjs` | 21 |
|
|
86
|
+
| `scripts/gozar-route-contract-test.mjs` | 21 |
|
|
87
|
+
| `scripts/host-budget-cpu-readback-test.mjs` | 7 |
|
|
88
|
+
| `scripts/host-check-allowlist-http-test.mjs` | 17 |
|
|
89
|
+
| `scripts/host-receipt-publication-crash-test.mjs` | 8 |
|
|
90
|
+
| `scripts/host-recovery-live-test.mjs` | 12 |
|
|
91
|
+
| `scripts/host-recovery-test.mjs` | 8 |
|
|
92
|
+
| `scripts/host-stop-path-audit-test.mjs` | 14 |
|
|
93
|
+
| `scripts/host-stop-reverify-test.mjs` | 10 |
|
|
94
|
+
| `scripts/inbox-e2e.mjs` | 16 |
|
|
95
|
+
| `scripts/install-gate-test.mjs` | 10 |
|
|
96
|
+
| `scripts/integrator-attempt-trace-test.mjs` | 12 |
|
|
97
|
+
| `scripts/integrator-check-input-test.mjs` | 10 |
|
|
98
|
+
| `scripts/integrator-filter-safety-test.mjs` | 12 |
|
|
99
|
+
| `scripts/integrator-policy-rejection-test.mjs` | 11 |
|
|
100
|
+
| `scripts/integrator-safety-test.mjs` | 14, 15 |
|
|
101
|
+
| `scripts/integrator-verifier-test.mjs` | 13 |
|
|
102
|
+
| `scripts/integrator-worktree-filter-context-test.mjs` | 12 |
|
|
103
|
+
| `scripts/lease-deadline-restart-test.mjs` | 8 |
|
|
104
|
+
| `scripts/lease-migrated-null-deadline-test.mjs` | 7 |
|
|
105
|
+
| `scripts/legacy-acquisition-guidance-test.mjs` | 12 |
|
|
106
|
+
| `scripts/legacy-init-start-test.mjs` | 12 |
|
|
107
|
+
| `scripts/live-trial/common.mjs` | 271 |
|
|
108
|
+
| `scripts/live-trial/dry-run.mjs` | 27, 106, 108 |
|
|
109
|
+
| `scripts/live-trial/setup.mjs` | 65 |
|
|
110
|
+
| `scripts/live-trial/teardown.mjs` | 93, 99, 172 |
|
|
111
|
+
| `scripts/maintenance-liveness-test.mjs` | 13 |
|
|
112
|
+
| `scripts/mcp-outcome-e2e.mjs` | 14 |
|
|
113
|
+
| `scripts/mcp-sse-idle-test.mjs` | 17 |
|
|
114
|
+
| `scripts/message-e2e.mjs` | 14 |
|
|
115
|
+
| `scripts/mirror-fetch-test.mjs` | 18, 133 |
|
|
116
|
+
| `scripts/neutral-schema-upgrade-test.mjs` | 15 |
|
|
117
|
+
| `scripts/neutral-worker-e2e.mjs` | 24 |
|
|
118
|
+
| `scripts/notify-ledger-admin-test.mjs` | 10 |
|
|
119
|
+
| `scripts/notify-ledger-crash-test.mjs` | 17 |
|
|
120
|
+
| `scripts/notify-ledger-reconcile-test.mjs` | 11 |
|
|
121
|
+
| `scripts/one-bridge-workers-e2e.mjs` | 16 |
|
|
122
|
+
| `scripts/outcomes.mjs` | 4 |
|
|
123
|
+
| `scripts/owner-report-artifact-e2e.mjs` | 163 |
|
|
124
|
+
| `scripts/patch-apply-default-test.mjs` | 10 |
|
|
125
|
+
| `scripts/patch-apply-path-spaces-test.mjs` | 11 |
|
|
126
|
+
| `scripts/pause-claim-hint-test.mjs` | 11 |
|
|
127
|
+
| `scripts/pinned-repository-fetch-test.mjs` | 8 |
|
|
128
|
+
| `scripts/prepared-dependencies-host-test.mjs` | 20 |
|
|
129
|
+
| `scripts/prepared-node-modules-test.mjs` | 8 |
|
|
130
|
+
| `scripts/prose-inspection-cleanup-test.mjs` | 9 |
|
|
131
|
+
| `scripts/protocol-retention-break-alert-test.mjs` | 8 |
|
|
132
|
+
| `scripts/protocol-scheduler-test.mjs` | 7 |
|
|
133
|
+
| `scripts/pull-queue-destination-test.mjs` | 8 |
|
|
134
|
+
| `scripts/pull-queue-test.mjs` | 13 |
|
|
135
|
+
| `scripts/queue-wait-perf-test.mjs` | 8 |
|
|
136
|
+
| `scripts/redaction-matrix-test.mjs` | 82 |
|
|
137
|
+
| `scripts/registry-e2e.mjs` | 14 |
|
|
138
|
+
| `scripts/regrant-effects-e2e.mjs` | 12 |
|
|
139
|
+
| `scripts/regrant-waiter-fencing-test.mjs` | 32 |
|
|
140
|
+
| `scripts/remote-loopback-callback-test.mjs` | 47, 56 |
|
|
141
|
+
| `scripts/sandbox-probe-e2e.mjs` | 27 |
|
|
142
|
+
| `scripts/sandbox-source-exemption-test.mjs` | 10 |
|
|
143
|
+
| `scripts/schema-fixture-guard-test.mjs` | 10 |
|
|
144
|
+
| `scripts/scope-names-e2e.mjs` | 15 |
|
|
145
|
+
| `scripts/secret-sinks-redaction-test.mjs` | 156, 178, 362, 386, 473, 501, 620 |
|
|
146
|
+
| `scripts/service-auto-update-test.mjs` | 12 |
|
|
147
|
+
| `scripts/service-install-test.mjs` | 13 |
|
|
148
|
+
| `scripts/service-legacy-probe-test.mjs` | 11 |
|
|
149
|
+
| `scripts/service-migrate-workers-test.mjs` | 11, 12 |
|
|
150
|
+
| `scripts/service-one-command-test.mjs` | 21 |
|
|
151
|
+
| `scripts/service-update-gate-test.mjs` | 13 |
|
|
152
|
+
| `scripts/service-update-journey-test.mjs` | 14 |
|
|
153
|
+
| `scripts/service-update-runtime-test.mjs` | 12 |
|
|
154
|
+
| `scripts/shutdown-signal-log-test.mjs` | 12 |
|
|
155
|
+
| `scripts/signal-endpoint-test.mjs` | 16 |
|
|
156
|
+
| `scripts/subscription-storage-test.mjs` | 31 |
|
|
157
|
+
| `scripts/t3-scope-e2e.mjs` | 13 |
|
|
158
|
+
| `scripts/t3-tools-e2e.mjs` | 14 |
|
|
159
|
+
| `scripts/t3-top-level-tools-noref-test.mjs` | 17 |
|
|
160
|
+
| `scripts/t3-top-level-tools-test.mjs` | 25 |
|
|
161
|
+
| `scripts/t3-wake-fence-e2e.mjs` | 20 |
|
|
162
|
+
| `scripts/test-ntfy-alert.mjs` | 3 |
|
|
163
|
+
| `scripts/test-segments-test.mjs` | 11, 106 |
|
|
164
|
+
| `scripts/test-segments.mjs` | 35 |
|
|
165
|
+
| `scripts/tool-registry-admission-test.mjs` | 11 |
|
|
166
|
+
| `scripts/tool-registry-test.mjs` | 14 |
|
|
167
|
+
| `scripts/tool-scheme-scopes-e2e.mjs` | 16 |
|
|
168
|
+
| `scripts/upgrade-release-fixture-test.mjs` | 20, 79 |
|
|
169
|
+
| `scripts/work-order-e2e.mjs` | 14 |
|
|
170
|
+
| `scripts/work-order-test.mjs` | 6 |
|
|
171
|
+
| `scripts/worker-bridge-setup.mjs` | 89, 105, 228, 231, 758 |
|
|
172
|
+
| `scripts/worker-isolation-test.mjs` | 22 |
|
|
173
|
+
| `scripts/worker-repo-cache-test.mjs` | 7 |
|
|
174
|
+
| `scripts/worker-repo-policy-e2e.mjs` | 14 |
|
|
175
|
+
| `scripts/workspace-disk-test.mjs` | 8 |
|
|
176
|
+
| `scripts/workspace-inspection-cleanup-test.mjs` | 7 |
|
|
177
|
+
| `scripts/workspace-nosandbox-e2e.mjs` | 22 |
|
|
178
|
+
| `src/acp-bridge.mjs` | 26, 264 |
|
|
179
|
+
| `src/alerts.mjs` | 11 |
|
|
180
|
+
| `src/auth.mjs` | 10 |
|
|
181
|
+
| `src/child-registry.mjs` | 10 |
|
|
182
|
+
| `src/connect-cli.mjs` | 114 |
|
|
183
|
+
| `src/default-home.mjs` | 9, 36 |
|
|
184
|
+
| `src/gozar-routes.mjs` | 46 |
|
|
185
|
+
| `src/host-check-allowlist.mjs` | 6 |
|
|
186
|
+
| `src/integrator.mjs` | 19 |
|
|
187
|
+
| `src/limits.mjs` | 8, 16, 25 |
|
|
188
|
+
| `src/paths.mjs` | 52, 56 |
|
|
189
|
+
| `src/pr-head-reviewer.mjs` | 15 |
|
|
190
|
+
| `src/prepared-node-modules.mjs` | 10 |
|
|
191
|
+
| `src/projects.mjs` | 15, 90 |
|
|
192
|
+
| `src/route-setting.mjs` | 14 |
|
|
193
|
+
| `src/server.mjs` | 56 |
|
|
194
|
+
| `src/service-launchd.mjs` | 23 |
|
|
195
|
+
| `src/service-update-gate.mjs` | 9 |
|
|
196
|
+
| `src/service-update-runtime.mjs` | 249 |
|
|
197
|
+
| `src/service-update.mjs` | 118 |
|
|
198
|
+
| `src/service.mjs` | 109, 347, 403 |
|
|
199
|
+
| `src/store.mjs` | 149, 252, 253 |
|
|
200
|
+
| `src/submission-policy.mjs` | 101 |
|
|
201
|
+
| `src/t3-transport.mjs` | 30 |
|
|
202
|
+
| `src/try-hosted.mjs` | 106 |
|
|
203
|
+
| `src/try.mjs` | 55, 84, 273 |
|
|
204
|
+
| `src/workers.mjs` | 170, 179 |
|
package/docs/worker-clients.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A worker is any MCP client that signs in to a Dalan bridge with OAuth, claims a job, reports progress and finishes it. This guide has the exact steps for Claude Code, Codex CLI and opencode, and the requirements for any other client.
|
|
4
4
|
|
|
5
|
+
If your local agent only sends jobs to a hosted worker, skip this guide: see [Send jobs from a local coding agent](local-agent-requester.md).
|
|
6
|
+
|
|
5
7
|
Start from the section that matches your bridge:
|
|
6
8
|
|
|
7
9
|
| Your bridge | Your client | Go to |
|
|
@@ -179,7 +181,7 @@ Each native attempt is approved by its own code, and a later attempt cannot take
|
|
|
179
181
|
|
|
180
182
|
### Worked example: Codex CLI on another computer
|
|
181
183
|
|
|
182
|
-
This example uses a bridge from `dalan service install --worker NAME --route
|
|
184
|
+
This example uses a bridge from `dalan service install --worker NAME --route tailscale` ([service setup](service-setup.md)) and Codex CLI on the worker computer. No reverse proxy and no domain of your own are involved.
|
|
183
185
|
|
|
184
186
|
1. On the bridge computer, allow the callback and open a pairing window:
|
|
185
187
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tnunamak/dalan",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "An MCP job bridge for bounded agent work, durable progress, results, and owner review.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"bin/*.mjs",
|
|
16
16
|
"src/",
|
|
17
|
+
"!src/**/*.test.mjs",
|
|
17
18
|
"!src/test-support/",
|
|
18
19
|
"!**/__pycache__/",
|
|
19
20
|
"packages/job-core/",
|
|
20
21
|
"!packages/job-core/test/",
|
|
21
22
|
"integrations/t3/acp-kit/src/",
|
|
23
|
+
"qualification/",
|
|
24
|
+
"contracts/adapter-qualification.schema.json",
|
|
22
25
|
"scripts/daily-selfcheck.mjs",
|
|
23
26
|
"scripts/dalan-try-selfcheck.mjs",
|
|
24
27
|
"scripts/monitor-targets.mjs",
|
|
@@ -53,7 +56,7 @@
|
|
|
53
56
|
},
|
|
54
57
|
"dependencies": {
|
|
55
58
|
"@agentclientprotocol/sdk": "1.8.0",
|
|
56
|
-
"@tnunamak/gozar": "^0.
|
|
59
|
+
"@tnunamak/gozar": "^0.3.0",
|
|
57
60
|
"oidc-provider": "9.13.0"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Adapter qualification
|
|
2
|
+
|
|
3
|
+
A worker profile may name an `adapter`: `mcp` or `protocol-v0`. Omission means unqualified. This field is independent of the `t3` authority grant and of Gozar tunnel routes.
|
|
4
|
+
|
|
5
|
+
Records follow [the adapter schema](../contracts/adapter-qualification.schema.json), copied from the handoff schema with adapter naming. `yes` with a passing observation maps to `verified`; `no` with a passing observation maps to `unsupported`; everything else maps to `unknown`. Unknown capabilities never satisfy a submission requirement.
|
|
6
|
+
|
|
7
|
+
`protocol-v0` qualifies identified question/answer/consume behavior through the local real-server fixture. Its declaration applies only with the `protocol-v0` catalog profile. `mcp` makes no verified capability claims. Neither record qualifies a hosted model, native session continuity, activation, or a worker sandbox. The source pin identifies the baseline exercised by the probe, rather than a live provider version.
|
|
8
|
+
|
|
9
|
+
Run `node scripts/qualification-gate-test.mjs` to validate the records, compare them with the runtime capability table, and rerun their observations. The gate refuses missing observations, failed probes, mismatched values, duplicate or missing capability names, and unbound evidence. Run `node scripts/adapter-qualification-test.mjs` to exercise actual `/submit` admission and inspect SQLite after refusals. `node scripts/pull-catalog-hash-test.mjs` pins the unchanged worker catalog for all profiles with T3 tools on and off.
|
|
10
|
+
|
|
11
|
+
For `execution=none` or `worker`, required capabilities must be verified by the worker's declared adapter. For `execution=host`, sandbox requirements still use the host backend; adapter requirements also need the worker adapter. Existing immutable retries retain their original admission and binding. Policy submissions reject `required_capabilities` rather than silently dropping it.
|
|
12
|
+
|
|
13
|
+
To add an adapter, add its record, register its strict identifier in `src/execution.mjs`, and add a probe whose passing output measures each declared value. Do not promote a hosted capability from documentation alone.
|