agentix-cli 0.129.0 → 0.131.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 (203) hide show
  1. package/dist/{App-G37JNRBW.js → App-WZ3HAKES.js} +2 -2
  2. package/dist/{ChatApp-NCKC7C3L.js → ChatApp-K4HDJL2S.js} +2 -2
  3. package/dist/absorb-eval-ER27DHHK.js +2 -0
  4. package/dist/{agent-LJ4SUQCC.js → agent-AQSVISXX.js} +2 -2
  5. package/dist/article-sync-4NOPOQU7.js +2 -0
  6. package/dist/{board-dashboard-LZJT4YWV.js → board-dashboard-3AI2Z2SP.js} +248 -211
  7. package/dist/board-dashboard-3AI2Z2SP.js.map +1 -0
  8. package/dist/chunk-2SXF66O6.js +55 -0
  9. package/dist/chunk-2SXF66O6.js.map +1 -0
  10. package/dist/{chunk-AMW2R676.js → chunk-2YB2G2BP.js} +3 -3
  11. package/dist/{chunk-AMW2R676.js.map → chunk-2YB2G2BP.js.map} +1 -1
  12. package/dist/chunk-2ZDV3DCT.js +52 -0
  13. package/dist/chunk-2ZDV3DCT.js.map +1 -0
  14. package/dist/chunk-3UOTLMXD.js +4 -0
  15. package/dist/chunk-3UOTLMXD.js.map +1 -0
  16. package/dist/chunk-5BI2T3WD.js +3 -0
  17. package/dist/chunk-5BI2T3WD.js.map +1 -0
  18. package/dist/{chunk-VJRITDSQ.js → chunk-6O6NW3ZG.js} +2 -2
  19. package/dist/chunk-6TURWSMN.js +3 -0
  20. package/dist/{chunk-VD7IO653.js.map → chunk-6TURWSMN.js.map} +1 -1
  21. package/dist/{chunk-BGG3ZSMW.js → chunk-7LN4VKDU.js} +14 -16
  22. package/dist/chunk-7LN4VKDU.js.map +1 -0
  23. package/dist/chunk-7UPFZJIT.js +861 -0
  24. package/dist/chunk-7UPFZJIT.js.map +1 -0
  25. package/dist/chunk-7VLLZQ3N.js +2 -0
  26. package/dist/chunk-7VLLZQ3N.js.map +1 -0
  27. package/dist/{chunk-4O4GZBKZ.js → chunk-AKOXTIJS.js} +2 -2
  28. package/dist/{chunk-4ZFLYY5P.js → chunk-APZIH3AY.js} +2 -2
  29. package/dist/{chunk-DVR6PFCJ.js → chunk-B2Q3PTPS.js} +2 -2
  30. package/dist/{chunk-SCJ5ZXEN.js → chunk-B2QYMUTD.js} +2 -2
  31. package/dist/{chunk-SCJ5ZXEN.js.map → chunk-B2QYMUTD.js.map} +1 -1
  32. package/dist/chunk-BIJHMWXK.js +21 -0
  33. package/dist/chunk-BIJHMWXK.js.map +1 -0
  34. package/dist/{chunk-4VDA4UM7.js → chunk-BKHIR2YJ.js} +2 -2
  35. package/dist/chunk-CBFBGN7J.js +54 -0
  36. package/dist/chunk-CBFBGN7J.js.map +1 -0
  37. package/dist/{chunk-4FMZTM3W.js → chunk-CL33CRH5.js} +3 -3
  38. package/dist/chunk-CL33CRH5.js.map +1 -0
  39. package/dist/{chunk-XIA2ACKX.js → chunk-CSWGYSC4.js} +2 -2
  40. package/dist/{chunk-Z5CBUZIW.js → chunk-E2VDBT3T.js} +2 -2
  41. package/dist/{chunk-XZN7QBRH.js → chunk-ERNBJLIQ.js} +2 -2
  42. package/dist/{chunk-R6UCPHUD.js → chunk-IA7INHXY.js} +2 -2
  43. package/dist/chunk-IMLAPB7G.js +4 -0
  44. package/dist/chunk-IMLAPB7G.js.map +1 -0
  45. package/dist/{chunk-3PGPN323.js → chunk-JP5OAMWQ.js} +1 -1
  46. package/dist/chunk-JP5OAMWQ.js.map +1 -0
  47. package/dist/chunk-KBJNJGBP.js +2 -0
  48. package/dist/chunk-KBJNJGBP.js.map +1 -0
  49. package/dist/chunk-KFIJDLQ5.js +3 -0
  50. package/dist/chunk-KFIJDLQ5.js.map +1 -0
  51. package/dist/{chunk-XOQNDWVW.js → chunk-KIYV4ZHG.js} +2 -2
  52. package/dist/{chunk-CPMQZ6Z7.js → chunk-KRK7OOTK.js} +2 -2
  53. package/dist/{chunk-ARSVKSC4.js → chunk-L2WVQREN.js} +2 -2
  54. package/dist/{chunk-I3RAUJCD.js → chunk-L4ALHWII.js} +23 -14
  55. package/dist/{chunk-I3RAUJCD.js.map → chunk-L4ALHWII.js.map} +1 -1
  56. package/dist/{chunk-YHD4PHFX.js → chunk-L4ZS4HGJ.js} +268 -251
  57. package/dist/chunk-L4ZS4HGJ.js.map +1 -0
  58. package/dist/chunk-MCBTVNPX.js +152 -0
  59. package/dist/chunk-MCBTVNPX.js.map +1 -0
  60. package/dist/{chunk-SCC7HBFZ.js → chunk-MFIM5Y3J.js} +2 -2
  61. package/dist/chunk-MRIVENBY.js +2 -0
  62. package/dist/{article-sync-TLZTHRZB.js.map → chunk-MRIVENBY.js.map} +1 -1
  63. package/dist/{chunk-CDLJOGVZ.js → chunk-VSL2SSBH.js} +6 -6
  64. package/dist/{chunk-X5JTG52Q.js → chunk-WKQQIYOE.js} +2 -2
  65. package/dist/{chunk-PVUNDNT3.js → chunk-YA6E47BR.js} +2 -2
  66. package/dist/{chunk-AOFTTIZZ.js → chunk-YPCZ5TNK.js} +2 -2
  67. package/dist/{chunk-BWSB7NOX.js → chunk-YQRWUF4Y.js} +2 -2
  68. package/dist/{chunk-BCUR2TJ7.js → chunk-YVR6652A.js} +2 -2
  69. package/dist/cli.js +1 -1
  70. package/dist/{client-A5OK3IFO.js → client-YIR3ELVN.js} +2 -2
  71. package/dist/config-4DOJYA2K.js +2 -0
  72. package/dist/{config-mutate-62FCJ3S6.js → config-mutate-KDRHKQE4.js} +2 -2
  73. package/dist/config-mutator-4PPBACWU.js +2 -0
  74. package/dist/{contributions-L2YS4AH2.js → contributions-MTKXXLIP.js} +2 -2
  75. package/dist/{contributions-L2YS4AH2.js.map → contributions-MTKXXLIP.js.map} +1 -1
  76. package/dist/{doctor-7TPSMMFA.js → doctor-FJ5RCG4J.js} +2 -2
  77. package/dist/enrich-NH3WHKD6.js +16 -0
  78. package/dist/enrich-NH3WHKD6.js.map +1 -0
  79. package/dist/{follow-up-tool-FKWIRFPW.js → follow-up-tool-SVZDSUIU.js} +2 -2
  80. package/dist/graph-EXDH7EPZ.js +2 -0
  81. package/dist/hub-CF4VFSRT.js +2 -0
  82. package/dist/index.d.ts +496 -0
  83. package/dist/index.js +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/load-5DNMGHFW.js +2 -0
  86. package/dist/model-call-BGTDPWZD.js +2 -0
  87. package/dist/notes-WJJEJ4CJ.js +2 -0
  88. package/dist/notes-settings-WMOH2V75.js +2 -0
  89. package/dist/processes-M3N3S7V5.js +2 -0
  90. package/dist/program-ZPNEAACQ.js +768 -0
  91. package/dist/program-ZPNEAACQ.js.map +1 -0
  92. package/dist/{promote-XBDWCHLU.js → promote-G6BOY7K5.js} +2 -2
  93. package/dist/query-H24BI3BI.js +2 -0
  94. package/dist/query-settings-IJB3QMDW.js +3 -0
  95. package/dist/query-settings-IJB3QMDW.js.map +1 -0
  96. package/dist/registry-TAUHYJCK.js +2 -0
  97. package/dist/{request-planner-SEXYQN7D.js → request-planner-V3R5J3V4.js} +2 -2
  98. package/dist/{review-candidates-PIJWPPHQ.js → review-candidates-TC7RJB4W.js} +2 -2
  99. package/dist/roster-IRXP32XF.js +2 -0
  100. package/dist/{rotation-memo-7VLREGS6.js → rotation-memo-2G6N3VF3.js} +2 -2
  101. package/dist/{routing-2V3Y6ZR5.js → routing-XQD74ERK.js} +2 -2
  102. package/dist/schedule-tool-U6KLY5MT.js +2 -0
  103. package/dist/{scheduler-SVZKDKJV.js → scheduler-WOOXIOER.js} +2 -2
  104. package/dist/scheduler-WOOXIOER.js.map +1 -0
  105. package/dist/{seat-C6TMCJWI.js → seat-B75JIAS3.js} +2 -2
  106. package/dist/seat-B75JIAS3.js.map +1 -0
  107. package/dist/{select-DP64KWO4.js → select-I6BSBQXP.js} +2 -2
  108. package/dist/{set-enabled-WCH6FU4N.js → set-enabled-THNVITGU.js} +2 -2
  109. package/dist/summaries-BIRSNWGH.js +2 -0
  110. package/dist/summaries-BIRSNWGH.js.map +1 -0
  111. package/dist/{tool-TWQRBV4Y.js → tool-CEBIS6GK.js} +2 -2
  112. package/dist/{tool-WUK3ZOWG.js → tool-LFWTZHB7.js} +2 -2
  113. package/dist/wiki-3ATPAHC2.js +2 -0
  114. package/dist/wiki-3ATPAHC2.js.map +1 -0
  115. package/dist/workspace-env-ROH45HXN.js +2 -0
  116. package/dist/workspace-env-ROH45HXN.js.map +1 -0
  117. package/package.json +1 -1
  118. package/dist/absorb-eval-ZCWHWKAD.js +0 -2
  119. package/dist/article-sync-TLZTHRZB.js +0 -2
  120. package/dist/board-dashboard-LZJT4YWV.js.map +0 -1
  121. package/dist/chunk-3PGPN323.js.map +0 -1
  122. package/dist/chunk-4FMZTM3W.js.map +0 -1
  123. package/dist/chunk-A347YHEW.js +0 -4
  124. package/dist/chunk-A347YHEW.js.map +0 -1
  125. package/dist/chunk-BGG3ZSMW.js.map +0 -1
  126. package/dist/chunk-EO4DEEXL.js +0 -2
  127. package/dist/chunk-EO4DEEXL.js.map +0 -1
  128. package/dist/chunk-EOLEKSN6.js +0 -54
  129. package/dist/chunk-EOLEKSN6.js.map +0 -1
  130. package/dist/chunk-M7IJVOJA.js +0 -55
  131. package/dist/chunk-M7IJVOJA.js.map +0 -1
  132. package/dist/chunk-QUXMLLX5.js +0 -2
  133. package/dist/chunk-QUXMLLX5.js.map +0 -1
  134. package/dist/chunk-QX2B4TJU.js +0 -3
  135. package/dist/chunk-QX2B4TJU.js.map +0 -1
  136. package/dist/chunk-VD7IO653.js +0 -3
  137. package/dist/chunk-YHD4PHFX.js.map +0 -1
  138. package/dist/chunk-ZF5U5KPB.js +0 -892
  139. package/dist/chunk-ZF5U5KPB.js.map +0 -1
  140. package/dist/config-DQ5SILHX.js +0 -2
  141. package/dist/config-mutator-3ZL5YQSO.js +0 -2
  142. package/dist/graph-5ZJ7YACP.js +0 -2
  143. package/dist/hub-EU5ECAJB.js +0 -2
  144. package/dist/load-NK3MIYXP.js +0 -2
  145. package/dist/notes-2VC47RCK.js +0 -2
  146. package/dist/notes-settings-X63D5HPM.js +0 -2
  147. package/dist/processes-5MP32QZT.js +0 -2
  148. package/dist/program-UTSXNAHM.js +0 -743
  149. package/dist/program-UTSXNAHM.js.map +0 -1
  150. package/dist/query-UI6GQEL7.js +0 -2
  151. package/dist/registry-JW6ETTBA.js +0 -2
  152. package/dist/schedule-tool-KFZ27JTH.js +0 -2
  153. package/dist/wiki-4LAJ36XR.js +0 -2
  154. /package/dist/{App-G37JNRBW.js.map → App-WZ3HAKES.js.map} +0 -0
  155. /package/dist/{ChatApp-NCKC7C3L.js.map → ChatApp-K4HDJL2S.js.map} +0 -0
  156. /package/dist/{absorb-eval-ZCWHWKAD.js.map → absorb-eval-ER27DHHK.js.map} +0 -0
  157. /package/dist/{agent-LJ4SUQCC.js.map → agent-AQSVISXX.js.map} +0 -0
  158. /package/dist/{client-A5OK3IFO.js.map → article-sync-4NOPOQU7.js.map} +0 -0
  159. /package/dist/{chunk-VJRITDSQ.js.map → chunk-6O6NW3ZG.js.map} +0 -0
  160. /package/dist/{chunk-4O4GZBKZ.js.map → chunk-AKOXTIJS.js.map} +0 -0
  161. /package/dist/{chunk-4ZFLYY5P.js.map → chunk-APZIH3AY.js.map} +0 -0
  162. /package/dist/{chunk-DVR6PFCJ.js.map → chunk-B2Q3PTPS.js.map} +0 -0
  163. /package/dist/{chunk-4VDA4UM7.js.map → chunk-BKHIR2YJ.js.map} +0 -0
  164. /package/dist/{chunk-XIA2ACKX.js.map → chunk-CSWGYSC4.js.map} +0 -0
  165. /package/dist/{chunk-Z5CBUZIW.js.map → chunk-E2VDBT3T.js.map} +0 -0
  166. /package/dist/{chunk-XZN7QBRH.js.map → chunk-ERNBJLIQ.js.map} +0 -0
  167. /package/dist/{chunk-R6UCPHUD.js.map → chunk-IA7INHXY.js.map} +0 -0
  168. /package/dist/{chunk-XOQNDWVW.js.map → chunk-KIYV4ZHG.js.map} +0 -0
  169. /package/dist/{chunk-CPMQZ6Z7.js.map → chunk-KRK7OOTK.js.map} +0 -0
  170. /package/dist/{chunk-ARSVKSC4.js.map → chunk-L2WVQREN.js.map} +0 -0
  171. /package/dist/{chunk-SCC7HBFZ.js.map → chunk-MFIM5Y3J.js.map} +0 -0
  172. /package/dist/{chunk-CDLJOGVZ.js.map → chunk-VSL2SSBH.js.map} +0 -0
  173. /package/dist/{chunk-X5JTG52Q.js.map → chunk-WKQQIYOE.js.map} +0 -0
  174. /package/dist/{chunk-PVUNDNT3.js.map → chunk-YA6E47BR.js.map} +0 -0
  175. /package/dist/{chunk-AOFTTIZZ.js.map → chunk-YPCZ5TNK.js.map} +0 -0
  176. /package/dist/{chunk-BWSB7NOX.js.map → chunk-YQRWUF4Y.js.map} +0 -0
  177. /package/dist/{chunk-BCUR2TJ7.js.map → chunk-YVR6652A.js.map} +0 -0
  178. /package/dist/{config-DQ5SILHX.js.map → client-YIR3ELVN.js.map} +0 -0
  179. /package/dist/{config-mutate-62FCJ3S6.js.map → config-4DOJYA2K.js.map} +0 -0
  180. /package/dist/{config-mutator-3ZL5YQSO.js.map → config-mutate-KDRHKQE4.js.map} +0 -0
  181. /package/dist/{doctor-7TPSMMFA.js.map → config-mutator-4PPBACWU.js.map} +0 -0
  182. /package/dist/{graph-5ZJ7YACP.js.map → doctor-FJ5RCG4J.js.map} +0 -0
  183. /package/dist/{follow-up-tool-FKWIRFPW.js.map → follow-up-tool-SVZDSUIU.js.map} +0 -0
  184. /package/dist/{hub-EU5ECAJB.js.map → graph-EXDH7EPZ.js.map} +0 -0
  185. /package/dist/{load-NK3MIYXP.js.map → hub-CF4VFSRT.js.map} +0 -0
  186. /package/dist/{notes-2VC47RCK.js.map → load-5DNMGHFW.js.map} +0 -0
  187. /package/dist/{notes-settings-X63D5HPM.js.map → model-call-BGTDPWZD.js.map} +0 -0
  188. /package/dist/{processes-5MP32QZT.js.map → notes-WJJEJ4CJ.js.map} +0 -0
  189. /package/dist/{promote-XBDWCHLU.js.map → notes-settings-WMOH2V75.js.map} +0 -0
  190. /package/dist/{query-UI6GQEL7.js.map → processes-M3N3S7V5.js.map} +0 -0
  191. /package/dist/{registry-JW6ETTBA.js.map → promote-G6BOY7K5.js.map} +0 -0
  192. /package/dist/{routing-2V3Y6ZR5.js.map → query-H24BI3BI.js.map} +0 -0
  193. /package/dist/{schedule-tool-KFZ27JTH.js.map → registry-TAUHYJCK.js.map} +0 -0
  194. /package/dist/{request-planner-SEXYQN7D.js.map → request-planner-V3R5J3V4.js.map} +0 -0
  195. /package/dist/{review-candidates-PIJWPPHQ.js.map → review-candidates-TC7RJB4W.js.map} +0 -0
  196. /package/dist/{scheduler-SVZKDKJV.js.map → roster-IRXP32XF.js.map} +0 -0
  197. /package/dist/{rotation-memo-7VLREGS6.js.map → rotation-memo-2G6N3VF3.js.map} +0 -0
  198. /package/dist/{seat-C6TMCJWI.js.map → routing-XQD74ERK.js.map} +0 -0
  199. /package/dist/{wiki-4LAJ36XR.js.map → schedule-tool-U6KLY5MT.js.map} +0 -0
  200. /package/dist/{select-DP64KWO4.js.map → select-I6BSBQXP.js.map} +0 -0
  201. /package/dist/{set-enabled-WCH6FU4N.js.map → set-enabled-THNVITGU.js.map} +0 -0
  202. /package/dist/{tool-TWQRBV4Y.js.map → tool-CEBIS6GK.js.map} +0 -0
  203. /package/dist/{tool-WUK3ZOWG.js.map → tool-LFWTZHB7.js.map} +0 -0
@@ -1,55 +0,0 @@
1
- import{c as j}from"./chunk-VD7IO653.js";import{a as D,b as I,c as _,d as L,e as T,j as U}from"./chunk-XIA2ACKX.js";import{y as O,z as V}from"./chunk-R6UCPHUD.js";import{b as P,c as $}from"./chunk-QOYAX2FT.js";import{readFileSync as J,existsSync as N}from"fs";V();import{resolve as W}from"path";import{execSync as z}from"child_process";async function pt(e,r,o,t={}){let d=t.selectorModel??"haiku",l=t.synthModel??"sonnet",p=t.maxCandidates??3,g=t.maxHops??2,h=t.maxArticles??8,s=t.timeoutMs??6e4,a=t.log??console.error.bind(console,"[wiki-query]"),c=t.messagePath?.length?t.messagePath:void 0,n=t.graphWeight??C,i=W(r.baseDir,"_index.md"),u=H(r,o,t.shared);if(!N(i)&&u.sharedPool.length===0)return S("no-catalog",e,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let f=(N(i)?J(i,"utf-8"):"")+q(e,u.sharedPool,c,n),E=Date.now(),k=[],y="";try{let m=await G(e,u.pool,o,p,c,n);m?(k=m,y=`[wiki-rerank seat] ${m.map(b=>b.title).join(" | ")}`):(y=await Q(et(e,f,p,c),d,s),k=nt(y))}catch(m){return a("selector failed:",m?.message),{...S("error",e,`Selector: ${m?.message||"unknown"}`),trace:{selectorMs:Date.now()-E,synthesisMs:0,selectorOutput:y}}}let x=Date.now()-E;if(k.length===0)return{...S("no-candidates",e,"Selector returned no candidates."),trace:{selectorMs:x,synthesisMs:0,selectorOutput:y}};let A=Y(k,u,g,h);if(A.length===0)return{...S("no-candidates",e,"Candidates did not resolve to readable articles."),candidates:k,trace:{selectorMs:x,synthesisMs:0,selectorOutput:y}};let v=Date.now(),R="";try{R=await Q(rt(e,A),l,s*2)}catch(m){return a("synthesis failed:",m?.message),{...S("error",e,`Synthesis: ${m?.message||"unknown"}`),candidates:k,walked:A.map(b=>({title:b.meta.title,path:b.path,type:b.meta.type,hop:b.hop??0})),trace:{selectorMs:x,synthesisMs:Date.now()-v,selectorOutput:y}}}let K=Date.now()-v;return{answer:R.trim(),citations:A.map(m=>({title:m.meta.title,path:m.path,type:m.meta.type})),candidates:k,walked:A.map(m=>({title:m.meta.title,path:m.path,type:m.meta.type,hop:m.hop??0})),status:"ok",trace:{selectorMs:x,synthesisMs:K,selectorOutput:y}}}async function gt(e,r,o,t={}){let d=t.maxCandidates??3,l=t.graphWeight??C,p=t.messagePath?.length?t.messagePath:void 0,g=t.pool??B(r);if(g.length===0||!e.trim())return[];let h=await G(e,g,o,d,p,l,t.stage??"retrieve");if(!h){let s=new Set($(e,P(g.map(F))).map(a=>a.docIndex));h=M(e,g,p,l).filter(a=>s.has(a)).slice(0,d).map(a=>({title:g[a].title,path:g[a].path}))}return h.length===0?[]:Y(h,H(r,o),t.maxHops??1,t.maxArticles??6)}function B(e){try{return(e.rebuildIndex().articles??[]).filter(r=>r.path&&!r.path.includes("/_versions/"))}catch{return[]}}function S(e,r,o){return{answer:"",citations:[],candidates:[],walked:[],status:e,error:o}}function H(e,r,o=[]){let t=new Map,d=[];for(let s of e.listArticles(r||""))t.set(s.meta.title.toLowerCase(),s.path),d.push({path:s.path,related:s.meta.related??[],lastUpdated:s.meta.lastUpdated??""});let l=[],p=new Map;for(let s of o)if(s.store.baseDir!==e.baseDir){p.set(s.id,s);for(let a of s.store.listArticles(r||"")){if(a.path.includes("/_versions/")||s.skip?.(a.path))continue;let c=`@${s.id}/${a.path}`;l.push(X(a,c)),d.push({path:c,related:a.meta.related??[],lastUpdated:a.meta.lastUpdated??""});let n=a.meta.title.toLowerCase();t.has(n)||t.set(n,c)}}let g=new Map;if(p.size>0)for(let s of[...d].sort((a,c)=>c.lastUpdated.localeCompare(a.lastUpdated)))for(let a of s.related){let c=a.toLowerCase(),n=g.get(c)??[];n.includes(s.path)||n.push(s.path),g.set(c,n)}let h;return{backlinks:g,get pool(){return h??=[...B(e),...l]},sharedPool:l,titleIndex:t,read(s){let a=s.match(/^@([^/]+)\/(.+)$/),c=a?p.get(a[1]):void 0;if(a&&!c)return null;let n=c?.store??e,i=a?a[2]:s,u=r?n.readArticleAs(i,r):n.readArticle(i);return u?{...u,path:s}:null}}}function X(e,r){return{path:r,title:e.meta.title,type:e.meta.type,related:e.meta.related,tags:e.meta.tags||[],owner:e.meta.owner,access:e.meta.access,sharedWith:e.meta.sharedWith,aliases:[e.meta.title.toLowerCase(),...(e.meta.aliases??[]).map(o=>o.toLowerCase())],backlinks:0,sources:e.meta.sources,lastUpdated:e.meta.lastUpdated,graphPath:e.meta.graphPath}}var Z=150;function q(e,r,o,t){return r.length===0?"":`
2
-
3
- ## Shared wiki (other agents' articles)
4
-
5
- ${M(e,r,o,t).slice(0,Z).map(l=>`- ${r[l].title}${r[l].type?` [${r[l].type}]`:""} (${r[l].path})`).join(`
6
- `)}
7
- `}var tt=3;function Y(e,r,o,t){let d=r.titleIndex,l=n=>n.startsWith("@"),p=[...e.filter(n=>!l(n.path)),...e.filter(n=>l(n.path))],g=p.length>0&&!l(p[0].path)?Math.floor(t/2):t,h=new Map,s=0,a=p.map(n=>({path:n.path,hop:0})),c=[];for(;h.size<t;){if(!a.length){if(!c.length||g>=t)break;g=t,a=c.splice(0)}let n=a.shift();if(h.has(n.path)||n.hop>o)continue;if(l(n.path)&&s>=g){c.push(n);continue}let i=r.read(n.path);if(i&&(h.set(n.path,{...i,hop:n.hop}),l(n.path)&&s++,!(n.hop>=o))){if(n.hop===0){let u=[i.meta.title,...i.meta.aliases??[]].map(f=>f.toLowerCase()),w=[...new Set(u.flatMap(f=>r.backlinks.get(f)??[]))].filter(f=>f!==n.path&&!h.has(f)).slice(0,tt);for(let f of w)a.push({path:f,hop:1})}for(let u of i.meta.related||[]){let w=d.get(u.toLowerCase());w&&!h.has(w)&&a.push({path:w,hop:n.hop+1})}}}return Array.from(h.values())}async function G(e,r,o,t,d,l=C,p="catalog-selector"){try{if(r.length<2)return null;let h=M(e,r,d,l).slice(0,I).map(n=>({id:`k${n}`,title:r[n].title||r[n].path,tags:r[n].tags,excerpt:[r[n].type?`type: ${r[n].type}`:"",(r[n].related??[]).length?`related: ${(r[n].related??[]).join(", ")}`:"",(r[n].graphPath??[]).length?`graph: ${(r[n].graphPath??[]).join(" \u203A ")}`:""].filter(Boolean).join(" \xB7 ")})),s=await O(D,_({query:e,candidates:h,excerptChars:300}),L(h),{features:{agent:o??"unknown",stage:p}});if(!s||s.mode!=="active")return null;let c=T(s.answers,h).ranked.slice(0,t).map(n=>r[Number(n.slice(1))]).filter(Boolean).map(n=>({title:n.title,path:n.path}));return c.length>0?c:null}catch{return null}}var C=.6;function M(e,r,o,t=C){let d=$(e,P(r.map(F))),l=d.reduce((i,u)=>Math.max(i,u.score),0),p=new Map(d.map(i=>[i.docIndex,l>0?i.score/l:0])),g=!!o?.length,h=i=>g&&i.graphPath?.length?U(o,i.graphPath):0,s=(i,u)=>u.score-i.score||i.i-u.i,a=r.map((i,u)=>({i:u,score:(p.get(u)??0)*(1+t*h(i))})).filter(i=>p.has(i.i)).sort(s),c=r.map((i,u)=>({i:u,score:h(i)})).filter(i=>!p.has(i.i)&&i.score>0).sort(s),n=[...a,...c].map(i=>i.i);for(let i=0;i<r.length;i++)n.includes(i)||n.push(i);return n}function F(e){return[e.title,(e.tags??[]).join(" "),(e.related??[]).join(" ")].join(" ")}function et(e,r,o,t){let d=t?.length?`
8
- ## Intent
9
-
10
- The request was classified under the intent-graph path "${t.join(" \u203A ")}". Prefer articles filed under the same branch when their titles are equally plausible.
11
- `:"";return`You are picking candidate articles from a wiki catalog to answer a question. You do NOT answer the question. You pick which articles the answer is likely to come from.
12
-
13
- ## Question
14
-
15
- ${e}
16
- ${d}
17
- ## Catalog (_index.md \u2014 articles grouped by type, with wikilink previews)
18
-
19
- ${r}
20
-
21
- ## Your task
22
-
23
- Pick up to ${o} articles from the catalog that are most likely to answer the question. Prefer:
24
- - Articles whose title directly names a subject in the question.
25
- - Articles of the right type (e.g. a "who owns X" question \u2192 person or project; a "what happened on DATE" \u2192 event).
26
- - Articles whose wikilinks suggest they sit at the center of a relevant subgraph.
27
-
28
- Return ONLY valid JSON, no markdown fencing, no prose:
29
-
30
- [
31
- {"title": "Exact Article Title", "path": "path/from/catalog.md"},
32
- ...
33
- ]
34
-
35
- If none of the articles match, return [].`}function rt(e,r){let o=r.map(t=>{let d=[t.meta.owner?`owner: ${t.meta.owner}`:"",t.meta.lastUpdated?`updated: ${t.meta.lastUpdated}`:""].filter(Boolean).join(", "),l=`### ${t.meta.title} \u2014 ${t.meta.type||"untyped"} (${t.path}) [hop ${t.hop}]${d?` {${d}}`:""}`,p=t.meta.related?.length?`Related: ${t.meta.related.join(", ")}`:"";return[l,p,"",t.content].filter(Boolean).join(`
36
- `)}).join(`
37
-
38
- ---
39
-
40
- `);return`You are answering a question using a small subgraph of wiki articles. The articles were walked from the catalog; trust them over your prior knowledge.
41
-
42
- ## Question
43
-
44
- ${e}
45
-
46
- ## Articles (${r.length} walked from the catalog)
47
-
48
- ${o}
49
-
50
- ## Your task
51
-
52
- Answer the question in 2\u20136 sentences. Cite articles by their title in square brackets like [Article Title]. When two articles disagree, prefer the one updated more recently, and say which agent's page and date the answer comes from. If the articles do not answer the question, say so plainly (do not invent). Prefer concrete facts over hedging.
53
-
54
- Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function nt(e){let r=e.match(/\[[\s\S]*?\]/);if(!r)return[];try{let o=JSON.parse(r[0]);return Array.isArray(o)?o.filter(t=>t&&typeof t.title=="string"&&typeof t.path=="string").map(t=>({title:t.title,path:t.path})):[]}catch{return[]}}async function Q(e,r,o){let{writeFileSync:t,mkdirSync:d,rmSync:l}=await import("fs"),{tmpdir:p}=await import("os"),g=W(p(),`agentx-wiki-query-${process.pid}`);d(g,{recursive:!0});let h=W(g,`prompt-${Date.now()}.txt`);t(h,e);try{let s=`cat '${h}' | claude -p - --output-format json --max-turns 1 --model ${r} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,a=z(s,{env:j(),encoding:"utf-8",timeout:o,maxBuffer:4*1024*1024});try{let c=JSON.parse(a);return String(c.result||c.content||"")}catch{return a}}finally{try{l(h,{force:!0})}catch{}}}async function ut(e){try{let{loadDaemonConfig:r}=await import("./config-DQ5SILHX.js");return r(e).wiki.query.shared}catch{return!0}}export{pt as a,gt as b,B as c,Z as d,C as e,M as f,ut as g};
55
- //# sourceMappingURL=chunk-M7IJVOJA.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/wiki/query.ts"],"sourcesContent":["import { readFileSync, existsSync } from \"fs\"\nimport { buildIndex, scoreAll } from \"@/memory/bm25\"\nimport { askSeat } from \"@/decisions/seat\"\nimport { ancestryScore } from \"@/graph\"\nimport {\n DEFAULT_SHORTLIST,\n WIKI_RERANK_SEAT,\n rerankQuestions,\n rerankState,\n toRanking,\n type RerankCandidate,\n} from \"@/decisions/seats/wiki-rerank\"\nimport { claudeCliEnv } from \"@/utils/workspace-env\"\nimport { resolve } from \"path\"\nimport { execSync } from \"child_process\"\nimport type { WikiArticle, WikiIndex } from \"./types\"\nimport type { WikiStore } from \"./store\"\n\n/**\n * Agentic wiki query — the \"Farzapedia-faithful\" retrieval path.\n *\n * Two LLM calls + a deterministic graph walk:\n * 1. Selector (cheap): read `_index.md` + question → pick up to `maxCandidates`\n * candidate articles by title + type.\n * 2. Walk (pure code): starting from candidates, follow `related` wikilinks\n * up to `maxHops`, capped at `maxArticles` total.\n * 3. Synthesis (main): answer the question from the walked subgraph.\n *\n * Returns an answer with citations and a trace of which articles were walked,\n * so callers can audit the retrieval path.\n */\n\nexport interface AgenticQueryOptions {\n /** Candidate-selection model (cheap). Defaults to \"haiku\". */\n selectorModel?: string\n /** Synthesis model (main). Defaults to \"sonnet\". */\n synthModel?: string\n /** Number of candidates the selector is asked to return. Default 3. */\n maxCandidates?: number\n /** Wikilink hops from candidates. Default 2. */\n maxHops?: number\n /** Hard cap on total articles walked. Default 8. */\n maxArticles?: number\n /** Timeout per LLM call, ms. Default 60_000. */\n timeoutMs?: number\n /** Logger — defaults to console.error. */\n log?: (...args: unknown[]) => void\n /** Intent-graph path the question's request was classified under.\n * Articles on the same branch rank higher in candidate selection. */\n messagePath?: string[]\n /** Weight of the branch match against the text match, 0–1. Default 0.6\n * (`graph.retrievalWeights.graph`). */\n graphWeight?: number\n /** Other wikis to search besides `store`: the shared wiki (#824). Only\n * articles the requester may read are offered. Their paths come back\n * as `@<id>/<path>`. */\n shared?: SharedWikiStore[]\n}\n\n/** A wiki searched alongside the requester's own. */\nexport interface SharedWikiStore {\n /** Shown in citations as `@<id>/<path>`: an agent id, or \"shared\". */\n id: string\n store: WikiStore\n /** Paths to leave out, e.g. the agents/ tree under the root store. */\n skip?: (path: string) => boolean\n}\n\nexport interface AgenticQueryResult {\n answer: string\n citations: Array<{ title: string; path: string; type?: string }>\n /** Titles/paths the selector picked. */\n candidates: Array<{ title: string; path: string }>\n /** Full article subgraph the walk produced. */\n walked: Array<{ title: string; path: string; type?: string; hop: number }>\n /** \"no-catalog\" | \"no-candidates\" | \"ok\" */\n status: \"ok\" | \"no-catalog\" | \"no-candidates\" | \"error\"\n /** For operator debugging only. */\n trace?: {\n selectorMs: number\n synthesisMs: number\n selectorOutput?: string\n }\n error?: string\n}\n\n/**\n * Run an agentic query against a specific agent's WikiStore.\n *\n * `requesterId` is used for permission checks — only articles the requester\n * can read will be included in the synthesis input.\n */\nexport async function agenticQuery(\n question: string,\n store: WikiStore,\n requesterId: string | undefined,\n opts: AgenticQueryOptions = {},\n): Promise<AgenticQueryResult> {\n const selectorModel = opts.selectorModel ?? \"haiku\"\n const synthModel = opts.synthModel ?? \"sonnet\"\n const maxCandidates = opts.maxCandidates ?? 3\n const maxHops = opts.maxHops ?? 2\n const maxArticles = opts.maxArticles ?? 8\n const timeoutMs = opts.timeoutMs ?? 60_000\n const log = opts.log ?? console.error.bind(console, \"[wiki-query]\")\n const messagePath = opts.messagePath?.length ? opts.messagePath : undefined\n const graphWeight = opts.graphWeight ?? DEFAULT_GRAPH_WEIGHT\n\n // --- Step 1: Load the catalog ---\n const catalogPath = resolve(store.baseDir, \"_index.md\")\n const view = scopeView(store, requesterId, opts.shared)\n if (!existsSync(catalogPath) && view.sharedPool.length === 0) {\n return emptyResult(\"no-catalog\", question, \"No _index.md found — run `agentx wiki status` to rebuild.\")\n }\n const ownCatalog = existsSync(catalogPath) ? readFileSync(catalogPath, \"utf-8\") : \"\"\n const catalog = ownCatalog + renderSharedCatalog(question, view.sharedPool, messagePath, graphWeight)\n\n // --- Step 2: Selector — pick candidates ---\n const selectorStart = Date.now()\n let candidates: Array<{ title: string; path: string }> = []\n let selectorOutput = \"\"\n try {\n const viaSeat = await selectCandidatesViaSeat(question, view.pool, requesterId, maxCandidates, messagePath, graphWeight)\n if (viaSeat) {\n candidates = viaSeat\n selectorOutput = `[wiki-rerank seat] ${viaSeat.map((c) => c.title).join(\" | \")}`\n } else {\n selectorOutput = await runClaude(\n buildSelectorPrompt(question, catalog, maxCandidates, messagePath),\n selectorModel,\n timeoutMs,\n )\n candidates = parseCandidates(selectorOutput)\n }\n } catch (e: any) {\n log(\"selector failed:\", e?.message)\n return { ...emptyResult(\"error\", question, `Selector: ${e?.message || \"unknown\"}`), trace: { selectorMs: Date.now() - selectorStart, synthesisMs: 0, selectorOutput } }\n }\n const selectorMs = Date.now() - selectorStart\n\n if (candidates.length === 0) {\n return { ...emptyResult(\"no-candidates\", question, \"Selector returned no candidates.\"), trace: { selectorMs, synthesisMs: 0, selectorOutput } }\n }\n\n // --- Step 3: Walk the subgraph via `related` wikilinks ---\n const walked = walkSubgraph(candidates, view, maxHops, maxArticles)\n\n if (walked.length === 0) {\n return { ...emptyResult(\"no-candidates\", question, \"Candidates did not resolve to readable articles.\"), candidates, trace: { selectorMs, synthesisMs: 0, selectorOutput } }\n }\n\n // --- Step 4: Synthesize the answer ---\n const synthStart = Date.now()\n let answer = \"\"\n try {\n answer = await runClaude(\n buildSynthesisPrompt(question, walked),\n synthModel,\n timeoutMs * 2,\n )\n } catch (e: any) {\n log(\"synthesis failed:\", e?.message)\n return { ...emptyResult(\"error\", question, `Synthesis: ${e?.message || \"unknown\"}`), candidates, walked: walked.map(w => ({ title: w.meta.title, path: w.path, type: w.meta.type, hop: (w as any).hop ?? 0 })), trace: { selectorMs, synthesisMs: Date.now() - synthStart, selectorOutput } }\n }\n const synthesisMs = Date.now() - synthStart\n\n return {\n answer: answer.trim(),\n citations: walked.map(a => ({ title: a.meta.title, path: a.path, type: a.meta.type })),\n candidates,\n walked: walked.map(w => ({ title: w.meta.title, path: w.path, type: w.meta.type, hop: (w as any).hop ?? 0 })),\n status: \"ok\",\n trace: { selectorMs, synthesisMs, selectorOutput },\n }\n}\n\nexport interface RetrieveOptions {\n /** Articles picked before the walk. Default 3. */\n maxCandidates?: number\n /** Wikilink hops from the picked articles. Default 1. */\n maxHops?: number\n /** Hard cap on articles returned. Default 6. */\n maxArticles?: number\n messagePath?: string[]\n graphWeight?: number\n /** The catalog to pick from. Pass it when retrieving many times in a row,\n * so the index is not rebuilt for every call. */\n pool?: CatalogEntry[]\n /** Seat telemetry label. */\n stage?: string\n}\n\n/**\n * The retrieval half of agenticQuery, without the synthesis call: BM25\n * shortlist, rerank seat, then the `related` wikilink walk. Returns the\n * walked articles, hop 0 first.\n *\n * When the seat is off or fails, the BM25 order decides on its own, and\n * only articles the text matched are picked: an article chosen for\n * nothing but its catalog position is noise here, not a candidate. There\n * is no CLI fallback, so this never spends an LLM call.\n */\nexport async function retrieveArticles(\n question: string,\n store: WikiStore,\n requesterId: string | undefined,\n opts: RetrieveOptions = {},\n): Promise<Array<WikiArticle & { hop: number }>> {\n const maxCandidates = opts.maxCandidates ?? 3\n const graphWeight = opts.graphWeight ?? DEFAULT_GRAPH_WEIGHT\n const messagePath = opts.messagePath?.length ? opts.messagePath : undefined\n const pool = opts.pool ?? catalogPool(store)\n if (pool.length === 0 || !question.trim()) return []\n\n let candidates = await selectCandidatesViaSeat(\n question, pool, requesterId, maxCandidates, messagePath, graphWeight, opts.stage ?? \"retrieve\",\n )\n if (!candidates) {\n const matched = new Set(scoreAll(question, buildIndex(pool.map(catalogDoc))).map((r) => r.docIndex))\n candidates = rankCatalogPool(question, pool, messagePath, graphWeight)\n .filter((i) => matched.has(i))\n .slice(0, maxCandidates)\n .map((i) => ({ title: pool[i].title, path: pool[i].path }))\n }\n if (candidates.length === 0) return []\n return walkSubgraph(candidates, scopeView(store, requesterId), opts.maxHops ?? 1, opts.maxArticles ?? 6)\n}\n\nexport type CatalogEntry = WikiIndex[\"articles\"][number]\n\n/** The catalog retrieval picks from: every indexed article but old versions. */\nexport function catalogPool(store: WikiStore): CatalogEntry[] {\n try {\n return (store.rebuildIndex().articles ?? []).filter((a) => a.path && !a.path.includes(\"/_versions/\"))\n } catch {\n return []\n }\n}\n\n// --- Helpers ---\n\nfunction emptyResult(\n status: AgenticQueryResult[\"status\"],\n _question: string,\n error?: string,\n): AgenticQueryResult {\n return {\n answer: \"\",\n citations: [],\n candidates: [],\n walked: [],\n status,\n error,\n }\n}\n\n/**\n * The articles a query may open: the requester's own wiki first, then\n * each shared one. Shared paths carry an `@<id>/` prefix so the walk\n * knows which store to read; a title the own wiki has resolves there.\n */\ninterface ScopeView {\n /** Own catalog, then the shared articles. */\n pool: CatalogEntry[]\n sharedPool: CatalogEntry[]\n titleIndex: Map<string, string>\n /** Title (lowercased) → pages whose `related` names it, newest first.\n * Built only when shared wikis are searched. */\n backlinks: Map<string, string[]>\n read(path: string): WikiArticle | null\n}\n\nfunction scopeView(store: WikiStore, requesterId: string | undefined, shared: SharedWikiStore[] = []): ScopeView {\n const titleIndex = new Map<string, string>()\n const linking: Array<{ path: string; related: string[]; lastUpdated: string }> = []\n for (const article of store.listArticles(requesterId || \"\")) {\n titleIndex.set(article.meta.title.toLowerCase(), article.path)\n linking.push({ path: article.path, related: article.meta.related ?? [], lastUpdated: article.meta.lastUpdated ?? \"\" })\n }\n const sharedPool: CatalogEntry[] = []\n const byId = new Map<string, SharedWikiStore>()\n for (const s of shared) {\n if (s.store.baseDir === store.baseDir) continue\n byId.set(s.id, s)\n // listArticles is cached and already drops what the requester can't\n // read; rebuilding every agent's index per query would not be.\n for (const a of s.store.listArticles(requesterId || \"\")) {\n if (a.path.includes(\"/_versions/\") || s.skip?.(a.path)) continue\n const path = `@${s.id}/${a.path}`\n sharedPool.push(catalogEntry(a, path))\n linking.push({ path, related: a.meta.related ?? [], lastUpdated: a.meta.lastUpdated ?? \"\" })\n const key = a.meta.title.toLowerCase()\n if (!titleIndex.has(key)) titleIndex.set(key, path)\n }\n }\n // In a fleet's shared pool the page that answers a question often links\n // TO the page the selector picked (a decision about a person), and the\n // forward walk never reaches it (#824 review: ranked 103rd of ~5,700).\n const backlinks = new Map<string, string[]>()\n if (byId.size > 0) {\n for (const l of [...linking].sort((a, b) => b.lastUpdated.localeCompare(a.lastUpdated))) {\n for (const t of l.related) {\n const key = t.toLowerCase()\n const list = backlinks.get(key) ?? []\n if (!list.includes(l.path)) list.push(l.path)\n backlinks.set(key, list)\n }\n }\n }\n let pool: CatalogEntry[] | undefined\n return {\n backlinks,\n // Lazy: retrieveArticles brings its own pool, and building this one\n // rebuilds the index.\n get pool() { return (pool ??= [...catalogPool(store), ...sharedPool]) },\n sharedPool,\n titleIndex,\n read(path) {\n const m = path.match(/^@([^/]+)\\/(.+)$/)\n const target = m ? byId.get(m[1]) : undefined\n if (m && !target) return null\n const s = target?.store ?? store\n const rel = m ? m[2] : path\n const article = requesterId ? s.readArticleAs(rel, requesterId) : s.readArticle(rel)\n return article ? { ...article, path } : null\n },\n }\n}\n\nfunction catalogEntry(a: WikiArticle, path: string): CatalogEntry {\n return {\n path,\n title: a.meta.title,\n type: a.meta.type,\n related: a.meta.related,\n tags: a.meta.tags || [],\n owner: a.meta.owner,\n access: a.meta.access,\n sharedWith: a.meta.sharedWith,\n aliases: [a.meta.title.toLowerCase(), ...(a.meta.aliases ?? []).map((x) => x.toLowerCase())],\n backlinks: 0,\n sources: a.meta.sources,\n lastUpdated: a.meta.lastUpdated,\n graphPath: a.meta.graphPath,\n }\n}\n\n/** Shared articles most related to the question, for the CLI selector.\n * Capped: a fleet's shared catalog would not fit one prompt. */\nexport const SHARED_CATALOG_LINES = 150\n\nfunction renderSharedCatalog(question: string, pool: CatalogEntry[], messagePath: string[] | undefined, graphWeight: number): string {\n if (pool.length === 0) return \"\"\n const lines = rankCatalogPool(question, pool, messagePath, graphWeight)\n .slice(0, SHARED_CATALOG_LINES)\n .map((i) => `- ${pool[i].title}${pool[i].type ? ` [${pool[i].type}]` : \"\"} (${pool[i].path})`)\n return `\\n\\n## Shared wiki (other agents' articles)\\n\\n${lines.join(\"\\n\")}\\n`\n}\n\n/** Pages that link to a picked page, opened per picked page. */\nconst BACKLINKS_PER_PICK = 3\n\nfunction walkSubgraph(\n candidates: Array<{ title: string; path: string }>,\n view: ScopeView,\n maxHops: number,\n maxArticles: number,\n): Array<WikiArticle & { hop: number }> {\n const titleIndex = view.titleIndex\n const isShared = (path: string) => path.startsWith(\"@\")\n\n // The agent's own pages come first, and shared pages may take at most\n // half the walk when it has any: in the #824 trial shared pages took\n // the slots of the agent's own correct pages and its score dropped.\n const ordered = [...candidates.filter((c) => !isShared(c.path)), ...candidates.filter((c) => isShared(c.path))]\n let sharedCap = ordered.length > 0 && !isShared(ordered[0].path) ? Math.floor(maxArticles / 2) : maxArticles\n\n const opened = new Map<string, WikiArticle & { hop: number }>()\n let sharedOpened = 0\n let frontier: Array<{ path: string; hop: number }> = ordered.map((c) => ({ path: c.path, hop: 0 }))\n // Shared pages turned away by the cap, in walk order. When the agent's\n // own pages run out first they get the slots left: an own pick with no\n // own neighbours must not leave the walk short of shared pages that answer.\n const deferred: Array<{ path: string; hop: number }> = []\n\n while (opened.size < maxArticles) {\n if (!frontier.length) {\n if (!deferred.length || sharedCap >= maxArticles) break\n sharedCap = maxArticles\n frontier = deferred.splice(0)\n }\n const next = frontier.shift()!\n if (opened.has(next.path)) continue\n if (next.hop > maxHops) continue\n if (isShared(next.path) && sharedOpened >= sharedCap) { deferred.push(next); continue }\n\n const article = view.read(next.path)\n if (!article) continue\n\n opened.set(next.path, { ...article, hop: next.hop })\n if (isShared(next.path)) sharedOpened++\n if (next.hop >= maxHops) continue\n\n if (next.hop === 0) {\n // Pages link to a subject by any of its names; skip what is already\n // open before taking the newest few, or an opened page uses a slot.\n const names = [article.meta.title, ...(article.meta.aliases ?? [])].map((n) => n.toLowerCase())\n const linking = [...new Set(names.flatMap((n) => view.backlinks.get(n) ?? []))]\n .filter((path) => path !== next.path && !opened.has(path))\n .slice(0, BACKLINKS_PER_PICK)\n for (const path of linking) frontier.push({ path, hop: 1 })\n }\n for (const target of article.meta.related || []) {\n const path = titleIndex.get(target.toLowerCase())\n if (path && !opened.has(path)) {\n frontier.push({ path, hop: next.hop + 1 })\n }\n }\n }\n\n return Array.from(opened.values())\n}\n\n// --- Prompts ---\n\n/**\n * Pick candidates with the wiki-rerank seat instead of a Claude CLI call.\n *\n * The selector is 56% of a wiki query — 14.1s of a 25s total, measured —\n * and its whole job is \"pick 3 articles from this catalog\", which is a\n * Choice with per-option probabilities. Jev answers that in about a\n * second. Synthesis stays on Sonnet; it writes prose, which Jev cannot.\n *\n * BM25 shortlists first because the shared catalog carries 971 entries,\n * past the 255-option cap. Same two-stage shape as findRelevantReranked,\n * and it reuses that seat rather than introducing a second one.\n *\n * Returns null whenever the seat is off, errors, or has nothing to rank,\n * and the caller falls back to the CLI selector — so this is strictly an\n * accelerator, never a new way to fail.\n */\nasync function selectCandidatesViaSeat(\n question: string,\n pool: CatalogEntry[],\n requesterId: string | undefined,\n maxCandidates: number,\n messagePath?: string[],\n graphWeight: number = DEFAULT_GRAPH_WEIGHT,\n stage = \"catalog-selector\",\n): Promise<Array<{ title: string; path: string }> | null> {\n try {\n if (pool.length < 2) return null\n\n const shortlist = rankCatalogPool(question, pool, messagePath, graphWeight).slice(0, DEFAULT_SHORTLIST)\n\n const candidates: RerankCandidate[] = shortlist.map((i) => ({\n id: `k${i}`,\n title: pool[i].title || pool[i].path,\n tags: pool[i].tags,\n // The catalog has no body — a title, its type, its wikilinks and its\n // branch of the intent graph are what the selector chooses on.\n excerpt: [\n pool[i].type ? `type: ${pool[i].type}` : \"\",\n (pool[i].related ?? []).length ? `related: ${(pool[i].related ?? []).join(\", \")}` : \"\",\n (pool[i].graphPath ?? []).length ? `graph: ${(pool[i].graphPath ?? []).join(\" › \")}` : \"\",\n ].filter(Boolean).join(\" · \"),\n }))\n\n const result = await askSeat(\n WIKI_RERANK_SEAT,\n rerankState({ query: question, candidates, excerptChars: 300 }),\n rerankQuestions(candidates),\n { features: { agent: requesterId ?? \"unknown\", stage } },\n )\n if (!result || result.mode !== \"active\") return null\n\n const ranking = toRanking(result.answers as never, candidates)\n const picked = ranking.ranked\n .slice(0, maxCandidates)\n .map((id) => pool[Number(id.slice(1))])\n .filter(Boolean)\n .map((a) => ({ title: a.title, path: a.path }))\n return picked.length > 0 ? picked : null\n } catch {\n return null\n }\n}\n\n/** Weight of the intent-graph branch match against the text match when\n * shortlisting catalog candidates. Mirrors `graph.retrievalWeights.graph`. */\nexport const DEFAULT_GRAPH_WEIGHT = 0.6\n\n/**\n * Order the catalog pool for a question. Three bands, never mixed:\n *\n * 1. articles the text match scored, ordered by `text * (1 + w * branch)`\n * when the request was classified: the branch reorders text matches\n * but cannot lift an unrelated article above one;\n * 2. articles on the request's branch that the text never matched, by\n * how much of the path they share;\n * 3. the rest, in catalog order.\n *\n * Band 1 comes first in full because the shortlist the reranker sees is\n * finite (DEFAULT_SHORTLIST): a busy category holds more same-branch\n * articles than that, and a blended score let them push the article that\n * actually answers the question out of the list.\n *\n * Exported for tests; the seat and the CLI selector both consume the order.\n */\nexport function rankCatalogPool(\n question: string,\n pool: Array<{ title: string; tags?: string[]; related?: string[]; graphPath?: string[] }>,\n messagePath?: string[],\n graphWeight: number = DEFAULT_GRAPH_WEIGHT,\n): number[] {\n const bm25 = scoreAll(question, buildIndex(pool.map(catalogDoc)))\n const maxBm25 = bm25.reduce((m, r) => Math.max(m, r.score), 0)\n const text = new Map(bm25.map((r) => [r.docIndex, maxBm25 > 0 ? r.score / maxBm25 : 0]))\n const useGraph = !!messagePath?.length\n const branch = (a: { graphPath?: string[] }) =>\n useGraph && a.graphPath?.length ? ancestryScore(messagePath!, a.graphPath) : 0\n\n const byScore = (x: { i: number; score: number }, y: { i: number; score: number }) => y.score - x.score || x.i - y.i\n const matched = pool\n .map((a, i) => ({ i, score: (text.get(i) ?? 0) * (1 + graphWeight * branch(a)) }))\n .filter((c) => text.has(c.i))\n .sort(byScore)\n const branchOnly = pool\n .map((a, i) => ({ i, score: branch(a) }))\n .filter((c) => !text.has(c.i) && c.score > 0)\n .sort(byScore)\n const ranked = [...matched, ...branchOnly].map((c) => c.i)\n for (let i = 0; i < pool.length; i++) if (!ranked.includes(i)) ranked.push(i)\n return ranked\n}\n\n/** What BM25 sees of a catalog entry: the catalog carries no body. */\nfunction catalogDoc(a: { title: string; tags?: string[]; related?: string[] }): string {\n return [a.title, (a.tags ?? []).join(\" \"), (a.related ?? []).join(\" \")].join(\" \")\n}\n\nfunction buildSelectorPrompt(question: string, catalog: string, maxCandidates: number, messagePath?: string[]): string {\n const branch = messagePath?.length\n ? `\\n## Intent\\n\\nThe request was classified under the intent-graph path \"${messagePath.join(\" › \")}\". Prefer articles filed under the same branch when their titles are equally plausible.\\n`\n : \"\"\n return `You are picking candidate articles from a wiki catalog to answer a question. You do NOT answer the question. You pick which articles the answer is likely to come from.\n\n## Question\n\n${question}\n${branch}\n## Catalog (_index.md — articles grouped by type, with wikilink previews)\n\n${catalog}\n\n## Your task\n\nPick up to ${maxCandidates} articles from the catalog that are most likely to answer the question. Prefer:\n- Articles whose title directly names a subject in the question.\n- Articles of the right type (e.g. a \"who owns X\" question → person or project; a \"what happened on DATE\" → event).\n- Articles whose wikilinks suggest they sit at the center of a relevant subgraph.\n\nReturn ONLY valid JSON, no markdown fencing, no prose:\n\n[\n {\"title\": \"Exact Article Title\", \"path\": \"path/from/catalog.md\"},\n ...\n]\n\nIf none of the articles match, return [].`\n}\n\nfunction buildSynthesisPrompt(\n question: string,\n articles: Array<WikiArticle & { hop: number }>,\n): string {\n const articlesBlock = articles\n .map(a => {\n // Owner and date let the answer say where a fact came from and pick\n // the newer page when two disagree (#824).\n const from = [a.meta.owner ? `owner: ${a.meta.owner}` : \"\", a.meta.lastUpdated ? `updated: ${a.meta.lastUpdated}` : \"\"].filter(Boolean).join(\", \")\n const header = `### ${a.meta.title} — ${a.meta.type || \"untyped\"} (${a.path}) [hop ${a.hop}]${from ? ` {${from}}` : \"\"}`\n const related = a.meta.related?.length ? `Related: ${a.meta.related.join(\", \")}` : \"\"\n return [header, related, \"\", a.content].filter(Boolean).join(\"\\n\")\n })\n .join(\"\\n\\n---\\n\\n\")\n\n return `You are answering a question using a small subgraph of wiki articles. The articles were walked from the catalog; trust them over your prior knowledge.\n\n## Question\n\n${question}\n\n## Articles (${articles.length} walked from the catalog)\n\n${articlesBlock}\n\n## Your task\n\nAnswer the question in 2–6 sentences. Cite articles by their title in square brackets like [Article Title]. When two articles disagree, prefer the one updated more recently, and say which agent's page and date the answer comes from. If the articles do not answer the question, say so plainly (do not invent). Prefer concrete facts over hedging.\n\nOutput ONLY the answer — no preamble, no \"here is my answer:\", no markdown fencing.`\n}\n\nfunction parseCandidates(raw: string): Array<{ title: string; path: string }> {\n const match = raw.match(/\\[[\\s\\S]*?\\]/)\n if (!match) return []\n try {\n const parsed = JSON.parse(match[0])\n if (!Array.isArray(parsed)) return []\n return parsed\n .filter((x: any) => x && typeof x.title === \"string\" && typeof x.path === \"string\")\n .map((x: any) => ({ title: x.title, path: x.path }))\n } catch {\n return []\n }\n}\n\nasync function runClaude(prompt: string, model: string, timeoutMs: number): Promise<string> {\n // Use stdin via a temp-file pipe to avoid shell-escaping a huge prompt.\n // Prompts can exceed the `-E` arg buffer on macOS, so we always pipe.\n const { writeFileSync, mkdirSync, rmSync } = await import(\"fs\")\n const { tmpdir } = await import(\"os\")\n const dir = resolve(tmpdir(), `agentx-wiki-query-${process.pid}`)\n mkdirSync(dir, { recursive: true })\n const promptPath = resolve(dir, `prompt-${Date.now()}.txt`)\n writeFileSync(promptPath, prompt)\n try {\n const cmd = `cat '${promptPath}' | claude -p - --output-format json --max-turns 1 --model ${model} --disallowedTools \"Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit\"`\n const raw = execSync(cmd, { env: claudeCliEnv(), encoding: \"utf-8\", timeout: timeoutMs, maxBuffer: 4 * 1024 * 1024 })\n try {\n const envelope = JSON.parse(raw)\n return String(envelope.result || envelope.content || \"\")\n } catch {\n return raw\n }\n } finally {\n try { rmSync(promptPath, { force: true }) } catch {}\n }\n}\n\n/** `wiki.query.shared` from agentx.json: whether a query also searches the\n * shared wiki. On when there is no config to read. The CLI and the\n * `agentx_wiki_query` tool both ask here, so the switch reaches both. */\nexport async function sharedQueryEnabled(configPath?: string): Promise<boolean> {\n try {\n const { loadDaemonConfig } = await import(\"@/daemon/config\")\n return loadDaemonConfig(configPath).wiki.query.shared\n } catch {\n return true\n }\n}\n"],"mappings":"iNAAA,OAAS,gBAAAA,EAAc,cAAAC,MAAkB,KAEzCC,IAWA,OAAS,WAAAC,MAAe,OACxB,OAAS,YAAAC,MAAgB,gBA8EzB,eAAsBC,GACpBC,EACAC,EACAC,EACAC,EAA4B,CAAC,EACA,CAC7B,IAAMC,EAAgBD,EAAK,eAAiB,QACtCE,EAAaF,EAAK,YAAc,SAChCG,EAAgBH,EAAK,eAAiB,EACtCI,EAAUJ,EAAK,SAAW,EAC1BK,EAAcL,EAAK,aAAe,EAClCM,EAAYN,EAAK,WAAa,IAC9BO,EAAMP,EAAK,KAAO,QAAQ,MAAM,KAAK,QAAS,cAAc,EAC5DQ,EAAcR,EAAK,aAAa,OAASA,EAAK,YAAc,OAC5DS,EAAcT,EAAK,aAAeU,EAGlCC,EAAcjB,EAAQI,EAAM,QAAS,WAAW,EAChDc,EAAOC,EAAUf,EAAOC,EAAaC,EAAK,MAAM,EACtD,GAAI,CAACc,EAAWH,CAAW,GAAKC,EAAK,WAAW,SAAW,EACzD,OAAOG,EAAY,aAAclB,EAAU,gEAA2D,EAGxG,IAAMmB,GADaF,EAAWH,CAAW,EAAIM,EAAaN,EAAa,OAAO,EAAI,IACrDO,EAAoBrB,EAAUe,EAAK,WAAYJ,EAAaC,CAAW,EAG9FU,EAAgB,KAAK,IAAI,EAC3BC,EAAqD,CAAC,EACtDC,EAAiB,GACrB,GAAI,CACF,IAAMC,EAAU,MAAMC,EAAwB1B,EAAUe,EAAK,KAAMb,EAAaI,EAAeK,EAAaC,CAAW,EACnHa,GACFF,EAAaE,EACbD,EAAiB,sBAAsB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AAEO,EAAOG,EAAY,CAAE,MAAO,EAAK,CAAC,CAAE,MAAE,CAAO,CACrD,CACF,CAKA,eAAsBI,GAAmBC,EAAuC,CAC9E,GAAI,CACF,GAAM,CAAE,iBAAAC,CAAiB,EAAI,KAAM,QAAO,sBAAiB,EAC3D,OAAOA,EAAiBD,CAAU,EAAE,KAAK,MAAM,MACjD,MAAE,CACA,MAAO,EACT,CACF","names":["readFileSync","existsSync","init_seat","resolve","execSync","agenticQuery","question","store","requesterId","opts","selectorModel","synthModel","maxCandidates","maxHops","maxArticles","timeoutMs","log","messagePath","graphWeight","DEFAULT_GRAPH_WEIGHT","catalogPath","view","scopeView","existsSync","emptyResult","catalog","readFileSync","renderSharedCatalog","selectorStart","candidates","selectorOutput","viaSeat","selectCandidatesViaSeat","c","runClaude","buildSelectorPrompt","parseCandidates","e","selectorMs","walked","walkSubgraph","synthStart","answer","buildSynthesisPrompt","w","synthesisMs","a","retrieveArticles","pool","catalogPool","matched","scoreAll","buildIndex","catalogDoc","r","rankCatalogPool","i","status","_question","error","shared","titleIndex","linking","article","sharedPool","byId","path","catalogEntry","key","backlinks","l","b","t","list","m","target","s","rel","x","SHARED_CATALOG_LINES","BACKLINKS_PER_PICK","isShared","ordered","sharedCap","opened","sharedOpened","frontier","deferred","next","names","n","stage","DEFAULT_SHORTLIST","result","askSeat","WIKI_RERANK_SEAT","rerankState","rerankQuestions","picked","toRanking","id","bm25","maxBm25","text","useGraph","branch","ancestryScore","byScore","y","branchOnly","ranked","articles","articlesBlock","from","header","related","raw","match","parsed","prompt","model","writeFileSync","mkdirSync","rmSync","tmpdir","dir","promptPath","cmd","claudeCliEnv","envelope","sharedQueryEnabled","configPath","loadDaemonConfig"]}
@@ -1,2 +0,0 @@
1
- var s=/^[A-Za-z0-9][A-Za-z0-9._:@-]*$/;function a(o){let n=o&&typeof o=="object"?o:{};return{enabled:n.enabled===!0,inbox:typeof n.inbox=="string"?n.inbox:"",crons:Array.isArray(n.crons)?n.crons.filter(r=>typeof r=="string"):[],maxNotesPerRun:Number.isInteger(n.maxNotesPerRun)?n.maxNotesPerRun:20,maxDeferrals:Number.isInteger(n.maxDeferrals)?n.maxDeferrals:3}}function b(o,n){let r={...o.wikiNotes&&typeof o.wikiNotes=="object"?o.wikiNotes:{}},t=[];if(n.inbox!==void 0){let e=String(n.inbox).trim();if(e&&!s.test(e))throw new Error(`"${e}" is not an agent id`);e?r.inbox=e:delete r.inbox,t.push(e?`inbox=${e}`:"inbox cleared")}if(n.crons!==void 0){let e=[...new Set(n.crons.map(i=>String(i).trim()).filter(Boolean))];r.crons=e,t.push(`crons=${e.length?e.join(","):"none"}`)}if(n.maxNotesPerRun!==void 0){let e=Number(n.maxNotesPerRun);if(!Number.isInteger(e)||e<1||e>100)throw new Error("max notes per run must be a whole number from 1 to 100");r.maxNotesPerRun=e,t.push(`maxNotesPerRun=${e}`)}if(n.maxDeferrals!==void 0){let e=Number(n.maxDeferrals);if(!Number.isInteger(e)||e<1||e>20)throw new Error("deferrals before a note expires must be a whole number from 1 to 20");r.maxDeferrals=e,t.push(`maxDeferrals=${e}`)}if(n.enabled!==void 0&&(r.enabled=!!n.enabled,t.push(r.enabled?"on":"off")),t.length===0)throw new Error("nothing to update");if(r.enabled&&!r.inbox)throw new Error("set the inbox agent first: the agent that runs the wiki observe/sweep schedule");for(let e of r.crons??[]){let i=o.crons?.[e];if(!i)throw new Error(`no schedule "${e}" on this node`);if(r.inbox&&i.agent!==r.inbox)throw new Error(`schedule "${e}" runs as "${i.agent}", not the inbox agent "${r.inbox}"`)}return o.wikiNotes=r,`wiki notes updated (${t.join(", ")})`}export{a,b};
2
- //# sourceMappingURL=chunk-QUXMLLX5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/wiki/notes-settings.ts"],"sourcesContent":["// Settings for the wiki notes inbox (#825), shared by\n// `agentx wiki notes config` and the dashboard's Schedules tab so both\n// apply the same checks to agentx.json.\n\nexport interface WikiNotesPatch {\n enabled?: boolean\n /** Agent that runs the wiki observe/sweep schedule. \"\" clears it. */\n inbox?: string\n /** Replace the list of schedules that read the inbox. */\n crons?: string[]\n maxNotesPerRun?: number\n maxDeferrals?: number\n}\n\nexport interface WikiNotesView {\n enabled: boolean\n inbox: string\n crons: string[]\n maxNotesPerRun: number\n maxDeferrals: number\n}\n\nconst ID_RE = /^[A-Za-z0-9][A-Za-z0-9._:@-]*$/\n\n/** The current settings, with defaults filled in. */\nexport function wikiNotesSettings(raw: any): WikiNotesView {\n const n = raw && typeof raw === \"object\" ? raw : {}\n return {\n enabled: n.enabled === true,\n inbox: typeof n.inbox === \"string\" ? n.inbox : \"\",\n crons: Array.isArray(n.crons) ? n.crons.filter((c: unknown) => typeof c === \"string\") : [],\n maxNotesPerRun: Number.isInteger(n.maxNotesPerRun) ? n.maxNotesPerRun : 20,\n maxDeferrals: Number.isInteger(n.maxDeferrals) ? n.maxDeferrals : 3,\n }\n}\n\n/**\n * Apply `patch` to `cfg.wikiNotes` in place and say what changed. Throws a\n * message meant for a person when the result would not work.\n *\n * The inbox agent may live on another node (a node that only posts notes),\n * so it is not required to be in `cfg.agents`. A schedule listed in\n * `crons` must exist here and run as the inbox agent: that is the run\n * that reads the notes.\n */\nexport function patchWikiNotes(cfg: any, patch: WikiNotesPatch): string {\n const cur = { ...(cfg.wikiNotes && typeof cfg.wikiNotes === \"object\" ? cfg.wikiNotes : {}) }\n const changes: string[] = []\n\n if (patch.inbox !== undefined) {\n const inbox = String(patch.inbox).trim()\n if (inbox && !ID_RE.test(inbox)) throw new Error(`\"${inbox}\" is not an agent id`)\n if (inbox) cur.inbox = inbox\n else delete cur.inbox\n changes.push(inbox ? `inbox=${inbox}` : \"inbox cleared\")\n }\n if (patch.crons !== undefined) {\n const ids = [...new Set(patch.crons.map((c) => String(c).trim()).filter(Boolean))]\n cur.crons = ids\n changes.push(`crons=${ids.length ? ids.join(\",\") : \"none\"}`)\n }\n if (patch.maxNotesPerRun !== undefined) {\n const n = Number(patch.maxNotesPerRun)\n if (!Number.isInteger(n) || n < 1 || n > 100) throw new Error(\"max notes per run must be a whole number from 1 to 100\")\n cur.maxNotesPerRun = n\n changes.push(`maxNotesPerRun=${n}`)\n }\n if (patch.maxDeferrals !== undefined) {\n const n = Number(patch.maxDeferrals)\n if (!Number.isInteger(n) || n < 1 || n > 20) throw new Error(\"deferrals before a note expires must be a whole number from 1 to 20\")\n cur.maxDeferrals = n\n changes.push(`maxDeferrals=${n}`)\n }\n if (patch.enabled !== undefined) {\n cur.enabled = Boolean(patch.enabled)\n changes.push(cur.enabled ? \"on\" : \"off\")\n }\n if (changes.length === 0) throw new Error(\"nothing to update\")\n\n if (cur.enabled && !cur.inbox) {\n throw new Error(\"set the inbox agent first: the agent that runs the wiki observe/sweep schedule\")\n }\n for (const id of cur.crons ?? []) {\n const job = cfg.crons?.[id]\n if (!job) throw new Error(`no schedule \"${id}\" on this node`)\n if (cur.inbox && job.agent !== cur.inbox) {\n throw new Error(`schedule \"${id}\" runs as \"${job.agent}\", not the inbox agent \"${cur.inbox}\"`)\n }\n }\n\n cfg.wikiNotes = cur\n return `wiki notes updated (${changes.join(\", \")})`\n}\n"],"mappings":"AAsBA,IAAMA,EAAQ,iCAGP,SAASC,EAAkBC,EAAyB,CACzD,IAAM,EAAIA,GAAO,OAAOA,GAAQ,SAAWA,EAAM,CAAC,EAClD,MAAO,CACL,QAAS,EAAE,UAAY,GACvB,MAAO,OAAO,EAAE,OAAU,SAAW,EAAE,MAAQ,GAC/C,MAAO,MAAM,QAAQ,EAAE,KAAK,EAAI,EAAE,MAAM,OAAQC,GAAe,OAAOA,GAAM,QAAQ,EAAI,CAAC,EACzF,eAAgB,OAAO,UAAU,EAAE,cAAc,EAAI,EAAE,eAAiB,GACxE,aAAc,OAAO,UAAU,EAAE,YAAY,EAAI,EAAE,aAAe,CACpE,CACF,CAWO,SAASC,EAAeC,EAAUC,EAA+B,CACtE,IAAMC,EAAM,CAAE,GAAIF,EAAI,WAAa,OAAOA,EAAI,WAAc,SAA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IAAI,MAAM,gFAAgF,EAElG,QAAWK,KAAML,EAAI,OAAS,CAAC,EAAG,CAChC,IAAMM,EAAMR,EAAI,QAAQO,CAAE,EAC1B,GAAI,CAACC,EAAK,MAAM,IAAI,MAAM,gBAAgBD,iBAAkB,EAC5D,GAAIL,EAAI,OAASM,EAAI,QAAUN,EAAI,MACjC,MAAM,IAAI,MAAM,aAAaK,eAAgBC,EAAI,gCAAgCN,EAAI,QAAQ,EAIjG,OAAAF,EAAI,UAAYE,EACT,uBAAuBC,EAAQ,KAAK,IAAI,IACjD","names":["ID_RE","wikiNotesSettings","raw","c","patchWikiNotes","cfg","patch","cur","changes","inbox","ids","n","id","job"]}
@@ -1,3 +0,0 @@
1
- import{a as f}from"./chunk-3PGPN323.js";import{existsSync as m,readFileSync as k,statSync as P,writeFileSync as O}from"fs";import{resolve as h}from"path";import g from"js-yaml";var n=(e=5)=>({panel:"history",title:"History",source:"history",show:e,importance:["major","normal"],fold:"minor",rollup:{min:5,days:30}}),c={panel:"discussed",title:"Discussed",source:"discussed",show:3,access:"owner"},s=(e=1)=>({panel:"notes",title:"Notes",source:"notes",show:e}),_=["device","server","app","domain","account","agent"],v=[{id:"person",label:"Person",plural:"People",pillar:"parties",schema:"Person",icon:"person",lens:[{panel:"roles",title:"Roles over time",from:["role_at","member_of","founded"],show:6,display:"timeline"},{panel:"relations",title:"Relations",from:["works_with","reports_to","client_of","related"],types:["person","organization"],show:5,group_by:"role"},{panel:"belongings",title:"Belongings",from:["owns","uses","related"],types:_,show:5},{panel:"obligations",title:"Obligations they carry",from:["subject_to"],show:3},n(),c,s()]},{id:"organization",label:"Organization",plural:"Organizations",pillar:"parties",schema:"Organization",icon:"org",lens:[{panel:"people",title:"People and roles",from:["role_at","member_of","founded"],show:6,group_by:"role"},{panel:"facts",title:"Key facts",from:["registered_with","located_in","identifier","legal_form"],show:6},{panel:"obligations",title:"Obligations and next due dates",from:["subject_to"],show:4},{panel:"agreements",title:"Agreements",source:"linked",types:["contract"],show:4},{panel:"decisions",title:"Decisions",source:"linked",types:["decision","policy"],show:4},n(),c,s()]},{id:"place",label:"Place",plural:"Places",pillar:"places",schema:"Place",icon:"pin",lens:[{panel:"here",title:"What is here",from:["located_in","related"],show:6},{panel:"laws",title:"Laws that apply here",from:["applies_in"],show:5},n(),s()]},{id:"jurisdiction",label:"Jurisdiction",plural:"Jurisdictions",pillar:"places",schema:"AdministrativeArea",icon:"pin",lens:[{panel:"laws",title:"Laws in force",from:["applies_in"],show:6},{panel:"authorities",title:"Authorities with reach",from:["jurisdiction_of"],show:5},{panel:"here",title:"What is here",from:["located_in"],show:5},s()]},{id:"device",label:"Device",plural:"Devices",pillar:"assets",schema:"Product",icon:"device",lens:[{panel:"state",title:"State now",source:"readings",latest:!0,show:6},n(),{panel:"apps",title:"Installed apps",from:["installed_on"],show:5},c,{panel:"parties",title:"Owner, user, location",from:["owns","uses","located_in","related"],types:["person","organization","place"],show:5},s()]},{id:"server",label:"Server",plural:"Servers",pillar:"assets",schema:"Product",icon:"server",lens:[{panel:"state",title:"State now",source:"readings",latest:!0,show:6},n(),{panel:"hosts",title:"Hosted services",from:["installed_on","runs_on"],show:6},c,{panel:"parties",title:"Owner and location",from:["owns","uses","located_in"],show:4},s()]},{id:"app",label:"App or system",plural:"Apps",pillar:"assets",schema:"SoftwareApplication",icon:"app",lens:[{panel:"installs",title:"Where it runs",from:["installed_on","runs_on"],show:5},{panel:"licence",title:"Licence or subscription",from:["party_to","licensed_by"],show:3},n(),c,s()]},{id:"domain",label:"Domain",plural:"Domains",pillar:"assets",schema:"WebSite",icon:"globe",lens:[{panel:"holder",title:"Holder",from:["owns","registrar"],show:3},{panel:"dues",title:"Renewal and due dates",source:"linked",types:["due_date"],show:4},{panel:"services",title:"Linked services",from:["related"],show:5},n(),s()]},{id:"account",label:"Account",plural:"Accounts",pillar:"assets",schema:"Service",icon:"key",lens:[{panel:"holder",title:"Holder",from:["owns","uses"],show:3},{panel:"dues",title:"Renewal and due dates",source:"linked",types:["due_date"],show:4},n(),s()]},{id:"agent",label:"Agent",plural:"Agents",pillar:"assets",schema:"SoftwareApplication",icon:"agent",lens:[{panel:"runs",title:"Where it runs",from:["runs_on","installed_on","related"],types:["server","device"],show:4},{panel:"works",title:"Works for",from:["works_for","uses","related"],types:["person","organization","project"],show:5},n(),c,s()]},{id:"project",label:"Project",plural:"Projects",pillar:"offerings",schema:"Project",icon:"project",lens:[{panel:"people",title:"Client and people",from:["client_of","works_on","related"],types:["person","organization","agent"],show:6,group_by:"role"},{panel:"agreements",title:"Agreements",source:"linked",types:["contract"],show:3},{panel:"decisions",title:"Decisions",source:"linked",types:["decision","policy"],show:4},n(6),c,s()]},{id:"offering",label:"Offering",plural:"Offerings",pillar:"offerings",schema:"Offer",icon:"project",lens:[{panel:"clients",title:"Clients",from:["client_of","related"],types:["organization","person"],show:5},n(),s()]},{id:"contract",label:"Agreement",plural:"Agreements",pillar:"agreements",schema:"Contract",icon:"contract",lens:[{panel:"parties",title:"Parties and roles",from:["party_to"],show:5,group_by:"role"},{panel:"terms",title:"Key terms and dates",from:["starts","renews","notice","amount"],show:6},{panel:"obligations",title:"Obligations it creates",from:["creates"],show:5},{panel:"amendments",title:"Amendments",from:["amends"],show:4},n(),s()]},{id:"legal_source",label:"Legal source",plural:"Legal sources",pillar:"law",schema:"Legislation",icon:"law",lens:[{panel:"reference",title:"Gazette reference and dates",from:["identifier","published_in","in_force_from","legal_force","issued_by"],show:6},{panel:"creates",title:"Obligations, penalties and reliefs it creates",from:["creates","created_by"],show:6},{panel:"amends",title:"Amends and amended by",from:["amends","repeals","implements"],show:5},{panel:"applies",title:"Where it applies",from:["applies_in"],show:3},s()]},{id:"obligation",label:"Obligation",plural:"Obligations",pillar:"law",schema:"LegalRuleML Obligation",icon:"law",lens:[{panel:"rule",title:"Who must do what, by when",from:["action","bearer","due_rule","amount_rule","authority","status"],show:6},{panel:"dues",title:"Next due dates",source:"linked",types:["due_date"],show:4},{panel:"sources",title:"Source articles",from:["created_by","changed_by"],show:4},{panel:"penalties",title:"Penalties and reliefs",from:["penalty_for","relieves"],show:4},{panel:"procedure",title:"Procedure",from:["procedure"],show:2},{panel:"bearers",title:"Who carries it",from:["subject_to"],show:5},n(4),s()]},{id:"penalty",label:"Penalty",plural:"Penalties",pillar:"law",schema:"LegalRuleML Penalty",icon:"law",lens:[{panel:"rule",title:"For which failure, how much",from:["penalty_for","kind","amount_rule","created_by"],show:6},s()]},{id:"relief",label:"Relief",plural:"Reliefs",pillar:"law",schema:"LegalRuleML Permission",icon:"law",lens:[{panel:"rule",title:"What it relieves, for whom, until when",from:["relieves","bearer","condition","created_by"],show:6},s()]},{id:"due_date",label:"Due date",plural:"Due dates",pillar:"law",schema:"Event",icon:"calendar",lens:[{panel:"due",title:"Due",from:["due_for","bearer","due","status","fulfilled_by"],show:6},s()]},{id:"event",label:"Event",plural:"Events",pillar:"events",schema:"Event",icon:"calendar",lens:[s(1),{panel:"involved",title:"Who and what was involved",from:["involves","affects","related"],show:8},{panel:"followed",title:"What followed",source:"linked",types:["event","decision"],show:4},c]},{id:"decision",label:"Decision",plural:"Decisions",pillar:"decisions",schema:"ChooseAction",icon:"decision",lens:[s(1),{panel:"affects",title:"What it affects",from:["affects","creates","related"],show:6},{panel:"replaced",title:"Replaced by",from:["replaced_by"],show:2},c]},{id:"policy",label:"Policy",plural:"Policies",pillar:"decisions",schema:"LegalRuleML Obligation",icon:"decision",lens:[{panel:"rule",title:"Rule",from:["action","bearer","creates","created_by"],show:6},{panel:"affects",title:"What it affects",from:["affects","related"],show:6},s()]},{id:"procedure",label:"Procedure",plural:"Procedures",pillar:"procedures",schema:"HowTo",icon:"steps",lens:[s(1),{panel:"triggers",title:"What triggers it",from:["procedure","triggered_by","related"],show:5},{panel:"runs",title:"Last runs",source:"linked",types:["event"],show:4}]},{id:"topic",label:"Topic",plural:"Topics",pillar:"topics",schema:"skos:Concept",icon:"topic",lens:[s(1),{panel:"related",title:"Related",from:["related"],show:8},n(4)]}],d={version:1,pillars:[{id:"parties",label:"Parties",description:"People and organisations, and the roles between them",icon:"person"},{id:"places",label:"Places & Jurisdictions",description:"Where things are, and whose rules apply there",icon:"pin"},{id:"assets",label:"Assets",description:"What is owned or run: devices, servers, apps, domains, accounts, agents",icon:"server"},{id:"offerings",label:"Offerings & Projects",description:"What is sold, built or delivered",icon:"project"},{id:"agreements",label:"Agreements",description:"Contracts, subscriptions and their terms",icon:"contract"},{id:"law",label:"Law & Obligations",description:"Legal sources, the obligations they create, penalties, reliefs and due dates",icon:"law"},{id:"events",label:"Events",description:"What happened, by importance",icon:"calendar"},{id:"decisions",label:"Decisions & Policies",description:"Why things are the way they are",icon:"decision"},{id:"procedures",label:"Procedures",description:"How things are done",icon:"steps"},{id:"topics",label:"Topics",description:"Pages no type fits yet. A growing count means a type is missing.",icon:"topic",sidebar:!1}],types:v,properties:[{id:"related",label:"related to",inverse:"related to"},{id:"role_at",label:"role at",inverse:"people",wikidata:"P108",range:["organization"]},{id:"member_of",label:"member of",inverse:"members",wikidata:"P463"},{id:"founded",label:"founded",inverse:"founded by",wikidata:"P112"},{id:"works_with",label:"works with",inverse:"works with"},{id:"reports_to",label:"reports to",inverse:"manages"},{id:"client_of",label:"client of",inverse:"clients",wikidata:"P1972"},{id:"works_on",label:"works on",inverse:"people"},{id:"works_for",label:"works for",inverse:"agents",wikidata:"P108"},{id:"owns",label:"owns",inverse:"owned by",wikidata:"P1830"},{id:"uses",label:"uses",inverse:"used by",wikidata:"P2283"},{id:"located_in",label:"located in",inverse:"here",wikidata:"P276"},{id:"installed_on",label:"installed on",inverse:"installed apps",range:["device","server"]},{id:"runs_on",label:"runs on",inverse:"hosts"},{id:"registered_with",label:"registered with",inverse:"registered"},{id:"identifier",label:"identifier",wikidata:"P1448"},{id:"legal_form",label:"legal form",wikidata:"P1454"},{id:"registrar",label:"registrar"},{id:"licensed_by",label:"licensed by",inverse:"licences"},{id:"party_to",label:"party to",inverse:"parties"},{id:"starts",label:"starts"},{id:"renews",label:"renews"},{id:"notice",label:"notice period"},{id:"amount",label:"amount"},{id:"creates",label:"creates",inverse:"created by"},{id:"created_by",label:"created by",inverse:"creates"},{id:"changed_by",label:"changed by",inverse:"changes"},{id:"amends",label:"amends",inverse:"amended by",wikidata:"P144"},{id:"repeals",label:"repeals",inverse:"repealed by"},{id:"implements",label:"implements",inverse:"implemented by"},{id:"issued_by",label:"issued by",inverse:"issues"},{id:"published_in",label:"published in",wikidata:"P1433"},{id:"in_force_from",label:"in force from",wikidata:"P7588"},{id:"legal_force",label:"legal force"},{id:"applies_in",label:"applies in",inverse:"laws that apply",wikidata:"P1001"},{id:"jurisdiction_of",label:"authority in",inverse:"authorities"},{id:"subject_to",label:"subject to",inverse:"carried by"},{id:"action",label:"action"},{id:"bearer",label:"bearer"},{id:"due_rule",label:"due"},{id:"amount_rule",label:"amount"},{id:"authority",label:"authority",inverse:"collects"},{id:"status",label:"status"},{id:"penalty_for",label:"penalty for",inverse:"penalties"},{id:"relieves",label:"relieves",inverse:"reliefs"},{id:"condition",label:"condition"},{id:"kind",label:"kind"},{id:"procedure",label:"procedure",inverse:"carries out"},{id:"due_for",label:"due for",inverse:"due dates"},{id:"due",label:"due on"},{id:"fulfilled_by",label:"fulfilled by",inverse:"fulfils"},{id:"involves",label:"involves",inverse:"events",wikidata:"P710"},{id:"affects",label:"affects",inverse:"affected by"},{id:"replaced_by",label:"replaced by",inverse:"replaces",wikidata:"P1366"},{id:"triggered_by",label:"triggered by",inverse:"triggers"},{id:"mentions",label:"mentions",inverse:"discussed in"},{id:"reading",label:"reading"}],importance:{default:"normal",major_set_by:"owner",rollup:{min:5,days:30}},sidebar:{pins_max:5,pins:[]},classify:[{type:"agent",legacy:["person","concept","project"],title:"\\bagents?\\b|\\bbot\\b"},{type:"server",legacy:["place","concept"],title:"\\b(server|vps|host|node)\\b"},{type:"device",legacy:["place","concept"],title:"\\b(laptop|macbook|desktop|phone|tablet|printer|router)\\b"},{type:"person",legacy:["person"]},{type:"event",legacy:["event"]},{type:"decision",legacy:["decision"]},{type:"procedure",legacy:["pattern"]},{type:"place",legacy:["place"]},{type:"project",legacy:["project"]},{type:"organization",path:["clients","customers","vendors","suppliers","organizations","orgs","companies"]},{type:"organization",tags:["organization","company","client","vendor","supplier","agency","bank"]},{type:"server",path:["servers","hosts","infrastructure"]},{type:"server",tags:["server","vps","host"]},{type:"device",path:["devices"]},{type:"device",tags:["device","laptop","phone","printer"]},{type:"agent",tags:["agent"],title:"\\bagent\\b"},{type:"app",path:["apps","systems","services"]},{type:"domain",tags:["domain","dns"]},{type:"contract",path:["contracts","agreements"]},{type:"contract",tags:["contract","agreement","subscription"]},{type:"legal_source",path:["laws","legislation"]},{type:"legal_source",tags:["law","legislation","decree"]},{type:"obligation",path:["obligations","compliance"]},{type:"obligation",tags:["obligation","compliance"]},{type:"policy",path:["policies"]},{type:"policy",tags:["policy"]},{type:"procedure",path:["runbooks","procedures"]},{type:"procedure",tags:["runbook","procedure","how-to"]}],fallback_type:"topic"};var y="ontology.yaml",b=new Map;function z(e){let t=h(e,y);if(!m(t))return{ontology:d,errors:[],file:null};let p=P(t).mtimeMs,l=b.get(t);if(l&&l.mtimeMs===p)return l.loaded;let a,i=[];try{a=g.load(k(t,"utf-8"))}catch(w){i.push(`${y} is not valid YAML: ${w.message}`),a={}}let r=A(d,u(a)?a:{},i);i.push(...j(r));let o={ontology:r,errors:i,file:t};return b.set(t,{mtimeMs:p,loaded:o}),o}function T(e){let t=h(e,y);if(m(t))throw new Error(`${t} already exists`);let p=["# Wiki ontology: pillars, types, typed relations, event importance and lenses.","# Edit any section; what you leave out falls back to the built-in defaults.","# Check it with: agentx wiki ontology check",""].join(`
2
- `);return O(t,p+g.dump(d,{lineWidth:120,noRefs:!0})),t}function A(e,t,p=[]){let l=structuredClone(e);typeof t.version=="number"&&(l.version=t.version);for(let a of["pillars","types","properties"]){let i=t[a];if(i!==void 0){if(!Array.isArray(i)){p.push(`${a} must be a list`);continue}l[a]=L(l[a],i,a,p)}}return u(t.importance)&&(l.importance={...l.importance,...t.importance}),u(t.sidebar)&&(l.sidebar={...l.sidebar,...t.sidebar}),t.classify!==void 0&&(Array.isArray(t.classify)?l.classify=t.classify:p.push("classify must be a list")),typeof t.fallback_type=="string"&&(l.fallback_type=t.fallback_type),l}function L(e,t,p,l){let a=e.map(i=>({...i}));for(let i of t){if(!u(i)||typeof i.id!="string"){l.push(`every item in ${p} needs an id`);continue}let r=a.findIndex(o=>o.id===i.id);r===-1?a.push(i):a[r]={...a[r],...i}}return a}function j(e){let t=[],p=new Set(e.pillars.map(i=>i.id)),l=new Set(e.types.map(i=>i.id)),a=new Set(e.properties.map(i=>i.id));for(let i of e.types){p.has(i.pillar)||t.push(`type ${i.id}: unknown pillar "${i.pillar}"`);for(let r of i.lens??[]){for(let o of S(r))a.has(o)||t.push(`type ${i.id}, panel ${r.panel}: unknown property "${o}"`);for(let o of r.types??[])l.has(o)||t.push(`type ${i.id}, panel ${r.panel}: unknown type "${o}"`);for(let o of r.importance??[])f.includes(o)||t.push(`type ${i.id}, panel ${r.panel}: unknown importance "${o}"`)}}for(let i of e.classify)if(l.has(i.type)||t.push(`classify: unknown type "${i.type}"`),i.title)try{new RegExp(i.title,"i")}catch{t.push(`classify: bad title pattern "${i.title}"`)}return l.has(e.fallback_type)||t.push(`fallback_type: unknown type "${e.fallback_type}"`),f.includes(e.importance.default)||t.push(`importance.default: unknown level "${e.importance.default}"`),e.sidebar.pins.length>e.sidebar.pins_max&&t.push(`sidebar.pins: ${e.sidebar.pins.length} pins, only the first ${e.sidebar.pins_max} are shown`),t}function S(e){return e.from?Array.isArray(e.from)?e.from:[e.from]:[]}function M(e){return e.source?e.source:e.panel==="history"||e.panel==="discussed"||e.panel==="notes"?e.panel:e.latest?"readings":e.from?"statements":"linked"}function u(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}export{y as a,z as b,T as c,A as d,j as e,S as f,M as g};
3
- //# sourceMappingURL=chunk-QX2B4TJU.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/wiki/ontology/load.ts","../src/wiki/ontology/defaults.ts"],"sourcesContent":["// --- Load and check `ontology.yaml` (#811) ---\n//\n// The file is optional. Each section the owner writes is merged over the\n// defaults: pillars, types and properties by `id` (a listed id replaces\n// the fields it sets, a new id is added), `importance` and `sidebar`\n// field by field, and `classify` as a whole list. Problems are reported,\n// never thrown, so a typo in the file cannot take the wiki down.\n\nimport { existsSync, readFileSync, statSync, writeFileSync } from \"fs\"\nimport { resolve } from \"path\"\nimport yaml from \"js-yaml\"\nimport { DEFAULT_ONTOLOGY } from \"./defaults\"\nimport { IMPORTANCE_LEVELS, type LensPanel, type Ontology, type PanelSource } from \"./types\"\n\nexport const ONTOLOGY_FILE = \"ontology.yaml\"\n\nexport interface LoadedOntology {\n ontology: Ontology\n /** Problems found in the file. The defaults are used where they apply. */\n errors: string[]\n /** Path of the file read, or null when the defaults were used as they are. */\n file: string | null\n}\n\nconst cache = new Map<string, { mtimeMs: number; loaded: LoadedOntology }>()\n\nexport function loadOntology(wikiDir: string): LoadedOntology {\n const file = resolve(wikiDir, ONTOLOGY_FILE)\n if (!existsSync(file)) return { ontology: DEFAULT_ONTOLOGY, errors: [], file: null }\n\n const mtimeMs = statSync(file).mtimeMs\n const hit = cache.get(file)\n if (hit && hit.mtimeMs === mtimeMs) return hit.loaded\n\n let raw: unknown\n const errors: string[] = []\n try {\n raw = yaml.load(readFileSync(file, \"utf-8\"))\n } catch (err) {\n errors.push(`${ONTOLOGY_FILE} is not valid YAML: ${(err as Error).message}`)\n raw = {}\n }\n const ontology = mergeOntology(DEFAULT_ONTOLOGY, isObject(raw) ? raw : {}, errors)\n errors.push(...checkOntology(ontology))\n const loaded = { ontology, errors, file }\n cache.set(file, { mtimeMs, loaded })\n return loaded\n}\n\n/** Write the defaults as a starting `ontology.yaml`. Refuses to overwrite. */\nexport function writeDefaultOntology(wikiDir: string): string {\n const file = resolve(wikiDir, ONTOLOGY_FILE)\n if (existsSync(file)) throw new Error(`${file} already exists`)\n const header = [\n \"# Wiki ontology: pillars, types, typed relations, event importance and lenses.\",\n \"# Edit any section; what you leave out falls back to the built-in defaults.\",\n \"# Check it with: agentx wiki ontology check\",\n \"\",\n ].join(\"\\n\")\n writeFileSync(file, header + yaml.dump(DEFAULT_ONTOLOGY, { lineWidth: 120, noRefs: true }))\n return file\n}\n\nexport function mergeOntology(base: Ontology, over: Record<string, unknown>, errors: string[] = []): Ontology {\n const out: Ontology = structuredClone(base)\n if (typeof over.version === \"number\") out.version = over.version\n for (const key of [\"pillars\", \"types\", \"properties\"] as const) {\n const list = over[key]\n if (list === undefined) continue\n if (!Array.isArray(list)) { errors.push(`${key} must be a list`); continue }\n out[key] = mergeById(out[key] as Array<{ id: string }>, list, key, errors) as never\n }\n if (isObject(over.importance)) out.importance = { ...out.importance, ...over.importance } as Ontology[\"importance\"]\n if (isObject(over.sidebar)) out.sidebar = { ...out.sidebar, ...over.sidebar } as Ontology[\"sidebar\"]\n if (over.classify !== undefined) {\n if (Array.isArray(over.classify)) out.classify = over.classify as Ontology[\"classify\"]\n else errors.push(\"classify must be a list\")\n }\n if (typeof over.fallback_type === \"string\") out.fallback_type = over.fallback_type\n return out\n}\n\nfunction mergeById(base: Array<{ id: string }>, list: unknown[], key: string, errors: string[]): Array<{ id: string }> {\n const out = base.map(x => ({ ...x }))\n for (const item of list) {\n if (!isObject(item) || typeof item.id !== \"string\") { errors.push(`every item in ${key} needs an id`); continue }\n const at = out.findIndex(x => x.id === item.id)\n if (at === -1) out.push(item as { id: string })\n else out[at] = { ...out[at], ...item }\n }\n return out\n}\n\n/** Problems that make part of the ontology unusable. */\nexport function checkOntology(o: Ontology): string[] {\n const errors: string[] = []\n const pillars = new Set(o.pillars.map(p => p.id))\n const types = new Set(o.types.map(t => t.id))\n const props = new Set(o.properties.map(p => p.id))\n for (const t of o.types) {\n if (!pillars.has(t.pillar)) errors.push(`type ${t.id}: unknown pillar \"${t.pillar}\"`)\n for (const p of t.lens ?? []) {\n for (const f of panelFrom(p)) if (!props.has(f)) errors.push(`type ${t.id}, panel ${p.panel}: unknown property \"${f}\"`)\n for (const ty of p.types ?? []) if (!types.has(ty)) errors.push(`type ${t.id}, panel ${p.panel}: unknown type \"${ty}\"`)\n for (const lv of p.importance ?? []) if (!IMPORTANCE_LEVELS.includes(lv)) errors.push(`type ${t.id}, panel ${p.panel}: unknown importance \"${lv}\"`)\n }\n }\n for (const r of o.classify) {\n if (!types.has(r.type)) errors.push(`classify: unknown type \"${r.type}\"`)\n if (r.title) {\n try { new RegExp(r.title, \"i\") } catch { errors.push(`classify: bad title pattern \"${r.title}\"`) }\n }\n }\n if (!types.has(o.fallback_type)) errors.push(`fallback_type: unknown type \"${o.fallback_type}\"`)\n if (!IMPORTANCE_LEVELS.includes(o.importance.default)) errors.push(`importance.default: unknown level \"${o.importance.default}\"`)\n if (o.sidebar.pins.length > o.sidebar.pins_max) {\n errors.push(`sidebar.pins: ${o.sidebar.pins.length} pins, only the first ${o.sidebar.pins_max} are shown`)\n }\n return errors\n}\n\nexport function panelFrom(p: LensPanel): string[] {\n if (!p.from) return []\n return Array.isArray(p.from) ? p.from : [p.from]\n}\n\nexport function panelSource(p: LensPanel): PanelSource {\n if (p.source) return p.source\n if (p.panel === \"history\" || p.panel === \"discussed\" || p.panel === \"notes\") return p.panel\n if (p.latest) return \"readings\"\n if (p.from) return \"statements\"\n return \"linked\"\n}\n\nfunction isObject(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v)\n}\n","// --- Default wiki ontology (#811) ---\n//\n// Generic starting point: nine pillars, the types inside them, the typed\n// relations between them and a lens for every type. An owner overrides\n// any section in `<wiki>/ontology.yaml`; `agentx wiki ontology init`\n// writes this file out as a starting point. Keep it free of any\n// particular organisation, person, country or product.\n\nimport type { LensPanel, Ontology, TypeDef } from \"./types\"\n\nconst history = (show = 5): LensPanel => ({\n panel: \"history\", title: \"History\", source: \"history\", show,\n importance: [\"major\", \"normal\"], fold: \"minor\", rollup: { min: 5, days: 30 },\n})\nconst discussed: LensPanel = { panel: \"discussed\", title: \"Discussed\", source: \"discussed\", show: 3, access: \"owner\" }\nconst notes = (show = 1): LensPanel => ({ panel: \"notes\", title: \"Notes\", source: \"notes\", show })\n\nconst ASSET_TYPES = [\"device\", \"server\", \"app\", \"domain\", \"account\", \"agent\"]\n\nconst types: TypeDef[] = [\n // Parties\n {\n id: \"person\", label: \"Person\", plural: \"People\", pillar: \"parties\", schema: \"Person\", icon: \"person\",\n lens: [\n { panel: \"roles\", title: \"Roles over time\", from: [\"role_at\", \"member_of\", \"founded\"], show: 6, display: \"timeline\" },\n { panel: \"relations\", title: \"Relations\", from: [\"works_with\", \"reports_to\", \"client_of\", \"related\"], types: [\"person\", \"organization\"], show: 5, group_by: \"role\" },\n { panel: \"belongings\", title: \"Belongings\", from: [\"owns\", \"uses\", \"related\"], types: ASSET_TYPES, show: 5 },\n { panel: \"obligations\", title: \"Obligations they carry\", from: [\"subject_to\"], show: 3 },\n history(),\n discussed,\n notes(),\n ],\n },\n {\n id: \"organization\", label: \"Organization\", plural: \"Organizations\", pillar: \"parties\", schema: \"Organization\", icon: \"org\",\n lens: [\n { panel: \"people\", title: \"People and roles\", from: [\"role_at\", \"member_of\", \"founded\"], show: 6, group_by: \"role\" },\n { panel: \"facts\", title: \"Key facts\", from: [\"registered_with\", \"located_in\", \"identifier\", \"legal_form\"], show: 6 },\n { panel: \"obligations\", title: \"Obligations and next due dates\", from: [\"subject_to\"], show: 4 },\n { panel: \"agreements\", title: \"Agreements\", source: \"linked\", types: [\"contract\"], show: 4 },\n { panel: \"decisions\", title: \"Decisions\", source: \"linked\", types: [\"decision\", \"policy\"], show: 4 },\n history(),\n discussed,\n notes(),\n ],\n },\n // Places & Jurisdictions\n {\n id: \"place\", label: \"Place\", plural: \"Places\", pillar: \"places\", schema: \"Place\", icon: \"pin\",\n lens: [\n { panel: \"here\", title: \"What is here\", from: [\"located_in\", \"related\"], show: 6 },\n { panel: \"laws\", title: \"Laws that apply here\", from: [\"applies_in\"], show: 5 },\n history(),\n notes(),\n ],\n },\n {\n id: \"jurisdiction\", label: \"Jurisdiction\", plural: \"Jurisdictions\", pillar: \"places\", schema: \"AdministrativeArea\", icon: \"pin\",\n lens: [\n { panel: \"laws\", title: \"Laws in force\", from: [\"applies_in\"], show: 6 },\n { panel: \"authorities\", title: \"Authorities with reach\", from: [\"jurisdiction_of\"], show: 5 },\n { panel: \"here\", title: \"What is here\", from: [\"located_in\"], show: 5 },\n notes(),\n ],\n },\n // Assets\n {\n id: \"device\", label: \"Device\", plural: \"Devices\", pillar: \"assets\", schema: \"Product\", icon: \"device\",\n lens: [\n { panel: \"state\", title: \"State now\", source: \"readings\", latest: true, show: 6 },\n history(),\n { panel: \"apps\", title: \"Installed apps\", from: [\"installed_on\"], show: 5 },\n discussed,\n { panel: \"parties\", title: \"Owner, user, location\", from: [\"owns\", \"uses\", \"located_in\", \"related\"], types: [\"person\", \"organization\", \"place\"], show: 5 },\n notes(),\n ],\n },\n {\n id: \"server\", label: \"Server\", plural: \"Servers\", pillar: \"assets\", schema: \"Product\", icon: \"server\",\n lens: [\n { panel: \"state\", title: \"State now\", source: \"readings\", latest: true, show: 6 },\n history(),\n { panel: \"hosts\", title: \"Hosted services\", from: [\"installed_on\", \"runs_on\"], show: 6 },\n discussed,\n { panel: \"parties\", title: \"Owner and location\", from: [\"owns\", \"uses\", \"located_in\"], show: 4 },\n notes(),\n ],\n },\n {\n id: \"app\", label: \"App or system\", plural: \"Apps\", pillar: \"assets\", schema: \"SoftwareApplication\", icon: \"app\",\n lens: [\n { panel: \"installs\", title: \"Where it runs\", from: [\"installed_on\", \"runs_on\"], show: 5 },\n { panel: \"licence\", title: \"Licence or subscription\", from: [\"party_to\", \"licensed_by\"], show: 3 },\n history(),\n discussed,\n notes(),\n ],\n },\n {\n id: \"domain\", label: \"Domain\", plural: \"Domains\", pillar: \"assets\", schema: \"WebSite\", icon: \"globe\",\n lens: [\n { panel: \"holder\", title: \"Holder\", from: [\"owns\", \"registrar\"], show: 3 },\n { panel: \"dues\", title: \"Renewal and due dates\", source: \"linked\", types: [\"due_date\"], show: 4 },\n { panel: \"services\", title: \"Linked services\", from: [\"related\"], show: 5 },\n history(),\n notes(),\n ],\n },\n {\n id: \"account\", label: \"Account\", plural: \"Accounts\", pillar: \"assets\", schema: \"Service\", icon: \"key\",\n lens: [\n { panel: \"holder\", title: \"Holder\", from: [\"owns\", \"uses\"], show: 3 },\n { panel: \"dues\", title: \"Renewal and due dates\", source: \"linked\", types: [\"due_date\"], show: 4 },\n history(),\n notes(),\n ],\n },\n {\n id: \"agent\", label: \"Agent\", plural: \"Agents\", pillar: \"assets\", schema: \"SoftwareApplication\", icon: \"agent\",\n lens: [\n { panel: \"runs\", title: \"Where it runs\", from: [\"runs_on\", \"installed_on\", \"related\"], types: [\"server\", \"device\"], show: 4 },\n { panel: \"works\", title: \"Works for\", from: [\"works_for\", \"uses\", \"related\"], types: [\"person\", \"organization\", \"project\"], show: 5 },\n history(),\n discussed,\n notes(),\n ],\n },\n // Offerings & Projects\n {\n id: \"project\", label: \"Project\", plural: \"Projects\", pillar: \"offerings\", schema: \"Project\", icon: \"project\",\n lens: [\n { panel: \"people\", title: \"Client and people\", from: [\"client_of\", \"works_on\", \"related\"], types: [\"person\", \"organization\", \"agent\"], show: 6, group_by: \"role\" },\n { panel: \"agreements\", title: \"Agreements\", source: \"linked\", types: [\"contract\"], show: 3 },\n { panel: \"decisions\", title: \"Decisions\", source: \"linked\", types: [\"decision\", \"policy\"], show: 4 },\n history(6),\n discussed,\n notes(),\n ],\n },\n {\n id: \"offering\", label: \"Offering\", plural: \"Offerings\", pillar: \"offerings\", schema: \"Offer\", icon: \"project\",\n lens: [\n { panel: \"clients\", title: \"Clients\", from: [\"client_of\", \"related\"], types: [\"organization\", \"person\"], show: 5 },\n history(),\n notes(),\n ],\n },\n // Agreements\n {\n id: \"contract\", label: \"Agreement\", plural: \"Agreements\", pillar: \"agreements\", schema: \"Contract\", icon: \"contract\",\n lens: [\n { panel: \"parties\", title: \"Parties and roles\", from: [\"party_to\"], show: 5, group_by: \"role\" },\n { panel: \"terms\", title: \"Key terms and dates\", from: [\"starts\", \"renews\", \"notice\", \"amount\"], show: 6 },\n { panel: \"obligations\", title: \"Obligations it creates\", from: [\"creates\"], show: 5 },\n { panel: \"amendments\", title: \"Amendments\", from: [\"amends\"], show: 4 },\n history(),\n notes(),\n ],\n },\n // Law & Obligations\n {\n id: \"legal_source\", label: \"Legal source\", plural: \"Legal sources\", pillar: \"law\", schema: \"Legislation\", icon: \"law\",\n lens: [\n { panel: \"reference\", title: \"Gazette reference and dates\", from: [\"identifier\", \"published_in\", \"in_force_from\", \"legal_force\", \"issued_by\"], show: 6 },\n { panel: \"creates\", title: \"Obligations, penalties and reliefs it creates\", from: [\"creates\", \"created_by\"], show: 6 },\n { panel: \"amends\", title: \"Amends and amended by\", from: [\"amends\", \"repeals\", \"implements\"], show: 5 },\n { panel: \"applies\", title: \"Where it applies\", from: [\"applies_in\"], show: 3 },\n notes(),\n ],\n },\n {\n id: \"obligation\", label: \"Obligation\", plural: \"Obligations\", pillar: \"law\", schema: \"LegalRuleML Obligation\", icon: \"law\",\n lens: [\n { panel: \"rule\", title: \"Who must do what, by when\", from: [\"action\", \"bearer\", \"due_rule\", \"amount_rule\", \"authority\", \"status\"], show: 6 },\n { panel: \"dues\", title: \"Next due dates\", source: \"linked\", types: [\"due_date\"], show: 4 },\n { panel: \"sources\", title: \"Source articles\", from: [\"created_by\", \"changed_by\"], show: 4 },\n { panel: \"penalties\", title: \"Penalties and reliefs\", from: [\"penalty_for\", \"relieves\"], show: 4 },\n { panel: \"procedure\", title: \"Procedure\", from: [\"procedure\"], show: 2 },\n { panel: \"bearers\", title: \"Who carries it\", from: [\"subject_to\"], show: 5 },\n history(4),\n notes(),\n ],\n },\n {\n id: \"penalty\", label: \"Penalty\", plural: \"Penalties\", pillar: \"law\", schema: \"LegalRuleML Penalty\", icon: \"law\",\n lens: [\n { panel: \"rule\", title: \"For which failure, how much\", from: [\"penalty_for\", \"kind\", \"amount_rule\", \"created_by\"], show: 6 },\n notes(),\n ],\n },\n {\n id: \"relief\", label: \"Relief\", plural: \"Reliefs\", pillar: \"law\", schema: \"LegalRuleML Permission\", icon: \"law\",\n lens: [\n { panel: \"rule\", title: \"What it relieves, for whom, until when\", from: [\"relieves\", \"bearer\", \"condition\", \"created_by\"], show: 6 },\n notes(),\n ],\n },\n {\n id: \"due_date\", label: \"Due date\", plural: \"Due dates\", pillar: \"law\", schema: \"Event\", icon: \"calendar\",\n lens: [\n { panel: \"due\", title: \"Due\", from: [\"due_for\", \"bearer\", \"due\", \"status\", \"fulfilled_by\"], show: 6 },\n notes(),\n ],\n },\n // Events\n {\n id: \"event\", label: \"Event\", plural: \"Events\", pillar: \"events\", schema: \"Event\", icon: \"calendar\",\n lens: [\n notes(1),\n { panel: \"involved\", title: \"Who and what was involved\", from: [\"involves\", \"affects\", \"related\"], show: 8 },\n { panel: \"followed\", title: \"What followed\", source: \"linked\", types: [\"event\", \"decision\"], show: 4 },\n discussed,\n ],\n },\n // Decisions & Policies\n {\n id: \"decision\", label: \"Decision\", plural: \"Decisions\", pillar: \"decisions\", schema: \"ChooseAction\", icon: \"decision\",\n lens: [\n notes(1),\n { panel: \"affects\", title: \"What it affects\", from: [\"affects\", \"creates\", \"related\"], show: 6 },\n { panel: \"replaced\", title: \"Replaced by\", from: [\"replaced_by\"], show: 2 },\n discussed,\n ],\n },\n {\n id: \"policy\", label: \"Policy\", plural: \"Policies\", pillar: \"decisions\", schema: \"LegalRuleML Obligation\", icon: \"decision\",\n lens: [\n { panel: \"rule\", title: \"Rule\", from: [\"action\", \"bearer\", \"creates\", \"created_by\"], show: 6 },\n { panel: \"affects\", title: \"What it affects\", from: [\"affects\", \"related\"], show: 6 },\n notes(),\n ],\n },\n // Procedures\n {\n id: \"procedure\", label: \"Procedure\", plural: \"Procedures\", pillar: \"procedures\", schema: \"HowTo\", icon: \"steps\",\n lens: [\n notes(1),\n { panel: \"triggers\", title: \"What triggers it\", from: [\"procedure\", \"triggered_by\", \"related\"], show: 5 },\n { panel: \"runs\", title: \"Last runs\", source: \"linked\", types: [\"event\"], show: 4 },\n ],\n },\n // Topics (fallback, not in the sidebar)\n {\n id: \"topic\", label: \"Topic\", plural: \"Topics\", pillar: \"topics\", schema: \"skos:Concept\", icon: \"topic\",\n lens: [\n notes(1),\n { panel: \"related\", title: \"Related\", from: [\"related\"], show: 8 },\n history(4),\n ],\n },\n]\n\nexport const DEFAULT_ONTOLOGY: Ontology = {\n version: 1,\n pillars: [\n { id: \"parties\", label: \"Parties\", description: \"People and organisations, and the roles between them\", icon: \"person\" },\n { id: \"places\", label: \"Places & Jurisdictions\", description: \"Where things are, and whose rules apply there\", icon: \"pin\" },\n { id: \"assets\", label: \"Assets\", description: \"What is owned or run: devices, servers, apps, domains, accounts, agents\", icon: \"server\" },\n { id: \"offerings\", label: \"Offerings & Projects\", description: \"What is sold, built or delivered\", icon: \"project\" },\n { id: \"agreements\", label: \"Agreements\", description: \"Contracts, subscriptions and their terms\", icon: \"contract\" },\n { id: \"law\", label: \"Law & Obligations\", description: \"Legal sources, the obligations they create, penalties, reliefs and due dates\", icon: \"law\" },\n { id: \"events\", label: \"Events\", description: \"What happened, by importance\", icon: \"calendar\" },\n { id: \"decisions\", label: \"Decisions & Policies\", description: \"Why things are the way they are\", icon: \"decision\" },\n { id: \"procedures\", label: \"Procedures\", description: \"How things are done\", icon: \"steps\" },\n { id: \"topics\", label: \"Topics\", description: \"Pages no type fits yet. A growing count means a type is missing.\", icon: \"topic\", sidebar: false },\n ],\n types,\n properties: [\n { id: \"related\", label: \"related to\", inverse: \"related to\" },\n { id: \"role_at\", label: \"role at\", inverse: \"people\", wikidata: \"P108\", range: [\"organization\"] },\n { id: \"member_of\", label: \"member of\", inverse: \"members\", wikidata: \"P463\" },\n { id: \"founded\", label: \"founded\", inverse: \"founded by\", wikidata: \"P112\" },\n { id: \"works_with\", label: \"works with\", inverse: \"works with\" },\n { id: \"reports_to\", label: \"reports to\", inverse: \"manages\" },\n { id: \"client_of\", label: \"client of\", inverse: \"clients\", wikidata: \"P1972\" },\n { id: \"works_on\", label: \"works on\", inverse: \"people\" },\n { id: \"works_for\", label: \"works for\", inverse: \"agents\", wikidata: \"P108\" },\n { id: \"owns\", label: \"owns\", inverse: \"owned by\", wikidata: \"P1830\" },\n { id: \"uses\", label: \"uses\", inverse: \"used by\", wikidata: \"P2283\" },\n { id: \"located_in\", label: \"located in\", inverse: \"here\", wikidata: \"P276\" },\n { id: \"installed_on\", label: \"installed on\", inverse: \"installed apps\", range: [\"device\", \"server\"] },\n { id: \"runs_on\", label: \"runs on\", inverse: \"hosts\" },\n { id: \"registered_with\", label: \"registered with\", inverse: \"registered\" },\n { id: \"identifier\", label: \"identifier\", wikidata: \"P1448\" },\n { id: \"legal_form\", label: \"legal form\", wikidata: \"P1454\" },\n { id: \"registrar\", label: \"registrar\" },\n { id: \"licensed_by\", label: \"licensed by\", inverse: \"licences\" },\n { id: \"party_to\", label: \"party to\", inverse: \"parties\" },\n { id: \"starts\", label: \"starts\" },\n { id: \"renews\", label: \"renews\" },\n { id: \"notice\", label: \"notice period\" },\n { id: \"amount\", label: \"amount\" },\n { id: \"creates\", label: \"creates\", inverse: \"created by\" },\n { id: \"created_by\", label: \"created by\", inverse: \"creates\" },\n { id: \"changed_by\", label: \"changed by\", inverse: \"changes\" },\n { id: \"amends\", label: \"amends\", inverse: \"amended by\", wikidata: \"P144\" },\n { id: \"repeals\", label: \"repeals\", inverse: \"repealed by\" },\n { id: \"implements\", label: \"implements\", inverse: \"implemented by\" },\n { id: \"issued_by\", label: \"issued by\", inverse: \"issues\" },\n { id: \"published_in\", label: \"published in\", wikidata: \"P1433\" },\n { id: \"in_force_from\", label: \"in force from\", wikidata: \"P7588\" },\n { id: \"legal_force\", label: \"legal force\" },\n { id: \"applies_in\", label: \"applies in\", inverse: \"laws that apply\", wikidata: \"P1001\" },\n { id: \"jurisdiction_of\", label: \"authority in\", inverse: \"authorities\" },\n { id: \"subject_to\", label: \"subject to\", inverse: \"carried by\" },\n { id: \"action\", label: \"action\" },\n { id: \"bearer\", label: \"bearer\" },\n { id: \"due_rule\", label: \"due\" },\n { id: \"amount_rule\", label: \"amount\" },\n { id: \"authority\", label: \"authority\", inverse: \"collects\" },\n { id: \"status\", label: \"status\" },\n { id: \"penalty_for\", label: \"penalty for\", inverse: \"penalties\" },\n { id: \"relieves\", label: \"relieves\", inverse: \"reliefs\" },\n { id: \"condition\", label: \"condition\" },\n { id: \"kind\", label: \"kind\" },\n { id: \"procedure\", label: \"procedure\", inverse: \"carries out\" },\n { id: \"due_for\", label: \"due for\", inverse: \"due dates\" },\n { id: \"due\", label: \"due on\" },\n { id: \"fulfilled_by\", label: \"fulfilled by\", inverse: \"fulfils\" },\n { id: \"involves\", label: \"involves\", inverse: \"events\", wikidata: \"P710\" },\n { id: \"affects\", label: \"affects\", inverse: \"affected by\" },\n { id: \"replaced_by\", label: \"replaced by\", inverse: \"replaces\", wikidata: \"P1366\" },\n { id: \"triggered_by\", label: \"triggered by\", inverse: \"triggers\" },\n { id: \"mentions\", label: \"mentions\", inverse: \"discussed in\" },\n { id: \"reading\", label: \"reading\" },\n ],\n importance: {\n default: \"normal\",\n major_set_by: \"owner\",\n rollup: { min: 5, days: 30 },\n },\n sidebar: { pins_max: 5, pins: [] },\n classify: [\n // Old pages filed agents as people and machines as places; the title\n // tells them apart until absorb writes `class` on the page.\n { type: \"agent\", legacy: [\"person\", \"concept\", \"project\"], title: \"\\\\bagents?\\\\b|\\\\bbot\\\\b\" },\n { type: \"server\", legacy: [\"place\", \"concept\"], title: \"\\\\b(server|vps|host|node)\\\\b\" },\n { type: \"device\", legacy: [\"place\", \"concept\"], title: \"\\\\b(laptop|macbook|desktop|phone|tablet|printer|router)\\\\b\" },\n { type: \"person\", legacy: [\"person\"] },\n { type: \"event\", legacy: [\"event\"] },\n { type: \"decision\", legacy: [\"decision\"] },\n { type: \"procedure\", legacy: [\"pattern\"] },\n { type: \"place\", legacy: [\"place\"] },\n // Folder and tag rules below refine untyped and concept pages only.\n { type: \"project\", legacy: [\"project\"] },\n { type: \"organization\", path: [\"clients\", \"customers\", \"vendors\", \"suppliers\", \"organizations\", \"orgs\", \"companies\"] },\n { type: \"organization\", tags: [\"organization\", \"company\", \"client\", \"vendor\", \"supplier\", \"agency\", \"bank\"] },\n { type: \"server\", path: [\"servers\", \"hosts\", \"infrastructure\"] },\n { type: \"server\", tags: [\"server\", \"vps\", \"host\"] },\n { type: \"device\", path: [\"devices\"] },\n { type: \"device\", tags: [\"device\", \"laptop\", \"phone\", \"printer\"] },\n { type: \"agent\", tags: [\"agent\"], title: \"\\\\bagent\\\\b\" },\n { type: \"app\", path: [\"apps\", \"systems\", \"services\"] },\n { type: \"domain\", tags: [\"domain\", \"dns\"] },\n { type: \"contract\", path: [\"contracts\", \"agreements\"] },\n { type: \"contract\", tags: [\"contract\", \"agreement\", \"subscription\"] },\n { type: \"legal_source\", path: [\"laws\", \"legislation\"] },\n { type: \"legal_source\", tags: [\"law\", \"legislation\", \"decree\"] },\n { type: \"obligation\", path: [\"obligations\", \"compliance\"] },\n { type: \"obligation\", tags: [\"obligation\", \"compliance\"] },\n { type: \"policy\", path: [\"policies\"] },\n { type: \"policy\", tags: [\"policy\"] },\n { type: \"procedure\", path: [\"runbooks\", \"procedures\"] },\n { type: \"procedure\", tags: [\"runbook\", \"procedure\", \"how-to\"] },\n ],\n fallback_type: \"topic\",\n}\n"],"mappings":"wCAQA,OAAS,cAAAA,EAAY,gBAAAC,EAAc,YAAAC,EAAU,iBAAAC,MAAqB,KAClE,OAAS,WAAAC,MAAe,OACxB,OAAOC,MAAU,UCAjB,IAAMC,EAAU,CAACC,EAAO,KAAkB,CACxC,MAAO,UAAW,MAAO,UAAW,OAAQ,UAAW,KAAAA,EACvD,WAAY,CAAC,QAAS,QAAQ,EAAG,KAAM,QAAS,OAAQ,CAAE,I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,CAAQhC,EAAO,KAAK,gCAAgCgC,EAAE,QAAQ,CAAE,CAGrG,OAAKR,EAAM,IAAIH,EAAE,aAAa,GAAGrB,EAAO,KAAK,gCAAgCqB,EAAE,gBAAgB,EAC1FU,EAAkB,SAASV,EAAE,WAAW,OAAO,GAAGrB,EAAO,KAAK,sCAAsCqB,EAAE,WAAW,UAAU,EAC5HA,EAAE,QAAQ,KAAK,OAASA,EAAE,QAAQ,UACpCrB,EAAO,KAAK,iBAAiBqB,EAAE,QAAQ,KAAK,+BAA+BA,EAAE,QAAQ,oBAAoB,EAEpGrB,CACT,CAEO,SAAS4B,EAAUL,EAAwB,CAChD,OAAKA,EAAE,KACA,MAAM,QAAQA,EAAE,IAAI,EAAIA,EAAE,KAAO,CAACA,EAAE,IAAI,EAD3B,CAAC,CAEvB,CAEO,SAASU,EAAYV,EAA2B,CACrD,OAAIA,EAAE,OAAeA,EAAE,OACnBA,EAAE,QAAU,WAAaA,EAAE,QAAU,aAAeA,EAAE,QAAU,QAAgBA,EAAE,MAClFA,EAAE,OAAe,WACjBA,EAAE,KAAa,aACZ,QACT,CAEA,SAASjB,EAAS4B,EAA0C,CAC1D,OAAO,OAAOA,GAAM,UAAYA,IAAM,MAAQ,CAAC,MAAM,QAAQA,CAAC,CAChE","names":["existsSync","readFileSync","statSync","writeFileSync","resolve","yaml","history","show","discussed","notes","ASSET_TYPES","types","DEFAULT_ONTOLOGY","ONTOLOGY_FILE","cache","loadOntology","wikiDir","file","resolve","existsSync","DEFAULT_ONTOLOGY","mtimeMs","statSync","hit","raw","errors","yaml","readFileSync","err","ontology","mergeOntology","isObject","checkOntology","loaded","writeDefaultOntology","header","writeFileSync","base","over","out","key","list","mergeById","x","item","at","o","pillars","p","types","t","props","f","panelFrom","ty","lv","IMPORTANCE_LEVELS","r","panelSource","v"]}
@@ -1,3 +0,0 @@
1
- import{readFileSync as l,existsSync as f}from"fs";import{resolve as d}from"path";function a(e){let n=[];for(let r of e.split(`
2
- `)){let t=r.trim();if(!t||t.startsWith("#"))continue;let s=t.startsWith("export ")?t.slice(7).trim():t,i=s.indexOf("=");if(i===-1)continue;let c=s.slice(0,i).trim(),o=s.slice(i+1).trim();o.length>=2&&(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),c&&n.push([c,o])}return n}function E(e){let n={};for(let r of[".env",".env.gitlab"]){let t=d(e,r);if(f(t))try{for(let[s,i]of a(l(t,"utf-8")))n[s]=i}catch{}}return n}var p=new Map;function g(e=process.cwd()){let n=p.get(e);if(n)return n;let r=d(e,".env"),t;if(!f(r))t=new Set;else try{t=new Set(a(l(r,"utf-8")).map(([s])=>s))}catch{t=new Set}return p.set(e,t),t}function A(e,n=process.env,r=process.cwd()){let t=E(e),s=g(r),i={...n};for(let c of s)c in t||delete i[c];for(let[c,o]of Object.entries(t))i[c]=o;return i}function u(e){return delete e.ANTHROPIC_API_KEY,delete e.ANTHROPIC_API_KEY_OLD,e}function v(e){let n=e.HOME||process.env.HOME,r=[e.PATH||"",n?`${n}/.local/bin`:"","/opt/homebrew/bin","/usr/local/bin"];return e.PATH=Array.from(new Set(r.flatMap(t=>t.split(":")).filter(Boolean))).join(":"),e}function m(){let e=v(u({...process.env}));return delete e.CLAUDECODE,e}function S(e,n="subscription"){if(n!=="api")return u(e);if(!e.ANTHROPIC_API_KEY)throw new Error(`billing "api" needs ANTHROPIC_API_KEY in the agent's environment`);return delete e.ANTHROPIC_API_KEY_OLD,delete e.CLAUDE_CODE_OAUTH_TOKEN,e}function y(e){if(f(e))for(let[n,r]of a(l(e,"utf-8")))process.env[n]===void 0&&(process.env[n]=r)}export{A as a,u as b,m as c,S as d,y as e};
3
- //# sourceMappingURL=chunk-VD7IO653.js.map