dispach 0.2.1 → 0.2.2
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 +89 -34
- package/dist/APEv2Parser-etzjd528.js +5 -0
- package/dist/{FlacParser-bf8y3e0w.js.map → APEv2Parser-etzjd528.js.map} +1 -1
- package/dist/{AiffParser-tbx3xkmk.js → AiffParser-y21k3fak.js} +3 -3
- package/dist/{AiffParser-tbx3xkmk.js.map → AiffParser-y21k3fak.js.map} +1 -1
- package/dist/App-4w3qkcs4.js +11 -0
- package/dist/{App-hjn867nc.js.map → App-4w3qkcs4.js.map} +1 -1
- package/dist/{AsfParser-d784ak3y.js → AsfParser-wd98k2h4.js} +3 -3
- package/dist/{AsfParser-d784ak3y.js.map → AsfParser-wd98k2h4.js.map} +1 -1
- package/dist/{ConfigEditor-g7eb2wsm.js → ConfigEditor-vk7vxaa6.js} +3 -3
- package/dist/{ConfigEditor-g7eb2wsm.js.map → ConfigEditor-vk7vxaa6.js.map} +1 -1
- package/dist/{DsdiffParser-vxnfx80c.js → DsdiffParser-cbfaj500.js} +3 -3
- package/dist/{DsdiffParser-vxnfx80c.js.map → DsdiffParser-cbfaj500.js.map} +1 -1
- package/dist/{DsfParser-0xsh0zzk.js → DsfParser-tybrja4x.js} +3 -3
- package/dist/{DsfParser-0xsh0zzk.js.map → DsfParser-tybrja4x.js.map} +1 -1
- package/dist/FlacParser-7t7da7qy.js +5 -0
- package/dist/{APEv2Parser-9wqew3zv.js.map → FlacParser-7t7da7qy.js.map} +1 -1
- package/dist/{KeyProbe-w8c37s9q.js → KeyProbe-5anphmb7.js} +3 -3
- package/dist/{KeyProbe-w8c37s9q.js.map → KeyProbe-5anphmb7.js.map} +1 -1
- package/dist/{MP4Parser-tq7r7wd4.js → MP4Parser-gc94h1n9.js} +3 -3
- package/dist/{MP4Parser-tq7r7wd4.js.map → MP4Parser-gc94h1n9.js.map} +1 -1
- package/dist/{MatroskaParser-a79gsmzb.js → MatroskaParser-cy2k4fac.js} +3 -3
- package/dist/{MatroskaParser-a79gsmzb.js.map → MatroskaParser-cy2k4fac.js.map} +1 -1
- package/dist/{MpegParser-zs61b3wq.js → MpegParser-c460fwf0.js} +3 -3
- package/dist/{MpegParser-zs61b3wq.js.map → MpegParser-c460fwf0.js.map} +1 -1
- package/dist/{MusepackParser-bp8dm6nz.js → MusepackParser-8mq2eabg.js} +3 -3
- package/dist/{MusepackParser-bp8dm6nz.js.map → MusepackParser-8mq2eabg.js.map} +1 -1
- package/dist/{OggParser-7pxr1sn9.js → OggParser-7dnc6apg.js} +3 -3
- package/dist/{OggParser-7pxr1sn9.js.map → OggParser-7dnc6apg.js.map} +1 -1
- package/dist/Picker-j7txnm7w.js +5 -0
- package/dist/{Picker-b09hr4tk.js.map → Picker-j7txnm7w.js.map} +1 -1
- package/dist/SessionPicker-hpv2ncsb.js +5 -0
- package/dist/{SessionPicker-wtfxwdxg.js.map → SessionPicker-hpv2ncsb.js.map} +3 -3
- package/dist/SkillBrowser-qc542n71.js +5 -0
- package/dist/{SkillBrowser-p9ht63c7.js.map → SkillBrowser-qc542n71.js.map} +1 -1
- package/dist/{WavPackParser-gpf3r92t.js → WavPackParser-kt7cds9c.js} +3 -3
- package/dist/{WavPackParser-gpf3r92t.js.map → WavPackParser-kt7cds9c.js.map} +1 -1
- package/dist/{WaveParser-3kcak550.js → WaveParser-g47ja0vy.js} +3 -3
- package/dist/{WaveParser-3kcak550.js.map → WaveParser-g47ja0vy.js.map} +1 -1
- package/dist/WizardApp-q4p979d1.js +5 -0
- package/dist/{WizardApp-494018sk.js.map → WizardApp-q4p979d1.js.map} +3 -3
- package/dist/{channels-yhdvxxrb.js → channels-4t89qpdt.js} +14 -14
- package/dist/{channels-yhdvxxrb.js.map → channels-4t89qpdt.js.map} +1 -1
- package/dist/client.d.ts +242 -1
- package/dist/client.js +11 -11
- package/dist/client.js.map +5 -5
- package/dist/{config-g0ybmm4t.js → config-35r6n1gh.js} +17 -17
- package/dist/{config-g0ybmm4t.js.map → config-35r6n1gh.js.map} +1 -1
- package/dist/{credential-pkme1sfe.js → credential-dpdgg4j6.js} +5 -5
- package/dist/{credential-pkme1sfe.js.map → credential-dpdgg4j6.js.map} +1 -1
- package/dist/{index-q8b1fc3k.js → index-0444sh6x.js} +4 -4
- package/dist/{index-q8b1fc3k.js.map → index-0444sh6x.js.map} +1 -1
- package/dist/{index-ec101x93.js → index-095hrkyr.js} +6 -6
- package/dist/{index-ec101x93.js.map → index-095hrkyr.js.map} +1 -1
- package/dist/index-1x8mzvz7.js +6 -0
- package/dist/{index-f056wkb4.js.map → index-1x8mzvz7.js.map} +1 -1
- package/dist/index-2bsardvh.js +5 -0
- package/dist/{index-9dmgk6d3.js.map → index-2bsardvh.js.map} +2 -2
- package/dist/{index-thmq816c.js → index-2zjh5zd5.js} +4 -4
- package/dist/{index-thmq816c.js.map → index-2zjh5zd5.js.map} +1 -1
- package/dist/{index-t6xnecdx.js → index-323jvr1g.js} +4 -4
- package/dist/{index-t6xnecdx.js.map → index-323jvr1g.js.map} +1 -1
- package/dist/{index-mn34kj95.js → index-3826kf9t.js} +5 -5
- package/dist/{index-mn34kj95.js.map → index-3826kf9t.js.map} +1 -1
- package/dist/index-38gs9anh.js +9 -0
- package/dist/{index-akv6e7ge.js.map → index-38gs9anh.js.map} +1 -1
- package/dist/index-3c5jt6by.js +5 -0
- package/dist/{index-3b3h8kyh.js.map → index-3c5jt6by.js.map} +2 -2
- package/dist/{index-a6mtqkth.js → index-3vzf253k.js} +7 -7
- package/dist/{index-a6mtqkth.js.map → index-3vzf253k.js.map} +1 -1
- package/dist/{index-5m9wydxb.js → index-42e29zs4.js} +4 -4
- package/dist/{index-5m9wydxb.js.map → index-42e29zs4.js.map} +1 -1
- package/dist/{index-v7mz396x.js → index-4fj1k64j.js} +4 -4
- package/dist/{index-v7mz396x.js.map → index-4fj1k64j.js.map} +1 -1
- package/dist/{index-s2tzq27a.js → index-51x0n5z0.js} +5 -5
- package/dist/{index-s2tzq27a.js.map → index-51x0n5z0.js.map} +1 -1
- package/dist/index-664xcamy.js +110 -0
- package/dist/index-664xcamy.js.map +13 -0
- package/dist/index-7mn8ack9.js +6 -0
- package/dist/{index-xa9crtzq.js.map → index-7mn8ack9.js.map} +2 -2
- package/dist/index-8edck2pr.js +6 -0
- package/dist/{index-7gsbzvnc.js.map → index-8edck2pr.js.map} +1 -1
- package/dist/{index-9qv87rq7.js → index-8h6kewy1.js} +7 -7
- package/dist/{index-9qv87rq7.js.map → index-8h6kewy1.js.map} +1 -1
- package/dist/index-8tmv33mr.js +6 -0
- package/dist/{index-vw2hf4d8.js.map → index-8tmv33mr.js.map} +1 -1
- package/dist/index-9914wh1d.js +6 -0
- package/dist/index-9914wh1d.js.map +10 -0
- package/dist/{index-ye2yb3xf.js → index-a2eh8dnk.js} +6 -6
- package/dist/{index-ye2yb3xf.js.map → index-a2eh8dnk.js.map} +1 -1
- package/dist/{index-81vj1bxe.js → index-bqdkm3de.js} +4 -4
- package/dist/{index-81vj1bxe.js.map → index-bqdkm3de.js.map} +1 -1
- package/dist/{index-j20k6k0m.js → index-dzy19wtf.js} +4 -4
- package/dist/{index-j20k6k0m.js.map → index-dzy19wtf.js.map} +1 -1
- package/dist/{index-gqaa06yh.js → index-eqqd4k4f.js} +9 -9
- package/dist/{index-gqaa06yh.js.map → index-eqqd4k4f.js.map} +1 -1
- package/dist/{index-633eqxry.js → index-ew997be5.js} +7 -7
- package/dist/{index-633eqxry.js.map → index-ew997be5.js.map} +1 -1
- package/dist/{index-y34s71qe.js → index-fa9wvpyw.js} +3 -3
- package/dist/{index-y34s71qe.js.map → index-fa9wvpyw.js.map} +1 -1
- package/dist/{index-myg5enf5.js → index-fbsrhcga.js} +4 -4
- package/dist/{index-myg5enf5.js.map → index-fbsrhcga.js.map} +1 -1
- package/dist/{index-x9z2xnct.js → index-fcsg95m5.js} +5 -5
- package/dist/{index-x9z2xnct.js.map → index-fcsg95m5.js.map} +1 -1
- package/dist/{index-zjphh8ch.js → index-gbkma7ds.js} +4 -4
- package/dist/{index-zjphh8ch.js.map → index-gbkma7ds.js.map} +1 -1
- package/dist/{index-ac2wzspd.js → index-gq1npngp.js} +4 -4
- package/dist/{index-ac2wzspd.js.map → index-gq1npngp.js.map} +1 -1
- package/dist/{index-6r9h7ftn.js → index-haypwvzd.js} +85 -85
- package/dist/index-haypwvzd.js.map +21 -0
- package/dist/{index-qh82wtpa.js → index-jc4kmfwa.js} +4 -4
- package/dist/{index-qh82wtpa.js.map → index-jc4kmfwa.js.map} +1 -1
- package/dist/index-kjqksgch.js +429 -0
- package/dist/index-kjqksgch.js.map +12 -0
- package/dist/{index-trx9xb59.js → index-m6fqx0ch.js} +7 -7
- package/dist/{index-trx9xb59.js.map → index-m6fqx0ch.js.map} +1 -1
- package/dist/{index-twcgf73h.js → index-ma6p7bt4.js} +4 -4
- package/dist/{index-twcgf73h.js.map → index-ma6p7bt4.js.map} +1 -1
- package/dist/index-nvc24414.js +6 -0
- package/dist/{index-1f1erzfx.js.map → index-nvc24414.js.map} +1 -1
- package/dist/index-nxhqf597.js +6 -0
- package/dist/{index-w97gprre.js.map → index-nxhqf597.js.map} +1 -1
- package/dist/{index-psk6q25h.js → index-p1zy871m.js} +4 -4
- package/dist/{index-psk6q25h.js.map → index-p1zy871m.js.map} +1 -1
- package/dist/{index-jh2az41t.js → index-p6ya59m6.js} +5 -5
- package/dist/{index-jh2az41t.js.map → index-p6ya59m6.js.map} +1 -1
- package/dist/{index-6c4p19m1.js → index-pszmnhgq.js} +2 -2
- package/dist/index-qg9bn980.js +1213 -0
- package/dist/{index-26ejkp8q.js.map → index-qg9bn980.js.map} +26 -23
- package/dist/index-qgsdgbk8.js +5 -0
- package/dist/{index-wk6andxq.js.map → index-qgsdgbk8.js.map} +2 -2
- package/dist/index-r4ax3x4d.js +74 -0
- package/dist/index-r4ax3x4d.js.map +13 -0
- package/dist/{index-zg89tq04.js → index-snz49ndn.js} +4 -4
- package/dist/{index-zg89tq04.js.map → index-snz49ndn.js.map} +1 -1
- package/dist/index-twn9bfm2.js +8 -0
- package/dist/{index-0mz7wpbw.js.map → index-twn9bfm2.js.map} +2 -2
- package/dist/{index-3fgq1acj.js → index-wc4entme.js} +10 -10
- package/dist/{index-3fgq1acj.js.map → index-wc4entme.js.map} +1 -1
- package/dist/{index-ad5c9t83.js → index-ynsvkqgb.js} +4 -4
- package/dist/{index-ad5c9t83.js.map → index-ynsvkqgb.js.map} +1 -1
- package/dist/index-ytxbw8py.js +63 -0
- package/dist/{index-0pddq849.js.map → index-ytxbw8py.js.map} +2 -2
- package/dist/index-yw3fby4n.js +6 -0
- package/dist/{index-4emtktc0.js.map → index-yw3fby4n.js.map} +2 -2
- package/dist/{index-307qmvb0.js → index-z157at3s.js} +25 -25
- package/dist/{index-307qmvb0.js.map → index-z157at3s.js.map} +1 -1
- package/dist/{index-pdsey1ab.js → index-zce9gy22.js} +62 -62
- package/dist/{index-pdsey1ab.js.map → index-zce9gy22.js.map} +1 -1
- package/dist/{index-skkddg44.js → index-zw6wyas6.js} +4 -4
- package/dist/{index-skkddg44.js.map → index-zw6wyas6.js.map} +1 -1
- package/dist/index.js +307 -291
- package/dist/index.js.map +15 -12
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/agent-template.d.ts +5 -0
- package/dist/lib/agent-template.d.ts.map +1 -1
- package/dist/lib/commands.d.ts.map +1 -1
- package/dist/lib/init-flow.d.ts +7 -30
- package/dist/lib/init-flow.d.ts.map +1 -1
- package/dist/lib/owner.d.ts +49 -0
- package/dist/lib/owner.d.ts.map +1 -0
- package/dist/lib/presets.d.ts +44 -0
- package/dist/lib/presets.d.ts.map +1 -0
- package/dist/lib/provision.d.ts +8 -1
- package/dist/lib/provision.d.ts.map +1 -1
- package/dist/lib/relay-client.d.ts +17 -0
- package/dist/lib/relay-client.d.ts.map +1 -0
- package/dist/lib/schema.d.ts +2 -0
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/sessions-view.d.ts +2 -0
- package/dist/lib/sessions-view.d.ts.map +1 -1
- package/dist/lib/source.d.ts +17 -0
- package/dist/lib/source.d.ts.map +1 -1
- package/dist/lib/wizard.d.ts.map +1 -1
- package/dist/owner.d.ts +16 -0
- package/dist/owner.d.ts.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/{web-f6869dy2.js → web-zph4h3p9.js} +7 -7
- package/dist/{web-f6869dy2.js.map → web-zph4h3p9.js.map} +1 -1
- package/dist/wire.d.ts +31 -0
- package/dist/wire.js +2 -2
- package/dist/wire.js.map +4 -4
- package/dist/wrapper-f662ny3r.js +5 -0
- package/dist/{wrapper-52c0vacs.js.map → wrapper-f662ny3r.js.map} +1 -1
- package/package.json +4 -1
- package/dist/APEv2Parser-9wqew3zv.js +0 -5
- package/dist/App-hjn867nc.js +0 -11
- package/dist/FlacParser-bf8y3e0w.js +0 -5
- package/dist/Picker-b09hr4tk.js +0 -5
- package/dist/SessionPicker-wtfxwdxg.js +0 -5
- package/dist/SkillBrowser-p9ht63c7.js +0 -5
- package/dist/WizardApp-494018sk.js +0 -5
- package/dist/index-0mz7wpbw.js +0 -8
- package/dist/index-0pddq849.js +0 -63
- package/dist/index-1f1erzfx.js +0 -6
- package/dist/index-26ejkp8q.js +0 -1194
- package/dist/index-3b3h8kyh.js +0 -5
- package/dist/index-4emtktc0.js +0 -6
- package/dist/index-4t3p7vm9.js +0 -6
- package/dist/index-4t3p7vm9.js.map +0 -10
- package/dist/index-6r9h7ftn.js.map +0 -21
- package/dist/index-7gsbzvnc.js +0 -6
- package/dist/index-94k4mh6s.js +0 -96
- package/dist/index-94k4mh6s.js.map +0 -13
- package/dist/index-9dmgk6d3.js +0 -5
- package/dist/index-akv6e7ge.js +0 -9
- package/dist/index-f056wkb4.js +0 -6
- package/dist/index-s57ztjhq.js +0 -74
- package/dist/index-s57ztjhq.js.map +0 -13
- package/dist/index-vw2hf4d8.js +0 -6
- package/dist/index-w97gprre.js +0 -6
- package/dist/index-wk6andxq.js +0 -5
- package/dist/index-xa9crtzq.js +0 -6
- package/dist/index-z0dgxd7d.js +0 -429
- package/dist/index-z0dgxd7d.js.map +0 -11
- package/dist/wrapper-52c0vacs.js +0 -5
- /package/dist/{index-6c4p19m1.js.map → index-pszmnhgq.js.map} +0 -0
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ with memory, tools, schedules, channels and approvals, on any OpenAI-compatible
|
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
11
|
npm i -g dispach # Node 24+, or: brew install moeen-mahmud/tap/dispach
|
|
12
|
+
# no Node? curl -fsSL https://github.com/moeen-mahmud/dispach/releases/latest/download/install.sh | sh
|
|
12
13
|
dispach init # name the agent, pick a model, paste a key
|
|
13
14
|
dispach run milo # talk to it in the terminal
|
|
14
15
|
```
|
|
@@ -22,9 +23,14 @@ Or run it as a server: one `docker run`, and [Call it over HTTP](#call-it-over-h
|
|
|
22
23
|
agent and streams its reply in three requests.
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
|
-
docker run -d -p 7420:7420 -
|
|
26
|
+
docker run -d --init -p 7420:7420 -v dispach-home:/home/dispach \
|
|
27
|
+
-e DISPACH_API_TOKEN=pick-a-secret ghcr.io/moeen-mahmud/dispach:0.2.2
|
|
26
28
|
```
|
|
27
29
|
|
|
30
|
+
The named volume is where the store, every agent and every key live; without it a `docker rm` for
|
|
31
|
+
an upgrade starts empty. `--init` is there because `exec` backgrounds children and a child whose
|
|
32
|
+
parent is PID 1 has nothing to reap it.
|
|
33
|
+
|
|
28
34
|
**Research:** [*What May an Agent Change About Itself? A Containment Floor for Self-Configuring Agent
|
|
29
35
|
Runtimes*](https://arxiv.org/abs/2610.06274) (Hossain and Mahmud, 2026, preprint) measures the floor in
|
|
30
36
|
Dispach's settings tool: with it in place, 0 of 167 protected writes were saved, though the models
|
|
@@ -39,10 +45,11 @@ shipped on Node, Apache-2.0.
|
|
|
39
45
|
**Where it is going: the multiplayer agent runtime.** 0.2.0 gives every user and every team in your
|
|
40
46
|
product their own isolated runtime of agents. Those agents share rooms and memory with the people
|
|
41
47
|
they work for, and stand in for them, openly, when they are away. That half ships in 0.2.0 as
|
|
42
|
-
**experimental**: on the HTTP API
|
|
48
|
+
**experimental**: on the HTTP API and the browser console (no TUI screens yet), and it may change within 0.2.x.
|
|
43
49
|
Everything else described in this README is stable.
|
|
44
50
|
|
|
45
51
|
**Docs:** [dispach.blivius.com/docs](https://dispach.blivius.com/docs) ·
|
|
52
|
+
**New in 0.2.2:** [the changelog, with upgrade notes](CHANGELOG.md) ·
|
|
46
53
|
**New in 0.2.0:** [what changed and how to upgrade](developer-docs/runtime/whats-new-0-2-0.md) ·
|
|
47
54
|
**Limits:** [what is measured, and what it does not do](developer-docs/runtime/limits-and-evidence.md)
|
|
48
55
|
|
|
@@ -60,8 +67,8 @@ or the [larger pieces that need an owner](https://github.com/moeen-mahmud/dispac
|
|
|
60
67
|
|
|
61
68
|
```bash
|
|
62
69
|
export TOKEN=pick-a-secret
|
|
63
|
-
docker run -d -p 7420:7420 -v dispach-home:/home/dispach -e DISPACH_API_TOKEN=$TOKEN \
|
|
64
|
-
ghcr.io/moeen-mahmud/dispach:0.2.
|
|
70
|
+
docker run -d --init -p 7420:7420 -v dispach-home:/home/dispach -e DISPACH_API_TOKEN=$TOKEN \
|
|
71
|
+
ghcr.io/moeen-mahmud/dispach:0.2.2
|
|
65
72
|
|
|
66
73
|
curl -s -H "Authorization: Bearer $TOKEN" localhost:7420/v1/agents \
|
|
67
74
|
-d '{"answers":{"user":"you","name":"milo","apiKey":"sk-…"}}'
|
|
@@ -114,8 +121,8 @@ gap of a few runs is noise. Hermes leads on Gemini 4 Argon and the two small ope
|
|
|
114
121
|
|
|
115
122
|
## Status
|
|
116
123
|
|
|
117
|
-
**0.2.
|
|
118
|
-
under Node. [`CHANGELOG.md`](CHANGELOG.md) has what landed in each release.
|
|
124
|
+
**0.2.2**, from npm, Homebrew, the container image or the standalone installer. Every install
|
|
125
|
+
runs under Node. [`CHANGELOG.md`](CHANGELOG.md) has what landed in each release.
|
|
119
126
|
|
|
120
127
|
Built and in use:
|
|
121
128
|
|
|
@@ -135,8 +142,10 @@ Built and in use:
|
|
|
135
142
|
services, the Docker image with a compose front door, Kubernetes, and `GET /v1/backup` for the
|
|
136
143
|
whole sandbox.
|
|
137
144
|
|
|
138
|
-
**Experimental in 0.2.0
|
|
139
|
-
|
|
145
|
+
**Experimental in 0.2.0**: rooms, stand-ins and team memory; the Slack, Microsoft Teams and A2A
|
|
146
|
+
channels; and media (transcription, image generation, spoken replies). The first three and the
|
|
147
|
+
channels have screens in the browser console since 0.2.2 (People, Rooms, Actions, Memory,
|
|
148
|
+
add a channel); media is still API-only.
|
|
140
149
|
|
|
141
150
|
**MCP is a tool provider, never the substrate** (decision 4.7): remote servers over Streamable HTTP,
|
|
142
151
|
their tools pinned by name like any other provider's. Composio is still called directly.
|
|
@@ -189,7 +198,7 @@ Full rationale for every decision, including the negative ones, is in `docs/00-D
|
|
|
189
198
|
|
|
190
199
|
```bash
|
|
191
200
|
npm i -g dispach # the `dispach` command
|
|
192
|
-
dispach --version # 0.2.
|
|
201
|
+
dispach --version # 0.2.2
|
|
193
202
|
```
|
|
194
203
|
|
|
195
204
|
and in an application that talks to a running server:
|
|
@@ -203,11 +212,39 @@ import { createClient } from "dispach/client"
|
|
|
203
212
|
import type { AnyEvent } from "dispach/wire"
|
|
204
213
|
```
|
|
205
214
|
|
|
206
|
-
There is no `@dispach/*` scope, deliberately: the runtime is
|
|
215
|
+
There is no `@dispach/*` scope, deliberately: the runtime is sixteen workspace packages (and a separately licensed control plane) under one name,
|
|
207
216
|
so there is one thing to install, one thing to version and one thing to trust. `dispach/client`
|
|
208
217
|
pulls in no terminal UI — asserted by the package's own tests, because an HTTP client has no
|
|
209
218
|
business paying the ~170-210 ms that importing Ink and React costs.
|
|
210
219
|
|
|
220
|
+
### Or without Node
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
curl -fsSL https://github.com/moeen-mahmud/dispach/releases/latest/download/install.sh | sh
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
macOS and Linux (glibc), arm64 and x64. Each release attaches one archive per platform: an official
|
|
227
|
+
Node 24, checked against nodejs.org's checksums, beside the same npm tarball the other installs use.
|
|
228
|
+
It is not a single compiled file on purpose — Bun can compile one, and Bun cannot complete the
|
|
229
|
+
WhatsApp handshake (see below), so what ships is Node. The script checks the archive against the
|
|
230
|
+
release's `SHA256SUMS`, unpacks it into `~/.dispach/versions/<version>`, links
|
|
231
|
+
`~/.dispach/bin/dispach`, and adds that directory to `PATH` in your shell's rc file, saying which.
|
|
232
|
+
Nothing needs root. Run it again to upgrade.
|
|
233
|
+
|
|
234
|
+
| Variable | Effect |
|
|
235
|
+
| --- | --- |
|
|
236
|
+
| `DISPACH_VERSION=0.2.2` | that release instead of the latest |
|
|
237
|
+
| `DISPACH_NO_MODIFY_PATH=1` | change no rc file; it prints the line to add |
|
|
238
|
+
| `DISPACH_INSTALL_DIR=<dir>` | install somewhere other than `~/.dispach` |
|
|
239
|
+
|
|
240
|
+
An upgrade does not move a background server installed with `dispach daemon install`, because the
|
|
241
|
+
service names the version directory it was started from; the script says so and keeps that
|
|
242
|
+
version, and `dispach daemon install` moves it. To uninstall, delete `~/.dispach/bin` and
|
|
243
|
+
`~/.dispach/versions` and the `PATH` line; your agents beside them in `~/.dispach` are left alone.
|
|
244
|
+
|
|
245
|
+
**Windows:** run it inside WSL (`wsl --install`), or use the container. A native build needs the
|
|
246
|
+
shell tool and the service manager ported; that is [open for contributions (#76)](https://github.com/moeen-mahmud/dispach/issues/76).
|
|
247
|
+
|
|
211
248
|
### Or with Homebrew
|
|
212
249
|
|
|
213
250
|
```bash
|
|
@@ -228,7 +265,7 @@ until `brew trust moeen-mahmud/tap` is run, because a bare name carries no such
|
|
|
228
265
|
### Or the container
|
|
229
266
|
|
|
230
267
|
```bash
|
|
231
|
-
docker pull ghcr.io/moeen-mahmud/dispach:0.2.
|
|
268
|
+
docker pull ghcr.io/moeen-mahmud/dispach:0.2.2
|
|
232
269
|
```
|
|
233
270
|
|
|
234
271
|
The [Docker](#docker) and [Compose](#hosting-with-compose) sections below have the run lines and
|
|
@@ -247,7 +284,7 @@ bun run build # builds every package the binary imports
|
|
|
247
284
|
cd packages/cli && bun link # puts `dispach` on your PATH
|
|
248
285
|
cd ../..
|
|
249
286
|
|
|
250
|
-
dispach --version # 0.2.
|
|
287
|
+
dispach --version # 0.2.2
|
|
251
288
|
dispach --help
|
|
252
289
|
```
|
|
253
290
|
|
|
@@ -258,8 +295,8 @@ Four things that are not obvious:
|
|
|
258
295
|
command picks it up; you never re-link. If `dispach: command not found`, `~/.bun/bin` is not on
|
|
259
296
|
your `PATH` — Bun's installer adds it, and a shell opened before you installed Bun will not have it.
|
|
260
297
|
- **`bun run build` builds every workspace package, and you need all of them.** The CLI imports
|
|
261
|
-
|
|
262
|
-
only `core` and `cli` leaves the binary running yesterday's provider code — and the symptom is the
|
|
298
|
+
every provider package — tools, channels, the Bedrock transport, media — from their `dist`
|
|
299
|
+
(`packages/cli/src/lib/providers.ts` is the list), so building only `core` and `cli` leaves the binary running yesterday's provider code — and the symptom is the
|
|
263
300
|
worst kind: your change is correct, a test fails, and the stack trace points into a stale `dist`.
|
|
264
301
|
- **Node 24+ must be on your `PATH`.** The built entry's shebang is `#!/usr/bin/env node`; Bun builds
|
|
265
302
|
it and Node runs it — the same runtime every install ships.
|
|
@@ -293,12 +330,23 @@ passed on the command line lands in shell history — so a scripted run
|
|
|
293
330
|
it in.
|
|
294
331
|
|
|
295
332
|
**`--preset` carries the endpoints worth not typing from memory** — OpenAI, Anthropic, DeepSeek,
|
|
296
|
-
OpenRouter, Groq, NVIDIA NIM,
|
|
297
|
-
answer for anything else. Any OpenAI-compatible `/chat/completions` endpoint works,
|
|
298
|
-
no provider branch in the transport: one POST, one body builder. What a preset
|
|
299
|
-
getting the base URL's *shape* right, which is the part that is easy to get wrong.
|
|
300
|
-
the version segment; the runtime appends `/chat/completions` itself, so a URL copied
|
|
301
|
-
provider's docs with the full path is refused.
|
|
333
|
+
OpenRouter, Groq, NVIDIA NIM, Ollama both local and hosted, and AWS Bedrock — and `custom` is a
|
|
334
|
+
first-class answer for anything else. Any OpenAI-compatible `/chat/completions` endpoint works,
|
|
335
|
+
because there is no provider branch in the transport: one POST, one body builder. What a preset
|
|
336
|
+
actually buys is getting the base URL's *shape* right, which is the part that is easy to get wrong.
|
|
337
|
+
It must end at the version segment; the runtime appends `/chat/completions` itself, so a URL copied
|
|
338
|
+
from a provider's docs with the full path is refused. Bedrock is the one preset that is not three
|
|
339
|
+
strings: `--preset bedrock --region eu-west-1` writes `api: bedrock-converse` and `options.region`,
|
|
340
|
+
no URL and no key variable, because credentials come from the AWS default chain (environment, a
|
|
341
|
+
named profile, the container or instance role). The web console's Models page offers the same list.
|
|
342
|
+
|
|
343
|
+
**You talk to an agent in one conversation, wherever you reach it.** `init` makes you the owner of
|
|
344
|
+
the agents it creates and writes `sessions.scope: owner`, so what you said on Telegram this morning
|
|
345
|
+
is in the web console's chat and the terminal's this afternoon, and each reply goes back to wherever
|
|
346
|
+
you asked. "New conversation" starts afresh on all of them at once. Strangers on a channel keep their
|
|
347
|
+
own conversations, and anything one of your agents saves about you is recalled by your others.
|
|
348
|
+
`dispach owner adopt <agent>` does the same for an agent made before 0.2.2
|
|
349
|
+
(`docs/23-SPEC-SESSIONS.md`).
|
|
302
350
|
|
|
303
351
|
Local Ollama and Ollama Cloud are **two presets on purpose.** Local needs no key, and the absent
|
|
304
352
|
`apiKeyEnv` is what makes the manifest omit the field and the provider send no `authorization`
|
|
@@ -443,7 +491,7 @@ token.
|
|
|
443
491
|
|
|
444
492
|
```bash
|
|
445
493
|
cp .env.example .env # then DISPACH_API_TOKEN
|
|
446
|
-
docker compose up -d --
|
|
494
|
+
docker compose up -d --wait # pulls ghcr.io/moeen-mahmud/dispach, DISPACH_VERSION pins a tag
|
|
447
495
|
curl localhost:7420/v1/ready # {"status":"ready","agents":0}
|
|
448
496
|
docker compose logs server # the claim link — open it once to get a browser key
|
|
449
497
|
```
|
|
@@ -472,13 +520,18 @@ fail because one of N agents is misconfigured.
|
|
|
472
520
|
|
|
473
521
|
Then open `http://localhost:7420` and paste nothing: the claim link in the logs carries a one-time
|
|
474
522
|
token the page exchanges for a key it keeps. From there the page creates agents, holds a streaming
|
|
475
|
-
conversation with one, and
|
|
476
|
-
|
|
523
|
+
conversation with one, and changes its models, tools, schedules, channels, files and settings; it
|
|
524
|
+
also shows usage and every turn, and manages people, rooms, the actions queue, shared memory,
|
|
525
|
+
webhooks, backups and scoped keys. Reading the container's own output is what confers
|
|
477
526
|
first ownership, which grants nothing new to anyone who could already run `docker compose logs`.
|
|
478
527
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
528
|
+
**A plain `up` pulls the published image once and never again.** `image:` names
|
|
529
|
+
`ghcr.io/moeen-mahmud/dispach:${DISPACH_VERSION:-latest}` with `pull_policy: missing`, so a machine
|
|
530
|
+
that pulled `latest` last month keeps serving it until `docker compose pull`; pin `DISPACH_VERSION`
|
|
531
|
+
in `.env` to make an upgrade a visible edit. Working from a checkout, `up -d --build --wait` builds
|
|
532
|
+
this tree under the same tag — and then **`--build` is not optional after the first run**, because
|
|
533
|
+
compose builds only when the tag is *absent*, so a second `up` reuses whatever was built before,
|
|
534
|
+
reports healthy, and serves it. Measured while writing this: a two-day-old image came up green and answered
|
|
482
535
|
every request from a binary that predated two whole phases. The recorded stale-`dist` hazard with a
|
|
483
536
|
container around it, and the same tell — everything works, nothing is current.
|
|
484
537
|
|
|
@@ -537,7 +590,7 @@ the shape.
|
|
|
537
590
|
The container is the honest place to exercise an agent that has a shell, and not only for
|
|
538
591
|
containment. Every `exec` test in this repo otherwise runs on macOS, where the shell is a real
|
|
539
592
|
bash and `realpath` resolves `/var` through a symlink — the exact conditions the recorded
|
|
540
|
-
`$PWD`-comparison bug lived in. In the image it is
|
|
593
|
+
`$PWD`-comparison bug lived in. In the image it is Debian's `dash` as `/bin/sh` on Linux, with a different PATH
|
|
541
594
|
and different `realpath` semantics. Those have never been exercised until now.
|
|
542
595
|
|
|
543
596
|
```bash
|
|
@@ -566,7 +619,7 @@ fenced as untrusted. What the agent's shell can reach is `sh`, `bash`, `git`, `p
|
|
|
566
619
|
and `curl` — `git` because the skills catalogue is fetched with it and its absence *deletes* that
|
|
567
620
|
feature rather than degrading it, `python3` and `uv` because a skill shipping scripts needs them.
|
|
568
621
|
|
|
569
|
-
What is **absent on purpose
|
|
622
|
+
What is **absent on purpose** (CI asserts Bun and the editors are missing): no Bun — the application is the published npm
|
|
570
623
|
package running under Node, exactly what a laptop runs; no `wget`, so there is one obvious HTTP client rather than two; and no pager
|
|
571
624
|
and no editor, because `exec` hands a child a file descriptor and never a TTY — anything that pages
|
|
572
625
|
or prompts blocks until its deadline and reads as a hung agent. The CI `docker` job asserts both
|
|
@@ -594,13 +647,14 @@ consequence: run it on a laptop and the policy is the only boundary there is.
|
|
|
594
647
|
## Docker
|
|
595
648
|
|
|
596
649
|
```bash
|
|
597
|
-
docker pull ghcr.io/moeen-mahmud/dispach:0.2.
|
|
598
|
-
|
|
650
|
+
docker pull ghcr.io/moeen-mahmud/dispach:0.2.2 # or build it: docker build -f docker/Dockerfile -t dispach .
|
|
651
|
+
cp examples/minimal/.env.example examples/minimal/.env # then MODEL_API_KEY; only the example is tracked
|
|
652
|
+
docker run --rm --init -p 7420:7420 \
|
|
599
653
|
--env-file examples/minimal/.env \
|
|
600
654
|
-e DISPACH_API_TOKEN=pick-something \
|
|
601
655
|
-v "$PWD/examples/minimal:/agent" \
|
|
602
656
|
-v dispach-home:/home/dispach \
|
|
603
|
-
ghcr.io/moeen-mahmud/dispach:0.2.
|
|
657
|
+
ghcr.io/moeen-mahmud/dispach:0.2.2
|
|
604
658
|
```
|
|
605
659
|
|
|
606
660
|
The token is not optional and is not boilerplate. The image binds `0.0.0.0`, because a process
|
|
@@ -684,8 +738,8 @@ Public pull requests are welcome; [`CONTRIBUTING.md`](CONTRIBUTING.md) is the co
|
|
|
684
738
|
|
|
685
739
|
## Boot budget
|
|
686
740
|
|
|
687
|
-
Process start → `runtime.ready` in under **1000 ms**, enforced in CI at 1200 ms. Every
|
|
688
|
-
README has a row in [`evals/CLAIMS.md`](evals/CLAIMS.md) naming the file it comes from.
|
|
741
|
+
Process start → `runtime.ready` in under **1000 ms**, enforced in CI at 1200 ms. Every performance
|
|
742
|
+
number in this README has a row in [`evals/CLAIMS.md`](evals/CLAIMS.md) naming the file it comes from.
|
|
689
743
|
|
|
690
744
|
Measured at **~65 ms** at 0.2.0 — 45 ms of interpreter and imports, 21 ms inside `Runtime.create` —
|
|
691
745
|
and checked on every phase rather than at the end (it was ~53 ms at 0.1.3; the 0.2.0 packages
|
|
@@ -697,7 +751,7 @@ bun run bench:boot
|
|
|
697
751
|
|
|
698
752
|
Reported with the machine state it was taken on, because without that a boot number is a number
|
|
699
753
|
about somebody's afternoon: the figure above is a 7-run median on an Apple M4 Pro at a load
|
|
700
|
-
average of ~3.
|
|
754
|
+
average of ~3.3, and an earlier run of the same tree at a load average of ~5 measured 91 ms. The budget has
|
|
701
755
|
three orders of magnitude of headroom, so the reason to say this is not the arithmetic — it is that
|
|
702
756
|
a regression is only visible against a figure you can reproduce.
|
|
703
757
|
|
|
@@ -800,6 +854,7 @@ hand-written, and was missing five commands at once. `dispach <command> --help`
|
|
|
800
854
|
| `sessions` | list stored sessions, or inspect one |
|
|
801
855
|
| `memory` | search what the agent remembers, or rebuild the index from the files |
|
|
802
856
|
| `config` | read and change an agent's settings, and fill in its secrets |
|
|
857
|
+
| `owner` | show who owns this machine's agents, or make an existing agent yours |
|
|
803
858
|
| `validate` | load and validate a manifest, then exit |
|
|
804
859
|
| `workspace` | check the workspace files against the authoring rules |
|
|
805
860
|
| `soul` | scaffold a hand-edited compact identity from a long-form document |
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{B,
|
|
2
|
+
import{B,Me,N,C,m,g,L,l,M,P,O}from"./index-ew997be5.js";import{Qe}from"./index-fa9wvpyw.js";import{I}from"./index-323jvr1g.js";var u=I(N(),1);var k={NONE:"not compressed\tPCM\tApple Computer",sowt:"PCM (byte swapped)",fl32:"32-bit floating point IEEE 32-bit float",fl64:"64-bit floating point IEEE 64-bit float\tApple Computer",alaw:"ALaw 2:1\t8-bit ITU-T G.711 A-law",ulaw:"µLaw 2:1\t8-bit ITU-T G.711 µ-law\tApple Computer",ULAW:"CCITT G.711 u-law 8-bit ITU-T G.711 µ-law",ALAW:"CCITT G.711 A-law 8-bit ITU-T G.711 A-law",FL32:"Float 32\tIEEE 32-bit float "};class n extends M("AIFF"){}class c{constructor(t,e){this.isAifc=e;let a=e?22:18;if(t.chunkSize<a)throw new n(`COMMON CHUNK size should always be at least ${a}`);this.len=t.chunkSize}get(t,e){let a=m.get(t,e+8)-16398,s=m.get(t,e+8+2),i={numChannels:m.get(t,e),numSampleFrames:g.get(t,e+2),sampleSize:m.get(t,e+6),sampleRate:a<0?s>>Math.abs(a):s<<a};if(this.isAifc){if(i.compressionType=O.get(t,e+18),this.len>22){let o=C.get(t,e+22);if(o>0){let d=(o+1)%2;if(23+o+d===this.len)i.compressionName=new l(o,"latin1").get(t,e+23);else throw new n("Illegal pstring length")}else i.compressionName=void 0}}else i.compressionName="PCM";return i}}var r={len:8,get:(t,e)=>({chunkID:O.get(t,e),chunkSize:Number(BigInt(g.get(t,e+4)))})};var p=u.default("music-metadata:parser:aiff");class w extends P{constructor(){super(...arguments);this.isCompressed=null}async parse(){if((await this.tokenizer.readToken(r)).chunkID!=="FORM")throw new n("Invalid Chunk-ID, expected 'FORM'");let e=await this.tokenizer.readToken(O);switch(e){case"AIFF":this.metadata.setFormat("container",e),this.isCompressed=!1;break;case"AIFC":this.metadata.setFormat("container","AIFF-C"),this.isCompressed=!0;break;default:throw new n(`Unsupported AIFF type: ${e}`)}this.metadata.setFormat("lossless",!this.isCompressed),this.metadata.setAudioOnly();try{while(!this.tokenizer.fileInfo.size||this.tokenizer.fileInfo.size-this.tokenizer.position>=r.len){p(`Reading AIFF chunk at offset=${this.tokenizer.position}`);let a=await this.tokenizer.readToken(r),s=2*Math.round(a.chunkSize/2),i=await this.readData(a);await this.tokenizer.ignore(s-i)}}catch(a){if(a instanceof B)p("End-of-stream");else throw a}}async readData(t){switch(t.chunkID){case"COMM":{if(this.isCompressed===null)throw new n("Failed to parse AIFF.COMM chunk when compression type is unknown");let e=await this.tokenizer.readToken(new c(t,this.isCompressed));if(this.metadata.setFormat("bitsPerSample",e.sampleSize),this.metadata.setFormat("sampleRate",e.sampleRate),this.metadata.setFormat("numberOfChannels",e.numChannels),this.metadata.setFormat("numberOfSamples",e.numSampleFrames),this.metadata.setFormat("duration",e.numSampleFrames/e.sampleRate),e.compressionName||e.compressionType)this.metadata.setFormat("codec",e.compressionName??k[e.compressionType]);return t.chunkSize}case"ID3 ":{let e=await this.tokenizer.readToken(new L(t.chunkSize)),a=Me(e);return await new Qe().parse(this.metadata,a,this.options),t.chunkSize}case"SSND":if(this.metadata.format.duration)this.metadata.setFormat("bitrate",8*t.chunkSize/this.metadata.format.duration);return 0;case"NAME":case"AUTH":case"(c) ":case"ANNO":return this.readTextChunk(t);default:return p(`Ignore chunk id=${t.chunkID}, size=${t.chunkSize}`),0}}async readTextChunk(t){let a=(await this.tokenizer.readToken(new l(t.chunkSize,"ascii"))).split("\x00").map((s)=>s.trim()).filter((s)=>s?.length);return await Promise.all(a.map((s)=>this.metadata.addTag("AIFF",t.chunkID,s))),t.chunkSize}}export{w as AIFFParser};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=AiffParser-
|
|
4
|
+
//# debugId=6C540DD8E042FDEC64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=AiffParser-y21k3fak.js.map
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import * as Token from 'token-types';\nimport { FourCcToken } from '../common/FourCC.js';\n/**\n * Common AIFF chunk header\n */\nexport const Header = {\n len: 8,\n get: (buf, off) => {\n return {\n // Chunk type ID\n chunkID: FourCcToken.get(buf, off),\n // Chunk size\n chunkSize: Number(BigInt(Token.UINT32_BE.get(buf, off + 4)))\n };\n }\n};\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";+HACA,eCEO,IAAM,EAAmB,CAC5B,KAAM,sCACN,KAAM,qBACN,KAAM,0CACN,KAAM,0DACN,KAAM,oCACN,KAAM,oDACN,KAAM,4CACN,KAAM,4CACN,KAAM,8BACV,EACO,MAAM,UAAyB,EAA+B,MAAM,CAAE,CAC7E,CACO,MAAM,CAAO,CAChB,WAAW,CAAC,EAAQ,EAAQ,CACxB,KAAK,OAAS,EACd,IAAM,EAAmB,EAAS,GAAK,GACvC,GAAI,EAAO,UAAY,EACnB,MAAM,IAAI,EAAiB,+CAA+C,GAAkB,EAChG,KAAK,IAAM,EAAO,UAEtB,GAAG,CAAC,EAAK,EAAK,CAEV,IAAM,EAAc,EAAU,IAAI,EAAK,EAAM,CAAC,EAAI,MAC5C,EAAuB,EAAU,IAAI,EAAK,EAAM,EAAI,CAAC,EACrD,EAAM,CACR,YAAmB,EAAU,IAAI,EAAK,CAAG,EACzC,gBAAuB,EAAU,IAAI,EAAK,EAAM,CAAC,EACjD,WAAkB,EAAU,IAAI,EAAK,EAAM,CAAC,EAC5C,WAAY,EAAQ,EAAI,GAAkB,KAAK,IAAI,CAAK,EAAI,GAAkB,CAClF,EACA,GAAI,KAAK,QAEL,GADA,EAAI,gBAAkB,EAAY,IAAI,EAAK,EAAM,EAAE,EAC/C,KAAK,IAAM,GAAI,CACf,IAAM,EAAe,EAAM,IAAI,EAAK,EAAM,EAAE,EAC5C,GAAI,EAAS,EAAG,CACZ,IAAM,GAAW,EAAS,GAAK,EAC/B,GAAI,GAAK,EAAS,IAAY,KAAK,IAC/B,EAAI,gBAAkB,IAAU,EAAW,EAAQ,QAAQ,EAAE,IAAI,EA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MAAM,EAEzE,OADA,MAAM,QAAQ,IAAI,EAAO,IAAI,KAAK,KAAK,SAAS,OAAO,OAAQ,EAAO,QAAS,CAAC,CAAC,CAAC,EAC3E,EAAO,UAEtB",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "6C540DD8E042FDEC64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t,J}from"./index-qg9bn980.js";import{i,sa,aa,b,$e}from"./index-dzy19wtf.js";import{Rn,mA,_n}from"./index-snz49ndn.js";import{nt}from"./index-1x8mzvz7.js";import{no}from"./index-p6ya59m6.js";import{kn,vn}from"./index-3826kf9t.js";import{Ki,Yi,Hn,Kn,nn,DA,er,Ji,Fr,Yn,qi,Ur,zi,Zi}from"./index-wc4entme.js";import{je}from"./index-fbsrhcga.js";import"./index-kjqksgch.js";import"./index-r4ax3x4d.js";import"./index-haypwvzd.js";import{TA}from"./index-9914wh1d.js";import{BA,Nn}from"./index-8h6kewy1.js";import{he,en,wA,Ge,xi,Gn,tn}from"./index-m6fqx0ch.js";import"./index-gq1npngp.js";import"./index-fcsg95m5.js";import"./index-3vzf253k.js";import{wt}from"./index-zw6wyas6.js";import{Mr,Pe}from"./index-jc4kmfwa.js";import{Y,De}from"./index-0444sh6x.js";import{be,Lo,Po,Uo,pa,ya,Qa,ma,Sa,Tr,Sn,Da}from"./index-8tmv33mr.js";import{Box as O,Text as X,useApp as Nt,useInput as et}from"ink";import{useCallback as tt,useEffect as ot,useMemo as rt,useRef as Wt,useState as _}from"react";import{Box as Ee,Text as oe}from"ink";import{jsx as ce,jsxs as re}from"react/jsx-runtime";function sn({lines:e,label:n,offset:o,maxRows:r,code:a}){if(e===void 0)return ce(Ee,{marginLeft:2,children:ce(nt,{label:`running ${n}`})});if(e.length===0)return ce(Ee,{marginLeft:2,children:re(oe,{color:i.muted,children:[n," printed nothing"]})});let{from:s,to:l}=De(e.length,Math.min(o+Math.floor(r/2),e.length-1),r),u=e.slice(s,l).map((m,w)=>({row:s+w,text:m}));return re(Ee,{flexDirection:"column",children:[a!==void 0&&a!==0?re(oe,{color:i.error,wrap:"truncate",children:[b.error,n," exited ",a]}):null,s>0?re(oe,{dimColor:!0,wrap:"truncate",children:[" ",b.ellipsis," ",s," line",s===1?"":"s"," above"]}):null,u.map((m)=>ce(oe,{wrap:"truncate",children:m.text},m.row)),l<e.length?re(oe,{dimColor:!0,wrap:"truncate",children:[" ",b.ellipsis," ",e.length-l," line",e.length-l===1?"":"s"," ","below"]}):null]})}import{Box as ht,Text as N}from"ink";import{jsx as ie,jsxs as ue}from"react/jsx-runtime";function an({editor:e,width:n,maxRows:o}){let r=e.search;if(r===void 0)return null;let a=en(e),s=Math.min(r.index,Math.max(0,a.length-1)),{from:l,to:u}=De(a.length,s,o),m=Math.max(8,n-4);return ue(ht,{flexDirection:"column",children:[a.length===0?ue(N,{color:i.muted,wrap:"truncate",children:[" ","nothing you have sent matches that"]}):a.slice(l,u).map((w,P)=>{let p=l+P===s;return ue(N,{wrap:"truncate",children:[ie(N,{color:i.accent,children:p?b.pointer:" "}),ie(N,{bold:p,dimColor:!p,children:Y(w.replace(/\s+/g," "),m)})]},w)}),ue(N,{wrap:"truncate",children:[ie(N,{color:i.muted,children:" search: "}),r.query,ie(N,{inverse:!0,children:" "}),a.length>1?ie(N,{color:i.muted,children:` ${s+1} of ${a.length}`}):null]})]})}import{Box as xt,Text as dn}from"ink";import{jsxs as ve}from"react/jsx-runtime";function ln({live:e,showReasoning:n,columns:o}){let r=n&&e.reasoning!==""&&e.text==="",a=r?e.reasoning:e.text;if(a==="")return null;let s=r?"· reasoning · ":"",l=no(a,o-[...s].length,Lo),u=l.lines.map((m,w)=>({at:w,text:m}));return ve(xt,{flexDirection:"column",children:[l.hidden>0?ve(dn,{dimColor:!0,wrap:"truncate",children:["… ",l.hidden," earlier row(s) hidden while streaming"]}):null,u.map((m)=>ve(dn,{dimColor:r,wrap:"truncate",children:[m.at===0?s:"",m.text]},`row-${m.at}`))]})}import{Box as gt,Text as W}from"ink";import{jsx as Ce,jsxs as ee}from"react/jsx-runtime";function bt(e){return e.matches.reduce((n,o)=>Math.max(n,o.word.length),0)}function cn({palette:e,index:n,width:o,maxRows:r}){if(e.matches.length===0)return ee(W,{color:i.muted,wrap:"truncate",children:[" ","no command starts with /",e.query]});let a=Math.min(n,e.matches.length-1),{from:s,to:l}=De(e.matches.length,a,r),u=bt(e),m=Math.max(8,o-(2+u+2));return ee(gt,{flexDirection:"column",children:[s>0?ee(W,{dimColor:!0,wrap:"truncate",children:[" ",b.ellipsis," ",s," above"]}):null,e.matches.slice(s,l).map((w,P)=>{let M=s+P===a;return ee(W,{wrap:"truncate",children:[Ce(W,{color:i.accent,children:M?b.pointer:" "}),Ce(W,{bold:M,...M?{color:i.accent}:{},children:w.word.padEnd(u)})," ",Ce(W,{dimColor:!0,children:Y(w.summary,m)})]},w.word)}),l<e.matches.length?ee(W,{dimColor:!0,wrap:"truncate",children:[" ",b.ellipsis," ",e.matches.length-l," below"]}):null,ee(W,{dimColor:!0,wrap:"truncate",children:[" ","↑↓ move · tab complete · enter run · esc close"]})]})}import{Box as un,Text as yt}from"ink";import{jsx as mn,jsxs as fn}from"react/jsx-runtime";function pn({editor:e,busy:n,placeholder:o,columns:r}){let a=e.value.split(`
|
|
3
|
+
`).length,s=Math.max(1,r-4);return fn(un,{flexDirection:"column",children:[mn(un,{borderStyle:$e,borderColor:n?i.border:i.borderActive,width:r,paddingX:1,children:mn(vn,{editor:e,gutter:Po,maxRows:Uo,columns:s,...o===void 0?{}:{placeholder:o}})}),a>1?fn(yt,{dimColor:!0,wrap:"truncate",children:[" ",Ki]}):null]})}import{Text as me}from"ink";import{jsx as gn,jsxs as xn}from"react/jsx-runtime";var Tt={idle:"ready",thinking:"thinking",streaming:"replying",working:"running a tool",cancelling:"cancelling"};function St(e){return`${(e/1000).toFixed(1)}s`}function hn(e,n){if(e!=="idle")return" · ^C cancels";return n?" · ^C again to leave":" · ^C twice to leave · /exit"}function kt(e){if(e!=="idle")return"";return" · ^O show reasoning"}var Rt=0.5,Mt=0.8;function wn({status:e,model:n,sessionKey:o,elapsedMs:r,last:a,quiet:s,armed:l,pressure:u,phase:m}){return xn(me,{dimColor:!0,wrap:"truncate",children:[xn(me,{color:sa[e],children:[b.dot,Tt[e]]}),e==="idle"?"":` ${St(r)}`,` · ${n} · ${o}`,m===void 0||s?"":` · ${m}`,u===void 0||u<Rt||s?"":gn(me,{...u>=Mt?{color:i.warning}:{},children:` · ctx ${Math.round(u*100)}%`}),a===void 0||s?"":` · last ${Ur(a)}`,kt(e),l===!0?gn(me,{color:i.warning,children:hn(e,!0)}):hn(e,!1)]})}import{Box as Pt,Text as fe}from"ink";var V={offset:0,pinned:!0};function bn(e,n){return Math.max(0,e-n)}function yn(e,n,o){let r=bn(n,o);return e.pinned?r:Math.max(0,Math.min(e.offset,r))}function Tn(e,n,o,r){if(n==="bottom")return V;let a=bn(o,r);if(a===0)return V;if(n==="top")return{offset:0,pinned:!1};let s=n==="pageUp"||n==="pageDown"?Math.max(1,r-1):1,l=n==="down"||n==="pageDown"?s:-s,u=yn(e,o,r)+l;if(u>=a)return V;return{offset:Math.max(0,u),pinned:!1}}function Mn(e,n,o){if(o<=0)return{from:0,to:0,above:n,below:0};let r=yn(e,n,o),a=Math.min(n,r+o);return{from:r,to:a,above:r,below:n-a}}function En(e,n){return Math.max(ya,e-n-1)}function Pn(e){let n=[];if(e.above>0)n.push(`↑ ${e.above} row${e.above===1?"":"s"} above`);if(e.below>0)n.push(`↓ ${e.below} row${e.below===1?"":"s"} below`,"esc returns");return n.length===0?"":` ${n.join(" · ")}`}function Cn(e){return{anchor:e,focus:e,dragging:!0}}function _e(e,n){if(!e.dragging)return e;return{...e,focus:n}}function An(e){return{...e,dragging:!1}}function Ln(e,n){return{...e,focus:n,dragging:!1}}function Et(e,n){return e.row<n.row||e.row===n.row&&e.column<=n.column}function Bn(e){if(e===void 0)return;let{anchor:n,focus:o}=e;if(n.row===o.row&&n.column===o.column)return;return Et(n,o)?{start:n,end:o}:{start:o,end:n}}function Le(e,n,o){let r=Bn(e);if(r===void 0)return;if(n<r.start.row||n>r.end.row)return;let a=n===r.start.row?Math.min(r.start.column,o):0,s=n===r.end.row?Math.min(r.end.column,o):o;return s<=a?void 0:{from:a,to:s}}function $n(e,n){let o=Bn(n);if(o===void 0)return"";let r=[];for(let a=o.start.row;a<=o.end.row;a+=1){let s=e[a];if(s===void 0)continue;let l=[...s.text],u=Le(n,a,l.length),m=u===void 0?"":l.slice(Math.max(u.from,s.lead),u.to).join("");if(s.continuation&&r.length>0){r[r.length-1]+=m;continue}r.push(m)}return r.map((a)=>a.replace(/\s+$/,"")).join(`
|
|
4
|
+
`)}function Ae(e){return e!==void 0&&!/\s/.test(e)}function In(e,n){let o=e[n.row];if(o===void 0)return{anchor:n,focus:n,dragging:!1};let r=[...o.text];if(!Ae(r[n.column]))return Be(e,n);let{column:a,column:s}=n;while(a>o.lead&&Ae(r[a-1]))a-=1;while(s<r.length&&Ae(r[s]))s+=1;return{anchor:{row:n.row,column:a},focus:{row:n.row,column:s},dragging:!1}}function Be(e,n){let o=e[n.row],r=o===void 0?0:[...o.text].length;return{anchor:{row:n.row,column:o?.lead??0},focus:{row:n.row,column:r},dragging:!1}}import{jsx as Ie,jsxs as On}from"react/jsx-runtime";function Dn({rows:e,slice:n,selection:o}){let r=e.slice(n.from,n.to),a=Pn(n);return On(Pt,{flexDirection:"column",children:[Ie(fe,{color:i.muted,wrap:"truncate",children:a===""?" ":a}),r.map((s,l)=>{let u=s.dim===!0?i.muted:aa[s.role],m=[...s.text],w=Le(o,n.from+l,m.length);if(w===void 0)return Ie(fe,{wrap:"truncate",bold:s.bold===!0,...u===void 0?{}:{color:u},children:s.text===""?" ":s.text},s.key);let P=Math.max(w.from,s.lead);return On(fe,{wrap:"truncate",bold:s.bold===!0,...u===void 0?{}:{color:u},children:[m.slice(0,P).join(""),Ie(fe,{backgroundColor:i.selection,children:m.slice(P,w.to).join("")}),m.slice(w.to).join("")]},s.key)})]})}import{useEffect as vt,useState as Ct}from"react";var At=100;function Wn(e){let[n,o]=Ct(0);return vt(()=>{if(!e){o(0);return}let r=Date.now();o(0);let a=setInterval(()=>o(Date.now()-r),At);return()=>clearInterval(a)},[e]),n}import{useCallback as pe,useEffect as _t,useReducer as Lt,useRef as Fn}from"react";function Un(e){let{source:n,sessionKey:o,initial:r}=e,[a,s]=Lt(qi,r),l=Fn(void 0),u=Fn(n.streamFilter());_t(()=>n.subscribe((p)=>{if(p.sessionKey!==void 0&&p.sessionKey!==o){if(p.parentSessionKey===o)s({kind:"event",event:p});return}if(p.type==="model.chunk"){let{delta:L,kind:B}=p.data;if(B==="reasoning"){s({kind:"delta",of:"reasoning",text:L});return}s({kind:"delta",of:"text",text:u.current.push(L)});return}if(p.type==="model.result"){s({kind:"delta",of:"text",text:u.current.endStep()});return}if(p.type==="turn.end")s({kind:"delta",of:"text",text:u.current.end()}),u.current=n.streamFilter();s({kind:"event",event:p})}),[n,o]);let m=pe((p)=>{s({kind:"user",text:p});let L=new AbortController;l.current=L,n.send(p,{sessionKey:o,signal:L.signal}).catch((B)=>{s({kind:"event",event:{v:1,ts:new Date().toISOString(),runtimeId:"cli",sessionKey:o,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})},[n,o]),w=pe(()=>{let p=l.current;if(p===void 0||p.signal.aborted)return;s({kind:"cancelling"}),p.abort()},[]),P=pe((p)=>s({kind:"note",text:p}),[]),M=pe(()=>s({kind:"trim"}),[]);return{state:a,busy:a.status!=="idle",send:m,cancel:w,note:P,trim:M}}var Oe=1,He=1,Ue=1,jn=2,Ne=4,We=2,Vn=14;function Fe(e,n){let{rows:o,caretRow:r}=kn(e,Math.max(1,n-Ne-We)),a=o.length,{from:s,to:l}=De(a,r,Math.max(1,Math.min(a,Uo)));return jn+(l-s)+(s>0?1:0)+(a-l>0?1:0)+(e.value.includes(`
|
|
5
|
+
`)?1:0)}var Bt=2;function $t(e,n){if(e===void 0)return 0;if(e.matches.length===0)return 1;let o=Math.min(e.matches.length,n),r=e.matches.length>o?1:0;return o+r+1}function Xn(e,n){if(e.search===void 0)return 0;let o=en(e);return(o.length===0?1:Math.min(o.length,n))+1}function zn(e){let n=e.live,o=n===void 0?"":e.showReasoning&&n.reasoning!==""&&n.text===""?n.reasoning:n.text,r=Oe+He+no(o,e.columns-Vn,Lo).rows+Xn(e.editor,e.searchMaxRows)+Fe(e.editor,e.columns)+(e.confirming?1:0)+(e.hint?1:0),a=Math.max(1,Math.min(e.paletteMaxRows,e.rows-r-Bt-1)),s=Oe+He+no(o,e.columns-Vn,Lo).rows+$t(e.palette,a)+Xn(e.editor,e.searchMaxRows)+Fe(e.editor,e.columns)+(e.confirming?1:0)+(e.hint?1:0),l=En(e.rows,s),u=e.landing?Math.max(0,l-ma-Tr):0;return{paletteRows:a,brand:u,body:l,transcript:Math.max(1,l-Ue),pane:Math.max(1,l-3)}}function Jn(e,n){let o=(n.brandLines===0?0:n.brandLines+Tr)+Oe+Ue,r=e.row-o;if(r<0)return;let a=n.from+r;if(a>=n.to)return;return{row:a,column:e.column}}function Qn(e,n){let o=kn(n.editor,Math.max(1,n.columns-Ne-We)),r=o.rows.length,{from:a,to:s}=De(r,o.caretRow,Math.max(1,Math.min(r,Uo))),l=a>0?1:0,u=Fe(n.editor,n.columns),w=n.rows-He-(n.hint?1:0)-u+jn/2+l,P=e.row-w;if(P<0||P>=s-a)return;let M=o.rows[a+P];if(M===void 0)return;let p=e.column-Ne/2-We;if(p<0)return M.start;return Math.min(M.end,M.start+Math.max(0,p-M.lead))}function Zn(e,n){let o=n===0?0:n+Tr;return Math.max(1,e.body-o-Ue)}var It=[{command:"pbcopy",args:[]},{command:"wl-copy",args:[]},{command:"xclip",args:["-selection","clipboard"]},{command:"xsel",args:["--clipboard","--input"]}];async function Ve(e){if(e==="")return{copied:!1,problem:"nothing selected"};let n=[];for(let o of It){let r=await wt({command:o.command,args:o.args,input:e,timeoutMs:2000});if(r.notFound){n.push(o.command);continue}if(r.code===0)return{copied:!0,using:o.command};return{copied:!1,using:o.command,problem:r.stderr.trim()||`${o.command} exited ${r.code}`}}return{copied:!1,problem:`no clipboard command found (tried ${n.join(", ")})`}}function Ot(e){return TA(e)?.args.findIndex((n)=>n.name==="manifest")??-1}function Dt(e){let n=e.rest.trim()===""?[]:e.rest.trim().split(/\s+/),o=Ot(e.name),r=o===-1||n.length<o?n:[...n.slice(0,o),e.manifestPath,...n.slice(o)];return[e.name,...r,"--plain"]}function Ht(e){let n=TA(e.name);if(n===void 0)return;let o=n.flags.find((s)=>s.name==="follow");if(o===void 0)return;if(!e.rest.trim().split(/\s+/).some((s)=>s==="--follow"||o.short!==void 0&&s===`-${o.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: ${e.name} ${e.rest.trim()}`}async function qn(e){let n=Ht(e);if(n!==void 0)return{lines:[n],code:1};let o=e.interpreter??process.execPath,r=e.script??(e.interpreter!==void 0?"":process.argv[1]??""),a=await wt({command:o,args:[r,...Dt(e)],...e.env===void 0?{}:{env:e.env},timeoutMs:e.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 ${o}`],code:1};if(a.signalled)return{lines:[...l,`${e.name} was stopped before it finished`],code:1};return{lines:l,code:a.code}}import{jsx as g,jsxs as K,Fragment as Gt}from"react/jsx-runtime";function Lr({source:e,sessionKey:n,model:o,agentName:r,warnings:a,freshSession:s,initial:l,correctKeys:u,showReasoning:m,quiet:w,onRestart:P,onSwitch:M,onNew:p,sessions:L,initialDraft:B,manifestPath:D,catalogue:ne,status:Ye,contextView:Xe}){let{exit:j}=Nt(),z=je(),R=Pe(z.columns,be),{state:E,busy:se,send:it,cancel:st,note:x,trim:Ke}=Un({source:e,sessionKey:n,initial:l}),[A,I]=_(()=>B===void 0||B===""?he:{...he,value:B,cursor:[...B].length}),[k,C]=_({kind:"none"}),[ze,at]=_(void 0),[Je,dt]=_(void 0),[Qe,lt]=_(void 0),[ae,xe]=_(V),[te,ge]=_(!1),[we,Ze]=_(!1),[qe,ct]=_(!1),[Q,G]=_(void 0),ye=Wt(void 0),H=k.kind==="none"?Ji(A.value):void 0,[Te,de]=_(0),ut=Wn(se),mt=rt(()=>zi(E.items),[E.items]),Z=rt(()=>Zi(E.items,{showReasoning:m,quiet:w,columns:R,expandReasoning:qe}),[E.items,m,w,R,qe]),q=s===!0&&!E.items.some((h)=>h.role==="user"),Se=q?Qa:pa,F=zn({rows:z.rows,columns:R,editor:A,live:E.live,showReasoning:m,palette:H,paletteMaxRows:Se,searchMaxRows:Se,confirming:we,landing:q,hint:q}),le=F.brand>0?_n(t.name,{columns:R-mA,rows:F.brand}):void 0,ke=Mn(ae,Z.length,Zn(F,le?.lines.length??0));ot(()=>{if(!ae.pinned)return;G(void 0),Ke()},[ae.pinned,E.items.length,Ke]),ot(()=>{if(!te)return;let h=setTimeout(()=>ge(!1),Da);return()=>clearTimeout(h)},[te]);let on=(h,T)=>{let f=Hn(h,Yn());if(f!==void 0)switch(f.kind){case"exit":Ze(!0);return;case"restart":{let d=e.reload;if(d===void 0){P?.(T),j();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":p?.(T),j();return;case"help":x(Kn());return;case"tools":e.tools().then((d)=>x(DA(d))).catch((d)=>x(`could not read the tools: ${d instanceof Error?d.message:String(d)}`));return;case"context":if(Xe===void 0){x("context is unavailable in this session");return}Xe().then(x).catch((d)=>x(`could not read the context: ${d instanceof Error?d.message:String(d)}`));return;case"status":if(Ye===void 0){x("status is unavailable in this session");return}Ye().then(x).catch((d)=>x(`could not read the status: ${d instanceof Error?d.message:String(d)}`));return;case"reset":e.clearSession(n).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(rn(`/${f.name}`,f.rest))return;x(nn({word:`/${f.name}`}));return;case"unknown":x(nn(f));return}if(se){x("a turn is still running — ^C cancels it, then send again");return}it(h)},Re=tt((h,T)=>{C({kind:"output",label:`/${h}`,lines:void 0,offset:0}),qn({name:h,rest:T,manifestPath:D??""}).then((f)=>C({kind:"output",label:`/${h}`,lines:f.lines,code:f.code,offset:0})).catch((f)=>C({kind:"output",label:`/${h}`,lines:[f instanceof Error?f.message:String(f)],code:1,offset:0}))},[D]),rn=tt((h,T)=>{let f=er().find((d)=>d.word===h);if(f===void 0)return!1;if(f.kind==="view"){if(f.word==="/sessions"&&L!==void 0&&M!==void 0)return C({kind:"sessions",stored:void 0}),import("./SessionPicker-hpv2ncsb.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"&&(T.trim()===""||T.trim()==="edit")){if(D===void 0)return x("this session has no manifest path, so there is nothing to edit"),!0;return C({kind:"config",rows:BA(D)}),import("./ConfigEditor-vk7vxaa6.js").then((d)=>dt(()=>d.ConfigEditor)),!0}if(f.word==="/skills"&&ne!==void 0)return C({kind:"skills"}),import("./SkillBrowser-qc542n71.js").then((d)=>at(()=>d.SkillBrowser)),!0;return Re(f.word.slice(1),T),!0}if(f.kind==="output")return Re(f.word.slice(1),T),!0;return!1},[Re,ne,L,M,x,D]);if(et((h,T)=>{if(k.kind!=="output")return;if(T.escape||h==="q"){C({kind:"none"});return}let f=k.lines?.length??0,d=T.pageDown||T.pageUp?F.pane:1,c=T.downArrow||T.pageDown?d:T.upArrow||T.pageUp?-d:0;if(c!==0)C({...k,offset:Math.max(0,Math.min(k.offset+c,Math.max(0,f-1)))})},{isActive:k.kind==="output"}),et((h,T)=>{let f=u===void 0?T:u(T,h);if(we){if(Ze(!1),h.toLowerCase()==="y"||f.return)j();return}if(H!==void 0){if(f.escape){I((y)=>Ge(y,{kind:"killToStart"})),de(0);return}if(f.upArrow||f.downArrow){de((y)=>Math.max(0,Math.min(y+(f.downArrow?1:-1),H.matches.length-1)));return}if(f.tab){let y=Fr(H,Te);if(y!==void 0)I((v)=>Ge({...v,value:"",cursor:0},{kind:"insert",text:y.word}));return}let c=Fr(H,Te);if(f.return&&c!==void 0){let y=c;if(de(0),I((v)=>({...v,value:"",cursor:0})),y.kind==="session")on(y.word,"");else rn(y.word,"");return}}let d=tn(h,f,Gn(A,se,{armed:te,scrolled:!ae.pinned}));if(te&&d.kind!=="exit")ge(!1);if(d.kind==="arm"){ge(!0);return}if(d.kind==="scroll"){let c=Math.max(1,d.times??1);xe((y)=>{let v=y;for(let S=0;S<c;S+=1)v=Tn(v,d.move,Z.length,F.transcript);return v});return}if(d.kind==="pointer"){let c=Jn({column:d.column,row:d.row},{brandLines:le?.lines.length??0,from:ke.from,to:ke.to});if(c===void 0){let S=Qn({column:d.column,row:d.row},{editor:A,columns:R,rows:z.rows,hint:q});if(S===void 0){if(d.gesture==="press")G(void 0),I((U)=>({...U,anchor:void 0}));return}G(void 0),I((U)=>d.gesture==="press"&&!d.shift?{...U,cursor:S,anchor:S}:{...U,cursor:S,anchor:U.anchor??U.cursor});return}if(d.gesture==="press"){if(d.shift&&Q!==void 0){G(Ln(Q,c)),ye.current=void 0;return}let S=ye.current,Me=S!==void 0&&Date.now()-S.when<=Sa&&S.at.row===c.row&&S.at.column===c.column?S.clicks%3+1:1;ye.current={at:c,when:Date.now(),clicks:Me},I((pt)=>({...pt,anchor:void 0})),G(Me===3?Be(Z,c):Me===2?In(Z,c):Cn(c));return}if(d.gesture==="drag"){G((S)=>S===void 0?void 0:_e(S,c));return}let y=Q===void 0?void 0:An(_e(Q,c));G(y);let v=$n(Z,y);if(v!=="")Ve(v).then((S)=>{if(!S.copied&&S.problem!=="nothing selected")x(`could not copy: ${S.problem??"unknown"}`)});return}if(d.kind==="copySelection"||d.kind==="cutSelection"){let c=wA(A);if(c===void 0){x("nothing selected — hold shift with a motion, or drag in the box");return}let y=[...A.value].slice(c.start,c.end).join("");if(d.kind==="cutSelection")I((v)=>Ge(v,d));Ve(y).then((v)=>{if(!v.copied)x(`could not copy: ${v.problem??"unknown"}`)});return}if(d.kind==="reasoning"){let c=E.items.some((y)=>(y.subagent?.lines.length??0)>0);if(!c&&!m){x("reasoning is off: either this model does not stream it, or --no-reasoning is set");return}if(!c&&!E.items.some((y)=>y.role==="reasoning")){x("no reasoning to show yet — this expands it once a turn has streamed some");return}ct((y)=>!y),xe(V);return}if(d.kind==="exit"){j();return}if(d.kind==="cancel"){st();return}if(d.kind==="submit"){let c=xi(A);if(I(c.state),xe(V),c.text!=="")on(c.text,c.state.value);return}if(d.kind==="paste"){I((c)=>Ge(c,{kind:"insert",text:d.lines.join(`
|
|
8
|
+
`)}));return}if(H!==void 0)de(0);I((c)=>Ge(c,d))},{isActive:k.kind==="none"}),k.kind==="config")return K(O,{flexDirection:"column",width:R,height:z.rows,children:[g(X,{color:i.accent,bold:!0,wrap:"truncate",children:Mr({title:`${t.name} ${J}`,summary:"settings"},R)}),Je===void 0?g(O,{marginLeft:2,children:g(nt,{label:"reading the settings"})}):g(Je,{rows:k.rows,apply:(h,T)=>Nn(D??"",h,T),reload:()=>BA(D??""),columns:R,window:Sn,onDone:(h)=>{if(C({kind:"none"}),h)P?.(A.value),j()}}),g(O,{flexGrow:1})]});if(k.kind==="sessions")return K(O,{flexDirection:"column",width:R,height:z.rows,children:[g(X,{color:i.accent,bold:!0,wrap:"truncate",children:Mr({title:`${t.name} ${J}`,summary:"pick a conversation"},R)}),g(O,{flexGrow:1}),k.stored===void 0||Qe===void 0?g(O,{marginLeft:2,children:g(nt,{label:"reading the stored conversations"})}):g(Qe,{sessions:k.stored,now:Date.now(),columns:R,maxRows:Sn,current:n,onDone:(h)=>{if(h===void 0||h===n){C({kind:"none"});return}M?.(h,A.value),j()}}),g(O,{flexGrow:1})]});if(k.kind==="skills"&&ne!==void 0&&ze!==void 0)return g(ze,{title:`${t.name} ${J}`,agents:[],target:D??"",load:ne.load,install:ne.install,onDone:()=>C({kind:"none"})});let ft=Mr({title:`${t.name} ${J}`,summary:"",agent:{name:r,model:o},...a===void 0||a.length===0?{}:{warnings:a}},R);return K(O,{flexDirection:"column",width:R,height:z.rows,children:[le===void 0?null:K(Gt,{children:[g(Rn,{lines:le.lines}),g(X,{children:" "})]}),g(X,{color:i.accent,bold:!0,wrap:"truncate",children:ft}),k.kind==="output"?K(O,{flexDirection:"column",children:[g(sn,{lines:k.lines,label:k.label,offset:k.offset,maxRows:F.pane,...k.code===void 0?{}:{code:k.code}}),K(X,{dimColor:!0,wrap:"truncate",children:[" ","↑↓ scroll · esc back to the prompt"]})]}):g(Dn,{rows:Z,slice:ke,...Q===void 0?{}:{selection:Q}}),g(O,{flexGrow:1}),E.live===void 0?null:g(ln,{live:E.live,showReasoning:m,columns:R}),H===void 0?null:g(cn,{palette:H,index:Te,width:R,maxRows:F.paletteRows}),g(an,{editor:A,width:R,maxRows:Se}),we?g(X,{color:i.warning,wrap:"truncate",children:" leave this session? press y to confirm · any other key stays"}):null,g(pn,{editor:A,busy:se,columns:R,...q?{placeholder:"Ask anything…"}:{}}),q?K(X,{dimColor:!0,wrap:"truncate",children:[" ",Yi]}):null,g(wn,{status:E.status,model:o,sessionKey:n,elapsedMs:ut,last:mt,quiet:w,armed:te,...E.pressure===void 0?{}:{pressure:E.pressure},...E.phase===void 0?{}:{phase:E.phase}})]})}export{Lr as App};
|
|
9
|
+
|
|
10
|
+
//# debugId=C558C857DD5440AA64756E2164756E21
|
|
11
|
+
//# sourceMappingURL=App-4w3qkcs4.js.map
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"/**\n * Running one of this binary's own commands, for a pane inside a session.\n *\n * ## Why a child process rather than calling the function\n *\n * The obvious implementation is to call `validateCommand()` and swap `process.stdout.write` for a\n * collector. It is also wrong here: Ink *owns* stdout while a session is mounted, and it writes a frame\n * whenever anything re-renders. A frame drawn during the capture window lands in the collector instead of\n * on the terminal — so the screen silently misses a repaint and the pane shows a frame of itself. Nothing\n * errors; the display is just wrong, intermittently, depending on timing.\n *\n * A child writes to its own pipe. Nothing is hijacked, the frame keeps rendering, and the pane shows\n * exactly what the command prints — which is also the honest thing to show, since \"run this command\" is\n * what the palette offered. The cost is process startup, which is the same ~100 ms every command in this\n * CLI already pays and is invisible next to reading the result.\n *\n * `--plain` is forced, for the reason it exists: a child that thought it had a terminal would return\n * escape sequences, and the pane would render them as text.\n */\n\nimport { findCommand } from \"#lib/commands\"\nimport { spawnCaptureAsync } from \"#lib/spawn\"\n\nexport interface SubcommandResult {\n readonly lines: readonly string[]\n readonly code: number\n}\n\nexport interface SubcommandRequest {\n readonly name: string\n /** Arguments as typed after the command word, split on whitespace. */\n readonly rest: string\n /** The agent this session is running, passed to any command that takes a manifest. */\n readonly manifestPath: string\n /** Injected by tests. `process.execPath` and `process.argv[1]` otherwise. */\n readonly interpreter?: string\n readonly script?: string\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly timeoutMs?: number\n}\n\n/**\n * Where this command wants the manifest among its positionals, or `-1` for one that takes none.\n *\n * Read off the command's own spec rather than a hand-kept list, which was wrong in both directions at\n * once. `NO_MANIFEST` held four names: `soul` takes an *action* first and was not listed, so\n * `/soul distill` ran as `soul <manifestPath> distill` and the action became a path — broken in-session\n * for as long as it has been offered there; and `agents` takes a variadic manifest first and *was*\n * listed, so it ran with none at all.\n *\n * It also could not express the real shape. `config` and `memory` take an action and *then* a manifest,\n * so \"prepend or not\" has no right answer for them — the path belongs at index 1. `soul`'s second\n * positional is a `file` (a long-form identity document, not a manifest), which is why matching on the\n * name matters rather than on the position.\n *\n * The same drift `session-commands.ts` exists to end: a second list describing `COMMANDS` disagrees with\n * it on the first command either one grows. Derived, a new command is covered with nothing to remember.\n */\nfunction manifestIndex(name: string): number {\n return findCommand(name)?.args.findIndex((arg) => arg.name === \"manifest\") ?? -1\n}\n\n/**\n * The argv for a request.\n *\n * Pure and exported so the assembly is testable without starting anything — which matters because\n * getting it wrong means a command runs against the wrong agent, and that is not visible in the output.\n */\nexport function subcommandArgv(request: SubcommandRequest): readonly string[] {\n const rest = request.rest.trim() === \"\" ? [] : request.rest.trim().split(/\\s+/)\n const at = manifestIndex(request.name)\n // Inserted only when everything before it was typed. `/skills` bare would otherwise become\n // `skills <manifestPath>`, putting a path where the action goes — and a command that resolves the\n // agent from the cwd instead is the lesser wrong: it may pick a different agent, where this one\n // cannot run at all. `--plain` stays last, so it cannot be swallowed as a flag's value.\n const positionals =\n at === -1 || rest.length < at\n ? rest\n : [...rest.slice(0, at), request.manifestPath, ...rest.slice(at)]\n return [request.name, ...positionals, \"--plain\"]\n}\n\n/**\n * Why a pane must not run this request, if it must not.\n *\n * A pane captures a child to completion, so a command that never finishes is a pane that shows a spinner\n * until the timeout fires and then reports being killed — thirty seconds of a frozen surface for a flag\n * that worked perfectly at a shell. `daemon logs --follow` is the case: it exists precisely to keep\n * printing until interrupted, and there is nothing for it to be interrupted *by* in here.\n *\n * Refused rather than quietly dropped. Dropping the flag would hand back the tail, which looks like a\n * following command that stopped immediately — a wrong answer that reads as a right one. Keyed off the\n * command's own spec, so a second command that grows a `follow` flag is covered with nothing to remember.\n */\nexport function paneRefusal(request: SubcommandRequest): string | undefined {\n const spec = findCommand(request.name)\n if (spec === undefined) return undefined\n const follow = spec.flags.find((flag) => flag.name === \"follow\")\n if (follow === undefined) return undefined\n const tokens = request.rest.trim().split(/\\s+/)\n const asked = tokens.some(\n (token) =>\n token === \"--follow\" || (follow.short !== undefined && token === `-${follow.short}`),\n )\n if (!asked) return undefined\n return `--follow keeps printing until it is interrupted, and a pane has nothing to interrupt it with. Run it in its own terminal: ${request.name} ${request.rest.trim()}`\n}\n\nexport async function runSubcommand(request: SubcommandRequest): Promise<SubcommandResult> {\n const refusal = paneRefusal(request)\n // Non-zero, because it did not do what was asked. A refusal reported as success is the shape hard\n // rule 8 forbids, whatever the message says.\n if (refusal !== undefined) return { lines: [refusal], code: 1 }\n\n // The interpreter and the script that started this process — `node` and `dist/index.js` under\n // the npm install, `bun` and `src/index.ts` from a checkout. `request.interpreter`/`request.script`\n // override, because the tests inject both; an interpreter injected without a script gets an\n // empty one rather than this process's, which would run the wrong program under the fake.\n const interpreter = request.interpreter ?? process.execPath\n const script =\n request.script ?? (request.interpreter !== undefined ? \"\" : (process.argv[1] ?? \"\"))\n const result = await spawnCaptureAsync({\n command: interpreter,\n args: [script, ...subcommandArgv(request)],\n ...(request.env === undefined ? {} : { env: request.env }),\n timeoutMs: request.timeoutMs ?? 30_000,\n })\n\n // stderr is shown, not dropped. A command that failed says why on stderr, and a pane that showed only\n // stdout would render an empty box for the case a person most needs to read.\n const body = [result.stdout, result.stderr].filter((part) => part.trim() !== \"\").join(\"\\n\")\n const lines = body === \"\" ? [] : body.replace(/\\n+$/, \"\").split(\"\\n\")\n if (result.notFound) {\n return { lines: [`could not run ${interpreter}`], code: 1 }\n }\n if (result.signalled) {\n return { lines: [...lines, `${request.name} was stopped before it finished`], code: 1 }\n }\n return { lines, code: result.code }\n}\n"
|
|
20
20
|
],
|
|
21
21
|
"mappings": ";0zBA2BA,cAAS,UAAK,YAAM,eAAQ,aAC5B,sBAA6B,gBAAa,cAAW,aAAS,eAAQ,cCVtE,cAAS,WAAK,iEAgBP,SAAS,EAAa,EAAG,QAAO,QAAO,SAAQ,UAAS,QAA4B,CACvF,GAAI,IAAU,OACV,OACI,GAAC,GAAD,CAAK,WAAY,EAAjB,SACI,GAAC,GAAD,CAAS,MAAO,WAAW,IAAS,EACtC,EAIV,GAAI,EAAM,SAAW,EACjB,OACI,GAAC,GAAD,CAAK,WAAY,E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EAAM,YACnB,EAEJ,EAAC,GAAD,CAAe,OAAQ,EAAQ,MAAO,EAAS,QAAS,GAAU,EAMjE,GACG,EAAC,EAAD,CAAM,MAAO,EAAM,QAAS,KAAK,WAAjC,SACK,iEACH,EACF,KACJ,EAAC,GAAD,CACI,OAAQ,EACR,KAAM,GACN,QAAS,KACJ,EAAU,CAAE,YAAa,eAAgB,EAAI,CAAC,EACvD,EAKC,EACG,EAAC,EAAD,CAAM,SAAQ,GAAC,KAAK,WAApB,SAGE,CAFG,KACA,IACH,EACF,KAGJ,EAAC,GAAD,CACI,OAAQ,EAAM,OACd,MAAO,EACP,WAAY,EACZ,UAAW,GACX,KAAM,GACN,MAAO,EACP,MAAO,MACF,EAAM,WAAa,OAAY,CAAC,EAAI,CAAE,SAAU,EAAM,QAAS,KAC/D,EAAM,QAAU,OAAY,CAAC,EAAI,CAAE,MAAO,EAAM,KAAM,EAC/D,GACF",
|
|
22
|
-
"debugId": "
|
|
22
|
+
"debugId": "C558C857DD5440AA64756E2164756E21",
|
|
23
23
|
"names": []
|
|
24
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{B,N,p,a,ne,l,Ee,M,w,pe,xe,CA,P}from"./index-633eqxry.js";import{I}from"./index-t6xnecdx.js";var Q=I(N(),1);function U(e){let t=e.trim();if(t.length!==36||t[8]!=="-"||t[13]!=="-"||t[18]!=="-"||t[23]!=="-")throw Error(`Invalid GUID format: ${e}`);let r,i=new Uint8Array(16);r=parseInt(t.slice(0,8),16),i[0]=r&255,i[1]=r>>>8&255,i[2]=r>>>16&255,i[3]=r>>>24&255,r=parseInt(t.slice(9,13),16),i[4]=r&255,i[5]=r>>>8&255,r=parseInt(t.slice(14,18),16),i[6]=r&255,i[7]=r>>>8&255,r=parseInt(t.slice(19,23),16),i[8]=r>>>8&255,i[9]=r&255,r=parseInt(t.slice(24,32),16),i[10]=r>>>24&255,i[11]=r>>>16&255,i[12]=r>>>8&255,i[13]=r&255,r=parseInt(t.slice(32,36),16),i[14]=r>>>8&255,i[15]=r&255;for(let s=0;s<16;s++)if(!Number.isFinite(i[s]))throw Error(`Invalid GUID format: ${e}`);if(!/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(t))throw Error(`Invalid GUID format: ${e}`);return i}class A{constructor(e){if(e.length!==16)throw Error("GUID must be exactly 16 bytes");this.bytes=e}static fromString(e){return new A(U(e))}toString(){let e=this.bytes,t=(m)=>m.toString(16).padStart(2,"0"),r=t(e[3])+t(e[2])+t(e[1])+t(e[0]),i=t(e[5])+t(e[4]),s=t(e[7])+t(e[6]),o=t(e[8])+t(e[9]),c=t(e[10])+t(e[11])+t(e[12])+t(e[13])+t(e[14])+t(e[15]);return`${r}-${i}-${s}-${o}-${c}`.toUpperCase()}equals(e,t=0){if(t<0||e.length-t<16)return!1;let r=this.bytes;for(let i=0;i<16;i++)if(e[t+i]!==r[i])return!1;return!0}}class n{static fromBin(e,t=0){return new n(n.decode(e,t))}static decode(e,t=0){return new A(e.subarray(t,t+16)).toString()}static decodeMediaType(e){switch(e.str){case n.AudioMedia.str:return"audio";case n.VideoMedia.str:return"video";case n.CommandMedia.str:return"command";case n.Degradable_JPEG_Media.str:return"degradable-jpeg";case n.FileTransferMedia.str:return"file-transfer";case n.BinaryMedia.str:return"binary"}}static encode(e){return U(e)}constructor(e){this.str=e}equals(e){return this.str===e.str}toBin(){return n.encode(this.str)}}n.HeaderObject=new n("75B22630-668E-11CF-A6D9-00AA0062CE6C");n.DataObject=new n("75B22636-668E-11CF-A6D9-00AA0062CE6C");n.SimpleIndexObject=new n("33000890-E5B1-11CF-89F4-00A0C90349CB");n.IndexObject=new n("D6E229D3-35DA-11D1-9034-00A0C90349BE");n.MediaObjectIndexObject=new n("FEB103F8-12AD-4C64-840F-2A1D2F7AD48C");n.TimecodeIndexObject=new n("3CB73FD0-0C4A-4803-953D-EDF7B6228F0C");n.FilePropertiesObject=new n("8CABDCA1-A947-11CF-8EE4-00C00C205365");n.StreamPropertiesObject=new n("B7DC0791-A9B7-11CF-8EE6-00C00C205365");n.HeaderExtensionObject=new n("5FBF03B5-A92E-11CF-8EE3-00C00C205365");n.CodecListObject=new n("86D15240-311D-11D0-A3A4-00A0C90348F6");n.ScriptCommandObject=new n("1EFB1A30-0B62-11D0-A39B-00A0C90348F6");n.MarkerObject=new n("F487CD01-A951-11CF-8EE6-00C00C205365");n.BitrateMutualExclusionObject=new n("D6E229DC-35DA-11D1-9034-00A0C90349BE");n.ErrorCorrectionObject=new n("75B22635-668E-11CF-A6D9-00AA0062CE6C");n.ContentDescriptionObject=new n("75B22633-668E-11CF-A6D9-00AA0062CE6C");n.ExtendedContentDescriptionObject=new n("D2D0A440-E307-11D2-97F0-00A0C95EA850");n.ContentBrandingObject=new n("2211B3FA-BD23-11D2-B4B7-00A0C955FC6E");n.StreamBitratePropertiesObject=new n("7BF875CE-468D-11D1-8D82-006097C9A2B2");n.ContentEncryptionObject=new n("2211B3FB-BD23-11D2-B4B7-00A0C955FC6E");n.ExtendedContentEncryptionObject=new n("298AE614-2622-4C17-B935-DAE07EE9289C");n.DigitalSignatureObject=new n("2211B3FC-BD23-11D2-B4B7-00A0C955FC6E");n.PaddingObject=new n("1806D474-CADF-4509-A4BA-9AABCB96AAE8");n.ExtendedStreamPropertiesObject=new n("14E6A5CB-C672-4332-8399-A96952065B5A");n.AdvancedMutualExclusionObject=new n("A08649CF-4775-4670-8A16-6E35357566CD");n.GroupMutualExclusionObject=new n("D1465A40-5A79-4338-B71B-E36B8FD6C249");n.StreamPrioritizationObject=new n("D4FED15B-88D3-454F-81F0-ED5C45999E24");n.BandwidthSharingObject=new n("A69609E6-517B-11D2-B6AF-00C04FD908E9");n.LanguageListObject=new n("7C4346A9-EFE0-4BFC-B229-393EDE415C85");n.MetadataObject=new n("C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA");n.MetadataLibraryObject=new n("44231C94-9498-49D1-A141-1D134E457054");n.IndexParametersObject=new n("D6E229DF-35DA-11D1-9034-00A0C90349BE");n.MediaObjectIndexParametersObject=new n("6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7");n.TimecodeIndexParametersObject=new n("F55E496D-9797-4B5D-8C8B-604DFE9BFB24");n.CompatibilityObject=new n("26F18B5D-4584-47EC-9F5F-0E651F0452C9");n.AdvancedContentEncryptionObject=new n("43058533-6981-49E6-9B74-AD12CB86D58C");n.AudioMedia=new n("F8699E40-5B4D-11CF-A8FD-00805F5C442B");n.VideoMedia=new n("BC19EFC0-5B4D-11CF-A8FD-00805F5C442B");n.CommandMedia=new n("59DACFC0-59E6-11D0-A3AC-00A0C90348F6");n.JFIF_Media=new n("B61BE100-5B4E-11CF-A8FD-00805F5C442B");n.Degradable_JPEG_Media=new n("35907DE0-E415-11CF-A917-00805F5C442B");n.FileTransferMedia=new n("91BD222C-F21C-497A-8B6D-5AA86BFC0185");n.BinaryMedia=new n("3AFB65E2-47EF-40F2-AC2C-70A90D71D343");n.ASF_Index_Placeholder_Object=new n("D9AADE20-7C17-4F9C-BC28-8555DD98E2A2");var d=n;function f(e){return Y[e]}function F(e){return xe(pe(e,"utf-16le"))}var Y=[F,H,Z,G,ee,W,H];function H(e){return new Uint8Array(e)}function Z(e,t=0){return W(e,t)===1}function G(e,t=0){return a.get(e,t)}function ee(e,t=0){return ne.get(e,t)}function W(e,t=0){return p.get(e,t)}class g extends M("ASF"){}var z={len:30,get:(e,t)=>{let r=C.get(e,t);if(r.objectSize<z.len)throw new g(`Invalid ASF top-level header object size: ${r.objectSize}`);return{...r,numberOfHeaderObjects:a.get(e,t+24)}}},C={len:24,get:(e,t)=>{let r=ne.get(e,t+16);if(r<BigInt(C.len)||r>BigInt(Number.MAX_SAFE_INTEGER))throw new g(`Invalid ASF header object size: ${r}`);return{objectId:d.fromBin(e,t),objectSize:Number(r)}}};class h{constructor(e){this.len=e.objectSize-C.len}postProcessTag(e,t,r,i){if(t==="WM/Picture")e.push({id:t,value:L.fromBuffer(i)});else{let s=f(r);if(!s)throw new g(`unexpected value headerType: ${r}`);e.push({id:t,value:s(i)})}}}class D extends h{get(e,t){return{fileId:d.fromBin(e,t),fileSize:ne.get(e,t+16),creationDate:ne.get(e,t+24),dataPacketsCount:ne.get(e,t+32),playDuration:ne.get(e,t+40),sendDuration:ne.get(e,t+48),preroll:ne.get(e,t+56),flags:{broadcast:w(e,t+64,24),seekable:w(e,t+64,25)},minimumDataPacketSize:a.get(e,t+68),maximumDataPacketSize:a.get(e,t+72),maximumBitrate:a.get(e,t+76)}}}D.guid=d.FilePropertiesObject;class x extends h{get(e,t){return{streamType:d.decodeMediaType(d.fromBin(e,t)),errorCorrectionType:d.fromBin(e,t+8)}}}x.guid=d.StreamPropertiesObject;class u{constructor(){this.len=22}get(e,t){let r=new DataView(e.buffer,t);return{reserved1:d.fromBin(e,t),reserved2:r.getUint16(16,!0),extensionDataSize:r.getUint32(18,!0)}}}u.guid=d.HeaderExtensionObject;var te={len:20,get:(e,t)=>({entryCount:new DataView(e.buffer,t).getUint16(16,!0)})};class R{constructor(e,t){this.tokenizer=e,this.remaining=t}async readToken(e){this.ensureAvailable(e.len);let t=await this.tokenizer.readToken(e);return this.remaining-=e.len,t}async readNumber(e){return this.readToken(e)}async readBuffer(e){this.ensureAvailable(e);let t=new Uint8Array(e);return await this.tokenizer.readBuffer(t),this.remaining-=e,t}async ignoreRemaining(){let e=await this.tokenizer.ignore(this.remaining);if(e!==this.remaining)throw new g(`Unexpected end of ASF Codec List Object; missing ${this.remaining-e} bytes`);this.remaining=0}ensureAvailable(e){if(e>this.remaining)throw new g(`ASF Codec List field size ${e} exceeds remaining object payload size ${this.remaining}`)}}async function V(e){let t=await e.readNumber(p);return(await e.readToken(new l(t*2,"utf-16le"))).replace("\x00","")}async function q(e,t){let r=new R(e,t),i=await r.readToken(te),s=[];for(let o=0;o<i.entryCount;++o)s.push(await re(r));return await r.ignoreRemaining(),s}async function ae(e){let t=await e.readNumber(p);return e.readBuffer(t)}async function re(e){let t=await e.readNumber(p);return{type:{videoCodec:(t&1)===1,audioCodec:(t&2)===2},codecName:await V(e),description:await V(e),information:await ae(e)}}class j extends h{get(e,t){let r=[],i=new DataView(e.buffer,t),s=10;for(let o=0;o<j.contentDescTags.length;++o){let c=i.getUint16(o*2,!0);if(c>0){let m=j.contentDescTags[o],b=s+c;r.push({id:m,value:F(e.subarray(t+s,t+b))}),s=b}}return r}}j.guid=d.ContentDescriptionObject;j.contentDescTags=["Title","Author","Copyright","Description","Rating"];class T extends h{get(e,t){let r=[],i=new DataView(e.buffer,t),s=i.getUint16(0,!0),o=2;for(let c=0;c<s;c+=1){let m=i.getUint16(o,!0);o+=2;let b=F(e.subarray(t+o,t+o+m));o+=m;let O=i.getUint16(o,!0);o+=2;let S=i.getUint16(o,!0);o+=2;let v=e.subarray(t+o,t+o+S);o+=S,this.postProcessTag(r,b,O,v)}return r}}T.guid=d.ExtendedContentDescriptionObject;class y extends h{get(e,t){let r=new DataView(e.buffer,t);return{startTime:ne.get(e,t),endTime:ne.get(e,t+8),dataBitrate:r.getInt32(12,!0),bufferSize:r.getInt32(16,!0),initialBufferFullness:r.getInt32(20,!0),alternateDataBitrate:r.getInt32(24,!0),alternateBufferSize:r.getInt32(28,!0),alternateInitialBufferFullness:r.getInt32(32,!0),maximumObjectSize:r.getInt32(36,!0),flags:{reliableFlag:w(e,t+40,0),seekableFlag:w(e,t+40,1),resendLiveCleanpointsFlag:w(e,t+40,2)},streamNumber:r.getInt16(42,!0),streamLanguageId:r.getInt16(44,!0),averageTimePerFrame:r.getInt32(52,!0),streamNameCount:r.getInt32(54,!0),payloadExtensionSystems:r.getInt32(56,!0),streamNames:[],streamPropertiesObject:null}}}y.guid=d.ExtendedStreamPropertiesObject;class E extends h{get(e,t){let r=[],i=new DataView(e.buffer,t),s=i.getUint16(0,!0),o=2;for(let c=0;c<s;c+=1){o+=4;let m=i.getUint16(o,!0);o+=2;let b=i.getUint16(o,!0);o+=2;let O=i.getUint32(o,!0);o+=4;let S=F(e.subarray(t+o,t+o+m));o+=m;let v=e.subarray(t+o,t+o+O);o+=O,this.postProcessTag(r,S,b,v)}return r}}E.guid=d.MetadataObject;class k extends E{}k.guid=d.MetadataLibraryObject;class L{static fromBuffer(e){return new L(e.length).get(e,0)}constructor(e){this.len=e}get(e,t){let r=new DataView(e.buffer,t),i=r.getUint8(0),s=r.getInt32(1,!0),o=5;while(r.getUint16(o)!==0)o+=2;let c=new l(o-5,"utf-16le").get(e,5);while(r.getUint16(o)!==0)o+=2;let m=new l(o-5,"utf-16le").get(e,5);return{type:CA[i],format:c,description:m,size:s,data:e.slice(o+4)}}}var _=Q.default("music-metadata:parser:ASF"),oe="asf",J=16777216;class se extends P{async parse(){let e=await this.tokenizer.readToken(z);if(!e.objectId.equals(d.HeaderObject))throw new g(`expected asf header; but was not found; got: ${e.objectId.str}`);if(e.numberOfHeaderObjects<1||e.numberOfHeaderObjects>1e4)throw new g(`Unrealistic number of ASF header objects: ${e.numberOfHeaderObjects}`);await this.parseObjectHeaders(e.numberOfHeaderObjects,e.objectSize-z.len)}async parseObjectHeaders(e,t){let r;for(let i=0;i<e;++i){let{header:s,payloadSize:o}=await this.readObjectHeader(t,"header");switch(_("header GUID=%s",s.objectId.str),s.objectId.str){case D.guid.str:{this.validateAllocationSize(o,"File Properties Object");let c=await this.tokenizer.readToken(new D(s));this.metadata.setFormat("duration",Number(c.playDuration/BigInt(1000))/1e4-Number(c.preroll)/1000),this.metadata.setFormat("bitrate",c.maximumBitrate);break}case x.guid.str:{this.validateAllocationSize(o,"Stream Properties Object");let c=await this.tokenizer.readToken(new x(s));this.metadata.setFormat("container",`ASF/${c.streamType}`);break}case u.guid.str:{let c=new u;if(o<c.len)throw new g(`ASF Header Extension Object payload is too small: ${o} bytes`);let m=await this.tokenizer.readToken(c),b=o-c.len;if(m.extensionDataSize!==b)throw new g(`ASF extension data size ${m.extensionDataSize} does not match enclosing payload size ${b}`);await this.parseExtensionObject(m.extensionDataSize);break}case j.guid.str:this.validateAllocationSize(o,"Content Description Object"),r=await this.tokenizer.readToken(new j(s)),await this.addTags(r);break;case T.guid.str:this.validateAllocationSize(o,"Extended Content Description Object"),r=await this.tokenizer.readToken(new T(s)),await this.addTags(r);break;case d.CodecListObject.str:{this.validateAllocationSize(o,"Codec List Object");let c;try{c=await q(this.tokenizer,o)}catch(b){let O=b instanceof Error?b.message:String(b);throw new g(`Invalid ASF Codec List Object: ${O}`)}c.forEach((b)=>{this.metadata.addStreamInfo({type:b.type.videoCodec?Ee.video:Ee.audio,codecName:b.codecName})});let m=c.filter((b)=>b.type.audioCodec).map((b)=>b.codecName).join("/");this.metadata.setFormat("codec",m);break}case d.StreamBitratePropertiesObject.str:await this.ignorePayload(o,"Stream Bitrate Properties Object");break;case d.PaddingObject.str:_("Padding: %s bytes",o),await this.ignorePayload(o,"Padding Object");break;default:this.metadata.addWarning(`Ignore ASF-Object-GUID: ${s.objectId.str}`),_("Ignore ASF-Object-GUID: %s",s.objectId.str),await this.ignorePayload(o,`object ${s.objectId.str}`)}t-=s.objectSize}if(t!==0)throw new g(`ASF header child objects leave ${t} payload byte(s) unaccounted`)}async addTags(e){await Promise.all(e.map(({id:t,value:r})=>this.metadata.addTag(oe,t,r)))}async readObjectHeader(e,t){if(e<C.len)throw new g(`Insufficient ASF ${t} data for an object header: ${e} bytes`);let r=await this.tokenizer.readToken(C);if(r.objectSize>e)throw new g(`ASF ${t} object size ${r.objectSize} exceeds remaining ${t} payload size ${e}`);return{header:r,payloadSize:this.validatePayloadAvailability(r,`${t} object`)}}validatePayloadAvailability(e,t){let r=e.objectSize-C.len,i=this.tokenizer.fileInfo.size;if(i!==void 0){let s=i-this.tokenizer.position;if(r>s)throw new g(`ASF ${t} payload size ${r} exceeds available input size ${s}`)}return r}validateAllocationSize(e,t){if(e>J)throw new g(`ASF ${t} payload size ${e} exceeds allocation limit ${J}`)}async ignorePayload(e,t){let r;try{r=await this.tokenizer.ignore(e)}catch(i){if(i instanceof B)throw new g(`Unexpected end of ASF ${t}`);throw i}if(r!==e)throw new g(`Unexpected end of ASF ${t}; missing ${e-r} bytes`)}async parseExtensionObject(e){while(e>0){let{header:t,payloadSize:r}=await this.readObjectHeader(e,"extension");switch(t.objectId.str){case y.guid.str:this.validateAllocationSize(r,"Extended Stream Properties Object"),await this.tokenizer.readToken(new y(t));break;case E.guid.str:{this.validateAllocationSize(r,"Metadata Object");let i=await this.tokenizer.readToken(new E(t));await this.addTags(i);break}case k.guid.str:{this.validateAllocationSize(r,"Metadata Library Object");let i=await this.tokenizer.readToken(new k(t));await this.addTags(i);break}case d.PaddingObject.str:await this.ignorePayload(r,"extension Padding Object");break;case d.CompatibilityObject.str:await this.ignorePayload(r,"Compatibility Object");break;case d.ASF_Index_Placeholder_Object.str:await this.ignorePayload(r,"Index Placeholder Object");break;default:this.metadata.addWarning(`Ignore ASF-Object-GUID: ${t.objectId.str}`),await this.ignorePayload(r,`extension object ${t.objectId.str}`);break}e-=t.objectSize}}}export{se as AsfParser};
|
|
2
|
+
import{B,N,f,a,re,l,Ce,M,w,fe,Ke,fA,P}from"./index-ew997be5.js";import{I}from"./index-323jvr1g.js";var Q=I(N(),1);function v(e){let t=e.trim();if(t.length!==36||t[8]!=="-"||t[13]!=="-"||t[18]!=="-"||t[23]!=="-")throw Error(`Invalid GUID format: ${e}`);let r,i=new Uint8Array(16);r=parseInt(t.slice(0,8),16),i[0]=r&255,i[1]=r>>>8&255,i[2]=r>>>16&255,i[3]=r>>>24&255,r=parseInt(t.slice(9,13),16),i[4]=r&255,i[5]=r>>>8&255,r=parseInt(t.slice(14,18),16),i[6]=r&255,i[7]=r>>>8&255,r=parseInt(t.slice(19,23),16),i[8]=r>>>8&255,i[9]=r&255,r=parseInt(t.slice(24,32),16),i[10]=r>>>24&255,i[11]=r>>>16&255,i[12]=r>>>8&255,i[13]=r&255,r=parseInt(t.slice(32,36),16),i[14]=r>>>8&255,i[15]=r&255;for(let s=0;s<16;s++)if(!Number.isFinite(i[s]))throw Error(`Invalid GUID format: ${e}`);if(!/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(t))throw Error(`Invalid GUID format: ${e}`);return i}class S{constructor(e){if(e.length!==16)throw Error("GUID must be exactly 16 bytes");this.bytes=e}static fromString(e){return new S(v(e))}toString(){let e=this.bytes,t=(m)=>m.toString(16).padStart(2,"0"),r=t(e[3])+t(e[2])+t(e[1])+t(e[0]),i=t(e[5])+t(e[4]),s=t(e[7])+t(e[6]),o=t(e[8])+t(e[9]),c=t(e[10])+t(e[11])+t(e[12])+t(e[13])+t(e[14])+t(e[15]);return`${r}-${i}-${s}-${o}-${c}`.toUpperCase()}equals(e,t=0){if(t<0||e.length-t<16)return!1;let r=this.bytes;for(let i=0;i<16;i++)if(e[t+i]!==r[i])return!1;return!0}}class n{static fromBin(e,t=0){return new n(n.decode(e,t))}static decode(e,t=0){return new S(e.subarray(t,t+16)).toString()}static decodeMediaType(e){switch(e.str){case n.AudioMedia.str:return"audio";case n.VideoMedia.str:return"video";case n.CommandMedia.str:return"command";case n.Degradable_JPEG_Media.str:return"degradable-jpeg";case n.FileTransferMedia.str:return"file-transfer";case n.BinaryMedia.str:return"binary"}}static encode(e){return v(e)}constructor(e){this.str=e}equals(e){return this.str===e.str}toBin(){return n.encode(this.str)}}n.HeaderObject=new n("75B22630-668E-11CF-A6D9-00AA0062CE6C");n.DataObject=new n("75B22636-668E-11CF-A6D9-00AA0062CE6C");n.SimpleIndexObject=new n("33000890-E5B1-11CF-89F4-00A0C90349CB");n.IndexObject=new n("D6E229D3-35DA-11D1-9034-00A0C90349BE");n.MediaObjectIndexObject=new n("FEB103F8-12AD-4C64-840F-2A1D2F7AD48C");n.TimecodeIndexObject=new n("3CB73FD0-0C4A-4803-953D-EDF7B6228F0C");n.FilePropertiesObject=new n("8CABDCA1-A947-11CF-8EE4-00C00C205365");n.StreamPropertiesObject=new n("B7DC0791-A9B7-11CF-8EE6-00C00C205365");n.HeaderExtensionObject=new n("5FBF03B5-A92E-11CF-8EE3-00C00C205365");n.CodecListObject=new n("86D15240-311D-11D0-A3A4-00A0C90348F6");n.ScriptCommandObject=new n("1EFB1A30-0B62-11D0-A39B-00A0C90348F6");n.MarkerObject=new n("F487CD01-A951-11CF-8EE6-00C00C205365");n.BitrateMutualExclusionObject=new n("D6E229DC-35DA-11D1-9034-00A0C90349BE");n.ErrorCorrectionObject=new n("75B22635-668E-11CF-A6D9-00AA0062CE6C");n.ContentDescriptionObject=new n("75B22633-668E-11CF-A6D9-00AA0062CE6C");n.ExtendedContentDescriptionObject=new n("D2D0A440-E307-11D2-97F0-00A0C95EA850");n.ContentBrandingObject=new n("2211B3FA-BD23-11D2-B4B7-00A0C955FC6E");n.StreamBitratePropertiesObject=new n("7BF875CE-468D-11D1-8D82-006097C9A2B2");n.ContentEncryptionObject=new n("2211B3FB-BD23-11D2-B4B7-00A0C955FC6E");n.ExtendedContentEncryptionObject=new n("298AE614-2622-4C17-B935-DAE07EE9289C");n.DigitalSignatureObject=new n("2211B3FC-BD23-11D2-B4B7-00A0C955FC6E");n.PaddingObject=new n("1806D474-CADF-4509-A4BA-9AABCB96AAE8");n.ExtendedStreamPropertiesObject=new n("14E6A5CB-C672-4332-8399-A96952065B5A");n.AdvancedMutualExclusionObject=new n("A08649CF-4775-4670-8A16-6E35357566CD");n.GroupMutualExclusionObject=new n("D1465A40-5A79-4338-B71B-E36B8FD6C249");n.StreamPrioritizationObject=new n("D4FED15B-88D3-454F-81F0-ED5C45999E24");n.BandwidthSharingObject=new n("A69609E6-517B-11D2-B6AF-00C04FD908E9");n.LanguageListObject=new n("7C4346A9-EFE0-4BFC-B229-393EDE415C85");n.MetadataObject=new n("C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA");n.MetadataLibraryObject=new n("44231C94-9498-49D1-A141-1D134E457054");n.IndexParametersObject=new n("D6E229DF-35DA-11D1-9034-00A0C90349BE");n.MediaObjectIndexParametersObject=new n("6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7");n.TimecodeIndexParametersObject=new n("F55E496D-9797-4B5D-8C8B-604DFE9BFB24");n.CompatibilityObject=new n("26F18B5D-4584-47EC-9F5F-0E651F0452C9");n.AdvancedContentEncryptionObject=new n("43058533-6981-49E6-9B74-AD12CB86D58C");n.AudioMedia=new n("F8699E40-5B4D-11CF-A8FD-00805F5C442B");n.VideoMedia=new n("BC19EFC0-5B4D-11CF-A8FD-00805F5C442B");n.CommandMedia=new n("59DACFC0-59E6-11D0-A3AC-00A0C90348F6");n.JFIF_Media=new n("B61BE100-5B4E-11CF-A8FD-00805F5C442B");n.Degradable_JPEG_Media=new n("35907DE0-E415-11CF-A917-00805F5C442B");n.FileTransferMedia=new n("91BD222C-F21C-497A-8B6D-5AA86BFC0185");n.BinaryMedia=new n("3AFB65E2-47EF-40F2-AC2C-70A90D71D343");n.ASF_Index_Placeholder_Object=new n("D9AADE20-7C17-4F9C-BC28-8555DD98E2A2");var d=n;function H(e){return Y[e]}function E(e){return Ke(fe(e,"utf-16le"))}var Y=[E,_,Z,G,ee,W,_];function _(e){return new Uint8Array(e)}function Z(e,t=0){return W(e,t)===1}function G(e,t=0){return a.get(e,t)}function ee(e,t=0){return re.get(e,t)}function W(e,t=0){return f.get(e,t)}class g extends M("ASF"){}var A={len:30,get:(e,t)=>{let r=j.get(e,t);if(r.objectSize<A.len)throw new g(`Invalid ASF top-level header object size: ${r.objectSize}`);return{...r,numberOfHeaderObjects:a.get(e,t+24)}}},j={len:24,get:(e,t)=>{let r=re.get(e,t+16);if(r<BigInt(j.len)||r>BigInt(Number.MAX_SAFE_INTEGER))throw new g(`Invalid ASF header object size: ${r}`);return{objectId:d.fromBin(e,t),objectSize:Number(r)}}};class C{constructor(e){this.len=e.objectSize-j.len}postProcessTag(e,t,r,i){if(t==="WM/Picture")e.push({id:t,value:U.fromBuffer(i)});else{let s=H(r);if(!s)throw new g(`unexpected value headerType: ${r}`);e.push({id:t,value:s(i)})}}}class F extends C{get(e,t){return{fileId:d.fromBin(e,t),fileSize:re.get(e,t+16),creationDate:re.get(e,t+24),dataPacketsCount:re.get(e,t+32),playDuration:re.get(e,t+40),sendDuration:re.get(e,t+48),preroll:re.get(e,t+56),flags:{broadcast:w(e,t+64,24),seekable:w(e,t+64,25)},minimumDataPacketSize:a.get(e,t+68),maximumDataPacketSize:a.get(e,t+72),maximumBitrate:a.get(e,t+76)}}}F.guid=d.FilePropertiesObject;class D extends C{get(e,t){return{streamType:d.decodeMediaType(d.fromBin(e,t)),errorCorrectionType:d.fromBin(e,t+8)}}}D.guid=d.StreamPropertiesObject;class x{constructor(){this.len=22}get(e,t){let r=new DataView(e.buffer,t);return{reserved1:d.fromBin(e,t),reserved2:r.getUint16(16,!0),extensionDataSize:r.getUint32(18,!0)}}}x.guid=d.HeaderExtensionObject;var te={len:20,get:(e,t)=>({entryCount:new DataView(e.buffer,t).getUint16(16,!0)})};class R{constructor(e,t){this.tokenizer=e,this.remaining=t}async readToken(e){this.ensureAvailable(e.len);let t=await this.tokenizer.readToken(e);return this.remaining-=e.len,t}async readNumber(e){return this.readToken(e)}async readBuffer(e){this.ensureAvailable(e);let t=new Uint8Array(e);return await this.tokenizer.readBuffer(t),this.remaining-=e,t}async ignoreRemaining(){let e=await this.tokenizer.ignore(this.remaining);if(e!==this.remaining)throw new g(`Unexpected end of ASF Codec List Object; missing ${this.remaining-e} bytes`);this.remaining=0}ensureAvailable(e){if(e>this.remaining)throw new g(`ASF Codec List field size ${e} exceeds remaining object payload size ${this.remaining}`)}}async function V(e){let t=await e.readNumber(f);return(await e.readToken(new l(t*2,"utf-16le"))).replace("\x00","")}async function q(e,t){let r=new R(e,t),i=await r.readToken(te),s=[];for(let o=0;o<i.entryCount;++o)s.push(await ne(r));return await r.ignoreRemaining(),s}async function ae(e){let t=await e.readNumber(f);return e.readBuffer(t)}async function ne(e){let t=await e.readNumber(f);return{type:{videoCodec:(t&1)===1,audioCodec:(t&2)===2},codecName:await V(e),description:await V(e),information:await ae(e)}}class p extends C{get(e,t){let r=[],i=new DataView(e.buffer,t),s=10;for(let o=0;o<p.contentDescTags.length;++o){let c=i.getUint16(o*2,!0);if(c>0){let m=p.contentDescTags[o],b=s+c;r.push({id:m,value:E(e.subarray(t+s,t+b))}),s=b}}return r}}p.guid=d.ContentDescriptionObject;p.contentDescTags=["Title","Author","Copyright","Description","Rating"];class u extends C{get(e,t){let r=[],i=new DataView(e.buffer,t),s=i.getUint16(0,!0),o=2;for(let c=0;c<s;c+=1){let m=i.getUint16(o,!0);o+=2;let b=E(e.subarray(t+o,t+o+m));o+=m;let h=i.getUint16(o,!0);o+=2;let k=i.getUint16(o,!0);o+=2;let z=e.subarray(t+o,t+o+k);o+=k,this.postProcessTag(r,b,h,z)}return r}}u.guid=d.ExtendedContentDescriptionObject;class T extends C{get(e,t){let r=new DataView(e.buffer,t);return{startTime:re.get(e,t),endTime:re.get(e,t+8),dataBitrate:r.getInt32(12,!0),bufferSize:r.getInt32(16,!0),initialBufferFullness:r.getInt32(20,!0),alternateDataBitrate:r.getInt32(24,!0),alternateBufferSize:r.getInt32(28,!0),alternateInitialBufferFullness:r.getInt32(32,!0),maximumObjectSize:r.getInt32(36,!0),flags:{reliableFlag:w(e,t+40,0),seekableFlag:w(e,t+40,1),resendLiveCleanpointsFlag:w(e,t+40,2)},streamNumber:r.getInt16(42,!0),streamLanguageId:r.getInt16(44,!0),averageTimePerFrame:r.getInt32(52,!0),streamNameCount:r.getInt32(54,!0),payloadExtensionSystems:r.getInt32(56,!0),streamNames:[],streamPropertiesObject:null}}}T.guid=d.ExtendedStreamPropertiesObject;class O extends C{get(e,t){let r=[],i=new DataView(e.buffer,t),s=i.getUint16(0,!0),o=2;for(let c=0;c<s;c+=1){o+=4;let m=i.getUint16(o,!0);o+=2;let b=i.getUint16(o,!0);o+=2;let h=i.getUint32(o,!0);o+=4;let k=E(e.subarray(t+o,t+o+m));o+=m;let z=e.subarray(t+o,t+o+h);o+=h,this.postProcessTag(r,k,b,z)}return r}}O.guid=d.MetadataObject;class y extends O{}y.guid=d.MetadataLibraryObject;class U{static fromBuffer(e){return new U(e.length).get(e,0)}constructor(e){this.len=e}get(e,t){let r=new DataView(e.buffer,t),i=r.getUint8(0),s=r.getInt32(1,!0),o=5;while(r.getUint16(o)!==0)o+=2;let c=new l(o-5,"utf-16le").get(e,5);while(r.getUint16(o)!==0)o+=2;let m=new l(o-5,"utf-16le").get(e,5);return{type:fA[i],format:c,description:m,size:s,data:e.slice(o+4)}}}var L=Q.default("music-metadata:parser:ASF"),oe="asf",J=16777216;class se extends P{async parse(){let e=await this.tokenizer.readToken(A);if(!e.objectId.equals(d.HeaderObject))throw new g(`expected asf header; but was not found; got: ${e.objectId.str}`);if(e.numberOfHeaderObjects<1||e.numberOfHeaderObjects>1e4)throw new g(`Unrealistic number of ASF header objects: ${e.numberOfHeaderObjects}`);await this.parseObjectHeaders(e.numberOfHeaderObjects,e.objectSize-A.len)}async parseObjectHeaders(e,t){let r;for(let i=0;i<e;++i){let{header:s,payloadSize:o}=await this.readObjectHeader(t,"header");switch(L("header GUID=%s",s.objectId.str),s.objectId.str){case F.guid.str:{this.validateAllocationSize(o,"File Properties Object");let c=await this.tokenizer.readToken(new F(s));this.metadata.setFormat("duration",Number(c.playDuration/BigInt(1000))/1e4-Number(c.preroll)/1000),this.metadata.setFormat("bitrate",c.maximumBitrate);break}case D.guid.str:{this.validateAllocationSize(o,"Stream Properties Object");let c=await this.tokenizer.readToken(new D(s));this.metadata.setFormat("container",`ASF/${c.streamType}`);break}case x.guid.str:{let c=new x;if(o<c.len)throw new g(`ASF Header Extension Object payload is too small: ${o} bytes`);let m=await this.tokenizer.readToken(c),b=o-c.len;if(m.extensionDataSize!==b)throw new g(`ASF extension data size ${m.extensionDataSize} does not match enclosing payload size ${b}`);await this.parseExtensionObject(m.extensionDataSize);break}case p.guid.str:this.validateAllocationSize(o,"Content Description Object"),r=await this.tokenizer.readToken(new p(s)),await this.addTags(r);break;case u.guid.str:this.validateAllocationSize(o,"Extended Content Description Object"),r=await this.tokenizer.readToken(new u(s)),await this.addTags(r);break;case d.CodecListObject.str:{this.validateAllocationSize(o,"Codec List Object");let c;try{c=await q(this.tokenizer,o)}catch(b){let h=b instanceof Error?b.message:String(b);throw new g(`Invalid ASF Codec List Object: ${h}`)}c.forEach((b)=>{this.metadata.addStreamInfo({type:b.type.videoCodec?Ce.video:Ce.audio,codecName:b.codecName})});let m=c.filter((b)=>b.type.audioCodec).map((b)=>b.codecName).join("/");this.metadata.setFormat("codec",m);break}case d.StreamBitratePropertiesObject.str:await this.ignorePayload(o,"Stream Bitrate Properties Object");break;case d.PaddingObject.str:L("Padding: %s bytes",o),await this.ignorePayload(o,"Padding Object");break;default:this.metadata.addWarning(`Ignore ASF-Object-GUID: ${s.objectId.str}`),L("Ignore ASF-Object-GUID: %s",s.objectId.str),await this.ignorePayload(o,`object ${s.objectId.str}`)}t-=s.objectSize}if(t!==0)throw new g(`ASF header child objects leave ${t} payload byte(s) unaccounted`)}async addTags(e){await Promise.all(e.map(({id:t,value:r})=>this.metadata.addTag(oe,t,r)))}async readObjectHeader(e,t){if(e<j.len)throw new g(`Insufficient ASF ${t} data for an object header: ${e} bytes`);let r=await this.tokenizer.readToken(j);if(r.objectSize>e)throw new g(`ASF ${t} object size ${r.objectSize} exceeds remaining ${t} payload size ${e}`);return{header:r,payloadSize:this.validatePayloadAvailability(r,`${t} object`)}}validatePayloadAvailability(e,t){let r=e.objectSize-j.len,i=this.tokenizer.fileInfo.size;if(i!==void 0){let s=i-this.tokenizer.position;if(r>s)throw new g(`ASF ${t} payload size ${r} exceeds available input size ${s}`)}return r}validateAllocationSize(e,t){if(e>J)throw new g(`ASF ${t} payload size ${e} exceeds allocation limit ${J}`)}async ignorePayload(e,t){let r;try{r=await this.tokenizer.ignore(e)}catch(i){if(i instanceof B)throw new g(`Unexpected end of ASF ${t}`);throw i}if(r!==e)throw new g(`Unexpected end of ASF ${t}; missing ${e-r} bytes`)}async parseExtensionObject(e){while(e>0){let{header:t,payloadSize:r}=await this.readObjectHeader(e,"extension");switch(t.objectId.str){case T.guid.str:this.validateAllocationSize(r,"Extended Stream Properties Object"),await this.tokenizer.readToken(new T(t));break;case O.guid.str:{this.validateAllocationSize(r,"Metadata Object");let i=await this.tokenizer.readToken(new O(t));await this.addTags(i);break}case y.guid.str:{this.validateAllocationSize(r,"Metadata Library Object");let i=await this.tokenizer.readToken(new y(t));await this.addTags(i);break}case d.PaddingObject.str:await this.ignorePayload(r,"extension Padding Object");break;case d.CompatibilityObject.str:await this.ignorePayload(r,"Compatibility Object");break;case d.ASF_Index_Placeholder_Object.str:await this.ignorePayload(r,"Index Placeholder Object");break;default:this.metadata.addWarning(`Ignore ASF-Object-GUID: ${t.objectId.str}`),await this.ignorePayload(r,`extension object ${t.objectId.str}`);break}e-=t.objectSize}}}export{se as AsfParser};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
5
|
-
//# sourceMappingURL=AsfParser-
|
|
4
|
+
//# debugId=C0124239ADF46CDC64756E2164756E21
|
|
5
|
+
//# sourceMappingURL=AsfParser-wd98k2h4.js.map
|