dispach 0.1.2 → 0.1.3
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 +134 -85
- package/dist/App-qfqvx9c7.js +11 -0
- package/dist/{App-b1yrwrcq.js.map → App-qfqvx9c7.js.map} +6 -7
- package/dist/ConfigEditor-apcnj4nj.js +6 -0
- package/dist/{ConfigEditor-n8hdw6r7.js.map → ConfigEditor-apcnj4nj.js.map} +2 -2
- package/dist/KeyProbe-ya5t3v3v.js +5 -0
- package/dist/{KeyProbe-9jjeze5r.js.map → KeyProbe-ya5t3v3v.js.map} +2 -2
- package/dist/Picker-b7mn0mjg.js +5 -0
- package/dist/{Picker-hfeh1g6m.js.map → Picker-b7mn0mjg.js.map} +1 -1
- package/dist/SessionPicker-vacfwczg.js +5 -0
- package/dist/{SessionPicker-zyqkg4dn.js.map → SessionPicker-vacfwczg.js.map} +2 -2
- package/dist/SkillBrowser-66ntwaa9.js +5 -0
- package/dist/{SkillBrowser-3qdp8080.js.map → SkillBrowser-66ntwaa9.js.map} +1 -1
- package/dist/WizardApp-123998yh.js +5 -0
- package/dist/{WizardApp-vzpbydy3.js.map → WizardApp-123998yh.js.map} +3 -3
- package/dist/agents.d.ts +19 -3
- package/dist/agents.d.ts.map +1 -1
- package/dist/channels-q4fwqq87.js +31 -0
- package/dist/channels-q4fwqq87.js.map +10 -0
- package/dist/channels.d.ts +26 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/client.js +10 -10
- package/dist/client.js.map +3 -3
- package/dist/config-64q4mgxc.js +24 -0
- package/dist/{config-g7za9x13.js.map → config-64q4mgxc.js.map} +2 -2
- package/dist/{credential-npr6z8c8.js → credential-2sj7vsmw.js} +5 -5
- package/dist/{credential-npr6z8c8.js.map → credential-2sj7vsmw.js.map} +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/index-0k3w2mxf.js +6 -0
- package/dist/{index-hwpvhaza.js.map → index-0k3w2mxf.js.map} +1 -1
- package/dist/index-1s81qstp.js +6 -0
- package/dist/{index-v8e92nfw.js.map → index-1s81qstp.js.map} +1 -1
- package/dist/index-2rycma8x.js +12 -0
- package/dist/{index-258d8bzg.js.map → index-2rycma8x.js.map} +4 -3
- package/dist/index-2zye08c4.js +6 -0
- package/dist/{index-vgc3y3rm.js.map → index-2zye08c4.js.map} +2 -2
- package/dist/{index-gme2egyq.js → index-3km1jwh7.js} +4 -4
- package/dist/{index-gme2egyq.js.map → index-3km1jwh7.js.map} +1 -1
- package/dist/index-3mtgcvkq.js +429 -0
- package/dist/index-3mtgcvkq.js.map +11 -0
- package/dist/index-4knb5vjm.js +90 -0
- package/dist/index-4knb5vjm.js.map +13 -0
- package/dist/{index-3g3ny01d.js → index-5nwwekk0.js} +4 -4
- package/dist/{index-3g3ny01d.js.map → index-5nwwekk0.js.map} +1 -1
- package/dist/index-5rm7dwq4.js +6 -0
- package/dist/index-5rm7dwq4.js.map +11 -0
- package/dist/index-79epttpm.js +6 -0
- package/dist/index-79epttpm.js.map +10 -0
- package/dist/{index-4cf6v9nb.js → index-7yk1zvds.js} +4 -4
- package/dist/{index-4cf6v9nb.js.map → index-7yk1zvds.js.map} +1 -1
- package/dist/index-81gb4ey4.js +6 -0
- package/dist/{index-4z7axw4r.js.map → index-81gb4ey4.js.map} +1 -1
- package/dist/index-8a5d8sfe.js +6 -0
- package/dist/{index-0d93hyfc.js.map → index-8a5d8sfe.js.map} +1 -1
- package/dist/index-a21zyy54.js +6 -0
- package/dist/index-a21zyy54.js.map +9 -0
- package/dist/index-b6da6c16.js +92 -0
- package/dist/index-b6da6c16.js.map +15 -0
- package/dist/index-byxrc961.js +903 -0
- package/dist/{index-tv4yv7d2.js.map → index-byxrc961.js.map} +16 -15
- package/dist/{index-ammv5st7.js → index-cgfg6t5a.js} +6 -6
- package/dist/{index-ammv5st7.js.map → index-cgfg6t5a.js.map} +1 -1
- package/dist/{index-s9mbq7h6.js → index-ehzwdnc3.js} +4 -4
- package/dist/{index-s9mbq7h6.js.map → index-ehzwdnc3.js.map} +1 -1
- package/dist/index-fzmmhmk2.js +7 -0
- package/dist/index-fzmmhmk2.js.map +11 -0
- package/dist/index-g3pk0kc0.js +6 -0
- package/dist/{index-9r0wyj6w.js.map → index-g3pk0kc0.js.map} +2 -2
- package/dist/index-h828nk24.js +153 -0
- package/dist/index-h828nk24.js.map +20 -0
- package/dist/{index-02dn6m2j.js → index-jq999vcw.js} +5 -5
- package/dist/{index-02dn6m2j.js.map → index-jq999vcw.js.map} +2 -2
- package/dist/index-k2aq5bg0.js +9 -0
- package/dist/{index-6p999cx4.js.map → index-k2aq5bg0.js.map} +4 -6
- package/dist/{index-cqqb6gaq.js → index-k3y8y3wj.js} +5 -5
- package/dist/{index-cqqb6gaq.js.map → index-k3y8y3wj.js.map} +1 -1
- package/dist/index-k59wwdgz.js +9 -0
- package/dist/{index-ff514z3y.js.map → index-k59wwdgz.js.map} +3 -5
- package/dist/index-nmnnwa02.js +6 -0
- package/dist/{index-6q4wf8e3.js.map → index-nmnnwa02.js.map} +1 -1
- package/dist/index-nn3tk25c.js +6 -0
- package/dist/{index-d4x6yvqh.js.map → index-nn3tk25c.js.map} +3 -4
- package/dist/index-q0hxh57v.js +126 -0
- package/dist/index-q0hxh57v.js.map +14 -0
- package/dist/index-srmhk9g5.js +11 -0
- package/dist/index-srmhk9g5.js.map +11 -0
- package/dist/index-swtyfhha.js +6 -0
- package/dist/{index-fex44816.js.map → index-swtyfhha.js.map} +2 -2
- package/dist/index-whq42sat.js +6 -0
- package/dist/{index-h9mw7b9d.js.map → index-whq42sat.js.map} +1 -1
- package/dist/{index-j7gyr5nx.js → index-wzsmh5j0.js} +7 -7
- package/dist/{index-j7gyr5nx.js.map → index-wzsmh5j0.js.map} +1 -1
- package/dist/{index-j55s3ehk.js → index-x7v1zq89.js} +7 -7
- package/dist/{index-j55s3ehk.js.map → index-x7v1zq89.js.map} +2 -2
- package/dist/index-xhzmv4dh.js +66 -0
- package/dist/index-xhzmv4dh.js.map +12 -0
- package/dist/index-xmv47vs0.js +6 -0
- package/dist/{index-gz9x25tz.js.map → index-xmv47vs0.js.map} +2 -2
- package/dist/index-y4c32wn7.js +6 -0
- package/dist/{index-qdbq8crg.js.map → index-y4c32wn7.js.map} +2 -2
- package/dist/index-yjcdp72k.js +6 -0
- package/dist/{index-tf71ap9v.js.map → index-yjcdp72k.js.map} +1 -1
- package/dist/index-zn24991r.js +6 -0
- package/dist/index-zn24991r.js.map +10 -0
- package/dist/index.js +374 -443
- package/dist/index.js.map +23 -27
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/channel-actions.d.ts +103 -0
- package/dist/lib/channel-actions.d.ts.map +1 -0
- package/dist/lib/chat-frame.d.ts +12 -1
- package/dist/lib/chat-frame.d.ts.map +1 -1
- package/dist/lib/commands.d.ts +13 -0
- package/dist/lib/commands.d.ts.map +1 -1
- package/dist/lib/const.d.ts +1 -1
- package/dist/lib/host-actions.d.ts +121 -0
- package/dist/lib/host-actions.d.ts.map +1 -0
- package/dist/lib/init-flow.d.ts +32 -0
- package/dist/lib/init-flow.d.ts.map +1 -1
- package/dist/lib/init-whatsapp.d.ts +52 -0
- package/dist/lib/init-whatsapp.d.ts.map +1 -0
- package/dist/lib/plugin-install.d.ts +120 -0
- package/dist/lib/plugin-install.d.ts.map +1 -0
- package/dist/lib/providers.d.ts.map +1 -1
- package/dist/lib/provision.d.ts.map +1 -1
- package/dist/lib/readme-table.d.ts +15 -0
- package/dist/lib/readme-table.d.ts.map +1 -0
- package/dist/lib/sandbox.d.ts +15 -0
- package/dist/lib/sandbox.d.ts.map +1 -1
- package/dist/lib/schema.d.ts +34 -1
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/subcommand.d.ts.map +1 -1
- package/dist/lib/web-url.d.ts +15 -0
- package/dist/lib/web-url.d.ts.map +1 -0
- package/dist/lib/wizard.d.ts.map +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/plugins.d.ts +27 -8
- package/dist/plugins.d.ts.map +1 -1
- package/dist/restart.d.ts +21 -0
- package/dist/restart.d.ts.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/schedules.d.ts.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/sessions.d.ts.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/status.d.ts +16 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/web-923c7f5e.js +14 -0
- package/dist/{web-vkb16r62.js.map → web-923c7f5e.js.map} +3 -3
- package/dist/web.d.ts +2 -13
- package/dist/web.d.ts.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/wrapper-0w9b3my0.js +11 -0
- package/dist/wrapper-0w9b3my0.js.map +23 -0
- package/package.json +6 -3
- package/dist/App-b1yrwrcq.js +0 -11
- package/dist/ConfigEditor-n8hdw6r7.js +0 -6
- package/dist/KeyProbe-9jjeze5r.js +0 -5
- package/dist/Picker-hfeh1g6m.js +0 -5
- package/dist/SessionPicker-zyqkg4dn.js +0 -5
- package/dist/SkillBrowser-3qdp8080.js +0 -5
- package/dist/WizardApp-vzpbydy3.js +0 -5
- package/dist/config-g7za9x13.js +0 -24
- package/dist/index-0d93hyfc.js +0 -6
- package/dist/index-1c5113t4.js +0 -66
- package/dist/index-1c5113t4.js.map +0 -12
- package/dist/index-258d8bzg.js +0 -12
- package/dist/index-4z7axw4r.js +0 -6
- package/dist/index-6p999cx4.js +0 -9
- package/dist/index-6q4wf8e3.js +0 -6
- package/dist/index-9r0wyj6w.js +0 -6
- package/dist/index-d4x6yvqh.js +0 -6
- package/dist/index-fecm8xe7.js +0 -77
- package/dist/index-fecm8xe7.js.map +0 -12
- package/dist/index-fex44816.js +0 -6
- package/dist/index-ff514z3y.js +0 -14
- package/dist/index-gz9x25tz.js +0 -6
- package/dist/index-h9mw7b9d.js +0 -6
- package/dist/index-hwpvhaza.js +0 -6
- package/dist/index-mtn0g9vc.js +0 -7
- package/dist/index-mtn0g9vc.js.map +0 -11
- package/dist/index-qdbq8crg.js +0 -6
- package/dist/index-tf71ap9v.js +0 -6
- package/dist/index-ttwyrdjs.js +0 -427
- package/dist/index-ttwyrdjs.js.map +0 -11
- package/dist/index-tv4yv7d2.js +0 -903
- package/dist/index-ty24n0jh.js +0 -167
- package/dist/index-ty24n0jh.js.map +0 -19
- package/dist/index-v8e92nfw.js +0 -6
- package/dist/index-vgc3y3rm.js +0 -6
- package/dist/index-whaw4b18.js +0 -6
- package/dist/index-whaw4b18.js.map +0 -10
- package/dist/web-vkb16r62.js +0 -14
package/README.md
CHANGED
|
@@ -4,15 +4,16 @@ A lightweight, model-agnostic AI agent runtime.
|
|
|
4
4
|
|
|
5
5
|
Dispach turns a stateless OpenAI-compatible `/chat/completions` endpoint into an agent that
|
|
6
6
|
uses tools, remembers across sessions, acts on your machine under a policy you set, lives in
|
|
7
|
-
messaging channels, runs on a schedule, and delegates to other agents.
|
|
8
|
-
Apache-2.0.
|
|
7
|
+
messaging channels, runs on a schedule, and delegates to other agents. TypeScript, built with Bun
|
|
8
|
+
and shipped on Node, Apache-2.0.
|
|
9
9
|
|
|
10
10
|
> To dispatch is to send a thing on its way with the authority to see it done — to decide
|
|
11
11
|
> what handles it, hand it over, and answer for the result.
|
|
12
12
|
|
|
13
13
|
## Status
|
|
14
14
|
|
|
15
|
-
**Pre-release, and it runs.** Install
|
|
15
|
+
**Pre-release, and it runs.** Install from npm, Homebrew or the container image, or work from a
|
|
16
|
+
checkout (all below). Every install runs under Node.
|
|
16
17
|
|
|
17
18
|
Built and in use: the manifest and agent loop, the store and sessions, tools with the NLT and
|
|
18
19
|
native dialects, the tiered workspace, system and web tool providers with a policy engine, the
|
|
@@ -106,17 +107,16 @@ so there is one thing to install, one thing to version and one thing to trust. `
|
|
|
106
107
|
pulls in no terminal UI — asserted by the package's own tests, because an HTTP client has no
|
|
107
108
|
business paying the ~170-210 ms that importing Ink and React costs.
|
|
108
109
|
|
|
109
|
-
### Or
|
|
110
|
-
|
|
111
|
-
One file, no Node and no `node_modules`. `bun build --compile` embeds the runtime, which is also
|
|
112
|
-
why it starts *faster* than a `node_modules` install — there is no module resolution left to do at
|
|
113
|
-
boot. Measured on an M-series mac, `validate --json`: **70–90 ms compiled against 90–110 ms through
|
|
114
|
-
Node**.
|
|
110
|
+
### Or with Homebrew
|
|
115
111
|
|
|
116
112
|
```bash
|
|
117
113
|
brew install moeen-mahmud/tap/dispach
|
|
118
114
|
```
|
|
119
115
|
|
|
116
|
+
The formula depends on `node` and installs the same npm tarball, so a brew install and an npm
|
|
117
|
+
install run identical code — one runtime, one artefact to checksum. (Until 0.1.3 the formula shipped
|
|
118
|
+
a Bun-compiled binary, and Bun cannot complete the WhatsApp handshake; see below.)
|
|
119
|
+
|
|
120
120
|
The name is fully qualified on purpose. Homebrew taps from it with no separate `brew tap`, and
|
|
121
121
|
naming a formula in full is *itself* what Homebrew accepts as consent to load a third-party tap —
|
|
122
122
|
`brew install dispach` after a plain `brew tap moeen-mahmud/tap` is the same install and refuses
|
|
@@ -124,30 +124,15 @@ until `brew trust moeen-mahmud/tap` is run, because a bare name carries no such
|
|
|
124
124
|
|
|
125
125
|
`brew services start dispach` then runs the always-on server; `brew info` prints the rest.
|
|
126
126
|
|
|
127
|
-
Or
|
|
128
|
-
`linux-arm64`, each with a `.sha256` beside it:
|
|
127
|
+
### Or the container
|
|
129
128
|
|
|
130
129
|
```bash
|
|
131
|
-
|
|
132
|
-
curl -fsSL -O "$base/dispach-darwin-arm64"
|
|
133
|
-
curl -fsSL -O "$base/dispach-darwin-arm64.sha256"
|
|
134
|
-
shasum -a 256 -c dispach-darwin-arm64.sha256 # must print "OK"
|
|
135
|
-
chmod +x dispach-darwin-arm64
|
|
136
|
-
sudo mv dispach-darwin-arm64 /usr/local/bin/dispach
|
|
130
|
+
docker pull ghcr.io/moeen-mahmud/dispach:0.1.3
|
|
137
131
|
```
|
|
138
132
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Two things worth knowing about the macOS asset, because the failure has no error message:
|
|
143
|
-
|
|
144
|
-
- **The release binary is ad-hoc signed, and it has to be.** A compiled Bun binary arrives
|
|
145
|
-
*linker-signed*, which macOS refuses on exec — **exit 137 with no output at all**, which reads as
|
|
146
|
-
a crash rather than as a policy. `codesign -dv` reports such a file as signed, so the obvious
|
|
147
|
-
check passes on a binary that cannot run. The release re-signs every darwin asset, and
|
|
148
|
-
`scripts/build-binary.ts` refuses to produce an unsigned one.
|
|
149
|
-
- **Gatekeeper still applies to a downloaded file.** A binary fetched with a browser carries a
|
|
150
|
-
quarantine attribute; `xattr -d com.apple.quarantine dispach` clears it. `curl` does not set it.
|
|
133
|
+
The [Docker](#docker) and [Compose](#hosting-with-compose) sections below have the run lines and
|
|
134
|
+
the reasons behind them. The image is `node:24-trixie-slim` with `git`, `python3`, `uv` and `jq`,
|
|
135
|
+
because the agent has a shell.
|
|
151
136
|
|
|
152
137
|
### Or from a checkout
|
|
153
138
|
|
|
@@ -175,8 +160,8 @@ Four things that are not obvious:
|
|
|
175
160
|
`tools-system`, `tools-web`, `tools-composio` and `channel-telegram` from their `dist`, so building
|
|
176
161
|
only `core` and `cli` leaves the binary running yesterday's provider code — and the symptom is the
|
|
177
162
|
worst kind: your change is correct, a test fails, and the stack trace points into a stale `dist`.
|
|
178
|
-
- **Node 24+ must be on your `PATH`.** The built
|
|
179
|
-
it and Node runs it.
|
|
163
|
+
- **Node 24+ must be on your `PATH`.** The built entry's shebang is `#!/usr/bin/env node`; Bun builds
|
|
164
|
+
it and Node runs it — the same runtime every install ships.
|
|
180
165
|
- **`DISPACH_HOME` relocates the whole sandbox.** Point it at a temporary directory and every agent,
|
|
181
166
|
the store and the logs go there instead of `~/.dispach` — which is how to try things out, and how
|
|
182
167
|
every test in this repo avoids touching a real one.
|
|
@@ -306,13 +291,17 @@ connects a channel, because a REPL that quietly started answering Telegram while
|
|
|
306
291
|
would be a surprise — and because a messaging provider allows exactly one listener per token, so
|
|
307
292
|
the two would fight over your bot.
|
|
308
293
|
|
|
309
|
-
`serve` still dies with its terminal.
|
|
294
|
+
`serve` still dies with its terminal. So `init` asks whether to keep it running — the default is
|
|
295
|
+
yes — and puts the service up itself: one service hosts every agent in the sandbox, and the agent
|
|
296
|
+
just written is adopted by it before the wizard finishes. By hand, and afterwards:
|
|
310
297
|
|
|
311
298
|
```bash
|
|
312
|
-
dispach daemon install
|
|
313
|
-
dispach
|
|
314
|
-
dispach
|
|
315
|
-
dispach
|
|
299
|
+
dispach daemon install # one service for every agent; checks it will boot first
|
|
300
|
+
dispach status # the service, every agent, every channel — one screen
|
|
301
|
+
dispach restart milo # reload one agent in place, after editing agent.yaml or .env
|
|
302
|
+
dispach restart # the whole service
|
|
303
|
+
dispach logs -f # the server's stderr; the same as `daemon logs`
|
|
304
|
+
dispach agents # what the sandbox holds and who is serving it
|
|
316
305
|
```
|
|
317
306
|
|
|
318
307
|
If you want everything off — services *and* a `serve` you left in a tab three days ago — there is
|
|
@@ -338,12 +327,12 @@ plaintext to any local process, so the agent reads its credentials from the `.en
|
|
|
338
327
|
manifest — which `init` writes `0600` — and the plist carries only `HOME`, `PATH` and the two brand
|
|
339
328
|
variables.
|
|
340
329
|
|
|
341
|
-
**Linux and containers.**
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
in flight, and exits 0.
|
|
330
|
+
**Linux and containers.** On Linux `daemon install` writes a systemd **user** unit and prints the
|
|
331
|
+
two commands that start it — it does not run them, because nothing in this project's test
|
|
332
|
+
environment can execute `systemctl`, and a unit nobody has started is how a "supported" platform
|
|
333
|
+
turns out not to be. Mind `loginctl enable-linger`, or the unit stops with your last session. In a
|
|
334
|
+
container, the image's own `serve` is the process and the container runtime supervises it — it
|
|
335
|
+
handles SIGTERM, finishes the delivery in flight, and exits 0.
|
|
347
336
|
|
|
348
337
|
## Hosting with Compose
|
|
349
338
|
|
|
@@ -477,8 +466,8 @@ fenced as untrusted. What the agent's shell can reach is `sh`, `bash`, `git`, `p
|
|
|
477
466
|
and `curl` — `git` because the skills catalogue is fetched with it and its absence *deletes* that
|
|
478
467
|
feature rather than degrading it, `python3` and `uv` because a skill shipping scripts needs them.
|
|
479
468
|
|
|
480
|
-
What is **absent on purpose**, and asserted as such: no Bun
|
|
481
|
-
|
|
469
|
+
What is **absent on purpose**, and asserted as such: no Bun — the application is the published npm
|
|
470
|
+
package running under Node, exactly what a laptop runs; no `wget`, so there is one obvious HTTP client rather than two; and no pager
|
|
482
471
|
and no editor, because `exec` hands a child a file descriptor and never a TTY — anything that pages
|
|
483
472
|
or prompts blocks until its deadline and reads as a hung agent. The CI `docker` job asserts both
|
|
484
473
|
lists, that the image is glibc, that a C-extension wheel installs with no compiler present, that a
|
|
@@ -505,13 +494,13 @@ consequence: run it on a laptop and the policy is the only boundary there is.
|
|
|
505
494
|
## Docker
|
|
506
495
|
|
|
507
496
|
```bash
|
|
508
|
-
docker build -f docker/Dockerfile -t dispach .
|
|
497
|
+
docker pull ghcr.io/moeen-mahmud/dispach:0.1.3 # or build it: docker build -f docker/Dockerfile -t dispach .
|
|
509
498
|
docker run --rm -p 7420:7420 \
|
|
510
499
|
--env-file examples/minimal/.env \
|
|
511
500
|
-e DISPACH_API_TOKEN=pick-something \
|
|
512
501
|
-v "$PWD/examples/minimal:/agent" \
|
|
513
502
|
-v dispach-home:/home/dispach \
|
|
514
|
-
dispach
|
|
503
|
+
ghcr.io/moeen-mahmud/dispach:0.1.3
|
|
515
504
|
```
|
|
516
505
|
|
|
517
506
|
The token is not optional and is not boilerplate. The image binds `0.0.0.0`, because a process
|
|
@@ -525,8 +514,10 @@ as anything `dispach init` creates inside the container. There is **one agents d
|
|
|
525
514
|
there was not before: the image used to set `DISPACH_HOME=/state`, so `init` wrote to `/state/agents`
|
|
526
515
|
while the CMD served `/agent`, and an agent created in the container was invisible to every listing.
|
|
527
516
|
|
|
528
|
-
The image is `
|
|
529
|
-
|
|
517
|
+
The image is `node:24-trixie-slim` and the runtime stage installs **the published npm tarball** with
|
|
518
|
+
`npm i -g` — the container runs byte-for-byte what `npm i -g dispach` runs on a laptop. No Bun: it
|
|
519
|
+
is the dev toolchain, and the runtime that cannot finish a WhatsApp pairing. glibc rather than musl
|
|
520
|
+
is deliberate and is about Python: PyPI's
|
|
530
521
|
C-extension wheels are `manylinux`, so on alpine anything without a `musllinux` build compiles from
|
|
531
522
|
source, and this image ships no compiler — a wheel would fail *inside a tool call*. Non-root as
|
|
532
523
|
`dispach` (uid 1000) — **a host directory bind-mounted at `/home/dispach` has to be writable by
|
|
@@ -538,15 +529,14 @@ deliberately. A Telegram outage must not read as an unhealthy container and get
|
|
|
538
529
|
the same outage, so the probe answers "can it serve a turn" rather than "is everything connected".
|
|
539
530
|
Channel state lives on the agent resource instead.
|
|
540
531
|
|
|
541
|
-
Measured on an arm64 Docker Desktop: the image is **
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
install rather than compile. The healthcheck reports healthy, an
|
|
532
|
+
Measured on an arm64 Docker Desktop at 0.1.3: the image is **701 MB** against an 800 MB ceiling,
|
|
533
|
+
and `docker compose up -d --wait` reaches healthy in about six seconds — readiness is tens of
|
|
534
|
+
milliseconds in-process and almost all of that is waiting for the first healthcheck probe. Where the
|
|
535
|
+
size goes: 110 MB Debian, 160 MB of Node (with npm and corepack, kept so the agent's shell has a
|
|
536
|
+
Node toolchain), 158 MB of apt packages (of which `git` alone is **92 MB**, because Debian's git
|
|
537
|
+
pulls perl), 47 MB of `uv`, and 58 MB for the installed package with `ink` and `react`. Node costs
|
|
538
|
+
about 75 MB more than the compiled binary it replaced in 0.1.3, and buys the one thing the binary
|
|
539
|
+
could not do: pair WhatsApp. The healthcheck reports healthy, an
|
|
550
540
|
unauthenticated write is refused with 401, `store.db` lands on the home volume owned by uid 1000,
|
|
551
541
|
and a real streaming turn against DeepSeek reconstructs from 26 `model.chunk` frames. The CI
|
|
552
542
|
`docker` job rebuilds and re-measures on every push, because a figure nobody re-checks is a figure
|
|
@@ -634,43 +624,101 @@ Stated plainly, because the alternative is someone assuming otherwise:
|
|
|
634
624
|
> the startup time and simplicity this project exists to preserve. If you need to run
|
|
635
625
|
> untrusted plugin code, run the whole agent in a container and treat that as the boundary.
|
|
636
626
|
|
|
637
|
-
`dispach plugins <
|
|
627
|
+
`dispach plugins list <agent>` prints what each plugin registered and what it declared, with that
|
|
638
628
|
last sentence repeated above the list. Declaring accurately costs nothing today and is the only
|
|
639
629
|
thing that will distinguish a plugin from a scramble when enforcement lands.
|
|
640
630
|
|
|
631
|
+
### WhatsApp
|
|
632
|
+
|
|
633
|
+
Bundled, like Telegram — no `plugins add` step. But read this first: Baileys reverse-engineers
|
|
634
|
+
WhatsApp Web, WhatsApp's terms do not permit it, and there is no appeal path when a number is
|
|
635
|
+
banned — including during development. **Pair a spare number.**
|
|
636
|
+
|
|
637
|
+
`init --whatsapp connected --whatsapp-number <digits>` writes the channel with `pairWith` set to the
|
|
638
|
+
account's own number; pairing is then an eight-character code typed into the phone under *Linked
|
|
639
|
+
devices › Link with phone number*, offered where the number was typed. Afterwards:
|
|
640
|
+
|
|
641
|
+
```bash
|
|
642
|
+
dispach channels pair milo wa # start a host if none is up, adopt milo, show the code, wait
|
|
643
|
+
dispach channels list milo # what it is reachable on, and whether it is paired
|
|
644
|
+
dispach channels unpair milo wa # forget the session
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
`pairWith` is the account the agent *runs as*; `allowFrom` is who may message it, and the paired
|
|
648
|
+
account is always admitted — `allowFrom` means who *else*. Numbers take a `+` and separators
|
|
649
|
+
anywhere they are typed.
|
|
650
|
+
|
|
651
|
+
`deviceName: milo` on the channel shows as `Google Chrome (milo)` under Linked devices. The left
|
|
652
|
+
half is fixed by the protocol; the bracket is yours. Some accounts refuse a non-standard name under
|
|
653
|
+
pairing-by-code — the refusal says so, and removing the field fixes it. New pairings only.
|
|
654
|
+
|
|
655
|
+
**It pairs under Node and not under Bun**, measured against the same bundle, which is why every
|
|
656
|
+
install of `dispach` runs under Node since 0.1.3. From a checkout under `bun run` the channel says
|
|
657
|
+
so at start rather than connecting to nothing in silence.
|
|
658
|
+
|
|
659
|
+
### Installing one
|
|
660
|
+
|
|
661
|
+
```bash
|
|
662
|
+
dispach plugins add <agent> moeen-mahmud/some-plugin --ref v1.0.0
|
|
663
|
+
dispach plugins list <agent>
|
|
664
|
+
dispach plugins remove <agent> some-plugin
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
`add` clones with git into `~/.dispach/plugins/<name>/`, loads it there to read its declarations,
|
|
668
|
+
prints them, and only then writes the `plugins:` entry — because a manifest naming a plugin that
|
|
669
|
+
will not load *does not load*, so writing the entry first would brick the agent and report success.
|
|
670
|
+
The verification is the same `conformance()` suite the plugin's own author runs.
|
|
671
|
+
|
|
672
|
+
**A plugin is one self-contained bundle.** Nothing is installed while this runtime runs (hard rule
|
|
673
|
+
5), so a tree that declares runtime dependencies and ships no `node_modules` is refused by name
|
|
674
|
+
rather than half-loading at your next boot. That rule is what makes the npm install and the
|
|
675
|
+
container — whose `node_modules` holds only the two declared dependencies — resolve a plugin
|
|
676
|
+
exactly as a checkout does.
|
|
677
|
+
|
|
678
|
+
What git costs, said rather than discovered: no version resolution and no integrity check. `--ref`
|
|
679
|
+
pins a tag or a commit, the resolved commit is recorded beside the code and printed by `plugins
|
|
680
|
+
list`, and the `dispachApi` gate checks **compatibility, not authenticity** — nothing here verifies
|
|
681
|
+
who published what. A local path is accepted too, which is how you test a bundle before publishing
|
|
682
|
+
it.
|
|
683
|
+
|
|
641
684
|
## Commands
|
|
642
685
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
authority; read this as a map. `dispach <command> --help` has the flags.
|
|
686
|
+
Generated from the same `CommandSpec` table the parser and `dispach --help` use — by
|
|
687
|
+
`bun scripts/readme-commands.ts`, and a test fails when this copy is stale. It used to be
|
|
688
|
+
hand-written, and was missing five commands at once. `dispach <command> --help` has the flags.
|
|
647
689
|
|
|
690
|
+
<!-- commands:begin — generated by scripts/readme-commands.ts; do not edit by hand -->
|
|
648
691
|
| Command | What it does |
|
|
649
692
|
| --- | --- |
|
|
650
|
-
| `init` | create
|
|
651
|
-
| `run` | an interactive session
|
|
652
|
-
| `
|
|
653
|
-
| `
|
|
654
|
-
| `
|
|
655
|
-
| `remove` | delete an agent: directory, sessions, memory, logs, service |
|
|
693
|
+
| `init` | create a new agent: manifest, workspace, and env files |
|
|
694
|
+
| `run` | start an interactive session — bare `run` picks from the sandbox |
|
|
695
|
+
| `schedules` | list schedules, when they next fire, and how the last run went |
|
|
696
|
+
| `sessions` | list stored sessions, or inspect one |
|
|
697
|
+
| `memory` | search what the agent remembers, or rebuild the index from the files |
|
|
656
698
|
| `config` | read and change an agent's settings, and fill in its secrets |
|
|
657
|
-
| `
|
|
658
|
-
| `web` | open the browser view of a running agent |
|
|
659
|
-
| `schedules` | what runs unattended: when each fires next, and how the last run went |
|
|
660
|
-
| `sessions` | list stored conversations, or inspect one |
|
|
661
|
-
| `memory` | search what an agent remembers, or rebuild the index |
|
|
662
|
-
| `skills` | browse the catalogues and install, or check one agent's skills |
|
|
663
|
-
| `sources` | the repositories skills come from: list, add, search |
|
|
664
|
-
| `tools` | the resolved tool catalogue, or warm a remote provider's cache |
|
|
665
|
-
| `plugins` | what each plugin this agent loaded registered, and what it declared |
|
|
666
|
-
| `credential` | mint, list and revoke operator keys for the API, optionally scoped |
|
|
667
|
-
| `validate` | load a manifest and report what it resolved to |
|
|
699
|
+
| `validate` | load and validate a manifest, then exit |
|
|
668
700
|
| `workspace` | check the workspace files against the authoring rules |
|
|
669
|
-
| `soul` | scaffold a compact identity
|
|
670
|
-
| `
|
|
671
|
-
| `
|
|
672
|
-
| `
|
|
673
|
-
| `
|
|
701
|
+
| `soul` | scaffold a hand-edited compact identity from a long-form document |
|
|
702
|
+
| `skills` | browse the catalogue and install — or list, scaffold, check one agent's skills |
|
|
703
|
+
| `sources` | the repositories skills come from: list, add, search |
|
|
704
|
+
| `channels` | what an agent is reachable on: connect, disconnect, set a credential, unpair |
|
|
705
|
+
| `plugins` | install a plugin, list what an agent loaded, or remove one |
|
|
706
|
+
| `agents` | the agents in the sandbox, and whether anything is serving them |
|
|
707
|
+
| `restart` | reload one agent on the running host, or restart the whole service |
|
|
708
|
+
| `status` | the service, the hosts, every agent and its channels — one screen |
|
|
709
|
+
| `logs` | the server's stderr tail — the same as `daemon logs` |
|
|
710
|
+
| `tools` | show the resolved tool catalogue, or fetch a remote provider's schemas into the cache |
|
|
711
|
+
| `serve` | run the HTTP API and connect the agents' channels |
|
|
712
|
+
| `credential` | mint, list and revoke operator credentials, optionally scoped |
|
|
713
|
+
| `keys` | press a chord and see the bytes, Ink's reading of them, and the intent |
|
|
714
|
+
| `terminal-setup` | teach this terminal to send shift+enter as a new line |
|
|
715
|
+
| `remove` | delete a sandbox agent: its directory, sessions, memory, logs and service |
|
|
716
|
+
| `stop` | stop one agent for good, or everything — named, it stays stopped across restarts |
|
|
717
|
+
| `start` | switch an agent back on, and have a running host adopt it now |
|
|
718
|
+
| `model` | ask the endpoint what it can actually do — window, output cap, prompt caching |
|
|
719
|
+
| `web` | open the browser view of a running agent |
|
|
720
|
+
| `daemon` | keep an agent serving in the background — starts at login, restarts on crash |
|
|
721
|
+
<!-- commands:end -->
|
|
674
722
|
|
|
675
723
|
## Documentation
|
|
676
724
|
|
|
@@ -687,7 +735,8 @@ authority; read this as a map. `dispach <command> --help` has the flags.
|
|
|
687
735
|
| `docs/07-SPEC-WORKSPACE.md` | Workspace file tiers, budgets, and prompt-style rendering |
|
|
688
736
|
| `docs/08-MEMORY.md` | How memory is stored, retrieved and injected, with the measured numbers |
|
|
689
737
|
| `docs/12-OPENCLAW-CUTOVER.md` | Moving off the runtime this one replaces |
|
|
690
|
-
|
|
|
738
|
+
| `RELEASING.md` | How a release is cut: the changelog, `bun run release`, and what the tag publishes |
|
|
739
|
+
| `CHANGELOG.md` | What changed in each release, in bullets |
|
|
691
740
|
| `CLAUDE.md` | The standing brief: hard rules and the hazards already paid for |
|
|
692
741
|
| `evals/` | Every performance claim, with the number and a script to reproduce it |
|
|
693
742
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{e,M}from"./index-byxrc961.js";import{o,Mi,ki,I,ce}from"./index-nn3tk25c.js";import{ft,EA,Et}from"./index-g3pk0kc0.js";import{Ce}from"./index-1s81qstp.js";import{_t}from"./index-k3y8y3wj.js";import{Yt,Jt}from"./index-jq999vcw.js";import{Qo,ho,nt,ot,TA,IA,ln,wo,xn,it,mo,Yn,So,Mo}from"./index-2rycma8x.js";import{ge}from"./index-8a5d8sfe.js";import"./index-3mtgcvkq.js";import{BA}from"./index-79epttpm.js";import{lA,tt}from"./index-k59wwdgz.js";import"./index-yjcdp72k.js";import"./index-srmhk9g5.js";import{ye}from"./index-ehzwdnc3.js";import{Ln,V}from"./index-whq42sat.js";import"./index-wzsmh5j0.js";import{K,XA,vA,te,Qi,qt,$A}from"./index-x7v1zq89.js";import{D,G}from"./index-zn24991r.js";import{J,en,An,on,Pi,xi,Yi,Ji,ji,Hn,At,qi}from"./index-2zye08c4.js";import{Box as H,Text as Q,useApp as Ft,useInput as Qn}from"ink";import{useCallback as Zn,useEffect as qn,useMemo as et,useRef as Ut,useState as _}from"react";import{Box as Be,Text as de}from"ink";import{jsx as xe,jsxs as le}from"react/jsx-runtime";function an({lines:n,label:t,offset:r,maxRows:i,code:a}){if(n===void 0)return xe(Be,{marginLeft:2,children:xe(Ce,{label:`running ${t}`})});if(n.length===0)return xe(Be,{marginLeft:2,children:le(de,{color:o.muted,children:[t," printed nothing"]})});let{from:s,to:l}=G(n.length,Math.min(r+Math.floor(i/2),n.length-1),i),u=n.slice(s,l).map((m,w)=>({row:s+w,text:m}));return le(Be,{flexDirection:"column",children:[a!==void 0&&a!==0?le(de,{color:o.error,wrap:"truncate",children:[I.error,t," exited ",a]}):null,s>0?le(de,{dimColor:!0,wrap:"truncate",children:[" ",I.ellipsis," ",s," line",s===1?"":"s"," above"]}):null,u.map((m)=>xe(de,{wrap:"truncate",children:m.text},m.row)),l<n.length?le(de,{dimColor:!0,wrap:"truncate",children:[" ",I.ellipsis," ",n.length-l," line",n.length-l===1?"":"s"," ","below"]}):null]})}import{Box as xt,Text as F}from"ink";import{jsx as ue,jsxs as we}from"react/jsx-runtime";function dn({editor:n,width:t,maxRows:r}){let i=n.search;if(i===void 0)return null;let a=XA(n),s=Math.min(i.index,Math.max(0,a.length-1)),{from:l,to:u}=G(a.length,s,r),m=Math.max(8,t-4);return we(xt,{flexDirection:"column",children:[a.length===0?we(F,{color:o.muted,wrap:"truncate",children:[" ","nothing you have sent matches that"]}):a.slice(l,u).map((w,E)=>{let h=l+E===s;return we(F,{wrap:"truncate",children:[ue(F,{color:o.accent,children:h?I.pointer:" "}),ue(F,{bold:h,dimColor:!h,children:D(w.replace(/\s+/g," "),m)})]},w)}),we(F,{wrap:"truncate",children:[ue(F,{color:o.muted,children:" search: "}),i.query,ue(F,{inverse:!0,children:" "}),a.length>1?ue(F,{color:o.muted,children:` ${s+1} of ${a.length}`}):null]})]})}import{Box as gt,Text as cn}from"ink";import{jsxs as $e}from"react/jsx-runtime";function un({live:n,showReasoning:t,columns:r}){let i=t&&n.reasoning!==""&&n.text==="",a=i?n.reasoning:n.text;if(a==="")return null;let s=i?"· reasoning · ":"",l=_t(a,r-[...s].length,en),u=l.lines.map((m,w)=>({at:w,text:m}));return $e(gt,{flexDirection:"column",children:[l.hidden>0?$e(cn,{dimColor:!0,wrap:"truncate",children:["… ",l.hidden," earlier row(s) hidden while streaming"]}):null,u.map((m)=>$e(cn,{dimColor:i,wrap:"truncate",children:[m.at===0?s:"",m.text]},`row-${m.at}`))]})}import{Box as wt,Text as U}from"ink";import{jsx as Ie,jsxs as ie}from"react/jsx-runtime";function bt(n){return n.matches.reduce((t,r)=>Math.max(t,r.word.length),0)}function mn({palette:n,index:t,width:r,maxRows:i}){if(n.matches.length===0)return ie(U,{color:o.muted,wrap:"truncate",children:[" ","no command starts with /",n.query]});let a=Math.min(t,n.matches.length-1),{from:s,to:l}=G(n.matches.length,a,i),u=bt(n),m=Math.max(8,r-(2+u+2));return ie(wt,{flexDirection:"column",children:[s>0?ie(U,{dimColor:!0,wrap:"truncate",children:[" ",I.ellipsis," ",s," above"]}):null,n.matches.slice(s,l).map((w,E)=>{let R=s+E===a;return ie(U,{wrap:"truncate",children:[Ie(U,{color:o.accent,children:R?I.pointer:" "}),Ie(U,{bold:R,...R?{color:o.accent}:{},children:w.word.padEnd(u)})," ",Ie(U,{dimColor:!0,children:D(w.summary,m)})]},w.word)}),l<n.matches.length?ie(U,{dimColor:!0,wrap:"truncate",children:[" ",I.ellipsis," ",n.matches.length-l," below"]}):null,ie(U,{dimColor:!0,wrap:"truncate",children:[" ","↑↓ move · tab complete · enter run · esc close"]})]})}import{Box as fn,Text as yt}from"ink";import{jsx as pn,jsxs as hn}from"react/jsx-runtime";function gn({editor:n,busy:t,placeholder:r,columns:i}){let a=n.value.split(`
|
|
3
|
+
`).length,s=Math.max(1,i-4);return hn(fn,{flexDirection:"column",children:[pn(fn,{borderStyle:ce,borderColor:t?o.border:o.borderActive,width:i,paddingX:1,children:pn(Jt,{editor:n,gutter:An,maxRows:on,columns:s,...r===void 0?{}:{placeholder:r}})}),a>1?hn(yt,{dimColor:!0,wrap:"truncate",children:[" ",Qo]}):null]})}import{Text as be}from"ink";import{jsx as yn,jsxs as bn}from"react/jsx-runtime";var Tt={idle:"ready",thinking:"thinking",streaming:"replying",working:"running a tool",cancelling:"cancelling"};function St(n){return`${(n/1000).toFixed(1)}s`}function wn(n,t){if(n!=="idle")return" · ^C cancels";return t?" · ^C again to leave":" · ^C twice to leave · /exit"}function kt(n){if(n!=="idle")return"";return" · ^O show reasoning"}var Rt=0.5,Mt=0.8;function Tn({status:n,model:t,sessionKey:r,elapsedMs:i,last:a,quiet:s,armed:l,pressure:u,phase:m}){return bn(be,{dimColor:!0,wrap:"truncate",children:[bn(be,{color:Mi[n],children:[I.dot,Tt[n]]}),n==="idle"?"":` ${St(i)}`,` · ${t} · ${r}`,m===void 0||s?"":` · ${m}`,u===void 0||u<Rt||s?"":yn(be,{...u>=Mt?{color:o.warning}:{},children:` · ctx ${Math.round(u*100)}%`}),a===void 0||s?"":` · last ${Yn(a)}`,kt(n),l===!0?yn(be,{color:o.warning,children:wn(n,!0)}):wn(n,!1)]})}import{Box as vt,Text as Te}from"ink";var z={offset:0,pinned:!0};function Sn(n,t){return Math.max(0,n-t)}function kn(n,t,r){let i=Sn(t,r);return n.pinned?i:Math.max(0,Math.min(n.offset,i))}function Rn(n,t,r,i){if(t==="bottom")return z;let a=Sn(r,i);if(a===0)return z;if(t==="top")return{offset:0,pinned:!1};let s=t==="pageUp"||t==="pageDown"?Math.max(1,i-1):1,l=t==="down"||t==="pageDown"?s:-s,u=kn(n,r,i)+l;if(u>=a)return z;return{offset:Math.max(0,u),pinned:!1}}function Mn(n,t,r){if(r<=0)return{from:0,to:0,above:t,below:0};let i=kn(n,t,r),a=Math.min(t,i+r);return{from:i,to:a,above:i,below:t-a}}function En(n,t){return Math.max(xi,n-t-1)}function Pn(n){let t=[];if(n.above>0)t.push(`↑ ${n.above} row${n.above===1?"":"s"} above`);if(n.below>0)t.push(`↓ ${n.below} row${n.below===1?"":"s"} below`,"esc returns");return t.length===0?"":` ${t.join(" · ")}`}function vn(n){return{anchor:n,focus:n,dragging:!0}}function De(n,t){if(!n.dragging)return n;return{...n,focus:t}}function Cn(n){return{...n,dragging:!1}}function _n(n,t){return{...n,focus:t,dragging:!1}}function Pt(n,t){return n.row<t.row||n.row===t.row&&n.column<=t.column}function Bn(n){if(n===void 0)return;let{anchor:t,focus:r}=n;if(t.row===r.row&&t.column===r.column)return;return Pt(t,r)?{start:t,end:r}:{start:r,end:t}}function He(n,t,r){let i=Bn(n);if(i===void 0)return;if(t<i.start.row||t>i.end.row)return;let a=t===i.start.row?Math.min(i.start.column,r):0,s=t===i.end.row?Math.min(i.end.column,r):r;return s<=a?void 0:{from:a,to:s}}function $n(n,t){let r=Bn(t);if(r===void 0)return"";let i=[];for(let a=r.start.row;a<=r.end.row;a+=1){let s=n[a];if(s===void 0)continue;let l=[...s.text],u=He(t,a,l.length),m=u===void 0?"":l.slice(Math.max(u.from,s.lead),u.to).join("");if(s.continuation&&i.length>0){i[i.length-1]+=m;continue}i.push(m)}return i.map((a)=>a.replace(/\s+$/,"")).join(`
|
|
4
|
+
`)}function Oe(n){return n!==void 0&&!/\s/.test(n)}function In(n,t){let r=n[t.row];if(r===void 0)return{anchor:t,focus:t,dragging:!1};let i=[...r.text];if(!Oe(i[t.column]))return Ne(n,t);let{column:a,column:s}=t;while(a>r.lead&&Oe(i[a-1]))a-=1;while(s<i.length&&Oe(i[s]))s+=1;return{anchor:{row:t.row,column:a},focus:{row:t.row,column:s},dragging:!1}}function Ne(n,t){let r=n[t.row],i=r===void 0?0:[...r.text].length;return{anchor:{row:t.row,column:r?.lead??0},focus:{row:t.row,column:i},dragging:!1}}import{jsx as We,jsxs as On}from"react/jsx-runtime";function Dn({rows:n,slice:t,selection:r}){let i=n.slice(t.from,t.to),a=Pn(t);return On(vt,{flexDirection:"column",children:[We(Te,{color:o.muted,wrap:"truncate",children:a===""?" ":a}),i.map((s,l)=>{let u=s.dim===!0?o.muted:ki[s.role],m=[...s.text],w=He(r,t.from+l,m.length);if(w===void 0)return We(Te,{wrap:"truncate",bold:s.bold===!0,...u===void 0?{}:{color:u},children:s.text===""?" ":s.text},s.key);let E=Math.max(w.from,s.lead);return On(Te,{wrap:"truncate",bold:s.bold===!0,...u===void 0?{}:{color:u},children:[m.slice(0,E).join(""),We(Te,{backgroundColor:o.selection,children:m.slice(E,w.to).join("")}),m.slice(w.to).join("")]},s.key)})]})}import{useEffect as Ct,useState as Lt}from"react";var Bt=100;function Nn(n){let[t,r]=Lt(0);return Ct(()=>{if(!n){r(0);return}let i=Date.now();r(0);let a=setInterval(()=>r(Date.now()-i),Bt);return()=>clearInterval(a)},[n]),t}import{useCallback as Se,useEffect as $t,useReducer as It,useRef as Wn}from"react";function Gn(n){let{source:t,sessionKey:r,initial:i}=n,[a,s]=It(mo,i),l=Wn(void 0),u=Wn(t.streamFilter());$t(()=>t.subscribe((h)=>{if(h.sessionKey!==void 0&&h.sessionKey!==r)return;if(h.type==="model.chunk"){let{delta:L,kind:B}=h.data;if(B==="reasoning"){s({kind:"delta",of:"reasoning",text:L});return}s({kind:"delta",of:"text",text:u.current.push(L)});return}if(h.type==="model.result"){s({kind:"delta",of:"text",text:u.current.endStep()});return}if(h.type==="turn.end")s({kind:"delta",of:"text",text:u.current.end()}),u.current=t.streamFilter();s({kind:"event",event:h})}),[t,r]);let m=Se((h)=>{s({kind:"user",text:h});let L=new AbortController;l.current=L,t.send(h,{sessionKey:r,signal:L.signal}).catch((B)=>{s({kind:"event",event:{v:1,ts:new Date().toISOString(),runtimeId:"cli",sessionKey:r,type:"error",data:{code:"cli_turn_failed",message:B instanceof Error?B.message:String(B),hint:"This escaped the turn loop's own error handling. Re-run with DEBUG=1 for a stack trace."}}})}).finally(()=>{if(l.current===L)l.current=void 0})},[t,r]),w=Se(()=>{let h=l.current;if(h===void 0||h.signal.aborted)return;s({kind:"cancelling"}),h.abort()},[]),E=Se((h)=>s({kind:"note",text:h}),[]),R=Se(()=>s({kind:"trim"}),[]);return{state:a,busy:a.status!=="idle",send:m,cancel:w,note:E,trim:R}}var Ge=1,Fe=1,Xe=1,Vn=2,Ue=4,Ve=2,Fn=14;function Ye(n,t){let{rows:r,caretRow:i}=Yt(n,Math.max(1,t-Ue-Ve)),a=r.length,{from:s,to:l}=G(a,i,Math.max(1,Math.min(a,on)));return Vn+(l-s)+(s>0?1:0)+(a-l>0?1:0)+(n.value.includes(`
|
|
5
|
+
`)?1:0)}var Ot=2;function Dt(n,t){if(n===void 0)return 0;if(n.matches.length===0)return 1;let r=Math.min(n.matches.length,t),i=n.matches.length>r?1:0;return r+i+1}function Un(n,t){if(n.search===void 0)return 0;let r=XA(n);return(r.length===0?1:Math.min(r.length,t))+1}function Xn(n){let t=n.live,r=t===void 0?"":n.showReasoning&&t.reasoning!==""&&t.text===""?t.reasoning:t.text,i=Ge+Fe+_t(r,n.columns-Fn,en).rows+Un(n.editor,n.searchMaxRows)+Ye(n.editor,n.columns)+(n.confirming?1:0)+(n.hint?1:0),a=Math.max(1,Math.min(n.paletteMaxRows,n.rows-i-Ot-1)),s=Ge+Fe+_t(r,n.columns-Fn,en).rows+Dt(n.palette,a)+Un(n.editor,n.searchMaxRows)+Ye(n.editor,n.columns)+(n.confirming?1:0)+(n.hint?1:0),l=En(n.rows,s),u=n.landing?Math.max(0,l-Ji-Hn):0;return{paletteRows:a,brand:u,body:l,transcript:Math.max(1,l-Xe),pane:Math.max(1,l-3)}}function Kn(n,t){let r=(t.brandLines===0?0:t.brandLines+Hn)+Ge+Xe,i=n.row-r;if(i<0)return;let a=t.from+i;if(a>=t.to)return;return{row:a,column:n.column}}function jn(n,t){let r=Yt(t.editor,Math.max(1,t.columns-Ue-Ve)),i=r.rows.length,{from:a,to:s}=G(i,r.caretRow,Math.max(1,Math.min(i,on))),l=a>0?1:0,u=Ye(t.editor,t.columns),w=t.rows-Fe-(t.hint?1:0)-u+Vn/2+l,E=n.row-w;if(E<0||E>=s-a)return;let R=r.rows[a+E];if(R===void 0)return;let h=n.column-Ue/2-Ve;if(h<0)return R.start;return Math.min(R.end,R.start+Math.max(0,h-R.lead))}function zn(n,t){let r=t===0?0:t+Hn;return Math.max(1,n.body-r-Xe)}var Ht=[{command:"pbcopy",args:[]},{command:"wl-copy",args:[]},{command:"xclip",args:["-selection","clipboard"]},{command:"xsel",args:["--clipboard","--input"]}];async function Ke(n){if(n==="")return{copied:!1,problem:"nothing selected"};let t=[];for(let r of Ht){let i=await ye({command:r.command,args:r.args,input:n,timeoutMs:2000});if(i.notFound){t.push(r.command);continue}if(i.code===0)return{copied:!0,using:r.command};return{copied:!1,using:r.command,problem:i.stderr.trim()||`${r.command} exited ${i.code}`}}return{copied:!1,problem:`no clipboard command found (tried ${t.join(", ")})`}}function Nt(n){return BA(n)?.args.findIndex((t)=>t.name==="manifest")??-1}function Wt(n){let t=n.rest.trim()===""?[]:n.rest.trim().split(/\s+/),r=Nt(n.name),i=r===-1||t.length<r?t:[...t.slice(0,r),n.manifestPath,...t.slice(r)];return[n.name,...i,"--plain"]}function Gt(n){let t=BA(n.name);if(t===void 0)return;let r=t.flags.find((s)=>s.name==="follow");if(r===void 0)return;if(!n.rest.trim().split(/\s+/).some((s)=>s==="--follow"||r.short!==void 0&&s===`-${r.short}`))return;return`--follow keeps printing until it is interrupted, and a pane has nothing to interrupt it with. Run it in its own terminal: ${n.name} ${n.rest.trim()}`}async function Jn(n){let t=Gt(n);if(t!==void 0)return{lines:[t],code:1};let r=n.interpreter??process.execPath,i=n.script??(n.interpreter!==void 0?"":process.argv[1]??""),a=await ye({command:r,args:[i,...Wt(n)],...n.env===void 0?{}:{env:n.env},timeoutMs:n.timeoutMs??30000}),s=[a.stdout,a.stderr].filter((u)=>u.trim()!=="").join(`
|
|
6
|
+
`),l=s===""?[]:s.replace(/\n+$/,"").split(`
|
|
7
|
+
`);if(a.notFound)return{lines:[`could not run ${r}`],code:1};if(a.signalled)return{lines:[...l,`${n.name} was stopped before it finished`],code:1};return{lines:l,code:a.code}}import{jsx as g,jsxs as Z,Fragment as Vt}from"react/jsx-runtime";function Dr({source:n,sessionKey:t,model:r,agentName:i,warnings:a,freshSession:s,initial:l,correctKeys:u,showReasoning:m,quiet:w,onRestart:E,onSwitch:R,onNew:h,sessions:L,initialDraft:B,manifestPath:N,catalogue:se,status:je,contextView:ze}){let{exit:q}=Ft(),ee=ge(),S=V(ee.columns,J),{state:P,busy:me,send:rt,cancel:st,note:x,trim:Je}=Gn({source:n,sessionKey:t,initial:l}),[A,O]=_(()=>B===void 0||B===""?K:{...K,value:B,cursor:[...B].length}),[T,C]=_({kind:"none"}),[Qe,at]=_(void 0),[Ze,dt]=_(void 0),[qe,lt]=_(void 0),[fe,ke]=_(z),[ae,Re]=_(!1),[Me,nn]=_(!1),[tn,ct]=_(!1),[ne,Y]=_(void 0),Ee=Ut(void 0),W=T.kind==="none"?wo(A.value):void 0,[Pe,pe]=_(0),ut=Nn(me),mt=et(()=>So(P.items),[P.items]),oe=et(()=>Mo(P.items,{showReasoning:m,quiet:w,columns:S,expandReasoning:tn}),[P.items,m,w,S,tn]),re=s===!0&&!P.items.some((p)=>p.role==="user"),ve=re?Yi:Pi,X=Xn({rows:ee.rows,columns:S,editor:A,live:P.live,showReasoning:m,palette:W,paletteMaxRows:ve,searchMaxRows:ve,confirming:Me,landing:re,hint:re}),he=X.brand>0?Et(e.name,{columns:S-EA,rows:X.brand}):void 0,Ae=Mn(fe,oe.length,zn(X,he?.lines.length??0));qn(()=>{if(!fe.pinned)return;Y(void 0),Je()},[fe.pinned,P.items.length,Je]),qn(()=>{if(!ae)return;let p=setTimeout(()=>Re(!1),qi);return()=>clearTimeout(p)},[ae]);let rn=(p,b)=>{let f=nt(p,it());if(f!==void 0)switch(f.kind){case"exit":nn(!0);return;case"restart":{let d=n.reload;if(d===void 0){E?.(b),q();return}x("asking the host to reload this agent…"),d().then((c)=>x(`reloaded ${c.join(", ")} — this conversation continues`)).catch((c)=>x(`could not reload: ${c instanceof Error?c.message:String(c)}`));return}case"new":h?.(b),q();return;case"help":x(ot());return;case"tools":n.tools().then((d)=>x(IA(d))).catch((d)=>x(`could not read the tools: ${d instanceof Error?d.message:String(d)}`));return;case"context":if(ze===void 0){x("context is unavailable in this session");return}ze().then(x).catch((d)=>x(`could not read the context: ${d instanceof Error?d.message:String(d)}`));return;case"status":if(je===void 0){x("status is unavailable in this session");return}je().then(x).catch((d)=>x(`could not read the status: ${d instanceof Error?d.message:String(d)}`));return;case"reset":n.clearSession(t).then(()=>x("session cleared — memory files on disk are untouched")).catch((d)=>x(`could not clear the session: ${d instanceof Error?d.message:String(d)}`));return;case"command":if(sn(`/${f.name}`,f.rest))return;x(TA({word:`/${f.name}`}));return;case"unknown":x(TA(f));return}if(me){x("a turn is still running — ^C cancels it, then send again");return}rt(p)},_e=Zn((p,b)=>{C({kind:"output",label:`/${p}`,lines:void 0,offset:0}),Jn({name:p,rest:b,manifestPath:N??""}).then((f)=>C({kind:"output",label:`/${p}`,lines:f.lines,code:f.code,offset:0})).catch((f)=>C({kind:"output",label:`/${p}`,lines:[f instanceof Error?f.message:String(f)],code:1,offset:0}))},[N]),sn=Zn((p,b)=>{let f=ln().find((d)=>d.word===p);if(f===void 0)return!1;if(f.kind==="view"){if(f.word==="/sessions"&&L!==void 0&&R!==void 0)return C({kind:"sessions",stored:void 0}),import("./SessionPicker-vacfwczg.js").then((d)=>lt(()=>d.SessionPicker)),L().then((d)=>C({kind:"sessions",stored:d})).catch((d)=>{C({kind:"none"}),x(`could not read the stored conversations: ${d instanceof Error?d.message:String(d)}`)}),!0;if(f.word==="/config"&&(b.trim()===""||b.trim()==="edit")){if(N===void 0)return x("this session has no manifest path, so there is nothing to edit"),!0;return C({kind:"config",rows:lA(N)}),import("./ConfigEditor-apcnj4nj.js").then((d)=>dt(()=>d.ConfigEditor)),!0}if(f.word==="/skills"&&se!==void 0)return C({kind:"skills"}),import("./SkillBrowser-66ntwaa9.js").then((d)=>at(()=>d.SkillBrowser)),!0;return _e(f.word.slice(1),b),!0}if(f.kind==="output")return _e(f.word.slice(1),b),!0;return!1},[_e,se,L,R,x,N]);if(Qn((p,b)=>{if(T.kind!=="output")return;if(b.escape||p==="q"){C({kind:"none"});return}let f=T.lines?.length??0,d=b.pageDown||b.pageUp?X.pane:1,c=b.downArrow||b.pageDown?d:b.upArrow||b.pageUp?-d:0;if(c!==0)C({...T,offset:Math.max(0,Math.min(T.offset+c,Math.max(0,f-1)))})},{isActive:T.kind==="output"}),Qn((p,b)=>{let f=u===void 0?b:u(b,p);if(Me){if(nn(!1),p.toLowerCase()==="y"||f.return)q();return}if(W!==void 0){if(f.escape){O((k)=>te(k,{kind:"killToStart"})),pe(0);return}if(f.upArrow||f.downArrow){pe((k)=>Math.max(0,Math.min(k+(f.downArrow?1:-1),W.matches.length-1)));return}if(f.tab){let k=xn(W,Pe);if(k!==void 0)O((v)=>te({...v,value:"",cursor:0},{kind:"insert",text:k.word}));return}let c=xn(W,Pe);if(f.return&&c!==void 0){let k=c;if(pe(0),O((v)=>({...v,value:"",cursor:0})),k.kind==="session")rn(k.word,"");else sn(k.word,"");return}}let d=$A(p,f,qt(A,me,{armed:ae,scrolled:!fe.pinned}));if(ae&&d.kind!=="exit")Re(!1);if(d.kind==="arm"){Re(!0);return}if(d.kind==="scroll"){let c=Math.max(1,d.times??1);ke((k)=>{let v=k;for(let y=0;y<c;y+=1)v=Rn(v,d.move,oe.length,X.transcript);return v});return}if(d.kind==="pointer"){let c=Kn({column:d.column,row:d.row},{brandLines:he?.lines.length??0,from:Ae.from,to:Ae.to});if(c===void 0){let y=jn({column:d.column,row:d.row},{editor:A,columns:S,rows:ee.rows,hint:re});if(y===void 0){if(d.gesture==="press")Y(void 0),O((j)=>({...j,anchor:void 0}));return}Y(void 0),O((j)=>d.gesture==="press"&&!d.shift?{...j,cursor:y,anchor:y}:{...j,cursor:y,anchor:j.anchor??j.cursor});return}if(d.gesture==="press"){if(d.shift&&ne!==void 0){Y(_n(ne,c)),Ee.current=void 0;return}let y=Ee.current,Le=y!==void 0&&Date.now()-y.when<=ji&&y.at.row===c.row&&y.at.column===c.column?y.clicks%3+1:1;Ee.current={at:c,when:Date.now(),clicks:Le},O((ht)=>({...ht,anchor:void 0})),Y(Le===3?Ne(oe,c):Le===2?In(oe,c):vn(c));return}if(d.gesture==="drag"){Y((y)=>y===void 0?void 0:De(y,c));return}let k=ne===void 0?void 0:Cn(De(ne,c));Y(k);let v=$n(oe,k);if(v!=="")Ke(v).then((y)=>{if(!y.copied&&y.problem!=="nothing selected")x(`could not copy: ${y.problem??"unknown"}`)});return}if(d.kind==="copySelection"||d.kind==="cutSelection"){let c=vA(A);if(c===void 0){x("nothing selected — hold shift with a motion, or drag in the box");return}let k=[...A.value].slice(c.start,c.end).join("");if(d.kind==="cutSelection")O((v)=>te(v,d));Ke(k).then((v)=>{if(!v.copied)x(`could not copy: ${v.problem??"unknown"}`)});return}if(d.kind==="reasoning"){if(!m){x("reasoning is off: either this model does not stream it, or --no-reasoning is set");return}if(!P.items.some((c)=>c.role==="reasoning")){x("no reasoning to show yet — this expands it once a turn has streamed some");return}ct((c)=>!c),ke(z);return}if(d.kind==="exit"){q();return}if(d.kind==="cancel"){st();return}if(d.kind==="submit"){let c=Qi(A);if(O(c.state),ke(z),c.text!=="")rn(c.text,c.state.value);return}if(d.kind==="paste"){O((c)=>te(c,{kind:"insert",text:d.lines.join(`
|
|
8
|
+
`)}));return}if(W!==void 0)pe(0);O((c)=>te(c,d))},{isActive:T.kind==="none"}),T.kind==="config")return Z(H,{flexDirection:"column",width:S,height:ee.rows,children:[g(Q,{color:o.accent,bold:!0,wrap:"truncate",children:Ln({title:`${e.name} ${M}`,summary:"settings"},S)}),Ze===void 0?g(H,{marginLeft:2,children:g(Ce,{label:"reading the settings"})}):g(Ze,{rows:T.rows,apply:(p,b)=>tt(N??"",p,b),reload:()=>lA(N??""),columns:S,window:At,onDone:(p)=>{if(C({kind:"none"}),p)E?.(A.value),q()}}),g(H,{flexGrow:1})]});if(T.kind==="sessions")return Z(H,{flexDirection:"column",width:S,height:ee.rows,children:[g(Q,{color:o.accent,bold:!0,wrap:"truncate",children:Ln({title:`${e.name} ${M}`,summary:"pick a conversation"},S)}),g(H,{flexGrow:1}),T.stored===void 0||qe===void 0?g(H,{marginLeft:2,children:g(Ce,{label:"reading the stored conversations"})}):g(qe,{sessions:T.stored,now:Date.now(),columns:S,maxRows:At,current:t,onDone:(p)=>{if(p===void 0||p===t){C({kind:"none"});return}R?.(p,A.value),q()}}),g(H,{flexGrow:1})]});if(T.kind==="skills"&&se!==void 0&&Qe!==void 0)return g(Qe,{title:`${e.name} ${M}`,agents:[],target:N??"",load:se.load,install:se.install,onDone:()=>C({kind:"none"})});let pt=Ln({title:`${e.name} ${M}`,summary:"",agent:{name:i,model:r},...a===void 0||a.length===0?{}:{warnings:a}},S);return Z(H,{flexDirection:"column",width:S,height:ee.rows,children:[he===void 0?null:Z(Vt,{children:[g(ft,{lines:he.lines}),g(Q,{children:" "})]}),g(Q,{color:o.accent,bold:!0,wrap:"truncate",children:pt}),T.kind==="output"?Z(H,{flexDirection:"column",children:[g(an,{lines:T.lines,label:T.label,offset:T.offset,maxRows:X.pane,...T.code===void 0?{}:{code:T.code}}),Z(Q,{dimColor:!0,wrap:"truncate",children:[" ","↑↓ scroll · esc back to the prompt"]})]}):g(Dn,{rows:oe,slice:Ae,...ne===void 0?{}:{selection:ne}}),g(H,{flexGrow:1}),P.live===void 0?null:g(un,{live:P.live,showReasoning:m,columns:S}),W===void 0?null:g(mn,{palette:W,index:Pe,width:S,maxRows:X.paletteRows}),g(dn,{editor:A,width:S,maxRows:ve}),Me?g(Q,{color:o.warning,wrap:"truncate",children:" leave this session? press y to confirm · any other key stays"}):null,g(gn,{editor:A,busy:me,columns:S,...re?{placeholder:"Ask anything…"}:{}}),re?Z(Q,{dimColor:!0,wrap:"truncate",children:[" ",ho]}):null,g(Tn,{status:P.status,model:r,sessionKey:t,elapsedMs:ut,last:mt,quiet:w,armed:ae,...P.pressure===void 0?{}:{pressure:P.pressure},...P.phase===void 0?{}:{phase:P.phase}})]})}export{Dr as App};
|
|
9
|
+
|
|
10
|
+
//# debugId=4DA58104C913BA1A64756E2164756E21
|
|
11
|
+
//# sourceMappingURL=App-qfqvx9c7.js.map
|