agentix-cli 0.192.0 → 0.194.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +3 -3
  2. package/apps/mac-helper/Sources/AgentXHelper/Presence.swift +70 -6
  3. package/apps/mac-helper/Sources/AgentXHelper/PresenceTag.swift +42 -5
  4. package/apps/mac-helper/Sources/AgentXHelper/main.swift +2 -1
  5. package/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +107 -4
  6. package/apps/mac-voice/Sources/AgentXVoice/Config.swift +0 -9
  7. package/apps/mac-voice/Sources/AgentXVoice/HistoryWindow.swift +3 -2
  8. package/apps/mac-voice/Sources/AgentXVoice/OpenRequests.swift +276 -8
  9. package/apps/mac-voice/Sources/AgentXVoice/RequestsWindow.swift +357 -26
  10. package/apps/mac-voice/Sources/AgentXVoice/SettingsWindow.swift +27 -0
  11. package/apps/mac-voice/Sources/AgentXVoice/StatusMenu.swift +17 -2
  12. package/apps/mac-voice/Sources/AgentXVoice/VoiceSettings.swift +23 -1
  13. package/apps/mac-voice/Sources/AgentXVoice/main.swift +335 -30
  14. package/dist/{App-N6WWCFBO.js → App-HBM52GXI.js} +2 -2
  15. package/dist/{ChatApp-JMSINKZP.js → ChatApp-N4P7M2TD.js} +2 -2
  16. package/dist/{absorb-eval-4LJ4R7GN.js → absorb-eval-HRWWPKT3.js} +2 -2
  17. package/dist/{adapter-2Y3PQ5IZ.js → adapter-X6T3YBUB.js} +2 -2
  18. package/dist/{agent-RSOKWOZ2.js → agent-3B4RMEDI.js} +2 -2
  19. package/dist/{board-dashboard-M3HOVCLM.js → board-dashboard-YCRGMNAT.js} +3668 -7064
  20. package/dist/board-dashboard-YCRGMNAT.js.map +1 -0
  21. package/dist/{chunk-4IHQSNE3.js → chunk-2GCPSAXQ.js} +2 -2
  22. package/dist/{chunk-PNWXXDTE.js → chunk-2KYGPVTX.js} +2 -2
  23. package/dist/chunk-3FZ6WHKX.js +2 -0
  24. package/dist/chunk-3FZ6WHKX.js.map +1 -0
  25. package/dist/{chunk-RZS4BHCW.js → chunk-6NQ7KYJH.js} +2 -2
  26. package/dist/{chunk-BSMT7MK4.js → chunk-7L54Z4EH.js} +2 -2
  27. package/dist/{chunk-WWFMIAYZ.js → chunk-BOCLWYWL.js} +2 -2
  28. package/dist/chunk-F2FJXKDG.js +7 -0
  29. package/dist/{chunk-Y7HU4GHT.js.map → chunk-F2FJXKDG.js.map} +1 -1
  30. package/dist/{chunk-OPBPH7IB.js → chunk-F3CMNSON.js} +2 -2
  31. package/dist/{chunk-6FHKA62Y.js → chunk-FO762MEC.js} +2 -2
  32. package/dist/{chunk-5XGQE2SN.js → chunk-HNZEXUNM.js} +2 -2
  33. package/dist/{chunk-RZPQML3W.js → chunk-HOZZUN47.js} +2 -2
  34. package/dist/chunk-HPRLRD4P.js +6 -0
  35. package/dist/chunk-HPRLRD4P.js.map +1 -0
  36. package/dist/chunk-I45E5TLK.js +934 -0
  37. package/dist/chunk-I45E5TLK.js.map +1 -0
  38. package/dist/{chunk-VGQDLAX3.js → chunk-K2BEV3BD.js} +2 -2
  39. package/dist/chunk-KE6BF4ZJ.js +2 -0
  40. package/dist/chunk-KE6BF4ZJ.js.map +1 -0
  41. package/dist/{chunk-2HPVL6UM.js → chunk-KXJRXRSD.js} +2 -2
  42. package/dist/{chunk-HNTWVZMH.js → chunk-LQIF2OHS.js} +2 -2
  43. package/dist/chunk-M2E3CNFS.js +38 -0
  44. package/dist/chunk-M2E3CNFS.js.map +1 -0
  45. package/dist/chunk-MB5CBY2C.js +189 -0
  46. package/dist/chunk-MB5CBY2C.js.map +1 -0
  47. package/dist/{chunk-QQTSGXFB.js → chunk-MC3ZZA5G.js} +2 -2
  48. package/dist/{chunk-2FCYIEKT.js → chunk-OEG476JY.js} +94 -91
  49. package/dist/chunk-OEG476JY.js.map +1 -0
  50. package/dist/chunk-P6WSD2UR.js +116 -0
  51. package/dist/chunk-P6WSD2UR.js.map +1 -0
  52. package/dist/{chunk-7NXFW4LM.js → chunk-PMSL4A5Y.js} +3 -3
  53. package/dist/{chunk-KZPZ2O2F.js → chunk-PO2SORKY.js} +36 -36
  54. package/dist/chunk-PO2SORKY.js.map +1 -0
  55. package/dist/{chunk-6DGMUN2Q.js → chunk-PX7PWXBI.js} +2 -2
  56. package/dist/{chunk-UUQ2AHUL.js → chunk-RW5FKJRE.js} +2 -2
  57. package/dist/{chunk-BZ2HOV4M.js → chunk-S42KBXNO.js} +332 -317
  58. package/dist/chunk-S42KBXNO.js.map +1 -0
  59. package/dist/{chunk-54LKUDJZ.js → chunk-UOIWIVU3.js} +2 -2
  60. package/dist/{chunk-JW3ZHQ7U.js → chunk-VX4PSOKU.js} +2 -2
  61. package/dist/{chunk-VG3NUHJX.js → chunk-XH36J3Z2.js} +2 -2
  62. package/dist/{chunk-FFPF7SAD.js → chunk-ZALVAXQ4.js} +2 -2
  63. package/dist/cli.js +1 -1
  64. package/dist/{client-CFS5VY26.js → client-YN3T56NM.js} +2 -2
  65. package/dist/{config-4R6DCRCN.js → config-G7T3TMWE.js} +2 -2
  66. package/dist/{config-mutate-EG5PS7KW.js → config-mutate-6CRKZQVQ.js} +2 -2
  67. package/dist/config-mutator-7VS3J5BY.js +2 -0
  68. package/dist/{contributions-G4FZ2PKZ.js → contributions-6VZ4OXJ5.js} +2 -2
  69. package/dist/{doctor-4VQ5RFWH.js → doctor-GFZZTK7C.js} +2 -2
  70. package/dist/{follow-up-tool-JJSFOO5D.js → follow-up-tool-NVP56W7E.js} +2 -2
  71. package/dist/{hub-Z3KDKP7M.js → hub-B434CABZ.js} +2 -2
  72. package/dist/index.d.ts +119 -7
  73. package/dist/index.js +1 -1
  74. package/dist/index.js.map +1 -1
  75. package/dist/{program-6UF4K6CK.js → program-IDRN5TAM.js} +255 -255
  76. package/dist/program-IDRN5TAM.js.map +1 -0
  77. package/dist/{promote-WJ5HXGJG.js → promote-3P6PGJOW.js} +2 -2
  78. package/dist/{query-7JPB2UBE.js → query-E4V7TS5S.js} +2 -2
  79. package/dist/query-runs-AENEZOM6.js +2 -0
  80. package/dist/{query-settings-O53GJRCB.js → query-settings-C5UBKJMN.js} +2 -2
  81. package/dist/registry-IG324PR3.js +2 -0
  82. package/dist/{request-planner-25WOUCP7.js → request-planner-G6IAUMSE.js} +2 -2
  83. package/dist/{review-candidates-KU3B6T5E.js → review-candidates-ZL2SJXWC.js} +2 -2
  84. package/dist/{routing-SJQB4SJM.js → routing-2IBIZYQU.js} +2 -2
  85. package/dist/schedule-tool-QCTT2R3B.js +2 -0
  86. package/dist/{scheduler-W3TMCBUH.js → scheduler-ZGB7IKZQ.js} +2 -2
  87. package/dist/{seat-NDZLFK4N.js → seat-CFY7LMPS.js} +2 -2
  88. package/dist/{select-3D3GZOBS.js → select-MU52ACKG.js} +2 -2
  89. package/dist/self-ELWZIMVY.js +2 -0
  90. package/dist/{set-enabled-ZUTWWK5S.js → set-enabled-XRNSYEI3.js} +2 -2
  91. package/dist/{sprint-tool-CAARUDXM.js → sprint-tool-E4MABD2N.js} +2 -2
  92. package/dist/{tool-3UIRQJZF.js → tool-V5Z4KWK7.js} +2 -2
  93. package/dist/{tool-HK7VOPB3.js → tool-W6M7GYRZ.js} +2 -2
  94. package/dist/{tool-GKPYCNZ3.js → tool-ZYVT4VUU.js} +2 -2
  95. package/dist/{wiki-F4YT226F.js → wiki-VP6XRWIS.js} +2 -2
  96. package/dist/wiki-enrich-LUFXPUYY.js +2 -0
  97. package/dist/wiki-enrich-LUFXPUYY.js.map +1 -0
  98. package/package.json +1 -1
  99. package/dist/board-dashboard-M3HOVCLM.js.map +0 -1
  100. package/dist/chunk-2FCYIEKT.js.map +0 -1
  101. package/dist/chunk-BZ2HOV4M.js.map +0 -1
  102. package/dist/chunk-CXAKD7XW.js +0 -114
  103. package/dist/chunk-CXAKD7XW.js.map +0 -1
  104. package/dist/chunk-CZMVJP7O.js +0 -2
  105. package/dist/chunk-CZMVJP7O.js.map +0 -1
  106. package/dist/chunk-E3UQEMNV.js +0 -188
  107. package/dist/chunk-E3UQEMNV.js.map +0 -1
  108. package/dist/chunk-JNJVRSOL.js +0 -36
  109. package/dist/chunk-JNJVRSOL.js.map +0 -1
  110. package/dist/chunk-KZPZ2O2F.js.map +0 -1
  111. package/dist/chunk-ORBEL4I4.js +0 -888
  112. package/dist/chunk-ORBEL4I4.js.map +0 -1
  113. package/dist/chunk-Y7HU4GHT.js +0 -7
  114. package/dist/config-mutator-YDVTCBQZ.js +0 -2
  115. package/dist/program-6UF4K6CK.js.map +0 -1
  116. package/dist/query-runs-VXS572PQ.js +0 -6
  117. package/dist/query-runs-VXS572PQ.js.map +0 -1
  118. package/dist/registry-WNKSI445.js +0 -2
  119. package/dist/schedule-tool-T6FHG77E.js +0 -2
  120. package/dist/self-SO6GCVYD.js +0 -2
  121. package/dist/wiki-enrich-E6YYAI2T.js +0 -2
  122. /package/dist/{App-N6WWCFBO.js.map → App-HBM52GXI.js.map} +0 -0
  123. /package/dist/{ChatApp-JMSINKZP.js.map → ChatApp-N4P7M2TD.js.map} +0 -0
  124. /package/dist/{absorb-eval-4LJ4R7GN.js.map → absorb-eval-HRWWPKT3.js.map} +0 -0
  125. /package/dist/{adapter-2Y3PQ5IZ.js.map → adapter-X6T3YBUB.js.map} +0 -0
  126. /package/dist/{agent-RSOKWOZ2.js.map → agent-3B4RMEDI.js.map} +0 -0
  127. /package/dist/{chunk-4IHQSNE3.js.map → chunk-2GCPSAXQ.js.map} +0 -0
  128. /package/dist/{chunk-PNWXXDTE.js.map → chunk-2KYGPVTX.js.map} +0 -0
  129. /package/dist/{chunk-RZS4BHCW.js.map → chunk-6NQ7KYJH.js.map} +0 -0
  130. /package/dist/{chunk-BSMT7MK4.js.map → chunk-7L54Z4EH.js.map} +0 -0
  131. /package/dist/{chunk-WWFMIAYZ.js.map → chunk-BOCLWYWL.js.map} +0 -0
  132. /package/dist/{chunk-OPBPH7IB.js.map → chunk-F3CMNSON.js.map} +0 -0
  133. /package/dist/{chunk-6FHKA62Y.js.map → chunk-FO762MEC.js.map} +0 -0
  134. /package/dist/{chunk-5XGQE2SN.js.map → chunk-HNZEXUNM.js.map} +0 -0
  135. /package/dist/{chunk-RZPQML3W.js.map → chunk-HOZZUN47.js.map} +0 -0
  136. /package/dist/{chunk-VGQDLAX3.js.map → chunk-K2BEV3BD.js.map} +0 -0
  137. /package/dist/{chunk-2HPVL6UM.js.map → chunk-KXJRXRSD.js.map} +0 -0
  138. /package/dist/{chunk-HNTWVZMH.js.map → chunk-LQIF2OHS.js.map} +0 -0
  139. /package/dist/{chunk-QQTSGXFB.js.map → chunk-MC3ZZA5G.js.map} +0 -0
  140. /package/dist/{chunk-7NXFW4LM.js.map → chunk-PMSL4A5Y.js.map} +0 -0
  141. /package/dist/{chunk-6DGMUN2Q.js.map → chunk-PX7PWXBI.js.map} +0 -0
  142. /package/dist/{chunk-UUQ2AHUL.js.map → chunk-RW5FKJRE.js.map} +0 -0
  143. /package/dist/{chunk-54LKUDJZ.js.map → chunk-UOIWIVU3.js.map} +0 -0
  144. /package/dist/{chunk-JW3ZHQ7U.js.map → chunk-VX4PSOKU.js.map} +0 -0
  145. /package/dist/{chunk-VG3NUHJX.js.map → chunk-XH36J3Z2.js.map} +0 -0
  146. /package/dist/{chunk-FFPF7SAD.js.map → chunk-ZALVAXQ4.js.map} +0 -0
  147. /package/dist/{client-CFS5VY26.js.map → client-YN3T56NM.js.map} +0 -0
  148. /package/dist/{config-4R6DCRCN.js.map → config-G7T3TMWE.js.map} +0 -0
  149. /package/dist/{config-mutate-EG5PS7KW.js.map → config-mutate-6CRKZQVQ.js.map} +0 -0
  150. /package/dist/{config-mutator-YDVTCBQZ.js.map → config-mutator-7VS3J5BY.js.map} +0 -0
  151. /package/dist/{contributions-G4FZ2PKZ.js.map → contributions-6VZ4OXJ5.js.map} +0 -0
  152. /package/dist/{doctor-4VQ5RFWH.js.map → doctor-GFZZTK7C.js.map} +0 -0
  153. /package/dist/{follow-up-tool-JJSFOO5D.js.map → follow-up-tool-NVP56W7E.js.map} +0 -0
  154. /package/dist/{hub-Z3KDKP7M.js.map → hub-B434CABZ.js.map} +0 -0
  155. /package/dist/{promote-WJ5HXGJG.js.map → promote-3P6PGJOW.js.map} +0 -0
  156. /package/dist/{query-7JPB2UBE.js.map → query-E4V7TS5S.js.map} +0 -0
  157. /package/dist/{registry-WNKSI445.js.map → query-runs-AENEZOM6.js.map} +0 -0
  158. /package/dist/{query-settings-O53GJRCB.js.map → query-settings-C5UBKJMN.js.map} +0 -0
  159. /package/dist/{routing-SJQB4SJM.js.map → registry-IG324PR3.js.map} +0 -0
  160. /package/dist/{request-planner-25WOUCP7.js.map → request-planner-G6IAUMSE.js.map} +0 -0
  161. /package/dist/{review-candidates-KU3B6T5E.js.map → review-candidates-ZL2SJXWC.js.map} +0 -0
  162. /package/dist/{schedule-tool-T6FHG77E.js.map → routing-2IBIZYQU.js.map} +0 -0
  163. /package/dist/{scheduler-W3TMCBUH.js.map → schedule-tool-QCTT2R3B.js.map} +0 -0
  164. /package/dist/{seat-NDZLFK4N.js.map → scheduler-ZGB7IKZQ.js.map} +0 -0
  165. /package/dist/{self-SO6GCVYD.js.map → seat-CFY7LMPS.js.map} +0 -0
  166. /package/dist/{select-3D3GZOBS.js.map → select-MU52ACKG.js.map} +0 -0
  167. /package/dist/{wiki-F4YT226F.js.map → self-ELWZIMVY.js.map} +0 -0
  168. /package/dist/{set-enabled-ZUTWWK5S.js.map → set-enabled-XRNSYEI3.js.map} +0 -0
  169. /package/dist/{sprint-tool-CAARUDXM.js.map → sprint-tool-E4MABD2N.js.map} +0 -0
  170. /package/dist/{tool-3UIRQJZF.js.map → tool-V5Z4KWK7.js.map} +0 -0
  171. /package/dist/{tool-HK7VOPB3.js.map → tool-W6M7GYRZ.js.map} +0 -0
  172. /package/dist/{tool-GKPYCNZ3.js.map → tool-ZYVT4VUU.js.map} +0 -0
  173. /package/dist/{wiki-enrich-E6YYAI2T.js.map → wiki-VP6XRWIS.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as _,b as F,c as K,d as z,e as J}from"./chunk-JTFCU5LH.js";import{a as j,b as I,c as Y,d as V,e as B,j as G}from"./chunk-RZS4BHCW.js";import{a as H}from"./chunk-LUOW2YHY.js";import{y as N,z as ot}from"./chunk-PNWXXDTE.js";import{h as Q}from"./chunk-QUFIUXMQ.js";import{b as E,c as L}from"./chunk-AHWWJ7AF.js";import{readFileSync as lt,existsSync as X}from"fs";ot();import{resolve as R}from"path";import{execSync as ct}from"child_process";var ht="haiku",dt="sonnet",pt=.8;function mt(e,r,o,t){if(t.size===0)return 0;let c=e.listArticles(r||"").map(l=>l.path).filter(l=>!l.includes("/_versions/"));return c.length===0&&(c=o.sharedPool.map(l=>l.path)),c.length===0?0:c.filter(l=>t.has(l)).length/c.length}async function _t(e,r,o,t={}){let c=t.selectorModel??ht,l=t.synthModel??dt,m=t.maxCandidates??3,g=t.maxHops??2,d=t.maxArticles??8,i=t.timeoutMs??6e4,s=t.log??console.error.bind(console,"[wiki-query]"),h=t.messagePath?.length?t.messagePath:void 0,n=t.graphWeight??W,a=R(r.baseDir,"_index.md"),p=tt(r,o,t.shared),b=t.method??"catalog";if(b!=="catalog"){let u=z(r,t.shared);if(b==="summaries"||mt(r,o,p,u)>=pt){let f=t.summaries??K,P=t.notes&&o&&t.notes.owner===o?F(t.notes):void 0,y=await J(e,P?gt(p,P):p,P?new Map([...u,...P.summaries]):u,{...f,navigatorModel:t.selectorModel??f.navigatorModel,answerModel:t.synthModel??f.answerModel},{call:t.call??H,fetch:t.fetch,timeoutMs:i,log:s}),$=y.picked.map(w=>({title:w.meta.title,path:w.path,type:_(w.path)?"note":w.meta.type,hop:w.hop}));return{answer:y.answer,citations:y.status==="ok"?$.map(({hop:w,...v})=>v):[],candidates:$.filter(w=>w.hop===0).map(({title:w,path:v})=>({title:w,path:v})),walked:$,status:y.status,method:"summaries",basis:y.basis,live:y.live,liveAsked:y.liveAsked,trace:y.trace,...y.error?{error:y.error}:{}}}}if(!X(a)&&p.sharedPool.length===0)return M("no-catalog",e,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let it=(X(a)?lt(a,"utf-8"):"")+yt(e,p.sharedPool,h,n),T=Date.now(),A=[],S="";try{let u=await nt(e,p.pool,o,m,h,n);u?(A=u,S=`[wiki-rerank seat] ${u.map(f=>f.title).join(" | ")}`):(S=await Z(wt(e,it,m,h),c,i),A=bt(S))}catch(u){return s("selector failed:",u?.message),{...M("error",e,`Selector: ${u?.message||"unknown"}`),trace:{selectorMs:Date.now()-T,synthesisMs:0,selectorOutput:S}}}let x=Date.now()-T;if(A.length===0)return{...M("no-candidates",e,"Selector returned no candidates."),trace:{selectorMs:x,synthesisMs:0,selectorOutput:S}};let C=rt(A,p,g,d);if(C.length===0)return{...M("no-candidates",e,"Candidates did not resolve to readable articles."),candidates:A,trace:{selectorMs:x,synthesisMs:0,selectorOutput:S}};let D=Date.now(),U="";try{U=await Z(kt(e,C),l,i*2)}catch(u){return s("synthesis failed:",u?.message),{...M("error",e,`Synthesis: ${u?.message||"unknown"}`),candidates:A,walked:C.map(f=>({title:f.meta.title,path:f.path,type:f.meta.type,hop:f.hop??0})),trace:{selectorMs:x,synthesisMs:Date.now()-D,selectorOutput:S}}}let st=Date.now()-D;return{answer:U.trim(),citations:C.map(u=>({title:u.meta.title,path:u.path,type:u.meta.type})),candidates:A,walked:C.map(u=>({title:u.meta.title,path:u.path,type:u.meta.type,hop:u.hop??0})),status:"ok",trace:{selectorMs:x,synthesisMs:st,selectorOutput:S}}}async function Rt(e,r,o,t={}){let c=t.maxCandidates??3,l=t.graphWeight??W,m=t.messagePath?.length?t.messagePath:void 0,g=t.pool??q(r);if(g.length===0||!e.trim())return[];let d=await nt(e,g,o,c,m,l,t.stage??"retrieve");if(!d){let i=new Set(L(e,E(g.map(at))).map(s=>s.docIndex));d=O(e,g,m,l).filter(s=>i.has(s)).slice(0,c).map(s=>({title:g[s].title,path:g[s].path}))}return d.length===0?[]:rt(d,tt(r,o),t.maxHops??1,t.maxArticles??6)}function q(e){try{return(e.rebuildIndex().articles??[]).filter(r=>r.path&&!r.path.includes("/_versions/"))}catch{return[]}}function M(e,r,o){return{answer:"",citations:[],candidates:[],walked:[],status:e,error:o}}function tt(e,r,o=[]){let t=new Map,c=[];for(let i of e.listArticles(r||""))t.set(i.meta.title.toLowerCase(),i.path),c.push({path:i.path,related:i.meta.related??[],lastUpdated:i.meta.lastUpdated??""});let l=[],m=new Map;for(let i of o)if(i.store.baseDir!==e.baseDir){m.set(i.id,i);for(let s of i.store.listArticles(r||"")){if(s.path.includes("/_versions/")||i.skip?.(s.path))continue;let h=`@${i.id}/${s.path}`;l.push(ut(s,h)),c.push({path:h,related:s.meta.related??[],lastUpdated:s.meta.lastUpdated??""});let n=s.meta.title.toLowerCase();t.has(n)||t.set(n,h)}}let g=new Map;if(m.size>0)for(let i of[...c].sort((s,h)=>h.lastUpdated.localeCompare(s.lastUpdated)))for(let s of i.related){let h=s.toLowerCase(),n=g.get(h)??[];n.includes(i.path)||n.push(i.path),g.set(h,n)}let d;return{backlinks:g,readable:new Set(c.map(i=>i.path)),get pool(){return d??=[...q(e),...l]},sharedPool:l,titleIndex:t,read(i){let s=i.match(/^@([^/]+)\/(.+)$/),h=s?m.get(s[1]):void 0;if(s&&!h)return null;let n=h?.store??e,a=s?s[2]:i,p=r?n.readArticleAs(a,r):n.readArticle(a);return p?{...p,path:i}:null},links(i){let s=(i.meta.related??[]).map(a=>t.get(a.toLowerCase())).filter(a=>!!a),h=[i.meta.title,...i.meta.aliases??[]].map(a=>a.toLowerCase()),n=[...new Set(h.flatMap(a=>g.get(a)??[]))].filter(a=>a!==i.path).slice(0,et);return[...new Set([...s,...n])].filter(a=>a!==i.path)}}}function gt(e,r){return{...e,pool:[...e.pool,...r.pool],readable:new Set([...e.readable,...r.pool.map(o=>o.path)]),read:o=>_(o)?r.read(o):e.read(o)}}function ut(e,r){return{path:r,title:e.meta.title,type:e.meta.type,related:e.meta.related,tags:e.meta.tags||[],owner:e.meta.owner,access:e.meta.access,sharedWith:e.meta.sharedWith,aliases:[e.meta.title.toLowerCase(),...(e.meta.aliases??[]).map(o=>o.toLowerCase())],backlinks:0,sources:e.meta.sources,lastUpdated:e.meta.lastUpdated,graphPath:e.meta.graphPath}}var ft=150;function yt(e,r,o,t){return r.length===0?"":`
1
+ import{a as _,b as F,c as K,d as z,e as J}from"./chunk-JTFCU5LH.js";import{a as j,b as I,c as Y,d as V,e as B,j as G}from"./chunk-6NQ7KYJH.js";import{a as H}from"./chunk-LUOW2YHY.js";import{y as N,z as ot}from"./chunk-2KYGPVTX.js";import{h as Q}from"./chunk-QUFIUXMQ.js";import{b as E,c as L}from"./chunk-AHWWJ7AF.js";import{readFileSync as lt,existsSync as X}from"fs";ot();import{resolve as R}from"path";import{execSync as ct}from"child_process";var ht="haiku",dt="sonnet",pt=.8;function mt(e,r,o,t){if(t.size===0)return 0;let c=e.listArticles(r||"").map(l=>l.path).filter(l=>!l.includes("/_versions/"));return c.length===0&&(c=o.sharedPool.map(l=>l.path)),c.length===0?0:c.filter(l=>t.has(l)).length/c.length}async function _t(e,r,o,t={}){let c=t.selectorModel??ht,l=t.synthModel??dt,m=t.maxCandidates??3,g=t.maxHops??2,d=t.maxArticles??8,i=t.timeoutMs??6e4,s=t.log??console.error.bind(console,"[wiki-query]"),h=t.messagePath?.length?t.messagePath:void 0,n=t.graphWeight??W,a=R(r.baseDir,"_index.md"),p=tt(r,o,t.shared),b=t.method??"catalog";if(b!=="catalog"){let u=z(r,t.shared);if(b==="summaries"||mt(r,o,p,u)>=pt){let f=t.summaries??K,P=t.notes&&o&&t.notes.owner===o?F(t.notes):void 0,y=await J(e,P?gt(p,P):p,P?new Map([...u,...P.summaries]):u,{...f,navigatorModel:t.selectorModel??f.navigatorModel,answerModel:t.synthModel??f.answerModel},{call:t.call??H,fetch:t.fetch,timeoutMs:i,log:s}),$=y.picked.map(w=>({title:w.meta.title,path:w.path,type:_(w.path)?"note":w.meta.type,hop:w.hop}));return{answer:y.answer,citations:y.status==="ok"?$.map(({hop:w,...v})=>v):[],candidates:$.filter(w=>w.hop===0).map(({title:w,path:v})=>({title:w,path:v})),walked:$,status:y.status,method:"summaries",basis:y.basis,live:y.live,liveAsked:y.liveAsked,trace:y.trace,...y.error?{error:y.error}:{}}}}if(!X(a)&&p.sharedPool.length===0)return M("no-catalog",e,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let it=(X(a)?lt(a,"utf-8"):"")+yt(e,p.sharedPool,h,n),T=Date.now(),A=[],S="";try{let u=await nt(e,p.pool,o,m,h,n);u?(A=u,S=`[wiki-rerank seat] ${u.map(f=>f.title).join(" | ")}`):(S=await Z(wt(e,it,m,h),c,i),A=bt(S))}catch(u){return s("selector failed:",u?.message),{...M("error",e,`Selector: ${u?.message||"unknown"}`),trace:{selectorMs:Date.now()-T,synthesisMs:0,selectorOutput:S}}}let x=Date.now()-T;if(A.length===0)return{...M("no-candidates",e,"Selector returned no candidates."),trace:{selectorMs:x,synthesisMs:0,selectorOutput:S}};let C=rt(A,p,g,d);if(C.length===0)return{...M("no-candidates",e,"Candidates did not resolve to readable articles."),candidates:A,trace:{selectorMs:x,synthesisMs:0,selectorOutput:S}};let D=Date.now(),U="";try{U=await Z(kt(e,C),l,i*2)}catch(u){return s("synthesis failed:",u?.message),{...M("error",e,`Synthesis: ${u?.message||"unknown"}`),candidates:A,walked:C.map(f=>({title:f.meta.title,path:f.path,type:f.meta.type,hop:f.hop??0})),trace:{selectorMs:x,synthesisMs:Date.now()-D,selectorOutput:S}}}let st=Date.now()-D;return{answer:U.trim(),citations:C.map(u=>({title:u.meta.title,path:u.path,type:u.meta.type})),candidates:A,walked:C.map(u=>({title:u.meta.title,path:u.path,type:u.meta.type,hop:u.hop??0})),status:"ok",trace:{selectorMs:x,synthesisMs:st,selectorOutput:S}}}async function Rt(e,r,o,t={}){let c=t.maxCandidates??3,l=t.graphWeight??W,m=t.messagePath?.length?t.messagePath:void 0,g=t.pool??q(r);if(g.length===0||!e.trim())return[];let d=await nt(e,g,o,c,m,l,t.stage??"retrieve");if(!d){let i=new Set(L(e,E(g.map(at))).map(s=>s.docIndex));d=O(e,g,m,l).filter(s=>i.has(s)).slice(0,c).map(s=>({title:g[s].title,path:g[s].path}))}return d.length===0?[]:rt(d,tt(r,o),t.maxHops??1,t.maxArticles??6)}function q(e){try{return(e.rebuildIndex().articles??[]).filter(r=>r.path&&!r.path.includes("/_versions/"))}catch{return[]}}function M(e,r,o){return{answer:"",citations:[],candidates:[],walked:[],status:e,error:o}}function tt(e,r,o=[]){let t=new Map,c=[];for(let i of e.listArticles(r||""))t.set(i.meta.title.toLowerCase(),i.path),c.push({path:i.path,related:i.meta.related??[],lastUpdated:i.meta.lastUpdated??""});let l=[],m=new Map;for(let i of o)if(i.store.baseDir!==e.baseDir){m.set(i.id,i);for(let s of i.store.listArticles(r||"")){if(s.path.includes("/_versions/")||i.skip?.(s.path))continue;let h=`@${i.id}/${s.path}`;l.push(ut(s,h)),c.push({path:h,related:s.meta.related??[],lastUpdated:s.meta.lastUpdated??""});let n=s.meta.title.toLowerCase();t.has(n)||t.set(n,h)}}let g=new Map;if(m.size>0)for(let i of[...c].sort((s,h)=>h.lastUpdated.localeCompare(s.lastUpdated)))for(let s of i.related){let h=s.toLowerCase(),n=g.get(h)??[];n.includes(i.path)||n.push(i.path),g.set(h,n)}let d;return{backlinks:g,readable:new Set(c.map(i=>i.path)),get pool(){return d??=[...q(e),...l]},sharedPool:l,titleIndex:t,read(i){let s=i.match(/^@([^/]+)\/(.+)$/),h=s?m.get(s[1]):void 0;if(s&&!h)return null;let n=h?.store??e,a=s?s[2]:i,p=r?n.readArticleAs(a,r):n.readArticle(a);return p?{...p,path:i}:null},links(i){let s=(i.meta.related??[]).map(a=>t.get(a.toLowerCase())).filter(a=>!!a),h=[i.meta.title,...i.meta.aliases??[]].map(a=>a.toLowerCase()),n=[...new Set(h.flatMap(a=>g.get(a)??[]))].filter(a=>a!==i.path).slice(0,et);return[...new Set([...s,...n])].filter(a=>a!==i.path)}}}function gt(e,r){return{...e,pool:[...e.pool,...r.pool],readable:new Set([...e.readable,...r.pool.map(o=>o.path)]),read:o=>_(o)?r.read(o):e.read(o)}}function ut(e,r){return{path:r,title:e.meta.title,type:e.meta.type,related:e.meta.related,tags:e.meta.tags||[],owner:e.meta.owner,access:e.meta.access,sharedWith:e.meta.sharedWith,aliases:[e.meta.title.toLowerCase(),...(e.meta.aliases??[]).map(o=>o.toLowerCase())],backlinks:0,sources:e.meta.sources,lastUpdated:e.meta.lastUpdated,graphPath:e.meta.graphPath}}var ft=150;function yt(e,r,o,t){return r.length===0?"":`
2
2
 
3
3
  ## Shared wiki (other agents' articles)
4
4
 
@@ -51,5 +51,5 @@ ${o}
51
51
 
52
52
  Answer the question in 2\u20136 sentences. Cite articles by their title in square brackets like [Article Title]. When two articles disagree, prefer the one updated more recently, and say which agent's page and date the answer comes from. If the articles do not answer the question, say so plainly (do not invent). Prefer concrete facts over hedging.
53
53
 
54
- Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function bt(e){let r=e.match(/\[[\s\S]*?\]/);if(!r)return[];try{let o=JSON.parse(r[0]);return Array.isArray(o)?o.filter(t=>t&&typeof t.title=="string"&&typeof t.path=="string").map(t=>({title:t.title,path:t.path})):[]}catch{return[]}}async function Z(e,r,o){let{writeFileSync:t,mkdirSync:c,rmSync:l}=await import("fs"),{tmpdir:m}=await import("os"),g=R(m(),`agentx-wiki-query-${process.pid}`);c(g,{recursive:!0});let d=R(g,`prompt-${Date.now()}.txt`);t(d,e);try{let i=`cat '${d}' | claude -p - --output-format json --max-turns 1 --model ${r} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,s=ct(i,{env:Q(),encoding:"utf-8",timeout:o,maxBuffer:4*1024*1024});try{let h=JSON.parse(s);return String(h.result||h.content||"")}catch{return s}}finally{try{l(d,{force:!0})}catch{}}}async function Ot(e){try{let{loadDaemonConfig:r}=await import("./config-4R6DCRCN.js");return r(e).wiki.query.shared}catch{return!0}}export{ht as a,dt as b,pt as c,_t as d,Rt as e,q as f,ft as g,W as h,O as i,Ot as j};
55
- //# sourceMappingURL=chunk-7NXFW4LM.js.map
54
+ Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function bt(e){let r=e.match(/\[[\s\S]*?\]/);if(!r)return[];try{let o=JSON.parse(r[0]);return Array.isArray(o)?o.filter(t=>t&&typeof t.title=="string"&&typeof t.path=="string").map(t=>({title:t.title,path:t.path})):[]}catch{return[]}}async function Z(e,r,o){let{writeFileSync:t,mkdirSync:c,rmSync:l}=await import("fs"),{tmpdir:m}=await import("os"),g=R(m(),`agentx-wiki-query-${process.pid}`);c(g,{recursive:!0});let d=R(g,`prompt-${Date.now()}.txt`);t(d,e);try{let i=`cat '${d}' | claude -p - --output-format json --max-turns 1 --model ${r} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,s=ct(i,{env:Q(),encoding:"utf-8",timeout:o,maxBuffer:4*1024*1024});try{let h=JSON.parse(s);return String(h.result||h.content||"")}catch{return s}}finally{try{l(d,{force:!0})}catch{}}}async function Ot(e){try{let{loadDaemonConfig:r}=await import("./config-G7T3TMWE.js");return r(e).wiki.query.shared}catch{return!0}}export{ht as a,dt as b,pt as c,_t as d,Rt as e,q as f,ft as g,W as h,O as i,Ot as j};
55
+ //# sourceMappingURL=chunk-PMSL4A5Y.js.map