@tnunamak/dalan 0.6.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/PROTOCOL.md +2 -0
  4. package/README.md +81 -84
  5. package/bin/dalan.mjs +9 -0
  6. package/bin/dot-worker.mjs +29 -4
  7. package/contracts/adapter-qualification.schema.json +170 -0
  8. package/docs/chatgpt-worker-onboarding.md +10 -14
  9. package/docs/claude-worker-onboarding.md +9 -8
  10. package/docs/codex-to-muse.md +21 -35
  11. package/docs/connect-chatgpt.md +10 -16
  12. package/docs/dalan-upgrade.md +4 -2
  13. package/docs/local-agent-mcp.md +24 -4
  14. package/docs/local-agent-requester.md +46 -0
  15. package/docs/manual-setup.md +2 -2
  16. package/docs/operations.md +12 -13
  17. package/docs/pull-workers.md +1 -2
  18. package/docs/service-setup.md +110 -163
  19. package/docs/setup-reference.md +6 -6
  20. package/docs/t3-question-relationship.md +43 -0
  21. package/docs/t3-reverse-control.md +12 -8
  22. package/docs/t3-wake-fence-r4.md +42 -0
  23. package/docs/test-suite-isolation.md +204 -0
  24. package/docs/worker-clients.md +6 -4
  25. package/package.json +5 -3
  26. package/qualification/README.md +13 -0
  27. package/qualification/mcp.json +121 -0
  28. package/qualification/protocol-v0.json +127 -0
  29. package/scripts/dalan-try-selfcheck.mjs +8 -7
  30. package/scripts/worker-bridge-setup.mjs +91 -81
  31. package/src/admin-socket.mjs +2 -1
  32. package/src/answer-journal.mjs +200 -0
  33. package/src/as-store.mjs +5 -3
  34. package/src/as.mjs +35 -26
  35. package/src/auth-check.mjs +59 -0
  36. package/src/cli-help.mjs +16 -16
  37. package/src/client-approval.mjs +57 -0
  38. package/src/client-convenience.mjs +166 -0
  39. package/src/client-conveniences.json +106 -0
  40. package/src/client-conveniences.schema.json +97 -0
  41. package/src/connect-cli.mjs +5 -5
  42. package/src/default-home.mjs +36 -0
  43. package/src/destinations/index.mjs +6 -0
  44. package/src/destinations/none.mjs +3 -0
  45. package/src/destinations/t3.mjs +63 -6
  46. package/src/execution.mjs +20 -2
  47. package/src/follow-current.mjs +27 -0
  48. package/src/gozar-routes.mjs +315 -0
  49. package/src/host-budget.mjs +17 -11
  50. package/src/host-execution-policy.mjs +2 -2
  51. package/src/host-stop-reverify.mjs +6 -4
  52. package/src/integrator.mjs +3 -1
  53. package/src/redirect-policy.mjs +61 -0
  54. package/src/route-setting.mjs +71 -12
  55. package/src/server.mjs +64 -12
  56. package/src/service-auto-update.mjs +8 -1
  57. package/src/service-launchd.mjs +186 -0
  58. package/src/service-migrate-workers.mjs +12 -2
  59. package/src/service-update-runtime.mjs +40 -6
  60. package/src/service-update.mjs +20 -14
  61. package/src/service.mjs +211 -63
  62. package/src/setup.mjs +55 -44
  63. package/src/store.mjs +77 -14
  64. package/src/submission-policy.mjs +8 -4
  65. package/src/t3.mjs +21 -2
  66. package/src/tool-registry.mjs +54 -8
  67. package/src/try-exposure.mjs +7 -657
  68. package/src/try-hosted.mjs +71 -101
  69. package/src/try-selfcheck.mjs +15 -8
  70. package/src/try.mjs +9 -13
  71. package/src/workers.mjs +4 -3
  72. package/src/workspace.mjs +94 -15
  73. package/scripts/lib/expose-tailscale.mjs +0 -408
  74. package/src/try-hosted-clients.mjs +0 -46
@@ -1,4 +1,4 @@
1
- // `dalan try --public`: the same trial, reached by a hosted MCP client (for example ChatGPT or claude.ai). It starts a public route, a bridge whose
1
+ // `dalan try --public`: the same trial, reached by a hosted MCP client. It starts a public route, a bridge whose
2
2
  // OAuth issuer is that route's address, queues one demo job, prints the connector URL and the clicks, asks the owner to approve the
3
3
  // sign-in, and calls the trial a success only when the hosted client finishes that job. The local flow in try.mjs is unchanged.
4
4
  import { execFile, spawn } from 'node:child_process';
@@ -13,19 +13,28 @@ import { createLineMasker, safeDiagnostic } from './diagnostic.mjs';
13
13
  import { registerSecret } from './redaction.mjs';
14
14
  import { defaultPath } from './paths.mjs';
15
15
  import { PAIRING_MINUTES } from './as-files.mjs';
16
- import { CLIENTS, CONNECTOR_NAME, callbackAllowed, handoffText, hostedPrompt } from './try-hosted-clients.mjs';
17
- import { PUBLIC_READY_MS, createGate, gozarProvider, localhostRunProvider, selectRouteProvider, startRoute, tailscaleNodeProvider, tailscaleProvider, verifyPublicReady, watchPublicIdentity } from './try-exposure.mjs';
16
+ import { createGate, verifyPublicReady, watchPublicIdentity } from './try-exposure.mjs';
17
+ import { RouteError, resolveRouteWord, buildQuery, describeCandidate, describeDisclosure, ensureDurableRoute, explainRouteError, gozarHomeFor, resolveGozar, startSessionRoute } from './gozar-routes.mjs';
18
18
  import { readRouteSetting } from './route-setting.mjs';
19
19
  import { childRegistry, registerChild, sweepChildren } from './child-registry.mjs';
20
20
 
21
21
  const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
22
22
  const HOSTED_WORKER = 'hosted';
23
+ const PUBLIC_READY_MS = 60_000;
24
+ export const CONNECTOR_NAME = 'Dalan Trial';
25
+ const STEPS = [
26
+ 'In your MCP client, add a custom MCP server (a custom connector).',
27
+ `Name it "${CONNECTOR_NAME}", paste the URL above, choose OAuth (automatic client registration if asked) and create it.`,
28
+ `Open a chat, enable "${CONNECTOR_NAME}", start sign-in, and approve the matching code in this terminal.`,
29
+ ];
30
+ export const hostedPrompt = (requestId, requestPhrase) =>
31
+ `Use ${CONNECTOR_NAME} to list pending jobs, claim only ${requestId}, read its brief, and finish it with the requested report (${requestPhrase}). Stop if the job is missing or cancelled. Do not read files, run commands, or call other services.`;
32
+ // `url` is a credential, so the caller writes this text to the owner's terminal only, never to a log.
33
+ export const handoffText = ({ url }) => [`Connector name: ${CONNECTOR_NAME}`, 'Paste this URL into your connector (it is a secret; it stays on this terminal and in the private resource-url file):', url, '', ...STEPS.map((step, i) => `${i + 1}. ${step}`)].map(line => terminalSafe(line)).join('\n');
23
34
  // Files that hold a credential of a finished trial. The job history stays.
24
35
  // A home that a restart reuses keeps the bridge's own config (its path secret); the others lose it.
25
- export function removeTrialSecrets(home, configDir, { keepConfig = false, keepNode = false } = {}) {
36
+ export function removeTrialSecrets(home, configDir, { keepConfig = false } = {}) {
26
37
  for (const file of [path.join(home, 'resource-url'), ...(keepConfig ? [] : [path.join(configDir, 'env')])]) fs.rmSync(file, { force: true });
27
- fs.rmSync(path.join(home, 'localhost-run'), { recursive: true, force: true });
28
- if (!keepNode) fs.rmSync(path.join(home, 'tsnode'), { recursive: true, force: true }); // else a child still holds files there: the next sweep removes them
29
38
  }
30
39
  const REPORT = 'bridge first report';
31
40
 
@@ -52,11 +61,11 @@ export function acquireHomeLock(home) {
52
61
  }
53
62
 
54
63
  // Said once, before any public address exists. Setup chooses a route; it does not install a service.
55
- export const TRIAL_NOTICE = 'Temporary demo link. It can change or stop without warning. Run dalan setup to choose Tailscale when available, or keep using temporary Gozar links. Setup does not install a background service.';
64
+ export const TRIAL_NOTICE = 'Temporary demo link. It can change or stop without warning. Run `dalan setup` to choose a stable route. Setup does not install a background service.';
56
65
  // A trial's maximum local lifetime is a shutdown limit, not a promise that a public route will stay available.
57
66
  export const TRIAL_MS = 3 * 60 * 60 * 1000;
58
67
  export const timeLeft = ms => { const minutes = Math.max(0, Math.ceil(ms / 60_000)); return minutes >= 60 ? `${Math.floor(minutes / 60)} h ${String(minutes % 60).padStart(2, '0')} min` : `${minutes} min`; };
59
- export const REAL_NOTICE = fromSetup => `Using Tailscale${fromSetup ? ', the address you saved with `dalan setup`' : ''}. This is not a trial link.`;
68
+ export const REAL_NOTICE = fromSetup => `Using a stable route${fromSetup ? ', the address you saved with `dalan setup`' : ''}. This is not a trial link.`;
60
69
 
61
70
  // Reads answers from one terminal reader and closes it, so the trial's own reader starts clean.
62
71
  export async function chooseMode({ input, out, signal }) {
@@ -79,55 +88,24 @@ export async function chooseMode({ input, out, signal }) {
79
88
  }
80
89
  };
81
90
  try {
82
- out.write(`Where will your worker run?\n 1. A hosted MCP client (for example ChatGPT or claude.ai)\n 2. Only on this computer\n`);
91
+ out.write(`Where will your worker run?\n 1. A hosted MCP client\n 2. Only on this computer\n`);
83
92
  const where = await pick('Choose [1]: ', 2);
84
- if (where === null) return { mode: 'local' };
85
- if (where === 2) return { mode: 'local' };
86
- out.write('Which client?\n 1. ChatGPT\n 2. claude.ai\n');
87
- const which = await pick('Choose [1]: ', 2);
88
- return which === null ? { mode: 'local' } : { mode: 'public', client: which === 2 ? 'claude' : 'chatgpt' };
93
+ return where === 1 ? { mode: 'public' } : { mode: 'local' };
89
94
  } finally { lines.close(); }
90
95
  }
91
96
 
92
- export function defaultProviders({ env, say, client, hostedDeps = {} }) {
93
- return [gozarProvider({ env, ...hostedDeps.gozar }), localhostRunProvider({ env, ...hostedDeps.localhostRun }), tailscaleProvider({ env, ...hostedDeps.tailscale }), tailscaleNodeProvider({ env, ...hostedDeps.tailscaleNode })];
94
- }
95
-
96
- // The restart command keeps a stable Tailscale home and gives each temporary route a new home.
97
- const STABLE_ORIGIN_ROUTES = new Set(['tailscale']);
98
- export const restartCommand = ({ cli, home, freshHome, shellQuote, client, route, provider }) => `${cli} try --public --client ${client} --route ${route} --home ${shellQuote(STABLE_ORIGIN_ROUTES.has(provider) ? home : freshHome)}`;
97
+ // A stable route keeps its home (and so its sign-in); a temporary route gets a new home each time.
98
+ export const restartCommand = ({ cli, home, freshHome, shellQuote, route, stable }) => `${cli} try --public${route === undefined ? '' : ` --route ${shellQuote(route)}`} --home ${shellQuote(stable ? home : freshHome)}`;
99
99
 
100
100
  export async function runHosted({ options, env, out, input, signal, errorContext, clock = { now: Date.now, sleep }, deps = {}, helpers }) {
101
101
  const { prepareHome, portFree, socketAnswers, choosePort, shellQuote, commandLine, parsePending, describeAttempt, MARKER, DIAGNOSE_AFTER_MS, DIAGNOSE_EVERY_MS, DIAGNOSE_LIMIT, POLL_MS, repo } = helpers;
102
- const client = options.client ?? 'chatgpt';
103
102
  const say = line => out.write(`${terminalSafe(line)}\n`);
104
- const providers = deps.providers ?? defaultProviders({ env, say, client, hostedDeps: deps });
105
- // An explicit route wins. Auto uses a usable Tailscale route first, then the consented Gozar trial relay.
106
- const autoRoute = options.route === undefined || options.route === 'auto';
107
- const saved = autoRoute ? readRouteSetting(env) : null;
108
- const tailscale = providers.find(provider => provider.name === 'tailscale');
109
- // Explicit routes are probed by the selector once; a saved relay needs no Tailscale preflight.
110
- const tailscaleProbe = autoRoute && saved !== 'gozar' && saved !== 'localhost.run' ? tailscale?.probe() : null;
111
- const automaticRoute = saved === 'gozar' || saved === 'localhost.run' ? 'gozar' :
112
- tailscaleProbe?.ok ? 'tailscale' : providers.some(provider => provider.name === 'gozar') ? 'gozar' : 'localhost.run';
113
- const routeChoice = options.route && options.route !== 'auto' ? options.route : automaticRoute;
114
- const realRoute = routeChoice === 'tailscale';
115
- const spec = CLIENTS[client];
103
+ // With no --route, a route saved by `dalan setup` is used as a durable route; an explicit --route name is a session route for this trial.
104
+ const saved = options.route === undefined ? readRouteSetting(env) : null;
105
+ const durable = saved !== null && saved.origin !== null;
116
106
  const realHome = fs.realpathSync(os.homedir());
117
- // Only the host's usable Funnel has a stable identity; its ephemeral fallback needs a new home.
118
- const routeMessages = [];
119
- let selectedProvider, selectionError;
120
- try {
121
- signal?.throwIfAborted();
122
- selectedProvider = autoRoute && routeChoice === 'tailscale' ? tailscale :
123
- selectRouteProvider({ route: routeChoice, providers, say: line => routeMessages.push(line), signal });
124
- if (selectedProvider?.name === 'localhost.run') {
125
- routeMessages.push('localhost.run is a third-party relay that can inspect forwarded traffic.');
126
- }
127
- }
128
- catch (error) { selectionError = error; } // Report startup failures after the home and cleanup context are ready.
129
- const stableHome = selectedProvider?.name === 'tailscale';
130
- const home = prepareHome(options.home ?? env.DALAN_HOME ?? path.join(realHome, '.local/share', stableHome ? `dalan-hosted-${client}` : `dalan-hosted-${randomBytes(3).toString('hex')}`), realHome);
107
+ let stableAddress = durable; // a session route learns its stability from Gozar once it exists
108
+ const home = prepareHome(options.home ?? env.DALAN_HOME ?? path.join(realHome, '.local/share', durable ? 'dalan-hosted' : `dalan-hosted-${randomBytes(3).toString('hex')}`), realHome);
131
109
  errorContext.home = home;
132
110
  const cliPath = errorContext.shellCli ?? shellQuote(path.join(repo, 'bin/dalan.mjs'));
133
111
  const cli = errorContext.cli ?? `node ${cliPath}`;
@@ -135,9 +113,9 @@ export async function runHosted({ options, env, out, input, signal, errorContext
135
113
  const configDir = defaultPath(home, '.config/dot-bridge');
136
114
  const logFile = path.join(home, 'server.log');
137
115
  errorContext.shellHome = shellQuote(home); errorContext.logFile = logFile; errorContext.shellLog = shellQuote(logFile);
138
- errorContext.tryFlags = ` --public --client ${client} --route ${routeChoice}`;
116
+ errorContext.tryFlags = ` --public${options.route === undefined ? '' : ` --route ${shellQuote(options.route)}`}`;
139
117
  const freshRestartHome = path.join(realHome, '.local/share', `dalan-hosted-${randomBytes(3).toString('hex')}`);
140
- const retry = () => commandLine(restartCommand({ cli, home, freshHome: freshRestartHome, shellQuote, client, route: routeChoice, provider: selectedProvider?.name ?? (realRoute ? 'tailscale' : null) }));
118
+ const retry = () => commandLine(restartCommand({ cli, home, freshHome: freshRestartHome, shellQuote, route: options.route, stable: stableAddress }));
141
119
  errorContext.freshTrialCommand = retry().trim();
142
120
 
143
121
  // A bridge or ssh that an earlier trial left behind (its process was killed without cleanup) is ended first; only a recorded, matching process is touched.
@@ -166,7 +144,7 @@ export async function runHosted({ options, env, out, input, signal, errorContext
166
144
  resolveRouteGone();
167
145
  };
168
146
  // The trial's lifetime is a real timer, not a check in the polling loop, so it also ends an unanswered question or a wait after a result.
169
- const trialMs = realRoute ? null : (deps.trialMs ?? TRIAL_MS);
147
+ const trialMs = durable ? null : (deps.trialMs ?? TRIAL_MS);
170
148
  let expired = false, expireTimer = null;
171
149
  const untilStopRequested = () => Promise.race([stopPromise, stopped, routeGone]);
172
150
  const ask = question => {
@@ -218,61 +196,55 @@ export async function runHosted({ options, env, out, input, signal, errorContext
218
196
  return true;
219
197
  };
220
198
 
221
- let gate = null, route = null, routeStopped = null, cleaned = true, keepRecoveredNode = false;
199
+ let gate = null, route = null, routeStopped = null, cleaned = true;
222
200
  let identityWatcher = null;
223
201
  let trialEndsAt = null;
224
202
  let releaseHome;
225
203
  try { releaseHome = acquireHomeLock(home); } catch (error) { lines.close(); throw error; }
226
204
  try {
227
- say(realRoute ? REAL_NOTICE(saved === 'tailscale') : TRIAL_NOTICE);
205
+ say(durable ? REAL_NOTICE(true) : TRIAL_NOTICE);
228
206
  say('Checking public routes…');
229
207
  gate = await createGate();
230
- // A trial that was killed earlier may have left a Tailscale node of its own running; end it before this one starts.
231
- for (const provider of providers) {
232
- const recovery = await provider.recover?.().catch(() => ({ retained: [{ home: null, sock: null }] }));
233
- const ended = Array.isArray(recovery) ? recovery : recovery?.ended;
234
- keepRecoveredNode ||= recovery?.retained?.some(debt => debt.home === home || debt.sock === path.join(home, 'tsnode/tailscaled.sock') || (!debt.home && !debt.sock)) ?? false;
235
- if (ended?.length) say(`Ended ${ended.join(', ')} left by an earlier trial.`);
236
- }
237
208
  signal?.throwIfAborted();
238
- if (selectedProvider?.name === 'gozar') {
239
- say('This public demo uses tunnl.gg, a third-party relay that can inspect forwarded traffic. Gozar creates an installation-specific relay key after your consent; Dalan does not pass your SSH keys. Terms: https://tunnl.gg/terms. Privacy: https://tunnl.gg/privacy. Continue? [y/N]');
240
- const consent = await new Promise(resolve => {
209
+ trialEndsAt = trialMs === null ? null : clock.now() + trialMs;
210
+ // Gozar answers the owner's questions; Dalan only shows what it returned and asks once.
211
+ const consent = async candidate => {
212
+ say(describeCandidate(candidate).join('\n')); say(describeDisclosure(candidate).join('\n')); say('Use this route? [y/N]');
213
+ return new Promise(resolve => {
241
214
  if (inputEnded || signal?.aborted) { resolve(false); return; }
242
- const finish = answer => {
243
- lines.off('line', onLine); lines.off('close', onClose); signal?.removeEventListener('abort', onClose);
244
- resolve(['y', 'yes'].includes(String(answer ?? '').trim().toLowerCase()));
245
- };
215
+ const finish = answer => { lines.off('line', onLine); lines.off('close', onClose); signal?.removeEventListener('abort', onClose); resolve(['y', 'yes'].includes(String(answer ?? '').trim().toLowerCase())); };
246
216
  const onLine = answer => finish(answer);
247
217
  const onClose = () => finish(null);
248
218
  lines.once('line', onLine); lines.once('close', onClose); signal?.addEventListener('abort', onClose, { once: true });
249
219
  });
250
- if (!consent) throw Object.assign(new Error('No public route was started because relay consent was not given.'), { tryKind: 'consent' });
251
- }
252
- trialEndsAt = trialMs === null ? null : clock.now() + trialMs;
220
+ };
253
221
  try {
254
- for (const message of routeMessages) say(message);
255
- if (selectionError) throw selectionError;
256
- route = await startRoute({ selectedProvider, gatePort: gate.port, home, say, signal, ...(trialEndsAt === null ? {} : { lifetimeEndsAt: trialEndsAt }) });
222
+ const gozar = deps.gozar ?? await resolveGozar();
223
+ const wanted = buildQuery({ home: saved?.gozarHome ?? gozarHomeFor(env), target: `127.0.0.1:${gate.port}`, route: options.route ?? saved?.routeName ?? undefined,
224
+ usage: durable ? { kind: 'durable', routeId: saved.routeId } : { kind: 'session', lifetimeMs: trialMs }, ...(durable ? { origin: saved.origin, address: 'stable' } : {}) });
225
+ const { query, pick } = await resolveRouteWord({ gozar, query: wanted });
226
+ if (durable) {
227
+ const view = await ensureDurableRoute({ gozar, query, consent, pick });
228
+ route = { origin: view.origin, exited: null, endedBecause: () => null, stop: async () => ({ removed: true }) }; // an app exit never closes a durable route
229
+ } else route = await startSessionRoute({ gozar, query, consent, signal, wait: 'allocated', pick });
230
+ if (!durable) stableAddress = route.view?.properties?.address?.stability === 'stable';
257
231
  }
258
232
  catch (error) {
259
- routeStopped = error?.routeCleanup ?? routeStopped;
260
- if (error?.tryKind === 'node_retained') {
261
- keepRecoveredNode = true;
262
- error.message += `\nStart a fresh trial with: ${cli} try --public --client ${client} --route ${routeChoice} --home ${shellQuote(path.join(realHome, '.local/share', `dalan-hosted-${randomBytes(3).toString('hex')}`))}`;
263
- }
264
233
  if (error && typeof error === 'object' && !signal?.aborted) {
234
+ if (error.tryKind !== 'consent') {
235
+ const known = explainRouteError(error);
236
+ if (known.code && !(error instanceof RouteError && error.tryKind)) error.message = `${known.line}${known.fix ? `\nNext: ${known.fix}` : ''}`;
237
+ }
265
238
  error.tryKind ??= 'route_start';
266
- // A real route never turns into a trial link without the owner choosing it.
267
- if (realRoute && error instanceof Error) error.message += '\nA Tailscale route never falls back to a trial relay on its own. Fix Tailscale and run again, or choose the Gozar demo route.';
239
+ if (durable && error instanceof Error) error.message += '\nA saved route never falls back to a temporary link on its own. Fix it and run again, or run with --route NAME.';
268
240
  }
269
241
  throw error;
270
242
  }
271
- if (route.exited) route.exited.then(() => markRouteLost(route.endedBecause?.() ?? route.provider.endedBecause?.() ?? 'provider_lost'));
243
+ if (route.exited) route.exited.then(() => markRouteLost(route.endedBecause() ?? 'route_lost'));
272
244
  const origin = route.origin;
273
- say(`Public route ready (${route.provider.name}).`);
245
+ say('Public route ready.');
274
246
  if (storedOrigin && storedOrigin !== origin) {
275
- const error = new Error(`this home was set up for ${storedOrigin}, but the new public address is ${origin}. A new address is a new sign-in identity. Start a fresh trial instead${route.provider.name === 'tailscale-node' ? ` with: ${cli} try --public --client ${client} --route ${routeChoice} --home ${shellQuote(path.join(realHome, '.local/share', `dalan-hosted-${randomBytes(3).toString('hex')}`))}` : ''}`);
247
+ const error = new Error(`this home was set up for ${storedOrigin}, but the new public address is ${origin}. A new address is a new sign-in identity. Start a fresh trial instead with: ${retry().trim()}`);
276
248
  error.tryKind = 'identity';
277
249
  throw error;
278
250
  }
@@ -298,12 +270,12 @@ export async function runHosted({ options, env, out, input, signal, errorContext
298
270
  fs.writeFileSync(urlFile, `${mcpUrl}\n`, { mode: 0o600 });
299
271
  fs.chmodSync(urlFile, 0o600);
300
272
 
301
- gate.open(bindPort, route.provider.name === 'gozar' ? { gozarOrigin: origin } : {});
302
- const ready = await verifyPublicReady({ origin, secret, fetchImpl: deps.fetchImpl ?? fetch, clock, timeoutMs: deps.readyMs ?? PUBLIC_READY_MS[route.provider.name], say, signal });
303
- if (!ready.ready) { if (!signal?.aborted) await route.provider.diagnose?.({ home, say, signal }).catch(() => {}); const error = new Error(`The public route is not ready (${ready.last}); the trial is stopping.`); error.tryKind = 'route'; throw error; }
273
+ gate.open(bindPort, { publicOrigin: origin });
274
+ const ready = await verifyPublicReady({ origin, secret, fetchImpl: deps.fetchImpl ?? fetch, clock, timeoutMs: deps.readyMs ?? PUBLIC_READY_MS, say, signal });
275
+ if (!ready.ready) { const error = new Error(`The public route is not ready (${ready.last}); the trial is stopping.`); error.tryKind = 'route'; throw error; }
304
276
  say("Public HTTPS, OAuth discovery and the authorization server's metadata verified.");
305
277
 
306
- if (!realRoute) {
278
+ if (!durable) {
307
279
  identityWatcher = await (deps.watchPublicIdentity ?? watchPublicIdentity)({
308
280
  origin, secret, identity: ready.identity, fetchImpl: deps.fetchImpl ?? fetch,
309
281
  onStatus: status => { if (status === 'retrying') say('The temporary public link is not responding; checking again.'); },
@@ -314,7 +286,6 @@ export async function runHosted({ options, env, out, input, signal, errorContext
314
286
  if (routeDied) throw Object.assign(new Error('The temporary demo link changed or stopped responding during startup; the trial is stopping.'), { tryKind: 'route_lost' });
315
287
  }
316
288
 
317
- // The default callback list already holds both clients' published callbacks; the approval below accepts only the selected client's.
318
289
  await dalan(['connect', 'start', '--worker', HOSTED_WORKER]);
319
290
  const requestId = `req_${randomUUID()}`;
320
291
  const phrase = `${REPORT} ${randomBytes(4).toString('hex')}`;
@@ -330,18 +301,18 @@ export async function runHosted({ options, env, out, input, signal, errorContext
330
301
  routeGone = Promise.race([routeGone, expiry]);
331
302
  }
332
303
  const trialLeft = () => trialEndsAt === null ? '' : ` Local shutdown limit: ${timeLeft(trialEndsAt - clock.now())}. The temporary link can stop earlier.`;
333
- if (trialEndsAt !== null) say(`This trial has a local shutdown limit of ${timeLeft(trialEndsAt - clock.now())}; the temporary link can stop earlier or without warning. Run \`dalan setup\` to choose Tailscale when available, or keep using temporary Gozar links. Setup does not install a background service.`);
304
+ if (trialEndsAt !== null) say(`This trial has a local shutdown limit of ${timeLeft(trialEndsAt - clock.now())}; the temporary link can stop earlier or without warning. Run \`dalan setup\` to choose a stable route. Setup does not install a background service.`);
334
305
  say('');
335
- say(handoffText({ client, url: mcpUrl }));
306
+ say(handoffText({ url: mcpUrl }));
336
307
  say('');
337
- say(`Waiting for sign-in. Ctrl-C stops the trial and attempts to remove its public route. This terminal shows the connection code. Type help here to see the ${spec.label} steps again. The URL is also in ${urlFile}.`);
308
+ say(`Waiting for sign-in. Ctrl-C stops the trial and attempts to remove its public route. This terminal shows the connection code. Type help here to see the steps again. The URL is also in ${urlFile}.`);
338
309
 
339
- const showPrompt = () => say(`Finish sign-in in its browser tab, then enable "${CONNECTOR_NAME}" in a ${spec.label} chat. Paste this into the chat:\n${hostedPrompt(requestId, phrase)}`);
310
+ const showPrompt = () => say(`Finish sign-in in its browser tab, then enable "${CONNECTOR_NAME}" in a chat. Paste this into the chat:\n${hostedPrompt(requestId, phrase)}`);
340
311
  const seen = new Set();
341
312
  let approvedConnection = null, reminded = 0, retryNow = false, stage = 'signin';
342
313
  let remindAt = clock.now() + DIAGNOSE_AFTER_MS;
343
314
  const stageNote = () => ({
344
- signin: `No sign-in request yet. Add ${CONNECTOR_NAME} in ${spec.label} and start sign-in. Type help here to see the steps again.`,
315
+ signin: `No sign-in request yet. Add ${CONNECTOR_NAME} in your MCP client and start sign-in. Type help here to see the steps again.`,
345
316
  approved: 'Approval succeeded, but the client has not claimed the job. Finish sign-in and send this prompt in a chat with the connector enabled.',
346
317
  claimed: 'The demo is claimed. Check the chat for a tool approval or a stopped response.',
347
318
  }[stage]);
@@ -353,7 +324,7 @@ export async function runHosted({ options, env, out, input, signal, errorContext
353
324
  };
354
325
  // Help is read from the same input as the answers: a line that is not an answer is checked for it.
355
326
  let asking = false;
356
- lines.on('line', line => { if (line.trim().toLowerCase() === 'help' && !asking) { if (stage === 'approved') { showPrompt(); return; } say(`${spec.label}\n${spec.steps.map((step, i) => `${i + 1}. ${step}`).join('\n')}\n(The connector URL is in ${urlFile}.)`); } });
327
+ lines.on('line', line => { if (line.trim().toLowerCase() === 'help' && !asking) { if (stage === 'approved') { showPrompt(); return; } say(`${STEPS.map((step, i) => `${i + 1}. ${step}`).join('\n')}\n(The connector URL is in ${urlFile}.)`); } });
357
328
  const askOnce = async question => { asking = true; try { return await ask(question); } finally { asking = false; } };
358
329
 
359
330
  while (!exited && !stopRequested() && !routeDied && !trialOver()) {
@@ -386,7 +357,6 @@ export async function runHosted({ options, env, out, input, signal, errorContext
386
357
  const { text, blocked } = describeAttempt(attempt, shownResource);
387
358
  say(`\nConnection waiting for your approval\n${text}\naccess the trial worker's demo queue`);
388
359
  if (blocked) { say('Not approving: this attempt names a different resource than this trial.'); continue; }
389
- if (!callbackAllowed(client, attempt.redirect_uri)) { say(`Not approving: its callback is not ${spec.label}'s. If you are using the other client, restart with --client ${client === 'chatgpt' ? 'claude' : 'chatgpt'}.`); continue; }
390
360
  if (attempt.native) { say('Not approving: this is a local program, not a hosted client.'); continue; }
391
361
  say('Check that the code matches the Dalan sign-in page you opened.');
392
362
  const answer = await askOnce('Approve this connection? [y/N] ');
@@ -398,13 +368,13 @@ export async function runHosted({ options, env, out, input, signal, errorContext
398
368
  }
399
369
  if (result) { approvedConnection = result.connection_id ?? (await dalan(['connect', 'list', '--json']).then(t => JSON.parse(t).connections.find(c => c.worker === HOSTED_WORKER && c.revoked_at === null)?.connection_id ?? null)); stage = 'approved'; say('Connection approved.'); showPrompt(); }
400
370
  else {
401
- say(`That attempt is no longer current or expired (attempts last ${PAIRING_MINUTES} minutes). Start the sign-in again in ${spec.label}; its new code appears here.`);
371
+ say(`That attempt is no longer current or expired (attempts last ${PAIRING_MINUTES} minutes). Start the sign-in again in your MCP client; its new code appears here.`);
402
372
  retryNow = (await pendingNow()).pending.some(p => !p.superseded && !seen.has(p.code));
403
373
  }
404
374
  break;
405
375
  }
406
376
  if (stopRequested()) { say('\nNot approved.'); break; }
407
- say(`Not approved. Start sign-in again in ${spec.label}; approve the new matching code here to get the demo prompt.`);
377
+ say(`Not approved. Start sign-in again in your MCP client; approve the new matching code here to get the demo prompt.`);
408
378
  }
409
379
  } else if (stage !== 'claimed') { stage = 'claimed'; say(`Hosted worker claimed ${requestId}.`); }
410
380
  if (reminded < DIAGNOSE_LIMIT && !exited && !stopRequested() && clock.now() >= remindAt) { say(`\n${stageNote()}${trialLeft()}`); if (stage === 'approved') showPrompt(); reminded++; remindAt = clock.now() + DIAGNOSE_EVERY_MS; }
@@ -416,7 +386,7 @@ export async function runHosted({ options, env, out, input, signal, errorContext
416
386
  const error = new Error(`The temporary demo link ${changed ? 'changed its address' : 'stopped responding'}. The connector cannot use this URL; the trial is stopping. Its saved reports stay in the trial Home.`);
417
387
  error.tryKind = 'route_lost'; throw error;
418
388
  }
419
- if (trialOver() && !stopRequested()) { const error = new Error(`The temporary trial reached its ${timeLeft(trialMs)} shutdown limit. Route cleanup will be attempted. Start a fresh trial for a new link, or run dalan setup to choose Tailscale when available. Setup does not install a background service.`); error.tryKind = 'route'; throw error; }
389
+ if (trialOver() && !stopRequested()) { const error = new Error(`The temporary trial reached its ${timeLeft(trialMs)} shutdown limit. Route cleanup will be attempted. Start a fresh trial for a new link, or run dalan setup to choose a stable route. Setup does not install a background service.`); error.tryKind = 'route'; throw error; }
420
390
  if (exited && !stopRequested()) { const error = new Error('the bridge stopped unexpectedly'); error.tryKind = 'unexpected'; throw error; }
421
391
  } catch (error) {
422
392
  if (signal?.aborted) { /* a normal stop */ }
@@ -428,14 +398,14 @@ export async function runHosted({ options, env, out, input, signal, errorContext
428
398
  // Close forwarding first, then end the connection while the bridge can still answer, then remove the route and stop the bridge.
429
399
  gate?.shut();
430
400
  if (errorContext.started && !exited) await dalan(['connect', 'revoke', HOSTED_WORKER], { abortable: false }).catch(() => {});
431
- if (route) routeStopped = await route.stop().catch(error => ({ removed: false, keepNode: true, detail: error.message }));
401
+ if (route) routeStopped = await route.stop().catch(error => ({ removed: false, detail: error.message }));
432
402
  await stopServer();
433
403
  await gate?.close();
434
404
  // The connector URL and the bridge's secrets are no use after the trial and stay on disk for nobody.
435
- removeTrialSecrets(home, configDir, { keepConfig: STABLE_ORIGIN_ROUTES.has(route?.provider.name), keepNode: keepRecoveredNode || Boolean(routeStopped?.keepNode) });
405
+ removeTrialSecrets(home, configDir, { keepConfig: stableAddress });
436
406
  releaseHome();
437
407
  cleaned = routeStopped ? routeStopped.removed : true;
438
- if (!cleaned) { process.exitCode = 1; out.write(`dalan: Bridge stopped; public-route cleanup is unconfirmed: ${terminalSafe(routeStopped.detail)}\n${routeStopped.command ? `Remove it with:\n${commandLine(routeStopped.command)}\n` : ''}`); }
408
+ if (!cleaned) { process.exitCode = 1; out.write(`dalan: Bridge stopped; public-route cleanup is unconfirmed: ${terminalSafe(routeStopped.detail)}\n`); }
439
409
  }
440
410
  if (route && cleaned) say('Public route removed. Bridge stopped.');
441
411
  else if (!route) say('No public route was started. Bridge stopped.');
@@ -1,17 +1,21 @@
1
1
  // Proves a live `dalan try` public address works as a real OAuth client sees it, step by step, without claude.ai:
2
- // discovery, dynamic registration with the client's published callback, PKCE authorize, the owner's approval in the trial
2
+ // discovery, dynamic registration with an ordinary HTTPS callback, PKCE authorize, the owner's approval in the trial
3
3
  // terminal, the token exchange, then an authenticated MCP initialize, tools/list and one read-only tool call.
4
4
  // One line per step. No token, authorization code, pairing code, secret path or URL is ever written to the output.
5
5
  import { createHash, randomBytes } from 'node:crypto';
6
6
  import { safeDiagnostic } from './diagnostic.mjs';
7
- import { CLIENTS } from './try-hosted-clients.mjs';
8
7
  import { authorizationServerMetadataUrl, onOrigin, TRIAL_ORIGIN_RULE } from './try-exposure.mjs';
9
8
  import { mcpResponseText } from './mcp-sse.mjs';
10
9
 
11
10
  const MCP_PROTOCOL = '2025-11-25';
12
11
  const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
13
12
 
14
- export async function runSelfCheck({ url, client = 'claude', fetchImpl = fetch, say = () => {}, approveWaitMs = 300_000, requestMs = 30_000, signal } = {}) {
13
+ // The check registers a throwaway generic client. Its redirect is an ordinary HTTPS URL: the bridge accepts any plain one.
14
+ export const SELFCHECK_REDIRECT = 'https://selfcheck.example/oauth/callback';
15
+
16
+ export async function runSelfCheck({ url, redirect = SELFCHECK_REDIRECT, fetchImpl = fetch, say = () => {}, approveWaitMs = 300_000, requestMs = 30_000, signal, approve, discoveryOnly = false } = {}) {
17
+ // `approve({ code })` lets the caller approve the pairing the page just showed (the owner's side); without it a human approves.
18
+ // `discoveryOnly` stops after the steps that need no approval: no registration, no RESULT line.
15
19
  let mcp;
16
20
  try { mcp = new URL(url); } catch { mcp = null; }
17
21
  if (!mcp || !['https:', 'http:'].includes(mcp.protocol)) { // the message is fixed: the supplied text may be a credential
@@ -19,7 +23,7 @@ export async function runSelfCheck({ url, client = 'claude', fetchImpl = fetch,
19
23
  say('RESULT FAIL');
20
24
  return { ok: false, results: [{ name: 'input', status: 'FAIL', detail: 'the trial URL is not a valid web address' }] };
21
25
  }
22
- const callback = CLIENTS[client].callbacks.find(c => typeof c === 'string'); // the client's stable, published callback
26
+ const callback = redirect;
23
27
  const results = [];
24
28
  let failed = false;
25
29
  const step = async (name, fn) => {
@@ -68,7 +72,8 @@ export async function runSelfCheck({ url, client = 'claude', fetchImpl = fetch,
68
72
  if (!meta.code_challenge_methods_supported?.includes('S256')) throw new Error('S256 is not supported');
69
73
  ctx.meta = meta;
70
74
  });
71
- await step(`registration: ${client}'s published callback is accepted as a public client`, async () => {
75
+ if (discoveryOnly) return { ok: !failed, results };
76
+ await step(`registration: an ordinary HTTPS callback is accepted as a public client`, async () => {
72
77
  const res = await get(ctx.meta.registration_endpoint, { method: 'POST', headers: { 'content-type': 'application/json' },
73
78
  body: JSON.stringify({ redirect_uris: [callback], client_name: 'dalan self-check', token_endpoint_auth_method: 'none', grant_types: ['authorization_code', 'refresh_token'], response_types: ['code'] }) });
74
79
  if (res.status !== 201) throw new Error(`HTTP ${res.status}`);
@@ -93,10 +98,12 @@ export async function runSelfCheck({ url, client = 'claude', fetchImpl = fetch,
93
98
  ctx.interaction = first.headers.get('location');
94
99
  if (first.status !== 303 || !ctx.interaction) throw new Error(`HTTP ${first.status}`);
95
100
  const page = await (await send(here(ctx.interaction))).text();
96
- if (!/class="code">[A-Z0-9-]+</.test(page)) throw new Error('the pairing page shows no code');
101
+ ctx.pairingCode = /class="code">([A-Z0-9-]+)</.exec(page)?.[1];
102
+ if (!ctx.pairingCode) throw new Error('the pairing page shows no code');
97
103
  });
98
- if (!failed) say(`WAIT approve the connection in the trial terminal (y); waiting up to ${Math.round(approveWaitMs / 1000)} s`);
99
- await step('approval: the owner approved in the trial terminal', async () => {
104
+ if (!failed && !approve) say(`WAIT approve the connection in the trial terminal (y); waiting up to ${Math.round(approveWaitMs / 1000)} s`);
105
+ await step(approve ? 'approval: the owner approved the pairing' : 'approval: the owner approved in the trial terminal', async () => {
106
+ if (approve) await approve({ code: ctx.pairingCode });
100
107
  const deadline = Date.now() + approveWaitMs;
101
108
  for (;;) {
102
109
  const done = await send(here(ctx.interaction));
package/src/try.mjs CHANGED
@@ -29,7 +29,7 @@ const BRIEF = 'Report the exact phrase: bridge first report. Do not read files,
29
29
  const REPORT = 'bridge first report';
30
30
  const MARKER = '.dalan-trial';
31
31
  const DEFAULT_CALLBACKS = ['http://127.0.0.1/callback', 'http://localhost/callback'];
32
- const USAGE = 'usage: dalan try [--local | --public [--client chatgpt|claude] [--route auto|gozar|localhost.run|tailscale]] [--home DIR] [--port N] [--callback PATTERN]...';
32
+ const USAGE = 'usage: dalan try [--local | --public [--route NAME]] [--home DIR] [--port N] [--callback PATTERN]...';
33
33
  const DEMO_REPO = 'dalan-demo/hello';
34
34
  const DENIED_REPO = 'dalan-demo/other';
35
35
  const DEMO_TITLE = 'Hello from the Dalan demo repository';
@@ -82,7 +82,7 @@ function formatTryError(error, context, alternate = null) {
82
82
  if (error?.tryKind === 'route_start') {
83
83
  // The route, not the home, failed: the same home retries cleanly, and the other route or a local trial are the real alternatives.
84
84
  const freshRelayHome = shellQuote(path.join(os.homedir(), '.local/share', `dalan-hosted-${randomUUID()}`));
85
- const otherRoute = /--route tailscale\b/.test(flags) ? commandBlock('Or make a temporary public demo link with Gozar:', `${cli} try${flags.replace('--route tailscale', '--route gozar')} --home ${freshRelayHome}`) : null;
85
+ const otherRoute = /--route\b/.test(flags) ? commandBlock('Or let Gozar pick a route for this trial:', `${cli} try${flags.replace(/\s--route\s+\S+/, '')} --home ${freshRelayHome}`) : null;
86
86
  return [`${cause}\nThe public route did not start, so the bridge was not started.`, commandBlock('Try again with:', `${cli} try${flags} --home ${context.shellHome}`), otherRoute,
87
87
  commandBlock('Or try on this computer only:', `${cli} try --local`)].filter(Boolean).join('\n');
88
88
  }
@@ -100,26 +100,22 @@ export async function describeTryError(error, context) {
100
100
 
101
101
  export function parseTryArgs(argv) {
102
102
  const out = { home: null, port: null, callbacks: [] };
103
- const choices = { '--client': ['chatgpt', 'claude'], '--route': ['auto', 'gozar', 'localhost.run', 'tailscale'] };
104
103
  for (let i = 0; i < argv.length; i++) {
105
104
  const [flag, value] = [argv[i], argv[i + 1]];
106
105
  if (flag === '--local' || flag === '--public') { out.mode = flag.slice(2); continue; }
107
- if (!['--home', '--port', '--callback', '--client', '--route'].includes(flag)) throw new Error(`unknown option ${JSON.stringify(flag)}\n${USAGE}`);
106
+ if (!['--home', '--port', '--callback', '--route'].includes(flag)) throw new Error(`unknown option ${JSON.stringify(flag)}\n${USAGE}`);
108
107
  if (value === undefined || value.startsWith('--')) throw new Error(`${flag} needs a value\n${USAGE}`);
109
108
  i++;
110
109
  if (flag === '--home') out.home = value;
111
110
  else if (flag === '--callback') out.callbacks.push(value);
112
- else if (flag in choices) {
113
- if (!choices[flag].includes(value)) throw new Error(`${flag} must be one of: ${choices[flag].join(', ')}`);
114
- out[flag.slice(2)] = value;
115
- } else if (/^\d+$/.test(value) && Number(value) > 0 && Number(value) < 65536) out.port = Number(value);
111
+ else if (flag === '--route') out.route = value; // the owner's Gozar route name, passed through exactly
112
+ else if (/^\d+$/.test(value) && Number(value) > 0 && Number(value) < 65536) out.port = Number(value);
116
113
  else throw new Error('--port requires a number from 1 to 65535');
117
114
  }
118
115
  // Conflicts are refused here, before any file, process or route exists. --client and --route only make sense for a public trial.
119
- const hostedOnly = ['client', 'route'].filter(key => out[key] !== undefined);
120
- if (out.mode === 'local' && hostedOnly.length) throw new Error(`--local cannot be combined with --${hostedOnly[0]}; those options are for a public trial`);
121
- if (hostedOnly.length && !out.mode) out.mode = 'public';
122
- if (out.mode === 'public' && out.callbacks.length) throw new Error('--callback is for a local client; a public trial uses the selected client\'s own callback');
116
+ if (out.mode === 'local' && out.route !== undefined) throw new Error('--local cannot be combined with --route; that option is for a public trial');
117
+ if (out.route !== undefined && !out.mode) out.mode = 'public';
118
+ if (out.mode === 'public' && out.callbacks.length) throw new Error('--callback is for a local client; a public trial uses the MCP client\'s own callback');
123
119
  return out;
124
120
  }
125
121
 
@@ -270,7 +266,7 @@ export async function runTry({ argv = [], env = process.env, out = process.stdou
270
266
  if (!options.mode) Object.assign(options, await hostedMode.chooseMode({ input, out, signal }));
271
267
  if (options.mode === 'public') {
272
268
  const cli = errorContext.cli ?? `node ${errorContext.shellCli ?? shellQuote(path.join(repo, 'bin/dalan.mjs'))}`;
273
- if (!interactive) throw new Error(`Hosted setup needs an interactive terminal for the URL and connection approval. Run this in an interactive terminal:\n${commandLine(`${cli} try --public --client ${options.client ?? 'chatgpt'}`)}`);
269
+ if (!interactive) throw new Error(`Hosted setup needs an interactive terminal for the URL and connection approval. Run this in an interactive terminal:\n${commandLine(`${cli} try --public${options.route !== undefined ? ` --route ${shellQuote(options.route)}` : ''}`)}`);
274
270
  return hostedMode.runHosted({ options, env, out, input, signal, errorContext, clock, deps: hosted, helpers: tryInternals });
275
271
  }
276
272
  }
package/src/workers.mjs CHANGED
@@ -6,7 +6,7 @@ import path from 'node:path';
6
6
  import { randomUUID, createHash } from 'node:crypto';
7
7
  import { DatabaseSync } from 'node:sqlite';
8
8
  import { writeAtomic } from './as-files.mjs';
9
- import { parseExecution } from './execution.mjs';
9
+ import { parseExecution, ADAPTER_QUALIFICATIONS } from './execution.mjs';
10
10
 
11
11
  const fail=message=>{throw new Error(`workers: ${message}`);};
12
12
  const object=(v,keys)=>{if(!v||typeof v!=='object'||Array.isArray(v)||Object.keys(v).some(k=>!keys.includes(k))) fail(`expected object with keys ${keys.join(', ')}`);};
@@ -62,7 +62,8 @@ export function parseWorkers(value,{builtin=false,builtinConnectionIds}={}) {
62
62
  if(name==='pool'||name==='unknown') fail(`worker name "${name}" is reserved and unsupported`);
63
63
  if(!/^[a-z][a-z0-9_-]{0,31}$/.test(name)) fail('invalid worker name');
64
64
  if(Object.hasOwn(config??{},'pool')) fail(`${name}.pool is not supported`);
65
- object(config,['connections','capabilities','guidance','repos','repo_access','denied_repos','destination','workspaceAllowed']);
65
+ object(config,['connections','capabilities','guidance','repos','repo_access','denied_repos','destination','workspaceAllowed','adapter']);
66
+ if(Object.hasOwn(config,'adapter')&&(typeof config.adapter!=='string'||!Object.hasOwn(ADAPTER_QUALIFICATIONS,config.adapter))) fail(`${name}.adapter must name a qualified adapter: ${Object.keys(ADAPTER_QUALIFICATIONS).join(', ')}`);
66
67
  const repoSettings=normalizeRepoSettings(config,name);
67
68
  if(config.guidance!==undefined&&config.guidance!=='resume') fail(`${name}.guidance may only be "resume"`);
68
69
  if(builtin&&config.connections!==undefined&&!(Array.isArray(config.connections)&&!config.connections.length)) fail(`${name}.connections must be absent in built-in mode; connections are recorded by dalan connect approve`);
@@ -81,7 +82,7 @@ export function parseWorkers(value,{builtin=false,builtinConnectionIds}={}) {
81
82
  if(config.workspaceAllowed!==undefined&&typeof config.workspaceAllowed!=='boolean') fail(`${name}.workspaceAllowed must be boolean`);
82
83
  const caps=config.capabilities??[];
83
84
  if(!Array.isArray(caps)||caps.some(c=>c!=='t3')) fail('capabilities may only contain t3');
84
- workers.set(name,{connections,capabilities:new Set(caps),...(config.workspaceAllowed!==undefined?{workspaceAllowed:config.workspaceAllowed}:{}),...(config.guidance?{guidance:config.guidance}:{}),...repoSettings,
85
+ workers.set(name,{connections,capabilities:new Set(caps),...(config.adapter!==undefined?{adapter:config.adapter}:{}),...(config.workspaceAllowed!==undefined?{workspaceAllowed:config.workspaceAllowed}:{}),...(config.guidance?{guidance:config.guidance}:{}),...repoSettings,
85
86
  ...(Object.hasOwn(config,'destination')?{destination:parseDestinationDeclaration(config.destination)}:{})});
86
87
  }
87
88
  if(!workers.size) fail('workers must not be empty');