@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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ChatGPT cloud worker: manual first connection
|
|
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.
|
|
4
|
+
|
|
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
|
+
|
|
7
|
+
## 1. Check features and the existing bridge
|
|
8
|
+
|
|
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
|
+
- 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.
|
|
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
|
+
- 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
|
+
|
|
15
|
+
## 2. Resolve the exact callback before registration
|
|
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)
|
|
18
|
+
|
|
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
|
+
|
|
21
|
+
For this built-in recipe, use DCR only if offered and compatible. This recipe covers Dynamic Client Registration; other registration methods need separate instructions from the owner. Do not invent credentials, switch issuers, add headers, or modify discovery/auth policy. If only another method is available, stop and ask the owner for that separately validated path.
|
|
22
|
+
|
|
23
|
+
Owner sequence:
|
|
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:
|
|
28
|
+
|
|
29
|
+
```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
|
+
dalan connect start --worker NAME
|
|
35
|
+
```
|
|
36
|
+
|
|
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.
|
|
38
|
+
|
|
39
|
+
## 3. Add, pair and inspect the connector
|
|
40
|
+
|
|
41
|
+
The current documented entry is **ChatGPT Plugins → plus → Add custom MCP server**. Supply a descriptive name and the bridge's exact resource URL, configure OAuth, review the risk warning, and create the personal plugin. Do not copy the quickstart's unauthenticated example. Inspect the discovered tools and install only for the intended account. [Connection guide](https://developers.openai.com/plugins/deploy/connect-chatgpt#add-the-mcp-server), [personal-plugin quickstart](https://developers.openai.com/plugins/quickstart)
|
|
42
|
+
|
|
43
|
+
If the UI instead shows **Settings → Apps → Advanced → Developer mode** and **Plugins → Create**, follow [ChatGPT user setup](connect-chatgpt.md#chatgpt-user-setup); the pairing and code-match checks are the same. For other UI differences, use current official guidance for the screen actually present.
|
|
44
|
+
|
|
45
|
+
During the owner-initiated browser flow:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
dalan connect pending
|
|
49
|
+
```
|
|
50
|
+
|
|
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:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
dalan connect approve CODE --worker NAME
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
These are bridge pairing requirements, not vendor UI claims. A missing/mismatched code, unexpected scopes or expired window is a stop, not permission to approve an entry without code comparison over a trusted channel. [Bridge pairing flow](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md#4-pair-fixture-a-and-allow-its-callback)
|
|
58
|
+
|
|
59
|
+
Before a job, inspect the actual connected catalog. The text smoke needs `list_pending`, `get`, `claim`, `progress` and `finish`; `ack_message` is useful only for messages. With the global T3 switch off, a modern process catalog omits `t3_thread_*` and advertises `notify_owner` to every worker; a worker without `t3` must still receive a denied result if it calls that tool. Advertised names do not grant authority. Repository tools, if enabled on the existing host, are not needed and must not be called by this execution-none job. Missing tools or unexpected privilege are blockers, not reasons to expand the profile.
|
|
60
|
+
|
|
61
|
+
For stale schemas, OpenAI documents refreshing the connection and retesting in a new conversation. [Metadata refresh](https://developers.openai.com/plugins/deploy/connect-chatgpt#refresh-metadata) Verify that the refreshed tool catalog exposes optional `acquisition_id`. Do not infer that every client needs, or never needs, a new conversation. Inspect the live `claim` schema and record what actually refreshed; any new Work/Codex task needs its own required authorization.
|
|
62
|
+
|
|
63
|
+
## 4. One owner-submitted text smoke
|
|
64
|
+
|
|
65
|
+
Only after the owner authorizes a real trial, create the assignment locally. This generates a unique request ID and harmless nonce; it does not submit anything:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
node --input-type=module > first-job.json <<'NODE'
|
|
69
|
+
import { randomUUID } from 'node:crypto';
|
|
70
|
+
const nonce = randomUUID();
|
|
71
|
+
console.log(JSON.stringify({
|
|
72
|
+
schema_version: 1,
|
|
73
|
+
request_id: `req_${randomUUID()}`,
|
|
74
|
+
brief: `Text-only bridge smoke. Return exactly SMOKE ${nonce}. Do not access repositories, run checks, start other jobs, or change any state outside this assignment's claim/progress/finish lifecycle.`,
|
|
75
|
+
inputs: [],
|
|
76
|
+
scope_paths: [],
|
|
77
|
+
execution_scope: 'read-only',
|
|
78
|
+
expected_output: `A completed text report containing exactly SMOKE ${nonce}.`
|
|
79
|
+
}, null, 2));
|
|
80
|
+
NODE
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The distinction matters: **`execution_scope` is `read-only`; executor selection is separately `--execution none`**, not `execution_scope: "none"`. No repository input or repository grant is required. The owner submits to the existing selected profile with quiet delivery (the default):
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
dalan submit --worker NAME --execution none --file first-job.json
|
|
87
|
+
dalan get REQUEST_ID --json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Use the `request_id` from the submit response for `REQUEST_ID`. Save the JSON and that ID; if the response is lost, retry the identical file/ID, not a new job. Confirm `execution` is `none` and the intended target worker before continuing.
|
|
91
|
+
|
|
92
|
+
Manually ask the already authorized cloud conversation to do exactly this (replace `REQUEST_ID` with the confirmed ID and explicitly select the connected bridge):
|
|
93
|
+
|
|
94
|
+
> Check the bridge once for REQUEST_ID only. Read it with get and stop if cancelled, revoked, mismatched or outside this text-only scope. Use list_pending to locate it. Before claiming, generate and privately save one random acquisition_id for this run. Never print this claim nonce (acquisition_id), even in diagnostics, examples or reports. Keep it in private saved run state and reuse it only for this acquisition. Use your stable claimant and that same acquisition_id on every claim retry. Save only the claim_id directly returned by your claim; do not borrow a grant from get. Read owner notes, send progress, echo the assigned nonce through a completed text finish using the current tool schema, then stop. Do not claim another job, call repository/check tools, create a Work/Codex task, invoke a model API, or add a schedule.
|
|
95
|
+
|
|
96
|
+
For ChatGPT's documented direct plugin invocation, select the plugin using `@` in the intended authorized conversation; this is not permission to start a new Work task. [Official quickstart](https://developers.openai.com/plugins/quickstart) No push delivery or scheduled wake is assumed. A blocker must go through `progress` to the submitting owner, not to an unrelated person.
|
|
97
|
+
|
|
98
|
+
After the worker finishes, the owner reads the bridge record, not just the chat reply:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
dalan get REQUEST_ID --json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Confirm that the job's status is `finished` and its report outcome is `completed`. Check the intended worker, execution `none` and the exact `SMOKE` value from `first-job.json`. A chat answer without the matching bridge report is not completion. After reviewing the report, run `dalan decide REQUEST_ID accepted`. Stop after this one job; repository work and recurring runs need their own setup.
|
|
105
|
+
|
|
106
|
+
## 5. Limits and owner acceptance record
|
|
107
|
+
|
|
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.
|
|
109
|
+
|
|
110
|
+
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
|
+
|
|
112
|
+
If a gate fails, report the exact step, sanitized error and next observation to the submitting owner. Leave schedules off, do not create another job to hide the failure, and use the owner's existing teardown plan for any authorized trial exposure. This page authorizes no login, settings, subscription, permission or host-network change.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Claude cloud worker: manual first connection
|
|
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.
|
|
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.
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
## 1. Check features and the existing bridge
|
|
10
|
+
|
|
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
|
+
- 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.
|
|
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
|
+
- 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
|
+
|
|
17
|
+
## 2. Allow the sourced callback, then choose registration
|
|
18
|
+
|
|
19
|
+
Anthropic documents this exact callback for hosted Claude surfaces:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
https://claude.ai/api/mcp/auth_callback
|
|
23
|
+
```
|
|
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)
|
|
26
|
+
|
|
27
|
+
On the bridge host, **before registration**:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
dalan connect allow-callback 'https://claude.ai/api/mcp/auth_callback'
|
|
31
|
+
dalan connect start --worker NAME
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
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
|
+
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
|
+
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
|
+
|
|
40
|
+
## 3. Add, pair and inspect the connector
|
|
41
|
+
|
|
42
|
+
For the documented individual-account path, open **Customize → Connectors**, use **+ Add**, then **Add custom connector**. Enter the name and exact resource URL, review detected authentication, and choose OAuth sign-in plus automatic registration. Managed workspaces follow the owner/member steps in the same source rather than this individual's path. [Official setup](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp)
|
|
43
|
+
|
|
44
|
+
If the screen differs, record the current labels and the role and access outcome before you proceed.
|
|
45
|
+
|
|
46
|
+
In the browser flow you initiated, wait for the bridge's pairing code. On the owner host:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dalan connect pending
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Compare the browser and local codes exactly. Check the requested worker, full callback, resource, scopes and client ID. The client name and `claude.ai` hostname alone cannot identify the initiating account. Approve only the matching code within the 10-minute pairing window:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
dalan connect approve CODE --worker NAME
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
These are bridge requirements. A code mismatch, expired window or unexpected callback/scope means stop, not auto-approve. The `as_registration_refused` DCR-refusal log records no callback details; never reconstruct an allowlist entry from it. [Bridge pairing requirements](https://github.com/tnunamak/dalan/blob/main/scripts/live-trial/README.md#4-pair-fixture-a-and-allow-its-callback)
|
|
59
|
+
|
|
60
|
+
Anthropic's test guide says to verify connected state, review **Tool permissions**, then enable the connector from **+ → Connectors** in a chat and confirm an actual tool call. [Test guide](https://claude.com/docs/connectors/building/testing#test-in-claude-as-a-custom-connector)
|
|
61
|
+
|
|
62
|
+
For this smoke, require `list_pending`, `get`, `claim`, `progress` and `finish`; `ack_message` is only for messages. With global T3 tools disabled, the process-wide catalog omits `t3_thread_*` and still advertises `notify_owner`; the worker's missing `t3` capability must make a direct `notify_owner` call fail. Advertised names do not grant authority. Repository tools may depend on existing host configuration, but are unnecessary and must not be called for the execution-none job. Verify the actual `claim` schema, including optional `acquisition_id`, instead of importing ChatGPT's refresh behavior. Missing tools or excess privileges are owner blockers; do not expand policy.
|
|
63
|
+
|
|
64
|
+
## 4. One owner-submitted text smoke
|
|
65
|
+
|
|
66
|
+
Only after the owner authorizes a real trial, create the assignment locally. This generates a unique request ID and harmless nonce; it does not submit anything:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
node --input-type=module > first-job.json <<'NODE'
|
|
70
|
+
import { randomUUID } from 'node:crypto';
|
|
71
|
+
const nonce = randomUUID();
|
|
72
|
+
console.log(JSON.stringify({
|
|
73
|
+
schema_version: 1,
|
|
74
|
+
request_id: `req_${randomUUID()}`,
|
|
75
|
+
brief: `Text-only bridge smoke. Return exactly SMOKE ${nonce}. Do not access repositories, run checks, start other jobs, or change any state outside this assignment's claim/progress/finish lifecycle.`,
|
|
76
|
+
inputs: [],
|
|
77
|
+
scope_paths: [],
|
|
78
|
+
execution_scope: 'read-only',
|
|
79
|
+
expected_output: `A completed text report containing exactly SMOKE ${nonce}.`
|
|
80
|
+
}, null, 2));
|
|
81
|
+
NODE
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The distinction matters: **`execution_scope` is `read-only`; executor selection is separately `--execution none`**, not `execution_scope: "none"`. No repository input or repository grant is required. The owner submits to the existing selected profile with quiet delivery (the default):
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
dalan submit --worker NAME --execution none --file first-job.json
|
|
88
|
+
dalan get REQUEST_ID --json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use the `request_id` from the submit response for `REQUEST_ID`. Save the JSON and that ID; if the response is lost, retry the identical file/ID, not a new job. Confirm `execution` is `none` and the intended target worker before continuing.
|
|
92
|
+
|
|
93
|
+
Manually ask the already authorized cloud conversation to do exactly this (replace `REQUEST_ID` with the confirmed ID and explicitly select the connected bridge):
|
|
94
|
+
|
|
95
|
+
> Check the bridge once for REQUEST_ID only. Read it with get and stop if cancelled, revoked, mismatched or outside this text-only scope. Use list_pending to locate it. Before claiming, generate and privately save one random acquisition_id for this run. Never print this claim nonce (acquisition_id), even in diagnostics, examples or reports. Keep it in private saved run state and reuse it only for this acquisition. Use your stable claimant and that same acquisition_id on every claim retry. Save only the claim_id directly returned by your claim; do not borrow a grant from get. Read owner notes, send progress, echo the assigned nonce through a completed text finish using the current tool schema, then stop. Do not claim another job, call repository/check tools, create a Work/Codex task, invoke a model API, or add a schedule.
|
|
96
|
+
|
|
97
|
+
Use the connector you enabled in the intended Claude chat. Push delivery and scheduled wake are not assumed. A blocker must go through `progress` to the submitting owner, not to an unrelated person.
|
|
98
|
+
|
|
99
|
+
After the worker finishes, the owner reads the bridge record, not just the chat reply:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
dalan get REQUEST_ID --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Confirm that the job's status is `finished` and its report outcome is `completed`. Check the intended worker, execution `none` and the exact `SMOKE` value from `first-job.json`. A chat answer without the matching bridge report is not completion. After reviewing the report, run `dalan decide REQUEST_ID accepted`. Stop after this one job; repository work and recurring runs need their own setup.
|
|
106
|
+
|
|
107
|
+
## 5. Limits and owner acceptance record
|
|
108
|
+
|
|
109
|
+
Record a redacted date/account-feature/bridge-commit ledger: worker profile, public-surface outcomes, official callback source and actual match, DCR selection, exact pairing-code comparison outcome, displayed catalog/schema, request ID, manual trigger, claim/finish result and owner `get`. Keep resource URLs (they contain the secret path), codes, credentials and claim/acquisition IDs out of shared evidence.
|
|
110
|
+
|
|
111
|
+
Acceptance requires the intended account and computer to pass every check. This recipe covers manual jobs with automatic registration. Other registration methods, long-lived token refresh, hosted background execution, automatic wake and schedules need separate setup instructions.
|
|
112
|
+
|
|
113
|
+
If a gate fails, send the exact failed step, sanitized error and required next observation to the submitting owner. Do not start a replacement job or change the profile to hide the failure. Keep recurring triggers disabled and use the owner's teardown plan for any authorized trial exposure. This recipe grants no authority for account, permission, subscription or host-network changes.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Send a job from Codex CLI to Muse Spark
|
|
2
|
+
|
|
3
|
+
Codex CLI submits a job through a local `dalan mcp` process. Muse Spark, Meta's hosted chat client, connects to the bridge over HTTPS and returns a report. You read it and record an accept or reject decision. The bridge queues work; you start the worker in Muse Spark.
|
|
4
|
+
|
|
5
|
+
## What you need
|
|
6
|
+
|
|
7
|
+
- Linux with systemd user services, or macOS with launchd.
|
|
8
|
+
- Node.js 24 or newer and npm.
|
|
9
|
+
- Codex CLI installed and signed in on the bridge computer.
|
|
10
|
+
- A Muse Spark account with remote MCP connections and tool calls available.
|
|
11
|
+
- A public HTTPS address that Muse Spark can reach. This guide creates one with Tailscale Funnel. 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.
|
|
12
|
+
- A free local port, here `8799`, and a new, short bridge-home path on local disk.
|
|
13
|
+
|
|
14
|
+
Funnel makes the bridge reachable from the public internet. Its HTTPS certificate publishes the machine and tailnet DNS names in a public certificate ledger. Keep the full MCP URL private: its path contains a secret. Your Codex and Muse Spark accounts retain their own usage limits and charges.
|
|
15
|
+
|
|
16
|
+
This first job uses no repository and runs no checks. Use a dedicated worker named `muse`. Do not reuse another worker's connection.
|
|
17
|
+
|
|
18
|
+
## 1. Start and expose the bridge
|
|
19
|
+
|
|
20
|
+
On the bridge computer, install Dalan:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install -g @tnunamak/dalan
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Create and start the service. The example home must not already exist. If the port is occupied, choose another free port.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
node "$(npm root -g)/@tnunamak/dalan/scripts/worker-bridge-setup.mjs" \
|
|
30
|
+
--worker muse --port 8799 --home "$HOME/.local/share/dalan-muse" \
|
|
31
|
+
--expose tailscale --no-repo-tools --start
|
|
32
|
+
export DALAN_HOME="$HOME/.local/share/dalan-muse"
|
|
33
|
+
dalan status --json
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
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.
|
|
39
|
+
|
|
40
|
+
**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 Spark has finished a job.
|
|
41
|
+
|
|
42
|
+
## 2. Connect Muse Spark as the worker
|
|
43
|
+
|
|
44
|
+
The bridge ships this exact Meta callback in its default allow-list:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
https://agent.meta.ai/api/hatch/oauth/callback
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Start a pairing window:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dalan connect start --worker muse
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
In Muse Spark, add a remote MCP server with the complete URL from `resource-url`. Start its OAuth sign-in and leave the Dalan sign-in page open. These are general actions, not names of Muse Spark controls.
|
|
57
|
+
|
|
58
|
+
On the bridge computer:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
dalan connect pending
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Compare the code with the one in your browser. Check that the worker is `muse`, the redirect is the Meta 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.
|
|
65
|
+
|
|
66
|
+
Replace `CODE` with your matching pending code:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
dalan connect approve CODE --worker muse
|
|
70
|
+
dalan connect list
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Complete the sign-in in the browser and return to Muse Spark. Do not add `--replace` to resolve a conflict casually: it transfers this worker's queued and future jobs to the new connection.
|
|
74
|
+
|
|
75
|
+
**Check:** approval prints `Approved "CODE" for worker "muse".` with your actual code. The connection list contains worker `muse` with `revoked_at: null`. Ask Muse Spark to list pending Dalan jobs; a successful reply, even an empty list, confirms tool access.
|
|
76
|
+
|
|
77
|
+
## 3. Add the local requester to Codex
|
|
78
|
+
|
|
79
|
+
Codex uses standard input and output, not the public worker URL. Find the installed executable in the owner shell:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
command -v dalan
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Add this entry to `~/.codex/config.toml`. Replace both paths with absolute paths from your computer. Do not leave `~` or `$HOME` in the example values.
|
|
86
|
+
|
|
87
|
+
```toml
|
|
88
|
+
[mcp_servers.dalan]
|
|
89
|
+
command = "/absolute/path/to/dalan"
|
|
90
|
+
args = ["mcp"]
|
|
91
|
+
env = { DALAN_HOME = "/absolute/path/to/.local/share/dalan-muse" }
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
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.
|
|
95
|
+
|
|
96
|
+
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.
|
|
97
|
+
|
|
98
|
+
**Check:** Codex exposes `dalan_submit`, `dalan_wait`, `dalan_result` and `dalan_status`. The status call returns your bridge's JSON status rather than a connection error.
|
|
99
|
+
|
|
100
|
+
## 4. Send one small job and read the result
|
|
101
|
+
|
|
102
|
+
Ask Codex to call `dalan_submit` with this object. Replace the request ID with a fresh `req_` plus UUID for each new job; keep the same ID when retrying that same submission.
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"worker": "muse",
|
|
107
|
+
"execution": "none",
|
|
108
|
+
"assignment": {
|
|
109
|
+
"schema_version": 1,
|
|
110
|
+
"request_id": "req_REPLACE_WITH_NEW_UUID",
|
|
111
|
+
"brief": "Write one sentence explaining why a finished job still needs owner review. Do not read files, run commands or call external services other than Dalan job tools.",
|
|
112
|
+
"inputs": [],
|
|
113
|
+
"expected_output": "One plain-text sentence.",
|
|
114
|
+
"execution_scope": "read-only"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Read the returned verdict and request ID. If the tool returns an error with reasons, fix the submission before proceeding. A queued job does not launch Muse Spark. In your Muse Spark conversation, send this instruction with the returned ID:
|
|
120
|
+
|
|
121
|
+
> Request REQUEST_ID is your only job: claim it with Dalan, do what its brief asks, report progress and finish it with the claim_id. Stop if it is missing or cancelled. Claim no other job.
|
|
122
|
+
|
|
123
|
+
Allow the job tool calls in Muse Spark. Back in Codex, ask it to call `dalan_wait` with `{"request_id":"REQUEST_ID","timeout_seconds":120}`, then `dalan_result` with `{"request_id":"REQUEST_ID"}`.
|
|
124
|
+
|
|
125
|
+
A wait can stop for a question, blocker or cancellation as well as a result. Read the state. If it reports `timeout`, the job remains open; inspect it and wait again. The local tool defaults to 120 seconds and caps each wait at 300 seconds. This route defaults to no external result delivery, so read the result here.
|
|
126
|
+
|
|
127
|
+
**Check:** `dalan_result` returns `status: "finished"` and a report containing the sentence. Read the report's outcome and content; a finished state alone does not establish success or acceptance.
|
|
128
|
+
|
|
129
|
+
## 5. Accept or reject the result
|
|
130
|
+
|
|
131
|
+
The local MCP server has no decision tool. In your owner shell, with the same `DALAN_HOME`, replace `REQUEST_ID` and choose one command.
|
|
132
|
+
|
|
133
|
+
Accept a satisfactory answer:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
dalan decide REQUEST_ID accepted --json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Reject an answer that is not useful:
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
dalan decide REQUEST_ID not_useful --json
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Do not use `rejected`: it is not a supported decision word. This records your review; it does not apply a patch or merge code.
|
|
146
|
+
|
|
147
|
+
**Check:** the command succeeds and returns the recorded decision in its JSON response.
|
|
148
|
+
|
|
149
|
+
## Troubleshooting
|
|
150
|
+
|
|
151
|
+
- **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.
|
|
152
|
+
- **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 Spark, and compare the new code with `dalan connect pending`.
|
|
153
|
+
- **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 Spark'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.
|
|
154
|
+
- **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.
|
|
155
|
+
- **Approval says the worker already has an active connection.** Inspect `dalan connect list`. Continue with the existing intended Muse Spark connection, or deliberately revoke it before pairing again. Do not approve a different client just because it calls itself Muse Spark.
|
|
156
|
+
|
|
157
|
+
## Removal
|
|
158
|
+
|
|
159
|
+
First disconnect the worker while the bridge is running:
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
dalan connect revoke muse
|
|
163
|
+
dalan connect stop
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Remove the remote MCP server from Muse Spark. Remove only the `mcp_servers.dalan` entry you added to Codex's configuration and start a new Codex session.
|
|
167
|
+
|
|
168
|
+
To remove this dedicated service and its recorded Funnel exposure:
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
node "$(npm root -g)/@tnunamak/dalan/scripts/worker-bridge-setup.mjs" \
|
|
172
|
+
--remove --worker muse --home "$HOME/.local/share/dalan-muse"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
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.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Connect ChatGPT as a Dalan worker
|
|
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.
|
|
4
|
+
|
|
5
|
+
**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
|
+
|
|
7
|
+
## Owner setup
|
|
8
|
+
|
|
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`.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
dalan status --json
|
|
13
|
+
```
|
|
14
|
+
|
|
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.
|
|
16
|
+
|
|
17
|
+
2. Open a pairing window for that worker.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
dalan connect start --worker NAME
|
|
21
|
+
```
|
|
22
|
+
|
|
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.
|
|
33
|
+
|
|
34
|
+
## ChatGPT user setup
|
|
35
|
+
|
|
36
|
+
1. In ChatGPT web, enable custom connector creation. Open **Settings → Apps → Advanced → Developer mode**. Then open **Plugins → Create**, enter a connection name and the owner's complete MCP URL, and select **OAuth** authentication. If the UI instead shows **Plugins → plus → Add custom MCP server**, follow [worker onboarding section 3](chatgpt-worker-onboarding.md#3-add-pair-and-inspect-the-connector); the pairing and code-match checks are the same.
|
|
37
|
+
|
|
38
|
+
Let ChatGPT discover the OAuth settings and select its offered Dynamic Client Registration, which registers this client with Dalan. Review the risk acknowledgement and choose **Create**. Do not enter static client credentials. A browser page should show a pairing code; keep it open.
|
|
39
|
+
|
|
40
|
+
2. Ask the owner to inspect the exact pending attempt on the bridge computer.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
dalan connect pending
|
|
44
|
+
```
|
|
45
|
+
|
|
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.
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dalan connect approve CODE --worker NAME
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The owner replaces `CODE` with the matched code. Approval should let the waiting browser return to ChatGPT. A saved connector is not yet proof of a working job.
|
|
53
|
+
|
|
54
|
+
3. As requester, save the [first-job JSON](manual-setup.md#submit-finish-and-read-the-result) from the manual setup with a new request ID, then submit it to this worker.
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
dalan submit --worker NAME --execution none --deliver none --file first-job.json --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The response contains that request ID. In a new ChatGPT conversation, use **+** to attach the connector. Send the manual setup's worker prompt with this request ID. Submission alone does not start ChatGPT.
|
|
61
|
+
|
|
62
|
+
After you start the worker, run wait and get in the requester shell.
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
dalan wait REQUEST_ID
|
|
66
|
+
dalan get REQUEST_ID
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Success is a finished report containing `bridge first report`. Read the report. If you accept it, record that decision.
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
dalan decide REQUEST_ID accepted
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## When connection fails
|
|
76
|
+
|
|
77
|
+
If ChatGPT says “Couldn't discover OAuth settings” or “Some app settings were rejected,” first check that the bridge is running (`dalan status --json` in the service's Home) and that ChatGPT has the complete HTTPS MCP URL, then inspect the discovery, registration, tunnel and TLS stages rather than assuming a single cause. Do not change authentication to get past the error. OpenAI does not document a universal port requirement for public custom MCP endpoints. See its [connection guide](https://developers.openai.com/plugins/deploy/connect-chatgpt) and [OAuth guide](https://developers.openai.com/plugins/build/auth).
|
|
78
|
+
|
|
79
|
+
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
|
+
|
|
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.
|
|
82
|
+
|
|
83
|
+
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.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Worker connection longevity
|
|
2
|
+
|
|
3
|
+
A worker’s OAuth token, refresh token and event subscription have separate lifetimes. Dalan does not hold or refresh the worker client’s token. The client must refresh its credentials and renew a finite Events subscription before its advertised `refreshBefore` deadline.
|
|
4
|
+
|
|
5
|
+
For an external issuer, inspect its access-token lifetime, parent session limits, refresh-token reuse policy and offline-session limits. A client-session timeout cannot necessarily extend the parent session. If you enable offline access, verify the issuer’s idle and maximum lifetimes and the client’s refresh behavior. Do not copy another deployment’s scope mappings, and do not treat a working subscription as proof that token refresh works.
|
|
6
|
+
|
|
7
|
+
The bridge defaults Events subscriptions to seven days and returns an expiration in `refreshBefore`. Its monitoring reports missing or expiring subscriptions. A manual or scheduled pull worker can operate without an Events subscription; assess health against the worker mode you configured. See [pull workers](pull-workers.md).
|
|
8
|
+
|
|
9
|
+
The legacy `dot-bridge-selfcheck.timer` example and `scripts/daily-selfcheck.mjs` are deployment-specific, so review their repository and subscription assumptions before you use them. Set `DALAN_GITHUB_REPOSITORY` and `DALAN_SELFCHECK_REPOSITORY_ID` (the numeric GitHub repository ID pinned to this installation) in the service environment, for example with a systemd drop-in, before enabling it. The check reads the public resource and the issuer from the bridge's own OAuth file (`oauth.env`, which must be mode 0600 or it is treated as unavailable), and the TLS host defaults to the resource hostname, so no endpoint environment variables are needed (the repository settings above stay required). `DALAN_SELFCHECK_RESOURCE` and `DALAN_SELFCHECK_ISSUER` override the file; an explicit `DALAN_SELFCHECK_TLS_HOST` must equal the resource hostname or the check fails. An alert is sent once per distinct set of failures: a repeated identical failure still exits 1 but sends no new alert until the set changes.
|
|
10
|
+
|
|
11
|
+
## MCP failure diagnostics
|
|
12
|
+
|
|
13
|
+
After deployment, `~/.local/state/dalan/requests.jsonl` records `mcp_received` before authentication and one `mcp_outcome` when each HTTP response finishes or closes early. A generated `call_id` joins those records to `mcp_inbound`, which still means authentication and request parsing succeeded. A received call with no outcome can indicate a process exit. These MCP records omit URLs, tokens, subjects, client-provided names, RPC IDs, arguments, file paths, contents and exception messages; the one exception is `tool_error_message` on a failed tool call, the bridge's error text redacted like alert notes and cut to 300 characters. Declared methods and tools are retained; undeclared names are logged as `unknown`. Old records are not rewritten. A refused sign-in has an `mcp_outcome` with `http_status` 401 and an `auth_reason`: `missing_bearer`, `invalid_token`, `unsupported_signature`, `invalid_signature`, `jwks_unavailable`, `signing_key_unavailable`, `wrong_issuer`, `wrong_audience`, `malformed_claims`, `expired`, `not_yet_valid`, `unknown_subject`, `invalid_scope`, or for built-in sign-in `connection_inactive`. A request to a path that is not the MCP path logs `mcp_inbound` with `status` 404, `route` `other`, `http_method`, `path_shape` and `auth_header_present`. `path_shape` keeps only the names of public routes (`mcp`, `.well-known`, `oauth-protected-resource`, and similar) and replaces every other segment, including the secret path and any token in a wrong URL, with its length. A client with no `mcp_received` line at all never reached the MCP path.
|
|
14
|
+
|
|
15
|
+
Outcome fields include tool, HTTP status, JSON-RPC error code, tool `isError`, duration, response bytes, completion (`finished` or `closed`), request phase, and fixed authentication/JWKS reasons, timing and fetch status. `pending` auth/JWKS outcomes with null timing mean the connection closed while verification was still running. `http_status: null` means no headers were sent; it must not be treated as HTTP 200. `response_bytes` is the serialized JSON body size prepared by the bridge, excluding HTTP headers. A closed response may not have delivered all those bytes. `finished` means Node handed the response to its transport; it does not prove ChatGPT accepted it. A pre-auth or incomplete-body failure has no tool name. Authentication is logged separately from tool scope rejection, which remains an HTTP 200 MCP tool error with the authentication challenge in `_meta`.
|
|
16
|
+
|
|
17
|
+
For an intermittent failure, correlate progress timestamps with `mcp_outcome` and reverse-proxy access entries. Check authentication failures first, then closed responses and their phase, then JSON-RPC or tool errors and response sizes.
|
|
18
|
+
|
|
19
|
+
## Liveness classes and alerts
|
|
20
|
+
|
|
21
|
+
The bridge reports observations and labels, not diagnoses. `dalan status --json` adds `claimed_outer_count`, `max_claimed_outer_assignments`, `oldest_claim_age_ms`, `oldest_claim_progress_age_ms`, `last_worker_call_at`, `last_list_pending_at`, `oldest_unclaimed_event_2xx_age_ms`, `queue_classes` and `stale_claims`. Queued work after its first event 2xx is labelled:
|
|
22
|
+
|
|
23
|
+
| Class | Meaning | Default threshold (limits.json key) |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| `pause_suspected` | no worker tool call and silence at least the threshold; cause unconfirmed | 20 min (`pause_suspected_silence_ms`) |
|
|
26
|
+
| `at_capacity_healthy` | every active worker subscriber has no free lane after counting shared worker claims and its principal's historical subject claims for that worker, and the newest activity on at least one claim is within that claim’s stored lease; waiting is expected | 60 min by default (`claim_lease_ms` sets the maximum) |
|
|
27
|
+
| `stale_claims` | claim past its persisted lease deadline, the deadline the sweep uses (`lease_expires_at`); `get` does not extend it | per grant (60 min by default) |
|
|
28
|
+
| `alive_not_claiming` | the worker called tools recently, slots free, item still queued after 2x the interval | interval 10 min (`assignment_reannounce_interval_ms`) |
|
|
29
|
+
| `transport_failing` | no event for the item ever got a 2xx; separate path, no re-announce | 20 min (`pause_suspected_silence_ms`) |
|
|
30
|
+
|
|
31
|
+
**Recover a claim.** Run `dalan claims` to inspect active grants. Automatic abandonment happens after the persisted lease expires; a usage break does not extend it. Regrant still requires verified host stop and resolved delivery/admission gates. `dalan abandon ID` needs the operator key and does not shorten the old deadline or prove that remote compute stopped. See [Claims and leases](operations.md#claims-and-leases).
|
|
32
|
+
|
|
33
|
+
**After a restart.** A claim last touched before startup is not swept until startup plus that claim's own lease duration. A claim touched since startup gets no restart grace. The first maintenance tick after the applicable deadline performs the sweep. Native protocol claims require explicit `renew_claim`; ordinary activity does not extend their fixed deadline.
|
|
34
|
+
|
|
35
|
+
**Queued work.** Preparation expiry and default-worker skip expiry continue during pause or a usage break. The PR-head reviewer cancels work for merged or closed PRs. See [Jobs the worker never takes](pull-workers.md#jobs-the-worker-never-takes) and [PR-head reviewer](pr-head-reviewer.md).
|
|
36
|
+
|
|
37
|
+
**Alerts and wake-ups.** The liveness classes above are observations, not proof of a cause. Attention alerts require 30 continuous observed minutes before publication; a recovery notice follows only an alert that was sent. `denial_mentioned` is log-only. Queue re-wakes are normally limited to one event per subscription every 90 seconds, with older work backing off after two hours. Pause, full capacity, inactive subscriptions and unresolved delivery can suppress them. For exact eligibility, settings and terminal transport behavior, see [Lifecycle events and metrics](operations.md#lifecycle-events-and-metrics).
|
|
38
|
+
|
|
39
|
+
## Change and rollback
|
|
40
|
+
|
|
41
|
+
Back up configuration and state before changing issuer mappings or service settings. Record the original values and restore only the changed mappings if a test fails; restoring an entire identity-provider database would also erase unrelated later changes. Test a full worker login, job completion and token refresh after any authentication change. Follow [operations](operations.md#upgrade-and-rollback) for bridge rollback, preserving existing unit names and data roots.
|
|
42
|
+
|
|
43
|
+
Self-check metadata discovery inserts `/.well-known/oauth-protected-resource` before the resource path: `https://h/api` uses `https://h/.well-known/oauth-protected-resource/api`; a root resource uses `https://h/.well-known/oauth-protected-resource`. The metadata `resource` must equal the configured `DALAN_SELFCHECK_RESOURCE` exactly, as RFC 9728 section 3.3 requires; an origin-only value does not match a path resource, and a root resource must be spelled as the server publishes it (with or without the trailing slash). Metadata and JWKS probes reject redirects without following them and identify the failing setting without disclosing the redirect URL.
|