agentix-cli 0.107.0 → 0.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-GRPPB7IF.js → App-4VWAQOVA.js} +2 -2
- package/dist/{ChatApp-ZEIEXPOB.js → ChatApp-KOTGUDZH.js} +2 -2
- package/dist/{agent-J22ODKSX.js → agent-CGRHC2IS.js} +2 -2
- package/dist/{board-dashboard-DUT3XBS7.js → board-dashboard-2X4OKKOM.js} +4 -4
- package/dist/{chunk-UEOG3H25.js → chunk-2VGYRETU.js} +2 -2
- package/dist/{chunk-UIDHTIPG.js → chunk-3TY6YJHO.js} +65 -65
- package/dist/chunk-3TY6YJHO.js.map +1 -0
- package/dist/{chunk-H5ZNKPXN.js → chunk-4UCDWEC4.js} +2 -2
- package/dist/{chunk-4YBFKN3B.js → chunk-5O6PIO7F.js} +2 -2
- package/dist/{chunk-JYFE6SQU.js → chunk-6F2E5NQA.js} +2 -2
- package/dist/chunk-6W74CHNW.js +26 -0
- package/dist/chunk-6W74CHNW.js.map +1 -0
- package/dist/{chunk-XQMLRZHY.js → chunk-BFOB6ERR.js} +2 -2
- package/dist/{chunk-OTCF46CF.js → chunk-BG6SOGKT.js} +2 -2
- package/dist/{chunk-UOOFNFEO.js → chunk-BZKGQMU2.js} +2 -2
- package/dist/{chunk-3RLYCNGP.js → chunk-CJL5OPNQ.js} +2 -2
- package/dist/{chunk-JUJPQWLG.js → chunk-CJR26JUI.js} +2 -2
- package/dist/{chunk-M6NIPFRY.js → chunk-D7M4WQFU.js} +2 -2
- package/dist/{chunk-M6NIPFRY.js.map → chunk-D7M4WQFU.js.map} +1 -1
- package/dist/{chunk-S4RQ6Q2B.js → chunk-FHI5WPFO.js} +2 -2
- package/dist/{chunk-FQGEDMG6.js → chunk-J32LSOBJ.js} +2 -2
- package/dist/{chunk-N72AJ2LS.js → chunk-KNIWHFOM.js} +7 -7
- package/dist/chunk-KNIWHFOM.js.map +1 -0
- package/dist/{chunk-GFON223J.js → chunk-MJWJ3JVA.js} +2 -2
- package/dist/{chunk-O5BBV4ZV.js → chunk-NIW75USA.js} +2 -2
- package/dist/{chunk-NL6JSS4E.js → chunk-QFP4YZII.js} +2 -2
- package/dist/{chunk-PEDNM2FA.js → chunk-QQAZ6EJP.js} +2 -2
- package/dist/{chunk-55MUAKXA.js → chunk-S4NZUPIN.js} +2 -2
- package/dist/{chunk-IRH2O2QB.js → chunk-SFPMS55Z.js} +2 -2
- package/dist/{chunk-CXCXMOTB.js → chunk-UTV4DRAW.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{client-WTC7P6PE.js → client-VYMTUZKN.js} +2 -2
- package/dist/{config-WG62KB23.js → config-J6CNV23P.js} +2 -2
- package/dist/config-mutator-RGC72OEU.js +2 -0
- package/dist/{doctor-XDR22CFD.js → doctor-GHUPUBET.js} +2 -2
- package/dist/index.d.ts +47 -3
- package/dist/index.js +1 -1
- package/dist/{program-PZO6XJYZ.js → program-H5V54XDB.js} +15 -15
- package/dist/{program-PZO6XJYZ.js.map → program-H5V54XDB.js.map} +1 -1
- package/dist/{promote-YEODWQX2.js → promote-KY3Y2PVU.js} +2 -2
- package/dist/{query-DC3O3QBJ.js → query-BYCRYDM3.js} +2 -2
- package/dist/{registry-PT5SRRZA.js → registry-NDFYNQG4.js} +2 -2
- package/dist/{request-planner-EP2XYPKZ.js → request-planner-YOUVO3BR.js} +2 -2
- package/dist/{review-candidates-VKH372WW.js → review-candidates-56ZPJNXW.js} +2 -2
- package/dist/{routing-OOIZ6433.js → routing-WKS2CZYF.js} +2 -2
- package/dist/schedule-tool-4L6QAILN.js +2 -0
- package/dist/scheduler-65SE3WJJ.js +2 -0
- package/dist/{seat-AGGELF3C.js → seat-EO3EVBH3.js} +2 -2
- package/dist/{select-6SXEU2NV.js → select-73JC2YBN.js} +2 -2
- package/dist/{set-enabled-GLWP7YDW.js → set-enabled-WQAO4BFF.js} +2 -2
- package/dist/{tool-23P66PKZ.js → tool-GCPMPPUE.js} +2 -2
- package/dist/{tool-UF6LOS6K.js → tool-QDU6MY6B.js} +2 -2
- package/dist/wiki-CQZE5Z5C.js +2 -0
- package/package.json +2 -1
- package/dist/chunk-DP7RTNDM.js +0 -24
- package/dist/chunk-DP7RTNDM.js.map +0 -1
- package/dist/chunk-N72AJ2LS.js.map +0 -1
- package/dist/chunk-UIDHTIPG.js.map +0 -1
- package/dist/config-mutator-7REOEXW4.js +0 -2
- package/dist/schedule-tool-W45LNZGX.js +0 -2
- package/dist/scheduler-YXU4G5NH.js +0 -2
- package/dist/wiki-6SCKSY4I.js +0 -2
- /package/dist/{App-GRPPB7IF.js.map → App-4VWAQOVA.js.map} +0 -0
- /package/dist/{ChatApp-ZEIEXPOB.js.map → ChatApp-KOTGUDZH.js.map} +0 -0
- /package/dist/{agent-J22ODKSX.js.map → agent-CGRHC2IS.js.map} +0 -0
- /package/dist/{board-dashboard-DUT3XBS7.js.map → board-dashboard-2X4OKKOM.js.map} +0 -0
- /package/dist/{chunk-UEOG3H25.js.map → chunk-2VGYRETU.js.map} +0 -0
- /package/dist/{chunk-H5ZNKPXN.js.map → chunk-4UCDWEC4.js.map} +0 -0
- /package/dist/{chunk-4YBFKN3B.js.map → chunk-5O6PIO7F.js.map} +0 -0
- /package/dist/{chunk-JYFE6SQU.js.map → chunk-6F2E5NQA.js.map} +0 -0
- /package/dist/{chunk-XQMLRZHY.js.map → chunk-BFOB6ERR.js.map} +0 -0
- /package/dist/{chunk-OTCF46CF.js.map → chunk-BG6SOGKT.js.map} +0 -0
- /package/dist/{chunk-UOOFNFEO.js.map → chunk-BZKGQMU2.js.map} +0 -0
- /package/dist/{chunk-3RLYCNGP.js.map → chunk-CJL5OPNQ.js.map} +0 -0
- /package/dist/{chunk-JUJPQWLG.js.map → chunk-CJR26JUI.js.map} +0 -0
- /package/dist/{chunk-S4RQ6Q2B.js.map → chunk-FHI5WPFO.js.map} +0 -0
- /package/dist/{chunk-FQGEDMG6.js.map → chunk-J32LSOBJ.js.map} +0 -0
- /package/dist/{chunk-GFON223J.js.map → chunk-MJWJ3JVA.js.map} +0 -0
- /package/dist/{chunk-O5BBV4ZV.js.map → chunk-NIW75USA.js.map} +0 -0
- /package/dist/{chunk-NL6JSS4E.js.map → chunk-QFP4YZII.js.map} +0 -0
- /package/dist/{chunk-PEDNM2FA.js.map → chunk-QQAZ6EJP.js.map} +0 -0
- /package/dist/{chunk-55MUAKXA.js.map → chunk-S4NZUPIN.js.map} +0 -0
- /package/dist/{chunk-IRH2O2QB.js.map → chunk-SFPMS55Z.js.map} +0 -0
- /package/dist/{chunk-CXCXMOTB.js.map → chunk-UTV4DRAW.js.map} +0 -0
- /package/dist/{client-WTC7P6PE.js.map → client-VYMTUZKN.js.map} +0 -0
- /package/dist/{config-WG62KB23.js.map → config-J6CNV23P.js.map} +0 -0
- /package/dist/{config-mutator-7REOEXW4.js.map → config-mutator-RGC72OEU.js.map} +0 -0
- /package/dist/{doctor-XDR22CFD.js.map → doctor-GHUPUBET.js.map} +0 -0
- /package/dist/{promote-YEODWQX2.js.map → promote-KY3Y2PVU.js.map} +0 -0
- /package/dist/{query-DC3O3QBJ.js.map → query-BYCRYDM3.js.map} +0 -0
- /package/dist/{registry-PT5SRRZA.js.map → registry-NDFYNQG4.js.map} +0 -0
- /package/dist/{request-planner-EP2XYPKZ.js.map → request-planner-YOUVO3BR.js.map} +0 -0
- /package/dist/{review-candidates-VKH372WW.js.map → review-candidates-56ZPJNXW.js.map} +0 -0
- /package/dist/{routing-OOIZ6433.js.map → routing-WKS2CZYF.js.map} +0 -0
- /package/dist/{schedule-tool-W45LNZGX.js.map → schedule-tool-4L6QAILN.js.map} +0 -0
- /package/dist/{scheduler-YXU4G5NH.js.map → scheduler-65SE3WJJ.js.map} +0 -0
- /package/dist/{seat-AGGELF3C.js.map → seat-EO3EVBH3.js.map} +0 -0
- /package/dist/{select-6SXEU2NV.js.map → select-73JC2YBN.js.map} +0 -0
- /package/dist/{set-enabled-GLWP7YDW.js.map → set-enabled-WQAO4BFF.js.map} +0 -0
- /package/dist/{tool-23P66PKZ.js.map → tool-GCPMPPUE.js.map} +0 -0
- /package/dist/{tool-UF6LOS6K.js.map → tool-QDU6MY6B.js.map} +0 -0
- /package/dist/{wiki-6SCKSY4I.js.map → wiki-CQZE5Z5C.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=promote-
|
|
1
|
+
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-5O6PIO7F.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-6W74CHNW.js";import"./chunk-CJL5OPNQ.js";import"./chunk-CECHWYJ2.js";import"./chunk-QFP4YZII.js";import"./chunk-WPNRDEHW.js";import"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
|
|
2
|
+
//# sourceMappingURL=promote-KY3Y2PVU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=query-
|
|
1
|
+
import{a,b,c}from"./chunk-BZKGQMU2.js";import"./chunk-QFP4YZII.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_GRAPH_WEIGHT,a as agenticQuery,c as rankCatalogPool};
|
|
2
|
+
//# sourceMappingURL=query-BYCRYDM3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=registry-
|
|
1
|
+
import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l}from"./chunk-3TY6YJHO.js";import"./chunk-2VGYRETU.js";import"./chunk-GLQLCBJS.js";import"./chunk-6W74CHNW.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-QQAZ6EJP.js";import"./chunk-6F2E5NQA.js";import"./chunk-VWTBHLMX.js";import"./chunk-BFOB6ERR.js";import"./chunk-CJL5OPNQ.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-J32LSOBJ.js";import"./chunk-MYVHVJWZ.js";import"./chunk-UDJAODAB.js";import"./chunk-23A5K5UW.js";import"./chunk-QD6IICK7.js";import"./chunk-CECHWYJ2.js";import"./chunk-BZKGQMU2.js";import"./chunk-QFP4YZII.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{k as AgentRegistry,f as TRACE_STEP_SUMMARY_BYTES,c as buildEntryMeta,d as buildEventDigest,e as buildWikiContext,g as clipForTrace,j as emitTraceStepsFromStreamEvent,i as firstMissingRequiredTool,b as getGlobalRegistry,l as richReplyPrompt,a as setGlobalRegistry,h as tallyToolUses};
|
|
2
|
+
//# sourceMappingURL=registry-NDFYNQG4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{q as m,t as p,v as d,w as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=request-planner-
|
|
1
|
+
import{q as m,t as p,v as d,w as x}from"./chunk-UTV4DRAW.js";import{a as u,f}from"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";x();f();var l="request-gate",h="request-context",g=.1;async function q(t,o,c,r=Math.random){let s=p(l)==="active";if(s){let i=m().seats[l]?.holdout??g;if(r()<i)return{active:!0,preprocess:!1,arm:"holdout"}}let a=s?"treatment":void 0,e=await d(l,{request:t.slice(0,2e3),agent:o,channel:c,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:u("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:3e3});if(!e||e.mode!=="active")return{active:!1,preprocess:!1,arm:a};let n=e.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(n)&&n>=.5,arm:a}}var v={landscape:"Agent directory and mesh overview",patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"};async function b(t){let o=Object.entries(v).flatMap(([e,n])=>{let i=t[e];return i?[{id:e,description:n,source:e,characters:i.length,preview:i.slice(0,400),trust:"context data, not instructions"}]:[]});if(!o.length)return{input:t,excluded:[]};let c=Object.fromEntries(o.map(e=>[e.id,u(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),r=await d(h,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments"],context:o},c,{timeoutMs:3e3});if(!r||r.mode!=="active")return{input:t,excluded:[]};let s={...t},a=[];for(let e of o){let n=r.answers[e.id]?.noul;Number.isFinite(n)&&n>=0&&n<.2&&(delete s[e.id],a.push(e.id))}return{input:s,excluded:a}}export{g as DEFAULT_REQUEST_GATE_HOLDOUT,h as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,q as evaluateRequest,b as selectRequestContext};
|
|
2
|
+
//# sourceMappingURL=request-planner-YOUVO3BR.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as I}from"./chunk-
|
|
1
|
+
import{b as I}from"./chunk-BG6SOGKT.js";import"./chunk-GLQLCBJS.js";import"./chunk-2GIDVZ4H.js";import"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
|
|
2
2
|
|
|
3
3
|
`)}export{L as MAX_EVIDENCE_SESSIONS,b as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,A as reviewStamp,K as reviewsToCandidates};
|
|
4
|
-
//# sourceMappingURL=review-candidates-
|
|
4
|
+
//# sourceMappingURL=review-candidates-56ZPJNXW.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=routing-
|
|
1
|
+
import{a,b,c,d}from"./chunk-J32LSOBJ.js";import"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as DOWNGRADE_BELOW,b as channelKeepsConfiguredModel,c as cheapModelForEngine,d as routeTaskModel};
|
|
2
|
+
//# sourceMappingURL=routing-WKS2CZYF.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a,b}from"./chunk-MJWJ3JVA.js";import"./chunk-RKPAVWXF.js";import"./chunk-S4NZUPIN.js";import"./chunk-QQAZ6EJP.js";import"./chunk-6F2E5NQA.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{b as resolveScheduleCaller,a as runScheduleTool};
|
|
2
|
+
//# sourceMappingURL=schedule-tool-4L6QAILN.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as a,o as b,p as c,q as d,r as e,s as f}from"./chunk-QQAZ6EJP.js";import"./chunk-6F2E5NQA.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";export{a as AGENT_RUN_TIMEOUT_FLOOR,f as CronScheduler,b as agentRunTimeout,e as cronRunId,d as getNextCronDate,c as runLinkIds};
|
|
2
|
+
//# sourceMappingURL=scheduler-65SE3WJJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=seat-
|
|
1
|
+
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i}from"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";i();export{h as askSeat,a as configureDecisions,c as decisionsRuntime,f as getSeatMode,d as parseSeatMode,g as recordSeatOutcome,b as resetDecisionsRuntime,e as seatEnvVar};
|
|
2
|
+
//# sourceMappingURL=seat-EO3EVBH3.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{v as S,w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=select-
|
|
1
|
+
import{v as S,w}from"./chunk-UTV4DRAW.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
|
|
2
|
+
//# sourceMappingURL=select-73JC2YBN.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=set-enabled-
|
|
1
|
+
import{b as a}from"./chunk-6F2E5NQA.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
|
|
2
|
+
//# sourceMappingURL=set-enabled-WQAO4BFF.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as h}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-MJWJ3JVA.js";import"./chunk-RKPAVWXF.js";import{b as u}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import{f}from"./chunk-Y4CYQV7G.js";import"./chunk-S4NZUPIN.js";import"./chunk-QQAZ6EJP.js";import"./chunk-6F2E5NQA.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var m=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function y(e){return typeof e=="string"?e.trim():""}async function A(e,i){let c=i.fetch??fetch,d=i.daemonUrl.replace(/\/$/,""),s=(y(e.action)||"create").toLowerCase(),r=h(e,i.env??process.env);if(s==="status"){let o=y(e.id);if(!o)return"Error: `id` is required for status (the card id you got when you raised it).";try{let n=await c(`${d}/approvals/${encodeURIComponent(o)}`,{signal:AbortSignal.timeout(1e4)}),a=await n.json().catch(()=>({}));if(!n.ok)return`Error: ${a?.error||`HTTP ${n.status}`}`;let t=a.card;if(r&&t.raised_by!==r.agentId)return`Error: card "${o}" was raised by another agent.`;if(t.status==="pending")return`Card ${t.id} is still waiting for the operator. It expires ${t.expires}; then "${t.if_silent}" applies.`;if(t.status==="decided"){let p=t.verdict==="yes"?f(t).join(`
|
|
2
2
|
`):"";return`Card ${t.id}: the operator said ${String(t.verdict).toUpperCase()}.${t.note?` Note: ${t.note}`:""}${p?`
|
|
3
3
|
${p}`:""}`}return`Card ${t.id} expired unanswered; the default applied: ${t.outcome??t.if_silent}.`}catch(n){return`Error: couldn't reach the daemon (${n?.message??n}).`}}if(s!=="create")return`Error: unknown action "${s}". Use create or status.`;if(!r)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=r.channel&&r.chatId&&!m.has(r.channel)?{channel:r.channel,chatId:r.chatId,...r.accountId?{accountId:r.accountId}:{}}:void 0,$={title:e.title,ask:e.ask,recommend:e.recommend,if_silent:e.if_silent,expires:e.expires,source:e.source,choices:e.choices,draft:e.draft,say:e.say,context:e.context,raised_by:r.agentId,...l?{reply:l}:{}};try{let o=await c(`${d}/approvals`,{method:"POST",headers:{"Content-Type":"application/json",...u(i.env??process.env)},body:JSON.stringify($),signal:AbortSignal.timeout(1e4)}),n=await o.json().catch(()=>({}));if(!o.ok)return`Error: ${n?.error||`HTTP ${o.status}`}`;let a=n.card;return[`Decision card ${a.id} is in the operator's Approvals inbox.`,`If nobody answers by ${a.expires}, "${a.if_silent}" applies.`,"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat."].join(" ")}catch(o){return`Error: couldn't reach the daemon (${o?.message??o}).`}}export{A as runApprovalTool};
|
|
4
|
-
//# sourceMappingURL=tool-
|
|
4
|
+
//# sourceMappingURL=tool-GCPMPPUE.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as g}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-MJWJ3JVA.js";import"./chunk-RKPAVWXF.js";import{b as h}from"./chunk-LLNPKE7H.js";import"./chunk-SHEUCITK.js";import"./chunk-S4NZUPIN.js";import"./chunk-QQAZ6EJP.js";import"./chunk-6F2E5NQA.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-QIJLFPWE.js";var $=t=>typeof t=="string"?t.trim():"",w={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"};function f(t){return t.length?t.map(e=>{let i=new Date(e.createdAt).toISOString().slice(0,16).replace("T"," "),a=e.state==="waiting_owner"&&e.question?` Question: ${e.question}`:e.state==="needs_attention"&&e.attentionReason?` ${e.attentionReason}`:"",n=String(e.text).replace(/\s+/g," ").trim();return`- ${e.id} [${w[e.state]??e.state}] ${i} UTC, ${e.channel}, ${e.agentId}: ${n.length>160?`${n.slice(0,159)}\u2026`:n}.${a}`}).join(`
|
|
2
2
|
`):"No open requests."}async function m(t,e){let i=e.fetch??fetch,a=e.daemonUrl.replace(/\/$/,""),n=($(t.action)||"list").toLowerCase();try{if(n==="list"){let d=await i(`${a}/requests`,{signal:AbortSignal.timeout(1e4)}),r=await d.json().catch(()=>({}));return d.ok?r.enabled?`${r.count} open request${r.count===1?"":"s"}, oldest first.
|
|
3
3
|
${f(r.items??[])}`:"Requests are turned off on this node (requests.enabled), so nothing is recorded.":`Error: ${r?.error||`HTTP ${d.status}`}`}let s=e.env??process.env,u=g(t,s);if(!u)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let c=await i(`${a}/requests`,{method:"POST",headers:{"Content-Type":"application/json",...h(s)},body:JSON.stringify({action:n,agentId:u.agentId,id:t.id,question:t.question,evidence:t.evidence,reason:t.reason}),signal:AbortSignal.timeout(1e4)}),l=await c.json().catch(()=>({}));if(!c.ok)return`Error: ${l?.error||`HTTP ${c.status}`}`;let o=l.request;return n==="accept"?`Request ${o.id} is open and in progress. Close it with done (and a link to the evidence) or decline (and the reason); it stays on the owner's list until then.`:n==="wait"?`Request ${o.id} is waiting on the owner with your question. Ask them the question now, once.`:n==="done"?`Request ${o.id} is closed as done. Evidence: ${o.evidence}`:`Request ${o.id} is closed as declined. Reason: ${o.closeReason}`}catch(s){return`Error: couldn't reach the daemon (${s?.message??s}).`}}export{f as describeOpen,m as runRequestTool};
|
|
4
|
-
//# sourceMappingURL=tool-
|
|
4
|
+
//# sourceMappingURL=tool-QDU6MY6B.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-BFOB6ERR.js";import{a}from"./chunk-CJL5OPNQ.js";import"./chunk-CECHWYJ2.js";import{a as c}from"./chunk-BZKGQMU2.js";import"./chunk-QFP4YZII.js";import"./chunk-WPNRDEHW.js";import"./chunk-2GIDVZ4H.js";import"./chunk-UTV4DRAW.js";import"./chunk-72SZI2UW.js";import"./chunk-FX3D7YON.js";import"./chunk-FCPTN6NF.js";import"./chunk-QOYAX2FT.js";import"./chunk-5MUJZODV.js";import"./chunk-7I7IEX4S.js";import"./chunk-D7M4WQFU.js";import"./chunk-RJ7DASOU.js";import"./chunk-BRK6M6LA.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
|
|
2
|
+
//# sourceMappingURL=wiki-CQZE5Z5C.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentix-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.109.0",
|
|
4
4
|
"description": "AI operations layer for small and medium businesses. Routes Telegram, WhatsApp, GitLab, GitHub, crons, webhooks, and mesh tasks to AI agents. Web wizard for operators, CLI for engineers. Self-hosted.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"typecheck": "tsc --noEmit",
|
|
60
60
|
"bench:context": "tsx bench/context-size.ts",
|
|
61
61
|
"bench:profiles": "tsx bench/context-profiles.ts",
|
|
62
|
+
"bench:compare": "tsx bench/compare-claude-code.ts",
|
|
62
63
|
"test": "vitest run",
|
|
63
64
|
"clean": "rimraf dist",
|
|
64
65
|
"format:write": "prettier --write \"src/**/*.{ts,tsx,mdx}\" --cache",
|
package/dist/chunk-DP7RTNDM.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{existsSync as y,mkdirSync as q,readdirSync as z,readFileSync as B,unlinkSync as S,writeFileSync as w}from"fs";import{resolve as p}from"path";import{createHash as _}from"crypto";import{existsSync as I,mkdirSync as V,readdirSync as O,readFileSync as Y,renameSync as N,unlinkSync as L,writeFileSync as T}from"fs";import{basename as C,dirname as F,resolve as l}from"path";var U=20,g=class extends Error{constructor(n){super(n?"memory changed since you read it (etag mismatch)":"memory does not exist (etag mismatch)");this.currentEtag=n;this.name="MemoryConflictError"}};function f(r){return _("sha256").update(r).digest("hex").slice(0,16)}function b(r,e){if(!e)return;let n=r===null?null:f(r);if(e.ifNoneMatch==="*"&&n!==null)throw new g(n);if(e.ifMatch!==void 0&&e.ifMatch!==n)throw new g(n)}function W(r,e){let n=l(F(r),`.${C(r)}.${process.pid}.${Date.now()}.tmp`);T(n,e),N(n,r)}function D(r){return l(F(r),"_versions",C(r,".md"))}function k(r,e){if(e===null)return;let n=D(r);V(n,{recursive:!0});let i=new Date().toISOString().replace(/[:.]/g,"-"),t=l(n,`${i}.md`);for(let o=1;I(t);o++)t=l(n,`${i}-${o}.md`);T(t,e),X(n)}function X(r){let e=O(r).filter(n=>n.endsWith(".md")).sort();for(let n of e.slice(0,Math.max(0,e.length-U)))try{L(l(r,n))}catch{}}function P(r){let e=D(r);return I(e)?O(e).filter(n=>n.endsWith(".md")).sort().reverse().map(n=>({id:n.slice(0,-3),content:Y(l(e,n),"utf-8")})):[]}var u=["user","feedback","project","reference"],j=class{baseDir;constructor(e={}){let n=e.baseDir??p(process.cwd(),".agentx");this.baseDir=p(n,"agent-memory")}dirFor(e){let n=A(e),i=p(this.baseDir,n);return q(i,{recursive:!0}),i}fileFor(e,n,i){return p(this.dirFor(e),`${n}_${A(i)}.md`)}indexPath(e){return p(this.dirFor(e),"MEMORY.md")}save(e,n){if(!u.includes(e.type))throw new Error(`invalid memory type: ${e.type}`);if(!e.name.trim())throw new Error("memory name is required");if(!e.description.trim())throw new Error("memory description is required");let i=this.fileFor(e.agentId,e.type,e.name),t=m(i);b(t,n);let o=new Date().toISOString(),s=o;if(t){let a=h(t);a&&(s=a.createdAt)}let c={name:A(e.name),type:e.type,description:e.description.trim(),body:e.body.trimEnd(),createdAt:s,updatedAt:o,...e.author?{author:e.author}:{},...e.taskId?{taskId:e.taskId}:{}},d=G(c);return k(i,t),W(i,d),this.rewriteIndex(e.agentId),{...c,etag:f(d)}}append(e,n){let i=this.get(e.agentId,e.name),t=i?`${i.body.trimEnd()}
|
|
2
|
-
|
|
3
|
-
${e.body.trim()}`:e.body;return this.save({...e,type:i?.type??e.type,body:t},n)}get(e,n){for(let i of u){let t=this.fileFor(e,i,n);if(!y(t))continue;let o=m(t)??"",s=h(o);if(s)return{...s,etag:f(o)}}return null}list(e){let n=this.dirFor(e);if(!y(n))return[];let i=[];for(let t of z(n,{withFileTypes:!0})){if(!t.isFile()||!t.name.endsWith(".md")||t.name==="MEMORY.md")continue;let o=m(p(n,t.name))??"",s=h(o);s&&i.push({...s,etag:f(o)})}return i.sort((t,o)=>{let s=u.indexOf(t.type),c=u.indexOf(o.type);return s!==c?s-c:t.name.localeCompare(o.name)})}remove(e,n,i){let t=u.map(o=>this.fileFor(e,o,n)).filter(o=>y(o));if(t.length===0)return!1;i&&b(m(t[0]),i);for(let o of t)k(o,m(o)),S(o);return this.rewriteIndex(e),!0}versions(e,n){return u.flatMap(i=>P(this.fileFor(e,i,n))).sort((i,t)=>t.id.localeCompare(i.id)).map(i=>{let t=h(i.content);return{id:i.id,record:t?{...t,etag:f(i.content)}:null}})}restore(e,n,i,t={}){let o=this.versions(e,n).find(a=>a.id===i);if(!o?.record)return null;let{type:s,description:c,body:d}=o.record;return this.save({agentId:e,type:s,name:n,description:c,body:d,...t})}indexMarkdown(e){let n=this.indexPath(e);return m(n)??""}syncToWorkspace(e,n){if(!n)return;let i=this.indexMarkdown(e).trim(),t=p(n,".agentx-memory.md");i?w(t,i+`
|
|
4
|
-
`):y(t)&&S(t);let o=p(n,"CLAUDE.md"),s="<!-- AGENTX-MEMORY-START \u2014 auto-managed by agentx; edit via `agentx memory` -->",c="<!-- AGENTX-MEMORY-END -->",d=i?`${s}
|
|
5
|
-
${i}
|
|
6
|
-
${c}`:"",a=m(o)??"",x=a.indexOf(s),E=a.indexOf(c),M;if(x>=0&&E>x){let $=a.slice(0,x).replace(/\n+$/,""),v=a.slice(E+c.length).replace(/^\n+/,"");M=d?[$,d,v].filter(Boolean).join(`
|
|
7
|
-
|
|
8
|
-
`)+`
|
|
9
|
-
`:[$,v].filter(Boolean).join(`
|
|
10
|
-
|
|
11
|
-
`)+($||v?`
|
|
12
|
-
`:"")}else if(d)M=a?a.replace(/\n+$/,"")+`
|
|
13
|
-
|
|
14
|
-
`+d+`
|
|
15
|
-
`:d+`
|
|
16
|
-
`;else return;w(o,M)}rewriteIndex(e){let n=this.list(e);if(n.length===0){let o=this.indexPath(e);y(o)&&S(o);return}let i={user:[],feedback:[],project:[],reference:[]};for(let o of n)i[o.type].push(o);let t=[];t.push(`# Memory \u2014 ${e}`,""),t.push("This is the agent's experiential memory: user preferences,"),t.push("feedback, project-specific context, and external references."),t.push("Updated via `agentx memory` CLI or by the agent itself.");for(let o of u){let s=i[o];if(s.length){t.push("",`## ${J(o)}`,"");for(let c of s)t.push(`- **${c.name}** \u2014 ${c.description} _(updated ${c.updatedAt.slice(0,10)})_`)}}t.push(""),w(this.indexPath(e),t.join(`
|
|
17
|
-
`))}};function G(r){return["---",`name: ${r.name}`,`description: ${R(r.description)}`,`type: ${r.type}`,`created: ${r.createdAt}`,`updated: ${r.updatedAt}`,...r.author?[`author: ${R(r.author)}`]:[],...r.taskId?[`task: ${R(r.taskId)}`]:[],"---",""].join(`
|
|
18
|
-
`)+r.body+`
|
|
19
|
-
`}function h(r){if(!r.startsWith(`---
|
|
20
|
-
`))return null;let e=r.indexOf(`
|
|
21
|
-
---
|
|
22
|
-
`,4);if(e<0)return null;let n=r.slice(4,e),i=r.slice(e+5).replace(/^\n+/,"").trimEnd(),t={};for(let o of n.split(`
|
|
23
|
-
`)){let s=o.indexOf(":");if(s<0)continue;let c=o.slice(0,s).trim(),d=H(o.slice(s+1).trim());t[c]=d}return!t.name||!t.type||!t.description||!u.includes(t.type)?null:{name:t.name,type:t.type,description:t.description,body:i,createdAt:t.created??"",updatedAt:t.updated??t.created??"",...t.author?{author:t.author}:{},...t.task?{taskId:t.task}:{}}}function R(r){return/[:#\n]/.test(r)?`"${r.replace(/"/g,'\\"')}"`:r}function H(r){return r.startsWith('"')&&r.endsWith('"')&&r.length>=2?r.slice(1,-1).replace(/\\"/g,'"'):r}function A(r){return r.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")||"unnamed"}function J(r){return r.charAt(0).toUpperCase()+r.slice(1)}function m(r){try{return B(r,"utf-8")}catch{return null}}export{g as a,j as b};
|
|
24
|
-
//# sourceMappingURL=chunk-DP7RTNDM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agents/agent-memory.ts","../src/agents/memory-versions.ts"],"sourcesContent":["import { existsSync, mkdirSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from \"fs\"\nimport { resolve } from \"path\"\nimport { atomicWrite, checkCondition, etagOf, readVersions, snapshot, type WriteCondition } from \"./memory-versions\"\n\n// --- AgentMemory: Claude-Code-style structured memory per agent ---\n//\n// Four memory kinds, each a separate file with YAML frontmatter + markdown\n// body, gathered under a per-agent root index (MEMORY.md):\n//\n// user/ — \"who this human is, what they do, what they know\"\n// feedback/ — \"rules the user gave me; what to do / avoid\"\n// project/ — \"facts about current work the code can't reveal\"\n// reference/ — \"pointers to external systems (linear board, grafana, …)\"\n//\n// Layout on disk:\n// .agentx/agent-memory/<agentId>/\n// MEMORY.md — one-line hook per memory, auto-maintained\n// user_deep_backend_expertise.md\n// feedback_no_mock_database.md\n// ...\n// _versions/<type>_<name>/<timestamp>.md — prior versions (memory-versions.ts)\n//\n// Philosophy: the wiki is authoritative / cross-agent / documented.\n// Memory is experiential / per-agent / \"what I learned across runs.\"\n// Durable, cross-agent-relevant memories get promoted to shared wiki\n// articles by `agentx wiki promote` (src/wiki/promote.ts) — corroboration\n// across agents boosts confidence but isn't required. This module stays\n// read-only from the promotion pipeline's perspective; authors keep both\n// layers parallel.\n\nexport type MemoryType = \"user\" | \"feedback\" | \"project\" | \"reference\"\n\nexport interface MemoryRecord {\n /** Slug-safe name, unique within an agent. */\n name: string\n type: MemoryType\n /** One-line hook — used as the MEMORY.md index entry. */\n description: string\n /** The body, excluding frontmatter. */\n body: string\n createdAt: string\n updatedAt: string\n /** Who wrote this version: an agent id verified against its running\n * task, \"operator\" (CLI), or \"unverified\" (a caller we couldn't check). */\n author?: string\n /** The running task that wrote it; opens on the Task page. */\n taskId?: string\n /** Content hash of the file as stored. Pass back as `ifMatch` to change\n * it only if nobody else has since. Not stored in the file. */\n etag?: string\n}\n\n/** Who is making a change, recorded in the memory's frontmatter. */\nexport interface MemoryProvenance {\n author?: string\n taskId?: string\n}\n\n/** One entry in a memory's history. */\nexport interface MemoryVersion {\n id: string\n record: MemoryRecord | null\n}\n\nconst TYPES: MemoryType[] = [\"user\", \"feedback\", \"project\", \"reference\"]\n\nexport interface AgentMemoryOptions {\n baseDir?: string\n}\n\nexport class AgentMemory {\n readonly baseDir: string\n\n constructor(opts: AgentMemoryOptions = {}) {\n const root = opts.baseDir ?? resolve(process.cwd(), \".agentx\")\n this.baseDir = resolve(root, \"agent-memory\")\n }\n\n private dirFor(agentId: string): string {\n const safe = slug(agentId)\n const dir = resolve(this.baseDir, safe)\n mkdirSync(dir, { recursive: true })\n return dir\n }\n\n private fileFor(agentId: string, type: MemoryType, name: string): string {\n return resolve(this.dirFor(agentId), `${type}_${slug(name)}.md`)\n }\n\n private indexPath(agentId: string): string {\n return resolve(this.dirFor(agentId), \"MEMORY.md\")\n }\n\n /** Save (create or update) a memory. Keeps createdAt stable across\n * updates; bumps updatedAt. The replaced version goes to history first.\n * With `cond`, throws MemoryConflictError instead of overwriting a\n * version the caller hasn't seen. Always rewrites MEMORY.md. */\n save(args: {\n agentId: string\n type: MemoryType\n name: string\n description: string\n body: string\n } & MemoryProvenance, cond?: WriteCondition): MemoryRecord {\n if (!TYPES.includes(args.type)) throw new Error(`invalid memory type: ${args.type}`)\n if (!args.name.trim()) throw new Error(\"memory name is required\")\n if (!args.description.trim()) throw new Error(\"memory description is required\")\n\n const path = this.fileFor(args.agentId, args.type, args.name)\n const existing = safeRead(path)\n checkCondition(existing, cond)\n const now = new Date().toISOString()\n let createdAt = now\n if (existing) {\n const parsed = parseMemoryFile(existing)\n if (parsed) createdAt = parsed.createdAt\n }\n const record: MemoryRecord = {\n name: slug(args.name),\n type: args.type,\n description: args.description.trim(),\n body: args.body.trimEnd(),\n createdAt,\n updatedAt: now,\n ...(args.author ? { author: args.author } : {}),\n ...(args.taskId ? { taskId: args.taskId } : {}),\n }\n const content = serialize(record)\n snapshot(path, existing)\n atomicWrite(path, content)\n this.rewriteIndex(args.agentId)\n return { ...record, etag: etagOf(content) }\n }\n\n /** Add to the end of an existing memory's body (or create it) in one\n * step, so two appends can't lose each other. */\n append(args: {\n agentId: string\n type: MemoryType\n name: string\n description: string\n body: string\n } & MemoryProvenance, cond?: WriteCondition): MemoryRecord {\n const existing = this.get(args.agentId, args.name)\n const body = existing ? `${existing.body.trimEnd()}\\n\\n${args.body.trim()}` : args.body\n return this.save({ ...args, type: existing?.type ?? args.type, body }, cond)\n }\n\n get(agentId: string, name: string): MemoryRecord | null {\n for (const type of TYPES) {\n const path = this.fileFor(agentId, type, name)\n if (!existsSync(path)) continue\n const raw = safeRead(path) ?? \"\"\n const parsed = parseMemoryFile(raw)\n if (parsed) return { ...parsed, etag: etagOf(raw) }\n }\n return null\n }\n\n /** Every memory for an agent. Sorted by type then name for stable\n * index rendering. */\n list(agentId: string): MemoryRecord[] {\n const dir = this.dirFor(agentId)\n if (!existsSync(dir)) return []\n const out: MemoryRecord[] = []\n for (const entry of readdirSync(dir, { withFileTypes: true })) {\n if (!entry.isFile() || !entry.name.endsWith(\".md\") || entry.name === \"MEMORY.md\") continue\n const raw = safeRead(resolve(dir, entry.name)) ?? \"\"\n const parsed = parseMemoryFile(raw)\n if (parsed) out.push({ ...parsed, etag: etagOf(raw) })\n }\n return out.sort((a, b) => {\n const ta = TYPES.indexOf(a.type)\n const tb = TYPES.indexOf(b.type)\n if (ta !== tb) return ta - tb\n return a.name.localeCompare(b.name)\n })\n }\n\n /** Remove a memory by name. The removed version stays in history, so\n * `restore` can bring it back. With `cond.ifMatch`, throws\n * MemoryConflictError if it changed since the caller read it. Returns\n * true on success, false if none found. */\n remove(agentId: string, name: string, cond?: WriteCondition): boolean {\n const paths = TYPES.map((t) => this.fileFor(agentId, t, name)).filter((p) => existsSync(p))\n if (paths.length === 0) return false\n if (cond) checkCondition(safeRead(paths[0]), cond)\n for (const path of paths) {\n snapshot(path, safeRead(path))\n unlinkSync(path)\n }\n this.rewriteIndex(agentId)\n return true\n }\n\n /** Prior versions of a memory, newest first, including ones kept after\n * it was deleted. */\n versions(agentId: string, name: string): MemoryVersion[] {\n return TYPES\n .flatMap((t) => readVersions(this.fileFor(agentId, t, name)))\n .sort((a, b) => b.id.localeCompare(a.id))\n .map((v) => {\n const parsed = parseMemoryFile(v.content)\n return { id: v.id, record: parsed ? { ...parsed, etag: etagOf(v.content) } : null }\n })\n }\n\n /** Put a prior version back as the current one. The version it replaces\n * goes to history, so a restore can itself be undone. */\n restore(agentId: string, name: string, versionId: string, by: MemoryProvenance = {}): MemoryRecord | null {\n const version = this.versions(agentId, name).find((v) => v.id === versionId)\n if (!version?.record) return null\n const { type, description, body } = version.record\n return this.save({ agentId, type, name, description, body, ...by })\n }\n\n /** The content of MEMORY.md — used at prompt-build time to inline into\n * the agent's system prompt. Returns \"\" when the agent has no\n * memories (so the prompt builder can no-op). */\n indexMarkdown(agentId: string): string {\n const path = this.indexPath(agentId)\n return safeRead(path) ?? \"\"\n }\n\n /** Push the agent's memory into its workspace so Claude Code sessions\n * pick it up automatically. Does two things:\n *\n * 1. Writes `<workspace>/.agentx-memory.md` — full MEMORY.md content,\n * explicit file the skill can `Read` at session start.\n * 2. Merges that same content into `<workspace>/CLAUDE.md` between\n * sentinel comments so Claude Code auto-loads it into the cached\n * system context on every session. Idempotent: subsequent syncs\n * replace the sentinel block.\n *\n * Never touches content outside the sentinel block — if the file\n * doesn't exist, creates it with just the sentinels. Safe to call\n * on any save / delete. */\n syncToWorkspace(agentId: string, workspacePath: string): void {\n if (!workspacePath) return\n const memory = this.indexMarkdown(agentId).trim()\n\n // 1. Explicit file for the `remember` skill to Read if it wants to.\n const explicitPath = resolve(workspacePath, \".agentx-memory.md\")\n if (memory) {\n writeFileSync(explicitPath, memory + \"\\n\")\n } else if (existsSync(explicitPath)) {\n unlinkSync(explicitPath)\n }\n\n // 2. Sentinel-merged into CLAUDE.md for auto-inject.\n const claudePath = resolve(workspacePath, \"CLAUDE.md\")\n const start = \"<!-- AGENTX-MEMORY-START — auto-managed by agentx; edit via `agentx memory` -->\"\n const end = \"<!-- AGENTX-MEMORY-END -->\"\n const block = memory\n ? `${start}\\n${memory}\\n${end}`\n : \"\"\n\n const existing = safeRead(claudePath) ?? \"\"\n const startIdx = existing.indexOf(start)\n const endIdx = existing.indexOf(end)\n\n let next: string\n if (startIdx >= 0 && endIdx > startIdx) {\n // Replace existing sentinel block (or remove it if memory is empty).\n const before = existing.slice(0, startIdx).replace(/\\n+$/, \"\")\n const after = existing.slice(endIdx + end.length).replace(/^\\n+/, \"\")\n next = block\n ? [before, block, after].filter(Boolean).join(\"\\n\\n\") + \"\\n\"\n : [before, after].filter(Boolean).join(\"\\n\\n\") + (before || after ? \"\\n\" : \"\")\n } else if (block) {\n // No prior block — append to the end of CLAUDE.md (creates the file\n // if needed). Keeps any existing content untouched.\n next = existing\n ? existing.replace(/\\n+$/, \"\") + \"\\n\\n\" + block + \"\\n\"\n : block + \"\\n\"\n } else {\n // Empty memory + no prior block → nothing to do.\n return\n }\n writeFileSync(claudePath, next)\n }\n\n /** Regenerate MEMORY.md from the on-disk files. Called automatically\n * after every save / remove; safe to call manually. */\n rewriteIndex(agentId: string): void {\n const entries = this.list(agentId)\n if (entries.length === 0) {\n const p = this.indexPath(agentId)\n if (existsSync(p)) unlinkSync(p)\n return\n }\n const grouped: Record<MemoryType, MemoryRecord[]> = {\n user: [], feedback: [], project: [], reference: [],\n }\n for (const r of entries) grouped[r.type].push(r)\n\n const lines: string[] = []\n lines.push(`# Memory — ${agentId}`, \"\")\n lines.push(\"This is the agent's experiential memory: user preferences,\")\n lines.push(\"feedback, project-specific context, and external references.\")\n lines.push(\"Updated via `agentx memory` CLI or by the agent itself.\")\n for (const type of TYPES) {\n const group = grouped[type]\n if (!group.length) continue\n lines.push(\"\", `## ${titleCase(type)}`, \"\")\n for (const r of group) {\n lines.push(`- **${r.name}** — ${r.description} _(updated ${r.updatedAt.slice(0, 10)})_`)\n }\n }\n lines.push(\"\")\n writeFileSync(this.indexPath(agentId), lines.join(\"\\n\"))\n }\n}\n\n// --- Serialisation helpers ---------------------------------------------\n\nfunction serialize(r: MemoryRecord): string {\n const frontmatter = [\n \"---\",\n `name: ${r.name}`,\n `description: ${escapeYaml(r.description)}`,\n `type: ${r.type}`,\n `created: ${r.createdAt}`,\n `updated: ${r.updatedAt}`,\n ...(r.author ? [`author: ${escapeYaml(r.author)}`] : []),\n ...(r.taskId ? [`task: ${escapeYaml(r.taskId)}`] : []),\n \"---\",\n \"\",\n ].join(\"\\n\")\n return frontmatter + r.body + \"\\n\"\n}\n\n/** Minimal frontmatter parser. Accepts `key: value` lines between `---`\n * markers; body is everything after. No YAML flow syntax — if we need\n * it later, swap for a proper parser. */\nexport function parseMemoryFile(raw: string): MemoryRecord | null {\n if (!raw.startsWith(\"---\\n\")) return null\n const end = raw.indexOf(\"\\n---\\n\", 4)\n if (end < 0) return null\n const header = raw.slice(4, end)\n const body = raw.slice(end + 5).replace(/^\\n+/, \"\").trimEnd()\n const fm: Record<string, string> = {}\n for (const line of header.split(\"\\n\")) {\n const colon = line.indexOf(\":\")\n if (colon < 0) continue\n const key = line.slice(0, colon).trim()\n const val = unescapeYaml(line.slice(colon + 1).trim())\n fm[key] = val\n }\n if (!fm.name || !fm.type || !fm.description) return null\n if (!TYPES.includes(fm.type as MemoryType)) return null\n return {\n name: fm.name,\n type: fm.type as MemoryType,\n description: fm.description,\n body,\n createdAt: fm.created ?? \"\",\n updatedAt: fm.updated ?? fm.created ?? \"\",\n ...(fm.author ? { author: fm.author } : {}),\n ...(fm.task ? { taskId: fm.task } : {}),\n }\n}\n\nfunction escapeYaml(s: string): string {\n if (/[:#\\n]/.test(s)) return `\"${s.replace(/\"/g, \"\\\\\\\"\")}\"`\n return s\n}\n\nfunction unescapeYaml(s: string): string {\n if (s.startsWith(\"\\\"\") && s.endsWith(\"\\\"\") && s.length >= 2) {\n return s.slice(1, -1).replace(/\\\\\"/g, \"\\\"\")\n }\n return s\n}\n\nfunction slug(s: string): string {\n return s.toLowerCase().replace(/[^a-z0-9]+/g, \"_\").replace(/^_+|_+$/g, \"\") || \"unnamed\"\n}\n\nfunction titleCase(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1)\n}\n\nfunction safeRead(path: string): string | null {\n try { return readFileSync(path, \"utf-8\") } catch { return null }\n}\n","import { createHash } from \"crypto\"\nimport { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from \"fs\"\nimport { basename, dirname, resolve } from \"path\"\n\n// --- Version history and write safety for AgentMemory files ---\n//\n// Every overwrite or delete of a memory file first copies the current file\n// into `_versions/<file stem>/<timestamp>.md` next to it, so any change can\n// be rolled back. Writes go through a temp file and a rename, so a reader\n// never sees half a file. An etag (content hash) lets callers make\n// conditional writes: two agents editing the same memory can no longer\n// silently overwrite each other.\n\n/** Old versions kept per memory. The oldest are pruned past this. */\nexport const MAX_VERSIONS = 20\n\nexport class MemoryConflictError extends Error {\n constructor(readonly currentEtag: string | null) {\n super(currentEtag\n ? \"memory changed since you read it (etag mismatch)\"\n : \"memory does not exist (etag mismatch)\")\n this.name = \"MemoryConflictError\"\n }\n}\n\n/** Conditions for a write, mirroring HTTP If-Match / If-None-Match. */\nexport interface WriteCondition {\n /** Write only when the current file has this etag. */\n ifMatch?: string\n /** \"*\": write only when no memory exists yet (create, never overwrite). */\n ifNoneMatch?: \"*\"\n}\n\nexport function etagOf(content: string): string {\n return createHash(\"sha256\").update(content).digest(\"hex\").slice(0, 16)\n}\n\n/** Throws MemoryConflictError when `current` (file content, or null when\n * absent) doesn't satisfy `cond`. No condition always passes. */\nexport function checkCondition(current: string | null, cond: WriteCondition | undefined): void {\n if (!cond) return\n const etag = current === null ? null : etagOf(current)\n if (cond.ifNoneMatch === \"*\" && etag !== null) throw new MemoryConflictError(etag)\n if (cond.ifMatch !== undefined && cond.ifMatch !== etag) throw new MemoryConflictError(etag)\n}\n\nexport function atomicWrite(path: string, content: string): void {\n const tmp = resolve(dirname(path), `.${basename(path)}.${process.pid}.${Date.now()}.tmp`)\n writeFileSync(tmp, content)\n renameSync(tmp, path)\n}\n\nfunction versionsDir(memoryFile: string): string {\n return resolve(dirname(memoryFile), \"_versions\", basename(memoryFile, \".md\"))\n}\n\n/** Copy the current file into its history before it is replaced or\n * removed. No-op when the file doesn't exist yet. */\nexport function snapshot(memoryFile: string, current: string | null): void {\n if (current === null) return\n const dir = versionsDir(memoryFile)\n mkdirSync(dir, { recursive: true })\n const stamp = new Date().toISOString().replace(/[:.]/g, \"-\")\n let path = resolve(dir, `${stamp}.md`)\n for (let n = 1; existsSync(path); n++) path = resolve(dir, `${stamp}-${n}.md`)\n writeFileSync(path, current)\n prune(dir)\n}\n\nfunction prune(dir: string): void {\n const files = readdirSync(dir).filter((f) => f.endsWith(\".md\")).sort()\n for (const f of files.slice(0, Math.max(0, files.length - MAX_VERSIONS))) {\n try { unlinkSync(resolve(dir, f)) } catch { /* already gone */ }\n }\n}\n\nexport interface StoredVersion {\n /** File stem, e.g. 2026-09-26T07-30-00-123Z. Pass to restore. */\n id: string\n content: string\n}\n\n/** Stored versions of a memory file, newest first. */\nexport function readVersions(memoryFile: string): StoredVersion[] {\n const dir = versionsDir(memoryFile)\n if (!existsSync(dir)) return []\n return readdirSync(dir)\n .filter((f) => f.endsWith(\".md\"))\n .sort()\n .reverse()\n .map((f) => ({ id: f.slice(0, -3), content: readFileSync(resolve(dir, f), \"utf-8\") }))\n}\n"],"mappings":"AAAA,OAAS,cAAAA,EAAY,aAAAC,EAAW,eAAAC,EAAa,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,KAC5F,OAAS,WAAAC,MAAe,OCDxB,OAAS,cAAAC,MAAkB,SAC3B,OAAS,cAAAC,EAAY,aAAAC,EAAW,eAAAC,EAAa,gBAAAC,EAAc,cAAAC,EAAY,cAAAC,EAAY,iBAAAC,MAAqB,KACxG,OAAS,YAAAC,EAAU,WAAAC,EAAS,WAAAC,MAAe,OAYpC,IAAMC,EAAe,GAEfC,EAAN,cAAkC,KAAM,CAC7C,YAAqBC,EAA4B,CAC/C,MAAMA,EACF,mDACA,uCAAuC,EAHxB,iBAAAA,EAInB,KAAK,KAAO,qBACd,CACF,EAUO,SAASC,EAAOC,EAA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E,EAAMC,EAAaJ,EAAK,MAAMC,EAAQ,CAAC,EAAE,KAAK,CAAC,EACrDF,EAAGG,CAAG,EAAIC,EAGZ,MADI,CAACJ,EAAG,MAAQ,CAACA,EAAG,MAAQ,CAACA,EAAG,aAC5B,CAACrE,EAAM,SAASqE,EAAG,IAAkB,EAAU,KAC5C,CACL,KAAMA,EAAG,KACT,KAAMA,EAAG,KACT,YAAaA,EAAG,YAChB,KAAAzC,EACA,UAAWyC,EAAG,SAAW,GACzB,UAAWA,EAAG,SAAWA,EAAG,SAAW,GACvC,GAAIA,EAAG,OAAS,CAAE,OAAQA,EAAG,MAAO,EAAI,CAAC,EACzC,GAAIA,EAAG,KAAO,CAAE,OAAQA,EAAG,IAAK,EAAI,CAAC,CACvC,CACF,CAEA,SAASF,EAAWQ,EAAmB,CACrC,MAAI,SAAS,KAAKA,CAAC,EAAU,IAAIA,EAAE,QAAQ,KAAM,KAAM,KAChDA,CACT,CAEA,SAASD,EAAaC,EAAmB,CACvC,OAAIA,EAAE,WAAW,GAAI,GAAKA,EAAE,SAAS,GAAI,GAAKA,EAAE,QAAU,EACjDA,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,OAAQ,GAAI,EAErCA,CACT,CAEA,SAASpE,EAAKoE,EAAmB,CAC/B,OAAOA,EAAE,YAAY,EAAE,QAAQ,cAAe,GAAG,EAAE,QAAQ,WAAY,EAAE,GAAK,SAChF,CAEA,SAAST,EAAUS,EAAmB,CACpC,OAAOA,EAAE,OAAO,CAAC,EAAE,YAAY,EAAIA,EAAE,MAAM,CAAC,CAC9C,CAEA,SAAS3D,EAASF,EAA6B,CAC7C,GAAI,CAAE,OAAO8D,EAAa9D,EAAM,OAAO,CAAE,MAAE,CAAQ,OAAO,IAAK,CACjE","names":["existsSync","mkdirSync","readdirSync","readFileSync","unlinkSync","writeFileSync","resolve","createHash","existsSync","mkdirSync","readdirSync","readFileSync","renameSync","unlinkSync","writeFileSync","basename","dirname","resolve","MAX_VERSIONS","MemoryConflictError","currentEtag","etagOf","content","checkCondition","current","cond","etag","atomicWrite","path","tmp","versionsDir","memoryFile","snapshot","dir","stamp","n","prune","files","f","readVersions","TYPES","AgentMemory","opts","root","resolve","agentId","safe","slug","dir","mkdirSync","type","name","args","cond","path","existing","safeRead","checkCondition","now","createdAt","parsed","parseMemoryFile","record","content","serialize","snapshot","atomicWrite","etagOf","body","existsSync","raw","out","entry","readdirSync","a","b","ta","tb","paths","t","p","unlinkSync","readVersions","v","versionId","by","version","description","workspacePath","memory","explicitPath","writeFileSync","claudePath","start","end","block","startIdx","endIdx","next","before","after","entries","grouped","r","lines","group","titleCase","escapeYaml","header","fm","line","colon","key","val","unescapeYaml","s","readFileSync"]}
|