agentix-cli 0.79.1 → 0.79.2
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-NZQQXETO.js → App-PFMTQ7J5.js} +2 -2
- package/dist/{ChatApp-CSVN3PRK.js → ChatApp-ZBSU2F6J.js} +2 -2
- package/dist/{agent-RTZDVG5B.js → agent-AMU6E27Z.js} +2 -2
- package/dist/{board-dashboard-SI5GP3XR.js → board-dashboard-PCRI2TGB.js} +4 -4
- package/dist/{chunk-2YIWQ57T.js → chunk-2ACZWM7F.js} +2 -2
- package/dist/{chunk-3OIFSKSR.js → chunk-2ZQ42Q4L.js} +2 -2
- package/dist/{chunk-B5VRY4NI.js → chunk-6SJTBTDG.js} +2 -2
- package/dist/{chunk-QAKL2D7O.js → chunk-7QRCAHPX.js} +2 -2
- package/dist/{chunk-2WRWBPDL.js → chunk-CNSPC4BZ.js} +2 -2
- package/dist/{chunk-Y4EWOE4N.js → chunk-DVTLDW66.js} +13 -13
- package/dist/{chunk-QIMIARFO.js → chunk-EAYHYAF3.js} +2 -2
- package/dist/{chunk-TQT4XDNN.js → chunk-EUVMKZUC.js} +2 -2
- package/dist/{chunk-EOBFJGTV.js → chunk-H7SL56KH.js} +3 -3
- package/dist/{chunk-QJM2D22B.js → chunk-HJ5FE33W.js} +222 -218
- package/dist/chunk-HJ5FE33W.js.map +1 -0
- package/dist/{chunk-N2A3KIVY.js → chunk-HTKSZZXK.js} +2 -2
- package/dist/{chunk-THZOPGSP.js → chunk-LNQOJC57.js} +2 -2
- package/dist/{chunk-2XSVV3M3.js → chunk-LPDQ2KK4.js} +2 -2
- package/dist/{chunk-P5KHF46N.js → chunk-M4XUZA3O.js} +2 -2
- package/dist/{chunk-3AFZBXNX.js → chunk-MGCTX2BB.js} +2 -2
- package/dist/{chunk-IXWPA6WM.js → chunk-R7WZUUYO.js} +2 -2
- package/dist/{chunk-PF5ZXMEG.js → chunk-RD5EKHGZ.js} +2 -2
- package/dist/{chunk-VIUCCUJ4.js → chunk-WNI2P7S6.js} +2 -2
- package/dist/{chunk-IWQURDYO.js → chunk-WVYOXM45.js} +2 -2
- package/dist/{chunk-SYXAEWFN.js → chunk-X6WZ54UJ.js} +5 -5
- package/dist/{chunk-ZBRZ5T2G.js → chunk-XFCSJUGY.js} +2 -2
- package/dist/{chunk-KH4PKJGD.js → chunk-YKPISR5J.js} +1 -1
- package/dist/{chunk-KH4PKJGD.js.map → chunk-YKPISR5J.js.map} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client-XAE7NLE2.js +2 -0
- package/dist/{config-OQVGSZWB.js → config-5HAWFIEL.js} +2 -2
- package/dist/config-mutator-Y7KAC4AC.js +2 -0
- package/dist/{doctor-NHEB7IMW.js → doctor-DST4SVW4.js} +2 -2
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/program-ONVBE267.js +2 -0
- package/dist/{promote-O6Y2RG4K.js → promote-CQCRZCYB.js} +2 -2
- package/dist/{query-J3XX5U3P.js → query-WSLKGCQN.js} +2 -2
- package/dist/{registry-DBLLSQ75.js → registry-6HKQKIBD.js} +2 -2
- package/dist/{request-planner-NP2XHSMV.js → request-planner-TNDIQMHS.js} +2 -2
- package/dist/{review-candidates-J3OBF4GM.js → review-candidates-SXVIYCVE.js} +2 -2
- package/dist/{routing-VTQBG767.js → routing-GQWG65DQ.js} +2 -2
- package/dist/schedule-tool-WXRMJMW6.js +2 -0
- package/dist/scheduler-YW6JFH3Z.js +2 -0
- package/dist/{seat-NBQOUDGU.js → seat-K2JSQIZ4.js} +2 -2
- package/dist/{select-T5FEWTZA.js → select-WKMMUWLU.js} +2 -2
- package/dist/{set-enabled-2GHZXDEA.js → set-enabled-RIE3PLNJ.js} +2 -2
- package/dist/{tool-6WLJTCE5.js → tool-TAMRBONN.js} +2 -2
- package/dist/wiki-WBRXHY7J.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-QJM2D22B.js.map +0 -1
- package/dist/client-TZPRACLX.js +0 -2
- package/dist/config-mutator-BA7YVYJY.js +0 -2
- package/dist/program-TSFYLHMZ.js +0 -2
- package/dist/schedule-tool-RQBVG3ZJ.js +0 -2
- package/dist/scheduler-BHXA74R6.js +0 -2
- package/dist/wiki-ZB6KMJKX.js +0 -2
- /package/dist/{App-NZQQXETO.js.map → App-PFMTQ7J5.js.map} +0 -0
- /package/dist/{ChatApp-CSVN3PRK.js.map → ChatApp-ZBSU2F6J.js.map} +0 -0
- /package/dist/{agent-RTZDVG5B.js.map → agent-AMU6E27Z.js.map} +0 -0
- /package/dist/{board-dashboard-SI5GP3XR.js.map → board-dashboard-PCRI2TGB.js.map} +0 -0
- /package/dist/{chunk-2YIWQ57T.js.map → chunk-2ACZWM7F.js.map} +0 -0
- /package/dist/{chunk-3OIFSKSR.js.map → chunk-2ZQ42Q4L.js.map} +0 -0
- /package/dist/{chunk-B5VRY4NI.js.map → chunk-6SJTBTDG.js.map} +0 -0
- /package/dist/{chunk-QAKL2D7O.js.map → chunk-7QRCAHPX.js.map} +0 -0
- /package/dist/{chunk-2WRWBPDL.js.map → chunk-CNSPC4BZ.js.map} +0 -0
- /package/dist/{chunk-Y4EWOE4N.js.map → chunk-DVTLDW66.js.map} +0 -0
- /package/dist/{chunk-QIMIARFO.js.map → chunk-EAYHYAF3.js.map} +0 -0
- /package/dist/{chunk-TQT4XDNN.js.map → chunk-EUVMKZUC.js.map} +0 -0
- /package/dist/{chunk-EOBFJGTV.js.map → chunk-H7SL56KH.js.map} +0 -0
- /package/dist/{chunk-N2A3KIVY.js.map → chunk-HTKSZZXK.js.map} +0 -0
- /package/dist/{chunk-THZOPGSP.js.map → chunk-LNQOJC57.js.map} +0 -0
- /package/dist/{chunk-2XSVV3M3.js.map → chunk-LPDQ2KK4.js.map} +0 -0
- /package/dist/{chunk-P5KHF46N.js.map → chunk-M4XUZA3O.js.map} +0 -0
- /package/dist/{chunk-3AFZBXNX.js.map → chunk-MGCTX2BB.js.map} +0 -0
- /package/dist/{chunk-IXWPA6WM.js.map → chunk-R7WZUUYO.js.map} +0 -0
- /package/dist/{chunk-PF5ZXMEG.js.map → chunk-RD5EKHGZ.js.map} +0 -0
- /package/dist/{chunk-VIUCCUJ4.js.map → chunk-WNI2P7S6.js.map} +0 -0
- /package/dist/{chunk-IWQURDYO.js.map → chunk-WVYOXM45.js.map} +0 -0
- /package/dist/{chunk-SYXAEWFN.js.map → chunk-X6WZ54UJ.js.map} +0 -0
- /package/dist/{chunk-ZBRZ5T2G.js.map → chunk-XFCSJUGY.js.map} +0 -0
- /package/dist/{client-TZPRACLX.js.map → client-XAE7NLE2.js.map} +0 -0
- /package/dist/{config-OQVGSZWB.js.map → config-5HAWFIEL.js.map} +0 -0
- /package/dist/{config-mutator-BA7YVYJY.js.map → config-mutator-Y7KAC4AC.js.map} +0 -0
- /package/dist/{doctor-NHEB7IMW.js.map → doctor-DST4SVW4.js.map} +0 -0
- /package/dist/{program-TSFYLHMZ.js.map → program-ONVBE267.js.map} +0 -0
- /package/dist/{promote-O6Y2RG4K.js.map → promote-CQCRZCYB.js.map} +0 -0
- /package/dist/{query-J3XX5U3P.js.map → query-WSLKGCQN.js.map} +0 -0
- /package/dist/{registry-DBLLSQ75.js.map → registry-6HKQKIBD.js.map} +0 -0
- /package/dist/{request-planner-NP2XHSMV.js.map → request-planner-TNDIQMHS.js.map} +0 -0
- /package/dist/{review-candidates-J3OBF4GM.js.map → review-candidates-SXVIYCVE.js.map} +0 -0
- /package/dist/{routing-VTQBG767.js.map → routing-GQWG65DQ.js.map} +0 -0
- /package/dist/{schedule-tool-RQBVG3ZJ.js.map → schedule-tool-WXRMJMW6.js.map} +0 -0
- /package/dist/{scheduler-BHXA74R6.js.map → scheduler-YW6JFH3Z.js.map} +0 -0
- /package/dist/{seat-NBQOUDGU.js.map → seat-K2JSQIZ4.js.map} +0 -0
- /package/dist/{select-T5FEWTZA.js.map → select-WKMMUWLU.js.map} +0 -0
- /package/dist/{set-enabled-2GHZXDEA.js.map → set-enabled-RIE3PLNJ.js.map} +0 -0
- /package/dist/{tool-6WLJTCE5.js.map → tool-TAMRBONN.js.map} +0 -0
- /package/dist/{wiki-ZB6KMJKX.js.map → wiki-WBRXHY7J.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as l,w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{v as l,w}from"./chunk-7QRCAHPX.js";import{a as i,f as p}from"./chunk-72SZI2UW.js";w();p();var d="task-tier";function u(e){return{task:m(e.message,2e3),agent:e.agent,channel:e.channel??null,continuesExistingSession:e.isFollowUp??!1,...e.toolsAvailable?{toolsAvailable:e.toolsAvailable}:{}}}var c={needsFlagship:i("This task needs the strongest available model to be done correctly.",{true:"Doing it well takes real reasoning: writing or reviewing code, diagnosing a failure, planning work across several steps, weighing a judgement, handling money, touching production or anything irreversible, following a long or ambiguous instruction, or work where being subtly wrong would not be noticed. Anything where a weaker model would produce something that LOOKS right belongs here.",false:"It is mechanical and its result is obvious on sight: acknowledging or confirming a message, restating or formatting something already written, a greeting, a status echo, reading one file and reporting what it says, a lookup with one right answer, a scheduled heartbeat with nothing to decide."})};function g(e){return e.needsFlagship.noul}function m(e,n){return e.length>n?`${e.slice(0,n)}\u2026`:e}var h=.2,T=60*60*1e3;function F(e,n){if(e==="claude-code"){let t=n?.cheapModels?.[e]??n?.cheapModel;return t&&/^(claude-|haiku$|sonnet$|opus$)/.test(t)?t:void 0}if(e==="codex-cli"){let t=n?.cheapModels?.[e];return t&&/^(gpt-|o\d)/.test(t)?t:void 0}}async function _(e){let n=(s,r=null)=>({downgraded:!1,needsFlagship:r,reason:s});if(e.channel==="voice"||e.channel==="desktop"||e.channel==="opencode")return n(`${e.channel} requests retain the configured model`);if(!e.cheapModel)return n("no cheaper model configured");if(e.isFollowUp){let s=e.sessionIdleMs??0,r=e.cacheTtlMs??T;if(s<r)return n(`follow-up on a warm cache (idle ${Math.round(s/1e3)}s) \u2014 swapping would cost more than it saves`)}let t;try{t=await l(d,u(e),c,{incumbent:{needsFlagship:1},features:{agent:e.agent,channel:e.channel??"unknown"},timeoutMs:1500})}catch{return n("routing seat threw \u2014 keeping the flagship")}if(!t)return n("routing seat unavailable \u2014 keeping the flagship");let o=g(t.answers);if(t.mode!=="active")return n(`shadow \u2014 would ${o<(e.threshold??h)?"downgrade":"keep"} (${o.toFixed(2)})`,o);let a=e.threshold??h;return o>=a?n(`needs the flagship (${o.toFixed(2)})`,o):{model:e.cheapModel,downgraded:!0,needsFlagship:o,reason:`mechanical task (${o.toFixed(2)} below ${a}) \u2192 ${e.cheapModel}`}}export{F as a,_ as b};
|
|
2
|
+
//# sourceMappingURL=chunk-EAYHYAF3.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{E as m,H as b}from"./chunk-
|
|
1
|
+
import{E as m,H as b}from"./chunk-YKPISR5J.js";b();function w(t){let e=typeof t.node=="string"?t.node:"",n=typeof t.token=="string"?t.token:"";if(!e||!n)try{let o=m(t.config);e||(e=o.dashboard?.daemonUrl||""),n||(n=o.dashboard?.token||"")}catch{}return e||(e="http://localhost:18800"),{baseUrl:e.replace(/\/+$/,""),token:n}}async function d(t,e,n){let o={Accept:"application/json"};t.token&&(o.Authorization=`Bearer ${t.token}`);let r=await fetch(`${t.baseUrl}${e}`,{headers:o,signal:n});if(!r.ok)throw new Error(`GET ${e} \u2192 HTTP ${r.status}`);return await r.json()}function R(t,e){return d(t,"/agents",e)}async function S(t,e){return(await d(t,"/api/processes",e)).processes??[]}function P(t,e){return d(t,"/crons",e)}async function h(t,e,n,o){let r={Accept:"application/json","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}${e}`,{method:"POST",headers:r,body:JSON.stringify(n),signal:o}),a=await s.text(),i;try{i=a?JSON.parse(a):{}}catch{i={raw:a}}if(!s.ok)throw new Error(i?.error||`POST ${e} \u2192 HTTP ${s.status}`);return i}function A(t,e,n="tui"){return h(t,"/api/processes/kill",{...e,reason:n})}function C(t,e,n,o){return h(t,"/task",{agent:e,message:n,context:o??{channel:"tui",chatId:"tui:operator"}})}async function $(t,e,n,o={}){let r={Accept:"text/event-stream","Content-Type":"application/json"};t.token&&(r.Authorization=`Bearer ${t.token}`);let s=await fetch(`${t.baseUrl}/task`,{method:"POST",headers:r,body:JSON.stringify({agent:e,message:n,stream:!0,context:{channel:o.channel??"chat-cli",chatId:o.chatId??"chat-cli:operator"}}),signal:o.signal});if(!s.ok||!s.body){let g=await s.text().catch(()=>"");throw new Error(`POST /task (stream) \u2192 HTTP ${s.status}${g?`: ${g.slice(0,200)}`:""}`)}let a=s.body.getReader(),i=new TextDecoder,u={content:""},c="";try{for(;;){let{done:g,value:p}=await a.read();if(g)break;c+=i.decode(p,{stream:!0});let l;for(;(l=c.indexOf(`
|
|
2
2
|
|
|
3
3
|
`))>=0;){let k=c.slice(0,l);c=c.slice(l+2);let f=x(k);f&&T(f,o,u)}}}finally{try{a.releaseLock()}catch{}}return u}function T(t,e,n){let{event:o,data:r}=t;switch(o){case"text":r?.text&&(n.content+=r.text,e.onText?.(r.text));break;case"thinking":r?.text&&e.onThinking?.(r.text);break;case"tool":e.onTool?.(r);break;case"done":typeof r?.content=="string"&&(n.content=r.content),n.usage=r?.usage,n.duration=r?.duration;break;case"error":n.error=r?.error,n.errorKind=r?.errorKind;break}}function x(t){let e="message",n="";for(let r of t.split(`
|
|
4
4
|
`))r.startsWith("event: ")?e=r.slice(7).trim():r.startsWith("data: ")&&(n=r.slice(6));if(!n)return null;let o;try{o=JSON.parse(n)}catch{o=n}return{event:e,data:o}}export{w as a,R as b,S as c,P as d,A as e,C as f,$ as g};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-EUVMKZUC.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as we}from"./chunk-7XB2CVC3.js";import{t as $t,u as It}from"./chunk-
|
|
1
|
+
import{a as we}from"./chunk-7XB2CVC3.js";import{t as $t,u as It}from"./chunk-2ZQ42Q4L.js";import{d as xt,e as vt}from"./chunk-AQASR6KR.js";import{b as ye,u as ft,w as Q,x as be,z as ke}from"./chunk-2ACZWM7F.js";import{c as kt,e as wt,f as St}from"./chunk-Y4CYQV7G.js";import{g as pt,h as mt,i as ht,k as yt,l as bt}from"./chunk-WVYOXM45.js";import{q as gt}from"./chunk-6SJTBTDG.js";import{E as dt,H as lr,r as Z,s as ct,t as ut,u as ar}from"./chunk-YKPISR5J.js";import{existsSync as cr,readdirSync as ur,readFileSync as dr,statSync as gr}from"fs";import{resolve as fr}from"path";function At(t,e,n=Date.now(),s=7){let r=s*864e5,i=new Map;for(let o of e){let a=i.get(o.workflowId);a?a.push(o):i.set(o.workflowId,[o])}return t.map(o=>{let a=i.get(o.id)??[],l=a.filter(p=>n-p.at<=r),c=a.filter(p=>n-p.at>r&&n-p.at<=r*2),u=l.filter(p=>p.status==="failed").length,d=a.filter(p=>p.status==="paused").length,g=a.length?Math.max(...a.map(p=>p.at)):null,f=a.length?c.length>0&&l.length===0?"dormant":l.length>0&&u*2>=l.length?"failing":l.length>0?"active":"quiet":"never";return{id:o.id,name:o.name||o.id,state:f,lastRunAt:g,recent:l.length,prior:c.length,failed:u,paused:d}}).sort((o,a)=>{let l={dormant:0,failing:1,active:2,quiet:3,never:4};return l[o.state]-l[a.state]||(a.lastRunAt??0)-(o.lastRunAt??0)})}var ee=new Map;function xo(t,e=1e3){if(!cr(t))return[];let n=ur(t).filter(i=>i.endsWith(".jsonl")).map(i=>{let o=fr(t,i);return{path:o,mtime:gr(o).mtimeMs}}).sort((i,o)=>o.mtime-i.mtime).slice(0,e),s=new Set(n.map(i=>i.path));for(let i of ee.keys())s.has(i)||ee.delete(i);let r=[];for(let{path:i,mtime:o}of n){let a=ee.get(i);if(a&&a.mtime===o){a.summary&&r.push(a.summary);continue}let l=pr(i,o);ee.set(i,{mtime:o,summary:l}),l&&r.push(l)}return r}function pr(t,e){try{let n=dr(t,"utf-8").split(`
|
|
2
2
|
`).filter(Boolean);if(!n.length)return null;let s=JSON.parse(n[0]),r=s.run?.workflowId;if(!r)return null;let i=s.run?.status??"unknown";for(let o=n.length-1;o>=0;o--){let a=JSON.parse(n[o]),l=a.status??a.run?.status;if(l){i=l;break}}return{workflowId:r,status:i,at:e}}catch{return null}}var mr={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},w={routines:200,summary:160,filters:6,filterValue:60,text:120},hr=(t,e,n)=>{try{return gt(t,e,n)}catch{return null}},_t=864e5;function Ao(t){let e=t.now??Date.now(),n={...mr,...t.thresholds},s=t.nextFire??hr,r=[];for(let a of t.crons){let l=t.cronRuns.get(a.id)??[],c=a.timezone||"UTC",u=l.map(f=>({at:Date.parse(f.startedAt),status:f.status})),d=l[0],g={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:$(a.id,w.text),trigger:{schedule:$(a.schedule,w.text),timezone:c},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?Se(a.nextRun)??Se(s(a.schedule,new Date(e),c)):null,lastRun:d?{at:d.startedAt,status:d.status,summary:xr(d.status==="success"?void 0:d.errorSummary,w.summary)}:null,lastSuccessAt:l.find(f=>f.status==="success")?.startedAt??null,consecutiveFailures:Rt(u),sampledRuns:l.length,flags:[],attention:null};g.flags=Ct(g,u,a.schedule,c,null,e,n,s),r.push(Dt(g))}let i=new Map(At(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 l=o.get(a.workflowId);l?l.push(a):o.set(a.workflowId,[a])}for(let a of t.workflows){let l=a.nodes.find(_=>_.type.startsWith("trigger."));if(!l||l.type!=="trigger.cron"&&l.type!=="trigger.hook")continue;let c=l.config??{},u=a.state||"active",d=u==="active",g=(o.get(a.id)??[]).slice().sort((_,he)=>he.at-_.at),f=g.map(_=>({at:_.at,status:kr(_.status)})),p=f[0],h=l.type==="trigger.cron",y=typeof c.spec=="string"?c.spec:"",C=typeof c.timezone=="string"?c.timezone:"UTC",O={id:`workflow:${a.id}`,source:"workflow",kind:h?"schedule":"event",name:$(a.title||a.id,w.text),trigger:h?{schedule:$(y,w.text),timezone:C}:{event:$(typeof c.event=="string"?c.event:"",w.text),filters:Sr(c.filter,a)},agent:wr(a),enabled:d,state:u,nextRunAt:h&&d&&y?Se(s(y,new Date(e),C)):null,lastRun:p?{at:new Date(p.at).toISOString(),status:p.status}:null,lastSuccessAt:(()=>{let _=f.find(he=>he.status==="success");return _?new Date(_.at).toISOString():null})(),consecutiveFailures:Rt(f),sampledRuns:g.length,flags:[],attention:null},Y=Date.parse(a.updated||a.created||"");O.flags=h?Ct(O,f,y,C,Number.isFinite(Y)?Y:null,e,n,s):yr(O,i.get(a.id)?.state==="dormant",Number.isFinite(Y)?Y:null,e,n),r.push(Dt(O))}return r.sort(br).slice(0,w.routines)}function Rt(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 Ct(t,e,n,s,r,i,o,a){let l=[],c=e.length?e[0].at:null;if(!t.enabled){let g=Et(c,r,i,o);return g&&l.push(g),l}if(t.consecutiveFailures>=o.failStreak&&l.push({reason:"failing",detail:`${t.consecutiveFailures} failed attempts in a row`}),c===null)return l.push({reason:"never-ran",detail:"No persisted attempt"}),l;let u=new Date(c),d=null;for(let g=0;g<o.missedFires&&(d=a(n,u,s),!!d);g++)u=d;return d&&i>d.getTime()+o.graceMs&&l.push({reason:"overdue",detail:`No attempt since ${new Date(c).toISOString()}; ${o.missedFires} scheduled fires missed`}),l}function yr(t,e,n,s,r){let i=[],o=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=Et(o,n,s,r);return a&&i.push(a),i}return t.consecutiveFailures>=r.failStreak&&i.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),o===null?i.push({reason:"never-ran",detail:"No run recorded for this trigger"}):e&&i.push({reason:"dormant",detail:"Fired in the prior week, silent in the last one"}),i}function Et(t,e,n,s){let r=Math.max(t??0,e??0);return r&&n-r<s.disabledDays*_t?null:{reason:"disabled-long",detail:r?`Disabled; no activity for ${Math.floor((n-r)/_t)} days`:"Disabled and never ran"}}function Dt(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 Tt={critical:0,warning:1,info:2};function br(t,e){let n=t.attention?Tt[t.attention]:3,s=e.attention?Tt[e.attention]:3;return n-s||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function kr(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 wr(t){if(t.ownerAgent)return $(t.ownerAgent,w.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?$(String(e.config.agentId),w.text):null}function Sr(t,e){let n=[],s=e?.project;if(s&&n.push($(`project=${s}`,w.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[r,i]of Object.entries(t)){let o=Array.isArray(i)?i.map(String):i==null?[]:[String(i)];o.length&&n.push($(`${r}=${o.join(",")}`,w.filterValue))}return n.slice(0,w.filters)}function Se(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 xr(t,e){return t===void 0?void 0:$(t,e)}import{createHash as vr,randomBytes as Lt}from"crypto";import{existsSync as $r,mkdirSync as Ir,readFileSync as Ar,writeFileSync as _r}from"fs";import{resolve as Rr,dirname as Cr}from"path";var xe="agx_live_",Dr=".agentx/tokens.json",Ot=class{file;constructor(e=process.cwd(),n=Dr){this.file=Rr(e,n)}load(){if(!$r(this.file))return[];try{return JSON.parse(Ar(this.file,"utf-8"))}catch{return[]}}save(e){Ir(Cr(this.file),{recursive:!0}),_r(this.file,JSON.stringify(e,null,2)+`
|
|
3
3
|
`,"utf-8")}create(e){if(!e.name?.trim())throw new Error("Token name is required.");if(!Array.isArray(e.scopes)||e.scopes.length===0)throw new Error("At least one scope is required.");for(let o of e.scopes)if(!Tr(o))throw new Error(`Invalid scope: ${o}`);let n=Lt(32).toString("hex"),s=xe+n,r={id:"tok_"+Lt(4).toString("hex"),name:e.name.trim(),prefix:xe+n.slice(0,4),hash:Pt(s),scopes:[...e.scopes],createdAt:new Date().toISOString(),expiresAt:e.expiresInDays?new Date(Date.now()+e.expiresInDays*86400*1e3).toISOString():void 0},i=this.load();return i.push(r),this.save(i),{token:s,record:r}}list(){return this.load()}revoke(e){let n=this.load(),s=n.find(r=>r.id===e);return s?(s.revokedAt=new Date().toISOString(),this.save(n),s):null}isActive(e){let n=this.load().find(s=>s.id===e);return!!n&&!n.revokedAt&&!(n.expiresAt&&Date.parse(n.expiresAt)<Date.now())}verify(e){if(!e||!e.startsWith(xe))return null;let n=Pt(e),s=this.load(),r=s.find(a=>a.hash===n);if(!r||r.revokedAt||r.expiresAt&&Date.parse(r.expiresAt)<Date.now())return null;let i=Date.now(),o=r.lastUsedAt?Date.parse(r.lastUsedAt):0;if(i-o>6e4){r.lastUsedAt=new Date(i).toISOString();try{this.save(s)}catch{}}return r}};function To(t,e){return!!(t.scopes.includes(e)||e.startsWith("agent:")&&t.scopes.includes("agent:*")||e==="dashboard:read"&&t.scopes.includes("dashboard:write"))}function Tr(t){return t==="dashboard:read"||t==="dashboard:write"||t==="agent:*"||/^agent:[a-z0-9][a-z0-9_-]*$/.test(t)||t==="mesh:peer"||t==="app"}function Pt(t){return"sha256:"+vr("sha256").update(t).digest("hex")}function Eo(t){let e=t.headers.authorization,n=Array.isArray(e)?e[0]:e;if(n&&n.toLowerCase().startsWith("bearer "))return n.slice(7).trim();if(t.url)try{let r=new URL(t.url,"http://localhost").searchParams.get("token");if(r)return r}catch{}return null}import{existsSync as $e,readdirSync as ss,readFileSync as is}from"fs";import{resolve as M}from"path";import{randomBytes as Vt}from"crypto";import{existsSync as Lr,mkdirSync as Or,readdirSync as Pr,readFileSync as jr,renameSync as Nt,unlinkSync as Mr,writeFileSync as Vr}from"fs";import{resolve as Ft}from"path";function jt(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var Er=t=>t.trim().split(`
|
|
4
4
|
`).pop()?.slice(0,300)||"no output";async function Mt(t,e,n,s=we){let r=await s(t.bin,[...jt(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return r.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${Er(r.stderr||r.stdout)}`}}async function Po(t,e,n,s,r=we){return(await r(t.bin,[...jt(t),"--read-only","media","download","--chat",e,"--id",n,"--output",s],{timeoutMs:12e4})).code===0}var Nr=2e3,Fr=t=>Mt(t.wacli,t.to,t.text);function ve(t){return Ft(t,".agentx","whatsapp-triage","drafts")}var Ur=t=>/^[a-z0-9-]{8,64}$/.test(t),te=(t,e)=>Ft(ve(t),`${e}.json`);function Ut(t,e){Or(ve(t),{recursive:!0});let n=te(t,e.id),s=`${n}.${process.pid}.tmp`;Vr(s,JSON.stringify(e,null,2)+`
|
|
@@ -152,5 +152,5 @@ Document the arguments, commands, or files the skill expects. Example:
|
|
|
152
152
|
# Example invocation
|
|
153
153
|
claude-code ${lt(t)} --arg value
|
|
154
154
|
\`\`\`
|
|
155
|
-
`}lr();var rr={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function sr(t){return{...rr,...t??{},regions:{...t?.regions??{}},buffer:{...rr.buffer,...t?.buffer??{}}}}function bc(t){try{return sr(dt(t).screen)}catch{return sr(void 0)}}var ko=/^[a-z][\w-]*$/,ir=["window","screen","menubar","notifications"];function q(t,e,n,s){let r=Number(t);if(t===""||t===null||!Number.isFinite(r)||!n(r))throw new Error(`${e} must be ${s}`);return r}var me=(t,e)=>q(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function or(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 kc(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=me(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=me(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=me(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=q(e.stableMs,"stableMs",r=>Number.isInteger(r)&&r>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=q(e.changeThreshold,"changeThreshold",r=>r>=0&&r<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let r={...n.regions??{}};for(let[i,o]of Object.entries(e.regions)){if(!ko.test(i))throw new Error(`region name "${i}" must be lowercase letters, digits, - or _`);o===null?delete r[i]:r[i]=or(o)}n.regions=r}if(e.buffer&&typeof e.buffer=="object"){let r=e.buffer,i={...n.buffer??{}};"enabled"in r&&(i.enabled=!!r.enabled),"seconds"in r&&(i.seconds=q(r.seconds,"buffer.seconds",o=>o>0&&o<=120,"above 0 and at most 120")),"fps"in r&&(i.fps=q(r.fps,"buffer.fps",o=>o>0&&o<=10,"above 0 and at most 10")),"maxPixels"in r&&(i.maxPixels=me(r.maxPixels,"buffer.maxPixels")),"region"in r&&(i.region=String(r.region).trim()),n.buffer=i}let s=n.buffer?.region;if(s!==void 0&&!ir.includes(s)&&!n.regions?.[s])try{or(s)}catch{throw new Error(`buffer.region "${s}" is not a region \u2014 use ${[...ir,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{At as a,xo as b,Je as c,ki as d,wi as e,gl as f,fl as g,pl as h,jn as i,hl as j,bl as k,D as l,Mn as m,w as n,Ao as o,Ot as p,To as q,Pt as r,Eo as s,zt as t,
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
`}lr();var rr={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function sr(t){return{...rr,...t??{},regions:{...t?.regions??{}},buffer:{...rr.buffer,...t?.buffer??{}}}}function bc(t){try{return sr(dt(t).screen)}catch{return sr(void 0)}}var ko=/^[a-z][\w-]*$/,ir=["window","screen","menubar","notifications"];function q(t,e,n,s){let r=Number(t);if(t===""||t===null||!Number.isFinite(r)||!n(r))throw new Error(`${e} must be ${s}`);return r}var me=(t,e)=>q(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function or(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 kc(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=me(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=me(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=me(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=q(e.stableMs,"stableMs",r=>Number.isInteger(r)&&r>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=q(e.changeThreshold,"changeThreshold",r=>r>=0&&r<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let r={...n.regions??{}};for(let[i,o]of Object.entries(e.regions)){if(!ko.test(i))throw new Error(`region name "${i}" must be lowercase letters, digits, - or _`);o===null?delete r[i]:r[i]=or(o)}n.regions=r}if(e.buffer&&typeof e.buffer=="object"){let r=e.buffer,i={...n.buffer??{}};"enabled"in r&&(i.enabled=!!r.enabled),"seconds"in r&&(i.seconds=q(r.seconds,"buffer.seconds",o=>o>0&&o<=120,"above 0 and at most 120")),"fps"in r&&(i.fps=q(r.fps,"buffer.fps",o=>o>0&&o<=10,"above 0 and at most 10")),"maxPixels"in r&&(i.maxPixels=me(r.maxPixels,"buffer.maxPixels")),"region"in r&&(i.region=String(r.region).trim()),n.buffer=i}let s=n.buffer?.region;if(s!==void 0&&!ir.includes(s)&&!n.regions?.[s])try{or(s)}catch{throw new Error(`buffer.region "${s}" is not a region \u2014 use ${[...ir,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{At as a,xo as b,Je as c,ki as d,wi as e,gl as f,fl as g,pl as h,jn as i,hl as j,bl as k,D as l,Mn as m,w as n,Ao as o,Ot as p,To as q,Pt as r,Eo as s,zt as t,I as u,P as v,Gt as w,W as x,B as y,Xo as z,Jo as A,qo as B,Yo as C,Zo as D,Po as E,Fr as F,Uo as G,Bt as H,j as I,ra as J,sa as K,ia as L,ha as M,ya as N,$l as O,Pi as P,Il as Q,ka as R,wa as S,Sa as T,xa as U,va as V,$a as W,Aa as X,_a as Y,ja as Z,Te as _,Ma as $,Va as aa,z as ba,K as ca,Ui as da,Ol as ea,Pl as fa,jl as ga,Ml as ha,qe as ia,Vl as ja,Oe as ka,Pe as la,ue as ma,Ns as na,Us as oa,Ba as pa,Me as qa,Ve as ra,Ws as sa,Bs as ta,xn as ua,An as va,Ha as wa,Ks as xa,za as ya,ei as za,ri as Aa,Ne as Ba,ii as Ca,_n as Da,T as Ea,Kn as Fa,Gn as Ga,Xn as Ha,Hl as Ia,qi as Ja,qn as Ka,Yn as La,tc as Ma,nc as Na,fo as Oa,rc as Pa,Qn as Qa,de as Ra,rl as Sa,Ln as Ta,Fe as Ua,Ge as Va,ul as Wa,ac as Xa,lc as Ya,cc as Za,uc as _a,dc as $a,gc as ab,fc as bb,pc as cb,mc as db,rr as eb,sr as fb,bc as gb,ir as hb,kc as ib};
|
|
156
|
+
//# sourceMappingURL=chunk-H7SL56KH.js.map
|