agentix-cli 0.134.0 → 0.135.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 (110) hide show
  1. package/dist/{absorb-eval-WU7JR3BT.js → absorb-eval-WY3YMLS4.js} +2 -2
  2. package/dist/{agent-2GPJGHHG.js → agent-3R5NY7I3.js} +2 -2
  3. package/dist/{board-dashboard-PUQPL4AX.js → board-dashboard-U3ZSCO62.js} +2 -2
  4. package/dist/{chunk-AHO4CQRK.js → chunk-5NT44FKL.js} +2 -2
  5. package/dist/{chunk-RJOA7QBB.js → chunk-6WF56ME6.js} +2 -2
  6. package/dist/{chunk-MCBTVNPX.js → chunk-BQIWMQNU.js} +2 -2
  7. package/dist/{chunk-MM3F74K4.js → chunk-EEBK4F6E.js} +3 -3
  8. package/dist/chunk-EEBK4F6E.js.map +1 -0
  9. package/dist/{chunk-YSXE65O7.js → chunk-GSKJ57XY.js} +4 -4
  10. package/dist/{chunk-VQYVL72V.js → chunk-H6VWU2HN.js} +2 -2
  11. package/dist/chunk-JRS5QRZG.js +2 -0
  12. package/dist/chunk-JRS5QRZG.js.map +1 -0
  13. package/dist/{chunk-5BI2T3WD.js → chunk-JTDUTCUE.js} +3 -3
  14. package/dist/chunk-JTDUTCUE.js.map +1 -0
  15. package/dist/{chunk-4VVHGR7H.js → chunk-KEXBEUSU.js} +1 -1
  16. package/dist/{chunk-4VVHGR7H.js.map → chunk-KEXBEUSU.js.map} +1 -1
  17. package/dist/chunk-L5UGH4T4.js +160 -0
  18. package/dist/chunk-L5UGH4T4.js.map +1 -0
  19. package/dist/{chunk-RDEFA6Y6.js → chunk-LU7GDHGD.js} +2 -2
  20. package/dist/chunk-MI7WOGH6.js +4 -0
  21. package/dist/chunk-MI7WOGH6.js.map +1 -0
  22. package/dist/chunk-NY7NHGVT.js +105 -0
  23. package/dist/chunk-NY7NHGVT.js.map +1 -0
  24. package/dist/chunk-QAWKN2N4.js +3 -0
  25. package/dist/chunk-QAWKN2N4.js.map +1 -0
  26. package/dist/{chunk-FEEXOWK5.js → chunk-QDWEM4DG.js} +2 -2
  27. package/dist/{chunk-JP5OAMWQ.js → chunk-RGZARSHV.js} +1 -1
  28. package/dist/{chunk-JP5OAMWQ.js.map → chunk-RGZARSHV.js.map} +1 -1
  29. package/dist/{chunk-TDGDH4RA.js → chunk-RVEMX5MJ.js} +2 -2
  30. package/dist/{chunk-TDGDH4RA.js.map → chunk-RVEMX5MJ.js.map} +1 -1
  31. package/dist/{chunk-URN74FTP.js → chunk-WWDYDLY2.js} +2 -2
  32. package/dist/{chunk-G4HDRJVN.js → chunk-YA3P77LV.js} +2 -2
  33. package/dist/{chunk-XWO6ALJQ.js → chunk-ZFRXFUP7.js} +2 -2
  34. package/dist/{chunk-NXRSIWQA.js → chunk-ZGVVYJIK.js} +2 -2
  35. package/dist/cli.js +1 -1
  36. package/dist/{contributions-74M6YOCZ.js → contributions-KLRJ4ZXV.js} +2 -2
  37. package/dist/{enrich-NH3WHKD6.js → enrich-ZB5I7KHN.js} +2 -2
  38. package/dist/event-levels-CQWHSLMT.js +3 -0
  39. package/dist/event-levels-CQWHSLMT.js.map +1 -0
  40. package/dist/graph-ZVKV3JBD.js +2 -0
  41. package/dist/{hub-VTDFUAEH.js → hub-TILTOOSS.js} +2 -2
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.js +1 -1
  44. package/dist/load-EOZUZK7U.js +2 -0
  45. package/dist/model-call-PKV5UAQ7.js +2 -0
  46. package/dist/{program-3URNCVEZ.js → program-U3HJY7E5.js} +272 -274
  47. package/dist/program-U3HJY7E5.js.map +1 -0
  48. package/dist/{promote-B2BADAEP.js → promote-RHVZB2QZ.js} +2 -2
  49. package/dist/push-bridge-325SXDGN.js +1 -1
  50. package/dist/{query-2VIIGGDS.js → query-OZXZVLO7.js} +2 -2
  51. package/dist/query-runs-7VX3YAC3.js +4 -0
  52. package/dist/query-runs-7VX3YAC3.js.map +1 -0
  53. package/dist/{query-settings-VJ3POZS3.js → query-settings-2MGUS6AY.js} +2 -2
  54. package/dist/registry-LZLIPP7N.js +2 -0
  55. package/dist/roster-BZGKG2ZA.js +2 -0
  56. package/dist/score-DZGPLHCL.js +3 -0
  57. package/dist/score-DZGPLHCL.js.map +1 -0
  58. package/dist/types-ARP27T6T.js +2 -0
  59. package/dist/types-LJZ2YY5W.js +2 -0
  60. package/dist/{wiki-SXWJ5NJQ.js → wiki-GCRRINW3.js} +2 -2
  61. package/dist/wiki-GCRRINW3.js.map +1 -0
  62. package/dist/wiki-enrich-P5TNWACZ.js +2 -0
  63. package/dist/wiki-enrich-P5TNWACZ.js.map +1 -0
  64. package/package.json +1 -1
  65. package/dist/chunk-5BI2T3WD.js.map +0 -1
  66. package/dist/chunk-7VLLZQ3N.js +0 -2
  67. package/dist/chunk-7VLLZQ3N.js.map +0 -1
  68. package/dist/chunk-DDEDSYLF.js +0 -105
  69. package/dist/chunk-DDEDSYLF.js.map +0 -1
  70. package/dist/chunk-KFIJDLQ5.js +0 -3
  71. package/dist/chunk-KFIJDLQ5.js.map +0 -1
  72. package/dist/chunk-MM3F74K4.js.map +0 -1
  73. package/dist/chunk-SFVDQNTY.js +0 -156
  74. package/dist/chunk-SFVDQNTY.js.map +0 -1
  75. package/dist/graph-EXDH7EPZ.js +0 -2
  76. package/dist/load-5DNMGHFW.js +0 -2
  77. package/dist/model-call-BGTDPWZD.js +0 -2
  78. package/dist/program-3URNCVEZ.js.map +0 -1
  79. package/dist/registry-PRCISYBO.js +0 -2
  80. package/dist/roster-IRXP32XF.js +0 -2
  81. package/dist/score-KDNIUTNV.js +0 -3
  82. package/dist/score-KDNIUTNV.js.map +0 -1
  83. package/dist/types-ROL44T62.js +0 -2
  84. /package/dist/{absorb-eval-WU7JR3BT.js.map → absorb-eval-WY3YMLS4.js.map} +0 -0
  85. /package/dist/{agent-2GPJGHHG.js.map → agent-3R5NY7I3.js.map} +0 -0
  86. /package/dist/{board-dashboard-PUQPL4AX.js.map → board-dashboard-U3ZSCO62.js.map} +0 -0
  87. /package/dist/{chunk-AHO4CQRK.js.map → chunk-5NT44FKL.js.map} +0 -0
  88. /package/dist/{chunk-RJOA7QBB.js.map → chunk-6WF56ME6.js.map} +0 -0
  89. /package/dist/{chunk-MCBTVNPX.js.map → chunk-BQIWMQNU.js.map} +0 -0
  90. /package/dist/{chunk-YSXE65O7.js.map → chunk-GSKJ57XY.js.map} +0 -0
  91. /package/dist/{chunk-VQYVL72V.js.map → chunk-H6VWU2HN.js.map} +0 -0
  92. /package/dist/{chunk-RDEFA6Y6.js.map → chunk-LU7GDHGD.js.map} +0 -0
  93. /package/dist/{chunk-FEEXOWK5.js.map → chunk-QDWEM4DG.js.map} +0 -0
  94. /package/dist/{chunk-URN74FTP.js.map → chunk-WWDYDLY2.js.map} +0 -0
  95. /package/dist/{chunk-G4HDRJVN.js.map → chunk-YA3P77LV.js.map} +0 -0
  96. /package/dist/{chunk-XWO6ALJQ.js.map → chunk-ZFRXFUP7.js.map} +0 -0
  97. /package/dist/{chunk-NXRSIWQA.js.map → chunk-ZGVVYJIK.js.map} +0 -0
  98. /package/dist/{contributions-74M6YOCZ.js.map → contributions-KLRJ4ZXV.js.map} +0 -0
  99. /package/dist/{enrich-NH3WHKD6.js.map → enrich-ZB5I7KHN.js.map} +0 -0
  100. /package/dist/{graph-EXDH7EPZ.js.map → graph-ZVKV3JBD.js.map} +0 -0
  101. /package/dist/{hub-VTDFUAEH.js.map → hub-TILTOOSS.js.map} +0 -0
  102. /package/dist/{load-5DNMGHFW.js.map → load-EOZUZK7U.js.map} +0 -0
  103. /package/dist/{model-call-BGTDPWZD.js.map → model-call-PKV5UAQ7.js.map} +0 -0
  104. /package/dist/{promote-B2BADAEP.js.map → promote-RHVZB2QZ.js.map} +0 -0
  105. /package/dist/{query-2VIIGGDS.js.map → query-OZXZVLO7.js.map} +0 -0
  106. /package/dist/{query-settings-VJ3POZS3.js.map → query-settings-2MGUS6AY.js.map} +0 -0
  107. /package/dist/{registry-PRCISYBO.js.map → registry-LZLIPP7N.js.map} +0 -0
  108. /package/dist/{roster-IRXP32XF.js.map → roster-BZGKG2ZA.js.map} +0 -0
  109. /package/dist/{types-ROL44T62.js.map → types-ARP27T6T.js.map} +0 -0
  110. /package/dist/{wiki-SXWJ5NJQ.js.map → types-LJZ2YY5W.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-AHO4CQRK.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-DDEDSYLF.js";import"./chunk-JP5OAMWQ.js";import"./chunk-4VVHGR7H.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
- //# sourceMappingURL=promote-B2BADAEP.js.map
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-5NT44FKL.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-NY7NHGVT.js";import"./chunk-KEXBEUSU.js";import"./chunk-RGZARSHV.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
+ //# sourceMappingURL=promote-RHVZB2QZ.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-XGOBZCYC.js";import"./chunk-WCXXXAHV.js";import"./chunk-GRMCAO3Q.js";import"./chunk-JWDJMFU6.js";import"./chunk-KZKDVIOE.js";import"./chunk-QIJLFPWE.js";export{i as PushRosterSync,a as ROSTER_CHECK_MS,b as ROSTER_RESEND_MS,h as handlePushBridge,g as peerOrigins,d as pushBridgeCaller,c as pushOrigin,f as relayTokenProblem,e as scopedPushTarget};
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-XGOBZCYC.js";import"./chunk-WCXXXAHV.js";import"./chunk-GRMCAO3Q.js";import"./chunk-KZKDVIOE.js";import"./chunk-JWDJMFU6.js";import"./chunk-QIJLFPWE.js";export{i as PushRosterSync,a as ROSTER_CHECK_MS,b as ROSTER_RESEND_MS,h as handlePushBridge,g as peerOrigins,d as pushBridgeCaller,c as pushOrigin,f as relayTokenProblem,e as scopedPushTarget};
2
2
  //# sourceMappingURL=push-bridge-325SXDGN.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h}from"./chunk-URN74FTP.js";import"./chunk-G4HDRJVN.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-7VLLZQ3N.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as AUTO_SUMMARY_COVERAGE,f as DEFAULT_GRAPH_WEIGHT,e as SHARED_CATALOG_LINES,b as agenticQuery,d as catalogPool,g as rankCatalogPool,c as retrieveArticles,h as sharedQueryEnabled};
2
- //# sourceMappingURL=query-2VIIGGDS.js.map
1
+ import{a,b,c,d,e,f,g,h}from"./chunk-WWDYDLY2.js";import"./chunk-YA3P77LV.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-JRS5QRZG.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as AUTO_SUMMARY_COVERAGE,f as DEFAULT_GRAPH_WEIGHT,e as SHARED_CATALOG_LINES,b as agenticQuery,d as catalogPool,g as rankCatalogPool,c as retrieveArticles,h as sharedQueryEnabled};
2
+ //# sourceMappingURL=query-OZXZVLO7.js.map
@@ -0,0 +1,4 @@
1
+ import"./chunk-QIJLFPWE.js";import{appendFileSync as l}from"fs";var y="_query-runs.jsonl";function i(r){return r==="error"||r==="no-catalog"}function m(r,n){try{l(r,`${JSON.stringify(n)}
2
+ `)}catch{}}function g(r,n){let u=r.split(`
3
+ `).filter(Boolean).flatMap(t=>{try{let e=JSON.parse(t);return e&&typeof e.status=="string"&&typeof e.at=="string"?[e]:[]}catch{return[]}}).filter(t=>!n||t.at>=n),o={};for(let t of u)o[t.status]=(o[t.status]??0)+1;let s=u.map(t=>Number(t.wallMs)||0).sort((t,e)=>t-e),a=t=>s.length?s[Math.min(s.length-1,Math.floor(t*s.length))]:0;return{total:u.length,failed:u.filter(t=>i(t.status)).length,byStatus:o,wallMsP50:a(.5),wallMsP95:a(.95)}}export{y as QUERY_RUNS_FILE,i as queryFailed,m as recordQueryRun,g as summariseQueryRuns};
4
+ //# sourceMappingURL=query-runs-7VX3YAC3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wiki/query-runs.ts"],"sourcesContent":["/**\n * `wiki query` outcomes, one line per query in `_query-runs.jsonl` (#603).\n *\n * A failed query used to print plain text and exit 0, so nothing counted\n * it. Each query now appends its status and timing here, and\n * `wiki query-runs` counts them. No question, answer or error text goes\n * in the file.\n */\nimport { appendFileSync } from \"fs\"\nimport type { AgenticQueryResult } from \"./query\"\n\nexport const QUERY_RUNS_FILE = \"_query-runs.jsonl\"\n\nexport type QueryStatus = AgenticQueryResult[\"status\"]\n\nexport interface QueryRunRecord {\n at: string\n agent: string\n status: QueryStatus\n method?: string\n wallMs: number\n}\n\n/** Statuses that mean the query could not run, not that the wiki had no answer. */\nexport function queryFailed(status: QueryStatus): boolean {\n return status === \"error\" || status === \"no-catalog\"\n}\n\n/** Append one record. Never throws: logging must not fail a query. */\nexport function recordQueryRun(file: string, record: QueryRunRecord): void {\n try {\n appendFileSync(file, `${JSON.stringify(record)}\\n`)\n } catch {\n // best-effort\n }\n}\n\nexport interface QueryRunSummary {\n total: number\n failed: number\n byStatus: Record<string, number>\n wallMsP50: number\n wallMsP95: number\n}\n\n/** Count queries by status, on or after `since` (an ISO date or time) when given. */\nexport function summariseQueryRuns(text: string, since?: string): QueryRunSummary {\n const records: QueryRunRecord[] = text.split(\"\\n\").filter(Boolean).flatMap((l) => {\n try {\n const r = JSON.parse(l)\n return r && typeof r.status === \"string\" && typeof r.at === \"string\" ? [r] : []\n } catch { return [] }\n }).filter((r) => !since || r.at >= since)\n const byStatus: Record<string, number> = {}\n for (const r of records) byStatus[r.status] = (byStatus[r.status] ?? 0) + 1\n const ms = records.map((r) => Number(r.wallMs) || 0).sort((a, b) => a - b)\n const pick = (q: number) => (ms.length ? ms[Math.min(ms.length - 1, Math.floor(q * ms.length))] : 0)\n return {\n total: records.length,\n failed: records.filter((r) => queryFailed(r.status)).length,\n byStatus,\n wallMsP50: pick(0.5),\n wallMsP95: pick(0.95),\n }\n}\n"],"mappings":"4BAQA,OAAS,kBAAAA,MAAsB,KAGxB,IAAMC,EAAkB,oBAaxB,SAASC,EAAYC,EAA8B,CACxD,OAAOA,IAAW,SAAWA,IAAW,YAC1C,CAGO,SAASC,EAAeC,EAAcC,EAA8B,CACzE,GAAI,CACFN,EAAeK,EAAM,GAAG,KAAK,UAAUC,CAAM;AAAA,CAAK,CACpD,MAAE,CAEF,CACF,CAWO,SAASC,EAAmBC,EAAcC,EAAiC,CAChF,IAAMC,EAA4BF,EAAK,MAAM;AAAA,CAAI,EAAE,OAAO,OAAO,EAAE,QAASG,GAAM,CAChF,GAAI,CACF,IAAMC,EAAI,KAAK,MAAMD,CAAC,EACtB,OAAOC,GAAK,OAAOA,EAAE,QAAW,UAAY,OAAOA,EAAE,IAAO,SAAW,CAACA,CAAC,EAAI,CAAC,CAChF,MAAE,CAAQ,MAAO,CAAC,CAAE,CACtB,CAAC,EAAE,OAAQA,GAAM,CAACH,GAASG,EAAE,IAAMH,CAAK,EAClCI,EAAmC,CAAC,EAC1C,QAAWD,KAAKF,EAASG,EAASD,EAAE,MAAM,GAAKC,EAASD,EAAE,MAAM,GAAK,GAAK,EAC1E,IAAME,EAAKJ,EAAQ,IAAKE,GAAM,OAAOA,EAAE,MAAM,GAAK,CAAC,EAAE,KAAK,CAACG,EAAGC,IAAMD,EAAIC,CAAC,EACnEC,EAAQC,GAAeJ,EAAG,OAASA,EAAG,KAAK,IAAIA,EAAG,OAAS,EAAG,KAAK,MAAMI,EAAIJ,EAAG,MAAM,CAAC,CAAC,EAAI,EAClG,MAAO,CACL,MAAOJ,EAAQ,OACf,OAAQA,EAAQ,OAAQE,GAAMV,EAAYU,EAAE,MAAM,CAAC,EAAE,OACrD,SAAAC,EACA,UAAWI,EAAK,EAAG,EACnB,UAAWA,EAAK,GAAI,CACtB,CACF","names":["appendFileSync","QUERY_RUNS_FILE","queryFailed","status","recordQueryRun","file","record","summariseQueryRuns","text","since","records","l","r","byStatus","ms","a","b","pick","q"]}
@@ -1,3 +1,3 @@
1
- import{b as u}from"./chunk-MEFPXHQJ.js";import{c as a}from"./chunk-G4HDRJVN.js";import"./chunk-7VLLZQ3N.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QIJLFPWE.js";import{readFileSync as f}from"fs";import{resolve as d}from"path";var g={shared:!0,method:"auto",summaries:a,notes:{enabled:!1,types:["project","reference"],dirs:{}}};function y(n,t,e=process.cwd()){if(!n.notes.enabled||!t)return;let r=n.notes.dirs[t];return{owner:t,dir:r?d(e,r):new u({baseDir:d(e,".agentx")}).dirOf(t),types:n.notes.types}}function E(n,t,e=process.env,r=process.cwd()){let i=e.AGENTX_AGENT_ID;if(!(!i||i!==t))return y(n,t,r)}function p(n){if(n)try{return f(n,"utf-8").trim().split(`
1
+ import{b as u}from"./chunk-MEFPXHQJ.js";import{c as a}from"./chunk-YA3P77LV.js";import"./chunk-JRS5QRZG.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QIJLFPWE.js";import{readFileSync as f}from"fs";import{resolve as d}from"path";var g={shared:!0,method:"auto",summaries:a,notes:{enabled:!1,types:["project","reference"],dirs:{}}};function y(n,t,e=process.cwd()){if(!n.notes.enabled||!t)return;let r=n.notes.dirs[t];return{owner:t,dir:r?d(e,r):new u({baseDir:d(e,".agentx")}).dirOf(t),types:n.notes.types}}function E(n,t,e=process.env,r=process.cwd()){let i=e.AGENTX_AGENT_ID;if(!(!i||i!==t))return y(n,t,r)}function p(n){if(n)try{return f(n,"utf-8").trim().split(`
2
2
  `)[0].trim()||void 0}catch{return}}function c(n,t){try{let e=new URL(n);return e.protocol==="https:"&&e.origin===new URL(t).origin}catch{return!1}}var l=n=>n.map(t=>typeof t=="string"?{repo:t}:{repo:t.repo,about:t.about});function h(n,t=process.env){let e=[];for(let r of n.wiki.query.live.sources){if(r.type==="agentx"){let o=n.node.bind.replace(/^0\.0\.0\.0:/,"127.0.0.1:");e.push({type:"agentx",url:r.url??`http://${o}`,peers:r.peers});continue}let i=(r.tokenEnv?t[r.tokenEnv]:void 0)||p(r.tokenFile);if(r.type==="github"){let o=n.channels.github,s=c(r.apiUrl,"https://api.github.com")?o?.token||p(o?.tokenFile):void 0;e.push({type:"github",apiUrl:r.apiUrl,token:i||s||void 0,repos:l(r.repos)})}else{let o=n.channels.gitlab,s=r.url??o?.host;if(!s)continue;let m=o?.host&&(!r.url||c(s,o.host))?o.token:void 0;e.push({type:"gitlab",url:s,token:i||m||void 0,repos:l(r.repos)})}}return e}function v(n,t=process.env){let e=n.wiki.query;return{shared:e.shared,method:e.method,summaries:{candidates:e.candidates,sharedCandidates:e.sharedCandidates,noteCandidates:e.notes.candidates,maxPages:e.maxPages,pageChars:e.pageChars,linkedPages:e.linkedPages,linkedChars:e.linkedChars,navigatorModel:e.navigatorModel,answerModel:e.answerModel,live:{enabled:e.live.enabled,maxReads:e.live.maxReads,timeoutMs:e.live.timeoutMs,plannerModel:e.live.plannerModel,sources:h(n,t)}},notes:{enabled:e.notes.enabled,types:e.notes.types,dirs:Object.fromEntries(Object.entries(n.agents).flatMap(([r,i])=>i.wiki?.notes?.dir?[[r,i.wiki.notes.dir]]:[]))}}}async function M(n){try{let{loadDaemonConfig:t}=await import("./config-GHMRBRDL.js");return v(t(n))}catch{return g}}export{g as DEFAULT_QUERY_SETTINGS,M as loadQuerySettings,c as mayLendToken,y as noteSourceFor,h as resolveLiveSources,v as resolveQuerySettings,E as toolNoteSourceFor};
3
- //# sourceMappingURL=query-settings-VJ3POZS3.js.map
3
+ //# sourceMappingURL=query-settings-2MGUS6AY.js.map
@@ -0,0 +1,2 @@
1
+ import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i,aa as k,ba as l,ca as m,da as n}from"./chunk-L5UGH4T4.js";import"./chunk-QDWEM4DG.js";import"./chunk-QSKG754X.js";import"./chunk-MEFPXHQJ.js";import"./chunk-SZDACK6O.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-SSQMFHSM.js";import"./chunk-LUYN6RAC.js";import"./chunk-3UOTLMXD.js";import"./chunk-36AXN6ZB.js";import"./chunk-KA2UIZXG.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-VWTBHLMX.js";import"./chunk-6WF56ME6.js";import"./chunk-NY7NHGVT.js";import"./chunk-KEXBEUSU.js";import"./chunk-RGZARSHV.js";import"./chunk-WWDYDLY2.js";import"./chunk-YA3P77LV.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-JRS5QRZG.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-K445URSN.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-6TURWSMN.js";import"./chunk-AV7T3SYT.js";import"./chunk-Y5MFVVTM.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{m as AgentRegistry,a as EDIT_TOOL_INSTRUCTION,h as TRACE_STEP_SUMMARY_BYTES,e as buildEntryMeta,f as buildEventDigest,g as buildWikiContext,i as clipForTrace,b as codingInstructions,l as emitTraceStepsFromStreamEvent,k as firstMissingRequiredTool,d as getGlobalRegistry,n as richReplyPrompt,c as setGlobalRegistry,j as tallyToolUses};
2
+ //# sourceMappingURL=registry-LZLIPP7N.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-QAWKN2N4.js";import"./chunk-QIJLFPWE.js";export{a as buildRoster,d as configuredAgents,e as loadRoster,c as personaName,b as rosterMatch};
2
+ //# sourceMappingURL=roster-BZGKG2ZA.js.map
@@ -0,0 +1,3 @@
1
+ import"./chunk-QIJLFPWE.js";function S(n){let s=n.trim();return(s.startsWith("[")?JSON.parse(s):s.split(`
2
+ `).filter(r=>r.trim()).map(r=>JSON.parse(r))).map((r,t)=>{let e=r??{},o=typeof e.question=="string"?e.question.trim():"",u=Array.isArray(e.expect)?e.expect.filter(c=>typeof c=="string"&&!!c.trim()):[];if(!o||u.length===0)throw new Error(`question ${t+1} needs a "question" and a non-empty "expect" list`);return{id:typeof e.id=="string"&&e.id?e.id:`q${t+1}`,question:o,expect:u}})}var l=n=>n.toLowerCase().replace(/[\s ]+/g," ").trim(),m=n=>n.replace(/\D+/g,"");function h(n,s){let i=l(n),r=m(n),t=[],e=[];for(let o of s)(o.split("|").some(c=>{let g=m(c);return!!c.trim()&&i.includes(l(c))||g.length>=5&&r.includes(g)})?t:e).push(o);return{found:t,missing:e}}function x(n,s){let i=s.map(({q:t,answer:e,status:o,citations:u,method:c,ms:g,costUsd:d})=>{let{found:a,missing:f}=h(e,t.expect);return{id:t.id,question:t.question,expect:t.expect,found:a,missing:f,score:a.length/t.expect.length,status:o,answer:e,citations:u,...c?{method:c}:{},...g!==void 0?{ms:g}:{},...d!==void 0?{costUsd:d}:{}}}),r=i.length?i.reduce((t,e)=>t+e.score,0)/i.length:0;return{at:n.at??new Date().toISOString(),questions:n.questions,agent:n.agent,shared:n.shared,...n.settings?{settings:n.settings}:{},score:r,full:i.filter(t=>t.missing.length===0).length,results:i}}function p(n){let s=t=>t.length?t.reduce((e,o)=>e+o,0)/t.length:void 0,i=n.results.flatMap(t=>t.ms===void 0?[]:[t.ms]),r=n.results.flatMap(t=>t.costUsd===void 0?[]:[t.costUsd]);return{meanMs:s(i),meanCostUsd:s(r),unpriced:n.results.length-r.length}}function R(n,s){let i=new Map(n.results.map(e=>[e.id,e])),r=s.results.map(e=>{let o=i.get(e.id);return{id:e.id,question:e.question,before:o?.score??0,after:e.score,gained:e.found.filter(u=>!o?.found.includes(u)),lost:(o?.found??[]).filter(u=>!e.found.includes(u)),...o?.ms!==void 0||e.ms!==void 0?{ms:{before:o?.ms,after:e.ms}}:{},...o?.costUsd!==void 0||e.costUsd!==void 0?{costUsd:{before:o?.costUsd,after:e.costUsd}}:{}}}),t=new Set(s.results.map(e=>e.id));return{before:n.score,after:s.score,deltas:r,changed:b(n,s),onlyBefore:n.results.filter(e=>!t.has(e.id)).map(e=>e.id),onlyAfter:s.results.filter(e=>!i.has(e.id)).map(e=>e.id),cost:{before:p(n),after:p(s)}}}function b(n,s){if(!n.settings||!s.settings)return"unknown";let i={...n.settings,agent:n.agent,shared:n.shared},r={...s.settings,agent:s.agent,shared:s.shared};return[...new Set([...Object.keys(i),...Object.keys(r)])].filter(t=>i[t]!==r[t]).map(t=>`${t}: ${String(i[t])} \u2192 ${String(r[t])}`)}export{x as buildReport,R as compareReports,h as matchFacts,S as parseQuestionSet,p as runCost};
3
+ //# sourceMappingURL=score-DZGPLHCL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/wiki/score.ts"],"sourcesContent":["// --- Score the wiki against a question set (#824) ---\n//\n// The fleet test behind #824 scored the wiki by hand: each agent took 10\n// to 12 real questions from its own past work and checked whether the\n// wiki answered them (47% and 75%). This makes that repeatable, so the\n// same set can be run before and after a week of daily contributions.\n//\n// A question set is JSON (an array) or JSON lines, one question each:\n//\n// {\"id\": \"q1\", \"question\": \"What is the vendor's billing contact's phone?\", \"expect\": [\"+1 555 0100\"]}\n//\n// An answer scores the share of its expected facts it contains. Matching\n// ignores case and spacing; a fact with five or more digits (a phone,\n// an invoice number) also matches on its digits alone. \"a|b\" accepts\n// either spelling (a date or an amount written two ways). Question sets\n// hold real facts, so they belong outside the repository.\n\nexport interface ScoreQuestion {\n id: string\n question: string\n /** Facts a correct answer contains, copied as they should appear. */\n expect: string[]\n}\n\nexport interface ScoreResult {\n id: string\n question: string\n expect: string[]\n found: string[]\n missing: string[]\n /** found / expected, 0–1. */\n score: number\n status: string\n answer: string\n citations: string[]\n /** How the pages were picked for this question. */\n method?: string\n /** Wall time of the question, in milliseconds. */\n ms?: number\n /** Model spend of the question, in dollars. Unset when it is not known\n * (the catalog method, or a call that reported no cost). */\n costUsd?: number\n}\n\n/** What a run was asked with, so two reports show what changed between them. */\nexport interface ScoreSettings {\n method: string\n linkedPages: number\n linkedChars: number\n live: boolean\n notes: boolean\n navigatorModel: string\n answerModel: string\n}\n\nexport interface ScoreReport {\n at: string\n questions: string\n agent: string\n /** Whether the shared wiki was searched too. */\n shared: boolean\n /** Unset in reports written before #863. */\n settings?: ScoreSettings\n /** Mean of the question scores, 0–1. */\n score: number\n /** Questions every expected fact was found for. */\n full: number\n results: ScoreResult[]\n}\n\nexport function parseQuestionSet(text: string): ScoreQuestion[] {\n const trimmed = text.trim()\n const raw: unknown[] = trimmed.startsWith(\"[\")\n ? JSON.parse(trimmed)\n : trimmed.split(\"\\n\").filter((l) => l.trim()).map((l) => JSON.parse(l))\n return raw.map((x, i) => {\n const r = (x ?? {}) as Record<string, unknown>\n const question = typeof r.question === \"string\" ? r.question.trim() : \"\"\n const expect = Array.isArray(r.expect) ? r.expect.filter((e): e is string => typeof e === \"string\" && !!e.trim()) : []\n if (!question || expect.length === 0) throw new Error(`question ${i + 1} needs a \"question\" and a non-empty \"expect\" list`)\n return { id: typeof r.id === \"string\" && r.id ? r.id : `q${i + 1}`, question, expect }\n })\n}\n\nconst norm = (s: string) => s.toLowerCase().replace(/[\\s ]+/g, \" \").trim()\nconst digits = (s: string) => s.replace(/\\D+/g, \"\")\n\n/** Which expected facts the answer contains. */\nexport function matchFacts(answer: string, expect: string[]): { found: string[]; missing: string[] } {\n const text = norm(answer)\n const textDigits = digits(answer)\n const found: string[] = []\n const missing: string[] = []\n for (const fact of expect) {\n // \"2027-03-31|31/03/2027\": any one spelling counts.\n const hit = fact.split(\"|\").some((alt) => {\n const d = digits(alt)\n return (!!alt.trim() && text.includes(norm(alt))) || (d.length >= 5 && textDigits.includes(d))\n })\n ;(hit ? found : missing).push(fact)\n }\n return { found, missing }\n}\n\nexport function buildReport(\n meta: { questions: string; agent: string; shared: boolean; at?: string; settings?: ScoreSettings },\n answers: Array<{ q: ScoreQuestion; answer: string; status: string; citations: string[]; method?: string; ms?: number; costUsd?: number }>,\n): ScoreReport {\n const results = answers.map(({ q, answer, status, citations, method, ms, costUsd }) => {\n const { found, missing } = matchFacts(answer, q.expect)\n return {\n id: q.id, question: q.question, expect: q.expect, found, missing, score: found.length / q.expect.length, status, answer, citations,\n ...(method ? { method } : {}), ...(ms !== undefined ? { ms } : {}), ...(costUsd !== undefined ? { costUsd } : {}),\n }\n })\n const score = results.length ? results.reduce((s, r) => s + r.score, 0) / results.length : 0\n return {\n at: meta.at ?? new Date().toISOString(),\n questions: meta.questions, agent: meta.agent, shared: meta.shared,\n ...(meta.settings ? { settings: meta.settings } : {}),\n score, full: results.filter((r) => r.missing.length === 0).length, results,\n }\n}\n\nexport interface ScoreDelta {\n id: string\n question: string\n before: number\n after: number\n /** Facts the later run found that the earlier one missed. */\n gained: string[]\n lost: string[]\n /** Wall time and spend of the question in each run, when recorded. */\n ms?: { before?: number; after?: number }\n costUsd?: { before?: number; after?: number }\n}\n\n/** Mean time and spend per question of one report, over the questions\n * that recorded them. Unset when none did. */\nexport interface RunCost {\n meanMs?: number\n meanCostUsd?: number\n /** Questions with no recorded spend: the mean leaves them out. */\n unpriced: number\n}\n\nexport function runCost(report: ScoreReport): RunCost {\n const mean = (xs: number[]) => (xs.length ? xs.reduce((a, b) => a + b, 0) / xs.length : undefined)\n const ms = report.results.flatMap((r) => (r.ms === undefined ? [] : [r.ms]))\n const usd = report.results.flatMap((r) => (r.costUsd === undefined ? [] : [r.costUsd]))\n return { meanMs: mean(ms), meanCostUsd: mean(usd), unpriced: report.results.length - usd.length }\n}\n\nexport interface ReportComparison {\n before: number\n after: number\n deltas: ScoreDelta[]\n /** Settings that differ, as \"key: before → after\". Unknown when either\n * report predates recorded settings. A fair test changes one. */\n changed: string[] | \"unknown\"\n /** Question ids only one of the two reports holds. */\n onlyBefore: string[]\n onlyAfter: string[]\n cost: { before: RunCost; after: RunCost }\n}\n\n/** Per-question change between two reports on the same set. */\nexport function compareReports(before: ScoreReport, after: ScoreReport): ReportComparison {\n const prior = new Map(before.results.map((r) => [r.id, r]))\n const deltas = after.results.map((r) => {\n const b = prior.get(r.id)\n return {\n id: r.id, question: r.question,\n before: b?.score ?? 0, after: r.score,\n gained: r.found.filter((f) => !b?.found.includes(f)),\n lost: (b?.found ?? []).filter((f) => !r.found.includes(f)),\n ...(b?.ms !== undefined || r.ms !== undefined ? { ms: { before: b?.ms, after: r.ms } } : {}),\n ...(b?.costUsd !== undefined || r.costUsd !== undefined ? { costUsd: { before: b?.costUsd, after: r.costUsd } } : {}),\n }\n })\n const afterIds = new Set(after.results.map((r) => r.id))\n return {\n before: before.score, after: after.score, deltas,\n changed: settingsChanged(before, after),\n onlyBefore: before.results.filter((r) => !afterIds.has(r.id)).map((r) => r.id),\n onlyAfter: after.results.filter((r) => !prior.has(r.id)).map((r) => r.id),\n cost: { before: runCost(before), after: runCost(after) },\n }\n}\n\nfunction settingsChanged(before: ScoreReport, after: ScoreReport): string[] | \"unknown\" {\n if (!before.settings || !after.settings) return \"unknown\"\n const a: Record<string, unknown> = { ...before.settings, agent: before.agent, shared: before.shared }\n const b: Record<string, unknown> = { ...after.settings, agent: after.agent, shared: after.shared }\n return [...new Set([...Object.keys(a), ...Object.keys(b)])]\n .filter((k) => a[k] !== b[k])\n .map((k) => `${k}: ${String(a[k])} → ${String(b[k])}`)\n}\n"],"mappings":"4BAsEO,SAASA,EAAiBC,EAA+B,CAC9D,IAAMC,EAAUD,EAAK,KAAK,EAI1B,OAHuBC,EAAQ,WAAW,GAAG,EACzC,KAAK,MAAMA,CAAO,EAClBA,EAAQ,MAAM;AAAA,CAAI,EAAE,OAAQC,GAAMA,EAAE,KAAK,CAAC,EAAE,IAAKA,GAAM,KAAK,MAAMA,CAAC,CAAC,GAC7D,IAAI,CAACC,EAAGC,IAAM,CACvB,IAAMC,EAAKF,GAAK,CAAC,EACXG,EAAW,OAAOD,EAAE,UAAa,SAAWA,EAAE,SAAS,KAAK,EA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EAA0C,CACtF,GAAI,CAACD,EAAO,UAAY,CAACC,EAAM,SAAU,MAAO,UAChD,IAAML,EAA6B,CAAE,GAAGI,EAAO,SAAU,MAAOA,EAAO,MAAO,OAAQA,EAAO,MAAO,EAC9FH,EAA6B,CAAE,GAAGI,EAAM,SAAU,MAAOA,EAAM,MAAO,OAAQA,EAAM,MAAO,EACjG,MAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,OAAO,KAAKL,CAAC,EAAG,GAAG,OAAO,KAAKC,CAAC,CAAC,CAAC,CAAC,EACvD,OAAQU,GAAMX,EAAEW,CAAC,IAAMV,EAAEU,CAAC,CAAC,EAC3B,IAAKA,GAAM,GAAGA,MAAM,OAAOX,EAAEW,CAAC,CAAC,YAAO,OAAOV,EAAEU,CAAC,CAAC,GAAG,CACzD","names":["parseQuestionSet","text","trimmed","l","x","i","r","question","expect","e","norm","s","digits","matchFacts","answer","textDigits","found","missing","fact","alt","d","buildReport","meta","answers","results","q","status","citations","method","ms","costUsd","score","runCost","report","mean","xs","a","b","usd","compareReports","before","after","prior","deltas","f","afterIds","settingsChanged","k"]}
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-KEXBEUSU.js";import"./chunk-QIJLFPWE.js";export{a as WIKI_ARTICLE_TYPES,b as isWikiArticleType};
2
+ //# sourceMappingURL=types-ARP27T6T.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-RGZARSHV.js";import"./chunk-QIJLFPWE.js";export{a as IMPORTANCE_LEVELS};
2
+ //# sourceMappingURL=types-LJZ2YY5W.js.map
@@ -1,2 +1,2 @@
1
- import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-RJOA7QBB.js";import{a}from"./chunk-DDEDSYLF.js";import"./chunk-JP5OAMWQ.js";import"./chunk-4VVHGR7H.js";import{b as c}from"./chunk-URN74FTP.js";import"./chunk-G4HDRJVN.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-7VLLZQ3N.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
2
- //# sourceMappingURL=wiki-SXWJ5NJQ.js.map
1
+ import"./chunk-VWTBHLMX.js";import{a as b}from"./chunk-6WF56ME6.js";import{a}from"./chunk-NY7NHGVT.js";import"./chunk-KEXBEUSU.js";import"./chunk-RGZARSHV.js";import{b as c}from"./chunk-WWDYDLY2.js";import"./chunk-YA3P77LV.js";import"./chunk-ERULJ2ZL.js";import"./chunk-WPNRDEHW.js";import"./chunk-JRS5QRZG.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-4XMALK7X.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-6TURWSMN.js";import"./chunk-QD6IICK7.js";import"./chunk-QOYAX2FT.js";import"./chunk-2PJKGZWP.js";import"./chunk-7I7IEX4S.js";import"./chunk-DYGQF3MI.js";import"./chunk-BRK6M6LA.js";import"./chunk-UIBUZ2N3.js";import"./chunk-2QNT5JDS.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
2
+ //# sourceMappingURL=wiki-GCRRINW3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-MI7WOGH6.js";import"./chunk-QIJLFPWE.js";export{a as claudeCall,b as registerWikiEnrich};
2
+ //# sourceMappingURL=wiki-enrich-P5TNWACZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentix-cli",
3
- "version": "0.134.0",
3
+ "version": "0.135.0",
4
4
  "description": "AI operations layer for small and medium businesses. Routes Telegram, WhatsApp, GitLab, GitHub, crons, webhooks, and mesh tasks to AI agents. Web wizard for operators, CLI for engineers. Self-hosted.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -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 if (over.agent_names !== undefined) {\n if (Array.isArray(over.agent_names)) out.agent_names = over.agent_names.filter((n): n is string => typeof n === \"string\" && !!n.trim())\n else errors.push(\"agent_names must be a list\")\n }\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\", \"works_on\", \"related\"], types: [\"person\", \"organization\", \"project\"], show: 5, group_by: \"role\" },\n // Agents are not a person's belongings or relations (#819).\n { panel: \"belongings\", title: \"Belongings\", from: [\"owns\", \"uses\", \"related\"], types: ASSET_TYPES.filter(t => t !== \"agent\"), 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\", \"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\"], domain: [\"person\"] },\n { id: \"member_of\", label: \"member of\", inverse: \"members\", wikidata: \"P463\", range: [\"organization\"], domain: [\"person\", \"organization\"] },\n { id: \"founded\", label: \"founded\", inverse: \"founded by\", wikidata: \"P112\", domain: [\"person\", \"organization\"] },\n { id: \"works_with\", label: \"works with\", inverse: \"works with\", domain: [\"person\", \"organization\"] },\n { id: \"reports_to\", label: \"reports to\", inverse: \"manages\", domain: [\"person\"] },\n { id: \"client_of\", label: \"client of\", inverse: \"clients\", wikidata: \"P1972\", domain: [\"person\", \"organization\"] },\n { id: \"client\", label: \"is for client\", inverse: \"projects\", range: [\"organization\", \"person\"], domain: [\"project\", \"offering\", \"contract\"] },\n { id: \"works_on\", label: \"works on\", inverse: \"people\", range: [\"project\"], domain: [\"person\", \"organization\", \"agent\"] },\n { id: \"works_for\", label: \"works for\", inverse: \"agents\", wikidata: \"P108\", domain: [\"agent\", \"person\"] },\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,IAAK,EAAG,KAAM,EAAG,CAC7E,GACMC,EAAuB,CAAE,MAAO,YAAa,MAAO,YAAa,OAAQ,YAAa,KAAM,EAAG,OAAQ,OAAQ,EAC/GC,EAAQ,CAACF,EAAO,KAAkB,CAAE,MAAO,QAAS,MAAO,QAAS,OAAQ,QAAS,KAAAA,CAAK,GAE1FG,EAAc,CAAC,SAAU,SAAU,MAAO,SAAU,UAAW,OAAO,EAEtEC,EAAmB,CAEvB,CACE,GAAI,SAAU,MAAO,SAAU,OAAQ,SAAU,OAAQ,UAAW,OAAQ,SAAU,KAAM,SAC5F,KAAM,CACJ,CA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SAASD,CAAE,GAAG9B,EAAO,KAAK,QAAQyB,EAAE,aAAaF,EAAE,8BAA8BO,IAAK,GAGtJ,QAAWE,KAAKX,EAAE,SAEhB,GADKG,EAAM,IAAIQ,EAAE,IAAI,GAAGhC,EAAO,KAAK,2BAA2BgC,EAAE,OAAO,EACpEA,EAAE,MACJ,GAAI,CAAE,IAAI,OAAOA,EAAE,MAAO,GAAG,CAAE,MAAE,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","t","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,2 +0,0 @@
1
- import{g as p}from"./chunk-6TURWSMN.js";import{spawn as m}from"child_process";var w=async(n,s,e)=>{let d=["-p","-","--output-format","json","--max-turns","1","--model",s,"--tools","","--strict-mcp-config","--mcp-config",'{"mcpServers":{}}',"--settings",'{"disableAllHooks":true}',"--setting-sources","","--no-session-persistence"],i=await new Promise((r,l)=>{let o=m("claude",d,{env:p(),stdio:["pipe","pipe","pipe"]}),c="",a="",u=setTimeout(()=>o.kill("SIGTERM"),e);o.stdout.on("data",t=>{c+=t}),o.stderr.on("data",t=>{a+=t}),o.on("error",t=>{clearTimeout(u),l(t)}),o.on("close",t=>{clearTimeout(u),t===0?r(c):l(new Error(`claude exited ${t}: ${a.trim().slice(0,200)}`))}),o.stdin.end(n)});try{let r=JSON.parse(i);if(r.is_error)throw new Error(`model error: ${String(r.result).slice(0,200)}`);return String(r.result??"")}catch(r){if(r instanceof SyntaxError)return i;throw r}};function y(n){let s=n.match(/\{[\s\S]*\}/);if(!s)return null;try{let e=JSON.parse(s[0]);return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}}export{w as a,y as b};
2
- //# sourceMappingURL=chunk-7VLLZQ3N.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/wiki/model-call.ts"],"sourcesContent":["import { spawn } from \"child_process\"\nimport { claudeCliEnv } from \"@/utils/workspace-env\"\n\n/** One model call: prompt in, text out. Tests pass their own. */\nexport type ModelCall = (prompt: string, model: string, timeoutMs: number) => Promise<string>\n\n/**\n * One `claude -p` call with no tools. The prompt carries wiki text and\n * lines read from outside systems, so no built-in tool, MCP server, hook\n * or settings file is loaded: an instruction hidden in that text has\n * nothing to run, write or send with. No shell either: the prompt goes\n * in on stdin.\n */\nexport const claudeModelCall: ModelCall = async (prompt, model, timeoutMs) => {\n const args = [\"-p\", \"-\", \"--output-format\", \"json\", \"--max-turns\", \"1\", \"--model\", model,\n \"--tools\", \"\", \"--strict-mcp-config\", \"--mcp-config\", '{\"mcpServers\":{}}',\n \"--settings\", '{\"disableAllHooks\":true}', \"--setting-sources\", \"\", \"--no-session-persistence\"]\n const out = await new Promise<string>((ok, fail) => {\n const child = spawn(\"claude\", args, { env: claudeCliEnv(), stdio: [\"pipe\", \"pipe\", \"pipe\"] })\n let stdout = \"\"\n let stderr = \"\"\n const timer = setTimeout(() => child.kill(\"SIGTERM\"), timeoutMs)\n child.stdout.on(\"data\", (d) => { stdout += d })\n child.stderr.on(\"data\", (d) => { stderr += d })\n child.on(\"error\", (err) => { clearTimeout(timer); fail(err) })\n child.on(\"close\", (code) => {\n clearTimeout(timer)\n if (code === 0) ok(stdout)\n else fail(new Error(`claude exited ${code}: ${stderr.trim().slice(0, 200)}`))\n })\n child.stdin.end(prompt)\n })\n try {\n const envelope = JSON.parse(out) as { result?: string; is_error?: boolean }\n if (envelope.is_error) throw new Error(`model error: ${String(envelope.result).slice(0, 200)}`)\n return String(envelope.result ?? \"\")\n } catch (err) {\n if (err instanceof SyntaxError) return out\n throw err\n }\n}\n\n/** The first JSON object in a model reply, or null. */\nexport function firstJsonObject(reply: string): Record<string, unknown> | null {\n const m = reply.match(/\\{[\\s\\S]*\\}/)\n if (!m) return null\n try {\n const parsed = JSON.parse(m[0])\n return parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? parsed as Record<string, unknown> : null\n } catch {\n return null\n }\n}\n"],"mappings":"wCAAA,OAAS,SAAAA,MAAa,gBAaf,IAAMC,EAA6B,MAAOC,EAAQC,EAAOC,IAAc,CAC5E,IAAMC,EAAO,CAAC,KAAM,IAAK,kBAAmB,OAAQ,cAAe,IAAK,UAAWF,EACjF,UAAW,GAAI,sBAAuB,eAAgB,oBACtD,aAAc,2BAA4B,oBAAqB,GAAI,0BAA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F","names":["spawn","claudeModelCall","prompt","model","timeoutMs","args","out","ok","fail","child","spawn","claudeCliEnv","stdout","stderr","timer","d","err","code","envelope","firstJsonObject","reply","m","parsed"]}
@@ -1,105 +0,0 @@
1
- import{a as O}from"./chunk-JP5OAMWQ.js";import{b as L}from"./chunk-4VVHGR7H.js";import{a as I,b as E,c as R,d as j,e as M,j as T}from"./chunk-ERULJ2ZL.js";import{y as C,z as N}from"./chunk-4XMALK7X.js";import{c as x,d as _}from"./chunk-QOYAX2FT.js";import{readFileSync as W,writeFileSync as k,appendFileSync as B,existsSync as w,mkdirSync as S,readdirSync as D,statSync as U}from"fs";import{resolve as u,join as J,relative as y,dirname as K}from"path";N();function V(v){return O.includes(v)}function F(v){if(!v)return;let t;try{t=JSON.parse(v)}catch{return}if(!Array.isArray(t))return;let e=t.filter(r=>typeof r=="object"&&r!==null&&typeof r.property=="string"&&r.property!==""&&typeof r.value=="string"&&r.value!=="");return e.length?e:void 0}function Y(v,t){let e=n=>{let i=/^(.*Z)(?:-(\d+))?\.md$/.exec(n);return i?[i[1],i[2]?Number(i[2]):0]:[n,0]},[r,a]=e(v),[o,s]=e(t);return r<o?-1:r>o?1:a-s}var P=class{baseDir;rawDir;log;constructor(t=u(process.cwd(),".agentx/wiki"),e=console.error.bind(console,"[wiki]")){this.baseDir=t,this.rawDir=u(t,"raw/entries"),this.log=e,S(this.rawDir,{recursive:!0}),S(u(t,"raw"),{recursive:!0}),this.ensureSchema()}canRead(t,e){return t.access==="public"?!0:e?!!(t.owner===e||t.access==="shared"&&t.sharedWith?.includes(e)):!1}canWrite(t,e){return t.owner===e}addEntry(t){let e=`${t.date}_${t.id}.md`,r=u(this.rawDir,e),a=["---",`id: ${t.id}`,`date: ${t.date}`,`agent: ${t.agentId}`,`source: ${t.source}`];if(t.sourceContext&&a.push(`context: ${t.sourceContext}`),t.meta)for(let[o,s]of Object.entries(t.meta))a.push(`${o}: ${JSON.stringify(s)}`);return a.push("---","",t.content),k(r,a.join(`
2
- `)),this.appendLog("ingest",`${t.id} from ${t.agentId} via ${t.source}`),e}readEntries(t){if(t.length===0||!w(this.rawDir))return[];let e=new Set(t),r=[];for(let a of D(this.rawDir)){let o=a.replace(/\.md$/,"").replace(/^\d{4}-\d{2}-\d{2}_/,"");if(!e.has(o))continue;let s=this.parseEntry(W(u(this.rawDir,a),"utf-8"),a);s&&r.push(s)}return r}listEntries(t){if(!w(this.rawDir))return[];let e=D(this.rawDir).filter(a=>a.endsWith(".md")).sort(),r=[];for(let a of e){let o=W(u(this.rawDir,a),"utf-8"),s=this.parseEntry(o,a);s&&(t?.agentId&&s.agentId!==t.agentId||t?.after&&s.date<t.after||t?.before&&s.date>t.before||r.push(s))}return r}parseEntry(t,e){let r=t.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!r)return null;let a=r[1],o=r[2].trim(),s=c=>a.match(new RegExp(`^${c}:\\s*(.+)$`,"m"))?.[1]?.trim()||"",n=new Set(["id","date","agent","source","context"]),i={};for(let c of a.split(`
3
- `)){let l=c.match(/^(\w+):\s*(.+)$/);if(!(!l||n.has(l[1])))try{i[l[1]]=JSON.parse(l[2])}catch{i[l[1]]=l[2].trim()}}return{id:s("id")||e.replace(".md",""),date:s("date"),agentId:s("agent"),source:s("source"),sourceContext:s("context")||void 0,content:o,meta:Object.keys(i).length>0?i:void 0}}writeArticle(t,e,r,a){let o=this.readArticle(t);if(o&&!this.canWrite(o.meta,a))return this.log(`Permission denied: "${a}" cannot write "${t}" (owner: ${o.meta.owner})`),!1;e.type&&!L(e.type)&&(this.log(`Dropping invalid article type "${e.type}" for "${t}" \u2014 enum is [person, project, place, concept, event, decision, pattern]`),e={...e,type:void 0});let s=u(this.baseDir,t);o&&this.saveVersion(t,s),S(K(s),{recursive:!0});let n=["---",`title: "${e.title}"`];e.type&&n.push(`type: ${e.type}`),e.related?.length&&n.push(`related: [${e.related.map(c=>`"${c}"`).join(", ")}]`),n.push(`tags: [${(e.tags||[]).map(c=>`"${c}"`).join(", ")}]`,`owner: ${e.owner}`,`access: ${e.access}`),e.sharedWith?.length&&n.push(`shared_with: [${e.sharedWith.map(c=>`"${c}"`).join(", ")}]`),n.push(`created: ${e.created}`,`last_updated: ${e.lastUpdated}`,`sources: [${e.sources.map(c=>`"${c}"`).join(", ")}]`),e.graphPath?.length&&n.push(`graph_path: [${e.graphPath.map(c=>`"${c}"`).join(", ")}]`),e.class&&n.push(`class: ${e.class}`),e.importance&&n.push(`importance: ${e.importance}`),e.date&&n.push(`date: ${e.date}`),e.rolledUpInto&&n.push(`rolled_up_into: ${JSON.stringify(e.rolledUpInto)}`),e.aliases?.length&&n.push(`aliases: ${JSON.stringify(e.aliases)}`),e.statements?.length&&n.push(`statements: ${JSON.stringify(e.statements)}`),n.push("---","",r),k(s,n.join(`
4
- `));let i=o?"update":"create";return this.appendLog(i,`${e.title} [${(e.tags||[]).slice(0,5).join(", ")}] by ${a} at ${t}`),!0}saveVersion(t,e){try{if(!w(e))return;let r=W(e,"utf-8"),a=new Date().toISOString().replace(/[:.]/g,"-"),o=u(this.baseDir,"_versions",t.replace(/\.md$/,""));S(o,{recursive:!0});for(let s=0;;s++)try{k(u(o,`${s?`${a}-${s}`:a}.md`),r,{flag:"wx"});return}catch(n){if(n.code!=="EEXIST")throw n}}catch{}}getVersions(t){let e=u(this.baseDir,"_versions",t.replace(/\.md$/,""));if(!w(e))return[];try{return D(e).filter(r=>r.endsWith(".md")).sort(Y).reverse().map(r=>({timestamp:r.replace(/\.md$/,"").replace(/-/g,(a,o)=>o<19?o===10?"T":o===13||o===16?":":"-":a),path:u(e,r)}))}catch{return[]}}restoreVersion(t,e){let r=this.getVersions(t),a=r.find(o=>o.timestamp===e)??r.find(o=>o.timestamp.startsWith(e));if(!a)return!1;try{let o=W(a.path,"utf-8"),s=u(this.baseDir,t);return this.saveVersion(t,s),k(s,o),this.appendLog("restore",`${t} restored to ${e}`),!0}catch{return!1}}readArticle(t){let e=u(this.baseDir,t);if(!w(e))return null;let r=W(e,"utf-8");return this.parseArticle(r,t)}readArticleAs(t,e){let r=this.readArticle(t);return!r||!this.canRead(r.meta,e)?null:r}parseArticle(t,e){let r=t.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!r)return null;let a=r[1],o=r[2].trim(),s=f=>a.match(new RegExp(`^${f}:\\s*(.+)$`,"m"))?.[1]?.trim().replace(/^"(.*)"$/,"$1")||"",n=f=>{let $=a.match(new RegExp(`^${f}:\\s*\\[(.*)\\]$`,"m"));return $?[...$[1].matchAll(/\s*(?:"(.*?)"(?=\s*(?:,|$))|([^,]+))/g)].map(A=>(A[1]??A[2]).trim()).filter(Boolean):[]},i=s("type")||s("kind"),l=new Set(["person","project","place","concept","event","decision","pattern"]).has(i)?i:void 0,g=n("tags").filter((f,$,A)=>f&&A.indexOf(f)===$),d=n("related"),p=n("graph_path"),m=n("aliases"),h=s("importance"),b=s("date");return{meta:{title:s("title"),type:l,related:d.length?d:void 0,tags:g,owner:s("owner"),access:s("access")||"public",sharedWith:n("shared_with"),created:s("created"),lastUpdated:s("last_updated"),sources:n("sources"),graphPath:p.length?p:void 0,class:/^[a-z][a-z0-9_]*$/.test(s("class"))?s("class"):void 0,importance:V(h)?h:void 0,date:/^\d{4}-\d{2}-\d{2}/.test(b)?b.slice(0,10):void 0,rolledUpInto:s("rolled_up_into")||void 0,aliases:m.length?m:void 0,statements:F(s("statements"))},content:o,path:e}}listCache=new Map;listArticles(t){return this.listCached(t)}listAllArticles(){return this.listCached(null)}listCached(t){let e=[],r=[];this.walkDir(this.baseDir,(i,c)=>{if(!i.endsWith(".md"))return;let l=y(this.baseDir,i);l.startsWith("raw/")||l.startsWith("_")||(e.push(l),r.push(`${l}:${c?.mtimeMs??"?"}:${c?.size??"?"}`))});let a=r.join("|"),o=t??"\0all",s=this.listCache.get(o);if(s&&s.signature===a)return s.articles.slice();let n=[];for(let i of e){let c=this.readArticle(i);c&&(t===null||this.canRead(c.meta,t))&&n.push(c)}return this.listCache.set(o,{signature:a,articles:n}),n.slice()}search(t,e,r=10){let a=t.toLowerCase(),o=[];if(this.walkDir(this.baseDir,d=>{if(!d.endsWith(".md"))return;let p=y(this.baseDir,d);if(p.startsWith("raw/")||p.startsWith("_"))return;let m=this.readArticle(p);!m||!this.canRead(m.meta,e)||o.push(m)}),o.length===0)return[];let s=o.map(d=>d.content),n=u(this.baseDir,"_bm25_cache.json"),i=_(s,n),c=x(t,i),l=new Map(c.map(d=>[d.docIndex,d.score]));return o.map((d,p)=>{let m=l.get(p)??0;return d.meta.title.toLowerCase().includes(a)&&(m+=10),d.meta.tags?.some(h=>h.toLowerCase().includes(a))&&(m+=5),{article:d,score:m}}).filter(d=>d.score>0).sort((d,p)=>p.score-d.score).slice(0,r).map(d=>d.article)}async findRelevantReranked(t,e,r=10,a={}){let o=Math.max(r,a.shortlist??E),s=this.findRelevant(t,e,o);if(s.length<2)return s.slice(0,r);let n=s.map((l,g)=>({id:`c${g}`,title:l.meta.title||`(untitled ${g})`,tags:l.meta.tags,excerpt:l.content})),i=await C(I,R({query:t,candidates:n,excerptChars:a.excerptChars}),j(n),{incumbent:{best:n[0].id},features:{agent:e??"unknown"}});return!i||i.mode!=="active"?s.slice(0,r):M(i.answers,n).ranked.map(l=>s[Number(l.slice(1))]).filter(l=>!!l).slice(0,r)}findRelevant(t,e,r=3,a,o={graph:.6,bm25:.4}){let s=[];if(this.walkDir(this.baseDir,h=>{if(!h.endsWith(".md"))return;let b=y(this.baseDir,h);if(b.startsWith("raw/")||b.startsWith("_"))return;let f=this.readArticle(b);!f||!this.canRead(f.meta,e)||s.push(f)}),s.length===0)return[];let n=s.map(h=>`${h.meta.title} ${(h.meta.tags||[]).join(" ")} ${h.content}`),i=u(this.baseDir,"_bm25_relevance_cache.json"),c=_(n,i),l=x(t,c),g=l.reduce((h,b)=>Math.max(h,b.score),0)||1,d=new Map(l.map(h=>[h.docIndex,h.score/g])),p=!!(a&&a.length>0);return s.map((h,b)=>{let f=d.get(b)??0,$=0;p&&h.meta.graphPath?.length&&($=T(a,h.meta.graphPath));let A=p?o.graph*$+o.bm25*f:f;return{article:h,score:A}}).filter(h=>h.score>0).sort((h,b)=>b.score-h.score).slice(0,r).map(h=>h.article)}buildContext(t,e=4e3){if(t.length===0)return"";let r=["[Wiki Knowledge]"],a=0;for(let o of t){let s=`
5
- ## ${o.meta.title} [${(o.meta.tags||[]).slice(0,3).join(", ")}]`,n=o.content.length>600?o.content.slice(0,600)+"...":o.content,i=s+`
6
- `+n;if(a+i.length>e)break;r.push(i),a+=i.length}return r.push(`
7
- [End Wiki Knowledge]`),r.join(`
8
- `)}rebuildIndex(){let t=[],e=new Map;this.walkDir(this.baseDir,s=>{if(!s.endsWith(".md"))return;let n=y(this.baseDir,s);if(n.startsWith("raw/")||n.startsWith("_"))return;let i=this.readArticle(n);if(!i)return;let c=i.content.match(/\[\[([^\]]+)\]\]/g)||[];for(let g of c){let d=g.replace(/\[\[|\]\]/g,"");e.set(d,(e.get(d)||0)+1)}let l=[i.meta.title.toLowerCase()];i.meta.tags&&l.push(...i.meta.tags.map(g=>g.toLowerCase())),t.push({path:n,title:i.meta.title,type:i.meta.type,related:i.meta.related,tags:i.meta.tags||[],owner:i.meta.owner,access:i.meta.access,sharedWith:i.meta.sharedWith,aliases:l,backlinks:e.get(i.meta.title)||0,sources:i.meta.sources,lastUpdated:i.meta.lastUpdated,graphPath:i.meta.graphPath})});let r={articles:t,lastRebuilt:new Date().toISOString()};k(u(this.baseDir,"_index.json"),JSON.stringify(r,null,2)),this.writeCatalog(t,r.lastRebuilt);let a=["# Wiki Index","",`Last rebuilt: ${r.lastRebuilt}`,""],o=new Map;for(let s of t){let n=s.access||"public",i=o.get(n)||[];i.push(s),o.set(n,i)}for(let[s,n]of Array.from(o.entries()).sort()){a.push(`## ${s}`,"");for(let i of n.sort((c,l)=>c.title.localeCompare(l.title))){let c=i.type?` [${i.type}]`:"";a.push(`- [${i.title}](${i.path})${c} \u2014 owner: ${i.owner}`)}a.push("")}return k(u(this.baseDir,"WIKI.md"),a.join(`
9
- `)),this.log(`Index rebuilt: ${t.length} articles`),this.appendLog("rebuild-index",`${t.length} articles indexed`),r}writeCatalog(t,e){let r=["person","project","place","concept","event","decision","pattern","untyped"],a={person:"## People",project:"## Projects",place:"## Places",concept:"## Concepts",event:"## Events",decision:"## Decisions",pattern:"## Patterns",untyped:"## Untyped (needs migration)"},o=new Map;for(let n of t){let i=n.type||"untyped",c=o.get(i)||[];c.push(n),o.set(i,c)}let s=["# Wiki Content Catalog","",`_Last rebuilt: ${e}_`,"","Articles grouped by type. Agentic query walks this file first to pick candidates.",""];for(let n of r){let i=o.get(n);if(!(!i||i.length===0)){s.push(a[n]||`## ${n}`,"");for(let c of i.sort((l,g)=>l.title.localeCompare(g.title))){let l=c.access==="private"?" (private)":c.access==="shared"?" (shared)":"",g=c.related?.length?` \u2192 [[${c.related.slice(0,3).join("]], [[")}]]${c.related.length>3?", \u2026":""}`:"";s.push(`- [${c.title}](${c.path})${l}${g}`)}s.push("")}}k(u(this.baseDir,"_index.md"),s.join(`
10
- `))}stats(){let t=0,e={},r={},a={};this.walkDir(this.baseDir,s=>{if(!s.endsWith(".md"))return;let n=y(this.baseDir,s);if(n.startsWith("raw/")||n.startsWith("_")||n==="WIKI.md")return;let i=this.readArticle(n);if(i){t++;for(let c of i.meta.tags||[])e[c]=(e[c]||0)+1;r[i.meta.access]=(r[i.meta.access]||0)+1,a[i.meta.owner]=(a[i.meta.owner]||0)+1}});let o=w(this.rawDir)?D(this.rawDir).filter(s=>s.endsWith(".md")).length:0;return{totalArticles:t,totalEntries:o,articlesByType:e,articlesByAccess:r,articlesByOwner:a}}appendLog(t,e){let r=u(this.baseDir,"log.md"),o=`## [${new Date().toISOString().replace("T"," ").slice(0,16)}] ${t} | ${e}
11
-
12
- `;w(r)||k(r,`# Wiki Log
13
-
14
- Chronological record of all wiki operations.
15
-
16
- `),B(r,o)}getLog(t=20){let e=u(this.baseDir,"log.md");return w(e)?W(e,"utf-8").split(/^## /m).filter(o=>o.startsWith("[")).slice(-t).map(o=>o.trim()):[]}ensureSchema(){let t=u(this.baseDir,"_schema.md");if(w(t))return;k(t,`# Wiki Schema
17
-
18
- A personal wiki maintained by LLMs. Karpathy pattern: plain files, aggressive tagging,
19
- structure emerges from data. The wiki is a compounding artifact.
20
-
21
- ## Structure
22
-
23
- \`\`\`
24
- wiki/
25
- _schema.md # This file
26
- worldview.md # YOUR mental model \u2014 the LLM reads this during absorb
27
- raw/entries/ # Immutable raw sources (conversations, imports, anything)
28
- [LLM-chosen dirs] # Structure emerges from data \u2014 the LLM picks paths
29
- \`\`\`
30
-
31
- The LLM decides how to organize articles. You describe YOUR world in worldview.md.
32
-
33
- ## Article Format
34
-
35
- \`\`\`yaml
36
- ---
37
- title: "Staging Deployment Process"
38
- tags: ["deploy", "staging", "devops", "process", "2026-04-06"]
39
- owner: devops-agent
40
- access: public
41
- created: 2026-04-06
42
- last_updated: 2026-04-06
43
- sources: ["entry-id-1", "entry-id-2"]
44
- ---
45
-
46
- Article content with [[wikilinks]] and section tags.
47
-
48
- ## Deploy Steps
49
- <!-- tags: process, runbook, staging -->
50
- Content specific to this section...
51
- \`\`\`
52
-
53
- ## Tags
54
-
55
- Tags are the primary context-narrowing mechanism. The more tags, the better.
56
-
57
- Tag aggressively:
58
- - **Who**: people, agents, teams involved
59
- - **What**: project, client, topic, technology
60
- - **When**: dates, periods, milestones
61
- - **Where**: server, environment, channel
62
- - **How**: process, decision, pattern
63
- - **Your terms**: whatever vocabulary makes sense in YOUR world
64
-
65
- Section tags (\`<!-- tags: ... -->\`) let different parts of an article
66
- match different queries. A deploy article might have sections tagged
67
- "runbook" and "incident" separately.
68
-
69
- ## Operations
70
-
71
- ### Absorb
72
- Read raw entries \u2192 read worldview.md \u2192 tag aggressively \u2192 create/update articles.
73
- Also identify GAPS: "We mention X but have no article for it."
74
-
75
- ### Query
76
- Match by tags first \u2192 then keyword within matched articles \u2192 synthesize.
77
- If agent is working on a specific project, only send content tagged for that project.
78
-
79
- ### Lint
80
- Check for: orphan articles, broken [[wikilinks]], untagged articles,
81
- articles over 100 lines that should split, mentioned-but-missing topics.
82
-
83
- ## Worldview
84
-
85
- Edit \`worldview.md\` to describe YOUR world. This is not a schema \u2014 it's your
86
- mental model. The LLM reads it during absorb to understand where things go.
87
-
88
- Example worldview.md:
89
- \`\`\`
90
- I'm the founder of Acme Corp.
91
- We build software products.
92
- Our agents: Marketing Bot, DevOps Bot, Coordinator.
93
- Clients: ClientA (enterprise), ClientB (startup).
94
- Infrastructure: local dev machine, cloud server.
95
- We use GitLab for version control.
96
- \`\`\`
97
- `),this.log("Created _schema.md")}extractWikilinks(t){return(t.match(/\[\[([^\]]+)\]\]/g)||[]).map(r=>r.replace(/\[\[|\]\]/g,""))}buildBacklinks(){let t={};return this.walkDir(this.baseDir,e=>{if(!e.endsWith(".md"))return;let r=y(this.baseDir,e);if(r.startsWith("raw/")||r.startsWith("_")||r==="WIKI.md"||r==="log.md")return;let a=W(e,"utf-8"),o=this.extractWikilinks(a);for(let s of o)t[s]||(t[s]=[]),t[s].push(r)}),k(u(this.baseDir,"_backlinks.json"),JSON.stringify(t,null,2)),t}getBacklinks(t){let e=u(this.baseDir,"_backlinks.json");if(!w(e))return[];try{return JSON.parse(W(e,"utf-8"))[t]||[]}catch{return[]}}findByTags(t,e,r=10){let a=t.map(s=>s.toLowerCase()),o=[];return this.walkDir(this.baseDir,s=>{if(!s.endsWith(".md"))return;let n=y(this.baseDir,s);if(n.startsWith("raw/")||n.startsWith("_"))return;let i=this.readArticle(n);if(!i||e&&!this.canRead(i.meta,e))return;let c=(i.meta.tags||[]).map(p=>p.toLowerCase()),l=(i.content.match(/<!--\s*tags?:\s*([^>]+)\s*-->/gi)||[]).flatMap(p=>p.replace(/<!--\s*tags?:\s*|\s*-->/gi,"").split(",").map(m=>m.trim().toLowerCase())),g=[...c,...l],d=a.filter(p=>g.includes(p)).length;d>0&&o.push({article:i,score:d})}),o.sort((s,n)=>n.score-s.score).slice(0,r).map(s=>s.article)}getAllTags(){let t=new Map;return this.walkDir(this.baseDir,e=>{if(!e.endsWith(".md"))return;let r=y(this.baseDir,e);if(r.startsWith("raw/")||r.startsWith("_"))return;let a=this.readArticle(r);if(a?.meta.tags)for(let o of a.meta.tags)t.set(o,(t.get(o)||0)+1)}),t}getWorldview(){let t=u(this.baseDir,"worldview.md");return w(t)?W(t,"utf-8"):null}setWorldview(t){k(u(this.baseDir,"worldview.md"),t),this.appendLog("worldview","Updated worldview")}lint(){let t=[],e=new Set,r=new Map,a=new Map;this.walkDir(this.baseDir,s=>{if(!s.endsWith(".md"))return;let n=y(this.baseDir,s);if(n.startsWith("raw/")||n.startsWith("_")||n==="WIKI.md"||n==="log.md")return;let i=this.readArticle(n);if(!i)return;e.add(i.meta.title),a.set(i.meta.title,n);let c=this.extractWikilinks(i.content);r.set(n,c);let l=i.content.split(`
98
- `).length;l>100&&t.push({type:"bloated",article:n,message:`${l} lines \u2014 consider splitting`}),i.meta.sources?.length||t.push({type:"unsourced",article:n,message:"No sources listed in frontmatter"}),l<10&&i.content.trim().length<100&&t.push({type:"stub",article:n,message:"Very short article \u2014 needs enrichment"})});for(let[s,n]of r)for(let i of n)e.has(i)||t.push({type:"broken-link",article:s,message:`[[${i}]] \u2014 target article not found`});let o=this.buildBacklinks();for(let[s,n]of a)(!o[s]||o[s].length===0)&&t.push({type:"orphan",article:n,message:`No other articles link to "${s}"`});return this.appendLog("lint",`Found ${t.length} issues`),t}getUnabsorbedEntries(){let t=new Set;return this.walkDir(this.baseDir,r=>{if(!r.endsWith(".md"))return;let a=y(this.baseDir,r);if(a.startsWith("raw/")||a.startsWith("_"))return;let o=this.readArticle(a);if(o?.meta.sources)for(let s of o.meta.sources)t.add(s)}),this.listEntries().filter(r=>!t.has(r.id))}buildAbsorbPrompt(t=20){let e=this.getUnabsorbedEntries().slice(0,t);if(e.length===0)return null;let r=e.map(a=>`[${a.date} ${a.agentId} via ${a.source}] ${a.content.slice(0,200)}`).join(`
99
-
100
- `);return`/wiki absorb
101
-
102
- There are ${e.length} unprocessed entries. Read each, understand what it means, and create or update wiki articles.
103
-
104
- ${r}`}walkDir(t,e){if(w(t))for(let r of D(t)){let a=J(t,r),o=U(a);o.isDirectory()?this.walkDir(a,e):e(a,o)}}};export{P as a};
105
- //# sourceMappingURL=chunk-DDEDSYLF.js.map