agentix-cli 0.182.0 → 0.184.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 (165) hide show
  1. package/apps/mac-helper/Sources/AgentXHelper/Presence.swift +9 -0
  2. package/apps/mac-helper/Sources/AgentXHelper/PresenceTag.swift +25 -9
  3. package/dist/{App-XWSSUYKF.js → App-WIHCYMHM.js} +2 -2
  4. package/dist/{ChatApp-UT2BRHYE.js → ChatApp-V3UASKNG.js} +2 -2
  5. package/dist/{absorb-eval-SFGUURBD.js → absorb-eval-EAGXITJH.js} +2 -2
  6. package/dist/{adapter-UHR7FVM7.js → adapter-7IDPCEJ7.js} +2 -2
  7. package/dist/{agent-5NTFSCEO.js → agent-H75SWYT6.js} +2 -2
  8. package/dist/{board-dashboard-7HIME2W4.js → board-dashboard-MHPJY4JB.js} +709 -2204
  9. package/dist/board-dashboard-MHPJY4JB.js.map +1 -0
  10. package/dist/{chunk-QGNV2HA4.js → chunk-2GIYVYIM.js} +2 -2
  11. package/dist/{chunk-5YG2ZQQW.js → chunk-2LTZUZJU.js} +3 -3
  12. package/dist/{chunk-343MPMLD.js → chunk-2V6ZGE74.js} +2 -2
  13. package/dist/{chunk-4KNHLHE3.js → chunk-4HYIERJ4.js} +2 -2
  14. package/dist/{chunk-XHJ5SVO5.js → chunk-4IKZSV5A.js} +302 -297
  15. package/dist/chunk-4IKZSV5A.js.map +1 -0
  16. package/dist/{chunk-QB6UPODO.js → chunk-56F5UTTA.js} +2 -2
  17. package/dist/chunk-5ELIX7BQ.js +3 -0
  18. package/dist/chunk-5ELIX7BQ.js.map +1 -0
  19. package/dist/{chunk-NIPMVM3G.js → chunk-7EMPPP3E.js} +2 -2
  20. package/dist/{chunk-IFHVAHQM.js → chunk-A4PW7EIK.js} +2 -2
  21. package/dist/chunk-AHWWJ7AF.js +2 -0
  22. package/dist/chunk-AHWWJ7AF.js.map +1 -0
  23. package/dist/{chunk-7WGJZLVJ.js → chunk-BITVUKT7.js} +2 -2
  24. package/dist/{chunk-MD2HCGSC.js → chunk-BZJF7DJR.js} +3 -3
  25. package/dist/chunk-BZJF7DJR.js.map +1 -0
  26. package/dist/{chunk-5NGQQOVK.js → chunk-CVPERUWT.js} +2 -2
  27. package/dist/chunk-CZMVJP7O.js +2 -0
  28. package/dist/chunk-CZMVJP7O.js.map +1 -0
  29. package/dist/chunk-DPV4M4AQ.js +2903 -0
  30. package/dist/chunk-DPV4M4AQ.js.map +1 -0
  31. package/dist/{chunk-GEFZMDDX.js → chunk-FJMTCU4S.js} +2 -2
  32. package/dist/{chunk-IGBW4VVM.js → chunk-GSQ2RCOZ.js} +2 -2
  33. package/dist/chunk-I5TUF6U7.js +888 -0
  34. package/dist/chunk-I5TUF6U7.js.map +1 -0
  35. package/dist/{chunk-YX4R2VGD.js → chunk-LR4QUAJT.js} +2 -2
  36. package/dist/{chunk-RDWDDPBI.js → chunk-NBWSZ53L.js} +2 -2
  37. package/dist/{chunk-4WSJKKSA.js → chunk-NHW4IY6N.js} +2 -2
  38. package/dist/{chunk-FDX4IGLK.js → chunk-NS2HSAHF.js} +2 -2
  39. package/dist/{chunk-YSPBVLTZ.js → chunk-OJ53ATNN.js} +2 -2
  40. package/dist/{chunk-JNWXHOJE.js → chunk-PN42ECV3.js} +2 -2
  41. package/dist/{chunk-Y4TVCWWF.js → chunk-R2KSORSK.js} +2 -2
  42. package/dist/{chunk-FYFJ7IQJ.js → chunk-RTIGD4NG.js} +2 -2
  43. package/dist/{chunk-Y5TBOMHY.js → chunk-UASRZKZQ.js} +6 -6
  44. package/dist/{chunk-H2KOXGDX.js → chunk-V4IOGISL.js} +2 -2
  45. package/dist/{chunk-Z4XVPGPZ.js → chunk-V6QFBL6F.js} +3 -3
  46. package/dist/{chunk-XI2HH5NR.js → chunk-WKHRKYCY.js} +2 -2
  47. package/dist/{chunk-BY3AUZYM.js → chunk-YTS54UZ5.js} +2 -2
  48. package/dist/cli.js +1 -1
  49. package/dist/{client-SQMU25PS.js → client-57TCFIV5.js} +2 -2
  50. package/dist/{compaction-26OHHULF.js → compaction-R7VWQB6X.js} +2 -2
  51. package/dist/{config-56NBA4SF.js → config-RHCIE7VE.js} +2 -2
  52. package/dist/{config-mutate-PD4O3HZ7.js → config-mutate-HCYXR2WP.js} +2 -2
  53. package/dist/config-mutator-JQ2R4J5Z.js +2 -0
  54. package/dist/{contributions-DKTJ623L.js → contributions-R4HXLJXU.js} +2 -2
  55. package/dist/{doctor-OI6GJZR5.js → doctor-22PZVT6A.js} +2 -2
  56. package/dist/{follow-up-tool-DYSLS6ZI.js → follow-up-tool-MC4TBGLP.js} +2 -2
  57. package/dist/hub-HXVIO4U5.js +2 -0
  58. package/dist/index.d.ts +55 -1
  59. package/dist/index.js +1 -1
  60. package/dist/{program-4GDIWCDM.js → program-736BTK4B.js} +260 -259
  61. package/dist/program-736BTK4B.js.map +1 -0
  62. package/dist/{promote-3272TZNI.js → promote-D24WO52J.js} +2 -2
  63. package/dist/push-bridge-NR7SLHGX.js +1 -1
  64. package/dist/{query-7XM6V4QG.js → query-J5NRZZUQ.js} +2 -2
  65. package/dist/{query-settings-HHVBIIVQ.js → query-settings-NT6ACLQY.js} +2 -2
  66. package/dist/{registry-QL3AM3UH.js → registry-SBIZVSQV.js} +2 -2
  67. package/dist/{request-planner-WNEDEA7X.js → request-planner-2CVL22EB.js} +2 -2
  68. package/dist/{review-candidates-TGPDJMWJ.js → review-candidates-MMNDJOTD.js} +2 -2
  69. package/dist/{routing-ALXY25NE.js → routing-KRST324W.js} +2 -2
  70. package/dist/schedule-tool-KOFUKVX5.js +2 -0
  71. package/dist/{scheduler-5PHNW243.js → scheduler-GCCE4FQP.js} +2 -2
  72. package/dist/{seat-ZYVVEILY.js → seat-E6F56TUM.js} +2 -2
  73. package/dist/{select-6QLEV6AC.js → select-D2VUSUCJ.js} +2 -2
  74. package/dist/self-SO6GCVYD.js +2 -0
  75. package/dist/{set-enabled-SYYTKJPC.js → set-enabled-GBI7JREU.js} +2 -2
  76. package/dist/signal-exit-C5EUGHKI.js +3 -0
  77. package/dist/signal-exit-C5EUGHKI.js.map +1 -0
  78. package/dist/{sprint-tool-PYVHPHR2.js → sprint-tool-HZ24VIC2.js} +2 -2
  79. package/dist/{tool-GIYOYXXM.js → tool-7BEFI5SJ.js} +2 -2
  80. package/dist/{tool-ZKZ4KYJT.js → tool-OXZ4TQBG.js} +2 -2
  81. package/dist/{tool-TDOUM3BJ.js → tool-QLQEYQYM.js} +2 -2
  82. package/dist/wiki-RFDU6SVD.js +2 -0
  83. package/dist/wiki-enrich-LDI67VQU.js +2 -0
  84. package/package.json +4 -1
  85. package/dist/board-dashboard-7HIME2W4.js.map +0 -1
  86. package/dist/chunk-7PQQZC6B.js +0 -310
  87. package/dist/chunk-7PQQZC6B.js.map +0 -1
  88. package/dist/chunk-MD2HCGSC.js.map +0 -1
  89. package/dist/chunk-NRUUT5TL.js +0 -256
  90. package/dist/chunk-NRUUT5TL.js.map +0 -1
  91. package/dist/chunk-OKADR5QO.js +0 -869
  92. package/dist/chunk-OKADR5QO.js.map +0 -1
  93. package/dist/chunk-QOYAX2FT.js +0 -2
  94. package/dist/chunk-QOYAX2FT.js.map +0 -1
  95. package/dist/chunk-R3CDFSNF.js +0 -580
  96. package/dist/chunk-R3CDFSNF.js.map +0 -1
  97. package/dist/chunk-XHJ5SVO5.js.map +0 -1
  98. package/dist/chunk-ZRALOFEG.js +0 -2035
  99. package/dist/chunk-ZRALOFEG.js.map +0 -1
  100. package/dist/config-mutator-ITL64FBW.js +0 -2
  101. package/dist/hub-4HDMTSR7.js +0 -2
  102. package/dist/processes-M7YPWX7H.js +0 -2
  103. package/dist/program-4GDIWCDM.js.map +0 -1
  104. package/dist/schedule-tool-22UBZXCG.js +0 -2
  105. package/dist/signal-exit-WL7G3EEZ.js +0 -2
  106. package/dist/signal-exit-WL7G3EEZ.js.map +0 -1
  107. package/dist/wiki-ZRGLGMII.js +0 -2
  108. package/dist/wiki-enrich-CTID7JQW.js +0 -2
  109. /package/dist/{App-XWSSUYKF.js.map → App-WIHCYMHM.js.map} +0 -0
  110. /package/dist/{ChatApp-UT2BRHYE.js.map → ChatApp-V3UASKNG.js.map} +0 -0
  111. /package/dist/{absorb-eval-SFGUURBD.js.map → absorb-eval-EAGXITJH.js.map} +0 -0
  112. /package/dist/{adapter-UHR7FVM7.js.map → adapter-7IDPCEJ7.js.map} +0 -0
  113. /package/dist/{agent-5NTFSCEO.js.map → agent-H75SWYT6.js.map} +0 -0
  114. /package/dist/{chunk-QGNV2HA4.js.map → chunk-2GIYVYIM.js.map} +0 -0
  115. /package/dist/{chunk-5YG2ZQQW.js.map → chunk-2LTZUZJU.js.map} +0 -0
  116. /package/dist/{chunk-343MPMLD.js.map → chunk-2V6ZGE74.js.map} +0 -0
  117. /package/dist/{chunk-4KNHLHE3.js.map → chunk-4HYIERJ4.js.map} +0 -0
  118. /package/dist/{chunk-QB6UPODO.js.map → chunk-56F5UTTA.js.map} +0 -0
  119. /package/dist/{chunk-NIPMVM3G.js.map → chunk-7EMPPP3E.js.map} +0 -0
  120. /package/dist/{chunk-IFHVAHQM.js.map → chunk-A4PW7EIK.js.map} +0 -0
  121. /package/dist/{chunk-7WGJZLVJ.js.map → chunk-BITVUKT7.js.map} +0 -0
  122. /package/dist/{chunk-5NGQQOVK.js.map → chunk-CVPERUWT.js.map} +0 -0
  123. /package/dist/{chunk-GEFZMDDX.js.map → chunk-FJMTCU4S.js.map} +0 -0
  124. /package/dist/{chunk-IGBW4VVM.js.map → chunk-GSQ2RCOZ.js.map} +0 -0
  125. /package/dist/{chunk-YX4R2VGD.js.map → chunk-LR4QUAJT.js.map} +0 -0
  126. /package/dist/{chunk-RDWDDPBI.js.map → chunk-NBWSZ53L.js.map} +0 -0
  127. /package/dist/{chunk-4WSJKKSA.js.map → chunk-NHW4IY6N.js.map} +0 -0
  128. /package/dist/{chunk-FDX4IGLK.js.map → chunk-NS2HSAHF.js.map} +0 -0
  129. /package/dist/{chunk-YSPBVLTZ.js.map → chunk-OJ53ATNN.js.map} +0 -0
  130. /package/dist/{chunk-JNWXHOJE.js.map → chunk-PN42ECV3.js.map} +0 -0
  131. /package/dist/{chunk-Y4TVCWWF.js.map → chunk-R2KSORSK.js.map} +0 -0
  132. /package/dist/{chunk-FYFJ7IQJ.js.map → chunk-RTIGD4NG.js.map} +0 -0
  133. /package/dist/{chunk-Y5TBOMHY.js.map → chunk-UASRZKZQ.js.map} +0 -0
  134. /package/dist/{chunk-H2KOXGDX.js.map → chunk-V4IOGISL.js.map} +0 -0
  135. /package/dist/{chunk-Z4XVPGPZ.js.map → chunk-V6QFBL6F.js.map} +0 -0
  136. /package/dist/{chunk-XI2HH5NR.js.map → chunk-WKHRKYCY.js.map} +0 -0
  137. /package/dist/{chunk-BY3AUZYM.js.map → chunk-YTS54UZ5.js.map} +0 -0
  138. /package/dist/{client-SQMU25PS.js.map → client-57TCFIV5.js.map} +0 -0
  139. /package/dist/{compaction-26OHHULF.js.map → compaction-R7VWQB6X.js.map} +0 -0
  140. /package/dist/{config-56NBA4SF.js.map → config-RHCIE7VE.js.map} +0 -0
  141. /package/dist/{config-mutate-PD4O3HZ7.js.map → config-mutate-HCYXR2WP.js.map} +0 -0
  142. /package/dist/{config-mutator-ITL64FBW.js.map → config-mutator-JQ2R4J5Z.js.map} +0 -0
  143. /package/dist/{contributions-DKTJ623L.js.map → contributions-R4HXLJXU.js.map} +0 -0
  144. /package/dist/{doctor-OI6GJZR5.js.map → doctor-22PZVT6A.js.map} +0 -0
  145. /package/dist/{follow-up-tool-DYSLS6ZI.js.map → follow-up-tool-MC4TBGLP.js.map} +0 -0
  146. /package/dist/{hub-4HDMTSR7.js.map → hub-HXVIO4U5.js.map} +0 -0
  147. /package/dist/{processes-M7YPWX7H.js.map → promote-D24WO52J.js.map} +0 -0
  148. /package/dist/{promote-3272TZNI.js.map → query-J5NRZZUQ.js.map} +0 -0
  149. /package/dist/{query-settings-HHVBIIVQ.js.map → query-settings-NT6ACLQY.js.map} +0 -0
  150. /package/dist/{query-7XM6V4QG.js.map → registry-SBIZVSQV.js.map} +0 -0
  151. /package/dist/{request-planner-WNEDEA7X.js.map → request-planner-2CVL22EB.js.map} +0 -0
  152. /package/dist/{review-candidates-TGPDJMWJ.js.map → review-candidates-MMNDJOTD.js.map} +0 -0
  153. /package/dist/{registry-QL3AM3UH.js.map → routing-KRST324W.js.map} +0 -0
  154. /package/dist/{routing-ALXY25NE.js.map → schedule-tool-KOFUKVX5.js.map} +0 -0
  155. /package/dist/{schedule-tool-22UBZXCG.js.map → scheduler-GCCE4FQP.js.map} +0 -0
  156. /package/dist/{scheduler-5PHNW243.js.map → seat-E6F56TUM.js.map} +0 -0
  157. /package/dist/{select-6QLEV6AC.js.map → select-D2VUSUCJ.js.map} +0 -0
  158. /package/dist/{seat-ZYVVEILY.js.map → self-SO6GCVYD.js.map} +0 -0
  159. /package/dist/{set-enabled-SYYTKJPC.js.map → set-enabled-GBI7JREU.js.map} +0 -0
  160. /package/dist/{sprint-tool-PYVHPHR2.js.map → sprint-tool-HZ24VIC2.js.map} +0 -0
  161. /package/dist/{tool-GIYOYXXM.js.map → tool-7BEFI5SJ.js.map} +0 -0
  162. /package/dist/{tool-ZKZ4KYJT.js.map → tool-OXZ4TQBG.js.map} +0 -0
  163. /package/dist/{tool-TDOUM3BJ.js.map → tool-QLQEYQYM.js.map} +0 -0
  164. /package/dist/{wiki-ZRGLGMII.js.map → wiki-RFDU6SVD.js.map} +0 -0
  165. /package/dist/{wiki-enrich-CTID7JQW.js.map → wiki-enrich-LDI67VQU.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{r as p}from"./chunk-FYFJ7IQJ.js";import{b as i,c as u,d as l,e as c}from"./chunk-FDX4IGLK.js";import d from"cronstrue";var f=Intl.DateTimeFormat().resolvedOptions().timeZone,g=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',m=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function x(e){return m.test(e)}function w(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function S(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function $(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||f,agent:e.agent,prompt:e.prompt,timeout:e.timeout??g,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.report==="exceptions"&&(t.report="exceptions"),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){return e.deliverResult===!1?"(failures only)":e.report==="exceptions"?"(exceptions and failures)":"(results and failures)"}function T(e){try{return d.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function A(e,r,t=new Date){try{return p(e,t,r)}catch{return null}}function D(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function y(e){return e?.approval?.action==="create"}async function R(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&y(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{f as a,E as b,x as c,w as d,S as e,$ as f,P as g,T as h,A as i,D as j,y as k,R as l,I as m,O as n};
2
- //# sourceMappingURL=chunk-H2KOXGDX.js.map
1
+ import{r as p}from"./chunk-RTIGD4NG.js";import{b as i,c as u,d as l,e as c}from"./chunk-NS2HSAHF.js";import d from"cronstrue";var f=Intl.DateTimeFormat().resolvedOptions().timeZone,g=600,E='Try: "every morning at 9", "weekdays at 6pm", "every 15 minutes", "every monday at 10am", "1st of every month at noon", "daily at 9:30am", "every hour"',m=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;function x(e){return m.test(e)}function w(e){try{return new Intl.DateTimeFormat("en-US",{timeZone:e}),!0}catch{return!1}}function S(e){return e?e.split(",").map(r=>r.trim().toLowerCase()).filter(r=>r==="log"||r==="notify"||r==="disable"):["log"]}function $(e){let r=[...e.onError??["log"]];e.notify&&!r.includes("notify")&&r.push("notify");let t={enabled:e.enabled??!0,schedule:e.parsed.cron,timezone:e.timezone||f,agent:e.agent,prompt:e.prompt,timeout:e.timeout??g,onError:r};return e.model&&(t.model=e.model),e.notify&&(t.notify=e.notify),e.notify&&e.deliverResult===!1&&(t.deliverResult=!1),e.report==="exceptions"&&(t.report="exceptions"),e.createdBy&&(t.createdBy=e.createdBy),e.approval&&(t.approval=e.approval),t}function P(e){return e.deliverResult===!1?"(failures only)":e.report==="exceptions"?"(exceptions and failures)":"(results and failures)"}function T(e){try{return d.toString(e,{use24HourTimeFormat:!1})}catch{return e}}function A(e,r,t=new Date){try{return p(e,t,r)}catch{return null}}function D(e,r){if(!e)return"unknown (no match within a year)";try{return`${new Intl.DateTimeFormat("en-GB",{timeZone:r,weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e)} (${r})`}catch{return e.toISOString()}}function y(e){return e?.approval?.action==="create"}async function R(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(delete a.approval,a.enabled=!0,t=`${e} approved and enabled (requested by ${s.requestedBy})`):(c(n,`crons.${e}`),t=`${e} deletion approved; job removed (requested by ${s.requestedBy})`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function I(e,r={}){let t="",o=await i(n=>{let a=l(n,`crons.${e}`);if(!a)throw new Error(`cron "${e}" not found`);let s=a.approval;if(!s)throw new Error(`cron "${e}" has no pending request`);s.action==="create"?(c(n,`crons.${e}`),t=`${e} rejected; pending job removed`):(delete a.approval,t=`${e} deletion rejected; job kept`)},{configPath:r.configPath,reload:r.reload});return o.success?{success:!0,message:t,result:o}:{success:!1,message:o.error||"failed",result:o}}async function O(e,r,t={}){return i(o=>{let n=l(o,`crons.${e}`);if(!n)throw new Error(`cron "${e}" not found`);if(r&&y(n))throw new Error(`cron "${e}" is awaiting approval; run \`agentx schedule approve ${e}\``);u(o,`crons.${e}.enabled`,r)},{configPath:t.configPath,reload:t.reload})}export{f as a,E as b,x as c,w as d,S as e,$ as f,P as g,T as h,A as i,D as j,y as k,R as l,I as m,O as n};
2
+ //# sourceMappingURL=chunk-V4IOGISL.js.map
@@ -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-QB6UPODO.js";import{a as H}from"./chunk-LUOW2YHY.js";import{y as N,z as ot}from"./chunk-YX4R2VGD.js";import{h as Q}from"./chunk-QUFIUXMQ.js";import{b as E,c as L}from"./chunk-QOYAX2FT.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-56F5UTTA.js";import{a as H}from"./chunk-LUOW2YHY.js";import{y as N,z as ot}from"./chunk-LR4QUAJT.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-56NBA4SF.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-Z4XVPGPZ.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-RHCIE7VE.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-V6QFBL6F.js.map
@@ -1,4 +1,4 @@
1
- import{a as k}from"./chunk-IMLAPB7G.js";import{k as w}from"./chunk-CTNZVRPA.js";import{d as Y}from"./chunk-QPABR72X.js";import{b as Z}from"./chunk-KP7KDLZ2.js";import{ba as K,ca as V,da as z,ea as Q,ka as A,pa as Me}from"./chunk-MD2HCGSC.js";import{existsSync as ee,readFileSync as Ce}from"node:fs";import{dirname as R,join as S}from"node:path";import{fileURLToPath as Te}from"node:url";import{homedir as _e}from"node:os";var L="tn.acme.agentx.voice",wt="AgentX Desktop.app",te="AgentX Helper.app";function St(e,t,n){return e!=="darwin"||t!=="arm64"||Number(n.split(".")[0])<23?"AgentX Desktop currently requires Apple Silicon and macOS 14 or newer.":null}function xt(e,t){if(t&&!Object.hasOwn(e,t))throw new Error(`Unknown agent: ${t}. Run agentx agent list.`);let n=t||Object.keys(e)[0];if(!n)throw new Error("No agents configured. Run agentx setup first.");return n}function D(e){return`'${e.replace(/'/g,"'\\''")}'`}var ne="/usr/bin:/bin:/usr/sbin:/sbin";function bt(e,t){return t||[...new Set([...e?[R(e)]:[],...ne.split(":")])].join(":")}function $(e){let t={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};return e.replace(/&(amp|lt|gt|quot|apos);/g,(n,r)=>t[r])}function Nt(e){let t=e.match(/<key>PATH<\/key>\s*<string>([^<]*)<\/string>/);return t?$(t[1]):ne}var vt=e=>/agentx\.voice.*\.plist$/.test(e);function At(e,t){let n=null,r=[];for(let{file:o,plist:i}of[...t].sort((s,l)=>s.file<l.file?-1:1)){let s=i.match(/<key>Label<\/key>\s*<string>([^<]*)<\/string>/)?.[1],l=i.match(/<key>ProgramArguments<\/key>\s*<array>\s*<string>([^<]*)<\/string>/)?.[1];!s||!l||!$(l).endsWith("/Contents/MacOS/AgentXVoice")||(n?r.push({file:o,label:$(s)}):n={file:o,label:$(s)})}return{keep:n??{file:S(e,`${L}.plist`),label:L},remove:r}}function re(e,t,n){for(let r of t.split(":"))if(r&&n(S(r,e)))return S(r,e);return null}function kt(e){let t=r=>r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),n={PATH:e.path,...e.agent?{AGENTX_VOICE_AGENT:e.agent}:{},AGENTX_DAEMON_URL:e.url,AGENTX_MAC_HELPER:e.helper,AGENTX_PASTE_COMMAND:`cd ${D(e.cwd)} && ${D(e.node)} ${D(e.cli)} paste`};return`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{a as k}from"./chunk-IMLAPB7G.js";import{k as w}from"./chunk-CTNZVRPA.js";import{d as Y}from"./chunk-QPABR72X.js";import{b as Z}from"./chunk-KP7KDLZ2.js";import{ba as K,ca as V,da as z,ea as Q,ka as A,pa as Me}from"./chunk-BZJF7DJR.js";import{existsSync as ee,readFileSync as Ce}from"node:fs";import{dirname as R,join as S}from"node:path";import{fileURLToPath as Te}from"node:url";import{homedir as _e}from"node:os";var L="tn.acme.agentx.voice",wt="AgentX Desktop.app",te="AgentX Helper.app";function St(e,t,n){return e!=="darwin"||t!=="arm64"||Number(n.split(".")[0])<23?"AgentX Desktop currently requires Apple Silicon and macOS 14 or newer.":null}function xt(e,t){if(t&&!Object.hasOwn(e,t))throw new Error(`Unknown agent: ${t}. Run agentx agent list.`);let n=t||Object.keys(e)[0];if(!n)throw new Error("No agents configured. Run agentx setup first.");return n}function D(e){return`'${e.replace(/'/g,"'\\''")}'`}var ne="/usr/bin:/bin:/usr/sbin:/sbin";function bt(e,t){return t||[...new Set([...e?[R(e)]:[],...ne.split(":")])].join(":")}function $(e){let t={amp:"&",lt:"<",gt:">",quot:'"',apos:"'"};return e.replace(/&(amp|lt|gt|quot|apos);/g,(n,r)=>t[r])}function Nt(e){let t=e.match(/<key>PATH<\/key>\s*<string>([^<]*)<\/string>/);return t?$(t[1]):ne}var vt=e=>/agentx\.voice.*\.plist$/.test(e);function At(e,t){let n=null,r=[];for(let{file:o,plist:i}of[...t].sort((s,l)=>s.file<l.file?-1:1)){let s=i.match(/<key>Label<\/key>\s*<string>([^<]*)<\/string>/)?.[1],l=i.match(/<key>ProgramArguments<\/key>\s*<array>\s*<string>([^<]*)<\/string>/)?.[1];!s||!l||!$(l).endsWith("/Contents/MacOS/AgentXVoice")||(n?r.push({file:o,label:$(s)}):n={file:o,label:$(s)})}return{keep:n??{file:S(e,`${L}.plist`),label:L},remove:r}}function re(e,t,n){for(let r of t.split(":"))if(r&&n(S(r,e)))return S(r,e);return null}function kt(e){let t=r=>r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),n={PATH:e.path,...e.agent?{AGENTX_VOICE_AGENT:e.agent}:{},AGENTX_DAEMON_URL:e.url,AGENTX_MAC_HELPER:e.helper,AGENTX_PASTE_COMMAND:`cd ${D(e.cwd)} && ${D(e.node)} ${D(e.cli)} paste`};return`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0"><dict>
4
4
  <key>Label</key><string>${t(e.label??L)}</string>
@@ -33,4 +33,4 @@ function run(argv) {
33
33
  `),at(r,n)}var dt=5*6e4;function _n(e,t,n=Date.now()){let r=J(e),o=r.checkedAt?Date.parse(r.checkedAt):NaN;return!r.cards||!(n-o<=dt)?!1:r.items[`card:${t}`]?.state!=="failed"}var X=24*36e5;function Oe(e,t,n){let r=e+t.dueAfterMinutes*6e4;return new Date(n!==void 0&&Number.isFinite(n)?Math.max(e,Math.min(r,n)):r)}function pt(e,t,n,r){let o=Date.parse(e.expires),i=[g(e.ask,w.ask)];return e.choices?.length&&i.push(...e.choices.map((s,l)=>`${l+1}. ${s}`)),e.recommend&&i.push(`Recommended: ${g(e.recommend,w.recommend)}`),i.push(`Answer: ${n}`,`agentx: card=${e.id}`),{key:`card:${e.id}`,title:g(e.title,w.title),notes:i.join(`
34
34
  `),due:Oe(r,t,o),priority:Number.isFinite(o)&&o-r<=X?"high":"none"}}function mt(e,t,n,r){let o=[g(e.question||e.text,w.ask),`Asked of ${e.agentId}.`,`Answer: ${n}`,`agentx: request=${e.id}`],i=e.dueAt??void 0;return{key:`request:${e.id}`,title:G(e,w.title).headline,notes:o.join(`
35
35
  `),due:Oe(r,t,i),priority:i!==void 0&&i-r<=X?"high":"none"}}async function Dn(e){let{root:t,settings:n,tasks:r,log:o}=e,i=e.now??Date.now(),s=new Date(i).toISOString(),l={created:0,completed:0,dismissed:0,failed:0},a=J(t);delete a.lastError;let c=u=>{a.lastError={at:s,message:u}},f=new Map;try{if(n.include.includes("card"))for(let u of e.cards())u.status==="pending"&&Date.parse(u.expires)>i&&f.set(`card:${u.id}`,pt(u,n,e.answerUrl,i));if(n.include.includes("request"))for(let u of e.requests())u.state==="waiting_owner"&&f.set(`request:${u.id}`,mt(u,n,e.answerUrl,i))}catch(u){return o(`[mirror] could not read what is waiting: ${u?.message??u}`),c(String(u?.message??u)),Re(t,a),l}let M=!0,y=new Map,Ie=async u=>{if(!y.has(u))try{y.set(u,new Set((await r.listOpen(u)).map(d=>d.id)))}catch(d){o(`[mirror] could not read list "${u}": ${d?.message??d}`),c(String(d?.message??d)),y.set(u,null),M=!1}return y.get(u)};for(let[u,d]of Object.entries(a.items)){if(d.state!=="open"||!d.id)continue;let p=await Ie(d.list);if(p)if(f.has(u))p.has(d.id)||(a.items[u]={...d,state:"dismissed",at:s},l.dismissed++,o(`[mirror] ${u}: its task was ticked off or deleted; it stays on the Desk and is not mirrored again`));else{if(p.has(d.id))try{await r.complete(d.id)}catch(h){o(`[mirror] ${u}: could not complete its task: ${h?.message??h}`),c(String(h?.message??h));continue}a.items[u]={...d,state:"completed",at:s},l.completed++}}let N=null,C="",T=0,b=[];for(let[u,d]of f){let p=a.items[u];if(p&&(p.state==="open"||p.state==="dismissed")||p?.state==="failed"&&p.failures>=B)continue;if(N===null)try{await r.ensureList(n.list),N=!0}catch(m){o(`[mirror] could not make list "${n.list}": ${m?.message??m}`),C=String(m?.message??m),c(C),N=!1}let h=p?.state==="failed"?p.failures:0;try{if(N===!1)throw new Error(C);let{id:m}=await r.add({list:n.list,title:d.title,notes:d.notes,due:d.due,priority:d.priority});a.items[u]={id:m,list:n.list,state:"open",at:s,createdAt:s,failures:0},l.created++}catch(m){let v=String(m?.message??m);u.startsWith("card:")&&T++;let _=h+1;a.items[u]={list:n.list,state:"failed",at:s,failures:_,lastError:v},c(v),l.failed++,o(`[mirror] ${u}: could not add to Reminders (${_}/${B}): ${v}`),_===B&&b.push({title:d.title,message:v})}}T&&o(`[mirror] ${T} card(s) could not be added to Reminders; the Mac popup shows them instead`);let Ee=a.failureToldAt?Date.parse(a.failureToldAt):NaN;if(b.length&&!(i-Ee<X)){let u=b[0],d=b.length>1?` (and ${b.length-1} more)`:"";try{await e.notify("Could not add to Reminders",`${u.title}${d}: ${g(u.message,200)}. Still on the Desk.`),a.failureToldAt=s}catch(p){o(`[mirror] could not tell the owner: ${p?.message??p}`)}}M&&(a.checkedAt=s,a.cards=n.include.includes("card"));for(let[u,d]of Object.entries(a.items))d.state!=="open"&&!f.has(u)&&i-Date.parse(d.at)>ct&&delete a.items[u];return Re(t,a),l}var $e=5*6e4;function Ln(e,t,n,r,o=Date.now()){let i=J(e),s=a=>{let c=a?Date.parse(a):NaN;return c>=n&&c<r},l={from:new Date(n).toISOString(),to:new Date(r).toISOString(),raised:0,created:{cards:0,requests:0},missed:[],closedFast:0,tooNew:0};for(let[a,c]of Object.entries(i.items))!c.id||!s(c.createdAt)||(a.startsWith("card:")?l.created.cards++:l.created.requests++);for(let a of t){if(!s(a.created_at))continue;l.raised++;let c=i.items[`card:${a.id}`];if(c?.id)continue;let f=Date.parse(a.created_at);if((a.status==="pending"?NaN:Date.parse(a.decided_at??""))-f<=$e){l.closedFast++;continue}if(a.status==="pending"&&o-f<=$e){l.tooNew++;continue}let y=c?.state==="failed"?`could not be added (${c.failures}x): ${c.lastError??"unknown error"}`:"no pass reached it";l.missed.push({id:a.id,title:a.title,reason:y})}return l}function qn(e){let t=[e.closedFast?`closed within 5 min: ${e.closedFast}`:"",e.tooNew?`raised in the last 5 min: ${e.tooNew}`:""].filter(Boolean);return`cards raised ${e.raised} / Reminders created ${e.created.cards+e.created.requests} (${e.created.cards} cards, ${e.created.requests} requests) / missed ${e.missed.length}${t.length?` \xB7 ${t.join(" \xB7 ")}`:""}`}export{wn as a,xe as b,j as c,U as d,Sn as e,xn as f,nt as g,bn as h,Nn as i,vn as j,G as k,g as l,On as m,wt as n,te as o,St as p,xt as q,bt as r,Nt as s,vt as t,At as u,re as v,kt as w,Rt as x,De as y,Le as z,qe as A,q as B,le as C,H as D,Se as E,dn as F,pn as G,mn as H,J as I,_n as J,Dn as K,Ln as L,qn as M};
36
- //# sourceMappingURL=chunk-XI2HH5NR.js.map
36
+ //# sourceMappingURL=chunk-WKHRKYCY.js.map
@@ -1,4 +1,4 @@
1
- import{c as w}from"./chunk-YSPBVLTZ.js";function T(t){let r=1779033703^t.length;for(let s=0;s<t.length;s++)r=Math.imul(r^t.charCodeAt(s),3432918353),r=r<<13|r>>>19;let o=r>>>0;return()=>{o=o+1831565813>>>0;let s=o;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}function _(t,r,o){let s=T(o),i=[...t].sort((e,u)=>e.path.localeCompare(u.path));for(let e=i.length-1;e>0;e--){let u=Math.floor(s()*(e+1));[i[e],i[u]]=[i[u],i[e]]}return i.slice(0,Math.max(0,r)).sort((e,u)=>e.path.localeCompare(u.path))}var R=new Set("about after again also because been before being between could does doing during each from have having here into just more most only other over same should some such than that their them then there these they this those through under until very were what when where which while will with would your yours user assistant agent message entry please thanks".split(" "));function k(t){let r=new Set;for(let o of t.toLowerCase().matchAll(/[\p{L}\p{N}][\p{L}\p{N}_-]{3,}/gu))R.has(o[0])||r.add(o[0]);return r}function E(t,r){let o=k(t);if(o.size===0)return 1;let s=k(r),i=0;for(let e of o)s.has(e)&&i++;return i/o.size}var W=.15;function $(t){let r=w(t);return{commits:r.commits,urls:r.urls,numbers:r.numbers}}function j(t,r,o){return t.includes(r)||o.some(s=>s.startsWith(r)||r.startsWith(s))}var y=t=>t.toLowerCase().replace(/\/+$/,"");function N(t,r,o){let s=t.sources.map(a=>r.get(a)).filter(a=>!!a),i=t.sources.filter(a=>!r.has(a)),e=s.filter(a=>k(a.content).size>=5&&E(a.content,t.content)<W).map(a=>a.id),u=[...s.map(a=>`${a.date??""}
1
+ import{c as w}from"./chunk-OJ53ATNN.js";function T(t){let r=1779033703^t.length;for(let s=0;s<t.length;s++)r=Math.imul(r^t.charCodeAt(s),3432918353),r=r<<13|r>>>19;let o=r>>>0;return()=>{o=o+1831565813>>>0;let s=o;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}function _(t,r,o){let s=T(o),i=[...t].sort((e,u)=>e.path.localeCompare(u.path));for(let e=i.length-1;e>0;e--){let u=Math.floor(s()*(e+1));[i[e],i[u]]=[i[u],i[e]]}return i.slice(0,Math.max(0,r)).sort((e,u)=>e.path.localeCompare(u.path))}var R=new Set("about after again also because been before being between could does doing during each from have having here into just more most only other over same should some such than that their them then there these they this those through under until very were what when where which while will with would your yours user assistant agent message entry please thanks".split(" "));function k(t){let r=new Set;for(let o of t.toLowerCase().matchAll(/[\p{L}\p{N}][\p{L}\p{N}_-]{3,}/gu))R.has(o[0])||r.add(o[0]);return r}function E(t,r){let o=k(t);if(o.size===0)return 1;let s=k(r),i=0;for(let e of o)s.has(e)&&i++;return i/o.size}var W=.15;function $(t){let r=w(t);return{commits:r.commits,urls:r.urls,numbers:r.numbers}}function j(t,r,o){return t.includes(r)||o.some(s=>s.startsWith(r)||r.startsWith(s))}var y=t=>t.toLowerCase().replace(/\/+$/,"");function N(t,r,o){let s=t.sources.map(a=>r.get(a)).filter(a=>!!a),i=t.sources.filter(a=>!r.has(a)),e=s.filter(a=>k(a.content).size>=5&&E(a.content,t.content)<W).map(a=>a.id),u=[...s.map(a=>`${a.date??""}
2
2
  ${a.content}`),t.previous??""].join(`
3
3
  `),l=u.toLowerCase(),d=$(u),p=new Set(d.urls.map(y)),g=new Set(d.numbers),n=$(t.content),c=[];for(let a of n.commits)j(l,a,d.commits)||c.push(`commit ${a}`);for(let a of n.urls)!p.has(y(a))&&!l.includes(y(a))&&c.push(`link ${a}`);for(let a of n.numbers)/^\d{1,2}$/.test(a)||!g.has(a)&&!l.includes(a)&&c.push(`number ${a}`);let h=[];for(let a of s){let m=$(a.content);if(m.commits.length===0&&m.urls.length===0)continue;let v=o(a.id),S=(v.length>0?v:[t.content]).join(`
4
4
  `).toLowerCase(),x=$(S);for(let b of m.commits)j(S,b,x.commits)||h.push({entry:a.id,fact:`commit ${b}`});for(let b of m.urls)S.includes(y(b))||h.push({entry:a.id,fact:`link ${b}`})}return{path:t.path,title:t.title,type:t.type,sources:t.sources.length,missingSources:i,weakSources:e,ungrounded:c,lost:h}}function U(t,r){let o=r.toLowerCase(),s=w(r).commits,i=[];for(let e of t){let u=w(e.content),l=[...u.commits.filter(d=>!j(o,d,s)).map(d=>`commit ${d}`),...u.urls.filter(d=>!o.includes(y(d))).map(d=>`link ${d}`)];l.length>0&&i.push({entry:e.id,facts:l})}return i}var P=new Set("the and for with from into of on in at to by an a".split(" "));function L(t){return new Set((t||"").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(r=>(r.length>1||/\d/.test(r))&&!P.has(r)&&!R.has(r)))}function M(t,r){if(t.size===0||r.size===0)return 0;let o=0;for(let s of t)r.has(s)&&o++;return o/(t.size+r.size-o)}function D(t,r,o={}){let s=o.titleMin??.75,i=o.sourcesMin??.5,e=t.map(l=>({...l,tt:L(l.title),ss:new Set(l.sources??[])})),u=[];for(let l=0;l<e.length;l++)for(let d=l+1;d<e.length;d++){let p=e[l],g=e[d];if(r&&!r.has(p.path)&&!r.has(g.path))continue;let n=(p.type??"")===(g.type??"")?M(p.tt,g.tt):0;if(n>=s){u.push({a:p.path,b:g.path,reason:"title",score:n});continue}if(p.ss.size>=2&&g.ss.size>=2){let c=M(p.ss,g.ss);c>=i&&u.push({a:p.path,b:g.path,reason:"sources",score:c})}}return u.sort((l,d)=>d.score-l.score||l.a.localeCompare(d.a))}var A=4e3;function J(t,r){let o=r.map(i=>{let e=i.content.length>A?`${i.content.slice(0,A)}
@@ -33,4 +33,4 @@ Reply with JSON only, no fencing:
33
33
  {"claims": 0, "supported": 0, "unsupported": [], "contradicted": [], "off_subject": [], "missing": [], "verdict": "good"}`}function z(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let r=t,o=l=>Array.isArray(l)?l.map(d=>String(d)):[],s=l=>typeof l=="number"&&Number.isFinite(l)&&l>=0?Math.round(l):NaN,i=s(r.claims);if(Number.isNaN(i))return null;let e=Math.min(i,Number.isNaN(s(r.supported))?i-o(r.unsupported).length:s(r.supported)),u=r.verdict==="good"||r.verdict==="minor"||r.verdict==="major"?r.verdict:null;return u?{claims:i,supported:Math.max(0,e),unsupported:o(r.unsupported),contradicted:o(r.contradicted),offSubject:o(r.off_subject??r.offSubject),missing:o(r.missing),verdict:u}:null}function I(t,r,o,s=[],i=5,e){let u={};for(let n of t)u[n.type??"untyped"]=(u[n.type??"untyped"]??0)+1;let l=new Set,d=new Set;for(let n of t)for(let c of n.lost)l.add(c.entry),d.add(`${c.entry}|${c.fact}`);let p=new Set(r.flatMap(n=>[n.a,n.b]).filter(n=>t.some(c=>c.path===n))),g={sample:{articles:t.length,seed:o.seed,since:o.since,byType:u},citations:{withSources:t.filter(n=>n.sources>0).length,missingSources:t.reduce((n,c)=>n+c.missingSources.length,0),weakSources:t.reduce((n,c)=>n+c.weakSources.length,0),articlesWithWeak:t.filter(n=>n.weakSources.length>0).length},grounding:{articlesWithUngrounded:t.filter(n=>n.ungrounded.length>0).length,ungroundedFacts:t.reduce((n,c)=>n+c.ungrounded.length,0)},lost:{entriesWithLostFacts:l.size,lostFacts:d.size},duplicates:{pairs:r.length,articlesInPair:p.size},...e?{uncited:{entries:e.entries,withLostFacts:e.lost.length}}:{},examples:{ungrounded:t.filter(n=>n.ungrounded.length>0).slice(0,i).map(n=>({path:n.path,facts:n.ungrounded.slice(0,6)})),lost:t.flatMap(n=>n.lost.map(c=>({path:n.path,...c}))).slice(0,i),weak:t.filter(n=>n.weakSources.length>0).slice(0,i).map(n=>({path:n.path,entries:n.weakSources})),duplicates:r.slice(0,i),uncited:(e?.lost??[]).slice(0,i).map(n=>({entry:n.entry,facts:n.facts.slice(0,4)})),judged:s.filter(n=>n.verdict.verdict!=="good").slice(0,i).map(n=>({path:n.path,verdict:n.verdict.verdict,unsupported:n.verdict.unsupported.slice(0,4),contradicted:n.verdict.contradicted.slice(0,4),offSubject:n.verdict.offSubject,missing:n.verdict.missing.slice(0,4)}))}};if(s.length>0){let n=s.map(a=>a.verdict),c=n.reduce((a,m)=>a+m.claims,0),h=n.reduce((a,m)=>a+m.supported,0);g.judge={judged:n.length,claims:c,supported:h,supportRate:c>0?h/c:1,unsupported:n.reduce((a,m)=>a+m.unsupported.length,0),contradicted:n.reduce((a,m)=>a+m.contradicted.length,0),articlesWithWrongMerge:n.filter(a=>a.offSubject.length>0).length,missingFacts:n.reduce((a,m)=>a+m.missing.length,0),verdicts:{good:n.filter(a=>a.verdict==="good").length,minor:n.filter(a=>a.verdict==="minor").length,major:n.filter(a=>a.verdict==="major").length}}}return g}var f=(t,r)=>r>0?`${Math.round(t/r*100)}%`:"\u2013";function O(t){let r=t.sample.articles,o=["# Wiki absorb scorecard","",`Sample: ${r} articles (seed \`${t.sample.seed}\`${t.sample.since?`, changed since ${t.sample.since}`:""}). Types: ${Object.entries(t.sample.byType).map(([e,u])=>`${e} ${u}`).join(", ")||"\u2013"}.`,"","| Check | Result | Lower is better? |","|---|---|---|",`| Articles citing at least one entry | ${t.citations.withSources}/${r} (${f(t.citations.withSources,r)}) | no |`,`| Cited ids with no entry | ${t.citations.missingSources} | yes |`,`| Articles with a weak citation (entry shares <${Math.round(W*100)}% of its words) | ${t.citations.articlesWithWeak}/${r} (${f(t.citations.articlesWithWeak,r)}) | yes |`,`| Articles with an ungrounded commit, link or number | ${t.grounding.articlesWithUngrounded}/${r} (${f(t.grounding.articlesWithUngrounded,r)}) | yes |`,`| Ungrounded facts | ${t.grounding.ungroundedFacts} | yes |`,`| Commits or links lost from cited entries | ${t.lost.lostFacts} across ${t.lost.entriesWithLostFacts} entries | yes |`,`| Sampled articles in a likely duplicate pair | ${t.duplicates.articlesInPair}/${r} (${f(t.duplicates.articlesInPair,r)}) | yes |`];if(t.uncited&&o.push(`| Entries read in the window but cited by no article | ${t.uncited.entries} | \u2013 |`,`| \u2026of which carry a commit or link no article has | ${t.uncited.withLostFacts} | yes |`),t.judge){let e=t.judge;o.push(`| Judge: claims supported by the cited entries | ${e.supported}/${e.claims} (${f(e.supported,e.claims)}) | no |`,`| Judge: unsupported / contradicted claims | ${e.unsupported} / ${e.contradicted} | yes |`,`| Judge: articles with an off-subject source (wrong merge) | ${e.articlesWithWrongMerge}/${e.judged} (${f(e.articlesWithWrongMerge,e.judged)}) | yes |`,`| Judge: facts missing from the article | ${e.missingFacts} | yes |`,`| Judge verdicts good / minor / major | ${e.verdicts.good} / ${e.verdicts.minor} / ${e.verdicts.major} | \u2013 |`)}let s=t.examples,i=(e,u)=>{u.length!==0&&o.push("",`## ${e}`,"",...u)};return i("Examples: ungrounded facts",s.ungrounded.map(e=>`- \`${e.path}\`: ${e.facts.join("; ")}`)),i("Examples: lost facts",s.lost.map(e=>`- \`${e.path}\` \u2190 entry \`${e.entry}\`: ${e.fact}`)),i("Examples: weak citations",s.weak.map(e=>`- \`${e.path}\`: ${e.entries.map(u=>`\`${u}\``).join(", ")}`)),i("Examples: uncited entries with facts no article has",s.uncited.map(e=>`- \`${e.entry}\`: ${e.facts.join("; ")}`)),i("Examples: likely duplicates",s.duplicates.map(e=>`- \`${e.a}\` \u2194 \`${e.b}\` (${e.reason}, ${e.score.toFixed(2)})`)),i("Examples: judge findings",s.judged.map(e=>{let u=[e.unsupported.length?`unsupported: ${e.unsupported.join(" | ")}`:"",e.contradicted.length?`contradicted: ${e.contradicted.join(" | ")}`:"",e.offSubject.length?`off-subject: ${e.offSubject.join(", ")}`:"",e.missing.length?`missing: ${e.missing.join(" | ")}`:""].filter(Boolean);return`- \`${e.path}\` (${e.verdict}): ${u.join("; ")}`})),o.push("","## Method","","- The sample is drawn with a seeded shuffle from the articles changed in the window, so the same seed and window give the same articles.","- Ungrounded: a commit hash, link or number (three digits or more, or a date) in the article that no cited entry and no earlier version of the article contains.","- Lost: a commit hash or link in a cited entry that no article citing that entry contains.","- Uncited: entries the absorb ledger marks as read in the window that no article cites; those carrying a commit or link that no article on the node has are counted as lost, since absorb will not offer them again.","- Weak citation: a cited entry sharing fewer than 15% of its distinctive words with the article.","- Duplicate: two articles of the same type whose titles share at least 75% of their words, or which share at least half their sources.","- Judge (optional): one model call per article reads the article and its cited entries and lists unsupported, contradicted, off-subject and missing items."),o.join(`
34
34
  `)+`
35
35
  `}function V(t){if(!t||typeof t!="object")return{};let r=t,o=r.usage??{},s=i=>typeof i=="number"&&Number.isFinite(i)?i:void 0;return{costUsd:s(r.total_cost_usd)??s(r.cost_usd),apiMs:s(r.duration_api_ms),inputTokens:s(o.input_tokens),outputTokens:s(o.output_tokens),cacheReadTokens:s(o.cache_read_input_tokens),cacheWriteTokens:s(o.cache_creation_input_tokens)}}function C(t,r){return t.length===0?0:t[Math.min(t.length-1,Math.floor(r*t.length))]}function Y(t){let r=new Map,o=i=>{let e=i||"(none)",u=r.get(e);return u||r.set(e,u={calls:[],runs:[]}),u};for(let i of t)i.kind==="call"?o(i.label).calls.push(i):i.kind==="run"&&o(i.label).runs.push(i);let s=[];for(let[i,{calls:e,runs:u}]of r){if(e.length===0)continue;let l=e.map(n=>n.wallMs).sort((n,c)=>n-c),d;if(u.length>0)d=u.reduce((n,c)=>n+(Date.parse(c.endedAt)-Date.parse(c.startedAt)),0);else{let n=e.map(h=>Date.parse(h.at)-h.wallMs),c=e.map(h=>Date.parse(h.at));d=Math.max(...c)-Math.min(...n)}let p=e.reduce((n,c)=>n+c.entries,0),g=e.reduce((n,c)=>n+(c.costUsd??0),0);s.push({label:i,calls:e.length,failed:e.filter(n=>n.failed).length,entries:p,articles:e.reduce((n,c)=>n+c.articles,0),refused:e.reduce((n,c)=>n+c.refused,0),heldCited:e.reduce((n,c)=>n+(c.heldCited??0),0),wallMs:d,callMsP50:C(l,.5),callMsP95:C(l,.95),prepMs:e.reduce((n,c)=>n+(c.prepMs??0),0),costUsd:g,costPerEntry:p>0?g/p:0,entriesPerMinute:d>0?p/d*6e4:0,promptChars:e.reduce((n,c)=>n+c.promptChars,0)})}return s.sort((i,e)=>i.label.localeCompare(e.label))}export{T as a,_ as b,k as c,E as d,W as e,N as f,U as g,D as h,A as i,J as j,z as k,I as l,O as m,V as n,Y as o};
36
- //# sourceMappingURL=chunk-BY3AUZYM.js.map
36
+ //# sourceMappingURL=chunk-YTS54UZ5.js.map
package/dist/cli.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-4GDIWCDM.js"),{installCliSignalExit:r}=await import("./signal-exit-WL7G3EEZ.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
2
+ import{b as o}from"./chunk-OSH2PEBH.js";import"./chunk-QIJLFPWE.js";var e=o(process.versions.node);e&&(console.error(e),process.exit(1));var{buildProgram:s}=await import("./program-736BTK4B.js"),{installCliSignalExit:r}=await import("./signal-exit-C5EUGHKI.js"),{applyConnectAttemptTimeout:i,configPathFromArgv:a,readConnectAttemptTimeout:n}=await import("./net-family-X2P3OVDP.js");r();i(n(process.cwd(),a(process.argv.slice(2))));var t=await s();process.argv.slice(2).length===0?t.outputHelp():t.parse();
3
3
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g}from"./chunk-IGBW4VVM.js";import"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
- //# sourceMappingURL=client-SQMU25PS.js.map
1
+ import{a,b,c,d,e,f,g}from"./chunk-GSQ2RCOZ.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{b as fetchAgents,d as fetchCrons,c as fetchProcesses,e as killProcess,a as resolveConn,f as sendTask,g as streamTask};
2
+ //# sourceMappingURL=client-57TCFIV5.js.map
@@ -1,4 +1,4 @@
1
- import{a as y}from"./chunk-QOYAX2FT.js";import"./chunk-QIJLFPWE.js";import{readFileSync as O,writeFileSync as k,existsSync as w,mkdirSync as E}from"fs";import{resolve as f}from"path";function d(t,o){let n=new Map;for(let r of t){if(r.role!=="agent")continue;let s=y(r.content);for(let c of s)n.set(c,(n.get(c)||0)+1)}let e=[...n.entries()].sort((r,s)=>s[1]-r[1]).slice(0,50).map(([r])=>r);return{lexicon:n,toolCalls:o||[],topKeywords:e,capturedAt:new Date().toISOString(),messageCount:t.length}}function S(t,o){let n=T(t,o),{distance:e,newTools:r,missingTools:s}=b(t,o),c=I(t,o),a=Math.min(1,n*.4+e*.3+c*.3),m=t.topKeywords.filter(u=>!o.lexicon.has(u)||(o.lexicon.get(u)||0)===0).slice(0,10);return{overallScore:Math.round(a*100)/100,lexiconDecay:Math.round(n*100)/100,toolShift:Math.round(e*100)/100,semanticDrift:Math.round(c*100)/100,lostWords:m,newTools:r,missingTools:s}}function T(t,o){if(t.topKeywords.length===0)return 0;let n=0;for(let e of t.topKeywords)o.lexicon.has(e)||n++;return n/t.topKeywords.length}function b(t,o){let n=new Set(t.toolCalls),e=new Set(o.toolCalls);if(n.size===0&&e.size===0)return{distance:0,newTools:[],missingTools:[]};let r=[...n].filter(l=>e.has(l)),s=new Set([...n,...e]),a=1-r.length/s.size,m=[...e].filter(l=>!n.has(l)),u=[...n].filter(l=>!e.has(l));return{distance:a,newTools:m,missingTools:u}}function I(t,o){if(t.topKeywords.length===0)return 0;let n=new Set(o.topKeywords),e=0;for(let r of t.topKeywords)n.has(r)&&e++;return 1-e/t.topKeywords.length}var C=".agentx/drift";function M(t,o,n=process.cwd()){let e=f(n,C);w(e)||E(e,{recursive:!0});let r={...o,lexicon:Object.fromEntries(o.lexicon)};k(f(e,`${t}.json`),JSON.stringify(r,null,2))}function v(t,o=process.cwd()){let n=f(o,C,`${t}.json`);if(!w(n))return null;try{let e=JSON.parse(O(n,"utf-8"));return{...e,lexicon:new Map(Object.entries(e.lexicon))}}catch{return null}}var R="claude-haiku-4-5-20251001";var A=5e4,K=6,F=8,P=`You are a conversation summarizer. Given a conversation history between a user and an AI agent, produce a concise summary that preserves:
1
+ import{a as y}from"./chunk-AHWWJ7AF.js";import"./chunk-QIJLFPWE.js";import{readFileSync as O,writeFileSync as k,existsSync as w,mkdirSync as E}from"fs";import{resolve as f}from"path";function d(t,o){let n=new Map;for(let r of t){if(r.role!=="agent")continue;let s=y(r.content);for(let c of s)n.set(c,(n.get(c)||0)+1)}let e=[...n.entries()].sort((r,s)=>s[1]-r[1]).slice(0,50).map(([r])=>r);return{lexicon:n,toolCalls:o||[],topKeywords:e,capturedAt:new Date().toISOString(),messageCount:t.length}}function S(t,o){let n=T(t,o),{distance:e,newTools:r,missingTools:s}=b(t,o),c=I(t,o),a=Math.min(1,n*.4+e*.3+c*.3),m=t.topKeywords.filter(u=>!o.lexicon.has(u)||(o.lexicon.get(u)||0)===0).slice(0,10);return{overallScore:Math.round(a*100)/100,lexiconDecay:Math.round(n*100)/100,toolShift:Math.round(e*100)/100,semanticDrift:Math.round(c*100)/100,lostWords:m,newTools:r,missingTools:s}}function T(t,o){if(t.topKeywords.length===0)return 0;let n=0;for(let e of t.topKeywords)o.lexicon.has(e)||n++;return n/t.topKeywords.length}function b(t,o){let n=new Set(t.toolCalls),e=new Set(o.toolCalls);if(n.size===0&&e.size===0)return{distance:0,newTools:[],missingTools:[]};let r=[...n].filter(l=>e.has(l)),s=new Set([...n,...e]),a=1-r.length/s.size,m=[...e].filter(l=>!n.has(l)),u=[...n].filter(l=>!e.has(l));return{distance:a,newTools:m,missingTools:u}}function I(t,o){if(t.topKeywords.length===0)return 0;let n=new Set(o.topKeywords),e=0;for(let r of t.topKeywords)n.has(r)&&e++;return 1-e/t.topKeywords.length}var C=".agentx/drift";function M(t,o,n=process.cwd()){let e=f(n,C);w(e)||E(e,{recursive:!0});let r={...o,lexicon:Object.fromEntries(o.lexicon)};k(f(e,`${t}.json`),JSON.stringify(r,null,2))}function v(t,o=process.cwd()){let n=f(o,C,`${t}.json`);if(!w(n))return null;try{let e=JSON.parse(O(n,"utf-8"));return{...e,lexicon:new Map(Object.entries(e.lexicon))}}catch{return null}}var R="claude-haiku-4-5-20251001";var A=5e4,K=6,F=8,P=`You are a conversation summarizer. Given a conversation history between a user and an AI agent, produce a concise summary that preserves:
2
2
 
3
3
  1. Key decisions made and their reasoning
4
4
  2. Important facts learned (names, IDs, paths, URLs, credentials shared)
@@ -25,4 +25,4 @@ ${o.summary}`,timestamp:new Date().toISOString()},...n]}async function $(t,o,n,e
25
25
  `).slice(-20);return`[Summary unavailable \u2014 keeping last ${s.length} lines]
26
26
  ${s.join(`
27
27
  `)}`}}export{W as applyCompaction,J as compactSession,G as needsCompaction};
28
- //# sourceMappingURL=compaction-26OHHULF.js.map
28
+ //# sourceMappingURL=compaction-R7VWQB6X.js.map
@@ -1,2 +1,2 @@
1
- import{Ab as x,Bb as y,Cb as z,Db as A,Eb as B,Gb as C,db as a,eb as b,fb as c,gb as d,hb as e,ib as f,jb as g,kb as h,lb as i,mb as j,nb as k,ob as l,pb as m,qb as n,rb as o,sb as p,tb as q,ub as r,vb as s,wb as t,xb as u,yb as v,zb as w}from"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";C();export{a as INTEGRATION_KINDS,x as WIKI_CONTRIBUTE_JOB,y as WIKI_CONTRIBUTE_MERGE_JOB,A as WIKI_SUMMARIZE_JOB,q as approvalsConfigSchema,f as callsSchema,d as cameraBotSchema,v as crossFieldProblems,s as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,t as expandEnvVars,e as isCronExpression,u as loadDaemonConfig,n as membersConfigSchema,i as mergePolicyConfigSchema,m as peopleConfigSchema,l as personSchema,p as qualityReportConfigSchema,o as requestStatusConfigSchema,k as requestsConfigSchema,g as reviewGateConfigSchema,h as trackersConfigSchema,w as validateWorkspaces,r as wallConfigSchema,j as watchersConfigSchema,z as withContributionJobs,B as withSummariesJob};
2
- //# sourceMappingURL=config-56NBA4SF.js.map
1
+ import{Ab as x,Bb as y,Cb as z,Db as A,Eb as B,Gb as C,db as a,eb as b,fb as c,gb as d,hb as e,ib as f,jb as g,kb as h,lb as i,mb as j,nb as k,ob as l,pb as m,qb as n,rb as o,sb as p,tb as q,ub as r,vb as s,wb as t,xb as u,yb as v,zb as w}from"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";C();export{a as INTEGRATION_KINDS,x as WIKI_CONTRIBUTE_JOB,y as WIKI_CONTRIBUTE_MERGE_JOB,A as WIKI_SUMMARIZE_JOB,q as approvalsConfigSchema,f as callsSchema,d as cameraBotSchema,v as crossFieldProblems,s as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,t as expandEnvVars,e as isCronExpression,u as loadDaemonConfig,n as membersConfigSchema,i as mergePolicyConfigSchema,m as peopleConfigSchema,l as personSchema,p as qualityReportConfigSchema,o as requestStatusConfigSchema,k as requestsConfigSchema,g as reviewGateConfigSchema,h as trackersConfigSchema,w as validateWorkspaces,r as wallConfigSchema,j as watchersConfigSchema,z as withContributionJobs,B as withSummariesJob};
2
+ //# sourceMappingURL=config-RHCIE7VE.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-IFHVAHQM.js";import"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
- //# sourceMappingURL=config-mutate-PD4O3HZ7.js.map
1
+ import{a,b}from"./chunk-A4PW7EIK.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
+ //# sourceMappingURL=config-mutate-HCYXR2WP.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e}from"./chunk-NS2HSAHF.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{b as applyConfigMutation,a as findConfigPath,d as getAtPath,c as setAtPath,e as unsetAtPath};
2
+ //# sourceMappingURL=config-mutator-JQ2R4J5Z.js.map
@@ -1,4 +1,4 @@
1
- import{a as ee}from"./chunk-NIPMVM3G.js";import"./chunk-YSPBVLTZ.js";import{f as Q,k as V}from"./chunk-VJVXEVZ7.js";import{b as O}from"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-Z4XVPGPZ.js";import"./chunk-JTFCU5LH.js";import"./chunk-QB6UPODO.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-YX4R2VGD.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-BERWTVG2.js";import{b as N,c as H}from"./chunk-QOYAX2FT.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as le}from"crypto";import{existsSync as z,mkdirSync as ne,readdirSync as re,readFileSync as ge,renameSync as se,writeFileSync as pe}from"fs";import{resolve as w}from"path";var _={maxPatches:30,maxCostUsd:.5,maxItems:60},he=12,fe=2e3,me=1500,M=8,U=300,be=12,B="## Checked facts";function S(n){return w(n,"_contributions")}function E(n,r){if(!z(n))return r;try{return JSON.parse(ge(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}}function L(n,r){ne(w(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;pe(t,`${JSON.stringify(r,null,2)}
1
+ import{a as ee}from"./chunk-7EMPPP3E.js";import"./chunk-OJ53ATNN.js";import{f as Q,k as V}from"./chunk-VJVXEVZ7.js";import{b as O}from"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-V6QFBL6F.js";import"./chunk-JTFCU5LH.js";import"./chunk-56F5UTTA.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-LR4QUAJT.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-BERWTVG2.js";import{b as N,c as H}from"./chunk-AHWWJ7AF.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as le}from"crypto";import{existsSync as z,mkdirSync as ne,readdirSync as re,readFileSync as ge,renameSync as se,writeFileSync as pe}from"fs";import{resolve as w}from"path";var _={maxPatches:30,maxCostUsd:.5,maxItems:60},he=12,fe=2e3,me=1500,M=8,U=300,be=12,B="## Checked facts";function S(n){return w(n,"_contributions")}function E(n,r){if(!z(n))return r;try{return JSON.parse(ge(n,"utf-8"))}catch(t){throw new Error(`${n} is not valid JSON: ${t.message}`)}}function L(n,r){ne(w(n,".."),{recursive:!0});let t=`${n}.${process.pid}.tmp`;pe(t,`${JSON.stringify(r,null,2)}
2
2
  `),se(t,n)}function ie(n){return{agents:E(w(S(n),"state.json"),{agents:{}}).agents??{}}}function ye(n){let r=w(S(n),"pending");return z(r)?re(r).filter(t=>t.endsWith(".json")).sort().map(t=>E(w(r,t),null)).filter(t=>!!t):[]}function G(n){return w(S(n),"held.json")}function K(n,r={}){let t=E(G(n),[]);return r.all?t:t.filter(a=>a.status==="held")}function _e(n){let r=w(S(n),"reports");if(!z(r))return null;let t=re(r).filter(a=>a.endsWith(".json")).sort().pop();return t?E(w(r,t),null):null}function ke(n,r,t,a={}){let o=ie(r).agents[t],c=a.now??Date.now(),e=a.since??o?.lastRunAt??new Date(c-864e5).toISOString(),d=e.slice(0,10),u=new Set(o?.processed??[]),s=[];for(let g of n.getAgentEntries(t))g.date<d||u.has(g.id)||s.push({id:g.id,at:g.date,kind:"chat",title:[g.source,g.sourceContext].filter(Boolean).join(" \xB7 "),text:g.content});if(a.db){let g=Date.parse(e);for(let l of V(a.db,{agentId:t,since:Number.isFinite(g)?g:void 0,limit:500})){if(l.status==="in-flight"||u.has(l.taskId))continue;let k=(Q(a.db,l.taskId)?.steps??[]).filter(b=>b.name==="tool_use"||b.action).slice(0,be).map(b=>`- ${b.action??b.name}${b.inputSummary?` ${x(b.inputSummary,160)}`:""}${b.outputSummary?` \u2192 ${x(b.outputSummary,240)}`:""}${b.error?` \u2717 ${x(b.error,120)}`:""}`),y=[`Request: ${x(l.originalMessage??l.messagePreview??"",600)}`,k.length?`Tool calls:
3
3
  ${k.join(`
4
4
  `)}`:"",l.finalResponse?`Reply: ${x(l.finalResponse,800)}`:""].filter(Boolean).join(`
@@ -54,4 +54,4 @@ _Sources: ${t.sources.join("; ")}._`,a);return n.writeArticle(r,{title:t.title,.
54
54
  `).replace(/\n{3,}/g,`
55
55
 
56
56
  `).trim(),superseded:d}}function Ce(n){let r=n.previous?` (previously: ${n.previous})`:"";return`- **${n.attribute}:** ${n.value} \u2014 ${n.source}; checked ${n.checkedAt.slice(0,10)} by ${n.by}${r}`}function Re(n){let r=n.match(/^- \*\*.+?:\*\* (.*?) — .*?; checked (\S+) by \S+(?: \(previously: (.*)\))?$/);return r?{value:r[1],checkedAt:r[2],...r[3]?{previous:r[3]}:{}}:void 0}function J(n,r){return`contribution:${n}@${r.slice(0,10)}`}var Te={person:"people",project:"projects",place:"places",concept:"concepts",event:"events",decision:"decisions",pattern:"patterns"};function de(n,r,t){let a=r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,60)||"page",o=t?Te[t]:"contributions",c=`${o}/${a}.md`;for(let e=2;n.readArticle(c);e++)c=`${o}/${a}-${e}.md`;return c}export{_ as DEFAULT_CONTRIBUTION_LIMITS,B as FACTS_HEADING,ue as applyFactLines,De as approveHeld,xe as buildContributionPrompt,S as contributionsDir,_e as latestReport,K as listHeld,ye as listPendingBatches,Be as mergeContributions,W as pageKey,Ae as parseContributionPatches,ke as pendingWork,Se as possibleDuplicate,Fe as rejectHeld,ce as replaceOnce,Me as runContribution};
57
- //# sourceMappingURL=contributions-DKTJ623L.js.map
57
+ //# sourceMappingURL=contributions-R4HXLJXU.js.map
@@ -1,2 +1,2 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i}from"./chunk-5NGQQOVK.js";import"./chunk-XI2HH5NR.js";import"./chunk-IMLAPB7G.js";import"./chunk-CTNZVRPA.js";import"./chunk-MNG2AMKZ.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-OSH2PEBH.js";import"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{i as daemonVoiceCheck,b as doctor,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
- //# sourceMappingURL=doctor-OI6GJZR5.js.map
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i}from"./chunk-CVPERUWT.js";import"./chunk-WKHRKYCY.js";import"./chunk-IMLAPB7G.js";import"./chunk-CTNZVRPA.js";import"./chunk-MNG2AMKZ.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-OSH2PEBH.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{i as daemonVoiceCheck,b as doctor,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
+ //# sourceMappingURL=doctor-22PZVT6A.js.map
@@ -1,7 +1,7 @@
1
- import{b as h}from"./chunk-4KNHLHE3.js";import"./chunk-RKPAVWXF.js";import"./chunk-H2KOXGDX.js";import{b as I}from"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import"./chunk-FYFJ7IQJ.js";import"./chunk-FDX4IGLK.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";var p=t=>typeof t=="string"?t.trim():"";function $(t){return[`Run ${t.runId} "${t.title}" [${t.status}] on step ${t.step}: waiting on ${t.waitingOn}.`,t.tags?.length?`Tags: ${t.tags.join(", ")}`:"",...(t.steps??[]).slice(-8).map(s=>`- ${String(s.at).slice(0,16).replace("T"," ")} ${s.step} ${s.status}${s.note?`: ${s.note}`:""}`)].filter(Boolean).join(`
1
+ import{b as h}from"./chunk-4HYIERJ4.js";import"./chunk-RKPAVWXF.js";import"./chunk-V4IOGISL.js";import{b as I}from"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import"./chunk-RTIGD4NG.js";import"./chunk-NS2HSAHF.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";var p=t=>typeof t=="string"?t.trim():"";function $(t){return[`Run ${t.runId} "${t.title}" [${t.status}] on step ${t.step}: waiting on ${t.waitingOn}.`,t.tags?.length?`Tags: ${t.tags.join(", ")}`:"",...(t.steps??[]).slice(-8).map(s=>`- ${String(s.at).slice(0,16).replace("T"," ")} ${s.step} ${s.status}${s.note?`: ${s.note}`:""}`)].filter(Boolean).join(`
2
2
  `)}async function T(t,c){let s=c.fetch??fetch,m=c.daemonUrl.replace(/\/$/,""),r=(p(t.action)||"list").toLowerCase(),f=c.env??process.env,w=async i=>{let l=await s(`${m}${i}`,{signal:AbortSignal.timeout(1e4)}),n=await l.json().catch(()=>({}));return{ok:l.ok,status:l.status,data:n}};try{if(r==="list"){let e=await w("/follow-up");if(!e.ok)return`Error: ${e.data?.error||`HTTP ${e.status}`}`;let o=e.data.groups??[];return o.length?o.map(d=>[`${d.tag}:`,...d.rows.map(a=>`- ${a.runId} "${a.title}" on ${a.step}: waiting on ${a.waitingOn} (since ${String(a.since).slice(0,16).replace("T"," ")} UTC)`)].join(`
3
3
  `)).join(`
4
4
  `):"No follow-up workflows are running."}if(r==="match"){let e=p(t.request)||p(t.title);if(!e)return"Error: match needs `request`: the owner's request in their words.";let o=h(t,f),d=await w(`/follow-up/match?q=${encodeURIComponent(e)}${o?`&agentId=${encodeURIComponent(o.agentId)}`:""}`);if(!d.ok)return`Error: ${d.data?.error||`HTTP ${d.status}`}`;let a=d.data.matches??[];return a.length?["Saved workflows, best fit first (confidence 0-1):",...a.map(u=>`- ${u.workflowId} "${u.title}" (${u.confidence}${u.autoStart?", starts without asking":""}): ${u.steps.map(k=>k.id).join(" \u2192 ")}`),'Start one with {action:"start", workflowId:"<id>", title:"\u2026", tags:["client:<name>"]}. Run its steps through the workflow, not by hand.'].join(`
5
5
  `):"No saved workflow fits. If the request has several steps, build one: start with title and steps."}if(r==="status"){let e=p(t.runId);if(!e)return"Error: status needs runId.";let o=await w(`/follow-up/${encodeURIComponent(e)}`);return o.ok?$(o.data.run):`Error: ${o.data?.error||`HTTP ${o.status}`}`}let i=h(t,f);if(!i)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let l=await s(`${m}/follow-up`,{method:"POST",headers:{"Content-Type":"application/json",...I(f)},body:JSON.stringify({action:r,agentId:i.agentId,workflowId:t.workflowId,title:t.title,description:t.description,tags:t.tags,inputs:t.inputs,steps:t.steps,edges:t.edges,approval:t.approval,autoStart:t.autoStart,requestId:t.requestId,runId:t.runId,step:t.step,evidence:t.evidence,note:t.note,reason:t.reason,fromRun:t.fromRun,status:t.status}),signal:AbortSignal.timeout(2e4)}),n=await l.json().catch(()=>({}));if(!l.ok)return`Error: ${n?.error||`HTTP ${l.status}`}`;if(r==="start"){let e=n.run;return[`Started run ${e.runId} "${e.title}"${n.built?" (built from the steps you gave; propose it with fromRun to keep it)":""}.`,n.awaitingApproval?"It waits for the owner's approval before the first step.":`It is on step ${e.step}: ${e.waitingOn}.`,"AgentX follows it from here: it starts each step, reminds whoever is slow, and tells the owner when it ends. Do not run its steps by hand.",...n.warning?[`Note: ${n.warning}`]:[]].join(" ")}return r==="plan"?[`Plan recorded on run ${n.run?.runId??t.runId}:`,...(n.plan??[]).map(e=>`- ${e.id} ${e.title}`),'Report each step with {action:"step", runId, step:"<id>", status:"started"|"done"|"failed"}.'].join(`
6
6
  `):r==="step"?`Step recorded. ${n.run?$(n.run):""}`.trim():r==="done"?`Step recorded as done. ${n.run?$(n.run):""}`.trim():r==="blocked"?"The step is marked blocked and the owner is told. Nothing more happens on it until it is sorted.":`Saved ${n.workflowId} switched off, and asked the owner (card ${n.cardId}) whether to keep it as a reusable workflow.`}catch(i){return`Error: couldn't reach the daemon (${i?.message??i}).`}}export{T as runWorkflowTool};
7
- //# sourceMappingURL=follow-up-tool-DYSLS6ZI.js.map
7
+ //# sourceMappingURL=follow-up-tool-MC4TBGLP.js.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-FJMTCU4S.js";import"./chunk-BITVUKT7.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-56F5UTTA.js";import"./chunk-WPNRDEHW.js";import"./chunk-LR4QUAJT.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
+ //# sourceMappingURL=hub-HXVIO4U5.js.map
package/dist/index.d.ts CHANGED
@@ -8559,6 +8559,13 @@ declare const daemonConfigSchema: z.ZodObject<{
8559
8559
  to: string;
8560
8560
  from: string;
8561
8561
  }>, "many">>;
8562
+ orgPeople: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
8563
+ role: z.ZodOptional<z.ZodString>;
8564
+ }, "strip", z.ZodTypeAny, {
8565
+ role?: string | undefined;
8566
+ }, {
8567
+ role?: string | undefined;
8568
+ }>>>;
8562
8569
  projects: z.ZodDefault<z.ZodArray<z.ZodObject<{
8563
8570
  id: z.ZodString;
8564
8571
  pm: z.ZodOptional<z.ZodString>;
@@ -8630,7 +8637,8 @@ declare const daemonConfigSchema: z.ZodObject<{
8630
8637
  plansDir?: string | undefined;
8631
8638
  maxAgentsPerDay?: number | undefined;
8632
8639
  dryRun?: boolean | undefined;
8633
- }>>;
8640
+ }>>; /** Speaking speed, 1 = normal. System voices: 175 words a minute times
8641
+ * this. ElevenLabs accepts 0.7 to 1.2 and is held to that range. */
8634
8642
  }, "strip", z.ZodTypeAny, {
8635
8643
  enabled: boolean;
8636
8644
  orgChart: Record<string, {
@@ -8675,6 +8683,9 @@ declare const daemonConfigSchema: z.ZodObject<{
8675
8683
  to: string;
8676
8684
  from: string;
8677
8685
  }[];
8686
+ orgPeople: Record<string, {
8687
+ role?: string | undefined;
8688
+ }>;
8678
8689
  contactMap: {
8679
8690
  client: string;
8680
8691
  channel?: string | undefined;
@@ -8752,6 +8763,9 @@ declare const daemonConfigSchema: z.ZodObject<{
8752
8763
  to: string;
8753
8764
  from: string;
8754
8765
  }[] | undefined;
8766
+ orgPeople?: Record<string, {
8767
+ role?: string | undefined;
8768
+ }> | undefined;
8755
8769
  contactMap?: {
8756
8770
  client: string;
8757
8771
  channel?: string | undefined;
@@ -8819,6 +8833,9 @@ declare const daemonConfigSchema: z.ZodObject<{
8819
8833
  to: string;
8820
8834
  from: string;
8821
8835
  }[];
8836
+ orgPeople: Record<string, {
8837
+ role?: string | undefined;
8838
+ }>;
8822
8839
  contactMap: {
8823
8840
  client: string;
8824
8841
  channel?: string | undefined;
@@ -8896,6 +8913,9 @@ declare const daemonConfigSchema: z.ZodObject<{
8896
8913
  to: string;
8897
8914
  from: string;
8898
8915
  }[] | undefined;
8916
+ orgPeople?: Record<string, {
8917
+ role?: string | undefined;
8918
+ }> | undefined;
8899
8919
  contactMap?: {
8900
8920
  client: string;
8901
8921
  channel?: string | undefined;
@@ -11610,6 +11630,9 @@ declare const daemonConfigSchema: z.ZodObject<{
11610
11630
  to: string;
11611
11631
  from: string;
11612
11632
  }[];
11633
+ orgPeople: Record<string, {
11634
+ role?: string | undefined;
11635
+ }>;
11613
11636
  contactMap: {
11614
11637
  client: string;
11615
11638
  channel?: string | undefined;
@@ -11864,6 +11887,9 @@ declare const daemonConfigSchema: z.ZodObject<{
11864
11887
  to: string;
11865
11888
  from: string;
11866
11889
  }[] | undefined;
11890
+ orgPeople?: Record<string, {
11891
+ role?: string | undefined;
11892
+ }> | undefined;
11867
11893
  contactMap?: {
11868
11894
  client: string;
11869
11895
  channel?: string | undefined;
@@ -18957,6 +18983,16 @@ declare const businessConfigSchema: z.ZodEffects<z.ZodObject<{
18957
18983
  to: string;
18958
18984
  from: string;
18959
18985
  }>, "many">>;
18986
+ /** People placed in the org chart (#1420), keyed by an id from the
18987
+ * top-level `people` list, with the role they hold (a key of `roles`).
18988
+ * A person named in a relation is in the chart without an entry here. */
18989
+ orgPeople: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
18990
+ role: z.ZodOptional<z.ZodString>;
18991
+ }, "strip", z.ZodTypeAny, {
18992
+ role?: string | undefined;
18993
+ }, {
18994
+ role?: string | undefined;
18995
+ }>>>;
18960
18996
  /** Per-project metadata. Phase 3 — defaults to empty array, so
18961
18997
  * existing agentx.json files validate without modification. */
18962
18998
  projects: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -19121,6 +19157,9 @@ declare const businessConfigSchema: z.ZodEffects<z.ZodObject<{
19121
19157
  to: string;
19122
19158
  from: string;
19123
19159
  }[];
19160
+ orgPeople: Record<string, {
19161
+ role?: string | undefined;
19162
+ }>;
19124
19163
  contactMap: {
19125
19164
  client: string;
19126
19165
  channel?: string | undefined;
@@ -19198,6 +19237,9 @@ declare const businessConfigSchema: z.ZodEffects<z.ZodObject<{
19198
19237
  to: string;
19199
19238
  from: string;
19200
19239
  }[] | undefined;
19240
+ orgPeople?: Record<string, {
19241
+ role?: string | undefined;
19242
+ }> | undefined;
19201
19243
  contactMap?: {
19202
19244
  client: string;
19203
19245
  channel?: string | undefined;
@@ -19265,6 +19307,9 @@ declare const businessConfigSchema: z.ZodEffects<z.ZodObject<{
19265
19307
  to: string;
19266
19308
  from: string;
19267
19309
  }[];
19310
+ orgPeople: Record<string, {
19311
+ role?: string | undefined;
19312
+ }>;
19268
19313
  contactMap: {
19269
19314
  client: string;
19270
19315
  channel?: string | undefined;
@@ -19342,6 +19387,9 @@ declare const businessConfigSchema: z.ZodEffects<z.ZodObject<{
19342
19387
  to: string;
19343
19388
  from: string;
19344
19389
  }[] | undefined;
19390
+ orgPeople?: Record<string, {
19391
+ role?: string | undefined;
19392
+ }> | undefined;
19345
19393
  contactMap?: {
19346
19394
  client: string;
19347
19395
  channel?: string | undefined;
@@ -19400,6 +19448,12 @@ declare class Organization {
19400
19448
  id: string;
19401
19449
  name?: string;
19402
19450
  }>);
19451
+ /** Take the chart from `config` in place, so every part of the business
19452
+ * layer that holds this object sees it at once (#1420). Throws, keeping
19453
+ * the old chart, when `config` is invalid. */
19454
+ replaceWith(config: BusinessConfig, people?: ReadonlyArray<{
19455
+ id: string;
19456
+ }>): void;
19403
19457
  get(agentId: string): EmployeeProfile | undefined;
19404
19458
  all(): EmployeeProfile[];
19405
19459
  /** Every relation, reportsTo included, with both ends written in full. */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Ia as Tt,Ja as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-XHJ5SVO5.js";import"./chunk-R3CDFSNF.js";import"./chunk-GTJIKXDB.js";import"./chunk-RDWDDPBI.js";import"./chunk-ZVP6GB4G.js";import"./chunk-XI2HH5NR.js";import"./chunk-EKJG63EJ.js";import"./chunk-4WSJKKSA.js";import"./chunk-7PQQZC6B.js";import"./chunk-IMLAPB7G.js";import"./chunk-6V5JBHUN.js";import"./chunk-2VDO2HEK.js";import"./chunk-5HLD66CW.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-UMHN33JQ.js";import"./chunk-CTNZVRPA.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-A5GYG56I.js";import"./chunk-343MPMLD.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-IS2IWRP7.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-X7UQY7CH.js";import"./chunk-QPABR72X.js";import"./chunk-H2KOXGDX.js";import"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import{m as lt,n as ct,o as dt,p as mt,q as pt,ya as yt}from"./chunk-Y5TBOMHY.js";import"./chunk-QGNV2HA4.js";import"./chunk-MEFPXHQJ.js";import{a as L}from"./chunk-BAXGL6TY.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-5YG2ZQQW.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{t as ut}from"./chunk-FYFJ7IQJ.js";import"./chunk-FDX4IGLK.js";import"./chunk-3UOTLMXD.js";import"./chunk-BE64IJWM.js";import"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-VWTBHLMX.js";import"./chunk-GEFZMDDX.js";import{a as ht}from"./chunk-7WGJZLVJ.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-Z4XVPGPZ.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-QB6UPODO.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-Y4TVCWWF.js";import{j as it,k as rt,l as at}from"./chunk-YX4R2VGD.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-AV7T3SYT.js";import"./chunk-LE3BXIUF.js";import"./chunk-BERWTVG2.js";import"./chunk-QOYAX2FT.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-DCIYOPJF.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Gb as nt,vb as tt,xb as st,zb as ot}from"./chunk-MD2HCGSC.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
1
+ import{Ia as Tt,Ja as Mt,a as St,b as kt,c as vt,d as xt,e as $t,f as Ct,g as Pt,h as bt}from"./chunk-4IKZSV5A.js";import"./chunk-I5TUF6U7.js";import"./chunk-GTJIKXDB.js";import"./chunk-NBWSZ53L.js";import"./chunk-ZVP6GB4G.js";import"./chunk-WKHRKYCY.js";import"./chunk-IMLAPB7G.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-NHW4IY6N.js";import"./chunk-6V5JBHUN.js";import"./chunk-2VDO2HEK.js";import"./chunk-5HLD66CW.js";import"./chunk-IS2IWRP7.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-MRIVENBY.js";import"./chunk-UMHN33JQ.js";import"./chunk-CTNZVRPA.js";import"./chunk-PPUN7YHA.js";import"./chunk-A5GYG56I.js";import"./chunk-2V6ZGE74.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-JWDJMFU6.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-QPABR72X.js";import"./chunk-V4IOGISL.js";import"./chunk-AJ5HMDRW.js";import"./chunk-KP7KDLZ2.js";import{m as lt,n as ct,o as dt,p as mt,q as pt,ya as yt}from"./chunk-UASRZKZQ.js";import"./chunk-2GIYVYIM.js";import"./chunk-MEFPXHQJ.js";import{a as L}from"./chunk-BAXGL6TY.js";import{A as D,B as z,C as V,a as ye,b as we,c as Se,d as Ae,e as Ie,f as Oe,g as Ne,h as He,i as je,j as Ue,k as _e,l as I,m as q,n as Be,o as qe,p as Ye,q as O,r as ze,s as Ve,t as Xe,u as x,v as Y,w as Qe,x as Ze,y as et,z as wt}from"./chunk-2LTZUZJU.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-6TTGRTDO.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{t as ut}from"./chunk-RTIGD4NG.js";import"./chunk-NS2HSAHF.js";import"./chunk-3UOTLMXD.js";import"./chunk-BE64IJWM.js";import"./chunk-PE5V2LI7.js";import"./chunk-GQ76J72O.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-VWTBHLMX.js";import"./chunk-FJMTCU4S.js";import{a as ht}from"./chunk-BITVUKT7.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-V6QFBL6F.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-56F5UTTA.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-R2KSORSK.js";import{j as it,k as rt,l as at}from"./chunk-LR4QUAJT.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-AV7T3SYT.js";import"./chunk-LE3BXIUF.js";import"./chunk-BERWTVG2.js";import"./chunk-AHWWJ7AF.js";import{a as ke,b as ve,c as xe,d as $e,e as Ce,f as Pe,g as be,h as Te,i as Me,j as Re,l as Ee,m as Ge,o as T,p as W}from"./chunk-DCIYOPJF.js";import{a as m,b as G}from"./chunk-7I7IEX4S.js";import{b as Fe,c as Le,d as A,e as De}from"./chunk-JHCI6XCJ.js";import{a as Ke,b as Je,e as We}from"./chunk-DSYKYZMT.js";import{Gb as nt,vb as tt,xb as st,zb as ot}from"./chunk-BZJF7DJR.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";W();G();import{execa as Rt}from"execa";import{existsSync as se,promises as X}from"fs";import S from"path";import ie from"node-fetch";async function Et(o,e){let t=o.split("/");if(t.length<2)throw new Error(`Invalid skill package ID: ${o}. Expected format: owner/repo`);let s=t[0],i=t[1],n=t[2];try{let a=n?`${s}/${i}/${n}`:`${s}/${i}`;await Rt("npx",["-y","skills","add",a],{cwd:e,stdio:"pipe"}),m.success(`Installed skill package: ${o}`);let r=S.resolve(e,".skills",`${s}_${i}`);if(se(r))return await ne(r,o);let d=S.resolve(e,".skills");return se(d)?await ne(d,o):[]}catch{return m.info(`Fetching skills directly from GitHub: ${s}/${i}`),await Gt(s,i,n,e)}}async function Gt(o,e,t,s){let i=[];try{let n=`https://api.github.com/repos/${o}/${e}/git/trees/main?recursive=1`,a=await ie(n);if(!a.ok)throw new Error(`GitHub API error: ${a.status}`);let d=(await a.json()).tree.filter(p=>p.type==="blob"&&p.path.endsWith("SKILL.md"));if(t){let p=d.find(f=>f.path.includes(`/${t}/`)||f.path===`${t}/SKILL.md`);if(p){let f=await oe(o,e,p.path,s);f&&i.push(f)}}else for(let p of d){let f=await oe(o,e,p.path,s);f&&i.push(f)}}catch(n){m.error(`Failed to fetch skills from GitHub: ${n.message}`)}return i}async function oe(o,e,t,s){try{let i=`https://raw.githubusercontent.com/${o}/${e}/main/${t}`,n=await ie(i);if(!n.ok)return null;let a=await n.text(),r=A(a);if(r){r.source="remote",r.packageId=`${o}/${e}`;let d=S.dirname(t),p=S.resolve(s,".skills",`${o}_${e}`,d);await X.mkdir(p,{recursive:!0}),await X.writeFile(S.resolve(p,"SKILL.md"),a),r.path=S.resolve(p,"SKILL.md")}return r}catch{return null}}async function ne(o,e){let t=[],{default:s}=await import("fast-glob"),i=await s.glob("**/SKILL.md",{cwd:o,deep:5});for(let n of i)try{let a=S.resolve(o,n),r=await X.readFile(a,"utf8"),d=A(r);d&&(d.source="remote",d.path=a,d.packageId=e,t.push(d))}catch{}return t}async function At(o,e,t,s,i){let n=["---",`name: ${o}`,`description: ${e}`];if(s?.length){n.push("tags:");for(let a of s)n.push(` - ${a}`)}if(i?.length){n.push("globs:");for(let a of i)n.push(` - ${a}`)}return n.push("---"),`${n.join(`
2
2
  `)}
3
3
 
4
4
  ${t}`}async function It(o){let{loadLocalSkills:e}=await import("./loader-YFVSSYSL.js");return e(o)}async function Ot(o,e,t,s,i){let a=[{role:"system",content:`You are a skill author for the Agent Skills ecosystem (skills.sh).