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.
- package/README.md +58 -18
- package/dist/APEv2Parser-9wqew3zv.js +5 -0
- package/dist/{APEv2Parser-jdp5yp24.js.map → APEv2Parser-9wqew3zv.js.map} +1 -1
- package/dist/{AiffParser-n65syezh.js → AiffParser-tbx3xkmk.js} +3 -3
- package/dist/{AiffParser-n65syezh.js.map → AiffParser-tbx3xkmk.js.map} +1 -1
- package/dist/App-hjn867nc.js +11 -0
- package/dist/{App-pmqmzsb3.js.map → App-hjn867nc.js.map} +1 -1
- package/dist/{AsfParser-da1fqvxz.js → AsfParser-d784ak3y.js} +3 -3
- package/dist/{AsfParser-da1fqvxz.js.map → AsfParser-d784ak3y.js.map} +1 -1
- package/dist/{ConfigEditor-4nqbeejh.js → ConfigEditor-g7eb2wsm.js} +3 -3
- package/dist/{ConfigEditor-4nqbeejh.js.map → ConfigEditor-g7eb2wsm.js.map} +1 -1
- package/dist/{DsdiffParser-gk95sj7t.js → DsdiffParser-vxnfx80c.js} +2 -2
- package/dist/{DsfParser-b0enevjw.js → DsfParser-0xsh0zzk.js} +3 -3
- package/dist/{DsfParser-b0enevjw.js.map → DsfParser-0xsh0zzk.js.map} +1 -1
- package/dist/FlacParser-bf8y3e0w.js +5 -0
- package/dist/{KeyProbe-rspsxpsr.js → KeyProbe-w8c37s9q.js} +3 -3
- package/dist/{KeyProbe-rspsxpsr.js.map → KeyProbe-w8c37s9q.js.map} +1 -1
- package/dist/{MP4Parser-ph7rv2fn.js → MP4Parser-tq7r7wd4.js} +3 -3
- package/dist/{MP4Parser-ph7rv2fn.js.map → MP4Parser-tq7r7wd4.js.map} +1 -1
- package/dist/{MatroskaParser-fjk1mpct.js → MatroskaParser-a79gsmzb.js} +3 -3
- package/dist/{MatroskaParser-fjk1mpct.js.map → MatroskaParser-a79gsmzb.js.map} +1 -1
- package/dist/{MpegParser-vp7cj8ts.js → MpegParser-zs61b3wq.js} +3 -3
- package/dist/{MpegParser-vp7cj8ts.js.map → MpegParser-zs61b3wq.js.map} +1 -1
- package/dist/{MusepackParser-v22gft1f.js → MusepackParser-bp8dm6nz.js} +3 -3
- package/dist/{MusepackParser-v22gft1f.js.map → MusepackParser-bp8dm6nz.js.map} +1 -1
- package/dist/{OggParser-as1m8xsa.js → OggParser-7pxr1sn9.js} +3 -3
- package/dist/{OggParser-as1m8xsa.js.map → OggParser-7pxr1sn9.js.map} +1 -1
- package/dist/{Picker-jkmd5xnx.js → Picker-b09hr4tk.js} +3 -3
- package/dist/{Picker-jkmd5xnx.js.map → Picker-b09hr4tk.js.map} +1 -1
- package/dist/{SessionPicker-3712ke3k.js → SessionPicker-wtfxwdxg.js} +3 -3
- package/dist/{SessionPicker-3712ke3k.js.map → SessionPicker-wtfxwdxg.js.map} +1 -1
- package/dist/{SkillBrowser-qhsyszt4.js → SkillBrowser-p9ht63c7.js} +3 -3
- package/dist/{SkillBrowser-qhsyszt4.js.map → SkillBrowser-p9ht63c7.js.map} +1 -1
- package/dist/{WavPackParser-b4qqavzg.js → WavPackParser-gpf3r92t.js} +3 -3
- package/dist/{WavPackParser-b4qqavzg.js.map → WavPackParser-gpf3r92t.js.map} +1 -1
- package/dist/{WaveParser-fqs1h38f.js → WaveParser-3kcak550.js} +3 -3
- package/dist/{WaveParser-fqs1h38f.js.map → WaveParser-3kcak550.js.map} +1 -1
- package/dist/WizardApp-494018sk.js +5 -0
- package/dist/{WizardApp-qrq36nv8.js.map → WizardApp-494018sk.js.map} +1 -1
- package/dist/{channels-gf31stv7.js → channels-yhdvxxrb.js} +14 -14
- package/dist/{channels-gf31stv7.js.map → channels-yhdvxxrb.js.map} +1 -1
- package/dist/config-g0ybmm4t.js +24 -0
- package/dist/{config-z2cd0c5f.js.map → config-g0ybmm4t.js.map} +1 -1
- package/dist/credential-pkme1sfe.js +19 -0
- package/dist/{credential-h0wmsjsw.js.map → credential-pkme1sfe.js.map} +1 -1
- package/dist/{index-dwxmy0kx.js → index-0mz7wpbw.js} +6 -6
- package/dist/{index-dwxmy0kx.js.map → index-0mz7wpbw.js.map} +1 -1
- package/dist/{index-fcqy46mh.js → index-0pddq849.js} +25 -25
- package/dist/{index-fcqy46mh.js.map → index-0pddq849.js.map} +1 -1
- package/dist/{index-2yj11ykt.js → index-1f1erzfx.js} +4 -4
- package/dist/{index-2yj11ykt.js.map → index-1f1erzfx.js.map} +1 -1
- package/dist/{index-1h9pqnec.js → index-26ejkp8q.js} +189 -189
- package/dist/{index-1h9pqnec.js.map → index-26ejkp8q.js.map} +7 -7
- package/dist/{index-ccpq4k6r.js → index-307qmvb0.js} +25 -25
- package/dist/{index-ccpq4k6r.js.map → index-307qmvb0.js.map} +1 -1
- package/dist/index-3b3h8kyh.js +5 -0
- package/dist/{index-3mvenfbg.js.map → index-3b3h8kyh.js.map} +1 -1
- package/dist/{index-0p9p6fvc.js → index-3fgq1acj.js} +10 -10
- package/dist/{index-0p9p6fvc.js.map → index-3fgq1acj.js.map} +3 -3
- package/dist/{index-dh2g58s1.js → index-4emtktc0.js} +3 -3
- package/dist/{index-dh2g58s1.js.map → index-4emtktc0.js.map} +1 -1
- package/dist/{index-026q0y3a.js → index-4t3p7vm9.js} +4 -4
- package/dist/{index-026q0y3a.js.map → index-4t3p7vm9.js.map} +1 -1
- package/dist/{index-t5d8ey5t.js → index-5m9wydxb.js} +4 -4
- package/dist/{index-t5d8ey5t.js.map → index-5m9wydxb.js.map} +1 -1
- package/dist/{index-g1d06ct5.js → index-633eqxry.js} +7 -7
- package/dist/{index-g1d06ct5.js.map → index-633eqxry.js.map} +1 -1
- package/dist/index-6r9h7ftn.js +308 -0
- package/dist/index-6r9h7ftn.js.map +21 -0
- package/dist/{index-kktaw552.js → index-7gsbzvnc.js} +2 -2
- package/dist/{index-z88f35vs.js → index-94k4mh6s.js} +13 -13
- package/dist/{index-z88f35vs.js.map → index-94k4mh6s.js.map} +3 -3
- package/dist/index-9dmgk6d3.js +5 -0
- package/dist/{index-tny7c703.js.map → index-9dmgk6d3.js.map} +1 -1
- package/dist/index-9qv87rq7.js +9 -0
- package/dist/{index-s4a28ctb.js.map → index-9qv87rq7.js.map} +1 -1
- package/dist/{index-k2q76dhw.js → index-a6mtqkth.js} +6 -6
- package/dist/{index-k2q76dhw.js.map → index-a6mtqkth.js.map} +1 -1
- package/dist/{index-0m0x1454.js → index-ac2wzspd.js} +4 -4
- package/dist/{index-0m0x1454.js.map → index-ac2wzspd.js.map} +1 -1
- package/dist/{index-wxmqyv4c.js → index-ad5c9t83.js} +4 -4
- package/dist/{index-wxmqyv4c.js.map → index-ad5c9t83.js.map} +1 -1
- package/dist/{index-b7qc21s7.js → index-akv6e7ge.js} +6 -6
- package/dist/{index-b7qc21s7.js.map → index-akv6e7ge.js.map} +1 -1
- package/dist/{index-v271gbaz.js → index-ec101x93.js} +4 -4
- package/dist/{index-v271gbaz.js.map → index-ec101x93.js.map} +1 -1
- package/dist/{index-rhv6gqpt.js → index-f056wkb4.js} +4 -4
- package/dist/{index-rhv6gqpt.js.map → index-f056wkb4.js.map} +1 -1
- package/dist/{index-c2qjdz4q.js → index-gqaa06yh.js} +8 -8
- package/dist/{index-c2qjdz4q.js.map → index-gqaa06yh.js.map} +1 -1
- package/dist/{index-rfa0ztab.js → index-j20k6k0m.js} +4 -4
- package/dist/{index-rfa0ztab.js.map → index-j20k6k0m.js.map} +1 -1
- package/dist/{index-2pzgta33.js → index-jh2az41t.js} +4 -4
- package/dist/{index-2pzgta33.js.map → index-jh2az41t.js.map} +1 -1
- package/dist/{index-gace5ac7.js → index-mn34kj95.js} +4 -4
- package/dist/{index-gace5ac7.js.map → index-mn34kj95.js.map} +1 -1
- package/dist/{index-rvq7t636.js → index-myg5enf5.js} +2 -2
- package/dist/{index-s78sq9g1.js → index-pdsey1ab.js} +45 -45
- package/dist/{index-s78sq9g1.js.map → index-pdsey1ab.js.map} +1 -1
- package/dist/{index-jmnjcw61.js → index-psk6q25h.js} +4 -4
- package/dist/{index-jmnjcw61.js.map → index-psk6q25h.js.map} +1 -1
- package/dist/{index-3s2q0m64.js → index-q8b1fc3k.js} +4 -4
- package/dist/{index-3s2q0m64.js.map → index-q8b1fc3k.js.map} +1 -1
- package/dist/{index-g8n8rhtr.js → index-qh82wtpa.js} +3 -3
- package/dist/{index-g8n8rhtr.js.map → index-qh82wtpa.js.map} +1 -1
- package/dist/{index-gqbny9gy.js → index-s2tzq27a.js} +6 -6
- package/dist/{index-gqbny9gy.js.map → index-s2tzq27a.js.map} +1 -1
- package/dist/{index-1wxw30j1.js → index-s57ztjhq.js} +35 -35
- package/dist/index-s57ztjhq.js.map +13 -0
- package/dist/{index-jv7egrh2.js → index-skkddg44.js} +4 -4
- package/dist/{index-jv7egrh2.js.map → index-skkddg44.js.map} +1 -1
- package/dist/{index-9m6b14b4.js → index-thmq816c.js} +4 -4
- package/dist/{index-9m6b14b4.js.map → index-thmq816c.js.map} +1 -1
- package/dist/{index-es4bgkbh.js → index-trx9xb59.js} +6 -6
- package/dist/{index-es4bgkbh.js.map → index-trx9xb59.js.map} +1 -1
- package/dist/{index-60jxyzbe.js → index-twcgf73h.js} +4 -4
- package/dist/{index-60jxyzbe.js.map → index-twcgf73h.js.map} +1 -1
- package/dist/index-vw2hf4d8.js +6 -0
- package/dist/{index-v6taf4vn.js.map → index-vw2hf4d8.js.map} +1 -1
- package/dist/{index-m5rmhcez.js → index-w97gprre.js} +4 -4
- package/dist/{index-m5rmhcez.js.map → index-w97gprre.js.map} +1 -1
- package/dist/index-wk6andxq.js +5 -0
- package/dist/{index-ak304afj.js.map → index-wk6andxq.js.map} +1 -1
- package/dist/index-x9z2xnct.js +11 -0
- package/dist/{index-5nprb9px.js.map → index-x9z2xnct.js.map} +1 -1
- package/dist/index-xa9crtzq.js +6 -0
- package/dist/{index-qe3ybzh6.js.map → index-xa9crtzq.js.map} +1 -1
- package/dist/{index-0v2gw4mk.js → index-y34s71qe.js} +3 -3
- package/dist/{index-0v2gw4mk.js.map → index-y34s71qe.js.map} +1 -1
- package/dist/{index-y6r1k2yd.js → index-ye2yb3xf.js} +7 -7
- package/dist/{index-y6r1k2yd.js.map → index-ye2yb3xf.js.map} +1 -1
- package/dist/{index-y605a1rj.js → index-z0dgxd7d.js} +10 -10
- package/dist/{index-y605a1rj.js.map → index-z0dgxd7d.js.map} +2 -2
- package/dist/{index-m01mb74d.js → index-zg89tq04.js} +4 -4
- package/dist/{index-m01mb74d.js.map → index-zg89tq04.js.map} +1 -1
- package/dist/{index-dgrwpzz9.js → index-zjphh8ch.js} +4 -4
- package/dist/{index-dgrwpzz9.js.map → index-zjphh8ch.js.map} +1 -1
- package/dist/index.js +172 -172
- package/dist/index.js.map +4 -4
- package/dist/transcript.d.ts.map +1 -1
- package/dist/web-f6869dy2.js +14 -0
- package/dist/{web-stkkwyka.js.map → web-f6869dy2.js.map} +1 -1
- package/dist/wrapper-52c0vacs.js +5 -0
- package/dist/{wrapper-bwxbqa53.js.map → wrapper-52c0vacs.js.map} +1 -1
- package/package.json +2 -2
- package/dist/APEv2Parser-jdp5yp24.js +0 -5
- package/dist/App-pmqmzsb3.js +0 -11
- package/dist/FlacParser-6jwner07.js +0 -5
- package/dist/WizardApp-qrq36nv8.js +0 -5
- package/dist/config-z2cd0c5f.js +0 -24
- package/dist/credential-h0wmsjsw.js +0 -19
- package/dist/index-1wxw30j1.js.map +0 -13
- package/dist/index-358nsn9t.js +0 -65
- package/dist/index-358nsn9t.js.map +0 -21
- package/dist/index-3mvenfbg.js +0 -5
- package/dist/index-5nprb9px.js +0 -11
- package/dist/index-ak304afj.js +0 -5
- package/dist/index-qe3ybzh6.js +0 -6
- package/dist/index-s4a28ctb.js +0 -9
- package/dist/index-tny7c703.js +0 -5
- package/dist/index-v6taf4vn.js +0 -6
- package/dist/web-stkkwyka.js +0 -14
- package/dist/wrapper-bwxbqa53.js +0 -5
- /package/dist/{DsdiffParser-gk95sj7t.js.map → DsdiffParser-vxnfx80c.js.map} +0 -0
- /package/dist/{FlacParser-6jwner07.js.map → FlacParser-bf8y3e0w.js.map} +0 -0
- /package/dist/{index-kktaw552.js.map → index-7gsbzvnc.js.map} +0 -0
- /package/dist/{index-rvq7t636.js.map → index-myg5enf5.js.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`)}function os(e,n){let r=M(n),a=(r.sources??[]).filter((i)=>i.name!==e.name),s=(r.disabled??[]).filter((i)=>i!==e.name);X({...r,sources:[...a,e],disabled:s},n)}function rs(e,n){let r=M(n),a=(r.sources??[]).filter((h)=>h.name!==e),s=a.length!==(r.sources??[]).length,i=
|
|
4
|
-
`),{commit:b,skills:g,unfiltered:h}}function
|
|
5
|
-
`).slice(-3).join(" ");if(n.timedOut===!0)return new
|
|
6
|
-
`)}function ar(e,n){let r=N(e);if(r[n]===void 0)return;let a=Object.fromEntries(Object.entries(r).filter(([s])=>s!==n));
|
|
7
|
-
`)}var x="SKILL.md";function
|
|
8
|
-
`),
|
|
2
|
+
import{t,j,f,A,H,ye,oi,q,J,Zt,si,Xt,lA,ai,_}from"./index-26ejkp8q.js";import{Us,xs,Bn}from"./index-thmq816c.js";import{ue}from"./index-6r9h7ftn.js";import{Pe,ot}from"./index-ad5c9t83.js";import{St,U,qe,Et}from"./index-akv6e7ge.js";import{d,k,Q,y}from"./index-a6mtqkth.js";import{wt}from"./index-skkddg44.js";import{Br,co}from"./index-z0dgxd7d.js";import{we,te}from"./index-0mz7wpbw.js";import{No,Mo}from"./index-q8b1fc3k.js";import{Rt,o,u}from"./index-vw2hf4d8.js";import{existsSync as T,mkdirSync as Re,readdirSync as z,readFileSync as Y,renameSync as Oe,rmSync as I,statSync as xe,writeFileSync as Ee}from"node:fs";import{join as R,relative as Ie}from"node:path";import{existsSync as pe,mkdirSync as $e,readFileSync as Se,writeFileSync as be}from"node:fs";import{join as D}from"node:path";var MA=[{name:"anthropic",url:"https://github.com/anthropics/skills",path:"skills",builtin:!0},{name:"github",url:"https://github.com/github/awesome-copilot",path:"skills",builtin:!0,curated:Us}],ke=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function TA(e){return e.length>0&&e.length<=64&&ke.test(e)}var G=1;function $n(e){return D(we(e),"sources.json")}function F(e){return D(we(e),"sources")}function L(e,n){return D(F(n),e)}function M(e){let n=$n(e);if(!pe(n))return{};let r;try{r=JSON.parse(Se(n,"utf8"))}catch(a){throw new A({code:"skill_sources_unreadable",message:`${n} is not valid JSON: ${a instanceof Error?a.message:String(a)}`,hint:"Fix the file, or delete it — the built-in sources work with no file at all."})}if(typeof r!=="object"||r===null||Array.isArray(r))throw new A({code:"skill_sources_unreadable",message:`${n} does not hold a JSON object`,hint:`Expected {"version": ${G}, "sources": [...]}. Delete the file to start from the built-in sources.`});return r}function ve(e){let n=M(e),r=(n.sources??[]).filter((l)=>TA(l.name)),a=new Set(n.disabled??[]),s=new Map(r.map((l)=>[l.name,l])),i=[];for(let l of MA){if(a.has(l.name))continue;let c=s.get(l.name);i.push(c===void 0?l:{...c,builtin:!1})}for(let l of r){if(MA.some((c)=>c.name===l.name))continue;i.push({...l,builtin:!1})}return i}function X(e,n){let r=$n(n);$e(we(n),{recursive:!0});let a={version:G,sources:e.sources??[],...e.disabled===void 0||e.disabled.length===0?{}:{disabled:e.disabled}};be(r,`${JSON.stringify(a,null,4)}
|
|
3
|
+
`)}function os(e,n){let r=M(n),a=(r.sources??[]).filter((i)=>i.name!==e.name),s=(r.disabled??[]).filter((i)=>i!==e.name);X({...r,sources:[...a,e],disabled:s},n)}function rs(e,n){let r=M(n),a=(r.sources??[]).filter((h)=>h.name!==e),s=a.length!==(r.sources??[]).length,i=MA.some((h)=>h.name===e),l=(r.disabled??[]).includes(e);if(!s&&!i)return!1;if(i&&l&&!s)return!1;let c=i&&!l?[...r.disabled??[],e]:r.disabled??[];return X({...r,sources:a,disabled:c},n),!0}function rr(e){let n=e.trim();if(n.length===0)throw P(e);if(/^[\w.-]+\/[\w.-]+$/.test(n))return{url:`https://github.com/${n.replace(/\.git$/,"")}`};if(n.startsWith("git@")||n.startsWith("ssh://"))return{url:n};let r;try{r=new URL(n)}catch{throw P(e)}if(r.protocol!=="https:"&&r.protocol!=="http:")throw P(e);let a=r.pathname.split("/").filter((h)=>h.length>0),s=a.findIndex((h)=>h==="tree"||h==="blob");if(s<2)return{url:`${r.origin}/${a.join("/")}`.replace(/\.git$/,"")};let i=a.slice(0,s).join("/"),l=a[s+1],c=a.slice(s+2).join("/");return{url:`${r.origin}/${i}`.replace(/\.git$/,""),...l===void 0?{}:{ref:l},...c.length===0?{}:{path:c}}}function P(e){return new A({code:"skill_source_url_invalid",message:`${JSON.stringify(e)} is not a repository`,hint:"Accepted: owner/repo, an https:// clone URL, a git@ SSH URL, or the page URL you were reading — .../tree/<branch>/<subdir> is understood."})}function V(e){let n=e.split("/").filter((r)=>r.length>0);if(n.length===1)return{skill:n[0]};if(n.length===2)return{source:n[0],skill:n[1]};throw new A({code:"skill_ref_invalid",message:`${JSON.stringify(e)} is neither a skill name nor <source>/<skill>`,hint:"Use `pdf` to search every source, or `anthropic/pdf` to name one. A path is taken as a path only if it exists on disk."})}var Z="SKILL.md",ee=180000,Hr=async(e,n)=>{let r=await wt({command:"git",args:e,...n===void 0?{}:{cwd:n},timeoutMs:ee,maxBuffer:33554432,env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:"",SSH_ASKPASS:"",SSH_ASKPASS_REQUIRE:"never",GIT_SSH_COMMAND:"ssh -oBatchMode=yes -oStrictHostKeyChecking=accept-new"}});if(r.notFound)throw new A({code:"git_missing",message:"git is not on PATH, and a skill source is a git repository",hint:"Install git — on macOS `xcode-select --install` is enough. Until then, clone a repository by hand and use `skills install <agent> <path>`."});return{code:r.code,stdout:r.stdout,stderr:r.stderr,...r.signalled?{timedOut:!0}:{}}};function ne(e,n){return R(F(n),`${e}.json`)}function ir(e,n){let r=ne(e,n);if(!T(r))return{};try{return JSON.parse(Y(r,"utf8"))}catch{return{}}}function dt(e,n){return T(R(L(e,n),".git"))}function sr(e){return e.startsWith(".")||e.startsWith("/")||e.startsWith("~")||T(e)}async function RA(e,n={}){let r=n.git??Hr,a=n.env,s=L(e.name,a),i=`${s}.partial`;Re(F(a),{recursive:!0}),I(i,{recursive:!0,force:!0});let l=["clone","--depth","1","--single-branch",...e.ref===void 0?[]:["--branch",e.ref]],c=e.path!==void 0,h=!c,m=c?await r([...l,"--filter=blob:none","--sparse",e.url,i]):await r([...l,e.url,i]);if(m.code!==0&&c){I(i,{recursive:!0,force:!0});let p=await r([...l,e.url,i]);if(p.code===0)h=!0,m=p}if(m.code!==0)throw I(i,{recursive:!0,force:!0}),Te(e,m);if(e.path!==void 0&&!h){let p=await r(["sparse-checkout","set",e.path],i);if(p.code!==0)throw I(i,{recursive:!0,force:!0}),new A({code:"skill_source_path_missing",message:`${e.name}: could not narrow the checkout to ${e.path}`,hint:`Check the path exists in ${e.url}. ${p.stderr.trim()||"git said nothing."}`})}let w=await r(["rev-parse","--short","HEAD"],i),b=w.code===0?w.stdout.trim():"unknown";I(s,{recursive:!0,force:!0}),Oe(i,s);let g=Ht(e,a).length;return Ee(ne(e.name,a),`${JSON.stringify({commit:b,fetchedAt:new Date().toISOString(),skills:g},null,4)}
|
|
4
|
+
`),{commit:b,skills:g,unfiltered:h}}function Te(e,n){let r=n.stderr.trim().split(`
|
|
5
|
+
`).slice(-3).join(" ");if(n.timedOut===!0)return new A({code:"skill_source_timeout",message:`${e.name}: git did not finish within ${Math.round(ee/1000)}s`,hint:`Check the network, then try again — a partly fetched source was discarded, so the previous copy of ${e.name} is untouched.`});return new A({code:"skill_source_fetch_failed",message:`${e.name}: could not clone ${e.url}${r.length===0?"":` — ${r}`}`,hint:"A private repository needs a credential helper git can use without prompting. Check the URL and the branch; `sources remove` drops a source you no longer want."})}var _e=4,re=new Set(["node_modules","dist","build","target","vendor",".git"]);function Ne(e){let n=[],r=(a,s)=>{if(s>_e)return;let i;try{i=z(a,{withFileTypes:!0})}catch{return}if(T(R(a,Z)))n.push(a);for(let l of i){if(!l.isDirectory())continue;if(l.name.startsWith(".")||re.has(l.name))continue;r(R(a,l.name),s+1)}};return r(e,0),n.sort()}var Ae=[".py",".sh",".js",".ts",".mjs",".rb",".pl"];function se(e,n=0){if(n>3)return[];let r=[],a;try{a=z(e,{withFileTypes:!0})}catch{return[]}for(let s of a){let i=R(e,s.name);if(s.isDirectory()){if(s.name.startsWith(".")||re.has(s.name))continue;r.push(...se(i,n+1));continue}if(!s.isFile())continue;if((xe(i).mode&73)!==0||Ae.some((c)=>s.name.endsWith(c)))r.push(i)}return r}function Ht(e,n){let r=L(e.name,n),a=e.path===void 0?r:R(r,e.path);if(!T(a))return[];let s=[];for(let i of Ne(a)){let l=Y(R(i,Z),"utf8"),c=i.slice(i.lastIndexOf("/")+1),h={source:e.name,dir:i,repoPath:Ie(r,i),scripts:se(i)};try{let m=Xt(c,l);s.push({...h,skill:m.frontmatter.name,description:m.frontmatter.description,tokens:H(m.body)})}catch(m){s.push({...h,skill:c,description:"",tokens:H(l),problem:m instanceof Error?m.message:String(m)})}}return s}import{cpSync as De,existsSync as v,mkdirSync as ce,readdirSync as C,readFileSync as Ue,rmSync as Me,statSync as de,writeFileSync as Ke}from"node:fs";import{basename as le,isAbsolute as fe,join as S,relative as Be,resolve as B}from"node:path";import{existsSync as Fe,readFileSync as Le,writeFileSync as oe}from"node:fs";import{join as Ce}from"node:path";var je=".origins.json",ie=1;function K(e){return Ce(e,je)}function N(e){let n=K(e);if(!Fe(n))return{};try{return JSON.parse(Le(n,"utf8")).origins??{}}catch{return{}}}function ae(e,n){let r={...N(e),...n};oe(K(e),`${JSON.stringify({version:ie,origins:r},null,4)}
|
|
6
|
+
`)}function ar(e,n){let r=N(e);if(r[n]===void 0)return;let a=Object.fromEntries(Object.entries(r).filter(([s])=>s!==n));oe(K(e),`${JSON.stringify({version:ie,origins:a},null,4)}
|
|
7
|
+
`)}var x="SKILL.md";function Kt(e){try{let n=q(e.manifestPath,{env:{..._([e.manifestPath]),...e.envOverlay}}),a=e.action==="new"||e.action==="install"?Ve(n.path,n.dir,n.manifest.skills):n.manifest.skills;if(a===void 0)return Je(e);let s=ye(n.manifest.model.main.id,n.manifest.model.main.capabilities),i=fe(a.dir)?a.dir:B(n.dir,a.dir);if(e.action==="new")return Ye(i,e);if(e.action==="remove")return tt(i,e);let l=lA({dir:i,maxActive:a.maxActive,threshold:a.threshold,style:s.promptStyle,agentDir:n.dir,runner:ue()});switch(e.action){case"list":return He(i,l.skills,l,e);case"show":return We(l.skills,e);case"install":return Qe(i,e);default:return Ge(l.skills,e)}}catch(n){if(e.json===!0&&f(n))return process.stdout.write(`${JSON.stringify({ok:!1,error:n.toDetail(),details:n.details},null,2)}
|
|
8
|
+
`),u;throw n}}function Je(e){if(e.json===!0)return process.stdout.write(`${JSON.stringify({ok:!0,configured:!1,skills:[]},null,2)}
|
|
9
9
|
`),o;return process.stdout.write(`this agent has no skills configured
|
|
10
10
|
|
|
11
11
|
`+` · find one and install it — searches the catalogues, 440+ skills:
|
|
@@ -21,16 +21,16 @@ import{A,j,f,t,H,ye,oi,q,J,ZA,si,XA,lt,ai,_}from"./index-1h9pqnec.js";import{Us,
|
|
|
21
21
|
|
|
22
22
|
\`sources search <what it should do>\` ranks 440+ from the configured catalogues, then
|
|
23
23
|
\`skills install <agent> <source>/<skill>\`. \`skills new <agent> <name>\` writes one from a template.
|
|
24
|
-
`),o;process.stdout.write(`${
|
|
24
|
+
`),o;process.stdout.write(`${d([{label:"skills",value:String(n.length)},{label:"per turn",value:`at most ${r.maxActive}`},{label:"threshold",value:r.threshold.toFixed(2)},{label:"index",value:r.cached?"cached":"scanned"}])}
|
|
25
25
|
`),process.stdout.write(`${k("catalogue")}
|
|
26
26
|
`);for(let i of n){let l=i.scripts.length===0?"":` ${i.scripts.length} script(s)`,c=i.frontmatter.whenNotToUse===void 0?" no when-not-to-use":"",h=s[i.name],m=h===void 0?"":` ${h.source}@${h.commit}`;process.stdout.write(` ${i.name.padEnd(20)} ${String(i.tokens).padStart(5)} tokens${l}${m}${c}
|
|
27
|
-
`)}return o}function We(e,n){let r=n.name;if(r===void 0)return process.stdout.write("skills show needs a skill name — `skills list` names them\n"),
|
|
28
|
-
`),
|
|
29
|
-
`),o;let{frontmatter:s}=a;if(process.stdout.write(`${
|
|
27
|
+
`)}return o}function We(e,n){let r=n.name;if(r===void 0)return process.stdout.write("skills show needs a skill name — `skills list` names them\n"),u;let a=e.find((l)=>l.name===r);if(a===void 0){let l=e.map((c)=>c.name).join(", ");return process.stdout.write(`no skill named ${r}${l===""?"":`. Known: ${l}`}
|
|
28
|
+
`),u}if(n.json===!0)return process.stdout.write(`${JSON.stringify({ok:!0,skill:Xe(a)},null,2)}
|
|
29
|
+
`),o;let{frontmatter:s}=a;if(process.stdout.write(`${d([{label:"name",value:a.name},{label:"directory",value:a.dir},{label:"body",value:`${a.tokens} tokens`},...s.license===void 0?[]:[{label:"license",value:s.license}],...s.compatibility===void 0?[]:[{label:"needs",value:s.compatibility}]])}
|
|
30
30
|
`),process.stdout.write(`${k("description")}
|
|
31
31
|
`),process.stdout.write(`${y(s.description)}
|
|
32
32
|
`),process.stdout.write(`${k("when not to use")}
|
|
33
|
-
`),process.stdout.write(`${y(s.whenNotToUse??`not declared — add metadata.${
|
|
33
|
+
`),process.stdout.write(`${y(s.whenNotToUse??`not declared — add metadata.${Zt()} to improve routing`)}
|
|
34
34
|
`),a.scripts.length>0){process.stdout.write(`${k("scripts")}
|
|
35
35
|
`);for(let l of a.scripts)process.stdout.write(`${Q(`${l.slug} — scripts/${l.file} via ${l.interpreter??"its own shebang"}`)}
|
|
36
36
|
`)}if(a.ignoredScripts.length>0){process.stdout.write(`${k("in scripts/ and not runnable")}
|
|
@@ -38,10 +38,10 @@ import{A,j,f,t,H,ye,oi,q,J,ZA,si,XA,lt,ai,_}from"./index-1h9pqnec.js";import{Us,
|
|
|
38
38
|
`)}if(s.allowedTools!==void 0)process.stdout.write(`${k("allowed-tools, declared and not honoured")}
|
|
39
39
|
`),process.stdout.write(`${y(s.allowedTools)}
|
|
40
40
|
`),process.stdout.write(`${y("this runtime reads the field and never acts on it; permissions live in tools.policy")}
|
|
41
|
-
`);let i=Object.entries(s.metadata).filter(([l])=>l!==
|
|
42
|
-
`),process.stdout.write(`${
|
|
41
|
+
`);let i=Object.entries(s.metadata).filter(([l])=>l!==Zt());if(i.length>0)process.stdout.write(`${k("metadata")}
|
|
42
|
+
`),process.stdout.write(`${d(i.map(([l,c])=>({label:l,value:c})))}
|
|
43
43
|
`);return o}function Ge(e,n){let r=ai(e);if(n.json===!0)return process.stdout.write(`${JSON.stringify({ok:r.length===0,skills:e.map(W),findings:r},null,2)}
|
|
44
|
-
`),n.strict===!0&&r.length>0?
|
|
44
|
+
`),n.strict===!0&&r.length>0?u:o;let a=new Map;for(let s of r){let l=e.find((c)=>s.message.includes(` ${c.name}:`))?.name??"";a.set(l,[...a.get(l)??[],s])}for(let s of e){let i=a.get(s.name)??[];process.stdout.write(` ${s.name.padEnd(20)} ${i.length===0?"ok":`${i.length} warning(s)`}
|
|
45
45
|
`)}if(r.length===0)return process.stdout.write(`
|
|
46
46
|
no findings
|
|
47
47
|
`),o;for(let s of r)process.stdout.write(`
|
|
@@ -49,21 +49,21 @@ no findings
|
|
|
49
49
|
`),process.stdout.write(` hint: ${s.hint}
|
|
50
50
|
`);return process.stdout.write(`
|
|
51
51
|
${r.length} finding(s) — warnings, not failures. --strict exits non-zero.
|
|
52
|
-
`),n.strict===!0?
|
|
52
|
+
`),n.strict===!0?u:o}function W(e){return{name:e.name,tokens:e.tokens,hasWhenNotToUse:e.frontmatter.whenNotToUse!==void 0,scripts:e.scripts.map((n)=>n.slug),ignoredScripts:e.ignoredScripts}}function Xe(e){return{...W(e),dir:e.dir,description:e.frontmatter.description,...e.frontmatter.whenNotToUse===void 0?{}:{whenNotToUse:e.frontmatter.whenNotToUse},...e.frontmatter.license===void 0?{}:{license:e.frontmatter.license},...e.frontmatter.compatibility===void 0?{}:{compatibility:e.frontmatter.compatibility},...e.frontmatter.allowedTools===void 0?{}:{allowedToolsDeclaredNotHonoured:e.frontmatter.allowedTools},metadata:e.frontmatter.metadata}}function Ve(e,n,r){let a=r?.dir??"./skills",s=fe(a)?a:B(n,a);if(ce(s,{recursive:!0}),r!==void 0)return r;let i=oi({file:e,path:["skills"],value:ze(a)});if(process.stdout.write(`${d([{label:"enabled",value:`skills.dir = ${a}`}])}
|
|
53
53
|
`),i.reflowed)process.stdout.write(`${Q("the file was re-serialised to add the block — it is valid, and comments may have moved")}
|
|
54
|
-
`);return{dir:a,...
|
|
55
|
-
`),
|
|
56
|
-
`),
|
|
54
|
+
`);return{dir:a,...me}}var me={maxActive:1,threshold:0.35};function ze(e){return{dir:e,...me}}function Ye(e,n){let r=n.name;if(r===void 0)return process.stdout.write("skills new needs a name — `skills new <manifest> <name>`\n"),u;if(!si(r))return process.stdout.write(`${r} is not a legal skill name: lowercase letters, digits and single hyphens, never leading, trailing or doubled, at most 64 characters.
|
|
55
|
+
`),u;let a=S(e,r);if(v(a))return process.stdout.write(`${a} already exists — nothing was written
|
|
56
|
+
`),u;return ce(a,{recursive:!0}),Ke(S(a,"SKILL.md"),co(Br,{SKILL_NAME:r,WHEN_NOT_TO_USE_KEY:Zt()}),"utf8"),process.stdout.write(`${d([{label:"created",value:S(a,"SKILL.md")},{label:"name",value:r}])}
|
|
57
57
|
`),process.stdout.write(`${k("next")}
|
|
58
58
|
${Q("edit the description — it is the only thing selection reads, so name the words someone would actually type")}
|
|
59
59
|
${Q("write the steps in place of the placeholder body")}
|
|
60
60
|
${Q("skills validate — it warns until the scaffold is replaced")}
|
|
61
61
|
${Q("restart the agent: the catalogue is scanned once at boot")}
|
|
62
|
-
`),o}function Qe(e,n){let r=n.name;if(r===void 0)return process.stdout.write("skills install needs something to install — `skills install <manifest> anthropic/pdf`, or a local path\n\n `sources search <what you need>` finds one.\n"),
|
|
63
|
-
`),
|
|
62
|
+
`),o}function Qe(e,n){let r=n.name;if(r===void 0)return process.stdout.write("skills install needs something to install — `skills install <manifest> anthropic/pdf`, or a local path\n\n `sources search <what you need>` finds one.\n"),u;let a=sr(r),s;if(!a){let g=Ze(r,n.sandboxEnv);if(g===void 0)return u;s=g}let i=s===void 0?B(r):s.entry.dir;if(s===void 0){if(!v(i)||!de(i).isDirectory())return process.stdout.write(`${i} is not a directory
|
|
63
|
+
`),u;if(v(r)&&ve(n.sandboxEnv).some((g)=>g.name===r))process.stdout.write(`note: ${r} is also a source, and a directory of that name here wins — \`sources search\` to install from the source instead
|
|
64
64
|
|
|
65
65
|
`)}let l={},c=[],m=v(S(i,x))?[i]:C(i,{withFileTypes:!0}).filter((g)=>g.isDirectory()&&v(S(i,g.name,x))).map((g)=>S(i,g.name));if(m.length===0)return process.stdout.write(`no ${x} in ${i} or in any directory directly inside it
|
|
66
|
-
`),
|
|
66
|
+
`),u;let w=[],b=[];for(let g of m){let p;try{p=Xt(le(g),Ue(S(g,x),"utf8")).frontmatter.name}catch(O){b.push(`${le(g)} — ${O instanceof Error?O.message:String(O)}`);continue}let E=S(e,p);if(v(E)){b.push(`${p} — already installed at ${E}`);continue}if(De(g,E,{recursive:!0,preserveTimestamps:!0}),w.push(p),s!==void 0)l[p]={source:s.spec.name,url:s.spec.url,repoPath:s.entry.repoPath,commit:s.commit,...s.spec.ref===void 0?{}:{ref:s.spec.ref},installedAt:new Date().toISOString()};c.push(...ge(E).map((O)=>`${p}/${Be(E,O)}`))}if(Object.keys(l).length>0)ae(e,l);if(n.collect!==void 0){for(let g of w)n.collect.push({name:g,ok:!0,runnable:c.filter((p)=>p.startsWith(`${g}/`))});for(let g of b){let p=g.indexOf(" — ");n.collect.push({name:p===-1?g:g.slice(0,p),ok:!1,reason:p===-1?g:g.slice(p+3),runnable:[]})}}if(n.quiet===!0)return w.length===0?u:o;process.stdout.write(`${d([{label:"from",value:s===void 0?i:`${s.spec.name} (${s.spec.url}) at ${s.commit}`},{label:"installed",value:w.join(", ")},{label:"skipped",value:b.length===0?"":String(b.length)}])}
|
|
67
67
|
`);for(let g of b)process.stdout.write(`${Q(g)}
|
|
68
68
|
`);if(c.length>0){if(process.stdout.write(`${k("this installed code, which the agent can run")}
|
|
69
69
|
${c.slice(0,12).map((g)=>Q(g)).join(`
|
|
@@ -73,16 +73,16 @@ ${c.slice(0,12).map((g)=>Q(g)).join(`
|
|
|
73
73
|
`)}if(w.length>0)process.stdout.write(`${k("next")}
|
|
74
74
|
${Q("skills validate — a vendored skill usually has no negative guidance, which is a warning and not a problem")}
|
|
75
75
|
${Q("restart the agent: the catalogue is scanned once at boot")}
|
|
76
|
-
`);return w.length===0?
|
|
76
|
+
`);return w.length===0?u:o}function Ze(e,n){let r;try{r=V(e)}catch(m){if(!f(m))throw m;process.stdout.write(`${m.message}
|
|
77
77
|
|
|
78
78
|
${m.hint}
|
|
79
79
|
`);return}let a=ve(n),s=r.source===void 0?a:a.filter((m)=>m.name===r.source);if(s.length===0){let m=j(r.source??"",a.map((w)=>w.name));process.stdout.write(`no source called ${r.source}
|
|
80
80
|
|
|
81
81
|
${m===void 0?"`sources list` shows them.":`Did you mean ${m}?`}
|
|
82
|
-
`);return}if(s.filter((m)=>!
|
|
82
|
+
`);return}if(s.filter((m)=>!dt(m.name,n)).length===s.length){process.stdout.write(`${s.length===1?`${s[0]?.name} has not`:"no source has"} been fetched yet, so there is nothing to install from
|
|
83
83
|
|
|
84
84
|
\`sources update${r.source===void 0?"":` ${r.source}`}\` first, or \`sources search ${r.skill}\` which fetches on demand.
|
|
85
|
-
`);return}let l=s.filter((m)=>
|
|
85
|
+
`);return}let l=s.filter((m)=>dt(m.name,n)).flatMap((m)=>Ht(m,n).map((w)=>({entry:w,spec:m}))),c=l.filter((m)=>m.entry.skill===r.skill);if(c.length===0){let m=j(r.skill,l.map((w)=>w.entry.skill));process.stdout.write(`no skill called ${r.skill} in ${s.map((w)=>w.name).join(", ")}
|
|
86
86
|
|
|
87
87
|
${m===void 0?`\`sources search ${r.skill}\` ranks what is there.`:`Did you mean ${m}? \`sources search ${r.skill}\` ranks the alternatives.`}
|
|
88
88
|
`);return}if(c.length>1){process.stdout.write(`${c.length} sources carry a skill called ${r.skill}
|
|
@@ -93,34 +93,34 @@ ${c.map((m)=>` ${m.spec.name}/${m.entry.skill} — ${m.spec.url}
|
|
|
93
93
|
`);return}let h=c[0];if(h.entry.problem!==void 0){process.stdout.write(`${h.spec.name}/${h.entry.skill} will not load: ${h.entry.problem}
|
|
94
94
|
|
|
95
95
|
Nothing was copied. That is upstream's to fix — installing a hand-edited copy from a path is the way round it.
|
|
96
|
-
`);return}return{entry:h.entry,spec:h.spec,commit:ir(h.spec.name,n).commit??"unknown"}}function
|
|
97
|
-
`),
|
|
96
|
+
`);return}return{entry:h.entry,spec:h.spec,commit:ir(h.spec.name,n).commit??"unknown"}}function ge(e,n=0){if(n>3)return[];let r=[];for(let a of C(e,{withFileTypes:!0})){let s=S(e,a.name);if(a.isDirectory()){if(a.name.startsWith("."))continue;r.push(...ge(s,n+1));continue}if(!a.isFile())continue;if((de(s).mode&73)!==0||et.some((l)=>a.name.endsWith(l)))r.push(s)}return r}var et=[".py",".sh",".js",".ts",".mjs",".rb",".pl"];function tt(e,n){let r=n.name;if(r===void 0)return process.stdout.write("skills remove needs a name — `skills list` names them\n"),u;let a=S(e,r);if(!v(S(a,x))){let l=v(e)?C(e,{withFileTypes:!0}).filter((c)=>c.isDirectory()&&v(S(e,c.name,x))).map((c)=>c.name).join(", "):"";return process.stdout.write(`no skill named ${r}${l===""?"":`. Known: ${l}`}
|
|
97
|
+
`),u}let s=he(a),i=N(e)[r];return Me(a,{recursive:!0,force:!0}),ar(e,r),process.stdout.write(`${d([{label:"removed",value:a},{label:"files",value:String(s)},...i===void 0?[]:[{label:"came from",value:`${i.source} (${i.url}) at ${i.commit}`}]])}
|
|
98
98
|
`),process.stdout.write(`${Q("restart the agent: the catalogue is scanned once at boot")}
|
|
99
|
-
`),o}function
|
|
100
|
-
`)})}function is(e,n,r){let a=[];for(let s of e)
|
|
99
|
+
`),o}function he(e){let n=0;for(let r of C(e,{withFileTypes:!0}))n+=r.isDirectory()?he(S(e,r.name)):1;return n}async function _A(e){let n=e.onStatus??(()=>{}),r=ve(e.env),a=r.filter((i)=>!dt(i.name,e.env));for(let[i,l]of a.entries()){n(`fetching ${l.name} (${i+1} of ${a.length}) — once per machine, shared by every agent`);try{let c=await RA(l,{...e.env===void 0?{}:{env:e.env},...e.git===void 0?{}:{git:e.git}});n(`${l.name}: ${c.skills} skills`)}catch(c){n(`${l.name} could not be fetched: ${f(c)?c.message:String(c)}`)}}let s=r.filter((i)=>dt(i.name,e.env)).map((i)=>({spec:i,entries:Ht(i,e.env)}));return xs(s)}async function nt(e){return await _A({...e,onStatus:(n)=>process.stdout.write(`${n}
|
|
100
|
+
`)})}function is(e,n,r){let a=[];for(let s of e)Kt({action:"install",manifestPath:n,name:s,quiet:!0,collect:a,...r.env===void 0?{}:{sandboxEnv:r.env},...r.envOverlay===void 0?{}:{envOverlay:r.envOverlay}});return st(a)}function rt(e,n,r){let a=[];for(let s of e)Kt({action:"install",manifestPath:n,name:`${s.source}/${s.skill}`,quiet:!0,collect:a,...r.env===void 0?{}:{sandboxEnv:r.env},...r.envOverlay===void 0?{}:{envOverlay:r.envOverlay}});return a}function st(e){let n=Bn(e);if(process.stdout.write(`${k(`installed ${n.installed.length} of ${n.total} skill${n.total===1?"":"s"}`,!0)}
|
|
101
101
|
`),n.installed.length>0)process.stdout.write(`${y(n.installed.join(", "))}
|
|
102
102
|
`);for(let r of n.failed)process.stdout.write(`${Q(`${r.name} — ${r.reason}`)}
|
|
103
103
|
`);if(n.runnable>0)process.stdout.write(`${k("code that came with them")}
|
|
104
104
|
${y(`${n.runnable} runnable file${n.runnable===1?"":"s"} across ${n.withCode} skill${n.withCode===1?"":"s"} — \`skills show <agent> <skill>\` names them`)}
|
|
105
105
|
`);return n.failed.length}async function ss(e){if(ve(e.env).length===0)return process.stdout.write(`no skill sources are configured
|
|
106
106
|
|
|
107
|
-
\`${
|
|
108
|
-
`),
|
|
107
|
+
\`${t.slug} sources add <url>\` adds one — a repository holding a skills/ directory.
|
|
108
|
+
`),u;if(!(ot({plain:e.plain===!0,json:e.json===!0,oneShot:!1}).mode==="rich"&&e.json!==!0)){let g=await nt(e);if(g.length===0)return process.stdout.write(`nothing to show — no catalogue could be read
|
|
109
109
|
|
|
110
|
-
\`${
|
|
111
|
-
`),
|
|
112
|
-
${y(`\`${
|
|
113
|
-
`),
|
|
114
|
-
`);if(h.installed.length>0)process.stdout.write(`${h.installed.length} skill${h.installed.length===1?"":"s"} installed — \`${
|
|
115
|
-
`);return h.failed.length===h.total&&h.total>0?
|
|
116
|
-
`),o}function
|
|
110
|
+
\`${t.slug} sources update\` reports why.
|
|
111
|
+
`),u;if(e.json===!0)return it(g);return lt(g,te(e.env))}let s=te(e.env);if(s.length===0)return process.stdout.write(`${k("no agent to install into",!0)}
|
|
112
|
+
${y(`\`${t.slug} init\` creates one, then this command installs into it.`)}
|
|
113
|
+
`),u;let[{render:i},{createElement:l},{SkillBrowser:c}]=await Promise.all([import("ink"),import("react"),import("./SkillBrowser-p9ht63c7.js")]),h,m=()=>{},w=new Promise((g)=>{m=g});St(),process.stdout.write(Rt);let b=i(l(c,{title:ct,agents:s,load:(g)=>_A({...e,onStatus:g}),install:async(g,p)=>Bn(rt(g,p,e)),onDone:(g)=>{h=g,m()}}),{exitOnCtrlC:!1,...Pe()});if(U(()=>b.unmount()),await w,b.unmount(),qe(),await Et(),h===void 0)return o;for(let g of h.failed)process.stderr.write(`${g.name} — ${g.reason}
|
|
114
|
+
`);if(h.installed.length>0)process.stdout.write(`${h.installed.length} skill${h.installed.length===1?"":"s"} installed — \`${t.slug} skills list <agent>\` shows them
|
|
115
|
+
`);return h.failed.length===h.total&&h.total>0?u:o}function it(e){return process.stdout.write(`${JSON.stringify({skills:e.filter((n)=>n.entry!==void 0).map((n)=>({ref:`${n.entry?.source}/${n.entry?.skill}`,source:n.entry?.source,skill:n.entry?.skill,tokens:n.entry?.tokens,scripts:n.entry?.scripts.length??0,description:n.entry?.description}))},null,2)}
|
|
116
|
+
`),o}function at(e){let r=e.reduce((i,l)=>l.kind==="item"?Math.max(i,l.label.length):i,0),a=No(100,r+12,{nameMax:46}),s=[];for(let i of e){if(i.kind==="source"){s.push(`
|
|
117
117
|
${i.label}`);continue}if(i.kind==="group"){s.push(` ${i.label}`);continue}let l=Mo({name:`${i.entry?.source}/${i.label}`,meta:i.meta??"",description:i.description??""},a);s.push(` ${l.name} ${l.meta} ${l.description}`.trimEnd())}return s.join(`
|
|
118
|
-
`)}function
|
|
118
|
+
`)}function lt(e,n){process.stdout.write(`${at(e)}
|
|
119
119
|
`);let r=e.find((s)=>s.entry!==void 0)?.entry,a=n[0]?.ref??"<agent>";return process.stdout.write(`${k("install")}
|
|
120
|
-
${y(`${
|
|
121
|
-
${y(`${
|
|
122
|
-
`),o}var ct=`${
|
|
123
|
-
export{
|
|
120
|
+
${y(`${t.slug} skills install ${a} ${r?.source??"anthropic"}/${r?.skill??"pdf"}`)}
|
|
121
|
+
${y(`${t.slug} skills — at a terminal, ticks several at once`,2)}
|
|
122
|
+
`),o}var ct=`${t.name} ${J}`;
|
|
123
|
+
export{MA,TA,$n,ve,os,rs,rr,Hr,ir,dt,sr,RA,Ht,ar,Kt,_A,is,ss};
|
|
124
124
|
|
|
125
|
-
//# debugId=
|
|
126
|
-
//# sourceMappingURL=index-
|
|
125
|
+
//# debugId=C4D6369EDF380BFA64756E2164756E21
|
|
126
|
+
//# sourceMappingURL=index-pdsey1ab.js.map
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
"/**\n * Bare `skills`, with no arguments: the catalogue, ticked, installed into an agent you pick.\n *\n * This is the entry point the owner asked for and the one the surface was missing. Everything else\n * required knowing something first — `skills list <agent>` needs an agent, `sources search <words>` needs\n * words, and `skills install <agent> <source>/<skill>` needs the name of a skill you have not seen yet.\n * A person who wants skills has none of those, so the command that takes no arguments has to be the one\n * that shows what exists.\n *\n * ## What it does not do\n *\n * It does not fetch on a pipe. `--plain`, a redirect, or CI gets the same list as text, from the same\n * `browseRows`, with the two commands that install a skill non-interactively printed underneath — because\n * a picker is not scriptable and pretending otherwise means somebody's CI job hangs on a keypress.\n *\n * It also does not resolve an agent for you when there are several. Installing somebody else's executable\n * code into whichever agent happened to sort first is not a default worth having, so the second screen\n * asks — and with exactly one agent it does not, because there is nothing to ask.\n */\n\nimport { BRAND, isHarnessError, VERSION } from \"@dispach/core\"\nimport {\n type BrowseInput,\n type BrowseRow,\n browseRows,\n type InstallReport,\n installReport,\n} from \"#lib/browse\"\nimport { ENTER_ALT_SCREEN, EXIT_FAILURE, EXIT_OK } from \"#lib/const\"\nimport { flushOutput, markAltScreen, onExit, restoreTerminal } from \"#lib/exit\"\nimport { negotiateKeyboard } from \"#lib/keyboard\"\nimport { resolveModeFromProcess } from \"#lib/output\"\nimport { bullet, indent, section } from \"#lib/render\"\nimport { columnsFor, layoutRow } from \"#lib/rows\"\nimport { listAgents, type SandboxAgent } from \"#lib/sandbox\"\nimport {\n type CatalogueEntry,\n fetchSource,\n type Git,\n isCached,\n readCatalogue,\n} from \"#lib/source-cache\"\nimport { loadSources } from \"#lib/sources\"\nimport { type InstallOutcome, skillsCommand } from \"#skills\"\n\nexport interface BrowseOptions {\n readonly plain?: boolean\n readonly json?: boolean\n /** Injected by the tests, which never reach a network. */\n readonly git?: Git\n readonly env?: Readonly<Record<string, string | undefined>>\n /** Both overridden in tests; at a terminal they are measured from the stream. */\n readonly rows?: number\n readonly width?: number\n}\n\n/**\n * Fetch what is not cached, then build the rows. Shared by the command and by `init`.\n *\n * Announced before the work: the first run pays ~40 MB once per machine and every agent on it shares the\n * result, and a command that pauses for twenty seconds with no output is indistinguishable from one that\n * has hung — the failure this whole area's git wrapper exists to prevent.\n */\n/**\n * Fetch what is not cached, then build the rows — reporting progress through a callback.\n *\n * A callback rather than `process.stdout` because one caller is *inside* a rendered screen, where writing\n * to stdout paints over the frame Ink is managing. The other caller passes a writer and gets the same lines\n * on a pipe. This is the seam that lets the init wizard show a spinner instead of a printed line.\n */\nexport async function fetchCatalogue(\n options: BrowseOptions & { readonly onStatus?: (line: string) => void },\n): Promise<readonly BrowseRow[]> {\n const say = options.onStatus ?? (() => {})\n const sources = loadSources(options.env)\n const cold = sources.filter((spec) => !isCached(spec.name, options.env))\n for (const [at, spec] of cold.entries()) {\n say(\n `fetching ${spec.name} (${at + 1} of ${cold.length}) — once per machine, shared by every agent`,\n )\n try {\n const result = await fetchSource(spec, {\n ...(options.env === undefined ? {} : { env: options.env }),\n ...(options.git === undefined ? {} : { git: options.git }),\n })\n say(`${spec.name}: ${result.skills} skills`)\n } catch (error) {\n say(\n `${spec.name} could not be fetched: ${isHarnessError(error) ? error.message : String(error)}`,\n )\n }\n }\n const inputs: BrowseInput[] = sources\n .filter((spec) => isCached(spec.name, options.env))\n .map((spec) => ({ spec, entries: readCatalogue(spec, options.env) }))\n return browseRows(inputs)\n}\n\n/** The same thing for the paths that own the terminal, printing each line as it happens. */\nexport async function catalogueRows(options: BrowseOptions): Promise<readonly BrowseRow[]> {\n return await fetchCatalogue({\n ...options,\n onStatus: (line) => process.stdout.write(`${line}\\n`),\n })\n}\n\n/**\n * Install a list of `<source>/<skill>` refs, reporting once.\n *\n * Exported for `init`, whose wizard already collected the refs on its own screen — so it needs the install\n * without the picker.\n */\nexport function installRefs(\n refs: readonly string[],\n manifestPath: string,\n options: BrowseOptions & { readonly envOverlay?: Readonly<Record<string, string | undefined>> },\n): number {\n const outcomes: InstallOutcome[] = []\n for (const ref of refs) {\n skillsCommand({\n action: \"install\",\n manifestPath,\n name: ref,\n quiet: true,\n collect: outcomes,\n ...(options.env === undefined ? {} : { sandboxEnv: options.env }),\n ...(options.envOverlay === undefined ? {} : { envOverlay: options.envOverlay }),\n })\n }\n return report(outcomes)\n}\n\n/**\n * One `skills install` per skill rather than one call with a list.\n *\n * The command's contract is one ref, it reports per skill, and a partial failure leaves the successful\n * ones installed with a named reason for the rest — batching would have to reimplement all of that.\n */\nfunction collectInstall(\n skills: readonly CatalogueEntry[],\n manifestPath: string,\n options: BrowseOptions & { readonly envOverlay?: Readonly<Record<string, string | undefined>> },\n): readonly InstallOutcome[] {\n const outcomes: InstallOutcome[] = []\n for (const entry of skills) {\n skillsCommand({\n action: \"install\",\n manifestPath,\n name: `${entry.source}/${entry.skill}`,\n quiet: true,\n collect: outcomes,\n ...(options.env === undefined ? {} : { sandboxEnv: options.env }),\n ...(options.envOverlay === undefined ? {} : { envOverlay: options.envOverlay }),\n })\n }\n return outcomes\n}\n\n/**\n * The one report for a batch, as text.\n *\n * Renders from `installReport`, which the rich result card also reads — so a pipe and a terminal cannot\n * disagree about what happened. Eleven ticked skills used to produce eleven of these.\n */\nfunction report(outcomes: readonly InstallOutcome[]): number {\n const summary = installReport(outcomes)\n process.stdout.write(\n `${section(`installed ${summary.installed.length} of ${summary.total} skill${summary.total === 1 ? \"\" : \"s\"}`, true)}\\n`,\n )\n if (summary.installed.length > 0) {\n process.stdout.write(`${indent(summary.installed.join(\", \"))}\\n`)\n }\n for (const failure of summary.failed) {\n process.stdout.write(`${bullet(`${failure.name} — ${failure.reason}`)}\\n`)\n }\n if (summary.runnable > 0) {\n // Counted here and named per skill by `skills show`. Twelve file paths per skill across eleven\n // skills is 130 lines of disclosure nobody reads, which discloses less than one honest sentence.\n process.stdout.write(\n `${section(\"code that came with them\")}\\n${indent(\n `${summary.runnable} runnable file${summary.runnable === 1 ? \"\" : \"s\"} across ${summary.withCode} skill${summary.withCode === 1 ? \"\" : \"s\"} — \\`skills show <agent> <skill>\\` names them`,\n )}\\n`,\n )\n }\n return summary.failed.length\n}\n\nexport async function browseCommand(options: BrowseOptions): Promise<number> {\n const sources = loadSources(options.env)\n if (sources.length === 0) {\n process.stdout.write(\n `no skill sources are configured\\n\\n \\`${BRAND.slug} sources add <url>\\` adds one — a repository holding a skills/ directory.\\n`,\n )\n return EXIT_FAILURE\n }\n\n const decision = resolveModeFromProcess({\n plain: options.plain === true,\n json: options.json === true,\n oneShot: false,\n })\n const interactive = decision.mode === \"rich\" && options.json !== true\n\n // The plain and JSON paths still fetch first, because they have nothing to render while they wait\n // and a spinner on a pipe is noise. The rich path does the opposite, and that inversion is the\n // whole point of this stage.\n if (!interactive) {\n const rows = await catalogueRows(options)\n if (rows.length === 0) {\n process.stdout.write(\n `nothing to show — no catalogue could be read\\n\\n \\`${BRAND.slug} sources update\\` reports why.\\n`,\n )\n return EXIT_FAILURE\n }\n if (options.json === true) return printJson(rows)\n return plainList(rows, listAgents(options.env))\n }\n\n const agents = listAgents(options.env)\n if (agents.length === 0) {\n // Checked before the mount because it needs no catalogue: fetching 40 MB to then say there is\n // nowhere to put it would be the wrong order to find out in.\n process.stdout.write(\n `${section(\"no agent to install into\", true)}\\n${indent(`\\`${BRAND.slug} init\\` creates one, then this command installs into it.`)}\\n`,\n )\n return EXIT_FAILURE\n }\n\n const [{ render }, { createElement }, { SkillBrowser }] = await Promise.all([\n import(\"ink\"),\n import(\"react\"),\n import(\"#components/SkillBrowser\"),\n ])\n\n let report: InstallReport | undefined\n let finish: () => void = () => {}\n const closed = new Promise<void>((resolve) => {\n finish = resolve\n })\n\n // Alternate screen: this waits for a keypress, so it takes the terminal and gives it back. The\n // enter sequence and the flag are written together — a flag set without the sequence would make the\n // restore clear the screen the output was just written to.\n markAltScreen()\n process.stdout.write(ENTER_ALT_SCREEN)\n\n const instance = render(\n createElement(SkillBrowser, {\n title: BROWSE_TITLE,\n agents,\n load: (onStatus: (line: string) => void) => fetchCatalogue({ ...options, onStatus }),\n install: async (skills: readonly CatalogueEntry[], manifestPath: string) =>\n installReport(collectInstall(skills, manifestPath, options)),\n onDone: (result: InstallReport | undefined) => {\n report = result\n finish()\n },\n }),\n { exitOnCtrlC: false, ...negotiateKeyboard() },\n )\n onExit(() => instance.unmount())\n await closed\n instance.unmount()\n restoreTerminal()\n await flushOutput()\n\n // Restored first, then one line on the real screen. A clean exit leaves no trace of the browsing;\n // what it does leave is the pointer to what changed, and any failure, because hard rule 8 does not\n // stop applying because a screen has closed.\n if (report === undefined) return EXIT_OK\n for (const failure of report.failed) {\n process.stderr.write(`${failure.name} — ${failure.reason}\\n`)\n }\n if (report.installed.length > 0) {\n process.stdout.write(\n `${report.installed.length} skill${report.installed.length === 1 ? \"\" : \"s\"} installed — \\`${BRAND.slug} skills list <agent>\\` shows them\\n`,\n )\n }\n return report.failed.length === report.total && report.total > 0 ? EXIT_FAILURE : EXIT_OK\n}\n\n/** The JSON form, unchanged and deliberately not rendered. */\nfunction printJson(rows: readonly BrowseRow[]): number {\n process.stdout.write(\n `${JSON.stringify(\n {\n skills: rows\n .filter((row) => row.entry !== undefined)\n .map((row) => ({\n ref: `${row.entry?.source}/${row.entry?.skill}`,\n source: row.entry?.source,\n skill: row.entry?.skill,\n tokens: row.entry?.tokens,\n scripts: row.entry?.scripts.length ?? 0,\n description: row.entry?.description,\n })),\n },\n null,\n 2,\n )}\\n`,\n )\n return EXIT_OK\n}\n\n/**\n * The pipe's rendering: the same rows, laid out in the same columns, at a fixed 100.\n *\n * Fixed rather than measured, because a redirected stream has no width and output that changed shape\n * depending on the terminal it was *not* written to is output no test can pin.\n */\nfunction plainListText(rows: readonly BrowseRow[]): string {\n const width = 100\n const longest = rows.reduce(\n (max, row) => (row.kind === \"item\" ? Math.max(max, row.label.length) : max),\n 0,\n )\n // `longest + 12` and a matching ceiling, because each name is printed as `<source>/<skill>` here.\n const columns = columnsFor(width, longest + 12, { nameMax: 46 })\n const lines: string[] = []\n for (const row of rows) {\n if (row.kind === \"source\") {\n lines.push(`\\n${row.label}`)\n continue\n }\n if (row.kind === \"group\") {\n lines.push(` ${row.label}`)\n continue\n }\n const cells = layoutRow(\n {\n name: `${row.entry?.source}/${row.label}`,\n meta: row.meta ?? \"\",\n description: row.description ?? \"\",\n },\n columns,\n )\n lines.push(` ${cells.name} ${cells.meta} ${cells.description}`.trimEnd())\n }\n return lines.join(\"\\n\")\n}\n\n/**\n * The pipe's answer: the same rows, plus the two commands that install one without a keypress.\n *\n * Exits 0. Asking what exists is a legitimate question and it was answered — unlike bare `run`, which\n * exits non-zero on a pipe because nothing ran and something was supposed to.\n */\nfunction plainList(rows: readonly BrowseRow[], agents: readonly SandboxAgent[]): number {\n process.stdout.write(`${plainListText(rows)}\\n`)\n const example = rows.find((row) => row.entry !== undefined)?.entry\n const agent = agents[0]?.ref ?? \"<agent>\"\n process.stdout.write(\n `${section(\"install\")}\\n${indent(`${BRAND.slug} skills install ${agent} ${example?.source ?? \"anthropic\"}/${example?.skill ?? \"pdf\"}`)}\\n${indent(`${BRAND.slug} skills — at a terminal, ticks several at once`, 2)}\\n`,\n )\n return EXIT_OK\n}\n\n/** Kept beside the command so the banner and the picker cannot disagree about the version. */\nexport const BROWSE_TITLE = `${BRAND.name} ${VERSION}`\n"
|
|
10
10
|
],
|
|
11
11
|
"mappings": ";idA+BA,qBACI,eACA,kBACA,kBACA,gBACA,aACA,cACA,oBACA,iBAEJ,eAAS,cAAM,mBChBf,qBAAS,gBAAY,mBAAW,oBAAc,iBAC9C,eAAS,kBAmDF,IAAM,GAAyC,CAClD,CACI,KAAM,YACN,IAAK,uCACL,KAAM,SACN,QAAS,EACb,EACA,CACI,KAAM,SACN,IAAK,4CACL,KAAM,SACN,QAAS,GAET,QAAS,EACb,CACJ,EAGM,GAAc,6BAEb,SAAS,EAAY,CAAC,EAAuB,CAChD,OAAO,EAAK,OAAS,GAAK,EAAK,QAAU,IAAM,GAAY,KAAK,CAAI,EASxE,IAAM,EAAU,EAET,SAAS,EAAY,CAAC,EAA4D,CACrF,OAAO,EAAK,GAAY,CAAG,EAAG,cAAc,EAIzC,SAAS,CAAS,CAAC,EAA4D,CAClF,OAAO,EAAK,GAAY,CAAG,EAAG,SAAS,EAGpC,SAAS,CAAQ,CAAC,EAAc,EAA4D,CAC/F,OAAO,EAAK,EAAU,CAAG,EAAG,CAAI,EAGp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,CAAC,EAEjF,OAAO,EAAM,KAAK;AAAA,CAAI,EAS1B,SAAS,EAAS,CAAC,EAA4B,EAAyC,CACpF,QAAQ,OAAO,MAAM,GAAG,GAAc,CAAI;AAAA,CAAK,EAC/C,IAAM,EAAU,EAAK,KAAK,CAAC,IAAQ,EAAI,QAAU,MAAS,GAAG,MACvD,EAAQ,EAAO,IAAI,KAAO,UAIhC,OAHA,QAAQ,OAAO,MACX,GAAG,EAAQ,SAAS;AAAA,EAAM,EAAO,GAAG,EAAM,uBAAuB,KAAS,GAAS,QAAU,eAAe,GAAS,OAAS,OAAO;AAAA,EAAM,EAAO,GAAG,EAAM,qDAAsD,CAAC;AAAA,CACtN,EACO,EAIJ,IAAM,GAAe,GAAG,EAAM,QAAQ",
|
|
12
|
-
"debugId": "
|
|
12
|
+
"debugId": "C4D6369EDF380BFA64756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
export{
|
|
2
|
+
import{B,N,$t,P,Lr}from"./index-633eqxry.js";import{Qe}from"./index-y34s71qe.js";import{I}from"./index-t6xnecdx.js";var r=I(N(),1);var t=r.default("music-metadata:parser:ID3");class at extends P{constructor(){super(...arguments);this.id3parser=new Qe}static async startsWithID3v2Header(e){return(await e.peekToken($t)).fileIdentifier==="ID3"}async parse(){try{await this.parseID3v2()}catch(e){if(e instanceof B)t("End-of-stream");else throw e}}finalize(){return}async parseID3v2(){if(await this.tryReadId3v2Headers(),t("End of ID3v2 header, go to MPEG-parser: pos=%s",this.tokenizer.position),await this.postId3v2Parse(),this.options.skipPostHeaders&&this.metadata.hasAny())this.finalize();else await new Lr(this.metadata,this.tokenizer,this.options).parse(),this.finalize()}async tryReadId3v2Headers(){if((await this.tokenizer.peekToken($t)).fileIdentifier==="ID3")return t("Found ID3v2 header, pos=%s",this.tokenizer.position),await this.id3parser.parse(this.metadata,this.tokenizer,this.options),this.tryReadId3v2Headers()}}
|
|
3
|
+
export{at};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=7EFD2291D138D6E864756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-psk6q25h.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { EndOfStreamError } from 'strtok3';\nimport initDebug from 'debug';\nimport { ID3v2Header } from './ID3v2Token.js';\nimport { ID3v2Parser } from './ID3v2Parser.js';\nimport { ID3v1Parser } from '../id3v1/ID3v1Parser.js';\nimport { BasicParser } from '../common/BasicParser.js';\nconst debug = initDebug('music-metadata:parser:ID3');\n/**\n * Abstract parser which tries take ID3v2 and ID3v1 headers.\n */\nexport class AbstractID3Parser extends BasicParser {\n constructor() {\n super(...arguments);\n this.id3parser = new ID3v2Parser();\n }\n static async startsWithID3v2Header(tokenizer) {\n return (await tokenizer.peekToken(ID3v2Header)).fileIdentifier === 'ID3';\n }\n async parse() {\n try {\n await this.parseID3v2();\n }\n catch (err) {\n if (err instanceof EndOfStreamError) {\n debug(\"End-of-stream\");\n }\n else {\n throw err;\n }\n }\n }\n finalize() {\n return;\n }\n async parseID3v2() {\n await this.tryReadId3v2Headers();\n debug('End of ID3v2 header, go to MPEG-parser: pos=%s', this.tokenizer.position);\n await this.postId3v2Parse();\n if (this.options.skipPostHeaders && this.metadata.hasAny()) {\n this.finalize();\n }\n else {\n const id3v1parser = new ID3v1Parser(this.metadata, this.tokenizer, this.options);\n await id3v1parser.parse();\n this.finalize();\n }\n }\n async tryReadId3v2Headers() {\n const id3Header = await this.tokenizer.peekToken(ID3v2Header);\n if (id3Header.fileIdentifier === 'ID3') {\n debug('Found ID3v2 header, pos=%s', this.tokenizer.position);\n await this.id3parser.parse(this.metadata, this.tokenizer, this.options);\n return this.tryReadId3v2Headers();\n }\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";oHACA,eAKA,IAAM,EAAQ,UAAU,2BAA2B,EAI5C,MAAM,WAA0B,CAAY,CAC/C,WAAW,EAAG,CACV,MAAM,GAAG,SAAS,EAClB,KAAK,UAAY,IAAI,gBAEZ,qBAAqB,CAAC,EAAW,CAC1C,OAAQ,MAAM,EAAU,UAAU,EAAW,GAAG,iBAAmB,YAEjE,KAAK,EAAG,CACV,GAAI,CACA,MAAM,KAAK,WAAW,EAE1B,MAAO,EAAK,CACR,GAAI,aAAe,EACf,EAAM,eAAe,EAEzB,KACI,MAAM,GAIlB,QAAQ,EAAG,CACP,aAEE,UAAU,EAAG,CAIf,GAHA,MAAM,KAAK,oBAAoB,EAC/B,EAAM,iDAAkD,KAAK,UAAU,QAAQ,EAC/E,MAAM,KAAK,eAAe,EACtB,KAAK,QAAQ,iBAAmB,KAAK,SAAS,OAAO,EACrD,KAAK,SAAS,EAElB,KAEI,MADoB,IAAI,GAAY,KAAK,SAAU,KAAK,UAAW,KAAK,OAAO,EAC7D,MAAM,EACxB,KAAK,SAAS,QAGhB,mBAAmB,EAAG,CAExB,IADkB,MAAM,KAAK,UAAU,UAAU,EAAW,GAC9C,iBAAmB,MAG7B,OAFA,EAAM,6BAA8B,KAAK,UAAU,QAAQ,EAC3D,MAAM,KAAK,UAAU,MAAM,KAAK,SAAU,KAAK,UAAW,KAAK,OAAO,EAC/D,KAAK,oBAAoB,EAG5C",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "7EFD2291D138D6E864756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
function
|
|
3
|
-
export{
|
|
2
|
+
function di(n){if(n<1000)return String(n);let r=n/1000;return r<10?`${r.toFixed(1)}k`:`${Math.round(r)}k`}function Ws(n,r,e){if(e)return"installed";let t=di(n);return r===0?t:`${t} · ${r} script${r===1?"":"s"}`}function Y(n,r){if(r<=0)return"";let e=n.replace(/\s+/g," ").trim();if(e.length<=r)return e;if(r===1)return"…";return`${e.slice(0,r-1)}…`}function No(n,r,e={}){let t=Math.max(18,Math.min(e.nameMax??34,r)),o=18,a=6;if(a+t+o>n)o=Math.max(6,n-a-t);if(a+t+o>n)t=Math.max(6,n-a-o);let m=n-(a+t+o+2);if(n<60||m<24)return{name:t,meta:o,description:0};return{name:t,meta:o,description:m}}function Mo(n,r){return{name:Y(n.name,r.name).padEnd(r.name),meta:Y(n.meta,r.meta).padEnd(r.meta),description:r.description===0?"":Y(n.description,r.description)}}function To(n,r){let e=Y(n,Math.max(0,r-8)),t=e.length+3;return`${e} ${"─".repeat(Math.max(0,Math.min(r,80)-t))}`}function zs(n,r,e){let t=n.length,o=(i)=>n[i]??1;if(n.reduce((i,c)=>i+c,0)<=e)return{from:0,to:t};let a=Math.min(Math.max(0,r),Math.max(0,t-1)),m=a,u=a+1,s=o(a),l=!0;for(;;){let i=u<t&&s+o(u)<=e,c=m>0&&s+o(m-1)<=e;if(!i&&!c)break;if(l&&i||!c)s+=o(u),u+=1;else m-=1,s+=o(m);l=!l}return{from:m,to:u}}function De(n,r,e){if(n<=e)return{from:0,to:n};let t=Math.floor(e/2),o=Math.min(Math.max(0,r-t),n-e);return{from:o,to:o+e}}
|
|
3
|
+
export{di,Ws,Y,No,Mo,To,zs,De};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=42AFA451BAC0D5B564756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-q8b1fc3k.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Laying a catalogue row out in a fixed number of columns. Pure, so the layout is testable as strings.\n *\n * ## Why this is not a component's problem\n *\n * The first version put the name, the size and the whole description in one `<Text>` and let Ink wrap.\n * Every row longer than the terminal became two or three lines, the checkbox column stopped lining up,\n * and a list of forty skills was unreadable. Wrapping is not a styling detail in a list — it destroys the\n * one property a list has, which is that a row is a row.\n *\n * So the width arithmetic lives here, in one place, as functions over numbers and strings: pad the name to\n * a column, pad the meta to a column, give the description whatever is left, and **truncate every field\n * before it can wrap**. `Text` also carries `wrap=\"truncate\"` as a backstop, but a backstop is not a\n * layout — the columns have to add up, or the description gets cut at a width nobody chose.\n */\n\n/** Terminal columns below which the description is dropped rather than shown as three characters. */\nconst NARROW = 60\n/** The name column, wide enough for `create-architectural-decision-record` to be recognisable. */\nconst NAME_MIN = 18\nconst NAME_MAX = 34\n/** `12.3k · 15 scripts` is the widest realistic meta string. */\nconst META = 18\n/** Checkbox plus pointer, both two characters. */\nconst GUTTER = 4\nconst GAP = 2\n\n/** `2284` → `2.3k`. A row is scanned, not audited, and five digits of precision cost a column. */\nexport function compactTokens(tokens: number): string {\n if (tokens < 1000) return String(tokens)\n const thousands = tokens / 1000\n return thousands < 10 ? `${thousands.toFixed(1)}k` : `${Math.round(thousands)}k`\n}\n\nexport function metaOf(tokens: number, scripts: number, installed: boolean): string {\n if (installed) return \"installed\"\n const size = compactTokens(tokens)\n return scripts === 0 ? size : `${size} · ${scripts} script${scripts === 1 ? \"\" : \"s\"}`\n}\n\n/** Cut to `width`, with an ellipsis when anything was lost. Never returns more than `width`. */\nexport function clip(text: string, width: number): string {\n if (width <= 0) return \"\"\n const flat = text.replace(/\\s+/g, \" \").trim()\n if (flat.length <= width) return flat\n if (width === 1) return \"…\"\n return `${flat.slice(0, width - 1)}…`\n}\n\nexport interface RowColumns {\n readonly name: number\n readonly meta: number\n readonly description: number\n}\n\n/**\n * How wide each column is at a given terminal width.\n *\n * The name column flexes with the longest name actually present rather than being fixed: a catalogue of\n * short names should not leave a third of the row empty, and one long name should not push the\n * description off the screen. Clamped at both ends for both reasons.\n */\nexport function columnsFor(\n width: number,\n longestName: number,\n options: { readonly nameMax?: number } = {},\n): RowColumns {\n // Overridden by the plain path, whose names carry a `source/` prefix and which has no cursor to keep\n // near them. Passing a wider name column *without* going through this function is what pushed every\n // piped row twelve characters over the width it was laid out for.\n let name = Math.max(NAME_MIN, Math.min(options.nameMax ?? NAME_MAX, longestName))\n let meta = META\n\n // The name and meta columns shrink before anything else does. Without this the *fixed* part of the row\n // could exceed the terminal on its own — at 40 columns with a 34-character name it came to 60, so every\n // row wrapped no matter what the description did, which is the bug this module exists to remove.\n const chrome = GUTTER + GAP\n if (chrome + name + meta > width) meta = Math.max(6, width - chrome - name)\n if (chrome + name + meta > width) name = Math.max(6, width - chrome - meta)\n\n const description = width - (chrome + name + meta + GAP)\n // Below the threshold the description is dropped entirely. Three characters of a sentence is worse than\n // none: it takes the same column and carries no information.\n if (width < NARROW || description < 24) return { name, meta, description: 0 }\n return { name, meta, description }\n}\n\n/**\n * One row, exactly `width` characters wide or less, in three aligned columns.\n *\n * Returned as one string rather than as fields, because alignment is the whole point and a caller that\n * assembled the parts could get the padding wrong. Colour is applied by the component *around* this — the\n * arithmetic must not know about escape codes, which do not occupy columns and would break every count.\n */\nexport function layoutRow(\n input: {\n readonly name: string\n readonly meta: string\n readonly description: string\n },\n columns: RowColumns,\n): { readonly name: string; readonly meta: string; readonly description: string } {\n return {\n name: clip(input.name, columns.name).padEnd(columns.name),\n meta: clip(input.meta, columns.meta).padEnd(columns.meta),\n description: columns.description === 0 ? \"\" : clip(input.description, columns.description),\n }\n}\n\n/** A heading, drawn as a rule so groups separate without costing a blank line each. */\nexport function headingRule(label: string, width: number): string {\n const text = clip(label, Math.max(0, width - 8))\n const filled = text.length + 3\n return `${text} ${\"─\".repeat(Math.max(0, Math.min(width, 80) - filled))}`\n}\n\n/**\n * Which slice of a longer list to show.\n *\n * Shared by the catalogue list and the input box, which want the same rule for the same reason: both\n * are taller than their allowance and both have a position that must stay visible. It lives here rather\n * than in either component because the second caller is what proved it was layout arithmetic and not a\n * detail of one screen.\n *\n * Originally: Keeps the cursor inside the window rather than paging, because a cursor that jumps a\n * whole viewport loses the reader's place.\n */\n/**\n * `viewport` for rows that are not all one line tall (QA K5).\n *\n * The settings editor draws a heading as a blank line and its label, and counting it as one row made the\n * frame taller than the terminal at 40 rows: the title, the first heading and the cursor scrolled off the\n * top at open. The window grows around `index`, a row below then a row above, until the next one would\n * pass `budget` lines, so the cursor is always inside it.\n */\nexport function viewportByHeight(\n heights: readonly number[],\n index: number,\n budget: number,\n): { readonly from: number; readonly to: number } {\n const total = heights.length\n const at = (i: number) => heights[i] ?? 1\n if (heights.reduce((sum, height) => sum + height, 0) <= budget) return { from: 0, to: total }\n const cursor = Math.min(Math.max(0, index), Math.max(0, total - 1))\n let from = cursor\n let to = cursor + 1\n let used = at(cursor)\n let downward = true\n for (;;) {\n const canDown = to < total && used + at(to) <= budget\n const canUp = from > 0 && used + at(from - 1) <= budget\n if (!canDown && !canUp) break\n if ((downward && canDown) || !canUp) {\n used += at(to)\n to += 1\n } else {\n from -= 1\n used += at(from)\n }\n downward = !downward\n }\n return { from, to }\n}\n\nexport function viewport(\n total: number,\n index: number,\n window: number,\n): { readonly from: number; readonly to: number } {\n if (total <= window) return { from: 0, to: total }\n const half = Math.floor(window / 2)\n const from = Math.min(Math.max(0, index - half), total - window)\n return { from, to: from + window }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AA4BO,SAAS,EAAa,CAAC,EAAwB,CAClD,GAAI,EAAS,KAAM,OAAO,OAAO,CAAM,EACvC,IAAM,EAAY,EAAS,KAC3B,OAAO,EAAY,GAAK,GAAG,EAAU,QAAQ,CAAC,KAAO,GAAG,KAAK,MAAM,CAAS,KAGzE,SAAS,EAAM,CAAC,EAAgB,EAAiB,EAA4B,CAChF,GAAI,EAAW,MAAO,YACtB,IAAM,EAAO,GAAc,CAAM,EACjC,OAAO,IAAY,EAAI,EAAO,GAAG,OAAU,WAAiB,IAAY,EAAI,GAAK,MAI9E,SAAS,CAAI,CAAC,EAAc,EAAuB,CACtD,GAAI,GAAS,EAAG,MAAO,GACvB,IAAM,EAAO,EAAK,QAAQ,OAAQ,GAAG,EAAE,KAAK,EAC5C,GAAI,EAAK,QAAU,EAAO,OAAO,EACjC,GAAI,IAAU,EAAG,MAA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KAAM,EAAG,GAAI,CAAM,EAC5F,IAAM,EAAS,KAAK,IAAI,KAAK,IAAI,EAAG,CAAK,EAAG,KAAK,IAAI,EAAG,EAAQ,CAAC,CAAC,EAC9D,EAAO,EACP,EAAK,EAAS,EACd,EAAO,EAAG,CAAM,EAChB,EAAW,GACf,OAAS,CACL,IAAM,EAAU,EAAK,GAAS,EAAO,EAAG,CAAE,GAAK,EACzC,EAAQ,EAAO,GAAK,EAAO,EAAG,EAAO,CAAC,GAAK,EACjD,GAAI,CAAC,GAAW,CAAC,EAAO,MACxB,GAAK,GAAY,GAAY,CAAC,EAC1B,GAAQ,EAAG,CAAE,EACb,GAAM,EACR,KACE,GAAQ,EACR,GAAQ,EAAG,CAAI,EAEnB,EAAW,CAAC,EAEhB,MAAO,CAAE,OAAM,IAAG,EAGf,SAAS,EAAQ,CACpB,EACA,EACA,EAC8C,CAC9C,GAAI,GAAS,EAAQ,MAAO,CAAE,KAAM,EAAG,GAAI,CAAM,EACjD,IAAM,EAAO,KAAK,MAAM,EAAS,CAAC,EAC5B,EAAO,KAAK,IAAI,KAAK,IAAI,EAAG,EAAQ,CAAI,EAAG,EAAQ,CAAM,EAC/D,MAAO,CAAE,OAAM,GAAI,EAAO,CAAO",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "42AFA451BAC0D5B564756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Y}from"./index-
|
|
2
|
+
import{Y}from"./index-q8b1fc3k.js";import{vo,Po,uA,dA,EA}from"./index-vw2hf4d8.js";var s=" · ",l=3;function Hs(n,e){let t=[{kind:"title",text:Y(n.title,e)}],r=n.agent===void 0?n.summary:[`${n.agent.name}${s}${n.agent.model}`,n.summary].filter((a)=>a!=="").join(s);if(r!=="")t.push({kind:"summary",text:Y(r,e)});let i=n.state??[];if(i.length>0)t.push({kind:"state",text:Y(i.map((a)=>a.label).join(s),e)});let o=n.warnings??[];for(let a of o.slice(0,l))t.push({kind:"warning",text:Y(`⚠ ${a}`,e)});if(o.length>l)t.push({kind:"warning",text:Y(`⚠ and ${o.length-l} more`,e)});return t}function Ks(n,e){let t=n.map((i)=>`${i.key} ${i.does}`),r="";for(let i of t){let o=r===""?i:`${r}${s}${i}`;if([...o].length>e)break;r=o}return r===""?Y(t[0]??"",e):r}function br(n,e){let t=[n.title];if(n.summary!=="")t.push(n.summary);if(n.agent!==void 0)t.push(n.agent.name,n.agent.model);let r=n.warnings??[];if(r.length>0)t.push(`⚠ ${r.length} note${r.length===1?"":"s"} at the top`);return Y(t.join(s),e)}var Ys={key:"q",does:"back"};function u(n,e){return n===void 0||n<=0?e:n}function ke(n,e){return Math.max(vo,Math.min(Po,u(n,e)))}function js(n,e){return Math.max(uA,Math.min(dA,u(n,e)-EA))}
|
|
3
3
|
export{Hs,Ks,br,Ys,ke,js};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
6
|
-
//# sourceMappingURL=index-
|
|
5
|
+
//# debugId=35146687C429934F64756E2164756E21
|
|
6
|
+
//# sourceMappingURL=index-qh82wtpa.js.map
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * What every screen has in common, as data: the header block and the footer's key hints.\n *\n * ## Why this is a module and not a component\n *\n * Three surfaces had a banner before this existed — chat, the wizard, the agent picker — and each\n * decided its own title, its own context lines and its own key hints, in JSX. So the *content* of a\n * header was only observable by mounting a renderer, and the one thing worth asserting about it is\n * exactly that content: whether the agent in scope is named, whether a session-wide warning is still\n * visible after the screen scrolls, whether the footer fits.\n *\n * Everything here is text in, text out. `Screen.tsx` is one consumer; a test asserting a header names\n * the right agent is another, and neither can drift from the other because there is one derivation.\n *\n * ## The rule the header exists to enforce\n *\n * CLAUDE.md: anything true for the whole session belongs where a person still sees it after\n * scrolling. On an inline surface that could be a line printed at the top; on the alternate screen\n * there *is* no scrolling past, so it has to be the header or nowhere. `warnings` is therefore part\n * of the header's shape rather than something each screen remembers to render.\n *\n * Colour is not decided here, for `render.ts`'s reason: this module has no idea whether it is being\n * read from a terminal or a log file, and that is `resolveMode`'s question.\n */\n\nimport {\n MAX_SCREEN_COLUMNS,\n MAX_SCREEN_ROWS,\n MIN_SCREEN_COLUMNS,\n MIN_SCREEN_ROWS,\n SCREEN_CHROME_ROWS,\n} from \"#lib/const\"\nimport { clip } from \"#lib/rows\"\n\n/**\n * A live fact about the runtime, shown as a word rather than a sentence.\n *\n * `tone` is a role, never a colour — the component maps it. A literal colour name here would put\n * appearance in a pure module and break the one-home rule `theme.ts` exists for.\n */\nexport interface StateChip {\n readonly label: string\n readonly tone: \"ok\" | \"warn\" | \"off\"\n}\n\nexport interface ScreenHeader {\n /** Product identity — `BRAND.name` and the version. The one line that is the same everywhere. */\n readonly title: string\n /** What this screen is, and the counts that make it worth looking at. */\n readonly summary: string\n /**\n * The agent this screen acts on, when it acts on one.\n *\n * Present so it is impossible to install a skill into, or stop, an agent you did not mean.\n * Absent — not blank — on the machine-level screens: `sources` is a registry shared by every\n * agent on the machine, and naming one there would be a lie about the scope of what you are\n * changing.\n */\n readonly agent?: { readonly name: string; readonly model: string }\n readonly state?: readonly StateChip[]\n /** True for the whole session, so it stays in the frame rather than scrolling away. */\n readonly warnings?: readonly string[]\n}\n\nexport interface KeyHint {\n /** As a reader sees it: `↑↓`, `enter`, `^C`, `⌥⏎`. */\n readonly key: string\n readonly does: string\n}\n\nconst SEPARATOR = \" · \"\n/** Warnings past this many are counted rather than listed — a header is not a log. */\nconst WARNINGS_SHOWN = 3\n\n/**\n * One rendered line, tagged with what it is.\n *\n * Tagged rather than returned as plain strings because the component styles each kind differently and\n * the alternative is worse in both directions: a flat list of strings forces the renderer to guess by\n * index (which broke the first time a header had no state row), and having the renderer rebuild the\n * summary from `header.agent` itself would be a second derivation of the one thing this module exists\n * to derive once. The kind travels with the text; appearance stays in `theme.ts`.\n */\nexport interface HeaderLine {\n readonly kind: \"title\" | \"summary\" | \"state\" | \"warning\"\n readonly text: string\n}\n\n/** The header, as tagged lines, each already clipped to the width. */\nexport function headerLines(header: ScreenHeader, width: number): readonly HeaderLine[] {\n const lines: HeaderLine[] = [{ kind: \"title\", text: clip(header.title, width) }]\n\n // The agent rides on the summary line rather than taking one of its own. It is the same fact —\n // \"what am I looking at, and whose\" — and a separate line for it pushes the body down on every\n // screen to say something the summary was already the place for.\n const scope =\n header.agent === undefined\n ? header.summary\n : [`${header.agent.name}${SEPARATOR}${header.agent.model}`, header.summary]\n .filter((part) => part !== \"\")\n .join(SEPARATOR)\n if (scope !== \"\") lines.push({ kind: \"summary\", text: clip(scope, width) })\n\n const chips = header.state ?? []\n if (chips.length > 0) {\n lines.push({\n kind: \"state\",\n text: clip(chips.map((chip) => chip.label).join(SEPARATOR), width),\n })\n }\n\n const warnings = header.warnings ?? []\n for (const warning of warnings.slice(0, WARNINGS_SHOWN)) {\n lines.push({ kind: \"warning\", text: clip(`⚠ ${warning}`, width) })\n }\n // Counted, not dropped. A header that silently showed three of five warnings would be the\n // trimmed-catalogue failure again: true of what is on screen, false of what is the case.\n if (warnings.length > WARNINGS_SHOWN) {\n lines.push({\n kind: \"warning\",\n text: clip(`⚠ and ${warnings.length - WARNINGS_SHOWN} more`, width),\n })\n }\n\n return lines\n}\n\n/**\n * The footer: what the keys do, on one line, clipped.\n *\n * One line and never two. A footer that wraps moves the body every time the hints change, and the\n * hints change per screen state — so a two-line footer means the list jumps as you use it. Hints are\n * dropped from the end when they do not fit, which is why the caller orders them by how likely\n * somebody is to need reminding: movement first, the destructive one last.\n */\nexport function hintLine(hints: readonly KeyHint[], width: number): string {\n const rendered = hints.map((hint) => `${hint.key} ${hint.does}`)\n // Longest prefix that fits. Built up rather than clipped down, so the line never ends in half a\n // hint — `enter inst…` reads as a different key than the one it is.\n let line = \"\"\n for (const hint of rendered) {\n const next = line === \"\" ? hint : `${line}${SEPARATOR}${hint}`\n if ([...next].length > width) break\n line = next\n }\n // Nothing fit: one clipped hint beats an empty footer, because a screen with no visible way out\n // is the worst thing a full-screen surface can be.\n return line === \"\" ? clip(rendered[0] ?? \"\", width) : line\n}\n\n/**\n * The whole header on one line, for a surface that cannot spare three.\n *\n * The chat is that surface. Its opening banner already says the version, the store, the session and every\n * load warning — and on the alternate screen that banner scrolls out of the window, taking the\n * session-wide facts with it. `headerLines`' three-to-six rows would fix that and cost a fifth of a short\n * terminal permanently, so this is the compromise the rule actually asks for: identity and scope always\n * visible, warnings reduced to a count that says where the detail is.\n *\n * A count rather than the text, deliberately. One warning wrapped over two lines is a header that changes\n * height, which is the one thing a fixed-height frame cannot have.\n */\nexport function titleLine(header: ScreenHeader, width: number): string {\n const parts = [header.title]\n // The summary was dropped here while `Screen` renders it on its own dim line, so a surface using the\n // one-line variant silently lost its label: the conversation switcher passed \"pick a conversation\"\n // and the settings editor \"settings\", and neither ever appeared. Empty adds nothing, which is what\n // the chat header passes.\n if (header.summary !== \"\") parts.push(header.summary)\n if (header.agent !== undefined) parts.push(header.agent.name, header.agent.model)\n const warnings = header.warnings ?? []\n if (warnings.length > 0) {\n parts.push(`\\u26a0 ${warnings.length} note${warnings.length === 1 ? \"\" : \"s\"} at the top`)\n }\n return clip(parts.join(SEPARATOR), width)\n}\n\n/** The hint every alternate-screen surface carries, so no screen invents its own word for leaving. */\nexport const QUIT_HINT: KeyHint = { key: \"q\", does: \"back\" }\n\n/**\n * Terminal columns and rows a screen may use, clamped.\n *\n * Here rather than beside the one command that first needed them. They were exported from `browse.ts`,\n * which is imported both statically (by the wizard) and dynamically (by the command) — and the bundler\n * emitted the export twice, producing a `Duplicate export of 'windowFor'` that every test passed straight\n * through because tests import source, not the bundle. Screen arithmetic belongs with the screen.\n */\n/**\n * Zero means unknown, not zero.\n *\n * A pty genuinely reports a width of 0 — recorded in `lib/const.ts` beside `FALLBACK_COLUMNS`, measured\n * under `script -q`, and handled correctly in `useTerminalSize` since it was written. It was *not* handled\n * here, so a caller passing the stream's own measurement clamped to the 40-column floor and laid its rows\n * out for half the terminal. Found in a real capture: the session picker's rows came out 43 characters wide\n * on an 80-column screen, uniformly — which reads as a design choice rather than as a bug.\n *\n * `?? fallback` alone does not cover it, because 0 is not nullish. The same trap, one operator away.\n */\nfunction known(measured: number | undefined, fallback: number): number {\n return measured === undefined || measured <= 0 ? fallback : measured\n}\n\nexport function screenColumns(columns: number | undefined, fallback: number): number {\n return Math.max(MIN_SCREEN_COLUMNS, Math.min(MAX_SCREEN_COLUMNS, known(columns, fallback)))\n}\n\nexport function screenRows(rows: number | undefined, fallback: number): number {\n return Math.max(\n MIN_SCREEN_ROWS,\n Math.min(MAX_SCREEN_ROWS, known(rows, fallback) - SCREEN_CHROME_ROWS),\n )\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";mFAsEA,IAAM,EAAY,MAEZ,EAAiB,EAiBhB,SAAS,EAAW,CAAC,EAAsB,EAAsC,CACpF,IAAM,EAAsB,CAAC,CAAE,KAAM,QAAS,KAAM,EAAK,EAAO,MAAO,CAAK,CAAE,CAAC,EAKzE,EACF,EAAO,QAAU,OACX,EAAO,QACP,CAAC,GAAG,EAAO,MAAM,OAAO,IAAY,EAAO,MAAM,QAAS,EAAO,OAAO,EACnE,OAAO,CAAC,IAAS,IAAS,EAAE,EAC5B,KAAK,CAAS,EAC7B,GAAI,IAAU,GAAI,EAAM,KAAK,CAAE,KAAM,UAAW,KAAM,EAAK,EAAO,CAAK,CAAE,CAAC,EAE1E,IAAM,EAAQ,EAAO,OAAS,CAAC,EAC/B,GAAI,EAAM,OAAS,EACf,EAAM,KAAK,CACP,KAAM,QACN,KAAM,EAAK,EAAM,IAAI,CAAC,IAAS,EAAK,KAAK,EAAE,KAAK,CAAS,EAAG,CAAK,CACrE,CAAC,EAGL,IAAM,EAAW,EAAO,UAAY,CAAC,EACrC,QAAW,KAAW,EAAS,MAAM,EAAG,CAAc,EAClD,EAAM,KAAK,CAAE,KAAM,UAAW,KAAM,EAAK,KAAK,IAAW,CAAK,CAAE,CAAC,EAI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