dispach 0.2.0 → 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 +144 -49
- package/dist/APEv2Parser-etzjd528.js +5 -0
- package/dist/{FlacParser-6jwner07.js.map → APEv2Parser-etzjd528.js.map} +1 -1
- package/dist/{AiffParser-n65syezh.js → AiffParser-y21k3fak.js} +3 -3
- package/dist/{AiffParser-n65syezh.js.map → AiffParser-y21k3fak.js.map} +1 -1
- package/dist/App-4w3qkcs4.js +11 -0
- package/dist/{App-pmqmzsb3.js.map → App-4w3qkcs4.js.map} +1 -1
- package/dist/{AsfParser-da1fqvxz.js → AsfParser-wd98k2h4.js} +3 -3
- package/dist/{AsfParser-da1fqvxz.js.map → AsfParser-wd98k2h4.js.map} +1 -1
- package/dist/{ConfigEditor-4nqbeejh.js → ConfigEditor-vk7vxaa6.js} +3 -3
- package/dist/{ConfigEditor-4nqbeejh.js.map → ConfigEditor-vk7vxaa6.js.map} +1 -1
- package/dist/{DsdiffParser-gk95sj7t.js → DsdiffParser-cbfaj500.js} +3 -3
- package/dist/{DsdiffParser-gk95sj7t.js.map → DsdiffParser-cbfaj500.js.map} +1 -1
- package/dist/{DsfParser-b0enevjw.js → DsfParser-tybrja4x.js} +3 -3
- package/dist/{DsfParser-b0enevjw.js.map → DsfParser-tybrja4x.js.map} +1 -1
- package/dist/FlacParser-7t7da7qy.js +5 -0
- package/dist/{APEv2Parser-jdp5yp24.js.map → FlacParser-7t7da7qy.js.map} +1 -1
- package/dist/{KeyProbe-rspsxpsr.js → KeyProbe-5anphmb7.js} +3 -3
- package/dist/{KeyProbe-rspsxpsr.js.map → KeyProbe-5anphmb7.js.map} +1 -1
- package/dist/{MP4Parser-ph7rv2fn.js → MP4Parser-gc94h1n9.js} +3 -3
- package/dist/{MP4Parser-ph7rv2fn.js.map → MP4Parser-gc94h1n9.js.map} +1 -1
- package/dist/{MatroskaParser-fjk1mpct.js → MatroskaParser-cy2k4fac.js} +3 -3
- package/dist/{MatroskaParser-fjk1mpct.js.map → MatroskaParser-cy2k4fac.js.map} +1 -1
- package/dist/{MpegParser-vp7cj8ts.js → MpegParser-c460fwf0.js} +3 -3
- package/dist/{MpegParser-vp7cj8ts.js.map → MpegParser-c460fwf0.js.map} +1 -1
- package/dist/{MusepackParser-v22gft1f.js → MusepackParser-8mq2eabg.js} +3 -3
- package/dist/{MusepackParser-v22gft1f.js.map → MusepackParser-8mq2eabg.js.map} +1 -1
- package/dist/OggParser-7dnc6apg.js +5 -0
- package/dist/{OggParser-as1m8xsa.js.map → OggParser-7dnc6apg.js.map} +1 -1
- package/dist/Picker-j7txnm7w.js +5 -0
- package/dist/{Picker-jkmd5xnx.js.map → Picker-j7txnm7w.js.map} +1 -1
- package/dist/SessionPicker-hpv2ncsb.js +5 -0
- package/dist/{SessionPicker-3712ke3k.js.map → SessionPicker-hpv2ncsb.js.map} +3 -3
- package/dist/SkillBrowser-qc542n71.js +5 -0
- package/dist/{SkillBrowser-qhsyszt4.js.map → SkillBrowser-qc542n71.js.map} +1 -1
- package/dist/{WavPackParser-b4qqavzg.js → WavPackParser-kt7cds9c.js} +3 -3
- package/dist/{WavPackParser-b4qqavzg.js.map → WavPackParser-kt7cds9c.js.map} +1 -1
- package/dist/{WaveParser-fqs1h38f.js → WaveParser-g47ja0vy.js} +3 -3
- package/dist/{WaveParser-fqs1h38f.js.map → WaveParser-g47ja0vy.js.map} +1 -1
- package/dist/WizardApp-q4p979d1.js +5 -0
- package/dist/{WizardApp-qrq36nv8.js.map → WizardApp-q4p979d1.js.map} +3 -3
- package/dist/{channels-gf31stv7.js → channels-4t89qpdt.js} +18 -18
- package/dist/{channels-gf31stv7.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-35r6n1gh.js +24 -0
- package/dist/{config-z2cd0c5f.js.map → config-35r6n1gh.js.map} +1 -1
- package/dist/credential-dpdgg4j6.js +19 -0
- package/dist/{credential-h0wmsjsw.js.map → credential-dpdgg4j6.js.map} +1 -1
- package/dist/{index-3s2q0m64.js → index-0444sh6x.js} +4 -4
- package/dist/{index-3s2q0m64.js.map → index-0444sh6x.js.map} +1 -1
- package/dist/{index-v271gbaz.js → index-095hrkyr.js} +6 -6
- package/dist/{index-v271gbaz.js.map → index-095hrkyr.js.map} +1 -1
- package/dist/index-1x8mzvz7.js +6 -0
- package/dist/{index-rhv6gqpt.js.map → index-1x8mzvz7.js.map} +1 -1
- package/dist/index-2bsardvh.js +5 -0
- package/dist/{index-tny7c703.js.map → index-2bsardvh.js.map} +2 -2
- package/dist/{index-9m6b14b4.js → index-2zjh5zd5.js} +4 -4
- package/dist/{index-9m6b14b4.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-gace5ac7.js → index-3826kf9t.js} +5 -5
- package/dist/{index-gace5ac7.js.map → index-3826kf9t.js.map} +1 -1
- package/dist/index-38gs9anh.js +9 -0
- package/dist/{index-b7qc21s7.js.map → index-38gs9anh.js.map} +1 -1
- package/dist/index-3c5jt6by.js +5 -0
- package/dist/{index-3mvenfbg.js.map → index-3c5jt6by.js.map} +2 -2
- package/dist/{index-k2q76dhw.js → index-3vzf253k.js} +7 -7
- package/dist/{index-k2q76dhw.js.map → index-3vzf253k.js.map} +1 -1
- package/dist/{index-t5d8ey5t.js → index-42e29zs4.js} +4 -4
- package/dist/{index-t5d8ey5t.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-gqbny9gy.js → index-51x0n5z0.js} +6 -6
- package/dist/{index-gqbny9gy.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-qe3ybzh6.js.map → index-7mn8ack9.js.map} +2 -2
- package/dist/index-8edck2pr.js +6 -0
- package/dist/{index-kktaw552.js.map → index-8edck2pr.js.map} +1 -1
- package/dist/index-8h6kewy1.js +9 -0
- package/dist/{index-s4a28ctb.js.map → index-8h6kewy1.js.map} +1 -1
- package/dist/index-8tmv33mr.js +6 -0
- package/dist/{index-v6taf4vn.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-y6r1k2yd.js → index-a2eh8dnk.js} +7 -7
- package/dist/{index-y6r1k2yd.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-rfa0ztab.js → index-dzy19wtf.js} +4 -4
- package/dist/{index-rfa0ztab.js.map → index-dzy19wtf.js.map} +1 -1
- package/dist/{index-c2qjdz4q.js → index-eqqd4k4f.js} +9 -9
- package/dist/{index-c2qjdz4q.js.map → index-eqqd4k4f.js.map} +1 -1
- package/dist/{index-g1d06ct5.js → index-ew997be5.js} +7 -7
- package/dist/{index-g1d06ct5.js.map → index-ew997be5.js.map} +1 -1
- package/dist/{index-0v2gw4mk.js → index-fa9wvpyw.js} +3 -3
- package/dist/{index-0v2gw4mk.js.map → index-fa9wvpyw.js.map} +1 -1
- package/dist/{index-rvq7t636.js → index-fbsrhcga.js} +4 -4
- package/dist/{index-rvq7t636.js.map → index-fbsrhcga.js.map} +1 -1
- package/dist/index-fcsg95m5.js +11 -0
- package/dist/{index-5nprb9px.js.map → index-fcsg95m5.js.map} +1 -1
- package/dist/{index-dgrwpzz9.js → index-gbkma7ds.js} +4 -4
- package/dist/{index-dgrwpzz9.js.map → index-gbkma7ds.js.map} +1 -1
- package/dist/{index-0m0x1454.js → index-gq1npngp.js} +4 -4
- package/dist/{index-0m0x1454.js.map → index-gq1npngp.js.map} +1 -1
- package/dist/index-haypwvzd.js +308 -0
- package/dist/index-haypwvzd.js.map +21 -0
- package/dist/{index-g8n8rhtr.js → index-jc4kmfwa.js} +4 -4
- package/dist/{index-g8n8rhtr.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-es4bgkbh.js → index-m6fqx0ch.js} +7 -7
- package/dist/{index-es4bgkbh.js.map → index-m6fqx0ch.js.map} +1 -1
- package/dist/{index-60jxyzbe.js → index-ma6p7bt4.js} +4 -4
- package/dist/{index-60jxyzbe.js.map → index-ma6p7bt4.js.map} +1 -1
- package/dist/index-nvc24414.js +6 -0
- package/dist/{index-2yj11ykt.js.map → index-nvc24414.js.map} +1 -1
- package/dist/index-nxhqf597.js +6 -0
- package/dist/{index-m5rmhcez.js.map → index-nxhqf597.js.map} +1 -1
- package/dist/{index-jmnjcw61.js → index-p1zy871m.js} +4 -4
- package/dist/{index-jmnjcw61.js.map → index-p1zy871m.js.map} +1 -1
- package/dist/{index-2pzgta33.js → index-p6ya59m6.js} +5 -5
- package/dist/{index-2pzgta33.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-1h9pqnec.js.map → index-qg9bn980.js.map} +28 -25
- package/dist/index-qgsdgbk8.js +5 -0
- package/dist/{index-ak304afj.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-m01mb74d.js → index-snz49ndn.js} +4 -4
- package/dist/{index-m01mb74d.js.map → index-snz49ndn.js.map} +1 -1
- package/dist/index-twn9bfm2.js +8 -0
- package/dist/{index-dwxmy0kx.js.map → index-twn9bfm2.js.map} +2 -2
- package/dist/{index-0p9p6fvc.js → index-wc4entme.js} +10 -10
- package/dist/{index-0p9p6fvc.js.map → index-wc4entme.js.map} +3 -3
- package/dist/{index-wxmqyv4c.js → index-ynsvkqgb.js} +4 -4
- package/dist/{index-wxmqyv4c.js.map → index-ynsvkqgb.js.map} +1 -1
- package/dist/index-ytxbw8py.js +63 -0
- package/dist/{index-fcqy46mh.js.map → index-ytxbw8py.js.map} +2 -2
- package/dist/index-yw3fby4n.js +6 -0
- package/dist/{index-dh2g58s1.js.map → index-yw3fby4n.js.map} +2 -2
- package/dist/{index-ccpq4k6r.js → index-z157at3s.js} +28 -28
- package/dist/{index-ccpq4k6r.js.map → index-z157at3s.js.map} +1 -1
- package/dist/{index-s78sq9g1.js → index-zce9gy22.js} +64 -64
- package/dist/{index-s78sq9g1.js.map → index-zce9gy22.js.map} +1 -1
- package/dist/{index-jv7egrh2.js → index-zw6wyas6.js} +4 -4
- package/dist/{index-jv7egrh2.js.map → index-zw6wyas6.js.map} +1 -1
- package/dist/index.js +308 -292
- 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/transcript.d.ts.map +1 -1
- package/dist/web-zph4h3p9.js +14 -0
- package/dist/{web-stkkwyka.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-bwxbqa53.js.map → wrapper-f662ny3r.js.map} +1 -1
- package/package.json +5 -2
- package/dist/APEv2Parser-jdp5yp24.js +0 -5
- package/dist/App-pmqmzsb3.js +0 -11
- package/dist/FlacParser-6jwner07.js +0 -5
- package/dist/OggParser-as1m8xsa.js +0 -5
- package/dist/Picker-jkmd5xnx.js +0 -5
- package/dist/SessionPicker-3712ke3k.js +0 -5
- package/dist/SkillBrowser-qhsyszt4.js +0 -5
- package/dist/WizardApp-qrq36nv8.js +0 -5
- package/dist/config-z2cd0c5f.js +0 -24
- package/dist/credential-h0wmsjsw.js +0 -19
- package/dist/index-026q0y3a.js +0 -6
- package/dist/index-026q0y3a.js.map +0 -10
- package/dist/index-1h9pqnec.js +0 -1194
- package/dist/index-1wxw30j1.js +0 -74
- package/dist/index-1wxw30j1.js.map +0 -13
- package/dist/index-2yj11ykt.js +0 -6
- package/dist/index-358nsn9t.js +0 -65
- package/dist/index-358nsn9t.js.map +0 -21
- package/dist/index-3mvenfbg.js +0 -5
- package/dist/index-5nprb9px.js +0 -11
- package/dist/index-ak304afj.js +0 -5
- package/dist/index-b7qc21s7.js +0 -9
- package/dist/index-dh2g58s1.js +0 -6
- package/dist/index-dwxmy0kx.js +0 -8
- package/dist/index-fcqy46mh.js +0 -63
- package/dist/index-kktaw552.js +0 -6
- package/dist/index-m5rmhcez.js +0 -6
- package/dist/index-qe3ybzh6.js +0 -6
- package/dist/index-rhv6gqpt.js +0 -6
- package/dist/index-s4a28ctb.js +0 -9
- package/dist/index-tny7c703.js +0 -5
- package/dist/index-v6taf4vn.js +0 -6
- package/dist/index-y605a1rj.js +0 -429
- package/dist/index-y605a1rj.js.map +0 -11
- package/dist/index-z88f35vs.js +0 -96
- package/dist/index-z88f35vs.js.map +0 -13
- package/dist/web-stkkwyka.js +0 -14
- package/dist/wrapper-bwxbqa53.js +0 -5
- /package/dist/{index-6c4p19m1.js.map → index-pszmnhgq.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{i}from"./index-
|
|
3
|
-
export{
|
|
2
|
+
import{i}from"./index-dzy19wtf.js";import{Y}from"./index-0444sh6x.js";import{Box as y,Text as h}from"ink";import{jsx as k,jsxs as b}from"react/jsx-runtime";function Rn({lines:t}){let r=t.map((n,e)=>({at:e,text:n}));return k(y,{flexDirection:"column",children:r.map((n)=>b(h,{color:i.brand,bold:!0,wrap:"truncate",children:[" ".repeat(mA),n.text]},`mark-${n.at}`))})}var mA=1;var m="#",u={A:[".###.","#...#","#####","#...#","#...#"],B:["####.","#...#","####.","#...#","####."],C:[".####","#....","#....","#....",".####"],D:["####.","#...#","#...#","#...#","####."],E:["#####","#....","####.","#....","#####"],F:["#####","#....","####.","#....","#...."],G:[".####","#....","#..##","#...#",".###."],H:["#...#","#...#","#####","#...#","#...#"],I:["#####","..#..","..#..","..#..","#####"],J:["..###","....#","....#","#...#",".###."],K:["#...#","#..#.","###..","#..#.","#...#"],L:["#....","#....","#....","#....","#####"],M:["#...#","##.##","#.#.#","#...#","#...#"],N:["#...#","##..#","#.#.#","#..##","#...#"],O:[".###.","#...#","#...#","#...#",".###."],P:["####.","#...#","####.","#....","#...."],Q:[".###.","#...#","#.#.#","#..#.",".##.#"],R:["####.","#...#","####.","#..#.","#...#"],S:[".####","#....",".###.","....#","####."],T:["#####","..#..","..#..","..#..","..#.."],U:["#...#","#...#","#...#","#...#",".###."],V:["#...#","#...#","#...#",".#.#.","..#.."],W:["#...#","#...#","#.#.#","##.##","#...#"],X:["#...#",".#.#.","..#..",".#.#.","#...#"],Y:["#...#",".#.#.","..#..","..#..","..#.."],Z:["#####","...#.","..#..",".#...","#####"],"0":[".###.","#..##","#.#.#","##..#",".###."],"1":["..#..",".##..","..#..","..#..",".###."],"2":[".###.","#...#","..##.",".#...","#####"],"3":["####.","....#",".###.","....#","####."],"4":["#..#.","#..#.","#####","...#.","...#."],"5":["#####","#....","####.","....#","####."],"6":[".###.","#....","####.","#...#",".###."],"7":["#####","....#","...#.","..#..",".#..."],"8":[".###.","#...#",".###.","#...#",".###."],"9":[".###.","#...#",".####","....#",".###."],".":[".....",".....",".....",".....","..#.."],"-":[".....",".....",".###.",".....","....."]," ":[".....",".....",".....",".....","....."]},w=5,x=1;function T(t){return[...t.toUpperCase()].every((r)=>u[r]!==void 0)}function B(t){let r=[...t.toUpperCase()].map((e)=>u[e]??u[" "]),n=".".repeat(x);return Array.from({length:w},(e,s)=>r.map((a)=>a?.[s]??"").join(n))}function f(t,r,n){let e=r.repeat(n),s=" ".repeat(n);return t.map((a)=>[...a].map((o)=>o===m?e:s).join(""))}function W(t){let r=[".".repeat([...t[0]??""].length),...t],n=[];for(let e=0;e<r.length;e+=2){let s=[...r[e]??""],a=[...r[e+1]??""],o=[];for(let l=0;l<Math.max(s.length,a.length);l+=1){let d=s[l]===m,c=a[l]===m;o.push(d&&c?"█":d?"▀":c?"▄":" ")}n.push(o.join(""))}return n}function g(t,r){return[Y([...t.toUpperCase()].join(" "),r)]}function p(t){return t.reduce((r,n)=>Math.max(r,[...n].length),0)}function _n(t,r){let n=t.trim();if(n===""||!T(n)){let o=g(n,r.columns);return{lines:o,tier:"plain",width:p(o)}}let e=B(n),s=[{tier:"wide",lines:f(e,"█",2)},{tier:"block",lines:f(e,"█",1)},{tier:"half",lines:W(e)}];for(let o of s){let l=o.lines.map((c)=>c.replace(/\s+$/,"")),d=p(l);if(d<=r.columns&&l.length<=r.rows)return{lines:l,tier:o.tier,width:d}}let a=g(n,r.columns);return{lines:a,tier:"plain",width:p(a)}}
|
|
3
|
+
export{Rn,mA,_n};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=95C0EA15AF2A18E264756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-snz49ndn.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * The product name, drawn large, from a glyph grid.\n *\n * ## Why a grid and not a string\n *\n * Hard rule 3: no brand strings outside `brand.ts`, so that a rename is one commit. An ASCII wordmark is\n * a brand string — a literal one would be the single largest violation in the tree. So this renders\n * whatever `BRAND.name` happens to say, from a table of letters, and a rename changes nothing here.\n *\n * ## The research, and what it settled\n *\n * Three findings shaped this. **5×5 pixels is the floor** for a legible Latin glyph without\n * anti-aliasing, so that is the grid. **A width-aware fallback is mandatory rather than polish** — the\n * big figlet faces (`big`, `ansi-shadow`) pass 120 columns on a nine-letter word, and this CLI's floor is\n * 40. And **half-blocks are the density trick**: one character cell per pixel renders a 5×5 glyph tall and\n * thin, because a cell is roughly 1:2, while packing two pixel rows into one cell with `▀▄█` brings it\n * back to nearly square.\n *\n * A third-party font was the obvious shortcut and is not taken: embedding `.flf` data or another\n * project's bitmap into an Apache-2.0 repo buys a licence question, and 26 letters are verifiable by\n * rendering them.\n *\n * ## One table, four renderings\n *\n * The tiers are parameter changes over the same grid — how many columns a pixel occupies, and whether\n * rows are packed — not four codepaths:\n *\n * | tier | pixel | rows | nine letters |\n * | --- | --- | --- | --- |\n * | `wide` | 2 columns | 5 | 106 columns |\n * | `block` | 1 column | 5 | 53 columns |\n * | `half` | 1 column | 3 | 53 columns |\n * | `plain` | — | 1 | as wide as the name |\n *\n * `plain` is the floor and always fits, because it is the name with spaces in it and gets clipped like\n * any other line. A screen too small for that is a screen with no wordmark, which is a real answer.\n *\n * Pure: text and a size in, lines out. Colour is the component's business.\n */\n\nimport { clip } from \"#lib/rows\"\n\n/** On and off, as authored. `#` reads as ink in the source, which is the only place these are edited. */\nconst ON = \"#\"\n\n/**\n * A 5×5 grid per glyph, authored by hand and verified by rendering.\n *\n * Uppercase only: the input is upper-cased before lookup, because a display face has no lowercase at this\n * size, and inventing one is how a name and its shout become two different-looking products. Digits are\n * here for a version, and `.`/`-`/space for what a name might contain.\n */\nconst GLYPHS: Readonly<Record<string, readonly string[]>> = {\n A: [\".###.\", \"#...#\", \"#####\", \"#...#\", \"#...#\"],\n B: [\"####.\", \"#...#\", \"####.\", \"#...#\", \"####.\"],\n C: [\".####\", \"#....\", \"#....\", \"#....\", \".####\"],\n D: [\"####.\", \"#...#\", \"#...#\", \"#...#\", \"####.\"],\n E: [\"#####\", \"#....\", \"####.\", \"#....\", \"#####\"],\n F: [\"#####\", \"#....\", \"####.\", \"#....\", \"#....\"],\n G: [\".####\", \"#....\", \"#..##\", \"#...#\", \".###.\"],\n H: [\"#...#\", \"#...#\", \"#####\", \"#...#\", \"#...#\"],\n I: [\"#####\", \"..#..\", \"..#..\", \"..#..\", \"#####\"],\n J: [\"..###\", \"....#\", \"....#\", \"#...#\", \".###.\"],\n K: [\"#...#\", \"#..#.\", \"###..\", \"#..#.\", \"#...#\"],\n L: [\"#....\", \"#....\", \"#....\", \"#....\", \"#####\"],\n M: [\"#...#\", \"##.##\", \"#.#.#\", \"#...#\", \"#...#\"],\n N: [\"#...#\", \"##..#\", \"#.#.#\", \"#..##\", \"#...#\"],\n O: [\".###.\", \"#...#\", \"#...#\", \"#...#\", \".###.\"],\n P: [\"####.\", \"#...#\", \"####.\", \"#....\", \"#....\"],\n Q: [\".###.\", \"#...#\", \"#.#.#\", \"#..#.\", \".##.#\"],\n R: [\"####.\", \"#...#\", \"####.\", \"#..#.\", \"#...#\"],\n S: [\".####\", \"#....\", \".###.\", \"....#\", \"####.\"],\n T: [\"#####\", \"..#..\", \"..#..\", \"..#..\", \"..#..\"],\n U: [\"#...#\", \"#...#\", \"#...#\", \"#...#\", \".###.\"],\n V: [\"#...#\", \"#...#\", \"#...#\", \".#.#.\", \"..#..\"],\n W: [\"#...#\", \"#...#\", \"#.#.#\", \"##.##\", \"#...#\"],\n X: [\"#...#\", \".#.#.\", \"..#..\", \".#.#.\", \"#...#\"],\n Y: [\"#...#\", \".#.#.\", \"..#..\", \"..#..\", \"..#..\"],\n Z: [\"#####\", \"...#.\", \"..#..\", \".#...\", \"#####\"],\n \"0\": [\".###.\", \"#..##\", \"#.#.#\", \"##..#\", \".###.\"],\n \"1\": [\"..#..\", \".##..\", \"..#..\", \"..#..\", \".###.\"],\n \"2\": [\".###.\", \"#...#\", \"..##.\", \".#...\", \"#####\"],\n \"3\": [\"####.\", \"....#\", \".###.\", \"....#\", \"####.\"],\n \"4\": [\"#..#.\", \"#..#.\", \"#####\", \"...#.\", \"...#.\"],\n \"5\": [\"#####\", \"#....\", \"####.\", \"....#\", \"####.\"],\n \"6\": [\".###.\", \"#....\", \"####.\", \"#...#\", \".###.\"],\n \"7\": [\"#####\", \"....#\", \"...#.\", \"..#..\", \".#...\"],\n \"8\": [\".###.\", \"#...#\", \".###.\", \"#...#\", \".###.\"],\n \"9\": [\".###.\", \"#...#\", \".####\", \"....#\", \".###.\"],\n \".\": [\".....\", \".....\", \".....\", \".....\", \"..#..\"],\n \"-\": [\".....\", \".....\", \".###.\", \".....\", \".....\"],\n \" \": [\".....\", \".....\", \".....\", \".....\", \".....\"],\n}\n\nconst GLYPH_ROWS = 5\n/** Blank pixel columns between letters. One is enough at this weight; two reads as word spacing. */\nconst TRACKING = 1\n\nexport type WordmarkTier = \"wide\" | \"block\" | \"half\" | \"plain\"\n\nexport interface Wordmark {\n readonly lines: readonly string[]\n readonly tier: WordmarkTier\n /** Code points in the widest line, so a caller can centre it without measuring. */\n readonly width: number\n}\n\n/** Letters this module can draw. A name containing anything else falls back to `plain`. */\nexport function drawable(text: string): boolean {\n return [...text.toUpperCase()].every((char) => GLYPHS[char] !== undefined)\n}\n\n/** The pixel grid for a whole word: rows of `#` and `.`, tracking included. */\nfunction pixels(text: string): readonly string[] {\n const glyphs = [...text.toUpperCase()].map((char) => GLYPHS[char] ?? GLYPHS[\" \"])\n const gap = \".\".repeat(TRACKING)\n return Array.from({ length: GLYPH_ROWS }, (_, row) =>\n glyphs.map((glyph) => glyph?.[row] ?? \"\").join(gap),\n )\n}\n\n/** Every pixel as `columns` cells of the fill character, or of space. */\nfunction solid(grid: readonly string[], fill: string, columns: number): readonly string[] {\n const on = fill.repeat(columns)\n const off = \" \".repeat(columns)\n return grid.map((row) => [...row].map((cell) => (cell === ON ? on : off)).join(\"\"))\n}\n\n/**\n * Two pixel rows to a text row, using the half blocks.\n *\n * This is what makes the compact tier look like type rather than a stretched grid: five pixel rows become\n * three text rows, so a 5-wide glyph is 5×3 cells — near enough square once a cell's own 1:2 ratio is\n * accounted for.\n *\n * Five rows is odd, so one of them pairs with nothing, and **which end gets the blank decides the\n * weight**. Padding the bottom leaves every baseline as a thin `▀`, so the letters sit on a hairline and\n * read light. Padding the *top* puts the blank against the cap line instead: the top stroke becomes `▄`\n * and the baseline becomes a full `█`. Compared side by side that is not a close call — caps want to be\n * bottom-heavy — which is why the blank row is prepended rather than appended.\n */\nfunction packed(grid: readonly string[]): readonly string[] {\n const padded = [\".\".repeat([...(grid[0] ?? \"\")].length), ...grid]\n const lines: string[] = []\n for (let row = 0; row < padded.length; row += 2) {\n const top = [...(padded[row] ?? \"\")]\n const bottom = [...(padded[row + 1] ?? \"\")]\n const cells: string[] = []\n for (let at = 0; at < Math.max(top.length, bottom.length); at += 1) {\n const up = top[at] === ON\n const down = bottom[at] === ON\n cells.push(up && down ? \"█\" : up ? \"▀\" : down ? \"▄\" : \" \")\n }\n lines.push(cells.join(\"\"))\n }\n return lines\n}\n\n/** The name with a space between every letter — the floor, and it always fits because it is clipped. */\nfunction spaced(text: string, columns: number): readonly string[] {\n return [clip([...text.toUpperCase()].join(\" \"), columns)]\n}\n\nfunction widthOf(lines: readonly string[]): number {\n return lines.reduce((widest, line) => Math.max(widest, [...line].length), 0)\n}\n\n/**\n * The largest wordmark that fits, and how it was drawn.\n *\n * Degrades on both axes, because a splash is constrained by both: a 40-column terminal has no room for the\n * grid at any packing, and an 8-row one has no room for five rows of anything. Trailing blank space is\n * trimmed from each line so a caller centring on `width` centres the ink rather than the padding.\n */\nexport function wordmark(\n text: string,\n space: { readonly columns: number; readonly rows: number },\n): Wordmark {\n const trimmed = text.trim()\n if (trimmed === \"\" || !drawable(trimmed)) {\n const lines = spaced(trimmed, space.columns)\n return { lines, tier: \"plain\", width: widthOf(lines) }\n }\n\n const grid = pixels(trimmed)\n const candidates: readonly { tier: WordmarkTier; lines: readonly string[] }[] = [\n { tier: \"wide\", lines: solid(grid, \"█\", 2) },\n { tier: \"block\", lines: solid(grid, \"█\", 1) },\n { tier: \"half\", lines: packed(grid) },\n ]\n\n for (const candidate of candidates) {\n const lines = candidate.lines.map((line) => line.replace(/\\s+$/, \"\"))\n const width = widthOf(lines)\n if (width <= space.columns && lines.length <= space.rows) {\n return { lines, tier: candidate.tier, width }\n }\n }\n\n const lines = spaced(trimmed, space.columns)\n return { lines, tier: \"plain\", width: widthOf(lines) }\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";sEAoBA,cAAS,UAAK,8DAIP,SAAS,EAAS,EAAG,SAAyB,CAIjD,IAAM,EAAO,EAAM,IAAI,CAAC,EAAM,KAAQ,CAAE,KAAI,MAAK,EAAE,EAEnD,OACI,EAAC,EAAD,CAAK,cAAc,SAAnB,SACK,EAAK,IAAI,CAAC,IACP,EAAC,EAAD,CAA6B,MAAO,EAAM,MAAO,KAAI,GAAC,KAAK,WAA3D,SAGE,CAFG,IAAI,OAAO,EAAY,EACvB,EAAI,OAFE,QAAQ,EAAI,IAGrB,CACL,EACH,EAYH,IAAM,GAAe,ECP5B,IAAM,EAAK,IASL,EAAsD,CACxD,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,C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,EAAM,IAAK,CAAC,CAAE,EAC3C,CAAE,KAAM,QAAS,MAAO,EAAM,EAAM,IAAK,CAAC,CAAE,EAC5C,CAAE,KAAM,OAAQ,MAAO,EAAO,CAAI,CAAE,CACxC,EAEA,QAAW,KAAa,EAAY,CAChC,IAAM,EAAQ,EAAU,MAAM,IAAI,CAAC,IAAS,EAAK,QAAQ,OAAQ,EAAE,CAAC,EAC9D,EAAQ,EAAQ,CAAK,EAC3B,GAAI,GAAS,EAAM,SAAW,EAAM,QAAU,EAAM,KAChD,MAAO,CAAE,QAAO,KAAM,EAAU,KAAM,OAAM,EAIpD,IAAM,EAAQ,EAAO,EAAS,EAAM,OAAO,EAC3C,MAAO,CAAE,QAAO,KAAM,QAAS,MAAO,EAAQ,CAAK,CAAE",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "95C0EA15AF2A18E264756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t,j,A,F,Qn}from"./index-qg9bn980.js";import{existsSync as l,mkdirSync as R,readdirSync as y,readFileSync as w,statSync as p,writeFileSync as S}from"node:fs";import{homedir as P}from"node:os";import{isAbsolute as k,join as i,resolve as m,sep as x}from"node:path";function f(n){return n!==void 0&&n!==""}function zt(n=process.env){return{noColor:f(n.NO_COLOR),dumbTerminal:n.TERM==="dumb",ci:f(n.CI)&&n.CI!=="false",debug:f(n.DEBUG),sandboxHome:f(n[`${t.envPrefix}HOME`])?n[`${t.envPrefix}HOME`]:void 0,noEnhancedKeys:f(n[`${t.envPrefix}NO_CSI_U`])}}function we(n=process.env){return zt(n).sandboxHome??i(P(),t.stateDir)}function q(n){return i(we(n),"agents")}function Dr(n){return i(we(n),"templates")}function G(n){return i(we(n),"store.db")}function ae(n){return i(we(n),"plugins")}function br(n,e){return i(ae(e),n)}function Eo(n){let e=i(we(n),"logs","server");return{out:i(e,"out.log"),err:i(e,"err.log")}}function pn(n,e){let o=i(we(e),"logs");return{out:i(o,`${n}.out.log`),err:i(o,`${n}.err.log`)}}function b(n){return i(n,".api-token")}function fn(n){try{let e=w(b(n),"utf8").trim();return e===""?void 0:e}catch{return}}function ri(n,e){R(n,{recursive:!0}),S(b(n),`${e}
|
|
3
|
+
`,{encoding:"utf8",mode:384})}function xs(n,e){let o=fn(n);if(o!==void 0)return o;let s=[];try{s=y(n).sort()}catch{}let g=s.map((r)=>Qn(i(n,r))[`${t.envPrefix}API_TOKEN`]).find((r)=>r!==void 0&&r!=="")??e();return ri(n,g),g}function Zt(n,e){let o=m(q(e)),s=m(n);return s===o||s.startsWith(o+x)}function Hs(n,e){if(Zt(n,e))return;return`note: ${m(n)} is outside the sandbox (${q(e)}) — this agent has no bare name, so every later command needs its path. Omit --dir to put it in the sandbox.`}function Ae(n){let e=q(n),o;try{o=y(e)}catch{return[]}let s=[];for(let r of o.sort()){let c=i(e,r),a=i(c,"agent.yaml");try{if(!p(c).isDirectory())continue}catch{continue}if(!l(a))continue;let h=0;try{h=p(a).mtimeMs}catch{}try{let u=F(a);s.push({ref:r,dir:c,manifestPath:a,mtimeMs:h,...u.id===void 0?{}:{id:u.id},...u.name===void 0?{}:{name:u.name},...u.modelId===void 0?{}:{modelId:u.modelId}})}catch(u){s.push({ref:r,dir:c,manifestPath:a,mtimeMs:h,problem:u instanceof Error?u.message:String(u)})}}let d=new Map;for(let r of s){if(r.id===void 0)continue;d.set(r.id,[...d.get(r.id)??[],r])}let g=s.map((r)=>{if(r.id===void 0||(d.get(r.id)?.length??0)<2)return r;return{...r,problem:`manifest id "${r.id}" is shared with another sandbox agent — their sessions share one history`}});return[...g.filter((r)=>r.problem===void 0),...g.filter((r)=>r.problem!==void 0)]}function ve(n,e,o=process.cwd()){let s=n.includes(x)||n.includes("/")||n.endsWith(".yaml")||n.endsWith(".yml"),d=k(n)?n:m(o,n);if(!s&&l(d)&&l(i(q(e),n)))process.stderr.write(`note: using ./${n} from the current directory; a sandbox agent "${n}" also exists — run it from elsewhere, or as ${i(q(e),n)}
|
|
4
|
+
`);if(s||l(d)){if(l(d)){if(p(d).isDirectory()){let a=i(d,"agent.yaml");if(l(a))return a;throw new A({code:"cli_agent_dir_without_manifest",message:`${n} is a directory with no agent.yaml inside.`,hint:"Point at the manifest itself, or at a directory that holds one. Sandbox agents are run by bare name, with no path separators."})}return d}throw new A({code:"cli_agent_path_missing",message:`${n} looks like a path, and nothing is there.`,hint:`Paths resolve against the current directory. For an agent in the sandbox, use its bare name — \`${t.slug} run <name>\` — which resolves under ${q(e)}.`})}let g=i(q(e),n,"agent.yaml");if(l(g))return g;let r=Ae(e).map((a)=>a.ref),c=j(n,r);throw new A({code:"cli_agent_unknown",message:`No agent named "${n}" in the sandbox${r.length===0?", which is empty":""}.`,hint:r.length===0?`Create one with \`${t.slug} init\`, or pass a path to an agent.yaml.`:`Known agents: ${r.join(", ")}.${c===void 0?"":` Did you mean ${c}?`} A path (./dir or file.yaml) is also accepted.`})}
|
|
5
|
+
export{zt,we,q,Dr,G,ae,br,Eo,pn,fn,ri,xs,Zt,Hs,Ae,ve};
|
|
6
|
+
|
|
7
|
+
//# debugId=BFDEA34526A327BA64756E2164756E21
|
|
8
|
+
//# sourceMappingURL=index-twn9bfm2.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"/**\n * The home sandbox: where agents live when nobody says otherwise.\n *\n * `~/<stateDir>/` (brand-derived, so a rename moves it) holds `agents/<ref>/` for init-created\n * agents and `store.db` for their sessions. One root, one store: the store schema is already\n * keyed by agent id, and a cwd-relative default meant the same agent got a different session\n * history in every directory you happened to be in.\n *\n * Discovery reads manifest *headers*, never `loadManifest`: loading expands env references and\n * checks that key variables are set, so a picker built on it would fail exactly when it is\n * needed most — on a machine where the key is not exported yet. A broken manifest becomes a\n * listed entry with a `problem`, never a broken listing.\n *\n * Tests override the root with `<ENVPREFIX>HOME` pointed at a tmpdir; nothing here touches the\n * real home directory when that is set.\n */\n\nimport { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport { isAbsolute, join, resolve, sep } from \"node:path\"\nimport { BRAND, HarnessError, nearest, readManifestHeader } from \"@dispach/core\"\nimport { readDotEnv } from \"#lib/ambient\"\nimport { readEnv } from \"#lib/env\"\n\nexport function sandboxRoot(\n env: Readonly<Record<string, string | undefined>> = process.env,\n): string {\n const override = readEnv(env).sandboxHome\n return override ?? join(homedir(), BRAND.stateDir)\n}\n\nexport function agentsDir(env?: Readonly<Record<string, string | undefined>>): string {\n return join(sandboxRoot(env), \"agents\")\n}\n\n/** Agent templates: one directory per template, written by the operator, read by `POST /v1/agents`. */\nexport function templatesDir(env?: Readonly<Record<string, string | undefined>>): string {\n return join(sandboxRoot(env), \"templates\")\n}\n\nexport function storePath(env?: Readonly<Record<string, string | undefined>>): string {\n return join(sandboxRoot(env), \"store.db\")\n}\n\n/**\n * Where installed plugins live — one directory per plugin, machine-level.\n *\n * The same shape and the same reasoning as the skills cache (`sources`) beside it: a plugin is code\n * the *person* trusts, fetched once and shared by every agent on the machine, and which agents\n * actually load it is decided by each manifest's own `plugins:` block. That is why there is no\n * registry file here — the manifest is the registry, and a second list of \"installed plugins\" would be\n * exactly the drift this project keeps paying for. `plugins list` reads the loader's own provenance\n * instead.\n *\n * Here rather than computed by a caller, because that is what makes `<ENVPREFIX>HOME` redirect it: a\n * caller that derived its own path wrote three agents into the author's real home directory once.\n */\nexport function pluginRoot(env?: Readonly<Record<string, string | undefined>>): string {\n return join(sandboxRoot(env), \"plugins\")\n}\n\nexport function pluginDir(\n name: string,\n env?: Readonly<Record<string, string | undefined>>,\n): string {\n return join(pluginRoot(env), name)\n}\n\n/**\n * Where a service writes its output, keyed by the agent's **manifest id**.\n *\n * Not by the directory name, which is what `run <ref>` takes — the same split as the store's\n * `agent_id` and the launchd label. Two directories with one manifest id therefore share these files,\n * which `listAgents` already warns about.\n *\n * Here rather than in `daemon.ts`, where it was private, because it is a fact about the sandbox layout\n * and `remove` needs it too. Moved rather than duplicated: a second copy of a path derivation is how\n * one command deletes a file another command is still writing to.\n */\n/**\n * Where the one server unit writes, in a **subdirectory** rather than beside the agent logs.\n *\n * `logs/<id>.err.log` is the per-agent shape, so a flat `logs/server.err.log` would collide with an\n * agent whose id happened to be `server` — and the collision would appear as a service and an agent\n * appending to one file, which is the kind of thing nobody diagnoses from a log.\n */\nexport function serverLogPaths(env?: Readonly<Record<string, string | undefined>>): {\n readonly out: string\n readonly err: string\n} {\n const dir = join(sandboxRoot(env), \"logs\", \"server\")\n return { out: join(dir, \"out.log\"), err: join(dir, \"err.log\") }\n}\n\nexport function logPaths(\n agentId: string,\n env?: Readonly<Record<string, string | undefined>>,\n): { readonly out: string; readonly err: string } {\n const dir = join(sandboxRoot(env), \"logs\")\n return { out: join(dir, `${agentId}.out.log`), err: join(dir, `${agentId}.err.log`) }\n}\n\n/**\n * The one token a sandbox's host serves with, beside the agents it serves (QA 0.2.0).\n *\n * One process hosts every agent in the sandbox, so it has one token — and it used to be the first\n * manifest's, while each `init` wrote a fresh random one into its own agent's `.env`. So `run`,\n * `stop` and `start` for any agent but the alphabetically first sent a token the host had never\n * heard of and got `401`. The token is the sandbox's now: `serve` and `hostToken` both read this\n * file for a manifest inside the sandbox, and `init` writes the same value into each new `.env`.\n *\n * Under the agents directory rather than the root because that is the path a test can redirect\n * (`QuestionDefaults.agentDirBase`), and a dotfile so `listAgents` never mistakes it for an agent.\n * An exported variable still wins over it everywhere — that is how a container is configured.\n */\nexport function hostTokenPath(agentsBase: string): string {\n return join(agentsBase, \".api-token\")\n}\n\nexport function readHostToken(agentsBase: string): string | undefined {\n try {\n const token = readFileSync(hostTokenPath(agentsBase), \"utf8\").trim()\n return token === \"\" ? undefined : token\n } catch {\n return undefined\n }\n}\n\nexport function writeHostToken(agentsBase: string, token: string): void {\n mkdirSync(agentsBase, { recursive: true })\n writeFileSync(hostTokenPath(agentsBase), `${token}\\n`, { encoding: \"utf8\", mode: 0o600 })\n}\n\n/**\n * The sandbox token, created on first need. With no file yet, the first agent that already has a\n * token donates it — that is the one a running host was started with, so adopting it keeps every\n * client that works today working. Only a sandbox with no token anywhere gets a new one.\n */\nexport function sharedHostToken(agentsBase: string, mint: () => string): string {\n const existing = readHostToken(agentsBase)\n if (existing !== undefined) return existing\n let entries: string[] = []\n try {\n entries = readdirSync(agentsBase).sort()\n } catch {\n // No sandbox yet: nothing to adopt.\n }\n const adopted = entries\n .map((ref) => readDotEnv(join(agentsBase, ref))[`${BRAND.envPrefix}API_TOKEN`])\n .find((token) => token !== undefined && token !== \"\")\n const token = adopted ?? mint()\n writeHostToken(agentsBase, token)\n return token\n}\n\n/**\n * Is this path inside the sandbox's agents directory?\n *\n * Both sides are resolved first, for the reason `root.ts` already records: an unresolved\n * `<base>/../../elsewhere` passes a prefix test while landing nowhere near the base. The `sep`\n * suffix is what stops `~/.brand/agents-backup` reading as inside `~/.brand/agents`.\n */\nexport function insideSandbox(\n targetDir: string,\n env?: Readonly<Record<string, string | undefined>>,\n): boolean {\n const base = resolve(agentsDir(env))\n const target = resolve(targetDir)\n return target === base || target.startsWith(base + sep)\n}\n\n/**\n * The one-line note an out-of-sandbox target earns, or `undefined` when it is inside.\n *\n * A note rather than a refusal: `init --dir ./examples/scout` is a legitimate thing to want, and a\n * command that refuses it would be one people work around with `mv`. What is *not* legitimate is\n * doing it silently — an agent outside the sandbox has no bare name, so every later `run`, `config`,\n * `daemon` and `schedules` call needs a path, and the reason for that is only obvious at the moment\n * the directory is chosen.\n *\n * Pure and separate from the write so the sentence can be asserted without a filesystem.\n */\nexport function outsideSandboxNote(\n targetDir: string,\n env?: Readonly<Record<string, string | undefined>>,\n): string | undefined {\n if (insideSandbox(targetDir, env)) return undefined\n return `note: ${resolve(targetDir)} is outside the sandbox (${agentsDir(env)}) — this agent has no bare name, so every later command needs its path. Omit --dir to put it in the sandbox.`\n}\n\nexport interface SandboxAgent {\n /** The directory name — what `run <ref>` takes. Filesystem-unique by construction. */\n readonly ref: string\n /** Absolute agent directory. */\n readonly dir: string\n /** Absolute path to its agent.yaml. */\n readonly manifestPath: string\n /** From the manifest header; may differ from `ref` for hand-copied directories. */\n readonly id?: string\n readonly name?: string\n /** Raw — may literally be an unexpanded `${MODEL_ID}` reference. */\n readonly modelId?: string\n /** Modification time of the manifest, for \"recently used\" ordering hints. */\n readonly mtimeMs: number\n /** Present when the manifest could not be read; the entry lists anyway, honestly. */\n readonly problem?: string\n}\n\n/**\n * Every agent directory in the sandbox, alphabetical by ref with broken entries last.\n *\n * Broken means the header could not be read — the entry still appears, carrying the problem,\n * because a listing that silently hides a corrupted agent turns \"why is my agent gone\" into a\n * filesystem investigation. Duplicate manifest ids are marked the same way: both run, but their\n * sessions share a store keyed by that id, which is worth a warning rather than a pretence.\n */\nexport function listAgents(\n env?: Readonly<Record<string, string | undefined>>,\n): readonly SandboxAgent[] {\n const dir = agentsDir(env)\n let entries: string[]\n try {\n entries = readdirSync(dir)\n } catch {\n // No sandbox yet is the normal first-run state, not an error.\n return []\n }\n\n const agents: SandboxAgent[] = []\n for (const ref of entries.sort()) {\n const agentDir = join(dir, ref)\n const manifestPath = join(agentDir, \"agent.yaml\")\n try {\n if (!statSync(agentDir).isDirectory()) continue\n } catch {\n continue\n }\n if (!existsSync(manifestPath)) continue\n\n let mtimeMs = 0\n try {\n mtimeMs = statSync(manifestPath).mtimeMs\n } catch {\n // Raced away between existsSync and statSync; list it with what we have.\n }\n\n try {\n const header = readManifestHeader(manifestPath)\n agents.push({\n ref,\n dir: agentDir,\n manifestPath,\n mtimeMs,\n ...(header.id === undefined ? {} : { id: header.id }),\n ...(header.name === undefined ? {} : { name: header.name }),\n ...(header.modelId === undefined ? {} : { modelId: header.modelId }),\n })\n } catch (error) {\n agents.push({\n ref,\n dir: agentDir,\n manifestPath,\n mtimeMs,\n problem: error instanceof Error ? error.message : String(error),\n })\n }\n }\n\n // Duplicate manifest ids share session history — say so rather than pretend it is fine.\n const byId = new Map<string, SandboxAgent[]>()\n for (const agent of agents) {\n if (agent.id === undefined) continue\n byId.set(agent.id, [...(byId.get(agent.id) ?? []), agent])\n }\n const marked = agents.map((agent) => {\n if (agent.id === undefined || (byId.get(agent.id)?.length ?? 0) < 2) return agent\n return {\n ...agent,\n problem: `manifest id \"${agent.id}\" is shared with another sandbox agent — their sessions share one history`,\n }\n })\n\n return [\n ...marked.filter((a) => a.problem === undefined),\n ...marked.filter((a) => a.problem !== undefined),\n ]\n}\n\n/**\n * Turn what the user typed into a manifest path.\n *\n * The filesystem wins: anything that looks like a path (a separator, a .yaml suffix, or a thing\n * that exists here) is a path, so `./milo` always forces the file even when a sandbox agent\n * `milo` exists — the same rule git applies to pathspec-versus-branch, with the same free escape\n * hatch. Only then is the ref tried as a sandbox agent name.\n */\nexport function resolveAgentRef(\n ref: string,\n env?: Readonly<Record<string, string | undefined>>,\n cwd: string = process.cwd(),\n): string {\n const looksLikePath =\n ref.includes(sep) || ref.includes(\"/\") || ref.endsWith(\".yaml\") || ref.endsWith(\".yml\")\n const asPath = isAbsolute(ref) ? ref : resolve(cwd, ref)\n\n // A bare name that happens to exist in the cwd wins as a path — but silently running the\n // wrong agent is worse than one stderr line. Only fires on genuine ambiguity.\n if (!looksLikePath && existsSync(asPath) && existsSync(join(agentsDir(env), ref))) {\n process.stderr.write(\n `note: using ./${ref} from the current directory; a sandbox agent \"${ref}\" also exists — run it from elsewhere, or as ${join(agentsDir(env), ref)}\\n`,\n )\n }\n\n if (looksLikePath || existsSync(asPath)) {\n if (existsSync(asPath)) {\n if (statSync(asPath).isDirectory()) {\n const inside = join(asPath, \"agent.yaml\")\n if (existsSync(inside)) return inside\n throw new HarnessError({\n code: \"cli_agent_dir_without_manifest\",\n message: `${ref} is a directory with no agent.yaml inside.`,\n hint: \"Point at the manifest itself, or at a directory that holds one. Sandbox agents are run by bare name, with no path separators.\",\n })\n }\n return asPath\n }\n throw new HarnessError({\n code: \"cli_agent_path_missing\",\n message: `${ref} looks like a path, and nothing is there.`,\n hint: `Paths resolve against the current directory. For an agent in the sandbox, use its bare name — \\`${BRAND.slug} run <name>\\` — which resolves under ${agentsDir(env)}.`,\n })\n }\n\n const sandboxManifest = join(agentsDir(env), ref, \"agent.yaml\")\n if (existsSync(sandboxManifest)) return sandboxManifest\n\n const known = listAgents(env).map((agent) => agent.ref)\n const suggestion = nearest(ref, known)\n throw new HarnessError({\n code: \"cli_agent_unknown\",\n message: `No agent named \"${ref}\" in the sandbox${known.length === 0 ? \", which is empty\" : \"\"}.`,\n hint:\n known.length === 0\n ? `Create one with \\`${BRAND.slug} init\\`, or pass a path to an agent.yaml.`\n : `Known agents: ${known.join(\", \")}.${suggestion === undefined ? \"\" : ` Did you mean ${suggestion}?`} A path (./dir or file.yaml) is also accepted.`,\n })\n}\n",
|
|
6
6
|
"/**\n * Every environment read the CLI makes.\n *\n * Centralised for the same reason termheat centralises it: an environment variable consulted deep\n * inside a component is untestable and invisible. Everything downstream takes an `EnvFacts` value,\n * so the interesting logic — `resolveMode` especially — is a pure function of its inputs.\n */\n\nimport { BRAND } from \"@dispach/core\"\nimport type { EnvFacts } from \"#lib/types\"\n\n/**\n * `NO_COLOR` is honoured when present and non-empty, per no-color.org. An exported-but-empty\n * variable is a container passing through something unset, not a stated preference.\n */\nfunction isSet(value: string | undefined): boolean {\n return value !== undefined && value !== \"\"\n}\n\nexport function readEnv(env: Readonly<Record<string, string | undefined>> = process.env): EnvFacts {\n return {\n noColor: isSet(env.NO_COLOR),\n dumbTerminal: env.TERM === \"dumb\",\n // `CI=false` is set by tooling that wants to say \"not CI\", and taking it literally would\n // strip interactivity from a terminal that has it.\n ci: isSet(env.CI) && env.CI !== \"false\",\n debug: isSet(env.DEBUG),\n // The sandbox root override, `<ENVPREFIX>HOME`. Brand-derived so a rename moves it.\n sandboxHome: isSet(env[`${BRAND.envPrefix}HOME`])\n ? env[`${BRAND.envPrefix}HOME`]\n : undefined,\n // Brand-derived like the sandbox root above, so a rename moves it.\n noEnhancedK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AS,CAAM,EAAE,YAAY,EAAG,CAChC,IAAM,EAAS,EAAK,EAAQ,YAAY,EACxC,GAAI,EAAW,CAAM,EAAG,OAAO,EAC/B,MAAM,IAAI,EAAa,CACnB,KAAM,iCACN,QAAS,GAAG,8CACZ,KAAM,+HACV,CAAC,EAEL,OAAO,EAEX,MAAM,IAAI,EAAa,CACnB,KAAM,yBACN,QAAS,GAAG,6CACZ,KAAM,mGAAmG,EAAM,4CAA4C,EAAU,CAAG,IAC5K,CAAC,EAGL,IAAM,EAAkB,EAAK,EAAU,CAAG,EAAG,EAAK,YAAY,EAC9D,GAAI,EAAW,CAAe,EAAG,OAAO,EAExC,IAAM,EAAQ,GAAW,CAAG,EAAE,IAAI,CAAC,IAAU,EAAM,GAAG,EAChD,EAAa,EAAQ,EAAK,CAAK,EACrC,MAAM,IAAI,EAAa,CACnB,KAAM,oBACN,QAAS,mBAAmB,oBAAsB,EAAM,SAAW,EAAI,mBAAqB,MAC5F,KACI,EAAM,SAAW,EACX,qBAAqB,EAAM,gDAC3B,iBAAiB,EAAM,KAAK,IAAI,KAAK,IAAe,OAAY,GAAK,iBAAiB,oDACpG,CAAC",
|
|
9
|
+
"debugId": "BFDEA34526A327BA64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{j,
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
5
|
-
`)}function I(e,t){return t<=0?"—":`${(e/t*100).toFixed(1)}%`}function
|
|
6
|
-
hint: ${o}`)}case"context.dropped":{let{messages:n,budget:r}=t.data;return m(e,"note",`context: ${n} older message(s) did not fit the ${r}-token budget and were left out`)}case"agent.warning":{let{code:n,message:r}=t.data;return m(e,"note",`${n}: ${r}`)}case"context.pressure":return{...e,pressure:t.data.fraction};case"compaction.stage":{let{stage:n,changed:r,before:o,after:d}=t.data;if(!r||n!=="collapse"&&n!=="reset")return e;return m(e,"note",`context: ${n==="reset"?"the conversation so far was replaced by a summary":"earlier turns were replaced by a summary"} (${o} → ${d} tokens)`)}case"phase.changed":{let{to:n,tools:r}=t.data;return{...m(e,"note",`phase: now in ${n} · ${r} tool${r===1?"":"s"} available`),phase:n}}case"context.reset":{let{warning:n}=t.data;return n===void 0?e:m(e,"note",`context: ${n}`)}default:return e}}function
|
|
7
|
-
`))}function
|
|
8
|
-
`);n.push(o({key:`${s.id}:title`,role:"banner",text:c,bold:!0}));for(let[y,g]of p.entries())for(let[h,f]of
|
|
9
|
-
export{
|
|
2
|
+
import{j,Mt,Ci}from"./index-qg9bn980.js";import{rt}from"./index-9914wh1d.js";import{ga}from"./index-dzy19wtf.js";import{In}from"./index-p6ya59m6.js";import{u}from"./index-3vzf253k.js";import{yi}from"./index-0444sh6x.js";import{Ca,fa}from"./index-8tmv33mr.js";var x=[{kind:"help",word:"/help",aliases:[],summary:"this list"},{kind:"status",word:"/status",aliases:[],summary:"model, channels, server, store — what this agent is and what is actually running"},{kind:"context",word:"/context",aliases:[],summary:"what is in the prompt right now, per slot, and what the percentage is a percentage of"},{kind:"restart",word:"/restart",aliases:[],summary:"restart the agent, for any configuration changes to take effect (memory files on disk are untouched)"},{kind:"tools",word:"/tools",aliases:[],summary:"what the model may call, and what the catalogue costs every turn"},{kind:"new",word:"/new",aliases:[],summary:"start a fresh conversation — this one stays in the store under its own key, and /sessions goes back to it"},{kind:"reset",word:"/reset",aliases:[],summary:"clear this conversation's history in place, keeping its key — memory files on disk are untouched"},{kind:"exit",word:"/exit",aliases:["/quit",":q"],summary:"leave — asks first, because the screen goes with it"}],Ki="⌥⏎ or a trailing \\ for a new line · ⏎ sends",Yi="/ commands · ⏎ sends · ⇧⏎ new line · ^C twice leaves",k=[{chord:"^C",summary:"cancel the turn in flight — at an idle prompt, press it twice to leave (the screen goes with it)"},{chord:"^D",summary:"leave when the line is empty; delete forward when it is not"},{chord:"^A / ^E",summary:"start of line / end of line"},{chord:"^B / ^F",summary:"back one character / forward one"},{chord:"^U / ^K",summary:"delete to the start of the line / to the end"},{chord:"^W",summary:"delete the word before the cursor"},{chord:"^P / ^N",summary:"previous / next of what you have already sent"},{chord:"↑ / ↓",summary:"a line up or down inside the message — the same history at its first and last line"},{chord:"⌥⏎ / ⇧⏎",summary:"a new line in the message — ⌥⏎ everywhere, ⇧⏎ where the terminal can tell it apart (`keys` says); a trailing \\ does the same; ⏎ sends it"},{chord:"⌥← / ⌥→",summary:"back one word / forward one — ^← / ^→ do the same"},{chord:"⌥⌫ / ⌥d",summary:"delete the word before the cursor / after it"},{chord:"Home / End",summary:"start of line / end of line, the same as ^A / ^E"},{chord:"cmd← / cmd→",summary:"start of line / end of line, where the terminal reports cmd (else ^A / ^E)"},{chord:"cmd↑ / cmd↓",summary:"the start / end of the whole message, however many lines it has"},{chord:"cmd⌫ / cmd⌦",summary:"delete to the start of the line / to the end"},{chord:"cmdz / cmd⇧z",summary:"undo / redo, the same as ^Z / ^Y"},{chord:"⇧ + any motion",summary:"select as the cursor moves — ⇧← a character, ⇧⌥← a word, ⇧cmd← to the line start, ⇧cmd↑ to the top; typing or ⌫ replaces what is selected"},{chord:"cmda",summary:"select the whole message"},{chord:"^R",summary:"search what you have already sent — ↑↓ to pick, ⏎ to use it, esc to cancel"},{chord:"^Z / ^Y",summary:"undo / redo the last edit — suspend is not available inside a session"},{chord:"PgUp / PgDn",summary:"back and forward through the conversation a screen at a time"},{chord:"⌥↑ / ⌥↓",summary:"the same, one row at a time"},{chord:"⌥PgUp / ⌥PgDn",summary:"the start of the conversation / back to the newest reply"},{chord:"^O / ⌥r",summary:"show the model's reasoning whole — folded to a few rows so the reply stays findable; ^O works on every terminal, ⌥r needs one that reports it"},{chord:"drag",summary:"select text — in the conversation it goes to the clipboard when you let go, so ⌘V works; in the input box it does not, because you are usually about to type over it (⌘C copies, ⌘X cuts). Double-click a word, triple-click a line, esc clears"},{chord:"esc",summary:"return to the newest reply when you have scrolled away"}],H=k.flatMap((e)=>[...e.chord.matchAll(/\^([A-Za-z])/g)].map((t)=>(t[1]??"").toLowerCase())),z=k.flatMap((e)=>[...e.chord.matchAll(/⌥([a-z])(?![A-Za-z])/g)].map((t)=>t[1]??""));var E=/^\/[A-Za-z][\w-]*$/,O=/^(\/[A-Za-z][\w-]*)\s+(.*)$/,b=new Map(x.flatMap((e)=>[e.word,...e.aliases].map((t)=>[t.toLowerCase(),e.kind])));function Hn(e,t=[]){let n=e.trim(),r=b.get(n.toLowerCase());if(r!==void 0)return{kind:r};let o=new Set(t);if(o.has(n.slice(1).toLowerCase())&&E.test(n))return{kind:"command",name:n.slice(1).toLowerCase(),rest:""};let d=O.exec(n);if(d!==null){let i=(d[1]??"").toLowerCase(),a=d[2]??"",l=b.get(i);if(l!==void 0)return{kind:l,rest:a};if(o.has(i.slice(1)))return{kind:"command",name:i.slice(1),rest:a};return}if(!E.test(n))return;let s=j(n.toLowerCase(),[...b.keys(),...t.map((i)=>`/${i}`)]);return{kind:"unknown",word:n,...s===void 0?{}:{nearest:s}}}var C=20;function _(e){return` ${[e.word,...e.aliases].join(" / ").padEnd(C)}${e.summary}`}function P(e){return` ${e.chord.padEnd(C)}${e.summary}`}function Kn(){return["commands:",...x.map(_),"","keys:",...k.map(P)].join(`
|
|
3
|
+
`)}function nn(e){let t=e.nearest===void 0?"":` Did you mean ${e.nearest}?`;return`${e.word} is not a command.${t} Type /help for the list — or add a space if you meant to say it to the model.`}function Xo(e){let t=e.describe();return{dialect:t.dialect,catalogueTokens:t.catalogueTokens,tools:e.tools.specs().map((n)=>({slug:n.slug,mutating:n.mutating,trust:n.trust??"trusted",...n.trustReason===void 0?{}:{trustReason:n.trustReason},summary:n.summary}))}}function DA(e){if(e.tools.length===0)return`no tools — this agent pinned none, so the model can only reply. Add them under tools.local or tools.pinned. (call format ${e.dialect})`;let t=e.tools.reduce((r,o)=>Math.max(r,o.slug.length),0),n=e.tools.flatMap((r)=>[` ${r.slug.padEnd(t)} ${r.mutating?"write":"read "} ${r.trust==="untrusted"?"untrusted":"trusted "} ${r.summary}`,...r.trustReason===void 0?[]:[`${" ".repeat(2+t+2+5+2+9+2)}trusted: ${r.trustReason}`]]);return[`${e.tools.length} tool${e.tools.length===1?"":"s"} · call format ${e.dialect} · catalogue ${e.catalogueTokens} tokens, on every turn`,...n].join(`
|
|
4
|
+
`)}function ji(e){let t=Math.max(1,e.window-e.wireTokens-e.reserveOutput),n=(e.total/t*100).toFixed(1),r=e.calibration.samples===0?"estimated — the estimator runs low on tool-heavy prompts":`corrected ×${e.calibration.ratio.toFixed(2)} from ${e.calibration.samples} reported ${e.calibration.samples===1?"figure":"figures"}`,o=e.slots.reduce((a,l)=>Math.max(a,l.label.length),0),d=e.slots.map((a)=>` ${String(a.slot).padStart(2)} ${a.label.padEnd(o)} ${String(a.tokens).padStart(6)}${a.pinned?" pinned":""}`),s=e.history.reduce((a,l)=>Math.max(a,l.label.length),0),i=e.history.length===0?[]:e.history.map((a)=>` ${a.label.padEnd(s)} ${String(a.tokens).padStart(6)} ${I(a.tokens,e.total).padStart(6)} ${String(a.messages).padStart(3)} msg`);return[u([{label:"window",value:`${e.window} (${e.windowSource})`},{label:"budget",value:`${t} = window ${e.window} − wire ${e.wireTokens} − reserveOutput ${e.reserveOutput}`},{label:"prompt",value:`${e.total} tokens · ${n}% of budget`},{label:"counted",value:r},{label:"compaction",value:e.lastCompaction??"none this session"},{label:"cache",value:e.cache===void 0?"not reported by this endpoint":`${e.cache.cached} of ${e.cache.prompt} prompt tokens (${I(e.cache.cached,e.cache.prompt)}) over ${e.cache.turns} turn${e.cache.turns===1?"":"s"} · ${e.cache.source}`}]),""," slots",...d,...i.length===0?[]:[""," history, by kind — share of the whole prompt",...i]].join(`
|
|
5
|
+
`)}function I(e,t){return t<=0?"—":`${(e/t*100).toFixed(1)}%`}function er(){let e=x.map((r)=>({word:r.word,summary:r.summary,kind:"session"})),t=new Set(e.map((r)=>r.word)),n=rt.filter((r)=>r.inSession!=="hidden").filter((r)=>!t.has(`/${r.name}`)).map((r)=>({word:`/${r.name}`,summary:r.summary,kind:r.inSession==="view"?"view":"output",spec:r}));return[...e,...n]}function Ji(e,t=er()){if(!/^\/[A-Za-z-]*$/.test(e))return;let n=e.slice(1).toLowerCase(),r=t.filter((o)=>o.word.slice(1).toLowerCase().startsWith(n));return{query:n,matches:r}}function Fr(e,t){if(e.matches.length===0)return;return e.matches[Math.max(0,Math.min(t,e.matches.length-1))]}function Yn(){return er().filter((e)=>e.kind!=="session").map((e)=>e.word.slice(1))}var M={items:[],live:void 0,status:"idle",nextId:0,turnFrom:void 0};function m(e,t,n,r={}){let o={id:`t${e.nextId}`,role:t,text:n,...r.stats===void 0?{}:{stats:r.stats},...r.callId===void 0?{}:{callId:r.callId},...r.pending===void 0?{}:{pending:r.pending}};return{...e,items:[...e.items,o],nextId:e.nextId+1}}function T(e){let t=e.live;if(t===void 0)return e;let n=e;if(t.reasoning!=="")n=m(n,"reasoning",t.reasoning);if(t.text!=="")n=m(n,"assistant",t.text);return{...n,live:void 0}}function qi(e,t){switch(t.kind){case"user":return m(e,"user",t.text);case"note":return m(e,"note",t.text);case"cancelling":return e.status==="idle"?e:{...e,status:"cancelling"};case"delta":return R(e,t.of,t.text);case"event":return K(e,t.event);case"trim":return L(e)}}function L(e){let t=e.items.length-fa;return t<=0?e:{...e,items:e.items.slice(t)}}function R(e,t,n){if(n==="")return e;let r=e.live??{text:"",reasoning:"",last:void 0};return{...e,live:{text:t==="text"?r.text+n:r.text,reasoning:t==="reasoning"?r.reasoning+n:r.reasoning,last:t},status:e.status==="cancelling"?"cancelling":"streaming"}}function w(e,t,n){let r=e.items.findIndex(t);if(r===-1)return e;let o=[...e.items],d=o[r],s=n(d.subagent,d);if(s===void 0)return e;return o[r]={...d,subagent:s},{...e,items:o}}function D(e,t){let n=(r)=>r.subagent?.sessionKey===t.sessionKey;if("slug"in t.data&&t.data.slug===Ci)return e;switch(t.type){case"tool.call":return w(e,n,(r)=>r===void 0?void 0:{...r,lines:[...r.lines,{callId:t.data.callId,text:`${t.data.slug} …`}]});case"tool.result":{let{slug:r,callId:o,ok:d,latencyMs:s}=t.data,i=`${r} — ${d?"ok":"failed"} · ${s} ms`;return w(e,n,(a)=>a===void 0?void 0:{...a,lines:a.lines.some((l)=>l.callId===o)?a.lines.map((l)=>l.callId===o?{callId:o,text:i}:l):[...a.lines,{callId:o,text:i}]})}case"tool.gated":return w(e,n,(r)=>r===void 0?void 0:{...r,lines:[...r.lines,{text:`${t.data.slug} — blocked: ${t.data.reason}`}]});default:return e}}function K(e,t){if(t.parentTurnId!==void 0)return D(e,t);switch(t.type){case"handoff.start":{let{kind:n,name:r,callId:o,sessionKey:d}=t.data;if(n!=="self"||o===void 0)return e;return w(e,(s)=>s.callId===o,()=>({name:r??"subagent",sessionKey:d,lines:[]}))}case"handoff.result":{let{sessionKey:n,steps:r,tokens:o,outcome:d}=t.data,s=`${r} step${r===1?"":"s"} · ${yi(o.prompt+o.output)} tokens · ${d==="ok"?"ok":d.replace("_"," ")}`;return w(e,(i)=>i.subagent?.sessionKey===n,(i)=>i===void 0?void 0:{...i,summary:s})}case"turn.start":return{...e,live:{text:"",reasoning:"",last:void 0},status:"thinking",turnFrom:e.items.length};case"model.result":return T(e);case"model.chunk":return R(e,t.data.kind,t.data.delta);case"tool.call":return{...m(T(e),"tool",`${t.data.slug}${t.data.mutating?" (changes state)":""}`,{callId:t.data.callId,pending:!0}),status:e.status==="cancelling"?"cancelling":"working"};case"tool.result":{let{slug:n,callId:r,ok:o,latencyMs:d,truncated:s}=t.data,i=`${n} — ${o?"ok":"failed"} · ${d} ms${s?" · observation trimmed":""}`,a=e.items.findIndex((p)=>p.callId===r&&p.pending===!0);if(a===-1)return m(e,o?"tool":"error",i);let l=[...e.items],c=l[a];return l[a]={id:c.id,role:o?"tool":"error",text:i,callId:r,...c.subagent===void 0?{}:{subagent:c.subagent}},{...e,items:l}}case"tool.gated":return m(e,"note",`${t.data.slug} — blocked: ${t.data.reason}`);case"tool.repair":return m(e,"note",t.data.slugs.length===0?`reply stopped short (${t.data.errors.join("; ")}), asking the model to finish`:`${t.data.slugs.join(", ")} — could not be used, asking the model again`);case"model.retry":{let{status:n,attempt:r,delayMs:o}=t.data;return m(e,"note",`retrying after HTTP ${n} — attempt ${r}, waiting ${o} ms`)}case"turn.end":{let{reason:n,steps:r,tokens:o,durationMs:d}=t.data,s={promptTokens:o.prompt,outputTokens:o.output,durationMs:d,steps:r,reason:n},i=T(e),a=e.turnFrom??0,l=-1;for(let h=i.items.length-1;h>=a;h-=1)if(i.items[h]?.role==="assistant"){l=h;break}let c=Mt(n,{steps:r,durationMs:d});if(l===-1)return{...m(i,"note",c??(n==="final"?"the model returned no text":""),{stats:s}),live:void 0,status:"idle",turnFrom:void 0};let p=[...i.items],y=p[l];p[l]={...y,stats:s};let g={...i,items:p,live:void 0,status:"idle",turnFrom:void 0};return c===void 0?g:m(g,"note",c)}case"error":{let{code:n,message:r,hint:o}=t.data;return m(e,"error",`${n}: ${r}
|
|
6
|
+
hint: ${o}`)}case"context.dropped":{let{messages:n,budget:r}=t.data;return m(e,"note",`context: ${n} older message(s) did not fit the ${r}-token budget and were left out`)}case"agent.warning":{let{code:n,message:r}=t.data;return m(e,"note",`${n}: ${r}`)}case"context.pressure":return{...e,pressure:t.data.fraction};case"compaction.stage":{let{stage:n,changed:r,before:o,after:d}=t.data;if(!r||n!=="collapse"&&n!=="reset")return e;return m(e,"note",`context: ${n==="reset"?"the conversation so far was replaced by a summary":"earlier turns were replaced by a summary"} (${o} → ${d} tokens)`)}case"phase.changed":{let{to:n,tools:r}=t.data;return{...m(e,"note",`phase: now in ${n} · ${r} tool${r===1?"":"s"} available`),phase:n}}case"context.reset":{let{warning:n}=t.data;return n===void 0?e:m(e,"note",`context: ${n}`)}default:return e}}function Ur(e){return`${e.promptTokens} prompt · ${e.outputTokens} output · ${e.durationMs} ms`}function Vi(e){if(e.length===0)return M;return m(M,"banner",e.join(`
|
|
7
|
+
`))}function Wi(e,t){let n=e;for(let r of t){if(r.text.trim()==="")continue;n=m(n,r.role,r.text)}return n}function zi(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.stats;if(n!==void 0)return n}return}function Zi(e,t){let n=[],r=e.filter((d)=>d.role!=="reasoning"||t.showReasoning),o=(d)=>({...d,lead:0,continuation:!1});for(let[d,s]of r.entries()){if(d>0)n.push(o({key:`${s.id}:gap`,role:s.role,text:""}));if(s.role==="banner"){let[c="",...p]=s.text.split(`
|
|
8
|
+
`);n.push(o({key:`${s.id}:title`,role:"banner",text:c,bold:!0}));for(let[y,g]of p.entries())for(let[h,f]of In(g,t.columns).entries())n.push({key:`${s.id}:note-${y}-${h}`,role:"banner",text:f,dim:!0,lead:0,continuation:h>0});continue}let i=ga[s.role],a=" ".repeat([...i].length),l=In(s.text,Math.max(1,t.columns-[...i].length));if(s.role==="reasoning"){let c=t.expandReasoning===!0?l.length:Math.min(l.length,Ca),p=l.length-c;n.push(o({key:`${s.id}:label`,role:"reasoning",dim:!0,text:p>0?`· reasoning · ${l.length} rows · ⌥r expands`:`· reasoning · ${l.length} row${l.length===1?"":"s"}`}));for(let[y,g]of l.slice(0,c).entries())n.push({key:`${s.id}:${y}`,role:"reasoning",text:`${a}${g}`,lead:a.length,continuation:y>0});if(p>0)n.push(o({key:`${s.id}:folded`,role:"reasoning",dim:!0,text:`${a}… ${p} more row${p===1?"":"s"}`}));continue}for(let[c,p]of l.entries())n.push({key:`${s.id}:${c}`,role:s.role,text:`${c===0?i:a}${p}`,lead:[...i].length,continuation:c>0});if(s.subagent!==void 0){let c=s.subagent,p=t.expandReasoning===!0,y=c.summary??"running",g=!p&&c.lines.length>0?` · ⌥r shows ${c.lines.length} call${c.lines.length===1?"":"s"}`:"";for(let[h,f]of In(`↳ subagent ${c.name} · ${y}${g}`,Math.max(1,t.columns-a.length)).entries())n.push(o({key:`${s.id}:sub-${h}`,role:s.role,text:`${a}${f}`,dim:!0}));if(p){let h=`${a} `;for(let[f,A]of c.lines.entries())for(let[S,N]of In(A.text,Math.max(1,t.columns-h.length)).entries())n.push({key:`${s.id}:sub-${f}-${S}`,role:s.role,text:`${h}${N}`,dim:!0,lead:h.length,continuation:S>0})}}if(s.stats!==void 0&&!t.quiet)n.push(o({key:`${s.id}:stats`,role:s.role,text:` ${Ur(s.stats)}`,dim:!0}))}return n}
|
|
9
|
+
export{Ki,Yi,Hn,Kn,nn,Xo,DA,ji,er,Ji,Fr,Yn,qi,Ur,Vi,Wi,zi,Zi};
|
|
10
10
|
|
|
11
|
-
//# debugId=
|
|
12
|
-
//# sourceMappingURL=index-
|
|
11
|
+
//# debugId=5F962D660F0E2DE864756E2164756E21
|
|
12
|
+
//# sourceMappingURL=index-wc4entme.js.map
|