@tnunamak/dalan 0.6.2 → 0.7.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 (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +25 -68
  3. package/bin/dalan.mjs +9 -0
  4. package/bin/dot-worker.mjs +16 -2
  5. package/docs/chatgpt-worker-onboarding.md +10 -14
  6. package/docs/claude-worker-onboarding.md +9 -8
  7. package/docs/codex-to-muse.md +21 -35
  8. package/docs/connect-chatgpt.md +10 -16
  9. package/docs/dalan-upgrade.md +4 -2
  10. package/docs/local-agent-mcp.md +24 -4
  11. package/docs/manual-setup.md +2 -2
  12. package/docs/operations.md +10 -11
  13. package/docs/pull-workers.md +1 -2
  14. package/docs/service-setup.md +94 -170
  15. package/docs/setup-reference.md +5 -5
  16. package/docs/worker-clients.md +4 -4
  17. package/package.json +2 -3
  18. package/scripts/dalan-try-selfcheck.mjs +8 -7
  19. package/scripts/worker-bridge-setup.mjs +91 -81
  20. package/src/as-store.mjs +5 -3
  21. package/src/as.mjs +35 -26
  22. package/src/auth-check.mjs +53 -0
  23. package/src/cli-help.mjs +13 -14
  24. package/src/client-approval.mjs +57 -0
  25. package/src/client-convenience.mjs +166 -0
  26. package/src/client-conveniences.json +106 -0
  27. package/src/client-conveniences.schema.json +97 -0
  28. package/src/connect-cli.mjs +5 -5
  29. package/src/default-home.mjs +36 -0
  30. package/src/follow-current.mjs +25 -0
  31. package/src/gozar-routes.mjs +314 -0
  32. package/src/redirect-policy.mjs +61 -0
  33. package/src/route-setting.mjs +71 -12
  34. package/src/server.mjs +2 -0
  35. package/src/service-auto-update.mjs +8 -1
  36. package/src/service-launchd.mjs +166 -0
  37. package/src/service-update-runtime.mjs +40 -6
  38. package/src/service-update.mjs +20 -14
  39. package/src/service.mjs +175 -63
  40. package/src/setup.mjs +55 -44
  41. package/src/try-exposure.mjs +7 -657
  42. package/src/try-hosted.mjs +71 -101
  43. package/src/try-selfcheck.mjs +15 -8
  44. package/src/try.mjs +9 -13
  45. package/scripts/lib/expose-tailscale.mjs +0 -408
  46. package/src/try-hosted-clients.mjs +0 -46
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  This file lists user-visible changes, newest first. Check the section for your target release before you upgrade.
4
4
 
5
+ ## 0.7.0
6
+
7
+ Install, run and update Dalan with three commands on Linux and macOS:
8
+
9
+ ```
10
+ npm install -g @tnunamak/dalan
11
+ dalan service install --worker NAME --route tailscale
12
+ dalan connect start --worker NAME
13
+ ```
14
+
15
+ - **One command installs a service on macOS and Linux.** `dalan service install --worker NAME --route ROUTE` creates a systemd user service on Linux or a launchd LaunchAgent on macOS, publishes it through [Gozar](https://www.npmjs.com/package/@tnunamak/gozar), and prints the public address, where the private connector URL file is, the next command and a health check. Run it again and nothing changes. It asks for your approval of the route first; `--yes` approves after you have read the disclosure. An address you already serve stays possible with `--public-url`, `--port` and `--target`.
16
+ - **One default home.** Commands find the service home without `DALAN_HOME`. Install records it in a small pointer file (`~/.config/dalan/home`); `DALAN_HOME` still overrides it. `dalan service uninstall` removes the service, its update timer or agent and its route, and moves the home aside to `<home>.removed-<date>` instead of deleting your keys and job history.
17
+ - **Automatic updates on macOS too.** A launchd update agent checks once a day, like the systemd timer on Linux. The `dalan` command on your PATH follows the version the updater switched to, so the command and the service do not drift. `DALAN_NO_FOLLOW=1` turns that off.
18
+ - **Updates work on npm 12.** `dalan service update` downloads the release tarball itself, checks it against the registry's sha512 integrity and installs from that local file. npm 12 refuses a remote tarball URL as a dependency (`EALLOWREMOTE`), which would have stopped every automatic update.
19
+ - **Updates adopt older services.** `dalan service update` now adopts a service installed by 0.6.0 or 0.6.1, including a unit that names its package directory with a trailing slash and a server that has no update gate.
20
+ - **Any OAuth MCP client can connect.** Dalan accepts a client it has not seen before when its redirect address is a plain HTTPS address or a native loopback address, and the owner approval code stays mandatory. The consent page and `dalan connect pending` show the client name as untrusted text, the redirect host and the full redirect address. The older callback allow-list still loads and only adds entries.
21
+ - **Routes only through Gozar 0.2.** Dalan no longer starts tunnels or runs Tailscale commands itself. It asks Gozar for the route, shows the disclosure Gozar returns, and never falls back to another route. `--route` takes a name you configured in Gozar or the label of an offered route, such as `tailscale`. Tailscale Funnel uses an unused port on this device, so an existing listener is never replaced.
22
+ - **`dalan doctor --auth`** runs the OAuth sign-in flow (discovery, registration, PKCE, token, MCP initialize and tool list) against the public address and prints a PASS or FAIL line per step without printing a secret.
23
+ - `dalan submit --wait` prints the request ID and the worker prompt before it waits. The guides now show `claude mcp add --scope user`, how to retry with `--replace`, and that Node 24 or newer is required.
24
+ - Documentation uses only the commands above. `worker-bridge-setup.mjs` remains for older setups and is no longer in the guides.
25
+
26
+ Upgrade note: `@tnunamak/gozar` 0.2.1 is now a dependency (`^0.2.1`). A service that a release before 0.7.0 generated keeps working; move it with a fresh `dalan service install`.
27
+
5
28
  ## 0.6.2
6
29
 
7
30
  - Add `dalan service update`, `--check`, automatic-update on/off and update status for Linux systemd services. New installs enable daily checks with jitter. Releases install side by side with npm integrity checks, local self-checks and a complete tool-catalog comparison for each configured worker. Changed descriptors stage until an explicit `--yes`; refresh hosted connectors after that switch. Failed switches attempt to restore the previous package and saved persistent state, and report rollback failures. See [service updates](docs/service-setup.md#service-updates) for limits and enrollment of older services.
package/README.md CHANGED
@@ -1,37 +1,23 @@
1
1
  # Dalan
2
2
 
3
- Give a coding agent in ChatGPT, Claude on the web, or another MCP client a job from your computer, then review its report.
3
+ Give your AI agent a coding job from your Mac or Linux computer, even when the agent can only connect through MCP. Dalan queues the job and brings its report back for you to review. It does not run a model or start your agent for you.
4
4
 
5
- ```sh
6
- npx -y @tnunamak/dalan try
7
- ```
5
+ Before you begin, install Node.js 24 or newer and Tailscale with Funnel enabled. Your agent's account must allow custom MCP connectors.
8
6
 
9
- **Success:** Dalan prints a connector URL and a prompt. Add the connector to your hosted client, compare the sign-in code with the one in your terminal, approve the match, then paste the prompt into a chat with the connector enabled. The agent's report returns to your terminal.
7
+ **Tailscale prerequisite.** `--route tailscale` publishes through Tailscale Funnel, which your tailnet administrator must allow (a `funnel` entry in the tailnet access controls; HTTPS and MagicDNS must be on too). If Funnel is not allowed, Dalan stops before it publishes anything and tells you which setup step is missing, or prints Tailscale's own refusal. Enable Funnel once at <https://tailscale.com/kb/1223/funnel>, then run the command again. Other routes need no Tailscale setting; `dalan setup` lists them.
10
8
 
11
9
  <a id="quickstart"></a>
12
10
 
13
- ## Try it with your MCP client
14
-
15
- You need Node.js 24 or newer, Linux or macOS (or WSL), and a hosted client account or workspace that permits custom MCP connectors.
16
-
17
- Start Dalan in an interactive terminal:
11
+ For a quick trial, install Dalan and run:
18
12
 
19
13
  ```sh
20
- npx -y @tnunamak/dalan try
14
+ npm install -g @tnunamak/dalan
15
+ dalan try --public --route tailscale
21
16
  ```
22
17
 
23
- Choose ChatGPT or Claude on the web. In `auto` mode, a saved Gozar choice or an older saved localhost.run choice selects Gozar. Otherwise Dalan uses Tailscale when a route is usable, and Gozar when Tailscale is not usable.
24
-
25
- When Dalan selects Gozar, it names tunnl.gg, links its [terms](https://tunnl.gg/terms) and [privacy notice](https://tunnl.gg/privacy), and asks for consent before exposure. After you consent, Gozar creates a key for this installation and opens a route through its key-bound `tunnl-gg` relay. Dalan does not use or pass your SSH keys. The relay terminates TLS and can see the connector URL and traffic. Keep private code and secrets out of the demo.
26
-
27
- A temporary demo link can change or stop without warning, including within minutes. Dalan checks the original address and ends the trial when it detects a route change or loss. The trial ends after three hours at most; that is a limit on the trial, not a promise about the link. If the address changes or the route stops, start a fresh trial and replace the connector URL.
18
+ Follow the terminal instructions to add the connector, compare the sign-in codes and approve the matching code. Paste the supplied prompt into your agent's chat. Success is a report returned to your terminal.
28
19
 
29
- 1. **Add the connector.** Follow Dalan's instructions to add the complete connector URL in your hosted client and start sign-in. Keep the URL private.
30
- 2. **Approve the sign-in.** Compare the code in the browser with the code in your terminal. Approve only when they match.
31
- 3. **Send the prompt.** Paste Dalan's prompt into a chat with the connector enabled. Dalan queues the demo job; it does not start the hosted chat for you.
32
- 4. **Review the report.** Read the report in your terminal before you accept or reject it.
33
-
34
- The hosted demo is a text job, not a repository review. It grants no repository access. Your agent uses its own account, limits and billing; Dalan does not run a model.
20
+ The trial is a text-only job with no repository access. Keep private code and secrets out of it. Ctrl-C stops the trial. A temporary demo link can change or stop without warning; Dalan ends the trial when it detects that, and the trial ends after three hours at most. For a persistent connection, follow the installation steps below.
35
21
 
36
22
  ### Stop a trial
37
23
 
@@ -39,7 +25,7 @@ Ctrl-C stops the trial. It also cancels a route that is still starting. Dalan cl
39
25
 
40
26
  If Gozar returns a cleanup-pending status for this trial, Dalan provides a recovery command that stops by port. Gozar does not bind that command to a session ID, so the route can change before the command runs. Inspect the current route before using it.
41
27
 
42
- On stop, Dalan removes the connector URL file. It also removes the bridge's secret file for temporary routes. It keeps the bridge configuration when a Tailscale route reuses the same home.
28
+ On stop, Dalan removes the connector URL file and the bridge's secret file for temporary routes. A trial prints its own home. If you run other `dalan` commands against a trial, set `DALAN_HOME` to that printed home first.
43
29
 
44
30
  ### Try without a public route
45
31
 
@@ -49,60 +35,33 @@ npx -y @tnunamak/dalan try --local
49
35
 
50
36
  This runs a self-check with a built-in demo worker and then lets you connect a client on this computer. It does not open a public route. To connect a worker client by hand, see [manual setup](docs/manual-setup.md#worker-setup).
51
37
 
52
- ## Use a Tailscale route
53
-
54
- `npx -y @tnunamak/dalan setup` saves a route choice for public trials. If Tailscale is ready for Funnel, setup asks whether to save Tailscale or Gozar for temporary links. If Tailscale is not ready, setup prints Tailscale installation instructions or lets you save Gozar. It does not install a background service or move a connector to a new address.
55
-
56
- Use Tailscale explicitly:
57
-
58
- ```sh
59
- npx -y @tnunamak/dalan setup
60
- npx -y @tnunamak/dalan try --public --route tailscale --client chatgpt
61
- ```
62
-
63
- Use `--client claude` for claude.ai. Tailscale login, client sign-in and approval may still be required. An explicit `--route tailscale` does not fall back to a trial link: if the route cannot start, Dalan stops and explains why.
64
-
65
- An explicit `--route tailscale` trial uses HTTPS port 443. When the port is available, Dalan opens its own Funnel rule for the trial and attempts to remove only that rule when it stops. If another rule already holds port 443, Dalan can start an isolated, temporary Tailscale node instead. It does not reuse or change the other rule. That node uses a new address and may need a one-time sign-in. A new address needs a new client sign-in.
66
-
67
- If the public address does not answer, the trial prints `TLS certificate: ok` or `TLS certificate: error (...)`. The trial keeps a masked copy of the temporary node's log as `tailscaled.log` in the trial home.
68
-
69
- ### Choose another relay
70
-
71
- `--route gozar` explicitly selects the Gozar relay. Dalan still asks for consent before it exposes the route.
72
-
73
- `--route localhost.run` remains available as an explicit option. It uses OpenSSH and a temporary third-party relay. The relay terminates TLS and can inspect the connector URL and forwarded traffic. Dalan prints this notice before it starts the route. The address can change or stop without warning. Dalan attempts to close the route and reports cleanup it cannot confirm.
74
-
75
- In `auto` mode, a saved Gozar choice or an older saved localhost.run choice selects Gozar. Otherwise, auto uses a usable Tailscale route and selects Gozar when Tailscale is unavailable.
76
-
77
38
  <a id="expose-your-bridge"></a>
78
39
 
79
- ## Install a long-running bridge
40
+ ## Install a persistent connection
80
41
 
81
- Install the CLI:
42
+ The same commands work on macOS and Linux. This example names your worker `assistant`; use that name consistently.
82
43
 
83
44
  ```sh
84
45
  npm install -g @tnunamak/dalan
46
+ dalan service install --worker assistant --route tailscale
47
+ dalan connect start --worker assistant
85
48
  ```
86
49
 
87
- For a bridge that runs in the background on Linux, follow [Run Dalan as a service](docs/service-setup.md). `dalan service install` installs a systemd user service and registers an existing HTTPS origin with Gozar. It does not configure your reverse proxy. One bridge can serve several workers with built-in sign-in and a stable tool catalog.
88
-
89
- New service installs enable daily update checks with up to one hour of jitter. `dalan service update --check --home DIR` reports the newest npm release without installing it. An update installs a separate version, checks every worker's tool catalog, restarts the bridge, and checks its health. A failed switch attempts to restore the previous version and saved state; a failed rollback is reported. Restarts interrupt client connections; these checks do not prove that every change in tool behavior is compatible.
90
-
91
- If any tool descriptor changes, Dalan stages the release and records `connector_refresh_required` without switching. Run `dalan service update --yes --home DIR` to authorize that switch, then refresh the Dalan connector in each hosted client. The daily timer never passes `--yes`. Use `dalan service status --home DIR` for the last result, or `dalan service auto-update off --home DIR` to disable future scheduled checks. Pass `--no-auto-update` during installation to opt out. Existing service preferences are preserved. See [update and recovery details](docs/service-setup.md#service-updates). These commands support Linux systemd services; they do not add launchd support.
92
-
93
- For an existing bridge, migrate worker settings into a new home before you install the service. Repeat `--source` for each old workers file. Use `--workspace-worker` for each worker that needs workspace access:
50
+ Add the private connector URL shown by Dalan to your agent's MCP settings and start sign-in. Compare the code shown in your client with the pending code in your terminal:
51
+ ```sh
52
+ dalan connect pending
53
+ ```
94
54
 
55
+ Only if they match, replace `CODE` below with that code and approve:
95
56
  ```sh
96
- dalan service migrate-workers \
97
- --home "$HOME/.local/share/dalan-service" \
98
- --source "$HOME/OLD_BRIDGE/.config/dot-bridge/workers.json" \
99
- --source-db "$HOME/OLD_BRIDGE/.local/share/dot-bridge/bridge.db" \
100
- --workspace-worker WORKER
57
+ dalan connect approve CODE --worker assistant
101
58
  ```
102
59
 
103
- Migration reads source files without changing them. It copies only repository grants backed by validated audit records. If a checkpoint fails, all source grants are denied until the owner re-approves them. It denies and reports unaudited additions. It preserves supported worker settings, but does not copy OAuth connections, tokens, jobs, results or old destination approvals. The new service defaults execution to `none`. It preserves explicit `workspaceAllowed` settings. Workspace access stays denied by default; pass `--workspace-worker NAME` to grant it to each worker that needs it. Pair every connector again, create new subscriptions with fresh signing keys, and approve each new destination revision. See [service setup](docs/service-setup.md#install-one-bridge-for-several-workers) for details.
60
+ Keep the connector URL and pairing codes private. You are ready to send a job when the client finishes sign-in.
61
+
62
+ Dalan runs in the background as a user service. On macOS it starts at login and stops at logout. On Linux it follows the systemd user manager; starting before login needs administrator setup. Installing a service does not start your AI agent. On macOS, host checks are unavailable and jobs run with `--execution none`.
104
63
 
105
- For a new service home, pass `--worker NAME` once for each worker instead of migrating. See `dalan help service` for the install options.
64
+ Automatic updates are enabled by default. Updates that change the tools exposed to your agent require approval and a connector refresh. See [service setup](docs/service-setup.md) for diagnostics, update controls, other routes and recovery.
106
65
 
107
66
  ## Give your connected agent a job
108
67
 
@@ -193,11 +152,9 @@ Any client that speaks HTTP MCP and completes the bridge's OAuth sign-in can be
193
152
 
194
153
  ## Upgrade
195
154
 
196
- Read the release notes and follow the ordered [upgrade guide](docs/dalan-upgrade.md) before an upgrade. This release changes the worker tool list. After you upgrade, refresh the Dalan connection once in each worker client.
197
-
198
- For a compatible-code restart, built-in OAuth keeps an unexpired access token only when the bridge uses the same private home and issuer and its grant and connection remain live. Access tokens last up to one hour. Before an upgrade or restore, stop the bridge and every other writer, then make a consistent SQLite backup. Preserve the complete active private config directory, including `as.json`, `as-jwks.json`, `as-cookie-keys.json`, `as.sqlite` and its sibling `as-storage.key`; the keys alone cannot restore sign-ins. Follow the [backup and rollback steps](docs/operations.md#upgrade-and-rollback).
155
+ For an installed service, follow [service updates](docs/service-setup.md#service-updates). Dalan checks daily by default; a tool-catalog change waits for your approval before switching and requires a refresh in each connected client.
199
156
 
200
- For the built-in public-client flow, a client that loses a refresh response can recover it only by retrying the identical request within five seconds, while the successor token and connection remain live. A retry after that window can fail and require the client to pair again. This is not a promise of recovery after a longer outage or across incompatible code or storage changes.
157
+ For an older or manually managed installation, follow the [upgrade guide](docs/dalan-upgrade.md). Before upgrading or restoring, use the [backup and rollback instructions](docs/operations.md#upgrade-and-rollback). Do not copy keys alone or mix files from different backups.
201
158
 
202
159
  ## Reference
203
160
 
package/bin/dalan.mjs CHANGED
@@ -4,8 +4,16 @@
4
4
  import fs from 'node:fs';
5
5
  import os from 'node:os';
6
6
  import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
7
8
  import { unsupportedRuntime } from '../src/runtime-check.mjs';
9
+ import { followTarget, handOver } from '../src/follow-current.mjs';
10
+ import { readDefaultHome } from '../src/default-home.mjs';
8
11
  import { resolveHelp } from '../src/cli-help.mjs';
12
+ // Follow the version the service runs, so the CLI and the service never drift. Then find the recorded home without DALAN_HOME.
13
+ const followed = followTarget({ ownBin: fileURLToPath(import.meta.url) });
14
+ if (followed) handOver(followed);
15
+ else {
16
+ if (!process.env.DALAN_HOME && !['try', 'service', 'setup'].includes(process.argv[2])) { const recorded = readDefaultHome(); if (recorded) process.env.DALAN_HOME = recorded; }
9
17
  if (['--version', '-v'].includes(process.argv[2])) {
10
18
  const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
11
19
  process.stdout.write(`${version}\n`);
@@ -41,3 +49,4 @@ if (help) {
41
49
  if (process.env.DALAN_HOME) process.env.HOME = path.resolve(process.env.DALAN_HOME);
42
50
  await import('./dot-worker.mjs');
43
51
  }
52
+ }
@@ -26,6 +26,7 @@ import { RESOURCE_LIMITS_UNAVAILABLE } from '../src/host-execution-policy.mjs';
26
26
  import { summarizeRejections } from '../src/rejections.mjs';
27
27
  import { VERDICT_EXIT, formatVerdict } from '../src/work-order.mjs';
28
28
  import { connectCommand } from '../src/connect-cli.mjs';
29
+ import { runAuthCheck } from '../src/auth-check.mjs';
29
30
  import { initAsFiles, rotateKeys } from '../src/as-files.mjs';
30
31
  import { docsUrl } from '../src/docs-url.mjs';
31
32
  import { workerPrompt } from '../src/worker-prompt.mjs';
@@ -333,7 +334,7 @@ async function waitDrained() {
333
334
  }
334
335
  }
335
336
  async function main() {
336
- let result, waitOutput=false, plainOutput=false;
337
+ let result, waitOutput=false, plainOutput=false, earlyId=false;
337
338
  const help=resolveHelp([command,...args]);
338
339
  if(help){ if(help.stream==='stdout') console.log(help.text); else console.error(help.text); process.exitCode=help.code; return; }
339
340
  switch (command) {
@@ -506,6 +507,8 @@ async function main() {
506
507
  }
507
508
  for(const w of result?.submission_warnings??[]) console.error(`dalan: WARNING: ${w}`);
508
509
  if(dryRun) { if(!json) console.error(formatVerdict(result)); process.exitCode=VERDICT_EXIT[result.verdict]??0; break; }
510
+ // A person driving a worker by hand needs the ID while the wait runs. On a terminal the lines go to stdout; piped, they go to stderr so stdout stays the one JSON result.
511
+ if(args.includes('--wait')&&!json) { (process.stdout.isTTY?console.log:console.error)(`Request ID: ${id}\nSend your worker: ${workerPrompt(id)}`); earlyId=true; }
509
512
  if(args.includes('--wait')) { result=await waitForAssignment(id,option('--timeout')); indexArtifacts(id,result); waitOutput=true; process.exitCode=waitExitCode(result.status); if(!json) waitTimeoutNote(id,result); }
510
513
  // Discovery labels are not capabilities. Report only the persisted, validated binding.
511
514
  const producer=typeof saved.producer==='string'&&producerPattern.test(saved.producer)?saved.producer:null;
@@ -514,7 +517,7 @@ async function main() {
514
517
  binding,wake:args.includes('--wait')?'wait_returned':delivery==='none'?'not_registered_by_this_submit':'delivery_destination'};
515
518
  if(json) result={...result,recovery};
516
519
  // Human mode: one plain next step on stderr, so stdout stays the JSON document. --json carries the full recovery record.
517
- else endNote=`${briefGiven?`Request ID: ${id}\nSend your worker: ${workerPrompt(id)}\n`:''}Next: ${recovery.wake==='wait_returned'?`read the result with: ${recovery.get}`:recovery.wake==='delivery_destination'?`the result goes to ${delivery}; check it any time with: ${recovery.get}`:`send your worker the job, then run: ${cli} wait ${id} (check it any time with: ${recovery.get})`}${recovery.inbox?`. List your jobs with: ${recovery.inbox}`:''}`;
520
+ else endNote=`${briefGiven&&!earlyId?`Request ID: ${id}\nSend your worker: ${workerPrompt(id)}\n`:''}Next: ${recovery.wake==='wait_returned'?`read the result with: ${recovery.get}`:recovery.wake==='delivery_destination'?`the result goes to ${delivery}; check it any time with: ${recovery.get}`:`send your worker the job, then run: ${cli} wait ${id} (check it any time with: ${recovery.get})`}${recovery.inbox?`. List your jobs with: ${recovery.inbox}`:''}`;
518
521
  // On a terminal, a person reads the output: show the human lines instead of the JSON receipt. Piped output stays
519
522
  // the JSON document, so scripts that read submit's standard output keep working; --json always prints it.
520
523
  if(!json&&!waitOutput&&process.stdout.isTTY) { result=`Request ID: ${id}${briefGiven?`\nSend your worker: ${workerPrompt(id)}`:''}`; plainOutput=true; endNote=endNote.split('\n').filter(l=>!l.startsWith('Request ID: ')&&!l.startsWith('Send your worker: ')).join('\n'); }
@@ -692,6 +695,17 @@ async function main() {
692
695
  break;
693
696
  }
694
697
  case 'doctor': {
698
+ if(args.includes('--auth')) {
699
+ // A real OAuth client walk against this home's public MCP URL; the owner approval goes through the admin socket and is revoked after.
700
+ if(args.includes('--checks')) throw new Error('doctor: --auth and --checks cannot be combined');
701
+ if(args.includes('--worker')&&(!option('--worker')||option('--worker').startsWith('--'))) throw new Error('--worker requires a name');
702
+ const lines=[];
703
+ const workersFile=readEnv('DALAN_WORKERS_FILE')||defaultPath(home,'.config/dot-bridge/workers.json');
704
+ const outcome=await runAuthCheck({home,workers:fs.existsSync(workersFile)?[...loadOwnerWorkers(workersFile).workers.keys()]:[],worker:option('--worker')??undefined,request,operator,say:line=>lines.push(line)});
705
+ if(!outcome.ok) process.exitCode=outcome.partial?2:1;
706
+ result=json?{ok:outcome.ok,results:outcome.results}:lines.join('\n');plainOutput=!json;
707
+ break;
708
+ }
695
709
  if(args.includes('--checks')) {
696
710
  // Local only: the owner's checks.json against each repo's default-branch tree (mirror). Warnings never fail the command; errors do.
697
711
  const repos=lintChecksFile();
@@ -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 ROUTE`). 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).