agentix-cli 0.204.0 → 0.205.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 (188) hide show
  1. package/dist/{App-FQRHQT5J.js → App-JDW5V4HT.js} +2 -2
  2. package/dist/{ChatApp-WBCGSGJM.js → ChatApp-SNM2PORO.js} +2 -2
  3. package/dist/{absorb-eval-3IU37HZQ.js → absorb-eval-WDAV4AI2.js} +2 -2
  4. package/dist/{adapter-URFSOOFE.js → adapter-C47BTKT6.js} +2 -2
  5. package/dist/{agent-P7XUCP3A.js → agent-EVMKJXJO.js} +2 -2
  6. package/dist/{board-dashboard-AVUFPO5X.js → board-dashboard-VSDTP4Y7.js} +404 -431
  7. package/dist/board-dashboard-VSDTP4Y7.js.map +1 -0
  8. package/dist/{chunk-WKR2OSCH.js → chunk-245IOYDJ.js} +2 -2
  9. package/dist/{chunk-FOWRNDMJ.js → chunk-2LJZHKTY.js} +2 -2
  10. package/dist/{chunk-P65XGEB7.js → chunk-2P3SHT5I.js} +2 -2
  11. package/dist/{chunk-JUSQMQ7L.js → chunk-2VSK6FAR.js} +2 -2
  12. package/dist/chunk-2YDG5CSS.js +2 -0
  13. package/dist/chunk-2YDG5CSS.js.map +1 -0
  14. package/dist/{chunk-T7WY5BSJ.js → chunk-5STGF4MI.js} +40 -40
  15. package/dist/chunk-5STGF4MI.js.map +1 -0
  16. package/dist/{chunk-Y4YOYOCG.js → chunk-AK46ORUI.js} +2 -2
  17. package/dist/{chunk-JKT5EFXT.js → chunk-CXFVIDJV.js} +2 -2
  18. package/dist/{chunk-ZPCSPEGO.js → chunk-CZVCT5ZV.js} +2 -2
  19. package/dist/{chunk-Y2D6FQBL.js → chunk-DOO4MUTS.js} +2 -2
  20. package/dist/{chunk-RIBANO2H.js → chunk-DUCYRNCT.js} +3 -3
  21. package/dist/chunk-DUCYRNCT.js.map +1 -0
  22. package/dist/{chunk-HX4R7RPR.js → chunk-DV42WUMD.js} +2 -2
  23. package/dist/{chunk-CAYY2IEV.js → chunk-EFGAPAYZ.js} +2 -2
  24. package/dist/{chunk-MAQFWGFT.js → chunk-ERVJLPS4.js} +2 -2
  25. package/dist/{chunk-5VD2J4JN.js → chunk-GWBFEVLO.js} +2 -2
  26. package/dist/{chunk-IAR5F3T5.js → chunk-IDGEDPRJ.js} +2 -2
  27. package/dist/chunk-IFNXMUEG.js +115 -0
  28. package/dist/chunk-IFNXMUEG.js.map +1 -0
  29. package/dist/{chunk-SLX3OHEW.js → chunk-IU63JGY3.js} +2 -2
  30. package/dist/{chunk-7QW4RECS.js → chunk-JSCVOB4G.js} +2 -2
  31. package/dist/{chunk-RUNCUVAH.js → chunk-JT5PIBCM.js} +2 -2
  32. package/dist/{chunk-EQPMQSJE.js → chunk-KRHVM26D.js} +2 -2
  33. package/dist/{chunk-WIGH5WMP.js → chunk-KWZ6NMXZ.js} +9 -9
  34. package/dist/{chunk-VGYW3Q7F.js → chunk-OLKYIKAZ.js} +2 -2
  35. package/dist/{chunk-RB7M2NPU.js → chunk-PQUK6XEW.js} +2 -2
  36. package/dist/{chunk-PSOE356C.js → chunk-PQX2VJUA.js} +2 -2
  37. package/dist/{chunk-TV5BDCQA.js → chunk-PTZNM2JU.js} +2 -2
  38. package/dist/{chunk-M4VYHPDS.js → chunk-PW3WG6JT.js} +2 -2
  39. package/dist/{chunk-EMWSFITR.js → chunk-QASIUKZJ.js} +2 -2
  40. package/dist/{chunk-N6NZBAWR.js → chunk-RXX4MYFL.js} +2 -2
  41. package/dist/{chunk-C2VZHIIX.js → chunk-S5A7QZVQ.js} +2 -2
  42. package/dist/{chunk-BIYEGA7Q.js → chunk-S6YN3IBM.js} +2 -2
  43. package/dist/{chunk-CJI26AJC.js → chunk-SKCOIP5R.js} +3 -3
  44. package/dist/{chunk-V3FSKTDF.js → chunk-UGRMFQAG.js} +2 -2
  45. package/dist/{chunk-XPZSEDE3.js → chunk-WDGATQV3.js} +4 -4
  46. package/dist/{chunk-XPZSEDE3.js.map → chunk-WDGATQV3.js.map} +1 -1
  47. package/dist/{chunk-QOEO27LF.js → chunk-WJMYBRM5.js} +2 -2
  48. package/dist/chunk-X6SXZDTY.js +969 -0
  49. package/dist/chunk-X6SXZDTY.js.map +1 -0
  50. package/dist/{chunk-EANSYWBQ.js → chunk-ZUHUCSGT.js} +334 -326
  51. package/dist/chunk-ZUHUCSGT.js.map +1 -0
  52. package/dist/cli.js +1 -1
  53. package/dist/{client-EOQLSAUW.js → client-WN7YI7DE.js} +2 -2
  54. package/dist/{config-SZZQFIJF.js → config-QUXKGIZX.js} +2 -2
  55. package/dist/{config-mutate-66VDWR46.js → config-mutate-HJH24ITC.js} +2 -2
  56. package/dist/{config-mutator-OILDQCAJ.js → config-mutator-OLLQR3ZD.js} +2 -2
  57. package/dist/{connect-AJKMRKXC.js → connect-OOPPXAOD.js} +2 -2
  58. package/dist/{contributions-LRQCDZCQ.js → contributions-LL7B4BP3.js} +2 -2
  59. package/dist/daemon-api-QCBFGT7S.js +2 -0
  60. package/dist/daemon-api-QCBFGT7S.js.map +1 -0
  61. package/dist/{doctor-EDZO7BUJ.js → doctor-WJ5H7QQW.js} +2 -2
  62. package/dist/{enrich-NIUEEGPA.js → enrich-MZMIQ3SV.js} +2 -2
  63. package/dist/{event-levels-D6QSANGF.js → event-levels-PCFARGKL.js} +2 -2
  64. package/dist/{follow-up-tool-QOO2TIQS.js → follow-up-tool-I2HTKMP4.js} +2 -2
  65. package/dist/{grants-3UVDASRI.js → grants-5GIY7347.js} +2 -2
  66. package/dist/{hub-6TKU6CHO.js → hub-7ASBN76I.js} +2 -2
  67. package/dist/index.d.ts +12 -0
  68. package/dist/index.js +1 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/org-tool-JCGGJJU6.js +2 -0
  71. package/dist/org-tool-JCGGJJU6.js.map +1 -0
  72. package/dist/{program-OFN6YQRH.js → program-7VNYZPRO.js} +238 -238
  73. package/dist/program-7VNYZPRO.js.map +1 -0
  74. package/dist/{promote-D3KYLUBD.js → promote-NSPUPPHB.js} +2 -2
  75. package/dist/providers-D6IUAHQJ.js +2 -0
  76. package/dist/{query-D2TQ2PUO.js → query-VW63IHDI.js} +2 -2
  77. package/dist/{query-settings-ILDX3HDF.js → query-settings-RS7DJI4H.js} +2 -2
  78. package/dist/{registry-N3BY3HSI.js → registry-6KREAROB.js} +2 -2
  79. package/dist/{request-planner-CVCG5XQR.js → request-planner-HZWQIRZO.js} +2 -2
  80. package/dist/resolve-LOYZUE2D.js +2 -0
  81. package/dist/{review-candidates-CKUN4PSY.js → review-candidates-2TXOUASP.js} +2 -2
  82. package/dist/{routing-OCIRGUKK.js → routing-ZV4VSZDV.js} +2 -2
  83. package/dist/{rules-A5ES57QT.js → rules-FBOLGE2S.js} +2 -2
  84. package/dist/schedule-tool-D357NLXS.js +2 -0
  85. package/dist/{scheduler-D2Z7RSEE.js → scheduler-SAID6RKQ.js} +2 -2
  86. package/dist/{seat-Z3E2FLDA.js → seat-XHBWBSTS.js} +2 -2
  87. package/dist/{select-J4ES7Q67.js → select-QUCTTAH3.js} +2 -2
  88. package/dist/{set-enabled-S22TICYC.js → set-enabled-CGMXLFC6.js} +2 -2
  89. package/dist/{sprint-tool-NDF47EKV.js → sprint-tool-SWRYSX3Q.js} +2 -2
  90. package/dist/status-PVYFTNX2.js +2 -0
  91. package/dist/{tool-6NZIUXI7.js → tool-6G63ZQW4.js} +2 -2
  92. package/dist/{tool-RCCMOMEY.js → tool-DA25L4ND.js} +2 -2
  93. package/dist/{tool-52JRXZVA.js → tool-ELGOVIM5.js} +2 -2
  94. package/dist/{tool-Z2OVFGWW.js → tool-MMH2JNP7.js} +2 -2
  95. package/dist/{wiki-HQKFZZSX.js → wiki-4ZL4QXA7.js} +2 -2
  96. package/dist/wiki-enrich-N5MUKDVW.js +2 -0
  97. package/dist/workspace-setup-QXFJRNSK.js +2 -0
  98. package/package.json +1 -1
  99. package/dist/board-dashboard-AVUFPO5X.js.map +0 -1
  100. package/dist/chunk-B6VASQHD.js +0 -2
  101. package/dist/chunk-B6VASQHD.js.map +0 -1
  102. package/dist/chunk-EANSYWBQ.js.map +0 -1
  103. package/dist/chunk-FCDMB2JA.js +0 -936
  104. package/dist/chunk-FCDMB2JA.js.map +0 -1
  105. package/dist/chunk-GDHSJH3T.js +0 -111
  106. package/dist/chunk-GDHSJH3T.js.map +0 -1
  107. package/dist/chunk-RIBANO2H.js.map +0 -1
  108. package/dist/chunk-T7WY5BSJ.js.map +0 -1
  109. package/dist/daemon-api-OVCXY4QC.js +0 -2
  110. package/dist/daemon-api-OVCXY4QC.js.map +0 -1
  111. package/dist/program-OFN6YQRH.js.map +0 -1
  112. package/dist/providers-AHLCB6R5.js +0 -2
  113. package/dist/resolve-JKXYBZ6R.js +0 -2
  114. package/dist/schedule-tool-YFMRYTEO.js +0 -2
  115. package/dist/status-PKHYFGZK.js +0 -2
  116. package/dist/wiki-enrich-7SZ5W2LF.js +0 -2
  117. package/dist/workspace-setup-W5UO2WZI.js +0 -2
  118. /package/dist/{App-FQRHQT5J.js.map → App-JDW5V4HT.js.map} +0 -0
  119. /package/dist/{ChatApp-WBCGSGJM.js.map → ChatApp-SNM2PORO.js.map} +0 -0
  120. /package/dist/{absorb-eval-3IU37HZQ.js.map → absorb-eval-WDAV4AI2.js.map} +0 -0
  121. /package/dist/{adapter-URFSOOFE.js.map → adapter-C47BTKT6.js.map} +0 -0
  122. /package/dist/{agent-P7XUCP3A.js.map → agent-EVMKJXJO.js.map} +0 -0
  123. /package/dist/{chunk-WKR2OSCH.js.map → chunk-245IOYDJ.js.map} +0 -0
  124. /package/dist/{chunk-FOWRNDMJ.js.map → chunk-2LJZHKTY.js.map} +0 -0
  125. /package/dist/{chunk-P65XGEB7.js.map → chunk-2P3SHT5I.js.map} +0 -0
  126. /package/dist/{chunk-JUSQMQ7L.js.map → chunk-2VSK6FAR.js.map} +0 -0
  127. /package/dist/{chunk-Y4YOYOCG.js.map → chunk-AK46ORUI.js.map} +0 -0
  128. /package/dist/{chunk-JKT5EFXT.js.map → chunk-CXFVIDJV.js.map} +0 -0
  129. /package/dist/{chunk-ZPCSPEGO.js.map → chunk-CZVCT5ZV.js.map} +0 -0
  130. /package/dist/{chunk-Y2D6FQBL.js.map → chunk-DOO4MUTS.js.map} +0 -0
  131. /package/dist/{chunk-HX4R7RPR.js.map → chunk-DV42WUMD.js.map} +0 -0
  132. /package/dist/{chunk-CAYY2IEV.js.map → chunk-EFGAPAYZ.js.map} +0 -0
  133. /package/dist/{chunk-MAQFWGFT.js.map → chunk-ERVJLPS4.js.map} +0 -0
  134. /package/dist/{chunk-5VD2J4JN.js.map → chunk-GWBFEVLO.js.map} +0 -0
  135. /package/dist/{chunk-IAR5F3T5.js.map → chunk-IDGEDPRJ.js.map} +0 -0
  136. /package/dist/{chunk-SLX3OHEW.js.map → chunk-IU63JGY3.js.map} +0 -0
  137. /package/dist/{chunk-7QW4RECS.js.map → chunk-JSCVOB4G.js.map} +0 -0
  138. /package/dist/{chunk-RUNCUVAH.js.map → chunk-JT5PIBCM.js.map} +0 -0
  139. /package/dist/{chunk-EQPMQSJE.js.map → chunk-KRHVM26D.js.map} +0 -0
  140. /package/dist/{chunk-WIGH5WMP.js.map → chunk-KWZ6NMXZ.js.map} +0 -0
  141. /package/dist/{chunk-VGYW3Q7F.js.map → chunk-OLKYIKAZ.js.map} +0 -0
  142. /package/dist/{chunk-RB7M2NPU.js.map → chunk-PQUK6XEW.js.map} +0 -0
  143. /package/dist/{chunk-PSOE356C.js.map → chunk-PQX2VJUA.js.map} +0 -0
  144. /package/dist/{chunk-TV5BDCQA.js.map → chunk-PTZNM2JU.js.map} +0 -0
  145. /package/dist/{chunk-M4VYHPDS.js.map → chunk-PW3WG6JT.js.map} +0 -0
  146. /package/dist/{chunk-EMWSFITR.js.map → chunk-QASIUKZJ.js.map} +0 -0
  147. /package/dist/{chunk-N6NZBAWR.js.map → chunk-RXX4MYFL.js.map} +0 -0
  148. /package/dist/{chunk-C2VZHIIX.js.map → chunk-S5A7QZVQ.js.map} +0 -0
  149. /package/dist/{chunk-BIYEGA7Q.js.map → chunk-S6YN3IBM.js.map} +0 -0
  150. /package/dist/{chunk-CJI26AJC.js.map → chunk-SKCOIP5R.js.map} +0 -0
  151. /package/dist/{chunk-V3FSKTDF.js.map → chunk-UGRMFQAG.js.map} +0 -0
  152. /package/dist/{chunk-QOEO27LF.js.map → chunk-WJMYBRM5.js.map} +0 -0
  153. /package/dist/{client-EOQLSAUW.js.map → client-WN7YI7DE.js.map} +0 -0
  154. /package/dist/{config-SZZQFIJF.js.map → config-QUXKGIZX.js.map} +0 -0
  155. /package/dist/{config-mutate-66VDWR46.js.map → config-mutate-HJH24ITC.js.map} +0 -0
  156. /package/dist/{config-mutator-OILDQCAJ.js.map → config-mutator-OLLQR3ZD.js.map} +0 -0
  157. /package/dist/{connect-AJKMRKXC.js.map → connect-OOPPXAOD.js.map} +0 -0
  158. /package/dist/{contributions-LRQCDZCQ.js.map → contributions-LL7B4BP3.js.map} +0 -0
  159. /package/dist/{doctor-EDZO7BUJ.js.map → doctor-WJ5H7QQW.js.map} +0 -0
  160. /package/dist/{enrich-NIUEEGPA.js.map → enrich-MZMIQ3SV.js.map} +0 -0
  161. /package/dist/{event-levels-D6QSANGF.js.map → event-levels-PCFARGKL.js.map} +0 -0
  162. /package/dist/{follow-up-tool-QOO2TIQS.js.map → follow-up-tool-I2HTKMP4.js.map} +0 -0
  163. /package/dist/{grants-3UVDASRI.js.map → grants-5GIY7347.js.map} +0 -0
  164. /package/dist/{hub-6TKU6CHO.js.map → hub-7ASBN76I.js.map} +0 -0
  165. /package/dist/{promote-D3KYLUBD.js.map → promote-NSPUPPHB.js.map} +0 -0
  166. /package/dist/{providers-AHLCB6R5.js.map → providers-D6IUAHQJ.js.map} +0 -0
  167. /package/dist/{query-D2TQ2PUO.js.map → query-VW63IHDI.js.map} +0 -0
  168. /package/dist/{query-settings-ILDX3HDF.js.map → query-settings-RS7DJI4H.js.map} +0 -0
  169. /package/dist/{registry-N3BY3HSI.js.map → registry-6KREAROB.js.map} +0 -0
  170. /package/dist/{request-planner-CVCG5XQR.js.map → request-planner-HZWQIRZO.js.map} +0 -0
  171. /package/dist/{resolve-JKXYBZ6R.js.map → resolve-LOYZUE2D.js.map} +0 -0
  172. /package/dist/{review-candidates-CKUN4PSY.js.map → review-candidates-2TXOUASP.js.map} +0 -0
  173. /package/dist/{routing-OCIRGUKK.js.map → routing-ZV4VSZDV.js.map} +0 -0
  174. /package/dist/{rules-A5ES57QT.js.map → rules-FBOLGE2S.js.map} +0 -0
  175. /package/dist/{schedule-tool-YFMRYTEO.js.map → schedule-tool-D357NLXS.js.map} +0 -0
  176. /package/dist/{scheduler-D2Z7RSEE.js.map → scheduler-SAID6RKQ.js.map} +0 -0
  177. /package/dist/{seat-Z3E2FLDA.js.map → seat-XHBWBSTS.js.map} +0 -0
  178. /package/dist/{select-J4ES7Q67.js.map → select-QUCTTAH3.js.map} +0 -0
  179. /package/dist/{set-enabled-S22TICYC.js.map → set-enabled-CGMXLFC6.js.map} +0 -0
  180. /package/dist/{sprint-tool-NDF47EKV.js.map → sprint-tool-SWRYSX3Q.js.map} +0 -0
  181. /package/dist/{status-PKHYFGZK.js.map → status-PVYFTNX2.js.map} +0 -0
  182. /package/dist/{tool-6NZIUXI7.js.map → tool-6G63ZQW4.js.map} +0 -0
  183. /package/dist/{tool-RCCMOMEY.js.map → tool-DA25L4ND.js.map} +0 -0
  184. /package/dist/{tool-52JRXZVA.js.map → tool-ELGOVIM5.js.map} +0 -0
  185. /package/dist/{tool-Z2OVFGWW.js.map → tool-MMH2JNP7.js.map} +0 -0
  186. /package/dist/{wiki-HQKFZZSX.js.map → wiki-4ZL4QXA7.js.map} +0 -0
  187. /package/dist/{wiki-enrich-7SZ5W2LF.js.map → wiki-enrich-N5MUKDVW.js.map} +0 -0
  188. /package/dist/{workspace-setup-W5UO2WZI.js.map → workspace-setup-QXFJRNSK.js.map} +0 -0
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-OFN6YQRH.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();
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-7VNYZPRO.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-JUSQMQ7L.js";import"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-EOQLSAUW.js.map
1
+ import{a,b,c,d,e,f,g}from"./chunk-2VSK6FAR.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-WN7YI7DE.js.map
@@ -1,2 +1,2 @@
1
- import{Ab as o,Bb as p,Cb as q,Db as r,Eb as s,Fb as t,Gb as u,Hb as v,Ib as w,Jb as x,Kb as y,Lb as z,Mb as A,Nb as B,Ob as C,Pb as D,Rb as E,mb as a,nb as b,ob as c,pb as d,qb as e,rb as f,sb as g,tb as h,ub as i,vb as j,wb as k,xb as l,yb as m,zb as n}from"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";E();export{a as INTEGRATION_KINDS,z as WIKI_CONTRIBUTE_JOB,A as WIKI_CONTRIBUTE_MERGE_JOB,C as WIKI_SUMMARIZE_JOB,r as approvalsConfigSchema,g as callsSchema,e as cameraBotSchema,x as crossFieldProblems,t as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,u as expandEnvVars,f as isCronExpression,w as literalSecretProblems,v as loadDaemonConfig,d as mailSenderSchema,o as membersConfigSchema,j as mergePolicyConfigSchema,n as peopleConfigSchema,m as personSchema,q as qualityReportConfigSchema,p as requestStatusConfigSchema,l as requestsConfigSchema,h as reviewGateConfigSchema,i as trackersConfigSchema,y as validateWorkspaces,s as wallConfigSchema,k as watchersConfigSchema,B as withContributionJobs,D as withSummariesJob};
2
- //# sourceMappingURL=config-SZZQFIJF.js.map
1
+ import{Ab as o,Bb as p,Cb as q,Db as r,Eb as s,Fb as t,Gb as u,Hb as v,Ib as w,Jb as x,Kb as y,Lb as z,Mb as A,Nb as B,Ob as C,Pb as D,Rb as E,mb as a,nb as b,ob as c,pb as d,qb as e,rb as f,sb as g,tb as h,ub as i,vb as j,wb as k,xb as l,yb as m,zb as n}from"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";E();export{a as INTEGRATION_KINDS,z as WIKI_CONTRIBUTE_JOB,A as WIKI_CONTRIBUTE_MERGE_JOB,C as WIKI_SUMMARIZE_JOB,r as approvalsConfigSchema,g as callsSchema,e as cameraBotSchema,x as crossFieldProblems,t as daemonConfigSchema,c as emailAccountSchema,b as eventSubscriptionSchema,u as expandEnvVars,f as isCronExpression,w as literalSecretProblems,v as loadDaemonConfig,d as mailSenderSchema,o as membersConfigSchema,j as mergePolicyConfigSchema,n as peopleConfigSchema,m as personSchema,q as qualityReportConfigSchema,p as requestStatusConfigSchema,l as requestsConfigSchema,h as reviewGateConfigSchema,i as trackersConfigSchema,y as validateWorkspaces,s as wallConfigSchema,k as watchersConfigSchema,B as withContributionJobs,D as withSummariesJob};
2
+ //# sourceMappingURL=config-QUXKGIZX.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"./chunk-SLX3OHEW.js";import"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
- //# sourceMappingURL=config-mutate-66VDWR46.js.map
1
+ import{a,b}from"./chunk-IU63JGY3.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{a as mutateAgentxConfig,b as writeAgentxConfig};
2
+ //# sourceMappingURL=config-mutate-HJH24ITC.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e}from"./chunk-P65XGEB7.js";import"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-OILDQCAJ.js.map
1
+ import{a,b,c,d,e}from"./chunk-2P3SHT5I.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-OLLQR3ZD.js.map
@@ -1,2 +1,2 @@
1
- import{b as l}from"./chunk-Q3A5P373.js";import{a as g,b as h,d}from"./chunk-JLBRNYKY.js";import"./chunk-QIJLFPWE.js";function k(t){let e;try{e=new URL(t)}catch{return null}return e.hash?null:e.protocol==="https:"||e.protocol==="http:"&&e.hostname==="localhost"?e.toString():null}async function v(t){let{scopes:e,unknown:r}=g(t.spec.oauth,t.extras);if(r.length){let o=Object.keys(t.spec.oauth.optionalScopes??{});throw new Error(`unknown --with ${r.join(", ")}. ${o.length?`Available: ${o.join(", ")}`:`${t.spec.title} has no optional scopes`}`)}let i=h(t.spec,t.clientId,t.redirectUri,e),n=await t.getCallback(i.url,i.state);if("error"in n)throw new Error(n.error);return d(t.spec,i,n.code,{fetch:t.fetch??fetch,clientId:t.clientId,clientSecret:t.clientSecret,now:(t.now??Date.now)(),warn:t.warn})}function p(t,e,r){let i=n=>n.replace(/[^A-Za-z0-9]+/g,"_").replace(/^_+|_+$/g,"").toUpperCase();return`${i(e)}_${i(t)}_${r?"REFRESH_TOKEN":"ACCESS_TOKEN"}`}function m(t,e,r,i,n){let o={...e.credentials??{}},s={...e.metadata??{}};delete s.oauthExpiresAt;let c;if(i==="keyring")n.keyring.set(l(t,e.kind,e.label),JSON.stringify(r)),o.auth="keyring",c="the OS keyring";else if(delete o.auth,r.refreshToken){let a=o.refreshTokenEnv??p(t,e.kind,!0);n.writeEnv(a,r.refreshToken),o.refreshTokenEnv=a,c=`.env as ${a}`}else{let a=o.tokenEnv??p(t,e.kind,!1);n.writeEnv(a,r.accessToken),o.tokenEnv=a,r.expiresAt&&(s.oauthExpiresAt=r.expiresAt),c=`.env as ${a}`}return s.oauthScopes=r.scopes.join(" "),s.oauthConnectedAt=r.connectedAt,{integration:{...e,credentials:o,metadata:s},where:c}}function y(t,e,r){let i=e.credentials?.auth==="keyring"?r.delete(l(t,e.kind,e.label)):!1,n={...e.credentials??{}},o=[n.refreshTokenEnv,n.tokenEnv].filter(c=>!!c);delete n.auth,delete n.refreshTokenEnv,delete n.tokenEnv;let s={...e.metadata??{}};return delete s.oauthScopes,delete s.oauthConnectedAt,delete s.oauthExpiresAt,{integration:{...e,credentials:n,metadata:s},removedFromKeyring:i,envLeft:o}}export{k as checkRedirectUri,y as forgetGrant,v as signIn,m as storeGrant,p as tokenEnvName};
2
- //# sourceMappingURL=connect-AJKMRKXC.js.map
1
+ import{a as g,b as h,d}from"./chunk-JLBRNYKY.js";import{b as l}from"./chunk-Q3A5P373.js";import"./chunk-QIJLFPWE.js";function k(t){let e;try{e=new URL(t)}catch{return null}return e.hash?null:e.protocol==="https:"||e.protocol==="http:"&&e.hostname==="localhost"?e.toString():null}async function v(t){let{scopes:e,unknown:r}=g(t.spec.oauth,t.extras);if(r.length){let o=Object.keys(t.spec.oauth.optionalScopes??{});throw new Error(`unknown --with ${r.join(", ")}. ${o.length?`Available: ${o.join(", ")}`:`${t.spec.title} has no optional scopes`}`)}let i=h(t.spec,t.clientId,t.redirectUri,e),n=await t.getCallback(i.url,i.state);if("error"in n)throw new Error(n.error);return d(t.spec,i,n.code,{fetch:t.fetch??fetch,clientId:t.clientId,clientSecret:t.clientSecret,now:(t.now??Date.now)(),warn:t.warn})}function p(t,e,r){let i=n=>n.replace(/[^A-Za-z0-9]+/g,"_").replace(/^_+|_+$/g,"").toUpperCase();return`${i(e)}_${i(t)}_${r?"REFRESH_TOKEN":"ACCESS_TOKEN"}`}function m(t,e,r,i,n){let o={...e.credentials??{}},s={...e.metadata??{}};delete s.oauthExpiresAt;let c;if(i==="keyring")n.keyring.set(l(t,e.kind,e.label),JSON.stringify(r)),o.auth="keyring",c="the OS keyring";else if(delete o.auth,r.refreshToken){let a=o.refreshTokenEnv??p(t,e.kind,!0);n.writeEnv(a,r.refreshToken),o.refreshTokenEnv=a,c=`.env as ${a}`}else{let a=o.tokenEnv??p(t,e.kind,!1);n.writeEnv(a,r.accessToken),o.tokenEnv=a,r.expiresAt&&(s.oauthExpiresAt=r.expiresAt),c=`.env as ${a}`}return s.oauthScopes=r.scopes.join(" "),s.oauthConnectedAt=r.connectedAt,{integration:{...e,credentials:o,metadata:s},where:c}}function y(t,e,r){let i=e.credentials?.auth==="keyring"?r.delete(l(t,e.kind,e.label)):!1,n={...e.credentials??{}},o=[n.refreshTokenEnv,n.tokenEnv].filter(c=>!!c);delete n.auth,delete n.refreshTokenEnv,delete n.tokenEnv;let s={...e.metadata??{}};return delete s.oauthScopes,delete s.oauthConnectedAt,delete s.oauthExpiresAt,{integration:{...e,credentials:n,metadata:s},removedFromKeyring:i,envLeft:o}}export{k as checkRedirectUri,y as forgetGrant,v as signIn,m as storeGrant,p as tokenEnvName};
2
+ //# sourceMappingURL=connect-OOPPXAOD.js.map
@@ -1,4 +1,4 @@
1
- import{a as ee}from"./chunk-MAQFWGFT.js";import"./chunk-EMWSFITR.js";import{f as Q,k as V}from"./chunk-VJVXEVZ7.js";import{b as O}from"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-CJI26AJC.js";import"./chunk-JTFCU5LH.js";import"./chunk-QOEO27LF.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-WKR2OSCH.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-A7JSRDJL.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-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-ERVJLPS4.js";import"./chunk-QASIUKZJ.js";import{f as Q,k as V}from"./chunk-VJVXEVZ7.js";import{b as O}from"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-OWNQ2FD4.js";import{b as X}from"./chunk-KEXBEUSU.js";import"./chunk-SKCOIP5R.js";import"./chunk-JTFCU5LH.js";import"./chunk-WJMYBRM5.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-245IOYDJ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-A7JSRDJL.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-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-LRQCDZCQ.js.map
57
+ //# sourceMappingURL=contributions-LL7B4BP3.js.map
@@ -0,0 +1,2 @@
1
+ import{a as $,b as w}from"./chunk-2YDG5CSS.js";import{a as j,e as I,j as A}from"./chunk-JSCVOB4G.js";import{c as R}from"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-Q3A5P373.js";import"./chunk-QUFIUXMQ.js";import"./chunk-QIJLFPWE.js";var P=16e3,O=/^[A-Za-z0-9_.:@-]{1,200}$/;function v(p,t){let a=Object.keys(t.reads),g=p.metadata?.reads;if(typeof g!="string"||!g.trim())return a;let r=new Set(g.split(",").map(i=>i.trim()).filter(Boolean));return a.filter(i=>r.has(i))}function D(p,t,a,g){for(let n of Object.keys(a))if(!t.params[n])return{ok:!1,error:`unknown parameter "${n}". Allowed: ${Object.keys(t.params).join(", ")||"none"}`};let r={};for(let[n,o]of Object.entries(t.params)){let e=a[n];if((e==null||e==="")&&o.fromMetadata&&(e=g[n]),(e==null||e==="")&&o.default!==void 0&&(e=o.default),e==null||e===""){if(o.required)return{ok:!1,error:`parameter "${n}" is required: ${o.description}`};continue}let f=Array.isArray(e)?e.map(String).join(","):String(e);if(f.length>1e3)return{ok:!1,error:`parameter "${n}" is too long`};let k=o.list?f.split(",").map(c=>c.trim()).filter(Boolean):[f];for(let c of k){if(o.enum&&!o.enum.includes(c))return{ok:!1,error:`"${c}" is not allowed for "${n}". Allowed: ${o.enum.join(", ")}`};if(o.pattern&&!new RegExp(`^(?:${o.pattern.source})$`,o.pattern.flags).test(c))return{ok:!1,error:`"${c}" is not a valid value for "${n}"`}}r[n]=o.list?k.join(","):f}let i=new Set,d="",m=t.path.replace(/\{([A-Za-z0-9_]+)\}/g,(n,o)=>{let e=r[o];return e?!O.test(e)||/^\.+$/.test(e)?(d||=`"${o}" must be a plain id`,""):(i.add(o),encodeURIComponent(e)):(d||=`parameter "${o}" is required for the path`,"")});if(d)return{ok:!1,error:d};let s=t.baseUrl??p.baseUrl,u=new URL(s),l=new URL(s+m);if(l.origin!==u.origin)return{ok:!1,error:"the read left the provider's address"};if(m.split("/").some(n=>n==="."||n==="..")||!l.pathname.startsWith(u.pathname))return{ok:!1,error:"the read left the provider's address"};for(let[n,o]of Object.entries(r))i.has(n)||l.searchParams.set(n,o);for(let[n,o]of Object.entries(t.fixedQuery??{}))l.searchParams.set(n,o);return{ok:!0,url:l,values:r}}async function S(p,t,a={}){let g=a.providers??$,r=w(t.kind,g);if(!r)return{ok:!1,status:400,error:`no provider for kind "${t.kind}". Known: ${Object.keys(g).join(", ")||"none yet"}`};let i=j(p,t.agentId,t.kind,t.label);if(!i)return{ok:!1,status:404,error:`agent "${t.agentId}" has no enabled ${t.kind} integration${t.label?` labelled "${t.label}"`:""}`};let d=i.integration,m=Object.prototype.hasOwnProperty.call(r.reads,t.read)?r.reads[t.read]:void 0;if(!m)return{ok:!1,status:400,error:`unknown read "${t.read}". Allowed: ${v(d,r).join(", ")}`};if(!v(d,r).includes(t.read))return{ok:!1,status:403,error:`read "${t.read}" is not allowed for ${t.kind} "${d.label}" (metadata.reads)`};let s=D(r,m,t.params??{},d.metadata??{});if(!s.ok)return{ok:!1,status:400,error:s.error};let u=await A(t.agentId,d,r,a);if(u.status!=="ok")return{ok:!1,status:409,error:u.reason};let l=a.fetch??fetch,n=u.token;if(r.readToken)try{n=await r.readToken({read:t.read,values:s.values,token:u.token,fetch:l,now:(a.now??Date.now)()})}catch(c){let b=R(String(c?.message??c)).split(u.token).join("[redacted]");return{ok:!1,status:403,error:`${r.title}: ${b}`}}let o={Accept:"application/json"};(r.tokenIn??"header")==="header"?o.Authorization=`Bearer ${n}`:s.url.searchParams.set(r.tokenParam??"access_token",n);let e;try{e=await l(s.url.toString(),{method:"GET",headers:o,signal:AbortSignal.timeout(2e4),redirect:"error"})}catch(c){return{ok:!1,status:502,error:`couldn't reach ${r.title}: ${R(String(c?.message??c))}`}}let f=(await e.text().catch(()=>"")).split(u.token).join("[redacted]");if(n!==u.token&&(f=f.split(n).join("[redacted]")),!e.ok){let c=f;try{let h=JSON.parse(f);c=h?.error?.message||h?.error_description||h?.error||f}catch{}let b=e.status===401?` Connect again: ${I(t.agentId,d)}.`:e.status===403?" The account or app may lack a permission or scope this read needs.":"";return{ok:!1,status:e.status,error:`${r.title} said ${e.status}: ${R(String(c))}.${b}`}}let k=f.length>P;return{ok:!0,status:e.status,body:k?f.slice(0,P):f,truncated:k}}function x(p,t,a=$){let g=p.agents?.[t]?.integrations??[],r=[];for(let i of g){if(i.enabled===!1)continue;let d=w(i.kind,a);d&&r.push({kind:i.kind,label:i.label,title:d.title,reads:v(i,d).map(m=>{let s=d.reads[m];return{name:m,description:s.description,params:Object.fromEntries(Object.entries(s.params).map(([u,l])=>[u,{description:l.description,required:!!l.required&&!(l.fromMetadata&&i.metadata?.[u]!==void 0)&&l.default===void 0,...l.enum?{allowed:l.enum}:{}}]))}})})}return r}var y=p=>typeof p=="string"?p.trim():"";async function L(p,t,a,g,r,i={}){let d=p.toUpperCase(),m=s=>s?r.agents?.[s]?null:{status:400,body:{error:`unknown agent "${s}": it must be an agent on this node`}}:{status:400,body:{error:"agent is required: your agent id"}};if(t==="/integrations/reads"&&d==="GET"){let s=y(g.get("agent")),u=m(s);return u||{status:200,body:{integrations:x(r,s,i.providers)}}}if(t==="/integrations/read"&&d==="POST"){let s=y(a?.agent),u=m(s);if(u)return u;let l=y(a?.kind),n=y(a?.read);if(!l||!n)return{status:400,body:{error:"kind and read are required"}};let o=a?.params&&typeof a.params=="object"&&!Array.isArray(a.params)?a.params:{},e=await S(r,{agentId:s,kind:l,label:y(a?.label)||void 0,read:n,params:o},i);return e.ok?{status:200,body:{status:e.status,body:e.body,truncated:e.truncated}}:{status:e.status>=400&&e.status<600?e.status:502,body:{error:e.error}}}return t==="/integrations/read"||t==="/integrations/reads"?{status:405,body:{error:"method not allowed"}}:{status:404,body:{error:"not found"}}}export{L as handleIntegrationsApi};
2
+ //# sourceMappingURL=daemon-api-QCBFGT7S.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/integrations/read.ts","../src/integrations/daemon-api.ts"],"sourcesContent":["import type { DaemonConfig, Integration } from \"@/daemon/config\"\nimport { getIntegration } from \"./resolve\"\nimport { connectCommand, resolveAccessToken, type TokenDeps } from \"./resolve\"\nimport { safeProviderText } from \"./oauth\"\nimport { BUILTIN_PROVIDERS, providerFor, type ProviderRegistry } from \"./providers\"\nimport type { ProviderSpec, ReadSpec } from \"./providers/types\"\n\n// --- Named, read-only calls to an outside API (`agentx_integration_read`) ---\n//\n// An agent names an integration kind, a read from that provider's spec and\n// a few parameters. This module checks every parameter against the spec,\n// builds the URL itself and sends a GET with the integration's token. There\n// is no way to send another method, another path or a parameter the spec\n// does not list. An integration can narrow its reads further with\n// metadata.reads (\"read_a,read_b\").\n//\n// The answer is bounded (MAX_BODY characters) and never carries the token.\n\nexport const MAX_BODY = 16_000\n\nexport interface ReadDeps extends TokenDeps {\n providers?: ProviderRegistry\n}\n\nexport interface ReadRequest {\n agentId: string\n kind: string\n label?: string\n read: string\n params?: Record<string, unknown>\n}\n\nexport type ReadResult =\n | { ok: true; status: number; body: string; truncated: boolean }\n | { ok: false; status: number; error: string }\n\nconst ID_PARAM = /^[A-Za-z0-9_.:@-]{1,200}$/\n\n/** The reads an integration allows: the spec's, narrowed by metadata.reads. */\nexport function allowedReads(i: Integration, spec: ProviderSpec): string[] {\n const all = Object.keys(spec.reads)\n const only = i.metadata?.reads\n if (typeof only !== \"string\" || !only.trim()) return all\n const pick = new Set(only.split(\",\").map((s) => s.trim()).filter(Boolean))\n return all.filter((r) => pick.has(r))\n}\n\n/** Check the agent's params against a read spec. Returns the path and query\n * to send, or the first problem found. Exported for tests. */\nexport function buildReadUrl(\n spec: ProviderSpec,\n read: ReadSpec,\n params: Record<string, unknown>,\n metadata: Record<string, unknown>,\n): { ok: true; url: URL; values: Record<string, string> } | { ok: false; error: string } {\n for (const k of Object.keys(params)) {\n if (!read.params[k]) return { ok: false, error: `unknown parameter \"${k}\". Allowed: ${Object.keys(read.params).join(\", \") || \"none\"}` }\n }\n const values: Record<string, string> = {}\n for (const [name, p] of Object.entries(read.params)) {\n let raw = params[name]\n if ((raw === undefined || raw === null || raw === \"\") && p.fromMetadata) raw = metadata[name]\n if ((raw === undefined || raw === null || raw === \"\") && p.default !== undefined) raw = p.default\n if (raw === undefined || raw === null || raw === \"\") {\n if (p.required) return { ok: false, error: `parameter \"${name}\" is required: ${p.description}` }\n continue\n }\n const value = Array.isArray(raw) ? raw.map(String).join(\",\") : String(raw)\n if (value.length > 1000) return { ok: false, error: `parameter \"${name}\" is too long` }\n const items = p.list ? value.split(\",\").map((s) => s.trim()).filter(Boolean) : [value]\n for (const item of items) {\n if (p.enum && !p.enum.includes(item)) return { ok: false, error: `\"${item}\" is not allowed for \"${name}\". Allowed: ${p.enum.join(\", \")}` }\n if (p.pattern && !new RegExp(`^(?:${p.pattern.source})$`, p.pattern.flags).test(item)) return { ok: false, error: `\"${item}\" is not a valid value for \"${name}\"` }\n }\n values[name] = p.list ? items.join(\",\") : value\n }\n const used = new Set<string>()\n let pathError = \"\"\n const path = read.path.replace(/\\{([A-Za-z0-9_]+)\\}/g, (_m, name: string) => {\n const v = values[name]\n if (!v) { pathError ||= `parameter \"${name}\" is required for the path`; return \"\" }\n // \".\" and \"..\" are dot segments: the URL parser would climb out of the path.\n if (!ID_PARAM.test(v) || /^\\.+$/.test(v)) { pathError ||= `\"${name}\" must be a plain id`; return \"\" }\n used.add(name)\n return encodeURIComponent(v)\n })\n if (pathError) return { ok: false, error: pathError }\n const root = read.baseUrl ?? spec.baseUrl\n const base = new URL(root)\n const url = new URL(root + path)\n if (url.origin !== base.origin) return { ok: false, error: \"the read left the provider's address\" }\n // Belt and braces: no dot segment in the read's own path, and the parsed\n // path still sits under the base path, so nothing climbed out.\n if (path.split(\"/\").some((s) => s === \".\" || s === \"..\") || !url.pathname.startsWith(base.pathname)) {\n return { ok: false, error: \"the read left the provider's address\" }\n }\n for (const [k, v] of Object.entries(values)) if (!used.has(k)) url.searchParams.set(k, v)\n for (const [k, v] of Object.entries(read.fixedQuery ?? {})) url.searchParams.set(k, v)\n return { ok: true, url, values }\n}\n\n/** Run one named read for an agent. */\nexport async function runIntegrationRead(config: DaemonConfig, req: ReadRequest, deps: ReadDeps = {}): Promise<ReadResult> {\n const providers = deps.providers ?? BUILTIN_PROVIDERS\n const spec = providerFor(req.kind, providers)\n if (!spec) return { ok: false, status: 400, error: `no provider for kind \"${req.kind}\". Known: ${Object.keys(providers).join(\", \") || \"none yet\"}` }\n const found = getIntegration(config, req.agentId, req.kind, req.label)\n if (!found) return { ok: false, status: 404, error: `agent \"${req.agentId}\" has no enabled ${req.kind} integration${req.label ? ` labelled \"${req.label}\"` : \"\"}` }\n const i = found.integration\n const read = Object.prototype.hasOwnProperty.call(spec.reads, req.read) ? spec.reads[req.read] : undefined\n if (!read) return { ok: false, status: 400, error: `unknown read \"${req.read}\". Allowed: ${allowedReads(i, spec).join(\", \")}` }\n if (!allowedReads(i, spec).includes(req.read)) return { ok: false, status: 403, error: `read \"${req.read}\" is not allowed for ${req.kind} \"${i.label}\" (metadata.reads)` }\n\n const built = buildReadUrl(spec, read, req.params ?? {}, i.metadata ?? {})\n if (!built.ok) return { ok: false, status: 400, error: built.error }\n\n const token = await resolveAccessToken(req.agentId, i, spec, deps)\n if (token.status !== \"ok\") return { ok: false, status: 409, error: token.reason }\n\n const f = deps.fetch ?? fetch\n let sendToken = token.token\n if (spec.readToken) {\n try {\n sendToken = await spec.readToken({ read: req.read, values: built.values, token: token.token, fetch: f, now: (deps.now ?? Date.now)() })\n } catch (e: any) {\n const why = safeProviderText(String(e?.message ?? e)).split(token.token).join(\"[redacted]\")\n return { ok: false, status: 403, error: `${spec.title}: ${why}` }\n }\n }\n const headers: Record<string, string> = { Accept: \"application/json\" }\n if ((spec.tokenIn ?? \"header\") === \"header\") headers.Authorization = `Bearer ${sendToken}`\n else built.url.searchParams.set(spec.tokenParam ?? \"access_token\", sendToken)\n\n let res: Response\n try {\n res = await f(built.url.toString(), { method: \"GET\", headers, signal: AbortSignal.timeout(20_000), redirect: \"error\" })\n } catch (e: any) {\n return { ok: false, status: 502, error: `couldn't reach ${spec.title}: ${safeProviderText(String(e?.message ?? e))}` }\n }\n let text = (await res.text().catch(() => \"\")).split(token.token).join(\"[redacted]\")\n if (sendToken !== token.token) text = text.split(sendToken).join(\"[redacted]\")\n if (!res.ok) {\n let why = text\n try { const j = JSON.parse(text); why = j?.error?.message || j?.error_description || j?.error || text } catch {}\n const hint = res.status === 401\n ? ` Connect again: ${connectCommand(req.agentId, i)}.`\n : res.status === 403 ? \" The account or app may lack a permission or scope this read needs.\" : \"\"\n return { ok: false, status: res.status, error: `${spec.title} said ${res.status}: ${safeProviderText(String(why))}.${hint}` }\n }\n const truncated = text.length > MAX_BODY\n return { ok: true, status: res.status, body: truncated ? text.slice(0, MAX_BODY) : text, truncated }\n}\n\nexport interface ReadCatalogEntry {\n kind: string\n label: string\n title: string\n reads: Array<{ name: string; description: string; params: Record<string, { description: string; required: boolean; allowed?: readonly string[] }> }>\n}\n\n/** The reads an agent can run, for the tool's list action. */\nexport function readCatalog(config: DaemonConfig, agentId: string, providers: ProviderRegistry = BUILTIN_PROVIDERS): ReadCatalogEntry[] {\n const list = ((config.agents?.[agentId] as any)?.integrations ?? []) as Integration[]\n const out: ReadCatalogEntry[] = []\n for (const i of list) {\n if (i.enabled === false) continue\n const spec = providerFor(i.kind, providers)\n if (!spec) continue\n out.push({\n kind: i.kind,\n label: i.label,\n title: spec.title,\n reads: allowedReads(i, spec).map((name) => {\n const r = spec.reads[name]\n return {\n name,\n description: r.description,\n params: Object.fromEntries(Object.entries(r.params).map(([k, p]) => [k, {\n description: p.description,\n required: !!p.required && !(p.fromMetadata && i.metadata?.[k] !== undefined) && p.default === undefined,\n ...(p.enum ? { allowed: p.enum } : {}),\n }])),\n }\n }),\n })\n }\n return out\n}\n","import type { DaemonConfig } from \"@/daemon/config\"\nimport { readCatalog, runIntegrationRead, type ReadDeps } from \"./read\"\n\n// --- The daemon's /integrations endpoints, for agents (#1696) ---\n//\n// GET /integrations/reads?agent= the named reads the agent can run\n// POST /integrations/read {agent, kind, label?, read, params?}\n//\n// Only reads: nothing here writes to an outside service, and no endpoint\n// returns a token. Gated by isMeshGatedPath: loopback, or a mesh token.\n\nexport interface IntegrationsApiReply {\n status: number\n body: unknown\n}\n\nconst str = (v: unknown): string => (typeof v === \"string\" ? v.trim() : \"\")\n\nexport async function handleIntegrationsApi(\n method: string,\n path: string,\n body: Record<string, unknown> | undefined,\n query: URLSearchParams,\n config: DaemonConfig,\n deps: ReadDeps = {},\n): Promise<IntegrationsApiReply> {\n const m = method.toUpperCase()\n const agentOk = (id: string): IntegrationsApiReply | null => {\n if (!id) return { status: 400, body: { error: \"agent is required: your agent id\" } }\n if (!config.agents?.[id]) return { status: 400, body: { error: `unknown agent \"${id}\": it must be an agent on this node` } }\n return null\n }\n\n if (path === \"/integrations/reads\" && m === \"GET\") {\n const agent = str(query.get(\"agent\"))\n const bad = agentOk(agent)\n if (bad) return bad\n return { status: 200, body: { integrations: readCatalog(config, agent, deps.providers) } }\n }\n\n if (path === \"/integrations/read\" && m === \"POST\") {\n const agent = str(body?.agent)\n const bad = agentOk(agent)\n if (bad) return bad\n const kind = str(body?.kind)\n const read = str(body?.read)\n if (!kind || !read) return { status: 400, body: { error: \"kind and read are required\" } }\n const params = body?.params && typeof body.params === \"object\" && !Array.isArray(body.params)\n ? (body.params as Record<string, unknown>)\n : {}\n const r = await runIntegrationRead(config, { agentId: agent, kind, label: str(body?.label) || undefined, read, params }, deps)\n if (!r.ok) return { status: r.status >= 400 && r.status < 600 ? r.status : 502, body: { error: r.error } }\n return { status: 200, body: { status: r.status, body: r.body, truncated: r.truncated } }\n }\n\n if (path === \"/integrations/read\" || path === \"/integrations/reads\") return { status: 405, body: { error: \"method not allowed\" } }\n return { status: 404, body: { error: \"not found\" } }\n}\n"],"mappings":"6PAkBO,IAAMA,EAAW,KAkBlBC,EAAW,4BAGV,SAASC,EAA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,IAAMC,EAASZ,GAAM,QAAU,OAAOA,EAAK,QAAW,UAAY,CAAC,MAAM,QAAQA,EAAK,MAAM,EACvFA,EAAK,OACN,CAAC,EACCa,EAAI,MAAMC,EAAmBZ,EAAQ,CAAE,QAASK,EAAO,KAAAG,EAAM,MAAOf,EAAIK,GAAM,KAAK,GAAK,OAAW,KAAAW,EAAM,OAAAC,CAAO,EAAGT,CAAI,EAC7H,OAAKU,EAAE,GACA,CAAE,OAAQ,IAAK,KAAM,CAAE,OAAQA,EAAE,OAAQ,KAAMA,EAAE,KAAM,UAAWA,EAAE,SAAU,CAAE,EADrE,CAAE,OAAQA,EAAE,QAAU,KAAOA,EAAE,OAAS,IAAMA,EAAE,OAAS,IAAK,KAAM,CAAE,MAAOA,EAAE,KAAM,CAAE,EAI3G,OAAId,IAAS,sBAAwBA,IAAS,sBAA8B,CAAE,OAAQ,IAAK,KAAM,CAAE,MAAO,oBAAqB,CAAE,EAC1H,CAAE,OAAQ,IAAK,KAAM,CAAE,MAAO,WAAY,CAAE,CACrD","names":["MAX_BODY","ID_PARAM","allowedReads","i","spec","all","only","pick","s","r","buildReadUrl","read","params","metadata","k","values","name","p","raw","value","items","item","used","pathError","path","_m","v","root","base","url","runIntegrationRead","config","req","deps","providers","BUILTIN_PROVIDERS","providerFor","found","getIntegration","built","token","resolveAccessToken","f","sendToken","e","why","safeProviderText","headers","res","text","j","hint","connectCommand","truncated","readCatalog","agentId","list","out","str","v","handleIntegrationsApi","method","path","body","query","config","deps","m","agentOk","id","agent","bad","readCatalog","kind","read","params","r","runIntegrationRead"]}
@@ -1,2 +1,2 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-Y4YOYOCG.js";import"./chunk-FOWRNDMJ.js";import"./chunk-B6VASQHD.js";import"./chunk-5VD2J4JN.js";import"./chunk-IMLAPB7G.js";import"./chunk-7QW4RECS.js";import"./chunk-BYEL7KKR.js";import"./chunk-XPZSEDE3.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-MNG2AMKZ.js";import"./chunk-QPABR72X.js";import"./chunk-KP7KDLZ2.js";import"./chunk-QUFIUXMQ.js";import"./chunk-36X7D4JA.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
- //# sourceMappingURL=doctor-EDZO7BUJ.js.map
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j}from"./chunk-AK46ORUI.js";import"./chunk-2LJZHKTY.js";import"./chunk-2YDG5CSS.js";import"./chunk-GWBFEVLO.js";import"./chunk-IMLAPB7G.js";import"./chunk-JSCVOB4G.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-WDGATQV3.js";import"./chunk-Q3A5P373.js";import"./chunk-QPABR72X.js";import"./chunk-MNG2AMKZ.js";import"./chunk-KP7KDLZ2.js";import"./chunk-QUFIUXMQ.js";import"./chunk-36X7D4JA.js";import"./chunk-OSH2PEBH.js";import"./chunk-7I7IEX4S.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{j as daemonVoiceCheck,b as doctor,i as mcpHeaderEnvChecks,g as meshPeerTokenChecks,h as meshTokenChecksFromConfig,a as runDoctorChecks,e as runMirrorChecks,d as runNativeChecks,c as runNotificationChecks,f as runReminderChecks};
2
+ //# sourceMappingURL=doctor-WJ5H7QQW.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-C2VZHIIX.js";import"./chunk-CAYY2IEV.js";import"./chunk-DODL5POT.js";import"./chunk-QAWKN2N4.js";import"./chunk-IMLAPB7G.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-QIJLFPWE.js";export{a as ENRICH_BY,b as ENRICH_TYPES,h as buildEnrichPrompt,j as checkEnrichment,n as createEntityPage,e as enrichContext,g as fingerprint,c as lensProperties,o as loadEnrichState,f as mentionsOf,l as mergedMeta,i as parseEnrichReply,d as readableAlongside,q as runEnrich,p as saveEnrichState,m as targetPage,k as withOverview};
2
- //# sourceMappingURL=enrich-NIUEEGPA.js.map
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-S5A7QZVQ.js";import"./chunk-EFGAPAYZ.js";import"./chunk-QAWKN2N4.js";import"./chunk-DODL5POT.js";import"./chunk-IMLAPB7G.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-QIJLFPWE.js";export{a as ENRICH_BY,b as ENRICH_TYPES,h as buildEnrichPrompt,j as checkEnrichment,n as createEntityPage,e as enrichContext,g as fingerprint,c as lensProperties,o as loadEnrichState,f as mentionsOf,l as mergedMeta,i as parseEnrichReply,d as readableAlongside,q as runEnrich,p as saveEnrichState,m as targetPage,k as withOverview};
2
+ //# sourceMappingURL=enrich-MZMIQ3SV.js.map
@@ -1,3 +1,3 @@
1
- import{a as A,k as R}from"./chunk-CAYY2IEV.js";import"./chunk-DODL5POT.js";import{f as g}from"./chunk-QAWKN2N4.js";import"./chunk-IMLAPB7G.js";import{c as I}from"./chunk-OWNQ2FD4.js";import{a as E}from"./chunk-ROLSSYXE.js";import"./chunk-QIJLFPWE.js";var b="wiki-events",x="importance_set",S=new Set(["event","due_date","topic"]),L=10,j=320;function _(t,e,c){let o=new Set(c.map(r=>r.toLowerCase()));for(let r of t??[])if(!(!E.includes(r.level)||!r.title&&!r.tags?.length)){if(r.title){let i;try{i=new RegExp(r.title,"i")}catch{continue}if(!i.test(e))continue}if(r.unless){let i;try{i=new RegExp(r.unless,"i")}catch{continue}if(i.test(e))continue}if(!(r.tags?.length&&!r.tags.some(i=>o.has(i.toLowerCase()))))return r.level}}function O(t,e){let c=` ${g(e)} `,o=[];for(let r of t.entities.values()){if(S.has(r.type))continue;let i=g(r.title);i.length>=4&&c.includes(` ${i} `)&&o.push(r)}return o}function C(t,e){let c=A(t,e,null).filter(r=>!S.has(r.type)),o=O(t,e.title);return[...new Map([...o,...c].map(r=>[r.id,r])).values()].slice(0,L)}function W(t,e){return e.pages.find(c=>!t.syncedFrom(c.agentId))}function $(t){return(t.statements??[]).some(e=>e.by===b&&e.property===x)}function G(t){return t.pages.some(e=>e.article.meta.importance&&!$(e.article.meta))}function U(t,e,c){let o=new Set;for(let s of c.about){let l=e.names.get(g(s))??(e.entities.has(s)?s:void 0);l&&o.add(l)}let r=[],i=[],a=[...e.entities.values()].filter(s=>s.type==="event").sort((s,l)=>(l.date||"").localeCompare(s.date||""));for(let s of a){if(s.pages.some(n=>n.article.meta.importance)&&(!c.force||G(s)))continue;let f=C(e,s);if(c.about.length&&!f.some(n=>o.has(n.id)))continue;let d=W(t,s);if(!d){i.push(s);continue}r.push({event:s,page:d,candidates:f})}return{items:r,noPage:i}}var M=(t,e)=>t.length>e?`${t.slice(0,e)}\u2026`:t;function V(t,e){let c=["You are sorting the event pages of a company wiki by importance, and saying what each event is about.","","Levels:","- minor: routine upkeep or a small incident with no lasting effect (a disk filled and was cleaned, a job was restarted, a reminder was sent).","- normal: something a person would want in the history of the thing it is about (a delivery, a payment, an outage that was noticed, a meeting with an outcome).","- major: a turning point (a client won or lost, a contract signed, a legal or financial deadline missed, data lost, a decision that changes how things are done).","When unsure between two levels, pick the lower one.","","## Events"];return t.forEach((o,r)=>{let i=M(R(o.page.article.content).replace(/\s+/g," ").trim(),j);c.push(`### ${r+1}. ${o.event.title} (${o.event.date||"no date"})`,i||"(no text)"),c.push(o.candidates.length?`May be about: ${o.candidates.map(a=>`"${a.title}" (${a.type})`).join(", ")}`:"May be about: nothing listed","")}),c.push("## Task","Return one JSON object and nothing else:",'{"events": [{"n": 1, "importance": "minor", "about": ["Exact Title"], "why": "one short reason"}]}',"","Rules:",`- One item per event, with its number. importance is one of ${E.join(", ")}.`,`- about: only titles from that event's own "May be about" list, copied exactly, and only the ones the event really concerns: the machine that failed, the client it was for, the person it happened to. Often one, at most three. Leave it empty when none fits.`,"- why: under 15 words, in English.",...e.importance.major_set_by==="owner"?["- major is only a suggestion here: the owner confirms it."]:[]),c.join(`
1
+ import{a as A,k as R}from"./chunk-EFGAPAYZ.js";import{f as g}from"./chunk-QAWKN2N4.js";import"./chunk-DODL5POT.js";import"./chunk-IMLAPB7G.js";import{c as I}from"./chunk-OWNQ2FD4.js";import{a as E}from"./chunk-ROLSSYXE.js";import"./chunk-QIJLFPWE.js";var b="wiki-events",x="importance_set",S=new Set(["event","due_date","topic"]),L=10,j=320;function _(t,e,c){let o=new Set(c.map(r=>r.toLowerCase()));for(let r of t??[])if(!(!E.includes(r.level)||!r.title&&!r.tags?.length)){if(r.title){let i;try{i=new RegExp(r.title,"i")}catch{continue}if(!i.test(e))continue}if(r.unless){let i;try{i=new RegExp(r.unless,"i")}catch{continue}if(i.test(e))continue}if(!(r.tags?.length&&!r.tags.some(i=>o.has(i.toLowerCase()))))return r.level}}function O(t,e){let c=` ${g(e)} `,o=[];for(let r of t.entities.values()){if(S.has(r.type))continue;let i=g(r.title);i.length>=4&&c.includes(` ${i} `)&&o.push(r)}return o}function C(t,e){let c=A(t,e,null).filter(r=>!S.has(r.type)),o=O(t,e.title);return[...new Map([...o,...c].map(r=>[r.id,r])).values()].slice(0,L)}function W(t,e){return e.pages.find(c=>!t.syncedFrom(c.agentId))}function $(t){return(t.statements??[]).some(e=>e.by===b&&e.property===x)}function G(t){return t.pages.some(e=>e.article.meta.importance&&!$(e.article.meta))}function U(t,e,c){let o=new Set;for(let s of c.about){let l=e.names.get(g(s))??(e.entities.has(s)?s:void 0);l&&o.add(l)}let r=[],i=[],a=[...e.entities.values()].filter(s=>s.type==="event").sort((s,l)=>(l.date||"").localeCompare(s.date||""));for(let s of a){if(s.pages.some(n=>n.article.meta.importance)&&(!c.force||G(s)))continue;let f=C(e,s);if(c.about.length&&!f.some(n=>o.has(n.id)))continue;let d=W(t,s);if(!d){i.push(s);continue}r.push({event:s,page:d,candidates:f})}return{items:r,noPage:i}}var M=(t,e)=>t.length>e?`${t.slice(0,e)}\u2026`:t;function V(t,e){let c=["You are sorting the event pages of a company wiki by importance, and saying what each event is about.","","Levels:","- minor: routine upkeep or a small incident with no lasting effect (a disk filled and was cleaned, a job was restarted, a reminder was sent).","- normal: something a person would want in the history of the thing it is about (a delivery, a payment, an outage that was noticed, a meeting with an outcome).","- major: a turning point (a client won or lost, a contract signed, a legal or financial deadline missed, data lost, a decision that changes how things are done).","When unsure between two levels, pick the lower one.","","## Events"];return t.forEach((o,r)=>{let i=M(R(o.page.article.content).replace(/\s+/g," ").trim(),j);c.push(`### ${r+1}. ${o.event.title} (${o.event.date||"no date"})`,i||"(no text)"),c.push(o.candidates.length?`May be about: ${o.candidates.map(a=>`"${a.title}" (${a.type})`).join(", ")}`:"May be about: nothing listed","")}),c.push("## Task","Return one JSON object and nothing else:",'{"events": [{"n": 1, "importance": "minor", "about": ["Exact Title"], "why": "one short reason"}]}',"","Rules:",`- One item per event, with its number. importance is one of ${E.join(", ")}.`,`- about: only titles from that event's own "May be about" list, copied exactly, and only the ones the event really concerns: the machine that failed, the client it was for, the person it happened to. Often one, at most three. Leave it empty when none fits.`,"- why: under 15 words, in English.",...e.importance.major_set_by==="owner"?["- major is only a suggestion here: the owner confirms it."]:[]),c.join(`
2
2
  `)}function N(t){let e=t.match(/```(?:json)?\s*\n([\s\S]*?)\n```/),c=e?e[1]:t.slice(t.indexOf("{"),t.lastIndexOf("}")+1);try{let o=JSON.parse(c);return o&&typeof o=="object"&&!Array.isArray(o)?o:null}catch{return null}}function P(t,e){return t==="major"&&e.importance.major_set_by==="owner"?{importance:"normal",proposed:"major"}:{importance:t}}function T(t,e,c){let o=new Map,r=N(t);for(let i of Array.isArray(r?.events)?r.events:[]){let a=i??{},s=Number(a.n)-1,l=e[s];if(!Number.isInteger(s)||!l||o.has(s))continue;let f=String(a.importance??"").trim().toLowerCase();if(!E.includes(f))continue;let d=[],n=new Map(l.candidates.map(u=>[g(u.title),u.title])),p=[];for(let u of Array.isArray(a.about)?a.about:[]){let m=n.get(g(String(u??"")));m&&!p.includes(m)?p.push(m):!m&&String(u??"").trim()&&d.push(`about ${String(u).trim().slice(0,80)}: not in the list shown`)}p.length>3&&d.push(`about: kept the first 3 of ${p.length}`);let h=typeof a.why=="string"?M(a.why.trim(),160):void 0;o.set(s,{verdict:{...P(f,c),about:p.slice(0,3),why:h||void 0,by:"model"},dropped:d})}return o}function B(t,e,c){let o=(t.statements??[]).filter(a=>a.by!==b),r=new Set(o.filter(a=>a.property==="involves").map(a=>g(a.value))),i=e.about.filter(a=>!r.has(g(a))).map(a=>({property:"involves",value:a,checked_at:c,by:b}));return i.push({property:x,value:e.proposed??e.importance,checked_at:c,by:b,...e.why?{note:e.why}:{}}),{...t,importance:e.importance,importanceProposed:e.proposed,statements:[...o,...i]}}async function K(t,e,c,o){let r=e.ontology,{items:i,noPage:a}=U(t,e,o),s=i.slice(0,o.max),l={outcomes:[],costUsd:0,calls:0,capped:!1,left:i.length-s.length};for(let n of o.about.length?a:[])l.outcomes.push({event:n.id,title:n.title,date:n.date,status:"no-page",about:[],dropped:["its pages are copied from another node"]});let f=(n,p,h)=>{let u=`${n.page.agentId}/${n.page.article.path}`,m={event:n.event.id,title:n.event.title,date:n.event.date,page:u,status:"dry-run",importance:p.importance,proposed:p.proposed,about:p.about,by:p.by,why:p.why,dropped:h};if(o.dryRun){l.outcomes.push(m);return}let v=t.getAgentWiki(n.page.agentId),k=n.page.article.path,w;try{w=v.withArticleLock(k,()=>{let y=v.readArticle(k);return y?y.meta.importance&&!$(y.meta)?"a level was set on the page during the run":v.writeArticle(k,B(y.meta,p,o.today),y.content,y.meta.owner||n.page.agentId)?void 0:"write refused":"the page was moved or removed during the run"})}catch(y){if(!(y instanceof I))throw y;w="the page was busy; run again"}l.outcomes.push(w?{...m,status:"failed",dropped:[...h,w]}:{...m,status:"written"})},d=[];for(let n of s){let p=_(r.importance.rules,n.event.title,n.page.article.meta.tags??[]);if(!p){d.push(n);continue}let h=new Set(O(e,n.event.title).map(m=>m.id)),u=n.candidates.filter(m=>h.has(m.id)).slice(0,3).map(m=>m.title);f(n,{...P(p,r),about:u,why:"matched an importance rule",by:"rule"},[])}if(o.rulesOnly)return l.left+=d.length,l;for(let n=0;n<d.length;n+=o.batch){let p=d.slice(n,n+o.batch);if(l.costUsd>=o.maxCostUsd){l.capped=!0,l.left+=d.length-n;break}l.calls++;let h;try{let u=await c(V(p,r));l.costUsd+=u.costUsd,h=T(u.text,p,r)}catch(u){for(let m of p)l.outcomes.push({event:m.event.id,title:m.event.title,date:m.event.date,page:`${m.page.agentId}/${m.page.article.path}`,status:"failed",about:[],dropped:[u.message.slice(0,200)]});continue}p.forEach((u,m)=>{let v=h.get(m);v?f(u,v.verdict,v.dropped):l.outcomes.push({event:u.event.id,title:u.event.title,date:u.event.date,page:`${u.page.agentId}/${u.page.article.path}`,status:"no-answer",about:[],dropped:["the reply had no usable item for this event"]})})}if(!o.dryRun)for(let n of new Set(l.outcomes.filter(p=>p.status==="written").map(p=>p.page.split("/")[0])))t.getAgentWiki(n).rebuildIndex();return l}function z(t,e,c,o){let r=e.names.get(g(c))??(e.entities.has(c)?c:void 0),i=r?e.entities.get(r):void 0;if(!i)return{ok:!1,reason:`no page is titled "${c}"`};if(i.type!=="event")return{ok:!1,title:i.title,reason:`"${i.title}" is a ${i.type}, not an event`};let a=W(t,i);if(!a)return{ok:!1,title:i.title,reason:"its pages are copied from another node; set the level there"};let s=t.getAgentWiki(a.agentId),l,f="write refused";try{l=s.withArticleLock(a.article.path,()=>{let d=s.readArticle(a.article.path)??a.article,n=(d.meta.statements??[]).filter(h=>!(h.by===b&&h.property===x)),p={...d.meta,importance:o,importanceProposed:void 0,statements:n.length?n:void 0};return s.writeArticle(a.article.path,p,d.content,d.meta.owner||a.agentId)})}catch(d){if(!(d instanceof I))throw d;l=!1,f="the page was busy; run again"}return l&&s.rebuildIndex(),{ok:l,title:i.title,page:`${a.agentId}/${a.article.path}`,reason:l?void 0:f}}function X(t,e,c){let o=[],r=new Map(e.outcomes.filter(i=>i.importance).map(i=>[i.event,i]));for(let i of c){let a=t.names.get(g(i))??(t.entities.has(i)?i:void 0),s=a?t.entities.get(a):void 0;if(!s)continue;let l=new Set(A(t,s,new Set(["event"])).map(n=>n.id)),f={minor:0,normal:0,major:0},d=new Set;for(let n of t.entities.values()){if(n.type!=="event")continue;let p=r.get(n.id);!(l.has(n.id)||p?.about.some(u=>g(u)===g(s.title)))||d.has(n.id)||(d.add(n.id),f[p?.importance??n.importance]++)}o.push({title:s.title,type:s.type,before:l.size,after:f})}return o}export{b as EVENTS_BY,V as buildEventsPrompt,T as checkEventsReply,C as eventCandidates,B as eventMeta,U as pickEvents,_ as ruleLevel,K as runEvents,z as setEventLevel,X as summariseAbout};
3
- //# sourceMappingURL=event-levels-D6QSANGF.js.map
3
+ //# sourceMappingURL=event-levels-PCFARGKL.js.map
@@ -1,7 +1,7 @@
1
- import{b as h}from"./chunk-Y2D6FQBL.js";import"./chunk-RKPAVWXF.js";import"./chunk-EQPMQSJE.js";import{b as I}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-IAR5F3T5.js";import"./chunk-P65XGEB7.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-DOO4MUTS.js";import"./chunk-RKPAVWXF.js";import"./chunk-KRHVM26D.js";import{b as I}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-IDGEDPRJ.js";import"./chunk-2P3SHT5I.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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-QOO2TIQS.js.map
7
+ //# sourceMappingURL=follow-up-tool-I2HTKMP4.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-BIYEGA7Q.js";import"./chunk-XPZSEDE3.js";import"./chunk-MNG2AMKZ.js";import"./chunk-7I7IEX4S.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{c as DEFAULT_GRANT_DAYS,a as GUEST_SCOPE_PREFIX,b as JOIN_CARD_BY,h as JOIN_FAILED,d as MAX_GRANT_DAYS,j as NO_GRANT,l as PAUSED,k as WAITING_HOST,s as endGrant,o as grantBrief,u as grantForGuest,e as grantIdOf,n as guestAccess,p as guestTask,g as inviteGuest,i as joinGuest,f as newGrantId,q as pauseGrant,r as resumeGrant,m as settleGrant,t as updateGrant};
2
- //# sourceMappingURL=grants-3UVDASRI.js.map
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-S6YN3IBM.js";import"./chunk-WDGATQV3.js";import"./chunk-MNG2AMKZ.js";import"./chunk-7I7IEX4S.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";export{c as DEFAULT_GRANT_DAYS,a as GUEST_SCOPE_PREFIX,b as JOIN_CARD_BY,h as JOIN_FAILED,d as MAX_GRANT_DAYS,j as NO_GRANT,l as PAUSED,k as WAITING_HOST,s as endGrant,o as grantBrief,u as grantForGuest,e as grantIdOf,n as guestAccess,p as guestTask,g as inviteGuest,i as joinGuest,f as newGrantId,q as pauseGrant,r as resumeGrant,m as settleGrant,t as updateGrant};
2
+ //# sourceMappingURL=grants-5GIY7347.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-TV5BDCQA.js";import"./chunk-ZPCSPEGO.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-QOEO27LF.js";import"./chunk-WPNRDEHW.js";import"./chunk-WKR2OSCH.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-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
- //# sourceMappingURL=hub-6TKU6CHO.js.map
1
+ import{a}from"./chunk-PTZNM2JU.js";import"./chunk-CZVCT5ZV.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-WJMYBRM5.js";import"./chunk-WPNRDEHW.js";import"./chunk-245IOYDJ.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-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{a as WikiHub};
2
+ //# sourceMappingURL=hub-7ASBN76I.js.map
package/dist/index.d.ts CHANGED
@@ -4573,6 +4573,9 @@ declare const daemonConfigSchema: z.ZodObject<{
4573
4573
  * one run, carrying the latest state. The window restarts with each
4574
4574
  * event. 0 starts a run per event. */
4575
4575
  debounceSeconds: z.ZodDefault<z.ZodNumber>;
4576
+ /** Adding this label to an issue or pull request starts a run, whoever
4577
+ * adds it (#1719). A comment starts one only with an @-mention. */
4578
+ triggerLabel: z.ZodDefault<z.ZodString>;
4576
4579
  }, "strip", z.ZodTypeAny, {
4577
4580
  enabled: boolean;
4578
4581
  cloudSessions: boolean;
@@ -4592,6 +4595,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4592
4595
  pullRequestActions: string[];
4593
4596
  ignoreOwnChanges: boolean;
4594
4597
  debounceSeconds: number;
4598
+ triggerLabel: string;
4595
4599
  token?: string | undefined;
4596
4600
  webhookSecret?: string | undefined;
4597
4601
  tokenFile?: string | undefined;
@@ -4623,6 +4627,7 @@ declare const daemonConfigSchema: z.ZodObject<{
4623
4627
  pullRequestActions?: string[] | undefined;
4624
4628
  ignoreOwnChanges?: boolean | undefined;
4625
4629
  debounceSeconds?: number | undefined;
4630
+ triggerLabel?: string | undefined;
4626
4631
  }>>;
4627
4632
  /** ntfy push notifications — outbound only. The operator-facing tap on
4628
4633
  * the shoulder: cron failures, task errors, and anything an agent decides
@@ -5086,6 +5091,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5086
5091
  pullRequestActions: string[];
5087
5092
  ignoreOwnChanges: boolean;
5088
5093
  debounceSeconds: number;
5094
+ triggerLabel: string;
5089
5095
  token?: string | undefined;
5090
5096
  webhookSecret?: string | undefined;
5091
5097
  tokenFile?: string | undefined;
@@ -5270,6 +5276,7 @@ declare const daemonConfigSchema: z.ZodObject<{
5270
5276
  pullRequestActions?: string[] | undefined;
5271
5277
  ignoreOwnChanges?: boolean | undefined;
5272
5278
  debounceSeconds?: number | undefined;
5279
+ triggerLabel?: string | undefined;
5273
5280
  } | undefined;
5274
5281
  webrtc?: {
5275
5282
  enabled?: boolean | undefined;
@@ -11884,6 +11891,7 @@ declare const daemonConfigSchema: z.ZodObject<{
11884
11891
  pullRequestActions: string[];
11885
11892
  ignoreOwnChanges: boolean;
11886
11893
  debounceSeconds: number;
11894
+ triggerLabel: string;
11887
11895
  token?: string | undefined;
11888
11896
  webhookSecret?: string | undefined;
11889
11897
  tokenFile?: string | undefined;
@@ -13368,6 +13376,7 @@ declare const daemonConfigSchema: z.ZodObject<{
13368
13376
  pullRequestActions?: string[] | undefined;
13369
13377
  ignoreOwnChanges?: boolean | undefined;
13370
13378
  debounceSeconds?: number | undefined;
13379
+ triggerLabel?: string | undefined;
13371
13380
  } | undefined;
13372
13381
  webrtc?: {
13373
13382
  enabled?: boolean | undefined;
@@ -15186,6 +15195,9 @@ declare class AgentXDaemon {
15186
15195
  /** The channel and chat of the running turn of `agentId` that `proof`
15187
15196
  * names, as the registry files the run. Null when it names none. */
15188
15197
  private provenTurn;
15198
+ /** The agent of the running turn this request proves, and whether the
15199
+ * owner started that turn (org-proposals.ts isOwnerContext, #1678). */
15200
+ private orgCaller;
15189
15201
  /** The agent whose running turn `proof` names: the owner of its task,
15190
15202
  * or `claimed` when its channel and chat match a running turn of that
15191
15203
  * agent. Null when the call proves none. */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Ma as Tt,Na 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-EANSYWBQ.js";import"./chunk-FCDMB2JA.js";import"./chunk-GTJIKXDB.js";import"./chunk-N6NZBAWR.js";import"./chunk-ZVP6GB4G.js";import"./chunk-5VD2J4JN.js";import"./chunk-IMLAPB7G.js";import"./chunk-7QW4RECS.js";import"./chunk-BYEL7KKR.js";import"./chunk-MRIVENBY.js";import"./chunk-BIYEGA7Q.js";import"./chunk-XPZSEDE3.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-EKJG63EJ.js";import"./chunk-RB7M2NPU.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-JWDJMFU6.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-A5GYG56I.js";import"./chunk-M4VYHPDS.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-UKUH662W.js";import"./chunk-6TTGRTDO.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-JKT5EFXT.js";import"./chunk-QPABR72X.js";import"./chunk-EQPMQSJE.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVV7ZZ77.js";import{Ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-T7WY5BSJ.js";import"./chunk-RUNCUVAH.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.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-PSOE356C.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{u as ut}from"./chunk-IAR5F3T5.js";import"./chunk-P65XGEB7.js";import"./chunk-3UOTLMXD.js";import"./chunk-VWTBHLMX.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-HPRLRD4P.js";import"./chunk-TV5BDCQA.js";import{a as ht}from"./chunk-ZPCSPEGO.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-CJI26AJC.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-QOEO27LF.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-V3FSKTDF.js";import{j as it,k as rt,l as at}from"./chunk-WKR2OSCH.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-GDHSJH3T.js";import"./chunk-36X7D4JA.js";import"./chunk-2HBEZV7L.js";import"./chunk-A7JSRDJL.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{Fb as tt,Hb as st,Kb as ot,Rb as nt}from"./chunk-RIBANO2H.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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{Oa as Tt,Pa 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-ZUHUCSGT.js";import"./chunk-X6SXZDTY.js";import"./chunk-GTJIKXDB.js";import"./chunk-RXX4MYFL.js";import"./chunk-ZVP6GB4G.js";import"./chunk-GWBFEVLO.js";import"./chunk-IMLAPB7G.js";import"./chunk-EKJG63EJ.js";import"./chunk-PQUK6XEW.js";import"./chunk-JSCVOB4G.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-IU63JGY3.js";import"./chunk-MRIVENBY.js";import"./chunk-S6YN3IBM.js";import"./chunk-WDGATQV3.js";import"./chunk-PPUN7YHA.js";import"./chunk-VZLIBDLH.js";import"./chunk-UKUH662W.js";import"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-JWDJMFU6.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-LQE73AZR.js";import"./chunk-2D3RYIDU.js";import"./chunk-Q3A5P373.js";import"./chunk-CXFVIDJV.js";import"./chunk-QPABR72X.js";import"./chunk-A5GYG56I.js";import"./chunk-PW3WG6JT.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-6TTGRTDO.js";import"./chunk-MNG2AMKZ.js";import"./chunk-RX5O5637.js";import"./chunk-KRHVM26D.js";import"./chunk-5ELIX7BQ.js";import"./chunk-X7UQY7CH.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-XVV7ZZ77.js";import{Ca as yt,m as lt,n as ct,o as dt,p as mt,q as pt}from"./chunk-5STGF4MI.js";import"./chunk-JT5PIBCM.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.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-PQX2VJUA.js";import{a as B,b as M,c as F}from"./chunk-SFQUP3BP.js";import"./chunk-GV7S5BAX.js";import"./chunk-SZDACK6O.js";import"./chunk-VE3SSOQX.js";import"./chunk-W4YR2RO2.js";import"./chunk-AFRHKA7B.js";import"./chunk-VJVXEVZ7.js";import{u as ut}from"./chunk-IDGEDPRJ.js";import"./chunk-2P3SHT5I.js";import"./chunk-3UOTLMXD.js";import"./chunk-VWTBHLMX.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-GSX4NK2N.js";import"./chunk-HPRLRD4P.js";import"./chunk-PTZNM2JU.js";import{a as ht}from"./chunk-CZVCT5ZV.js";import"./chunk-OWNQ2FD4.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-SKCOIP5R.js";import"./chunk-JTFCU5LH.js";import{f as gt,g as ft}from"./chunk-WJMYBRM5.js";import"./chunk-WPNRDEHW.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-UGRMFQAG.js";import{j as it,k as rt,l as at}from"./chunk-245IOYDJ.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-MYVHVJWZ.js";import"./chunk-QUFIUXMQ.js";import"./chunk-IFNXMUEG.js";import"./chunk-36X7D4JA.js";import"./chunk-2HBEZV7L.js";import"./chunk-A7JSRDJL.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{Fb as tt,Hb as st,Kb as ot,Rb as nt}from"./chunk-DUCYRNCT.js";import"./chunk-VJ5HC63R.js";import"./chunk-UEEB3UTU.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.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).