agentix-cli 0.187.0 → 0.188.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-WIHCYMHM.js → App-TX7LI6KT.js} +2 -2
- package/dist/{ChatApp-V3UASKNG.js → ChatApp-EJ4HFEMK.js} +2 -2
- package/dist/{absorb-eval-EAGXITJH.js → absorb-eval-VQPH6GEL.js} +2 -2
- package/dist/{adapter-7IDPCEJ7.js → adapter-DOGVLK3V.js} +2 -2
- package/dist/{agent-H75SWYT6.js → agent-HXMOUQ34.js} +2 -2
- package/dist/{board-dashboard-IUIXTKCG.js → board-dashboard-7EU5WG4C.js} +334 -327
- package/dist/board-dashboard-7EU5WG4C.js.map +1 -0
- package/dist/{chunk-FJMTCU4S.js → chunk-2G2QFSFG.js} +2 -2
- package/dist/{chunk-MYFTR4NH.js → chunk-3DUXFU35.js} +2 -2
- package/dist/{chunk-4HYIERJ4.js → chunk-3TMNWRDV.js} +2 -2
- package/dist/{chunk-A4PW7EIK.js → chunk-6HL5SXWI.js} +2 -2
- package/dist/{chunk-LR4QUAJT.js → chunk-7BHYORYO.js} +2 -2
- package/dist/{chunk-UASRZKZQ.js → chunk-7ZBRCRQL.js} +5 -5
- package/dist/{chunk-NBWSZ53L.js → chunk-AKXVFCGZ.js} +2 -2
- package/dist/{chunk-BITVUKT7.js → chunk-ARPMEYAH.js} +2 -2
- package/dist/{chunk-XCDN62CQ.js → chunk-BAFE33EX.js} +2 -2
- package/dist/{chunk-GSQ2RCOZ.js → chunk-BEJJADMD.js} +2 -2
- package/dist/{chunk-ZFMNH47D.js → chunk-BHAC2CFX.js} +3 -3
- package/dist/chunk-BHAC2CFX.js.map +1 -0
- package/dist/{chunk-OJ53ATNN.js → chunk-DE7GI62O.js} +2 -2
- package/dist/{chunk-RTIGD4NG.js → chunk-EVF6ER6O.js} +2 -2
- package/dist/{chunk-PN42ECV3.js → chunk-IPC3DD7K.js} +2 -2
- package/dist/{chunk-V4IOGISL.js → chunk-JFPBBLFG.js} +2 -2
- package/dist/{chunk-ZRC2ZHHE.js → chunk-KTAVI47Q.js} +2 -2
- package/dist/{chunk-R2KSORSK.js → chunk-MKKNFUXP.js} +2 -2
- package/dist/{chunk-YTS54UZ5.js → chunk-MNXG6R2J.js} +2 -2
- package/dist/{chunk-7EMPPP3E.js → chunk-MUNNOE5V.js} +2 -2
- package/dist/{chunk-2V6ZGE74.js → chunk-N3YNBFSU.js} +2 -2
- package/dist/{chunk-SVZZUZ3K.js → chunk-ONQVHC5P.js} +250 -250
- package/dist/chunk-ONQVHC5P.js.map +1 -0
- package/dist/chunk-OTRWL5YQ.js +112 -0
- package/dist/chunk-OTRWL5YQ.js.map +1 -0
- package/dist/{chunk-2GIYVYIM.js → chunk-PAXQYM4E.js} +2 -2
- package/dist/{chunk-NHW4IY6N.js → chunk-PWKSA4NM.js} +2 -2
- package/dist/{chunk-V6QFBL6F.js → chunk-QNDCZLTP.js} +3 -3
- package/dist/{chunk-2LTZUZJU.js → chunk-SWSBKCFH.js} +2 -2
- package/dist/{chunk-NS2HSAHF.js → chunk-T4UW3PJG.js} +2 -2
- package/dist/{chunk-56F5UTTA.js → chunk-WB2NS2XC.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-57TCFIV5.js → client-TRY2JBXV.js} +2 -2
- package/dist/{config-RHCIE7VE.js → config-TRQM7YIS.js} +2 -2
- package/dist/{config-mutate-HCYXR2WP.js → config-mutate-JY7YREIC.js} +2 -2
- package/dist/config-mutator-7PFJYQR5.js +2 -0
- package/dist/{contributions-R4HXLJXU.js → contributions-VCUTJ55I.js} +2 -2
- package/dist/{doctor-NPHNPYHR.js → doctor-QYEW3VAN.js} +2 -2
- package/dist/{follow-up-tool-MC4TBGLP.js → follow-up-tool-JCOV7J7F.js} +2 -2
- package/dist/{hub-HXVIO4U5.js → hub-TMMQVLKT.js} +2 -2
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/{program-K7IWAPAJ.js → program-PY3QQUNQ.js} +110 -110
- package/dist/{program-K7IWAPAJ.js.map → program-PY3QQUNQ.js.map} +1 -1
- package/dist/{promote-D24WO52J.js → promote-G6HCAXBM.js} +2 -2
- package/dist/{query-J5NRZZUQ.js → query-DJHRLQPO.js} +2 -2
- package/dist/{query-settings-NT6ACLQY.js → query-settings-ZRUX4KFX.js} +2 -2
- package/dist/{registry-SBIZVSQV.js → registry-2ZDQB6OB.js} +2 -2
- package/dist/{request-planner-2CVL22EB.js → request-planner-P7LA3Y3G.js} +2 -2
- package/dist/{review-candidates-MMNDJOTD.js → review-candidates-N476JBOT.js} +2 -2
- package/dist/{routing-KRST324W.js → routing-KE6HJUXN.js} +2 -2
- package/dist/schedule-tool-CUT4S7D7.js +2 -0
- package/dist/{scheduler-GCCE4FQP.js → scheduler-4G55ZZVP.js} +2 -2
- package/dist/{seat-E6F56TUM.js → seat-P5AHZ552.js} +2 -2
- package/dist/{select-D2VUSUCJ.js → select-AMHQBDNY.js} +2 -2
- package/dist/{set-enabled-GBI7JREU.js → set-enabled-RPQVY3WC.js} +2 -2
- package/dist/{sprint-tool-HZ24VIC2.js → sprint-tool-V6CC54SR.js} +2 -2
- package/dist/{tool-QLQEYQYM.js → tool-C24RZAGA.js} +2 -2
- package/dist/{tool-7BEFI5SJ.js → tool-SIDS4E4E.js} +2 -2
- package/dist/{tool-OXZ4TQBG.js → tool-XXIBUQ6F.js} +2 -2
- package/dist/{wiki-RFDU6SVD.js → wiki-6ALVJE7O.js} +2 -2
- package/dist/wiki-enrich-H5NOCWM2.js +2 -0
- package/package.json +1 -1
- package/dist/board-dashboard-IUIXTKCG.js.map +0 -1
- package/dist/chunk-BZJF7DJR.js +0 -107
- package/dist/chunk-BZJF7DJR.js.map +0 -1
- package/dist/chunk-SVZZUZ3K.js.map +0 -1
- package/dist/chunk-ZFMNH47D.js.map +0 -1
- package/dist/config-mutator-JQ2R4J5Z.js +0 -2
- package/dist/schedule-tool-KOFUKVX5.js +0 -2
- package/dist/wiki-enrich-LDI67VQU.js +0 -2
- /package/dist/{App-WIHCYMHM.js.map → App-TX7LI6KT.js.map} +0 -0
- /package/dist/{ChatApp-V3UASKNG.js.map → ChatApp-EJ4HFEMK.js.map} +0 -0
- /package/dist/{absorb-eval-EAGXITJH.js.map → absorb-eval-VQPH6GEL.js.map} +0 -0
- /package/dist/{adapter-7IDPCEJ7.js.map → adapter-DOGVLK3V.js.map} +0 -0
- /package/dist/{agent-H75SWYT6.js.map → agent-HXMOUQ34.js.map} +0 -0
- /package/dist/{chunk-FJMTCU4S.js.map → chunk-2G2QFSFG.js.map} +0 -0
- /package/dist/{chunk-MYFTR4NH.js.map → chunk-3DUXFU35.js.map} +0 -0
- /package/dist/{chunk-4HYIERJ4.js.map → chunk-3TMNWRDV.js.map} +0 -0
- /package/dist/{chunk-A4PW7EIK.js.map → chunk-6HL5SXWI.js.map} +0 -0
- /package/dist/{chunk-LR4QUAJT.js.map → chunk-7BHYORYO.js.map} +0 -0
- /package/dist/{chunk-UASRZKZQ.js.map → chunk-7ZBRCRQL.js.map} +0 -0
- /package/dist/{chunk-NBWSZ53L.js.map → chunk-AKXVFCGZ.js.map} +0 -0
- /package/dist/{chunk-BITVUKT7.js.map → chunk-ARPMEYAH.js.map} +0 -0
- /package/dist/{chunk-XCDN62CQ.js.map → chunk-BAFE33EX.js.map} +0 -0
- /package/dist/{chunk-GSQ2RCOZ.js.map → chunk-BEJJADMD.js.map} +0 -0
- /package/dist/{chunk-OJ53ATNN.js.map → chunk-DE7GI62O.js.map} +0 -0
- /package/dist/{chunk-RTIGD4NG.js.map → chunk-EVF6ER6O.js.map} +0 -0
- /package/dist/{chunk-PN42ECV3.js.map → chunk-IPC3DD7K.js.map} +0 -0
- /package/dist/{chunk-V4IOGISL.js.map → chunk-JFPBBLFG.js.map} +0 -0
- /package/dist/{chunk-ZRC2ZHHE.js.map → chunk-KTAVI47Q.js.map} +0 -0
- /package/dist/{chunk-R2KSORSK.js.map → chunk-MKKNFUXP.js.map} +0 -0
- /package/dist/{chunk-YTS54UZ5.js.map → chunk-MNXG6R2J.js.map} +0 -0
- /package/dist/{chunk-7EMPPP3E.js.map → chunk-MUNNOE5V.js.map} +0 -0
- /package/dist/{chunk-2V6ZGE74.js.map → chunk-N3YNBFSU.js.map} +0 -0
- /package/dist/{chunk-2GIYVYIM.js.map → chunk-PAXQYM4E.js.map} +0 -0
- /package/dist/{chunk-NHW4IY6N.js.map → chunk-PWKSA4NM.js.map} +0 -0
- /package/dist/{chunk-V6QFBL6F.js.map → chunk-QNDCZLTP.js.map} +0 -0
- /package/dist/{chunk-2LTZUZJU.js.map → chunk-SWSBKCFH.js.map} +0 -0
- /package/dist/{chunk-NS2HSAHF.js.map → chunk-T4UW3PJG.js.map} +0 -0
- /package/dist/{chunk-56F5UTTA.js.map → chunk-WB2NS2XC.js.map} +0 -0
- /package/dist/{client-57TCFIV5.js.map → client-TRY2JBXV.js.map} +0 -0
- /package/dist/{config-RHCIE7VE.js.map → config-TRQM7YIS.js.map} +0 -0
- /package/dist/{config-mutate-HCYXR2WP.js.map → config-mutate-JY7YREIC.js.map} +0 -0
- /package/dist/{config-mutator-JQ2R4J5Z.js.map → config-mutator-7PFJYQR5.js.map} +0 -0
- /package/dist/{contributions-R4HXLJXU.js.map → contributions-VCUTJ55I.js.map} +0 -0
- /package/dist/{doctor-NPHNPYHR.js.map → doctor-QYEW3VAN.js.map} +0 -0
- /package/dist/{follow-up-tool-MC4TBGLP.js.map → follow-up-tool-JCOV7J7F.js.map} +0 -0
- /package/dist/{hub-HXVIO4U5.js.map → hub-TMMQVLKT.js.map} +0 -0
- /package/dist/{promote-D24WO52J.js.map → promote-G6HCAXBM.js.map} +0 -0
- /package/dist/{query-J5NRZZUQ.js.map → query-DJHRLQPO.js.map} +0 -0
- /package/dist/{query-settings-NT6ACLQY.js.map → query-settings-ZRUX4KFX.js.map} +0 -0
- /package/dist/{registry-SBIZVSQV.js.map → registry-2ZDQB6OB.js.map} +0 -0
- /package/dist/{request-planner-2CVL22EB.js.map → request-planner-P7LA3Y3G.js.map} +0 -0
- /package/dist/{review-candidates-MMNDJOTD.js.map → review-candidates-N476JBOT.js.map} +0 -0
- /package/dist/{routing-KRST324W.js.map → routing-KE6HJUXN.js.map} +0 -0
- /package/dist/{schedule-tool-KOFUKVX5.js.map → schedule-tool-CUT4S7D7.js.map} +0 -0
- /package/dist/{scheduler-GCCE4FQP.js.map → scheduler-4G55ZZVP.js.map} +0 -0
- /package/dist/{seat-E6F56TUM.js.map → seat-P5AHZ552.js.map} +0 -0
- /package/dist/{select-D2VUSUCJ.js.map → select-AMHQBDNY.js.map} +0 -0
- /package/dist/{set-enabled-GBI7JREU.js.map → set-enabled-RPQVY3WC.js.map} +0 -0
- /package/dist/{sprint-tool-HZ24VIC2.js.map → sprint-tool-V6CC54SR.js.map} +0 -0
- /package/dist/{tool-QLQEYQYM.js.map → tool-C24RZAGA.js.map} +0 -0
- /package/dist/{tool-7BEFI5SJ.js.map → tool-SIDS4E4E.js.map} +0 -0
- /package/dist/{tool-OXZ4TQBG.js.map → tool-XXIBUQ6F.js.map} +0 -0
- /package/dist/{wiki-RFDU6SVD.js.map → wiki-6ALVJE7O.js.map} +0 -0
- /package/dist/{wiki-enrich-LDI67VQU.js.map → wiki-enrich-H5NOCWM2.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ge,b as k,c as D,d as Xe,e as ge,f as ue,g as j,h as me,i as N,j as L,n as Ve,o as Qe,p as Ze,q as ea}from"./chunk-EFGAPAYZ.js";import{e as Ye,i as Je}from"./chunk-QAWKN2N4.js";import{b as xe}from"./chunk-DODL5POT.js";import{a as Q,b as Ke}from"./chunk-
|
|
1
|
+
import{a as Ge,b as k,c as D,d as Xe,e as ge,f as ue,g as j,h as me,i as N,j as L,n as Ve,o as Qe,p as Ze,q as ea}from"./chunk-EFGAPAYZ.js";import{e as Ye,i as Je}from"./chunk-QAWKN2N4.js";import{b as xe}from"./chunk-DODL5POT.js";import{a as Q,b as Ke}from"./chunk-6HL5SXWI.js";import{Ia as We,Ja as Be,Ka as Ue,Ma as Fe,ja as _,oa as Le,wb as qe}from"./chunk-BHAC2CFX.js";import{a as X}from"./chunk-IMLAPB7G.js";import{b as V}from"./chunk-2VDO2HEK.js";import{c as Me,e as He}from"./chunk-LQE73AZR.js";import{b as Ne}from"./chunk-MRIVENBY.js";import{q as pe,s as je}from"./chunk-XPZSEDE3.js";import{ga as G}from"./chunk-PAXQYM4E.js";import{a as q,b as J}from"./chunk-T4UW3PJG.js";import{a as De}from"./chunk-2G2QFSFG.js";import{c as Ee,d as Re}from"./chunk-OWNQ2FD4.js";import{a as Oe}from"./chunk-ROLSSYXE.js";import{a as Pe}from"./chunk-QUFIUXMQ.js";import{Gb as ce,Ta as Ie,_a as Va,ea as de,fa as Te,pa as Xa,tb as le,wb as F,xb as ze}from"./chunk-OTRWL5YQ.js";import{existsSync as K,readFileSync as da,writeFileSync as la,appendFileSync as lt,mkdirSync as ct}from"fs";import{dirname as pt,resolve as M}from"path";import{fileURLToPath as xt}from"url";import{hostname as gt}from"os";import{spawn as ut}from"child_process";var fe=`:root {
|
|
2
2
|
/* --- Brand (agentina) --------------------------------------------- */
|
|
3
3
|
--ax-blue: #2979FF;
|
|
4
4
|
--ax-blue-d: #1B5FD9;
|
|
@@ -2900,4 +2900,4 @@ ${a}=${t}
|
|
|
2900
2900
|
WHERE person = ? AND state IN (${t.map(()=>"?").join(",")})
|
|
2901
2901
|
${r}`).all(a,...t,...n).map(i=>({id:i.id,state:i.state,channel:i.channel,agentId:i.agent_id,text:i.text,createdAt:i.created_at})):[]}function Zo(e,a){return Wa(e,a,de,"ORDER BY created_at")}function ei(e,a,t=50){return Wa(e,a,[...de,...Te],"ORDER BY created_at DESC, rowid DESC LIMIT ?",Math.max(1,Math.min(t,500)))}Va();var Ce="member:",mr=90,fr="members",hr="tailscale-user-login",br=400,vr=60*60*1e3;function wr(e){let a=e.scopes.find(t=>t.startsWith(Ce));return a?a.slice(Ce.length):null}function Ua(e,a){if(!e)return null;let t=a.verify(e),r=t?wr(t):null;return t&&r?{rec:t,personId:r}:null}function si(e,a){let t=e.people().find(s=>s.id===a);if(!t)return{ok:!1,error:`No person "${a}". Add them first: agentx people add ${a} --name "\u2026"`};let{token:r,record:n}=e.tokens.create({name:`${t.name} (machine not paired yet)`,scopes:[`${Ce}${t.id}`],expiresInDays:mr}),{code:o,expiresAt:i}=e.codes.create({token:r,tokenId:n.id,name:t.id});return e.members.log({person:t.id,device:n.id,event:"invited"}),{ok:!0,code:o,expiresAt:i,tokenId:n.id,person:t}}var yr=Math.round(Me/6e4);function kr(e){return e==="client"?"Your project":"My work"}function di(e){let a=kr(e.person.role),t=e.person.role==="client"?`I use AgentX to keep track of the work I do for you. It has a page for you, "${a}": what you asked us for, and where each request stands.`:`I use AgentX to give our AI agents their jobs. It has a page for you, "${a}": what you asked the agents for, and where each request stands.`;return[`Hi ${e.person.name},`,"",t,"","To open it:","1. Accept the Tailscale share I sent you. Tailscale is a small program that connects your computer to mine, privately.",`2. Open ${e.origin.replace(/\/+$/,"")}/member in Edge or Chrome, give your computer a name and type this code: ${He(e.code)}`,` The code works once, for ${yr} minutes. If it has stopped working, tell me and I will send you a new one.`,"","I then approve your machine, and the page opens by itself."].join(`
|
|
2902
2902
|
`)}var _r="The private network says someone else is connecting from this machine. Ask the person who invited you for a new code.",$r="Too many machines are waiting for the owner's answer. Try again later.",Ba="That code didn't work. Check it, or ask the person who invited you for a new one.",Fa=(e,a)=>{let t=e.headers[a];return(Array.isArray(t)?t[0]:t||"").trim()};function qa(e){let a=e.socket?.remoteAddress||"";return a==="127.0.0.1"||a==="::1"||a==="::ffff:127.0.0.1"}function Sr(e){if(!qa(e))return null;let a=Fa(e,hr).toLowerCase();return a?a.slice(0,80):null}function Ar(e){let a=e.socket?.remoteAddress||"unknown";if(!qa(e))return a;let t=Fa(e,"x-forwarded-for").split(",").pop().trim();return/^[0-9a-fA-F:.]{2,45}$/.test(t)?t:a}function Cr(e){return typeof e=="string"?e.replace(/[^\p{L}\p{N} ._'()-]/gu," ").replace(/\s+/g," ").trim().slice(0,60):""}function Tr(e){return e.identities.map(Ie).filter(a=>!!a&&a.channel==="tailscale").map(a=>a.value)}async function li(e,a){let t=Date.now(),r=a.now??Date.now,n=a.log??(b=>console.log(b)),o=Ar(e),i=a.limiter.retryAfter(o);if(i>0)return n(`[member] pair-code refused from ${o}: locked out for ${i}s more`),{status:429,body:{error:"too many attempts",retryAfter:i},retryAfter:i};let s=null,d="";try{let b=await V(e,2048);s=b.code,d=Cr(b.machine)}catch{}let l=a.codes.redeem(s),c=l?Ua(l.token,a.tokens):null;if(await zr(t,a.minMs??br),!l||!c)return a.limiter.fail(o),n(`[member] pair-code failed from ${o}`),{status:401,body:{error:Ba}};a.limiter.succeed(o);let{rec:m,personId:g}=c,u=a.people().find(b=>b.id===g);if(!u)return a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:"person no longer listed"}),n(`[member] pair-code for ${g} refused from ${o}: person no longer listed`),{status:403,body:{error:Ba}};let x=Sr(e),f=Tr(u);if(f.length&&(!x||!f.includes(x)))return a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:`network login ${x??"missing"}; expected ${f.join(" or ")}`}),n(`[member] ${g}: pairing from ${o} refused: the network says "${x??"nobody"}", expected ${f.join(" or ")}`),{status:403,body:{error:_r}};let C=d||"Unnamed machine",w=u.name.slice(0,40),v=je(a.root,{title:`New machine for ${w}`,ask:`From ${o}, ${x?`network login ${x}`:"no network login reported"}. Machine name, as typed there: "${C}". Let it see ${w}'s own work?`,recommend:`Yes if ${w} told you they just paired this machine. No if you did not expect it.`,if_silent:"discard",raised_by:fr},{now:r()});return v.ok?(a.members.add({tokenId:m.id,personId:g,name:C,state:"pending",cardId:v.card.id,address:o,...x?{network:x}:{},createdAt:new Date(r()).toISOString()}),a.members.log({person:g,device:m.id,event:"paired",address:o,detail:C}),n(`[member] ${g} paired "${C}" from ${o}; waiting for the owner (card ${v.card.id})`),{status:200,body:{person:g,name:C,state:"pending"},token:l.token}):(a.tokens.revoke(m.id),a.members.log({person:g,device:m.id,event:"refused",address:o,detail:v.error}),n(`[member] ${g}: pairing from ${o} refused: ${v.error}`),{status:503,body:{error:$r}})}var se="this machine is not paired",Ir="waiting for the owner to approve this machine";function Ka(e){return e?e.status==="decided"?e.verdict??null:e.status==="expired"?"no":null:null}function ci(e,a){return a.state==="pending"&&a.cardId?Ka(pe(e,a.cardId)):null}function pi(e,a,t){let r=a.now??Date.now,n=a.log??(c=>console.log(c)),o=Ua(e,a.tokens);if(!o)return{ok:!1,status:401,error:se};let{rec:i,personId:s}=o,d=a.members.byToken(i.id);if(!d||d.state==="removed"||d.personId!==s)return{ok:!1,status:401,error:se};if(a.people&&!a.people().some(c=>c.id===s))return Ya(a,i.id,"person no longer listed"),n(`[member] ${s}: "${d.name}" ended: person no longer listed`),{ok:!1,status:401,error:se};if(d.state==="pending"){let c=d.cardId?pe(a.root,d.cardId):null,m=Ka(c);if(m==="yes")d=a.members.update(i.id,{state:"active",approvedAt:new Date(r()).toISOString()})??d,a.members.log({person:s,device:i.id,event:"approved",detail:c?.decided_by}),n(`[member] ${s}: "${d.name}" approved`);else if(m==="no"){let g=c?.status==="expired"?"the owner did not answer in time":"the owner said no";return a.tokens.revoke(i.id),a.members.update(i.id,{state:"removed",removedAt:new Date(r()).toISOString(),removedReason:g}),a.members.log({person:s,device:i.id,event:"refused",detail:g}),n(`[member] ${s}: "${d.name}" refused: ${g}`),{ok:!1,status:401,error:se}}else return{ok:!1,status:403,error:Ir,waiting:!0}}let l=d.lastSeenAt?Date.parse(d.lastSeenAt):0;return t&&(r()-l>=vr||d.lastAddress!==t)&&(d=a.members.update(i.id,{lastSeenAt:new Date(r()).toISOString(),lastAddress:t})??d,a.members.log({person:s,device:i.id,event:"signed-in",address:t})),{ok:!0,device:d,personId:s,rec:i}}function Ya(e,a,t="removed by the owner"){let r=e.members.byToken(a);if(!r)return null;e.tokens.revoke(a);let n=e.members.update(a,{state:"removed",removedAt:new Date((e.now??Date.now)()).toISOString(),removedReason:t});return e.members.log({person:r.personId,device:a,event:"removed",detail:t}),n}function xi(e,a){return e.members.devices(a).filter(t=>t.state!=="removed").map(t=>Ya(e,t.tokenId,"person removed by the owner")).filter(t=>!!t)}async function zr(e,a){let t=e+a-Date.now();t>0&&await new Promise(r=>setTimeout(r,t))}var Ja=["gitlab","github"];function Pr(e,a,t){let r=String(a||"").trim().toLowerCase();if(!Ja.includes(r))throw new Error(`Request status works on ${Ja.join(" and ")}, not on "${a}".`);e.requestStatus=e.requestStatus&&typeof e.requestStatus=="object"?e.requestStatus:{};let n=Array.isArray(e.requestStatus.channels)?e.requestStatus.channels.map(o=>String(o).toLowerCase()):[];return e.requestStatus.channels=t?[...new Set([...n,r])]:n.filter(o=>o!==r),`request status on ${r} is ${t?"on":"off"}`}function mi(e){return Array.isArray(e?.requestStatus?.channels)?e.requestStatus.channels.map(a=>String(a).toLowerCase()):[]}function fi(e){let{summary:a}=Q(t=>Pr(t,e?.channel,!!e?.enabled));return{summary:a}}var bi="https://myaccount.google.com/apppasswords";function vi(e){let a=e.split("@")[1]?.toLowerCase()??"";if(a==="gmail.com"||a==="googlemail.com")return{imapHost:"imap.gmail.com",imapPort:993,smtpHost:"smtp.gmail.com",smtpPort:465}}function wi(e){let a=e.user&&e.user!==e.address?{user:e.user}:{};return{agent:e.agent,address:e.address,imap:{host:e.imapHost,port:e.imapPort,secure:e.imapPort===993,...a,password:`\${${e.passwordEnv}}`},smtp:{host:e.smtpHost,port:e.smtpPort,secure:e.smtpPort===465},allowFrom:e.allowFrom,send:e.send}}function yi(e){return`EMAIL_${e.toUpperCase().replace(/[^A-Z0-9]/g,"_")}_PASSWORD`}function _i(e){return new Set(Object.entries(e).filter(([,a])=>a?.wiki?.absorb?.enabled===!1).map(([a])=>a))}function $i(e,a){return a.only?{agents:[a.only],skipped:[]}:{agents:e.filter(t=>!a.off.has(t)),skipped:e.filter(t=>a.off.has(t))}}function Si(e,a){return`absorb is off for this agent (agents.${e}.wiki.absorb.enabled); skipped.${e===a?" It reads the wiki notes inbox, so the inbox was not read.":""} Use --agent ${e} to run it anyway.`}function Ai(e,a){if(a){if(!e.wiki?.absorb)return;delete e.wiki.absorb.enabled,Object.keys(e.wiki.absorb).length===0&&delete e.wiki.absorb,Object.keys(e.wiki).length===0&&delete e.wiki;return}e.wiki??={},e.wiki.absorb??={},e.wiki.absorb.enabled=!1}var Er="https://ntfy.sh";function Ti(e){return{enabled:!!e?.enabled,server:e?.server||Er,topicSet:!!e?.topic,tokenSet:!!e?.token}}function Ii(e,a){let t={...e??{}};if("enabled"in a&&(t.enabled=!!a.enabled),"server"in a){let r=String(a.server).trim().replace(/\/+$/,"");if(!/^https?:\/\/\S+$/.test(r))throw new Error("ntfy server must be an http(s) URL");t.server=r}if("topic"in a){let r=String(a.topic).trim();if(!r)throw new Error("ntfy topic cannot be empty");t.topic=r}if("token"in a){let r=String(a.token??"").trim();r?t.token=r:delete t.token}if(t.enabled&&!t.topic)throw new Error("set a topic before enabling ntfy");return t}export{fe as a,na as b,be as c,Za as d,et as e,at as f,tt as g,rt as h,nt as i,ot as j,it as k,ca as l,mt as m,yn as n,kn as o,_n as p,vo as q,dr as r,_o as s,Co as t,La as u,Jo as v,Go as w,zn as x,Pn as y,It as z,Et as A,ve as B,En as C,Rn as D,Rt as E,Nn as F,Ln as G,Wn as H,Qo as I,Zo as J,ei as K,mr as L,si as M,yr as N,kr as O,di as P,Ar as Q,li as R,ci as S,pi as T,Ya as U,xi as V,Ja as W,Pr as X,mi as Y,fi as Z,bi as _,vi as $,wi as aa,yi as ba,_i as ca,$i as da,Si as ea,Ai as fa,Ti as ga,Ii as ha,Qt as ia,co as ja,fo as ka,ho as la};
|
|
2903
|
-
//# sourceMappingURL=chunk-
|
|
2903
|
+
//# sourceMappingURL=chunk-BAFE33EX.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{Gb as b,xb as m}from"./chunk-
|
|
1
|
+
import{Gb as b,xb as m}from"./chunk-OTRWL5YQ.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-BEJJADMD.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as ze}from"./chunk-GTJIKXDB.js";import{C as Fn,J as Gn,k as U}from"./chunk-
|
|
1
|
+
import{a as ze}from"./chunk-GTJIKXDB.js";import{C as Fn,J as Gn,k as U}from"./chunk-KTAVI47Q.js";import{f as Hn,g as zn,h as Xn,k as Kn}from"./chunk-PWKSA4NM.js";import{b as Wn}from"./chunk-2VDO2HEK.js";import{a as jn,i as qn,l as Bn,n as Ve,o as He,q as Y,r as B,t as Vn}from"./chunk-XPZSEDE3.js";import{t as Mn,u as Un}from"./chunk-N3YNBFSU.js";import{d as Pn,e as On}from"./chunk-AQASR6KR.js";import{a as kn,b as vn,d as Sn,e as $n}from"./chunk-MNG2AMKZ.js";import{h as J,j as _n,l as En,m as An,n as Rn}from"./chunk-RX5O5637.js";import{a as In,c as Tn,e as Dn,f as We,h as Cn,j as Nn,k as Ln,l as je,m as qe,n as Be}from"./chunk-5ELIX7BQ.js";import{h as hn,i as bn,j as yn,l as wn,m as xn}from"./chunk-JFPBBLFG.js";import{a as fn,c as mn}from"./chunk-KP7KDLZ2.js";import{Aa as Ue,Ca as Fe,b as Pe,s as Oe,u as Me,xa as gn,za as de}from"./chunk-PAXQYM4E.js";import{r as pn}from"./chunk-EVF6ER6O.js";import{a as dn,b as ce,e as un}from"./chunk-T4UW3PJG.js";import{a as cn}from"./chunk-QUFIUXMQ.js";import{A as Ss,Gb as ln,d as De,f as Zt,j as vs,la as tn,ma as nn,nb as Le,oa as rn,pa as on,wb as sn,x as le,xb as an,y as Qt,z as en}from"./chunk-OTRWL5YQ.js";import{a as Ce,h as $s}from"./chunk-VJ5HC63R.js";import{j as Ne,r as _s}from"./chunk-UEEB3UTU.js";import{existsSync as Es,readdirSync as As,readFileSync as Rs,statSync as Is}from"fs";import{resolve as Ts}from"path";function Jn(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)??[],l=a.filter(f=>n-f.at<=o),c=a.filter(f=>n-f.at>o&&n-f.at<=o*2),d=l.filter(f=>f.status==="failed").length,u=a.filter(f=>f.status==="paused").length,p=a.length?Math.max(...a.map(f=>f.at)):null,g=a.length?c.length>0&&l.length===0?"dormant":l.length>0&&d*2>=l.length?"failing":l.length>0?"active":"quiet":"never";return{id:i.id,name:i.name||i.id,state:g,lastRunAt:p,recent:l.length,prior:c.length,failed:d,paused:u}}).sort((i,a)=>{let l={dormant:0,failing:1,active:2,quiet:3,never:4};return l[i.state]-l[a.state]||(a.lastRunAt??0)-(i.lastRunAt??0)})}var ue=new Map;function ad(t,e=1e3){if(!Es(t))return[];let n=As(t).filter(s=>s.endsWith(".jsonl")).map(s=>{let i=Ts(t,s);return{path:i,mtime:Is(i).mtimeMs}}).sort((s,i)=>i.mtime-s.mtime).slice(0,e),r=new Set(n.map(s=>s.path));for(let s of ue.keys())r.has(s)||ue.delete(s);let o=[];for(let{path:s,mtime:i}of n){let a=ue.get(s);if(a&&a.mtime===i){a.summary&&o.push(a.summary);continue}let l=Ds(s,i);ue.set(s,{mtime:i,summary:l}),l&&o.push(l)}return o}function Ds(t,e){try{let n=Rs(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]),l=a.status??a.run?.status;if(l){s=l;break}}return{workflowId:o,status:s,at:e}}catch{return null}}var Yn=7,Cs={failStreak:3,disabledDays:30,missedFires:2,graceMs:15*6e4},k={routines:200,summary:160,filters:6,filterValue:60,text:120},Ns=(t,e,n)=>{try{return pn(t,e,n)}catch{return null}},Zn=864e5;function ud(t){let e=t.now??Date.now(),n={...Cs,...t.thresholds},r=t.nextFire??Ns,o=[];for(let a of t.crons){let l=t.cronRuns.get(a.id)??[],c=a.timezone||"UTC",d=l.map(g=>({at:Date.parse(g.startedAt),status:g.status})),u=l[0],p={id:`cron:${a.id}`,source:"cron",kind:"schedule",name:T(a.id,k.text),trigger:{schedule:T(a.schedule,k.text),timezone:c},agent:a.agent||null,enabled:a.enabled,state:a.enabled?"enabled":"disabled",nextRunAt:a.enabled?Xe(a.nextRun)??Xe(r(a.schedule,new Date(e),c)):null,lastRun:u?{at:u.startedAt,status:u.status,summary:Fs(u.status==="success"?void 0:u.errorSummary,k.summary)}:null,lastSuccessAt:l.find(g=>g.status==="success")?.startedAt??null,consecutiveFailures:Qn(d),sampledRuns:l.length,flags:[],attention:null,recent:l.slice(0,Yn).map(g=>({at:g.startedAt,status:g.status}))};p.flags=er(p,d,a.schedule,c,null,e,n,r),o.push(tr(p))}let s=new Map(Jn(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 l=i.get(a.workflowId);l?l.push(a):i.set(a.workflowId,[a])}for(let a of t.workflows){let l=a.nodes.find(x=>x.type.startsWith("trigger."));if(!l||l.type!=="trigger.cron"&&l.type!=="trigger.hook")continue;let c=l.config??{},d=a.state||"active",u=d==="active",p=(i.get(a.id)??[]).slice().sort((x,Te)=>Te.at-x.at),g=p.map(x=>({at:x.at,status:Os(x.status)})),f=g[0],m=l.type==="trigger.cron",b=typeof c.spec=="string"?c.spec:"",$=typeof c.timezone=="string"?c.timezone:"UTC",q={id:`workflow:${a.id}`,source:"workflow",kind:m?"schedule":"event",name:T(a.title||a.id,k.text),trigger:m?{schedule:T(b,k.text),timezone:$}:{event:T(typeof c.event=="string"?c.event:"",k.text),filters:Us(c.filter,a)},agent:Ms(a),enabled:u,state:d,nextRunAt:m&&u&&b?Xe(r(b,new Date(e),$)):null,lastRun:f?{at:new Date(f.at).toISOString(),status:f.status}:null,lastSuccessAt:(()=>{let x=g.find(Te=>Te.status==="success");return x?new Date(x.at).toISOString():null})(),consecutiveFailures:Qn(g),sampledRuns:p.length,flags:[],attention:null,recent:g.slice(0,Yn).map(x=>({at:new Date(x.at).toISOString(),status:x.status}))},ae=Date.parse(a.updated||a.created||"");q.flags=m?er(q,g,b,$,Number.isFinite(ae)?ae:null,e,n,r):Ls(q,s.get(a.id)?.state==="dormant",Number.isFinite(ae)?ae:null,e,n),o.push(tr(q))}return o.sort(Ps).slice(0,k.routines)}function Qn(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 er(t,e,n,r,o,s,i,a){let l=[],c=e.length?e[0].at:null;if(!t.enabled){let p=rr(c,o,s,i);return p&&l.push(p),l}if(t.consecutiveFailures>=i.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 d=new Date(c),u=null;for(let p=0;p<i.missedFires&&(u=a(n,d,r),!!u);p++)d=u;return u&&s>u.getTime()+i.graceMs&&l.push({reason:"overdue",detail:`No attempt since ${new Date(c).toISOString()}; ${i.missedFires} scheduled fires missed`}),l}function Ls(t,e,n,r,o){let s=[],i=t.lastRun?Date.parse(t.lastRun.at):null;if(!t.enabled){let a=rr(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 rr(t,e,n,r){let o=Math.max(t??0,e??0);return o&&n-o<r.disabledDays*Zn?null:{reason:"disabled-long",detail:o?`Disabled; no activity for ${Math.floor((n-o)/Zn)} days`:"Disabled and never ran"}}function tr(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 nr={critical:0,warning:1,info:2};function Ps(t,e){let n=t.attention?nr[t.attention]:3,r=e.attention?nr[e.attention]:3;return n-r||Number(e.enabled)-Number(t.enabled)||t.name.localeCompare(e.name)}function Os(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 Ms(t){if(t.ownerAgent)return T(t.ownerAgent,k.text);let e=t.nodes.find(n=>n.type==="agent"&&typeof n.config?.agentId=="string"&&n.config.agentId);return e?T(String(e.config.agentId),k.text):null}function Us(t,e){let n=[],r=e?.project;if(r&&n.push(T(`project=${r}`,k.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(T(`${o}=${i.join(",")}`,k.filterValue))}return n.slice(0,k.filters)}function Xe(t){if(!t)return null;let e=t instanceof Date?t:new Date(t);return Number.isFinite(e.getTime())?e.toISOString():null}function T(t,e){return t.length<=e?t:t.slice(0,e-3)+"..."}function Fs(t,e){return t===void 0?void 0:T(t,e)}import{mkdirSync as Ws,readFileSync as js,renameSync as qs,writeFileSync as Bs}from"fs";import{resolve as Vs}from"path";function or(t){return Vs(He(t),"_state.json")}function _(t){try{let e=JSON.parse(js(or(t),"utf-8"));return{snoozed:e&&typeof e.snoozed=="object"&&e.snoozed?e.snoozed:{},...typeof e?.lastDigest=="string"?{lastDigest:e.lastDigest}:{},...e?.popped&&typeof e.popped=="object"?{popped:e.popped}:{},...typeof e?.passAt=="string"?{passAt:e.passAt}:{},...Array.isArray(e?.wanted)?{wanted:e.wanted.filter(n=>typeof n=="string")}:{}}}catch{return{snoozed:{}}}}function Z(t,e){Ws(He(t),{recursive:!0});let n=or(t),r=`${n}.${process.pid}.tmp`;Bs(r,JSON.stringify(e,null,2)+`
|
|
3
|
-
`),qs(r,n)}function sr(t,e,n,r=Date.now()){let o=_(t),s={};for(let[i,a]of Object.entries(o.snoozed))Date.parse(a)>r&&(s[i]=a);s[e]=n.toISOString(),Z(t,{...o,snoozed:s})}function hd(t,e){Z(t,{..._(t),lastDigest:e})}function Ke(t,e,n,r=Date.now()){let o=_(t),s=new Set(n),i={};for(let[l,c]of Object.entries(o.popped??{}))s.has(l)&&(i[l]=c);i[e]=new Date(r).toISOString();let a=(o.wanted??[]).filter(l=>l!==e&&s.has(l));Z(t,{...o,popped:i,wanted:a})}function ir(t,e){let n=_(t);Z(t,{...n,wanted:[...(n.wanted??[]).filter(r=>r!==e),e]})}function bd(t,e=Date.now()){Z(t,{..._(t),popped:{},passAt:new Date(e).toISOString()})}import{existsSync as Hs,readFileSync as zs}from"fs";ln();$s();function ar(t){let e=dn(t),n={};if(Hs(e))try{n=sn(JSON.parse(zs(e,"utf-8")))}catch{n={}}let r=Le.safeParse(n?.requests);return r.success?r.data:Le.parse(void 0)}async function Sd(t,e={}){let n=(t.channels??[]).filter(r=>!Ce.has(r.toLowerCase().split("@")[0]));return n.length?{success:!1,error:`unknown channel ${n.map(r=>`"${r}"`).join(", ")}: use ${[...Ce].join(", ")}`}:ce(r=>{let o=r.requests??={};for(let s of["enabled","channels","from","staleAfterHours","retentionDays","settleHandedBack"])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.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 Q,readdirSync as fi,readFileSync as Qe}from"fs";import{dirname as mi,resolve as E}from"path";import{randomBytes as dr}from"crypto";import{existsSync as Ks,mkdirSync as Gs,readdirSync as Js,readFileSync as Ys,renameSync as ur,unlinkSync as Zs,writeFileSync as Qs}from"fs";import{resolve as pr}from"path";function lr(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var Xs=t=>t.trim().split(`
|
|
3
|
+
`),qs(r,n)}function sr(t,e,n,r=Date.now()){let o=_(t),s={};for(let[i,a]of Object.entries(o.snoozed))Date.parse(a)>r&&(s[i]=a);s[e]=n.toISOString(),Z(t,{...o,snoozed:s})}function hd(t,e){Z(t,{..._(t),lastDigest:e})}function Ke(t,e,n,r=Date.now()){let o=_(t),s=new Set(n),i={};for(let[l,c]of Object.entries(o.popped??{}))s.has(l)&&(i[l]=c);i[e]=new Date(r).toISOString();let a=(o.wanted??[]).filter(l=>l!==e&&s.has(l));Z(t,{...o,popped:i,wanted:a})}function ir(t,e){let n=_(t);Z(t,{...n,wanted:[...(n.wanted??[]).filter(r=>r!==e),e]})}function bd(t,e=Date.now()){Z(t,{..._(t),popped:{},passAt:new Date(e).toISOString()})}import{existsSync as Hs,readFileSync as zs}from"fs";ln();$s();function ar(t){let e=dn(t),n={};if(Hs(e))try{n=sn(JSON.parse(zs(e,"utf-8")))}catch{n={}}let r=Le.safeParse(n?.requests);return r.success?r.data:Le.parse(void 0)}async function Sd(t,e={}){let n=(t.channels??[]).filter(r=>!Ce.has(r.toLowerCase().split("@")[0]));return n.length?{success:!1,error:`unknown channel ${n.map(r=>`"${r}"`).join(", ")}: use ${[...Ce].join(", ")}`}:ce(r=>{let o=r.requests??={};for(let s of["enabled","channels","from","staleAfterHours","retentionDays","settleHandedBack","homeCloses"])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.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 Q,readdirSync as fi,readFileSync as Qe}from"fs";import{dirname as mi,resolve as E}from"path";import{randomBytes as dr}from"crypto";import{existsSync as Ks,mkdirSync as Gs,readdirSync as Js,readFileSync as Ys,renameSync as ur,unlinkSync as Zs,writeFileSync as Qs}from"fs";import{resolve as pr}from"path";function lr(t){return[...t.account?["--account",t.account]:[],...t.store?["--store",t.store]:[]]}var Xs=t=>t.trim().split(`
|
|
4
4
|
`).pop()?.slice(0,300)||"no output";async function cr(t,e,n,r=ze){let o=await r(t.bin,[...lr(t),"send","text","--to",e,"--message",n,"--no-preview"],{timeoutMs:6e4});return o.code===0?{ok:!0}:{ok:!1,error:`wacli send failed: ${Xs(o.stderr||o.stdout)}`}}async function Ed(t,e,n,r,o=ze){return(await o(t.bin,[...lr(t),"--read-only","media","download","--chat",e,"--id",n,"--output",r],{timeoutMs:12e4})).code===0}var ei=2e3,ti=t=>cr(t.wacli,t.to,t.text);function Ge(t){return pr(t,".agentx","whatsapp-triage","drafts")}var ni=t=>/^[a-z0-9-]{8,64}$/.test(t),pe=(t,e)=>pr(Ge(t),`${e}.json`);function gr(t,e){Gs(Ge(t),{recursive:!0});let n=pe(t,e.id),r=`${n}.${process.pid}.tmp`;Qs(r,JSON.stringify(e,null,2)+`
|
|
5
5
|
`,{mode:384}),ur(r,n)}function Cd(t,e,n=Date.now()){let r=e.text.trim().slice(0,ei);if(!r)throw new Error("empty draft");let o={...e,text:r,id:`${n.toString(36)}-${dr(4).toString("hex")}`,status:"pending",created_at:new Date(n).toISOString()};return gr(t,o),o}function ge(t,e){if(!ni(e))return null;try{return JSON.parse(Ys(pe(t,e),"utf-8"))}catch{return null}}function fr(t,e){let n=Ge(t);return Ks(n)?Js(n).filter(r=>r.endsWith(".json")).map(r=>ge(t,r.slice(0,-5))).filter(r=>!!r&&(!e||r.status===e)).sort((r,o)=>r.created_at.localeCompare(o.created_at)):[]}async function mr(t,e,n,r={}){let o=ge(t,e);if(!o||o.status!=="pending")return{ok:!1,error:`no reply draft "${e}" is waiting`};let s=`${pe(t,e)}.${process.pid}.${dr(3).toString("hex")}.claim`;try{ur(pe(t,e),s)}catch{return{ok:!1,error:`reply draft "${e}" is already being decided`}}let i={...o,decided_by:r.by??"operator",decided_at:new Date(r.now??Date.now()).toISOString()};if(n==="no")i.status="rejected";else{let a=await(r.send??ti)(o).catch(l=>({ok:!1,error:String(l?.message??l)}));a.ok?i.status="sent":(i.status="failed",i.error=a.error)}gr(t,i);try{Zs(s)}catch{}return i.status==="failed"?{ok:!1,error:i.error??"send failed"}:{ok:!0,draft:i}}import{mkdirSync as oi,writeFileSync as si}from"fs";import{resolve as br}from"path";function Je(t,e,n,r){let o=t.agents?.[e];if(!o)return null;let s=o.integrations;if(!Array.isArray(s))return null;let i=s.find(a=>a.enabled!==!1&&a.kind===n&&(!r||a.label===r));return i?{agentId:e,integration:i}:null}function ri(t,e){let r=(t.credentials??{})[e];if(!r)return{status:"no-credential",reason:`integration "${t.label}" has no ${String(e)} configured`};if(e==="auth"&&r==="keyring")return{status:"ok"};if(typeof r=="string"&&/^[A-Z][A-Z0-9_]*$/.test(r)){let o=process.env[r];return o?{status:"ok",value:o,envVar:r}:{status:"env-unset",envVar:r,reason:`env var ${r} is unset (declared by integration "${t.label}")`}}return typeof r=="string"?{status:"ok",value:r}:{status:"no-credential",reason:`unrecognized credential ref shape for ${String(e)}`}}function Ld(t,e,n,r,o){let s=Je(t,e,n,o);return s?ri(s.integration,r):{status:"kind-not-found",reason:`agent "${e}" has no integration of kind "${n}"${o?` with label "${o}"`:""}`}}var yr="ready",ii="202510";function ai(t){let e=t.date??t.created_at.slice(0,10);return br(t.workspace,yr,`${e}-${t.platform}-${t.id}.txt`)}function hr(t){let e=ai(t);return oi(br(t.workspace,yr),{recursive:!0}),si(e,t.text.endsWith(`
|
|
6
6
|
`)?t.text:`${t.text}
|
|
@@ -885,4 +885,4 @@ Document the arguments, commands, or files the skill expects. Example:
|
|
|
885
885
|
claude-code ${Yt(t)} --arg value
|
|
886
886
|
\`\`\`
|
|
887
887
|
`}ln();var ys={maxPixels:12e5,timeoutMs:5e3,intervalMs:100,changeThreshold:.015,stableMs:400,regions:{},buffer:{enabled:!1,seconds:10,fps:2,region:"screen",maxPixels:3e5}};function ws(t){return{...ys,...t??{},regions:{...t?.regions??{}},buffer:{...ys.buffer,...t?.buffer??{}}}}function Xf(t){try{return ws(an(t).screen)}catch{return ws(void 0)}}var od=/^[a-z][\w-]*$/,xs=["window","screen","menubar","notifications"];function ie(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 Ie=(t,e)=>ie(t,e,n=>Number.isInteger(n)&&n>0,"a whole number above 0");function ks(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 Kf(t,e){let n={...t??{}};if("maxPixels"in e&&(n.maxPixels=Ie(e.maxPixels,"maxPixels")),"timeoutMs"in e&&(n.timeoutMs=Ie(e.timeoutMs,"timeoutMs")),"intervalMs"in e&&(n.intervalMs=Ie(e.intervalMs,"intervalMs")),"stableMs"in e&&(n.stableMs=ie(e.stableMs,"stableMs",o=>Number.isInteger(o)&&o>=0,"a whole number, 0 or more")),"changeThreshold"in e&&(n.changeThreshold=ie(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(!od.test(s))throw new Error(`region name "${s}" must be lowercase letters, digits, - or _`);i===null?delete o[s]:o[s]=ks(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=ie(o.seconds,"buffer.seconds",i=>i>0&&i<=120,"above 0 and at most 120")),"fps"in o&&(s.fps=ie(o.fps,"buffer.fps",i=>i>0&&i<=10,"above 0 and at most 10")),"maxPixels"in o&&(s.maxPixels=Ie(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&&!xs.includes(r)&&!n.regions?.[r])try{ks(r)}catch{throw new Error(`buffer.region "${r}" is not a region \u2014 use ${[...xs,...Object.keys(n.regions??{})].join(", ")}, or x,y,w,h`)}return n}export{Jn as a,ad as b,It as c,Ya as d,Za as e,Lp as f,Pp as g,Op as h,Fp as i,Wp as j,jp as k,yo as l,wo as m,qp as n,xo as o,Vp as p,zp as q,O as r,ko as s,k as t,ud as u,$o as v,Zp as w,tg as x,Eo as y,ng as z,Ao as A,rg as B,ne as C,_l as D,og as E,sg as F,Io as G,Ed as H,ti as I,Cd as J,mr as K,Ld as L,_ as M,hd as N,bd as O,qd as P,fe as Q,Bd as R,ar as S,Sd as T,F as U,gu as V,Rr as W,Tr as X,Ci as Y,Ni as Z,hu as _,bu as $,Wi as aa,ku as ba,Do as ca,lg as da,$u as ea,_u as fa,fo as ga,xt as ha,Va as ia,v as ja,Vo as ka,Fg as la,Wg as ma,dc as na,Vg as oa,Jo as pa,Hg as qa,zg as ra,Zg as sa,kc as ta,Qg as ua,Au as va,Ru as wa,Iu as xa,Tu as ya,Du as za,Cu as Aa,Lu as Ba,Pu as Ca,Uu as Da,Fu as Ea,Wu as Fa,qu as Ga,Bu as Ha,Vu as Ia,Hu as Ja,zu as Ka,Xu as La,Ku as Ma,rp as Na,ut as Oa,op as Pa,sp as Qa,ee as Ra,te as Sa,Ac as Ta,cf as Ua,df as Va,uf as Wa,pf as Xa,Ft as Ya,gf as Za,ft as _a,mt as $a,ve as ab,ha as bb,ya as cb,dp as db,bt as eb,yt as fb,wa as gb,xa as hb,no as ib,io as jb,up as kb,Sa as lb,pp as mb,Da as nb,La as ob,wt as pb,Oa as qb,ao as rb,M as sb,as as tb,ls as ub,cs as vb,jt as wb,wf as xb,Oc as yb,us as zb,ps as Ab,Tf as Bb,Df as Cb,Zc as Db,Cf as Eb,fs as Fb,Se as Gb,$p as Hb,At as Ib,Dp as Jb,Of as Kb,Mf as Lb,Uf as Mb,Ff as Nb,Wf as Ob,jf as Pb,qf as Qb,Bf as Rb,Vf as Sb,ys as Tb,ws as Ub,Xf as Vb,xs as Wb,Kf as Xb};
|
|
888
|
-
//# sourceMappingURL=chunk-
|
|
888
|
+
//# sourceMappingURL=chunk-BHAC2CFX.js.map
|