agentix-cli 0.115.0 → 0.116.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/AnswerView.swift +24 -2
- package/apps/mac-voice/Sources/AgentXVoice/ListenAgain.swift +26 -0
- package/apps/mac-voice/Sources/AgentXVoice/main.swift +54 -0
- package/dist/{App-6OMMZW2M.js → App-7Z2PWARZ.js} +2 -2
- package/dist/{ChatApp-EDDROHNA.js → ChatApp-GFAIRLGZ.js} +2 -2
- package/dist/{agent-VPM3EEUB.js → agent-LXLZGVW3.js} +2 -2
- package/dist/{board-dashboard-4GQ7RTH3.js → board-dashboard-CPCSSVZE.js} +255 -224
- package/dist/board-dashboard-CPCSSVZE.js.map +1 -0
- package/dist/chunk-6LCP6SVR.js +482 -0
- package/dist/chunk-6LCP6SVR.js.map +1 -0
- package/dist/{chunk-MG5LRE5B.js → chunk-7IF3LXAU.js} +2 -2
- package/dist/{chunk-7T7IXLLA.js → chunk-AWQIUI7N.js} +2 -2
- package/dist/{chunk-5FY7PWXW.js → chunk-B65YTB3T.js} +2 -2
- package/dist/chunk-BRL3UPFW.js +2 -0
- package/dist/chunk-BRL3UPFW.js.map +1 -0
- package/dist/{chunk-EVXL6X2R.js → chunk-CCL73Z2P.js} +56 -56
- package/dist/{chunk-EVXL6X2R.js.map → chunk-CCL73Z2P.js.map} +1 -1
- package/dist/{chunk-ECBVOIIK.js → chunk-CKYSGX54.js} +171 -171
- package/dist/chunk-CKYSGX54.js.map +1 -0
- package/dist/chunk-DMHQIACQ.js +3 -0
- package/dist/chunk-DMHQIACQ.js.map +1 -0
- package/dist/{chunk-K3BG77KK.js → chunk-EKOVLUKH.js} +2 -2
- package/dist/{chunk-S4XSVAAG.js → chunk-ELWKTURG.js} +2 -2
- package/dist/chunk-EMGB23H5.js +3 -0
- package/dist/chunk-EMGB23H5.js.map +1 -0
- package/dist/{chunk-IGORU3XR.js → chunk-FBEMUCBO.js} +2 -2
- package/dist/{chunk-IGORU3XR.js.map → chunk-FBEMUCBO.js.map} +1 -1
- package/dist/chunk-GRMCAO3Q.js +2 -0
- package/dist/chunk-GRMCAO3Q.js.map +1 -0
- package/dist/{chunk-CJJULHPJ.js → chunk-HOY2GIKV.js} +4 -4
- package/dist/{chunk-YE4HKOS5.js → chunk-HSYNOMM2.js} +2 -2
- package/dist/{chunk-PITMPRVP.js → chunk-IEZ6OYFJ.js} +2 -2
- package/dist/{chunk-BXYKFWAI.js → chunk-J3SIOMDL.js} +2 -2
- package/dist/{chunk-PX2AOZ5G.js → chunk-JLCJVPRC.js} +2 -2
- package/dist/{chunk-QLB76BGE.js → chunk-KI4CIUVJ.js} +2 -2
- package/dist/{chunk-2NYP4OQU.js → chunk-LNY6N73E.js} +4 -4
- package/dist/{chunk-2NYP4OQU.js.map → chunk-LNY6N73E.js.map} +1 -1
- package/dist/{chunk-KTF4YF4M.js → chunk-R277UDDQ.js} +2 -2
- package/dist/{chunk-4STXRZZS.js → chunk-S56ZGAFM.js} +2 -2
- package/dist/{chunk-SDOSQ6TJ.js → chunk-UUMNP47Q.js} +2 -2
- package/dist/{chunk-UQX2HY5M.js → chunk-WRICEAR6.js} +2 -2
- package/dist/{chunk-J5TZ6QGD.js → chunk-Y3CZE54A.js} +2 -2
- package/dist/{chunk-BU4LE2RT.js → chunk-YMNQYODO.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-VUNPLVCG.js → client-CU5GNTKR.js} +2 -2
- package/dist/{config-HE2LGTTG.js → config-ITVBNUWW.js} +2 -2
- package/dist/config-mutator-5YRHHA2I.js +2 -0
- package/dist/doctor-MLD3XCYE.js +2 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{program-53CQJEUZ.js → program-IBOVOVZI.js} +191 -187
- package/dist/program-IBOVOVZI.js.map +1 -0
- package/dist/{promote-4PPJJ6AW.js → promote-JMJPWZI7.js} +2 -2
- package/dist/push-DID6RZYI.js +2 -0
- package/dist/push-bridge-IFUQLIMF.js +2 -0
- package/dist/push-store-L5QHMSST.js +2 -0
- package/dist/{query-ETDKC7WC.js → query-QGPVKGYY.js} +2 -2
- package/dist/{registry-AMETOJ3S.js → registry-PZNC5XYT.js} +2 -2
- package/dist/{request-planner-VFWWT5XR.js → request-planner-M4IKDZBU.js} +2 -2
- package/dist/{review-candidates-2PI4CGZO.js → review-candidates-6DNRBJZ6.js} +2 -2
- package/dist/routing-7NSB6O2S.js +2 -0
- package/dist/schedule-tool-ZP7H55EL.js +2 -0
- package/dist/scheduler-XV5UQQYH.js +2 -0
- package/dist/{seat-TVNR245I.js → seat-ZRCUQCUP.js} +2 -2
- package/dist/{select-KY7B4HAS.js → select-OLNLTEBR.js} +2 -2
- package/dist/{set-enabled-NEINY2I2.js → set-enabled-LG3ESZDC.js} +2 -2
- package/dist/token-store-AY6OBDVI.js +2 -0
- package/dist/token-store-AY6OBDVI.js.map +1 -0
- package/dist/{tool-MQQ2W5LJ.js → tool-RBXRPIBV.js} +2 -2
- package/dist/{tool-5JGMWH62.js → tool-S6U42ULD.js} +2 -2
- package/dist/wiki-XKQN5CWR.js +2 -0
- package/dist/wiki-XKQN5CWR.js.map +1 -0
- package/package.json +1 -1
- package/dist/board-dashboard-4GQ7RTH3.js.map +0 -1
- package/dist/chunk-2QSG53RN.js +0 -482
- package/dist/chunk-2QSG53RN.js.map +0 -1
- package/dist/chunk-ACFQBLPX.js +0 -3
- package/dist/chunk-ACFQBLPX.js.map +0 -1
- package/dist/chunk-ECBVOIIK.js.map +0 -1
- package/dist/config-mutator-22AVTST2.js +0 -2
- package/dist/doctor-6RDRST4G.js +0 -2
- package/dist/program-53CQJEUZ.js.map +0 -1
- package/dist/push-HEDA6P3B.js +0 -2
- package/dist/push-HEDA6P3B.js.map +0 -1
- package/dist/push-store-5VJ4FNI4.js +0 -2
- package/dist/routing-M7MDLD7Q.js +0 -2
- package/dist/schedule-tool-2EQ53IOQ.js +0 -2
- package/dist/scheduler-YGVINPZF.js +0 -2
- package/dist/token-store-YBSU2DTV.js +0 -2
- package/dist/wiki-COAUQ6TQ.js +0 -2
- /package/dist/{App-6OMMZW2M.js.map → App-7Z2PWARZ.js.map} +0 -0
- /package/dist/{ChatApp-EDDROHNA.js.map → ChatApp-GFAIRLGZ.js.map} +0 -0
- /package/dist/{agent-VPM3EEUB.js.map → agent-LXLZGVW3.js.map} +0 -0
- /package/dist/{chunk-MG5LRE5B.js.map → chunk-7IF3LXAU.js.map} +0 -0
- /package/dist/{chunk-7T7IXLLA.js.map → chunk-AWQIUI7N.js.map} +0 -0
- /package/dist/{chunk-5FY7PWXW.js.map → chunk-B65YTB3T.js.map} +0 -0
- /package/dist/{chunk-K3BG77KK.js.map → chunk-EKOVLUKH.js.map} +0 -0
- /package/dist/{chunk-S4XSVAAG.js.map → chunk-ELWKTURG.js.map} +0 -0
- /package/dist/{chunk-CJJULHPJ.js.map → chunk-HOY2GIKV.js.map} +0 -0
- /package/dist/{chunk-YE4HKOS5.js.map → chunk-HSYNOMM2.js.map} +0 -0
- /package/dist/{chunk-PITMPRVP.js.map → chunk-IEZ6OYFJ.js.map} +0 -0
- /package/dist/{chunk-BXYKFWAI.js.map → chunk-J3SIOMDL.js.map} +0 -0
- /package/dist/{chunk-PX2AOZ5G.js.map → chunk-JLCJVPRC.js.map} +0 -0
- /package/dist/{chunk-QLB76BGE.js.map → chunk-KI4CIUVJ.js.map} +0 -0
- /package/dist/{chunk-KTF4YF4M.js.map → chunk-R277UDDQ.js.map} +0 -0
- /package/dist/{chunk-4STXRZZS.js.map → chunk-S56ZGAFM.js.map} +0 -0
- /package/dist/{chunk-SDOSQ6TJ.js.map → chunk-UUMNP47Q.js.map} +0 -0
- /package/dist/{chunk-UQX2HY5M.js.map → chunk-WRICEAR6.js.map} +0 -0
- /package/dist/{chunk-J5TZ6QGD.js.map → chunk-Y3CZE54A.js.map} +0 -0
- /package/dist/{chunk-BU4LE2RT.js.map → chunk-YMNQYODO.js.map} +0 -0
- /package/dist/{client-VUNPLVCG.js.map → client-CU5GNTKR.js.map} +0 -0
- /package/dist/{config-HE2LGTTG.js.map → config-ITVBNUWW.js.map} +0 -0
- /package/dist/{config-mutator-22AVTST2.js.map → config-mutator-5YRHHA2I.js.map} +0 -0
- /package/dist/{doctor-6RDRST4G.js.map → doctor-MLD3XCYE.js.map} +0 -0
- /package/dist/{promote-4PPJJ6AW.js.map → promote-JMJPWZI7.js.map} +0 -0
- /package/dist/{push-store-5VJ4FNI4.js.map → push-DID6RZYI.js.map} +0 -0
- /package/dist/{query-ETDKC7WC.js.map → push-bridge-IFUQLIMF.js.map} +0 -0
- /package/dist/{registry-AMETOJ3S.js.map → push-store-L5QHMSST.js.map} +0 -0
- /package/dist/{routing-M7MDLD7Q.js.map → query-QGPVKGYY.js.map} +0 -0
- /package/dist/{schedule-tool-2EQ53IOQ.js.map → registry-PZNC5XYT.js.map} +0 -0
- /package/dist/{request-planner-VFWWT5XR.js.map → request-planner-M4IKDZBU.js.map} +0 -0
- /package/dist/{review-candidates-2PI4CGZO.js.map → review-candidates-6DNRBJZ6.js.map} +0 -0
- /package/dist/{scheduler-YGVINPZF.js.map → routing-7NSB6O2S.js.map} +0 -0
- /package/dist/{seat-TVNR245I.js.map → schedule-tool-ZP7H55EL.js.map} +0 -0
- /package/dist/{token-store-YBSU2DTV.js.map → scheduler-XV5UQQYH.js.map} +0 -0
- /package/dist/{wiki-COAUQ6TQ.js.map → seat-ZRCUQCUP.js.map} +0 -0
- /package/dist/{select-KY7B4HAS.js.map → select-OLNLTEBR.js.map} +0 -0
- /package/dist/{set-enabled-NEINY2I2.js.map → set-enabled-LG3ESZDC.js.map} +0 -0
- /package/dist/{tool-MQQ2W5LJ.js.map → tool-RBXRPIBV.js.map} +0 -0
- /package/dist/{tool-5JGMWH62.js.map → tool-S6U42ULD.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-6W74CHNW.js";import{a as E}from"./chunk-
|
|
1
|
+
import{q as _,r as W}from"./chunk-2AXFYDWF.js";import{b as Y,c as I,d as O}from"./chunk-AQASR6KR.js";import{b as F}from"./chunk-6W74CHNW.js";import{a as E}from"./chunk-KI4CIUVJ.js";import{b as L}from"./chunk-CECHWYJ2.js";import{createHash as ee}from"crypto";import{existsSync as H,readdirSync as te,readFileSync as re,writeFileSync as ne}from"fs";import{resolve as P}from"path";function be(n,r,s,t,o,i,c=""){return Z(r,s,t,o,i,c)}function Z(n,r,s,t,o,i=""){let c=r?`
|
|
2
2
|
## Worldview
|
|
3
3
|
|
|
4
4
|
${r}
|
|
@@ -240,4 +240,4 @@ ${g}`}var x="memory-promoter",oe=["project","reference","feedback"],K="_memory-p
|
|
|
240
240
|
Re-emit the FULL corrected JSON object \u2014 same structure, fixed issues, valid JSON only.`:n,y=await t(`${a}/task`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:r.viaAgent,message:h,freshSession:s===null,context:{channel:"api",chatId:r.chatId??"memory-promote"}}),signal:i.signal});if(!y.ok){let f=await y.text().catch(()=>"");throw new Error(`agent /task ${y.status}: ${f.slice(0,500)}`)}let w=await y.json();if(w.error)throw new Error(`agent reported error: ${w.error}`);let b=String(w.content??"").trim();if(!b)throw new Error("agent returned empty content");return b}if(!r.model)throw new Error("callPromotionLlm: viaAgent or model is required");let p=process.env.ANTHROPIC_API_KEY;if(!p)throw new Error("ANTHROPIC_API_KEY not set; use --via <agentId> instead");let u=[{role:"user",content:n}];s&&(u.push({role:"assistant",content:"(previous attempt; will retry with corrections)"}),u.push({role:"user",content:`Your previous response failed validation: ${s}
|
|
241
241
|
Re-emit the FULL corrected JSON object.`}));let g=await t(me,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":ge},body:JSON.stringify({model:r.model,max_tokens:8e3,messages:u}),signal:i.signal});if(!g.ok){let a=await g.text().catch(()=>"");throw new Error(`anthropic API ${g.status}: ${a.slice(0,500)}`)}let l=await g.json(),e=(Array.isArray(l.content)?l.content:[]).filter(a=>a?.type==="text").map(a=>a.text).join(`
|
|
242
242
|
`).trim();if(!e)throw new Error("anthropic API returned no text content");return e}finally{clearTimeout(c)}}async function Se(n={}){let r=n.wikiDir??P(process.cwd(),".agentx","wiki"),s=n.memoryRoot??P(process.cwd(),".agentx"),t=n.log??(()=>{}),o=n.now??Date.now(),i={candidates:[],clusters:[],proposed:[],skipped:[],gaps:[],warnings:[],errors:[],dryRun:!n.commit},c=new E(r,(...m)=>t(m.map(String).join(" "))),p=c.rebuildIndex(),u=z(r),g=[...ce(s),...n.extraCandidates??[]];if(i.candidates=de(g,p,u,{types:n.types,sinceMs:n.sinceMs,agentFilter:n.agentFilter,now:o,max:n.max}),i.candidates.length===0)return t("no unpromoted memories in window"),i;if(i.clusters=le(i.candidates),i.dryRun)return i;let l=p.articles.map(m=>({title:m.title,path:m.path,type:m.type})),d=c.getWorldview()??"",e=n.budgetTokens??ue,a=i.clusters,h=D(x,a,l,d);for(;R(h)>e&&a.length>1;)a=a.slice(0,-1),h=D(x,a,l,d);if(R(h)>e)return i.errors.push(`judge prompt (~${R(h)} tokens) exceeds the ${e}-token budget even with one cluster`),i;a.length<i.clusters.length&&i.warnings.push(`token budget: judged ${a.length} of ${i.clusters.length} clusters; the rest wait for the next run`);let y=a.flatMap(m=>m.candidates),w=new Set(y.map(m=>m.stamp)),b=n.chatId??`memory-promote-${new Date(o).toISOString().slice(0,10)}`,f=B(await G(h,{...n,chatId:b}),w);if("error"in f&&(t(`parse failed (${f.error}) \u2014 retrying with feedback`),f=B(await G(h,{...n,chatId:b},f.error),w)),"error"in f)return i.errors.push(`LLM response unusable after retry: ${f.error}`),i;i.warnings.push(...f.warnings),i.gaps=f.gaps;let v=new Date(o).toISOString(),k=[],T=new Map(y.map(m=>[m.stamp,m]));for(let m of f.articles){let A=c.readArticle(m.path);if(A&&!c.canWrite(A.meta,x)){i.errors.push(`write denied for "${m.path}" (owned by ${A.meta.owner??"?"})`);continue}let M=fe(m.promotedFrom,T),S={id:Y(o,m.path),createdAt:v,status:"pending",article:m,evidence:M,...A?{replaces:{lastUpdated:A.meta.lastUpdated,contentHash:V(A.content)}}:{}};I(r,S),i.proposed.push({id:S.id,path:m.path,title:m.title,type:m.type,stamps:m.promotedFrom,agents:M.agents,occurrences:M.occurrences});for(let X of m.promotedFrom)k.push({stamp:X,decision:"proposed",article:m.path,proposal:S.id,at:v})}for(let m of f.skipped)k.push({stamp:m.stamp,decision:"skipped",reason:m.reason,at:v}),i.skipped.push(m);return k.length&&C(r,k),i}var ue=6e4;function R(n){return Math.ceil(n.length/4)}function V(n){return ee("sha256").update(n).digest("hex").slice(0,16)}var he=600;function ye(n){return n.startsWith("review:")?"review":n.startsWith(j)?"failure":"memory"}function fe(n,r){let s=[];for(let t of n){let o=r.get(t);o&&s.push({stamp:t,kind:ye(t),agentId:o.agentId,type:o.memory.type,name:o.memory.name,description:o.memory.description,...o.occurrences?{occurrences:o.occurrences}:{},...o.sessions?.length?{sessions:o.sessions}:{},...o.tasks?.length?{tasks:o.tasks}:{},...o.failure?{failure:o.failure}:{},...o.memory.author?{author:o.memory.author}:{},...o.memory.taskId?{taskId:o.memory.taskId}:{},updatedAt:o.memory.updatedAt,excerpt:o.memory.body.slice(0,he)})}return{agents:[...new Set(s.map(t=>t.agentId))].sort(),occurrences:Math.max(1,...s.map(t=>t.occurrences??1)),sources:s}}function Ee(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=s.log??(()=>{}),i=new E(n,(...a)=>o(a.map(String).join(" "))),{article:c}=t,p=i.readArticle(c.path);if(!s.force){if(p&&!t.replaces)return{ok:!1,error:`"${c.path}" was created after this proposal; review it, then approve with --force`};if(p&&t.replaces&&V(p.content)!==t.replaces.contentHash)return{ok:!1,error:`"${c.path}" changed since this proposal; review it, then approve with --force`}}let u=s.now??Date.now(),g=new Date(u).toISOString().slice(0,10);if(!i.writeArticle(c.path,{title:c.title,type:L(c.type)?c.type:void 0,related:c.related,tags:c.tags,owner:x,access:"public",created:p?.meta.created??g,lastUpdated:g,sources:ae(p?.meta.sources,c.promotedFrom)},c.content,x))return{ok:!1,error:`write denied for "${c.path}" (owned by ${p?.meta.owner??"?"})`};let d=new Date(u).toISOString();C(n,c.promotedFrom.map(a=>({stamp:a,decision:"promoted",article:c.path,proposal:r,at:d}))),i.rebuildIndex();let e={...t,status:"approved",decidedBy:s.by??"operator",decidedAt:d};return I(n,e),{ok:!0,proposal:e}}function Oe(n,r,s={}){let t=O(n,r);if(!t)return{ok:!1,error:`no proposal "${r}"`};if(t.status!=="pending")return{ok:!1,error:`proposal "${r}" is already ${t.status}`};let o=new Date(s.now??Date.now()).toISOString();C(n,t.article.promotedFrom.map(c=>({stamp:c,decision:"rejected",article:t.article.path,proposal:r,reason:s.reason,at:o})));let i={...t,status:"rejected",decidedBy:s.by??"operator",decidedAt:o,...s.reason?{reason:s.reason}:{}};return I(n,i),{ok:!0,proposal:i}}export{be as a,x as b,oe as c,K as d,q as e,ie as f,$ as g,ae as h,ce as i,z as j,C as k,le as l,B as m,de as n,G as o,Se as p,R as q,ye as r,fe as s,Ee as t,Oe as u};
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-7IF3LXAU.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{f as j,i as x,p as O,r as I}from"./chunk-S2GAEH2F.js";import{a as R}from"./chunk-JXF54PT7.js";import{ja as S,ma as L}from"./chunk-
|
|
1
|
+
import{f as j,i as x,p as O,r as I}from"./chunk-S2GAEH2F.js";import{a as R}from"./chunk-JXF54PT7.js";import{ja as S,ma as L}from"./chunk-FBEMUCBO.js";L();import{Command as z}from"commander";import f from"chalk";import{execFileSync as h}from"child_process";import{accessSync as T,constants as H,existsSync as y,readFileSync as b,readdirSync as $,statSync as X}from"fs";import{join as E,resolve as m}from"path";import{homedir as B}from"os";import{createRequire as F}from"module";import{execFile as M}from"child_process";var q=(t,n)=>new Promise(e=>{try{M(t,n,{timeout:5e3},(i,s)=>e(i?null:String(s)))}catch{e(null)}}),N="Open System Settings \u203A Notifications \u203A AgentX Helper, turn on Allow notifications and choose Banners.";async function P(t={}){if((t.platform??process.platform)!=="darwin")return{state:"unsupported",message:"Desktop banners are only shown on a Mac."};let n=t.helper===void 0?I():t.helper;if(!n)return{state:"missing",message:"AgentX Helper is not installed, so banners come from Script Editor and show its icon.",fix:'Run agentx desktop install, then run agentx notify "Hello" --title "Test" and click Allow.'};let e=await(t.run??q)(n,["notify-status"]),i=null;try{i=e?JSON.parse(e):null}catch{i=null}return i?i.authorization==="notDetermined"?{state:"not-asked",path:n,message:"macOS has not asked yet whether AgentX Helper may notify; banners show the Script Editor icon until it does.",fix:'Run agentx notify "Hello" --title "Test" and click Allow when macOS asks.'}:i.authorization==="denied"?{state:"not-allowed",path:n,message:"macOS does not allow AgentX Helper to notify, so banners show the Script Editor icon.",fix:N}:i.alertStyle==="none"?{state:"hidden",path:n,message:"AgentX Helper may notify, but its banner style is None, so nothing appears on screen.",fix:N}:{state:"ready",path:n,message:"AgentX Helper posts banners with the AgentX icon."}:{state:"outdated",path:n,message:"AgentX Helper is too old to report whether it may notify.",fix:"Run agentx desktop install to update it."}}async function J(t={}){let n=[];await Z(n),U(n);let e=K(n);return e&&Q(n,e),e&&Y(n,e),e&&ee(n,e),e&&te(n,e),e&&oe(n,e),e&&await G(n,e),e&&V(n,e),t.running!==!1&&e&&await ie(n,e),{checks:n,summary:W(n)}}var ke=new z().name("doctor").description("pre-flight health check: Node, config, credentials, daemon").option("--no-running","skip the live daemon probe").option("--json","emit machine-readable JSON (stable shape for CI)").action(async t=>{let{checks:n,summary:e}=await J({running:t.running!==!1});t.json?process.stdout.write(JSON.stringify({checks:n,summary:e},null,2)+`
|
|
2
2
|
`):se(n),process.exit(e.errors>0?1:0)});async function G(t,n,e=P){if(!O(n.notifications?.local).banner)return;let i=await e();i.state!=="unsupported"&&t.push({severity:i.state==="ready"?"ok":"warn",group:"Notifications",title:i.message,detail:i.path,fix:i.fix})}function V(t,n,e=process.platform,i=s=>{try{return T(s,H.X_OK),!0}catch{return!1}}){let s=n.reminders;if(!s?.enabled)return;if(e!=="darwin"){t.push({severity:"warn",group:"Reminders",title:"Reminders hand-back unavailable on this machine",detail:"reminders.enabled is set, but Apple Reminders exists only on macOS. The daemon starts without it.",fix:"Set reminders.enabled to false here, or enable it on the Mac node instead."});return}let r=s.command||"remindctl",a=r.includes("/")?i(r)?r:null:x(r,process.env.PATH||"",i);t.push(a?{severity:"ok",group:"Reminders",title:`Watching ${(s.lists||[]).join(", ")} for due reminders`,detail:a}:{severity:"fail",group:"Reminders",title:`${r} not found`,detail:"The daemon reads Apple Reminders through remindctl.",fix:"brew install steipete/tap/remindctl, or set reminders.command to its full path."})}async function Z(t){let n=R(process.versions.node);t.push({severity:n?"ok":"fail",group:"Environment",title:`Node.js ${process.versions.node}`,detail:n?void 0:"AgentX requires Node 22.19 or newer, up to Node 26.",fix:n?void 0:"Install Node 22 (nvm install 22 && nvm use 22)"});let e=l=>{try{return h(process.platform==="win32"?"where":"which",[l],{encoding:"utf-8"}).trim().split(`
|
|
3
3
|
`)[0]}catch{return null}},i=e("npm");t.push({severity:i?"ok":"fail",group:"Environment",title:i?"npm on PATH":"npm not found",detail:i||void 0});let s=e("claude");if(s){let l;try{l=h("claude",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"Environment",title:`claude CLI ${l||"installed"}`,detail:s})}else t.push({severity:"warn",group:"Environment",title:"claude CLI not on PATH",detail:"Only required for agents on the claude-code tier.",fix:"See https://docs.anthropic.com/en/docs/claude-code"});let r=e("codex");if(r){let l;try{l=h("codex",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"Environment",title:`codex CLI ${l||"installed"}`,detail:r})}else t.push({severity:"warn",group:"Environment",title:"codex CLI not on PATH",detail:"Only required for agents on the codex-cli tier.",fix:"Install with `npm i -g @openai/codex`."});let a=e("opencode");if(a){let l;try{l=h("opencode",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"Environment",title:`opencode CLI ${l||"installed"}`,detail:a})}else t.push({severity:"warn",group:"Environment",title:"opencode CLI not on PATH",detail:"Only required for agents on the opencode tier.",fix:"Install from https://opencode.ai/docs/."});try{F(import.meta.url)("better-sqlite3"),t.push({severity:"ok",group:"Environment",title:`better-sqlite3 loads for Node ${process.version}`,detail:`NODE_MODULE_VERSION ${process.versions.modules}`})}catch(l){t.push({severity:"fail",group:"Environment",title:"better-sqlite3 native binding does not load",detail:l?.message??String(l),fix:`Run "pnpm rebuild better-sqlite3" with the same Node used by the daemon (${process.version}, modules ${process.versions.modules}).`})}}function U(t){if(process.platform!=="darwin")return;let n=E(B(),"Library/LaunchAgents"),e=[];try{e=$(n).filter(s=>/agentx\.voice.*\.plist$/.test(s))}catch{return}let i=s=>{try{return T(s,H.X_OK),!0}catch{return!1}};for(let s of e){let r=j(b(E(n,s),"utf-8")),a=x("ffmpeg",r,i);t.push(a?{severity:"ok",group:"Desktop",title:"ffmpeg reachable by the desktop app",detail:`${a} (${s})`}:{severity:"warn",group:"Desktop",title:"ffmpeg not reachable by the desktop app",detail:`Local Whisper transcription fails without it. ${s} sets PATH to ${r}.`,fix:"Install ffmpeg (brew install ffmpeg), then rerun agentx desktop install."})}}function K(t){let n=m(process.cwd(),"agentx.json");if(!y(n))return t.push({severity:"fail",group:"Config",title:"agentx.json not found",detail:`Looked in ${n}`,fix:"Run `agentx setup` to create one via the web wizard."}),null;let e;try{e=JSON.parse(b(n,"utf-8"))}catch(a){return t.push({severity:"fail",group:"Config",title:"agentx.json is not valid JSON",detail:a.message}),null}try{S(n),t.push({severity:"ok",group:"Config",title:`agentx.json valid (${Object.keys(e.agents||{}).length} agents, ${Object.keys(e.crons||{}).length} schedules)`})}catch(a){t.push({severity:"fail",group:"Config",title:"agentx.json failed schema validation",detail:a.message,fix:"Open /admin \u2192 Advanced tab to edit and re-save."})}let i=Object.entries(e.agents||{}).filter(([,a])=>a.tier==="claude-code");i.length>0&&((()=>{try{return h(process.platform==="win32"?"where":"which",["claude"],{stdio:"ignore"}),!0}catch{return!1}})()||t.push({severity:"fail",group:"Config",title:`${i.length} agent(s) use claude-code tier but claude CLI is missing`,detail:i.map(([l])=>l).join(", "),fix:"Install Claude Code (https://docs.anthropic.com/en/docs/claude-code) or switch these agents to tier=sdk."}));let s=Object.entries(e.agents||{}).filter(([,a])=>a.tier==="codex-cli");s.length>0&&((()=>{try{return h(process.platform==="win32"?"where":"which",["codex"],{stdio:"ignore"}),!0}catch{return!1}})()||t.push({severity:"fail",group:"Config",title:`${s.length} agent(s) use codex-cli tier but codex CLI is missing`,detail:s.map(([l])=>l).join(", "),fix:"Install Codex CLI with `npm i -g @openai/codex` or switch these agents to tier=claude-code."}));let r=Object.entries(e.agents||{}).filter(([,a])=>a.tier==="opencode");return r.length>0&&((()=>{try{return h(process.platform==="win32"?"where":"which",["opencode"],{stdio:"ignore"}),!0}catch{return!1}})()||t.push({severity:"fail",group:"Config",title:`${r.length} agent(s) use opencode tier but OpenCode CLI is missing`,detail:r.map(([l])=>l).join(", "),fix:"Install OpenCode from https://opencode.ai/docs/ or switch these agents to another tier."})),e}function Q(t,n){let e=new Set;if(C(n,e),e.size===0){t.push({severity:"ok",group:"Secrets",title:"No ${VAR} references in agentx.json"});return}let i=m(process.cwd(),".env"),s={};if(y(i))for(let l of b(i,"utf-8").split(/\r?\n/)){let u=l.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)$/i);u&&(s[u[1]]=u[2])}let r=[],a=[];for(let l of e){let u=process.env[l]??s[l];u===void 0?r.push(l):(!u.trim()||/^["']?\s*["']?$/.test(u))&&a.push(l)}r.length===0&&a.length===0?t.push({severity:"ok",group:"Secrets",title:`${e.size} env reference(s) resolved`}):(r.length>0&&t.push({severity:"fail",group:"Secrets",title:`${r.length} env var(s) referenced in agentx.json but missing`,detail:r.join(", "),fix:`Add to .env \u2014 e.g. ${r[0]}=<value>`}),a.length>0&&t.push({severity:"warn",group:"Secrets",title:`${a.length} env var(s) set but empty`,detail:a.join(", ")}))}function C(t,n){if(typeof t=="string")for(let e of t.matchAll(/\$\{([A-Z_][A-Z0-9_]*)\}/g))n.add(e[1]);else if(Array.isArray(t))for(let e of t)C(e,n);else if(t&&typeof t=="object")for(let e of Object.values(t))C(e,n)}function Y(t,n){let e=[];for(let[i,s]of Object.entries(n.agents||{})){if(!s.workspace)continue;let r=s.workspace.startsWith("/")?s.workspace:m(process.cwd(),s.workspace);try{X(r).isDirectory()||e.push(`${i}: ${r} (exists but not a directory)`)}catch{e.push(`${i}: ${r}`)}}e.length===0?t.push({severity:"ok",group:"Workspaces",title:"All agent workspace folders exist"}):t.push({severity:"warn",group:"Workspaces",title:`${e.length} agent workspace(s) missing`,detail:e.join(`
|
|
4
4
|
`),fix:"The daemon will create missing folders on first task, but you won't see CLAUDE.md / skills until you populate them."})}function ee(t,n){let e=/\$\{[A-Za-z_][A-Za-z0-9_]*\}/g,i=[];for(let[s,r]of Object.entries(n.agents||{})){if(!r.workspace)continue;let a=r.workspace.startsWith("/")?r.workspace:m(process.cwd(),r.workspace);for(let l of["settings.json","settings.local.json"]){let u=m(a,".claude",l);if(!y(u))continue;let w;try{w=JSON.parse(b(u,"utf-8"))}catch(d){i.push({severity:"fail",agent:s,msg:`${l}: JSON parse error \u2014 ${d.message}`});continue}let k=w.env||{};for(let[d,p]of Object.entries(k)){if(typeof p!="string")continue;let g=p.match(e);g&&i.push({severity:"fail",agent:s,msg:`${l} env.${d} contains unexpanded ${[...new Set(g)].join(",")} \u2014 Claude Code does NOT expand \${VAR} in settings.json (use a fully-literal value)`})}let o=k.PATH;if(typeof o=="string"){let d=o.split(":").filter(Boolean);d.includes("/usr/bin")||i.push({severity:"fail",agent:s,msg:`${l} env.PATH missing /usr/bin \u2014 cat/head/sh/which will fail`}),d.includes("/bin")||i.push({severity:"fail",agent:s,msg:`${l} env.PATH missing /bin \u2014 ls/cp/mv will fail`})}let c=w.permissions;if(c&&typeof c=="object"&&"allow"in c){let d=c.allow,p=c.deny;Array.isArray(d)&&d.length===0&&Array.isArray(p)&&p.length>0&&i.push({severity:"warn",agent:s,msg:`${l} permissions.allow is explicitly [] with ${p.length} deny rules \u2014 agent may be locked out (omit the key to use defaults instead)`})}}}if(i.length===0){t.push({severity:"ok",group:"Workspace settings",title:`All ${Object.keys(n.agents||{}).length} agent .claude/settings.json files clean`});return}for(let s of i)t.push({severity:s.severity,group:"Workspace settings",title:`${s.agent}: ${s.msg}`,fix:s.severity==="fail"?"Edit .claude/settings.json \u2014 replace ${VAR} with the literal value or omit the key to inherit.":"Either remove the empty allow list or populate it."})}function te(t,n){let e=n.webhooks??[],i=[],s=m(process.cwd(),n.workflows?.dir||".agentx/workflows"),r=new Set;try{if(y(s))for(let o of $(s))o.endsWith(".json")&&!o.startsWith("_")&&!o.endsWith(".disabled.json")&&r.add(o.replace(/\.json$/,""))}catch{}let a=new Set(["github","gitlab"]);for(let o of e){if(!o.enabled||!a.has(o.source))continue;!(o.triggers&&Object.keys(o.triggers).length>0)&&!o.defaultWorkflow&&i.push({severity:"warn",title:`webhook "${o.id}" (${o.source} -> ${o.agentId}) has no triggers map; every event-type collapses to the bound agent`,fix:'Add a triggers map: { "issues.opened": "wf-id", "pull_request.synchronize": "wf-id" } \u2014 or set defaultWorkflow.'})}for(let o of e)if(!(!o.enabled||!o.triggers)){for(let[c,d]of Object.entries(o.triggers))r.size>0&&!r.has(d)&&i.push({severity:"fail",title:`webhook "${o.id}".triggers["${c}"] -> "${d}" \u2014 no such workflow under ${n.workflows?.dir||".agentx/workflows"}`,fix:"Create the workflow file or fix the id in agentx.json"});o.defaultWorkflow&&r.size>0&&!r.has(o.defaultWorkflow)&&i.push({severity:"fail",title:`webhook "${o.id}".defaultWorkflow -> "${o.defaultWorkflow}" \u2014 no such workflow`,fix:"Create the workflow file or fix the id in agentx.json"})}try{if(y(s)){for(let o of $(s))if(!(!o.endsWith(".json")||o.startsWith("_")||o.endsWith(".disabled.json")))try{let c=JSON.parse(b(m(s,o),"utf-8"));c?.status==="active"&&c?.state==="quarantined"&&i.push({severity:"warn",title:`workflow "${c.id??o}" is status=active but state=quarantined \u2014 it looks live but will never dispatch`,fix:'Resolve the conflict the detector flagged, then set state back to "active" (or set status to "review" while parked).'})}catch{}}}catch{}let l=new Set((n.mesh?.peers??[]).map(o=>o.name));for(let o of e)!o.enabled||!o.node||l.has(o.node)||i.push({severity:"fail",title:`webhook "${o.id}" routes to mesh peer "${o.node}" which is not in mesh.peers`,fix:"Add the peer to mesh.peers or remove the node field on the webhook."});let u=new Map;for(let o of e){if(!o.enabled)continue;let c=`${o.source}:${o.agentId}`,d=u.get(c);d?i.push({severity:"warn",title:`webhook entries "${d}" and "${o.id}" both enabled for ${o.source} -> ${o.agentId}; only the first is dispatched`,fix:"Disable one entry, or merge their triggers maps into a single entry."}):u.set(c,o.id)}let w=new Set(Object.keys(n.agents??{}));for(let o of n.channels?.gitlab?.agentMappings??[])if(o?.agentId){if(o.node){l.has(o.node)||i.push({severity:"fail",title:`gitlab.agentMappings entry agentId="${o.agentId}" routes to mesh peer "${o.node}" which is not in mesh.peers`,fix:"Add the peer to mesh.peers or drop the node field on the mapping."});continue}w.has(o.agentId)||i.push({severity:"warn",title:`gitlab.agentMappings entry agentId="${o.agentId}" \u2014 no such agent in agents.* (and no node field, so it's not a cross-mesh route)`,fix:'Add the agent to agents.*, set node:"<peer>" if the agent lives remotely, or remove the mapping.'})}for(let[o,c]of Object.entries(n.channels?.telegram?.accounts??{}))c.agentBinding?w.has(c.agentBinding)||i.push({severity:"fail",title:`telegram account "${o}".agentBinding -> "${c.agentBinding}" \u2014 no such agent in agents.*`,fix:"Fix the agentBinding or define the agent in agents.*."}):i.push({severity:"fail",title:`telegram account "${o}" has no agentBinding; every DM to this bot will drop`,fix:"Set agentBinding to a valid agent id."});let k=new Set(["telegram-bot","whatsapp","slack-bot","discord-bot","gitlab-user","github-user","gmail","hotmail","smtp","hubspot","salesforce","pipedrive","odoo","trello","linear","asana","jira","notion","stripe","sentry","vercel","twilio","custom"]);for(let[o,c]of Object.entries(n.agents??{})){let d=c.integrations??[];if(!d.length)continue;let p=new Set;for(let g of d){let A=`${g.kind}::${g.label}`;p.has(A)&&i.push({severity:"warn",title:`agents.${o}.integrations: duplicate (${g.kind}, ${g.label})`,fix:"Remove the duplicate or rename one. (kind, label) must be unique per agent."}),p.add(A),k.has(g.kind)||i.push({severity:"warn",title:`agents.${o}.integrations: unknown kind "${g.kind}" on integration "${g.label}"`,fix:'Use a canonical kind from INTEGRATION_KINDS, or "custom" for ad-hoc services.'});let D=g.credentials||{};for(let[_,v]of Object.entries(D))typeof v=="string"&&/^[A-Z][A-Z0-9_]*$/.test(v)&&!process.env[v]&&i.push({severity:"warn",title:`agents.${o}.integrations[${g.kind}/${g.label}].${_} -> $${v} but env var is unset (in this shell)`,fix:`Set ${v} on the daemon environment. The daemon's process.env is what matters; this warning fires from your local shell.`})}}if(i.length===0){t.push({severity:"ok",group:"Routing",title:`${e.length} webhook(s), ${Object.keys(n.channels?.telegram?.accounts??{}).length} telegram account(s) \u2014 all routing references resolve`});return}for(let o of i)t.push({severity:o.severity,group:"Routing",title:o.title,fix:o.fix})}function ne(t){return typeof t?.canMeasure!="boolean"?null:t.canMeasure?{severity:"ok",group:"Runtime",title:"Daemon finds ffmpeg to measure phone recordings"}:{severity:"warn",group:"Runtime",title:t.allowUnmeasured?"Daemon can't find ffmpeg: phone recordings go unmeasured (voice.allowUnmeasured)":"Daemon can't find ffmpeg: phone voice input is refused",fix:"Install ffmpeg (brew install ffmpeg / sudo apt install ffmpeg), or set AGENTX_FFMPEG in the service's environment. The daemon's PATH is shorter than your shell's."}}async function ie(t,n){let e=n.dashboard?.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800",i={};n.dashboard?.token&&(i.Authorization=`Bearer ${n.dashboard.token}`);try{let s=new AbortController,r=setTimeout(()=>s.abort(),2e3),a=await fetch(e+"/health",{headers:i,signal:s.signal});if(clearTimeout(r),!a.ok){t.push({severity:"warn",group:"Runtime",title:`Daemon responded ${a.status}`,detail:e});return}let l=await a.json();t.push({severity:"ok",group:"Runtime",title:`Daemon healthy \u2014 ${l.agents?.length??0} agents live, uptime ${Math.round((l.uptime??0)/60)}m`,detail:e});let u=ne(l.voice);u&&t.push(u)}catch{t.push({severity:"warn",group:"Runtime",title:"Daemon not reachable (not running?)",detail:e,fix:"Run `agentx daemon start`. Skip this check with `agentx doctor --no-running`."})}}function oe(t,n){let e=Object.entries(n.agents||{}).filter(([,s])=>s?.codegraph===!0&&(s.tier==="claude-code"||s.tier==="codex-cli"));if(e.length===0)return;let i=null;try{i=h(process.platform==="win32"?"where":"which",["codegraph"],{encoding:"utf-8"}).trim().split(`
|
|
5
5
|
`)[0]||null}catch{i=null}if(i){let s;try{s=h("codegraph",["--version"],{encoding:"utf-8",timeout:3e3}).trim()}catch{}t.push({severity:"ok",group:"CodeGraph",title:`codegraph CLI ${s||"installed"}`,detail:i})}else t.push({severity:"fail",group:"CodeGraph",title:"codegraph CLI not on PATH",detail:`${e.length} agent(s) have codegraph:true but the binary isn't available.`,fix:"Install with `npm i -g @colbymchenry/codegraph`."});for(let[s,r]of e){if(!r.workspace||!y(r.workspace)){t.push({severity:"warn",group:"CodeGraph",title:`${s}: workspace missing`,detail:`Workspace path ${r.workspace} does not exist \u2014 codegraph will skip this agent.`});continue}let a=m(r.workspace,".codegraph","codegraph.db");y(a)?t.push({severity:"ok",group:"CodeGraph",title:`${s}: index present`,detail:a}):t.push({severity:"warn",group:"CodeGraph",title:`${s}: index not built yet`,detail:".codegraph/ missing \u2014 daemon will background-index this workspace on next boot.",fix:`Run \`codegraph init --index ${r.workspace}\` to build it now.`})}}function W(t){return{errors:t.filter(n=>n.severity==="fail").length,warnings:t.filter(n=>n.severity==="warn").length,ok:t.filter(n=>n.severity==="ok").length}}function se(t){console.log(),console.log(f.bold(" agentx doctor")),console.log();let n=new Map;for(let i of t)n.has(i.group)||n.set(i.group,[]),n.get(i.group).push(i);for(let[i,s]of n){console.log(f.bold(" "+i));for(let r of s){let a=r.severity==="ok"?f.green("\u2713"):r.severity==="warn"?f.yellow("!"):f.red("\u2717");console.log(` ${a} ${r.title}`),r.detail&&console.log(f.dim(" "+r.detail.replace(/\n/g,`
|
|
6
6
|
`))),r.fix&&console.log(f.dim(" \u2192 "+r.fix))}console.log()}let e=W(t);e.errors>0?console.log(f.red.bold(` ${e.errors} error${e.errors===1?"":"s"}`)+(e.warnings?f.yellow(`, ${e.warnings} warning${e.warnings===1?"":"s"}`):"")+`. Fix the error${e.errors===1?"":"s"} and rerun.`):e.warnings>0?console.log(f.yellow.bold(` ${e.warnings} warning${e.warnings===1?"":"s"}.`)+f.dim(" Review but not blocking.")):console.log(f.green.bold(` All checks passed (${e.ok}).`)),console.log()}export{P as a,J as b,ke as c,G as d,V as e,ne as f};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-AWQIUI7N.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as tt,c as nt}from"./chunk-GLQLCBJS.js";import{a as Ve}from"./chunk-GV7S5BAX.js";import{c as Ze}from"./chunk-SZDACK6O.js";import{b as ce}from"./chunk-AFRHKA7B.js";import{b as qe,e as Ye,f as Ge,i as Qe,k as Xe,l as et,q as rt}from"./chunk-
|
|
1
|
+
import{b as tt,c as nt}from"./chunk-GLQLCBJS.js";import{a as Ve}from"./chunk-GV7S5BAX.js";import{c as Ze}from"./chunk-SZDACK6O.js";import{b as ce}from"./chunk-AFRHKA7B.js";import{b as qe,e as Ye,f as Ge,i as Qe,k as Xe,l as et,q as rt}from"./chunk-J3SIOMDL.js";import{c as Ke,e as ze,f as Je}from"./chunk-KA2UIZXG.js";import{e as He,g as Ue,h as Be,i as de}from"./chunk-GQ76J72O.js";import{a as _e,b as oe,c as se,d as Le,e as ae}from"./chunk-QD6IICK7.js";import{y as Ce,z as hn}from"./chunk-WRICEAR6.js";import{b as Me,f as mn}from"./chunk-72SZI2UW.js";import{c as We,d as je}from"./chunk-QOYAX2FT.js";import{f as ie,n as gn}from"./chunk-UIBUZ2N3.js";import{existsSync as yn,mkdirSync as it,readFileSync as wn,writeFileSync as kn,renameSync as bn}from"fs";import{resolve as ot,dirname as vn}from"path";var st=class{filePath;log;constructor(e={}){let t=e.baseDir??ot(process.cwd(),".agentx");this.filePath=ot(t,"handover.json"),this.log=e.log??console.error.bind(console,"[handover]"),it(t,{recursive:!0})}key(e,t,n){return`${e}::${t}::${n||"-"}`}load(){if(!yn(this.filePath))return{version:1,overrides:{}};try{let e=wn(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){it(vn(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp-${process.pid}`;kn(t,JSON.stringify(e,null,2)),bn(t,this.filePath)}get(e,t,n){let o=this.load().overrides[this.key(e,t,n)];if(o&&!(o.expiresAt&&Date.parse(o.expiresAt)<Date.now()))return o}set(e){if(!e.channel||!e.chatId||!e.toAgent)throw new Error("channel, chatId and toAgent are required");let t=this.load(),n={...e,createdAt:e.createdAt??new Date().toISOString()};return t.overrides[this.key(n.channel,n.chatId,n.accountId)]=n,this.save(t),n}remove(e,t,n){let i=this.load(),o=this.key(e,t,n);return o in i.overrides?(delete i.overrides[o],this.save(i),!0):!1}consumeSummary(e,t,n){let i=this.load(),o=i.overrides[this.key(e,t,n)];if(!o||!o.summary||o.summaryConsumedAt)return;let s=o.summary;return o.summaryConsumedAt=new Date().toISOString(),this.save(i),s}listActive(){let e=this.load(),t=Date.now();return Object.values(e.overrides).filter(n=>!n.expiresAt||Date.parse(n.expiresAt)>=t)}listByAgent(e){let t=this.listActive();return{incoming:t.filter(n=>n.toAgent===e),outgoing:t.filter(n=>n.fromAgent===e)}}};import{readFileSync as ut,writeFileSync as le,appendFileSync as Rn,mkdirSync as $n,existsSync as pt,statSync as xn}from"fs";import{resolve as U}from"path";var at="[Agent Memory \u2014 persistent facts from past conversations]",Sn=2400;function dt(r,e){return r?`UNVERIFIED (${e===null?"age unknown":`${e}d old`}) `:""}function In(r,e=Date.now()){let t=ze(r,e),n=r.undated?"UNVERIFIED (never checked) ":dt(t,He(r.verifiedAt,e));return{line:`- [wiki ${r.id}] ${n}${r.subject} \xB7 ${r.attribute}: ${r.value} (${r.source}, checked ${r.verifiedAt.slice(0,10)} by ${r.verifiedBy})`,unverified:t}}function An(r,e){let n=!r.source.chatId.startsWith("-")&&/^\d+$/.test(r.source.chatId)?"DM":r.source.chatId,i=Be(r,e);return{line:`- [${r.category}] ${dt(i,Ue(r,e))}${r.content} (${n}, ${r.source.date})`,unverified:i}}function ct(r,e=[],t=Date.now()){let n=[],i=new Set,o=at.length,s=!1;for(let a of r){let d=e.length>0?Je(a.content,e):null,c,u,p=d&&Date.parse(a.createdAt)>Date.parse(d.verifiedAt)&&!a.content.toLowerCase().includes(d.value.toLowerCase());if(d&&!p){if(i.has(d.id))continue;i.add(d.id),c=In(d,t),u=d.id}else c=An(a,t),d&&(c.line+=` [differs from wiki ${d.id}]`);let f=c.unverified&&!s?de.length:0;if(o+f+c.line.length>Sn)break;n.push({fact:a,...c,...u?{wikiRef:u}:{}}),o+=f+c.line.length,f&&(s=!0)}return n}function lt(r){if(r.length===0)return"";let e=r.some(t=>t.unverified)?[de]:[];return[at,...e,...r.map(t=>t.line),"[End Memory]"].join(`
|
|
2
2
|
`)}var ft=200,Pn=7,gt=class{memoryDir;ledger;constructor(e=process.cwd()){this.memoryDir=U(e,".agentx/memory"),this.ledger=new Ke(U(e,".agentx/wiki")),pt(this.memoryDir)||$n(this.memoryDir,{recursive:!0})}filePath(e){return U(this.memoryDir,`${e}.jsonl`)}addMemory(e,t){if(t.category==="secret"||oe(t.content))return!1;let n=t.source.trust??_e(t.source.channel),i=t.review??Le(n),o={...t,source:{...t.source,trust:n},...i?{review:i}:{},id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,createdAt:new Date().toISOString()};return Rn(this.filePath(e),JSON.stringify(o)+`
|
|
3
3
|
`),!0}parsedCache=new Map;getAll(e){let t=this.filePath(e);if(!pt(t))return[];try{let{mtimeMs:n,size:i}=xn(t),o=this.parsedCache.get(t);if(o&&o.mtimeMs===n&&o.size===i)return o.facts.slice();let a=ut(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:n,size:i,facts:a}),a.slice()}catch{return[]}}findRelevant(e,t,n=8){let i=this.getAll(t).filter(ae);if(i.length===0)return[];let o=i.map(g=>`${g.keywords.join(" ")} ${g.content}`),s=U(this.memoryDir,`${t}_bm25_cache.json`),a=je(o,s),d=We(e,a),c=new Map(d.map(g=>[g.docIndex,g.score])),p=i.map((g,h)=>{let m=c.get(h)??0;return g.category==="commitment"&&(m+=1),{memory:g,score:m}}).filter(g=>g.score>0);if(p.length===0)return i.slice(-n);let f=p.sort((g,h)=>h.score-g.score).slice(0,n).map(g=>g.memory);if(f.length>0)try{this.recordAccess(t,f.map(g=>g.id))}catch{}return f}buildContext(e){return lt(this.contextLines(e))}contextFacts(e){return this.contextLines(e).map(t=>t.fact)}contextLines(e){let t=[];try{t=this.ledger.list()}catch{}return ct(e,t)}recordAccess(e,t){if(t.length===0)return;let n=this.getAll(e),i=new Set(t),o=!1;for(let s of n)if(i.has(s.id)){s.accessCount=(s.accessCount||0)+1,s.lastAccessed=new Date().toISOString();let a=s.intervalDays||1;s.intervalDays=Math.min(a*2,30),s.nextReview=new Date(Date.now()+s.intervalDays*864e5).toISOString(),o=!0}o&&le(this.filePath(e),n.map(s=>JSON.stringify(s)).join(`
|
|
@@ -25,4 +25,4 @@ import{b as tt,c as nt}from"./chunk-GLQLCBJS.js";import{a as Ve}from"./chunk-GV7
|
|
|
25
25
|
`).filter(Boolean),i=[];for(let o=n.length-1;o>=0&&i.length<t;o--)try{let s=JSON.parse(n[o]);(!e||s.person===e)&&i.push(s)}catch{}return i}load(){if(Oe(this.file))try{let e=JSON.parse(Ne(this.file,"utf-8"));if(e&&Array.isArray(e.devices))return e}catch{}return{devices:[]}}save(e){Gt(Qt(this.file),{recursive:!0});let t=`${this.file}.${process.pid}.${en(4).toString("hex")}.tmp`;Zt(t,JSON.stringify(e,null,2)+`
|
|
26
26
|
`,{encoding:"utf-8",mode:384}),Vt(t,this.file)}};import{extname as ui}from"path";var nn=/<agentx-artifact>([\s\S]*?)<\/agentx-artifact>/gi,rn=/<agentx-artifact>[\s\S]*$/i;function Ps(r,e=1/0,t=!1){let n=[],i=String(r??"");if(!/<agentx-artifact>/i.test(i))return{text:i,artifacts:n};let o=i.replace(nn,(s,a)=>{try{let d=JSON.parse(a.trim());if(d&&typeof d.filename=="string"&&typeof d.mime=="string"&&n.length<e){let c=d.mime,u=c.startsWith("image/")?"image":c==="application/pdf"?"pdf":c.startsWith("text/")?"text":"file";n.push({type:u,filename:d.filename,mime:c})}}catch{}return""});return{text:(t?o.replace(rn,""):o).trim(),artifacts:n}}function Ts(r,e=!1){let t=String(r??""),n=t;if(/<agentx-artifact>/i.test(t)){let i=t.replace(nn,(o,s)=>{try{let a=JSON.parse(s.trim());return a&&typeof a.filename=="string"?a.filename:""}catch{return""}});n=(e?i.replace(rn,""):i).trim()}return n.replace(/```[\s\S]*?```|`[^`\n]*`|!\[([^\]\n]*)\]\(([^)\s]+)\)/g,(i,o,s)=>o===void 0||s===void 0?i:`[${o||s}](${s})`)}var pi={".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"}},Os={bytes:20*1024*1024,perMessage:20,pathChars:512};function Ns(r){return pi[ui(r).toLowerCase()]??null}var fi=["[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(`
|
|
27
27
|
`);function Ds(r,e,t){return r==="app"&&e&&t!==!1?fi:void 0}import{lstatSync as Ee,mkdirSync as gi,readdirSync as mi,realpathSync as De,unlinkSync as hi}from"fs";import{join as ne,resolve as on}from"path";var sn=".agentx/outbox",yi=7*24*60*60*1e3;function wi(r,e){try{let t=De(on(e,r)),n=ne(t,sn);return De(n)===n&&Ee(n).isDirectory()?n:null}catch{return null}}function js(r,e={}){let t=e.cwd??process.cwd();if(e.create!==!1)try{let i=De(on(t,r));Ee(ne(i,".agentx"),{throwIfNoEntry:!1})?.isSymbolicLink()||gi(ne(i,sn),{recursive:!0})}catch{return 0}let n=wi(r,t);return n?an(n,(e.now??Date.now())-(e.maxAgeMs??yi)):0}function an(r,e){let t=0;for(let n of mi(r)){let i=ne(r,n);try{let o=Ee(i);o.isDirectory()?t+=an(i,e):Math.max(o.mtimeMs,o.ctimeMs)<e&&(hi(i),t++)}catch{}}return t}export{st as a,gt as b,mt as c,Fi as d,Nn as e,Wi as f,$ as g,pe as h,v as i,B as j,Bn as k,he as l,we as m,be as n,xe as o,Hr as p,qr as q,Te as r,ar as s,ai as t,tn as u,Ps as v,Ts as w,Os as x,Ns as y,Ds as z,sn as A,js as B};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-B65YTB3T.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as g,g as d}from"./chunk-DMHQIACQ.js";import{a as m}from"./chunk-GRMCAO3Q.js";var A=/^[A-Za-z0-9._-]{1,64}$/,y=/^[A-Za-z0-9_-]{1,64}$/,P=100,S=1e3,E=6e4,R=15*6e4;function u(s){return(s.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"node").slice(0,64)}function $(s,t,n){let a=/^bearer /i.test(s)?s.slice(7).trim():"",e="Phones paired with another computer need that computer's own peer token: give it a token in mesh.peers on both computers.";if(!a||n&&a===n)return{error:e};let p=new Set(t.filter(i=>i.token===a).map(i=>u(i.name)));if(p.size===0)return{error:e};if(p.size>1)return{error:`Several mesh.peers entries share this token (${[...p].join(", ")}). Give each computer its own token.`};let[r]=p,o=t.filter(i=>i.token!==a&&u(i.name)===r).map(i=>i.name);return o.length?{error:`mesh.peers names ${o.map(i=>`"${i}"`).join(", ")} too close to this computer's name: rename one so they differ in letters or digits.`}:{origin:r}}function C(s){return new Set(s.map(t=>u(t.name)))}function j(s,t,n,a){let e=s&&typeof s=="object"?s:{};if("error"in t)return{status:403,body:{error:t.error}};let p=t.origin;if(!A.test(p))return{status:403,body:{error:"this peer's name can't be used as a notification origin"}};if(!n)return{status:503,body:{error:a??"Notifications are not set up on the computer that sends them."}};if(e.op==="roster"){if(!Array.isArray(e.active)||e.active.length>S||!e.active.every(l=>typeof l=="string"&&y.test(l)))return{status:400,body:{error:"active must be a list of device ids"}};let h=n.store();return h?{status:200,body:{ok:!0,removed:h.pruneOrigin(p,e.active)}}:{status:503,body:{error:n.reason??"the database is unavailable"}}}if(e.op!=="app")return{status:400,body:{error:"op must be app or roster"}};let r=e.call&&typeof e.call=="object"?e.call:{},o=r.device&&typeof r.device=="object"?r.device:{},i=typeof r.path=="string"?r.path:"",c=r.method==="GET"||r.method==="POST"?r.method:"";if(!g(i)||!c)return{status:404,body:{error:"not found"}};if(typeof o.id!="string"||!y.test(o.id))return{status:400,body:{error:"device.id is required"}};let v=typeof o.name=="string"&&o.name.trim()?o.name.trim():o.id,b=r.body&&typeof r.body=="object"&&!Array.isArray(r.body)?r.body:{};return d({path:i,method:c,body:b,device:{id:m(p,o.id),name:k(`${v} (${p})`,P)}},n)}var f=class{constructor(t){this.deps=t}lastKey=null;lastSentAt=0;failing=!1;async tick(){let t=(this.deps.now??Date.now)(),n;try{n=[...new Set(this.deps.active())].sort()}catch(e){return this.deps.log?.(`push: phone list not read, not sent this time: ${e?.message??e}`),!1}let a=n.join(",");if(a===this.lastKey&&t-this.lastSentAt<R)return!1;try{return await this.deps.send(n),this.lastKey=a,this.lastSentAt=t,this.failing&&this.deps.log?.("push: phone list sent to the push host again"),this.failing=!1,!0}catch(e){return this.failing||this.deps.log?.(`push: phone list not sent to the push host, retrying every minute: ${e?.message??e}`),this.failing=!0,!1}}};function k(s,t){let n=[...s];return n.length>t?n.slice(0,t-1).join("")+"\u2026":s}export{E as a,R as b,u as c,$ as d,C as e,j as f,f as g};
|
|
2
|
+
//# sourceMappingURL=chunk-BRL3UPFW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/daemon/push-bridge.ts"],"sourcesContent":["import { isAppPushPath, runAppPush, type AppPushCall, type AppPushDeps, type AppPushResult } from \"./app-push\"\nimport { remoteDeviceId } from \"@/channels/push\"\nimport type { PushStore } from \"@/channels/push-store\"\n\n// --- Push bridge: phones paired with a relaying node (#711) ---\n//\n// Push has one host per mesh: the node that holds the VAPID keys and the\n// subscriptions table. A node with channels.push.relayTo forwards outbound\n// pushes to it (PushRelayAdapter); this module covers the other direction,\n// for a phone paired with that relaying node:\n//\n// phone → relay dashboard /api/app/push* (device token checked there)\n// → relay daemon POST /push/app (loopback)\n// → host daemon POST /push/app (the relay's peer token)\n// → runAppPush on the host's table, device id \"<origin>:<tok_…>\"\n//\n// The host never takes the origin from the request: it is the name of the\n// mesh.peers entry whose token the caller presented (pushBridgeCaller). A\n// caller holding only MESH_TOKEN, which every node accepts, names no node\n// and is refused, so one node can't subscribe, read or prune under\n// another's name.\n//\n// The relay also sends its roster of active token ids (\"roster\" op). The\n// host drops that node's rows whose phone is no longer in it, so\n// `agentx app revoke` on the relay stops the phone's notifications at the\n// next sync, as it does for a phone paired with the host.\n//\n// Every answer is { status, body }: the phone-app status and JSON, wrapped\n// so a relay can tell them apart from a transport failure.\n\n/** What a relay sends to the host's POST /push/app. */\nexport type PushBridgeRequest =\n | { op: \"app\"; origin: string; call: AppPushCall }\n | { op: \"roster\"; origin: string; active: string[] }\n\nconst ORIGIN = /^[A-Za-z0-9._-]{1,64}$/\nconst DEVICE_ID = /^[A-Za-z0-9_-]{1,64}$/\nconst MAX_NAME = 100\nconst MAX_ROSTER = 1000\n\n/** How often a relay checks its roster, and the longest it goes without\n * sending one even when nothing changed (the host may have restarted\n * from a backup, or missed a send while down). */\nexport const ROSTER_CHECK_MS = 60_000\nexport const ROSTER_RESEND_MS = 15 * 60_000\n\n/** This node's name as a relay origin: letters, digits, dot, dash and\n * underscore, so it can't contain the \":\" that scopes a device id. */\nexport function pushOrigin(nodeName: string): string {\n return (nodeName.replace(/[^A-Za-z0-9._-]+/g, \"-\").replace(/^-+|-+$/g, \"\") || \"node\").slice(0, 64)\n}\n\n/** Who is calling, on the host: the origin of the mesh.peers entry whose\n * token the caller presented, or why the call can't be tied to one. */\nexport type PushBridgeCaller = { origin: string } | { error: string }\n\nexport function pushBridgeCaller(\n authorization: string,\n peers: ReadonlyArray<{ name: string; token?: string }>,\n meshToken?: string,\n): PushBridgeCaller {\n const token = /^bearer /i.test(authorization) ? authorization.slice(7).trim() : \"\"\n const needs = \"Phones paired with another computer need that computer's own peer token: give it a token in mesh.peers on both computers.\"\n // MESH_TOKEN is shared by the whole mesh, so it says nothing about who sent it.\n if (!token || (meshToken && token === meshToken)) return { error: needs }\n const origins = new Set(peers.filter((p) => p.token === token).map((p) => pushOrigin(p.name)))\n if (origins.size === 0) return { error: needs }\n if (origins.size > 1) return { error: `Several mesh.peers entries share this token (${[...origins].join(\", \")}). Give each computer its own token.` }\n const [origin] = origins\n // Two peers whose names map to one origin would share, and prune, each\n // other's phones (\"my mac\" and \"my-mac\").\n const clash = peers.filter((p) => p.token !== token && pushOrigin(p.name) === origin).map((p) => p.name)\n if (clash.length) return { error: `mesh.peers names ${clash.map((n) => `\"${n}\"`).join(\", \")} too close to this computer's name: rename one so they differ in letters or digits.` }\n return { origin }\n}\n\n/** The origins of the configured peers, for checking a scoped device id on\n * the host: a row whose node left mesh.peers is no longer delivered. */\nexport function peerOrigins(peers: ReadonlyArray<{ name: string }>): Set<string> {\n return new Set(peers.map((p) => pushOrigin(p.name)))\n}\n\n/** On the host: answers one bridged request from `caller` (pushBridgeCaller).\n * `deps` is null when this node is not sending pushes itself; `reason`\n * then says why. An `origin` in the request itself is ignored. */\nexport function handlePushBridge(raw: unknown, caller: PushBridgeCaller, deps: (AppPushDeps & { store: () => PushStore | null }) | null, reason?: string): AppPushResult {\n const req = (raw && typeof raw === \"object\" ? raw : {}) as Record<string, any>\n if (\"error\" in caller) return { status: 403, body: { error: caller.error } }\n const origin = caller.origin\n if (!ORIGIN.test(origin)) return { status: 403, body: { error: \"this peer's name can't be used as a notification origin\" } }\n if (!deps) return { status: 503, body: { error: reason ?? \"Notifications are not set up on the computer that sends them.\" } }\n\n if (req.op === \"roster\") {\n if (!Array.isArray(req.active) || req.active.length > MAX_ROSTER || !req.active.every((id: unknown) => typeof id === \"string\" && DEVICE_ID.test(id))) {\n return { status: 400, body: { error: \"active must be a list of device ids\" } }\n }\n const store = deps.store()\n if (!store) return { status: 503, body: { error: deps.reason ?? \"the database is unavailable\" } }\n return { status: 200, body: { ok: true, removed: store.pruneOrigin(origin, req.active) } }\n }\n\n if (req.op !== \"app\") return { status: 400, body: { error: \"op must be app or roster\" } }\n const call = (req.call && typeof req.call === \"object\" ? req.call : {}) as Record<string, any>\n const device = (call.device && typeof call.device === \"object\" ? call.device : {}) as Record<string, any>\n const path = typeof call.path === \"string\" ? call.path : \"\"\n const method = call.method === \"GET\" || call.method === \"POST\" ? call.method : \"\"\n if (!isAppPushPath(path) || !method) return { status: 404, body: { error: \"not found\" } }\n if (typeof device.id !== \"string\" || !DEVICE_ID.test(device.id)) return { status: 400, body: { error: \"device.id is required\" } }\n const name = typeof device.name === \"string\" && device.name.trim() ? device.name.trim() : device.id\n const body = call.body && typeof call.body === \"object\" && !Array.isArray(call.body) ? call.body : {}\n return runAppPush({\n path,\n method,\n body,\n // The relay's name goes with the phone's, so `agentx app devices` and\n // the host's logs say where the phone is paired.\n device: { id: remoteDeviceId(origin, device.id), name: clip(`${name} (${origin})`, MAX_NAME) },\n }, deps)\n}\n\n/** On a relay: sends the roster of active token ids when it changed, or\n * every ROSTER_RESEND_MS. A failed send is retried at the next tick. */\nexport class PushRosterSync {\n private lastKey: string | null = null\n private lastSentAt = 0\n private failing = false\n\n constructor(private deps: {\n active: () => string[]\n send: (active: string[]) => Promise<unknown>\n now?: () => number\n log?: (...args: unknown[]) => void\n }) {}\n\n async tick(): Promise<boolean> {\n const now = (this.deps.now ?? Date.now)()\n let active: string[]\n try {\n active = [...new Set(this.deps.active())].sort()\n } catch (e: any) {\n // A torn or failed read of the phone list: sending nothing keeps the\n // host's rows; sending [] would unsubscribe every phone paired here.\n this.deps.log?.(`push: phone list not read, not sent this time: ${e?.message ?? e}`)\n return false\n }\n const key = active.join(\",\")\n if (key === this.lastKey && now - this.lastSentAt < ROSTER_RESEND_MS) return false\n try {\n await this.deps.send(active)\n this.lastKey = key\n this.lastSentAt = now\n if (this.failing) this.deps.log?.(\"push: phone list sent to the push host again\")\n this.failing = false\n return true\n } catch (e: any) {\n // Once per outage, not every minute.\n if (!this.failing) this.deps.log?.(`push: phone list not sent to the push host, retrying every minute: ${e?.message ?? e}`)\n this.failing = true\n return false\n }\n }\n}\n\nfunction clip(s: string, max: number): string {\n const chars = [...s]\n return chars.length > max ? chars.slice(0, max - 1).join(\"\") + \"…\" : s\n}\n"],"mappings":"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","names":["ORIGIN","DEVICE_ID","MAX_NAME","MAX_ROSTER","ROSTER_CHECK_MS","ROSTER_RESEND_MS","pushOrigin","nodeName","pushBridgeCaller","authorization","peers","meshToken","token","needs","origins","p","origin","clash","n","peerOrigins","handlePushBridge","raw","caller","deps","reason","req","id","store","call","device","path","method","isAppPushPath","name","body","runAppPush","remoteDeviceId","clip","PushRosterSync","now","active","key","max","chars"]}
|