agentix-cli 0.53.0 → 0.55.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 (148) hide show
  1. package/apps/mac-voice/Sources/AgentXVoice/AgentClient.swift +26 -0
  2. package/apps/mac-voice/Sources/AgentXVoice/StatusMenu.swift +55 -3
  3. package/apps/mac-voice/Sources/AgentXVoice/main.swift +136 -13
  4. package/dist/{App-R62ZQVSF.js → App-4EM7IPB3.js} +2 -2
  5. package/dist/{ChatApp-AS567EFE.js → ChatApp-FYTEEGSU.js} +2 -2
  6. package/dist/{agent-H4NB4BUA.js → agent-RZ46ZB4W.js} +2 -2
  7. package/dist/{board-dashboard-E3MUVNVQ.js → board-dashboard-NRRYCDZW.js} +1097 -215
  8. package/dist/board-dashboard-NRRYCDZW.js.map +1 -0
  9. package/dist/chunk-2D3RYIDU.js +3 -0
  10. package/dist/chunk-2D3RYIDU.js.map +1 -0
  11. package/dist/{chunk-KB7YIM3W.js → chunk-4HEVSWO3.js} +2 -2
  12. package/dist/{chunk-7DPKPBRJ.js → chunk-6AK6WKE5.js} +2 -2
  13. package/dist/{chunk-TH5KNJLA.js → chunk-723K4SAW.js} +2 -2
  14. package/dist/{chunk-OMTRHHZJ.js → chunk-76AHNHWC.js} +44 -45
  15. package/dist/chunk-76AHNHWC.js.map +1 -0
  16. package/dist/{chunk-KJWBQZT7.js → chunk-C3VRBEJ7.js} +2 -2
  17. package/dist/{chunk-C5JXPMTW.js → chunk-CELYD5QW.js} +2 -2
  18. package/dist/{chunk-FSZXY53Z.js → chunk-D3LSPFHK.js} +2 -2
  19. package/dist/chunk-EJ5ISSWW.js +151 -0
  20. package/dist/chunk-EJ5ISSWW.js.map +1 -0
  21. package/dist/{chunk-FS4WBYY3.js → chunk-EZN2YXRY.js} +2 -2
  22. package/dist/{chunk-QU6ZUKAD.js → chunk-GSOL2LW6.js} +2 -2
  23. package/dist/{chunk-7OWXFLAM.js → chunk-JC5Q5MPI.js} +171 -164
  24. package/dist/chunk-JC5Q5MPI.js.map +1 -0
  25. package/dist/{chunk-SABOPOYX.js → chunk-K4RDE6YU.js} +211 -197
  26. package/dist/chunk-K4RDE6YU.js.map +1 -0
  27. package/dist/{ntfy-ZY2NPGBA.js → chunk-KZKDVIOE.js} +3 -3
  28. package/dist/chunk-KZKDVIOE.js.map +1 -0
  29. package/dist/{chunk-VD4TMPJI.js → chunk-LKJSPO3S.js} +2 -2
  30. package/dist/{chunk-NF52Q3TV.js → chunk-M4AG2YNX.js} +2 -2
  31. package/dist/{chunk-WKTFP3SK.js → chunk-NO2HOK4B.js} +2 -2
  32. package/dist/{chunk-KFG6WWFS.js → chunk-O3XG2NVR.js} +18 -18
  33. package/dist/{chunk-KFG6WWFS.js.map → chunk-O3XG2NVR.js.map} +1 -1
  34. package/dist/chunk-QD6IICK7.js +2 -0
  35. package/dist/chunk-QD6IICK7.js.map +1 -0
  36. package/dist/{chunk-PGJL5V6Y.js → chunk-SA23V7WX.js} +2 -2
  37. package/dist/chunk-U4H35SJS.js +15 -0
  38. package/dist/chunk-U4H35SJS.js.map +1 -0
  39. package/dist/chunk-UIVHSYCN.js +29 -0
  40. package/dist/chunk-UIVHSYCN.js.map +1 -0
  41. package/dist/{chunk-6OOK7Y4S.js → chunk-W4YMMWJL.js} +2 -2
  42. package/dist/chunk-WOMQ2VGA.js +5 -0
  43. package/dist/{chunk-OV35MJKS.js.map → chunk-WOMQ2VGA.js.map} +1 -1
  44. package/dist/chunk-WWMFNLKD.js +10 -0
  45. package/dist/chunk-WWMFNLKD.js.map +1 -0
  46. package/dist/chunk-X5C5W3E4.js +3 -0
  47. package/dist/chunk-X5C5W3E4.js.map +1 -0
  48. package/dist/{chunk-CCMM5TP4.js → chunk-XEOAKD5C.js} +2 -2
  49. package/dist/cli.js +1 -1
  50. package/dist/cli.js.map +1 -1
  51. package/dist/client-IA7ZPE56.js +2 -0
  52. package/dist/{compaction-NWPBPWY2.js → compaction-H5U32UU6.js} +2 -2
  53. package/dist/config-HPN2F7LH.js +2 -0
  54. package/dist/config-mutator-7GPTMTVB.js +2 -0
  55. package/dist/doctor-IBWQVQV4.js +2 -0
  56. package/dist/index.d.ts +273 -19
  57. package/dist/index.js +1 -1
  58. package/dist/index.js.map +1 -1
  59. package/dist/memory-extract-F76BE6KA.js +2 -0
  60. package/dist/ntfy-52EXHVMD.js +2 -0
  61. package/dist/program-D5TAPSIH.js +2 -0
  62. package/dist/{promote-DJFMTLRC.js → promote-T4UJROEH.js} +2 -2
  63. package/dist/push-HEDA6P3B.js +2 -0
  64. package/dist/push-HEDA6P3B.js.map +1 -0
  65. package/dist/push-keys-2DTD7YNQ.js +2 -0
  66. package/dist/push-store-LXTYULUF.js +2 -0
  67. package/dist/query-VUJC4Y5O.js +2 -0
  68. package/dist/registry-DX2RI7I7.js +2 -0
  69. package/dist/{request-planner-2H7HCUCZ.js → request-planner-B7DE7VJR.js} +2 -2
  70. package/dist/{review-candidates-U7R64OCS.js → review-candidates-4YJHIBAF.js} +2 -2
  71. package/dist/routing-MZG3UODH.js +2 -0
  72. package/dist/schedule-tool-A4OFQ4YZ.js +2 -0
  73. package/dist/scheduler-RHJW2V4M.js +2 -0
  74. package/dist/scheduler-RHJW2V4M.js.map +1 -0
  75. package/dist/seat-2PEI7JRX.js +2 -0
  76. package/dist/seat-2PEI7JRX.js.map +1 -0
  77. package/dist/{select-XGK27RPP.js → select-4KIUR27O.js} +2 -2
  78. package/dist/{set-enabled-7YGN2FAZ.js → set-enabled-SE7HQKPF.js} +2 -2
  79. package/dist/subscriptions-RYVPHVIV.js +2 -0
  80. package/dist/subscriptions-RYVPHVIV.js.map +1 -0
  81. package/dist/{tool-HKDIZ6I4.js → tool-5VMD7IE4.js} +2 -2
  82. package/dist/wiki-2QFLAH4U.js +2 -0
  83. package/dist/wiki-2QFLAH4U.js.map +1 -0
  84. package/package.json +3 -1
  85. package/dist/board-dashboard-E3MUVNVQ.js.map +0 -1
  86. package/dist/chunk-47EEUZBK.js +0 -15
  87. package/dist/chunk-47EEUZBK.js.map +0 -1
  88. package/dist/chunk-7OWXFLAM.js.map +0 -1
  89. package/dist/chunk-D4HAR3L3.js +0 -28
  90. package/dist/chunk-D4HAR3L3.js.map +0 -1
  91. package/dist/chunk-HRBKSZ34.js +0 -2
  92. package/dist/chunk-HRBKSZ34.js.map +0 -1
  93. package/dist/chunk-IDYP7G7Z.js +0 -150
  94. package/dist/chunk-IDYP7G7Z.js.map +0 -1
  95. package/dist/chunk-OMTRHHZJ.js.map +0 -1
  96. package/dist/chunk-OV35MJKS.js +0 -5
  97. package/dist/chunk-SABOPOYX.js.map +0 -1
  98. package/dist/client-XTQDYMOX.js +0 -2
  99. package/dist/config-3SW4V44Z.js +0 -2
  100. package/dist/config-mutator-H32FXUYJ.js +0 -2
  101. package/dist/doctor-J6RCHFVE.js +0 -2
  102. package/dist/memory-extract-MGGXIZTE.js +0 -2
  103. package/dist/ntfy-ZY2NPGBA.js.map +0 -1
  104. package/dist/program-SQTOPCQW.js +0 -2
  105. package/dist/query-UAZUMU4N.js +0 -2
  106. package/dist/registry-4OUBA2TY.js +0 -2
  107. package/dist/routing-LVQH6WOJ.js +0 -2
  108. package/dist/schedule-tool-2BONJVCJ.js +0 -2
  109. package/dist/scheduler-7CEXDECA.js +0 -2
  110. package/dist/seat-2KGFNCIW.js +0 -2
  111. package/dist/wiki-6YT7B5HU.js +0 -2
  112. /package/dist/{App-R62ZQVSF.js.map → App-4EM7IPB3.js.map} +0 -0
  113. /package/dist/{ChatApp-AS567EFE.js.map → ChatApp-FYTEEGSU.js.map} +0 -0
  114. /package/dist/{agent-H4NB4BUA.js.map → agent-RZ46ZB4W.js.map} +0 -0
  115. /package/dist/{chunk-KB7YIM3W.js.map → chunk-4HEVSWO3.js.map} +0 -0
  116. /package/dist/{chunk-7DPKPBRJ.js.map → chunk-6AK6WKE5.js.map} +0 -0
  117. /package/dist/{chunk-TH5KNJLA.js.map → chunk-723K4SAW.js.map} +0 -0
  118. /package/dist/{chunk-KJWBQZT7.js.map → chunk-C3VRBEJ7.js.map} +0 -0
  119. /package/dist/{chunk-C5JXPMTW.js.map → chunk-CELYD5QW.js.map} +0 -0
  120. /package/dist/{chunk-FSZXY53Z.js.map → chunk-D3LSPFHK.js.map} +0 -0
  121. /package/dist/{chunk-FS4WBYY3.js.map → chunk-EZN2YXRY.js.map} +0 -0
  122. /package/dist/{chunk-QU6ZUKAD.js.map → chunk-GSOL2LW6.js.map} +0 -0
  123. /package/dist/{chunk-VD4TMPJI.js.map → chunk-LKJSPO3S.js.map} +0 -0
  124. /package/dist/{chunk-NF52Q3TV.js.map → chunk-M4AG2YNX.js.map} +0 -0
  125. /package/dist/{chunk-WKTFP3SK.js.map → chunk-NO2HOK4B.js.map} +0 -0
  126. /package/dist/{chunk-PGJL5V6Y.js.map → chunk-SA23V7WX.js.map} +0 -0
  127. /package/dist/{chunk-6OOK7Y4S.js.map → chunk-W4YMMWJL.js.map} +0 -0
  128. /package/dist/{chunk-CCMM5TP4.js.map → chunk-XEOAKD5C.js.map} +0 -0
  129. /package/dist/{client-XTQDYMOX.js.map → client-IA7ZPE56.js.map} +0 -0
  130. /package/dist/{compaction-NWPBPWY2.js.map → compaction-H5U32UU6.js.map} +0 -0
  131. /package/dist/{config-3SW4V44Z.js.map → config-HPN2F7LH.js.map} +0 -0
  132. /package/dist/{config-mutator-H32FXUYJ.js.map → config-mutator-7GPTMTVB.js.map} +0 -0
  133. /package/dist/{doctor-J6RCHFVE.js.map → doctor-IBWQVQV4.js.map} +0 -0
  134. /package/dist/{memory-extract-MGGXIZTE.js.map → memory-extract-F76BE6KA.js.map} +0 -0
  135. /package/dist/{program-SQTOPCQW.js.map → ntfy-52EXHVMD.js.map} +0 -0
  136. /package/dist/{promote-DJFMTLRC.js.map → program-D5TAPSIH.js.map} +0 -0
  137. /package/dist/{query-UAZUMU4N.js.map → promote-T4UJROEH.js.map} +0 -0
  138. /package/dist/{registry-4OUBA2TY.js.map → push-keys-2DTD7YNQ.js.map} +0 -0
  139. /package/dist/{routing-LVQH6WOJ.js.map → push-store-LXTYULUF.js.map} +0 -0
  140. /package/dist/{schedule-tool-2BONJVCJ.js.map → query-VUJC4Y5O.js.map} +0 -0
  141. /package/dist/{scheduler-7CEXDECA.js.map → registry-DX2RI7I7.js.map} +0 -0
  142. /package/dist/{request-planner-2H7HCUCZ.js.map → request-planner-B7DE7VJR.js.map} +0 -0
  143. /package/dist/{review-candidates-U7R64OCS.js.map → review-candidates-4YJHIBAF.js.map} +0 -0
  144. /package/dist/{seat-2KGFNCIW.js.map → routing-MZG3UODH.js.map} +0 -0
  145. /package/dist/{wiki-6YT7B5HU.js.map → schedule-tool-A4OFQ4YZ.js.map} +0 -0
  146. /package/dist/{select-XGK27RPP.js.map → select-4KIUR27O.js.map} +0 -0
  147. /package/dist/{set-enabled-7YGN2FAZ.js.map → set-enabled-SE7HQKPF.js.map} +0 -0
  148. /package/dist/{tool-HKDIZ6I4.js.map → tool-5VMD7IE4.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import{k as m,l as $,p as x}from"./chunk-47EEUZBK.js";x();import{readFileSync as S,writeFileSync as P,existsSync as b}from"fs";import{resolve as f}from"path";function w(r){if(r)return f(r);let e=[f(process.cwd(),"agentx.json"),f(process.cwd(),".agentx/config.json")];for(let n of e)if(b(n))return n;return e[0]}function v(r){return JSON.parse(JSON.stringify(r))}async function O(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/reload`,{method:"POST",signal:AbortSignal.timeout(3e3)});return e.ok?{ok:!0}:{ok:!1,reason:`HTTP ${e.status}`}}catch(e){return{ok:!1,reason:e?.cause?.code||e?.message||"unreachable"}}}async function J(r,e={}){let{validate:n=!0,dryRun:t=!1,reload:s=!0,configPath:u,daemonUrl:c}=e,o=w(u);if(!b(o))return{success:!1,path:o,error:`Config not found at ${o}. Run \`agentx init\` first.`};let d;try{d=S(o,"utf-8")}catch(a){return{success:!1,path:o,error:`Cannot read ${o}: ${a.message}`}}let g;try{g=JSON.parse(d)}catch(a){return{success:!1,path:o,error:`Invalid JSON in ${o}: ${a.message}`}}let i=v(g);try{await r(i)}catch(a){return{success:!1,path:o,error:`Mutator threw: ${a.message}`}}if(n){let a=$(i),l=m.safeParse(a);if(!l.success){let k=l.error.issues.map(y=>` ${y.path.join(".")||"<root>"}: ${y.message}`).join(`
1
+ import{l as m,m as $,q as x}from"./chunk-U4H35SJS.js";x();import{readFileSync as S,writeFileSync as P,existsSync as b}from"fs";import{resolve as f}from"path";function w(r){if(r)return f(r);let e=[f(process.cwd(),"agentx.json"),f(process.cwd(),".agentx/config.json")];for(let n of e)if(b(n))return n;return e[0]}function v(r){return JSON.parse(JSON.stringify(r))}async function O(r){try{let e=await fetch(`${r.replace(/\/$/,"")}/reload`,{method:"POST",signal:AbortSignal.timeout(3e3)});return e.ok?{ok:!0}:{ok:!1,reason:`HTTP ${e.status}`}}catch(e){return{ok:!1,reason:e?.cause?.code||e?.message||"unreachable"}}}async function J(r,e={}){let{validate:n=!0,dryRun:t=!1,reload:s=!0,configPath:u,daemonUrl:c}=e,o=w(u);if(!b(o))return{success:!1,path:o,error:`Config not found at ${o}. Run \`agentx init\` first.`};let d;try{d=S(o,"utf-8")}catch(a){return{success:!1,path:o,error:`Cannot read ${o}: ${a.message}`}}let g;try{g=JSON.parse(d)}catch(a){return{success:!1,path:o,error:`Invalid JSON in ${o}: ${a.message}`}}let i=v(g);try{await r(i)}catch(a){return{success:!1,path:o,error:`Mutator threw: ${a.message}`}}if(n){let a=$(i),l=m.safeParse(a);if(!l.success){let k=l.error.issues.map(y=>` ${y.path.join(".")||"<root>"}: ${y.message}`).join(`
2
2
  `);return{success:!1,path:o,error:`Validation failed:
3
3
  ${k}`,after:i}}}if(t)return{success:!0,path:o,after:i,dryRun:!0};try{P(o,JSON.stringify(i,null,2)+`
4
4
  `)}catch(a){return{success:!1,path:o,error:`Write failed: ${a.message}`,after:i}}let p=!1,h;if(s){let a=c||R(i),l=await O(a);l.ok?p=!0:h=l.reason}return{success:!0,path:o,after:i,reloaded:p,reloadSkipped:h}}function R(r){let e=r?.node?.bind;if(!e)return"http://127.0.0.1:18800";let[n,t]=e.split(":");return`http://${n==="0.0.0.0"||n==="::"?"127.0.0.1":n}:${t}`}function N(r,e,n){let t=e.split("."),s=r;for(let u=0;u<t.length-1;u++){let c=t[u];(s[c]===void 0||s[c]===null)&&(s[c]={}),s=s[c]}s[t[t.length-1]]=n}function j(r,e){let n=e.split("."),t=r;for(let s of n){if(t==null)return;t=t[s]}return t}function A(r,e){let n=e.split("."),t=r;for(let s=0;s<n.length-1;s++){if(t==null)return;t=t[n[s]]}t!=null&&delete t[n[n.length-1]]}export{w as a,J as b,N as c,j as d,A as e};
5
- //# sourceMappingURL=chunk-FS4WBYY3.js.map
5
+ //# sourceMappingURL=chunk-EZN2YXRY.js.map
@@ -1,4 +1,4 @@
1
- import{a as R,b as j,c as O,d as W,e as D}from"./chunk-TFVUOC2C.js";import{b as C}from"./chunk-2GIDVZ4H.js";import{v,w as Q}from"./chunk-NF52Q3TV.js";import{b as $,c as M}from"./chunk-QOYAX2FT.js";import{readFileSync as T,existsSync as _}from"fs";Q();import{resolve as b}from"path";import{execSync as Y}from"child_process";async function V(n,i,s,e={}){let d=e.selectorModel??"haiku",a=e.synthModel??"sonnet",c=e.maxCandidates??3,l=e.maxHops??2,r=e.maxArticles??8,p=e.timeoutMs??6e4,u=e.log??console.error.bind(console,"[wiki-query]"),h=b(i.baseDir,"_index.md");if(!_(h))return w("no-catalog",n,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let k=T(h,"utf-8"),t=Date.now(),g=[],m="";try{let o=await B(n,i,s,c);o?(g=o,m=`[wiki-rerank seat] ${o.map(y=>y.title).join(" | ")}`):(m=await N(I(n,k,c),d,p),g=F(m))}catch(o){return u("selector failed:",o?.message),{...w("error",n,`Selector: ${o?.message||"unknown"}`),trace:{selectorMs:Date.now()-t,synthesisMs:0,selectorOutput:m}}}let A=Date.now()-t;if(g.length===0)return{...w("no-candidates",n,"Selector returned no candidates."),trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let f=E(g,i,s,l,r);if(f.length===0)return{...w("no-candidates",n,"Candidates did not resolve to readable articles."),candidates:g,trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let S=Date.now(),x="";try{x=await N(L(n,f),a,p*2)}catch(o){return u("synthesis failed:",o?.message),{...w("error",n,`Synthesis: ${o?.message||"unknown"}`),candidates:g,walked:f.map(y=>({title:y.meta.title,path:y.path,type:y.meta.type,hop:y.hop??0})),trace:{selectorMs:A,synthesisMs:Date.now()-S,selectorOutput:m}}}let P=Date.now()-S;return{answer:x.trim(),citations:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type})),candidates:g,walked:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type,hop:o.hop??0})),status:"ok",trace:{selectorMs:A,synthesisMs:P,selectorOutput:m}}}function w(n,i,s){return{answer:"",citations:[],candidates:[],walked:[],status:n,error:s}}function E(n,i,s,e,d){let a=new Map;for(let r of i.listArticles(s||""))a.set(r.meta.title.toLowerCase(),r.path);let c=new Map,l=[];for(let r of n)c.has(r.path)||l.push({path:r.path,hop:0});for(;l.length&&c.size<d;){let r=l.shift();if(c.has(r.path)||r.hop>e)continue;let p=s?i.readArticleAs(r.path,s):i.readArticle(r.path);if(p&&(c.set(r.path,{...p,hop:r.hop}),!(r.hop>=e)))for(let u of p.meta.related||[]){let h=a.get(u.toLowerCase());h&&!c.has(h)&&l.push({path:h,hop:r.hop+1})}}return Array.from(c.values())}async function B(n,i,s,e){try{let a=(i.rebuildIndex().articles??[]).filter(t=>t.path&&!t.path.includes("/_versions/"));if(a.length<2)return null;let c=a.map(t=>[t.title,(t.tags??[]).join(" "),(t.related??[]).join(" ")].join(" ")),l=M(n,$(c)).map(t=>t.docIndex);for(let t=0;t<a.length;t++)l.includes(t)||l.push(t);let p=l.slice(0,j).map(t=>({id:`k${t}`,title:a[t].title||a[t].path,tags:a[t].tags,excerpt:[a[t].type?`type: ${a[t].type}`:"",(a[t].related??[]).length?`related: ${(a[t].related??[]).join(", ")}`:""].filter(Boolean).join(" \xB7 ")})),u=await v(R,O({query:n,candidates:p,excerptChars:300}),W(p),{features:{agent:s??"unknown",stage:"catalog-selector"}});if(!u||u.mode!=="active")return null;let k=D(u.answers,p).ranked.slice(0,e).map(t=>a[Number(t.slice(1))]).filter(Boolean).map(t=>({title:t.title,path:t.path}));return k.length>0?k:null}catch{return null}}function I(n,i,s){return`You are picking candidate articles from a wiki catalog to answer a question. You do NOT answer the question. You pick which articles the answer is likely to come from.
1
+ import{a as R,b as j,c as O,d as W,e as D}from"./chunk-TFVUOC2C.js";import{b as C}from"./chunk-2GIDVZ4H.js";import{v,w as Q}from"./chunk-M4AG2YNX.js";import{b as $,c as M}from"./chunk-QOYAX2FT.js";import{readFileSync as T,existsSync as _}from"fs";Q();import{resolve as b}from"path";import{execSync as Y}from"child_process";async function V(n,i,s,e={}){let d=e.selectorModel??"haiku",a=e.synthModel??"sonnet",c=e.maxCandidates??3,l=e.maxHops??2,r=e.maxArticles??8,p=e.timeoutMs??6e4,u=e.log??console.error.bind(console,"[wiki-query]"),h=b(i.baseDir,"_index.md");if(!_(h))return w("no-catalog",n,"No _index.md found \u2014 run `agentx wiki status` to rebuild.");let k=T(h,"utf-8"),t=Date.now(),g=[],m="";try{let o=await B(n,i,s,c);o?(g=o,m=`[wiki-rerank seat] ${o.map(y=>y.title).join(" | ")}`):(m=await N(I(n,k,c),d,p),g=F(m))}catch(o){return u("selector failed:",o?.message),{...w("error",n,`Selector: ${o?.message||"unknown"}`),trace:{selectorMs:Date.now()-t,synthesisMs:0,selectorOutput:m}}}let A=Date.now()-t;if(g.length===0)return{...w("no-candidates",n,"Selector returned no candidates."),trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let f=E(g,i,s,l,r);if(f.length===0)return{...w("no-candidates",n,"Candidates did not resolve to readable articles."),candidates:g,trace:{selectorMs:A,synthesisMs:0,selectorOutput:m}};let S=Date.now(),x="";try{x=await N(L(n,f),a,p*2)}catch(o){return u("synthesis failed:",o?.message),{...w("error",n,`Synthesis: ${o?.message||"unknown"}`),candidates:g,walked:f.map(y=>({title:y.meta.title,path:y.path,type:y.meta.type,hop:y.hop??0})),trace:{selectorMs:A,synthesisMs:Date.now()-S,selectorOutput:m}}}let P=Date.now()-S;return{answer:x.trim(),citations:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type})),candidates:g,walked:f.map(o=>({title:o.meta.title,path:o.path,type:o.meta.type,hop:o.hop??0})),status:"ok",trace:{selectorMs:A,synthesisMs:P,selectorOutput:m}}}function w(n,i,s){return{answer:"",citations:[],candidates:[],walked:[],status:n,error:s}}function E(n,i,s,e,d){let a=new Map;for(let r of i.listArticles(s||""))a.set(r.meta.title.toLowerCase(),r.path);let c=new Map,l=[];for(let r of n)c.has(r.path)||l.push({path:r.path,hop:0});for(;l.length&&c.size<d;){let r=l.shift();if(c.has(r.path)||r.hop>e)continue;let p=s?i.readArticleAs(r.path,s):i.readArticle(r.path);if(p&&(c.set(r.path,{...p,hop:r.hop}),!(r.hop>=e)))for(let u of p.meta.related||[]){let h=a.get(u.toLowerCase());h&&!c.has(h)&&l.push({path:h,hop:r.hop+1})}}return Array.from(c.values())}async function B(n,i,s,e){try{let a=(i.rebuildIndex().articles??[]).filter(t=>t.path&&!t.path.includes("/_versions/"));if(a.length<2)return null;let c=a.map(t=>[t.title,(t.tags??[]).join(" "),(t.related??[]).join(" ")].join(" ")),l=M(n,$(c)).map(t=>t.docIndex);for(let t=0;t<a.length;t++)l.includes(t)||l.push(t);let p=l.slice(0,j).map(t=>({id:`k${t}`,title:a[t].title||a[t].path,tags:a[t].tags,excerpt:[a[t].type?`type: ${a[t].type}`:"",(a[t].related??[]).length?`related: ${(a[t].related??[]).join(", ")}`:""].filter(Boolean).join(" \xB7 ")})),u=await v(R,O({query:n,candidates:p,excerptChars:300}),W(p),{features:{agent:s??"unknown",stage:"catalog-selector"}});if(!u||u.mode!=="active")return null;let k=D(u.answers,p).ranked.slice(0,e).map(t=>a[Number(t.slice(1))]).filter(Boolean).map(t=>({title:t.title,path:t.path}));return k.length>0?k:null}catch{return null}}function I(n,i,s){return`You are picking candidate articles from a wiki catalog to answer a question. You do NOT answer the question. You pick which articles the answer is likely to come from.
2
2
 
3
3
  ## Question
4
4
 
@@ -42,4 +42,4 @@ ${s}
42
42
  Answer the question in 2\u20136 sentences. Cite articles by their title in square brackets like [Article Title]. If the articles do not answer the question, say so plainly (do not invent). Prefer concrete facts over hedging.
43
43
 
44
44
  Output ONLY the answer \u2014 no preamble, no "here is my answer:", no markdown fencing.`}function F(n){let i=n.match(/\[[\s\S]*?\]/);if(!i)return[];try{let s=JSON.parse(i[0]);return Array.isArray(s)?s.filter(e=>e&&typeof e.title=="string"&&typeof e.path=="string").map(e=>({title:e.title,path:e.path})):[]}catch{return[]}}async function N(n,i,s){let{writeFileSync:e,mkdirSync:d,rmSync:a}=await import("fs"),{tmpdir:c}=await import("os"),l=b(c(),`agentx-wiki-query-${process.pid}`);d(l,{recursive:!0});let r=b(l,`prompt-${Date.now()}.txt`);e(r,n);try{let p=`cat '${r}' | claude -p - --output-format json --max-turns 1 --model ${i} --disallowedTools "Bash Read Write Edit Glob Grep Agent WebSearch WebFetch NotebookEdit"`,u=Y(p,{env:C({...process.env}),encoding:"utf-8",timeout:s,maxBuffer:4*1024*1024});try{let h=JSON.parse(u);return String(h.result||h.content||"")}catch{return u}}finally{try{a(r,{force:!0})}catch{}}}export{V as a};
45
- //# sourceMappingURL=chunk-QU6ZUKAD.js.map
45
+ //# sourceMappingURL=chunk-GSOL2LW6.js.map