dispach 0.2.4 → 0.2.13
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/README.md +32 -33
- package/dist/APEv2Parser-rt8hyadd.js +5 -0
- package/dist/{FlacParser-8xprykrh.js.map → APEv2Parser-rt8hyadd.js.map} +1 -1
- package/dist/{AiffParser-ns1y9f0g.js → AiffParser-gvpmtb2e.js} +3 -3
- package/dist/{AiffParser-ns1y9f0g.js.map → AiffParser-gvpmtb2e.js.map} +1 -1
- package/dist/{App-wkpkwgjt.js → App-18dvbyev.js} +8 -8
- package/dist/{App-wkpkwgjt.js.map → App-18dvbyev.js.map} +1 -1
- package/dist/{AsfParser-bae2a1yf.js → AsfParser-h9zyh6cx.js} +3 -3
- package/dist/{AsfParser-bae2a1yf.js.map → AsfParser-h9zyh6cx.js.map} +1 -1
- package/dist/{ConfigEditor-hy9jtas3.js → ConfigEditor-444m13ta.js} +3 -3
- package/dist/{ConfigEditor-hy9jtas3.js.map → ConfigEditor-444m13ta.js.map} +1 -1
- package/dist/{DsdiffParser-s0zvxnfa.js → DsdiffParser-gxqv4gn1.js} +3 -3
- package/dist/{DsdiffParser-s0zvxnfa.js.map → DsdiffParser-gxqv4gn1.js.map} +1 -1
- package/dist/{DsfParser-90mvzt4v.js → DsfParser-sndt4jbk.js} +3 -3
- package/dist/{DsfParser-90mvzt4v.js.map → DsfParser-sndt4jbk.js.map} +1 -1
- package/dist/FlacParser-rmkpvf9e.js +5 -0
- package/dist/{APEv2Parser-x13n424p.js.map → FlacParser-rmkpvf9e.js.map} +1 -1
- package/dist/{KeyProbe-fk5krzks.js → KeyProbe-6t531sy6.js} +3 -3
- package/dist/{KeyProbe-fk5krzks.js.map → KeyProbe-6t531sy6.js.map} +1 -1
- package/dist/{MP4Parser-nmvbkq21.js → MP4Parser-87xfsck4.js} +3 -3
- package/dist/{MP4Parser-nmvbkq21.js.map → MP4Parser-87xfsck4.js.map} +1 -1
- package/dist/{MatroskaParser-tsmz2qfq.js → MatroskaParser-7krspfgx.js} +3 -3
- package/dist/{MatroskaParser-tsmz2qfq.js.map → MatroskaParser-7krspfgx.js.map} +1 -1
- package/dist/{MpegParser-y5fjpaz9.js → MpegParser-jcs35q0h.js} +3 -3
- package/dist/{MpegParser-y5fjpaz9.js.map → MpegParser-jcs35q0h.js.map} +1 -1
- package/dist/{MusepackParser-544q0byg.js → MusepackParser-d4zfnzk3.js} +3 -3
- package/dist/{MusepackParser-544q0byg.js.map → MusepackParser-d4zfnzk3.js.map} +1 -1
- package/dist/{OggParser-v77rbjnt.js → OggParser-fbspjs7v.js} +3 -3
- package/dist/{OggParser-v77rbjnt.js.map → OggParser-fbspjs7v.js.map} +1 -1
- package/dist/{Picker-32m79nmp.js → Picker-x6aj42tc.js} +3 -3
- package/dist/{Picker-32m79nmp.js.map → Picker-x6aj42tc.js.map} +1 -1
- package/dist/{SessionPicker-9p06npt5.js → SessionPicker-pngdv97x.js} +3 -3
- package/dist/{SessionPicker-9p06npt5.js.map → SessionPicker-pngdv97x.js.map} +1 -1
- package/dist/{SkillBrowser-ezdx3xsh.js → SkillBrowser-3mnzkakr.js} +3 -3
- package/dist/{SkillBrowser-ezdx3xsh.js.map → SkillBrowser-3mnzkakr.js.map} +1 -1
- package/dist/{WavPackParser-k623m0hk.js → WavPackParser-0x9z4466.js} +3 -3
- package/dist/{WavPackParser-k623m0hk.js.map → WavPackParser-0x9z4466.js.map} +1 -1
- package/dist/{WaveParser-nj4p1vx8.js → WaveParser-31b6qtef.js} +3 -3
- package/dist/{WaveParser-nj4p1vx8.js.map → WaveParser-31b6qtef.js.map} +1 -1
- package/dist/{WizardApp-p350qspw.js → WizardApp-c42wc116.js} +3 -3
- package/dist/{WizardApp-p350qspw.js.map → WizardApp-c42wc116.js.map} +1 -1
- package/dist/{channels-a9zx9yba.js → channels-nf6d8fvx.js} +14 -14
- package/dist/{channels-a9zx9yba.js.map → channels-nf6d8fvx.js.map} +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +11 -11
- package/dist/client.js.map +4 -4
- package/dist/{config-3mz4zwsf.js → config-sx40rg8m.js} +21 -21
- package/dist/{config-3mz4zwsf.js.map → config-sx40rg8m.js.map} +1 -1
- package/dist/{credential-ja7zmd4c.js → credential-vdbkfk65.js} +5 -5
- package/dist/{credential-ja7zmd4c.js.map → credential-vdbkfk65.js.map} +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/{index-dcy14zdn.js → index-0dcpsfet.js} +5 -5
- package/dist/{index-dcy14zdn.js.map → index-0dcpsfet.js.map} +1 -1
- package/dist/{index-a1axc952.js → index-1h8s50d9.js} +4 -4
- package/dist/{index-a1axc952.js.map → index-1h8s50d9.js.map} +1 -1
- package/dist/{index-ayhdn87b.js → index-1hbvhrsj.js} +4 -4
- package/dist/{index-ayhdn87b.js.map → index-1hbvhrsj.js.map} +1 -1
- package/dist/{index-5gn74n56.js → index-1hfece7s.js} +7 -7
- package/dist/{index-5gn74n56.js.map → index-1hfece7s.js.map} +1 -1
- package/dist/{index-0dvs3a06.js → index-2h566rtg.js} +4 -4
- package/dist/{index-0dvs3a06.js.map → index-2h566rtg.js.map} +1 -1
- package/dist/{index-zzpgsbn3.js → index-4fj1k64j.js} +4 -4
- package/dist/{index-zzpgsbn3.js.map → index-4fj1k64j.js.map} +1 -1
- package/dist/{index-gezqawvw.js → index-4g4smpkk.js} +5 -5
- package/dist/{index-gezqawvw.js.map → index-4g4smpkk.js.map} +1 -1
- package/dist/index-4gfsf9n8.js +6 -0
- package/dist/{index-tc054tcb.js.map → index-4gfsf9n8.js.map} +1 -1
- package/dist/{index-mgef1n4e.js → index-5ptbytze.js} +9 -9
- package/dist/{index-mgef1n4e.js.map → index-5ptbytze.js.map} +1 -1
- package/dist/{index-f6r3h2yh.js → index-5s1cq8np.js} +5 -5
- package/dist/{index-f6r3h2yh.js.map → index-5s1cq8np.js.map} +1 -1
- package/dist/{index-rqfwd7j5.js → index-659ggfbf.js} +4 -4
- package/dist/{index-rqfwd7j5.js.map → index-659ggfbf.js.map} +1 -1
- package/dist/index-6ebppx3t.js +6 -0
- package/dist/{index-x9nn57kk.js.map → index-6ebppx3t.js.map} +1 -1
- package/dist/{index-4j65jp20.js → index-6pym9p8h.js} +6 -6
- package/dist/{index-4j65jp20.js.map → index-6pym9p8h.js.map} +1 -1
- package/dist/index-9ejax6hp.js +6 -0
- package/dist/{index-s0t15ndj.js.map → index-9ejax6hp.js.map} +1 -1
- package/dist/{index-86rb86nr.js → index-9hw9j1qg.js} +4 -4
- package/dist/{index-86rb86nr.js.map → index-9hw9j1qg.js.map} +1 -1
- package/dist/{index-yz0fcxky.js → index-9xhresrg.js} +4 -4
- package/dist/{index-yz0fcxky.js.map → index-9xhresrg.js.map} +1 -1
- package/dist/{index-2td5h856.js → index-abm0zyc0.js} +6 -6
- package/dist/{index-2td5h856.js.map → index-abm0zyc0.js.map} +1 -1
- package/dist/{index-8k8y7edx.js → index-ar5c9d2f.js} +5 -5
- package/dist/{index-8k8y7edx.js.map → index-ar5c9d2f.js.map} +1 -1
- package/dist/index-bhj4pmrx.js +74 -0
- package/dist/index-bhj4pmrx.js.map +13 -0
- package/dist/{index-brh25jhq.js → index-brt17yfr.js} +3 -3
- package/dist/{index-brh25jhq.js.map → index-brt17yfr.js.map} +1 -1
- package/dist/index-bysnsdkd.js +6 -0
- package/dist/{index-c6qrcweh.js.map → index-bysnsdkd.js.map} +1 -1
- package/dist/{index-kz01jz58.js → index-c74wx9pv.js} +4 -4
- package/dist/{index-kz01jz58.js.map → index-c74wx9pv.js.map} +1 -1
- package/dist/{index-qj4adnfe.js → index-cm3g4t3r.js} +9 -9
- package/dist/{index-qj4adnfe.js.map → index-cm3g4t3r.js.map} +1 -1
- package/dist/{index-8mkatm20.js → index-dzp6mc5h.js} +4 -4
- package/dist/{index-8mkatm20.js.map → index-dzp6mc5h.js.map} +1 -1
- package/dist/{index-b8bfzbfe.js → index-fad09b8c.js} +4 -4
- package/dist/{index-b8bfzbfe.js.map → index-fad09b8c.js.map} +1 -1
- package/dist/{index-2fw9e5gg.js → index-fvb2dxzn.js} +4 -4
- package/dist/{index-2fw9e5gg.js.map → index-fvb2dxzn.js.map} +1 -1
- package/dist/index-gpq4agva.js +5 -0
- package/dist/{index-635wcsh1.js.map → index-gpq4agva.js.map} +1 -1
- package/dist/index-hcpvk5de.js +5 -0
- package/dist/{index-7zgjkbb0.js.map → index-hcpvk5de.js.map} +1 -1
- package/dist/{index-s0f0s6n5.js → index-jv5t63tp.js} +4 -4
- package/dist/{index-s0f0s6n5.js.map → index-jv5t63tp.js.map} +1 -1
- package/dist/{index-60h4knj6.js → index-kyz4t0j0.js} +59 -59
- package/dist/{index-60h4knj6.js.map → index-kyz4t0j0.js.map} +1 -1
- package/dist/{index-7p8d1gf0.js → index-m6r2sxcw.js} +23 -23
- package/dist/{index-7p8d1gf0.js.map → index-m6r2sxcw.js.map} +1 -1
- package/dist/{index-4fajxhdv.js → index-mhw3d7af.js} +4 -4
- package/dist/{index-4fajxhdv.js.map → index-mhw3d7af.js.map} +1 -1
- package/dist/{index-h787rq0h.js → index-mk7hrzq7.js} +10 -10
- package/dist/{index-h787rq0h.js.map → index-mk7hrzq7.js.map} +1 -1
- package/dist/{index-r83jpct7.js → index-n0hqgwad.js} +4 -4
- package/dist/{index-r83jpct7.js.map → index-n0hqgwad.js.map} +1 -1
- package/dist/{index-k6wq0j4q.js → index-ncb840sk.js} +4 -4
- package/dist/{index-k6wq0j4q.js.map → index-ncb840sk.js.map} +1 -1
- package/dist/{index-8jejze0z.js → index-ntczmwnf.js} +3 -3
- package/dist/{index-8jejze0z.js.map → index-ntczmwnf.js.map} +1 -1
- package/dist/{index-ts8a1sdn.js → index-p5gy5s7p.js} +6 -6
- package/dist/{index-ts8a1sdn.js.map → index-p5gy5s7p.js.map} +1 -1
- package/dist/index-p86w0qjw.js +5 -0
- package/dist/{index-pz92ksp8.js.map → index-p86w0qjw.js.map} +1 -1
- package/dist/{index-cb45233h.js → index-qhh30m9p.js} +4 -4
- package/dist/{index-cb45233h.js.map → index-qhh30m9p.js.map} +1 -1
- package/dist/{index-z4adxmzm.js → index-rerdsr3d.js} +5 -5
- package/dist/{index-z4adxmzm.js.map → index-rerdsr3d.js.map} +1 -1
- package/dist/{index-67sfck4d.js → index-s0mfq8t7.js} +18 -18
- package/dist/index-s0mfq8t7.js.map +11 -0
- package/dist/{index-9k6qa50r.js → index-s9ybp2r1.js} +6 -6
- package/dist/{index-9k6qa50r.js.map → index-s9ybp2r1.js.map} +1 -1
- package/dist/index-ss77hvwy.js +1246 -0
- package/dist/{index-tv52jhac.js.map → index-ss77hvwy.js.map} +32 -31
- package/dist/{index-yy4v9kca.js → index-t9bnt6a1.js} +4 -4
- package/dist/{index-yy4v9kca.js.map → index-t9bnt6a1.js.map} +1 -1
- package/dist/{index-5zpfz4kb.js → index-w2ss9hn5.js} +7 -7
- package/dist/{index-5zpfz4kb.js.map → index-w2ss9hn5.js.map} +1 -1
- package/dist/{index-1cagdzqe.js → index-w80shmpv.js} +2 -2
- package/dist/index-w8e8qxd4.js +337 -0
- package/dist/index-w8e8qxd4.js.map +21 -0
- package/dist/{index-xyh98x7p.js → index-z9r4e0yq.js} +4 -4
- package/dist/{index-xyh98x7p.js.map → index-z9r4e0yq.js.map} +1 -1
- package/dist/{index-039ew35r.js → index-zj87j4j2.js} +4 -4
- package/dist/{index-039ew35r.js.map → index-zj87j4j2.js.map} +1 -1
- package/dist/{index-446exxcb.js → index-zmerx9rc.js} +7 -7
- package/dist/{index-446exxcb.js.map → index-zmerx9rc.js.map} +1 -1
- package/dist/{index-nndwx2wp.js → index-zqjtjs7c.js} +39 -39
- package/dist/{index-nndwx2wp.js.map → index-zqjtjs7c.js.map} +1 -1
- package/dist/index.js +318 -305
- package/dist/index.js.map +6 -5
- package/dist/lib/launchd.d.ts.map +1 -1
- package/dist/lib/service-env.d.ts.map +1 -1
- package/dist/lib/templates.d.ts.map +1 -1
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/watchdog.d.ts +20 -0
- package/dist/lib/watchdog.d.ts.map +1 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/sources.d.ts.map +1 -1
- package/dist/{web-7mdrcb8a.js → web-zvf80ns1.js} +5 -5
- package/dist/{web-7mdrcb8a.js.map → web-zvf80ns1.js.map} +1 -1
- package/dist/wire.js +11 -11
- package/dist/wire.js.map +4 -4
- package/dist/wrapper-5zhcdmnk.js +5 -0
- package/dist/{wrapper-4hdmdwft.js.map → wrapper-5zhcdmnk.js.map} +1 -1
- package/package.json +4 -4
- package/dist/APEv2Parser-x13n424p.js +0 -5
- package/dist/FlacParser-8xprykrh.js +0 -5
- package/dist/index-635wcsh1.js +0 -5
- package/dist/index-67sfck4d.js.map +0 -13
- package/dist/index-7zgjkbb0.js +0 -5
- package/dist/index-c6qrcweh.js +0 -6
- package/dist/index-hd5nkwd7.js +0 -74
- package/dist/index-hd5nkwd7.js.map +0 -13
- package/dist/index-n197qdw1.js +0 -308
- package/dist/index-n197qdw1.js.map +0 -21
- package/dist/index-pz92ksp8.js +0 -5
- package/dist/index-s0t15ndj.js +0 -6
- package/dist/index-tc054tcb.js +0 -6
- package/dist/index-tv52jhac.js +0 -1252
- package/dist/index-x9nn57kk.js +0 -6
- package/dist/wrapper-4hdmdwft.js +0 -5
- /package/dist/{index-1cagdzqe.js.map → index-w80shmpv.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/agents.ts", "../src/init.ts", "../src/lib/init-skills.ts", "../src/lib/measure-window.ts", "../src/lib/owner.ts", "../src/lib/provision.ts", "../src/lib/stdin-tap.ts", "../src/lib/terminal.ts", "../src/keys.ts", "../src/lib/help.ts", "../src/lib/interface-missing.ts", "../src/lib/secret-files.ts", "../src/lib/warnings.ts", "../src/memory.ts", "../src/lib/probe.ts", "../src/model.ts", "../src/owner.ts", "../src/plugins.ts", "../../core/dist/testing/index.js", "../src/lib/plugin-install.ts", "../src/remove.ts", "../src/lib/remove-plan.ts", "../src/stop.ts", "../src/restart.ts", "../src/run.ts", "../../client/dist/index.js", "../src/lib/resume.ts", "../src/lib/source.ts", "../src/schedules.ts", "../src/serve.ts", "../src/lib/agent-secrets.ts", "../src/lib/agent-template.ts", "../src/lib/relay-client.ts", "../src/sessions.ts", "../src/soul.ts", "../src/sources.ts", "../src/start.ts", "../src/status.ts", "../src/terminal-setup.ts", "../src/tools.ts", "../src/validate.ts", "../src/workspace.ts", "../src/index.ts"],
|
|
3
|
+
"sources": ["../src/agents.ts", "../src/init.ts", "../src/lib/init-skills.ts", "../src/lib/measure-window.ts", "../src/lib/owner.ts", "../src/lib/provision.ts", "../src/lib/stdin-tap.ts", "../src/lib/terminal.ts", "../src/keys.ts", "../src/lib/help.ts", "../src/lib/interface-missing.ts", "../src/lib/secret-files.ts", "../src/lib/warnings.ts", "../src/memory.ts", "../src/lib/probe.ts", "../src/model.ts", "../src/owner.ts", "../src/plugins.ts", "../../core/dist/testing/index.js", "../src/lib/plugin-install.ts", "../src/remove.ts", "../src/lib/remove-plan.ts", "../src/stop.ts", "../src/restart.ts", "../src/run.ts", "../../client/dist/index.js", "../src/lib/resume.ts", "../src/lib/source.ts", "../src/schedules.ts", "../src/serve.ts", "../src/lib/agent-secrets.ts", "../src/lib/agent-template.ts", "../src/lib/relay-client.ts", "../src/lib/watchdog.ts", "../src/sessions.ts", "../src/soul.ts", "../src/sources.ts", "../src/start.ts", "../src/status.ts", "../src/terminal-setup.ts", "../src/tools.ts", "../src/validate.ts", "../src/workspace.ts", "../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * `agents` — what is in the sandbox, and whether anything is serving it.\n *\n * Bare, it lists every agent the sandbox holds: the question \"what agents do I have\" had no\n * command until 0.1.3 — `agents` required manifest paths, `serve` defaulted to the sandbox, and\n * the listing lived only inside `run`'s picker. Given paths or names, it boots a runtime over them\n * and describes each in full, which is the older shape and still the one that proves one process\n * hosts N agents.\n */\n\nimport { processAlive, Runtime } from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { EXIT_OK } from \"#lib/const\"\nimport { onExit } from \"#lib/exit\"\nimport { agentStateOf, liveHosts } from \"#lib/lifecycle\"\nimport {\n BUILT_IN_PLUGINS,\n CHANNELS,\n MEDIA_PROVIDERS,\n MODEL_TRANSPORTS,\n scriptRunner,\n TOOL_PROVIDERS,\n} from \"#lib/providers\"\nimport { duration, keyValue, type Row } from \"#lib/render\"\nimport { listAgents, pluginRoot, type SandboxAgent, storePath } from \"#lib/sandbox\"\nimport type { AgentsOptions } from \"#lib/schema\"\n\nexport interface SandboxAgentStatus extends SandboxAgent {\n /** `false` when `stop <agent>` switched it off durably. */\n readonly enabled: boolean\n readonly reason?: string\n /** `serving · <mode> · pid N · up …` from the lease, when a live process holds it. */\n readonly serving?: string\n readonly pid?: number\n}\n\n/** Every sandbox agent with its durable switch and its live host, from the lease table. */\nexport async function sandboxAgents(store?: string): Promise<readonly SandboxAgentStatus[]> {\n const hosts = await liveHosts(store)\n const out: SandboxAgentStatus[] = []\n for (const agent of listAgents()) {\n const id = agent.id ?? agent.ref\n const state = (await agentStateOf(id, store)) ?? { enabled: true }\n const lease = hosts.find((row) => row.agentId === id)\n const since = lease === undefined ? Number.NaN : Date.now() - Date.parse(lease.startedAt)\n out.push({\n ...agent,\n enabled: state.enabled,\n ...(state.reason === undefined ? {} : { reason: state.reason }),\n ...(lease === undefined\n ? {}\n : {\n pid: lease.pid,\n serving: `serving · ${lease.mode} · pid ${lease.pid}${\n Number.isFinite(since) ? ` · up ${duration(since)}` : \"\"\n }`,\n }),\n })\n }\n return out\n}\n\nexport function agentRows(agents: readonly SandboxAgentStatus[]): readonly Row[] {\n if (agents.length === 0) {\n return [{ label: \"agents\", value: \"none in the sandbox\", note: \"init creates one\" }]\n }\n return agents.map((agent) => ({\n label: agent.ref,\n value: agent.problem !== undefined ? \"broken\" : agent.enabled ? \"on\" : \"off\",\n note:\n agent.problem ??\n agent.serving ??\n (agent.enabled\n ? `not hosted${agent.modelId === undefined ? \"\" : ` · ${agent.modelId}`}`\n : `switched off${agent.reason === undefined ? \"\" : ` — ${agent.reason}`}`),\n }))\n}\n\nexport async function agentsCommand(options: AgentsOptions): Promise<number> {\n if (options.manifestPaths.length === 0) {\n const agents = await sandboxAgents(options.store)\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify({ agents }, null, 2)}\\n`)\n } else {\n process.stdout.write(`${keyValue(agentRows(agents))}\\n`)\n }\n return EXIT_OK\n }\n\n const runtime = await Runtime.create({\n agents: [...options.manifestPaths],\n toolProviders: TOOL_PROVIDERS,\n modelTransports: MODEL_TRANSPORTS,\n mediaProviders: MEDIA_PROVIDERS,\n builtInPlugins: BUILT_IN_PLUGINS,\n pluginRoot: pluginRoot(),\n scriptRunner: scriptRunner(),\n channels: CHANNELS,\n env: ambientEnv(options.manifestPaths),\n // The shared store, so the lease rows below are visible at all — and `lease: false`, so\n // looking does not briefly claim one and refuse a `serve` starting in the same instant.\n store: options.store ?? storePath(),\n lease: false,\n })\n onExit(() => runtime.stop(\"cli-exit\"))\n\n const described = runtime.list().map((agent) => agent.describe())\n // Whether anything is actually serving each one, read from the runtime lease. That row is\n // written by whichever process holds the agent, so this cannot disagree with reality the way a\n // separate registry would — and it answers in a container, where there is no service manager\n // to ask. A row is a claim rather than a fact, so the pid is checked before it is believed.\n const serving = new Map<string, string>()\n for (const lease of await runtime.store.leases.all()) {\n if (lease.runtimeId === runtime.runtimeId || !processAlive(lease.pid)) continue\n const since = Date.now() - Date.parse(lease.startedAt)\n serving.set(\n lease.agentId,\n `serving · ${lease.mode} · pid ${lease.pid}${\n Number.isFinite(since) ? ` · up ${duration(since)}` : \"\"\n }`,\n )\n }\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify(\n {\n agents: described.map((agent) => ({\n ...agent,\n serving: serving.get(agent.id) ?? null,\n })),\n },\n null,\n 2,\n )}\\n`,\n )\n return EXIT_OK\n }\n\n // Padded columns, like every other command. This was the one place still emitting tabs, which\n // made the same product look like two depending on which command you had just run.\n const rows: Row[] = described.map((agent) => ({\n label: agent.id,\n value: `${agent.model} ${String(agent.window).padStart(7)} window`,\n note: serving.get(agent.id) ?? agent.name,\n }))\n process.stdout.write(`${keyValue(rows)}\\n`)\n return EXIT_OK\n}\n",
|
|
6
6
|
"/**\n * `init [dir]` — one command from installed binary to an agent that answers.\n *\n * Interactive at a terminal, flag-driven everywhere else, and the same flow either way: the\n * questions live in `lib/init-flow.ts` as pure data, this file just asks them. Non-interactive\n * runs (`--yes`, a pipe, CI) take each question's default and refuse — naming the missing flags —\n * when a question has none, because inventing an agent name is not a default, it is a guess.\n *\n * Nothing is written over an existing file, there is no `--force`, and the wizard never asks for\n * the API key itself: typing a secret into a prompt invites shoulder-surfing, and passing one as\n * a flag writes it into shell history. The generated `.env` carries an empty `KEY=` line and the\n * next-steps block says to fill it.\n *\n * Before exiting 0 the generated directory is validated with the *real* loader — the same\n * sequence `validate` runs — so a template bug is this command's failure, never the user's first.\n */\n\nimport { basename, dirname, join, resolve } from \"node:path\"\nimport { BRAND, HarnessError, isHarnessError, SqliteStore, VERSION } from \"@dispach/core\"\nimport { installRefs } from \"#browse\"\nimport { announce } from \"#lib/bootstrap\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { markTerminalDirty, onExit } from \"#lib/exit\"\nimport { adoptOnHost, ensureHost, type HostPairOutcome, waitForPairing } from \"#lib/host-actions\"\nimport {\n COMPOSIO_KEY_ENV,\n composioEnabled,\n type InitAnswers,\n type InitStep,\n planFiles,\n type QuestionDefaults,\n SKILLS_CHOICES,\n slugify,\n TELEGRAM_TOKEN_ENV,\n validateAnswer,\n webBackendByValue,\n} from \"#lib/init-flow\"\nimport { findAndInstallSkill } from \"#lib/init-skills\"\nimport { type PairOutcome, pairLater, pairWhatsApp } from \"#lib/init-whatsapp\"\nimport { negotiateKeyboard } from \"#lib/keyboard\"\nimport { measuredWindow } from \"#lib/measure-window\"\nimport { resolveModeFromProcess } from \"#lib/output\"\nimport { claimManifest } from \"#lib/owner\"\nimport { checkAgentLoads, complete, FLAG_FOR, fillDefaults, writeAgentFiles } from \"#lib/provision\"\nimport { agentsDir, insideSandbox, outsideSandboxNote, storePath } from \"#lib/sandbox\"\nimport type { InitOptions } from \"#lib/schema\"\nimport { webUrl } from \"#lib/web-url\"\n\n/** Which flag supplies each step, for the refusal that names what is missing. */\n\nexport type InitResult =\n | { readonly kind: \"ok\"; readonly manifestPath: string }\n | { readonly kind: \"aborted\" }\n | { readonly kind: \"failed\"; readonly code: number }\n\n/** The variable `web_search` will read, or undefined when this agent does not search. */\nfunction searchKeyVar(answers: InitAnswers): string | undefined {\n if (answers.web !== \"search\") return undefined\n return webBackendByValue(answers.webBackend ?? \"tavily\")?.apiKeyEnv\n}\n\nexport async function initCommand(options: InitOptions): Promise<number> {\n const result = await runInit(options)\n if (result.kind === \"aborted\") {\n process.stdout.write(\"nothing written\\n\")\n return EXIT_OK\n }\n return result.kind === \"failed\" ? result.code : EXIT_OK\n}\n\n/**\n * The same flow, returning the created manifest's path — the picker's \"create a new agent\" chains\n * straight into `run` through this, so there is exactly one wizard entry point.\n */\nexport async function initInteractive(options: InitOptions): Promise<InitResult> {\n return runInit(options)\n}\n\nasync function runInit(options: InitOptions): Promise<InitResult> {\n const partial = fromFlags(options)\n\n // Interactive only when `run` would have rendered rich: both streams are terminals and\n // nothing (CI, NO_COLOR, --plain, a dumb TERM) asked for scriptable behaviour. `--yes` opts\n // out even at a terminal.\n const decision = resolveModeFromProcess({\n json: false,\n plain: options.plain === true,\n oneShot: false,\n })\n const interactive = decision.mode === \"rich\" && options.yes !== true\n\n // The dir question defaults into the home sandbox, computed here because the flow module is\n // pure and may not touch the filesystem or environment. An explicit [dir] still overrides.\n const defaults = { agentDirBase: agentsDir() }\n\n if (interactive) {\n // The Ink wizard, lazily — the renderer must never be paid for by a flag-driven run.\n // Its confirm screen replaces the readline summary too: undefined means the person\n // backed out, and nothing is written.\n const collected = await runWizard(partial, defaults)\n if (collected === undefined) return { kind: \"aborted\" }\n Object.assign(partial, collected)\n } else {\n fillDefaults(\n partial,\n options.yes === true ? \"--yes was passed\" : decision.because,\n defaults,\n )\n }\n\n // Asked once, here, and never at boot: the endpoint's own window beats the registry's guess by\n // model id (decision 14.124). Unknown is fine; the registry stays in charge.\n const completed = complete(partial, defaults)\n const keyForProbe =\n completed.apiKey ??\n (completed.apiKeyEnv === undefined ? undefined : process.env[completed.apiKeyEnv])\n // Only when someone is at the keyboard or asked for it: `init --yes` and a pipe reach no network.\n // Not probed for Bedrock: the probe speaks chat-completions, and there is no URL to ask.\n const window =\n (interactive || options.measureWindow === true) && completed.baseUrl !== \"\"\n ? await measuredWindow(completed.baseUrl, completed.model, {\n ...(keyForProbe === undefined || keyForProbe === \"\"\n ? {}\n : { apiKey: keyForProbe }),\n })\n : undefined\n const answers = completed\n const targetDir = resolve(process.cwd(), answers.dir)\n\n // Said before anything is written, not after: the cost of an out-of-sandbox agent is paid by\n // every later command, and the only moment it is cheap to reconsider is now. Never a refusal —\n // an agent living in a project checkout is a real thing to want, and the failure this replaces\n // was silence, not permission.\n const note = outsideSandboxNote(targetDir)\n if (note !== undefined) process.stderr.write(`${note}\\n`)\n const manifestPath = join(targetDir, \"agent.yaml\")\n const files = planFiles(answers, window)\n\n // Per-target checks rather than \"directory not empty\": a fresh `git init`'d directory must\n // work, and the refusal names every collision at once rather than one per run.\n // The one writer, shared with `POST /v1/agents`. Two would be the shape this repo keeps\n // paying for: right when written, divergent at the next change, with the symptom being an\n // agent that works when created one way and not the other.\n writeAgentFiles(targetDir, files)\n\n // The real loader, on the real output. The one concession: when the named key var is not in\n // the environment yet — the normal case, the next-steps block is about to say \"set it\" — it\n // is stubbed so `validateApiKeyEnv` passes while every structural check (schema, budgets,\n // tiers, rule guard, rendering) runs for real. When the var is already exported, no stub:\n // a full honest validate.\n // Hoisted out of the try below, because installing a skill needs the same stub: a manifest written\n // sixty milliseconds ago names a key variable whose line is deliberately empty, so *every* load during\n // init has to tolerate it, not just this one.\n const keyVar = answers.apiKeyEnv\n const needsStub =\n keyVar !== undefined &&\n answers.apiKey === undefined &&\n (process.env[keyVar] === undefined || process.env[keyVar] === \"\")\n const envOverlay = needsStub && keyVar !== undefined ? { [keyVar]: \"(pending)\" } : undefined\n\n let distilled = false\n try {\n distilled = checkAgentLoads(join(targetDir, \"agent.yaml\"), envOverlay).distilled\n } catch (error) {\n // The files stay on disk — they are inspectable evidence — but the exit is a failure and\n // the loader's own report is printed verbatim. A generated agent that cannot load is this\n // command's bug, and hiding it behind exit 0 would be rule 8's exact shape.\n if (isHarnessError(error)) {\n process.stderr.write(\n `init wrote ${files.length} files to ${targetDir}, but the result does not load:\\n${error.format()}\\n`,\n )\n return { kind: \"failed\", code: EXIT_FAILURE }\n }\n throw error\n }\n\n // Installed *before* the next steps are printed, so the last screen can say what happened\n // rather than instructing someone to do the thing that just happened. The first version had it\n // the other way round and read as a contradiction.\n //\n // The very first version did not install at all, reasoning that the .env would still be empty\n // and the install check would refuse. True of a scripted `--yes` run and false of the one that\n // matters: at a terminal the wizard *asks* for the bot token and writes it, so by this line the\n // agent is complete. Telling someone who just answered \"yes, keep it running\" to go and type\n // another command is answering a question with homework.\n //\n // Guarded rather than assumed — `daemon install` runs its own checks and refuses if something\n // is missing, and a refusal falls back to naming the command. The one outcome that must not\n // happen is a silent skip after somebody said yes.\n process.stdout.write(`wrote ${files.length} files to ${targetDir} — validated ok\\n`)\n\n // After the load check, so a skill is only ever added to an agent already known to be valid; before\n // the service install, so what gets started is the finished agent rather than one a skill lands in a\n // second later. Cannot fail the init: every failure path inside reports and returns.\n //\n // Nothing is *chosen* here. At a terminal the wizard already showed the catalogue between two of its\n // questions and collected refs into `skillsPick`; this installs them, with one summary rather than one\n // report per skill. A scripted run has no picker, so `--skills \"<phrase>\"` ranks and installs the best\n // match instead — the same interactive/scripted split this command makes everywhere else.\n if (answers.skills === \"find\") {\n const refs = (answers.skillsPick ?? \"\")\n .split(\",\")\n .map((ref) => ref.trim())\n .filter((ref) => ref !== \"\")\n if (refs.length > 0) {\n installRefs(refs, manifestPath, {\n ...(envOverlay === undefined ? {} : { envOverlay }),\n })\n } else if (!interactive) {\n await findAndInstallSkill({\n answers,\n manifestPath,\n ...(envOverlay === undefined ? {} : { envOverlay }),\n })\n }\n }\n\n await claimForOwner(manifestPath, targetDir, defaults.agentDirBase)\n\n /**\n * The host first, then the channel — because the host is what pairs it.\n *\n * When the answer was \"keep it running\", the server is put up now (the same bootstrap every\n * host-wanting command uses, so a unit installed here and one installed by `daemon install` are\n * the same unit) and asked to adopt the agent that was just written. WhatsApp then pairs\n * **through that host**: it holds the socket, so when the phone accepts, the session is already\n * in the process that will answer. No reload, no second command — which is the dead end this\n * replaces, where `init` paired in its own process and the next line said to go and run `serve`.\n *\n * Without a host — `--daemon none`, a container, CI, no installer — pairing happens in this\n * process as before and the closing screen names what to run. Neither path can fail the init;\n * every branch reports and returns. And pairing is skipped without a terminal, because a\n * scripted run has nobody to read a code.\n */\n let hostUrl: string | undefined\n if (answers.daemon === \"service\") {\n process.stdout.write(\"\\n\")\n const { outcome, host } = await ensureHost({\n ...(options.installServer === undefined ? {} : { install: options.installServer }),\n })\n const note = announce(outcome)\n if (note !== undefined) process.stderr.write(note)\n if (host?.baseUrl !== undefined) {\n const adopted = await adoptOnHost(host, manifestPath)\n if (adopted.ok) hostUrl = host.baseUrl\n else\n process.stderr.write(\n `pid ${host.pid} did not adopt ${slugify(answers.name)}${\n adopted.detail === undefined ? \"\" : `: ${adopted.detail}`\n }\\n`,\n )\n }\n }\n\n let paired: PairOutcome | HostPairOutcome | undefined\n if (answers.whatsapp === \"connected\" && (answers.whatsappNumber ?? \"\") !== \"\" && interactive) {\n paired =\n hostUrl !== undefined\n ? await waitForPairing({ manifestPath, channelId: \"wa\" })\n : await pairWhatsApp({\n manifestPath,\n dir: targetDir,\n number: answers.whatsappNumber ?? \"\",\n channelId: \"wa\",\n })\n }\n\n // Named only when it did not finish here, so the closing block never tells somebody to go and\n // type a code they have already used.\n if (answers.whatsapp === \"connected\" && paired !== \"paired\")\n process.stdout.write(`\\n${pairLater(slugify(answers.name))}`)\n process.stdout.write(nextSteps(answers, targetDir, distilled, hostUrl))\n return { kind: \"ok\", manifestPath: join(targetDir, \"agent.yaml\") }\n}\n\n/**\n * Make the person running `init` this agent's owner (decision 15.7), before any host adopts it, so it\n * boots owned: the manifest just written says `sessions.scope: owner`, and an owner scope with nobody\n * assigned is one conversation per surface plus a warning.\n *\n * Only inside the sandbox, whose store is the one the sandbox's agents run on and whose path a test\n * redirects. An agent written elsewhere is told the command that does it, and never fails the init:\n * every agent on disk is a complete agent, owned or not.\n */\nasync function claimForOwner(\n manifestPath: string,\n targetDir: string,\n agentsBase: string,\n): Promise<void> {\n const id = basename(targetDir)\n if (!insideSandbox(targetDir)) {\n process.stdout.write(\n `\\nTo make it yours across every surface: ${BRAND.slug} owner adopt ${manifestPath}\\n`,\n )\n return\n }\n let store: SqliteStore | undefined\n try {\n store = await SqliteStore.open({ path: storePath() })\n await claimManifest(store, manifestPath, agentsBase)\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error)\n process.stderr.write(\n `could not record you as ${id}'s owner: ${detail}\\n hint: run \\`${BRAND.slug} owner adopt ${id}\\` once the store is reachable.\\n`,\n )\n } finally {\n await store?.close()\n }\n}\n\n/**\n * `--skills` as a choice, or as a search phrase.\n *\n * `--skills starter` and `--skills none` are the choices; `--skills \"pdf tables\"` means \"find one\", with\n * those words. Told apart by membership in `SKILLS_CHOICES` rather than by shape, so the set of choices\n * stays the only thing that decides — and a phrase is never mistaken for a mistyped choice, because a\n * mistyped choice becomes a search that reports finding nothing rather than silently doing something else.\n */\nfunction skillsPair(raw: string | undefined): [InitStep, string | undefined][] {\n if (raw === undefined) return []\n if (SKILLS_CHOICES.some((choice) => choice.value === raw)) return [[\"skills\", raw]]\n return [\n [\"skills\", \"find\"],\n [\"skillsSearch\", raw],\n ]\n}\n\n/** Flag values pass the same per-step validation the wizard applies — a bad flag fails by name. */\nfunction fromFlags(options: InitOptions): Partial<Record<InitStep, string>> {\n const given: Partial<Record<InitStep, string>> = {}\n const pairs: readonly [InitStep, string | undefined][] = [\n [\"user\", options.user],\n [\"name\", options.name],\n [\"purpose\", options.purpose],\n [\"preset\", options.preset],\n [\"model\", options.model],\n [\"baseUrl\", options.baseUrl],\n [\"region\", options.region],\n [\"apiKeyEnv\", options.apiKeyEnv],\n [\"system\", options.system],\n [\"web\", options.web],\n [\"webBackend\", options.webBackend],\n [\"composio\", options.composio],\n [\"telegram\", options.telegram],\n [\"telegramAllow\", options.telegramAllow],\n [\"whatsapp\", options.whatsapp],\n [\"whatsappNumber\", options.whatsappNumber],\n [\"server\", options.server],\n [\"schedules\", options.schedules],\n // `--skills` takes a choice name *or* the words to search for, and the sugar is here rather than\n // in `validateAnswer` so the per-step validation stays strict — a flag that quietly accepted\n // anything is a flag that mistypes `startr` into a search query for \"startr\".\n ...skillsPair(options.skills),\n [\"daemon\", options.daemon],\n [\"dir\", options.dir],\n ]\n for (const [step, raw] of pairs) {\n if (raw === undefined) continue\n const checked = validateAnswer(step, raw)\n if (!checked.ok) {\n throw new HarnessError({\n code: \"cli_init_flag_invalid\",\n message: `${FLAG_FOR[step]} is ${JSON.stringify(raw)}, which ${checked.reason}`,\n hint: \"The flags take the same values the interactive questions do; run the command at a terminal without flags to be walked through them.\",\n })\n }\n given[step] = checked.value\n }\n return given\n}\n\n/**\n * The Ink wizard, mounted lazily — the renderer must never be paid for by a flag-driven run.\n *\n * Same shape as run.ts's rich path: literal `import(\"ink\")`, `markTerminalDirty()` before the\n * render, `exitOnCtrlC: false` (the wizard owns ^C as abort), `onExit` unmount. The component\n * calls `onDone` with the collected answers (or undefined on abort) and exits itself; the value\n * is read after `waitUntilExit`.\n */\nasync function runWizard(\n partial: Partial<Record<InitStep, string>>,\n defaults: QuestionDefaults,\n): Promise<Partial<Record<InitStep, string>> | undefined> {\n const [{ render }, { createElement }, { WizardApp }] = await Promise.all([\n import(\"ink\"),\n import(\"react\"),\n import(\"#components/WizardApp\"),\n ])\n\n let collected: Partial<Record<InitStep, string>> | undefined\n markTerminalDirty()\n const instance = render(\n createElement(WizardApp, {\n title: `${BRAND.name} ${VERSION}`,\n given: partial,\n defaults,\n onDone: (answers) => {\n collected = answers\n },\n }),\n { exitOnCtrlC: false, ...negotiateKeyboard() },\n )\n onExit(() => instance.unmount())\n await instance.waitUntilExit()\n instance.unmount()\n return collected\n}\n\nfunction nextSteps(\n answers: InitAnswers,\n targetDir: string,\n distilled: boolean,\n /** The address of the host now serving this agent, when the service is up and adopted it. */\n hostUrl?: string,\n): string {\n const installed = hostUrl !== undefined\n // An agent inside the sandbox runs by bare name from anywhere; anything else by path.\n const inSandbox = dirname(targetDir) === agentsDir()\n const runRef = inSandbox ? basename(targetDir) : join(targetDir, \"agent.yaml\")\n const manifest = join(targetDir, \"agent.yaml\")\n\n const steps: string[] = []\n // Only when there is genuinely nothing to run with. Telling someone to add a key they just\n // typed in is the kind of instruction people learn to skip past.\n if (answers.apiKeyEnv !== undefined && answers.apiKey === undefined) {\n steps.push(`Add your key: edit ${join(targetDir, \".env\")} and set ${answers.apiKeyEnv}=`)\n }\n // Same rule as the model key: only when there is genuinely nothing to search with. A search\n // agent whose key is blank starts fine and fails at the first web_search naming the variable —\n // which is the right failure and a poor first impression if nobody said so here.\n const searchVar = searchKeyVar(answers)\n if (searchVar !== undefined && answers.webKey === undefined) {\n steps.push(\n `Add your search key: edit ${join(targetDir, \".env\")} and set ${searchVar}= — web_fetch works without it, web_search does not`,\n )\n }\n // The key, and only the key. Discovering and connecting an app is now something to *ask the\n // agent for* rather than a setup chore — which is the whole change, so a next step telling\n // someone to go and warm a cache would be describing the flow this replaced.\n if (composioEnabled(answers) && answers.composioKey === undefined) {\n steps.push(\n `Add your Composio key: edit ${join(targetDir, \".env\")} and set ${COMPOSIO_KEY_ENV}=`,\n )\n }\n // The bot token, and only when it is genuinely missing. A channel whose token is blank fails\n // the *load* — the factory reads it at boot — so this is not a first-turn surprise, it is a\n // `serve` that will not start at all.\n if (answers.telegram === \"connected\" && answers.telegramToken === undefined) {\n steps.push(\n `Add your bot token: message @BotFather with /newbot, then edit ` +\n `${join(targetDir, \".env\")} and set ${TELEGRAM_TOKEN_ENV}=`,\n )\n }\n // `run` never starts a channel and never binds a port, so an agent configured for either has a\n // second thing to know. Said here rather than discovered — the whole reason these capabilities\n // became questions is that a generated file was hiding them. One step rather than two once the\n // service is up: \"run it\" and \"and by the way run starts nothing\" are the same sentence, and\n // printing both made steps 1 and 2 read as duplicates of each other.\n const channels = [\n ...(answers.telegram === \"connected\" ? [\"the Telegram bot\"] : []),\n ...(answers.whatsapp === \"connected\" ? [\"WhatsApp\"] : []),\n ]\n const reachable = channels.length > 0 || answers.server === \"local\"\n const what = [...channels, ...(answers.server === \"local\" ? [\"the HTTP API\"] : [])].join(\n \" and \",\n )\n if (installed) {\n // Already serving — so the first thing to do is talk to it, and the browser is the surface\n // that needs no second terminal. The URL is the deliverable; `web` prints the same one.\n steps.push(\n `open ${webUrl(hostUrl, basename(targetDir))} — the web UI. The service is serving ` +\n `${basename(targetDir)} now; ${what} ${channels.length + (answers.server === \"local\" ? 1 : 0) === 1 ? \"is\" : \"are\"} up.`,\n )\n steps.push(`${BRAND.slug} run ${runRef} — talks to it here, attached to that same service.`)\n } else {\n steps.push(`${BRAND.slug} run ${runRef}`)\n }\n if (reachable && !installed) {\n steps.push(`${BRAND.slug} serve ${runRef} — starts ${what}; \\`run\\` starts neither`)\n // And the half `serve` does not cover: it lives and dies with its terminal. Only when the\n // service did not come up here — printed unconditionally it read as a contradiction, a\n // next step telling you to run the command whose output was two lines above.\n if (answers.daemon === \"service\") {\n steps.push(\n `${BRAND.slug} daemon install — the same thing, supervised: one service hosts ` +\n `every agent, starts at login and survives a reboot.`,\n )\n }\n }\n if (answers.telegram === \"connected\" && answers.telegramAllow === undefined) {\n steps.push(\n `Message the bot. Nobody is on its allowFrom yet, so it will refuse you — and print ` +\n `the exact line to paste into agent.yaml.`,\n )\n }\n if (composioEnabled(answers)) {\n steps.push(\n `Ask it for an app — \"connect my Gmail\" — and it finds the tools, gives you the ` +\n `sign-in link, and pins what you need. New tools go live on the next restart.`,\n )\n }\n // Named here whatever was answered, because this is the one screen everybody reads and the sources\n // registry was otherwise reachable only by someone who already knew the word `sources`. The line\n // changes with the answer: somebody who now has a real skill wants \"add another\", somebody holding a\n // template wants \"or take a real one\", and somebody who declined wants to know the option exists.\n steps.push(\n answers.skills === \"find\"\n ? `Add more skills: \\`${BRAND.slug} sources search <what it should do>\\` ranks every skill in the catalogues, then \\`${BRAND.slug} skills install ${runRef} <source>/<skill>\\`.`\n : answers.skills === \"starter\"\n ? `Fill in workspace-level skills/starter/SKILL.md, or take a real one — \\`${BRAND.slug} sources search <what it should do>\\` searches the configured catalogues.`\n : `Skills are off but the directory is there — \\`${BRAND.slug} sources search <what it should do>\\` finds one, \\`${BRAND.slug} skills new ${runRef} <name>\\` writes one.`,\n )\n steps.push(\n `Make workspace/SOUL.md yours, then re-derive SOUL.compact.md to match — ` +\n `\\`${BRAND.slug} workspace ${manifest}\\` shows exactly what still reads as a template.`,\n )\n\n // Said before the numbered list, because it changes what the list means: with a service\n // installed, `serve` is not something you need to run and the agent is already answering.\n const serviceNote = installed\n ? `\\nit is running in the background now — \\`${BRAND.slug} status\\` at any time,\\n\\`${BRAND.slug} restart ${runRef}\\` after editing it, and \\`${BRAND.slug} stop\\` turns everything off.\\n`\n : \"\"\n\n const soulNote = distilled\n ? `\\nthis model ships SOUL.compact.md — the full SOUL.md needs a 200k+ window on a\\nfrontier-class model, and activates automatically if you upgrade.\\n`\n : \"\"\n\n return (\n `${soulNote}${serviceNote}\\n` +\n steps.map((step, index) => ` ${index + 1}. ${step}\\n`).join(\"\")\n )\n}\n",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"/**\n * `model probe` — ask the endpoint what it can actually do, instead of guessing from its name.\n *\n * Every `init` preset's default model has an unverified context window and nothing has ever said so.\n * `deepseek-v4-pro` is declared at 393,216 against a published 1,048,576, and `claude-*` is one\n * registry row for every Claude model ever released.\n *\n * The third suspicion this was built on turned out to be wrong, which is worth keeping written down:\n * `promptCache: \"none\"` on every `deepseek-*` row looked like a cost bug, and the registry comment\n * beside those rows had already answered it — the field says the *runtime* places no breakpoints, not\n * that the provider does not cache. The first live run measured 1024 of 1115 prompt tokens cached, so\n * the comment was right and the alarm was not. Nothing in core reads the field at all today; its only\n * consumer is a line of `validate`'s output.\n *\n * ## What it costs, and why the order is what it is\n *\n * Two of the four techniques are free. `GET /models` is a metadata read. The over-range `max_tokens`\n * request is **refused before a token is generated**, so it is billed for nothing — which is what\n * makes it the best technique here rather than merely a clever one: it asks the endpoint to state its\n * own limit and the endpoint answers in the error message.\n *\n * The caching probe sends two small calls, and is the only way to answer a question no endpoint\n * exposes directly. The window search is behind `--window` because it is the one that spends real\n * money, and it prints what it will spend before it spends it.\n *\n * ## Every role, not just main\n *\n * An agent can run three models on three endpoints, and until Phase 7D only main's window was\n * reported anywhere at all. A compactor quietly running on `CONSERVATIVE`'s 8,192 is the configuration\n * decision 12.x calls *\"the intended production shape and usually the biggest available cost win\"*, so\n * it is exactly the one that must not be silently wrong. Roles that fall back to main are skipped\n * rather than probed twice — they are the same endpoint and the same model.\n */\n\nimport {\n bearerHeaders,\n editManifest,\n endpointUrl,\n isHarnessError,\n loadManifest,\n modelsUrl,\n windowReport,\n} from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { askYesNo } from \"#lib/confirm\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport {\n bestFinding,\n type CacheFinding,\n cacheFromUsage,\n cacheVerdict,\n ceilingFromRefusal,\n contextFromModels,\n measuredComment,\n type RoleProbe,\n registryRow,\n searchCost,\n type WindowFinding,\n} from \"#lib/probe\"\nimport { keyValue, section } from \"#lib/render\"\n\n/**\n * A `max_tokens` no endpoint can honour, chosen to be refused rather than clamped.\n *\n * Large enough that nothing serves it, small enough to stay inside a 32-bit signed integer — a value\n * past that is rejected by some gateways as a *type* error, whose message names no limit and answers\n * nothing.\n */\nconst IMPOSSIBLE_MAX_TOKENS = 2_000_000_000\n\n/**\n * The prefix length the caching probe repeats.\n *\n * Vendors that document a minimum cacheable prefix put it in the hundreds of tokens, so a two-word\n * probe would report \"no caching\" for every endpoint on earth and the negative would be worthless.\n * This is deliberately over that line and still costs a fraction of a cent.\n */\nconst CACHE_PREFIX_TOKENS = 1024\n\n/** Where a `--window` search starts, and the ceiling it refuses to climb past without being asked. */\nconst SEARCH_START = 8192\nconst SEARCH_LIMIT = 2_097_152\n\nexport interface ModelOptions {\n readonly manifestPath: string\n readonly window: boolean\n /** Dollars per million input tokens, for the one arithmetic step this cannot know. */\n readonly price?: number\n readonly write: boolean\n /** Skip the `--window` spend prompt. Never widens anything else. */\n readonly yes: boolean\n readonly json: boolean\n /** Injected by tests. Production passes nothing and gets the global. */\n readonly fetch?: typeof globalThis.fetch\n}\n\ninterface Endpoint {\n readonly chat: string\n readonly models: string\n readonly headers: Record<string, string>\n readonly modelId: string\n}\n\n/** A word of roughly one token, repeated — good enough to size a prompt, which is all this needs. */\nfunction filler(tokens: number): string {\n return \"context \".repeat(Math.max(1, tokens))\n}\n\nasync function readBody(response: Response): Promise<{ text: string; json: unknown }> {\n const text = await response.text()\n try {\n return { text, json: JSON.parse(text) }\n } catch {\n return { text, json: undefined }\n }\n}\n\n/** The message an endpoint put in its error body, wherever it put it. */\nfunction errorMessage(json: unknown, fallback: string): string {\n if (typeof json === \"object\" && json !== null) {\n const record = json as Record<string, unknown>\n const error = record.error\n if (typeof error === \"string\") return error\n if (typeof error === \"object\" && error !== null) {\n const message = (error as Record<string, unknown>).message\n if (typeof message === \"string\") return message\n }\n if (typeof record.message === \"string\") return record.message\n }\n return fallback\n}\n\n/** Technique 1: metadata. Free, and absent on more endpoints than it is present. */\nasync function probeMetadata(\n endpoint: Endpoint,\n doFetch: typeof globalThis.fetch,\n failures: string[],\n): Promise<WindowFinding | undefined> {\n try {\n const response = await doFetch(endpoint.models, { headers: endpoint.headers })\n if (!response.ok) {\n failures.push(`GET /models answered ${response.status}`)\n return undefined\n }\n const { json } = await readBody(response)\n const finding = contextFromModels(json, endpoint.modelId)\n if (finding === undefined) failures.push(\"GET /models published no context length\")\n return finding\n } catch (cause) {\n failures.push(\n `GET /models failed: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n return undefined\n }\n}\n\n/**\n * Technique 2: ask for an impossible output and read the refusal.\n *\n * The refusal is free and it is *authoritative* — the endpoint generated the number from its own\n * configuration rather than from a table somebody maintained. Two numbers can come back: an output\n * ceiling (`max_tokens must be <= 8192`) and sometimes the window itself.\n */\nasync function probeRefusal(\n endpoint: Endpoint,\n doFetch: typeof globalThis.fetch,\n failures: string[],\n): Promise<{ window: WindowFinding | undefined; outputCeiling: number | undefined }> {\n try {\n const response = await doFetch(endpoint.chat, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", ...endpoint.headers },\n body: JSON.stringify({\n model: endpoint.modelId,\n messages: [{ role: \"user\", content: \"hi\" }],\n max_tokens: IMPOSSIBLE_MAX_TOKENS,\n }),\n })\n const { text, json } = await readBody(response)\n if (response.ok) {\n // It served the request rather than refusing it, which means `max_tokens` was clamped\n // silently. That is a real finding about the endpoint and not a probe failure — and it is\n // the shape CLAUDE.md warns about: an endpoint that ignores a parameter says nothing.\n failures.push(\n \"the endpoint accepted an impossible max_tokens rather than refusing it — it clamps silently, so this technique cannot measure it\",\n )\n return { window: undefined, outputCeiling: undefined }\n }\n const message = errorMessage(json, text.slice(0, 400))\n const named = ceilingFromRefusal(message)\n if (named === undefined) {\n failures.push(`the refusal named no number: ${message.slice(0, 160)}`)\n return { window: undefined, outputCeiling: undefined }\n }\n // A number under the declared window is an *output* ceiling, not a context one: no endpoint\n // refuses a two-token prompt for being too long. Above it, the refusal is about the window.\n const looksLikeOutput = /max_?tokens/i.test(message)\n return {\n window: looksLikeOutput\n ? undefined\n : {\n technique: \"refusal\",\n tokens: named,\n bound: \"ceiling\",\n detail: `refused an over-range request naming ${named}`,\n },\n outputCeiling: looksLikeOutput ? named : undefined,\n }\n } catch (cause) {\n failures.push(\n `the over-range request failed: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n return { window: undefined, outputCeiling: undefined }\n }\n}\n\n/** One small call, returning what it reported about caching. */\nasync function cacheCall(\n endpoint: Endpoint,\n doFetch: typeof globalThis.fetch,\n prompt: string,\n): Promise<CacheFinding | undefined> {\n const response = await doFetch(endpoint.chat, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", ...endpoint.headers },\n body: JSON.stringify({\n model: endpoint.modelId,\n messages: [{ role: \"user\", content: prompt }],\n max_tokens: 1,\n }),\n })\n if (!response.ok) return undefined\n const { json } = await readBody(response)\n const usage =\n typeof json === \"object\" && json !== null\n ? (json as Record<string, unknown>).usage\n : undefined\n return cacheFromUsage(usage)\n}\n\n/**\n * Technique 3: the same prompt twice, looking for a hit on the second.\n *\n * The single most consequential line in this command's output. It is also the one whose *negative*\n * must be stated carefully — a miss proves nothing on its own, because the prefix may be under the\n * endpoint's minimum, and `cacheVerdict` says so rather than concluding `none`.\n */\nasync function probeCache(\n endpoint: Endpoint,\n doFetch: typeof globalThis.fetch,\n failures: string[],\n): Promise<{ supported: boolean | undefined; detail: string }> {\n const prompt = `${filler(CACHE_PREFIX_TOKENS)}\\nReply with the single character x.`\n try {\n const first = await cacheCall(endpoint, doFetch, prompt)\n const second = await cacheCall(endpoint, doFetch, prompt)\n return cacheVerdict(first, second, CACHE_PREFIX_TOKENS)\n } catch (cause) {\n failures.push(\n `the caching probe failed: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n return { supported: undefined, detail: \"the probe did not complete\" }\n }\n}\n\n/**\n * Technique 4: grow a prompt until it is refused.\n *\n * Doubling rather than binary search, and the difference is the point: a binary search needs an upper\n * bound to bisect against, and not knowing the upper bound is the entire problem. Doubling finds the\n * bracket, and the *refusal* that ends it usually names the real number — at which point the search\n * has bought a ceiling rather than the floor it was aiming for, which is a better result than it was\n * designed to get.\n */\nasync function probeSearch(\n endpoint: Endpoint,\n doFetch: typeof globalThis.fetch,\n failures: string[],\n): Promise<WindowFinding | undefined> {\n let size = SEARCH_START\n let lastAccepted = 0\n while (size <= SEARCH_LIMIT) {\n let response: Response\n try {\n response = await doFetch(endpoint.chat, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\", ...endpoint.headers },\n body: JSON.stringify({\n model: endpoint.modelId,\n messages: [{ role: \"user\", content: filler(size) }],\n max_tokens: 1,\n }),\n })\n } catch (cause) {\n failures.push(\n `the search stopped at ${size}: ${cause instanceof Error ? cause.message : String(cause)}`,\n )\n break\n }\n if (response.ok) {\n // The *reported* count, never the requested one. `filler` repeats a word and a word is not\n // a token, so the sizes this loop chooses are only roughly tokens — and a floor is a claim\n // about a number, so labelling it with an estimate would make the one honest output of\n // this technique dishonest. The endpoint counted the prompt; take its answer.\n const { json } = await readBody(response)\n const usage =\n typeof json === \"object\" && json !== null\n ? (json as Record<string, unknown>).usage\n : undefined\n const counted =\n typeof usage === \"object\" && usage !== null\n ? (usage as Record<string, unknown>).prompt_tokens\n : undefined\n lastAccepted =\n typeof counted === \"number\" && Number.isFinite(counted) ? counted : lastAccepted\n size *= 2\n continue\n }\n const { text, json } = await readBody(response)\n const named = ceilingFromRefusal(errorMessage(json, text.slice(0, 400)))\n if (named !== undefined) {\n return {\n technique: \"search\",\n tokens: named,\n bound: \"ceiling\",\n detail: `refused a ${size}-token prompt and named ${named}`,\n }\n }\n break\n }\n if (lastAccepted === 0) return undefined\n return {\n technique: \"search\",\n tokens: lastAccepted,\n // A floor and nothing more. The endpoint accepted this and never said what it would refuse.\n bound: \"floor\",\n detail: `accepted a prompt the endpoint counted at ${lastAccepted} tokens; nothing above it named a number`,\n }\n}\n\nfunction renderRole(probe: RoleProbe, price: number | undefined): string {\n const best = bestFinding(probe.findings)\n const verdict =\n best === undefined\n ? \"nothing measured — every technique came back empty\"\n : `${best.tokens} (${best.bound}) · ${best.detail}`\n const agreement =\n best === undefined\n ? \"\"\n : best.tokens === probe.declared\n ? \"matches what is configured\"\n : best.bound === \"ceiling\" && best.tokens > probe.declared\n ? `configured value is ${probe.declared}, which is ${(best.tokens - probe.declared).toLocaleString(\"en-US\")} tokens short`\n : `configured value is ${probe.declared}`\n const cache =\n probe.cache.supported === undefined\n ? `unknown — ${probe.cache.detail}`\n : probe.cache.supported\n ? `yes — ${probe.cache.detail}`\n : `no — ${probe.cache.detail}`\n\n return [\n section(` ${probe.role} · ${probe.modelId}`),\n keyValue([\n { label: \"endpoint\", value: probe.baseUrl },\n { label: \"configured\", value: `${probe.declared} (${probe.declaredSource})` },\n { label: \"measured\", value: verdict },\n { label: \"agreement\", value: agreement },\n {\n label: \"output cap\",\n value: probe.outputCeiling === undefined ? \"\" : String(probe.outputCeiling),\n },\n { label: \"prompt cache\", value: cache },\n ...(price === undefined\n ? []\n : [{ label: \"price\", value: `$${price}/Mtok input, as given` }]),\n ]),\n ...(probe.failures.length === 0\n ? []\n : [\n // Printed rather than swallowed. A technique that found nothing is information about\n // the endpoint — \"it clamps max_tokens silently\" is a fact worth knowing — and a\n // report that showed only successes would look like the probe had nothing to say.\n \" what did not answer:\",\n ...probe.failures.map((line) => ` · ${line}`),\n ]),\n ...(best === undefined || best.bound !== \"ceiling\"\n ? []\n : [\n \"\",\n \" registry row, if this model should ship with it:\",\n registryRow(probe.modelId, best.tokens, probe.outputCeiling)\n .split(\"\\n\")\n .map((line) => ` ${line}`)\n .join(\"\\n\"),\n ]),\n ].join(\"\\n\")\n}\n\nexport async function modelCommand(options: ModelOptions): Promise<number> {\n const doFetch = options.fetch ?? globalThis.fetch\n try {\n const loaded = loadManifest(options.manifestPath, {\n env: ambientEnv([options.manifestPath]),\n })\n const { manifest } = loaded\n // Only roles carrying their own configuration. A fallback role is the same model on the same\n // endpoint, so probing it again would spend money to learn the same thing twice.\n const roles = windowReport(manifest).filter((entry) => entry.role === entry.configuredAs)\n\n // Decided before the loop so the question is asked once rather than once per role, and\n // *not* by returning early: the two free techniques cost nothing, so declining the search is\n // a reason to skip the search and no reason to skip them. An earlier version returned here\n // and printed \"the free techniques still ran above\", which they had not — a sentence\n // asserting something that did not happen, found by reading the output rather than the code.\n let searchApproved = false\n if (options.window) {\n const cost = searchCost(SEARCH_START, SEARCH_LIMIT)\n const perRole = cost.tokens * roles.length\n const dollars =\n options.price === undefined\n ? \"\"\n : ` ≈ $${((perRole / 1_000_000) * options.price).toFixed(2)}`\n process.stdout.write(\n `--window will send up to ${cost.requests} requests per role, about ${perRole.toLocaleString(\"en-US\")} input tokens in total${dollars}.\\n` +\n \"That is an upper bound: the search stops at the first refusal, and the refused request generates nothing.\\n\" +\n \"Tokens rather than dollars unless --price says otherwise: a price table in this repo would be wrong within a quarter.\\n\",\n )\n // An estimate a person cannot act on is decoration. `askYesNo` answers **no** on a\n // non-TTY, so a pipe or a CI run is told rather than charged — the same asymmetry\n // `remove` uses, and the reason `--yes` exists for the scripted case.\n searchApproved = options.yes || (await askYesNo(\"spend it?\"))\n process.stdout.write(\n searchApproved\n ? \"\\n\"\n : \"\\nSkipping the search. The free techniques below still run — re-run with --window --yes to search without asking.\\n\\n\",\n )\n }\n\n const probes: RoleProbe[] = []\n for (const entry of roles) {\n const config = manifest.model[entry.role] ?? manifest.model.main\n if (config.baseUrl === undefined) {\n // Every probe here is a chat-completions request; another transport has no\n // `/models` to read and no bearer to send. Saying so beats a request that cannot mean\n // anything.\n process.stdout.write(\n `model.${entry.role} uses the ${config.api ?? \"chat-completions\"} transport, which this probe does not speak. Its window comes from the capability registry: ${entry.window.contextWindow.toLocaleString(\"en-US\")} tokens (${entry.window.source}).\\n`,\n )\n continue\n }\n const endpoint: Endpoint = {\n chat: endpointUrl(config.baseUrl),\n models: modelsUrl(config.baseUrl),\n headers: bearerHeaders(config.apiKeyEnv, loaded.env, `model.${entry.role}`),\n modelId: config.id,\n }\n const failures: string[] = []\n const findings: WindowFinding[] = []\n\n const metadata = await probeMetadata(endpoint, doFetch, failures)\n if (metadata !== undefined) findings.push(metadata)\n\n const refusal = await probeRefusal(endpoint, doFetch, failures)\n if (refusal.window !== undefined) findings.push(refusal.window)\n\n const cache = await probeCache(endpoint, doFetch, failures)\n\n if (searchApproved) {\n const searched = await probeSearch(endpoint, doFetch, failures)\n if (searched !== undefined) findings.push(searched)\n }\n\n probes.push({\n role: entry.role,\n modelId: config.id,\n baseUrl: config.baseUrl,\n declared: entry.window.contextWindow,\n declaredSource: entry.window.source,\n findings,\n cache,\n outputCeiling: refusal.outputCeiling,\n failures,\n })\n }\n\n if (options.json) {\n process.stdout.write(`${JSON.stringify({ agent: manifest.id, probes }, null, 2)}\\n`)\n return EXIT_OK\n }\n\n const applied = options.write\n ? await writeMeasured(loaded.path, probes)\n : { written: [], refused: [] }\n\n process.stdout.write(\n [\n `probed ${manifest.id} · ${probes.length} role${probes.length === 1 ? \"\" : \"s\"}`,\n ...probes.map((probe) => renderRole(probe, options.price)),\n \"\",\n ...(options.write\n ? [\n ...(applied.written.length === 0\n ? []\n : [\n \" written to the manifest:\",\n ...applied.written.map((l) => ` ${l}`),\n ]),\n // Refusals are printed, never silent. \"Nothing happened\" and \"nothing needed\n // to happen\" are different, and a --write that reported neither would look\n // like it had worked.\n ...(applied.refused.length === 0\n ? []\n : [\" not written:\", ...applied.refused.map((l) => ` ${l}`)]),\n \" A restart picks it up — an agent's settings are fixed for its lifetime.\",\n ]\n : [writeNote(probes)]),\n \"\",\n ].join(\"\\n\"),\n )\n return EXIT_OK\n } catch (error) {\n if (isHarnessError(error)) {\n process.stderr.write(`${error.format()}\\n`)\n return EXIT_FAILURE\n }\n throw error\n }\n}\n\n/**\n * Write the measured window into the manifest — and refuse to write a floor.\n *\n * The refusal is the feature. A floor says \"at least this much\" and writing it as `contextWindow`\n * turns it into \"exactly this much\" the moment anybody reads the file: that is precisely how\n * `deepseek-v4-pro` came to sit at 393,216 against a published 1,048,576, and a command that\n * recreated it one generation later would be worse than no command. Only a **ceiling** — a number the\n * endpoint named while refusing — is written.\n *\n * Through `editManifest`, never by re-serialising: a whole-file rewrite cannot be validated, and\n * `parseDocument` → `setIn` → `String(doc)` reflows comments into the wrong section.\n */\nasync function writeMeasured(\n file: string,\n probes: readonly RoleProbe[],\n): Promise<{ written: string[]; refused: string[] }> {\n const written: string[] = []\n const refused: string[] = []\n for (const probe of probes) {\n const best = bestFinding(probe.findings)\n if (best === undefined) {\n refused.push(`${probe.role}: nothing measured`)\n continue\n }\n if (best.bound !== \"ceiling\") {\n refused.push(\n `${probe.role}: ${best.tokens} is a floor, not a window — the endpoint accepted it and never said what it would refuse`,\n )\n continue\n }\n if (best.tokens === probe.declared) {\n refused.push(`${probe.role}: already ${best.tokens}, nothing to change`)\n continue\n }\n await editManifest({\n file,\n path: [\"model\", probe.role, \"capabilities\", \"contextWindow\"],\n value: best.tokens,\n })\n written.push(`${probe.role}: ${probe.declared} → ${best.tokens}`)\n }\n return { written, refused }\n}\n\n/**\n * The paste-ready line, for the run that did not pass `--write`.\n *\n * The comment is the whole of decision 3.8's \"measured\" case: there is no schema field claiming a\n * number was measured, because such a field is settable by hand and would turn a fact into a claim.\n * A dated comment naming the endpoint is for the person reading the file in six months.\n */\nfunction writeNote(probes: readonly RoleProbe[]): string {\n const ceilings = probes.filter((probe) => bestFinding(probe.findings)?.bound === \"ceiling\")\n if (ceilings.length === 0) {\n return \" Nothing measured a ceiling, so there is nothing worth writing down. A floor is not a window.\"\n }\n const first = ceilings[0]\n const best = first === undefined ? undefined : bestFinding(first.findings)\n if (first === undefined || best === undefined) return \"\"\n const host = new URL(first.baseUrl).host\n return [\n \" --write records this. By hand, it is one line under the role, and the comment is the point:\",\n ` contextWindow: ${best.tokens}`,\n ` # ${measuredComment(host, new Date().toISOString().slice(0, 10), best.detail)}`,\n ].join(\"\\n\")\n}\n",
|
|
21
21
|
"/**\n * `owner show` and `owner adopt <agent>` (decisions 15.7, 15.14).\n *\n * `init` makes the person running it the owner of what it creates. An agent made before that, or\n * outside the sandbox, has nobody, so `sessions.scope: owner` would do nothing for it: this is the\n * one step that makes it yours — registered, assigned with your channel senders from `allowFrom`,\n * and the scope written. Idempotent, so running it twice changes nothing the second time.\n */\n\nimport { readFileSync } from \"node:fs\"\nimport { BRAND, editManifest, HarnessError, readManifestHeader, SqliteStore } from \"@dispach/core\"\nimport { EXIT_OK } from \"#lib/const\"\nimport { reloadOnHost } from \"#lib/host-actions\"\nimport { claimManifest, ownerPath } from \"#lib/owner\"\nimport { agentsDir, storePath } from \"#lib/sandbox\"\n\nexport interface OwnerCommandOptions {\n readonly action: string\n readonly manifestPath?: string\n readonly store?: string\n readonly json: boolean\n}\n\nexport async function ownerCommand(options: OwnerCommandOptions): Promise<number> {\n const agentsBase = agentsDir()\n if (options.action === \"show\") {\n let id: string | undefined\n try {\n id = readFileSync(ownerPath(agentsBase), \"utf8\").trim() || undefined\n } catch {\n id = undefined\n }\n if (options.json) process.stdout.write(`${JSON.stringify({ owner: id ?? null })}\\n`)\n else\n process.stdout.write(\n id === undefined\n ? `No owner yet. \\`${BRAND.slug} init\\` or \\`${BRAND.slug} owner adopt <agent>\\` makes you one.\\n`\n : `${id}\\n`,\n )\n return EXIT_OK\n }\n\n const manifestPath = options.manifestPath\n if (manifestPath === undefined || manifestPath === \"\") {\n throw new HarnessError({\n code: \"owner_agent_required\",\n message: \"owner adopt needs an agent.\",\n hint: `Name one: \\`${BRAND.slug} owner adopt milo\\`, or a path to its agent.yaml.`,\n })\n }\n const agentId = readManifestHeader(manifestPath).id ?? \"\"\n\n const store = await SqliteStore.open({ path: options.store ?? storePath() })\n let claimed: Awaited<ReturnType<typeof claimManifest>>\n try {\n claimed = await claimManifest(store, manifestPath, agentsBase)\n } finally {\n await store.close()\n }\n\n // `sessions:` is a top-level block a manifest written before 0.2.2 does not have, and the source\n // editor appends only under a parent that exists — so it goes at the end, where a reader finds it.\n const edit = await editManifest({\n file: manifestPath,\n path: [\"sessions\", \"scope\"],\n value: \"owner\",\n fallback: (source) =>\n /^sessions:/m.test(source)\n ? undefined\n : `${source.replace(/\\n*$/, \"\\n\")}\\n# One conversation with you across the web, the terminal and every channel.\\nsessions:\\n scope: owner\\n`,\n })\n const reload = await reloadOnHost(manifestPath, options.store)\n const host =\n reload.kind === \"reloaded\" || reload.kind === \"pending\"\n ? `reloaded by pid ${reload.pid}`\n : reload.kind === \"no-host\"\n ? \"not running here; takes effect when it next starts\"\n : `pid ${reload.pid} did not reload it (${reload.kind}); restart it to take effect`\n\n if (options.json) {\n process.stdout.write(\n `${JSON.stringify({ agent: agentId, owner: claimed.owner, channelIds: claimed.channelIds, scopeChanged: edit.changed, reload: reload.kind })}\\n`,\n )\n return EXIT_OK\n }\n process.stdout.write(\n [\n `owner ${claimed.owner}`,\n `agent ${agentId} sessions.scope: owner${edit.changed ? \"\" : \" (already)\"}`,\n // Every entry, because each one is now somebody the agent treats as you.\n `you on ${claimed.channelIds.length === 0 ? \"the web and the terminal only — no allowFrom entries to recognise you by on a channel\" : claimed.channelIds.join(\", \")}`,\n `host ${host}`,\n \"\",\n ].join(\"\\n\"),\n )\n return EXIT_OK\n}\n",
|
|
22
22
|
"/**\n * `plugins` — install one, list what an agent loaded, or remove one.\n *\n * ## Three questions, and why `list` answers two of them\n *\n * `plugins list` was the whole command for three phases: the surface decision 7.5 promised, since\n * `permissions` is advisory vocabulary and a vocabulary nobody can read is one nobody declares\n * accurately. It prints the declarations beside what each plugin registered, which together answer\n * the only two questions worth asking of a plugin — what did naming this buy me, and what did it ask\n * for. It is a command rather than a line in `validate` because `plugin.loaded` fires during boot,\n * before anything can subscribe, so the runtime carries the report and this reads it.\n *\n * It now also prints **which lookup answered** for each entry. With three lookups — the binary's own\n * registry, the plugin root, then a module import — \"which code is loaded\" stops being derivable from\n * the manifest alone, and an installed plugin shadowed by a same-named bundled one would otherwise be\n * invisible.\n *\n * ## Why `add` verifies before it writes\n *\n * A manifest naming a plugin that will not load **does not load**, so an `add` that wrote the entry\n * and left a broken directory behind would brick the agent and report success — and `plugins remove`,\n * the command that undoes it, would be reachable only by hand-editing the file. So the order is:\n * fetch to a partial directory, refuse there, and only then rename into place and write the entry.\n *\n * The verification is `conformance()` from `@dispach/core/testing` — the same suite the plugin's own\n * author runs, rather than a second definition of \"well-formed\" living here. It calls `setup` once\n * into a void, so nothing is constructed and no credential is read. That does mean **reading the\n * declarations runs the plugin's module scope**, which `add` says out loud: there is no way to learn\n * what a plugin declares without loading it, because the declarations are its default export, and a\n * second place to declare them would be a second thing to keep in step.\n */\n\nimport { existsSync, rmSync } from \"node:fs\"\nimport { resolve } from \"node:path\"\nimport {\n BRAND,\n editManifest,\n HarnessError,\n type Permission,\n type Plugin,\n Runtime,\n readManifestHeader,\n satisfiesApiRange,\n VERSION,\n} from \"@dispach/core\"\nimport { conformance } from \"@dispach/core/testing\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { EXIT_OK } from \"#lib/const\"\nimport { onExit } from \"#lib/exit\"\nimport {\n entryOf,\n fetchPlugin,\n type InstalledPlugin,\n installedPlugins,\n notSelfContained,\n pluginNameFor,\n} from \"#lib/plugin-install\"\nimport {\n BUILT_IN_PLUGIN_SPECS,\n BUILT_IN_PLUGINS,\n CHANNELS,\n MEDIA_PROVIDERS,\n MODEL_TRANSPORTS,\n scriptRunner,\n TOOL_PROVIDERS,\n} from \"#lib/providers\"\nimport { keyValue, type Row } from \"#lib/render\"\nimport { listAgents, pluginDir, pluginRoot, storePath } from \"#lib/sandbox\"\nimport type { PluginsOptions } from \"#lib/schema\"\nimport { looksLikePath } from \"#lib/source-cache\"\nimport { isSourceName, parseSourceUrl } from \"#lib/sources\"\n\nexport async function pluginsCommand(options: PluginsOptions): Promise<number> {\n switch (options.action) {\n case \"list\":\n return await listCommand(options)\n case \"add\":\n return await addCommand(options)\n case \"remove\":\n return await removeCommand(options)\n default:\n throw new HarnessError({\n code: \"cli_plugins_action_unknown\",\n message: `plugins: ${JSON.stringify(options.action)} is not an action`,\n hint: `Actions are list, add and remove — \\`${BRAND.slug} plugins list <agent>\\`.`,\n })\n }\n}\n\n// ─── list ────────────────────────────────────────────────────────────────────────────────\n\nasync function listCommand(options: PluginsOptions): Promise<number> {\n const runtime = await Runtime.create({\n agents: [options.manifestPath],\n toolProviders: TOOL_PROVIDERS,\n modelTransports: MODEL_TRANSPORTS,\n mediaProviders: MEDIA_PROVIDERS,\n builtInPlugins: BUILT_IN_PLUGINS,\n pluginRoot: pluginRoot(options.env),\n scriptRunner: scriptRunner(),\n channels: CHANNELS,\n env: ambientEnv([options.manifestPath]),\n store: storePath(options.env),\n lease: false,\n })\n onExit(() => runtime.stop(\"cli-exit\"))\n\n const loaded = [...runtime.plugins.values()].flat()\n const installed = installedPlugins(options.env)\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify(\n { plugins: loaded, installed, available: BUILT_IN_PLUGIN_SPECS },\n null,\n 2,\n )}\\n`,\n )\n return EXIT_OK\n }\n\n if (loaded.length === 0) {\n // Names what could be written rather than printing an empty table. A capability reachable\n // only by somebody who already knows the field names is a capability the surface is hiding —\n // the same reason `init` asks about every provider the runtime has.\n process.stdout.write(\n `No plugins. This binary can resolve these by name:\\n\\n${BUILT_IN_PLUGIN_SPECS.map(\n (spec) => ` - \"${spec}\"`,\n ).join(\n \"\\n\",\n )}\\n\\nAdd a \\`plugins:\\` block to agent.yaml naming the ones you want, or fetch one with \\`${BRAND.slug} plugins add <agent> <repo>\\`.\\n`,\n )\n if (installed.length > 0) {\n process.stdout.write(\n `\\nInstalled in ${pluginRoot(options.env)} and named by no agent:\\n${installed\n .map((entry) => ` - \"${entry.name}\"`)\n .join(\"\\n\")}\\n`,\n )\n }\n return EXIT_OK\n }\n\n const rows: Row[] = loaded.map((plugin) => ({\n label: plugin.name,\n value: `${plugin.version} ${`${plugin.setupMs} ms`.padStart(9)}`,\n note: `${lookupNote(plugin.spec, plugin.lookup, installed)} — ${\n plugin.registered.length === 0 ? \"registered nothing\" : plugin.registered.join(\", \")\n }`,\n }))\n process.stdout.write(`${keyValue(rows)}\\n`)\n\n // Printed separately, and only when something declared one. Advisory in v1 — the line says so,\n // because a permission list that reads as enforcement is worse than none: it invites the belief\n // that installing a plugin is bounded by what it declared.\n const declaring = loaded.filter((plugin) => plugin.permissions.length > 0)\n if (declaring.length > 0) {\n process.stdout.write(\"\\nDeclared access — advisory in v1, recorded and not enforced:\\n\")\n for (const plugin of declaring) {\n for (const permission of plugin.permissions) {\n process.stdout.write(\n ` ${plugin.name} ${permission.kind} ${permissionDetail(permission)}\\n`,\n )\n }\n }\n }\n\n const unused = installed.filter((entry) => !loaded.some((plugin) => plugin.spec === entry.name))\n if (unused.length > 0) {\n process.stdout.write(\n `\\nAlso installed, named by no agent: ${unused.map((entry) => entry.name).join(\", \")}\\n`,\n )\n }\n return EXIT_OK\n}\n\n/** Which of the three lookups answered, with the commit when provenance knows one. */\nfunction lookupNote(spec: string, lookup: string, installed: readonly InstalledPlugin[]): string {\n if (lookup !== \"installed\") return lookup === \"registry\" ? \"built in\" : \"imported\"\n const origin = installed.find((entry) => entry.name === spec)?.origin\n return origin === undefined ? \"installed\" : `installed ${origin.commit}`\n}\n\nfunction permissionDetail(permission: Permission): string {\n switch (permission.kind) {\n case \"network\":\n return permission.hosts.join(\", \")\n case \"env\":\n return permission.vars.join(\", \")\n case \"fs\":\n return `${permission.paths.join(\", \")} (${permission.mode})`\n case \"exec\":\n return permission.commands.join(\", \")\n default:\n return permission.tables.join(\", \")\n }\n}\n\n// ─── add ─────────────────────────────────────────────────────────────────────────────────\n\nasync function addCommand(options: PluginsOptions): Promise<number> {\n const typed = options.rest?.[0]\n if (typed === undefined || typed === \"\") {\n throw new HarnessError({\n code: \"cli_plugins_add_needs_repo\",\n message: \"plugins add needs a repository\",\n hint: `\\`${BRAND.slug} plugins add <agent> <owner/repo> [--ref v1.0.0]\\`. A plugin is fetched with git — an owner/repo shorthand, a clone URL, the page URL you were reading (whose .../tree/<branch>/<subdir> is understood), or a local repository while you are writing one.`,\n })\n }\n // A local repository is a first-class spec, because it is the only way an author can test the\n // bundle they are about to publish: `plugins:` can already name a relative path, but that is not\n // what runs in the container — a vendored copy in the plugin root is. Filesystem-first, the rule\n // `resolveAgentRef` and `skills install` both follow, so a path is never read as `owner/repo`.\n const parsed = looksLikePath(typed)\n ? { url: resolve(typed.replace(/^file:\\/\\//, \"\")) }\n : parseSourceUrl(typed)\n // A `--ref` beats one read out of a `/tree/<branch>/` URL: the flag is what somebody typed on\n // purpose, and the URL's branch is usually whatever page they happened to be reading.\n const ref = options.ref ?? parsed.ref\n const name =\n options.name === undefined ? pluginNameFor(parsed.url, parsed.path) : checked(options.name)\n\n const existing = installedPlugins(options.env).find((entry) => entry.name === name)\n if (existing?.origin !== undefined && existing.origin.url !== parsed.url) {\n throw new HarnessError({\n code: \"plugin_name_taken\",\n message: `A different plugin is already installed as \"${name}\" — from ${existing.origin.url}`,\n hint: `Two repositories cannot share one directory, and the directory name is what a manifest's \\`plugins:\\` entry means. Pass \\`--name <name>\\`, or \\`${BRAND.slug} plugins remove <agent> ${name}\\` first.`,\n })\n }\n\n process.stdout.write(\n `Fetching ${parsed.url}${ref === undefined ? \"\" : ` at ${ref}`} as \"${name}\"…\\n`,\n )\n\n let report: Awaited<ReturnType<typeof conformance>> | undefined\n\n const fetched = await fetchPlugin(\n {\n name,\n url: parsed.url,\n ...(ref === undefined ? {} : { ref }),\n ...(parsed.path === undefined ? {} : { path: parsed.path }),\n },\n {\n ...(options.env === undefined ? {} : { env: options.env }),\n ...(options.git === undefined ? {} : { git: options.git }),\n // Everything that could refuse runs here, against the partial directory, so a refusal\n // leaves whatever was installed under this name untouched and the manifest unwritten.\n inspect: async (dir) => {\n const problem = notSelfContained(dir)\n if (problem !== undefined) {\n throw new HarnessError({\n code: \"plugin_not_self_contained\",\n message: `${name} cannot be loaded as fetched: ${problem}`,\n hint: \"A plugin is distributed as one self-contained bundle. Nothing is installed while this runtime runs (hard rule 5), so a declared dependency would simply be missing at boot. Ask the author to bundle their dependencies, or commit node_modules in the distribution repository.\",\n })\n }\n const entry = entryOf(dir)\n if (!existsSync(entry)) {\n throw new HarnessError({\n code: \"plugin_entry_missing\",\n message: `${name} has no entry file — ${entry.slice(dir.length + 1)} is not in the repository`,\n hint: \"A plugin directory is entered through the `main` its package.json names, defaulting to index.js. A distribution repository commits its built entry file; a source checkout does not, which is usually what this means.\",\n })\n }\n const plugin = await pluginFromFile(name, entry)\n report = await conformance(plugin)\n if (!report.ok) {\n throw new HarnessError({\n code: \"plugin_not_conformant\",\n message: `${report.declared.name} does not meet the plugin contract:\\n${report.findings\n .filter((finding) => finding.level === \"error\")\n .map((finding) => ` ${finding.check}: ${finding.message}`)\n .join(\"\\n\")}`,\n hint: `This is the same suite the plugin's own author runs — \\`conformance()\\` from ${BRAND.packageScope}/core/testing. Nothing was installed. Report it upstream with the checks named above.`,\n })\n }\n // A range that does not admit this host is a **warning** in the suite, because\n // running it against a newer host than a plugin targets is a normal thing for an\n // author to do. Installing is not: the loader refuses this at boot, so writing the\n // entry would leave an agent that will not start, reported as success.\n if (satisfiesApiRange(VERSION, report.declared.apiRange) !== true) {\n throw new HarnessError({\n code: \"plugin_api_mismatch\",\n message: `${report.declared.name} ${report.declared.version} supports host ${report.declared.apiRange}, and this host is ${VERSION}`,\n hint: \"The loader refuses this at boot, so installing it would write an entry that stops the agent starting. Look for a newer release of the plugin, or a `--ref` that matches this host.\",\n })\n }\n },\n },\n )\n\n // Disclosure after the fetch rather than before, and the reason is stated rather than hidden:\n // what a plugin declares *is* its default export, so there is nothing to read without loading\n // the module — which has now happened. The alternative is a second place to declare it.\n const declared = report?.declared\n process.stdout.write(\n `\\n${declared?.name ?? name} ${declared?.version ?? \"?\"} (${fetched.commit})\\n` +\n ` from ${parsed.url}${ref === undefined ? \"\" : ` at ${ref}`}\\n` +\n ` installed ${fetched.dir}\\n` +\n ` host range ${declared?.apiRange ?? \"?\"} — this host is ${VERSION}\\n` +\n ` registers ${report === undefined || report.registered.length === 0 ? \"nothing\" : report.registered.join(\", \")}\\n`,\n )\n if (declared !== undefined && declared.permissions.length > 0) {\n process.stdout.write(\n `\\nIt declares access to:\\n${declared.permissions\n .map((permission) => ` ${permission.kind} ${permissionDetail(permission)}`)\n .join(\"\\n\")}\\n` +\n \"\\nAdvisory only. `permissions` is recorded and enforced by nothing in v1 (decision 7.5) —\\n\" +\n \"a plugin is trusted in-process code, so this list is what the author says it needs, not a\\n\" +\n \"boundary. Install plugins you trust.\\n\",\n )\n } else {\n process.stdout.write(\n \"\\nIt declares no access. That is not a guarantee: `permissions` is advisory in v1, so a\\nplugin that declares nothing can still do anything this process can. Install plugins you trust.\\n\",\n )\n }\n const warnings = report?.findings.filter((finding) => finding.level === \"warning\") ?? []\n for (const warning of warnings) {\n process.stdout.write(`\\nnote: ${warning.check} — ${warning.message}\\n`)\n }\n\n // The manifest entry is the **directory** name, which is not always the plugin's own `name` —\n // `--name` decides one and the author decides the other. Said out loud when they differ, because\n // `plugins list` keys its rows by the plugin's name and the manifest by the directory, and\n // somebody reading both would otherwise have two names and no stated relationship.\n if (declared !== undefined && declared.name !== name) {\n process.stdout.write(\n `\\nnote: it calls itself \"${declared.name}\"; the \\`plugins:\\` entry is the directory, \"${name}\".\\n`,\n )\n }\n\n const result = await addToManifest(options.manifestPath, name)\n process.stdout.write(\n result === \"already\"\n ? `\\n${options.manifestPath} already names \"${name}\".\\n`\n : `\\nAdded \"${name}\" to the plugins: block in ${options.manifestPath}.\\nIt loads at the next start — an agent's plugins are fixed for its lifetime, so restart a running one.\\n`,\n )\n return EXIT_OK\n}\n\nfunction checked(name: string): string {\n if (isSourceName(name)) return name\n throw new HarnessError({\n code: \"plugin_name_invalid\",\n message: `--name ${JSON.stringify(name)} is not a usable plugin directory name`,\n hint: \"Lowercase letters, digits and single hyphens. That segment is what the manifest's `plugins:` entry names, so it has to be a directory name and a YAML scalar at once.\",\n })\n}\n\n/**\n * Load a file and get the plugin out of it.\n *\n * Deliberately narrow: two conditions, and `conformance()` produces every other finding. A third\n * definition of \"is this a plugin\" — after the loader's and the suite's — is what this avoids.\n */\nasync function pluginFromFile(name: string, entry: string): Promise<Plugin> {\n let module: unknown\n try {\n module = await import(entry)\n } catch (cause) {\n throw new HarnessError({\n code: \"plugin_import_failed\",\n message: `${name}: ${entry} could not be imported — ${cause instanceof Error ? cause.message : String(cause)}`,\n hint: \"A plugin is one self-contained ES module. A bare `require` or an unresolved import is what this usually means, and neither can be fixed by installing anything: nothing is installed while this runtime runs. Nothing was installed.\",\n cause,\n })\n }\n const candidate = (module as { default?: unknown }).default\n if (candidate === null || typeof candidate !== \"object\") {\n throw new HarnessError({\n code: \"plugin_malformed\",\n message: `${name}: ${entry} has no object as its default export`,\n hint: `A plugin is the module's default export: an object with \\`name\\`, \\`version\\`, a \\`${BRAND.slug}Api\\` host range and \\`setup\\`. A named export is not searched for and a factory function is not called, because a wrong guess produces a plugin that registers nothing and reports success.`,\n })\n }\n if (typeof (candidate as { setup?: unknown }).setup !== \"function\") {\n throw new HarnessError({\n code: \"plugin_malformed\",\n message: `${name}: the default export of ${entry} has no \\`setup\\` function`,\n hint: \"`setup(context)` is the whole extension surface — it registers channels, tool providers, a script runner or middleware, and does no work.\",\n })\n }\n return candidate as Plugin\n}\n\n/** Append the entry unless it is already there. The one manifest writer does the placing. */\nasync function addToManifest(manifestPath: string, name: string): Promise<\"written\" | \"already\"> {\n const header = readManifestHeader(manifestPath)\n const refs = header.plugins ?? []\n const already = refs.some((ref) => (typeof ref === \"string\" ? ref : ref.spec) === name)\n if (already) return \"already\"\n await editManifest({\n file: manifestPath,\n path: [\"plugins\"],\n // Strings, not `{spec}` maps: a bare entry is what a manifest should carry when there is no\n // config, and the object form is for the entries that need one.\n value: [...refs.map((ref) => (typeof ref === \"string\" ? ref : ref.spec)), name],\n })\n return \"written\"\n}\n\n// ─── remove ──────────────────────────────────────────────────────────────────────────────\n\nasync function removeCommand(options: PluginsOptions): Promise<number> {\n const name = options.rest?.[0]\n if (name === undefined || name === \"\") {\n throw new HarnessError({\n code: \"cli_plugins_remove_needs_name\",\n message: \"plugins remove needs a name\",\n hint: `\\`${BRAND.slug} plugins remove <agent> <name>\\`, where the name is the \\`plugins:\\` entry — \\`plugins list <agent>\\` prints them.`,\n })\n }\n\n const header = readManifestHeader(options.manifestPath)\n const refs = (header.plugins ?? []).map((ref) => (typeof ref === \"string\" ? ref : ref.spec))\n if (refs.includes(name)) {\n await editManifest({\n file: options.manifestPath,\n path: [\"plugins\"],\n value: refs.filter((ref) => ref !== name),\n })\n // A pointer rather than a claim. Whether anything in the manifest *depended* on this plugin\n // is only knowable by loading it, which has just been deleted — and the consequence is loud\n // at the next start (`channels[0] declares type \"x\", which is not registered here`), so what\n // is worth buying here is the one command that says so before that start.\n process.stdout.write(\n `Dropped \"${name}\" from ${options.manifestPath}.\\nRun \\`${BRAND.slug} validate ${options.manifestPath}\\` — a channel or tool provider it supplied is now unresolved.\\n`,\n )\n } else {\n process.stdout.write(`${options.manifestPath} does not name \"${name}\".\\n`)\n }\n\n const dir = pluginDir(name, options.env)\n if (!existsSync(dir)) {\n process.stdout.write(`Nothing installed at ${dir}.\\n`)\n return EXIT_OK\n }\n\n // The directory is machine-level and shared, so deleting it while another agent still names it\n // would break that agent at its next start — with the damage done by a command somebody ran\n // about a different agent. Named rather than deleted, which is the same call `remove` makes\n // about two directories sharing one manifest id.\n const others = otherAgentsNaming(name, options.manifestPath, options.env)\n if (others.length > 0) {\n process.stdout.write(\n `Kept ${dir} — still named by ${others.join(\", \")}.\\nRemove it from those agents first, or delete the directory by hand.\\n`,\n )\n return EXIT_OK\n }\n rmSync(dir, { recursive: true, force: true })\n process.stdout.write(`Deleted ${dir}.\\n`)\n return EXIT_OK\n}\n\n/** Sandbox agents other than this one whose `plugins:` names it. Header reads, so no credentials. */\nfunction otherAgentsNaming(\n name: string,\n exceptManifest: string,\n env?: Readonly<Record<string, string | undefined>>,\n): readonly string[] {\n const found: string[] = []\n for (const agent of listAgents(env)) {\n if (agent.manifestPath === exceptManifest) continue\n try {\n const header = readManifestHeader(agent.manifestPath)\n const refs = (header.plugins ?? []).map((ref) =>\n typeof ref === \"string\" ? ref : ref.spec,\n )\n if (refs.includes(name)) found.push(agent.ref)\n } catch {\n // A broken manifest cannot be asked. Not a reason to refuse the delete — `listAgents`\n // already surfaces it, and treating unreadable as \"names it\" would make one corrupt\n // agent pin every plugin on the machine forever.\n }\n }\n return found\n}\n",
|
|
23
|
-
"import\"../index-yn977xfp.js\";\nimport {\n EventBus2,\n VERSION2,\n satisfies,\n SETUP_BUDGET_MS2\n} from \"../index-
|
|
23
|
+
"import\"../index-yn977xfp.js\";\nimport {\n EventBus2,\n VERSION2,\n satisfies,\n SETUP_BUDGET_MS2\n} from \"../index-pnbavrmp.js\";\n\n// src/testing/conformance.ts\nvar SILENT = { debug: () => {}, info: () => {}, warn: () => {}, error: () => {} };\nfunction isPermission(value) {\n if (value === null || typeof value !== \"object\")\n return false;\n const kind = value.kind;\n return kind === \"network\" || kind === \"env\" || kind === \"fs\" || kind === \"exec\" || kind === \"store\";\n}\nasync function conformance(plugin, options = {}) {\n const findings = [];\n const registered = [];\n const hostVersion = options.hostVersion ?? VERSION2;\n const error = (check, message, hint) => {\n findings.push({ level: \"error\", check, message, hint });\n };\n const warn = (check, message, hint) => {\n findings.push({ level: \"warning\", check, message, hint });\n };\n if (typeof plugin.name !== \"string\" || plugin.name === \"\") {\n error(\"name\", \"The plugin has no name.\", \"`name` is how events, errors and `plugins` output refer to this plugin. It must be unique within a runtime.\");\n }\n if (satisfies(plugin.version, \"*\") === undefined) {\n error(\"version\", `\\`version\\` is ${JSON.stringify(plugin.version)}, which is not a plain semver triple.`, \"Write it as `major.minor.patch`. It is reported verbatim in `plugin.loaded`, and a version nobody can compare is a version nobody can act on.\");\n }\n const decided = satisfies(hostVersion, plugin.dispachApi);\n if (decided === undefined) {\n error(\"dispachApi\", `\\`dispachApi\\` is ${JSON.stringify(plugin.dispachApi)}, which the host cannot check.`, \"Supported: `*`, an exact version, `^`, `~`, space-separated comparators, and `||`. A range the host cannot parse is refused rather than assumed satisfied, so this plugin would not load.\");\n } else if (!decided) {\n warn(\"dispachApi\", `\\`dispachApi\\` ${plugin.dispachApi} does not admit this host (${hostVersion}).`, \"Correct if you are testing against a host you do not support. A warning rather than an error, because running the suite on a newer host than the plugin targets is a normal thing to do.\");\n }\n if (plugin.dispachApi.trim() === \"*\") {\n warn(\"dispachApi\", \"`dispachApi` is `*`, which accepts every host version including ones that do not exist yet.\", \"Narrow it to the range you have actually tested. A plugin that never refuses to load is a plugin that fails at runtime instead, somewhere else, with nothing pointing back at the skew.\");\n }\n for (const [index, permission] of (plugin.permissions ?? []).entries()) {\n if (!isPermission(permission)) {\n error(\"permissions\", `\\`permissions[${index}]\\` is not one of the declared kinds.`, \"Kinds are network, env, fs, exec and store. Advisory in v1 — but authors who declare accurately before enforcement lands are the ones who will not have to scramble afterwards.\");\n }\n }\n let config = options.config ?? {};\n if (plugin.configSchema !== undefined) {\n const parsed = plugin.configSchema.safeParse(config);\n if (parsed.success)\n config = parsed.data;\n else {\n warn(\"configSchema\", \"The schema refused the config this suite passed.\", \"Pass a valid `config` through `conformance(plugin, { config })`. The default is `{}`, which a schema with required fields correctly rejects.\");\n }\n }\n const context = {\n defineChannel: (id) => registered.push(`channel:${id}`),\n defineToolProvider: (id) => registered.push(`toolProvider:${id}`),\n defineModelTransport: (api) => registered.push(`modelTransport:${api}`),\n defineMediaProvider: (name) => registered.push(`mediaProvider:${name}`),\n defineScriptRunner: () => registered.push(\"scriptRunner\"),\n use: (entry) => registered.push(`middleware:${entry.name}`),\n defineRoute: (route) => registered.push(`route:${route.method} ${route.path}`),\n config,\n agentId: \"conformance\",\n paths: {\n workspace: \"/nonexistent/conformance\",\n state: \"/nonexistent/conformance/.state\",\n manifest: \"/nonexistent/conformance/agent.yaml\"\n },\n env: {},\n logger: SILENT,\n events: new EventBus2({ runtimeId: \"conformance\" })\n };\n const started = performance.now();\n try {\n await plugin.setup(context);\n } catch (cause) {\n error(\"setup\", `\\`setup\\` threw: ${cause instanceof Error ? cause.message : String(cause)}`, \"`setup` registers capabilities and does no work, so it must succeed with an empty environment and a workspace that does not exist. Read a token in the factory you register, not here — that runs only when an agent actually uses the capability.\");\n }\n const setupMs = Math.round((performance.now() - started) * 100) / 100;\n if (setupMs > SETUP_BUDGET_MS2) {\n error(\"setup budget\", `\\`setup\\` took ${setupMs} ms against a ${SETUP_BUDGET_MS2} ms budget.`, \"Move the work into the factory you register. A channel connects in `start()`, which runs after readiness; a provider resolves from its cache at boot and refreshes afterwards. Hard rule 4: no network I/O before `runtime.ready`.\");\n }\n if (registered.length === 0) {\n warn(\"setup\", \"`setup` registered nothing.\", \"A plugin that registers no channel, tool provider, script runner or middleware extends nothing. Every `define*` and `use` call is recorded, so registering something and still seeing this means the registration did not run — check for a branch in `setup` that skipped it.\");\n }\n return {\n ok: findings.every((finding) => finding.level !== \"error\"),\n findings,\n registered,\n setupMs,\n declared: {\n name: plugin.name,\n version: plugin.version,\n apiRange: plugin.dispachApi,\n permissions: (plugin.permissions ?? []).filter(isPermission)\n }\n };\n}\nfunction formatFindings(result) {\n if (result.findings.length === 0)\n return \"conformance: ok\";\n return result.findings.map((finding) => `${finding.level}: ${finding.check} — ${finding.message}\n hint: ${finding.hint}`).join(`\n`);\n}\nexport {\n conformance,\n formatFindings\n};\n\n//# debugId=F3C53EED8CB17C7064756E2164756E21\n//# sourceMappingURL=index.js.map\n",
|
|
24
24
|
"/**\n * Fetching a plugin, and reading what is installed.\n *\n * ## One self-contained bundle, and why that is the whole design\n *\n * Nothing installs dependencies, ever — hard rule 5, and it is what makes this mechanism small\n * enough to be worth having at all. A plugin is fetched as a directory with a runnable entry file\n * and nothing to resolve, so the npm install and the container — whose `node_modules` holds only\n * the two declared dependencies — load a plugin exactly as a checkout does. `notSelfContained` is what keeps that\n * true: a tree that declares runtime dependencies and ships none is refused **here**, rather than\n * half-loading at somebody's next boot.\n *\n * ## Git, and what git costs\n *\n * `realGit` from `lib/source-cache.ts` is reused wholesale — the only network module in the CLI, with\n * prompting disabled in all four ways git can be asked and a wall-clock timeout, because a\n * `git ls-remote` on a repository that does not exist once sat for two minutes waiting for a\n * credential prompt nobody was watching.\n *\n * What git does not buy, stated rather than discovered: no version resolution and no integrity check.\n * A bare spec is whatever that branch points at today. `--ref` pins a tag or a commit, the resolved\n * commit is recorded beside the plugin, and `plugins list` prints it — so \"which code is loaded\" has\n * an answer. The host-range gate is a **compatibility** check and not an authenticity one; nothing\n * here verifies who published what. npm specs are the thing that would, and they are deliberately out\n * of scope: a registry fetch plus a tar extractor, and a change to \"one npm name\" worth its own\n * decision rather than arriving as a side effect.\n *\n * ## No registry file\n *\n * `sources` needs `sources.json` because a source is machine-level and nothing else records it. A\n * plugin is selected by each agent's own `plugins:` block, so the manifest *is* the registry, and a\n * second list would be exactly the drift this repo keeps paying for. What lives beside the code is\n * provenance, not selection: `.origin.json`, one file per plugin, deleted with the directory.\n */\n\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\"\nimport { join } from \"node:path\"\nimport { HarnessError } from \"@dispach/core\"\nimport { pluginDir, pluginRoot } from \"#lib/sandbox\"\nimport { type Git, realGit } from \"#lib/source-cache\"\nimport { isSourceName } from \"#lib/sources\"\n\n/** Provenance, written beside the code. Not a registry — see the module docstring. */\nexport interface PluginOrigin {\n readonly url: string\n /** The branch, tag or commit asked for, or absent for the remote's default. */\n readonly ref?: string\n /** Subdirectory of the repository the plugin was taken from, when it is a monorepo. */\n readonly path?: string\n /** What the ref resolved to at fetch time. Short, as `git rev-parse --short` prints it. */\n readonly commit: string\n readonly fetchedAt: string\n}\n\nexport const ORIGIN_FILE = \".origin.json\"\n\nexport interface InstalledPlugin {\n /** The directory name, which is what a manifest's `plugins:` entry writes. */\n readonly name: string\n readonly dir: string\n readonly origin?: PluginOrigin\n}\n\nexport function readOrigin(dir: string): PluginOrigin | undefined {\n const path = join(dir, ORIGIN_FILE)\n if (!existsSync(path)) return undefined\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as PluginOrigin\n } catch {\n // A corrupt provenance file costs an \"unknown origin\" line and nothing else. The code beside\n // it still loads, and refusing to list it would hide a plugin that is working.\n return undefined\n }\n}\n\n/**\n * Every plugin directory in the root, alphabetical.\n *\n * A listing of what is *available*, which is a different question from what an agent loads — that\n * one only the manifest answers, and `plugins list` prints both.\n */\nexport function installedPlugins(\n env?: Readonly<Record<string, string | undefined>>,\n): readonly InstalledPlugin[] {\n const root = pluginRoot(env)\n let entries: string[]\n try {\n entries = readdirSync(root)\n } catch {\n // No plugins yet is the normal state, not an error.\n return []\n }\n const found: InstalledPlugin[] = []\n for (const name of entries.sort()) {\n if (name.startsWith(\".\") || name.endsWith(\".partial\")) continue\n const dir = join(root, name)\n if (!existsSync(join(dir, \"package.json\")) && !existsSync(join(dir, \"index.js\"))) continue\n const origin = readOrigin(dir)\n found.push({ name, dir, ...(origin === undefined ? {} : { origin }) })\n }\n return found\n}\n\n/**\n * The entry file a directory would be loaded through — the same derivation the loader performs.\n *\n * Duplicated deliberately and narrowly: core's version *throws* the load-time refusals, and this one\n * answers \"would it load\" before anything is renamed into place. The shape it has to agree about is\n * one field of one file, and `plugins add` asserts the agreement by loading through it.\n */\nexport function entryOf(dir: string): string {\n const packageFile = join(dir, \"package.json\")\n if (!existsSync(packageFile)) return join(dir, \"index.js\")\n try {\n const parsed = JSON.parse(readFileSync(packageFile, \"utf8\")) as { main?: unknown }\n if (typeof parsed.main === \"string\" && parsed.main !== \"\") return join(dir, parsed.main)\n } catch {\n // Reported by the caller's own check, which has a better sentence for it than this does.\n }\n return join(dir, \"index.js\")\n}\n\n/**\n * Why this tree cannot be loaded without an install, or `undefined` when it can.\n *\n * A committed `node_modules` clears it: vendoring the dependencies is a perfectly good way to be\n * self-contained, and refusing a tree that already has what it declares would be refusing the thing\n * being asked for.\n */\nexport function notSelfContained(dir: string): string | undefined {\n const packageFile = join(dir, \"package.json\")\n if (!existsSync(packageFile)) return undefined\n let parsed: { dependencies?: Record<string, string> }\n try {\n parsed = JSON.parse(readFileSync(packageFile, \"utf8\")) as {\n dependencies?: Record<string, string>\n }\n } catch (cause) {\n return `its package.json is not valid JSON (${cause instanceof Error ? cause.message : String(cause)})`\n }\n const declared = Object.keys(parsed.dependencies ?? {})\n if (declared.length === 0) return undefined\n if (existsSync(join(dir, \"node_modules\"))) return undefined\n const shown = declared.slice(0, 4).join(\", \")\n return `it declares ${declared.length} runtime ${declared.length === 1 ? \"dependency\" : \"dependencies\"} (${shown}${declared.length > 4 ? \", …\" : \"\"}) and ships no node_modules`\n}\n\n/** What a person typed, turned into something to clone. */\nexport interface PluginSpec {\n readonly name: string\n readonly url: string\n readonly ref?: string\n readonly path?: string\n}\n\n/**\n * Where a repository URL's plugin name comes from.\n *\n * The subdirectory when the URL names one — a monorepo's `packages/channel-whatsapp` is the plugin,\n * not the repository — and the repository name otherwise. Refused rather than transformed when it is\n * not a usable directory name: silently lowercasing `My-Channel` would put the code somewhere\n * other than where the `plugins:` entry the person then reads says it is.\n */\nexport function pluginNameFor(url: string, path: string | undefined): string {\n const segment =\n (path ?? url)\n .split(\"/\")\n .filter((part) => part.length > 0)\n .pop() ?? \"\"\n const name = segment.replace(/\\.git$/, \"\")\n if (!isSourceName(name)) {\n throw new HarnessError({\n code: \"plugin_name_invalid\",\n message: `${JSON.stringify(name || url)} is not a usable plugin directory name`,\n hint: \"A plugin is installed into one lowercase path segment — letters, digits and single hyphens — because that segment is what the manifest's `plugins:` entry names. Pass `--name <name>` to choose it.\",\n })\n }\n return name\n}\n\nexport interface FetchPluginResult {\n readonly dir: string\n readonly commit: string\n}\n\n/**\n * Clone a plugin into the root, replacing whatever was there only once it has worked.\n *\n * `<dir>.partial` then a rename, the same discipline `fetchSource` uses and for the same reason: an\n * interrupted update leaves the previous copy intact and loadable, and an interrupted *first* fetch\n * leaves no directory rather than an empty one that reads as a plugin with nothing in it.\n *\n * `.git` is dropped afterwards, which is where this differs from a skills source. A source is a\n * working copy that `sources update` re-clones; a plugin directory is a vendored artefact that\n * `.origin.json` describes, and leaving a checkout there invites a `git pull` that would move the\n * code out from under the recorded commit with nothing reporting it.\n *\n * The caller decides whether the result is acceptable *before* renaming — see `plugins add`, which\n * loads the plugin out of the partial directory and refuses there. A command that undoes a mistake\n * must not sit behind the load the mistake breaks.\n */\nexport async function fetchPlugin(\n spec: PluginSpec,\n options: {\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly git?: Git\n /** Called with the partial directory before it is renamed into place. Throwing discards it. */\n readonly inspect?: (dir: string) => Promise<void> | void\n } = {},\n): Promise<FetchPluginResult> {\n const git = options.git ?? realGit\n const target = pluginDir(spec.name, options.env)\n const partial = `${target}.partial`\n\n mkdirSync(pluginRoot(options.env), { recursive: true })\n rmSync(partial, { recursive: true, force: true })\n\n const result = await git([\n \"clone\",\n \"--depth\",\n \"1\",\n \"--single-branch\",\n ...(spec.ref === undefined ? [] : [\"--branch\", spec.ref]),\n spec.url,\n partial,\n ])\n if (result.code !== 0) {\n rmSync(partial, { recursive: true, force: true })\n throw cloneFailed(spec, result.stderr, result.timedOut === true)\n }\n\n const head = await git([\"rev-parse\", \"--short\", \"HEAD\"], partial)\n const commit = head.code === 0 ? head.stdout.trim() : \"unknown\"\n\n // The plugin is the named subdirectory when there is one, so everything downstream — the\n // inspection, the entry, the origin file — is about the tree that will actually be loaded.\n const from = spec.path === undefined ? partial : join(partial, spec.path)\n if (!existsSync(from)) {\n rmSync(partial, { recursive: true, force: true })\n throw new HarnessError({\n code: \"plugin_path_missing\",\n message: `${spec.url} has no ${spec.path} at ${commit}`,\n hint: \"The path comes from the URL you pasted — .../tree/<branch>/<subdir>. Check it against the repository, or pass the repository URL on its own.\",\n })\n }\n rmSync(join(from, \".git\"), { recursive: true, force: true })\n\n try {\n await options.inspect?.(from)\n } catch (error) {\n rmSync(partial, { recursive: true, force: true })\n throw error\n }\n\n rmSync(target, { recursive: true, force: true })\n if (from === partial) {\n renameSync(partial, target)\n } else {\n renameSync(from, target)\n rmSync(partial, { recursive: true, force: true })\n }\n\n const origin: PluginOrigin = {\n url: spec.url,\n ...(spec.ref === undefined ? {} : { ref: spec.ref }),\n ...(spec.path === undefined ? {} : { path: spec.path }),\n commit,\n fetchedAt: new Date().toISOString(),\n }\n writeFileSync(join(target, ORIGIN_FILE), `${JSON.stringify(origin, null, 4)}\\n`)\n return { dir: target, commit }\n}\n\nfunction cloneFailed(spec: PluginSpec, stderr: string, timedOut: boolean): HarnessError {\n const said = stderr.trim().split(\"\\n\").slice(-3).join(\" \")\n if (timedOut) {\n return new HarnessError({\n code: \"plugin_fetch_timeout\",\n message: `${spec.name}: git did not finish in time`,\n hint: `Check the network and try again — the partial fetch was discarded, so whatever was installed as ${spec.name} is untouched.`,\n })\n }\n return new HarnessError({\n code: \"plugin_fetch_failed\",\n message: `${spec.name}: could not clone ${spec.url}${said.length === 0 ? \"\" : ` — ${said}`}`,\n hint: \"A private repository needs a credential helper git can use without prompting. Check the URL and the --ref; nothing was written.\",\n })\n}\n",
|
|
25
25
|
"/**\n * `remove <agent>` — the mirror of `init`.\n *\n * `init` creates a sandbox agent: a directory, a manifest, a workspace, an `.env`. Everything after\n * that scatters — sessions and memory into one shared `store.db` keyed by manifest id, logs into\n * `logs/<id>.*.log`, a LaunchAgent under `<slug>.agent.<id>`, a lease row while it runs. Nothing put\n * those back together, so deleting an agent meant `rm -rf` plus knowledge nobody has, and the rows\n * left behind were unreachable: `LeaseStore.orphans` sees ids with *running* turns and no lease, which\n * cannot see an agent whose directory was deleted while it was idle.\n *\n * ## Only the sandbox\n *\n * A ref, never a path. `run` accepts `./somewhere/agent.yaml` because running a manifest in place is a\n * real thing to want; deleting one is not — a directory somebody pointed at is theirs to remove, and a\n * command that recursively deletes an arbitrary argument is one bad tab-completion from being the worst\n * thing in this repository. A path is refused, by name, with `rm -rf` named as the honest alternative.\n *\n * ## Show, then require the name typed back\n *\n * `--dry-run` and the confirmation print the *same* listing from the same function, so what a dry run\n * shows is what a real run does. The bar is the agent's name typed back rather than a keypress: `y`\n * against the wrong listing is one keystroke from deleting conversations that cannot be recovered, and\n * the listing exists on the assumption somebody reads it. Not a TTY means no, so a piped run without\n * `--yes` deletes nothing and says so.\n *\n * ## The order is the safety\n *\n * Stop, then unload the service, then rows, then logs, then the directory — see `removalSteps` for why\n * each of those is where it is. The short version: every step but the last is recoverable, and the\n * directory is the only part that is not.\n */\n\nimport { existsSync, readdirSync, rmSync, statSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport { join } from \"node:path\"\nimport { BRAND, HarnessError, processAlive, readManifestHeader, SqliteStore } from \"@dispach/core\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { labelFor } from \"#lib/launchd\"\nimport {\n type FileFacts,\n type Orphan,\n type RemovalFacts,\n removalFindings,\n removalSteps,\n renderOrphans,\n renderRemoval,\n} from \"#lib/remove-plan\"\nimport { bullet, keyValue, type Row, section } from \"#lib/render\"\nimport { agentsDir, listAgents, logPaths, sandboxRoot, storePath } from \"#lib/sandbox\"\nimport { type Exec, resolveServiceManager, type ServiceManager } from \"#lib/service\"\nimport { stopCommand } from \"#stop\"\n\n/**\n * The facts plus the manifest path the executor needs.\n *\n * `manifestPath` is deliberately **not** on `RemovalFacts`: the plan module never reads it, and a pure\n * module carrying a field nothing in it uses is a field that can quietly go wrong. It is `stop`'s\n * argument, so it belongs to the half of this that does the work.\n */\ntype Removal = RemovalFacts & { readonly manifestPath: string }\n\nexport interface RemoveOptions {\n /** The sandbox directory name. Absent only with `--prune` or `--all`. */\n readonly ref?: string\n readonly dryRun?: boolean\n /** Delete the directory only; leave the store, the logs and the service alone. */\n readonly filesOnly?: boolean\n /** Rows and logs no sandbox directory claims. */\n readonly prune?: boolean\n readonly all?: boolean\n readonly yes?: boolean\n readonly json?: boolean\n readonly store?: string\n /** Test seams. Nothing in `src/` outside this file passes them. */\n readonly exec?: Exec\n readonly platform?: string\n /** Injected so the prompt is testable, and so `--yes` can bypass it without a fake TTY. */\n readonly confirm?: (question: string, expected: string) => Promise<boolean>\n}\n\nexport async function removeCommand(options: RemoveOptions): Promise<number> {\n const store = await SqliteStore.open({ path: options.store ?? storePath() })\n try {\n if (options.prune === true) return await pruneAction(options, store)\n if (options.all === true) return await allAction(options, store)\n if (options.ref === undefined) {\n throw new HarnessError({\n code: \"cli_remove_needs_agent\",\n message: \"remove needs an agent.\",\n hint: `\\`${BRAND.slug} remove <name>\\` takes a sandbox agent's name — the ones \\`${BRAND.slug} run\\` lists. \\`--prune\\` clears data no agent claims; \\`--all\\` removes every agent.`,\n })\n }\n return await removeOne(options.ref, options, store)\n } finally {\n await store.close()\n }\n}\n\n// ─── one agent ──────────────────────────────────────────────────────────────────────────\n\nasync function removeOne(ref: string, options: RemoveOptions, store: SqliteStore): Promise<number> {\n const facts = await gather(ref, options, store)\n const findings = removalFindings(facts)\n if (findings.length > 0) {\n const first = findings[0] as { code: string; message: string; hint: string }\n throw new HarnessError({ code: first.code, message: first.message, hint: first.hint })\n }\n\n const steps = removalSteps(facts)\n const listing = `${section(`removing ${ref} will:`, true)}\\n${renderRemoval(facts)}\\n\\n${steps\n .map((step) => bullet(step.detail))\n .join(\"\\n\")}\\n`\n\n if (options.dryRun === true) {\n process.stdout.write(\n options.json === true\n ? `${JSON.stringify({ ref, agentId: facts.agentId, steps, footprint: facts.footprint }, null, 2)}\\n`\n : `${listing}\\nNothing was deleted — this was --dry-run.\\n`,\n )\n return EXIT_OK\n }\n\n process.stdout.write(listing)\n if (!(await agreed(options, ref, `type the agent's name to confirm:`))) {\n process.stdout.write(\"\\nNothing was deleted.\\n\")\n return EXIT_OK\n }\n\n return await execute(facts, options, store)\n}\n\n/**\n * Perform the steps, in order, reporting each.\n *\n * A failure to stop **aborts** rather than continuing: deleting the directory out from under a live\n * process leaves it serving from a manifest that no longer exists, with the backgrounded children only\n * a graceful stop would have reaped.\n */\nasync function execute(\n facts: Removal,\n options: RemoveOptions,\n store: SqliteStore,\n): Promise<number> {\n const done: Row[] = []\n\n if (facts.running !== undefined || (!facts.filesOnly && facts.service !== undefined)) {\n // Delegated to `stop` rather than reimplemented: it consults both sources, sends SIGTERM before\n // SIGKILL, and disables as well as unloading. Its output is the same words the stop command\n // prints, which is the point — this is not a second, subtly different way to stop an agent.\n const code = await stopCommand({\n manifestPath: facts.manifestPath,\n ...(options.exec === undefined ? {} : { exec: options.exec }),\n ...(options.platform === undefined ? {} : { platform: options.platform }),\n })\n if (code !== EXIT_OK) {\n process.stderr.write(\n `\\nStopping ${facts.ref} did not succeed, so nothing was deleted. Its directory and data are untouched.\\n hint: check what is still running with \\`${BRAND.slug} stop --dry-run\\`, then run remove again.\\n`,\n )\n return EXIT_FAILURE\n }\n done.push({ label: \"stopped\", value: facts.ref })\n }\n\n if (!facts.filesOnly && facts.service !== undefined) {\n // `stop` disabled and unloaded it; this deletes the definition. Both are needed — a plist left\n // on disk is a job that reappears the moment somebody runs `daemon start`.\n const manager = serviceManager(options)\n try {\n manager?.uninstall(facts.service)\n done.push({ label: \"service\", value: `${facts.service} removed` })\n } catch (error) {\n // Not fatal: the agent is still going, and a plist for a deleted agent fails loudly at the\n // next login rather than silently. Named so it can be cleaned up by hand.\n done.push({\n label: \"service\",\n value: `${facts.service} could NOT be removed`,\n note: error instanceof Error ? error.message : String(error),\n })\n }\n }\n\n if (!facts.filesOnly) {\n const went = await store.purgeAgent(facts.agentId)\n done.push({\n label: \"store\",\n value: `${went.sessions} conversation(s), ${went.messages} message(s), ${went.passages} passage(s)`,\n })\n for (const log of facts.logs) rmSync(log.path, { force: true })\n if (facts.logs.length > 0) {\n done.push({ label: \"logs\", value: `${facts.logs.length} file(s)` })\n }\n }\n\n // Last, for the reason `removalSteps` documents: it is the only irreplaceable part.\n rmSync(facts.dir, { recursive: true, force: true })\n done.push({ label: \"directory\", value: facts.dir })\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify({ removed: facts.ref, agentId: facts.agentId, filesOnly: facts.filesOnly }, null, 2)}\\n`,\n )\n return EXIT_OK\n }\n process.stdout.write(`\\n${facts.ref} removed.\\n${keyValue(done)}\\n`)\n if (facts.filesOnly) {\n process.stdout.write(\n `\\nIts sessions and memory are still in the store under the id \"${facts.agentId}\", which another agent shares.\\n`,\n )\n }\n return EXIT_OK\n}\n\n// ─── every agent, and the leftovers ─────────────────────────────────────────────────────\n\nasync function allAction(options: RemoveOptions, store: SqliteStore): Promise<number> {\n const agents = listAgents()\n if (agents.length === 0) {\n process.stdout.write(\"The sandbox is empty — there is nothing to remove.\\n\")\n return EXIT_OK\n }\n\n process.stdout.write(\n `${section(`removing every agent in ${agentsDir()}:`, true)}\\n${agents\n .map((agent) =>\n bullet(\n `${agent.ref}${agent.id === undefined || agent.id === agent.ref ? \"\" : ` (id ${agent.id})`}`,\n ),\n )\n .join(\"\\n\")}\\n`,\n )\n if (options.dryRun === true) {\n process.stdout.write(\"\\nNothing was deleted — this was --dry-run.\\n\")\n return EXIT_OK\n }\n // A different word from a ref, so a half-remembered `--all` cannot be confirmed by typing the name\n // of the one agent somebody had in mind.\n if (!(await agreed(options, \"all\", `type \\`all\\` to remove all ${agents.length}:`))) {\n process.stdout.write(\"\\nNothing was deleted.\\n\")\n return EXIT_OK\n }\n\n let worst = EXIT_OK\n for (const agent of agents) {\n const facts = await gather(agent.ref, options, store)\n // Every agent is going, so a shared id is no longer a reason to refuse: nothing is left behind\n // to be surprised by the deletion. Ordering still matters per agent.\n const code = await execute({ ...facts, sharesIdWith: [] }, options, store)\n if (code !== EXIT_OK) worst = code\n }\n return worst\n}\n\n/**\n * Rows and logs belonging to no sandbox directory.\n *\n * The gap `LeaseStore.orphans`'s own docstring admits to and pointed at a `sessions --reap-orphans`\n * that was never built. Two sources, because an orphan can appear in either: `store.agentIds()` for\n * rows, and the logs directory for files a service wrote before its agent was deleted.\n */\nasync function pruneAction(options: RemoveOptions, store: SqliteStore): Promise<number> {\n const claimed = new Set(\n listAgents()\n .map((agent) => agent.id ?? agent.ref)\n .filter((id) => id !== \"\"),\n )\n const ids = new Set<string>((await store.agentIds()).filter((id) => !claimed.has(id)))\n for (const id of logAgentIds()) if (!claimed.has(id)) ids.add(id)\n\n const orphans: Orphan[] = []\n for (const agentId of [...ids].sort()) {\n orphans.push({\n agentId,\n footprint: await store.agentFootprint(agentId),\n logs: logsFor(agentId),\n })\n }\n\n if (orphans.length === 0) {\n process.stdout.write(\n options.json === true\n ? `${JSON.stringify({ pruned: [] })}\\n`\n : `Nothing to prune — every agent id in the store and the log directory belongs to an agent in ${agentsDir()}.\\n`,\n )\n return EXIT_OK\n }\n\n process.stdout.write(\n `${section(\"no sandbox directory claims these:\", true)}\\n${renderOrphans(orphans)}\\n`,\n )\n if (options.dryRun === true) {\n process.stdout.write(\"\\nNothing was deleted — this was --dry-run.\\n\")\n return EXIT_OK\n }\n if (!(await agreed(options, \"prune\", \"type `prune` to delete them:\"))) {\n process.stdout.write(\"\\nNothing was deleted.\\n\")\n return EXIT_OK\n }\n\n const rows: Row[] = []\n for (const orphan of orphans) {\n const went = await store.purgeAgent(orphan.agentId)\n for (const log of orphan.logs) rmSync(log.path, { force: true })\n rows.push({\n label: orphan.agentId,\n value: `${went.sessions} conversation(s), ${went.passages} passage(s), ${orphan.logs.length} log file(s)`,\n })\n }\n process.stdout.write(\n options.json === true\n ? `${JSON.stringify({ pruned: orphans.map((o) => o.agentId) }, null, 2)}\\n`\n : `\\npruned ${orphans.length} agent id(s).\\n${keyValue(rows)}\\n`,\n )\n return EXIT_OK\n}\n\n// ─── facts ──────────────────────────────────────────────────────────────────────────────\n\nasync function gather(ref: string, options: RemoveOptions, store: SqliteStore): Promise<Removal> {\n if (ref.includes(\"/\") || ref.endsWith(\".yaml\") || ref.endsWith(\".yml\")) {\n throw new HarnessError({\n code: \"cli_remove_takes_a_name\",\n message: `remove takes a sandbox agent's name, and \"${ref}\" is a path.`,\n hint: `An agent outside ${agentsDir()} is a directory you created and yours to delete — \\`rm -rf\\` it. This command only removes agents \\`${BRAND.slug} init\\` made, because it also has to clear their sessions, memory, logs and service.`,\n })\n }\n\n const agents = listAgents()\n const agent = agents.find((candidate) => candidate.ref === ref)\n if (agent === undefined) {\n const known = agents.map((candidate) => candidate.ref)\n throw new HarnessError({\n code: \"cli_agent_unknown\",\n message: `No agent named \"${ref}\" in the sandbox${known.length === 0 ? \", which is empty\" : \"\"}.`,\n hint:\n known.length === 0\n ? `Nothing to remove. \\`${BRAND.slug} init\\` creates one.`\n : `Known agents: ${known.join(\", \")}. \\`--prune\\` clears data left by an agent whose directory is already gone.`,\n })\n }\n\n // The header, not `loadManifest`: loading checks that key env vars are set, and refusing to delete\n // a broken agent because its API key is missing would refuse exactly the agent most worth deleting.\n let agentId = agent.id\n if (agentId === undefined) {\n try {\n agentId = readManifestHeader(agent.manifestPath).id\n } catch {\n // Unreadable manifest. The directory can still go; there is just no id to key data by, so\n // this degrades to files-only rather than guessing that the ref is the id.\n }\n }\n\n const filesOnly = options.filesOnly === true || agentId === undefined\n const id = agentId ?? ref\n const footprint = await store.agentFootprint(id)\n const lease = footprint.lease ? await store.leases.get(id) : undefined\n const service = serviceManager(options)\n const label = labelFor(BRAND.slug, id)\n\n return {\n ref,\n agentId: id,\n manifestPath: agent.manifestPath,\n dir: agent.dir,\n files: treeSize(agent.dir),\n footprint,\n logs: logsFor(id),\n sharesIdWith: agents\n .filter((other) => other.ref !== ref && (other.id ?? \"\") === id)\n .map((other) => other.ref),\n // A lease row is a claim, not a fact: a boot that failed after claiming leaves a row seconds old\n // with no process under it, and reporting that as running would block a removal on a pid that\n // does not exist.\n ...(lease !== undefined && processAlive(lease.pid)\n ? { running: { pid: lease.pid, mode: lease.mode } }\n : {}),\n ...(service?.state(label).installed === true ? { service: label } : {}),\n filesOnly,\n }\n}\n\nfunction serviceManager(options: RemoveOptions): ServiceManager | undefined {\n const platform = options.platform ?? process.platform\n if (platform !== \"darwin\") return undefined\n return resolveServiceManager(platform, {\n home: homedir(),\n uid: process.getuid?.() ?? 0,\n envPrefix: BRAND.envPrefix,\n ...(options.exec === undefined ? {} : { exec: options.exec }),\n })\n}\n\n/** Files and bytes under a directory. A directory that cannot be read counts as empty rather than throwing. */\nfunction treeSize(dir: string): { readonly count: number; readonly bytes: number } {\n let count = 0\n let total = 0\n const walk = (at: string): void => {\n let entries: string[]\n try {\n entries = readdirSync(at)\n } catch {\n return\n }\n for (const entry of entries) {\n const path = join(at, entry)\n try {\n const stats = statSync(path)\n if (stats.isDirectory()) {\n walk(path)\n continue\n }\n count += 1\n total += stats.size\n } catch {\n // Raced away mid-walk. The listing is a summary, not an inventory.\n }\n }\n }\n walk(dir)\n return { count, bytes: total }\n}\n\nfunction logsFor(agentId: string): readonly FileFacts[] {\n const paths = logPaths(agentId)\n const out: FileFacts[] = []\n for (const path of [paths.out, paths.err]) {\n try {\n if (!existsSync(path)) continue\n out.push({ path, bytes: statSync(path).size })\n } catch {\n // Unreadable. Not listed, and not deleted either.\n }\n }\n return out\n}\n\n/**\n * Agent ids implied by the log directory.\n *\n * A service can have written logs for an agent that never reached the store — a manifest that failed to\n * load restarts, writes to stderr and persists nothing — so the log directory names ids `agentIds()`\n * cannot. `dot.err.log` on the author's machine was exactly that.\n */\nfunction logAgentIds(): readonly string[] {\n let entries: string[]\n try {\n entries = readdirSync(join(sandboxRoot(), \"logs\"))\n } catch {\n return []\n }\n const ids = new Set<string>()\n for (const entry of entries) {\n for (const suffix of [\".out.log\", \".err.log\"]) {\n if (entry.endsWith(suffix)) ids.add(entry.slice(0, -suffix.length))\n }\n }\n return [...ids]\n}\n\nasync function agreed(\n options: RemoveOptions,\n expected: string,\n question: string,\n): Promise<boolean> {\n if (options.yes === true) return true\n const ask = options.confirm\n if (ask === undefined) return false\n return await ask(question, expected)\n}\n",
|
|
26
26
|
"/**\n * What removing an agent would actually take, and what should stop it.\n *\n * Facts in, a listing and an ordered plan out. Gathering the facts needs the filesystem, the store and\n * `launchctl`; deciding what to do with them needs none of that — and the interesting cases here are\n * exactly the ones that are painful to produce on a real machine: a manifest id shared by two\n * directories, a live lease, an installed service, rows nobody claims. A table beats breaking a\n * sandbox nine different ways.\n *\n * ## Why the listing and the deletion come from one place\n *\n * The confirmation is a listing plus the agent's name typed back, and the listing *is* `--dry-run` —\n * one code path, so what a dry run shows is what a real run does. Deriving the two separately is how a\n * confirmation comes to describe something other than what happens, which for an irreversible command\n * is the worst available failure: the person read it, agreed to it, and got something else.\n *\n * No `node:*`, no `process`. This module is on the boundaries test's `PURE` list.\n */\n\nimport type { AgentFootprint } from \"@dispach/core\"\nimport { bytes, keyValue, type Row } from \"#lib/render\"\n\nexport interface Finding {\n readonly code: string\n readonly message: string\n /** Never optional. Hard rule 7, and a test asserts it over every finding this can produce. */\n readonly hint: string\n}\n\n/** A file the removal would delete, and what it costs to keep. */\nexport interface FileFacts {\n readonly path: string\n readonly bytes: number\n}\n\nexport interface RemovalFacts {\n /** The directory name — what was typed, and what the confirmation asks to be typed back. */\n readonly ref: string\n /** The manifest id. Keys the store, the logs and the service label; may differ from `ref`. */\n readonly agentId: string\n readonly dir: string\n /** Files under `dir`, counted and summed. Empty when the directory could not be read. */\n readonly files: { readonly count: number; readonly bytes: number }\n /** What the store holds for `agentId`. */\n readonly footprint: AgentFootprint\n /** Log files that exist. Absent entries are simply not listed. */\n readonly logs: readonly FileFacts[]\n /**\n * Other sandbox directories whose manifest id is also `agentId`.\n *\n * The refusal case. Store rows, logs and the service label are all keyed by id, so removing this\n * agent's *data* would remove theirs.\n */\n readonly sharesIdWith: readonly string[]\n /** A live process holding the lease, if any. */\n readonly running?: { readonly pid: number; readonly mode: string }\n /** The launchd label, when a service is installed under it. */\n readonly service?: string\n /** Only the directory goes; the store, the logs and the service are left alone. */\n readonly filesOnly: boolean\n}\n\n/**\n * What must not be removed, and why.\n *\n * **A shared manifest id blocks, rather than degrading to a partial removal.** Deleting store rows by\n * `agent_id` when two directories answer to that id destroys the other agent's conversations and\n * memory, and reports success — the silent-loss shape hard rule 8 exists to prevent. Falling back to\n * files-only automatically was the alternative and is worse in a quieter way: it leaves rows that\n * `agentIds` will list forever as belonging to nobody, having told the person their agent was gone.\n *\n * `--files-only` clears it, because then the id is not being acted on at all.\n */\nexport function removalFindings(facts: RemovalFacts): readonly Finding[] {\n if (facts.filesOnly || facts.sharesIdWith.length === 0) return []\n const others = facts.sharesIdWith.join(\", \")\n return [\n {\n code: \"cli_agent_id_shared\",\n message: `\"${facts.ref}\" has the manifest id \"${facts.agentId}\", which is also used by ${others} — removing its data would take that agent's sessions and memory too.`,\n hint: `Change one manifest's id and run \\`memory rebuild\\` for it, or pass --files-only to delete just the ${facts.ref} directory and leave the store alone.`,\n },\n ]\n}\n\nexport type StepKind = \"stop\" | \"service\" | \"store\" | \"logs\" | \"directory\"\n\nexport interface Step {\n readonly kind: StepKind\n /** What this step will do, in the imperative. Shown before it happens. */\n readonly detail: string\n}\n\n/**\n * The steps, in the order they must run.\n *\n * The order is not cosmetic:\n *\n * 1. **Stop first.** A process holding the lease is still writing sessions, and a graceful stop is the\n * only path that runs `provider.stop()` — the sole reaper for backgrounded `exec` children. Deleting\n * a running agent's directory would leave a live process serving from a manifest that no longer\n * exists, with orphaned shells behind it.\n * 2. **Service next.** `disable` persists across boots and `bootout` does not, so both are needed: a\n * label left enabled comes back at the next login and fails forever against a deleted manifest.\n * 3. **Store, then logs, then the directory last.** Every earlier step is recoverable — an agent whose\n * rows are gone still loads and still runs. The directory is the only irreplaceable part, so it goes\n * when nothing else can fail; the reverse order leaves a manifest-less agent whose data is\n * unreachable and whose name nothing can name.\n */\nexport function removalSteps(facts: RemovalFacts): readonly Step[] {\n const steps: Step[] = []\n if (facts.running !== undefined) {\n steps.push({\n kind: \"stop\",\n detail: `stop pid ${facts.running.pid} (${facts.running.mode}) — gracefully, so anything it left running in the background is reaped`,\n })\n }\n if (!facts.filesOnly && facts.service !== undefined) {\n steps.push({\n kind: \"service\",\n detail: `disable and unload ${facts.service}`,\n })\n }\n if (!facts.filesOnly) {\n const f = facts.footprint\n steps.push({\n kind: \"store\",\n detail: `delete ${plural(f.sessions, \"conversation\")}, ${plural(f.messages, \"message\")}, ${plural(f.passages, \"memory passage\")}`,\n })\n if (facts.logs.length > 0) {\n steps.push({ kind: \"logs\", detail: `delete ${plural(facts.logs.length, \"log file\")}` })\n }\n }\n steps.push({ kind: \"directory\", detail: `delete ${facts.dir}` })\n return steps\n}\n\n/**\n * The listing shown before anything happens, and printed on its own by `--dry-run`.\n *\n * Every row is a number somebody might want to stop over. A zero row is still shown where its absence\n * would be ambiguous — `service not installed` is information, and omitting it invites the reading\n * that a service was quietly left behind.\n */\nexport function renderRemoval(facts: RemovalFacts): string {\n const f = facts.footprint\n const rows: Row[] = [\n {\n label: \"directory\",\n value: `${facts.dir}`,\n note: `${plural(facts.files.count, \"file\")}, ${bytes(facts.files.bytes)}`,\n },\n ]\n if (facts.agentId !== facts.ref) {\n // Worth its own row whenever they differ: everything except the directory is keyed by the id,\n // so a person who only knows the ref is reading a listing about a name they have not seen.\n rows.push({\n label: \"manifest id\",\n value: facts.agentId,\n note: \"keys the store, logs and service\",\n })\n }\n if (facts.filesOnly) {\n rows.push({\n label: \"keeping\",\n value: `${plural(f.sessions, \"conversation\")}, ${plural(f.passages, \"memory passage\")}, and the logs`,\n note: \"--files-only\",\n })\n } else {\n rows.push(\n {\n label: \"sessions\",\n value: `${plural(f.sessions, \"conversation\")}, ${plural(f.messages, \"message\")}, ${plural(f.turns, \"turn\")}`,\n },\n {\n label: \"memory\",\n value: `${plural(f.passages, \"passage\")} from ${plural(f.memorySources, \"source\")}`,\n },\n {\n label: \"outbox\",\n value:\n f.outbox === 0\n ? \"nothing queued\"\n : `${plural(f.outbox, \"delivery\")}${f.outboxPending === 0 ? \"\" : `, ${f.outboxPending} not yet sent`}`,\n // A pending delivery is a reply somebody is waiting for, and removal abandons it.\n ...(f.outboxPending === 0 ? {} : { note: \"abandoned\" }),\n },\n {\n label: \"schedules\",\n value: f.schedules === 0 ? \"none\" : plural(f.schedules, \"schedule\"),\n // A schedule is the one thing here that would keep *firing* if it survived, so its\n // removal is the part of this listing least likely to be regretted and most likely\n // to be missed if it were absent.\n ...(f.schedules === 0 ? {} : { note: \"stops firing\" }),\n },\n {\n label: \"logs\",\n value:\n facts.logs.length === 0\n ? \"none\"\n : `${plural(facts.logs.length, \"file\")}, ${bytes(facts.logs.reduce((n, l) => n + l.bytes, 0))}`,\n },\n { label: \"service\", value: facts.service ?? \"not installed\" },\n )\n }\n rows.push({\n label: \"running\",\n value:\n facts.running === undefined ? \"no\" : `pid ${facts.running.pid} (${facts.running.mode})`,\n })\n return keyValue(rows)\n}\n\n/** An agent id with rows or logs in the sandbox that no directory claims. */\nexport interface Orphan {\n readonly agentId: string\n readonly footprint: AgentFootprint\n readonly logs: readonly FileFacts[]\n}\n\n/**\n * The listing for `--prune`.\n *\n * Separate from `renderRemoval` because it answers a different question — not \"what does this agent\n * own\" but \"what is left over\" — and because an orphan has no directory, no ref and no manifest, so\n * most of the other rows would be empty or a lie.\n */\nexport function renderOrphans(orphans: readonly Orphan[]): string {\n if (orphans.length === 0) return \"\"\n return orphans\n .map((orphan) => {\n const f = orphan.footprint\n const parts: string[] = []\n if (f.sessions > 0) {\n parts.push(\n `${plural(f.sessions, \"conversation\")}, ${plural(f.messages, \"message\")}`,\n )\n }\n if (f.passages > 0) parts.push(`${plural(f.passages, \"memory passage\")}`)\n if (f.outbox > 0) parts.push(`${plural(f.outbox, \"queued delivery\")}`)\n if (f.schedules > 0) parts.push(`${plural(f.schedules, \"schedule\")}`)\n if (f.lease) parts.push(\"a stale lease\")\n if (orphan.logs.length > 0) {\n parts.push(\n `${plural(orphan.logs.length, \"log file\")}, ${bytes(orphan.logs.reduce((n, l) => n + l.bytes, 0))}`,\n )\n }\n // Never empty: an orphan is only listed because *something* references the id, so an empty\n // parts list would mean the caller found it by some route this cannot describe.\n return ` ${orphan.agentId} ${parts.length === 0 ? \"rows with no detail\" : parts.join(\" · \")}`\n })\n .join(\"\\n\")\n}\n\nfunction plural(count: number, noun: string): string {\n return `${count} ${noun}${count === 1 ? \"\" : \"s\"}`\n}\n",
|
|
@@ -31,10 +31,11 @@
|
|
|
31
31
|
"/**\n * The conversation a resumed session paints, out of the messages the store kept.\n *\n * Pure, and extracted from `run` for one reason: it was four chained lambdas inside a function that\n * needs a live runtime to call, so the only way to check it was to resume a real session and look. The\n * shape it decides has already been wrong twice — first painting nothing at all under a banner that\n * said `17 message(s)`, then painting every turn except the ones that called a tool — and both times\n * the layers around it were individually correct.\n *\n * What counts as part of the conversation:\n *\n * - No `origin` — a person's message, or a reply the model wrote as its final answer.\n * - `origin: \"call\"` — a tool-calling step. Its prose is narration the live session *did* show as it\n * streamed, so excluding the row made a resumed transcript differ from the one that had been on\n * screen. Under NLT the row also holds the ACTION block, which `proseOf` removes.\n *\n * What does not, and why each is deliberate rather than unhandled:\n *\n * - `origin: \"observation\"` — text a stranger wrote. It reaches the model inside a fence; painting it\n * as part of the conversation would present it as something the agent or the person said.\n * - `origin: \"repair\"` and `origin: \"digest\"` — the runtime talking to itself about a malformed call\n * or a compacted history. True of the prompt, not of anything anybody said.\n * - `role: \"system\"` and `role: \"tool\"` — the assembled prefix and native tool results, neither of\n * which was ever on screen.\n */\n\nimport type { ChatMessage, DialectId } from \"@dispach/core\"\nimport { BRAND, proseOf } from \"@dispach/core\"\nimport { DIM_STYLE, RESET_STYLE } from \"#lib/const\"\nimport type { PriorMessage } from \"#transcript\"\n\n/**\n * `history` in order, reduced to what a reader saw. Empty prose is dropped, not painted blank.\n *\n * A step that called a tool without narrating it produces no text at all, and a blank message row in a\n * resumed transcript reads as content that failed to load.\n */\nexport function priorMessages(\n history: readonly ChatMessage[],\n dialect: DialectId,\n): readonly PriorMessage[] {\n const shown: PriorMessage[] = []\n for (const message of history) {\n if (message.origin !== undefined && message.origin !== \"call\") continue\n if (message.role !== \"user\" && message.role !== \"assistant\") continue\n const text = proseOf(message, dialect)\n if (text === \"\") continue\n shown.push({ role: message.role, text })\n }\n return shown\n}\n\n/**\n * The note a clean exit leaves on the shell's own screen.\n *\n * Nothing else survives. That was the decision and the alternate screen enforces it whether we agree or\n * not — so the one thing worth printing is not the conversation, which is in the store, but the command\n * that reaches it again.\n *\n * Two lines and faint, which is a change from the one bright line this used to be. The old form led with\n * `session <key> ·` and buried the command behind `resume with:`, so the half a person needs to *copy*\n * sat at the end of a sentence they had to read first. The key is not lost by dropping the prefix — it is\n * inside the command, which is the only place it is any use. And faint because this is the epilogue: the\n * work is over, and a line as loud as the output above it reads as one more result.\n *\n * The agent is named by the ref `resolveAgentRef` accepts rather than by a path, because a line you\n * cannot paste is a line that reads as help and is not.\n */\nexport function resumeNotice(input: {\n readonly ref: string | undefined\n readonly sessionKey: string\n}): string {\n // Named rather than omitted when the id is missing: a command with a placeholder in it says what is\n // wanted where it is wanted, and a command silently missing its agent looks complete and is not.\n const ref = input.ref ?? \"<your agent>\"\n const command = `${BRAND.slug} run ${ref} --session ${input.sessionKey}`\n // The blank line above separates it from whatever the shell had on screen before the session took it.\n // The reset precedes the last newline so the prompt after it is not faint.\n return `\\n${DIM_STYLE}Resume this session with:\\n${command}${RESET_STYLE}\\n`\n}\n\n/**\n * Why a banner is being printed, as the one sentence a person reads.\n *\n * Four answers, and they are genuinely different things to say: a `/restart` is about *configuration*\n * and would be a lie about a switch; a `/new` opened a conversation that did not exist a moment ago,\n * and the only thing worth saying about it is what happened to the one being left.\n *\n * Extracted from `bannerLines` because that function needs a live agent and a store to call, so the\n * sentence selection — the only part a person actually reads — could not be checked without resuming a\n * real session and looking. Exactly the reason `priorMessages` above lives here.\n *\n * The return is `undefined` for a first run: nothing has happened yet that needs explaining.\n */\nexport function reopenNote(\n reopened: \"first\" | \"restart\" | \"switch\" | \"new\",\n previousKey?: string,\n): string | undefined {\n switch (reopened) {\n case \"first\":\n return undefined\n case \"restart\":\n return \"restarted — the configuration on disk is now the one in force; the conversation continues from the store.\"\n case \"switch\":\n // What was left behind is worth naming: the previous conversation is still in the store, and\n // the key in the banner above is the one that reaches this one again.\n return \"switched conversation — the one you left is still in the store, under its own key.\"\n case \"new\":\n // By name, unlike the switch sentence. After a `/new` the conversation you left is on screen\n // nowhere — the picker lists it, but only once you know to go looking — and the whole promise\n // of the command is that nothing was destroyed. Claiming that without naming the key is\n // asking to be taken on trust.\n return previousKey === undefined\n ? \"new conversation — the one you left is still in the store, under its own key.\"\n : `new conversation — the one you left is ${previousKey}, still in the store. /sessions goes back to it.`\n }\n}\n",
|
|
32
32
|
"/**\n * What a chat view needs from an agent, and the two ways of supplying it.\n *\n * ## Why this exists\n *\n * `run` built a `Runtime` in its own process and handed the resulting `Agent` and `EventBus`\n * straight to the screen. That was right while the CLI *was* the product; it stopped being right\n * the moment a server is always on, because `run` then starts a **second** runtime for an agent\n * something else is already hosting. Two processes on one SQLite file is not two views of one\n * conversation — it is two writers, and slot 2 told the model as much (`declined`, decision 5.17),\n * which is the runtime being honest about a situation nobody wanted.\n *\n * So the screen takes an `AgentSource` instead. `embeddedSource` is today's behaviour, for the\n * cases where nothing else is hosting: a container, CI, `--ephemeral`, a machine whose bootstrap\n * was suppressed. `remoteSource` is the same shape over `/v1`, and is what a terminal gets when a\n * live host holds the agent.\n *\n * ## Why the two implementations are small\n *\n * Because the *views* were already projections. `toolsView` takes a structural `AgentToolsSource`\n * rather than an `Agent`, `ContextView` and `SessionRowSource` are plain data, and `endNote` lives\n * in core precisely so four callers cannot word a turn's ending four ways. Almost nothing here\n * formats anything; it fetches, and hands back the shapes the formatters already read.\n *\n * ## The one thing that is genuinely different\n *\n * **Cancellation.** Embedded, a turn is an in-process promise and an `AbortController` reaches it.\n * Attached, the turn belongs to the server — the recorded rule is that turns are detached from the\n * client connection and are never cancelled on disconnect — so stopping one is a *request*, naming\n * the turn. `send` takes a signal on both paths and each honours it its own way, so the caller\n * keeps one contract and `useTurn` never learns which it is talking to.\n */\n\nimport type { AnyEvent, ErrorDetail, StreamFilter, TurnEndReason } from \"@dispach/core\"\nimport { createNltStreamFilter, passThroughFilter } from \"@dispach/core/wire\"\nimport { priorMessages } from \"#lib/resume\"\nimport { type ContextView, type ToolsView, toolsView } from \"#lib/session-commands\"\nimport type { PriorMessage } from \"#transcript\"\n\n/** The facts a banner, a status line and a reasoning decision are made from. */\nexport interface SourceDescription {\n readonly agentId: string\n readonly name: string\n readonly model: string\n readonly dialect: string\n readonly window: number\n /** What the catalogue costs per turn — the figure `/tools` reports and a person trims against. */\n readonly catalogueTokens: number\n /** `\"none\"` when the model does not reason, which is what decides streaming it by default. */\n readonly thinking: string\n readonly warnings: readonly ErrorDetail[]\n}\n\n/** One conversation, as the session picker reads it. */\nexport interface SourceSession {\n readonly sessionKey: string\n readonly channel: string\n readonly turns: number\n readonly messages: number\n readonly lastActivityAt: string\n readonly phase?: string\n /** False for a conversation a \"new conversation\" left behind (`docs/23-SPEC-SESSIONS.md`). */\n readonly head?: boolean\n}\n\nexport interface SendOptions {\n readonly sessionKey: string\n readonly signal: AbortSignal\n}\n\n/**\n * How a turn ended, in the shape both renderers already read.\n *\n * `send` resolves with this rather than `void` because the plain path needs it: `endNote` takes a\n * reason and a step count, `endedBadly` decides the exit status, and the stats line is the one\n * thing a scripted run prints that is not the reply. Attached, every field comes off `turn.end`\n * and the `error` event rather than out of a returned object — which is the same information, and\n * is why this is a shape rather than core's `TurnResult`.\n */\nexport interface TurnOutcome {\n /** The reply. Empty on the streaming path, where it has already been written out. */\n readonly text: string\n readonly reason: TurnEndReason\n readonly steps: number\n readonly durationMs: number\n readonly tokens: { readonly prompt: number; readonly output: number }\n readonly error?: ErrorDetail\n}\n\nexport interface AgentSource {\n /**\n * Which of the two this is.\n *\n * Read by the banner and by `/status`, never to choose behaviour — a caller branching on this\n * is a caller that should have been given a method. The one legitimate use is telling somebody\n * what they are looking at, and that is exactly the sentence a person needs when the same\n * command does two things.\n */\n readonly kind: \"embedded\" | \"attached\"\n readonly agentId: string\n /** Where the agent actually runs, when it is somewhere else. */\n readonly host?: { readonly baseUrl: string; readonly pid: number }\n\n describe(): SourceDescription\n /**\n * Every event for this runtime, chunks included. Returns the unsubscribe.\n *\n * Chunks are not optional and never have been: this is the one wildcard subscriber in the tree\n * that genuinely wants per-token frames, which is why they are opt-in everywhere else. Dropping\n * the flag does not break anything loudly — the TUI simply stops streaming.\n */\n subscribe(handler: (event: AnyEvent) => void): () => void\n /** Resolves when the turn has ended, on both paths, so `busy` means the same thing. */\n send(text: string, options: SendOptions): Promise<TurnOutcome>\n /**\n * A fresh filter for the dialect in use.\n *\n * The wire carries **unfiltered** chunks — deliberately, since a stream nobody has filtered is\n * the one a debugger wants and the tool block is what the next model call sees. So an attached\n * view does the same work the embedded one does, from the dialect its description already\n * carries. Without it a chat bubble shows `ACTION: now / format: human / END`.\n */\n streamFilter(): StreamFilter\n history(sessionKey: string): Promise<readonly PriorMessage[]>\n sessions(): Promise<readonly SourceSession[]>\n clearSession(sessionKey: string): Promise<void>\n /**\n * The person's own conversation, when the agent keeps one across surfaces\n * (`docs/23-SPEC-SESSIONS.md`): what a run with no key opens, so the terminal shows what was said\n * on Telegram. `undefined` when the agent keeps none (`channel-peer`, or an owner or peer scope\n * nobody is assigned to). Attached, also `undefined` until the host lists one, since it reads the\n * session list; the key a run then sends resolves to the same conversation on the host.\n */\n ownConversation(): Promise<string | undefined>\n /**\n * The conversation a turn sent with `sessionKey` will run in. Under `sessions.scope: owner` it is\n * `owner:<P>` whatever the terminal named, and both renderers follow a turn's events by key, so a\n * run resolves before it sends: 0.2.2's `run --plain` filtered out every event of its own reply.\n */\n resolveSessionKey(sessionKey: string): Promise<string>\n /** `/new` under an owner or peer scope: the rotated key, or `undefined` when nothing rotates. */\n rotateSession(): Promise<string | undefined>\n tools(): Promise<ToolsView>\n context(sessionKey: string): Promise<ContextView>\n /**\n * Ask the **host** to replace this agent. Present only when attached.\n *\n * Absent means the caller owns the runtime and rebuilds it itself, which is what `/restart` has\n * always done — the optional method is the capability, the same way `AppProps.catalogue` and\n * `status` are. Resolves with every agent that came back: replacing a supervisor replaces its\n * team, because they load from one manifest as one unit.\n */\n readonly reload?: () => Promise<readonly string[]>\n /** Release whatever this holds. Never stops the agent — an attached view owns nothing. */\n close(): Promise<void>\n}\n\n/** The parts of a live `Agent` this needs, structurally, so a test needs no runtime. */\nexport interface EmbeddedAgent {\n readonly id: string\n describe(): { readonly dialect: string; readonly catalogueTokens: number }\n readonly tools: {\n specs(): readonly {\n readonly slug: string\n readonly mutating: boolean\n readonly trust?: string\n readonly trustReason?: string\n readonly summary: string\n }[]\n }\n}\n\n/** The bus half, equally narrow. */\nexport interface EmbeddedBus {\n on(\n type: \"*\",\n handler: (event: AnyEvent) => void,\n options?: { readonly chunks?: boolean },\n ): () => void\n}\n\n/** `createNltStreamFilter` for `nlt`, a pass-through otherwise. One place decides it. */\nexport function filterFor(dialect: string): StreamFilter {\n return dialect === \"nlt\" ? createNltStreamFilter() : passThroughFilter()\n}\n\n/**\n * Today's behaviour, unchanged, behind the interface.\n *\n * Everything here is a one-liner over an object this process already holds, which is the point: the\n * embedded path must not get slower or subtler for the sake of the remote one, and a reader should\n * be able to see at a glance that nothing was smuggled in.\n */\nexport function embeddedSource(input: {\n readonly agent: EmbeddedAgent\n readonly bus: EmbeddedBus\n /** `agent.send`, narrowed — the loop's own signature, not re-declared here. */\n readonly send: (text: string, options: SendOptions & { source: \"repl\" }) => Promise<TurnOutcome>\n readonly history: (sessionKey: string) => Promise<readonly PriorMessage[]>\n readonly sessions: () => Promise<readonly SourceSession[]>\n readonly clearSession: (sessionKey: string) => Promise<void>\n readonly ownConversation: () => Promise<string | undefined>\n readonly resolveSessionKey: (sessionKey: string) => Promise<string>\n readonly rotateSession: () => Promise<string | undefined>\n readonly context: (sessionKey: string) => Promise<ContextView>\n readonly streamFilter: () => StreamFilter\n readonly description: SourceDescription\n}): AgentSource {\n return {\n kind: \"embedded\",\n agentId: input.agent.id,\n describe: () => input.description,\n // `{ chunks: true }` is not a tuning knob. Every other wildcard subscriber — `/v1/events`,\n // the WebSocket bridge, every plugin watcher — must stay off the per-token path, so the\n // flag is opt-in and this is the one caller that opts in.\n subscribe: (handler) => input.bus.on(\"*\", handler, { chunks: true }),\n send: (text, options) => input.send(text, { ...options, source: \"repl\" }),\n streamFilter: input.streamFilter,\n history: input.history,\n sessions: input.sessions,\n clearSession: input.clearSession,\n ownConversation: input.ownConversation,\n resolveSessionKey: input.resolveSessionKey,\n rotateSession: input.rotateSession,\n // Built from the live registry rather than fetched, and `toolsView` takes the structural\n // source rather than an `Agent`, which is why this is a projection and not a copy.\n tools: async () => toolsView(input.agent),\n context: input.context,\n // No `reload`: the caller owns the runtime and rebuilds it. `/restart` has always worked\n // that way, and an optional method is how this interface spells a capability.\n close: async () => {},\n }\n}\n\n/**\n * The same shape over `/v1`, for an agent something else is already hosting.\n *\n * Three things here are not translations of the embedded path, and each is a decision.\n *\n * **One subscription, not two.** The events come from `GET /v1/events` and the turn is followed on\n * that same stream. Using a turn's own `/stream` as well would deliver every chunk twice, because\n * the firehose already carries them — so `send` resolves by watching for its own `turn.end` rather\n * than by draining a second stream.\n *\n * **Cancellation is a request.** Turns are detached from the client connection by design and are\n * never cancelled on disconnect, so an abort here POSTs a stop naming the turn. It is best-effort\n * in one specific way worth knowing: the turn id only exists once the send has been accepted, so an\n * abort in the window before that is remembered and applied when the id arrives, rather than lost.\n *\n * **Filtering is ours.** The wire carries unfiltered chunks — deliberately, per the wire entry's\n * own docstring — so this rebuilds the dialect's filter from the description it already fetched.\n * Without it a reply renders as `ACTION: now / format: human / END`.\n */\n/**\n * The parts of the API client this needs, structurally.\n *\n * Narrow for the same two reasons `EmbeddedAgent` is — a fake is a plain object, and anything else\n * reached for is a type error rather than a surprise — and for a third: naming the client's own\n * exported type would put the product name in a `packages/cli` source file, which hard rule 3 and\n * a boundaries test both forbid. The real client satisfies this without being named.\n */\nexport interface ApiClient {\n agent(id: string): {\n send(\n text: string,\n options?: { readonly sessionKey?: string },\n ): Promise<{ readonly turnId: string }>\n turn(turnId: string): { stop(): Promise<void> }\n messages(sessionKey: string): Promise<{\n readonly messages: readonly {\n readonly role: string\n readonly content: string\n readonly origin?: string\n }[]\n }>\n clearSession(sessionKey: string): Promise<unknown>\n rotateSession(): Promise<{ readonly sessionKey: string }>\n resolveSessionKey(sessionKey: string): Promise<string>\n reload(): Promise<{ readonly adopted: readonly string[] }>\n tools(): Promise<\n readonly {\n readonly slug: string\n readonly summary: string\n readonly mutating: boolean\n readonly trust: string\n readonly trustReason?: string\n }[]\n >\n sessions(): Promise<readonly SourceSession[]>\n context(options: { readonly sessionKey: string }): Promise<unknown>\n }\n events(options: {\n readonly agentId?: string\n readonly chunks?: boolean\n readonly signal?: AbortSignal\n }): AsyncGenerator<{ readonly kind: string; readonly event?: AnyEvent }>\n}\n\nexport function remoteSource(input: {\n readonly client: ApiClient\n readonly agentId: string\n /** Fetched once at attach, so `describe()` can stay synchronous like the embedded one. */\n readonly description: SourceDescription\n readonly host: { readonly baseUrl: string; readonly pid: number }\n}): AgentSource {\n const agent = input.client.agent(input.agentId)\n /** Fans one SSE stream out to every subscriber, so attaching twice opens one connection. */\n const handlers = new Set<(event: AnyEvent) => void>()\n const abort = new AbortController()\n let pump: Promise<void> | undefined\n\n const start = (): void => {\n if (pump !== undefined) return\n pump = (async () => {\n for await (const item of input.client.events({\n agentId: input.agentId,\n // The one wildcard in the tree that genuinely wants tokens — see `AgentSource`.\n chunks: true,\n signal: abort.signal,\n })) {\n if (item.kind !== \"event\" || item.event === undefined) continue\n for (const handler of handlers) handler(item.event)\n }\n })().catch(() => {\n // A dropped stream is reported through the transcript by the turn that notices it, not\n // by throwing into a `for await` nobody is awaiting. Swallowing it here would be the\n // silent failure hard rule 8 forbids if this were the only signal — it is not: a send\n // whose `turn.end` never arrives rejects, which is where a person is actually looking.\n })\n }\n\n return {\n kind: \"attached\",\n agentId: input.agentId,\n host: input.host,\n describe: () => input.description,\n subscribe: (handler) => {\n handlers.add(handler)\n start()\n return () => handlers.delete(handler)\n },\n send: async (text, options) => {\n let stopped = false\n let turnId: string | undefined\n const onAbort = (): void => {\n stopped = true\n // Fire-and-forget: the abort is the caller saying stop, and a failed stop request\n // must not reject the send — the turn's own end is what resolves this.\n if (turnId !== undefined)\n void agent\n .turn(turnId)\n .stop()\n .catch(() => {})\n }\n options.signal.addEventListener(\"abort\", onAbort, { once: true })\n\n /**\n * The outcome, assembled from the stream rather than returned by the send.\n *\n * `POST /messages` answers 202 the moment the turn is accepted — turns are detached\n * from the client connection by design — so everything the plain path prints comes off\n * `turn.end`, and the failure detail off the `error` event that precedes it. Collected\n * here rather than by the caller because both renderers would otherwise assemble it,\n * and two assemblies of one fact is how they come to disagree.\n */\n let failure: ErrorDetail | undefined\n const ended = new Promise<TurnOutcome>((resolve) => {\n const off = (event: AnyEvent): void => {\n if (\n turnId !== undefined &&\n event.turnId !== undefined &&\n event.turnId !== turnId\n )\n return\n if (event.type === \"error\") {\n failure = event.data\n return\n }\n if (event.type !== \"turn.end\") return\n handlers.delete(off)\n resolve({\n // Empty on purpose: the chunks have already been written by whoever is\n // subscribed, and handing back a second copy would print the reply twice.\n text: \"\",\n reason: event.data.reason,\n steps: event.data.steps,\n durationMs: event.data.durationMs,\n tokens: event.data.tokens,\n ...(failure === undefined ? {} : { error: failure }),\n })\n }\n handlers.add(off)\n start()\n })\n\n try {\n const handle = await agent.send(text, { sessionKey: options.sessionKey })\n turnId = handle.turnId\n // Aborted while the request was in flight. The listener above had no id to name, so\n // it is applied here instead of being dropped — the window is small and a stop that\n // silently did nothing is the worst available outcome for a cancel key.\n if (stopped)\n void agent\n .turn(turnId)\n .stop()\n .catch(() => {})\n return await ended\n } finally {\n options.signal.removeEventListener(\"abort\", onAbort)\n }\n },\n streamFilter: () => filterFor(input.description.dialect),\n history: async (sessionKey) => {\n const page = await agent.messages(sessionKey)\n // Oldest-first for the screen; the API pages newest-first because that is how a UI\n // scrolls back. `priorMessages` decides what is shown — one rule, in `lib/resume.ts`,\n // because which origins count has been got wrong twice.\n return priorMessages(\n [...page.messages].reverse().map((message) => ({\n role: message.role as \"user\" | \"assistant\",\n content: message.content,\n ...(message.origin === undefined ? {} : { origin: message.origin }),\n })) as Parameters<typeof priorMessages>[0],\n input.description.dialect as Parameters<typeof priorMessages>[1],\n )\n },\n sessions: () => agent.sessions(),\n clearSession: async (sessionKey) => {\n await agent.clearSession(sessionKey)\n },\n // The operator's conversation is the owner's (14.42), and the host's listing says which is\n // current; a channel-peer agent has none, so nothing matches.\n ownConversation: async () =>\n (await agent.sessions()).find(\n (session) => session.head !== false && session.sessionKey.startsWith(\"owner:\"),\n )?.sessionKey,\n // The host's own rule, asked rather than copied. A host older than the route (0.2.2) answers\n // 404, and the key as named is the best answer left: what that host's run printed anyway.\n resolveSessionKey: async (sessionKey) => {\n try {\n return await agent.resolveSessionKey(sessionKey)\n } catch {\n return sessionKey\n }\n },\n // `409 session_not_rotatable` is the channel-peer answer: a fresh key of the terminal's own.\n rotateSession: async () => {\n try {\n return (await agent.rotateSession()).sessionKey\n } catch {\n return undefined\n }\n },\n tools: async () => {\n const tools = await agent.tools()\n return {\n dialect: input.description.dialect,\n catalogueTokens: input.description.catalogueTokens,\n tools: tools.map((tool) => ({\n slug: tool.slug,\n mutating: tool.mutating,\n trust: tool.trust,\n ...(tool.trustReason === undefined ? {} : { trustReason: tool.trustReason }),\n summary: tool.summary,\n })),\n }\n },\n context: async (sessionKey) => {\n // The route calls `previewContext` with the same arguments `send` does, so this is the\n // same object the embedded path builds — only `windowSource` is ours, because a\n // description carries the window and not where it came from.\n const preview = (await agent.context({ sessionKey })) as Omit<\n ContextView,\n \"windowSource\"\n > & {\n readonly compactions?: number\n }\n return {\n ...preview,\n windowSource: \"as the host resolved it\",\n ...(preview.lastCompaction === undefined && preview.compactions !== undefined\n ? {\n lastCompaction:\n preview.compactions === 0\n ? undefined\n : `${preview.compactions} stage${preview.compactions === 1 ? \"\" : \"s\"} run this session`,\n }\n : {}),\n }\n },\n reload: async () => (await agent.reload()).adopted,\n close: async () => {\n abort.abort()\n handlers.clear()\n },\n }\n}\n\n/**\n * Whether something else is already hosting this agent, and where.\n *\n * Both halves matter and neither is guessable. A lease says **who** is serving an agent right now;\n * its `base_url` — published after the bind, cleared on takeover — says where, because a manifest's\n * `server.port` is only what the file asked for and `--port 0` means the port does not exist until\n * the socket does. A host serving no HTTP has a lease and no address, and cannot be attached to.\n *\n * `processAlive` is checked inside `liveHostOf` for the recorded reason: a lease row is a claim,\n * not a fact, and a boot that failed *after* claiming leaves a fresh heartbeat with no process\n * under it. A dead pid outranks a recent timestamp.\n */\nexport interface LiveHost {\n readonly baseUrl: string\n readonly pid: number\n}\n\nexport function hostFrom(\n lease: { readonly pid: number; readonly baseUrl?: string } | undefined,\n): LiveHost | undefined {\n if (lease?.baseUrl === undefined || lease.baseUrl === \"\") return undefined\n return { baseUrl: lease.baseUrl, pid: lease.pid }\n}\n",
|
|
33
33
|
"/**\n * The `schedules` command — what is scheduled, when it fires next, and whether the last run worked.\n *\n * **It reads, enables and disables. It does not write a schedule.** Creating one here would be a\n * third writer beside the manifest and the API, each with its own idea of a valid expression, and\n * the manifest is where a schedule belongs — it survives a rebuild and shows up in a diff. What the\n * CLI adds is the two questions a file cannot answer: when this actually fires next, and how the\n * last run went.\n *\n * The distinction the listing exists to make is the one `status` had to learn: **running and working\n * are different questions.** A schedule can be perfectly configured, listed, enabled, and silently\n * failing every night — so `LAST` carries the outcome, not just the time.\n */\n\nimport { Runtime, type ScheduleRecord } from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { onExit } from \"#lib/exit\"\nimport {\n BUILT_IN_PLUGINS,\n CHANNELS,\n MEDIA_PROVIDERS,\n MODEL_TRANSPORTS,\n scriptRunner,\n TOOL_PROVIDERS,\n} from \"#lib/providers\"\nimport { ago } from \"#lib/render\"\nimport { pluginRoot, storePath } from \"#lib/sandbox\"\nimport type { SchedulesOptions } from \"#lib/schema\"\n\nfunction pad(value: string, width: number): string {\n return value.length >= width ? value : value + \" \".repeat(width - value.length)\n}\n\n/**\n * When it next fires, in words.\n *\n * A schedule that is *disabled* has a due time — it is kept current so enabling it does not fire it\n * at once — and printing that time would say it is about to run. `off` is the true answer.\n */\nfunction nextIn(schedule: ScheduleRecord, now: number): string {\n if (!schedule.enabled) return \"off\"\n if (schedule.nextRunAt === undefined) return \"done\"\n const delta = Date.parse(schedule.nextRunAt) - now\n if (delta <= 0) return \"due\"\n const minutes = Math.round(delta / 60_000)\n if (minutes < 60) return `in ${minutes}m`\n const hours = Math.round(delta / 3_600_000)\n return hours < 48 ? `in ${hours}h` : `in ${Math.round(hours / 24)}d`\n}\n\n/** The outcome of the last run, which is the half of \"is this working\" a due time cannot answer. */\nfunction lastRun(schedule: ScheduleRecord, now: number): string {\n if (schedule.lastFiredAt === undefined) return \"never run\"\n const when = ago(schedule.lastFiredAt, now)\n if (schedule.lastStatus === \"error\") return `FAILED ${when}`\n return `ok ${when}`\n}\n\nfunction printList(schedules: readonly ScheduleRecord[], now: number): void {\n if (schedules.length === 0) {\n // Exit 0: an agent with no schedules is a correct answer to the question asked. The line\n // says where they come from, because \"none\" alone leaves somebody looking for a subcommand.\n process.stdout.write(\"no schedules — add a `schedules:` block to the manifest\\n\")\n return\n }\n\n const idWidth = Math.max(8, ...schedules.map((s) => s.id.length))\n const whenWidth = Math.max(4, ...schedules.map((s) => `${s.kind} ${s.expr}`.length))\n process.stdout.write(\n `${pad(\"SCHEDULE\", idWidth)} ${pad(\"WHEN\", whenWidth)} ${pad(\"NEXT\", 7)} LAST\\n`,\n )\n for (const schedule of schedules) {\n process.stdout.write(\n `${pad(schedule.id, idWidth)} ${pad(`${schedule.kind} ${schedule.expr}`, whenWidth)} ` +\n `${pad(nextIn(schedule, now), 7)} ${lastRun(schedule, now)}\\n`,\n )\n }\n\n // Named once at the bottom rather than as a column: it is true of every row and a column would\n // spend width repeating it.\n const failing = schedules.filter((s) => s.lastStatus === \"error\")\n if (failing.length > 0) {\n process.stdout.write(\n `\\n${failing.length} failing — \\`schedules --id ${failing[0]?.id}\\` for the error\\n`,\n )\n }\n}\n\nfunction printOne(schedule: ScheduleRecord): void {\n const rows: [string, string][] = [\n [\"kind\", `${schedule.kind} ${schedule.expr}`],\n [\"timezone\", schedule.timezone ?? \"(host)\"],\n [\"task\", schedule.task],\n [\n \"deliver\",\n schedule.deliverChannel === undefined\n ? \"none — the reply reaches the event stream only\"\n : `${schedule.deliverChannel} → ${schedule.deliverTo}`,\n ],\n [\"session\", schedule.sessionMode],\n [\"model role\", schedule.role ?? \"main\"],\n [\"enabled\", schedule.enabled ? \"yes\" : \"no\"],\n [\"declared in\", schedule.origin === \"manifest\" ? \"agent.yaml\" : \"the API\"],\n [\"next run\", schedule.nextRunAt ?? \"(never again)\"],\n [\"runs\", String(schedule.runs)],\n [\"last run\", schedule.lastFiredAt ?? \"never\"],\n [\"last status\", schedule.lastStatus ?? \"-\"],\n ]\n if (schedule.lastError !== undefined) rows.push([\"last error\", schedule.lastError])\n\n const width = Math.max(...rows.map(([label]) => label.length))\n process.stdout.write(`${schedule.id}\\n`)\n for (const [label, value] of rows) {\n process.stdout.write(` ${pad(label, width)} ${value}\\n`)\n }\n}\n\n/** One address this agent has actually been reached on, and can therefore deliver to. */\nexport interface Recipient {\n readonly channelId: string\n readonly address: string\n readonly lastSeen: string\n}\n\n/**\n * Addresses `deliver.to` can name, derived from sessions this agent has actually had.\n *\n * **Observed, never guessed.** The alternative — asking the transport to resolve a handle — is the\n * thing that cannot work: Telegram will not tell a bot the chat id behind an `@name`, and a private\n * chat has no other address. What the store holds is the id a real inbound message arrived on, which\n * is the one value known to route.\n *\n * Filtered to *declared channel ids*, so `local`, `api` and `schedule` sessions are left out. They\n * are sessions and they are not places a reply can be sent, and listing them under a heading that\n * says \"what deliver.to takes\" would be four wrong answers beside one right one.\n *\n * Pure, and takes plain rows rather than a store, so the shaping is testable without a runtime.\n */\nexport function recipientsFrom(\n sessions: readonly {\n readonly channel: string\n readonly peerId: string\n readonly lastActivityAt: string\n }[],\n channelIds: readonly string[],\n): readonly Recipient[] {\n const declared = new Set(channelIds)\n const latest = new Map<string, Recipient>()\n\n for (const session of sessions) {\n if (!declared.has(session.channel)) continue\n const key = `${session.channel}\\u0000${session.peerId}`\n const seen = latest.get(key)\n // One row per address, carrying the most recent contact: the same peer opens a new session\n // per thread, and three rows for one person is a list that has to be read twice.\n if (seen !== undefined && seen.lastSeen >= session.lastActivityAt) continue\n latest.set(key, {\n channelId: session.channel,\n address: session.peerId,\n lastSeen: session.lastActivityAt,\n })\n }\n\n return [...latest.values()].sort((a, b) =>\n a.channelId === b.channelId\n ? b.lastSeen.localeCompare(a.lastSeen)\n : a.channelId.localeCompare(b.channelId),\n )\n}\n\nfunction printRecipients(recipients: readonly Recipient[], now: number): void {\n if (recipients.length === 0) {\n // Exit 0 and say why it is empty. \"None\" on its own reads as a broken query, and the real\n // cause is almost always that nobody has messaged the agent yet.\n process.stdout.write(\n \"no addresses yet — this agent has had no conversation on a declared channel.\\n\" +\n \" An address appears here once a first message arrives on one.\\n\",\n )\n return\n }\n\n const channelWidth = Math.max(7, ...recipients.map((r) => r.channelId.length))\n const addressWidth = Math.max(7, ...recipients.map((r) => r.address.length))\n process.stdout.write(\n `${pad(\"CHANNEL\", channelWidth)} ${pad(\"ADDRESS\", addressWidth)} LAST SEEN\\n`,\n )\n for (const recipient of recipients) {\n process.stdout.write(\n `${pad(recipient.channelId, channelWidth)} ${pad(recipient.address, addressWidth)} ` +\n `${ago(recipient.lastSeen, now)}\\n`,\n )\n }\n\n // The whole reason the listing exists, so it is not left to be inferred from the shape of the\n // values. A handle is what `allowFrom` holds and what a person recognises, and for a private\n // chat it is the one thing that cannot work.\n process.stdout.write(\n \"\\nUse an ADDRESS in deliver.to. On Telegram an @name addresses a channel and\\n\" +\n \"never a person — a private chat is reached by the numeric id above.\\n\",\n )\n}\n\nexport async function schedulesCommand(options: SchedulesOptions): Promise<number> {\n const runtime = await Runtime.create({\n agents: [options.manifestPath],\n // The sandbox store — the same one `serve` writes to, or this inspects nothing.\n store: options.store ?? storePath(),\n toolProviders: TOOL_PROVIDERS,\n modelTransports: MODEL_TRANSPORTS,\n mediaProviders: MEDIA_PROVIDERS,\n builtInPlugins: BUILT_IN_PLUGINS,\n pluginRoot: pluginRoot(),\n scriptRunner: scriptRunner(),\n channels: CHANNELS,\n env: ambientEnv([options.manifestPath]),\n // Read-only, and a lease is a claim to *serve*. Taking one here would make a listing refuse\n // to run while the agent is actually being served, which is when it is most wanted.\n lease: false,\n })\n onExit(() => runtime.stop(\"cli-exit\"))\n\n const agent = runtime.list()[0]\n if (agent === undefined) throw new Error(\"The manifest produced no agent.\")\n const now = Date.now()\n\n for (const [id, enabled] of [\n [options.enable, true],\n [options.disable, false],\n ] as const) {\n if (id === undefined) continue\n const existing = await agent.store.schedules.get(agent.id, id)\n if (existing === undefined) {\n process.stderr.write(\n `no schedule \"${id}\" on ${agent.id}\\n` +\n \" hint: run `schedules` with no flags to see what this agent has.\\n\",\n )\n return EXIT_FAILURE\n }\n\n // **Refused for a manifest-owned schedule, rather than written and silently undone.**\n //\n // The manifest owns the schedules it declares — reconciliation at the next boot restores\n // every field from the file, `enabled` included. Writing the store here therefore reported\n // success on a change that lasted until the next start of the process, which is rule 8's\n // exact shape: the flag worked, the listing agreed, and one restart later it was back on.\n // Caught by running the two commands in sequence rather than by reading either.\n //\n // Not fixed by editing `agent.yaml` from here: `manifest/edit.ts` is deliberately the one\n // writer, and a schedule lives in a sequence whose index this command has no business\n // knowing. Naming the edit is more useful than performing it — it is one line, it shows up\n // in a diff, and it survives.\n if (existing.origin === \"manifest\") {\n process.stderr.write(\n `${id} is declared in agent.yaml, so the manifest decides whether it runs.\\n` +\n ` Writing it here would last until the next start — reconciliation restores every\\n` +\n ` field from the file, enabled included.\\n\\n` +\n ` hint: set \\`enabled: ${enabled}\\` on the \"${id}\" entry under schedules: in\\n` +\n ` ${options.manifestPath}\\n`,\n )\n return EXIT_FAILURE\n }\n\n await agent.store.schedules.setEnabled(agent.id, id, enabled, new Date(now).toISOString())\n // Said plainly, because the surprising reading is the other one: enabling does not fire.\n process.stdout.write(\n enabled\n ? `${id} enabled — it fires at its next occurrence, not now\\n`\n : `${id} disabled — still listed, and it keeps its place in the sequence\\n`,\n )\n }\n\n if (options.recipients === true) {\n const recipients = recipientsFrom(\n await agent.store.sessions.list(agent.id),\n agent.manifest.channels.map((channel) => channel.id),\n )\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify({ recipients }, null, 2)}\\n`)\n return EXIT_OK\n }\n printRecipients(recipients, now)\n return EXIT_OK\n }\n\n const schedules = await agent.store.schedules.list(agent.id)\n\n if (options.json) {\n process.stdout.write(`${JSON.stringify({ schedules }, null, 2)}\\n`)\n return EXIT_OK\n }\n\n if (options.id !== undefined) {\n const one = schedules.find((schedule) => schedule.id === options.id)\n if (one === undefined) {\n process.stderr.write(`no schedule \"${options.id}\" on ${agent.id}\\n`)\n return EXIT_FAILURE\n }\n printOne(one)\n return EXIT_OK\n }\n\n if (options.enable === undefined && options.disable === undefined) {\n printList(schedules, now)\n }\n return EXIT_OK\n}\n",
|
|
34
|
-
"/**\n * The `serve` command: `<binary> serve <manifest> [--port N] [--host H]`.\n *\n * Boots a runtime with channels started, binds the HTTP surface, and stays up until interrupted.\n * The only long-running command in the binary, and the only one that opens a listening socket.\n *\n * **Channels start here and nowhere else.** `run` constructs the same runtime with\n * `startChannels: false`, because a REPL that silently began answering Telegram messages while you\n * typed at it would be a surprise, and a one-shot `run --input` that opened a long-poll would hang\n * on exit. The flag decides *whether*, never *when* — either way nothing connects before\n * `runtime.ready`.\n *\n * No Ink. A server writes lines to stdout and is very often not attached to a terminal at all; a\n * rendering framework on this path would cost more than the whole command and produce escape codes\n * in a log file.\n */\n\nimport { rmSync } from \"node:fs\"\nimport { dirname, join } from \"node:path\"\nimport {\n AgentManifestSchema,\n BRAND,\n EventBus,\n HarnessError,\n isHarnessError,\n loadManifest,\n Runtime,\n} from \"@dispach/core\"\nimport {\n type AgentRemover,\n browsableHost,\n claimCommand,\n claimUrl,\n createApprovalRegistry,\n createClaimTicket,\n serve,\n} from \"@dispach/server\"\nimport { secretStatus, writeSecrets } from \"#lib/agent-secrets\"\nimport {\n listTemplates,\n provisionFromTemplate,\n rerenderFromTemplate,\n templateRecordOf,\n} from \"#lib/agent-template\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { inContainer } from \"#lib/bootstrap\"\nimport { setChannelCredential, setChannelEnabled, unpairChannel } from \"#lib/channel-actions\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { claimSignals, onExit } from \"#lib/exit\"\nimport { claimHostLease, HOST_LEASE, hostableAgents, manifestForId } from \"#lib/lifecycle\"\nimport { claimManifest } from \"#lib/owner\"\nimport {\n BUILT_IN_PLUGINS,\n CHANNELS,\n MEDIA_PROVIDERS,\n MODEL_TRANSPORTS,\n scriptRunner,\n TOOL_PROVIDERS,\n} from \"#lib/providers\"\nimport { provisionAgent, provisionSteps } from \"#lib/provision\"\nimport { relayClient } from \"#lib/relay-client\"\nimport {\n agentsDir,\n insideSandbox,\n listAgents,\n pluginRoot,\n readHostToken,\n sandboxRoot,\n storePath,\n templatesDir,\n writeHostToken,\n} from \"#lib/sandbox\"\n\nexport interface ServeOptions {\n /**\n * Zero or more manifests. The process hosts every agent they produce.\n *\n * Plural since 16.2a: decision 8.5 has said \"one process hosts N agents\" since the beginning\n * and core was built that way — `RuntimeOptions.agents` is already an array — so a single path\n * here was the only thing pinning the product to one agent.\n *\n * **Empty means the sandbox's agents**, which is what the service unit runs and what makes the\n * product always-on: a host that has to be told which agents to serve cannot serve one that was\n * provisioned after it started. Naming manifests is the container's shape, where the agent\n * arrives on a mount and the sandbox is not the inventory.\n */\n readonly manifestPaths: readonly string[]\n readonly port?: number\n readonly host?: string\n readonly store?: string\n /** Print a one-time claim even when a key already exists. The lockout escape. */\n readonly claim?: boolean\n readonly json?: boolean\n}\n\n/**\n * The `server:` block a manifest that declares none resolves to.\n *\n * Asked of the **schema** rather than written out here, so a bare `serve` and a manifest with no\n * `server:` block cannot come to disagree about the port — which they would the first time somebody\n * changed the default in one place. Parsing an empty object is the cheapest way to ask a Zod schema\n * what its defaults are.\n */\nfunction defaultServerConfig(): ReturnType<typeof AgentManifestSchema.parse>[\"server\"] {\n return AgentManifestSchema.shape.server.parse({})\n}\n\nexport async function serveCommand(options: ServeOptions): Promise<number> {\n const env = ambientEnv(options.manifestPaths)\n const drainMs = drainFrom(env)\n\n /**\n * What to host, and what is switched off.\n *\n * Read before the runtime exists, because it decides which agents the runtime is *asked* for —\n * a disabled agent is not loaded at all, so there is nothing to filter afterwards. The switch is\n * honoured for an explicitly named manifest too, and that is deliberate: the launchd trap this\n * table is modelled on is precisely a job that installs cleanly, reports success and silently\n * never starts, and the cure is not to make the durable state easy to bypass — it is to say so.\n */\n // The same path the runtime will open, not the sandbox default: `serve --store` exists, and\n // a host reading its on/off switch from a different database than the one it serves out of\n // is wrong in exactly the configuration that is easiest to miss.\n const storeFile = options.store ?? storePath()\n const hostable = await hostableAgents(options.manifestPaths, env, storeFile)\n const switchedOff = hostable.filter((entry) => !entry.enabled)\n const wanted = hostable.filter((entry) => entry.enabled)\n\n /**\n * **A discovered agent that will not load is skipped; a named one still refuses.**\n *\n * The asymmetry is the whole point, and it was found by running the container rather than by\n * reading this. `init` writes a manifest whose `.env` holds `MODEL_API_KEY=` — empty, by its\n * own design, since step 1 of what it prints is \"add your key\". A bare `serve` hosts every\n * enabled agent in the sandbox, so one freshly created agent made `loadManifest` throw, the\n * host exited 1, and `restart: unless-stopped` restarted it into the same failure: **9\n * restarts, the API gone, the web UI gone** — the always-on server that exists to provision\n * agents taken down by an agent halfway through being provisioned. The message was perfect and\n * went to `docker logs`, which is the 57 MB lesson with the polarity reversed: not a bad\n * message in a file nobody opens, a correct one nobody can act on because the thing that would\n * let them act is what died.\n *\n * So a host does not get to fail because one of N agents is misconfigured. That is the same\n * reasoning `listAgents` uses to show a broken directory rather than omitting it, and the same\n * reasoning behind `GET /v1/agents` carrying a stopped row: the listing says what exists, the\n * resource says what is running.\n *\n * A **named** manifest is the other case and keeps throwing. The caller asked for that agent by\n * path, so quietly serving something else is the worse error — exactly the direction\n * `hostableAgents` already distinguishes, which is why the condition here is the same one.\n */\n const discovered = options.manifestPaths.length === 0\n const manifests: { path: string; loaded: ReturnType<typeof loadManifest> }[] = []\n const broken: { path: string; detail: string; hint?: string }[] = []\n for (const entry of wanted) {\n try {\n /**\n * **One pass again, because the check that needed two is gone.**\n *\n * This was a plugin load followed by a `loadManifest` against\n * `Object.keys(supply.channels)` — the 0.1.1 fix for `defineChannel` not working\n * through this binary, where a manifest naming a plugin-supplied channel was refused\n * with `channel_type_unknown` before the plugin that would satisfy it was imported.\n *\n * The whole pass existed to feed `knownChannels`/`knownProviders` into the loader, and\n * neither exists any more: a channel type and a provider id are now checked where the\n * thing is *constructed* — `buildChannels` and `buildProviders` — which degrade what\n * they cannot build to a warning rather than refusing the agent. One owner each, so\n * there is nothing left for a second pass to disagree with, and an agent declaring\n * plugins no longer pays a duplicate `setup()` here.\n *\n * The try/catch stays. A manifest can still fail to load for its own reasons — a schema\n * error, a workspace file disk does not have — and a *discovered* one is skipped and\n * reported rather than taking the host down with it.\n */\n manifests.push({\n path: entry.manifestPath,\n loaded: loadManifest(entry.manifestPath, {\n env,\n }),\n })\n } catch (error) {\n if (!discovered) throw error\n broken.push({\n path: entry.manifestPath,\n detail: isHarnessError(error) ? error.message : String(error),\n ...(isHarnessError(error) && error.hint !== undefined ? { hint: error.hint } : {}),\n })\n }\n }\n /**\n * **Zero agents is a running server, not a failure.**\n *\n * The whole point of an always-on host is that the API exists before there is anything to talk\n * to: the binary is installed, the server is up, and provisioning reaches it. A refusal here\n * would make the first-run experience \"install, then find something to serve, then start\", and\n * would turn a container whose only agent somebody stopped into a crash loop.\n *\n * So the server config comes from the first manifest when there is one, and from the schema's\n * defaults when there is not — which is the same thing a manifest that declares no `server:`\n * block resolves to.\n */\n const first = manifests[0]\n const loaded = first?.loaded\n const config = loaded?.manifest.server ?? defaultServerConfig()\n\n /**\n * **The bind is process-level, so a disagreement about it is refused rather than ignored.**\n *\n * One process, one socket, one token — so with several manifests the server config can only\n * come from one of them, and silently taking the first would make a manifest that carefully\n * declares `port: 7500` a file whose setting does nothing. That is the \"looks configured and is\n * not\" shape, and it is worse here than elsewhere because the symptom is a port somebody else\n * is already using.\n *\n * Compared after defaults are applied, which is what makes this correct rather than pedantic:\n * an unset `port` *is* 7420, so a manifest that says 7420 and one that says nothing agree, and\n * one that says 7500 disagrees with both.\n */\n for (const entry of manifests.slice(1)) {\n const other = entry.loaded.manifest.server\n for (const [field, mine, theirs, settled] of [\n // **A flag settles the question, so it also settles the disagreement.** `--port` and\n // `--host` override every manifest, so refusing because two of them disagree about a\n // value nothing is going to read would be a refusal the operator has already answered.\n // `tokenEnv` has no flag, so a disagreement there is always live.\n [\"server.port\", config.port, other.port, options.port !== undefined],\n [\"server.host\", config.host, other.host, options.host !== undefined],\n [\"server.tokenEnv\", config.tokenEnv, other.tokenEnv, false],\n ] as const) {\n if (settled || mine === theirs) continue\n throw new HarnessError({\n code: \"serve_bind_conflict\",\n message: `${first?.path ?? \"the first manifest\"} sets ${field} to ${String(mine)} and ${entry.path} sets it to ${String(theirs)}.`,\n hint: \"One process binds one socket with one token, so these have to agree. Make them match, or run the disagreeing agent in its own process — a second `serve` on its own port.\",\n field,\n })\n }\n }\n // Flags win over the manifest: the manifest is the deployment's intent and a flag is this\n // invocation's. `--port 0` is honoured — it means \"any free port\", which a test wants.\n const port = options.port ?? config.port\n /**\n * Whether a taken port is a refusal or a starting point.\n *\n * **A flag is an instruction and the manifest is a preference.** `--port 7420` names one socket\n * and failing is the correct answer — silently serving somewhere else would be the \"looks\n * configured and is not\" shape this file already refuses for a manifest disagreement. Everything\n * else walks: `init` writes `port: 7420` into every manifest it generates, so on a machine with\n * a container, a service and a checkout the default collides constantly, and the old behaviour\n * was a dead end that named no way out.\n *\n * `--port 0` never walks — the OS is already picking a free one, and there is nothing to avoid.\n *\n * This is only safe because **the lease carries the address, not the manifest**: `publishAddress`\n * runs after the bind with whatever was actually taken, so `stop`, `web url` and an attached\n * `run` follow the socket rather than the file. That mechanism exists for `--port 0` and this\n * rides on it.\n */\n const walkPorts = options.port === undefined\n const host = options.host ?? config.host\n // `loaded.env`, never `env`. `ambientEnv` returns the *process* environment — the agent's own\n // `.env` beside the manifest is layered in by `loadManifest`, which is why every other\n // credential in this runtime is read from the manifest's live env. Reading the ambient one\n // here meant a token sitting in the agent's `.env` was invisible, and the banner said\n // \"unauthenticated\" while the file plainly had it. Same mistake `Agent.create` documents:\n // the manifest's live env, not the ambient one.\n // `loaded.env`, never `env`. `ambientEnv` returns the *process* environment; the agent's own\n // `.env` beside the manifest is layered in by `loadManifest`. With no manifest at all there is\n // no agent env to layer, so the process environment is the only source there is — which is the\n // service unit's shape, where the variable comes from the unit definition.\n const own = loaded === undefined ? env[config.tokenEnv] : loaded.env[config.tokenEnv]\n // A sandbox host serves with the sandbox's token, not the first manifest's (QA 0.2.0: every\n // other agent's `run`, `stop` and `start` sent its own and got 401). An export still wins —\n // that is how a container is configured. With no file yet, the token this host would have used\n // becomes the sandbox's, so nothing that authenticates today stops working.\n const exported = env[config.tokenEnv]\n const inSandbox = manifests.every((entry) => insideSandbox(dirname(entry.path), env))\n let token = own\n if (inSandbox && (exported === undefined || exported === \"\")) {\n const shared = readHostToken(agentsDir(env))\n if (shared !== undefined) token = shared\n else if (own !== undefined && own !== \"\") writeHostToken(agentsDir(env), own)\n }\n\n // Set by the generated service definition and by nothing else, so this is a fact rather than a\n // guess. `ppid === 1` would also be true of any orphaned process, and getting it wrong means\n // telling someone to press ctrl-c at a log file.\n const asDaemon = env[`${BRAND.envPrefix}SERVICE`] !== undefined\n\n // Subscribed BEFORE the runtime exists, which is what the `bus` option is for. Channels start\n // inside `Runtime.create` — after `runtime.ready`, but still inside the call — so a listener\n // attached afterwards misses every status and error they emitted on the way up. Same trap as\n // the boot warnings that landed in an empty room for weeks: anything true during boot has to be\n // subscribed to before boot.\n const bus = new EventBus({ runtimeId: `rt_${Date.now().toString(36)}` })\n if (options.json !== true) {\n bus.on(\"agent.channel.status\", (event) => {\n const data = event.data as {\n channelId: string\n status: string\n detail?: string\n input?: { kind: string; payload: string; expiresAt?: string }\n }\n /**\n * A `needs_input` names where the payload is, and never prints it.\n *\n * The payload is a QR's bytes — unreadable in a log, and hundreds of characters of it\n * would bury the sentence that matters. But a line saying only \"needs_input\" is the\n * 57 MB-log failure in one line: true, and no route to acting on it. The agent\n * resource carries the payload because `statusOf` returns it, so that is what this\n * points at.\n */\n /**\n * **A pairing code is printed; a QR is pointed at.** The rule above — never print the\n * payload — was written for a QR, which is hundreds of bytes nobody can read off a\n * log. An eight-character code is the opposite: it *is* the thing to read, and a line\n * saying \"GET /v1/agents/milo carries it\" sent a person to a browser to fetch eight\n * characters the terminal already had.\n */\n const waiting =\n data.input === undefined\n ? \"\"\n : data.input.kind === \"pairing_code\"\n ? `\\n\\n ${data.input.payload}\\n${\n data.input.expiresAt === undefined\n ? \"\"\n : `\\n expires ${data.input.expiresAt}`\n }`\n : ` (${data.input.kind}${\n data.input.expiresAt === undefined\n ? \"\"\n : `, expires ${data.input.expiresAt}`\n } — GET /v1/agents/${event.agentId ?? \"\"} carries it)`\n process.stdout.write(\n ` ${data.channelId}: ${data.status}${data.detail === undefined ? \"\" : ` — ${data.detail}`}${waiting}\\n`,\n )\n })\n bus.on(\"agent.channel.error\", (event) => {\n const data = event.data as { channelId: string; message: string; hint: string }\n process.stderr.write(` ${data.channelId}: ${data.message}\\n hint: ${data.hint}\\n`)\n })\n /**\n * A turn that failed, in the only log a container has.\n *\n * `error` is where every uncaught turn failure lands, and **nothing here subscribed to it**\n * — the same empty room `delivery.failed` sat in, one event over. Measured live: a 401 from\n * the model endpoint ended a turn in 258 ms, `POST /messages` had already answered 200 with\n * a turn id, `GET /sessions/<key>/messages` returned `[]`, and `docker logs` held not one\n * word about it. Every surface a person could reach said nothing while the runtime had a\n * sentence naming the cause and the field to fix.\n *\n * stderr, and the session key with it: under a service manager this is the file somebody\n * greps after the fact, and a failure with no conversation attached cannot be matched to\n * the message that provoked it.\n */\n bus.on(\"error\", (event) => {\n const data = event.data as { code: string; message: string; hint: string }\n const where = event.sessionKey === undefined ? \"\" : ` [${event.sessionKey}]`\n process.stderr.write(\n ` turn failed${where}: ${data.code}: ${data.message}\\n hint: ${data.hint}\\n`,\n )\n })\n // The one thing a person watching a bot most wants to see, and it is otherwise only in the\n // event stream: who was refused, and the line that would let them in.\n bus.on(\"agent.channel.rejected\", (event) => {\n const data = event.data as { channelId: string; reason: string; detail: string }\n process.stdout.write(` ${data.channelId}: ${data.reason} — ${data.detail}\\n`)\n })\n }\n\n /**\n * Created before the runtime, because the runtime is constructed *with* the approver.\n *\n * That ordering is the whole reason this lives here and not inside `serve()`: `Runtime.create`\n * takes `approve` and cannot hand back the function it was built with, so the registry has to\n * exist first and then be given to both. Same shape as the shared `running` map, one layer\n * further out.\n *\n * Supplying it is also what silences `confirm_without_approver` — `Agent.create` keys that\n * warning on `approve` being absent, so an agent with `onMutate: \"confirm\"` stops warning under\n * `serve` and keeps warning under `run`, which is exactly true of the two surfaces today.\n */\n const approvals = createApprovalRegistry()\n\n // The control plane's peer-ask relay (decision 15.10): present only in a silo it placed, which it\n // gives both variables. Built once, so a host reload keeps the cached peer list in memory.\n const relayUrl = env[`${BRAND.envPrefix}RELAY_URL`]\n const relayToken = env[`${BRAND.envPrefix}RELAY_TOKEN`]\n const relay =\n relayUrl === undefined || relayUrl === \"\" || relayToken === undefined || relayToken === \"\"\n ? undefined\n : relayClient({\n url: relayUrl,\n token: relayToken,\n cacheFile: join(dirname(storeFile), \"relay-peers.json\"),\n })\n const createOptions = (paths: readonly string[]): Parameters<typeof Runtime.create>[0] => ({\n agents: paths,\n ...(relay === undefined ? {} : { relay }),\n // The seam `ToolContext.approve` declared in Phase 3 and nothing ever filled. A blocked\n // call now emits `approval.requested` and waits for a POST; an unanswered one ends with the\n // turn, because core races the approver against the turn's own signal rather than starting\n // a second clock.\n approve: approvals.approver,\n env,\n bus,\n toolProviders: TOOL_PROVIDERS,\n modelTransports: MODEL_TRANSPORTS,\n mediaProviders: MEDIA_PROVIDERS,\n builtInPlugins: BUILT_IN_PLUGINS,\n pluginRoot: pluginRoot(),\n scriptRunner: scriptRunner(),\n channels: CHANNELS,\n // The one call site that passes this. See the file comment.\n startChannels: true,\n // Same rule and the same reason: `serve` is the only command that fires schedules. A REPL\n // that started firing them while somebody typed at it would be a surprise, and a one-shot\n // `run --input` that armed a timer would not exit.\n startSchedules: true,\n // `run` and `sessions` have resolved this default since the sandbox landed; `serve` never\n // did, so it silently took core's `\":memory:\"` — correct as a *library* default, since\n // constructing a Runtime must not create a directory in someone's working tree, and wrong\n // for the one command built to stay up. The cost was invisible and total: every channel\n // conversation started blank after a restart, `sessions` could not see a single turn that\n // arrived over a channel, and Phase 4's exactly-once outbox was unreachable through the\n // only command that has channels — the queue was created and destroyed per process, so a\n // crash mid-delivery lost the queue rather than recovering it.\n store: storeFile,\n // Recorded on the runtime lease and read back only to phrase a refusal. `<PREFIX>SERVICE`\n // is set by the generated service definition and by nothing else, so this is a fact rather\n // than a guess — `ppid === 1` would also be true of any orphaned process.\n mode: asDaemon ? \"daemon\" : \"terminal\",\n })\n\n /**\n * **One agent the runtime refuses to build does not take the host down either (QA K14).**\n *\n * The pre-check above only sees what `loadManifest` refuses. `Agent.create` refuses more — a media\n * provider whose key is not set yet (enabled first and filled second, on purpose), a workspace\n * file `memory_write` grew past its budget — and one such agent made `serve` exit 1 for every\n * agent in the sandbox. So when a *discovered* set fails, each agent is built alone in a\n * throwaway, in-memory runtime; the ones that fail join `broken` and are reported beside the\n * others, and the host starts with the rest. Only the failure path pays for it.\n */\n let runtime: Runtime\n try {\n runtime = await Runtime.create(createOptions(manifests.map((entry) => entry.path)))\n } catch (error) {\n if (!discovered || manifests.length === 0) throw error\n const survivors: typeof manifests = []\n for (const entry of manifests) {\n try {\n const probe = await Runtime.create({\n ...createOptions([entry.path]),\n store: \":memory:\",\n startChannels: false,\n startSchedules: false,\n })\n await probe.stop()\n survivors.push(entry)\n } catch (alone) {\n broken.push({\n path: entry.path,\n detail: isHarnessError(alone) ? alone.message : String(alone),\n ...(isHarnessError(alone) && alone.hint !== undefined\n ? { hint: alone.hint }\n : {}),\n })\n }\n }\n // Every agent builds alone, so the failure is not any one agent's: say it as it was.\n if (survivors.length === manifests.length) throw error\n manifests.splice(0, manifests.length, ...survivors)\n runtime = await Runtime.create(createOptions(survivors.map((entry) => entry.path)))\n }\n\n // Claimed and *registered* before the socket binds, and that ordering is the bug this fixes.\n //\n // Both used to sit after the banner. So between \"serving on …\" reaching stdout and\n // `waitForSignal()` registering its handlers there was a window with **no handler at all** — and\n // in it, SIGINT takes its default action and kills the process outright: exit code `null`, no\n // outbox flush, no lease release, and none of the backgrounded `exec` children reaped.\n //\n // Not a theoretical window. CI caught it as `Expected: 0, Received: null` on a loaded two-core\n // runner, where the work between the two points takes long enough to lose the race — and the\n // real-world shape is worse than a red test: an orchestrator that restarts a container promptly\n // sends its signal into exactly that gap, which is the failure `claimSignals` was introduced to\n // prevent in the first place.\n //\n // The promise is created here and awaited far below. A signal arriving in between resolves it\n // immediately, so an early stop is honoured rather than missed.\n claimSignals()\n const stopRequested = waitForSignal()\n\n /**\n * The one-time bootstrap credential, minted only when there is nothing to bootstrap *from*.\n *\n * Printed while no operator key is live, and otherwise not — a fresh claim at every boot would\n * leave a standing credential in the log, which is the opposite of a one-time ticket. `--claim`\n * overrides that, because a claim printed only while no key exists is a claim unavailable to\n * exactly the person who has lost theirs.\n *\n * Minted after `Runtime.create` because the store has to be open to ask, and before the bind\n * because the handler needs it — the same ordering `approvals` has one layer up.\n */\n const liveKeys = await runtime.store.operatorKeys.liveCount()\n const claim = liveKeys === 0 || options.claim === true ? createClaimTicket() : undefined\n\n let running: Awaited<ReturnType<typeof serve>>\n /**\n * Ports actually tried, so the banner can say it moved and the refusal can say how far it looked.\n * The first entry is what was asked for.\n */\n const attempted: number[] = []\n try {\n running = await bindWalking(port, walkPorts, (candidate) => {\n attempted.push(candidate)\n return serve({\n runtime,\n host,\n port: candidate,\n approvals,\n // The origin allowlists, from the manifest. Passed rather than defaulted, because the\n // guard's *default* behaviour is what protects a server whose operator configured\n // nothing — these two only widen it.\n allowedOrigins: config.allowedOrigins,\n allowedHosts: config.allowedHosts,\n /**\n * How `POST /v1/agents/:id/start` finds a manifest for an agent this host is not\n * holding. Injected because `packages/server` may not import the CLI, and the sandbox\n * layout is the CLI's — the same seam 16.5's provisioning route needs.\n *\n * Matched on the manifest's **id**, not on the directory name, because `:id` in the\n * route is an agent id and the two are allowed to differ for a hand-copied directory.\n */\n resolveAgent: (agentId) => manifestForId(agentId, env),\n /**\n * How `POST /v1/agents` creates one. The server owns the route and the gate; this is\n * the implementation, injected because `packages/server` may not import the CLI.\n *\n * Both halves come from `lib/provision.ts`, which is also what `init` writes through —\n * so an agent provisioned over HTTP is byte-identical to one created at a terminal, and\n * the step list a browser renders is the walk the wizard performs.\n *\n * Injected **unconditionally**, including in the container. What keeps provisioning out\n * of there is the loopback gate rather than this absence — the image's `CMD` binds\n * `0.0.0.0`, so the route answers `403`. A container that deliberately binds loopback\n * and wants to provision into itself is then a thing that works, which is the right\n * answer for `docker run -it … init`'s neighbour.\n */\n provision: {\n steps: () => provisionSteps({ agentDirBase: agentsDir(env) }),\n create: (answers) =>\n provisionAgent({ answers, defaults: { agentDirBase: agentsDir(env) } }),\n // Over this runtime's own store, so the agent is adopted already owned.\n claim: async (manifestPath) => {\n await claimManifest(runtime.store, manifestPath, agentsDir(env))\n },\n templates: () => listTemplates(templatesDir(env)),\n createFromTemplate: (input) =>\n provisionFromTemplate({\n ...input,\n templatesDir: templatesDir(env),\n agentDirBase: agentsDir(env),\n }),\n rerender: (input) =>\n rerenderFromTemplate({ ...input, templatesDir: templatesDir(env) }),\n templateOf: templateRecordOf,\n },\n /**\n * `GET`/`PUT /v1/agents/:id/secrets`. The allowed names come from the agent's own\n * manifest inside `writeSecrets`, never from the request; the `.env` write is\n * `applySecret`, the same one `config env` uses.\n */\n secrets: { status: secretStatus, write: writeSecrets },\n /** `DELETE /v1/agents/:id`: sandbox agents only, and never an id two directories share. */\n remover: sandboxRemover(env),\n /** `GET /v1/backup?include=home`: everything else under the sandbox root. */\n home: sandboxRoot(env),\n /**\n * The same functions the `channels` command calls, injected for the same reason the\n * provisioner is: *how* a channel is switched off or re-credentialled is the CLI's —\n * `editManifest` for one, `applySecret` at `0600` for the other — and a second\n * implementation inside the server is how the browser and the terminal come to disagree\n * about what \"disconnect\" means.\n */\n channels: {\n setEnabled: setChannelEnabled,\n setCredential: setChannelCredential,\n unpair: unpairChannel,\n },\n ...(claim === undefined ? {} : { claim }),\n ...(token === undefined || token === \"\" ? {} : { token }),\n })\n })\n } catch (error) {\n // The runtime is already up; leaving it running after a failed bind would hold the store\n // open and keep channels polling with nothing serving.\n await runtime.stop(\"server failed to bind\")\n if (isHarnessError(error)) throw error\n const looked = attempted.length > 1 ? ` — also tried ${attempted.slice(1).join(\", \")}` : \"\"\n throw new HarnessError({\n code: \"server_bind_failed\",\n message: `Could not bind ${host}:${port}${looked}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n hint: walkPorts\n ? `Every port in the range is taken. Pass --port to name a free one, or stop whatever is holding them — \\`${BRAND.slug} stop\\` releases one this runtime started.`\n : \"Another process is on that port, and --port was given explicitly so nothing else was tried. Drop the flag to let it walk to the next free port, or name a different one.\",\n cause: error,\n })\n }\n\n /**\n * Tell the lease rows where this host answers, now that the socket exists.\n *\n * After the bind and not before, because `--port 0` means the port is not known until then —\n * and this is the whole mechanism behind `stop <agent>`: one process hosts several agents, so\n * stopping one has to be a request naming it rather than a signal to the process.\n */\n // Claimed before the address is published, so `publish` puts the address on it too.\n const hostLease =\n runtime.owned.length === 0 &&\n (await claimHostLease(runtime.store.leases, {\n runtimeId: runtime.runtimeId,\n mode: asDaemon ? \"daemon\" : \"terminal\",\n }))\n await runtime.publishAddress(running.url)\n\n const agents = runtime.list()\n\n // Name the process after what it is serving.\n //\n // Without this a long-running service is a bare interpreter in Activity Monitor and in `ps`,\n // indistinguishable from every other one on the machine — and the one place a person looks when\n // something is eating CPU is exactly the place it was anonymous.\n //\n // **One agent gets its name; several get a count.** Listing them would blow the 16-character\n // `comm` truncation on the second id and leave a fragment, which is worse than a number.\n //\n // Two stated costs. Assigning `process.title` overwrites the argv region, so `ps` shows this\n // instead of the full command line — the arguments stay visible in `launchctl print` and in\n // `daemon status`. And **Bun ignores the assignment entirely**: measured against the same\n // manifest, Node shows the title while `bun run` from a checkout shows raw argv.\n // So this works on the soft-compat runtime and nowhere else, which is worth knowing before\n // relying on it — the line stays because it costs nothing where it does not work.\n const firstAgent = agents[0]\n if (firstAgent !== undefined) {\n process.title =\n agents.length === 1\n ? `${BRAND.slug} ${firstAgent.id}`\n : `${BRAND.slug} ${agents.length} agents`\n }\n // The port is bound now, which `Runtime.create` could not know — it returns before `serve` runs.\n // Told before the first turn, so slot 2 says \"on\" rather than \"enabled but not listening\".\n for (const agent of agents) agent.reportRuntimeState({ serverListening: true })\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify({\n url: running.url,\n websocket: running.websocket,\n authenticated: token !== undefined && token !== \"\",\n keys: liveKeys,\n ...(claim === undefined ? {} : { claim: claim.token }),\n agents: agents.map((agent) => ({\n id: agent.id,\n channels: runtime.channels.statusOf(agent.id),\n })),\n // Named even when empty, so a scripted caller can tell \"nothing was declined\" from\n // \"this build does not report it\".\n declined: runtime.declined.map((held) => ({\n agentId: held.agentId,\n pid: held.pid,\n mode: held.mode,\n since: held.startedAt,\n })),\n // Same reasoning, and the more important of the two: an agent absent from this\n // report with no line explaining it is the \"I set this up and it is not running\"\n // failure the durable switch exists to make explicable.\n disabled: switchedOff.map((entry) => ({\n agentId: entry.agentId,\n ...(entry.reason === undefined ? {} : { reason: entry.reason }),\n })),\n // A third way an agent can be absent, and the one that reads as a bug rather than\n // as a choice: its manifest would not load. Named for the same reason as the two\n // above — a scripted caller has to be able to tell \"no agent is broken\" from \"this\n // build does not say\".\n broken: broken.map((entry) => ({\n path: entry.path,\n detail: entry.detail,\n ...(entry.hint === undefined ? {} : { hint: entry.hint }),\n })),\n })}\\n`,\n )\n } else {\n /**\n * **A bind is not an address.** `running.url` carries whatever was bound, so the container\n * printed `http://0.0.0.0:7420` — a URL a browser does nothing with, as the first and most\n * prominent line of the banner. `browsableHost` has existed since Phase 13 for exactly\n * this and its own docstring notes it had two copies before a third caller arrived; this is\n * the fourth, and it never got it. A laptop cannot show the defect: `serve` there binds\n * `127.0.0.1` and the substitution never fires.\n *\n * The bind is still named when it differs, because \"listening on every interface\" is a\n * security-relevant fact and quietly showing loopback instead would hide it.\n */\n const browsable = `http://${browsableHost(host)}:${running.port}`\n const boundNote = browsable === running.url ? \"\" : ` (bound ${host} — every interface)`\n process.stdout.write(`${BRAND.name} serving on ${browsable}${boundNote}\\n`)\n\n /**\n * **It moved, so it says so.** A port walk that reported nothing would make `server.port:\n * 7420` in the manifest a line that is quietly false for the life of the process — the same\n * \"looks configured and is not\" failure the bind-disagreement check above refuses, arrived\n * at by a different route. Named on its own line rather than folded into the URL, because\n * the remedy is about the *other* process and not about this one.\n */\n if (running.port !== port)\n process.stdout.write(\n ` moved from ${port} — something else is on it. \\`--port ${port}\\` would refuse instead of moving.\\n`,\n )\n\n /**\n * The web UI and the reference, named because nothing named them.\n *\n * Both have been served unauthenticated since they shipped and neither appeared anywhere a\n * person looks — the API reference in particular, which is the single thing most worth\n * knowing about a server you have just started and cannot yet call. A surface nobody is\n * told about is a surface nobody has, which is the `includeHistory` shape applied to a page\n * rather than to a field.\n */\n process.stdout.write(` web UI ${browsable}/ · API reference ${browsable}/docs\\n`)\n for (const agent of agents) {\n const channels = runtime.channels.statusOf(agent.id)\n const suffix =\n channels.length === 0\n ? \"no channels\"\n : channels\n // A broken channel is marked here as well as announced, because the\n // announcement scrolls and this line is the summary somebody reads before\n // walking away. `opt — tg (telegram)` on a channel that will never connect\n // is the \"running and not working\" failure `status` exists to answer.\n .map(\n (c) => `${c.id} (${c.type}${c.status === \"error\" ? \", BROKEN\" : \"\"})`,\n )\n .join(\", \")\n // Schedules named on the banner for the reason the 57 MB log taught: this is the last\n // place a person looks before walking away, and \"it is set up\" is exactly the belief a\n // schedule that never fires depends on going unchecked.\n const enabled = agent.manifest.schedules.filter((schedule) => schedule.enabled)\n const scheduled =\n agent.manifest.schedules.length === 0\n ? \"\"\n : `, ${enabled.length} schedule${enabled.length === 1 ? \"\" : \"s\"}${\n agent.manifest.schedules.length > enabled.length\n ? ` (+${agent.manifest.schedules.length - enabled.length} disabled)`\n : \"\"\n }`\n process.stdout.write(` ${agent.id} — ${suffix}${scheduled}\\n`)\n }\n\n /**\n * What this process is **not** serving, and why that has to be said.\n *\n * A lease refused means another live process is already serving that agent, and the claim\n * now declines it rather than refusing the whole boot — so without this line a host asked\n * for five agents comes up reporting four and looks entirely healthy. That is the\n * looks-fine-and-is-not shape, one process boundary out, and the same one slot 2's\n * `servedElsewhere` exists for.\n *\n * The pid is printed because it is the only actionable thing here — the `stop` command\n * is the next command, and knowing which process to expect it to reach is the difference\n * between running it and wondering.\n */\n /**\n * What is switched off, and how to switch it back on.\n *\n * The line is the whole reason a durable stop is safe to have. launchd's `disable` persists\n * across boots and no verb deletes the row, so a job with that label installs cleanly,\n * reports success and never starts — 2,463 restarts into a 57 MB log, with message quality\n * never the problem. A persistent switch is only defensible when the thing it switches off\n * says so at the moment somebody is looking.\n */\n for (const entry of switchedOff) {\n process.stdout.write(\n ` ${entry.agentId} — stopped${\n entry.reason === undefined ? \"\" : ` (${entry.reason})`\n }, \\`${BRAND.slug} start ${entry.agentId}\\`\\n`,\n )\n }\n\n /**\n * What would not load, with the reason and the file.\n *\n * Printed rather than thrown, because throwing is what took the host down — and printed\n * *loudly*, because \"skipped\" is the one state a person reads as working. The path is the\n * actionable half: the fix is almost always a key missing from the `.env` beside it, which\n * is precisely the state `init` leaves an agent in on purpose.\n */\n for (const entry of broken) {\n process.stdout.write(` ${entry.path} — NOT served: ${entry.detail}\\n`)\n if (entry.hint !== undefined) process.stdout.write(` hint: ${entry.hint}\\n`)\n }\n\n for (const held of runtime.declined) {\n process.stdout.write(\n ` ${held.agentId} — NOT served here: pid ${held.pid} (${held.mode}) already has it\\n`,\n )\n }\n if (runtime.declined.length > 0) {\n process.stdout.write(\n ` \\`${BRAND.slug} stop <agent>\\` ends the other one, or leave it — nothing here is broken.\\n`,\n )\n }\n if (claim !== undefined) {\n // Printed here rather than logged at debug level for the reason the 57 MB log taught:\n // this is the line somebody is looking at, and a bootstrap credential in a file nobody\n // opens is a bootstrap nobody performs. Reading it is what confers first ownership, and\n // that is a real boundary — `docker logs` already reveals the agent's conversations, so\n // this grants nothing new to anyone who can see it.\n // The URL first, because opening it is what most people will do and the page does the\n // exchange properly — it POSTs the token rather than spending it on a GET. The `curl`\n // line stays for the case a browser cannot reach: a headless box, a CI step, a platform\n // minting its first key.\n process.stdout.write(\n ` open once to claim this server:\\n ${claimUrl(host, running.port, claim.token)}\\n` +\n ` without a browser: ${claimCommand(host, running.port, claim.token)}\\n`,\n )\n if (token === undefined || token === \"\") {\n // The latch in `createHandler`: a live key makes this server demand a credential.\n // Said out loud, because minting one on an open server *changes* what the server\n // is, and discovering that by being locked out of your own loopback port is the\n // worst way to learn it.\n process.stdout.write(\n \" the first key closes this server — every route then needs a credential.\\n\",\n )\n }\n }\n if (token === undefined || token === \"\") {\n // Loopback-only, or `serve` would have refused to bind. Said out loud anyway: someone\n // who later changes the host needs to know the token was never set.\n process.stdout.write(\n ` unauthenticated — loopback only. Set ${config.tokenEnv} to bind a public host.\\n`,\n )\n }\n // The single highest-value place to mention the daemon: this is the exact moment a person\n // learns that `serve` lives and dies with the terminal it was typed into. Left unsaid, the\n // discovery happens later, by the agent going quiet with nothing to explain it.\n if (asDaemon) {\n process.stdout.write(\n ` running as a background service · ${BRAND.slug} daemon status ${agents[0]?.id ?? \"\"}\\n`,\n )\n } else if (inContainer()) {\n /**\n * A container has no terminal to lose and is already supervised.\n *\n * The generic line told an operator reading `docker logs` to press ctrl-c — in a\n * terminal that does not exist — and to run `daemon install <agent>`, which is both the\n * per-agent form 16.4 retires *and* a second supervisor underneath the one that started\n * this process. Two pieces of advice, neither actionable, on the last line of the only\n * output a container deployment has.\n */\n process.stdout.write(\n \" supervised by the container runtime — it stops with the container, and SIGTERM finishes the delivery in flight.\\n\",\n )\n } else {\n process.stdout.write(\n ` ctrl-c to stop — this ends when the terminal does. \\`${BRAND.slug} daemon install${\n agents[0]?.id === undefined ? \"\" : ` ${agents[0].id}`\n }\\` keeps it running.\\n`,\n )\n }\n }\n\n // Registered as a *teardown*, not as a second signal handler, and that distinction was a live\n // bug. `installGuards` already owns SIGTERM and answers it with `finishNow(EXIT_SIGTERM)`,\n // which hard-exits; this module used to register its own `process.once(\"SIGTERM\")` alongside\n // it. Both fired, and the hard exit won — so `runtime.stop()` never completed. No outbox\n // flush, no clean database close, and no `provider.stop()`, which is the only thing that reaps\n // the child processes `exec` backgrounds. Invisible at a terminal, because ctrl-C sends SIGINT\n // and the guard deliberately ignores that one; unavoidable under a service manager, where\n // SIGTERM is how every stop and every restart happens.\n //\n // `finish()` awaits `runTeardowns()`, so putting the shutdown here means the signal path waits\n // for it instead of racing it.\n let stopped = false\n const shutdown = async () => {\n if (stopped) return\n stopped = true\n // Before the server closes, so a readiness probe sees `draining` and a client watching a\n // turn's stream sees it end.\n if (drainMs > 0 && runtime.all().some((agent) => agent.inFlight > 0)) {\n const started = Date.now()\n process.stdout.write(`draining — waiting up to ${drainMs} ms for running turns\\n`)\n const left = await runtime.drain(drainMs)\n process.stdout.write(\n left === 0\n ? `drained in ${Date.now() - started} ms\\n`\n : `${left} turn(s) still running after ${drainMs} ms; the next start marks them interrupted\\n`,\n )\n }\n await running.stop()\n if (hostLease) {\n await runtime.store.leases.release(HOST_LEASE, runtime.runtimeId).catch(() => {})\n }\n await runtime.stop(\"interrupted\")\n }\n onExit(shutdown)\n\n await stopRequested\n\n process.stdout.write(\"stopping\\n\")\n await shutdown()\n // Zero, deliberately, and it is load-bearing rather than cosmetic. A requested stop is not a\n // fault, and the generated service definition restarts only on a crash signal — so a non-zero\n // exit here would be read by the supervisor as \"this configuration is broken, stay down\".\n return EXIT_OK\n}\n\n/**\n * `<PREFIX>DRAIN_MS`: how long a stop waits for running turns. Unset is 0, today's behaviour — a\n * stop never waits. Refused at start when malformed, since a typo found at the first SIGTERM is a\n * drain that silently did not happen.\n */\nfunction drainFrom(env: Record<string, string | undefined>): number {\n const name = `${BRAND.envPrefix}DRAIN_MS`\n const raw = env[name]\n if (raw === undefined || raw === \"\") return 0\n if (!/^\\d+$/.test(raw)) {\n throw new HarnessError({\n code: \"serve_drain_invalid\",\n message: `${name} is \"${raw}\", which is not a number of milliseconds.`,\n hint: `Set it to a whole number, a few seconds under the orchestrator's grace period — 25000 beside Kubernetes' default terminationGracePeriodSeconds of 30. Unset, a stop does not wait.`,\n field: name,\n })\n }\n return Number(raw)\n}\n\n/**\n * Resolve on SIGINT or SIGTERM.\n *\n * Both, because SIGINT is a person at a terminal and SIGTERM is an orchestrator, and a container\n * that ignored SIGTERM would be killed after its grace period — mid-delivery, which is the one\n * moment the outbox's recovery path exists to survive and would rather not exercise.\n */\nfunction waitForSignal(): Promise<void> {\n return new Promise((resolve) => {\n const finish = () => {\n process.off(\"SIGINT\", finish)\n process.off(\"SIGTERM\", finish)\n resolve()\n }\n process.once(\"SIGINT\", finish)\n process.once(\"SIGTERM\", finish)\n })\n}\n\n/** Re-exported for the boundaries test, which asserts this module imports no renderer. */\nexport const SERVE_EXIT_FAILURE = EXIT_FAILURE\n\n/** How far past the requested port a walk will look before giving up. */\nconst PORT_WALK = 16\n\n/**\n * Bind at `first`, or at the next free port after it.\n *\n * Only a port that is **taken** advances the walk. Every other failure is rethrown on the spot: a\n * permission error on port 80 would otherwise be retried sixteen times and reported as \"the range\n * is full\", which sends a reader to the wrong problem entirely.\n *\n * Detected from the message rather than from a code, because that is what the runtime gives us —\n * Bun's `serve` throws `Failed to start server. Is port 7420 in use?` and Node's listener reports\n * `EADDRINUSE`. Both spellings are matched; a shape neither covers falls through to a rethrow,\n * which is the safe direction.\n */\nasync function bindWalking<T>(\n first: number,\n walk: boolean,\n bind: (port: number) => Promise<T>,\n): Promise<T> {\n // `0` is the OS picking for us. There is nothing to walk past, and incrementing it would turn\n // \"any free port\" into a request for port 1.\n const last = walk && first !== 0 ? first + PORT_WALK : first\n for (let candidate = first; ; candidate += 1) {\n try {\n return await bind(candidate)\n } catch (error) {\n if (candidate >= last || !portIsTaken(error)) throw error\n }\n }\n}\n\n/** Whether a bind failure was \"somebody else has this port\" rather than anything else. */\nfunction portIsTaken(error: unknown): boolean {\n if (typeof error === \"object\" && error !== null && \"code\" in error)\n if ((error as { code?: unknown }).code === \"EADDRINUSE\") return true\n const message = error instanceof Error ? error.message : String(error)\n return message.includes(\"EADDRINUSE\") || message.includes(\"in use\")\n}\n\n/**\n * What `DELETE /v1/agents/:id` may delete: an agent inside the sandbox whose id no other directory\n * declares. The same two refusals `remove` makes — a path outside the sandbox is somebody's project,\n * and a shared id shares one store, so deleting it would take the other agent's history too.\n */\nexport function sandboxRemover(env: Readonly<Record<string, string | undefined>>): AgentRemover {\n return {\n locate(agentId) {\n const matches = listAgents(env).filter((agent) => agent.id === agentId)\n const first = matches[0]\n if (first === undefined) {\n return {\n ok: false,\n status: 404,\n error: {\n code: \"agent_remove_not_in_sandbox\",\n message: `No agent \"${agentId}\" in the sandbox, so there are no files here to delete.`,\n hint: \"Only sandbox agents are deleted over the API. An agent elsewhere is removed by deleting its directory yourself.\",\n },\n }\n }\n if (matches.length > 1) {\n return {\n ok: false,\n status: 409,\n error: {\n code: \"agent_remove_shared_id\",\n message: `${matches.length} sandbox directories declare id \"${agentId}\": ${matches.map((agent) => agent.dir).join(\", \")}.`,\n hint: \"They share one conversation history, so deleting either would delete the other's too. Give one a different id first.\",\n },\n }\n }\n return { ok: true, dir: first.dir }\n },\n async deleteDir(dir) {\n if (!insideSandbox(dir, env)) {\n throw new Error(`refusing to delete ${dir}: it is outside the sandbox`)\n }\n rmSync(dir, { recursive: true, force: true })\n },\n }\n}\n",
|
|
34
|
+
"/**\n * The `serve` command: `<binary> serve <manifest> [--port N] [--host H]`.\n *\n * Boots a runtime with channels started, binds the HTTP surface, and stays up until interrupted.\n * The only long-running command in the binary, and the only one that opens a listening socket.\n *\n * **Channels start here and nowhere else.** `run` constructs the same runtime with\n * `startChannels: false`, because a REPL that silently began answering Telegram messages while you\n * typed at it would be a surprise, and a one-shot `run --input` that opened a long-poll would hang\n * on exit. The flag decides *whether*, never *when* — either way nothing connects before\n * `runtime.ready`.\n *\n * No Ink. A server writes lines to stdout and is very often not attached to a terminal at all; a\n * rendering framework on this path would cost more than the whole command and produce escape codes\n * in a log file.\n */\n\nimport { rmSync } from \"node:fs\"\nimport { dirname, join } from \"node:path\"\nimport {\n AgentManifestSchema,\n BRAND,\n EventBus,\n HarnessError,\n isHarnessError,\n loadManifest,\n Runtime,\n} from \"@dispach/core\"\nimport {\n type AgentRemover,\n browsableHost,\n claimCommand,\n claimUrl,\n createApprovalRegistry,\n createClaimTicket,\n serve,\n} from \"@dispach/server\"\nimport { secretStatus, writeSecrets } from \"#lib/agent-secrets\"\nimport {\n listTemplates,\n provisionFromTemplate,\n rerenderFromTemplate,\n templateRecordOf,\n} from \"#lib/agent-template\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { inContainer } from \"#lib/bootstrap\"\nimport { setChannelCredential, setChannelEnabled, unpairChannel } from \"#lib/channel-actions\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { claimSignals, onExit } from \"#lib/exit\"\nimport { claimHostLease, HOST_LEASE, hostableAgents, manifestForId } from \"#lib/lifecycle\"\nimport { claimManifest } from \"#lib/owner\"\nimport {\n BUILT_IN_PLUGINS,\n CHANNELS,\n MEDIA_PROVIDERS,\n MODEL_TRANSPORTS,\n scriptRunner,\n TOOL_PROVIDERS,\n} from \"#lib/providers\"\nimport { provisionAgent, provisionSteps } from \"#lib/provision\"\nimport { relayClient } from \"#lib/relay-client\"\nimport {\n agentsDir,\n insideSandbox,\n listAgents,\n pluginRoot,\n readHostToken,\n sandboxRoot,\n storePath,\n templatesDir,\n writeHostToken,\n} from \"#lib/sandbox\"\nimport { loopStallFrom, startLoopWatchdog } from \"#lib/watchdog\"\n\nexport interface ServeOptions {\n /**\n * Zero or more manifests. The process hosts every agent they produce.\n *\n * Plural since 16.2a: decision 8.5 has said \"one process hosts N agents\" since the beginning\n * and core was built that way — `RuntimeOptions.agents` is already an array — so a single path\n * here was the only thing pinning the product to one agent.\n *\n * **Empty means the sandbox's agents**, which is what the service unit runs and what makes the\n * product always-on: a host that has to be told which agents to serve cannot serve one that was\n * provisioned after it started. Naming manifests is the container's shape, where the agent\n * arrives on a mount and the sandbox is not the inventory.\n */\n readonly manifestPaths: readonly string[]\n readonly port?: number\n readonly host?: string\n readonly store?: string\n /** Print a one-time claim even when a key already exists. The lockout escape. */\n readonly claim?: boolean\n readonly json?: boolean\n}\n\n/**\n * The `server:` block a manifest that declares none resolves to.\n *\n * Asked of the **schema** rather than written out here, so a bare `serve` and a manifest with no\n * `server:` block cannot come to disagree about the port — which they would the first time somebody\n * changed the default in one place. Parsing an empty object is the cheapest way to ask a Zod schema\n * what its defaults are.\n */\nfunction defaultServerConfig(): ReturnType<typeof AgentManifestSchema.parse>[\"server\"] {\n return AgentManifestSchema.shape.server.parse({})\n}\n\nexport async function serveCommand(options: ServeOptions): Promise<number> {\n const env = ambientEnv(options.manifestPaths)\n const drainMs = drainFrom(env)\n const loopStallS = loopStallFrom(env)\n\n /**\n * What to host, and what is switched off.\n *\n * Read before the runtime exists, because it decides which agents the runtime is *asked* for —\n * a disabled agent is not loaded at all, so there is nothing to filter afterwards. The switch is\n * honoured for an explicitly named manifest too, and that is deliberate: the launchd trap this\n * table is modelled on is precisely a job that installs cleanly, reports success and silently\n * never starts, and the cure is not to make the durable state easy to bypass — it is to say so.\n */\n // The same path the runtime will open, not the sandbox default: `serve --store` exists, and\n // a host reading its on/off switch from a different database than the one it serves out of\n // is wrong in exactly the configuration that is easiest to miss.\n const storeFile = options.store ?? storePath()\n const hostable = await hostableAgents(options.manifestPaths, env, storeFile)\n const switchedOff = hostable.filter((entry) => !entry.enabled)\n const wanted = hostable.filter((entry) => entry.enabled)\n\n /**\n * **A discovered agent that will not load is skipped; a named one still refuses.**\n *\n * The asymmetry is the whole point, and it was found by running the container rather than by\n * reading this. `init` writes a manifest whose `.env` holds `MODEL_API_KEY=` — empty, by its\n * own design, since step 1 of what it prints is \"add your key\". A bare `serve` hosts every\n * enabled agent in the sandbox, so one freshly created agent made `loadManifest` throw, the\n * host exited 1, and `restart: unless-stopped` restarted it into the same failure: **9\n * restarts, the API gone, the web UI gone** — the always-on server that exists to provision\n * agents taken down by an agent halfway through being provisioned. The message was perfect and\n * went to `docker logs`, which is the 57 MB lesson with the polarity reversed: not a bad\n * message in a file nobody opens, a correct one nobody can act on because the thing that would\n * let them act is what died.\n *\n * So a host does not get to fail because one of N agents is misconfigured. That is the same\n * reasoning `listAgents` uses to show a broken directory rather than omitting it, and the same\n * reasoning behind `GET /v1/agents` carrying a stopped row: the listing says what exists, the\n * resource says what is running.\n *\n * A **named** manifest is the other case and keeps throwing. The caller asked for that agent by\n * path, so quietly serving something else is the worse error — exactly the direction\n * `hostableAgents` already distinguishes, which is why the condition here is the same one.\n */\n const discovered = options.manifestPaths.length === 0\n const manifests: { path: string; loaded: ReturnType<typeof loadManifest> }[] = []\n const broken: { path: string; detail: string; hint?: string }[] = []\n for (const entry of wanted) {\n try {\n /**\n * **One pass again, because the check that needed two is gone.**\n *\n * This was a plugin load followed by a `loadManifest` against\n * `Object.keys(supply.channels)` — the 0.1.1 fix for `defineChannel` not working\n * through this binary, where a manifest naming a plugin-supplied channel was refused\n * with `channel_type_unknown` before the plugin that would satisfy it was imported.\n *\n * The whole pass existed to feed `knownChannels`/`knownProviders` into the loader, and\n * neither exists any more: a channel type and a provider id are now checked where the\n * thing is *constructed* — `buildChannels` and `buildProviders` — which degrade what\n * they cannot build to a warning rather than refusing the agent. One owner each, so\n * there is nothing left for a second pass to disagree with, and an agent declaring\n * plugins no longer pays a duplicate `setup()` here.\n *\n * The try/catch stays. A manifest can still fail to load for its own reasons — a schema\n * error, a workspace file disk does not have — and a *discovered* one is skipped and\n * reported rather than taking the host down with it.\n */\n manifests.push({\n path: entry.manifestPath,\n loaded: loadManifest(entry.manifestPath, {\n env,\n }),\n })\n } catch (error) {\n if (!discovered) throw error\n broken.push({\n path: entry.manifestPath,\n detail: isHarnessError(error) ? error.message : String(error),\n ...(isHarnessError(error) && error.hint !== undefined ? { hint: error.hint } : {}),\n })\n }\n }\n /**\n * **Zero agents is a running server, not a failure.**\n *\n * The whole point of an always-on host is that the API exists before there is anything to talk\n * to: the binary is installed, the server is up, and provisioning reaches it. A refusal here\n * would make the first-run experience \"install, then find something to serve, then start\", and\n * would turn a container whose only agent somebody stopped into a crash loop.\n *\n * So the server config comes from the first manifest when there is one, and from the schema's\n * defaults when there is not — which is the same thing a manifest that declares no `server:`\n * block resolves to.\n */\n const first = manifests[0]\n const loaded = first?.loaded\n const config = loaded?.manifest.server ?? defaultServerConfig()\n\n /**\n * **The bind is process-level, so a disagreement about it is refused rather than ignored.**\n *\n * One process, one socket, one token — so with several manifests the server config can only\n * come from one of them, and silently taking the first would make a manifest that carefully\n * declares `port: 7500` a file whose setting does nothing. That is the \"looks configured and is\n * not\" shape, and it is worse here than elsewhere because the symptom is a port somebody else\n * is already using.\n *\n * Compared after defaults are applied, which is what makes this correct rather than pedantic:\n * an unset `port` *is* 7420, so a manifest that says 7420 and one that says nothing agree, and\n * one that says 7500 disagrees with both.\n */\n for (const entry of manifests.slice(1)) {\n const other = entry.loaded.manifest.server\n for (const [field, mine, theirs, settled] of [\n // **A flag settles the question, so it also settles the disagreement.** `--port` and\n // `--host` override every manifest, so refusing because two of them disagree about a\n // value nothing is going to read would be a refusal the operator has already answered.\n // `tokenEnv` has no flag, so a disagreement there is always live.\n [\"server.port\", config.port, other.port, options.port !== undefined],\n [\"server.host\", config.host, other.host, options.host !== undefined],\n [\"server.tokenEnv\", config.tokenEnv, other.tokenEnv, false],\n ] as const) {\n if (settled || mine === theirs) continue\n throw new HarnessError({\n code: \"serve_bind_conflict\",\n message: `${first?.path ?? \"the first manifest\"} sets ${field} to ${String(mine)} and ${entry.path} sets it to ${String(theirs)}.`,\n hint: \"One process binds one socket with one token, so these have to agree. Make them match, or run the disagreeing agent in its own process — a second `serve` on its own port.\",\n field,\n })\n }\n }\n // Flags win over the manifest: the manifest is the deployment's intent and a flag is this\n // invocation's. `--port 0` is honoured — it means \"any free port\", which a test wants.\n const port = options.port ?? config.port\n /**\n * Whether a taken port is a refusal or a starting point.\n *\n * **A flag is an instruction and the manifest is a preference.** `--port 7420` names one socket\n * and failing is the correct answer — silently serving somewhere else would be the \"looks\n * configured and is not\" shape this file already refuses for a manifest disagreement. Everything\n * else walks: `init` writes `port: 7420` into every manifest it generates, so on a machine with\n * a container, a service and a checkout the default collides constantly, and the old behaviour\n * was a dead end that named no way out.\n *\n * `--port 0` never walks — the OS is already picking a free one, and there is nothing to avoid.\n *\n * This is only safe because **the lease carries the address, not the manifest**: `publishAddress`\n * runs after the bind with whatever was actually taken, so `stop`, `web url` and an attached\n * `run` follow the socket rather than the file. That mechanism exists for `--port 0` and this\n * rides on it.\n */\n const walkPorts = options.port === undefined\n const host = options.host ?? config.host\n // `loaded.env`, never `env`. `ambientEnv` returns the *process* environment — the agent's own\n // `.env` beside the manifest is layered in by `loadManifest`, which is why every other\n // credential in this runtime is read from the manifest's live env. Reading the ambient one\n // here meant a token sitting in the agent's `.env` was invisible, and the banner said\n // \"unauthenticated\" while the file plainly had it. Same mistake `Agent.create` documents:\n // the manifest's live env, not the ambient one.\n // `loaded.env`, never `env`. `ambientEnv` returns the *process* environment; the agent's own\n // `.env` beside the manifest is layered in by `loadManifest`. With no manifest at all there is\n // no agent env to layer, so the process environment is the only source there is — which is the\n // service unit's shape, where the variable comes from the unit definition.\n const own = loaded === undefined ? env[config.tokenEnv] : loaded.env[config.tokenEnv]\n // A sandbox host serves with the sandbox's token, not the first manifest's (QA 0.2.0: every\n // other agent's `run`, `stop` and `start` sent its own and got 401). An export still wins —\n // that is how a container is configured. With no file yet, the token this host would have used\n // becomes the sandbox's, so nothing that authenticates today stops working.\n const exported = env[config.tokenEnv]\n const inSandbox = manifests.every((entry) => insideSandbox(dirname(entry.path), env))\n let token = own\n if (inSandbox && (exported === undefined || exported === \"\")) {\n const shared = readHostToken(agentsDir(env))\n if (shared !== undefined) token = shared\n else if (own !== undefined && own !== \"\") writeHostToken(agentsDir(env), own)\n }\n\n // Set by the generated service definition and by nothing else, so this is a fact rather than a\n // guess. `ppid === 1` would also be true of any orphaned process, and getting it wrong means\n // telling someone to press ctrl-c at a log file.\n const asDaemon = env[`${BRAND.envPrefix}SERVICE`] !== undefined\n\n // Subscribed BEFORE the runtime exists, which is what the `bus` option is for. Channels start\n // inside `Runtime.create` — after `runtime.ready`, but still inside the call — so a listener\n // attached afterwards misses every status and error they emitted on the way up. Same trap as\n // the boot warnings that landed in an empty room for weeks: anything true during boot has to be\n // subscribed to before boot.\n const bus = new EventBus({ runtimeId: `rt_${Date.now().toString(36)}` })\n if (options.json !== true) {\n bus.on(\"agent.channel.status\", (event) => {\n const data = event.data as {\n channelId: string\n status: string\n detail?: string\n input?: { kind: string; payload: string; expiresAt?: string }\n }\n /**\n * A `needs_input` names where the payload is, and never prints it.\n *\n * The payload is a QR's bytes — unreadable in a log, and hundreds of characters of it\n * would bury the sentence that matters. But a line saying only \"needs_input\" is the\n * 57 MB-log failure in one line: true, and no route to acting on it. The agent\n * resource carries the payload because `statusOf` returns it, so that is what this\n * points at.\n */\n /**\n * **A pairing code is printed; a QR is pointed at.** The rule above — never print the\n * payload — was written for a QR, which is hundreds of bytes nobody can read off a\n * log. An eight-character code is the opposite: it *is* the thing to read, and a line\n * saying \"GET /v1/agents/milo carries it\" sent a person to a browser to fetch eight\n * characters the terminal already had.\n */\n const waiting =\n data.input === undefined\n ? \"\"\n : data.input.kind === \"pairing_code\"\n ? `\\n\\n ${data.input.payload}\\n${\n data.input.expiresAt === undefined\n ? \"\"\n : `\\n expires ${data.input.expiresAt}`\n }`\n : ` (${data.input.kind}${\n data.input.expiresAt === undefined\n ? \"\"\n : `, expires ${data.input.expiresAt}`\n } — GET /v1/agents/${event.agentId ?? \"\"} carries it)`\n process.stdout.write(\n ` ${data.channelId}: ${data.status}${data.detail === undefined ? \"\" : ` — ${data.detail}`}${waiting}\\n`,\n )\n })\n bus.on(\"agent.channel.error\", (event) => {\n const data = event.data as { channelId: string; message: string; hint: string }\n process.stderr.write(` ${data.channelId}: ${data.message}\\n hint: ${data.hint}\\n`)\n })\n /**\n * A turn that failed, in the only log a container has.\n *\n * `error` is where every uncaught turn failure lands, and **nothing here subscribed to it**\n * — the same empty room `delivery.failed` sat in, one event over. Measured live: a 401 from\n * the model endpoint ended a turn in 258 ms, `POST /messages` had already answered 200 with\n * a turn id, `GET /sessions/<key>/messages` returned `[]`, and `docker logs` held not one\n * word about it. Every surface a person could reach said nothing while the runtime had a\n * sentence naming the cause and the field to fix.\n *\n * stderr, and the session key with it: under a service manager this is the file somebody\n * greps after the fact, and a failure with no conversation attached cannot be matched to\n * the message that provoked it.\n */\n bus.on(\"error\", (event) => {\n const data = event.data as { code: string; message: string; hint: string }\n const where = event.sessionKey === undefined ? \"\" : ` [${event.sessionKey}]`\n process.stderr.write(\n ` turn failed${where}: ${data.code}: ${data.message}\\n hint: ${data.hint}\\n`,\n )\n })\n // The one thing a person watching a bot most wants to see, and it is otherwise only in the\n // event stream: who was refused, and the line that would let them in.\n bus.on(\"agent.channel.rejected\", (event) => {\n const data = event.data as { channelId: string; reason: string; detail: string }\n process.stdout.write(` ${data.channelId}: ${data.reason} — ${data.detail}\\n`)\n })\n }\n\n /**\n * Created before the runtime, because the runtime is constructed *with* the approver.\n *\n * That ordering is the whole reason this lives here and not inside `serve()`: `Runtime.create`\n * takes `approve` and cannot hand back the function it was built with, so the registry has to\n * exist first and then be given to both. Same shape as the shared `running` map, one layer\n * further out.\n *\n * Supplying it is also what silences `confirm_without_approver` — `Agent.create` keys that\n * warning on `approve` being absent, so an agent with `onMutate: \"confirm\"` stops warning under\n * `serve` and keeps warning under `run`, which is exactly true of the two surfaces today.\n */\n const approvals = createApprovalRegistry()\n\n // The control plane's peer-ask relay (decision 15.10): present only in a silo it placed, which it\n // gives both variables. Built once, so a host reload keeps the cached peer list in memory.\n const relayUrl = env[`${BRAND.envPrefix}RELAY_URL`]\n const relayToken = env[`${BRAND.envPrefix}RELAY_TOKEN`]\n const relay =\n relayUrl === undefined || relayUrl === \"\" || relayToken === undefined || relayToken === \"\"\n ? undefined\n : relayClient({\n url: relayUrl,\n token: relayToken,\n cacheFile: join(dirname(storeFile), \"relay-peers.json\"),\n })\n const createOptions = (paths: readonly string[]): Parameters<typeof Runtime.create>[0] => ({\n agents: paths,\n ...(relay === undefined ? {} : { relay }),\n // The seam `ToolContext.approve` declared in Phase 3 and nothing ever filled. A blocked\n // call now emits `approval.requested` and waits for a POST; an unanswered one ends with the\n // turn, because core races the approver against the turn's own signal rather than starting\n // a second clock.\n approve: approvals.approver,\n env,\n bus,\n toolProviders: TOOL_PROVIDERS,\n modelTransports: MODEL_TRANSPORTS,\n mediaProviders: MEDIA_PROVIDERS,\n builtInPlugins: BUILT_IN_PLUGINS,\n pluginRoot: pluginRoot(),\n scriptRunner: scriptRunner(),\n channels: CHANNELS,\n // The one call site that passes this. See the file comment.\n startChannels: true,\n // Same rule and the same reason: `serve` is the only command that fires schedules. A REPL\n // that started firing them while somebody typed at it would be a surprise, and a one-shot\n // `run --input` that armed a timer would not exit.\n startSchedules: true,\n // `run` and `sessions` have resolved this default since the sandbox landed; `serve` never\n // did, so it silently took core's `\":memory:\"` — correct as a *library* default, since\n // constructing a Runtime must not create a directory in someone's working tree, and wrong\n // for the one command built to stay up. The cost was invisible and total: every channel\n // conversation started blank after a restart, `sessions` could not see a single turn that\n // arrived over a channel, and Phase 4's exactly-once outbox was unreachable through the\n // only command that has channels — the queue was created and destroyed per process, so a\n // crash mid-delivery lost the queue rather than recovering it.\n store: storeFile,\n // Recorded on the runtime lease and read back only to phrase a refusal. `<PREFIX>SERVICE`\n // is set by the generated service definition and by nothing else, so this is a fact rather\n // than a guess — `ppid === 1` would also be true of any orphaned process.\n mode: asDaemon ? \"daemon\" : \"terminal\",\n })\n\n /**\n * **One agent the runtime refuses to build does not take the host down either (QA K14).**\n *\n * The pre-check above only sees what `loadManifest` refuses. `Agent.create` refuses more — a media\n * provider whose key is not set yet (enabled first and filled second, on purpose), a workspace\n * file `memory_write` grew past its budget — and one such agent made `serve` exit 1 for every\n * agent in the sandbox. So when a *discovered* set fails, each agent is built alone in a\n * throwaway, in-memory runtime; the ones that fail join `broken` and are reported beside the\n * others, and the host starts with the rest. Only the failure path pays for it.\n */\n let runtime: Runtime\n try {\n runtime = await Runtime.create(createOptions(manifests.map((entry) => entry.path)))\n } catch (error) {\n if (!discovered || manifests.length === 0) throw error\n const survivors: typeof manifests = []\n for (const entry of manifests) {\n try {\n const probe = await Runtime.create({\n ...createOptions([entry.path]),\n store: \":memory:\",\n startChannels: false,\n startSchedules: false,\n })\n await probe.stop()\n survivors.push(entry)\n } catch (alone) {\n broken.push({\n path: entry.path,\n detail: isHarnessError(alone) ? alone.message : String(alone),\n ...(isHarnessError(alone) && alone.hint !== undefined\n ? { hint: alone.hint }\n : {}),\n })\n }\n }\n // Every agent builds alone, so the failure is not any one agent's: say it as it was.\n if (survivors.length === manifests.length) throw error\n manifests.splice(0, manifests.length, ...survivors)\n runtime = await Runtime.create(createOptions(survivors.map((entry) => entry.path)))\n }\n\n // Claimed and *registered* before the socket binds, and that ordering is the bug this fixes.\n //\n // Both used to sit after the banner. So between \"serving on …\" reaching stdout and\n // `waitForSignal()` registering its handlers there was a window with **no handler at all** — and\n // in it, SIGINT takes its default action and kills the process outright: exit code `null`, no\n // outbox flush, no lease release, and none of the backgrounded `exec` children reaped.\n //\n // Not a theoretical window. CI caught it as `Expected: 0, Received: null` on a loaded two-core\n // runner, where the work between the two points takes long enough to lose the race — and the\n // real-world shape is worse than a red test: an orchestrator that restarts a container promptly\n // sends its signal into exactly that gap, which is the failure `claimSignals` was introduced to\n // prevent in the first place.\n //\n // The promise is created here and awaited far below. A signal arriving in between resolves it\n // immediately, so an early stop is honoured rather than missed.\n claimSignals()\n const stopRequested = waitForSignal()\n\n /**\n * The one-time bootstrap credential, minted only when there is nothing to bootstrap *from*.\n *\n * Printed while no operator key is live, and otherwise not — a fresh claim at every boot would\n * leave a standing credential in the log, which is the opposite of a one-time ticket. `--claim`\n * overrides that, because a claim printed only while no key exists is a claim unavailable to\n * exactly the person who has lost theirs.\n *\n * Minted after `Runtime.create` because the store has to be open to ask, and before the bind\n * because the handler needs it — the same ordering `approvals` has one layer up.\n */\n const liveKeys = await runtime.store.operatorKeys.liveCount()\n const claim = liveKeys === 0 || options.claim === true ? createClaimTicket() : undefined\n\n let running: Awaited<ReturnType<typeof serve>>\n /**\n * Ports actually tried, so the banner can say it moved and the refusal can say how far it looked.\n * The first entry is what was asked for.\n */\n const attempted: number[] = []\n try {\n running = await bindWalking(port, walkPorts, (candidate) => {\n attempted.push(candidate)\n return serve({\n runtime,\n host,\n port: candidate,\n approvals,\n // The origin allowlists, from the manifest. Passed rather than defaulted, because the\n // guard's *default* behaviour is what protects a server whose operator configured\n // nothing — these two only widen it.\n allowedOrigins: config.allowedOrigins,\n allowedHosts: config.allowedHosts,\n /**\n * How `POST /v1/agents/:id/start` finds a manifest for an agent this host is not\n * holding. Injected because `packages/server` may not import the CLI, and the sandbox\n * layout is the CLI's — the same seam 16.5's provisioning route needs.\n *\n * Matched on the manifest's **id**, not on the directory name, because `:id` in the\n * route is an agent id and the two are allowed to differ for a hand-copied directory.\n */\n resolveAgent: (agentId) => manifestForId(agentId, env),\n /**\n * How `POST /v1/agents` creates one. The server owns the route and the gate; this is\n * the implementation, injected because `packages/server` may not import the CLI.\n *\n * Both halves come from `lib/provision.ts`, which is also what `init` writes through —\n * so an agent provisioned over HTTP is byte-identical to one created at a terminal, and\n * the step list a browser renders is the walk the wizard performs.\n *\n * Injected **unconditionally**, including in the container. What keeps provisioning out\n * of there is the loopback gate rather than this absence — the image's `CMD` binds\n * `0.0.0.0`, so the route answers `403`. A container that deliberately binds loopback\n * and wants to provision into itself is then a thing that works, which is the right\n * answer for `docker run -it … init`'s neighbour.\n */\n provision: {\n steps: () => provisionSteps({ agentDirBase: agentsDir(env) }),\n create: (answers) =>\n provisionAgent({ answers, defaults: { agentDirBase: agentsDir(env) } }),\n // Over this runtime's own store, so the agent is adopted already owned.\n claim: async (manifestPath) => {\n await claimManifest(runtime.store, manifestPath, agentsDir(env))\n },\n templates: () => listTemplates(templatesDir(env)),\n createFromTemplate: (input) =>\n provisionFromTemplate({\n ...input,\n templatesDir: templatesDir(env),\n agentDirBase: agentsDir(env),\n }),\n rerender: (input) =>\n rerenderFromTemplate({ ...input, templatesDir: templatesDir(env) }),\n templateOf: templateRecordOf,\n },\n /**\n * `GET`/`PUT /v1/agents/:id/secrets`. The allowed names come from the agent's own\n * manifest inside `writeSecrets`, never from the request; the `.env` write is\n * `applySecret`, the same one `config env` uses.\n */\n secrets: { status: secretStatus, write: writeSecrets },\n /** `DELETE /v1/agents/:id`: sandbox agents only, and never an id two directories share. */\n remover: sandboxRemover(env),\n /** `GET /v1/backup?include=home`: everything else under the sandbox root. */\n home: sandboxRoot(env),\n /**\n * The same functions the `channels` command calls, injected for the same reason the\n * provisioner is: *how* a channel is switched off or re-credentialled is the CLI's —\n * `editManifest` for one, `applySecret` at `0600` for the other — and a second\n * implementation inside the server is how the browser and the terminal come to disagree\n * about what \"disconnect\" means.\n */\n channels: {\n setEnabled: setChannelEnabled,\n setCredential: setChannelCredential,\n unpair: unpairChannel,\n },\n ...(claim === undefined ? {} : { claim }),\n ...(token === undefined || token === \"\" ? {} : { token }),\n })\n })\n } catch (error) {\n // The runtime is already up; leaving it running after a failed bind would hold the store\n // open and keep channels polling with nothing serving.\n await runtime.stop(\"server failed to bind\")\n if (isHarnessError(error)) throw error\n const looked = attempted.length > 1 ? ` — also tried ${attempted.slice(1).join(\", \")}` : \"\"\n throw new HarnessError({\n code: \"server_bind_failed\",\n message: `Could not bind ${host}:${port}${looked}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n hint: walkPorts\n ? `Every port in the range is taken. Pass --port to name a free one, or stop whatever is holding them — \\`${BRAND.slug} stop\\` releases one this runtime started.`\n : \"Another process is on that port, and --port was given explicitly so nothing else was tried. Drop the flag to let it walk to the next free port, or name a different one.\",\n cause: error,\n })\n }\n\n /**\n * Tell the lease rows where this host answers, now that the socket exists.\n *\n * After the bind and not before, because `--port 0` means the port is not known until then —\n * and this is the whole mechanism behind `stop <agent>`: one process hosts several agents, so\n * stopping one has to be a request naming it rather than a signal to the process.\n */\n // Claimed before the address is published, so `publish` puts the address on it too.\n const hostLease =\n runtime.owned.length === 0 &&\n (await claimHostLease(runtime.store.leases, {\n runtimeId: runtime.runtimeId,\n mode: asDaemon ? \"daemon\" : \"terminal\",\n }))\n await runtime.publishAddress(running.url)\n\n const agents = runtime.list()\n\n // Name the process after what it is serving.\n //\n // Without this a long-running service is a bare interpreter in Activity Monitor and in `ps`,\n // indistinguishable from every other one on the machine — and the one place a person looks when\n // something is eating CPU is exactly the place it was anonymous.\n //\n // **One agent gets its name; several get a count.** Listing them would blow the 16-character\n // `comm` truncation on the second id and leave a fragment, which is worse than a number.\n //\n // Two stated costs. Assigning `process.title` overwrites the argv region, so `ps` shows this\n // instead of the full command line — the arguments stay visible in `launchctl print` and in\n // `daemon status`. And **Bun ignores the assignment entirely**: measured against the same\n // manifest, Node shows the title while `bun run` from a checkout shows raw argv.\n // So this works on the soft-compat runtime and nowhere else, which is worth knowing before\n // relying on it — the line stays because it costs nothing where it does not work.\n const firstAgent = agents[0]\n if (firstAgent !== undefined) {\n process.title =\n agents.length === 1\n ? `${BRAND.slug} ${firstAgent.id}`\n : `${BRAND.slug} ${agents.length} agents`\n }\n // The port is bound now, which `Runtime.create` could not know — it returns before `serve` runs.\n // Told before the first turn, so slot 2 says \"on\" rather than \"enabled but not listening\".\n for (const agent of agents) agent.reportRuntimeState({ serverListening: true })\n // After the bind: a slow start is not a stall, and before it there is nothing to restart for.\n const stopWatchdog = startLoopWatchdog(loopStallS)\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify({\n url: running.url,\n websocket: running.websocket,\n authenticated: token !== undefined && token !== \"\",\n keys: liveKeys,\n ...(claim === undefined ? {} : { claim: claim.token }),\n agents: agents.map((agent) => ({\n id: agent.id,\n channels: runtime.channels.statusOf(agent.id),\n })),\n // Named even when empty, so a scripted caller can tell \"nothing was declined\" from\n // \"this build does not report it\".\n declined: runtime.declined.map((held) => ({\n agentId: held.agentId,\n pid: held.pid,\n mode: held.mode,\n since: held.startedAt,\n })),\n // Same reasoning, and the more important of the two: an agent absent from this\n // report with no line explaining it is the \"I set this up and it is not running\"\n // failure the durable switch exists to make explicable.\n disabled: switchedOff.map((entry) => ({\n agentId: entry.agentId,\n ...(entry.reason === undefined ? {} : { reason: entry.reason }),\n })),\n // A third way an agent can be absent, and the one that reads as a bug rather than\n // as a choice: its manifest would not load. Named for the same reason as the two\n // above — a scripted caller has to be able to tell \"no agent is broken\" from \"this\n // build does not say\".\n broken: broken.map((entry) => ({\n path: entry.path,\n detail: entry.detail,\n ...(entry.hint === undefined ? {} : { hint: entry.hint }),\n })),\n })}\\n`,\n )\n } else {\n /**\n * **A bind is not an address.** `running.url` carries whatever was bound, so the container\n * printed `http://0.0.0.0:7420` — a URL a browser does nothing with, as the first and most\n * prominent line of the banner. `browsableHost` has existed since Phase 13 for exactly\n * this and its own docstring notes it had two copies before a third caller arrived; this is\n * the fourth, and it never got it. A laptop cannot show the defect: `serve` there binds\n * `127.0.0.1` and the substitution never fires.\n *\n * The bind is still named when it differs, because \"listening on every interface\" is a\n * security-relevant fact and quietly showing loopback instead would hide it.\n */\n const browsable = `http://${browsableHost(host)}:${running.port}`\n const boundNote = browsable === running.url ? \"\" : ` (bound ${host} — every interface)`\n process.stdout.write(`${BRAND.name} serving on ${browsable}${boundNote}\\n`)\n\n /**\n * **It moved, so it says so.** A port walk that reported nothing would make `server.port:\n * 7420` in the manifest a line that is quietly false for the life of the process — the same\n * \"looks configured and is not\" failure the bind-disagreement check above refuses, arrived\n * at by a different route. Named on its own line rather than folded into the URL, because\n * the remedy is about the *other* process and not about this one.\n */\n if (running.port !== port)\n process.stdout.write(\n ` moved from ${port} — something else is on it. \\`--port ${port}\\` would refuse instead of moving.\\n`,\n )\n\n /**\n * The web UI and the reference, named because nothing named them.\n *\n * Both have been served unauthenticated since they shipped and neither appeared anywhere a\n * person looks — the API reference in particular, which is the single thing most worth\n * knowing about a server you have just started and cannot yet call. A surface nobody is\n * told about is a surface nobody has, which is the `includeHistory` shape applied to a page\n * rather than to a field.\n */\n process.stdout.write(` web UI ${browsable}/ · API reference ${browsable}/docs\\n`)\n for (const agent of agents) {\n const channels = runtime.channels.statusOf(agent.id)\n const suffix =\n channels.length === 0\n ? \"no channels\"\n : channels\n // A broken channel is marked here as well as announced, because the\n // announcement scrolls and this line is the summary somebody reads before\n // walking away. `opt — tg (telegram)` on a channel that will never connect\n // is the \"running and not working\" failure `status` exists to answer.\n .map(\n (c) => `${c.id} (${c.type}${c.status === \"error\" ? \", BROKEN\" : \"\"})`,\n )\n .join(\", \")\n // Schedules named on the banner for the reason the 57 MB log taught: this is the last\n // place a person looks before walking away, and \"it is set up\" is exactly the belief a\n // schedule that never fires depends on going unchecked.\n const enabled = agent.manifest.schedules.filter((schedule) => schedule.enabled)\n const scheduled =\n agent.manifest.schedules.length === 0\n ? \"\"\n : `, ${enabled.length} schedule${enabled.length === 1 ? \"\" : \"s\"}${\n agent.manifest.schedules.length > enabled.length\n ? ` (+${agent.manifest.schedules.length - enabled.length} disabled)`\n : \"\"\n }`\n process.stdout.write(` ${agent.id} — ${suffix}${scheduled}\\n`)\n }\n\n /**\n * What this process is **not** serving, and why that has to be said.\n *\n * A lease refused means another live process is already serving that agent, and the claim\n * now declines it rather than refusing the whole boot — so without this line a host asked\n * for five agents comes up reporting four and looks entirely healthy. That is the\n * looks-fine-and-is-not shape, one process boundary out, and the same one slot 2's\n * `servedElsewhere` exists for.\n *\n * The pid is printed because it is the only actionable thing here — the `stop` command\n * is the next command, and knowing which process to expect it to reach is the difference\n * between running it and wondering.\n */\n /**\n * What is switched off, and how to switch it back on.\n *\n * The line is the whole reason a durable stop is safe to have. launchd's `disable` persists\n * across boots and no verb deletes the row, so a job with that label installs cleanly,\n * reports success and never starts — 2,463 restarts into a 57 MB log, with message quality\n * never the problem. A persistent switch is only defensible when the thing it switches off\n * says so at the moment somebody is looking.\n */\n for (const entry of switchedOff) {\n process.stdout.write(\n ` ${entry.agentId} — stopped${\n entry.reason === undefined ? \"\" : ` (${entry.reason})`\n }, \\`${BRAND.slug} start ${entry.agentId}\\`\\n`,\n )\n }\n\n /**\n * What would not load, with the reason and the file.\n *\n * Printed rather than thrown, because throwing is what took the host down — and printed\n * *loudly*, because \"skipped\" is the one state a person reads as working. The path is the\n * actionable half: the fix is almost always a key missing from the `.env` beside it, which\n * is precisely the state `init` leaves an agent in on purpose.\n */\n for (const entry of broken) {\n process.stdout.write(` ${entry.path} — NOT served: ${entry.detail}\\n`)\n if (entry.hint !== undefined) process.stdout.write(` hint: ${entry.hint}\\n`)\n }\n\n for (const held of runtime.declined) {\n process.stdout.write(\n ` ${held.agentId} — NOT served here: pid ${held.pid} (${held.mode}) already has it\\n`,\n )\n }\n if (runtime.declined.length > 0) {\n process.stdout.write(\n ` \\`${BRAND.slug} stop <agent>\\` ends the other one, or leave it — nothing here is broken.\\n`,\n )\n }\n if (claim !== undefined) {\n // Printed here rather than logged at debug level for the reason the 57 MB log taught:\n // this is the line somebody is looking at, and a bootstrap credential in a file nobody\n // opens is a bootstrap nobody performs. Reading it is what confers first ownership, and\n // that is a real boundary — `docker logs` already reveals the agent's conversations, so\n // this grants nothing new to anyone who can see it.\n // The URL first, because opening it is what most people will do and the page does the\n // exchange properly — it POSTs the token rather than spending it on a GET. The `curl`\n // line stays for the case a browser cannot reach: a headless box, a CI step, a platform\n // minting its first key.\n process.stdout.write(\n ` open once to claim this server:\\n ${claimUrl(host, running.port, claim.token)}\\n` +\n ` without a browser: ${claimCommand(host, running.port, claim.token)}\\n`,\n )\n if (token === undefined || token === \"\") {\n // The latch in `createHandler`: a live key makes this server demand a credential.\n // Said out loud, because minting one on an open server *changes* what the server\n // is, and discovering that by being locked out of your own loopback port is the\n // worst way to learn it.\n process.stdout.write(\n \" the first key closes this server — every route then needs a credential.\\n\",\n )\n }\n }\n if (token === undefined || token === \"\") {\n // Loopback-only, or `serve` would have refused to bind. Said out loud anyway: someone\n // who later changes the host needs to know the token was never set.\n process.stdout.write(\n ` unauthenticated — loopback only. Set ${config.tokenEnv} to bind a public host.\\n`,\n )\n }\n // The single highest-value place to mention the daemon: this is the exact moment a person\n // learns that `serve` lives and dies with the terminal it was typed into. Left unsaid, the\n // discovery happens later, by the agent going quiet with nothing to explain it.\n if (asDaemon) {\n process.stdout.write(\n ` running as a background service · ${BRAND.slug} daemon status ${agents[0]?.id ?? \"\"}\\n`,\n )\n } else if (inContainer()) {\n /**\n * A container has no terminal to lose and is already supervised.\n *\n * The generic line told an operator reading `docker logs` to press ctrl-c — in a\n * terminal that does not exist — and to run `daemon install <agent>`, which is both the\n * per-agent form 16.4 retires *and* a second supervisor underneath the one that started\n * this process. Two pieces of advice, neither actionable, on the last line of the only\n * output a container deployment has.\n */\n process.stdout.write(\n \" supervised by the container runtime — it stops with the container, and SIGTERM finishes the delivery in flight.\\n\",\n )\n } else {\n process.stdout.write(\n ` ctrl-c to stop — this ends when the terminal does. \\`${BRAND.slug} daemon install${\n agents[0]?.id === undefined ? \"\" : ` ${agents[0].id}`\n }\\` keeps it running.\\n`,\n )\n }\n }\n\n // Registered as a *teardown*, not as a second signal handler, and that distinction was a live\n // bug. `installGuards` already owns SIGTERM and answers it with `finishNow(EXIT_SIGTERM)`,\n // which hard-exits; this module used to register its own `process.once(\"SIGTERM\")` alongside\n // it. Both fired, and the hard exit won — so `runtime.stop()` never completed. No outbox\n // flush, no clean database close, and no `provider.stop()`, which is the only thing that reaps\n // the child processes `exec` backgrounds. Invisible at a terminal, because ctrl-C sends SIGINT\n // and the guard deliberately ignores that one; unavoidable under a service manager, where\n // SIGTERM is how every stop and every restart happens.\n //\n // `finish()` awaits `runTeardowns()`, so putting the shutdown here means the signal path waits\n // for it instead of racing it.\n let stopped = false\n const shutdown = async () => {\n if (stopped) return\n stopped = true\n stopWatchdog()\n // Before the server closes, so a readiness probe sees `draining` and a client watching a\n // turn's stream sees it end.\n if (drainMs > 0 && runtime.all().some((agent) => agent.inFlight > 0)) {\n const started = Date.now()\n process.stdout.write(`draining — waiting up to ${drainMs} ms for running turns\\n`)\n const left = await runtime.drain(drainMs)\n process.stdout.write(\n left === 0\n ? `drained in ${Date.now() - started} ms\\n`\n : `${left} turn(s) still running after ${drainMs} ms; the next start marks them interrupted\\n`,\n )\n }\n await running.stop()\n if (hostLease) {\n await runtime.store.leases.release(HOST_LEASE, runtime.runtimeId).catch(() => {})\n }\n await runtime.stop(\"interrupted\")\n }\n onExit(shutdown)\n\n await stopRequested\n\n process.stdout.write(\"stopping\\n\")\n await shutdown()\n // Zero, deliberately, and it is load-bearing rather than cosmetic. A requested stop is not a\n // fault, and the generated service definition restarts only on a crash signal — so a non-zero\n // exit here would be read by the supervisor as \"this configuration is broken, stay down\".\n return EXIT_OK\n}\n\n/**\n * `<PREFIX>DRAIN_MS`: how long a stop waits for running turns. Unset is 0, today's behaviour — a\n * stop never waits. Refused at start when malformed, since a typo found at the first SIGTERM is a\n * drain that silently did not happen.\n */\nfunction drainFrom(env: Record<string, string | undefined>): number {\n const name = `${BRAND.envPrefix}DRAIN_MS`\n const raw = env[name]\n if (raw === undefined || raw === \"\") return 0\n if (!/^\\d+$/.test(raw)) {\n throw new HarnessError({\n code: \"serve_drain_invalid\",\n message: `${name} is \"${raw}\", which is not a number of milliseconds.`,\n hint: `Set it to a whole number, a few seconds under the orchestrator's grace period — 25000 beside Kubernetes' default terminationGracePeriodSeconds of 30. Unset, a stop does not wait.`,\n field: name,\n })\n }\n return Number(raw)\n}\n\n/**\n * Resolve on SIGINT or SIGTERM.\n *\n * Both, because SIGINT is a person at a terminal and SIGTERM is an orchestrator, and a container\n * that ignored SIGTERM would be killed after its grace period — mid-delivery, which is the one\n * moment the outbox's recovery path exists to survive and would rather not exercise.\n */\nfunction waitForSignal(): Promise<void> {\n return new Promise((resolve) => {\n const finish = () => {\n process.off(\"SIGINT\", finish)\n process.off(\"SIGTERM\", finish)\n resolve()\n }\n process.once(\"SIGINT\", finish)\n process.once(\"SIGTERM\", finish)\n })\n}\n\n/** Re-exported for the boundaries test, which asserts this module imports no renderer. */\nexport const SERVE_EXIT_FAILURE = EXIT_FAILURE\n\n/** How far past the requested port a walk will look before giving up. */\nconst PORT_WALK = 16\n\n/**\n * Bind at `first`, or at the next free port after it.\n *\n * Only a port that is **taken** advances the walk. Every other failure is rethrown on the spot: a\n * permission error on port 80 would otherwise be retried sixteen times and reported as \"the range\n * is full\", which sends a reader to the wrong problem entirely.\n *\n * Detected from the message rather than from a code, because that is what the runtime gives us —\n * Bun's `serve` throws `Failed to start server. Is port 7420 in use?` and Node's listener reports\n * `EADDRINUSE`. Both spellings are matched; a shape neither covers falls through to a rethrow,\n * which is the safe direction.\n */\nasync function bindWalking<T>(\n first: number,\n walk: boolean,\n bind: (port: number) => Promise<T>,\n): Promise<T> {\n // `0` is the OS picking for us. There is nothing to walk past, and incrementing it would turn\n // \"any free port\" into a request for port 1.\n const last = walk && first !== 0 ? first + PORT_WALK : first\n for (let candidate = first; ; candidate += 1) {\n try {\n return await bind(candidate)\n } catch (error) {\n if (candidate >= last || !portIsTaken(error)) throw error\n }\n }\n}\n\n/** Whether a bind failure was \"somebody else has this port\" rather than anything else. */\nfunction portIsTaken(error: unknown): boolean {\n if (typeof error === \"object\" && error !== null && \"code\" in error)\n if ((error as { code?: unknown }).code === \"EADDRINUSE\") return true\n const message = error instanceof Error ? error.message : String(error)\n return message.includes(\"EADDRINUSE\") || message.includes(\"in use\")\n}\n\n/**\n * What `DELETE /v1/agents/:id` may delete: an agent inside the sandbox whose id no other directory\n * declares. The same two refusals `remove` makes — a path outside the sandbox is somebody's project,\n * and a shared id shares one store, so deleting it would take the other agent's history too.\n */\nexport function sandboxRemover(env: Readonly<Record<string, string | undefined>>): AgentRemover {\n return {\n locate(agentId) {\n const matches = listAgents(env).filter((agent) => agent.id === agentId)\n const first = matches[0]\n if (first === undefined) {\n return {\n ok: false,\n status: 404,\n error: {\n code: \"agent_remove_not_in_sandbox\",\n message: `No agent \"${agentId}\" in the sandbox, so there are no files here to delete.`,\n hint: \"Only sandbox agents are deleted over the API. An agent elsewhere is removed by deleting its directory yourself.\",\n },\n }\n }\n if (matches.length > 1) {\n return {\n ok: false,\n status: 409,\n error: {\n code: \"agent_remove_shared_id\",\n message: `${matches.length} sandbox directories declare id \"${agentId}\": ${matches.map((agent) => agent.dir).join(\", \")}.`,\n hint: \"They share one conversation history, so deleting either would delete the other's too. Give one a different id first.\",\n },\n }\n }\n return { ok: true, dir: first.dir }\n },\n async deleteDir(dir) {\n if (!insideSandbox(dir, env)) {\n throw new Error(`refusing to delete ${dir}: it is outside the sandbox`)\n }\n rmSync(dir, { recursive: true, force: true })\n },\n }\n}\n",
|
|
35
35
|
"/**\n * An agent's credentials, set over the API: which ones it reads, and writing them.\n *\n * **The variable is resolved from the manifest, never taken on trust from the caller.** A route that\n * wrote whatever name it was sent would write any variable at all, the one this host authenticates\n * with included. The set a caller may write is exactly the set the agent's own manifest reads, as\n * `${VAR}` or through an `*Env` field. That rule is `ChannelAdmin.setCredential`'s, generalised\n * from one channel to the whole manifest.\n *\n * **Minus the server's own token.** `server.tokenEnv` authenticates callers of the agent's API, and a\n * caller able to set it could replace the credential it is checked against.\n *\n * Values are write-only. `secretStatus` says whether each is set, never what it is.\n */\n\nimport { readFileSync } from \"node:fs\"\nimport { HarnessError, manifestEnvReferences } from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { applySecret } from \"#lib/config-apply\"\nimport { agentEnv, isSet } from \"#lib/config-env\"\n\n/** The dotted path excluded by meaning rather than by name. See the module comment. */\nconst SERVER_TOKEN_PATH = \"server.tokenEnv\"\n\nexport interface SecretStatus {\n readonly name: string\n /** Whether the agent will see a non-empty value: its `.env` layered under the real environment. */\n readonly set: boolean\n /** The fields that read it, so a caller can tell `MODEL_API_KEY` for the model from one for a tool. */\n readonly usedBy: readonly string[]\n}\n\n/** Every variable this agent's manifest reads that a caller may set, in first-use order. */\nexport function secretStatus(manifestPath: string): readonly SecretStatus[] {\n const text = readFileSync(manifestPath, \"utf8\")\n const env = agentEnv(manifestPath)\n const byName = new Map<string, string[]>()\n const serverToken = new Set(\n manifestEnvReferences(text)\n .filter((ref) => ref.path === SERVER_TOKEN_PATH)\n .map((ref) => ref.name),\n )\n for (const ref of manifestEnvReferences(text)) {\n if (serverToken.has(ref.name)) continue\n const uses = byName.get(ref.name) ?? []\n uses.push(ref.path)\n byName.set(ref.name, uses)\n }\n return [...byName].map(([name, usedBy]) => ({ name, set: isSet(env, name), usedBy }))\n}\n\nexport interface SecretsWritten {\n readonly written: readonly string[]\n /**\n * Written, and not what the agent will see, because the real environment sets the same variable\n * and wins. Precedence is core's and deliberate (an operator's export must beat a file for a\n * container to configure its own agents), so the route reports it rather than overriding it.\n */\n readonly shadowed: readonly string[]\n}\n\n/**\n * Write values into the `.env` beside the manifest, at 0600. All or nothing: every name is checked\n * before anything is written, so a request naming one wrong variable changes no file.\n */\nexport function writeSecrets(\n manifestPath: string,\n values: Readonly<Record<string, string>>,\n): SecretsWritten {\n const allowed = secretStatus(manifestPath).map((entry) => entry.name)\n for (const [name, value] of Object.entries(values)) {\n if (!allowed.includes(name)) {\n throw new HarnessError({\n code: \"secret_not_referenced\",\n message: `\"${name}\" is not a variable this agent's manifest reads.`,\n hint:\n allowed.length === 0\n ? \"This agent's manifest reads no variables a caller may set.\"\n : `It reads ${allowed.join(\", \")}. A variable is settable when the manifest names it, as \\${NAME} or through an *Env field; the server's own token never is. GET /v1/agents/:id/secrets lists them.`,\n field: `values.${name}`,\n })\n }\n if (value === \"\") {\n throw new HarnessError({\n code: \"secret_value_empty\",\n message: `An empty value for ${name} would not start the agent.`,\n hint: \"A variable set to nothing fails the load exactly as a missing one does. Nothing was written.\",\n field: `values.${name}`,\n })\n }\n }\n const ambient = ambientEnv([manifestPath])\n const written: string[] = []\n const shadowed: string[] = []\n for (const [name, value] of Object.entries(values)) {\n applySecret(manifestPath, name, value)\n written.push(name)\n if (isSet(ambient, name)) shadowed.push(name)\n }\n return { written, shadowed }\n}\n",
|
|
36
36
|
"/**\n * Agent templates on disk: listing them, and creating an agent from one.\n *\n * The rendering rules are core's (`manifest/template.ts`, which is pure and has the YAML parser this\n * package deliberately does not). This module is the filesystem half, and it holds the one promise\n * the route makes: **a request that fails leaves nothing behind, and a request that succeeds leaves\n * an agent `run` would load.**\n *\n * So an agent is rendered into memory, written to a staging directory *outside* the agents\n * directory, loaded there by the same check `init` runs, and only then renamed into place. The\n * staging directory is a sibling rather than a dot-directory inside `agents/`, because `listAgents`\n * reads any directory with an `agent.yaml` as an agent. A concurrent listing would otherwise see a\n * half-validated one under a real id.\n *\n * Templates are written by the operator (baked into an image, mounted, copied onto a volume) and\n * never uploaded through the API. A template decides what every agent made from it can do, so\n * authoring one is the operator's act, the same line that keeps the agent's directory off the wire.\n */\n\nimport { createHash } from \"node:crypto\"\nimport {\n existsSync,\n lstatSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\"\nimport { basename, dirname, join } from \"node:path\"\nimport {\n HarnessError,\n isHarnessError,\n manifestEnvReferences,\n parseTemplateSpec,\n parseWorkspaceFile,\n renderTemplate,\n type TemplateFile,\n type TemplateSpec,\n} from \"@dispach/core\"\nimport { applySecret } from \"#lib/config-apply\"\nimport { slugify } from \"#lib/init-flow\"\nimport { checkAgentLoads, type ProvisionResult, writeAgentFiles } from \"#lib/provision\"\n\nconst SPEC_FILE = \"template.yaml\"\n/** A template name is a directory name and nothing else: no separators, no `..`, no dotfiles. */\nconst TEMPLATE_NAME = /^[a-z0-9][a-z0-9-]*$/\n\n/** One template, as a client picking one needs to see it. Never a value, and never a secret's. */\nexport interface TemplateSummary {\n readonly name: string\n readonly description?: string\n readonly vars: readonly {\n readonly name: string\n readonly description?: string\n readonly required: boolean\n readonly default?: string\n /** A secret is written to the agent's `.env` and never returned. */\n readonly secret: boolean\n }[]\n /**\n * Why this template cannot be used, when it cannot.\n *\n * Listed rather than hidden, for the reason `listAgents` shows a broken directory: an operator\n * who put a template in place and cannot see it has no way to learn it has a typo.\n */\n readonly problem?: { readonly code: string; readonly message: string; readonly hint: string }\n}\n\nexport function listTemplates(dir: string): readonly TemplateSummary[] {\n let entries: string[]\n try {\n entries = readdirSync(dir)\n } catch {\n // No templates directory is the normal state for a sandbox that has none.\n return []\n }\n const out: TemplateSummary[] = []\n for (const name of entries.sort()) {\n if (!TEMPLATE_NAME.test(name)) continue\n const root = join(dir, name)\n if (!lstatSync(root).isDirectory()) continue\n try {\n const spec = readSpec(root)\n out.push({\n name,\n ...(spec.description === undefined ? {} : { description: spec.description }),\n vars: spec.vars.map((entry) => ({\n name: entry.name,\n ...(entry.description === undefined ? {} : { description: entry.description }),\n required: entry.required,\n ...(entry.default === undefined ? {} : { default: entry.default }),\n secret: entry.secret !== undefined,\n })),\n })\n } catch (error) {\n if (!isHarnessError(error)) throw error\n out.push({\n name,\n vars: [],\n problem: { code: error.code, message: error.message, hint: error.hint },\n })\n }\n }\n return out\n}\n\nfunction readSpec(root: string): TemplateSpec {\n const path = join(root, SPEC_FILE)\n if (!existsSync(path)) {\n throw new HarnessError({\n code: \"template_spec_missing\",\n message: `${basename(root)} has no ${SPEC_FILE}.`,\n hint: `A template is an agent directory with a ${SPEC_FILE} beside agent.yaml declaring its variables. An empty one (\\`vars: {}\\`) is valid.`,\n })\n }\n return parseTemplateSpec(readFileSync(path, \"utf8\"), `${basename(root)}/${SPEC_FILE}`)\n}\n\n/**\n * Every file under a template, except its spec.\n *\n * **Symlinks are refused, not followed.** A template is copied into a new agent, and a symlink in one\n * is a way to copy whatever it points at, the host's own files included, into a directory an agent\n * reads. Binary files are refused too, because the renderer is a text substitution and a byte it\n * cannot represent would be silently corrupted.\n * ponytail: text-only templates. Copy binaries verbatim when a template needs an image.\n */\nfunction readTemplateFiles(root: string, rel = \"\"): TemplateFile[] {\n const out: TemplateFile[] = []\n for (const entry of readdirSync(join(root, rel)).sort()) {\n const relPath = rel === \"\" ? entry : `${rel}/${entry}`\n if (relPath === SPEC_FILE) continue\n const full = join(root, relPath)\n const stat = lstatSync(full)\n if (stat.isSymbolicLink()) {\n throw new HarnessError({\n code: \"template_symlink\",\n message: `${relPath} in the template is a symbolic link.`,\n hint: \"A template is copied into every agent made from it, and a link would copy whatever it points at. Replace it with the file itself.\",\n field: relPath,\n })\n }\n if (stat.isDirectory()) {\n out.push(...readTemplateFiles(root, relPath))\n continue\n }\n const bytes = readFileSync(full)\n if (bytes.includes(0)) {\n throw new HarnessError({\n code: \"template_binary_file\",\n message: `${relPath} in the template is not a text file.`,\n hint: \"Templates are rendered by text substitution, which would corrupt a binary file. Leave it out of the template and add it to the agent afterwards.\",\n field: relPath,\n })\n }\n out.push({ relPath, contents: bytes.toString(\"utf8\") })\n }\n return out\n}\n\nexport interface TemplateRequest {\n readonly templatesDir: string\n /** The sandbox's agents directory. Injected, never computed here, so a test can redirect it. */\n readonly agentDirBase: string\n readonly template: string\n readonly name: string\n readonly vars: Readonly<Record<string, string>>\n}\n\nexport function provisionFromTemplate(input: TemplateRequest): ProvisionResult {\n if (!TEMPLATE_NAME.test(input.template)) {\n throw templateUnknown(input.template, input.templatesDir)\n }\n const root = join(input.templatesDir, input.template)\n if (!existsSync(root) || !lstatSync(root).isDirectory()) {\n throw templateUnknown(input.template, input.templatesDir)\n }\n\n const name = input.name.trim()\n if (name === \"\") {\n throw new HarnessError({\n code: \"provision_name_required\",\n message: \"An agent made from a template needs a name.\",\n hint: 'Send { \"template\": \"…\", \"name\": \"Acme store\", \"vars\": {…} }. The id every route keys on is derived from the name, and a template can use it as {{agent.name}} and {{agent.id}}.',\n field: \"name\",\n })\n }\n const id = slugify(name)\n const targetDir = join(input.agentDirBase, id)\n if (existsSync(targetDir)) {\n throw new HarnessError({\n code: \"provision_agent_exists\",\n message: `An agent directory named \"${id}\" already exists.`,\n hint: \"The id is derived from the name, so pick a different name. Nothing is overwritten: replacing an agent's workspace is exactly the loss provisioning exists to prevent.\",\n field: \"name\",\n })\n }\n\n const rendered = renderTemplate({\n spec: readSpec(root),\n files: readTemplateFiles(root),\n id,\n name,\n vars: input.vars,\n })\n\n const staging = join(\n dirname(input.agentDirBase),\n `.${basename(input.agentDirBase)}-staging`,\n `${id}-${crypto.randomUUID().slice(0, 8)}`,\n )\n mkdirSync(staging, { recursive: true })\n try {\n writeAgentFiles(staging, rendered.files)\n writeProvenance(staging, {\n template: input.template,\n name,\n vars: plainVars(readSpec(root), input.vars),\n files: hashes(rendered.files),\n })\n const manifestPath = join(staging, \"agent.yaml\")\n for (const [variable, value] of Object.entries(rendered.env)) {\n applySecret(manifestPath, variable, value)\n }\n // Every variable the manifest reads and nothing supplied is stubbed for this check only: an\n // agent may be created before its key exists, which is what the secrets route is for. What\n // the check proves is structure (schema, budgets, tiers, rules), not credentials. One the\n // server's own environment sets is left alone: stubbing it laid \"(pending)\" over a real\n // `MODEL_BASE_URL` and refused a template whose agent would have loaded.\n const manifest = rendered.files.find((file) => file.relPath === \"agent.yaml\")\n const overlay: Record<string, string> = {}\n for (const ref of manifestEnvReferences(manifest?.contents ?? \"\")) {\n if (rendered.env[ref.name] === undefined && !process.env[ref.name])\n overlay[ref.name] = \"(pending)\"\n }\n checkAgentLoads(manifestPath, overlay)\n\n mkdirSync(input.agentDirBase, { recursive: true })\n renameSync(staging, targetDir)\n } catch (error) {\n rmSync(staging, { recursive: true, force: true })\n throw error\n }\n\n return {\n agentId: id,\n dir: targetDir,\n manifestPath: join(targetDir, \"agent.yaml\"),\n files: [\n ...rendered.files.map((file) => file.relPath),\n ...(Object.keys(rendered.env).length > 0 ? [\".env\"] : []),\n ],\n }\n}\n\nfunction templateUnknown(name: string, dir: string): HarnessError {\n const known = listTemplates(dir).map((entry) => entry.name)\n return new HarnessError({\n code: \"template_not_found\",\n message: `No template called ${JSON.stringify(name)}.`,\n hint:\n known.length === 0\n ? `This server has no templates. An operator adds one as a directory under ${dir}.`\n : `Templates here: ${known.join(\", \")}. GET /v1/templates lists them with their variables.`,\n field: \"template\",\n })\n}\n\n// ─── Re-rendering an agent's template files (pilot.5) ─────────────────────────\n\n/**\n * What the agent was made from, beside its manifest: the template, the plain vars, and a hash of\n * every file as it was rendered. The hash is what tells a file nobody touched from one somebody (the\n * person, the agent, a `PATCH /config`) edited since, and only the first kind is re-rendered.\n * Secret vars are never in it; they live in `.env`.\n */\nconst PROVENANCE_FILE = \".template.json\"\n\ninterface Provenance {\n readonly version: 1\n readonly template: string\n readonly name: string\n readonly vars: Readonly<Record<string, string>>\n readonly files: Readonly<Record<string, string>>\n}\n\nfunction hashOf(contents: string): string {\n return createHash(\"sha256\").update(contents).digest(\"hex\")\n}\n\nfunction hashes(files: readonly TemplateFile[]): Record<string, string> {\n return Object.fromEntries(files.map((file) => [file.relPath, hashOf(file.contents)]))\n}\n\nfunction plainVars(\n spec: TemplateSpec,\n vars: Readonly<Record<string, string>>,\n): Record<string, string> {\n const secret = new Set(\n spec.vars.filter((entry) => entry.secret !== undefined).map((e) => e.name),\n )\n return Object.fromEntries(Object.entries(vars).filter(([name]) => !secret.has(name)))\n}\n\nfunction writeProvenance(dir: string, provenance: Omit<Provenance, \"version\">): void {\n writeFileSync(\n join(dir, PROVENANCE_FILE),\n `${JSON.stringify({ version: 1, ...provenance }, null, 2)}\\n`,\n { mode: 0o600 },\n )\n}\n\n/** The template an agent was made from and its plain vars; undefined with no record. */\nexport function templateRecordOf(\n agentDir: string,\n): { readonly template: string; readonly vars: Readonly<Record<string, string>> } | undefined {\n const recordPath = join(agentDir, PROVENANCE_FILE)\n if (!existsSync(recordPath)) return undefined\n const record = JSON.parse(readFileSync(recordPath, \"utf8\")) as Provenance\n return { template: record.template, vars: record.vars }\n}\n\nexport interface RerenderResult {\n readonly rendered: readonly string[]\n readonly skipped: readonly {\n readonly file: string\n readonly reason: \"edited\" | \"memory\" | \"removed\"\n }[]\n /** Put every rewritten file back, for when the agent then refuses to load. */\n readonly undo: () => void\n}\n\n/**\n * Apply changed vars to an agent made from a template: re-render, and rewrite only the files that are\n * exactly as the template last rendered them.\n *\n * Three things are never rewritten. A file whose contents moved since it was rendered (`edited`),\n * because somebody chose those words. A file that is the agent's memory (`memory`): `MEMORY.md`, and\n * any file declaring `eviction: oldest`, which is how a workspace names its `memory_write` target. And\n * a file that is gone (`removed`), since deleting it was a choice too. `USER.md` is none of those\n * unless edited, so it is re-rendered: typically where the person's name and role live.\n */\nexport function rerenderFromTemplate(input: {\n readonly templatesDir: string\n readonly agentDir: string\n readonly vars: Readonly<Record<string, string>>\n}): RerenderResult {\n const recordPath = join(input.agentDir, PROVENANCE_FILE)\n if (!existsSync(recordPath)) {\n throw new HarnessError({\n code: \"agent_not_from_template\",\n message: \"This agent has no record of the template it was made from.\",\n hint: \"Only an agent created with POST /v1/agents {template} on 0.2.0 or later carries one, because re-rendering needs the hash of every file as it was rendered. For an older agent, edit the files directly or create it again from the template.\",\n })\n }\n const record = JSON.parse(readFileSync(recordPath, \"utf8\")) as Provenance\n const root = join(input.templatesDir, record.template)\n if (!existsSync(root)) throw templateUnknown(record.template, input.templatesDir)\n const spec = readSpec(root)\n\n for (const name of Object.keys(input.vars)) {\n const declared = spec.vars.find((entry) => entry.name === name)\n if (declared?.secret !== undefined) {\n throw new HarnessError({\n code: \"template_var_secret\",\n message: `\"${name}\" is a secret, and a secret is never rendered into a file.`,\n hint: `Set it with PUT /v1/agents/:id/secrets as ${declared.secret}.`,\n field: `vars.${name}`,\n })\n }\n }\n\n const vars = { ...record.vars, ...input.vars }\n const rendered = renderTemplate({\n spec,\n files: readTemplateFiles(root),\n id: basename(input.agentDir),\n name: record.name,\n // Secrets were never recorded, so a required secret var counts as present here: it was\n // checked when the agent was created and it lives in `.env`, not in any file.\n vars: {\n ...Object.fromEntries(\n spec.vars\n .filter((entry) => entry.secret !== undefined && entry.required)\n .map((entry) => [entry.name, \"(in .env)\"]),\n ),\n ...vars,\n },\n })\n\n // `before` is undefined for a file this call created, so undoing removes it.\n const written: { readonly path: string; readonly before: string | undefined }[] = []\n const out: string[] = []\n const skipped: { file: string; reason: \"edited\" | \"memory\" | \"removed\" }[] = []\n const nextHashes: Record<string, string> = { ...record.files }\n try {\n for (const file of rendered.files) {\n const path = join(input.agentDir, file.relPath)\n const recorded = record.files[file.relPath]\n if (!existsSync(path)) {\n if (recorded !== undefined) {\n skipped.push({ file: file.relPath, reason: \"removed\" })\n continue\n }\n // New in the template since the agent was made: nothing to overwrite.\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, file.contents)\n written.push({ path, before: undefined })\n nextHashes[file.relPath] = hashOf(file.contents)\n out.push(file.relPath)\n continue\n }\n const current = readFileSync(path, \"utf8\")\n if (isMemory(file.relPath, current)) {\n skipped.push({ file: file.relPath, reason: \"memory\" })\n continue\n }\n if (recorded === undefined || hashOf(current) !== recorded) {\n skipped.push({ file: file.relPath, reason: \"edited\" })\n continue\n }\n if (current === file.contents) continue\n writeFileSync(path, file.contents)\n written.push({ path, before: current })\n nextHashes[file.relPath] = hashOf(file.contents)\n out.push(file.relPath)\n }\n writeProvenance(input.agentDir, {\n template: record.template,\n name: record.name,\n vars: plainVars(spec, vars),\n files: nextHashes,\n })\n } catch (error) {\n restore(written)\n throw error\n }\n\n return {\n rendered: out,\n skipped,\n undo: () => {\n restore(written)\n // The record goes back too, or the next re-render compares against hashes of files that\n // were just put back.\n writeFileSync(recordPath, `${JSON.stringify(record, null, 2)}\\n`, { mode: 0o600 })\n },\n }\n}\n\nfunction restore(\n written: readonly { readonly path: string; readonly before: string | undefined }[],\n): void {\n for (const entry of written) {\n if (entry.before === undefined) rmSync(entry.path, { force: true })\n else writeFileSync(entry.path, entry.before)\n }\n}\n\nfunction isMemory(relPath: string, contents: string): boolean {\n if (basename(relPath) === \"MEMORY.md\") return true\n if (!relPath.endsWith(\".md\")) return false\n try {\n return parseWorkspaceFile(relPath, contents).frontmatter.eviction === \"oldest\"\n } catch {\n return false\n }\n}\n",
|
|
37
37
|
"/**\n * The runtime's side of the control plane's peer-ask relay (decision 15.10,\n * `docs/24-SPEC-PEER-ASK.md`). Built by `serve` only when the control plane put a relay URL and token\n * in this silo's environment; a self-hosted install has neither, and nothing about it changes.\n *\n * The peer list is cached in one file beside the store, keyed by agent id, because an agent is built\n * before readiness and may not touch the network then (hard rule 4): it boots from the saved list and\n * the runtime refreshes it afterwards.\n */\n\nimport { readFileSync, renameSync, writeFileSync } from \"node:fs\"\nimport type { RelayClient, RemotePeer } from \"@dispach/core\"\n\ntype Cache = Record<string, readonly RemotePeer[]>\n\nfunction readCache(file: string): Cache {\n try {\n const parsed: unknown = JSON.parse(readFileSync(file, \"utf8\"))\n return typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)\n ? (parsed as Cache)\n : {}\n } catch {\n // Missing on a first boot, and a broken file is a list to fetch again: either way, no peers\n // until the refresh after readiness.\n return {}\n }\n}\n\n/** The control plane's refusal, said as an error a person can act on. */\nasync function refusal(response: Response, what: string): Promise<Error> {\n const body = (await response.json().catch(() => ({}))) as {\n error?: { code?: string; message?: string; hint?: string }\n }\n const detail = body.error\n return new Error(\n detail?.message === undefined\n ? `the control plane answered ${response.status} to ${what}`\n : `${detail.message}${detail.hint === undefined ? \"\" : ` ${detail.hint}`}`,\n )\n}\n\nexport function relayClient(init: {\n readonly url: string\n readonly token: string\n readonly cacheFile: string\n readonly fetch?: typeof fetch\n}): RelayClient {\n const doFetch = init.fetch ?? globalThis.fetch\n const base = init.url.replace(/\\/+$/, \"\")\n const headers = { authorization: `Bearer ${init.token}` }\n const cache = readCache(init.cacheFile)\n\n return {\n cachedPeers: (agentId) => cache[agentId] ?? [],\n\n async refreshPeers(agentId, participantId) {\n const response = await doFetch(\n `${base}/v1/relay/peers?participant=${encodeURIComponent(participantId)}`,\n { headers },\n )\n if (!response.ok) throw await refusal(response, \"the peer list\")\n const { peers } = (await response.json()) as { peers: readonly RemotePeer[] }\n cache[agentId] = peers\n // Written whole and renamed into place, so a crash mid-write leaves the previous list.\n const partial = `${init.cacheFile}.partial`\n writeFileSync(partial, `${JSON.stringify(cache, null, 2)}\\n`, { mode: 0o600 })\n renameSync(partial, init.cacheFile)\n return peers\n },\n\n async ask(request) {\n const response = await doFetch(`${base}/v1/relay/ask`, {\n method: \"POST\",\n headers: { ...headers, \"content-type\": \"application/json\" },\n body: JSON.stringify({\n participant: request.participantId,\n toSilo: request.silo,\n toAgent: request.agent,\n question: request.question,\n askedBy: request.fromAgent,\n sessionKey: request.sessionKey,\n }),\n ...(request.signal === undefined ? {} : { signal: request.signal }),\n })\n if (!response.ok) {\n const body = (await response.json().catch(() => ({}))) as {\n error?: { code: string; message: string; hint: string }\n }\n return {\n text: \"\",\n reason: \"error\",\n steps: 0,\n tokens: { prompt: 0, output: 0 },\n error: body.error ?? {\n code: \"relay_unavailable\",\n message: `The control plane answered ${response.status}.`,\n hint: \"Check the control plane is reachable from this silo.\",\n },\n }\n }\n return (await response.json()) as Awaited<ReturnType<RelayClient[\"ask\"]>>\n },\n }\n}\n",
|
|
38
|
+
"/**\n * The event-loop watchdog for `serve` (0.2.6).\n *\n * A turn that blocks the event loop (a runaway regex, a synchronous read of something huge, a busy\n * loop in a plugin) freezes the whole server: every agent, every channel, `/v1/ready`. Nothing inside\n * the loop can notice, because noticing needs the loop. So the main thread stamps a shared clock once\n * a second, and a worker thread, which keeps running, kills the process when the stamp is older than\n * `<PREFIX>LOOP_STALL_S` (default 60). The supervisor (Docker's restart policy, launchd, systemd)\n * starts it again; the outbox and the interrupted-turn sweep are what make that restart safe.\n *\n * SIGKILL, because SIGTERM is answered on the frozen loop. The line before it is written with\n * `fs.writeSync` from the worker: a worker's `process.stderr` is relayed through the main thread and\n * would never arrive. Node's `--report-on-signal` was measured and dropped for the same reason: its\n * handler runs on the main loop, so a stalled process never writes the report.\n */\n\nimport { Worker } from \"node:worker_threads\"\nimport { BRAND, HarnessError } from \"@dispach/core\"\n\nconst DEFAULT_STALL_S = 60\n\n/** Seconds of stall before the kill; 0 switches the watchdog off. Refused at start when malformed. */\nexport function loopStallFrom(env: Readonly<Record<string, string | undefined>>): number {\n const name = `${BRAND.envPrefix}LOOP_STALL_S`\n const raw = env[name]\n if (raw === undefined || raw === \"\") return DEFAULT_STALL_S\n if (!/^\\d+$/.test(raw)) {\n throw new HarnessError({\n code: \"serve_loop_stall_invalid\",\n message: `${name} is \"${raw}\", which is not a whole number of seconds.`,\n hint: `Set it to the seconds a frozen server may stay frozen before it is killed and restarted (default ${DEFAULT_STALL_S}), or 0 to switch the watchdog off.`,\n field: name,\n })\n }\n return Number(raw)\n}\n\n/** CommonJS, because an `eval` worker is a script in Node; Bun accepts it as well. */\nconst WORKER = `\nconst { workerData } = require(\"node:worker_threads\")\nconst { writeSync } = require(\"node:fs\")\nconst beat = new Float64Array(workerData.beat)\nsetInterval(() => {\n const stalled = Date.now() - beat[0]\n if (stalled < workerData.limitMs) return\n try {\n writeSync(2, workerData.prefix + \"event loop stalled for \" + Math.round(stalled / 1000) + \"s; killing the process so its supervisor restarts it\\\\n\")\n } finally {\n process.kill(workerData.pid, \"SIGKILL\")\n }\n}, 1000)\n`\n\n/** Start watching; the returned function stops it. Never keeps the process alive on its own. */\nexport function startLoopWatchdog(stallS: number, prefix = `${BRAND.slug}: `): () => void {\n if (stallS <= 0) return () => {}\n const beat = new Float64Array(new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT))\n beat[0] = Date.now()\n const tick = setInterval(() => {\n beat[0] = Date.now()\n }, 1000)\n tick.unref()\n const worker = new Worker(WORKER, {\n eval: true,\n workerData: { beat: beat.buffer, limitMs: stallS * 1000, pid: process.pid, prefix },\n })\n worker.unref()\n return () => {\n clearInterval(tick)\n void worker.terminate()\n }\n}\n",
|
|
38
39
|
"/**\n * The `sessions` command — inspect what the store holds.\n *\n * This exists to make persistence observable from outside the process that wrote it. A store you\n * cannot look into is a store you cannot debug, and \"the history is in there somewhere\" is not a\n * claim anyone should have to take on faith.\n *\n * It opens the same database the chat session uses, which is safe while a turn is running: the driver\n * puts the file in WAL mode, so a reader does not block a writer.\n */\n\nimport { type Agent, Runtime, type SessionSummary } from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { DEFAULT_ROW_LIMIT, EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { onExit } from \"#lib/exit\"\nimport {\n BUILT_IN_PLUGINS,\n CHANNELS,\n MEDIA_PROVIDERS,\n MODEL_TRANSPORTS,\n scriptRunner,\n TOOL_PROVIDERS,\n} from \"#lib/providers\"\nimport { ago } from \"#lib/render\"\nimport { pluginRoot, storePath } from \"#lib/sandbox\"\nimport type { SessionsOptions } from \"#lib/schema\"\n\nfunction pad(value: string, width: number): string {\n return value.length >= width ? value : value + \" \".repeat(width - value.length)\n}\n\n/**\n * Collapse a schedule's per-run sessions into one row.\n *\n * An isolated scheduled run gets a fresh session every time — `schedule:<id>:<runId>` — which is\n * what keeps a daily brief from accumulating history it was never asked to carry, and what makes\n * \"what did last Tuesday's brief say\" a question with an answer. The cost lands here: a 15-minute\n * schedule writes about 35,000 sessions a year, and unfolded they bury every conversation a person\n * actually had.\n *\n * Folded by the schedule id, newest run's activity shown, with the count beside it. The individual\n * keys are still addressable — `--session schedule:brief:r_…` reads one — so nothing is hidden,\n * only summarized.\n */\ninterface ListRow {\n readonly sessionKey: string\n readonly phase: string | undefined\n messages: number\n turns: number\n lastActivityAt: string\n runs?: number\n}\n\nfunction foldScheduleRuns(sessions: readonly SessionSummary[]): readonly ListRow[] {\n const folded = new Map<string, ListRow>()\n const out: ListRow[] = []\n\n for (const session of sessions) {\n const parts = session.sessionKey.split(\":\")\n // Exactly three segments, the first `schedule`: anything else is somebody's own key and is\n // left alone. A two-segment `schedule:brief` is a shared-session schedule and is a real\n // single conversation, not a run.\n const row: ListRow = {\n sessionKey: session.sessionKey,\n phase: session.phase,\n messages: session.messages,\n turns: session.turns,\n lastActivityAt: session.lastActivityAt,\n }\n\n if (parts.length !== 3 || parts[0] !== \"schedule\") {\n out.push(row)\n continue\n }\n\n const id = `schedule:${parts[1]}`\n const seen = folded.get(id)\n if (seen === undefined) {\n const entry: ListRow = { ...row, sessionKey: `${id}:*`, runs: 1 }\n folded.set(id, entry)\n out.push(entry)\n continue\n }\n seen.runs = (seen.runs ?? 1) + 1\n seen.messages += session.messages\n seen.turns += session.turns\n // The listing sorts by activity, so the fold keeps the most recent of the group.\n if (session.lastActivityAt > seen.lastActivityAt) {\n seen.lastActivityAt = session.lastActivityAt\n }\n }\n\n return out\n}\n\nfunction printList(sessions: readonly SessionSummary[]): void {\n if (sessions.length === 0) {\n // Exit 0: an agent with no conversations yet is a correct answer to the question asked, not\n // a failure. The line says so rather than printing nothing.\n process.stdout.write(\"no sessions yet\\n\")\n return\n }\n\n const rows = foldScheduleRuns(sessions)\n const keyWidth = Math.max(7, ...rows.map((s) => s.sessionKey.length))\n process.stdout.write(\n `${pad(\"SESSION\", keyWidth)} ${pad(\"MSGS\", 5)} ${pad(\"TURNS\", 5)} ${pad(\"PHASE\", 8)} LAST\\n`,\n )\n for (const session of rows) {\n const runs =\n session.runs === undefined\n ? \"\"\n : ` (${session.runs} run${session.runs === 1 ? \"\" : \"s\"})`\n process.stdout.write(\n `${pad(session.sessionKey, keyWidth)} ${pad(String(session.messages), 5)} ` +\n `${pad(String(session.turns), 5)} ${pad(session.phase ?? \"-\", 8)} ${ago(session.lastActivityAt, Date.now())}${runs}\\n`,\n )\n }\n}\n\nasync function printMessages(agent: Agent, sessionKey: string, limit: number): Promise<void> {\n const page = await agent.store.messages.page(agent.id, sessionKey, { limit })\n if (page.messages.length === 0) {\n process.stdout.write(`no messages in ${sessionKey}\\n`)\n return\n }\n // Oldest-first for reading, though the page came back newest-first for the cursor.\n for (const message of [...page.messages].reverse()) {\n process.stdout.write(`${message.role}: ${message.content}\\n`)\n }\n if (page.nextBefore !== undefined) {\n process.stdout.write(\"\\n… older messages exist; raise --limit\\n\")\n }\n}\n\nasync function printTurns(agent: Agent, sessionKey: string, limit: number): Promise<void> {\n const turns = await agent.turns(sessionKey, limit)\n if (turns.length === 0) {\n process.stdout.write(`no turns in ${sessionKey}\\n`)\n return\n }\n process.stdout.write(\n `${pad(\"TURN\", 22)} ${pad(\"STATUS\", 9)} ${pad(\"STEPS\", 5)} ${pad(\"TOKENS\", 13)} ${pad(\"MS\", 6)} SOURCE\\n`,\n )\n for (const turn of turns) {\n process.stdout.write(\n `${pad(turn.turnId, 22)} ${pad(turn.status, 9)} ${pad(String(turn.steps), 5)} ` +\n `${pad(`${turn.promptTokens}/${turn.outputTokens}`, 13)} ` +\n `${pad(String(turn.durationMs ?? \"-\"), 6)} ${turn.source}\\n`,\n )\n if (turn.errorCode !== undefined) {\n process.stdout.write(` ${turn.errorCode}: ${turn.errorMessage}\\n`)\n if (turn.errorHint !== undefined) process.stdout.write(` hint: ${turn.errorHint}\\n`)\n }\n }\n}\n\nexport async function sessionsCommand(options: SessionsOptions): Promise<number> {\n const runtime = await Runtime.create({\n agents: [options.manifestPath],\n // The sandbox store — the same default `run` writes to, or `sessions` inspects nothing.\n store: options.store ?? storePath(),\n toolProviders: TOOL_PROVIDERS,\n modelTransports: MODEL_TRANSPORTS,\n mediaProviders: MEDIA_PROVIDERS,\n builtInPlugins: BUILT_IN_PLUGINS,\n pluginRoot: pluginRoot(),\n scriptRunner: scriptRunner(),\n channels: CHANNELS,\n env: ambientEnv([options.manifestPath]),\n })\n onExit(() => runtime.stop(\"cli-exit\"))\n\n const agent = runtime.list()[0]\n if (agent === undefined) throw new Error(\"The manifest produced no agent.\")\n\n const limit = options.limit ?? DEFAULT_ROW_LIMIT\n\n if (options.clear === true) {\n if (options.sessionKey === undefined) {\n throw new Error(\n \"--clear needs a session. hint: pass --session <key>; there is deliberately no way to clear every session at once.\",\n )\n }\n const before = await agent.store.messages.count(agent.id, options.sessionKey)\n await agent.clearSession(options.sessionKey)\n process.stdout.write(\n `cleared ${options.sessionKey}: ${before} message(s) removed, memory files untouched\\n`,\n )\n return EXIT_OK\n }\n\n if (options.json === true) {\n const payload =\n options.sessionKey === undefined\n ? { store: runtime.store.location, sessions: await agent.sessions() }\n : {\n store: runtime.store.location,\n session: await agent.store.sessions.get(agent.id, options.sessionKey),\n messages: (\n await agent.store.messages.page(agent.id, options.sessionKey, { limit })\n ).messages,\n turns: await agent.turns(options.sessionKey, limit),\n }\n process.stdout.write(`${JSON.stringify(payload, null, 2)}\\n`)\n return EXIT_OK\n }\n\n process.stdout.write(`store: ${runtime.store.location}\\n\\n`)\n\n if (options.sessionKey === undefined) {\n printList(await agent.sessions())\n return EXIT_OK\n }\n\n const session = await agent.store.sessions.get(agent.id, options.sessionKey)\n if (session === undefined) {\n // Exit 1: the user named a session that is not there. Printing \"0 messages\" would answer a\n // question they did not ask and hide the typo.\n process.stderr.write(\n `no session \"${options.sessionKey}\" for agent ${agent.id}\\n` +\n ` hint: run \\`sessions ${options.manifestPath}\\` to list the keys that exist\\n`,\n )\n return EXIT_FAILURE\n }\n\n if (options.turns === true) await printTurns(agent, options.sessionKey, limit)\n else await printMessages(agent, options.sessionKey, limit)\n return EXIT_OK\n}\n",
|
|
39
40
|
"/**\n * `soul distill <file>` — scaffold a hand-edited compact identity from a long-form document.\n *\n * A scaffold, never a summary. The command copies the document's *structure* — its headings, and\n * its `<rules>` blocks verbatim, because rules are exactly what must survive distillation and\n * copying is not summarising — and leaves a placeholder under each heading for the author to fill.\n * Automatic summarisation of an identity document drops exactly the parts that produce voice,\n * which is why `onUnmet: distill` ships a committed file and not a runtime transformation.\n *\n * The placeholders are the `{{NAME}}` form the `workspace` command already warns about, on\n * purpose: an unedited scaffold keeps reporting itself until a person has written every section.\n */\n\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { basename, dirname, join } from \"node:path\"\nimport { HarnessError, parseWorkspaceFile } from \"@dispach/core\"\nimport { EXIT_OK } from \"#lib/const\"\n\nexport interface SoulOptions {\n readonly action: string\n readonly file: string\n readonly out?: string\n}\n\nconst HEADING = /^(#{1,6})\\s+(.*)$/\nconst RULES_OPEN = /^[ \\t]*<rules(?:\\s[^>]*)?>[ \\t]*$/\nconst RULES_CLOSE = /^[ \\t]*<\\/rules>[ \\t]*$/\nconst FENCE = /^\\s*(?:```|~~~)/\n\nexport function soulCommand(options: SoulOptions): number {\n if (options.action !== \"distill\") {\n throw new HarnessError({\n code: \"cli_soul_unknown_action\",\n message: `soul takes the action \"distill\", not \"${options.action}\".`,\n hint: \"Usage: soul distill <file> [--out <path>]. It scaffolds a compact identity file from a long-form document; the scaffold is edited by hand and named in context.soul.distilled.\",\n })\n }\n\n let raw: string\n try {\n raw = readFileSync(options.file, \"utf8\")\n } catch {\n throw new HarnessError({\n code: \"cli_soul_file_missing\",\n message: `${options.file} is not readable.`,\n hint: \"Point soul distill at the long-form identity document named by context.soul.file.\",\n })\n }\n\n const source = basename(options.file)\n const out =\n options.out ?? join(dirname(options.file), `${source.replace(/\\.md$/i, \"\")}.compact.md`)\n\n if (existsSync(out)) {\n throw new HarnessError({\n code: \"cli_soul_out_exists\",\n message: `${out} already exists, and a scaffold must not overwrite a file someone has edited.`,\n hint: \"The compact file is the hand-edited artefact — regenerating it over someone's edits is exactly the loss automatic distillation would cause. Pass --out with a fresh path, or delete the file first if it really is disposable.\",\n })\n }\n\n // The comments below are authoring guidance in the same sense as the workspace templates':\n // the loader strips them before injection, so they are free at runtime.\n const { body } = parseWorkspaceFile(source, raw)\n const scaffold = buildScaffold(source, body)\n\n writeFileSync(out, scaffold, \"utf8\")\n process.stdout.write(\n `wrote ${out}\\n` +\n `\\n` +\n `The scaffold copies ${source}'s headings and its <rules> blocks verbatim, and leaves a\\n` +\n `{{PLACEHOLDER}} under each heading. Now:\\n` +\n ` 1. Fill every placeholder by hand — two or three sentences that must survive, in the\\n` +\n ` document's own voice. The workspace command warns until none are left.\\n` +\n ` 2. Name the file in context.soul.distilled.\\n`,\n )\n return EXIT_OK\n}\n\n/**\n * Structure over prose: headings and rules survive, everything else becomes a named placeholder.\n *\n * Deliberately line-oriented and fence-aware, like the renderer — a heading inside a fence is a\n * demonstration, not a section.\n */\nfunction buildScaffold(source: string, body: string): string {\n const lines: string[] = [\n \"---\",\n \"tier: static\",\n \"---\",\n \"\",\n \"<!--\",\n `Compact identity scaffolded from ${source}. This file is the one small models actually`,\n `run on, so every sentence here is paid for on every turn — keep it to the few that`,\n `produce the voice. The long document stays the source of truth; edit it first, then`,\n `re-derive this by hand. These comments are stripped before injection and cost nothing.`,\n \"-->\",\n \"\",\n ]\n\n let inFence = false\n let inRules = false\n let sections = 0\n let sawHeading = false\n\n for (const line of body.split(\"\\n\")) {\n if (FENCE.test(line)) {\n inFence = !inFence\n if (inRules) lines.push(line)\n continue\n }\n if (inFence) {\n if (inRules) lines.push(line)\n continue\n }\n\n if (RULES_OPEN.test(line)) {\n inRules = true\n lines.push(line)\n continue\n }\n if (inRules) {\n lines.push(line)\n if (RULES_CLOSE.test(line)) {\n inRules = false\n lines.push(\"\")\n }\n continue\n }\n\n const heading = HEADING.exec(line)\n if (heading !== null) {\n sawHeading = true\n sections += 1\n lines.push(line)\n lines.push(\"\")\n lines.push(`{{SECTION_${sections}}}`)\n lines.push(\"\")\n }\n }\n\n if (!sawHeading) {\n lines.push(`{{ESSENCE}}`)\n lines.push(\"\")\n }\n\n return `${lines\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\")\n .trimEnd()}\\n`\n}\n",
|
|
40
41
|
"/**\n * `sources list|add|remove|update|search` — the repositories skills are found in.\n *\n * A separate command from `skills`, and the split is the point: **`skills` acts on one agent and always\n * takes a manifest; `sources` is machine-level and never takes one.** Folding these together would have\n * meant a positional whose meaning changes with the verb — the agent for `list`, a sub-verb for\n * `sources`, a query for `search` — which reads badly in `--help` and parses worse. The boundary also\n * happens to be the one this codebase keeps arriving at: what the agent may do is the agent's, and where\n * things come from is the person's.\n *\n * `search` fetches a source that has never been fetched, and never refreshes one that has. That makes\n * the first search work on a new machine with no setup, which is the whole point of shipping defaults,\n * while keeping \"go and talk to the network again\" an explicit `update`. Both announce what they are\n * doing before they do it, because a command that pauses for nine seconds with no output is\n * indistinguishable from one that has hung — which is exactly the failure this file's git wrapper exists\n * to prevent.\n */\n\nimport {\n bm25Selector,\n HarnessError,\n isHarnessError,\n nearest,\n type ScoredSkill,\n type Skill,\n} from \"@dispach/core\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { bullet, indent, keyValue, section } from \"#lib/render\"\nimport {\n type CatalogueEntry,\n fetchSource,\n type Git,\n isCached,\n readCatalogue,\n readMeta,\n} from \"#lib/source-cache\"\nimport {\n addSource,\n DEFAULT_SOURCES,\n isSourceName,\n loadSources,\n parseSourceUrl,\n registryPath,\n removeSource,\n type SourceSpec,\n} from \"#lib/sources\"\n\nexport const SOURCES_ACTIONS = [\"list\", \"add\", \"remove\", \"update\", \"search\"] as const\n\nexport interface SourcesOptions {\n readonly action: string\n /** Everything after the action: a name, a URL, a query. Meaning is the action's. */\n readonly rest: readonly string[]\n readonly path?: string\n readonly ref?: string\n readonly json?: boolean\n /** Injected by the tests, which never reach a network. */\n readonly git?: Git\n readonly env?: Readonly<Record<string, string | undefined>>\n}\n\n/** How many search hits are printed before the rest are counted. */\nconst TOP = 12\n\nexport async function sourcesCommand(options: SourcesOptions): Promise<number> {\n try {\n switch (options.action) {\n case \"list\":\n return list(options)\n case \"add\":\n return add(options)\n case \"remove\":\n return drop(options)\n case \"update\":\n return await update(options)\n case \"search\":\n return await search(options)\n default:\n // Unreachable through the dispatcher, which checks against the spec's choices.\n throw new HarnessError({\n code: \"sources_action_unknown\",\n message: `${options.action} is not a sources action`,\n hint: `One of: ${SOURCES_ACTIONS.join(\", \")}.`,\n })\n }\n } catch (error) {\n if (isHarnessError(error)) {\n process.stdout.write(`${error.message}\\n\\n ${error.hint}\\n`)\n return EXIT_FAILURE\n }\n throw error\n }\n}\n\nfunction list(options: SourcesOptions): number {\n const sources = loadSources(options.env)\n const rows = sources.map((spec) => {\n const meta = readMeta(spec.name, options.env)\n return {\n ...spec,\n cached: isCached(spec.name, options.env),\n commit: meta.commit,\n fetchedAt: meta.fetchedAt,\n skills: meta.skills,\n }\n })\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify({ registry: registryPath(options.env), sources: rows }, null, 2)}\\n`,\n )\n return EXIT_OK\n }\n\n if (rows.length === 0) {\n process.stdout.write(\n `every built-in source has been removed, and none has been added\\n\\n \\`sources add <name> <url>\\` to add one, or \\`sources add ${DEFAULT_SOURCES[0]?.name ?? \"anthropic\"} ${DEFAULT_SOURCES[0]?.url ?? \"\"}\\` to put a built-in back.\\n`,\n )\n return EXIT_OK\n }\n\n process.stdout.write(section(\"sources\", true))\n for (const row of rows) {\n process.stdout.write(\n `\\n${bullet(`${row.name}${row.builtin === true ? \" (built-in)\" : \"\"}`)}\\n`,\n )\n process.stdout.write(\n indent(\n keyValue([\n { label: \"url\", value: row.url },\n ...(row.path === undefined ? [] : [{ label: \"path\", value: row.path }]),\n ...(row.ref === undefined ? [] : [{ label: \"branch\", value: row.ref }]),\n {\n label: \"cached\",\n value: row.cached\n ? `${row.skills ?? \"?\"} skills at ${row.commit ?? \"?\"}, fetched ${row.fetchedAt ?? \"at an unknown time\"}`\n : \"never fetched — `sources update` or just search, which fetches on demand\",\n },\n ]),\n 4,\n ),\n )\n }\n process.stdout.write(`\\n${section(\"registry\")}\\n${indent(registryPath(options.env))}\\n`)\n return EXIT_OK\n}\n\nfunction add(options: SourcesOptions): number {\n const [first, second] = options.rest\n if (first === undefined) {\n throw new HarnessError({\n code: \"sources_add_incomplete\",\n message: \"sources add needs a repository\",\n hint: \"`sources add <url>` names it after the owner, or `sources add <name> <url>` to choose. A .../tree/<branch>/<subdir> page URL is understood.\",\n })\n }\n\n // `add <url>` and `add <name> <url>` are told apart by which argument looks like a repository,\n // rather than by counting: a one-argument form that guessed wrong would silently register a source\n // called `https:` and fail on the next line.\n const named = second !== undefined\n const rawUrl = named ? (second as string) : first\n const parsed = parseSourceUrl(rawUrl)\n const name = named ? first : derive(parsed.url)\n\n if (!isSourceName(name)) {\n throw new HarnessError({\n code: \"sources_name_invalid\",\n message: `${JSON.stringify(name)} is not usable as a source name`,\n hint: \"Lowercase letters, digits and single hyphens — it becomes a directory in the cache and the prefix in `install <agent> <source>/<skill>`.\",\n })\n }\n\n const existing = loadSources(options.env).find((spec) => spec.name === name)\n if (existing !== undefined && !named) {\n throw new HarnessError({\n code: \"sources_name_taken\",\n message: `${name} is already a source, pointing at ${existing.url}`,\n hint: `Give this one its own name: \\`sources add <name> ${rawUrl}\\`.`,\n })\n }\n\n // A flag beats the URL, so a page URL can be added and then narrowed without retyping it.\n const path = options.path ?? parsed.path\n const ref = options.ref ?? parsed.ref\n const spec: SourceSpec = {\n name,\n url: parsed.url,\n ...(path === undefined ? {} : { path }),\n ...(ref === undefined ? {} : { ref }),\n }\n addSource(spec, options.env)\n\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify({ added: spec }, null, 2)}\\n`)\n return EXIT_OK\n }\n process.stdout.write(\n `${keyValue([\n { label: existing === undefined ? \"added\" : \"replaced\", value: name },\n { label: \"url\", value: spec.url },\n ...(spec.path === undefined\n ? [\n {\n label: \"path\",\n value: \"the whole repository — `--path skills` if the skills live in a subdirectory\",\n },\n ]\n : [{ label: \"path\", value: spec.path }]),\n ...(spec.ref === undefined ? [] : [{ label: \"branch\", value: spec.ref }]),\n ])}\\n`,\n )\n process.stdout.write(\n `${section(\"next\")}\\n${bullet(`sources update ${name}`)}\\n${bullet(\"sources search <what you need>\")}\\n`,\n )\n return EXIT_OK\n}\n\n/**\n * A name for a repository nobody named: its owner.\n *\n * `anthropics/skills` → `anthropics`, `github/awesome-copilot` → `github`. The repository half is the\n * wrong choice — half the candidates on any search are called `skills`, so it collides immediately and\n * carries no information.\n */\nfunction derive(url: string): string {\n const segments = url\n .replace(/\\.git$/, \"\")\n .split(/[:/]/)\n .filter((part) => part.length > 0)\n const owner = segments[segments.length - 2] ?? \"\"\n return owner\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n}\n\nfunction drop(options: SourcesOptions): number {\n const name = options.rest[0]\n if (name === undefined) {\n throw new HarnessError({\n code: \"sources_remove_incomplete\",\n message: \"sources remove needs a name\",\n hint: \"`sources list` shows them.\",\n })\n }\n const known = loadSources(options.env).map((spec) => spec.name)\n if (!removeSource(name, options.env)) {\n const suggestion = nearest(name, known)\n throw new HarnessError({\n code: \"sources_unknown\",\n message: `no source called ${name}`,\n hint:\n suggestion === undefined\n ? `Configured: ${known.join(\", \") || \"none\"}.`\n : `Did you mean ${suggestion}?`,\n })\n }\n const builtin = DEFAULT_SOURCES.some((spec) => spec.name === name)\n process.stdout.write(\n `removed ${name}${builtin ? \" — a built-in, so it stays out until `sources add` puts it back\" : \"\"}\\n`,\n )\n process.stdout.write(\n \"\\n The cached copy is left on disk; nothing already installed into an agent is touched.\\n\",\n )\n return EXIT_OK\n}\n\nasync function update(options: SourcesOptions): Promise<number> {\n const configured = loadSources(options.env)\n const wanted =\n options.rest.length === 0\n ? configured\n : options.rest.map((name) => {\n const found = configured.find((spec) => spec.name === name)\n if (found === undefined) {\n const suggestion = nearest(\n name,\n configured.map((spec) => spec.name),\n )\n throw new HarnessError({\n code: \"sources_unknown\",\n message: `no source called ${name}`,\n hint:\n suggestion === undefined\n ? `Configured: ${configured.map((spec) => spec.name).join(\", \") || \"none\"}.`\n : `Did you mean ${suggestion}?`,\n })\n }\n return found\n })\n\n if (wanted.length === 0) {\n process.stdout.write(\"no sources configured\\n\\n `sources add <url>` to add one.\\n\")\n return EXIT_OK\n }\n\n const done: { name: string; commit: string; skills: number }[] = []\n const failed: { name: string; reason: string }[] = []\n for (const spec of wanted) {\n // Announced before the work, not after: a clone of a large repository takes seconds and silence\n // is how a person decides a command has hung.\n if (options.json !== true) process.stdout.write(`fetching ${spec.name} … `)\n try {\n const result = await fetchSource(spec, {\n ...(options.env === undefined ? {} : { env: options.env }),\n ...(options.git === undefined ? {} : { git: options.git }),\n })\n done.push({ name: spec.name, commit: result.commit, skills: result.skills })\n if (options.json !== true) {\n process.stdout.write(\n `${result.skills} skills at ${result.commit}${result.unfiltered && spec.path !== undefined ? \" (full clone — the server refused a partial one)\" : \"\"}\\n`,\n )\n }\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error)\n failed.push({ name: spec.name, reason })\n if (options.json !== true) process.stdout.write(`failed\\n`)\n if (options.json !== true && isHarnessError(error)) {\n process.stdout.write(`${indent(error.message)}\\n${indent(error.hint, 4)}\\n`)\n }\n }\n }\n\n if (options.json === true) {\n process.stdout.write(`${JSON.stringify({ updated: done, failed }, null, 2)}\\n`)\n }\n // One source failing is not the command failing, but a run where nothing worked exits non-zero —\n // hard rule 8: nothing fails silently and exits 0.\n return done.length === 0 ? EXIT_FAILURE : EXIT_OK\n}\n\n/**\n * Rank every skill in every source against a query, with the same scorer that decides activation.\n *\n * Deliberate reuse rather than convenience: `bm25Selector` is what the runtime will run against the\n * installed skill's own frontmatter on every turn, so what ranks first here is what will actually\n * activate there. A separate search ranking would let a skill look like the obvious answer in the\n * catalogue and never fire once installed, and nothing would report the discrepancy.\n */\nasync function search(options: SourcesOptions): Promise<number> {\n const query = options.rest.join(\" \").trim()\n const configured = loadSources(options.env)\n if (configured.length === 0) {\n process.stdout.write(\"no sources configured\\n\\n `sources add <url>` to add one.\\n\")\n return EXIT_FAILURE\n }\n\n const cold = configured.filter((spec) => !isCached(spec.name, options.env))\n for (const spec of cold) {\n if (options.json !== true)\n process.stdout.write(`fetching ${spec.name} for the first time … `)\n try {\n const result = await fetchSource(spec, {\n ...(options.env === undefined ? {} : { env: options.env }),\n ...(options.git === undefined ? {} : { git: options.git }),\n })\n if (options.json !== true) process.stdout.write(`${result.skills} skills\\n`)\n } catch (error) {\n if (options.json !== true) {\n process.stdout.write(`failed\\n`)\n if (isHarnessError(error)) process.stdout.write(`${indent(error.message)}\\n`)\n }\n }\n }\n\n const entries = configured.flatMap((spec) => readCatalogue(spec, options.env))\n if (entries.length === 0) {\n process.stdout.write(\n \"\\nnothing to search — no source has been fetched successfully\\n\\n `sources update` reports why.\\n\",\n )\n return EXIT_FAILURE\n }\n\n const ranked = query.length === 0 ? entries : rank(query, entries)\n if (ranked.length === 0) {\n process.stdout.write(\n `\\nnothing in ${entries.length} skills across ${configured.length} sources matches ${JSON.stringify(query)}\\n\\n Try the words a skill's own description would use — the ranking is lexical, not semantic. \\`sources search\\` with no query lists everything.\\n`,\n )\n return EXIT_OK\n }\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify(\n {\n query,\n searched: entries.length,\n results: ranked.map((entry) => ({\n source: entry.source,\n skill: entry.skill,\n description: entry.description,\n tokens: entry.tokens,\n scripts: entry.scripts.length,\n repoPath: entry.repoPath,\n ...(entry.problem === undefined ? {} : { problem: entry.problem }),\n })),\n },\n null,\n 2,\n )}\\n`,\n )\n return EXIT_OK\n }\n\n const shown = ranked.slice(0, TOP)\n process.stdout.write(\n `\\n${section(query.length === 0 ? `${entries.length} skills` : `${ranked.length} of ${entries.length} skills match ${JSON.stringify(query)}`, true)}\\n`,\n )\n for (const entry of shown) {\n process.stdout.write(\n `${bullet(`${entry.source}/${entry.skill}`)} ${entry.tokens} tokens${\n entry.scripts.length === 0\n ? \"\"\n : `, ${entry.scripts.length} runnable file${entry.scripts.length === 1 ? \"\" : \"s\"}`\n }${entry.problem === undefined ? \"\" : \" — will not load\"}\\n`,\n )\n const summary = entry.problem ?? entry.description\n process.stdout.write(\n `${indent(summary.length > 160 ? `${summary.slice(0, 157)}…` : summary, 4)}\\n`,\n )\n }\n if (ranked.length > shown.length) {\n process.stdout.write(\n `\\n${indent(`… and ${ranked.length - shown.length} more; narrow the query or use --json`)}\\n`,\n )\n }\n process.stdout.write(\n `\\n${section(\"install\")}\\n${indent(`skills install <agent> ${shown[0]?.source}/${shown[0]?.skill}`)}\\n`,\n )\n return EXIT_OK\n}\n\nfunction rank(query: string, entries: readonly CatalogueEntry[]): readonly CatalogueEntry[] {\n const byKey = new Map<string, CatalogueEntry>()\n const skills: Skill[] = entries.map((entry) => {\n const key = `${entry.source}/${entry.skill}`\n byKey.set(key, entry)\n return {\n // The scorer reads `name` and `description` only, so a source-qualified name is what keeps\n // two sources' `pdf` apart in the result set without changing what is scored.\n name: key,\n dir: entry.dir,\n tokens: entry.tokens,\n scripts: [],\n ignoredScripts: [],\n frontmatter: { name: key, description: entry.description, metadata: {} },\n }\n })\n return bm25Selector(query, skills)\n .filter((scored: ScoredSkill) => scored.score > 0)\n .map((scored) => byKey.get(scored.skill.name))\n .filter((entry): entry is CatalogueEntry => entry !== undefined)\n}\n",
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"/**\n * The `workspace <manifest>` command — the authoring rules, checked.\n *\n * Deliberately a separate command from `validate`. That one answers \"does this load?\", which is a\n * question with a yes or a no; this one answers \"is this written well?\", which is a judgement. They\n * report differently because they are different: a budget bust stops the runtime, and a rule with no\n * stated reason is a note from a careful reader.\n *\n * So every finding here is a warning and the command exits 0 by default. `--strict` is for CI, where\n * \"warnings you have decided to live with\" and \"warnings nobody has read\" look identical and only a\n * non-zero exit tells them apart.\n */\n\nimport {\n checkAuthoring,\n type ErrorDetail,\n isHarnessError,\n loadManifest,\n resolveCapabilities,\n resolveWorkspace,\n ruleBudgetFailure,\n} from \"@dispach/core\"\nimport { ambientEnv } from \"#lib/ambient\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\n\nexport interface WorkspaceOptions {\n readonly manifestPath: string\n readonly json?: boolean\n readonly strict?: boolean\n}\n\nexport function workspaceCommand(options: WorkspaceOptions): number {\n try {\n const loaded = loadManifest(options.manifestPath, {\n // The same environment `run` will use, or this validates a different agent — the\n // failure that rule exists for is a validator that disagrees with the runtime.\n env: ambientEnv([options.manifestPath]),\n })\n const { manifest } = loaded\n const capabilities = resolveCapabilities(\n manifest.model.main.id,\n manifest.model.main.capabilities,\n )\n\n // The same resolution `run` uses, soul gate included — the file the gate selects is a file\n // someone wrote, and its writing deserves the same reading as any other identity file.\n const { workspace, warnings } = resolveWorkspace(loaded, capabilities.promptStyle)\n\n // The authoring checks read the *authored* text, never the rendered form. An author fixes\n // what they wrote, and telling them about a heading the renderer inserted would send them\n // looking for a line that is not in their file.\n const findings: ErrorDetail[] = [\n ...warnings,\n ...checkAuthoring(\n workspace.files.map((file) => ({\n name: file.name,\n authored: file.authored,\n tier: file.tier,\n field: file.field,\n })),\n ),\n ]\n const ruleFailure = ruleBudgetFailure(workspace, manifest.context.rules)\n if (ruleFailure !== undefined) findings.push(ruleFailure.toDetail())\n\n if (options.json === true) {\n process.stdout.write(\n `${JSON.stringify(\n {\n ok: findings.length === 0,\n path: loaded.path,\n promptStyle: capabilities.promptStyle,\n files: workspace.files.map((file) => ({\n name: file.name,\n tier: file.tier,\n editable: file.editable,\n tokens: file.tokens,\n budget: file.budget,\n })),\n tokens: workspace.tokens,\n findings,\n },\n null,\n 2,\n )}\\n`,\n )\n return options.strict === true && findings.length > 0 ? EXIT_FAILURE : EXIT_OK\n }\n\n const style = capabilities.promptStyle\n process.stdout.write(\n `${loaded.path}\\n` +\n ` rendering delimiters=${style.delimiters} intensity=${style.intensity} examplesIn=${style.examplesIn}\\n` +\n ` total ${workspace.tokens.total} tokens (static ${workspace.tokens.static}, volatile ${workspace.tokens.volatile}, reminder ${workspace.tokens.reminder})\\n`,\n )\n\n for (const file of workspace.files) {\n process.stdout.write(\n ` ${file.name.padEnd(14)} ${file.tier.padEnd(9)} ${String(file.tokens).padStart(5)}/${file.budget} tokens, editable=${file.editable}\\n`,\n )\n }\n\n if (findings.length === 0) {\n process.stdout.write(\"\\nno findings\\n\")\n return EXIT_OK\n }\n\n for (const finding of findings) {\n process.stdout.write(`\\n ${finding.code}: ${finding.message}\\n`)\n process.stdout.write(` hint: ${finding.hint}\\n`)\n }\n // Counted rather than merely listed: \"three findings\" is the sentence someone acts on, and\n // scrolling back to count them is how a fourth one goes unnoticed.\n process.stdout.write(`\\n${findings.length} finding(s)\\n`)\n\n return options.strict === true ? EXIT_FAILURE : EXIT_OK\n } catch (error) {\n if (options.json === true && isHarnessError(error)) {\n process.stdout.write(\n `${JSON.stringify({ ok: false, error: error.toDetail(), details: error.details }, null, 2)}\\n`,\n )\n return EXIT_FAILURE\n }\n throw error\n }\n}\n",
|
|
47
48
|
"/**\n * The entry point: parse, dispatch, exit.\n *\n * No shebang here — the build prepends one via `--banner`. Two would be a syntax error, and the\n * source is never executed directly: `bun run src/index.ts` and `node dist/index.js` are the two\n * supported ways in.\n *\n * Three rules hold here and nowhere else.\n *\n * **It imports no Ink and no React.** The rich renderer is reached through a dynamic `import()` in\n * `run.ts`, because loading it costs ~170-210 ms under Node — more than the entire runtime of\n * `validate --json`. A static import anywhere on this path would be paid by every command.\n *\n * **Commands return exit codes; they never call `process.exit`.** Exiting mid-write discards buffered\n * stdout when the output is a pipe, which is how `--json` gets read. This file is the one exception,\n * on the last line, and only after `finish` has drained the output — a command that exits by itself\n * skips the teardowns and the drain both.\n *\n * **Asking for help is a success.** The previous entry point set exit code 1 for `--help` given\n * without a command, reporting failure for the one thing that had worked.\n */\n\nimport { BRAND, HarnessError, isHarnessError, VERSION } from \"@dispach/core\"\nimport { agentsCommand } from \"#agents\"\nimport { browseCommand } from \"#browse\"\nimport { daemonCommand } from \"#daemon\"\nimport { initCommand } from \"#init\"\nimport { keysCommand } from \"#keys\"\nimport { parse } from \"#lib/args\"\nimport { announce, ensureServer } from \"#lib/bootstrap\"\nimport { actionOrRef } from \"#lib/commands\"\nimport { askExactly, askYesNo } from \"#lib/confirm\"\nimport { EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { readEnv } from \"#lib/env\"\nimport { finishNow, installGuards } from \"#lib/exit\"\nimport { helpText } from \"#lib/help\"\nimport { installServerUnit } from \"#lib/host-actions\"\nimport { missingInterface } from \"#lib/interface-missing\"\nimport { resolveAgentRef } from \"#lib/sandbox\"\nimport { loadSecretFiles } from \"#lib/secret-files\"\nimport { quietAcceptedWarnings } from \"#lib/warnings\"\nimport { memoryCommand } from \"#memory\"\nimport { modelCommand } from \"#model\"\nimport { ownerCommand } from \"#owner\"\nimport { pluginsCommand } from \"#plugins\"\nimport { removeCommand } from \"#remove\"\nimport { restartCommand } from \"#restart\"\nimport { runCommand } from \"#run\"\nimport { schedulesCommand } from \"#schedules\"\nimport { serveCommand } from \"#serve\"\nimport { sessionsCommand } from \"#sessions\"\nimport { skillsCommand } from \"#skills\"\nimport { soulCommand } from \"#soul\"\nimport { sourcesCommand } from \"#sources\"\nimport { startCommand } from \"#start\"\nimport { statusCommand } from \"#status\"\nimport { stopCommand } from \"#stop\"\nimport { terminalSetupCommand } from \"#terminal-setup\"\nimport { toolsCommand } from \"#tools\"\nimport { validateCommand } from \"#validate\"\nimport { workspaceCommand } from \"#workspace\"\n\nfunction report(error: unknown): number {\n const missing = missingInterface(error)\n if (missing !== undefined) {\n process.stderr.write(\n `cli_interface_missing: this command draws the terminal UI, and ${missing} is not installed.\\n` +\n ` hint: it is an optional dependency, left out by an install with --omit=optional. Reinstall without it (npm i -g ${BRAND.slug}), or pass --plain where the command has it.\\n`,\n )\n return EXIT_FAILURE\n }\n if (isHarnessError(error)) {\n // `format()` prints the code, the field, the hint, and every sub-failure — so a command line\n // with two mistakes in it reports both rather than one at a time.\n process.stderr.write(`${error.format()}\\n`)\n } else if (error instanceof Error) {\n process.stderr.write(`${error.message}\\n`)\n if (readEnv().debug && error.stack !== undefined) process.stderr.write(`${error.stack}\\n`)\n } else {\n process.stderr.write(`${String(error)}\\n`)\n }\n return EXIT_FAILURE\n}\n\nasync function dispatch(argv: readonly string[]): Promise<number> {\n const result = parse(argv)\n\n switch (result.kind) {\n case \"version\":\n process.stdout.write(`${VERSION}\\n`)\n return EXIT_OK\n\n case \"help\":\n process.stdout.write(helpText(result.command))\n return EXIT_OK\n\n case \"usage\":\n // Invoked with nothing to do. The help goes to stdout because it was not an error in the\n // arguments — but the code is non-zero, because nothing was accomplished.\n process.stdout.write(helpText())\n return EXIT_FAILURE\n\n case \"command\":\n break\n }\n\n const { command, positionals, flags } = result.parsed\n // Present when the command's first argument is required; `init` and `run` legitimately take\n // none. Each case knows which it is.\n const manifestPath = positionals[0] as string\n // Every manifest-taking command accepts a sandbox agent name too — one resolver, applied\n // here at the dispatch layer, so `sessions milo` works the moment `run milo` does. The\n // resolution throws with the candidate list and a nearest-match hint.\n const resolved = (): string => resolveAgentRef(manifestPath)\n\n /**\n * First run: if this command wants a host and none is up, put one up and say so in one line.\n *\n * Here rather than in each command, because \"does this want a host\" is declared on the spec\n * (`CommandSpec.needsServer`, required) and this is the one place that reads it — a hand-kept\n * list of command names would be the drift `session-commands.ts` was written to end, with a new\n * command silently absent from it or silently included in it.\n *\n * **Before the switch and after the parse**, which matters in both directions: `--help`,\n * `--version` and a usage error have already returned above, so asking for help never installs\n * anything; and an unparseable command line never gets this far either.\n *\n * The announcement goes to **stderr** so it cannot land in the middle of `--json` output\n * somebody is piping into `jq`. It never throws — see `ensureServer`.\n */\n // `--store` only when this command declares it. `flags.str` throws for an undeclared flag —\n // deliberately, since reading one is a CLI bug — and the bootstrap is global, so it cannot\n // assume a per-command flag exists. Asking the spec is the honest version of that question.\n const storeFlag = command.flags.some((flag) => flag.name === \"store\")\n ? flags.str(\"store\")\n : undefined\n const bootstrap = await ensureServer({\n needsServer: command.needsServer,\n disabled: flags.bool(\"no-bootstrap\"),\n install: () => installServerUnit(),\n ...(storeFlag === undefined ? {} : { store: storeFlag }),\n })\n const note = announce(bootstrap)\n if (note !== undefined) process.stderr.write(note)\n\n switch (command.name) {\n case \"init\": {\n // `--dir`, never a positional: `init milo` read as the agent's name and meant the\n // directory. The parser refuses a positional now, with the spec's own two-readings hint.\n const dir = flags.str(\"dir\")\n const user = flags.str(\"user\")\n const name = flags.str(\"name\")\n const purpose = flags.str(\"purpose\")\n const preset = flags.str(\"preset\")\n const model = flags.str(\"model\")\n const baseUrl = flags.str(\"base-url\")\n const region = flags.str(\"region\")\n const apiKeyEnv = flags.str(\"api-key-env\")\n const system = flags.str(\"system\")\n const web = flags.str(\"web\")\n const webBackend = flags.str(\"web-backend\")\n const composio = flags.str(\"composio\")\n const telegram = flags.str(\"telegram\")\n const telegramAllow = flags.str(\"telegram-allow\")\n const whatsapp = flags.str(\"whatsapp\")\n const whatsappNumber = flags.str(\"whatsapp-number\")\n const server = flags.str(\"server\")\n const schedules = flags.str(\"schedules\")\n const skills = flags.str(\"skills\")\n const daemon = flags.str(\"daemon\")\n return await initCommand({\n ...(dir === undefined ? {} : { dir }),\n ...(user === undefined ? {} : { user }),\n ...(name === undefined ? {} : { name }),\n ...(purpose === undefined ? {} : { purpose }),\n ...(preset === undefined ? {} : { preset }),\n ...(model === undefined ? {} : { model }),\n ...(baseUrl === undefined ? {} : { baseUrl }),\n ...(region === undefined ? {} : { region }),\n ...(apiKeyEnv === undefined ? {} : { apiKeyEnv }),\n ...(system === undefined ? {} : { system }),\n ...(web === undefined ? {} : { web }),\n ...(webBackend === undefined ? {} : { webBackend }),\n ...(composio === undefined ? {} : { composio }),\n ...(telegram === undefined ? {} : { telegram }),\n ...(schedules === undefined ? {} : { schedules }),\n ...(telegramAllow === undefined ? {} : { telegramAllow }),\n ...(whatsapp === undefined ? {} : { whatsapp }),\n ...(whatsappNumber === undefined ? {} : { whatsappNumber }),\n ...(server === undefined ? {} : { server }),\n ...(skills === undefined ? {} : { skills }),\n ...(daemon === undefined ? {} : { daemon }),\n yes: flags.bool(\"yes\"),\n plain: flags.bool(\"plain\"),\n measureWindow: flags.bool(\"measure-window\"),\n installServer: installServerUnit,\n })\n }\n\n case \"run\": {\n const session = flags.str(\"session\")\n const input = flags.str(\"input\")\n const store = flags.str(\"store\")\n return await runCommand({\n // Bare `run` hands the sandbox the decision; a given ref resolves path-or-name.\n ...(positionals[0] === undefined ? {} : { manifestPath: resolved() }),\n ...(session === undefined ? {} : { sessionKey: session }),\n continueSession: flags.bool(\"continue\"),\n ...(input === undefined ? {} : { once: input }),\n ...(store === undefined ? {} : { store }),\n ephemeral: flags.bool(\"ephemeral\"),\n quiet: flags.bool(\"quiet\"),\n showReasoning: flags.bool(\"show-reasoning\"),\n noReasoning: flags.bool(\"no-reasoning\"),\n // Only when actually written. `flags.bool` returns `false` for an absent boolean, and\n // passing that would turn \"no opinion\" into \"definitely on\" and override the env var.\n ...(flags.bool(\"no-enhanced-keys\") ? { noEnhancedKeys: true } : {}),\n plain: flags.bool(\"plain\"),\n })\n }\n\n case \"schedules\": {\n const store = flags.str(\"store\")\n const id = flags.str(\"id\")\n const enable = flags.str(\"enable\")\n const disable = flags.str(\"disable\")\n return await schedulesCommand({\n manifestPath: resolved(),\n ...(store === undefined ? {} : { store }),\n ...(id === undefined ? {} : { id }),\n ...(enable === undefined ? {} : { enable }),\n ...(disable === undefined ? {} : { disable }),\n recipients: flags.bool(\"recipients\"),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"sessions\": {\n const session = flags.str(\"session\")\n const store = flags.str(\"store\")\n const limit = flags.num(\"limit\")\n return await sessionsCommand({\n manifestPath: resolved(),\n ...(session === undefined ? {} : { sessionKey: session }),\n ...(store === undefined ? {} : { store }),\n ...(limit === undefined ? {} : { limit }),\n json: flags.bool(\"json\"),\n clear: flags.bool(\"clear\"),\n turns: flags.bool(\"turns\"),\n })\n }\n\n case \"owner\": {\n const store = flags.str(\"store\")\n return await ownerCommand({\n // Positional 0 is the action, as for `memory`; the agent is positional 1.\n action: manifestPath,\n ...(positionals[1] === undefined\n ? {}\n : { manifestPath: resolveAgentRef(positionals[1]) }),\n ...(store === undefined ? {} : { store }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"memory\": {\n const limit = flags.num(\"limit\")\n const store = flags.str(\"store\")\n return await memoryCommand({\n // Positional 0 is the action, as for `soul` and `daemon` — so `resolved()` must not run\n // here; the manifest is positional 1.\n action: manifestPath,\n manifestPath: resolveAgentRef(positionals[1] ?? \"\"),\n ...(positionals[2] === undefined ? {} : { query: positionals[2] }),\n ...(limit === undefined ? {} : { limit }),\n ...(store === undefined ? {} : { store }),\n all: flags.bool(\"all\"),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"config\": {\n // As for `soul` and `daemon`, positional 0 is the action, so `resolved()` must not run —\n // the agent is positional 1 and this command resolves it itself.\n const { configCommand, readAction } = await import(\"#config\")\n // `config <agent>` with no action is the editor, so the split is not positional. The six\n // action words win and anything else is an agent — the same rule a slash command uses.\n const asked = readAction(manifestPath, positionals[1])\n return await configCommand({\n action: asked.action,\n ...(asked.ref === undefined ? {} : { ref: asked.ref }),\n ...(positionals[2] === undefined ? {} : { name: positionals[2] }),\n ...(positionals[3] === undefined ? {} : { value: positionals[3] }),\n ...(flags.str(\"channel\") === undefined\n ? {}\n : { channel: flags.str(\"channel\") as string }),\n remove: flags.bool(\"remove\"),\n yes: flags.bool(\"yes\"),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n })\n }\n\n case \"validate\":\n return await validateCommand({ manifestPath: resolved(), json: flags.bool(\"json\") })\n\n case \"workspace\":\n return workspaceCommand({\n manifestPath: resolved(),\n json: flags.bool(\"json\"),\n strict: flags.bool(\"strict\"),\n })\n\n case \"soul\": {\n const out = flags.str(\"out\")\n return soulCommand({\n // For this command the first positional is the action, not a manifest.\n action: manifestPath,\n file: positionals[1] as string,\n ...(out === undefined ? {} : { out }),\n })\n }\n\n case \"skills\": {\n // Bare `skills` is the catalogue. Checked before the manifest is resolved, because browsing\n // is not about an agent — the agent is chosen on the second screen.\n if (positionals.length === 0) {\n return await browseCommand({\n plain: flags.bool(\"plain\"),\n json: flags.bool(\"json\"),\n })\n }\n // Positional 0 is the action, so the manifest is positional 1 — the same shape `soul` uses\n // and the reason `resolved()` is not called here.\n const skill = positionals[2]\n return skillsCommand({\n action: manifestPath,\n manifestPath: resolveAgentRef(positionals[1] ?? \"\"),\n ...(skill === undefined ? {} : { name: skill }),\n json: flags.bool(\"json\"),\n strict: flags.bool(\"strict\"),\n })\n }\n\n case \"sources\": {\n // Positional 0 is the action and there is no manifest, so `resolveAgentRef` never runs —\n // this command answers about the machine, not about an agent.\n const path = flags.str(\"path\")\n const ref = flags.str(\"ref\")\n return await sourcesCommand({\n action: manifestPath,\n rest: positionals.slice(1),\n ...(path === undefined ? {} : { path }),\n ...(ref === undefined ? {} : { ref }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"channels\": {\n // The action is optional, so positional 0 is either an action word or the agent — the\n // same split `config` makes, resolved from the command's own spec rather than a second\n // copy of the action list.\n const split = actionOrRef(\"channels\", manifestPath)\n const ref = split.ref ?? positionals[1] ?? \"\"\n const { channelsCommand } = await import(\"#channels\")\n return await channelsCommand({\n ...(split.action === undefined ? {} : { action: split.action }),\n manifestPath: resolveAgentRef(ref),\n ...(positionals[2] === undefined ? {} : { channelId: positionals[2] }),\n json: flags.bool(\"json\"),\n installServer: installServerUnit,\n })\n }\n\n case \"plugins\": {\n const ref = flags.str(\"ref\")\n const name = flags.str(\"name\")\n return await pluginsCommand({\n action: manifestPath,\n manifestPath: resolveAgentRef(positionals[1] ?? \"\"),\n rest: positionals.slice(2),\n ...(ref === undefined ? {} : { ref }),\n ...(name === undefined ? {} : { name }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"agents\": {\n const store = flags.str(\"store\")\n return await agentsCommand({\n // Bare lists the sandbox; names or paths describe those agents in full.\n manifestPaths: positionals.map((ref) => resolveAgentRef(ref)),\n ...(store === undefined ? {} : { store }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"restart\": {\n const store = flags.str(\"store\")\n return await restartCommand({\n // Optional: bare restarts the service, named reloads that agent where it runs.\n ...(manifestPath === undefined ? {} : { manifestPath: resolved() }),\n ...(store === undefined ? {} : { store }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"status\": {\n const store = flags.str(\"store\")\n return await statusCommand({\n ...(store === undefined ? {} : { store }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"logs\": {\n // An alias for `daemon logs`, flags and all: `--lines`, `--follow`, `--truncate`.\n const lines = flags.num(\"lines\")\n const store = flags.str(\"store\")\n return await daemonCommand({\n action: \"logs\",\n ...(manifestPath === undefined ? {} : { manifestPath: resolved() }),\n ...(lines === undefined ? {} : { lines }),\n follow: flags.bool(\"follow\"),\n truncate: flags.bool(\"truncate\"),\n ...(store === undefined ? {} : { store }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"serve\": {\n const port = flags.num(\"port\")\n const host = flags.str(\"host\")\n const store = flags.str(\"store\")\n return await serveCommand({\n manifestPaths: positionals.map((ref) => resolveAgentRef(ref)),\n ...(port === undefined ? {} : { port }),\n ...(host === undefined ? {} : { host }),\n ...(store === undefined ? {} : { store }),\n claim: flags.bool(\"claim\"),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"keys\":\n return await keysCommand({ noEnhancedKeys: flags.bool(\"no-enhanced-keys\") })\n\n case \"terminal-setup\":\n return await terminalSetupCommand({\n dryRun: flags.bool(\"dry-run\"),\n yes: flags.bool(\"yes\"),\n json: flags.bool(\"json\"),\n confirm: askYesNo,\n })\n\n case \"remove\":\n return await removeCommand({\n // A bare ref, never `resolved()`: removal is about a sandbox directory, and a resolved\n // manifest path would make `remove ./anything` look supported. `remove.ts` refuses a path.\n ...(manifestPath === undefined ? {} : { ref: manifestPath }),\n dryRun: flags.bool(\"dry-run\"),\n filesOnly: flags.bool(\"files-only\"),\n prune: flags.bool(\"prune\"),\n all: flags.bool(\"all\"),\n yes: flags.bool(\"yes\"),\n json: flags.bool(\"json\"),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n confirm: askExactly,\n })\n\n case \"stop\": {\n const reason = flags.str(\"reason\")\n return await stopCommand({\n // Optional on purpose: bare `stop` is the whole host, and naming an agent is a\n // different command rather than the same one with a filter — see stop.ts.\n ...(manifestPath === undefined ? {} : { manifestPath: resolved() }),\n dryRun: flags.bool(\"dry-run\"),\n ...(reason === undefined ? {} : { reason }),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"start\":\n return await startCommand({\n manifestPath: resolved(),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n json: flags.bool(\"json\"),\n })\n\n case \"web\": {\n const { webCommand } = await import(\"#web\")\n return await webCommand({\n // The action is positional 0 and the agent positional 1 — the `daemon install\n // <agent>` shape, which `manifestIndex` already reads off this spec, so the parser\n // and the help needed no change for a nested verb.\n action: manifestPath as \"run\" | \"open\" | \"url\" | undefined,\n ...(positionals[1] === undefined\n ? {}\n : { manifestPath: resolveAgentRef(positionals[1]) }),\n noOpen: flags.bool(\"no-open\"),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"credential\": {\n const { credentialCommand } = await import(\"#credential\")\n return await credentialCommand({\n // Action at positional 0 and the id at 1 — the `web run <agent>` shape, which\n // `manifestIndex` already reads off the spec, so the parser needed no change.\n action: manifestPath ?? \"\",\n ...(positionals[1] === undefined ? {} : { keyId: positionals[1] }),\n ...(flags.str(\"label\") === undefined\n ? {}\n : { label: flags.str(\"label\") as string }),\n ...(flags.str(\"agents\") === undefined\n ? {}\n : { agents: flags.str(\"agents\") as string }),\n ...(flags.str(\"sessions\") === undefined\n ? {}\n : { sessions: flags.str(\"sessions\") as string }),\n ...(flags.str(\"can\") === undefined ? {} : { can: flags.str(\"can\") as string }),\n ...(flags.str(\"expires\") === undefined\n ? {}\n : { expires: flags.str(\"expires\") as string }),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"daemon\": {\n const lines = flags.num(\"lines\")\n return await daemonCommand({\n // As for `soul`, the first positional is the action rather than a manifest — so\n // `resolved()` must not run here. The agent is positional 1, and it is optional:\n // bare `daemon status` reports on every installed agent.\n action: manifestPath,\n ...(positionals[1] === undefined\n ? {}\n : { manifestPath: resolveAgentRef(positionals[1]) }),\n ...(lines === undefined ? {} : { lines }),\n follow: flags.bool(\"follow\"),\n truncate: flags.bool(\"truncate\"),\n dryRun: flags.bool(\"dry-run\"),\n ...(flags.str(\"store\") === undefined\n ? {}\n : { store: flags.str(\"store\") as string }),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"model\": {\n const price = flags.num(\"price\")\n return await modelCommand({\n manifestPath: resolveAgentRef(positionals[1] as string),\n window: flags.bool(\"window\"),\n ...(price === undefined ? {} : { price }),\n write: flags.bool(\"write\"),\n yes: flags.bool(\"yes\"),\n json: flags.bool(\"json\"),\n })\n }\n\n case \"tools\":\n return await toolsCommand({\n manifestPath: resolved(),\n warm: flags.bool(\"warm\"),\n json: flags.bool(\"json\"),\n })\n\n default:\n // Unreachable: `parse` refuses an unknown command with a suggestion. Present so that\n // adding a command to lib/commands.ts without wiring it fails loudly rather than\n // silently doing nothing and exiting 0.\n throw new HarnessError({\n code: \"cli_command_unwired\",\n message: `Command \"${command.name}\" is declared but not wired up.`,\n hint: \"Add a case for it in src/index.ts.\",\n })\n }\n}\n\n// Before anything opens a store, which is what makes Node emit its `node:sqlite` experimental\n// warning into the middle of a command's output. See `lib/warnings.ts` for what is filtered and why\n// the list is specific rather than \"every ExperimentalWarning\".\nquietAcceptedWarnings()\ninstallGuards()\n// Before anything reads the environment: `X_FILE` fills `X` for every reader (pilot.9).\nloadSecretFiles()\n\n// One way out for every route, so the terminal is restored and buffered output drains before the\n// process ends — and then the process actually ends.\n//\n// `finish` alone was the bug: it sets `process.exitCode` and lets the event loop empty, which assumes\n// the loop can empty. A runtime leaves a keep-alive socket to the tool provider in Node's global\n// `fetch` pool, so it does not — measured at 180 seconds still alive after `/exit`, and the `tools`\n// command killed at 30. `lib/exit.ts` carries the numbers.\nawait dispatch(process.argv.slice(2))\n .catch(report)\n .then((code) => finishNow(code))\n"
|
|
48
49
|
],
|
|
49
|
-
"mappings": ";i4CAqCO,eAAe,EAAa,CAAC,EAAwD,CACxF,IAAM,EAAQ,MAAM,GAAU,CAAK,EAC7B,EAA4B,CAAC,EACnC,QAAW,KAAS,GAAW,EAAG,CAC9B,IAAM,EAAK,EAAM,IAAM,EAAM,IACvB,EAAS,MAAM,GAAa,EAAI,CAAK,GAAM,CAAE,QAAS,EAAK,EAC3D,EAAQ,EAAM,KAAK,CAAC,IAAQ,EAAI,UAAY,CAAE,EAC9C,EAAQ,IAAU,OAAY,OAAO,IAAM,KAAK,IAAI,EAAI,KAAK,MAAM,EAAM,SAAS,EACxF,EAAI,KAAK,IACF,EACH,QAAS,EAAM,WACX,EAAM,SAAW,OAAY,CAAC,EAAI,CAAE,OAAQ,EAAM,MAAO,KACzD,IAAU,OACR,CAAC,EACD,CACI,IAAK,EAAM,IACX,Q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