noskills 4.1.56 → 4.5.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/LICENSE +13 -0
- package/README.md +47 -10
- package/chunks/ajan-bridge-T5M4DPDT.js +1 -0
- package/chunks/anthropic-TS7EMQML.js +1 -0
- package/chunks/approve-HEW3VFYH.js +1 -0
- package/chunks/ask-AXHTCVD6.js +2 -0
- package/chunks/block-VN76CXZW.js +1 -0
- package/chunks/{browser-XLYVEO2J.js → browser-BGFD24RX.js} +1 -1
- package/chunks/bun-WZ7BVR7Y.js +1 -0
- package/chunks/cancel-7WRAST62.js +1 -0
- package/chunks/chunk-3ZJ3UGQL.js +48 -0
- package/chunks/chunk-4PF2MT7S.js +29 -0
- package/chunks/chunk-575Y3OEG.js +1 -0
- package/chunks/{chunk-DZTBXXB3.js → chunk-5DZHAHXW.js} +23 -23
- package/chunks/chunk-5PBNUBBY.js +3 -0
- package/chunks/{chunk-HNAHPI6V.js → chunk-5RLCKUIF.js} +1 -1
- package/chunks/chunk-6YSS6PEL.js +3 -0
- package/chunks/chunk-7GC46XEU.js +1 -0
- package/chunks/{chunk-LBPD4EIH.js → chunk-7PPUGTKL.js} +1 -1
- package/chunks/chunk-AUZWXMWA.js +27 -0
- package/chunks/chunk-CH6A3LES.js +91 -0
- package/chunks/{chunk-UG26APX2.js → chunk-CML74SNT.js} +1 -1
- package/chunks/chunk-CTTMQSHF.js +1 -0
- package/chunks/chunk-DBKXMYLF.js +4 -0
- package/chunks/chunk-DEHRWREM.js +1 -0
- package/chunks/chunk-EIGFDYGQ.js +1 -0
- package/chunks/chunk-EIMBEXUJ.js +1 -0
- package/chunks/chunk-EJYSOUEA.js +1 -0
- package/chunks/chunk-ENP4P2YH.js +0 -0
- package/chunks/{chunk-RJX4ZXQ4.js → chunk-EROZRDGT.js} +1 -1
- package/chunks/chunk-FE4MKOI4.js +1 -0
- package/chunks/chunk-GQTHILPL.js +5 -0
- package/chunks/chunk-HISXAZ4Y.js +1 -0
- package/chunks/chunk-I4Z2RF7L.js +31 -0
- package/chunks/chunk-IFE5SYGK.js +1 -0
- package/chunks/chunk-IGDFEGCH.js +2 -0
- package/chunks/chunk-JL3MAFYQ.js +1 -0
- package/chunks/chunk-JYVB6UAV.js +1 -0
- package/chunks/chunk-KJLEPI7T.js +1 -0
- package/chunks/chunk-KM64FL2X.js +1 -0
- package/chunks/chunk-KMLNG3EC.js +1 -0
- package/chunks/chunk-KRKOWSYW.js +148 -0
- package/chunks/chunk-KRRPOVQG.js +1 -0
- package/chunks/{chunk-CKETVOVQ.js → chunk-LJEWPIEI.js} +1 -1
- package/chunks/{chunk-VAP3TSYK.js → chunk-LN4NDYT6.js} +1 -1
- package/chunks/{chunk-Z3O5HAIO.js → chunk-NGCBWJML.js} +1 -1
- package/chunks/chunk-O4KKKYCH.js +1 -0
- package/chunks/chunk-OAWYVETM.js +1 -0
- package/chunks/chunk-PKEQKXZW.js +23 -0
- package/chunks/chunk-PRQ5CRIG.js +1 -0
- package/chunks/{chunk-SWYX6WYQ.js → chunk-PSX63TYP.js} +2 -2
- package/chunks/{chunk-5P46WSNG.js → chunk-Q4TI7EYT.js} +1 -1
- package/chunks/chunk-QKWJ72HI.js +3 -0
- package/chunks/chunk-RAQY37P6.js +1 -0
- package/chunks/{openai-QGEN33SU.js → chunk-S4MUTKHT.js} +3 -3
- package/chunks/chunk-SLO22P65.js +1 -0
- package/chunks/chunk-UE56BMAW.js +21 -0
- package/chunks/{chunk-O2NUECRA.js → chunk-VJRCTYGL.js} +1 -1
- package/chunks/chunk-VXU6XZ66.js +39 -0
- package/chunks/chunk-W4TQLLUK.js +7 -0
- package/chunks/{chunk-PKYW3S5P.js → chunk-XDRX4ZBJ.js} +1 -1
- package/chunks/{chunk-XNGHRJVK.js → chunk-Y5E7ZCCX.js} +1 -1
- package/chunks/chunk-Z7OYXH3J.js +1 -0
- package/chunks/claude-code-DIWRQKZA.js +1 -0
- package/chunks/cmd-46ZIHXLB.js +1 -0
- package/chunks/concern-QSENGU6C.js +1 -0
- package/chunks/{config-CZDLCSOC.js → config-S3UXTJN2.js} +1 -1
- package/chunks/decision-ledger-GY2W6VWL.js +1 -0
- package/chunks/delegate-WKXIER7E.js +1 -0
- package/chunks/deno-YM5PW6ZM.js +1 -0
- package/chunks/{diagrams-H7NLJF7W.js → diagrams-A7W2EBYV.js} +1 -1
- package/chunks/diagrams-CBCUA47B.js +1 -0
- package/chunks/{dist-UI3SRKS3.js → dist-3MH5UCQU.js} +3 -3
- package/chunks/done-WR3UFYJT.js +1 -0
- package/chunks/followup-5EGZEF5Q.js +1 -0
- package/chunks/free-KJQHRYZA.js +1 -0
- package/chunks/gemini-IWP24T63.js +1 -0
- package/chunks/init-437SU6XH.js +1 -0
- package/chunks/invoke-hook-LMCWNF65.js +13 -0
- package/chunks/kiro-THWCXS5L.js +1 -0
- package/chunks/{learn-KIZTV5OH.js → learn-ZTYKBZER.js} +1 -1
- package/chunks/ledger-FOOPJ2UO.js +1 -0
- package/chunks/list-HNGIOVBK.js +1 -0
- package/chunks/loader-command-3A5FK2RF.js +1 -0
- package/chunks/loader-reactor-YZM7HO4G.js +1 -0
- package/chunks/manager-2MOLEJ4Q.js +3 -0
- package/chunks/mod-6EZYRKWV.js +1 -0
- package/chunks/{mod-TYCXSLSH.js → mod-7VTKN6Q5.js} +1 -1
- package/chunks/mod-7X5TKHKC.js +1 -0
- package/chunks/mod-AJIRKRAH.js +1 -0
- package/chunks/mod-SFSUQWSB.js +8 -0
- package/chunks/mod-TGOMO3CJ.js +1 -0
- package/chunks/{multipart-parser-UVM6CEKF.js → multipart-parser-DKDFOZKD.js} +1 -1
- package/chunks/next-Y6FOPM4Z.js +15 -0
- package/chunks/node-AZK2C657.js +12 -0
- package/chunks/node-GQQ42DT2.js +68 -0
- package/chunks/node-J4GTOSL2.js +1 -0
- package/chunks/ollama-2KAMCXVL.js +1 -0
- package/chunks/openai-HHE35TAX.js +31 -0
- package/chunks/openai-YES2XJDU.js +1 -0
- package/chunks/opencode-S4M7WJTO.js +1 -0
- package/chunks/{pack-33LQ7SJT.js → pack-KUT53Z24.js} +4 -4
- package/chunks/plan-export-PG2BVRQZ.js +3 -0
- package/chunks/purge-JGNJNEET.js +4 -0
- package/chunks/reopen-RPDXN3CF.js +1 -0
- package/chunks/reset-RBCQO2RF.js +1 -0
- package/chunks/review-VMS5MYOV.js +1 -0
- package/chunks/{rule-XREVPB5P.js → rule-IB4VKSBC.js} +2 -2
- package/chunks/run-62PWXVII.js +3 -0
- package/chunks/sdk-FR7Z4YSC.js +1 -0
- package/chunks/{session-HBP5GGI2.js → session-Q43KMFL2.js} +1 -1
- package/chunks/spec-4RKLPOEM.js +1 -0
- package/chunks/{src-GLQPTDNR.js → src-HXQVVTGQ.js} +1 -1
- package/chunks/{status-P754FM5Y.js → status-OGLFEFF7.js} +1 -1
- package/chunks/sync-H35O5DN5.js +1 -0
- package/chunks/{unstable_chmod-RZ5DE3XZ.js → unstable_chmod-44MCKF3B.js} +1 -1
- package/chunks/validate-JX7UTAK5.js +1 -0
- package/chunks/vertexai-WF5CKMYI.js +1 -0
- package/chunks/watch-SOZDHLSC.js +8 -0
- package/chunks/web-3VGRM3W4.js +1 -0
- package/chunks/wontfix-RBOGLLWJ.js +1 -0
- package/chunks/workerd-I7MLRCLJ.js +1 -0
- package/noskills.js +1 -1
- package/package.json +2 -2
- package/chunks/anthropic-LDUWIUPL.js +0 -1
- package/chunks/approve-OIXULOYH.js +0 -1
- package/chunks/ask-VGI3BFZW.js +0 -2
- package/chunks/block-6L3XJKPC.js +0 -1
- package/chunks/bun-5VMFSLLY.js +0 -1
- package/chunks/cancel-6IH4L4BL.js +0 -1
- package/chunks/chunk-2GF5IUQD.js +0 -39
- package/chunks/chunk-2N4GTHXQ.js +0 -1
- package/chunks/chunk-5CNPFLE6.js +0 -1
- package/chunks/chunk-5MN3MWQN.js +0 -1
- package/chunks/chunk-65A35QPF.js +0 -1
- package/chunks/chunk-7UX6WIXX.js +0 -1
- package/chunks/chunk-AGPCY6XP.js +0 -1
- package/chunks/chunk-AGWPQX43.js +0 -31
- package/chunks/chunk-AP3YBNPX.js +0 -1
- package/chunks/chunk-BJ2X6GHW.js +0 -5
- package/chunks/chunk-D3IKJ7FF.js +0 -1
- package/chunks/chunk-EFG5UU32.js +0 -1
- package/chunks/chunk-H77MLIL5.js +0 -4
- package/chunks/chunk-JVCVWI3B.js +0 -3
- package/chunks/chunk-OLM5RTFK.js +0 -1
- package/chunks/chunk-OTRBRRIO.js +0 -1
- package/chunks/chunk-U5SHLIO4.js +0 -3
- package/chunks/chunk-UT6ZCLRA.js +0 -1
- package/chunks/chunk-XXBSEOQR.js +0 -148
- package/chunks/chunk-YSLRAWBK.js +0 -1
- package/chunks/chunk-YSSDQJTT.js +0 -91
- package/chunks/chunk-YTNM7A5Y.js +0 -3
- package/chunks/claude-code-BWCSAVK2.js +0 -1
- package/chunks/cmd-ZXO6KFK6.js +0 -1
- package/chunks/concern-RB444PUE.js +0 -1
- package/chunks/delegate-NEWTWM6L.js +0 -1
- package/chunks/deno-QOH6TCLQ.js +0 -1
- package/chunks/diagrams-I2QKL7WR.js +0 -1
- package/chunks/done-KCSWC5WY.js +0 -1
- package/chunks/followup-5IFWOU4E.js +0 -1
- package/chunks/free-R4ZTZ76O.js +0 -1
- package/chunks/gemini-YR5KT32S.js +0 -1
- package/chunks/init-JRL2FB64.js +0 -1
- package/chunks/invoke-hook-CYJM3RDY.js +0 -13
- package/chunks/kiro-RGYUKJAX.js +0 -3
- package/chunks/list-6EQP6VUL.js +0 -1
- package/chunks/manager-WDSQSVF6.js +0 -6
- package/chunks/mod-A77UWGGG.js +0 -1
- package/chunks/next-47KYGODA.js +0 -7
- package/chunks/node-3FTYLC7H.js +0 -67
- package/chunks/node-BPWE6I45.js +0 -1
- package/chunks/ollama-LTZ43OHQ.js +0 -3
- package/chunks/openai-Y74OQTVB.js +0 -23
- package/chunks/opencode-PZDL7VDP.js +0 -1
- package/chunks/purge-G22VY6CI.js +0 -4
- package/chunks/reopen-63HEEXO6.js +0 -1
- package/chunks/reset-UDDESCDH.js +0 -1
- package/chunks/review-BC5HZNOU.js +0 -1
- package/chunks/run-GI2ZJ7BS.js +0 -3
- package/chunks/sdk-6IMATOQ3.js +0 -40
- package/chunks/spec-CLMOWKHY.js +0 -1
- package/chunks/sync-LPYKBDG2.js +0 -1
- package/chunks/vertexai-RUXZ24C2.js +0 -1
- package/chunks/watch-MONZHLBZ.js +0 -8
- package/chunks/web-PEDL6264.js +0 -1
- package/chunks/wontfix-A6OZSA3P.js +0 -1
- package/chunks/workerd-IIQRIOBX.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as $,b as V,h as E,i as B,j as H,k as m,l as a,m as h,n as y,o as w}from"./chunk-AUZWXMWA.js";import"./chunk-KM64FL2X.js";import{a as Q}from"./chunk-EIMBEXUJ.js";import{a as ce,b as le}from"./chunk-KJLEPI7T.js";import{b as ie,e as oe,f as ae}from"./chunk-5DZHAHXW.js";import{d as re}from"./chunk-7PPUGTKL.js";import{N as ne}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{a as ee,c as te,d as se}from"./chunk-IFE5SYGK.js";import"./chunk-CTTMQSHF.js";import{a as Z}from"./chunk-Z7OYXH3J.js";import"./chunk-VXU6XZ66.js";import"./chunk-EJYSOUEA.js";import"./chunk-JYVB6UAV.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import{b as j}from"./chunk-O4KKKYCH.js";import{D as X,b as W,c as G,g as J,k as Y,n as q,o as O,p as z,r as K,t as U}from"./chunk-KRKOWSYW.js";import"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import"./chunk-CH6A3LES.js";import{a as _}from"./chunk-OAWYVETM.js";import{i as g}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var de=Q;var ve=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},Se=[{id:"claude-code",paths:["CLAUDE.md",".claude"]},{id:"cursor",paths:[".cursorrules",".cursor"]},{id:"kiro",paths:[".kiro"]},{id:"copilot",paths:[".github/copilot-instructions.md"]},{id:"windsurf",paths:[".windsurfrules"]},{id:"codex",paths:[".codex",".codex/config.toml"]},{id:"copilot-cli",paths:[".copilot",".github/hooks"]}],ue=async t=>{let e=[];for(let i of Se)for(let n of i.paths)if(await ve(`${t}/${n}`)){e.push(i.id);break}return e};var l=async t=>{try{return await g.fs.stat(t),!0}catch{return!1}},pe=async(t,e)=>{try{let i=await g.fs.readTextFile(t);return JSON.parse(i)[e]??null}catch{return null}},Pe=async t=>{let e=[];return(await l(`${t}/package.json`)||await l(`${t}/deno.json`))&&e.push("typescript"),await l(`${t}/go.mod`)&&e.push("go"),await l(`${t}/Cargo.toml`)&&e.push("rust"),(await l(`${t}/pyproject.toml`)||await l(`${t}/setup.py`))&&e.push("python"),e},Te=async t=>{let e=[],i=await pe(`${t}/package.json`,"dependencies");return i!==null&&("react"in i&&e.push("react"),"vue"in i&&e.push("vue"),"svelte"in i&&e.push("svelte"),"next"in i&&e.push("nextjs"),"express"in i&&e.push("express"),"hono"in i&&e.push("hono")),e},be=async t=>{let e=[];return await l(`${t}/.github/workflows`)&&e.push("github-actions"),await l(`${t}/.gitlab-ci.yml`)&&e.push("gitlab-ci"),await l(`${t}/Jenkinsfile`)&&e.push("jenkins"),await l(`${t}/.circleci`)&&e.push("circleci"),e},Ie=async t=>{if(await l(`${t}/deno.json`))return"deno";let e=await pe(`${t}/package.json`,"devDependencies");if(e!==null){if("vitest"in e)return"vitest";if("jest"in e)return"jest";if("playwright"in e)return"playwright"}return null},ge=async t=>{let[e,i,n,u]=await Promise.all([Pe(t),Te(t),be(t),Ie(t)]);return{languages:e,frameworks:i,ci:n,testRunner:u}};var me=(t,e)=>{let i=String(e.concernCount).padStart(2);m(t),a(t,"\u2714 noskills is ready"),m(t),a(t," Your project has:"),a(t,` \u2022 ${i} active concerns shaping every spec`),a(t," \u2022 Hooks enforcing quality gates"),e.toolCount>0&&a(t," \u2022 Rules synced to your coding tools"),m(t),a(t," To start your first spec:"),a(t," 1. Switch to PLAN MODE in your coding tool"),a(t," (Claude Code: Shift+Tab twice)"),a(t," 2. Describe what you want to build"),a(t," 3. noskills will guide you through discovery"),m(t),a(t,' Or just type: noskills spec new "your feature description"')};var Ke=async t=>{let e=g.process.cwd(),i=ce(t),n=V({target:i==="agent"?"non-interactive":"interactive"}),u=le(t),C=fe(u,"--concerns"),f=fe(u,"--tools"),p=u.includes("--non-interactive")||i==="agent",P=await X(e);B(n,"noskills init");let x=w(n,"Checking directories...");x.start(),await U(e),x.succeed("Config: .eser/");let A=w(n,"Scanning project...");A.start();let T=await ge(e);A.succeed("Project scanned");for(let s of T.languages)y.step(n,` ${s}`);for(let s of T.frameworks)y.step(n,` ${s}`);h(n);let L=w(n,"Detecting coding tools...");L.start();let R=await ue(e),v=Z(),N=v!==null&&!R.includes(v)?[v]:[],S=[...new Set([...N,...R])];L.succeed(`${S.length} coding tool(s) detected`);let d;if(f!==null){let s=["claude-code","cursor","kiro","copilot","windsurf","opencode","codex","copilot-cli"],o=f.filter(r=>s.includes(r));d=[...new Set([...N,...o])]}else if(P){let s=await O(e);d=s!==null?[...s.tools]:[...S]}else p?d=[...S]:(h(n),d=await je(n,S,v));h(n);let M=w(n,"Detecting AI providers...");M.start();let b=(await de()).filter(s=>s.available).map(s=>s.name);M.succeed(`${b.length} provider(s) detected`),h(n);let I=await j(),c;if(C!==null){let s=I.map(o=>o.id);c=C.filter(o=>s.includes(o)).sort((o,r)=>s.indexOf(o)-s.indexOf(r))}else if(P){let s=await O(e);c=s!==null?[...s.concerns]:[]}else if(p)c=[];else{let s=I.map(r=>({value:r.id,label:r.name,hint:r.description.slice(0,60)})),o=await E(n,{message:"What kind of project is this? (space to toggle, enter to confirm)",options:s});c=$(o)?[]:[...o]}c.length>0&&y.success(n,` Concerns: ${c.join(", ")}`),h(n);let he=I.filter(s=>c.includes(s.id));for(let s of he)await K(e,s);let F=await se();ee(F);let D={...G(c,d,b,T),command:F};if(await z(e,D),!P){let s=W();await Y(e,s)}if(d.length>0){let s=w(n,"Syncing tool files...");s.start();let o=await ae(e,d,D);s.succeed(`Synced ${o.length} tool(s)`);for(let r of o)y.step(n,` ${r}`)}if(H(n,`Done. ${d.length} tool(s), ${b.length} provider(s), ${c.length} concern(s).`),i==="agent"){let s=await J(e),r=(await j()).filter(ye=>c.includes(ye.id)),k=await ie(e),we=oe(D?.tools??[]),Ce=await ne(s,r,k,D,void 0,void 0,void 0,we);await re(Ce,"json")}else{let s=new Set(["DISCOVERY","DISCOVERY_REFINEMENT","SPEC_PROPOSAL","SPEC_APPROVED","EXECUTING","BLOCKED"]),o=[];try{o=await q(e)}catch{}o.some(k=>s.has(k.phase??""))?(m(n),a(n,`Start a spec with: ${te('spec new "..."')}`)):me(n,{concernCount:c.length,toolCount:d.length})}return _(void 0)},Ee=[{value:"claude-code",label:"Claude Code"},{value:"cursor",label:"Cursor"},{value:"kiro",label:"Kiro"},{value:"copilot",label:"GitHub Copilot"},{value:"windsurf",label:"Windsurf"},{value:"opencode",label:"OpenCode"},{value:"codex",label:"Codex CLI"},{value:"copilot-cli",label:"Copilot CLI"}],je=async(t,e,i)=>{let n=e.length===0?"No coding tools detected. Which tools do you use? (space to toggle)":"Any additional tools? (space to toggle, enter to skip)",u=new Set(e),C=await E(t,{message:n,options:Ee.map(p=>({...p,hint:p.value===i?"you're running inside it":u.has(p.value)?"detected":void 0,disabled:p.value===i})),initialValues:[...e],required:!1});if($(C))return[...e];let f=[...C];return i!==null&&!f.includes(i)&&f.unshift(i),f},fe=(t,e)=>{if(t===void 0)return null;for(let i of t)if(i.startsWith(`${e}=`))return i.slice(e.length+1).split(",").map(n=>n.trim()).filter(Boolean);return null};export{Ke as main};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{a as L,b as $,c as A,d as F}from"./chunk-DEHRWREM.js";import{a as q,b as B}from"./chunk-W4TQLLUK.js";import{a as Q}from"./chunk-NGCBWJML.js";import{a as V,b as W,d as K,e as J}from"./chunk-5DZHAHXW.js";import{N as Y,O as v}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{c as k}from"./chunk-IFE5SYGK.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import{f as G}from"./chunk-O4KKKYCH.js";import{D as M,f,g as C,h as N,o as O,s as x,w as _,x as U}from"./chunk-KRKOWSYW.js";import{a}from"./chunk-OAWYVETM.js";import{i}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var X=e=>new Set(e.toLowerCase().replace(/[^\p{L}\p{N}\s]/gu," ").split(/\s+/).filter(n=>n.length>2)),z=(e,n)=>{let s=X(e),t=X(n);if(s.size===0||t.size===0)return 0;let c=0;for(let r of s)t.has(r)&&c++;let o=s.size+t.size-c;return o===0?0:c/o};var I=async()=>{let e=i.process.stdin.getReader(),n=[];try{for(;;){let{done:o,value:r}=await e.read();if(o||r===void 0)break;n.push(r)}}finally{e.releaseLock()}let s=0,t=new Uint8Array(n.reduce((o,r)=>o+r.length,0));for(let o of n)t.set(o,s),s+=o.length;let c=new TextDecoder().decode(t);try{return JSON.parse(c)}catch{return{}}},b=async e=>{let n=new TextEncoder,s=i.process.stdout.getWriter();await s.write(n.encode(JSON.stringify(e))),s.releaseLock()},ye=async e=>{switch(e?.[0]){case"pre-tool-use":return await ne();case"stop":return await ie();case"post-file-write":return await oe();case"post-bash":return await re();case"session-start":return await ae();case"post-ask-user-question":return await le();default:return a(void 0)}},y=async e=>{await b({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`noskills: ${e}`}})},se=async e=>{await b({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow",additionalContext:e}})},H=(e,n)=>{if(n)return null;let s=F(e);if(!s.includes("git"))return null;let t=$(s);for(let c of t)if(!L(c))return"Git write operations are not allowed. Only read commands (log, diff, status, show, blame, branch, tag) are permitted. The user controls git, the agent controls files.";return A(s)?"Git write operations detected in subshell or pipe. Only read commands are permitted. The user controls git, the agent controls files.":null},ne=async()=>{let e=await I(),n=e.tool_name??"unknown",s=e.tool_input??{},t=e.cwd??i.env.get("NOSKILLS_PROJECT_ROOT")??i.process.cwd(),c=await O(t),o=i.env.get("NOSKILLS_SESSION")??null;if(o!==null){let l=await _(t,o);if(l!==null&&l.mode==="free"){if(n==="Bash"){let d=(s.command??"").trim(),u=c?.allowGit??!1;if(!u&&d.includes("git")){let w=H(d,u);if(w!==null)return await y(w),a(void 0)}}return a(void 0)}}let r={};if(o!==null){let l=await _(t,o);if(l!==null&&l.mode==="spec"&&l.phase!==null)r={phase:l.phase};else if(l!==null&&l.spec!==null)try{r=await N(t,l.spec)}catch{return a(void 0)}else return a(void 0)}else{let l=await U(t);if(l.length>0){let d={DISCOVERY:10,DISCOVERY_REFINEMENT:10,SPEC_PROPOSAL:10,SPEC_APPROVED:8,BLOCKED:8,EXECUTING:2,IDLE:0,COMPLETED:0},u="IDLE",w=0;for(let D of l){let S=D.phase??"IDLE",T=d[S]??0;T>w&&(w=T,u=S)}r={phase:u};let R=new TextEncoder,h=i.process.stderr.getWriter();await h.write(R.encode(`noskills: WARNING \u2014 ${l.length} session(s) active but NOSKILLS_SESSION not set. Using most restrictive phase (${u}). Set NOSKILLS_SESSION for correct per-instance enforcement.
|
|
2
|
+
`)),h.releaseLock()}else try{let d=await C(t),u=d;if(d.spec!==null&&d.spec!==void 0)try{u=await N(t,d.spec)}catch{}r=u}catch{return a(void 0)}}if(n==="Bash"){let l=(s.command??"").trim(),d=c?.allowGit??!1,u=H(l,d);return u!==null?(await y(u),a(void 0)):a(void 0)}let m=["Write","Edit","MultiEdit"];if(!m.includes(n))return a(void 0);let p=s.file_path??s.path??"";if(p.includes(".eser/")||p.includes(".claude/"))return a(void 0);let g=r.phase??"UNKNOWN";if(g==="UNKNOWN")return await y("Phase unknown \u2014 file edit blocked. Run `noskills status` to check state."),a(void 0);if(g==="EXECUTING"&&r.execution?.criteriaScope==="review-gate")return await y('Review gate active \u2014 file edits blocked. Evaluate concern dimensions against the existing implementation and submit findings via `noskills next --answer=\'{"completed":[...],"remaining":[]}\'`.'),a(void 0);if(g==="EXECUTING"||g==="IDLE"||g==="COMPLETED"){if(g==="EXECUTING"&&m.includes(n)){let l=`${t}/${f.progressesDir}/executor-warned.flag`;try{await i.fs.readTextFile(l)}catch{try{await i.fs.mkdir(`${t}/${f.progressesDir}`,{recursive:!0}),await i.fs.writeTextFile(l,new Date().toISOString());let d=new TextEncoder,u=i.process.stderr.getWriter();await u.write(d.encode(`noskills: REMINDER \u2014 You should be spawning a noskills-executor sub-agent for implementation work. If you're the main orchestrator agent, delegate to a sub-agent instead of editing directly. If you ARE a sub-agent, ignore this message and continue.
|
|
3
|
+
`)),u.releaseLock()}catch{}}}if(g==="EXECUTING"&&p.length>0)try{let l=[],d=await V(t),u=K(d,"EXECUTING",p);l.push(...u);let w=await Q(t,[p]);for(let E of w)l.push(`(${E.folder}/) ${E.rule}`);let h=r.classification??null,D=await x(t),S=await O(t),T=D.filter(E=>S!==null&&S.concerns.includes(E.id)),j=G(T,p,h);if(l.push(...j),l.length>0){let E=`[noskills] Rules for this file:
|
|
4
|
+
`+l.map(Z=>`- ${Z}`).join(`
|
|
5
|
+
`);return await se(E),a(void 0)}}catch{}return a(void 0)}let P={DISCOVERY:`You are in DISCOVERY \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${k("next")}\` to continue.
|
|
6
|
+
modeDirective: ${v("DISCOVERY")??""}`,DISCOVERY_REFINEMENT:`You are in DISCOVERY_REFINEMENT \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, complete discovery and get the spec approved first. Run \`${k('next --answer="approve"')}\` or revise answers.
|
|
7
|
+
modeDirective: ${v("DISCOVERY_REFINEMENT")??""}`,SPEC_PROPOSAL:`You are in SPEC_PROPOSAL \u2014 this is a thinking phase, not an implementation phase. Read and discuss only. To write code, approve the spec first. Run \`${k("approve")}\`
|
|
8
|
+
modeDirective: ${v("SPEC_PROPOSAL")??""}`,SPEC_APPROVED:`You are in SPEC_APPROVED \u2014 start execution first: \`${k('next --answer="start"')}\``,BLOCKED:`Execution blocked. Resolve with \`${k('next --answer="resolution"')}\`
|
|
9
|
+
modeDirective: ${v("BLOCKED")??""}`};return await y(P[g]??`Run \`${k("next")}\` first.`),a(void 0)},ie=async()=>{let e=await I();if(e.stop_hook_active===!0)return a(void 0);let n=e.cwd??i.env.get("NOSKILLS_PROJECT_ROOT")??i.process.cwd(),s;try{let o=await i.fs.readTextFile(`${n}/${f.stateFile}`);s=JSON.parse(o)}catch{return a(void 0)}if(s.phase!=="EXECUTING")return a(void 0);if(q(s.execution))return a(void 0);let t=await B(n);if(t===null)return a(void 0);try{await i.fs.remove(`${n}/${f.progressesDir}/executor-warned.flag`)}catch{}let c=15;try{let o=await O(n);o!==null&&(c=o.maxIterationsBeforeRestart)}catch{}if(t.iteration>=c){let o=new TextEncoder,r=i.process.stderr.getWriter();await r.write(o.encode(`noskills: iteration ${t.iteration} reached threshold (${c}). Consider starting a fresh conversation.
|
|
10
|
+
`)),r.releaseLock()}return a(void 0)},oe=async()=>{let e=await I(),n=e.tool_input??{},s=n.file_path??n.path??"";if(!s||s.includes(".eser/")||s.includes(".claude/"))return a(void 0);let t=e.cwd??i.env.get("NOSKILLS_PROJECT_ROOT")??i.process.cwd(),c=`${t}/${f.progressesDir}/files-changed.jsonl`,o=JSON.stringify({file:s,tool:e.tool_name,ts:new Date().toISOString()});try{await i.fs.mkdir(`${t}/${f.progressesDir}`,{recursive:!0});let r="";try{r=await i.fs.readTextFile(c)}catch{}await i.fs.writeTextFile(c,r+o+`
|
|
11
|
+
`)}catch{}return a(void 0)},re=async()=>{let e=await I(),s=(e.tool_input??{}).command??"";if(!s.includes("noskills"))return a(void 0);let t=e.cwd??i.env.get("NOSKILLS_PROJECT_ROOT")??i.process.cwd(),c=`${t}/${f.progressesDir}/noskills-calls.jsonl`,o=JSON.stringify({command:s,ts:new Date().toISOString()});try{await i.fs.mkdir(`${t}/${f.progressesDir}`,{recursive:!0});let r="";try{r=await i.fs.readTextFile(c)}catch{}await i.fs.writeTextFile(c,r+o+`
|
|
12
|
+
`)}catch{}return a(void 0)},ae=async()=>{let e=i.env.get("NOSKILLS_PROJECT_ROOT")??i.process.cwd();if(!await M(e))return a(void 0);let n=await C(e),s=await O(e),c=(await x(e)).filter(p=>s!==null&&s.concerns.includes(p.id)),o=await W(e),r=J(s?.tools??[]),m=await Y(n,c,o,s,void 0,void 0,void 0,r);return await b(m),a(void 0)},ce=async(e,n)=>{if((e.tool_name??"")!=="AskUserQuestion")return;let t=e.tool_input??{},c="",o=t.questions;if(Array.isArray(o)&&o.length>0?c=o[0].question??"":typeof t.question=="string"&&(c=t.question),c.length===0)return;let r="unknown",m=null,p="";try{let u=await C(n);m=u.spec??null;let w=u.discovery??{},R=u.phase??"",h=w.currentQuestion??0;R==="DISCOVERY"?r=["status_quo","ambition","reversibility","user_impact","verification","scope_boundary"][h]??`Q${h+1}`:R==="DISCOVERY_REFINEMENT"?r="refinement":R==="SPEC_PROPOSAL"&&(r="approval")}catch{}let P=z(p,c)>=.7?"exact":"modified",d={token:crypto.randomUUID().slice(0,8),stepId:r,spec:m,match:P,originalQuestion:p,askedQuestion:c,createdAt:new Date().toISOString()};try{await i.fs.mkdir(`${n}/${f.progressesDir}`,{recursive:!0}),await i.fs.writeTextFile(`${n}/${f.askTokenFile}`,JSON.stringify(d)+`
|
|
13
|
+
`)}catch{}},le=async()=>{let e=await I(),n=e.cwd??i.env.get("NOSKILLS_PROJECT_ROOT")??i.process.cwd();return await ce(e,n),a(void 0)};export{ye as main,ce as processAskUserQuestionHook};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-QKWJ72HI.js";import"./chunk-CML74SNT.js";import"./chunk-JYVB6UAV.js";import"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{a as KiroModel,b as kiroFactory};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as R}from"./chunk-
|
|
1
|
+
import{f as R}from"./chunk-5DZHAHXW.js";import{a as D,b as x,c as C}from"./chunk-XDRX4ZBJ.js";import"./chunk-IFE5SYGK.js";import{c as P,d as a,f as o,g,o as b,q as I,r as T}from"./chunk-VXU6XZ66.js";import{E as S,f as k,i as E,o as L}from"./chunk-KRKOWSYW.js";import{a as u,b as w}from"./chunk-OAWYVETM.js";import{i as $}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var U=async(i,e,t)=>{let d=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,50),h=`---
|
|
2
2
|
phases: [EXECUTING]
|
|
3
3
|
source: learned from spec "${t}" on ${new Date().toISOString().slice(0,10)}
|
|
4
4
|
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k,d as m}from"./chunk-7PPUGTKL.js";import{b as n}from"./chunk-IFE5SYGK.js";import{d as u,f as p,o as c,q as f,r as g}from"./chunk-VXU6XZ66.js";import{d as y,e as w,f as h}from"./chunk-GQTHILPL.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as S,i as L}from"./chunk-KRKOWSYW.js";import{a as o,b as l}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var A=a=>{for(let t of a)if(t.startsWith("--format=")){let e=t.slice(9).toLowerCase();if(e==="measurement-draft"||e==="measurement"||e==="draft")return"measurement-draft"}return"ledger"},D=async a=>{let{root:t}=await S(),e=a??[],F=L(e),x=e.find(s=>!s.startsWith("-")),r=F??x??null,d=k(e);if(r===null||r.length===0){let s=c({renderer:g.ansi(),sink:f.stdout()});return s.writeln(p("Error: spec name is required.")),s.writeln(u(`Usage: ${n()} spec <name> ledger (or: ${n()} ledger <name>)`)),await s.close(),l({exitCode:1})}let i=await w(t,r);if(A(e)==="measurement-draft")return await m(y(r,i),d),o(void 0);let v=await h(t,r);return await m({spec:r,records:i,summary:v},d),o(void 0)};export{D as main};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as p}from"./chunk-EIMBEXUJ.js";import{c as t,d as a,g as l,m as n,o,q as m,r as d}from"./chunk-VXU6XZ66.js";import"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import{a as i}from"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var $=async b=>{let e=o({renderer:d.ansi(),sink:m.stdout()});e.writeln(t("AI Providers")),e.writeln("");let r=await p(),v=r.map(s=>[s.available?l("\u25CF"):a("\u25CB"),s.available?t(`${s.name} (${s.alias})`):a(`${s.name} (${s.alias})`),a(s.type),s.available?s.detail:a(s.detail)]);e.writeln(n(["","Provider","Type","Status"],v));let u=r.filter(s=>s.available).length;return e.writeln(a(`${u}/${r.length} providers available`)),await e.close(),i(void 0)};export{$ as main};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./chunk-SLO22P65.js";import"./chunk-HISXAZ4Y.js";var g={aiCreateModel:"EserAjanAiCreateModel",aiGenerateText:"EserAjanAiGenerateText",aiStreamText:"EserAjanAiStreamText",aiStreamRead:"EserAjanAiStreamRead",aiCancelRequest:"EserAjanAiCancelRequest",aiCloseModel:"EserAjanAiCloseModel",aiFreeStream:"EserAjanAiFreeStream",aiBatchCreate:"EserAjanAiBatchCreate",aiBatchGet:"EserAjanAiBatchGet",aiBatchList:"EserAjanAiBatchList",aiBatchDownload:"EserAjanAiBatchDownload",aiBatchCancel:"EserAjanAiBatchCancel",logCreate:"EserAjanLogCreate",logWrite:"EserAjanLogWrite",logClose:"EserAjanLogClose",logShouldLog:"EserAjanLogShouldLog",logConfigure:"EserAjanLogConfigure",httpCreate:"EserAjanHttpCreate",httpRequest:"EserAjanHttpRequest",httpClose:"EserAjanHttpClose",httpRequestStream:"EserAjanHttpRequestStream",httpStreamRead:"EserAjanHttpStreamRead",httpStreamClose:"EserAjanHttpStreamClose",cacheCreate:"EserAjanCacheCreate",cacheGetDir:"EserAjanCacheGetDir",cacheGetVersionedPath:"EserAjanCacheGetVersionedPath",cacheList:"EserAjanCacheList",cacheRemove:"EserAjanCacheRemove",cacheClear:"EserAjanCacheClear",cacheClose:"EserAjanCacheClose",postsCreateService:"EserAjanPostsCreateService",postsCompose:"EserAjanPostsCompose",postsGetTimeline:"EserAjanPostsGetTimeline",postsSearch:"EserAjanPostsSearch",postsClose:"EserAjanPostsClose",codebaseWalkFilesStreamCreate:"EserAjanCodebaseWalkFilesStreamCreate",codebaseWalkFilesStreamRead:"EserAjanCodebaseWalkFilesStreamRead",codebaseWalkFilesStreamClose:"EserAjanCodebaseWalkFilesStreamClose",codebaseValidateFilesStreamCreate:"EserAjanCodebaseValidateFilesStreamCreate",codebaseValidateFilesStreamRead:"EserAjanCodebaseValidateFilesStreamRead",codebaseValidateFilesStreamClose:"EserAjanCodebaseValidateFilesStreamClose",parsingTokenizeStreamCreate:"EserAjanParsingTokenizeStreamCreate",parsingTokenizeStreamPush:"EserAjanParsingTokenizeStreamPush",parsingTokenizeStreamClose:"EserAjanParsingTokenizeStreamClose",shellTuiKeypressCreate:"EserAjanShellTuiKeypressCreate",shellTuiKeypressRead:"EserAjanShellTuiKeypressRead",shellTuiKeypressClose:"EserAjanShellTuiKeypressClose",shellExecSpawn:"EserAjanShellExecSpawn",shellExecRead:"EserAjanShellExecRead",shellExecWrite:"EserAjanShellExecWrite",shellExecClose:"EserAjanShellExecClose",shellPtySpawn:"EserAjanShellPtySpawn",shellPtyRead:"EserAjanShellPtyRead",shellPtyWrite:"EserAjanShellPtyWrite",shellPtyResize:"EserAjanShellPtyResize",shellPtyKill:"EserAjanShellPtyKill",shellPtyClose:"EserAjanShellPtyClose"},C=i=>new Error(`${i} is unavailable through the eser-ajan WASM command-mode fallback: the WASM module is re-instantiated for every symbol call, so its handle registries start empty each time and handles cannot be carried across calls. Install the native library (the @eserstack/ajan platform package for this OS and architecture) or set ESER_AJAN_LIB_PATH to an existing build.`),j=async i=>{let c=(await import("node:fs")).readFileSync(i),A=await WebAssembly.compile(c),E=e=>{let a=JSON.stringify(e),n=new TextEncoder().encode(a),r=new l({stdin:n}),t=new WebAssembly.Instance(A,{wasi_snapshot_preview1:r.wasiImport});r.start(t);let o=r.getStdout().trim();return o.length===0?{ok:!1,error:"WASM module produced no output"}:JSON.parse(o)},s=(e,a)=>{let n=g[e];if(n!==void 0)throw C(n);let r={fn:e};a!==void 0&&(r.args=a);let t=E(r);if(!t.ok)throw new Error(`eser-ajan WASM call "${e}" failed: ${t.error??"unknown error"}`);return t.result??""};return{symbols:{EserAjanVersion:()=>s("version"),EserAjanInit:()=>(s("init"),0),EserAjanShutdown:()=>{s("shutdown")},EserAjanFree:e=>{},EserAjanConfigLoad:e=>s("configLoad",{optionsJSON:e}),EserAjanDIResolve:e=>s("diResolve",{name:e}),EserAjanAiCreateModel:e=>s("aiCreateModel",{configJSON:e}),EserAjanAiGenerateText:(e,a)=>s("aiGenerateText",{modelHandle:e,optionsJSON:a}),EserAjanAiStreamText:(e,a)=>s("aiStreamText",{modelHandle:e,optionsJSON:a}),EserAjanAiStreamRead:e=>s("aiStreamRead",{streamHandle:e}),EserAjanAiCancelRequest:e=>s("aiCancelRequest",{requestJSON:e}),EserAjanAiCloseModel:e=>s("aiCloseModel",{modelHandle:e}),EserAjanAiFreeStream:e=>s("aiFreeStream",{streamHandle:e}),EserAjanAiBatchCreate:e=>s("aiBatchCreate",{requestJSON:e}),EserAjanAiBatchGet:e=>s("aiBatchGet",{requestJSON:e}),EserAjanAiBatchList:e=>s("aiBatchList",{requestJSON:e}),EserAjanAiBatchDownload:e=>s("aiBatchDownload",{requestJSON:e}),EserAjanAiBatchCancel:e=>s("aiBatchCancel",{requestJSON:e}),EserAjanFormatEncode:e=>s("formatEncode",{requestJSON:e}),EserAjanFormatDecode:e=>s("formatDecode",{requestJSON:e}),EserAjanFormatList:()=>s("formatList"),EserAjanFormatEncodeDocument:e=>s("formatEncodeDocument",{requestJSON:e}),EserAjanLogCreate:e=>s("logCreate",{configJSON:e}),EserAjanLogWrite:e=>s("logWrite",{requestJSON:e}),EserAjanLogClose:e=>s("logClose",{handle:e}),EserAjanLogShouldLog:e=>s("logShouldLog",{requestJSON:e}),EserAjanLogConfigure:e=>s("logConfigure",{requestJSON:e}),EserAjanHttpCreate:e=>s("httpCreate",{configJSON:e}),EserAjanHttpRequest:e=>s("httpRequest",{requestJSON:e}),EserAjanHttpClose:e=>s("httpClose",{handle:e}),EserAjanHttpRequestStream:e=>s("httpRequestStream",{requestJSON:e}),EserAjanHttpStreamRead:e=>s("httpStreamRead",{handle:e}),EserAjanHttpStreamClose:e=>s("httpStreamClose",{handle:e}),EserAjanNoskillsInit:e=>s("noskillsInit",{requestJSON:e}),EserAjanNoskillsSpecNew:e=>s("noskillsSpecNew",{requestJSON:e}),EserAjanNoskillsNext:e=>s("noskillsNext",{requestJSON:e}),EserAjanWorkflowRun:e=>s("workflowRun",{requestJSON:e}),EserAjanCryptoHash:e=>s("cryptoHash",{requestJSON:e}),EserAjanCacheCreate:e=>s("cacheCreate",{requestJSON:e}),EserAjanCacheGetDir:e=>s("cacheGetDir",{requestJSON:e}),EserAjanCacheGetVersionedPath:e=>s("cacheGetVersionedPath",{requestJSON:e}),EserAjanCacheList:e=>s("cacheList",{requestJSON:e}),EserAjanCacheRemove:e=>s("cacheRemove",{requestJSON:e}),EserAjanCacheClear:e=>s("cacheClear",{requestJSON:e}),EserAjanCacheClose:e=>s("cacheClose",{requestJSON:e}),EserAjanCsGenerate:e=>s("csGenerate",{requestJSON:e}),EserAjanCsSync:e=>s("csSync",{requestJSON:e}),EserAjanKitListRecipes:e=>s("kitListRecipes",{requestJSON:e}),EserAjanKitApplyRecipe:e=>s("kitApplyRecipe",{requestJSON:e}),EserAjanKitCloneRecipe:e=>s("kitCloneRecipe",{requestJSON:e}),EserAjanKitNewProject:e=>s("kitNewProject",{requestJSON:e}),EserAjanKitUpdateRecipe:e=>s("kitUpdateRecipe",{requestJSON:e}),EserAjanPostsCreateService:e=>s("postsCreateService",{requestJSON:e}),EserAjanPostsCompose:e=>s("postsCompose",{requestJSON:e}),EserAjanPostsGetTimeline:e=>s("postsGetTimeline",{requestJSON:e}),EserAjanPostsSearch:e=>s("postsSearch",{requestJSON:e}),EserAjanPostsClose:e=>s("postsClose",{requestJSON:e}),EserAjanCodebaseGitCurrentBranch:e=>s("codebaseGitCurrentBranch",{requestJSON:e}),EserAjanCodebaseGitLatestTag:e=>s("codebaseGitLatestTag",{requestJSON:e}),EserAjanCodebaseGitLog:e=>s("codebaseGitLog",{requestJSON:e}),EserAjanCodebaseValidateCommitMsg:e=>s("codebaseValidateCommitMsg",{requestJSON:e}),EserAjanCodebaseGenerateChangelog:e=>s("codebaseGenerateChangelog",{requestJSON:e}),EserAjanCodebaseBumpVersion:e=>s("codebaseBumpVersion",{requestJSON:e}),EserAjanCodebaseWalkFiles:e=>s("codebaseWalkFiles",{requestJSON:e}),EserAjanCodebaseValidateFiles:e=>s("codebaseValidateFiles",{requestJSON:e}),EserAjanCodebaseCheckCircularDeps:e=>s("codebaseCheckCircularDeps",{requestJSON:e}),EserAjanCodebaseCheckExportNames:e=>s("codebaseCheckExportNames",{requestJSON:e}),EserAjanCodebaseCheckModExports:e=>s("codebaseCheckModExports",{requestJSON:e}),EserAjanCodebaseCheckPackageConfigs:e=>s("codebaseCheckPackageConfigs",{requestJSON:e}),EserAjanCodebaseCheckDocs:e=>s("codebaseCheckDocs",{requestJSON:e}),EserAjanCodebaseWalkFilesStreamCreate:e=>s("codebaseWalkFilesStreamCreate",{requestJSON:e}),EserAjanCodebaseWalkFilesStreamRead:e=>s("codebaseWalkFilesStreamRead",{handle:e}),EserAjanCodebaseWalkFilesStreamClose:e=>s("codebaseWalkFilesStreamClose",{handle:e}),EserAjanCodebaseValidateFilesStreamCreate:e=>s("codebaseValidateFilesStreamCreate",{requestJSON:e}),EserAjanCodebaseValidateFilesStreamRead:e=>s("codebaseValidateFilesStreamRead",{handle:e}),EserAjanCodebaseValidateFilesStreamClose:e=>s("codebaseValidateFilesStreamClose",{handle:e}),EserAjanCollectorSpecifierToIdentifier:e=>s("collectorSpecifierToIdentifier",{requestJSON:e}),EserAjanCollectorWalkFiles:e=>s("collectorWalkFiles",{requestJSON:e}),EserAjanCollectorGenerateManifest:e=>s("collectorGenerateManifest",{requestJSON:e}),EserAjanParsingTokenize:e=>s("parsingTokenize",{requestJSON:e}),EserAjanParsingSimpleTokens:()=>s("parsingSimpleTokens"),EserAjanParsingTokenizeStreamCreate:e=>s("parsingTokenizeStreamCreate",{requestJSON:e}),EserAjanParsingTokenizeStreamPush:e=>s("parsingTokenizeStreamPush",{requestJSON:e}),EserAjanParsingTokenizeStreamClose:e=>s("parsingTokenizeStreamClose",{requestJSON:e}),EserAjanShellExec:e=>s("shellExec",{requestJSON:e}),EserAjanShellTuiKeypressCreate:e=>s("shellTuiKeypressCreate",{requestJSON:e}),EserAjanShellTuiKeypressRead:e=>s("shellTuiKeypressRead",{handle:e}),EserAjanShellTuiKeypressClose:e=>s("shellTuiKeypressClose",{handle:e}),EserAjanShellTuiSetStdinRaw:e=>s("shellTuiSetStdinRaw",{requestJSON:e}),EserAjanShellTuiGetSize:e=>s("shellTuiGetSize",{requestJSON:e}),EserAjanShellExecSpawn:e=>s("shellExecSpawn",{requestJSON:e}),EserAjanShellExecRead:e=>s("shellExecRead",{handle:e}),EserAjanShellExecWrite:e=>s("shellExecWrite",{requestJSON:e}),EserAjanShellExecClose:e=>s("shellExecClose",{handle:e}),EserAjanShellPtySpawn:e=>s("shellPtySpawn",{requestJSON:e}),EserAjanShellPtyRead:e=>Promise.resolve().then(()=>s("shellPtyRead",{handle:e})),EserAjanShellPtyWrite:e=>s("shellPtyWrite",{requestJSON:e}),EserAjanShellPtyResize:e=>s("shellPtyResize",{requestJSON:e}),EserAjanShellPtyKill:e=>s("shellPtyKill",{requestJSON:e}),EserAjanShellPtyClose:e=>s("shellPtyClose",{handle:e})},close:()=>{}}};export{j as loadCommandWasm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-SLO22P65.js";import"./chunk-HISXAZ4Y.js";var F=async m=>{let l=(await import("node:fs")).readFileSync(m),d=await WebAssembly.compile(l),o=new i,n=new WebAssembly.Instance(d,{wasi_snapshot_preview1:o.wasiImport}),a=n.exports;o.initialize(n);let s=e=>{if(e<=0)return"";let r=a.eser_ajan_result_ptr();if(r===0)return"";let c=new Uint8Array(a.memory.buffer,r,e),t=new Uint8Array(e);return t.set(c),new TextDecoder().decode(t)};return{symbols:{EserAjanVersion:()=>{let e=a.eser_ajan_version();return s(e)},EserAjanInit:()=>a.eser_ajan_init(),EserAjanShutdown:()=>{a.eser_ajan_shutdown()},EserAjanFree:e=>{},EserAjanConfigLoad:e=>{let r=a.eser_ajan_config_load();return s(r)},EserAjanDIResolve:e=>{let r=a.eser_ajan_di_resolve();return s(r)},EserAjanFormatEncode:e=>'{"error":"Format calls require native FFI or command-mode WASM"}',EserAjanFormatDecode:e=>'{"error":"Format calls require native FFI or command-mode WASM"}',EserAjanFormatList:()=>'{"error":"Format calls require native FFI or command-mode WASM"}',EserAjanFormatEncodeDocument:e=>'{"error":"Format calls require native FFI or command-mode WASM"}',EserAjanLogCreate:e=>'{"error":"Log calls require native FFI or command-mode WASM"}',EserAjanLogWrite:e=>'{"error":"Log calls require native FFI or command-mode WASM"}',EserAjanLogClose:e=>'{"error":"Log calls require native FFI or command-mode WASM"}',EserAjanLogShouldLog:e=>'{"error":"Log calls require native FFI or command-mode WASM"}',EserAjanLogConfigure:e=>'{"error":"Log calls require native FFI or command-mode WASM"}',EserAjanAiCreateModel:e=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiGenerateText:(e,r)=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiStreamText:(e,r)=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiStreamRead:e=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiCancelRequest:e=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiCloseModel:e=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiFreeStream:e=>'{"error":"AI calls require native FFI or command-mode WASM"}',EserAjanAiBatchCreate:e=>'{"error":"AI batch calls require native FFI or command-mode WASM"}',EserAjanAiBatchGet:e=>'{"error":"AI batch calls require native FFI or command-mode WASM"}',EserAjanAiBatchList:e=>'{"error":"AI batch calls require native FFI or command-mode WASM"}',EserAjanAiBatchDownload:e=>'{"error":"AI batch calls require native FFI or command-mode WASM"}',EserAjanAiBatchCancel:e=>'{"error":"AI batch calls require native FFI or command-mode WASM"}',EserAjanHttpCreate:e=>'{"error":"HTTP calls require native FFI or command-mode WASM"}',EserAjanHttpRequest:e=>'{"error":"HTTP calls require native FFI or command-mode WASM"}',EserAjanHttpClose:e=>'{"error":"HTTP calls require native FFI or command-mode WASM"}',EserAjanHttpRequestStream:e=>'{"error":"HTTP stream calls require native FFI or command-mode WASM"}',EserAjanHttpStreamRead:e=>'{"error":"HTTP stream calls require native FFI or command-mode WASM"}',EserAjanHttpStreamClose:e=>'{"error":"HTTP stream calls require native FFI or command-mode WASM"}',EserAjanNoskillsInit:e=>'{"error":"Noskills calls require native FFI or command-mode WASM"}',EserAjanNoskillsSpecNew:e=>'{"error":"Noskills calls require native FFI or command-mode WASM"}',EserAjanNoskillsNext:e=>'{"error":"Noskills calls require native FFI or command-mode WASM"}',EserAjanWorkflowRun:e=>'{"error":"Workflow calls require native FFI or command-mode WASM"}',EserAjanCryptoHash:e=>'{"error":"Crypto calls require native FFI or command-mode WASM"}',EserAjanCacheCreate:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCacheGetDir:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCacheGetVersionedPath:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCacheList:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCacheRemove:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCacheClear:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCacheClose:e=>'{"error":"Cache calls require native FFI or command-mode WASM"}',EserAjanCsGenerate:e=>'{"error":"CS calls require native FFI or command-mode WASM"}',EserAjanCsSync:e=>'{"error":"CS calls require native FFI or command-mode WASM"}',EserAjanKitListRecipes:e=>'{"error":"Kit calls require native FFI or command-mode WASM"}',EserAjanKitApplyRecipe:e=>'{"error":"Kit calls require native FFI or command-mode WASM"}',EserAjanKitCloneRecipe:e=>'{"error":"Kit calls require native FFI or command-mode WASM"}',EserAjanKitNewProject:e=>'{"error":"Kit calls require native FFI or command-mode WASM"}',EserAjanKitUpdateRecipe:e=>'{"error":"Kit calls require native FFI or command-mode WASM"}',EserAjanPostsCreateService:e=>'{"error":"Posts calls require native FFI or command-mode WASM"}',EserAjanPostsCompose:e=>'{"error":"Posts calls require native FFI or command-mode WASM"}',EserAjanPostsGetTimeline:e=>'{"error":"Posts calls require native FFI or command-mode WASM"}',EserAjanPostsSearch:e=>'{"error":"Posts calls require native FFI or command-mode WASM"}',EserAjanPostsClose:e=>'{"error":"Posts calls require native FFI or command-mode WASM"}',EserAjanCodebaseGitCurrentBranch:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseGitLatestTag:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseGitLog:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseValidateCommitMsg:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseGenerateChangelog:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseBumpVersion:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseWalkFiles:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseValidateFiles:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseCheckCircularDeps:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseCheckExportNames:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseCheckModExports:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseCheckPackageConfigs:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseCheckDocs:e=>'{"error":"Codebase calls require native FFI or command-mode WASM"}',EserAjanCodebaseWalkFilesStreamCreate:e=>'{"error":"Codebase streaming requires native FFI or command-mode WASM"}',EserAjanCodebaseWalkFilesStreamRead:e=>'{"error":"Codebase streaming requires native FFI or command-mode WASM"}',EserAjanCodebaseWalkFilesStreamClose:e=>'{"error":"Codebase streaming requires native FFI or command-mode WASM"}',EserAjanCodebaseValidateFilesStreamCreate:e=>'{"error":"Codebase streaming requires native FFI or command-mode WASM"}',EserAjanCodebaseValidateFilesStreamRead:e=>'{"error":"Codebase streaming requires native FFI or command-mode WASM"}',EserAjanCodebaseValidateFilesStreamClose:e=>'{"error":"Codebase streaming requires native FFI or command-mode WASM"}',EserAjanCollectorSpecifierToIdentifier:e=>'{"error":"Collector calls require native FFI or command-mode WASM"}',EserAjanCollectorWalkFiles:e=>'{"error":"Collector calls require native FFI or command-mode WASM"}',EserAjanCollectorGenerateManifest:e=>'{"error":"Collector calls require native FFI or command-mode WASM"}',EserAjanParsingTokenize:e=>'{"error":"Parsing calls require native FFI or command-mode WASM"}',EserAjanParsingSimpleTokens:()=>'{"error":"Parsing calls require native FFI or command-mode WASM"}',EserAjanParsingTokenizeStreamCreate:e=>'{"error":"Parsing calls require native FFI or command-mode WASM"}',EserAjanParsingTokenizeStreamPush:e=>'{"error":"Parsing calls require native FFI or command-mode WASM"}',EserAjanParsingTokenizeStreamClose:e=>'{"error":"Parsing calls require native FFI or command-mode WASM"}',EserAjanShellExec:e=>'{"error":"Shell exec calls require native FFI or command-mode WASM"}',EserAjanShellTuiKeypressCreate:e=>'{"error":"Shell TUI calls require native FFI or command-mode WASM"}',EserAjanShellTuiKeypressRead:e=>'{"error":"Shell TUI calls require native FFI or command-mode WASM"}',EserAjanShellTuiKeypressClose:e=>'{"error":"Shell TUI calls require native FFI or command-mode WASM"}',EserAjanShellTuiSetStdinRaw:e=>'{"error":"Shell TUI calls require native FFI or command-mode WASM"}',EserAjanShellTuiGetSize:e=>'{"error":"Shell TUI calls require native FFI or command-mode WASM"}',EserAjanShellExecSpawn:e=>'{"error":"Shell exec spawn requires native FFI or command-mode WASM"}',EserAjanShellExecRead:e=>'{"error":"Shell exec spawn requires native FFI or command-mode WASM"}',EserAjanShellExecWrite:e=>'{"error":"Shell exec spawn requires native FFI or command-mode WASM"}',EserAjanShellExecClose:e=>'{"error":"Shell exec spawn requires native FFI or command-mode WASM"}',EserAjanShellPtySpawn:e=>'{"error":"Shell PTY requires native FFI or command-mode WASM"}',EserAjanShellPtyRead:e=>Promise.resolve('{"error":"Shell PTY requires native FFI or command-mode WASM"}'),EserAjanShellPtyWrite:e=>'{"error":"Shell PTY requires native FFI or command-mode WASM"}',EserAjanShellPtyResize:e=>'{"error":"Shell PTY requires native FFI or command-mode WASM"}',EserAjanShellPtyKill:e=>'{"error":"Shell PTY requires native FFI or command-mode WASM"}',EserAjanShellPtyClose:e=>'{"error":"Shell PTY requires native FFI or command-mode WASM"}'},close:()=>{}}};export{F as loadReactorWasm};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import"./chunk-DEHRWREM.js";import{b as ve,c as xe}from"./chunk-DBKXMYLF.js";import"./chunk-Q4TI7EYT.js";import{c as me,d as Ue,e as $e,p as C,q as f,r as $,s as fe,t as He,u as W,v as Ge}from"./chunk-AUZWXMWA.js";import{a as nt}from"./chunk-EROZRDGT.js";import"./chunk-LN4NDYT6.js";import{h as be}from"./chunk-5RLCKUIF.js";import"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{b as Se}from"./chunk-IFE5SYGK.js";import"./chunk-VXU6XZ66.js";import"./chunk-GQTHILPL.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{A as Ye,C as we,D as Je,E as Ze,f as We,g as qe,h as ye,l as je,n as Xe,o as Qe,v as ge,y as he}from"./chunk-KRKOWSYW.js";import{f as et,g as tt}from"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import{a as pe,b as _e}from"./chunk-OAWYVETM.js";import{i as U}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import{m as ue}from"./chunk-FE4MKOI4.js";import{d as j}from"./chunk-HISXAZ4Y.js";var Z={};j(Z,{createInitialState:()=>Ie,geometry:()=>Ae,reduce:()=>J,sanitizeRemoteAction:()=>Ce,sanitizeRemoteMessage:()=>Me,sanitizeRemoteTransport:()=>ct,tree:()=>Y});var Y={};j(Y,{collectLeaves:()=>z,firstLeaf:()=>K,hasLeaf:()=>D,leaf:()=>X,removeLeaf:()=>H,resizeFocused:()=>Q,splitLeaf:()=>q});var rt=e=>e<.1?.1:e>.9?.9:e,X=e=>({kind:"leaf",pane:e}),z=e=>e.kind==="leaf"?[e.pane]:[...z(e.first),...z(e.second)],D=(e,t)=>e.kind==="leaf"?e.pane===t:D(e.first,t)||D(e.second,t),K=e=>{let t=e;for(;t.kind==="branch";)t=t.first;return t.pane},q=(e,t,n,r,o=.5)=>e.kind==="leaf"?e.pane!==t?e:{kind:"branch",direction:n,first:e,second:X(r),ratio:rt(o)}:D(e.first,t)?{...e,first:q(e.first,t,n,r,o)}:D(e.second,t)?{...e,second:q(e.second,t,n,r,o)}:e,H=(e,t)=>{if(e.kind==="leaf")return e.pane===t?{root:null,promoted:null}:{root:e,promoted:null};if(e.first.kind==="leaf"&&e.first.pane===t)return{root:e.second,promoted:K(e.second)};if(e.second.kind==="leaf"&&e.second.pane===t)return{root:e.first,promoted:K(e.first)};if(D(e.first,t)){let n=H(e.first,t);return n.root===null?{root:e.second,promoted:K(e.second)}:{root:{...e,first:n.root},promoted:n.promoted}}if(D(e.second,t)){let n=H(e.second,t);return n.root===null?{root:e.first,promoted:K(e.first)}:{root:{...e,second:n.root},promoted:n.promoted}}return{root:e,promoted:null}},Q=(e,t,n,r)=>{if(e.kind==="leaf")return e;let o=D(e.first,t)?"first":D(e.second,t)?"second":null;if(o===null)return e;let i=e[o],s=Q(i,t,n,r);if(s!==i)return{...e,[o]:s};let c=n==="left"||n==="right"?"vertical":"horizontal";if(e.direction!==c)return e;let u=n==="right"||n==="down"?1:-1;return{...e,ratio:rt(e.ratio+u*r)}};var Ae={};j(Ae,{DEFAULT_CHROME:()=>L,computeTabGeoms:()=>B,decorationRegions:()=>Ee,effectiveChrome:()=>Te,neighborInDirection:()=>Re});var L={tabBarRows:1,statusBarRows:1},xt=10,Pt=3,Te=(e,t)=>{let n=t.leftCols??0,r=t.rightCols??0,o=t.topRows??0,i=t.bottomRows??0;e.cols-n-r<xt&&(n=0,r=0);let s=t.tabBarRows+t.statusBarRows+o+i;return e.rows-s<Pt&&(o=0,i=0),{...t,leftCols:n,rightCols:r,topRows:o,bottomRows:i}},Ee=(e,t)=>{let n=t.leftCols??0,r=t.rightCols??0,o=t.topRows??0,i=t.bottomRows??0,s=t.tabBarRows+1,c=Math.max(0,e.rows-t.tabBarRows-t.statusBarRows),u=n+1,w=Math.max(0,e.cols-n-r),l={};return n>0&&(l.left={x:1,y:s,width:n,height:c}),r>0&&(l.right={x:e.cols-r+1,y:s,width:r,height:c}),o>0&&(l.top={x:u,y:s,width:w,height:o}),i>0&&(l.bottom={x:u,y:e.rows-t.statusBarRows-i+1,width:w,height:i}),l},ot=100,Pe=e=>{if(e.kind==="leaf")return{id:e.pane,size:{type:"flex",grow:1}};let t=e.direction==="vertical"?"row":"column",n=Math.max(1,Math.round(e.ratio*ot)),r=Math.max(1,Math.round((1-e.ratio)*ot));return{direction:t,size:{type:"flex",grow:1},children:[{...Pe(e.first),size:{type:"flex",grow:n}},{...Pe(e.second),size:{type:"flex",grow:r}}]}},B=(e,t,n)=>{let r=n.leftCols??0,o=n.rightCols??0,i=n.topRows??0,s=n.bottomRows??0,c=r,u=n.tabBarRows+i,w=Math.max(0,t.cols-r-o),l=Math.max(0,t.rows-n.tabBarRows-n.statusBarRows-i-s),b=new Map;if(e.fullscreenPane!==void 0)return b.set(e.fullscreenPane,{x:c,y:u,width:w,height:l}),b;let T=He.computeLayout(Pe(e.root),w,l);for(let v of T)v.id!==void 0&&b.set(v.id,{x:v.x+c,y:v.y+u,width:v.width,height:v.height});return b},Re=(e,t,n)=>{let r=e.get(t);if(r===void 0)return null;let o=n==="left"||n==="right",i=r.x+r.width/2,s=r.y+r.height/2,c=null,u=1/0;for(let[w,l]of e){if(w===t||!(o?l.y<r.y+r.height&&l.y+l.height>r.y:l.x<r.x+r.width&&l.x+l.width>r.x))continue;let T=o?l.x+l.width/2:l.y+l.height/2,v=o?i:s;if(!(n==="left"||n==="up"?T<v:T>v))continue;let d=Math.abs(T-v);d<u&&(u=d,c=w)}return c};var Tt=.05,O=[{type:"render"}],Ie=e=>({panes:{},tabs:[],activeTab:0,mode:"normal",viewport:e,running:!0,nextPaneSeq:1,nextTabSeq:1}),R=e=>({state:e,effects:[]}),F=e=>e.tabs[e.activeTab],V=(e,t)=>({...e,tabs:e.tabs.map((n,r)=>r===e.activeTab?t:n)}),it=(e,t)=>{let n=`pane-${e.nextPaneSeq}`,r={id:n,kind:t.kind??"terminal",title:t.title??t.command??"shell",cwd:t.cwd,command:t.command,args:t.args,meta:t.meta};return{pane:r,state:{...e,panes:{...e.panes,[n]:r},nextPaneSeq:e.nextPaneSeq+1}}},at=(e,t)=>{let n=e.tabs[t];if(n===void 0)return R(e);let r=z(n.root),o=r.map(u=>({type:"killPty",pane:u})),i={...e.panes};for(let u of r)delete i[u];let s=e.tabs.filter((u,w)=>w!==t);if(s.length===0)return{state:{...e,panes:i,tabs:s,running:!1},effects:[...o,{type:"exit"}]};let c=t<e.activeTab?e.activeTab-1:Math.min(e.activeTab,s.length-1);return{state:{...e,panes:i,tabs:s,activeTab:c},effects:[...o,{type:"render"}]}},Et=e=>at(e,e.activeTab),st=(e,t,n)=>{let r=F(e);if(r===void 0)return R(e);let{pane:o,state:i}=it(e,n),s=q(r.root,r.focusedPane,t,o.id),c={...r,root:s,focusedPane:o.id,fullscreenPane:void 0};return{state:V(i,c),effects:[{type:"spawnPty",pane:o.id},{type:"render"}]}},J=(e,t)=>{switch(t.type){case"switchMode":return{state:{...e,mode:t.mode},effects:O};case"splitPane":return st(e,t.direction,{});case"newPane":return st(e,t.direction??"vertical",{kind:t.kind,command:t.command,args:t.args,cwd:t.cwd,title:t.title,meta:t.meta});case"closeFocusedPane":{let n=F(e);if(n===void 0)return R(e);let r=n.focusedPane,{root:o,promoted:i}=H(n.root,r);if(o===null)return Et(e);let s={...e.panes};delete s[r];let c={...n,root:o,focusedPane:i??K(o),fullscreenPane:void 0};return{state:V({...e,panes:s},c),effects:[{type:"killPty",pane:r},{type:"render"}]}}case"focusDirection":{let n=F(e);if(n===void 0)return R(e);let r=B(n,e.viewport,L),o=Re(r,n.focusedPane,t.direction);return o===null?R(e):{state:V(e,{...n,focusedPane:o}),effects:O}}case"focusNext":case"focusPrev":{let n=F(e);if(n===void 0)return R(e);let r=z(n.root);if(r.length<=1)return R(e);let o=r.indexOf(n.focusedPane),i=t.type==="focusNext"?1:-1,s=r[(o+i+r.length)%r.length];return{state:V(e,{...n,focusedPane:s}),effects:O}}case"focusPane":{let n=F(e);return n===void 0||!D(n.root,t.pane)?R(e):{state:V(e,{...n,focusedPane:t.pane}),effects:O}}case"toggleFullscreen":{let n=F(e);if(n===void 0)return R(e);let r=n.fullscreenPane===n.focusedPane?void 0:n.focusedPane;return{state:V(e,{...n,fullscreenPane:r}),effects:O}}case"resizePane":{let n=F(e);if(n===void 0)return R(e);let r=Q(n.root,n.focusedPane,t.direction,Tt);return r===n.root?R(e):{state:V(e,{...n,root:r}),effects:O}}case"newTab":{let n=`tab-${e.nextTabSeq}`,{pane:r,state:o}=it(e,{kind:t.kind,command:t.command,args:t.args,cwd:t.cwd,title:t.title,meta:t.meta}),i={id:n,name:t.title??`tab ${e.nextTabSeq}`,root:X(r.id),focusedPane:r.id},s=[...o.tabs,i];return{state:{...o,tabs:s,activeTab:s.length-1,nextTabSeq:o.nextTabSeq+1},effects:[{type:"spawnPty",pane:r.id},{type:"render"}]}}case"closeTab":return at(e,t.index??e.activeTab);case"gotoTab":return t.index<0||t.index>=e.tabs.length?R(e):{state:{...e,activeTab:t.index},effects:O};case"nextTab":case"prevTab":{if(e.tabs.length<=1)return R(e);let n=t.type==="nextTab"?1:-1,r=(e.activeTab+n+e.tabs.length)%e.tabs.length;return{state:{...e,activeTab:r},effects:O}}case"scroll":{let n=F(e);return n===void 0?R(e):{state:e,effects:[{type:"scrollPane",pane:n.focusedPane,action:t.action}]}}case"writeInput":{let n=F(e);return n===void 0?R(e):{state:e,effects:[{type:"writePty",pane:n.focusedPane,data:t.data}]}}case"writeToPane":return e.panes[t.pane]===void 0?R(e):{state:e,effects:[{type:"writePty",pane:t.pane,data:t.data}]};case"resizeViewport":return{state:{...e,viewport:{cols:t.cols,rows:t.rows}},effects:O};case"paneExited":{let n=e.tabs.findIndex(l=>D(l.root,t.pane));if(n<0)return R(e);let r=e.tabs[n],{root:o,promoted:i}=H(r.root,t.pane),s={...e.panes};if(delete s[t.pane],o===null){let l=e.tabs.filter((T,v)=>v!==n);if(l.length===0)return{state:{...e,panes:s,tabs:l,running:!1},effects:[{type:"exit"}]};let b=n<e.activeTab?e.activeTab-1:Math.min(e.activeTab,l.length-1);return{state:{...e,panes:s,tabs:l,activeTab:b},effects:O}}let c=r.focusedPane===t.pane?i??K(o):r.focusedPane,u=r.fullscreenPane===t.pane?void 0:r.fullscreenPane,w={...r,root:o,focusedPane:c,fullscreenPane:u};return{state:{...e,panes:s,tabs:e.tabs.map((l,b)=>b===n?w:l)},effects:O}}case"detach":return{state:e,effects:[{type:"detach"}]};case"quit":return{state:{...e,running:!1},effects:[{type:"exit"}]}}};var Ce=e=>{if(e.type!=="newTab"&&e.type!=="newPane"||e.command===void 0&&e.args===void 0&&e.cwd===void 0)return e;let t={...e.kind===void 0?{}:{kind:e.kind},...e.title===void 0?{}:{title:e.title},...e.meta===void 0?{}:{meta:e.meta}};return e.type==="newPane"?{type:"newPane",...e.direction===void 0?{}:{direction:e.direction},...t}:{type:"newTab",...t}},Me=e=>{if(e.t!=="action")return e;let t=Ce(e.action);return t===e.action?e:{...e,action:t}},ct=e=>({...e,onMessage:t=>{e.onMessage(n=>t(Me(n)))}});var re={};j(re,{buildKeymap:()=>te,defaultKeymap:()=>De,lookup:()=>ne,mergeOverrides:()=>lt,parseChord:()=>ee});var ee=e=>{let t=[];e.ctrl&&t.push("ctrl"),e.meta&&t.push("alt");let n=e.name.length===1;return e.shift&&!n&&t.push("shift"),t.push(n?e.name.toLowerCase():e.name),t.join("+")};var dt=e=>Array.isArray(e)?e:[e],te=e=>{let t=new Map;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let o=new Map;for(let i of Object.keys(r))o.set(i,dt(r[i]));t.set(n,o)}return t},ne=(e,t,n)=>e.get(t)?.get(n),lt=(e,t)=>{let n=new Map;for(let[r,o]of e)n.set(r,new Map(o));for(let r of Object.keys(t)){let o=t[r];if(o===void 0)continue;let i=n.get(r)??new Map;for(let s of Object.keys(o))i.set(s,dt(o[s]));n.set(r,i)}return n};var A={type:"switchMode",mode:"normal"},Rt={normal:{"ctrl+p":{type:"switchMode",mode:"pane"},"ctrl+t":{type:"switchMode",mode:"tab"},"ctrl+n":{type:"switchMode",mode:"resize"},"ctrl+s":{type:"switchMode",mode:"scroll"},"ctrl+g":{type:"switchMode",mode:"locked"},"ctrl+o":{type:"detach"},"ctrl+q":{type:"quit"}},pane:{n:[{type:"newPane"},A],v:[{type:"splitPane",direction:"vertical"},A],s:[{type:"splitPane",direction:"horizontal"},A],x:[{type:"closeFocusedPane"},A],f:[{type:"toggleFullscreen"},A],z:[{type:"toggleFullscreen"},A],left:{type:"focusDirection",direction:"left"},right:{type:"focusDirection",direction:"right"},up:{type:"focusDirection",direction:"up"},down:{type:"focusDirection",direction:"down"},h:{type:"focusDirection",direction:"left"},l:{type:"focusDirection",direction:"right"},k:{type:"focusDirection",direction:"up"},j:{type:"focusDirection",direction:"down"},enter:A,escape:A},tab:{n:[{type:"newTab"},A],x:[{type:"closeTab"},A],left:{type:"prevTab"},h:{type:"prevTab"},right:{type:"nextTab"},l:{type:"nextTab"},1:{type:"gotoTab",index:0},2:{type:"gotoTab",index:1},3:{type:"gotoTab",index:2},4:{type:"gotoTab",index:3},5:{type:"gotoTab",index:4},6:{type:"gotoTab",index:5},7:{type:"gotoTab",index:6},8:{type:"gotoTab",index:7},9:{type:"gotoTab",index:8},enter:A,escape:A},resize:{left:{type:"resizePane",direction:"left"},right:{type:"resizePane",direction:"right"},up:{type:"resizePane",direction:"up"},down:{type:"resizePane",direction:"down"},h:{type:"resizePane",direction:"left"},l:{type:"resizePane",direction:"right"},k:{type:"resizePane",direction:"up"},j:{type:"resizePane",direction:"down"},enter:A,escape:A},scroll:{up:{type:"scroll",action:"up"},down:{type:"scroll",action:"down"},k:{type:"scroll",action:"up"},j:{type:"scroll",action:"down"},pageup:{type:"scroll",action:"pageUp"},pagedown:{type:"scroll",action:"pageDown"},g:{type:"scroll",action:"home"},"shift+g":{type:"scroll",action:"end"},enter:A,escape:A},locked:{"ctrl+g":A}},De=te(Rt);var Oe=(e,t=L)=>{let n=e.tabs[e.activeTab];if(n===void 0)return{tabs:[],activeTab:0,mode:e.mode,viewport:e.viewport,focusedPane:null,panes:[],chrome:t};let r=B(n,e.viewport,t),o=z(n.root),i=[];for(let s of o){let c=r.get(s);if(c===void 0)continue;let u=e.panes[s];i.push({id:s,kind:u?.kind??"terminal",title:u?.title??s,geom:c,focused:s===n.focusedPane,exited:u?.exited??!1})}return{tabs:e.tabs.map(s=>({id:s.id,name:s.name})),activeTab:e.activeTab,mode:e.mode,viewport:e.viewport,focusedPane:n.focusedPane,panes:i,chrome:t}};var At=(e,t)=>e.tabBarRows===t.tabBarRows&&e.statusBarRows===t.statusBarRows&&(e.leftCols??0)===(t.leftCols??0)&&(e.rightCols??0)===(t.rightCols??0)&&(e.topRows??0)===(t.topRows??0)&&(e.bottomRows??0)===(t.bottomRows??0),It=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id||e[n].name!==t[n].name)return!1;return!0},Ct=(e,t)=>e.id===t.id&&e.kind===t.kind&&e.title===t.title&&e.focused===t.focused&&e.exited===t.exited&&e.geom.x===t.geom.x&&e.geom.y===t.geom.y&&e.geom.width===t.geom.width&&e.geom.height===t.geom.height,Mt=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Ct(e[n],t[n]))return!1;return!0},Dt=(e,t)=>e.cols===t.cols&&e.rows===t.rows,ke=(e,t)=>{if(e===null)return{mode:t.mode,activeTab:t.activeTab,focusedPane:t.focusedPane,viewport:t.viewport,tabs:t.tabs,panes:t.panes,chrome:t.chrome};let n={},r=!1;return e.mode!==t.mode&&(n.mode=t.mode,r=!0),e.activeTab!==t.activeTab&&(n.activeTab=t.activeTab,r=!0),e.focusedPane!==t.focusedPane&&(n.focusedPane=t.focusedPane,r=!0),Dt(e.viewport,t.viewport)||(n.viewport=t.viewport,r=!0),It(e.tabs,t.tabs)||(n.tabs=t.tabs,r=!0),Mt(e.panes,t.panes)||(n.panes=t.panes,r=!0),At(e.chrome,t.chrome)||(n.chrome=t.chrome,r=!0),r?n:null};var oe=()=>{let e=null,t=null,n=!1,r=!1;return[{send(s){r||t?.(s)},onMessage(s){e=s},close(){n=!0}},{send(s){n||e?.(s)},onMessage(s){t=s},close(){r=!0}}]};var Le=(e,t=16)=>{let n=!1,r=!1,o=null,i=()=>{n=!1,o=null;let c=r;r=!1,e(c)},s=()=>{n||(n=!0,o=setTimeout(i,t))};return{schedule:s,requestFull(){r=!0,s()},stop(){o!==null&&(clearTimeout(o),o=null),n=!1}}};var kt={normal:"ctrl+p pane \xB7 ctrl+t tab \xB7 ctrl+n resize \xB7 ctrl+s scroll \xB7 ctrl+q quit",pane:"PANE: n new \xB7 v|s split \xB7 x close \xB7 f full \xB7 hjkl focus \xB7 esc",tab:"TAB: n new \xB7 x close \xB7 h/l switch \xB7 1-9 goto \xB7 esc",resize:"RESIZE: hjkl/arrows \xB7 esc",scroll:"SCROLL: j/k \xB7 g/G \xB7 esc",locked:"LOCKED: ctrl+g to unlock"},Lt=(e,t)=>{let n=e.viewport.cols,r=t??` ${e.mode.toUpperCase()} ${kt[e.mode]}`,o=f.visibleLength(r),i=f.truncate(r,n)+" ".repeat(Math.max(0,n-o));return f.moveTo(e.viewport.rows,1)+f.inverse(i)},pt=(e,t,n)=>{let r=[];n.fullRedraw&&r.push(C.clearScreenSeq());let o=Ge.renderTabBar({tabs:e.tabs.map(s=>({id:s.id,label:s.name})),activeIndex:e.activeTab,maxWidth:e.viewport.cols});r.push(f.moveTo(1,1)+o);let i={row:e.viewport.rows,col:1,visible:!1};for(let s of e.panes){if(s.geom.width<2||s.geom.height<2)continue;let c={id:s.id,x:s.geom.x+1,y:s.geom.y+1,width:s.geom.width,height:s.geom.height};r.push($.drawBox({...c,title:s.title,borderStyle:s.focused?"double":"single",skipInterior:!0}));let u=t.getWidget(s.id);u!==void 0&&(r.push(u.render(c,n.fullRedraw)),s.focused&&(i={row:c.y+1+u.terminal.cursorRow,col:c.x+1+u.terminal.cursorCol,visible:!0}))}return r.push(Lt(e,n.statusText)),{data:r.join(""),cursor:i}};var Ft=new TextDecoder,ut=(e,t,n)=>{let r=ne(n,t,ee(e));return r!==void 0?r.map(o=>({t:"action",action:o})):t==="normal"||t==="locked"?[{t:"action",action:{type:"writeInput",data:Ft.decode(e.raw)}}]:[]},mt=(e,t)=>{if(t===null||e.type!=="mousedown")return[];for(let n of t.panes){let r=n.geom.x+1,o=n.geom.y+1;if(e.x>=r&&e.x<r+n.geom.width&&e.y>=o&&e.y<o+n.geom.height)return[{t:"action",action:{type:"focusPane",pane:n.id}}]}return[]};var Nt=new TextEncoder,se=e=>{let{transport:t,keymap:n}=e,r=new Map,o=null,i=!1,s=!1,c=null,u=null,w={cols:80,rows:24},l=h=>U.process.writeToStdout(Nt.encode(h)),b=h=>{let y=r.get(h);if(y!==void 0)return y;let a=o?.panes.find(x=>x.id===h),g=a?Math.max(1,a.geom.width-2):80,P=a?Math.max(1,a.geom.height-2):24,p=new fe(P,g);return r.set(h,p),p},T=()=>{if(o===null)return;let h=new Set;for(let y of o.panes){h.add(y.id);let a=Math.max(1,y.geom.width-2),g=Math.max(1,y.geom.height-2),P=r.get(y.id);P===void 0?r.set(y.id,new fe(g,a)):(P.terminal.rows!==g||P.terminal.cols!==a)&&P.resize(g,a)}for(let y of[...r.keys()])h.has(y)||r.delete(y)},m=Le(h=>{if(s||o===null)return;let y=pt(o,{getWidget:g=>r.get(g)},{fullRedraw:h,statusText:e.statusText}),a=C.hideCursorSeq()+y.data;e.decorate!==void 0&&(a+=e.decorate({regions:Ee(o.viewport,o.chrome),scene:o})),a+=f.moveTo(y.cursor.row,y.cursor.col)+(y.cursor.visible?C.showCursorSeq():""),l(a)}),d=h=>{switch(h.t){case"scene":{let y=o,a=h.delta;o={tabs:a.tabs??y?.tabs??[],activeTab:a.activeTab??y?.activeTab??0,mode:a.mode??y?.mode??"normal",viewport:a.viewport??y?.viewport??w,focusedPane:a.focusedPane!==void 0?a.focusedPane:y?.focusedPane??null,panes:a.panes??y?.panes??[],chrome:a.chrome??y?.chrome??L};let g=h.full||a.panes!==void 0||a.tabs!==void 0||a.viewport!==void 0||a.chrome!==void 0;g&&T(),g?m.requestFull():m.schedule();break}case"output":b(h.pane).write(h.data),m.schedule();break;case"exit":S();break}},E=()=>{u=setInterval(()=>{let h=C.getTerminalSize();(h.cols!==w.cols||h.rows!==w.rows)&&(w={cols:h.cols,rows:h.rows},t.send({t:"resize",viewport:w}))},e.sizePollMs??250)},S=()=>{i&&(i=!1,s=!0,c?.abort(),u!==null&&clearInterval(u),m.stop(),l(me.disableMouse()+C.showCursorSeq()+C.exitAlternateScreen()),t.close())};return{handle:d,run:async()=>{i=!0,t.onMessage(d),l(C.enterAlternateScreen()+C.hideCursorSeq()+C.clearScreenSeq()+me.enableMouse());let h=C.getTerminalSize();w={cols:h.cols,rows:h.rows},t.send({t:"attach",viewport:w}),E(),c=new AbortController,await Ue(async()=>{for await(let y of $e(U.process.stdin,c.signal)){if(!i)break;try{if(y.kind==="mouse"){if(e.onMouse?.(y.event,o)===!0)continue;for(let a of mt(y.event,o))t.send(a)}else{if(e.onKey?.(y.event,o)===!0)continue;for(let a of ut(y.event,o?.mode??"normal",n))t.send(a)}}catch{}}})},stop:S,refresh:()=>{s||m.schedule()}}};var Fe=e=>{let t=new Map,n=new Map;return{async spawn(r){if(t.has(r.pane))return;let o=await tt({command:r.command,args:[...r.args],cwd:r.cwd,env:r.env,cols:r.cols,rows:r.rows});t.set(r.pane,o),n.set(r.pane,`${r.cols}x${r.rows}`),o.onData(i=>e.onData(r.pane,i)),o.exitCode.then(i=>e.onExit(r.pane,i)).catch(()=>e.onExit(r.pane,-1))},write(r,o){t.get(r)?.write(o)},resize(r,o,i){let s=`${o}x${i}`;n.get(r)!==s&&(n.set(r,s),t.get(r)?.resize(o,i))},kill(r){let o=t.get(r);o!==void 0&&(o.kill(),t.delete(r),n.delete(r))},forget(r){t.delete(r),n.delete(r)},async killAll(){let r=[...t.values()];t.clear(),n.clear();for(let c of r)c.kill("SIGTERM");let o=r.map(c=>c.exitCode.catch(()=>-1)),i,s=await Promise.race([Promise.allSettled(o).then(()=>!1),new Promise(c=>{i=setTimeout(()=>c(!0),2e3)})]);if(i!==void 0&&clearTimeout(i),s)for(let c of r)c.kill("SIGKILL")},has(r){return t.has(r)}}};var zt={up:"\x1B[A\x1B[A\x1B[A",down:"\x1B[B\x1B[B\x1B[B",pageUp:"\x1B[5~",pageDown:"\x1B[6~",home:"\x1B[H",end:"\x1B[F"},ie=e=>{let t=e.chrome??L,n=e.initialState,r=e.exitOnEmpty??!0,o=()=>Te(n.viewport,t),i=null,s=null,c=!1,u=new Set,w=new Set,l=(e.createHost??Fe)({onData:(a,g)=>i?.send({t:"output",pane:a,data:g}),onExit:(a,g)=>{l.forget(a),S({type:"paneExited",pane:a,code:g}),e.onPaneExit?.(a)}}),b=()=>{let a=n.tabs[n.activeTab];return a===void 0?new Map:B(a,n.viewport,o())},T=a=>({cols:a?Math.max(1,a.width-2):Math.max(1,n.viewport.cols-2),rows:a?Math.max(1,a.height-2):Math.max(1,n.viewport.rows-2)}),v=async a=>{let g=n.panes[a];if(!(g===void 0||l.has(a)||u.has(a))){u.add(a);try{let P=b().get(a),{cols:p,rows:x}=T(P),I=e.resolveSpawn(g,P??{x:0,y:0,width:p,height:x});await l.spawn({pane:a,command:I.command,args:I.args,cwd:I.cwd,env:I.env,cols:p,rows:x})}finally{u.delete(a),w.delete(a)&&l.has(a)&&l.kill(a)}}},m=()=>{for(let[a,g]of b()){if(!l.has(a))continue;let{cols:P,rows:p}=T(g);l.resize(a,P,p)}},d=()=>{let a=Oe(n,o()),g=s===null,P=ke(s,a);s=a,P!==null&&i?.send({t:"scene",full:g,delta:P})},E=a=>{switch(a.type){case"spawnPty":v(a.pane).catch(g=>{let P=g instanceof Error?g.message:String(g);i?.send({t:"output",pane:a.pane,data:`\r
|
|
2
|
+
[mux] failed to start pane: ${P}\r
|
|
3
|
+
`})});break;case"writePty":l.write(a.pane,a.data);break;case"killPty":l.has(a.pane)?l.kill(a.pane):u.has(a.pane)&&w.add(a.pane);break;case"scrollPane":l.write(a.pane,zt[a.action]);break;case"render":break;case"detach":i?.send({t:"exit",code:0});break;case"exit":if(!r)break;i?.send({t:"exit",code:0}),y();break}},S=a=>{if(c)return;let g=J(n,a);n=g.state;for(let P of g.effects)E(P);m(),d()},k=a=>{switch(a.t){case"attach":n={...n,viewport:a.viewport},s=null,m(),d();break;case"action":S(a.action);break;case"resize":S({type:"resizeViewport",cols:a.viewport.cols,rows:a.viewport.rows});break}},h=null,y=()=>(h!==null||(c=!0,h=(async()=>{await l.killAll(),i?.close()})()),h);return{connect(a){let g=i;i=a,s=null,a.onMessage(k),g!==null&&g!==a&&g.close()},disconnect(a){i===a&&(i=null)},dispatch:S,setChrome(a){t=a,m(),d()},getState:()=>n,dispose:y}};var ft=async e=>{let t=ue()==="windows"?"where":"which";try{return await et`${t} ${e}`.noThrow().code()===0}catch{return!1}},yt=async e=>{for(let t of e)if(await ft(t))return t;return null},_=e=>{let t=null,n=async()=>(t!==null||(t=await yt(e.candidates)),t);return{id:e.id,displayName:e.displayName,capabilities:{supportsBracketedPaste:!0,...e.capabilities},resolveCommand:n,async buildSpawnSpec(r){let o=await n();return o===null?null:{command:o,args:[],env:{...r.baseEnv,...r.extraEnv},cwd:r.cwd}}}};var ae=_({id:"claude-code",displayName:"Claude Code",candidates:["claude","claude-code"]});var Ne=_({id:"opencode",displayName:"OpenCode",candidates:["opencode"]});var Ke=_({id:"codex",displayName:"Codex",candidates:["codex"]});var Vt=[ae,Ne,Ke];var ze=e=>Vt.find(t=>t.id===e),Be=()=>ae;var $t=["IDLE","DISCOVERY","REVIEW","DRAFT","APPROVED","EXECUTING","DONE","IDLE"],Ht=e=>{let n={DISCOVERY_REFINEMENT:"REVIEW",SPEC_PROPOSAL:"DRAFT",SPEC_APPROVED:"APPROVED",COMPLETED:"DONE",BLOCKED:"EXECUTING"}[e]??e;return $t.map(r=>r===n?`[ ${r} ]`:r).join(" \u2192 ")},gt=async(e,t)=>{let n;try{n=await je(e,t)}catch{n=await qe(e)}let r=await nt(e,t),o=new Set(n.execution.completedTasks??[]),i=(r?.tasks??[]).map(m=>({id:m.id,description:m.title,done:o.has(m.id),...m.files!==void 0&&m.files.length>0?{files:m.files}:{}})),s=[...new Set(n.discovery.answers.map(m=>"user"in m?m.user:null).filter(m=>m!==null&&m!=="Unknown User"))],c=(n.specNotes??[]).filter(m=>m.text.startsWith("[QUESTION] ")).map(m=>({id:m.id,text:m.text.replace("[QUESTION] ",""),user:m.user,ts:m.timestamp})),u=n.transitionHistory??[],w=u.length>0?u[0].timestamp:new Date().toISOString(),l=n.lastCalledAt??w,b=n.execution.confidenceFindings??[],T=b.length>0?Math.round(b.reduce((m,d)=>m+d.confidence,0)/b.length*10)/10:null,v=b.filter(m=>m.confidence<5).length;return{name:t,slug:t,phase:n.phase,description:n.specDescription??"",tasks:i,contributors:s,delegations:n.discovery.delegations??[],pendingQuestions:c,pendingSignoffs:[],roadmap:Ht(n.phase),createdAt:w,updatedAt:l,avgConfidence:T,lowConfidenceItems:v}},ce=async e=>{let t=await Xe(e),n=new Set(t.map(d=>d.name));try{let d=`${e}/${We.specsDir}`;for await(let E of(await import("./mod-7VTKN6Q5.js")).runtime.fs.readDir(d))E.isDirectory&&!n.has(E.name)&&n.add(E.name)}catch{}let r=[];for(let d of n)try{r.push(await gt(e,d))}catch{}r.sort((d,E)=>{let S=d.phase!=="COMPLETED"&&d.phase!=="IDLE",k=E.phase!=="COMPLETED"&&E.phase!=="IDLE";return S&&!k?-1:!S&&k?1:E.updatedAt.localeCompare(d.updatedAt)});let o=r.find(d=>d.phase!=="COMPLETED"&&d.phase!=="IDLE")??null,i=await ve(e,{limit:50}),s=i.filter(d=>d.type==="mention"),c=new Set(i.filter(d=>d.type==="mention-reply").map(d=>d.mentionId)),u=s.filter(d=>!c.has(d.id)).map(d=>({id:d.id??"",spec:d.spec,from:d.from??d.user,to:d.to??"",question:d.question??"",status:"pending",ts:d.ts})),l=i.filter(d=>d.type==="signoff").filter(d=>d.status==="pending").map(d=>({spec:d.spec,role:d.role??"",status:"pending",ts:d.ts})),b=await be(e),T=b!==void 0?{name:b.name,email:b.email}:null,m=(await Qe(e))?.roles??null;return{specs:r,activeSpec:o,pendingMentions:u,pendingSignoffs:l,recentEvents:i,currentUser:T,roles:m}};var qt=e=>e===null?"\u2014":{DISCOVERY:"DISC",DISCOVERY_REFINEMENT:"REVW",SPEC_PROPOSAL:"DRFT",SPEC_APPROVED:"APPR",EXECUTING:"EXEC",BLOCKED:"BLKD",COMPLETED:"DONE",IDLE:"IDLE"}[e]??e.slice(0,4),jt=e=>{switch(e){case"EXECUTING":return"green";case"DISCOVERY":case"DISCOVERY_REFINEMENT":return"cyan";case"BLOCKED":return"red";case"SPEC_PROPOSAL":case"SPEC_APPROVED":return"yellow";case"COMPLETED":return"dim";default:return"dim"}},Xt=(e,t)=>{switch(t){case"green":return f.green(e);case"yellow":return f.yellow(e);case"red":return f.red(e);case"cyan":return f.cyan(e);case"dim":return f.dim(e);default:return e}},Qt=(e,t)=>{let n=new Set(t.filter(o=>o.spec!==null).map(o=>o.spec)),r=e.map(o=>({label:o.name,badge:qt(o.phase),badgeColor:jt(o.phase),active:n.has(o.name),dimmed:o.phase==="COMPLETED"}));return r.length===0&&r.push({label:"No specs yet",dimmed:!0,selectable:!1}),r},ht=(e,t,n,r)=>{let o=Qt(e,t),i=$.drawBox({x:r.x,y:r.y,width:r.width,height:r.height,title:"Specs",borderStyle:"rounded"}),s=r.width-2,c=r.height-2,u=Math.max(0,Math.min(n,o.length-1)),w=W.ensureVisible(W.createScrollState(o.length,c),u),l=W.visibleRange(w),b=[];for(let m=0;m<c;m++){let d=l.start+m,E=r.y+1+m;if(d>=l.end||d>=o.length){b.push(f.moveTo(E,r.x+1)+" ".repeat(s));continue}let S=o[d];if(S===void 0){b.push(f.moveTo(E,r.x+1)+" ".repeat(s));continue}let k=S.selectable!==!1,h=d===n&&k,y=S.active?f.green("\u25CF"):h?"\u25B8":" ",a=S.badge!==void 0?" "+Xt(`[${S.badge}]`,S.badgeColor??"dim"):"",g=S.dimmed?f.dim(S.label):S.label,P=` ${y} ${g}${a}`,p=f.truncate(P,s),x=Math.max(0,s-f.visibleLength(p));h?b.push(f.moveTo(E,r.x+1)+f.inverse(p+" ".repeat(x))):b.push(f.moveTo(E,r.x+1)+p+" ".repeat(x))}let T={id:r.id,x:r.x,y:r.y+1,width:r.width-1,height:c},v=W.renderScrollbar(T,w);return i+b.join("")+v};var Jt=["IDLE","DISCOVERY","REVIEW","DRAFT","APPROVED","EXECUTING","DONE","IDLE"],Zt=e=>{if(e===null||e==="IDLE")return"IDLE";let n={DISCOVERY_REFINEMENT:"REVIEW",SPEC_PROPOSAL:"DRAFT",SPEC_APPROVED:"APPROVED",COMPLETED:"DONE"}[e]??e;return Jt.map(r=>r===n?f.bold(`\u2726${r}\u2726`):f.dim(r)).join("\u2192")},en=(e,t,n)=>{if(t===0)return f.dim("no tasks");let r=Math.round(e/t*n),o=n-r;return f.green("\u2588".repeat(r))+f.dim("\u2591".repeat(o))+` ${e}/${t}`},wt=(e,t,n)=>{let r=[];return e===null?(r.push(f.bold("Mode: ")+f.cyan("IDLE")),r.push(f.dim("No active spec"))):e.mode==="free"?(r.push(f.bold("Mode: ")+f.cyan("IDLE")),r.push(f.dim("No active spec")),r.push(""),r.push(f.dim(`Session: ${e.sessionId}`))):(r.push(f.bold("Spec: ")+(e.spec??"unknown")),r.push(f.bold("Phase: ")+(e.phase??"unknown")),r.push(""),r.push(Zt(e.phase)),r.push(""),n!==void 0&&r.push(f.bold("Progress: ")+en(n.completed,n.total,15)),r.push(""),r.push(f.dim(`Session: ${e.sessionId}`))),$.fillBox({x:t.x,y:t.y,width:t.width,height:t.height,title:"Monitor",borderStyle:"rounded"},r)};var de=()=>new Date().toISOString(),St=(e,t={})=>{let n=typeof e=="function"?e:()=>e;return r=>{let o=U.env.toObject(),i=n();return{command:r.command??o.SHELL??"/bin/sh",args:r.args??[],cwd:r.cwd??i,env:{...o,NOSKILLS_SESSION:r.meta?.sessionId??t.sessionId?.()??"",NOSKILLS_PROJECT_ROOT:i}}}},bt=async(e,t)=>{let n=we();return await ge(e,{id:n,spec:null,mode:"free",phase:null,pid:0,startedAt:de(),lastActiveAt:de(),tool:t}),{sessionId:n,spec:null,mode:"free",phase:null}},vt=async(e,t,n)=>{let r=null;try{r=(await ye(e,t)).phase}catch{}let o=we();return await ge(e,{id:o,spec:t,mode:"spec",phase:r,pid:0,startedAt:de(),lastActiveAt:de(),tool:n}),{sessionId:o,spec:t,mode:"spec",phase:r}};var rn=30,on=8,wo=async e=>{let t=e?.includes("--dry-run")??!1,{root:n}=await Ze();if(!await Je(n))return console.error("noskills is not initialized. Run:",Se(),"init"),_e({exitCode:1});let r=ze("claude-code")??Be(),o=(await ce(n)).specs.map(p=>({name:p.name,phase:p.phase,hasActiveSession:!1})),i=0,s=!1,c=new Map;if(t)return console.log(`noskills manager | ${o.length} spec(s) | ${Se()}`),pe(void 0);let u=!0,w=()=>({tabBarRows:1,statusBarRows:1,leftCols:u?rn:0,topRows:on}),l=St(n),{cols:b,rows:T}=C.getTerminalSize(),v=ie({initialState:Z.createInitialState({cols:b,rows:T}),resolveSpawn:l,chrome:w()}),m=async p=>{let x=await r.resolveCommand()??"claude";v.dispatch({type:"newTab",command:x,cwd:n,title:p.spec??"free",meta:{sessionId:p.sessionId}});let I=v.getState(),M=I.tabs[I.activeTab];M!==void 0&&c.set(M.id,{id:M.id,spec:p.spec,mode:p.mode,sessionId:p.sessionId,phase:p.phase})},d=async()=>{await m(await bt(n,r.id))},E=async p=>{for(let x of c.values())if(x.spec===p){let I=v.getState().tabs.findIndex(M=>M.id===x.id);if(I>=0){v.dispatch({type:"gotoTab",index:I});return}}await m(await vt(n,p,r.id))},S,k=p=>{let x=new Set(p.scene.tabs.map(N=>N.id));for(let N of[...c.keys()])if(!x.has(N)){let le=c.get(N);c.delete(N),he(n,le.sessionId).catch(()=>{})}let I=[...c.values()],M="";if(p.regions.left!==void 0&&(M+=ht(o,I,i,{id:"specs",...p.regions.left})),p.regions.top!==void 0){let N=p.scene.tabs[p.scene.activeTab]?.id,le=N!==void 0?c.get(N)??null:null;M+=wt(le,{id:"monitor",...p.regions.top})}return M},h=p=>{if(s)switch(p.name){case"up":return i=Math.max(0,i-1),S.refresh(),!0;case"down":return i=Math.min(Math.max(0,o.length-1),i+1),S.refresh(),!0;case"return":{let x=o[i];return s=!1,x!==void 0&&E(x.name).catch(()=>{}),S.refresh(),!0}case"x":return s=!1,v.dispatch({type:"closeFocusedPane"}),S.refresh(),!0;case"escape":case"tab":return s=!1,S.refresh(),!0;default:return!0}return p.ctrl&&p.name==="e"?(s=!0,S.refresh(),!0):p.ctrl&&p.name==="t"?(d().catch(()=>{}),!0):p.ctrl&&p.name==="w"?(u=!u,v.setChrome(w()),!0):p.ctrl&&/^[1-9]$/.test(p.name)?(v.dispatch({type:"gotoTab",index:Number(p.name)-1}),!0):!1},y=(p,x)=>{if(x===null)return!1;let I=x.chrome.leftCols??0;if(I>0&&p.x<=I&&p.type==="mousedown"){let M=p.y-3;return M>=0&&M<o.length&&(i=M,E(o[M].name).catch(()=>{}),S.refresh()),!0}return!1},[a,g]=oe();v.connect(a),S=se({transport:g,keymap:re.buildKeymap({normal:{"ctrl+q":{type:"quit"}}}),decorate:k,onKey:h,onMouse:y,statusText:" noskills | ctrl+e specs \xB7 ctrl+t new tab \xB7 ctrl+1-9 switch \xB7 ctrl+w hide \xB7 ctrl+q quit"});let P=xe(n,async()=>{try{o=(await ce(n)).specs.map(x=>({name:x.name,phase:x.phase,hasActiveSession:!1})),i>=o.length&&(i=Math.max(0,o.length-1)),S.refresh()}catch{}});await d();try{await S.run()}finally{P(),S.stop();for(let p of c.values())await he(n,p.sessionId).catch(()=>{});await v.dispose(),await Ye(n)}return pe(void 0)};export{wo as main};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as g,b as v}from"./chunk-EIGFDYGQ.js";import{a as G,b as O}from"./chunk-RAQY37P6.js";import{a as h,b as R}from"./chunk-5PBNUBBY.js";import{a as k,b as E}from"./chunk-JL3MAFYQ.js";import{a as L,b as S}from"./chunk-QKWJ72HI.js";import{a as w,b as A,c as M,d as C,e as T,f as B,g as I}from"./chunk-CML74SNT.js";import{a as b,b as j,c as _,d as D,e as J}from"./chunk-PRQ5CRIG.js";import{a as n,b as s}from"./chunk-7GC46XEU.js";import{a as d,b as l}from"./chunk-S4MUTKHT.js";import{a as x,b as P}from"./chunk-KMLNG3EC.js";import{a as m,b as y,c as p,d as F,e as f,f as u}from"./chunk-PSX63TYP.js";import"./chunk-EJYSOUEA.js";import"./chunk-JYVB6UAV.js";import"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var a=null,Y=()=>(a??=V(),a),i={anthropic:async()=>(await import("./anthropic-TS7EMQML.js")).anthropicFactory,openai:async()=>(await import("./openai-YES2XJDU.js")).openaiFactory,gemini:async()=>(await import("./gemini-IWP24T63.js")).geminiFactory,vertexai:async()=>(await import("./vertexai-WF5CKMYI.js")).vertexaiFactory,"claude-code":async()=>(await import("./claude-code-DIWRQKZA.js")).claudeCodeFactory,ollama:async()=>(await import("./ollama-2KAMCXVL.js")).ollamaFactory,opencode:async()=>(await import("./opencode-S4M7WJTO.js")).openCodeFactory,kiro:async()=>(await import("./kiro-THWCXS5L.js")).kiroFactory},t=null,c=()=>(t??=(async()=>{let{tryLoadBridgeFactories:o}=await import("./ajan-bridge-T5M4DPDT.js");return await o()})(),t),K=async o=>await i[o]?.(),q=async o=>{for(let e of await c())if(e.provider===o)return e;return await K(o)},V=async()=>{let o=await Promise.all(Object.values(i).map(r=>r())),e=new Map;for(let r of o)e.set(r.provider,r);for(let r of await c())e.set(r.provider,r);return[...e.values()]};export{b as AjanBridgeModel,j as AjanBridgeModelFactory,n as AnthropicModel,G as ClaudeCodeModel,x as GeminiModel,L as KiroModel,h as OllamaModel,d as OpenAIModel,k as OpenCodeModel,g as VertexAIModel,s as anthropicFactory,T as captureStderr,B as classifyExitCode,u as classifyGenAIError,O as claudeCodeFactory,_ as createBridgeFactories,Y as defaultFactories,q as factoryFor,I as formatMessagesAsText,P as geminiFactory,J as getBridgeLoadError,S as kiroFactory,y as mapContentBlockToGenAIPart,f as mapGenAIResponseToResult,p as mapMessagesToGenAI,m as mapRoleToGenAI,F as mapToolsToGenAI,R as ollamaFactory,E as openCodeFactory,l as openaiFactory,M as parseJsonlStream,C as parseTextOutput,w as resolveBinary,A as spawnCliProcess,D as tryLoadBridgeFactories,K as tsFactoryFor,v as vertexaiFactory};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,b as s,c as t,d as u,e as v,f as w,g as x,h as A,i as B}from"./chunk-
|
|
1
|
+
import{a as r,b as s,c as t,d as u,e as v,f as w,g as x,h as A,i as B}from"./chunk-Y5E7ZCCX.js";import{b as y,c as z}from"./chunk-LJEWPIEI.js";import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{c as AlreadyExistsError,b as NotFoundError,d as ProcessError,a as RuntimeCapabilityError,t as buildCommand,z as clearWorkerdEnv,A as createRuntime,x as detectExecutionContext,s as detectInvoker,g as detectRuntime,n as getArch,w as getCliPrefix,o as getHomedir,m as getPlatform,q as getPlatformInfo,h as getRuntimeVersion,p as getTmpdir,j as isBrowser,u as isCommandInPath,l as isEdge,i as isRuntime,k as isServer,v as matchCliPrefix,y as populateEnvFromContext,f as posixPath,r as resolvePathDirs,B as runtime,e as toPosix};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{d as CommandBuilder,a as CommandError,h as ProcessGroup,f as exec,e as parseCommand,c as spawnChildGo,b as spawnChildGoSync,g as spawnPty};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-4PF2MT7S.js";import"./chunk-HISXAZ4Y.js";export{c as detectRuntime,a as getLibraryExtension,e as loadEserAjan,b as resolveLibraryPath,d as selectBackend};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import"./chunk-HISXAZ4Y.js";var $=await import("node:fs"),c=s=>{try{return $.statSync(s),!0}catch{return!1}},P=s=>{let o=globalThis;if(typeof o.process<"u"&&typeof o.process.env=="object")return o.process.env[s]??void 0},A=s=>{if(s!==void 0)return s;let o=globalThis;return typeof o.__dirname=="string"?o.__dirname:typeof o.process<"u"&&typeof o.process.cwd=="function"?o.process.cwd():"."},g={command:"eser-ajan.wasm",reactor:"eser-ajan-reactor.wasm"},l=(s="command",o)=>{let a=g[s]??g.command,r=[a,`${a}.bin`],f=s==="reactor"?"wasi-reactor":"wasi",e=[],m=P("ESER_AJAN_WASM_PATH");if(m!==void 0){if(c(m))return m;e.push(`$ESER_AJAN_WASM_PATH = ${m}`)}let d=A(o);for(let n of r){let t=`${d}/${n}`;if(e.push(t),c(t))return t}let h=`${d}/..`;for(let n of r){let t=`${h}/dist/${f}/${n}`;if(e.push(t),c(t))return t}for(let n of r){let t=`${d}/dist/${f}/${n}`;if(e.push(t),c(t))return t}let u=globalThis,p=typeof u.process<"u"&&typeof u.process.cwd=="function"?u.process.cwd():".";if(p!==d)for(let n of r){let t=`${p}/pkg/@eserstack/ajan/dist/${f}/${n}`;if(e.push(t),c(t))return t}let w=[d,h,p];for(let n of w)for(let t of r){let i=`${n}/node_modules/@eserstack/ajan-wasm/${t}`;if(e.push(i),c(i))return i}for(let n of r){let t=[`/usr/local/lib/${n}`,`/usr/lib/${n}`];for(let i of t)if(e.push(i),c(i))return i}throw new Error(`Could not find eser-ajan WASM module (${a}).
|
|
2
|
+
Checked the following locations:
|
|
3
|
+
`+e.map(n=>` - ${n}`).join(`
|
|
4
|
+
`)+`
|
|
5
|
+
|
|
6
|
+
To fix this:
|
|
7
|
+
1. Install: npm install @eserstack/ajan
|
|
8
|
+
2. Or set ESER_AJAN_WASM_PATH to the full path of ${a}`)};var y=import.meta.dirname,_=(s="command")=>{try{return l(s,y),!0}catch{return!1}},W=async s=>{let o=s?.mode??"command",a=s?.wasmPath??l(o,y);if(o==="reactor"){let{loadReactorWasm:f}=await import("./loader-reactor-YZM7HO4G.js");return f(a)}let{loadCommandWasm:r}=await import("./loader-command-3A5FK2RF.js");return r(a)};export{_ as isWasmAvailable,W as loadEserAjanWasm};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as A,b as E}from"./chunk-KM64FL2X.js";import{a as C,b as D}from"./chunk-EIMBEXUJ.js";import{a as k,b as w,c as x,d as y,e as z,f as B}from"./chunk-CTTMQSHF.js";import{a,b,c,d,e,f,g,h,i,j}from"./chunk-EJYSOUEA.js";import{a as l,b as m,c as n,d as o,e as p,f as q,g as r,h as s,i as t,j as u,k as v}from"./chunk-JYVB6UAV.js";import"./chunk-IGDFEGCH.js";import"./chunk-ENP4P2YH.js";import"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import"./chunk-CH6A3LES.js";import"./chunk-OAWYVETM.js";import"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";export{l as AiError,n as AuthFailedError,p as BadRequestError,o as InsufficientCreditsError,s as ModelAlreadyExistsError,r as ModelNotFoundError,m as RateLimitedError,B as Registry,q as ServiceUnavailableError,t as UnsupportedProviderError,c as audioMessage,v as classifyAndWrap,u as classifyStatusCode,z as collectStream,i as decodeDataUrl,C as detectAllProviders,j as detectMimeFromUrl,D as getAvailableProviderNames,b as imageMessage,A as isBatchCapable,h as isDataUrl,E as moduleDef,w as text,e as textBlock,a as textMessage,x as textResult,f as toolCallBlock,y as toolCalls,g as toolResultBlock,d as toolResultMessage,k as withDefaults};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as F,d as U,f as V,k as Y}from"./chunk-
|
|
1
|
+
import{c as F,d as U,f as V,k as Y}from"./chunk-I4Z2RF7L.js";import{b as B}from"./chunk-HISXAZ4Y.js";function v(u){let o=u.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!o)return;let n=o[2]||o[3]||"",r=n.slice(n.lastIndexOf("\\")+1);return r=r.replace(/%22/g,'"'),r=r.replace(/&#(\d{4});/g,(E,l)=>String.fromCharCode(l)),r}async function z(u,o){if(!/multipart/i.test(o))throw new TypeError("Failed to fetch");let n=o.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!n)throw new TypeError("no or bad content-type header, no multipart boundary");let r=new y(n[1]||n[2]),E,l,d,H,e,i,A=[],b=new U,p=s=>{d+=h.decode(s,{stream:!0})},N=s=>{A.push(s)},a=()=>{let s=new F(A,i,{type:e});b.append(H,s)},S=()=>{b.append(H,d)},h=new TextDecoder("utf-8");h.decode(),r.onPartBegin=function(){r.onPartData=p,r.onPartEnd=S,E="",l="",d="",H="",e="",i=null,A.length=0},r.onHeaderField=function(s){E+=h.decode(s,{stream:!0})},r.onHeaderValue=function(s){l+=h.decode(s,{stream:!0})},r.onHeaderEnd=function(){if(l+=h.decode(),E=E.toLowerCase(),E==="content-disposition"){let s=l.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);s&&(H=s[2]||s[3]||""),i=v(l),i&&(r.onPartData=N,r.onPartEnd=a)}else E==="content-type"&&(e=l);l="",E=""};for await(let s of u)r.write(s);return r.end(),b}var f,t,w,_,O,g,x,m,C,I,M,$,R,y,Z=B(()=>{Y();V();f=0,t={START_BOUNDARY:f++,HEADER_FIELD_START:f++,HEADER_FIELD:f++,HEADER_VALUE_START:f++,HEADER_VALUE:f++,HEADER_VALUE_ALMOST_DONE:f++,HEADERS_ALMOST_DONE:f++,PART_DATA_START:f++,PART_DATA:f++,END:f++},w=1,_={PART_BOUNDARY:w,LAST_BOUNDARY:w*=2},O=10,g=13,x=32,m=45,C=58,I=97,M=122,$=u=>u|32,R=()=>{},y=class{constructor(o){this.index=0,this.flags=0,this.onHeaderEnd=R,this.onHeaderField=R,this.onHeadersEnd=R,this.onHeaderValue=R,this.onPartBegin=R,this.onPartData=R,this.onPartEnd=R,this.boundaryChars={},o=`\r
|
|
2
2
|
--`+o;let n=new Uint8Array(o.length);for(let r=0;r<o.length;r++)n[r]=o.charCodeAt(r),this.boundaryChars[n[r]]=!0;this.boundary=n,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=t.START_BOUNDARY}write(o){let n=0,r=o.length,E=this.index,{lookbehind:l,boundary:d,boundaryChars:H,index:e,state:i,flags:A}=this,b=this.boundary.length,p=b-1,N=o.length,a,S,h=c=>{this[c+"Mark"]=n},s=c=>{delete this[c+"Mark"]},D=(c,P,T,k)=>{(P===void 0||P!==T)&&this[c](k&&k.subarray(P,T))},L=(c,P)=>{let T=c+"Mark";T in this&&(P?(D(c,this[T],n,o),delete this[T]):(D(c,this[T],o.length,o),this[T]=0))};for(n=0;n<r;n++)switch(a=o[n],i){case t.START_BOUNDARY:if(e===d.length-2){if(a===m)A|=_.LAST_BOUNDARY;else if(a!==g)return;e++;break}else if(e-1===d.length-2){if(A&_.LAST_BOUNDARY&&a===m)i=t.END,A=0;else if(!(A&_.LAST_BOUNDARY)&&a===O)e=0,D("onPartBegin"),i=t.HEADER_FIELD_START;else return;break}a!==d[e+2]&&(e=-2),a===d[e+2]&&e++;break;case t.HEADER_FIELD_START:i=t.HEADER_FIELD,h("onHeaderField"),e=0;case t.HEADER_FIELD:if(a===g){s("onHeaderField"),i=t.HEADERS_ALMOST_DONE;break}if(e++,a===m)break;if(a===C){if(e===1)return;L("onHeaderField",!0),i=t.HEADER_VALUE_START;break}if(S=$(a),S<I||S>M)return;break;case t.HEADER_VALUE_START:if(a===x)break;h("onHeaderValue"),i=t.HEADER_VALUE;case t.HEADER_VALUE:a===g&&(L("onHeaderValue",!0),D("onHeaderEnd"),i=t.HEADER_VALUE_ALMOST_DONE);break;case t.HEADER_VALUE_ALMOST_DONE:if(a!==O)return;i=t.HEADER_FIELD_START;break;case t.HEADERS_ALMOST_DONE:if(a!==O)return;D("onHeadersEnd"),i=t.PART_DATA_START;break;case t.PART_DATA_START:i=t.PART_DATA,h("onPartData");case t.PART_DATA:if(E=e,e===0){for(n+=p;n<N&&!(o[n]in H);)n+=b;n-=p,a=o[n]}if(e<d.length)d[e]===a?(e===0&&L("onPartData",!0),e++):e=0;else if(e===d.length)e++,a===g?A|=_.PART_BOUNDARY:a===m?A|=_.LAST_BOUNDARY:e=0;else if(e-1===d.length)if(A&_.PART_BOUNDARY){if(e=0,a===O){A&=~_.PART_BOUNDARY,D("onPartEnd"),D("onPartBegin"),i=t.HEADER_FIELD_START;break}}else A&_.LAST_BOUNDARY&&a===m?(D("onPartEnd"),i=t.END,A=0):e=0;if(e>0)l[e-1]=a;else if(E>0){let c=new Uint8Array(l.buffer,l.byteOffset,l.byteLength);D("onPartData",0,E,c),E=0,h("onPartData"),n--}break;case t.END:break;default:throw new Error(`Unexpected state entered: ${i}`)}L("onHeaderField"),L("onHeaderValue"),L("onPartData"),this.index=e,this.state=i,this.flags=A}end(){if(this.state===t.HEADER_FIELD_START&&this.index===0||this.state===t.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==t.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}});Z();export{z as toFormData};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{a as he}from"./chunk-NGCBWJML.js";import{a as Xe}from"./chunk-KJLEPI7T.js";import{a as ue,c as me,e as fe}from"./chunk-5DZHAHXW.js";import{a as Ge,b as Ke,d as O}from"./chunk-7PPUGTKL.js";import{a as Ze}from"./chunk-6YSS6PEL.js";import{a as X}from"./chunk-EROZRDGT.js";import{a as et,b as tt,c as st,d as nt}from"./chunk-LN4NDYT6.js";import{h as K}from"./chunk-5RLCKUIF.js";import{B as le,C as He,L as pe,M as Ye,N as de,P as Be,a as Me,b as qe,c as ne,d as Le,e as Ue,f as ie,g as j,h as re,i as je,j as Y,k as oe,l as _e,n as Ve,p as ae,q as Je,t as ce,u as We,v as B,w as Qe,x as ze}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{c as G}from"./chunk-IFE5SYGK.js";import"./chunk-Z7OYXH3J.js";import{a as we,b as ve,c as ye}from"./chunk-VJRCTYGL.js";import{a as xe,b as Ce,c as De,d as Re,e as Ie,g as ke,h as Pe,j as Ae,k as U}from"./chunk-PKEQKXZW.js";import{h as Q}from"./chunk-O4KKKYCH.js";import{D as Oe,E as Ne,b as ge,d as Se,f as $,h as Ee,i as be,m as $e,n as Te,o as z,p as te,s as Fe,u as H,z as se}from"./chunk-KRKOWSYW.js";import{a as W,b as L}from"./chunk-OAWYVETM.js";import{i as R}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var Ut=async i=>{let{root:e}=await Ne(),c=Ge(i),a=Ke(i);if(!await Oe(e))return await O({error:`noskills not initialized. Run: ${G("init")}`},c),L({exitCode:1});let r=null;for(let m of a)m.startsWith("--answer=")&&(r=m.slice(9));let t=be(a),s;try{s=await Ee(e,t)}catch(m){let g=m instanceof Error?m.message:String(m);return await O({error:g},c),L({exitCode:1})}if(t===null&&s.phase!=="IDLE"&&s.phase!=="COMPLETED")return await O({error:"Error: --spec=<name> is required. Use `noskills spec list` to see available specs."},c),L({exitCode:1});let l=await z(e);if(l?.command!==void 0){let{setCommandPrefix:m}=await import("./cmd-46ZIHXLB.js");m(l.command)}if(l===null)return await O({error:"No config found"},c),L({exitCode:1});if(s.spec!==null&&s.phase!=="IDLE"&&s.phase!=="COMPLETED"){let m=`${e}/${$.specDir(s.spec)}`;try{await R.fs.stat(m)}catch{return await O({error:!0,message:`Active spec '${s.spec}' directory not found. Files may have been deleted manually.`,suggestion:`Run \`${G("reset")}\` to return to idle, or \`${G("cancel")}\` to mark as cancelled.`},c),L({exitCode:1})}}let f=Xe(a,l);s.phase==="DISCOVERY"&&s.discovery.audience!==f&&(s={...s,discovery:{...s.discovery,audience:f}});let o=(await Fe(e)).filter(m=>l.concerns.includes(m.id));if(r!==null){let m=await K(e),g=await ft(e,s,l,o,r,m);await H(e,g);let w={...g,lastCalledAt:new Date().toISOString()};await H(e,w);let q=R.env.get("NOSKILLS_SESSION")??null;q!==null&&await se(e,q,w.phase);let _=await ue(e),{tier1:N,tier2Count:Z}=me(_,w.phase),ee=w.spec!==null?await X(e,w.spec):null,v=await ot(e,w),D=await he(e,v),M=fe(l?.tools??[]),F=await K(e),P=await de(w,o,N,l,ee,D,void 0,M,F,Z,e),C=r.trim().toLowerCase()==="save",b=w.phase===s.phase;if(C&&b&&(w.phase==="SPEC_PROPOSAL"||w.phase==="SPEC_APPROVED")){let V=w.phase==="SPEC_PROPOSAL"?"Spec draft saved. The spec stays in DRAFT and can be reviewed by anyone. Other users can add ACs (`ac add`), notes (`note add`), or tasks (`task add`) while in draft. When ready, any user can approve with `noskills spec <name> approve`.":'Spec is approved and parked. Others can still add ACs or notes. When ready, run `noskills next --answer="start"` to begin execution.',J={...P,instruction:V,saved:!0};return await O(J,c),W(void 0)}return await O(P,c),W(void 0)}let p={...s,lastCalledAt:new Date().toISOString()};await H(e,p);let d=R.env.get("NOSKILLS_SESSION")??null;d!==null&&await se(e,d,p.phase);let u=await ue(e),{tier1:S,tier2Count:y}=me(u,p.phase),x=p.spec!==null?await X(e,p.spec):null,I=await ot(e,p),k=await he(e,I),T;p.phase==="IDLE"&&(T={existingSpecs:(await Te(e)).map(g=>({name:g.name,phase:g.state.phase,iteration:g.state.execution.iteration,detail:g.state.phase==="EXECUTING"?`${g.state.execution.completedTasks.length} tasks done, iteration ${g.state.execution.iteration}`:g.state.phase==="SPEC_PROPOSAL"?"awaiting approval":g.state.phase==="COMPLETED"?"completed":void 0})),rulesCount:S.length});let A=fe(l?.tools??[]),E=await K(e),h=await de(p,o,S,l,x,k,T,A,E,y,e);return await O(h,c),W(void 0)},at=async(i,e,c)=>{let a=`${i}/${$.askTokenFile}`;try{let r=await R.fs.readTextFile(a),t=JSON.parse(r);if((t.spec??null)!==(e??null))return{source:"INFERRED",questionMatch:"not-asked"};if(t.stepId!==c)return{source:"INFERRED",questionMatch:"not-asked"};let s=Date.now()-new Date(t.createdAt??0).getTime();if(!isFinite(s)||s<0||s>1800*1e3)return{source:"INFERRED",questionMatch:"not-asked"};try{await R.fs.remove(a)}catch{}return{source:"STATED",questionMatch:t.match??"exact"}}catch{return{source:"INFERRED",questionMatch:"not-asked"}}},ct=(i,e,c)=>{let a=i.discovery.answers,r=-1;for(let n=a.length-1;n>=0;n--){let o=a[n];if(o!==void 0&&o.questionId===e){r=n;break}}if(r===-1)return i;let t=a[r];if(t===void 0)return i;let l={...Se(t),source:c.source,questionMatch:c.questionMatch},f=[...a.slice(0,r),l,...a.slice(r+1)];return{...i,discovery:{...i.discovery,answers:f}}},pt=["status_quo","ambition","reversibility","user_impact","verification","scope_boundary"],dt=(i,e)=>i===null&&e===null?!0:i===null||e===null?!1:i.involvesWebUI===e.involvesWebUI&&i.involvesCLI===e.involvesCLI&&i.involvesPublicAPI===e.involvesPublicAPI&&i.involvesMigration===e.involvesMigration&&i.involvesDataHandling===e.involvesDataHandling,ut=async(i,e,c,a,r,t)=>{if(e.spec===null||e.specState.path===null)return{newState:e,revealNotification:null};let s=Pe(c),l=new Date,f=r?.name??"Unknown User",n=e.classification??null,o=Ye(e),p=!dt(n,o),d=xe(t),u=Ie(e.specState.placeholders,s,f,l);u=Ce(u,d,o);let S=ke(e.specState.metadata,{type:"answer",user:f,section:s},l),y={...e,classification:o,specState:{...e.specState,placeholders:u,metadata:S}},x=null;if(p){let I=Re(e.specState.placeholders,u),k=I?.revealed??[],T=I?.hidden??[],A=k.map(m=>{let g=d.find(q=>q.id===m),w=g?.concernSource!==void 0?` (from concern: ${g.concernSource})`:"";return` \u2022 ${g?.title??m}${w}`}),E=T.map(m=>` \u2022 ${d.find(w=>w.id===m)?.title??m}`),h=[];if(A.length>0){let m=De(n,o);h.push(`
|
|
2
|
+
Classification updated. ${A.length} new section(s) appeared:
|
|
3
|
+
`+A.join(`
|
|
4
|
+
`)+`
|
|
5
|
+
Reason: your answer mentioned ${m}`)}E.length>0&&h.push(`
|
|
6
|
+
${E.length} section(s) hidden (no longer relevant):
|
|
7
|
+
`+E.join(`
|
|
8
|
+
`)),h.length>0&&(x=h.join(`
|
|
9
|
+
`))}try{let I=`${i}/${e.specState.path}`,k=new Set(e.specState.placeholders.filter(h=>h.status!=="conditional-hidden").map(h=>h.sectionId)),T=new Set(u.filter(h=>h.status!=="conditional-hidden").map(h=>h.sectionId)),A=[...T].filter(h=>!k.has(h)).map(h=>d.find(m=>m.id===h)).filter(h=>h!==void 0),E=[...k].filter(h=>!T.has(h));await Ae({path:I,sectionId:s,body:a,attribution:{user:f,date:l},metadata:S,visiblePlaceholders:u,classificationChanged:p,newlyRevealedSections:A,newlyHiddenIds:E})}catch{}return{newState:y,revealNotification:x}},it={a:"selective-expansion",b:"hold-scope",c:"scope-expansion",d:"scope-reduction","selective-expansion":"selective-expansion","hold-scope":"hold-scope","scope-expansion":"scope-expansion","scope-reduction":"scope-reduction"},rt=async(i,e,c,a,r)=>{let t=a.trim().toLowerCase();if(t==="approve"||t==="y"||t==="yes"){let s=pe(e.discovery.answers);if(s.detected&&s.proposals.length>=2)return oe(e);if(e.discovery.mode!==void 0)return oe(e);try{let l=Y(e);if(l.spec!==null){let f=`${i}/${$.specDir(l.spec)}`;await U(`${f}/spec.md`,`${f}/spec.proposal.md`).catch(()=>{})}return l}catch(l){throw ce(e)==="stage-c"?new Error(`${l.message} \u2014 Your CEO review is saved and will be preserved (run 'noskills next' to see remaining gaps).`):l}}return e},mt=async(i,e,c,a,r)=>{let t=a.trim().toLowerCase(),s=ce(e),l=it[t];if(l!==void 0)return B(e,l);try{let n=JSON.parse(a);if(n!==null&&typeof n=="object"){if("posture"in n||"completeness"in n){let o=e;if(typeof n.completeness=="object"&&n.completeness!==null&&typeof n.completeness.overall=="number"&&Array.isArray(n.completeness.dimensions)&&(o=We(o,n.completeness),s==="stage-a"&&c.defaultReviewPosture!==void 0&&!("posture"in n)&&(o=B(o,c.defaultReviewPosture))),"posture"in n){let p=it[String(n.posture)];p!==void 0&&(o=B(o,p))}return o}if("ceoReview"in n)return Qe(e,n.ceoReview,typeof n.reflection=="string"?n.reflection:void 0)}}catch{}if(s==="stage-c"){if(t==="approve"||t==="y"||t==="yes")return rt(i,e,c,a,r);if(t==="revise"||t==="r")return ze(e)}if(t==="save-posture"){let n=e.discovery.refinement?.reviewPosture;if(n!==void 0)try{let o=await z(i);o!==null&&await te(i,{...o,defaultReviewPosture:n}),console.error(`Saved '${n}' as project default posture.`)}catch{}return e}if(t==="clear-posture"){try{let n=await z(i);if(n!==null){let{defaultReviewPosture:o,...p}=n;await te(i,p),console.error("Cleared project default posture.")}}catch{}return e}if(t==="approve"){let n=await rt(i,e,c,a,r);if(n!==e){let o=e.discovery.refinement?.initialCompletenessScore?.overall,p=e.discovery.refinement?.completenessScore?.overall;return o!==void 0&&p!==void 0&&o!==p?console.error(`Completeness improved from ${o} to ${p}/10 through review.`):p!==void 0&&console.error(`Spec reviewed at ${p}/10.`),n}}if(t==="split")return await ht(i,e);if(t==="keep"){let n=ae(e,{id:`decision-split-keep-${Date.now()}`,question:"Split spec into separate areas?",choice:"Chose to keep as single spec despite multiple areas detected",promoted:!1,timestamp:new Date().toISOString()}),o=Y(n);if(o.spec!==null){let p=`${i}/${$.specDir(o.spec)}`;await U(`${p}/spec.md`,`${p}/spec.proposal.md`).catch(()=>{})}return o}let f=e.discovery.alternativesPresented===!0;if(e.discovery.approved&&!f){let n;if(t==="skip"||t==="none")n=ie(e);else{let p=!1;try{let d=JSON.parse(a);if(d!==null&&typeof d=="object"&&"approach"in d){let u={id:String(d.approach),name:String(d.name??d.approach),summary:String(d.summary??""),effort:String(d.effort??""),risk:String(d.risk??""),user:r?.name??"Unknown User",timestamp:new Date().toISOString()};n=Ue(e,u),p=!0}}catch{}p||(n=ie(e))}let o=Y(n);if(o.spec!==null){let p=`${i}/${$.specDir(o.spec)}`;await U(`${p}/spec.md`,`${p}/spec.proposal.md`).catch(()=>{})}return o}try{let n=JSON.parse(a);if(typeof n.revise=="object"&&n.revise!==null){let o=e,p=await at(i,e.spec,"refinement");for(let[d,u]of Object.entries(n.revise))typeof u=="string"&&u.length>0&&(o=j(o,d,u,r),o=ct(o,d,p));return o}}catch{}return e},ft=async(i,e,c,a,r,t)=>{switch(e.phase){case"DISCOVERY":{let s=e.discovery.userContext!==void 0&&e.discovery.userContext.length>0,l=e.specDescription!==null&&e.specDescription.length>0,f=e.discovery.mode;if(!s&&f===void 0&&l){if(r.trim()==="import-plan"){let u=await Be(i);if(u!==null)try{let S=await R.fs.readTextFile(u.path);return He(e,S,u.path)}catch{}return le(e,"\u26A0 No active plan found \u2014 plan.md was not detected or has expired. Please share your context directly.")}return le(e,r)}if(f===void 0&&l)return["full","validate","technical-depth","ship-fast","explore"].includes(r)?ne(e,r):ne(e,"full");let n=e.discovery.premisesCompleted===!0;if(f!==void 0&&!n){try{let u=JSON.parse(r);if(u!==null&&typeof u=="object"&&"premises"in u){let y=u.premises.map(x=>({text:x.text??"",agreed:x.agreed??!0,revision:x.revision,user:t?.name??"Unknown User",timestamp:new Date().toISOString()}));if(y.length===0)throw new Error("Premise challenge requires at least one premise. Empty array rejected.");return Le(e,y)}}catch{throw new Error("Premise challenge requires valid JSON with premises array. Re-prompt the user.")}throw new Error("Premise challenge requires a premises array. Cannot skip with empty input.")}let o=e.discovery.audience==="agent",p=null;try{let u=JSON.parse(r);typeof u=="object"&&u!==null&&!Array.isArray(u)&&(o?we.map(x=>x.id).every(x=>x in u)&&(p=u):p=u)}catch{}let d=e;if(p!==null){for(let[u,S]of Object.entries(p))typeof S=="string"&&S.length>0&&(d=j(d,u,S,t));d={...d,discovery:{...d.discovery,batchSubmitted:!0}}}else{let u=ve(a),S=d.discovery.currentQuestion,y=u[S];if(y===void 0)return e;d=j(d,y.id,r,t);let x=pt[S]??`Q${S+1}`,I=await at(i,e.spec,x);d=ct(d,y.id,I),d=_e(d);let{newState:k}=await ut(i,d,y.id,r,t,a);d=k}return ye(d.discovery.answers)&&(d=re(d)),d}case"DISCOVERY_REFINEMENT":return await mt(i,e,c,r,t);case"SPEC_PROPOSAL":{if(r.trim().toLowerCase()==="save")return e;let s=e;if(s.classification===null){s=je(s);try{await Ze(i,s,a)}catch{}}try{let l=JSON.parse(r);if(typeof l.refinement=="string"&&l.refinement.length>0){let f=l.refinement;if(s.spec!==null){let n=`${i}/${$.specFile(s.spec)}`,o=await R.fs.readTextFile(n);if(f.includes("task-")){let d=gt(f).map(y=>`- [ ] ${y}`).join(`
|
|
10
|
+
`),u=/## Tasks\n\n([\s\S]*?)(?=\n## |\n*$)/,S=o.replace(u,`## Tasks
|
|
11
|
+
|
|
12
|
+
${d}
|
|
13
|
+
`);await R.fs.writeTextFile(n,S)}}return s}}catch{}return s}case"SPEC_APPROVED":{if(r.trim().toLowerCase()==="save")return e;let s=Ve(e);if(s.spec!==null){await et(i,s.spec,"executing"),await nt(i,s.spec,"executing");let l=`${i}/${$.specDir(s.spec)}`;await U(`${l}/spec.md`,`${l}/spec.approved.md`).catch(()=>{})}return s}case"EXECUTING":{if(!e.execution.awaitingStatusReport){let s={...e,execution:{...e.execution,lastProgress:r}};if(c.verifyCommand!==null&&c.verifyCommand!==void 0&&c.verifyCommand.length>0){let l=await wt(i,c.verifyCommand);if(s={...s,execution:{...s.execution,lastVerification:l}},!l.passed)return s}return s={...s,execution:{...s.execution,awaitingStatusReport:!0}},s}return await St(i,e,r,a)}case"BLOCKED":{let s=e.execution.lastProgress??"Unknown",l={id:`d${e.decisions.length+1}`,question:s.replace(/^BLOCKED:\s*/,""),choice:r,promoted:!1,timestamp:new Date().toISOString()},f=ae(e,l);return f=Me(f,"EXECUTING"),f={...f,execution:{...f.execution,lastProgress:`Resolved: ${r}`}},f}default:return e}},ht=async(i,e)=>{let c=pe(e.discovery.answers);if(!c.detected||c.proposals.length===0)return e;let a=[];for(let t of c.proposals){let s=`${i}/${$.specDir(t.name)}`;await R.fs.mkdir(s,{recursive:!0});let l=e.discovery.answers.filter(o=>t.relevantAnswers.includes(o.questionId)),n=qe(ge(),t.name,`spec/${t.name}`);for(let o of l)n=j(n,o.questionId,o.answer);n=re(n),await $e(i,t.name,n),a.push(t.name)}return Je(e,"cancelled",`Split into: ${a.join(", ")}`)},gt=i=>i.split(/(?=task-\d+:)/).map(e=>e.replace(/[,;\n\s]+$/,"").trim()).filter(e=>/^task-\d+:/.test(e)),St=async(i,e,c,a)=>{let r;try{r=JSON.parse(c)}catch{return{...e,execution:{...e.execution,lastProgress:c,awaitingStatusReport:!1}}}let t=e;if(e.execution.debt!==null&&e.execution.debt.items.length>0&&typeof e.execution.debt.items[0]=="string"){let D=e.execution.debt.items.map((P,C)=>({id:`legacy-${C+1}`,text:P,since:e.execution.debt.fromIteration}));t={...e,execution:{...e.execution,debt:{...e.execution.debt,items:D}}};let M=new TextEncoder,F=R.process.stderr.getWriter();await F.write(M.encode(`noskills: migrated legacy string[] debt to DebtItem[] format
|
|
14
|
+
`)),F.releaseLock()}let s=new Set(["mandatory-tests","mandatory-docs"]),f=(r.na??[]).filter(v=>s.has(v));if(f.length>0)return{...t,execution:{...t.execution,lastProgress:`REJECTED: Tests and documentation ACs require explicit justification to mark as N/A. Explain why tests or docs are not needed for this spec. Rejected IDs: ${f.join(", ")}`,awaitingStatusReport:!0}};let n=r.completed??[],o=new Set(n),p=r.na??[],d=new Set(p),u=r.newIssues??[],S=r.remaining??[],y=r.blocked??[],x=t.execution.debt?.unaddressedIterations??0,I=t.execution.debt!==null?t.execution.debt.items.filter(v=>!o.has(v.id)&&!d.has(v.id)):[],k=t.execution.debtCounter??0,T=u.map((v,D)=>({id:`debt-${k+D+1}`,text:v,since:t.execution.iteration})),A=[...I,...T],E=S.length===0&&y.length===0&&u.length===0,h=E||A.length===0?null:{items:A,fromIteration:t.execution.debt?.fromIteration??t.execution.iteration,unaddressedIterations:I.length>0?x+1:1},m=[...new Set([...t.execution.naItems??[],...p])],g=[];n.length>0&&g.push(`Completed: ${n.join(", ")}`),p.length>0&&g.push(`N/A: ${p.join(", ")}`);let w=g.length>0?g.join("; "):"Status report submitted",q=t.execution.lastVerification===null||t.execution.lastVerification.passed===!0,_=h===null&&q,N=k+u.length,Z=t.execution.criteriaScope,ee=t.execution.gateConcernCursor??0;if(Z==="review-gate"){if(E){let v=Q(a,t.classification).length>0?a.filter(M=>Q([M],t.classification).length>0):[],D=ee+1;return D>=v.length?{...t,execution:{...t.execution,criteriaScope:void 0,gateConcernCursor:void 0,awaitingStatusReport:!1,debt:h,debtCounter:N,naItems:m,lastProgress:"Review gate complete \u2014 all concern dimensions satisfied. Run `noskills done` to finish."}}:{...t,execution:{...t.execution,criteriaScope:"review-gate",gateConcernCursor:D,awaitingStatusReport:!0,debt:h,debtCounter:N,naItems:m,lastProgress:`Review gate: concern ${v[D]?.name??String(D)} \u2014 submit findings`}}}return{...t,execution:{...t.execution,awaitingStatusReport:!0,debt:h,debtCounter:N,naItems:m,lastProgress:`Review gate: ${S.length} dimension(s) still remaining \u2014 verify them and resubmit with remaining:[]`}}}if(_&&t.spec!==null){let v=await X(i,t.spec);if(v!==null){let D=t.execution.completedTasks??[],M=new Set(D),F=[];try{let C=JSON.parse(t.execution.lastProgress??"");Array.isArray(C.completed)&&(F=C.completed.filter(b=>!M.has(b)&&v.tasks.some(V=>V.id===b)))}catch{}if(F.length===0){let C=v.tasks.find(b=>!M.has(b.id));C!==void 0&&(F=[C.id])}let P=[];for(let C of F)await tt(i,t.spec,C),await st(i,t.spec,C,"done"),P.push(C);if(P.length>0){let C=P.length===1?`Task ${P[0]} accepted`:`Tasks ${P.join(", ")} accepted`,b=[...D,...P];return v.tasks.every(J=>b.includes(J.id))&&a.filter(lt=>Q([lt],t.classification).length>0).length>0?{...t,execution:{...t.execution,lastProgress:`${C}: ${w}. All spec tasks complete \u2014 entering review gate.`,awaitingStatusReport:!0,criteriaScope:"review-gate",gateConcernCursor:0,debt:h,completedTasks:b,debtCounter:N,naItems:m}}:{...t,execution:{...t.execution,lastProgress:`${C}: ${w}`,awaitingStatusReport:!1,debt:h,completedTasks:b,debtCounter:N,naItems:m}}}}}return{...t,execution:{...t.execution,lastProgress:_?w:`Task not accepted \u2014 remaining items must be addressed first. ${w}`,awaitingStatusReport:!1,debt:h,debtCounter:N,naItems:m}}},wt=async(i,e)=>{try{let{execSync:c}=await import("node:child_process"),a=c(e,{cwd:i,encoding:"utf-8",timeout:6e4,stdio:["pipe","pipe","pipe"]});return{passed:!0,output:String(a).slice(0,4e3),timestamp:new Date().toISOString()}}catch(c){let a=c,r=((a.stdout??"")+(a.stderr??"")).slice(0,4e3);return a.status!==void 0?{passed:!1,output:r||"Verification failed with no output",timestamp:new Date().toISOString()}:{passed:!1,output:`Verification command failed to execute: ${c instanceof Error?c.message:String(c)}`,timestamp:new Date().toISOString()}}},ot=async(i,e)=>{let c=[...e.execution.modifiedFiles??[]],a=await vt(i);return[...new Set([...c,...a])]},vt=async i=>{let e=`${i}/${$.progressesDir}/files-changed.jsonl`;try{let a=(await R.fs.readTextFile(e)).trim().split(`
|
|
15
|
+
`).filter(Boolean),r=[];for(let t of a)try{let s=JSON.parse(t);r.includes(s.file)||r.push(s.file)}catch{}return r}catch{return[]}};export{at as consumeAskToken,ft as handleAnswer,Ut as main,gt as parseRefinementTasks};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{a as g,b as d,c as $,r as G,v as u,w as W}from"./chunk-3ZJ3UGQL.js";import"./chunk-HISXAZ4Y.js";import*as h from"node:fs/promises";import*as F from"node:fs";import*as p from"node:path";import*as J from"node:child_process";import*as V from"node:crypto";import*as Y from"node:readline";function O(r){if(r.inputSchema.type!=="object")throw new Error(`JSON schema for tool "${r.name}" must be an object, but got ${r.inputSchema.type}`);return{type:"custom",name:r.name,input_schema:r.inputSchema,description:r.description,run:r.run,parse:t=>t,...r.close?{close:r.close}:{}}}import*as k from"node:fs/promises";import*as w from"node:path";import{randomUUID as nt}from"node:crypto";var x=493,st=420;async function ot(r){try{return await k.realpath(r)}catch{return r}}async function at(r){let t=[],e=r,i=0;for(;;){let n;try{n=await k.realpath(e)}catch{let s=!1;try{s=(await k.lstat(e)).isSymbolicLink()}catch{}if(s){if(++i>40)throw new u(`path ${JSON.stringify(r)} has too many levels of symbolic links`);e=w.resolve(w.dirname(e),await k.readlink(e));continue}let o=w.dirname(e);if(o===e)return r;t.push(w.basename(e)),e=o;continue}return t.length?w.join(n,...t.reverse()):n}}async function j(r,t,e){let i=e?.allowOutside??!1,n=await ot(w.resolve(r)),s=w.resolve(n,t);if(i)return s;let o=await at(s);if(o!==n&&!o.startsWith(n+w.sep))throw new u(`path ${JSON.stringify(t)} escapes workdir`);return o}async function q(r,t){let e=w.dirname(r),i=w.join(e,`.tmp-${process.pid}-${nt()}`),n;try{n=await k.open(i,"wx",st),await n.writeFile(t,"utf-8"),await n.sync(),await n.close(),n=void 0,await k.rename(i,r)}catch(s){throw n&&await n.close().catch(()=>{}),await k.unlink(i).catch(()=>{}),s}}function A(r,t){switch(r?.code){case"ENOENT":return`${t}: no such file or directory`;case"EACCES":case"EPERM":return`${t}: permission denied`;case"ENOTDIR":return`${t}: not a directory`;case"EISDIR":return`${t}: is a directory`;case"ELOOP":return`${t}: too many levels of symbolic links`;case"ENAMETOOLONG":return`${t}: file name too long`;case"ENOSPC":return`${t}: no space left on device`;case"EMFILE":case"ENFILE":return`${t}: too many open files`;default:return`${t}: ${r instanceof Error?r.message:String(r)}`}}import*as b from"node:fs/promises";import*as H from"node:fs";import*as m from"node:path";import{execFile as ct}from"node:child_process";import{promisify as lt}from"node:util";import{Readable as ft}from"node:stream";import{pipeline as ut}from"node:stream/promises";var dt=lt(ct);async function pt(r){let{client:t,sessionId:e}=r;if(!t||!e)return async()=>{};let i=G(t),n=await t.beta.sessions.retrieve(e),s=m.resolve(r.workdir,"skills"),o=[];for(let a of n.agent.skills)try{let c=await z(t,a.skill_id,a.version),f=await t.beta.skills.versions.retrieve(c,{skill_id:a.skill_id}),l=m.basename(f.name.trim());(l===""||l==="."||l==="..")&&(l=a.skill_id);let v=m.resolve(s,l);if(v!==s&&!v.startsWith(s+m.sep)){i.warn("skill name escapes the skills dir; skipping",{component:"agent-tool-context",name:f.name});continue}let T=await t.beta.skills.versions.download(c,{skill_id:a.skill_id});await b.rm(v,{recursive:!0,force:!0}),await b.mkdir(v,{recursive:!0,mode:x}),o.push(v),await K(T,v),i.info("downloaded skill",{component:"agent-tool-context",skill_id:a.skill_id,version:c,dest:v})}catch(c){i.warn("failed to download skill",{component:"agent-tool-context",skill_id:a.skill_id,error:String(c)})}return async()=>{for(let a of o)await b.rm(a,{recursive:!0,force:!0}).catch(c=>{i.warn("failed to clean up skill",{component:"agent-tool-context",dest:a,error:String(c)})})}}async function z(r,t,e){if(/^\d+$/.test(e))return e;let i;for await(let n of r.beta.skills.versions.list(t))/^\d+$/.test(n.version)&&(i===void 0||BigInt(n.version)>BigInt(i))&&(i=n.version);if(i===void 0)throw new $(`skill ${JSON.stringify(t)} has no concrete version to resolve ${JSON.stringify(e)} against`);return i}function ht(r){for(let t of r.split(`
|
|
2
|
+
`)){let e=t.trim();if(e&&(m.isAbsolute(e)||e.split(/[\\/]/).includes("..")))throw new $(`refusing to extract unsafe archive member: ${e}`)}}function mt(r){for(let t of r.split(`
|
|
3
|
+
`)){let e=t.trimStart()[0];if(e==="l"||e==="h"||e==="b"||e==="c"||e==="p"||e==="s")throw new $("refusing to extract archive with symlink/hardlink/device member")}}async function B(r,t){try{let{stdout:e}=await dt(r,t);return e}catch(e){throw e!=null&&typeof e=="object"&&e.code==="ENOENT"?new $(`skill extraction requires the \`${r}\` command, but it was not found on PATH`):e}}function wt(r){let t,e=!1;for(let i of r.split(`
|
|
4
|
+
`)){let n=i.trim().split("/").filter(o=>o!==""&&o!==".");if(n.length===0)continue;let s=n[0];if(t===void 0)t=s;else if(s!==t)return"";n.length>1&&(e=!0)}return t!==void 0&&e?t:""}async function K(r,t){let e=m.join(t,`.skill-archive-${process.pid}-${Date.now()}`);if(!r.body)throw new $("skill download response had no body");await ut(ft.fromWeb(r.body),H.createWriteStream(e));let i=m.join(m.dirname(t),`.skill-stage-${process.pid}-${Date.now()}`);try{let n=await yt(e,4),s=n.length>=4&&n[0]===80&&n[1]===75&&n[2]===3&&n[3]===4,o=s?"unzip":"tar",a=await B(o,s?["-Z1",e]:["-tf",e]);ht(a),mt(await B(o,s?["-Z",e]:["-tvf",e]));let c=wt(a);await b.mkdir(i,{recursive:!0,mode:x}),await B(o,s?["-oq",e,"-d",i]:["-xf",e,"-C",i]);let f=c?m.join(i,c):i;for(let l of await b.readdir(f))await b.rename(m.join(f,l),m.join(t,l))}finally{await b.rm(e,{force:!0}),await b.rm(i,{recursive:!0,force:!0})}}async function yt(r,t){let e=await b.open(r,"r");try{let i=Buffer.alloc(t),{bytesRead:n}=await e.read(i,0,t,0);return i.subarray(0,n)}finally{await e.close()}}var P,y,_,I,S,E,U,X=100*1024,Q=12e4,gt=256*1024,R=100*1024,bt=2e3,_t=200,vt=/\x1b\[[0-9;?]*[ -/]*[@-~]/g,$t=h.glob;function tt(r){return r===void 0?gt:r}function ae(r){return[Et(r),Ot(r),St(r),Tt(r),xt(r),At(r)]}function M(r,t){return j(r.workdir,t,{allowOutside:r.unrestrictedPaths??!1})}function kt(){let r={};for(let[t,e]of Object.entries(process.env))t.startsWith("ANTHROPIC_")||(r[t]=e);return r}var C=class{constructor(t,e=kt()){P.add(this),y.set(this,void 0),_.set(this,""),I.set(this,!1),S.set(this,!1),E.set(this,null),g(this,y,J.spawn("/bin/bash",["--noprofile","--norc"],{cwd:t,env:{...e,PS1:"",PS2:"",TERM:"dumb"},stdio:["pipe","pipe","pipe"],detached:!0}),"f"),d(this,y,"f").stdout.setEncoding("utf8"),d(this,y,"f").stderr.setEncoding("utf8"),d(this,y,"f").stdout.on("data",i=>d(this,P,"m",U).call(this,i)),d(this,y,"f").stderr.on("data",i=>d(this,P,"m",U).call(this,i)),d(this,y,"f").once("close",()=>{g(this,S,!0,"f");let i=d(this,E,"f");g(this,E,null,"f"),i?.resolve()})}get closed(){return d(this,S,"f")}async exec(t,e={}){if(d(this,S,"f"))throw new $("bash session terminated");let i=e.timeoutMs??Q,n=e.signal;if(n?.aborted)throw new $("bash command aborted");g(this,_,"","f"),g(this,I,!1,"f");let s=`__ANT_CMD_${V.randomUUID()}_DONE__`,o=`${s.slice(0,8)}''${s.slice(8)}`,a=`{ ${t}
|
|
5
|
+
} </dev/null 2>&1; printf '\\n${o}%d\\n' $?
|
|
6
|
+
`;if(d(this,y,"f").stdin.write(a),d(this,_,"f").indexOf(s)<0){let{promise:et,resolve:rt}=W();g(this,E,{sentinel:s,resolve:rt},"f");let L,N;try{await Promise.race([et,new Promise((it,D)=>{L=setTimeout(()=>D(new $(`bash command timed out after ${i}ms`)),i)}),new Promise((it,D)=>{n&&(N=()=>D(new $("bash command aborted")),n.addEventListener("abort",N,{once:!0}))})])}finally{L&&clearTimeout(L),N&&n&&n.removeEventListener("abort",N),g(this,E,null,"f")}}let c=d(this,_,"f").indexOf(s);if(c<0)throw new $("bash session terminated");let l=d(this,_,"f").slice(c+s.length).match(/^(-?\d+)/),v=l?parseInt(l[1],10):-1,T=d(this,_,"f").slice(0,c).replace(vt,"").replace(/\n+$/,"");return d(this,I,"f")&&(T=`[output truncated]
|
|
7
|
+
${T}`),{output:T,exitCode:v}}close(){if(d(this,S,"f"))return;g(this,S,!0,"f");let t=d(this,E,"f");g(this,E,null,"f"),t?.resolve(),d(this,y,"f").stdout.destroy(),d(this,y,"f").stderr.destroy(),d(this,y,"f").stdin.destroy();try{process.kill(-d(this,y,"f").pid,"SIGKILL")}catch{d(this,y,"f").kill("SIGKILL")}d(this,y,"f").unref()}};y=new WeakMap,_=new WeakMap,I=new WeakMap,S=new WeakMap,E=new WeakMap,P=new WeakSet,U=function(t){if(g(this,_,d(this,_,"f")+t,"f"),d(this,_,"f").length>X&&(g(this,_,d(this,_,"f").slice(d(this,_,"f").length-X),"f"),g(this,I,!0,"f")),d(this,E,"f")&&d(this,_,"f").indexOf(d(this,E,"f").sentinel)>=0){let e=d(this,E,"f");g(this,E,null,"f"),e.resolve()}};function Et(r){let t,e=Promise.resolve();return O({name:"bash",description:"Run a bash command in a persistent shell. State (cwd, env vars) persists across calls.",inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to run"},restart:{type:"boolean",description:"Restart the persistent shell before running"},timeout_ms:{type:"integer",description:"Per-call timeout in milliseconds"}}},run:async({command:i,restart:n,timeout_ms:s},o)=>{let a=e,c=W();e=c.promise;try{await a}catch{}try{if(n&&(t?.close(),t=void 0),!i){if(n)return"bash session restarted";throw new u("bash: command is required")}t??(t=new C(r.workdir,r.env));try{let{output:f,exitCode:l}=await t.exec(i,{timeoutMs:s??Q,signal:o?.signal});if(l!==0)throw new u(f||`exit ${l}`);return f}catch(f){throw f instanceof u?f:(t.close(),t=void 0,new u(`bash: ${f instanceof Error?f.message:String(f)}`))}}finally{c.resolve()}},close:()=>{t?.close(),t=void 0}})}function Ot(r){return O({name:"read",description:"Read a UTF-8 text file relative to the workdir.",inputSchema:{type:"object",properties:{file_path:{type:"string"},view_range:{type:"array",items:{type:"integer"},description:"[start_line, end_line] 1-indexed inclusive"}},required:["file_path"]},run:async({file_path:t,view_range:e})=>{if(!t)throw new u("read: file_path is required");let i=await M(r,t),n;try{let l=await h.stat(i);if(!l.isFile())throw new u(`read: ${t} is not a regular file`);let v=tt(r.maxFileBytes);if(v!==null&&l.size>v)throw new u(`read: ${t} is ${l.size} bytes, exceeds ${v}-byte limit. Use bash (head/tail/sed) to read a slice.`);n=await h.readFile(i,"utf8")}catch(l){throw l instanceof u?l:new u(`read: ${A(l,t)}`)}if(!e)return n;if(e.length!==2)throw new u("read: view_range must be [start_line, end_line]");let[s,o]=e,a=n.split(`
|
|
8
|
+
`),c=Math.max(0,s-1),f=o>0?o:a.length;return a.slice(c,f).join(`
|
|
9
|
+
`)}})}function St(r){return O({name:"write",description:"Write a UTF-8 text file relative to the workdir, creating parent directories as needed.",inputSchema:{type:"object",properties:{file_path:{type:"string"},content:{type:"string"}},required:["file_path","content"]},run:async({file_path:t,content:e})=>{if(!t)throw new u("write: file_path is required");let i=await M(r,t);try{await h.mkdir(p.dirname(i),{recursive:!0,mode:x}),await q(i,e??"")}catch(n){throw new u(`write: ${A(n,t)}`)}return`wrote ${Buffer.byteLength(e??"")} bytes to ${t}`}})}function Tt(r){return O({name:"edit",description:"Replace old_string with new_string in a file. old_string must be unique unless replace_all.",inputSchema:{type:"object",properties:{file_path:{type:"string"},old_string:{type:"string"},new_string:{type:"string"},replace_all:{type:"boolean"}},required:["file_path","old_string","new_string"]},run:async({file_path:t,old_string:e,new_string:i,replace_all:n})=>{if(!t)throw new u("edit: file_path is required");if(!e)throw new u("edit: old_string is required");let s=await M(r,t),o;try{let f=await h.stat(s);if(!f.isFile())throw new u(`edit: ${t} is not a regular file`);let l=tt(r.maxFileBytes);if(l!==null&&f.size>l)throw new u(`edit: ${t} is ${f.size} bytes, exceeds ${l}-byte limit. Use bash (sed/awk) to edit a large file.`);o=await h.readFile(s,"utf8")}catch(f){throw f instanceof u?f:new u(`edit: ${A(f,t)}`)}let a=o.split(e).length-1;if(a===0)throw new u(`edit: old_string not found in ${t}`);let c;if(n)c=o.split(e).join(i);else{if(a>1)throw new u(`edit: old_string appears ${a} times in ${t} (must be unique)`);c=o.replace(e,()=>i)}try{await q(s,c)}catch(f){throw new u(`edit: write: ${A(f,t)}`)}return`edited ${t} (${n?a:1} replacement(s))`}})}function xt(r){return O({name:"glob",description:"Match files under the workdir against a glob pattern. Results are mtime-sorted, newest first.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string",description:"Directory to search in. Defaults to the workdir."}},required:["pattern"]},run:async({pattern:t,path:e})=>{if(!t)throw new u("glob: pattern is required");let i=p.resolve(r.workdir),n=t;if(p.isAbsolute(t)){if(!r.unrestrictedPaths)throw new u("glob: absolute pattern not permitted");i=p.parse(t).root,n=p.relative(i,t)}else e&&(i=await M(r,e));if(!r.unrestrictedPaths&&n.split(/[\\/]/).includes(".."))throw new u('glob: ".." is not permitted in the pattern');let s=r.unrestrictedPaths?i:await h.realpath(i).catch(()=>i),o=[];try{for await(let a of $t(n,{cwd:i,withFileTypes:!0,exclude:c=>c.name===".git"||c.name==="node_modules"})){if(!a.isFile())continue;let c=p.join(a.parentPath,a.name);if(!r.unrestrictedPaths){let l;try{l=await h.realpath(c)}catch{continue}if(!Mt(s,l))continue}let f=0;try{f=(await h.stat(c)).mtimeMs}catch{}o.push({path:c,mtime:f})}}catch(a){throw new u(`glob: ${a instanceof Error?a.message:String(a)}`)}return o.length===0?"no matches":(o.sort((a,c)=>c.mtime-a.mtime),o.slice(0,_t).map(a=>a.path).join(`
|
|
10
|
+
`))}})}function At(r){return O({name:"grep",description:"Search file contents for a regex. Uses ripgrep if available, otherwise a built-in walker.",inputSchema:{type:"object",properties:{pattern:{type:"string"},path:{type:"string"}},required:["pattern"]},run:async({pattern:t,path:e},i)=>{if(!t)throw new u("grep: pattern is required");let n=p.resolve(r.workdir);e&&(n=await M(r,e));let s=await Lt();return s?It(s,t,n,i?.signal):Rt(t,n,i?.signal)}})}function It(r,t,e,i){return new Promise((n,s)=>{let o=J.spawn(r,["-n","--no-heading","-e",t,"--",e],{...i?{signal:i}:{}}),a="",c="",f=!1;o.stdout.on("data",l=>{f||(a+=l,a.length>R&&(f=!0,a=a.slice(0,R),o.kill("SIGKILL")))}),o.stderr.on("data",l=>c+=l),o.on("close",l=>{if(i?.aborted)return s(new u("grep: aborted"));if(f)return n(a+`
|
|
11
|
+
[output truncated at ${R} bytes]`);if(l===0)return n(a);if(l===1)return n("no matches");s(new u(`grep: rg failed: ${c||`exit ${l}`}`))}),o.on("error",l=>{if(i?.aborted)return s(new u("grep: aborted"));s(new u(`grep: rg failed: ${l.message}`))})})}async function Rt(r,t,e){let i;try{i=new RegExp(r)}catch(c){throw new u(`grep: invalid regex: ${c instanceof Error?c.message:String(c)}`)}let n=[],s=R,o=c=>(s-=c.length+1,s<0?(n.push(`[output truncated at ${R} bytes]`),!1):(n.push(c),!0));if((await h.stat(t).catch(()=>null))?.isFile()?await Z(t,i,o):await Ft(t,"",c=>Z(p.join(t,c),i,o),e),e?.aborted)throw new u("grep: aborted");return n.length===0?"no matches":n.join(`
|
|
12
|
+
`)}async function Z(r,t,e){let i=F.createReadStream(r,{encoding:"utf8"}),n=Y.createInterface({input:i,crlfDelay:1/0}),s=0;try{for await(let o of n)if(s++,!(o.length>bt)&&t.test(o)&&!e(`${r}:${s}:${o}`))return!1}catch{}finally{i.destroy()}return!0}function Mt(r,t){let e=p.relative(r,t);return e===""||!e.startsWith(".."+p.sep)&&e!==".."&&!p.isAbsolute(e)}var Nt=40,Pt=5e4;async function Ft(r,t,e,i){let n=Pt;async function s(o,a){if(a>Nt)return!0;if(i?.aborted)return!1;let c;try{c=await h.readdir(p.join(r,o),{withFileTypes:!0})}catch{return!0}for(let f of c){if(f.name===".git"||f.name==="node_modules")continue;if(n--<=0||i?.aborted)return!1;let l=o?p.join(o,f.name):f.name;if(f.isDirectory()){if(!await s(l,a+1))return!1}else if(f.isFile()&&await e(l)===!1)return!1}return!0}await s(t,0)}async function Lt(){let r=(process.env.PATH??"").split(p.delimiter);for(let t of r){let e=p.join(t,"rg");try{return await h.access(e,F.constants.X_OK),e}catch{}}return null}export{C as BashSession,ae as betaAgentToolset20260401,Et as betaBashTool,Tt as betaEditTool,xt as betaGlobTool,At as betaGrepTool,Ot as betaReadTool,St as betaWriteTool,K as extractSkillArchive,M as resolvePath,z as resolveSkillVersion,pt as setupSkills};
|