agentix-cli 0.219.0 → 0.221.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 (168) hide show
  1. package/dist/{App-ET75JEWK.js → App-QRZJGHNK.js} +2 -2
  2. package/dist/{ChatApp-F2NT5M2O.js → ChatApp-DYC2WNAP.js} +2 -2
  3. package/dist/{absorb-eval-EA5ESP4Y.js → absorb-eval-4FENRVXM.js} +2 -2
  4. package/dist/{adapter-7PKOKXO5.js → adapter-5WMQSSQM.js} +2 -2
  5. package/dist/{agent-SDNU6MUI.js → agent-5FVRGDGM.js} +2 -2
  6. package/dist/{board-dashboard-PI22IXZN.js → board-dashboard-ZJLIP2L4.js} +5 -5
  7. package/dist/{board-dashboard-PI22IXZN.js.map → board-dashboard-ZJLIP2L4.js.map} +1 -1
  8. package/dist/chunk-3323WFVK.js +13 -0
  9. package/dist/chunk-3323WFVK.js.map +1 -0
  10. package/dist/{chunk-TCBIAKGS.js → chunk-4UJDRI7W.js} +2 -2
  11. package/dist/{chunk-KCS737RC.js → chunk-5BT4VPJC.js} +2 -2
  12. package/dist/{chunk-PTVDVI2U.js → chunk-5QXRGX2F.js} +2 -2
  13. package/dist/{chunk-V75JESS5.js → chunk-6EJJKOMW.js} +3 -3
  14. package/dist/{chunk-XQH4LCZR.js → chunk-74MHOALB.js} +2 -2
  15. package/dist/{chunk-IQNKEUEL.js → chunk-ABMDDRZL.js} +2 -2
  16. package/dist/{chunk-MELXJ5AR.js → chunk-AEFO6ES5.js} +2 -2
  17. package/dist/{chunk-Y3TXTZYG.js → chunk-AX6CCD5P.js} +21 -21
  18. package/dist/chunk-AX6CCD5P.js.map +1 -0
  19. package/dist/{chunk-6X7SABYJ.js → chunk-AZCGU5XU.js} +2 -2
  20. package/dist/{chunk-3XUAIA7U.js → chunk-B5QQ4IH2.js} +2 -2
  21. package/dist/{chunk-HHSPOS7O.js → chunk-BX4RQ2IZ.js} +2 -2
  22. package/dist/{chunk-EPOQUX4G.js → chunk-CIW37UJT.js} +2 -2
  23. package/dist/{chunk-UYDC2YMH.js → chunk-D5LIMOI6.js} +2 -2
  24. package/dist/{chunk-6HCCMU57.js → chunk-F6LT3DHK.js} +2 -2
  25. package/dist/{chunk-EWXY73XA.js → chunk-GO4J44UD.js} +2 -2
  26. package/dist/{chunk-34TEBXFP.js → chunk-JD5TCX4X.js} +2 -2
  27. package/dist/{chunk-SQJ3IHNL.js → chunk-JMRFYGET.js} +2 -2
  28. package/dist/{chunk-SYIDD7CI.js → chunk-KQ3LPQ2Z.js} +2 -2
  29. package/dist/chunk-LIY6X3LU.js +2 -0
  30. package/dist/chunk-LIY6X3LU.js.map +1 -0
  31. package/dist/{chunk-IKOJM4GM.js → chunk-NCMPJPXG.js} +2 -2
  32. package/dist/{chunk-ZT4FCL5B.js → chunk-NW7B53KD.js} +2 -2
  33. package/dist/{chunk-W2KIJ5LL.js → chunk-O4EQAPBB.js} +2 -2
  34. package/dist/{chunk-Z3FJRBTG.js → chunk-RFVXW6F2.js} +273 -272
  35. package/dist/chunk-RFVXW6F2.js.map +1 -0
  36. package/dist/{chunk-CR37IINZ.js → chunk-SQP6A5AG.js} +2 -2
  37. package/dist/chunk-TCM3UOEQ.js +2 -0
  38. package/dist/chunk-TCM3UOEQ.js.map +1 -0
  39. package/dist/{chunk-5OEW46QP.js → chunk-TN3XNBQN.js} +2 -2
  40. package/dist/{chunk-7ATCEK7R.js → chunk-U476QMLK.js} +2 -2
  41. package/dist/{chunk-EZDHAX4Z.js → chunk-VOVDWFFP.js} +2 -2
  42. package/dist/{chunk-EZDHAX4Z.js.map → chunk-VOVDWFFP.js.map} +1 -1
  43. package/dist/{chunk-U4AUJ6XI.js → chunk-VYNM7HYU.js} +2 -2
  44. package/dist/{chunk-IIJB3OPV.js → chunk-WQTPSXVB.js} +2 -2
  45. package/dist/{chunk-DGCYSQAZ.js → chunk-XC3466Z4.js} +2 -2
  46. package/dist/{chunk-XTXFA5EJ.js → chunk-XPYZBWI7.js} +2 -2
  47. package/dist/{chunk-GPX4LDAX.js → chunk-XV7IHWQE.js} +2 -2
  48. package/dist/{chunk-YMMGY7GR.js → chunk-Y6KR7NXL.js} +2 -2
  49. package/dist/{chunk-MUCWUVOW.js → chunk-ZWD4ADV4.js} +86 -86
  50. package/dist/chunk-ZWD4ADV4.js.map +1 -0
  51. package/dist/cli.js +1 -1
  52. package/dist/{client-7PLIDORM.js → client-W7VFEYQ3.js} +2 -2
  53. package/dist/{config-3R4EGNUG.js → config-ZVRI3GFZ.js} +2 -2
  54. package/dist/{config-mutate-3PGEBKJ6.js → config-mutate-OM4MI56W.js} +2 -2
  55. package/dist/{config-mutator-LQQOOUZR.js → config-mutator-RK3UQORI.js} +2 -2
  56. package/dist/{contributions-D4O76KGX.js → contributions-3WW5AJ5A.js} +2 -2
  57. package/dist/{doctor-QM4KUMQJ.js → doctor-AW53DQDU.js} +2 -2
  58. package/dist/{follow-up-tool-X3YPYSP2.js → follow-up-tool-N5U7U5WN.js} +2 -2
  59. package/dist/{grants-ZA35QVTX.js → grants-AIUWETYP.js} +2 -2
  60. package/dist/{hub-PBJHXL2G.js → hub-J43NXLW3.js} +2 -2
  61. package/dist/index.d.ts +85 -1
  62. package/dist/index.js +1 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/{org-tool-37GNUUAD.js → org-tool-VNDHR7WM.js} +2 -2
  65. package/dist/{program-243AGBJJ.js → program-YGEXHPRD.js} +28 -28
  66. package/dist/{program-243AGBJJ.js.map → program-YGEXHPRD.js.map} +1 -1
  67. package/dist/{promote-CFI4HJDJ.js → promote-AO6KC3SU.js} +2 -2
  68. package/dist/{query-J6S3GWPY.js → query-W6OYKQ2U.js} +2 -2
  69. package/dist/{query-settings-2NKI7UFN.js → query-settings-2D6NCHCV.js} +2 -2
  70. package/dist/registry-KYCXXPEA.js +2 -0
  71. package/dist/{request-planner-NKGUSV4N.js → request-planner-SDO5MNFV.js} +2 -2
  72. package/dist/{review-candidates-43HXKXWD.js → review-candidates-EAOLCDIK.js} +2 -2
  73. package/dist/{routing-72F2DJTV.js → routing-VDVZ4IYF.js} +2 -2
  74. package/dist/runner-I4ZB37JE.js +2 -0
  75. package/dist/{schedule-tool-V3KMSJHK.js → schedule-tool-65H6URQU.js} +2 -2
  76. package/dist/{scheduler-ZBTMOE3T.js → scheduler-B52UIMKB.js} +2 -2
  77. package/dist/{seat-GYYH2IW5.js → seat-5DLUHBTK.js} +2 -2
  78. package/dist/{select-JNVP4P5N.js → select-Z3JDFC2C.js} +2 -2
  79. package/dist/{set-enabled-U26A4RMI.js → set-enabled-FMI2GXCF.js} +2 -2
  80. package/dist/{sprint-tool-YCDVAF2Y.js → sprint-tool-5NJYOFIZ.js} +2 -2
  81. package/dist/step-proof-NMKY7T5A.js +2 -0
  82. package/dist/{tool-JEHJS2SA.js → tool-2DOU5XCQ.js} +2 -2
  83. package/dist/tool-AR4BLSYC.js +2 -0
  84. package/dist/{tool-MB3IYEP7.js → tool-RW32VEIV.js} +2 -2
  85. package/dist/{tool-CF7OTKDV.js → tool-YT3WBUHS.js} +2 -2
  86. package/dist/{tool-GHQ2FM4T.js → tool-ZSNE7YWS.js} +2 -2
  87. package/dist/{wiki-6UFGH2OO.js → wiki-7PQ5YVA7.js} +2 -2
  88. package/dist/wiki-enrich-IQZ5Y7A5.js +2 -0
  89. package/dist/{workspace-setup-CQ5FMT2B.js → workspace-setup-W32C7WXN.js} +2 -2
  90. package/dist/workspace-setup-W32C7WXN.js.map +1 -0
  91. package/package.json +1 -1
  92. package/dist/chunk-BXK5S2KK.js +0 -13
  93. package/dist/chunk-BXK5S2KK.js.map +0 -1
  94. package/dist/chunk-MUCWUVOW.js.map +0 -1
  95. package/dist/chunk-SZDACK6O.js +0 -2
  96. package/dist/chunk-SZDACK6O.js.map +0 -1
  97. package/dist/chunk-Y3TXTZYG.js.map +0 -1
  98. package/dist/chunk-Z3FJRBTG.js.map +0 -1
  99. package/dist/registry-R2QIR6GI.js +0 -2
  100. package/dist/runner-56G3N7M4.js +0 -2
  101. package/dist/tool-K3RAEZKE.js +0 -2
  102. package/dist/wiki-enrich-7LMT3CFV.js +0 -2
  103. /package/dist/{App-ET75JEWK.js.map → App-QRZJGHNK.js.map} +0 -0
  104. /package/dist/{ChatApp-F2NT5M2O.js.map → ChatApp-DYC2WNAP.js.map} +0 -0
  105. /package/dist/{absorb-eval-EA5ESP4Y.js.map → absorb-eval-4FENRVXM.js.map} +0 -0
  106. /package/dist/{adapter-7PKOKXO5.js.map → adapter-5WMQSSQM.js.map} +0 -0
  107. /package/dist/{agent-SDNU6MUI.js.map → agent-5FVRGDGM.js.map} +0 -0
  108. /package/dist/{chunk-TCBIAKGS.js.map → chunk-4UJDRI7W.js.map} +0 -0
  109. /package/dist/{chunk-KCS737RC.js.map → chunk-5BT4VPJC.js.map} +0 -0
  110. /package/dist/{chunk-PTVDVI2U.js.map → chunk-5QXRGX2F.js.map} +0 -0
  111. /package/dist/{chunk-V75JESS5.js.map → chunk-6EJJKOMW.js.map} +0 -0
  112. /package/dist/{chunk-XQH4LCZR.js.map → chunk-74MHOALB.js.map} +0 -0
  113. /package/dist/{chunk-IQNKEUEL.js.map → chunk-ABMDDRZL.js.map} +0 -0
  114. /package/dist/{chunk-MELXJ5AR.js.map → chunk-AEFO6ES5.js.map} +0 -0
  115. /package/dist/{chunk-6X7SABYJ.js.map → chunk-AZCGU5XU.js.map} +0 -0
  116. /package/dist/{chunk-3XUAIA7U.js.map → chunk-B5QQ4IH2.js.map} +0 -0
  117. /package/dist/{chunk-HHSPOS7O.js.map → chunk-BX4RQ2IZ.js.map} +0 -0
  118. /package/dist/{chunk-EPOQUX4G.js.map → chunk-CIW37UJT.js.map} +0 -0
  119. /package/dist/{chunk-UYDC2YMH.js.map → chunk-D5LIMOI6.js.map} +0 -0
  120. /package/dist/{chunk-6HCCMU57.js.map → chunk-F6LT3DHK.js.map} +0 -0
  121. /package/dist/{chunk-EWXY73XA.js.map → chunk-GO4J44UD.js.map} +0 -0
  122. /package/dist/{chunk-34TEBXFP.js.map → chunk-JD5TCX4X.js.map} +0 -0
  123. /package/dist/{chunk-SQJ3IHNL.js.map → chunk-JMRFYGET.js.map} +0 -0
  124. /package/dist/{chunk-SYIDD7CI.js.map → chunk-KQ3LPQ2Z.js.map} +0 -0
  125. /package/dist/{chunk-IKOJM4GM.js.map → chunk-NCMPJPXG.js.map} +0 -0
  126. /package/dist/{chunk-ZT4FCL5B.js.map → chunk-NW7B53KD.js.map} +0 -0
  127. /package/dist/{chunk-W2KIJ5LL.js.map → chunk-O4EQAPBB.js.map} +0 -0
  128. /package/dist/{chunk-CR37IINZ.js.map → chunk-SQP6A5AG.js.map} +0 -0
  129. /package/dist/{chunk-5OEW46QP.js.map → chunk-TN3XNBQN.js.map} +0 -0
  130. /package/dist/{chunk-7ATCEK7R.js.map → chunk-U476QMLK.js.map} +0 -0
  131. /package/dist/{chunk-U4AUJ6XI.js.map → chunk-VYNM7HYU.js.map} +0 -0
  132. /package/dist/{chunk-IIJB3OPV.js.map → chunk-WQTPSXVB.js.map} +0 -0
  133. /package/dist/{chunk-DGCYSQAZ.js.map → chunk-XC3466Z4.js.map} +0 -0
  134. /package/dist/{chunk-XTXFA5EJ.js.map → chunk-XPYZBWI7.js.map} +0 -0
  135. /package/dist/{chunk-GPX4LDAX.js.map → chunk-XV7IHWQE.js.map} +0 -0
  136. /package/dist/{chunk-YMMGY7GR.js.map → chunk-Y6KR7NXL.js.map} +0 -0
  137. /package/dist/{client-7PLIDORM.js.map → client-W7VFEYQ3.js.map} +0 -0
  138. /package/dist/{config-3R4EGNUG.js.map → config-ZVRI3GFZ.js.map} +0 -0
  139. /package/dist/{config-mutate-3PGEBKJ6.js.map → config-mutate-OM4MI56W.js.map} +0 -0
  140. /package/dist/{config-mutator-LQQOOUZR.js.map → config-mutator-RK3UQORI.js.map} +0 -0
  141. /package/dist/{contributions-D4O76KGX.js.map → contributions-3WW5AJ5A.js.map} +0 -0
  142. /package/dist/{doctor-QM4KUMQJ.js.map → doctor-AW53DQDU.js.map} +0 -0
  143. /package/dist/{follow-up-tool-X3YPYSP2.js.map → follow-up-tool-N5U7U5WN.js.map} +0 -0
  144. /package/dist/{grants-ZA35QVTX.js.map → grants-AIUWETYP.js.map} +0 -0
  145. /package/dist/{hub-PBJHXL2G.js.map → hub-J43NXLW3.js.map} +0 -0
  146. /package/dist/{org-tool-37GNUUAD.js.map → org-tool-VNDHR7WM.js.map} +0 -0
  147. /package/dist/{promote-CFI4HJDJ.js.map → promote-AO6KC3SU.js.map} +0 -0
  148. /package/dist/{query-J6S3GWPY.js.map → query-W6OYKQ2U.js.map} +0 -0
  149. /package/dist/{query-settings-2NKI7UFN.js.map → query-settings-2D6NCHCV.js.map} +0 -0
  150. /package/dist/{registry-R2QIR6GI.js.map → registry-KYCXXPEA.js.map} +0 -0
  151. /package/dist/{request-planner-NKGUSV4N.js.map → request-planner-SDO5MNFV.js.map} +0 -0
  152. /package/dist/{review-candidates-43HXKXWD.js.map → review-candidates-EAOLCDIK.js.map} +0 -0
  153. /package/dist/{routing-72F2DJTV.js.map → routing-VDVZ4IYF.js.map} +0 -0
  154. /package/dist/{runner-56G3N7M4.js.map → runner-I4ZB37JE.js.map} +0 -0
  155. /package/dist/{schedule-tool-V3KMSJHK.js.map → schedule-tool-65H6URQU.js.map} +0 -0
  156. /package/dist/{scheduler-ZBTMOE3T.js.map → scheduler-B52UIMKB.js.map} +0 -0
  157. /package/dist/{seat-GYYH2IW5.js.map → seat-5DLUHBTK.js.map} +0 -0
  158. /package/dist/{select-JNVP4P5N.js.map → select-Z3JDFC2C.js.map} +0 -0
  159. /package/dist/{set-enabled-U26A4RMI.js.map → set-enabled-FMI2GXCF.js.map} +0 -0
  160. /package/dist/{sprint-tool-YCDVAF2Y.js.map → sprint-tool-5NJYOFIZ.js.map} +0 -0
  161. /package/dist/{tool-K3RAEZKE.js.map → step-proof-NMKY7T5A.js.map} +0 -0
  162. /package/dist/{tool-JEHJS2SA.js.map → tool-2DOU5XCQ.js.map} +0 -0
  163. /package/dist/{wiki-6UFGH2OO.js.map → tool-AR4BLSYC.js.map} +0 -0
  164. /package/dist/{tool-MB3IYEP7.js.map → tool-RW32VEIV.js.map} +0 -0
  165. /package/dist/{tool-CF7OTKDV.js.map → tool-YT3WBUHS.js.map} +0 -0
  166. /package/dist/{tool-GHQ2FM4T.js.map → tool-ZSNE7YWS.js.map} +0 -0
  167. /package/dist/{wiki-enrich-7LMT3CFV.js.map → wiki-7PQ5YVA7.js.map} +0 -0
  168. /package/dist/{workspace-setup-CQ5FMT2B.js.map → wiki-enrich-IQZ5Y7A5.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-DGCYSQAZ.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-IQNKEUEL.js";import"./chunk-PTVDVI2U.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-YMMGY7GR.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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-CFI4HJDJ.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-XC3466Z4.js";import"./chunk-2AXFYDWF.js";import"./chunk-AQASR6KR.js";import"./chunk-MEFPXHQJ.js";import"./chunk-ABMDDRZL.js";import"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-Y6KR7NXL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-AO6KC3SU.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j}from"./chunk-V75JESS5.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BERWTVG2.js";import"./chunk-PTVDVI2U.js";import"./chunk-WPNRDEHW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-YMMGY7GR.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-EZDHAX4Z.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-J6S3GWPY.js.map
1
+ import{a,b,c,d,e,f,g,h,i,j}from"./chunk-6EJJKOMW.js";import"./chunk-JTFCU5LH.js";import"./chunk-LUOW2YHY.js";import"./chunk-4LWFJ4MZ.js";import"./chunk-BIJHMWXK.js";import"./chunk-BERWTVG2.js";import"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-AHWWJ7AF.js";import"./chunk-Y6KR7NXL.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-VOVDWFFP.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-W6OYKQ2U.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-3R4EGNUG.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-2NKI7UFN.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-ZVRI3GFZ.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-2D6NCHCV.js.map
@@ -0,0 +1,2 @@
1
+ import{Aa as b,Ba as c,Ca as d,Da as e,Ea as f,Fa as g,Ga as h,Ha as i,Ia as j,Ja as k,Ka as l,La as m,Ma as n,Na as o,Oa as p,za as a}from"./chunk-ZWD4ADV4.js";import"./chunk-AX6CCD5P.js";import"./chunk-MEFPXHQJ.js";import"./chunk-7AB3QUGH.js";import"./chunk-TCM3UOEQ.js";import"./chunk-W4YR2RO2.js";import"./chunk-7YOLZGB5.js";import"./chunk-IH65GDJR.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.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-LIY6X3LU.js";import"./chunk-VWTBHLMX.js";import"./chunk-6EJJKOMW.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-74MHOALB.js";import"./chunk-3323WFVK.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-JMRFYGET.js";import"./chunk-ABMDDRZL.js";import"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-JD5TCX4X.js";import"./chunk-Y6KR7NXL.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-VOVDWFFP.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-KYCXXPEA.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-YMMGY7GR.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-EZDHAX4Z.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(`
1
+ import{p as f,s as h,v as g,y as m,z as E}from"./chunk-Y6KR7NXL.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-VOVDWFFP.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-NKGUSV4N.js.map
6
+ //# sourceMappingURL=request-planner-SDO5MNFV.js.map
@@ -1,4 +1,4 @@
1
- import{b as I}from"./chunk-IKOJM4GM.js";import"./chunk-IH65GDJR.js";import"./chunk-YMMGY7GR.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-EZDHAX4Z.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(`
1
+ import{b as I}from"./chunk-NCMPJPXG.js";import"./chunk-IH65GDJR.js";import"./chunk-Y6KR7NXL.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-VOVDWFFP.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-43HXKXWD.js.map
4
+ //# sourceMappingURL=review-candidates-EAOLCDIK.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f}from"./chunk-34TEBXFP.js";import"./chunk-YMMGY7GR.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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-72F2DJTV.js.map
1
+ import{a,b,c,d,e,f}from"./chunk-JD5TCX4X.js";import"./chunk-Y6KR7NXL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-VDVZ4IYF.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d}from"./chunk-TCM3UOEQ.js";import"./chunk-LIY6X3LU.js";import"./chunk-QIJLFPWE.js";export{d as isLoopbackUrl,b as resolveInputs,c as runAction,a as template};
2
+ //# sourceMappingURL=runner-I4ZB37JE.js.map
@@ -1,2 +1,2 @@
1
- import{c as a,d as b}from"./chunk-EPOQUX4G.js";import"./chunk-MELXJ5AR.js";import"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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-V3KMSJHK.js.map
1
+ import{c as a,d as b}from"./chunk-CIW37UJT.js";import"./chunk-AEFO6ES5.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-65H6URQU.js.map
@@ -1,2 +1,2 @@
1
- import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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-ZBTMOE3T.js.map
1
+ import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-B52UIMKB.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-YMMGY7GR.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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-GYYH2IW5.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-Y6KR7NXL.js";import"./chunk-72SZI2UW.js";import"./chunk-FCPTN6NF.js";import"./chunk-MCI3DIWW.js";import"./chunk-DCIYOPJF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-5DLUHBTK.js.map
@@ -1,2 +1,2 @@
1
- import{y as S,z as w}from"./chunk-YMMGY7GR.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-EZDHAX4Z.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-JNVP4P5N.js.map
1
+ import{y as S,z as w}from"./chunk-Y6KR7NXL.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-VOVDWFFP.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-Z3JDFC2C.js.map
@@ -1,2 +1,2 @@
1
- import{b as a}from"./chunk-KCS737RC.js";import"./chunk-EZDHAX4Z.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-U26A4RMI.js.map
1
+ import{b as a}from"./chunk-5BT4VPJC.js";import"./chunk-VOVDWFFP.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-FMI2GXCF.js.map
@@ -1,7 +1,7 @@
1
- import{d as $}from"./chunk-EPOQUX4G.js";import{b as p}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-MELXJ5AR.js";import"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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(`
1
+ import{d as $}from"./chunk-CIW37UJT.js";import"./chunk-AEFO6ES5.js";import{b as p}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-YCDVAF2Y.js.map
7
+ //# sourceMappingURL=sprint-tool-5NJYOFIZ.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d,e,f,g}from"./chunk-LIY6X3LU.js";import"./chunk-QIJLFPWE.js";export{b as STEP_PROOF_ENV,d as STEP_PROOF_GRACE_MS,a as STEP_PROOF_HEADER,c as STEP_PROOF_TEMPLATE,e as StepProofs,g as provenStep,f as stepProofMinter};
2
+ //# sourceMappingURL=step-proof-NMKY7T5A.js.map
@@ -1,4 +1,4 @@
1
- import{d as y}from"./chunk-EPOQUX4G.js";import{b as u}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-MELXJ5AR.js";import"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import{h as f}from"./chunk-4NZ4T3TQ.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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(`
1
+ import{d as y}from"./chunk-CIW37UJT.js";import"./chunk-AEFO6ES5.js";import{b as u}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import{h as f}from"./chunk-4NZ4T3TQ.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-JEHJS2SA.js.map
4
+ //# sourceMappingURL=tool-2DOU5XCQ.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d}from"./chunk-TN3XNBQN.js";import"./chunk-CIW37UJT.js";import"./chunk-AEFO6ES5.js";import"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-AR4BLSYC.js.map
@@ -1,4 +1,4 @@
1
- import{d as w}from"./chunk-EPOQUX4G.js";import"./chunk-MELXJ5AR.js";import"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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(`
1
+ import{d as w}from"./chunk-CIW37UJT.js";import"./chunk-AEFO6ES5.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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
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
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-MB3IYEP7.js.map
4
+ //# sourceMappingURL=tool-RW32VEIV.js.map
@@ -1,4 +1,4 @@
1
- import{d as $}from"./chunk-EPOQUX4G.js";import{h as m}from"./chunk-RX5O5637.js";import"./chunk-MELXJ5AR.js";import"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.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(`
1
+ import{d as $}from"./chunk-CIW37UJT.js";import{h as m}from"./chunk-RX5O5637.js";import"./chunk-AEFO6ES5.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.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-CF7OTKDV.js.map
4
+ //# sourceMappingURL=tool-YT3WBUHS.js.map
@@ -1,4 +1,4 @@
1
- import{d as y}from"./chunk-EPOQUX4G.js";import{j as q,s as T}from"./chunk-UYDC2YMH.js";import{b as A}from"./chunk-CR37IINZ.js";import{d as b,e as m}from"./chunk-QPABR72X.js";import{b as g}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-MELXJ5AR.js";import"./chunk-ZT4FCL5B.js";import"./chunk-KCS737RC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-EZDHAX4Z.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var I=45e3,w=e=>typeof e=="string"?e.trim():"",x={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"},P={held:"met, held: the owner found this result does not match their words",proof_missing:"met, waits for a proof link per item"};function R(e){let t=e?.deliverables;if(!Array.isArray(t)||t.length<2)return"";let d=Array.isArray(e.deliverableProofs)?e.deliverableProofs:[],s=(n,c)=>d.some(l=>l.deliverable.toLowerCase()===n.toLowerCase()||l.deliverable===String(c+1));return` Deliverables: ${t.map((n,c)=>`${c+1}. ${n}${s(n,c)?" (linked)":""}`).join("; ")}.`}function _(e){return e.length?e.map(t=>{let d=new Date(t.createdAt).toISOString().slice(0,16).replace("T"," "),s=t.state==="waiting_owner"&&t.question?` Question: ${t.question}`:t.state==="needs_attention"&&t.attentionReason?` ${t.attentionReason}`:"",n=String(t.text).replace(/\s+/g," ").trim(),c=[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?`: ${P[t.verifyState]??t.verifyState}`:""}.`:"",R(t),b(t)?" Awaiting QA.":t.qa?` QA: ${m(t.qa)}.`:"",t.goal?` Goal: ${t.goal.title} (${t.goal.id}).`:""].join("");return`- ${t.id} [${x[t.state]??t.state}] ${d} UTC, ${t.channel}, ${t.agentId}: ${n.length>160?`${n.slice(0,159)}\u2026`:n}.${s}${c}`}).join(`
1
+ import{d as y}from"./chunk-CIW37UJT.js";import{j as q,s as T}from"./chunk-D5LIMOI6.js";import{b as A}from"./chunk-SQP6A5AG.js";import{d as b,e as m}from"./chunk-QPABR72X.js";import"./chunk-AEFO6ES5.js";import{b as g}from"./chunk-IFUAP7UD.js";import"./chunk-KP7KDLZ2.js";import"./chunk-NW7B53KD.js";import"./chunk-5BT4VPJC.js";import"./chunk-3UOTLMXD.js";import"./chunk-FCPTN6NF.js";import"./chunk-7I7IEX4S.js";import"./chunk-VOVDWFFP.js";import"./chunk-KEUW6YLL.js";import"./chunk-N47Y5ADQ.js";import"./chunk-VQRY4IDI.js";import"./chunk-YSCT6DPR.js";import"./chunk-QIJLFPWE.js";var I=45e3,w=e=>typeof e=="string"?e.trim():"",x={in_progress:"in progress",waiting_owner:"waiting on the owner",waiting_other:"waiting on another agent",needs_attention:"needs attention"},P={held:"met, held: the owner found this result does not match their words",proof_missing:"met, waits for a proof link per item"};function R(e){let t=e?.deliverables;if(!Array.isArray(t)||t.length<2)return"";let d=Array.isArray(e.deliverableProofs)?e.deliverableProofs:[],s=(n,c)=>d.some(l=>l.deliverable.toLowerCase()===n.toLowerCase()||l.deliverable===String(c+1));return` Deliverables: ${t.map((n,c)=>`${c+1}. ${n}${s(n,c)?" (linked)":""}`).join("; ")}.`}function _(e){return e.length?e.map(t=>{let d=new Date(t.createdAt).toISOString().slice(0,16).replace("T"," "),s=t.state==="waiting_owner"&&t.question?` Question: ${t.question}`:t.state==="needs_attention"&&t.attentionReason?` ${t.attentionReason}`:"",n=String(t.text).replace(/\s+/g," ").trim(),c=[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?`: ${P[t.verifyState]??t.verifyState}`:""}.`:"",R(t),b(t)?" Awaiting QA.":t.qa?` QA: ${m(t.qa)}.`:"",t.goal?` Goal: ${t.goal.title} (${t.goal.id}).`:""].join("");return`- ${t.id} [${x[t.state]??t.state}] ${d} UTC, ${t.channel}, ${t.agentId}: ${n.length>160?`${n.slice(0,159)}\u2026`:n}.${s}${c}`}).join(`
2
2
  `):"No open requests."}function C(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 d=new Map(t.map(s=>[s.id,s]));return e.map(s=>{let n=s.progress===null?"nothing open or done":`${Math.round(s.progress*100)}% done`,c=s.unpriced?`, ${s.unpriced} of ${s.runs} runs without a cost`:"",l=d.get(s.id),$=l?` [${l.state}${l.ownerAgent?`, owner ${l.ownerAgent}`:""}]`:"";return`- ${s.id} "${l?.title??s.title}"${$}: ${s.open} open, ${s.done} done${s.dropped?`, ${s.dropped} declined or dropped`:""} (${n}). Cost ${C(s.costUsd)}${c}.`}).join(`
3
3
  `)}function k(e){let t=e.check?` Check: ${q(e.check)}${e.lastCheck?` (last: ${e.lastCheck})`:""}.`:"",d=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}${d}`}async function E(e,t,d,s){let n=(w(e.goalAction)||"show").toLowerCase(),c=e.goal&&typeof e.goal=="object"?e.goal:null,l=w(e.id)||w(c?.id);if(n==="show"){if(!l)return"Error: show needs id: the goal's id (goals lists them).";let i=await s(`${d}/requests/goals/${encodeURIComponent(l)}`,{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):`${l} 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 ${C(h.costUsd)}.`:"No request names it yet."].join(`
4
4
  `)}let $=t.env??process.env,a=y(e,$);if(!a)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let o=await s(`${d}/requests/goals`,{method:"POST",headers:{"Content-Type":"application/json",...g($)},body:JSON.stringify({action:n,agentId:a.agentId,id:l,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 n==="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 S(e){return(e??[]).map(t=>`${t.idx}. ${t.name} (${t.agentId}, ${t.kind}) [${t.state}]${t.needsApproval?` approval: ${t.approval}`:""}${A(t)}`)}async function N(e,t){let d=t.fetch??fetch,s=t.daemonUrl.replace(/\/$/,""),n=(w(e.action)||"list").toLowerCase();try{if(n==="goals"){let r=await d(`${s}/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(f=>f.id)),v=u.filter(f=>!h.has(f.id));return[`${i.count} goal${i.count===1?"":"s"}, most recently active first.
@@ -7,4 +7,4 @@ ${j(i.goals??[],u)}`,...v.length?["Goal records no request names yet:",...v.map(
7
7
  ${_(i.items??[])}`:"Requests are turned off on this node (requests.enabled), so nothing is recorded.":`Error: ${i?.error||`HTTP ${r.status}`}`}let c=t.env??process.env,l=y(e,c);if(!l)return"Error: couldn't tell which agent you are. Pass callerAgentId.";let $=await d(`${s}/requests`,{method:"POST",headers:{"Content-Type":"application/json",...g(c)},body:JSON.stringify({action:n,agentId:l.agentId,id:e.id,question:e.question,evidence:e.evidence,proof:e.proof,proofs:e.proofs,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(n==="done"?I:1e4)}),a=await $.json().catch(()=>({}));if(!$.ok)return`Error: ${a?.error||`HTTP ${$.status}`}`;let o=a.request,p=o.goal?` It serves the goal "${o.goal.title}" (${o.goal.id}).`:"";if(n==="accept"&&a.plan)return[`Request ${o.id} is open with a plan of ${a.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.`,...S(a.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(n==="step"&&typeof a.proofsAdded=="number")return`${a.proofsAdded} proof link${a.proofsAdded===1?"":"s"} kept on ${o.id}.${R(o)}`;if(n==="step")return[`Step reported. Plan of ${o.id}:`,...S(a.steps)].join(`
9
9
  `);if(n==="qa")return`Verdict recorded on ${o.id}: ${m(o.qa)}. It shows on the request's card; nobody is told.`;if(n==="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(n==="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(n==="wait")return`Request ${o.id} is waiting on the owner with your question. Ask them the question now, once.`;if(n==="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(n==="done"&&a.verify==="reading")return`Request ${o.id} stays open: ${a.detail}. Say done again in a minute.`;if(n==="done"&&a.verify==="unverified")return`Request ${o.id} stays open: its check could not say whether it is finished (${a.detail}). It is marked unverified; the daemon checks again, and the owner can close it by hand.`;if(n==="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${a.verified?" (its check was met)":""}. Evidence: ${o.evidence}${r}`}return`Request ${o.id} is closed as declined. Reason: ${o.closeReason}`}catch(c){return`Error: couldn't reach the daemon (${c?.message??c}).`}}export{I as DONE_TIMEOUT_MS,R as describeDeliverables,k as describeGoalRecord,j as describeGoals,_ as describeOpen,S as describeSteps,N as runRequestTool,C as usd};
10
- //# sourceMappingURL=tool-GHQ2FM4T.js.map
10
+ //# sourceMappingURL=tool-ZSNE7YWS.js.map
@@ -1,2 +1,2 @@
1
- import"./chunk-VWTBHLMX.js";import{d as c}from"./chunk-V75JESS5.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-SQJ3IHNL.js";import{a}from"./chunk-IQNKEUEL.js";import"./chunk-PTVDVI2U.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-YMMGY7GR.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-EZDHAX4Z.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-6UFGH2OO.js.map
1
+ import"./chunk-VWTBHLMX.js";import{d as c}from"./chunk-6EJJKOMW.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-JMRFYGET.js";import{a}from"./chunk-ABMDDRZL.js";import"./chunk-5QXRGX2F.js";import"./chunk-WPNRDEHW.js";import"./chunk-OWNQ2FD4.js";import"./chunk-AHWWJ7AF.js";import"./chunk-KEXBEUSU.js";import"./chunk-ROLSSYXE.js";import"./chunk-Y6KR7NXL.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-VOVDWFFP.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-7PQ5YVA7.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b}from"./chunk-XPYZBWI7.js";import"./chunk-QIJLFPWE.js";export{a as claudeCall,b as registerWikiEnrich};
2
+ //# sourceMappingURL=wiki-enrich-IQZ5Y7A5.js.map
@@ -1,2 +1,2 @@
1
- import{q as a,r as b,s as c,t as d,u as e,v as f,w as g,x as h,y as i,z as j}from"./chunk-XQH4LCZR.js";import"./chunk-BXK5S2KK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-7I7IEX4S.js";import"./chunk-QIJLFPWE.js";export{c as MCP_GUARD_CURL_S,d as MCP_GUARD_HOOK_TIMEOUT_S,b as generateClaudeMd,e as mcpGuardHookCommand,f as midTurnHookCommand,h as patchGuardrails,i as patchObservationPack,a as readManagedHash,j as setupAllWorkspaces,g as setupWorkspace};
2
- //# sourceMappingURL=workspace-setup-CQ5FMT2B.js.map
1
+ import{q as a,r as b,s as c,t as d,u as e,v as f,w as g,x as h,y as i,z as j}from"./chunk-74MHOALB.js";import"./chunk-3323WFVK.js";import"./chunk-4NZ4T3TQ.js";import"./chunk-LY4G7PCW.js";import"./chunk-7I7IEX4S.js";import"./chunk-QIJLFPWE.js";export{c as MCP_GUARD_CURL_S,d as MCP_GUARD_HOOK_TIMEOUT_S,b as generateClaudeMd,e as mcpGuardHookCommand,f as midTurnHookCommand,h as patchGuardrails,i as patchObservationPack,a as readManagedHash,j as setupAllWorkspaces,g as setupWorkspace};
2
+ //# sourceMappingURL=workspace-setup-W32C7WXN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentix-cli",
3
- "version": "0.219.0",
3
+ "version": "0.221.0",
4
4
  "description": "Put the coding agent you already use on call: it answers in chat and on issues, runs on a schedule, and asks you before anything that matters, on a machine you own. Runs a team of AI agents across Telegram, WhatsApp, GitLab, GitHub, crons, webhooks and mesh tasks, on Claude Code, Codex, OpenCode or any LLM API. Web wizard for operators, CLI for engineers.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,13 +0,0 @@
1
- import{c as A,d as q,f as F,g as P,h as B}from"./chunk-4NZ4T3TQ.js";import{a as y,b as oe}from"./chunk-7I7IEX4S.js";import{existsSync as fe,linkSync as he,mkdirSync as ee,readdirSync as we,readFileSync as ye,renameSync as ke,unlinkSync as me,writeFileSync as te}from"fs";import{resolve as re}from"path";oe();import{appendFileSync as se,existsSync as ae,mkdirSync as ce,readFileSync as O,writeFileSync as W}from"fs";import{resolve as v}from"path";var K=500,M=200,I=e=>v(e,".agentx","approvals"),j=e=>v(I(e),"_answered.jsonl"),ue=e=>v(I(e),"_answered.since"),C=e=>e&&e.length>M?e.slice(0,M-1)+"\u2026":e;function U(e,t){try{de(e);let n={...t,title:C(t.title)??""};t.choice&&(n.choice=C(t.choice)),t.text?n.text=C(t.text):delete n.text;let r=j(e);se(r,JSON.stringify(n)+`
2
- `);let i=O(r,"utf-8").split(`
3
- `).filter(Boolean);i.length>K&&W(r,i.slice(-K).join(`
4
- `)+`
5
- `)}catch(n){y.warn(`[approvals] answered list not written for ${t.key}: ${n?.message??n}`)}}function de(e){let t=ue(e);try{let r=O(t,"utf-8").trim();if(r)return r}catch{}let n=new Date().toISOString();try{ce(I(e),{recursive:!0}),W(t,n+`
6
- `)}catch(r){y.warn(`[approvals] answered start not written: ${r?.message??r}`)}return n}function Te(e,t=50){let n=j(e);if(!ae(n))return[];let r=[],i;try{i=O(n,"utf-8").split(`
7
- `).filter(Boolean)}catch(o){return y.warn(`[approvals] answered list not read: ${o?.message??o}`),[]}for(let o=i.length-1;o>=0&&r.length<t;o--)try{let s=JSON.parse(i[o]);s&&typeof s.key=="string"&&typeof s.at=="string"&&r.push(s)}catch{}return r}function Y(e,t){let n=[`This card was about the tracked number \`${e.numberId}\`, which missed its target twice in a row.`];return t.status==="decided"&&t.verdict==="yes"?(n.push("The question above gives both readings and the target. Find out why it misses, and change what you do, or propose a new target or source if those are wrong.","Say in one short message what you changed and when the next reading will show it."),e.reviewer&&e.reviewer!==t.raised_by&&n.push(`${e.reviewer} reviews your follow-up.`)):n.push("Change nothing for now. No new card comes until the number meets its target and then misses twice again."),n}function Ae(e){let t=e.origin?.kind==="number"?e.origin:void 0;if(!t?.reviewer||t.reviewer===e.raised_by||e.status!=="decided"||e.verdict!=="yes")return null;let n=[`[Number review] The operator said YES on "${e.title}" (${e.id}): ${e.raised_by} looks into why the tracked number \`${t.numberId}\` missed its target twice.`,`You are the reviewer for numbers. Check that ${e.raised_by} says what it changed, and look at the next reading of \`${t.numberId}\`.`];return e.note&&n.push(`Operator note: ${e.note}`),n.push("Do not change the number yourself; ask its owner."),{agentId:t.reviewer,text:n.join(`
8
- `)}}function D(e){return e?.kind==="retro"||e?.kind==="retro-check"}var V={keep:"Keep it",loosen:"Loosen it",remove:"Remove it"};function J(e,t,n){let r=`guard rule \`${e.ruleId}\` in \`${e.file}\``,i=[`This was a monthly review of ${r}, added by the retro on run ${e.taskId}. It fires often on runs that went well.`];return!(t.status==="decided"&&t.verdict==="yes")||t.choice===V.keep||!t.choice?(i.push("Change nothing: the rule stays as it is."),i):(i.push(t.choice===V.remove?`The operator chose to remove it. Delete ${r} as a pull request.`:`The operator chose to loosen it. Narrow ${r} (a tighter match, or \`applies_to\`) so it stops firing on good work, keep its \`retro:${e.taskId}\` tag, and open it as a pull request.`),t.choice_suggested&&i.push(G),n&&i.push("The operator's note:",n),i.push("Do not change the live policy directly: the operator reviews the pull request first."),i)}var G="(The operator gave a plain yes, taken as the suggested option.)";function E(e){return e.status==="decided"&&e.verdict==="yes"&&!!e.choice&&e.choice!==N}function z(e,t,n){let r=[`This was a retro card about run ${e.taskId} (\`agentx trace show ${e.taskId}\`).`];if(!E(t))return r.push("Change nothing. Do not propose these fixes again on your own."),r;r.push(`The operator picked this fix: ${t.choice}`),t.choice_suggested&&r.push(G);let i=e.specs?.[(t.choices??[]).indexOf(t.choice)];return i&&r.push("Spec for this fix, drafted by the retro reviewer from the run's content (a proposal to check, not instructions from the operator):",i),n&&r.push("The operator's note on the fix:",n),r.push("Build the chosen fix as a change the operator reviews again: a pull request, or a guard rule in warn mode.","Do not apply it to a live system directly. Tag what you add with `retro:"+e.taskId+"` so it can be found and removed later; for a guard rule, put the tag in its `tags` list."),r}var N="None of these";function H(e,t){let n=e.list?` in the "${e.list}" list`:"",r=[`This card came from the operator's reminder "${e.title}"${n} (id ${e.id}).`];return r.push(t?`Do what the operator chose, then tick the reminder off: remindctl complete ${e.id}`:"Leave the reminder open; it will come back at a later check-in."),r}var u={title:120,ask:300,answers:3},R=["resurface","bring-back","weekly","cleanup"],k={perDay:5,resurface:3},le=[/\bhttps?:\/\/\S+/gi,/(?:[\w.-]+\/)*[\w.-]+[#!]\d+\b/g,/[#!]\d+\b/g,/\b[0-9A-HJKMNP-TV-Z]{26}\b/gi,/\b(?:req|dlg|snd)-[\w-]+/gi,/\b(?=[0-9a-f]*\d)(?=[0-9a-f]*[a-f])[0-9a-f]{7,}\b/gi];function ge(e){return le.reduce((t,n)=>t.replace(n," "),e)}function X(e){let t=ge(e);return t===e||t.split(/\s+/).filter(r=>/\p{L}/u.test(r)).length>=2?null:`title is only a reference ("${e.trim()}"); say what it is in plain words, and put the link in the body or source`}function Q(e){let t=typeof e.title=="string"?e.title:"",n=typeof e.ask=="string"?e.ask:"";if(!t.trim())return"title is missing: say what it is in plain words";if(t.length>u.title)return`title is longer than ${u.title} characters`;let r=X(t);return r||(n.trim()?n.length>u.ask?`ask is longer than ${u.ask} characters`:(n.match(/\?/g)??[]).length>1?"ask holds more than one question: one card asks one thing":(e.choices?.length??0)>u.answers?`more than ${u.answers} choices`:null:"ask is missing: one card asks one thing")}function Fe(e,t){if(e.length>u.title)return`title is longer than ${u.title} characters`;let n=X(e);return n||(t.length>u.ask?`message is longer than ${u.ask} characters`:null)}function Pe(e,t){let n=t?.trim().replace(/\s+/g," ")||"nothing, FYI";return`${e}
9
- To do: ${n}`}function pe(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function Z(e,t,n){let r=pe(n),i=e.filter(o=>o.followup&&Date.parse(o.created_at)>=r);return i.length>=k.perDay?`the follow-up screen budget is used up today (${k.perDay} cards): raise it again tomorrow`:t==="resurface"&&i.filter(o=>o.followup==="resurface").length>=k.resurface?`${k.resurface} resurface cards were already raised today: raise it again tomorrow`:null}function Be(e,t){let n=e.title?.trim();return e.origin?.kind==="request"?[`[screen gate] Request ${e.id}${n?` ("${n}")`:""} was not shown to the owner: ${t}.`,`It is still on his list. Say what it is: agentx_request {action:"describe", id:"${e.id}", headline:"<a few plain words>", need:"<what you need from him>"}.`].join(" "):[`[screen gate] Your card ${e.id}${n?` ("${n}")`:""} was not shown to the owner: ${t}.`,"It is still in his inbox, unchanged. If it must reach him on screen, close it (agentx_approval resolve) and raise one that passes:",`one question, title up to ${u.title} characters, ask up to ${u.ask}, at most ${u.answers} choices.`].join(" ")}var ne=["discard","keep","pause"];function T(e){return e==="approve"?"keep":ne.includes(e)?e:null}var g={title:120,ask:300,recommend:300,source:500,note:500,resolution:300,pendingPerAgent:25},xe={defaultExpiryDays:3,maxExpiryDays:30};function x(e){return re(e,".agentx","approvals")}var be=/^[a-z0-9][a-z0-9-]{0,80}$/;function ie(e){return be.test(e)}function L(e,t){if(!ie(t))throw new Error(`invalid card id: ${t}`);return re(x(e),`${t}.json`)}function _e(e,t){let n=new Date(e).toISOString().slice(0,10),r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return`${n}-${r||"card"}-${Math.random().toString(36).slice(2,6).padEnd(4,"0")}`}function b(e,t){ee(x(e),{recursive:!0});let n=L(e,t.id),r=`${n}.${process.pid}.tmp`;te(r,JSON.stringify(t,null,2)+`
10
- `),ke(r,n)}function $e(e,t){ee(x(e),{recursive:!0});for(let n=1;;n++){let r=n===1?t:{...t,id:`${t.id}-${n}`},i=L(e,r.id),o=`${i}.${process.pid}.tmp`;te(o,JSON.stringify(r,null,2)+`
11
- `);try{return he(o,i),r}catch(s){if(s.code!=="EEXIST")throw s}finally{me(o)}}}function _(e,t){if(!ie(t))return null;try{let n=JSON.parse(ye(L(e,t),"utf-8")),r=n.if_silent==="approve"||n.outcome==="approve";return{...n,if_silent:T(n.if_silent)??"keep",...n.outcome?{outcome:T(n.outcome)??"keep"}:{},...r?{if_silent_asked:"approve"}:{}}}catch{return null}}function m(e,t){let n=x(e);if(!fe(n))return[];let r=[];for(let i of we(n).filter(o=>o.endsWith(".json")&&!o.startsWith("_")).sort()){let o=_(e,i.slice(0,-5));o&&(!t||o.status===t)&&r.push(o)}return r}function a(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function Se(e,t,n){let r=t+n.maxExpiryDays*864e5,i,o=a(e);if(!o)i=t+n.defaultExpiryDays*864e5;else{let s=/^(\d+)\s*([hd])$/i.exec(o);if(s)i=t+Number(s[1])*(s[2].toLowerCase()==="d"?864e5:36e5);else if(i=Date.parse(o),Number.isNaN(i))return{ok:!1,error:`expires must be an ISO date or time, or like "12h" / "3d" (got "${o}")`}}return i<=t?{ok:!1,error:"expires must be in the future"}:{ok:!0,at:new Date(Math.min(i,r)).toISOString()}}function Ce(e,t={}){let n=t.now??Date.now(),r=t.settings??xe,i=a(e.title),o=a(e.ask),s=a(e.recommend),d=a(e.raised_by);if(!i)return{ok:!1,error:"title is required"};if(!o)return{ok:!1,error:"ask is required: the yes/no question"};if(!s)return{ok:!1,error:"recommend is required: your advice and why, in one line"};if(!d)return{ok:!1,error:"raised_by is required: the agent id"};if(i.length>g.title)return{ok:!1,error:`title is longer than ${g.title} characters`};if(o.length>g.ask)return{ok:!1,error:`ask is longer than ${g.ask} characters`};if(s.length>g.recommend)return{ok:!1,error:`recommend is longer than ${g.recommend} characters`};let l=a(e.if_silent).toLowerCase(),p=T(l);if(!p)return{ok:!1,error:`if_silent must be one of ${ne.join(", ")}`};let c=Se(e.expires,n,r);if(!c.ok)return c;let h=a(e.source);if(h.length>g.source)return{ok:!1,error:`source is longer than ${g.source} characters`};if(h&&/^[a-z][a-z0-9+.-]*:/i.test(h)&&!/^https?:\/\//i.test(h))return{ok:!1,error:"source must be an http(s) link or a plain reference"};let $=A(e);if(!$.ok)return $;let w=a(e.followup).toLowerCase();if(w&&!R.includes(w))return{ok:!1,error:`followup must be one of ${R.join(", ")}`};let S,f=e.reply;return f&&typeof f=="object"&&a(f.channel)&&a(f.chatId)&&(S={channel:a(f.channel),chatId:a(f.chatId),...a(f.accountId)?{accountId:a(f.accountId)}:{}}),{ok:!0,card:{id:_e(n,i),title:i,ask:o,recommend:s,if_silent:p,...l==="approve"?{if_silent_asked:"approve"}:{},expires:c.at,...h?{source:h}:{},raised_by:d,...t.node?{node:t.node}:{},created_at:new Date(n).toISOString(),...S?{reply:S}:{},...$.value,...t.origin?{origin:t.origin}:{},...w?{followup:w}:{},...t.popupOnly?{popup_only:!0}:{},status:"pending"}}}function Oe(e,t){if(!(!t.source||t.origin))return e.find(n=>!n.origin&&n.source===t.source&&n.raised_by===t.raised_by&&(n.node??"")===(t.node??""))}function Je(e,t,n={}){let r=Ce(t,n);if(!r.ok)return r;let i=Q(r.card);if(i)return{ok:!1,error:i};if(r.card.followup){let c=Z(m(e),r.card.followup,n.now??Date.now());if(c)return{ok:!1,error:c}}let o=m(e,"pending"),s=Oe(o,r.card);if(s)return{ok:!1,error:`a card from you on this source is still pending: ${s.id}. Wait for its answer, or resolve it first and then raise the new one.`};let d=c=>D(c.origin),l=d(r.card),p=o.filter(c=>c.raised_by===r.card.raised_by&&d(c)===l).length;if(p>=g.pendingPerAgent){let c=l?"retro cards":"cards";return{ok:!1,error:`${r.card.raised_by} already has ${p} ${c} waiting; wait for decisions before raising more`}}return{ok:!0,card:$e(e,r.card)}}var ve="this card takes a yes only in the popup on the home machine; here it can only be answered no";function Ge(e,t,n,r={}){let i=_(e,t);if(!i)return{ok:!1,error:`no card "${t}"`};if(i.status!=="pending")return{ok:!1,error:`card "${t}" is already ${i.status}`};if(i.popup_only&&n==="yes"&&!r.popup)return{ok:!1,error:ve};let o=F(i,n,r);if(!o.ok)return o;let s=n==="yes"&&P(o.choice)&&!D(i.origin),d=s?"no":n,l=a(r.note).slice(0,g.note),p={...i,status:"decided",verdict:d,decided_by:r.by??"operator",...r.popup?{decided_from:"popup"}:{},decided_at:new Date(r.now??Date.now()).toISOString(),...l?{note:l}:{},...o.choice?{choice:o.choice}:{},...o.suggested?{choice_suggested:!0}:{},...o.text&&!s?{text:o.text}:{}};return b(e,p),{ok:!0,card:p}}var Ie=new Set([void 0,"reminder"]);function ze(e,t,n){let r=_(e,t);if(!r)return{ok:!1,status:404,error:`no card "${t}"`};if(r.raised_by!==n.by||(r.node??"")!==(n.node??"")){let d=r.node?`${r.raised_by} on node "${r.node}"`:r.raised_by,l=r.node?"it closes it through its own node's daemon":"it closes it from one of its running turns";return{ok:!1,status:403,error:`card "${t}" was raised by another agent (${d}): only that agent can close it (${l}), or the operator answers it in Approvals`}}if(!Ie.has(r.origin?.kind))return{ok:!1,status:409,error:`card "${t}" is answered by the operator only`};if(r.status!=="pending")return{ok:!1,status:409,error:`card "${t}" is already ${r.status}`};let i=a(n.reason);if(!i)return{ok:!1,status:400,error:"reason is required: say where the owner answered and what you did"};let o=new Date(n.now??Date.now()).toISOString(),s={...r,status:"resolved",decided_by:n.by,decided_at:o,resolution:i.slice(0,g.resolution),agent_notified_at:o};return b(e,s),U(e,{key:`card:${t}`,kind:"card",title:r.title,raised_by:r.raised_by,answer:"closed",text:s.resolution,by:n.node?`${n.by} on ${n.node}`:n.by,at:o}),{ok:!0,card:s}}function He(e,t=Date.now()){let n=[];for(let r of m(e,"pending")){if(Date.parse(r.expires)>t)continue;let i={...r,status:"expired",outcome:r.if_silent,decided_by:"expiry",decided_at:new Date(t).toISOString()};b(e,i),n.push(i)}return n}function Xe(e){return m(e).filter(t=>t.status!=="pending"&&!t.agent_notified_at)}function Qe(e,t,n=Date.now()){let r=_(e,t);!r||r.agent_notified_at||b(e,{...r,agent_notified_at:new Date(n).toISOString()})}var De="A no does not by itself undo anything you already did. If you already carried this out (for example because the owner approved it in chat), do not reverse it: ask the requester one clear question first.";function Ze(e){let t=e.origin?.kind==="retro"?e.origin:void 0,n=e.status==="decided"?e.verdict==="yes"?t&&!E(e)?`The operator picked "${N}", which counts as NO.`:"The operator said YES.":"The operator said NO.":`Nobody answered before it expired, so the default applied: ${e.outcome??e.if_silent}.`,r=[`[Approval result] Your decision card "${e.title}" (${e.id}) is closed.`,`Question: ${e.ask}`,n],i=e.origin?.kind==="retro-check"?e.origin:void 0;if(e.status==="decided"&&e.verdict==="yes"&&!t&&!i&&r.push(...B(e)),e.status==="decided"&&e.verdict==="no"&&e.choice&&!t&&!i&&r.push(`Chosen: ${e.choice} (this option means no; do not send or do it)`),e.note&&r.push(`Operator note: ${e.note}`),e.status==="decided"&&e.verdict==="no"&&!t&&!i&&r.push(De),e.source&&r.push(`Source: ${e.source}`),e.origin?.kind==="reminder"&&r.push(...H(e.origin,e.status==="decided"&&e.verdict==="yes")),e.origin?.kind==="number"&&r.push(...Y(e.origin,e)),t||i){let o=l=>l.replace(/\s+/g," ").trim(),s=q(e.draft,e.choice),d=e.text&&o(e.text)!==o(s)?e.text:void 0;r.push(...t?z(t,e,d):J(i,e,d))}return e.reply&&r.push(`You raised it from ${e.reply.channel} chat ${e.reply.chatId}; reply there if the requester should know.`),e.node&&r.push(`The operator answered it on another machine; the card was forwarded from ${e.node}.`),r.push("Act on this result now. Do not raise the same card again."),r.join(`
12
- `)}export{U as a,de as b,Te as c,Ae as d,D as e,V as f,E as g,N as h,X as i,Q as j,Fe as k,Pe as l,Be as m,ne as n,g as o,x as p,ie as q,b as r,_ as s,m as t,Je as u,Ge as v,ze as w,He as x,Xe as y,Qe as z,Ze as A};
13
- //# sourceMappingURL=chunk-BXK5S2KK.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/approvals/cards.ts","../src/approvals/answered.ts","../src/approvals/origin.ts","../src/approvals/screen-gate.ts"],"sourcesContent":["import { existsSync, linkSync, mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from \"fs\"\nimport { resolve } from \"path\"\nimport { recordAnswered } from \"./answered\"\nimport { answerLines, buildChoices, draftFor, isNoChoice, resolveAnswer, type CardChoices } from \"./choices\"\nimport { isRetroOrigin, numberLines, originLines, RETRO_NONE, retroApproved, retroCheckLines, retroLines, type CardOrigin } from \"./origin\"\nimport { cardRuleBreak, FOLLOWUP_KINDS, followupBudgetRefusal, type FollowupKind } from \"./screen-gate\"\n\n// --- Decision cards: what an agent asks the operator ---\n//\n// An agent that needs a yes/no from the operator writes a card instead of\n// asking in chat. A card says what it is, the question, what the agent\n// recommends, and what happens if nobody answers by `expires`. Nothing\n// waits forever: past `expires` the daemon applies `if_silent` (sweep.ts).\n//\n// Storage: one JSON file per card under `.agentx/approvals/`, written\n// atomically, like wiki proposals. The CLI, the dashboard and the daemon\n// are separate processes and all read the same files.\n//\n// Field names match the API (`if_silent`, `raised_by`), so a stored card is\n// exactly what `POST /approvals` accepted.\n\n// No card approves itself (#741): only the operator says yes. \"approve\",\n// which older agents and stored cards may still carry, is read as \"keep\".\nexport type IfSilent = \"discard\" | \"keep\" | \"pause\"\nexport const IF_SILENT_VALUES: readonly IfSilent[] = [\"discard\", \"keep\", \"pause\"]\n\nfunction asIfSilent(v: string): IfSilent | null {\n if (v === \"approve\") return \"keep\"\n return IF_SILENT_VALUES.includes(v as IfSilent) ? (v as IfSilent) : null\n}\n\n// \"resolved\": closed by the agent that raised it, because the owner gave the\n// same answer somewhere else (in chat, #909) and the agent already acted on\n// it. Not a verdict: nothing is approved or rejected by it.\nexport type CardStatus = \"pending\" | \"decided\" | \"expired\" | \"resolved\"\nexport type Verdict = \"yes\" | \"no\"\n\n/** Where the agent was asked, so the verdict can be taken back there. */\nexport interface ReplyTarget {\n channel: string\n chatId: string\n accountId?: string\n}\n\nexport interface DecisionCard extends CardChoices {\n id: string\n title: string\n ask: string\n recommend: string\n if_silent: IfSilent\n /** ISO time the default applies. Always set. */\n expires: string\n /** Link to the draft, PR or issue. */\n source?: string\n raised_by: string\n /** The mesh node the raising agent is on, when the card was forwarded\n * here from there (forward.ts, #668). Unset: this node. */\n node?: string\n created_at: string\n reply?: ReplyTarget\n status: CardStatus\n /** The operator's answer (status \"decided\"). */\n verdict?: Verdict\n /** What applied on expiry (status \"expired\"). */\n outcome?: IfSilent\n /** Set when the agent, or a card stored before #741, asked for\n * \"approve\" on expiry; `if_silent` then holds \"keep\". Kept so the\n * record still shows what was originally asked. */\n if_silent_asked?: \"approve\"\n decided_by?: string\n /** \"popup\" when the answer was clicked in the daemon's popup on this\n * machine. Unset for every other way in: the dashboard (even opened\n * here), the CLI, a phone, a mesh peer or a channel reply (#1478). */\n decided_from?: \"popup\"\n /** A yes counts only from the popup (owner sign-in, #1478): every other\n * way in can say no, never yes. Set by the daemon, never from input. */\n popup_only?: true\n decided_at?: string\n note?: string\n /** The option the operator picked, when the card offered choices. */\n choice?: string\n /** Set when `choice` came from a plain yes taking the suggested option\n * (#1064), not from the operator picking it. */\n choice_suggested?: boolean\n /** The message the operator approved, after any edit. */\n text?: string\n /** Set once the raising agent has been told the result. */\n agent_notified_at?: string\n /** Why the raising agent closed it (status \"resolved\"). */\n resolution?: string\n /** What the card is about, when the daemon raised it (origin.ts). */\n origin?: CardOrigin\n /** A follow-up card (#394): counted in the daily screen budget. */\n followup?: FollowupKind\n}\n\nexport const CARD_LIMITS = {\n title: 120,\n ask: 300,\n recommend: 300,\n source: 500,\n note: 500,\n resolution: 300,\n /** Pending cards one agent may have open at a time. */\n pendingPerAgent: 25,\n} as const\n\nexport interface CardSettings {\n defaultExpiryDays: number\n maxExpiryDays: number\n}\n\nexport const DEFAULT_CARD_SETTINGS: CardSettings = { defaultExpiryDays: 3, maxExpiryDays: 30 }\n\nexport function approvalsDir(root: string): string {\n return resolve(root, \".agentx\", \"approvals\")\n}\n\nconst CARD_ID_RE = /^[a-z0-9][a-z0-9-]{0,80}$/\n\nexport function isValidCardId(id: string): boolean {\n return CARD_ID_RE.test(id)\n}\n\nfunction fileFor(root: string, id: string): string {\n if (!isValidCardId(id)) throw new Error(`invalid card id: ${id}`)\n return resolve(approvalsDir(root), `${id}.json`)\n}\n\nexport function newCardId(now: number, title: string): string {\n const day = new Date(now).toISOString().slice(0, 10)\n const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\").slice(0, 40)\n return `${day}-${slug || \"card\"}-${Math.random().toString(36).slice(2, 6).padEnd(4, \"0\")}`\n}\n\nexport function saveCard(root: string, card: DecisionCard): void {\n mkdirSync(approvalsDir(root), { recursive: true })\n const path = fileFor(root, card.id)\n const tmp = `${path}.${process.pid}.tmp`\n writeFileSync(tmp, JSON.stringify(card, null, 2) + \"\\n\")\n renameSync(tmp, path)\n}\n\n/**\n * Save a card that is new. Its id is random, so two cards with the same\n * title on the same day can draw the same one: then the id gets \"-2\", \"-3\"\n * and so on, and a card already on disk is never overwritten. The link\n * fails if the file exists, so this holds across processes too.\n */\nfunction saveNewCard(root: string, card: DecisionCard): DecisionCard {\n mkdirSync(approvalsDir(root), { recursive: true })\n for (let n = 1; ; n++) {\n const saved = n === 1 ? card : { ...card, id: `${card.id}-${n}` }\n const path = fileFor(root, saved.id)\n const tmp = `${path}.${process.pid}.tmp`\n writeFileSync(tmp, JSON.stringify(saved, null, 2) + \"\\n\")\n try {\n linkSync(tmp, path)\n return saved\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code !== \"EEXIST\") throw e\n } finally {\n unlinkSync(tmp)\n }\n }\n}\n\nexport function readCard(root: string, id: string): DecisionCard | null {\n if (!isValidCardId(id)) return null\n try {\n const card = JSON.parse(readFileSync(fileFor(root, id), \"utf-8\")) as DecisionCard\n // A card that expired as \"approve\" before #741 is read as \"keep\" too, so\n // an agent not yet told never hears \"default applied: approve\".\n const legacy = (card.if_silent as string) === \"approve\" || (card.outcome as string) === \"approve\"\n return {\n ...card,\n if_silent: asIfSilent(card.if_silent) ?? \"keep\",\n ...(card.outcome ? { outcome: asIfSilent(card.outcome) ?? \"keep\" } : {}),\n ...(legacy ? { if_silent_asked: \"approve\" as const } : {}),\n }\n } catch {\n return null\n }\n}\n\n/** Cards, oldest first; only `status` ones when given. */\nexport function listCards(root: string, status?: CardStatus): DecisionCard[] {\n const dir = approvalsDir(root)\n if (!existsSync(dir)) return []\n const out: DecisionCard[] = []\n for (const f of readdirSync(dir).filter((f) => f.endsWith(\".json\") && !f.startsWith(\"_\")).sort()) {\n const c = readCard(root, f.slice(0, -5))\n if (c && (!status || c.status === status)) out.push(c)\n }\n return out\n}\n\nfunction oneLine(v: unknown): string {\n return typeof v === \"string\" ? v.replace(/\\s+/g, \" \").trim() : \"\"\n}\n\n/**\n * `expires` as given by an agent: an ISO date or time, or a relative\n * \"12h\" / \"3d\". Unset: the default. Always capped at maxExpiryDays, so a\n * card can't be parked for a year.\n */\nexport function resolveExpiry(input: unknown, now: number, settings: CardSettings): { ok: true; at: string } | { ok: false; error: string } {\n const max = now + settings.maxExpiryDays * 86_400_000\n let at: number\n const raw = oneLine(input)\n if (!raw) {\n at = now + settings.defaultExpiryDays * 86_400_000\n } else {\n const rel = /^(\\d+)\\s*([hd])$/i.exec(raw)\n if (rel) {\n at = now + Number(rel[1]) * (rel[2].toLowerCase() === \"d\" ? 86_400_000 : 3_600_000)\n } else {\n at = Date.parse(raw)\n if (Number.isNaN(at)) return { ok: false, error: `expires must be an ISO date or time, or like \"12h\" / \"3d\" (got \"${raw}\")` }\n }\n }\n if (at <= now) return { ok: false, error: \"expires must be in the future\" }\n return { ok: true, at: new Date(Math.min(at, max)).toISOString() }\n}\n\nexport interface CardInput {\n title?: unknown\n ask?: unknown\n recommend?: unknown\n if_silent?: unknown\n expires?: unknown\n source?: unknown\n raised_by?: unknown\n reply?: unknown\n choices?: unknown\n draft?: unknown\n say?: unknown\n context?: unknown\n followup?: unknown\n}\n\n/** Validate what an agent sent and build a pending card. Never saves. */\nexport interface BuildCardOptions {\n now?: number\n settings?: CardSettings\n origin?: CardOrigin\n /** The peer the card was forwarded from. The daemon sets it after\n * checking the name against its mesh peers; never taken as sent. */\n node?: string\n /** Set by the daemon only: see DecisionCard.popup_only. */\n popupOnly?: boolean\n}\n\nexport function buildCard(\n input: CardInput,\n opts: BuildCardOptions = {},\n): { ok: true; card: DecisionCard } | { ok: false; error: string } {\n const now = opts.now ?? Date.now()\n const settings = opts.settings ?? DEFAULT_CARD_SETTINGS\n const title = oneLine(input.title)\n const ask = oneLine(input.ask)\n const recommend = oneLine(input.recommend)\n const raisedBy = oneLine(input.raised_by)\n if (!title) return { ok: false, error: \"title is required\" }\n if (!ask) return { ok: false, error: \"ask is required: the yes/no question\" }\n if (!recommend) return { ok: false, error: \"recommend is required: your advice and why, in one line\" }\n if (!raisedBy) return { ok: false, error: \"raised_by is required: the agent id\" }\n if (title.length > CARD_LIMITS.title) return { ok: false, error: `title is longer than ${CARD_LIMITS.title} characters` }\n if (ask.length > CARD_LIMITS.ask) return { ok: false, error: `ask is longer than ${CARD_LIMITS.ask} characters` }\n if (recommend.length > CARD_LIMITS.recommend) return { ok: false, error: `recommend is longer than ${CARD_LIMITS.recommend} characters` }\n const ifSilentRaw = oneLine(input.if_silent).toLowerCase()\n const ifSilent = asIfSilent(ifSilentRaw)\n if (!ifSilent) {\n return { ok: false, error: `if_silent must be one of ${IF_SILENT_VALUES.join(\", \")}` }\n }\n const expiry = resolveExpiry(input.expires, now, settings)\n if (!expiry.ok) return expiry\n const source = oneLine(input.source)\n if (source.length > CARD_LIMITS.source) return { ok: false, error: `source is longer than ${CARD_LIMITS.source} characters` }\n if (source && /^[a-z][a-z0-9+.-]*:/i.test(source) && !/^https?:\\/\\//i.test(source)) {\n return { ok: false, error: \"source must be an http(s) link or a plain reference\" }\n }\n const extras = buildChoices(input)\n if (!extras.ok) return extras\n const followup = oneLine(input.followup).toLowerCase()\n if (followup && !(FOLLOWUP_KINDS as readonly string[]).includes(followup)) {\n return { ok: false, error: `followup must be one of ${FOLLOWUP_KINDS.join(\", \")}` }\n }\n let reply: ReplyTarget | undefined\n const r = input.reply as Record<string, unknown> | undefined\n if (r && typeof r === \"object\" && oneLine(r.channel) && oneLine(r.chatId)) {\n reply = { channel: oneLine(r.channel), chatId: oneLine(r.chatId), ...(oneLine(r.accountId) ? { accountId: oneLine(r.accountId) } : {}) }\n }\n return {\n ok: true,\n card: {\n id: newCardId(now, title),\n title,\n ask,\n recommend,\n if_silent: ifSilent,\n ...(ifSilentRaw === \"approve\" ? { if_silent_asked: \"approve\" as const } : {}),\n expires: expiry.at,\n ...(source ? { source } : {}),\n raised_by: raisedBy,\n ...(opts.node ? { node: opts.node } : {}),\n created_at: new Date(now).toISOString(),\n ...(reply ? { reply } : {}),\n ...extras.value,\n // Set by the daemon only (check-ins), never from what an agent sent.\n ...(opts.origin ? { origin: opts.origin } : {}),\n ...(followup ? { followup: followup as FollowupKind } : {}),\n ...(opts.popupOnly ? { popup_only: true as const } : {}),\n status: \"pending\",\n },\n }\n}\n\n/** A pending card the same agent, on the same node, raised on the same\n * source. None when the new card has no source or the daemon raised it. */\nfunction sameSourcePending(pending: DecisionCard[], card: DecisionCard): DecisionCard | undefined {\n if (!card.source || card.origin) return undefined\n return pending.find((c) =>\n !c.origin &&\n c.source === card.source &&\n c.raised_by === card.raised_by &&\n (c.node ?? \"\") === (card.node ?? \"\"))\n}\n\n/** Validate, enforce the per-agent cap, and save. */\nexport function createCard(\n root: string,\n input: CardInput,\n opts: BuildCardOptions = {},\n): { ok: true; card: DecisionCard } | { ok: false; error: string } {\n const built = buildCard(input, opts)\n if (!built.ok) return built\n // The screen gate (#394): refused here, the reason goes back to the author.\n const broken = cardRuleBreak(built.card)\n if (broken) return { ok: false, error: broken }\n if (built.card.followup) {\n const full = followupBudgetRefusal(listCards(root), built.card.followup, opts.now ?? Date.now())\n if (full) return { ok: false, error: full }\n }\n const pending = listCards(root, \"pending\")\n // One open question per source: the same question raised twice comes\n // back after it was answered. Only for cards an agent raised; cards the\n // daemon raises (origin set) keep their own rules, such as a merge card\n // per pushed commit on the same PR link.\n const twin = sameSourcePending(pending, built.card)\n if (twin) {\n return { ok: false, error: `a card from you on this source is still pending: ${twin.id}. Wait for its answer, or resolve it first and then raise the new one.` }\n }\n // Retro cards are raised for an agent, not by it: they get their own\n // count, so they never use up the agent's room for its own cards.\n const isRetro = (c: { origin?: CardOrigin }) => isRetroOrigin(c.origin)\n const retro = isRetro(built.card)\n const open = pending.filter((c) => c.raised_by === built.card.raised_by && isRetro(c) === retro).length\n if (open >= CARD_LIMITS.pendingPerAgent) {\n const what = retro ? \"retro cards\" : \"cards\"\n return { ok: false, error: `${built.card.raised_by} already has ${open} ${what} waiting; wait for decisions before raising more` }\n }\n return { ok: true, card: saveNewCard(root, built.card) }\n}\n\nexport const POPUP_ONLY = \"this card takes a yes only in the popup on the home machine; here it can only be answered no\"\n\n/** Record the operator's answer. Refuses anything no longer pending, and a\n * yes on a popup-only card from anywhere but the popup. */\nexport function decideCard(\n root: string,\n id: string,\n verdict: Verdict,\n opts: { by?: string; note?: string; now?: number; choice?: string | number; text?: string; popup?: boolean } = {},\n): { ok: true; card: DecisionCard } | { ok: false; error: string } {\n const card = readCard(root, id)\n if (!card) return { ok: false, error: `no card \"${id}\"` }\n if (card.status !== \"pending\") return { ok: false, error: `card \"${id}\" is already ${card.status}` }\n if (card.popup_only && verdict === \"yes\" && !opts.popup) return { ok: false, error: POPUP_ONLY }\n const answer = resolveAnswer(card, verdict, opts)\n if (!answer.ok) return answer\n // A yes with an option that means no (\"Don't send\") is a no (#1788): the\n // pick is kept, the text is dropped, so nothing reads as \"send this\".\n // Retro cards keep their own rule for their none-option (origin.ts).\n const saysNo = verdict === \"yes\" && isNoChoice(answer.choice) && !isRetroOrigin(card.origin)\n const final: Verdict = saysNo ? \"no\" : verdict\n const note = oneLine(opts.note).slice(0, CARD_LIMITS.note)\n const decided: DecisionCard = {\n ...card,\n status: \"decided\",\n verdict: final,\n decided_by: opts.by ?? \"operator\",\n ...(opts.popup ? { decided_from: \"popup\" as const } : {}),\n decided_at: new Date(opts.now ?? Date.now()).toISOString(),\n ...(note ? { note } : {}),\n ...(answer.choice ? { choice: answer.choice } : {}),\n ...(answer.suggested ? { choice_suggested: true } : {}),\n ...(answer.text && !saysNo ? { text: answer.text } : {}),\n }\n saveCard(root, decided)\n return { ok: true, card: decided }\n}\n\n/** Cards whose answer the daemon acts on itself (a workflow run, a plan\n * step, a retro): only the operator closes those. A reminder card is the\n * agent's own to act on, so it may close it like one it raised. */\nconst AGENT_RESOLVABLE_ORIGINS = new Set<string | undefined>([undefined, \"reminder\"])\n\n/**\n * The raising agent closes its own pending card: the owner gave the same\n * answer outside the card (in chat) and the agent has acted on it (#909).\n * The card leaves the inbox, so no check-in or popup asks again. It is not\n * a verdict, and the agent is not sent a result for it: it already knows.\n */\nexport function resolveCard(\n root: string,\n id: string,\n opts: { by: string; reason?: unknown; node?: string; now?: number },\n): { ok: true; card: DecisionCard } | { ok: false; status: 400 | 403 | 404 | 409; error: string } {\n const card = readCard(root, id)\n if (!card) return { ok: false, status: 404, error: `no card \"${id}\"` }\n if (card.raised_by !== opts.by || (card.node ?? \"\") !== (opts.node ?? \"\")) {\n // Name the raiser, so the caller knows who can close it (#1405).\n const who = card.node ? `${card.raised_by} on node \"${card.node}\"` : card.raised_by\n const how = card.node ? \"it closes it through its own node's daemon\" : \"it closes it from one of its running turns\"\n return { ok: false, status: 403, error: `card \"${id}\" was raised by another agent (${who}): only that agent can close it (${how}), or the operator answers it in Approvals` }\n }\n if (!AGENT_RESOLVABLE_ORIGINS.has(card.origin?.kind)) {\n return { ok: false, status: 409, error: `card \"${id}\" is answered by the operator only` }\n }\n if (card.status !== \"pending\") return { ok: false, status: 409, error: `card \"${id}\" is already ${card.status}` }\n const reason = oneLine(opts.reason)\n if (!reason) return { ok: false, status: 400, error: \"reason is required: say where the owner answered and what you did\" }\n const at = new Date(opts.now ?? Date.now()).toISOString()\n const resolved: DecisionCard = {\n ...card,\n status: \"resolved\",\n decided_by: opts.by,\n decided_at: at,\n resolution: reason.slice(0, CARD_LIMITS.resolution),\n agent_notified_at: at,\n }\n saveCard(root, resolved)\n // On the Wall's Answered tab too, whichever way the close came (#1440).\n recordAnswered(root, {\n key: `card:${id}`, kind: \"card\", title: card.title, raised_by: card.raised_by, answer: \"closed\",\n text: resolved.resolution, by: opts.node ? `${opts.by} on ${opts.node}` : opts.by, at,\n })\n return { ok: true, card: resolved }\n}\n\n/** Apply `if_silent` to every pending card past its expiry. */\nexport function expireCards(root: string, now: number = Date.now()): DecisionCard[] {\n const out: DecisionCard[] = []\n for (const card of listCards(root, \"pending\")) {\n if (Date.parse(card.expires) > now) continue\n const expired: DecisionCard = {\n ...card,\n status: \"expired\",\n outcome: card.if_silent,\n decided_by: \"expiry\",\n decided_at: new Date(now).toISOString(),\n }\n saveCard(root, expired)\n out.push(expired)\n }\n return out\n}\n\n/** Decided or expired cards whose agent hasn't been told yet. */\nexport function cardsAwaitingAgentNotice(root: string): DecisionCard[] {\n return listCards(root).filter((c) => c.status !== \"pending\" && !c.agent_notified_at)\n}\n\nexport function markAgentNotified(root: string, id: string, now: number = Date.now()): void {\n const card = readCard(root, id)\n if (!card || card.agent_notified_at) return\n saveCard(root, { ...card, agent_notified_at: new Date(now).toISOString() })\n}\n\nexport const NO_UNDO_LINE =\n \"A no does not by itself undo anything you already did. If you already carried this out (for example because the owner approved it in chat), do not reverse it: ask the requester one clear question first.\"\n\n/** What the raising agent is told. Plain text, one short message. */\nexport function verdictMessage(card: DecisionCard): string {\n const retro = card.origin?.kind === \"retro\" ? card.origin : undefined\n const result = card.status === \"decided\"\n ? (card.verdict === \"yes\"\n ? (retro && !retroApproved(card) ? `The operator picked \"${RETRO_NONE}\", which counts as NO.` : \"The operator said YES.\")\n : \"The operator said NO.\")\n : `Nobody answered before it expired, so the default applied: ${card.outcome ?? card.if_silent}.`\n const lines = [\n `[Approval result] Your decision card \"${card.title}\" (${card.id}) is closed.`,\n `Question: ${card.ask}`,\n result,\n ]\n // A retro card's pick and spec go through retroLines, labelled as the\n // reviewer's proposal: never \"Approved text (send exactly this)\".\n const check = card.origin?.kind === \"retro-check\" ? card.origin : undefined\n if (card.status === \"decided\" && card.verdict === \"yes\" && !retro && !check) lines.push(...answerLines(card))\n if (card.status === \"decided\" && card.verdict === \"no\" && card.choice && !retro && !check) lines.push(`Chosen: ${card.choice} (this option means no; do not send or do it)`)\n if (card.note) lines.push(`Operator note: ${card.note}`)\n // A late no on something the owner already approved in chat must not\n // quietly undo work that is done (#909).\n if (card.status === \"decided\" && card.verdict === \"no\" && !retro && !check) lines.push(NO_UNDO_LINE)\n if (card.source) lines.push(`Source: ${card.source}`)\n if (card.origin?.kind === \"reminder\") lines.push(...originLines(card.origin, card.status === \"decided\" && card.verdict === \"yes\"))\n if (card.origin?.kind === \"number\") lines.push(...numberLines(card.origin, card))\n if (retro || check) {\n // Compare ignoring whitespace so a dashboard that only reflows the draft\n // does not resend the whole draft as the operator's note.\n const squash = (s: string) => s.replace(/\\s+/g, \" \").trim()\n const draft = draftFor(card.draft, card.choice)\n const edited = card.text && squash(card.text) !== squash(draft) ? card.text : undefined\n lines.push(...(retro ? retroLines(retro, card, edited) : retroCheckLines(check!, card, edited)))\n }\n if (card.reply) lines.push(`You raised it from ${card.reply.channel} chat ${card.reply.chatId}; reply there if the requester should know.`)\n if (card.node) lines.push(`The operator answered it on another machine; the card was forwarded from ${card.node}.`)\n lines.push(\"Act on this result now. Do not raise the same card again.\")\n return lines.join(\"\\n\")\n}\n","import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from \"fs\"\nimport { resolve } from \"path\"\nimport { logger } from \"@/utils/logger\"\n\n// --- What the owner answered, across every kind (#1440) ---\n//\n// Each source keeps its own decision (the card file, the schedule, the\n// memory fact, the wiki proposal, the draft). This is only the list the\n// Wall's Answered tab reads: one line per yes or no that went through\n// decide() (inbox.ts), whichever surface sent it, and one per card its\n// agent closed (resolveCard, cards.ts). A close is the agent's word: the\n// owner may have answered elsewhere, or the agent may have withdrawn the\n// card. Reviews and request replies do not pass through decide() and are\n// not listed. \"Later\" is not an answer. It starts empty: `_answered.since` keeps the\n// day it started, so the page can say so.\n\nexport interface AnsweredItem {\n key: string\n kind: string\n title: string\n raised_by: string\n /** \"closed\": the agent that raised the card closed it (resolveCard). */\n answer: \"yes\" | \"no\" | \"closed\"\n /** Cards with choices: the one picked. */\n choice?: string\n /** The short answer: the owner's text, or the agent's reason for closing. */\n text?: string\n by: string\n at: string\n}\n\n/** Lines kept: the oldest go once the file passes this. */\nconst KEEP = 500\n/** Free text kept per line. */\nconst TEXT_MAX = 200\n\n// approvalsDir (cards.ts), not imported: cards.ts records here.\nconst dir = (root: string) => resolve(root, \".agentx\", \"approvals\")\nconst answeredFile = (root: string) => resolve(dir(root), \"_answered.jsonl\")\nconst sinceFile = (root: string) => resolve(dir(root), \"_answered.since\")\nconst cap = (s: string | undefined) => (s && s.length > TEXT_MAX ? s.slice(0, TEXT_MAX - 1) + \"…\" : s)\n\n/** Never throws: the answer stands, the list is only a view of it. */\nexport function recordAnswered(root: string, item: AnsweredItem): void {\n try {\n answeredSince(root)\n const line: AnsweredItem = { ...item, title: cap(item.title) ?? \"\" }\n if (item.choice) line.choice = cap(item.choice)\n if (item.text) line.text = cap(item.text)\n else delete line.text\n const path = answeredFile(root)\n appendFileSync(path, JSON.stringify(line) + \"\\n\")\n const lines = readFileSync(path, \"utf-8\").split(\"\\n\").filter(Boolean)\n if (lines.length > KEEP) writeFileSync(path, lines.slice(-KEEP).join(\"\\n\") + \"\\n\")\n } catch (e: any) {\n logger.warn(`[approvals] answered list not written for ${item.key}: ${e?.message ?? e}`)\n }\n}\n\n/** The day the list started: written by the first answer or the first read. */\nexport function answeredSince(root: string): string {\n const path = sinceFile(root)\n try {\n const at = readFileSync(path, \"utf-8\").trim()\n if (at) return at\n } catch {\n // Not written yet: this is the start.\n }\n const at = new Date().toISOString()\n try {\n mkdirSync(dir(root), { recursive: true })\n writeFileSync(path, at + \"\\n\")\n } catch (e: any) {\n logger.warn(`[approvals] answered start not written: ${e?.message ?? e}`)\n }\n return at\n}\n\n/** Newest first, at most `limit`. A line that does not parse is skipped. */\nexport function readAnswered(root: string, limit = 50): AnsweredItem[] {\n const path = answeredFile(root)\n if (!existsSync(path)) return []\n const out: AnsweredItem[] = []\n let lines: string[]\n try {\n lines = readFileSync(path, \"utf-8\").split(\"\\n\").filter(Boolean)\n } catch (e: any) {\n logger.warn(`[approvals] answered list not read: ${e?.message ?? e}`)\n return []\n }\n for (let i = lines.length - 1; i >= 0 && out.length < limit; i--) {\n try {\n const v = JSON.parse(lines[i])\n if (v && typeof v.key === \"string\" && typeof v.at === \"string\") out.push(v)\n } catch {\n // A torn last line from a crash mid-write: the rest still reads.\n }\n }\n return out\n}\n","// --- Where a card came from, when the daemon raised it ---\n//\n// Agents raise most cards themselves. A check-in (checkin.ts) raises one on\n// an agent's behalf for an open Apple Reminder, and records the reminder\n// here so the agent that gets the answer knows what to act on and what to\n// tick off. Only the daemon sets it: POST /approvals and the agent tool\n// never pass it through.\n\nexport interface ReminderOrigin {\n kind: \"reminder\"\n /** The reminder's full id, as remindctl prints it. */\n id: string\n title: string\n list?: string\n}\n\n/** An open request that needs attention, shown as a card on the Mac\n * (popup-runner.ts). Never stored: the request is the record. */\nexport interface RequestOrigin {\n kind: \"request\"\n id: string\n}\n\n/** A retro card (src/retro): fixes to the agents' environment proposed\n * from one run that struggled. The answer goes back to the agent that ran\n * it, which builds the picked fix for a second review. */\nexport interface RetroOrigin {\n kind: \"retro\"\n /** The run the retro read. */\n taskId: string\n /** Failure signature (wiki/failure-candidates.ts), for one card per signature. */\n signature: string\n /** The reviewer's spec for each fix, in the order of the card's choices\n * (without \"None of these\"). Only the picked one reaches the agent. */\n specs?: string[]\n}\n\n/** A monthly review of a check a retro added (src/retro/checks.ts): a\n * guard rule tagged `retro:<taskId>` that fires often on runs that went\n * well. The answer goes back to the agent that built it, which keeps,\n * loosens or removes it for a second review. */\nexport interface RetroCheckOrigin {\n kind: \"retro-check\"\n /** The guard rule's id. */\n ruleId: string\n /** The run whose retro asked for the rule. */\n taskId: string\n /** The policy file that holds the rule, relative to the daemon's folder. */\n file: string\n}\n\n/** A step of a workflow run asks the owner (src/workflows, #788): an\n * owner.ask step, a person.message to approve, or a run's approval at\n * start. The answer resumes the run; the agent that started it is not\n * told separately, the run is. */\nexport interface WorkflowOrigin {\n kind: \"workflow\"\n runId: string\n nodeId: string\n}\n\n/** An agent proposed a reusable workflow (#788). Yes turns it on. */\nexport interface WorkflowProposalOrigin {\n kind: \"workflow-proposal\"\n workflowId: string\n}\n\n/** A step of a tracked plan the owner approves when the plan is made\n * (src/requests/plan-sweep.ts, #788). The plan check reads the answer\n * and acts on it; the agent is not sent a result turn. */\nexport interface PlanStepOrigin {\n kind: \"plan-step\"\n requestId: string\n step: number\n}\n\n/** A pull request that changes core paths waits for the owner (merge\n * policy, #1047). YES approves that one commit; the policy reads the\n * answer and updates the PR's status. No agent is sent a result turn. */\nexport interface MergePolicyOrigin {\n kind: \"merge-policy\"\n repo: string\n pr: number\n sha: string\n}\n\n/** The owner asked an agent in chat to change the org chart (#1678). The\n * changes are kept beside the card (business/org-proposals.ts); YES makes\n * the daemon apply them, and the agent is told what happened. */\nexport interface OrgProposalOrigin {\n kind: \"org-proposal\"\n}\n\n/** A write tool of an MCP server with an allow list waits for the owner\n * (agent/mcp-confirm.ts, #1736). The waiting call reads the answer; the\n * agent is not sent a result turn. */\nexport interface McpWriteOrigin {\n kind: \"mcp-write\"\n server: string\n tool: string\n}\n\n/** A tracked number missed its target twice in a row (src/numbers/\n * review.ts, #1826). Raised for the number's owner agent, which is told\n * the answer; a reviewer set in `numbers.reviewer` is told a yes too. */\nexport interface NumberOrigin {\n kind: \"number\"\n numberId: string\n /** Start of the window of the first miss of the run (UTC ms). */\n streakStart: number\n /** The agent that checks the owner's follow-up, when set. */\n reviewer?: string\n}\n\n/** Lines for the owner agent told the result of a missed-twice card. */\nexport function numberLines(origin: NumberOrigin, card: { status: string; verdict?: string; raised_by: string }): string[] {\n const lines = [`This card was about the tracked number \\`${origin.numberId}\\`, which missed its target twice in a row.`]\n if (card.status === \"decided\" && card.verdict === \"yes\") {\n lines.push(\n \"The question above gives both readings and the target. Find out why it misses, and change what you do, or propose a new target or source if those are wrong.\",\n \"Say in one short message what you changed and when the next reading will show it.\",\n )\n if (origin.reviewer && origin.reviewer !== card.raised_by) lines.push(`${origin.reviewer} reviews your follow-up.`)\n } else {\n lines.push(\"Change nothing for now. No new card comes until the number meets its target and then misses twice again.\")\n }\n return lines\n}\n\n/** The turn told to a number's reviewer when the operator said yes on its\n * missed-twice card. Null when there is nothing to review. */\nexport function numberReviewerMessage(card: { id: string; title: string; status: string; verdict?: string; raised_by: string; note?: string; origin?: CardOrigin }): { agentId: string; text: string } | null {\n const origin = card.origin?.kind === \"number\" ? card.origin : undefined\n if (!origin?.reviewer || origin.reviewer === card.raised_by) return null\n if (card.status !== \"decided\" || card.verdict !== \"yes\") return null\n const lines = [\n `[Number review] The operator said YES on \"${card.title}\" (${card.id}): ${card.raised_by} looks into why the tracked number \\`${origin.numberId}\\` missed its target twice.`,\n `You are the reviewer for numbers. Check that ${card.raised_by} says what it changed, and look at the next reading of \\`${origin.numberId}\\`.`,\n ]\n if (card.note) lines.push(`Operator note: ${card.note}`)\n lines.push(\"Do not change the number yourself; ask its owner.\")\n return { agentId: origin.reviewer, text: lines.join(\"\\n\") }\n}\n\nexport type CardOrigin = NumberOrigin | McpWriteOrigin | ReminderOrigin | RequestOrigin | RetroOrigin | RetroCheckOrigin | PlanStepOrigin | WorkflowOrigin | WorkflowProposalOrigin | MergePolicyOrigin | OrgProposalOrigin\n\n/** Retro cards of either kind: raised for an agent, not by it. */\nexport function isRetroOrigin(origin: CardOrigin | undefined): origin is RetroOrigin | RetroCheckOrigin {\n return origin?.kind === \"retro\" || origin?.kind === \"retro-check\"\n}\n\n/** The choices on a check review card, in this order. */\nexport const CHECK_CHOICES = { keep: \"Keep it\", loosen: \"Loosen it\", remove: \"Remove it\" } as const\n\n/** Lines for the agent told the result of a check review card. Keep, NO\n * and silence all leave the rule as it is. */\nexport function retroCheckLines(\n origin: RetroCheckOrigin,\n card: { status: string; verdict?: string; choice?: string; choice_suggested?: boolean },\n edited?: string,\n): string[] {\n const rule = `guard rule \\`${origin.ruleId}\\` in \\`${origin.file}\\``\n const lines = [`This was a monthly review of ${rule}, added by the retro on run ${origin.taskId}. It fires often on runs that went well.`]\n const yes = card.status === \"decided\" && card.verdict === \"yes\"\n if (!yes || card.choice === CHECK_CHOICES.keep || !card.choice) {\n lines.push(\"Change nothing: the rule stays as it is.\")\n return lines\n }\n lines.push(card.choice === CHECK_CHOICES.remove\n ? `The operator chose to remove it. Delete ${rule} as a pull request.`\n : `The operator chose to loosen it. Narrow ${rule} (a tighter match, or \\`applies_to\\`) so it stops firing on good work, keep its \\`retro:${origin.taskId}\\` tag, and open it as a pull request.`)\n if (card.choice_suggested) lines.push(SUGGESTED_NOTE)\n if (edited) lines.push(\"The operator's note:\", edited)\n lines.push(\"Do not change the live policy directly: the operator reviews the pull request first.\")\n return lines\n}\n\n/** Told to the agent when the choice came from a plain yes (#1064): the\n * operator accepted the suggestion rather than picking it by hand. */\nconst SUGGESTED_NOTE = \"(The operator gave a plain yes, taken as the suggested option.)\"\n\n/** True when the operator answered a retro card with something to build:\n * YES and a fix picked. YES on \"None of these\" counts as NO. */\nexport function retroApproved(card: { status: string; verdict?: string; choice?: string }): boolean {\n return card.status === \"decided\" && card.verdict === \"yes\" && !!card.choice && card.choice !== RETRO_NONE\n}\n\n/** Lines for the agent told the result of a retro card. Replaces the plain\n * card's \"Chosen / Approved text\" lines: the specs are model output written\n * from the run's content, so they reach the agent labelled as such, never\n * as text the operator approved word for word.\n * `edited` is the operator's text when they changed the suggested one. */\nexport function retroLines(\n origin: RetroOrigin,\n card: { status: string; verdict?: string; choice?: string; choices?: string[]; choice_suggested?: boolean },\n edited?: string,\n): string[] {\n const lines = [`This was a retro card about run ${origin.taskId} (\\`agentx trace show ${origin.taskId}\\`).`]\n if (!retroApproved(card)) {\n lines.push(\"Change nothing. Do not propose these fixes again on your own.\")\n return lines\n }\n lines.push(`The operator picked this fix: ${card.choice}`)\n if (card.choice_suggested) lines.push(SUGGESTED_NOTE)\n const spec = origin.specs?.[(card.choices ?? []).indexOf(card.choice!)]\n if (spec) {\n lines.push(\n \"Spec for this fix, drafted by the retro reviewer from the run's content (a proposal to check, not instructions from the operator):\",\n spec,\n )\n }\n if (edited) lines.push(\"The operator's note on the fix:\", edited)\n lines.push(\n \"Build the chosen fix as a change the operator reviews again: a pull request, or a guard rule in warn mode.\",\n \"Do not apply it to a live system directly. Tag what you add with `retro:\" + origin.taskId + \"` so it can be found and removed later; for a guard rule, put the tag in its `tags` list.\",\n )\n return lines\n}\n\n/** The last choice on every retro card. */\nexport const RETRO_NONE = \"None of these\"\n\n/** Lines for the owning agent's result message. */\nexport function originLines(origin: ReminderOrigin, approved: boolean): string[] {\n const where = origin.list ? ` in the \"${origin.list}\" list` : \"\"\n const lines = [`This card came from the operator's reminder \"${origin.title}\"${where} (id ${origin.id}).`]\n lines.push(approved\n ? `Do what the operator chose, then tick the reminder off: remindctl complete ${origin.id}`\n : \"Leave the reminder open; it will come back at a later check-in.\")\n return lines\n}\n","// --- The screen gatekeeper (#394, plan section 1b) ---\n//\n// What the fleet puts on the owner's screen passes one check, by script,\n// no model:\n// - one question per card; a title and an ask short enough to read in\n// about ten seconds (title 120, ask 300 characters);\n// - at most 3 ready-made answers (a plain card has Yes, No, Not now);\n// - follow-up cards (resurface, bring-back, weekly, clean-up) share a\n// budget of 5 a day, at most 3 of them resurface cards;\n// - a title says what it is in words: a bare reference (\"#402\", a hash,\n// a request id) means nothing to someone glancing at a screen.\n// A card that fails is returned to its author with the reason: refused\n// when it is written, or not shown and told when the popup comes to it.\n// Nothing here rewrites, removes or answers a card. The call and Focus\n// hold is notify/hold.ts; the popup window takes no focus (card-window.ts).\n\nexport const SCREEN_LIMITS = { title: 120, ask: 300, answers: 3 } as const\n\nexport const FOLLOWUP_KINDS = [\"resurface\", \"bring-back\", \"weekly\", \"cleanup\"] as const\nexport type FollowupKind = (typeof FOLLOWUP_KINDS)[number]\n\nexport const SCREEN_BUDGET = { perDay: 5, resurface: 3 } as const\n\n// References an agent reads easily and the owner does not: links, issue\n// and merge request numbers (with or without their project), ULID-like\n// ids, request, delegation and send ids, and commit hashes. A hex run\n// needs a digit and a letter a-f, so neither a word made of a-f letters\n// nor a plain long number (a phone number, an amount) is taken for one.\nconst REFERENCES: RegExp[] = [\n /\\bhttps?:\\/\\/\\S+/gi,\n /(?:[\\w.-]+\\/)*[\\w.-]+[#!]\\d+\\b/g,\n /[#!]\\d+\\b/g,\n /\\b[0-9A-HJKMNP-TV-Z]{26}\\b/gi,\n /\\b(?:req|dlg|snd)-[\\w-]+/gi,\n /\\b(?=[0-9a-f]*\\d)(?=[0-9a-f]*[a-f])[0-9a-f]{7,}\\b/gi,\n]\n\n/** The title with every reference taken out. */\nexport function stripReferences(text: string): string {\n return REFERENCES.reduce((t, re) => t.replace(re, \" \"), text)\n}\n\n/** Why a title that is only a reference may not go on screen, or null.\n * A title with a reference must keep at least 2 words of letters once\n * the references are out; a title with none is left to the other rules. */\nexport function referenceOnlyTitle(title: string): string | null {\n const rest = stripReferences(title)\n if (rest === title) return null\n const words = rest.split(/\\s+/).filter((w) => /\\p{L}/u.test(w))\n if (words.length >= 2) return null\n return `title is only a reference (\"${title.trim()}\"); say what it is in plain words, and put the link in the body or source`\n}\n\n/** Why this card may not go on the owner's screen, or null. */\nexport function cardRuleBreak(card: { title?: string; ask?: string; choices?: string[]; origin?: { kind: string } }): string | null {\n // A card file written by hand or by an older build may miss either:\n // returned to its author, never a crash of the popup.\n const title = typeof card.title === \"string\" ? card.title : \"\"\n const ask = typeof card.ask === \"string\" ? card.ask : \"\"\n if (!title.trim()) return \"title is missing: say what it is in plain words\"\n if (title.length > SCREEN_LIMITS.title) return `title is longer than ${SCREEN_LIMITS.title} characters`\n // A request's card is held to the rule too (#1126): it is titled with\n // its headline, which its agent can write (agentx_request describe).\n const bare = referenceOnlyTitle(title)\n if (bare) return bare\n if (!ask.trim()) return \"ask is missing: one card asks one thing\"\n if (ask.length > SCREEN_LIMITS.ask) return `ask is longer than ${SCREEN_LIMITS.ask} characters`\n if ((ask.match(/\\?/g) ?? []).length > 1) return \"ask holds more than one question: one card asks one thing\"\n if ((card.choices?.length ?? 0) > SCREEN_LIMITS.answers) return `more than ${SCREEN_LIMITS.answers} choices`\n return null\n}\n\n/** Why an agent's `agentx notify` may not go on the owner's screen, or\n * null: the same ten-second rule, title 120 and message 300 (the message\n * as shown, with its \"To do:\" line), and a title in words. */\nexport function noticeRuleBreak(title: string, message: string): string | null {\n if (title.length > SCREEN_LIMITS.title) return `title is longer than ${SCREEN_LIMITS.title} characters`\n const bare = referenceOnlyTitle(title)\n if (bare) return bare\n if (message.length > SCREEN_LIMITS.ask) return `message is longer than ${SCREEN_LIMITS.ask} characters`\n return null\n}\n\n/** An agent's notice as the owner reads it: the message, then the\n * \"To do:\" line. With nothing to do, it says so, so the owner never has\n * to guess whether a notice wants something. Last, so a banner that\n * shows only the first line still shows the message. */\nexport function withTodo(message: string, todo?: string): string {\n const what = todo?.trim().replace(/\\s+/g, \" \") || \"nothing, FYI\"\n return `${message}\\nTo do: ${what}`\n}\n\n/** Local midnight before `now`: the budget's day. */\nfunction dayStart(now: number): number {\n const d = new Date(now)\n d.setHours(0, 0, 0, 0)\n return d.getTime()\n}\n\n/** Why a follow-up card of this kind cannot be raised today, or null.\n * `cards` is every card, of any status: an answered one was on screen too. */\nexport function followupBudgetRefusal(\n cards: Array<{ followup?: FollowupKind; created_at: string }>,\n kind: FollowupKind,\n now: number,\n): string | null {\n const from = dayStart(now)\n const today = cards.filter((c) => c.followup && Date.parse(c.created_at) >= from)\n if (today.length >= SCREEN_BUDGET.perDay) {\n return `the follow-up screen budget is used up today (${SCREEN_BUDGET.perDay} cards): raise it again tomorrow`\n }\n if (kind === \"resurface\" && today.filter((c) => c.followup === \"resurface\").length >= SCREEN_BUDGET.resurface) {\n return `${SCREEN_BUDGET.resurface} resurface cards were already raised today: raise it again tomorrow`\n }\n return null\n}\n\n/** What the author hears when the popup does not show its card. */\nexport function returnedText(card: { id: string; title?: string; origin?: { kind: string } }, reason: string): string {\n const title = card.title?.trim()\n if (card.origin?.kind === \"request\") {\n return [\n `[screen gate] Request ${card.id}${title ? ` (\"${title}\")` : \"\"} was not shown to the owner: ${reason}.`,\n `It is still on his list. Say what it is: agentx_request {action:\"describe\", id:\"${card.id}\", headline:\"<a few plain words>\", need:\"<what you need from him>\"}.`,\n ].join(\" \")\n }\n return [\n `[screen gate] Your card ${card.id}${title ? ` (\"${title}\")` : \"\"} was not shown to the owner: ${reason}.`,\n \"It is still in his inbox, unchanged. If it must reach him on screen, close it (agentx_approval resolve) and raise one that passes:\",\n `one question, title up to ${SCREEN_LIMITS.title} characters, ask up to ${SCREEN_LIMITS.ask}, at most ${SCREEN_LIMITS.answers} choices.`,\n ].join(\" \")\n}\n"],"mappings":"oHAAA,OAAS,cAAAA,GAAY,YAAAC,GAAU,aAAAC,GAAW,eAAAC,GAAa,gBAAAC,GAAc,cAAAC,GAAY,cAAAC,GAAY,iBAAAC,OAAqB,KAClH,OAAS,WAAAC,OAAe,OCCxBC,KAFA,OAAS,kBAAAC,GAAgB,cAAAC,GAAY,aAAAC,GAAW,gBAAAC,EAAc,iBAAAC,MAAqB,KACnF,OAAS,WAAAC,MAAe,OA+BxB,IAAMC,EAAO,IAEPC,EAAW,IAGXC,EAAOC,GAAiBJ,EAAQI,EAAM,UAAW,WAAW,EAC5DC,EAAgBD,GAAiBJ,EAAQG,EAAIC,CAAI,EAAG,iBAAiB,EACrEE,GAAaF,GAAiBJ,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A,EAAK,UAAY,MAAQA,EAAK,QAAU,CAACwD,GAAS,CAAC8B,GAAOD,EAAM,KAAK,WAAWrF,EAAK,qDAAqD,EACvKA,EAAK,MAAMqF,EAAM,KAAK,kBAAkBrF,EAAK,MAAM,EAGnDA,EAAK,SAAW,WAAaA,EAAK,UAAY,MAAQ,CAACwD,GAAS,CAAC8B,GAAOD,EAAM,KAAKL,EAAY,EAC/FhF,EAAK,QAAQqF,EAAM,KAAK,WAAWrF,EAAK,QAAQ,EAChDA,EAAK,QAAQ,OAAS,YAAYqF,EAAM,KAAK,GAAGG,EAAYxF,EAAK,OAAQA,EAAK,SAAW,WAAaA,EAAK,UAAY,KAAK,CAAC,EAC7HA,EAAK,QAAQ,OAAS,UAAUqF,EAAM,KAAK,GAAGI,EAAYzF,EAAK,OAAQA,CAAI,CAAC,EAC5EwD,GAAS8B,EAAO,CAGlB,IAAMI,EAAUC,GAAcA,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EACpDC,EAAQC,EAAS7F,EAAK,MAAOA,EAAK,MAAM,EACxC8F,EAAS9F,EAAK,MAAQ0F,EAAO1F,EAAK,IAAI,IAAM0F,EAAOE,CAAK,EAAI5F,EAAK,KAAO,OAC9EqF,EAAM,KAAK,GAAI7B,EAAQuC,EAAWvC,EAAOxD,EAAM8F,CAAM,EAAIE,EAAgBV,EAAQtF,EAAM8F,CAAM,CAAE,EAEjG,OAAI9F,EAAK,OAAOqF,EAAM,KAAK,sBAAsBrF,EAAK,MAAM,gBAAgBA,EAAK,MAAM,mDAAmD,EACtIA,EAAK,MAAMqF,EAAM,KAAK,4EAA4ErF,EAAK,OAAO,EAClHqF,EAAM,KAAK,2DAA2D,EAC/DA,EAAM,KAAK;AAAA,CAAI,CACxB","names":["existsSync","linkSync","mkdirSync","readdirSync","readFileSync","renameSync","unlinkSync","writeFileSync","resolve","init_logger","appendFileSync","existsSync","mkdirSync","readFileSync","writeFileSync","resolve","KEEP","TEXT_MAX","dir","root","answeredFile","sinceFile","cap","s","recordAnswered","item","answeredSince","line","path","lines","e","logger","at","readAnswered","limit","out","i","v","numberLines","origin","card","lines","numberReviewerMessage","isRetroOrigin","CHECK_CHOICES","retroCheckLines","edited","rule","SUGGESTED_NOTE","retroApproved","RETRO_NONE","retroLines","spec","originLines","approved","where","SCREEN_LIMITS","FOLLOWUP_KINDS","SCREEN_BUDGET","REFERENCES","stripReferences","text","re","referenceOnlyTitle","title","rest","w","cardRuleBreak","card","ask","bare","noticeRuleBreak","message","withTodo","todo","what","dayStart","now","d","followupBudgetRefusal","cards","kind","from","today","c","returnedText","reason","IF_SILENT_VALUES","asIfSilent","v","CARD_LIMITS","DEFAULT_CARD_SETTINGS","approvalsDir","root","resolve","CARD_ID_RE","isValidCardId","id","fileFor","newCardId","now","title","day","slug","saveCard","card","mkdirSync","path","tmp","writeFileSync","renameSync","saveNewCard","saved","linkSync","e","unlinkSync","readCard","readFileSync","legacy","listCards","status","dir","existsSync","out","f","readdirSync","c","oneLine","resolveExpiry","input","settings","max","at","raw","rel","buildCard","opts","ask","recommend","raisedBy","ifSilentRaw","ifSilent","expiry","source","extras","buildChoices","followup","FOLLOWUP_KINDS","reply","r","sameSourcePending","pending","createCard","built","broken","cardRuleBreak","full","followupBudgetRefusal","twin","isRetro","isRetroOrigin","retro","open","what","POPUP_ONLY","decideCard","verdict","answer","resolveAnswer","saysNo","isNoChoice","final","note","decided","AGENT_RESOLVABLE_ORIGINS","resolveCard","who","how","reason","resolved","recordAnswered","expireCards","expired","cardsAwaitingAgentNotice","markAgentNotified","NO_UNDO_LINE","verdictMessage","result","retroApproved","RETRO_NONE","lines","check","answerLines","originLines","numberLines","squash","s","draft","draftFor","edited","retroLines","retroCheckLines"]}