dispach 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -25
- package/dist/APEv2Parser-x13n424p.js +5 -0
- package/dist/{FlacParser-drm5wq0p.js.map → APEv2Parser-x13n424p.js.map} +1 -1
- package/dist/{AiffParser-9hj6fpmy.js → AiffParser-ns1y9f0g.js} +3 -3
- package/dist/{AiffParser-9hj6fpmy.js.map → AiffParser-ns1y9f0g.js.map} +1 -1
- package/dist/App-wkpkwgjt.js +11 -0
- package/dist/{App-2f72vhjv.js.map → App-wkpkwgjt.js.map} +1 -1
- package/dist/AsfParser-bae2a1yf.js +5 -0
- package/dist/{AsfParser-7emspn04.js.map → AsfParser-bae2a1yf.js.map} +1 -1
- package/dist/ConfigEditor-hy9jtas3.js +6 -0
- package/dist/{ConfigEditor-vk7vxaa6.js.map → ConfigEditor-hy9jtas3.js.map} +1 -1
- package/dist/DsdiffParser-s0zvxnfa.js +5 -0
- package/dist/{DsdiffParser-dz88pnnr.js.map → DsdiffParser-s0zvxnfa.js.map} +1 -1
- package/dist/{DsfParser-qgh63tbs.js → DsfParser-90mvzt4v.js} +3 -3
- package/dist/{DsfParser-qgh63tbs.js.map → DsfParser-90mvzt4v.js.map} +1 -1
- package/dist/FlacParser-8xprykrh.js +5 -0
- package/dist/{APEv2Parser-ysjr6adv.js.map → FlacParser-8xprykrh.js.map} +1 -1
- package/dist/{KeyProbe-5anphmb7.js → KeyProbe-fk5krzks.js} +3 -3
- package/dist/{KeyProbe-5anphmb7.js.map → KeyProbe-fk5krzks.js.map} +1 -1
- package/dist/MP4Parser-nmvbkq21.js +5 -0
- package/dist/{MP4Parser-yr7p3z12.js.map → MP4Parser-nmvbkq21.js.map} +2 -2
- package/dist/{MatroskaParser-jkbsbsk3.js → MatroskaParser-tsmz2qfq.js} +3 -3
- package/dist/{MatroskaParser-jkbsbsk3.js.map → MatroskaParser-tsmz2qfq.js.map} +1 -1
- package/dist/{MpegParser-t93vwnew.js → MpegParser-y5fjpaz9.js} +3 -3
- package/dist/{MpegParser-t93vwnew.js.map → MpegParser-y5fjpaz9.js.map} +1 -1
- package/dist/MusepackParser-544q0byg.js +5 -0
- package/dist/{MusepackParser-6e8kbh2d.js.map → MusepackParser-544q0byg.js.map} +2 -2
- package/dist/OggParser-v77rbjnt.js +5 -0
- package/dist/{OggParser-ggcypmag.js.map → OggParser-v77rbjnt.js.map} +1 -1
- package/dist/Picker-32m79nmp.js +5 -0
- package/dist/{Picker-j7txnm7w.js.map → Picker-32m79nmp.js.map} +1 -1
- package/dist/SessionPicker-9p06npt5.js +5 -0
- package/dist/{SessionPicker-hpv2ncsb.js.map → SessionPicker-9p06npt5.js.map} +1 -1
- package/dist/SkillBrowser-ezdx3xsh.js +5 -0
- package/dist/{SkillBrowser-qc542n71.js.map → SkillBrowser-ezdx3xsh.js.map} +1 -1
- package/dist/WavPackParser-k623m0hk.js +5 -0
- package/dist/{WavPackParser-jw9stzqp.js.map → WavPackParser-k623m0hk.js.map} +1 -1
- package/dist/WaveParser-nj4p1vx8.js +5 -0
- package/dist/{WaveParser-epmncs9w.js.map → WaveParser-nj4p1vx8.js.map} +1 -1
- package/dist/WizardApp-p350qspw.js +5 -0
- package/dist/{WizardApp-pgzcz9zq.js.map → WizardApp-p350qspw.js.map} +1 -1
- package/dist/channels-a9zx9yba.js +31 -0
- package/dist/{channels-m8nambmm.js.map → channels-a9zx9yba.js.map} +1 -1
- package/dist/config-3mz4zwsf.js +24 -0
- package/dist/{config-hmgrqgf2.js.map → config-3mz4zwsf.js.map} +2 -2
- package/dist/credential-ja7zmd4c.js +19 -0
- package/dist/{credential-nkb2ya59.js.map → credential-ja7zmd4c.js.map} +1 -1
- package/dist/index-039ew35r.js +6 -0
- package/dist/index-039ew35r.js.map +10 -0
- package/dist/index-0dvs3a06.js +6 -0
- package/dist/{index-jc4kmfwa.js.map → index-0dvs3a06.js.map} +1 -1
- package/dist/{index-pszmnhgq.js → index-1cagdzqe.js} +9 -9
- package/dist/{index-pszmnhgq.js.map → index-1cagdzqe.js.map} +1 -1
- package/dist/index-2fw9e5gg.js +6 -0
- package/dist/{index-0444sh6x.js.map → index-2fw9e5gg.js.map} +1 -1
- package/dist/{index-hgm2gchq.js → index-2td5h856.js} +12 -12
- package/dist/{index-hgm2gchq.js.map → index-2td5h856.js.map} +1 -1
- package/dist/{index-m6fqx0ch.js → index-446exxcb.js} +7 -7
- package/dist/{index-m6fqx0ch.js.map → index-446exxcb.js.map} +1 -1
- package/dist/{index-snz49ndn.js → index-4fajxhdv.js} +4 -4
- package/dist/{index-snz49ndn.js.map → index-4fajxhdv.js.map} +1 -1
- package/dist/index-4j65jp20.js +9 -0
- package/dist/{index-38gs9anh.js.map → index-4j65jp20.js.map} +1 -1
- package/dist/index-5gn74n56.js +10 -0
- package/dist/{index-22fzzn7z.js.map → index-5gn74n56.js.map} +2 -2
- package/dist/index-5zpfz4kb.js +9 -0
- package/dist/{index-eztfverw.js.map → index-5zpfz4kb.js.map} +1 -1
- package/dist/index-60h4knj6.js +126 -0
- package/dist/{index-ry6a4bqh.js.map → index-60h4knj6.js.map} +2 -2
- package/dist/index-635wcsh1.js +5 -0
- package/dist/{index-2bsardvh.js.map → index-635wcsh1.js.map} +1 -1
- package/dist/{index-k8e9f466.js → index-67sfck4d.js} +19 -19
- package/dist/index-67sfck4d.js.map +13 -0
- package/dist/index-7p8d1gf0.js +63 -0
- package/dist/{index-ytxbw8py.js.map → index-7p8d1gf0.js.map} +1 -1
- package/dist/index-7zgjkbb0.js +5 -0
- package/dist/{index-qgsdgbk8.js.map → index-7zgjkbb0.js.map} +1 -1
- package/dist/{index-zw6wyas6.js → index-86rb86nr.js} +4 -4
- package/dist/{index-zw6wyas6.js.map → index-86rb86nr.js.map} +1 -1
- package/dist/{index-fbsrhcga.js → index-8jejze0z.js} +4 -4
- package/dist/{index-fbsrhcga.js.map → index-8jejze0z.js.map} +1 -1
- package/dist/index-8k8y7edx.js +7 -0
- package/dist/{index-3826kf9t.js.map → index-8k8y7edx.js.map} +1 -1
- package/dist/index-8mkatm20.js +6 -0
- package/dist/{index-42e29zs4.js.map → index-8mkatm20.js.map} +1 -1
- package/dist/{index-3vzf253k.js → index-9k6qa50r.js} +7 -7
- package/dist/{index-3vzf253k.js.map → index-9k6qa50r.js.map} +1 -1
- package/dist/{index-yw3fby4n.js → index-a1axc952.js} +4 -4
- package/dist/{index-yw3fby4n.js.map → index-a1axc952.js.map} +1 -1
- package/dist/index-ayhdn87b.js +6 -0
- package/dist/{index-dzy19wtf.js.map → index-ayhdn87b.js.map} +1 -1
- package/dist/index-b8bfzbfe.js +6 -0
- package/dist/{index-836hc2h1.js.map → index-b8bfzbfe.js.map} +2 -2
- package/dist/index-brh25jhq.js +6 -0
- package/dist/{index-hrwakb11.js.map → index-brh25jhq.js.map} +2 -2
- package/dist/index-c6qrcweh.js +6 -0
- package/dist/{index-nxhqf597.js.map → index-c6qrcweh.js.map} +1 -1
- package/dist/index-cb45233h.js +6 -0
- package/dist/{index-nvc24414.js.map → index-cb45233h.js.map} +1 -1
- package/dist/{index-51x0n5z0.js → index-dcy14zdn.js} +5 -5
- package/dist/{index-51x0n5z0.js.map → index-dcy14zdn.js.map} +1 -1
- package/dist/index-f6r3h2yh.js +8 -0
- package/dist/{index-9t4dz145.js.map → index-f6r3h2yh.js.map} +1 -1
- package/dist/index-gezqawvw.js +11 -0
- package/dist/{index-sh44ymqz.js.map → index-gezqawvw.js.map} +1 -1
- package/dist/{index-1mbdz3f7.js → index-h787rq0h.js} +10 -10
- package/dist/{index-1mbdz3f7.js.map → index-h787rq0h.js.map} +1 -1
- package/dist/index-hd5nkwd7.js +74 -0
- package/dist/{index-djeqvfms.js.map → index-hd5nkwd7.js.map} +5 -5
- package/dist/index-k6wq0j4q.js +6 -0
- package/dist/{index-mjfv7k5w.js.map → index-k6wq0j4q.js.map} +1 -1
- package/dist/index-kz01jz58.js +6 -0
- package/dist/{index-323jvr1g.js.map → index-kz01jz58.js.map} +1 -1
- package/dist/{index-dv9pdjy4.js → index-mgef1n4e.js} +10 -10
- package/dist/{index-dv9pdjy4.js.map → index-mgef1n4e.js.map} +1 -1
- package/dist/{index-fxpmx6cr.js → index-n197qdw1.js} +191 -191
- package/dist/{index-fxpmx6cr.js.map → index-n197qdw1.js.map} +3 -3
- package/dist/index-nndwx2wp.js +153 -0
- package/dist/{index-dpcm1j62.js.map → index-nndwx2wp.js.map} +2 -2
- package/dist/index-pz92ksp8.js +5 -0
- package/dist/{index-3c5jt6by.js.map → index-pz92ksp8.js.map} +1 -1
- package/dist/index-qj4adnfe.js +14 -0
- package/dist/{index-y7dxq4a4.js.map → index-qj4adnfe.js.map} +2 -2
- package/dist/index-r83jpct7.js +6 -0
- package/dist/{index-xg7s813b.js.map → index-r83jpct7.js.map} +2 -2
- package/dist/{index-2zjh5zd5.js → index-rqfwd7j5.js} +4 -4
- package/dist/{index-2zjh5zd5.js.map → index-rqfwd7j5.js.map} +1 -1
- package/dist/index-s0f0s6n5.js +6 -0
- package/dist/{index-pqw1n1pv.js.map → index-s0f0s6n5.js.map} +1 -1
- package/dist/index-s0t15ndj.js +6 -0
- package/dist/{index-8edck2pr.js.map → index-s0t15ndj.js.map} +1 -1
- package/dist/index-tc054tcb.js +6 -0
- package/dist/{index-8tmv33mr.js.map → index-tc054tcb.js.map} +1 -1
- package/dist/{index-095hrkyr.js → index-ts8a1sdn.js} +6 -6
- package/dist/{index-095hrkyr.js.map → index-ts8a1sdn.js.map} +1 -1
- package/dist/index-tv52jhac.js +1252 -0
- package/dist/{index-hpvfqq6r.js.map → index-tv52jhac.js.map} +3 -3
- package/dist/index-x9nn57kk.js +6 -0
- package/dist/{index-1x8mzvz7.js.map → index-x9nn57kk.js.map} +1 -1
- package/dist/{index-308y9xt0.js → index-xyh98x7p.js} +4 -4
- package/dist/{index-308y9xt0.js.map → index-xyh98x7p.js.map} +1 -1
- package/dist/{index-jff5q27j.js → index-yy4v9kca.js} +4 -4
- package/dist/{index-jff5q27j.js.map → index-yy4v9kca.js.map} +1 -1
- package/dist/{index-bqdkm3de.js → index-yz0fcxky.js} +4 -4
- package/dist/{index-bqdkm3de.js.map → index-yz0fcxky.js.map} +1 -1
- package/dist/{index-p6ya59m6.js → index-z4adxmzm.js} +5 -5
- package/dist/{index-p6ya59m6.js.map → index-z4adxmzm.js.map} +1 -1
- package/dist/{index-4fj1k64j.js → index-zzpgsbn3.js} +4 -4
- package/dist/{index-4fj1k64j.js.map → index-zzpgsbn3.js.map} +1 -1
- package/dist/index.js +345 -345
- package/dist/index.js.map +4 -4
- package/dist/web-7mdrcb8a.js +14 -0
- package/dist/{web-gfv0mzgs.js.map → web-7mdrcb8a.js.map} +1 -1
- package/dist/wrapper-4hdmdwft.js +5 -0
- package/dist/{wrapper-f662ny3r.js.map → wrapper-4hdmdwft.js.map} +1 -1
- package/package.json +1 -1
- package/dist/APEv2Parser-ysjr6adv.js +0 -5
- package/dist/App-2f72vhjv.js +0 -11
- package/dist/AsfParser-7emspn04.js +0 -5
- package/dist/ConfigEditor-vk7vxaa6.js +0 -6
- package/dist/DsdiffParser-dz88pnnr.js +0 -5
- package/dist/FlacParser-drm5wq0p.js +0 -5
- package/dist/MP4Parser-yr7p3z12.js +0 -5
- package/dist/MusepackParser-6e8kbh2d.js +0 -5
- package/dist/OggParser-ggcypmag.js +0 -5
- package/dist/Picker-j7txnm7w.js +0 -5
- package/dist/SessionPicker-hpv2ncsb.js +0 -5
- package/dist/SkillBrowser-qc542n71.js +0 -5
- package/dist/WavPackParser-jw9stzqp.js +0 -5
- package/dist/WaveParser-epmncs9w.js +0 -5
- package/dist/WizardApp-pgzcz9zq.js +0 -5
- package/dist/channels-m8nambmm.js +0 -31
- package/dist/config-hmgrqgf2.js +0 -24
- package/dist/credential-nkb2ya59.js +0 -19
- package/dist/index-0444sh6x.js +0 -6
- package/dist/index-1x8mzvz7.js +0 -6
- package/dist/index-22fzzn7z.js +0 -10
- package/dist/index-2bsardvh.js +0 -5
- package/dist/index-323jvr1g.js +0 -6
- package/dist/index-3826kf9t.js +0 -7
- package/dist/index-38gs9anh.js +0 -9
- package/dist/index-3c5jt6by.js +0 -5
- package/dist/index-42e29zs4.js +0 -6
- package/dist/index-836hc2h1.js +0 -6
- package/dist/index-8edck2pr.js +0 -6
- package/dist/index-8tmv33mr.js +0 -6
- package/dist/index-9t4dz145.js +0 -8
- package/dist/index-djeqvfms.js +0 -74
- package/dist/index-dpcm1j62.js +0 -153
- package/dist/index-dzy19wtf.js +0 -6
- package/dist/index-eztfverw.js +0 -9
- package/dist/index-hpvfqq6r.js +0 -1252
- package/dist/index-hrwakb11.js +0 -6
- package/dist/index-jc4kmfwa.js +0 -6
- package/dist/index-k8e9f466.js.map +0 -13
- package/dist/index-mjfv7k5w.js +0 -6
- package/dist/index-nvc24414.js +0 -6
- package/dist/index-nxhqf597.js +0 -6
- package/dist/index-pqw1n1pv.js +0 -6
- package/dist/index-qgsdgbk8.js +0 -5
- package/dist/index-qv6ktepc.js +0 -6
- package/dist/index-qv6ktepc.js.map +0 -10
- package/dist/index-ry6a4bqh.js +0 -126
- package/dist/index-sh44ymqz.js +0 -11
- package/dist/index-xg7s813b.js +0 -6
- package/dist/index-y7dxq4a4.js +0 -14
- package/dist/index-ytxbw8py.js +0 -63
- package/dist/web-gfv0mzgs.js +0 -14
- package/dist/wrapper-f662ny3r.js +0 -5
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{s,mi,la}from"./index-ayhdn87b.js";import{Text as e}from"ink";import{useEffect as a,useState as i}from"react";import{jsx as c,jsxs as f}from"react/jsx-runtime";function it({label:r}){let[t,n]=i(0);return a(()=>{let o=setInterval(()=>n((p)=>(p+1)%mi.length),la);return()=>clearInterval(o)},[]),f(e,{children:[c(e,{color:s.accent,children:mi[t]})," ",r]})}
|
|
3
|
+
export{it};
|
|
4
|
+
|
|
5
|
+
//# debugId=B8E6FC373A36C56164756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-x9nn57kk.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * A braille spinner with a label. Ten glyphs from the theme, not a dependency (decision 11.10).\n *\n * The one kit component with its own state — the frame index — because animation is presentation,\n * not application state. Callers pair it with `useElapsed` when a count-up matters (the picker's\n * boot transition); it is deliberately not used in the init wizard, whose write-and-validate\n * completes in single-digit milliseconds and would only flash.\n */\n\nimport { Text } from \"ink\"\nimport { useEffect, useState } from \"react\"\nimport { SPINNER_FRAMES, SPINNER_INTERVAL_MS, THEME } from \"#lib/theme\"\n\nexport interface SpinnerProps {\n readonly label: string\n}\n\nexport function Spinner({ label }: SpinnerProps) {\n const [frame, setFrame] = useState(0)\n useEffect(() => {\n const timer = setInterval(\n () => setFrame((current) => (current + 1) % SPINNER_FRAMES.length),\n SPINNER_INTERVAL_MS,\n )\n return () => clearInterval(timer)\n }, [])\n\n return (\n <Text>\n <Text color={THEME.accent}>{SPINNER_FRAMES[frame]}</Text> {label}\n </Text>\n )\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";yCASA,eAAS,YACT,oBAAS,cAAW,gEAOb,SAAS,EAAO,EAAG,SAAuB,CAC7C,IAAO,EAAO,GAAY,EAAS,CAAC,EASpC,OARA,EAAU,IAAM,CACZ,IAAM,EAAQ,YACV,IAAM,EAAS,CAAC,KAAa,EAAU,GAAK,GAAe,MAAM,EACjE,EACJ,EACA,MAAO,IAAM,cAAc,CAAK,GACjC,CAAC,CAAC,EAGD,EAAC,EAAD,UAEE,CADE,EAAC,EAAD,CAAM,MAAO,EAAM,OAAnB,SAA4B,GAAe,GAAS,EADxD,IAC+D,GAC7D",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "B8E6FC373A36C56164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{fs}from"./index-4j65jp20.js";import{$t}from"./index-f6r3h2yh.js";function Ke(e){if(e??$t().noEnhancedKeys)return{};return fs(),{kittyKeyboard:{mode:"enabled",flags:["disambiguateEscapeCodes","reportEventTypes"]}}}function o(e){if(e.json)return{mode:"json",because:"--json was passed"};if(e.plain)return{mode:"plain",because:"--plain was passed"};if(e.oneShot)return{mode:"plain",because:"--input is always plain"};if(!e.stdoutIsTTY)return{mode:"plain",because:"stdout is not a terminal"};if(!e.stdinIsTTY)return{mode:"plain",because:"stdin is not a terminal"};if(e.env.noColor)return{mode:"plain",because:"NO_COLOR is set"};if(e.env.dumbTerminal)return{mode:"plain",because:"TERM is dumb"};if(e.env.ci)return{mode:"plain",because:"CI is set"};return{mode:"rich",because:"stdout and stdin are both terminals"}}function gt(e){return o({...e,stdinIsTTY:process.stdin.isTTY===!0,stdoutIsTTY:process.stdout.isTTY===!0,env:$t()})}
|
|
3
|
+
export{Ke,gt};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=20C77BA3619311B964756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-xyh98x7p.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * How output is rendered, resolved once per process.\n *\n * This mirrors the reasoning behind decision 3.5, which forbids the tool dialect from changing with\n * the model: behaviour that shifts silently with the environment cannot be reasoned about. So the\n * resolution is total and ordered, and it returns *why* it chose — the reason is printable, which is\n * what turns \"it wasn't interactive and I don't know why\" into a question with an answer.\n *\n * Measured, not assumed: importing Ink and React costs ~65 ms under Bun and ~170-210 ms under Node,\n * against a ~70 ms total runtime for `validate --json`. Nothing on a non-rich path may import them,\n * which is why this returns a mode rather than a renderer.\n */\n\nimport { readEnv } from \"#lib/env\"\nimport type { ModeDecision, ModeInputs } from \"#lib/schema\"\n\n/**\n * Total and ordered. Every branch is reachable and every input is consulted, so no combination of\n * flags and environment lands somewhere undocumented.\n */\nexport function resolveMode(inputs: ModeInputs): ModeDecision {\n if (inputs.json) return { mode: \"json\", because: \"--json was passed\" }\n if (inputs.plain) return { mode: \"plain\", because: \"--plain was passed\" }\n\n // A one-shot is a scripting affordance. Its output must not depend on whether a human happened\n // to be at a terminal, or `--input` would mean two different things in a shell script and in a\n // shell.\n if (inputs.oneShot) return { mode: \"plain\", because: \"--input is always plain\" }\n\n if (!inputs.stdoutIsTTY) return { mode: \"plain\", because: \"stdout is not a terminal\" }\n // A live transcript with no way to type into it is a worse plain renderer, not a better one.\n if (!inputs.stdinIsTTY) return { mode: \"plain\", because: \"stdin is not a terminal\" }\n\n if (inputs.env.noColor) return { mode: \"plain\", because: \"NO_COLOR is set\" }\n if (inputs.env.dumbTerminal) return { mode: \"plain\", because: \"TERM is dumb\" }\n // CI logs are files that happen to scroll. Cursor movement in one is noise forever.\n if (inputs.env.ci) return { mode: \"plain\", because: \"CI is set\" }\n\n return { mode: \"rich\", because: \"stdout and stdin are both terminals\" }\n}\n\n/**\n * Deliberately not consulted: `FORCE_COLOR`. It says how much colour a stream can carry, not\n * whether a human is watching, and honouring it here would turn a CI job that wanted coloured logs\n * into one driving a cursor around a file. Ink's own colour depth still respects it.\n */\nexport function resolveModeFromProcess(flags: {\n readonly json: boolean\n readonly plain: boolean\n readonly oneShot: boolean\n}): ModeDecision {\n return resolveMode({\n ...flags,\n stdinIsTTY: process.stdin.isTTY === true,\n stdoutIsTTY: process.stdout.isTTY === true,\n env: readEnv(),\n })\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";wEAuFO,SAAS,EAAiB,CAAC,EAAqC,CAInE,GAAI,GAAY,GAAQ,EAAE,eAAgB,MAAO,CAAC,EAElD,OADA,GAAiB,EACV,CACH,cAAe,CAEX,KAAM,UACN,MAAO,CAAC,0BAA2B,kBAAkB,CACzD,CACJ,EC/EG,SAAS,CAAW,CAAC,EAAkC,CAC1D,GAAI,EAAO,KAAM,MAAO,CAAE,KAAM,OAAQ,QAAS,mBAAoB,EACrE,GAAI,EAAO,MAAO,MAAO,CAAE,KAAM,QAAS,QAAS,oBAAqB,EAKxE,GAAI,EAAO,QAAS,MAAO,CAAE,KAAM,QAAS,QAAS,yBAA0B,EAE/E,GAAI,CAAC,EAAO,YAAa,MAAO,CAAE,KAAM,QAAS,QAAS,0BAA2B,EAErF,GAAI,CAAC,EAAO,WAAY,MAAO,CAAE,KAAM,QAAS,QAAS,yBAA0B,EAEnF,GAAI,EAAO,IAAI,QAAS,MAAO,CAAE,KAAM,QAAS,QAAS,iBAAkB,EAC3E,GAAI,EAAO,IAAI,aAAc,MAAO,CAAE,KAAM,QAAS,QAAS,cAAe,EAE7E,GAAI,EAAO,IAAI,GAAI,MAAO,CAAE,KAAM,QAAS,QAAS,WAAY,EAEhE,MAAO,CAAE,KAAM,OAAQ,QAAS,qCAAsC,EAQnE,SAAS,EAAsB,CAAC,EAItB,CACb,OAAO,EAAY,IACZ,EACH,WAAY,QAAQ,MAAM,QAAU,GACpC,YAAa,QAAQ,OAAO,QAAU,GACtC,IAAK,GAAQ,CACjB,CAAC",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "20C77BA3619311B964756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{A,n}from"./index-tv52jhac.js";import{cn,at,RA,ln,as}from"./index-039ew35r.js";class st extends n{static ERROR_NAME="UsageError"}function S(e,i){let t=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=(t[l-1]??0)+(e[o-1]===i[l-1]?0:1),d=(g[l-1]??0)+1,_=(t[l]??0)+1;g.push(Math.min(f,d,_))}t=g}return t[i.length]??Math.max(e.length,i.length)}function M(e,i){let t,o=Number.POSITIVE_INFINITY;for(let g of i){let l=S(e,g);if(l<o)o=l,t=g}return t!==void 0&&o<=Math.max(2,Math.floor(e.length/3))?t:void 0}class R{#e;#t;constructor(e,i){this.#e=e,this.#t=i}#n(e,i){let t=this.#t.get(e);if(t===void 0)throw new st({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(t.kind!==i)throw new st({code:"cli_flag_kind_mismatch",message:`Flag "${e}" is declared as ${t.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,t,o){return o===void 0?{code:e,message:i,hint:t}:{code:e,message:i,hint:t,field:o}}function y(e){let i=e[0];return new st({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,t){let o=Number(i);if(i.trim()===""||!Number.isFinite(o))return c("cli_flag_not_a_number",`${t} expects a number, got ${JSON.stringify(i)}.`,`Pass a number, as in ${t} 50. The old parser silently used the default here, which made a typo look like it worked.`,t);if(e.integer===!0&&!Number.isInteger(o))return c("cli_flag_not_an_integer",`${t} expects a whole number, got ${i}.`,`Drop the fractional part: ${t} ${Math.trunc(o)}.`,t);if(e.min!==void 0&&o<e.min)return c("cli_flag_below_min",`${t} must be at least ${e.min}, got ${o}.`,`Pass ${e.min} or more.`,t);return o}function ss(e){let i=e[0];if(i===void 0)return{kind:"usage"};if(i.startsWith("-")){let s=new Set(cn.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 ${at.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 t=RA(i);if(t===void 0){let s=M(i,at.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(ln(t).map((s)=>[s.name,s])),g=new Map(ln(t).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=as(m,t.name),x=M(m,[...o.keys()]);d.push(c(k.length>0?"cli_flag_wrong_command":"cli_unknown_flag",k.length>0?`${t.name} does not accept --${m}.`:`Unknown flag --${m}.`,k.length>0?`--${m} is accepted by: ${k.join(", ")}.`:x===void 0?`Run \`${A.slug} ${t.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} ${t.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:t};if(v.bool("version"))return{kind:"version"};let N=t.args.some((s)=>s.variadic===!0),F=t.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",`${t.name} needs ${s===void 0?"another argument":`a ${s.name}`}.`,`Usage: ${A.slug} ${t.name} ${t.args.map((r)=>`<${r.name}${r.variadic===!0?"...":""}>`).join(" ")}`))}else if(!N&&f.length>t.args.length){let s=f.slice(t.args.length);d.push(c("cli_unexpected_argument",`${t.name} takes ${t.args.length} argument(s), got ${f.length}.`,t.unexpectedArgHint??`Unexpected: ${s.join(" ")}. Quote a value containing spaces.`))}if(d.length>0)throw y(d);return{kind:"command",parsed:{command:t,positionals:f,flags:v}}}
|
|
3
|
+
export{st,ss};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=0B3BB667C43691EF64756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-yy4v9kca.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,SAAS,CAAQ,CAAC,EAAW,EAAmB,CAE5C,IAAI,EAAW,MAAM,KAAK,CAAE,OAAQ,EAAE,OAAS,CAAE,EAAG,CAAC,EAAG,IAAM,CAAC,EAC/D,QAAS,EAAI,EAAG,GAAK,EAAE,OAAQ,GAAK,EAAG,CACnC,IAAM,EAAU,CAAC,CAAC,EAClB,QAAS,EAAI,EAAG,GAAK,EAAE,OAAQ,GAAK,EAAG,CACnC,IAAM,GAAgB,EAAS,EAAI,IAAM,IAAM,EAAE,EAAI,KAAO,EAAE,EAAI,GAAK,EAAI,GACrE,GAAa,EAAQ,EAAI,IAAM,GAAK,EACpC,GAAY,EAAS,IAAM,GAAK,EACtC,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,UAAU,EAAM,QAAQ,EAAQ,QAAQ,EAAQ,KAAK,IAAI,CAAC,IAAM,IAAI,EAAE,OAAO,EAAE,WAAa,GAAO,MAAQ,KAAK,EAAE,KAAK,GAAG,GAC9H,CACJ,EACF,KAAK,GAAI,CAAC,GAAY,EAAY,OAAS,EAAQ,KAAK,OAAQ,CAC9D,IAAM,EAAQ,EAAY,MAAM,EAAQ,KAAK,MAAM,EACnD,EAAO,KACH,EACI,0BACA,GAAG,EAAQ,cAAc,EAAQ,KAAK,2BAA2B,EAAY,UAC7E,EAAQ,mBACJ,eAAe,EAAM,KAAK,GAAG,qCACrC,CACJ,EAGJ,GAAI,EAAO,OAAS,EAAG,MAAM,EAAM,CAAM,EAEzC,MAAO,CAAE,KAAM,UAAW,OAAQ,CAAE,UAAS,cAAa,OAAM,CAAE",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "0B3BB667C43691EF64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
function r(n){let e=[];for(let t=0;t<6;t+=1){let o=n[t]??0;e.push("0123456789abcdefghjkmnpqrstvwxyz"[o&31]??"0")}return`local:${e.join("")}`}function
|
|
3
|
-
export{
|
|
2
|
+
function r(n){let e=[];for(let t=0;t<6;t+=1){let o=n[t]??0;e.push("0123456789abcdefghjkmnpqrstvwxyz"[o&31]??"0")}return`local:${e.join("")}`}function Xo(n){return r(n(6))}function Ki(n){return new RegExp("^local:[0123456789abcdefghjkmnpqrstvwxyz]{6}$").test(n)}
|
|
3
|
+
export{Xo,Ki};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=BF23AAFBD5F3B45764756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-yz0fcxky.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Naming a conversation.\n *\n * Every `run` used to land in `local:default`, which made the store one long transcript per agent:\n * yesterday's debugging session and this morning's question shared a history, so the model was\n * conditioned on both and neither could be resumed without the other. A key per run fixes that, and it\n * moves the cost — you now have to *say* which conversation you mean, which is what `--continue` and the\n * exit pointer are for.\n *\n * ## Why six random characters rather than a timestamp\n *\n * A timestamp sorts and reads well and is twenty characters somebody has to type. `sessions` already\n * sorts by `lastActivityAt`, so the ordering a timestamp would carry is information the *listing* has and\n * the key does not need — and the two things a person actually does with a key are read it off a pointer\n * line and type it back. Six symbols is one glance and one word.\n *\n * ## Why the prefix stays\n *\n * `local:` says which surface opened the conversation, and it is already load-bearing: Telegram writes\n * `tg:<chat>`, so the prefix is what stops a chat id colliding with a terminal session. A bare key would\n * work today and break the first time two surfaces agreed on a name.\n *\n * Pure: the randomness arrives as bytes, so a test gets the key it asked for.\n */\n\n/**\n * Base-32 without the symbols that look like each other.\n *\n * `i`, `l`, `o` and `u` are out — a key is read off a screen and typed back, and `local:1i0o` is one\n * nobody transcribes reliably. Exactly 32 symbols also divides a byte's low five bits, so there is no\n * modulo bias: an alphabet that does not divide evenly makes its first symbols more likely than its last,\n * which matters here not for secrecy but because it makes collisions more likely than the count below\n * claims.\n */\nconst ALPHABET = \"0123456789abcdefghjkmnpqrstvwxyz\"\n\n/** Symbols after the prefix. Six gives 32^6 ≈ 1.07 billion, so a 50% collision needs ~39,000 sessions. */\nexport const SESSION_KEY_LENGTH = 6\n\n/** The surface that opened the conversation. A terminal session; Telegram writes its own prefix. */\nexport const LOCAL_SESSION_PREFIX = \"local\"\n\n/**\n * A key from six bytes.\n *\n * Only the low five bits of each byte are read, which is why the alphabet is exactly 32 long.\n */\nexport function sessionKeyFrom(bytes: Uint8Array): string {\n const symbols: string[] = []\n for (let at = 0; at < SESSION_KEY_LENGTH; at += 1) {\n const byte = bytes[at] ?? 0\n symbols.push(ALPHABET[byte & 0x1f] ?? \"0\")\n }\n return `${LOCAL_SESSION_PREFIX}:${symbols.join(\"\")}`\n}\n\n/**\n * A freshly minted key, from an injected source of randomness.\n *\n * The one derivation. `resolveSession` computed `sessionKeyFrom(random(SESSION_KEY_LENGTH))` inline and\n * `/new` needed the same line — two copies of \"what a generated session is called\" is how two surfaces\n * come to disagree about it, the same reason `logPaths` moved into `lib/sandbox.ts` rather than being\n * copied into `remove`.\n *\n * `random` is a parameter rather than a `crypto` call so a test gets the key it asked for, and so the\n * component layer never has to reach for crypto to open a conversation.\n */\nexport function newSessionKey(random: (count: number) => Uint8Array): string {\n return sessionKeyFrom(random(SESSION_KEY_LENGTH))\n}\n\n/**\n * True for a key this module could have produced.\n *\n * Used to *explain* a key rather than to validate one — a hand-written `--session mine` is perfectly\n * valid and must stay so. It exists because a generated key is the one a person did not choose, and a\n * listing can say so.\n */\nexport function isGeneratedSessionKey(key: string): boolean {\n return new RegExp(`^${LOCAL_SESSION_PREFIX}:[${ALPHABET}]{${SESSION_KEY_LENGTH}}$`).test(key)\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AA+CO,SAAS,CAAc,CAAC,EAA2B,CACtD,IAAM,EAAoB,CAAC,EAC3B,QAAS,EAAK,EAAG,EAZa,EAYY,GAAM,EAAG,CAC/C,IAAM,EAAO,EAAM,IAAO,EAC1B,EAAQ,KAjBC,mCAiBa,EAAO,KAAS,GAAG,EAE7C,MAAO,SAA2B,EAAQ,KAAK,EAAE,IAc9C,SAAS,EAAa,CAAC,EAA+C,CACzE,OAAO,EAAe,EA/BQ,CA+BiB,CAAC,EAU7C,SAAS,EAAqB,CAAC,EAAsB,CACxD,OAAO,IAAI,OAAO,+CAAgE,EAAE,KAAK,CAAG",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "BF23AAFBD5F3B45764756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var y=[[4352,4447],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[43360,43391],[44032,55203],[63744,64255],[65040,65049],[65072,65135],[65280,65376],[65504,65510],[127744,128591],[128640,128767],[129280,129535],[129648,129791],[131072,196605],[196608,262141]],w=[[768,879],[1155,1161],[1425,1469],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[2304,2307],[2362,2362],[3633,3633],[3636,3642],[6832,6911],[7616,7679],[8203,8207],[8400,8447],[65024,65039],[65056,65071],[65279,65279]];function m(n,t){for(let[f,e]of t){if(n<f)return!1;if(n<=e)return!0}return!1}function W(n){if(n<32||n>=127&&n<160)return 0;if(m(n,w))return 0;if(m(n,y))return 2;return 1}function g(n){return n.map((t)=>W(t.codePointAt(0)??0))}var T=" ".repeat(8);function
|
|
3
|
-
`).flatMap((f)=>A(f,t))}function
|
|
4
|
-
export{
|
|
2
|
+
var y=[[4352,4447],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[43360,43391],[44032,55203],[63744,64255],[65040,65049],[65072,65135],[65280,65376],[65504,65510],[127744,128591],[128640,128767],[129280,129535],[129648,129791],[131072,196605],[196608,262141]],w=[[768,879],[1155,1161],[1425,1469],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[2304,2307],[2362,2362],[3633,3633],[3636,3642],[6832,6911],[7616,7679],[8203,8207],[8400,8447],[65024,65039],[65056,65071],[65279,65279]];function m(n,t){for(let[f,e]of t){if(n<f)return!1;if(n<=e)return!0}return!1}function W(n){if(n<32||n>=127&&n<160)return 0;if(m(n,w))return 0;if(m(n,y))return 2;return 1}function g(n){return n.map((t)=>W(t.codePointAt(0)??0))}var T=" ".repeat(8);function no(n,t){let f=n.replaceAll("\t",T),e=[...f],s=g(e),b=(x,u)=>{let r=0;for(let l=x;l<u;l+=1)r+=s[l]??0;return r};if(t<=0||b(0,e.length)<=t)return[{text:f,lead:0,from:0,to:e.length}];let o=0;while(o<e.length&&(e[o]===" "||e[o]===" "))o+=1;if(o>0){let x=e.slice(o).join("");if(o>=t)return no(x,t).map((r)=>({...r,from:r.from+o,to:r.to+o}));let u=" ".repeat(o);return no(x,t-o).map((r)=>({text:`${u}${r.text}`,lead:r.lead+o,from:r.from+o,to:r.to+o}))}let h=[],d=0,i=0,p=(x)=>{h.push({text:e.slice(d,x).join(""),lead:0,from:d,to:x})},a=0;while(a<=e.length){let x=a;while(x<e.length&&e[x]!==" ")x+=1;let u=b(a,x);if(u>t){if(i>0)p(a===d?a:a-1),d=a,i=0;let r=a;while(b(r,x)>t){let l=r,c=0;while(l<x&&c+(s[l]??0)<=t)c+=s[l]??0,l+=1;if(l===r)l=r+1;d=r,p(l),r=l,d=r}d=r,i=b(r,x)}else if(i>0&&i+1+u>t)p(a-1),d=a,i=u;else i=i===0?u:i+1+u;if(x>=e.length)break;a=x+1}return p(e.length),h}function A(n,t){return no(n,t).map((f)=>f.text)}function ps(n,t){let f=0;for(let[e,s]of[...n].entries()){if(e>=t)break;f+=s==="\t"?8:1}return f}function dn(n,t){return n.split(`
|
|
3
|
+
`).flatMap((f)=>A(f,t))}function oo(n,t,f){if(n===""||f<=0)return{lines:[],rows:0,hidden:0};let e=dn(n,t);if(e.length<=f)return{lines:e,rows:e.length,hidden:0};return{lines:e.slice(e.length-f),rows:f+1,hidden:e.length-f}}
|
|
4
|
+
export{no,ps,dn,oo};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
7
|
-
//# sourceMappingURL=index-
|
|
6
|
+
//# debugId=EE86264606257D2564756E2164756E21
|
|
7
|
+
//# sourceMappingURL=index-z4adxmzm.js.map
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
"/**\n * Breaking text into the rows a fixed-width window will draw.\n *\n * ## One wrapping, ours\n *\n * This module used to count rows the way a terminal does — divide the character count by the width — and\n * hand the text to Ink to wrap. Those are two different answers to one question, and the difference is not\n * academic: Ink breaks at spaces, so 240 characters at 80 columns is **four** rows to Ink and three to a\n * division. Every cap built on the division was therefore one row short of what appeared on screen, which\n * on the alternate buffer is a frame taller than the terminal.\n *\n * So the rule is that whoever owns a bounded window wraps the text itself and renders each row with\n * `wrap=\"truncate\"`. The count is then the count, by construction, and a frame test asserts it against a\n * real render rather than trusting the arithmetic.\n *\n * Tabs are expanded to spaces on the way through. A tab's width is the terminal's business and not ours,\n * so a row containing one cannot be measured — expanding it is the only way the number we counted is the\n * number drawn. It changes bytes, never meaning, which is the line decision 4.27 draws.\n */\n\nconst TAB_WIDTH = 8\nconst TAB = \" \".repeat(TAB_WIDTH)\n\nimport { cellWidths } from \"#lib/width\"\n\n/**\n * One drawn row, and which source characters it drew.\n *\n * The offsets exist because a row's text is **not** a slice of its line. Breaking at a space consumes\n * the space, a word longer than the window is cut, and a hanging indent is re-applied to rows that never\n * contained it — so \"which row is source offset 41 on, and at what column\" cannot be recovered from the\n * strings afterwards. Anything that draws a caret over wrapped text needs exactly that, and computing it\n * a second time from the finished rows is how a cursor ends up a column out on the lines that wrapped.\n */\nexport interface WrappedRow {\n /** Exactly what is painted, the re-applied indent included. */\n readonly text: string\n /** Columns of `text` that are indent. A caret never lands to the left of this. */\n readonly lead: number\n /** Source code-point offset of this row's first drawn character. */\n readonly from: number\n /** One past this row's last drawn character. A break at a space leaves a gap before the next `from`. */\n readonly to: number\n}\n\n/**\n * One logical line, broken at spaces to fit `columns`, with the source offsets kept.\n *\n * A word longer than the whole width is cut rather than allowed to overflow — a URL or a base64 blob is\n * the normal case for that, and there is nowhere better to break it. Returns one row for an empty line,\n * because a blank line in a reply is a blank row on screen and dropping it would close up paragraphs the\n * model deliberately separated.\n */\nexport function wrapRows(line: string, columns: number): readonly WrappedRow[] {\n // Tabs are expanded before anything is measured, so offsets are into the *expanded* line. A caller\n // placing a caret has to expand its own column the same way, which `expandColumn` is for.\n const flat = line.replaceAll(\"\\t\", TAB)\n const all = [...flat]\n // Widths per cell, computed once. Every measurement below is a sum over this rather than a count of\n // code points: an emoji is one code point and two columns, so counting made `\"👍\".repeat(10)` measure\n // ten and draw twenty. Offsets stay in code points, because that is what a caller slices with.\n const w = cellWidths(all)\n const span = (from: number, to: number): number => {\n let total = 0\n for (let at = from; at < to; at += 1) total += w[at] ?? 0\n return total\n }\n if (columns <= 0 || span(0, all.length) <= columns) {\n return [{ text: flat, lead: 0, from: 0, to: all.length }]\n }\n\n // Leading whitespace is structure, and splitting on spaces destroys it.\n //\n // Found live: `/help`'s output indents each entry by two spaces, and every line short enough to fit kept\n // them while every line that wrapped lost them — so one list came out at two different indents depending\n // on how long each summary happened to be. Held aside here and re-applied to every row, which also gives\n // a wrapped indented block a hanging indent rather than a ragged left edge.\n let indent = 0\n while (indent < all.length && (all[indent] === \" \" || all[indent] === \"\\u00a0\")) indent += 1\n if (indent > 0) {\n const body = all.slice(indent).join(\"\")\n // An indent as wide as the window is dropped rather than honoured: keeping it would leave no room\n // for the text, and shrinking the width to fit it recurses forever. The recursion terminates either\n // way, because `body` cannot begin with a space.\n if (indent >= columns) {\n return wrapRows(body, columns).map((row) => ({\n ...row,\n from: row.from + indent,\n to: row.to + indent,\n }))\n }\n const pad = \" \".repeat(indent)\n return wrapRows(body, columns - indent).map((row) => ({\n text: `${pad}${row.text}`,\n lead: row.lead + indent,\n from: row.from + indent,\n to: row.to + indent,\n }))\n }\n\n const rows: WrappedRow[] = []\n // `at` is where the pending row starts in the source; `width` is how much of it is drawn so far.\n let at = 0\n let width = 0\n const push = (to: number) => {\n rows.push({ text: all.slice(at, to).join(\"\"), lead: 0, from: at, to })\n }\n let cursor = 0\n while (cursor <= all.length) {\n // The next word, and the single space that introduced it. A run of spaces is not collapsed —\n // only the one space a break consumes is, which is what keeps the offsets honest.\n let end = cursor\n while (end < all.length && all[end] !== \" \") end += 1\n const word = span(cursor, end)\n\n if (word > columns) {\n // Longer than any row can hold. Flush what is pending, then cut it into full rows.\n if (width > 0) {\n push(cursor === at ? cursor : cursor - 1)\n at = cursor\n width = 0\n }\n let take = cursor\n while (span(take, end) > columns) {\n // Advance by *columns*, not by cells. A cut that would land inside a double-width\n // character stops before it, which is why the row can come out one column short: half an\n // emoji is not a thing a terminal can draw, and drawing it anyway is how a row overflows.\n let stop = take\n let filled = 0\n while (stop < end && filled + (w[stop] ?? 0) <= columns) {\n filled += w[stop] ?? 0\n stop += 1\n }\n // A single character wider than the whole window would otherwise loop forever taking\n // nothing. Emit it alone and overflow by one column, which is the only option left.\n if (stop === take) stop = take + 1\n at = take\n push(stop)\n take = stop\n at = take\n }\n at = take\n width = span(take, end)\n } else if (width > 0 && width + 1 + word > columns) {\n // Does not fit beside what is already on this row. The space before it is the break and is\n // drawn by neither row, which is why `to` and the next `from` are not the same number.\n push(cursor - 1)\n at = cursor\n width = word\n } else {\n width = width === 0 ? word : width + 1 + word\n }\n\n if (end >= all.length) break\n cursor = end + 1\n }\n push(all.length)\n return rows\n}\n\nfunction wrapLine(line: string, columns: number): readonly string[] {\n return wrapRows(line, columns).map((row) => row.text)\n}\n\n/** A code-point column in `line` translated into the tab-expanded coordinates `wrapRows` reports. */\nexport function expandColumn(line: string, column: number): number {\n let out = 0\n for (const [at, ch] of [...line].entries()) {\n if (at >= column) break\n out += ch === \"\\t\" ? TAB_WIDTH : 1\n }\n return out\n}\n\n/** Every row `text` occupies at `columns`, newlines respected and long lines broken. */\nexport function wrapText(text: string, columns: number): readonly string[] {\n return text.split(\"\\n\").flatMap((line) => wrapLine(line, columns))\n}\n\n/**\n * The live pane: the rows to draw, how tall that makes it, and how much was dropped.\n *\n * Height-capped on purpose. Ink erases and redraws its whole dynamic tree per frame, so an uncapped pane\n * means redrawing the entire reply on every token — a cost that grows with the length of the answer,\n * precisely when the terminal is busiest. The newest rows are the ones kept, because they are what the\n * reader is looking at, and nothing is lost: the finished reply joins the transcript at `turn.end`.\n *\n * All three numbers from one wrap, because they were computed separately and disagreed. The component\n * needs the rows and the dropped count; the chat frame needs the height to subtract from the terminal\n * *before* the pane renders. Deriving them apart meant the notice's own row was counted by one caller and\n * not the other, which is a layout one row taller than the screen.\n */\nexport interface LivePane {\n /** What to draw, newest last. Already wrapped, so each is one row. */\n readonly lines: readonly string[]\n /** Rows the pane occupies, the \"… n hidden\" notice included. Zero when there is nothing to show. */\n readonly rows: number\n /** Rows dropped off the top. Non-zero is exactly the condition for drawing the notice. */\n readonly hidden: number\n}\n\nexport function livePane(text: string, columns: number, maxRows: number): LivePane {\n if (text === \"\" || maxRows <= 0) return { lines: [], rows: 0, hidden: 0 }\n const all = wrapText(text, columns)\n if (all.length <= maxRows) return { lines: all, rows: all.length, hidden: 0 }\n // The extra row is the notice itself.\n return {\n lines: all.slice(all.length - maxRows),\n rows: maxRows + 1,\n hidden: all.length - maxRows,\n }\n}\n"
|
|
7
7
|
],
|
|
8
8
|
"mappings": ";AA4BA,IAAM,EAA+C,CACjD,CAAC,KAAQ,IAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,MAAQ,KAAM,EACf,CAAC,OAAS,MAAO,EACjB,CAAC,OAAS,MAAO,EACjB,CAAC,OAAS,MAAO,EACjB,CAAC,OAAS,MAAO,EACjB,CAAC,OAAS,MAAO,EACjB,CAAC,OAAS,MAAO,CACrB,EAGM,EAA+C,CACjD,CAAC,IAAQ,GAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM,EACf,CAAC,KAAQ,IAAM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EACR,EAGX,SAAS,CAAQ,CAAC,EAAc,EAAoC,CAChE,OAAO,GAAS,EAAM,CAAO,EAAE,IAAI,CAAC,IAAQ,EAAI,IAAI,EAIjD,SAAS,EAAY,CAAC,EAAc,EAAwB,CAC/D,IAAI,EAAM,EACV,QAAY,EAAI,IAAO,CAAC,GAAG,CAAI,EAAE,QAAQ,EAAG,CACxC,GAAI,GAAM,EAAQ,MAClB,GAAO,IAAO,KArJJ,EAqJuB,EAErC,OAAO,EAIJ,SAAS,EAAQ,CAAC,EAAc,EAAoC,CACvE,OAAO,EAAK,MAAM;AAAA,CAAI,EAAE,QAAQ,CAAC,IAAS,EAAS,EAAM,CAAO,CAAC,EAyB9D,SAAS,EAAQ,CAAC,EAAc,EAAiB,EAA2B,CAC/E,GAAI,IAAS,IAAM,GAAW,EAAG,MAAO,CAAE,MAAO,CAAC,EAAG,KAAM,EAAG,OAAQ,CAAE,EACxE,IAAM,EAAM,GAAS,EAAM,CAAO,EAClC,GAAI,EAAI,QAAU,EAAS,MAAO,CAAE,MAAO,EAAK,KAAM,EAAI,OAAQ,OAAQ,CAAE,EAE5E,MAAO,CACH,MAAO,EAAI,MAAM,EAAI,OAAS,CAAO,EACrC,KAAM,EAAU,EAChB,OAAQ,EAAI,OAAS,CACzB",
|
|
9
|
-
"debugId": "
|
|
9
|
+
"debugId": "EE86264606257D2564756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
function
|
|
3
|
-
export{
|
|
2
|
+
function ea(t){let e=[],r=/\[(\d+);(\d+)(?::(\d+))?([A-Za-z~])/g;for(let s of t.matchAll(r)){let a=Number(s[1]),n=Number(s[2]),i=s[3],o=s[4]??"";if(!Number.isFinite(a)||!Number.isFinite(n)||n<1)continue;e.push({modifier:n,final:o,param:a,eventType:i===void 0?void 0:i==="3"?"release":i==="2"?"repeat":"press"})}return e}function ta(t){let e=t.codePointAt(0)===27?t.slice(1):t;return/^\[\?\d*u$/.test(e)}function u(t,e,r){switch(t.final){case"A":return e.upArrow;case"B":return e.downArrow;case"C":return e.rightArrow;case"D":return e.leftArrow;case"H":return e.home;case"F":return e.end;case"~":switch(t.param){case 1:case 7:return e.home;case 3:return e.delete;case 4:case 8:return e.end;case 5:return e.pageUp;case 6:return e.pageDown;default:return!1}case"u":if(t.param===13)return e.return;if(t.param===127)return e.backspace;if(t.param===27)return e.escape;return r!==""&&r===String.fromCodePoint(t.param).toLowerCase();default:return!1}}function Aa(t,e,r){let s=r.findIndex((i)=>u(i,t,e));if(s===-1)return t;let[a]=r.splice(s,1);if(a===void 0)return t;let n=a.modifier-1;return{...t,shift:(n&1)!==0,meta:(n&2)!==0,ctrl:(n&4)!==0,super:(n&8)!==0,...a.eventType===void 0?{}:{eventType:a.eventType}}}
|
|
3
|
+
export{ea,ta,Aa};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=FA104468BD741D0F64756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-zzpgsbn3.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Reading a modifier off the bytes, because Ink's reading of it is lossy.\n *\n * ## The defect this exists for\n *\n * Warp sends `cmd+left` as `CSI 1;9D` — modifier 9, which decodes to the super bit — and **omits the\n * event-type field**. Ink's kitty branch for special keys requires that field (its regex demands a\n * `:<event>` group), so the sequence falls through to its legacy branch, which does:\n *\n * key.meta = key.meta || !!(modifier & 10)\n *\n * `10` is `alt | super`. With modifier 8 that is `8 & 10 === 8`, truthy — so **super arrives as meta**,\n * and `cmd+left` becomes indistinguishable from `option+left` before our keymap is called at all.\n * Reported from a real session: both chords navigated by word, which is the only symptom this can have.\n *\n * Negotiating `reportEventTypes` was supposed to avoid this by making Warp include the field. It does not\n * — measured by the symptom, not assumed — and a fix that depends on a terminal populating an optional\n * field is a fix that works on some terminals. So the modifier is decoded here, from the bytes, where it\n * is unambiguous: bit 8 is super whether or not an event type follows it.\n *\n * ## Why this is not a second parser\n *\n * It reads *one* field. Key identity still comes from Ink — `leftArrow`, `home`, `input` — and this only\n * overrides the four modifier flags, and only when a sequence was actually found and matched to the key\n * Ink reported. Anything unrecognised leaves the key exactly as it arrived, so the worst case is today's\n * behaviour rather than a new class of wrong.\n */\n\nimport type { KeyState } from \"#lib/types\"\n\n/** Modifier bits, per the xterm and kitty encodings: the wire value is `1 + these`. */\nconst SHIFT = 1\nconst ALT = 2\nconst CTRL = 4\nconst SUPER = 8\n\n/** One modified key found in a chunk. `final` identifies the key for CSI forms, `param` for `u`. */\nexport interface CsiKey {\n readonly modifier: number\n readonly final: string\n /** The first parameter: a key number for `~` forms, a codepoint for `u`, else 1. */\n readonly param: number\n readonly eventType: \"press\" | \"repeat\" | \"release\" | undefined\n}\n\n/**\n * Every modified key in a chunk, oldest first.\n *\n * Matches `CSI <param> ; <modifier> [: <event>] <final>`, which covers the arrows (`A`-`D`), Home and End\n * (`H`/`F`), the tilde forms (`1~` `3~` `4~` `5~` `6~` `7~` `8~`) and kitty's letter form (`u`) in one\n * expression, because they differ only in the final byte. A sequence with no modifier parameter is skipped\n * — there is nothing to correct on an unmodified key. The leading escape is not required: Ink strips one\n * from the front of a chunk before a handler sees it, the same reason `lib/mouse.ts` anchors instead.\n */\nexport function csiKeys(chunk: string): readonly CsiKey[] {\n const found: CsiKey[] = []\n const pattern = /\\[(\\d+);(\\d+)(?::(\\d+))?([A-Za-z~])/g\n for (const match of chunk.matchAll(pattern)) {\n const param = Number(match[1])\n const modifier = Number(match[2])\n const event = match[3]\n const final = match[4] ?? \"\"\n if (!Number.isFinite(param) || !Number.isFinite(modifier) || modifier < 1) continue\n found.push({\n modifier,\n final,\n param,\n eventType:\n event === undefined\n ? undefined\n : event === \"3\"\n ? \"release\"\n : event === \"2\"\n ? \"repeat\"\n : \"press\",\n })\n }\n return found\n}\n\n/**\n * A terminal *reply*, not a keystroke: `CSI ? <flags> u`.\n *\n * Ink asks the terminal for its kitty-keyboard flags at mount, waits 200 ms, and strips the answer out of\n * stdin if one arrives in time. Measured in a real Warp session: it arrived **late**, the window had\n * closed, and the bytes fell through to `useInput` as ordinary text — `input \"[?0u\"`, resolving to an\n * insert. Left unclaimed that types `[?0u` into somebody's first message, which is the same class of\n * defect as a mouse report reaching the buffer and is claimed here for the same reason.\n *\n * Deliberately narrow. Only this one reply is recognised, because it is the only one this runtime *asks*\n * for — and the finals it would be tempting to generalise to are dangerous: `CSI 1;2R` is a real modified\n * F3 key, so claiming `R` would swallow a keystroke to catch a reply nobody requested.\n */\nexport function isTerminalReply(input: string): boolean {\n // The optional escape is stripped by code point rather than matched in the pattern: a control\n // character written into a regex is invisible in the source, which is a lint error for good reason —\n // `lib/keys-view.ts` draws the same line for the same reason.\n const body = input.codePointAt(0) === 0x1b ? input.slice(1) : input\n return /^\\[\\?\\d*u$/.test(body)\n}\n\n/** Which Ink flag a CSI final byte identifies, so a record can be matched to the key Ink reported. */\nfunction identifies(record: CsiKey, key: KeyState, input: string): boolean {\n switch (record.final) {\n case \"A\":\n return key.upArrow\n case \"B\":\n return key.downArrow\n case \"C\":\n return key.rightArrow\n case \"D\":\n return key.leftArrow\n case \"H\":\n return key.home\n case \"F\":\n return key.end\n case \"~\":\n switch (record.param) {\n case 1:\n case 7:\n return key.home\n case 3:\n return key.delete\n case 4:\n case 8:\n return key.end\n case 5:\n return key.pageUp\n case 6:\n return key.pageDown\n default:\n return false\n }\n case \"u\":\n // Kitty's letter form. Ink already decodes these correctly, so matching them is only about\n // not consuming a record that belongs to a later keystroke.\n if (record.param === 13) return key.return\n if (record.param === 127) return key.backspace\n if (record.param === 27) return key.escape\n return input !== \"\" && input === String.fromCodePoint(record.param).toLowerCase()\n default:\n return false\n }\n}\n\n/**\n * The key Ink reported, with its modifiers taken from the bytes when they can be.\n *\n * `records` is consumed: the matched entry is removed, so two keys in one chunk stay in step. Matching by\n * identity rather than by position is what makes that safe — a record that does not correspond to the key\n * Ink is reporting is left in the queue for whichever keystroke it belongs to, instead of being applied to\n * this one.\n */\nexport function withRealModifiers(key: KeyState, input: string, records: CsiKey[]): KeyState {\n const at = records.findIndex((record) => identifies(record, key, input))\n if (at === -1) return key\n const [record] = records.splice(at, 1)\n if (record === undefined) return key\n const bits = record.modifier - 1\n return {\n ...key,\n shift: (bits & SHIFT) !== 0,\n // `meta` is Alt/Option only. This is the whole correction: Ink merges super into it and we do not.\n meta: (bits & ALT) !== 0,\n ctrl: (bits & CTRL) !== 0,\n super: (bits & SUPER) !== 0,\n ...(record.eventType === undefined ? {} : { eventType: record.eventType }),\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAsDO,SAAS,EAAO,CAAC,EAAkC,CACtD,IAAM,EAAkB,CAAC,EACnB,EAAU,uCAChB,QAAW,KAAS,EAAM,SAAS,CAAO,EAAG,CACzC,IAAM,EAAQ,OAAO,EAAM,EAAE,EACvB,EAAW,OAAO,EAAM,EAAE,EAC1B,EAAQ,EAAM,GACd,EAAQ,EAAM,IAAM,GAC1B,GAAI,CAAC,OAAO,SAAS,CAAK,GAAK,CAAC,OAAO,SAAS,CAAQ,GAAK,EAAW,EAAG,SAC3E,EAAM,KAAK,CACP,WACA,QACA,QACA,UACI,IAAU,OACJ,OACA,IAAU,IACR,UACA,IAAU,IACR,SACA,OAClB,CAAC,EAEL,OAAO,EAgBJ,SAAS,EAAe,CAAC,EAAwB,CAIpD,IAAM,EAAO,EAAM,YAAY,CAAC,IAAM,GAAO,EAAM,MAAM,CAAC,EAAI,EAC9D,MAAO,aAAa,KAAK,CAAI,EAIjC,SAAS,CAAU,CAAC,EAAgB,EAAe,EAAwB,CACvE,OAAQ,EAAO,OACX,IAAK,IACD,OAAO,EAAI,QACf,IAAK,IACD,OAAO,EAAI,UACf,IAAK,IACD,OAAO,EAAI,WACf,IAAK,IACD,OAAO,EAAI,UACf,IAAK,IACD,OAAO,EAAI,KACf,IAAK,IACD,OAAO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