agentix-cli 0.226.5 → 0.227.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.
Files changed (142) hide show
  1. package/dist/{App-KOHZIHFD.js → App-5BQT2BO7.js} +2 -2
  2. package/dist/{ChatApp-24AJYZEC.js → ChatApp-HCL4GMU3.js} +2 -2
  3. package/dist/{absorb-eval-VCDJPF6M.js → absorb-eval-3VT5V6ML.js} +2 -2
  4. package/dist/{adapter-JGB45SCW.js → adapter-YV5LJLTM.js} +2 -2
  5. package/dist/{agent-XNZ5TOG5.js → agent-5XKFUTVC.js} +2 -2
  6. package/dist/{board-dashboard-MG7HVCKE.js → board-dashboard-DBKG3KIB.js} +4 -4
  7. package/dist/{chunk-XV3QPZWH.js → chunk-3NICPEZX.js} +2 -2
  8. package/dist/{chunk-FGHJDZDB.js → chunk-4FQ2QXMN.js} +2 -2
  9. package/dist/{chunk-LTOSEP7C.js → chunk-6O6WRTCA.js} +2 -2
  10. package/dist/{chunk-LGYIHB73.js → chunk-6UDWKHHV.js} +3 -3
  11. package/dist/{chunk-7K7ZQU3C.js → chunk-A65IUW6P.js} +2 -2
  12. package/dist/{chunk-WXV3KLNI.js → chunk-AT3B343G.js} +3 -3
  13. package/dist/{chunk-Q6TGKWZE.js → chunk-BFJIIB6S.js} +2 -2
  14. package/dist/{chunk-2XQMUSGM.js → chunk-DTCE4QPZ.js} +2 -2
  15. package/dist/{chunk-UBONPGNT.js → chunk-EDWENU5W.js} +2 -2
  16. package/dist/{chunk-QZ24XACR.js → chunk-FNYFWMMO.js} +2 -2
  17. package/dist/{chunk-2TVJTWFC.js → chunk-IVNIUTWB.js} +2 -2
  18. package/dist/{chunk-GMAORBGM.js → chunk-OKBBJO6W.js} +2 -2
  19. package/dist/{chunk-SPVGDMR7.js → chunk-OKNXOXE5.js} +2 -2
  20. package/dist/{chunk-VNXYQH45.js → chunk-OY6EJSSN.js} +2 -2
  21. package/dist/{chunk-DG56PTYL.js → chunk-OYILGRLT.js} +2 -2
  22. package/dist/{chunk-ZUZYJQJ4.js → chunk-P7KDA2SK.js} +2 -2
  23. package/dist/{chunk-MM7U4PWY.js → chunk-QKFRCFOG.js} +2 -2
  24. package/dist/{chunk-BTLADRMY.js → chunk-QM4QZXWM.js} +2 -2
  25. package/dist/{chunk-ZQN2UETA.js → chunk-SLTLOM43.js} +2 -2
  26. package/dist/{chunk-QU7ICYFR.js → chunk-T2QYHIEZ.js} +2 -2
  27. package/dist/{chunk-D6LX27PO.js → chunk-U2KZLLST.js} +2 -2
  28. package/dist/{chunk-EYVPRIO3.js → chunk-UAFB6PN5.js} +2 -2
  29. package/dist/{chunk-FWNP27H4.js → chunk-UBL2MUQQ.js} +2 -2
  30. package/dist/{chunk-FWNP27H4.js.map → chunk-UBL2MUQQ.js.map} +1 -1
  31. package/dist/{chunk-I32TCCAK.js → chunk-UJN3VYLI.js} +2 -2
  32. package/dist/{chunk-6ECXITK2.js → chunk-USDTPG3G.js} +2 -2
  33. package/dist/{chunk-A24QXLEG.js → chunk-WRIIGKIX.js} +2 -2
  34. package/dist/{chunk-HRCK6K36.js → chunk-X5YMUOUR.js} +228 -228
  35. package/dist/chunk-X5YMUOUR.js.map +1 -0
  36. package/dist/{chunk-BDHWTWD7.js → chunk-XL5PGUPL.js} +2 -2
  37. package/dist/{chunk-3IL57455.js → chunk-YYKQCDYX.js} +2 -2
  38. package/dist/{chunk-CF2R6BOX.js → chunk-ZHIRQFYT.js} +2 -2
  39. package/dist/{chunk-XDSYUBEP.js → chunk-ZL7IMUYR.js} +109 -111
  40. package/dist/chunk-ZL7IMUYR.js.map +1 -0
  41. package/dist/cli.js +1 -1
  42. package/dist/{client-D3HDGKKI.js → client-RLT2WHZ2.js} +2 -2
  43. package/dist/{config-OBH67S4V.js → config-DYYASLHG.js} +2 -2
  44. package/dist/{config-mutate-KSTFRHFL.js → config-mutate-ETY72JKN.js} +2 -2
  45. package/dist/{config-mutator-XXZPHMS5.js → config-mutator-7LOJSFQU.js} +2 -2
  46. package/dist/{contributions-ROZVACRZ.js → contributions-2CQCUX7Y.js} +2 -2
  47. package/dist/{doctor-UCH5FAYV.js → doctor-FUNKG5AZ.js} +2 -2
  48. package/dist/{follow-up-tool-IPVPMERA.js → follow-up-tool-NBHOKW2L.js} +2 -2
  49. package/dist/{hub-UY6IPKJU.js → hub-IU55ZDYD.js} +2 -2
  50. package/dist/index.d.ts +8 -16
  51. package/dist/index.js +1 -1
  52. package/dist/{org-tool-YOLOEYRA.js → org-tool-T7KRHAQJ.js} +2 -2
  53. package/dist/{program-QUIOI4AU.js → program-DAIHS5PT.js} +24 -24
  54. package/dist/{promote-LKKZS7DD.js → promote-QGWRSL7W.js} +2 -2
  55. package/dist/{query-UGQY7TE7.js → query-FXICXYYH.js} +2 -2
  56. package/dist/{query-settings-HS2YNSLM.js → query-settings-Q54OZRY4.js} +2 -2
  57. package/dist/{registry-S5TXGCQH.js → registry-MTL5BPCA.js} +2 -2
  58. package/dist/{request-planner-3MKTH2B6.js → request-planner-DNCIVMCW.js} +2 -2
  59. package/dist/{review-candidates-ODCGXSYY.js → review-candidates-TBX6KVLI.js} +2 -2
  60. package/dist/{routing-K3O27TBW.js → routing-4NZ6IE6J.js} +2 -2
  61. package/dist/{schedule-tool-5ZIJOA7R.js → schedule-tool-CXGHTSNO.js} +2 -2
  62. package/dist/{scheduler-Y2COW5JL.js → scheduler-LJBJUV2G.js} +2 -2
  63. package/dist/{seat-YMSIXFTN.js → seat-U7VEGSF7.js} +2 -2
  64. package/dist/{select-F6DEPWZH.js → select-LCDXSKY4.js} +2 -2
  65. package/dist/{set-enabled-UEYUQHF3.js → set-enabled-O2ZRHN4D.js} +2 -2
  66. package/dist/{sprint-tool-WPVO3XBV.js → sprint-tool-BMW4MGPA.js} +2 -2
  67. package/dist/{tool-QVQZRRSO.js → tool-6GB72KYS.js} +2 -2
  68. package/dist/{tool-7TXMGK5Q.js → tool-G2THDJ6B.js} +2 -2
  69. package/dist/{tool-F5GN7WSE.js → tool-GM4SND6P.js} +2 -2
  70. package/dist/tool-RLUTRCUO.js +2 -0
  71. package/dist/{tool-FZPOQXSQ.js → tool-UGH2ZSCI.js} +2 -2
  72. package/dist/{wiki-ZI3GXGNW.js → wiki-A7BSVC7D.js} +2 -2
  73. package/dist/wiki-enrich-JFMYQK3N.js +2 -0
  74. package/package.json +1 -1
  75. package/dist/chunk-HRCK6K36.js.map +0 -1
  76. package/dist/chunk-XDSYUBEP.js.map +0 -1
  77. package/dist/tool-HHMSHXUP.js +0 -2
  78. package/dist/wiki-enrich-JK46USSG.js +0 -2
  79. /package/dist/{App-KOHZIHFD.js.map → App-5BQT2BO7.js.map} +0 -0
  80. /package/dist/{ChatApp-24AJYZEC.js.map → ChatApp-HCL4GMU3.js.map} +0 -0
  81. /package/dist/{absorb-eval-VCDJPF6M.js.map → absorb-eval-3VT5V6ML.js.map} +0 -0
  82. /package/dist/{adapter-JGB45SCW.js.map → adapter-YV5LJLTM.js.map} +0 -0
  83. /package/dist/{agent-XNZ5TOG5.js.map → agent-5XKFUTVC.js.map} +0 -0
  84. /package/dist/{board-dashboard-MG7HVCKE.js.map → board-dashboard-DBKG3KIB.js.map} +0 -0
  85. /package/dist/{chunk-XV3QPZWH.js.map → chunk-3NICPEZX.js.map} +0 -0
  86. /package/dist/{chunk-FGHJDZDB.js.map → chunk-4FQ2QXMN.js.map} +0 -0
  87. /package/dist/{chunk-LTOSEP7C.js.map → chunk-6O6WRTCA.js.map} +0 -0
  88. /package/dist/{chunk-LGYIHB73.js.map → chunk-6UDWKHHV.js.map} +0 -0
  89. /package/dist/{chunk-7K7ZQU3C.js.map → chunk-A65IUW6P.js.map} +0 -0
  90. /package/dist/{chunk-WXV3KLNI.js.map → chunk-AT3B343G.js.map} +0 -0
  91. /package/dist/{chunk-Q6TGKWZE.js.map → chunk-BFJIIB6S.js.map} +0 -0
  92. /package/dist/{chunk-2XQMUSGM.js.map → chunk-DTCE4QPZ.js.map} +0 -0
  93. /package/dist/{chunk-UBONPGNT.js.map → chunk-EDWENU5W.js.map} +0 -0
  94. /package/dist/{chunk-QZ24XACR.js.map → chunk-FNYFWMMO.js.map} +0 -0
  95. /package/dist/{chunk-2TVJTWFC.js.map → chunk-IVNIUTWB.js.map} +0 -0
  96. /package/dist/{chunk-GMAORBGM.js.map → chunk-OKBBJO6W.js.map} +0 -0
  97. /package/dist/{chunk-SPVGDMR7.js.map → chunk-OKNXOXE5.js.map} +0 -0
  98. /package/dist/{chunk-VNXYQH45.js.map → chunk-OY6EJSSN.js.map} +0 -0
  99. /package/dist/{chunk-DG56PTYL.js.map → chunk-OYILGRLT.js.map} +0 -0
  100. /package/dist/{chunk-ZUZYJQJ4.js.map → chunk-P7KDA2SK.js.map} +0 -0
  101. /package/dist/{chunk-MM7U4PWY.js.map → chunk-QKFRCFOG.js.map} +0 -0
  102. /package/dist/{chunk-BTLADRMY.js.map → chunk-QM4QZXWM.js.map} +0 -0
  103. /package/dist/{chunk-ZQN2UETA.js.map → chunk-SLTLOM43.js.map} +0 -0
  104. /package/dist/{chunk-QU7ICYFR.js.map → chunk-T2QYHIEZ.js.map} +0 -0
  105. /package/dist/{chunk-D6LX27PO.js.map → chunk-U2KZLLST.js.map} +0 -0
  106. /package/dist/{chunk-EYVPRIO3.js.map → chunk-UAFB6PN5.js.map} +0 -0
  107. /package/dist/{chunk-I32TCCAK.js.map → chunk-UJN3VYLI.js.map} +0 -0
  108. /package/dist/{chunk-6ECXITK2.js.map → chunk-USDTPG3G.js.map} +0 -0
  109. /package/dist/{chunk-A24QXLEG.js.map → chunk-WRIIGKIX.js.map} +0 -0
  110. /package/dist/{chunk-BDHWTWD7.js.map → chunk-XL5PGUPL.js.map} +0 -0
  111. /package/dist/{chunk-3IL57455.js.map → chunk-YYKQCDYX.js.map} +0 -0
  112. /package/dist/{chunk-CF2R6BOX.js.map → chunk-ZHIRQFYT.js.map} +0 -0
  113. /package/dist/{client-D3HDGKKI.js.map → client-RLT2WHZ2.js.map} +0 -0
  114. /package/dist/{config-OBH67S4V.js.map → config-DYYASLHG.js.map} +0 -0
  115. /package/dist/{config-mutate-KSTFRHFL.js.map → config-mutate-ETY72JKN.js.map} +0 -0
  116. /package/dist/{config-mutator-XXZPHMS5.js.map → config-mutator-7LOJSFQU.js.map} +0 -0
  117. /package/dist/{contributions-ROZVACRZ.js.map → contributions-2CQCUX7Y.js.map} +0 -0
  118. /package/dist/{doctor-UCH5FAYV.js.map → doctor-FUNKG5AZ.js.map} +0 -0
  119. /package/dist/{follow-up-tool-IPVPMERA.js.map → follow-up-tool-NBHOKW2L.js.map} +0 -0
  120. /package/dist/{hub-UY6IPKJU.js.map → hub-IU55ZDYD.js.map} +0 -0
  121. /package/dist/{org-tool-YOLOEYRA.js.map → org-tool-T7KRHAQJ.js.map} +0 -0
  122. /package/dist/{program-QUIOI4AU.js.map → program-DAIHS5PT.js.map} +0 -0
  123. /package/dist/{promote-LKKZS7DD.js.map → promote-QGWRSL7W.js.map} +0 -0
  124. /package/dist/{query-UGQY7TE7.js.map → query-FXICXYYH.js.map} +0 -0
  125. /package/dist/{query-settings-HS2YNSLM.js.map → query-settings-Q54OZRY4.js.map} +0 -0
  126. /package/dist/{registry-S5TXGCQH.js.map → registry-MTL5BPCA.js.map} +0 -0
  127. /package/dist/{request-planner-3MKTH2B6.js.map → request-planner-DNCIVMCW.js.map} +0 -0
  128. /package/dist/{review-candidates-ODCGXSYY.js.map → review-candidates-TBX6KVLI.js.map} +0 -0
  129. /package/dist/{routing-K3O27TBW.js.map → routing-4NZ6IE6J.js.map} +0 -0
  130. /package/dist/{schedule-tool-5ZIJOA7R.js.map → schedule-tool-CXGHTSNO.js.map} +0 -0
  131. /package/dist/{scheduler-Y2COW5JL.js.map → scheduler-LJBJUV2G.js.map} +0 -0
  132. /package/dist/{seat-YMSIXFTN.js.map → seat-U7VEGSF7.js.map} +0 -0
  133. /package/dist/{select-F6DEPWZH.js.map → select-LCDXSKY4.js.map} +0 -0
  134. /package/dist/{set-enabled-UEYUQHF3.js.map → set-enabled-O2ZRHN4D.js.map} +0 -0
  135. /package/dist/{sprint-tool-WPVO3XBV.js.map → sprint-tool-BMW4MGPA.js.map} +0 -0
  136. /package/dist/{tool-QVQZRRSO.js.map → tool-6GB72KYS.js.map} +0 -0
  137. /package/dist/{tool-7TXMGK5Q.js.map → tool-G2THDJ6B.js.map} +0 -0
  138. /package/dist/{tool-F5GN7WSE.js.map → tool-GM4SND6P.js.map} +0 -0
  139. /package/dist/{tool-HHMSHXUP.js.map → tool-RLUTRCUO.js.map} +0 -0
  140. /package/dist/{tool-FZPOQXSQ.js.map → tool-UGH2ZSCI.js.map} +0 -0
  141. /package/dist/{wiki-ZI3GXGNW.js.map → wiki-A7BSVC7D.js.map} +0 -0
  142. /package/dist/{wiki-enrich-JK46USSG.js.map → wiki-enrich-JFMYQK3N.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{e as g}from"./chunk-LGYIHB73.js";async function $(e,i,r,n,o={}){let a=o.retrieve??g,c=o.perEntry??2,s=o.maxArticles??8,f=o.queryChars??1500,h=new Map;for(let t of e){let l=[];try{l=await a(t.content.slice(0,f),i,r,{pool:n,maxCandidates:c,maxHops:1,maxArticles:c*2,stage:"absorb-covering"})}catch{}for(let u of l){let p=h.get(u.path);p?(p.hop=Math.min(p.hop,u.hop),p.entries.includes(t.id)||p.entries.push(t.id)):h.set(u.path,{...u,entries:[t.id]})}}return[...h.values()].sort((t,l)=>t.hop-l.hop||l.entries.length-t.entries.length||t.path.localeCompare(l.path)).slice(0,s)}function x(e){if(e.length===0)return"";let i=e.map(r=>{let n=`### ${r.meta.title} \u2014 ${r.meta.type||"untyped"} (${r.path})`,o=`Found for entries: ${r.entries.join(", ")}${r.hop>0?" (linked from a match)":""}`,a=r.meta.related?.length?`Related: ${r.meta.related.join(", ")}`:"";return[n,o,a,"",r.content].filter(c=>c!=="").join(`
1
+ import{e as g}from"./chunk-6UDWKHHV.js";async function $(e,i,r,n,o={}){let a=o.retrieve??g,c=o.perEntry??2,s=o.maxArticles??8,f=o.queryChars??1500,h=new Map;for(let t of e){let l=[];try{l=await a(t.content.slice(0,f),i,r,{pool:n,maxCandidates:c,maxHops:1,maxArticles:c*2,stage:"absorb-covering"})}catch{}for(let u of l){let p=h.get(u.path);p?(p.hop=Math.min(p.hop,u.hop),p.entries.includes(t.id)||p.entries.push(t.id)):h.set(u.path,{...u,entries:[t.id]})}}return[...h.values()].sort((t,l)=>t.hop-l.hop||l.entries.length-t.entries.length||t.path.localeCompare(l.path)).slice(0,s)}function x(e){if(e.length===0)return"";let i=e.map(r=>{let n=`### ${r.meta.title} \u2014 ${r.meta.type||"untyped"} (${r.path})`,o=`Found for entries: ${r.entries.join(", ")}${r.hop>0?" (linked from a match)":""}`,a=r.meta.related?.length?`Related: ${r.meta.related.join(", ")}`:"";return[n,o,a,"",r.content].filter(c=>c!=="").join(`
2
2
  `)}).join(`
3
3
 
4
4
  ---
@@ -14,4 +14,4 @@ These ${e.length} articles were found by searching the wiki for each entry below
14
14
 
15
15
  ${i}
16
16
  `}var d=/\bhttps?:\/\/[^\s<>"'`)\]]+/gi,y=/\[\[([^\]|]+)(?:\|[^\]]*)?\]\]/g,w=/(?<![\w-])(?=[0-9a-f]*[0-9])(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}(?![\w-])/gi,k=/(?<![\w.,:/-])\d+(?:[.,:\-/]\d+)*(?![\w])/g,C=/^\s*\d+[.)]\s/gm;function A(e){let i=[...e.matchAll(d)].map(s=>s[0].replace(/[.,;:!?'"]+$/,"")),r=[...e.matchAll(y)].map(s=>s[1].trim()),n=e.replace(d," ").replace(y," ").replace(C," "),o=[...n.matchAll(w)].map(s=>s[0].toLowerCase()),c=[...n.replace(w," ").matchAll(k)].map(s=>v(s[0]));return{commits:m(o),urls:m(i),wikilinks:m(r),numbers:m(c)}}function R(e,i){let r=A(e),n=A(i),o=i.toLowerCase(),a=[];for(let t of r.commits)!o.includes(t)&&!n.commits.some(l=>l.startsWith(t)||t.startsWith(l))&&a.push(`commit ${t}`);let c=t=>t.toLowerCase().replace(/\/+$/,""),s=new Set(n.urls.map(c));for(let t of r.urls)s.has(c(t))||a.push(`link ${t}`);let f=new Set(n.wikilinks.map(t=>t.toLowerCase()));for(let t of r.wikilinks)f.has(t.toLowerCase())||a.push(`link [[${t}]]`);let h=new Set(n.numbers);for(let t of r.numbers)h.has(t)||a.push(`number ${t}`);return a}function v(e){return/^\d{1,3}(,\d{3})+$/.test(e)?e.replace(/,/g,""):e}function m(e){return[...new Set(e)]}function L(e,i){if(i.some(n=>n.path===e.path))return e.path;let r=b(e.title);return r?i.find(n=>b(n.title)===r)?.path??e.path:e.path}function b(e){return(e||"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}export{$ as a,x as b,A as c,R as d,L as e};
17
- //# sourceMappingURL=chunk-I32TCCAK.js.map
17
+ //# sourceMappingURL=chunk-UJN3VYLI.js.map
@@ -1,4 +1,4 @@
1
- import{a as M,b as E,c as R,d as T,e as j,j as O}from"./chunk-2XQMUSGM.js";import{c as P,d as N}from"./chunk-OWNQ2FD4.js";import{c as _,d as x}from"./chunk-AHWWJ7AF.js";import{b as I}from"./chunk-KEXBEUSU.js";import{a as B}from"./chunk-ROLSSYXE.js";import{y as C,z as K}from"./chunk-BTLADRMY.js";import{readFileSync as $,writeFileSync as b,appendFileSync as V,existsSync as w,mkdirSync as L,readdirSync as D,statSync as F}from"fs";import{resolve as h,join as Y,relative as k,dirname as z}from"path";K();function U(A){return B.includes(A)}function G(A){if(!A)return;let t;try{t=JSON.parse(A)}catch{return}if(!Array.isArray(t))return;let e=t.filter(s=>typeof s=="object"&&s!==null&&typeof s.property=="string"&&s.property!==""&&typeof s.value=="string"&&s.value!=="");return e.length?e:void 0}function H(A,t){let e=a=>{let o=/^(.*Z)(?:-(\d+))?\.md$/.exec(a);return o?[o[1],o[2]?Number(o[2]):0]:[a,0]},[s,i]=e(A),[n,r]=e(t);return s<n?-1:s>n?1:i-r}var J=class{baseDir;rawDir;log;lockWaitMs=5e3;constructor(t=h(process.cwd(),".agentx/wiki"),e=console.error.bind(console,"[wiki]")){this.baseDir=t,this.rawDir=h(t,"raw/entries"),this.log=e,L(this.rawDir,{recursive:!0}),L(h(t,"raw"),{recursive:!0}),this.ensureSchema()}canRead(t,e){return t.access==="public"?!0:e?!!(t.owner===e||t.access==="shared"&&t.sharedWith?.includes(e)):!1}canWrite(t,e){return t.owner===e}addEntry(t){let e=`${t.date}_${t.id}.md`,s=h(this.rawDir,e),i=["---",`id: ${t.id}`,`date: ${t.date}`,`agent: ${t.agentId}`,`source: ${t.source}`];if(t.sourceContext&&i.push(`context: ${t.sourceContext}`),t.meta)for(let[n,r]of Object.entries(t.meta))i.push(`${n}: ${JSON.stringify(r)}`);return i.push("---","",t.content),b(s,i.join(`
1
+ import{a as M,b as E,c as R,d as T,e as j,j as O}from"./chunk-DTCE4QPZ.js";import{c as P,d as N}from"./chunk-OWNQ2FD4.js";import{c as _,d as x}from"./chunk-AHWWJ7AF.js";import{b as I}from"./chunk-KEXBEUSU.js";import{a as B}from"./chunk-ROLSSYXE.js";import{y as C,z as K}from"./chunk-QM4QZXWM.js";import{readFileSync as $,writeFileSync as b,appendFileSync as V,existsSync as w,mkdirSync as L,readdirSync as D,statSync as F}from"fs";import{resolve as h,join as Y,relative as k,dirname as z}from"path";K();function U(A){return B.includes(A)}function G(A){if(!A)return;let t;try{t=JSON.parse(A)}catch{return}if(!Array.isArray(t))return;let e=t.filter(s=>typeof s=="object"&&s!==null&&typeof s.property=="string"&&s.property!==""&&typeof s.value=="string"&&s.value!=="");return e.length?e:void 0}function H(A,t){let e=a=>{let o=/^(.*Z)(?:-(\d+))?\.md$/.exec(a);return o?[o[1],o[2]?Number(o[2]):0]:[a,0]},[s,i]=e(A),[n,r]=e(t);return s<n?-1:s>n?1:i-r}var J=class{baseDir;rawDir;log;lockWaitMs=5e3;constructor(t=h(process.cwd(),".agentx/wiki"),e=console.error.bind(console,"[wiki]")){this.baseDir=t,this.rawDir=h(t,"raw/entries"),this.log=e,L(this.rawDir,{recursive:!0}),L(h(t,"raw"),{recursive:!0}),this.ensureSchema()}canRead(t,e){return t.access==="public"?!0:e?!!(t.owner===e||t.access==="shared"&&t.sharedWith?.includes(e)):!1}canWrite(t,e){return t.owner===e}addEntry(t){let e=`${t.date}_${t.id}.md`,s=h(this.rawDir,e),i=["---",`id: ${t.id}`,`date: ${t.date}`,`agent: ${t.agentId}`,`source: ${t.source}`];if(t.sourceContext&&i.push(`context: ${t.sourceContext}`),t.meta)for(let[n,r]of Object.entries(t.meta))i.push(`${n}: ${JSON.stringify(r)}`);return i.push("---","",t.content),b(s,i.join(`
2
2
  `)),this.appendLog("ingest",`${t.id} from ${t.agentId} via ${t.source}`),e}readEntries(t){if(t.length===0||!w(this.rawDir))return[];let e=new Set(t),s=[];for(let i of D(this.rawDir)){let n=i.replace(/\.md$/,"").replace(/^\d{4}-\d{2}-\d{2}_/,"");if(!e.has(n))continue;let r=this.parseEntry($(h(this.rawDir,i),"utf-8"),i);r&&s.push(r)}return s}listEntries(t){if(!w(this.rawDir))return[];let e=D(this.rawDir).filter(i=>i.endsWith(".md")).sort(),s=[];for(let i of e){let n=$(h(this.rawDir,i),"utf-8"),r=this.parseEntry(n,i);r&&(t?.agentId&&r.agentId!==t.agentId||t?.after&&r.date<t.after||t?.before&&r.date>t.before||s.push(r))}return s}parseEntry(t,e){let s=t.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!s)return null;let i=s[1],n=s[2].trim(),r=c=>i.match(new RegExp(`^${c}:\\s*(.+)$`,"m"))?.[1]?.trim()||"",a=new Set(["id","date","agent","source","context"]),o={};for(let c of i.split(`
3
3
  `)){let l=c.match(/^(\w+):\s*(.+)$/);if(!(!l||a.has(l[1])))try{o[l[1]]=JSON.parse(l[2])}catch{o[l[1]]=l[2].trim()}}return{id:r("id")||e.replace(".md",""),date:r("date"),agentId:r("agent"),source:r("source"),sourceContext:r("context")||void 0,content:n,meta:Object.keys(o).length>0?o:void 0}}withArticleLock(t,e){let s=`${h(this.baseDir,"_locks",t)}.lock`;return N(h(this.baseDir,t),e,{lock:s,what:`wiki page ${t}`,timeoutMs:this.lockWaitMs,staleMs:1e4})}writeArticle(t,e,s,i){try{return this.withArticleLock(t,()=>this.writeArticleLocked(t,e,s,i))}catch(n){if(!(n instanceof P))throw n;return this.log(n.message),!1}}writeArticleLocked(t,e,s,i){let n=this.readArticle(t);if(n&&!this.canWrite(n.meta,i))return this.log(`Permission denied: "${i}" cannot write "${t}" (owner: ${n.meta.owner})`),!1;e.type&&!I(e.type)&&(this.log(`Dropping invalid article type "${e.type}" for "${t}" \u2014 enum is [person, project, place, concept, event, decision, pattern]`),e={...e,type:void 0});let r=h(this.baseDir,t);n&&this.saveVersion(t,r),L(z(r),{recursive:!0});let a=["---",`title: "${e.title}"`];e.type&&a.push(`type: ${e.type}`),e.related?.length&&a.push(`related: [${e.related.map(c=>`"${c}"`).join(", ")}]`),a.push(`tags: [${(e.tags||[]).map(c=>`"${c}"`).join(", ")}]`,`owner: ${e.owner}`,`access: ${e.access}`),e.sharedWith?.length&&a.push(`shared_with: [${e.sharedWith.map(c=>`"${c}"`).join(", ")}]`),a.push(`created: ${e.created}`,`last_updated: ${e.lastUpdated}`,`sources: [${e.sources.map(c=>`"${c}"`).join(", ")}]`),e.graphPath?.length&&a.push(`graph_path: [${e.graphPath.map(c=>`"${c}"`).join(", ")}]`),e.class&&a.push(`class: ${e.class}`),e.importance&&a.push(`importance: ${e.importance}`),e.importanceProposed&&a.push(`importance_proposed: ${e.importanceProposed}`),e.date&&a.push(`date: ${e.date}`),e.rolledUpInto&&a.push(`rolled_up_into: ${JSON.stringify(e.rolledUpInto)}`),e.aliases?.length&&a.push(`aliases: ${JSON.stringify(e.aliases)}`),e.statements?.length&&a.push(`statements: ${JSON.stringify(e.statements)}`),a.push("---","",s),b(r,a.join(`
4
4
  `));let o=n?"update":"create";return this.appendLog(o,`${e.title} [${(e.tags||[]).slice(0,5).join(", ")}] by ${i} at ${t}`),!0}saveVersion(t,e){try{if(!w(e))return;let s=$(e,"utf-8"),i=new Date().toISOString().replace(/[:.]/g,"-"),n=h(this.baseDir,"_versions",t.replace(/\.md$/,""));L(n,{recursive:!0});for(let r=0;;r++)try{b(h(n,`${r?`${i}-${r}`:i}.md`),s,{flag:"wx"});return}catch(a){if(a.code!=="EEXIST")throw a}}catch{}}getVersions(t){let e=h(this.baseDir,"_versions",t.replace(/\.md$/,""));if(!w(e))return[];try{return D(e).filter(s=>s.endsWith(".md")).sort(H).reverse().map(s=>({timestamp:s.replace(/\.md$/,"").replace(/-/g,(i,n)=>n<19?n===10?"T":n===13||n===16?":":"-":i),path:h(e,s)}))}catch{return[]}}restoreVersion(t,e){let s=this.getVersions(t),i=s.find(n=>n.timestamp===e)??s.find(n=>n.timestamp.startsWith(e));return i?this.withArticleLock(t,()=>this.restoreLocked(t,i.path,e)):!1}restoreLocked(t,e,s){try{let i=$(e,"utf-8"),n=h(this.baseDir,t);return this.saveVersion(t,n),b(n,i),this.appendLog("restore",`${t} restored to ${s}`),!0}catch{return!1}}readArticle(t){let e=h(this.baseDir,t);if(!w(e))return null;let s=$(e,"utf-8");return this.parseArticle(s,t)}readArticleAs(t,e){let s=this.readArticle(t);return!s||!this.canRead(s.meta,e)?null:s}parseArticle(t,e){let s=t.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!s)return null;let i=s[1],n=s[2].trim(),r=W=>i.match(new RegExp(`^${W}:\\s*(.+)$`,"m"))?.[1]?.trim().replace(/^"(.*)"$/,"$1")||"",a=W=>{let v=i.match(new RegExp(`^${W}:\\s*\\[(.*)\\]$`,"m"));return v?[...v[1].matchAll(/\s*(?:"(.*?)"(?=\s*(?:,|$))|([^,]+))/g)].map(S=>(S[1]??S[2]).trim()).filter(Boolean):[]},o=r("type")||r("kind"),l=new Set(["person","project","place","concept","event","decision","pattern"]).has(o)?o:void 0,g=a("tags").filter((W,v,S)=>W&&S.indexOf(W)===v),d=a("related"),p=a("graph_path"),m=a("aliases"),u=r("importance"),f=r("importance_proposed"),y=r("date");return{meta:{title:r("title"),type:l,related:d.length?d:void 0,tags:g,owner:r("owner"),access:r("access")||"public",sharedWith:a("shared_with"),created:r("created"),lastUpdated:r("last_updated"),sources:a("sources"),graphPath:p.length?p:void 0,class:/^[a-z][a-z0-9_]*$/.test(r("class"))?r("class"):void 0,importance:U(u)?u:void 0,importanceProposed:U(f)?f:void 0,date:/^\d{4}-\d{2}-\d{2}/.test(y)?y.slice(0,10):void 0,rolledUpInto:r("rolled_up_into")||void 0,aliases:m.length?m:void 0,statements:G(r("statements"))},content:n,path:e}}listCache=new Map;listArticles(t){return this.listCached(t)}listAllArticles(){return this.listCached(null)}listCached(t){let e=[],s=[];this.walkDir(this.baseDir,(o,c)=>{if(!o.endsWith(".md"))return;let l=k(this.baseDir,o);l.startsWith("raw/")||l.startsWith("_")||(e.push(l),s.push(`${l}:${c?.mtimeMs??"?"}:${c?.size??"?"}`))});let i=s.join("|"),n=t??"\0all",r=this.listCache.get(n);if(r&&r.signature===i)return r.articles.slice();let a=[];for(let o of e){let c=this.readArticle(o);c&&(t===null||this.canRead(c.meta,t))&&a.push(c)}return this.listCache.set(n,{signature:i,articles:a}),a.slice()}search(t,e,s=10){let i=t.toLowerCase(),n=[];if(this.walkDir(this.baseDir,d=>{if(!d.endsWith(".md"))return;let p=k(this.baseDir,d);if(p.startsWith("raw/")||p.startsWith("_"))return;let m=this.readArticle(p);!m||!this.canRead(m.meta,e)||n.push(m)}),n.length===0)return[];let r=n.map(d=>d.content),a=h(this.baseDir,"_bm25_cache.json"),o=x(r,a),c=_(t,o),l=new Map(c.map(d=>[d.docIndex,d.score]));return n.map((d,p)=>{let m=l.get(p)??0;return d.meta.title.toLowerCase().includes(i)&&(m+=10),d.meta.tags?.some(u=>u.toLowerCase().includes(i))&&(m+=5),{article:d,score:m}}).filter(d=>d.score>0).sort((d,p)=>p.score-d.score).slice(0,s).map(d=>d.article)}async findRelevantReranked(t,e,s=10,i={}){let n=Math.max(s,i.shortlist??E),r=this.findRelevant(t,e,n);if(r.length<2)return r.slice(0,s);let a=r.map((l,g)=>({id:`c${g}`,title:l.meta.title||`(untitled ${g})`,tags:l.meta.tags,excerpt:l.content})),o=await C(M,R({query:t,candidates:a,excerptChars:i.excerptChars}),T(a),{incumbent:{best:a[0].id},features:{agent:e??"unknown"}});return!o||o.mode!=="active"?r.slice(0,s):j(o.answers,a).ranked.map(l=>r[Number(l.slice(1))]).filter(l=>!!l).slice(0,s)}findRelevant(t,e,s=3,i,n={graph:.6,bm25:.4}){let r=[];if(this.walkDir(this.baseDir,u=>{if(!u.endsWith(".md"))return;let f=k(this.baseDir,u);if(f.startsWith("raw/")||f.startsWith("_"))return;let y=this.readArticle(f);!y||!this.canRead(y.meta,e)||r.push(y)}),r.length===0)return[];let a=r.map(u=>`${u.meta.title} ${(u.meta.tags||[]).join(" ")} ${u.content}`),o=h(this.baseDir,"_bm25_relevance_cache.json"),c=x(a,o),l=_(t,c),g=l.reduce((u,f)=>Math.max(u,f.score),0)||1,d=new Map(l.map(u=>[u.docIndex,u.score/g])),p=!!(i&&i.length>0);return r.map((u,f)=>{let y=d.get(f)??0,W=0;p&&u.meta.graphPath?.length&&(W=O(i,u.meta.graphPath));let v=p?n.graph*W+n.bm25*y:y;return{article:u,score:v}}).filter(u=>u.score>0).sort((u,f)=>f.score-u.score).slice(0,s).map(u=>u.article)}buildContext(t,e=4e3){if(t.length===0)return"";let s=["[Wiki Knowledge]"],i=0;for(let n of t){let r=`
@@ -102,4 +102,4 @@ We use GitLab for version control.
102
102
  There are ${e.length} unprocessed entries. Read each, understand what it means, and create or update wiki articles.
103
103
 
104
104
  ${s}`}walkDir(t,e){if(w(t))for(let s of D(t)){let i=Y(t,s),n=F(i);n.isDirectory()?this.walkDir(i,e):e(i,n)}}};export{J as a};
105
- //# sourceMappingURL=chunk-6ECXITK2.js.map
105
+ //# sourceMappingURL=chunk-USDTPG3G.js.map
@@ -1,4 +1,4 @@
1
- import{Dc as m,tc as l}from"./chunk-FWNP27H4.js";m();import{existsSync as g,readFileSync as u,writeFileSync as a,copyFileSync as y}from"fs";import{resolve as p}from"path";function P(e,n={}){let t=n.configPath||p(process.cwd(),"agentx.json");if(!g(t))throw new Error(`agentx.json not found at ${t}`);let i=JSON.parse(u(t,"utf-8")),o=e(i),s=typeof o=="string"?{summary:o}:o,c=JSON.stringify(i,null,2)+`
1
+ import{Dc as m,tc as l}from"./chunk-UBL2MUQQ.js";m();import{existsSync as g,readFileSync as u,writeFileSync as a,copyFileSync as y}from"fs";import{resolve as p}from"path";function P(e,n={}){let t=n.configPath||p(process.cwd(),"agentx.json");if(!g(t))throw new Error(`agentx.json not found at ${t}`);let i=JSON.parse(u(t,"utf-8")),o=e(i),s=typeof o=="string"?{summary:o}:o,c=JSON.stringify(i,null,2)+`
2
2
  `,f=t+".tmp";a(f,c,"utf-8");try{JSON.parse(u(f,"utf-8"))}catch(d){throw new Error(`config did not round-trip cleanly: ${d.message}`)}let r;return n.skipBackup||(r=`${t}.bak.${Date.now()}`,y(t,r)),a(t,c,"utf-8"),n.skipReload||h().catch(()=>{}),{summary:s.summary,payload:s.payload,backupPath:r}}function S(e,n={}){let t=n.configPath||p(process.cwd(),"agentx.json");if(g(t)&&!n.overwrite)throw new Error(`agentx.json already exists at ${t}. Pass overwrite=true to replace it.`);return a(t,JSON.stringify(e,null,2)+`
3
3
  `,"utf-8"),{file:t}}async function h(){try{let n=l().dashboard.daemonUrl?.replace(/\/+$/,"")||"http://127.0.0.1:18800";await fetch(`${n}/reload`,{method:"POST"}).catch(()=>null)}catch{}}export{P as a,S as b};
4
- //# sourceMappingURL=chunk-A24QXLEG.js.map
4
+ //# sourceMappingURL=chunk-WRIIGKIX.js.map