dispach 0.2.3 → 0.2.13

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.
Files changed (219) hide show
  1. package/README.md +46 -43
  2. package/dist/APEv2Parser-rt8hyadd.js +5 -0
  3. package/dist/{AiffParser-9hj6fpmy.js → AiffParser-gvpmtb2e.js} +3 -3
  4. package/dist/{AiffParser-9hj6fpmy.js.map → AiffParser-gvpmtb2e.js.map} +1 -1
  5. package/dist/App-18dvbyev.js +11 -0
  6. package/dist/{App-2f72vhjv.js.map → App-18dvbyev.js.map} +1 -1
  7. package/dist/AsfParser-h9zyh6cx.js +5 -0
  8. package/dist/{AsfParser-7emspn04.js.map → AsfParser-h9zyh6cx.js.map} +1 -1
  9. package/dist/ConfigEditor-444m13ta.js +6 -0
  10. package/dist/{ConfigEditor-vk7vxaa6.js.map → ConfigEditor-444m13ta.js.map} +1 -1
  11. package/dist/DsdiffParser-gxqv4gn1.js +5 -0
  12. package/dist/{DsdiffParser-dz88pnnr.js.map → DsdiffParser-gxqv4gn1.js.map} +1 -1
  13. package/dist/{DsfParser-qgh63tbs.js → DsfParser-sndt4jbk.js} +3 -3
  14. package/dist/{DsfParser-qgh63tbs.js.map → DsfParser-sndt4jbk.js.map} +1 -1
  15. package/dist/FlacParser-rmkpvf9e.js +5 -0
  16. package/dist/{KeyProbe-5anphmb7.js → KeyProbe-6t531sy6.js} +3 -3
  17. package/dist/{KeyProbe-5anphmb7.js.map → KeyProbe-6t531sy6.js.map} +1 -1
  18. package/dist/MP4Parser-87xfsck4.js +5 -0
  19. package/dist/{MP4Parser-yr7p3z12.js.map → MP4Parser-87xfsck4.js.map} +2 -2
  20. package/dist/{MatroskaParser-jkbsbsk3.js → MatroskaParser-7krspfgx.js} +3 -3
  21. package/dist/{MatroskaParser-jkbsbsk3.js.map → MatroskaParser-7krspfgx.js.map} +1 -1
  22. package/dist/{MpegParser-t93vwnew.js → MpegParser-jcs35q0h.js} +3 -3
  23. package/dist/{MpegParser-t93vwnew.js.map → MpegParser-jcs35q0h.js.map} +1 -1
  24. package/dist/MusepackParser-d4zfnzk3.js +5 -0
  25. package/dist/{MusepackParser-6e8kbh2d.js.map → MusepackParser-d4zfnzk3.js.map} +2 -2
  26. package/dist/OggParser-fbspjs7v.js +5 -0
  27. package/dist/{OggParser-ggcypmag.js.map → OggParser-fbspjs7v.js.map} +1 -1
  28. package/dist/Picker-x6aj42tc.js +5 -0
  29. package/dist/{Picker-j7txnm7w.js.map → Picker-x6aj42tc.js.map} +1 -1
  30. package/dist/SessionPicker-pngdv97x.js +5 -0
  31. package/dist/{SessionPicker-hpv2ncsb.js.map → SessionPicker-pngdv97x.js.map} +1 -1
  32. package/dist/SkillBrowser-3mnzkakr.js +5 -0
  33. package/dist/{SkillBrowser-qc542n71.js.map → SkillBrowser-3mnzkakr.js.map} +1 -1
  34. package/dist/WavPackParser-0x9z4466.js +5 -0
  35. package/dist/{WavPackParser-jw9stzqp.js.map → WavPackParser-0x9z4466.js.map} +1 -1
  36. package/dist/WaveParser-31b6qtef.js +5 -0
  37. package/dist/{WaveParser-epmncs9w.js.map → WaveParser-31b6qtef.js.map} +1 -1
  38. package/dist/WizardApp-c42wc116.js +5 -0
  39. package/dist/{WizardApp-pgzcz9zq.js.map → WizardApp-c42wc116.js.map} +1 -1
  40. package/dist/channels-nf6d8fvx.js +31 -0
  41. package/dist/{channels-m8nambmm.js.map → channels-nf6d8fvx.js.map} +1 -1
  42. package/dist/client.d.ts +1 -1
  43. package/dist/client.js +11 -11
  44. package/dist/client.js.map +4 -4
  45. package/dist/config-sx40rg8m.js +24 -0
  46. package/dist/{config-hmgrqgf2.js.map → config-sx40rg8m.js.map} +2 -2
  47. package/dist/credential-vdbkfk65.js +19 -0
  48. package/dist/{credential-nkb2ya59.js.map → credential-vdbkfk65.js.map} +1 -1
  49. package/dist/daemon.d.ts.map +1 -1
  50. package/dist/{index-51x0n5z0.js → index-0dcpsfet.js} +4 -4
  51. package/dist/{index-51x0n5z0.js.map → index-0dcpsfet.js.map} +1 -1
  52. package/dist/{index-yw3fby4n.js → index-1h8s50d9.js} +3 -3
  53. package/dist/{index-yw3fby4n.js.map → index-1h8s50d9.js.map} +1 -1
  54. package/dist/index-1hbvhrsj.js +6 -0
  55. package/dist/{index-dzy19wtf.js.map → index-1hbvhrsj.js.map} +1 -1
  56. package/dist/index-1hfece7s.js +10 -0
  57. package/dist/{index-22fzzn7z.js.map → index-1hfece7s.js.map} +2 -2
  58. package/dist/index-2h566rtg.js +6 -0
  59. package/dist/{index-jc4kmfwa.js.map → index-2h566rtg.js.map} +1 -1
  60. package/dist/index-4g4smpkk.js +11 -0
  61. package/dist/{index-sh44ymqz.js.map → index-4g4smpkk.js.map} +1 -1
  62. package/dist/index-4gfsf9n8.js +6 -0
  63. package/dist/{index-8tmv33mr.js.map → index-4gfsf9n8.js.map} +1 -1
  64. package/dist/{index-dv9pdjy4.js → index-5ptbytze.js} +10 -10
  65. package/dist/{index-dv9pdjy4.js.map → index-5ptbytze.js.map} +1 -1
  66. package/dist/index-5s1cq8np.js +8 -0
  67. package/dist/{index-9t4dz145.js.map → index-5s1cq8np.js.map} +1 -1
  68. package/dist/{index-2zjh5zd5.js → index-659ggfbf.js} +2 -2
  69. package/dist/index-6ebppx3t.js +6 -0
  70. package/dist/{index-1x8mzvz7.js.map → index-6ebppx3t.js.map} +1 -1
  71. package/dist/index-6pym9p8h.js +9 -0
  72. package/dist/{index-38gs9anh.js.map → index-6pym9p8h.js.map} +1 -1
  73. package/dist/index-9ejax6hp.js +6 -0
  74. package/dist/{index-8edck2pr.js.map → index-9ejax6hp.js.map} +1 -1
  75. package/dist/{index-zw6wyas6.js → index-9hw9j1qg.js} +4 -4
  76. package/dist/{index-zw6wyas6.js.map → index-9hw9j1qg.js.map} +1 -1
  77. package/dist/{index-bqdkm3de.js → index-9xhresrg.js} +4 -4
  78. package/dist/{index-bqdkm3de.js.map → index-9xhresrg.js.map} +1 -1
  79. package/dist/{index-hgm2gchq.js → index-abm0zyc0.js} +12 -12
  80. package/dist/{index-hgm2gchq.js.map → index-abm0zyc0.js.map} +1 -1
  81. package/dist/index-ar5c9d2f.js +7 -0
  82. package/dist/{index-3826kf9t.js.map → index-ar5c9d2f.js.map} +1 -1
  83. package/dist/index-bhj4pmrx.js +74 -0
  84. package/dist/index-bhj4pmrx.js.map +13 -0
  85. package/dist/index-brt17yfr.js +6 -0
  86. package/dist/{index-hrwakb11.js.map → index-brt17yfr.js.map} +2 -2
  87. package/dist/index-bysnsdkd.js +6 -0
  88. package/dist/{index-nxhqf597.js.map → index-bysnsdkd.js.map} +1 -1
  89. package/dist/index-c74wx9pv.js +6 -0
  90. package/dist/{index-323jvr1g.js.map → index-c74wx9pv.js.map} +1 -1
  91. package/dist/index-cm3g4t3r.js +14 -0
  92. package/dist/{index-y7dxq4a4.js.map → index-cm3g4t3r.js.map} +2 -2
  93. package/dist/index-dzp6mc5h.js +6 -0
  94. package/dist/{index-42e29zs4.js.map → index-dzp6mc5h.js.map} +1 -1
  95. package/dist/index-fad09b8c.js +6 -0
  96. package/dist/{index-836hc2h1.js.map → index-fad09b8c.js.map} +2 -2
  97. package/dist/{index-0444sh6x.js → index-fvb2dxzn.js} +4 -4
  98. package/dist/{index-0444sh6x.js.map → index-fvb2dxzn.js.map} +1 -1
  99. package/dist/{index-2bsardvh.js → index-gpq4agva.js} +3 -3
  100. package/dist/{index-2bsardvh.js.map → index-gpq4agva.js.map} +1 -1
  101. package/dist/{index-qgsdgbk8.js → index-hcpvk5de.js} +3 -3
  102. package/dist/{index-qgsdgbk8.js.map → index-hcpvk5de.js.map} +1 -1
  103. package/dist/{index-pqw1n1pv.js → index-jv5t63tp.js} +4 -4
  104. package/dist/{index-pqw1n1pv.js.map → index-jv5t63tp.js.map} +1 -1
  105. package/dist/index-kyz4t0j0.js +126 -0
  106. package/dist/{index-ry6a4bqh.js.map → index-kyz4t0j0.js.map} +2 -2
  107. package/dist/{index-ytxbw8py.js → index-m6r2sxcw.js} +33 -33
  108. package/dist/{index-ytxbw8py.js.map → index-m6r2sxcw.js.map} +1 -1
  109. package/dist/{index-snz49ndn.js → index-mhw3d7af.js} +3 -3
  110. package/dist/{index-snz49ndn.js.map → index-mhw3d7af.js.map} +1 -1
  111. package/dist/{index-1mbdz3f7.js → index-mk7hrzq7.js} +9 -9
  112. package/dist/{index-1mbdz3f7.js.map → index-mk7hrzq7.js.map} +1 -1
  113. package/dist/index-n0hqgwad.js +6 -0
  114. package/dist/{index-xg7s813b.js.map → index-n0hqgwad.js.map} +2 -2
  115. package/dist/index-ncb840sk.js +6 -0
  116. package/dist/{index-mjfv7k5w.js.map → index-ncb840sk.js.map} +1 -1
  117. package/dist/{index-fbsrhcga.js → index-ntczmwnf.js} +4 -4
  118. package/dist/{index-fbsrhcga.js.map → index-ntczmwnf.js.map} +1 -1
  119. package/dist/{index-095hrkyr.js → index-p5gy5s7p.js} +4 -4
  120. package/dist/{index-095hrkyr.js.map → index-p5gy5s7p.js.map} +1 -1
  121. package/dist/{index-3c5jt6by.js → index-p86w0qjw.js} +3 -3
  122. package/dist/{index-3c5jt6by.js.map → index-p86w0qjw.js.map} +1 -1
  123. package/dist/index-qhh30m9p.js +6 -0
  124. package/dist/{index-nvc24414.js.map → index-qhh30m9p.js.map} +1 -1
  125. package/dist/{index-p6ya59m6.js → index-rerdsr3d.js} +4 -4
  126. package/dist/{index-p6ya59m6.js.map → index-rerdsr3d.js.map} +1 -1
  127. package/dist/{index-k8e9f466.js → index-s0mfq8t7.js} +19 -19
  128. package/dist/index-s0mfq8t7.js.map +11 -0
  129. package/dist/{index-3vzf253k.js → index-s9ybp2r1.js} +7 -7
  130. package/dist/{index-3vzf253k.js.map → index-s9ybp2r1.js.map} +1 -1
  131. package/dist/index-ss77hvwy.js +1246 -0
  132. package/dist/{index-hpvfqq6r.js.map → index-ss77hvwy.js.map} +32 -31
  133. package/dist/{index-jff5q27j.js → index-t9bnt6a1.js} +4 -4
  134. package/dist/{index-jff5q27j.js.map → index-t9bnt6a1.js.map} +1 -1
  135. package/dist/index-w2ss9hn5.js +9 -0
  136. package/dist/{index-eztfverw.js.map → index-w2ss9hn5.js.map} +1 -1
  137. package/dist/{index-pszmnhgq.js → index-w80shmpv.js} +9 -9
  138. package/dist/{index-pszmnhgq.js.map → index-w80shmpv.js.map} +1 -1
  139. package/dist/index-w8e8qxd4.js +337 -0
  140. package/dist/index-w8e8qxd4.js.map +21 -0
  141. package/dist/{index-308y9xt0.js → index-z9r4e0yq.js} +4 -4
  142. package/dist/{index-308y9xt0.js.map → index-z9r4e0yq.js.map} +1 -1
  143. package/dist/index-zj87j4j2.js +6 -0
  144. package/dist/index-zj87j4j2.js.map +10 -0
  145. package/dist/{index-m6fqx0ch.js → index-zmerx9rc.js} +6 -6
  146. package/dist/{index-m6fqx0ch.js.map → index-zmerx9rc.js.map} +1 -1
  147. package/dist/index-zqjtjs7c.js +153 -0
  148. package/dist/{index-dpcm1j62.js.map → index-zqjtjs7c.js.map} +2 -2
  149. package/dist/index.js +381 -368
  150. package/dist/index.js.map +7 -6
  151. package/dist/lib/launchd.d.ts.map +1 -1
  152. package/dist/lib/service-env.d.ts.map +1 -1
  153. package/dist/lib/templates.d.ts.map +1 -1
  154. package/dist/lib/theme.d.ts.map +1 -1
  155. package/dist/lib/watchdog.d.ts +20 -0
  156. package/dist/lib/watchdog.d.ts.map +1 -0
  157. package/dist/serve.d.ts.map +1 -1
  158. package/dist/skills.d.ts.map +1 -1
  159. package/dist/sources.d.ts.map +1 -1
  160. package/dist/web-zvf80ns1.js +14 -0
  161. package/dist/{web-gfv0mzgs.js.map → web-zvf80ns1.js.map} +1 -1
  162. package/dist/wire.js +11 -11
  163. package/dist/wire.js.map +4 -4
  164. package/dist/wrapper-5zhcdmnk.js +5 -0
  165. package/package.json +4 -4
  166. package/dist/APEv2Parser-ysjr6adv.js +0 -5
  167. package/dist/App-2f72vhjv.js +0 -11
  168. package/dist/AsfParser-7emspn04.js +0 -5
  169. package/dist/ConfigEditor-vk7vxaa6.js +0 -6
  170. package/dist/DsdiffParser-dz88pnnr.js +0 -5
  171. package/dist/FlacParser-drm5wq0p.js +0 -5
  172. package/dist/MP4Parser-yr7p3z12.js +0 -5
  173. package/dist/MusepackParser-6e8kbh2d.js +0 -5
  174. package/dist/OggParser-ggcypmag.js +0 -5
  175. package/dist/Picker-j7txnm7w.js +0 -5
  176. package/dist/SessionPicker-hpv2ncsb.js +0 -5
  177. package/dist/SkillBrowser-qc542n71.js +0 -5
  178. package/dist/WavPackParser-jw9stzqp.js +0 -5
  179. package/dist/WaveParser-epmncs9w.js +0 -5
  180. package/dist/WizardApp-pgzcz9zq.js +0 -5
  181. package/dist/channels-m8nambmm.js +0 -31
  182. package/dist/config-hmgrqgf2.js +0 -24
  183. package/dist/credential-nkb2ya59.js +0 -19
  184. package/dist/index-1x8mzvz7.js +0 -6
  185. package/dist/index-22fzzn7z.js +0 -10
  186. package/dist/index-323jvr1g.js +0 -6
  187. package/dist/index-3826kf9t.js +0 -7
  188. package/dist/index-38gs9anh.js +0 -9
  189. package/dist/index-42e29zs4.js +0 -6
  190. package/dist/index-836hc2h1.js +0 -6
  191. package/dist/index-8edck2pr.js +0 -6
  192. package/dist/index-8tmv33mr.js +0 -6
  193. package/dist/index-9t4dz145.js +0 -8
  194. package/dist/index-djeqvfms.js +0 -74
  195. package/dist/index-djeqvfms.js.map +0 -13
  196. package/dist/index-dpcm1j62.js +0 -153
  197. package/dist/index-dzy19wtf.js +0 -6
  198. package/dist/index-eztfverw.js +0 -9
  199. package/dist/index-fxpmx6cr.js +0 -308
  200. package/dist/index-fxpmx6cr.js.map +0 -21
  201. package/dist/index-hpvfqq6r.js +0 -1252
  202. package/dist/index-hrwakb11.js +0 -6
  203. package/dist/index-jc4kmfwa.js +0 -6
  204. package/dist/index-k8e9f466.js.map +0 -13
  205. package/dist/index-mjfv7k5w.js +0 -6
  206. package/dist/index-nvc24414.js +0 -6
  207. package/dist/index-nxhqf597.js +0 -6
  208. package/dist/index-qv6ktepc.js +0 -6
  209. package/dist/index-qv6ktepc.js.map +0 -10
  210. package/dist/index-ry6a4bqh.js +0 -126
  211. package/dist/index-sh44ymqz.js +0 -11
  212. package/dist/index-xg7s813b.js +0 -6
  213. package/dist/index-y7dxq4a4.js +0 -14
  214. package/dist/web-gfv0mzgs.js +0 -14
  215. package/dist/wrapper-f662ny3r.js +0 -5
  216. /package/dist/{APEv2Parser-ysjr6adv.js.map → APEv2Parser-rt8hyadd.js.map} +0 -0
  217. /package/dist/{FlacParser-drm5wq0p.js.map → FlacParser-rmkpvf9e.js.map} +0 -0
  218. /package/dist/{index-2zjh5zd5.js.map → index-659ggfbf.js.map} +0 -0
  219. /package/dist/{wrapper-f662ny3r.js.map → wrapper-5zhcdmnk.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
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)}}
2
+ import{s}from"./index-1hbvhrsj.js";import{j}from"./index-fvb2dxzn.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:s.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,a)=>r.map((i)=>i?.[a]??"").join(n))}function f(t,r,n){let e=r.repeat(n),a=" ".repeat(n);return t.map((i)=>[...i].map((o)=>o===m?e:a).join(""))}function W(t){let r=[".".repeat([...t[0]??""].length),...t],n=[];for(let e=0;e<r.length;e+=2){let a=[...r[e]??""],i=[...r[e+1]??""],o=[];for(let l=0;l<Math.max(a.length,i.length);l+=1){let d=a[l]===m,c=i[l]===m;o.push(d&&c?"█":d?"▀":c?"▄":" ")}n.push(o.join(""))}return n}function g(t,r){return[j([...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),a=[{tier:"wide",lines:f(e,"█",2)},{tier:"block",lines:f(e,"█",1)},{tier:"half",lines:W(e)}];for(let o of a){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 i=g(n,r.columns);return{lines:i,tier:"plain",width:p(i)}}
3
3
  export{Rn,mA,_n};
4
4
 
5
- //# debugId=95C0EA15AF2A18E264756E2164756E21
6
- //# sourceMappingURL=index-snz49ndn.js.map
5
+ //# debugId=D3E6A8A4861E2AD864756E2164756E21
6
+ //# sourceMappingURL=index-mhw3d7af.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,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG,CAAC,QAAS,QAAS,QAAS,QAAS,OAAO,EAC/C,EAAG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AAC,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": "95C0EA15AF2A18E264756E2164756E21",
9
+ "debugId": "D3E6A8A4861E2AD864756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{j,Mt,Ci}from"./index-hpvfqq6r.js";import{rt}from"./index-qv6ktepc.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",S=[{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"}],U=S.flatMap((e)=>[...e.chord.matchAll(/\^([A-Za-z])/g)].map((t)=>(t[1]??"").toLowerCase())),Z=S.flatMap((e)=>[...e.chord.matchAll(/⌥([a-z])(?![A-Za-z])/g)].map((t)=>t[1]??""));var C=/^\/[A-Za-z][\w-]*$/,L=/^(\/[A-Za-z][\w-]*)\s+(.*)$/,T=new Map(x.flatMap((e)=>[e.word,...e.aliases].map((t)=>[t.toLowerCase(),e.kind])));function Hn(e,t=[]){let n=e.trim(),r=T.get(n.toLowerCase());if(r!==void 0)return{kind:r};let o=new Set(t);if(o.has(n.slice(1).toLowerCase())&&C.test(n))return{kind:"command",name:n.slice(1).toLowerCase(),rest:""};let l=L.exec(n);if(l!==null){let i=(l[1]??"").toLowerCase(),a=l[2]??"",d=T.get(i);if(d!==void 0)return{kind:d,rest:a};if(o.has(i.slice(1)))return{kind:"command",name:i.slice(1),rest:a};return}if(!C.test(n))return;let s=j(n.toLowerCase(),[...T.keys(),...t.map((i)=>`/${i}`)]);return{kind:"unknown",word:n,...s===void 0?{}:{nearest:s}}}var R=20;function D(e){return` ${[e.word,...e.aliases].join(" / ").padEnd(R)}${e.summary}`}function K(e){return` ${e.chord.padEnd(R)}${e.summary}`}function Kn(){return["commands:",...x.map(D),"","keys:",...S.map(K)].join(`
2
+ import{J,Mt,Ei}from"./index-ss77hvwy.js";import{st}from"./index-zj87j4j2.js";import{ga}from"./index-1hbvhrsj.js";import{In}from"./index-rerdsr3d.js";import{p}from"./index-s9ybp2r1.js";import{Bi}from"./index-fvb2dxzn.js";import{fa,Ca}from"./index-4gfsf9n8.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"}],Hi="⌥⏎ or a trailing \\ for a new line · ⏎ sends",Ki="/ commands · ⏎ sends · ⇧⏎ new line · ^C twice leaves",S=[{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"}],j=S.flatMap((e)=>[...e.chord.matchAll(/\^([A-Za-z])/g)].map((t)=>(t[1]??"").toLowerCase())),U=S.flatMap((e)=>[...e.chord.matchAll(/⌥([a-z])(?![A-Za-z])/g)].map((t)=>t[1]??""));var C=/^\/[A-Za-z][\w-]*$/,L=/^(\/[A-Za-z][\w-]*)\s+(.*)$/,T=new Map(x.flatMap((e)=>[e.word,...e.aliases].map((t)=>[t.toLowerCase(),e.kind])));function Hn(e,t=[]){let n=e.trim(),r=T.get(n.toLowerCase());if(r!==void 0)return{kind:r};let o=new Set(t);if(o.has(n.slice(1).toLowerCase())&&C.test(n))return{kind:"command",name:n.slice(1).toLowerCase(),rest:""};let l=L.exec(n);if(l!==null){let i=(l[1]??"").toLowerCase(),a=l[2]??"",d=T.get(i);if(d!==void 0)return{kind:d,rest:a};if(o.has(i.slice(1)))return{kind:"command",name:i.slice(1),rest:a};return}if(!C.test(n))return;let s=J(n.toLowerCase(),[...T.keys(),...t.map((i)=>`/${i}`)]);return{kind:"unknown",word:n,...s===void 0?{}:{nearest:s}}}var R=20;function D(e){return` ${[e.word,...e.aliases].join(" / ").padEnd(R)}${e.summary}`}function K(e){return` ${e.chord.padEnd(R)}${e.summary}`}function Kn(){return["commands:",...x.map(D),"","keys:",...S.map(K)].join(`
3
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,d)=>Math.max(a,d.label.length),0),l=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,d)=>Math.max(a,d.label.length),0),i=e.history.length===0?[]:e.history.map((a)=>` ${a.label.padEnd(s)} ${String(a.tokens).padStart(6)} ${M(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 (${M(e.cache.cached,e.cache.prompt)}) over ${e.cache.turns} turn${e.cache.turns===1?"":"s"} · ${e.cache.source}`}]),""," slots",...l,...i.length===0?[]:[""," history, by kind — share of the whole prompt",...i]].join(`
5
- `)}function M(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 A={items:[],live:void 0,status:"idle",nextId:0,turnFrom:void 0};function p(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 E(e){let t=e.live;if(t===void 0)return e;let n=e;if(t.reasoning!=="")n=p(n,"reasoning",t.reasoning);if(t.text!=="")n=p(n,"assistant",t.text);return{...n,live:void 0}}function qi(e,t){switch(t.kind){case"user":return p(e,"user",t.text);case"note":return p(e,"note",t.text);case"cancelling":return e.status==="idle"?e:{...e,status:"cancelling"};case"delta":return N(e,t.of,t.text);case"event":return H(e,t.event);case"trim":return F(e)}}function F(e){let t=e.items.length-fa;return t<=0?e:{...e,items:e.items.slice(t)}}function N(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,r){let o=e.items.findIndex(t);if(o===-1)return e;let l=[...e.items],s=l[o],i=s.subagents??[],a=i.findIndex((c)=>c.sessionKey===n),d=r(a===-1?void 0:i[a]);if(d===void 0)return e;let m=a===-1?[...i,d].sort((c,h)=>(c.index??0)-(h.index??0)):i.map((c,h)=>h===a?d:c);return l[o]={...s,subagents:m},{...e,items:l}}var O=(e)=>(t)=>t.subagents?.some((n)=>n.sessionKey===e)===!0;function V(e,t){let n=t.sessionKey??"",r=O(n);if("slug"in t.data&&t.data.slug===Ci)return e;switch(t.type){case"tool.call":return w(e,r,n,(o)=>o===void 0?void 0:{...o,lines:[...o.lines,{callId:t.data.callId,text:`${t.data.slug} …`}]});case"tool.result":{let{slug:o,callId:l,ok:s,latencyMs:i}=t.data,a=`${o} — ${s?"ok":"failed"} · ${i} ms`;return w(e,r,n,(d)=>d===void 0?void 0:{...d,lines:d.lines.some((m)=>m.callId===l)?d.lines.map((m)=>m.callId===l?{callId:l,text:a}:m):[...d.lines,{callId:l,text:a}]})}case"tool.gated":return w(e,r,n,(o)=>o===void 0?void 0:{...o,lines:[...o.lines,{text:`${t.data.slug} — blocked: ${t.data.reason}`}]});default:return e}}function H(e,t){if(t.parentTurnId!==void 0)return V(e,t);switch(t.type){case"handoff.start":{let{kind:n,name:r,callId:o,sessionKey:l,label:s,index:i}=t.data;if(n!=="self"||o===void 0)return e;return w(e,(a)=>a.callId===o,l,(a)=>a??{name:r??"subagent",sessionKey:l,lines:[],...s===void 0?{}:{label:s},...i===void 0?{}:{index:i}})}case"handoff.result":{let{sessionKey:n,steps:r,tokens:o,outcome:l}=t.data,s=`${r} step${r===1?"":"s"} · ${yi(o.prompt+o.output)} tokens · ${l==="ok"?"ok":l.replace("_"," ")}`;return w(e,O(n),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 E(e);case"model.chunk":return N(e,t.data.kind,t.data.delta);case"tool.call":return{...p(E(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:l,truncated:s}=t.data,i=`${n} — ${o?"ok":"failed"} · ${l} ms${s?" · observation trimmed":""}`,a=e.items.findIndex((c)=>c.callId===r&&c.pending===!0);if(a===-1)return p(e,o?"tool":"error",i);let d=[...e.items],m=d[a];return d[a]={id:m.id,role:o?"tool":"error",text:i,callId:r,...m.subagents===void 0?{}:{subagents:m.subagents}},{...e,items:d}}case"tool.gated":return p(e,"note",`${t.data.slug} — blocked: ${t.data.reason}`);case"tool.repair":return p(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 p(e,"note",`retrying after HTTP ${n} — attempt ${r}, waiting ${o} ms`)}case"turn.end":{let{reason:n,steps:r,tokens:o,durationMs:l}=t.data,s={promptTokens:o.prompt,outputTokens:o.output,durationMs:l,steps:r,reason:n},i=E(e),a=e.turnFrom??0,d=-1;for(let y=i.items.length-1;y>=a;y-=1)if(i.items[y]?.role==="assistant"){d=y;break}let m=Mt(n,{steps:r,durationMs:l});if(d===-1)return{...p(i,"note",m??(n==="final"?"the model returned no text":""),{stats:s}),live:void 0,status:"idle",turnFrom:void 0};let c=[...i.items],h=c[d];c[d]={...h,stats:s};let g={...i,items:c,live:void 0,status:"idle",turnFrom:void 0};return m===void 0?g:p(g,"note",m)}case"error":{let{code:n,message:r,hint:o}=t.data;return p(e,"error",`${n}: ${r}
6
- hint: ${o}`)}case"context.dropped":{let{messages:n,budget:r}=t.data;return p(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 p(e,"note",`${n}: ${r}`)}case"context.pressure":return{...e,pressure:t.data.fraction};case"compaction.stage":{let{stage:n,changed:r,before:o,after:l}=t.data;if(!r||n!=="collapse"&&n!=="reset")return e;return p(e,"note",`context: ${n==="reset"?"the conversation so far was replaced by a summary":"earlier turns were replaced by a summary"} (${o} → ${l} tokens)`)}case"phase.changed":{let{to:n,tools:r}=t.data;return{...p(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:p(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 A;return p(A,"banner",e.join(`
7
- `))}function Wi(e,t){let n=e;for(let r of t){if(r.text.trim()==="")continue;n=p(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((l)=>l.role!=="reasoning"||t.showReasoning),o=(l)=>({...l,lead:0,continuation:!1});for(let[l,s]of r.entries()){if(l>0)n.push(o({key:`${s.id}:gap`,role:s.role,text:""}));if(s.role==="banner"){let[m="",...c]=s.text.split(`
8
- `);n.push(o({key:`${s.id}:title`,role:"banner",text:m,bold:!0}));for(let[h,g]of c.entries())for(let[y,b]of In(g,t.columns).entries())n.push({key:`${s.id}:note-${h}-${y}`,role:"banner",text:b,dim:!0,lead:0,continuation:y>0});continue}let i=ga[s.role],a=" ".repeat([...i].length),d=In(s.text,Math.max(1,t.columns-[...i].length));if(s.role==="reasoning"){let m=t.expandReasoning===!0?d.length:Math.min(d.length,Ca),c=d.length-m;n.push(o({key:`${s.id}:label`,role:"reasoning",dim:!0,text:c>0?`· reasoning · ${d.length} rows · ⌥r expands`:`· reasoning · ${d.length} row${d.length===1?"":"s"}`}));for(let[h,g]of d.slice(0,m).entries())n.push({key:`${s.id}:${h}`,role:"reasoning",text:`${a}${g}`,lead:a.length,continuation:h>0});if(c>0)n.push(o({key:`${s.id}:folded`,role:"reasoning",dim:!0,text:`${a}… ${c} more row${c===1?"":"s"}`}));continue}for(let[m,c]of d.entries())n.push({key:`${s.id}:${m}`,role:s.role,text:`${m===0?i:a}${c}`,lead:[...i].length,continuation:m>0});for(let[m,c]of(s.subagents??[]).entries()){let h=t.expandReasoning===!0,g=c.summary??"running",y=!h&&c.lines.length>0?` · ⌥r shows ${c.lines.length} call${c.lines.length===1?"":"s"}`:"",b=c.label===void 0?"":` · ${c.label}`;for(let[f,k]of In(`↳ subagent ${c.name}${b} · ${g}${y}`,Math.max(1,t.columns-a.length)).entries())n.push(o({key:`${s.id}:sub${m}-${f}`,role:s.role,text:`${a}${k}`,dim:!0}));if(h){let f=`${a} `;for(let[k,_]of c.lines.entries())for(let[I,P]of In(_.text,Math.max(1,t.columns-f.length)).entries())n.push({key:`${s.id}:sub${m}-${k}-${I}`,role:s.role,text:`${f}${P}`,dim:!0,lead:f.length,continuation:I>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};
4
+ `)}function Yi(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,d)=>Math.max(a,d.label.length),0),l=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,d)=>Math.max(a,d.label.length),0),i=e.history.length===0?[]:e.history.map((a)=>` ${a.label.padEnd(s)} ${String(a.tokens).padStart(6)} ${M(a.tokens,e.total).padStart(6)} ${String(a.messages).padStart(3)} msg`);return[p([{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 (${M(e.cache.cached,e.cache.prompt)}) over ${e.cache.turns} turn${e.cache.turns===1?"":"s"} · ${e.cache.source}`}]),""," slots",...l,...i.length===0?[]:[""," history, by kind — share of the whole prompt",...i]].join(`
5
+ `)}function M(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=st.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 A={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 E(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 Ji(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 N(e,t.of,t.text);case"event":return H(e,t.event);case"trim":return F(e)}}function F(e){let t=e.items.length-Ca;return t<=0?e:{...e,items:e.items.slice(t)}}function N(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,r){let o=e.items.findIndex(t);if(o===-1)return e;let l=[...e.items],s=l[o],i=s.subagents??[],a=i.findIndex((c)=>c.sessionKey===n),d=r(a===-1?void 0:i[a]);if(d===void 0)return e;let u=a===-1?[...i,d].sort((c,h)=>(c.index??0)-(h.index??0)):i.map((c,h)=>h===a?d:c);return l[o]={...s,subagents:u},{...e,items:l}}var O=(e)=>(t)=>t.subagents?.some((n)=>n.sessionKey===e)===!0;function V(e,t){let n=t.sessionKey??"",r=O(n);if("slug"in t.data&&t.data.slug===Ei)return e;switch(t.type){case"tool.call":return w(e,r,n,(o)=>o===void 0?void 0:{...o,lines:[...o.lines,{callId:t.data.callId,text:`${t.data.slug} …`}]});case"tool.result":{let{slug:o,callId:l,ok:s,latencyMs:i}=t.data,a=`${o} — ${s?"ok":"failed"} · ${i} ms`;return w(e,r,n,(d)=>d===void 0?void 0:{...d,lines:d.lines.some((u)=>u.callId===l)?d.lines.map((u)=>u.callId===l?{callId:l,text:a}:u):[...d.lines,{callId:l,text:a}]})}case"tool.gated":return w(e,r,n,(o)=>o===void 0?void 0:{...o,lines:[...o.lines,{text:`${t.data.slug} — blocked: ${t.data.reason}`}]});default:return e}}function H(e,t){if(t.parentTurnId!==void 0)return V(e,t);switch(t.type){case"handoff.start":{let{kind:n,name:r,callId:o,sessionKey:l,label:s,index:i}=t.data;if(n!=="self"||o===void 0)return e;return w(e,(a)=>a.callId===o,l,(a)=>a??{name:r??"subagent",sessionKey:l,lines:[],...s===void 0?{}:{label:s},...i===void 0?{}:{index:i}})}case"handoff.result":{let{sessionKey:n,steps:r,tokens:o,outcome:l}=t.data,s=`${r} step${r===1?"":"s"} · ${Bi(o.prompt+o.output)} tokens · ${l==="ok"?"ok":l.replace("_"," ")}`;return w(e,O(n),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 E(e);case"model.chunk":return N(e,t.data.kind,t.data.delta);case"tool.call":return{...m(E(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:l,truncated:s}=t.data,i=`${n} — ${o?"ok":"failed"} · ${l} ms${s?" · observation trimmed":""}`,a=e.items.findIndex((c)=>c.callId===r&&c.pending===!0);if(a===-1)return m(e,o?"tool":"error",i);let d=[...e.items],u=d[a];return d[a]={id:u.id,role:o?"tool":"error",text:i,callId:r,...u.subagents===void 0?{}:{subagents:u.subagents}},{...e,items:d}}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:l}=t.data,s={promptTokens:o.prompt,outputTokens:o.output,durationMs:l,steps:r,reason:n},i=E(e),a=e.turnFrom??0,d=-1;for(let y=i.items.length-1;y>=a;y-=1)if(i.items[y]?.role==="assistant"){d=y;break}let u=Mt(n,{steps:r,durationMs:l});if(d===-1)return{...m(i,"note",u??(n==="final"?"the model returned no text":""),{stats:s}),live:void 0,status:"idle",turnFrom:void 0};let c=[...i.items],h=c[d];c[d]={...h,stats:s};let g={...i,items:c,live:void 0,status:"idle",turnFrom:void 0};return u===void 0?g:m(g,"note",u)}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:l}=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} → ${l} 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 qi(e){if(e.length===0)return A;return m(A,"banner",e.join(`
7
+ `))}function Vi(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 Wi(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((l)=>l.role!=="reasoning"||t.showReasoning),o=(l)=>({...l,lead:0,continuation:!1});for(let[l,s]of r.entries()){if(l>0)n.push(o({key:`${s.id}:gap`,role:s.role,text:""}));if(s.role==="banner"){let[u="",...c]=s.text.split(`
8
+ `);n.push(o({key:`${s.id}:title`,role:"banner",text:u,bold:!0}));for(let[h,g]of c.entries())for(let[y,b]of In(g,t.columns).entries())n.push({key:`${s.id}:note-${h}-${y}`,role:"banner",text:b,dim:!0,lead:0,continuation:y>0});continue}let i=ga[s.role],a=" ".repeat([...i].length),d=In(s.text,Math.max(1,t.columns-[...i].length));if(s.role==="reasoning"){let u=t.expandReasoning===!0?d.length:Math.min(d.length,fa),c=d.length-u;n.push(o({key:`${s.id}:label`,role:"reasoning",dim:!0,text:c>0?`· reasoning · ${d.length} rows · ⌥r expands`:`· reasoning · ${d.length} row${d.length===1?"":"s"}`}));for(let[h,g]of d.slice(0,u).entries())n.push({key:`${s.id}:${h}`,role:"reasoning",text:`${a}${g}`,lead:a.length,continuation:h>0});if(c>0)n.push(o({key:`${s.id}:folded`,role:"reasoning",dim:!0,text:`${a}… ${c} more row${c===1?"":"s"}`}));continue}for(let[u,c]of d.entries())n.push({key:`${s.id}:${u}`,role:s.role,text:`${u===0?i:a}${c}`,lead:[...i].length,continuation:u>0});for(let[u,c]of(s.subagents??[]).entries()){let h=t.expandReasoning===!0,g=c.summary??"running",y=!h&&c.lines.length>0?` · ⌥r shows ${c.lines.length} call${c.lines.length===1?"":"s"}`:"",b=c.label===void 0?"":` · ${c.label}`;for(let[f,k]of In(`↳ subagent ${c.name}${b} · ${g}${y}`,Math.max(1,t.columns-a.length)).entries())n.push(o({key:`${s.id}:sub${u}-${f}`,role:s.role,text:`${a}${k}`,dim:!0}));if(h){let f=`${a} `;for(let[k,_]of c.lines.entries())for(let[I,P]of In(_.text,Math.max(1,t.columns-f.length)).entries())n.push({key:`${s.id}:sub${u}-${k}-${I}`,role:s.role,text:`${f}${P}`,dim:!0,lead:f.length,continuation:I>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{Hi,Ki,Hn,Kn,nn,Xo,DA,Yi,er,ji,Fr,Yn,Ji,Ur,qi,Vi,Wi,zi};
10
10
 
11
- //# debugId=4469EBE24A4D839C64756E2164756E21
12
- //# sourceMappingURL=index-1mbdz3f7.js.map
11
+ //# debugId=A4047C10CC6DF13B64756E2164756E21
12
+ //# sourceMappingURL=index-mk7hrzq7.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/**\n * The tool row `match` picks, with its subagent for `sessionKey` changed or added. Unchanged state\n * when no row matches or `change` declines.\n */\nfunction withSubagent(\n state: TranscriptState,\n match: (item: TranscriptItem) => boolean,\n sessionKey: string,\n change: (view: SubagentView | undefined) => 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 views = item.subagents ?? []\n const index = views.findIndex((view) => view.sessionKey === sessionKey)\n const view = change(index === -1 ? undefined : views[index])\n if (view === undefined) return state\n const next =\n index === -1\n ? [...views, view].sort((a, b) => (a.index ?? 0) - (b.index ?? 0))\n : views.map((existing, i) => (i === index ? view : existing))\n items[at] = { ...item, subagents: next }\n return { ...state, items }\n}\n\n/** The row holding the subagent whose session is `sessionKey`. */\nconst holds = (sessionKey: string) => (item: TranscriptItem) =>\n item.subagents?.some((view) => view.sessionKey === sessionKey) === true\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 key = event.sessionKey ?? \"\"\n const mine = holds(key)\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, key, (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, key, (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, key, (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, label, index } = event.data\n if (kind !== \"self\" || callId === undefined) return state\n return withSubagent(\n state,\n (item) => item.callId === callId,\n sessionKey,\n (view) =>\n view ?? {\n name: name ?? \"subagent\",\n sessionKey,\n lines: [],\n ...(label === undefined ? {} : { label }),\n ...(index === undefined ? {} : { index }),\n },\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(state, holds(sessionKey), sessionKey, (view) =>\n 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 call's blocks outlive its own completion: the children's lines are the point.\n ...(item.subagents === undefined ? {} : { subagents: item.subagents }),\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 for (const [b, view] of (item.subagents ?? []).entries()) {\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 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 const label = view.label === undefined ? \"\" : ` · ${view.label}`\n for (const [n, line] of wrapText(\n `↳ subagent ${view.name}${label} · ${status}${more}`,\n Math.max(1, options.columns - pad.length),\n ).entries()) {\n rows.push(\n chrome({\n key: `${item.id}:sub${b}-${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${b}-${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
  "mappings": ";mQAuCO,IAAM,EAAkD,CAC3D,CAAE,KAAM,OAAQ,KAAM,QAAS,QAAS,CAAC,EAAG,QAAS,WAAY,EACjE,CAKI,KAAM,SACN,KAAM,UACN,QAAS,CAAC,EACV,QAAS,kFACb,EACA,CAII,KAAM,UACN,KAAM,WACN,QAAS,CAAC,EACV,QACI,uFACR,EACA,CACI,KAAM,UACN,KAAM,WACN,QAAS,CAAC,EACV,QACI,sGACR,EACA,CACI,KAAM,QACN,KAAM,SACN,QAAS,CAAC,EACV,QAAS,kEACb,EACA,CAII,KAAM,MACN,KAAM,OACN,QAAS,CAAC,EACV,QACI,2GACR,EACA,CACI,KAAM,QACN,KAAM,SACN,QAAS,CAAC,EACV,QACI,kGACR,EACA,CACI,KAAM,OACN,KAAM,QACN,QAAS,CAAC,QAAS,IAAI,EAIvB,QAAS,qDACb,CACJ,EAoBa,GAAe,+CAUf,GAAmB,uDAEnB,EAA0C,CACnD,CACI,MAAO,KACP,QACI,kGACR,EACA,CAAE,MAAO,KAAM,QAAS,6DAA8D,EACtF,CAAE,MAAO,UAAW,QAAS,6BAA8B,EAC3D,CAAE,MAAO,UAAW,QAAS,kCAAmC,EAChE,CAAE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,OAAS,EACvB,eAAe,EAAK,MAAM,cAAc,EAAK,MAAM,SAAW,EAAI,GAAK,MACvE,GACJ,EAAQ,EAAK,QAAU,OAAY,GAAK,MAAM,EAAK,QACzD,QAAY,EAAG,KAAS,GACpB,cAAc,EAAK,OAAO,OAAW,IAAS,IAC9C,KAAK,IAAI,EAAG,EAAQ,QAAU,EAAI,MAAM,CAC5C,EAAE,QAAQ,EACN,EAAK,KACD,EAAO,CACH,IAAK,GAAG,EAAK,SAAS,KAAK,IAC3B,KAAM,EAAK,KACX,KAAM,GAAG,IAAM,IACf,IAAK,EACT,CAAC,CACL,EAEJ,GAAI,EAAM,CACN,IAAM,EAAQ,GAAG,MACjB,QAAY,EAAG,KAAS,EAAK,MAAM,QAAQ,EACvC,QAAY,EAAG,KAAY,GACvB,EAAK,KACL,KAAK,IAAI,EAAG,EAAQ,QAAU,EAAM,MAAM,CAC9C,EAAE,QAAQ,EACN,EAAK,KAAK,CACN,IAAK,GAAG,EAAK,SAAS,KAAK,KAAK,IAChC,KAAM,EAAK,KACX,KAAM,GAAG,IAAQ,IACjB,IAAK,GACL,KAAM,EAAM,OACZ,aAAc,EAAI,CACtB,CAAC,GAMjB,GAAI,EAAK,QAAU,QAAa,CAAC,EAAQ,MACrC,EAAK,KACD,EAAO,CACH,IAAK,GAAG,EAAK,WACb,KAAM,EAAK,KACX,KAAM,KAAK,GAAY,EAAK,KAAK,IACjC,IAAK,EACT,CAAC,CACL,EAIR,OAAO",
10
- "debugId": "4469EBE24A4D839C64756E2164756E21",
10
+ "debugId": "A4047C10CC6DF13B64756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{T,te,C,b,le,c,l,P,d,R,O,k,CA,M}from"./index-1hfece7s.js";import{lt}from"./index-jv5t63tp.js";import{u}from"./index-c74wx9pv.js";var E=u(T(),1);class Pt{static fromBase64(e){return Pt.fromBuffer(Uint8Array.from(atob(e),(t)=>t.charCodeAt(0)))}static fromBuffer(e){return new Pt(e.length).get(e,0)}constructor(e){this.len=e}get(e,t){let s=CA[l.get(e,t)];t+=4;let a=l.get(e,t);t+=4;let i=new d(a,"utf-8").get(e,t);t+=a;let r=l.get(e,t);t+=4;let p=new d(r,"utf-8").get(e,t);t+=r;let g=l.get(e,t);t+=4;let y=l.get(e,t);t+=4;let S=l.get(e,t);t+=4;let w=l.get(e,t);t+=4;let N=l.get(e,t);t+=4;let A=e.slice(t,t+N);return{type:s,format:i,description:p,width:g,height:y,colour_depth:S,indexed_color:w,data:A}}}var o={len:7,get:(e,t)=>({packetType:C.get(e,t),vorbis:new d(6,"ascii").get(e,t+1)})},F={len:23,get:(e,t)=>({version:c.get(e,t+0),channelMode:C.get(e,t+4),sampleRate:c.get(e,t+5),bitrateMax:c.get(e,t+9),bitrateNominal:c.get(e,t+13),bitrateMin:c.get(e,t+17)})};var B=u(T(),1);class m{constructor(e,t){this.data=e,this.offset=t}readInt32(){let e=c.get(this.data,this.offset);return this.offset+=4,e}readStringUtf8(){let e=this.readInt32(),t=te(this.data.subarray(this.offset,this.offset+e),"utf-8");return this.offset+=e,t}parseUserComment(){let e=this.offset,t=this.readStringUtf8(),s=t.indexOf("=");return{key:t.substring(0,s).toUpperCase(),value:t.substring(s+1),len:this.offset-e}}}var n=B.default("music-metadata:parser:ogg:vorbis1");class h extends R("Vorbis"){}class Et{constructor(e,t){this.pageSegments=[],this.durationOnLastPage=!0,this.metadata=e,this.options=t}async parsePage(e,t){if(this.lastPageHeader=e,e.headerType.firstPage)this.parseFirstPage(e,t);else{if(e.headerType.continued){if(this.pageSegments.length===0)throw new h("Cannot continue on previous page");this.pageSegments.push(t)}if(e.headerType.lastPage||!e.headerType.continued){if(this.pageSegments.length>0){let s=Et.mergeUint8Arrays(this.pageSegments);await this.parseFullPage(s)}this.pageSegments=e.headerType.lastPage?[]:[t]}}}static mergeUint8Arrays(e){let t=e.reduce((a,i)=>a+i.length,0),s=new Uint8Array(t);return e.forEach((a,i,r)=>{let p=r.slice(0,i).reduce((g,y)=>g+y.length,0);s.set(a,p)}),s}async flush(){await this.parseFullPage(Et.mergeUint8Arrays(this.pageSegments))}async parseUserComment(e,t){let a=new m(e,t).parseUserComment();return await this.addTag(a.key,a.value),a.len}async addTag(e,t){if(e==="METADATA_BLOCK_PICTURE"&&typeof t==="string"){if(this.options.skipCovers){n("Ignore picture");return}t=Pt.fromBase64(t),n(`Push picture: id=${e}, format=${t.format}`)}else n(`Push tag: id=${e}, value=${t}`);await this.metadata.addTag("vorbis",e,t)}calculateDuration(e){if(this.lastPageHeader&&(e||this.lastPageHeader.headerType.lastPage)&&this.metadata.format.sampleRate&&this.lastPageHeader.absoluteGranulePosition>=0)this.metadata.setFormat("numberOfSamples",this.lastPageHeader.absoluteGranulePosition),this.metadata.setFormat("duration",this.lastPageHeader.absoluteGranulePosition/this.metadata.format.sampleRate)}parseFirstPage(e,t){this.metadata.setFormat("codec","Vorbis I"),this.metadata.setFormat("hasAudio",!0),n("Parse first page");let s=o.get(t,0);if(s.vorbis!=="vorbis")throw new h("Metadata does not look like Vorbis");if(s.packetType===1){let a=F.get(t,o.len);this.metadata.setFormat("sampleRate",a.sampleRate),this.metadata.setFormat("bitrate",a.bitrateNominal),this.metadata.setFormat("numberOfChannels",a.channelMode),n("sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s",a.sampleRate,a.bitrateNominal,a.channelMode)}else throw new h("First Ogg page should be type 1: the identification header")}async parseFullPage(e){let t=o.get(e,0);switch(n("Parse full page: type=%s, byteLength=%s",t.packetType,e.byteLength),t.packetType){case 3:return this.parseUserCommentList(e,o.len);case 1:case 5:break}}async parseUserCommentList(e,t){let s=c.get(e,t);t+=4,t+=s;let a=c.get(e,t);t+=4;while(a-- >0)t+=await this.parseUserComment(e,t)}}var Pe={STREAMINFO:0,PADDING:1,APPLICATION:2,SEEKTABLE:3,VORBIS_COMMENT:4,CUESHEET:5,PICTURE:6},Un={len:4,get:(e,t)=>({lastBlock:O(e,t,7),type:k(e,t,1,7),length:le.get(e,t+1)})},xn={len:34,get:(e,t)=>({minimumBlockSize:b.get(e,t),maximumBlockSize:b.get(e,t+2)/1000,minimumFrameSize:le.get(e,t+4),maximumFrameSize:le.get(e,t+7),sampleRate:le.get(e,t+10)>>4,channels:k(e,t+12,4,3)+1,bitsPerSample:k(e,t+12,7,5)+1,totalSamples:k(e,t+13,4,36),fileMD5:new P(16).get(e,t+18)})};var _=E.default("music-metadata:parser:FLAC");class I extends R("FLAC"){}class Zo extends lt{constructor(){super(...arguments);this.vorbisParser=new Et(this.metadata,this.options)}async postId3v2Parse(){if((await this.tokenizer.readToken(M)).toString()!=="fLaC")throw new I("Invalid FLAC preamble");let t;do t=await this.tokenizer.readToken(Un),await this.parseDataBlock(t);while(!t.lastBlock);if(this.tokenizer.fileInfo.size&&this.metadata.format.duration){let s=this.tokenizer.fileInfo.size-this.tokenizer.position;this.metadata.setFormat("bitrate",8*s/this.metadata.format.duration)}}async parseDataBlock(e){switch(_(`blockHeader type=${e.type}, length=${e.length}`),e.type){case Pe.STREAMINFO:return this.readBlockStreamInfo(e.length);case Pe.PADDING:break;case Pe.APPLICATION:break;case Pe.SEEKTABLE:break;case Pe.VORBIS_COMMENT:return this.readComment(e.length);case Pe.CUESHEET:break;case Pe.PICTURE:await this.parsePicture(e.length);return;default:this.metadata.addWarning(`Unknown block type: ${e.type}`)}return this.tokenizer.ignore(e.length).then()}async readBlockStreamInfo(e){if(e!==xn.len)throw new I("Unexpected block-stream-info length");let t=await this.tokenizer.readToken(xn);this.metadata.setFormat("container","FLAC"),this.processsStreamInfo(t)}processsStreamInfo(e){if(this.metadata.setFormat("codec","FLAC"),this.metadata.setFormat("hasAudio",!0),this.metadata.setFormat("lossless",!0),this.metadata.setFormat("numberOfChannels",e.channels),this.metadata.setFormat("bitsPerSample",e.bitsPerSample),this.metadata.setFormat("sampleRate",e.sampleRate),e.totalSamples>0)this.metadata.setFormat("duration",e.totalSamples/e.sampleRate)}async readComment(e){let t=await this.tokenizer.readToken(new P(e));return this.parseComment(t)}async parseComment(e){let t=new m(e,0),s=t.readStringUtf8();if(s.length>0)this.metadata.setFormat("tool",s);let a=t.readInt32(),i=Array(a);for(let r=0;r<a;r++)i[r]=t.parseUserComment();await Promise.all(i.map((r)=>{if(r.key==="ENCODER")this.metadata.setFormat("tool",r.value);return this.addTag(r.key,r.value)}))}async parsePicture(e){if(this.options.skipCovers)return this.tokenizer.ignore(e);return this.addPictureTag(await this.tokenizer.readToken(new Pt(e)))}addPictureTag(e){return this.addTag("METADATA_BLOCK_PICTURE",e)}addTag(e,t){return this.vorbisParser.addTag(e,t)}}
3
+ export{Pt,Et,Pe,Un,xn,Zo};
4
+
5
+ //# debugId=883A2BF5787D606964756E2164756E21
6
+ //# sourceMappingURL=index-n0hqgwad.js.map
@@ -8,7 +8,7 @@
8
8
  "import * as Token from 'token-types';\nimport { textDecode } from '@borewit/text-codec';\nexport class VorbisDecoder {\n constructor(data, offset) {\n this.data = data;\n this.offset = offset;\n }\n readInt32() {\n const value = Token.UINT32_LE.get(this.data, this.offset);\n this.offset += 4;\n return value;\n }\n readStringUtf8() {\n const len = this.readInt32();\n const value = textDecode(this.data.subarray(this.offset, this.offset + len), 'utf-8');\n this.offset += len;\n return value;\n }\n parseUserComment() {\n const offset0 = this.offset;\n const v = this.readStringUtf8();\n const idx = v.indexOf('=');\n return {\n key: v.substring(0, idx).toUpperCase(),\n value: v.substring(idx + 1),\n len: this.offset - offset0\n };\n }\n}\n",
9
9
  "import * as util from '../common/Util.js';\nimport { UINT16_BE, UINT24_BE, Uint8ArrayType } from 'token-types';\n/**\n * FLAC supports up to 128 kinds of metadata blocks; currently the following are defined:\n * ref: https://xiph.org/flac/format.html#metadata_block\n */\nexport const BlockType = {\n STREAMINFO: 0, // STREAMINFO\n PADDING: 1, // PADDING\n APPLICATION: 2, // APPLICATION\n SEEKTABLE: 3, // SEEKTABLE\n VORBIS_COMMENT: 4, // VORBIS_COMMENT\n CUESHEET: 5, // CUESHEET\n PICTURE: 6 // PICTURE\n};\nexport const BlockHeader = {\n len: 4,\n get: (buf, off) => {\n return {\n lastBlock: util.getBit(buf, off, 7),\n type: util.getBitAllignedNumber(buf, off, 1, 7),\n length: UINT24_BE.get(buf, off + 1)\n };\n }\n};\n/**\n * METADATA_BLOCK_DATA\n * Ref: https://xiph.org/flac/format.html#metadata_block_streaminfo\n */\nexport const BlockStreamInfo = {\n len: 34,\n get: (buf, off) => {\n return {\n // The minimum block size (in samples) used in the stream.\n minimumBlockSize: UINT16_BE.get(buf, off),\n // The maximum block size (in samples) used in the stream.\n // (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.\n maximumBlockSize: UINT16_BE.get(buf, off + 2) / 1000,\n // The minimum frame size (in bytes) used in the stream.\n // May be 0 to imply the value is not known.\n minimumFrameSize: UINT24_BE.get(buf, off + 4),\n // The maximum frame size (in bytes) used in the stream.\n // May be 0 to imply the value is not known.\n maximumFrameSize: UINT24_BE.get(buf, off + 7),\n // Sample rate in Hz. Though 20 bits are available,\n // the maximum sample rate is limited by the structure of frame headers to 655350Hz.\n // Also, a value of 0 is invalid.\n sampleRate: UINT24_BE.get(buf, off + 10) >> 4,\n // probably slower: sampleRate: common.getBitAllignedNumber(buf, off + 10, 0, 20),\n // (number of channels)-1. FLAC supports from 1 to 8 channels\n channels: util.getBitAllignedNumber(buf, off + 12, 4, 3) + 1,\n // bits per sample)-1.\n // FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.\n bitsPerSample: util.getBitAllignedNumber(buf, off + 12, 7, 5) + 1,\n // Total samples in stream.\n // 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels.\n // A value of zero here means the number of total samples is unknown.\n totalSamples: util.getBitAllignedNumber(buf, off + 13, 4, 36),\n // the MD5 hash of the file (see notes for usage... it's a littly tricky)\n fileMD5: new Uint8ArrayType(16).get(buf, off + 18)\n };\n }\n};\n"
10
10
  ],
11
- "m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GAAI,EAAI,MAAQ,UACZ,KAAK,SAAS,UAAU,OAAQ,EAAI,KAAK,EAE7C,OAAO,KAAK,OAAO,EAAI,IAAK,EAAI,KAAK,EACxC,CAAC,QAEA,YAAY,CAAC,EAAS,CACxB,GAAI,KAAK,QAAQ,WACb,OAAO,KAAK,UAAU,OAAO,CAAO,EAExC,OAAO,KAAK,cAAc,MAAM,KAAK,UAAU,UAAU,IAAI,GAAmB,CAAO,CAAC,CAAC,EAE7F,aAAa,CAAC,EAAS,CACnB,OAAO,KAAK,OAAO,yBAA0B,CAAO,EAExD,MAAM,CAAC,EAAI,EAAO,CACd,OAAO,KAAK,aAAa,OAAO,EAAI,CAAK,EAEjD",
12
+ "debugId": "883A2BF5787D606964756E2164756E21",
13
13
  "names": []
14
14
  }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{Tt,mo,Qn,v}from"./index-ss77hvwy.js";import{existsSync as E,readFileSync as h}from"node:fs";import{dirname as l,join as o,resolve as u}from"node:path";function Gt(n){let e=o(l(n),".env"),r={};if(E(e))try{r=Tt(h(e,"utf8"))}catch{}return mo(r,v([n]))}function on(n,e){let r=n[e];return r!==void 0&&r!==""}function f(n,e,r={}){let i=l(n),t=u(r.cwd??process.cwd()),d=r.readDir??Qn,g=r.env??process.env,m=v([n],r),p=d(i),y=d(t),a=m[e];if(a!==void 0&&a!==""){let b=u(i)===t,c=y[e];if(!b&&c!==void 0&&g[e]===c)return{kind:"ambiguous",path:o(t,".env")};return{kind:"export"}}let s=p[e];if(s!==void 0&&s!=="")return{kind:"agent",path:o(i,".env")};return{kind:"unset"}}function Zi(n){switch(n.kind){case"export":return"from the environment, not a .env file";case"ambiguous":return"from the environment or ./.env — indistinguishable";case"agent":return;case"unset":return"not set"}}function $i(n){let e=[],r=x(n.rawModelId);if(r!==void 0)e.push({field:"model.main.id",variable:r,origin:f(n.manifestPath,r,n.options??{})});if(n.apiKeyEnv!==void 0)e.push({field:"model.main.apiKeyEnv",variable:n.apiKeyEnv,origin:f(n.manifestPath,n.apiKeyEnv,n.options??{})});return e}function x(n){if(n===void 0)return;return/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/.exec(n.trim())?.[1]}
3
+ export{Gt,on,Zi,$i};
4
+
5
+ //# debugId=15CC478BDB9A7EF964756E2164756E21
6
+ //# sourceMappingURL=index-ncb840sk.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * Whether a variable an agent depends on is actually set, from that agent's point of view.\n *\n * `ambientEnv` is **not** this. It layers the *cwd*'s `.env` against an agent's — demoting a colliding\n * variable so a project checkout cannot silently change which model a sandbox agent runs on — and it\n * returns `process.env` unchanged whenever nothing is in tension. It never *adds* the agent's own file.\n *\n * The agent's `.env` is merged by `loadManifest`, through core's `layeredEnv`, and that is the answer a\n * question about this agent needs. Reading `process.env` alone reported a variable as unset while the\n * file beside the manifest plainly had it — the same class of mistake `serve` made once, reporting\n * \"unauthenticated\" for a token sitting next to the manifest. It showed up here as an editor row that\n * still read `(not set)` immediately after somebody set it, which is the \"did that work?\" failure this\n * whole surface exists to remove.\n *\n * Precedence is core's, unchanged: the real environment wins, because an operator's export has to beat\n * a file for a container to be able to configure the agent it runs.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\"\nimport { dirname, join, resolve } from \"node:path\"\nimport { type EnvSource, layeredEnv, parseDotEnv } from \"@dispach/core\"\nimport { type AmbientOptions, ambientEnv, readDotEnv } from \"#lib/ambient\"\n\n/** The environment this agent will actually see: its own `.env` under the ambient one. */\nexport function agentEnv(manifestPath: string): EnvSource {\n const path = join(dirname(manifestPath), \".env\")\n let beside: Record<string, string> = {}\n if (existsSync(path)) {\n try {\n beside = parseDotEnv(readFileSync(path, \"utf8\"))\n } catch {\n // An unreadable `.env` is reported by the loader, in the words the loader uses. Here it\n // simply means nothing is known to be set, which is the safe reading for a \"is it set?\"\n // question — claiming a variable is present when the file cannot be read would be worse.\n }\n }\n return layeredEnv(beside, ambientEnv([manifestPath]))\n}\n\n/** Whether `name` has a non-empty value. Empty counts as unset: it fails a load exactly as absent does. */\nexport function isSet(env: EnvSource, name: string): boolean {\n const value = env[name]\n return value !== undefined && value !== \"\"\n}\n\n/**\n * Where a value came from, which is a different question from whether it is set.\n *\n * Three layers can supply one variable and the winner is not obvious from any of them:\n *\n * 1. the real environment — an operator's export, or a container's `environment:` block\n * 2. the `.env` beside the agent's manifest\n * 3. a `.env` in the directory the command was run from, demoted beneath (2) by `ambientEnv`\n *\n * Every one of those is correct on its own, and the composition is unreadable. It produced a real\n * confusion in a container: `docker compose` passes `MODEL_ID` and friends as process environment,\n * so an agent scaffolded inside that container silently ran on the *mounted*\n * agent's model, and the `0600` `.env` that `init` had just written was ignored for exactly those\n * keys — with nothing anywhere saying so.\n *\n * The precedence is not the bug and is not changed here. What was missing is a sentence, and the\n * recorded lesson from the last time this surfaced is that *a warning explained the surprise and\n * did not remove it* — so this reports rather than intervenes.\n */\nexport type EnvOrigin =\n /** The real environment won: an export, or a container's own configuration. */\n | { readonly kind: \"export\" }\n /** The `.env` beside the manifest won. */\n | { readonly kind: \"agent\"; readonly path: string }\n /**\n * Either an export or the cwd's `.env`, and **they cannot be told apart**.\n *\n * Bun auto-loads a `.env` from the current directory into `process.env` before any of this code\n * runs, so once the two agree on a string there is no evidence left distinguishing them. Said\n * rather than guessed: naming one would be a coin toss printed as a fact.\n */\n | { readonly kind: \"ambiguous\"; readonly path: string }\n | { readonly kind: \"unset\" }\n\n/**\n * Which layer supplies `name` for this agent.\n *\n * Mirrors `ambientEnv`'s precedence by *calling* it rather than by restating it — the demotion rule\n * is subtle (a cwd variable is demoted only when the agent's own file also sets it *and* the values\n * match), and a second implementation of that would drift on the first edit.\n */\nexport function sourceOf(\n manifestPath: string,\n name: string,\n options: AmbientOptions = {},\n): EnvOrigin {\n const agentDir = dirname(manifestPath)\n const cwd = resolve(options.cwd ?? process.cwd())\n const read = options.readDir ?? readDotEnv\n const raw = options.env ?? process.env\n\n const ambient = ambientEnv([manifestPath], options)\n const beside = read(agentDir)\n const inCwd = read(cwd)\n\n const fromAmbient = ambient[name]\n if (fromAmbient !== undefined && fromAmbient !== \"\") {\n // The cwd file is only a candidate when it is a *different* directory from the agent's: when\n // they are the same directory, that file **is** the agent's own and `ambientEnv` says so.\n const sameDir = resolve(agentDir) === cwd\n const cwdValue = inCwd[name]\n if (!sameDir && cwdValue !== undefined && raw[name] === cwdValue) {\n return { kind: \"ambiguous\", path: join(cwd, \".env\") }\n }\n return { kind: \"export\" }\n }\n\n const fromFile = beside[name]\n if (fromFile !== undefined && fromFile !== \"\") {\n return { kind: \"agent\", path: join(agentDir, \".env\") }\n }\n\n return { kind: \"unset\" }\n}\n\n/**\n * The phrase for a status line — short, because it rides after a value somebody is already reading.\n *\n * Returns `undefined` for the ordinary case, which is the whole point: a line that always carries a\n * provenance note is a line nobody reads it on. The agent's own `.env` winning is what an author\n * expects, so only the surprising sources say anything.\n */\nexport function describeOrigin(origin: EnvOrigin): string | undefined {\n switch (origin.kind) {\n case \"export\":\n return \"from the environment, not a .env file\"\n case \"ambiguous\":\n return \"from the environment or ./.env — indistinguishable\"\n case \"agent\":\n return undefined\n case \"unset\":\n return \"not set\"\n }\n}\n\n/** One env-backed field, the variable behind it, and where the value came from. */\nexport interface Provenance {\n readonly field: string\n readonly variable: string\n readonly origin: EnvOrigin\n}\n\n/**\n * The env-backed fields worth saying something about, and only when there is something to say.\n *\n * Two fields, chosen because they are the two that produced a real confusion in a container:\n * `docker compose` passes `MODEL_ID` and `MODEL_API_KEY` as process environment, and the ambient\n * environment deliberately beats the agent's own file so an operator can configure the agent their\n * container runs. So an agent scaffolded in that container ran on the *mounted*\n * agent's model and ignored the `0600` `.env` init had just written.\n *\n * The model id is included **only when the manifest writes it as a variable**. A generated manifest\n * carries it literally (which is why `readManifestHeader` can list agents without credentials), and\n * a literal has no provenance to report — printing \"from the environment\" about a value nothing read\n * from the environment would be worse than silence. `apiKeyEnv` is always a variable name by hard\n * rule 10, so it is always askable.\n */\nexport function envProvenance(input: {\n readonly manifestPath: string\n /** The raw, unexpanded `model.main.id` — `readManifestHeader().modelId`. */\n readonly rawModelId: string | undefined\n readonly apiKeyEnv: string | undefined\n readonly options?: AmbientOptions\n}): readonly Provenance[] {\n const rows: Provenance[] = []\n const variable = soleVariable(input.rawModelId)\n if (variable !== undefined) {\n rows.push({\n field: \"model.main.id\",\n variable,\n origin: sourceOf(input.manifestPath, variable, input.options ?? {}),\n })\n }\n if (input.apiKeyEnv !== undefined) {\n rows.push({\n field: \"model.main.apiKeyEnv\",\n variable: input.apiKeyEnv,\n origin: sourceOf(input.manifestPath, input.apiKeyEnv, input.options ?? {}),\n })\n }\n return rows\n}\n\n/**\n * The variable name when a value is exactly one `${VAR}` reference, and nothing otherwise.\n *\n * Deliberately narrow. `prefix-${VAR}` expands from the environment too, but its provenance is a\n * sentence about part of a string, and a half-true note on a compound value is the kind of detail\n * that gets believed whole.\n */\nfunction soleVariable(raw: string | undefined): string | undefined {\n if (raw === undefined) return undefined\n const match = /^\\$\\{([A-Za-z_][A-Za-z0-9_]*)\\}$/.exec(raw.trim())\n return match?.[1]\n}\n"
6
6
  ],
7
7
  "mappings": ";4CAkBA,qBAAS,kBAAY,gBACrB,kBAAS,UAAS,aAAM,kBAKjB,SAAS,EAAQ,CAAC,EAAiC,CACtD,IAAM,EAAO,EAAK,EAAQ,CAAY,EAAG,MAAM,EAC3C,EAAiC,CAAC,EACtC,GAAI,EAAW,CAAI,EACf,GAAI,CACA,EAAS,GAAY,EAAa,EAAM,MAAM,CAAC,EACjD,KAAM,EAMZ,OAAO,GAAW,EAAQ,EAAW,CAAC,CAAY,CAAC,CAAC,EAIjD,SAAS,EAAK,CAAC,EAAgB,EAAuB,CACzD,IAAM,EAAQ,EAAI,GAClB,OAAO,IAAU,QAAa,IAAU,GA4CrC,SAAS,CAAQ,CACpB,EACA,EACA,EAA0B,CAAC,EAClB,CACT,IAAM,EAAW,EAAQ,CAAY,EAC/B,EAAM,EAAQ,EAAQ,KAAO,QAA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8
+ "debugId": "15CC478BDB9A7EF964756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{be,vo}from"./index-8tmv33mr.js";import{useStdout as u}from"ink";import{useEffect as i,useState as t}from"react";function s(e){let n=e?.columns,o=e?.rows;return{columns:n===void 0||n<=0?be:n,rows:o===void 0||o<=0?vo:o}}function je(){let{stdout:e}=u(),[n,o]=t(()=>s(e));return i(()=>{if(e===void 0)return;let r=()=>o(s(e));return e.on("resize",r),()=>void e.off("resize",r)},[e]),n}
3
- export{je};
2
+ import{Me,vo}from"./index-4gfsf9n8.js";import{useStdout as u}from"ink";import{useEffect as i,useState as t}from"react";function s(e){let n=e?.columns,o=e?.rows;return{columns:n===void 0||n<=0?Me:n,rows:o===void 0||o<=0?vo:o}}function qe(){let{stdout:e}=u(),[n,o]=t(()=>s(e));return i(()=>{if(e===void 0)return;let r=()=>o(s(e));return e.on("resize",r),()=>void e.off("resize",r)},[e]),n}
3
+ export{qe};
4
4
 
5
- //# debugId=1C95E70E693A669564756E2164756E21
6
- //# sourceMappingURL=index-fbsrhcga.js.map
5
+ //# debugId=5F65D595EB0FDE5364756E2164756E21
6
+ //# sourceMappingURL=index-ntczmwnf.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * Terminal width, kept current across resizes.\n *\n * `columns` can genuinely be 0 — measured, under a pty allocated by `script -q`, which is how a real\n * TTY gets driven in a test harness. Anything dividing by the width has to survive that, so the\n * fallback is applied here rather than at each call site.\n */\n\nimport { useStdout } from \"ink\"\nimport { useEffect, useState } from \"react\"\nimport { FALLBACK_COLUMNS, FALLBACK_ROWS } from \"#lib/const\"\n\ninterface Size {\n readonly columns: number\n readonly rows: number\n}\n\n/**\n * Module-level and pure, so the resize listener has a stable identity. A reader defined inside the\n * hook would be a new function every render, which means either a stale listener or re-subscribing\n * on every frame.\n */\nfunction readSize(stdout: { columns?: number; rows?: number } | undefined): Size {\n const columns = stdout?.columns\n const rows = stdout?.rows\n return {\n columns: columns === undefined || columns <= 0 ? FALLBACK_COLUMNS : columns,\n rows: rows === undefined || rows <= 0 ? FALLBACK_ROWS : rows,\n }\n}\n\nexport function useTerminalSize(): Size {\n const { stdout } = useStdout()\n const [size, setSize] = useState(() => readSize(stdout))\n\n useEffect(() => {\n if (stdout === undefined) return\n const onResize = () => setSize(readSize(stdout))\n stdout.on(\"resize\", onResize)\n return () => void stdout.off(\"resize\", onResize)\n }, [stdout])\n\n return size\n}\n"
6
6
  ],
7
7
  "mappings": ";uCAQA,oBAAS,YACT,oBAAS,cAAW,cAapB,SAAS,CAAQ,CAAC,EAA+D,CAC7E,IAAM,EAAU,GAAQ,QAClB,EAAO,GAAQ,KACrB,MAAO,CACH,QAAS,IAAY,QAAa,GAAW,EAAI,GAAmB,EACpE,KAAM,IAAS,QAAa,GAAQ,EAAI,GAAgB,CAC5D,EAGG,SAAS,EAAe,EAAS,CACpC,IAAQ,UAAW,EAAU,GACtB,EAAM,GAAW,EAAS,IAAM,EAAS,CAAM,CAAC,EASvD,OAPA,EAAU,IAAM,CACZ,GAAI,IAAW,OAAW,OAC1B,IAAM,EAAW,IAAM,EAAQ,EAAS,CAAM,CAAC,EAE/C,OADA,EAAO,GAAG,SAAU,CAAQ,EACrB,IAAM,KAAK,EAAO,IAAI,SAAU,CAAQ,GAChD,CAAC,CAAM,CAAC,EAEJ",
8
- "debugId": "1C95E70E693A669564756E2164756E21",
8
+ "debugId": "5F65D595EB0FDE5364756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import{createInterface as w}from"node:readline";async function MA(u,o={}){let e=o.input??process.stdin,r=o.output??process.stdout;if(e.isTTY!==!0)return!1;let i=w({input:e,output:r});try{let s=await new Promise((t)=>{i.question(`
3
- ${u} [y/N] `,t)});return/^y(es)?$/i.test(s.trim())}finally{i.close()}}async function ts(u,o,e={}){let r=e.input??process.stdin,i=e.output??process.stdout;if(r.isTTY!==!0)return!1;let s=w({input:r,output:i});try{return(await new Promise((a)=>{s.question(`
3
+ ${u} [y/N] `,t)});return/^y(es)?$/i.test(s.trim())}finally{i.close()}}async function es(u,o,e={}){let r=e.input??process.stdin,i=e.output??process.stdout;if(r.isTTY!==!0)return!1;let s=w({input:r,output:i});try{return(await new Promise((a)=>{s.question(`
4
4
  ${u} `,a)})).trim()===o}finally{s.close()}}async function Zn(u,o={}){let e=o.input??process.stdin,r=o.output??process.stdout;if(e.isTTY!==!0)return;r.write(`
5
5
  ${u} `);let i=typeof e.setRawMode==="function";if(i)e.setRawMode?.(!0);e.resume?.();try{return await new Promise((s)=>{let t="",a=!1,d=!1,l=(f)=>{e.removeListener("data",p),r.write(`
6
6
  `),s(f)},p=(f)=>{let m=typeof f==="string"?f:f.toString("utf8");for(let c of m){let n=c.charCodeAt(0);if(d){if(n>=64&&n<=126)d=!1;continue}if(a){if(a=!1,c==="["||c==="O")d=!0;continue}if(n===27){a=!0;continue}if(n===13||n===10)return l(t);if(n===3)return l(void 0);if(n===4)return l(t===""?void 0:t);if(n===127||n===8){if(t.length>0)t=t.slice(0,-1),r.write("\b \b");continue}if(n<32)continue;t+=c,r.write("*")}};e.on("data",p)})}finally{if(i)e.setRawMode?.(!1)}}
7
- export{MA,ts,Zn};
7
+ export{MA,es,Zn};
8
8
 
9
- //# debugId=53D6C51D513B5AF964756E2164756E21
10
- //# sourceMappingURL=index-095hrkyr.js.map
9
+ //# debugId=2AFA5AD3E847794064756E2164756E21
10
+ //# sourceMappingURL=index-p5gy5s7p.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * A yes/no question on the plain path.\n *\n * One question, one place. The wizard has its own confirm *screen* under Ink and the picker has a\n * selection; what was missing was the shape a single command needs before doing something outside its\n * own workspace — and the only current caller, `terminal-setup`, is the only command that does that.\n *\n * **Not a TTY means no.** A piped or CI run cannot answer, so the safe answer is the one that changes\n * nothing — and the caller reports that nothing was written rather than treating it as a failure.\n * Defaulting to yes here would make a redirected invocation edit somebody's editor keybindings, which is\n * the kind of surprise that is only discovered later.\n *\n * Deliberately not a general prompt library. A second kind of question can have a second function; a\n * configurable one would grow options nobody needs and hide the TTY rule above inside them. There are\n * three now — `askExactly` is a different bar, and `askSecret` is a different *channel*, because a\n * value that must not be echoed cannot go through readline at all.\n */\n\nimport { createInterface } from \"node:readline\"\n\nexport interface ConfirmOptions {\n /** Injected by tests. The process streams otherwise. */\n readonly input?: NodeJS.ReadableStream & { isTTY?: boolean }\n readonly output?: NodeJS.WritableStream\n}\n\nexport async function askYesNo(question: string, options: ConfirmOptions = {}): Promise<boolean> {\n const input = options.input ?? process.stdin\n const output = options.output ?? process.stdout\n if (input.isTTY !== true) return false\n\n const rl = createInterface({ input, output })\n try {\n const answer = await new Promise<string>((resolve) => {\n rl.question(`\\n${question} [y/N] `, resolve)\n })\n return /^y(es)?$/i.test(answer.trim())\n } finally {\n // Always closed: a readline left open holds the event loop and the process never exits.\n rl.close()\n }\n}\n\n/**\n * A question answered only by typing something back exactly.\n *\n * The bar for an irreversible, multi-part deletion. `askYesNo` is one keypress, which is right for\n * \"shall I edit your keybindings\" and too cheap for \"delete this agent, its conversations and its\n * memory\" — a stray `y` against the wrong listing is a mistake with nothing to undo it, and the whole\n * point of showing the listing first is that somebody reads it. Typing the name is what proves they did.\n *\n * Compared after trimming and nothing else. Case is **not** folded: an agent's ref is the name of a\n * directory, so `Milo` and `milo` are two different agents on a case-sensitive filesystem, and\n * accepting either here would accept the wrong one somewhere else.\n *\n * Not a TTY means no, for the reason `askYesNo` has it: a piped or CI run cannot answer, and the safe\n * answer is the one that changes nothing. The caller reports that nothing was deleted, and `--yes` is\n * how a script says it meant it.\n */\nexport async function askExactly(\n question: string,\n expected: string,\n options: ConfirmOptions = {},\n): Promise<boolean> {\n const input = options.input ?? process.stdin\n const output = options.output ?? process.stdout\n if (input.isTTY !== true) return false\n\n const rl = createInterface({ input, output })\n try {\n const answer = await new Promise<string>((resolve) => {\n rl.question(`\\n${question} `, resolve)\n })\n return answer.trim() === expected\n } finally {\n rl.close()\n }\n}\n\n/**\n * A value typed at a prompt and never echoed. `undefined` means cancelled or unavailable.\n *\n * ## Why this is not readline\n *\n * readline echoes what it reads, and the documented way to stop it is to overwrite a private method on\n * the interface — which needs a cast this codebase does not allow. Reading the bytes is a dozen more\n * lines and it is the honest version: raw mode on, one `*` written per character, raw mode off in a\n * `finally` so a thrown error cannot leave the terminal unable to echo anything the person types next.\n *\n * ## Why a secret never comes from an argument\n *\n * The alternative was `--value`, and it puts the secret in two places nobody intends: the shell's\n * history file, and `ps` output, where every local process can read it for the lifetime of the call.\n * That is the same exposure `renderPlist` throws to prevent — launchd echoes a job's environment in\n * plaintext, so a plist carries no secret — and the reasoning does not change because the process is\n * short-lived. Not a TTY returns `undefined` rather than reading a pipe, so a CI run is *told* that\n * nothing was written instead of a secret arriving from somewhere the caller did not audit.\n *\n * ^C cancels and ^D on an empty line cancels; both return `undefined`, and the caller reports that\n * nothing changed. Backspace is honoured because a mistyped key in a value you cannot see is otherwise\n * unrecoverable without starting the command again.\n */\n/**\n * The narrow surface `askSecret` touches, rather than a widened `ConfirmOptions.input`.\n *\n * `process.stdin`'s declared `on` is a union of overloads, and intersecting that with an object type\n * makes it uncallable — the compiler cannot pick a signature. Declaring only what is used and asserting\n * the real stream against it once keeps the check where it is useful: anything else this function\n * reached for would be a type error here rather than a runtime surprise.\n */\nexport interface SecretInput {\n readonly isTTY?: boolean\n setRawMode?: (mode: boolean) => unknown\n resume?: () => unknown\n on(event: \"data\", listener: (chunk: Buffer | string) => void): unknown\n removeListener(event: \"data\", listener: (chunk: Buffer | string) => void): unknown\n}\n\nexport interface SecretOptions {\n readonly input?: SecretInput\n readonly output?: NodeJS.WritableStream\n}\n\nexport async function askSecret(\n question: string,\n options: SecretOptions = {},\n): Promise<string | undefined> {\n const input = options.input ?? (process.stdin as unknown as SecretInput)\n const output = options.output ?? process.stdout\n if (input.isTTY !== true) return undefined\n\n output.write(`\\n${question} `)\n const raw = typeof input.setRawMode === \"function\"\n if (raw) input.setRawMode?.(true)\n input.resume?.()\n\n try {\n return await new Promise<string | undefined>((resolve) => {\n let value = \"\"\n // Escape-sequence state. Dropping only the escape *byte* left `[A` in the value for an\n // arrow key — two characters of junk in a string nobody can see, which is worse than three\n // because it looks like nothing happened. CSI runs until a byte in 0x40–0x7e ends it.\n let escaped = false\n let csi = false\n const finish = (result: string | undefined) => {\n input.removeListener(\"data\", onData)\n output.write(\"\\n\")\n resolve(result)\n }\n const onData = (chunk: Buffer | string) => {\n const text = typeof chunk === \"string\" ? chunk : chunk.toString(\"utf8\")\n for (const char of text) {\n const code = char.charCodeAt(0)\n if (csi) {\n // The final byte of a CSI sequence, and the end of it.\n if (code >= 0x40 && code <= 0x7e) csi = false\n continue\n }\n if (escaped) {\n escaped = false\n // `[` opens CSI and `O` opens SS3, which is how some terminals send arrows.\n if (char === \"[\" || char === \"O\") csi = true\n continue\n }\n if (code === 27) {\n escaped = true\n continue\n }\n if (code === 13 || code === 10) return finish(value)\n // ^C always cancels; ^D cancels only an empty line, so it cannot silently\n // truncate a value somebody was halfway through typing.\n if (code === 3) return finish(undefined)\n if (code === 4) return finish(value === \"\" ? undefined : value)\n if (code === 127 || code === 8) {\n if (value.length > 0) {\n value = value.slice(0, -1)\n output.write(\"\\b \\b\")\n }\n continue\n }\n // Any remaining control byte is a chord, and a secret has none in it.\n if (code < 32) continue\n value += char\n output.write(\"*\")\n }\n }\n input.on(\"data\", onData)\n })\n } finally {\n // Always restored. A thrown error that left raw mode on would leave the shell that follows\n // unable to echo anything at all, which reads as a hung terminal rather than a failed command.\n if (raw) input.setRawMode?.(false)\n }\n}\n"
6
6
  ],
7
7
  "mappings": ";AAkBA,0BAAS,sBAQF,eAAe,EAAQ,CAAC,EAAkB,EAA0B,CAAC,EAAqB,CAC7F,IAAM,EAAQ,EAAQ,OAAS,QAAQ,MACjC,EAAS,EAAQ,QAAU,QAAQ,OACzC,GAAI,EAAM,QAAU,GAAM,MAAO,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