agentix-cli 0.119.0 → 0.120.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/{agent-E6W5VBYH.js → agent-63RXZRL2.js} +2 -2
- package/dist/{board-dashboard-WDO6Z24C.js → board-dashboard-XQEZBQL5.js} +2 -2
- package/dist/{chunk-PVQPXZHE.js → chunk-247SOQLP.js} +4 -4
- package/dist/chunk-56KNKUFF.js +3 -0
- package/dist/chunk-56KNKUFF.js.map +1 -0
- package/dist/chunk-6FVFD5WU.js +4 -0
- package/dist/chunk-6FVFD5WU.js.map +1 -0
- package/dist/{chunk-IVCFXLAR.js → chunk-6JJJ5MUU.js} +5 -5
- package/dist/chunk-6JJJ5MUU.js.map +1 -0
- package/dist/{chunk-TJ7IUHC7.js → chunk-7ZABMMSW.js} +2 -2
- package/dist/{chunk-GJKYOEDE.js → chunk-AXFE34OV.js} +2 -2
- package/dist/{chunk-ZDWE47LM.js → chunk-KQX3U3H2.js} +2 -2
- package/dist/{chunk-JMFP35EU.js → chunk-PCOXSCYT.js} +180 -180
- package/dist/{chunk-JMFP35EU.js.map → chunk-PCOXSCYT.js.map} +1 -1
- package/dist/{chunk-5PR6DZYW.js → chunk-S6NQB7VV.js} +2 -2
- package/dist/{chunk-5UFIHT66.js → chunk-UAPWOE2W.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{grants-V2ZNLWSJ.js → grants-ZMHSJMYE.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{program-SOKOBCYN.js → program-E3NTPNCZ.js} +217 -206
- package/dist/program-E3NTPNCZ.js.map +1 -0
- package/dist/{query-NAU7J34H.js → query-R6YELRQN.js} +2 -2
- package/dist/{registry-I5PXGCO6.js → registry-HIZIFAVH.js} +2 -2
- package/dist/{review-candidates-HAP7P6SH.js → review-candidates-6YIBOEEG.js} +2 -2
- package/dist/{rotation-memo-5MTSJ4FH.js → rotation-memo-6UW6DTBQ.js} +2 -2
- package/dist/{rotation-memo-5MTSJ4FH.js.map → rotation-memo-6UW6DTBQ.js.map} +1 -1
- package/dist/{wiki-PPX3HYXW.js → wiki-R4MNLBXE.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2GIDVZ4H.js +0 -3
- package/dist/chunk-2GIDVZ4H.js.map +0 -1
- package/dist/chunk-BDJWN3PL.js +0 -4
- package/dist/chunk-BDJWN3PL.js.map +0 -1
- package/dist/chunk-IVCFXLAR.js.map +0 -1
- package/dist/program-SOKOBCYN.js.map +0 -1
- /package/dist/{agent-E6W5VBYH.js.map → agent-63RXZRL2.js.map} +0 -0
- /package/dist/{board-dashboard-WDO6Z24C.js.map → board-dashboard-XQEZBQL5.js.map} +0 -0
- /package/dist/{chunk-PVQPXZHE.js.map → chunk-247SOQLP.js.map} +0 -0
- /package/dist/{chunk-TJ7IUHC7.js.map → chunk-7ZABMMSW.js.map} +0 -0
- /package/dist/{chunk-GJKYOEDE.js.map → chunk-AXFE34OV.js.map} +0 -0
- /package/dist/{chunk-ZDWE47LM.js.map → chunk-KQX3U3H2.js.map} +0 -0
- /package/dist/{chunk-5PR6DZYW.js.map → chunk-S6NQB7VV.js.map} +0 -0
- /package/dist/{chunk-5UFIHT66.js.map → chunk-UAPWOE2W.js.map} +0 -0
- /package/dist/{grants-V2ZNLWSJ.js.map → grants-ZMHSJMYE.js.map} +0 -0
- /package/dist/{query-NAU7J34H.js.map → query-R6YELRQN.js.map} +0 -0
- /package/dist/{registry-I5PXGCO6.js.map → registry-HIZIFAVH.js.map} +0 -0
- /package/dist/{review-candidates-HAP7P6SH.js.map → review-candidates-6YIBOEEG.js.map} +0 -0
- /package/dist/{wiki-PPX3HYXW.js.map → wiki-R4MNLBXE.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as $e}from"./chunk-GTJIKXDB.js";import{q as zt}from"./chunk-S2GAEH2F.js";import{a as te,b as w}from"./chunk-BGG3ZSMW.js";import{b as qt}from"./chunk-WCXXXAHV.js";import{
|
|
1
|
+
import{a as $e}from"./chunk-GTJIKXDB.js";import{q as zt}from"./chunk-S2GAEH2F.js";import{a as te,b as w}from"./chunk-BGG3ZSMW.js";import{b as qt}from"./chunk-WCXXXAHV.js";import{f as Kt,g as ve,i as U,j as B,l as Gt}from"./chunk-6FVFD5WU.js";import{t as Bt,u as Ht}from"./chunk-FSXWNVGL.js";import{d as Ft,e as Ut}from"./chunk-AQASR6KR.js";import{A as Se,b as ke,v as Dt,x as ee,y as xe}from"./chunk-RJBRYUKU.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-IOYRRGK7.js";import{q as Ct}from"./chunk-B6OXEIOF.js";import{a as Rt,b as _t}from"./chunk-4PQREYBU.js";import{A as qr,ba as we,ia as $t,ja as At,ma as It,n as Q,o as wt,p as kt,q as Br,y as St,z as vt}from"./chunk-IMLLHT7U.js";import{a as be,h as Hr}from"./chunk-BRK6M6LA.js";import{f as xt,n as zr}from"./chunk-UIBUZ2N3.js";import{existsSync as Kr,readdirSync as Gr,readFileSync as Xr,statSync as Jr}from"fs";import{resolve as Yr}from"path";function Xt(t,e,n=Date.now(),i=7){let r=i*864e5,o=new Map;for(let s of e){let a=o.get(s.workflowId);a?a.push(s):o.set(s.workflowId,[s])}return t.map(s=>{let a=o.get(s.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:s.id,name:s.name||s.id,state:f,lastRunAt:p,recent:c.length,prior:l.length,failed:u,paused:d}}).sort((s,a)=>{let c={dormant:0,failing:1,active:2,quiet:3,never:4};return c[s.state]-c[a.state]||(a.lastRunAt??0)-(s.lastRunAt??0)})}var ne=new Map;function ka(t,e=1e3){if(!Kr(t))return[];let n=Gr(t).filter(o=>o.endsWith(".jsonl")).map(o=>{let s=Yr(t,o);return{path:s,mtime:Jr(s).mtimeMs}}).sort((o,s)=>s.mtime-o.mtime).slice(0,e),i=new Set(n.map(o=>o.path));for(let o of ne.keys())i.has(o)||ne.delete(o);let r=[];for(let{path:o,mtime:s}of n){let a=ne.get(o);if(a&&a.mtime===s){a.summary&&r.push(a.summary);continue}let c=Zr(o,s);ne.set(o,{mtime:s,summary:c}),c&&r.push(c)}return r}function Zr(t,e){try{let n=Xr(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 o=i.run?.status??"unknown";for(let s=n.length-1;s>=0;s--){let a=JSON.parse(n[s]),c=a.status??a.run?.status;if(c){o=c;break}}return{workflowId:r,status:o,at:e}}catch{return null}}var Qr={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},k={routines:200,summary:160,filters:6,filterValue:60,text:120},ei=(t,e,n)=>{try{return Ct(t,e,n)}catch{return null}},Jt=864e5;function $a(t){let e=t.now??Date.now(),n={...Qr,...t.thresholds},i=t.nextFire??ei,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?Ae(a.nextRun)??Ae(i(a.schedule,new Date(e),l)):null,lastRun:d?{at:d.startedAt,status:d.status,summary:si(d.status==="success"?void 0:d.errorSummary,k.summary)}:null,lastSuccessAt:c.find(f=>f.status==="success")?.startedAt??null,consecutiveFailures:Yt(u),sampledRuns:c.length,flags:[],attention:null};p.flags=Zt(p,u,a.schedule,l,null,e,n,i),r.push(Qt(p))}let o=new Map(Xt(t.workflows.map(a=>({id:a.id,name:a.title})),t.workflowRuns,e).map(a=>[a.id,a])),s=new Map;for(let a of t.workflowRuns){let c=s.get(a.workflowId);c?c.push(a):s.set(a.workflowId,[a])}for(let a of t.workflows){let c=a.nodes.find(R=>R.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=(s.get(a.id)??[]).slice().sort((R,ye)=>ye.at-R.at),f=p.map(R=>({at:R.at,status:ri(R.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:oi(l.filter,a)},agent:ii(a),enabled:d,state:u,nextRunAt:h&&d&&y?Ae(i(y,new Date(e),D)):null,lastRun:g?{at:new Date(g.at).toISOString(),status:g.status}:null,lastSuccessAt:(()=>{let R=f.find(ye=>ye.status==="success");return R?new Date(R.at).toISOString():null})(),consecutiveFailures:Yt(f),sampledRuns:p.length,flags:[],attention:null},Z=Date.parse(a.updated||a.created||"");N.flags=h?Zt(N,f,y,D,Number.isFinite(Z)?Z:null,e,n,i):ti(N,o.get(a.id)?.state==="dormant",Number.isFinite(Z)?Z:null,e,n),r.push(Qt(N))}return r.sort(ni).slice(0,k.routines)}function Yt(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 Zt(t,e,n,i,r,o,s,a){let c=[],l=e.length?e[0].at:null;if(!t.enabled){let p=tn(l,r,o,s);return p&&c.push(p),c}if(t.consecutiveFailures>=s.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<s.missedFires&&(d=a(n,u,i),!!d);p++)u=d;return d&&o>d.getTime()+s.graceMs&&c.push({reason:"overdue",detail:`No attempt since ${new Date(l).toISOString()}; ${s.missedFires} scheduled fires missed`}),c}function ti(t,e,n,i,r){let o=[],s=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=tn(s,n,i,r);return a&&o.push(a),o}return t.consecutiveFailures>=r.failStreak&&o.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),s===null?o.push({reason:"never-ran",detail:"No run recorded for this trigger"}):e&&o.push({reason:"dormant",detail:"Fired in the prior week, silent in the last one"}),o}function tn(t,e,n,i){let r=Math.max(t??0,e??0);return r&&n-r<i.disabledDays*Jt?null:{reason:"disabled-long",detail:r?`Disabled; no activity for ${Math.floor((n-r)/Jt)} days`:"Disabled and never ran"}}function Qt(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 en={critical:0,warning:1,info:2};function ni(t,e){let n=t.attention?en[t.attention]:3,i=e.attention?en[e.attention]:3;return n-i||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function ri(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 ii(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 oi(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,o]of Object.entries(t)){let s=Array.isArray(o)?o.map(String):o==null?[]:[String(o)];s.length&&n.push($(`${r}=${s.join(",")}`,k.filterValue))}return n.slice(0,k.filters)}function Ae(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 si(t,e){return t===void 0?void 0:$(t,e)}import{existsSync as oe,readdirSync as $i,readFileSync as Ai}from"fs";import{resolve as E}from"path";import{randomBytes as on}from"crypto";import{existsSync as ci,mkdirSync as li,readdirSync as ui,readFileSync as di,renameSync as sn,unlinkSync as pi,writeFileSync as fi}from"fs";import{resolve as an}from"path";function nn(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var ai=t=>t.trim().split(`
|
|
3
3
|
`).pop()?.slice(0,300)||"no output";async function rn(t,e,n,i=$e){let r=await i(t.bin,[...nn(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return r.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${ai(r.stderr||r.stdout)}`}}async function Ra(t,e,n,i,r=$e){return(await r(t.bin,[...nn(t),"--read-only","media","download","--chat",e,"--id",n,"--output",i],{timeoutMs:12e4})).code===0}var gi=2e3,mi=t=>rn(t.wacli,t.to,t.text);function Ie(t){return an(t,".agentx","whatsapp-triage","drafts")}var hi=t=>/^[a-z0-9-]{8,64}$/.test(t),re=(t,e)=>an(Ie(t),`${e}.json`);function cn(t,e){li(Ie(t),{recursive:!0});let n=re(t,e.id),i=`${n}.${process.pid}.tmp`;fi(i,JSON.stringify(e,null,2)+`
|
|
4
4
|
`,{mode:384}),sn(i,n)}function Pa(t,e,n=Date.now()){let i=e.text.trim().slice(0,gi);if(!i)throw new Error("empty draft");let r={...e,text:i,id:`${n.toString(36)}-${on(4).toString("hex")}`,status:"pending",created_at:new Date(n).toISOString()};return cn(t,r),r}function ie(t,e){if(!hi(e))return null;try{return JSON.parse(di(re(t,e),"utf-8"))}catch{return null}}function ln(t,e){let n=Ie(t);return ci(n)?ui(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 un(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 o=`${re(t,e)}.${process.pid}.${on(3).toString("hex")}.claim`;try{sn(re(t,e),o)}catch{return{ok:!1,error:`reply draft "${e}" is already being decided`}}let s={...r,decided_by:i.by??"operator",decided_at:new Date(i.now??Date.now()).toISOString()};if(n==="no")s.status="rejected";else{let a=await(i.send??mi)(r).catch(c=>({ok:!1,error:String(c?.message??c)}));a.ok?s.status="sent":(s.status="failed",s.error=a.error)}cn(t,s);try{pi(o)}catch{}return s.status==="failed"?{ok:!1,error:s.error??"send failed"}:{ok:!0,draft:s}}import{mkdirSync as yi,readFileSync as bi,renameSync as wi,writeFileSync as ki}from"fs";import{resolve as xi}from"path";function dn(t){return xi(ve(t),"_state.json")}function A(t){try{let e=JSON.parse(bi(dn(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){yi(ve(t),{recursive:!0});let n=dn(t),i=`${n}.${process.pid}.tmp`;ki(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
|
`}It();var Vr={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function Wr(t){return{...Vr,...t??{},regions:{...t?.regions??{}},buffer:{...Vr.buffer,...t?.buffer??{}}}}function Wu(t){try{return Wr(At(t).screen)}catch{return Wr(void 0)}}var ya=/^[a-z][\w-]*$/,Fr=["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 Ur(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 Fu(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[o,s]of Object.entries(e.regions)){if(!ya.test(o))throw new Error(`region name "${o}" must be lowercase letters, digits, - or _`);s===null?delete r[o]:r[o]=Ur(s)}n.regions=r}if(e.buffer&&typeof e.buffer=="object"){let r=e.buffer,o={...n.buffer??{}};"enabled"in r&&(o.enabled=!!r.enabled),"seconds"in r&&(o.seconds=Y(r.seconds,"buffer.seconds",s=>s>0&&s<=120,"above 0 and at most 120")),"fps"in r&&(o.fps=Y(r.fps,"buffer.fps",s=>s>0&&s<=10,"above 0 and at most 10")),"maxPixels"in r&&(o.maxPixels=he(r.maxPixels,"buffer.maxPixels")),"region"in r&&(o.region=String(r.region).trim()),n.buffer=o}let i=n.buffer?.region;if(i!==void 0&&!Fr.includes(i)&&!n.regions?.[i])try{Ur(i)}catch{throw new Error(`buffer.region "${i}" is not a region \u2014 use ${[...Fr,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Xt as a,ka as b,Ze as c,Fo as d,Uo as e,el as f,tl as g,nl as h,er as i,il as j,sl as k,T as l,tr as m,k as n,$a as o,Ra as p,mi as q,Pa as r,un as s,A as t,ja as u,Va as v,mn as w,za as x,z as y,oc as z,kn as A,nr as B,ll as C,pl as D,hr as E,Vl as F,Wl as G,ql as H,Ls as I,Kl as J,ac as K,cc as L,lc as M,uc as N,dc as O,pc as P,gc as Q,mc as R,$c as S,Le as T,Ac as U,Ic as V,q as W,K as X,Ws as Y,nu as Z,ru as _,iu as $,ou as aa,st as ba,su as ca,Ne as da,je as ea,de as fa,so as ga,co as ha,Ec as ia,We as ja,Fe as ka,lo as la,uo as ma,Wn as na,Hn as oa,Tc as pa,go as qa,Pc as ra,So as sa,Ao as ta,Ue as ua,Ro as va,zn as wa,P as xa,_r as ya,Cr as za,Dr as Aa,pu as Ba,Xs as Ca,Tr as Da,Pr as Ea,vu as Fa,$u as Ga,da as Ha,Au as Ia,Mr as Ja,pe as Ka,zc as La,Yn as Ma,Be as Na,Je as Oa,Zc as Pa,Cu as Qa,Du as Ra,Eu as Sa,Tu as Ta,Pu as Ua,Lu as Va,Mu as Wa,Ou as Xa,Nu as Ya,Vr as Za,Wr as _a,Wu as $a,Fr as ab,Fu as bb};
|
|
482
|
-
//# sourceMappingURL=chunk-
|
|
482
|
+
//# sourceMappingURL=chunk-S6NQB7VV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as ce,d as J,e as E,f as K,g as z}from"./chunk-SCJ5ZXEN.js";import{a as de,b as le}from"./chunk-BGG3ZSMW.js";import{b as ae}from"./chunk-WCXXXAHV.js";import{c as oe,e as ie}from"./chunk-LQE73AZR.js";import{
|
|
1
|
+
import{c as ce,d as J,e as E,f as K,g as z}from"./chunk-SCJ5ZXEN.js";import{a as de,b as le}from"./chunk-BGG3ZSMW.js";import{b as ae}from"./chunk-WCXXXAHV.js";import{c as oe,e as ie}from"./chunk-LQE73AZR.js";import{i as F,k as se}from"./chunk-6FVFD5WU.js";import{a as ne,b as re}from"./chunk-4PQREYBU.js";import{a as te}from"./chunk-23SQSUBI.js";import{A as De,R as Z,Y as ze,ga as q,ia as ee,ja as U,ma as j,w as L,x as Q}from"./chunk-IMLLHT7U.js";import{existsSync as M,readFileSync as ve,writeFileSync as be,appendFileSync as Oe,mkdirSync as Be}from"fs";import{dirname as He,resolve as P}from"path";import{fileURLToPath as Le}from"url";import{hostname as qe}from"os";import{spawn as je}from"child_process";j();import{existsSync as ge,readFileSync as pe,writeFileSync as Y,copyFileSync as Me}from"fs";import{resolve as me}from"path";function W(e,t={}){let n=t.configPath||me(process.cwd(),"agentx.json");if(!ge(n))throw new Error(`agentx.json not found at ${n}`);let r=JSON.parse(pe(n,"utf-8")),a=e(r),o=typeof a=="string"?{summary:a}:a,s=JSON.stringify(r,null,2)+`
|
|
2
2
|
`,l=n+".tmp";Y(l,s,"utf-8");try{JSON.parse(pe(l,"utf-8"))}catch(c){throw new Error(`config did not round-trip cleanly: ${c.message}`)}let i;return t.skipBackup||(i=`${n}.bak.${Date.now()}`,Me(n,i)),Y(n,s,"utf-8"),t.skipReload||Ne().catch(()=>{}),{summary:o.summary,payload:o.payload,backupPath:i}}function ue(e,t={}){let n=t.configPath||me(process.cwd(),"agentx.json");if(ge(n)&&!t.overwrite)throw new Error(`agentx.json already exists at ${n}. Pass overwrite=true to replace it.`);return Y(n,JSON.stringify(e,null,2)+`
|
|
3
3
|
`,"utf-8"),{file:n}}async function Ne(){try{let t=U().dashboard.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800";await fetch(`${t}/reload`,{method:"POST"}).catch(()=>null)}catch{}}function fe(e,t){let n=e.configExists?e.agentCount===0?"Add your first agent":"Add another agent":"Set up your team",r=`<header class="ax-topbar">
|
|
4
4
|
<div class="ax-topbar__left">
|
|
@@ -742,4 +742,4 @@ tr:hover td { background: var(--bg-hover); }
|
|
|
742
742
|
WHERE person = ? AND state IN (${n.map(()=>"?").join(",")})
|
|
743
743
|
${r}`).all(t,...n,...a).map(s=>({id:s.id,state:s.state,channel:s.channel,agentId:s.agent_id,text:s.text,createdAt:s.created_at})):[]}function pn(e,t){return Ae(e,t,L,"ORDER BY created_at")}function gn(e,t,n=50){return Ae(e,t,[...L,...Q],"ORDER BY created_at DESC, rowid DESC LIMIT ?",Math.max(1,Math.min(n,500)))}ze();var V="member:",gt=90,mt="members",ut="tailscale-user-login",ft=400,ht=60*60*1e3;function vt(e){let t=e.scopes.find(n=>n.startsWith(V));return t?t.slice(V.length):null}function Ie(e,t){if(!e)return null;let n=t.verify(e),r=n?vt(n):null;return n&&r?{rec:n,personId:r}:null}function xn(e,t){let n=e.people().find(l=>l.id===t);if(!n)return{ok:!1,error:`No person "${t}". Add them first: agentx people add ${t} --name "\u2026"`};let{token:r,record:a}=e.tokens.create({name:`${n.name} (machine not paired yet)`,scopes:[`${V}${n.id}`],expiresInDays:gt}),{code:o,expiresAt:s}=e.codes.create({token:r,tokenId:a.id,name:n.id});return e.members.log({person:n.id,device:a.id,event:"invited"}),{ok:!0,code:o,expiresAt:s,tokenId:a.id,person:n}}var bt=Math.round(oe/6e4);function xt(e){return e==="client"?"Your project":"My work"}function yn(e){let t=xt(e.person.role),n=e.person.role==="client"?`I use AgentX to keep track of the work I do for you. It has a page for you, "${t}": what you asked us for, and where each request stands.`:`I use AgentX to give our AI agents their jobs. It has a page for you, "${t}": what you asked the agents for, and where each request stands.`;return[`Hi ${e.person.name},`,"",n,"","To open it:","1. Accept the Tailscale share I sent you. Tailscale is a small program that connects your computer to mine, privately.",`2. Open ${e.origin.replace(/\/+$/,"")}/member in Edge or Chrome, give your computer a name and type this code: ${ie(e.code)}`,` The code works once, for ${bt} minutes. If it has stopped working, tell me and I will send you a new one.`,"","I then approve your machine, and the page opens by itself."].join(`
|
|
744
744
|
`)}var yt="The private network says someone else is connecting from this machine. Ask the person who invited you for a new code.",kt="Too many machines are waiting for the owner's answer. Try again later.",Se="That code didn't work. Check it, or ask the person who invited you for a new one.",Ee=(e,t)=>{let n=e.headers[t];return(Array.isArray(n)?n[0]:n||"").trim()};function Te(e){let t=e.socket?.remoteAddress||"";return t==="127.0.0.1"||t==="::1"||t==="::ffff:127.0.0.1"}function wt(e){if(!Te(e))return null;let t=Ee(e,ut).toLowerCase();return t?t.slice(0,80):null}function $t(e){let t=e.socket?.remoteAddress||"unknown";if(!Te(e))return t;let n=Ee(e,"x-forwarded-for").split(",").pop().trim();return/^[0-9a-fA-F:.]{2,45}$/.test(n)?n:t}function At(e){return typeof e=="string"?e.replace(/[^\p{L}\p{N} ._'()-]/gu," ").replace(/\s+/g," ").trim().slice(0,60):""}function St(e){return e.identities.map(Z).filter(t=>!!t&&t.channel==="tailscale").map(t=>t.value)}async function kn(e,t){let n=Date.now(),r=t.now??Date.now,a=t.log??(m=>console.log(m)),o=$t(e),s=t.limiter.retryAfter(o);if(s>0)return a(`[member] pair-code refused from ${o}: locked out for ${s}s more`),{status:429,body:{error:"too many attempts",retryAfter:s},retryAfter:s};let l=null,i="";try{let m=await ae(e,2048);l=m.code,i=At(m.machine)}catch{}let c=t.codes.redeem(l),g=c?Ie(c.token,t.tokens):null;if(await Et(n,t.minMs??ft),!c||!g)return t.limiter.fail(o),a(`[member] pair-code failed from ${o}`),{status:401,body:{error:Se}};t.limiter.succeed(o);let{rec:f,personId:d}=g,h=t.people().find(m=>m.id===d);if(!h)return t.tokens.revoke(f.id),t.members.log({person:d,device:f.id,event:"refused",address:o,detail:"person no longer listed"}),a(`[member] pair-code for ${d} refused from ${o}: person no longer listed`),{status:403,body:{error:Se}};let u=wt(e),A=St(h);if(A.length&&(!u||!A.includes(u)))return t.tokens.revoke(f.id),t.members.log({person:d,device:f.id,event:"refused",address:o,detail:`network login ${u??"missing"}; expected ${A.join(" or ")}`}),a(`[member] ${d}: pairing from ${o} refused: the network says "${u??"nobody"}", expected ${A.join(" or ")}`),{status:403,body:{error:yt}};let x=i||"Unnamed machine",y=h.name.slice(0,40),v=se(t.root,{title:`New machine for ${y}`,ask:`From ${o}, ${u?`network login ${u}`:"no network login reported"}. Machine name, as typed there: "${x}". Let it see ${y}'s own work?`,recommend:`Yes if ${y} told you they just paired this machine. No if you did not expect it.`,if_silent:"discard",raised_by:mt},{now:r()});return v.ok?(t.members.add({tokenId:f.id,personId:d,name:x,state:"pending",cardId:v.card.id,address:o,...u?{network:u}:{},createdAt:new Date(r()).toISOString()}),t.members.log({person:d,device:f.id,event:"paired",address:o,detail:x}),a(`[member] ${d} paired "${x}" from ${o}; waiting for the owner (card ${v.card.id})`),{status:200,body:{person:d,name:x,state:"pending"},token:c.token}):(t.tokens.revoke(f.id),t.members.log({person:d,device:f.id,event:"refused",address:o,detail:v.error}),a(`[member] ${d}: pairing from ${o} refused: ${v.error}`),{status:503,body:{error:kt}})}var H="this machine is not paired",It="waiting for the owner to approve this machine";function Ce(e){return e?e.status==="decided"?e.verdict??null:e.status==="expired"?"no":null:null}function wn(e,t){return t.state==="pending"&&t.cardId?Ce(F(e,t.cardId)):null}function $n(e,t,n){let r=t.now??Date.now,a=t.log??(g=>console.log(g)),o=Ie(e,t.tokens);if(!o)return{ok:!1,status:401,error:H};let{rec:s,personId:l}=o,i=t.members.byToken(s.id);if(!i||i.state==="removed"||i.personId!==l)return{ok:!1,status:401,error:H};if(t.people&&!t.people().some(g=>g.id===l))return Re(t,s.id,"person no longer listed"),a(`[member] ${l}: "${i.name}" ended: person no longer listed`),{ok:!1,status:401,error:H};if(i.state==="pending"){let g=i.cardId?F(t.root,i.cardId):null,f=Ce(g);if(f==="yes")i=t.members.update(s.id,{state:"active",approvedAt:new Date(r()).toISOString()})??i,t.members.log({person:l,device:s.id,event:"approved",detail:g?.decided_by}),a(`[member] ${l}: "${i.name}" approved`);else if(f==="no"){let d=g?.status==="expired"?"the owner did not answer in time":"the owner said no";return t.tokens.revoke(s.id),t.members.update(s.id,{state:"removed",removedAt:new Date(r()).toISOString(),removedReason:d}),t.members.log({person:l,device:s.id,event:"refused",detail:d}),a(`[member] ${l}: "${i.name}" refused: ${d}`),{ok:!1,status:401,error:H}}else return{ok:!1,status:403,error:It,waiting:!0}}let c=i.lastSeenAt?Date.parse(i.lastSeenAt):0;return n&&(r()-c>=ht||i.lastAddress!==n)&&(i=t.members.update(s.id,{lastSeenAt:new Date(r()).toISOString(),lastAddress:n})??i,t.members.log({person:l,device:s.id,event:"signed-in",address:n})),{ok:!0,device:i,personId:l,rec:s}}function Re(e,t,n="removed by the owner"){let r=e.members.byToken(t);if(!r)return null;e.tokens.revoke(t);let a=e.members.update(t,{state:"removed",removedAt:new Date((e.now??Date.now)()).toISOString(),removedReason:n});return e.members.log({person:r.personId,device:t,event:"removed",detail:n}),a}function An(e,t){return e.members.devices(t).filter(n=>n.state!=="removed").map(n=>Re(e,n.tokenId,"person removed by the owner")).filter(n=>!!n)}async function Et(e,t){let n=e+t-Date.now();n>0&&await new Promise(r=>setTimeout(r,n))}var Pe=["gitlab","github"];function Tt(e,t,n){let r=String(t||"").trim().toLowerCase();if(!Pe.includes(r))throw new Error(`Request status works on ${Pe.join(" and ")}, not on "${t}".`);e.requestStatus=e.requestStatus&&typeof e.requestStatus=="object"?e.requestStatus:{};let a=Array.isArray(e.requestStatus.channels)?e.requestStatus.channels.map(o=>String(o).toLowerCase()):[];return e.requestStatus.channels=n?[...new Set([...a,r])]:a.filter(o=>o!==r),`request status on ${r} is ${n?"on":"off"}`}function En(e){return Array.isArray(e?.requestStatus?.channels)?e.requestStatus.channels.map(t=>String(t).toLowerCase()):[]}function Tn(e){let{summary:t}=W(n=>Tt(n,e?.channel,!!e?.enabled));return{summary:t}}var Ct="https://ntfy.sh";function Rn(e){return{enabled:!!e?.enabled,server:e?.server||Ct,topicSet:!!e?.topic,tokenSet:!!e?.token}}function Pn(e,t){let n={...e??{}};if("enabled"in t&&(n.enabled=!!t.enabled),"server"in t){let r=String(t.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(r))throw new Error("ntfy server must be an http(s) URL");n.server=r}if("topic"in t){let r=String(t.topic).trim();if(!r)throw new Error("ntfy topic cannot be empty");n.topic=r}if("token"in t){let r=String(t.token??"").trim();r?n.token=r:delete n.token}if(n.enabled&&!n.topic)throw new Error("set a topic before enabling ntfy");return n}export{W as a,xe as b,jt as c,Ft as d,Jt as e,Vt as f,Qt as g,Zt as h,cn as i,pn as j,gn as k,gt as l,xn as m,bt as n,xt as o,yn as p,$t as q,kn as r,wn as s,$n as t,Re as u,An as v,Pe as w,Tt as x,En as y,Tn as z,Rn as A,Pn as B,lt as C,sn as D};
|
|
745
|
-
//# sourceMappingURL=chunk-
|
|
745
|
+
//# sourceMappingURL=chunk-UAPWOE2W.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-E3NTPNCZ.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,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=grants-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-7ZABMMSW.js";import"./chunk-6FVFD5WU.js";import"./chunk-Y4CYQV7G.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{c as DEFAULT_GRANT_DAYS,a as GUEST_SCOPE_PREFIX,b as JOIN_CARD_BY,h as JOIN_FAILED,d as MAX_GRANT_DAYS,j as NO_GRANT,l as PAUSED,k as WAITING_HOST,s as endGrant,o as grantBrief,u as grantForGuest,e as grantIdOf,n as guestAccess,p as guestTask,g as inviteGuest,i as joinGuest,f as newGrantId,q as pauseGrant,r as resumeGrant,m as settleGrant,t as updateGrant};
|
|
2
|
+
//# sourceMappingURL=grants-ZMHSJMYE.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,
|
|
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,ja as Tt,ka as Mt}from"./chunk-PCOXSCYT.js";import"./chunk-S6NQB7VV.js";import"./chunk-GTJIKXDB.js";import"./chunk-KQX3U3H2.js";import"./chunk-S2GAEH2F.js";import"./chunk-BGG3ZSMW.js";import"./chunk-ZVP6GB4G.js";import"./chunk-XGOBZCYC.js";import"./chunk-WCXXXAHV.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-7ZABMMSW.js";import"./chunk-6FVFD5WU.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-FSXWNVGL.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-EMGB23H5.js";import"./chunk-JWDJMFU6.js";import"./chunk-GRMCAO3Q.js";import"./chunk-KZKDVIOE.js";import{ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-247SOQLP.js";import"./chunk-RJBRYUKU.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-AXFE34OV.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-IOYRRGK7.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-B6OXEIOF.js";import"./chunk-4PQREYBU.js";import"./chunk-VWTBHLMX.js";import"./chunk-23SQSUBI.js";import{a as ht}from"./chunk-HK7TU5NX.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-2G227TF3.js";import"./chunk-MYVHVJWZ.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-6JJJ5MUU.js";import{f as gt,g as ft}from"./chunk-FTZCNID3.js";import"./chunk-WPNRDEHW.js";import"./chunk-56KNKUFF.js";import{j as it,k as rt,l as at}from"./chunk-NDPU6AX2.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-IMLLHT7U.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.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).
|