dispach 0.2.0 → 0.2.1

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 (167) hide show
  1. package/README.md +58 -18
  2. package/dist/APEv2Parser-9wqew3zv.js +5 -0
  3. package/dist/{APEv2Parser-jdp5yp24.js.map → APEv2Parser-9wqew3zv.js.map} +1 -1
  4. package/dist/{AiffParser-n65syezh.js → AiffParser-tbx3xkmk.js} +3 -3
  5. package/dist/{AiffParser-n65syezh.js.map → AiffParser-tbx3xkmk.js.map} +1 -1
  6. package/dist/App-hjn867nc.js +11 -0
  7. package/dist/{App-pmqmzsb3.js.map → App-hjn867nc.js.map} +1 -1
  8. package/dist/{AsfParser-da1fqvxz.js → AsfParser-d784ak3y.js} +3 -3
  9. package/dist/{AsfParser-da1fqvxz.js.map → AsfParser-d784ak3y.js.map} +1 -1
  10. package/dist/{ConfigEditor-4nqbeejh.js → ConfigEditor-g7eb2wsm.js} +3 -3
  11. package/dist/{ConfigEditor-4nqbeejh.js.map → ConfigEditor-g7eb2wsm.js.map} +1 -1
  12. package/dist/{DsdiffParser-gk95sj7t.js → DsdiffParser-vxnfx80c.js} +2 -2
  13. package/dist/{DsfParser-b0enevjw.js → DsfParser-0xsh0zzk.js} +3 -3
  14. package/dist/{DsfParser-b0enevjw.js.map → DsfParser-0xsh0zzk.js.map} +1 -1
  15. package/dist/FlacParser-bf8y3e0w.js +5 -0
  16. package/dist/{KeyProbe-rspsxpsr.js → KeyProbe-w8c37s9q.js} +3 -3
  17. package/dist/{KeyProbe-rspsxpsr.js.map → KeyProbe-w8c37s9q.js.map} +1 -1
  18. package/dist/{MP4Parser-ph7rv2fn.js → MP4Parser-tq7r7wd4.js} +3 -3
  19. package/dist/{MP4Parser-ph7rv2fn.js.map → MP4Parser-tq7r7wd4.js.map} +1 -1
  20. package/dist/{MatroskaParser-fjk1mpct.js → MatroskaParser-a79gsmzb.js} +3 -3
  21. package/dist/{MatroskaParser-fjk1mpct.js.map → MatroskaParser-a79gsmzb.js.map} +1 -1
  22. package/dist/{MpegParser-vp7cj8ts.js → MpegParser-zs61b3wq.js} +3 -3
  23. package/dist/{MpegParser-vp7cj8ts.js.map → MpegParser-zs61b3wq.js.map} +1 -1
  24. package/dist/{MusepackParser-v22gft1f.js → MusepackParser-bp8dm6nz.js} +3 -3
  25. package/dist/{MusepackParser-v22gft1f.js.map → MusepackParser-bp8dm6nz.js.map} +1 -1
  26. package/dist/{OggParser-as1m8xsa.js → OggParser-7pxr1sn9.js} +3 -3
  27. package/dist/{OggParser-as1m8xsa.js.map → OggParser-7pxr1sn9.js.map} +1 -1
  28. package/dist/{Picker-jkmd5xnx.js → Picker-b09hr4tk.js} +3 -3
  29. package/dist/{Picker-jkmd5xnx.js.map → Picker-b09hr4tk.js.map} +1 -1
  30. package/dist/{SessionPicker-3712ke3k.js → SessionPicker-wtfxwdxg.js} +3 -3
  31. package/dist/{SessionPicker-3712ke3k.js.map → SessionPicker-wtfxwdxg.js.map} +1 -1
  32. package/dist/{SkillBrowser-qhsyszt4.js → SkillBrowser-p9ht63c7.js} +3 -3
  33. package/dist/{SkillBrowser-qhsyszt4.js.map → SkillBrowser-p9ht63c7.js.map} +1 -1
  34. package/dist/{WavPackParser-b4qqavzg.js → WavPackParser-gpf3r92t.js} +3 -3
  35. package/dist/{WavPackParser-b4qqavzg.js.map → WavPackParser-gpf3r92t.js.map} +1 -1
  36. package/dist/{WaveParser-fqs1h38f.js → WaveParser-3kcak550.js} +3 -3
  37. package/dist/{WaveParser-fqs1h38f.js.map → WaveParser-3kcak550.js.map} +1 -1
  38. package/dist/WizardApp-494018sk.js +5 -0
  39. package/dist/{WizardApp-qrq36nv8.js.map → WizardApp-494018sk.js.map} +1 -1
  40. package/dist/{channels-gf31stv7.js → channels-yhdvxxrb.js} +14 -14
  41. package/dist/{channels-gf31stv7.js.map → channels-yhdvxxrb.js.map} +1 -1
  42. package/dist/config-g0ybmm4t.js +24 -0
  43. package/dist/{config-z2cd0c5f.js.map → config-g0ybmm4t.js.map} +1 -1
  44. package/dist/credential-pkme1sfe.js +19 -0
  45. package/dist/{credential-h0wmsjsw.js.map → credential-pkme1sfe.js.map} +1 -1
  46. package/dist/{index-dwxmy0kx.js → index-0mz7wpbw.js} +6 -6
  47. package/dist/{index-dwxmy0kx.js.map → index-0mz7wpbw.js.map} +1 -1
  48. package/dist/{index-fcqy46mh.js → index-0pddq849.js} +25 -25
  49. package/dist/{index-fcqy46mh.js.map → index-0pddq849.js.map} +1 -1
  50. package/dist/{index-2yj11ykt.js → index-1f1erzfx.js} +4 -4
  51. package/dist/{index-2yj11ykt.js.map → index-1f1erzfx.js.map} +1 -1
  52. package/dist/{index-1h9pqnec.js → index-26ejkp8q.js} +189 -189
  53. package/dist/{index-1h9pqnec.js.map → index-26ejkp8q.js.map} +7 -7
  54. package/dist/{index-ccpq4k6r.js → index-307qmvb0.js} +25 -25
  55. package/dist/{index-ccpq4k6r.js.map → index-307qmvb0.js.map} +1 -1
  56. package/dist/index-3b3h8kyh.js +5 -0
  57. package/dist/{index-3mvenfbg.js.map → index-3b3h8kyh.js.map} +1 -1
  58. package/dist/{index-0p9p6fvc.js → index-3fgq1acj.js} +10 -10
  59. package/dist/{index-0p9p6fvc.js.map → index-3fgq1acj.js.map} +3 -3
  60. package/dist/{index-dh2g58s1.js → index-4emtktc0.js} +3 -3
  61. package/dist/{index-dh2g58s1.js.map → index-4emtktc0.js.map} +1 -1
  62. package/dist/{index-026q0y3a.js → index-4t3p7vm9.js} +4 -4
  63. package/dist/{index-026q0y3a.js.map → index-4t3p7vm9.js.map} +1 -1
  64. package/dist/{index-t5d8ey5t.js → index-5m9wydxb.js} +4 -4
  65. package/dist/{index-t5d8ey5t.js.map → index-5m9wydxb.js.map} +1 -1
  66. package/dist/{index-g1d06ct5.js → index-633eqxry.js} +7 -7
  67. package/dist/{index-g1d06ct5.js.map → index-633eqxry.js.map} +1 -1
  68. package/dist/index-6r9h7ftn.js +308 -0
  69. package/dist/index-6r9h7ftn.js.map +21 -0
  70. package/dist/{index-kktaw552.js → index-7gsbzvnc.js} +2 -2
  71. package/dist/{index-z88f35vs.js → index-94k4mh6s.js} +13 -13
  72. package/dist/{index-z88f35vs.js.map → index-94k4mh6s.js.map} +3 -3
  73. package/dist/index-9dmgk6d3.js +5 -0
  74. package/dist/{index-tny7c703.js.map → index-9dmgk6d3.js.map} +1 -1
  75. package/dist/index-9qv87rq7.js +9 -0
  76. package/dist/{index-s4a28ctb.js.map → index-9qv87rq7.js.map} +1 -1
  77. package/dist/{index-k2q76dhw.js → index-a6mtqkth.js} +6 -6
  78. package/dist/{index-k2q76dhw.js.map → index-a6mtqkth.js.map} +1 -1
  79. package/dist/{index-0m0x1454.js → index-ac2wzspd.js} +4 -4
  80. package/dist/{index-0m0x1454.js.map → index-ac2wzspd.js.map} +1 -1
  81. package/dist/{index-wxmqyv4c.js → index-ad5c9t83.js} +4 -4
  82. package/dist/{index-wxmqyv4c.js.map → index-ad5c9t83.js.map} +1 -1
  83. package/dist/{index-b7qc21s7.js → index-akv6e7ge.js} +6 -6
  84. package/dist/{index-b7qc21s7.js.map → index-akv6e7ge.js.map} +1 -1
  85. package/dist/{index-v271gbaz.js → index-ec101x93.js} +4 -4
  86. package/dist/{index-v271gbaz.js.map → index-ec101x93.js.map} +1 -1
  87. package/dist/{index-rhv6gqpt.js → index-f056wkb4.js} +4 -4
  88. package/dist/{index-rhv6gqpt.js.map → index-f056wkb4.js.map} +1 -1
  89. package/dist/{index-c2qjdz4q.js → index-gqaa06yh.js} +8 -8
  90. package/dist/{index-c2qjdz4q.js.map → index-gqaa06yh.js.map} +1 -1
  91. package/dist/{index-rfa0ztab.js → index-j20k6k0m.js} +4 -4
  92. package/dist/{index-rfa0ztab.js.map → index-j20k6k0m.js.map} +1 -1
  93. package/dist/{index-2pzgta33.js → index-jh2az41t.js} +4 -4
  94. package/dist/{index-2pzgta33.js.map → index-jh2az41t.js.map} +1 -1
  95. package/dist/{index-gace5ac7.js → index-mn34kj95.js} +4 -4
  96. package/dist/{index-gace5ac7.js.map → index-mn34kj95.js.map} +1 -1
  97. package/dist/{index-rvq7t636.js → index-myg5enf5.js} +2 -2
  98. package/dist/{index-s78sq9g1.js → index-pdsey1ab.js} +45 -45
  99. package/dist/{index-s78sq9g1.js.map → index-pdsey1ab.js.map} +1 -1
  100. package/dist/{index-jmnjcw61.js → index-psk6q25h.js} +4 -4
  101. package/dist/{index-jmnjcw61.js.map → index-psk6q25h.js.map} +1 -1
  102. package/dist/{index-3s2q0m64.js → index-q8b1fc3k.js} +4 -4
  103. package/dist/{index-3s2q0m64.js.map → index-q8b1fc3k.js.map} +1 -1
  104. package/dist/{index-g8n8rhtr.js → index-qh82wtpa.js} +3 -3
  105. package/dist/{index-g8n8rhtr.js.map → index-qh82wtpa.js.map} +1 -1
  106. package/dist/{index-gqbny9gy.js → index-s2tzq27a.js} +6 -6
  107. package/dist/{index-gqbny9gy.js.map → index-s2tzq27a.js.map} +1 -1
  108. package/dist/{index-1wxw30j1.js → index-s57ztjhq.js} +35 -35
  109. package/dist/index-s57ztjhq.js.map +13 -0
  110. package/dist/{index-jv7egrh2.js → index-skkddg44.js} +4 -4
  111. package/dist/{index-jv7egrh2.js.map → index-skkddg44.js.map} +1 -1
  112. package/dist/{index-9m6b14b4.js → index-thmq816c.js} +4 -4
  113. package/dist/{index-9m6b14b4.js.map → index-thmq816c.js.map} +1 -1
  114. package/dist/{index-es4bgkbh.js → index-trx9xb59.js} +6 -6
  115. package/dist/{index-es4bgkbh.js.map → index-trx9xb59.js.map} +1 -1
  116. package/dist/{index-60jxyzbe.js → index-twcgf73h.js} +4 -4
  117. package/dist/{index-60jxyzbe.js.map → index-twcgf73h.js.map} +1 -1
  118. package/dist/index-vw2hf4d8.js +6 -0
  119. package/dist/{index-v6taf4vn.js.map → index-vw2hf4d8.js.map} +1 -1
  120. package/dist/{index-m5rmhcez.js → index-w97gprre.js} +4 -4
  121. package/dist/{index-m5rmhcez.js.map → index-w97gprre.js.map} +1 -1
  122. package/dist/index-wk6andxq.js +5 -0
  123. package/dist/{index-ak304afj.js.map → index-wk6andxq.js.map} +1 -1
  124. package/dist/index-x9z2xnct.js +11 -0
  125. package/dist/{index-5nprb9px.js.map → index-x9z2xnct.js.map} +1 -1
  126. package/dist/index-xa9crtzq.js +6 -0
  127. package/dist/{index-qe3ybzh6.js.map → index-xa9crtzq.js.map} +1 -1
  128. package/dist/{index-0v2gw4mk.js → index-y34s71qe.js} +3 -3
  129. package/dist/{index-0v2gw4mk.js.map → index-y34s71qe.js.map} +1 -1
  130. package/dist/{index-y6r1k2yd.js → index-ye2yb3xf.js} +7 -7
  131. package/dist/{index-y6r1k2yd.js.map → index-ye2yb3xf.js.map} +1 -1
  132. package/dist/{index-y605a1rj.js → index-z0dgxd7d.js} +10 -10
  133. package/dist/{index-y605a1rj.js.map → index-z0dgxd7d.js.map} +2 -2
  134. package/dist/{index-m01mb74d.js → index-zg89tq04.js} +4 -4
  135. package/dist/{index-m01mb74d.js.map → index-zg89tq04.js.map} +1 -1
  136. package/dist/{index-dgrwpzz9.js → index-zjphh8ch.js} +4 -4
  137. package/dist/{index-dgrwpzz9.js.map → index-zjphh8ch.js.map} +1 -1
  138. package/dist/index.js +172 -172
  139. package/dist/index.js.map +4 -4
  140. package/dist/transcript.d.ts.map +1 -1
  141. package/dist/web-f6869dy2.js +14 -0
  142. package/dist/{web-stkkwyka.js.map → web-f6869dy2.js.map} +1 -1
  143. package/dist/wrapper-52c0vacs.js +5 -0
  144. package/dist/{wrapper-bwxbqa53.js.map → wrapper-52c0vacs.js.map} +1 -1
  145. package/package.json +2 -2
  146. package/dist/APEv2Parser-jdp5yp24.js +0 -5
  147. package/dist/App-pmqmzsb3.js +0 -11
  148. package/dist/FlacParser-6jwner07.js +0 -5
  149. package/dist/WizardApp-qrq36nv8.js +0 -5
  150. package/dist/config-z2cd0c5f.js +0 -24
  151. package/dist/credential-h0wmsjsw.js +0 -19
  152. package/dist/index-1wxw30j1.js.map +0 -13
  153. package/dist/index-358nsn9t.js +0 -65
  154. package/dist/index-358nsn9t.js.map +0 -21
  155. package/dist/index-3mvenfbg.js +0 -5
  156. package/dist/index-5nprb9px.js +0 -11
  157. package/dist/index-ak304afj.js +0 -5
  158. package/dist/index-qe3ybzh6.js +0 -6
  159. package/dist/index-s4a28ctb.js +0 -9
  160. package/dist/index-tny7c703.js +0 -5
  161. package/dist/index-v6taf4vn.js +0 -6
  162. package/dist/web-stkkwyka.js +0 -14
  163. package/dist/wrapper-bwxbqa53.js +0 -5
  164. /package/dist/{DsdiffParser-gk95sj7t.js.map → DsdiffParser-vxnfx80c.js.map} +0 -0
  165. /package/dist/{FlacParser-6jwner07.js.map → FlacParser-bf8y3e0w.js.map} +0 -0
  166. /package/dist/{index-kktaw552.js.map → index-7gsbzvnc.js.map} +0 -0
  167. /package/dist/{index-rvq7t636.js.map → index-myg5enf5.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{spawn as s,spawnSync as f}from"node:child_process";function ds(n){let e=f(n.command,[...n.args],{encoding:"utf8",...n.input===void 0?{}:{input:n.input},...n.cwd===void 0?{}:{cwd:n.cwd},...n.env===void 0?{}:{env:n.env},...n.timeoutMs===void 0?{}:{timeout:n.timeoutMs},...n.maxBuffer===void 0?{}:{maxBuffer:n.maxBuffer}}),d=e.error?.code;return{code:e.status??1,stdout:e.stdout??"",stderr:e.stderr??"",signalled:e.signal!==null,notFound:d==="ENOENT"}}function wA(n){return new Promise((e)=>{let d=s(n.command,[...n.args],{...n.cwd===void 0?{}:{cwd:n.cwd},...n.env===void 0?{}:{env:n.env},stdio:[n.input===void 0?"ignore":"pipe","pipe","pipe"]});if(n.input!==void 0)d.stdin?.end(n.input);let t="",a="",r=!1,u=n.maxBuffer??33554432;d.stdout?.on("data",(o)=>{if(t.length<u)t+=o.toString("utf8")}),d.stderr?.on("data",(o)=>{if(a.length<u)a+=o.toString("utf8")});let i=n.timeoutMs===void 0?void 0:setTimeout(()=>{r=!0,d.kill("SIGTERM")},n.timeoutMs);d.on("error",(o)=>{if(i!==void 0)clearTimeout(i);e({code:1,stdout:t,stderr:o.message,signalled:r,notFound:o.code==="ENOENT"})}),d.on("close",(o,l)=>{if(i!==void 0)clearTimeout(i);e({code:o??1,stdout:t,stderr:a,signalled:r||l!==null,notFound:!1})})})}
3
- export{ds,wA};
2
+ import{spawn as s,spawnSync as f}from"node:child_process";function us(n){let e=f(n.command,[...n.args],{encoding:"utf8",...n.input===void 0?{}:{input:n.input},...n.cwd===void 0?{}:{cwd:n.cwd},...n.env===void 0?{}:{env:n.env},...n.timeoutMs===void 0?{}:{timeout:n.timeoutMs},...n.maxBuffer===void 0?{}:{maxBuffer:n.maxBuffer}}),d=e.error?.code;return{code:e.status??1,stdout:e.stdout??"",stderr:e.stderr??"",signalled:e.signal!==null,notFound:d==="ENOENT"}}function wt(n){return new Promise((e)=>{let d=s(n.command,[...n.args],{...n.cwd===void 0?{}:{cwd:n.cwd},...n.env===void 0?{}:{env:n.env},stdio:[n.input===void 0?"ignore":"pipe","pipe","pipe"]});if(n.input!==void 0)d.stdin?.end(n.input);let t="",a="",r=!1,u=n.maxBuffer??33554432;d.stdout?.on("data",(o)=>{if(t.length<u)t+=o.toString("utf8")}),d.stderr?.on("data",(o)=>{if(a.length<u)a+=o.toString("utf8")});let i=n.timeoutMs===void 0?void 0:setTimeout(()=>{r=!0,d.kill("SIGTERM")},n.timeoutMs);d.on("error",(o)=>{if(i!==void 0)clearTimeout(i);e({code:1,stdout:t,stderr:o.message,signalled:r,notFound:o.code==="ENOENT"})}),d.on("close",(o,l)=>{if(i!==void 0)clearTimeout(i);e({code:o??1,stdout:t,stderr:a,signalled:r||l!==null,notFound:!1})})})}
3
+ export{us,wt};
4
4
 
5
- //# debugId=107B0DFE4BC01F6F64756E2164756E21
6
- //# sourceMappingURL=index-jv7egrh2.js.map
5
+ //# debugId=75EEC3ABE68DAD2964756E2164756E21
6
+ //# sourceMappingURL=index-skkddg44.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * The one place in this package that starts a process.\n *\n * There were two callers before this file existed and the second one is what created it: `lib/service.ts`\n * ran `launchctl`, and fetching a skill source needs `git`. The rule the boundaries test enforces is\n * \"exactly one module imports `node:child_process`\", and its stated reason is that a second call site is a\n * second place a test has to intercept — the first one that forgets reaches somebody's real machine. Two\n * callers of one seam keeps that property; an allowlist with two entries in it loses it, and would go on\n * losing it once per phase.\n *\n * Deliberately thin, and deliberately not clever. Everything specific to a tool — git's four ways of\n * being told not to prompt, launchd's exit-status decoding — belongs to the caller that knows about it.\n * What lives here is \"run this, capture what it said, and tell me honestly how it ended\".\n *\n * `notFound` is a field rather than an exception because the two callers want different sentences for it:\n * a missing `git` has a remedy the person can act on, and a missing `launchctl` means this is not the\n * operating system the caller thought it was. A shared error message would be wrong for both.\n */\n\nimport { spawn, spawnSync } from \"node:child_process\"\n\nexport interface SpawnRequest {\n readonly command: string\n readonly args: readonly string[]\n readonly cwd?: string\n /** Replaces the environment entirely when given. Callers spread `process.env` themselves. */\n readonly env?: Readonly<Record<string, string | undefined>>\n readonly timeoutMs?: number\n readonly maxBuffer?: number\n /**\n * Text to write to the child's stdin, which is then closed.\n *\n * Added for the clipboard: `pbcopy` reads what it copies from stdin and there is no argument form. The\n * alternative was a temporary file, which puts whatever was selected on disk — and a selection is\n * routinely the most sensitive thing on the screen. The seam grows rather than the caller working\n * around it, per the rule about first-party code not getting private escape hatches.\n */\n readonly input?: string\n}\n\nexport interface SpawnResult {\n readonly code: number\n readonly stdout: string\n readonly stderr: string\n /** True when a timeout or a signal ended it, rather than the process choosing to exit. */\n readonly signalled: boolean\n /** True when the command is not on PATH at all. */\n readonly notFound: boolean\n}\n\nexport function spawnCapture(request: SpawnRequest): SpawnResult {\n const result = spawnSync(request.command, [...request.args], {\n encoding: \"utf8\",\n ...(request.input === undefined ? {} : { input: request.input }),\n ...(request.cwd === undefined ? {} : { cwd: request.cwd }),\n ...(request.env === undefined ? {} : { env: request.env as NodeJS.ProcessEnv }),\n ...(request.timeoutMs === undefined ? {} : { timeout: request.timeoutMs }),\n ...(request.maxBuffer === undefined ? {} : { maxBuffer: request.maxBuffer }),\n })\n const code = (result.error as NodeJS.ErrnoException | undefined)?.code\n return {\n code: result.status ?? 1,\n stdout: result.stdout ?? \"\",\n stderr: result.stderr ?? \"\",\n signalled: result.signal !== null,\n notFound: code === \"ENOENT\",\n }\n}\n\n/**\n * The same thing, without blocking the event loop.\n *\n * Exists because `spawnSync` inside an Ink app freezes the whole terminal: no spinner frame advances, and\n * the keypresses that arrive during a twenty-second `git clone` are echoed by the tty instead of being\n * consumed by the app — which is how `^[[B^[[A` ended up printed in the middle of a fetch progress line.\n * Anything a rendered screen waits on has to be awaited, not blocked on.\n */\nexport function spawnCaptureAsync(request: SpawnRequest): Promise<SpawnResult> {\n return new Promise((resolve) => {\n const child = spawn(request.command, [...request.args], {\n ...(request.cwd === undefined ? {} : { cwd: request.cwd }),\n ...(request.env === undefined ? {} : { env: request.env as NodeJS.ProcessEnv }),\n // Never inherit: a child that writes to the terminal would paint over the rendered frame, and\n // one that reads from it would steal the keys the app is listening for.\n // A pipe only when there is something to write. `ignore` otherwise, for the reason below.\n stdio: [request.input === undefined ? \"ignore\" : \"pipe\", \"pipe\", \"pipe\"],\n })\n if (request.input !== undefined) {\n // Ended immediately: a child reading stdin waits for EOF, so a pipe left open is a process\n // that never exits and a promise that never settles.\n child.stdin?.end(request.input)\n }\n let stdout = \"\"\n let stderr = \"\"\n let signalled = false\n const cap = request.maxBuffer ?? 32 * 1024 * 1024\n child.stdout?.on(\"data\", (chunk: Buffer) => {\n if (stdout.length < cap) stdout += chunk.toString(\"utf8\")\n })\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n if (stderr.length < cap) stderr += chunk.toString(\"utf8\")\n })\n const timer =\n request.timeoutMs === undefined\n ? undefined\n : setTimeout(() => {\n signalled = true\n // The group, not the pid: `git clone` spawns helpers, and killing only the parent\n // leaves them running with nothing referencing them.\n child.kill(\"SIGTERM\")\n }, request.timeoutMs)\n child.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (timer !== undefined) clearTimeout(timer)\n resolve({\n code: 1,\n stdout,\n stderr: error.message,\n signalled,\n notFound: error.code === \"ENOENT\",\n })\n })\n child.on(\"close\", (code, signal) => {\n if (timer !== undefined) clearTimeout(timer)\n resolve({\n code: code ?? 1,\n stdout,\n stderr,\n signalled: signalled || signal !== null,\n notFound: false,\n })\n })\n })\n}\n"
6
6
  ],
7
7
  "mappings": ";AAmBA,gBAAS,eAAO,2BA+BT,SAAS,EAAY,CAAC,EAAoC,CAC7D,IAAM,EAAS,EAAU,EAAQ,QAAS,CAAC,GAAG,EAAQ,IAAI,EAAG,CACzD,SAAU,UACN,EAAQ,QAAU,OAAY,CAAC,EAAI,CAAE,MAAO,EAAQ,KAAM,KAC1D,EAAQ,MAAQ,OAAY,CAAC,EAAI,CAAE,IAAK,EAAQ,GAAI,KACpD,EAAQ,MAAQ,OAAY,CAAC,EAAI,CAAE,IAAK,EAAQ,GAAyB,KACzE,EAAQ,YAAc,OAAY,CAAC,EAAI,CAAE,QAAS,EAAQ,SAAU,KACpE,EAAQ,YAAc,OAAY,CAAC,EAAI,CAAE,UAAW,EAAQ,SAAU,CAC9E,CAAC,EACK,EAAQ,EAAO,OAA6C,KAClE,MAAO,CACH,KAAM,EAAO,QAAU,EACvB,OAAQ,EAAO,QAAU,GACzB,OAAQ,EAAO,QAAU,GACzB,UAAW,EAAO,SAAW,KAC7B,SAAU,IAAS,QACvB,EAWG,SAAS,EAAiB,CAAC,EAA6C,CAC3E,OAAO,IAAI,QAAQ,CAAC,IAAY,CAC5B,IAAM,EAAQ,EAAM,EAAQ,QAAS,CAAC,GAAG,EAAQ,IAAI,EAAG,IAChD,EAAQ,MAAQ,OAAY,CAAC,EAAI,CAAE,IAAK,EAAQ,GAAI,KACpD,EAAQ,MAAQ,OAAY,CAAC,EAAI,CAAE,IAAK,EAAQ,GAAyB,EAI7E,MAAO,CAAC,EAAQ,QAAU,OAAY,SAAW,OAAQ,OAAQ,MAAM,CAC3E,CAAC,EACD,GAAI,EAAQ,QAAU,OAGlB,EAAM,OAAO,IAAI,EAAQ,KAAK,EAElC,IAAI,EAAS,GACT,EAAS,GACT,EAAY,GACV,EAAM,EAAQ,WAAa,SACjC,EAAM,QAAQ,GAAG,OAAQ,CAAC,IAAkB,CACxC,GAAI,EAAO,OAAS,EAAK,GAAU,EAAM,SAAS,MAAM,EAC3D,EACD,EAAM,QAAQ,GAAG,OAAQ,CAAC,IAAkB,CACxC,GAAI,EAAO,OAAS,EAAK,GAAU,EAAM,SAAS,MAAM,EAC3D,EACD,IAAM,EACF,EAAQ,YAAc,OAChB,OACA,WAAW,IAAM,CACb,EAAY,GAGZ,EAAM,KAAK,SAAS,GACrB,EAAQ,SAAS,EAC9B,EAAM,GAAG,QAAS,CAAC,IAAiC,CAChD,GAAI,IAAU,OAAW,aAAa,CAAK,EAC3C,EAAQ,CACJ,KAAM,EACN,SACA,OAAQ,EAAM,QACd,YACA,SAAU,EAAM,OAAS,QAC7B,CAAC,EACJ,EACD,EAAM,GAAG,QAAS,CAAC,EAAM,IAAW,CAChC,GAAI,IAAU,OAAW,aAAa,CAAK,EAC3C,EAAQ,CACJ,KAAM,GAAQ,EACd,SACA,SACA,UAAW,GAAa,IAAW,KACnC,SAAU,EACd,CAAC,EACJ,EACJ",
8
- "debugId": "107B0DFE4BC01F6F64756E2164756E21",
8
+ "debugId": "75EEC3ABE68DAD2964756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{Ws}from"./index-3s2q0m64.js";var c=[{title:"Specs and planning",skills:["prd","breakdown-feature-prd","breakdown-epic-pm","breakdown-feature-implementation","breakdown-plan","create-implementation-plan","create-specification","create-architectural-decision-record","create-technical-spike"]},{title:"Documents",skills:["create-readme","create-tldr-page","documentation-writer","convert-plaintext-to-md","markdown-to-html"]},{title:"Communications",skills:["meeting-minutes","email-drafter","linkedin-post-formatter","daily-prep"]},{title:"Go to market",skills:["gtm-0-to-1-launch","gtm-board-and-investor-communication","gtm-enterprise-account-planning","gtm-enterprise-onboarding","gtm-operating-cadence","gtm-partnership-architecture","gtm-positioning-strategy","gtm-product-led-growth","gtm-technical-product-pricing","gtm-developer-ecosystem"]},{title:"Team and process",skills:["mentoring-juniors","impediment-prioritization","quality-playbook"]},{title:"Diagrams",skills:["napkin","excalidraw-diagram-generator","draw-io-diagram-generator","plantuml-ascii"]},{title:"Prompt craft and research",skills:["boost-prompt","autoresearch"]}],Us=c.flatMap((e)=>e.skills);function u(e){return c.find((n)=>n.skills.includes(e))?.title}function m(e,n){let t=n.filter((a)=>a.problem===void 0);if(e.curated===void 0)return t;let r=new Set(e.curated);return t.filter((a)=>r.has(a.skill)||r.has(g(a.repoPath)))}function g(e){let n=e.lastIndexOf("/");return n===-1?e:e.slice(n+1)}function xs(e){let n=[];for(let t of e){let r=m(t.spec,t.entries);if(r.length===0)continue;let a=new Set(t.installed??[]);n.push({kind:"source",label:`${t.spec.name} ${r.length} skill${r.length===1?"":"s"}`});let s=new Map,d=[];for(let o of r){let i=t.spec.curated===void 0?void 0:u(o.skill);if(i===void 0)d.push(o);else{let l=s.get(i);if(l===void 0)s.set(i,[o]);else l.push(o)}}for(let o of d)n.push(p(o,a));for(let[o,i]of s){n.push({kind:"group",label:o});for(let l of i)n.push(p(l,a))}}return n}function p(e,n){return{kind:"item",label:e.skill,meta:Ws(e.tokens,e.scripts.length,n.has(e.skill)),description:f(e.description),entry:e}}function f(e){let n=e.replace(/\s+/g," ").trim(),t=n.search(/\.\s/);return t===-1?n:n.slice(0,t+1)}function jt(e){return e.map((n)=>n.kind==="item")}function Oo(e,n){return n.map((t)=>e[t]?.entry).filter((t)=>t!==void 0)}function hn(e){let n=e.filter((t)=>t.ok);return{installed:n.map((t)=>t.name),failed:e.filter((t)=>!t.ok).map((t)=>({name:t.name,reason:t.reason??"not installed"})),runnable:n.reduce((t,r)=>t+r.runnable.length,0),withCode:n.filter((t)=>t.runnable.length>0).length,total:e.length}}
3
- export{Us,xs,jt,Oo,hn};
2
+ import{Ws}from"./index-q8b1fc3k.js";var c=[{title:"Specs and planning",skills:["prd","breakdown-feature-prd","breakdown-epic-pm","breakdown-feature-implementation","breakdown-plan","create-implementation-plan","create-specification","create-architectural-decision-record","create-technical-spike"]},{title:"Documents",skills:["create-readme","create-tldr-page","documentation-writer","convert-plaintext-to-md","markdown-to-html"]},{title:"Communications",skills:["meeting-minutes","email-drafter","linkedin-post-formatter","daily-prep"]},{title:"Go to market",skills:["gtm-0-to-1-launch","gtm-board-and-investor-communication","gtm-enterprise-account-planning","gtm-enterprise-onboarding","gtm-operating-cadence","gtm-partnership-architecture","gtm-positioning-strategy","gtm-product-led-growth","gtm-technical-product-pricing","gtm-developer-ecosystem"]},{title:"Team and process",skills:["mentoring-juniors","impediment-prioritization","quality-playbook"]},{title:"Diagrams",skills:["napkin","excalidraw-diagram-generator","draw-io-diagram-generator","plantuml-ascii"]},{title:"Prompt craft and research",skills:["boost-prompt","autoresearch"]}],Us=c.flatMap((e)=>e.skills);function u(e){return c.find((n)=>n.skills.includes(e))?.title}function m(e,n){let t=n.filter((a)=>a.problem===void 0);if(e.curated===void 0)return t;let r=new Set(e.curated);return t.filter((a)=>r.has(a.skill)||r.has(g(a.repoPath)))}function g(e){let n=e.lastIndexOf("/");return n===-1?e:e.slice(n+1)}function xs(e){let n=[];for(let t of e){let r=m(t.spec,t.entries);if(r.length===0)continue;let a=new Set(t.installed??[]);n.push({kind:"source",label:`${t.spec.name} ${r.length} skill${r.length===1?"":"s"}`});let s=new Map,d=[];for(let o of r){let i=t.spec.curated===void 0?void 0:u(o.skill);if(i===void 0)d.push(o);else{let l=s.get(i);if(l===void 0)s.set(i,[o]);else l.push(o)}}for(let o of d)n.push(p(o,a));for(let[o,i]of s){n.push({kind:"group",label:o});for(let l of i)n.push(p(l,a))}}return n}function p(e,n){return{kind:"item",label:e.skill,meta:Ws(e.tokens,e.scripts.length,n.has(e.skill)),description:f(e.description),entry:e}}function f(e){let n=e.replace(/\s+/g," ").trim(),t=n.search(/\.\s/);return t===-1?n:n.slice(0,t+1)}function jA(e){return e.map((n)=>n.kind==="item")}function Oo(e,n){return n.map((t)=>e[t]?.entry).filter((t)=>t!==void 0)}function Bn(e){let n=e.filter((t)=>t.ok);return{installed:n.map((t)=>t.name),failed:e.filter((t)=>!t.ok).map((t)=>({name:t.name,reason:t.reason??"not installed"})),runnable:n.reduce((t,r)=>t+r.runnable.length,0),withCode:n.filter((t)=>t.runnable.length>0).length,total:e.length}}
3
+ export{Us,xs,jA,Oo,Bn};
4
4
 
5
- //# debugId=766562EF80602F2164756E2164756E21
6
- //# sourceMappingURL=index-9m6b14b4.js.map
5
+ //# debugId=6165020D7DD3032B64756E2164756E21
6
+ //# sourceMappingURL=index-thmq816c.js.map
@@ -6,6 +6,6 @@
6
6
  "/**\n * The browse list: a curated catalogue turned into rows, and rows turned back into skills.\n *\n * Pure and PURE-listed. The screen root renders it and the plain path prints it, so the *shape* of the\n * list — which sources appear, in what order, under which headings, with what shown beside each entry —\n * is decided once here and asserted without mounting Ink or reaching a network.\n *\n * Keeping this separate from the component is what makes `--plain` honest: a terminal and a pipe print\n * the same list because both read the same rows, rather than the plain path reimplementing the ordering\n * and drifting the first time a group is added.\n */\n\nimport { curatedGroupOf } from \"#lib/curated\"\nimport { metaOf } from \"#lib/rows\"\nimport type { CatalogueEntry } from \"#lib/source-cache\"\nimport type { SourceSpec } from \"#lib/sources\"\n\nexport interface BrowseRow {\n /** `source` is a top-level heading, `group` a subheading; neither is selectable. */\n readonly kind: \"source\" | \"group\" | \"item\"\n readonly label: string\n /** Its own column, not appended to the label — the row is laid out, not concatenated. */\n readonly meta?: string\n readonly description?: string\n /** The skill this row installs. Absent on a heading. */\n readonly entry?: CatalogueEntry\n}\n\n/**\n * A source's entries, filtered by its curation and grouped for display.\n *\n * Curation is applied *here* rather than in `readCatalogue`, so `sources search` keeps seeing everything.\n * A curated list is a recommendation; a search that could not find a named skill would be a restriction.\n */\nexport function curatedEntries(\n spec: SourceSpec,\n entries: readonly CatalogueEntry[],\n): readonly CatalogueEntry[] {\n const usable = entries.filter((entry) => entry.problem === undefined)\n if (spec.curated === undefined) return usable\n const allowed = new Set(spec.curated)\n // Matched on the *folder* name, which is what a curated list is written in terms of — and which the\n // spec requires to equal the frontmatter name, so either would work today and the folder is the one\n // that stays true if upstream renames the skill inside the file.\n return usable.filter(\n (entry) => allowed.has(entry.skill) || allowed.has(basename(entry.repoPath)),\n )\n}\n\nfunction basename(path: string): string {\n const cut = path.lastIndexOf(\"/\")\n return cut === -1 ? path : path.slice(cut + 1)\n}\n\nexport interface BrowseInput {\n readonly spec: SourceSpec\n readonly entries: readonly CatalogueEntry[]\n /** Already installed in the target agent, shown as such rather than offered twice. */\n readonly installed?: readonly string[]\n}\n\n/**\n * Every row, in display order: one heading per source, then per curated group where the source has them.\n *\n * An installed skill is listed with a note rather than removed, because a list whose contents change\n * depending on which agent you picked is one you cannot learn.\n */\nexport function browseRows(inputs: readonly BrowseInput[]): readonly BrowseRow[] {\n const rows: BrowseRow[] = []\n for (const input of inputs) {\n const entries = curatedEntries(input.spec, input.entries)\n if (entries.length === 0) continue\n const installed = new Set(input.installed ?? [])\n\n rows.push({\n kind: \"source\",\n label: `${input.spec.name} ${entries.length} skill${entries.length === 1 ? \"\" : \"s\"}`,\n })\n\n // Grouped where the curation defines groups, flat otherwise. `anthropics/skills` is 17 broadly\n // useful entries and inventing categories for it would be editorialising about somebody else's\n // catalogue; `awesome-copilot` is 425 and the groups are why it is legible at all.\n const grouped = new Map<string, CatalogueEntry[]>()\n const ungrouped: CatalogueEntry[] = []\n for (const entry of entries) {\n const group = input.spec.curated === undefined ? undefined : curatedGroupOf(entry.skill)\n if (group === undefined) ungrouped.push(entry)\n else {\n const bucket = grouped.get(group)\n if (bucket === undefined) grouped.set(group, [entry])\n else bucket.push(entry)\n }\n }\n\n for (const entry of ungrouped) rows.push(itemRow(entry, installed))\n for (const [title, bucket] of grouped) {\n rows.push({ kind: \"group\", label: title })\n for (const entry of bucket) rows.push(itemRow(entry, installed))\n }\n }\n return rows\n}\n\nfunction itemRow(entry: CatalogueEntry, installed: ReadonlySet<string>): BrowseRow {\n return {\n kind: \"item\",\n label: entry.skill,\n // The script count is on the row because it is the one fact that should change somebody's mind\n // before ticking a box: a skill with runnable files is code that will run on this machine.\n meta: metaOf(entry.tokens, entry.scripts.length, installed.has(entry.skill)),\n description: summarise(entry.description),\n entry,\n }\n}\n\n/**\n * First sentence, uncapped.\n *\n * The *column* decides the visible width now, in `lib/rows.ts`, so capping here as well would truncate\n * twice — once at 96 characters and again at whatever the terminal has left, which is how a wide terminal\n * ends up showing a short description with an ellipsis and empty space after it.\n */\nexport function summarise(description: string): string {\n const flat = description.replace(/\\s+/g, \" \").trim()\n const stop = flat.search(/\\.\\s/)\n return stop === -1 ? flat : flat.slice(0, stop + 1)\n}\n\n/** Which rows the cursor may land on, for the multi-select reducer. */\nexport function selectableOf(rows: readonly BrowseRow[]): readonly boolean[] {\n return rows.map((row) => row.kind === \"item\")\n}\n\n/** The skills behind a set of chosen row indices, in the order they appear on screen. */\nexport function chosenEntries(\n rows: readonly BrowseRow[],\n chosen: readonly number[],\n): readonly CatalogueEntry[] {\n return chosen\n .map((index) => rows[index]?.entry)\n .filter((entry): entry is CatalogueEntry => entry !== undefined)\n}\n\n// ─── what an install did ─────────────────────────────────────────────────────────────────\n\n/**\n * The structural half of `skills.ts`'s `InstallOutcome`.\n *\n * Declared here rather than imported so this module stays free of the command that produces it —\n * `skills.ts` reaches the filesystem, and importing it would drag that into every consumer of the row\n * layout, including the pure tests.\n */\nexport interface InstallOutcomeLike {\n readonly name: string\n readonly ok: boolean\n readonly reason?: string\n readonly runnable: readonly string[]\n}\n\nexport interface InstallReport {\n readonly installed: readonly string[]\n readonly failed: readonly { readonly name: string; readonly reason: string }[]\n /** Runnable files across every successful install, and how many skills brought them. */\n readonly runnable: number\n readonly withCode: number\n readonly total: number\n}\n\n/**\n * One report for a batch, as data.\n *\n * Both renderings read this — the text one the pipe and `init` print, and the card the browser shows\n * inside its own frame. The alternative was each composing its own summary from the outcomes, and a\n * terminal and a pipe disagreeing about what happened is exactly the class of failure the shared\n * `browseRows` was introduced to end.\n */\nexport function installReport(outcomes: readonly InstallOutcomeLike[]): InstallReport {\n const ok = outcomes.filter((outcome) => outcome.ok)\n return {\n installed: ok.map((outcome) => outcome.name),\n failed: outcomes\n .filter((outcome) => !outcome.ok)\n .map((outcome) => ({ name: outcome.name, reason: outcome.reason ?? \"not installed\" })),\n runnable: ok.reduce((count, outcome) => count + outcome.runnable.length, 0),\n withCode: ok.filter((outcome) => outcome.runnable.length > 0).length,\n total: outcomes.length,\n }\n}\n"
7
7
  ],
8
8
  "mappings": ";oCAmCO,IAAM,EAA6C,CACtD,CACI,MAAO,qBACP,OAAQ,CACJ,MACA,wBACA,oBACA,mCACA,iBACA,6BACA,uBACA,uCACA,wBACJ,CACJ,EACA,CACI,MAAO,YACP,OAAQ,CACJ,gBACA,mBACA,uBACA,0BACA,kBACJ,CACJ,EACA,CACI,MAAO,iBACP,OAAQ,CAAC,kBAAmB,gBAAiB,0BAA2B,YAAY,CACxF,EACA,CACI,MAAO,eACP,OAAQ,CACJ,oBACA,uCACA,kCACA,4BACA,wBACA,+BACA,2BACA,yBACA,gCACA,yBACJ,CACJ,EACA,CACI,MAAO,mBACP,OAAQ,CAAC,oBAAqB,4BAA6B,kBAAkB,CACjF,EACA,CACI,MAAO,WACP,OAAQ,CACJ,SACA,+BACA,4BACA,gBACJ,CACJ,EACA,CAGI,MAAO,4BACP,OAAQ,CAAC,eAAgB,cAAc,CAC3C,CACJ,EAGa,GAA8C,EAAkB,QACzE,CAAC,IAAU,EAAM,MACrB,EAQO,SAAS,CAAc,CAAC,EAAmC,CAC9D,OAAO,EAAkB,KAAK,CAAC,IAAU,EAAM,OAAO,SAAS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-1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{qs}from"./index-v7mz396x.js";import{$s}from"./index-rfa0ztab.js";import{aa,Ci}from"./index-v6taf4vn.js";var Be={value:"",cursor:0,history:[],historyOffset:0,draft:"",past:[],future:[],search:void 0,anchor:void 0};function c(r){return[...r]}function u(r,e){return Math.max(0,Math.min(r,e))}function h(r){return{value:r.value,cursor:r.cursor}}function d(r,e){let n=r.past.at(-1);if(e.coalesce&&n!==void 0&&r.future.length===0)return{...r,future:[]};if(n!==void 0&&n.value===r.value)return{...r,future:[]};return{...r,past:[...r.past,h(r)].slice(-Ci),future:[]}}function a(r,e){return{...r,value:e,cursor:c(e).length}}function k(r,e){let n=d(r,{coalesce:!e.includes(`
2
+ import{qs}from"./index-v7mz396x.js";import{$s}from"./index-j20k6k0m.js";import{aa,Ci}from"./index-vw2hf4d8.js";var he={value:"",cursor:0,history:[],historyOffset:0,draft:"",past:[],future:[],search:void 0,anchor:void 0};function c(r){return[...r]}function u(r,e){return Math.max(0,Math.min(r,e))}function h(r){return{value:r.value,cursor:r.cursor}}function d(r,e){let n=r.past.at(-1);if(e.coalesce&&n!==void 0&&r.future.length===0)return{...r,future:[]};if(n!==void 0&&n.value===r.value)return{...r,future:[]};return{...r,past:[...r.past,h(r)].slice(-Ci),future:[]}}function a(r,e){return{...r,value:e,cursor:c(e).length}}function k(r,e){let n=d(r,{coalesce:!e.includes(`
3
3
  `)}),o=c(n.value),t=u(n.cursor,o.length),i=[...o.slice(0,t),...c(e),...o.slice(t)];return{...n,value:i.join(""),cursor:t+c(e).length}}function E(r){let e=c(r.value),n=u(r.cursor,e.length);if(n===0)return r;let o=d(r,{coalesce:!1}),t=[...e.slice(0,n-1),...e.slice(n)];return{...o,value:t.join(""),cursor:n-1}}function y(r){let e=c(r.value),n=u(r.cursor,e.length);if(n>=e.length)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(n+1)].join("")}}function f(r){return r===void 0||/\s/.test(r)}function v(r,e){let n=e;while(n>0&&f(r[n-1]))n-=1;while(n>0&&!f(r[n-1]))n-=1;return n}function b(r,e){let n=e;while(n<r.length&&f(r[n]))n+=1;while(n<r.length&&!f(r[n]))n+=1;return n}function x(r){let e=c(r.value),n=v(e,u(r.cursor,e.length));if(n===r.cursor)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(r.cursor)].join(""),cursor:n}}function A(r){let e=c(r.value),n=u(r.cursor,e.length),o=b(e,n);if(o===n)return r;return{...d(r,{coalesce:!1}),value:[...e.slice(0,n),...e.slice(o)].join("")}}function l(r,e){let n=c(r),o=u(e,n.length),t=o;while(t>0&&n[t-1]!==`
4
4
  `)t-=1;let i=o;while(i<n.length&&n[i]!==`
5
5
  `)i+=1;return{start:t,end:i}}function Vo(r){let e=c(r.value),n=u(r.cursor,e.length),o=e.slice(0,n),{start:t}=l(r.value,n);return{line:o.filter((i)=>i===`
6
6
  `).length,lines:e.filter((i)=>i===`
7
- `).length+1,column:n-t}}function p(r,e){let n=c(r.value),o=u(r.cursor,n.length),t=l(r.value,o),i=o-t.start;if(e<0){if(t.start===0)return r;let m=l(r.value,t.start-1);return{...r,cursor:Math.min(m.start+i,m.end)}}if(t.end>=n.length)return r;let s=l(r.value,t.end+1);return{...r,cursor:Math.min(s.start+i,s.end)}}function L(r){if(r.history.length===0)return r;let e=Math.min(r.historyOffset+1,r.history.length),n=r.history[r.history.length-e];if(n===void 0)return r;return a({...d(r,{coalesce:!1}),historyOffset:e,draft:r.historyOffset===0?r.value:r.draft},n)}function I(r){if(r.historyOffset===0)return r;let e=r.historyOffset-1,n=d(r,{coalesce:!1});if(e===0)return a({...n,historyOffset:0},r.draft);let o=r.history[r.history.length-e];return o===void 0?r:a({...n,historyOffset:e},o)}function Xt(r){let e=(r.search?.query??"").toLowerCase(),n=new Set,o=[];for(let t=r.history.length-1;t>=0;t-=1){let i=r.history[t];if(i===void 0||n.has(i))continue;if(e===""||i.toLowerCase().includes(e))n.add(i),o.push(i)}return o}function C(r){let e=Xt(r);return e[u(r.search?.index??0,Math.max(0,e.length-1))]}function g(r,e){let n=r.search;if(n===void 0)return r;let o=Xt(r);if(o.length===0)return r;return{...r,search:{...n,index:u(n.index+e,o.length-1)}}}function T(r,e){let n=r.search;if(n===void 0)return r;return{...r,search:{query:n.query+e,index:0}}}function M(r){let e=r.search;if(e===void 0)return r;let n=c(e.query).slice(0,-1).join("");return{...r,search:{query:n,index:0}}}function O(r){let e=C(r);if(e===void 0)return{...r,search:void 0};return a({...d(r,{coalesce:!1}),search:void 0},e)}function K(r){let e=r.past.at(-1);if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:r.past.slice(0,-1),future:[h(r),...r.future],historyOffset:0}}function j(r){let e=r.future[0];if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:[...r.past,h(r)].slice(-Ci),future:r.future.slice(1)}}function mt(r){if(r.anchor===void 0||r.anchor===r.cursor)return;return r.anchor<r.cursor?{start:r.anchor,end:r.cursor}:{start:r.cursor,end:r.anchor}}function w(r){let e=mt(r);if(e===void 0)return{...r,anchor:void 0};let n=c(r.value);return{...d(r,{coalesce:!1}),value:[...n.slice(0,e.start),...n.slice(e.end)].join(""),cursor:e.start,anchor:void 0}}function R(r){return r.kind==="insert"||r.kind==="newline"||r.kind==="backspace"||r.kind==="delete"}function Le(r,e){if(r.search===void 0&&R(e)&&mt(r)!==void 0){let o=w(r);if(e.kind==="backspace"||e.kind==="delete")return o;return Le(o,e)}if(e.kind==="extend"){let o=r.anchor??r.cursor;return{...Le({...r,anchor:void 0},{kind:e.to}),anchor:o}}if(e.kind==="cutSelection")return w(r);if(e.kind==="copySelection")return r;if(e.kind==="selectAll")return{...r,anchor:0,cursor:c(r.value).length};let n=W(r,e);return n.anchor===void 0?n:{...n,anchor:void 0}}function W(r,e){if(r.search!==void 0)switch(e.kind){case"insert":return T(r,e.text);case"backspace":return M(r);case"historyPrev":case"lineUp":return g(r,1);case"historyNext":case"lineDown":return g(r,-1);case"searchAccept":return O(r);case"searchCancel":return{...r,search:void 0};case"searchOpen":return r;default:return{...r,search:void 0}}switch(e.kind){case"insert":return k(r,e.text);case"newline":return k(r,`
8
- `);case"backspace":return E(r);case"delete":return y(r);case"cursorLeft":return{...r,cursor:u(r.cursor-1,c(r.value).length)};case"cursorRight":return{...r,cursor:u(r.cursor+1,c(r.value).length)};case"cursorHome":return{...r,cursor:l(r.value,r.cursor).start};case"cursorEnd":return{...r,cursor:l(r.value,r.cursor).end};case"bufferStart":return{...r,cursor:0};case"bufferEnd":return{...r,cursor:c(r.value).length};case"wordLeft":return{...r,cursor:v(c(r.value),r.cursor)};case"wordRight":return{...r,cursor:b(c(r.value),r.cursor)};case"lineUp":return p(r,-1);case"lineDown":return p(r,1);case"killToStart":{let{start:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,n),...o.slice(r.cursor)].join(""),cursor:n}}case"killToEnd":{let{end:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,r.cursor),...o.slice(n)].join("")}}case"killWord":return x(r);case"killWordForward":return A(r);case"historyPrev":return L(r);case"historyNext":return I(r);case"undo":return K(r);case"redo":return j(r);case"searchOpen":return{...r,search:{query:"",index:0}};case"searchAccept":case"searchCancel":case"submit":case"cancel":case"exit":case"arm":case"scroll":case"pointer":case"reasoning":case"paste":case"none":return r;case"extend":case"selectAll":case"copySelection":case"cutSelection":return r}}function ki(r){let e=r.value.trim();if(e==="")return{text:"",state:{...Be,history:r.history}};let o=r.history.at(-1)===e?r.history:[...r.history,e].slice(-aa);return{text:e,state:{...Be,history:o}}}function Ln(r,e,n={}){let{line:o,lines:t}=Vo(r);return{busy:e,empty:r.value==="",firstLine:o===0,lastLine:o===t-1,searching:r.search!==void 0,armed:n.armed??!1,scrolled:n.scrolled??!1}}function D(r,e){switch(r){case"c":if(e.searching)return{kind:"searchCancel"};if(e.busy)return{kind:"cancel"};return e.armed?{kind:"exit"}:{kind:"arm"};case"d":return e.empty?{kind:"exit"}:{kind:"delete"};case"a":return{kind:"cursorHome"};case"e":return{kind:"cursorEnd"};case"b":return{kind:"cursorLeft"};case"f":return{kind:"cursorRight"};case"u":return{kind:"killToStart"};case"k":return{kind:"killToEnd"};case"w":return{kind:"killWord"};case"p":return{kind:"historyPrev"};case"n":return{kind:"historyNext"};case"r":return{kind:"searchOpen"};case"o":return{kind:"reasoning"};case"z":return{kind:"undo"};case"y":return{kind:"redo"};default:return{kind:"none"}}}function $t(r,e,n){let o=$s(r);if(o!==void 0){if(o.rows!==0)return{kind:"scroll",move:o.rows<0?"up":"down",times:Math.abs(o.rows)};if(o.at!==void 0&&o.kind!==void 0&&o.kind!=="wheel")return{kind:"pointer",gesture:o.kind,column:o.at.column,row:o.at.row,shift:o.shift===!0};return{kind:"none"}}if(e.eventType==="release")return{kind:"none"};if(e.shift){let i=H(e);if(i!==void 0)return{kind:"extend",to:i}}if(e.super){if(e.leftArrow)return{kind:"cursorHome"};if(e.rightArrow)return{kind:"cursorEnd"};if(e.upArrow)return{kind:"bufferStart"};if(e.downArrow)return{kind:"bufferEnd"};if(e.backspace)return{kind:"killToStart"};if(e.delete)return{kind:"killToEnd"};if(r==="z")return e.shift?{kind:"redo"}:{kind:"undo"};if(r==="a")return{kind:"selectAll"};if(r==="c")return{kind:"copySelection"};if(r==="x")return{kind:"cutSelection"};return{kind:"none"}}if(qs(r))return{kind:"none"};if(e.ctrl&&e.leftArrow)return{kind:"wordLeft"};if(e.ctrl&&e.rightArrow)return{kind:"wordRight"};if(e.ctrl&&e.backspace)return{kind:"killWord"};if(e.ctrl)return D(r.toLowerCase(),n);if(e.meta){if(e.return)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"top"};if(e.pageDown)return{kind:"scroll",move:"bottom"};if(e.upArrow)return{kind:"scroll",move:"up"};if(e.downArrow)return{kind:"scroll",move:"down"};if(e.leftArrow||r==="b")return{kind:"wordLeft"};if(e.rightArrow||r==="f")return{kind:"wordRight"};if(e.backspace)return{kind:"killWord"};if(r==="d")return{kind:"killWordForward"};if(r==="r")return{kind:"reasoning"};return{kind:"none"}}if(e.return&&e.shift)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"pageUp"};if(e.pageDown)return{kind:"scroll",move:"pageDown"};if(e.home)return{kind:"cursorHome"};if(e.end)return{kind:"cursorEnd"};if(e.return)return n.searching?{kind:"searchAccept"}:{kind:"submit"};if(e.backspace)return{kind:"backspace"};if(e.delete)return{kind:"delete"};if(e.leftArrow)return{kind:"cursorLeft"};if(e.rightArrow)return{kind:"cursorRight"};if(e.upArrow)return n.searching||n.firstLine?{kind:"historyPrev"}:{kind:"lineUp"};if(e.downArrow)return n.searching||n.lastLine?{kind:"historyNext"}:{kind:"lineDown"};if(e.escape){if(n.searching)return{kind:"searchCancel"};return n.scrolled?{kind:"scroll",move:"bottom"}:{kind:"none"}}if(e.tab)return{kind:"none"};if(r==="")return{kind:"none"};if(r==="\x1B[H"||r==="\x1B[1~")return{kind:"cursorHome"};if(r==="\x1B[F"||r==="\x1B[4~")return{kind:"cursorEnd"};if(/[\r\n]/.test(r)){let i=r.split(/\r\n|[\r\n]/).map(S),s=i.at(-1)===""&&i.length>1;return{kind:"paste",lines:s?i.slice(0,-1):i,complete:s}}let t=S(r);return t===""?{kind:"none"}:{kind:"insert",text:t}}function H(r){if(r.super){if(r.leftArrow)return"cursorHome";if(r.rightArrow)return"cursorEnd";if(r.upArrow)return"bufferStart";if(r.downArrow)return"bufferEnd";return}if(r.meta||r.ctrl){if(r.leftArrow)return"wordLeft";if(r.rightArrow)return"wordRight";return}if(r.home)return"cursorHome";if(r.end)return"cursorEnd";if(r.leftArrow)return"cursorLeft";if(r.rightArrow)return"cursorRight";if(r.upArrow)return"lineUp";if(r.downArrow)return"lineDown";return}function S(r){return[...r].filter((e)=>{let n=e.codePointAt(0)??0;return n>=32&&n!==127}).join("")}function en(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"cancel"}:{kind:"none"};if(e.return)return{kind:"confirm"};if(e.escape)return{kind:"cancel"};if(r===" ")return{kind:"toggle"};if(r==="a")return{kind:"all"};if(r==="n")return{kind:"none-selected"};let n=mA(r,e);return n.kind==="move"?n:{kind:"none"}}function mA(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"exit"}:{kind:"none"};if(e.return)return{kind:"choose"};if(e.escape)return{kind:"back"};if(e.upArrow)return{kind:"move",move:{kind:"up"}};if(e.downArrow)return{kind:"move",move:{kind:"down"}};switch(r){case"k":return{kind:"move",move:{kind:"up"}};case"j":return{kind:"move",move:{kind:"down"}};case"g":return{kind:"move",move:{kind:"first"}};case"G":return{kind:"move",move:{kind:"last"}};default:break}if(/^[1-9]$/.test(r))return{kind:"move",move:{kind:"jump",index:Number(r)-1}};return{kind:"none"}}function vn(r,e,n){if(e.ctrl&&r.toLowerCase()==="c")return{kind:"abort"};if(e.escape)return{kind:"back"};if(e.return)return{kind:"commit"};if(n.select)return{kind:"list",intent:mA(r,e)};let o=$t(r,e,{busy:!1,empty:n.empty,firstLine:!0,lastLine:!0,searching:!1,armed:!1,scrolled:!1});switch(o.kind){case"submit":return{kind:"commit"};case"exit":return{kind:"abort"};case"arm":case"scroll":return{kind:"edit",intent:{kind:"none"}};case"historyPrev":case"historyNext":return{kind:"edit",intent:{kind:"none"}};case"paste":return{kind:"edit",intent:{kind:"insert",text:o.lines[0]??""}};default:return{kind:"edit",intent:o}}}
9
- export{Be,Vo,Xt,mt,Le,ki,Ln,$t,en,mA,vn};
7
+ `).length+1,column:n-t}}function p(r,e){let n=c(r.value),o=u(r.cursor,n.length),t=l(r.value,o),i=o-t.start;if(e<0){if(t.start===0)return r;let m=l(r.value,t.start-1);return{...r,cursor:Math.min(m.start+i,m.end)}}if(t.end>=n.length)return r;let s=l(r.value,t.end+1);return{...r,cursor:Math.min(s.start+i,s.end)}}function L(r){if(r.history.length===0)return r;let e=Math.min(r.historyOffset+1,r.history.length),n=r.history[r.history.length-e];if(n===void 0)return r;return a({...d(r,{coalesce:!1}),historyOffset:e,draft:r.historyOffset===0?r.value:r.draft},n)}function I(r){if(r.historyOffset===0)return r;let e=r.historyOffset-1,n=d(r,{coalesce:!1});if(e===0)return a({...n,historyOffset:0},r.draft);let o=r.history[r.history.length-e];return o===void 0?r:a({...n,historyOffset:e},o)}function XA(r){let e=(r.search?.query??"").toLowerCase(),n=new Set,o=[];for(let t=r.history.length-1;t>=0;t-=1){let i=r.history[t];if(i===void 0||n.has(i))continue;if(e===""||i.toLowerCase().includes(e))n.add(i),o.push(i)}return o}function C(r){let e=XA(r);return e[u(r.search?.index??0,Math.max(0,e.length-1))]}function g(r,e){let n=r.search;if(n===void 0)return r;let o=XA(r);if(o.length===0)return r;return{...r,search:{...n,index:u(n.index+e,o.length-1)}}}function T(r,e){let n=r.search;if(n===void 0)return r;return{...r,search:{query:n.query+e,index:0}}}function M(r){let e=r.search;if(e===void 0)return r;let n=c(e.query).slice(0,-1).join("");return{...r,search:{query:n,index:0}}}function O(r){let e=C(r);if(e===void 0)return{...r,search:void 0};return a({...d(r,{coalesce:!1}),search:void 0},e)}function K(r){let e=r.past.at(-1);if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:r.past.slice(0,-1),future:[h(r),...r.future],historyOffset:0}}function j(r){let e=r.future[0];if(e===void 0)return r;return{...r,value:e.value,cursor:u(e.cursor,c(e.value).length),past:[...r.past,h(r)].slice(-Ci),future:r.future.slice(1)}}function mA(r){if(r.anchor===void 0||r.anchor===r.cursor)return;return r.anchor<r.cursor?{start:r.anchor,end:r.cursor}:{start:r.cursor,end:r.anchor}}function w(r){let e=mA(r);if(e===void 0)return{...r,anchor:void 0};let n=c(r.value);return{...d(r,{coalesce:!1}),value:[...n.slice(0,e.start),...n.slice(e.end)].join(""),cursor:e.start,anchor:void 0}}function R(r){return r.kind==="insert"||r.kind==="newline"||r.kind==="backspace"||r.kind==="delete"}function Le(r,e){if(r.search===void 0&&R(e)&&mA(r)!==void 0){let o=w(r);if(e.kind==="backspace"||e.kind==="delete")return o;return Le(o,e)}if(e.kind==="extend"){let o=r.anchor??r.cursor;return{...Le({...r,anchor:void 0},{kind:e.to}),anchor:o}}if(e.kind==="cutSelection")return w(r);if(e.kind==="copySelection")return r;if(e.kind==="selectAll")return{...r,anchor:0,cursor:c(r.value).length};let n=W(r,e);return n.anchor===void 0?n:{...n,anchor:void 0}}function W(r,e){if(r.search!==void 0)switch(e.kind){case"insert":return T(r,e.text);case"backspace":return M(r);case"historyPrev":case"lineUp":return g(r,1);case"historyNext":case"lineDown":return g(r,-1);case"searchAccept":return O(r);case"searchCancel":return{...r,search:void 0};case"searchOpen":return r;default:return{...r,search:void 0}}switch(e.kind){case"insert":return k(r,e.text);case"newline":return k(r,`
8
+ `);case"backspace":return E(r);case"delete":return y(r);case"cursorLeft":return{...r,cursor:u(r.cursor-1,c(r.value).length)};case"cursorRight":return{...r,cursor:u(r.cursor+1,c(r.value).length)};case"cursorHome":return{...r,cursor:l(r.value,r.cursor).start};case"cursorEnd":return{...r,cursor:l(r.value,r.cursor).end};case"bufferStart":return{...r,cursor:0};case"bufferEnd":return{...r,cursor:c(r.value).length};case"wordLeft":return{...r,cursor:v(c(r.value),r.cursor)};case"wordRight":return{...r,cursor:b(c(r.value),r.cursor)};case"lineUp":return p(r,-1);case"lineDown":return p(r,1);case"killToStart":{let{start:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,n),...o.slice(r.cursor)].join(""),cursor:n}}case"killToEnd":{let{end:n}=l(r.value,r.cursor);if(n===r.cursor)return r;let o=c(r.value);return{...d(r,{coalesce:!1}),value:[...o.slice(0,r.cursor),...o.slice(n)].join("")}}case"killWord":return x(r);case"killWordForward":return A(r);case"historyPrev":return L(r);case"historyNext":return I(r);case"undo":return K(r);case"redo":return j(r);case"searchOpen":return{...r,search:{query:"",index:0}};case"searchAccept":case"searchCancel":case"submit":case"cancel":case"exit":case"arm":case"scroll":case"pointer":case"reasoning":case"paste":case"none":return r;case"extend":case"selectAll":case"copySelection":case"cutSelection":return r}}function ki(r){let e=r.value.trim();if(e==="")return{text:"",state:{...he,history:r.history}};let o=r.history.at(-1)===e?r.history:[...r.history,e].slice(-aa);return{text:e,state:{...he,history:o}}}function Ln(r,e,n={}){let{line:o,lines:t}=Vo(r);return{busy:e,empty:r.value==="",firstLine:o===0,lastLine:o===t-1,searching:r.search!==void 0,armed:n.armed??!1,scrolled:n.scrolled??!1}}function D(r,e){switch(r){case"c":if(e.searching)return{kind:"searchCancel"};if(e.busy)return{kind:"cancel"};return e.armed?{kind:"exit"}:{kind:"arm"};case"d":return e.empty?{kind:"exit"}:{kind:"delete"};case"a":return{kind:"cursorHome"};case"e":return{kind:"cursorEnd"};case"b":return{kind:"cursorLeft"};case"f":return{kind:"cursorRight"};case"u":return{kind:"killToStart"};case"k":return{kind:"killToEnd"};case"w":return{kind:"killWord"};case"p":return{kind:"historyPrev"};case"n":return{kind:"historyNext"};case"r":return{kind:"searchOpen"};case"o":return{kind:"reasoning"};case"z":return{kind:"undo"};case"y":return{kind:"redo"};default:return{kind:"none"}}}function $A(r,e,n){let o=$s(r);if(o!==void 0){if(o.rows!==0)return{kind:"scroll",move:o.rows<0?"up":"down",times:Math.abs(o.rows)};if(o.at!==void 0&&o.kind!==void 0&&o.kind!=="wheel")return{kind:"pointer",gesture:o.kind,column:o.at.column,row:o.at.row,shift:o.shift===!0};return{kind:"none"}}if(e.eventType==="release")return{kind:"none"};if(e.shift){let i=H(e);if(i!==void 0)return{kind:"extend",to:i}}if(e.super){if(e.leftArrow)return{kind:"cursorHome"};if(e.rightArrow)return{kind:"cursorEnd"};if(e.upArrow)return{kind:"bufferStart"};if(e.downArrow)return{kind:"bufferEnd"};if(e.backspace)return{kind:"killToStart"};if(e.delete)return{kind:"killToEnd"};if(r==="z")return e.shift?{kind:"redo"}:{kind:"undo"};if(r==="a")return{kind:"selectAll"};if(r==="c")return{kind:"copySelection"};if(r==="x")return{kind:"cutSelection"};return{kind:"none"}}if(qs(r))return{kind:"none"};if(e.ctrl&&e.leftArrow)return{kind:"wordLeft"};if(e.ctrl&&e.rightArrow)return{kind:"wordRight"};if(e.ctrl&&e.backspace)return{kind:"killWord"};if(e.ctrl)return D(r.toLowerCase(),n);if(e.meta){if(e.return)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"top"};if(e.pageDown)return{kind:"scroll",move:"bottom"};if(e.upArrow)return{kind:"scroll",move:"up"};if(e.downArrow)return{kind:"scroll",move:"down"};if(e.leftArrow||r==="b")return{kind:"wordLeft"};if(e.rightArrow||r==="f")return{kind:"wordRight"};if(e.backspace)return{kind:"killWord"};if(r==="d")return{kind:"killWordForward"};if(r==="r")return{kind:"reasoning"};return{kind:"none"}}if(e.return&&e.shift)return{kind:"newline"};if(e.pageUp)return{kind:"scroll",move:"pageUp"};if(e.pageDown)return{kind:"scroll",move:"pageDown"};if(e.home)return{kind:"cursorHome"};if(e.end)return{kind:"cursorEnd"};if(e.return)return n.searching?{kind:"searchAccept"}:{kind:"submit"};if(e.backspace)return{kind:"backspace"};if(e.delete)return{kind:"delete"};if(e.leftArrow)return{kind:"cursorLeft"};if(e.rightArrow)return{kind:"cursorRight"};if(e.upArrow)return n.searching||n.firstLine?{kind:"historyPrev"}:{kind:"lineUp"};if(e.downArrow)return n.searching||n.lastLine?{kind:"historyNext"}:{kind:"lineDown"};if(e.escape){if(n.searching)return{kind:"searchCancel"};return n.scrolled?{kind:"scroll",move:"bottom"}:{kind:"none"}}if(e.tab)return{kind:"none"};if(r==="")return{kind:"none"};if(r==="\x1B[H"||r==="\x1B[1~")return{kind:"cursorHome"};if(r==="\x1B[F"||r==="\x1B[4~")return{kind:"cursorEnd"};if(/[\r\n]/.test(r)){let i=r.split(/\r\n|[\r\n]/).map(S),s=i.at(-1)===""&&i.length>1;return{kind:"paste",lines:s?i.slice(0,-1):i,complete:s}}let t=S(r);return t===""?{kind:"none"}:{kind:"insert",text:t}}function H(r){if(r.super){if(r.leftArrow)return"cursorHome";if(r.rightArrow)return"cursorEnd";if(r.upArrow)return"bufferStart";if(r.downArrow)return"bufferEnd";return}if(r.meta||r.ctrl){if(r.leftArrow)return"wordLeft";if(r.rightArrow)return"wordRight";return}if(r.home)return"cursorHome";if(r.end)return"cursorEnd";if(r.leftArrow)return"cursorLeft";if(r.rightArrow)return"cursorRight";if(r.upArrow)return"lineUp";if(r.downArrow)return"lineDown";return}function S(r){return[...r].filter((e)=>{let n=e.codePointAt(0)??0;return n>=32&&n!==127}).join("")}function en(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"cancel"}:{kind:"none"};if(e.return)return{kind:"confirm"};if(e.escape)return{kind:"cancel"};if(r===" ")return{kind:"toggle"};if(r==="a")return{kind:"all"};if(r==="n")return{kind:"none-selected"};let n=mt(r,e);return n.kind==="move"?n:{kind:"none"}}function mt(r,e){if(e.ctrl)return r.toLowerCase()==="c"||r.toLowerCase()==="d"?{kind:"exit"}:{kind:"none"};if(e.return)return{kind:"choose"};if(e.escape)return{kind:"back"};if(e.upArrow)return{kind:"move",move:{kind:"up"}};if(e.downArrow)return{kind:"move",move:{kind:"down"}};switch(r){case"k":return{kind:"move",move:{kind:"up"}};case"j":return{kind:"move",move:{kind:"down"}};case"g":return{kind:"move",move:{kind:"first"}};case"G":return{kind:"move",move:{kind:"last"}};default:break}if(/^[1-9]$/.test(r))return{kind:"move",move:{kind:"jump",index:Number(r)-1}};return{kind:"none"}}function vn(r,e,n){if(e.ctrl&&r.toLowerCase()==="c")return{kind:"abort"};if(e.escape)return{kind:"back"};if(e.return)return{kind:"commit"};if(n.select)return{kind:"list",intent:mt(r,e)};let o=$A(r,e,{busy:!1,empty:n.empty,firstLine:!0,lastLine:!0,searching:!1,armed:!1,scrolled:!1});switch(o.kind){case"submit":return{kind:"commit"};case"exit":return{kind:"abort"};case"arm":case"scroll":return{kind:"edit",intent:{kind:"none"}};case"historyPrev":case"historyNext":return{kind:"edit",intent:{kind:"none"}};case"paste":return{kind:"edit",intent:{kind:"insert",text:o.lines[0]??""}};default:return{kind:"edit",intent:o}}}
9
+ export{he,Vo,XA,mA,Le,ki,Ln,$A,en,mt,vn};
10
10
 
11
- //# debugId=93659E34ED44C36B64756E2164756E21
12
- //# sourceMappingURL=index-es4bgkbh.js.map
11
+ //# debugId=1103A2C5290F2A5464756E2164756E21
12
+ //# sourceMappingURL=index-trx9xb59.js.map
@@ -6,6 +6,6 @@
6
6
  "/**\n * Keystrokes in, intents out. Pure, and free of any Ink import.\n *\n * The one contract worth stating explicitly, because Phase 1 established and measured it:\n * **Ctrl-C cancels the turn, not the process.** Whether a keystroke means \"cancel\" or \"exit\"\n * depends on whether a turn is in flight, so that decision belongs here — in a function that can be\n * tested against both states — rather than in a component where it can only be tested by hand.\n */\n\nimport { lineInfo } from \"#editor\"\nimport { isTerminalReply } from \"#lib/csi\"\nimport { mouseInput } from \"#lib/mouse\"\nimport type { EditorState, Intent, KeyState, MotionKind } from \"#lib/types\"\n\nexport interface KeyContext {\n /** A turn is in flight. */\n readonly busy: boolean\n /** The input buffer is empty. */\n readonly empty: boolean\n /**\n * The cursor is on the first line, so ↑ means history rather than a line up.\n *\n * Position decides, because a multi-line buffer wants both and every editor resolves it this way:\n * at the top of what you are composing there is nothing above to move to, so the arrow is free to\n * mean the other thing. `^P`/`^N` stay unconditional history for anyone who would rather not think\n * about where the cursor is.\n */\n readonly firstLine: boolean\n readonly lastLine: boolean\n /** `^R` is open, so enter accepts a match and escape closes it. */\n readonly searching: boolean\n /**\n * A first ^C has already been pressed at an idle prompt, so the next one leaves.\n *\n * Held by the caller rather than derived, because it is the one piece of keyboard state with a\n * *clock* attached — it expires — and a pure function cannot own that. What it must not do is\n * decide what an armed ^C means, which is why the flag comes in here and the decision stays below.\n */\n readonly armed: boolean\n /**\n * The transcript window is parked above the newest row, so escape means \"come back down\".\n *\n * Escape had nothing to do at an idle prompt and was claimed as `none` to keep control characters\n * out of the buffer. A scrolled-away view is the one state where a reader plainly wants a way out\n * of where they are, and escape is the key they will press.\n */\n readonly scrolled: boolean\n}\n\n/**\n * The context for a given editor state.\n *\n * Exported and derived in one place so no renderer computes it by hand. `empty` was already this shape\n * — editor state passed to the keymap as context — and the two line flags are the same idea; a caller\n * that got `firstLine` wrong would make the arrows misbehave in a way no test of this module would see.\n */\nexport function keyContext(\n editor: EditorState,\n busy: boolean,\n session: { readonly armed?: boolean; readonly scrolled?: boolean } = {},\n): KeyContext {\n const { line, lines } = lineInfo(editor)\n return {\n busy,\n empty: editor.value === \"\",\n firstLine: line === 0,\n lastLine: line === lines - 1,\n searching: editor.search !== undefined,\n armed: session.armed ?? false,\n scrolled: session.scrolled ?? false,\n }\n}\n\n/** Ctrl-key chords arrive as `key.ctrl` plus the letter in `input`. */\nfunction ctrlIntent(letter: string, context: KeyContext): Intent {\n switch (letter) {\n case \"c\":\n // While a search is open, ^C dismisses it rather than the session: the search is the\n // foreground thing, and quitting the whole session from it would lose a message somebody\n // is part-way through composing.\n if (context.searching) return { kind: \"searchCancel\" }\n // The whole point. Busy means a turn is generating; interrupting it must leave the\n // prompt behind, not the shell.\n if (context.busy) return { kind: \"cancel\" }\n // At an idle prompt it takes two, and the first one says so.\n //\n // One press used to exit, which was defensible while the session left its conversation in\n // the scrollback: ^C landed you back in a shell with the transcript still above it. On the\n // alternate screen the buffer is discarded on the way out, so the same keystroke now throws\n // the visible conversation away — and it is one press away from the chord that means\n // \"cancel this turn\", pressed reflexively when a reply runs long. ^D still leaves in one,\n // for anyone who wants that, and the status line names whichever is live.\n return context.armed ? { kind: \"exit\" } : { kind: \"arm\" }\n case \"d\":\n // Ctrl-D is end-of-input, so it only ends the session when there is nothing to submit.\n // On a line with text it is a forward delete, as in a shell.\n return context.empty ? { kind: \"exit\" } : { kind: \"delete\" }\n case \"a\":\n return { kind: \"cursorHome\" }\n case \"e\":\n return { kind: \"cursorEnd\" }\n case \"b\":\n return { kind: \"cursorLeft\" }\n case \"f\":\n return { kind: \"cursorRight\" }\n case \"u\":\n return { kind: \"killToStart\" }\n case \"k\":\n return { kind: \"killToEnd\" }\n case \"w\":\n return { kind: \"killWord\" }\n case \"p\":\n return { kind: \"historyPrev\" }\n case \"n\":\n return { kind: \"historyNext\" }\n case \"r\":\n return { kind: \"searchOpen\" }\n case \"o\":\n // The same thing ⌥r does, on a chord that cannot fail to arrive.\n //\n // ⌥r needs either the kitty protocol or the terminal's option-as-meta setting; a ctrl letter\n // needs neither, because it is a single control byte every terminal has always sent. Reported\n // as \"⌥r doesn't do anything\", and while the immediate cause was a fold with nothing in it,\n // the standing cause is that a view toggle should not depend on a terminal handshake at all.\n // ^O is what the reference CLI binds its own transcript toggle to, so the habit transfers.\n return { kind: \"reasoning\" }\n case \"z\":\n // Undo, not SIGTSTP. Ink puts stdin in raw mode, so the terminal never generates the\n // signal and the byte arrives here — which makes this a choice rather than an accident.\n // Suspending a chat you can leave with ^D is worth little; undo is worth a lot, and the\n // footer says so, which is what keeps the trade visible.\n return { kind: \"undo\" }\n case \"y\":\n return { kind: \"redo\" }\n default:\n return { kind: \"none\" }\n }\n}\n\nexport function keyToIntent(input: string, key: KeyState, context: KeyContext): Intent {\n // The mouse, before anything else, and unconditionally.\n //\n // Ink has no idea what a mouse report is and hands it over as text: with tracking on, one wheel notch\n // reached the insert branch and typed the report into the message. So every report is claimed here —\n // the wheel becomes a scroll and everything else becomes nothing at all, because a click that falls\n // through is the same bug with a different button.\n const mouse = mouseInput(input)\n if (mouse !== undefined) {\n if (mouse.rows !== 0) {\n return {\n kind: \"scroll\",\n move: mouse.rows < 0 ? \"up\" : \"down\",\n times: Math.abs(mouse.rows),\n }\n }\n // A press, drag or release. Reported rather than resolved: which row of the conversation a cell\n // sits on is a question about the frame, and this function has no frame. Still claimed either way —\n // a report that fell through would be typed into the message, which is the bug this branch exists\n // for and does not stop being one because the gesture is now useful.\n if (mouse.at !== undefined && mouse.kind !== undefined && mouse.kind !== \"wheel\") {\n return {\n kind: \"pointer\",\n gesture: mouse.kind,\n column: mouse.at.column,\n row: mouse.at.row,\n shift: mouse.shift === true,\n }\n }\n return { kind: \"none\" }\n }\n\n // A key *release* is not a keystroke. `reportEventTypes` is on so that `super` survives on an arrow\n // key (Ink's kitty branch requires the `:eventType` field), and the cost is that Ink hands the type\n // through without filtering — so every enhanced key arrives twice, down and up, and every chord would\n // fire twice. Repeats are kept: holding a key down is a real thing to do.\n if (key.eventType === \"release\") return { kind: \"none\" }\n\n // ─── shift extends a selection ───────────────────────────────────────────────────────\n //\n // Before the cmd, ctrl and option blocks, because every one of them would otherwise claim the chord\n // and drop the shift: `cmd+shift+←` arrives as `CSI 1;10D` — one plus shift plus super — and the\n // super block below matches on `key.super` without looking at shift at all.\n //\n // Only the motion keys are recognised, which is what keeps this from swallowing ordinary typing:\n // `key.shift` is true for every capital letter, and a letter matches none of the tests in\n // `shiftMotion`. Return is not a motion either, so `⇧⏎` still reaches the newline branch.\n if (key.shift) {\n const to = shiftMotion(key)\n if (to !== undefined) return { kind: \"extend\", to }\n }\n\n // ─── command chords ──────────────────────────────────────────────────────────────────\n //\n // `super` is Cmd, and it is only ever true once the kitty keyboard protocol has been negotiated —\n // no legacy sequence can express it, and Ink's legacy path folds it into `meta`, which is why\n // `cmd+←` used to word-move like `⌥←` instead of jumping to the start of the line.\n //\n // Horizontal is the line, vertical is the whole message: that is what macOS binds and what every\n // editor on the platform does. Before the ctrl and meta blocks because a chord can carry more than\n // one modifier, and cmd is the most specific claim.\n if (key.super) {\n if (key.leftArrow) return { kind: \"cursorHome\" }\n if (key.rightArrow) return { kind: \"cursorEnd\" }\n if (key.upArrow) return { kind: \"bufferStart\" }\n if (key.downArrow) return { kind: \"bufferEnd\" }\n if (key.backspace) return { kind: \"killToStart\" }\n if (key.delete) return { kind: \"killToEnd\" }\n if (input === \"z\") return key.shift ? { kind: \"redo\" } : { kind: \"undo\" }\n if (input === \"a\") return { kind: \"selectAll\" }\n // Reachable only where the protocol delivers `super`, and the terminal may claim them first for\n // its own copy — which is exactly why a *selection* in the composer does not auto-copy: the\n // fallback for a chord that may not arrive is retyping, not a surprise clipboard write.\n if (input === \"c\") return { kind: \"copySelection\" }\n if (input === \"x\") return { kind: \"cutSelection\" }\n // Unclaimed, and deliberately swallowed for the same reason an unclaimed option chord is: the\n // insert branch would type the bare letter, so cmd+s would put an \"s\" in the message.\n return { kind: \"none\" }\n }\n\n // Ctrl with an arrow or a backspace is the other spelling of a word operation — Linux and Windows\n // convention, and the reference honours `ctrl || meta || fn` for exactly one action because a\n // physical chord reaches a terminal in more than one encoding. Before `ctrlIntent`, which dispatches\n // on a *letter* and would see an empty string here.\n // A terminal's answer to a question this process asked is not a keystroke. Claimed next to the mouse\n // for the same reason: Ink hands it over as text, and text reaches the insert branch.\n if (isTerminalReply(input)) return { kind: \"none\" }\n\n if (key.ctrl && key.leftArrow) return { kind: \"wordLeft\" }\n if (key.ctrl && key.rightArrow) return { kind: \"wordRight\" }\n if (key.ctrl && key.backspace) return { kind: \"killWord\" }\n\n if (key.ctrl) return ctrlIntent(input.toLowerCase(), context)\n\n // ─── option chords ───────────────────────────────────────────────────────────────────\n //\n // Every one of these is measured against Ink's parser rather than assumed, because a terminal has\n // more than one way to send them and the parser reporting *a* key says nothing about which:\n //\n // ⌥← Apple Terminal `ESC b` → input \"b\" + meta iTerm2 `CSI 1;3D` → leftArrow + meta\n // ⌥→ Apple Terminal `ESC f` → input \"f\" + meta iTerm2 `CSI 1;3C` → rightArrow + meta\n // ⌥⌫ `ESC DEL` → backspace + meta\n // ⌥d `ESC d` → input \"d\" + meta\n // ⌥r `ESC r` → input \"r\" + meta\n // ⌥⏎ `ESC CR` → return + meta\n // ⇧⏎ kitty protocol `CSI 13;2u` → return + shift (only once the terminal is taught)\n //\n // Both spellings of each are honoured, so the same binding works in both families of terminal.\n //\n // Under the kitty protocol these arrive as `CSI <codepoint>;3u` instead — `⌥r` is `CSI 114;3u`, and\n // Ink reports it as `input \"r\"` with `meta` set, which is the same shape the table above describes.\n // That is why negotiating the protocol needed no change here: these bindings were always right and\n // simply never arrived, because Warp's Option-as-Meta setting is off by default and `⌥r` was\n // reaching us as the composed character `®`.\n if (key.meta) {\n if (key.return) return { kind: \"newline\" }\n // ⌥↑/⌥↓ walk the conversation a row at a time, and ⌥PgUp/⌥PgDn go to its ends. Bare ↑/↓ cannot\n // do this: they already mean line movement inside a message and history at its edges, and a\n // third meaning on one key is how a keyboard stops being predictable.\n if (key.pageUp) return { kind: \"scroll\", move: \"top\" }\n if (key.pageDown) return { kind: \"scroll\", move: \"bottom\" }\n if (key.upArrow) return { kind: \"scroll\", move: \"up\" }\n if (key.downArrow) return { kind: \"scroll\", move: \"down\" }\n if (key.leftArrow || input === \"b\") return { kind: \"wordLeft\" }\n if (key.rightArrow || input === \"f\") return { kind: \"wordRight\" }\n if (key.backspace) return { kind: \"killWord\" }\n if (input === \"d\") return { kind: \"killWordForward\" }\n // Reasoning is folded to a few rows by default, and this is how the rest of it is read. Same\n // shape as ⌥d — a letter with meta — so it works wherever the chords above already do.\n if (input === \"r\") return { kind: \"reasoning\" }\n // An unclaimed option chord does nothing. Falling through would reach the insert branch and\n // type the bare letter, so ⌥s would silently put an \"s\" in the message. Composed characters\n // (é, ∆) are unaffected: macOS sends those as the character itself, with no meta flag.\n return { kind: \"none\" }\n }\n\n // Shift+enter is a newline where the terminal can express it — `terminal-setup` is what teaches\n // iTerm2, VS Code, Ghostty and Kitty to send the sequence Ink already understands. Where it\n // cannot, this is never true and ⏎ submits, which is why ⌥⏎ is the documented chord.\n if (key.return && key.shift) return { kind: \"newline\" }\n\n // Paging the conversation, unmodified.\n //\n // Deliberately not ^U/^D, which the plan named: both are already taken by the editor — ^U deletes to\n // the start of the line and ^D leaves an empty one — and they are documented, shell-standard, and\n // reached by muscle memory. A scroll key that silently deleted half a message would be a worse bug\n // than no scroll key.\n if (key.pageUp) return { kind: \"scroll\", move: \"pageUp\" }\n if (key.pageDown) return { kind: \"scroll\", move: \"pageDown\" }\n\n // Home and End. Ink has always parsed them; `KeyState` never declared the fields, so both keys did\n // nothing whatsoever until now. The raw-sequence fallback further down catches the terminals that\n // send a spelling Ink does not flag.\n if (key.home) return { kind: \"cursorHome\" }\n if (key.end) return { kind: \"cursorEnd\" }\n\n if (key.return) return context.searching ? { kind: \"searchAccept\" } : { kind: \"submit\" }\n if (key.backspace) return { kind: \"backspace\" }\n if (key.delete) return { kind: \"delete\" }\n if (key.leftArrow) return { kind: \"cursorLeft\" }\n if (key.rightArrow) return { kind: \"cursorRight\" }\n // History at the edges of the buffer, line movement inside it. While searching both walk the match\n // list, which the reducer routes — the arrows mean \"previous\" and \"next\" either way.\n if (key.upArrow) {\n return context.searching || context.firstLine ? { kind: \"historyPrev\" } : { kind: \"lineUp\" }\n }\n if (key.downArrow) {\n return context.searching || context.lastLine\n ? { kind: \"historyNext\" }\n : { kind: \"lineDown\" }\n }\n\n // Escape closes a search; otherwise it is claimed deliberately and does nothing, rather than\n // falling through to the insert branch where it would put a control character into the buffer and\n // be sent to a model. Tab is claimed for the same reason.\n if (key.escape) {\n if (context.searching) return { kind: \"searchCancel\" }\n return context.scrolled ? { kind: \"scroll\", move: \"bottom\" } : { kind: \"none\" }\n }\n if (key.tab) return { kind: \"none\" }\n\n // A paste arrives as one large `input` with no key flags, so insert has to accept many\n // characters at once rather than assuming a single keypress.\n if (input === \"\") return { kind: \"none\" }\n\n // Home and End again, by raw sequence. There are four spellings in the wild and Ink flags only some\n // of them — the reference keeps the same fallback for the same reason (`useTextInput.ts:385-389`).\n // After the empty-input check and before the printable filter, which would otherwise strip the\n // escape and insert `[H` into the message.\n if (input === \"\\u001B[H\" || input === \"\\u001B[1~\") return { kind: \"cursorHome\" }\n if (input === \"\\u001B[F\" || input === \"\\u001B[4~\") return { kind: \"cursorEnd\" }\n\n // Newlines inside that chunk are line breaks, not control noise. Stripping them — which the\n // printable filter below would do — silently joins the last word of one line to the first word\n // of the next and submits nothing, so a pasted multi-line prompt arrives mangled with no error.\n if (/[\\r\\n]/.test(input)) {\n const lines = input.split(/\\r\\n|[\\r\\n]/).map(printableOnly)\n // A trailing newline means the final line is finished too; without one, the tail is still\n // being typed.\n const complete = lines.at(-1) === \"\" && lines.length > 1\n return { kind: \"paste\", lines: complete ? lines.slice(0, -1) : lines, complete }\n }\n\n const printable = printableOnly(input)\n return printable === \"\" ? { kind: \"none\" } : { kind: \"insert\", text: printable }\n}\n\n/**\n * Which motion a shift chord extends by, or `undefined` when the key is not a motion at all.\n *\n * Modifier first, then the bare keys, so `shift+cmd+←` is a line and `shift+⌥←` is a word rather than both\n * being a character. `shift+↑` extends a line up even on the first line, where the unshifted arrow means\n * history: selecting upward is unambiguous, and a history chord that also grew a selection would be one\n * key doing two unrelated things.\n *\n * `input` is deliberately not consulted. The `ESC b` spelling of `⌥←` would arrive shifted as `ESC B`, and\n * matching a capital letter here is how `shift+B` would start selecting words. Terminals send the CSI form\n * for a shifted arrow, which carries the flags this reads.\n */\nfunction shiftMotion(key: KeyState): MotionKind | undefined {\n if (key.super) {\n if (key.leftArrow) return \"cursorHome\"\n if (key.rightArrow) return \"cursorEnd\"\n if (key.upArrow) return \"bufferStart\"\n if (key.downArrow) return \"bufferEnd\"\n return undefined\n }\n if (key.meta || key.ctrl) {\n if (key.leftArrow) return \"wordLeft\"\n if (key.rightArrow) return \"wordRight\"\n return undefined\n }\n if (key.home) return \"cursorHome\"\n if (key.end) return \"cursorEnd\"\n if (key.leftArrow) return \"cursorLeft\"\n if (key.rightArrow) return \"cursorRight\"\n if (key.upArrow) return \"lineUp\"\n if (key.downArrow) return \"lineDown\"\n return undefined\n}\n\n/**\n * Drop C0 controls and DEL. A bracketed-paste marker or a stray escape sequence reaching the buffer\n * would be invisible on screen and sent to the model as if it had been typed.\n */\nfunction printableOnly(text: string): string {\n return [...text]\n .filter((char) => {\n const code = char.codePointAt(0) ?? 0\n return code >= 0x20 && code !== 0x7f\n })\n .join(\"\")\n}\n\n// ─── screen keymaps ──────────────────────────────────────────────────────────────────────\n//\n// The wizard and picker differ from the chat input in what Esc means — a *context*, not a new\n// module, which is why they live here beside `keyToIntent` rather than in per-screen files: one\n// keyboard home, closed by the same drift tests.\n\nimport type { SelectMove } from \"#lib/select\"\n\nexport type ListIntent =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"choose\" }\n | { readonly kind: \"back\" }\n | { readonly kind: \"exit\" }\n | { readonly kind: \"none\" }\n\n/**\n * A checklist adds two verbs a single-select list does not have: tick a row, and finish.\n *\n * Space ticks and enter finishes, which is the convention every multi-select in a terminal uses — and\n * getting it the other way round is the mistake that makes a picker feel broken, because enter on a\n * highlighted row is such a strong habit that people submit with one thing ticked and never see the rest.\n * `a` and `n` are all/none, worth having when the list is fifty rows long.\n */\nexport type CheckIntent =\n | { readonly kind: \"move\"; readonly move: SelectMove }\n | { readonly kind: \"toggle\" }\n | { readonly kind: \"all\" }\n | { readonly kind: \"none-selected\" }\n | { readonly kind: \"confirm\" }\n | { readonly kind: \"cancel\" }\n | { readonly kind: \"none\" }\n\nexport function keyToCheckIntent(input: string, key: KeyState): CheckIntent {\n if (key.ctrl) {\n return input.toLowerCase() === \"c\" || input.toLowerCase() === \"d\"\n ? { kind: \"cancel\" }\n : { kind: \"none\" }\n }\n if (key.return) return { kind: \"confirm\" }\n if (key.escape) return { kind: \"cancel\" }\n // Ink reports the space bar as the input string \" \" with no flag of its own.\n if (input === \" \") return { kind: \"toggle\" }\n if (input === \"a\") return { kind: \"all\" }\n if (input === \"n\") return { kind: \"none-selected\" }\n\n const list = keyToListIntent(input, key)\n // Movement is shared so the two lists cannot drift apart; `choose` cannot arrive, because `key.return`\n // is handled above, and the remaining kinds are not this screen's.\n return list.kind === \"move\" ? list : { kind: \"none\" }\n}\n\n/**\n * List navigation: arrows or j/k, g/G for ends, enter chooses, esc backs out, ^C/^D leave.\n *\n * A digit jumps the cursor — visibly and reversibly — and deliberately does not choose: a stray\n * number must never launch an agent.\n */\nexport function keyToListIntent(input: string, key: KeyState): ListIntent {\n if (key.ctrl) {\n return input.toLowerCase() === \"c\" || input.toLowerCase() === \"d\"\n ? { kind: \"exit\" }\n : { kind: \"none\" }\n }\n if (key.return) return { kind: \"choose\" }\n if (key.escape) return { kind: \"back\" }\n if (key.upArrow) return { kind: \"move\", move: { kind: \"up\" } }\n if (key.downArrow) return { kind: \"move\", move: { kind: \"down\" } }\n\n switch (input) {\n case \"k\":\n return { kind: \"move\", move: { kind: \"up\" } }\n case \"j\":\n return { kind: \"move\", move: { kind: \"down\" } }\n case \"g\":\n return { kind: \"move\", move: { kind: \"first\" } }\n case \"G\":\n return { kind: \"move\", move: { kind: \"last\" } }\n default:\n break\n }\n if (/^[1-9]$/.test(input)) {\n return { kind: \"move\", move: { kind: \"jump\", index: Number(input) - 1 } }\n }\n return { kind: \"none\" }\n}\n\nexport type WizardKeyIntent =\n | { readonly kind: \"back\" }\n | { readonly kind: \"abort\" }\n | { readonly kind: \"commit\" }\n | { readonly kind: \"list\"; readonly intent: ListIntent }\n | { readonly kind: \"edit\"; readonly intent: Intent }\n\n/**\n * The wizard's chrome keys are checked before delegation — Esc means \"back a question\" here,\n * which is exactly why chat's `keyToIntent` (which claims Esc as none) is not reused raw.\n *\n * Text steps then get the full chat editor treatment (^A/^E, ^W, code-point cursor); select steps\n * get the list navigation. A pasted blob collapses to its first line — a wizard answer is one\n * line — and history chords mean nothing inside a question.\n */\nexport function keyToWizardIntent(\n input: string,\n key: KeyState,\n context: { readonly select: boolean; readonly empty: boolean },\n): WizardKeyIntent {\n if (key.ctrl && input.toLowerCase() === \"c\") return { kind: \"abort\" }\n if (key.escape) return { kind: \"back\" }\n if (key.return) return { kind: \"commit\" }\n\n if (context.select) {\n return { kind: \"list\", intent: keyToListIntent(input, key) }\n }\n\n // A wizard answer is one line — a pasted blob collapses to its first — so the cursor is always on\n // both the first and the last line, and ↑/↓ mean history rather than line movement. There is no\n // search here either.\n const intent = keyToIntent(input, key, {\n busy: false,\n empty: context.empty,\n firstLine: true,\n lastLine: true,\n searching: false,\n // A question is not a conversation: there is nothing to scroll and nothing to arm, and Esc is\n // claimed above as \"back a question\" before this is ever reached.\n armed: false,\n scrolled: false,\n })\n switch (intent.kind) {\n case \"submit\":\n return { kind: \"commit\" }\n case \"exit\":\n // ^D on an empty question line reads as \"get me out\", same as ^C.\n return { kind: \"abort\" }\n case \"arm\":\n case \"scroll\":\n // Unreachable in practice — ^C is claimed as `abort` above and there is nothing to scroll —\n // and listed rather than left to the default, so adding a session-only intent cannot\n // silently become an edit the wizard applies to a field.\n return { kind: \"edit\", intent: { kind: \"none\" } }\n case \"historyPrev\":\n case \"historyNext\":\n return { kind: \"edit\", intent: { kind: \"none\" } }\n case \"paste\":\n return {\n kind: \"edit\",\n intent: { kind: \"insert\", text: intent.lines[0] ?? \"\" },\n }\n default:\n return { kind: \"edit\", intent }\n }\n}\n"
7
7
  ],
8
8
  "mappings": ";+GA2BO,IAAM,GAA4B,CACrC,MAAO,GACP,OAAQ,EACR,QAAS,CAAC,EACV,cAAe,EACf,MAAO,GACP,KAAM,CAAC,EACP,OAAQ,CAAC,EACT,OAAQ,OACR,OAAQ,MACZ,EAEA,SAAS,CAAK,CAAC,EAAyB,CACpC,MAAO,CAAC,GAAG,CAAK,EAGpB,SAAS,CAAK,CAAC,EAAgB,EAAwB,CACnD,OAAO,KAAK,IAAI,EAAG,KAAK,IAAI,EAAQ,CAAM,CAAC,EAG/C,SAAS,CAAQ,CAAC,EAAoC,CAClD,MAAO,CAAE,MAAO,EAAM,MAAO,OAAQ,EAAM,MAAO,EAYtD,SAAS,CAAQ,CAAC,EAAoB,EAAsD,CACxF,IAAM,EAAM,EAAM,KAAK,GAAG,EAAE,EAG5B,GAAI,EAAQ,UAAY,IAAQ,QAAa,EAAM,OAAO,SAAW,EACjE,MAAO,IAAK,EAAO,OA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E21",
9
+ "debugId": "1103A2C5290F2A5464756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{A,t}from"./index-1h9pqnec.js";import{sn,nA,Ot,an,es}from"./index-026q0y3a.js";class tA extends t{static ERROR_NAME="UsageError"}function S(e,i){let n=Array.from({length:i.length+1},(o,g)=>g);for(let o=1;o<=e.length;o+=1){let g=[o];for(let l=1;l<=i.length;l+=1){let f=(n[l-1]??0)+(e[o-1]===i[l-1]?0:1),d=(g[l-1]??0)+1,_=(n[l]??0)+1;g.push(Math.min(f,d,_))}n=g}return n[i.length]??Math.max(e.length,i.length)}function M(e,i){let n,o=Number.POSITIVE_INFINITY;for(let g of i){let l=S(e,g);if(l<o)o=l,n=g}return n!==void 0&&o<=Math.max(2,Math.floor(e.length/3))?n:void 0}class R{#e;#t;constructor(e,i){this.#e=e,this.#t=i}#n(e,i){let n=this.#t.get(e);if(n===void 0)throw new tA({code:"cli_flag_not_declared",message:`No flag "${e}" is declared for this command.`,hint:"This is a bug in the CLI, not in the command line. Add the flag to lib/commands.ts or fix the reader."});if(n.kind!==i)throw new tA({code:"cli_flag_kind_mismatch",message:`Flag "${e}" is declared as ${n.kind} but was read as ${i}.`,hint:"This is a bug in the CLI. The reader and lib/commands.ts disagree."});return this.#e.get(e)}str(e){let i=this.#n(e,"string");return typeof i==="string"?i:void 0}num(e){let i=this.#n(e,"number");return typeof i==="number"?i:void 0}bool(e){return this.#n(e,"boolean")===!0}has(e){return this.#e.has(e)}}function c(e,i,n,o){return o===void 0?{code:e,message:i,hint:n}:{code:e,message:i,hint:n,field:o}}function y(e){let i=e[0];return new tA({code:"cli_usage",message:e.length===1&&i!==void 0?i.message:`${e.length} problems with the command line.`,hint:e.length===1&&i!==void 0?i.hint:"Each problem below names the flag and its fix.",...i?.field===void 0?{}:{field:i.field},details:e})}function D(e,i,n){let o=Number(i);if(i.trim()===""||!Number.isFinite(o))return c("cli_flag_not_a_number",`${n} expects a number, got ${JSON.stringify(i)}.`,`Pass a number, as in ${n} 50. The old parser silently used the default here, which made a typo look like it worked.`,n);if(e.integer===!0&&!Number.isInteger(o))return c("cli_flag_not_an_integer",`${n} expects a whole number, got ${i}.`,`Drop the fractional part: ${n} ${Math.trunc(o)}.`,n);if(e.min!==void 0&&o<e.min)return c("cli_flag_below_min",`${n} must be at least ${e.min}, got ${o}.`,`Pass ${e.min} or more.`,n);return o}function $i(e){let i=e[0];if(i===void 0)return{kind:"usage"};if(i.startsWith("-")){let s=new Set(sn.flatMap((a)=>a.short===void 0?[`--${a.name}`]:[`--${a.name}`,`-${a.short}`])),r=e.filter((a)=>!s.has(a));if(r.length>0)throw y([c("cli_no_command","No command given.",`Run \`${A.slug} --help\` for the command list. Commands are ${nA.map((a)=>a.name).join(", ")}.`,r[0])]);if(e.includes("--version")||e.includes("-v"))return{kind:"version"};if(e.includes("--help")||e.includes("-h"))return{kind:"help",command:void 0};return{kind:"usage"}}let n=Ot(i);if(n===void 0){let s=M(i,nA.map((r)=>r.name));throw y([c("cli_unknown_command",`Unknown command "${i}".`,s===void 0?`Run \`${A.slug} --help\` for the command list.`:`Did you mean "${s}"? Run \`${A.slug} --help\` for the full list.`,i)])}let o=new Map(an(n).map((s)=>[s.name,s])),g=new Map(an(n).filter((s)=>s.short!==void 0).map((s)=>[s.short,s])),l=new Map,f=[],d=[],_=!1,w=(s,r,a)=>{if(r===""){d.push(c("cli_flag_empty_value",`${a} was given an empty value.`,"Pass a value, or drop the flag entirely to use the default.",a));return}if(s.kind==="number"){let u=D(s,r,a);if(typeof u==="number")l.set(s.name,u);else d.push(u);return}l.set(s.name,r)};for(let s=1;s<e.length;s+=1){let r=e[s];if(r===void 0)continue;if(_){f.push(r);continue}if(r==="--"){_=!0;continue}if(r.startsWith("--")){let a=r.slice(2),u=a.indexOf("="),m=u===-1?a:a.slice(0,u),h=o.get(m);if(h===void 0){let k=es(m,n.name),x=M(m,[...o.keys()]);d.push(c(k.length>0?"cli_flag_wrong_command":"cli_unknown_flag",k.length>0?`${n.name} does not accept --${m}.`:`Unknown flag --${m}.`,k.length>0?`--${m} is accepted by: ${k.join(", ")}.`:x===void 0?`Run \`${A.slug} ${n.name} --help\` for the flags this command accepts.`:`Did you mean --${x}?`,`--${m}`));continue}let p=`--${m}`;if(h.kind==="boolean"){if(u!==-1){d.push(c("cli_flag_takes_no_value",`${p} is a switch and takes no value.`,`Drop the "=${a.slice(u+1)}" — pass ${p} on its own.`,p));continue}l.set(h.name,!0);continue}if(u!==-1){w(h,a.slice(u+1),p);continue}let b=e[s+1];if(h.bare!==void 0&&(b===void 0||b.startsWith("-"))){l.set(h.name,h.bare);continue}if(b===void 0){d.push(c("cli_flag_needs_value",`${p} needs a value.`,`Pass one, as in ${p} <${h.placeholder??"value"}>.`,p));continue}w(h,b,p),s+=1;continue}if(r.startsWith("-")&&r.length>1){for(let a of[...r.slice(1)]){let u=g.get(a);if(u===void 0){d.push(c("cli_unknown_flag",`Unknown flag -${a}.`,`Run \`${A.slug} ${n.name} --help\` for the flags this command accepts.`,`-${a}`));continue}if(u.kind!=="boolean"){d.push(c("cli_short_flag_needs_value",`-${a} takes a value and cannot be bundled.`,`Write it on its own: --${u.name} <${u.placeholder??"value"}>.`,`-${a}`));continue}l.set(u.name,!0)}continue}f.push(r)}let v=new R(l,o);if(v.bool("help"))return{kind:"help",command:n};if(v.bool("version"))return{kind:"version"};let N=n.args.some((s)=>s.variadic===!0),F=n.args.filter((s)=>s.required);if(d.length>0)throw y(d);else if(f.length<F.length){let s=F[f.length];d.push(c("cli_missing_argument",`${n.name} needs ${s===void 0?"another argument":`a ${s.name}`}.`,`Usage: ${A.slug} ${n.name} ${n.args.map((r)=>`<${r.name}${r.variadic===!0?"...":""}>`).join(" ")}`))}else if(!N&&f.length>n.args.length){let s=f.slice(n.args.length);d.push(c("cli_unexpected_argument",`${n.name} takes ${n.args.length} argument(s), got ${f.length}.`,n.unexpectedArgHint??`Unexpected: ${s.join(" ")}. Quote a value containing spaces.`))}if(d.length>0)throw y(d);return{kind:"command",parsed:{command:n,positionals:f,flags:v}}}
3
- export{tA,$i};
2
+ import{t,A}from"./index-26ejkp8q.js";import{sn,nt,OA,an,es}from"./index-4t3p7vm9.js";class At extends A{static ERROR_NAME="UsageError"}function S(e,i){let n=Array.from({length:i.length+1},(o,g)=>g);for(let o=1;o<=e.length;o+=1){let g=[o];for(let l=1;l<=i.length;l+=1){let f=(n[l-1]??0)+(e[o-1]===i[l-1]?0:1),d=(g[l-1]??0)+1,_=(n[l]??0)+1;g.push(Math.min(f,d,_))}n=g}return n[i.length]??Math.max(e.length,i.length)}function M(e,i){let n,o=Number.POSITIVE_INFINITY;for(let g of i){let l=S(e,g);if(l<o)o=l,n=g}return n!==void 0&&o<=Math.max(2,Math.floor(e.length/3))?n:void 0}class R{#e;#t;constructor(e,i){this.#e=e,this.#t=i}#n(e,i){let n=this.#t.get(e);if(n===void 0)throw new At({code:"cli_flag_not_declared",message:`No flag "${e}" is declared for this command.`,hint:"This is a bug in the CLI, not in the command line. Add the flag to lib/commands.ts or fix the reader."});if(n.kind!==i)throw new At({code:"cli_flag_kind_mismatch",message:`Flag "${e}" is declared as ${n.kind} but was read as ${i}.`,hint:"This is a bug in the CLI. The reader and lib/commands.ts disagree."});return this.#e.get(e)}str(e){let i=this.#n(e,"string");return typeof i==="string"?i:void 0}num(e){let i=this.#n(e,"number");return typeof i==="number"?i:void 0}bool(e){return this.#n(e,"boolean")===!0}has(e){return this.#e.has(e)}}function c(e,i,n,o){return o===void 0?{code:e,message:i,hint:n}:{code:e,message:i,hint:n,field:o}}function y(e){let i=e[0];return new At({code:"cli_usage",message:e.length===1&&i!==void 0?i.message:`${e.length} problems with the command line.`,hint:e.length===1&&i!==void 0?i.hint:"Each problem below names the flag and its fix.",...i?.field===void 0?{}:{field:i.field},details:e})}function D(e,i,n){let o=Number(i);if(i.trim()===""||!Number.isFinite(o))return c("cli_flag_not_a_number",`${n} expects a number, got ${JSON.stringify(i)}.`,`Pass a number, as in ${n} 50. The old parser silently used the default here, which made a typo look like it worked.`,n);if(e.integer===!0&&!Number.isInteger(o))return c("cli_flag_not_an_integer",`${n} expects a whole number, got ${i}.`,`Drop the fractional part: ${n} ${Math.trunc(o)}.`,n);if(e.min!==void 0&&o<e.min)return c("cli_flag_below_min",`${n} must be at least ${e.min}, got ${o}.`,`Pass ${e.min} or more.`,n);return o}function $i(e){let i=e[0];if(i===void 0)return{kind:"usage"};if(i.startsWith("-")){let s=new Set(sn.flatMap((a)=>a.short===void 0?[`--${a.name}`]:[`--${a.name}`,`-${a.short}`])),r=e.filter((a)=>!s.has(a));if(r.length>0)throw y([c("cli_no_command","No command given.",`Run \`${t.slug} --help\` for the command list. Commands are ${nt.map((a)=>a.name).join(", ")}.`,r[0])]);if(e.includes("--version")||e.includes("-v"))return{kind:"version"};if(e.includes("--help")||e.includes("-h"))return{kind:"help",command:void 0};return{kind:"usage"}}let n=OA(i);if(n===void 0){let s=M(i,nt.map((r)=>r.name));throw y([c("cli_unknown_command",`Unknown command "${i}".`,s===void 0?`Run \`${t.slug} --help\` for the command list.`:`Did you mean "${s}"? Run \`${t.slug} --help\` for the full list.`,i)])}let o=new Map(an(n).map((s)=>[s.name,s])),g=new Map(an(n).filter((s)=>s.short!==void 0).map((s)=>[s.short,s])),l=new Map,f=[],d=[],_=!1,w=(s,r,a)=>{if(r===""){d.push(c("cli_flag_empty_value",`${a} was given an empty value.`,"Pass a value, or drop the flag entirely to use the default.",a));return}if(s.kind==="number"){let u=D(s,r,a);if(typeof u==="number")l.set(s.name,u);else d.push(u);return}l.set(s.name,r)};for(let s=1;s<e.length;s+=1){let r=e[s];if(r===void 0)continue;if(_){f.push(r);continue}if(r==="--"){_=!0;continue}if(r.startsWith("--")){let a=r.slice(2),u=a.indexOf("="),m=u===-1?a:a.slice(0,u),h=o.get(m);if(h===void 0){let k=es(m,n.name),x=M(m,[...o.keys()]);d.push(c(k.length>0?"cli_flag_wrong_command":"cli_unknown_flag",k.length>0?`${n.name} does not accept --${m}.`:`Unknown flag --${m}.`,k.length>0?`--${m} is accepted by: ${k.join(", ")}.`:x===void 0?`Run \`${t.slug} ${n.name} --help\` for the flags this command accepts.`:`Did you mean --${x}?`,`--${m}`));continue}let p=`--${m}`;if(h.kind==="boolean"){if(u!==-1){d.push(c("cli_flag_takes_no_value",`${p} is a switch and takes no value.`,`Drop the "=${a.slice(u+1)}" — pass ${p} on its own.`,p));continue}l.set(h.name,!0);continue}if(u!==-1){w(h,a.slice(u+1),p);continue}let b=e[s+1];if(h.bare!==void 0&&(b===void 0||b.startsWith("-"))){l.set(h.name,h.bare);continue}if(b===void 0){d.push(c("cli_flag_needs_value",`${p} needs a value.`,`Pass one, as in ${p} <${h.placeholder??"value"}>.`,p));continue}w(h,b,p),s+=1;continue}if(r.startsWith("-")&&r.length>1){for(let a of[...r.slice(1)]){let u=g.get(a);if(u===void 0){d.push(c("cli_unknown_flag",`Unknown flag -${a}.`,`Run \`${t.slug} ${n.name} --help\` for the flags this command accepts.`,`-${a}`));continue}if(u.kind!=="boolean"){d.push(c("cli_short_flag_needs_value",`-${a} takes a value and cannot be bundled.`,`Write it on its own: --${u.name} <${u.placeholder??"value"}>.`,`-${a}`));continue}l.set(u.name,!0)}continue}f.push(r)}let v=new R(l,o);if(v.bool("help"))return{kind:"help",command:n};if(v.bool("version"))return{kind:"version"};let N=n.args.some((s)=>s.variadic===!0),F=n.args.filter((s)=>s.required);if(d.length>0)throw y(d);else if(f.length<F.length){let s=F[f.length];d.push(c("cli_missing_argument",`${n.name} needs ${s===void 0?"another argument":`a ${s.name}`}.`,`Usage: ${t.slug} ${n.name} ${n.args.map((r)=>`<${r.name}${r.variadic===!0?"...":""}>`).join(" ")}`))}else if(!N&&f.length>n.args.length){let s=f.slice(n.args.length);d.push(c("cli_unexpected_argument",`${n.name} takes ${n.args.length} argument(s), got ${f.length}.`,n.unexpectedArgHint??`Unexpected: ${s.join(" ")}. Quote a value containing spaces.`))}if(d.length>0)throw y(d);return{kind:"command",parsed:{command:n,positionals:f,flags:v}}}
3
+ export{At,$i};
4
4
 
5
- //# debugId=5C15F0C31565ECB564756E2164756E21
6
- //# sourceMappingURL=index-60jxyzbe.js.map
5
+ //# debugId=D04D0AB07DF86B7664756E2164756E21
6
+ //# sourceMappingURL=index-twcgf73h.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * The argument parser. Pure — argv in, a decision out, no I/O and no `process`.\n *\n * It replaces a parser that failed silently in four distinct ways, each of which is now a test:\n *\n * - **A value beginning with `-` was swallowed.** The old rule was \"consume the next token unless\n * it looks like a flag\", so `--input \"-5 degrees\"` set `input` to boolean `true`, the caller's\n * `typeof input === \"string\"` check failed, and the process opened an interactive session instead\n * of running the one turn it was asked for. The rule here has no such hole: whether a flag\n * consumes the next token is a property of the *flag*, declared in `commands.ts`, never a guess\n * about the value.\n * - **Unknown flags were ignored.** `--sesion local:x` ran against the default session silently.\n * - **A non-numeric `--limit` fell back to the default.**\n * - **`--help` with no command exited 1**, reporting failure for the one thing that had succeeded.\n *\n * Every problem found is collected rather than thrown on sight, so a line with two mistakes reports\n * both. `HarnessError.details` already renders that shape.\n */\n\nimport { BRAND, type ErrorDetail, HarnessError } from \"@dispach/core\"\nimport { COMMANDS, commandsAccepting, findCommand, flagsFor, GLOBAL_FLAGS } from \"#lib/commands\"\nimport type { FlagSpec, FlagValue, FlagValues, ParseResult } from \"#lib/schema\"\n\n/** Anything wrong with the command line itself. Distinct from anything wrong with a manifest. */\nexport class UsageError extends HarnessError {\n static override readonly ERROR_NAME = \"UsageError\"\n}\n\n// ─── nearest match ───────────────────────────────────────────────────────────────────────\n\nfunction distance(a: string, b: string): number {\n // Two rows rather than a full matrix; the strings here are flag names.\n let previous = Array.from({ length: b.length + 1 }, (_, i) => i)\n for (let i = 1; i <= a.length; i += 1) {\n const current = [i]\n for (let j = 1; j <= b.length; j += 1) {\n const substitution = (previous[j - 1] ?? 0) + (a[i - 1] === b[j - 1] ? 0 : 1)\n const insertion = (current[j - 1] ?? 0) + 1\n const deletion = (previous[j] ?? 0) + 1\n current.push(Math.min(substitution, insertion, deletion))\n }\n previous = current\n }\n return previous[b.length] ?? Math.max(a.length, b.length)\n}\n\nfunction nearest(word: string, candidates: readonly string[]): string | undefined {\n let best: string | undefined\n let bestScore = Number.POSITIVE_INFINITY\n for (const candidate of candidates) {\n const score = distance(word, candidate)\n if (score < bestScore) {\n bestScore = score\n best = candidate\n }\n }\n // A suggestion has to be plausible. Beyond a third of the word it is noise, and noise in an\n // error message is worse than no suggestion at all.\n return best !== undefined && bestScore <= Math.max(2, Math.floor(word.length / 3))\n ? best\n : undefined\n}\n\n// ─── flag values ─────────────────────────────────────────────────────────────────────────\n\nclass Values implements FlagValues {\n readonly #values: ReadonlyMap<string, FlagValue>\n readonly #specs: ReadonlyMap<string, FlagSpec>\n\n constructor(values: ReadonlyMap<string, FlagValue>, specs: ReadonlyMap<string, FlagSpec>) {\n this.#values = values\n this.#specs = specs\n }\n\n #expect(name: string, kind: FlagSpec[\"kind\"]): FlagValue | undefined {\n const spec = this.#specs.get(name)\n if (spec === undefined) {\n throw new UsageError({\n code: \"cli_flag_not_declared\",\n message: `No flag \"${name}\" is declared for this command.`,\n hint: \"This is a bug in the CLI, not in the command line. Add the flag to lib/commands.ts or fix the reader.\",\n })\n }\n if (spec.kind !== kind) {\n throw new UsageError({\n code: \"cli_flag_kind_mismatch\",\n message: `Flag \"${name}\" is declared as ${spec.kind} but was read as ${kind}.`,\n hint: \"This is a bug in the CLI. The reader and lib/commands.ts disagree.\",\n })\n }\n return this.#values.get(name)\n }\n\n str(name: string): string | undefined {\n const value = this.#expect(name, \"string\")\n return typeof value === \"string\" ? value : undefined\n }\n\n num(name: string): number | undefined {\n const value = this.#expect(name, \"number\")\n return typeof value === \"number\" ? value : undefined\n }\n\n bool(name: string): boolean {\n return this.#expect(name, \"boolean\") === true\n }\n\n has(name: string): boolean {\n return this.#values.has(name)\n }\n}\n\n// ─── parse ───────────────────────────────────────────────────────────────────────────────\n\nfunction detail(code: string, message: string, hint: string, field?: string): ErrorDetail {\n return field === undefined ? { code, message, hint } : { code, message, hint, field }\n}\n\nfunction usage(details: ErrorDetail[]): UsageError {\n const first = details[0]\n return new UsageError({\n code: \"cli_usage\",\n message:\n details.length === 1 && first !== undefined\n ? first.message\n : `${details.length} problems with the command line.`,\n hint:\n details.length === 1 && first !== undefined\n ? first.hint\n : \"Each problem below names the flag and its fix.\",\n ...(first?.field === undefined ? {} : { field: first.field }),\n details,\n })\n}\n\nfunction readNumber(spec: FlagSpec, raw: string, written: string): number | ErrorDetail {\n const value = Number(raw)\n if (raw.trim() === \"\" || !Number.isFinite(value)) {\n return detail(\n \"cli_flag_not_a_number\",\n `${written} expects a number, got ${JSON.stringify(raw)}.`,\n `Pass a number, as in ${written} 50. The old parser silently used the default here, which made a typo look like it worked.`,\n written,\n )\n }\n if (spec.integer === true && !Number.isInteger(value)) {\n return detail(\n \"cli_flag_not_an_integer\",\n `${written} expects a whole number, got ${raw}.`,\n `Drop the fractional part: ${written} ${Math.trunc(value)}.`,\n written,\n )\n }\n if (spec.min !== undefined && value < spec.min) {\n return detail(\n \"cli_flag_below_min\",\n `${written} must be at least ${spec.min}, got ${value}.`,\n `Pass ${spec.min} or more.`,\n written,\n )\n }\n return value\n}\n\n/**\n * `argv` is everything after the program name.\n *\n * The command comes first, before any flag, as with git and docker. That ordering is what makes the\n * parse unambiguous: flag semantics depend on the command's spec, so the command has to be known\n * before a single flag can be interpreted.\n */\nexport function parse(argv: readonly string[]): ParseResult {\n const head = argv[0]\n\n if (head === undefined) return { kind: \"usage\" }\n\n if (head.startsWith(\"-\")) {\n // No command. Only the global flags can appear here, and only two of them do anything.\n const globals = new Set(\n GLOBAL_FLAGS.flatMap((flag) =>\n flag.short === undefined\n ? [`--${flag.name}`]\n : [`--${flag.name}`, `-${flag.short}`],\n ),\n )\n const unknown = argv.filter((token) => !globals.has(token))\n if (unknown.length > 0) {\n throw usage([\n detail(\n \"cli_no_command\",\n \"No command given.\",\n `Run \\`${BRAND.slug} --help\\` for the command list. Commands are ${COMMANDS.map((c) => c.name).join(\", \")}.`,\n unknown[0],\n ),\n ])\n }\n if (argv.includes(\"--version\") || argv.includes(\"-v\")) return { kind: \"version\" }\n if (argv.includes(\"--help\") || argv.includes(\"-h\")) {\n return { kind: \"help\", command: undefined }\n }\n return { kind: \"usage\" }\n }\n\n const command = findCommand(head)\n if (command === undefined) {\n const suggestion = nearest(\n head,\n COMMANDS.map((c) => c.name),\n )\n throw usage([\n detail(\n \"cli_unknown_command\",\n `Unknown command \"${head}\".`,\n suggestion === undefined\n ? `Run \\`${BRAND.slug} --help\\` for the command list.`\n : `Did you mean \"${suggestion}\"? Run \\`${BRAND.slug} --help\\` for the full list.`,\n head,\n ),\n ])\n }\n\n const specs = new Map(flagsFor(command).map((flag) => [flag.name, flag]))\n const shorts = new Map(\n flagsFor(command)\n .filter((flag) => flag.short !== undefined)\n .map((flag) => [flag.short as string, flag]),\n )\n\n const values = new Map<string, FlagValue>()\n const positionals: string[] = []\n const errors: ErrorDetail[] = []\n let terminated = false\n\n const setValue = (spec: FlagSpec, raw: string, written: string): void => {\n if (raw === \"\") {\n errors.push(\n detail(\n \"cli_flag_empty_value\",\n `${written} was given an empty value.`,\n \"Pass a value, or drop the flag entirely to use the default.\",\n written,\n ),\n )\n return\n }\n if (spec.kind === \"number\") {\n const result = readNumber(spec, raw, written)\n if (typeof result === \"number\") values.set(spec.name, result)\n else errors.push(result)\n return\n }\n values.set(spec.name, raw)\n }\n\n for (let i = 1; i < argv.length; i += 1) {\n const token = argv[i]\n if (token === undefined) continue\n\n if (terminated) {\n positionals.push(token)\n continue\n }\n if (token === \"--\") {\n terminated = true\n continue\n }\n\n if (token.startsWith(\"--\")) {\n const body = token.slice(2)\n const eq = body.indexOf(\"=\")\n const name = eq === -1 ? body : body.slice(0, eq)\n const spec = specs.get(name)\n\n if (spec === undefined) {\n const elsewhere = commandsAccepting(name, command.name)\n const suggestion = nearest(name, [...specs.keys()])\n errors.push(\n detail(\n elsewhere.length > 0 ? \"cli_flag_wrong_command\" : \"cli_unknown_flag\",\n elsewhere.length > 0\n ? `${command.name} does not accept --${name}.`\n : `Unknown flag --${name}.`,\n elsewhere.length > 0\n ? `--${name} is accepted by: ${elsewhere.join(\", \")}.`\n : suggestion === undefined\n ? `Run \\`${BRAND.slug} ${command.name} --help\\` for the flags this command accepts.`\n : `Did you mean --${suggestion}?`,\n `--${name}`,\n ),\n )\n continue\n }\n\n const written = `--${name}`\n\n if (spec.kind === \"boolean\") {\n if (eq !== -1) {\n errors.push(\n detail(\n \"cli_flag_takes_no_value\",\n `${written} is a switch and takes no value.`,\n `Drop the \"=${body.slice(eq + 1)}\" — pass ${written} on its own.`,\n written,\n ),\n )\n continue\n }\n values.set(spec.name, true)\n continue\n }\n\n if (eq !== -1) {\n setValue(spec, body.slice(eq + 1), written)\n continue\n }\n\n // Consume the next token unconditionally. This is the fix for the swallowed-value bug:\n // whether a token is a value is decided by the spec, never by whether it starts with a\n // dash. `--input -5` means the text \"-5\".\n const next = argv[i + 1]\n // Unless the spec declares a bare form, in which case a missing token or one starting with a\n // dash means the flag was written on its own. Opt-in per flag, because the inversion is only\n // safe for a field whose values cannot start with a dash — see `FlagSpec.bare`.\n if (spec.bare !== undefined && (next === undefined || next.startsWith(\"-\"))) {\n values.set(spec.name, spec.bare)\n continue\n }\n if (next === undefined) {\n errors.push(\n detail(\n \"cli_flag_needs_value\",\n `${written} needs a value.`,\n `Pass one, as in ${written} <${spec.placeholder ?? \"value\"}>.`,\n written,\n ),\n )\n continue\n }\n setValue(spec, next, written)\n i += 1\n continue\n }\n\n if (token.startsWith(\"-\") && token.length > 1) {\n // Short flags cluster only when every letter is a switch. Anything else is ambiguous\n // about which flag the trailing text belongs to, and guessing is how values get lost.\n for (const letter of [...token.slice(1)]) {\n const spec = shorts.get(letter)\n if (spec === undefined) {\n errors.push(\n detail(\n \"cli_unknown_flag\",\n `Unknown flag -${letter}.`,\n `Run \\`${BRAND.slug} ${command.name} --help\\` for the flags this command accepts.`,\n `-${letter}`,\n ),\n )\n continue\n }\n if (spec.kind !== \"boolean\") {\n errors.push(\n detail(\n \"cli_short_flag_needs_value\",\n `-${letter} takes a value and cannot be bundled.`,\n `Write it on its own: --${spec.name} <${spec.placeholder ?? \"value\"}>.`,\n `-${letter}`,\n ),\n )\n continue\n }\n values.set(spec.name, true)\n }\n continue\n }\n\n positionals.push(token)\n }\n\n // Help wins over argument checking. Asking how to use a command you invoked wrongly is the most\n // likely next thing you want, and refusing to answer would be perverse.\n const flags = new Values(values, specs)\n if (flags.bool(\"help\")) return { kind: \"help\", command }\n if (flags.bool(\"version\")) return { kind: \"version\" }\n\n // Positional counting is only meaningful once every flag parsed. An unknown flag cannot consume\n // its value — the kind is unknown — so the orphan lands here as a positional, and reporting\n // \"takes 1 argument, got 2\" alongside the real mistake sends the reader looking in the wrong\n // place. Report causes, never their consequences.\n const variadic = command.args.some((arg) => arg.variadic === true)\n const required = command.args.filter((arg) => arg.required)\n if (errors.length > 0) {\n throw usage(errors)\n } else if (positionals.length < required.length) {\n const missing = required[positionals.length]\n errors.push(\n detail(\n \"cli_missing_argument\",\n `${command.name} needs ${missing === undefined ? \"another argument\" : `a ${missing.name}`}.`,\n `Usage: ${BRAND.slug} ${command.name} ${command.args.map((a) => `<${a.name}${a.variadic === true ? \"...\" : \"\"}>`).join(\" \")}`,\n ),\n )\n } else if (!variadic && positionals.length > command.args.length) {\n const extra = positionals.slice(command.args.length)\n errors.push(\n detail(\n \"cli_unexpected_argument\",\n `${command.name} takes ${command.args.length} argument(s), got ${positionals.length}.`,\n command.unexpectedArgHint ??\n `Unexpected: ${extra.join(\" \")}. Quote a value containing spaces.`,\n ),\n )\n }\n\n if (errors.length > 0) throw usage(errors)\n\n return { kind: \"command\", parsed: { command, positionals, flags } }\n}\n"
6
6
  ],
7
7
  "mappings": ";qFAwBO,MAAM,WAAmB,CAAa,QAChB,WAAa,YAC1C,CAIA,SA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Go=10,ga=4,ca=6,Fo=3,la=2000,Uo=50,Ia=1,o=0,u=1,ua=143;var da=3,Ea=23,Ca=8,fa=400,Or=1,yn=12,pa=300,ha=2000;
3
+ export{oa,Ro,ra,Rt,ia,sa,be,_o,ko,Lo,vo,Po,uA,dA,EA,aa,Ci,Go,ga,ca,Fo,la,Uo,Ia,o,u,ua,da,Ea,Ca,fa,Or,yn,pa,ha};
4
+
5
+ //# debugId=36922320F4F187AB64756E2164756E21
6
+ //# sourceMappingURL=index-vw2hf4d8.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * Every constant the CLI uses, in one place.\n *\n * The rule is the one termheat follows: no magic number inline. A width, a limit, or a control\n * sequence buried in a component is invisible to anyone tuning behaviour later, and two copies of\n * the same number drift.\n */\n\n// ─── terminal ────────────────────────────────────────────────────────────────────────────\n\nexport const SHOW_CURSOR = \"\\u001B[?25h\"\nexport const RESET_STYLE = \"\\u001B[0m\"\n/**\n * Faint text, for the one thing written outside Ink that is not the point of the output.\n *\n * SGR 2 rather than a grey foreground: a fixed colour is wrong on half the terminals in existence,\n * and dim is the terminal's own opinion about what recedes on the theme in use. It persists across a\n * newline, so a multi-line note opens it once and resets once — and the reset lands before the final\n * newline, or the shell prompt that follows inherits it.\n */\nexport const DIM_STYLE = \"\\u001B[2m\"\n\n/**\n * The alternate screen buffer — a second, empty screen the terminal swaps in, discards on the way\n * out, and never adds to the scrollback.\n *\n * `1049` rather than the older `47`: it saves the cursor position and clears the new buffer in one\n * sequence, which is what lands the shell prompt back where it was rather than wherever the app left\n * the cursor.\n *\n * The order on the way out is easy to get backwards. A style reset applies to whichever buffer is\n * *current*, so it has to be written before the swap away — reset afterwards and any colour the app\n * left on lands on the shell's screen instead of the one being discarded. `restoreTerminal` does them\n * in that order and says so there too.\n */\nexport const ENTER_ALT_SCREEN = \"\\u001B[?1049h\"\nexport const LEAVE_ALT_SCREEN = \"\\u001B[?1049l\"\n\n/**\n * Pop the kitty keyboard protocol: `CSI < u`, the counterpart to the `CSI > flags u` Ink pushes.\n *\n * Here rather than in `lib/keyboard.ts` so the dependency runs one way — `lib/exit.ts` needs the\n * sequence and `lib/keyboard.ts` needs `markEnhancedKeys`, and only one of those two can import the\n * other. Terminal-mode sequences already live in this module, which makes this the side that moves.\n */\nexport const DISABLE_ENHANCED_KEYS = \"\\u001B[<u\"\n\n/**\n * Fallback width. A pty can genuinely report `columns === 0` — measured, under `script -q`, which\n * is how this repo drives a real TTY in a test harness. Any layout maths that divides by the\n * terminal width has to survive that.\n */\nexport const FALLBACK_COLUMNS = 80\nexport const FALLBACK_ROWS = 24\n\n/**\n * Rows the live pane may occupy before it starts showing only its tail.\n *\n * Ink erases and redraws its whole dynamic tree every frame, so an unbounded live region means\n * redrawing hundreds of lines per token. Finished messages move into `<Static>`, which is written\n * once and never touched again; this cap is what keeps the *unfinished* one cheap.\n */\nexport const LIVE_PANE_MAX_ROWS = 12\n\nexport const PROMPT = \"› \"\n\n/**\n * The width a screen is laid out for, clamped at both ends.\n *\n * The floor is where the row layout drops its description column rather than wrapping — below it\n * nothing sensible is possible, and a wrapped row is what made the first skills list unreadable. The\n * ceiling stops a 300-column window putting a description a screen away from the name it belongs to.\n *\n * Here rather than in the one command that first needed them, because every screen now shares a frame\n * and two screens clamping differently is the drift `render.ts` was written to end.\n */\nexport const MIN_SCREEN_COLUMNS = 40\nexport const MAX_SCREEN_COLUMNS = 140\n\n/** Rows a scrolling list may occupy, before and after the frame takes its share. */\nexport const MIN_SCREEN_ROWS = 8\nexport const MAX_SCREEN_ROWS = 40\n/** Header, footer, margins and the counter — what the frame costs a list. */\nexport const SCREEN_CHROME_ROWS = 8\n\n// ─── commands and input ──────────────────────────────────────────────────────────────────\n\n// The command words themselves live in `session-commands.ts`, beside the summary that documents\n// each one and the dispatch that honours it. Three bare string constants here is how the help text\n// and the parser came to disagree in the first place.\n\n/** Lines of input history kept for the up/down arrows. */\nexport const HISTORY_LIMIT = 200\n\n/**\n * Undo points kept for the input buffer.\n *\n * Bounded because a snapshot holds a whole copy of the text, and a long composing session with a\n * pasted document in it would otherwise keep every intermediate version alive for the life of the\n * process. A run of typing is one point, not one per keystroke, so this is deeper than it looks.\n */\nexport const UNDO_LIMIT = 100\n\n/**\n * Rows the input box may grow to before it scrolls internally.\n *\n * The same reasoning as `LIVE_PANE_MAX_ROWS`: the input is in Ink's dynamic region, which is erased and\n * redrawn every frame, so an unbounded box means redrawing a pasted document on every keystroke. It\n * also stops a long paste pushing the conversation off the screen.\n */\nexport const MAX_INPUT_ROWS = 10\n\n/**\n * Rows of a reasoning block shown before it folds to a count.\n *\n * Reasoning is secondary and routinely the longest item in a conversation — a real turn produced a\n * twenty-three-row block for a one-sentence answer, which filled a thirty-row terminal on its own and made\n * the reply itself something you had to scroll to find. Four rows is enough to see what it was thinking\n * about; `⌥r` shows the rest.\n *\n * Folding is a *view* decision, applied when items become rows. The whole text is always in the item, so\n * expanding needs no re-derivation and nothing is lost.\n */\nexport const REASONING_FOLD_ROWS = 4\n\n/** Matches `^R` shows at once. Enough to recognise one, few enough to leave the prompt on screen. */\nexport const SEARCH_ROWS = 6\n\n/**\n * Rows a single-value field may wrap to before it scrolls to follow the caret.\n *\n * Smaller than `MAX_INPUT_ROWS`, because a *value* is not a message: a wizard answer and a manifest\n * setting are one line of intent that happens to be long. Three is enough for the longest thing a\n * generated manifest holds — `tools.pinned` at 92 characters is two rows on an 80-column terminal — and\n * few enough that the field never pushes the rest of the screen around.\n *\n * There was no bound at all before, because the field passed no width: in the settings editor a long\n * value was clipped at the terminal's edge with the caret past the clip, and you could not see what you\n * were typing. The wizard escaped it — a bordered box bounds its text whatever the field passes.\n */\nexport const FIELD_ROWS = 3\n\n/**\n * Transcript items kept before the oldest are dropped.\n *\n * Load-bearing rather than prudent, and it was missing for three phases. While the conversation lived\n * in `<Static>` a finished item was written once and cost nothing afterwards; the alternate screen took\n * that away, so every item is now re-derived and re-wrapped on every frame — an unbounded buffer means\n * unbounded work per keystroke, and the case that reaches it is an agent looping tool calls overnight\n * rather than anybody typing.\n *\n * Counted in **items**, not rows, because the row count depends on the terminal width and the reducer\n * that owns the buffer is pure and has none. That does not contradict the scroll layer's rule that the\n * unit is a row: that rule is about addressing an *offset*, where paging by item steps over a forty-row\n * reply in one keystroke.\n *\n * Deliberately far past any session a person reads end to end — roughly four hundred turns — so the cap\n * is a backstop nobody meets rather than a limit that shapes ordinary use. Eviction is also gated on the\n * reader following the tail; see `TRIM` in `transcript.ts` for why that gate is not optional.\n */\nexport const MAX_TRANSCRIPT_ITEMS = 2000\n\n// ─── defaults ────────────────────────────────────────────────────────────────────────────\n\nexport const DEFAULT_ROW_LIMIT = 50\nexport const MIN_ROW_LIMIT = 1\n\n// ─── exit codes ──────────────────────────────────────────────────────────────────────────\n\nexport const EXIT_OK = 0\nexport const EXIT_FAILURE = 1\n/** 128 + SIGTERM, the shell convention. */\nexport const EXIT_SIGTERM = 143\n\n/** Rows a pane over the conversation may use — a command's output, or a hosted view. */\nexport const PANE_ROWS = 16\n\n/**\n * The fewest rows a scrolling body is ever given.\n *\n * A floor rather than a target. At eight terminal rows the chrome alone — header, composer, status —\n * accounts for most of the screen, and the alternative to a floor is a body of zero rows: a session\n * that shows the prompt and no conversation at all, which reads as a broken renderer rather than as a\n * window somebody should make taller.\n */\nexport const MIN_BODY_ROWS = 3\n\n/**\n * Rows a list may take while landing — before anything has been sent.\n *\n * Deliberately larger than `SEARCH_ROWS`, which is tuned for a live conversation where every row of list is a\n * row of conversation hidden. There is no conversation yet on the landing screen and its whole job is\n * discovery: showing six of fifteen commands behind a `… 9 below` is the wrong trade on the screen somebody\n * opens before they know what the commands are. The brand mark gives up a tier to pay for it, which the tier\n * ladder already knows how to do.\n *\n * **This tracks the size of the in-session command table**, so a phase that adds a command has to raise it —\n * which is why `commands.test.ts` asserts the relationship rather than leaving it to whoever notices the\n * `… 1 below`. It is not derived from `COMMANDS` directly because `commands.ts` reads this module, and the\n * cycle would cost more than the assertion does.\n */\nexport const LANDING_LIST_ROWS = 23\n\n/**\n * Rows of conversation the landing screen keeps, whatever the brand mark would like.\n *\n * The banner is written into the transcript, so a wordmark that squeezed it to nothing would hide the boot\n * notes and every load warning behind a picture — which is the trimmed-catalogue failure with better\n * typography: true of what is on screen, false of what is the case.\n *\n * Eight rather than four, measured against a real banner: four left the window showing the *tail* of it, so\n * the first thing on screen was the second half of a wrapped store path. The banner runs six to eight rows\n * depending on how many load warnings there are.\n */\nexport const MIN_LANDING_TRANSCRIPT = 8\n\n/**\n * How long after a press a second one still counts as a double-click.\n *\n * A terminal reports three presses and never a \"double click\", so the grouping is ours to infer — from time\n * *and* position, because two clicks 300 ms apart on different words are two clicks. 400 ms is the common\n * platform default; longer makes a deliberate second selection turn into a word-select, shorter makes a\n * real double-click fail on a slow hand.\n */\nexport const MULTI_CLICK_MS = 400\n\n/** The blank row between the brand mark and the one-line header under it. */\nexport const BRAND_GAP_ROWS = 1\n\n/** Conversations the session picker shows at once. The list scrolls inside this. */\nexport const SESSION_PICKER_ROWS = 12\n\n/**\n * How often `daemon logs --follow` checks a service log for new bytes.\n *\n * Polled rather than watched: `fs.watch` on macOS reports another process's appends unreliably, and a\n * follower that misses the line somebody is waiting for is worse than one that arrives a third of a\n * second late — the reason to watch a log live is not trusting what you have been told. Ctrl-C wakes the\n * pending sleep rather than waiting it out, so this interval never delays a stop.\n */\nexport const LOG_POLL_MS = 300\n\n/**\n * How long a ^C at an idle prompt stays armed.\n *\n * The chord is doubled rather than immediate because a single ^C means \"cancel the turn\" everywhere\n * else in this session, and the two are one keystroke apart. Long enough to be a deliberate second\n * press, short enough that an armed prompt left alone goes back to being safe.\n */\nexport const EXIT_ARM_MS = 2000\n"
6
6
  ],
7
7
  "mappings": ";AAUO,IAAM,GAAc,YACd,GAAc,UASd,GAAY,UAeZ,GAAmB,cACnB,GAAmB,cASnB,GAAwB,UAOxB,GAAmB,GACnB,GAAgB,GAShB,GAAqB,GAErB,GAAS,KAYT,GAAqB,GACrB,GAAqB,IAGrB,GAAkB,EAClB,GAAkB,GAElB,GAAqB,EASrB,GAAgB,IAShB,GAAa,IASb,GAAiB,GAajB,GAAsB,EAGtB,GAAc,EAcd,GAAa,EAoBb,GAAuB,KAIvB,GAAoB,GACpB,GAAgB,EAIhB,EAAU,EACV,EAAe,EAEf,GAAe,IAarB,IAAM,GAAgB,EAgBhB,GAAoB,GAapB,GAAyB,EAUzB,GAAiB,IAGjB,GAAiB,EAGjB,GAAsB,GAUtB,GAAc,IASd,GAAc",
8
- "debugId": "BD6C01B66CCF614164756E2164756E21",
8
+ "debugId": "36922320F4F187AB64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{i,ze}from"./index-rfa0ztab.js";import{Box as l,Text as o}from"ink";import{jsx as e,jsxs as d}from"react/jsx-runtime";function ht({title:n,lines:t}){return d(l,{flexDirection:"column",borderStyle:ze,borderColor:i.borderActive,paddingX:1,children:[e(o,{bold:!0,color:i.accent,children:n}),t.map((r)=>e(o,{dimColor:!0,children:r},r))]})}
3
- export{ht};
2
+ import{i,ze}from"./index-j20k6k0m.js";import{Box as l,Text as o}from"ink";import{jsx as e,jsxs as d}from"react/jsx-runtime";function BA({title:n,lines:t}){return d(l,{flexDirection:"column",borderStyle:ze,borderColor:i.borderActive,paddingX:1,children:[e(o,{bold:!0,color:i.accent,children:n}),t.map((r)=>e(o,{dimColor:!0,children:r},r))]})}
3
+ export{BA};
4
4
 
5
- //# debugId=327A0EEDF1F27D7464756E2164756E21
6
- //# sourceMappingURL=index-m5rmhcez.js.map
5
+ //# debugId=D436777A6FF4FAA364756E2164756E21
6
+ //# sourceMappingURL=index-w97gprre.js.map
@@ -5,6 +5,6 @@
5
5
  "/**\n * The welcome box: product identity in a rounded frame, context lines dim beneath it.\n *\n * Purely presentational — the caller supplies the title (usually `BRAND.name + version`) and the\n * lines, so this renders identically at the top of a chat session, a wizard, or the picker.\n *\n * Every boxed surface stretches to the full terminal width — no `alignSelf`. Content-fit boxes\n * next to full-width ones read as different components; one rule everywhere is what makes the\n * screens look like one product.\n */\n\nimport { Box, Text } from \"ink\"\nimport { BORDER_STYLE, THEME } from \"#lib/theme\"\n\nexport interface BannerProps {\n readonly title: string\n readonly lines: readonly string[]\n}\n\nexport function Banner({ title, lines }: BannerProps) {\n return (\n <Box\n flexDirection=\"column\"\n borderStyle={BORDER_STYLE}\n borderColor={THEME.borderActive}\n paddingX={1}\n >\n <Text bold color={THEME.accent}>\n {title}\n </Text>\n {lines.map((line) => (\n <Text key={line} dimColor>\n {line}\n </Text>\n ))}\n </Box>\n )\n}\n"
6
6
  ],
7
7
  "mappings": ";sCAWA,cAAS,UAAK,8DAQP,SAAS,EAAM,EAAG,QAAO,SAAsB,CAClD,OACI,EAAC,EAAD,CACI,cAAc,SACd,YAAa,GACb,YAAa,EAAM,aACnB,SAAU,EAJd,SAcE,CARE,EAAC,EAAD,CAAM,KAAI,GAAC,MAAO,EAAM,OAAxB,SACK,EACH,EACD,EAAM,IAAI,CAAC,IACR,EAAC,EAAD,CAAiB,SAAQ,GAAzB,SACK,GADM,CAET,CACL,GACH",
8
- "debugId": "327A0EEDF1F27D7464756E2164756E21",
8
+ "debugId": "D436777A6FF4FAA364756E2164756E21",
9
9
  "names": []
10
10
  }