agentix-cli 0.105.1 → 0.106.0
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/dist/{App-HQKQH7ER.js → App-PVMJEC3G.js} +2 -2
- package/dist/{ChatApp-DE7QNKTD.js → ChatApp-GWIOURQL.js} +2 -2
- package/dist/{agent-LYZ3FCFB.js → agent-IOHJGUZT.js} +2 -2
- package/dist/{board-dashboard-Q7K4ZJ2S.js → board-dashboard-OA4WFL3D.js} +4 -4
- package/dist/{chunk-MORQGMXG.js → chunk-3IEFHOPH.js} +2 -2
- package/dist/{chunk-ZLLJQICH.js → chunk-4MESMUND.js} +2 -2
- package/dist/{chunk-WCSVPH5M.js → chunk-5D5NKZSD.js} +2 -2
- package/dist/{chunk-DTO22ALU.js → chunk-CHQ5Q4QO.js} +2 -2
- package/dist/{chunk-LTS4A7AP.js → chunk-CZFGADZ2.js} +2 -2
- package/dist/{chunk-OLZVLA4T.js → chunk-DJMK22SB.js} +2 -2
- package/dist/{chunk-RQ4J2WHD.js → chunk-GGB5JMII.js} +2 -2
- package/dist/chunk-H5LQXHQQ.js +54 -0
- package/dist/chunk-H5LQXHQQ.js.map +1 -0
- package/dist/{chunk-Y4KJCUQO.js → chunk-HRX7FIOO.js} +2 -2
- package/dist/{chunk-4HBRZGW3.js → chunk-MTP2RH3P.js} +2 -2
- package/dist/{chunk-PGW64HAT.js → chunk-PWTSY77F.js} +2 -2
- package/dist/{chunk-UVE624RW.js → chunk-QCKUXJJ3.js} +2 -2
- package/dist/{chunk-WY3EV2FB.js → chunk-SGOXLRY4.js} +2 -2
- package/dist/{chunk-7ZSGT4NO.js → chunk-UW6RUGNV.js} +2 -2
- package/dist/{chunk-5NXB5YHK.js → chunk-UZ5Q6Q2X.js} +244 -237
- package/dist/chunk-UZ5Q6Q2X.js.map +1 -0
- package/dist/{chunk-D6BN5AIP.js → chunk-VYSFOONA.js} +2 -2
- package/dist/{chunk-GWZMRGQO.js → chunk-W3LSDADF.js} +2 -2
- package/dist/{chunk-5XRD5DDP.js → chunk-YSMPXFQR.js} +74 -72
- package/dist/chunk-YSMPXFQR.js.map +1 -0
- package/dist/{chunk-WT7MLOMA.js → chunk-YZJCOWHU.js} +2 -2
- package/dist/{chunk-QDIEP4NK.js → chunk-ZD5ECP5D.js} +2 -2
- package/dist/{chunk-27IFUCJ6.js → chunk-ZROS7GX2.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-GLZXM7T3.js → client-DLRQIQZU.js} +2 -2
- package/dist/config-32FKG36S.js +2 -0
- package/dist/config-mutator-2VM2FWRF.js +2 -0
- package/dist/{doctor-JNHPILIA.js → doctor-ALOXJM5G.js} +2 -2
- package/dist/index.d.ts +90 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{program-UA4WZRTD.js → program-DSUZFBJZ.js} +138 -138
- package/dist/{program-UA4WZRTD.js.map → program-DSUZFBJZ.js.map} +1 -1
- package/dist/{promote-2HKB5NOG.js → promote-SXH7DKMC.js} +2 -2
- package/dist/{query-OR2CWXUA.js → query-WKBSHVWZ.js} +2 -2
- package/dist/registry-DAWQT4D4.js +2 -0
- package/dist/{request-planner-ASZDSP2Q.js → request-planner-GV5NAXQ5.js} +2 -2
- package/dist/{review-candidates-PDTQVHFG.js → review-candidates-AWIUSB3O.js} +2 -2
- package/dist/{routing-EFZBY6WW.js → routing-35ETOM24.js} +2 -2
- package/dist/schedule-tool-BXRRN3IE.js +2 -0
- package/dist/scheduler-PIZG2JA4.js +2 -0
- package/dist/{seat-5A73RLRK.js → seat-EQKPGMJE.js} +2 -2
- package/dist/{select-CODD2FVV.js → select-RJCBMM3O.js} +2 -2
- package/dist/{set-enabled-2COGGCQQ.js → set-enabled-ADQH7VKE.js} +2 -2
- package/dist/{tool-3X755YK2.js → tool-JPHWWTZI.js} +2 -2
- package/dist/{tool-LNPR4PNJ.js → tool-K4MU42KH.js} +2 -2
- package/dist/wiki-RHHHYUTK.js +2 -0
- package/package.json +2 -1
- package/dist/chunk-5NXB5YHK.js.map +0 -1
- package/dist/chunk-5XRD5DDP.js.map +0 -1
- package/dist/chunk-73TOQOLZ.js +0 -54
- package/dist/chunk-73TOQOLZ.js.map +0 -1
- package/dist/config-X7GKGKLR.js +0 -2
- package/dist/config-mutator-FCJVNIY5.js +0 -2
- package/dist/registry-ER6WLLPN.js +0 -2
- package/dist/schedule-tool-63WNEZPE.js +0 -2
- package/dist/scheduler-IFHH326C.js +0 -2
- package/dist/wiki-REOU5NBI.js +0 -2
- /package/dist/{App-HQKQH7ER.js.map → App-PVMJEC3G.js.map} +0 -0
- /package/dist/{ChatApp-DE7QNKTD.js.map → ChatApp-GWIOURQL.js.map} +0 -0
- /package/dist/{agent-LYZ3FCFB.js.map → agent-IOHJGUZT.js.map} +0 -0
- /package/dist/{board-dashboard-Q7K4ZJ2S.js.map → board-dashboard-OA4WFL3D.js.map} +0 -0
- /package/dist/{chunk-MORQGMXG.js.map → chunk-3IEFHOPH.js.map} +0 -0
- /package/dist/{chunk-ZLLJQICH.js.map → chunk-4MESMUND.js.map} +0 -0
- /package/dist/{chunk-WCSVPH5M.js.map → chunk-5D5NKZSD.js.map} +0 -0
- /package/dist/{chunk-DTO22ALU.js.map → chunk-CHQ5Q4QO.js.map} +0 -0
- /package/dist/{chunk-LTS4A7AP.js.map → chunk-CZFGADZ2.js.map} +0 -0
- /package/dist/{chunk-OLZVLA4T.js.map → chunk-DJMK22SB.js.map} +0 -0
- /package/dist/{chunk-RQ4J2WHD.js.map → chunk-GGB5JMII.js.map} +0 -0
- /package/dist/{chunk-Y4KJCUQO.js.map → chunk-HRX7FIOO.js.map} +0 -0
- /package/dist/{chunk-4HBRZGW3.js.map → chunk-MTP2RH3P.js.map} +0 -0
- /package/dist/{chunk-PGW64HAT.js.map → chunk-PWTSY77F.js.map} +0 -0
- /package/dist/{chunk-UVE624RW.js.map → chunk-QCKUXJJ3.js.map} +0 -0
- /package/dist/{chunk-WY3EV2FB.js.map → chunk-SGOXLRY4.js.map} +0 -0
- /package/dist/{chunk-7ZSGT4NO.js.map → chunk-UW6RUGNV.js.map} +0 -0
- /package/dist/{chunk-D6BN5AIP.js.map → chunk-VYSFOONA.js.map} +0 -0
- /package/dist/{chunk-GWZMRGQO.js.map → chunk-W3LSDADF.js.map} +0 -0
- /package/dist/{chunk-WT7MLOMA.js.map → chunk-YZJCOWHU.js.map} +0 -0
- /package/dist/{chunk-QDIEP4NK.js.map → chunk-ZD5ECP5D.js.map} +0 -0
- /package/dist/{chunk-27IFUCJ6.js.map → chunk-ZROS7GX2.js.map} +0 -0
- /package/dist/{client-GLZXM7T3.js.map → client-DLRQIQZU.js.map} +0 -0
- /package/dist/{config-X7GKGKLR.js.map → config-32FKG36S.js.map} +0 -0
- /package/dist/{config-mutator-FCJVNIY5.js.map → config-mutator-2VM2FWRF.js.map} +0 -0
- /package/dist/{doctor-JNHPILIA.js.map → doctor-ALOXJM5G.js.map} +0 -0
- /package/dist/{promote-2HKB5NOG.js.map → promote-SXH7DKMC.js.map} +0 -0
- /package/dist/{query-OR2CWXUA.js.map → query-WKBSHVWZ.js.map} +0 -0
- /package/dist/{registry-ER6WLLPN.js.map → registry-DAWQT4D4.js.map} +0 -0
- /package/dist/{request-planner-ASZDSP2Q.js.map → request-planner-GV5NAXQ5.js.map} +0 -0
- /package/dist/{review-candidates-PDTQVHFG.js.map → review-candidates-AWIUSB3O.js.map} +0 -0
- /package/dist/{routing-EFZBY6WW.js.map → routing-35ETOM24.js.map} +0 -0
- /package/dist/{schedule-tool-63WNEZPE.js.map → schedule-tool-BXRRN3IE.js.map} +0 -0
- /package/dist/{scheduler-IFHH326C.js.map → scheduler-PIZG2JA4.js.map} +0 -0
- /package/dist/{seat-5A73RLRK.js.map → seat-EQKPGMJE.js.map} +0 -0
- /package/dist/{select-CODD2FVV.js.map → select-RJCBMM3O.js.map} +0 -0
- /package/dist/{set-enabled-2COGGCQQ.js.map → set-enabled-ADQH7VKE.js.map} +0 -0
- /package/dist/{tool-3X755YK2.js.map → tool-JPHWWTZI.js.map} +0 -0
- /package/dist/{tool-LNPR4PNJ.js.map → tool-K4MU42KH.js.map} +0 -0
- /package/dist/{wiki-REOU5NBI.js.map → wiki-RHHHYUTK.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as $e}from"./chunk-GTJIKXDB.js";import{a as te,b as w}from"./chunk-DG5I6PPM.js";import{q as zt}from"./chunk-S2GAEH2F.js";import{t as Ut,u as Ht}from"./chunk-
|
|
1
|
+
import{a as $e}from"./chunk-GTJIKXDB.js";import{a as te,b as w}from"./chunk-DG5I6PPM.js";import{q as zt}from"./chunk-S2GAEH2F.js";import{t as Ut,u as Ht}from"./chunk-4MESMUND.js";import{d as Ft,e as Bt}from"./chunk-AQASR6KR.js";import{b as qt,c as ve,e as B,f as U,h as Kt}from"./chunk-E5OV6RTG.js";import{A as Se,b as ke,v as Dt,x as ee,y as xe}from"./chunk-ZD5ECP5D.js";import{a as jt,b as Vt,d as Wt}from"./chunk-Y4CYQV7G.js";import{a as Et,b as Tt}from"./chunk-SHEUCITK.js";import{g as Pt,h as Lt,i as Mt,k as Ot,l as Nt}from"./chunk-GGB5JMII.js";import{q as Ct}from"./chunk-CZFGADZ2.js";import{a as It,b as _t}from"./chunk-5D5NKZSD.js";import{$ as we,A as Hr,ga as $t,ha as Rt,ka as At,n as Q,o as wt,p as kt,q as Fr,y as St,z as vt}from"./chunk-H5LQXHQQ.js";import{a as xt,i as Ur}from"./chunk-RJ7DASOU.js";import{a as be,h as Br}from"./chunk-BRK6M6LA.js";import{existsSync as zr,readdirSync as qr,readFileSync as Kr,statSync as Gr}from"fs";import{resolve as Xr}from"path";function Gt(t,e,n=Date.now(),i=7){let r=i*864e5,s=new Map;for(let o of e){let a=s.get(o.workflowId);a?a.push(o):s.set(o.workflowId,[o])}return t.map(o=>{let a=s.get(o.id)??[],c=a.filter(g=>n-g.at<=r),l=a.filter(g=>n-g.at>r&&n-g.at<=r*2),u=c.filter(g=>g.status==="failed").length,d=a.filter(g=>g.status==="paused").length,p=a.length?Math.max(...a.map(g=>g.at)):null,f=a.length?l.length>0&&c.length===0?"dormant":c.length>0&&u*2>=c.length?"failing":c.length>0?"active":"quiet":"never";return{id:o.id,name:o.name||o.id,state:f,lastRunAt:p,recent:c.length,prior:l.length,failed:u,paused:d}}).sort((o,a)=>{let c={dormant:0,failing:1,active:2,quiet:3,never:4};return c[o.state]-c[a.state]||(a.lastRunAt??0)-(o.lastRunAt??0)})}var ne=new Map;function ga(t,e=1e3){if(!zr(t))return[];let n=qr(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let o=Xr(t,s);return{path:o,mtime:Gr(o).mtimeMs}}).sort((s,o)=>o.mtime-s.mtime).slice(0,e),i=new Set(n.map(s=>s.path));for(let s of ne.keys())i.has(s)||ne.delete(s);let r=[];for(let{path:s,mtime:o}of n){let a=ne.get(s);if(a&&a.mtime===o){a.summary&&r.push(a.summary);continue}let c=Jr(s,o);ne.set(s,{mtime:o,summary:c}),c&&r.push(c)}return r}function Jr(t,e){try{let n=Kr(t,"utf-8").split(`
|
|
2
2
|
`).filter(Boolean);if(!n.length)return null;let i=JSON.parse(n[0]),r=i.run?.workflowId;if(!r)return null;let s=i.run?.status??"unknown";for(let o=n.length-1;o>=0;o--){let a=JSON.parse(n[o]),c=a.status??a.run?.status;if(c){s=c;break}}return{workflowId:r,status:s,at:e}}catch{return null}}var Yr={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},k={routines:200,summary:160,filters:6,filterValue:60,text:120},Zr=(t,e,n)=>{try{return Ct(t,e,n)}catch{return null}},Xt=864e5;function ba(t){let e=t.now??Date.now(),n={...Yr,...t.thresholds},i=t.nextFire??Zr,r=[];for(let a of t.crons){let c=t.cronRuns.get(a.id)??[],l=a.timezone||"UTC",u=c.map(f=>({at:Date.parse(f.startedAt),status:f.status})),d=c[0],p={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:$(a.id,k.text),trigger:{schedule:$(a.schedule,k.text),timezone:l},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?Re(a.nextRun)??Re(i(a.schedule,new Date(e),l)):null,lastRun:d?{at:d.startedAt,status:d.status,summary:ii(d.status==="success"?void 0:d.errorSummary,k.summary)}:null,lastSuccessAt:c.find(f=>f.status==="success")?.startedAt??null,consecutiveFailures:Jt(u),sampledRuns:c.length,flags:[],attention:null};p.flags=Yt(p,u,a.schedule,l,null,e,n,i),r.push(Zt(p))}let s=new Map(Gt(t.workflows.map(a=>({id:a.id,name:a.title})),t.workflowRuns,e).map(a=>[a.id,a])),o=new Map;for(let a of t.workflowRuns){let c=o.get(a.workflowId);c?c.push(a):o.set(a.workflowId,[a])}for(let a of t.workflows){let c=a.nodes.find(I=>I.type.startsWith("trigger."));if(!c||c.type!=="trigger.cron"&&c.type!=="trigger.hook")continue;let l=c.config??{},u=a.state||"active",d=u==="active",p=(o.get(a.id)??[]).slice().sort((I,ye)=>ye.at-I.at),f=p.map(I=>({at:I.at,status:ti(I.status)})),g=f[0],h=c.type==="trigger.cron",y=typeof l.spec=="string"?l.spec:"",D=typeof l.timezone=="string"?l.timezone:"UTC",N={id:`workflow:${a.id}`,source:"workflow",kind:h?"schedule":"event",name:$(a.title||a.id,k.text),trigger:h?{schedule:$(y,k.text),timezone:D}:{event:$(typeof l.event=="string"?l.event:"",k.text),filters:ri(l.filter,a)},agent:ni(a),enabled:d,state:u,nextRunAt:h&&d&&y?Re(i(y,new Date(e),D)):null,lastRun:g?{at:new Date(g.at).toISOString(),status:g.status}:null,lastSuccessAt:(()=>{let I=f.find(ye=>ye.status==="success");return I?new Date(I.at).toISOString():null})(),consecutiveFailures:Jt(f),sampledRuns:p.length,flags:[],attention:null},Z=Date.parse(a.updated||a.created||"");N.flags=h?Yt(N,f,y,D,Number.isFinite(Z)?Z:null,e,n,i):Qr(N,s.get(a.id)?.state==="dormant",Number.isFinite(Z)?Z:null,e,n),r.push(Zt(N))}return r.sort(ei).slice(0,k.routines)}function Jt(t){let e=0;for(let n of t)if(!(n.status==="running"||n.status==="paused"||n.status==="unknown"))if(n.status==="failed"||n.status==="timeout")e++;else break;return e}function Yt(t,e,n,i,r,s,o,a){let c=[],l=e.length?e[0].at:null;if(!t.enabled){let p=en(l,r,s,o);return p&&c.push(p),c}if(t.consecutiveFailures>=o.failStreak&&c.push({reason:"failing",detail:`${t.consecutiveFailures} failed attempts in a row`}),l===null)return c.push({reason:"never-ran",detail:"No persisted attempt"}),c;let u=new Date(l),d=null;for(let p=0;p<o.missedFires&&(d=a(n,u,i),!!d);p++)u=d;return d&&s>d.getTime()+o.graceMs&&c.push({reason:"overdue",detail:`No attempt since ${new Date(l).toISOString()}; ${o.missedFires} scheduled fires missed`}),c}function Qr(t,e,n,i,r){let s=[],o=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=en(o,n,i,r);return a&&s.push(a),s}return t.consecutiveFailures>=r.failStreak&&s.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),o===null?s.push({reason:"never-ran",detail:"No run recorded for this trigger"}):e&&s.push({reason:"dormant",detail:"Fired in the prior week, silent in the last one"}),s}function en(t,e,n,i){let r=Math.max(t??0,e??0);return r&&n-r<i.disabledDays*Xt?null:{reason:"disabled-long",detail:r?`Disabled; no activity for ${Math.floor((n-r)/Xt)} days`:"Disabled and never ran"}}function Zt(t){let e=new Set(t.flags.map(n=>n.reason));return t.attention=e.has("failing")?"critical":e.has("overdue")||e.has("dormant")||e.has("never-ran")?"warning":e.has("disabled-long")?"info":null,t}var Qt={critical:0,warning:1,info:2};function ei(t,e){let n=t.attention?Qt[t.attention]:3,i=e.attention?Qt[e.attention]:3;return n-i||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function ti(t){switch(t){case"completed":case"ok":return"success";case"failed":return"failed";case"timeout":return"timeout";case"canceled":return"canceled";case"running":return"running";case"paused":return"paused";default:return"unknown"}}function ni(t){if(t.ownerAgent)return $(t.ownerAgent,k.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?$(String(e.config.agentId),k.text):null}function ri(t,e){let n=[],i=e?.project;if(i&&n.push($(`project=${i}`,k.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[r,s]of Object.entries(t)){let o=Array.isArray(s)?s.map(String):s==null?[]:[String(s)];o.length&&n.push($(`${r}=${o.join(",")}`,k.filterValue))}return n.slice(0,k.filters)}function Re(t){if(!t)return null;let e=t instanceof Date?t:new Date(t);return Number.isFinite(e.getTime())?e.toISOString():null}function $(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}function ii(t,e){return t===void 0?void 0:$(t,e)}import{existsSync as se,readdirSync as Si,readFileSync as vi}from"fs";import{resolve as E}from"path";import{randomBytes as rn}from"crypto";import{existsSync as oi,mkdirSync as ai,readdirSync as ci,readFileSync as li,renameSync as sn,unlinkSync as ui,writeFileSync as di}from"fs";import{resolve as on}from"path";function tn(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var si=t=>t.trim().split(`
|
|
3
3
|
`).pop()?.slice(0,300)||"no output";async function nn(t,e,n,i=$e){let r=await i(t.bin,[...tn(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return r.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${si(r.stderr||r.stdout)}`}}async function xa(t,e,n,i,r=$e){return(await r(t.bin,[...tn(t),"--read-only","media","download","--chat",e,"--id",n,"--output",i],{timeoutMs:12e4})).code===0}var pi=2e3,fi=t=>nn(t.wacli,t.to,t.text);function Ae(t){return on(t,".agentx","whatsapp-triage","drafts")}var gi=t=>/^[a-z0-9-]{8,64}$/.test(t),re=(t,e)=>on(Ae(t),`${e}.json`);function an(t,e){ai(Ae(t),{recursive:!0});let n=re(t,e.id),i=`${n}.${process.pid}.tmp`;di(i,JSON.stringify(e,null,2)+`
|
|
4
4
|
`,{mode:384}),sn(i,n)}function Ia(t,e,n=Date.now()){let i=e.text.trim().slice(0,pi);if(!i)throw new Error("empty draft");let r={...e,text:i,id:`${n.toString(36)}-${rn(4).toString("hex")}`,status:"pending",created_at:new Date(n).toISOString()};return an(t,r),r}function ie(t,e){if(!gi(e))return null;try{return JSON.parse(li(re(t,e),"utf-8"))}catch{return null}}function cn(t,e){let n=Ae(t);return oi(n)?ci(n).filter(i=>i.endsWith(".json")).map(i=>ie(t,i.slice(0,-5))).filter(i=>!!i&&(!e||i.status===e)).sort((i,r)=>i.created_at.localeCompare(r.created_at)):[]}async function ln(t,e,n,i={}){let r=ie(t,e);if(!r||r.status!=="pending")return{ok:!1,error:`no reply draft "${e}" is waiting`};let s=`${re(t,e)}.${process.pid}.${rn(3).toString("hex")}.claim`;try{sn(re(t,e),s)}catch{return{ok:!1,error:`reply draft "${e}" is already being decided`}}let o={...r,decided_by:i.by??"operator",decided_at:new Date(i.now??Date.now()).toISOString()};if(n==="no")o.status="rejected";else{let a=await(i.send??fi)(r).catch(c=>({ok:!1,error:String(c?.message??c)}));a.ok?o.status="sent":(o.status="failed",o.error=a.error)}an(t,o);try{ui(s)}catch{}return o.status==="failed"?{ok:!1,error:o.error??"send failed"}:{ok:!0,draft:o}}import{mkdirSync as mi,readFileSync as hi,renameSync as yi,writeFileSync as bi}from"fs";import{resolve as wi}from"path";function un(t){return wi(ve(t),"_state.json")}function R(t){try{let e=JSON.parse(hi(un(t),"utf-8"));return{snoozed:e&&typeof e.snoozed=="object"&&e.snoozed?e.snoozed:{},...typeof e?.lastDigest=="string"?{lastDigest:e.lastDigest}:{},...e?.popped&&typeof e.popped=="object"?{popped:e.popped}:{},...typeof e?.passAt=="string"?{passAt:e.passAt}:{},...Array.isArray(e?.wanted)?{wanted:e.wanted.filter(n=>typeof n=="string")}:{}}}catch{return{snoozed:{}}}}function H(t,e){mi(ve(t),{recursive:!0});let n=un(t),i=`${n}.${process.pid}.tmp`;bi(i,JSON.stringify(e,null,2)+`
|
|
@@ -479,4 +479,4 @@ Document the arguments, commands, or files the skill expects. Example:
|
|
|
479
479
|
claude-code ${bt(t)} --arg value
|
|
480
480
|
\`\`\`
|
|
481
481
|
`}At();var Nr={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function jr(t){return{...Nr,...t??{},regions:{...t?.regions??{}},buffer:{...Nr.buffer,...t?.buffer??{}}}}function Eu(t){try{return jr(Rt(t).screen)}catch{return jr(void 0)}}var da=/^[a-z][\w-]*$/,Vr=["window","screen","menubar","notifications"];function Y(t,e,n,i){let r=Number(t);if(t===""||t===null||!Number.isFinite(r)||!n(r))throw new Error(`${e} must be ${i}`);return r}var he=(t,e)=>Y(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function Wr(t){let e=typeof t=="string"?t.split(",").map(Number):[t?.x,t?.y,t?.width,t?.height].map(Number);if(e.length!==4||!e.every(Number.isFinite)||e[2]<=0||e[3]<=0)throw new Error("a region is x,y,width,height in screen points, with width and height above 0");return{x:e[0],y:e[1],width:e[2],height:e[3]}}function Tu(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=he(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=he(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=he(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=Y(e.stableMs,"stableMs",r=>Number.isInteger(r)&&r>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=Y(e.changeThreshold,"changeThreshold",r=>r>=0&&r<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let r={...n.regions??{}};for(let[s,o]of Object.entries(e.regions)){if(!da.test(s))throw new Error(`region name "${s}" must be lowercase letters, digits, - or _`);o===null?delete r[s]:r[s]=Wr(o)}n.regions=r}if(e.buffer&&typeof e.buffer=="object"){let r=e.buffer,s={...n.buffer??{}};"enabled"in r&&(s.enabled=!!r.enabled),"seconds"in r&&(s.seconds=Y(r.seconds,"buffer.seconds",o=>o>0&&o<=120,"above 0 and at most 120")),"fps"in r&&(s.fps=Y(r.fps,"buffer.fps",o=>o>0&&o<=10,"above 0 and at most 10")),"maxPixels"in r&&(s.maxPixels=he(r.maxPixels,"buffer.maxPixels")),"region"in r&&(s.region=String(r.region).trim()),n.buffer=s}let i=n.buffer?.region;if(i!==void 0&&!Vr.includes(i)&&!n.regions?.[i])try{Wr(i)}catch{throw new Error(`buffer.region "${i}" is not a region \u2014 use ${[...Vr,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Gt as a,ga as b,Ze as c,js as d,Vs as e,Gc as f,Xc as g,Jc as h,Qn as i,Zc as j,el as k,T as l,er as m,k as n,ba as o,xa as p,fi as q,Ia as r,ln as s,R as t,Ta as u,Pa as v,gn as w,Va as x,z as y,Qa as z,wn as A,rl as B,gr as C,Dl as D,El as E,Nl as F,_o as G,jl as H,tc as I,nc as J,rc as K,ic as L,sc as M,oc as N,cc as O,lc as P,bc as Q,Le as R,wc as S,kc as T,q as U,K as V,Lo as W,Kl as X,Gl as Y,Xl as Z,Jl as _,ot as $,Yl as aa,Ne as ba,je as ca,de as da,is as ea,os as fa,Rc as ga,We as ha,Fe as ia,as as ja,cs as ka,Vn as la,Un as ma,Ac as na,ds as oa,Ic as pa,ws as qa,Ss as ra,Be as sa,$s as ta,Hn as ua,P as va,Ar as wa,Ir as xa,_r as ya,ru as za,Uo as Aa,Dr as Ba,Er as Ca,gu as Da,mu as Ea,sa as Fa,hu as Ga,Pr as Ha,pe as Ia,Vc as Ja,Jn as Ka,Ue as La,Je as Ma,qc as Na,ku as Oa,xu as Pa,Su as Qa,vu as Ra,$u as Sa,Ru as Ta,Au as Ua,Iu as Va,_u as Wa,Nr as Xa,jr as Ya,Eu as Za,Vr as _a,Tu as $a};
|
|
482
|
-
//# sourceMappingURL=chunk-
|
|
482
|
+
//# sourceMappingURL=chunk-YZJCOWHU.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as tt,c as nt}from"./chunk-GLQLCBJS.js";import{c as Ze}from"./chunk-SZDACK6O.js";import{b as ce}from"./chunk-AFRHKA7B.js";import{b as qe,e as Ye,f as Ge,i as Qe,k as Xe,l as et,q as rt}from"./chunk-
|
|
1
|
+
import{b as tt,c as nt}from"./chunk-GLQLCBJS.js";import{c as Ze}from"./chunk-SZDACK6O.js";import{b as ce}from"./chunk-AFRHKA7B.js";import{b as qe,e as Ye,f as Ge,i as Qe,k as Xe,l as et,q as rt}from"./chunk-CZFGADZ2.js";import{c as Ke,e as ze,f as Je}from"./chunk-KA2UIZXG.js";import{e as He,g as Ue,h as Be,i as de}from"./chunk-GQ76J72O.js";import{a as Ve}from"./chunk-GV7S5BAX.js";import{a as _e,b as oe,c as se,d as Le,e as ae}from"./chunk-QD6IICK7.js";import{v as Ce,w as hn}from"./chunk-CHQ5Q4QO.js";import{b as Me,f as mn}from"./chunk-72SZI2UW.js";import{c as We,d as je}from"./chunk-QOYAX2FT.js";import{a as ie,i as gn}from"./chunk-RJ7DASOU.js";import{existsSync as yn,mkdirSync as it,readFileSync as wn,writeFileSync as kn,renameSync as bn}from"fs";import{resolve as ot,dirname as vn}from"path";var st=class{filePath;log;constructor(e={}){let t=e.baseDir??ot(process.cwd(),".agentx");this.filePath=ot(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),it(t,{recursive:!0})}key(e,t,n){return`${e}::${t}::${n||"-"}`}load(){if(!yn(this.filePath))return{version:1,overrides:{}};try{let e=wn(this.filePath,"utf-8"),t=JSON.parse(e);return!t||typeof t!="object"?{version:1,overrides:{}}:(t.overrides||(t.overrides={}),t)}catch(e){return this.log(`load failed, starting empty: ${e?.message||e}`),{version:1,overrides:{}}}}save(e){it(vn(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;kn(t,JSON.stringify(e,null,2)),bn(t,this.filePath)}get(e,t,n){let o=this.load().overrides[this.key(e,t,n)];if(o&&!(o.expiresAt&&Date.parse(o.expiresAt)<Date.now()))return o}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),n={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(n.channel,n.chatId,n.accountId)]=n,this.save(t),n}remove(e,t,n){let i=this.load(),o=this.key(e,t,n);return o in i.overrides?(delete i.overrides[o],this.save(i),!0):!1}consumeSummary(e,t,n){let i=this.load(),o=i.overrides[this.key(e,t,n)];if(!o||!o.summary||o.summaryConsumedAt)return;let s=o.summary;return o.summaryConsumedAt=new Date().toISOString(),this.save(i),s}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(n=>!n.expiresAt||Date.parse(n.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(n=>n.toAgent===e),outgoing:t.filter(n=>n.fromAgent===e)}}};import{readFileSync as ut,writeFileSync as le,appendFileSync as Rn,mkdirSync as $n,existsSync as pt,statSync as xn}from"fs";import{resolve as U}from"path";var at="[Agent Memory \u2014 persistent facts from past conversations]",Sn=2400;function dt(r,e){return r?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function In(r,e=Date.now()){let t=ze(r,e),n=r.undated?"UNVERIFIED (never checked) ":dt(t,He(r.verifiedAt,e));return{line:`- [wiki ${r.id}] ${n}${r.subject} \xB7 ${r.attribute}: ${r.value} (${r.source}, checked ${r.verifiedAt.slice(0,10)} by ${r.verifiedBy})`,unverified:t}}function An(r,e){let n=!r.source.chatId.startsWith("-")&&/^\d+$/.test(r.source.chatId)?"DM":r.source.chatId,i=Be(r,e);return{line:`- [${r.category}] ${dt(i,Ue(r,e))}${r.content} (${n}, ${r.source.date})`,unverified:i}}function ct(r,e=[],t=Date.now()){let n=[],i=new Set,o=at.length,s=!1;for(let a of r){let d=e.length>0?Je(a.content,e):null,c,u,p=d&&Date.parse(a.createdAt)>Date.parse(d.verifiedAt)&&!a.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!p){if(i.has(d.id))continue;i.add(d.id),c=In(d,t),u=d.id}else c=An(a,t),d&&(c.line+=` [differs from wiki ${d.id}]`);let f=c.unverified&&!s?de.length:0;if(o+f+c.line.length>Sn)break;n.push({fact:a,...c,...u?{wikiRef:u}:{}}),o+=f+c.line.length,f&&(s=!0)}return n}function lt(r){if(r.length===0)return"";let e=r.some(t=>t.unverified)?[de]:[];return[at,...e,...r.map(t=>t.line),"[End Memory]"].join(`
|
|
2
2
|
`)}var ft=200,Pn=7,gt=class{memoryDir;ledger;constructor(e=process.cwd()){this.memoryDir=U(e,".agentx/memory"),this.ledger=new Ke(U(e,".agentx/wiki")),pt(this.memoryDir)||$n(this.memoryDir,{recursive:!0})}filePath(e){return U(this.memoryDir,`${e}.jsonl`)}addMemory(e,t){if(t.category==="secret"||oe(t.content))return!1;let n=t.source.trust??_e(t.source.channel),i=t.review??Le(n),o={...t,source:{...t.source,trust:n},...i?{review:i}:{},id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,createdAt:new Date().toISOString()};return Rn(this.filePath(e),JSON.stringify(o)+`
|
|
3
3
|
`),!0}parsedCache=new Map;getAll(e){let t=this.filePath(e);if(!pt(t))return[];try{let{mtimeMs:n,size:i}=xn(t),o=this.parsedCache.get(t);if(o&&o.mtimeMs===n&&o.size===i)return o.facts.slice();let a=ut(t,"utf-8").split(`
|
|
4
4
|
`).filter(d=>d.trim()).map(d=>{try{return JSON.parse(d)}catch{return null}}).filter(d=>d!==null);return this.parsedCache.set(t,{mtimeMs:n,size:i,facts:a}),a.slice()}catch{return[]}}findRelevant(e,t,n=8){let i=this.getAll(t).filter(ae);if(i.length===0)return[];let o=i.map(g=>`${g.keywords.join(" ")} ${g.content}`),s=U(this.memoryDir,`${t}_bm25_cache.json`),a=je(o,s),d=We(e,a),c=new Map(d.map(g=>[g.docIndex,g.score])),p=i.map((g,h)=>{let m=c.get(h)??0;return g.category==="commitment"&&(m+=1),{memory:g,score:m}}).filter(g=>g.score>0);if(p.length===0)return i.slice(-n);let f=p.sort((g,h)=>h.score-g.score).slice(0,n).map(g=>g.memory);if(f.length>0)try{this.recordAccess(t,f.map(g=>g.id))}catch{}return f}buildContext(e){return lt(this.contextLines(e))}contextFacts(e){return this.contextLines(e).map(t=>t.fact)}contextLines(e){let t=[];try{t=this.ledger.list()}catch{}return ct(e,t)}recordAccess(e,t){if(t.length===0)return;let n=this.getAll(e),i=new Set(t),o=!1;for(let s of n)if(i.has(s.id)){s.accessCount=(s.accessCount||0)+1,s.lastAccessed=new Date().toISOString();let a=s.intervalDays||1;s.intervalDays=Math.min(a*2,30),s.nextReview=new Date(Date.now()+s.intervalDays*864e5).toISOString(),o=!0}o&&le(this.filePath(e),n.map(s=>JSON.stringify(s)).join(`
|
|
@@ -25,4 +25,4 @@ import{b as tt,c as nt}from"./chunk-GLQLCBJS.js";import{c as Ze}from"./chunk-SZD
|
|
|
25
25
|
`).filter(Boolean),i=[];for(let o=n.length-1;o>=0&&i.length<t;o--)try{let s=JSON.parse(n[o]);(!e||s.person===e)&&i.push(s)}catch{}return i}load(){if(Oe(this.file))try{let e=JSON.parse(Ne(this.file,"utf-8"));if(e&&Array.isArray(e.devices))return e}catch{}return{devices:[]}}save(e){Gt(Qt(this.file),{recursive:!0});let t=`${this.file}.${process.pid}.${en(4).toString("hex")}.tmp`;Zt(t,JSON.stringify(e,null,2)+`
|
|
26
26
|
`,{encoding:"utf-8",mode:384}),Vt(t,this.file)}};import{extname as ui}from"path";var nn=/<agentx-artifact>([\s\S]*?)<\/agentx-artifact>/gi,rn=/<agentx-artifact>[\s\S]*$/i;function Ps(r,e=1/0,t=!1){let n=[],i=String(r??"");if(!/<agentx-artifact>/i.test(i))return{text:i,artifacts:n};let o=i.replace(nn,(s,a)=>{try{let d=JSON.parse(a.trim());if(d&&typeof d.filename=="string"&&typeof d.mime=="string"&&n.length<e){let c=d.mime,u=c.startsWith("image/")?"image":c==="application/pdf"?"pdf":c.startsWith("text/")?"text":"file";n.push({type:u,filename:d.filename,mime:c})}}catch{}return""});return{text:(t?o.replace(rn,""):o).trim(),artifacts:n}}function Ts(r,e=!1){let t=String(r??""),n=t;if(/<agentx-artifact>/i.test(t)){let i=t.replace(nn,(o,s)=>{try{let a=JSON.parse(s.trim());return a&&typeof a.filename=="string"?a.filename:""}catch{return""}});n=(e?i.replace(rn,""):i).trim()}return n.replace(/```[\s\S]*?```|`[^`\n]*`|!\[([^\]\n]*)\]\(([^)\s]+)\)/g,(i,o,s)=>o===void 0||s===void 0?i:`[${o||s}](${s})`)}var pi={".png":{mime:"image/png",kind:"image"},".jpg":{mime:"image/jpeg",kind:"image"},".jpeg":{mime:"image/jpeg",kind:"image"},".gif":{mime:"image/gif",kind:"image"},".webp":{mime:"image/webp",kind:"image"},".svg":{mime:"image/svg+xml",kind:"file"},".pdf":{mime:"application/pdf",kind:"file"},".txt":{mime:"text/plain; charset=utf-8",kind:"file"},".md":{mime:"text/markdown; charset=utf-8",kind:"file"},".csv":{mime:"text/csv; charset=utf-8",kind:"file"},".json":{mime:"application/json",kind:"file"},".mp3":{mime:"audio/mpeg",kind:"audio"},".m4a":{mime:"audio/mp4",kind:"audio"},".wav":{mime:"audio/wav",kind:"audio"},".mp4":{mime:"video/mp4",kind:"video"},".webm":{mime:"video/webm",kind:"video"}},Os={bytes:20*1024*1024,perMessage:20,pathChars:512};function Ns(r){return pi[ui(r).toLowerCase()]??null}var fi=["[Phone app: showing files]","To show the owner a file you created (a chart, a screenshot, a PDF, a recording), save or copy it into .agentx/outbox/ in your workspace and end your reply with one line per file:",'<agentx-artifact>{"filename":".agentx/outbox/<name.ext>","mime":"<mime/type>"}</agentx-artifact>',"Files outside your workspace (/tmp, your home folder) are refused. Outbox files are removed after 7 days.","The line is removed from the text. Images show in the reply, audio and video get a player, other files an Open link. Allowed: png, jpg, gif, webp, svg, pdf, txt, md, csv, json, mp3, m4a, wav, mp4, webm; up to 20 MB and 20 files per reply.","A picture already on the web can go inline as ."].join(`
|
|
27
27
|
`);function Ds(r,e,t){return r==="app"&&e&&t!==!1?fi:void 0}import{lstatSync as Ee,mkdirSync as gi,readdirSync as mi,realpathSync as De,unlinkSync as hi}from"fs";import{join as ne,resolve as on}from"path";var sn=".agentx/outbox",yi=7*24*60*60*1e3;function wi(r,e){try{let t=De(on(e,r)),n=ne(t,sn);return De(n)===n&&Ee(n).isDirectory()?n:null}catch{return null}}function js(r,e={}){let t=e.cwd??process.cwd();if(e.create!==!1)try{let i=De(on(t,r));Ee(ne(i,".agentx"),{throwIfNoEntry:!1})?.isSymbolicLink()||gi(ne(i,sn),{recursive:!0})}catch{return 0}let n=wi(r,t);return n?an(n,(e.now??Date.now())-(e.maxAgeMs??yi)):0}function an(r,e){let t=0;for(let n of mi(r)){let i=ne(r,n);try{let o=Ee(i);o.isDirectory()?t+=an(i,e):Math.max(o.mtimeMs,o.ctimeMs)<e&&(hi(i),t++)}catch{}}return t}export{st as a,gt as b,mt as c,Fi as d,Nn as e,Wi as f,$ as g,pe as h,v as i,B as j,Bn as k,he as l,we as m,be as n,xe as o,Hr as p,qr as q,Te as r,ar as s,ai as t,tn as u,Ps as v,Ts as w,Os as x,Ns as y,Ds as z,sn as A,js as B};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-ZD5ECP5D.js.map
|
|
@@ -48,7 +48,7 @@ The "modified" field is optional and can contain updated values to pass forward.
|
|
|
48
48
|
... (output truncated)`:i;return s.exitCode!==0?{tool_use_id:e.id,content:`Command exited with code ${s.exitCode}:
|
|
49
49
|
${c}`,is_error:!0}:{tool_use_id:e.id,content:c||"(no output)"}}async editFile(e){let t=String(e.input.path||""),o=e.input.edits,n=ge.resolve(this.cwd,t);if(!o||o.length===0)return{tool_use_id:e.id,content:"No edits provided.",is_error:!0};let s=await W.checkFileWrite(t);if(s==="deny")return{tool_use_id:e.id,content:`File write blocked by permissions: ${t}`,is_error:!0};if(s==="skip")return{tool_use_id:e.id,content:`File write skipped (plan mode): ${t}`};if(f.has("pre:file-write")){let a=await f.execute("pre:file-write",{event:"pre:file-write",file:n,cwd:this.cwd});if(a.blocked)return{tool_use_id:e.id,content:a.message||`File edit blocked by pre:file-write hook: ${t}`,is_error:!0}}let i=await re.readFile(n,"utf8"),c=[];for(let a of o)i.includes(a.old_text)?(i=i.replace(a.old_text,a.new_text),c.push(`Replaced: "${a.old_text.slice(0,40)}..."`)):c.push(`Not found: "${a.old_text.slice(0,40)}..."`);return this.options.dryRun||await re.writeFile(n,i,"utf8"),f.has("post:file-write")&&await f.execute("post:file-write",{event:"post:file-write",file:n,fileContent:i,cwd:this.cwd}),{tool_use_id:e.id,content:`Edited ${t}:
|
|
50
50
|
${c.join(`
|
|
51
|
-
`)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),n=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-
|
|
51
|
+
`)}`}}async createFiles(e){let t=e.input,o=t.files||[];return{tool_use_id:e.id,content:t.summary||`Queued ${o.length} file(s) for creation.`,files:o}}async spawnAgent(e){let t=String(e.input.agent_id||""),o=String(e.input.prompt||""),n=Number(e.input.timeout_seconds)||300;if(!t||!o)return{tool_use_id:e.id,content:"agent_id and prompt are required.",is_error:!0};try{let{SubAgentManager:s}=await import("./subagent-XY5N7TUU.js"),{getGlobalRegistry:i}=await import("./registry-DAWQT4D4.js"),c=i();if(!c)return{tool_use_id:e.id,content:"Sub-agent spawning requires the daemon to be running.",is_error:!0};let p=await new s(c).spawn({targetAgentId:t,prompt:o,parentAgentId:"orchestrator",timeout:n*1e3});return p.success?{tool_use_id:e.id,content:`Sub-agent "${t}" completed (${Math.round(p.duration/1e3)}s):
|
|
52
52
|
|
|
53
53
|
${p.content}`}:{tool_use_id:e.id,content:`Sub-agent "${t}" failed: ${p.error}`,is_error:!0}}catch(s){return{tool_use_id:e.id,content:`Failed to spawn sub-agent: ${s.message}`,is_error:!0}}}async askUser(e){let t=String(e.input.question||""),o=e.input.options,n=t;return o?.length&&(n+=`
|
|
54
54
|
Options: ${o.join(", ")}`),{tool_use_id:e.id,content:"Question sent to user.",followUp:n}}};async function Ae(r){let{provider:e,systemPrompt:t,messages:o,providerOptions:n,cwd:s,maxIterations:i=20,enabledTools:c,interactive:a=!0,overwrite:p=!1,dryRun:l=!1,onProgress:d,abortSignal:u}=r,m=u?{...n,abortSignal:u}:n;if(!e.generateRaw)return dt(r);let I=new se(s,{interactive:a,overwrite:p,dryRun:l,acmeContext:r.acmeContext,abortSignal:u}),D=be(c);if(r.acmeContext)for(let g of at)D.push({name:g.name,description:g.description,input_schema:g.input_schema});let E=new Set;if(r.mcpTools?.length)for(let g of r.mcpTools)D.push({name:g.name,description:g.description,input_schema:g.input_schema}),E.add(g.name);let C=o.filter(g=>g.role!=="system").map(g=>({role:g.role,content:g.content})),B=[],G=0,F=0,A=0,O="",j,_=0;for(;_<i;){if(_++,u?.aborted)throw new Error("cancelled");d?.({type:"iteration_start",iteration:_}),b.step(_,`Agentic loop iteration (${D.length} tools available)`);let g,M=!!e.generateRawStream&&!!d;try{if(M){let T=null,U=null,v="";for await(let x of e.generateRawStream(C,t,D,m))x.type==="text_delta"?(v+=x.text,d?.({type:"text_delta",text:x.text})):x.type==="thinking_delta"?d?.({type:"thinking_delta",text:x.text}):x.type==="raw_result"?T=x.result:x.type==="error"&&(U=x.error);if(U&&!T)throw new Error(U);if(!T)throw new Error("generateRawStream returned no raw_result event");g=T,g._streamedText=v}else g=await e.generateRaw(C,t,D,m)}catch(T){if(T.message?.includes("not available"))return dt(r);throw T}G+=g.usage.input_tokens+g.usage.output_tokens,F+=g.usage.input_tokens,A+=g.usage.output_tokens;let P=g._streamedText;for(let T of g.content)T.type==="text"&&(O+=T.text,P===void 0&&d?.({type:"text_delta",text:T.text}));if(P!==void 0&&delete g._streamedText,g.stop_reason==="end_turn"||g.stop_reason==="max_tokens")break;if(g.stop_reason==="tool_use"){let T=g.content.filter(v=>v.type==="tool_use");if(T.length===0)break;C.push({role:"assistant",content:g.content});let U=[];for(let v of T){d?.({type:"tool_call",name:v.name,id:v.id,input:v.input}),b.step(_,`Tool call: ${v.name}`);let x;if(E.has(v.name)&&r.mcpDispatch){let h=await r.mcpDispatch(v.name,v.input);x={tool_use_id:v.id,content:h.content,is_error:h.isError}}else x=await I.execute({name:v.name,id:v.id,input:v.input});d?.({type:"tool_result",name:v.name,id:v.id,content:x.content.slice(0,200),is_error:x.is_error}),x.files?.length&&(B.push(...x.files),d?.({type:"files_created",files:x.files})),x.followUp&&(j=x.followUp),U.push({type:"tool_result",tool_use_id:x.tool_use_id,content:x.content,is_error:x.is_error})}if(C.push({role:"user",content:U}),j)break;continue}break}return d?.({type:"complete",iterations:_,totalTokens:G}),{files:B,content:O,followUp:j,tokensUsed:G,inputTokens:F||void 0,outputTokens:A||void 0,iterations:_}}async function dt(r){let{provider:e,systemPrompt:t,messages:o,providerOptions:n,maxIterations:s=5}=r,c=[{role:"system",content:t+`
|
|
@@ -123,4 +123,4 @@ ${r.projectInstructions}`),r.memoryContext&&o.push(r.memoryContext),o.push(`# Ou
|
|
|
123
123
|
Generate output appropriate for: ${e}. Use the \`create_files\` tool to output all files.`),o.join(`
|
|
124
124
|
|
|
125
125
|
`)}export{qe as a,Vt as b,Yt as c,We as d,ze as e,Ve as f,Ye as g,Pe as h,ee as i,Re as j,le as k,te as l,Tt as m,oe as n,Mt as o,f as p,et as q,tt as r,Me as s,de as t,W as u,ne as v,it as w,Ee as x,$e as y,se as z,mt as A,Zn as B,er as C};
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
126
|
+
//# sourceMappingURL=chunk-ZROS7GX2.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-
|
|
2
|
+
import{b as o}from"./chunk-JXF54PT7.js";import"./chunk-QIJLFPWE.js";var s=o(process.versions.node);s&&(console.error(s),process.exit(1));var{buildProgram:r}=await import("./program-DSUZFBJZ.js"),{installCliSignalExit:i}=await import("./signal-exit-WL7G3EEZ.js");i();var e=await r();process.argv.slice(2).length===0?e.outputHelp():e.parse();
|
|
3
3
|
//# sourceMappingURL=cli.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=client-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-MTP2RH3P.js";import"./chunk-H5LQXHQQ.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
|
|
2
|
+
//# sourceMappingURL=client-DLRQIQZU.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$ as e,X as a,Y as b,Z as c,_ as d,aa as f,ba as g,ca as h,da as i,ea as j,fa as k,ga as l,ha as m,ia as n,ka as o}from"./chunk-H5LQXHQQ.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";o();export{a as INTEGRATION_KINDS,j as approvalsConfigSchema,d as callsSchema,c as cameraBotSchema,k as daemonConfigSchema,b as eventSubscriptionSchema,l as expandEnvVars,m as loadDaemonConfig,h as membersConfigSchema,g as peopleConfigSchema,f as personSchema,i as requestStatusConfigSchema,e as requestsConfigSchema,n as validateWorkspaces};
|
|
2
|
+
//# sourceMappingURL=config-32FKG36S.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-5D5NKZSD.js";import"./chunk-H5LQXHQQ.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
|
|
2
|
+
//# sourceMappingURL=config-mutator-2VM2FWRF.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=doctor-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e}from"./chunk-HRX7FIOO.js";import"./chunk-S2GAEH2F.js";import"./chunk-JXF54PT7.js";import"./chunk-H5LQXHQQ.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{e as daemonVoiceCheck,b as doctor,a as runDoctorChecks,c as runNotificationChecks,d as runReminderChecks};
|
|
2
|
+
//# sourceMappingURL=doctor-ALOXJM5G.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -4292,9 +4292,6 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
4292
4292
|
rules: z.ZodDefault<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
4293
4293
|
id: z.ZodString;
|
|
4294
4294
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
4295
|
-
/**
|
|
4296
|
-
* Load .env file into process.env (simple, no dependency).
|
|
4297
|
-
*/
|
|
4298
4295
|
chats: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
4299
4296
|
senders: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
4300
4297
|
agent: z.ZodString;
|
|
@@ -5169,6 +5166,19 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
5169
5166
|
* keeps a cut answer over the 280 characters the Mac pill opens
|
|
5170
5167
|
* at (AnswerView.isWorthShowing), so "on screen" stays true. */
|
|
5171
5168
|
spokenMaxChars: z.ZodDefault<z.ZodNumber>;
|
|
5169
|
+
/** A transcript with no words (empty, or only bracketed markers such
|
|
5170
|
+
* as "[background noise]") gets a fixed reply from /ask and wakes no
|
|
5171
|
+
* agent. `markers` is what counts as a marker, without the brackets. */
|
|
5172
|
+
noiseFilter: z.ZodDefault<z.ZodObject<{
|
|
5173
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
5174
|
+
markers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
5175
|
+
}, "strip", z.ZodTypeAny, {
|
|
5176
|
+
enabled: boolean;
|
|
5177
|
+
markers: string[];
|
|
5178
|
+
}, {
|
|
5179
|
+
enabled?: boolean | undefined;
|
|
5180
|
+
markers?: string[] | undefined;
|
|
5181
|
+
}>>;
|
|
5172
5182
|
/** The on-device engine behind "local" and every fallback:
|
|
5173
5183
|
* mlx-whisper (Python, all languages) or Parakeet (Core ML, 25
|
|
5174
5184
|
* European languages, no Arabic; 483 MB downloaded on first use into
|
|
@@ -5237,6 +5247,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
5237
5247
|
stt: "auto" | "local" | "elevenlabs";
|
|
5238
5248
|
allowUnmeasured: boolean;
|
|
5239
5249
|
spokenMaxChars: number;
|
|
5250
|
+
noiseFilter: {
|
|
5251
|
+
enabled: boolean;
|
|
5252
|
+
markers: string[];
|
|
5253
|
+
};
|
|
5240
5254
|
localStt: "mlx-whisper" | "parakeet";
|
|
5241
5255
|
endOfTurn: "volume" | "vad";
|
|
5242
5256
|
hotkeys: {
|
|
@@ -5265,6 +5279,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
5265
5279
|
stt?: "auto" | "local" | "elevenlabs" | undefined;
|
|
5266
5280
|
allowUnmeasured?: boolean | undefined;
|
|
5267
5281
|
spokenMaxChars?: number | undefined;
|
|
5282
|
+
noiseFilter?: {
|
|
5283
|
+
enabled?: boolean | undefined;
|
|
5284
|
+
markers?: string[] | undefined;
|
|
5285
|
+
} | undefined;
|
|
5268
5286
|
localStt?: "mlx-whisper" | "parakeet" | undefined;
|
|
5269
5287
|
endOfTurn?: "volume" | "vad" | undefined;
|
|
5270
5288
|
hotkeys?: {
|
|
@@ -6493,6 +6511,38 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
6493
6511
|
* context. The promotion gate for that wants labelled production rows,
|
|
6494
6512
|
* not a good afternoon on a fixture. Raise it to collect them. */
|
|
6495
6513
|
continuityStateTurns: z.ZodDefault<z.ZodNumber>;
|
|
6514
|
+
/** How much a session is given when it starts, per channel (#615).
|
|
6515
|
+
* `full` is the classic start. `lean` starts Claude Code with only
|
|
6516
|
+
* the `agentx` MCP server (no user-level connectors), only the
|
|
6517
|
+
* project's settings (no global CLAUDE.md, user skills or plugins),
|
|
6518
|
+
* and asks for the landscape, chat history and cross-chat context
|
|
6519
|
+
* through MCP tools instead of pushing them into the prompt. A
|
|
6520
|
+
* channel missing here keeps the built-in default: github, a2a,
|
|
6521
|
+
* workflow and cron are lean; every other channel is full. Only
|
|
6522
|
+
* claude-code and codex-cli agents have a lean start; other tiers
|
|
6523
|
+
* are always full. See src/agents/session-profile.ts. */
|
|
6524
|
+
profileByChannel: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<["full", "lean"]>>>;
|
|
6525
|
+
/** What a lean start keeps. */
|
|
6526
|
+
lean: z.ZodDefault<z.ZodObject<{
|
|
6527
|
+
/** MCP servers from the workspace's .mcp.json kept in a lean
|
|
6528
|
+
* session, by name. `agentx` is always added. */
|
|
6529
|
+
mcpServers: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
6530
|
+
/** Claude Code setting sources a lean session reads. Without `user`,
|
|
6531
|
+
* the global CLAUDE.md, user skills, plugins and user-level MCP
|
|
6532
|
+
* connectors are not loaded. `project` is the workspace. */
|
|
6533
|
+
settingSources: z.ZodDefault<z.ZodArray<z.ZodEnum<["user", "project", "local"]>, "many">>;
|
|
6534
|
+
/** Replace the pushed landscape, chat history and cross-chat
|
|
6535
|
+
* context with one line naming the tools that fetch them. */
|
|
6536
|
+
contextOnDemand: z.ZodDefault<z.ZodBoolean>;
|
|
6537
|
+
}, "strip", z.ZodTypeAny, {
|
|
6538
|
+
mcpServers: string[];
|
|
6539
|
+
settingSources: ("user" | "local" | "project")[];
|
|
6540
|
+
contextOnDemand: boolean;
|
|
6541
|
+
}, {
|
|
6542
|
+
mcpServers?: string[] | undefined;
|
|
6543
|
+
settingSources?: ("user" | "local" | "project")[] | undefined;
|
|
6544
|
+
contextOnDemand?: boolean | undefined;
|
|
6545
|
+
}>>;
|
|
6496
6546
|
}, "strip", z.ZodTypeAny, {
|
|
6497
6547
|
contextStrategy: "layered" | "planner";
|
|
6498
6548
|
staleMinutes: number;
|
|
@@ -6500,6 +6550,12 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
6500
6550
|
tierTwoThresholdTokens: number;
|
|
6501
6551
|
tierTwoThresholdTokensByChannel: Record<string, number>;
|
|
6502
6552
|
continuityStateTurns: number;
|
|
6553
|
+
lean: {
|
|
6554
|
+
mcpServers: string[];
|
|
6555
|
+
settingSources: ("user" | "local" | "project")[];
|
|
6556
|
+
contextOnDemand: boolean;
|
|
6557
|
+
};
|
|
6558
|
+
profileByChannel: Record<string, "full" | "lean">;
|
|
6503
6559
|
maxClaudeCodeDispatchesPerHour?: number | undefined;
|
|
6504
6560
|
maxClaudeCodeDispatchesPer5h?: number | undefined;
|
|
6505
6561
|
}, {
|
|
@@ -6511,6 +6567,12 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
6511
6567
|
maxClaudeCodeDispatchesPerHour?: number | undefined;
|
|
6512
6568
|
maxClaudeCodeDispatchesPer5h?: number | undefined;
|
|
6513
6569
|
continuityStateTurns?: number | undefined;
|
|
6570
|
+
lean?: {
|
|
6571
|
+
mcpServers?: string[] | undefined;
|
|
6572
|
+
settingSources?: ("user" | "local" | "project")[] | undefined;
|
|
6573
|
+
contextOnDemand?: boolean | undefined;
|
|
6574
|
+
} | undefined;
|
|
6575
|
+
profileByChannel?: Record<string, "full" | "lean"> | undefined;
|
|
6514
6576
|
}>>;
|
|
6515
6577
|
/** Move B — JS/TS plugins. Each entry is an installed npm package name
|
|
6516
6578
|
* (e.g. `agentx-plugin-mattermost` or `@acme/plugin-mattermost`); the
|
|
@@ -6689,6 +6751,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
6689
6751
|
stt: "auto" | "local" | "elevenlabs";
|
|
6690
6752
|
allowUnmeasured: boolean;
|
|
6691
6753
|
spokenMaxChars: number;
|
|
6754
|
+
noiseFilter: {
|
|
6755
|
+
enabled: boolean;
|
|
6756
|
+
markers: string[];
|
|
6757
|
+
};
|
|
6692
6758
|
localStt: "mlx-whisper" | "parakeet";
|
|
6693
6759
|
endOfTurn: "volume" | "vad";
|
|
6694
6760
|
hotkeys: {
|
|
@@ -7240,6 +7306,12 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7240
7306
|
tierTwoThresholdTokens: number;
|
|
7241
7307
|
tierTwoThresholdTokensByChannel: Record<string, number>;
|
|
7242
7308
|
continuityStateTurns: number;
|
|
7309
|
+
lean: {
|
|
7310
|
+
mcpServers: string[];
|
|
7311
|
+
settingSources: ("user" | "local" | "project")[];
|
|
7312
|
+
contextOnDemand: boolean;
|
|
7313
|
+
};
|
|
7314
|
+
profileByChannel: Record<string, "full" | "lean">;
|
|
7243
7315
|
maxClaudeCodeDispatchesPerHour?: number | undefined;
|
|
7244
7316
|
maxClaudeCodeDispatchesPer5h?: number | undefined;
|
|
7245
7317
|
};
|
|
@@ -7466,6 +7538,10 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
7466
7538
|
stt?: "auto" | "local" | "elevenlabs" | undefined;
|
|
7467
7539
|
allowUnmeasured?: boolean | undefined;
|
|
7468
7540
|
spokenMaxChars?: number | undefined;
|
|
7541
|
+
noiseFilter?: {
|
|
7542
|
+
enabled?: boolean | undefined;
|
|
7543
|
+
markers?: string[] | undefined;
|
|
7544
|
+
} | undefined;
|
|
7469
7545
|
localStt?: "mlx-whisper" | "parakeet" | undefined;
|
|
7470
7546
|
endOfTurn?: "volume" | "vad" | undefined;
|
|
7471
7547
|
hotkeys?: {
|
|
@@ -8079,6 +8155,12 @@ declare const daemonConfigSchema: z.ZodObject<{
|
|
|
8079
8155
|
maxClaudeCodeDispatchesPerHour?: number | undefined;
|
|
8080
8156
|
maxClaudeCodeDispatchesPer5h?: number | undefined;
|
|
8081
8157
|
continuityStateTurns?: number | undefined;
|
|
8158
|
+
lean?: {
|
|
8159
|
+
mcpServers?: string[] | undefined;
|
|
8160
|
+
settingSources?: ("user" | "local" | "project")[] | undefined;
|
|
8161
|
+
contextOnDemand?: boolean | undefined;
|
|
8162
|
+
} | undefined;
|
|
8163
|
+
profileByChannel?: Record<string, "full" | "lean"> | undefined;
|
|
8082
8164
|
} | undefined;
|
|
8083
8165
|
plugins?: string[] | undefined;
|
|
8084
8166
|
processPool?: {
|
|
@@ -9556,6 +9638,11 @@ interface AgentTask {
|
|
|
9556
9638
|
* Seeds an empty AgentX session the same way a channel adapter's
|
|
9557
9639
|
* seedHistory does, so a new or rotated session starts with it. */
|
|
9558
9640
|
seedHistory?: SeededMessage[];
|
|
9641
|
+
/** Extra flags for the `claude` CLI, set by the registry from the
|
|
9642
|
+
* channel's session profile (lean: strict MCP config, setting sources;
|
|
9643
|
+
* see agents/session-profile.ts). Spawn-per-task and persistent
|
|
9644
|
+
* processes carry them alike. Ignored by other tiers. */
|
|
9645
|
+
claudeArgs?: string[];
|
|
9559
9646
|
/** Routine autonomy level (cron job / workflow agent step). `report` and
|
|
9560
9647
|
* `propose` are enforced for THIS task only via a per-spawn guard hook
|
|
9561
9648
|
* (see guard/autonomy-enforce.ts); unset or `act` = the agent's normal
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt,
|
|
1
|
+
import{a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt,ia as Tt,ja as Mt}from"./chunk-UZ5Q6Q2X.js";import"./chunk-YZJCOWHU.js";import"./chunk-GTJIKXDB.js";import"./chunk-VYSFOONA.js";import"./chunk-DG5I6PPM.js";import"./chunk-ZVP6GB4G.js";import"./chunk-S2GAEH2F.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-4MESMUND.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-ACFQBLPX.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-3Z5P2CWS.js";import"./chunk-E5OV6RTG.js";import"./chunk-PPUN7YHA.js";import{aa as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-YSMPXFQR.js";import"./chunk-ZD5ECP5D.js";import"./chunk-GLQLCBJS.js";import"./chunk-DP7RTNDM.js";import{a as L}from"./chunk-C245D4BZ.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-ZROS7GX2.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-Y4CYQV7G.js";import"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-GGB5JMII.js";import"./chunk-SZDACK6O.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-CZFGADZ2.js";import"./chunk-5D5NKZSD.js";import"./chunk-VWTBHLMX.js";import"./chunk-DJMK22SB.js";import{a as ht}from"./chunk-QCKUXJJ3.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-PWTSY77F.js";import"./chunk-MYVHVJWZ.js";import"./chunk-DWADWDMU.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-3IEFHOPH.js";import{f as gt,g as ft}from"./chunk-W3LSDADF.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-CHQ5Q4QO.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-5MUJZODV.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{fa as tt,ha as st,ia as ot,ka as nt}from"./chunk-H5LQXHQQ.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
|
|
2
2
|
`)}
|
|
3
3
|
|
|
4
4
|
${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-YFVSSYSL.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).
|