agentix-cli 0.134.0 → 0.135.1

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 (116) hide show
  1. package/dist/{absorb-eval-WU7JR3BT.js → absorb-eval-YT5TOTC7.js} +2 -2
  2. package/dist/{agent-2GPJGHHG.js → agent-DRUIMWF5.js} +2 -2
  3. package/dist/{board-dashboard-PUQPL4AX.js → board-dashboard-2524GN5N.js} +2 -2
  4. package/dist/chunk-32LIPTHM.js +55 -0
  5. package/dist/chunk-32LIPTHM.js.map +1 -0
  6. package/dist/{chunk-AHO4CQRK.js → chunk-3D5XUOBL.js} +2 -2
  7. package/dist/{chunk-MM3F74K4.js → chunk-3F4GPRGQ.js} +3 -3
  8. package/dist/chunk-3F4GPRGQ.js.map +1 -0
  9. package/dist/{chunk-MCBTVNPX.js → chunk-H4NSB54D.js} +2 -2
  10. package/dist/{chunk-4VVHGR7H.js → chunk-KEXBEUSU.js} +1 -1
  11. package/dist/{chunk-4VVHGR7H.js.map → chunk-KEXBEUSU.js.map} +1 -1
  12. package/dist/chunk-MTX4UPNB.js +3 -0
  13. package/dist/chunk-MTX4UPNB.js.map +1 -0
  14. package/dist/chunk-MUVE3UAS.js +105 -0
  15. package/dist/chunk-MUVE3UAS.js.map +1 -0
  16. package/dist/chunk-MWNCS57L.js +2 -0
  17. package/dist/chunk-MWNCS57L.js.map +1 -0
  18. package/dist/{chunk-YSXE65O7.js → chunk-NG72DYJR.js} +80 -80
  19. package/dist/chunk-NG72DYJR.js.map +1 -0
  20. package/dist/chunk-QAWKN2N4.js +3 -0
  21. package/dist/chunk-QAWKN2N4.js.map +1 -0
  22. package/dist/{chunk-FEEXOWK5.js → chunk-QDWEM4DG.js} +2 -2
  23. package/dist/{chunk-NXRSIWQA.js → chunk-R6ECKZLE.js} +2 -2
  24. package/dist/chunk-R6KLH34H.js +4 -0
  25. package/dist/chunk-R6KLH34H.js.map +1 -0
  26. package/dist/{chunk-JP5OAMWQ.js → chunk-ROLSSYXE.js} +1 -1
  27. package/dist/{chunk-JP5OAMWQ.js.map → chunk-ROLSSYXE.js.map} +1 -1
  28. package/dist/{chunk-G4HDRJVN.js → chunk-SKSYII3K.js} +2 -2
  29. package/dist/{chunk-RJOA7QBB.js → chunk-SN7YH4E4.js} +2 -2
  30. package/dist/{chunk-TDGDH4RA.js → chunk-TTG3ZW3W.js} +2 -2
  31. package/dist/{chunk-TDGDH4RA.js.map → chunk-TTG3ZW3W.js.map} +1 -1
  32. package/dist/{chunk-XWO6ALJQ.js → chunk-UTW56K5I.js} +2 -2
  33. package/dist/{chunk-VQYVL72V.js → chunk-UXOGNBGL.js} +2 -2
  34. package/dist/chunk-WYEWNN76.js +160 -0
  35. package/dist/chunk-WYEWNN76.js.map +1 -0
  36. package/dist/{chunk-RDEFA6Y6.js → chunk-ZEAT2B5B.js} +2 -2
  37. package/dist/cli.js +1 -1
  38. package/dist/{contributions-74M6YOCZ.js → contributions-ZD6ZGTJR.js} +2 -2
  39. package/dist/enrich-EFIPWA3P.js +16 -0
  40. package/dist/{enrich-NH3WHKD6.js.map → enrich-EFIPWA3P.js.map} +1 -1
  41. package/dist/event-levels-7CY7AJLY.js +3 -0
  42. package/dist/event-levels-7CY7AJLY.js.map +1 -0
  43. package/dist/graph-ZVKV3JBD.js +2 -0
  44. package/dist/{hub-VTDFUAEH.js → hub-MVX3U6A2.js} +2 -2
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.js +1 -1
  47. package/dist/load-LQ2I2PQI.js +2 -0
  48. package/dist/model-call-J7JATTMW.js +2 -0
  49. package/dist/{program-3URNCVEZ.js → program-WOQXOAYQ.js} +254 -256
  50. package/dist/program-WOQXOAYQ.js.map +1 -0
  51. package/dist/{promote-B2BADAEP.js → promote-X2XQEEQP.js} +2 -2
  52. package/dist/push-bridge-325SXDGN.js +1 -1
  53. package/dist/query-RRHYPXOM.js +2 -0
  54. package/dist/query-runs-WYRNBLLC.js +6 -0
  55. package/dist/query-runs-WYRNBLLC.js.map +1 -0
  56. package/dist/{query-settings-VJ3POZS3.js → query-settings-WKVLQEVZ.js} +2 -2
  57. package/dist/registry-VXK36CCL.js +2 -0
  58. package/dist/roster-BZGKG2ZA.js +2 -0
  59. package/dist/score-LNJ46A67.js +3 -0
  60. package/dist/score-LNJ46A67.js.map +1 -0
  61. package/dist/types-ARP27T6T.js +2 -0
  62. package/dist/types-YZX46RES.js +2 -0
  63. package/dist/{wiki-SXWJ5NJQ.js → wiki-QZ7XNAMJ.js} +2 -2
  64. package/dist/wiki-QZ7XNAMJ.js.map +1 -0
  65. package/dist/wiki-enrich-PMG4T6PP.js +2 -0
  66. package/dist/wiki-enrich-PMG4T6PP.js.map +1 -0
  67. package/package.json +1 -1
  68. package/dist/chunk-5BI2T3WD.js +0 -3
  69. package/dist/chunk-5BI2T3WD.js.map +0 -1
  70. package/dist/chunk-7VLLZQ3N.js +0 -2
  71. package/dist/chunk-7VLLZQ3N.js.map +0 -1
  72. package/dist/chunk-DDEDSYLF.js +0 -105
  73. package/dist/chunk-DDEDSYLF.js.map +0 -1
  74. package/dist/chunk-KFIJDLQ5.js +0 -3
  75. package/dist/chunk-KFIJDLQ5.js.map +0 -1
  76. package/dist/chunk-MM3F74K4.js.map +0 -1
  77. package/dist/chunk-SFVDQNTY.js +0 -156
  78. package/dist/chunk-SFVDQNTY.js.map +0 -1
  79. package/dist/chunk-URN74FTP.js +0 -55
  80. package/dist/chunk-URN74FTP.js.map +0 -1
  81. package/dist/chunk-YSXE65O7.js.map +0 -1
  82. package/dist/enrich-NH3WHKD6.js +0 -16
  83. package/dist/graph-EXDH7EPZ.js +0 -2
  84. package/dist/load-5DNMGHFW.js +0 -2
  85. package/dist/model-call-BGTDPWZD.js +0 -2
  86. package/dist/program-3URNCVEZ.js.map +0 -1
  87. package/dist/query-2VIIGGDS.js +0 -2
  88. package/dist/registry-PRCISYBO.js +0 -2
  89. package/dist/roster-IRXP32XF.js +0 -2
  90. package/dist/score-KDNIUTNV.js +0 -3
  91. package/dist/score-KDNIUTNV.js.map +0 -1
  92. package/dist/types-ROL44T62.js +0 -2
  93. /package/dist/{absorb-eval-WU7JR3BT.js.map → absorb-eval-YT5TOTC7.js.map} +0 -0
  94. /package/dist/{agent-2GPJGHHG.js.map → agent-DRUIMWF5.js.map} +0 -0
  95. /package/dist/{board-dashboard-PUQPL4AX.js.map → board-dashboard-2524GN5N.js.map} +0 -0
  96. /package/dist/{chunk-AHO4CQRK.js.map → chunk-3D5XUOBL.js.map} +0 -0
  97. /package/dist/{chunk-MCBTVNPX.js.map → chunk-H4NSB54D.js.map} +0 -0
  98. /package/dist/{chunk-FEEXOWK5.js.map → chunk-QDWEM4DG.js.map} +0 -0
  99. /package/dist/{chunk-NXRSIWQA.js.map → chunk-R6ECKZLE.js.map} +0 -0
  100. /package/dist/{chunk-G4HDRJVN.js.map → chunk-SKSYII3K.js.map} +0 -0
  101. /package/dist/{chunk-RJOA7QBB.js.map → chunk-SN7YH4E4.js.map} +0 -0
  102. /package/dist/{chunk-XWO6ALJQ.js.map → chunk-UTW56K5I.js.map} +0 -0
  103. /package/dist/{chunk-VQYVL72V.js.map → chunk-UXOGNBGL.js.map} +0 -0
  104. /package/dist/{chunk-RDEFA6Y6.js.map → chunk-ZEAT2B5B.js.map} +0 -0
  105. /package/dist/{contributions-74M6YOCZ.js.map → contributions-ZD6ZGTJR.js.map} +0 -0
  106. /package/dist/{graph-EXDH7EPZ.js.map → graph-ZVKV3JBD.js.map} +0 -0
  107. /package/dist/{hub-VTDFUAEH.js.map → hub-MVX3U6A2.js.map} +0 -0
  108. /package/dist/{load-5DNMGHFW.js.map → load-LQ2I2PQI.js.map} +0 -0
  109. /package/dist/{model-call-BGTDPWZD.js.map → model-call-J7JATTMW.js.map} +0 -0
  110. /package/dist/{promote-B2BADAEP.js.map → promote-X2XQEEQP.js.map} +0 -0
  111. /package/dist/{query-2VIIGGDS.js.map → query-RRHYPXOM.js.map} +0 -0
  112. /package/dist/{query-settings-VJ3POZS3.js.map → query-settings-WKVLQEVZ.js.map} +0 -0
  113. /package/dist/{registry-PRCISYBO.js.map → registry-VXK36CCL.js.map} +0 -0
  114. /package/dist/{roster-IRXP32XF.js.map → roster-BZGKG2ZA.js.map} +0 -0
  115. /package/dist/{types-ROL44T62.js.map → types-ARP27T6T.js.map} +0 -0
  116. /package/dist/{wiki-SXWJ5NJQ.js.map → types-YZX46RES.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{f as h}from"./chunk-KFIJDLQ5.js";import{f as j,g}from"./chunk-5BI2T3WD.js";import{a as z}from"./chunk-IMLAPB7G.js";function E(o,t){return o.ontology.types.find(e=>e.id===t)?.lens??[{panel:"notes",source:"notes",show:1}]}function v(o,t,e){let a=o.ontology.properties.find(n=>n.id===t);return a?e?a.inverse??a.label:a.label:t.replace(/_/g," ")}function G(o,t){let e=o.until??o.date??o.since??"",a=t.until??t.date??t.since??"";return e!==a?a.localeCompare(e):o.label.localeCompare(t.label)}function R(o,t,e,a,n){let r=a?n:e.target?o.entities.get(e.target):void 0,i=[v(o,e.property,a)];return e.role&&i.unshift(e.role.length>40?`${e.role.slice(0,39)}\u2026`:e.role),{label:r?.title??e.value,entityId:r?.id,type:r?.type,chips:i,since:e.since,until:e.until,status:e.status,private:e.access==="private",statement:a?void 0:t.statements.indexOf(e),sub:e.note}}function H(o,t,e){let a=new Set(j(e)),n=e.types?new Set(e.types):null,r=[],i=new Set,s=x=>!n||!!x&&n.has(x.type);for(let x of t.statements){if(!a.has(x.property))continue;let d=x.target?o.entities.get(x.target):void 0;s(d)&&(r.push(R(o,t,x,!1)),d&&i.add(d.id))}for(let x of o.incoming.get(t.id)??[]){if(!a.has(x.property))continue;let d=o.entities.get(x.from);!d||!s(d)||(x.statement?r.push(R(o,t,x.statement,!0,d)):i.has(d.id)||r.push({label:d.title,entityId:d.id,type:d.type,chips:[v(o,"related",!0)],date:d.updated}),i.add(d.id))}if(a.has("related"))for(let x of o.outgoing.get(t.id)??[]){if(x.property!=="related"||i.has(x.to))continue;let d=o.entities.get(x.to);!d||!s(d)||(r.push({label:d.title,entityId:d.id,type:d.type,chips:[v(o,"related",!1)],date:d.updated}),i.add(d.id))}let c=r.filter(x=>!x.chips.includes(v(o,"related",!1))),p=r.filter(x=>x.chips.includes(v(o,"related",!1)));return[...c.sort(G),...p.sort(G)]}function I(o,t,e){let a=new Set;for(let r of o.outgoing.get(t.id)??[])a.add(r.to);for(let r of o.incoming.get(t.id)??[])a.add(r.from);let n=[];for(let r of a){let i=o.entities.get(r);i&&(!e||e.has(i.type))&&n.push(i)}return n.sort((r,i)=>(i.date||i.updated).localeCompare(r.date||r.updated))}function M(o){return{label:o.title,entityId:o.id,type:o.type,chips:[],date:o.date,importance:o.importance}}function T(o,t,e){let a=I(o,t,new Set(["event"])).map(M),n=new Set(e.importance??["major","normal","minor"]),r=a.filter(p=>n.has(p.importance??o.ontology.importance.default)),i=e.fold?a.filter(p=>p.importance===e.fold):[],s=[],c=e.rollup??o.ontology.importance.rollup;if(i.length>=c.min&&i[0].date){let p=Date.parse(i[0].date),x=i.filter(d=>d.date&&p-Date.parse(d.date)<=c.days*864e5);x.length>=c.min&&s.push(`${x.length} minor events in ${c.days} days up to ${i[0].date}`)}return{shown:r,folded:i,rollups:s}}function V(o,t){let e=o.statements.map((r,i)=>({st:r,i})).filter(({st:r})=>r.property==="reading"||!!r.metric).sort((r,i)=>(i.st.at??"").localeCompare(r.st.at??"")),a=new Set,n=[];for(let{st:r,i}of e){let s=r.metric??"reading";t&&a.has(s)||(a.add(s),n.push({label:`${s.replace(/_/g," ")}: ${r.value}`,chips:[],date:r.at,statement:i,private:r.access==="private"}))}return n}function B(o,t){return t(o.sources).sort((e,a)=>a.date.localeCompare(e.date)).map(e=>{let a=e.content.split(`
1
+ import{f as j,g}from"./chunk-MTX4UPNB.js";import{f as h}from"./chunk-QAWKN2N4.js";import{a as z}from"./chunk-IMLAPB7G.js";function E(o,t){return o.ontology.types.find(e=>e.id===t)?.lens??[{panel:"notes",source:"notes",show:1}]}function v(o,t,e){let a=o.ontology.properties.find(n=>n.id===t);return a?e?a.inverse??a.label:a.label:t.replace(/_/g," ")}function G(o,t){let e=o.until??o.date??o.since??"",a=t.until??t.date??t.since??"";return e!==a?a.localeCompare(e):o.label.localeCompare(t.label)}function R(o,t,e,a,n){let r=a?n:e.target?o.entities.get(e.target):void 0,i=[v(o,e.property,a)];return e.role&&i.unshift(e.role.length>40?`${e.role.slice(0,39)}\u2026`:e.role),{label:r?.title??e.value,entityId:r?.id,type:r?.type,chips:i,since:e.since,until:e.until,status:e.status,private:e.access==="private",statement:a?void 0:t.statements.indexOf(e),sub:e.note}}function H(o,t,e){let a=new Set(j(e)),n=e.types?new Set(e.types):null,r=[],i=new Set,s=x=>!n||!!x&&n.has(x.type);for(let x of t.statements){if(!a.has(x.property))continue;let d=x.target?o.entities.get(x.target):void 0;s(d)&&(r.push(R(o,t,x,!1)),d&&i.add(d.id))}for(let x of o.incoming.get(t.id)??[]){if(!a.has(x.property))continue;let d=o.entities.get(x.from);!d||!s(d)||(x.statement?r.push(R(o,t,x.statement,!0,d)):i.has(d.id)||r.push({label:d.title,entityId:d.id,type:d.type,chips:[v(o,"related",!0)],date:d.updated}),i.add(d.id))}if(a.has("related"))for(let x of o.outgoing.get(t.id)??[]){if(x.property!=="related"||i.has(x.to))continue;let d=o.entities.get(x.to);!d||!s(d)||(r.push({label:d.title,entityId:d.id,type:d.type,chips:[v(o,"related",!1)],date:d.updated}),i.add(d.id))}let c=r.filter(x=>!x.chips.includes(v(o,"related",!1))),p=r.filter(x=>x.chips.includes(v(o,"related",!1)));return[...c.sort(G),...p.sort(G)]}function I(o,t,e){let a=new Set;for(let r of o.outgoing.get(t.id)??[])a.add(r.to);for(let r of o.incoming.get(t.id)??[])a.add(r.from);let n=[];for(let r of a){let i=o.entities.get(r);i&&(!e||e.has(i.type))&&n.push(i)}return n.sort((r,i)=>(i.date||i.updated).localeCompare(r.date||r.updated))}function M(o){return{label:o.title,entityId:o.id,type:o.type,chips:[],date:o.date,importance:o.importance}}function T(o,t,e){let a=I(o,t,new Set(["event"])).map(M),n=new Set(e.importance??["major","normal","minor"]),r=a.filter(p=>n.has(p.importance??o.ontology.importance.default)),i=e.fold?a.filter(p=>p.importance===e.fold):[],s=[],c=e.rollup??o.ontology.importance.rollup;if(i.length>=c.min&&i[0].date){let p=Date.parse(i[0].date),x=i.filter(d=>d.date&&p-Date.parse(d.date)<=c.days*864e5);x.length>=c.min&&s.push(`${x.length} minor events in ${c.days} days up to ${i[0].date}`)}return{shown:r,folded:i,rollups:s}}function V(o,t){let e=o.statements.map((r,i)=>({st:r,i})).filter(({st:r})=>r.property==="reading"||!!r.metric).sort((r,i)=>(i.st.at??"").localeCompare(r.st.at??"")),a=new Set,n=[];for(let{st:r,i}of e){let s=r.metric??"reading";t&&a.has(s)||(a.add(s),n.push({label:`${s.replace(/_/g," ")}: ${r.value}`,chips:[],date:r.at,statement:i,private:r.access==="private"}))}return n}function B(o,t){return t(o.sources).sort((e,a)=>a.date.localeCompare(e.date)).map(e=>{let a=e.content.split(`
2
2
  `).map(n=>n.trim()).find(Boolean)??"";return{label:a.length>120?`${a.slice(0,117)}\u2026`:a,chips:[],date:e.date,sub:`${e.date} \xB7 ${e.agentId} \xB7 ${e.source}`}})}function P(o,t,e,a){let n=g(e),r=[],i=[],s=[];if(n==="statements")r=H(o,t,e);else if(n==="linked")r=I(o,t,e.types?new Set(e.types):null).map(M);else if(n==="readings")r=V(t,!a.full&&e.latest!==!1);else if(n==="discussed")r=B(t,a.readEntries);else if(n==="history"){let p=T(o,t,e);r=a.full?I(o,t,new Set(["event"])).map(M):p.shown,i=a.full?[]:p.folded,s=p.rollups}let c=r.length;if(a.full){let p=a.pageSize??50,x=Math.max(1,a.page??1);r=r.slice((x-1)*p,x*p)}else r=r.slice(0,e.show??5);return{def:e,title:e.title??e.panel.replace(/_/g," "),items:r,total:c,folded:i,rollups:s,ownerOnly:e.access==="owner"}}function l(o){return String(o??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var O={home:'<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/>',person:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/>',org:'<rect x="4" y="3" width="16" height="18" rx="2"/><path d="M9 7h2M13 7h2M9 11h2M13 11h2M9 15h2M13 15h2"/>',pin:'<path d="M12 21s-7-6.2-7-11a7 7 0 0 1 14 0c0 4.8-7 11-7 11z"/><circle cx="12" cy="10" r="2.5"/>',server:'<rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.5h.01M7 16.5h.01"/>',device:'<rect x="4" y="5" width="16" height="11" rx="1.5"/><path d="M2 19h20"/>',app:'<rect x="4" y="4" width="16" height="16" rx="3"/><path d="M9 12h6M12 9v6"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.5 3 14.5 0 18M12 3c-3 3.5-3 14.5 0 18"/>',key:'<circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3"/>',agent:'<rect x="5" y="8" width="14" height="11" rx="3"/><path d="M12 4v4M9 13h.01M15 13h.01"/>',project:'<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z"/><path d="M4 7.5l8 4.5 8-4.5M12 12v9"/>',contract:'<path d="M7 3h7l5 5v13H7z"/><path d="M14 3v5h5M10 13h6M10 17h4"/>',law:'<path d="M12 3v18M5 21h14M6 7h12M6 7l-3 7a3 3 0 0 0 6 0zM18 7l-3 7a3 3 0 0 0 6 0z"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/>',decision:'<path d="M12 3v18M12 8H6l-2 2 2 2h6M12 12h6l2 2-2 2h-6"/>',steps:'<path d="M9 6h11M9 12h11M9 18h11M4 6l1 1 2-2M4 12l1 1 2-2M4 18l1 1 2-2"/>',topic:'<path d="M4 7h16M4 12h10M4 17h7"/>',chat:'<path d="M4 5h16v11H9l-5 4z"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',arrow:'<path d="M5 12h14M13 6l6 6-6 6"/>',search:'<circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/>',merge:'<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="12" r="2"/><path d="M6 8v8M8 6c6 0 8 2 8 6"/>'};function m(o){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${O[o??""]??O.topic}</svg>`}function u(o,t){return m(o.types.find(e=>e.id===t)?.icon)}function b(o,t){return o.types.find(e=>e.id===t)?.label??t??""}function f(o){return`/e/${encodeURIComponent(o)}`}function L(o){return`<nav class="ox-crumbs" aria-label="Breadcrumb">${[{label:"Wiki",href:"/"},...o].map((e,a,n)=>a===n.length-1||!e.href?`<b>${l(e.label)}</b>`:`<a href="${e.href}">${l(e.label)}</a>`).join('<span aria-hidden="true">/</span>')}</nav>`}function y(o){let t=["","Pillar","Overview","Panel","Statement"];return`<div class="ox-zoom" title="Zoom level">${[1,2,3,4].map(a=>`<span class="${a===o?"on":""}">Z${a}${a===o?` ${t[a]}`:""}</span>`).join("")}</div>`}function w(o,t){let e=o.ontology,a=`<a class="ox-nav${t.home?" on":""}" href="/">${m("home")}<span>Home</span></a>`,n=e.sidebar.pins.slice(0,e.sidebar.pins_max);if(n.length){a+='<div class="ox-side-h">Pinned</div>';for(let r of n){let i=o.names.get(h(r)),s=i?o.entities.get(i):void 0;s&&(a+=`<a class="ox-nav pin${t.entity===s.id?" on":""}" href="${f(s.id)}">${u(e,s.type)}<span>${l(s.title)}</span></a>`)}}a+='<div class="ox-side-h">Pillars</div>';for(let r of e.pillars)r.sidebar!==!1&&(a+=`<a class="ox-nav${t.pillar===r.id?" on":""}" href="/p/${encodeURIComponent(r.id)}">${m(r.icon)}<span>${l(r.label)}</span></a>`);return a+='<div class="ox-side-foot">Types, topics and agent wikis are one level down, on Home and the pillar pages.</div>',a}function $(o,t,e,a="",n=""){return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
@@ -149,4 +149,4 @@ body>a[href="/admin"]+.ox-app .ox-top{padding-right:130px}
149
149
  `;var F=()=>new Date().toISOString().slice(0,10);function q(o){return o?`<span class="ox-st ${l(o)}">${l(o)}</span>`:""}function K(o){return o.private?`<span class="l"><span class="ox-mask">\u2022\u2022\u2022\u2022</span> ${m("lock")}</span>`:o.entityId?`<a href="${f(o.entityId)}">${l(o.label)}</a>`:`<span class="l">${l(o.label)}</span>`}function J(o,t){if(t.sub)return t.sub;let e=[];return t.type&&e.push(b(o.ontology,t.type).toLowerCase()),t.since||t.until?e.push(`${t.since??"\u2026"} \u2192 ${t.until??"now"}`):t.date&&e.push(t.date),e.join(" \xB7 ")}function Y(o,t,e){let a=J(o,e),n=e.chips.map(i=>`<span class="ox-chip">${l(i)}</span>`).join(""),r=e.statement!==void 0&&e.statement>=0?`<a class="ox-sub" href="${f(t.id)}/s/${e.statement}" title="Where this comes from (Z4)">Z4</a>`:"";return`<div class="ox-row"><span class="ox-ic">${e.type?u(o.ontology,e.type):m(e.private?"lock":"topic")}</span><div class="t">${K(e)}${a?`<div class="ox-sub">${l(a)}</div>`:""}</div><div class="r">${n}${q(e.status)}${r}</div></div>`}function U(o){let t=o.importance??"normal";return`<div class="ox-ev"><span class="d">${l(o.date??"")}</span><span class="ox-st ${t}">${t}</span><span>${o.entityId?`<a href="${f(o.entityId)}">${l(o.label)}</a>`:l(o.label)}</span></div>`}function Q(o){let t=o.flatMap(s=>[s.since,s.until]).filter(s=>!!s).map(s=>Number(s.slice(0,4))).filter(Boolean),e=Number(F().slice(0,4)),a=Math.min(...t,e-1),n=Math.max(1,e+1-a),r=(s,c)=>{if(!s)return c?100:0;let[p,x]=[Number(s.slice(0,4)),Number(s.slice(5,7))||(c?12:1)];return Math.min(100,Math.max(0,(p-a+(x-1)/12)/n*100))},i=`<div class="ox-tl-axis"><span></span><span class="yrs"><span>${a}</span><span>${e}</span></span></div>`;for(let s of o){let c=r(s.since,!1),p=r(s.until,!0),x=`${s.since??"\u2026"} \u2192 ${s.until??"now"}`;i+=`<div class="ox-tl-row"><div class="who">${s.chips.map(l).join(", ")}<small>${s.entityId?`<a href="${f(s.entityId)}">${l(s.label)}</a>`:l(s.label)}</small></div><div class="ox-track"><i class="${s.until?"past":""}" style="left:${c.toFixed(1)}%;width:${Math.max(4,p-c).toFixed(1)}%" title="${l(x)}">${l(x)}</i></div></div>`}return i}function S(o,t,e,a,n=""){let r=!a&&(e.total>e.items.length||e.def.source==="notes"||e.folded.length)?`<a class="zin" href="${f(t.id)}/${encodeURIComponent(e.def.panel)}">all ${e.total||""} (Z3) \u2192</a>`:"",s=e.def.source==="notes"||e.def.panel==="notes"?`${t.pages.length} page${t.pages.length===1?"":"s"}`:`${e.total} ${e.total===1?"item":"items"}`,c=`<span class="note">${e.ownerOnly?`${m("lock")} private to the owner \xB7 `:""}${s}</span>`,p="";e.def.source==="notes"||e.def.panel==="notes"?p=n||'<div class="ox-empty">No notes.</div>':e.items.length===0?p='<div class="ox-empty">Nothing recorded yet.</div>':e.def.display==="timeline"&&e.items.some(d=>d.since)?p=Q(e.items):e.def.source==="history"||e.items.every(d=>d.type==="event")?p=e.items.map(U).join(""):p=e.items.map(d=>Y(o,t,d)).join("");for(let d of e.rollups)p+=`<div class="ox-fold">\u21BB Recurring: ${l(d)}</div>`;return e.folded.length&&(p+=`<details class="ox-fold"><summary>+ ${e.folded.length} minor event${e.folded.length===1?"":"s"}</summary>${e.folded.slice(0,20).map(U).join("")}</details>`),`<section class="ox-card${e.def.display==="timeline"||e.def.source==="notes"||e.def.panel==="notes"?" wide":""}"><div class="ox-card-h"><h2>${l(e.title)}</h2>${c}${r}</div>${p}</section>`}function C(o,t){return z(t.replace(/<!--\s*tags?:[^>]*-->\s*\n?/gi,"").replace(/<!-- \/overview -->\s*\n?/g,""),{wikilink:(e,a)=>{let n=o.names.get(h(e));return n?`<a href="${f(n)}" class="wikilink">${a}</a>`:`<a href="/find?q=${encodeURIComponent(e)}" class="wikilink broken" title="No page yet">${a}</a>`}})}function k(o){return o.replace(/^---\n[\s\S]*?\n---\n?/,"").trim()}var X=/^##[ \t]+Overview[ \t]*$/im,N="<!-- /overview -->";function D(o){let t=X.exec(o);if(!t)return;let e=t.index+t[0].length,a=o.slice(e),n=a.indexOf(N),r=a.search(/^#{1,2}[ \t]/m),i=[n,r].filter(p=>p>=0),s=e+(i.length?Math.min(...i):a.length),c=n>=0&&e+n===s?s+N.length:s;return{start:t.index,textStart:e,end:s,after:c}}function ee(o){let t=k(o),e=D(t);return(e?t.slice(e.textStart,e.end).trim():"")||void 0}function te(o){let t=[...o.pages].sort((e,a)=>(a.article.meta.lastUpdated||"").localeCompare(e.article.meta.lastUpdated||""));for(let e of t){let a=ee(e.article.content);if(a)return a}}function oe(o,t){if(o.length<=t)return o;let e=o.slice(0,t),a=Math.max(...[". ","! ","? ","\u061F ","\u3002"].map(n=>e.lastIndexOf(n)));return a>t/3?e.slice(0,a+1):`${e.replace(/\s+\S*$/,"")}\u2026`}function ne(o,t=360){let n=(k(o.pages[0]?.article.content??"").split(/\n\s*\n/).map(r=>r.trim()).find(r=>r&&!r.startsWith("#")&&!r.startsWith("|")&&!r.startsWith("```"))??"").replace(/\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/g,(r,i,s)=>s??i).replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/^[-*]\s+/gm,"").replace(/[*_`]/g,"").replace(/\s+/g," ").trim();return oe(n,t)}function ae(o,t){return o.ontology.pillars.find(e=>e.id===t.pillar)}function W(o,t,e=[]){let a=ae(o,t);return L([{label:a?.label??t.pillar,href:`/p/${encodeURIComponent(t.pillar)}`},{label:b(o.ontology,t.type),href:`/p/${encodeURIComponent(t.pillar)}?kind=${encodeURIComponent(t.type)}`},{label:t.title,href:e.length?f(t.id):void 0},...e])}function _(o,t,e){if(!e){let a=t.pages[0];if(!a)return"";let n=k(a.article.content),r=D(n),i=(r?n.slice(0,r.start)+n.slice(r.after):n).trim(),s=i.length>1600?`${i.slice(0,1600).replace(/\n[^\n]*$/,"")}
150
150
 
151
151
  \u2026`:i;return`<div class="ox-prose">${C(o,s)}</div>`}return t.pages.map(a=>`<div class="ox-sub">from ${l(a.agentId)} \xB7 ${l(a.article.path)} \xB7 updated ${l(a.article.meta.lastUpdated||"\u2014")}</div><div class="ox-prose">${C(o,k(a.article.content))}</div>`).join('<hr style="border:0;border-top:1px solid var(--edge);margin:16px 0">')}function re(o,t,e){let a=o.ontology.types.find(i=>i.id===t.type),n=`<span class="ox-lbl">Lens for this type</span><div class="ox-annot"><b>${l(a?.label??t.type)}</b> opens with:<ol>`;n+=e.map(i=>`<li>${l(i.title??i.panel)}</li>`).join(""),n+=`</ol><span class="ox-sub">from ontology.yaml \xB7 types.${l(t.type)}.lens</span></div>`,n+='<span class="ox-lbl" style="margin-top:20px">Zoom in</span>';for(let i of e)n+=`<div class="ox-row"><span class="ox-ic">${m(g(i)==="history"?"calendar":g(i)==="discussed"?"chat":"arrow")}</span><div class="t"><a href="${f(t.id)}/${encodeURIComponent(i.panel)}">${l(i.title??i.panel)}</a><div class="ox-sub">Z3 \xB7 in full</div></div></div>`;n+='<span class="ox-lbl" style="margin-top:20px">Provenance</span>';let r=new Map;for(let i of t.pages)r.set(i.agentId,(r.get(i.agentId)??0)+1);for(let[i,s]of r){let c=t.pages.find(p=>p.agentId===i);n+=`<div class="ox-row"><span class="ox-ic">${m("agent")}</span><div class="t"><a href="/agent/${encodeURIComponent(i)}/article/${encodeURIComponent(c.article.path)}">${l(i)}</a><div class="ox-sub">${s} page${s===1?"":"s"} \xB7 ${t.statements.filter(p=>p.page.agentId===i).length} statements</div></div></div>`}return t.pages.length>1&&(n+=`<div class="ox-row"><span class="ox-ic">${m("merge")}</span><div class="t"><span class="l">${t.pages.length} pages merged</span><div class="ox-sub">same name, one entity</div></div></div>`),n}function ve(o,t){let{g:e}=o,a=E(e,t.type),n=e.ontology.types.find(p=>p.id===t.type),r=e.ontology.sidebar.pins.some(p=>e.names.get(h(p))===t.id),i=`<div class="ox-bar">${W(e,t)}${y(2)}</div>`;i+=`<div class="ox-head"><div class="ox-avatar">${u(e.ontology,t.type)}</div><div><h1>${l(t.title)}</h1><div class="ox-chips">`,i+=`<span class="ox-chip type">${u(e.ontology,t.type)}${l(n?.label??t.type)}</span>`,n?.schema&&(i+=`<span class="ox-chip mono">${l(n.schema.includes(" ")||n.schema.includes(":")?n.schema:`schema.org/${n.schema}`)}</span>`),t.type==="event"&&(i+=`<span class="ox-st ${t.importance}">${t.importance}</span>`),r&&(i+='<span class="ox-chip">pinned</span>'),t.pages.length>1&&(i+=`<span class="ox-chip">${m("merge")}merged from ${t.pages.length} pages</span>`),i+="</div></div></div>",t.review&&(i+=`<div class="ox-card ox-sub" style="border-color:var(--warn,#d97706)">Check the type: ${l(t.review)}</div>`);let s=te(t),c=s?"":ne(t);if((s||c)&&a[0]?.panel!=="notes"){let p=s?`<div class="ox-summary ox-prose">${C(e,s)}</div>`:`<p class="ox-summary">${l(c)}</p>`;i+=`<section class="ox-card">${p}<div class="ox-meta"><span>updated ${l(t.updated||"\u2014")}</span><span>sources: ${t.sources.length}</span><span>${t.statements.length} statements</span></div></section>`}i+='<div class="ox-grid2">';for(let p of a){let x=P(e,t,p,{full:!1,readEntries:o.readEntries}),d=g(p)==="notes";i+=S(e,t,x,!1,d?_(e,t,!1):"")}return i+="</div>",$(t.title,w(e,{pillar:t.pillar,entity:t.id}),i,re(e,t,a))}function be(o,t,e,a){let{g:n}=o,r=E(n,t.type).find(d=>d.panel===e);if(!r)return null;let i=P(n,t,r,{full:!0,page:a,pageSize:50,readEntries:o.readEntries}),s=r.title??r.panel,c=`<div class="ox-bar">${W(n,t,[{label:s}])}${y(3)}</div>`;c+=`<div class="ox-head"><div class="ox-avatar">${u(n.ontology,t.type)}</div><div><h1>${l(s)}</h1><p>${l(t.title)} \xB7 ${i.total} item${i.total===1?"":"s"}</p></div></div>`;let p=g(r)==="notes";c+=S(n,t,i,!0,p?_(n,t,!0):"");let x=Math.ceil(i.total/50);if(x>1){let d=`${f(t.id)}/${encodeURIComponent(e)}`;c+=`<div class="ox-pager">${a>1?`<a href="${d}?page=${a-1}">\u2190 newer</a>`:""}<span>page ${a} of ${x}</span>${a<x?`<a href="${d}?page=${a+1}">older \u2192</a>`:""}</div>`}return $(`${s} \xB7 ${t.title}`,w(n,{pillar:t.pillar,entity:t.id}),c)}function ye(o,t,e){let{g:a}=o,n=t.statements[e];if(!n)return null;let r=a.ontology.properties.find(d=>d.id===n.property),i=n.target?a.entities.get(n.target):void 0,s=n.page.article.meta,c=[["Subject",`<a href="${f(t.id)}">${l(t.title)}</a>`],["Property",`${l(r?.label??n.property)}${r?.wikidata?` <span class="ox-sub">wikidata ${l(r.wikidata)}</span>`:""}`],["Value",i?`<a href="${f(i.id)}">${l(i.title)}</a>`:l(n.value)]];n.role&&c.push(["Role",l(n.role)]),n.metric&&c.push(["Metric",l(n.metric)]),(n.since||n.until)&&c.push(["True",`${l(n.since??"\u2026")} \u2192 ${l(n.until??"now")}`]),n.at&&c.push(["Measured",l(n.at)]),c.push(["Recorded",l(s.lastUpdated||s.created||"\u2014")]),c.push(["Source",l(n.source??(s.sources.length?`${s.sources.length} conversation entries`:"not given"))]),c.push(["Written by",`${l(n.page.agentId)} \xB7 <a href="/agent/${encodeURIComponent(n.page.agentId)}/article/${encodeURIComponent(n.page.article.path)}">${l(n.page.article.path)}</a>`]),c.push(["Status",n.status?`<span class="ox-st ${l(n.status)}">${l(n.status)}</span>`:"not set"]),n.confirmed_by&&c.push(["Confirmed by",l(n.confirmed_by)]),n.checked_at&&c.push(["Checked",l(n.checked_at)]),c.push(["Access",l(n.access??s.access)]),n.note&&c.push(["Note",l(n.note)]);let p=o.versions(n.page.agentId,n.page.article.path);c.push(["Past versions",p.length?p.slice(0,8).map(d=>l(d.timestamp)).join("<br>"):"none saved"]);let x=`<div class="ox-bar">${W(a,t,[{label:r?.label??n.property}])}${y(4)}</div>`;return x+=`<div class="ox-head"><div class="ox-avatar">${m("key")}</div><div><h1>${l(r?.label??n.property)}</h1><p>${l(t.title)} \u2192 ${l(i?.title??n.value)}</p></div></div>`,x+=`<section class="ox-card">${c.map(([d,A])=>`<div class="ox-kv"><span class="k">${d}</span><span>${A}</span></div>`).join("")}</section>`,$(`${r?.label??n.property} \xB7 ${t.title}`,w(a,{pillar:t.pillar,entity:t.id}),x)}export{I as a,l as b,m as c,u as d,b as e,f,L as g,y as h,w as i,$ as j,k,N as l,D as m,ne as n,ve as o,be as p,ye as q};
152
- //# sourceMappingURL=chunk-MCBTVNPX.js.map
152
+ //# sourceMappingURL=chunk-H4NSB54D.js.map
@@ -1,2 +1,2 @@
1
1
  var e=["person","project","place","concept","event","decision","pattern"];function i(t){return typeof t=="string"&&e.includes(t)}export{e as a,i as b};
2
- //# sourceMappingURL=chunk-4VVHGR7H.js.map
2
+ //# sourceMappingURL=chunk-KEXBEUSU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/wiki/types.ts"],"sourcesContent":["// --- Wiki types ---\n//\n// Karpathy/Farzapedia pattern: plain files, LLM-chosen structure, articles\n// organized by `type` with wikilinks (`related`) as the primary navigation\n// surface. `_index.md` is the catalog; tags are a secondary hint, no longer\n// load-bearing. See blog/wiki-karpathy-review for the why.\n\nimport type { Importance, WikiStatement } from \"./ontology/types\"\n\nexport type WikiAccess = \"private\" | \"shared\" | \"public\"\n\n/**\n * Article type — the organizational spine. Matches Farzapedia's\n * `type: person | project | place | concept | event`, extended with\n * `decision` and `pattern` for workflow-heavy corpora.\n * Optional on legacy articles; Phase 2 migration backfills it.\n */\nexport type WikiArticleType =\n | \"person\"\n | \"project\"\n | \"place\"\n | \"concept\"\n | \"event\"\n | \"decision\"\n | \"pattern\"\n\n/** Runtime-iterable source of truth for the `type` enum. Use this for\n * write-side validation and CLI/prompt string interpolation. */\nexport const WIKI_ARTICLE_TYPES: readonly WikiArticleType[] = [\n \"person\",\n \"project\",\n \"place\",\n \"concept\",\n \"event\",\n \"decision\",\n \"pattern\",\n] as const\n\n/** True if `s` is a recognised article type. Use in the write path\n * to drop unknown values coming from upstream LLMs. */\nexport function isWikiArticleType(s: unknown): s is WikiArticleType {\n return typeof s === \"string\" && (WIKI_ARTICLE_TYPES as readonly string[]).includes(s)\n}\n\n/**\n * Article metadata. `type` + `related` are the primary retrieval surface;\n * tags remain as a secondary hint but are no longer central.\n */\nexport interface WikiArticleMeta {\n title: string\n /** Organizational spine — Phase 2 migration backfills any missing values. */\n type?: WikiArticleType\n /** Wikilink targets (by title) — persisted from `[[wikilinks]]` in body. */\n related?: string[]\n /** Secondary hint, no longer the retrieval spine. */\n tags: string[]\n owner: string // Agent ID\n access: WikiAccess\n sharedWith?: string[]\n created: string\n lastUpdated: string\n sources: string[] // Raw entry IDs\n /** Intent graph path (root → leaf node ids) when the article was authored\n * under an active intent graph. Empty for legacy articles — retrieval\n * falls back to pure BM25 for those. */\n graphPath?: string[]\n /** Ontology type (`organization`, `device`, `obligation`…), finer than\n * `type`. Unset, the ontology's classify rules decide (#811). */\n class?: string\n /** Event importance. Unset, the ontology default applies. */\n importance?: Importance\n /** When the event happened (YYYY-MM-DD). */\n date?: string\n /** Title of the event this minor event rolled up into. */\n rolledUpInto?: string\n /** Other names for the same thing; pages sharing a name merge. */\n aliases?: string[]\n /** Typed facts about this page's subject. */\n statements?: WikiStatement[]\n}\n\nexport interface WikiArticle {\n meta: WikiArticleMeta\n content: string // Markdown body — may contain section tags\n path: string // LLM-chosen path — structure emerges from data\n}\n\nexport interface WikiEntry {\n id: string\n date: string\n agentId: string\n source: string\n sourceContext?: string\n content: string\n meta?: Record<string, unknown>\n}\n\nexport interface WikiIndex {\n articles: Array<{\n path: string\n title: string\n type?: WikiArticleType\n related?: string[]\n tags: string[]\n owner: string\n access: WikiAccess\n sharedWith?: string[]\n aliases: string[]\n backlinks: number\n sources?: string[]\n lastUpdated?: string\n /** Intent-graph path the article's sources were classified under. */\n graphPath?: string[]\n }>\n lastRebuilt: string\n}\n"],"mappings":"AA4BO,IAAMA,EAAiD,CAC5D,SACA,UACA,QACA,UACA,QACA,WACA,SACF,EAIO,SAASC,EAAkBC,EAAkC,CAClE,OAAO,OAAOA,GAAM,UAAaF,EAAyC,SAASE,CAAC,CACtF","names":["WIKI_ARTICLE_TYPES","isWikiArticleType","s"]}
1
+ {"version":3,"sources":["../src/wiki/types.ts"],"sourcesContent":["// --- Wiki types ---\n//\n// Karpathy/Farzapedia pattern: plain files, LLM-chosen structure, articles\n// organized by `type` with wikilinks (`related`) as the primary navigation\n// surface. `_index.md` is the catalog; tags are a secondary hint, no longer\n// load-bearing. See blog/wiki-karpathy-review for the why.\n\nimport type { Importance, WikiStatement } from \"./ontology/types\"\n\nexport type WikiAccess = \"private\" | \"shared\" | \"public\"\n\n/**\n * Article type — the organizational spine. Matches Farzapedia's\n * `type: person | project | place | concept | event`, extended with\n * `decision` and `pattern` for workflow-heavy corpora.\n * Optional on legacy articles; Phase 2 migration backfills it.\n */\nexport type WikiArticleType =\n | \"person\"\n | \"project\"\n | \"place\"\n | \"concept\"\n | \"event\"\n | \"decision\"\n | \"pattern\"\n\n/** Runtime-iterable source of truth for the `type` enum. Use this for\n * write-side validation and CLI/prompt string interpolation. */\nexport const WIKI_ARTICLE_TYPES: readonly WikiArticleType[] = [\n \"person\",\n \"project\",\n \"place\",\n \"concept\",\n \"event\",\n \"decision\",\n \"pattern\",\n] as const\n\n/** True if `s` is a recognised article type. Use in the write path\n * to drop unknown values coming from upstream LLMs. */\nexport function isWikiArticleType(s: unknown): s is WikiArticleType {\n return typeof s === \"string\" && (WIKI_ARTICLE_TYPES as readonly string[]).includes(s)\n}\n\n/**\n * Article metadata. `type` + `related` are the primary retrieval surface;\n * tags remain as a secondary hint but are no longer central.\n */\nexport interface WikiArticleMeta {\n title: string\n /** Organizational spine — Phase 2 migration backfills any missing values. */\n type?: WikiArticleType\n /** Wikilink targets (by title) — persisted from `[[wikilinks]]` in body. */\n related?: string[]\n /** Secondary hint, no longer the retrieval spine. */\n tags: string[]\n owner: string // Agent ID\n access: WikiAccess\n sharedWith?: string[]\n created: string\n lastUpdated: string\n sources: string[] // Raw entry IDs\n /** Intent graph path (root → leaf node ids) when the article was authored\n * under an active intent graph. Empty for legacy articles — retrieval\n * falls back to pure BM25 for those. */\n graphPath?: string[]\n /** Ontology type (`organization`, `device`, `obligation`…), finer than\n * `type`. Unset, the ontology's classify rules decide (#811). */\n class?: string\n /** Event importance. Unset, the ontology default applies. */\n importance?: Importance\n /** A level a job suggests and only the owner may set (#811). */\n importanceProposed?: Importance\n /** When the event happened (YYYY-MM-DD). */\n date?: string\n /** Title of the event this minor event rolled up into. */\n rolledUpInto?: string\n /** Other names for the same thing; pages sharing a name merge. */\n aliases?: string[]\n /** Typed facts about this page's subject. */\n statements?: WikiStatement[]\n}\n\nexport interface WikiArticle {\n meta: WikiArticleMeta\n content: string // Markdown body — may contain section tags\n path: string // LLM-chosen path — structure emerges from data\n}\n\nexport interface WikiEntry {\n id: string\n date: string\n agentId: string\n source: string\n sourceContext?: string\n content: string\n meta?: Record<string, unknown>\n}\n\nexport interface WikiIndex {\n articles: Array<{\n path: string\n title: string\n type?: WikiArticleType\n related?: string[]\n tags: string[]\n owner: string\n access: WikiAccess\n sharedWith?: string[]\n aliases: string[]\n backlinks: number\n sources?: string[]\n lastUpdated?: string\n /** Intent-graph path the article's sources were classified under. */\n graphPath?: string[]\n }>\n lastRebuilt: string\n}\n"],"mappings":"AA4BO,IAAMA,EAAiD,CAC5D,SACA,UACA,QACA,UACA,QACA,WACA,SACF,EAIO,SAASC,EAAkBC,EAAkC,CAClE,OAAO,OAAOA,GAAM,UAAaF,EAAyC,SAASE,CAAC,CACtF","names":["WIKI_ARTICLE_TYPES","isWikiArticleType","s"]}
@@ -0,0 +1,3 @@
1
+ import{a as d}from"./chunk-ROLSSYXE.js";import{existsSync as g,readFileSync as P,statSync as O,writeFileSync as A}from"fs";import{resolve as h}from"path";import w from"js-yaml";var l=(t=5)=>({panel:"history",title:"History",source:"history",show:t,importance:["major","normal"],fold:"minor",rollup:{min:5,days:30}}),c={panel:"discussed",title:"Discussed",source:"discussed",show:3,access:"owner"},s=(t=1)=>({panel:"notes",title:"Notes",source:"notes",show:t}),v=["device","server","app","domain","account","agent"],m="\\b(down|outage|offline|unreachable|fail(ed|ing|ure)?|crash(ed|es|ing)?|broke|broken|lost|loss|corrupt(ed)?|data|production|prod|customers?|clients?|incident|breach|after|loop|again)\\b",k=[{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","works_on","related"],types:["person","organization","project"],show:5,group_by:"role"},{panel:"belongings",title:"Belongings",from:["owns","uses","related"],types:v.filter(t=>t!=="agent"),show:5},{panel:"obligations",title:"Obligations they carry",from:["subject_to"],show:3},l(),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},l(),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},l(),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},l(),{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},l(),{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},l(),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},l(),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},l(),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},l(),c,s()]},{id:"project",label:"Project",plural:"Projects",pillar:"offerings",schema:"Project",icon:"project",lens:[{panel:"people",title:"Client and people",from:["client","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},l(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},l(),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},l(),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},l(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},l(4)]}],u={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:k,properties:[{id:"related",label:"related to",inverse:"related to"},{id:"role_at",label:"role at",inverse:"people",wikidata:"P108",range:["organization"],domain:["person"]},{id:"member_of",label:"member of",inverse:"members",wikidata:"P463",range:["organization"],domain:["person","organization"]},{id:"founded",label:"founded",inverse:"founded by",wikidata:"P112",domain:["person","organization"]},{id:"works_with",label:"works with",inverse:"works with",domain:["person","organization"]},{id:"reports_to",label:"reports to",inverse:"manages",domain:["person"]},{id:"client_of",label:"client of",inverse:"clients",wikidata:"P1972",domain:["person","organization"]},{id:"client",label:"is for client",inverse:"projects",range:["organization","person"],domain:["project","offering","contract"]},{id:"works_on",label:"works on",inverse:"people",range:["project"],domain:["person","organization","agent"]},{id:"works_for",label:"works for",inverse:"agents",wikidata:"P108",domain:["agent","person"]},{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"},{id:"importance_set",label:"importance set"}],importance:{default:"normal",major_set_by:"owner",rollup:{min:5,days:30},rules:[{level:"minor",title:"\\b(disk|storage) (is |was |almost |nearly )?(full|pressure|cleanup|clean-up|usage|space)\\b",unless:m},{level:"minor",title:"\\b(cache|logs?|temp files?) (was |were )?(cleared|cleaned|purged|rotated|pruned)\\b",unless:m},{level:"minor",title:"\\b(restart(ed)?|reboot(ed)?|health ?check|heartbeat)\\b",unless:m}]},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 T(t){let i=h(t,y);if(!g(i))return{ontology:u,errors:[],file:null};let r=O(i).mtimeMs,a=b.get(i);if(a&&a.mtimeMs===r)return a.loaded;let n,e=[];try{n=w.load(P(i,"utf-8"))}catch(_){e.push(`${y} is not valid YAML: ${_.message}`),n={}}let o=L(u,f(n)?n:{},e);e.push(...$(o));let p={ontology:o,errors:e,file:i};return b.set(i,{mtimeMs:r,loaded:p}),p}function M(t){let i=h(t,y);if(g(i))throw new Error(`${i} already exists`);let r=["# 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 A(i,r+w.dump(u,{lineWidth:120,noRefs:!0})),i}function L(t,i,r=[]){let a=structuredClone(t);typeof i.version=="number"&&(a.version=i.version);for(let n of["pillars","types","properties"]){let e=i[n];if(e!==void 0){if(!Array.isArray(e)){r.push(`${n} must be a list`);continue}a[n]=j(a[n],e,n,r)}}return f(i.importance)&&(a.importance={...a.importance,...i.importance}),f(i.sidebar)&&(a.sidebar={...a.sidebar,...i.sidebar}),i.classify!==void 0&&(Array.isArray(i.classify)?a.classify=i.classify:r.push("classify must be a list")),typeof i.fallback_type=="string"&&(a.fallback_type=i.fallback_type),i.agent_names!==void 0&&(Array.isArray(i.agent_names)?a.agent_names=i.agent_names.filter(n=>typeof n=="string"&&!!n.trim()):r.push("agent_names must be a list")),a}function j(t,i,r,a){let n=t.map(e=>({...e}));for(let e of i){if(!f(e)||typeof e.id!="string"){a.push(`every item in ${r} needs an id`);continue}let o=n.findIndex(p=>p.id===e.id);o===-1?n.push(e):n[o]={...n[o],...e}}return n}function $(t){let i=[],r=new Set(t.pillars.map(e=>e.id)),a=new Set(t.types.map(e=>e.id)),n=new Set(t.properties.map(e=>e.id));for(let e of t.types){r.has(e.pillar)||i.push(`type ${e.id}: unknown pillar "${e.pillar}"`);for(let o of e.lens??[]){for(let p of S(o))n.has(p)||i.push(`type ${e.id}, panel ${o.panel}: unknown property "${p}"`);for(let p of o.types??[])a.has(p)||i.push(`type ${e.id}, panel ${o.panel}: unknown type "${p}"`);for(let p of o.importance??[])d.includes(p)||i.push(`type ${e.id}, panel ${o.panel}: unknown importance "${p}"`)}}for(let e of t.classify)if(a.has(e.type)||i.push(`classify: unknown type "${e.type}"`),e.title)try{new RegExp(e.title,"i")}catch{i.push(`classify: bad title pattern "${e.title}"`)}a.has(t.fallback_type)||i.push(`fallback_type: unknown type "${t.fallback_type}"`),d.includes(t.importance.default)||i.push(`importance.default: unknown level "${t.importance.default}"`);for(let e of t.importance.rules??[]){if(d.includes(e.level)||i.push(`importance.rules: unknown level "${e.level}"`),!e.title&&!e.tags?.length&&i.push(`importance.rules: a rule for "${e.level}" needs a title or tags`),e.title)try{new RegExp(e.title,"i")}catch{i.push(`importance.rules: bad title pattern "${e.title}"`)}if(e.unless)try{new RegExp(e.unless,"i")}catch{i.push(`importance.rules: bad unless pattern "${e.unless}"`)}}return t.sidebar.pins.length>t.sidebar.pins_max&&i.push(`sidebar.pins: ${t.sidebar.pins.length} pins, only the first ${t.sidebar.pins_max} are shown`),i}function S(t){return t.from?Array.isArray(t.from)?t.from:[t.from]:[]}function C(t){return t.source?t.source:t.panel==="history"||t.panel==="discussed"||t.panel==="notes"?t.panel:t.latest?"readings":t.from?"statements":"linked"}function f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}export{y as a,T as b,M as c,L as d,$ as e,S as f,C as g};
3
+ //# sourceMappingURL=chunk-MTX4UPNB.js.map
@@ -0,0 +1 @@
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 for (const r of o.importance.rules ?? []) {\n if (!IMPORTANCE_LEVELS.includes(r.level)) errors.push(`importance.rules: unknown level \"${r.level}\"`)\n if (!r.title && !r.tags?.length) errors.push(`importance.rules: a rule for \"${r.level}\" needs a title or tags`)\n if (r.title) {\n try { new RegExp(r.title, \"i\") } catch { errors.push(`importance.rules: bad title pattern \"${r.title}\"`) }\n }\n if (r.unless) {\n try { new RegExp(r.unless, \"i\") } catch { errors.push(`importance.rules: bad unless pattern \"${r.unless}\"`) }\n }\n }\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\n/** Words that make an upkeep title worth a second look. */\nconst UPKEEP_UNLESS = \"\\\\b(down|outage|offline|unreachable|fail(ed|ing|ure)?|crash(ed|es|ing)?|broke|broken|lost|loss|corrupt(ed)?|data|production|prod|customers?|clients?|incident|breach|after|loop|again)\\\\b\"\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 { id: \"importance_set\", label: \"importance set\" },\n ],\n importance: {\n default: \"normal\",\n major_set_by: \"owner\",\n rollup: { min: 5, days: 30 },\n // Routine machine upkeep: true for any fleet, so safe as a default.\n // `unless` keeps a title that also reports damage (\"Production down\n // after reboot\") for the model.\n rules: [\n { level: \"minor\", title: \"\\\\b(disk|storage) (is |was |almost |nearly )?(full|pressure|cleanup|clean-up|usage|space)\\\\b\", unless: UPKEEP_UNLESS },\n { level: \"minor\", title: \"\\\\b(cache|logs?|temp files?) (was |were )?(cleared|cleaned|purged|rotated|pruned)\\\\b\", unless: UPKEEP_UNLESS },\n { level: \"minor\", title: \"\\\\b(restart(ed)?|reboot(ed)?|health ?check|heartbeat)\\\\b\", unless: UPKEEP_UNLESS },\n ],\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,EAGtEC,EAAgB,4LAEhBC,EAAmB,CAEvB,CACE,GAAI,SAAU,MAAO,SAAU,OAAQ,SAAU,OAAQ,UAAW,OAAQ,SAAU,KAAM,SAC5F,KAAM,CACJ,CAAE,MAAO,QAAS,MAAO,kBAAmB,KAAM,CAAC,UAAW,YAAa,SAAS,EAAG,KAAM,EAAG,QAAS,UAAW,EACpH,CAAE,MAAO,YAAa,MAAO,YAAa,KAAM,CAAC,aAAc,aAAc,YA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AAQA,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","UPKEEP_UNLESS","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"]}
@@ -0,0 +1,105 @@
1
+ import{b as I}from"./chunk-KEXBEUSU.js";import{a as P}from"./chunk-ROLSSYXE.js";import{a as E,b as R,c as j,d as M,e as T,j as O}from"./chunk-ERULJ2ZL.js";import{y as L,z as U}from"./chunk-4XMALK7X.js";import{c as _,d as C}from"./chunk-QOYAX2FT.js";import{readFileSync as $,writeFileSync as w,appendFileSync as J,existsSync as b,mkdirSync as x,readdirSync as D,statSync as K}from"fs";import{resolve as u,join as V,relative as k,dirname as F}from"path";U();function N(v){return P.includes(v)}function Y(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 z(v,t){let e=i=>{let n=/^(.*Z)(?:-(\d+))?\.md$/.exec(i);return n?[n[1],n[2]?Number(n[2]):0]:[i,0]},[r,a]=e(v),[o,s]=e(t);return r<o?-1:r>o?1:a-s}var B=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,x(this.rawDir,{recursive:!0}),x(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),w(r,a.join(`
2
+ `)),this.appendLog("ingest",`${t.id} from ${t.agentId} via ${t.source}`),e}readEntries(t){if(t.length===0||!b(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($(u(this.rawDir,a),"utf-8"),a);s&&r.push(s)}return r}listEntries(t){if(!b(this.rawDir))return[];let e=D(this.rawDir).filter(a=>a.endsWith(".md")).sort(),r=[];for(let a of e){let o=$(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()||"",i=new Set(["id","date","agent","source","context"]),n={};for(let c of a.split(`
3
+ `)){let l=c.match(/^(\w+):\s*(.+)$/);if(!(!l||i.has(l[1])))try{n[l[1]]=JSON.parse(l[2])}catch{n[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(n).length>0?n: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&&!I(e.type)&&(this.log(`Dropping invalid article type "${e.type}" for "${t}" \u2014 enum is [person, project, place, concept, event, decision, pattern]`),e={...e,type:void 0});let s=u(this.baseDir,t);o&&this.saveVersion(t,s),x(F(s),{recursive:!0});let i=["---",`title: "${e.title}"`];e.type&&i.push(`type: ${e.type}`),e.related?.length&&i.push(`related: [${e.related.map(c=>`"${c}"`).join(", ")}]`),i.push(`tags: [${(e.tags||[]).map(c=>`"${c}"`).join(", ")}]`,`owner: ${e.owner}`,`access: ${e.access}`),e.sharedWith?.length&&i.push(`shared_with: [${e.sharedWith.map(c=>`"${c}"`).join(", ")}]`),i.push(`created: ${e.created}`,`last_updated: ${e.lastUpdated}`,`sources: [${e.sources.map(c=>`"${c}"`).join(", ")}]`),e.graphPath?.length&&i.push(`graph_path: [${e.graphPath.map(c=>`"${c}"`).join(", ")}]`),e.class&&i.push(`class: ${e.class}`),e.importance&&i.push(`importance: ${e.importance}`),e.importanceProposed&&i.push(`importance_proposed: ${e.importanceProposed}`),e.date&&i.push(`date: ${e.date}`),e.rolledUpInto&&i.push(`rolled_up_into: ${JSON.stringify(e.rolledUpInto)}`),e.aliases?.length&&i.push(`aliases: ${JSON.stringify(e.aliases)}`),e.statements?.length&&i.push(`statements: ${JSON.stringify(e.statements)}`),i.push("---","",r),w(s,i.join(`
4
+ `));let n=o?"update":"create";return this.appendLog(n,`${e.title} [${(e.tags||[]).slice(0,5).join(", ")}] by ${a} at ${t}`),!0}saveVersion(t,e){try{if(!b(e))return;let r=$(e,"utf-8"),a=new Date().toISOString().replace(/[:.]/g,"-"),o=u(this.baseDir,"_versions",t.replace(/\.md$/,""));x(o,{recursive:!0});for(let s=0;;s++)try{w(u(o,`${s?`${a}-${s}`:a}.md`),r,{flag:"wx"});return}catch(i){if(i.code!=="EEXIST")throw i}}catch{}}getVersions(t){let e=u(this.baseDir,"_versions",t.replace(/\.md$/,""));if(!b(e))return[];try{return D(e).filter(r=>r.endsWith(".md")).sort(z).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=$(a.path,"utf-8"),s=u(this.baseDir,t);return this.saveVersion(t,s),w(s,o),this.appendLog("restore",`${t} restored to ${e}`),!0}catch{return!1}}readArticle(t){let e=u(this.baseDir,t);if(!b(e))return null;let r=$(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=W=>a.match(new RegExp(`^${W}:\\s*(.+)$`,"m"))?.[1]?.trim().replace(/^"(.*)"$/,"$1")||"",i=W=>{let A=a.match(new RegExp(`^${W}:\\s*\\[(.*)\\]$`,"m"));return A?[...A[1].matchAll(/\s*(?:"(.*?)"(?=\s*(?:,|$))|([^,]+))/g)].map(S=>(S[1]??S[2]).trim()).filter(Boolean):[]},n=s("type")||s("kind"),l=new Set(["person","project","place","concept","event","decision","pattern"]).has(n)?n:void 0,g=i("tags").filter((W,A,S)=>W&&S.indexOf(W)===A),d=i("related"),p=i("graph_path"),m=i("aliases"),h=s("importance"),f=s("importance_proposed"),y=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:i("shared_with"),created:s("created"),lastUpdated:s("last_updated"),sources:i("sources"),graphPath:p.length?p:void 0,class:/^[a-z][a-z0-9_]*$/.test(s("class"))?s("class"):void 0,importance:N(h)?h:void 0,importanceProposed:N(f)?f:void 0,date:/^\d{4}-\d{2}-\d{2}/.test(y)?y.slice(0,10):void 0,rolledUpInto:s("rolled_up_into")||void 0,aliases:m.length?m:void 0,statements:Y(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,(n,c)=>{if(!n.endsWith(".md"))return;let l=k(this.baseDir,n);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 i=[];for(let n of e){let c=this.readArticle(n);c&&(t===null||this.canRead(c.meta,t))&&i.push(c)}return this.listCache.set(o,{signature:a,articles:i}),i.slice()}search(t,e,r=10){let a=t.toLowerCase(),o=[];if(this.walkDir(this.baseDir,d=>{if(!d.endsWith(".md"))return;let p=k(this.baseDir,d);if(p.startsWith("raw/")||p.startsWith("_"))return;let m=this.readArticle(p);!m||!this.canRead(m.meta,e)||o.push(m)}),o.length===0)return[];let s=o.map(d=>d.content),i=u(this.baseDir,"_bm25_cache.json"),n=C(s,i),c=_(t,n),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??R),s=this.findRelevant(t,e,o);if(s.length<2)return s.slice(0,r);let i=s.map((l,g)=>({id:`c${g}`,title:l.meta.title||`(untitled ${g})`,tags:l.meta.tags,excerpt:l.content})),n=await L(E,j({query:t,candidates:i,excerptChars:a.excerptChars}),M(i),{incumbent:{best:i[0].id},features:{agent:e??"unknown"}});return!n||n.mode!=="active"?s.slice(0,r):T(n.answers,i).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 f=k(this.baseDir,h);if(f.startsWith("raw/")||f.startsWith("_"))return;let y=this.readArticle(f);!y||!this.canRead(y.meta,e)||s.push(y)}),s.length===0)return[];let i=s.map(h=>`${h.meta.title} ${(h.meta.tags||[]).join(" ")} ${h.content}`),n=u(this.baseDir,"_bm25_relevance_cache.json"),c=C(i,n),l=_(t,c),g=l.reduce((h,f)=>Math.max(h,f.score),0)||1,d=new Map(l.map(h=>[h.docIndex,h.score/g])),p=!!(a&&a.length>0);return s.map((h,f)=>{let y=d.get(f)??0,W=0;p&&h.meta.graphPath?.length&&(W=O(a,h.meta.graphPath));let A=p?o.graph*W+o.bm25*y:y;return{article:h,score:A}}).filter(h=>h.score>0).sort((h,f)=>f.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(", ")}]`,i=o.content.length>600?o.content.slice(0,600)+"...":o.content,n=s+`
6
+ `+i;if(a+n.length>e)break;r.push(n),a+=n.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 i=k(this.baseDir,s);if(i.startsWith("raw/")||i.startsWith("_"))return;let n=this.readArticle(i);if(!n)return;let c=n.content.match(/\[\[([^\]]+)\]\]/g)||[];for(let g of c){let d=g.replace(/\[\[|\]\]/g,"");e.set(d,(e.get(d)||0)+1)}let l=[n.meta.title.toLowerCase()];n.meta.tags&&l.push(...n.meta.tags.map(g=>g.toLowerCase())),t.push({path:i,title:n.meta.title,type:n.meta.type,related:n.meta.related,tags:n.meta.tags||[],owner:n.meta.owner,access:n.meta.access,sharedWith:n.meta.sharedWith,aliases:l,backlinks:e.get(n.meta.title)||0,sources:n.meta.sources,lastUpdated:n.meta.lastUpdated,graphPath:n.meta.graphPath})});let r={articles:t,lastRebuilt:new Date().toISOString()};w(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 i=s.access||"public",n=o.get(i)||[];n.push(s),o.set(i,n)}for(let[s,i]of Array.from(o.entries()).sort()){a.push(`## ${s}`,"");for(let n of i.sort((c,l)=>c.title.localeCompare(l.title))){let c=n.type?` [${n.type}]`:"";a.push(`- [${n.title}](${n.path})${c} \u2014 owner: ${n.owner}`)}a.push("")}return w(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 i of t){let n=i.type||"untyped",c=o.get(n)||[];c.push(i),o.set(n,c)}let s=["# Wiki Content Catalog","",`_Last rebuilt: ${e}_`,"","Articles grouped by type. Agentic query walks this file first to pick candidates.",""];for(let i of r){let n=o.get(i);if(!(!n||n.length===0)){s.push(a[i]||`## ${i}`,"");for(let c of n.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("")}}w(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 i=k(this.baseDir,s);if(i.startsWith("raw/")||i.startsWith("_")||i==="WIKI.md")return;let n=this.readArticle(i);if(n){t++;for(let c of n.meta.tags||[])e[c]=(e[c]||0)+1;r[n.meta.access]=(r[n.meta.access]||0)+1,a[n.meta.owner]=(a[n.meta.owner]||0)+1}});let o=b(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
+ `;b(r)||w(r,`# Wiki Log
13
+
14
+ Chronological record of all wiki operations.
15
+
16
+ `),J(r,o)}getLog(t=20){let e=u(this.baseDir,"log.md");return b(e)?$(e,"utf-8").split(/^## /m).filter(o=>o.startsWith("[")).slice(-t).map(o=>o.trim()):[]}ensureSchema(){let t=u(this.baseDir,"_schema.md");if(b(t))return;w(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=k(this.baseDir,e);if(r.startsWith("raw/")||r.startsWith("_")||r==="WIKI.md"||r==="log.md")return;let a=$(e,"utf-8"),o=this.extractWikilinks(a);for(let s of o)t[s]||(t[s]=[]),t[s].push(r)}),w(u(this.baseDir,"_backlinks.json"),JSON.stringify(t,null,2)),t}getBacklinks(t){let e=u(this.baseDir,"_backlinks.json");if(!b(e))return[];try{return JSON.parse($(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 i=k(this.baseDir,s);if(i.startsWith("raw/")||i.startsWith("_"))return;let n=this.readArticle(i);if(!n||e&&!this.canRead(n.meta,e))return;let c=(n.meta.tags||[]).map(p=>p.toLowerCase()),l=(n.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:n,score:d})}),o.sort((s,i)=>i.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=k(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 b(t)?$(t,"utf-8"):null}setWorldview(t){w(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 i=k(this.baseDir,s);if(i.startsWith("raw/")||i.startsWith("_")||i==="WIKI.md"||i==="log.md")return;let n=this.readArticle(i);if(!n)return;e.add(n.meta.title),a.set(n.meta.title,i);let c=this.extractWikilinks(n.content);r.set(i,c);let l=n.content.split(`
98
+ `).length;l>100&&t.push({type:"bloated",article:i,message:`${l} lines \u2014 consider splitting`}),n.meta.sources?.length||t.push({type:"unsourced",article:i,message:"No sources listed in frontmatter"}),l<10&&n.content.trim().length<100&&t.push({type:"stub",article:i,message:"Very short article \u2014 needs enrichment"})});for(let[s,i]of r)for(let n of i)e.has(n)||t.push({type:"broken-link",article:s,message:`[[${n}]] \u2014 target article not found`});let o=this.buildBacklinks();for(let[s,i]of a)(!o[s]||o[s].length===0)&&t.push({type:"orphan",article:i,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=k(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(b(t))for(let r of D(t)){let a=V(t,r),o=K(a);o.isDirectory()?this.walkDir(a,e):e(a,o)}}};export{B as a};
105
+ //# sourceMappingURL=chunk-MUVE3UAS.js.map