agentix-cli 0.114.0 → 0.114.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/dist/{agent-5F4EKGQN.js → agent-NGCPRTBH.js} +2 -2
- package/dist/{board-dashboard-GGW5ZZLT.js → board-dashboard-7B2B564A.js} +244 -244
- package/dist/{board-dashboard-GGW5ZZLT.js.map → board-dashboard-7B2B564A.js.map} +1 -1
- package/dist/{chunk-O2RVUM2B.js → chunk-CSLVHAYV.js} +2 -2
- package/dist/{chunk-QQIWLN3H.js → chunk-DOQ6Y7GZ.js} +5 -5
- package/dist/chunk-DOQ6Y7GZ.js.map +1 -0
- package/dist/{chunk-4COYYJJY.js → chunk-EVB23EHN.js} +2 -2
- package/dist/chunk-JVSTKXMI.js +6 -0
- package/dist/chunk-JVSTKXMI.js.map +1 -0
- package/dist/{chunk-XTO4GRGN.js → chunk-QBWJGDKE.js} +3 -3
- package/dist/{chunk-XX7NXI3Y.js → chunk-TZIPWZY6.js} +2 -2
- package/dist/{chunk-HPY54DU6.js → chunk-UMFFIUU6.js} +2 -2
- package/dist/{chunk-YU5NDKPA.js → chunk-UZB5UO35.js} +2 -2
- package/dist/{chunk-VQM77L54.js → chunk-Z6OPM7EH.js} +2 -2
- package/dist/{chunk-6WNQY6K2.js → chunk-ZXQYOSHP.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{program-IEMICVO3.js → program-4IMJEMDM.js} +7 -7
- package/dist/{promote-S7SKOKX2.js → promote-4VTXBVUC.js} +2 -2
- package/dist/{query-GOBQ3GL5.js → query-B32UDQJS.js} +2 -2
- package/dist/{registry-HUJEORRW.js → registry-GY4X2GZX.js} +2 -2
- package/dist/{wiki-FZHSX4K3.js → wiki-LVYHDK2R.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-ILGLEA3I.js +0 -6
- package/dist/chunk-ILGLEA3I.js.map +0 -1
- package/dist/chunk-QQIWLN3H.js.map +0 -1
- /package/dist/{agent-5F4EKGQN.js.map → agent-NGCPRTBH.js.map} +0 -0
- /package/dist/{chunk-O2RVUM2B.js.map → chunk-CSLVHAYV.js.map} +0 -0
- /package/dist/{chunk-4COYYJJY.js.map → chunk-EVB23EHN.js.map} +0 -0
- /package/dist/{chunk-XTO4GRGN.js.map → chunk-QBWJGDKE.js.map} +0 -0
- /package/dist/{chunk-XX7NXI3Y.js.map → chunk-TZIPWZY6.js.map} +0 -0
- /package/dist/{chunk-HPY54DU6.js.map → chunk-UMFFIUU6.js.map} +0 -0
- /package/dist/{chunk-YU5NDKPA.js.map → chunk-UZB5UO35.js.map} +0 -0
- /package/dist/{chunk-VQM77L54.js.map → chunk-Z6OPM7EH.js.map} +0 -0
- /package/dist/{chunk-6WNQY6K2.js.map → chunk-ZXQYOSHP.js.map} +0 -0
- /package/dist/{program-IEMICVO3.js.map → program-4IMJEMDM.js.map} +0 -0
- /package/dist/{promote-S7SKOKX2.js.map → promote-4VTXBVUC.js.map} +0 -0
- /package/dist/{query-GOBQ3GL5.js.map → query-B32UDQJS.js.map} +0 -0
- /package/dist/{registry-HUJEORRW.js.map → registry-GY4X2GZX.js.map} +0 -0
- /package/dist/{wiki-FZHSX4K3.js.map → wiki-LVYHDK2R.js.map} +0 -0
|
@@ -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-GY4X2GZX.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-UZB5UO35.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as o}from"./chunk-TZIPWZY6.js";import{resolve as a}from"path";import{existsSync as d,readdirSync as c,mkdirSync as l}from"fs";var g=class{baseDir;agentsDir;mode;sharedStore;agentStores=new Map;log;constructor(t=a(process.cwd(),".agentx/wiki"),e=console.error.bind(console,"[wiki-hub]"),r="graph"){this.baseDir=t,this.agentsDir=a(t,"agents"),this.mode=r,this.log=e,l(this.agentsDir,{recursive:!0}),this.sharedStore=new o(t,e)}getMode(){return this.mode}getAgentWiki(t){let e=`${t}:${this.mode}`;if(this.agentStores.has(e))return this.agentStores.get(e);let r=a(this.agentsDir,t,this.mode),i=new o(r,this.log);return this.agentStores.set(e,i),i}getBaseDir(){return this.baseDir}getSharedStore(){return this.sharedStore}listAgents(){let t=new Set,e=this.sharedStore.listEntries();for(let r of e)t.add(r.agentId);if(d(this.agentsDir))for(let r of c(this.agentsDir))!r.startsWith("_")&&!r.startsWith(".")&&t.add(r);return[...t].sort()}getAgentEntries(t){return this.sharedStore.listEntries({agentId:t})}getUnabsorbedEntries(t){let e=this.getAgentWiki(t),r=this.getAgentEntries(t),i=new Set,n=e.rebuildIndex();for(let s of n.articles)if(s.sources)for(let h of s.sources)i.add(h);return r.filter(s=>!i.has(s.id))}summary(){return this.listAgents().map(e=>{let r=this.getAgentEntries(e),n=this.getAgentWiki(e).rebuildIndex(),s=this.getUnabsorbedEntries(e);return{agentId:e,totalEntries:r.length,totalArticles:n.articles.length,unabsorbed:s.length,articles:n.articles}})}};export{g as a};
|
|
2
|
+
//# sourceMappingURL=chunk-Z6OPM7EH.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as Xt}from"./chunk-S2GAEH2F.js";import{a as Re}from"./chunk-GTJIKXDB.js";import{a as re,b as w}from"./chunk-BGG3ZSMW.js";import{t as Gt,u as Kt}from"./chunk-
|
|
1
|
+
import{q as Xt}from"./chunk-S2GAEH2F.js";import{a as Re}from"./chunk-GTJIKXDB.js";import{a as re,b as w}from"./chunk-BGG3ZSMW.js";import{t as Gt,u as Kt}from"./chunk-EVB23EHN.js";import{d as zt,e as qt}from"./chunk-AQASR6KR.js";import{b as Jt,c as Ie,e as B,f as H,h as Yt}from"./chunk-JIT5GPTX.js";import{A as Ae,b as ve,v as Lt,x as ne,y as $e}from"./chunk-J3GXZQXY.js";import{a as Mt,b as Nt}from"./chunk-SHEUCITK.js";import{a as Ut,b as Bt,d as Ht}from"./chunk-Y4CYQV7G.js";import{g as Ot,h as jt,i as Vt,k as Wt,l as Ft}from"./chunk-YLKCFW2R.js";import{q as Et}from"./chunk-VGI4EZTP.js";import{a as Pt,b as Tt}from"./chunk-CYKPDILL.js";import{A as Xr,ba as Se,ia as _t,ja as Ct,ma as Dt,n as te,o as vt,p as $t,q as qr,y as It,z as Rt}from"./chunk-Y5HBYSJW.js";import{f as At,n as Kr}from"./chunk-UIBUZ2N3.js";import{a as xe,h as Gr}from"./chunk-BRK6M6LA.js";import{existsSync as Jr,readdirSync as Yr,readFileSync as Zr,statSync as Qr}from"fs";import{resolve as ei}from"path";function Zt(t,e,n=Date.now(),r=7){let i=r*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(f=>n-f.at<=i),l=a.filter(f=>n-f.at>i&&n-f.at<=i*2),u=c.filter(f=>f.status==="failed").length,d=a.filter(f=>f.status==="paused").length,p=a.length?Math.max(...a.map(f=>f.at)):null,g=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:g,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 ie=new Map;function _a(t,e=1e3){if(!Jr(t))return[];let n=Yr(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let o=ei(t,s);return{path:o,mtime:Qr(o).mtimeMs}}).sort((s,o)=>o.mtime-s.mtime).slice(0,e),r=new Set(n.map(s=>s.path));for(let s of ie.keys())r.has(s)||ie.delete(s);let i=[];for(let{path:s,mtime:o}of n){let a=ie.get(s);if(a&&a.mtime===o){a.summary&&i.push(a.summary);continue}let c=ti(s,o);ie.set(s,{mtime:o,summary:c}),c&&i.push(c)}return i}function ti(t,e){try{let n=Zr(t,"utf-8").split(`
|
|
2
2
|
`).filter(Boolean);if(!n.length)return null;let r=JSON.parse(n[0]),i=r.run?.workflowId;if(!i)return null;let s=r.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:i,status:s,at:e}}catch{return null}}var ni={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},k={routines:200,summary:160,filters:6,filterValue:60,text:120},ri=(t,e,n)=>{try{return Et(t,e,n)}catch{return null}},Qt=864e5;function Ta(t){let e=t.now??Date.now(),n={...ni,...t.thresholds},r=t.nextFire??ri,i=[];for(let a of t.crons){let c=t.cronRuns.get(a.id)??[],l=a.timezone||"UTC",u=c.map(g=>({at:Date.parse(g.startedAt),status:g.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?_e(a.nextRun)??_e(r(a.schedule,new Date(e),l)):null,lastRun:d?{at:d.startedAt,status:d.status,summary:li(d.status==="success"?void 0:d.errorSummary,k.summary)}:null,lastSuccessAt:c.find(g=>g.status==="success")?.startedAt??null,consecutiveFailures:en(u),sampledRuns:c.length,flags:[],attention:null};p.flags=tn(p,u,a.schedule,l,null,e,n,r),i.push(nn(p))}let s=new Map(Zt(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(_=>_.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((_,ke)=>ke.at-_.at),g=p.map(_=>({at:_.at,status:oi(_.status)})),f=g[0],m=c.type==="trigger.cron",y=typeof l.spec=="string"?l.spec:"",P=typeof l.timezone=="string"?l.timezone:"UTC",j={id:`workflow:${a.id}`,source:"workflow",kind:m?"schedule":"event",name:$(a.title||a.id,k.text),trigger:m?{schedule:$(y,k.text),timezone:P}:{event:$(typeof l.event=="string"?l.event:"",k.text),filters:ci(l.filter,a)},agent:ai(a),enabled:d,state:u,nextRunAt:m&&d&&y?_e(r(y,new Date(e),P)):null,lastRun:f?{at:new Date(f.at).toISOString(),status:f.status}:null,lastSuccessAt:(()=>{let _=g.find(ke=>ke.status==="success");return _?new Date(_.at).toISOString():null})(),consecutiveFailures:en(g),sampledRuns:p.length,flags:[],attention:null},ee=Date.parse(a.updated||a.created||"");j.flags=m?tn(j,g,y,P,Number.isFinite(ee)?ee:null,e,n,r):ii(j,s.get(a.id)?.state==="dormant",Number.isFinite(ee)?ee:null,e,n),i.push(nn(j))}return i.sort(si).slice(0,k.routines)}function en(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 tn(t,e,n,r,i,s,o,a){let c=[],l=e.length?e[0].at:null;if(!t.enabled){let p=sn(l,i,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,r),!!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 ii(t,e,n,r,i){let s=[],o=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=sn(o,n,r,i);return a&&s.push(a),s}return t.consecutiveFailures>=i.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 sn(t,e,n,r){let i=Math.max(t??0,e??0);return i&&n-i<r.disabledDays*Qt?null:{reason:"disabled-long",detail:i?`Disabled; no activity for ${Math.floor((n-i)/Qt)} days`:"Disabled and never ran"}}function nn(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 rn={critical:0,warning:1,info:2};function si(t,e){let n=t.attention?rn[t.attention]:3,r=e.attention?rn[e.attention]:3;return n-r||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function oi(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 ai(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 ci(t,e){let n=[],r=e?.project;if(r&&n.push($(`project=${r}`,k.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[i,s]of Object.entries(t)){let o=Array.isArray(s)?s.map(String):s==null?[]:[String(s)];o.length&&n.push($(`${i}=${o.join(",")}`,k.filterValue))}return n.slice(0,k.filters)}function _e(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 li(t,e){return t===void 0?void 0:$(t,e)}import{existsSync as ae,readdirSync as Ri,readFileSync as _i}from"fs";import{resolve as T}from"path";import{randomBytes as cn}from"crypto";import{existsSync as di,mkdirSync as pi,readdirSync as gi,readFileSync as fi,renameSync as ln,unlinkSync as mi,writeFileSync as hi}from"fs";import{resolve as un}from"path";function on(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var ui=t=>t.trim().split(`
|
|
3
3
|
`).pop()?.slice(0,300)||"no output";async function an(t,e,n,r=Re){let i=await r(t.bin,[...on(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return i.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${ui(i.stderr||i.stdout)}`}}async function Ma(t,e,n,r,i=Re){return(await i(t.bin,[...on(t),"--read-only","media","download","--chat",e,"--id",n,"--output",r],{timeoutMs:12e4})).code===0}var yi=2e3,bi=t=>an(t.wacli,t.to,t.text);function Ce(t){return un(t,".agentx","whatsapp-triage","drafts")}var wi=t=>/^[a-z0-9-]{8,64}$/.test(t),se=(t,e)=>un(Ce(t),`${e}.json`);function dn(t,e){pi(Ce(t),{recursive:!0});let n=se(t,e.id),r=`${n}.${process.pid}.tmp`;hi(r,JSON.stringify(e,null,2)+`
|
|
4
4
|
`,{mode:384}),ln(r,n)}function Fa(t,e,n=Date.now()){let r=e.text.trim().slice(0,yi);if(!r)throw new Error("empty draft");let i={...e,text:r,id:`${n.toString(36)}-${cn(4).toString("hex")}`,status:"pending",created_at:new Date(n).toISOString()};return dn(t,i),i}function oe(t,e){if(!wi(e))return null;try{return JSON.parse(fi(se(t,e),"utf-8"))}catch{return null}}function pn(t,e){let n=Ce(t);return di(n)?gi(n).filter(r=>r.endsWith(".json")).map(r=>oe(t,r.slice(0,-5))).filter(r=>!!r&&(!e||r.status===e)).sort((r,i)=>r.created_at.localeCompare(i.created_at)):[]}async function gn(t,e,n,r={}){let i=oe(t,e);if(!i||i.status!=="pending")return{ok:!1,error:`no reply draft "${e}" is waiting`};let s=`${se(t,e)}.${process.pid}.${cn(3).toString("hex")}.claim`;try{ln(se(t,e),s)}catch{return{ok:!1,error:`reply draft "${e}" is already being decided`}}let o={...i,decided_by:r.by??"operator",decided_at:new Date(r.now??Date.now()).toISOString()};if(n==="no")o.status="rejected";else{let a=await(r.send??bi)(i).catch(c=>({ok:!1,error:String(c?.message??c)}));a.ok?o.status="sent":(o.status="failed",o.error=a.error)}dn(t,o);try{mi(s)}catch{}return o.status==="failed"?{ok:!1,error:o.error??"send failed"}:{ok:!0,draft:o}}import{mkdirSync as ki,readFileSync as xi,renameSync as Si,writeFileSync as vi}from"fs";import{resolve as $i}from"path";function fn(t){return $i(Ie(t),"_state.json")}function A(t){try{let e=JSON.parse(xi(fn(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 z(t,e){ki(Ie(t),{recursive:!0});let n=fn(t),r=`${n}.${process.pid}.tmp`;vi(r,JSON.stringify(e,null,2)+`
|
|
@@ -479,4 +479,4 @@ Document the arguments, commands, or files the skill expects. Example:
|
|
|
479
479
|
claude-code ${St(t)} --arg value
|
|
480
480
|
\`\`\`
|
|
481
481
|
`}Dt();var Ur={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function Br(t){return{...Ur,...t??{},regions:{...t?.regions??{}},buffer:{...Ur.buffer,...t?.buffer??{}}}}function Ju(t){try{return Br(Ct(t).screen)}catch{return Br(void 0)}}var Aa=/^[a-z][\w-]*$/,Hr=["window","screen","menubar","notifications"];function Q(t,e,n,r){let i=Number(t);if(t===""||t===null||!Number.isFinite(i)||!n(i))throw new Error(`${e} must be ${r}`);return i}var we=(t,e)=>Q(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function zr(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 Yu(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=we(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=we(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=we(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=Q(e.stableMs,"stableMs",i=>Number.isInteger(i)&&i>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=Q(e.changeThreshold,"changeThreshold",i=>i>=0&&i<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let i={...n.regions??{}};for(let[s,o]of Object.entries(e.regions)){if(!Aa.test(s))throw new Error(`region name "${s}" must be lowercase letters, digits, - or _`);o===null?delete i[s]:i[s]=zr(o)}n.regions=i}if(e.buffer&&typeof e.buffer=="object"){let i=e.buffer,s={...n.buffer??{}};"enabled"in i&&(s.enabled=!!i.enabled),"seconds"in i&&(s.seconds=Q(i.seconds,"buffer.seconds",o=>o>0&&o<=120,"above 0 and at most 120")),"fps"in i&&(s.fps=Q(i.fps,"buffer.fps",o=>o>0&&o<=10,"above 0 and at most 10")),"maxPixels"in i&&(s.maxPixels=we(i.maxPixels,"buffer.maxPixels")),"region"in i&&(s.region=String(i.region).trim()),n.buffer=s}let r=n.buffer?.region;if(r!==void 0&&!Hr.includes(r)&&!n.regions?.[r])try{zr(r)}catch{throw new Error(`buffer.region "${r}" is not a region \u2014 use ${[...Hr,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Zt as a,_a as b,tt as c,Bs as d,Hs as e,cl as f,ll as g,ul as h,rr as i,pl as j,fl as k,E as l,ir as m,k as n,Ta as o,Ma as p,bi as q,Fa as r,gn as s,A as t,qa as u,Ga as v,bn as w,Qa as x,q as y,gc as z,vn as A,hl as B,nt as C,sr as D,wl as E,Sl as F,wr as G,Xl as H,Jl as I,nu as J,Uo as K,ru as L,mc as M,hc as N,yc as O,bc as P,wc as Q,kc as R,Sc as S,vc as T,Tc as U,Oe as V,Ec as W,Lc as X,G as Y,K as Z,Ko as _,pu as $,gu as aa,fu as ba,mu as ca,ut as da,hu as ea,We as fa,Fe as ga,ge as ha,ls as ia,ds as ja,Vc as ka,Be as la,He as ma,ps as na,gs as oa,Bn as pa,Gn as qa,Wc as ra,hs as sa,Fc as ta,$s as ua,Rs as va,ze as wa,Cs as xa,Kn as ya,L as za,Pr as Aa,Tr as Ba,Er as Ca,Su as Da,ra as Ea,Mr as Fa,Nr as Ga,Eu as Ha,Lu as Ia,wa as Ja,Mu as Ka,jr as La,fe as Ma,Qc as Na,er as Oa,qe as Pa,Qe as Qa,ol as Ra,Vu as Sa,Wu as Ta,Fu as Ua,Uu as Va,Bu as Wa,Hu as Xa,zu as Ya,qu as Za,Gu as _a,Ur as $a,Br as ab,Ju as bb,Hr as cb,Yu as db};
|
|
482
|
-
//# sourceMappingURL=chunk-
|
|
482
|
+
//# sourceMappingURL=chunk-ZXQYOSHP.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-4IMJEMDM.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
|
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,ia as Tt,ja as Mt}from"./chunk-
|
|
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-DOQ6Y7GZ.js";import"./chunk-ZXQYOSHP.js";import"./chunk-VTWSW4KB.js";import"./chunk-S2GAEH2F.js";import"./chunk-GTJIKXDB.js";import"./chunk-BGG3ZSMW.js";import"./chunk-ZVP6GB4G.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-EVB23EHN.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-ACFQBLPX.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-QLWGLRT5.js";import"./chunk-JIT5GPTX.js";import{ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-QBWJGDKE.js";import"./chunk-J3GXZQXY.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import{a as L}from"./chunk-UG2OF2EI.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-UZB5UO35.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-Y4CYQV7G.js";import"./chunk-YLKCFW2R.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-76Z4VHDX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import{s as ut}from"./chunk-VGI4EZTP.js";import"./chunk-CYKPDILL.js";import"./chunk-VWTBHLMX.js";import"./chunk-Z6OPM7EH.js";import{a as ht}from"./chunk-TZIPWZY6.js";import"./chunk-36AXN6ZB.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-GSX4NK2N.js";import"./chunk-HG6QA6EU.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-CSLVHAYV.js";import{f as gt,g as ft}from"./chunk-JVSTKXMI.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import{j as it,k as rt,l as at}from"./chunk-A35RTVMM.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-2PJKGZWP.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{ha as tt,ja as st,ka as ot,ma as nt}from"./chunk-Y5HBYSJW.js";import"./chunk-UIBUZ2N3.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).
|