agentix-cli 0.210.0 → 0.211.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-EMCBJ5NE.js → App-RIXKQIO7.js} +2 -2
- package/dist/{ChatApp-HIHZEUKS.js → ChatApp-2TKXDJGQ.js} +2 -2
- package/dist/{absorb-eval-7CCHO4KZ.js → absorb-eval-5YZOYFF4.js} +2 -2
- package/dist/{adapter-J6YO4FLT.js → adapter-Q76GO2I7.js} +2 -2
- package/dist/{agent-AETIDS4G.js → agent-GW6Z6OFF.js} +2 -2
- package/dist/{board-dashboard-OAAO3ZKR.js → board-dashboard-RPZJBHL3.js} +4 -4
- package/dist/{chunk-UQMNYIGT.js → chunk-323KMXT4.js} +2 -2
- package/dist/{chunk-DNQEK2KS.js → chunk-6BINQY52.js} +7 -7
- package/dist/{chunk-DNQEK2KS.js.map → chunk-6BINQY52.js.map} +1 -1
- package/dist/{chunk-CTN4KYE6.js → chunk-6UI7GJSB.js} +2 -2
- package/dist/{chunk-4CGAIVLW.js → chunk-6VHORIGB.js} +2 -2
- package/dist/{chunk-5GHYIU5L.js → chunk-BQIZN5JU.js} +2 -2
- package/dist/{chunk-6FCD7K6G.js → chunk-CUX7BF7B.js} +2 -2
- package/dist/{chunk-PK2KOR6H.js → chunk-EPIKS3WL.js} +2 -2
- package/dist/{chunk-F3DCWMTS.js → chunk-F3HVONL6.js} +2 -2
- package/dist/{chunk-TADIDWYZ.js → chunk-FFOGEFPT.js} +2 -2
- package/dist/{chunk-5UXCARLO.js → chunk-FLDMRYZD.js} +2 -2
- package/dist/{chunk-H22TBFXT.js → chunk-FLNSBODK.js} +2 -2
- package/dist/{chunk-NWY4OF4X.js → chunk-GUID2ZA2.js} +3 -3
- package/dist/chunk-GUID2ZA2.js.map +1 -0
- package/dist/{chunk-VJVXEVZ7.js → chunk-IH65GDJR.js} +6 -6
- package/dist/chunk-IH65GDJR.js.map +1 -0
- package/dist/{chunk-EP3XCCZ3.js → chunk-ISRY3GAD.js} +2 -2
- package/dist/{chunk-GCR3KWCV.js → chunk-JJC2HBWC.js} +2 -2
- package/dist/{chunk-WSHOJMQG.js → chunk-LYY7G6LO.js} +2 -2
- package/dist/{chunk-N2DOU7A5.js → chunk-MHRVTFLZ.js} +3 -3
- package/dist/{chunk-TAUJUPJN.js → chunk-MKQI5WL2.js} +2 -2
- package/dist/{chunk-UEEB3UTU.js → chunk-N47Y5ADQ.js} +10 -10
- package/dist/{chunk-UEEB3UTU.js.map → chunk-N47Y5ADQ.js.map} +1 -1
- package/dist/{chunk-D55REZL3.js → chunk-OAVJMZLF.js} +2 -2
- package/dist/{chunk-KI2M5LXX.js → chunk-PYTNMX2D.js} +2 -2
- package/dist/{chunk-426L6XZP.js → chunk-QQKPZKQT.js} +2 -2
- package/dist/{chunk-UEYKYTJD.js → chunk-UYG7UOVQ.js} +2 -2
- package/dist/{chunk-RTYBNDHE.js → chunk-W4K3DFAX.js} +2 -2
- package/dist/{chunk-TNIN3DPC.js → chunk-WNE4GRXY.js} +2 -2
- package/dist/{chunk-6L3K7Y7E.js → chunk-XWMHNDED.js} +2 -2
- package/dist/{chunk-W3DLKUOV.js → chunk-XWOXXVVX.js} +2 -2
- package/dist/{chunk-PTDPY5YN.js → chunk-Y4BNOZWQ.js} +2 -2
- package/dist/{chunk-4GS2I57L.js → chunk-Y65DB3PF.js} +2 -2
- package/dist/{chunk-TPGQIJOK.js → chunk-YRBJ4KB7.js} +3 -3
- package/dist/chunk-YRBJ4KB7.js.map +1 -0
- package/dist/{chunk-6X2K2VSD.js → chunk-YZD6EZMU.js} +2 -2
- package/dist/{chunk-CXLAXYZG.js → chunk-YZEQLJD2.js} +303 -299
- package/dist/chunk-YZEQLJD2.js.map +1 -0
- package/dist/{chunk-TARMAPO6.js → chunk-ZWO36TCN.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-XITH4RAT.js → client-AIQ7D7VU.js} +2 -2
- package/dist/{config-YYD7E5BT.js → config-TSSRDRCK.js} +2 -2
- package/dist/config-mutate-XUBGMDIU.js +2 -0
- package/dist/{config-mutator-XHSEEKWW.js → config-mutator-G62RKREK.js} +2 -2
- package/dist/{contributions-R2BJWBI7.js → contributions-RQZO4V36.js} +2 -2
- package/dist/{doctor-2GK4QVSK.js → doctor-DVMX6632.js} +2 -2
- package/dist/{failure-candidates-WGSFI7GR.js → failure-candidates-FASPEOBF.js} +2 -2
- package/dist/{follow-up-tool-FT5JYKSI.js → follow-up-tool-MS4FSM2J.js} +2 -2
- package/dist/hub-RKX3L5LU.js +2 -0
- package/dist/index.js +1 -1
- package/dist/{org-tool-BTZF5L74.js → org-tool-NA6U3IJJ.js} +2 -2
- package/dist/{program-O5MDSQSU.js → program-YEHUSQFX.js} +25 -25
- package/dist/{promote-JQYV4QKG.js → promote-OV2OD55V.js} +2 -2
- package/dist/{query-RW3BV23C.js → query-6FK2A4K2.js} +2 -2
- package/dist/{query-settings-DN6BU3QA.js → query-settings-RE2BTERX.js} +2 -2
- package/dist/{registry-CQLEJUHN.js → registry-APVJFCDJ.js} +2 -2
- package/dist/{request-planner-M4GOEJUD.js → request-planner-23FPTJLW.js} +2 -2
- package/dist/{review-candidates-HZDY5DV3.js → review-candidates-FCRNGU2S.js} +2 -2
- package/dist/{routing-IUE6GT6T.js → routing-W7AOH7QM.js} +2 -2
- package/dist/schedule-tool-RXX26TI4.js +2 -0
- package/dist/scheduler-3CJD7UF4.js +2 -0
- package/dist/{seat-OIVGQP4P.js → seat-BIVMGYMR.js} +2 -2
- package/dist/{select-TKODF5NC.js → select-LWTPLTCE.js} +2 -2
- package/dist/{set-enabled-B3A2VMDN.js → set-enabled-OKG7Q5WY.js} +2 -2
- package/dist/{sprint-tool-N4RLQ3EN.js → sprint-tool-YLQADXQH.js} +2 -2
- package/dist/{surface-usage-Y7D5W52I.js → surface-usage-Y23TE5AN.js} +2 -2
- package/dist/{tool-SBFQKJ4J.js → tool-5T5SSYMB.js} +2 -2
- package/dist/{tool-FQY3IU4B.js → tool-XZU2IJUI.js} +2 -2
- package/dist/{tool-FUEAREQB.js → tool-YCCQX7BT.js} +2 -2
- package/dist/{tool-UL673LK6.js → tool-ZXIRHFRB.js} +2 -2
- package/dist/{traces-O4TIZ4SM.js → traces-MKAHGAYG.js} +2 -2
- package/dist/{wiki-S6FJAVZ6.js → wiki-2BVHRZX5.js} +2 -2
- package/dist/wiki-enrich-BHPD4BOV.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-CXLAXYZG.js.map +0 -1
- package/dist/chunk-NWY4OF4X.js.map +0 -1
- package/dist/chunk-TPGQIJOK.js.map +0 -1
- package/dist/chunk-VJVXEVZ7.js.map +0 -1
- package/dist/config-mutate-F23A3UAU.js +0 -2
- package/dist/hub-QBJH2GAV.js +0 -2
- package/dist/schedule-tool-WAXHHKSR.js +0 -2
- package/dist/scheduler-PPKHYCMH.js +0 -2
- package/dist/wiki-enrich-UQKBCRS7.js +0 -2
- /package/dist/{App-EMCBJ5NE.js.map → App-RIXKQIO7.js.map} +0 -0
- /package/dist/{ChatApp-HIHZEUKS.js.map → ChatApp-2TKXDJGQ.js.map} +0 -0
- /package/dist/{absorb-eval-7CCHO4KZ.js.map → absorb-eval-5YZOYFF4.js.map} +0 -0
- /package/dist/{adapter-J6YO4FLT.js.map → adapter-Q76GO2I7.js.map} +0 -0
- /package/dist/{agent-AETIDS4G.js.map → agent-GW6Z6OFF.js.map} +0 -0
- /package/dist/{board-dashboard-OAAO3ZKR.js.map → board-dashboard-RPZJBHL3.js.map} +0 -0
- /package/dist/{chunk-UQMNYIGT.js.map → chunk-323KMXT4.js.map} +0 -0
- /package/dist/{chunk-CTN4KYE6.js.map → chunk-6UI7GJSB.js.map} +0 -0
- /package/dist/{chunk-4CGAIVLW.js.map → chunk-6VHORIGB.js.map} +0 -0
- /package/dist/{chunk-5GHYIU5L.js.map → chunk-BQIZN5JU.js.map} +0 -0
- /package/dist/{chunk-6FCD7K6G.js.map → chunk-CUX7BF7B.js.map} +0 -0
- /package/dist/{chunk-PK2KOR6H.js.map → chunk-EPIKS3WL.js.map} +0 -0
- /package/dist/{chunk-F3DCWMTS.js.map → chunk-F3HVONL6.js.map} +0 -0
- /package/dist/{chunk-TADIDWYZ.js.map → chunk-FFOGEFPT.js.map} +0 -0
- /package/dist/{chunk-5UXCARLO.js.map → chunk-FLDMRYZD.js.map} +0 -0
- /package/dist/{chunk-H22TBFXT.js.map → chunk-FLNSBODK.js.map} +0 -0
- /package/dist/{chunk-EP3XCCZ3.js.map → chunk-ISRY3GAD.js.map} +0 -0
- /package/dist/{chunk-GCR3KWCV.js.map → chunk-JJC2HBWC.js.map} +0 -0
- /package/dist/{chunk-WSHOJMQG.js.map → chunk-LYY7G6LO.js.map} +0 -0
- /package/dist/{chunk-N2DOU7A5.js.map → chunk-MHRVTFLZ.js.map} +0 -0
- /package/dist/{chunk-TAUJUPJN.js.map → chunk-MKQI5WL2.js.map} +0 -0
- /package/dist/{chunk-D55REZL3.js.map → chunk-OAVJMZLF.js.map} +0 -0
- /package/dist/{chunk-KI2M5LXX.js.map → chunk-PYTNMX2D.js.map} +0 -0
- /package/dist/{chunk-426L6XZP.js.map → chunk-QQKPZKQT.js.map} +0 -0
- /package/dist/{chunk-UEYKYTJD.js.map → chunk-UYG7UOVQ.js.map} +0 -0
- /package/dist/{chunk-RTYBNDHE.js.map → chunk-W4K3DFAX.js.map} +0 -0
- /package/dist/{chunk-TNIN3DPC.js.map → chunk-WNE4GRXY.js.map} +0 -0
- /package/dist/{chunk-6L3K7Y7E.js.map → chunk-XWMHNDED.js.map} +0 -0
- /package/dist/{chunk-W3DLKUOV.js.map → chunk-XWOXXVVX.js.map} +0 -0
- /package/dist/{chunk-PTDPY5YN.js.map → chunk-Y4BNOZWQ.js.map} +0 -0
- /package/dist/{chunk-4GS2I57L.js.map → chunk-Y65DB3PF.js.map} +0 -0
- /package/dist/{chunk-6X2K2VSD.js.map → chunk-YZD6EZMU.js.map} +0 -0
- /package/dist/{chunk-TARMAPO6.js.map → chunk-ZWO36TCN.js.map} +0 -0
- /package/dist/{client-XITH4RAT.js.map → client-AIQ7D7VU.js.map} +0 -0
- /package/dist/{config-YYD7E5BT.js.map → config-TSSRDRCK.js.map} +0 -0
- /package/dist/{config-mutate-F23A3UAU.js.map → config-mutate-XUBGMDIU.js.map} +0 -0
- /package/dist/{config-mutator-XHSEEKWW.js.map → config-mutator-G62RKREK.js.map} +0 -0
- /package/dist/{contributions-R2BJWBI7.js.map → contributions-RQZO4V36.js.map} +0 -0
- /package/dist/{doctor-2GK4QVSK.js.map → doctor-DVMX6632.js.map} +0 -0
- /package/dist/{failure-candidates-WGSFI7GR.js.map → failure-candidates-FASPEOBF.js.map} +0 -0
- /package/dist/{follow-up-tool-FT5JYKSI.js.map → follow-up-tool-MS4FSM2J.js.map} +0 -0
- /package/dist/{hub-QBJH2GAV.js.map → hub-RKX3L5LU.js.map} +0 -0
- /package/dist/{org-tool-BTZF5L74.js.map → org-tool-NA6U3IJJ.js.map} +0 -0
- /package/dist/{program-O5MDSQSU.js.map → program-YEHUSQFX.js.map} +0 -0
- /package/dist/{promote-JQYV4QKG.js.map → promote-OV2OD55V.js.map} +0 -0
- /package/dist/{query-RW3BV23C.js.map → query-6FK2A4K2.js.map} +0 -0
- /package/dist/{query-settings-DN6BU3QA.js.map → query-settings-RE2BTERX.js.map} +0 -0
- /package/dist/{registry-CQLEJUHN.js.map → registry-APVJFCDJ.js.map} +0 -0
- /package/dist/{request-planner-M4GOEJUD.js.map → request-planner-23FPTJLW.js.map} +0 -0
- /package/dist/{review-candidates-HZDY5DV3.js.map → review-candidates-FCRNGU2S.js.map} +0 -0
- /package/dist/{routing-IUE6GT6T.js.map → routing-W7AOH7QM.js.map} +0 -0
- /package/dist/{schedule-tool-WAXHHKSR.js.map → schedule-tool-RXX26TI4.js.map} +0 -0
- /package/dist/{scheduler-PPKHYCMH.js.map → scheduler-3CJD7UF4.js.map} +0 -0
- /package/dist/{seat-OIVGQP4P.js.map → seat-BIVMGYMR.js.map} +0 -0
- /package/dist/{select-TKODF5NC.js.map → select-LWTPLTCE.js.map} +0 -0
- /package/dist/{set-enabled-B3A2VMDN.js.map → set-enabled-OKG7Q5WY.js.map} +0 -0
- /package/dist/{sprint-tool-N4RLQ3EN.js.map → sprint-tool-YLQADXQH.js.map} +0 -0
- /package/dist/{surface-usage-Y7D5W52I.js.map → surface-usage-Y23TE5AN.js.map} +0 -0
- /package/dist/{tool-SBFQKJ4J.js.map → tool-5T5SSYMB.js.map} +0 -0
- /package/dist/{tool-FQY3IU4B.js.map → tool-XZU2IJUI.js.map} +0 -0
- /package/dist/{tool-FUEAREQB.js.map → tool-YCCQX7BT.js.map} +0 -0
- /package/dist/{tool-UL673LK6.js.map → tool-ZXIRHFRB.js.map} +0 -0
- /package/dist/{traces-O4TIZ4SM.js.map → traces-MKAHGAYG.js.map} +0 -0
- /package/dist/{wiki-S6FJAVZ6.js.map → wiki-2BVHRZX5.js.map} +0 -0
- /package/dist/{wiki-enrich-UQKBCRS7.js.map → wiki-enrich-BHPD4BOV.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as g}from"./chunk-
|
|
1
|
+
import{e as g}from"./chunk-MHRVTFLZ.js";async function $(e,i,r,n,o={}){let a=o.retrieve??g,c=o.perEntry??2,s=o.maxArticles??8,f=o.queryChars??1500,h=new Map;for(let t of e){let l=[];try{l=await a(t.content.slice(0,f),i,r,{pool:n,maxCandidates:c,maxHops:1,maxArticles:c*2,stage:"absorb-covering"})}catch{}for(let u of l){let p=h.get(u.path);p?(p.hop=Math.min(p.hop,u.hop),p.entries.includes(t.id)||p.entries.push(t.id)):h.set(u.path,{...u,entries:[t.id]})}}return[...h.values()].sort((t,l)=>t.hop-l.hop||l.entries.length-t.entries.length||t.path.localeCompare(l.path)).slice(0,s)}function x(e){if(e.length===0)return"";let i=e.map(r=>{let n=`### ${r.meta.title} \u2014 ${r.meta.type||"untyped"} (${r.path})`,o=`Found for entries: ${r.entries.join(", ")}${r.hop>0?" (linked from a match)":""}`,a=r.meta.related?.length?`Related: ${r.meta.related.join(", ")}`:"";return[n,o,a,"",r.content].filter(c=>c!=="").join(`
|
|
2
2
|
`)}).join(`
|
|
3
3
|
|
|
4
4
|
---
|
|
@@ -14,4 +14,4 @@ These ${e.length} articles were found by searching the wiki for each entry below
|
|
|
14
14
|
|
|
15
15
|
${i}
|
|
16
16
|
`}var d=/\bhttps?:\/\/[^\s<>"'`)\]]+/gi,y=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,w=/(?<![\w-])(?=[0-9a-f]*[0-9])(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}(?![\w-])/gi,k=/(?<![\w.,:/-])\d+(?:[.,:\-/]\d+)*(?![\w])/g,C=/^\s*\d+[.)]\s/gm;function A(e){let i=[...e.matchAll(d)].map(s=>s[0].replace(/[.,;:!?'"]+$/,"")),r=[...e.matchAll(y)].map(s=>s[1].trim()),n=e.replace(d," ").replace(y," ").replace(C," "),o=[...n.matchAll(w)].map(s=>s[0].toLowerCase()),c=[...n.replace(w," ").matchAll(k)].map(s=>v(s[0]));return{commits:m(o),urls:m(i),wikilinks:m(r),numbers:m(c)}}function R(e,i){let r=A(e),n=A(i),o=i.toLowerCase(),a=[];for(let t of r.commits)!o.includes(t)&&!n.commits.some(l=>l.startsWith(t)||t.startsWith(l))&&a.push(`commit ${t}`);let c=t=>t.toLowerCase().replace(/\/+$/,""),s=new Set(n.urls.map(c));for(let t of r.urls)s.has(c(t))||a.push(`link ${t}`);let f=new Set(n.wikilinks.map(t=>t.toLowerCase()));for(let t of r.wikilinks)f.has(t.toLowerCase())||a.push(`link [[${t}]]`);let h=new Set(n.numbers);for(let t of r.numbers)h.has(t)||a.push(`number ${t}`);return a}function v(e){return/^\d{1,3}(,\d{3})+$/.test(e)?e.replace(/,/g,""):e}function m(e){return[...new Set(e)]}function L(e,i){if(i.some(n=>n.path===e.path))return e.path;let r=b(e.title);return r?i.find(n=>b(n.title)===r)?.path??e.path:e.path}function b(e){return(e||"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}export{$ as a,x as b,A as c,R as d,L as e};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-Y65DB3PF.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ft}from"./chunk-GTJIKXDB.js";import{H as Er,O as Ir,k as K}from"./chunk-
|
|
1
|
+
import{a as ft}from"./chunk-GTJIKXDB.js";import{H as Er,O as Ir,k as K}from"./chunk-W4K3DFAX.js";import{f as $r,g as Tr,h as Ar,l as Rr}from"./chunk-FLNSBODK.js";import{b as _r}from"./chunk-2VDO2HEK.js";import{t as vr,u as Sr}from"./chunk-ZWO36TCN.js";import{d as xr,e as kr}from"./chunk-AQASR6KR.js";import{h as pe,j as dr,l as ur,m as pr,n as gr}from"./chunk-RX5O5637.js";import{a as mr,c as fr,e as hr,f as ut,h as br,j as yr,k as wr,l as pt,m as gt,n as mt}from"./chunk-5ELIX7BQ.js";import{a as rr,c as or}from"./chunk-KP7KDLZ2.js";import{Aa as ue,Ca as dt,b as at,f as Gn,s as lt,u as ct,xa as Ae,ya as er,za as W}from"./chunk-MKQI5WL2.js";import{a as $e,b as de,e as Yn}from"./chunk-7AB3QUGH.js";import{h as sr,i as ir,j as ar,l as lr,m as cr}from"./chunk-FLDMRYZD.js";import{s as Zn}from"./chunk-JJC2HBWC.js";import{a as Jn,b as Te,e as Qn}from"./chunk-Y4BNOZWQ.js";import{c as Re,d as tr,e as nr}from"./chunk-XVV7ZZ77.js";import{b as ee}from"./chunk-5ONH4ITT.js";import{a as Kn,c as it}from"./chunk-ILEC3IAV.js";import{a as Wn,i as Vn,l as Xn,n as ot,o as st,r as ce,s as Z,u as zn}from"./chunk-XL7UWG36.js";import{a as jn,b as Bn,d as qn,e as Hn}from"./chunk-MNG2AMKZ.js";import{a as Un}from"./chunk-7IW25T4K.js";import{a as Fn}from"./chunk-QUFIUXMQ.js";import{Ba as Dn,Ca as Cn,E as _e,Ea as Nn,F as $n,Fa as On,Fb as rt,G as Tn,H as vi,Ob as Ln,Pb as Pn,Zb as Mn,f as Ze,g as C,i as Ee,j as E,k as le,l as En,o as _n,p as et,va as In}from"./chunk-GUID2ZA2.js";import{a as tt,h as Si}from"./chunk-KEUW6YLL.js";import{j as nt,q as An,r as Rn}from"./chunk-N47Y5ADQ.js";import{existsSync as Ei,readdirSync as _i,readFileSync as $i,statSync as Ti}from"fs";import{resolve as Ai}from"path";function Dr(t,e,n=Date.now(),r=7){let o=r*864e5,s=new Map;for(let i of e){let a=s.get(i.workflowId);a?a.push(i):s.set(i.workflowId,[i])}return t.map(i=>{let a=s.get(i.id)??[],d=a.filter(m=>n-m.at<=o),l=a.filter(m=>n-m.at>o&&n-m.at<=o*2),c=d.filter(m=>m.status==="failed").length,p=a.filter(m=>m.status==="paused").length,u=a.length?Math.max(...a.map(m=>m.at)):null,g=a.length?l.length>0&&d.length===0?"dormant":d.length>0&&c*2>=d.length?"failing":d.length>0?"active":"quiet":"never";return{id:i.id,name:i.name||i.id,state:g,lastRunAt:u,recent:d.length,prior:l.length,failed:c,paused:p}}).sort((i,a)=>{let d={dormant:0,failing:1,active:2,quiet:3,never:4};return d[i.state]-d[a.state]||(a.lastRunAt??0)-(i.lastRunAt??0)})}var Ie=new Map;function Cu(t,e=1e3){if(!Ei(t))return[];let n=_i(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let i=Ai(t,s);return{path:i,mtime:Ti(i).mtimeMs}}).sort((s,i)=>i.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 o=[];for(let{path:s,mtime:i}of n){let a=Ie.get(s);if(a&&a.mtime===i){a.summary&&o.push(a.summary);continue}let d=Ri(s,i);Ie.set(s,{mtime:i,summary:d}),d&&o.push(d)}return o}function Ri(t,e){try{let n=$i(t,"utf-8").split(`
|
|
2
2
|
`).filter(Boolean);if(!n.length)return null;let r=JSON.parse(n[0]),o=r.run?.workflowId;if(!o)return null;let s=r.run?.status??"unknown";for(let i=n.length-1;i>=0;i--){let a=JSON.parse(n[i]),d=a.status??a.run?.status;if(d){s=d;break}}return{workflowId:o,status:s,at:e}}catch{return null}}var Cr=7,Ii={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},A={routines:200,summary:160,filters:6,filterValue:60,text:120},Di=(t,e,n)=>{try{return Zn(t,e,n)}catch{return null}},Nr=864e5;function Pu(t){let e=t.now??Date.now(),n={...Ii,...t.thresholds},r=t.nextFire??Di,o=[];for(let a of t.crons){let d=t.cronRuns.get(a.id)??[],l=a.timezone||"UTC",c=d.map(g=>({at:Date.parse(g.startedAt),status:g.status})),p=d[0],u={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:F(a.id,A.text),trigger:{schedule:F(a.schedule,A.text),timezone:l},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?ht(a.nextRun)??ht(r(a.schedule,new Date(e),l)):null,lastRun:p?{at:p.startedAt,status:p.status,summary:Mi(p.status==="success"?void 0:p.errorSummary,A.summary)}:null,lastSuccessAt:d.find(g=>g.status==="success")?.startedAt??null,consecutiveFailures:Or(c),sampledRuns:d.length,flags:[],attention:null,recent:d.slice(0,Cr).map(g=>({at:g.startedAt,status:g.status}))};u.flags=Lr(u,c,a.schedule,l,null,e,n,r),o.push(Pr(u))}let s=new Map(Dr(t.workflows.map(a=>({id:a.id,name:a.title})),t.workflowRuns,e).map(a=>[a.id,a])),i=new Map;for(let a of t.workflowRuns){let d=i.get(a.workflowId);d?d.push(a):i.set(a.workflowId,[a])}for(let a of t.workflows){let d=a.nodes.find(k=>k.type.startsWith("trigger."));if(!d||d.type!=="trigger.cron"&&d.type!=="trigger.hook")continue;let l=d.config??{},c=a.state||"active",p=c==="active",u=(i.get(a.id)??[]).slice().sort((k,D)=>D.at-k.at),g=u.map(k=>({at:k.at,status:Oi(k.status)})),m=g[0],f=d.type==="trigger.cron",w=typeof l.spec=="string"?l.spec:"",x=typeof l.timezone=="string"?l.timezone:"UTC",b={id:`workflow:${a.id}`,source:"workflow",kind:f?"schedule":"event",name:F(a.title||a.id,A.text),trigger:f?{schedule:F(w,A.text),timezone:x}:{event:F(typeof l.event=="string"?l.event:"",A.text),filters:Pi(l.filter,a)},agent:Li(a),enabled:p,state:c,nextRunAt:f&&p&&w?ht(r(w,new Date(e),x)):null,lastRun:m?{at:new Date(m.at).toISOString(),status:m.status}:null,lastSuccessAt:(()=>{let k=g.find(D=>D.status==="success");return k?new Date(k.at).toISOString():null})(),consecutiveFailures:Or(g),sampledRuns:u.length,flags:[],attention:null,recent:g.slice(0,Cr).map(k=>({at:new Date(k.at).toISOString(),status:k.status}))},y=Date.parse(a.updated||a.created||"");b.flags=f?Lr(b,g,w,x,Number.isFinite(y)?y:null,e,n,r):Ci(b,s.get(a.id)?.state==="dormant",Number.isFinite(y)?y:null,e,n),o.push(Pr(b))}return o.sort(Ni).slice(0,A.routines)}function Or(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 Lr(t,e,n,r,o,s,i,a){let d=[],l=e.length?e[0].at:null;if(!t.enabled){let u=Fr(l,o,s,i);return u&&d.push(u),d}if(t.consecutiveFailures>=i.failStreak&&d.push({reason:"failing",detail:`${t.consecutiveFailures} failed attempts in a row`}),l===null)return d.push({reason:"never-ran",detail:"No persisted attempt"}),d;let c=new Date(l),p=null;for(let u=0;u<i.missedFires&&(p=a(n,c,r),!!p);u++)c=p;return p&&s>p.getTime()+i.graceMs&&d.push({reason:"overdue",detail:`No attempt since ${new Date(l).toISOString()}; ${i.missedFires} scheduled fires missed`}),d}function Ci(t,e,n,r,o){let s=[],i=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=Fr(i,n,r,o);return a&&s.push(a),s}return t.consecutiveFailures>=o.failStreak&&s.push({reason:"failing",detail:`${t.consecutiveFailures} failed runs in a row`}),i===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 Fr(t,e,n,r){let o=Math.max(t??0,e??0);return o&&n-o<r.disabledDays*Nr?null:{reason:"disabled-long",detail:o?`Disabled; no activity for ${Math.floor((n-o)/Nr)} days`:"Disabled and never ran"}}function Pr(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 Mr={critical:0,warning:1,info:2};function Ni(t,e){let n=t.attention?Mr[t.attention]:3,r=e.attention?Mr[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 Li(t){if(t.ownerAgent)return F(t.ownerAgent,A.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?F(String(e.config.agentId),A.text):null}function Pi(t,e){let n=[],r=e?.project;if(r&&n.push(F(`project=${r}`,A.filterValue)),t&&typeof t=="object"&&!Array.isArray(t))for(let[o,s]of Object.entries(t)){let i=Array.isArray(s)?s.map(String):s==null?[]:[String(s)];i.length&&n.push(F(`${o}=${i.join(",")}`,A.filterValue))}return n.slice(0,A.filters)}function ht(t){if(!t)return null;let e=t instanceof Date?t:new Date(t);return Number.isFinite(e.getTime())?e.toISOString():null}function F(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}function Mi(t,e){return t===void 0?void 0:F(t,e)}import{mkdirSync as Fi,readFileSync as Ui,renameSync as Wi,writeFileSync as ji}from"fs";import{resolve as Bi}from"path";function Ur(t){return Bi(st(t),"_state.json")}function N(t){try{let e=JSON.parse(Ui(Ur(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 ge(t,e){Fi(st(t),{recursive:!0});let n=Ur(t),r=`${n}.${process.pid}.tmp`;ji(r,JSON.stringify(e,null,2)+`
|
|
3
3
|
`),Wi(r,n)}function Wr(t,e,n,r=Date.now()){let o=N(t),s={};for(let[i,a]of Object.entries(o.snoozed))Date.parse(a)>r&&(s[i]=a);s[e]=n.toISOString(),ge(t,{...o,snoozed:s})}function ju(t,e){ge(t,{...N(t),lastDigest:e})}function bt(t,e,n,r=Date.now()){let o=N(t),s=new Set(n),i={};for(let[d,l]of Object.entries(o.popped??{}))s.has(d)&&(i[d]=l);i[e]=new Date(r).toISOString();let a=(o.wanted??[]).filter(d=>d!==e&&s.has(d));ge(t,{...o,popped:i,wanted:a})}function jr(t,e){let n=N(t);ge(t,{...n,wanted:[...(n.wanted??[]).filter(r=>r!==e),e]})}function Bu(t,e=Date.now()){ge(t,{...N(t),popped:{},passAt:new Date(e).toISOString()})}import{existsSync as qi,readFileSync as Hi}from"fs";Mn();Si();function Br(t){let e=Jn(t),n={};if(qi(e))try{n=Ln(JSON.parse(Hi(e,"utf-8")))}catch{n={}}let r=rt.safeParse(n?.requests);return r.success?r.data:rt.parse(void 0)}async function Ku(t,e={}){let n=(t.channels??[]).filter(r=>!tt.has(r.toLowerCase().split("@")[0]));return n.length?{success:!1,error:`unknown channel ${n.map(r=>`"${r}"`).join(", ")}: use ${[...tt].join(", ")}`}:Te(r=>{let o=r.requests??={};for(let s of["enabled","channels","from","staleAfterHours","retentionDays","settleHandedBack","homeCloses","releaseOnOwnerTurn"])t[s]!==void 0&&(o[s]=t[s]);if(t.plans){let s=o.plans??={};for(let i of["enabled","stallMinutes","maxNudges","approveKinds","disabledAgents","requireForWork","requireOverMinutes"])t.plans[i]!==void 0&&(s[i]=t.plans[i])}if(t.headlines?.enabled!==void 0&&((o.headlines??={}).enabled=t.headlines.enabled),t.catchPromises){let s=o.catchPromises??={};for(let i of["enabled","dailyCap"])t.catchPromises[i]!==void 0&&(s[i]=t.catchPromises[i])}if(t.autoResend){let s=o.autoResend??={};for(let i of["enabled","afterMinutes","holdMaxHours"])t.autoResend[i]!==void 0&&(s[i]=t.autoResend[i])}if(t.flow){let s=o.flow??={};for(let i of["timeZone","days"])t.flow[i]!==void 0&&(s[i]=t.flow[i])}if(t.checkers){let s=o.checkers??={};for(let i of["enabled","checkEveryMinutes"])t.checkers[i]!==void 0&&(s[i]=t.checkers[i])}},{configPath:e.configPath,reload:e.reload})}import{existsSync as H,readdirSync as ua,readFileSync as kt,statSync as pa}from"fs";import{dirname as lo,resolve as T}from"path";import{randomBytes as Vr}from"crypto";import{existsSync as Xi,mkdirSync as zi,readdirSync as Ki,readFileSync as Gi,renameSync as Xr,unlinkSync as Yi,writeFileSync as Ji}from"fs";import{resolve as zr}from"path";function qr(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var Vi=t=>t.trim().split(`
|
|
4
4
|
`).pop()?.slice(0,300)||"no output";async function Hr(t,e,n,r=ft){let o=await r(t.bin,[...qr(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return o.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${Vi(o.stderr||o.stdout)}`}}async function Ju(t,e,n,r,o=ft){return(await o(t.bin,[...qr(t),"--read-only","media","download","--chat",e,"--id",n,"--output",r],{timeoutMs:12e4})).code===0}var Qi=2e3,Zi=t=>Hr(t.wacli,t.to,t.text);function yt(t){return zr(t,".agentx","whatsapp-triage","drafts")}var ea=t=>/^[a-z0-9-]{8,64}$/.test(t),De=(t,e)=>zr(yt(t),`${e}.json`);function Kr(t,e){zi(yt(t),{recursive:!0});let n=De(t,e.id),r=`${n}.${process.pid}.tmp`;Ji(r,JSON.stringify(e,null,2)+`
|
|
@@ -65,7 +65,7 @@ import{a as ft}from"./chunk-GTJIKXDB.js";import{H as Er,O as Ir,k as K}from"./ch
|
|
|
65
65
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);this.db.transaction(()=>{s.run(e,n,o),r.forEach((a,d)=>{let l=d===0,c=l&&a.agentId===n&&a.kind!=="message";i.run(e,d+1,a.name,a.kind,a.agentId,a.doneWhen,l?"active":"pending",a.needsApproval?1:0,a.message??null,a.toChannel??null,a.toChat??null,a.toAccount??null,a.checkUrl??null,a.checkContains??null,a.stallMinutes??null,c?o:null,o,a.checkCount??null)}),this.event(e,null,"created",`${r.length} steps, written by ${n}`,o)})()}get(e){let n=this.db.prepare("SELECT * FROM request_plans WHERE request_id = ?").get(e);return n?wt(n):null}steps(e){return this.db.prepare("SELECT * FROM request_plan_steps WHERE request_id = ? ORDER BY idx").all(e).map(ro)}step(e,n){let r=this.db.prepare("SELECT * FROM request_plan_steps WHERE request_id = ? AND idx = ?").get(e,n);return r?ro(r):null}listActive(){return this.db.prepare("SELECT * FROM request_plans WHERE state = 'active' ORDER BY created_at, rowid").all().map(wt)}updateStep(e,n,r){let o=[],s=[];for(let[i,a]of Object.entries(r)){let d=da[i];!d||a===void 0||(o.push(`${d} = ?`),s.push(typeof a=="boolean"?a?1:0:a))}o.length&&this.db.prepare(`UPDATE request_plan_steps SET ${o.join(", ")} WHERE request_id = ? AND idx = ?`).run(...s,e,n)}finish(e,n,r){return this.db.prepare("UPDATE request_plans SET state = ?, finished_at = ? WHERE request_id = ? AND state = 'active'").run(n,r,e).changes>0}markNotified(e,n){this.db.prepare("UPDATE request_plans SET notified_at = ? WHERE request_id = ?").run(n,e)}awaitingSummary(){return this.db.prepare("SELECT * FROM request_plans WHERE state = 'done' AND notified_at IS NULL ORDER BY finished_at").all().map(wt)}event(e,n,r,o,s){this.db.prepare("INSERT INTO request_plan_events (request_id, step, at, kind, detail) VALUES (?, ?, ?, ?, ?)").run(e,n,s,r,o.replace(/\s+/g," ").trim().slice(0,la))}continues(e,n){let r=this.db.prepare("SELECT turns, cost_usd, told_at FROM request_plan_continues WHERE goal_key = ? AND day = ?").get(e,n);return r?{turns:r.turns,costUsd:r.cost_usd,toldAt:r.told_at??null}:{turns:0,costUsd:0,toldAt:null}}addContinue(e,n,r){this.db.prepare(`INSERT INTO request_plan_continues (goal_key, day, turns, cost_usd, told_at) VALUES (?, ?, ?, ?, ?)
|
|
66
66
|
ON CONFLICT(goal_key, day) DO UPDATE SET turns = turns + excluded.turns, cost_usd = cost_usd + excluded.cost_usd,
|
|
67
67
|
told_at = COALESCE(excluded.told_at, told_at)`).run(e,n,r.turns??0,r.costUsd??0,r.toldAt??null)}events(e,n=200){return this.db.prepare("SELECT request_id, step, at, kind, detail FROM request_plan_events WHERE request_id = ? ORDER BY at DESC, rowid DESC LIMIT ?").all(e,n).reverse().map(r=>({requestId:r.request_id,step:r.step??null,at:r.at,kind:r.kind,detail:r.detail}))}stepEvents(e,n,r,o=200){return this.db.prepare("SELECT request_id, step, at, kind, detail FROM request_plan_events WHERE request_id = ? AND step = ? AND kind = ? ORDER BY at DESC, rowid DESC LIMIT ?").all(e,n,r,o).reverse().map(s=>({requestId:s.request_id,step:s.step??null,at:s.at,kind:s.kind,detail:s.detail}))}},gp=Dn;var co=["card","schedule","agent","memory","wiki","fact","question","whatsapp","email","content","request"],ga=280;function O(t,e=ga){let n=t.replace(/\s+/g," ").trim();return n.length>e?`${n.slice(0,e-1)}\u2026`:n}function te(t){if(t.configPath)return T(t.configPath);let e=[T(t.root,"agentx.json"),T(t.root,".agentx","config.json")];return e.find(n=>H(n))??e[0]}function V(t){return t.wikiDir?T(t.wikiDir):T(t.root,".agentx","wiki")}function ma(t){return Z(t.root,"pending").map(fa)}function fa(t){return{key:`card:${t.id}`,kind:"card",title:t.title,ask:t.ask,yes:`tell ${t.raised_by} yes`,no:`tell ${t.raised_by} no`,recommend:t.recommend,if_silent:t.if_silent,expires:t.expires,...t.source?{source:t.source}:{},raised_by:t.raised_by,...t.node?{node:t.node}:{},created_at:t.created_at,...t.choices?{choices:t.choices,more:`agentx approvals popup card:${t.id}`}:{},...t.draft?{draft:t.draft}:{},...t.context||t.draft?{detail:O([t.context,t.draft?`Suggested message: ${t.draft}`:""].filter(Boolean).join(" \xB7 "))}:{}}}function ha(t){let e=te(t);if(!H(e))return[];let n;try{n=JSON.parse(kt(e,"utf-8"))}catch{return[]}let r=new Date(t.now??Date.now()),o=[];for(let[s,i]of Object.entries(n?.crons??{})){let a=i?.approval;if(!a||a.action!=="create"&&a.action!=="delete")continue;let d=i.timezone||"UTC",l=i.schedule?sr(i.schedule):"",c=i.schedule?`${l.charAt(0).toLowerCase()}${l.slice(1)} (${i.schedule})`:"no schedule",p=String(i.prompt??i.command??""),u=a.action==="create";o.push({key:`schedule:${s}`,kind:"schedule",title:u?`New schedule "${s}" for ${i.agent??"an agent"}`:`Delete schedule "${s}"`,ask:u?`Let ${i.agent??"the agent"} run this ${c}?`:`Remove the schedule "${s}" (${c})?`,yes:u?"enable it":"remove it",no:u?"drop the request":"keep the schedule",raised_by:String(a.requestedBy??"unknown"),created_at:String(a.requestedAt??""),detail:O(`${p}${u&&i.schedule?` \xB7 first run ${ar(ir(i.schedule,d,r),d)}`:""}`),more:"agentx schedule list"})}return o}function uo(t){let e=T(t,".agentx","memory");return H(e)?ua(e).filter(n=>n.endsWith(".jsonl")).map(n=>n.slice(0,-6)).sort():[]}function ba(t){let e=uo(t.root);if(e.length===0)return[];let n=new at(t.root),r=[];for(let o of e)for(let s of n.held(o))r.push({key:`memory:${o}/${s.id}`,kind:"memory",title:`Fact ${o} learned from ${s.source.channel}`,ask:`Let ${o} use this fact in its prompts?`,yes:"use it",no:"keep it out for good",raised_by:o,created_at:s.createdAt,detail:O(s.content),more:`agentx memory facts held --agent ${o}`});return r}function ya(t){let e=t.sources.filter(n=>n.failure);return e.length?e.map(n=>`Recurring failure: ${n.agentId}'s ${n.failure.tool} fails with "${n.failure.errorClass}" in ${n.occurrences??1} sessions (${n.failure.runs} runs).`).join(" "):`${t.sources.length} source(s)${t.occurrences>1?`, seen in ${t.occurrences} sessions`:""}.`}function wa(t){return kr(V(t),"pending").map(e=>{let n=e.evidence;return{key:`wiki:${e.id}`,kind:"wiki",title:e.article.title,ask:e.replaces?`Update "${e.article.path}" in the shared wiki?`:`Add "${e.article.path}" to the shared wiki?`,yes:"write the article",no:"decline it",raised_by:n.agents.join(", ")||"wiki promote",created_at:e.createdAt,detail:O(`${ya(n)} ${e.article.content}`),more:`agentx wiki proposals show ${e.id}`}})}var so=new Map;function po(t,e){let n=pa(t,{bigint:!0}),r=`${n.mtimeNs}:${n.size}`,o=so.get(t);if(o?.version===r)return o.value;let s=e();return so.set(t,{version:r,value:s}),s}function xa(t){let e=t.subject&&t.attribute&&t.value;return{key:`fact:${t.id}`,kind:"fact",title:e?`${t.subject} \xB7 ${t.attribute}: ${t.value}`:`Claim from ${t.agentId}'s summary`,ask:`Is this true? Check it at its source first. "${O(t.claim,200)}"`,yes:e?"record it as a fact you confirmed":"nothing until you give the subject, attribute and value in the terminal",no:"drop the claim",raised_by:t.agentId,created_at:t.createdAt,detail:O(`From ${t.origin}. Source: ${t.source}.${e?"":" AgentX could not read a subject, attribute and value from it."}`),more:"agentx wiki facts proposals list"}}function ka(t,e){let n=V(t);if(!H(T(n,"_facts.json")))return;let r=Re(new ee(n),"pending").find(o=>o.id===e);return r?xa(r):void 0}function va(t){let e=T(V(t),"_facts.json");if(!H(e))return;let n=po(e,()=>Re(new ee(lo(e)),"pending").map(a=>Date.parse(a.createdAt)||0));if(n.length===0)return;let r=t.now??Date.now(),o=n.filter(a=>r-a<864e5).length,s=Math.max(...n),i=n.length.toLocaleString("en-US");return{kind:"fact",count:n.length,new_today:o,...s?{newest:new Date(s).toISOString()}:{},title:`${i} wiki claim${n.length===1?"":"s"} wait for a check${o?` (${o} new today)`:""}`,more:"agentx wiki facts proposals list"}}function Sa(t){return t.kind==="contradiction"?`${t.subject}: two values disagree`:t.kind==="article"?`No article yet for ${t.subject}`:`${t.subject}: ${t.field??"a field"} is missing`}function go(t){let e=V(t),n=new it(e);if(!H(n.path))return[];let r=po(n.path,()=>{let s=n.load();if(s.unreadable)throw new Error(`${n.path} is unreadable: ${s.unreadable}`);return s.questions.filter(i=>i.status==="open"&&i.kind==="contradiction")}),o;return r.map(s=>{let i;if(s.kind==="contradiction"&&s.proposed&&s.factId){let a=(o??=new ee(e)).get(s.factId);a&&(i=[a.value,s.proposed.value])}return{key:`question:${s.id}`,kind:"question",title:Sa(s),ask:s.question,yes:i?"record the value you pick, confirmed by you":`answer it in the terminal: agentx wiki answer ${s.id} "<value>"`,no:"dismiss it; the wiki keeps its value",raised_by:s.agentId,created_at:s.asked,...i?{choices:i}:{},more:"agentx wiki questions"}})}function Ea(t){return Gr(t.root,"pending").map(e=>({key:`whatsapp:${e.id}`,kind:"whatsapp",title:`WhatsApp reply to ${e.chat_name||e.to}`,ask:`Send this to ${e.chat_name||e.to}? "${e.text}"`,yes:"send it on WhatsApp",no:"drop the draft",raised_by:e.agent,created_at:e.created_at,detail:O(`${e.triage}: ${e.summary}`),more:"agentx whatsapp triage log"}))}function _a(t){return Tr(t.root,"pending").map(e=>({key:`email:${e.id}`,kind:"email",title:`Email reply to ${e.to_name?`${e.to_name} <${e.to}>`:e.to}`,ask:`Send this reply to ${e.to}, subject "${e.subject}"?`,yes:"send the email",no:"drop the reply",raised_by:e.agent,created_at:e.created_at,draft:e.text,...e.error?{detail:O(`Last try not sent: ${e.error}`)}:{}}))}function $a(t){let e=Object.entries(lt(t.root)).filter(([,r])=>r.kind==="approval");if(e.length===0)return[];let n=Oe(t).agents??{};return e.map(([r,o])=>{let s=n[r]??{};return{key:`agent:${r}`,kind:"agent",title:`New agent "${s.name||r}", created by ${o.by}`,ask:`Let ${s.name||r} (${s.tier||"claude-code"}) start working?`,yes:"let it run",no:"remove it from agentx.json (its folder is kept)",raised_by:o.by,created_at:o.at,detail:O(`Workspace: ${s.workspace||"?"}. Instructions: ${s.systemPrompt||"(none)"}`),more:"agentx agent list"}})}function Oe(t){try{return JSON.parse(kt(te(t),"utf-8"))}catch{return{}}}function xt(t){let e={};try{e=Object.fromEntries(Fn(kt(T(lo(te(t)),".env"),"utf-8")))}catch{}return{...e,...process.env}}function Ta(t){let e=pr(t.root,"pending");if(e.length===0)return[];let n=Oe(t),r=xt(t);return e.map(o=>{let s=pe[o.platform]??o.platform;return{key:`content:${o.id}`,kind:"content",title:`${s} post${o.topic?`: ${o.topic}`:""}${o.date?` (for ${o.date})`:""}`,ask:`Publish this on ${s}? "${o.text}"`,yes:to({config:n,env:r},o.agent,o.platform)?`post it on ${s}`:"save it ready to paste (no connector is set)",no:"drop the draft",raised_by:o.agent,created_at:o.created_at,detail:O(`Follows your past posts: ${o.samples.join(", ")}`),more:`agentx content show ${o.id}`,text_hash:dr(o.text)}})}function G(t){if(t.requests)return t.requests;if(T(t.root)!==process.cwd()||!H(T(t.root,".agentx","db.sqlite")))return null;let e=nt({quiet:!0});if(!e)return null;let n=io.get(e);return!n&&!Cn(e)?null:(n||io.set(e,n=new Nn(e)),n)}var io=new WeakMap;function jp(t){if(t.plans)return t.plans;if(t.requests||T(t.root)!==process.cwd()||!H(T(t.root,".agentx","db.sqlite")))return null;let e=nt({quiet:!0});if(!e||!oo(e))return null;let n=ao.get(e);return n||ao.set(e,n=new Ne(e)),n}var ao=new WeakMap;function Aa(t){let e=G(t);return e?e.listByState("needs_attention").map(n=>({key:`request:${n.id}`,kind:"request",title:K(n,120).headline,ask:`Not finished. Ask ${n.agentId} to pick it up again?`,yes:`hand it back to ${n.agentId}`,no:"drop the request",raised_by:n.agentId,created_at:new Date(n.createdAt).toISOString(),detail:O(`${n.attentionReason??"It needs attention"}. You said (${n.channel}): ${n.text}`),more:`agentx requests show ${n.id}`})):[]}var mo={card:ma,schedule:ha,agent:$a,memory:ba,wiki:wa,fact:()=>[],question:go,whatsapp:Ea,email:_a,content:Ta,request:Aa};function Ra(t,e){let n=t.expires?Date.parse(t.expires):1/0,r=e.expires?Date.parse(e.expires):1/0;return n!==r?n-r:(Date.parse(t.created_at)||0)-(Date.parse(e.created_at)||0)}function fo(t,e={}){let n=t.now??Date.now(),{snoozed:r}=N(t.root),o=[],s=[],i=[],a=0;for(let d of e.kinds??co){if(d==="fact"){try{let c=va(t);c&&i.push(c)}catch(c){s.push({kind:d,error:String(c?.message??c).slice(0,200)})}continue}let l;try{l=mo[d](t)}catch(c){s.push({kind:d,error:String(c?.message??c).slice(0,200)});continue}for(let c of l){let p=r[c.key];if(p&&Date.parse(p)>n){if(!e.includeSnoozed){a++;continue}c.snoozed_until=p}o.push(c)}}return o.sort(Ra),{items:o,snoozed:a,errors:s,backlog:i}}function ho(t){let e=t.indexOf(":");if(e<=0)return null;let n=t.slice(0,e),r=t.slice(e+1);return!co.includes(n)||!r?null:{kind:n,ref:r}}function Ia(t,e,n){switch(e){case"card":return ce(t.root,n)?.status==="pending";case"wiki":return xr(V(t),n)?.status==="pending";case"whatsapp":return Ce(t.root,n)?.status==="pending";case"email":return $r(t.root,n)?.status==="pending";case"content":return ur(t.root,n)?.status==="pending";default:return!!bo(t,e,n)}}function bo(t,e,n){return e==="fact"?ka(t,n):mo[e](t).find(r=>r.key===`${e}:${n}`)}async function yo(t,e,n,r={}){let o=n==="later"?null:ho(e),s;if(o)try{s=bo(t,o.kind,o.ref)}catch{s=void 0}let i=await Da(t,e,n,r);if(i.ok&&o&&n!=="later"){let a=typeof r.choice=="number"?s?.choices?.[r.choice-1]:r.choice;Wn(t.root,{key:e,kind:o.kind,title:s?.title??e,raised_by:s?.raised_by??"",answer:n,...a?{choice:a}:{},...r.text?{text:r.text}:{},by:r.by??"operator",at:new Date(t.now??Date.now()).toISOString()})}return i}async function Da(t,e,n,r){let o=ho(e);if(!o)return{ok:!1,error:`unknown item "${e}": use a key from \`agentx approvals list\``};let{kind:s,ref:i}=o,a=t.now??Date.now(),d=r.by??"operator";if(n==="later"){if(!Ia(t,s,i))return{ok:!1,error:`nothing waiting for "${e}"`};let c=r.laterHours&&r.laterHours>0?r.laterHours:24,p=new Date(a+c*36e5);return Wr(t.root,e,p,a),{ok:!0,message:`${e} put off until ${p.toISOString()}`}}let l=n==="yes";switch(s){case"card":{let c=zn(t.root,i,l?"yes":"no",{by:d,note:r.note,now:a,choice:r.choice,text:r.text,popup:r.popup});return c.ok?{ok:!0,message:`${e}: ${c.card.raised_by} will be told ${l?"yes":"no"}${c.card.choice?` (${c.card.choice}${c.card.choice_suggested?", the suggested option":""})`:""}`}:c}case"schedule":{let c=await(l?lr:cr)(i,{configPath:te(t),reload:t.reload});return c.success?{ok:!0,message:c.message}:{ok:!1,error:c.message}}case"agent":{if(lt(t.root)[i]?.kind!=="approval")return{ok:!1,error:`no new agent "${i}" waits for approval`};if(l)return ct(t.root,i,"approval"),{ok:!0,message:`${e}: approved. It runs once the daemon has loaded it; if it was added while the daemon was running, run: agentx daemon restart`};let c=[],p=await Te(u=>{Qn(u,`agents.${i}`);for(let[g,m]of Object.entries(u.crons??{}))m?.agent===i&&(delete u.crons[g],c.push(g))},{configPath:te(t),reload:t.reload});return p.success?(ct(t.root,i),{ok:!0,message:`${e}: removed from agentx.json${c.length?`, with its schedules ${c.join(", ")}`:""}; its folder is kept`}):{ok:!1,error:p.error||"could not remove it from agentx.json"}}case"memory":{let c=i.indexOf("/");if(c<=0)return{ok:!1,error:"memory keys look like memory:<agent>/<fact-id>"};let p=i.slice(0,c),u=i.slice(c+1);if(!uo(t.root).includes(p))return{ok:!1,error:`no memory for agent "${p}"`};let g=new at(t.root);return g.held(p).some(m=>m.id===u)?(g.review(p,u,l?"approved":"rejected",d),{ok:!0,message:`${e} ${l?"approved: the agent may use it":"rejected: it stays out of prompts"}`}):{ok:!1,error:`fact "${u}" isn't waiting for review`}}case"wiki":{let c=V(t),p=l?vr(c,i,{by:d,force:r.force,now:a}):Sr(c,i,{by:d,reason:r.note,now:a});return p.ok?{ok:!0,message:l?`${p.proposal.article.path} written to the shared wiki`:`${e} rejected`}:p}case"fact":return Ca(t,e,i,l,d,r);case"question":return Oa(t,e,i,l,d,r);case"whatsapp":{let c=await Yr(t.root,i,l?"yes":"no",{by:d,now:a,send:t.sendWhatsApp});return c.ok?{ok:!0,message:l?`${e}: sent to ${c.draft.chat_name||c.draft.to}`:`${e}: dropped, nothing sent`}:c}case"email":{let c=t.sendEmail??Rr(Oe(t),xt(t)),p=await Ar(t.root,i,l?"yes":"no",{by:d,now:a,text:r.text,send:c});return p.ok?{ok:!0,message:l?`${e}: sent to ${p.draft.to}${p.draft.edited?" (as you edited it)":""}`:`${e}: dropped, nothing sent`}:p}case"content":{let c=t.publishContent??no({config:Oe(t),env:xt(t)}),p=await gr(t.root,i,l?"yes":"no",{by:d,now:a,text:r.text,seen:r.seen,publish:c});if(!p.ok)return p;if(!l)return{ok:!0,message:`${e}: dropped, nothing published`};let u=pe[p.draft.platform];return{ok:!0,message:p.draft.status==="posted"?`${e}: posted on ${u}${p.draft.url?` (${p.draft.url})`:""}`:`${e}: no ${u} connector is set, so it is saved ready to paste: ${p.draft.file}`}}case"request":{let c=G(t),p=c?.get(i);return!c||!p||p.state!=="needs_attention"?{ok:!1,error:`nothing waiting for "${e}"`}:l?Br(te(t)).enabled?(c.requestPickup(i,a),{ok:!0,message:`${e}: ${p.agentId} will be asked to pick it up again`}):{ok:!1,error:"Requests are off, so nothing would hand it back. Turn them on (agentx requests settings --enabled on), or answer no to drop it."}:(c.close(i,"dropped",r.note?.trim()||`dropped by ${d}`,a,null,d==="operator"?In:d),{ok:!0,message:`${e}: dropped`})}}}function Ca(t,e,n,r,o,s){let i=new ee(V(t));try{let a=Re(i,"pending").find(l=>l.id===n);if(!a)return{ok:!1,error:`nothing waiting for "${e}"`};if(!r)return nr(i,a.id,o,s.note),{ok:!0,message:`${e}: claim dropped`};let d=tr(i,a.id,o);return{ok:!0,message:`${e}: ${d.write.fact.subject} \xB7 ${d.write.fact.attribute} recorded as "${d.write.fact.value}"`}}catch(a){return{ok:!1,error:String(a?.message??a)}}}function Na(t,e){if(e===void 0||e==="")return;let n=typeof e=="number"?e:/^\d+$/.test(String(e).trim())?Number(e):NaN;if(Number.isInteger(n))return t[n-1];let r=String(e).trim().toLowerCase();return t.find(o=>o.toLowerCase()===r)}function Oa(t,e,n,r,o,s){let i=V(t),a=new it(i),d=a.list("open").find(l=>l.id===n);if(!d)return{ok:!1,error:`nothing waiting for "${e}"`};try{if(Kn(`${r?"answer":"dismiss"} a wiki question`),!r)return a.resolve(d.id,"dismissed"),{ok:!0,message:`${e}: dismissed`};let l=go(t).find(g=>g.key===e);if(!l?.choices)return{ok:!1,error:`answer it in the terminal: agentx wiki answer ${d.id} "<value>"`};let c=Na(l.choices,s.choice);if(!c)return{ok:!1,error:`pick one of: ${l.choices.map((g,m)=>`${m+1}. ${g}`).join(", ")}`};let p=new ee(i),u=d.factId?p.get(d.factId):void 0;return u&&p.write({subject:u.subject,attribute:u.attribute,value:c,source:"owner said",verifiedBy:o,volatility:u.volatility},{confirmedBy:o}),a.resolve(d.id,"answered",c),{ok:!0,message:`${e}: answered "${c}"`}}catch(l){return{ok:!1,error:String(l?.message??l)}}}var La=3,Pa=7,Ma=50,St=120,Fa=280,vt=600,xo=36e5,Ua=24*xo;function Hp(t){let e=new Set;for(let n of t)for(let r of n.runningTasks??[])r.traceId&&e.add(r.traceId);return e}function ne(t,e){let n=t.replace(/\s+/g," ").trim();return n.length>e?`${n.slice(0,e-1)}\u2026`:n}var Le=t=>new Date(t).toISOString();function Wa(t,e,n){let r=e.key.slice(0,Math.max(0,e.key.indexOf(":")))||"card";return{key:e.key,kind:r,column:"yours",node:t.node,nodeName:t.nodeName,title:ne(e.title,St),...e.ask?{ask:ne(e.ask,vt)}:{},...e.detail?{facts:ne(e.detail,Fa)}:{},...e.recommend?{recommend:e.recommend}:{},...e.raisedBy?{agent:e.raisedBy}:{},...e.yes?{yes:e.yes}:{},...e.no?{no:e.no}:{},...e.choices?.length?{choices:e.choices}:{},...e.draft?{draft:e.draft}:{},...e.expires?{expires:e.expires}:{},...e.ifSilent?{ifSilent:e.ifSilent}:{},...e.createdAt?{askedAt:e.createdAt}:{},can:{answer:!0,later:!0,reply:n&&r==="request"}}}var ja={done:"Done",declined:"Declined",dropped:"Dropped"};function ko(t,e,n){let{record:r,links:o}=e,s=K(r,St),i={key:`request:${r.id}`,kind:"request",node:t.node,nodeName:t.nodeName,title:s.headline,need:s.need,...r.headline?{said:ne(s.said,vt)}:{},agent:r.agentId,askedAt:Le(r.createdAt),changedAt:Le(r.stateChangedAt??r.updatedAt)};switch(r.state){case"candidate":case"needs_attention":return null;case"waiting_owner":return o.some(a=>a.kind==="card"&&n.has(`card:${a.ref}`))?null:{...i,column:"yours",...r.question?{ask:ne(r.question,vt)}:{},can:{answer:!1,later:!1,reply:!0}};case"in_progress":case"waiting_other":{let a=o.some(l=>l.kind==="run"&&!!t.liveRuns?.has(l.ref)),d=t.now-r.updatedAt<(t.quietHours??La)*xo;return{...i,column:a||d?"agent":"quiet",...a?{live:a}:{},can:{answer:!1,later:!1,reply:!a}}}default:{let a=r.state==="done"?r.evidence:r.closeReason;return{...i,need:void 0,column:"done",changedAt:Le(r.closedAt??r.stateChangedAt??r.updatedAt),outcome:ja[r.state]??r.state,...a?{evidence:a}:{},can:{answer:!1,later:!1,reply:!1}}}}}function Ba(t){return t.status==="decided"?t.verdict==="yes"?`Answered yes${t.choice?`: ${t.choice}`:""}`:"Answered no":t.status==="expired"?`No answer in time: ${t.outcome==="discard"?"discarded":t.outcome==="pause"?"paused":"kept"}`:"Closed by the agent"}function qa(t,e){return{key:`card:${e.id}`,kind:"card",column:"done",node:t.node,nodeName:t.nodeName,title:ne(e.title,St),ask:e.ask,agent:e.raised_by,askedAt:e.created_at,...e.decided_at?{changedAt:e.decided_at}:{},outcome:Ba(e),...e.resolution?{evidence:e.resolution}:{},can:{answer:!1,later:!1,reply:!1}}}var L=t=>t&&Date.parse(t)||0,wo=(t,e)=>t.map(n=>n[e]).filter(n=>!!L(n)).sort((n,r)=>L(n)-L(r))[0];function Et(t){let e=[],n=[];for(let o of t.inbox){o.error&&n.push(`What waits on ${o.nodeName} could not be read: ${o.error}`);for(let s of o.items)e.push(Wa(o,s,o.node===t.node))}let r=vo(t,e);for(let o of t.requests??[]){let s=ko(t,o,r);s?.column==="yours"&&e.push(s)}return{cards:e,errors:n}}function vo(t,e){return new Set([...e.filter(n=>n.node===t.node).map(n=>n.key),...t.deferred??[]])}function Vp(t){let e=Et(t.owner?{...t,requests:null}:t),n=t.owner?[...t.owner.items,...e.cards]:e.cards,r=t.owner?[...t.owner.errors,...e.errors]:e.errors,o=vo(t,n),s=[],i=[],a=[];for(let u of t.requests??[]){let g=ko(t,u,o);g&&g.column!=="yours"&&{agent:s,quiet:i,done:a}[g.column].push(g)}let d=t.now-(t.doneDays??Pa)*Ua;for(let u of t.cards)u.status!=="pending"&&L(u.decided_at)>=d&&a.push(qa(t,u));s.sort((u,g)=>L(g.changedAt)-L(u.changedAt)),i.sort((u,g)=>L(u.changedAt)-L(g.changedAt)),a.sort((u,g)=>L(g.changedAt)-L(u.changedAt));let l=a.filter(u=>L(u.changedAt)>=d).slice(0,Ma),c=wo(n,"askedAt"),p=wo(i,"changedAt");return{ts:Le(t.now),cards:[...n,...s,...i,...l],figures:{yours:{count:n.length,...c?{oldest:c}:{},...t.owner?.later?{later:t.owner.later}:{}},agent:{count:s.length},quiet:{count:i.length,...p?{oldest:p}:{}},done:{count:l.length}},errors:r}}function Ha(t){return{key:t.key,title:t.title,ask:t.ask,recommend:t.recommend,yes:t.yes,no:t.no,raisedBy:t.raised_by,expires:t.expires,...t.if_silent?{ifSilent:t.if_silent}:{},...t.choices?{choices:t.choices}:{},...t.draft?{draft:t.draft}:{},...t.detail?{detail:t.detail}:{},...t.created_at?{createdAt:t.created_at}:{}}}function Va(t,e,n){let r=t.map(o=>o.askedAt).filter(o=>!!o&&!!Date.parse(o)).sort((o,s)=>Date.parse(o)-Date.parse(s));return{count:t.length,later:e,...r[0]?{oldest:r[0]}:{},items:t,errors:n}}function Gp(t,e){let n=t.now??Date.now(),r=[],o=fo(t,{includeSnoozed:!0});for(let c of o.errors)r.push(`What waits (${c.kind}) could not be read: ${c.error}`);let s=o.items.filter(c=>!c.snoozed_until),i=new Set(o.items.filter(c=>c.snoozed_until).map(c=>c.key)),a=null;try{let c=G(t);c&&(a=c.listByState("waiting_owner").map(p=>({record:p,links:c.links(p.id)})))}catch(c){r.push(`Requests could not be read: ${c?.message??c}`)}let{cards:d,errors:l}=Et({now:n,node:e.url,nodeName:e.name,inbox:[{node:e.url,nodeName:e.name,items:s.map(Ha)}],requests:a,deferred:i});return Va(d,i.size,[...r,...l])}import{readFileSync as Xa}from"fs";var za=1e4,So=/^[0-9a-f]{7,64}$/i;function Qp(t){let e=t.fetch??fetch;return async n=>{if(n==="self"){let i=t.self();return i&&So.test(i)?{source:n,commit:i}:{source:n,commit:null,error:"this build does not carry its commit (run from source?)"}}let r;try{r=await e(n,{signal:AbortSignal.timeout(za)})}catch(i){return{source:n,commit:null,error:`could not be reached: ${String(i?.message??i).slice(0,200)}`}}if(!r.ok)return{source:n,commit:null,error:`HTTP ${r.status}`};let o=await r.json().catch(()=>null),s=t.field.split(".").reduce((i,a)=>i&&typeof i=="object"?i[a]:void 0,o);return typeof s=="string"&&So.test(s.trim())?{source:n,commit:s.trim()}:{source:n,commit:null,error:`no commit under "${t.field}"`}}}function Zp(t){let e=t.requests.checkers,n=t.channels.github,r=e?.github?.token??n?.token;if(!r&&n?.tokenFile)try{r=Xa(n.tokenFile,"utf-8").trim().split(`
|
|
68
|
-
`)[0].trim()||void 0}catch{}let o=t.channels.gitlab;return{github:{apiUrl:e?.github?.apiUrl??"https://api.github.com",token:r},gitlab:{url:e?.gitlab?.url??o?.host??"https://gitlab.com",token:e?.gitlab?.token??o?.token}}}var Pe=new Set(["127.0.0.1","::1","::ffff:127.0.0.1"]);function tg(t){return t==="/api/memory"||t.startsWith("/api/memory/")||t==="/api/assistant"||t.startsWith("/api/assistant/")||t==="/api/agent-picture"||t==="/approvals"||t.startsWith("/approvals/")||t==="/api/org"||t.startsWith("/api/org/")||t==="/content"||t.startsWith("/content/")||t==="/integrations"||t.startsWith("/integrations/")||t==="/screen"||t==="/native/notes"||t==="/requests"||t.startsWith("/requests/")||t==="/watchers"||t.startsWith("/watchers/")||t==="/follow-up"||t.startsWith("/follow-up/")||t==="/events/recent"||t==="/events/hub"||/^\/agents\/[^/]+\/events$/.test(t)||t==="/a2a/delegations"||t.startsWith("/a2a/delegations/")||t==="/traces"||t.startsWith("/traces/")||t==="/voice/history"||t.startsWith("/voice/history/")||t==="/voice/requests"||t.startsWith("/voice/requests/")||t==="/voice/transcribe"||t==="/voice/speak"||t==="/app-files"||t==="/calls"||t.startsWith("/calls/")||t==="/webrtc/camera"||t.startsWith("/webrtc/camera/")||t==="/mesh/guests"||t.startsWith("/mesh/guests/")||t==="/wiki/agents"||t==="/wiki/entries"||t==="/wiki/articles"||t==="/wiki/article"||t==="/wiki/notes"||t==="/api/wiki/curate"||t==="/api/wiki/curate/restore"||t==="/api/signals/stopped"||t.startsWith("/api/signals/stopped/")||t==="/api/review-gate/reviews"||t==="/owner/told"||t==="/owner/presence"}function ng(t){return t==="/reload"||t==="/api/processes/kill"||t==="/send"||t==="/send/agent"||t==="/send/contact"||t==="/mesh/announce"||t==="/events"||t==="/voice/settings"||t==="/voice/preview"||/^\/api\/tasks\/[^/]+\/(cancel|followup)$/.test(t)||/^\/mesh\/guests\/[^/]+\/(pause|resume|end|update)$/.test(t)||/^\/crons\/[^/]+\/enabled$/.test(t)||/^\/channels\/[^/]+\/switch$/.test(t)||/^\/workflow-runs\/[^/]+\/cancel$/.test(t)||t==="/api/signals/stop"||t==="/api/signals/resume"||t==="/api/signals/drop"||t==="/api/signals/stop-all"||t==="/api/signals/stop-all/report"||t==="/api/review-gate/replay"}function rg(t){return Pe.has(t)}function og(t){if(t.foreignBrowser)return{allowed:!1,reason:"foreign-browser-origin"};if(t.enforcementDisabled)return{allowed:!0,reason:"disabled"};if(Pe.has(t.remoteAddress))return{allowed:!0,reason:"loopback"};if(t.acceptedTokens.size===0)return{allowed:!0,reason:"no-tokens-configured"};let e=t.authorizationHeader||"",n=e.startsWith("Bearer ")?e.slice(7).trim():"";return n&&t.acceptedTokens.has(n)?{allowed:!0,reason:"token"}:{allowed:!1,reason:"missing-or-invalid-token"}}function sg(t){let e=t.authorizationHeader||"",n=e.startsWith("Bearer ")?e.slice(7).trim():"";return n&&t.chatSecret&&n===t.chatSecret?!0:t.foreignBrowser?!1:n&&t.acceptedTokens.has(n)?!0:!t.chatSecret&&Pe.has(t.remoteAddress)}function ig(t){let e=t.authorizationHeader||"",n=e.startsWith("Bearer ")?e.slice(7).trim():"";return t.chatSecret?n===t.chatSecret:Pe.has(t.remoteAddress)||!!n&&t.acceptedTokens.has(n)}function ag(t,e=process.env){let n=new Set;e.MESH_TOKEN&&n.add(e.MESH_TOKEN);for(let r of t.mesh?.peers||[])r.token&&n.add(r.token);return n}function lg(t,e,n=process.env){let r=s=>s.replace(/\/+$/,"");return(e===r(t.daemonUrl)?t.token:t.daemons.find(s=>r(s.url)===e)?.token)||n.MESH_TOKEN||void 0}function Me(t){return(Array.isArray(t)?t[0]:t)?.trim()??""}function Ka(t){try{return new URL(t).host.toLowerCase()}catch{return null}}function Ga(t=process.env){return new Set((t.AGENTX_ALLOWED_ORIGINS||"").split(",").map(e=>e.trim().replace(/\/+$/,"").toLowerCase()).filter(Boolean))}function dg(t,e=Ga()){let n=Me(t.origin);if(n){if(e.has(n.replace(/\/+$/,"").toLowerCase()))return"same-origin";let o=Ka(n),s=[Me(t.host),Me(t["x-forwarded-host"])].filter(Boolean).map(i=>i.toLowerCase());return o&&s.includes(o)?"same-origin":"foreign"}let r=Me(t["sec-fetch-site"]).toLowerCase();return r==="cross-site"||r==="same-site"?"foreign":"none"}function ug(t){let e=(t||"GET").toUpperCase();return e!=="GET"&&e!=="HEAD"}var _t="/api/admin/pictures",Ya=/^\/api\/pictures\/(agent|person)\/([^/]+)$/,Ja=/^\/api\/admin\/pictures\/(agent|person)\/([^/]+)$/;function _(t,e,n){t.writeHead(e,{"Content-Type":"application/json","Cache-Control":"no-store"}),t.end(JSON.stringify(n))}function Qa(t){let e={agent:{},person:{}};for(let n of mr)for(let[r,o]of Object.entries(br(t,n)))e[n][r]=yr(n,r,o);return e}function mg(t,e,n,r,o){let s=n.match(Ya);if(!s)return!1;if((t.method||"GET").toUpperCase()!=="GET")return _(e,405,{error:"GET only"}),!0;let i=decodeURIComponent(s[2]),a=wr(o,s[1],i,r.searchParams.get("v")||"");return a?(e.writeHead(200,{"Content-Type":fr,"Content-Length":String(a.length),"Cache-Control":"private, max-age=31536000, immutable","X-Content-Type-Options":"nosniff","Content-Security-Policy":"default-src 'none'"}),e.end(a),!0):(_(e,404,{error:"no such picture"}),!0)}async function fg(t,e,n,r){if(n!==_t&&!n.startsWith(`${_t}/`))return!1;let o=(t.method||"GET").toUpperCase();if(n===_t)return o!=="GET"?(_(e,405,{error:"GET only"}),!0):(_(e,200,{...Qa(r.root),editable:{agent:r.agentIds(),person:r.personIds()}}),!0);let s=n.match(Ja);if(!s)return _(e,404,{error:"not found"}),!0;if(o!=="PUT"&&o!=="DELETE")return _(e,405,{error:"PUT or DELETE only"}),!0;let i=t.headers["x-requested-with"];if(i!=="agentx-board"&&i!=="agentx-admin")return _(e,400,{error:"missing X-Requested-With: agentx-board"}),!0;let a=s[1],d=decodeURIComponent(s[2]),l=a==="agent"?r.agentIds():r.personIds();if(!hr.test(d)||!l.includes(d))return _(e,404,{error:a==="agent"?`no agent "${d}" in agentx.json`:`no person "${d}" in agentx.json`}),!0;if(o==="DELETE"){let c=gt(r.root,a,d);return _(e,200,{ok:!0,removed:c}),!0}try{let c=await mt(t),p=await pt(r.root,a,d,c);_(e,200,{ok:!0,url:p.url})}catch(c){if(c instanceof ut)return _(e,c.status,{error:c.message}),!0;throw c}return!0}async function hg(t,e,n,r){let o=(t.method||"GET").toUpperCase();if(o!=="PUT"&&o!=="DELETE"){_(e,405,{error:"PUT or DELETE only"});return}let s=n.searchParams.get("agent")?.trim()||void 0,i=r.provenAgent(s);if(!i){_(e,403,{error:"Only an agent sets its own picture, from its own run: send X-AgentX-Task (or X-AgentX-Channel and X-AgentX-Chat) of a running turn. The owner sets pictures in Settings."});return}if(s&&s!==i){_(e,403,{error:`An agent can only change its own picture: this run is "${i}", not "${s}".`});return}if(o==="DELETE"){_(e,200,{ok:!0,agent:i,removed:gt(r.root,"agent",i)});return}try{let a=await pt(r.root,"agent",i,await mt(t));_(e,200,{ok:!0,agent:i,url:a.url})}catch(a){if(a instanceof ut){_(e,a.status,{error:a.message});return}throw a}}var Eo={};function wg(t){Eo=t}function xg(){return Eo}var kg=`<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
|
68
|
+
`)[0].trim()||void 0}catch{}let o=t.channels.gitlab;return{github:{apiUrl:e?.github?.apiUrl??"https://api.github.com",token:r},gitlab:{url:e?.gitlab?.url??o?.host??"https://gitlab.com",token:e?.gitlab?.token??o?.token}}}var Pe=new Set(["127.0.0.1","::1","::ffff:127.0.0.1"]);function tg(t){return t==="/api/memory"||t.startsWith("/api/memory/")||t==="/api/assistant"||t.startsWith("/api/assistant/")||t==="/api/agent-picture"||t==="/approvals"||t.startsWith("/approvals/")||t==="/api/org"||t.startsWith("/api/org/")||t==="/content"||t.startsWith("/content/")||t==="/integrations"||t.startsWith("/integrations/")||t==="/screen"||t==="/native/notes"||t==="/requests"||t.startsWith("/requests/")||t==="/watchers"||t.startsWith("/watchers/")||t==="/follow-up"||t.startsWith("/follow-up/")||t==="/events/recent"||t==="/events/hub"||/^\/agents\/[^/]+\/events$/.test(t)||t==="/a2a/delegations"||t.startsWith("/a2a/delegations/")||t==="/traces"||t.startsWith("/traces/")||t==="/voice/history"||t.startsWith("/voice/history/")||t==="/voice/requests"||t.startsWith("/voice/requests/")||t==="/voice/transcribe"||t==="/voice/speak"||t==="/app-files"||t==="/calls"||t.startsWith("/calls/")||t==="/webrtc/camera"||t.startsWith("/webrtc/camera/")||t==="/mesh/guests"||t.startsWith("/mesh/guests/")||t==="/wiki/agents"||t==="/wiki/entries"||t==="/wiki/articles"||t==="/wiki/article"||t==="/wiki/notes"||t==="/api/wiki/curate"||t==="/api/wiki/curate/restore"||t==="/api/signals/stopped"||t.startsWith("/api/signals/stopped/")||t==="/api/review-gate/reviews"||t==="/owner/told"||t==="/owner/presence"||t==="/lookup"}function ng(t){return t==="/reload"||t==="/api/processes/kill"||t==="/send"||t==="/send/agent"||t==="/send/contact"||t==="/mesh/announce"||t==="/events"||t==="/voice/settings"||t==="/voice/preview"||/^\/api\/tasks\/[^/]+\/(cancel|followup)$/.test(t)||/^\/mesh\/guests\/[^/]+\/(pause|resume|end|update)$/.test(t)||/^\/crons\/[^/]+\/enabled$/.test(t)||/^\/channels\/[^/]+\/switch$/.test(t)||/^\/workflow-runs\/[^/]+\/cancel$/.test(t)||t==="/api/signals/stop"||t==="/api/signals/resume"||t==="/api/signals/drop"||t==="/api/signals/stop-all"||t==="/api/signals/stop-all/report"||t==="/api/review-gate/replay"}function rg(t){return Pe.has(t)}function og(t){if(t.foreignBrowser)return{allowed:!1,reason:"foreign-browser-origin"};if(t.enforcementDisabled)return{allowed:!0,reason:"disabled"};if(Pe.has(t.remoteAddress))return{allowed:!0,reason:"loopback"};if(t.acceptedTokens.size===0)return{allowed:!0,reason:"no-tokens-configured"};let e=t.authorizationHeader||"",n=e.startsWith("Bearer ")?e.slice(7).trim():"";return n&&t.acceptedTokens.has(n)?{allowed:!0,reason:"token"}:{allowed:!1,reason:"missing-or-invalid-token"}}function sg(t){let e=t.authorizationHeader||"",n=e.startsWith("Bearer ")?e.slice(7).trim():"";return n&&t.chatSecret&&n===t.chatSecret?!0:t.foreignBrowser?!1:n&&t.acceptedTokens.has(n)?!0:!t.chatSecret&&Pe.has(t.remoteAddress)}function ig(t){let e=t.authorizationHeader||"",n=e.startsWith("Bearer ")?e.slice(7).trim():"";return t.chatSecret?n===t.chatSecret:Pe.has(t.remoteAddress)||!!n&&t.acceptedTokens.has(n)}function ag(t,e=process.env){let n=new Set;e.MESH_TOKEN&&n.add(e.MESH_TOKEN);for(let r of t.mesh?.peers||[])r.token&&n.add(r.token);return n}function lg(t,e,n=process.env){let r=s=>s.replace(/\/+$/,"");return(e===r(t.daemonUrl)?t.token:t.daemons.find(s=>r(s.url)===e)?.token)||n.MESH_TOKEN||void 0}function Me(t){return(Array.isArray(t)?t[0]:t)?.trim()??""}function Ka(t){try{return new URL(t).host.toLowerCase()}catch{return null}}function Ga(t=process.env){return new Set((t.AGENTX_ALLOWED_ORIGINS||"").split(",").map(e=>e.trim().replace(/\/+$/,"").toLowerCase()).filter(Boolean))}function dg(t,e=Ga()){let n=Me(t.origin);if(n){if(e.has(n.replace(/\/+$/,"").toLowerCase()))return"same-origin";let o=Ka(n),s=[Me(t.host),Me(t["x-forwarded-host"])].filter(Boolean).map(i=>i.toLowerCase());return o&&s.includes(o)?"same-origin":"foreign"}let r=Me(t["sec-fetch-site"]).toLowerCase();return r==="cross-site"||r==="same-site"?"foreign":"none"}function ug(t){let e=(t||"GET").toUpperCase();return e!=="GET"&&e!=="HEAD"}var _t="/api/admin/pictures",Ya=/^\/api\/pictures\/(agent|person)\/([^/]+)$/,Ja=/^\/api\/admin\/pictures\/(agent|person)\/([^/]+)$/;function _(t,e,n){t.writeHead(e,{"Content-Type":"application/json","Cache-Control":"no-store"}),t.end(JSON.stringify(n))}function Qa(t){let e={agent:{},person:{}};for(let n of mr)for(let[r,o]of Object.entries(br(t,n)))e[n][r]=yr(n,r,o);return e}function mg(t,e,n,r,o){let s=n.match(Ya);if(!s)return!1;if((t.method||"GET").toUpperCase()!=="GET")return _(e,405,{error:"GET only"}),!0;let i=decodeURIComponent(s[2]),a=wr(o,s[1],i,r.searchParams.get("v")||"");return a?(e.writeHead(200,{"Content-Type":fr,"Content-Length":String(a.length),"Cache-Control":"private, max-age=31536000, immutable","X-Content-Type-Options":"nosniff","Content-Security-Policy":"default-src 'none'"}),e.end(a),!0):(_(e,404,{error:"no such picture"}),!0)}async function fg(t,e,n,r){if(n!==_t&&!n.startsWith(`${_t}/`))return!1;let o=(t.method||"GET").toUpperCase();if(n===_t)return o!=="GET"?(_(e,405,{error:"GET only"}),!0):(_(e,200,{...Qa(r.root),editable:{agent:r.agentIds(),person:r.personIds()}}),!0);let s=n.match(Ja);if(!s)return _(e,404,{error:"not found"}),!0;if(o!=="PUT"&&o!=="DELETE")return _(e,405,{error:"PUT or DELETE only"}),!0;let i=t.headers["x-requested-with"];if(i!=="agentx-board"&&i!=="agentx-admin")return _(e,400,{error:"missing X-Requested-With: agentx-board"}),!0;let a=s[1],d=decodeURIComponent(s[2]),l=a==="agent"?r.agentIds():r.personIds();if(!hr.test(d)||!l.includes(d))return _(e,404,{error:a==="agent"?`no agent "${d}" in agentx.json`:`no person "${d}" in agentx.json`}),!0;if(o==="DELETE"){let c=gt(r.root,a,d);return _(e,200,{ok:!0,removed:c}),!0}try{let c=await mt(t),p=await pt(r.root,a,d,c);_(e,200,{ok:!0,url:p.url})}catch(c){if(c instanceof ut)return _(e,c.status,{error:c.message}),!0;throw c}return!0}async function hg(t,e,n,r){let o=(t.method||"GET").toUpperCase();if(o!=="PUT"&&o!=="DELETE"){_(e,405,{error:"PUT or DELETE only"});return}let s=n.searchParams.get("agent")?.trim()||void 0,i=r.provenAgent(s);if(!i){_(e,403,{error:"Only an agent sets its own picture, from its own run: send X-AgentX-Task (or X-AgentX-Channel and X-AgentX-Chat) of a running turn. The owner sets pictures in Settings."});return}if(s&&s!==i){_(e,403,{error:`An agent can only change its own picture: this run is "${i}", not "${s}".`});return}if(o==="DELETE"){_(e,200,{ok:!0,agent:i,removed:gt(r.root,"agent",i)});return}try{let a=await pt(r.root,"agent",i,await mt(t));_(e,200,{ok:!0,agent:i,url:a.url})}catch(a){if(a instanceof ut){_(e,a.status,{error:a.message});return}throw a}}var Eo={};function wg(t){Eo=t}function xg(){return Eo}var kg=`<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
|
69
69
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
70
70
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
71
71
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
@@ -966,4 +966,4 @@ Document the arguments, commands, or files the skill expects. Example:
|
|
|
966
966
|
claude-code ${Sn(t)} --arg value
|
|
967
967
|
\`\`\`
|
|
968
968
|
`}Mn();var yi={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function wi(t){return{...yi,...t??{},regions:{...t?.regions??{}},buffer:{...yi.buffer,...t?.buffer??{}}}}function zh(t){try{return wi(Pn(t).screen)}catch{return wi(void 0)}}var Ru=/^[a-z][\w-]*$/,xi=["window","screen","menubar","notifications"];function ke(t,e,n,r){let o=Number(t);if(t===""||t===null||!Number.isFinite(o)||!n(o))throw new Error(`${e} must be ${r}`);return o}var Je=(t,e)=>ke(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function ki(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 Kh(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=Je(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=Je(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=Je(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=ke(e.stableMs,"stableMs",o=>Number.isInteger(o)&&o>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=ke(e.changeThreshold,"changeThreshold",o=>o>=0&&o<=1,"between 0 and 1")),e.regions&&typeof e.regions=="object"){let o={...n.regions??{}};for(let[s,i]of Object.entries(e.regions)){if(!Ru.test(s))throw new Error(`region name "${s}" must be lowercase letters, digits, - or _`);i===null?delete o[s]:o[s]=ki(i)}n.regions=o}if(e.buffer&&typeof e.buffer=="object"){let o=e.buffer,s={...n.buffer??{}};"enabled"in o&&(s.enabled=!!o.enabled),"seconds"in o&&(s.seconds=ke(o.seconds,"buffer.seconds",i=>i>0&&i<=120,"above 0 and at most 120")),"fps"in o&&(s.fps=ke(o.fps,"buffer.fps",i=>i>0&&i<=10,"above 0 and at most 10")),"maxPixels"in o&&(s.maxPixels=Je(o.maxPixels,"buffer.maxPixels")),"region"in o&&(s.region=String(o.region).trim()),n.buffer=s}let r=n.buffer?.region;if(r!==void 0&&!xi.includes(r)&&!n.regions?.[r])try{ki(r)}catch{throw new Error(`buffer.region "${r}" is not a region \u2014 use ${[...xi,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Dr as a,Cu as b,Yt as c,sc as d,ic as e,mm as f,fm as g,hm as h,wm as i,xm as j,km as k,ls as l,cs as m,vm as n,Xe as o,Em as p,$m as q,X as r,ds as s,A as t,Pu as u,gs as v,Cm as w,Lm as x,fs as y,Pm as z,hs as A,Mm as B,he as C,Nc as D,Fm as E,Um as F,ys as G,Ju as H,Zi as I,rp as J,Yr as K,N as L,ju as M,Bu as N,pp as O,Ne as P,gp as Q,Br as R,Ku as S,G as T,jp as U,fo as V,yo as W,Mc as X,jm as Y,Fc as Z,Bm as _,qm as $,Qt as aa,xs as ba,Xm as ca,en as da,jc as ea,Bc as fa,Ym as ga,Pa as ha,Ma as ia,Hp as ja,Vp as ka,Ha as la,Gp as ma,As as na,Zm as oa,Qp as pa,Zp as qa,os as ra,jt as sa,Ql as ta,R as ua,js as va,Cf as wa,Nf as xa,$d as ya,Mf as za,zs as Aa,Ff as Ba,Uf as Ca,Vf as Da,Ld as Ea,Md as Fa,Xf as Ga,tg as Ha,ng as Ia,rg as Ja,og as Ka,sg as La,ig as Ma,ag as Na,lg as Oa,dg as Pa,ug as Qa,mg as Ra,fg as Sa,hg as Ta,wg as Ua,xg as Va,kg as Wa,vg as Xa,Sg as Ya,Eg as Za,_g as _a,Og as $a,Dt as ab,Lg as bb,Pg as cb,me as db,fe as eb,qd as fb,th as gb,nh as hb,rh as ib,oh as jb,un as kb,sh as lb,Ot as mb,Lt as nb,Be as ob,xl as pb,vl as qb,jg as rb,Mt as sb,Ft as tb,Sl as ub,El as vb,qo as wb,zo as xb,Bg as yb,Tl as zb,qg as Ab,Ll as Bb,Fl as Cb,Ut as Db,Wl as Eb,Ko as Fb,z as Gb,oi as Hb,si as Ib,ii as Jb,gn as Kb,uh as Lb,Qd as Mb,li as Nb,ci as Ob,vh as Pb,Sh as Qb,mu as Rb,Eh as Sb,ui as Tb,Qo as Ub,Rh as Vb,xu as Wb,Dh as Xb,Ch as Yb,qe as Zb,om as _b,Kt as $b,um as ac,Ph as bc,Mh as cc,Fh as dc,Uh as ec,Wh as fc,jh as gc,Bh as hc,qh as ic,Hh as jc,yi as kc,wi as lc,zh as mc,xi as nc,Kh as oc};
|
|
969
|
-
//# sourceMappingURL=chunk-
|
|
969
|
+
//# sourceMappingURL=chunk-YRBJ4KB7.js.map
|