agentix-cli 0.197.0 → 0.199.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/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +7 -2
- package/apps/mac-voice/Sources/AgentXVoice/AnswerView.swift +19 -8
- package/apps/mac-voice/Sources/AgentXVoice/Artifacts.swift +54 -0
- package/apps/mac-voice/Sources/AgentXVoice/Markdown.swift +3 -0
- package/apps/mac-voice/Sources/AgentXVoice/PanelAnswer.swift +3 -2
- package/apps/mac-voice/Sources/AgentXVoice/main.swift +7 -7
- package/dist/{App-GF6MCNH6.js → App-HGCD735J.js} +2 -2
- package/dist/{ChatApp-FO2JNLWI.js → ChatApp-VVBGBDKU.js} +2 -2
- package/dist/{absorb-eval-7KMQJ5BR.js → absorb-eval-2XT7XBH7.js} +2 -2
- package/dist/{adapter-V7DQXCII.js → adapter-ZGEMORWD.js} +2 -2
- package/dist/{agent-PJBGUZMR.js → agent-4IF72I6E.js} +2 -2
- package/dist/{board-dashboard-M3RVQM7K.js → board-dashboard-2P77CUM3.js} +481 -336
- package/dist/board-dashboard-2P77CUM3.js.map +1 -0
- package/dist/chunk-2P5NP4H6.js +2 -0
- package/dist/{chunk-B3JQ5J47.js.map → chunk-2P5NP4H6.js.map} +1 -1
- package/dist/{chunk-4O6ZFYWT.js → chunk-3DAHVUJH.js} +2 -2
- package/dist/{chunk-K3623S4U.js → chunk-3DX7CKKW.js} +2 -2
- package/dist/{chunk-J7PZJRYO.js → chunk-3Q6MRG3P.js} +2 -2
- package/dist/{chunk-HIHROVHC.js → chunk-3SWDVBGA.js} +2 -2
- package/dist/{chunk-7MW44Y5O.js → chunk-5NE26NUO.js} +9 -9
- package/dist/{chunk-7MW44Y5O.js.map → chunk-5NE26NUO.js.map} +1 -1
- package/dist/{chunk-WFPLZLCF.js → chunk-5QK3U7R6.js} +2 -2
- package/dist/{chunk-RC3QYH2J.js → chunk-5VRN6JP7.js} +2 -2
- package/dist/{chunk-DHD4KUTW.js → chunk-6QU5YWOE.js} +2 -2
- package/dist/{chunk-424CABZF.js → chunk-7SKUXUIX.js} +26 -26
- package/dist/chunk-7SKUXUIX.js.map +1 -0
- package/dist/chunk-B4KQC3DG.js +4 -0
- package/dist/chunk-B4KQC3DG.js.map +1 -0
- package/dist/{chunk-R3TH2OG7.js → chunk-BBXB7X25.js} +2 -2
- package/dist/chunk-DECMCWGN.js +3 -0
- package/dist/{chunk-BY5CN7C7.js.map → chunk-DECMCWGN.js.map} +1 -1
- package/dist/{chunk-HOL645BZ.js → chunk-DUVPXHDO.js} +2 -2
- package/dist/{chunk-KB5JMDGS.js → chunk-F6UAAQSU.js} +2 -2
- package/dist/{chunk-IOCULCCJ.js → chunk-I4U2ELEX.js} +2 -2
- package/dist/{chunk-TKXZHRV3.js → chunk-JAS75QDT.js} +2 -2
- package/dist/chunk-K2JE5XR4.js +934 -0
- package/dist/chunk-K2JE5XR4.js.map +1 -0
- package/dist/{chunk-RLI32DLG.js → chunk-K3QWXVLV.js} +2 -2
- package/dist/{chunk-BN5JVELZ.js → chunk-KWU4EOWC.js} +2 -2
- package/dist/{chunk-425HPUKF.js → chunk-L3FCDIJT.js} +2 -2
- package/dist/{chunk-QABY3WEM.js → chunk-OCZVJANH.js} +2 -2
- package/dist/{chunk-SK7M6PS6.js → chunk-OWL6JA6W.js} +2 -2
- package/dist/{chunk-OXTFAV2A.js → chunk-RE6N3TRQ.js} +2 -2
- package/dist/{chunk-IQQ3I6R7.js → chunk-SPZXOCN5.js} +294 -294
- package/dist/chunk-SPZXOCN5.js.map +1 -0
- package/dist/{chunk-HUOR3FGJ.js → chunk-T7HWU7O4.js} +2 -2
- package/dist/chunk-UPRACUXY.js +118 -0
- package/dist/chunk-UPRACUXY.js.map +1 -0
- package/dist/{chunk-TBS7OVMI.js → chunk-UU7A5DNY.js} +2 -2
- package/dist/{chunk-3LMBT5LK.js → chunk-UY25GSQ3.js} +2 -2
- package/dist/{chunk-OVB3LW6L.js → chunk-XTBFWRM3.js} +2 -2
- package/dist/{chunk-3K3IBV5K.js → chunk-XZFBOXFK.js} +2 -2
- package/dist/chunk-YSCT6DPR.js +2 -0
- package/dist/chunk-YSCT6DPR.js.map +1 -0
- package/dist/{chunk-35GSB7SK.js → chunk-YU2JJIQH.js} +3 -3
- package/dist/cli.js +1 -1
- package/dist/client-PNZ3LL72.js +2 -0
- package/dist/config-HOKADOXX.js +2 -0
- package/dist/config-mutate-ZR7EM4IB.js +2 -0
- package/dist/config-mutator-NWTMXBEY.js +2 -0
- package/dist/{contributions-2HR5ZGMK.js → contributions-NBKZD7QW.js} +2 -2
- package/dist/{doctor-VMWX6GKN.js → doctor-K6SPV3GU.js} +2 -2
- package/dist/{follow-up-tool-BCSCBKVL.js → follow-up-tool-NPC3JLOA.js} +2 -2
- package/dist/hub-NKGZO574.js +2 -0
- package/dist/index.d.ts +197 -91
- package/dist/index.js +1 -1
- package/dist/ntfy-LSFROBMD.js +2 -0
- package/dist/{program-MOVUJBAA.js → program-DYFXKKJE.js} +243 -242
- package/dist/program-DYFXKKJE.js.map +1 -0
- package/dist/{promote-WWPXP5Z4.js → promote-HIFKFRC4.js} +2 -2
- package/dist/{push-E5YKRFAW.js → push-VMY34YND.js} +2 -2
- package/dist/push-bridge-T5HZZRA2.js +2 -0
- package/dist/{query-F7HRTCWI.js → query-VXE4AREX.js} +2 -2
- package/dist/{query-settings-Z32LXLJI.js → query-settings-NC7FOIRC.js} +2 -2
- package/dist/{registry-D5HHCFCC.js → registry-NGRLHM7L.js} +2 -2
- package/dist/{request-planner-4FSNZJVQ.js → request-planner-I65SRAJI.js} +2 -2
- package/dist/{review-candidates-U2DOD5Z3.js → review-candidates-7KV34XZR.js} +2 -2
- package/dist/{routing-USMMBJYT.js → routing-MLOSXPVH.js} +2 -2
- package/dist/schedule-tool-7DCB7KJP.js +2 -0
- package/dist/scheduler-WEOQLNIF.js +2 -0
- package/dist/{seat-3LW672DM.js → seat-66LQTUIR.js} +2 -2
- package/dist/{select-MPMJSYKX.js → select-JV425OUL.js} +2 -2
- package/dist/{set-enabled-TQXG3MSQ.js → set-enabled-DWL2MKVS.js} +2 -2
- package/dist/{sprint-tool-JQ5KCJDP.js → sprint-tool-CDO3HLLT.js} +2 -2
- package/dist/{tool-ZP3SZKYR.js → tool-7EFJJM2A.js} +2 -2
- package/dist/{tool-DHCKG3SK.js → tool-U3WQCSUN.js} +2 -2
- package/dist/{tool-D4DHXF4Z.js → tool-W763BDXL.js} +2 -2
- package/dist/wiki-MIEXBQ5H.js +2 -0
- package/dist/wiki-enrich-K4HHTRZN.js +2 -0
- package/package.json +1 -1
- package/dist/board-dashboard-M3RVQM7K.js.map +0 -1
- package/dist/chunk-27ICCQVL.js +0 -934
- package/dist/chunk-27ICCQVL.js.map +0 -1
- package/dist/chunk-424CABZF.js.map +0 -1
- package/dist/chunk-B3JQ5J47.js +0 -2
- package/dist/chunk-BMNDAEF4.js +0 -2
- package/dist/chunk-BMNDAEF4.js.map +0 -1
- package/dist/chunk-BY5CN7C7.js +0 -3
- package/dist/chunk-I22ZKW7Q.js +0 -4
- package/dist/chunk-I22ZKW7Q.js.map +0 -1
- package/dist/chunk-IQQ3I6R7.js.map +0 -1
- package/dist/chunk-SNYAM7YB.js +0 -116
- package/dist/chunk-SNYAM7YB.js.map +0 -1
- package/dist/client-ZHE4B2DD.js +0 -2
- package/dist/config-THBWCNN7.js +0 -2
- package/dist/config-mutate-FBX6TFCY.js +0 -2
- package/dist/config-mutator-33RBNPV4.js +0 -2
- package/dist/hub-WPC6MTZY.js +0 -2
- package/dist/ntfy-73UW6GHN.js +0 -2
- package/dist/program-MOVUJBAA.js.map +0 -1
- package/dist/push-bridge-RV3CBTYO.js +0 -2
- package/dist/schedule-tool-IRTB23XL.js +0 -2
- package/dist/scheduler-L4ERAOMG.js +0 -2
- package/dist/wiki-CRH6XAXE.js +0 -2
- package/dist/wiki-enrich-YZEW6RZT.js +0 -2
- /package/dist/{App-GF6MCNH6.js.map → App-HGCD735J.js.map} +0 -0
- /package/dist/{ChatApp-FO2JNLWI.js.map → ChatApp-VVBGBDKU.js.map} +0 -0
- /package/dist/{absorb-eval-7KMQJ5BR.js.map → absorb-eval-2XT7XBH7.js.map} +0 -0
- /package/dist/{adapter-V7DQXCII.js.map → adapter-ZGEMORWD.js.map} +0 -0
- /package/dist/{agent-PJBGUZMR.js.map → agent-4IF72I6E.js.map} +0 -0
- /package/dist/{chunk-4O6ZFYWT.js.map → chunk-3DAHVUJH.js.map} +0 -0
- /package/dist/{chunk-K3623S4U.js.map → chunk-3DX7CKKW.js.map} +0 -0
- /package/dist/{chunk-J7PZJRYO.js.map → chunk-3Q6MRG3P.js.map} +0 -0
- /package/dist/{chunk-HIHROVHC.js.map → chunk-3SWDVBGA.js.map} +0 -0
- /package/dist/{chunk-WFPLZLCF.js.map → chunk-5QK3U7R6.js.map} +0 -0
- /package/dist/{chunk-RC3QYH2J.js.map → chunk-5VRN6JP7.js.map} +0 -0
- /package/dist/{chunk-DHD4KUTW.js.map → chunk-6QU5YWOE.js.map} +0 -0
- /package/dist/{chunk-R3TH2OG7.js.map → chunk-BBXB7X25.js.map} +0 -0
- /package/dist/{chunk-HOL645BZ.js.map → chunk-DUVPXHDO.js.map} +0 -0
- /package/dist/{chunk-KB5JMDGS.js.map → chunk-F6UAAQSU.js.map} +0 -0
- /package/dist/{chunk-IOCULCCJ.js.map → chunk-I4U2ELEX.js.map} +0 -0
- /package/dist/{chunk-TKXZHRV3.js.map → chunk-JAS75QDT.js.map} +0 -0
- /package/dist/{chunk-RLI32DLG.js.map → chunk-K3QWXVLV.js.map} +0 -0
- /package/dist/{chunk-BN5JVELZ.js.map → chunk-KWU4EOWC.js.map} +0 -0
- /package/dist/{chunk-425HPUKF.js.map → chunk-L3FCDIJT.js.map} +0 -0
- /package/dist/{chunk-QABY3WEM.js.map → chunk-OCZVJANH.js.map} +0 -0
- /package/dist/{chunk-SK7M6PS6.js.map → chunk-OWL6JA6W.js.map} +0 -0
- /package/dist/{chunk-OXTFAV2A.js.map → chunk-RE6N3TRQ.js.map} +0 -0
- /package/dist/{chunk-HUOR3FGJ.js.map → chunk-T7HWU7O4.js.map} +0 -0
- /package/dist/{chunk-TBS7OVMI.js.map → chunk-UU7A5DNY.js.map} +0 -0
- /package/dist/{chunk-3LMBT5LK.js.map → chunk-UY25GSQ3.js.map} +0 -0
- /package/dist/{chunk-OVB3LW6L.js.map → chunk-XTBFWRM3.js.map} +0 -0
- /package/dist/{chunk-3K3IBV5K.js.map → chunk-XZFBOXFK.js.map} +0 -0
- /package/dist/{chunk-35GSB7SK.js.map → chunk-YU2JJIQH.js.map} +0 -0
- /package/dist/{client-ZHE4B2DD.js.map → client-PNZ3LL72.js.map} +0 -0
- /package/dist/{config-THBWCNN7.js.map → config-HOKADOXX.js.map} +0 -0
- /package/dist/{config-mutate-FBX6TFCY.js.map → config-mutate-ZR7EM4IB.js.map} +0 -0
- /package/dist/{config-mutator-33RBNPV4.js.map → config-mutator-NWTMXBEY.js.map} +0 -0
- /package/dist/{contributions-2HR5ZGMK.js.map → contributions-NBKZD7QW.js.map} +0 -0
- /package/dist/{doctor-VMWX6GKN.js.map → doctor-K6SPV3GU.js.map} +0 -0
- /package/dist/{follow-up-tool-BCSCBKVL.js.map → follow-up-tool-NPC3JLOA.js.map} +0 -0
- /package/dist/{hub-WPC6MTZY.js.map → hub-NKGZO574.js.map} +0 -0
- /package/dist/{ntfy-73UW6GHN.js.map → ntfy-LSFROBMD.js.map} +0 -0
- /package/dist/{promote-WWPXP5Z4.js.map → promote-HIFKFRC4.js.map} +0 -0
- /package/dist/{push-E5YKRFAW.js.map → push-VMY34YND.js.map} +0 -0
- /package/dist/{push-bridge-RV3CBTYO.js.map → push-bridge-T5HZZRA2.js.map} +0 -0
- /package/dist/{query-F7HRTCWI.js.map → query-VXE4AREX.js.map} +0 -0
- /package/dist/{query-settings-Z32LXLJI.js.map → query-settings-NC7FOIRC.js.map} +0 -0
- /package/dist/{registry-D5HHCFCC.js.map → registry-NGRLHM7L.js.map} +0 -0
- /package/dist/{request-planner-4FSNZJVQ.js.map → request-planner-I65SRAJI.js.map} +0 -0
- /package/dist/{review-candidates-U2DOD5Z3.js.map → review-candidates-7KV34XZR.js.map} +0 -0
- /package/dist/{routing-USMMBJYT.js.map → routing-MLOSXPVH.js.map} +0 -0
- /package/dist/{schedule-tool-IRTB23XL.js.map → schedule-tool-7DCB7KJP.js.map} +0 -0
- /package/dist/{scheduler-L4ERAOMG.js.map → scheduler-WEOQLNIF.js.map} +0 -0
- /package/dist/{seat-3LW672DM.js.map → seat-66LQTUIR.js.map} +0 -0
- /package/dist/{select-MPMJSYKX.js.map → select-JV425OUL.js.map} +0 -0
- /package/dist/{set-enabled-TQXG3MSQ.js.map → set-enabled-DWL2MKVS.js.map} +0 -0
- /package/dist/{sprint-tool-JQ5KCJDP.js.map → sprint-tool-CDO3HLLT.js.map} +0 -0
- /package/dist/{tool-ZP3SZKYR.js.map → tool-7EFJJM2A.js.map} +0 -0
- /package/dist/{tool-DHCKG3SK.js.map → tool-U3WQCSUN.js.map} +0 -0
- /package/dist/{tool-D4DHXF4Z.js.map → tool-W763BDXL.js.map} +0 -0
- /package/dist/{wiki-CRH6XAXE.js.map → wiki-MIEXBQ5H.js.map} +0 -0
- /package/dist/{wiki-enrich-YZEW6RZT.js.map → wiki-enrich-K4HHTRZN.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as pe}from"./chunk-7AB3QUGH.js";import{a as Ct}from"./chunk-GV7S5BAX.js";import{c as Ft}from"./chunk-SZDACK6O.js";import{b as Le}from"./chunk-AFRHKA7B.js";import{b as Ht,c as Bt}from"./chunk-VJVXEVZ7.js";import{b as jt,
|
|
1
|
+
import{a as pe}from"./chunk-7AB3QUGH.js";import{a as Ct}from"./chunk-GV7S5BAX.js";import{c as Ft}from"./chunk-SZDACK6O.js";import{b as Le}from"./chunk-AFRHKA7B.js";import{b as Ht,c as Bt}from"./chunk-VJVXEVZ7.js";import{b as jt,f as Mt,g as Et,j as _t,l as Lt,m as Ut,s as Kt}from"./chunk-5NE26NUO.js";import{b as Ot,d as Nt,e as Dt}from"./chunk-5ONH4ITT.js";import{e as Pt,g as Tt,h as Wt,i as _e}from"./chunk-JRAG37V5.js";import{y as St,z as Ir}from"./chunk-F6UAAQSU.js";import{b as $t,f as br}from"./chunk-72SZI2UW.js";import{a as te,b as xt}from"./chunk-A7JSRDJL.js";import{a as At,b as Ee,d as Ce,e as Rt,f as Fe}from"./chunk-BERWTVG2.js";import{c as It,d as vt}from"./chunk-AHWWJ7AF.js";import{ja as Me,ua as kr}from"./chunk-UPRACUXY.js";import{j as je,r as yr}from"./chunk-UEEB3UTU.js";import{existsSync as vr,mkdirSync as qt,readFileSync as $r,writeFileSync as Sr,renameSync as Ar}from"fs";import{resolve as Jt,dirname as Rr}from"path";var zt=class{filePath;log;constructor(e={}){let t=e.baseDir??Jt(process.cwd(),".agentx");this.filePath=Jt(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),qt(t,{recursive:!0})}key(e,t,r){return`${e}::${t}::${r||"-"}`}load(){if(!vr(this.filePath))return{version:1,overrides:{}};try{let e=$r(this.filePath,"utf-8"),t=JSON.parse(e);return!t||typeof t!="object"?{version:1,overrides:{}}:(t.overrides||(t.overrides={}),t)}catch(e){return this.log(`load failed, starting empty: ${e?.message||e}`),{version:1,overrides:{}}}}save(e){qt(Rr(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;Sr(t,JSON.stringify(e,null,2)),Ar(t,this.filePath)}get(e,t,r){let s=this.load().overrides[this.key(e,t,r)];if(s&&!(s.expiresAt&&Date.parse(s.expiresAt)<Date.now()))return s}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),r={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(r.channel,r.chatId,r.accountId)]=r,this.save(t),r}remove(e,t,r){let o=this.load(),s=this.key(e,t,r);return s in o.overrides?(delete o.overrides[s],this.save(o),!0):!1}consumeSummary(e,t,r){let o=this.load(),s=o.overrides[this.key(e,t,r)];if(!s||!s.summary||s.summaryConsumedAt)return;let a=s.summary;return s.summaryConsumedAt=new Date().toISOString(),this.save(o),a}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(r=>!r.expiresAt||Date.parse(r.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(r=>r.toAgent===e),outgoing:t.filter(r=>r.fromAgent===e)}}};import{readFileSync as Zt,writeFileSync as Ue,appendFileSync as Wr,mkdirSync as Or,existsSync as Xt,statSync as Nr}from"fs";import{resolve as fe}from"path";var Yt="[Agent Memory \u2014 persistent facts from past conversations]",xr=2400;function Gt(n,e){return n?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function Pr(n,e=Date.now()){let t=Nt(n,e),r=n.undated?"UNVERIFIED (never checked) ":Gt(t,Pt(n.verifiedAt,e));return{line:`- [wiki ${n.id}] ${r}${n.subject} \xB7 ${n.attribute}: ${n.value} (${n.source}, checked ${n.verifiedAt.slice(0,10)} by ${n.verifiedBy})`,unverified:t}}function Tr(n,e){let r=!n.source.chatId.startsWith("-")&&/^\d+$/.test(n.source.chatId)?"DM":n.source.chatId;if(te(n.content))return{line:`- [${n.category}] ${xt}${n.content} (${r}, ${n.source.date})`,unverified:!0};let o=Wt(n,e);return{line:`- [${n.category}] ${Gt(o,Tt(n,e))}${n.content} (${r}, ${n.source.date})`,unverified:o}}function Vt(n,e=[],t=Date.now()){let r=[],o=new Set,s=Yt.length,a=!1;for(let i of n){let d=e.length>0?Dt(i.content,e):null,l,c,p=d&&Date.parse(i.createdAt)>Date.parse(d.verifiedAt)&&!i.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!p){if(o.has(d.id))continue;o.add(d.id),l=Pr(d,t),c=d.id}else l=Tr(i,t),d&&(l.line+=` [differs from wiki ${d.id}]`);let f=l.unverified&&!a?_e.length:0;if(s+f+l.line.length>xr)break;r.push({fact:i,...l,...c?{wikiRef:c}:{}}),s+=f+l.line.length,f&&(a=!0)}return r}function Qt(n){if(n.length===0)return"";let e=n.some(t=>t.unverified)?[_e]:[];return[Yt,...e,...n.map(t=>t.line),"[End Memory]"].join(`
|
|
2
2
|
`)}var en=200,Dr=7,tn=class{memoryDir;ledger;constructor(e=process.cwd()){this.memoryDir=fe(e,".agentx/memory"),this.ledger=new Ot(fe(e,".agentx/wiki")),Xt(this.memoryDir)||Or(this.memoryDir,{recursive:!0})}filePath(e){return fe(this.memoryDir,`${e}.jsonl`)}addMemory(e,t){if(t.category==="secret"||Ee(t.content)||te(t.content))return!1;let r=t.source.trust??At(t.source.channel),o=t.review??Rt(r),s={...t,source:{...t.source,trust:r},...o?{review:o}:{},id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,createdAt:new Date().toISOString()};return Wr(this.filePath(e),JSON.stringify(s)+`
|
|
3
3
|
`),!0}parsedCache=new Map;getAll(e){let t=this.filePath(e);if(!Xt(t))return[];try{let{mtimeMs:r,size:o}=Nr(t),s=this.parsedCache.get(t);if(s&&s.mtimeMs===r&&s.size===o)return s.facts.slice();let i=Zt(t,"utf-8").split(`
|
|
4
4
|
`).filter(d=>d.trim()).map(d=>{try{return JSON.parse(d)}catch{return null}}).filter(d=>d!==null);return this.parsedCache.set(t,{mtimeMs:r,size:o,facts:i}),i.slice()}catch{return[]}}findRelevant(e,t,r=8){let o=this.getAll(t).filter(Fe);if(o.length===0)return[];let s=o.map(g=>`${g.keywords.join(" ")} ${g.content}`),a=fe(this.memoryDir,`${t}_bm25_cache.json`),i=vt(s,a),d=It(e,i),l=new Map(d.map(g=>[g.docIndex,g.score])),p=o.map((g,m)=>{let y=l.get(m)??0;return g.category==="commitment"&&(y+=1),{memory:g,score:y}}).filter(g=>g.score>0);if(p.length===0)return o.slice(-r);let f=p.sort((g,m)=>m.score-g.score).slice(0,r).map(g=>g.memory);if(f.length>0)try{this.recordAccess(t,f.map(g=>g.id))}catch{}return f}buildContext(e){return Qt(this.contextLines(e))}contextFacts(e){return this.contextLines(e).map(t=>t.fact)}contextLines(e){let t=[];try{t=this.ledger.list()}catch{}return Vt(e,t)}recordAccess(e,t){if(t.length===0)return;let r=this.getAll(e),o=new Set(t),s=!1;for(let a of r)if(o.has(a.id)){a.accessCount=(a.accessCount||0)+1,a.lastAccessed=new Date().toISOString();let i=a.intervalDays||1;a.intervalDays=Math.min(i*2,30),a.nextReview=new Date(Date.now()+a.intervalDays*864e5).toISOString(),s=!0}s&&Ue(this.filePath(e),r.map(a=>JSON.stringify(a)).join(`
|
|
@@ -39,4 +39,4 @@ ${n.text}`}async function xe(n,e){let t=n.channels[e.channel],r={channel:e.chann
|
|
|
39
39
|
`).filter(Boolean),o=[];for(let s=r.length-1;s>=0&&o.length<t;s--)try{let a=JSON.parse(r[s]);(!e||a.person===e)&&o.push(a)}catch{}return o}load(){if(ht(this.file))try{let e=JSON.parse(wt(this.file,"utf-8"));if(e&&Array.isArray(e.devices))return e}catch{}return{devices:[]}}save(e){er(rr(this.file),{recursive:!0});let t=`${this.file}.${process.pid}.${sr(4).toString("hex")}.tmp`;nr(t,JSON.stringify(e,null,2)+`
|
|
40
40
|
`,{encoding:"utf-8",mode:384}),tr(t,this.file)}};import{extname as si}from"path";var ar=/<agentx-artifact>([\s\S]*?)<\/agentx-artifact>/gi,dr=/<agentx-artifact>[\s\S]*$/i;function _l(n,e=1/0,t=!1){let r=[],o=String(n??"");if(!/<agentx-artifact>/i.test(o))return{text:o,artifacts:r};let s=o.replace(ar,(a,i)=>{try{let d=JSON.parse(i.trim());if(d&&typeof d.filename=="string"&&typeof d.mime=="string"&&r.length<e){let l=d.mime,c=l.startsWith("image/")?"image":l==="application/pdf"?"pdf":l.startsWith("text/")?"text":"file";r.push({type:c,filename:d.filename,mime:l})}}catch{}return""});return{text:(t?s.replace(dr,""):s).trim(),artifacts:r}}function Ll(n,e=!1){let t=String(n??""),r=t;if(/<agentx-artifact>/i.test(t)){let o=t.replace(ar,(s,a)=>{try{let i=JSON.parse(a.trim());return i&&typeof i.filename=="string"?i.filename:""}catch{return""}});r=(e?o.replace(dr,""):o).trim()}return r.replace(/```[\s\S]*?```|`[^`\n]*`|!\[([^\]\n]*)\]\(([^)\s]+)\)/g,(o,s,a)=>s===void 0||a===void 0?o:`[${s||a}](${a})`)}var ii={".png":{mime:"image/png",kind:"image"},".jpg":{mime:"image/jpeg",kind:"image"},".jpeg":{mime:"image/jpeg",kind:"image"},".gif":{mime:"image/gif",kind:"image"},".webp":{mime:"image/webp",kind:"image"},".svg":{mime:"image/svg+xml",kind:"file"},".pdf":{mime:"application/pdf",kind:"file"},".txt":{mime:"text/plain; charset=utf-8",kind:"file"},".md":{mime:"text/markdown; charset=utf-8",kind:"file"},".csv":{mime:"text/csv; charset=utf-8",kind:"file"},".json":{mime:"application/json",kind:"file"},".mp3":{mime:"audio/mpeg",kind:"audio"},".m4a":{mime:"audio/mp4",kind:"audio"},".wav":{mime:"audio/wav",kind:"audio"},".mp4":{mime:"video/mp4",kind:"video"},".webm":{mime:"video/webm",kind:"video"}},Ul={bytes:20*1024*1024,perMessage:20,pathChars:512};function Hl(n){return ii[si(n).toLowerCase()]??null}var ai=["[Phone app: showing files]","To show the owner a file you created (a chart, a screenshot, a PDF, a recording), save or copy it into .agentx/outbox/ in your workspace and end your reply with one line per file:",'<agentx-artifact>{"filename":".agentx/outbox/<name.ext>","mime":"<mime/type>"}</agentx-artifact>',"Files outside your workspace (/tmp, your home folder) are refused. Outbox files are removed after 7 days.","The line is removed from the text. Images show in the reply, audio and video get a player, other files an Open link. Allowed: png, jpg, gif, webp, svg, pdf, txt, md, csv, json, mp3, m4a, wav, mp4, webm; up to 20 MB and 20 files per reply.","A picture already on the web can go inline as ."].join(`
|
|
41
41
|
`);function Bl(n,e,t){return n==="app"&&e&&t!==!1?ai:void 0}import{lstatSync as kt,mkdirSync as di,readdirSync as li,realpathSync as yt,unlinkSync as ui}from"fs";import{join as Ne,resolve as lr}from"path";var ur=".agentx/outbox",ci=7*24*60*60*1e3;function pi(n,e){try{let t=yt(lr(e,n)),r=Ne(t,ur);return yt(r)===r&&kt(r).isDirectory()?r:null}catch{return null}}function zl(n,e={}){let t=e.cwd??process.cwd();if(e.create!==!1)try{let o=yt(lr(t,n));kt(Ne(o,".agentx"),{throwIfNoEntry:!1})?.isSymbolicLink()||di(Ne(o,ur),{recursive:!0})}catch{return 0}let r=pi(n,t);return r?cr(r,(e.now??Date.now())-(e.maxAgeMs??ci)):0}function cr(n,e){let t=0;for(let r of li(n)){let o=Ne(n,r);try{let s=kt(o);s.isDirectory()?t+=cr(o,e):Math.max(s.mtimeMs,s.ctimeMs)<e&&(ui(o),t++)}catch{}}return t}export{zt as a,tn as b,nn as c,Wi as d,Er as e,Oi as f,Fr as g,ji as h,Mi as i,Ei as j,Ci as k,Fi as l,_i as m,Li as n,Ur as o,Ui as p,Hi as q,Ji as r,qe as s,Gr as t,zi as u,Yi as v,Vr as w,Gi as x,un as y,Zi as z,Xi as A,pn as B,fn as C,to as D,oa as E,sa as F,da as G,la as H,x as I,ne as J,S as K,ze as L,yo as M,Ve as N,L as O,Xe as P,tt as Q,pt as R,As as S,Os as T,gt as U,Eo as V,qs as W,al as X,dl as Y,ll as Z,ul as _,cl as $,Js as aa,zs as ba,pl as ca,fl as da,gl as ea,ml as fa,yl as ga,kl as ha,bl as ia,Il as ja,vl as ka,$l as la,Sl as ma,Al as na,Rl as oa,xl as pa,Pl as qa,Xs as ra,Tl as sa,Wl as ta,Ol as ua,Nl as va,ir as wa,_l as xa,Ll as ya,Ul as za,Hl as Aa,Bl as Ba,ur as Ca,zl as Da};
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-5QK3U7R6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{X as y,Z as v,da as w,ea as C,ga as E,ha as R,ia as I}from"./chunk-
|
|
1
|
+
import{X as y,Z as v,da as w,ea as C,ga as E,ha as R,ia as I}from"./chunk-UPRACUXY.js";I();v();var L=1e4,T=["issues","prs","all"],W=/^[\w.-]+(?:\/[\w.-]+)+$/,m=e=>typeof e=="string"?e.trim():"";function f(e){let t=m(e.provider).toLowerCase();if(t!=="github"&&t!=="gitlab")return"count.provider must be github or gitlab";let r=m(e.project),n=r.split("/");if(!W.test(r)||n.some(o=>o==="."||o==="..")||t==="github"&&n.length!==2)return t==="github"?'count.project must be "owner/repo"':'count.project must be "group/project"';let s=(m(e.what)||"issues").toLowerCase();if(!T.includes(s))return`count.what must be one of ${T.join(", ")}`;let i=e.max===void 0||e.max===null||e.max===""?0:Number(e.max);return!Number.isInteger(i)||i<0?"count.max must be a whole number, 0 or more":{provider:t,project:r,what:s,max:i}}function S(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let r=f(t);return typeof r=="string"?null:r}catch{return null}}var _=e=>e==="issues"?"open issues":e==="prs"?"open pull requests":"open issues and pull requests";function $(e){return`${_(e.what)} in ${e.provider} ${e.project} \u2264 ${e.max}`}async function Y(e,t){if(!t)return{verdict:"unverifiable",detail:`no ${e.provider} connector on this node`};try{let r=e.what==="all"?["issues","prs"]:[e.what],n=0;for(let i of r){let o=await t(e.provider,e.project,i);if(typeof o!="number")return{verdict:"unverifiable",detail:`${e.project}: ${o.error}`};n+=o}let s=`${n} ${_(e.what)} in ${e.project}`;return{verdict:n<=e.max?"met":"not_met",detail:s,count:n}}catch(r){return{verdict:"unverifiable",detail:`the count check failed: ${String(r?.message??r).slice(0,200)}`}}}function B(e,t=fetch){return async(r,n,s)=>{let i;if(r==="github"){let a=e.github;if(!a)return{error:"no github connector on this node (channels.github or requests.checkers.github)"};let d=encodeURIComponent(`repo:${n} is:open is:${s==="prs"?"pr":"issue"}`);i=`${a.apiUrl.replace(/\/$/,"")}/search/issues?q=${d}&per_page=1`}else{let a=e.gitlab;if(!a)return{error:"no gitlab connector on this node (channels.gitlab or requests.checkers.gitlab)"};i=`${a.url.replace(/\/$/,"")}/api/v4/projects/${encodeURIComponent(n)}/${s==="prs"?"merge_requests":"issues"}?state=opened&per_page=1`}let o;try{o=await t(i,{headers:y(r,e),signal:AbortSignal.timeout(L)})}catch(a){return{error:`could not be reached: ${String(a?.message??a).slice(0,200)}`}}if(!o.ok)return{error:o.status===404?"not found (or not visible to the connector)":`HTTP ${o.status}`};if(r==="gitlab"){let a=Number(o.headers.get("x-total"));return Number.isInteger(a)&&a>=0?a:{error:"no X-Total in the answer"}}let c=await o.json().catch(()=>null),l=Number(c?.total_count);return Number.isInteger(l)&&l>=0?l:{error:"no total_count in the answer"}}}var F=["active","done","dropped"],Q=300,A=500;function ee(e,t=w,r=Date.now()){if(e&&typeof e=="object"&&!Array.isArray(e)&&String(e.kind).trim().toLowerCase()==="count"){let s=f(e);return typeof s=="string"?s:{kind:"count",...s}}let n=C(e,t,r);return typeof n!="string"?n:/^closeWhen(\.kind)? must be/.test(n)?"check must be an object with a kind: url, issue, git-ancestor, reply or count":n.replace(/^closeWhen/,"check")}function U(e){if(!e)return null;try{if(JSON.parse(e)?.kind==="count"){let t=S(e);return t?{kind:"count",...t}:null}}catch{return null}return R(e)}function j(e){return e.kind==="count"?$(e):E(e)}function k(e){return{id:e.id,title:e.title,ownerAgent:e.owner_agent??null,state:e.state,doneWhen:e.done_when??null,check:U(e.check_spec),evidence:e.evidence??null,lastCheck:e.last_check??null,lastCheckAt:e.last_check_at??null,createdAt:e.created_at,updatedAt:e.updated_at,closedAt:e.closed_at??null}}var N=class{constructor(t){this.db=t;t.exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS goals (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
title TEXT NOT NULL,
|
|
@@ -17,4 +17,4 @@ import{X as y,Z as v,da as w,ea as C,ga as E,ha as R,ia as I}from"./chunk-SNYAM7
|
|
|
17
17
|
`)}get(t){let r=this.db.prepare("SELECT * FROM goals WHERE id = ?").get(t);return r?k(r):null}list(t=F,r=200){let n=t.map(()=>"?").join(", ");return this.db.prepare(`SELECT * FROM goals WHERE state IN (${n}) ORDER BY updated_at DESC, rowid DESC LIMIT ?`).all(...t,r).map(k)}ensure(t,r,n){return this.db.prepare("INSERT INTO goals (id, title, owner_agent, state, created_at, updated_at) VALUES (?, ?, ?, 'active', ?, ?) ON CONFLICT(id) DO NOTHING").run(t.id,t.title,r,n,n),this.get(t.id)}upsert(t,r){let n=this.get(t.id);return n?this.db.prepare("UPDATE goals SET title = ?, owner_agent = ?, done_when = ?, check_spec = ?, updated_at = ? WHERE id = ?").run(t.title||n.title,t.ownerAgent!==void 0?t.ownerAgent:n.ownerAgent,t.doneWhen!==void 0?t.doneWhen:n.doneWhen,t.check!==void 0?t.check?JSON.stringify(t.check):null:n.check?JSON.stringify(n.check):null,r,t.id):this.db.prepare("INSERT INTO goals (id, title, owner_agent, state, done_when, check_spec, created_at, updated_at) VALUES (?, ?, ?, 'active', ?, ?, ?, ?)").run(t.id,t.title,t.ownerAgent??null,t.doneWhen??null,t.check?JSON.stringify(t.check):null,r,r),this.get(t.id)}close(t,r,n,s){return this.db.prepare("UPDATE goals SET state = ?, evidence = ?, closed_at = ?, updated_at = ? WHERE id = ? AND state = 'active'").run(r,n?n.slice(0,A):null,s,s,t).changes>0}markChecked(t,r,n){this.db.prepare("UPDATE goals SET last_check = ?, last_check_at = ? WHERE id = ?").run(r.slice(0,A),n,t)}dueChecks(t){return this.db.prepare("SELECT * FROM goals WHERE state = 'active' AND check_spec IS NOT NULL AND (last_check_at IS NULL OR last_check_at <= ?) ORDER BY last_check_at ASC LIMIT 50").all(t).map(k)}};async function te(e,t,r,n,s=()=>{}){let i=[];for(let o of e.dueChecks(n-r*6e4)){let c;try{c=await t(o.check)}catch(l){c={verdict:"unverifiable",detail:String(l?.message??l)}}e.markChecked(o.id,c.detail,n),c.verdict==="met"&&e.close(o.id,"done",`check: ${c.detail}`,n)?(i.push(o.id),s(`[goals] ${o.id} done: ${c.detail}`)):c.verdict==="unverifiable"&&s(`[goals] ${o.id}: check failed: ${c.detail}`)}return i}function ne(e,t){let r=[`[Goal] ${e.title} (${e.id}): ${e.state}${e.ownerAgent?`, owner ${e.ownerAgent}`:""}.`];return e.doneWhen&&r.push(`Done when: ${e.doneWhen}`),e.check&&r.push(`Check: ${j(e.check)}${e.lastCheck?`; last seen: ${e.lastCheck}${e.lastCheckAt?` (${new Date(e.lastCheckAt).toISOString().slice(0,16).replace("T"," ")} UTC)`:""}`:""}`),t&&r.push(`Requests under it: ${t.open} open, ${t.done} done.`),r.join(`
|
|
18
18
|
`)}var g="Africa/Tunis";function b(e,t=g){let r=Object.fromEntries(new Intl.DateTimeFormat("en-GB",{timeZone:t,hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(new Date(e)).map(s=>[s.type,s.value])),n=(Number(r.hour)%24*3600+Number(r.minute)*60+Number(r.second))*1e3+e%1e3;return e-n}var M=(e,t)=>new Intl.DateTimeFormat("en-GB",{timeZone:t,hour12:!1,hour:"2-digit",minute:"2-digit"}).format(new Date(e));function q(e,t=10){let r=e.replace(/\s+/g," ").trim().split(" ");return r.slice(0,t).join(" ")+(r.length>t?" \u2026":"")}var H=new Set(["issue","idea","approval","erp","card"]);function oe(e,t={}){let r=e.map(n=>{let s=[],i=(o,c)=>{s.some(l=>l.kind===o&&l.ref===c)||s.push({kind:o,ref:c})};for(let o of n.links??[])H.has(o.kind)&&i(o.kind,o.ref);return n.home&&i(n.home.kind,n.home.link),t.hasPlan?.(n.id)&&i("plan",n.id),n.evidence&&i("evidence",n.evidence),{id:n.id,time:M(n.createdAt,t.zone??g),words:q(n.text),state:n.state,owner:n.agentId,landed:s,noHome:s.length===0&&n.state!=="declined"&&n.state!=="dropped"}});return[...r.filter(n=>n.noHome),...r.filter(n=>!n.noHome)]}var x={timeZone:g,days:7},X=90,D=5,G=120,P=(e,t)=>new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e));function Z(e,t){return{day:P(e,t),start:e,asked:0,done:0,dropped:0,moving:0,waiting:0,stuck:0,rate:null,dropReasons:[],moreReasons:0,resent:0,resentDone:0}}function ie(e,t={}){let r=t.zone??x.timeZone,n=Math.min(Math.max(Math.floor(t.days??x.days),1),X),s=t.now??Date.now(),i=[b(s,r)];for(;i.length<n;)i.unshift(b(i[0]-1,r));let o=i.map(a=>Z(a,r)),c=o.map(()=>new Map),l=0;for(let a of e.flowRows(i[0])){for(;l+1<o.length&&a.createdAt>=o[l+1].start;)l++;let d=o[l];if(d.asked++,a.state==="done")d.done++;else if(a.state==="declined"||a.state==="dropped"){d.dropped++;let p=(a.closeReason??"").replace(/\s+/g," ").trim(),u=p.length>G?`${p.slice(0,G-1)}\u2026`:p||"no reason given";c[l].set(u,(c[l].get(u)??0)+1)}else a.state==="in_progress"||a.state==="waiting_other"?d.moving++:a.state==="waiting_owner"?d.waiting++:a.state==="needs_attention"&&d.stuck++;a.resentAt!==null&&(d.resent++,a.state==="done"&&d.resentDone++)}return o.forEach((a,d)=>{a.rate=a.asked?(a.done+a.dropped)/a.asked:null;let p=[...c[d]].sort((u,h)=>h[1]-u[1]);a.dropReasons=p.slice(0,D).map(([u,h])=>({reason:u,count:h})),a.moreReasons=p.slice(D).reduce((u,[,h])=>u+h,0)}),{zone:r,days:o,today:o[o.length-1]}}var O=e=>e===null?"\u2013":`${Math.round(e*100)}%`;function ce(e){let t=e.today,r=[`Today (${t.day}, ${e.zone}): ${t.asked?`${t.done+t.dropped} of ${t.asked} closed, ${O(t.rate)}`:"nothing asked yet"}.`,` ${t.done} done, ${t.dropped} dropped, ${t.moving} moving, ${t.waiting} waiting on the owner, ${t.stuck} stuck.`+(t.resent?` ${t.resent} resent once on its own, ${t.resentDone} of them done.`:"")];if(t.dropReasons.length){r.push(" Dropped because:");for(let n of t.dropReasons)r.push(` ${n.count} \xD7 ${n.reason}`);t.moreReasons&&r.push(` ${t.moreReasons} more`)}if(e.days.length>1){r.push("","Day asked done dropped moving waiting stuck rate");for(let n of e.days){let s=[n.asked,n.done,n.dropped,n.moving,n.waiting,n.stuck].map(String);r.push(`${n.day} ${s[0].padStart(5)} ${s[1].padStart(4)} ${s[2].padStart(7)} ${s[3].padStart(6)} ${s[4].padStart(7)} ${s[5].padStart(5)} ${O(n.rate).padStart(4)}`)}}return r.join(`
|
|
19
19
|
`)}export{f as a,S as b,$ as c,Y as d,B as e,Q as f,A as g,ee as h,j as i,N as j,te as k,ne as l,b as m,oe as n,x as o,X as p,ie as q,ce as r};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-5VRN6JP7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{s as p}from"./chunk-5NE26NUO.js";import{b as i,c as u,d as l,e as c}from"./chunk-DUVPXHDO.js";import d from"cronstrue";var f=Intl.DateTimeFormat().resolvedOptions().timeZone,g=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',m=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function x(e){return m.test(e)}function w(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function S(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function $(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||f,agent:e.agent,prompt:e.prompt,timeout:e.timeout??g,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.report==="exceptions"&&(t.report="exceptions"),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){return e.deliverResult===!1?"(failures only)":e.report==="exceptions"?"(exceptions and failures)":"(results and failures)"}function T(e){try{return d.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function A(e,r,t=new Date){try{return p(e,t,r)}catch{return null}}function D(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function y(e){return e?.approval?.action==="create"}async function R(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&y(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{f as a,E as b,x as c,w as d,S as e,$ as f,P as g,T as h,A as i,D as j,y as k,R as l,I as m,O as n};
|
|
2
|
+
//# sourceMappingURL=chunk-6QU5YWOE.js.map
|