agentix-cli 0.215.0 → 0.217.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 (175) hide show
  1. package/dist/{App-OUWMH6QG.js → App-IXJCCCGN.js} +2 -2
  2. package/dist/{ChatApp-EZ5A47FV.js → ChatApp-4YCCRL5M.js} +2 -2
  3. package/dist/{absorb-eval-WM6JQGYG.js → absorb-eval-YE57HA6N.js} +2 -2
  4. package/dist/{adapter-W26OC6ET.js → adapter-CRVWPQBN.js} +2 -2
  5. package/dist/{agent-KOKQSRAH.js → agent-CTZN3P2K.js} +2 -2
  6. package/dist/{board-dashboard-NVQUQSWI.js → board-dashboard-2WE2HBEW.js} +621 -394
  7. package/dist/board-dashboard-2WE2HBEW.js.map +1 -0
  8. package/dist/{chunk-OQNJIIR2.js → chunk-2F7KQ4DJ.js} +2 -2
  9. package/dist/{chunk-XHON5WB5.js → chunk-2MAKXLK2.js} +3 -3
  10. package/dist/{chunk-GGAEFVXL.js → chunk-3B7RH3IK.js} +2 -2
  11. package/dist/{chunk-ACPGDZOV.js → chunk-3C6UDZDX.js} +2 -2
  12. package/dist/{chunk-H4DWZIU7.js → chunk-56UTQ4FU.js} +2 -2
  13. package/dist/chunk-5FFNFW4C.js +20 -0
  14. package/dist/chunk-5FFNFW4C.js.map +1 -0
  15. package/dist/{chunk-MIUITI47.js → chunk-64IVC2G6.js} +2 -2
  16. package/dist/{chunk-IHFOW4JF.js → chunk-AOPNASCE.js} +2 -2
  17. package/dist/chunk-BXK5S2KK.js +13 -0
  18. package/dist/chunk-BXK5S2KK.js.map +1 -0
  19. package/dist/{chunk-QOGZD6Z3.js → chunk-ELC3M5WS.js} +318 -316
  20. package/dist/chunk-ELC3M5WS.js.map +1 -0
  21. package/dist/{chunk-PSYHAO57.js → chunk-FFLMSNTN.js} +2 -2
  22. package/dist/{chunk-JLH73NRM.js → chunk-GEKEILPL.js} +5 -5
  23. package/dist/{chunk-JLH73NRM.js.map → chunk-GEKEILPL.js.map} +1 -1
  24. package/dist/{chunk-J2R47R56.js → chunk-I4FXWN7I.js} +2 -2
  25. package/dist/{chunk-CSC45PA7.js → chunk-IP67DTXX.js} +2 -2
  26. package/dist/chunk-KBSQRQPF.js +10 -0
  27. package/dist/chunk-KBSQRQPF.js.map +1 -0
  28. package/dist/{chunk-4BYJN2A3.js → chunk-LLNLDZNA.js} +2 -2
  29. package/dist/{chunk-N476XZD3.js → chunk-LSFLSB7C.js} +2 -2
  30. package/dist/{chunk-4ZD2C76P.js → chunk-M42GMRZF.js} +2 -2
  31. package/dist/{chunk-JKMFKNGS.js → chunk-MFZNBE65.js} +2 -2
  32. package/dist/{chunk-4DCQIHWU.js → chunk-NFUHYIYG.js} +2 -2
  33. package/dist/chunk-O2YDS2P3.js +8 -0
  34. package/dist/chunk-O2YDS2P3.js.map +1 -0
  35. package/dist/{chunk-B7HDWFKR.js → chunk-OJ4RUZZY.js} +2 -2
  36. package/dist/chunk-PZ2F6J2E.js +134 -0
  37. package/dist/chunk-PZ2F6J2E.js.map +1 -0
  38. package/dist/{chunk-CAH6TNC6.js → chunk-Q432O462.js} +2 -2
  39. package/dist/{chunk-Z7632XS3.js → chunk-QEOGWSRR.js} +2 -2
  40. package/dist/{chunk-QR3P5RG7.js → chunk-QGRIW7SE.js} +2 -2
  41. package/dist/{chunk-JEBU5JUM.js → chunk-RKKAP4EY.js} +2 -2
  42. package/dist/{chunk-HY4PE6R3.js → chunk-SJJ7QEFE.js} +2 -2
  43. package/dist/{chunk-6UTOBSEA.js → chunk-SYIDD7CI.js} +2 -2
  44. package/dist/{chunk-7AFXLWWW.js → chunk-WHAMZPEG.js} +141 -87
  45. package/dist/chunk-WHAMZPEG.js.map +1 -0
  46. package/dist/{chunk-QMICGPM6.js → chunk-X2GBLX3E.js} +2 -2
  47. package/dist/{chunk-M4H2RYP4.js → chunk-XQH4LCZR.js} +2 -2
  48. package/dist/{chunk-Q7Y5VQGX.js → chunk-YXGZSVPY.js} +2 -2
  49. package/dist/{chunk-ZRBTLW2B.js → chunk-Z5HYCMDF.js} +2 -2
  50. package/dist/cli.js +1 -1
  51. package/dist/client-UPXDV3SM.js +2 -0
  52. package/dist/config-LAM4HUTA.js +2 -0
  53. package/dist/config-mutate-P4QLFUVH.js +2 -0
  54. package/dist/config-mutator-RIPSMYAO.js +2 -0
  55. package/dist/{contributions-FXUTKU6R.js → contributions-SHSEI3TX.js} +2 -2
  56. package/dist/{doctor-GP2KVKWE.js → doctor-TLDBNHYM.js} +2 -2
  57. package/dist/{follow-up-tool-C4PLLZIT.js → follow-up-tool-VM4ZDRC5.js} +2 -2
  58. package/dist/{follow-up-tool-C4PLLZIT.js.map → follow-up-tool-VM4ZDRC5.js.map} +1 -1
  59. package/dist/{grants-U2734ZHZ.js → grants-ZA35QVTX.js} +2 -2
  60. package/dist/hub-7Y6ZUVJV.js +2 -0
  61. package/dist/index.d.ts +375 -295
  62. package/dist/index.js +1 -1
  63. package/dist/org-tool-TOHI7MBS.js +2 -0
  64. package/dist/{org-tool-6PPIGWH2.js.map → org-tool-TOHI7MBS.js.map} +1 -1
  65. package/dist/{program-WSGVQTFM.js → program-QZKK3Y2W.js} +310 -310
  66. package/dist/program-QZKK3Y2W.js.map +1 -0
  67. package/dist/{promote-CXXMZWWH.js → promote-OBTQ3ZUN.js} +2 -2
  68. package/dist/push-bridge-T5HZZRA2.js +1 -1
  69. package/dist/{query-RPZIRN3X.js → query-K6NR3GQE.js} +2 -2
  70. package/dist/{query-settings-EBOBWOAL.js → query-settings-NIZBB73K.js} +2 -2
  71. package/dist/{registry-KRU6AWVW.js → registry-B7X6YGS7.js} +2 -2
  72. package/dist/{request-planner-LNNKTY7K.js → request-planner-YDIX4BQW.js} +2 -2
  73. package/dist/{review-candidates-HQBKXAJA.js → review-candidates-3QCCHXWM.js} +2 -2
  74. package/dist/routing-BGMIY5JY.js +2 -0
  75. package/dist/schedule-tool-P6XM6W3S.js +2 -0
  76. package/dist/scheduler-PUKN5YSL.js +2 -0
  77. package/dist/{seat-BSWBTNCP.js → seat-OTAJJ5BP.js} +2 -2
  78. package/dist/{select-T4F42G6W.js → select-KKMXIVVL.js} +2 -2
  79. package/dist/{set-enabled-UK4TPVC7.js → set-enabled-BNF427ZN.js} +2 -2
  80. package/dist/{sprint-tool-DN3BKLUY.js → sprint-tool-Y72HTX5X.js} +2 -2
  81. package/dist/{sprint-tool-DN3BKLUY.js.map → sprint-tool-Y72HTX5X.js.map} +1 -1
  82. package/dist/{tool-L3CQUOAZ.js → tool-DW6MYEG2.js} +2 -2
  83. package/dist/{tool-L3CQUOAZ.js.map → tool-DW6MYEG2.js.map} +1 -1
  84. package/dist/tool-EA4FWTH6.js +2 -0
  85. package/dist/{tool-ZVYUWVJQ.js → tool-F4ZVMX4J.js} +2 -2
  86. package/dist/{tool-ZVYUWVJQ.js.map → tool-F4ZVMX4J.js.map} +1 -1
  87. package/dist/{tool-ZCSGJ2ZF.js → tool-HUOT3I42.js} +2 -2
  88. package/dist/{tool-ZCSGJ2ZF.js.map → tool-HUOT3I42.js.map} +1 -1
  89. package/dist/tool-QDAD4ACK.js +4 -0
  90. package/dist/{tool-JJGEGQF3.js.map → tool-QDAD4ACK.js.map} +1 -1
  91. package/dist/wiki-J6MSHSVD.js +2 -0
  92. package/dist/wiki-enrich-3Y3TZ6ZK.js +2 -0
  93. package/dist/{workspace-setup-VGXHYCD5.js → workspace-setup-CQ5FMT2B.js} +2 -2
  94. package/dist/workspace-setup-CQ5FMT2B.js.map +1 -0
  95. package/package.json +1 -1
  96. package/dist/board-dashboard-NVQUQSWI.js.map +0 -1
  97. package/dist/chunk-35UGFFHA.js +0 -20
  98. package/dist/chunk-35UGFFHA.js.map +0 -1
  99. package/dist/chunk-7AFXLWWW.js.map +0 -1
  100. package/dist/chunk-KAM4ZWRE.js +0 -133
  101. package/dist/chunk-KAM4ZWRE.js.map +0 -1
  102. package/dist/chunk-OQQTV3OF.js +0 -12
  103. package/dist/chunk-OQQTV3OF.js.map +0 -1
  104. package/dist/chunk-QOGZD6Z3.js.map +0 -1
  105. package/dist/chunk-RKPAVWXF.js +0 -2
  106. package/dist/chunk-RKPAVWXF.js.map +0 -1
  107. package/dist/chunk-UUOCCLIL.js +0 -8
  108. package/dist/chunk-UUOCCLIL.js.map +0 -1
  109. package/dist/client-U3OFNJ5W.js +0 -2
  110. package/dist/config-S522VXLI.js +0 -2
  111. package/dist/config-mutate-KBZV2T4X.js +0 -2
  112. package/dist/config-mutator-YNNEGRV3.js +0 -2
  113. package/dist/hub-V2AGLA7T.js +0 -2
  114. package/dist/org-tool-6PPIGWH2.js +0 -2
  115. package/dist/program-WSGVQTFM.js.map +0 -1
  116. package/dist/routing-XXA7GIBA.js +0 -2
  117. package/dist/schedule-tool-65TFOUWK.js +0 -2
  118. package/dist/scheduler-DIPOBJBF.js +0 -2
  119. package/dist/tool-JJGEGQF3.js +0 -4
  120. package/dist/wiki-IDLRJ6WL.js +0 -2
  121. package/dist/wiki-enrich-XWLDJAZI.js +0 -2
  122. /package/dist/{App-OUWMH6QG.js.map → App-IXJCCCGN.js.map} +0 -0
  123. /package/dist/{ChatApp-EZ5A47FV.js.map → ChatApp-4YCCRL5M.js.map} +0 -0
  124. /package/dist/{absorb-eval-WM6JQGYG.js.map → absorb-eval-YE57HA6N.js.map} +0 -0
  125. /package/dist/{adapter-W26OC6ET.js.map → adapter-CRVWPQBN.js.map} +0 -0
  126. /package/dist/{agent-KOKQSRAH.js.map → agent-CTZN3P2K.js.map} +0 -0
  127. /package/dist/{chunk-OQNJIIR2.js.map → chunk-2F7KQ4DJ.js.map} +0 -0
  128. /package/dist/{chunk-XHON5WB5.js.map → chunk-2MAKXLK2.js.map} +0 -0
  129. /package/dist/{chunk-GGAEFVXL.js.map → chunk-3B7RH3IK.js.map} +0 -0
  130. /package/dist/{chunk-ACPGDZOV.js.map → chunk-3C6UDZDX.js.map} +0 -0
  131. /package/dist/{chunk-H4DWZIU7.js.map → chunk-56UTQ4FU.js.map} +0 -0
  132. /package/dist/{chunk-MIUITI47.js.map → chunk-64IVC2G6.js.map} +0 -0
  133. /package/dist/{chunk-IHFOW4JF.js.map → chunk-AOPNASCE.js.map} +0 -0
  134. /package/dist/{chunk-PSYHAO57.js.map → chunk-FFLMSNTN.js.map} +0 -0
  135. /package/dist/{chunk-J2R47R56.js.map → chunk-I4FXWN7I.js.map} +0 -0
  136. /package/dist/{chunk-CSC45PA7.js.map → chunk-IP67DTXX.js.map} +0 -0
  137. /package/dist/{chunk-4BYJN2A3.js.map → chunk-LLNLDZNA.js.map} +0 -0
  138. /package/dist/{chunk-N476XZD3.js.map → chunk-LSFLSB7C.js.map} +0 -0
  139. /package/dist/{chunk-4ZD2C76P.js.map → chunk-M42GMRZF.js.map} +0 -0
  140. /package/dist/{chunk-JKMFKNGS.js.map → chunk-MFZNBE65.js.map} +0 -0
  141. /package/dist/{chunk-4DCQIHWU.js.map → chunk-NFUHYIYG.js.map} +0 -0
  142. /package/dist/{chunk-B7HDWFKR.js.map → chunk-OJ4RUZZY.js.map} +0 -0
  143. /package/dist/{chunk-CAH6TNC6.js.map → chunk-Q432O462.js.map} +0 -0
  144. /package/dist/{chunk-Z7632XS3.js.map → chunk-QEOGWSRR.js.map} +0 -0
  145. /package/dist/{chunk-QR3P5RG7.js.map → chunk-QGRIW7SE.js.map} +0 -0
  146. /package/dist/{chunk-JEBU5JUM.js.map → chunk-RKKAP4EY.js.map} +0 -0
  147. /package/dist/{chunk-HY4PE6R3.js.map → chunk-SJJ7QEFE.js.map} +0 -0
  148. /package/dist/{chunk-6UTOBSEA.js.map → chunk-SYIDD7CI.js.map} +0 -0
  149. /package/dist/{chunk-QMICGPM6.js.map → chunk-X2GBLX3E.js.map} +0 -0
  150. /package/dist/{chunk-M4H2RYP4.js.map → chunk-XQH4LCZR.js.map} +0 -0
  151. /package/dist/{chunk-Q7Y5VQGX.js.map → chunk-YXGZSVPY.js.map} +0 -0
  152. /package/dist/{chunk-ZRBTLW2B.js.map → chunk-Z5HYCMDF.js.map} +0 -0
  153. /package/dist/{client-U3OFNJ5W.js.map → client-UPXDV3SM.js.map} +0 -0
  154. /package/dist/{config-S522VXLI.js.map → config-LAM4HUTA.js.map} +0 -0
  155. /package/dist/{config-mutate-KBZV2T4X.js.map → config-mutate-P4QLFUVH.js.map} +0 -0
  156. /package/dist/{config-mutator-YNNEGRV3.js.map → config-mutator-RIPSMYAO.js.map} +0 -0
  157. /package/dist/{contributions-FXUTKU6R.js.map → contributions-SHSEI3TX.js.map} +0 -0
  158. /package/dist/{doctor-GP2KVKWE.js.map → doctor-TLDBNHYM.js.map} +0 -0
  159. /package/dist/{grants-U2734ZHZ.js.map → grants-ZA35QVTX.js.map} +0 -0
  160. /package/dist/{hub-V2AGLA7T.js.map → hub-7Y6ZUVJV.js.map} +0 -0
  161. /package/dist/{promote-CXXMZWWH.js.map → promote-OBTQ3ZUN.js.map} +0 -0
  162. /package/dist/{query-RPZIRN3X.js.map → query-K6NR3GQE.js.map} +0 -0
  163. /package/dist/{query-settings-EBOBWOAL.js.map → query-settings-NIZBB73K.js.map} +0 -0
  164. /package/dist/{registry-KRU6AWVW.js.map → registry-B7X6YGS7.js.map} +0 -0
  165. /package/dist/{request-planner-LNNKTY7K.js.map → request-planner-YDIX4BQW.js.map} +0 -0
  166. /package/dist/{review-candidates-HQBKXAJA.js.map → review-candidates-3QCCHXWM.js.map} +0 -0
  167. /package/dist/{routing-XXA7GIBA.js.map → routing-BGMIY5JY.js.map} +0 -0
  168. /package/dist/{schedule-tool-65TFOUWK.js.map → schedule-tool-P6XM6W3S.js.map} +0 -0
  169. /package/dist/{scheduler-DIPOBJBF.js.map → scheduler-PUKN5YSL.js.map} +0 -0
  170. /package/dist/{seat-BSWBTNCP.js.map → seat-OTAJJ5BP.js.map} +0 -0
  171. /package/dist/{select-T4F42G6W.js.map → select-KKMXIVVL.js.map} +0 -0
  172. /package/dist/{set-enabled-UK4TPVC7.js.map → set-enabled-BNF427ZN.js.map} +0 -0
  173. /package/dist/{wiki-IDLRJ6WL.js.map → tool-EA4FWTH6.js.map} +0 -0
  174. /package/dist/{wiki-enrich-XWLDJAZI.js.map → wiki-J6MSHSVD.js.map} +0 -0
  175. /package/dist/{workspace-setup-VGXHYCD5.js.map → wiki-enrich-3Y3TZ6ZK.js.map} +0 -0
@@ -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,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-JEBU5JUM.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-ZRBTLW2B.js";import"./chunk-Z7632XS3.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
- //# sourceMappingURL=promote-CXXMZWWH.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,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t}from"./chunk-RKKAP4EY.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-Z5HYCMDF.js";import"./chunk-QEOGWSRR.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as DEFAULT_PROMOTE_TYPES,a as PROMOTER_OWNER,c as PROMOTION_LEDGER_FILE,j as appendPromotionLedger,s as approveProposal,n as callPromotionLlm,p as estimateTokens,r as evidenceFor,m as getUnpromotedMemories,k as groupCandidates,h as listAllAgentMemories,d as memoryKey,e as memoryStamp,g as mergeSources,f as parseMemoryStamp,l as parsePromotionResponse,i as readPromotionLedger,t as rejectProposal,o as runPromotion,q as sourceKind};
2
+ //# sourceMappingURL=promote-OBTQ3ZUN.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-JWDJMFU6.js";import"./chunk-7AB3QUGH.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{i as PushRosterSync,a as ROSTER_CHECK_MS,b as ROSTER_RESEND_MS,h as handlePushBridge,g as peerOrigins,d as pushBridgeCaller,c as pushOrigin,f as relayTokenProblem,e as scopedPushTarget};
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-3Q6MRG3P.js";import"./chunk-2VDO2HEK.js";import"./chunk-JWDJMFU6.js";import"./chunk-2P5NP4H6.js";import"./chunk-B4KQC3DG.js";import"./chunk-7AB3QUGH.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{i as PushRosterSync,a as ROSTER_CHECK_MS,b as ROSTER_RESEND_MS,h as handlePushBridge,g as peerOrigins,d as pushBridgeCaller,c as pushOrigin,f as relayTokenProblem,e as scopedPushTarget};
2
2
  //# sourceMappingURL=push-bridge-T5HZZRA2.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-XHON5WB5.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BERWTVG2.js";import"./chunk-Z7632XS3.js";import"./chunk-WPNRDEHW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{c as AUTO_SUMMARY_COVERAGE,a as CATALOG_SELECTOR_MODEL,b as CATALOG_SYNTH_MODEL,h as DEFAULT_GRAPH_WEIGHT,g as SHARED_CATALOG_LINES,d as agenticQuery,f as catalogPool,i as rankCatalogPool,e as retrieveArticles,j as sharedQueryEnabled};
2
- //# sourceMappingURL=query-RPZIRN3X.js.map
1
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-2MAKXLK2.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BERWTVG2.js";import"./chunk-QEOGWSRR.js";import"./chunk-WPNRDEHW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{c as AUTO_SUMMARY_COVERAGE,a as CATALOG_SELECTOR_MODEL,b as CATALOG_SYNTH_MODEL,h as DEFAULT_GRAPH_WEIGHT,g as SHARED_CATALOG_LINES,d as agenticQuery,f as catalogPool,i as rankCatalogPool,e as retrieveArticles,j as sharedQueryEnabled};
2
+ //# sourceMappingURL=query-K6NR3GQE.js.map
@@ -1,3 +1,3 @@
1
1
  import{b as u}from"./chunk-MEFPXHQJ.js";import{c as a}from"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BERWTVG2.js";import"./chunk-QUFIUXMQ.js";import"./chunk-QIJLFPWE.js";import{readFileSync as f}from"fs";import{resolve as d}from"path";var g={shared:!0,method:"auto",summaries:a,notes:{enabled:!1,types:["project","reference"],dirs:{}}};function y(n,t,e=process.cwd()){if(!n.notes.enabled||!t)return;let r=n.notes.dirs[t];return{owner:t,dir:r?d(e,r):new u({baseDir:d(e,".agentx")}).dirOf(t),types:n.notes.types}}function E(n,t,e=process.env,r=process.cwd()){let i=e.AGENTX_AGENT_ID;if(!(!i||i!==t))return y(n,t,r)}function p(n){if(n)try{return f(n,"utf-8").trim().split(`
2
- `)[0].trim()||void 0}catch{return}}function c(n,t){try{let e=new URL(n);return e.protocol==="https:"&&e.origin===new URL(t).origin}catch{return!1}}var l=n=>n.map(t=>typeof t=="string"?{repo:t}:{repo:t.repo,about:t.about});function h(n,t=process.env){let e=[];for(let r of n.wiki.query.live.sources){if(r.type==="agentx"){let o=n.node.bind.replace(/^0\.0\.0\.0:/,"127.0.0.1:");e.push({type:"agentx",url:r.url??`http://${o}`,peers:r.peers});continue}let i=(r.tokenEnv?t[r.tokenEnv]:void 0)||p(r.tokenFile);if(r.type==="github"){let o=n.channels.github,s=c(r.apiUrl,"https://api.github.com")?o?.token||p(o?.tokenFile):void 0;e.push({type:"github",apiUrl:r.apiUrl,token:i||s||void 0,repos:l(r.repos)})}else{let o=n.channels.gitlab,s=r.url??o?.host;if(!s)continue;let m=o?.host&&(!r.url||c(s,o.host))?o.token:void 0;e.push({type:"gitlab",url:s,token:i||m||void 0,repos:l(r.repos)})}}return e}function v(n,t=process.env){let e=n.wiki.query;return{shared:e.shared,method:e.method,summaries:{candidates:e.candidates,sharedCandidates:e.sharedCandidates,noteCandidates:e.notes.candidates,maxPages:e.maxPages,pageChars:e.pageChars,linkedPages:e.linkedPages,linkedChars:e.linkedChars,navigatorModel:e.navigatorModel,answerModel:e.answerModel,live:{enabled:e.live.enabled,maxReads:e.live.maxReads,timeoutMs:e.live.timeoutMs,plannerModel:e.live.plannerModel,sources:h(n,t)}},notes:{enabled:e.notes.enabled,types:e.notes.types,dirs:Object.fromEntries(Object.entries(n.agents).flatMap(([r,i])=>i.wiki?.notes?.dir?[[r,i.wiki.notes.dir]]:[]))}}}async function M(n){try{let{loadDaemonConfig:t}=await import("./config-S522VXLI.js");return v(t(n))}catch{return g}}export{g as DEFAULT_QUERY_SETTINGS,M as loadQuerySettings,c as mayLendToken,y as noteSourceFor,h as resolveLiveSources,v as resolveQuerySettings,E as toolNoteSourceFor};
3
- //# sourceMappingURL=query-settings-EBOBWOAL.js.map
2
+ `)[0].trim()||void 0}catch{return}}function c(n,t){try{let e=new URL(n);return e.protocol==="https:"&&e.origin===new URL(t).origin}catch{return!1}}var l=n=>n.map(t=>typeof t=="string"?{repo:t}:{repo:t.repo,about:t.about});function h(n,t=process.env){let e=[];for(let r of n.wiki.query.live.sources){if(r.type==="agentx"){let o=n.node.bind.replace(/^0\.0\.0\.0:/,"127.0.0.1:");e.push({type:"agentx",url:r.url??`http://${o}`,peers:r.peers});continue}let i=(r.tokenEnv?t[r.tokenEnv]:void 0)||p(r.tokenFile);if(r.type==="github"){let o=n.channels.github,s=c(r.apiUrl,"https://api.github.com")?o?.token||p(o?.tokenFile):void 0;e.push({type:"github",apiUrl:r.apiUrl,token:i||s||void 0,repos:l(r.repos)})}else{let o=n.channels.gitlab,s=r.url??o?.host;if(!s)continue;let m=o?.host&&(!r.url||c(s,o.host))?o.token:void 0;e.push({type:"gitlab",url:s,token:i||m||void 0,repos:l(r.repos)})}}return e}function v(n,t=process.env){let e=n.wiki.query;return{shared:e.shared,method:e.method,summaries:{candidates:e.candidates,sharedCandidates:e.sharedCandidates,noteCandidates:e.notes.candidates,maxPages:e.maxPages,pageChars:e.pageChars,linkedPages:e.linkedPages,linkedChars:e.linkedChars,navigatorModel:e.navigatorModel,answerModel:e.answerModel,live:{enabled:e.live.enabled,maxReads:e.live.maxReads,timeoutMs:e.live.timeoutMs,plannerModel:e.live.plannerModel,sources:h(n,t)}},notes:{enabled:e.notes.enabled,types:e.notes.types,dirs:Object.fromEntries(Object.entries(n.agents).flatMap(([r,i])=>i.wiki?.notes?.dir?[[r,i.wiki.notes.dir]]:[]))}}}async function M(n){try{let{loadDaemonConfig:t}=await import("./config-LAM4HUTA.js");return v(t(n))}catch{return g}}export{g as DEFAULT_QUERY_SETTINGS,M as loadQuerySettings,c as mayLendToken,y as noteSourceFor,h as resolveLiveSources,v as resolveQuerySettings,E as toolNoteSourceFor};
3
+ //# sourceMappingURL=query-settings-NIZBB73K.js.map
@@ -1,2 +1,2 @@
1
- import{Aa as e,Ba as f,Ca as g,Da as h,Ea as i,Fa as j,Ga as k,Ha as l,Ia as m,Ja as n,Ka as o,La as p,wa as a,xa as b,ya as c,za as d}from"./chunk-JLH73NRM.js";import"./chunk-GGAEFVXL.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.js";import"./chunk-W4YR2RO2.js";import"./chunk-7YOLZGB5.js";import"./chunk-IH65GDJR.js";import"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-KWWBDLE6.js";import"./chunk-HVMUYEQP.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-VWTBHLMX.js";import"./chunk-XHON5WB5.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-MYVHVJWZ.js";import"./chunk-M4H2RYP4.js";import"./chunk-OQQTV3OF.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-DPG6VHPX.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-Z5CMA4JN.js";import"./chunk-4BYJN2A3.js";import"./chunk-ZRBTLW2B.js";import"./chunk-Z7632XS3.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-JKMFKNGS.js";import"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{o as AgentRegistry,f as DEFAULT_SLOT_WAIT_MS,a as EDIT_TOOL_INSTRUCTION,j as TRACE_STEP_SUMMARY_BYTES,g as buildEntryMeta,h as buildEventDigest,i as buildWikiContext,k as clipForTrace,b as codingInstructions,n as emitTraceStepsFromStreamEvent,m as firstMissingRequiredTool,d as getGlobalRegistry,e as lastActivityLine,p as richReplyPrompt,c as setGlobalRegistry,l as tallyToolUses};
2
- //# sourceMappingURL=registry-KRU6AWVW.js.map
1
+ import{Aa as e,Ba as f,Ca as g,Da as h,Ea as i,Fa as j,Ga as k,Ha as l,Ia as m,Ja as n,Ka as o,La as p,wa as a,xa as b,ya as c,za as d}from"./chunk-GEKEILPL.js";import"./chunk-3B7RH3IK.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.js";import"./chunk-W4YR2RO2.js";import"./chunk-7YOLZGB5.js";import"./chunk-IH65GDJR.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-J3SOEFRE.js";import"./chunk-SIU6STB2.js";import"./chunk-X5C5W3E4.js";import"./chunk-KWWBDLE6.js";import"./chunk-HVMUYEQP.js";import"./chunk-GV7S5BAX.js";import"./chunk-GSX4NK2N.js";import"./chunk-SZDACK6O.js";import"./chunk-VWTBHLMX.js";import"./chunk-2MAKXLK2.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BE64IJWM.js";import"./chunk-5ONH4ITT.js";import"./chunk-JRAG37V5.js";import"./chunk-ILEC3IAV.js";import"./chunk-MYVHVJWZ.js";import"./chunk-XQH4LCZR.js";import"./chunk-BXK5S2KK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-DPG6VHPX.js";import"./chunk-BERWTVG2.js";import"./chunk-A7JSRDJL.js";import"./chunk-Z5CMA4JN.js";import"./chunk-LLNLDZNA.js";import"./chunk-Z5HYCMDF.js";import"./chunk-QEOGWSRR.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-MFZNBE65.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-7IW25T4K.js";import"./chunk-Q3A5P373.js";import"./chunk-JLBRNYKY.js";import"./chunk-BYEL7KKR.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-DSYKYZMT.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{o as AgentRegistry,f as DEFAULT_SLOT_WAIT_MS,a as EDIT_TOOL_INSTRUCTION,j as TRACE_STEP_SUMMARY_BYTES,g as buildEntryMeta,h as buildEventDigest,i as buildWikiContext,k as clipForTrace,b as codingInstructions,n as emitTraceStepsFromStreamEvent,m as firstMissingRequiredTool,d as getGlobalRegistry,e as lastActivityLine,p as richReplyPrompt,c as setGlobalRegistry,l as tallyToolUses};
2
+ //# sourceMappingURL=registry-B7X6YGS7.js.map
@@ -1,6 +1,6 @@
1
- import{p as f,s as h,v as g,y as m,z as E}from"./chunk-MIUITI47.js";import{a as p,f as w}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";E();w();var l="request-gate",x="request-context",q=.1,C=3e3;function b(t,s){return s??f(t)??C}async function k(t,s,n,r=Math.random){let d=g(l)==="active";if(d){let e=h().seats[l]?.holdout??q;if(r()<e)return{active:!0,preprocess:!1,arm:"holdout"}}let i=d?"treatment":void 0,a=await m(l,{request:t.slice(0,2e3),agent:s,channel:n,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:p("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:b(l)});if(!a||a.mode!=="active")return{active:!1,preprocess:!1,arm:i};let c=a.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(c)&&c>=.5,arm:i}}var T={patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"},v=[{id:"landscape",header:/^\[Landscape\]$/,description:"Directory of the other agents on this node and on mesh peers, and the channels they are on"},{id:"landscape.messaging",header:/^\[Cross-Channel Messaging\]$/,description:"How to send a message to a different channel than the one this request came from"},{id:"landscape.recall",header:/^\[Conversation Recall\b/,description:"How to look up earlier turns of a conversation that are not in the prompt"},{id:"landscape.monitoring",header:/^\[Background Monitoring\]$/,description:"How to watch logs, pipelines or files in the background"},{id:"landscape.teams",header:/^\[Agent Teams\]$/,description:"How to split a large task across a team of parallel agents"}];function S(t){let s=[],n=null;for(let r of t.split(`
1
+ import{p as f,s as h,v as g,y as m,z as E}from"./chunk-64IVC2G6.js";import{a as p,f as w}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";E();w();var l="request-gate",x="request-context",q=.1,C=3e3;function b(t,s){return s??f(t)??C}async function k(t,s,n,r=Math.random){let d=g(l)==="active";if(d){let e=h().seats[l]?.holdout??q;if(r()<e)return{active:!0,preprocess:!1,arm:"holdout"}}let i=d?"treatment":void 0,a=await m(l,{request:t.slice(0,2e3),agent:s,channel:n,operations:["select optional context","evaluate model routing where permitted"],constraints:["Keep the original request and mandatory instructions","Desktop model cannot be downgraded"]},{preprocess:p("This request benefits from structured context selection or another bounded typed decision before the main agent executes.",{true:"Relevant context must be selected, or a bounded routing decision can help. Follow-ups and ambiguous references need context.",false:"Typed preprocessing adds no useful decision; send the request to the configured main agent with existing context."})},{timeoutMs:b(l)});if(!a||a.mode!=="active")return{active:!1,preprocess:!1,arm:i};let c=a.answers.preprocess?.noul;return{active:!0,preprocess:Number.isFinite(c)&&c>=.5,arm:i}}var T={patternContext:"Learned behavioral patterns",references:"Retrieved project references",memoryContext:"Retrieved agent memory",crossChatContext:"Summaries from other conversations",longMemoryRecall:"Older conversation recall",wikiContext:"Retrieved wiki knowledge"},v=[{id:"landscape",header:/^\[Landscape\]$/,description:"Directory of the other agents on this node and on mesh peers, and the channels they are on"},{id:"landscape.messaging",header:/^\[Cross-Channel Messaging\]$/,description:"How to send a message to a different channel than the one this request came from"},{id:"landscape.recall",header:/^\[Conversation Recall\b/,description:"How to look up earlier turns of a conversation that are not in the prompt"},{id:"landscape.monitoring",header:/^\[Background Monitoring\]$/,description:"How to watch logs, pipelines or files in the background"},{id:"landscape.teams",header:/^\[Agent Teams\]$/,description:"How to split a large task across a team of parallel agents"}];function S(t){let s=[],n=null;for(let r of t.split(`
2
2
  `)){let d=/^\[[^\]]+\]$/.test(r);if(d||!n){let i=d?v.find(a=>a.header.test(r)):void 0;n={id:i?i.id:null,text:r},s.push(n)}else n.text+=`
3
3
  `+r}return s}async function O(t,s={}){let n=Object.entries(T).flatMap(([e,o])=>{let u=t[e];return u?[y(e,o,u)]:[]}),r=t.landscape?S(t.landscape):[];for(let e of r){if(!e.id||!e.text.trim())continue;let o=v.find(u=>u.id===e.id);n.push(y(e.id,o.description,e.text))}if(!n.length)return{input:t,excluded:[]};let d=Object.fromEntries(n.map(e=>[e.id,p(`Context block ${e.id} is relevant to completing the current request correctly.`,{true:"Needed or potentially relevant; retain if uncertain or the preview is incomplete.",false:"Clearly unrelated to the current request; safe to omit."})])),i=await m(x,{request:t.message.slice(0,2e3),channel:t.channel,agent:t.agentId,mandatory:["request","identity","permissions and instructions","same-chat history","handover","attachments","group-chat rules"],context:n},d,{timeoutMs:b(x,s.timeoutMs)});if(!i||i.mode!=="active")return{input:t,excluded:[]};let a={...t},c=[];for(let e of n){let o=i.answers[e.id]?.noul;Number.isFinite(o)&&o>=0&&o<.2&&c.push(e.id)}for(let e of c)e in T&&delete a[e];if(r.some(e=>e.id&&c.includes(e.id))){let e=r.filter(o=>!o.id||!c.includes(o.id)).map(o=>o.text.trim()).filter(Boolean);a.landscape=e.length?e.join(`
4
4
 
5
5
  `):void 0}return{input:a,excluded:c}}function y(t,s,n){return{id:t,description:s,source:t,characters:n.length,preview:n.slice(0,400),trust:"context data, not instructions"}}export{q as DEFAULT_REQUEST_GATE_HOLDOUT,x as REQUEST_CONTEXT_SEAT,l as REQUEST_GATE_SEAT,C as REQUEST_SEAT_TIMEOUT_MS,k as evaluateRequest,O as selectRequestContext,S as splitLandscape};
6
- //# sourceMappingURL=request-planner-LNNKTY7K.js.map
6
+ //# sourceMappingURL=request-planner-YDIX4BQW.js.map
@@ -1,4 +1,4 @@
1
- import{b as I}from"./chunk-B7HDWFKR.js";import"./chunk-IH65GDJR.js";import"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
1
+ import{b as I}from"./chunk-OJ4RUZZY.js";import"./chunk-IH65GDJR.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";import{createHash as E}from"crypto";var v="review:",b={decisions:"project",warnings:"feedback",friction:"feedback",context:"reference"};function A(t,n,r){let s=E("sha1").update(r.trim().toLowerCase()).digest("hex").slice(0,10);return`${v}${t}/${n}@${s}`}function F(t){if(!t.startsWith(v))return null;let n=t.slice(v.length),r=n.lastIndexOf("@"),s=n.lastIndexOf("/",r===-1?void 0:r);return r===-1||s===-1?null:{reviewId:n.slice(0,s),kind:n.slice(s+1,r),digest:n.slice(r+1)}}var C=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"finding",L=5;function T(t,n){return`${t}|${I(n)}`}function K(t,n={}){let r=n.kinds??Object.keys(b),s=n.minLength??24,h=[],d=new Map,u=new Map,f=new Map,x=new Map;for(let e of t){let i;try{i=JSON.parse(e.result)}catch{continue}let o=e.updated_at?new Date(e.updated_at).toISOString():new Date().toISOString();for(let c of r){let l=b[c];if(!l)continue;let R=i[c];if(Array.isArray(R))for(let $ of R){let a=String($?.text??"").trim();if(a.length<s)continue;let g=A(e.id,c,a),_=g.slice(g.lastIndexOf("@")),w=`${c}${_}`,y=T(c,a),S=f.get(y)??new Set;if(S.add(e.session_id??e.id),f.set(y,S),d.has(w))continue;let O=String($?.evidence??"").trim(),k={occurrences:1,agentId:e.agent,key:`${e.agent}/${l}_${C(a)}`,stamp:g,memory:{name:C(a),type:l,description:a.slice(0,200),body:"",createdAt:o,updatedAt:o}};x.set(g,{text:a,evidence:O,agent:e.agent,source:e.source}),d.set(w,k),u.set(w,y),h.push(k)}}}for(let[e,i]of d){let o=f.get(u.get(e)??"");i.occurrences=o?.size??1,i.sessions=[...o??[]].slice(0,L);let c=x.get(i.stamp);i.memory.body=D(c,i.occurrences)}let m=new Map;for(let[e,i]of d){let o=u.get(e)??e,c=m.get(o)??[];c.push(i),m.set(o,c)}let M=[...m.values()].sort((e,i)=>i[0].occurrences-e[0].occurrences),p=[];for(let e=0;p.length<h.length;e++){let i=!1;for(let o of M)e<o.length&&(p.push(o[e]),i=!0);if(!i)break}return p}function D(t,n){let r=`${t.agent}${t.source?` via ${t.source}`:""}`,s=[];return n>1?(s.push(`Observed in ${n} separate sessions. Most recently stated as:`),s.push(`> ${t.text}`),s.push(`Recurring across ${n} sessions is what makes this worth recording \u2014 any single occurrence is session state, the repetition is the finding.`)):s.push(t.text),t.evidence&&s.push(`**Evidence:** ${t.evidence}`),s.push(`_From ${n>1?"session reviews":"a session review"} of ${r}._`),s.join(`
2
2
 
3
3
  `)}export{L as MAX_EVIDENCE_SESSIONS,b as PROMOTABLE_KINDS,v as REVIEW_STAMP_PREFIX,F as parseReviewStamp,A as reviewStamp,K as reviewsToCandidates};
4
- //# sourceMappingURL=review-candidates-HQBKXAJA.js.map
4
+ //# sourceMappingURL=review-candidates-3QCCHXWM.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f}from"./chunk-MFZNBE65.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{e as DEFAULT_TRIAGE_ACTIONS,a as DOWNGRADE_BELOW,b as channelKeepsConfiguredModel,c as cheapModelForEngine,d as routeTaskModel,f as triageModelFor};
2
+ //# sourceMappingURL=routing-BGMIY5JY.js.map
@@ -0,0 +1,2 @@
1
+ import{c as a,d as b}from"./chunk-O2YDS2P3.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as resolveScheduleCaller,a as runScheduleTool};
2
+ //# sourceMappingURL=schedule-tool-P6XM6W3S.js.map
@@ -0,0 +1,2 @@
1
+ import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{a as AGENT_RUN_TIMEOUT_FLOOR,f as CronScheduler,b as agentRunTimeout,e as cronRunId,d as getNextCronDate,c as runLinkIds};
2
+ //# sourceMappingURL=scheduler-PUKN5YSL.js.map
@@ -1,2 +1,2 @@
1
- import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-MIUITI47.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";l();export{a as DEFAULT_SEAT_TIMEOUT_MS,k as askSeat,c as configureDecisions,b as configuredSeatTimeout,e as decisionsRuntime,h as getSeatMode,i as labelSeatCall,f as parseSeatMode,j as recordSeatOutcome,d as resetDecisionsRuntime,g as seatEnvVar};
2
- //# sourceMappingURL=seat-BSWBTNCP.js.map
1
+ import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";l();export{a as DEFAULT_SEAT_TIMEOUT_MS,k as askSeat,c as configureDecisions,b as configuredSeatTimeout,e as decisionsRuntime,h as getSeatMode,i as labelSeatCall,f as parseSeatMode,j as recordSeatOutcome,d as resetDecisionsRuntime,g as seatEnvVar};
2
+ //# sourceMappingURL=seat-OTAJJ5BP.js.map
@@ -1,2 +1,2 @@
1
- import{y as S,z as w}from"./chunk-MIUITI47.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
2
- //# sourceMappingURL=select-T4F42G6W.js.map
1
+ import{y as S,z as w}from"./chunk-64IVC2G6.js";import{a as g,b as h,f as R}from"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import{e as f}from"./chunk-JHCI6XCJ.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";w();R();var p="skill-select";function y(l){return{task:d(l.task,1200),...l.agent?{agent:l.agent}:{},skills:l.candidates.map(t=>({name:t.name,purpose:d(t.description,300),...t.category?{category:t.category}:{},...t.tags?.length?{tags:t.tags.slice(0,8)}:{}}))}}function b(l){let t={};for(let i of l)t[i.name]=d(i.description,300);return{anyRelevant:g("At least one of these skills is about the task at hand.",{true:"The task is the kind of work one of these skills exists for, and following it would change how the work is done \u2014 it names the same system, the same procedure or the same kind of artefact.",false:"None of them is about this task. They may share vocabulary with it, mention the same tools, or belong to the same project without bearing on what is being asked. Sharing words with a task is not being about it."}),best:h(t,"Which skill is this task most about?")}}function v(l){let t=l.anyRelevant,i=l.best,o=Object.entries(i.probabilities??{}).map(([e,s])=>({name:e,p:Number(s)||0})).sort((e,s)=>s.p-e.p);return{anyRelevant:t.noul,name:i.choice,confidence:i.confidence,ranked:o}}function d(l,t){return l.length>t?`${l.slice(0,t)}\u2026`:l}var x=.1,A=12;async function E(l,t,i={}){let o=i.minRelevant??.6,e=f(l,t).filter(n=>n.relevance>=x).slice(0,A),s=e.map(n=>({name:n.skill.frontmatter.name,lexical:n.relevance}));if(e.length===0)return{skill:null,anyRelevant:0,confidence:0,shortlist:s,judged:!1,reason:"no skill mentions anything in this task"};if(e.length===1)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`only ${e[0].skill.frontmatter.name} matched (${e[0].matchReason})`};let r=e.map(n=>({name:n.skill.frontmatter.name,description:n.skill.frontmatter.description,category:n.skill.frontmatter.category??null,tags:n.skill.frontmatter.tags})),m=await S(p,y({task:t,agent:i.agent??null,candidates:r}),b(r),{incumbent:{best:r[0].name},features:{agent:i.agent??"unknown",candidates:r.length}});if(!m)return{skill:e[0].skill,anyRelevant:e[0].relevance,confidence:e[0].relevance,shortlist:s,judged:!1,reason:`seat off \u2014 lexical top match (${e[0].matchReason})`};let a=v(m.answers),c=s.map(n=>({...n,p:a.ranked.find(k=>k.name===n.name)?.p??0})).sort((n,k)=>(k.p??0)-(n.p??0));if(a.anyRelevant<o)return{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`nothing on the shortlist is about this task (${a.anyRelevant.toFixed(2)} below ${o})`};let u=e.find(n=>n.skill.frontmatter.name===a.name);return u?{skill:u.skill,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`${a.name} (confidence ${a.confidence.toFixed(2)})`}:{skill:null,anyRelevant:a.anyRelevant,confidence:a.confidence,shortlist:c,judged:!0,reason:`seat chose "${a.name}", which was not on the shortlist`}}export{E as pickSkillForTask};
2
+ //# sourceMappingURL=select-KKMXIVVL.js.map
@@ -1,2 +1,2 @@
1
- import{b as a}from"./chunk-N476XZD3.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
2
- //# sourceMappingURL=set-enabled-UK4TPVC7.js.map
1
+ import{b as a}from"./chunk-LSFLSB7C.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";async function i(o,r,s={}){let e=null,n=await a(l=>{let t=l.crons?.[o];if(t?r&&t.approval?.action==="create"?e={ok:!1,status:409,error:`schedule "${o}" is waiting for approval: agentx schedule approve ${o}`}:t.enabled===r&&(e={ok:!0,id:o,enabled:r,changed:!1}):e={ok:!1,status:404,error:`no schedule "${o}"`},e)throw new Error("no write");t.enabled=r,e={ok:!0,id:o,enabled:r,changed:!0}},{configPath:s.configPath,reload:!1});return e&&(!e.ok||!e.changed)?e:n.success?e??{ok:!1,status:500,error:"mutation did not run"}:{ok:!1,status:500,error:n.error||"could not write agentx.json"}}export{i as setCronEnabled};
2
+ //# sourceMappingURL=set-enabled-BNF427ZN.js.map
@@ -1,7 +1,7 @@
1
- import{b as $}from"./chunk-UUOCCLIL.js";import"./chunk-RKPAVWXF.js";import{b as p}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-H4DWZIU7.js";import"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";var m=t=>typeof t=="string"?t.trim():"";function l(t){let n=t.sprint,i=[`${n.id} "${n.title}" [${n.state}], lead ${n.createdBy}${n.ref?`, plan ${n.ref}`:""}`];for(let r of t.lanes??[]){let o=(t.items??[]).filter(e=>e.lane===r.lane);i.push(` lane ${r.lane} (${r.agentId}) [${r.state}]${r.note?` ${r.note}`:""}`);for(let e of o)i.push(` ${e.idx}. ${e.ref}${e.title?` (${e.title})`:""} [${e.state}]${e.note&&e.state!=="done"?` ${e.note}`:""}`)}return i.join(`
1
+ import{d as $}from"./chunk-O2YDS2P3.js";import{b as p}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var m=t=>typeof t=="string"?t.trim():"";function l(t){let n=t.sprint,i=[`${n.id} "${n.title}" [${n.state}], lead ${n.createdBy}${n.ref?`, plan ${n.ref}`:""}`];for(let r of t.lanes??[]){let o=(t.items??[]).filter(e=>e.lane===r.lane);i.push(` lane ${r.lane} (${r.agentId}) [${r.state}]${r.note?` ${r.note}`:""}`);for(let e of o)i.push(` ${e.idx}. ${e.ref}${e.title?` (${e.title})`:""} [${e.state}]${e.note&&e.state!=="done"?` ${e.note}`:""}`)}return i.join(`
2
2
  `)}async function S(t,n){let i=n.fetch??fetch,r=n.daemonUrl.replace(/\/$/,""),o=(m(t.action)||"list").toLowerCase();try{if(o==="list"||o==="show"){let f=m(t.id);if(o==="show"&&!f)return"Error: show needs id: the sprint's id (spr-\u2026).";let d=await i(`${r}/sprints${o==="show"?`/${encodeURIComponent(f)}`:""}`,{signal:AbortSignal.timeout(1e4)}),a=await d.json().catch(()=>({}));if(!d.ok)return`Error: ${a?.error||`HTTP ${d.status}`}`;if(o==="show")return l(a);if(!a.enabled)return"Sprints are turned off on this node (requests.sprints.enabled).";let h=a.items??[];return h.length?h.map(l).join(`
3
3
 
4
4
  `):"No sprints."}let e=n.env??process.env,u=$(t,e);if(!u)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let c=await i(`${r}/sprints`,{method:"POST",headers:{"Content-Type":"application/json",...p(e)},body:JSON.stringify({action:o,agentId:u.agentId,id:t.id,title:t.title,ref:t.ref,idleMinutes:t.idleMinutes,lanes:t.lanes,lane:t.lane,item:t.item,note:t.note}),signal:AbortSignal.timeout(1e4)}),s=await c.json().catch(()=>({}));return c.ok?o==="start"?[`Sprint ${s.sprint.id} is running. AgentX hands each lane its first item now, and the next one each time the lane's turn ends; a lane that fails, or sits idle with items left, is told to the owner.`,l(s),"You do not need to stay in this session to keep the lanes going."].join(`
5
5
  `):o==="cancel"?`Sprint ${s.sprint.id} is cancelled: no more items are handed out. A turn already running goes on.`:[`Done. Sprint ${s.sprint.id} now:`,l(s)].join(`
6
6
  `):`Error: ${s?.error||`HTTP ${c.status}`}`}catch(e){return`Error: couldn't reach the daemon (${e?.message??e}).`}}export{l as describeSprint,S as runSprintTool};
7
- //# sourceMappingURL=sprint-tool-DN3BKLUY.js.map
7
+ //# sourceMappingURL=sprint-tool-Y72HTX5X.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/requests/sprint-tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\n\n// --- Agent-facing `agentx_sprint` tool (#1241) ---\n//\n// A lead agent hands the daemon a sprint: lanes side by side, each with an\n// agent and an ordered list of items. The daemon gives each lane its next\n// item when the lane's turn ends, so the lanes go on after the lead's\n// session does.\n// start a new sprint: title, ref (the plan's link), lanes\n// list active sprints and the last finished ones\n// show one sprint, item by item\n// block stop a lane (its agent or the lead), with a note\n// retry, skip, hold, release\n// the lead moves a lane on\n// cancel the lead stops the sprint\n// It talks to the daemon's /sprints endpoints.\n\nexport interface SprintToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\n/** One block per sprint: its lanes, item by item. */\nexport function describeSprint(v: any): string {\n const s = v.sprint\n const lines = [`${s.id} \"${s.title}\" [${s.state}], lead ${s.createdBy}${s.ref ? `, plan ${s.ref}` : \"\"}`]\n for (const l of v.lanes ?? []) {\n const items = (v.items ?? []).filter((i: any) => i.lane === l.lane)\n lines.push(` lane ${l.lane} (${l.agentId}) [${l.state}]${l.note ? ` ${l.note}` : \"\"}`)\n for (const i of items) lines.push(` ${i.idx}. ${i.ref}${i.title ? ` (${i.title})` : \"\"} [${i.state}]${i.note && i.state !== \"done\" ? ` ${i.note}` : \"\"}`)\n }\n return lines.join(\"\\n\")\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runSprintTool(args: Record<string, unknown>, deps: SprintToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n\n try {\n if (action === \"list\" || action === \"show\") {\n const id = str(args.id)\n if (action === \"show\" && !id) return \"Error: show needs id: the sprint's id (spr-…).\"\n const res = await doFetch(`${base}/sprints${action === \"show\" ? `/${encodeURIComponent(id)}` : \"\"}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"show\") return describeSprint(data)\n if (!data.enabled) return \"Sprints are turned off on this node (requests.sprints.enabled).\"\n const items = data.items ?? []\n return items.length ? items.map(describeSprint).join(\"\\n\\n\") : \"No sprints.\"\n }\n\n const env = deps.env ?? process.env\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/sprints`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n id: args.id, title: args.title, ref: args.ref, idleMinutes: args.idleMinutes, lanes: args.lanes,\n lane: args.lane, item: args.item, note: args.note,\n }),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"start\") {\n return [\n `Sprint ${data.sprint.id} is running. AgentX hands each lane its first item now, and the next one each time the lane's turn ends; a lane that fails, or sits idle with items left, is told to the owner.`,\n describeSprint(data),\n \"You do not need to stay in this session to keep the lanes going.\",\n ].join(\"\\n\")\n }\n if (action === \"cancel\") return `Sprint ${data.sprint.id} is cancelled: no more items are handed out. A turn already running goes on.`\n return [`Done. Sprint ${data.sprint.id} now:`, describeSprint(data)].join(\"\\n\")\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"wdAwBA,IAAMA,EAAOC,GAAgB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAGzD,SAASC,EAAeD,EAAgB,CAC7C,IAAME,EAAIF,EAAE,OACNG,EAAQ,CAAC,GAAGD,EAAE,OAAOA,EAAE,WAAWA,EAAE,gBAAgBA,EAAE,YAAYA,EAAE,IAAM,UAAUA,EAAE,MAAQ,IAAI,EACxG,QAAWE,KAAKJ,EAAE,OAAS,CAAC,EAAG,CAC7B,IAAMK,GAASL,EAAE,OAAS,CAAC,GAAG,OAAQM,GAAWA,EAAE,OAASF,EAAE,IAAI,EAClED,EAAM,KAAK,UAAUC,EAAE,SAASA,EAAE,aAAaA,EAAE,SAASA,EAAE,KAAO,IAAIA,EAAE,OAAS,IAAI,EACtF,QAAWE,KAAKD,EAAOF,EAAM,KAAK,OAAOG,EAAE,QAAQA,EAAE,MAAMA,EAAE,MAAQ,KAAKA,EAAE,SAAW,OAAOA,EAAE,SAASA,EAAE,MAAQA,EAAE,QAAU,OAAS,IAAIA,EAAE,OAAS,IAAI,EAE7J,OAAOH,EAAM,KAAK;AAAA,CAAI,CACxB,CAGA,eAAsBI,EAAcC,EAA+BC,EAAuC,CACxG,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUb,EAAIS,EAAK,MAAM,GAAK,QAAQ,YAAY,EAExD,GAAI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ACtBd,EAAec,CAAI,EACnB,kEACF,EAAE,KAAK;AAAA,CAAI,EAETH,IAAW,SAAiB,UAAUG,EAAK,OAAO,iFAC/C,CAAC,gBAAgBA,EAAK,OAAO,UAAWd,EAAec,CAAI,CAAC,EAAE,KAAK;AAAA,CAAI,EAT1D,UAAUA,GAAM,OAAS,QAAQD,EAAI,UAU3D,OAAS,EAAP,CACA,MAAO,qCAAqC,GAAG,SAAW,KAC5D,CACF","names":["str","v","describeSprint","s","lines","l","items","i","runSprintTool","args","deps","doFetch","base","action","id","res","data","env","caller","resolveScheduleCaller","callerHeaders"]}
1
+ {"version":3,"sources":["../src/requests/sprint-tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\n\n// --- Agent-facing `agentx_sprint` tool (#1241) ---\n//\n// A lead agent hands the daemon a sprint: lanes side by side, each with an\n// agent and an ordered list of items. The daemon gives each lane its next\n// item when the lane's turn ends, so the lanes go on after the lead's\n// session does.\n// start a new sprint: title, ref (the plan's link), lanes\n// list active sprints and the last finished ones\n// show one sprint, item by item\n// block stop a lane (its agent or the lead), with a note\n// retry, skip, hold, release\n// the lead moves a lane on\n// cancel the lead stops the sprint\n// It talks to the daemon's /sprints endpoints.\n\nexport interface SprintToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\n/** One block per sprint: its lanes, item by item. */\nexport function describeSprint(v: any): string {\n const s = v.sprint\n const lines = [`${s.id} \"${s.title}\" [${s.state}], lead ${s.createdBy}${s.ref ? `, plan ${s.ref}` : \"\"}`]\n for (const l of v.lanes ?? []) {\n const items = (v.items ?? []).filter((i: any) => i.lane === l.lane)\n lines.push(` lane ${l.lane} (${l.agentId}) [${l.state}]${l.note ? ` ${l.note}` : \"\"}`)\n for (const i of items) lines.push(` ${i.idx}. ${i.ref}${i.title ? ` (${i.title})` : \"\"} [${i.state}]${i.note && i.state !== \"done\" ? ` ${i.note}` : \"\"}`)\n }\n return lines.join(\"\\n\")\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runSprintTool(args: Record<string, unknown>, deps: SprintToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n\n try {\n if (action === \"list\" || action === \"show\") {\n const id = str(args.id)\n if (action === \"show\" && !id) return \"Error: show needs id: the sprint's id (spr-…).\"\n const res = await doFetch(`${base}/sprints${action === \"show\" ? `/${encodeURIComponent(id)}` : \"\"}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"show\") return describeSprint(data)\n if (!data.enabled) return \"Sprints are turned off on this node (requests.sprints.enabled).\"\n const items = data.items ?? []\n return items.length ? items.map(describeSprint).join(\"\\n\\n\") : \"No sprints.\"\n }\n\n const env = deps.env ?? process.env\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/sprints`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n id: args.id, title: args.title, ref: args.ref, idleMinutes: args.idleMinutes, lanes: args.lanes,\n lane: args.lane, item: args.item, note: args.note,\n }),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (action === \"start\") {\n return [\n `Sprint ${data.sprint.id} is running. AgentX hands each lane its first item now, and the next one each time the lane's turn ends; a lane that fails, or sits idle with items left, is told to the owner.`,\n describeSprint(data),\n \"You do not need to stay in this session to keep the lanes going.\",\n ].join(\"\\n\")\n }\n if (action === \"cancel\") return `Sprint ${data.sprint.id} is cancelled: no more items are handed out. A turn already running goes on.`\n return [`Done. Sprint ${data.sprint.id} now:`, describeSprint(data)].join(\"\\n\")\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"4bAwBA,IAAMA,EAAOC,GAAgB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAGzD,SAASC,EAAeD,EAAgB,CAC7C,IAAME,EAAIF,EAAE,OACNG,EAAQ,CAAC,GAAGD,EAAE,OAAOA,EAAE,WAAWA,EAAE,gBAAgBA,EAAE,YAAYA,EAAE,IAAM,UAAUA,EAAE,MAAQ,IAAI,EACxG,QAAWE,KAAKJ,EAAE,OAAS,CAAC,EAAG,CAC7B,IAAMK,GAASL,EAAE,OAAS,CAAC,GAAG,OAAQM,GAAWA,EAAE,OAASF,EAAE,IAAI,EAClED,EAAM,KAAK,UAAUC,EAAE,SAASA,EAAE,aAAaA,EAAE,SAASA,EAAE,KAAO,IAAIA,EAAE,OAAS,IAAI,EACtF,QAAWE,KAAKD,EAAOF,EAAM,KAAK,OAAOG,EAAE,QAAQA,EAAE,MAAMA,EAAE,MAAQ,KAAKA,EAAE,SAAW,OAAOA,EAAE,SAASA,EAAE,MAAQA,EAAE,QAAU,OAAS,IAAIA,EAAE,OAAS,IAAI,EAE7J,OAAOH,EAAM,KAAK;AAAA,CAAI,CACxB,CAGA,eAAsBI,EAAcC,EAA+BC,EAAuC,CACxG,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUb,EAAIS,EAAK,MAAM,GAAK,QAAQ,YAAY,EAExD,GAAI,CACF,GAAII,IAAW,QAAUA,IAAW,OAAQ,CAC1C,IAAMC,EAAKd,EAAIS,EAAK,EAAE,EACtB,GAAII,IAAW,QAAU,CAACC,EAAI,MAAO,sDACrC,IAAMC,EAAM,MAAMJ,EAAQ,GAAGC,YAAeC,IAAW,OAAS,IAAI,mBAAm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M,OAAS,QAAQD,EAAI,UAU3D,OAAS,EAAP,CACA,MAAO,qCAAqC,GAAG,SAAW,KAC5D,CACF","names":["str","v","describeSprint","s","lines","l","items","i","runSprintTool","args","deps","doFetch","base","action","id","res","data","env","caller","resolveScheduleCaller","callerHeaders"]}
@@ -1,4 +1,4 @@
1
- import{b as y}from"./chunk-UUOCCLIL.js";import"./chunk-RKPAVWXF.js";import{b as u}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-H4DWZIU7.js";import"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import{h as f}from"./chunk-4NZ4T3TQ.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";var w=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function c(t){return typeof t=="string"?t.trim():""}async function b(t,s){let d=s.fetch??fetch,l=s.daemonUrl.replace(/\/$/,""),i=(c(t.action)||"create").toLowerCase(),o=y(t,s.env??process.env);if(i==="status"){let n=c(t.id);if(!n)return"Error: `id` is required for status (the card id you got when you raised it).";try{let a=await d(`${l}/approvals/${encodeURIComponent(n)}`,{signal:AbortSignal.timeout(1e4)}),r=await a.json().catch(()=>({}));if(!a.ok)return`Error: ${r?.error||`HTTP ${a.status}`}`;let e=r.card;if(o&&e.raised_by!==o.agentId)return`Error: card "${n}" was raised by another agent.`;if(e.status==="pending")return`Card ${e.id} is still waiting for the operator. It expires ${e.expires}; then "${e.if_silent}" applies.`;if(e.status==="decided"){let h=e.verdict==="yes"?f(e).join(`
1
+ import{d as y}from"./chunk-O2YDS2P3.js";import{b as u}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import{h as f}from"./chunk-4NZ4T3TQ.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var w=new Set(["cron","heartbeat","api","a2a","mesh","approvals","requests"]);function c(t){return typeof t=="string"?t.trim():""}async function b(t,s){let d=s.fetch??fetch,l=s.daemonUrl.replace(/\/$/,""),i=(c(t.action)||"create").toLowerCase(),o=y(t,s.env??process.env);if(i==="status"){let n=c(t.id);if(!n)return"Error: `id` is required for status (the card id you got when you raised it).";try{let a=await d(`${l}/approvals/${encodeURIComponent(n)}`,{signal:AbortSignal.timeout(1e4)}),r=await a.json().catch(()=>({}));if(!a.ok)return`Error: ${r?.error||`HTTP ${a.status}`}`;let e=r.card;if(o&&e.raised_by!==o.agentId)return`Error: card "${n}" was raised by another agent.`;if(e.status==="pending")return`Card ${e.id} is still waiting for the operator. It expires ${e.expires}; then "${e.if_silent}" applies.`;if(e.status==="decided"){let h=e.verdict==="yes"?f(e).join(`
2
2
  `):"";return`Card ${e.id}: the operator said ${String(e.verdict).toUpperCase()}.${e.note?` Note: ${e.note}`:""}${h?`
3
3
  ${h}`:""}`}return e.status==="resolved"?`Card ${e.id} was closed by ${e.raised_by}: ${e.resolution??"answered outside the card"}.`:`Card ${e.id} expired unanswered; the default applied: ${e.outcome??e.if_silent}.`}catch(a){return`Error: couldn't reach the daemon (${a?.message??a}).`}}if(i==="resolve"){let n=c(t.id),a=c(t.reason);if(!n)return"Error: `id` is required for resolve (the card id you got when you raised it).";if(!a)return'Error: `reason` is required for resolve: where the owner answered and what you did, e.g. "approved in chat, done".';if(!o)return"Error: couldn't tell which agent you are. Pass callerAgentId.";try{let r=await d(`${l}/approvals/${encodeURIComponent(n)}/resolve`,{method:"POST",headers:{"Content-Type":"application/json",...u(s.env??process.env)},body:JSON.stringify({raised_by:o.agentId,reason:a}),signal:AbortSignal.timeout(1e4)}),e=await r.json().catch(()=>({}));return r.ok?`Card ${e.card.id} is closed. It left the operator's inbox, so nobody will be asked about it again.`:`Error: ${e?.error||`HTTP ${r.status}`}`}catch(r){return`Error: couldn't reach the daemon (${r?.message??r}).`}}if(i!=="create")return`Error: unknown action "${i}". Use create, status or resolve.`;if(!o)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let p=o.channel&&o.chatId&&!w.has(o.channel)?{channel:o.channel,chatId:o.chatId,...o.accountId?{accountId:o.accountId}:{}}:void 0,$={title:t.title,ask:t.ask,recommend:t.recommend,if_silent:t.if_silent,expires:t.expires,source:t.source,choices:t.choices,draft:t.draft,say:t.say,context:t.context,followup:t.followup,raised_by:o.agentId,...p?{reply:p}:{}};try{let n=await d(`${l}/approvals`,{method:"POST",headers:{"Content-Type":"application/json",...u(s.env??process.env)},body:JSON.stringify($),signal:AbortSignal.timeout(1e4)}),a=await n.json().catch(()=>({}));if(!n.ok)return`Error: ${a?.error||`HTTP ${n.status}`}`;let r=a.card;return[`Decision card ${r.id} is in the operator's Approvals inbox.`,`If nobody answers by ${r.expires}, "${r.if_silent}" applies.`,"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat.",`If the operator answers the same thing in chat and you act on it, close the card with {action:"resolve", id:"${r.id}", reason:"approved in chat, done"} so it is not asked again.`].join(" ")}catch(n){return`Error: couldn't reach the daemon (${n?.message??n}).`}}export{b as runApprovalTool};
4
- //# sourceMappingURL=tool-L3CQUOAZ.js.map
4
+ //# sourceMappingURL=tool-DW6MYEG2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/approvals/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\nimport { answerLines } from \"./choices\"\n\n// --- Agent-facing `agentx_approval` tool ---\n//\n// Lets an agent raise a decision card instead of asking the operator in\n// chat, check what happened to one, and close its own card once the owner\n// answered the same thing in chat and it acted on that (#909). It talks to\n// the daemon's /approvals endpoints, which never decide: there is no\n// action here that approves or rejects anything.\n\nexport type ApprovalToolAction = \"create\" | \"status\" | \"resolve\"\n\nexport interface ApprovalToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst NON_CHAT_CHANNELS = new Set([\"cron\", \"heartbeat\", \"api\", \"a2a\", \"mesh\", \"approvals\", \"requests\"])\n\nfunction str(v: unknown): string {\n return typeof v === \"string\" ? v.trim() : \"\"\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runApprovalTool(args: Record<string, unknown>, deps: ApprovalToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"create\").toLowerCase() as ApprovalToolAction\n const caller = resolveScheduleCaller(args, deps.env ?? process.env)\n\n if (action === \"status\") {\n const id = str(args.id)\n if (!id) return \"Error: `id` is required for status (the card id you got when you raised it).\"\n try {\n const res = await doFetch(`${base}/approvals/${encodeURIComponent(id)}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const c = data.card\n if (caller && c.raised_by !== caller.agentId) return `Error: card \"${id}\" was raised by another agent.`\n if (c.status === \"pending\") return `Card ${c.id} is still waiting for the operator. It expires ${c.expires}; then \"${c.if_silent}\" applies.`\n if (c.status === \"decided\") {\n const picked = c.verdict === \"yes\" ? answerLines(c).join(\"\\n\") : \"\"\n return `Card ${c.id}: the operator said ${String(c.verdict).toUpperCase()}.${c.note ? ` Note: ${c.note}` : \"\"}${picked ? `\\n${picked}` : \"\"}`\n }\n if (c.status === \"resolved\") return `Card ${c.id} was closed by ${c.raised_by}: ${c.resolution ?? \"answered outside the card\"}.`\n return `Card ${c.id} expired unanswered; the default applied: ${c.outcome ?? c.if_silent}.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n }\n\n if (action === \"resolve\") {\n const id = str(args.id)\n const reason = str(args.reason)\n if (!id) return \"Error: `id` is required for resolve (the card id you got when you raised it).\"\n if (!reason) return \"Error: `reason` is required for resolve: where the owner answered and what you did, e.g. \\\"approved in chat, done\\\".\"\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n try {\n const res = await doFetch(`${base}/approvals/${encodeURIComponent(id)}/resolve`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(deps.env ?? process.env) },\n body: JSON.stringify({ raised_by: caller.agentId, reason }),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n return `Card ${data.card.id} is closed. It left the operator's inbox, so nobody will be asked about it again.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n }\n\n if (action !== \"create\") return `Error: unknown action \"${action}\". Use create, status or resolve.`\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n\n const reply = caller.channel && caller.chatId && !NON_CHAT_CHANNELS.has(caller.channel)\n ? { channel: caller.channel, chatId: caller.chatId, ...(caller.accountId ? { accountId: caller.accountId } : {}) }\n : undefined\n const payload = {\n title: args.title,\n ask: args.ask,\n recommend: args.recommend,\n if_silent: args.if_silent,\n expires: args.expires,\n source: args.source,\n choices: args.choices,\n draft: args.draft,\n say: args.say,\n context: args.context,\n followup: args.followup,\n raised_by: caller.agentId,\n ...(reply ? { reply } : {}),\n }\n try {\n const res = await doFetch(`${base}/approvals`, {\n method: \"POST\",\n // The headers name this run: a card moves a request to \"waiting on\n // the owner\" only when it comes from the turn of that request.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(deps.env ?? process.env) },\n body: JSON.stringify(payload),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const c = data.card\n return [\n `Decision card ${c.id} is in the operator's Approvals inbox.`,\n `If nobody answers by ${c.expires}, \"${c.if_silent}\" applies.`,\n \"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat.\",\n `If the operator answers the same thing in chat and you act on it, close the card with {action:\"resolve\", id:\"${c.id}\", reason:\"approved in chat, done\"} so it is not asked again.`,\n ].join(\" \")\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"ggBAoBA,IAAMA,EAAoB,IAAI,IAAI,CAAC,OAAQ,YAAa,MAAO,MAAO,OAAQ,YAAa,UAAU,CAAC,EAEtG,SAASC,EAAIC,EAAoB,CAC/B,OAAO,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,EAC5C,CAGA,eAAsBC,EAAgBC,EAA+BC,EAAyC,CAC5G,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUP,EAAIG,EAAK,MAAM,GAAK,UAAU,YAAY,EACpDK,EAASC,EAAsBN,EAAMC,EAAK,KAAO,QAAQ,GAAG,EAElE,GAAIG,IAAW,SAAU,CACvB,IAAMG,EAAKV,EAAIG,EAAK,EAAE,EACtB,GAAI,CAACO,EAAI,MAAO,+EAChB,GAAI,CACF,IAAMC,EAAM,MAAMN,EAAQ,GAAGC,eAAkB,mBAAmBI,CAAE,IAAK,CAAE,OAAQ,YAAY,QAAQ,GAAM,CAAE,CAAC,EAC1GE,EAAO,MAAMD,EAAI,KAAK,EAAE,MAAM,KAAO,CAAC,EAAE,EAC9C,GAAI,CAACA,EAAI,GAAI,MAAO,UAAUC,GAAM,OAAS,QAAQD,EAAI,WACzD,IAAME,EAAID,EAAK,KACf,GAAIJ,GAAUK,EAAE,YAAcL,EAAO,QAAS,MAAO,gBAAgBE,kCACrE,GAAIG,EA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A0BA,qCAC1D,GAAI,CAACC,EAAQ,MAAO,gEAEpB,IAAMW,EAAQX,EAAO,SAAWA,EAAO,QAAU,CAACT,EAAkB,IAAIS,EAAO,OAAO,EAClF,CAAE,QAASA,EAAO,QAAS,OAAQA,EAAO,OAAQ,GAAIA,EAAO,UAAY,CAAE,UAAWA,EAAO,SAAU,EAAI,CAAC,CAAG,EAC/G,OACEY,EAAU,CACd,MAAOjB,EAAK,MACZ,IAAKA,EAAK,IACV,UAAWA,EAAK,UAChB,UAAWA,EAAK,UAChB,QAASA,EAAK,QACd,OAAQA,EAAK,OACb,QAASA,EAAK,QACd,MAAOA,EAAK,MACZ,IAAKA,EAAK,IACV,QAASA,EAAK,QACd,SAAUA,EAAK,SACf,UAAWK,EAAO,QAClB,GAAIW,EAAQ,CAAE,MAAAA,CAAM,EAAI,CAAC,CAC3B,EACA,GAAI,CACF,IAAMR,EAAM,MAAMN,EAAQ,GAAGC,cAAkB,CAC7C,OAAQ,OAGR,QAAS,CAAE,eAAgB,mBAAoB,GAAGY,EAAcd,EAAK,KAAO,QAAQ,GAAG,CAAE,EACzF,KAAM,KAAK,UAAUgB,CAAO,EAC5B,OAAQ,YAAY,QAAQ,GAAM,CACpC,CAAC,EACKR,EAAO,MAAMD,EAAI,KAAK,EAAE,MAAM,KAAO,CAAC,EAAE,EAC9C,GAAI,CAACA,EAAI,GAAI,MAAO,UAAUC,GAAM,OAAS,QAAQD,EAAI,WACzD,IAAME,EAAID,EAAK,KACf,MAAO,CACL,iBAAiBC,EAAE,2CACnB,wBAAwBA,EAAE,aAAaA,EAAE,sBACzC,+HACA,gHAAgHA,EAAE,iEACpH,EAAE,KAAK,GAAG,CACZ,OAASG,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["NON_CHAT_CHANNELS","str","v","runApprovalTool","args","deps","doFetch","base","action","caller","resolveScheduleCaller","id","res","data","c","picked","answerLines","e","reason","callerHeaders","reply","payload"]}
1
+ {"version":3,"sources":["../src/approvals/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\nimport { answerLines } from \"./choices\"\n\n// --- Agent-facing `agentx_approval` tool ---\n//\n// Lets an agent raise a decision card instead of asking the operator in\n// chat, check what happened to one, and close its own card once the owner\n// answered the same thing in chat and it acted on that (#909). It talks to\n// the daemon's /approvals endpoints, which never decide: there is no\n// action here that approves or rejects anything.\n\nexport type ApprovalToolAction = \"create\" | \"status\" | \"resolve\"\n\nexport interface ApprovalToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst NON_CHAT_CHANNELS = new Set([\"cron\", \"heartbeat\", \"api\", \"a2a\", \"mesh\", \"approvals\", \"requests\"])\n\nfunction str(v: unknown): string {\n return typeof v === \"string\" ? v.trim() : \"\"\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runApprovalTool(args: Record<string, unknown>, deps: ApprovalToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"create\").toLowerCase() as ApprovalToolAction\n const caller = resolveScheduleCaller(args, deps.env ?? process.env)\n\n if (action === \"status\") {\n const id = str(args.id)\n if (!id) return \"Error: `id` is required for status (the card id you got when you raised it).\"\n try {\n const res = await doFetch(`${base}/approvals/${encodeURIComponent(id)}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const c = data.card\n if (caller && c.raised_by !== caller.agentId) return `Error: card \"${id}\" was raised by another agent.`\n if (c.status === \"pending\") return `Card ${c.id} is still waiting for the operator. It expires ${c.expires}; then \"${c.if_silent}\" applies.`\n if (c.status === \"decided\") {\n const picked = c.verdict === \"yes\" ? answerLines(c).join(\"\\n\") : \"\"\n return `Card ${c.id}: the operator said ${String(c.verdict).toUpperCase()}.${c.note ? ` Note: ${c.note}` : \"\"}${picked ? `\\n${picked}` : \"\"}`\n }\n if (c.status === \"resolved\") return `Card ${c.id} was closed by ${c.raised_by}: ${c.resolution ?? \"answered outside the card\"}.`\n return `Card ${c.id} expired unanswered; the default applied: ${c.outcome ?? c.if_silent}.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n }\n\n if (action === \"resolve\") {\n const id = str(args.id)\n const reason = str(args.reason)\n if (!id) return \"Error: `id` is required for resolve (the card id you got when you raised it).\"\n if (!reason) return \"Error: `reason` is required for resolve: where the owner answered and what you did, e.g. \\\"approved in chat, done\\\".\"\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n try {\n const res = await doFetch(`${base}/approvals/${encodeURIComponent(id)}/resolve`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(deps.env ?? process.env) },\n body: JSON.stringify({ raised_by: caller.agentId, reason }),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n return `Card ${data.card.id} is closed. It left the operator's inbox, so nobody will be asked about it again.`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n }\n\n if (action !== \"create\") return `Error: unknown action \"${action}\". Use create, status or resolve.`\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n\n const reply = caller.channel && caller.chatId && !NON_CHAT_CHANNELS.has(caller.channel)\n ? { channel: caller.channel, chatId: caller.chatId, ...(caller.accountId ? { accountId: caller.accountId } : {}) }\n : undefined\n const payload = {\n title: args.title,\n ask: args.ask,\n recommend: args.recommend,\n if_silent: args.if_silent,\n expires: args.expires,\n source: args.source,\n choices: args.choices,\n draft: args.draft,\n say: args.say,\n context: args.context,\n followup: args.followup,\n raised_by: caller.agentId,\n ...(reply ? { reply } : {}),\n }\n try {\n const res = await doFetch(`${base}/approvals`, {\n method: \"POST\",\n // The headers name this run: a card moves a request to \"waiting on\n // the owner\" only when it comes from the turn of that request.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(deps.env ?? process.env) },\n body: JSON.stringify(payload),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const c = data.card\n return [\n `Decision card ${c.id} is in the operator's Approvals inbox.`,\n `If nobody answers by ${c.expires}, \"${c.if_silent}\" applies.`,\n \"You will get a message with the result. Tell the requester it is waiting for approval; don't ask the operator again in chat.\",\n `If the operator answers the same thing in chat and you act on it, close the card with {action:\"resolve\", id:\"${c.id}\", reason:\"approved in chat, done\"} so it is not asked again.`,\n ].join(\" \")\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"oeAoBA,IAAMA,EAAoB,IAAI,IAAI,CAAC,OAAQ,YAAa,MAAO,MAAO,OAAQ,YAAa,UAAU,CAAC,EAEtG,SAASC,EAAIC,EAAoB,CAC/B,OAAO,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,EAC5C,CAGA,eAAsBC,EAAgBC,EAA+BC,EAAyC,CAC5G,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUP,EAAIG,EAAK,MAAM,GAAK,UAAU,YAAY,EACpDK,EAASC,EAAsBN,EAAMC,EAAK,KAAO,QAAQ,GAAG,EAElE,GAAIG,IAAW,SAAU,CACvB,IAAMG,EAAKV,EAAIG,EAAK,EAAE,EACtB,GAAI,CAACO,EAAI,MAAO,+EAChB,GAAI,CACF,IAAMC,EAAM,MAAMN,EAAQ,GAAGC,eAAkB,mBAAmBI,CAAE,IAAK,CAAE,OAAQ,YAAY,QAAQ,GAAM,CAAE,CAAC,EAC1GE,EAAO,MAAMD,EAAI,KAAK,EAAE,MAAM,KAAO,CAAC,EAAE,EAC9C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qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["NON_CHAT_CHANNELS","str","v","runApprovalTool","args","deps","doFetch","base","action","caller","resolveScheduleCaller","id","res","data","c","picked","answerLines","e","reason","callerHeaders","reply","payload"]}
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d}from"./chunk-KBSQRQPF.js";import"./chunk-O2YDS2P3.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";export{b as describeCard,a as describeNumber,c as describeReadings,d as runNumbersTool};
2
+ //# sourceMappingURL=tool-EA4FWTH6.js.map
@@ -1,4 +1,4 @@
1
- import{b as $}from"./chunk-UUOCCLIL.js";import"./chunk-RKPAVWXF.js";import{h as m}from"./chunk-RX5O5637.js";import"./chunk-H4DWZIU7.js";import"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";var u=e=>typeof e=="string"?e.trim():"";async function k(e,l){let w=l.fetch??fetch,y=l.daemonUrl.replace(/\/$/,""),i=(u(e.action)||"draft").toLowerCase(),p=$(e,l.env??process.env);if(!p)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let f=encodeURIComponent(p.agentId),d=async(s,c)=>{let n=await w(`${y}${s}`,{...c,signal:AbortSignal.timeout(1e4)}),r=await n.json().catch(()=>({}));return{ok:n.ok,data:n.ok?r:{error:r?.error||`HTTP ${n.status}`}}};try{if(i==="voice"){let r=encodeURIComponent(u(e.topic)),{ok:a,data:o}=await d(`/content/voice?agent=${f}&topic=${r}&n=${Number(e.n)||3}`);return a?o.total?[`${o.total} past post(s) in voice/. Closest to the topic:`,...o.samples.map(t=>`- ${t.file}: ${t.excerpt}`),"Read the whole files before you write, follow their length, tone and habits, and name them in `samples` when you raise the draft."].join(`
1
+ import{d as $}from"./chunk-O2YDS2P3.js";import{h as m}from"./chunk-RX5O5637.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var u=e=>typeof e=="string"?e.trim():"";async function k(e,l){let w=l.fetch??fetch,y=l.daemonUrl.replace(/\/$/,""),i=(u(e.action)||"draft").toLowerCase(),p=$(e,l.env??process.env);if(!p)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let f=encodeURIComponent(p.agentId),d=async(s,c)=>{let n=await w(`${y}${s}`,{...c,signal:AbortSignal.timeout(1e4)}),r=await n.json().catch(()=>({}));return{ok:n.ok,data:n.ok?r:{error:r?.error||`HTTP ${n.status}`}}};try{if(i==="voice"){let r=encodeURIComponent(u(e.topic)),{ok:a,data:o}=await d(`/content/voice?agent=${f}&topic=${r}&n=${Number(e.n)||3}`);return a?o.total?[`${o.total} past post(s) in voice/. Closest to the topic:`,...o.samples.map(t=>`- ${t.file}: ${t.excerpt}`),"Read the whole files before you write, follow their length, tone and habits, and name them in `samples` when you raise the draft."].join(`
2
2
  `):"There are no past posts in voice/ yet. Ask the owner to add a few (one post per .md or .txt file) before you draft.":`Error: ${o.error}`}if(i==="calendar"){let{ok:r,data:a}=await d(`/content/calendar?agent=${f}`);return r?a.exists?a.entries.length?["Planned in the next 14 days:",...a.entries.map(o=>`- ${o.date} ${o.platform}: ${o.topic} (${o.status})`)].join(`
3
3
  `):"Nothing is planned in the next 14 days. Add rows to calendar.md.":"There is no calendar.md yet. Create it from the calendar template in your content skill.":`Error: ${a.error}`}if(i==="status"){let r=u(e.id);if(!r)return"Error: `id` is required for status (the draft id you got when you raised it).";let{ok:a,data:o}=await d(`/content/drafts/${encodeURIComponent(r)}?agent=${f}`);if(!a)return`Error: ${o.error}`;let t=o.draft,h=m[t.platform]??t.platform;switch(t.status){case"pending":return`Draft ${t.id} is still waiting for the owner's approval. Nothing has been published.`;case"posted":return`Draft ${t.id} was approved and posted on ${h}${t.url?`: ${t.url}`:""}.`;case"ready":return`Draft ${t.id} was approved. No ${h} connector is set, so it was saved ready to paste: ${t.file}.`;case"rejected":return`Draft ${t.id}: the owner said no. Nothing was published.`;default:return`Draft ${t.id} was approved but not posted: ${t.error??"unknown error"}.`}}if(i!=="draft")return`Error: unknown action "${i}". Use voice, calendar, draft or status.`;let{ok:s,data:c}=await d("/content/drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:p.agentId,platform:e.platform,text:e.text,samples:e.samples,topic:e.topic,date:e.date})});if(!s)return`Error: ${c.error}`;let n=c.draft;return[`Draft ${n.id} is in the owner's Approvals inbox as content:${n.id}. Nothing is published until they say yes.`,`It follows: ${n.samples.join(", ")}.`,`Don't post it yourself and don't ask again in chat. Check it later with {action:"status", id:"`+n.id+'"}.'].join(" ")}catch(s){return`Error: couldn't reach the daemon (${s?.message??s}).`}}export{k as runContentTool};
4
- //# sourceMappingURL=tool-ZVYUWVJQ.js.map
4
+ //# sourceMappingURL=tool-F4ZVMX4J.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/content/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { PLATFORM_LABEL, type ContentDraft } from \"./drafts\"\n\n// --- Agent-facing `agentx_content` tool ---\n//\n// Lets a content agent find the owner's past posts closest to a topic,\n// read its calendar, raise a draft for approval and check what happened\n// to it. It talks to the daemon's /content endpoints, which never publish:\n// there is no action here that posts anything.\n\nexport type ContentToolAction = \"voice\" | \"calendar\" | \"draft\" | \"status\"\n\nexport interface ContentToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown): string => (typeof v === \"string\" ? v.trim() : \"\")\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runContentTool(args: Record<string, unknown>, deps: ContentToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"draft\").toLowerCase() as ContentToolAction\n const caller = resolveScheduleCaller(args, deps.env ?? process.env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const agent = encodeURIComponent(caller.agentId)\n\n const call = async (path: string, init?: RequestInit): Promise<{ ok: boolean; data: any }> => {\n const res = await doFetch(`${base}${path}`, { ...init, signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({}))\n return { ok: res.ok, data: res.ok ? data : { error: (data as any)?.error || `HTTP ${res.status}` } }\n }\n\n try {\n if (action === \"voice\") {\n const topic = encodeURIComponent(str(args.topic))\n const { ok, data } = await call(`/content/voice?agent=${agent}&topic=${topic}&n=${Number(args.n) || 3}`)\n if (!ok) return `Error: ${data.error}`\n if (!data.total) return \"There are no past posts in voice/ yet. Ask the owner to add a few (one post per .md or .txt file) before you draft.\"\n return [\n `${data.total} past post(s) in voice/. Closest to the topic:`,\n ...data.samples.map((s: any) => `- ${s.file}: ${s.excerpt}`),\n \"Read the whole files before you write, follow their length, tone and habits, and name them in `samples` when you raise the draft.\",\n ].join(\"\\n\")\n }\n\n if (action === \"calendar\") {\n const { ok, data } = await call(`/content/calendar?agent=${agent}`)\n if (!ok) return `Error: ${data.error}`\n if (!data.exists) return \"There is no calendar.md yet. Create it from the calendar template in your content skill.\"\n if (!data.entries.length) return \"Nothing is planned in the next 14 days. Add rows to calendar.md.\"\n return [\"Planned in the next 14 days:\", ...data.entries.map((e: any) => `- ${e.date} ${e.platform}: ${e.topic} (${e.status})`)].join(\"\\n\")\n }\n\n if (action === \"status\") {\n const id = str(args.id)\n if (!id) return \"Error: `id` is required for status (the draft id you got when you raised it).\"\n const { ok, data } = await call(`/content/drafts/${encodeURIComponent(id)}?agent=${agent}`)\n if (!ok) return `Error: ${data.error}`\n const d = data.draft as ContentDraft\n const where = PLATFORM_LABEL[d.platform] ?? d.platform\n switch (d.status) {\n case \"pending\": return `Draft ${d.id} is still waiting for the owner's approval. Nothing has been published.`\n case \"posted\": return `Draft ${d.id} was approved and posted on ${where}${d.url ? `: ${d.url}` : \"\"}.`\n case \"ready\": return `Draft ${d.id} was approved. No ${where} connector is set, so it was saved ready to paste: ${d.file}.`\n case \"rejected\": return `Draft ${d.id}: the owner said no. Nothing was published.`\n default: return `Draft ${d.id} was approved but not posted: ${d.error ?? \"unknown error\"}.`\n }\n }\n\n if (action !== \"draft\") return `Error: unknown action \"${action}\". Use voice, calendar, draft or status.`\n const { ok, data } = await call(\"/content/drafts\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n agent: caller.agentId,\n platform: args.platform,\n text: args.text,\n samples: args.samples,\n topic: args.topic,\n date: args.date,\n }),\n })\n if (!ok) return `Error: ${data.error}`\n const d = data.draft as ContentDraft\n return [\n `Draft ${d.id} is in the owner's Approvals inbox as content:${d.id}. Nothing is published until they say yes.`,\n `It follows: ${d.samples.join(\", \")}.`,\n \"Don't post it yourself and don't ask again in chat. Check it later with {action:\\\"status\\\", id:\\\"\" + d.id + \"\\\"}.\",\n ].join(\" \")\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"4bAkBA,IAAMA,EAAOC,GAAwB,OA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Q,KAAK,IAAI,KAClC,iGAAsGA,EAAE,GAAK,KAC/G,EAAE,KAAK,GAAG,CACZ,OAASF,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["str","v","runContentTool","args","deps","doFetch","base","action","caller","resolveScheduleCaller","agent","call","path","init","res","data","topic","ok","s","e","id","d","where","PLATFORM_LABEL"]}
1
+ {"version":3,"sources":["../src/content/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { PLATFORM_LABEL, type ContentDraft } from \"./drafts\"\n\n// --- Agent-facing `agentx_content` tool ---\n//\n// Lets a content agent find the owner's past posts closest to a topic,\n// read its calendar, raise a draft for approval and check what happened\n// to it. It talks to the daemon's /content endpoints, which never publish:\n// there is no action here that posts anything.\n\nexport type ContentToolAction = \"voice\" | \"calendar\" | \"draft\" | \"status\"\n\nexport interface ContentToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown): string => (typeof v === \"string\" ? v.trim() : \"\")\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runContentTool(args: Record<string, unknown>, deps: ContentToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"draft\").toLowerCase() as ContentToolAction\n const caller = resolveScheduleCaller(args, deps.env ?? process.env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const agent = encodeURIComponent(caller.agentId)\n\n const call = async (path: string, init?: RequestInit): Promise<{ ok: boolean; data: any }> => {\n const res = await doFetch(`${base}${path}`, { ...init, signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({}))\n return { ok: res.ok, data: res.ok ? data : { error: (data as any)?.error || `HTTP ${res.status}` } }\n }\n\n try {\n if (action === \"voice\") {\n const topic = encodeURIComponent(str(args.topic))\n const { ok, data } = await call(`/content/voice?agent=${agent}&topic=${topic}&n=${Number(args.n) || 3}`)\n if (!ok) return `Error: ${data.error}`\n if (!data.total) return \"There are no past posts in voice/ yet. Ask the owner to add a few (one post per .md or .txt file) before you draft.\"\n return [\n `${data.total} past post(s) in voice/. Closest to the topic:`,\n ...data.samples.map((s: any) => `- ${s.file}: ${s.excerpt}`),\n \"Read the whole files before you write, follow their length, tone and habits, and name them in `samples` when you raise the draft.\",\n ].join(\"\\n\")\n }\n\n if (action === \"calendar\") {\n const { ok, data } = await call(`/content/calendar?agent=${agent}`)\n if (!ok) return `Error: ${data.error}`\n if (!data.exists) return \"There is no calendar.md yet. Create it from the calendar template in your content skill.\"\n if (!data.entries.length) return \"Nothing is planned in the next 14 days. Add rows to calendar.md.\"\n return [\"Planned in the next 14 days:\", ...data.entries.map((e: any) => `- ${e.date} ${e.platform}: ${e.topic} (${e.status})`)].join(\"\\n\")\n }\n\n if (action === \"status\") {\n const id = str(args.id)\n if (!id) return \"Error: `id` is required for status (the draft id you got when you raised it).\"\n const { ok, data } = await call(`/content/drafts/${encodeURIComponent(id)}?agent=${agent}`)\n if (!ok) return `Error: ${data.error}`\n const d = data.draft as ContentDraft\n const where = PLATFORM_LABEL[d.platform] ?? d.platform\n switch (d.status) {\n case \"pending\": return `Draft ${d.id} is still waiting for the owner's approval. Nothing has been published.`\n case \"posted\": return `Draft ${d.id} was approved and posted on ${where}${d.url ? `: ${d.url}` : \"\"}.`\n case \"ready\": return `Draft ${d.id} was approved. No ${where} connector is set, so it was saved ready to paste: ${d.file}.`\n case \"rejected\": return `Draft ${d.id}: the owner said no. Nothing was published.`\n default: return `Draft ${d.id} was approved but not posted: ${d.error ?? \"unknown error\"}.`\n }\n }\n\n if (action !== \"draft\") return `Error: unknown action \"${action}\". Use voice, calendar, draft or status.`\n const { ok, data } = await call(\"/content/drafts\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n agent: caller.agentId,\n platform: args.platform,\n text: args.text,\n samples: args.samples,\n topic: args.topic,\n date: args.date,\n }),\n })\n if (!ok) return `Error: ${data.error}`\n const d = data.draft as ContentDraft\n return [\n `Draft ${d.id} is in the owner's Approvals inbox as content:${d.id}. Nothing is published until they say yes.`,\n `It follows: ${d.samples.join(\", \")}.`,\n \"Don't post it yourself and don't ask again in chat. Check it later with {action:\\\"status\\\", id:\\\"\" + d.id + \"\\\"}.\",\n ].join(\" \")\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"gaAkBA,IAAMA,EAAOC,GAAwB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAGxE,eAAsBC,EAAeC,EAA+BC,EAAwC,CAC1G,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,GAAUP,EAAIG,EAAK,MAAM,GAAK,SAAS,YAAY,EACnDK,EAASC,EAAsBN,EAAMC,EAAK,KAAO,QAAQ,GAAG,EAClE,GAAI,CAACI,EAAQ,MAAO,gEACpB,IAAME,EAAQ,mBAAmBF,EAAO,OAAO,EAEzCG,EAAO,MAAOC,EAAcC,IAA4D,CAC5F,IAAMC,EAAM,MAAMT,EAAQ,GAAGC,IAAOM,IAAQ,CAAE,GAAGC,EAAM,OAAQ,YAAY,QAAQ,GAAM,CAAE,CAAC,EACtFE,EAAO,MAAMD,EAAI,KAAK,EAAE,MAAM,KAAO,CAAC,EAAE,EAC9C,MAAO,CAAE,GAAIA,EAAI,GAAI,KAAMA,EAAI,GAAKC,EAAO,CAAE,MAAQA,GAAc,OAAS,QAAQD,EAAI,QAAS,CAAE,CACrG,EAEA,GAAI,CACF,GAAIP,IAAW,QAAS,CACtB,IAAMS,EAAQ,mBAAmBhB,EAAIG,EAAK,KAAK,CAAC,EAC1C,CAAE,GAAAc,EAAI,KAAAF,CAAK,EAAI,MAAMJ,EAAK,wBAAwBD,WAAeM,OAAW,OAAOb,EAAK,CAAC,GAAK,GAAG,EACvG,OAA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kBAAmB,CACjD,OAAQ,OACR,QAAS,CAAE,eAAgB,kBAAmB,EAC9C,KAAM,KAAK,UAAU,CACnB,MAAOH,EAAO,QACd,SAAUL,EAAK,SACf,KAAMA,EAAK,KACX,QAASA,EAAK,QACd,MAAOA,EAAK,MACZ,KAAMA,EAAK,IACb,CAAC,CACH,CAAC,EACD,GAAI,CAACc,EAAI,MAAO,UAAUF,EAAK,QAC/B,IAAMM,EAAIN,EAAK,MACf,MAAO,CACL,SAASM,EAAE,mDAAmDA,EAAE,+CAChE,eAAeA,EAAE,QAAQ,KAAK,IAAI,KAClC,iGAAsGA,EAAE,GAAK,KAC/G,EAAE,KAAK,GAAG,CACZ,OAASF,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["str","v","runContentTool","args","deps","doFetch","base","action","caller","resolveScheduleCaller","agent","call","path","init","res","data","topic","ok","s","e","id","d","where","PLATFORM_LABEL"]}
@@ -1,4 +1,4 @@
1
- import{b as y}from"./chunk-UUOCCLIL.js";import"./chunk-RKPAVWXF.js";import{i as v,r as S}from"./chunk-35UGFFHA.js";import{b}from"./chunk-CSC45PA7.js";import{d as T,e as m}from"./chunk-QPABR72X.js";import{b as g}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-H4DWZIU7.js";import"./chunk-CAH6TNC6.js";import"./chunk-N476XZD3.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-KAM4ZWRE.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-YSCT6DPR.js";import"./chunk-VQRY4IDI.js";import"./chunk-QIJLFPWE.js";var C=45e3,f=e=>typeof e=="string"?e.trim():"",I={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"};function x(e){return e.length?e.map(t=>{let a=new Date(t.createdAt).toISOString().slice(0,16).replace("T"," "),n=t.state==="waiting_owner"&&t.question?` Question: ${t.question}`:t.state==="needs_attention"&&t.attentionReason?` ${t.attentionReason}`:"",s=String(t.text).replace(/\s+/g," ").trim(),l=[t.promise&&t.owedTo?` Promised to ${t.owedTo}.`:"",t.dueAt?` Due ${new Date(t.dueAt).toISOString().slice(0,16).replace("T"," ")} UTC.`:"",t.closeWhen?` Closes on its check (${t.closeWhen.kind})${t.verifyState?`: ${t.verifyState}`:""}.`:"",T(t)?" Awaiting QA.":t.qa?` QA: ${m(t.qa)}.`:"",t.goal?` Goal: ${t.goal.title} (${t.goal.id}).`:""].join("");return`- ${t.id} [${I[t.state]??t.state}] ${a} UTC, ${t.channel}, ${t.agentId}: ${s.length>160?`${s.slice(0,159)}\u2026`:s}.${n}${l}`}).join(`
1
+ import{d as y}from"./chunk-O2YDS2P3.js";import{j as v,s as S}from"./chunk-5FFNFW4C.js";import{b}from"./chunk-IP67DTXX.js";import{d as T,e as m}from"./chunk-QPABR72X.js";import{b as g}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var C=45e3,f=e=>typeof e=="string"?e.trim():"",I={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"};function x(e){return e.length?e.map(t=>{let a=new Date(t.createdAt).toISOString().slice(0,16).replace("T"," "),n=t.state==="waiting_owner"&&t.question?` Question: ${t.question}`:t.state==="needs_attention"&&t.attentionReason?` ${t.attentionReason}`:"",s=String(t.text).replace(/\s+/g," ").trim(),l=[t.promise&&t.owedTo?` Promised to ${t.owedTo}.`:"",t.dueAt?` Due ${new Date(t.dueAt).toISOString().slice(0,16).replace("T"," ")} UTC.`:"",t.closeWhen?` Closes on its check (${t.closeWhen.kind})${t.verifyState?`: ${t.verifyState}`:""}.`:"",T(t)?" Awaiting QA.":t.qa?` QA: ${m(t.qa)}.`:"",t.goal?` Goal: ${t.goal.title} (${t.goal.id}).`:""].join("");return`- ${t.id} [${I[t.state]??t.state}] ${a} UTC, ${t.channel}, ${t.agentId}: ${s.length>160?`${s.slice(0,159)}\u2026`:s}.${n}${l}`}).join(`
2
2
  `):"No open requests."}function A(e){return`$${e>0&&e<.01?e.toFixed(3):e.toFixed(2)}`}function j(e,t=[]){if(!e.length)return"No request names a goal.";let a=new Map(t.map(n=>[n.id,n]));return e.map(n=>{let s=n.progress===null?"nothing open or done":`${Math.round(n.progress*100)}% done`,l=n.unpriced?`, ${n.unpriced} of ${n.runs} runs without a cost`:"",d=a.get(n.id),$=d?` [${d.state}${d.ownerAgent?`, owner ${d.ownerAgent}`:""}]`:"";return`- ${n.id} "${d?.title??n.title}"${$}: ${n.open} open, ${n.done} done${n.dropped?`, ${n.dropped} declined or dropped`:""} (${s}). Cost ${A(n.costUsd)}${l}.`}).join(`
3
3
  `)}function k(e){let t=e.check?` Check: ${v(e.check)}${e.lastCheck?` (last: ${e.lastCheck})`:""}.`:"",a=e.state!=="active"&&e.evidence?` Closed: ${e.evidence}.`:"";return`${e.id} "${e.title}" [${e.state}${e.ownerAgent?`, owner ${e.ownerAgent}`:""}].${e.doneWhen?` Done when: ${e.doneWhen}.`:""}${t}${a}`}async function G(e,t,a,n){let s=(f(e.goalAction)||"show").toLowerCase(),l=e.goal&&typeof e.goal=="object"?e.goal:null,d=f(e.id)||f(l?.id);if(s==="show"){if(!d)return"Error: show needs id: the goal's id (goals lists them).";let i=await n(`${a}/requests/goals/${encodeURIComponent(d)}`,{signal:AbortSignal.timeout(1e4)}),u=await i.json().catch(()=>({}));if(!i.ok)return`Error: ${u?.error||`HTTP ${i.status}`}`;let h=u.summary;return[u.goal?k(u.goal):`${d} has no record yet: it is a label on its requests. Make one with goalAction create.`,h?`Requests: ${h.open} open, ${h.done} done${h.dropped?`, ${h.dropped} declined or dropped`:""}. Cost ${A(h.costUsd)}.`:"No request names it yet."].join(`
4
4
  `)}let $=t.env??process.env,c=y(e,$);if(!c)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let o=await n(`${a}/requests/goals`,{method:"POST",headers:{"Content-Type":"application/json",...g($)},body:JSON.stringify({action:s,agentId:c.agentId,id:d,goal:e.goal,doneWhen:e.doneWhen,check:e.check??e.closeWhen,evidence:e.evidence,reason:e.reason}),signal:AbortSignal.timeout(1e4)}),p=await o.json().catch(()=>({}));if(!o.ok)return`Error: ${p?.error||`HTTP ${o.status}`}`;let r=p.goal;return s==="create"?`Goal ${o.status===201?"made":"updated"}: ${k(r)}${r.check?" The daemon runs its check and closes it when it is met.":` Close it with {action:"goal", goalAction:"close", id:"${r.id}", evidence:"<link>"} when it is reached.`} A cron with goal "${r.id}" stops running once it is closed.`:`Goal ${r.id} is ${r.state}. Crons that name it no longer run.`}function R(e){return(e??[]).map(t=>`${t.idx}. ${t.name} (${t.agentId}, ${t.kind}) [${t.state}]${t.needsApproval?` approval: ${t.approval}`:""}${b(t)}`)}async function D(e,t){let a=t.fetch??fetch,n=t.daemonUrl.replace(/\/$/,""),s=(f(e.action)||"list").toLowerCase();try{if(s==="goals"){let r=await a(`${n}/requests/goals`,{signal:AbortSignal.timeout(1e4)}),i=await r.json().catch(()=>({}));if(!r.ok)return`Error: ${i?.error||`HTTP ${r.status}`}`;let u=i.records??[],h=new Set((i.goals??[]).map(w=>w.id)),q=u.filter(w=>!h.has(w.id));return[`${i.count} goal${i.count===1?"":"s"}, most recently active first.
@@ -7,4 +7,4 @@ ${j(i.goals??[],u)}`,...q.length?["Goal records no request names yet:",...q.map(
7
7
  ${x(i.items??[])}`:"Requests are turned off on this node (requests.enabled), so nothing is recorded.":`Error: ${i?.error||`HTTP ${r.status}`}`}let l=t.env??process.env,d=y(e,l);if(!d)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let $=await a(`${n}/requests`,{method:"POST",headers:{"Content-Type":"application/json",...g(l)},body:JSON.stringify({action:s,agentId:d.agentId,id:e.id,question:e.question,evidence:e.evidence,proof:e.proof,reason:e.reason,steps:e.steps,work:e.work,estimateMinutes:e.estimateMinutes,step:e.step,status:e.status,note:e.note,waitUntil:e.waitUntil,home:e.home,owedTo:e.owedTo,text:e.text,due:e.due,closeWhen:e.closeWhen,headline:e.headline,need:e.need,needsQa:e.needsQa,verdict:e.verdict,goal:e.goal}),signal:AbortSignal.timeout(s==="done"?C:1e4)}),c=await $.json().catch(()=>({}));if(!$.ok)return`Error: ${c?.error||`HTTP ${$.status}`}`;let o=c.request,p=o.goal?` It serves the goal "${o.goal.title}" (${o.goal.id}).`:"";if(s==="accept"&&c.plan)return[`Request ${o.id} is open with a plan of ${c.steps.length} steps.${p} The daemon hands each step to its agent in order, nudges a step that goes quiet, and tells the owner when it is finished or blocked.`,...R(c.steps),`Steps the owner approves get a decision card now; an approved message is sent by the daemon itself. Report your own steps with {action:"step", id:"${o.id}", step:<n>, status:"progress"|"done"|"blocked"}.`].join(`
8
8
  `);if(s==="step")return[`Step reported. Plan of ${o.id}:`,...R(c.steps)].join(`
9
9
  `);if(s==="qa")return`Verdict recorded on ${o.id}: ${m(o.qa)}. It shows on the request's card; nobody is told.`;if(s==="describe")return`Request ${o.id} now reads "${o.headline??"(no headline)"}" on the owner's cards. Needed from them: ${o.need??"what follows from where it stands"}.`;if(s==="accept")return`Request ${o.id} is open and in progress.${p} Close it with done (and a link to the evidence) or decline (and the reason); it stays on the owner's list until then.`;if(s==="wait")return`Request ${o.id} is waiting on the owner with your question. Ask them the question now, once.`;if(s==="promise")return`Promise ${o.id} is open, owed to ${o.owedTo}${o.dueAt?`, due ${new Date(o.dueAt).toISOString().slice(0,16).replace("T"," ")} UTC`:""}. `+(o.closeWhen?"The daemon checks its evidence and closes it once the check is met.":`Close it with {action:"done", id:"${o.id}", evidence:"<link>"} when it is kept.`);if(s==="done"&&c.verify==="unverified")return`Request ${o.id} stays open: its check could not say whether it is finished (${c.detail}). It is marked unverified; the daemon checks again, and the owner can close it by hand.`;if(s==="done"){let r=o.factId?` It left fact ${o.factId} in the wiki (agentx wiki facts show ${o.factId}).`:"";return`Request ${o.id} is closed as done${c.verified?" (its check was met)":""}. Evidence: ${o.evidence}${r}`}return`Request ${o.id} is closed as declined. Reason: ${o.closeReason}`}catch(l){return`Error: couldn't reach the daemon (${l?.message??l}).`}}export{C as DONE_TIMEOUT_MS,k as describeGoalRecord,j as describeGoals,x as describeOpen,R as describeSteps,D as runRequestTool,A as usd};
10
- //# sourceMappingURL=tool-ZCSGJ2ZF.js.map
10
+ //# sourceMappingURL=tool-HUOT3I42.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/requests/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\nimport { awaitingQa, describeQa } from \"./qa\"\nimport type { GoalSummary } from \"./goals\"\nimport { describeGoalCheck, type GoalRecord } from \"./goal-store\"\nimport { describeFlow } from \"./flow\"\nimport { waitsText } from \"./plan-store\"\n\n// --- Agent-facing `agentx_request` tool (#356) ---\n//\n// Lets an agent say what it is doing with the owner's request, so the\n// request stays visible until it is closed:\n// accept I am taking this on; keep it open after this turn. With\n// `steps` (two or more): a tracked plan the daemon follows (#788).\n// `work` and `estimateMinutes` say what it is: code work or a\n// long estimate is refused without steps (#1048). `goal`\n// names the goal it serves (#1168)\n// step report on one step of a plan: progress, done, blocked\n// wait the next step is the owner's answer to this question\n// done finished, with a link to the evidence, or a typed proof\n// (link, test, output, check; #1138 D). On a loop with a\n// closeWhen the daemon runs its check first (#1039). A promise\n// closed with a proof leaves a dated wiki fact\n// decline I will not do it, with the reason\n// promise I owe someone something (owedTo, text, due, closeWhen):\n// an open loop of its own, listed with the open requests\n// describe what it is (headline) and what is needed from the owner\n// (need), for every card, push and Desk line (#1126). accept,\n// wait and promise take the two as well\n// qa a QA verdict on a request (#1188): block, risk or pass, with\n// a note. accept, wait, promise and describe take needsQa to\n// ask for one\n// list what is still open\n// goals every goal requests name: progress and cost (#1168)\n// goal one goal record (#1568): goalAction show (default), create\n// (goal {id, title}, doneWhen, check), close (evidence) or\n// drop (reason). A goal with a check closes by itself when it\n// is met; a cron that names it stops running then\n// flow the daily flow rate: today's, then one line per day (#1542)\n// It talks to the daemon's /requests endpoints. Dropping a request is the\n// owner's alone; there is no action for it here.\n\nexport interface RequestToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\n/** A done on a loop with a check waits for it: the slowest is an issue\n * check, three forge calls of up to 10 s each. */\nexport const DONE_TIMEOUT_MS = 45_000\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\nconst STATE_WORDS: Record<string, string> = {\n in_progress: \"in progress\",\n waiting_owner: \"waiting on the owner\",\n waiting_other: \"waiting on another agent\",\n needs_attention: \"needs attention\",\n}\n\n/** One line per open request, oldest first. */\nexport function describeOpen(items: any[]): string {\n if (!items.length) return \"No open requests.\"\n return items.map((r) => {\n const when = new Date(r.createdAt).toISOString().slice(0, 16).replace(\"T\", \" \")\n const extra = r.state === \"waiting_owner\" && r.question ? ` Question: ${r.question}`\n : r.state === \"needs_attention\" && r.attentionReason ? ` ${r.attentionReason}` : \"\"\n const words = String(r.text).replace(/\\s+/g, \" \").trim()\n const loop = [\n r.promise && r.owedTo ? ` Promised to ${r.owedTo}.` : \"\",\n r.dueAt ? ` Due ${new Date(r.dueAt).toISOString().slice(0, 16).replace(\"T\", \" \")} UTC.` : \"\",\n r.closeWhen ? ` Closes on its check (${r.closeWhen.kind})${r.verifyState ? `: ${r.verifyState}` : \"\"}.` : \"\",\n awaitingQa(r) ? \" Awaiting QA.\" : r.qa ? ` QA: ${describeQa(r.qa)}.` : \"\",\n r.goal ? ` Goal: ${r.goal.title} (${r.goal.id}).` : \"\",\n ].join(\"\")\n return `- ${r.id} [${STATE_WORDS[r.state] ?? r.state}] ${when} UTC, ${r.channel}, ${r.agentId}: ${words.length > 160 ? `${words.slice(0, 159)}…` : words}.${extra}${loop}`\n }).join(\"\\n\")\n}\n\n/** Dollars, to the cent; under a cent, to the tenth of one. */\nexport function usd(n: number): string {\n return `$${n > 0 && n < 0.01 ? n.toFixed(3) : n.toFixed(2)}`\n}\n\n/** One line per goal, most recently active first (#1168). */\nexport function describeGoals(goals: GoalSummary[], records: GoalRecord[] = []): string {\n if (!goals.length) return \"No request names a goal.\"\n const byId = new Map(records.map((g) => [g.id, g]))\n return goals.map((g) => {\n const far = g.progress === null ? \"nothing open or done\" : `${Math.round(g.progress * 100)}% done`\n const unpriced = g.unpriced ? `, ${g.unpriced} of ${g.runs} runs without a cost` : \"\"\n const rec = byId.get(g.id)\n const state = rec ? ` [${rec.state}${rec.ownerAgent ? `, owner ${rec.ownerAgent}` : \"\"}]` : \"\"\n return `- ${g.id} \"${rec?.title ?? g.title}\"${state}: ${g.open} open, ${g.done} done${g.dropped ? `, ${g.dropped} declined or dropped` : \"\"} (${far}). Cost ${usd(g.costUsd)}${unpriced}.`\n }).join(\"\\n\")\n}\n\n/** One goal record in a line (#1568). */\nexport function describeGoalRecord(g: GoalRecord): string {\n const check = g.check ? ` Check: ${describeGoalCheck(g.check)}${g.lastCheck ? ` (last: ${g.lastCheck})` : \"\"}.` : \"\"\n const closed = g.state !== \"active\" && g.evidence ? ` Closed: ${g.evidence}.` : \"\"\n return `${g.id} \"${g.title}\" [${g.state}${g.ownerAgent ? `, owner ${g.ownerAgent}` : \"\"}].${g.doneWhen ? ` Done when: ${g.doneWhen}.` : \"\"}${check}${closed}`\n}\n\nasync function goalTool(args: Record<string, unknown>, deps: RequestToolDeps, base: string, doFetch: typeof fetch): Promise<string> {\n const op = (str(args.goalAction) || \"show\").toLowerCase()\n const goalArg = args.goal && typeof args.goal === \"object\" ? args.goal as Record<string, unknown> : null\n const id = str(args.id) || str(goalArg?.id)\n if (op === \"show\") {\n if (!id) return \"Error: show needs id: the goal's id (goals lists them).\"\n const res = await doFetch(`${base}/requests/goals/${encodeURIComponent(id)}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const s = data.summary as GoalSummary | null\n return [\n data.goal ? describeGoalRecord(data.goal) : `${id} has no record yet: it is a label on its requests. Make one with goalAction create.`,\n s ? `Requests: ${s.open} open, ${s.done} done${s.dropped ? `, ${s.dropped} declined or dropped` : \"\"}. Cost ${usd(s.costUsd)}.` : \"No request names it yet.\",\n ].join(\"\\n\")\n }\n const env = deps.env ?? process.env\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/requests/goals`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action: op, agentId: caller.agentId, id, goal: args.goal, doneWhen: args.doneWhen,\n check: args.check ?? args.closeWhen, evidence: args.evidence, reason: args.reason,\n }),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const g = data.goal as GoalRecord\n if (op === \"create\") {\n return `Goal ${res.status === 201 ? \"made\" : \"updated\"}: ${describeGoalRecord(g)}${g.check ? \" The daemon runs its check and closes it when it is met.\" : ` Close it with {action:\"goal\", goalAction:\"close\", id:\"${g.id}\", evidence:\"<link>\"} when it is reached.`} A cron with goal \"${g.id}\" stops running once it is closed.`\n }\n return `Goal ${g.id} is ${g.state}. Crons that name it no longer run.`\n}\n\n/** One line per plan step. */\nexport function describeSteps(steps: any[]): string[] {\n return (steps ?? []).map((s) => `${s.idx}. ${s.name} (${s.agentId}, ${s.kind}) [${s.state}]${s.needsApproval ? ` approval: ${s.approval}` : \"\"}${waitsText(s)}`)\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runRequestTool(args: Record<string, unknown>, deps: RequestToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n\n try {\n if (action === \"goals\") {\n const res = await doFetch(`${base}/requests/goals`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const records: GoalRecord[] = data.records ?? []\n const named = new Set((data.goals ?? []).map((g: GoalSummary) => g.id))\n const bare = records.filter((g) => !named.has(g.id))\n return [\n `${data.count} goal${data.count === 1 ? \"\" : \"s\"}, most recently active first.\\n${describeGoals(data.goals ?? [], records)}`,\n ...(bare.length ? [\"Goal records no request names yet:\", ...bare.map((g) => `- ${describeGoalRecord(g)}`)] : []),\n ].join(\"\\n\")\n }\n\n if (action === \"goal\") return await goalTool(args, deps, base, doFetch)\n\n if (action === \"flow\") {\n const days = typeof args.days === \"number\" ? `?days=${Math.floor(args.days)}` : \"\"\n const res = await doFetch(`${base}/requests/flow${days}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (!data.enabled) return \"Requests are turned off on this node (requests.enabled), so nothing is recorded.\"\n return describeFlow(data)\n }\n\n if (action === \"list\") {\n const res = await doFetch(`${base}/requests`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (!data.enabled) return \"Requests are turned off on this node (requests.enabled), so nothing is recorded.\"\n return `${data.count} open request${data.count === 1 ? \"\" : \"s\"}, oldest first.\\n${describeOpen(data.items ?? [])}`\n }\n\n const env = deps.env ?? process.env\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/requests`, {\n method: \"POST\",\n // The headers name this run: the daemon refuses a write that does\n // not come from a running turn of the agent.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n id: args.id, question: args.question, evidence: args.evidence, proof: args.proof, reason: args.reason,\n steps: args.steps, work: args.work, estimateMinutes: args.estimateMinutes, step: args.step, status: args.status, note: args.note, waitUntil: args.waitUntil, home: args.home,\n owedTo: args.owedTo, text: args.text, due: args.due, closeWhen: args.closeWhen,\n headline: args.headline, need: args.need, needsQa: args.needsQa, verdict: args.verdict, goal: args.goal,\n }),\n signal: AbortSignal.timeout(action === \"done\" ? DONE_TIMEOUT_MS : 10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const r = data.request\n const serves = r.goal ? ` It serves the goal \"${r.goal.title}\" (${r.goal.id}).` : \"\"\n if (action === \"accept\" && data.plan) {\n return [\n `Request ${r.id} is open with a plan of ${data.steps.length} steps.${serves} The daemon hands each step to its agent in order, nudges a step that goes quiet, and tells the owner when it is finished or blocked.`,\n ...describeSteps(data.steps),\n `Steps the owner approves get a decision card now; an approved message is sent by the daemon itself. Report your own steps with {action:\"step\", id:\"${r.id}\", step:<n>, status:\"progress\"|\"done\"|\"blocked\"}.`,\n ].join(\"\\n\")\n }\n if (action === \"step\") return [`Step reported. Plan of ${r.id}:`, ...describeSteps(data.steps)].join(\"\\n\")\n if (action === \"qa\") return `Verdict recorded on ${r.id}: ${describeQa(r.qa)}. It shows on the request's card; nobody is told.`\n if (action === \"describe\") return `Request ${r.id} now reads \"${r.headline ?? \"(no headline)\"}\" on the owner's cards. Needed from them: ${r.need ?? \"what follows from where it stands\"}.`\n if (action === \"accept\") return `Request ${r.id} is open and in progress.${serves} Close it with done (and a link to the evidence) or decline (and the reason); it stays on the owner's list until then.`\n if (action === \"wait\") return `Request ${r.id} is waiting on the owner with your question. Ask them the question now, once.`\n if (action === \"promise\") {\n return `Promise ${r.id} is open, owed to ${r.owedTo}${r.dueAt ? `, due ${new Date(r.dueAt).toISOString().slice(0, 16).replace(\"T\", \" \")} UTC` : \"\"}. ` +\n (r.closeWhen ? \"The daemon checks its evidence and closes it once the check is met.\" : `Close it with {action:\"done\", id:\"${r.id}\", evidence:\"<link>\"} when it is kept.`)\n }\n if (action === \"done\" && data.verify === \"unverified\") {\n return `Request ${r.id} stays open: its check could not say whether it is finished (${data.detail}). It is marked unverified; the daemon checks again, and the owner can close it by hand.`\n }\n if (action === \"done\") {\n const fact = r.factId ? ` It left fact ${r.factId} in the wiki (agentx wiki facts show ${r.factId}).` : \"\"\n return `Request ${r.id} is closed as done${data.verified ? \" (its check was met)\" : \"\"}. Evidence: ${r.evidence}${fact}`\n }\n return `Request ${r.id} is closed as declined. Reason: ${r.closeReason}`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"ylBAkDO,IAAMA,EAAkB,KAEzBC,EAAOC,GAAgB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAE1DC,EAAsC,CAC1C,YAAa,cACb,cAAe,uBACf,cAAe,2BACf,gBAAiB,iBACnB,EAGO,SAASC,EAAaC,EAAsB,CACjD,OAAKA,EAAM,OACJA,EAAM,IAAKC,GAAM,CACtB,IAAMC,EAAO,IAAI,KAAKD,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,IAAK,GAAG,EACxEE,EAAQF,EAAE,QAAU,iBAAmBA,EAAE,SAAW,cAAcA,EAAE,WACtEA,EAAE,QAAU,mBAAqBA,EAAE,gBAAkB,IAAIA,EAAE,kBAAoB,GAC7EG,EAAQ,OAAOH,EAAE,IAAI,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EACjDI,EAAO,CACXJ,EAAE,SAAWA,EAAE,OAAS,gBAAgBA,EAAE,UAAY,GACtDA,EAAE,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IAEpH,MAAO,WAAW/C,EAAE,qCAAqCA,EAAE,aAC7D,OAASgD,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["DONE_TIMEOUT_MS","str","v","STATE_WORDS","describeOpen","items","r","when","extra","words","loop","awaitingQa","describeQa","usd","n","describeGoals","goals","records","byId","g","far","unpriced","rec","state","describeGoalRecord","check","describeGoalCheck","closed","goalTool","args","deps","base","doFetch","op","goalArg","id","res","data","s","env","caller","resolveScheduleCaller","callerHeaders","describeSteps","steps","waitsText","runRequestTool","action","named","bare","days","describeFlow","serves","fact","e"]}
1
+ {"version":3,"sources":["../src/requests/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\nimport { callerHeaders } from \"@/calls/service\"\nimport { awaitingQa, describeQa } from \"./qa\"\nimport type { GoalSummary } from \"./goals\"\nimport { describeGoalCheck, type GoalRecord } from \"./goal-store\"\nimport { describeFlow } from \"./flow\"\nimport { waitsText } from \"./plan-store\"\n\n// --- Agent-facing `agentx_request` tool (#356) ---\n//\n// Lets an agent say what it is doing with the owner's request, so the\n// request stays visible until it is closed:\n// accept I am taking this on; keep it open after this turn. With\n// `steps` (two or more): a tracked plan the daemon follows (#788).\n// `work` and `estimateMinutes` say what it is: code work or a\n// long estimate is refused without steps (#1048). `goal`\n// names the goal it serves (#1168)\n// step report on one step of a plan: progress, done, blocked\n// wait the next step is the owner's answer to this question\n// done finished, with a link to the evidence, or a typed proof\n// (link, test, output, check; #1138 D). On a loop with a\n// closeWhen the daemon runs its check first (#1039). A promise\n// closed with a proof leaves a dated wiki fact\n// decline I will not do it, with the reason\n// promise I owe someone something (owedTo, text, due, closeWhen):\n// an open loop of its own, listed with the open requests\n// describe what it is (headline) and what is needed from the owner\n// (need), for every card, push and Desk line (#1126). accept,\n// wait and promise take the two as well\n// qa a QA verdict on a request (#1188): block, risk or pass, with\n// a note. accept, wait, promise and describe take needsQa to\n// ask for one\n// list what is still open\n// goals every goal requests name: progress and cost (#1168)\n// goal one goal record (#1568): goalAction show (default), create\n// (goal {id, title}, doneWhen, check), close (evidence) or\n// drop (reason). A goal with a check closes by itself when it\n// is met; a cron that names it stops running then\n// flow the daily flow rate: today's, then one line per day (#1542)\n// It talks to the daemon's /requests endpoints. Dropping a request is the\n// owner's alone; there is no action for it here.\n\nexport interface RequestToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\n/** A done on a loop with a check waits for it: the slowest is an issue\n * check, three forge calls of up to 10 s each. */\nexport const DONE_TIMEOUT_MS = 45_000\n\nconst str = (v: unknown) => (typeof v === \"string\" ? v.trim() : \"\")\n\nconst STATE_WORDS: Record<string, string> = {\n in_progress: \"in progress\",\n waiting_owner: \"waiting on the owner\",\n waiting_other: \"waiting on another agent\",\n needs_attention: \"needs attention\",\n}\n\n/** One line per open request, oldest first. */\nexport function describeOpen(items: any[]): string {\n if (!items.length) return \"No open requests.\"\n return items.map((r) => {\n const when = new Date(r.createdAt).toISOString().slice(0, 16).replace(\"T\", \" \")\n const extra = r.state === \"waiting_owner\" && r.question ? ` Question: ${r.question}`\n : r.state === \"needs_attention\" && r.attentionReason ? ` ${r.attentionReason}` : \"\"\n const words = String(r.text).replace(/\\s+/g, \" \").trim()\n const loop = [\n r.promise && r.owedTo ? ` Promised to ${r.owedTo}.` : \"\",\n r.dueAt ? ` Due ${new Date(r.dueAt).toISOString().slice(0, 16).replace(\"T\", \" \")} UTC.` : \"\",\n r.closeWhen ? ` Closes on its check (${r.closeWhen.kind})${r.verifyState ? `: ${r.verifyState}` : \"\"}.` : \"\",\n awaitingQa(r) ? \" Awaiting QA.\" : r.qa ? ` QA: ${describeQa(r.qa)}.` : \"\",\n r.goal ? ` Goal: ${r.goal.title} (${r.goal.id}).` : \"\",\n ].join(\"\")\n return `- ${r.id} [${STATE_WORDS[r.state] ?? r.state}] ${when} UTC, ${r.channel}, ${r.agentId}: ${words.length > 160 ? `${words.slice(0, 159)}…` : words}.${extra}${loop}`\n }).join(\"\\n\")\n}\n\n/** Dollars, to the cent; under a cent, to the tenth of one. */\nexport function usd(n: number): string {\n return `$${n > 0 && n < 0.01 ? n.toFixed(3) : n.toFixed(2)}`\n}\n\n/** One line per goal, most recently active first (#1168). */\nexport function describeGoals(goals: GoalSummary[], records: GoalRecord[] = []): string {\n if (!goals.length) return \"No request names a goal.\"\n const byId = new Map(records.map((g) => [g.id, g]))\n return goals.map((g) => {\n const far = g.progress === null ? \"nothing open or done\" : `${Math.round(g.progress * 100)}% done`\n const unpriced = g.unpriced ? `, ${g.unpriced} of ${g.runs} runs without a cost` : \"\"\n const rec = byId.get(g.id)\n const state = rec ? ` [${rec.state}${rec.ownerAgent ? `, owner ${rec.ownerAgent}` : \"\"}]` : \"\"\n return `- ${g.id} \"${rec?.title ?? g.title}\"${state}: ${g.open} open, ${g.done} done${g.dropped ? `, ${g.dropped} declined or dropped` : \"\"} (${far}). Cost ${usd(g.costUsd)}${unpriced}.`\n }).join(\"\\n\")\n}\n\n/** One goal record in a line (#1568). */\nexport function describeGoalRecord(g: GoalRecord): string {\n const check = g.check ? ` Check: ${describeGoalCheck(g.check)}${g.lastCheck ? ` (last: ${g.lastCheck})` : \"\"}.` : \"\"\n const closed = g.state !== \"active\" && g.evidence ? ` Closed: ${g.evidence}.` : \"\"\n return `${g.id} \"${g.title}\" [${g.state}${g.ownerAgent ? `, owner ${g.ownerAgent}` : \"\"}].${g.doneWhen ? ` Done when: ${g.doneWhen}.` : \"\"}${check}${closed}`\n}\n\nasync function goalTool(args: Record<string, unknown>, deps: RequestToolDeps, base: string, doFetch: typeof fetch): Promise<string> {\n const op = (str(args.goalAction) || \"show\").toLowerCase()\n const goalArg = args.goal && typeof args.goal === \"object\" ? args.goal as Record<string, unknown> : null\n const id = str(args.id) || str(goalArg?.id)\n if (op === \"show\") {\n if (!id) return \"Error: show needs id: the goal's id (goals lists them).\"\n const res = await doFetch(`${base}/requests/goals/${encodeURIComponent(id)}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const s = data.summary as GoalSummary | null\n return [\n data.goal ? describeGoalRecord(data.goal) : `${id} has no record yet: it is a label on its requests. Make one with goalAction create.`,\n s ? `Requests: ${s.open} open, ${s.done} done${s.dropped ? `, ${s.dropped} declined or dropped` : \"\"}. Cost ${usd(s.costUsd)}.` : \"No request names it yet.\",\n ].join(\"\\n\")\n }\n const env = deps.env ?? process.env\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/requests/goals`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action: op, agentId: caller.agentId, id, goal: args.goal, doneWhen: args.doneWhen,\n check: args.check ?? args.closeWhen, evidence: args.evidence, reason: args.reason,\n }),\n signal: AbortSignal.timeout(10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const g = data.goal as GoalRecord\n if (op === \"create\") {\n return `Goal ${res.status === 201 ? \"made\" : \"updated\"}: ${describeGoalRecord(g)}${g.check ? \" The daemon runs its check and closes it when it is met.\" : ` Close it with {action:\"goal\", goalAction:\"close\", id:\"${g.id}\", evidence:\"<link>\"} when it is reached.`} A cron with goal \"${g.id}\" stops running once it is closed.`\n }\n return `Goal ${g.id} is ${g.state}. Crons that name it no longer run.`\n}\n\n/** One line per plan step. */\nexport function describeSteps(steps: any[]): string[] {\n return (steps ?? []).map((s) => `${s.idx}. ${s.name} (${s.agentId}, ${s.kind}) [${s.state}]${s.needsApproval ? ` approval: ${s.approval}` : \"\"}${waitsText(s)}`)\n}\n\n/** Returns the text the agent sees. Every refusal is text, never a throw. */\nexport async function runRequestTool(args: Record<string, unknown>, deps: RequestToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const action = (str(args.action) || \"list\").toLowerCase()\n\n try {\n if (action === \"goals\") {\n const res = await doFetch(`${base}/requests/goals`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const records: GoalRecord[] = data.records ?? []\n const named = new Set((data.goals ?? []).map((g: GoalSummary) => g.id))\n const bare = records.filter((g) => !named.has(g.id))\n return [\n `${data.count} goal${data.count === 1 ? \"\" : \"s\"}, most recently active first.\\n${describeGoals(data.goals ?? [], records)}`,\n ...(bare.length ? [\"Goal records no request names yet:\", ...bare.map((g) => `- ${describeGoalRecord(g)}`)] : []),\n ].join(\"\\n\")\n }\n\n if (action === \"goal\") return await goalTool(args, deps, base, doFetch)\n\n if (action === \"flow\") {\n const days = typeof args.days === \"number\" ? `?days=${Math.floor(args.days)}` : \"\"\n const res = await doFetch(`${base}/requests/flow${days}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (!data.enabled) return \"Requests are turned off on this node (requests.enabled), so nothing is recorded.\"\n return describeFlow(data)\n }\n\n if (action === \"list\") {\n const res = await doFetch(`${base}/requests`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n if (!data.enabled) return \"Requests are turned off on this node (requests.enabled), so nothing is recorded.\"\n return `${data.count} open request${data.count === 1 ? \"\" : \"s\"}, oldest first.\\n${describeOpen(data.items ?? [])}`\n }\n\n const env = deps.env ?? process.env\n const caller = resolveScheduleCaller(args, env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const res = await doFetch(`${base}/requests`, {\n method: \"POST\",\n // The headers name this run: the daemon refuses a write that does\n // not come from a running turn of the agent.\n headers: { \"Content-Type\": \"application/json\", ...callerHeaders(env) },\n body: JSON.stringify({\n action, agentId: caller.agentId,\n id: args.id, question: args.question, evidence: args.evidence, proof: args.proof, reason: args.reason,\n steps: args.steps, work: args.work, estimateMinutes: args.estimateMinutes, step: args.step, status: args.status, note: args.note, waitUntil: args.waitUntil, home: args.home,\n owedTo: args.owedTo, text: args.text, due: args.due, closeWhen: args.closeWhen,\n headline: args.headline, need: args.need, needsQa: args.needsQa, verdict: args.verdict, goal: args.goal,\n }),\n signal: AbortSignal.timeout(action === \"done\" ? DONE_TIMEOUT_MS : 10_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const r = data.request\n const serves = r.goal ? ` It serves the goal \"${r.goal.title}\" (${r.goal.id}).` : \"\"\n if (action === \"accept\" && data.plan) {\n return [\n `Request ${r.id} is open with a plan of ${data.steps.length} steps.${serves} The daemon hands each step to its agent in order, nudges a step that goes quiet, and tells the owner when it is finished or blocked.`,\n ...describeSteps(data.steps),\n `Steps the owner approves get a decision card now; an approved message is sent by the daemon itself. Report your own steps with {action:\"step\", id:\"${r.id}\", step:<n>, status:\"progress\"|\"done\"|\"blocked\"}.`,\n ].join(\"\\n\")\n }\n if (action === \"step\") return [`Step reported. Plan of ${r.id}:`, ...describeSteps(data.steps)].join(\"\\n\")\n if (action === \"qa\") return `Verdict recorded on ${r.id}: ${describeQa(r.qa)}. It shows on the request's card; nobody is told.`\n if (action === \"describe\") return `Request ${r.id} now reads \"${r.headline ?? \"(no headline)\"}\" on the owner's cards. Needed from them: ${r.need ?? \"what follows from where it stands\"}.`\n if (action === \"accept\") return `Request ${r.id} is open and in progress.${serves} Close it with done (and a link to the evidence) or decline (and the reason); it stays on the owner's list until then.`\n if (action === \"wait\") return `Request ${r.id} is waiting on the owner with your question. Ask them the question now, once.`\n if (action === \"promise\") {\n return `Promise ${r.id} is open, owed to ${r.owedTo}${r.dueAt ? `, due ${new Date(r.dueAt).toISOString().slice(0, 16).replace(\"T\", \" \")} UTC` : \"\"}. ` +\n (r.closeWhen ? \"The daemon checks its evidence and closes it once the check is met.\" : `Close it with {action:\"done\", id:\"${r.id}\", evidence:\"<link>\"} when it is kept.`)\n }\n if (action === \"done\" && data.verify === \"unverified\") {\n return `Request ${r.id} stays open: its check could not say whether it is finished (${data.detail}). It is marked unverified; the daemon checks again, and the owner can close it by hand.`\n }\n if (action === \"done\") {\n const fact = r.factId ? ` It left fact ${r.factId} in the wiki (agentx wiki facts show ${r.factId}).` : \"\"\n return `Request ${r.id} is closed as done${data.verified ? \" (its check was met)\" : \"\"}. Evidence: ${r.evidence}${fact}`\n }\n return `Request ${r.id} is closed as declined. Reason: ${r.closeReason}`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"6jBAkDO,IAAMA,EAAkB,KAEzBC,EAAOC,GAAgB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAE1DC,EAAsC,CAC1C,YAAa,cACb,cAAe,uBACf,cAAe,2BACf,gBAAiB,iBACnB,EAGO,SAASC,EAAaC,EAAsB,CACjD,OAAKA,EAAM,OACJA,EAAM,IAAKC,GAAM,CACtB,IAAMC,EAAO,IAAI,KAAKD,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,IAAK,GAAG,EACxEE,EAAQF,EAAE,QAAU,iBAAmBA,EAAE,SAAW,cAAcA,EAAE,WACtEA,EAAE,QAAU,mBAAqBA,EAAE,gBAAkB,IAAIA,EAAE,kBAAoB,GAC7EG,EAAQ,OAAOH,EAAE,IAAI,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EACjDI,EAAO,CACXJ,EAAE,SAAWA,EAAE,OAAS,gBAAgBA,EAAE,UAAY,GACtDA,EAAE,MAAQ,QAAQ,IAAI,KAAKA,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAG,EAAE,EAAE,QAAQ,IAAK,GAAG,SAAW,GAC1FA,EAAE,UAAY,yBAAy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v","STATE_WORDS","describeOpen","items","r","when","extra","words","loop","awaitingQa","describeQa","usd","n","describeGoals","goals","records","byId","g","far","unpriced","rec","state","describeGoalRecord","check","describeGoalCheck","closed","goalTool","args","deps","base","doFetch","op","goalArg","id","res","data","s","env","caller","resolveScheduleCaller","callerHeaders","describeSteps","steps","waitsText","runRequestTool","action","named","bare","days","describeFlow","serves","fact","e"]}
@@ -0,0 +1,4 @@
1
+ import{d as w}from"./chunk-O2YDS2P3.js";import"./chunk-56UTQ4FU.js";import"./chunk-Q432O462.js";import"./chunk-LSFLSB7C.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var g=e=>typeof e=="string"?e.trim():"";async function b(e,a){let u=a.fetch??fetch,h=a.daemonUrl.replace(/\/$/,""),i=w(e,a.env??process.env);if(!i)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let n=g(e.kind),m=g(e.read);try{if(!m){let c=await u(`${h}/integrations/reads?agent=${encodeURIComponent(i.agentId)}`,{signal:AbortSignal.timeout(1e4)}),$=await c.json().catch(()=>({}));if(!c.ok)return`Error: ${$?.error||`HTTP ${c.status}`}`;let f=($.integrations??[]).filter(r=>!n||r.kind===n);if(!f.length)return n?`You have no ${n} integration with named reads. Ask the owner to connect one: agentx agent integrations connect <agent> ${n}.`:"You have no integrations with named reads. Ask the owner to connect one with agentx agent integrations connect.";let o=[];for(let r of f){o.push(`${r.kind} "${r.label}" (${r.title}):`);for(let d of r.reads){let p=Object.entries(d.params).map(([y,l])=>`${y}${l.required?"":"?"}${l.allowed?`=${l.allowed.join("|")}`:""}`).join(", ");o.push(`- ${d.name}: ${d.description}${p?` Params: ${p}`:""}`)}}return o.push("Run one with {kind, read, params}. Comma-separate list values (e.g. metric:'a,b')."),o.join(`
2
+ `)}if(!n)return"Error: `kind` is required with `read`.";let t=await u(`${h}/integrations/read`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:i.agentId,kind:n,label:g(e.label)||void 0,read:m,params:e.params}),signal:AbortSignal.timeout(3e4)}),s=await t.json().catch(()=>({}));return t.ok?`${s.body}${s.truncated?`
3
+ [truncated: narrow the read (fewer metrics, a shorter period)]`:""}`:`Error: ${s?.error||`HTTP ${t.status}`}`}catch(t){return`Error: couldn't reach the daemon (${t?.message??t}).`}}export{b as runIntegrationTool};
4
+ //# sourceMappingURL=tool-QDAD4ACK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/integrations/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\n\n// --- Agent-facing `agentx_integration_read` tool (#1696) ---\n//\n// Lists the outside-API reads the agent may run, and runs one. It talks to\n// the daemon's /integrations endpoints, which hold the tokens: the agent\n// never sees one, and there is no action here that writes anywhere.\n\nexport interface IntegrationToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown): string => (typeof v === \"string\" ? v.trim() : \"\")\n\nexport async function runIntegrationTool(args: Record<string, unknown>, deps: IntegrationToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const caller = resolveScheduleCaller(args, deps.env ?? process.env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const kind = str(args.kind)\n const read = str(args.read)\n\n try {\n if (!read) {\n const res = await doFetch(`${base}/integrations/reads?agent=${encodeURIComponent(caller.agentId)}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const list = (data.integrations ?? []).filter((i: any) => !kind || i.kind === kind)\n if (!list.length) return kind\n ? `You have no ${kind} integration with named reads. Ask the owner to connect one: agentx agent integrations connect <agent> ${kind}.`\n : \"You have no integrations with named reads. Ask the owner to connect one with agentx agent integrations connect.\"\n const lines: string[] = []\n for (const i of list) {\n lines.push(`${i.kind} \"${i.label}\" (${i.title}):`)\n for (const r of i.reads) {\n const ps = Object.entries(r.params as Record<string, any>)\n .map(([k, p]) => `${k}${p.required ? \"\" : \"?\"}${p.allowed ? `=${p.allowed.join(\"|\")}` : \"\"}`)\n .join(\", \")\n lines.push(`- ${r.name}: ${r.description}${ps ? ` Params: ${ps}` : \"\"}`)\n }\n }\n lines.push(\"Run one with {kind, read, params}. Comma-separate list values (e.g. metric:'a,b').\")\n return lines.join(\"\\n\")\n }\n\n if (!kind) return \"Error: `kind` is required with `read`.\"\n const res = await doFetch(`${base}/integrations/read`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ agent: caller.agentId, kind, label: str(args.label) || undefined, read, params: args.params }),\n signal: AbortSignal.timeout(30_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n return `${data.body}${data.truncated ? \"\\n[truncated: narrow the read (fewer metrics, a shorter period)]\" : \"\"}`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"oZAcA,IAAMA,EAAOC,GAAwB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAExE,eAAsBC,EAAmBC,EAA+BC,EAA4C,CAClH,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,EAASC,EAAsBL,EAAMC,EAAK,KAAO,QAAQ,GAAG,EAClE,GAAI,CAACG,EAAQ,MAAO,gEACpB,IAAME,EAAOT,EAAIG,EAAK,IAAI,EACpBO,EAAOV,EAAIG,EAAK,IAAI,EAE1B,GAAI,CACF,GAAI,CAACO,EAAM,CACT,IAAMC,EAAM,MAAMN,EAAQ,GAAGC,8BAAiC,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E,EAC9C,OAAKA,EAAI,GACF,GAAGC,EAAK,OAAOA,EAAK,UAAY;AAAA,gEAAqE,KADxF,UAAUA,GAAM,OAAS,QAAQD,EAAI,UAE3D,OAASS,EAAP,CACA,MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["str","v","runIntegrationTool","args","deps","doFetch","base","caller","resolveScheduleCaller","kind","read","res","data","list","i","lines","r","ps","k","p","e"]}
1
+ {"version":3,"sources":["../src/integrations/tool.ts"],"sourcesContent":["import { resolveScheduleCaller } from \"@/crons/schedule-tool\"\n\n// --- Agent-facing `agentx_integration_read` tool (#1696) ---\n//\n// Lists the outside-API reads the agent may run, and runs one. It talks to\n// the daemon's /integrations endpoints, which hold the tokens: the agent\n// never sees one, and there is no action here that writes anywhere.\n\nexport interface IntegrationToolDeps {\n daemonUrl: string\n fetch?: typeof fetch\n env?: NodeJS.ProcessEnv\n}\n\nconst str = (v: unknown): string => (typeof v === \"string\" ? v.trim() : \"\")\n\nexport async function runIntegrationTool(args: Record<string, unknown>, deps: IntegrationToolDeps): Promise<string> {\n const doFetch = deps.fetch ?? fetch\n const base = deps.daemonUrl.replace(/\\/$/, \"\")\n const caller = resolveScheduleCaller(args, deps.env ?? process.env)\n if (!caller) return \"Error: couldn't tell which agent you are. Pass callerAgentId.\"\n const kind = str(args.kind)\n const read = str(args.read)\n\n try {\n if (!read) {\n const res = await doFetch(`${base}/integrations/reads?agent=${encodeURIComponent(caller.agentId)}`, { signal: AbortSignal.timeout(10_000) })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n const list = (data.integrations ?? []).filter((i: any) => !kind || i.kind === kind)\n if (!list.length) return kind\n ? `You have no ${kind} integration with named reads. Ask the owner to connect one: agentx agent integrations connect <agent> ${kind}.`\n : \"You have no integrations with named reads. Ask the owner to connect one with agentx agent integrations connect.\"\n const lines: string[] = []\n for (const i of list) {\n lines.push(`${i.kind} \"${i.label}\" (${i.title}):`)\n for (const r of i.reads) {\n const ps = Object.entries(r.params as Record<string, any>)\n .map(([k, p]) => `${k}${p.required ? \"\" : \"?\"}${p.allowed ? `=${p.allowed.join(\"|\")}` : \"\"}`)\n .join(\", \")\n lines.push(`- ${r.name}: ${r.description}${ps ? ` Params: ${ps}` : \"\"}`)\n }\n }\n lines.push(\"Run one with {kind, read, params}. Comma-separate list values (e.g. metric:'a,b').\")\n return lines.join(\"\\n\")\n }\n\n if (!kind) return \"Error: `kind` is required with `read`.\"\n const res = await doFetch(`${base}/integrations/read`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ agent: caller.agentId, kind, label: str(args.label) || undefined, read, params: args.params }),\n signal: AbortSignal.timeout(30_000),\n })\n const data = await res.json().catch(() => ({})) as any\n if (!res.ok) return `Error: ${data?.error || `HTTP ${res.status}`}`\n return `${data.body}${data.truncated ? \"\\n[truncated: narrow the read (fewer metrics, a shorter period)]\" : \"\"}`\n } catch (e: any) {\n return `Error: couldn't reach the daemon (${e?.message ?? e}).`\n }\n}\n"],"mappings":"wXAcA,IAAMA,EAAOC,GAAwB,OAAOA,GAAM,SAAWA,EAAE,KAAK,EAAI,GAExE,eAAsBC,EAAmBC,EAA+BC,EAA4C,CAClH,IAAMC,EAAUD,EAAK,OAAS,MACxBE,EAAOF,EAAK,UAAU,QAAQ,MAAO,EAAE,EACvCG,EAASC,EAAsBL,EAAMC,EAAK,KAAO,QAAQ,GAAG,EAClE,GAAI,CAACG,EAAQ,MAAO,gEACpB,IAAME,EAAOT,EAAIG,EAAK,IAAI,EACpBO,EAAOV,EAAIG,EAAK,IAAI,EAE1B,GAAI,CACF,GAAI,CAACO,EAAM,CACT,IAAMC,EAAM,MAAMN,EAAQ,GAAGC,8BAAiC,mBAAmBC,EAAO,OAAO,IAAK,CAAE,OAAQ,YAAY,QAAQ,GAAM,CAAE,CAAC,EACrIK,EAAO,MAAMD,EAAI,KAAK,EAAE,MAAM,KAAO,CAAC,EAAE,EA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MAAO,qCAAqCA,GAAG,SAAWA,KAC5D,CACF","names":["str","v","runIntegrationTool","args","deps","doFetch","base","caller","resolveScheduleCaller","kind","read","res","data","list","i","lines","r","ps","k","p","e"]}
@@ -0,0 +1,2 @@
1
+ import"./chunk-VWTBHLMX.js";import{d as c}from"./chunk-2MAKXLK2.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BERWTVG2.js";import{b}from"./chunk-LLNLDZNA.js";import{a}from"./chunk-Z5HYCMDF.js";import"./chunk-QEOGWSRR.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-64IVC2G6.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-QUFIUXMQ.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-PZ2F6J2E.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-RGDKHYY2.js";import"./chunk-QIJLFPWE.js";export{b as WikiHub,a as WikiStore,c as agenticQuery};
2
+ //# sourceMappingURL=wiki-J6MSHSVD.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-NFUHYIYG.js";import"./chunk-QIJLFPWE.js";export{a as claudeCall,b as registerWikiEnrich};
2
+ //# sourceMappingURL=wiki-enrich-3Y3TZ6ZK.js.map