dispach 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -36
- package/dist/APEv2Parser-ysjr6adv.js +5 -0
- package/dist/{FlacParser-bf8y3e0w.js.map → APEv2Parser-ysjr6adv.js.map} +1 -1
- package/dist/{AiffParser-tbx3xkmk.js → AiffParser-9hj6fpmy.js} +3 -3
- package/dist/{AiffParser-tbx3xkmk.js.map → AiffParser-9hj6fpmy.js.map} +1 -1
- package/dist/App-2f72vhjv.js +11 -0
- package/dist/{App-hjn867nc.js.map → App-2f72vhjv.js.map} +3 -3
- package/dist/{AsfParser-d784ak3y.js → AsfParser-7emspn04.js} +3 -3
- package/dist/{AsfParser-d784ak3y.js.map → AsfParser-7emspn04.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-dz88pnnr.js} +3 -3
- package/dist/{DsdiffParser-vxnfx80c.js.map → DsdiffParser-dz88pnnr.js.map} +1 -1
- package/dist/{DsfParser-0xsh0zzk.js → DsfParser-qgh63tbs.js} +3 -3
- package/dist/{DsfParser-0xsh0zzk.js.map → DsfParser-qgh63tbs.js.map} +1 -1
- package/dist/FlacParser-drm5wq0p.js +5 -0
- package/dist/{APEv2Parser-9wqew3zv.js.map → FlacParser-drm5wq0p.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-yr7p3z12.js} +3 -3
- package/dist/{MP4Parser-tq7r7wd4.js.map → MP4Parser-yr7p3z12.js.map} +1 -1
- package/dist/{MatroskaParser-a79gsmzb.js → MatroskaParser-jkbsbsk3.js} +3 -3
- package/dist/{MatroskaParser-a79gsmzb.js.map → MatroskaParser-jkbsbsk3.js.map} +1 -1
- package/dist/{MpegParser-zs61b3wq.js → MpegParser-t93vwnew.js} +3 -3
- package/dist/{MpegParser-zs61b3wq.js.map → MpegParser-t93vwnew.js.map} +1 -1
- package/dist/{MusepackParser-bp8dm6nz.js → MusepackParser-6e8kbh2d.js} +3 -3
- package/dist/{MusepackParser-bp8dm6nz.js.map → MusepackParser-6e8kbh2d.js.map} +1 -1
- package/dist/OggParser-ggcypmag.js +5 -0
- package/dist/{OggParser-7pxr1sn9.js.map → OggParser-ggcypmag.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-jw9stzqp.js} +3 -3
- package/dist/{WavPackParser-gpf3r92t.js.map → WavPackParser-jw9stzqp.js.map} +1 -1
- package/dist/{WaveParser-3kcak550.js → WaveParser-epmncs9w.js} +3 -3
- package/dist/{WaveParser-3kcak550.js.map → WaveParser-epmncs9w.js.map} +1 -1
- package/dist/WizardApp-pgzcz9zq.js +5 -0
- package/dist/{WizardApp-494018sk.js.map → WizardApp-pgzcz9zq.js.map} +3 -3
- package/dist/{channels-yhdvxxrb.js → channels-m8nambmm.js} +14 -14
- package/dist/{channels-yhdvxxrb.js.map → channels-m8nambmm.js.map} +1 -1
- package/dist/client.d.ts +285 -1
- package/dist/client.js +11 -11
- package/dist/client.js.map +5 -5
- package/dist/components/App.d.ts.map +1 -1
- package/dist/{config-g0ybmm4t.js → config-hmgrqgf2.js} +17 -17
- package/dist/{config-g0ybmm4t.js.map → config-hmgrqgf2.js.map} +1 -1
- package/dist/{credential-pkme1sfe.js → credential-nkb2ya59.js} +5 -5
- package/dist/{credential-pkme1sfe.js.map → credential-nkb2ya59.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-1mbdz3f7.js +12 -0
- package/dist/{index-3fgq1acj.js.map → index-1mbdz3f7.js.map} +3 -3
- package/dist/index-1x8mzvz7.js +6 -0
- package/dist/{index-f056wkb4.js.map → index-1x8mzvz7.js.map} +1 -1
- package/dist/{index-633eqxry.js → index-22fzzn7z.js} +7 -7
- package/dist/{index-633eqxry.js.map → index-22fzzn7z.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-ad5c9t83.js → index-308y9xt0.js} +4 -4
- package/dist/{index-ad5c9t83.js.map → index-308y9xt0.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-836hc2h1.js +6 -0
- package/dist/{index-xa9crtzq.js.map → index-836hc2h1.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-8tmv33mr.js +6 -0
- package/dist/{index-vw2hf4d8.js.map → index-8tmv33mr.js.map} +1 -1
- package/dist/index-9t4dz145.js +8 -0
- package/dist/{index-0mz7wpbw.js.map → index-9t4dz145.js.map} +2 -2
- 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-djeqvfms.js +74 -0
- package/dist/index-djeqvfms.js.map +13 -0
- package/dist/{index-307qmvb0.js → index-dpcm1j62.js} +28 -28
- package/dist/{index-307qmvb0.js.map → index-dpcm1j62.js.map} +1 -1
- package/dist/index-dv9pdjy4.js +429 -0
- package/dist/index-dv9pdjy4.js.map +12 -0
- 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-9qv87rq7.js → index-eztfverw.js} +7 -7
- package/dist/{index-9qv87rq7.js.map → index-eztfverw.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-6r9h7ftn.js → index-fxpmx6cr.js} +117 -117
- package/dist/index-fxpmx6cr.js.map +21 -0
- package/dist/{index-ye2yb3xf.js → index-hgm2gchq.js} +6 -6
- package/dist/{index-ye2yb3xf.js.map → index-hgm2gchq.js.map} +1 -1
- package/dist/index-hpvfqq6r.js +1252 -0
- package/dist/{index-26ejkp8q.js.map → index-hpvfqq6r.js.map} +30 -26
- package/dist/{index-y34s71qe.js → index-hrwakb11.js} +3 -3
- package/dist/{index-y34s71qe.js.map → index-hrwakb11.js.map} +1 -1
- 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-twcgf73h.js → index-jff5q27j.js} +4 -4
- package/dist/{index-twcgf73h.js.map → index-jff5q27j.js.map} +1 -1
- package/dist/index-k8e9f466.js +110 -0
- package/dist/index-k8e9f466.js.map +13 -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-ac2wzspd.js → index-mjfv7k5w.js} +4 -4
- package/dist/{index-ac2wzspd.js.map → index-mjfv7k5w.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-jh2az41t.js → index-p6ya59m6.js} +5 -5
- package/dist/{index-jh2az41t.js.map → index-p6ya59m6.js.map} +1 -1
- package/dist/{index-psk6q25h.js → index-pqw1n1pv.js} +4 -4
- package/dist/{index-psk6q25h.js.map → index-pqw1n1pv.js.map} +1 -1
- package/dist/{index-6c4p19m1.js → index-pszmnhgq.js} +2 -2
- package/dist/index-qgsdgbk8.js +5 -0
- package/dist/{index-wk6andxq.js.map → index-qgsdgbk8.js.map} +2 -2
- package/dist/index-qv6ktepc.js +6 -0
- package/dist/index-qv6ktepc.js.map +10 -0
- package/dist/{index-pdsey1ab.js → index-ry6a4bqh.js} +62 -62
- package/dist/{index-pdsey1ab.js.map → index-ry6a4bqh.js.map} +1 -1
- package/dist/{index-x9z2xnct.js → index-sh44ymqz.js} +5 -5
- package/dist/{index-x9z2xnct.js.map → index-sh44ymqz.js.map} +1 -1
- 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-zjphh8ch.js → index-xg7s813b.js} +4 -4
- package/dist/{index-zjphh8ch.js.map → index-xg7s813b.js.map} +1 -1
- package/dist/{index-gqaa06yh.js → index-y7dxq4a4.js} +9 -9
- package/dist/{index-gqaa06yh.js.map → index-y7dxq4a4.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-skkddg44.js → index-zw6wyas6.js} +4 -4
- package/dist/{index-skkddg44.js.map → index-zw6wyas6.js.map} +1 -1
- package/dist/index.js +304 -288
- 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 +25 -0
- package/dist/lib/source.d.ts.map +1 -1
- package/dist/lib/types.d.ts +8 -2
- package/dist/lib/types.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/transcript.d.ts.map +1 -1
- package/dist/{web-f6869dy2.js → web-gfv0mzgs.js} +7 -7
- package/dist/{web-f6869dy2.js.map → web-gfv0mzgs.js.map} +1 -1
- package/dist/wire.d.ts +50 -0
- package/dist/wire.js +5 -5
- 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/OggParser-7pxr1sn9.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-3fgq1acj.js +0 -12
- 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/dist/client.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export interface ErrorDetail {
|
|
|
13
13
|
* embedder shows to people: AWS's text names the assumed-role ARN and the account.
|
|
14
14
|
*/
|
|
15
15
|
readonly detail?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Each failure, when one error stands for several: a manifest that broke two rules. Absent for a
|
|
18
|
+
* single failure, whose own fields already say it.
|
|
19
|
+
*/
|
|
20
|
+
readonly details?: readonly ErrorDetail[];
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* A channel's last reported state.
|
|
@@ -370,6 +375,10 @@ export interface EventDataMap {
|
|
|
370
375
|
name?: string;
|
|
371
376
|
/** The parent's tool call this delegation answers. */
|
|
372
377
|
callId?: string;
|
|
378
|
+
/** A `delegate` task's position in its call, from 0. Absent for a routed call or a handoff. */
|
|
379
|
+
index?: number;
|
|
380
|
+
/** The label the model gave a `delegate` task. */
|
|
381
|
+
label?: string;
|
|
373
382
|
};
|
|
374
383
|
/**
|
|
375
384
|
* How it ended. `outcome` rather than a boolean, and that is the same reasoning
|
|
@@ -386,6 +395,8 @@ export interface EventDataMap {
|
|
|
386
395
|
kind: "member" | "self";
|
|
387
396
|
name?: string;
|
|
388
397
|
callId?: string;
|
|
398
|
+
index?: number;
|
|
399
|
+
label?: string;
|
|
389
400
|
outcome: "ok" | "no_artifact" | "budget" | "error";
|
|
390
401
|
steps: number;
|
|
391
402
|
tokens: {
|
|
@@ -394,6 +405,30 @@ export interface EventDataMap {
|
|
|
394
405
|
};
|
|
395
406
|
errorCode?: string;
|
|
396
407
|
};
|
|
408
|
+
/**
|
|
409
|
+
* A peer ask (`ask_agent`, decision 15.9) began. `sessionKey` is the peer's fresh session, where
|
|
410
|
+
* its transcript is; for a remote peer it is the key in the other silo.
|
|
411
|
+
*/
|
|
412
|
+
"peer.ask": {
|
|
413
|
+
askId: string;
|
|
414
|
+
peer: string;
|
|
415
|
+
remote: boolean;
|
|
416
|
+
sessionKey: string;
|
|
417
|
+
callId?: string;
|
|
418
|
+
};
|
|
419
|
+
/** How it ended. `budget` carries a partial answer; `error` is a fault reaching or inside the peer. */
|
|
420
|
+
"peer.answer": {
|
|
421
|
+
askId: string;
|
|
422
|
+
peer: string;
|
|
423
|
+
sessionKey: string;
|
|
424
|
+
outcome: "ok" | "budget" | "error";
|
|
425
|
+
steps: number;
|
|
426
|
+
tokens: {
|
|
427
|
+
prompt: number;
|
|
428
|
+
output: number;
|
|
429
|
+
};
|
|
430
|
+
errorCode?: string;
|
|
431
|
+
};
|
|
397
432
|
"turn.start": {
|
|
398
433
|
source: string;
|
|
399
434
|
inputTokens: number;
|
|
@@ -471,6 +506,18 @@ export interface EventDataMap {
|
|
|
471
506
|
count: number;
|
|
472
507
|
warning?: string;
|
|
473
508
|
};
|
|
509
|
+
/**
|
|
510
|
+
* A session's checkpoint was written (decision 15.21): by `POST …/sessions/:key/compact`, or after a
|
|
511
|
+
* turn whose `reset` fired. `before` and `after` are the estimated tokens a turn would start from.
|
|
512
|
+
* Its own type rather than a `compaction.stage` member, so a client's switch over that union keeps
|
|
513
|
+
* compiling.
|
|
514
|
+
*/
|
|
515
|
+
"session.compacted": {
|
|
516
|
+
before: number;
|
|
517
|
+
after: number;
|
|
518
|
+
digest: "model" | "mechanical";
|
|
519
|
+
keptTurns: number;
|
|
520
|
+
};
|
|
474
521
|
/**
|
|
475
522
|
* The session moved to another phase, and the visible catalogue changed with it.
|
|
476
523
|
*
|
|
@@ -957,6 +1004,8 @@ export interface WireError {
|
|
|
957
1004
|
readonly hint?: string;
|
|
958
1005
|
/** The manifest path or request field at fault, when the server can name one. */
|
|
959
1006
|
readonly field?: string;
|
|
1007
|
+
/** Each failure, when this error stands for several (a manifest that broke two rules). */
|
|
1008
|
+
readonly details?: readonly WireError[];
|
|
960
1009
|
}
|
|
961
1010
|
export declare class DispachError extends Error {
|
|
962
1011
|
/** Stable and machine-readable. Branch on this, never on `message`. */
|
|
@@ -964,6 +1013,8 @@ export declare class DispachError extends Error {
|
|
|
964
1013
|
/** What to do about it. Empty only if the server sent none, which `spec.test.ts` forbids. */
|
|
965
1014
|
readonly hint: string;
|
|
966
1015
|
readonly field: string | undefined;
|
|
1016
|
+
/** Each failure, when this error stands for several. Empty otherwise. */
|
|
1017
|
+
readonly details: readonly WireError[];
|
|
967
1018
|
/** HTTP status, or `undefined` for a failure that never reached a response. */
|
|
968
1019
|
readonly status: number | undefined;
|
|
969
1020
|
/** The request that produced it, so a caught error is traceable without a log. */
|
|
@@ -1267,6 +1318,24 @@ export interface AgentClient {
|
|
|
1267
1318
|
createSchedule(schedule: Readonly<Record<string, unknown>>): Promise<ScheduleRecord>;
|
|
1268
1319
|
updateSchedule(scheduleId: string, patch: Readonly<Record<string, unknown>>): Promise<ScheduleRecord>;
|
|
1269
1320
|
deleteSchedule(scheduleId: string): Promise<void>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Fetch the tool providers' catalogues now and reload only if what the agent serves moved.
|
|
1323
|
+
* `providers` narrows to some of them; omitted is all. 202 when a turn is running and the
|
|
1324
|
+
* reload is pending.
|
|
1325
|
+
*/
|
|
1326
|
+
refreshTools(options?: {
|
|
1327
|
+
readonly providers?: readonly string[];
|
|
1328
|
+
}): Promise<ToolsRefreshResult>;
|
|
1329
|
+
/**
|
|
1330
|
+
* What an expression means before it is written: the next instants, the zone in force and the
|
|
1331
|
+
* jitter it would carry. Parsed by the server with the same function the write uses.
|
|
1332
|
+
*/
|
|
1333
|
+
previewSchedule(input: {
|
|
1334
|
+
readonly kind: "cron" | "every" | "at";
|
|
1335
|
+
readonly expr: string;
|
|
1336
|
+
readonly timezone?: string;
|
|
1337
|
+
readonly count?: number;
|
|
1338
|
+
}): Promise<SchedulePreview>;
|
|
1270
1339
|
/** Fire one now, out of band. Does **not** move its next scheduled run. */
|
|
1271
1340
|
runSchedule(scheduleId: string): Promise<{
|
|
1272
1341
|
readonly scheduleId: string;
|
|
@@ -1340,6 +1409,31 @@ export interface AgentClient {
|
|
|
1340
1409
|
readonly sessionKey: string;
|
|
1341
1410
|
readonly recall: boolean;
|
|
1342
1411
|
}>;
|
|
1412
|
+
/**
|
|
1413
|
+
* The conversation a message naming `sessionKey` would run in, without sending one. Under
|
|
1414
|
+
* `sessions.scope: owner` a caller's own key runs in `owner:<P>`; follow a turn's events by the
|
|
1415
|
+
* key this returns, not the one sent.
|
|
1416
|
+
*/
|
|
1417
|
+
resolveSessionKey(sessionKey: string): Promise<string>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Fold everything before the last `keepTurns` turns (default 2) into a saved digest, so the next
|
|
1420
|
+
* turn starts from it (decision 15.21). Every message stays stored. `409 session_too_short` when
|
|
1421
|
+
* nothing is older than the kept turns.
|
|
1422
|
+
*/
|
|
1423
|
+
compactSession(sessionKey: string, options?: {
|
|
1424
|
+
readonly keepTurns?: number;
|
|
1425
|
+
}): Promise<CompactedSession>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Start the caller's conversation afresh on every surface, for an agent whose `sessionScope` is
|
|
1428
|
+
* `owner` or `peer` (`docs/23-SPEC-SESSIONS.md`). `409 session_not_rotatable` for `channel-peer`,
|
|
1429
|
+
* where a new conversation is simply a new `sessionKey` on the next message.
|
|
1430
|
+
*/
|
|
1431
|
+
rotateSession(options?: {
|
|
1432
|
+
readonly from?: TurnSender;
|
|
1433
|
+
}): Promise<{
|
|
1434
|
+
readonly sessionKey: string;
|
|
1435
|
+
readonly previous: string;
|
|
1436
|
+
}>;
|
|
1343
1437
|
context(options?: {
|
|
1344
1438
|
readonly sessionKey?: string;
|
|
1345
1439
|
readonly input?: string;
|
|
@@ -1383,14 +1477,105 @@ export interface AgentClient {
|
|
|
1383
1477
|
start(): Promise<AgentLifecycleState>;
|
|
1384
1478
|
/** Record which member this agent works for. An admin participant's act (Phase 27). */
|
|
1385
1479
|
assign(participantId: string): Promise<AssignmentLike>;
|
|
1480
|
+
/** Who the agent works for, or `null` when nobody. */
|
|
1481
|
+
assignment(): Promise<{
|
|
1482
|
+
readonly id: string;
|
|
1483
|
+
readonly assignment: AssignmentLike | null;
|
|
1484
|
+
}>;
|
|
1386
1485
|
unassign(): Promise<{
|
|
1387
1486
|
readonly id: string;
|
|
1388
1487
|
readonly unassigned: boolean;
|
|
1389
1488
|
}>;
|
|
1489
|
+
/** The files the agent's prompt is built from, as the manifest declares them. */
|
|
1490
|
+
workspaceFiles(): Promise<{
|
|
1491
|
+
readonly id: string;
|
|
1492
|
+
readonly files: readonly {
|
|
1493
|
+
readonly name: string;
|
|
1494
|
+
readonly tier: string;
|
|
1495
|
+
readonly field: string;
|
|
1496
|
+
readonly exists: boolean;
|
|
1497
|
+
readonly bytes: number;
|
|
1498
|
+
}[];
|
|
1499
|
+
}>;
|
|
1500
|
+
/** One declared workspace file's text. `exists: false` with empty content for one not yet written. */
|
|
1501
|
+
workspaceFile(name: string): Promise<{
|
|
1502
|
+
readonly id: string;
|
|
1503
|
+
readonly file: string;
|
|
1504
|
+
readonly tier?: string;
|
|
1505
|
+
readonly field?: string;
|
|
1506
|
+
readonly exists: boolean;
|
|
1507
|
+
readonly content: string;
|
|
1508
|
+
}>;
|
|
1509
|
+
/**
|
|
1510
|
+
* Replace one declared workspace file, whole. On a running agent the reload is attempted and a
|
|
1511
|
+
* text that would stop it loading is refused with the old text put back; `applied` says
|
|
1512
|
+
* whether the new text is in force.
|
|
1513
|
+
*/
|
|
1514
|
+
putWorkspaceFile(name: string, content: string): Promise<{
|
|
1515
|
+
readonly id: string;
|
|
1516
|
+
readonly file: string;
|
|
1517
|
+
readonly written: boolean;
|
|
1518
|
+
readonly loads: boolean;
|
|
1519
|
+
readonly error?: WireError;
|
|
1520
|
+
readonly applied: boolean;
|
|
1521
|
+
readonly pending?: WireError;
|
|
1522
|
+
}>;
|
|
1390
1523
|
/** A slice of this agent — its carried memory, archive and knowledge — as a bundle (R11). */
|
|
1391
1524
|
exportBundle(paths?: readonly ("MEMORY.md" | "memory/" | "knowledge/")[]): Promise<AgentBundleLike>;
|
|
1392
1525
|
/** Merge a bundle into this agent. Memory note by note; knowledge kept (`skip`) or `overwrite`n. */
|
|
1393
1526
|
importBundle(bundle: AgentBundleLike, mode?: "skip" | "overwrite"): Promise<ImportReportLike>;
|
|
1527
|
+
/**
|
|
1528
|
+
* Re-render a template-made agent with new values. A file edited since it was rendered is
|
|
1529
|
+
* `skipped` rather than overwritten, and a secret goes to `.env`, never back in the answer.
|
|
1530
|
+
*/
|
|
1531
|
+
setVars(vars: Readonly<Record<string, string>>): Promise<VarsResultLike>;
|
|
1532
|
+
/** The template this agent was made from and its plain vars. `409` for one with no record. */
|
|
1533
|
+
vars(): Promise<{
|
|
1534
|
+
readonly id: string;
|
|
1535
|
+
readonly template: string;
|
|
1536
|
+
readonly vars: Readonly<Record<string, string>>;
|
|
1537
|
+
}>;
|
|
1538
|
+
/**
|
|
1539
|
+
* Send exact text on one of the agent's channels, with no model turn, through the outbox. `key`
|
|
1540
|
+
* makes it idempotent: a repeat answers `duplicate: true` and sends nothing.
|
|
1541
|
+
*/
|
|
1542
|
+
deliver(input: {
|
|
1543
|
+
readonly channel: string;
|
|
1544
|
+
readonly to: string;
|
|
1545
|
+
readonly text: string;
|
|
1546
|
+
readonly key: string;
|
|
1547
|
+
}): Promise<{
|
|
1548
|
+
readonly sessionKey: string;
|
|
1549
|
+
readonly key: string;
|
|
1550
|
+
readonly duplicate: boolean;
|
|
1551
|
+
}>;
|
|
1552
|
+
}
|
|
1553
|
+
/** `model.main`'s capabilities as the runtime resolved them (`02-SPEC-MANIFEST.md`). */
|
|
1554
|
+
export interface ModelCapabilitiesLike {
|
|
1555
|
+
readonly nativeTools: boolean;
|
|
1556
|
+
readonly strictSchema: boolean;
|
|
1557
|
+
readonly thinking: "none" | "anthropic" | "openai" | "deepseek";
|
|
1558
|
+
readonly promptCache: "none" | "anthropic" | "openai" | "bedrock";
|
|
1559
|
+
readonly parallelToolCalls: boolean;
|
|
1560
|
+
readonly contextWindow: number;
|
|
1561
|
+
readonly maxOutput: number;
|
|
1562
|
+
readonly vision?: boolean;
|
|
1563
|
+
readonly promptStyle: {
|
|
1564
|
+
readonly delimiters: string;
|
|
1565
|
+
readonly intensity: string;
|
|
1566
|
+
readonly examplesIn: string;
|
|
1567
|
+
readonly skillsIn: string;
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
/** What `setVars` reports: which files were rendered, which kept, and whether the agent reloaded. */
|
|
1571
|
+
export interface VarsResultLike {
|
|
1572
|
+
readonly id: string;
|
|
1573
|
+
readonly rendered: readonly string[];
|
|
1574
|
+
readonly skipped: readonly {
|
|
1575
|
+
readonly file: string;
|
|
1576
|
+
readonly reason: "edited" | "memory" | "removed";
|
|
1577
|
+
}[];
|
|
1578
|
+
readonly reload: "none" | "loaded" | "pending";
|
|
1394
1579
|
}
|
|
1395
1580
|
/** What `stop` and `start` report back. */
|
|
1396
1581
|
export interface AgentLifecycleState {
|
|
@@ -1436,6 +1621,8 @@ export interface AgentDescriptionLike {
|
|
|
1436
1621
|
readonly model?: string;
|
|
1437
1622
|
readonly dialect?: string;
|
|
1438
1623
|
readonly window?: number;
|
|
1624
|
+
/** The main model's resolved capabilities: the registry's row with the manifest's overrides. */
|
|
1625
|
+
readonly capabilities?: ModelCapabilitiesLike;
|
|
1439
1626
|
readonly tools?: number;
|
|
1440
1627
|
/** What the catalogue costs per turn. A tool *count* says nothing about the bill. */
|
|
1441
1628
|
readonly catalogueTokens?: number;
|
|
@@ -1443,6 +1630,8 @@ export interface AgentDescriptionLike {
|
|
|
1443
1630
|
readonly schedules?: number;
|
|
1444
1631
|
readonly entryPhase?: string | null;
|
|
1445
1632
|
readonly phases?: readonly string[];
|
|
1633
|
+
/** How a turn's conversation is chosen: `owner`, `peer` or `channel-peer` (since 0.2.2). */
|
|
1634
|
+
readonly sessionScope?: "owner" | "peer" | "channel-peer";
|
|
1446
1635
|
/**
|
|
1447
1636
|
* Each channel's last reported state. `unknown[]` until 16.6, which is why the web UI cast.
|
|
1448
1637
|
*
|
|
@@ -1464,6 +1653,30 @@ export interface AgentDescriptionLike {
|
|
|
1464
1653
|
};
|
|
1465
1654
|
}[];
|
|
1466
1655
|
readonly warnings?: readonly WireError[];
|
|
1656
|
+
/**
|
|
1657
|
+
* Who this agent delegates to, on `GET /v1/agents/:id` only. Members are observable here and
|
|
1658
|
+
* addressable nowhere. Absent for an agent with no team.
|
|
1659
|
+
*/
|
|
1660
|
+
readonly team?: readonly {
|
|
1661
|
+
readonly id: string;
|
|
1662
|
+
readonly task: string;
|
|
1663
|
+
/** The field names the member hands back. */
|
|
1664
|
+
readonly artifact: readonly string[];
|
|
1665
|
+
}[];
|
|
1666
|
+
/** What the agent is for, in one line (`description` in its manifest). */
|
|
1667
|
+
readonly description?: string;
|
|
1668
|
+
/** Whether it takes part in `ask_agent` (`delegation.ask`). */
|
|
1669
|
+
readonly ask?: boolean;
|
|
1670
|
+
/** Its assignee's participant id, or `null` for a shared agent. On the listing only. */
|
|
1671
|
+
readonly assignee?: string | null;
|
|
1672
|
+
/** Whom `ask_agent` can ask, on `GET /v1/agents/:id` only. Absent when nobody. */
|
|
1673
|
+
readonly peers?: readonly {
|
|
1674
|
+
readonly id: string;
|
|
1675
|
+
readonly name?: string;
|
|
1676
|
+
readonly description?: string;
|
|
1677
|
+
readonly shared: boolean;
|
|
1678
|
+
readonly remote: boolean;
|
|
1679
|
+
}[];
|
|
1467
1680
|
/** Set on a `disabled` row: when it was switched off, and why if anybody said. */
|
|
1468
1681
|
readonly disabledAt?: string;
|
|
1469
1682
|
readonly reason?: string;
|
|
@@ -1609,6 +1822,12 @@ export interface StoredMessageLike {
|
|
|
1609
1822
|
readonly turnId?: string;
|
|
1610
1823
|
readonly origin?: string;
|
|
1611
1824
|
readonly createdAt?: string;
|
|
1825
|
+
/** Under the `native` dialect only: the calls an assistant message made. Its `content` is then often empty. */
|
|
1826
|
+
readonly toolCalls?: readonly {
|
|
1827
|
+
readonly id: string;
|
|
1828
|
+
readonly name: string;
|
|
1829
|
+
readonly arguments: string;
|
|
1830
|
+
}[];
|
|
1612
1831
|
}
|
|
1613
1832
|
export interface MessagePageLike {
|
|
1614
1833
|
readonly messages: readonly StoredMessageLike[];
|
|
@@ -1623,6 +1842,27 @@ export interface MessagePageLike {
|
|
|
1623
1842
|
* conversation is, and the field is *there*, so the only way to find out is to read the server. The
|
|
1624
1843
|
* same shape as `channels` being `readonly unknown[]` until 16.6.
|
|
1625
1844
|
*/
|
|
1845
|
+
/** `POST …/tools/refresh`. */
|
|
1846
|
+
export interface ToolsRefreshResult {
|
|
1847
|
+
readonly id: string;
|
|
1848
|
+
readonly providers: readonly {
|
|
1849
|
+
readonly provider: string;
|
|
1850
|
+
readonly ok: boolean;
|
|
1851
|
+
readonly fetched: number;
|
|
1852
|
+
readonly error?: string;
|
|
1853
|
+
}[];
|
|
1854
|
+
readonly added: readonly string[];
|
|
1855
|
+
readonly removed: readonly string[];
|
|
1856
|
+
readonly changed: readonly string[];
|
|
1857
|
+
readonly reload?: string;
|
|
1858
|
+
}
|
|
1859
|
+
/** `GET …/schedules/preview`. */
|
|
1860
|
+
export interface SchedulePreview {
|
|
1861
|
+
readonly kind: "cron" | "every" | "at";
|
|
1862
|
+
readonly zone: string;
|
|
1863
|
+
readonly next: readonly string[];
|
|
1864
|
+
readonly jitterMs: number;
|
|
1865
|
+
}
|
|
1626
1866
|
export interface SessionSummary {
|
|
1627
1867
|
readonly sessionKey: string;
|
|
1628
1868
|
readonly channel: string;
|
|
@@ -1635,6 +1875,24 @@ export interface SessionSummary {
|
|
|
1635
1875
|
readonly thread?: string;
|
|
1636
1876
|
/** Phase-scoped tool visibility, persisted per session. Absent on an unphased agent. */
|
|
1637
1877
|
readonly phase?: string;
|
|
1878
|
+
/** `false` on a conversation kept out of history recall; absent means it is recalled. */
|
|
1879
|
+
readonly recall?: false;
|
|
1880
|
+
/**
|
|
1881
|
+
* Whether this is the conversation its person's base key currently means: false for one a
|
|
1882
|
+
* rotation left behind. True for every key under `channel-peer`. Absent from a server before 0.3.
|
|
1883
|
+
*/
|
|
1884
|
+
readonly head?: boolean;
|
|
1885
|
+
/** When the session's checkpoint was last written (`compactSession`). Absent: never compacted. */
|
|
1886
|
+
readonly compactedAt?: string;
|
|
1887
|
+
}
|
|
1888
|
+
/** What `compactSession` did. `before` and `after` are estimated tokens a turn starts from. */
|
|
1889
|
+
export interface CompactedSession {
|
|
1890
|
+
readonly sessionKey: string;
|
|
1891
|
+
readonly before: number;
|
|
1892
|
+
readonly after: number;
|
|
1893
|
+
/** `model` when a declared `model.compactor` wrote the digest; `mechanical` otherwise. */
|
|
1894
|
+
readonly digest: "model" | "mechanical";
|
|
1895
|
+
readonly keptTurns: number;
|
|
1638
1896
|
}
|
|
1639
1897
|
export interface MessagesOptions {
|
|
1640
1898
|
/** The cursor from a previous page's `nextBefore`. Absent starts at the newest. */
|
|
@@ -1776,10 +2034,15 @@ export interface ParticipantLike {
|
|
|
1776
2034
|
readonly kind: "human";
|
|
1777
2035
|
readonly name?: string;
|
|
1778
2036
|
readonly role: "admin" | "member";
|
|
2037
|
+
/** A job title, as the team knows the person. Not a permission. */
|
|
2038
|
+
readonly title?: string;
|
|
2039
|
+
/** An IANA zone, `Europe/London`: what "tomorrow at nine" means for this person. */
|
|
2040
|
+
readonly timezone?: string;
|
|
1779
2041
|
readonly createdAt: string;
|
|
1780
2042
|
/** Pushed by the embedder; absent reads as online. */
|
|
1781
2043
|
readonly presence?: "online" | "offline";
|
|
1782
2044
|
readonly presenceAt?: string;
|
|
2045
|
+
readonly channelIds?: readonly string[];
|
|
1783
2046
|
}
|
|
1784
2047
|
/** A slice of one agent: the carried memory file, the memory archive and knowledge (R11). */
|
|
1785
2048
|
export interface AgentBundleLike {
|
|
@@ -1921,7 +2184,7 @@ export interface KeyScopeLike {
|
|
|
1921
2184
|
readonly agents?: readonly string[];
|
|
1922
2185
|
/** A session-key prefix; a trailing `*` is accepted and ignored. */
|
|
1923
2186
|
readonly sessions?: string;
|
|
1924
|
-
readonly can?: readonly ("read" | "chat" | "write" | "admin")[];
|
|
2187
|
+
readonly can?: readonly ("read" | "chat" | "write" | "admin" | "peer")[];
|
|
1925
2188
|
/** The one participant this key speaks for: every turn it starts acts for them. */
|
|
1926
2189
|
readonly participant?: string;
|
|
1927
2190
|
}
|
|
@@ -1978,6 +2241,10 @@ export interface DispachClient {
|
|
|
1978
2241
|
readonly id: string;
|
|
1979
2242
|
readonly name?: string;
|
|
1980
2243
|
readonly role?: "admin" | "member";
|
|
2244
|
+
readonly title?: string;
|
|
2245
|
+
readonly timezone?: string;
|
|
2246
|
+
/** `<channel type>:<id or handle>`: what `peer` session scope recognises them by. */
|
|
2247
|
+
readonly channelIds?: readonly string[];
|
|
1981
2248
|
}): Promise<ParticipantLike>;
|
|
1982
2249
|
/** The rooms and DMs this credential can see. */
|
|
1983
2250
|
conversations(): Promise<readonly ConversationLike[]>;
|
|
@@ -2096,6 +2363,23 @@ export interface DispachClient {
|
|
|
2096
2363
|
}>;
|
|
2097
2364
|
/** Permanent. A revoked secret can never be re-presented. */
|
|
2098
2365
|
revokeKey(keyId: string): Promise<OperatorKeyLike>;
|
|
2366
|
+
/**
|
|
2367
|
+
* Delete an agent for good: its directory, its conversations and its memory. `confirm` must be
|
|
2368
|
+
* the id again, the HTTP form of typing the name back.
|
|
2369
|
+
*/
|
|
2370
|
+
deleteAgent(agentId: string, confirm: string): Promise<{
|
|
2371
|
+
readonly id: string;
|
|
2372
|
+
readonly removed: boolean;
|
|
2373
|
+
} & Readonly<Record<string, unknown>>>;
|
|
2374
|
+
/**
|
|
2375
|
+
* The whole server as a tar.gz: `backup.json`, a consistent `store.db` snapshot and every hosted
|
|
2376
|
+
* agent's directory. `include` adds `.env`, `.git` or the rest of the state directory.
|
|
2377
|
+
*/
|
|
2378
|
+
backup(include?: readonly ("env" | "git" | "home")[]): Promise<Blob>;
|
|
2379
|
+
deleteParticipant(participantId: string): Promise<{
|
|
2380
|
+
readonly id: string;
|
|
2381
|
+
readonly deleted: boolean;
|
|
2382
|
+
}>;
|
|
2099
2383
|
}
|
|
2100
2384
|
/** Narrow an event by type, so a `switch` over a stream keeps its `data` typed. */
|
|
2101
2385
|
export declare function isEvent<K extends EventType>(event: AnyEvent, type: K): event is AnyEvent & {
|
package/dist/client.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var z="dispach",V="Dispach",J=1;function
|
|
2
|
-
`),...
|
|
3
|
-
`)),e.block.wrapped.add(e.heredocKey),e.heredocKey=void 0,e.heredocLines=[]}function w(e){if(q(e),e.block!==void 0)e.blocks.push(e.block);e.block=void 0,e.openKey=void 0,e.awaitingSlug=!1}function G(){return{block:void 0,openKey:void 0,severedKey:void 0,severedPending:void 0,heredocKey:void 0,heredocLines:[],justClosed:!1,awaitingSlug:!1,text:[],blocks:[]}}function de(e,
|
|
4
|
-
${
|
|
5
|
-
`)},g=(s)=>{if(
|
|
6
|
-
`);while(
|
|
7
|
-
`)}let u=
|
|
1
|
+
var z="dispach",V="Dispach",J=1;function _(e,t){return{slug:e,name:t,envPrefix:`${e.toUpperCase()}_`,stateDir:`.${e}`,apiVersion:`${e}/v${J}`,packageScope:`@${e}`}}var k=_(z,V),S=`${k.envPrefix}BRAND`,Y=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;function Z(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function X(e){if(e===void 0)return k;let t=e.trim();if(t==="")throw Error(`${S} is set but empty. hint: unset ${S} entirely to use the default brand — an empty value `+'is treated as a mistake rather than as "no override", because a declared-but-unset variable is usually a container passing through a name it never assigned.');if(!Y.test(t))throw Error(`${S}="${t}" is not a usable brand slug. hint: the slug becomes an env var prefix, a dot-directory, an npm scope, and the `+"manifest apiVersion, so it must be lowercase alphanumeric with inner hyphens — "+"e.g. acme or acme-run.");if(t===k.slug)return k;return _(t,Z(t))}var we=X(process.env[S]);var ve="What I already know, carried from before this conversation and kept current. "+"Not a transcript — these are standing facts about the person I work for and my own working notes. "+"If they ask what I know or remember about them, this is the answer.";var y=(e)=>String.fromCharCode(e),v=y(27),D=y(7),Te=new RegExp(`${v}\\[[0-?]*[ -/]*[@-~]`,"g"),$e=new RegExp(`${v}\\][\\s\\S]*?(?:${D}|${v}\\\\|$)`,"g"),ke=new RegExp(`${v}[P^_X][\\s\\S]*?(?:${v}\\\\|${D}|$)`,"g"),Ee=new RegExp(`${v}[@-Z\\\\-_0-9=><]?`,"g"),Se=new RegExp(`[${y(128)}-${y(159)}]`,"g"),Ce=new RegExp(`[${y(0)}-${y(8)}${y(11)}${y(12)}${y(14)}-${y(31)}${y(127)}]`,"g");var O=["runtime.ready","store.ready","runtime.stopping","agent.loaded","agent.disposed","agent.reloaded","agent.warning","plugin.loaded","plugin.slow","approval.requested","approval.resolved","handoff.start","handoff.result","peer.ask","peer.answer","turn.start","context.assembled","context.dropped","context.pressure","compaction.stage","context.reset","session.compacted","phase.changed","model.call","model.chunk","model.retry","model.fallback","model.result","media.result","tool.usage","tool.call","tool.result","tool.gated","tool.repair","tools.refreshed","agent.tools.refreshed","agent.channel.status","agent.channel.error","agent.channel.rejected","delivery.sent","delivery.retry","delivery.failed","delivery.uncertain","runtime.released","schedules.reconciled","schedule.fired","schedule.skipped","schedule.deferred","schedule.error","conversation.message","conversation.skipped","action.deferred","action.decided","agent.assigned","memory.read","memory.recalled","memory.forgotten","turn.end","error"],Q=/\r\n\r\n|\n\n|\r\r/;function P(e){let t=[],d,a,c;for(let l of e.split(/\r\n|\n|\r/)){if(l===""||l.startsWith(":"))continue;let r=l.indexOf(":"),f=r===-1?l:l.slice(0,r),p=r===-1?"":l.slice(r+1);if(p.startsWith(" "))p=p.slice(1);switch(f){case"data":t.push(p);break;case"event":d=p;break;case"id":a=p;break;case"retry":{let g=Number.parseInt(p,10);if(Number.isFinite(g))c=g;break}default:break}}if(t.length===0&&d===void 0)return;return{...d===void 0?{}:{event:d},data:t.join(`
|
|
2
|
+
`),...a===void 0?{}:{id:a},...c===void 0?{}:{retry:c}}}async function*N(e){let t=new TextDecoder,d="";for await(let a of e){d+=typeof a==="string"?a:t.decode(a,{stream:!0});while(!0){let c=Q.exec(d);if(c===null)break;let l=d.slice(0,c.index);d=d.slice(c.index+c[0].length);let r=P(l);if(r!==void 0)yield r}}if(d+=t.decode(),d.trim()!==""){let a=P(d);if(a!==void 0)yield a}}function ee(){return{push:(e)=>e,endStep:()=>"",end:()=>""}}function ne(e){return e!=="final"&&e!=="stopped"}function te(e,t={}){switch(e){case"final":return;case"max_steps":return`stopped${t.steps===void 0?"":` after ${t.steps} steps`} without finishing — say "continue" to carry on, or raise limits.maxSteps`;case"no_progress":return'stopped: the same tool call was repeated with no change — say "continue" with more to go on, or check whether that tool is telling it anything useful';case"truncated":return"the reply was cut off at the output limit — raise model.<role>.maxTokens, or ask for less";case"timeout":return`timed out${t.durationMs===void 0?"":` after ${t.durationMs} ms`} — raise limits.turnTimeoutMs`;case"stopped":return t.cancelledAfterMs===void 0?"cancelled":`cancelled after ${t.cancelledAfterMs.toFixed(0)} ms`;case"error":return}}var re="submit_artifact";var M="<<<",K=">>>",E=/^\s*(?:(?:[-*+]|\d+[.)])\s+)?(?:<\s*)?action\s*:(.+)$/i,se=/^\s*(?:[-*+]\s+|\d+[.)]\s+)?([A-Za-z_][\w.-]*?)\s*:(.*)$/,A=/^\s*`{3,}\s*(?:[\w+-]+\s*)?$/,C=/^\s*end\s*$/i,oe=/^\s*<\s*action\s*>\s*$/i,L=/^\s*<\s*\/\s*action\s*>\s*$/i,ie=/^\s*<\/?\s*[A-Za-z_][\w.:-]*\s*(?:\/\s*)?>\s*$/;function j(e){let t=(e??"").trim();return t.endsWith(">")?t.slice(0,-1).trimEnd():t}function R(e){return x(x(ae(e,"`'\"*<"),"`'\"*>"),".,;:").trim()}function ae(e,t){let d=0;while(d<e.length&&t.includes(e[d]??""))d+=1;return e.slice(d)}function x(e,t){let d=e.length;while(d>0&&t.includes(e[d-1]??""))d-=1;return e.slice(0,d)}function F(e,t,d){let a=e.fields.get(t);if(a===void 0)e.fields.set(t,[d]);else a.push(d)}function q(e){if(e.block===void 0||e.heredocKey===void 0)return;let t=[...e.heredocLines];if(t[t.length-1]==="")t.pop();F(e.block,e.heredocKey,t.join(`
|
|
3
|
+
`)),e.block.wrapped.add(e.heredocKey),e.heredocKey=void 0,e.heredocLines=[]}function w(e){if(q(e),e.block!==void 0)e.blocks.push(e.block);e.block=void 0,e.openKey=void 0,e.awaitingSlug=!1}function G(){return{block:void 0,openKey:void 0,severedKey:void 0,severedPending:void 0,heredocKey:void 0,heredocLines:[],justClosed:!1,awaitingSlug:!1,text:[],blocks:[]}}function de(e,t,d){let a=t.trim();if(e.heredocKey!==void 0){if(a===K){q(e);return}if(C.test(a)){w(e),e.justClosed=!0;return}if(E.test(t)){w(e);let r=E.exec(t),f=R(j(r?.[1]));if(f!=="")e.block={slug:f,fields:new Map,wrapped:new Set,severed:new Set};return}e.heredocLines.push(t);return}let c=E.exec(t);if(c!==null){let r=R(j(c[1]));if(w(e),r==="")return;e.block={slug:r,fields:new Map,wrapped:new Set,severed:new Set};return}if(oe.test(t)){w(e),e.awaitingSlug=!0;return}if(e.awaitingSlug){if(a==="")return;if(L.test(t)){e.awaitingSlug=!1;return}let r=R(a);if(e.awaitingSlug=!1,r!=="")e.block={slug:r,fields:new Map,wrapped:new Set,severed:new Set};return}if(L.test(t)){if(e.block!==void 0)w(e),e.justClosed=!0;return}if(ie.test(t))return;if(e.block===void 0){if(A.test(t)&&(e.justClosed||d())){e.justClosed=!1;return}if(C.test(a)&&e.severedPending!==void 0){e.severedPending.block.severed.add(e.severedPending.key),e.severedPending=void 0;return}if(E.test(t))e.severedPending=void 0;if(e.text.push(t),a!=="")e.justClosed=!1;return}if(a===""){if(e.openKey!==void 0)e.severedKey=e.openKey;e.openKey=void 0;return}if(C.test(a)){e.severedKey=void 0,w(e),e.justClosed=!0;return}if(A.test(t))return;let l=se.exec(t);if(l!==null){let r=(l[1]??"").trim(),f=(l[2]??"").trim();if(e.severedKey=void 0,f===M)e.heredocKey=r,e.heredocLines=[],e.openKey=void 0;else F(e.block,r,f),e.openKey=r;return}if(e.openKey!==void 0){let r=e.block.fields.get(e.openKey),f=r?.[r.length-1];if(r!==void 0&&f!==void 0)r[r.length-1]=f===""?a:`${f}
|
|
4
|
+
${a}`;return}if(e.severedKey!==void 0)e.severedPending={block:e.block,key:e.severedKey},e.severedKey=void 0;w(e),e.text.push(t)}function ue(e){if(/^\s*(?:(?:[-*+]|\d+[.)]?)\s*)?$/.test(e))return!0;let t=e.replace(/^\s*(?:[-*+]\s+|\d+[.)]\s+)?/,"").toLowerCase(),d=t.startsWith("<")?t.slice(1):t;if("action:".startsWith(d)||d.startsWith("action:"))return!0;if(/^<\/?$/.test(t)||/^<\/?[a-z_][\w.:-]*>?$/.test(t))return!0;return/^`{1,3}[\w+-]*$/.test(t)}function I(e){return e.endsWith("\r")?e.slice(0,-1):e}function le(){let e=G(),t="",d=0,a,c="",l=!1,r=(s)=>{if(s==="")return"";if(s.trim()==="")return c+=s,"";let n=c+s;if(c="",l)return n;return l=!0,n.replace(/^\s+/,"")},f=(s,n)=>{let i=e.text.length;return de(e,s,()=>n!==void 0&&E.test(n)),e.text.length>i?s:void 0},p=(s,n,i)=>{let u=f(s,n);if(u===void 0)return"";return r(u.slice(i))+r(`
|
|
5
|
+
`)},g=(s)=>{if(a===void 0)return"";let n=a;return a=void 0,p(n,s,0)};return{push(s){let n="";t+=s;let i=t.indexOf(`
|
|
6
|
+
`);while(i!==-1){let m=I(t.slice(0,i));if(t=t.slice(i+1),n+=g(m),e.block===void 0&&A.test(m)&&!e.justClosed)a=m;else n+=p(m,void 0,d);d=0,i=t.indexOf(`
|
|
7
|
+
`)}let u=I(t);if(e.block===void 0&&!e.awaitingSlug&&a===void 0&&!ue(u))n+=r(u.slice(d)),d=u.length;return n},endStep(){let s=o();return c=`
|
|
8
8
|
|
|
9
|
-
`,e=G(),s},end:o};function o(){let s=g(void 0),
|
|
9
|
+
`,e=G(),s},end:o};function o(){let s=g(void 0),n=I(t);if(n!==""){let i=f(n,void 0);if(i!==void 0)s+=r(i.slice(d))}return t="",d=0,a=void 0,s}}var Re=`# Tools
|
|
10
10
|
|
|
11
11
|
To use a tool, write an ACTION block. Start each line at the left margin, exactly like this:
|
|
12
12
|
|
|
@@ -27,8 +27,8 @@ Rules for a block:
|
|
|
27
27
|
|
|
28
28
|
Anything you write outside a block is shown to the person you are talking to, so keep explanations
|
|
29
29
|
short and keep them out of the block. When no tool fits, simply reply — never invent a tool, and
|
|
30
|
-
never guess a value for a required field you have not been given.`;function ce(e){return e.startsWith("subagent:")||e.startsWith("handoff:")}class b extends Error{code;hint;field;status;request;constructor(e,
|
|
31
|
-
hint: ${e.hint}`);if(this.name="DispachError",this.code=e.code,this.hint=e.hint??"",this.field=e.field,this.status=n.status,this.request=n.method===void 0||n.path===void 0?void 0:{method:n.method,path:n.path},n.cause!==void 0)this.cause=n.cause}}function fe(e,n){let d=e instanceof Error?e.message:String(e);return new b({code:"transport_failed",message:`${n.method} ${n.path} did not reach ${n.baseUrl}: ${d}`,hint:"Check the base URL, that the server is running, and that nothing between you and it is refusing the connection. `GET /v1/health` needs no token and is the cheapest probe."},{...n,cause:e})}async function he(e,n){let d;try{let i=await e.json();if(typeof i.error?.code==="string"&&typeof i.error.message==="string")d={code:i.error.code,message:i.error.message,...i.error.hint===void 0?{}:{hint:i.error.hint},...i.error.field===void 0?{}:{field:i.error.field}}}catch{}return new b(d??{code:`http_${e.status}`,message:`${n.method} ${n.path} returned ${e.status} with no error body.`,hint:"This is not a response this server produces, so something between you and it answered — a proxy, a gateway, or a load balancer. Check the URL and what is in front of it."},{status:e.status,...n})}var W=new Set(N);async function*H(e){for await(let n of O(pe(e))){if(n.event===void 0||n.data==="")continue;let d;try{d=JSON.parse(n.data)}catch{continue}yield{name:n.event,data:d}}}async function*pe(e){let n=e.getReader();try{while(!0){let{done:d,value:i}=await n.read();if(d)return;if(i!==void 0)yield i}}finally{n.releaseLock()}}async function*me(e){for await(let{name:n,data:d}of H(e)){if(W.has(n)){yield{kind:"event",event:d};continue}let i=d??{};switch(n){case"turn.accepted":yield{kind:"accepted",turnId:String(i.turnId??""),sessionKey:String(i.sessionKey??"")};break;case"stream.replay":yield{kind:"replay",report:{state:i.state==="ended"?"ended":"running",events:Number(i.events??0),truncated:i.truncated===!0,dropped:Number(i.dropped??0),chunks:i.chunks==="start"||i.chunks==="partial"?i.chunks:"none"}};break;case"stream.ended":yield{kind:"ended",turnId:String(i.turnId??""),status:String(i.status??"unknown"),steps:typeof i.steps==="number"?i.steps:void 0,errorCode:typeof i.errorCode==="string"?i.errorCode:void 0};break;case"stream.unavailable":yield{kind:"unavailable",turnId:String(i.turnId??""),reason:String(i.reason??"not observable from this process")};break;default:break}}}async function*ye(e){for await(let{name:n,data:d}of H(e)){if(W.has(n)){yield{kind:"event",event:d};continue}if(n==="stream.subscribed"){let i=d??{};yield{kind:"subscribed",report:{agentId:typeof i.agentId==="string"?i.agentId:null,types:Array.isArray(i.types)?i.types:null,chunks:i.chunks===!0,implied:typeof i.implied==="string"?i.implied:void 0}}}}}async function*ge(e,n={}){for await(let d of e){if(d.kind==="replay"&&d.report.truncated&&n.allowTruncated!==!0)throw new b({code:"replay_truncated",message:`This turn's replay is missing its oldest ${d.report.dropped} event(s), so the text reconstructed from it would be incomplete.`,hint:"Read the finished text from GET /v1/agents/:id/turns/:turnId, or pass { allowTruncated: true } to accept a fragment. Streaming from the start of a turn is never truncated — this only happens when reattaching to one that has already produced more events than the buffer holds."});if(d.kind==="unavailable")throw new b({code:"turn_not_observable",message:`Turn ${d.turnId} is recorded as running but is not observable here: ${d.reason}.`,hint:"Its events are buffered in whichever process is executing it. Poll GET /v1/agents/:id/turns/:turnId for the outcome."});if(d.kind!=="event")continue;if(d.event.type!=="model.chunk")continue;let i=d.event.data;if(i.kind==="reasoning")continue;if(typeof i.delta==="string")yield i.delta}}function Ue(e,n){return e.type===n}function Pe(e){let n=e.baseUrl.length;while(n>0&&e.baseUrl[n-1]==="/")n-=1;let d=e.baseUrl.slice(0,n),i=e.fetch??fetch,c=(o={})=>({...e.token===void 0?{}:{authorization:`Bearer ${e.token}`},...o});async function l(o,s,t={}){let a;try{a=await i(`${d}${s}`,{method:o,headers:c({...t.body===void 0?{}:{"content-type":"application/json"},...t.accept===void 0?{}:{accept:t.accept},...t.headers}),...t.body===void 0?{}:{body:JSON.stringify(t.body)},...t.signal===void 0?{}:{signal:t.signal}})}catch(u){throw fe(u,{method:o,path:s,baseUrl:d})}if(!a.ok)throw await he(a,{method:o,path:s});return a}async function r(o,s,t){return await(await l(o,s,t??{})).json()}async function f(o,s){let t=await l("GET",o,{accept:"text/event-stream",...s===void 0?{}:{signal:s}});if(t.body===null)throw new b({code:"no_response_body",message:`GET ${o} returned ${t.status} with no body to read.`,hint:"An SSE route always has a body. A missing one means something between you and the server buffered the response — commonly a proxy without streaming enabled."},{status:t.status,method:"GET",path:o});return t.body}function p(o,s,t,a={}){let u=(h)=>{let T=new URLSearchParams;if(h?.chunks===!0)T.set("chunks","true");if(h?.children===!0)T.set("children","true");let _=T.toString();return _===""?"":`?${_}`},m={turnId:s,sessionKey:t,replayed:a.replayed===!0,async*stream(h){let T=await f(`/v1/agents/${encodeURIComponent(o)}/turns/${encodeURIComponent(s)}/stream${u(h)}`,h?.signal);yield*me(T)},async*tokens(h){yield*ge(m.stream({chunks:!0,...h,children:!1}),{...h?.allowTruncated===void 0?{}:{allowTruncated:h.allowTruncated}})},async text(){for await(let h of m.stream()){if(h.kind==="ended")break;if(h.kind==="unavailable")break;if(h.kind==="event"&&h.event.type==="turn.end")break}return(await m.get()).text},get:()=>r("GET",`/v1/agents/${encodeURIComponent(o)}/turns/${encodeURIComponent(s)}`),async stop(){await l("POST",`/v1/agents/${encodeURIComponent(o)}/turns/${encodeURIComponent(s)}/stop`)}};return m}function g(o){let s=(t)=>`/v1/agents/${encodeURIComponent(o)}${t}`;return{id:o,async send(t,a){let u=await r("POST",s("/messages"),{body:{text:t,...a?.sessionKey===void 0?{}:{sessionKey:a.sessionKey},...a?.deliver===void 0?{}:{deliver:a.deliver},...a?.from===void 0?{}:{from:a.from},...a?.images===void 0?{}:{images:a.images},...a?.runtimeNote===void 0?{}:{runtimeNote:a.runtimeNote},...a?.chunks===!0?{chunks:!0}:{},...a?.role===void 0?{}:{role:a.role}},...a?.idempotencyKey===void 0?{}:{headers:{"idempotency-key":a.idempotencyKey}},...a?.signal===void 0?{}:{signal:a.signal}});return p(o,u.turnId,u.sessionKey,{replayed:u.replayed===!0})},turn:(t)=>p(o,t,""),describe:()=>r("GET",s("")),tools:()=>r("GET",s("/tools")),skills:()=>r("GET",s("/skills")),sessions:()=>r("GET",s("/sessions")),messages:(t,a)=>{let u=new URLSearchParams;if(a?.before!==void 0)u.set("before",String(a.before));if(a?.limit!==void 0)u.set("limit",String(a.limit));let m=u.size===0?"":`?${u.toString()}`;return r("GET",s(`/sessions/${encodeURIComponent(t)}/messages${m}`))},clearSession:(t)=>r("DELETE",s(`/sessions/${encodeURIComponent(t)}`)),reload:()=>r("POST",s("/reload"),{body:{}}),usage:(t)=>r("GET",s(`/usage${B(t)}`)),turns:(t)=>{let a=new URLSearchParams;if(t?.limit!==void 0)a.set("limit",String(t.limit));if(t?.before!==void 0)a.set("before",String(t.before));let u=a.size===0?"":`?${a.toString()}`;return r("GET",s(`/turns${u}`))},secrets:async()=>(await r("GET",s("/secrets"))).secrets,setSecrets:(t)=>r("PUT",s("/secrets"),{body:{values:t}}),schedules:async()=>(await r("GET",s("/schedules"))).schedules,approvals:async()=>(await r("GET",s("/approvals"))).approvals,createSchedule:(t)=>r("POST",s("/schedules"),{body:t}),updateSchedule:(t,a)=>r("PATCH",s(`/schedules/${encodeURIComponent(t)}`),{body:a}),deleteSchedule:async(t)=>{await r("DELETE",s(`/schedules/${encodeURIComponent(t)}`))},runSchedule:(t)=>r("POST",s(`/schedules/${encodeURIComponent(t)}/run`),{body:{}}),config:()=>r("GET",s("/config")),setConfig:(t,a,u)=>r("PATCH",s("/config"),{body:{path:t,value:a,...u?.confirm===void 0?{}:{confirm:u.confirm}}}),removeConfig:(t,a)=>r("PATCH",s("/config"),{body:{path:t,remove:!0,...a?.confirm===void 0?{}:{confirm:a.confirm}}}),setConfigs:(t)=>r("PATCH",s("/config"),{body:{changes:t.map((a)=>({...a}))}}),setChannel:(t,a)=>r("PATCH",s(`/channels/${encodeURIComponent(t)}`),{body:{...a}}),unpairChannel:(t)=>r("POST",s(`/channels/${encodeURIComponent(t)}/unpair`)),session:(t)=>r("GET",s(`/sessions/${encodeURIComponent(t)}`)),setPhase:(t,a)=>r("POST",s(`/sessions/${encodeURIComponent(t)}/phase`),{body:{phase:a}}),setRecall:(t,a)=>r("POST",s(`/sessions/${encodeURIComponent(t)}/recall`),{body:{recall:a}}),approve:async(t,a)=>{await r("POST",s(`/approvals/${encodeURIComponent(t)}`),{body:{granted:a}})},stop:(t)=>r("POST",s("/stop"),{body:t===void 0?{}:{reason:t}}),start:()=>r("POST",s("/start"),{body:{}}),assign:(t)=>r("PUT",s("/assignee"),{body:{participantId:t}}),unassign:()=>r("DELETE",s("/assignee")),exportBundle:(t)=>r("GET",s(`/export${t===void 0?"":`?paths=${encodeURIComponent(t.join(","))}`}`)),importBundle:(t,a)=>r("POST",s("/import"),{body:{bundle:t,...a===void 0?{}:{mode:a}}}),context:(t)=>{let a=new URLSearchParams;if(t?.sessionKey!==void 0)a.set("sessionKey",t.sessionKey);if(t?.input!==void 0)a.set("input",t.input);let u=a.size===0?"":`?${a.toString()}`;return r("GET",s(`/context${u}`))}}}return{agent:g,agents:()=>r("GET","/v1/agents"),health:()=>r("GET","/v1/health"),async ready(){try{return await l("GET","/v1/ready"),!0}catch(o){if(o instanceof b&&o.status===503)return!1;throw o}},provision:()=>r("GET","/v1/provision"),keys:()=>r("GET","/v1/keys"),createKey:(o)=>r("POST","/v1/keys",{body:o}),revokeKey:(o)=>r("DELETE",`/v1/keys/${encodeURIComponent(o)}`),createAgent:(o)=>r("POST","/v1/agents",{body:{answers:o}}),usage:(o)=>r("GET",`/v1/usage${B(o)}`),activity:()=>r("GET","/v1/activity"),participants:async()=>(await r("GET","/v1/participants")).participants,registerParticipant:(o)=>r("POST","/v1/participants",{body:o}),conversations:async()=>(await r("GET","/v1/conversations")).conversations,createConversation:(o)=>r("POST","/v1/conversations",{body:o}),conversation:(o)=>r("GET",`/v1/conversations/${encodeURIComponent(o)}`),setMembers:(o,s)=>r("PATCH",`/v1/conversations/${encodeURIComponent(o)}/members`,{body:s}),postMessage:(o,s)=>r("POST",`/v1/conversations/${encodeURIComponent(o)}/messages`,{body:s}),conversationMessages:(o,s={})=>{let t=new URLSearchParams;if(s.after!==void 0)t.set("after",String(s.after));if(s.limit!==void 0)t.set("limit",String(s.limit));let a=t.size===0?"":`?${t}`;return r("GET",`/v1/conversations/${encodeURIComponent(o)}/messages${a}`)},setPresence:(o,s)=>r("PUT",`/v1/participants/${encodeURIComponent(o)}/presence`,{body:{presence:s}}),actions:async(o={})=>(await r("GET",`/v1/actions${o.status===void 0?"":`?status=${o.status}`}`)).actions,decideAction:(o,s)=>r("POST",`/v1/actions/${encodeURIComponent(o)}`,{body:{approve:s}}),addNote:(o)=>r("POST","/v1/memory/notes",{body:o}),notes:async(o)=>(await r("GET",`/v1/memory/notes?scope=${encodeURIComponent(o)}`)).notes,deleteNote:(o)=>r("DELETE",`/v1/memory/notes/${encodeURIComponent(o)}`),memoryReads:async(o)=>(await r("GET",`/v1/participants/${encodeURIComponent(o)}/memory/reads`)).reads,projects:async()=>(await r("GET","/v1/projects")).projects,putProject:(o,s)=>r("PUT",`/v1/projects/${encodeURIComponent(o)}`,{body:s}),deleteProject:(o)=>r("DELETE",`/v1/projects/${encodeURIComponent(o)}`),setSpaceWriter:(o)=>r("PUT","/v1/memory/space/writer",{body:{writer:o}}),webhooks:async()=>(await r("GET","/v1/webhooks")).webhooks,createWebhook:(o)=>r("POST","/v1/webhooks",{body:o}),deleteWebhook:(o)=>r("DELETE",`/v1/webhooks/${encodeURIComponent(o)}`),templates:async()=>(await r("GET","/v1/templates")).templates,createAgentFromTemplate:(o)=>r("POST","/v1/agents",{body:o}),async*events(o){let s=new URLSearchParams;if(o?.agentId!==void 0)s.set("agentId",o.agentId);if(o?.types!==void 0&&o.types.length>0)s.set("types",o.types.join(","));if(o?.chunks===!0)s.set("chunks","true");let t=s.size===0?"":`?${s.toString()}`,a=await f(`/v1/events${t}`,o?.signal);yield*ye(a)}}}function B(e){let n=new URLSearchParams;if(e?.by!==void 0)n.set("by",e.by.join(","));if(e?.from!==void 0)n.set("from",e.from);if(e?.to!==void 0)n.set("to",e.to);return n.size===0?"":`?${n.toString()}`}export{b as DispachError,Pe as createClient,Ue as isEvent};
|
|
30
|
+
never guess a value for a required field you have not been given.`;function ce(e){return e.startsWith("subagent:")||e.startsWith("handoff:")}class b extends Error{code;hint;field;details;status;request;constructor(e,t={}){super([e.message,...(e.details??[]).map((d)=>` - ${d.field===void 0?"":`${d.field}: `}${d.message}`),...e.hint===void 0?[]:[` hint: ${e.hint}`]].join(`
|
|
31
|
+
`));if(this.name="DispachError",this.code=e.code,this.hint=e.hint??"",this.field=e.field,this.details=e.details??[],this.status=t.status,this.request=t.method===void 0||t.path===void 0?void 0:{method:t.method,path:t.path},t.cause!==void 0)this.cause=t.cause}}function fe(e,t){let d=e instanceof Error?e.message:String(e);return new b({code:"transport_failed",message:`${t.method} ${t.path} did not reach ${t.baseUrl}: ${d}`,hint:"Check the base URL, that the server is running, and that nothing between you and it is refusing the connection. `GET /v1/health` needs no token and is the cheapest probe."},{...t,cause:e})}async function he(e,t){let d;try{let a=await e.json();if(typeof a.error?.code==="string"&&typeof a.error.message==="string")d={code:a.error.code,message:a.error.message,...a.error.hint===void 0?{}:{hint:a.error.hint},...a.error.field===void 0?{}:{field:a.error.field}}}catch{}return new b(d??{code:`http_${e.status}`,message:`${t.method} ${t.path} returned ${e.status} with no error body.`,hint:"This is not a response this server produces, so something between you and it answered — a proxy, a gateway, or a load balancer. Check the URL and what is in front of it."},{status:e.status,...t})}var B=new Set(O);async function*H(e){for await(let t of N(pe(e))){if(t.event===void 0||t.data==="")continue;let d;try{d=JSON.parse(t.data)}catch{continue}yield{name:t.event,data:d}}}async function*pe(e){let t=e.getReader();try{while(!0){let{done:d,value:a}=await t.read();if(d)return;if(a!==void 0)yield a}}finally{t.releaseLock()}}async function*me(e){for await(let{name:t,data:d}of H(e)){if(B.has(t)){yield{kind:"event",event:d};continue}let a=d??{};switch(t){case"turn.accepted":yield{kind:"accepted",turnId:String(a.turnId??""),sessionKey:String(a.sessionKey??"")};break;case"stream.replay":yield{kind:"replay",report:{state:a.state==="ended"?"ended":"running",events:Number(a.events??0),truncated:a.truncated===!0,dropped:Number(a.dropped??0),chunks:a.chunks==="start"||a.chunks==="partial"?a.chunks:"none"}};break;case"stream.ended":yield{kind:"ended",turnId:String(a.turnId??""),status:String(a.status??"unknown"),steps:typeof a.steps==="number"?a.steps:void 0,errorCode:typeof a.errorCode==="string"?a.errorCode:void 0};break;case"stream.unavailable":yield{kind:"unavailable",turnId:String(a.turnId??""),reason:String(a.reason??"not observable from this process")};break;default:break}}}async function*ye(e){for await(let{name:t,data:d}of H(e)){if(B.has(t)){yield{kind:"event",event:d};continue}if(t==="stream.subscribed"){let a=d??{};yield{kind:"subscribed",report:{agentId:typeof a.agentId==="string"?a.agentId:null,types:Array.isArray(a.types)?a.types:null,chunks:a.chunks===!0,implied:typeof a.implied==="string"?a.implied:void 0}}}}}async function*ge(e,t={}){for await(let d of e){if(d.kind==="replay"&&d.report.truncated&&t.allowTruncated!==!0)throw new b({code:"replay_truncated",message:`This turn's replay is missing its oldest ${d.report.dropped} event(s), so the text reconstructed from it would be incomplete.`,hint:"Read the finished text from GET /v1/agents/:id/turns/:turnId, or pass { allowTruncated: true } to accept a fragment. Streaming from the start of a turn is never truncated — this only happens when reattaching to one that has already produced more events than the buffer holds."});if(d.kind==="unavailable")throw new b({code:"turn_not_observable",message:`Turn ${d.turnId} is recorded as running but is not observable here: ${d.reason}.`,hint:"Its events are buffered in whichever process is executing it. Poll GET /v1/agents/:id/turns/:turnId for the outcome."});if(d.kind!=="event")continue;if(d.event.type!=="model.chunk")continue;let a=d.event.data;if(a.kind==="reasoning")continue;if(typeof a.delta==="string")yield a.delta}}function _e(e,t){return e.type===t}function Pe(e){let t=e.baseUrl.length;while(t>0&&e.baseUrl[t-1]==="/")t-=1;let d=e.baseUrl.slice(0,t),a=e.fetch??fetch,c=(o={})=>({...e.token===void 0?{}:{authorization:`Bearer ${e.token}`},...o});async function l(o,s,n={}){let i;try{i=await a(`${d}${s}`,{method:o,headers:c({...n.body===void 0?{}:{"content-type":"application/json"},...n.accept===void 0?{}:{accept:n.accept},...n.headers}),...n.body===void 0?{}:{body:JSON.stringify(n.body)},...n.signal===void 0?{}:{signal:n.signal}})}catch(u){throw fe(u,{method:o,path:s,baseUrl:d})}if(!i.ok)throw await he(i,{method:o,path:s});return i}async function r(o,s,n){return await(await l(o,s,n??{})).json()}async function f(o,s){let n=await l("GET",o,{accept:"text/event-stream",...s===void 0?{}:{signal:s}});if(n.body===null)throw new b({code:"no_response_body",message:`GET ${o} returned ${n.status} with no body to read.`,hint:"An SSE route always has a body. A missing one means something between you and the server buffered the response — commonly a proxy without streaming enabled."},{status:n.status,method:"GET",path:o});return n.body}function p(o,s,n,i={}){let u=(h)=>{let T=new URLSearchParams;if(h?.chunks===!0)T.set("chunks","true");if(h?.children===!0)T.set("children","true");let U=T.toString();return U===""?"":`?${U}`},m={turnId:s,sessionKey:n,replayed:i.replayed===!0,async*stream(h){let T=await f(`/v1/agents/${encodeURIComponent(o)}/turns/${encodeURIComponent(s)}/stream${u(h)}`,h?.signal);yield*me(T)},async*tokens(h){yield*ge(m.stream({chunks:!0,...h,children:!1}),{...h?.allowTruncated===void 0?{}:{allowTruncated:h.allowTruncated}})},async text(){for await(let h of m.stream()){if(h.kind==="ended")break;if(h.kind==="unavailable")break;if(h.kind==="event"&&h.event.type==="turn.end")break}return(await m.get()).text},get:()=>r("GET",`/v1/agents/${encodeURIComponent(o)}/turns/${encodeURIComponent(s)}`),async stop(){await l("POST",`/v1/agents/${encodeURIComponent(o)}/turns/${encodeURIComponent(s)}/stop`)}};return m}function g(o){let s=(n)=>`/v1/agents/${encodeURIComponent(o)}${n}`;return{id:o,async send(n,i){let u=await r("POST",s("/messages"),{body:{text:n,...i?.sessionKey===void 0?{}:{sessionKey:i.sessionKey},...i?.deliver===void 0?{}:{deliver:i.deliver},...i?.from===void 0?{}:{from:i.from},...i?.images===void 0?{}:{images:i.images},...i?.runtimeNote===void 0?{}:{runtimeNote:i.runtimeNote},...i?.chunks===!0?{chunks:!0}:{},...i?.role===void 0?{}:{role:i.role}},...i?.idempotencyKey===void 0?{}:{headers:{"idempotency-key":i.idempotencyKey}},...i?.signal===void 0?{}:{signal:i.signal}});return p(o,u.turnId,u.sessionKey,{replayed:u.replayed===!0})},turn:(n)=>p(o,n,""),describe:()=>r("GET",s("")),tools:()=>r("GET",s("/tools")),skills:()=>r("GET",s("/skills")),sessions:()=>r("GET",s("/sessions")),messages:(n,i)=>{let u=new URLSearchParams;if(i?.before!==void 0)u.set("before",String(i.before));if(i?.limit!==void 0)u.set("limit",String(i.limit));let m=u.size===0?"":`?${u.toString()}`;return r("GET",s(`/sessions/${encodeURIComponent(n)}/messages${m}`))},clearSession:(n)=>r("DELETE",s(`/sessions/${encodeURIComponent(n)}`)),reload:()=>r("POST",s("/reload"),{body:{}}),usage:(n)=>r("GET",s(`/usage${W(n)}`)),turns:(n)=>{let i=new URLSearchParams;if(n?.limit!==void 0)i.set("limit",String(n.limit));if(n?.before!==void 0)i.set("before",String(n.before));let u=i.size===0?"":`?${i.toString()}`;return r("GET",s(`/turns${u}`))},secrets:async()=>(await r("GET",s("/secrets"))).secrets,setSecrets:(n)=>r("PUT",s("/secrets"),{body:{values:n}}),schedules:async()=>(await r("GET",s("/schedules"))).schedules,approvals:async()=>(await r("GET",s("/approvals"))).approvals,createSchedule:(n)=>r("POST",s("/schedules"),{body:n}),updateSchedule:(n,i)=>r("PATCH",s(`/schedules/${encodeURIComponent(n)}`),{body:i}),deleteSchedule:async(n)=>{await r("DELETE",s(`/schedules/${encodeURIComponent(n)}`))},refreshTools:(n)=>r("POST",s("/tools/refresh"),{body:n?.providers===void 0?{}:{providers:n.providers}}),previewSchedule:(n)=>{let i=new URLSearchParams({kind:n.kind,expr:n.expr});if(n.timezone!==void 0)i.set("timezone",n.timezone);if(n.count!==void 0)i.set("count",String(n.count));return r("GET",s(`/schedules/preview?${i.toString()}`))},runSchedule:(n)=>r("POST",s(`/schedules/${encodeURIComponent(n)}/run`),{body:{}}),config:()=>r("GET",s("/config")),setConfig:(n,i,u)=>r("PATCH",s("/config"),{body:{path:n,value:i,...u?.confirm===void 0?{}:{confirm:u.confirm}}}),removeConfig:(n,i)=>r("PATCH",s("/config"),{body:{path:n,remove:!0,...i?.confirm===void 0?{}:{confirm:i.confirm}}}),setConfigs:(n)=>r("PATCH",s("/config"),{body:{changes:n.map((i)=>({...i}))}}),setChannel:(n,i)=>r("PATCH",s(`/channels/${encodeURIComponent(n)}`),{body:{...i}}),unpairChannel:(n)=>r("POST",s(`/channels/${encodeURIComponent(n)}/unpair`)),session:(n)=>r("GET",s(`/sessions/${encodeURIComponent(n)}`)),setPhase:(n,i)=>r("POST",s(`/sessions/${encodeURIComponent(n)}/phase`),{body:{phase:i}}),setRecall:(n,i)=>r("POST",s(`/sessions/${encodeURIComponent(n)}/recall`),{body:{recall:i}}),resolveSessionKey:async(n)=>(await r("POST",s("/sessions/resolve"),{body:{sessionKey:n}})).sessionKey,compactSession:(n,i)=>r("POST",s(`/sessions/${encodeURIComponent(n)}/compact`),{body:i?.keepTurns===void 0?{}:{keepTurns:i.keepTurns}}),rotateSession:(n)=>r("POST",s("/sessions/rotate"),{body:n?.from===void 0?{}:{from:n.from}}),approve:async(n,i)=>{await r("POST",s(`/approvals/${encodeURIComponent(n)}`),{body:{granted:i}})},stop:(n)=>r("POST",s("/stop"),{body:n===void 0?{}:{reason:n}}),start:()=>r("POST",s("/start"),{body:{}}),assign:(n)=>r("PUT",s("/assignee"),{body:{participantId:n}}),unassign:()=>r("DELETE",s("/assignee")),assignment:()=>r("GET",s("/assignee")),workspaceFiles:()=>r("GET",s("/workspace")),workspaceFile:(n)=>r("GET",s(`/workspace/${encodeURIComponent(n)}`)),putWorkspaceFile:(n,i)=>r("PUT",s(`/workspace/${encodeURIComponent(n)}`),{body:{content:i}}),exportBundle:(n)=>r("GET",s(`/export${n===void 0?"":`?paths=${encodeURIComponent(n.join(","))}`}`)),importBundle:(n,i)=>r("POST",s("/import"),{body:{bundle:n,...i===void 0?{}:{mode:i}}}),setVars:(n)=>r("PATCH",s("/vars"),{body:{vars:n}}),vars:()=>r("GET",s("/vars")),deliver:(n)=>r("POST",s("/deliveries"),{body:n}),context:(n)=>{let i=new URLSearchParams;if(n?.sessionKey!==void 0)i.set("sessionKey",n.sessionKey);if(n?.input!==void 0)i.set("input",n.input);let u=i.size===0?"":`?${i.toString()}`;return r("GET",s(`/context${u}`))}}}return{agent:g,agents:()=>r("GET","/v1/agents"),health:()=>r("GET","/v1/health"),async ready(){try{return await l("GET","/v1/ready"),!0}catch(o){if(o instanceof b&&o.status===503)return!1;throw o}},provision:()=>r("GET","/v1/provision"),keys:()=>r("GET","/v1/keys"),createKey:(o)=>r("POST","/v1/keys",{body:o}),revokeKey:(o)=>r("DELETE",`/v1/keys/${encodeURIComponent(o)}`),deleteAgent:(o,s)=>r("DELETE",`/v1/agents/${encodeURIComponent(o)}?confirm=${encodeURIComponent(s)}`),backup:async(o)=>(await l("GET",`/v1/backup${o===void 0||o.length===0?"":`?include=${o.join(",")}`}`,{accept:"application/gzip"})).blob(),deleteParticipant:(o)=>r("DELETE",`/v1/participants/${encodeURIComponent(o)}`),createAgent:(o)=>r("POST","/v1/agents",{body:{answers:o}}),usage:(o)=>r("GET",`/v1/usage${W(o)}`),activity:()=>r("GET","/v1/activity"),participants:async()=>(await r("GET","/v1/participants")).participants,registerParticipant:(o)=>r("POST","/v1/participants",{body:o}),conversations:async()=>(await r("GET","/v1/conversations")).conversations,createConversation:(o)=>r("POST","/v1/conversations",{body:o}),conversation:(o)=>r("GET",`/v1/conversations/${encodeURIComponent(o)}`),setMembers:(o,s)=>r("PATCH",`/v1/conversations/${encodeURIComponent(o)}/members`,{body:s}),postMessage:(o,s)=>r("POST",`/v1/conversations/${encodeURIComponent(o)}/messages`,{body:s}),conversationMessages:(o,s={})=>{let n=new URLSearchParams;if(s.after!==void 0)n.set("after",String(s.after));if(s.limit!==void 0)n.set("limit",String(s.limit));let i=n.size===0?"":`?${n}`;return r("GET",`/v1/conversations/${encodeURIComponent(o)}/messages${i}`)},setPresence:(o,s)=>r("PUT",`/v1/participants/${encodeURIComponent(o)}/presence`,{body:{presence:s}}),actions:async(o={})=>(await r("GET",`/v1/actions${o.status===void 0?"":`?status=${o.status}`}`)).actions,decideAction:(o,s)=>r("POST",`/v1/actions/${encodeURIComponent(o)}`,{body:{approve:s}}),addNote:(o)=>r("POST","/v1/memory/notes",{body:o}),notes:async(o)=>(await r("GET",`/v1/memory/notes?scope=${encodeURIComponent(o)}`)).notes,deleteNote:(o)=>r("DELETE",`/v1/memory/notes/${encodeURIComponent(o)}`),memoryReads:async(o)=>(await r("GET",`/v1/participants/${encodeURIComponent(o)}/memory/reads`)).reads,projects:async()=>(await r("GET","/v1/projects")).projects,putProject:(o,s)=>r("PUT",`/v1/projects/${encodeURIComponent(o)}`,{body:s}),deleteProject:(o)=>r("DELETE",`/v1/projects/${encodeURIComponent(o)}`),setSpaceWriter:(o)=>r("PUT","/v1/memory/space/writer",{body:{writer:o}}),webhooks:async()=>(await r("GET","/v1/webhooks")).webhooks,createWebhook:(o)=>r("POST","/v1/webhooks",{body:o}),deleteWebhook:(o)=>r("DELETE",`/v1/webhooks/${encodeURIComponent(o)}`),templates:async()=>(await r("GET","/v1/templates")).templates,createAgentFromTemplate:(o)=>r("POST","/v1/agents",{body:o}),async*events(o){let s=new URLSearchParams;if(o?.agentId!==void 0)s.set("agentId",o.agentId);if(o?.types!==void 0&&o.types.length>0)s.set("types",o.types.join(","));if(o?.chunks===!0)s.set("chunks","true");let n=s.size===0?"":`?${s.toString()}`,i=await f(`/v1/events${n}`,o?.signal);yield*ye(i)}}}function W(e){let t=new URLSearchParams;if(e?.by!==void 0)t.set("by",e.by.join(","));if(e?.from!==void 0)t.set("from",e.from);if(e?.to!==void 0)t.set("to",e.to);return t.size===0?"":`?${t.toString()}`}export{b as DispachError,Pe as createClient,_e as isEvent};
|
|
32
32
|
|
|
33
|
-
//# debugId=
|
|
33
|
+
//# debugId=3B2BF74A58DC6C9164756E2164756E21
|
|
34
34
|
//# sourceMappingURL=client.js.map
|