@tnunamak/dalan 0.6.2 → 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.
Files changed (74) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/PROTOCOL.md +2 -0
  4. package/README.md +81 -84
  5. package/bin/dalan.mjs +9 -0
  6. package/bin/dot-worker.mjs +29 -4
  7. package/contracts/adapter-qualification.schema.json +170 -0
  8. package/docs/chatgpt-worker-onboarding.md +10 -14
  9. package/docs/claude-worker-onboarding.md +9 -8
  10. package/docs/codex-to-muse.md +21 -35
  11. package/docs/connect-chatgpt.md +10 -16
  12. package/docs/dalan-upgrade.md +4 -2
  13. package/docs/local-agent-mcp.md +24 -4
  14. package/docs/local-agent-requester.md +46 -0
  15. package/docs/manual-setup.md +2 -2
  16. package/docs/operations.md +12 -13
  17. package/docs/pull-workers.md +1 -2
  18. package/docs/service-setup.md +110 -163
  19. package/docs/setup-reference.md +6 -6
  20. package/docs/t3-question-relationship.md +43 -0
  21. package/docs/t3-reverse-control.md +12 -8
  22. package/docs/t3-wake-fence-r4.md +42 -0
  23. package/docs/test-suite-isolation.md +204 -0
  24. package/docs/worker-clients.md +6 -4
  25. package/package.json +5 -3
  26. package/qualification/README.md +13 -0
  27. package/qualification/mcp.json +121 -0
  28. package/qualification/protocol-v0.json +127 -0
  29. package/scripts/dalan-try-selfcheck.mjs +8 -7
  30. package/scripts/worker-bridge-setup.mjs +91 -81
  31. package/src/admin-socket.mjs +2 -1
  32. package/src/answer-journal.mjs +200 -0
  33. package/src/as-store.mjs +5 -3
  34. package/src/as.mjs +35 -26
  35. package/src/auth-check.mjs +59 -0
  36. package/src/cli-help.mjs +16 -16
  37. package/src/client-approval.mjs +57 -0
  38. package/src/client-convenience.mjs +166 -0
  39. package/src/client-conveniences.json +106 -0
  40. package/src/client-conveniences.schema.json +97 -0
  41. package/src/connect-cli.mjs +5 -5
  42. package/src/default-home.mjs +36 -0
  43. package/src/destinations/index.mjs +6 -0
  44. package/src/destinations/none.mjs +3 -0
  45. package/src/destinations/t3.mjs +63 -6
  46. package/src/execution.mjs +20 -2
  47. package/src/follow-current.mjs +27 -0
  48. package/src/gozar-routes.mjs +315 -0
  49. package/src/host-budget.mjs +17 -11
  50. package/src/host-execution-policy.mjs +2 -2
  51. package/src/host-stop-reverify.mjs +6 -4
  52. package/src/integrator.mjs +3 -1
  53. package/src/redirect-policy.mjs +61 -0
  54. package/src/route-setting.mjs +71 -12
  55. package/src/server.mjs +64 -12
  56. package/src/service-auto-update.mjs +8 -1
  57. package/src/service-launchd.mjs +186 -0
  58. package/src/service-migrate-workers.mjs +12 -2
  59. package/src/service-update-runtime.mjs +40 -6
  60. package/src/service-update.mjs +20 -14
  61. package/src/service.mjs +211 -63
  62. package/src/setup.mjs +55 -44
  63. package/src/store.mjs +77 -14
  64. package/src/submission-policy.mjs +8 -4
  65. package/src/t3.mjs +21 -2
  66. package/src/tool-registry.mjs +54 -8
  67. package/src/try-exposure.mjs +7 -657
  68. package/src/try-hosted.mjs +71 -101
  69. package/src/try-selfcheck.mjs +15 -8
  70. package/src/try.mjs +9 -13
  71. package/src/workers.mjs +4 -3
  72. package/src/workspace.mjs +94 -15
  73. package/scripts/lib/expose-tailscale.mjs +0 -408
  74. package/src/try-hosted-clients.mjs +0 -46
@@ -0,0 +1,170 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:dalan-handoff:adapter-qualification:1",
4
+ "title": "Draft adapter qualification record",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "record_kind",
10
+ "adapter_id",
11
+ "observed_on",
12
+ "pins",
13
+ "roles",
14
+ "continuity",
15
+ "activation",
16
+ "capabilities",
17
+ "qualification",
18
+ "limits"
19
+ ],
20
+ "properties": {
21
+ "schema_version": {
22
+ "const": 1
23
+ },
24
+ "record_kind": {
25
+ "const": "draft_internal_qualification_record_not_wire_protocol"
26
+ },
27
+ "adapter_id": {
28
+ "type": "string",
29
+ "minLength": 1
30
+ },
31
+ "observed_on": {
32
+ "type": "string",
33
+ "format": "date"
34
+ },
35
+ "pins": {
36
+ "type": "object",
37
+ "required": [
38
+ "dalan_commit",
39
+ "requester_ref",
40
+ "worker_host_ref",
41
+ "protocol",
42
+ "sdk",
43
+ "catalog_fingerprint"
44
+ ],
45
+ "additionalProperties": {
46
+ "type": [
47
+ "string",
48
+ "null"
49
+ ]
50
+ }
51
+ },
52
+ "roles": {
53
+ "type": "array",
54
+ "uniqueItems": true,
55
+ "items": {
56
+ "enum": [
57
+ "requester",
58
+ "worker",
59
+ "tool_provider",
60
+ "tool_consumer"
61
+ ]
62
+ }
63
+ },
64
+ "continuity": {
65
+ "enum": [
66
+ "retained_native",
67
+ "checkpoint_replay",
68
+ "reconstructed_explicit_context",
69
+ "new_work",
70
+ "inbox_only",
71
+ "unknown"
72
+ ]
73
+ },
74
+ "activation": {
75
+ "enum": [
76
+ "manual",
77
+ "host_schedule",
78
+ "host_event",
79
+ "native_endpoint",
80
+ "unknown"
81
+ ]
82
+ },
83
+ "capabilities": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "object",
87
+ "additionalProperties": false,
88
+ "required": [
89
+ "name",
90
+ "declared",
91
+ "observed",
92
+ "required"
93
+ ],
94
+ "properties": {
95
+ "name": {
96
+ "type": "string"
97
+ },
98
+ "declared": {
99
+ "enum": [
100
+ "yes",
101
+ "no",
102
+ "unknown"
103
+ ]
104
+ },
105
+ "observed": {
106
+ "enum": [
107
+ "not_tested",
108
+ "passed",
109
+ "failed",
110
+ "blocked",
111
+ "inconclusive"
112
+ ]
113
+ },
114
+ "required": {
115
+ "type": "boolean"
116
+ },
117
+ "evidence_refs": {
118
+ "type": "array",
119
+ "items": {
120
+ "type": "string"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "qualification": {
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "required": [
130
+ "state",
131
+ "evidence_level",
132
+ "run_refs"
133
+ ],
134
+ "properties": {
135
+ "state": {
136
+ "enum": [
137
+ "not_run",
138
+ "partial",
139
+ "passed_for_declared_scope",
140
+ "failed",
141
+ "blocked",
142
+ "inconclusive"
143
+ ]
144
+ },
145
+ "evidence_level": {
146
+ "enum": [
147
+ "documentation",
148
+ "source_inspection",
149
+ "deterministic_component",
150
+ "actual_store_integration",
151
+ "live_host",
152
+ "independent_review"
153
+ ]
154
+ },
155
+ "run_refs": {
156
+ "type": "array",
157
+ "items": {
158
+ "type": "string"
159
+ }
160
+ }
161
+ }
162
+ },
163
+ "limits": {
164
+ "type": "array",
165
+ "items": {
166
+ "type": "string"
167
+ }
168
+ }
169
+ }
170
+ }
@@ -1,6 +1,6 @@
1
1
  # ChatGPT cloud worker: manual first connection
2
2
 
3
- This recipe is for a ChatGPT-hosted worker using a remote MCP connector with the bridge's built-in authorization server. It is not a Codex CLI requester setup, an API integration, or a claim that every paid account can run an unattended worker. The first acceptance test is **one repository-free text assignment, execution none, triggered manually**. No schedule or signal hook is part of onboarding.
3
+ This recipe is for a ChatGPT-hosted worker using a remote MCP connector with the bridge's built-in authorization server. Dalan's flow is generic: any MCP client that supports OAuth with Dynamic Client Registration (DCR) and PKCE can connect, and the owner approves it by matching the code. The ChatGPT steps here are optional vendor notes. It is not a Codex CLI requester setup, an API integration, or a claim that every paid account can run an unattended worker. The first acceptance test is **one repository-free text assignment, execution none, triggered manually**. No schedule or signal hook is part of onboarding.
4
4
 
5
5
  The owner completes the setup and first-job checks below on the intended account and computer. The commands below are for a separately authorized operator.
6
6
 
@@ -8,13 +8,13 @@ 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) and make `dalan` available on your PATH with `DALAN_HOME` set to that setup's bridge home. Retain the same generated HOME, worker profile and `<bridge-home>/resource-url` 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.
11
+ - Have the owner complete the [public-service owner setup](service-setup.md#owner-setup) (`dalan service install --worker NAME --route tailscale`). 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
 
15
- ## 2. Resolve the exact callback before registration
15
+ ## 2. Check the redirect before approval
16
16
 
17
- **Do not paste a callback template.** OpenAI directs operators to copy the exact production redirect URI from the MCP server's management page. Current documentation distinguishes callback-ID-specific `https://chatgpt.com/connector/oauth/{callback_id}` from stable `https://chatgpt.com/connector_platform_oauth_redirect`; stable selection depends on issuer-identification support, with an older-server exception. This recipe does not assume which mode the pinned bridge will select. [Redirect rules](https://developers.openai.com/plugins/build/auth#redirect-url)
17
+ **Do not paste a callback template, and do not edit any callback list.** The bridge accepts a structurally valid HTTPS redirect from a registering client and shows you the full redirect when you approve. Your job is to compare it. OpenAI directs operators to the exact production redirect shown on the MCP server's management page. Current documentation distinguishes callback-ID-specific `https://chatgpt.com/connector/oauth/{callback_id}` from stable `https://chatgpt.com/connector_platform_oauth_redirect`; stable selection depends on issuer-identification support, with an older-server exception. This recipe does not assume which mode the pinned bridge will select. [Redirect rules](https://developers.openai.com/plugins/build/auth#redirect-url)
18
18
 
19
19
  The same source documents protected-resource discovery, Dynamic Client Registration (DCR) through `registration_endpoint`, and Client ID Metadata Documents (CIMD) as a different client-identity path. DCR registers a client; CIMD does not. A predefined/static OAuth client instead requires an already registered ID and matching client-authentication method. A static client secret is not a bearer token. [OAuth/client registration](https://developers.openai.com/plugins/build/auth#oauth-flow)
20
20
 
@@ -22,19 +22,15 @@ For this built-in recipe, use DCR only if offered and compatible. This recipe co
22
22
 
23
23
  Owner sequence:
24
24
 
25
- 1. For a normal first connection, follow [Connect ChatGPT](connect-chatgpt.md). Fresh initialization includes the documented ChatGPT callback patterns. If you need to add a callback to an existing installation, obtain the complete redirect from ChatGPT's connection settings or current official instructions before adding it. If you cannot establish the exact value, stop rather than guessing.
26
- 2. Verify HTTPS, exact vendor host and full path, including any connection-specific suffix. The bridge refuses callback queries, fragments and credentials. The `as_registration_refused` log records no callback details; it is not a callback source. [Bridge callback handling](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md#4-pair-fixture-a-and-allow-its-callback)
27
- 3. On the bridge host, allow that value **before DCR**, then open the short pairing window:
25
+ 1. For a normal first connection, follow [Connect ChatGPT](connect-chatgpt.md). Open the short pairing window on the bridge host:
28
26
 
29
27
  ```sh
30
- printf 'Exact verified ChatGPT callback: '
31
- IFS= read -r CALLBACK_URL
32
- dalan connect allow-callback "$CALLBACK_URL"
33
- unset CALLBACK_URL
34
28
  dalan connect start --worker NAME
35
29
  ```
36
30
 
37
- If the callback differs from the source or the bridge rejects it, stop; do not broaden the allowlist or change auth mode. Record the callback that ChatGPT showed so you can check the allowlist against it later.
31
+ 2. When ChatGPT registers, read the redirect in the pending attempt. Check HTTPS, the exact host `chatgpt.com` and the full path, including any connection-specific suffix. A curated ChatGPT name or icon appears only when the redirect's exact origin is `https://chatgpt.com`; a lookalike host, another port or plain HTTP shows only the generic label. The label is a convenience and never a reason to approve. The bridge refuses callback queries that change the redirect, fragments and credentials. The `as_registration_refused` log records no callback details; it is not a callback source. [Bridge callback handling](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md#4-pair-fixture-a-and-allow-its-callback)
32
+
33
+ If the redirect differs from what ChatGPT showed, do not approve; restart the connection. Record the redirect that ChatGPT showed so you can compare it with the pending attempt.
38
34
 
39
35
  ## 3. Add, pair and inspect the connector
40
36
 
@@ -48,7 +44,7 @@ During the owner-initiated browser flow:
48
44
  dalan connect pending
49
45
  ```
50
46
 
51
- Compare the browser pairing code **exactly** with the local pending code. Check the expected worker, client ID, full callback, resource and scopes; a familiar client name or vendor callback does not establish which account initiated the flow. Approve only the matching code, within the 10-minute window:
47
+ Compare the browser pairing code **exactly** with the local pending code. Check the expected worker, client ID, full callback, resource and scopes; a familiar client name, curated label or vendor redirect does not establish which account initiated the flow. Approve only the matching code, within the 10-minute window:
52
48
 
53
49
  ```sh
54
50
  dalan connect approve CODE --worker NAME
@@ -105,7 +101,7 @@ Confirm that the job's status is `finished` and its report outcome is `completed
105
101
 
106
102
  ## 5. Limits and owner acceptance record
107
103
 
108
- Keep a redacted ledger with date, account/workspace feature availability, bridge commit, worker profile, public-surface results, exact callback **source**, chosen registration method, matching-code result, displayed tool names/schema, request ID, manual trigger time, claim/finish result and owner `get` result. Keep resource URLs, private URLs, codes, claim/acquisition IDs, tokens and client secrets out of shared evidence.
104
+ Keep a redacted ledger with date, account/workspace feature availability, bridge commit, worker profile, public-surface results, exact redirect **source**, chosen registration method, matching-code result, displayed tool names/schema, request ID, manual trigger time, claim/finish result and owner `get` result. Keep resource URLs, private URLs, codes, claim/acquisition IDs, tokens and client secrets out of shared evidence.
109
105
 
110
106
  Do not mark the journey accepted until the owner completes every required check on the intended account and computer. This recipe covers manual jobs with Dynamic Client Registration on ChatGPT web. Other registration methods, mobile or older UI variants, long-lived refresh and unattended wake need separate setup instructions.
111
107
 
@@ -1,8 +1,8 @@
1
1
  # Claude cloud worker: manual first connection
2
2
 
3
- This recipe connects a Claude-hosted conversation to the bridge's built-in authorization server through a remote MCP custom connector. It is not Claude Code's local MCP/requester flow or a Messages API integration. Start with **one repository-free text assignment, execution none, triggered manually**. Do not enable a schedule, hosted background feature or signal hook for the first smoke.
3
+ This recipe connects a Claude-hosted conversation to the bridge's built-in authorization server through a remote MCP custom connector. Dalan's flow is generic: any MCP client that supports OAuth with Dynamic Client Registration (DCR) and PKCE can connect, and the owner approves it by matching the code. The Claude steps here are optional vendor notes. It is not Claude Code's local MCP/requester flow or a Messages API integration. Start with **one repository-free text assignment, execution none, triggered manually**. Do not enable a schedule, hosted background feature or signal hook for the first smoke.
4
4
 
5
- For a new hosted-worker installation, begin with [Run Dalan as a service](service-setup.md#owner-setup), using a public HTTPS origin and your selected worker `NAME`. A provider-hosted connector cannot reach the README's loopback trial. Install the checkout using [owner and requester setup](manual-setup.md#owner-and-requester-setup), then follow the service guide rather than starting the loopback server. Keep the service's bridge home and worker identity throughout pairing, submission and result retrieval.
5
+ For a new hosted-worker installation, begin with [Run Dalan as a service](service-setup.md#owner-setup), using a public HTTPS origin and your selected worker `NAME`. A provider-hosted connector cannot reach the README's loopback trial. Install the package with `npm install -g @tnunamak/dalan`, then follow the service guide rather than starting the loopback server. Keep the service's bridge home and worker identity throughout pairing, submission and result retrieval.
6
6
 
7
7
  The owner completes the setup and first-job checks below on the intended account and computer. All commands below are for a separately authorized operator.
8
8
 
@@ -10,11 +10,11 @@ The owner completes the setup and first-job checks below on the intended account
10
10
 
11
11
  - Confirm that this account/workspace can add or use a custom remote MCP connector, perform OAuth, enable it in a conversation, and call the required tools. On managed plans, organization role and connector access matter; the official help page describes owner setup before member connection. A plan label alone is not an access test. [Custom connector setup](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp)
12
12
  - Unattended execution and background-worker availability are separate observations. An interactive manual smoke proves neither. If a required connector control is absent, stop and have the owner verify access; do not upgrade, change roles, or add a subscription.
13
- - Complete [service setup](service-setup.md#owner-setup), put `dalan` on your PATH, and export `DALAN_HOME` to the generated service home. Use a dedicated worker with no T3 capability and no allowed repositories for this first job. `NAME` below means that worker's profile name, not the account display name.
13
+ - Complete [service setup](service-setup.md#owner-setup), and put `dalan` on your PATH. No `DALAN_HOME` is needed for a service made by `dalan service install`. Use a dedicated worker with no T3 capability and no allowed repositories for this first job. `NAME` below means that worker's profile name, not the account display name.
14
14
  - Supply the public **HTTPS resource URL** from the private `<bridge-home>/resource-url` file, including its secret path and `/mcp`. Do not use the origin, an OAuth endpoint or localhost. Claude's remote connector traffic originates from Anthropic infrastructure, even when the UI is on a local device. [Network requirements](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp#network-requirements)
15
15
  - Prefer public HTTPS port 443 as a simple trial default, not an asserted Claude port restriction. Have the owner verify path-suffixed resource/authorization discovery (200), tokenless MCP (401), and unsuffixed discovery/root/`/admin` (404) from outside the private network. The [public-surface checker](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md#3-verify-from-outside-the-tailnet) consumes a private resource-file value; do not reuse an unrelated example job.
16
16
 
17
- ## 2. Allow the sourced callback, then choose registration
17
+ ## 2. Check the redirect, then choose registration
18
18
 
19
19
  Anthropic documents this exact callback for hosted Claude surfaces:
20
20
 
@@ -22,20 +22,21 @@ Anthropic documents this exact callback for hosted Claude surfaces:
22
22
  https://claude.ai/api/mcp/auth_callback
23
23
  ```
24
24
 
25
- Claude Code uses a different loopback flow; do not weaken the bridge's HTTPS callback policy to accommodate it in this cloud-worker recipe. [Official callback URLs](https://claude.com/docs/connectors/building/authentication#callback-urls)
25
+ Claude Code uses a different loopback flow with a changing port; this cloud-worker recipe does not cover it. [Official callback URLs](https://claude.com/docs/connectors/building/authentication#callback-urls)
26
26
 
27
- On the bridge host, **before registration**:
27
+ No callback list needs editing. On the bridge host, open the pairing window **before** you start the connection in Claude:
28
28
 
29
29
  ```sh
30
- dalan connect allow-callback 'https://claude.ai/api/mcp/auth_callback'
31
30
  dalan connect start --worker NAME
32
31
  ```
33
32
 
33
+ When Claude registers, compare the redirect in the pending attempt with the value above. A curated Claude name and icon appear only when the redirect's exact origin is `https://claude.ai`; a lookalike host, another port or plain HTTP shows only the generic label. The label is a convenience and never replaces the code match.
34
+
34
35
  The current custom-connector UI distinguishes automatic registration, a published Client ID Metadata Document (CIMD), and a supplied OAuth client. Choose **Register automatically** for this Dynamic Client Registration (DCR) recipe, not the published-identity default simply because it is recommended in the UI. [Connector setup](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp)
35
36
 
36
37
  DCR discovers `registration_endpoint` and creates the client. A static OAuth client requires the owner to register the exact redirect first and supply the matching client ID/authentication credentials; it is not a static request-header token. CIMD is another identity method, not DCR. [Claude authentication](https://claude.com/docs/connectors/building/authentication#register-claude-as-an-oauth-client)
37
38
 
38
- This recipe covers automatic client registration; other registration methods need separate instructions from the owner. If automatic registration is absent or fails, stop and ask for an owner-validated variant; do not invent client credentials, switch to no-auth, add bearer headers, change issuers or broaden callback patterns. Verify a differing callback against current official hosted-surface documentation before making any allowlist change.
39
+ This recipe covers automatic client registration; other registration methods need separate instructions from the owner. If automatic registration is absent or fails, stop and ask for an owner-validated variant; do not invent client credentials, switch to no-auth, add bearer headers or change issuers. If the redirect differs from the documented hosted-surface value, do not approve; verify it against current official documentation first.
39
40
 
40
41
  ## 3. Add, pair and inspect the connector
41
42
 
@@ -8,51 +8,37 @@ Codex CLI submits a job through a local `dalan mcp` process. Muse (muse.ai), a h
8
8
  - Node.js 24 or newer and npm.
9
9
  - Codex CLI installed and signed in on the bridge computer.
10
10
  - A Muse account with remote MCP connections and tool calls available.
11
- - A public HTTPS address that Muse can reach. Tailscale is optional: either a Tailscale route or the Gozar relay can provide public HTTPS.
12
- - A free local port, here `8799`, and a new, short bridge-home path on local disk.
11
+ - A public HTTPS address that Muse can reach. A Gozar route provides it.
13
12
 
14
- Both routes make the bridge reachable from the public internet. With `--route tailscale`, Tailscale cannot read the traffic; its HTTPS certificate publishes the machine and tailnet DNS names in a public certificate ledger. The Gozar relay terminates TLS and can read the connector URL and traffic. Keep the full MCP URL private: its path contains a secret. Your Codex and Muse accounts retain their own usage limits and charges.
13
+ A route makes the bridge reachable from the public internet. Some routes are run by a third party that terminates TLS and can read the connector URL and traffic; others do not. `dalan setup` shows what each route offers. Keep the full MCP URL private: its path contains a secret. Your Codex and Muse accounts retain their own usage limits and charges.
15
14
 
16
15
  This first job uses no repository and runs no checks. Use a dedicated worker named `muse`. Do not reuse another worker's connection.
17
16
 
18
17
  ## 1. Start and expose the bridge
19
18
 
20
- Choose your public HTTPS route first. The README describes [`--route tailscale`](../README.md#use-a-tailscale-route) and the [Gozar relay with `--route gozar`](../README.md#choose-another-relay) for public trials, including relay consent and temporary-link limits. Those are trial options, not flags for the service setup command below. For an existing public HTTPS bridge, use its actual bridge home as `DALAN_HOME` and its private `resource-url`, with a dedicated worker named `muse`, then continue at step 2. Do not reuse another worker's connection.
21
-
22
- ### Tailscale service option
23
-
24
- The following existing service recipe is one option, not a requirement for Muse. Install Tailscale, sign in, and enable MagicDNS, HTTPS certificates and Funnel for the machine first. On macOS, use the open-source `tailscaled`; the App Store and Standalone apps do not support Funnel.
25
-
26
- On the bridge computer, install Dalan:
19
+ Install Dalan, then install the service with a dedicated worker named `muse`. `tailscale` publishes through Tailscale Funnel, which your tailnet administrator must allow (see [service setup](service-setup.md#install-and-connect-your-agent)); `dalan setup` lists the other routes.
27
20
 
28
21
  ```sh
29
22
  npm install -g @tnunamak/dalan
23
+ dalan service install --worker muse --route tailscale
24
+ dalan status
25
+ dalan doctor --auth
30
26
  ```
31
27
 
32
- Create and start the service. The example home must not already exist. If the port is occupied, choose another free port.
33
-
34
- ```sh
35
- node "$(npm root -g)/@tnunamak/dalan/scripts/worker-bridge-setup.mjs" \
36
- --worker muse --port 8799 --home "$HOME/.local/share/dalan-muse" \
37
- --expose tailscale --no-repo-tools --start
38
- export DALAN_HOME="$HOME/.local/share/dalan-muse"
39
- dalan status --json
40
- ```
41
-
42
- Use the same `DALAN_HOME` in every owner shell below. The setup writes a service and a private `resource-url` file in that home. It disables repository workspace tools for this example. A new worker has no repository grants.
43
-
44
- Open `$DALAN_HOME/resource-url` privately and use its entire URL in step 2. Do not substitute the public hostname alone or a loopback URL. If you already have an HTTPS reverse proxy, use the [service guide](service-setup.md) instead of setting up a second exposure.
28
+ Install keeps the bridge's state in `~/.local/share/dalan-service`, which `dalan` remembers; no `DALAN_HOME` is needed. A new worker has no repository grants, and host checks stay off. Open the private connector URL file that install printed and use its entire URL in step 2. Do not substitute the public hostname alone or a loopback URL. For an existing HTTPS reverse proxy, see the [service guide](service-setup.md#an-existing-reverse-proxy).
45
29
 
46
- **Check:** setup prints `Resource URL file (private, mode 0600):` followed by the file path, and `PASS public HTTPS: GET /admin returned 404 from the bridge`. The status command returns a JSON status record. The public check proves reachability, not that Muse has finished a job.
30
+ **Check:** install prints the path of the private connector URL file, and `dalan doctor --auth` passes. `dalan status` returns the queue state. The public check proves reachability and sign-in, not that Muse has finished a job.
47
31
 
48
32
  ## 2. Connect Muse as the worker
49
33
 
50
- The bridge ships this exact callback in its default allow-list:
34
+ Dalan's flow is generic: any MCP client that supports OAuth with Dynamic Client Registration (DCR) and PKCE can connect, and you approve it by matching the code. Muse is one such client. No callback list needs editing. Muse has used this redirect:
51
35
 
52
36
  ```text
53
37
  https://agent.meta.ai/api/hatch/oauth/callback
54
38
  ```
55
39
 
40
+ A curated Muse name and icon appear only when the redirect's exact origin is `https://agent.meta.ai`. A lookalike host, another port or plain HTTP shows only the generic label. The label is a convenience and never a reason to approve.
41
+
56
42
  Start a pairing window:
57
43
 
58
44
  ```sh
@@ -67,7 +53,7 @@ On the bridge computer:
67
53
  dalan connect pending
68
54
  ```
69
55
 
70
- Compare the code with the one in your browser. Check that the worker is `muse`, the redirect is the callback above and the resource identifies your bridge. Check the scopes: ordinary jobs need `dalan.read` and `dalan.work`. The older `dot-bridge.read` and `dot-bridge.work` names are aliases. The bridge also advertises `t3.read` and `t3.write`; those names do not replace the Dalan job scopes. Do not approve an unexpected connection or rely on its client name, which the app supplies.
56
+ Compare the code with the one in your browser. Check that the worker is `muse`, the redirect is the one Muse showed for this connection (the value above, unless Muse's documentation says otherwise) and the resource identifies your bridge. Check the scopes: ordinary jobs need `dalan.read` and `dalan.work`. The older `dot-bridge.read` and `dot-bridge.work` names are aliases. The bridge also advertises `t3.read` and `t3.write`; those names do not replace the Dalan job scopes. Do not approve an unexpected connection or rely on its client name, which the app supplies.
71
57
 
72
58
  Replace `CODE` with your matching pending code:
73
59
 
@@ -94,9 +80,10 @@ Add this entry to `~/.codex/config.toml`. Replace both paths with absolute paths
94
80
  [mcp_servers.dalan]
95
81
  command = "/absolute/path/to/dalan"
96
82
  args = ["mcp"]
97
- env = { DALAN_HOME = "/absolute/path/to/.local/share/dalan-muse" }
98
83
  ```
99
84
 
85
+ `dalan mcp` finds the remembered service home. Add `env = { DALAN_HOME = "/absolute/path/to/home" }` only to select a different home.
86
+
100
87
  Start a new Codex CLI session on this computer so it loads the entry. Ask it to call `dalan_status`. To call these tools from `codex exec`, which has no screen to approve them, set per-tool approval for the `dalan` server as the `codex exec` paragraph of [Worker clients](worker-clients.md#native-cli-worker-codex-cli) describes.
101
88
 
102
89
  The local server has the access of the Unix user running it. It uses the bridge's admin socket and needs no separate OAuth connection. Give it only to an agent you trust with your local Dalan CLI access.
@@ -134,7 +121,7 @@ A wait can stop for a question, blocker or cancellation as well as a result. Rea
134
121
 
135
122
  ## 5. Accept or reject the result
136
123
 
137
- The local MCP server has no decision tool. In your owner shell, with the same `DALAN_HOME`, replace `REQUEST_ID` and choose one command.
124
+ The local MCP server has no decision tool. In your owner shell, replace `REQUEST_ID` and choose one command.
138
125
 
139
126
  Accept a satisfactory answer:
140
127
 
@@ -154,10 +141,10 @@ Do not use `rejected`: it is not a supported decision word. This records your re
154
141
 
155
142
  ## Troubleshooting
156
143
 
157
- - **Public DNS or HTTPS check fails.** Setup prints `FAIL public DNS:` or `FAIL public HTTPS:`. Read its suggested next step. The service and home remain in place; use the printed retry-check command after fixing the issue, rather than rerunning setup against the same home.
144
+ - **The public check fails.** Run `dalan doctor --auth` and read its failing step. Running `dalan service install` again with the same options is safe; it changes nothing that already works.
158
145
  - **The sign-in page says `Not accepting connections` or `Connection attempt invalid or expired`.** Open a new pairing window with `dalan connect start --worker muse`, restart sign-in in Muse, and compare the new code with `dalan connect pending`.
159
- - **The callback is refused.** The bridge can report `Callback not allowed` or refuse registration because the redirect does not match an allowed callback. Obtain the exact current callback from Muse's connection flow or provider documentation. Verify that it belongs to the client before allowing it with `dalan connect allow-callback 'EXACT_HTTPS_CALLBACK'`, then restart sign-in. Do not broaden the allow-list to an entire domain.
160
- - **Codex cannot reach the bridge.** A CLI error beginning `cannot reach the bridge:` means the selected home's bridge is not running. Check the absolute `DALAN_HOME` in the Codex entry, then run `dalan status --json` in an owner shell with that same home and inspect the service. Do not register the public URL as Codex's requester endpoint.
146
+ - **Registration is refused.** The bridge refuses a redirect that is not a valid HTTPS URL, or that carries credentials or a fragment. Read the reason, compare the redirect with what Muse's connection flow shows, then restart sign-in. Do not approve a connection whose redirect you cannot match to the client you started.
147
+ - **Codex cannot reach the bridge.** A CLI error beginning `cannot reach the bridge:` means the selected home's bridge is not running. Run `dalan status --json` and `dalan service status` in an owner shell. If the Codex entry sets `DALAN_HOME`, check that it is the absolute path of the running bridge's home. Do not register the public URL as Codex's requester endpoint.
161
148
  - **Approval says the worker already has an active connection.** Inspect `dalan connect list`. Continue with the existing intended Muse connection, or deliberately revoke it before pairing again. Do not approve a different client just because it calls itself Muse.
162
149
 
163
150
  ## Removal
@@ -171,11 +158,10 @@ dalan connect stop
171
158
 
172
159
  Remove the remote MCP server from Muse. Remove only the `mcp_servers.dalan` entry you added to Codex's configuration and start a new Codex session.
173
160
 
174
- If you used the Tailscale service option, remove this dedicated service and its recorded Funnel exposure:
161
+ Remove this dedicated service and its public route:
175
162
 
176
163
  ```sh
177
- node "$(npm root -g)/@tnunamak/dalan/scripts/worker-bridge-setup.mjs" \
178
- --remove --worker muse --home "$HOME/.local/share/dalan-muse"
164
+ dalan service uninstall
179
165
  ```
180
166
 
181
- This command retains the bridge home, including its keys and job history. Follow [service removal](service-setup.md#remove-a-generated-service) if you also want to delete that data.
167
+ This command moves the bridge home, including its keys and job history, aside and does not delete it; delete the moved directory when you want the data gone. See [service removal](service-setup.md#remove-the-service).
@@ -1,18 +1,21 @@
1
1
  # Connect ChatGPT as a Dalan worker
2
2
 
3
- This guide takes you from a built-in OAuth connection to one completed job. Use ChatGPT on the web with custom MCP connections enabled for your account or workspace; UI labels can vary. The owner runs Dalan and approves the connection; the ChatGPT user connects the worker and starts its run. One person can perform both roles.
3
+ This guide takes you from a built-in OAuth connection to one completed job. Dalan accepts any MCP client that supports OAuth with Dynamic Client Registration (DCR) and PKCE; ChatGPT is one example, and the steps below are optional conveniences for it. The owner runs Dalan and approves the connection by matching a code; the ChatGPT user connects the worker and starts its run. One person can perform both roles. Use ChatGPT on the web with custom MCP connections enabled for your account or workspace; UI labels can vary.
4
+
5
+ A client you have not listed here follows the same flow: give it the complete MCP URL, let it register itself, then compare the code and redirect in the pending attempt before you approve. Dalan shows a curated name and icon only when the redirect's exact HTTPS origin is a known one, such as `https://chatgpt.com`. That label is a convenience, not proof of who is connecting, and it never decides whether you may approve.
4
6
 
5
7
  **Just trying it?** Follow the [README hosted trial](../README.md#quickstart). It prints the connector URL and steps for a short hosted demo, then returns the agent's report to your terminal. The rest of this guide sets up a permanent bridge.
6
8
 
7
9
  ## Owner setup
8
10
 
9
- 1. Follow the [service setup](service-setup.md) with a publicly reachable HTTPS origin. Set `DALAN_HOME` to that service's private home and make `dalan` available on your PATH with the [manual setup](manual-setup.md#owner-and-requester-setup) steps. Use the service's worker name wherever this guide says `NAME`.
11
+ 1. Follow the [service setup](service-setup.md): `dalan service install --worker NAME --route tailscale` creates the public HTTPS address. Use the service's worker name wherever this guide says `NAME`.
10
12
 
11
13
  ```sh
12
- dalan status --json
14
+ dalan status
15
+ dalan doctor --auth
13
16
  ```
14
17
 
15
- Status shows the running bridge. Read the complete MCP URL from the private `$DALAN_HOME/resource-url` file. It has the form `https://HOST/<secret>/mcp`; enter the actual URL only in connector setup. A localhost URL cannot reach the bridge from ChatGPT's servers.
18
+ Status shows the running bridge. Read the complete MCP URL from the private connector URL file that install printed. It has the form `https://HOST/<secret>/mcp`; enter the actual URL only in connector setup. A localhost URL cannot reach the bridge from ChatGPT's servers.
16
19
 
17
20
  2. Open a pairing window for that worker.
18
21
 
@@ -20,16 +23,7 @@ This guide takes you from a built-in OAuth connection to one completed job. Use
20
23
  dalan connect start --worker NAME
21
24
  ```
22
25
 
23
- The response shows an open window for `NAME`; the default is ten minutes. Fresh init already allows `https://chatgpt.com/connector_platform_oauth_redirect` and the callback-ID form `https://chatgpt.com/connector/oauth/*`. An existing installation retains its saved allowlist. If its attempt uses the exact callback observed below and that callback is absent, add it before retrying.
24
-
25
- ```sh
26
- printf 'Exact ChatGPT callback shown for this connection: '
27
- IFS= read -r CALLBACK_URL
28
- dalan connect allow-callback "$CALLBACK_URL"
29
- unset CALLBACK_URL
30
- ```
31
-
32
- Compare the complete value with ChatGPT's displayed redirect before running the command. Add only that verified callback, then restart the connection flow.
26
+ The response shows an open window for `NAME`; the default is ten minutes. No callback list is needed: ChatGPT registers itself, and you compare its redirect when you approve.
33
27
 
34
28
  ## ChatGPT user setup
35
29
 
@@ -43,7 +37,7 @@ This guide takes you from a built-in OAuth connection to one completed job. Use
43
37
  dalan connect pending
44
38
  ```
45
39
 
46
- Match the code on the browser page, worker `NAME`, resource, client ID, callback and requested scopes. The client name is untrusted text. Compare the callback with the exact redirect shown by ChatGPT for this connection; it may be the stable redirect or a callback-ID-specific redirect described in [Resolve the exact callback](chatgpt-worker-onboarding.md#2-resolve-the-exact-callback-before-registration). If attempts are ambiguous or a value differs unexpectedly, resolve that before approval.
40
+ Match the code on the browser page, worker `NAME`, resource, client ID, redirect and requested scopes. The client name is untrusted text; a curated ChatGPT label appears only for an exact `https://chatgpt.com` redirect and does not replace the code match. ChatGPT may use the stable redirect or a callback-ID-specific redirect described in [Check the redirect](chatgpt-worker-onboarding.md#2-check-the-redirect-before-approval). If attempts are ambiguous or a value differs unexpectedly, resolve that before approval.
47
41
 
48
42
  ```sh
49
43
  dalan connect approve CODE --worker NAME
@@ -78,6 +72,6 @@ If ChatGPT says “Couldn't discover OAuth settings” or “Some app settings w
78
72
 
79
73
  HTTP 421 means the incoming Host does not match the configured public origin, including any non-default port. Preserve Host through the proxy; forwarding a different `X-Forwarded-Host` does not fix it. See [network setup](service-setup.md).
80
74
 
81
- If the pairing window expired, open it again with `dalan connect start --worker NAME`, restart connection in ChatGPT and compare the new code with pending attempts. If registration reports an unallowed callback, compare its exact scheme, host and path with the expected ChatGPT redirect before adding it. Public discovery probes do not prove browser approval, token exchange or authenticated MCP calls work.
75
+ If the pairing window expired, open it again with `dalan connect start --worker NAME`, restart connection in ChatGPT and compare the new code with pending attempts. If registration is refused, read the reason, then compare the redirect's exact scheme, host and path with what ChatGPT shows for this connection. Public discovery probes do not prove browser approval, token exchange or authenticated MCP calls work.
82
76
 
83
77
  This guide covers ChatGPT on the web; set up a mobile browser separately. Repeat the first job after you reconnect or change endpoint settings, and configure [wake hooks or schedules](pull-workers.md) only after manual jobs work.
@@ -1,5 +1,7 @@
1
1
  # Upgrade to Dalan
2
2
 
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
+
3
5
  `dalan` is the main command. The package also installs `dalan-worker`, `dalan-acp-agent`, `dalan-alert`, `dalan-deadman`, `dalan-heartbeat` and `dalan-pr-reviewer`. 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.
4
6
 
5
7
  ## Pre-upgrade checklist
@@ -10,7 +12,7 @@ Upgrade in this order: drain built-in-auth claims while the old service runs; st
10
12
 
11
13
  **Run a command in the service's environment.** A generated service sets `HOME` (the bridge home), `NODE_ENV=production`, `DALAN_AUTH_MODE=builtin`, `DALAN_BIND_HOST=127.0.0.1`, `DALAN_GOZAR_SERVICE=1`, `DALAN_CATALOG_PROFILE=stable`, `DALAN_ENABLE_WORKSPACE` (`1` when repository tools are on, otherwise `0`), `DALAN_ENABLE_T3_TOOLS` (`1` or `0`), `DALAN_PORT` and `PATH`. Read them, then run each command with those values in front of that one command. Do not `export` them or change `HOME` in your shell: `launchctl` and `systemctl --user` need your own `HOME`.
12
14
 
13
- Your shell can carry more than the service has. The README tells you to `export DALAN_HOME=...` and `DALAN_LOOPBACK=1` for a trial, and `dalan` makes `DALAN_HOME` win over the `HOME` you pass, so an inherited `DALAN_HOME` points every command at the trial, not at the service. `env -u NAME` removes a variable from one command. List the `DALAN_` and `DOT_BRIDGE_` names your shell exports, and remove each one that the service does not set:
15
+ Your shell can carry more than the service has. A trial or a hand-started bridge has you `export DALAN_HOME=...` and `DALAN_LOOPBACK=1`, and `dalan` makes `DALAN_HOME` win over the `HOME` you pass, so an inherited `DALAN_HOME` points every command at the trial, not at the service. `env -u NAME` removes a variable from one command. List the `DALAN_` and `DOT_BRIDGE_` names your shell exports, and remove each one that the service does not set:
14
16
 
15
17
  ```sh
16
18
  env | grep -E '^(DALAN|DOT_BRIDGE)_' | cut -d= -f1
@@ -122,7 +124,7 @@ Before replacing or relinking the old checkout, use `node "$HOME/dalan-drain/bin
122
124
  - macOS: step 1 unloaded the agent, so load it first: `launchctl bootstrap user/$(id -u) ~/Library/LaunchAgents/LABEL.plist`, then `launchctl kickstart -k user/$(id -u)/LABEL`, then `launchctl print user/$(id -u)/LABEL | grep -E 'state|runs'` must show `state = running`. `kickstart` alone fails with exit 113 after `bootout`, because the service is no longer loaded. Keep the `kickstart` after the `bootstrap`: a plist generated by an older release can load with `state = not running` and never start until it is kicked.
123
125
  5. Check the log shows `MCP listening`, run the schema check from [Confirm the schema](#pre-upgrade-checklist) (it must print `66`), then finish a [first-job smoke check](operations.md#smoke-check-an-installed-service).
124
126
 
125
- 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; `--purge-home` refuses while another unit file in the user's unit directory names the home or a process holds its `bridge.db` open, and it names what it found. Do not run `worker-bridge-setup.mjs` again for the same worker to "refresh" it: it refuses to overwrite an existing unit.
127
+ 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.
126
128
 
127
129
  ## Existing homes and explicit path migration
128
130
 
@@ -15,16 +15,34 @@ Each tool runs the matching `dalan` command with `--json`, so receipts, assignme
15
15
 
16
16
  ## Access
17
17
 
18
- The server has the access of the user who starts it: it reaches the bridge through the local admin socket, as the CLI does. It opens no network port and has no separate credential. Do not run it for someone you would not give `dalan` to. Set `DALAN_HOME` explicitly in this MCP server's environment to the exact home of the running bridge. Use the Home line that the running trial printed. A local `dalan try` prints `$HOME/.local/share/dalan-trial`. A public trial prints `$HOME/.local/share/dalan-hosted-<client>` on a usable Tailscale route, or `$HOME/.local/share/dalan-hosted-<random hex>` on a relay. The trial home is not the CLI's normal default, and `dalan mcp` does not stop to ask which home you meant.
18
+ The server has the access of the user who starts it: it reaches the bridge through the local admin socket, as the CLI does. It opens no network port and has no separate credential. Do not run it for someone you would not give `dalan` to. For a service made by `dalan service install`, `dalan mcp` finds the remembered service home, so you set nothing. For a `dalan try` bridge or a bridge you started by hand, set `DALAN_HOME` in this MCP server's environment to the exact home of the running bridge, using the Home line that the running trial printed. A local `dalan try` prints `$HOME/.local/share/dalan-trial`; a public trial prints its own home. A trial home is not the CLI's normal default, and `dalan mcp` does not stop to ask which home you meant.
19
19
 
20
20
  ## Claude Code
21
21
 
22
- This example uses the home of a local `dalan try`. For a public trial, replace it with the Home line your running bridge printed, and replace `/path/to/dalan` as described below.
22
+ For a service made by `dalan service install`:
23
23
 
24
24
  ```sh
25
- claude mcp add dalan --env DALAN_HOME="$HOME/.local/share/dalan-trial" -- /path/to/dalan mcp
25
+ claude mcp add --scope user dalan -- "$(command -v dalan)" mcp
26
26
  ```
27
27
 
28
+ For a `dalan try` bridge, add its home as an override. This example uses the home of a local `dalan try`; for a public trial, use the Home line your running bridge printed:
29
+
30
+ ```sh
31
+ claude mcp add --scope user dalan --env DALAN_HOME="$HOME/.local/share/dalan-trial" -- "$(command -v dalan)" mcp
32
+ ```
33
+
34
+ Keep `--scope user`. Without it, Claude Code registers the server for the current project only, and a session in another directory does not see it. `dalan mcp` needs Node 24 or newer (`node --version`).
35
+
36
+ ## After a pairing that stopped part way
37
+
38
+ If a client stopped during pairing (a crash, a closed window), the worker name already has an active connection, and approving the retry fails with "already has an active connection". Approve the new code with `--replace`:
39
+
40
+ ```sh
41
+ dalan connect approve CODE --worker W --replace
42
+ ```
43
+
44
+ `--replace` ends the old connection for worker `W`. The new connection receives every queued and future job for `W`, including briefs you approved before the switch. Use it only for a code you started yourself.
45
+
28
46
  ## Codex
29
47
 
30
48
  Add this to `~/.codex/config.toml`:
@@ -36,6 +54,8 @@ args = ["mcp"]
36
54
  env = { DALAN_HOME = "/absolute/path/to/the-running-bridge-home" }
37
55
  ```
38
56
 
57
+ Omit the `env` line for a service made by `dalan service install`.
58
+
39
59
  Replace `/path/to/dalan` with the output of `command -v dalan`, or with `node /path/to/dalan/bin/dalan.mjs` split into `command = "node"` and `args = ["/path/to/dalan/bin/dalan.mjs", "mcp"]`.
40
60
 
41
- Use an absolute home path in the TOML; do not leave `$HOME` or `~` in it. Start a new client session and ask it to call `dalan_status`. Check that the returned status belongs to your running bridge before submitting a job. If the call cannot connect, verify the configured home and run `dalan status --json` in a shell using that same `DALAN_HOME`. For a complete submit-and-result example, follow [Send one small job and read the result](codex-to-muse.md#4-send-one-small-job-and-read-the-result), using your connected worker's name.
61
+ Use an absolute home path in the TOML; do not leave `$HOME` or `~` in it. Start a new client session and ask it to call `dalan_status`. Check that the returned status belongs to your running bridge before submitting a job. If the call cannot connect, verify the configured home and run `dalan status --json` in a shell that selects the same home. For a complete submit-and-result example, follow [Send one small job and read the result](codex-to-muse.md#4-send-one-small-job-and-read-the-result), using your connected worker's name.