dispach 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -34
- package/dist/APEv2Parser-etzjd528.js +5 -0
- package/dist/{FlacParser-bf8y3e0w.js.map → APEv2Parser-etzjd528.js.map} +1 -1
- package/dist/{AiffParser-tbx3xkmk.js → AiffParser-y21k3fak.js} +3 -3
- package/dist/{AiffParser-tbx3xkmk.js.map → AiffParser-y21k3fak.js.map} +1 -1
- package/dist/App-4w3qkcs4.js +11 -0
- package/dist/{App-hjn867nc.js.map → App-4w3qkcs4.js.map} +1 -1
- package/dist/{AsfParser-d784ak3y.js → AsfParser-wd98k2h4.js} +3 -3
- package/dist/{AsfParser-d784ak3y.js.map → AsfParser-wd98k2h4.js.map} +1 -1
- package/dist/{ConfigEditor-g7eb2wsm.js → ConfigEditor-vk7vxaa6.js} +3 -3
- package/dist/{ConfigEditor-g7eb2wsm.js.map → ConfigEditor-vk7vxaa6.js.map} +1 -1
- package/dist/{DsdiffParser-vxnfx80c.js → DsdiffParser-cbfaj500.js} +3 -3
- package/dist/{DsdiffParser-vxnfx80c.js.map → DsdiffParser-cbfaj500.js.map} +1 -1
- package/dist/{DsfParser-0xsh0zzk.js → DsfParser-tybrja4x.js} +3 -3
- package/dist/{DsfParser-0xsh0zzk.js.map → DsfParser-tybrja4x.js.map} +1 -1
- package/dist/FlacParser-7t7da7qy.js +5 -0
- package/dist/{APEv2Parser-9wqew3zv.js.map → FlacParser-7t7da7qy.js.map} +1 -1
- package/dist/{KeyProbe-w8c37s9q.js → KeyProbe-5anphmb7.js} +3 -3
- package/dist/{KeyProbe-w8c37s9q.js.map → KeyProbe-5anphmb7.js.map} +1 -1
- package/dist/{MP4Parser-tq7r7wd4.js → MP4Parser-gc94h1n9.js} +3 -3
- package/dist/{MP4Parser-tq7r7wd4.js.map → MP4Parser-gc94h1n9.js.map} +1 -1
- package/dist/{MatroskaParser-a79gsmzb.js → MatroskaParser-cy2k4fac.js} +3 -3
- package/dist/{MatroskaParser-a79gsmzb.js.map → MatroskaParser-cy2k4fac.js.map} +1 -1
- package/dist/{MpegParser-zs61b3wq.js → MpegParser-c460fwf0.js} +3 -3
- package/dist/{MpegParser-zs61b3wq.js.map → MpegParser-c460fwf0.js.map} +1 -1
- package/dist/{MusepackParser-bp8dm6nz.js → MusepackParser-8mq2eabg.js} +3 -3
- package/dist/{MusepackParser-bp8dm6nz.js.map → MusepackParser-8mq2eabg.js.map} +1 -1
- package/dist/{OggParser-7pxr1sn9.js → OggParser-7dnc6apg.js} +3 -3
- package/dist/{OggParser-7pxr1sn9.js.map → OggParser-7dnc6apg.js.map} +1 -1
- package/dist/Picker-j7txnm7w.js +5 -0
- package/dist/{Picker-b09hr4tk.js.map → Picker-j7txnm7w.js.map} +1 -1
- package/dist/SessionPicker-hpv2ncsb.js +5 -0
- package/dist/{SessionPicker-wtfxwdxg.js.map → SessionPicker-hpv2ncsb.js.map} +3 -3
- package/dist/SkillBrowser-qc542n71.js +5 -0
- package/dist/{SkillBrowser-p9ht63c7.js.map → SkillBrowser-qc542n71.js.map} +1 -1
- package/dist/{WavPackParser-gpf3r92t.js → WavPackParser-kt7cds9c.js} +3 -3
- package/dist/{WavPackParser-gpf3r92t.js.map → WavPackParser-kt7cds9c.js.map} +1 -1
- package/dist/{WaveParser-3kcak550.js → WaveParser-g47ja0vy.js} +3 -3
- package/dist/{WaveParser-3kcak550.js.map → WaveParser-g47ja0vy.js.map} +1 -1
- package/dist/WizardApp-q4p979d1.js +5 -0
- package/dist/{WizardApp-494018sk.js.map → WizardApp-q4p979d1.js.map} +3 -3
- package/dist/{channels-yhdvxxrb.js → channels-4t89qpdt.js} +14 -14
- package/dist/{channels-yhdvxxrb.js.map → channels-4t89qpdt.js.map} +1 -1
- package/dist/client.d.ts +242 -1
- package/dist/client.js +11 -11
- package/dist/client.js.map +5 -5
- package/dist/{config-g0ybmm4t.js → config-35r6n1gh.js} +17 -17
- package/dist/{config-g0ybmm4t.js.map → config-35r6n1gh.js.map} +1 -1
- package/dist/{credential-pkme1sfe.js → credential-dpdgg4j6.js} +5 -5
- package/dist/{credential-pkme1sfe.js.map → credential-dpdgg4j6.js.map} +1 -1
- package/dist/{index-q8b1fc3k.js → index-0444sh6x.js} +4 -4
- package/dist/{index-q8b1fc3k.js.map → index-0444sh6x.js.map} +1 -1
- package/dist/{index-ec101x93.js → index-095hrkyr.js} +6 -6
- package/dist/{index-ec101x93.js.map → index-095hrkyr.js.map} +1 -1
- package/dist/index-1x8mzvz7.js +6 -0
- package/dist/{index-f056wkb4.js.map → index-1x8mzvz7.js.map} +1 -1
- package/dist/index-2bsardvh.js +5 -0
- package/dist/{index-9dmgk6d3.js.map → index-2bsardvh.js.map} +2 -2
- package/dist/{index-thmq816c.js → index-2zjh5zd5.js} +4 -4
- package/dist/{index-thmq816c.js.map → index-2zjh5zd5.js.map} +1 -1
- package/dist/{index-t6xnecdx.js → index-323jvr1g.js} +4 -4
- package/dist/{index-t6xnecdx.js.map → index-323jvr1g.js.map} +1 -1
- package/dist/{index-mn34kj95.js → index-3826kf9t.js} +5 -5
- package/dist/{index-mn34kj95.js.map → index-3826kf9t.js.map} +1 -1
- package/dist/index-38gs9anh.js +9 -0
- package/dist/{index-akv6e7ge.js.map → index-38gs9anh.js.map} +1 -1
- package/dist/index-3c5jt6by.js +5 -0
- package/dist/{index-3b3h8kyh.js.map → index-3c5jt6by.js.map} +2 -2
- package/dist/{index-a6mtqkth.js → index-3vzf253k.js} +7 -7
- package/dist/{index-a6mtqkth.js.map → index-3vzf253k.js.map} +1 -1
- package/dist/{index-5m9wydxb.js → index-42e29zs4.js} +4 -4
- package/dist/{index-5m9wydxb.js.map → index-42e29zs4.js.map} +1 -1
- package/dist/{index-v7mz396x.js → index-4fj1k64j.js} +4 -4
- package/dist/{index-v7mz396x.js.map → index-4fj1k64j.js.map} +1 -1
- package/dist/{index-s2tzq27a.js → index-51x0n5z0.js} +5 -5
- package/dist/{index-s2tzq27a.js.map → index-51x0n5z0.js.map} +1 -1
- package/dist/index-664xcamy.js +110 -0
- package/dist/index-664xcamy.js.map +13 -0
- package/dist/index-7mn8ack9.js +6 -0
- package/dist/{index-xa9crtzq.js.map → index-7mn8ack9.js.map} +2 -2
- package/dist/index-8edck2pr.js +6 -0
- package/dist/{index-7gsbzvnc.js.map → index-8edck2pr.js.map} +1 -1
- package/dist/{index-9qv87rq7.js → index-8h6kewy1.js} +7 -7
- package/dist/{index-9qv87rq7.js.map → index-8h6kewy1.js.map} +1 -1
- package/dist/index-8tmv33mr.js +6 -0
- package/dist/{index-vw2hf4d8.js.map → index-8tmv33mr.js.map} +1 -1
- package/dist/index-9914wh1d.js +6 -0
- package/dist/index-9914wh1d.js.map +10 -0
- package/dist/{index-ye2yb3xf.js → index-a2eh8dnk.js} +6 -6
- package/dist/{index-ye2yb3xf.js.map → index-a2eh8dnk.js.map} +1 -1
- package/dist/{index-81vj1bxe.js → index-bqdkm3de.js} +4 -4
- package/dist/{index-81vj1bxe.js.map → index-bqdkm3de.js.map} +1 -1
- package/dist/{index-j20k6k0m.js → index-dzy19wtf.js} +4 -4
- package/dist/{index-j20k6k0m.js.map → index-dzy19wtf.js.map} +1 -1
- package/dist/{index-gqaa06yh.js → index-eqqd4k4f.js} +9 -9
- package/dist/{index-gqaa06yh.js.map → index-eqqd4k4f.js.map} +1 -1
- package/dist/{index-633eqxry.js → index-ew997be5.js} +7 -7
- package/dist/{index-633eqxry.js.map → index-ew997be5.js.map} +1 -1
- package/dist/{index-y34s71qe.js → index-fa9wvpyw.js} +3 -3
- package/dist/{index-y34s71qe.js.map → index-fa9wvpyw.js.map} +1 -1
- package/dist/{index-myg5enf5.js → index-fbsrhcga.js} +4 -4
- package/dist/{index-myg5enf5.js.map → index-fbsrhcga.js.map} +1 -1
- package/dist/{index-x9z2xnct.js → index-fcsg95m5.js} +5 -5
- package/dist/{index-x9z2xnct.js.map → index-fcsg95m5.js.map} +1 -1
- package/dist/{index-zjphh8ch.js → index-gbkma7ds.js} +4 -4
- package/dist/{index-zjphh8ch.js.map → index-gbkma7ds.js.map} +1 -1
- package/dist/{index-ac2wzspd.js → index-gq1npngp.js} +4 -4
- package/dist/{index-ac2wzspd.js.map → index-gq1npngp.js.map} +1 -1
- package/dist/{index-6r9h7ftn.js → index-haypwvzd.js} +85 -85
- package/dist/index-haypwvzd.js.map +21 -0
- package/dist/{index-qh82wtpa.js → index-jc4kmfwa.js} +4 -4
- package/dist/{index-qh82wtpa.js.map → index-jc4kmfwa.js.map} +1 -1
- package/dist/index-kjqksgch.js +429 -0
- package/dist/index-kjqksgch.js.map +12 -0
- package/dist/{index-trx9xb59.js → index-m6fqx0ch.js} +7 -7
- package/dist/{index-trx9xb59.js.map → index-m6fqx0ch.js.map} +1 -1
- package/dist/{index-twcgf73h.js → index-ma6p7bt4.js} +4 -4
- package/dist/{index-twcgf73h.js.map → index-ma6p7bt4.js.map} +1 -1
- package/dist/index-nvc24414.js +6 -0
- package/dist/{index-1f1erzfx.js.map → index-nvc24414.js.map} +1 -1
- package/dist/index-nxhqf597.js +6 -0
- package/dist/{index-w97gprre.js.map → index-nxhqf597.js.map} +1 -1
- package/dist/{index-psk6q25h.js → index-p1zy871m.js} +4 -4
- package/dist/{index-psk6q25h.js.map → index-p1zy871m.js.map} +1 -1
- package/dist/{index-jh2az41t.js → index-p6ya59m6.js} +5 -5
- package/dist/{index-jh2az41t.js.map → index-p6ya59m6.js.map} +1 -1
- package/dist/{index-6c4p19m1.js → index-pszmnhgq.js} +2 -2
- package/dist/index-qg9bn980.js +1213 -0
- package/dist/{index-26ejkp8q.js.map → index-qg9bn980.js.map} +26 -23
- package/dist/index-qgsdgbk8.js +5 -0
- package/dist/{index-wk6andxq.js.map → index-qgsdgbk8.js.map} +2 -2
- package/dist/index-r4ax3x4d.js +74 -0
- package/dist/index-r4ax3x4d.js.map +13 -0
- package/dist/{index-zg89tq04.js → index-snz49ndn.js} +4 -4
- package/dist/{index-zg89tq04.js.map → index-snz49ndn.js.map} +1 -1
- package/dist/index-twn9bfm2.js +8 -0
- package/dist/{index-0mz7wpbw.js.map → index-twn9bfm2.js.map} +2 -2
- package/dist/{index-3fgq1acj.js → index-wc4entme.js} +10 -10
- package/dist/{index-3fgq1acj.js.map → index-wc4entme.js.map} +1 -1
- package/dist/{index-ad5c9t83.js → index-ynsvkqgb.js} +4 -4
- package/dist/{index-ad5c9t83.js.map → index-ynsvkqgb.js.map} +1 -1
- package/dist/index-ytxbw8py.js +63 -0
- package/dist/{index-0pddq849.js.map → index-ytxbw8py.js.map} +2 -2
- package/dist/index-yw3fby4n.js +6 -0
- package/dist/{index-4emtktc0.js.map → index-yw3fby4n.js.map} +2 -2
- package/dist/{index-307qmvb0.js → index-z157at3s.js} +25 -25
- package/dist/{index-307qmvb0.js.map → index-z157at3s.js.map} +1 -1
- package/dist/{index-pdsey1ab.js → index-zce9gy22.js} +62 -62
- package/dist/{index-pdsey1ab.js.map → index-zce9gy22.js.map} +1 -1
- package/dist/{index-skkddg44.js → index-zw6wyas6.js} +4 -4
- package/dist/{index-skkddg44.js.map → index-zw6wyas6.js.map} +1 -1
- package/dist/index.js +307 -291
- package/dist/index.js.map +15 -12
- package/dist/init.d.ts.map +1 -1
- package/dist/lib/agent-template.d.ts +5 -0
- package/dist/lib/agent-template.d.ts.map +1 -1
- package/dist/lib/commands.d.ts.map +1 -1
- package/dist/lib/init-flow.d.ts +7 -30
- package/dist/lib/init-flow.d.ts.map +1 -1
- package/dist/lib/owner.d.ts +49 -0
- package/dist/lib/owner.d.ts.map +1 -0
- package/dist/lib/presets.d.ts +44 -0
- package/dist/lib/presets.d.ts.map +1 -0
- package/dist/lib/provision.d.ts +8 -1
- package/dist/lib/provision.d.ts.map +1 -1
- package/dist/lib/relay-client.d.ts +17 -0
- package/dist/lib/relay-client.d.ts.map +1 -0
- package/dist/lib/schema.d.ts +2 -0
- package/dist/lib/schema.d.ts.map +1 -1
- package/dist/lib/sessions-view.d.ts +2 -0
- package/dist/lib/sessions-view.d.ts.map +1 -1
- package/dist/lib/source.d.ts +17 -0
- package/dist/lib/source.d.ts.map +1 -1
- package/dist/lib/wizard.d.ts.map +1 -1
- package/dist/owner.d.ts +16 -0
- package/dist/owner.d.ts.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/serve.d.ts.map +1 -1
- package/dist/{web-f6869dy2.js → web-zph4h3p9.js} +7 -7
- package/dist/{web-f6869dy2.js.map → web-zph4h3p9.js.map} +1 -1
- package/dist/wire.d.ts +31 -0
- package/dist/wire.js +2 -2
- package/dist/wire.js.map +4 -4
- package/dist/wrapper-f662ny3r.js +5 -0
- package/dist/{wrapper-52c0vacs.js.map → wrapper-f662ny3r.js.map} +1 -1
- package/package.json +4 -1
- package/dist/APEv2Parser-9wqew3zv.js +0 -5
- package/dist/App-hjn867nc.js +0 -11
- package/dist/FlacParser-bf8y3e0w.js +0 -5
- package/dist/Picker-b09hr4tk.js +0 -5
- package/dist/SessionPicker-wtfxwdxg.js +0 -5
- package/dist/SkillBrowser-p9ht63c7.js +0 -5
- package/dist/WizardApp-494018sk.js +0 -5
- package/dist/index-0mz7wpbw.js +0 -8
- package/dist/index-0pddq849.js +0 -63
- package/dist/index-1f1erzfx.js +0 -6
- package/dist/index-26ejkp8q.js +0 -1194
- package/dist/index-3b3h8kyh.js +0 -5
- package/dist/index-4emtktc0.js +0 -6
- package/dist/index-4t3p7vm9.js +0 -6
- package/dist/index-4t3p7vm9.js.map +0 -10
- package/dist/index-6r9h7ftn.js.map +0 -21
- package/dist/index-7gsbzvnc.js +0 -6
- package/dist/index-94k4mh6s.js +0 -96
- package/dist/index-94k4mh6s.js.map +0 -13
- package/dist/index-9dmgk6d3.js +0 -5
- package/dist/index-akv6e7ge.js +0 -9
- package/dist/index-f056wkb4.js +0 -6
- package/dist/index-s57ztjhq.js +0 -74
- package/dist/index-s57ztjhq.js.map +0 -13
- package/dist/index-vw2hf4d8.js +0 -6
- package/dist/index-w97gprre.js +0 -6
- package/dist/index-wk6andxq.js +0 -5
- package/dist/index-xa9crtzq.js +0 -6
- package/dist/index-z0dgxd7d.js +0 -429
- package/dist/index-z0dgxd7d.js.map +0 -11
- package/dist/wrapper-52c0vacs.js +0 -5
- /package/dist/{index-6c4p19m1.js.map → index-pszmnhgq.js.map} +0 -0
|
@@ -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,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS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AAO,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 noEnhancedKeys: isSet(env[`${BRAND.envPrefix}NO_CSI_U`]),\n }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";4CAiBA,qBAAS,eAAY,iBAAW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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,Mt,
|
|
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:
|
|
7
|
-
`))}function
|
|
8
|
-
`);n.push(o({key:`${s.id}:title`,role:"banner",text:
|
|
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
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"/**\n * Events in, view state out. Pure, and the only place that decides what a turn looks like.\n *\n * The CLI has always been a `runtime.bus` subscriber; this makes it a *reducer* over that bus\n * instead of a set of callbacks writing to stdout. Three things follow from that:\n *\n * - \"What does the reader see when a turn errors mid-stream?\" is a unit test rather than something\n * reproduced by hand against a live endpoint.\n * - Finished items are append-only and immutable, which is exactly the contract Ink's `<Static>`\n * needs: a node written once and never re-rendered. The still-moving reply lives in `live`, so\n * the dynamic region stays one item regardless of how long the conversation gets.\n * - Phase 4's SSE client and Phase 12's TUI client can consume the same reduction instead of\n * re-deriving it.\n *\n * No clock and no randomness: ids come from a counter in the state, so the same events always\n * produce the same output and the tests need no fakes.\n */\n\nimport { type AnyEvent, endNote, SUBMIT_ARTIFACT } from \"@dispach/core\"\nimport { MAX_TRANSCRIPT_ITEMS, REASONING_FOLD_ROWS } from \"#lib/const\"\nimport { compactTokens } from \"#lib/rows\"\nimport { ROLE_PREFIX } from \"#lib/theme\"\nimport type {\n SubagentView,\n TranscriptItem,\n TranscriptRole,\n TranscriptRow,\n TranscriptState,\n TurnStats,\n} from \"#lib/types\"\nimport { wrapText } from \"#lib/wrap\"\n\n/**\n * The transcript is driven by more than the bus — a typed line and a cancellation request are not\n * events — so the reducer takes an action union rather than an event directly.\n */\nexport type TranscriptAction =\n | { readonly kind: \"user\"; readonly text: string }\n | { readonly kind: \"event\"; readonly event: AnyEvent }\n | { readonly kind: \"note\"; readonly text: string }\n | { readonly kind: \"cancelling\" }\n /**\n * A model delta that has already been through the dialect's stream filter.\n *\n * Filtering cannot happen in here: a filter is stateful and this reducer is pure. So the caller\n * owns one per step and dispatches what is left. A caller that dispatches the raw `model.chunk`\n * event instead still works — it just shows the invocation blocks, which is right for a dialect\n * with no in-band protocol and wrong for NLT.\n */\n | { readonly kind: \"delta\"; readonly of: \"text\" | \"reasoning\"; readonly text: string }\n /**\n * Drop the oldest items if the buffer is over `MAX_TRANSCRIPT_ITEMS`.\n *\n * An action rather than something `append` does on its own, because whether it is *safe* depends on\n * a fact this reducer cannot see: rows are addressed by position, so dropping any from the front\n * moves every offset below them. A reader parked twelve turns back would keep their offset and\n * silently start reading different text — the appearance of a live session that is not one, which is\n * the failure `ScrollState.pinned` exists to make impossible. Only the layer holding that flag knows\n * when eviction is allowed, so only it can ask.\n */\n | { readonly kind: \"trim\" }\n\nexport const EMPTY_TRANSCRIPT: TranscriptState = {\n items: [],\n live: undefined,\n status: \"idle\",\n nextId: 0,\n turnFrom: undefined,\n}\n\nfunction append(\n state: TranscriptState,\n role: TranscriptRole,\n text: string,\n extra: {\n readonly stats?: TurnStats\n readonly callId?: string\n readonly pending?: boolean\n } = {},\n): TranscriptState {\n const item: TranscriptItem = {\n id: `t${state.nextId}`,\n role,\n text,\n ...(extra.stats === undefined ? {} : { stats: extra.stats }),\n ...(extra.callId === undefined ? {} : { callId: extra.callId }),\n ...(extra.pending === undefined ? {} : { pending: extra.pending }),\n }\n return { ...state, items: [...state.items, item], nextId: state.nextId + 1 }\n}\n\n/**\n * Commit whatever the model has streamed so far, and clear it.\n *\n * Called at each step boundary rather than once at the end of the turn, which is what puts the\n * transcript back in the order things happened. Committing at `turn.end` alone produced a turn shaped\n * \"every tool row, then all the reasoning, then all the text\" — so the reasoning that *decided* to call\n * a tool was printed below the tool's result, and step one's reasoning was concatenated onto step two's\n * with no break between them. Live output on a real turn read `…look for it in my workspace.The user is\n * asking me to…`, two sentences from two steps with nothing marking the join.\n *\n * Reasoning goes in ahead of the text it produced. Whether it is *shown* is the view's business — the\n * item is written either way, so `--show-reasoning` can be honoured after the fact.\n */\nfunction flushLive(state: TranscriptState): TranscriptState {\n const live = state.live\n if (live === undefined) return state\n let next = state\n if (live.reasoning !== \"\") next = append(next, \"reasoning\", live.reasoning)\n if (live.text !== \"\") next = append(next, \"assistant\", live.text)\n return { ...next, live: undefined }\n}\n\n/** `data` is typed per event in core's map; narrowing by `type` first is what makes this safe. */\nexport function reduce(state: TranscriptState, action: TranscriptAction): TranscriptState {\n switch (action.kind) {\n case \"user\":\n return append(state, \"user\", action.text)\n\n case \"note\":\n return append(state, \"note\", action.text)\n\n case \"cancelling\":\n // A state, not an item. Cancellation that produced partial text still ends in a\n // `turn.end`, and that is what commits the text.\n return state.status === \"idle\" ? state : { ...state, status: \"cancelling\" }\n\n case \"delta\":\n return applyDelta(state, action.of, action.text)\n\n case \"event\":\n return reduceEvent(state, action.event)\n\n case \"trim\":\n return trim(state)\n }\n}\n\n/**\n * The oldest items above the cap, dropped. Identity when there is nothing to do.\n *\n * Returning the same object rather than a copy is what makes this cheap to ask about: `useReducer`\n * compares by reference and skips the render, so the caller can dispatch on every change without\n * checking first — and a caller that has to check first is a caller that eventually forgets.\n *\n * The banner is an ordinary item and goes with the rest. It is four hundred turns of scrollback above\n * the reader by then, and exempting it would leave the session's opening line pinned above a\n * conversation it no longer describes.\n */\nfunction trim(state: TranscriptState): TranscriptState {\n const over = state.items.length - MAX_TRANSCRIPT_ITEMS\n return over <= 0 ? state : { ...state, items: state.items.slice(over) }\n}\n\nfunction applyDelta(\n state: TranscriptState,\n kind: \"text\" | \"reasoning\",\n delta: string,\n): TranscriptState {\n if (delta === \"\") return state\n const live = state.live ?? { text: \"\", reasoning: \"\", last: undefined }\n return {\n ...state,\n live: {\n text: kind === \"text\" ? live.text + delta : live.text,\n reasoning: kind === \"reasoning\" ? live.reasoning + delta : live.reasoning,\n last: kind,\n },\n // A cancellation already asked for is not undone by another token arriving in flight; the\n // request stands until the turn actually ends.\n status: state.status === \"cancelling\" ? \"cancelling\" : \"streaming\",\n }\n}\n\n/** The tool row `match` picks, with its subagent replaced. Unchanged state when no row matches. */\nfunction withSubagent(\n state: TranscriptState,\n match: (item: TranscriptItem) => boolean,\n change: (view: SubagentView | undefined, item: TranscriptItem) => SubagentView | undefined,\n): TranscriptState {\n const at = state.items.findIndex(match)\n if (at === -1) return state\n const items = [...state.items]\n const item = items[at] as TranscriptItem\n const view = change(item.subagent, item)\n if (view === undefined) return state\n items[at] = { ...item, subagent: view }\n return { ...state, items }\n}\n\n/**\n * A subagent's own event: its tool calls become lines under the routed call's row. Its text and\n * turn events stay out of the conversation, which is the parent's; `handoff.result` reports the end.\n */\nfunction reduceChild(state: TranscriptState, event: AnyEvent): TranscriptState {\n const mine = (item: TranscriptItem) => item.subagent?.sessionKey === event.sessionKey\n // The child's return channel is how it hands back its answer, not work it did for the person.\n if (\"slug\" in event.data && event.data.slug === SUBMIT_ARTIFACT) return state\n switch (event.type) {\n case \"tool.call\":\n return withSubagent(state, mine, (view) =>\n view === undefined\n ? undefined\n : {\n ...view,\n lines: [\n ...view.lines,\n { callId: event.data.callId, text: `${event.data.slug} …` },\n ],\n },\n )\n case \"tool.result\": {\n const { slug, callId, ok, latencyMs } = event.data\n const text = `${slug} — ${ok ? \"ok\" : \"failed\"} · ${latencyMs} ms`\n return withSubagent(state, mine, (view) =>\n view === undefined\n ? undefined\n : {\n ...view,\n lines: view.lines.some((line) => line.callId === callId)\n ? view.lines.map((line) =>\n line.callId === callId ? { callId, text } : line,\n )\n : [...view.lines, { callId, text }],\n },\n )\n }\n case \"tool.gated\":\n return withSubagent(state, mine, (view) =>\n view === undefined\n ? undefined\n : {\n ...view,\n lines: [\n ...view.lines,\n { text: `${event.data.slug} — blocked: ${event.data.reason}` },\n ],\n },\n )\n default:\n return state\n }\n}\n\nfunction reduceEvent(state: TranscriptState, event: AnyEvent): TranscriptState {\n if (event.parentTurnId !== undefined) return reduceChild(state, event)\n switch (event.type) {\n case \"handoff.start\": {\n const { kind, name, callId, sessionKey } = event.data\n if (kind !== \"self\" || callId === undefined) return state\n return withSubagent(\n state,\n (item) => item.callId === callId,\n () => ({ name: name ?? \"subagent\", sessionKey, lines: [] }),\n )\n }\n\n case \"handoff.result\": {\n const { sessionKey, steps, tokens, outcome } = event.data\n const summary = `${steps} step${steps === 1 ? \"\" : \"s\"} · ${compactTokens(tokens.prompt + tokens.output)} tokens · ${outcome === \"ok\" ? \"ok\" : outcome.replace(\"_\", \" \")}`\n return withSubagent(\n state,\n (item) => item.subagent?.sessionKey === sessionKey,\n (view) => (view === undefined ? undefined : { ...view, summary }),\n )\n }\n\n case \"turn.start\":\n return {\n ...state,\n live: { text: \"\", reasoning: \"\", last: undefined },\n status: \"thinking\",\n turnFrom: state.items.length,\n }\n\n case \"model.result\":\n // The step boundary. `model.result` is emitted once per model call, so this is where a step's\n // reasoning and text stop growing — no new event was needed to find it.\n return flushLive(state)\n\n case \"model.chunk\":\n return applyDelta(state, event.data.kind, event.data.delta)\n\n case \"tool.call\":\n // Committed the moment the call starts, not when it returns: a tool that takes eight\n // seconds must not leave the screen looking like a stalled model. Anything the model\n // streamed before deciding to call it is flushed first, so the reasoning sits above the\n // call it explains rather than below the call's result.\n return {\n ...append(\n flushLive(state),\n \"tool\",\n `${event.data.slug}${event.data.mutating ? \" (changes state)\" : \"\"}`,\n { callId: event.data.callId, pending: true },\n ),\n status: state.status === \"cancelling\" ? \"cancelling\" : \"working\",\n }\n\n case \"tool.result\": {\n const { slug, callId, ok, latencyMs, truncated } = event.data\n const text = `${slug} — ${ok ? \"ok\" : \"failed\"} · ${latencyMs} ms${truncated ? \" · observation trimmed\" : \"\"}`\n // The call's own row, completed. Matched on `callId` rather than on position, because calls\n // can overlap and \"the last tool row\" is then not the row this result belongs to.\n const at = state.items.findIndex(\n (item) => item.callId === callId && item.pending === true,\n )\n if (at === -1) {\n // No row to complete — a result for a call this transcript never saw. Appended rather\n // than dropped: an observation nobody can account for is exactly the thing worth seeing.\n return append(state, ok ? \"tool\" : \"error\", text)\n }\n const items = [...state.items]\n const item = items[at] as TranscriptItem\n items[at] = {\n id: item.id,\n role: ok ? \"tool\" : \"error\",\n text,\n callId,\n // The routed call's block outlives its own completion: the child's lines are the point.\n ...(item.subagent === undefined ? {} : { subagent: item.subagent }),\n }\n return { ...state, items }\n }\n\n case \"tool.gated\":\n // Deliberately visible. A blocked write is the one tool outcome a person must not have\n // to go looking for — and it is a `note` rather than an `error` because the wire spec is\n // explicit that this is not one: the turn continues and the model reports back.\n return append(state, \"note\", `${event.data.slug} — blocked: ${event.data.reason}`)\n\n case \"tool.repair\":\n // A silent repair is indistinguishable from a slow turn, and it costs a whole step. With no\n // slugs it is the runtime's nudge (14.123), not a tool that failed, and says so.\n return append(\n state,\n \"note\",\n event.data.slugs.length === 0\n ? `reply stopped short (${event.data.errors.join(\"; \")}), asking the model to finish`\n : `${event.data.slugs.join(\", \")} — could not be used, asking the model again`,\n )\n\n case \"model.retry\": {\n const { status, attempt, delayMs } = event.data\n return append(\n state,\n \"note\",\n `retrying after HTTP ${status} — attempt ${attempt}, waiting ${delayMs} ms`,\n )\n }\n\n case \"turn.end\": {\n const { reason, steps, tokens, durationMs } = event.data\n const stats: TurnStats = {\n promptTokens: tokens.prompt,\n outputTokens: tokens.output,\n durationMs,\n steps,\n reason,\n }\n\n // Whatever the last step streamed but never got a `model.result` for — a cancelled turn, or\n // one that ended on an error mid-stream. On a clean turn this is a no-op, because each step\n // committed itself as it finished.\n const next = flushLive(state)\n const from = state.turnFrom ?? 0\n // The reply this turn produced, which is where its cost belongs. Searched from the turn's own\n // first item: without that floor, a turn that produced no text would hang its statistics on\n // the *previous* turn's reply, which reads as that reply having cost twice.\n let reply = -1\n for (let at = next.items.length - 1; at >= from; at -= 1) {\n if (next.items[at]?.role === \"assistant\") {\n reply = at\n break\n }\n }\n // Why the turn stopped, from the formatter the plain path uses. Until this existed\n // `stats.reason` reached the reducer and was rendered nowhere, so a turn the step budget\n // cut off looked exactly like a completed one — which is how an agent came to stop\n // mid-task on \"Let me install it\" with nothing on screen explaining it.\n const why = endNote(reason, { steps, durationMs })\n\n if (reply === -1) {\n // A turn that produced nothing is not a normal outcome and must not look like one.\n const said = append(\n next,\n \"note\",\n why ?? (reason === \"final\" ? \"the model returned no text\" : \"\"),\n { stats },\n )\n return { ...said, live: undefined, status: \"idle\", turnFrom: undefined }\n }\n const items = [...next.items]\n const item = items[reply] as TranscriptItem\n items[reply] = { ...item, stats }\n const settled: TranscriptState = {\n ...next,\n items,\n live: undefined,\n status: \"idle\",\n turnFrom: undefined,\n }\n // Below the reply, not attached to it: the reply is what the model said, and this is what\n // the runtime did. Attaching it to the item would put a harness sentence in the model's\n // voice — the distinction `note` exists for.\n return why === undefined ? settled : append(settled, \"note\", why)\n }\n\n // `agent.error` used to fall through to here. It was declared in Phase 1, carried a\n // hint, and was emitted by **nothing, ever** — so this label was reachable only from a\n // test that constructed one by hand. Deleted rather than wired up: `error` already\n // carries every uncaught failure, and a second error event with no emitter is vocabulary\n // that makes the catalogue look richer than it is.\n case \"error\": {\n const { code, message, hint } = event.data\n return append(state, \"error\", `${code}: ${message}\\nhint: ${hint}`)\n }\n\n case \"context.dropped\": {\n const { messages, budget } = event.data\n // A note, not a stage line: the ladder decided what to compact and this is the budget\n // running out regardless. Worth saying because the agent is now answering without part of\n // the conversation, and nothing else on any surface would mention it.\n return append(\n state,\n \"note\",\n `context: ${messages} older message(s) did not fit the ${budget}-token budget and were left out`,\n )\n }\n\n case \"agent.warning\": {\n const { code, message } = event.data\n return append(state, \"note\", `${code}: ${message}`)\n }\n\n case \"context.pressure\":\n // A gauge, so it replaces rather than accumulates. `source` is deliberately not shown: it\n // is diagnostic and the status line has no room for a word that changes nothing a person\n // would do — it is on the event for whoever is reading events.\n return { ...state, pressure: event.data.fraction }\n\n case \"compaction.stage\": {\n const { stage, changed, before, after } = event.data\n // Only the stages that destroy detail get a line. trim, snip and micro are recoverable —\n // the conversation is still in the store and a snipped observation keeps a pointer — while\n // collapse and reset replace a span of the conversation with a summary, and a person who\n // was not watching the gauge still needs to know that happened.\n if (!changed || (stage !== \"collapse\" && stage !== \"reset\")) return state\n const what =\n stage === \"reset\"\n ? \"the conversation so far was replaced by a summary\"\n : \"earlier turns were replaced by a summary\"\n return append(state, \"note\", `context: ${what} (${before} → ${after} tokens)`)\n }\n\n case \"phase.changed\": {\n const { to, tools } = event.data\n // A line *and* the gauge. The line because a phase change is the reason the agent's\n // abilities changed mid-conversation, and a person scrolling back needs it where it\n // happened; the gauge because \"which phase am I in\" is a current-state question.\n const next = append(\n state,\n \"note\",\n `phase: now in ${to} · ${tools} tool${tools === 1 ? \"\" : \"s\"} available`,\n )\n return { ...next, phase: to }\n }\n\n case \"context.reset\": {\n const { warning } = event.data\n // The count itself is not shown — the note above already said what happened. A *second*\n // reset is a configuration problem rather than a busy session, and that is worth a line.\n return warning === undefined ? state : append(state, \"note\", `context: ${warning}`)\n }\n\n default:\n // Boot and bookkeeping events — `runtime.ready`, `store.ready`, `model.call`,\n // `context.assembled`. They belong to the banner and the status bar, not the transcript. Ignored explicitly so that a new event type added in a later\n // phase is inert here rather than a crash.\n return state\n }\n}\n\n/** What a renderer writes for a turn's cost. Kept here so the plain and rich paths agree. */\nexport function formatStats(stats: TurnStats): string {\n return `${stats.promptTokens} prompt · ${stats.outputTokens} output · ${stats.durationMs} ms`\n}\n\n/**\n * Opening banner — version, session, store, any turn a previous process left unfinished.\n *\n * One `banner` item rather than N notes, so the rich renderer can box it as a unit. The plain\n * path never calls this — it writes the lines directly — so plain output is unchanged by the\n * boxing.\n */\nexport function seed(notes: readonly string[]): TranscriptState {\n if (notes.length === 0) return EMPTY_TRANSCRIPT\n return append(EMPTY_TRANSCRIPT, \"banner\", notes.join(\"\\n\"))\n}\n\n/** One earlier message, as much of it as a transcript row needs. */\nexport interface PriorMessage {\n readonly role: \"user\" | \"assistant\"\n readonly text: string\n}\n\n/**\n * Put the conversation that already happened on the screen.\n *\n * Resuming used to paint an empty transcript over a full history: the messages reached the *model* and\n * never the person, so the banner said `17 message(s)` above a blank screen and the only honest reading\n * was that something had been lost. Rendering them is what makes that count verifiable.\n *\n * A separate function rather than a second argument to `seed`, because an optional parameter here would\n * have to distinguish \"no history\" from \"not asked for\" — and under `exactOptionalPropertyTypes` a\n * default parameter fires on an explicitly passed `undefined`, which has already cost this repo a\n * debugging round. `seedHistory(seed(banner), prior)` composes with nothing to remember.\n *\n * **Prose only.** Tool calls and observations are left out for the same reason they are left out of the\n * memory index: an observation is a wall of text a stranger wrote, and replaying forty of them above the\n * composer buries the conversation the person came back for. The turn statistics are left off too — they\n * were true of a process that has exited, and a cost line under a resumed reply reads as this session's.\n */\nexport function seedHistory(\n state: TranscriptState,\n messages: readonly PriorMessage[],\n): TranscriptState {\n let next = state\n for (const message of messages) {\n if (message.text.trim() === \"\") continue\n next = append(next, message.role, message.text)\n }\n return next\n}\n\n/** The most recent completed turn's cost, for the status bar. */\nexport function lastStats(items: readonly TranscriptItem[]): TurnStats | undefined {\n for (let i = items.length - 1; i >= 0; i -= 1) {\n const stats = items[i]?.stats\n if (stats !== undefined) return stats\n }\n return undefined\n}\n\n// ─── the finished conversation, as rows ──────────────────────────────────────────────────\n\n/**\n * Flatten items into the rows a windowed transcript scrolls through.\n *\n * ## Why rows rather than items\n *\n * Scrolling by item is the cheaper thing to build and the wrong unit. One assistant reply is a single\n * item and forty rows on screen, so an item-indexed window either shows the whole answer or none of it —\n * page-up from the bottom of a long reply would jump over the entire thing and land on the question\n * before it. Rows are what a reader moves through, so rows are what the offset counts.\n *\n * Wrapping happens here, not in Ink. A window has to know its content's height before it draws any of\n * it, and a count Ink might disagree with is a window off by however many lines wrapped — which shows up\n * as the last line of a reply hidden under the composer, intermittently, depending on the text.\n *\n * Pure, and one derivation for both halves of the frame: the component renders these rows and the layout\n * asks how many there are.\n */\nexport function transcriptRows(\n items: readonly TranscriptItem[],\n options: {\n readonly showReasoning: boolean\n readonly quiet: boolean\n readonly columns: number\n /** Reasoning blocks are shown whole rather than folded to `REASONING_FOLD_ROWS`. */\n readonly expandReasoning?: boolean\n },\n): readonly TranscriptRow[] {\n const rows: TranscriptRow[] = []\n const visible = items.filter((item) => item.role !== \"reasoning\" || options.showReasoning)\n\n /**\n * A row this renderer invented: a gap, a label, a fold notice, a stats line.\n *\n * `lead: 0` because there is no prefix to exclude, and `continuation: false` because it starts a line of\n * its own. Selectable, deliberately — a stats line or a banner note is text somebody may well want to\n * copy, and the cells worth excluding are the role prefixes, which are per-row and handled below.\n */\n const chrome = (row: Omit<TranscriptRow, \"lead\" | \"continuation\">): TranscriptRow => ({\n ...row,\n lead: 0,\n continuation: false,\n })\n\n for (const [at, item] of visible.entries()) {\n // A blank row between items, and never a trailing one. The rich transcript is read rather than\n // grepped, and two turns that touch each other read as one wall of text; a blank row at the end\n // would instead be a permanent gap above the composer.\n if (at > 0) rows.push(chrome({ key: `${item.id}:gap`, role: item.role, text: \"\" }))\n\n if (item.role === \"banner\") {\n // The banner keeps its content and loses its border. A bordered box inside a windowed list\n // costs two rows this module cannot count — Ink measures the frame, not us — and the frame\n // was decoration on a surface that is now itself a frame.\n const [title = \"\", ...lines] = item.text.split(\"\\n\")\n rows.push(chrome({ key: `${item.id}:title`, role: \"banner\", text: title, bold: true }))\n for (const [n, line] of lines.entries()) {\n for (const [w, wrapped] of wrapText(line, options.columns).entries()) {\n rows.push({\n key: `${item.id}:note-${n}-${w}`,\n role: \"banner\",\n text: wrapped,\n dim: true,\n lead: 0,\n // Only rows the *wrap* invented continue; a fresh source line does not.\n continuation: w > 0,\n })\n }\n }\n continue\n }\n\n const prefix = ROLE_PREFIX[item.role]\n const pad = \" \".repeat([...prefix].length)\n // The prefix is part of the first row's width and an indent on every row after it, so a reply\n // that wraps stays in one column instead of reading as a second message.\n const body = wrapText(item.text, Math.max(1, options.columns - [...prefix].length))\n\n if (item.role === \"reasoning\") {\n // A header row and an indented body, rather than a label wide enough to be the indent. Folded\n // unless asked for: the block is secondary, and at full length it routinely fills the screen\n // and pushes the reply it produced out of sight.\n const shown =\n options.expandReasoning === true\n ? body.length\n : Math.min(body.length, REASONING_FOLD_ROWS)\n const folded = body.length - shown\n rows.push(\n chrome({\n key: `${item.id}:label`,\n role: \"reasoning\",\n dim: true,\n text:\n folded > 0\n ? `· reasoning · ${body.length} rows · ⌥r expands`\n : `· reasoning · ${body.length} row${body.length === 1 ? \"\" : \"s\"}`,\n }),\n )\n for (const [n, line] of body.slice(0, shown).entries()) {\n rows.push({\n key: `${item.id}:${n}`,\n role: \"reasoning\",\n text: `${pad}${line}`,\n lead: pad.length,\n continuation: n > 0,\n })\n }\n if (folded > 0) {\n rows.push(\n chrome({\n key: `${item.id}:folded`,\n role: \"reasoning\",\n dim: true,\n text: `${pad}… ${folded} more row${folded === 1 ? \"\" : \"s\"}`,\n }),\n )\n }\n continue\n }\n\n for (const [n, line] of body.entries()) {\n rows.push({\n key: `${item.id}:${n}`,\n role: item.role,\n text: `${n === 0 ? prefix : pad}${line}`,\n // The prefix on the first row and its hanging indent on every row after it are the same\n // width, so one number covers both — and it is exactly the span a copy must drop.\n lead: [...prefix].length,\n continuation: n > 0,\n })\n }\n\n if (item.subagent !== undefined) {\n // Folded with the reasoning blocks, by the same key: both are the detail behind a row, and\n // the reply is what a person reads first.\n const view = item.subagent\n const open = options.expandReasoning === true\n const status = view.summary ?? \"running\"\n const more =\n !open && view.lines.length > 0\n ? ` · ⌥r shows ${view.lines.length} call${view.lines.length === 1 ? \"\" : \"s\"}`\n : \"\"\n for (const [n, line] of wrapText(\n `↳ subagent ${view.name} · ${status}${more}`,\n Math.max(1, options.columns - pad.length),\n ).entries()) {\n rows.push(\n chrome({\n key: `${item.id}:sub-${n}`,\n role: item.role,\n text: `${pad}${line}`,\n dim: true,\n }),\n )\n }\n if (open) {\n const inner = `${pad} `\n for (const [n, line] of view.lines.entries()) {\n for (const [w, wrapped] of wrapText(\n line.text,\n Math.max(1, options.columns - inner.length),\n ).entries()) {\n rows.push({\n key: `${item.id}:sub-${n}-${w}`,\n role: item.role,\n text: `${inner}${wrapped}`,\n dim: true,\n lead: inner.length,\n continuation: w > 0,\n })\n }\n }\n }\n }\n\n if (item.stats !== undefined && !options.quiet) {\n rows.push(\n chrome({\n key: `${item.id}:stats`,\n role: item.role,\n text: ` ${formatStats(item.stats)}`,\n dim: true,\n }),\n )\n }\n }\n\n return rows\n}\n"
|
|
8
8
|
],
|
|
9
9
|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
|
|
3
|
-
export{
|
|
2
|
+
import{ps}from"./index-38gs9anh.js";import{zt}from"./index-twn9bfm2.js";function Ue(e){if(e??zt().noEnhancedKeys)return{};return ps(),{kittyKeyboard:{mode:"enabled",flags:["disambiguateEscapeCodes","reportEventTypes"]}}}function o(e){if(e.json)return{mode:"json",because:"--json was passed"};if(e.plain)return{mode:"plain",because:"--plain was passed"};if(e.oneShot)return{mode:"plain",because:"--input is always plain"};if(!e.stdoutIsTTY)return{mode:"plain",because:"stdout is not a terminal"};if(!e.stdinIsTTY)return{mode:"plain",because:"stdin is not a terminal"};if(e.env.noColor)return{mode:"plain",because:"NO_COLOR is set"};if(e.env.dumbTerminal)return{mode:"plain",because:"TERM is dumb"};if(e.env.ci)return{mode:"plain",because:"CI is set"};return{mode:"rich",because:"stdout and stdin are both terminals"}}function it(e){return o({...e,stdinIsTTY:process.stdin.isTTY===!0,stdoutIsTTY:process.stdout.isTTY===!0,env:zt()})}
|
|
3
|
+
export{Ue,it};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=BAE572569B452FE064756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-ynsvkqgb.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * How output is rendered, resolved once per process.\n *\n * This mirrors the reasoning behind decision 3.5, which forbids the tool dialect from changing with\n * the model: behaviour that shifts silently with the environment cannot be reasoned about. So the\n * resolution is total and ordered, and it returns *why* it chose — the reason is printable, which is\n * what turns \"it wasn't interactive and I don't know why\" into a question with an answer.\n *\n * Measured, not assumed: importing Ink and React costs ~65 ms under Bun and ~170-210 ms under Node,\n * against a ~70 ms total runtime for `validate --json`. Nothing on a non-rich path may import them,\n * which is why this returns a mode rather than a renderer.\n */\n\nimport { readEnv } from \"#lib/env\"\nimport type { ModeDecision, ModeInputs } from \"#lib/schema\"\n\n/**\n * Total and ordered. Every branch is reachable and every input is consulted, so no combination of\n * flags and environment lands somewhere undocumented.\n */\nexport function resolveMode(inputs: ModeInputs): ModeDecision {\n if (inputs.json) return { mode: \"json\", because: \"--json was passed\" }\n if (inputs.plain) return { mode: \"plain\", because: \"--plain was passed\" }\n\n // A one-shot is a scripting affordance. Its output must not depend on whether a human happened\n // to be at a terminal, or `--input` would mean two different things in a shell script and in a\n // shell.\n if (inputs.oneShot) return { mode: \"plain\", because: \"--input is always plain\" }\n\n if (!inputs.stdoutIsTTY) return { mode: \"plain\", because: \"stdout is not a terminal\" }\n // A live transcript with no way to type into it is a worse plain renderer, not a better one.\n if (!inputs.stdinIsTTY) return { mode: \"plain\", because: \"stdin is not a terminal\" }\n\n if (inputs.env.noColor) return { mode: \"plain\", because: \"NO_COLOR is set\" }\n if (inputs.env.dumbTerminal) return { mode: \"plain\", because: \"TERM is dumb\" }\n // CI logs are files that happen to scroll. Cursor movement in one is noise forever.\n if (inputs.env.ci) return { mode: \"plain\", because: \"CI is set\" }\n\n return { mode: \"rich\", because: \"stdout and stdin are both terminals\" }\n}\n\n/**\n * Deliberately not consulted: `FORCE_COLOR`. It says how much colour a stream can carry, not\n * whether a human is watching, and honouring it here would turn a CI job that wanted coloured logs\n * into one driving a cursor around a file. Ink's own colour depth still respects it.\n */\nexport function resolveModeFromProcess(flags: {\n readonly json: boolean\n readonly plain: boolean\n readonly oneShot: boolean\n}): ModeDecision {\n return resolveMode({\n ...flags,\n stdinIsTTY: process.stdin.isTTY === true,\n stdoutIsTTY: process.stdout.isTTY === true,\n env: readEnv(),\n })\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";wEAuFO,SAAS,EAAiB,CAAC,EAAqC,CAInE,GAAI,GAAY,GAAQ,EAAE,eAAgB,MAAO,CAAC,EAElD,OADA,GAAiB,EACV,CACH,cAAe,CAEX,KAAM,UACN,MAAO,CAAC,0BAA2B,kBAAkB,CACzD,CACJ,EC/EG,SAAS,CAAW,CAAC,EAAkC,CAC1D,GAAI,EAAO,KAAM,MAAO,CAAE,KAAM,OAAQ,QAAS,mBAAoB,EACrE,GAAI,EAAO,MAAO,MAAO,CAAE,KAAM,QAAS,QAAS,oBAAqB,EAKxE,GAAI,EAAO,QAAS,MAAO,CAAE,KAAM,QAAS,QAAS,yBAA0B,EAE/E,GAAI,CAAC,EAAO,YAAa,MAAO,CAAE,KAAM,QAAS,QAAS,0BAA2B,EAErF,GAAI,CAAC,EAAO,WAAY,MAAO,CAAE,KAAM,QAAS,QAAS,yBAA0B,EAEnF,GAAI,EAAO,IAAI,QAAS,MAAO,CAAE,KAAM,QAAS,QAAS,iBAAkB,EAC3E,GAAI,EAAO,IAAI,aAAc,MAAO,CAAE,KAAM,QAAS,QAAS,cAAe,EAE7E,GAAI,EAAO,IAAI,GAAI,MAAO,CAAE,KAAM,QAAS,QAAS,WAAY,EAEhE,MAAO,CAAE,KAAM,OAAQ,QAAS,qCAAsC,EAQnE,SAAS,EAAsB,CAAC,EAItB,CACb,OAAO,EAAY,IACZ,EACH,WAAY,QAAQ,MAAM,QAAU,GACpC,YAAa,QAAQ,OAAO,QAAU,GACtC,IAAK,GAAQ,CACjB,CAAC",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "BAE572569B452FE064756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|