@tnunamak/dalan 0.8.0 → 0.8.2
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 +70 -1
- package/CONTRIBUTING.md +2 -0
- package/PROTOCOL.md +6 -0
- package/README.md +8 -12
- package/bin/dalan.mjs +25 -4
- package/bin/dot-acp-agent.mjs +572 -76
- package/bin/dot-alert.mjs +9 -3
- package/bin/dot-deadman.mjs +3 -1
- package/bin/dot-heartbeat.mjs +14 -7
- package/bin/dot-pr-reviewer.mjs +3 -31
- package/bin/dot-worker.mjs +215 -40
- package/contracts/adapter-qualification.schema.json +94 -7
- package/docs/chatgpt-worker-onboarding.md +1 -1
- package/docs/codex-to-muse.md +2 -2
- package/docs/connect-chatgpt.md +1 -1
- package/docs/connection-longevity.md +2 -2
- package/docs/dalan-upgrade.md +8 -5
- package/docs/deadman.md +4 -0
- package/docs/design/authority-matrix.md +18 -0
- package/docs/design/failure-table.md +87 -0
- package/docs/design/identities.md +22 -0
- package/docs/design/pnpm-prepared-dependencies.md +64 -0
- package/docs/design/reuse-ledger.md +75 -0
- package/docs/design/target-architecture-v2.md +434 -0
- package/docs/local-agent-mcp.md +14 -0
- package/docs/local-agent-requester.md +3 -2
- package/docs/manual-setup.md +1 -1
- package/docs/operations.md +78 -14
- package/docs/pull-workers.md +11 -0
- package/docs/relationships.md +13 -0
- package/docs/service-setup.md +10 -10
- package/docs/t3-integration.md +6 -2
- package/docs/t3-reverse-control.md +5 -5
- package/docs/t3-wake-fence-r4.md +1 -1
- package/docs/test-suite-isolation.md +8 -6
- package/docs/trials/chatgpt-agent.md +47 -0
- package/docs/trials/claude-code-requester.md +68 -0
- package/docs/trials/muse.md +46 -0
- package/docs/usage.md +35 -9
- package/docs/worker-clients.md +1 -1
- package/integrations/t3/acp-kit/src/errors.mjs +6 -2
- package/integrations/t3/acp-kit/src/lock.mjs +46 -17
- package/integrations/t3/acp-kit/src/session-store.mjs +15 -3
- package/integrations/t3/acp-kit/src/t3-envelope.mjs +10 -2
- package/package.json +4 -3
- package/packages/job-core/protocol/canonical.mjs +45 -7
- package/packages/job-core/transitions.mjs +4 -2
- package/scripts/upgrade-drain.mjs +96 -8
- package/scripts/worker-bridge-setup.mjs +215 -120
- package/src/ack-ledger.mjs +7 -1
- package/src/acp-bridge.mjs +256 -28
- package/src/admin-socket.mjs +32 -3
- package/src/alerts.mjs +17 -8
- package/src/answer-journal-retention.mjs +82 -0
- package/src/answer-journal.mjs +6 -4
- package/src/as-store.mjs +51 -6
- package/src/as.mjs +27 -5
- package/src/catalog-switch-inventory.mjs +70 -0
- package/src/check-response.mjs +4 -1
- package/src/claim-command-ledger.mjs +3 -2
- package/src/cli-help.mjs +29 -10
- package/src/cli-name.mjs +13 -1
- package/src/connect-cli.mjs +159 -4
- package/src/deadman.mjs +8 -5
- package/src/delivery.mjs +2 -19
- package/src/destinations/index.mjs +75 -14
- package/src/drain-runner.mjs +5 -1
- package/src/follow-current.mjs +3 -1
- package/src/get-summary.mjs +11 -2
- package/src/git-env.mjs +1 -1
- package/src/gozar-routes.mjs +313 -94
- package/src/host-budget-storage.py +56 -6
- package/src/host-budget.mjs +98 -15
- package/src/host-execution-policy.mjs +17 -6
- package/src/inbox.mjs +13 -3
- package/src/legacy-names.mjs +0 -2
- package/src/lifecycle.mjs +104 -11
- package/src/loopback-probe.mjs +46 -0
- package/src/mcp-outcome.mjs +3 -1
- package/src/mcp-sse.mjs +2 -1
- package/src/mcp-stdio.mjs +192 -30
- package/src/patch-apply.mjs +285 -19
- package/src/phase-trace.mjs +73 -0
- package/src/prepared-go-modules.mjs +127 -0
- package/src/prepared-node-modules.mjs +225 -38
- package/src/prepared-pnpm.mjs +276 -0
- package/src/prepared-store-prune.mjs +52 -0
- package/src/projects.mjs +59 -7
- package/src/protocol-artifact-commands.mjs +28 -0
- package/src/protocol-finish.mjs +3 -2
- package/src/publication-authority.mjs +22 -0
- package/src/publish-plan.mjs +2 -2
- package/src/pull-queue.mjs +55 -20
- package/src/read-api.mjs +127 -0
- package/src/redaction.mjs +173 -0
- package/src/rejections.mjs +19 -3
- package/src/route-custody.mjs +90 -0
- package/src/route-publication.mjs +50 -0
- package/src/route-setup.mjs +184 -0
- package/src/schema-subset.mjs +5 -3
- package/src/server.mjs +619 -88
- package/src/service-launchd.mjs +5 -1
- package/src/service-update-lock.mjs +7 -4
- package/src/service-update-runtime.mjs +64 -19
- package/src/service-update.mjs +193 -48
- package/src/service.mjs +276 -77
- package/src/setup.mjs +48 -25
- package/src/signal.mjs +1 -1
- package/src/status-evidence.mjs +18 -5
- package/src/status-summary.mjs +3 -0
- package/src/store.mjs +1086 -127
- package/src/submission-policy.mjs +257 -56
- package/src/t3-control.mjs +1 -1
- package/src/t3.mjs +14 -8
- package/src/terminal-safe.mjs +9 -7
- package/src/tool-registry.mjs +134 -41
- package/src/try-exposure.mjs +53 -86
- package/src/try-hosted.mjs +257 -70
- package/src/try.mjs +48 -22
- package/src/work-order.mjs +11 -6
- package/src/worker-instructions.mjs +26 -4
- package/src/worker-runs.mjs +35 -0
- package/src/workers.mjs +49 -4
- package/src/workspace.mjs +354 -54
- package/systemd/dot-deadman.service +3 -1
- package/docs/dot-pr-reviewer.config.example.json +0 -9
- package/docs/pr-head-reviewer.md +0 -70
- package/src/pr-head-reviewer.mjs +0 -596
- package/systemd/dot-pr-reviewer.service +0 -11
- package/systemd/dot-pr-reviewer.timer +0 -10
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"observed_on": {
|
|
32
32
|
"type": "string",
|
|
33
|
-
"format": "date"
|
|
33
|
+
"format": "date",
|
|
34
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
|
34
35
|
},
|
|
35
36
|
"pins": {
|
|
36
37
|
"type": "object",
|
|
@@ -42,11 +43,36 @@
|
|
|
42
43
|
"sdk",
|
|
43
44
|
"catalog_fingerprint"
|
|
44
45
|
],
|
|
45
|
-
"additionalProperties":
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"properties": {
|
|
48
|
+
"dalan_commit": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
},
|
|
52
|
+
"requester_ref": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"minLength": 1
|
|
55
|
+
},
|
|
56
|
+
"worker_host_ref": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"minLength": 1
|
|
59
|
+
},
|
|
60
|
+
"protocol": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
},
|
|
64
|
+
"sdk": {
|
|
65
|
+
"type": [
|
|
66
|
+
"string",
|
|
67
|
+
"null"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"catalog_fingerprint": {
|
|
71
|
+
"type": [
|
|
72
|
+
"string",
|
|
73
|
+
"null"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
50
76
|
}
|
|
51
77
|
},
|
|
52
78
|
"roles": {
|
|
@@ -166,5 +192,66 @@
|
|
|
166
192
|
"type": "string"
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
|
-
}
|
|
195
|
+
},
|
|
196
|
+
"allOf": [
|
|
197
|
+
{
|
|
198
|
+
"if": {
|
|
199
|
+
"properties": {
|
|
200
|
+
"qualification": {
|
|
201
|
+
"properties": {
|
|
202
|
+
"state": {
|
|
203
|
+
"const": "passed_for_declared_scope"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": [
|
|
207
|
+
"state"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"required": [
|
|
212
|
+
"qualification"
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"then": {
|
|
216
|
+
"properties": {
|
|
217
|
+
"pins": {
|
|
218
|
+
"properties": {
|
|
219
|
+
"catalog_fingerprint": {
|
|
220
|
+
"type": "string",
|
|
221
|
+
"minLength": 1
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"capabilities": {
|
|
226
|
+
"items": {
|
|
227
|
+
"if": {
|
|
228
|
+
"properties": {
|
|
229
|
+
"required": {
|
|
230
|
+
"const": true
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"required": [
|
|
234
|
+
"required"
|
|
235
|
+
]
|
|
236
|
+
},
|
|
237
|
+
"then": {
|
|
238
|
+
"properties": {
|
|
239
|
+
"observed": {
|
|
240
|
+
"const": "passed"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"qualification": {
|
|
247
|
+
"properties": {
|
|
248
|
+
"run_refs": {
|
|
249
|
+
"minItems": 1
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
]
|
|
170
257
|
}
|
|
@@ -8,7 +8,7 @@ The owner completes the setup and first-job checks below on the intended account
|
|
|
8
8
|
|
|
9
9
|
- Confirm that the intended account/workspace can add a custom remote MCP server, authorize it with OAuth, and invoke its tools in the intended cloud conversation. OpenAI says account/workspace policies govern custom MCP access; stop if the controls are absent rather than changing a subscription or policy. [Connection guide](https://developers.openai.com/plugins/deploy/connect-chatgpt#add-the-mcp-server)
|
|
10
10
|
- Background runs, schedules, push wake and continuous execution are separate capabilities and not prerequisites for this manual smoke; ordinary chat access does not prove any of them.
|
|
11
|
-
- Have the owner complete the [public-service owner setup](service-setup.md#owner-setup) (`dalan service install --worker NAME
|
|
11
|
+
- Have the owner complete the [public-service owner setup](service-setup.md#owner-setup) (`dalan service install --worker NAME`). Retain the same service home, worker profile and private `resource-url` file throughout this recipe. Use an existing dedicated worker profile with no T3 capability and no allowed repositories. `NAME` below means that exact profile name, not the account display name. Do not change the profile to make a failed test pass.
|
|
12
12
|
- Use the existing public **HTTPS resource URL**, including its secret path and `/mcp`, from `<bridge-home>/resource-url` (mode 0600); never substitute the host root or an authorization endpoint. Prefer standard public port 443 for the trial. This is a conservative deployment choice, not a claim that OpenAI forbids other ports. OpenAI documents public HTTPS and authentication discovery for this path. [Endpoint requirements](https://developers.openai.com/plugins/deploy/connect-chatgpt#prepare-the-endpoint)
|
|
13
13
|
- Before account linking, have the owner verify the public surface from outside the private network: path-suffixed resource/authorization discovery returns 200; tokenless MCP returns 401; unsuffixed discovery, root and `/admin` return 404. The existing [live-trial public check](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md#3-verify-from-outside-the-tailnet) reads the resource URL from a private file. Reuse its check, but not its job: that job is not this smoke.
|
|
14
14
|
|
package/docs/codex-to-muse.md
CHANGED
|
@@ -16,11 +16,11 @@ This first job uses no repository and runs no checks. Use a dedicated worker nam
|
|
|
16
16
|
|
|
17
17
|
## 1. Start and expose the bridge
|
|
18
18
|
|
|
19
|
-
Install Dalan, then install the service with a dedicated worker named `muse`.
|
|
19
|
+
Install Dalan, then install the service with a dedicated worker named `muse`. Gozar shows the available routes and any steps that need your approval.
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
22
|
npm install -g @tnunamak/dalan
|
|
23
|
-
dalan service install --worker muse
|
|
23
|
+
dalan service install --worker muse
|
|
24
24
|
dalan status
|
|
25
25
|
dalan doctor --auth
|
|
26
26
|
```
|
package/docs/connect-chatgpt.md
CHANGED
|
@@ -8,7 +8,7 @@ A client you have not listed here follows the same flow: give it the complete MC
|
|
|
8
8
|
|
|
9
9
|
## Owner setup
|
|
10
10
|
|
|
11
|
-
1. Follow the [service setup](service-setup.md): `dalan service install --worker NAME
|
|
11
|
+
1. Follow the [service setup](service-setup.md): `dalan service install --worker NAME` creates the public HTTPS address. Use the service's worker name wherever this guide says `NAME`.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
14
|
dalan status
|
|
@@ -12,7 +12,7 @@ The legacy `dot-bridge-selfcheck.timer` example and `scripts/daily-selfcheck.mjs
|
|
|
12
12
|
|
|
13
13
|
After deployment, `~/.local/state/dalan/requests.jsonl` records `mcp_received` before authentication and one `mcp_outcome` when each HTTP response finishes or closes early. A generated `call_id` joins those records to `mcp_inbound`, which still means authentication and request parsing succeeded. A received call with no outcome can indicate a process exit. These MCP records omit URLs, tokens, subjects, client-provided names, RPC IDs, arguments, file paths, contents and exception messages; the one exception is `tool_error_message` on a failed tool call, the bridge's error text redacted like alert notes and cut to 300 characters. Declared methods and tools are retained; undeclared names are logged as `unknown`. Old records are not rewritten. A refused sign-in has an `mcp_outcome` with `http_status` 401 and an `auth_reason`: `missing_bearer`, `invalid_token`, `unsupported_signature`, `invalid_signature`, `jwks_unavailable`, `signing_key_unavailable`, `wrong_issuer`, `wrong_audience`, `malformed_claims`, `expired`, `not_yet_valid`, `unknown_subject`, `invalid_scope`, or for built-in sign-in `connection_inactive`. A request to a path that is not the MCP path logs `mcp_inbound` with `status` 404, `route` `other`, `http_method`, `path_shape` and `auth_header_present`. `path_shape` keeps only the names of public routes (`mcp`, `.well-known`, `oauth-protected-resource`, and similar) and replaces every other segment, including the secret path and any token in a wrong URL, with its length. A client with no `mcp_received` line at all never reached the MCP path.
|
|
14
14
|
|
|
15
|
-
Outcome fields include tool, HTTP status, JSON-RPC error code, tool `isError`, duration, response bytes, completion (`finished` or `closed`), request phase, and fixed authentication/JWKS reasons, timing and fetch status. `pending` auth/JWKS outcomes with null timing mean the connection closed while verification was still running. `http_status: null` means no headers were sent; it must not be treated as HTTP 200. `response_bytes` is the serialized JSON body size prepared by the bridge, excluding HTTP headers. A closed response may not have delivered all those bytes. `finished` means Node handed the response to its transport; it does not prove ChatGPT accepted it. A pre-auth or incomplete-body failure has no tool name. Authentication is logged separately from tool scope rejection, which remains an HTTP 200 MCP tool error with the authentication challenge in `_meta`.
|
|
15
|
+
Outcome fields include `worker` (the configured worker name the verified connection maps to, so a call is attributable to one worker; `null` for a call refused before authentication), tool, HTTP status, JSON-RPC error code, tool `isError`, duration, response bytes, completion (`finished` or `closed`), request phase, and fixed authentication/JWKS reasons, timing and fetch status. `pending` auth/JWKS outcomes with null timing mean the connection closed while verification was still running. `http_status: null` means no headers were sent; it must not be treated as HTTP 200. `response_bytes` is the serialized JSON body size prepared by the bridge, excluding HTTP headers. A closed response may not have delivered all those bytes. `finished` means Node handed the response to its transport; it does not prove ChatGPT accepted it. A pre-auth or incomplete-body failure has no tool name. Authentication is logged separately from tool scope rejection, which remains an HTTP 200 MCP tool error with the authentication challenge in `_meta`.
|
|
16
16
|
|
|
17
17
|
For an intermittent failure, correlate progress timestamps with `mcp_outcome` and reverse-proxy access entries. Check authentication failures first, then closed responses and their phase, then JSON-RPC or tool errors and response sizes.
|
|
18
18
|
|
|
@@ -32,7 +32,7 @@ The bridge reports observations and labels, not diagnoses. `dalan status --json`
|
|
|
32
32
|
|
|
33
33
|
**After a restart.** A claim last touched before startup is not swept until startup plus that claim's own lease duration. A claim touched since startup gets no restart grace. The first maintenance tick after the applicable deadline performs the sweep. Native protocol claims require explicit `renew_claim`; ordinary activity does not extend their fixed deadline.
|
|
34
34
|
|
|
35
|
-
**Queued work.** Preparation expiry and default-worker skip expiry continue during pause or a usage break.
|
|
35
|
+
**Queued work.** Preparation expiry and default-worker skip expiry continue during pause or a usage break. See [Jobs the worker never takes](pull-workers.md#jobs-the-worker-never-takes).
|
|
36
36
|
|
|
37
37
|
**Alerts and wake-ups.** The liveness classes above are observations, not proof of a cause. Attention alerts require 30 continuous observed minutes before publication; a recovery notice follows only an alert that was sent. `denial_mentioned` is log-only. Queue re-wakes are normally limited to one event per subscription every 90 seconds, with older work backing off after two hours. Pause, full capacity, inactive subscriptions and unresolved delivery can suppress them. For exact eligibility, settings and terminal transport behavior, see [Lifecycle events and metrics](operations.md#lifecycle-events-and-metrics).
|
|
38
38
|
|
package/docs/dalan-upgrade.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A service made by `dalan service install` updates itself and through `dalan service update`; see [service updates](service-setup.md#service-updates). This guide covers services and checkouts that earlier releases set up, and the ordered steps for a manual upgrade.
|
|
4
4
|
|
|
5
|
-
`dalan` is the main command. The package also installs `dalan-worker`, `dalan-acp-agent`, `dalan-alert`, `dalan-deadman
|
|
5
|
+
`dalan` is the main command. The package also installs `dalan-worker`, `dalan-acp-agent`, `dalan-alert`, `dalan-deadman` and `dalan-heartbeat`. `dalan-pr-reviewer` stays for one release as a stub that exits 2 and says the reviewer was retired. It does not install the commands of the `dot-bridge` package; change scripts, units and timers that run `dot-worker`, `dot-deadman`, `dot-heartbeat`, `dot-alert`, `dot-acp-agent` or `dot-pr-reviewer` to the `dalan` or `dalan-*` command. `DALAN_X` takes precedence over `DOT_BRIDGE_X`, including an explicitly empty value except `AUTH_MODE`; an empty `DALAN_AUTH_MODE` falls back to a non-empty legacy auth mode, or stays unset if neither supplies one; an actual legacy fallback emits at most one warning from the main thread in each process. The `DOT_ACP_*` and `DOT_DRAINED_*` adapter settings keep their existing names.
|
|
6
6
|
|
|
7
7
|
## Pre-upgrade checklist
|
|
8
8
|
|
|
@@ -64,6 +64,8 @@ Releases before 0.4.0 were published as `dot-bridge`. The old package installs t
|
|
|
64
64
|
|
|
65
65
|
Replace `VERSION` with the release you want (`npm view @tnunamak/dalan versions` lists them). The command is `@tnunamak/dalan@VERSION` here and in step 3, so both steps use the same release. The script is in the package; an installed `dalan` of a release that ships `scripts/upgrade-drain.mjs` can run it from `"$(npm root -g)/@tnunamak/dalan"` the same way. `BRIDGE_HOME` and `PORT` come from [Run a command in the service's environment](#pre-upgrade-checklist).
|
|
66
66
|
|
|
67
|
+
**Restart without waiting for leases (the default when the service has the gate).** `node scripts/upgrade-drain.mjs` asks the running service for `dalan quiesce status`. When it answers with the in-flight counters, the script drains by quiesce; `--until-quiescent` insists on that and fails when the gate is missing, and `--pause` forces the older pause-and-wait drain below. A service that answers HTTP 404 for the route (one that predates the gate) gets the pause drain, which keeps claims refused until the longest live lease ends (up to 20 minutes per deploy for a worker whose lease is 15): every worker idles for that time. If the status call fails any other way (a timeout, a transport error, a reply without counters), the script retries three times, then stops without changing anything and asks for `--until-quiescent` or `--pause`. The pause drain releases the pause it issued when it fails or is killed with SIGINT, SIGTERM or SIGHUP (`drain aborted (...); claims resumed`); a pause that was already in place is left as it was; after a completed drain the pause stays for the restart. The quiesce drain runs `dalan quiesce on`, never pauses claims, and does not wait for live leases: a restart on the same database keeps them, as long as the restart ends before a lease expires (a lease runs from the claim's last activity; an expired lease revokes the old claim ID and the new service returns the job to the queue). It waits only until no admitted call, delivery or unverified host check remains (`dalan quiesce status`). If it fails, times out, or is killed with SIGINT, SIGTERM or SIGHUP before the poll ends, it reopens admission itself and prints `drain aborted (...); gate reopened`; if that reopen call fails or its reply does not show the gate open, it says so, and you run `dalan quiesce off` under the old HOME. A gate that was already closed when the drain started is left closed, as a pause that was already in place is. A SIGKILL cannot be caught, so after one run `dalan quiesce status` and reopen by hand. After the restart the gate is off. Read calls still write activity rows and the maintenance timer still runs, so this is not full write silence.
|
|
68
|
+
|
|
67
69
|
The old package may not provide `dalan`. Until step 3 installs the new command, run new-release CLI commands as `node "$HOME/dalan-new/node_modules/@tnunamak/dalan/bin/dalan.mjs"` instead of `dalan`, with the same service-environment prefix. Use that staged CLI for every `dalan paths` call in the backup recipe; do not replace the serving package merely to obtain the backup command.
|
|
68
70
|
|
|
69
71
|
2. Stop the service. Linux: `systemctl --user stop dot-bridge-NAME.service`. macOS: `launchctl bootout user/$(id -u) ~/Library/LaunchAgents/LABEL.plist`; for an agent that an earlier release loaded, use `gui/$(id -u)` instead of `user/$(id -u)`. `LABEL` is `org.dalan.dot-bridge-NAME`. An install made by a release before 0.4.0 has a different label; find its file with `ls ~/Library/LaunchAgents | grep dot-bridge`.
|
|
@@ -126,6 +128,10 @@ Before replacing or relinking the old checkout, use `node "$HOME/dalan-drain/bin
|
|
|
126
128
|
|
|
127
129
|
The upgrade does not rewrite the service that an older release generated. That service keeps its unit or plist name (on macOS, the launchd label that release created), its `DOT_BRIDGE_*` environment names and its `~/.config/dot-bridge`, `~/.local/share/dot-bridge` and `~/.local/state/dot-bridge` directories. It works as it did, and each start logs one deprecation line for the old environment names. `worker-bridge-setup.mjs --remove` finds only the current label. Stop an agent of a release before 0.4.0 and delete its plist by hand before you remove the install; do not delete a home while another unit file in the user's unit directory names it or a process holds its `bridge.db` open. Do not run `worker-bridge-setup.mjs` again for the same worker to "refresh" it: it refuses to overwrite an existing unit.
|
|
128
130
|
|
|
131
|
+
## Route credentials and existing services
|
|
132
|
+
|
|
133
|
+
Dalan keeps the existing worker profiles, grants and signing keys on upgrade. Gozar 0.5 binds setup approvals and credential references to a specific owner and configuration. If Gozar requests configuration migration, keep the old installation and its route records. Resolve or close the exact old route with that installation before setting up a new private Gozar home. Enter credentials through the approval prompts when Gozar requests them. Copying old credentials or private route records cannot grant setup authority.
|
|
134
|
+
|
|
129
135
|
## Existing homes and explicit path migration
|
|
130
136
|
|
|
131
137
|
Fresh homes use `~/.config/dalan`, `~/.local/share/dalan`, `~/.local/state/dalan`, `~/.tmp/dalan`, and `~/.dalan/prepared-node-modules`. An existing legacy root remains in use when the corresponding new root is absent. Existing legacy installations also keep their not-yet-created state roots under the old name. An empty new root, empty directory scaffolding or zero-byte placeholders never hide a populated legacy root. Partial bootstrap roots also remain inactive until they contain the listed durable components present in the legacy root: authorization keys, database ledgers, worker profiles and their audit, thread limits, alert files and the ACP secret. Signal tokens count as one group: if the legacy root holds any `signal-token` or `signal-token.NAME` file, the new root must hold at least one, because rotation can replace one form with the other. The check uses this fixed list. It is not a full comparison, so a copy that lacks a custom file can still win; move whole roots, as below, and verify `dalan paths` afterwards. A listed file you removed on purpose from the new root keeps the legacy root in use; remove it from the legacy root too, or remove the legacy root after the explicit migration. When both corresponding roots are initialized, the new root wins. Companion roots that do not exist yet follow the existing installation; after a complete config, data or state area is explicitly migrated, absent companions use the new spelling. Complete config-only or data-only migrations can therefore start with the other area still under its legacy name. A missing workers profile recorded as previously present still requires explicit recovery, regardless of the directory spelling. Files from two roots are never merged. Repository checks prefer `.dalan.json` and accept `.dot-bridge.json` when the new file is absent.
|
|
@@ -213,7 +219,7 @@ For an existing identity profile, startup fills only omitted lists and leaves ex
|
|
|
213
219
|
|
|
214
220
|
The private journal commits each seed and one audit event together, with `before: legacy-any` and `after: exact`. Interrupted profile publication reuses that committed seed. Doctor and `worker list --json` show the resulting lists and audit events. Back up `workers-repos.json` with the rest of the private configuration. Preserve `bridge.db.secrets/storage.key` with the encrypted database too; a new data sibling missing that key cannot replace the legacy root, even when all its other data files exist.
|
|
215
221
|
|
|
216
|
-
Before upgrading a built-in-auth installation, run `node scripts/upgrade-drain.mjs` from the new release while the old service is still running, with the old HOME and environment. From a checkout, run it in a checkout of the new tag (`git worktree add`). For an npm install, run it from a scratch copy of the new package (`npm install --prefix "$HOME/dalan-new" @tnunamak/dalan@VERSION`, then `cd "$HOME/dalan-new/node_modules/@tnunamak/dalan"`): it uses the `bin/dot-worker.mjs` in the current directory. Use the same `VERSION` that you will install in the upgrade; do not substitute the latest release for the planned one.
|
|
222
|
+
Before upgrading a built-in-auth installation, run `node scripts/upgrade-drain.mjs` from the new release while the old service is still running, with the old HOME and environment. From a checkout, run it in a checkout of the new tag (`git worktree add`). For an npm install, run it from a scratch copy of the new package (`npm install --prefix "$HOME/dalan-new" @tnunamak/dalan@VERSION`, then `cd "$HOME/dalan-new/node_modules/@tnunamak/dalan"`): it uses the `bin/dot-worker.mjs` in the current directory. Use the same `VERSION` that you will install in the upgrade; do not substitute the latest release for the planned one. With a service that has no quiesce gate (or with `--pause`) it pauses new claims but does not pause submissions, so jobs can still be queued while it waits. It prints each active job ID and lease expiry. The default timeout is five minutes; set `DALAN_UPGRADE_DRAIN_TIMEOUT_MS` for another bounded wait. If a command times out, returns an HTTP error, or prints invalid JSON, the drain prints the same recovery step: keep the old service running, let workers finish or wait for leases to expire, run `dalan resume` under the old HOME, then retry the drain. After a successful drain, stop the old service, replace only the code, start the new service with the same HOME and configuration, then run `dalan resume` to release the persisted pause. An expired lease revokes the old claim ID but does not prove its process stopped; the new service sweeps the row back to the queue, where the claimant can resume the work only with a fresh claim epoch after stopping the old run. Pre-upgrade claims have no authenticated connection binding and cannot be safely assigned one during migration.
|
|
217
223
|
|
|
218
224
|
To inspect and finish the migration before restarting the service, stop the service and run the new build with its HOME, PATH and environment:
|
|
219
225
|
|
|
@@ -243,6 +249,3 @@ The producer source for the fix loop is now `fix-loop`. The name used before thi
|
|
|
243
249
|
|
|
244
250
|
Deploy the CLI and the server together. A request that the new CLI sends or stores with `fix-loop` as its source, objective key or task kind is rejected by a server that has been rolled back to an earlier release, so a rollback of the server needs a rollback of the CLI, and the reverse. The database itself needs no change in either direction.
|
|
245
251
|
|
|
246
|
-
## PR-head reviewer report thread key
|
|
247
|
-
|
|
248
|
-
The `report_thread_id` key of the PR-head reviewer config was named `lead_thread_id` before this release. The old key is still read; when both are set, `report_thread_id` wins. The `delivery_via` value in the reviewer log for this fallback is now `report-thread` (it was `lead`).
|
package/docs/deadman.md
CHANGED
|
@@ -26,6 +26,10 @@ DOT_DEADMAN_NTFY_TOKEN=<optional provider token>
|
|
|
26
26
|
|
|
27
27
|
The service listens on `127.0.0.1:8788`; put an HTTPS reverse proxy in front of it for the bridge host, or use a private authenticated transport. Keep the bearer token only on the bridge host and the receiver host. The configured notification URL must be canonical and must not redirect. The receiver rejects a remote plain-HTTP publisher URL at startup. The unit resolves Node through `/usr/local/bin:/usr/bin:/bin` and the CLI requires Node 24+. Install Node there or set `ExecStart` to its installed absolute path. Then enable `systemd/dot-deadman.service` on the independent host.
|
|
28
28
|
|
|
29
|
+
The independent alerter is a system unit. It restarts after any process exit, including exit code 0, with a three-second delay. Its start-rate limit is disabled so repeated failures do not permanently park the monitor. An intentional operator stop still stops it; this restart policy does not prove notification delivery or protect against host failure.
|
|
30
|
+
|
|
31
|
+
The bridge itself is a user unit, separate from the system alerter. An enabled bridge user unit starts at boot without a login only when lingering is enabled with `loginctl enable-linger <user>` for its owning account. Enabling the independent alerter does not enable lingering or start the bridge.
|
|
32
|
+
|
|
29
33
|
On the bridge host, create `~/.config/dalan/deadman.env` with mode 0600:
|
|
30
34
|
|
|
31
35
|
```sh
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Authority and lifetime
|
|
2
|
+
|
|
3
|
+
A participant is an identity. Requesting, performing, lending, and borrowing are independent grants, not identity classes. An accepted job does not grant a tool or destination permission. This is a source map, not proof of live hosted authorization.
|
|
4
|
+
|
|
5
|
+
| Role | Grant that carries it today | Gap | Enforcer revokes by |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| Request | Per-job owner capability `src/store.mjs#owner`; admin socket/operator key `src/server.mjs#operatorKey`; destination approval and submission policy `src/store.mjs#destinationAdmissionInTransaction` | Requesters need the local host administrative surface. D4 adds a requester catalog profile for hosts unable to run Dalan. | Owner-hash check, administrative access control, current destination admission, and retention fence; no inference from role name |
|
|
8
|
+
| Perform | Enrolled worker connection `src/workers.mjs#connectionsDigest`; claim epoch and lease `src/store.mjs#lease_deadline_at` | Hosted path exists. Runtime and peer adapters remain D3/D5. | Reject a stale connection, epoch, cancelled job, or expired lease at the enforcing operation |
|
|
9
|
+
| Lend tools | Registration and per-worker grants `src/tool-registry.mjs#grantChange`; `src/store.mjs#registered_tools`, `src/store.mjs#tool_grants` | T3 grants are broad and job-independent; C3 adds scope. | Owner revocation `src/tool-registry.mjs#revoke`; disabled registration or absent grant denies access |
|
|
10
|
+
| Borrow tools | list_tools, call_tool_read, call_tool_write `src/server.mjs#list_tools` | No additional role surface required. | Registry checks the current grant; possession of a tool name does not authorize a call |
|
|
11
|
+
|
|
12
|
+
| Lifetime | Where it lives | Revoked by | Enforcer revokes by |
|
|
13
|
+
|---|---|---|---|
|
|
14
|
+
| Relationship | NEW per-side relationships row with shared relationship_id (C2). Today implicit in worker profile and destination thread. | Ending the relationship; jobs, questions and results remain. | Planned relationship admission fence, not erasure or automatic cancellation of retained work |
|
|
15
|
+
| Work | assignments, claims, job_questions, protocol_events `src/store.mjs#job_questions`, `src/store.mjs#protocol_events` | Terminal state, cancel, retention tombstone | Job transition/epoch checks and `src/protocol-retention.mjs#assertProtocolAvailable` |
|
|
16
|
+
| Authority | Separate owner capability, lease, connection fence, tool grants, destination approvals and retention. C2 proposes a read-only dalan grants composition, not a new grant store. | Each grant's enforcer | Lease deadline, connection digest, registry revocation, owner-hash validation, destination admission and retention fences remain local to their enforcers |
|
|
17
|
+
|
|
18
|
+
Relationship continuity must not extend authority lifetime. Revocation after an await requires current authority at the effect, not merely at request admission. Ending foreground activity is not evidence that a native operation stopped.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Failure closure map
|
|
2
|
+
|
|
3
|
+
The Closed by column names planned PR responsibility, not merged or tested closure. characterized marks the supplied A1 characterization targets and existing source seams; no traces were executed for this document. gap marks a partial facility that does not by itself solve the failure. open means no facility identified at this pin. A cited facility is an anchor, not a claim that the whole failure is solved.
|
|
4
|
+
|
|
5
|
+
| F | Title | Facility today | Closed by (PR id) | Status |
|
|
6
|
+
|---|---|---|---|---|
|
|
7
|
+
| F01 | Lost creation reply | `src/store.mjs#owner_submit_commands` | A1 | characterized |
|
|
8
|
+
| F02 | Conflicting idempotency payload | `src/protocol-owner-command.mjs#executeProtocolOwnerCommand` | A1, B1 | characterized |
|
|
9
|
+
| F03 | Completion precedes start response | `src/result-binding.mjs#terminalAuthority` | A1 | characterized |
|
|
10
|
+
| F04 | Question after foreground ends | `src/store.mjs#askQuestion` | A1, B2 | characterized |
|
|
11
|
+
| F05 | Pending question restart | `src/store.mjs#job_questions` | A1, B2 | characterized |
|
|
12
|
+
| F06 | Answer saved before preparation | `src/answer-journal.mjs#prepare` | B1 | gap |
|
|
13
|
+
| F07 | Answer prepared before send | `src/answer-journal.mjs#send` | B1 | gap |
|
|
14
|
+
| F08 | Remote answer committed; reply lost | `src/answer-journal.mjs#reconcile` | B1 | gap |
|
|
15
|
+
| F09 | Human consent sent to model | `src/store.mjs#QUESTION_PURPOSES`; `src/destinations/t3.mjs#messageFor` | B3 | gap |
|
|
16
|
+
| F10 | Question node equals task node | `src/store.mjs#job_questions` | A1, B4 | characterized |
|
|
17
|
+
| F11 | Correction before finish | none | C1 | open |
|
|
18
|
+
| F12 | Finish before correction | none | C1 | open |
|
|
19
|
+
| F13 | Correction with question outstanding | none | B3, C1 | open |
|
|
20
|
+
| F14 | Stale epoch write | `src/store.mjs#consumeAnswer` | A1, B4 | characterized |
|
|
21
|
+
| F15 | Connection replaced | `src/workers.mjs#connectionsDigest` | A1, C2 | characterized |
|
|
22
|
+
| F16 | Revocation after await | `src/store.mjs#destinationAdmissionInTransaction` | A1 | characterized |
|
|
23
|
+
| F17 | Unauthorized destination | `src/store.mjs#destinationSnapshot` | C3 | gap |
|
|
24
|
+
| F18 | Onward widening | none | D4 | open |
|
|
25
|
+
| F19 | Result acknowledgment lost | `src/notify-ledger.mjs#NotifyLedger` | B2, B4 | gap |
|
|
26
|
+
| F20 | Sibling canceled | `src/protocol-stop-observer.mjs#createProtocolStopObserver` | A1 | characterized |
|
|
27
|
+
| F21 | Parent stopped before return | `src/destinations/t3.mjs#canAdmitContinuation` | B2, C4 | gap |
|
|
28
|
+
| F22 | Foreground interrupted | `src/t3-control.mjs#runT3Tool` | B2, C4 | gap |
|
|
29
|
+
| F23 | Stop denied or unobservable | `src/protocol-stop-observer.mjs#createProtocolStopObserver` | B2, C4, D3 | gap |
|
|
30
|
+
| F24 | Receipt retention loss | `src/protocol-retention.mjs#assertProtocolAvailable` | A1, B1, C7 | characterized |
|
|
31
|
+
| F25 | Interior feed gap | `src/durable-waiters.mjs#createDurableWaiters` | A1, B4, C7 | characterized |
|
|
32
|
+
| F26 | Exclusive wait deadlock | `src/protocol-owner-waiters.mjs#createProtocolOwnerWaiters` | A1, B4 | characterized |
|
|
33
|
+
| F27 | Replayable resume repeats effect | `src/answer-journal.mjs#send` | B1, D3 | gap |
|
|
34
|
+
| F28 | Tool-level error in completed task | `src/mcp-outcome.mjs#recordMcpResponse` | A1, C5 | characterized |
|
|
35
|
+
| F29 | Tasks capability absent | `src/execution.mjs#admitAdapterCapabilities` | C5 | gap |
|
|
36
|
+
| F30 | Webhook accepted but no agent | `src/notify-ledger.mjs#NotifyLedger` | B2, D1 | gap |
|
|
37
|
+
| F31 | Catalog/credential renewal failure | none | C5, D1 | open |
|
|
38
|
+
| F32 | Rollback forgets a remote commit | `src/claim-command-ledger.mjs#createClaimCommands` | B4, C7 | gap |
|
|
39
|
+
| F33 | Artifact bytes or source mismatch | `src/artifact-journal.mjs#artifactBytesDigest` | C6 | gap |
|
|
40
|
+
| F34 | Native-to-HTTP tool re-export | none | C3, D4 | open |
|
|
41
|
+
| F35 | Policy order lacks availability event | `src/pull-queue.mjs#PullQueue` | A1, D1 | characterized |
|
|
42
|
+
| F36 | Only one host succeeds | none | D1 | open |
|
|
43
|
+
|
|
44
|
+
## Requirement index
|
|
45
|
+
|
|
46
|
+
Requirements below are design acceptance obligations, not a count of implemented features or user validation.
|
|
47
|
+
|
|
48
|
+
| Requirement | Name |
|
|
49
|
+
|---|---|
|
|
50
|
+
| R01 | Core host neutrality |
|
|
51
|
+
| R02 | Relationship continuity |
|
|
52
|
+
| R03 | Separate authority lifetime |
|
|
53
|
+
| R04 | Role symmetry |
|
|
54
|
+
| R05 | Authenticated identity |
|
|
55
|
+
| R06 | Capability intersection |
|
|
56
|
+
| R07 | No silent downgrade |
|
|
57
|
+
| R08 | Immutable attempt |
|
|
58
|
+
| R09 | Creation uncertainty |
|
|
59
|
+
| R10 | Durable external question |
|
|
60
|
+
| R11 | One answer authority |
|
|
61
|
+
| R12 | Exact answer replay |
|
|
62
|
+
| R13 | Clarification versus consent |
|
|
63
|
+
| R14 | Material input identity |
|
|
64
|
+
| R15 | Correction races |
|
|
65
|
+
| R16 | Terminal immutability |
|
|
66
|
+
| R17 | Selective tool grants |
|
|
67
|
+
| R18 | Onward attenuation |
|
|
68
|
+
| R19 | Current authority at effect |
|
|
69
|
+
| R20 | Typed control |
|
|
70
|
+
| R21 | No parent resurrection |
|
|
71
|
+
| R22 | Independent returns |
|
|
72
|
+
| R23 | Artifact provenance |
|
|
73
|
+
| R24 | Retention truth |
|
|
74
|
+
| R25 | No deadlocking waits |
|
|
75
|
+
| R26 | Native resume truth |
|
|
76
|
+
| R27 | Activation separation |
|
|
77
|
+
| R28 | Real hosted permission |
|
|
78
|
+
| R29 | Incremental migration |
|
|
79
|
+
| R30 | Rollback after effects |
|
|
80
|
+
| R31 | Native capabilities retained |
|
|
81
|
+
| R32 | No mandatory platform |
|
|
82
|
+
| R33 | No unauthorized fallback |
|
|
83
|
+
| R34 | Versioned route qualification |
|
|
84
|
+
| R35 | Independent portability |
|
|
85
|
+
| R36 | Operator burden and economics |
|
|
86
|
+
| R37 | Policy-order discovery |
|
|
87
|
+
| R38 | Safe source scope |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Identity boundaries
|
|
2
|
+
|
|
3
|
+
Pinned source: cb6b119196f025ac8cbbf93f0ee8bd0a30221654. These are distinct identities, not interchangeable credentials. NEW and Candidate entries are design targets, not implemented claims.
|
|
4
|
+
|
|
5
|
+
| Identity | Lives at | Status | Must never become |
|
|
6
|
+
|---|---|---|---|
|
|
7
|
+
| Authenticated principal | OAuth subject `src/auth.mjs#subject`; per-job owner hash `src/store.mjs#owner_hash`; operator key `src/server.mjs#operatorKey` | Exists | A job, session, or delegated role |
|
|
8
|
+
| Enrolled connection | workers.json connections; fence and digest `src/workers.mjs#connectionsDigest` | Exists | The principal or permanent relationship |
|
|
9
|
+
| Relationship | Proposed relationships.relationship_id | NEW (C2) | A worker connection, job, or authority grant |
|
|
10
|
+
| Logical shared context | Candidate meta.objective_key if C1 step 0 confirms its semantics; otherwise proposed relationships.context_ref | Candidate | A native session or permission |
|
|
11
|
+
| Work or request | assignments.request_id `src/store.mjs#request_id` | Exists | A question or parent session |
|
|
12
|
+
| Native session | T3 delivery in `src/destinations/t3.mjs#createT3Destination`; ACP session in `bin/dot-acp-agent.mjs#sessionFile` | Exists, connector-only | A core identity or grant |
|
|
13
|
+
| Claim and lease epoch | claims.claim_id and protocol_events.epoch `src/store.mjs#protocol_events` | Exists | Stable work identity or connection identity |
|
|
14
|
+
| Question | job_questions(request_id, question_id) `src/store.mjs#job_questions` | Exists | A task node or consent grant |
|
|
15
|
+
| Material input revision | Candidate meta.revision plus assignments.payload_hash | Candidate (C1) | Protocol mutation revision |
|
|
16
|
+
| Protocol mutation revision | protocol_events.revision; expected_revision `src/protocol-owner-command.mjs#executeProtocolOwnerCommand` | Exists | Material input identity |
|
|
17
|
+
| Operation key | Worker receipts `src/claim-command-ledger.mjs#createClaimCommands`; owner_submit_commands and tool_idempotency `src/store.mjs#owner_submit_commands`, `src/store.mjs#tool_idempotency`; answer:<question_id> journal key `src/answer-journal.mjs#prepare` (R5) | Exists | A grant, arbitrary retry, or changed intent |
|
|
18
|
+
| Artifact | artifacts.id, sha256 and sealing `src/store.mjs#sha256`; byte journal `src/artifact-journal.mjs#createArtifactJournal` | Exists | A delivery acknowledgment or unverified source claim |
|
|
19
|
+
| Delivery attempt | notifications.id and attempt_id `src/store.mjs#attempt_id`; `src/ack-ledger.mjs#AckLedger` | Exists | A new operation or completed work |
|
|
20
|
+
| Parent lifecycle generation | Opaque parent_generation column `src/store.mjs#parent_generation`; destination capture/read `src/destinations/t3.mjs#readGeneration` | Exists at this pin (NEW in original R6 plan) | Core session state or authority to resurrect a parent |
|
|
21
|
+
|
|
22
|
+
The objective metadata exists in `src/objectives.mjs#metaFields`. That fact alone does not confirm it as shared context or material input identity. C1 step 0 must decide those semantics before promotion.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# pnpm support for the prepared-dependency store (plan, 11-26)
|
|
2
|
+
|
|
3
|
+
Built (see "Spike and build results" at the end). The text above is the plan as approved; the results section records where the build differs.
|
|
4
|
+
|
|
5
|
+
## Answer to the question asked
|
|
6
|
+
Main (#90) supports npm lockfiles v2/v3 only, including npm workspaces. A `pnpm-lock.yaml` is not read at all. The repo's `package-lock.json` is looked up; none exists in pdpp, so every pdpp check fails with unprepared dependencies.
|
|
7
|
+
|
|
8
|
+
## Prior art (divan: sandboxing/fast-untrusted-jobs-should-reuse-verified-immutable-dependencies-...)
|
|
9
|
+
- `pnpm fetch` builds a store from the lockfile alone (manifest contents ignored); `pnpm install --offline --frozen-lockfile` then assembles node_modules with no registry. Local `file:` deps are skipped at fetch time.
|
|
10
|
+
- pnpm node_modules is hardlinks into a content-addressed store plus relative symlinks. A shared store is not an assembled tree.
|
|
11
|
+
- pnpm settings docs restrict repo-controlled registry/env interpolation (secret-leak risk). So the preparation must not honour a repo `.npmrc`.
|
|
12
|
+
- Sandboxed CI pattern (Codex/Copilot/Devin/Jules setup scripts, devbox, Nix): fetch with network once, freeze, run offline. Our npm and Go preparers already follow it.
|
|
13
|
+
|
|
14
|
+
## Design
|
|
15
|
+
A new kind modelled on `prepared-go-modules.mjs`, publishing through the same pipeline as npm workspaces (trees, metadata, freeze, validate, in-child prepare, pinned-base rule).
|
|
16
|
+
- Identity: sha256 of `pnpm-lock.yaml`, `pnpm-workspace.yaml`, root `package.json`, each importer `package.json`; runtime (node, pnpm version, platform, arch). Importer list comes from the lock's `importers:` keys with a fail-closed parser. Host pnpm version must equal `packageManager` or the repo is unsupported.
|
|
17
|
+
- Unsupported (fail closed, offer filter says so): repo `.npmrc`, `patchedDependencies`, `link:` or `file:` outside the importer set, importer paths with links or odd characters.
|
|
18
|
+
- Prepare, in the detached child: stage dir with the pinned files; `pnpm fetch` then `pnpm install --offline --frozen-lockfile --ignore-scripts --package-import-method=copy` into a stage-private store (or a shared download store with copy import). Copy import is required: hardlinked store files share inodes, so `freezeTree` chmod would alter the store. Minimal env, as in the Go preparer.
|
|
19
|
+
- Publish: root `node_modules` plus each importer's `node_modules` as workspace trees (already supported). `validateTree` gets one new rule: a relative link is valid when its lexical target is inside the root tree, another allowed importer tree, or an importer directory. Trial: 2694 links in the root tree; the only ones leaving it are 12 links to importer directories, which the existing workspace-link rule already allows.
|
|
20
|
+
- Wire-up: `workspace.mjs prepareDependencies` (same unchanged-from-base rule, adds `pnpm-lock.yaml` and workspace yaml), `dalan prepare-deps --pnpm`, offer filter from #88, docs.
|
|
21
|
+
- Checks: do not use `pnpm test` (pnpm is not in the sandbox, and pdpp's script wrapper starts its own cgroup sandbox). Each package check runs `node --import tsx scripts/run-node-tests.mjs --test ...` directly.
|
|
22
|
+
|
|
23
|
+
## Size
|
|
24
|
+
- `src/prepared-pnpm.mjs` about 170 lines; validateTree rule about 20; wiring about 30; docs about 15.
|
|
25
|
+
- Tests about 300 lines: identity and fail-closed cases, link rules (escape, absolute, other-tree), copy independence (freeze does not touch a source file), failed fetch publishes nothing, offline fixture workspace with a seeded store.
|
|
26
|
+
- One PR, one builder (Sonnet, medium), about one day. A spike of 1-2 h comes first (below).
|
|
27
|
+
- Disk: about 1 GB per distinct lock (trial tree 961 MB, 55,766 entries). The disk is 92% full, 114 GB free; the store holds 3.2 GB for 7 npm entries and has no pruning. pdpp's lock changed once in the last 7 days. A keep-newest-N prune is a separate row; I would add it with this build.
|
|
28
|
+
|
|
29
|
+
## Coverage (last 7 days, 71 pdpp worker patches that have a patch file)
|
|
30
|
+
- display, list-envelope, reference-contract, pdpp-brand-react, operator-ui: 35/71 = 49%.
|
|
31
|
+
- Plus reference-operations-sandbox: 48/71 = 68%.
|
|
32
|
+
- apps/site would reach 87%, but its tests need a generate step (`@/generated` is missing after install), so it is out of scope.
|
|
33
|
+
That clears the maintainer's rule (a default only if the test covers code patches touch; the npm candidates covered 0%).
|
|
34
|
+
|
|
35
|
+
## Expect it to work because:
|
|
36
|
+
1. The hard parts already work on main: read-only tree mounts, workspace trees, the pinned-base rule, in-child preparation, freeze and validate. pnpm only replaces the installer.
|
|
37
|
+
2. Trial (pdpp worktree, pnpm 12.6.0), not a guess: offline frozen `--ignore-scripts` install 6.4 s with a warm store; all links relative; tests pass offline with no postinstall: reference-contract 165, operator-ui 264/264, display 80/80 (4.6 s), pdpp-brand-react 71/71 (8.7 s), reference-operations-sandbox pass (1 s), tsc 0.7 s.
|
|
38
|
+
3. Coverage is measured from the real patches (above), not assumed.
|
|
39
|
+
|
|
40
|
+
Likeliest-wrong assumption: the bridge sandbox can run those commands with the pnpm tree mounted read-only and the cross-tree links resolving at the mount points (root tree at `node_modules`, importer trees at `packages/x/node_modules`). I tested the commands on the host, not in the sandbox.
|
|
41
|
+
Cheapest settler (step 0, about 1-2 h, before the build): hand-assemble the trial tree into a throwaway store entry and run one real allowlisted host check on a pdpp worktree through the bridge sandbox. If it passes, build. If links or tsx's cache write fail, the plan changes before any code is written.
|
|
42
|
+
|
|
43
|
+
Other risks: copy import time (not measured, est. 10-20 s extra per prepare); native postinstalls (better-sqlite3, onnxruntime-node, protobufjs) are skipped, so a package whose tests load them fails. None of the six packages above needs one. A rebuild step for an owner-approved list is v2.
|
|
44
|
+
|
|
45
|
+
## Open decision for the maintainer
|
|
46
|
+
One default check for pdpp that runs the six packages in sequence (simple; each ran 1-9 s, the whole run is not yet timed), or per-path checks (needs checks.json support I have not confirmed). I recommend the single sequential check.
|
|
47
|
+
|
|
48
|
+
## Spike and build results (11-26)
|
|
49
|
+
Spike (pdpp origin/main, pnpm 12.6.0, lock v9, real bridge sandbox through `runHostBudget`):
|
|
50
|
+
- `pnpm install --frozen-lockfile --ignore-scripts --offline --package-import-method=copy`: 5.0 s, tree 1002 MB, 7 importer trees (apps/site, packages/pdpp-brand, conformance-suite, pdpp-brand-react, display, operator-ui, reference-contract); 2694 links in the root tree, all relative; only 12 leave the root tree, all to importer directories.
|
|
51
|
+
- Mounted as `host-budget-storage.py` does (root tree at `/workspace/node_modules`, importer trees at `/workspace/<path>/node_modules`), the six packages pass: display 80, list-envelope 16, reference-contract 165, pdpp-brand-react 71, operator-ui 264, reference-operations-sandbox 15 = 611 tests. One `/usr/bin/sh -c` check; CPU 27-31 s of 120, wall 24-32 s of 180, memory 366 MB, disk write 22 MB of 512.
|
|
52
|
+
- The process cap is the tight budget: peak 120-123 of 128 at `--test-concurrency=1`; at pdpp's default concurrency the sequence failed with `budget exceeded: processes`. A single package peaks at 63-97. The check must pass `--test-concurrency=1` (documented in docs/operations.md). The cause of the extra ~23 processes was not chased.
|
|
53
|
+
- Out of scope: apps/site (its tests need a generate step), native postinstalls (skipped by `--ignore-scripts`; none of the six packages needs one).
|
|
54
|
+
|
|
55
|
+
Build (the same check, prepared through the new code, passed again: 611 tests, exit 0, CPU 22.9 s, wall 23.6 s, memory 365 MB, 121 processes). Where the build differs from, or adds to, the plan:
|
|
56
|
+
- The lock is two YAML documents (pnpm 11+): the first pins pnpm itself, the second is the project. The parser reads only the last document.
|
|
57
|
+
- A workspace package with no dependencies has no `importers:` block, yet others link to it (`list-envelope`, `reference-operations-sandbox`). A `link:` target is therefore valid when it is an importer or matches a `packages:` glob of `pnpm-workspace.yaml`; the same set is the "importer directory" set for the tree-link rule.
|
|
58
|
+
- `pnpm fetch` also fills the virtual store, so it gets `--package-import-method=copy` too; otherwise hardlinks into the store reach the published tree. The store is deleted before `freezeTree`, so a hardlink could never alter a surviving store file, but the flag keeps the trees independent.
|
|
59
|
+
- The offline install reads package metadata that `fetch` cached under pnpm's cache directory. The stage points `XDG_CACHE_HOME` at a stage-private directory (`--cache-dir` is not accepted by every pnpm 12 release) and deletes it with the stage. HOME stays the owner's so pnpm finds the pinned release it switches to.
|
|
60
|
+
- The version rule is checked by running `pnpm --version` in a scratch directory whose package.json pins `packageManager`: pnpm switches to the pinned release when it has one. On this host the default pnpm is 12.23.0 and pdpp pins 12.6.0; the switch works from the cached release. If the release is absent and cannot be fetched, the repository is unsupported with that reason.
|
|
61
|
+
- Also unsupported: `.pnpmfile.cjs` and its variants (repository code at install), and `registries`, `registry`, hooks, `patchedDependencies` and similar keys in `pnpm-workspace.yaml`.
|
|
62
|
+
- pnpm 12 reads `pnpm_config_*` environment variables, not `npm_config_*`, for the registry. The preparer forwards `pnpm_config_registry` and the fetch-retry settings from the owner's environment; the in-child environment filter forwards `pnpm_config_*`.
|
|
63
|
+
- Prune: `src/prepared-store-prune.mjs`, run by `dalan prepare-deps` after each npm or pnpm preparation (never in the library calls), plus `dalan prepare-deps --prune [--keep N]`.
|
|
64
|
+
- Known limits: no native rebuild; process peak close to the cap; `pnpm` must be on the PATH of the bridge and the owner.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Reuse ledger
|
|
2
|
+
|
|
3
|
+
Pinned source: cb6b119196f025ac8cbbf93f0ee8bd0a30221654. RETAIN describes current modules, not test execution. ADD, NEW, OPT and UP describe proposed work. No product code changes belong to A2.
|
|
4
|
+
|
|
5
|
+
## Retained modules
|
|
6
|
+
|
|
7
|
+
License `repo` identifies first-party code, not a license assertion for its dependencies. Node built-ins are not vendored packages. The ACP facade imports @agentclientprotocol/sdk 1.8.0 as declared in package.json. Its installed package.json is absent from this checkout; the dependency license is UNVERIFIED, not inferred from Dalan's license. Transitive dependency licenses need their own manifests before redistribution.
|
|
8
|
+
|
|
9
|
+
| Module | Does today | Disposition | License |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| `src/store.mjs#askQuestion` | Jobs, claims, reports; identified questions, answers and consumption. Owner capabilities, keyed submission, late evidence, decisions and transactional notification outbox. | RETAIN purpose and opaque generation; ADD revises, relationship and grant scope | repo |
|
|
12
|
+
| `src/protocol-owner-command.mjs#executeProtocolOwnerCommand` | Keyed owner commands bind job, owner hash, key, expected revision, operation and payload. Exact retry replays; changed identity conflicts. | RETAIN | repo |
|
|
13
|
+
| `src/claim-command-ledger.mjs#createClaimCommands` | Worker command receipts. | RETAIN | repo |
|
|
14
|
+
| `src/protocol-owner-waiters.mjs#createProtocolOwnerWaiters` | Durable owner wait materialization. | RETAIN | repo |
|
|
15
|
+
| `src/durable-waiters.mjs#createDurableWaiters` | Durable wait records across restart. | RETAIN | repo |
|
|
16
|
+
| `src/artifact-journal.mjs#createArtifactJournal` | Chunked byte-verified artifacts. | RETAIN | repo |
|
|
17
|
+
| `src/result-binding.mjs#createResultBindings` | Terminal result bindings to artifact digests. | RETAIN | repo |
|
|
18
|
+
| `src/protocol-stop-observer.mjs#createProtocolStopObserver` | Scoped stop observations require trusted evidence. | RETAIN | repo |
|
|
19
|
+
| `src/protocol-retention.mjs#assertProtocolAvailable` | Retention tombstones fence access. | RETAIN | repo |
|
|
20
|
+
| `src/lifecycle.mjs#lifecycleTypes` | Append-only lifecycle records coordinated with mutations. | RETAIN + ADD typed control events (C4) | repo |
|
|
21
|
+
| `src/destinations/index.mjs#createDestinations` | Requester destination adapter selection. | RETAIN; generation admission is implemented in the T3 destination | repo |
|
|
22
|
+
| `src/destinations/none.mjs#createNoneDestination` | No-delivery destination. | RETAIN | repo |
|
|
23
|
+
| `src/destinations/t3.mjs#createT3Destination` | Requester result delivery uses a stable message identity. | RETAIN opaque generation admission; inspect/send remains best effort, not an atomic upstream fence | repo |
|
|
24
|
+
| `src/ack-ledger.mjs#AckLedger` | Acknowledgment evidence for send attempts. | RETAIN | repo |
|
|
25
|
+
| `src/notify-ledger.mjs#NotifyLedger` | Durable send ledger; uncertain sends need reconciliation, not blind resend. | RETAIN | repo |
|
|
26
|
+
| `src/workers.mjs#parseWorkers` | Worker profiles, enrollment and connection digests. | RETAIN adapter declaration; ADD relationship link | repo |
|
|
27
|
+
| `src/tool-registry.mjs#createToolRegistry` | Default-deny worker grants, closed handler kinds and argument-free audit. | RETAIN + ADD grant scope (C3) | repo |
|
|
28
|
+
| `src/execution.mjs#admitHostExecution` | Capability declarations and execution admission. | RETAIN qualification pattern (C5) | repo |
|
|
29
|
+
| `scripts/capability-table-test.mjs#gate` | Checks declared capabilities against the gate. | RETAIN qualification pattern (C5) | repo |
|
|
30
|
+
| `src/mcp-stdio.mjs#TOOLS` | Requester MCP surface. | RETAIN + ADD dalan_answer and dalan_questions (B5) | repo |
|
|
31
|
+
| `bin/dot-worker.mjs#writeReceipt` | Requester CLI and owner receipt files. Existing receipt is not the proposed answer journal. | RETAIN + ADD answer/questions surface (B5) | repo |
|
|
32
|
+
| `src/demo-worker.mjs#workJob` | Deterministic worker. | RETAIN first-job prover and B4 fixture | repo |
|
|
33
|
+
| `src/try.mjs#beginPairing` | Harmless first-job route through OAuth enrollment. | RETAIN first-job prover and B4 fixture | repo |
|
|
34
|
+
| `src/pull-queue.mjs#PullQueue` | Policy-order queue; discovery and acquisition are distinct. | RETAIN route characterization A1 and live D1 | repo |
|
|
35
|
+
| `src/work-order.mjs#compileWorkOrder` | Policy work-order compilation and source scope checks. | RETAIN | repo |
|
|
36
|
+
| `src/acp-bridge.mjs#prepareAssignment` | ACP facade for T3 requester assignment preparation. | RETAIN as is; B-thin wake covers blocked-question continuation | repo |
|
|
37
|
+
| `bin/dot-acp-agent.mjs#runTurn` | ACP agent facade; blocked question ends the foreground turn rather than becoming native durable continuation. | RETAIN as is | repo; @agentclientprotocol/sdk: UNVERIFIED (package manifest unavailable) |
|
|
38
|
+
| `src/mcp-outcome.mjs#recordMcpResponse` | Tool response outcome is separate from job completed/blocked/failed (F28). | RETAIN | repo |
|
|
39
|
+
| `src/t3.mjs#inspectThread` | T3 thread inspection and classification. | RETAIN T3 adapter; generation comparison is present, atomic upstream fencing remains unverified | repo |
|
|
40
|
+
| `src/t3-transport.mjs#dispatchT3Result` | Stable-id T3 result dispatch. | RETAIN | repo |
|
|
41
|
+
| `src/t3-control.mjs#runT3Tool` | T3 reverse-control operations. | RETAIN | repo |
|
|
42
|
+
| `src/t3-audit.mjs#prepareT3Audit` | T3 control audit admission and records. | RETAIN | repo |
|
|
43
|
+
| scripts/conformance/ | Golden trace suite with real-server and SQLite harness; the design input specifies 42 traces. Count is not a test-pass claim. | RETAIN executable contract (D3); recheck the count when the suite changes | repo |
|
|
44
|
+
|
|
45
|
+
Additional source anchors: `src/store.mjs#answerQuestion`, `src/store.mjs#consumeAnswer`, `src/store.mjs#owner_submit_commands`, `src/store.mjs#destinationSnapshot`. Requester answer replay now also has `src/answer-journal.mjs#prepare`, `src/answer-journal.mjs#send` and `src/answer-journal.mjs#reconcile`.
|
|
46
|
+
|
|
47
|
+
## Small additions
|
|
48
|
+
|
|
49
|
+
The following rows separate implemented additions from remaining plans. The pinned `src/store.mjs#SUPPORTED_SCHEMA_VERSION` is 68. Schema 67 adds question purpose; schema 68 adds parent_generation and held notifications. Numbers 69–71 remain design reservations, not applied migrations. Reconcile merged migrations before implementation.
|
|
50
|
+
|
|
51
|
+
| Module | Does today | Disposition | License |
|
|
52
|
+
|---|---|---|---|
|
|
53
|
+
| `src/answer-journal.mjs#prepare` | Saves exact key, expected revision and text before send. `src/answer-journal.mjs#send` retries that envelope; reconcile reads back. | RETAIN (formerly NEW); R08, R11, R12 (R5). Runtime crash characterization remains a GAP here. | repo |
|
|
54
|
+
| `src/store.mjs#parent_generation` | Schema 68 persists an opaque value. `src/destinations/t3.mjs#readGeneration` owns decoding. | RETAIN (formerly NEW); R21 (R6). Atomic upstream stop/send fence remains a GAP. | repo |
|
|
55
|
+
| `src/store.mjs#QUESTION_PURPOSES` | Schema 67 distinguishes clarification, human decision, authentication and tool permission. `src/destinations/t3.mjs#messageFor` requests human handling for non-clarifications. | RETAIN (formerly branch plan), R13 (R7); `src/server.mjs#requireOperatorForHumanQuestion` requires the operator boundary; live human authorization is not runtime-certified here. | repo |
|
|
56
|
+
| src/store.mjs and CLI: revises link and stale guard | NEW semantic link, not a mutable attempt. | ADD migration 69, submit/decide and submit --revises; R14–R16 (C1) | repo (planned) |
|
|
57
|
+
| src/store.mjs, src/workers.mjs and CLI: relationships | NEW per-side relationship row and assignments.relationship_id; read-only grants composition. | ADD migration 70, relationships/grants commands; R02–R04, R18 (C2) | repo (planned) |
|
|
58
|
+
| src/tool-registry.mjs, src/server.mjs and store: tool_grants.scope | NEW scope on existing grant store. | ADD migration 71 and T3 wiring; R17, R19 (C3) | repo (planned) |
|
|
59
|
+
| `src/execution.mjs#ADAPTER_QUALIFICATIONS` and `src/execution.mjs#admitAdapterCapabilities` | mcp and protocol-v0 adapter declarations; only protocol-v0 declares identified_questions verified, restricted to that catalog. | RETAIN initial C5; further route/version qualification remains planned. R06, R07, R34; no hosted-provider certification. | repo |
|
|
60
|
+
| src/lifecycle.mjs, src/inbox.mjs, src/status-summary.mjs: typed control and held-wake display | Held delivery exists in `src/destinations/t3.mjs#holdItem`; wider typed-control semantics remain planned. | RETAIN held delivery; ADD remaining R20, R21 (C4, D2); no parent resurrection | repo (planned) |
|
|
61
|
+
|
|
62
|
+
## Optional and upstream work
|
|
63
|
+
|
|
64
|
+
| Module | Does today | Disposition | License |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| bin/dalan-acp-worker.mjs | Not built. | OPT ACP-client performer (D3) | repo (planned); future dependencies UNVERIFIED |
|
|
67
|
+
| A2A pull worker | Not built. | OPT D5 only for a named peer | UNVERIFIED until selected |
|
|
68
|
+
| Requester catalog profile | Not built. | OPT catalog change D4 for hosts unable to run Dalan | repo (planned) |
|
|
69
|
+
| T3 stopSeq / message.dispatch ifStopSeq | Upstream capability proposal; not Dalan code. | UP B6; do not emulate a missing stop fence with an unsafe fallback | upstream, UNVERIFIED |
|
|
70
|
+
|
|
71
|
+
Not built: a RequesterPort/WorkerPort layer, BindingIdentity table, route-negotiation service, broker, workflow engine, or universal capability token. These additions are not prerequisites for retaining the current facilities.
|
|
72
|
+
|
|
73
|
+
## Verification gaps
|
|
74
|
+
|
|
75
|
+
GAP: no runtime tests or live host/provider qualification were executed. Source anchors identify facilities, not proven failure closure. GAP: atomic upstream stop/send admission remains unavailable in this inspection. GAP: correction/relationship/scoped-tool semantics and their planned migrations remain design work. GAP: third-party package manifests were unavailable for @agentclientprotocol/sdk and @tnunamak/gozar, so their licenses are UNVERIFIED; root package declarations cannot establish dependency licenses. The latter is imported by `src/server.mjs#main`. No dependency license is inferred from the first-party repo label.
|