@tnunamak/dalan 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +176 -0
- package/CONTRIBUTING.md +26 -0
- package/LICENSE +204 -0
- package/PROTOCOL.md +351 -0
- package/README.md +215 -2
- package/SECURITY.md +30 -0
- package/bin/dalan.mjs +43 -0
- package/bin/dot-acp-agent.mjs +377 -0
- package/bin/dot-alert.mjs +9 -0
- package/bin/dot-deadman.mjs +82 -0
- package/bin/dot-heartbeat.mjs +29 -0
- package/bin/dot-pr-reviewer.mjs +32 -0
- package/bin/dot-worker.mjs +764 -0
- package/docs/chatgpt-worker-onboarding.md +112 -0
- package/docs/claude-worker-onboarding.md +113 -0
- package/docs/codex-to-muse.md +175 -0
- package/docs/connect-chatgpt.md +83 -0
- package/docs/connection-longevity.md +43 -0
- package/docs/dalan-upgrade.md +246 -0
- package/docs/deadman.md +61 -0
- package/docs/dot-pr-reviewer.config.example.json +9 -0
- package/docs/durability-audit.md +27 -0
- package/docs/keycloak-client-chatgpt-dot-bridge.json +59 -0
- package/docs/keycloak-oauth-setup.md +30 -0
- package/docs/local-agent-mcp.md +41 -0
- package/docs/manual-setup.md +135 -0
- package/docs/mirror-fetch.md +97 -0
- package/docs/operations.md +799 -0
- package/docs/operator-duties.md +68 -0
- package/docs/owner-integrator.md +27 -0
- package/docs/portable-auth-profile.md +107 -0
- package/docs/pr-head-reviewer.md +70 -0
- package/docs/pr-preflight.md +28 -0
- package/docs/pull-queue.md +131 -0
- package/docs/pull-workers.md +94 -0
- package/docs/redaction.md +27 -0
- package/docs/service-setup.md +219 -0
- package/docs/setup-reference.md +80 -0
- package/docs/t3-connector-icon.png +0 -0
- package/docs/t3-integration.md +51 -0
- package/docs/t3-result-retry-delivery.md +41 -0
- package/docs/t3-reverse-control.md +107 -0
- package/docs/usage.md +443 -0
- package/docs/worker-clients.md +290 -0
- package/integrations/t3/acp-kit/src/capability.mjs +25 -0
- package/integrations/t3/acp-kit/src/errors.mjs +13 -0
- package/integrations/t3/acp-kit/src/index.mjs +5 -0
- package/integrations/t3/acp-kit/src/lock.mjs +155 -0
- package/integrations/t3/acp-kit/src/session-store.mjs +36 -0
- package/integrations/t3/acp-kit/src/t3-envelope.mjs +62 -0
- package/package.json +67 -4
- package/packages/job-core/README.md +18 -0
- package/packages/job-core/index.mjs +2 -0
- package/packages/job-core/package.json +8 -0
- package/packages/job-core/protocol/canonical.mjs +11 -0
- package/packages/job-core/protocol/v0/command.schema.json +1154 -0
- package/packages/job-core/protocol/v0/event.schema.json +77 -0
- package/packages/job-core/protocol/v0/reply.schema.json +59 -0
- package/packages/job-core/transitions.mjs +25 -0
- package/scripts/daily-selfcheck.mjs +135 -0
- package/scripts/dalan-try-selfcheck.mjs +29 -0
- package/scripts/lib/expose-tailscale.mjs +408 -0
- package/scripts/live-trial/common.mjs +272 -0
- package/scripts/monitor-targets.mjs +44 -0
- package/scripts/upgrade-drain.mjs +39 -0
- package/scripts/worker-bridge-setup.mjs +925 -0
- package/src/ack-ledger.mjs +37 -0
- package/src/acp-bridge.mjs +418 -0
- package/src/acp-context.mjs +138 -0
- package/src/admin-socket.mjs +14 -0
- package/src/alerts.mjs +147 -0
- package/src/artifact-journal.mjs +75 -0
- package/src/as-files.mjs +347 -0
- package/src/as-store.mjs +456 -0
- package/src/as.mjs +538 -0
- package/src/auth.mjs +166 -0
- package/src/builtin-http.mjs +22 -0
- package/src/check-coverage.mjs +38 -0
- package/src/check-lint.mjs +88 -0
- package/src/check-readiness.mjs +112 -0
- package/src/check-response.mjs +19 -0
- package/src/child-exit.mjs +18 -0
- package/src/child-registry.mjs +94 -0
- package/src/claim-command-ledger.mjs +51 -0
- package/src/cli-help.mjs +186 -0
- package/src/cli-name.mjs +16 -0
- package/src/connect-cli.mjs +126 -0
- package/src/consumers.mjs +61 -0
- package/src/deadman.mjs +329 -0
- package/src/delivery.mjs +19 -0
- package/src/demo-worker.mjs +150 -0
- package/src/destinations/index.mjs +23 -0
- package/src/destinations/none.mjs +15 -0
- package/src/destinations/t3.mjs +109 -0
- package/src/diagnostic.mjs +78 -0
- package/src/docs-url.mjs +9 -0
- package/src/drain-runner.mjs +9 -0
- package/src/drained-owner.mjs +26 -0
- package/src/drained-slot.mjs +70 -0
- package/src/drained.mjs +40 -0
- package/src/durable-waiters.mjs +236 -0
- package/src/env.mjs +19 -0
- package/src/execution.mjs +112 -0
- package/src/failure-type.mjs +28 -0
- package/src/get-summary.mjs +32 -0
- package/src/git-env.mjs +15 -0
- package/src/host-budget-receipts.mjs +154 -0
- package/src/host-budget-seccomp.py +33 -0
- package/src/host-budget-service.mjs +54 -0
- package/src/host-budget-stop.mjs +26 -0
- package/src/host-budget-storage.py +259 -0
- package/src/host-budget.mjs +149 -0
- package/src/host-cgroup.mjs +23 -0
- package/src/host-check-allowlist.mjs +42 -0
- package/src/host-execution-policy.mjs +38 -0
- package/src/host-health.mjs +34 -0
- package/src/host-stop-reverify.mjs +44 -0
- package/src/inbox.mjs +55 -0
- package/src/integrator.mjs +322 -0
- package/src/job-retention.mjs +69 -0
- package/src/legacy-names.mjs +8 -0
- package/src/lifecycle.mjs +291 -0
- package/src/limits.mjs +31 -0
- package/src/loopback.mjs +9 -0
- package/src/mcp-outcome.mjs +79 -0
- package/src/mcp-sse.mjs +62 -0
- package/src/mcp-stdio.mjs +191 -0
- package/src/mirror-fetch-lock.py +164 -0
- package/src/mirror-fetch.mjs +174 -0
- package/src/notify-ledger.mjs +82 -0
- package/src/objectives.mjs +129 -0
- package/src/owner-report-artifact.mjs +66 -0
- package/src/patch-apply.mjs +84 -0
- package/src/path-syntax.mjs +16 -0
- package/src/paths.mjs +67 -0
- package/src/pr-head-reviewer.mjs +596 -0
- package/src/pr-preflight.mjs +51 -0
- package/src/prepared-node-modules.mjs +129 -0
- package/src/process-inspection.mjs +36 -0
- package/src/projects.mjs +480 -0
- package/src/protocol-artifact-commands.mjs +52 -0
- package/src/protocol-delivery-driver.mjs +167 -0
- package/src/protocol-finish.mjs +100 -0
- package/src/protocol-owner-command.mjs +35 -0
- package/src/protocol-owner-mutations.mjs +22 -0
- package/src/protocol-owner-waiters.mjs +67 -0
- package/src/protocol-retention.mjs +52 -0
- package/src/protocol-services.mjs +61 -0
- package/src/protocol-stop-observer.mjs +131 -0
- package/src/publish-plan.mjs +245 -0
- package/src/pull-queue.mjs +159 -0
- package/src/redaction.mjs +763 -0
- package/src/rejections.mjs +18 -0
- package/src/request-log.mjs +102 -0
- package/src/restore-check.mjs +90 -0
- package/src/result-binding.mjs +65 -0
- package/src/route-setting.mjs +24 -0
- package/src/runtime-check.mjs +13 -0
- package/src/sandbox-supervisor.mjs +105 -0
- package/src/schema-subset.mjs +186 -0
- package/src/scopes.mjs +15 -0
- package/src/server.mjs +1468 -0
- package/src/service-migrate-workers.mjs +113 -0
- package/src/service.mjs +388 -0
- package/src/setup.mjs +63 -0
- package/src/shutdown-signal.mjs +12 -0
- package/src/signal-sandbox-processes.py +56 -0
- package/src/signal.mjs +119 -0
- package/src/status-evidence.mjs +47 -0
- package/src/status-summary.mjs +54 -0
- package/src/store.mjs +3069 -0
- package/src/submission-policy.mjs +623 -0
- package/src/subscription-storage.mjs +64 -0
- package/src/t3-audit.mjs +120 -0
- package/src/t3-control.mjs +102 -0
- package/src/t3-transport.mjs +158 -0
- package/src/t3.mjs +209 -0
- package/src/terminal-safe.mjs +19 -0
- package/src/tool-registry.mjs +453 -0
- package/src/try-command.mjs +11 -0
- package/src/try-exposure.mjs +908 -0
- package/src/try-hosted-clients.mjs +46 -0
- package/src/try-hosted.mjs +444 -0
- package/src/try-selfcheck.mjs +168 -0
- package/src/try.mjs +635 -0
- package/src/webhooks.mjs +86 -0
- package/src/work-order.mjs +265 -0
- package/src/worker-instructions.mjs +26 -0
- package/src/worker-prompt.mjs +4 -0
- package/src/workers.mjs +632 -0
- package/src/workspace.mjs +1065 -0
- package/systemd/dot-bridge-heartbeat.service +18 -0
- package/systemd/dot-bridge-heartbeat.timer +10 -0
- package/systemd/dot-bridge-selfcheck.service +12 -0
- package/systemd/dot-bridge-selfcheck.timer +11 -0
- package/systemd/dot-bridge.service +17 -0
- package/systemd/dot-deadman.service +30 -0
- package/systemd/dot-pr-reviewer.service +11 -0
- package/systemd/dot-pr-reviewer.timer +10 -0
package/README.md
CHANGED
|
@@ -1,3 +1,216 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dalan
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Give a coding agent in ChatGPT, Claude on the web, or another MCP client a job from your computer, then review its report.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npx -y @tnunamak/dalan try
|
|
7
|
+
```
|
|
8
|
+
|
|
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.
|
|
10
|
+
|
|
11
|
+
<a id="quickstart"></a>
|
|
12
|
+
|
|
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:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx -y @tnunamak/dalan try
|
|
21
|
+
```
|
|
22
|
+
|
|
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.
|
|
28
|
+
|
|
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.
|
|
35
|
+
|
|
36
|
+
### Stop a trial
|
|
37
|
+
|
|
38
|
+
Ctrl-C stops the trial. It also cancels a route that is still starting. Dalan closes its forwarding gate and attempts to remove its route. If it cannot confirm cleanup, it reports that. When Gozar cannot confirm route ownership, Dalan leaves the route alone and gives no stop command; use a different port and home for another trial.
|
|
39
|
+
|
|
40
|
+
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
|
+
|
|
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.
|
|
43
|
+
|
|
44
|
+
### Try without a public route
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npx -y @tnunamak/dalan try --local
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
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
|
+
|
|
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
|
+
<a id="expose-your-bridge"></a>
|
|
78
|
+
|
|
79
|
+
## Install a long-running bridge
|
|
80
|
+
|
|
81
|
+
Install the CLI:
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
npm install -g @tnunamak/dalan
|
|
85
|
+
```
|
|
86
|
+
|
|
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
|
+
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:
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
dalan service migrate-workers \
|
|
93
|
+
--home "$HOME/.local/share/dalan-service" \
|
|
94
|
+
--source "$HOME/OLD_BRIDGE/.config/dot-bridge/workers.json" \
|
|
95
|
+
--source-db "$HOME/OLD_BRIDGE/.local/share/dot-bridge/bridge.db" \
|
|
96
|
+
--workspace-worker WORKER
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
For a new service home, pass `--worker NAME` once for each worker instead of migrating. See `dalan help service` for the install options.
|
|
102
|
+
|
|
103
|
+
## Give your connected agent a job
|
|
104
|
+
|
|
105
|
+
In another terminal, replace `WORKER` with the name of your connected worker:
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
dalan submit --worker WORKER --execution none --deliver none --brief "Explain what a database index does. Do not read files, run commands or call external services."
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Send the agent the request ID that Dalan prints. Ask it to claim that job, follow its brief and return a report. Queuing a job does not start the agent.
|
|
112
|
+
|
|
113
|
+
Replace `REQUEST_ID` with that ID, then wait and read the result:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
dalan wait REQUEST_ID
|
|
117
|
+
dalan get REQUEST_ID --json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Read the report before recording your decision:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
dalan decide REQUEST_ID accepted
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
A finished job and an accepted result are separate steps. Acceptance does not apply a patch. After review, apply a finished job's patch with:
|
|
127
|
+
|
|
128
|
+
```sh
|
|
129
|
+
dalan apply REQUEST_ID --dir PATH
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
<a id="separate-repository-assignment"></a>
|
|
133
|
+
|
|
134
|
+
## Give a worker a repository job
|
|
135
|
+
|
|
136
|
+
The first job needs no repository. Repository jobs need Git and Python 3.8 or newer on the bridge computer, workspaces enabled, and an exact repository grant for the worker. The hosted demo does not enable repository work. A repository grant and a job's read/write scope are separate limits; host checks are another capability.
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
dalan worker allow WORKER OWNER/REPO
|
|
140
|
+
dalan worker list WORKER --json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Revoke access when the worker no longer needs it:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
dalan worker deny WORKER OWNER/REPO
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For a read-only repository job, replace the request ID, repository and full commit SHA below. Choose a file that exists at that commit:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"schema_version": 1,
|
|
154
|
+
"request_id": "req_<new UUID>",
|
|
155
|
+
"brief": "Read README.md at the pinned commit and report its title. Do not run checks or change files.",
|
|
156
|
+
"inputs": [{"github_repo": "OWNER/REPO", "base_sha": "<full 40-character commit SHA>"}],
|
|
157
|
+
"expected_output": "README title and pinned revision; no patch or check claim.",
|
|
158
|
+
"scope_paths": ["README.md"],
|
|
159
|
+
"execution_scope": "read-only"
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Save it as `repository-job.json`, then submit, wait, read the report and record your decision:
|
|
164
|
+
|
|
165
|
+
```sh
|
|
166
|
+
dalan submit --worker WORKER --execution none --deliver none --file repository-job.json --json
|
|
167
|
+
dalan wait REQUEST_ID
|
|
168
|
+
dalan get REQUEST_ID
|
|
169
|
+
dalan decide REQUEST_ID accepted
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The host's GitHub credential must be able to read the repository. For local clones, manual bridge setup and workspace configuration, see [manual setup](docs/manual-setup.md#owner-and-requester-setup) and the [setup reference](docs/setup-reference.md). Keep private repository credentials out of the job brief.
|
|
173
|
+
|
|
174
|
+
<a id="support-matrix"></a>
|
|
175
|
+
<a id="connect-your-own-worker"></a>
|
|
176
|
+
|
|
177
|
+
## Connect any MCP worker
|
|
178
|
+
|
|
179
|
+
Any client that speaks HTTP MCP and completes the bridge's OAuth sign-in can be a worker. Start with the [worker guide](docs/worker-clients.md); client recipes add registration details, while job tools and grant rules stay the same.
|
|
180
|
+
|
|
181
|
+
| Client | Guide |
|
|
182
|
+
|---|---|
|
|
183
|
+
| Any MCP client | [Connect a worker client](docs/worker-clients.md) |
|
|
184
|
+
| Codex CLI | [Native CLI worker: Codex CLI](docs/worker-clients.md#native-cli-worker-codex-cli) |
|
|
185
|
+
| Claude Code | [Native CLI worker: Claude Code](docs/worker-clients.md#native-cli-worker-claude-code) |
|
|
186
|
+
| opencode | [CLI worker: opencode](docs/worker-clients.md#cli-worker-opencode) |
|
|
187
|
+
| ChatGPT | [Connect ChatGPT](docs/connect-chatgpt.md) |
|
|
188
|
+
| Claude on the web | [Claude cloud worker](docs/claude-worker-onboarding.md) |
|
|
189
|
+
|
|
190
|
+
## Upgrade
|
|
191
|
+
|
|
192
|
+
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.
|
|
193
|
+
|
|
194
|
+
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).
|
|
195
|
+
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
## Reference
|
|
199
|
+
|
|
200
|
+
| Need | Command or guide |
|
|
201
|
+
| --- | --- |
|
|
202
|
+
| Command help | `dalan help --all` |
|
|
203
|
+
| Trial options | `dalan help try` |
|
|
204
|
+
| Bridge and queue state | `dalan status --json` |
|
|
205
|
+
| Results needing attention | `dalan inbox --all` |
|
|
206
|
+
| A full job record | `dalan get REQUEST_ID --json` |
|
|
207
|
+
| Host diagnostics | `dalan doctor --json` |
|
|
208
|
+
| File locations | `dalan paths --json` |
|
|
209
|
+
| Cancel a job | `dalan cancel REQUEST_ID` |
|
|
210
|
+
| Run a bridge in the background | [Service setup](docs/service-setup.md) |
|
|
211
|
+
| Upgrade or remove an installation | [Operations](docs/operations.md) |
|
|
212
|
+
| Release changes | [Changelog](CHANGELOG.md) |
|
|
213
|
+
|
|
214
|
+
When asking for help, share the failing step and error. Do not share private connector URLs, pairing codes or credentials.
|
|
215
|
+
|
|
216
|
+
Licensed under Apache-2.0.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Report a vulnerability
|
|
4
|
+
|
|
5
|
+
Use GitHub private vulnerability reporting. Never put secrets, exploit details, or private host information in public issues or pull requests.
|
|
6
|
+
|
|
7
|
+
To file a report, open **Security** on [this repository's page](https://github.com/tnunamak/dalan), then **Advisories**, then select **Report a vulnerability**. You can also go straight to <https://github.com/tnunamak/dalan/security/advisories/new>. GitHub asks you to sign in first if you have not.
|
|
8
|
+
|
|
9
|
+
This route works only if the repository has private vulnerability reporting enabled. If **Report a vulnerability** is missing, open a new issue, choose **Request a private security reporting route**, and include no details. Send the report after a private route exists.
|
|
10
|
+
|
|
11
|
+
Include the affected revision, impact, and steps to reproduce with sanitized examples.
|
|
12
|
+
|
|
13
|
+
## Secret redaction
|
|
14
|
+
|
|
15
|
+
The bridge masks credentials in logs, alerts, errors, in the report text and progress notes it shows the owner, and in stored report artifacts. The local database keeps the exact text a worker sent, so protect the database and its backups. Redaction catches accidental leaks of registered secrets and known formats, including JSON-escaped spellings such as a `\u0073` escape inside a JSON string or key. It cannot stop a worker that deliberately encodes a secret it knows. Examples that can pass unmasked include base64-encoded unregistered secrets and secrets split across log lines. See [docs/redaction.md](docs/redaction.md).
|
|
16
|
+
|
|
17
|
+
## Known limits
|
|
18
|
+
|
|
19
|
+
These are real gaps that are not fixed. Each has a test that pins today's behavior, so a change to it is deliberate.
|
|
20
|
+
|
|
21
|
+
- **Without a workers file, external OAuth maps every allowed subject to the single worker.** Every subject on `OAUTH_ALLOWED_SUBJECTS` is the one legacy worker (`dot`); that list is your explicit grant, so list only subjects you trust as that worker. The list is exact match only (no wildcard), and an absent or empty list refuses to start. With a `workers.json` in external mode, every connection record must name its `subject`; `client_id` and `connection_id` only narrow it. Pinned by `scripts/auth-cache-test.mjs` and `scripts/worker-isolation-test.mjs`.
|
|
22
|
+
- **Approving a replacement (`--replace`) hands the new client every queued and future job for that worker, including briefs approved before the switch.** Approve only a code you started yourself. The principal is the worker, not the OAuth client: replacement exists so a worker can switch clients or recover after a crash. The approve error and output name the worker and say this.
|
|
23
|
+
- **A replacement worker connection can read jobs approved for the connection it replaced.** `get` and `list_pending` are open to every authenticated connection of the worker. After the owner approves connection B in place of A, B can read the brief and title of a queued job that was approved for A. B can also claim a job that is still queued, because a claim checks only that the claimant connection is live and that the job's own destination is still approved. B cannot take over a claim that A already holds while its lease is unexpired, and a call bound to such a claim is fenced to the connection that holds it. Risk: disclosure of that job's text, and the right to claim it, to a connection the owner approved for the worker but did not approve for that job. Pinned by `ReadAdmitted/get` and `ReadAdmitted/list_pending` in `scripts/claim-statechart-http-test.mjs`; the formal model in `spec/tla/ClaimsReads.cfg` shows the same read.
|
|
24
|
+
- **A queued job with no deadline whose approved destination changed stays queued.** Every claim of it is refused with `destination_changed`, and nothing cancels it automatically. Risk: queue clutter only, no data exposure. The owner recovers it with cancel and resubmit under a new request ID, or by restoring the approved destination. Pinned by `QueueProgress known limit` in `scripts/claim-statechart-test.mjs`; `spec/tla/Queue.cfg` shows the same non-progress.
|
|
25
|
+
|
|
26
|
+
## Scope and support
|
|
27
|
+
|
|
28
|
+
Reports may cover the bridge server, OAuth and claim admission, worker sandboxing, and the CLI. The latest npm release and the latest commit on main are supported. Where safe, check that the issue still affects the latest release or main before you report it.
|
|
29
|
+
|
|
30
|
+
This project is maintained by one person. The maintainer will review reports as time allows and may ask for more information. There is no guaranteed response time and no bug bounty.
|
package/bin/dalan.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// `dalan try` runs before the CLI loads: it picks its own trial home. For every other command, DALAN_HOME names the
|
|
3
|
+
// bridge home. Setting HOME here, after Node has started, keeps version-manager shims working.
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { unsupportedRuntime } from '../src/runtime-check.mjs';
|
|
8
|
+
import { resolveHelp } from '../src/cli-help.mjs';
|
|
9
|
+
if (['--version', '-v'].includes(process.argv[2])) {
|
|
10
|
+
const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
11
|
+
process.stdout.write(`${version}\n`);
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
// Before any import that needs Node 24 (node:sqlite): an unsupported Node or platform gets one line, not a stack trace.
|
|
15
|
+
const unsupported = unsupportedRuntime();
|
|
16
|
+
if (unsupported) { process.stderr.write(`dalan: ${unsupported}\n`); process.exit(1); }
|
|
17
|
+
// Help requests, no command and unknown commands are answered here, before the trial-home guard and the CLI load.
|
|
18
|
+
const help = resolveHelp(process.argv.slice(2));
|
|
19
|
+
if (help) {
|
|
20
|
+
(help.stream === 'stdout' ? process.stdout : process.stderr).write(`${help.text}\n`);
|
|
21
|
+
process.exitCode = help.code;
|
|
22
|
+
} else if (process.argv[2] === 'mcp') {
|
|
23
|
+
// stdout is the protocol channel: nothing else may print to it. The tools run the CLI, which applies the DALAN_HOME rules.
|
|
24
|
+
await (await import('../src/mcp-stdio.mjs')).main();
|
|
25
|
+
} else if (process.argv[2] === 'setup') {
|
|
26
|
+
await (await import('../src/setup.mjs')).main();
|
|
27
|
+
} else if (process.argv[2] === 'service') {
|
|
28
|
+
try { await (await import('../src/service.mjs')).serviceMain(process.argv.slice(3)); }
|
|
29
|
+
catch (error) { process.stderr.write(`dalan: service: ${error.message}\n`); process.exitCode = 1; }
|
|
30
|
+
} else if (process.argv[2] === 'try') {
|
|
31
|
+
await (await import('../src/try.mjs')).main();
|
|
32
|
+
} else {
|
|
33
|
+
const command = process.argv[2];
|
|
34
|
+
const trial = path.join(os.homedir(), '.local/share/dalan-trial');
|
|
35
|
+
// doctor is exempt: it diagnoses a missing bridge home and reports it as a finding.
|
|
36
|
+
if (!process.env.DALAN_HOME && command && !['help', '--help', '-h', 'paths', 'doctor'].includes(command) && fs.existsSync(path.join(trial, '.dalan-trial'))) {
|
|
37
|
+
const message = `DALAN_HOME is not set, so "dalan ${command}" does not know which bridge home to use. To use the trial bridge, run this, then run the command again:\n export DALAN_HOME='${trial.replaceAll("'", "'\\''")}'`;
|
|
38
|
+
process.stderr.write(process.argv.includes('--json') ? `${JSON.stringify({ error: message, kind: 'local' })}\n` : `dalan: ${message}\n`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
if (process.env.DALAN_HOME) process.env.HOME = path.resolve(process.env.DALAN_HOME);
|
|
42
|
+
await import('./dot-worker.mjs');
|
|
43
|
+
}
|