@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.
Files changed (199) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/CONTRIBUTING.md +26 -0
  3. package/LICENSE +204 -0
  4. package/PROTOCOL.md +351 -0
  5. package/README.md +215 -2
  6. package/SECURITY.md +30 -0
  7. package/bin/dalan.mjs +43 -0
  8. package/bin/dot-acp-agent.mjs +377 -0
  9. package/bin/dot-alert.mjs +9 -0
  10. package/bin/dot-deadman.mjs +82 -0
  11. package/bin/dot-heartbeat.mjs +29 -0
  12. package/bin/dot-pr-reviewer.mjs +32 -0
  13. package/bin/dot-worker.mjs +764 -0
  14. package/docs/chatgpt-worker-onboarding.md +112 -0
  15. package/docs/claude-worker-onboarding.md +113 -0
  16. package/docs/codex-to-muse.md +175 -0
  17. package/docs/connect-chatgpt.md +83 -0
  18. package/docs/connection-longevity.md +43 -0
  19. package/docs/dalan-upgrade.md +246 -0
  20. package/docs/deadman.md +61 -0
  21. package/docs/dot-pr-reviewer.config.example.json +9 -0
  22. package/docs/durability-audit.md +27 -0
  23. package/docs/keycloak-client-chatgpt-dot-bridge.json +59 -0
  24. package/docs/keycloak-oauth-setup.md +30 -0
  25. package/docs/local-agent-mcp.md +41 -0
  26. package/docs/manual-setup.md +135 -0
  27. package/docs/mirror-fetch.md +97 -0
  28. package/docs/operations.md +799 -0
  29. package/docs/operator-duties.md +68 -0
  30. package/docs/owner-integrator.md +27 -0
  31. package/docs/portable-auth-profile.md +107 -0
  32. package/docs/pr-head-reviewer.md +70 -0
  33. package/docs/pr-preflight.md +28 -0
  34. package/docs/pull-queue.md +131 -0
  35. package/docs/pull-workers.md +94 -0
  36. package/docs/redaction.md +27 -0
  37. package/docs/service-setup.md +219 -0
  38. package/docs/setup-reference.md +80 -0
  39. package/docs/t3-connector-icon.png +0 -0
  40. package/docs/t3-integration.md +51 -0
  41. package/docs/t3-result-retry-delivery.md +41 -0
  42. package/docs/t3-reverse-control.md +107 -0
  43. package/docs/usage.md +443 -0
  44. package/docs/worker-clients.md +290 -0
  45. package/integrations/t3/acp-kit/src/capability.mjs +25 -0
  46. package/integrations/t3/acp-kit/src/errors.mjs +13 -0
  47. package/integrations/t3/acp-kit/src/index.mjs +5 -0
  48. package/integrations/t3/acp-kit/src/lock.mjs +155 -0
  49. package/integrations/t3/acp-kit/src/session-store.mjs +36 -0
  50. package/integrations/t3/acp-kit/src/t3-envelope.mjs +62 -0
  51. package/package.json +67 -4
  52. package/packages/job-core/README.md +18 -0
  53. package/packages/job-core/index.mjs +2 -0
  54. package/packages/job-core/package.json +8 -0
  55. package/packages/job-core/protocol/canonical.mjs +11 -0
  56. package/packages/job-core/protocol/v0/command.schema.json +1154 -0
  57. package/packages/job-core/protocol/v0/event.schema.json +77 -0
  58. package/packages/job-core/protocol/v0/reply.schema.json +59 -0
  59. package/packages/job-core/transitions.mjs +25 -0
  60. package/scripts/daily-selfcheck.mjs +135 -0
  61. package/scripts/dalan-try-selfcheck.mjs +29 -0
  62. package/scripts/lib/expose-tailscale.mjs +408 -0
  63. package/scripts/live-trial/common.mjs +272 -0
  64. package/scripts/monitor-targets.mjs +44 -0
  65. package/scripts/upgrade-drain.mjs +39 -0
  66. package/scripts/worker-bridge-setup.mjs +925 -0
  67. package/src/ack-ledger.mjs +37 -0
  68. package/src/acp-bridge.mjs +418 -0
  69. package/src/acp-context.mjs +138 -0
  70. package/src/admin-socket.mjs +14 -0
  71. package/src/alerts.mjs +147 -0
  72. package/src/artifact-journal.mjs +75 -0
  73. package/src/as-files.mjs +347 -0
  74. package/src/as-store.mjs +456 -0
  75. package/src/as.mjs +538 -0
  76. package/src/auth.mjs +166 -0
  77. package/src/builtin-http.mjs +22 -0
  78. package/src/check-coverage.mjs +38 -0
  79. package/src/check-lint.mjs +88 -0
  80. package/src/check-readiness.mjs +112 -0
  81. package/src/check-response.mjs +19 -0
  82. package/src/child-exit.mjs +18 -0
  83. package/src/child-registry.mjs +94 -0
  84. package/src/claim-command-ledger.mjs +51 -0
  85. package/src/cli-help.mjs +186 -0
  86. package/src/cli-name.mjs +16 -0
  87. package/src/connect-cli.mjs +126 -0
  88. package/src/consumers.mjs +61 -0
  89. package/src/deadman.mjs +329 -0
  90. package/src/delivery.mjs +19 -0
  91. package/src/demo-worker.mjs +150 -0
  92. package/src/destinations/index.mjs +23 -0
  93. package/src/destinations/none.mjs +15 -0
  94. package/src/destinations/t3.mjs +109 -0
  95. package/src/diagnostic.mjs +78 -0
  96. package/src/docs-url.mjs +9 -0
  97. package/src/drain-runner.mjs +9 -0
  98. package/src/drained-owner.mjs +26 -0
  99. package/src/drained-slot.mjs +70 -0
  100. package/src/drained.mjs +40 -0
  101. package/src/durable-waiters.mjs +236 -0
  102. package/src/env.mjs +19 -0
  103. package/src/execution.mjs +112 -0
  104. package/src/failure-type.mjs +28 -0
  105. package/src/get-summary.mjs +32 -0
  106. package/src/git-env.mjs +15 -0
  107. package/src/host-budget-receipts.mjs +154 -0
  108. package/src/host-budget-seccomp.py +33 -0
  109. package/src/host-budget-service.mjs +54 -0
  110. package/src/host-budget-stop.mjs +26 -0
  111. package/src/host-budget-storage.py +259 -0
  112. package/src/host-budget.mjs +149 -0
  113. package/src/host-cgroup.mjs +23 -0
  114. package/src/host-check-allowlist.mjs +42 -0
  115. package/src/host-execution-policy.mjs +38 -0
  116. package/src/host-health.mjs +34 -0
  117. package/src/host-stop-reverify.mjs +44 -0
  118. package/src/inbox.mjs +55 -0
  119. package/src/integrator.mjs +322 -0
  120. package/src/job-retention.mjs +69 -0
  121. package/src/legacy-names.mjs +8 -0
  122. package/src/lifecycle.mjs +291 -0
  123. package/src/limits.mjs +31 -0
  124. package/src/loopback.mjs +9 -0
  125. package/src/mcp-outcome.mjs +79 -0
  126. package/src/mcp-sse.mjs +62 -0
  127. package/src/mcp-stdio.mjs +191 -0
  128. package/src/mirror-fetch-lock.py +164 -0
  129. package/src/mirror-fetch.mjs +174 -0
  130. package/src/notify-ledger.mjs +82 -0
  131. package/src/objectives.mjs +129 -0
  132. package/src/owner-report-artifact.mjs +66 -0
  133. package/src/patch-apply.mjs +84 -0
  134. package/src/path-syntax.mjs +16 -0
  135. package/src/paths.mjs +67 -0
  136. package/src/pr-head-reviewer.mjs +596 -0
  137. package/src/pr-preflight.mjs +51 -0
  138. package/src/prepared-node-modules.mjs +129 -0
  139. package/src/process-inspection.mjs +36 -0
  140. package/src/projects.mjs +480 -0
  141. package/src/protocol-artifact-commands.mjs +52 -0
  142. package/src/protocol-delivery-driver.mjs +167 -0
  143. package/src/protocol-finish.mjs +100 -0
  144. package/src/protocol-owner-command.mjs +35 -0
  145. package/src/protocol-owner-mutations.mjs +22 -0
  146. package/src/protocol-owner-waiters.mjs +67 -0
  147. package/src/protocol-retention.mjs +52 -0
  148. package/src/protocol-services.mjs +61 -0
  149. package/src/protocol-stop-observer.mjs +131 -0
  150. package/src/publish-plan.mjs +245 -0
  151. package/src/pull-queue.mjs +159 -0
  152. package/src/redaction.mjs +763 -0
  153. package/src/rejections.mjs +18 -0
  154. package/src/request-log.mjs +102 -0
  155. package/src/restore-check.mjs +90 -0
  156. package/src/result-binding.mjs +65 -0
  157. package/src/route-setting.mjs +24 -0
  158. package/src/runtime-check.mjs +13 -0
  159. package/src/sandbox-supervisor.mjs +105 -0
  160. package/src/schema-subset.mjs +186 -0
  161. package/src/scopes.mjs +15 -0
  162. package/src/server.mjs +1468 -0
  163. package/src/service-migrate-workers.mjs +113 -0
  164. package/src/service.mjs +388 -0
  165. package/src/setup.mjs +63 -0
  166. package/src/shutdown-signal.mjs +12 -0
  167. package/src/signal-sandbox-processes.py +56 -0
  168. package/src/signal.mjs +119 -0
  169. package/src/status-evidence.mjs +47 -0
  170. package/src/status-summary.mjs +54 -0
  171. package/src/store.mjs +3069 -0
  172. package/src/submission-policy.mjs +623 -0
  173. package/src/subscription-storage.mjs +64 -0
  174. package/src/t3-audit.mjs +120 -0
  175. package/src/t3-control.mjs +102 -0
  176. package/src/t3-transport.mjs +158 -0
  177. package/src/t3.mjs +209 -0
  178. package/src/terminal-safe.mjs +19 -0
  179. package/src/tool-registry.mjs +453 -0
  180. package/src/try-command.mjs +11 -0
  181. package/src/try-exposure.mjs +908 -0
  182. package/src/try-hosted-clients.mjs +46 -0
  183. package/src/try-hosted.mjs +444 -0
  184. package/src/try-selfcheck.mjs +168 -0
  185. package/src/try.mjs +635 -0
  186. package/src/webhooks.mjs +86 -0
  187. package/src/work-order.mjs +265 -0
  188. package/src/worker-instructions.mjs +26 -0
  189. package/src/worker-prompt.mjs +4 -0
  190. package/src/workers.mjs +632 -0
  191. package/src/workspace.mjs +1065 -0
  192. package/systemd/dot-bridge-heartbeat.service +18 -0
  193. package/systemd/dot-bridge-heartbeat.timer +10 -0
  194. package/systemd/dot-bridge-selfcheck.service +12 -0
  195. package/systemd/dot-bridge-selfcheck.timer +11 -0
  196. package/systemd/dot-bridge.service +17 -0
  197. package/systemd/dot-deadman.service +30 -0
  198. package/systemd/dot-pr-reviewer.service +11 -0
  199. package/systemd/dot-pr-reviewer.timer +10 -0
@@ -0,0 +1,168 @@
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
3
+ // terminal, the token exchange, then an authenticated MCP initialize, tools/list and one read-only tool call.
4
+ // One line per step. No token, authorization code, pairing code, secret path or URL is ever written to the output.
5
+ import { createHash, randomBytes } from 'node:crypto';
6
+ import { safeDiagnostic } from './diagnostic.mjs';
7
+ import { CLIENTS } from './try-hosted-clients.mjs';
8
+ import { authorizationServerMetadataUrl, onOrigin, TRIAL_ORIGIN_RULE } from './try-exposure.mjs';
9
+ import { mcpResponseText } from './mcp-sse.mjs';
10
+
11
+ const MCP_PROTOCOL = '2025-11-25';
12
+ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
13
+
14
+ export async function runSelfCheck({ url, client = 'claude', fetchImpl = fetch, say = () => {}, approveWaitMs = 300_000, requestMs = 30_000, signal } = {}) {
15
+ let mcp;
16
+ try { mcp = new URL(url); } catch { mcp = null; }
17
+ if (!mcp || !['https:', 'http:'].includes(mcp.protocol)) { // the message is fixed: the supplied text may be a credential
18
+ say('FAIL input: the trial URL is not a valid web address');
19
+ say('RESULT FAIL');
20
+ return { ok: false, results: [{ name: 'input', status: 'FAIL', detail: 'the trial URL is not a valid web address' }] };
21
+ }
22
+ const callback = CLIENTS[client].callbacks.find(c => typeof c === 'string'); // the client's stable, published callback
23
+ const results = [];
24
+ let failed = false;
25
+ const step = async (name, fn) => {
26
+ if (failed) { results.push({ name, status: 'SKIP' }); say(`SKIP ${name}`); return undefined; }
27
+ try {
28
+ const note = await fn();
29
+ results.push({ name, status: 'PASS' }); say(`PASS ${name}${note ? ` (${scrub(note)})` : ''}`);
30
+ } catch (error) {
31
+ const detail = scrub(safeDiagnostic(error?.name === 'AbortError' || error?.name === 'TimeoutError' ? 'cancelled or timed out' : error?.message, 200));
32
+ failed = true; results.push({ name, status: 'FAIL', detail });
33
+ say(`FAIL ${name}: ${detail}`);
34
+ }
35
+ return undefined;
36
+ };
37
+ // The secret path is part of the MCP URL; keep it, the origin-relative credentials and the full URL out of every line.
38
+ const secretPath = mcp.pathname.split('/')[1] ?? '';
39
+ const scrub = text => String(text).split(url).join('[url]').split(secretPath).join('[secret]');
40
+ // Every request has its own deadline, so a server that never finishes its answer cannot outlast the check.
41
+ const get = (u, init = {}) => fetchImpl(u, { redirect: 'manual', ...init, signal: signal ? AbortSignal.any([AbortSignal.timeout(requestMs), signal]) : AbortSignal.timeout(requestMs), headers: { connection: 'close', ...(init.headers ?? {}) } });
42
+ const json = async (res, label) => { try { return JSON.parse(await res.text()); } catch { throw new Error(`${label} is not JSON`); } };
43
+ const ctx = {};
44
+
45
+ await step('challenge: an unauthenticated MCP request is answered with an OAuth challenge', async () => {
46
+ const res = await get(url, { method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream' }, body: '{"jsonrpc":"2.0","id":1,"method":"ping"}' });
47
+ if (res.status !== 401) throw new Error(`HTTP ${res.status}, not 401`);
48
+ const header = res.headers.get('www-authenticate') ?? '';
49
+ if (!/^Bearer/i.test(header)) throw new Error('no Bearer challenge');
50
+ ctx.metadataUrl = /resource_metadata="([^"]+)"/.exec(header)?.[1];
51
+ if (!ctx.metadataUrl) throw new Error('the challenge names no resource_metadata');
52
+ });
53
+ await step('discovery: protected-resource metadata names this resource and an authorization server', async () => {
54
+ const res = await get(ctx.metadataUrl);
55
+ if (res.status !== 200) throw new Error(`HTTP ${res.status}`);
56
+ const doc = await json(res, 'resource metadata');
57
+ if (doc.resource !== url) throw new Error('the resource is not the MCP URL');
58
+ if (!Array.isArray(doc.authorization_servers) || doc.authorization_servers.length === 0) throw new Error('no authorization server');
59
+ ctx.issuer = String(doc.authorization_servers[0]);
60
+ if (!onOrigin(mcp.origin, ctx.issuer)) throw new Error(`the issuer is on another origin (${TRIAL_ORIGIN_RULE})`);
61
+ });
62
+ await step('metadata: the issuer matches exactly and every endpoint is on the public origin', async () => {
63
+ const res = await get(authorizationServerMetadataUrl(ctx.issuer));
64
+ if (res.status !== 200) throw new Error(`HTTP ${res.status}`);
65
+ const meta = await json(res, 'authorization-server metadata');
66
+ if (meta.issuer !== ctx.issuer) throw new Error('the issuer in the metadata differs from the issuer in discovery');
67
+ for (const key of ['authorization_endpoint', 'token_endpoint', 'registration_endpoint']) if (typeof meta[key] !== 'string' || !onOrigin(mcp.origin, meta[key])) throw new Error(`${key} is missing or off this origin (${TRIAL_ORIGIN_RULE})`);
68
+ if (!meta.code_challenge_methods_supported?.includes('S256')) throw new Error('S256 is not supported');
69
+ ctx.meta = meta;
70
+ });
71
+ await step(`registration: ${client}'s published callback is accepted as a public client`, async () => {
72
+ const res = await get(ctx.meta.registration_endpoint, { method: 'POST', headers: { 'content-type': 'application/json' },
73
+ 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
+ if (res.status !== 201) throw new Error(`HTTP ${res.status}`);
75
+ const doc = await json(res, 'registration');
76
+ if (doc.token_endpoint_auth_method !== 'none') throw new Error(`token_endpoint_auth_method is ${safeDiagnostic(doc.token_endpoint_auth_method, 40)}, not none`);
77
+ if (Object.hasOwn(doc, 'client_secret')) throw new Error('a client secret was issued to a public client');
78
+ ctx.clientId = doc.client_id;
79
+ });
80
+ const cookies = new Map();
81
+ const send = async (u, init) => {
82
+ const cookie = [...cookies].map(([k, v]) => `${k}=${v}`).join('; ');
83
+ const res = await get(u, { ...init, headers: { ...(cookie ? { cookie } : {}) } });
84
+ for (const line of res.headers.getSetCookie?.() ?? []) { const [pair] = line.split(';'), i = pair.indexOf('='); if (pair.slice(i + 1) === '') cookies.delete(pair.slice(0, i)); else cookies.set(pair.slice(0, i), pair.slice(i + 1)); }
85
+ return res;
86
+ };
87
+ const here = location => new URL(location, mcp.origin).href;
88
+ const verifier = randomBytes(32).toString('base64url'), state = randomBytes(6).toString('hex');
89
+ await step('authorize: a PKCE request reaches the pairing page', async () => {
90
+ const authorize = new URL(ctx.meta.authorization_endpoint);
91
+ for (const [k, v] of Object.entries({ client_id: ctx.clientId, response_type: 'code', redirect_uri: callback, scope: 'dalan.read dalan.work', state, resource: url, code_challenge: createHash('sha256').update(verifier).digest('base64url'), code_challenge_method: 'S256' })) authorize.searchParams.set(k, v);
92
+ const first = await send(authorize.href);
93
+ ctx.interaction = first.headers.get('location');
94
+ if (first.status !== 303 || !ctx.interaction) throw new Error(`HTTP ${first.status}`);
95
+ 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');
97
+ });
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 () => {
100
+ const deadline = Date.now() + approveWaitMs;
101
+ for (;;) {
102
+ const done = await send(here(ctx.interaction));
103
+ if (done.status === 303) { ctx.resume = done.headers.get('location'); return; }
104
+ if (Date.now() > deadline) throw new Error('not approved in time');
105
+ signal?.throwIfAborted();
106
+ await sleep(500);
107
+ }
108
+ });
109
+ await step('callback: the redirect carries this request\'s state and a code, and the issuer if it names one', async () => {
110
+ const resume = await send(here(ctx.resume));
111
+ const back = new URL(resume.headers.get('location') ?? '', mcp.origin);
112
+ if (back.searchParams.get('state') !== state) throw new Error('the state does not match');
113
+ ctx.code = back.searchParams.get('code');
114
+ if (!ctx.code) throw new Error('no authorization code');
115
+ const iss = back.searchParams.get('iss');
116
+ if (iss !== null && iss !== ctx.issuer) throw new Error('the iss parameter differs from the issuer');
117
+ if (resume.status !== 302 && resume.status !== 303) throw new Error(`the redirect status is HTTP ${resume.status}`);
118
+ if (`${back.origin}${back.pathname}` !== callback) throw new Error('the redirect is not to the registered callback');
119
+ });
120
+ await step('token: the code is exchanged for a bearer token bound to this resource', async () => {
121
+ const res = await get(ctx.meta.token_endpoint, { method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' },
122
+ body: new URLSearchParams({ client_id: ctx.clientId, grant_type: 'authorization_code', code: ctx.code, redirect_uri: callback, code_verifier: verifier, resource: url }) });
123
+ if (res.status !== 200) throw new Error(`HTTP ${res.status}`);
124
+ const doc = await json(res, 'token response');
125
+ if (typeof doc.access_token !== 'string' || doc.access_token === '') throw new Error('no access_token');
126
+ if (!/^bearer$/i.test(doc.token_type ?? '')) throw new Error(`token_type is ${safeDiagnostic(doc.token_type, 20)}`);
127
+ ctx.token = doc.access_token;
128
+ let audience = 'opaque token';
129
+ const parts = ctx.token.split('.');
130
+ if (parts.length === 3) {
131
+ try { const aud = JSON.parse(Buffer.from(parts[1], 'base64url').toString()).aud; if (![aud].flat().includes(url)) throw new Error('x'); audience = 'audience is this resource'; }
132
+ catch { throw new Error('the token\'s audience is not this resource'); }
133
+ }
134
+ return `${audience}; scope ${safeDiagnostic(doc.scope, 80)}; expires_in ${Number.isInteger(doc.expires_in) ? doc.expires_in : 'unset'}`;
135
+ });
136
+ let session = {};
137
+ const rpc = async (body, expect = 200) => {
138
+ const res = await get(url, { method: 'POST', body: JSON.stringify(body), headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream', authorization: `Bearer ${ctx.token}`, ...session } });
139
+ const text = await res.text();
140
+ if (res.status !== expect) throw new Error(`HTTP ${res.status}`);
141
+ if (expect === 202) return null;
142
+ try { return { res, message: JSON.parse(mcpResponseText(text) ?? 'null') }; } catch { throw new Error('the reply is not JSON'); }
143
+ };
144
+ await step('mcp auth: a bearer token that was not issued here is refused', async () => {
145
+ const res = await get(url, { method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json, text/event-stream', authorization: `Bearer ${randomBytes(24).toString('base64url')}` }, body: '{"jsonrpc":"2.0","id":9,"method":"ping"}' });
146
+ if (res.status !== 401) throw new Error(`HTTP ${res.status}, not 401`);
147
+ });
148
+ await step('mcp initialize: the bearer token is accepted', async () => {
149
+ const { res, message } = await rpc({ jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: MCP_PROTOCOL, capabilities: {}, clientInfo: { name: 'dalan-self-check', version: '1' } } });
150
+ if (typeof message.result?.protocolVersion !== 'string') throw new Error('no protocol version in the reply');
151
+ session = { 'mcp-protocol-version': message.result.protocolVersion, ...(res.headers.get('mcp-session-id') ? { 'mcp-session-id': res.headers.get('mcp-session-id') } : {}) };
152
+ await rpc({ jsonrpc: '2.0', method: 'notifications/initialized' }, 202);
153
+ return `protocol ${safeDiagnostic(message.result.protocolVersion, 20)}`;
154
+ });
155
+ await step('mcp tools/list: the worker tools are listed', async () => {
156
+ const { message } = await rpc({ jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} });
157
+ const names = (message.result?.tools ?? []).map(t => t.name);
158
+ if (!names.includes('list_pending')) throw new Error('list_pending is not listed');
159
+ return `${names.length} tools`;
160
+ });
161
+ await step('mcp tools/call: list_pending (read-only) returns', async () => {
162
+ const { message } = await rpc({ jsonrpc: '2.0', id: 3, method: 'tools/call', params: { name: 'list_pending', arguments: {} } });
163
+ if (message.result?.isError || !message.result?.content?.length) throw new Error('the tool call failed');
164
+ });
165
+ const ok = !failed;
166
+ say(ok ? 'RESULT PASS' : 'RESULT FAIL');
167
+ return { ok, results };
168
+ }