dispach 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +596 -0
- package/dist/App-dxqm39zx.js +11 -0
- package/dist/App-dxqm39zx.js.map +25 -0
- package/dist/ConfigEditor-7v5nebvy.js +6 -0
- package/dist/ConfigEditor-7v5nebvy.js.map +11 -0
- package/dist/KeyProbe-vjhmdpx6.js +5 -0
- package/dist/KeyProbe-vjhmdpx6.js.map +11 -0
- package/dist/Picker-jxaesaxy.js +5 -0
- package/dist/Picker-jxaesaxy.js.map +10 -0
- package/dist/SessionPicker-z2t0p4b5.js +5 -0
- package/dist/SessionPicker-z2t0p4b5.js.map +11 -0
- package/dist/SkillBrowser-yyf2gy0q.js +5 -0
- package/dist/SkillBrowser-yyf2gy0q.js.map +11 -0
- package/dist/WizardApp-12ndxgqv.js +5 -0
- package/dist/WizardApp-12ndxgqv.js.map +13 -0
- package/dist/agents.d.ts +9 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/browse.d.ts +63 -0
- package/dist/browse.d.ts.map +1 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +34 -0
- package/dist/client.js.map +11 -0
- package/dist/components/App.d.ts +28 -0
- package/dist/components/App.d.ts.map +1 -0
- package/dist/components/Banner.d.ts +16 -0
- package/dist/components/Banner.d.ts.map +1 -0
- package/dist/components/Brandmark.d.ts +31 -0
- package/dist/components/Brandmark.d.ts.map +1 -0
- package/dist/components/CheckList.d.ts +38 -0
- package/dist/components/CheckList.d.ts.map +1 -0
- package/dist/components/CommandOutput.d.ts +29 -0
- package/dist/components/CommandOutput.d.ts.map +1 -0
- package/dist/components/ConfigEditor.d.ts +64 -0
- package/dist/components/ConfigEditor.d.ts.map +1 -0
- package/dist/components/HistorySearch.d.ts +23 -0
- package/dist/components/HistorySearch.d.ts.map +1 -0
- package/dist/components/KeyProbe.d.ts +36 -0
- package/dist/components/KeyProbe.d.ts.map +1 -0
- package/dist/components/LineCursor.d.ts +55 -0
- package/dist/components/LineCursor.d.ts.map +1 -0
- package/dist/components/Live.d.ts +17 -0
- package/dist/components/Live.d.ts.map +1 -0
- package/dist/components/Palette.d.ts +21 -0
- package/dist/components/Palette.d.ts.map +1 -0
- package/dist/components/Picker.d.ts +23 -0
- package/dist/components/Picker.d.ts.map +1 -0
- package/dist/components/Prompt.d.ts +20 -0
- package/dist/components/Prompt.d.ts.map +1 -0
- package/dist/components/Screen.d.ts +39 -0
- package/dist/components/Screen.d.ts.map +1 -0
- package/dist/components/SelectList.d.ts +34 -0
- package/dist/components/SelectList.d.ts.map +1 -0
- package/dist/components/SessionPicker.d.ts +26 -0
- package/dist/components/SessionPicker.d.ts.map +1 -0
- package/dist/components/SkillBrowser.d.ts +39 -0
- package/dist/components/SkillBrowser.d.ts.map +1 -0
- package/dist/components/Spinner.d.ts +13 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/StatusBar.d.ts +11 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/SummaryCard.d.ts +11 -0
- package/dist/components/SummaryCard.d.ts.map +1 -0
- package/dist/components/TextField.d.ts +39 -0
- package/dist/components/TextField.d.ts.map +1 -0
- package/dist/components/Transcript.d.ts +23 -0
- package/dist/components/Transcript.d.ts.map +1 -0
- package/dist/components/WizardApp.d.ts +18 -0
- package/dist/components/WizardApp.d.ts.map +1 -0
- package/dist/components/WizardFrame.d.ts +19 -0
- package/dist/components/WizardFrame.d.ts.map +1 -0
- package/dist/config-yz0nz51b.js +24 -0
- package/dist/config-yz0nz51b.js.map +10 -0
- package/dist/config.d.ts +71 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/credential-wgt4gvcz.js +19 -0
- package/dist/credential-wgt4gvcz.js.map +10 -0
- package/dist/credential.d.ts +68 -0
- package/dist/credential.d.ts.map +1 -0
- package/dist/daemon.d.ts +47 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/editor.d.ts +81 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/hooks/useElapsed.d.ts +10 -0
- package/dist/hooks/useElapsed.d.ts.map +1 -0
- package/dist/hooks/useTerminalSize.d.ts +14 -0
- package/dist/hooks/useTerminalSize.d.ts.map +1 -0
- package/dist/hooks/useTurn.d.ts +41 -0
- package/dist/hooks/useTurn.d.ts.map +1 -0
- package/dist/index-2cvtz0fy.js +903 -0
- package/dist/index-2cvtz0fy.js.map +194 -0
- package/dist/index-3nwfz9jq.js +12 -0
- package/dist/index-3nwfz9jq.js.map +11 -0
- package/dist/index-6b7qvh1x.js +6 -0
- package/dist/index-6b7qvh1x.js.map +10 -0
- package/dist/index-6z0yr17z.js +12 -0
- package/dist/index-6z0yr17z.js.map +11 -0
- package/dist/index-7da4fqcr.js +7 -0
- package/dist/index-7da4fqcr.js.map +11 -0
- package/dist/index-8bmhd2hj.js +6 -0
- package/dist/index-8bmhd2hj.js.map +10 -0
- package/dist/index-9d011p3q.js +6 -0
- package/dist/index-9d011p3q.js.map +10 -0
- package/dist/index-9f9pp2ef.js +6 -0
- package/dist/index-9f9pp2ef.js.map +10 -0
- package/dist/index-9nsfs0vy.js +6 -0
- package/dist/index-9nsfs0vy.js.map +10 -0
- package/dist/index-9pj1ws0p.js +77 -0
- package/dist/index-9pj1ws0p.js.map +12 -0
- package/dist/index-b5wwtxzk.js +66 -0
- package/dist/index-b5wwtxzk.js.map +12 -0
- package/dist/index-b8zwg8a3.js +6 -0
- package/dist/index-b8zwg8a3.js.map +10 -0
- package/dist/index-bry9bzt3.js +427 -0
- package/dist/index-bry9bzt3.js.map +11 -0
- package/dist/index-bwckzbf8.js +6 -0
- package/dist/index-bwckzbf8.js.map +10 -0
- package/dist/index-cx3vz7sf.js +6 -0
- package/dist/index-cx3vz7sf.js.map +11 -0
- package/dist/index-e8n70sgj.js +6 -0
- package/dist/index-e8n70sgj.js.map +11 -0
- package/dist/index-fvhg0xyd.js +167 -0
- package/dist/index-fvhg0xyd.js.map +19 -0
- package/dist/index-gbnc99j8.js +14 -0
- package/dist/index-gbnc99j8.js.map +13 -0
- package/dist/index-h2yds678.js +7 -0
- package/dist/index-h2yds678.js.map +11 -0
- package/dist/index-j97vttdt.js +10 -0
- package/dist/index-j97vttdt.js.map +10 -0
- package/dist/index-jk0def33.js +6 -0
- package/dist/index-jk0def33.js.map +12 -0
- package/dist/index-jym27m75.js +6 -0
- package/dist/index-jym27m75.js.map +10 -0
- package/dist/index-mgdgx22q.js +10 -0
- package/dist/index-mgdgx22q.js.map +10 -0
- package/dist/index-mrtb5y08.js +6 -0
- package/dist/index-mrtb5y08.js.map +11 -0
- package/dist/index-my5cjx00.js +6 -0
- package/dist/index-my5cjx00.js.map +10 -0
- package/dist/index-qc2vrq9z.js +7 -0
- package/dist/index-qc2vrq9z.js.map +11 -0
- package/dist/index-rqbtm761.js +6 -0
- package/dist/index-rqbtm761.js.map +10 -0
- package/dist/index-rqzg861g.js +6 -0
- package/dist/index-rqzg861g.js.map +10 -0
- package/dist/index-t1xvacym.js +6 -0
- package/dist/index-t1xvacym.js.map +11 -0
- package/dist/index-xgqzk5cq.js +9 -0
- package/dist/index-xgqzk5cq.js.map +12 -0
- package/dist/index-xqyms08r.js +6 -0
- package/dist/index-xqyms08r.js.map +10 -0
- package/dist/index-yr25dnf5.js +6 -0
- package/dist/index-yr25dnf5.js.map +10 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +527 -0
- package/dist/index.js.map +48 -0
- package/dist/init.d.ts +34 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/keymap.d.ts +126 -0
- package/dist/keymap.d.ts.map +1 -0
- package/dist/keys.d.ts +17 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/lib/ambient.d.ts +69 -0
- package/dist/lib/ambient.d.ts.map +1 -0
- package/dist/lib/args.d.ts +33 -0
- package/dist/lib/args.d.ts.map +1 -0
- package/dist/lib/bootstrap.d.ts +84 -0
- package/dist/lib/bootstrap.d.ts.map +1 -0
- package/dist/lib/browse.d.ts +89 -0
- package/dist/lib/browse.d.ts.map +1 -0
- package/dist/lib/browser.d.ts +55 -0
- package/dist/lib/browser.d.ts.map +1 -0
- package/dist/lib/chat-frame.d.ts +156 -0
- package/dist/lib/chat-frame.d.ts.map +1 -0
- package/dist/lib/clipboard.d.ts +32 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/commands.d.ts +26 -0
- package/dist/lib/commands.d.ts.map +1 -0
- package/dist/lib/composer.d.ts +85 -0
- package/dist/lib/composer.d.ts.map +1 -0
- package/dist/lib/config-apply.d.ts +51 -0
- package/dist/lib/config-apply.d.ts.map +1 -0
- package/dist/lib/config-editor.d.ts +113 -0
- package/dist/lib/config-editor.d.ts.map +1 -0
- package/dist/lib/config-env.d.ts +110 -0
- package/dist/lib/config-env.d.ts.map +1 -0
- package/dist/lib/config-rows.d.ts +37 -0
- package/dist/lib/config-rows.d.ts.map +1 -0
- package/dist/lib/config-view.d.ts +133 -0
- package/dist/lib/config-view.d.ts.map +1 -0
- package/dist/lib/confirm.d.ts +86 -0
- package/dist/lib/confirm.d.ts.map +1 -0
- package/dist/lib/const.d.ts +213 -0
- package/dist/lib/const.d.ts.map +1 -0
- package/dist/lib/csi.d.ts +70 -0
- package/dist/lib/csi.d.ts.map +1 -0
- package/dist/lib/curated.d.ts +44 -0
- package/dist/lib/curated.d.ts.map +1 -0
- package/dist/lib/daemon-plan.d.ts +151 -0
- package/dist/lib/daemon-plan.d.ts.map +1 -0
- package/dist/lib/dotenv-edit.d.ts +30 -0
- package/dist/lib/dotenv-edit.d.ts.map +1 -0
- package/dist/lib/env.d.ts +10 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/exit.d.ts +170 -0
- package/dist/lib/exit.d.ts.map +1 -0
- package/dist/lib/help.d.ts +10 -0
- package/dist/lib/help.d.ts.map +1 -0
- package/dist/lib/init-flow.d.ts +539 -0
- package/dist/lib/init-flow.d.ts.map +1 -0
- package/dist/lib/init-skills.d.ts +46 -0
- package/dist/lib/init-skills.d.ts.map +1 -0
- package/dist/lib/keyboard.d.ts +76 -0
- package/dist/lib/keyboard.d.ts.map +1 -0
- package/dist/lib/keys-view.d.ts +57 -0
- package/dist/lib/keys-view.d.ts.map +1 -0
- package/dist/lib/launchd.d.ts +151 -0
- package/dist/lib/launchd.d.ts.map +1 -0
- package/dist/lib/lifecycle.d.ts +126 -0
- package/dist/lib/lifecycle.d.ts.map +1 -0
- package/dist/lib/log-follow.d.ts +71 -0
- package/dist/lib/log-follow.d.ts.map +1 -0
- package/dist/lib/mouse.d.ts +84 -0
- package/dist/lib/mouse.d.ts.map +1 -0
- package/dist/lib/multiselect.d.ts +37 -0
- package/dist/lib/multiselect.d.ts.map +1 -0
- package/dist/lib/origins.d.ts +40 -0
- package/dist/lib/origins.d.ts.map +1 -0
- package/dist/lib/output.d.ts +29 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/palette.d.ts +69 -0
- package/dist/lib/palette.d.ts.map +1 -0
- package/dist/lib/probe.d.ts +158 -0
- package/dist/lib/probe.d.ts.map +1 -0
- package/dist/lib/providers.d.ts +63 -0
- package/dist/lib/providers.d.ts.map +1 -0
- package/dist/lib/provision.d.ts +163 -0
- package/dist/lib/provision.d.ts.map +1 -0
- package/dist/lib/remove-plan.d.ts +120 -0
- package/dist/lib/remove-plan.d.ts.map +1 -0
- package/dist/lib/render.d.ts +78 -0
- package/dist/lib/render.d.ts.map +1 -0
- package/dist/lib/resume.d.ts +69 -0
- package/dist/lib/resume.d.ts.map +1 -0
- package/dist/lib/rows.d.ts +69 -0
- package/dist/lib/rows.d.ts.map +1 -0
- package/dist/lib/sandbox.d.ts +101 -0
- package/dist/lib/sandbox.d.ts.map +1 -0
- package/dist/lib/schema.d.ts +491 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/screen.d.ts +102 -0
- package/dist/lib/screen.d.ts.map +1 -0
- package/dist/lib/scroll.d.ts +64 -0
- package/dist/lib/scroll.d.ts.map +1 -0
- package/dist/lib/select.d.ts +23 -0
- package/dist/lib/select.d.ts.map +1 -0
- package/dist/lib/service-env.d.ts +38 -0
- package/dist/lib/service-env.d.ts.map +1 -0
- package/dist/lib/service.d.ts +102 -0
- package/dist/lib/service.d.ts.map +1 -0
- package/dist/lib/session-commands.d.ts +229 -0
- package/dist/lib/session-commands.d.ts.map +1 -0
- package/dist/lib/session-key.d.ts +55 -0
- package/dist/lib/session-key.d.ts.map +1 -0
- package/dist/lib/sessions-view.d.ts +31 -0
- package/dist/lib/sessions-view.d.ts.map +1 -0
- package/dist/lib/source-cache.d.ts +105 -0
- package/dist/lib/source-cache.d.ts.map +1 -0
- package/dist/lib/source.d.ts +281 -0
- package/dist/lib/source.d.ts.map +1 -0
- package/dist/lib/sources.d.ts +107 -0
- package/dist/lib/sources.d.ts.map +1 -0
- package/dist/lib/spawn.d.ts +56 -0
- package/dist/lib/spawn.d.ts.map +1 -0
- package/dist/lib/stdin-tap.d.ts +41 -0
- package/dist/lib/stdin-tap.d.ts.map +1 -0
- package/dist/lib/subcommand.d.ts +57 -0
- package/dist/lib/subcommand.d.ts.map +1 -0
- package/dist/lib/systemd.d.ts +60 -0
- package/dist/lib/systemd.d.ts.map +1 -0
- package/dist/lib/templates.d.ts +35 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/terminal.d.ts +98 -0
- package/dist/lib/terminal.d.ts.map +1 -0
- package/dist/lib/text-selection.d.ts +75 -0
- package/dist/lib/text-selection.d.ts.map +1 -0
- package/dist/lib/theme.d.ts +90 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/types.d.ts +467 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/warnings.d.ts +79 -0
- package/dist/lib/warnings.d.ts.map +1 -0
- package/dist/lib/width.d.ts +39 -0
- package/dist/lib/width.d.ts.map +1 -0
- package/dist/lib/wizard.d.ts +95 -0
- package/dist/lib/wizard.d.ts.map +1 -0
- package/dist/lib/wordmark.d.ts +60 -0
- package/dist/lib/wordmark.d.ts.map +1 -0
- package/dist/lib/wrap.d.ts +74 -0
- package/dist/lib/wrap.d.ts.map +1 -0
- package/dist/memory.d.ts +25 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/model.d.ts +47 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/plugins.d.ts +15 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/remove.d.ts +52 -0
- package/dist/remove.d.ts.map +1 -0
- package/dist/run.d.ts +42 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/schedules.d.ts +41 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/serve.d.ts +41 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/sessions.d.ts +13 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/skills.d.ts +80 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/soul.d.ts +19 -0
- package/dist/soul.d.ts.map +1 -0
- package/dist/sources.d.ts +32 -0
- package/dist/sources.d.ts.map +1 -0
- package/dist/start.d.ts +26 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/stop.d.ts +58 -0
- package/dist/stop.d.ts.map +1 -0
- package/dist/terminal-setup.d.ts +31 -0
- package/dist/terminal-setup.d.ts.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/transcript.d.ts +124 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/validate.d.ts +36 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/web-w7r68df1.js +14 -0
- package/dist/web-w7r68df1.js.map +11 -0
- package/dist/web.d.ts +36 -0
- package/dist/web.d.ts.map +1 -0
- package/dist/wire.d.ts +10 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +33 -0
- package/dist/wire.js.map +10 -0
- package/dist/workspace.d.ts +19 -0
- package/dist/workspace.d.ts.map +1 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
# Dispach
|
|
2
|
+
|
|
3
|
+
A lightweight, model-agnostic AI agent runtime.
|
|
4
|
+
|
|
5
|
+
Dispach turns a stateless OpenAI-compatible `/chat/completions` endpoint into an agent that
|
|
6
|
+
uses tools, remembers across sessions, acts on your machine under a policy you set, and lives in
|
|
7
|
+
messaging channels. Scheduling and delegation to other agents are designed and not yet built —
|
|
8
|
+
see Status. Bun-first TypeScript, Apache-2.0.
|
|
9
|
+
|
|
10
|
+
> To dispatch is to send a thing on its way with the authority to see it done — to decide
|
|
11
|
+
> what handles it, hand it over, and answer for the result.
|
|
12
|
+
|
|
13
|
+
## Status
|
|
14
|
+
|
|
15
|
+
**Pre-release, and it runs.** Install a single binary, or work from a checkout (both below).
|
|
16
|
+
|
|
17
|
+
Built and in use: the manifest and agent loop, the store and sessions, tools with the NLT and
|
|
18
|
+
native dialects, the tiered workspace, system and web tool providers with a policy engine, the
|
|
19
|
+
Telegram channel, the HTTP/SSE server, an idempotent outbox, launchd services, skills with two
|
|
20
|
+
catalogues, the full-screen TUI, the compaction ladder, phase-scoped tools, memory that carries
|
|
21
|
+
across sessions, and scheduling — cron, interval and one-shot, DST-correct, on one timer.
|
|
22
|
+
|
|
23
|
+
Also built since: the plugin API with all four middleware wrap points, supervisor delegation with
|
|
24
|
+
typed handoffs, the Docker image and a compose front door, a typed client, operator keys, approvals
|
|
25
|
+
over the wire, and a browser UI on the same origin as the API.
|
|
26
|
+
|
|
27
|
+
Not built yet: WhatsApp. `docs/05-PLAN.md` has every phase with its acceptance criteria and what is
|
|
28
|
+
ticked.
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
An agent harness is a runtime layer with four necessary and sufficient elements:
|
|
33
|
+
|
|
34
|
+
1. **An agent loop** — model call, tool execution, observation, repeat
|
|
35
|
+
2. **A tool interface** — resolution, validation, execution
|
|
36
|
+
3. **Context management** — assembly, budgeting, progressive compaction
|
|
37
|
+
4. **Control mechanisms** — phases, limits, cancellation, scheduling
|
|
38
|
+
|
|
39
|
+
Anything outside those four is a plugin, not core. Dispach is not an orchestration graph,
|
|
40
|
+
a workflow engine, a RAG pipeline, a vector database, or a model gateway.
|
|
41
|
+
|
|
42
|
+
## Design commitments
|
|
43
|
+
|
|
44
|
+
The ones that would otherwise look like mistakes:
|
|
45
|
+
|
|
46
|
+
- **Natural-language tool calling is the default dialect**, not native function calling.
|
|
47
|
+
Published replication across 14 models: +14.9pp accuracy, 93% fewer critical errors, −25%
|
|
48
|
+
tokens; +24 to +43pp on small models specifically. `native` is an explicit opt-in.
|
|
49
|
+
- **The tool dialect is config and never auto-detected.** Behaviour must not change silently
|
|
50
|
+
when the model changes.
|
|
51
|
+
- **Tools are pinned at load, not searched at runtime.** Search-then-execute is two-hop
|
|
52
|
+
reasoning, which is where small models fail.
|
|
53
|
+
- **Compaction is progressive and harness-driven** — five stages from 60% context pressure,
|
|
54
|
+
not one lossy summarise at 95%.
|
|
55
|
+
- **Memory is SQLite FTS5, not embeddings.** No model weights, no embedding service, no
|
|
56
|
+
network in the memory path.
|
|
57
|
+
- **Zero network I/O before readiness.** Channels connect after `runtime.ready` and report
|
|
58
|
+
status via events.
|
|
59
|
+
- **Generation is detached from the client connection.** A browser refresh never kills a
|
|
60
|
+
turn; reattach by turn id is in the wire protocol.
|
|
61
|
+
|
|
62
|
+
Full rationale for every decision, including the negative ones, is in `docs/00-DECISIONS.md`.
|
|
63
|
+
|
|
64
|
+
## Getting set up
|
|
65
|
+
|
|
66
|
+
### Install
|
|
67
|
+
|
|
68
|
+
**From npm**, which is one package carrying the command and the client:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm i -g dispach # the `dispach` command
|
|
72
|
+
dispach --version # 0.1.0
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
and in an application that talks to a running server:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm i dispach
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { createClient } from "dispach/client"
|
|
83
|
+
import type { AnyEvent } from "dispach/wire"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
There is no `@dispach/*` scope, deliberately: the runtime is nine workspace packages and one name,
|
|
87
|
+
so there is one thing to install, one thing to version and one thing to trust. `dispach/client`
|
|
88
|
+
pulls in no terminal UI — asserted by the package's own tests, because an HTTP client has no
|
|
89
|
+
business paying the ~170-210 ms that importing Ink and React costs.
|
|
90
|
+
|
|
91
|
+
### Or the standalone binary
|
|
92
|
+
|
|
93
|
+
One file, no Node and no `node_modules`. `bun build --compile` embeds the runtime, which is also
|
|
94
|
+
why it starts *faster* than a `node_modules` install — there is no module resolution left to do at
|
|
95
|
+
boot. Measured on an M-series mac, `validate --json`: **70–90 ms compiled against 90–110 ms through
|
|
96
|
+
Node**.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
brew tap moeen-mahmud/dispach https://github.com/moeen-mahmud/dispach
|
|
100
|
+
brew install moeen-mahmud/dispach/dispach
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Or take the asset straight from a release — `darwin-arm64`, `darwin-x64`, `linux-x64` and
|
|
104
|
+
`linux-arm64`, each with a `.sha256` beside it:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
base=https://github.com/moeen-mahmud/dispach/releases/latest/download
|
|
108
|
+
curl -fsSL -O "$base/dispach-darwin-arm64"
|
|
109
|
+
curl -fsSL -O "$base/dispach-darwin-arm64.sha256"
|
|
110
|
+
shasum -a 256 -c dispach-darwin-arm64.sha256 # must print "OK"
|
|
111
|
+
chmod +x dispach-darwin-arm64
|
|
112
|
+
sudo mv dispach-darwin-arm64 /usr/local/bin/dispach
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Download with `-O`, not `-o dispach`: the checksum file names the asset, so renaming before the
|
|
116
|
+
check makes `shasum -c` look for a file that is not there.
|
|
117
|
+
|
|
118
|
+
Two things worth knowing about the macOS asset, because the failure has no error message:
|
|
119
|
+
|
|
120
|
+
- **The release binary is ad-hoc signed, and it has to be.** A compiled Bun binary arrives
|
|
121
|
+
*linker-signed*, which macOS refuses on exec — **exit 137 with no output at all**, which reads as
|
|
122
|
+
a crash rather than as a policy. `codesign -dv` reports such a file as signed, so the obvious
|
|
123
|
+
check passes on a binary that cannot run. The release re-signs every darwin asset, and
|
|
124
|
+
`scripts/build-binary.ts` refuses to produce an unsigned one.
|
|
125
|
+
- **Gatekeeper still applies to a downloaded file.** A binary fetched with a browser carries a
|
|
126
|
+
quarantine attribute; `xattr -d com.apple.quarantine dispach` clears it. `curl` does not set it.
|
|
127
|
+
|
|
128
|
+
### Or from a checkout
|
|
129
|
+
|
|
130
|
+
For working on Dispach itself. The order matters: `bin` points at `dist/`, so a link made before
|
|
131
|
+
the build points at nothing.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
git clone https://github.com/moeen-mahmud/dispach && cd dispach
|
|
135
|
+
bun install
|
|
136
|
+
bun run build # builds every package the binary imports
|
|
137
|
+
cd packages/cli && bun link # puts `dispach` on your PATH
|
|
138
|
+
cd ../..
|
|
139
|
+
|
|
140
|
+
dispach --version # 0.1.0
|
|
141
|
+
dispach --help
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Four things that are not obvious:
|
|
145
|
+
|
|
146
|
+
- **`bun link` symlinks the checkout**, so `~/.bun/bin/dispach` resolves to
|
|
147
|
+
`packages/cli/dist/index.js` in your working tree. Re-run `bun run build` after a change and the
|
|
148
|
+
command picks it up; you never re-link. If `dispach: command not found`, `~/.bun/bin` is not on
|
|
149
|
+
your `PATH` — Bun's installer adds it, and a shell opened before you installed Bun will not have it.
|
|
150
|
+
- **`bun run build` builds every workspace package, and you need all of them.** The CLI imports
|
|
151
|
+
`tools-system`, `tools-web`, `tools-composio` and `channel-telegram` from their `dist`, so building
|
|
152
|
+
only `core` and `cli` leaves the binary running yesterday's provider code — and the symptom is the
|
|
153
|
+
worst kind: your change is correct, a test fails, and the stack trace points into a stale `dist`.
|
|
154
|
+
- **Node 24+ must be on your `PATH`.** The built binary's shebang is `#!/usr/bin/env node`; Bun builds
|
|
155
|
+
it and Node runs it.
|
|
156
|
+
- **`DISPACH_HOME` relocates the whole sandbox.** Point it at a temporary directory and every agent,
|
|
157
|
+
the store and the logs go there instead of `~/.dispach` — which is how to try things out, and how
|
|
158
|
+
every test in this repo avoids touching a real one.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
DISPACH_HOME=/tmp/sandbox dispach init # a throwaway agent
|
|
162
|
+
DISPACH_HOME=/tmp/sandbox dispach run
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
You need one model endpoint. `init` asks which, writes the variable name into `agent.yaml` and the
|
|
166
|
+
key into a gitignored `.env` beside it — the manifest never holds a secret. Anything OpenAI-compatible
|
|
167
|
+
works, including a local Ollama, which needs no key at all.
|
|
168
|
+
|
|
169
|
+
## Quickstart
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
dispach init # an interactive wizard: your name, the agent's name, an endpoint
|
|
173
|
+
dispach run milo # agents live in ~/.dispach/agents — run them by name, from anywhere
|
|
174
|
+
dispach run # or just this: picks from your agents, or walks you through creating one
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`init` writes a complete starter agent — a reference-style manifest, a SOUL.md identity pair, an
|
|
178
|
+
AGENTS.md operations file, the tiered workspace, `.env` — and validates it with the real loader
|
|
179
|
+
before exiting. It asks for your API key at the prompt, masked, and writes it to the gitignored
|
|
180
|
+
`.env` beside the manifest; `agent.yaml` only ever names the variable. No flag accepts a key — one
|
|
181
|
+
passed on the command line lands in shell history — so a scripted run
|
|
182
|
+
(`init --user Ada --name Scout --preset ollama --yes`) leaves the line blank and says where to fill
|
|
183
|
+
it in.
|
|
184
|
+
|
|
185
|
+
## Changing an agent afterwards
|
|
186
|
+
|
|
187
|
+
Nothing about an agent is fixed at `init`. `config` is the person's editor for it — the agent has its
|
|
188
|
+
own (`config_set`), and the two are deliberately not the same: what a tool may do is the agent's to
|
|
189
|
+
ask for, but where it writes, who may reach it and what address it listens on are yours.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
dispach config milo # a screen: every setting, edit in place
|
|
193
|
+
dispach config list milo # every setting, its value, and who may set it
|
|
194
|
+
dispach config set milo model.main.id deepseek-v4-pro
|
|
195
|
+
dispach config env milo MODEL_API_KEY # prompted, masked, written 0600
|
|
196
|
+
dispach config allow milo @your_handle # who a channel accepts messages from
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`config <agent>` with no action opens the editor, which covers the same fields plus one `allowFrom` row
|
|
200
|
+
per channel and every secret the manifest depends on — masked as you type, and never shown afterwards.
|
|
201
|
+
Each row is written when you confirm it, so there is no unsaved state to lose; a value the schema
|
|
202
|
+
rejects is refused with the schema's own words and nothing is written. `/config` inside a session opens
|
|
203
|
+
the same screen, and restarts the agent on the way out so the change is actually in force.
|
|
204
|
+
|
|
205
|
+
Every edit is placed in the file, re-validated against the real schema and only then written, so a
|
|
206
|
+
change that would stop the agent loading is refused instead of discovered at the next boot. Comments
|
|
207
|
+
and alignment survive. Two edits — replacing the deny rules, and turning the write gate off — say what
|
|
208
|
+
the guard does and ask before applying; nothing else asks.
|
|
209
|
+
|
|
210
|
+
An agent's settings are fixed for the lifetime of the process running it, so a change lands at the next
|
|
211
|
+
start and the command says so, naming the process holding it.
|
|
212
|
+
|
|
213
|
+
## Where things live
|
|
214
|
+
|
|
215
|
+
Agents created by `init` live in a sandbox under your home directory, and `run <name>` finds them
|
|
216
|
+
from anywhere:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
~/.dispach/
|
|
220
|
+
store.db sessions, memory, the outbox — one database, shared
|
|
221
|
+
agents/<name>/ agent.yaml, .env (0600), workspace/, skills/
|
|
222
|
+
logs/<id>.*.log what a background service wrote
|
|
223
|
+
sources/ skill-catalogue clones, shared by every agent
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
A fresh sandbox holds only `agents/`. The store is created on the first turn, `logs/` by the first
|
|
227
|
+
background service, `sources/` by the first catalogue fetch — nothing is made speculatively.
|
|
228
|
+
|
|
229
|
+
**One database, shared by every agent, isolated by `agent_id` on every table.** Not accidental: the
|
|
230
|
+
schema was already keyed that way, and a per-directory default meant the same agent got a different
|
|
231
|
+
conversation history depending on which directory you happened to run it from. Two consequences worth
|
|
232
|
+
knowing before they surprise you:
|
|
233
|
+
|
|
234
|
+
- **The store, the logs and the service label are keyed by the manifest `id`; the directory is keyed
|
|
235
|
+
by its own name.** They are usually the same and do not have to be. Two directories with one
|
|
236
|
+
manifest id therefore *share* one conversation history — `run` lists both and says so, and
|
|
237
|
+
`remove` refuses to delete either one's data rather than taking the other's with it.
|
|
238
|
+
- **Memory's full-text index is genuinely shared**, which is why ranking is computed in
|
|
239
|
+
`rank/bm25.ts` rather than by SQLite: FTS5's own `bm25()` takes its statistics over the whole
|
|
240
|
+
table, so one agent saving a note would have moved another agent's scores.
|
|
241
|
+
|
|
242
|
+
Removing an agent means a directory, rows in four tables, two log files and possibly a service, so
|
|
243
|
+
there is a command for it rather than a `rm -rf` and a list of things to remember:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
dispach remove milo --dry-run # exactly what would go, and nothing else happens
|
|
247
|
+
dispach remove milo # shows the same listing, then asks for the name typed back
|
|
248
|
+
dispach remove --prune # data left behind by an agent whose directory is already gone
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Keeping an agent up
|
|
252
|
+
|
|
253
|
+
`run` is a conversation and `serve` is a server: `serve` is the only command that binds a socket or
|
|
254
|
+
connects a channel, because a REPL that quietly started answering Telegram while you typed at it
|
|
255
|
+
would be a surprise — and because a messaging provider allows exactly one listener per token, so
|
|
256
|
+
the two would fight over your bot.
|
|
257
|
+
|
|
258
|
+
`serve` still dies with its terminal. On macOS:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
dispach daemon install milo # checks it will boot, then installs a LaunchAgent
|
|
262
|
+
dispach daemon status # running? how many restarts? why did it stop?
|
|
263
|
+
dispach daemon restart milo # after editing agent.yaml or .env
|
|
264
|
+
dispach daemon logs milo
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
If you want everything off — services *and* a `serve` you left in a tab three days ago — there is
|
|
268
|
+
one switch that needs to know nothing:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
dispach stop # every agent; --dry-run lists what it would stop first
|
|
272
|
+
dispach stop milo # or just one
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
It asks each process to stop rather than killing it, because the graceful path is the only one that
|
|
276
|
+
reaps commands the agent left running in the background, and it *disables* each service as well as
|
|
277
|
+
unloading it — a safety switch that came back at the next login would not be one. `daemon start`
|
|
278
|
+
brings an agent back.
|
|
279
|
+
|
|
280
|
+
A configuration error stops the service **once** rather than restarting it forever — the generated
|
|
281
|
+
job restarts on a crash signal and on nothing else, so a missing token leaves a stopped service and
|
|
282
|
+
an explanation instead of a log file growing at one line every ten seconds. `status` prints the
|
|
283
|
+
exit code and the tail of stderr, and exits non-zero, so it is usable from a monitor.
|
|
284
|
+
|
|
285
|
+
The service definition contains no secrets, ever. `launchctl print` echoes a job's environment in
|
|
286
|
+
plaintext to any local process, so the agent reads its credentials from the `.env` beside its
|
|
287
|
+
manifest — which `init` writes `0600` — and the plist carries only `HOME`, `PATH` and the two brand
|
|
288
|
+
variables.
|
|
289
|
+
|
|
290
|
+
**Linux and containers.** There is no `daemon` on Linux: nothing in this project's test environment
|
|
291
|
+
can run `systemctl`, and shipping a unit file nobody has executed is how a "supported" platform
|
|
292
|
+
turns out not to be. `daemon` there refuses and prints the `ExecStart=` line with the paths already
|
|
293
|
+
resolved, which is the part that is hard to get right by hand. In a container, run `serve` in the
|
|
294
|
+
foreground and let the container runtime supervise it — it handles SIGTERM, finishes the delivery
|
|
295
|
+
in flight, and exits 0.
|
|
296
|
+
|
|
297
|
+
## Hosting with Compose
|
|
298
|
+
|
|
299
|
+
The one-command path. `docker compose up` brings up a server with an agent, an exposed API and the
|
|
300
|
+
**web UI on the same origin** — nothing to configure but a token and a model key.
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
cp .env.example .env # then DISPACH_API_TOKEN and MODEL_API_KEY
|
|
304
|
+
docker compose up -d --build --wait
|
|
305
|
+
curl localhost:7420/v1/ready
|
|
306
|
+
docker compose logs agent # the claim link — open it once to get a browser key
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Then open `http://localhost:7420` and paste nothing: the claim link in the logs carries a one-time
|
|
310
|
+
token the page exchanges for a key it keeps. Reading the container's own output is what confers
|
|
311
|
+
first ownership, which grants nothing new to anyone who could already run `docker compose logs`.
|
|
312
|
+
|
|
313
|
+
**`--build` is not optional after the first run.** `image: dispach:local` names a tag, and compose
|
|
314
|
+
builds only when that tag is *absent* — so a second `up` reuses whatever was built before, reports
|
|
315
|
+
healthy, and serves it. Measured while writing this: a two-day-old image came up green and answered
|
|
316
|
+
every request from a binary that predated two whole phases. The recorded stale-`dist` hazard with a
|
|
317
|
+
container around it, and the same tell — everything works, nothing is current.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
curl -s -H "Authorization: Bearer $DISPACH_API_TOKEN" \
|
|
321
|
+
-H 'content-type: application/json' \
|
|
322
|
+
-d '{"text":"what can you do?"}' \
|
|
323
|
+
localhost:7420/v1/agents/minimal/messages
|
|
324
|
+
# → {"turnId":"t_…","sessionKey":"api:default"}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
`docker-compose.yml` is at the repo root so a fresh clone needs no `-f`. The full wire surface is
|
|
328
|
+
in [`docs/04-SPEC-WIRE.md`](docs/04-SPEC-WIRE.md); `docker compose down` stops it and
|
|
329
|
+
`docker compose down -v` also discards the state volume.
|
|
330
|
+
|
|
331
|
+
Every compose subcommand reads `.env`, not just `up` — so passing the variables inline works for
|
|
332
|
+
`up` and then `logs`, `ps` and `down` fail on the same interpolation. Copy the file.
|
|
333
|
+
|
|
334
|
+
One thing the claim link cannot know: it is built from the port the server **bound**, which is
|
|
335
|
+
always 7420 inside the container. Set `HOST_PORT` to anything else and the link needs that port
|
|
336
|
+
substituted by hand.
|
|
337
|
+
|
|
338
|
+
Four things in that file are answers to defaults that bite, and they are commented there rather
|
|
339
|
+
than left to be discovered:
|
|
340
|
+
|
|
341
|
+
- **No `command:` override.** The image's CMD carries `--host 0.0.0.0`; a compose `command:`
|
|
342
|
+
replaces CMD wholesale, so adding one drops the host flag and the process listens on loopback
|
|
343
|
+
*inside* the container, which no published port can reach.
|
|
344
|
+
- **A named volume at `/home/dispach`.** That is the agent's home, and the sandbox inside it is a
|
|
345
|
+
laptop's: `~/.dispach/store.db`, `~/.dispach/agents/`, `~/.dispach/logs/`. A named volume inherits
|
|
346
|
+
uid 1000 from the image; a host path keeps host ownership, and a non-root container cannot write
|
|
347
|
+
its own home. It also holds the `uv` cache and the cloned skills catalogues, which used to sit on
|
|
348
|
+
a tmpfs and be discarded on every restart.
|
|
349
|
+
- **`/agent` is read-write.** The skills cache and `memory_write` both write beside the manifest.
|
|
350
|
+
- **`stop_grace_period: 30s`.** The 10 s default can SIGKILL an outbox flush mid-write.
|
|
351
|
+
|
|
352
|
+
The model reaches the container through the *environment* rather than through a `.env` beside the
|
|
353
|
+
manifest, which is the documented precedence: the ambient environment beats an agent's own file,
|
|
354
|
+
so an operator can configure the agent their container runs.
|
|
355
|
+
|
|
356
|
+
One agent per container **by choice, not by limitation**: `serve` accepts several manifests and one
|
|
357
|
+
process hosts N agents (decision 8.5), but a shared process means one agent's runaway `exec` starves
|
|
358
|
+
the others, so the image runs one. A second agent is a second service with its
|
|
359
|
+
own port, its own agent directory and **its own state volume** — a commented example in the
|
|
360
|
+
compose file shows the shape, including why sharing a volume would have two boots deleting each
|
|
361
|
+
other's schedules.
|
|
362
|
+
|
|
363
|
+
## Developing against the container
|
|
364
|
+
|
|
365
|
+
The container is the honest place to exercise an agent that has a shell, and not only for
|
|
366
|
+
containment. Every `exec` test in this repo otherwise runs on macOS, where the shell is a real
|
|
367
|
+
bash and `realpath` resolves `/var` through a symlink — the exact conditions the recorded
|
|
368
|
+
`$PWD`-comparison bug lived in. In the image it is busybox `sh` on Linux, with a different PATH
|
|
369
|
+
and different `realpath` semantics. Those have never been exercised until now.
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
cp .env.example .env # token + a model key
|
|
373
|
+
echo 'AGENT_DIR=./examples/shell-agent' >> .env # an agent that can actually run things
|
|
374
|
+
docker compose up -d --build --wait
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Then the loop. `--build` on `up` rebuilds only what changed, and layer caching means a source-only
|
|
378
|
+
edit re-runs `bun run build` and nothing before it:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
docker compose up -d --build --wait # after any source change
|
|
382
|
+
docker compose logs -f # what it is saying
|
|
383
|
+
docker compose exec agent sh # a shell in the container, as uid 1000
|
|
384
|
+
docker compose down # stop; down -v also discards the home volume
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Verified: `exec` runs inside the container as **uid 1000**, cwd `/agent/workspace`, with output
|
|
388
|
+
fenced as untrusted. What the agent's shell can reach is `sh`, `bash`, `git`, `python3`, `uv`, `jq`
|
|
389
|
+
and `curl` — `git` because the skills catalogue is fetched with it and its absence *deletes* that
|
|
390
|
+
feature rather than degrading it, `python3` and `uv` because a skill shipping scripts needs them.
|
|
391
|
+
|
|
392
|
+
What is **absent on purpose**, and asserted as such: no Bun and no Node, because the application is
|
|
393
|
+
one compiled binary; no `wget`, so there is one obvious HTTP client rather than two; and no pager
|
|
394
|
+
and no editor, because `exec` hands a child a file descriptor and never a TTY — anything that pages
|
|
395
|
+
or prompts blocks until its deadline and reads as a hung agent. The CI `docker` job asserts both
|
|
396
|
+
lists, that the image is glibc, that a C-extension wheel installs with no compiler present, that a
|
|
397
|
+
named timezone resolves, and that it still runs as uid 1000 with `$HOME` set.
|
|
398
|
+
|
|
399
|
+
### What containment the compose file adds
|
|
400
|
+
|
|
401
|
+
`tools.policy` decides *whether* a command runs. It does not decide *where*, and it cannot: a
|
|
402
|
+
write root does not bind `exec`, because `echo x > file` carries its target inside a shell string
|
|
403
|
+
nothing can inspect. So the deployment supplies the other half:
|
|
404
|
+
|
|
405
|
+
| | |
|
|
406
|
+
| --- | --- |
|
|
407
|
+
| `cap_drop: [ALL]` | The process is uid 1000 and binds 7420, above 1024. Nothing asks for a capability, so an empty set is the true requirement rather than a compromise. |
|
|
408
|
+
| `no-new-privileges` | A setuid binary cannot raise privileges. There should be none; this makes that a property rather than an audit. |
|
|
409
|
+
| `pids_limit: 512` | **A fork bomb is one `exec` call away.** `init: true` reaps children; only this bounds them. |
|
|
410
|
+
| `mem_limit: 2g`, `cpus: 2.0` | An agent asked to process a large file can allocate until the host swaps. Here it is OOM-killed and restarts, which is legible. |
|
|
411
|
+
| `read_only: true` | An immutable root filesystem. `/agent` and `/home/dispach` are mounts and stay writable — the skills cache and `memory_write` both need that. |
|
|
412
|
+
| `tmpfs` on `/tmp` | Where `exec` hands children a file descriptor rather than buffering their output. There used to be a second entry for `$HOME`, which meant a Python skill rebuilt its venv on every boot; `$HOME` is a volume now, so that trade is gone rather than accepted. |
|
|
413
|
+
|
|
414
|
+
`examples/shell-agent` is the agent to mount for this, and its README is blunt about the
|
|
415
|
+
consequence: run it on a laptop and the policy is the only boundary there is.
|
|
416
|
+
|
|
417
|
+
## Docker
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
docker build -f docker/Dockerfile -t dispach .
|
|
421
|
+
docker run --rm -p 7420:7420 \
|
|
422
|
+
--env-file examples/minimal/.env \
|
|
423
|
+
-e DISPACH_API_TOKEN=pick-something \
|
|
424
|
+
-v "$PWD/examples/minimal:/agent" \
|
|
425
|
+
-v dispach-home:/home/dispach \
|
|
426
|
+
dispach
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
The token is not optional and is not boilerplate. The image binds `0.0.0.0`, because a process
|
|
430
|
+
listening on loopback *inside* a container is unreachable through a published port — a container
|
|
431
|
+
that looks healthy, answers nothing, and gives no clue why. A non-loopback bind then requires a
|
|
432
|
+
token by design, and `serve` refuses to start without one rather than binding the world open.
|
|
433
|
+
|
|
434
|
+
A manifest goes at `/agent`, and the entrypoint links it into the sandbox as `primary` — so the
|
|
435
|
+
mounted agent is reachable by bare ref (`dispach validate primary`) and appears in the same listing
|
|
436
|
+
as anything `dispach init` creates inside the container. There is **one agents directory**, which
|
|
437
|
+
there was not before: the image used to set `DISPACH_HOME=/state`, so `init` wrote to `/state/agents`
|
|
438
|
+
while the CMD served `/agent`, and an agent created in the container was invisible to every listing.
|
|
439
|
+
|
|
440
|
+
The image is `debian:trixie-slim` and the runtime stage contains **one file** — the compiled binary.
|
|
441
|
+
No Bun, no Node, no `node_modules`. glibc rather than musl is deliberate and is about Python: PyPI's
|
|
442
|
+
C-extension wheels are `manylinux`, so on alpine anything without a `musllinux` build compiles from
|
|
443
|
+
source, and this image ships no compiler — a wheel would fail *inside a tool call*. Non-root as
|
|
444
|
+
`dispach` (uid 1000) — **a host directory bind-mounted at `/home/dispach` has to be writable by
|
|
445
|
+
uid 1000**, or the container starts and fails at the first turn with a permission error, which is
|
|
446
|
+
the worse moment to find out.
|
|
447
|
+
|
|
448
|
+
The healthcheck polls `/v1/ready`, which flips at `runtime.ready` — *before* channels connect,
|
|
449
|
+
deliberately. A Telegram outage must not read as an unhealthy container and get it restarted into
|
|
450
|
+
the same outage, so the probe answers "can it serve a turn" rather than "is everything connected".
|
|
451
|
+
Channel state lives on the agent resource instead.
|
|
452
|
+
|
|
453
|
+
Measured on an arm64 Docker Desktop, 2026-09-17, after the base-image change: the image is
|
|
454
|
+
**570 MB** against a 700 MB ceiling and `docker compose up -d --wait` reaches healthy in **5.7 s** —
|
|
455
|
+
the same as before, because readiness is tens of milliseconds in-process and almost all of that is
|
|
456
|
+
waiting for the first healthcheck probe. Where the size goes: 109 MB debian-slim, 180 MB of apt
|
|
457
|
+
packages (of which `git` alone is **92 MB**, because Debian's git pulls perl), 47 MB of `uv`, and
|
|
458
|
+
85 MB of compiled binary. `git` is the price of glibc and glibc is the price of Python wheels that
|
|
459
|
+
install rather than compile. The healthcheck reports healthy, an
|
|
460
|
+
unauthenticated write is refused with 401, `store.db` lands on the home volume owned by uid 1000,
|
|
461
|
+
and a real streaming turn against DeepSeek reconstructs from 26 `model.chunk` frames. The CI
|
|
462
|
+
`docker` job rebuilds and re-measures on every push, because a figure nobody re-checks is a figure
|
|
463
|
+
about one afternoon.
|
|
464
|
+
|
|
465
|
+
Two notes on reading those numbers. The size is `docker image inspect --format '{{.Size}}'`, which
|
|
466
|
+
is what the CI gate uses; `docker images` prints **180 MB** for the same image on the same machine,
|
|
467
|
+
a different accounting, so check which one a figure came from before treating it as a regression.
|
|
468
|
+
And the boot happened with a **deliberately invalid** model key — no network I/O before
|
|
469
|
+
`runtime.ready` is the rule this project exists for, and a container reaching healthy on a fake
|
|
470
|
+
credential is that rule visible from outside.
|
|
471
|
+
|
|
472
|
+
## Development
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
bun install
|
|
476
|
+
bun run build # bun build + tsc --emitDeclarationOnly
|
|
477
|
+
bun test
|
|
478
|
+
bun run test:node # core only, under Node's runner — proves the sqlite adapter
|
|
479
|
+
bun run lint # biome, not eslint or prettier
|
|
480
|
+
bun run typecheck
|
|
481
|
+
bun run check:deps # core imports nothing from a sibling package
|
|
482
|
+
bun run bench:boot # must stay under 1000 ms
|
|
483
|
+
bun run bench:schedule # 100 schedules on one timer — reports drift, does not assert it
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Requires Bun. Node 24+ is supported as a soft goal, tested in CI, never a merge blocker.
|
|
487
|
+
|
|
488
|
+
A few house rules that bite first, all enforced by tests rather than review:
|
|
489
|
+
|
|
490
|
+
- **The product name appears in exactly one source file.** No directory, type or variable contains it,
|
|
491
|
+
so a rename stays one commit — use `scripts/rename-brand.ts`, never a hand edit.
|
|
492
|
+
- **`packages/core` imports nothing from a sibling package.** `check:deps` fails the build.
|
|
493
|
+
- **No `any`.** Prefer `Record<string, unknown>`, and a real interface over both.
|
|
494
|
+
- **Every error carries a `hint`.** A new error type without one fails review — the expensive part of a
|
|
495
|
+
failure is almost never the failure, it is that the failure did not say what was wrong.
|
|
496
|
+
- **Nothing fails silently and exits 0.**
|
|
497
|
+
- **Tests are required for `packages/core`.** A harness is a state machine, a scheduler and a tool
|
|
498
|
+
executor; those break in ways manual exercise does not reach.
|
|
499
|
+
|
|
500
|
+
`CLAUDE.md` is the standing brief — it is written for coding agents and is the fastest way to learn
|
|
501
|
+
the hazards this codebase has already paid for. `docs/00-DECISIONS.md` has the rationale for every
|
|
502
|
+
locked decision, including the negative ones, which are the ones most likely to look like mistakes.
|
|
503
|
+
|
|
504
|
+
## Boot budget
|
|
505
|
+
|
|
506
|
+
Process start → `runtime.ready` in under **1000 ms**, enforced in CI at 1200 ms.
|
|
507
|
+
|
|
508
|
+
Measured at **~53 ms** — 37 ms of interpreter and imports, 16 ms inside `Runtime.create` — and
|
|
509
|
+
checked on every phase rather than at the end:
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
bun run bench:boot
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
Reported with the machine state it was taken on, because without that a boot number is a number
|
|
516
|
+
about somebody's afternoon: the figure above is a 7-run median on an M-series laptop at a load
|
|
517
|
+
average of ~5, and the same tree measured 58 ms with four builds running beside it. The budget has
|
|
518
|
+
three orders of magnitude of headroom, so the reason to say this is not the arithmetic — it is that
|
|
519
|
+
a regression is only visible against a figure you can reproduce.
|
|
520
|
+
|
|
521
|
+
This single number is why the project exists: the runtime it replaces spends roughly four minutes on
|
|
522
|
+
network calls during hook initialisation. Nothing here touches the network before readiness.
|
|
523
|
+
|
|
524
|
+
If you ever see a boot in the tens of seconds, check `uptime` before profiling. Twice it has been the
|
|
525
|
+
machine being saturated — once by orphaned shells this runtime had itself failed to reap — and not the
|
|
526
|
+
runtime being slow.
|
|
527
|
+
|
|
528
|
+
## Rebranding
|
|
529
|
+
|
|
530
|
+
The product name lives in exactly one source file, `packages/core/src/brand.ts`, from which
|
|
531
|
+
the env var prefix, state directory, npm scope, and manifest `apiVersion` are all derived:
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
bun scripts/rename-brand.ts acme --dry
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
## Plugin security posture
|
|
538
|
+
|
|
539
|
+
Stated plainly, because the alternative is someone assuming otherwise:
|
|
540
|
+
|
|
541
|
+
> Dispach plugins run in-process with full privileges. The `permissions` block is
|
|
542
|
+
> documentation, not a sandbox. Install plugins you trust, the same way you treat any npm
|
|
543
|
+
> dependency. Real isolation requires separate processes or V8 isolates, both of which cost
|
|
544
|
+
> the startup time and simplicity this project exists to preserve. If you need to run
|
|
545
|
+
> untrusted plugin code, run the whole agent in a container and treat that as the boundary.
|
|
546
|
+
|
|
547
|
+
`dispach plugins <manifest>` prints what each plugin registered and what it declared, with that
|
|
548
|
+
last sentence repeated above the list. Declaring accurately costs nothing today and is the only
|
|
549
|
+
thing that will distinguish a plugin from a scramble when enforcement lands.
|
|
550
|
+
|
|
551
|
+
## Commands
|
|
552
|
+
|
|
553
|
+
`dispach --help` prints this from the same table the parser uses, so the two cannot drift.
|
|
554
|
+
`dispach <command> --help` has the flags.
|
|
555
|
+
|
|
556
|
+
| Command | What it does |
|
|
557
|
+
| --- | --- |
|
|
558
|
+
| `init` | create an agent — manifest, workspace, env, validated before it exits |
|
|
559
|
+
| `run` | an interactive session; bare `run` picks from the sandbox |
|
|
560
|
+
| `serve` | the HTTP API and the agent's channels. The only command that binds a socket |
|
|
561
|
+
| `daemon` | install, start, stop and inspect a background service (macOS) |
|
|
562
|
+
| `stop` | stop everything — services and any loose `serve` |
|
|
563
|
+
| `remove` | delete an agent: directory, sessions, memory, logs, service |
|
|
564
|
+
| `config` | read and change an agent's settings, and fill in its secrets |
|
|
565
|
+
| `sessions` | list stored conversations, or inspect one |
|
|
566
|
+
| `memory` | search what an agent remembers, or rebuild the index |
|
|
567
|
+
| `skills` | browse the catalogues and install, or check one agent's skills |
|
|
568
|
+
| `sources` | the repositories skills come from: list, add, search |
|
|
569
|
+
| `tools` | the resolved tool catalogue, or warm a remote provider's cache |
|
|
570
|
+
| `validate` | load a manifest and report what it resolved to |
|
|
571
|
+
| `workspace` | check the workspace files against the authoring rules |
|
|
572
|
+
| `soul` | scaffold a compact identity file from a long-form one |
|
|
573
|
+
| `agents` | what one or more manifest *paths* produce |
|
|
574
|
+
| `keys` | press a chord and see the bytes, Ink's reading of them, and the intent |
|
|
575
|
+
| `model probe` | ask the endpoint what it can actually do — window, output cap, prompt caching |
|
|
576
|
+
| `terminal-setup` | teach a terminal to send shift+enter as a newline |
|
|
577
|
+
|
|
578
|
+
## Documentation
|
|
579
|
+
|
|
580
|
+
| Doc | Contents |
|
|
581
|
+
| --- | --- |
|
|
582
|
+
| `docs/00-DECISIONS.md` | Every locked decision, with rationale |
|
|
583
|
+
| `docs/01-ARCHITECTURE.md` | Module map, loop, context assembly, compaction, boot budget |
|
|
584
|
+
| `docs/02-SPEC-MANIFEST.md` | `agent.yaml` — the configuration contract |
|
|
585
|
+
| `docs/03-SPEC-PLUGIN-API.md` | Plugin and middleware contracts |
|
|
586
|
+
| `docs/04-SPEC-WIRE.md` | HTTP/SSE surface and lifecycle event schema |
|
|
587
|
+
| `docs/05-PLAN.md` | Every phase with acceptance criteria, and what is ticked |
|
|
588
|
+
| `docs/09-API-GUIDE.md` | The agent server, walked through from `compose up` to a streamed reply |
|
|
589
|
+
| `packages/client/README.md` | The typed client — turns, streams, reattach, typed errors |
|
|
590
|
+
| `docs/07-SPEC-WORKSPACE.md` | Workspace file tiers, budgets, and prompt-style rendering |
|
|
591
|
+
| `CLAUDE.md` | The standing brief: hard rules and the hazards already paid for |
|
|
592
|
+
| `evals/` | Every performance claim, with the number and a script to reproduce it |
|
|
593
|
+
|
|
594
|
+
## License
|
|
595
|
+
|
|
596
|
+
Apache-2.0. Copyright 2026 Moeen Mahmud.
|