abtars 0.3.4-alpha.8 → 0.3.4

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 (335) hide show
  1. package/bundle/{_registry.generated-YP5GLSG7.js → _registry.generated-AVR7DK2A.js} +15 -15
  2. package/bundle/{abmind-lazy-7Z44NODV.js → abmind-lazy-E3YCFKQ5.js} +15 -5
  3. package/bundle/abtars-browser.js +4 -4
  4. package/bundle/abtars-cli.js +23 -13
  5. package/bundle/abtars-cli.js.map +2 -2
  6. package/bundle/abtars-restart.js +3 -3
  7. package/bundle/abtars-task.js +3 -3
  8. package/bundle/abtars.js +385 -466
  9. package/bundle/abtars.js.map +4 -4
  10. package/bundle/{acp-raw-client-E6FM45NC.js → acp-raw-client-UCNK3OTU.js} +2 -2
  11. package/bundle/{action-gate-G2V47NHW.js → action-gate-V4FCBHFB.js} +2 -2
  12. package/bundle/{agent-api-adapter-WRGEQ6DV.js → agent-api-adapter-7HEPYSIN.js} +3 -3
  13. package/bundle/{agent-api-rate-limit-WCFXJMGY.js → agent-api-rate-limit-RZSAM3SW.js} +4 -4
  14. package/bundle/{agent-registry-GHNG2PH3.js → agent-registry-46A2R5KP.js} +7 -7
  15. package/bundle/{bootstrap-PZIDBPEJ.js → bootstrap-MIHJJSWU.js} +2 -2
  16. package/bundle/{bridge-lock-transport-4ZH7QTJP.js → bridge-lock-transport-7RSN7OLJ.js} +4 -4
  17. package/bundle/{browser-D3LZV7ZK.js → browser-F6BCWJWW.js} +6 -6
  18. package/bundle/{budget-45QOBDWA.js → budget-WUM3SPKW.js} +3 -3
  19. package/bundle/{capability-JFWX3IQF.js → capability-QVRKGRFC.js} +5 -5
  20. package/bundle/{chunk-YSKCQH6E.js → chunk-2IYJ4I66.js} +2 -2
  21. package/bundle/{chunk-W2R2HFOQ.js → chunk-2NLUT5S2.js} +6 -6
  22. package/bundle/chunk-3BG3AIDP.js +191 -0
  23. package/bundle/chunk-3BG3AIDP.js.map +7 -0
  24. package/bundle/{chunk-OKAQICWY.js → chunk-3GQX34S2.js} +3 -3
  25. package/bundle/{chunk-QROWBWLL.js → chunk-3XZ773BS.js} +2 -2
  26. package/bundle/{chunk-DYBW4XXL.js → chunk-467SRLLR.js} +2 -2
  27. package/bundle/{chunk-374NCXFZ.js → chunk-4AILRHUI.js} +10 -8
  28. package/bundle/chunk-4AILRHUI.js.map +7 -0
  29. package/bundle/{chunk-GPZNXY2U.js → chunk-4S3H4OK7.js} +4 -4
  30. package/bundle/{chunk-NDCRWEEJ.js → chunk-4Y5MJQRE.js} +6 -6
  31. package/bundle/{chunk-FRKW6LWB.js → chunk-55UWKI5C.js} +3 -3
  32. package/bundle/{chunk-7JN2MMU7.js → chunk-5PNJFDSW.js} +8 -8
  33. package/bundle/{chunk-LUNA6PM5.js → chunk-5RVOEFGT.js} +4 -2
  34. package/bundle/{chunk-LUNA6PM5.js.map → chunk-5RVOEFGT.js.map} +2 -2
  35. package/bundle/{chunk-OXTSWQCX.js → chunk-5Y3FJ2Y7.js} +2 -2
  36. package/bundle/{chunk-TMUYFERL.js → chunk-6B5ZFUPD.js} +2 -2
  37. package/bundle/{chunk-65VCEC32.js → chunk-6PA5JBUU.js} +2 -2
  38. package/bundle/{chunk-C7K6VZNY.js → chunk-BNXV7SZI.js} +21 -12
  39. package/bundle/chunk-BNXV7SZI.js.map +7 -0
  40. package/bundle/{chunk-AFREM7FX.js → chunk-CK7YTA2F.js} +2 -2
  41. package/bundle/{chunk-NRUSRJXR.js → chunk-DZJ5QZFD.js} +2 -2
  42. package/bundle/{chunk-YRSMGJFP.js → chunk-E67KESEG.js} +2 -2
  43. package/bundle/{chunk-ZV4IWKDJ.js → chunk-E7XD5UGB.js} +3 -3
  44. package/bundle/{chunk-CXXU3HAU.js → chunk-EAX5ZZUL.js} +63 -39
  45. package/bundle/chunk-EAX5ZZUL.js.map +7 -0
  46. package/bundle/{chunk-PEDX56EL.js → chunk-EFGBM555.js} +2 -2
  47. package/bundle/{chunk-EQSG2CRM.js → chunk-FGYDIX54.js} +22 -15
  48. package/bundle/chunk-FGYDIX54.js.map +7 -0
  49. package/bundle/{chunk-YPAQEQSC.js → chunk-GF6NVNA7.js} +15 -5
  50. package/bundle/chunk-GF6NVNA7.js.map +7 -0
  51. package/bundle/{chunk-UNM3OXHB.js → chunk-HGSHCQ5F.js} +110 -72
  52. package/bundle/{chunk-UNM3OXHB.js.map → chunk-HGSHCQ5F.js.map} +2 -2
  53. package/bundle/{chunk-VXCETPZU.js → chunk-IMIGG5EO.js} +39 -39
  54. package/bundle/chunk-IMIGG5EO.js.map +7 -0
  55. package/bundle/{chunk-P2K2K6XL.js → chunk-ITOFPJAV.js} +44 -32
  56. package/bundle/chunk-ITOFPJAV.js.map +7 -0
  57. package/bundle/{chunk-75ATTOW4.js → chunk-IY6UKLPS.js} +3 -3
  58. package/bundle/{chunk-EUZDKV3C.js → chunk-J4RUFAPK.js} +3 -3
  59. package/bundle/{chunk-HZDLFLRP.js → chunk-J7DRPVMU.js} +35 -5
  60. package/bundle/chunk-J7DRPVMU.js.map +7 -0
  61. package/bundle/{chunk-EGL6UMAO.js → chunk-JG4BKXBN.js} +7 -1
  62. package/bundle/chunk-JG4BKXBN.js.map +7 -0
  63. package/bundle/{chunk-N4EB6LA7.js → chunk-JLWYPGWI.js} +5 -5
  64. package/bundle/{chunk-5QUTMUIK.js → chunk-JXYWDAHD.js} +12 -12
  65. package/bundle/{chunk-GRVWZO4C.js → chunk-KOSFXW2S.js} +24 -3
  66. package/bundle/{chunk-GRVWZO4C.js.map → chunk-KOSFXW2S.js.map} +1 -1
  67. package/bundle/{chunk-M3JEX6L4.js → chunk-L72RIPEC.js} +9 -9
  68. package/bundle/{chunk-TEFZ4JA4.js → chunk-NHPLD3C7.js} +2 -2
  69. package/bundle/{chunk-2KC5G3EA.js → chunk-OWUO5RS3.js} +5 -5
  70. package/bundle/{chunk-4MULJ5SS.js → chunk-OY4Q6AMY.js} +71 -49
  71. package/bundle/chunk-OY4Q6AMY.js.map +7 -0
  72. package/bundle/{chunk-WBTJ2E62.js → chunk-P3NODAHF.js} +2 -5
  73. package/bundle/{chunk-WBTJ2E62.js.map → chunk-P3NODAHF.js.map} +2 -2
  74. package/bundle/{chunk-SMPHE3ZM.js → chunk-PB5GF4FG.js} +215 -163
  75. package/bundle/chunk-PB5GF4FG.js.map +7 -0
  76. package/bundle/{chunk-WYHGNI56.js → chunk-PMD5BLFS.js} +6 -6
  77. package/bundle/{chunk-URQPDCK5.js → chunk-Q66LQMMZ.js} +3 -3
  78. package/bundle/{chunk-IHYKTDIP.js → chunk-SC2Y5NR2.js} +36 -119
  79. package/bundle/chunk-SC2Y5NR2.js.map +7 -0
  80. package/bundle/chunk-SFL4EPCZ.js +555 -0
  81. package/bundle/chunk-SFL4EPCZ.js.map +7 -0
  82. package/bundle/{chunk-LDUOOKQY.js → chunk-SJPUNDZ3.js} +5 -5
  83. package/bundle/{chunk-LDUOOKQY.js.map → chunk-SJPUNDZ3.js.map} +1 -1
  84. package/bundle/{chunk-JQDJPUHM.js → chunk-TWB2ZGVH.js} +2 -2
  85. package/bundle/{chunk-IJT4KWXT.js → chunk-U4U47YE7.js} +2 -2
  86. package/bundle/{chunk-2FAZIA37.js → chunk-W546CU3A.js} +3 -3
  87. package/bundle/chunk-WC5O5KOE.js +211 -0
  88. package/bundle/chunk-WC5O5KOE.js.map +7 -0
  89. package/bundle/{chunk-JNIHEDKF.js → chunk-XPWYDNWL.js} +2 -2
  90. package/bundle/{chunk-GWILHZPT.js → chunk-XRTXYN66.js} +10 -7
  91. package/bundle/{chunk-GWILHZPT.js.map → chunk-XRTXYN66.js.map} +2 -2
  92. package/bundle/{chunk-EFJVUJBE.js → chunk-Y5FEFKGM.js} +6 -6
  93. package/bundle/chunk-YJZE4OK3.js +169 -0
  94. package/bundle/chunk-YJZE4OK3.js.map +7 -0
  95. package/bundle/{chunk-GVM5YU5I.js → chunk-Z4FZPB42.js} +2 -2
  96. package/bundle/{chunk-7BSQ5UQO.js → chunk-ZSIDQ66D.js} +3 -3
  97. package/bundle/{chunk-XX6BGTPO.js → chunk-ZZZCJJEO.js} +4 -4
  98. package/bundle/{commands-OIISYHTD.js → commands-2ZW6CMLC.js} +17 -16
  99. package/bundle/{config-M3P5IOAI.js → config-YMY5YHKN.js} +6 -6
  100. package/bundle/{context-2RJHC2LE.js → context-CL2RSLII.js} +7 -5
  101. package/bundle/context-CL2RSLII.js.map +7 -0
  102. package/bundle/{daemon-TB23FFWY.js → daemon-D7SU63OY.js} +3 -3
  103. package/bundle/{delegation-tools-YATZFKYO.js → delegation-tools-WS7Z56KZ.js} +12 -12
  104. package/bundle/{deploy-T6R45OZJ.js → deploy-AMTVKIMU.js} +2 -2
  105. package/bundle/{deps-WVK553KF.js → deps-T63AVJKJ.js} +3 -3
  106. package/bundle/{direct-api-transport-S2RDH2I7.js → direct-api-transport-QNNY2WWP.js} +51 -32
  107. package/bundle/direct-api-transport-QNNY2WWP.js.map +7 -0
  108. package/bundle/{discord-adapter-UTXUWX3A.js → discord-adapter-ABAD56Y2.js} +21 -20
  109. package/bundle/{discord-adapter-UTXUWX3A.js.map → discord-adapter-ABAD56Y2.js.map} +1 -1
  110. package/bundle/{dns-wakeup-IDOJIXBX.js → dns-wakeup-V3LEFXPE.js} +9 -33
  111. package/bundle/dns-wakeup-V3LEFXPE.js.map +7 -0
  112. package/bundle/{doctor-probes-B54JFIW3.js → doctor-probes-O6YI6XSZ.js} +6 -2
  113. package/bundle/{env-schema-4JXQUOH4.js → env-schema-B5RB32DC.js} +3 -3
  114. package/bundle/{gossip-3C3BSNPN.js → gossip-SKRCPOBS.js} +9 -5
  115. package/bundle/{guardrails-DL7ZSWVN.js → guardrails-64GQ5Y5K.js} +4 -4
  116. package/bundle/{heartbeat-system-MVTRS4GP.js → heartbeat-system-X4MUTKJD.js} +6 -6
  117. package/bundle/{heartbeat-tier3-6KH45CL6.js → heartbeat-tier3-2PTPWEQQ.js} +53 -76
  118. package/bundle/heartbeat-tier3-2PTPWEQQ.js.map +7 -0
  119. package/bundle/{hook-system-M3POLUIB.js → hook-system-YB635OC4.js} +3 -3
  120. package/bundle/{hotskills-FWX4QI7V.js → hotskills-Q75D2DK3.js} +5 -5
  121. package/bundle/{install-OS3CU7NF.js → install-RFKKFSGS.js} +17 -30
  122. package/bundle/install-RFKKFSGS.js.map +7 -0
  123. package/bundle/{install-manifest-5PPWMD2W.js → install-manifest-J7ICPCJN.js} +2 -2
  124. package/bundle/{irc-adapter-PTTZD32W.js → irc-adapter-TVEV4R6H.js} +3 -3
  125. package/bundle/{irc-config-CP7ZMUOX.js → irc-config-M676FOFI.js} +4 -4
  126. package/bundle/{kanban-board-M326B2XJ.js → kanban-board-DLEJUCNN.js} +9 -7
  127. package/bundle/{kanban-channel-IJ52OMNA.js → kanban-channel-XOLUHJZJ.js} +6 -6
  128. package/bundle/kanban-delivery-C4QPBNPX.js +45 -0
  129. package/bundle/kanban-delivery-C4QPBNPX.js.map +7 -0
  130. package/bundle/{lazy-require-KCRVT4SI.js → lazy-require-JKQSALXN.js} +3 -3
  131. package/bundle/{logger-OWCSNYCA.js → logger-3EGHBD4R.js} +2 -2
  132. package/bundle/{main-chat-ZNUZCTNS.js → main-chat-3H63REKK.js} +4 -4
  133. package/bundle/{master-user-HSKM4ZFN.js → master-user-MUBUP3KD.js} +5 -5
  134. package/bundle/{media-utils-3ZYOD7SK.js → media-utils-HUUIALAJ.js} +3 -3
  135. package/bundle/{message-pipeline-AUIUNM5R.js → message-pipeline-GRDRWONR.js} +17 -16
  136. package/bundle/meta.json +2773 -2241
  137. package/bundle/{metrics-collector-L3VPEHII.js → metrics-collector-YMUGY3PI.js} +31 -2
  138. package/bundle/metrics-collector-YMUGY3PI.js.map +7 -0
  139. package/bundle/{model-health-registry-MLEIZSTV.js → model-health-registry-QADMFQFQ.js} +2 -2
  140. package/bundle/{nerve-IGSXBKZZ.js → nerve-QPAEBRKX.js} +3 -3
  141. package/bundle/{notification-BFSIEECG.js → notification-3JICGXWU.js} +6 -6
  142. package/bundle/{openrouter-credits-NTVZDRYM.js → openrouter-credits-7NEIPYJN.js} +3 -3
  143. package/bundle/{orc-tools-TOD4WHTM.js → orc-tools-UZVPONKY.js} +5 -3
  144. package/bundle/{peer-auth-QC4EF2PM.js → peer-auth-RI43DKJE.js} +24 -15
  145. package/bundle/{peer-client-RGEU5HOK.js → peer-client-UITTMWJ2.js} +34 -29
  146. package/bundle/peer-client-UITTMWJ2.js.map +7 -0
  147. package/bundle/{peer-config-TN55LFDC.js → peer-config-URM7DCW6.js} +9 -4
  148. package/bundle/{peer-transport-5VKK2I7P.js → peer-transport-SI7I72DB.js} +12 -10
  149. package/bundle/{phase-transport-FS6NL4A5.js → phase-transport-ESWWACZI.js} +17 -17
  150. package/bundle/{reconcile-CTFCLQRN.js → reconcile-GFDQYNBD.js} +3 -3
  151. package/bundle/{reconciler-NZ4O4BCP.js → reconciler-IEUJXJN2.js} +12 -12
  152. package/bundle/{restore-IFHPI7I7.js → restore-FARTGLQQ.js} +3 -3
  153. package/bundle/{rollback-ANRI3T5Z.js → rollback-GEWPZABG.js} +2 -2
  154. package/bundle/{sandbox-runtime-QROWHDCS.js → sandbox-runtime-DV6E25J6.js} +2 -2
  155. package/bundle/{self-healer-utils-IFAYOQO2.js → self-healer-utils-P4SKNNEM.js} +3 -3
  156. package/bundle/{sha-tracker-ZWBP6CIJ.js → sha-tracker-77SHLYNY.js} +3 -3
  157. package/bundle/{skill-session-VJXTKOKL.js → skill-session-5HSMXY54.js} +3 -3
  158. package/bundle/{skill-stats-JORH5DGM.js → skill-stats-MI3RSWWL.js} +4 -4
  159. package/bundle/{skill-watcher-E4MGLKLS.js → skill-watcher-5L7JE6TN.js} +4 -4
  160. package/bundle/{sleep-BEWAUFCL.js → sleep-I4JFASCY.js} +11 -11
  161. package/bundle/{soul-bundle-VWAVHCZ6.js → soul-bundle-522C3IRH.js} +9 -8
  162. package/bundle/{spin-E3ZDEDKT.js → spin-VHNGNWTD.js} +11 -11
  163. package/bundle/{spin-notifications-SE2HVZI7.js → spin-notifications-7NC5XZEM.js} +5 -5
  164. package/bundle/{spin-types-OIE67MJK.js → spin-types-C5KOQOPD.js} +7 -3
  165. package/bundle/{sse-parser-anthropic-A6R4Z2TB.js → sse-parser-anthropic-MMTVWHLI.js} +3 -3
  166. package/bundle/{sse-parser-responses-HSZY3QGJ.js → sse-parser-responses-3AOFN64C.js} +3 -3
  167. package/bundle/{ssrf-guard-O6SHIK6Q.js → ssrf-guard-U2JA72TC.js} +3 -3
  168. package/bundle/{start-7QZIWO3S.js → start-H5IUFAWF.js} +4 -2
  169. package/bundle/{start-7QZIWO3S.js.map → start-H5IUFAWF.js.map} +2 -2
  170. package/bundle/{stt-LGVPXMVR.js → stt-PSOPPBV4.js} +4 -4
  171. package/bundle/{system-status-FAVNIUFJ.js → system-status-4LYGOFNO.js} +38 -24
  172. package/bundle/system-status-4LYGOFNO.js.map +7 -0
  173. package/bundle/{task-store-W5BFIAIH.js → task-store-MNCW42BW.js} +4 -4
  174. package/bundle/{telegram-adapter-4TX7QWKC.js → telegram-adapter-O6KIZDY6.js} +62 -45
  175. package/bundle/telegram-adapter-O6KIZDY6.js.map +7 -0
  176. package/bundle/{tool-registry-7FK3OQGL.js → tool-registry-JJMWCQKZ.js} +26 -24
  177. package/bundle/{tool-sandbox-4UC6GAKA.js → tool-sandbox-CNL6V6IH.js} +4 -4
  178. package/bundle/{transport-config-KBF5W2DP.js → transport-config-6MB2K2XC.js} +7 -7
  179. package/bundle/tribe-GDTFYJTK.js +111 -0
  180. package/bundle/tribe-GDTFYJTK.js.map +7 -0
  181. package/bundle/{update-CKFP6LBE.js → update-HGQAOC5L.js} +3 -3
  182. package/bundle/{usage-tracker-NXD364VX.js → usage-tracker-SR4BI6ZT.js} +2 -2
  183. package/bundle/{user-registry-35BW4XKM.js → user-registry-4PACZJIJ.js} +4 -4
  184. package/bundle/wire-platform-KKPWNNNQ.js +88 -0
  185. package/bundle/wire-platform-KKPWNNNQ.js.map +7 -0
  186. package/bundle/ws-peer-client-U3NNPOK7.js +370 -0
  187. package/bundle/ws-peer-client-U3NNPOK7.js.map +7 -0
  188. package/package.json +1 -1
  189. package/scripts/abtars-watchdog.sh +1 -5
  190. package/scripts/emergency-deploy.sh +2 -2
  191. package/scripts/emergency-update.sh +36 -37
  192. package/bundle/chunk-374NCXFZ.js.map +0 -7
  193. package/bundle/chunk-4MULJ5SS.js.map +0 -7
  194. package/bundle/chunk-4S554KLW.js +0 -105
  195. package/bundle/chunk-4S554KLW.js.map +0 -7
  196. package/bundle/chunk-C7K6VZNY.js.map +0 -7
  197. package/bundle/chunk-CXXU3HAU.js.map +0 -7
  198. package/bundle/chunk-EGL6UMAO.js.map +0 -7
  199. package/bundle/chunk-EQSG2CRM.js.map +0 -7
  200. package/bundle/chunk-HT2BPTZY.js +0 -241
  201. package/bundle/chunk-HT2BPTZY.js.map +0 -7
  202. package/bundle/chunk-HZDLFLRP.js.map +0 -7
  203. package/bundle/chunk-IHYKTDIP.js.map +0 -7
  204. package/bundle/chunk-IKUZPMVA.js +0 -82
  205. package/bundle/chunk-IKUZPMVA.js.map +0 -7
  206. package/bundle/chunk-P2K2K6XL.js.map +0 -7
  207. package/bundle/chunk-PU5HSKWH.js +0 -257
  208. package/bundle/chunk-PU5HSKWH.js.map +0 -7
  209. package/bundle/chunk-RWRRGE4U.js +0 -72
  210. package/bundle/chunk-RWRRGE4U.js.map +0 -7
  211. package/bundle/chunk-SMPHE3ZM.js.map +0 -7
  212. package/bundle/chunk-VUIX5AGB.js +0 -65
  213. package/bundle/chunk-VUIX5AGB.js.map +0 -7
  214. package/bundle/chunk-VXCETPZU.js.map +0 -7
  215. package/bundle/chunk-YPAQEQSC.js.map +0 -7
  216. package/bundle/context-2RJHC2LE.js.map +0 -7
  217. package/bundle/direct-api-transport-S2RDH2I7.js.map +0 -7
  218. package/bundle/dns-wakeup-IDOJIXBX.js.map +0 -7
  219. package/bundle/heartbeat-tier3-6KH45CL6.js.map +0 -7
  220. package/bundle/install-OS3CU7NF.js.map +0 -7
  221. package/bundle/metrics-collector-L3VPEHII.js.map +0 -7
  222. package/bundle/peer-client-RGEU5HOK.js.map +0 -7
  223. package/bundle/peer-jwt-NCCPXJRX.js +0 -18
  224. package/bundle/stream-single-RFJNUTL6.js +0 -34
  225. package/bundle/stream-single-RFJNUTL6.js.map +0 -7
  226. package/bundle/system-status-FAVNIUFJ.js.map +0 -7
  227. package/bundle/telegram-adapter-4TX7QWKC.js.map +0 -7
  228. package/bundle/user-registry-35BW4XKM.js.map +0 -7
  229. package/bundle/ws-peer-client-AIXCXF7V.js +0 -173
  230. package/bundle/ws-peer-client-AIXCXF7V.js.map +0 -7
  231. /package/bundle/{_registry.generated-YP5GLSG7.js.map → _registry.generated-AVR7DK2A.js.map} +0 -0
  232. /package/bundle/{abmind-lazy-7Z44NODV.js.map → abmind-lazy-E3YCFKQ5.js.map} +0 -0
  233. /package/bundle/{acp-raw-client-E6FM45NC.js.map → acp-raw-client-UCNK3OTU.js.map} +0 -0
  234. /package/bundle/{action-gate-G2V47NHW.js.map → action-gate-V4FCBHFB.js.map} +0 -0
  235. /package/bundle/{agent-api-adapter-WRGEQ6DV.js.map → agent-api-adapter-7HEPYSIN.js.map} +0 -0
  236. /package/bundle/{agent-api-rate-limit-WCFXJMGY.js.map → agent-api-rate-limit-RZSAM3SW.js.map} +0 -0
  237. /package/bundle/{agent-registry-GHNG2PH3.js.map → agent-registry-46A2R5KP.js.map} +0 -0
  238. /package/bundle/{bootstrap-PZIDBPEJ.js.map → bootstrap-MIHJJSWU.js.map} +0 -0
  239. /package/bundle/{bridge-lock-transport-4ZH7QTJP.js.map → bridge-lock-transport-7RSN7OLJ.js.map} +0 -0
  240. /package/bundle/{browser-D3LZV7ZK.js.map → browser-F6BCWJWW.js.map} +0 -0
  241. /package/bundle/{budget-45QOBDWA.js.map → budget-WUM3SPKW.js.map} +0 -0
  242. /package/bundle/{capability-JFWX3IQF.js.map → capability-QVRKGRFC.js.map} +0 -0
  243. /package/bundle/{chunk-YSKCQH6E.js.map → chunk-2IYJ4I66.js.map} +0 -0
  244. /package/bundle/{chunk-W2R2HFOQ.js.map → chunk-2NLUT5S2.js.map} +0 -0
  245. /package/bundle/{chunk-OKAQICWY.js.map → chunk-3GQX34S2.js.map} +0 -0
  246. /package/bundle/{chunk-QROWBWLL.js.map → chunk-3XZ773BS.js.map} +0 -0
  247. /package/bundle/{chunk-DYBW4XXL.js.map → chunk-467SRLLR.js.map} +0 -0
  248. /package/bundle/{chunk-GPZNXY2U.js.map → chunk-4S3H4OK7.js.map} +0 -0
  249. /package/bundle/{chunk-NDCRWEEJ.js.map → chunk-4Y5MJQRE.js.map} +0 -0
  250. /package/bundle/{chunk-FRKW6LWB.js.map → chunk-55UWKI5C.js.map} +0 -0
  251. /package/bundle/{chunk-7JN2MMU7.js.map → chunk-5PNJFDSW.js.map} +0 -0
  252. /package/bundle/{chunk-OXTSWQCX.js.map → chunk-5Y3FJ2Y7.js.map} +0 -0
  253. /package/bundle/{chunk-TMUYFERL.js.map → chunk-6B5ZFUPD.js.map} +0 -0
  254. /package/bundle/{chunk-65VCEC32.js.map → chunk-6PA5JBUU.js.map} +0 -0
  255. /package/bundle/{chunk-AFREM7FX.js.map → chunk-CK7YTA2F.js.map} +0 -0
  256. /package/bundle/{chunk-NRUSRJXR.js.map → chunk-DZJ5QZFD.js.map} +0 -0
  257. /package/bundle/{chunk-YRSMGJFP.js.map → chunk-E67KESEG.js.map} +0 -0
  258. /package/bundle/{chunk-ZV4IWKDJ.js.map → chunk-E7XD5UGB.js.map} +0 -0
  259. /package/bundle/{chunk-PEDX56EL.js.map → chunk-EFGBM555.js.map} +0 -0
  260. /package/bundle/{chunk-75ATTOW4.js.map → chunk-IY6UKLPS.js.map} +0 -0
  261. /package/bundle/{chunk-EUZDKV3C.js.map → chunk-J4RUFAPK.js.map} +0 -0
  262. /package/bundle/{chunk-N4EB6LA7.js.map → chunk-JLWYPGWI.js.map} +0 -0
  263. /package/bundle/{chunk-5QUTMUIK.js.map → chunk-JXYWDAHD.js.map} +0 -0
  264. /package/bundle/{chunk-M3JEX6L4.js.map → chunk-L72RIPEC.js.map} +0 -0
  265. /package/bundle/{chunk-TEFZ4JA4.js.map → chunk-NHPLD3C7.js.map} +0 -0
  266. /package/bundle/{chunk-2KC5G3EA.js.map → chunk-OWUO5RS3.js.map} +0 -0
  267. /package/bundle/{chunk-WYHGNI56.js.map → chunk-PMD5BLFS.js.map} +0 -0
  268. /package/bundle/{chunk-URQPDCK5.js.map → chunk-Q66LQMMZ.js.map} +0 -0
  269. /package/bundle/{chunk-JQDJPUHM.js.map → chunk-TWB2ZGVH.js.map} +0 -0
  270. /package/bundle/{chunk-IJT4KWXT.js.map → chunk-U4U47YE7.js.map} +0 -0
  271. /package/bundle/{chunk-2FAZIA37.js.map → chunk-W546CU3A.js.map} +0 -0
  272. /package/bundle/{chunk-JNIHEDKF.js.map → chunk-XPWYDNWL.js.map} +0 -0
  273. /package/bundle/{chunk-EFJVUJBE.js.map → chunk-Y5FEFKGM.js.map} +0 -0
  274. /package/bundle/{chunk-GVM5YU5I.js.map → chunk-Z4FZPB42.js.map} +0 -0
  275. /package/bundle/{chunk-7BSQ5UQO.js.map → chunk-ZSIDQ66D.js.map} +0 -0
  276. /package/bundle/{chunk-XX6BGTPO.js.map → chunk-ZZZCJJEO.js.map} +0 -0
  277. /package/bundle/{commands-OIISYHTD.js.map → commands-2ZW6CMLC.js.map} +0 -0
  278. /package/bundle/{config-M3P5IOAI.js.map → config-YMY5YHKN.js.map} +0 -0
  279. /package/bundle/{daemon-TB23FFWY.js.map → daemon-D7SU63OY.js.map} +0 -0
  280. /package/bundle/{delegation-tools-YATZFKYO.js.map → delegation-tools-WS7Z56KZ.js.map} +0 -0
  281. /package/bundle/{deploy-T6R45OZJ.js.map → deploy-AMTVKIMU.js.map} +0 -0
  282. /package/bundle/{deps-WVK553KF.js.map → deps-T63AVJKJ.js.map} +0 -0
  283. /package/bundle/{doctor-probes-B54JFIW3.js.map → doctor-probes-O6YI6XSZ.js.map} +0 -0
  284. /package/bundle/{env-schema-4JXQUOH4.js.map → env-schema-B5RB32DC.js.map} +0 -0
  285. /package/bundle/{gossip-3C3BSNPN.js.map → gossip-SKRCPOBS.js.map} +0 -0
  286. /package/bundle/{guardrails-DL7ZSWVN.js.map → guardrails-64GQ5Y5K.js.map} +0 -0
  287. /package/bundle/{heartbeat-system-MVTRS4GP.js.map → heartbeat-system-X4MUTKJD.js.map} +0 -0
  288. /package/bundle/{hook-system-M3POLUIB.js.map → hook-system-YB635OC4.js.map} +0 -0
  289. /package/bundle/{hotskills-FWX4QI7V.js.map → hotskills-Q75D2DK3.js.map} +0 -0
  290. /package/bundle/{install-manifest-5PPWMD2W.js.map → install-manifest-J7ICPCJN.js.map} +0 -0
  291. /package/bundle/{irc-adapter-PTTZD32W.js.map → irc-adapter-TVEV4R6H.js.map} +0 -0
  292. /package/bundle/{irc-config-CP7ZMUOX.js.map → irc-config-M676FOFI.js.map} +0 -0
  293. /package/bundle/{kanban-board-M326B2XJ.js.map → kanban-board-DLEJUCNN.js.map} +0 -0
  294. /package/bundle/{kanban-channel-IJ52OMNA.js.map → kanban-channel-XOLUHJZJ.js.map} +0 -0
  295. /package/bundle/{lazy-require-KCRVT4SI.js.map → lazy-require-JKQSALXN.js.map} +0 -0
  296. /package/bundle/{logger-OWCSNYCA.js.map → logger-3EGHBD4R.js.map} +0 -0
  297. /package/bundle/{main-chat-ZNUZCTNS.js.map → main-chat-3H63REKK.js.map} +0 -0
  298. /package/bundle/{master-user-HSKM4ZFN.js.map → master-user-MUBUP3KD.js.map} +0 -0
  299. /package/bundle/{media-utils-3ZYOD7SK.js.map → media-utils-HUUIALAJ.js.map} +0 -0
  300. /package/bundle/{message-pipeline-AUIUNM5R.js.map → message-pipeline-GRDRWONR.js.map} +0 -0
  301. /package/bundle/{model-health-registry-MLEIZSTV.js.map → model-health-registry-QADMFQFQ.js.map} +0 -0
  302. /package/bundle/{nerve-IGSXBKZZ.js.map → nerve-QPAEBRKX.js.map} +0 -0
  303. /package/bundle/{notification-BFSIEECG.js.map → notification-3JICGXWU.js.map} +0 -0
  304. /package/bundle/{openrouter-credits-NTVZDRYM.js.map → openrouter-credits-7NEIPYJN.js.map} +0 -0
  305. /package/bundle/{orc-tools-TOD4WHTM.js.map → orc-tools-UZVPONKY.js.map} +0 -0
  306. /package/bundle/{peer-auth-QC4EF2PM.js.map → peer-auth-RI43DKJE.js.map} +0 -0
  307. /package/bundle/{peer-config-TN55LFDC.js.map → peer-config-URM7DCW6.js.map} +0 -0
  308. /package/bundle/{peer-jwt-NCCPXJRX.js.map → peer-transport-SI7I72DB.js.map} +0 -0
  309. /package/bundle/{peer-transport-5VKK2I7P.js.map → phase-transport-ESWWACZI.js.map} +0 -0
  310. /package/bundle/{phase-transport-FS6NL4A5.js.map → reconcile-GFDQYNBD.js.map} +0 -0
  311. /package/bundle/{reconciler-NZ4O4BCP.js.map → reconciler-IEUJXJN2.js.map} +0 -0
  312. /package/bundle/{restore-IFHPI7I7.js.map → restore-FARTGLQQ.js.map} +0 -0
  313. /package/bundle/{reconcile-CTFCLQRN.js.map → rollback-GEWPZABG.js.map} +0 -0
  314. /package/bundle/{sandbox-runtime-QROWHDCS.js.map → sandbox-runtime-DV6E25J6.js.map} +0 -0
  315. /package/bundle/{self-healer-utils-IFAYOQO2.js.map → self-healer-utils-P4SKNNEM.js.map} +0 -0
  316. /package/bundle/{rollback-ANRI3T5Z.js.map → sha-tracker-77SHLYNY.js.map} +0 -0
  317. /package/bundle/{skill-session-VJXTKOKL.js.map → skill-session-5HSMXY54.js.map} +0 -0
  318. /package/bundle/{sha-tracker-ZWBP6CIJ.js.map → skill-stats-MI3RSWWL.js.map} +0 -0
  319. /package/bundle/{skill-stats-JORH5DGM.js.map → skill-watcher-5L7JE6TN.js.map} +0 -0
  320. /package/bundle/{skill-watcher-E4MGLKLS.js.map → sleep-I4JFASCY.js.map} +0 -0
  321. /package/bundle/{sleep-BEWAUFCL.js.map → soul-bundle-522C3IRH.js.map} +0 -0
  322. /package/bundle/{soul-bundle-VWAVHCZ6.js.map → spin-VHNGNWTD.js.map} +0 -0
  323. /package/bundle/{spin-notifications-SE2HVZI7.js.map → spin-notifications-7NC5XZEM.js.map} +0 -0
  324. /package/bundle/{spin-E3ZDEDKT.js.map → spin-types-C5KOQOPD.js.map} +0 -0
  325. /package/bundle/{sse-parser-anthropic-A6R4Z2TB.js.map → sse-parser-anthropic-MMTVWHLI.js.map} +0 -0
  326. /package/bundle/{sse-parser-responses-HSZY3QGJ.js.map → sse-parser-responses-3AOFN64C.js.map} +0 -0
  327. /package/bundle/{ssrf-guard-O6SHIK6Q.js.map → ssrf-guard-U2JA72TC.js.map} +0 -0
  328. /package/bundle/{spin-types-OIE67MJK.js.map → stt-PSOPPBV4.js.map} +0 -0
  329. /package/bundle/{stt-LGVPXMVR.js.map → task-store-MNCW42BW.js.map} +0 -0
  330. /package/bundle/{task-store-W5BFIAIH.js.map → tool-registry-JJMWCQKZ.js.map} +0 -0
  331. /package/bundle/{tool-registry-7FK3OQGL.js.map → tool-sandbox-CNL6V6IH.js.map} +0 -0
  332. /package/bundle/{tool-sandbox-4UC6GAKA.js.map → transport-config-6MB2K2XC.js.map} +0 -0
  333. /package/bundle/{transport-config-KBF5W2DP.js.map → update-HGQAOC5L.js.map} +0 -0
  334. /package/bundle/{update-CKFP6LBE.js.map → usage-tracker-SR4BI6ZT.js.map} +0 -0
  335. /package/bundle/{usage-tracker-NXD364VX.js.map → user-registry-4PACZJIJ.js.map} +0 -0
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/components/tasks/task-checker.ts", "../src/components/heartbeat-tasks.ts", "../src/components/daily-cycle.ts", "../src/components/safe-json.ts", "../src/components/tasks/task-queue.ts", "../src/components/idle-save.ts", "../src/boot/phase-pipeline-deps.ts"],
4
- "sourcesContent": ["/**\n * cron-checker \u2014 heartbeat task that fires due cron entries.\n *\n * Reminders \u2192 pending_reminders.json (picked up by main.ts message loop)\n * Tasks \u2192 spawns kiro-cli subprocess, calls onTaskComplete callback\n */\n\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { abtarsHome } from \"../../paths.js\";\nimport { logInfo } from \"../logger.js\";\nimport { CronExpressionParser } from \"cron-parser\";\nimport { readEntries as dbReadEntries, writeEntry, removeEntry as dbRemoveEntry } from \"./task-store.js\";\nimport type { CronEntry } from \"../../cli/abtars-task.js\";\n\nconst TAG = \"cron-checker\";\nconst memoryDir = (): string => join(abtarsHome(), \"state\");\nconst remindersPath = (): string => join(memoryDir(), \"pending_reminders.json\");\n\nexport interface PendingReminder {\n chatId: number;\n message: string;\n createdAt: number;\n threadId?: number;\n}\n\nexport function readPendingReminders(): PendingReminder[] {\n if (!existsSync(remindersPath())) return [];\n try { return JSON.parse(readFileSync(remindersPath(), \"utf-8\")) as PendingReminder[]; }\n catch (err) { logAndSwallow(TAG, \"readPendingReminders\", err); return []; }\n}\n\nexport function clearPendingReminders(): void {\n if (existsSync(remindersPath())) writeFileSync(remindersPath(), \"[]\", \"utf-8\");\n}\n\nexport function appendReminder(r: PendingReminder): void {\n mkdirSync(memoryDir(), { recursive: true });\n const existing = readPendingReminders();\n existing.push(r);\n writeFileSync(remindersPath(), JSON.stringify(existing, null, 2), \"utf-8\");\n}\n\nconst MAX_HISTORY = 10;\nconst GC_AGE_MS = 7 * 24 * 60 * 60 * 1000; // 7 days\n\n/** Record a run in the entry's history (keeps last MAX_HISTORY). */\nexport function recordRun(entry: CronEntry, exitCode?: number): void {\n if (!entry.history) entry.history = [];\n entry.history.push({ ts: Date.now(), ...(exitCode !== undefined ? { exitCode } : {}) });\n if (entry.history.length > MAX_HISTORY) entry.history = entry.history.slice(-MAX_HISTORY);\n}\n\n\n/**\n * Scan tasks.json for due entries. Fires reminders directly.\n * Returns due task entries (script + agent) for the CronQueue to process.\n * Advances fireAt and writes tasks.json.\n */\nexport function checkCron(): CronEntry[] {\n let entries = dbReadEntries();\n const now = Date.now();\n const dueTasks: CronEntry[] = [];\n\n // GC: remove fired one-shots older than 7 days\n for (const e of entries) {\n if (e.fired && !e.schedule && now - e.createdAt > GC_AGE_MS) {\n dbRemoveEntry(e.id);\n logInfo(TAG, `\uD83D\uDDD1\uFE0F GC: pruned old fired entry ${e.id}`);\n }\n }\n entries = entries.filter(e => !(e.fired && !e.schedule && now - e.createdAt > GC_AGE_MS));\n\n for (const entry of entries) {\n if (entry.fired || entry.paused || entry.fireAt > now) continue;\n\n // #692: daily rate limit \u2014 skip if maxRunsPerDay reached (count only successful runs)\n if (entry.maxRunsPerDay && entry.history) {\n const todayStart = new Date().setHours(0, 0, 0, 0);\n const todaySuccesses = entry.history.filter(h => h.ts >= todayStart && h.exitCode !== 1).length;\n if (todaySuccesses >= entry.maxRunsPerDay) {\n // Advance to next occurrence without running\n if (entry.schedule) {\n try {\n const expr = CronExpressionParser.parse(entry.schedule);\n entry.fireAt = expr.next().getTime();\n writeEntry(entry);\n } catch (err) { logAndSwallow(\"cron_checker\", \"op\", err); }\n }\n continue;\n }\n }\n\n // #327: stale detection \u2014 if past the catch-up window, advance to next occurrence\n if (entry.schedule && entry.fireAt <= now) {\n const maxDelay = (entry.catchUp ?? 0) * 3600_000;\n // Only consider stale if missed by more than one full interval (at minimum 5 min)\n const MIN_STALE_MS = 5 * 60_000;\n const staleThreshold = Math.max(maxDelay, MIN_STALE_MS);\n if (now - entry.fireAt > staleThreshold) {\n try {\n const expr = CronExpressionParser.parse(entry.schedule);\n entry.fireAt = expr.next().getTime();\n writeEntry(entry);\n logInfo(TAG, `\u23ED\uFE0F Stale \"${entry.id}\" \u2014 advanced to next occurrence`);\n } catch (err) { logAndSwallow(\"cron_checker\", \"op\", err); }\n continue;\n }\n }\n\n entry.lastRanAt = now;\n const wasRetry = !!entry._retrying;\n if (entry.schedule) {\n try {\n const expr = CronExpressionParser.parse(entry.schedule);\n entry.fireAt = expr.next().getTime();\n } catch (err) { logAndSwallow(TAG, \"cron parse next\", err); entry.fired = true; }\n } else {\n entry.fired = true;\n }\n delete entry._retrying;\n\n if (entry.type === \"reminder\") {\n appendReminder({ chatId: entry.chatId, message: entry.message, createdAt: now });\n recordRun(entry);\n logInfo(TAG, `\u23F0 Reminder fired: \"${entry.message}\" \u2192 chat ${entry.chatId}`);\n } else {\n dueTasks.push({ ...entry, _retrying: wasRetry || undefined });\n }\n\n writeEntry(entry);\n }\n\n return dueTasks;\n}\n", "/**\n * Heartbeat tasks extracted from bridge-app.ts \u2014 complex periodic operations\n * that benefit from being independently readable and testable.\n */\n\nimport { logAndSwallow } from \"./log-and-swallow.js\";\nimport { logInfo, logError } from \"./logger.js\";\nimport { setIdleCompactReset } from \"./message-pipeline.js\";\nimport type { IKiroTransport } from \"./transport/kiro-transport.js\";\nimport type { MemoryManager } from \"abmind\";\nimport type { HeartbeatTask } from \"../types/index.js\";\nimport { isDailyCycleDue, type DailyCycleDeps } from \"./daily-cycle.js\";\n\nconst TAG = \"heartbeat_tasks\";\nexport interface IdleCompactDeps {\n transport: IKiroTransport;\n memory: MemoryManager | null;\n memoryDir: string;\n allowedUserIds: Set<number>;\n isSleepActive: () => boolean;\n}\n\n/** Idle compaction removed \u2014 context engine handles compaction automatically via buildContext(). */\nexport function createIdleCompactTask(_deps: IdleCompactDeps): HeartbeatTask {\n setIdleCompactReset(() => {});\n return {\n name: \"idle-compact\",\n heavy: false,\n execute: async () => false,\n };\n}\n\nexport type AgeCheckDeps = DailyCycleDeps & { startSleep?: () => void; checkHwSleep?: () => void; checkStaleSleep?: () => void; cronBusy?: () => boolean };\n\n/** Daily cycle \u2014 spawn Dreamy after BED_TIME + quiet ticks, then hw sleep after more quiet ticks. */\nexport function createAgeCheckTask(deps: AgeCheckDeps): HeartbeatTask {\n let counter = 0;\n return {\n name: \"age-check\",\n execute: async () => {\n counter++;\n if (counter % 5 !== 0) return; // every 5 ticks (~5 min)\n if (deps.checkStaleSleep) deps.checkStaleSleep();\n if (deps.checkHwSleep && !deps.cronBusy?.()) deps.checkHwSleep();\n if (!isDailyCycleDue(deps)) return;\n logInfo(\"age-check\", `\uD83D\uDE34 BED_TIME (${deps.sleepHour}:${String(deps.sleepMinute).padStart(2, \"0\")}) \u2014 spawning Dreamy`);\n try { import(\"../cli/commands/doctor-probes.js\").then(m => m.runFixes()).catch(() => {}); } catch (err) { logAndSwallow(\"heartbeat_tasks\", \"op\", err); }\n if (deps.startSleep) { deps.startSleep(); }\n },\n };\n}\n\n/** DB integrity check \u2014 runs every ~1 hour (time-based, independent of tick interval). */\nexport function createDbIntegrityTask(memory: MemoryManager | null): HeartbeatTask {\n let lastCheckAt = 0;\n const INTERVAL_MS = 60 * 60 * 1000;\n const MAX_FAILURES = 5;\n let consecutiveFailures = 0;\n let escalated = false;\n return {\n name: \"db-integrity\",\n execute: async () => {\n if (escalated) return;\n if (Date.now() - lastCheckAt < INTERVAL_MS) return;\n lastCheckAt = Date.now();\n if (!memory) return;\n const result = memory.maintenance.checkIntegrity();\n if (result !== \"ok\") {\n logError(\"db-integrity\", `Memory DB integrity check failed: ${result}`);\n const { rebuilt } = memory.rebuildFtsIndexes();\n if (rebuilt.length > 0) {\n logInfo(\"db-integrity\", `Auto-rebuilt FTS indexes: ${rebuilt.join(\", \")}`);\n consecutiveFailures = 0;\n } else {\n consecutiveFailures++;\n if (consecutiveFailures >= MAX_FAILURES) {\n escalated = true;\n const msg = `\u26A0\uFE0F FTS corruption persists after ${MAX_FAILURES} rebuild attempts. Needs manual fix.`;\n logError(\"db-integrity\", msg);\n const { bufferSystemEvent } = await import(\"./system-event-buffer.js\");\n bufferSystemEvent(msg);\n }\n }\n } else {\n consecutiveFailures = 0;\n }\n },\n };\n}\n\n/** #440: Check for updates on npm, notify if newer version available. */\nexport function createUpdateCheckTask(notify: (msg: string) => void): HeartbeatTask {\n return {\n name: \"update-check\",\n async execute() {\n if (process.env[\"UPDATES_CHECK_ENABLED\"] === \"false\") return;\n const { checkForUpdate } = await import(\"./update-check.js\");\n const { readFileSync } = await import(\"node:fs\");\n const { join } = await import(\"node:path\");\n const { abtarsHome } = await import(\"../paths.js\");\n let version = \"0.0.0\";\n let source = \"npm\";\n try {\n const m = JSON.parse(readFileSync(join(abtarsHome(), \"manifest.json\"), \"utf-8\"));\n version = m.version ?? \"0.0.0\";\n source = m.source ?? \"npm\";\n } catch (err) { logAndSwallow(TAG, \"read manifest.json\", err); }\n if (source === \"local\") return; // git deploys are always ahead of npm\n const result = checkForUpdate(\"abtars\", version);\n if (result?.shouldNotify) {\n notify(`\u26A1 Update available: ${result.current} \u2192 ${result.latest}. Run: abtars update`);\n }\n },\n };\n}\n\n/** #613: Flush skill usage stats to disk every 3 hours. */\nexport function createSkillStatsFlushTask(): HeartbeatTask {\n let lastFlushAt = 0;\n const INTERVAL_MS = 3 * 60 * 60 * 1000;\n return {\n name: \"skill-stats-flush\",\n execute: async () => {\n if (Date.now() - lastFlushAt < INTERVAL_MS) return;\n lastFlushAt = Date.now();\n const { flush } = await import(\"./skill-stats.js\");\n flush();\n },\n };\n}\n\n/** #1114: Reload skills catalog every 10 minutes if skill files changed. */\nexport function createSkillReloadTask(): HeartbeatTask {\n let lastCheckAt = 0;\n let lastMtime = 0;\n const INTERVAL_MS = 10 * 60 * 1000;\n return {\n name: \"skill-reload\",\n execute: async () => {\n if (Date.now() - lastCheckAt < INTERVAL_MS) return;\n lastCheckAt = Date.now();\n const { statSync } = await import(\"node:fs\");\n const { join } = await import(\"node:path\");\n const { abtarsHome } = await import(\"../paths.js\");\n const skillsDir = join(abtarsHome(), \"skills\");\n try {\n const mtime = statSync(skillsDir).mtimeMs;\n if (mtime === lastMtime) return;\n lastMtime = mtime;\n const { reloadCatalog } = await import(\"../capabilities/hotskills/index.js\");\n const count = reloadCatalog();\n logInfo(\"skill-reload\", `Catalog regenerated: ${count} skills`);\n } catch { /* skills dir missing \u2014 skip */ }\n },\n };\n}\n\nexport interface KanbanDeliveryDeps {\n sendSystemMessage: (prompt: string) => Promise<void>;\n sendMessage: (chatId: string, text: string) => Promise<void>;\n sendDocument: (chatId: string, filePath: string, caption: string) => Promise<void>;\n chatId: () => string;\n}\n\n/** #857/#934: Kanban delivery \u2014 routes based on delivery_mode. */\nexport function createKanbanDeliveryTask(deps: KanbanDeliveryDeps): HeartbeatTask {\n return {\n name: \"kanban-delivery\",\n execute: async () => {\n try {\n const { kanbanPending, kanbanSetDelivering, kanbanMarkDelivered, kanbanDeliveryFailed } = await import(\"./tasks/kanban-board.js\");\n const pending = kanbanPending();\n if (pending.length === 0) return;\n\n for (const card of pending) {\n if (card.delivery_mode === \"silent\") {\n kanbanMarkDelivered(card.id);\n continue;\n }\n kanbanSetDelivering(card.id);\n try {\n if (card.delivery_mode === \"deliver\") {\n if (card.result_path) await deps.sendDocument(deps.chatId(), card.result_path, card.title);\n await deps.sendSystemMessage(`[SYSTEM] Task \"${card.title}\" complete. File delivered: ${card.result_path ?? \"(no file)\"}`);\n } else {\n // \"announce\"\n await deps.sendSystemMessage(\n `[TASK COMPLETE] \"${card.title}\" done.\\nResult:\\n${card.result_summary ?? \"(no output)\"}\\n\\nDeliver this to the user naturally.`\n );\n }\n kanbanMarkDelivered(card.id);\n } catch (err) {\n kanbanDeliveryFailed(card.id);\n logError(TAG, `Kanban delivery failed for card ${card.id}: ${err}`);\n }\n }\n } catch (err) { logAndSwallow(TAG, \"kanban-delivery\", err); }\n },\n };\n}\n\n/** #936: Expire idle user sessions managed by Spin. */\nexport function createUserSessionExpiryTask(): HeartbeatTask {\n return {\n name: \"user-session-expiry\",\n execute: async () => {\n const { spin } = await import(\"./spin.js\");\n const sessions = spin.listAllSessions();\n if (!sessions.length) return;\n const now = Date.now();\n for (const session of sessions) {\n if (session.idleTimeoutMs === Infinity) continue;\n if (session.status !== \"ready\") continue;\n if (!session.transport) continue;\n if (now - session.lastActiveAt > session.idleTimeoutMs) {\n spin.destroySession(session.userId, session.id);\n }\n }\n },\n };\n}\n\n/** #857: Kanban cleanup \u2014 purge delivered cards older than 7 days. */\nexport function createKanbanCleanupTask(): HeartbeatTask {\n let counter = 0;\n return {\n name: \"kanban-cleanup\",\n execute: async () => {\n counter++;\n if (counter % 72 !== 0) return; // ~hourly\n try {\n const { kanbanCleanup } = await import(\"./tasks/kanban-board.js\");\n const purged = kanbanCleanup(7);\n if (purged > 0) logInfo(TAG, `Kanban: purged ${purged} delivered cards > 7d`);\n } catch (err) { logAndSwallow(TAG, \"kanban-cleanup\", err); }\n },\n };\n}\n\n/** #832: Metrics flush (every 5min) + prune (daily). */\nexport function createMetricsTask(cronQueueDepth: () => number): HeartbeatTask {\n let flushCounter = 0;\n let pruneCounter = 0;\n return {\n name: \"metrics\",\n execute: async () => {\n try {\n const { recordCronDepth, flushToFile, pruneMetricsFile } = await import(\"./metrics-collector.js\");\n recordCronDepth(cronQueueDepth());\n flushCounter++;\n if (flushCounter % 6 === 0) flushToFile(); // ~5min (6 ticks \u00D7 50s)\n pruneCounter++;\n if (pruneCounter % 1728 === 0) pruneMetricsFile(); // ~daily (1728 ticks \u00D7 50s)\n } catch (err) { logAndSwallow(TAG, \"metrics\", err); }\n },\n };\n}\n", "import { getEnv } from \"./env-schema.js\";\nimport { spin } from \"./spin.js\";\n/**\n * Daily cycle check \u2014 shared by standby handler and age-check heartbeat task.\n *\n * After BED_TIME, counts quiet ticks (no new messages). After 6 quiet ticks\n * (~30min at 5min heartbeat), triggers sleep. Any new message resets the counter.\n */\nimport type { IMemorySystem } from \"abmind\";\nimport { logInfo } from \"./logger.js\";\nimport { logAndSwallow } from \"./log-and-swallow.js\";\nimport { safeReadJson } from \"./safe-json.js\";\nimport { abmind } from \"../utils/abmind-lazy.js\";\nimport { readBridgeLockField } from \"./transport/bridge-lock-transport.js\";\n\n\nexport interface DailyCycleDeps {\n sleepHour: number;\n sleepMinute: number;\n bridgeLockPath: string;\n sleepAuditDir: string;\n memory: IMemorySystem | null;\n isSleepActive: () => boolean;\n}\n\n\n\nlet quietTickCount = 0;\nlet lastSeenMsgTs = 0;\n\n/** Reset the quiet tick counter (call when user sends a message). */\nexport function resetBedtimeCounter(): void {\n quietTickCount = 0;\n}\n\n/** Returns true if conditions are met for the daily restart + sleep cycle. */\nexport function isDailyCycleDue(deps: DailyCycleDeps): boolean {\n // User-protection guards \u2014 NEVER bypass, even when forced.\n if (spin.listAllSessions().some(s => s.busy) || deps.isSleepActive()) return false;\n\n // Force-sleep request in bridge.lock \u2014 short-circuit time/audit/startedAt guards.\n // Peek-only here; spawnSleep() clears the field via readAndClearForceSleep().\n const forceSleep = readBridgeLockField<string>(\"forceSleep\");\n if (forceSleep) {\n logInfo(\"bedtime\", `\u26A1 forceSleep=${forceSleep} \u2014 bypassing bedtime/audit/startedAt guards`);\n return true;\n }\n\n const now = new Date();\n const nowMinutes = now.getHours() * 60 + now.getMinutes();\n const sleepMinutes = deps.sleepHour * 60 + deps.sleepMinute;\n if (nowMinutes < sleepMinutes) {\n quietTickCount = 0; // not bedtime yet, reset\n return false;\n }\n\n // Midnight wraparound: BED_TIME 0:30 means \"after midnight\", not \"all day\".\n // If more than 7 hours have passed since BED_TIME, it's daytime \u2014 not bedtime.\n if (nowMinutes - sleepMinutes > 7 * 60) {\n quietTickCount = 0;\n return false;\n }\n\n // Single source of truth: lock file status\n if (abmind()?.hasSleepAuditToday(deps.sleepAuditDir)) return false;\n\n const lockData = safeReadJson<{ startedAt?: number; lastHeartbeat?: number }>(deps.bridgeLockPath, {});\n if (!lockData.startedAt) return false; // fail-closed on missing/corrupt lock\n if (!lockData.lastHeartbeat) return false; // no successful tick yet \u2014 dark wake guard\n\n // Check for new messages since last tick \u2014 only Main (A) sessions count (#510)\n let currentMsgTs = 0;\n try {\n const row = deps.memory?.getLastMessageTimestamp(true, \"A\");\n currentMsgTs = row ?? 0;\n } catch (err) { logAndSwallow(\"daily_cycle\", \"getLastMessageTimestamp\", err); return false; }\n\n if (currentMsgTs > lastSeenMsgTs) {\n // New message arrived \u2014 reset counter\n lastSeenMsgTs = currentMsgTs;\n quietTickCount = 0;\n logInfo(\"bedtime\", `Message received \u2014 quiet counter reset (BED_TIME ${deps.sleepHour}:${String(deps.sleepMinute).padStart(2, \"0\")})`);\n return false;\n }\n\n // No new messages this tick \u2014 increment quiet counter\n quietTickCount++;\n const hbSec = parseInt(process.env[\"HEARTBEAT_INTERVAL_SEC\"] ?? \"60\", 10);\n const threshold = Math.ceil(getEnv().bedQuietMin * 60 / hbSec);\n logInfo(\"bedtime\", `Quiet tick ${quietTickCount}/${threshold} (BED_TIME ${deps.sleepHour}:${String(deps.sleepMinute).padStart(2, \"0\")})`);\n\n if (quietTickCount >= threshold) {\n quietTickCount = 0; // reset after triggering \u2014 prevents re-spawn on next tick\n return true;\n }\n return false;\n}\n", "/**\n * safe-json.ts \u2014 Defensive JSON file reader.\n * Returns fallback on any error (missing file, invalid JSON, wrong schema).\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { logAndSwallow } from \"./log-and-swallow.js\";\n\nconst TAG = \"safe_json\";\n\n/** Read and parse a JSON file. Returns fallback on any error. */\nexport function safeReadJson<T>(path: string, fallback: T): T {\n try {\n const raw = readFileSync(path, \"utf-8\");\n const parsed = JSON.parse(raw);\n if (parsed === null || typeof parsed !== \"object\") return fallback;\n return parsed as T;\n } catch (err) {\n logAndSwallow(TAG, `safeReadJson ${path}`, err);\n return fallback;\n }\n}\n", "/**\n * CronQueue \u2014 sequential job processor for cron tasks.\n *\n * Heartbeat enqueues due tasks. Queue runs them one at a time:\n * scripts sequentially, agents sequentially, never concurrent.\n * Priority-sorted: high jobs jump ahead of pending medium/low.\n * Duplicate prevention: same entry ID can't be queued or running twice.\n */\n\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport { addTaskFailure } from \"./task-failure-buffer.js\";\nimport { spawn } from \"node:child_process\";\nimport { existsSync, readFileSync, readdirSync, statSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport { resolve, join, dirname, basename } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { abtarsHome } from \"../../paths.js\";\nimport { logInfo, logWarn } from \"../logger.js\";\nimport { readLastPromptAt, readBridgeLockField } from \"../transport/bridge-lock-transport.js\";\nimport { recordRun as dbRecordRun, readEntry, writeEntry } from \"./task-store.js\";\nimport { recordRun } from \"./task-checker.js\";\nimport { kanbanComplete, kanbanFail } from \"./kanban-board.js\";\nimport type { CronEntry } from \"../../cli/abtars-task.js\";\nimport { localDate } from \"../../utils/date.js\";\n\nconst TAG = \"cron-queue\";\nconst AGENT_TIMEOUT_MS = 30 * 60 * 1000;\nconst RETRY_DELAY_MS = 10 * 60 * 1000; // skip 1 cycle (2 \u00D7 5min)\nconst PRIO_RANK: Record<string, number> = { high: 0, medium: 1, low: 2 };\nconst STATE_FILE = join(homedir(), \".abtars\", \"state\", \"task-queue-state.json\");\n\ninterface PersistedState {\n pid: number;\n currentJob: { entryId: string; message: string; startedAt: number; type: string } | null;\n queue: Array<{ entryId: string; message: string; priority: string; manual: boolean }>;\n}\n\nfunction persistState(current: RunningJob | null, queue: QueuedJob[]): void {\n try {\n const state: PersistedState = {\n pid: process.pid,\n currentJob: current ? { entryId: current.entryId, message: current.message, startedAt: current.startedAt, type: current.type } : null,\n queue: queue.map(j => ({ entryId: j.entry.id, message: j.entry.message, priority: j.entry.priority ?? \"medium\", manual: j.manual ?? false })),\n };\n writeFileSync(STATE_FILE, JSON.stringify(state), \"utf-8\");\n } catch (err) { logAndSwallow(\"cron_queue\", \"op\", err); }\n}\n\nfunction loadStaleState(): PersistedState | null {\n try {\n if (!existsSync(STATE_FILE)) return null;\n const raw = JSON.parse(readFileSync(STATE_FILE, \"utf-8\")) as PersistedState;\n // If PID matches current process, state is ours (not stale)\n if (raw.pid === process.pid) return null;\n // If bridge was in hw_sleep, don't mark as failed (watchdog-aware)\n const sleepStatus = readBridgeLockField(\"sleepStatus\");\n if (sleepStatus === \"hw_sleep\") return null;\n return raw;\n } catch (err) { logAndSwallow(TAG, \"loadStaleState\", err); return null; }\n}\n\nfunction recordRunToFile(entryId: string, exitCode?: number): void {\n dbRecordRun(entryId, exitCode);\n}\n\nfunction writeResultFile(entryId: string, content: string): string | null {\n try {\n const dir = join(abtarsHome(), \"workspace\", entryId);\n mkdirSync(dir, { recursive: true });\n const file = join(dir, `${entryId}-${localDate()}.md`);\n writeFileSync(file, content, \"utf-8\");\n return file;\n } catch (err) { logAndSwallow(TAG, \"writeResultFile\", err); return null; }\n}\n\nconst DOD_MIN_BYTES = 100;\n\nfunction todayStr(): string {\n return localDate();\n}\n\n/** Read task file, substitute {today}, glob associated _* files, return { prompt, dodPaths }. */\nfunction readTaskFile(taskFile: string): { prompt: string; dodPaths: string[] } | null {\n const filePath = resolve(taskFile.replace(/^~/, homedir()));\n if (!existsSync(filePath)) { logWarn(TAG, `Task file not found: ${filePath}`); return null; }\n const raw = readFileSync(filePath, \"utf-8\");\n const today = todayStr();\n const content = raw.replace(/\\{today\\}/g, today);\n\n const dodIdx = content.indexOf(\"## Definition of Done\");\n let prompt: string;\n let dodPaths: string[] = [];\n if (dodIdx === -1) {\n prompt = content.trim();\n } else {\n prompt = content.slice(0, dodIdx).trim();\n const dodSection = content.slice(dodIdx);\n dodPaths = dodSection.split(\"\\n\")\n .filter(l => l.match(/^- /))\n .map(l => l.replace(/^- /, \"\").trim())\n .map(p => resolve(p.replace(/^~/, homedir())));\n }\n\n // Glob associated files: {taskname}_* in same directory (cap 10k chars total)\n const dir = dirname(filePath);\n const base = basename(filePath, \".md\");\n const associated = readdirSync(dir).filter(f => f !== base + \".md\" && !f.startsWith(\".\")).sort();\n if (associated.length > 0) {\n let injected = \"\\n\\n---\\n## Associated files\\n\";\n let totalChars = 0;\n const CAP = 10_000;\n for (const f of associated) {\n const fc = readFileSync(join(dir, f), \"utf-8\");\n if (totalChars + fc.length > CAP) {\n injected += `\\n[${f}]: (truncated \u2014 full file at ${join(dir, f)})\\n`;\n break;\n }\n injected += `\\n### ${f}\\n\\`\\`\\`\\n${fc}\\n\\`\\`\\`\\n`;\n totalChars += fc.length;\n }\n prompt += injected;\n }\n\n return { prompt, dodPaths };\n}\n\n/** Check DoD: each path must exist and be >= DOD_MIN_BYTES. Returns pass/fail + details.\n * Re-stats once after a short delay if a file appears missing \u2014 tool calls that write files\n * (send_document, execute_bash) may still be completing when the circuit breaker fires. (#1282)\n */\nfunction checkDoD(paths: string[]): { passed: boolean; details: string } {\n if (paths.length === 0) return { passed: true, details: \"no DoD defined\" };\n const results: string[] = [];\n let allPassed = true;\n for (const p of paths) {\n let size: number | null = null;\n if (existsSync(p)) {\n size = statSync(p).size;\n } else {\n // Re-stat after 1.5s \u2014 file may be written by a tool call that completed just as the\n // agent loop was aborted by the circuit breaker.\n const deadline = Date.now() + 1500;\n while (Date.now() < deadline) {\n // Synchronous spin \u2014 this runs in the task callback, not on the main event loop hot path.\n const remaining = deadline - Date.now();\n if (remaining > 0) Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, Math.min(remaining, 200));\n if (existsSync(p)) { size = statSync(p).size; break; }\n }\n }\n if (size === null) {\n results.push(`\u2717 missing: ${p}`);\n allPassed = false;\n } else if (size < DOD_MIN_BYTES) {\n results.push(`\u2717 too small (${size}B): ${p}`);\n allPassed = false;\n } else {\n results.push(`\u2713 ${p} (${size}B)`);\n }\n }\n return { passed: allPassed, details: results.join(\"\\n\") };\n}\n\n/** Schedule a one-time retry after 1 skipped cycle. */\nfunction scheduleRetry(entry: CronEntry, isRetry: boolean): void {\n if (!entry.schedule || isRetry) return;\n try {\n const target = readEntry(entry.id);\n if (target) {\n target.fireAt = Date.now() + RETRY_DELAY_MS;\n target.fired = false;\n target._retrying = true;\n writeEntry(target);\n logInfo(TAG, `Scheduled retry for \"${entry.id}\" in ${RETRY_DELAY_MS / 60000}min`);\n }\n } catch (err) {\n logWarn(TAG, `Failed to schedule retry: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n\nexport type TaskCompleteCallback = (chatId: number, message: string, result: string, dodFiles?: string[]) => void;\nexport type FailInjectCallback = (entryId: string, command: string, result: string) => void;\nexport type TaskPausedCallback = (chatId: number, title: string, reason: string) => void;\n\ninterface QueuedJob {\n entry: CronEntry;\n onComplete?: TaskCompleteCallback;\n manual?: boolean;\n}\n\nexport interface RunningJob {\n entryId: string;\n message: string;\n pid: number;\n startedAt: number;\n type: \"script\" | \"agent\";\n}\n\nexport class CronQueue {\n private queue: QueuedJob[] = [];\n private _current: RunningJob | null = null;\n private timeout: ReturnType<typeof setTimeout> | null = null;\n private readonly onFailInject?: FailInjectCallback;\n private readonly onTaskPaused?: TaskPausedCallback;\n private readonly failCounts = new Map<string, { date: string; count: number }>();\n\n constructor(_cliPath: string, _workingDir: string, onFailInject?: FailInjectCallback, onTaskPaused?: TaskPausedCallback) {\n this.onFailInject = onFailInject;\n this.onTaskPaused = onTaskPaused;\n // #267: recover stale state from previous process\n const stale = loadStaleState();\n if (stale) {\n if (stale.currentJob) {\n logWarn(TAG, `Stale in-flight job detected: \"${stale.currentJob.entryId}\" (PID ${stale.pid} dead) \u2014 marking failed`);\n recordRunToFile(stale.currentJob.entryId, 1);\n }\n if (stale.queue.length > 0) {\n logWarn(TAG, `${stale.queue.length} stale queued job(s) from previous process \u2014 dropped`);\n }\n // Clear stale state\n persistState(null, []);\n }\n }\n\n /** Currently running job, or null. */\n get currentJob(): RunningJob | null { return this._current; }\n\n /** Number of jobs waiting. */\n get pending(): number { return this.queue.length; }\n\n /** Enqueue a task. Returns null on success, error string on failure. */\n enqueue(entry: CronEntry, onComplete?: TaskCompleteCallback, manual?: boolean): string | null {\n if (this._current?.entryId === entry.id) {\n return `\u23F3 Already running: \"${entry.message.slice(0, 60)}\"`;\n }\n if (this.queue.some(j => j.entry.id === entry.id)) {\n return `\u23F3 Already queued: \"${entry.message.slice(0, 60)}\"`;\n }\n\n // Priority-sorted insert\n const rank = PRIO_RANK[entry.priority ?? \"medium\"] ?? 1;\n let i = 0;\n while (i < this.queue.length) {\n const qRank = PRIO_RANK[this.queue[i]!.entry.priority ?? \"medium\"] ?? 1;\n if (rank < qRank) break;\n i++;\n }\n this.queue.splice(i, 0, { entry, onComplete, manual });\n logInfo(TAG, `Enqueued \"${entry.id}\" (${entry.executor ?? \"agent\"}, ${entry.priority ?? \"medium\"}${manual ? \", manual\" : \"\"}) \u2014 ${this.queue.length} pending`);\n persistState(this._current, this.queue);\n\n if (!this._current) this.processNext();\n return null;\n }\n\n private processNext(): void {\n if (this.queue.length === 0) return;\n\n // Skip all tasks during hardware sleep (dark wakes are too brief)\n if (readBridgeLockField(\"sleepStatus\") === \"hw_sleep\") {\n logInfo(TAG, `\u23F8 Hardware sleep \u2014 deferring ${this.queue.length} task(s)`);\n return;\n }\n\n const job = this.queue.shift()!;\n const { entry } = job;\n\n if (entry.executor === \"script\") {\n this.runScript(entry, job.onComplete);\n } else if (entry.executor === \"orc\") {\n this.runOrc(entry);\n } else {\n this.runAgent(entry, job.onComplete, job.manual);\n }\n }\n\n private setCurrent(entry: CronEntry, pid: number, type: \"script\" | \"agent\"): void {\n this._current = {\n entryId: entry.id,\n message: entry.message.slice(0, 80),\n pid,\n startedAt: Date.now(),\n type,\n };\n persistState(this._current, this.queue);\n }\n\n private clearCurrent(): void {\n if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; }\n this._current = null;\n persistState(this._current, this.queue);\n }\n\n private tryInjectFailure(entry: CronEntry, result: string): void {\n if (!this.onFailInject) return;\n const today = localDate();\n const key = entry.id;\n const fc = this.failCounts.get(key);\n if (fc && fc.date === today && fc.count >= 2) {\n logInfo(TAG, `Skip auto-fix for \"${key}\" \u2014 already 2 attempts today`);\n return;\n }\n const count = (fc?.date === today ? fc.count : 0) + 1;\n this.failCounts.set(key, { date: today, count });\n logInfo(TAG, `Injecting failure to agent for \"${key}\" (attempt ${count}/2)`);\n this.onFailInject(entry.id, entry.message, result);\n }\n\n private checkAutoPause(entry: CronEntry, exitCode: number, lastError: string): boolean {\n if (!entry.schedule) return false;\n if (exitCode === 0) {\n if (entry.consecutiveFails) { entry.consecutiveFails = 0; writeEntry(entry); }\n return false;\n }\n entry.consecutiveFails = (entry.consecutiveFails ?? 0) + 1;\n if (entry.consecutiveFails >= 3) {\n entry.paused = true;\n logWarn(TAG, `\u23F8 Auto-paused \"${entry.id}\" after ${entry.consecutiveFails} consecutive failures`);\n this.onTaskPaused?.(entry.chatId, entry.title ?? entry.message.slice(0, 60), lastError.slice(0, 200));\n writeEntry(entry);\n return true;\n }\n writeEntry(entry);\n return false;\n }\n\n private runOrc(entry: CronEntry): void {\n logInfo(TAG, `\u25B6 Orc: \"${entry.message.slice(0, 60)}\"`);\n import(\"../spin.js\").then(({ spin }) => {\n spin.dispatch({ type: \"O\", goal: entry.message, source: \"task\", priority: entry.priority ?? \"MEDIUM\", deliveryMode: entry.deliveryMode });\n this.clearCurrent();\n this.processNext();\n }).catch((err) => {\n logWarn(TAG, `Orc dispatch failed: ${err instanceof Error ? err.message : String(err)}`);\n this.clearCurrent();\n this.processNext();\n });\n }\n\n private runScript(entry: CronEntry, onComplete?: TaskCompleteCallback): void {\n logInfo(TAG, `\u25B6 Script: \"${entry.message.slice(0, 60)}\"`);\n try {\n const child = spawn(\"bash\", [\"-c\", entry.message], { stdio: [\"ignore\", \"pipe\", \"pipe\"] });\n \n this.setCurrent(entry, child.pid ?? 0, \"script\");\n\n let output = \"\";\n child.stdout?.on(\"data\", (d: Buffer) => { output += d.toString(); });\n child.stderr?.on(\"data\", (d: Buffer) => { output += d.toString(); });\n\n child.on(\"exit\", (code) => {\n const status = code === 0 ? \"\u2713\" : `\u274C (exit ${code})`;\n logInfo(TAG, `\u25A0 Script ${status}: \"${entry.message.slice(0, 60)}\"`);\n recordRunToFile(entry.id, code ?? undefined);\n if (code === 0) recordRun(entry, 0); // #694: count toward maxRunsPerDay only on success\n const paused = this.checkAutoPause(entry, code ?? 1, (output || \"(no output)\").slice(0, 200));\n if (code === 0 && output.trim() && entry.agentFollowUp && entry.agentMessage) {\n logInfo(TAG, `\u25A0 Gate triggered \u2192 enqueuing agent follow-up for \"${entry.id}\"`);\n const agentEntry: CronEntry = { ...entry, executor: \"agent\", message: entry.agentMessage.replace(\"{{GATE_OUTPUT}}\", output.trim()), agentFollowUp: undefined };\n this.clearCurrent();\n this.enqueue(agentEntry, onComplete);\n return;\n }\n if (code !== 0) {\n scheduleRetry(entry, !!entry._retrying);\n if (!paused && code !== 2) this.tryInjectFailure(entry, `${status}\\n${(output || \"(no output)\").slice(0, 500)}`);\n addTaskFailure({ taskName: entry.title ?? entry.message.slice(0, 60), exitCode: code ?? 1, error: (output || \"\").slice(0, 100), timestamp: Date.now(), consecutiveFailures: entry.consecutiveFails ?? 1 });\n }\n if (!paused) {\n // Silent success: don't notify user when script exits 0 with no output\n if (code !== 0 || output.trim()) {\n onComplete?.(entry.chatId, entry.message, `${status}\\n${(output || \"(no output)\").slice(0, 500)}`);\n }\n }\n this.clearCurrent();\n this.processNext();\n });\n\n child.on(\"error\", (err) => {\n logWarn(TAG, `Script spawn failed: ${err.message}`);\n onComplete?.(entry.chatId, entry.message, `\u274C Failed: ${err.message}`);\n this.clearCurrent();\n this.processNext();\n });\n } catch (err) {\n logWarn(TAG, `Script error: ${err instanceof Error ? err.message : String(err)}`);\n this.clearCurrent();\n this.processNext();\n }\n }\n\n private async runAgent(entry: CronEntry, onComplete?: TaskCompleteCallback, manual?: boolean): Promise<void> {\n // Idle gate: defer agent tasks if user was active in last 90s (skip for manual triggers)\n if (!manual) {\n const idleMs = Date.now() - readLastPromptAt();\n if (idleMs < 90_000) {\n logInfo(TAG, `\u23F8 Deferring agent task \"${entry.id}\" \u2014 user active ${Math.round(idleMs / 1000)}s ago`);\n entry.consecutiveFails = (entry.consecutiveFails ?? 0) + 1;\n if (entry.consecutiveFails >= 3) {\n entry.paused = true;\n logWarn(TAG, `\u23F8 Auto-paused \"${entry.id}\" after ${entry.consecutiveFails} idle-gate deferrals`);\n this.onTaskPaused?.(entry.chatId, entry.title ?? entry.message.slice(0, 60), `idle-gate hit ${entry.consecutiveFails}\u00D7 in a row`);\n }\n writeEntry(entry);\n scheduleRetry(entry, !!entry._retrying);\n this.clearCurrent();\n this.processNext();\n return;\n }\n }\n\n // Read task file if specified, otherwise use inline message\n let prompt = entry.message;\n let dodPaths: string[] = [];\n if (entry.taskFile) {\n const task = readTaskFile(entry.taskFile);\n if (task) {\n prompt = task.prompt;\n dodPaths = task.dodPaths;\n } else {\n logWarn(TAG, `Falling back to inline message for \"${entry.id}\"`);\n }\n }\n\n // #1141: Inject task-scoped persistent context if it exists\n const contextFile = join(abtarsHome(), \"workspace\", entry.id, \"CONTEXT.md\");\n if (existsSync(contextFile)) {\n const raw = readFileSync(contextFile, \"utf-8\").trim();\n if (raw) {\n const ctx = raw.length > 30000 ? (logWarn(TAG, `Task context truncated (${raw.length} > 30000)`), raw.slice(0, 30000)) : raw;\n prompt = `[TASK CONTEXT \u2014 your notes from previous runs]\\n${ctx}\\n\\n[TASK]\\n${prompt}`;\n logInfo(TAG, `Injected task context (${ctx.length} chars)`);\n }\n }\n\n logInfo(TAG, `\u25B6 Agent: \"${entry.message.slice(0, 60)}\"`);\n\n // #936 Phase 2: Route to user session via injectGreeting if targetUserId is set\n if (entry.targetUserId) {\n this.setCurrent(entry, 0, \"agent\");\n try {\n const { spin } = await import(\"../spin.js\");\n const response = await spin.injectGreeting(entry.targetUserId, prompt);\n if (response) {\n recordRunToFile(entry.id, 0);\n recordRun(entry, 0);\n logInfo(TAG, `\u2713 Greeting delivered to ${entry.targetUserId}`);\n } else {\n recordRunToFile(entry.id, 1);\n logWarn(TAG, `Greeting failed for ${entry.targetUserId}`);\n }\n } catch (err) {\n recordRunToFile(entry.id, 1);\n logWarn(TAG, `Greeting error: ${err instanceof Error ? err.message : String(err)}`);\n } finally {\n this.clearCurrent();\n this.processNext();\n }\n return;\n }\n\n // Set current BEFORE any await \u2014 prevents race where enqueue() sees _current=null\n // and calls processNext() again while we're awaiting the dynamic import.\n this.setCurrent(entry, 0, \"agent\");\n\n // #1141: Skill-trigger task \u2014 delegate to launchSkill()\n if ((entry as any).skill) {\n const { launchSkill } = await import(\"../skill-session.js\");\n const userId = entry.targetUserId ?? String(entry.chatId);\n const err = await launchSkill((entry as any).skill, userId, String(entry.chatId), prompt);\n if (err) logWarn(TAG, `Skill launch failed for \"${entry.id}\": ${err}`);\n else logInfo(TAG, `\u25A0 Skill \"${(entry as any).skill}\" launched for \"${entry.id}\"`);\n recordRunToFile(entry.id, err ? 1 : 0);\n if (!err) recordRun(entry, 0);\n this.clearCurrent();\n this.processNext();\n return;\n }\n\n // Kanban board: track this task (Spin handles card lifecycle)\n // Set $WORKSPACE for agent tool execution \u2014 all output goes here\n const workspace = join(abtarsHome(), \"workspace\", entry.id);\n mkdirSync(workspace, { recursive: true });\n process.env[\"WORKSPACE\"] = workspace;\n\n const { spin } = await import(\"../spin.js\");\n\n // 30-min hard timeout\n this.timeout = setTimeout(() => {\n logWarn(TAG, `\u23F1\uFE0F Agent \"${entry.id}\" timed out (30min)`);\n }, AGENT_TIMEOUT_MS);\n\n // #935: map agent field to session type (canonical task routing \u2014 distinct from TYPE_AGENT in spin-types which maps type\u2192model-role)\n const AGENT_SESSION: Record<string, string> = { professor: \"A\", browsie: \"B\", coding: \"C\", dreamy: \"D\" };\n const sessionType = (AGENT_SESSION[entry.agent ?? \"\"] ?? \"T\") as import(\"../spin-types.js\").SessionType;\n\n spin.dispatchAwait({ type: sessionType, title: entry.title ?? entry.message.slice(0, 80), goal: prompt, source: \"task\", priority: entry.priority ?? \"MEDIUM\", chatId: String(entry.chatId), deliveryMode: entry.deliveryMode, maxToolRounds: entry.maxToolRounds })\n .then(({ cardId: boardId, result: response }) => {\n // Guard: if model returned raw JSON tool output ({\"stdout\":...,\"exit_code\":...}),\n // extract just the meaningful content. This happens when the model echoes its last\n // tool result instead of synthesizing a human-readable response.\n let cleaned = response || \"(no output)\";\n try {\n const parsed = JSON.parse(cleaned);\n if (parsed && typeof parsed === \"object\" && \"exit_code\" in parsed) {\n cleaned = parsed.stdout || parsed.stderr || \"(task completed)\";\n }\n } catch (err) { logAndSwallow(TAG, \"JSON.parse task output\", err); }\n const summary = cleaned.slice(0, 500);\n let exitCode = 0;\n let dodResult = \"\";\n if (dodPaths.length > 0) {\n const dod = checkDoD(dodPaths);\n // If DoD paths missing but model produced substantial output, accept it\n if (!dod.passed && cleaned.length > 200) {\n dod.passed = true;\n dod.details += \"\\n\u2713 accepted: model output written to result file\";\n }\n exitCode = dod.passed ? 0 : 1;\n dodResult = `\\nDoD: ${dod.passed ? \"PASSED\" : \"FAILED\"}\\n${dod.details}`;\n logInfo(TAG, `\u25A0 Agent DoD ${dod.passed ? \"\u2713\" : \"\u274C\"}: \"${entry.message.slice(0, 60)}\"\\n${dod.details}`);\n } else {\n logInfo(TAG, `\u25A0 Agent completed: \"${entry.message.slice(0, 60)}\"`);\n }\n\n // Write result file \u2014 skip if DoD files exist (they ARE the result)\n // #1118: inline tasks skip file writing \u2014 deliver text directly via kanban\n const producedFiles = dodPaths.filter(p => existsSync(p));\n const isReport = entry.deliveryMethod === \"report\";\n const resultPath = producedFiles.length > 0 ? producedFiles[0] : (isReport ? writeResultFile(entry.id, cleaned) : null);\n if (resultPath) logInfo(TAG, `\u25A0 Result: ${resultPath}`);\n\n // Kanban board: mark complete or failed\n if (exitCode === 0) {\n // #1118: inline tasks store full response as summary (delivered as chat message)\n const kanbanSummary = isReport ? summary : cleaned;\n kanbanComplete(boardId, resultPath ?? null, kanbanSummary);\n } else {\n kanbanFail(boardId, `${summary}${dodResult}`);\n }\n\n recordRunToFile(entry.id, exitCode);\n if (exitCode === 0) recordRun(entry, 0); // #694: count toward maxRunsPerDay only on success\n const paused = this.checkAutoPause(entry, exitCode, `${summary}${dodResult}`);\n const icon = exitCode === 0 ? \"\u2713\" : \"\u274C\";\n if (exitCode !== 0) {\n scheduleRetry(entry, !!entry._retrying);\n if (!paused) this.tryInjectFailure(entry, `${icon} ${summary}${dodResult}`);\n }\n if (!paused) {\n const producedFiles = dodPaths.filter(p => existsSync(p));\n onComplete?.(entry.chatId, entry.message, `${icon} ${summary}${dodResult}`, producedFiles.length > 0 ? producedFiles : undefined);\n }\n })\n .catch((err: unknown) => {\n const boardId = 0; // card already tracked by Spin\n logWarn(TAG, `Agent failed: ${err instanceof Error ? err.message : String(err)}`);\n kanbanFail(boardId, err instanceof Error ? err.message : String(err));\n recordRunToFile(entry.id, 1);\n const paused = this.checkAutoPause(entry, 1, err instanceof Error ? err.message : String(err));\n scheduleRetry(entry, !!entry._retrying);\n if (!paused) {\n const errMsg = `\u274C Failed: ${err instanceof Error ? err.message : String(err)}`;\n this.tryInjectFailure(entry, errMsg);\n onComplete?.(entry.chatId, entry.message, errMsg);\n }\n })\n .finally(() => {\n this.clearCurrent();\n this.processNext();\n });\n }\n}\n", "import { mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { logInfo, logWarn, logDebug } from \"./logger.js\";\nimport type { IKiroTransport } from \"./transport/kiro-transport.js\";\nimport { localDate } from \"../utils/date.js\";\n\nconst CHAT_SAVE_IDLE_MS = 10 * 60 * 1000;\n\n/**\n * Manages idle-save timers: after 10 min of inactivity per session,\n * saves the kiro-cli conversation transcript to the working directory.\n */\nexport class IdleSave {\n private readonly timers = new Map<string, ReturnType<typeof setTimeout>>();\n private readonly transport: IKiroTransport;\n private readonly memoryDir: string;\n private readonly enabled: boolean;\n\n constructor(transport: IKiroTransport, memoryDir: string, memoryEnabled: boolean) {\n this.transport = transport;\n this.memoryDir = memoryDir;\n this.enabled = memoryEnabled;\n }\n\n getTimers(): Map<string, ReturnType<typeof setTimeout>> {\n return this.timers;\n }\n\n reset(sessionKey: string, chatId: number): void {\n const existing = this.timers.get(sessionKey);\n if (existing) clearTimeout(existing);\n this.timers.set(sessionKey, setTimeout(() => {\n this.timers.delete(sessionKey);\n this.save(sessionKey, chatId);\n }, CHAT_SAVE_IDLE_MS));\n }\n\n async save(sessionKey: string, chatId: number): Promise<void> {\n if (!this.enabled || !this.memoryDir) return;\n // /chat save only works on tmux transport, not ACP\n if (!(\"sendKeys\" in this.transport)) return;\n const today = localDate();\n const dir = join(this.memoryDir, \"working\", today);\n try { mkdirSync(dir, { recursive: true }); } catch { logDebug(\"idle-save\", `Cannot create ${dir} \u2014 skipping`); return; }\n const dest = join(dir, `transcript_${chatId}.chat`);\n try {\n await this.transport.sendPrompt(sessionKey, `/chat save ${dest}`);\n logInfo(\"idle-save\", `Chat saved to ${dest}`);\n } catch (e) {\n logWarn(\"idle-save\", `Chat save failed: ${e instanceof Error ? e.message : JSON.stringify(e)}`);\n }\n }\n\n clearAll(): void {\n for (const timer of this.timers.values()) clearTimeout(timer);\n this.timers.clear();\n }\n}\n", "/**\n * phase-pipeline-deps \u2014 boot phase 5: construct CronQueue + pipelineDeps object.\n *\n * Must run after phase-transport (uses ctx.transport). Runs before\n * phase-platforms (platforms' adapters close over ctx.pipelineDeps).\n *\n * - Constructs CodingMode, IdleSave, CronQueue\n * - Wires setEnqueueCron singleton (tool-registry)\n * - Builds the PipelineDeps object \u2014 closes over ctx fields so later phases\n * can populate sleepHandle, selfHealerTask, loadedCapabilities via ctx\n * mutation without rewiring\n * - cronCallback closes over ctx so it reads telegramAdapter when fired\n *\n * Owns singleton: tool-registry._enqueueCron (via setEnqueueCron).\n *\n * Populates ctx: cronQueue, idleSave, pipelineDeps.\n */\n\nimport { readEntry as cronReadEntry } from \"../components/tasks/task-store.js\";\nimport { CronQueue } from \"../components/tasks/task-queue.js\";\nimport { IdleSave } from \"../components/idle-save.js\";\nimport { logWarn, logInfo } from \"../components/logger.js\";\nimport { loadTransport, resolveAgent } from \"../components/transport-config.js\";\nimport { updateCtxStart } from \"./ctx-start.js\";\nimport type { BootCtx, PhaseResult } from \"./context.js\";\nimport type { PipelineDeps } from \"../components/message-pipeline.js\";\nimport type { TaskCompleteCallback } from \"../components/tasks/task-queue.js\";\nimport { getEnv } from \"../components/env-schema.js\";\n\nexport async function phasePipelineDeps(ctx: BootCtx): Promise<PhaseResult> {\n const { config, memoryConfig, transport } = ctx;\n if (!transport) { ctx.phaseHealth.set(phasePipelineDeps.name, { status: \"skipped\", error: \"no transport\" }); logWarn(\"boot\", `${phasePipelineDeps.name}: skipping \u2014 transport not available`); return \"skipped\"; }\n\n ctx.idleSave = new IdleSave(transport, memoryConfig.memoryDir, memoryConfig.memoryEnabled);\n\n // CronQueue first \u2014 pipelineDeps references it\n let shaState: \"idle\" | \"running\" | \"cooldown\" = \"idle\";\n const shaPending: string[] = [];\n const cronQueue = new CronQueue(\n config.transport.agentCliPath,\n config.transport.workingDir,\n (entryId, command, result) => {\n // Three-state SHA guard (#719)\n if (shaState === \"running\") return; // drop entirely \u2014 SHA might be fixing it\n if (ctx.telegramAdapter) {\n ctx.telegramAdapter.sendNotification(String(getEnv().mainChatId), `\u26A0\uFE0F ${entryId} failed`);\n }\n if (!getEnv().selfhealEnabled) return;\n if (shaState === \"cooldown\") {\n shaPending.push(entryId);\n return;\n }\n // SHA idle \u2192 fire\n shaState = \"running\";\n const pending = shaPending.length > 0 ? `\\nAlso failed recently: ${shaPending.join(\", \")}` : \"\";\n shaPending.length = 0;\n if (ctx.telegramAdapter) {\n ctx.telegramAdapter.sendNotification(String(getEnv().mainChatId), `\uD83D\uDD27 Calling SHA, reason: \"${entryId}\" failed`);\n }\n const msg = `[System] You ARE the self-healing agent. A scheduled task failed:\\nTask: \"${entryId}\"\\nCommand: ${command}\\nResult: ${result}${pending}\\n\\nDiagnose the root cause. If you can fix it programmatically (script fix, token refresh, pause task), do it. If the fix requires human action (manual browser login, external service down), state clearly: \"Requires human intervention: <reason>\" \u2014 do NOT create a skill or suggest adding error handling (you ARE the error handling). Be concise.\\n\\nFORBIDDEN: Do NOT modify vital config files unless the bridge is in a crash loop or cannot boot:\\n- transport.json\\n- .env / .env.skills\\n- peers.json\\n- users.json\\nException: fixing JSON structural corruption (invalid syntax, parse errors) is always allowed.\\n\\nA single task failure is NOT grounds for config changes. Investigate root cause, report findings.`;\n void (async () => {\n try {\n // #1271: SHA goes through the unified spin() chokepoint (S profile =\n // coding agent, call-terminate \u2014 session is created and deleted).\n await ctx.sessionManager.spin({\n type: \"S\",\n prompt: msg,\n await: true,\n });\n } catch (err) {\n logWarn(\"main\", `SHA session failed: ${err}`);\n } finally {\n shaState = \"cooldown\";\n setTimeout(() => { shaState = \"idle\"; }, 60_000);\n }\n })();\n },\n (chatId, title, _reason) => {\n if (!ctx.telegramAdapter) return;\n const msg = `\u26D4 \"${title}\" needs manual fix, further errors suppressed.\\nResume with: /task resume <id>`;\n ctx.telegramAdapter.sendNotification(String(chatId), msg);\n },\n );\n ctx.cronQueue = cronQueue;\n\n // cronCallback closes over ctx \u2014 reads telegramAdapter lazily (set in phase-platforms)\n const cronCallback: TaskCompleteCallback = (_chatId, _message, _result, _dodFiles) => {\n // #857: delivery handled by kanban board poll in heartbeat-tasks.\n // Board was already updated by task-queue (kanbanComplete/kanbanFail).\n // Main agent picks up done cards and delivers on next interaction.\n };\n\n // Wire task_manage --run to the cron queue (singleton: _enqueueCron)\n const { setEnqueueCron } = await import(\"../components/transport/tool-registry.js\");\n const enqueueCron = (id: string, manual?: boolean): string | null => {\n try {\n const entry = cronReadEntry(id);\n if (!entry) return `\u274C Entry ${id} not found`;\n return cronQueue.enqueue(entry, cronCallback, manual);\n } catch (err) {\n return `\u274C ${err instanceof Error ? err.message : String(err)}`;\n }\n };\n setEnqueueCron(enqueueCron);\n\n // Wire secret_get tool to memory DB\n\n // #894: Wire Spin (which IS the session manager now) to runtime\n const { spin } = await import(\"../components/spin.js\");\n spin.setRuntime(ctx.runtime);\n if (ctx.memory) spin.setMemory(ctx.memory as any);\n\n // #936: Register master session in Spin\n const { loadUsers } = await import(\"../components/user-registry.js\");\n const registry = loadUsers();\n const masterUser = registry.users.find(u => u.role === \"master\");\n if (masterUser && transport) {\n const masterChatId = masterUser.platforms.telegram ?? masterUser.platforms.discord;\n if (masterChatId) {\n spin.registerMasterSession({\n userId: masterUser.userId,\n chatId: typeof masterChatId === \"number\" ? masterChatId : parseInt(String(masterChatId), 10),\n platform: masterUser.platforms.telegram ? \"telegram\" : \"discord\",\n transport,\n });\n }\n }\n\n // #998: Set system prompt AFTER memory state is known\n if (transport && \"setSystemPrompt\" in transport && typeof (transport as any).setSystemPrompt === \"function\") {\n const { buildSoulBundle } = await import(\"../components/soul-bundle.js\");\n const bundle = buildSoulBundle(\"A\", ctx.memory ?? null);\n if (bundle) (transport as { setSystemPrompt: (p: string) => void }).setSystemPrompt(bundle);\n }\n\n // #907: Register Nerve notification listeners for Orc\n await import(\"../components/spin-notifications.js\");\n\n // #540: Resume Orc if it was active before crash\n const { readBridgeLockField } = await import(\"../components/transport/bridge-lock-transport.js\");\n const orcCard = readBridgeLockField<number>(\"orc_active\");\n if (orcCard) {\n logInfo(\"boot\", `Orc was active (card #${orcCard}) \u2014 resuming`);\n spin.dispatch({ type: \"O\", goal: \"Resume: reconcile kanban state for your active project\", source: \"agent\", cardId: orcCard });\n }\n\n // Build pipelineDeps. References ctx fields; later phases mutate ctx.sleepHandle /\n // pipelineDeps.loadedCapabilities / pipelineDeps.selfHealerTask in place.\n const pipelineDeps: PipelineDeps = {\n transport,\n memory: ctx.memory,\n memoryConfig,\n nlmConfig: ctx.nlmConfig,\n idleSave: ctx.idleSave,\n conversationBuffer: ctx.conversationBuffer,\n config: {\n workingDir: config.transport.workingDir,\n },\n startedAt: ctx.startedAt,\n sttConfig: ctx.sttConfig,\n ttsConfig: ctx.ttsConfig,\n sessionManager: ctx.sessionManager,\n updateCtxStart,\n cronCurrentJob: () => cronQueue.currentJob,\n enqueueCron,\n requestShutdown: (code?: number) => ctx.requestShutdownWithCode(code ?? 0),\n sleepProgress: () => ctx.sleepHandle?.progress ?? null,\n loadedCapabilities: [],\n selfHealerTask: null,\n hailMary: ctx.hailMary,\n rebuildTransport: async () => {\n const { rebuildTransport } = await import(\"./phase-transport.js\");\n await rebuildTransport(ctx);\n },\n phaseHealth: ctx.phaseHealth,\n registry: ctx.registry,\n bridgeLockPath: ctx.bridgeLockPath,\n get maxContext() {\n try {\n const tc = loadTransport();\n if (tc) {\n const prof = resolveAgent(\"professor\", tc);\n if (prof?.contextWindow) return prof.contextWindow;\n }\n } catch { /* fallback */ }\n return 128000;\n },\n };\n ctx.pipelineDeps = pipelineDeps;\n\n // #944 Step C: Wire full message handler on already-connected platforms\n const { handleInboundMessage } = await import(\"../components/message-pipeline.js\");\n if (ctx.telegramAdapter) {\n ctx.telegramAdapter.setMessageHandler({ pipeline: pipelineDeps, conversationBuffer: ctx.conversationBuffer, transport, memory: ctx.memory, sessionManager: ctx.sessionManager, actionGate: ctx.actionGate });\n logInfo(\"boot\", \"Telegram: full pipeline wired\");\n }\n if (ctx.discordAdapter) {\n ctx.discordAdapter.setMessageHandler({ pipeline: pipelineDeps, transport, memory: ctx.memory, conversationBuffer: ctx.conversationBuffer });\n logInfo(\"boot\", \"Discord: full pipeline wired\");\n }\n for (const [name, adapter] of ctx.platformAdapters) {\n if (name === \"irc\" && \"setMessageHandler\" in adapter) {\n (adapter as any).setMessageHandler((msg: any) => handleInboundMessage(msg, adapter, pipelineDeps));\n logInfo(\"boot\", \"IRC: full pipeline wired\");\n }\n }\n\n // Drain recovery queue \u2014 messages that arrived before pipeline was ready\n const recoveryQueue = (ctx as any)._recoveryQueue as Array<{ msg: any; adapter: any }> | undefined;\n if (recoveryQueue?.length) {\n logInfo(\"boot\", `Draining ${recoveryQueue.length} queued message(s) from recovery handler`);\n for (const { msg, adapter } of recoveryQueue) {\n handleInboundMessage(msg, adapter, pipelineDeps).catch(err => logWarn(\"boot\", `Drain error: ${err}`));\n }\n recoveryQueue.length = 0;\n }\n\n // Wire send_document tool + ActionGate (moved from phase-platforms)\n if (ctx.telegramAdapter) {\n const mainChatId = config.mainChatId;\n if (mainChatId) {\n const { setSendDocument } = await import(\"../components/transport/tool-registry.js\");\n setSendDocument((path, caption) => ctx.telegramAdapter!.sendDocument(String(mainChatId), path, caption));\n if (ctx.actionGate) {\n const api = (ctx.telegramAdapter as any).api;\n const chatId = String(mainChatId);\n ctx.actionGate.setNotify(async (text: string, buttons: Array<{ text: string; data: string }>) => {\n const opts: any = {};\n if (buttons.length > 0) {\n opts.reply_markup = { inline_keyboard: [buttons.map((b: any) => ({ text: b.text, callback_data: b.data }))] };\n }\n await api.sendMessage(chatId, text, opts);\n });\n }\n }\n }\n // Wire IRC send tool\n const ircAdapter = ctx.platformAdapters.get(\"irc\");\n if (ircAdapter) {\n const { setIrcSend } = await import(\"../components/transport/tool-registry.js\");\n setIrcSend((channel, message) => { ircAdapter.sendMessage(channel, message); });\n }\n\n // #1000: \"Back online\" notification moved to bridge-app.ts (fires before greeting)\n\n // #949: Wire channel\u2192remote sync listener\n const { initChannelSync } = await import(\"../components/tasks/kanban-channel.js\");\n initChannelSync();\n\n // Register Tier 3 heartbeat tasks (cron, kanban, self-healer, model-health, etc.)\n const { registerTier3Tasks } = await import(\"./heartbeat-tier3.js\");\n await registerTier3Tasks(ctx);\n\n return \"ran\";\n}\n\n/** Export cronCallback factory for phase-heartbeat's age-check task re-enqueue. */\nexport function createCronCallback(_ctx: BootCtx): TaskCompleteCallback {\n return (_chatId, _message, _result, _dodFiles) => {\n // #857/#1020: delivery handled exclusively by kanban board (phase-heartbeat card:done handler).\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;AAGA;AACA;AACA,yBAAqC;AAJrC,SAAS,YAAY,cAAc,eAAe,iBAAiB;AACnE,SAAS,YAAY;AAOrB,IAAM,MAAM;AACZ,IAAM,YAAY,MAAc,KAAK,WAAW,GAAG,OAAO;AAC1D,IAAM,gBAAgB,MAAc,KAAK,UAAU,GAAG,wBAAwB;AASvE,SAAS,uBAA0C;AACxD,MAAI,CAAC,WAAW,cAAc,CAAC,EAAG,QAAO,CAAC;AAC1C,MAAI;AAAE,WAAO,KAAK,MAAM,aAAa,cAAc,GA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,OAAY,CAAC;AACnB,cAAI,QAAQ,SAAS,GAAG;AACtB,iBAAK,eAAe,EAAE,iBAAiB,CAAC,QAAQ,IAAI,CAAC,OAAY,EAAE,MAAM,EAAE,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE;AAAA,UAC9G;AACA,gBAAM,IAAI,YAAY,QAAQ,MAAM,IAAI;AAAA,QAC1C,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAa,IAAI,iBAAiB,IAAI,KAAK;AACjD,MAAI,YAAY;AACd,UAAM,EAAE,WAAW,IAAI,MAAM,OAAO,6BAA0C;AAC9E,eAAW,CAAC,SAAS,YAAY;AAAE,iBAAW,YAAY,SAAS,OAAO;AAAA,IAAG,CAAC;AAAA,EAChF;AAKA,QAAM,EAAE,gBAAgB,IAAI,MAAM,OAAO,8BAAuC;AAChF,kBAAgB;AAGhB,QAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,+BAAsB;AAClE,QAAM,mBAAmB,GAAG;AAE5B,SAAO;AACT;AAGO,SAAS,mBAAmB,MAAqC;AACtE,SAAO,CAAC,SAAS,UAAU,SAAS,cAAc;AAAA,EAElD;AACF;",
6
- "names": ["recordRun", "readFileSync", "TAG", "TAG", "readFileSync", "join", "abtarsHome", "statSync", "spin", "existsSync", "readFileSync", "writeFileSync", "mkdirSync", "join", "TAG", "join", "writeFileSync", "existsSync", "readFileSync", "mkdirSync", "spin", "recordRun", "producedFiles", "mkdirSync", "join", "memoryDir", "join", "mkdirSync", "spin", "readBridgeLockField"]
7
- }
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
3
- import {
4
- init_logger,
5
- logDebug,
6
- logError,
7
- logWarn
8
- } from "./chunk-GWILHZPT.js";
9
-
10
- // src/utils/abmind-lazy.ts
11
- init_logger();
12
- import { createRequire } from "node:module";
13
- import { readFileSync } from "node:fs";
14
- var ABMIND_MIN = [0, 3, 0];
15
- var _mod = null;
16
- var _loaded = false;
17
- function resetAbmindCache() {
18
- _mod = null;
19
- _loaded = false;
20
- }
21
- function parseSemver(v) {
22
- const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
23
- return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
24
- }
25
- function lt(a, b) {
26
- return a[0] !== b[0] ? a[0] < b[0] : a[1] !== b[1] ? a[1] < b[1] : a[2] < b[2];
27
- }
28
- function isSupportedVersion(version) {
29
- const p = parseSemver(version);
30
- return !!p && !lt(p, ABMIND_MIN);
31
- }
32
- function readResolvedAbmindVersion() {
33
- try {
34
- const req = createRequire(import.meta.url);
35
- const pkgPath = req.resolve("abmind/package.json");
36
- return JSON.parse(readFileSync(pkgPath, "utf-8")).version ?? null;
37
- } catch {
38
- return null;
39
- }
40
- }
41
- async function loadAbmind() {
42
- if (_loaded) return _mod;
43
- _loaded = true;
44
- let mod = null;
45
- try {
46
- const req = createRequire(import.meta.url);
47
- const resolvedPath = req.resolve("abmind");
48
- mod = await import(resolvedPath);
49
- } catch {
50
- mod = null;
51
- }
52
- if (!mod) {
53
- logWarn("boot", "abmind not installed \u2014 running without persistent memory");
54
- _mod = null;
55
- return null;
56
- }
57
- const ver = readResolvedAbmindVersion();
58
- if (!ver || !isSupportedVersion(ver)) {
59
- logError(
60
- "boot",
61
- `abmind@${ver ?? "?"} is below the supported floor ${ABMIND_MIN.join(".")} \u2014 memory disabled to avoid a silent contract break. Upgrade: npm install -g abmind@latest`
62
- );
63
- _mod = null;
64
- return null;
65
- }
66
- logDebug("boot", `memory: enabled via abmind@${ver}`);
67
- _mod = mod;
68
- return _mod;
69
- }
70
- function abmind() {
71
- return _mod;
72
- }
73
-
74
- export {
75
- ABMIND_MIN,
76
- resetAbmindCache,
77
- parseSemver,
78
- isSupportedVersion,
79
- loadAbmind,
80
- abmind
81
- };
82
- //# sourceMappingURL=chunk-IKUZPMVA.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/utils/abmind-lazy.ts"],
4
- "sourcesContent": ["/**\n * Lazy abmind loader \u2014 pre-loaded once at boot, then available synchronously.\n * ALL runtime access to abmind goes through here.\n *\n * If abmind is not installed, or is below the supported contract version\n * (#1243), abmind() returns null and the bridge runs without persistent\n * memory (nullMemory). A below-floor abmind is rejected loudly \u2014 never a\n * silent contract break that would quietly drop memory mid-session.\n */\nimport { createRequire } from \"node:module\";\nimport { readFileSync } from \"node:fs\";\nimport { logDebug, logError, logWarn } from \"../components/logger.js\";\n\ntype AbmindModule = typeof import(\"abmind\");\n\n/**\n * Minimum abmind version that provides the supported contract surface\n * (abmind SUPPORTED-SURFACE.md, #1243). Below this \u2192 memory disabled loudly.\n * Bump only when abtars starts relying on newer surface.\n */\nexport const ABMIND_MIN: readonly [number, number, number] = [0, 3, 0];\n\nlet _mod: AbmindModule | null = null;\nlet _loaded = false;\n\n/** Reset cache \u2014 called on in-process restart. */\nexport function resetAbmindCache(): void {\n _mod = null;\n _loaded = false;\n}\n\n/** Parse the leading major.minor.patch from a semver string (ignores pre-release/build). */\nexport function parseSemver(v: string): [number, number, number] | null {\n const m = /^(\\d+)\\.(\\d+)\\.(\\d+)/.exec(v);\n return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;\n}\n\nfunction lt(a: readonly [number, number, number], b: readonly [number, number, number]): boolean {\n return a[0] !== b[0] ? a[0] < b[0] : a[1] !== b[1] ? a[1] < b[1] : a[2] < b[2];\n}\n\n/** True iff `version` is at least ABMIND_MIN (the supported contract floor). */\nexport function isSupportedVersion(version: string): boolean {\n const p = parseSemver(version);\n return !!p && !lt(p, ABMIND_MIN);\n}\n\n/** Read the version of the resolvable abmind package, or null if not resolvable. */\nfunction readResolvedAbmindVersion(): string | null {\n try {\n const req = createRequire(import.meta.url);\n const pkgPath = req.resolve(\"abmind/package.json\");\n return (JSON.parse(readFileSync(pkgPath, \"utf-8\")).version as string) ?? null;\n } catch {\n return null;\n }\n}\n\n/** Call once at boot (phase-memory). Caches the module. Returns null if unavailable or below-floor. */\nexport async function loadAbmind(): Promise<AbmindModule | null> {\n if (_loaded) return _mod;\n _loaded = true;\n\n let mod: AbmindModule | null = null;\n try {\n const req = createRequire(import.meta.url);\n const resolvedPath = req.resolve(\"abmind\");\n mod = await import(resolvedPath);\n } catch {\n mod = null;\n }\n if (!mod) {\n logWarn(\"boot\", \"abmind not installed \u2014 running without persistent memory\");\n _mod = null;\n return null;\n }\n\n const ver = readResolvedAbmindVersion();\n if (!ver || !isSupportedVersion(ver)) {\n logError(\n \"boot\",\n `abmind@${ver ?? \"?\"} is below the supported floor ${ABMIND_MIN.join(\".\")} \u2014 memory disabled to avoid a silent contract break. Upgrade: npm install -g abmind@latest`,\n );\n _mod = null;\n return null;\n }\n\n logDebug(\"boot\", `memory: enabled via abmind@${ver}`);\n _mod = mod;\n return _mod;\n}\n\n/** Synchronous access after loadAbmind() has been called. Returns null if unavailable. */\nexport function abmind(): AbmindModule | null {\n return _mod;\n}\n"],
5
- "mappings": ";;;;;;;;;;AAWA;AAFA,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAUtB,IAAM,aAAgD,CAAC,GAAG,GAAG,CAAC;AAErE,IAAI,OAA4B;AAChC,IAAI,UAAU;AAGP,SAAS,mBAAyB;AACvC,SAAO;AACP,YAAU;AACZ;AAGO,SAAS,YAAY,GAA4C;AACtE,QAAM,IAAI,uBAAuB,KAAK,CAAC;AACvC,SAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI;AAC1D;AAEA,SAAS,GAAG,GAAsC,GAA+C;AAC/F,SAAO,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;AAC/E;AAGO,SAAS,mBAAmB,SAA0B;AAC3D,QAAM,IAAI,YAAY,OAAO;AAC7B,SAAO,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,UAAU;AACjC;AAGA,SAAS,4BAA2C;AAClD,MAAI;AACF,UAAM,MAAM,cAAc,YAAY,GAAG;AACzC,UAAM,UAAU,IAAI,QAAQ,qBAAqB;AACjD,WAAQ,KAAK,MAAM,aAAa,SAAS,OAAO,CAAC,EAAE,WAAsB;AAAA,EAC3E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,eAAsB,aAA2C;AAC/D,MAAI,QAAS,QAAO;AACpB,YAAU;AAEV,MAAI,MAA2B;AAC/B,MAAI;AACF,UAAM,MAAM,cAAc,YAAY,GAAG;AACzC,UAAM,eAAe,IAAI,QAAQ,QAAQ;AACzC,UAAM,MAAM,OAAO;AAAA,EACrB,QAAQ;AACN,UAAM;AAAA,EACR;AACA,MAAI,CAAC,KAAK;AACR,YAAQ,QAAQ,+DAA0D;AAC1E,WAAO;AACP,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,0BAA0B;AACtC,MAAI,CAAC,OAAO,CAAC,mBAAmB,GAAG,GAAG;AACpC;AAAA,MACE;AAAA,MACA,UAAU,OAAO,GAAG,iCAAiC,WAAW,KAAK,GAAG,CAAC;AAAA,IAC3E;AACA,WAAO;AACP,WAAO;AAAA,EACT;AAEA,WAAS,QAAQ,8BAA8B,GAAG,EAAE;AACpD,SAAO;AACP,SAAO;AACT;AAGO,SAAS,SAA8B;AAC5C,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/components/transport/tool-registry.ts", "../src/components/transport/skill-authoring.ts", "../src/components/transport/mcp-tool.ts", "../src/components/transport/peer-delegation-tools.ts", "../src/components/transport/kanban-tool.ts", "../src/components/transport/channel-tool.ts"],
4
- "sourcesContent": ["/**\n * Tool registry for DirectApiTransport.\n * Phase 2: native tool schemas. Phase 3: in-process memory when available.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { appendFileSync, mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport type { MemoryBackend } from \"abmind\";\nimport type { InstantStoreParams } from \"../../types/index.js\";\nimport { logWarn, redactSecrets } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport { checkTool, checkPath, auditDeny, type SandboxPolicy } from \"../tool-sandbox.js\";\nimport { getMasterUserId } from \"../master-user.js\";\n\nconst TAG = \"tool_registry\";\n\n// #449: append-only audit log\nconst AUDIT_DIR = join(process.env[\"ABTARS_HOME\"] ?? join(homedir(), \".abtars\"), \"logs\");\nconst AUDIT_PATH = join(AUDIT_DIR, \"audit.jsonl\");\ntry { mkdirSync(AUDIT_DIR, { recursive: true }); } catch (err) { logAndSwallow(TAG, \"mkdirSync audit dir\", err); }\nfunction audit(entry: Record<string, unknown>): void {\n try { appendFileSync(AUDIT_PATH, JSON.stringify(entry) + \"\\n\"); } catch (err) { logAndSwallow(TAG, \"audit write\", err); }\n}\n\nexport type ToolDefinition = {\n readonly name: string;\n readonly description: string;\n readonly parameters: Record<string, unknown>;\n execute(args: Record<string, string>, context?: { userId: string; signal?: AbortSignal }): Promise<string>;\n};\n\nconst BASH_TIMEOUT_MS = 300_000;\nconst CLI_TIMEOUT_MS = 60_000;\n\n// #1266: when no in-process memory backend is wired, return this error\n// rather than silently shelling out to a CLI on PATH we don't trust.\nconst MEMORY_BACKEND_ERROR = \"memory backend not initialized \u2014 abmind failed to load or below supported floor\";\n\n/**\n * Patterns that would spawn or restart a bridge/watchdog process.\n * Blocked to prevent the LLM (especially fallback models) from accidentally\n * starting a second bridge instance, which would cause port conflicts,\n * Telegram 409 errors, and bridge.lock PID confusion.\n *\n * See post-mortem of 2026-04-22 outage: cron agent ran execute_bash that\n * spawned a rogue bridge alongside the watchdog-supervised one.\n */\nconst BLOCKED_PATTERNS: readonly RegExp[] = [\n /\\bmain\\.js\\b/, // node .../current/dist/main.js ...\n /\\babtars\\.sh\\b/, // the launcher\n /\\bwatchdog\\.sh\\b/, // the watchdog\n /\\blaunchctl\\s+(load|bootstrap|kickstart|start)\\b/, // launchd bridge start\n];\n\nexport function isBridgeSpawnCommand(cmd: string): boolean {\n return BLOCKED_PATTERNS.some(p => p.test(cmd));\n}\n\n/** Block kill/pkill/killall targeting the bridge's own PID or process patterns (#414). */\nfunction isBridgeKillCommand(cmd: string): boolean {\n const pid = process.pid;\n const ppid = process.ppid;\n // Direct kill of own PID or parent\n if (new RegExp(`\\\\bkill\\\\s+(-\\\\d+\\\\s+)?${pid}\\\\b`).test(cmd)) return true;\n if (new RegExp(`\\\\bkill\\\\s+(-\\\\d+\\\\s+)?${ppid}\\\\b`).test(cmd)) return true;\n // pkill/killall targeting bridge patterns\n if (/\\b(pkill|killall)\\b.*\\b(abtars|main\\.js|watchdog)\\b/.test(cmd)) return true;\n if (/\\bkill\\b.*\\$\\(.*pgrep.*abtars/.test(cmd)) return true;\n return false;\n}\n\nfunction runBash(cmd: string, timeout = BASH_TIMEOUT_MS, signal?: AbortSignal): Promise<string> {\n // Guardrails: command check\n const { checkCommand, classifyCommand } = require(\"../guardrails.js\") as typeof import(\"../guardrails.js\");\n const cmdBlock = checkCommand(cmd);\n if (cmdBlock) {\n logWarn(\"tool-registry\", `Guardrails blocked: ${cmd.slice(0, 200)}`);\n return Promise.resolve(JSON.stringify({ stderr: cmdBlock, exit_code: 126 }));\n }\n\n // Action gate: auth-required commands\n const tier = classifyCommand(cmd);\n if (tier === \"auth-required\" && _actionGate) {\n return _actionGate.requestAuth(\"bash-auth\", cmd).then((granted) => {\n if (!granted) {\n logWarn(\"tool-registry\", `Auth denied for: ${cmd.slice(0, 200)}`);\n return JSON.stringify({ stderr: \"Command requires authorization. Master denied or timed out.\", exit_code: 126 });\n }\n return executeBash(cmd, timeout, signal);\n });\n }\n\n if (isBridgeSpawnCommand(cmd)) {\n logWarn(\"tool-registry\", `Blocked bridge-spawn command: ${cmd.slice(0, 200)}`);\n return Promise.resolve(JSON.stringify({\n stderr: \"Command blocked: this would spawn/restart a bridge or watchdog process. The bridge is already running under launchd+watchdog supervision; use launchctl inspection commands (launchctl list, launchctl print) or signal the existing process instead.\",\n exit_code: 126,\n }));\n }\n if (isBridgeKillCommand(cmd)) {\n logWarn(\"tool-registry\", `Blocked bridge-kill command: ${cmd.slice(0, 200)}`);\n return Promise.resolve(JSON.stringify({\n stderr: \"Command blocked: this would kill the bridge process (yourself). Ask the user to send /restart for a session reset or restart the bridge manually.\",\n exit_code: 126,\n }));\n }\n return executeBash(cmd, timeout, signal);\n}\n\nlet _seatbeltActive = false;\nlet _seatbeltPolicy: import(\"../seatbelt/policy.js\").SeatbeltPolicy | null = null;\n\n/** Wire seatbelt for OS-level command sandboxing (#906). */\nexport function setSeatbelt(active: boolean, policy?: import(\"../seatbelt/policy.js\").SeatbeltPolicy): void {\n _seatbeltActive = active;\n _seatbeltPolicy = policy ?? null;\n}\n\nfunction executeBash(cmd: string, timeout: number, signal?: AbortSignal): Promise<string> {\n return new Promise((resolve) => {\n let bin = \"bash\";\n let args = [\"-c\", cmd];\n\n // #906: Wrap in OS sandbox if seatbelt active and command needs sandboxing\n if (_seatbeltActive && _seatbeltPolicy) {\n const { shouldSandbox, wrapCommand } = require(\"../seatbelt/index.js\") as typeof import(\"../seatbelt/index.js\");\n if (shouldSandbox(cmd)) {\n const wrapped = wrapCommand(cmd, _seatbeltPolicy);\n bin = wrapped.bin;\n args = wrapped.args;\n }\n }\n\n const child = execFile(bin, args, { timeout, maxBuffer: 1024 * 1024 }, (err, stdout, stderr) => {\n const result: Record<string, unknown> = {};\n if (stdout) result[\"stdout\"] = stdout.slice(0, 50_000);\n if (stderr) result[\"stderr\"] = stderr.slice(0, 10_000);\n if (err) result[\"exit_code\"] = (err as NodeJS.ErrnoException & { code?: number }).code ?? 1;\n else result[\"exit_code\"] = 0;\n resolve(JSON.stringify(result));\n });\n if (signal) {\n if (signal.aborted) { child.kill(\"SIGTERM\"); return; }\n const onAbort = (): void => {\n child.kill(\"SIGTERM\");\n // #1003: escalate to SIGKILL if child doesn't exit within 3s\n setTimeout(() => { try { child.kill(\"SIGKILL\"); } catch {} }, 3000);\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n child.on(\"exit\", () => signal.removeEventListener(\"abort\", onAbort));\n }\n });\n}\n\nlet memoryBackend: MemoryBackend | null = null;\n\n/** Wire in-process memory backend. Call once after memory init. */\nexport function setMemoryBackend(backend: MemoryBackend | null): void {\n memoryBackend = backend;\n}\n\nlet _actionGate: import(\"../action-gate.js\").ActionGate | null = null;\n\n/** Wire action gate for auth-required commands. */\nexport function setActionGate(gate: import(\"../action-gate.js\").ActionGate | null): void {\n _actionGate = gate;\n}\n\nlet _peerActivityCb: ((msg: string) => void) | null = null;\n\n/** Wire peer activity notification callback. */\nexport function setPeerActivityCallback(cb: ((msg: string) => void) | null): void {\n _peerActivityCb = cb;\n}\n\n// --- Tool definitions ---\n\nconst bashTool: ToolDefinition = {\n name: \"execute_bash\",\n description: \"Execute a bash command. Use for file operations, git, running scripts, and any shell command. Commands that would spawn or restart a bridge/watchdog process (node main.js, abtars.sh, abtars-watchdog.sh, launchctl load/bootstrap/kickstart/start) are blocked \u2014 the bridge is already supervised.\",\n parameters: {\n type: \"object\",\n properties: { command: { type: \"string\", description: \"The bash command to execute\" } },\n required: [\"command\"],\n },\n execute: (args, context) => runBash(args[\"command\"] ?? \"\", BASH_TIMEOUT_MS, context?.signal),\n};\n\nlet _storeCount = 0;\nconst STORE_CAP = 20;\n\n/** Reset store counter (called on new subagent session). */\nexport function resetStoreCounter(): void { _storeCount = 0; }\n\nconst memoryStoreTool: ToolDefinition = {\n name: \"memory_store\",\n description: \"Store a memory. Use after learning something about the user, their preferences, decisions, or facts worth remembering.\",\n parameters: {\n type: \"object\",\n properties: {\n translated: { type: \"string\", description: \"Memory content in English\" },\n original: { type: \"string\", description: \"Memory content in original language (if not English)\" },\n type: { type: \"string\", enum: [\"fact\", \"preference\", \"decision\", \"experience\", \"skill\", \"relationship\", \"goal\"], description: \"Memory type\" },\n emotion: { type: \"integer\", description: \"Emotion score -5 to +5 (0=neutral)\" },\n confidence: { type: \"integer\", description: \"Confidence 1-5 (3=default)\" },\n classification: { type: \"integer\", description: \"0=public (general knowledge), 1=internal (default), 2=confidential (personal preferences, habits, opinions about specific users), 3=secret (credentials, API keys, tokens, passwords \u2014 store IMMEDIATELY with exact string, never paraphrase, never wait for Dreamy)\" },\n },\n required: [\"translated\", \"type\"],\n },\n async execute(args, context): Promise<string> {\n if (++_storeCount > STORE_CAP) {\n return JSON.stringify({ stored: false, error: \"Store limit reached for this session. Move to next task.\" });\n }\n if (memoryBackend) {\n try {\n const params: InstantStoreParams = {\n userId: context?.userId ?? getMasterUserId(),\n contentEn: args[\"translated\"] ?? \"\",\n contentOriginal: args[\"original\"] ?? args[\"translated\"] ?? \"\",\n memoryType: (args[\"type\"] ?? \"fact\") as InstantStoreParams[\"memoryType\"],\n emotionScore: parseInt(args[\"emotion\"] ?? \"0\", 10),\n confidence: parseInt(args[\"confidence\"] ?? \"3\", 10),\n classification: parseInt(args[\"classification\"] ?? \"1\", 10),\n };\n const result = await memoryBackend.instantStore({ ...params, createdBy: \"tool:memory_store\" });\n return JSON.stringify(result);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n // #706: FTS5 corruption self-heal \u2014 rebuild indexes and retry once\n if (msg.includes(\"fts5\") || msg.includes(\"corruption\")) {\n try {\n memoryBackend.rebuildFtsIndexes();\n logWarn(\"tool-registry\", \"FTS corruption detected \u2014 rebuilt indexes, retrying store\");\n const params: InstantStoreParams = {\n userId: context?.userId ?? getMasterUserId(),\n contentEn: args[\"translated\"] ?? \"\",\n contentOriginal: args[\"original\"] ?? args[\"translated\"] ?? \"\",\n memoryType: (args[\"type\"] ?? \"fact\") as InstantStoreParams[\"memoryType\"],\n emotionScore: parseInt(args[\"emotion\"] ?? \"0\", 10),\n confidence: parseInt(args[\"confidence\"] ?? \"3\", 10),\n classification: parseInt(args[\"classification\"] ?? \"1\", 10),\n };\n const result = await memoryBackend.instantStore({ ...params, createdBy: \"tool:memory_store\" });\n return JSON.stringify(result);\n } catch (retryErr) { /* fall through */ }\n }\n return JSON.stringify({ error: msg });\n }\n }\n return JSON.stringify({ error: MEMORY_BACKEND_ERROR });\n },\n};\n\nconst memoryRecallTool: ToolDefinition = {\n name: \"memory_recall\",\n description: \"Search memories by keyword or semantic query. Returns relevant stored memories.\",\n parameters: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n limit: { type: \"integer\", description: \"Max results (default 10)\" },\n },\n required: [\"query\"],\n },\n async execute(args, context): Promise<string> {\n if (memoryBackend) {\n try {\n const t0 = Date.now();\n const userId = context?.userId ?? getMasterUserId();\n const { loadUsers } = await import(\"../user-registry.js\");\n const userEntry = loadUsers().byUserId.get(userId);\n const result = await memoryBackend.recall({\n translated: [args[\"query\"] ?? \"\"],\n original: args[\"query\"] ?? \"\",\n userId,\n limit: parseInt(args[\"limit\"] ?? \"10\", 10),\n maxClassification: userEntry?.maxClass ?? 1,\n });\n import(\"../metrics-collector.js\").then(({ recordLatency }) => recordLatency(\"recall\", Date.now() - t0)).catch(() => {});\n return JSON.stringify(result);\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n }\n return JSON.stringify({ error: MEMORY_BACKEND_ERROR });\n },\n};\n\nconst memoryEditTool: ToolDefinition = {\n name: \"memory_edit\",\n description: \"Edit an existing memory by ID. Change content, type, emotion, confidence, or classification.\",\n parameters: {\n type: \"object\",\n properties: {\n memory_id: { type: \"integer\", description: \"Memory ID to edit\" },\n translated: { type: \"string\", description: \"New English content\" },\n original: { type: \"string\", description: \"New original language content\" },\n type: { type: \"string\", description: \"New memory type\" },\n emotion: { type: \"integer\", description: \"New emotion score\" },\n confidence: { type: \"integer\", description: \"New confidence\" },\n classification: { type: \"integer\", description: \"New classification\" },\n caller: { type: \"string\", enum: [\"kp\", \"dreamy\"], description: \"Who is making the edit\" },\n },\n required: [\"memory_id\"],\n },\n async execute(args): Promise<string> {\n if (memoryBackend) {\n try {\n const result = await memoryBackend.editMemory({\n memoryId: parseInt(args[\"memory_id\"] ?? \"0\", 10),\n contentEn: args[\"translated\"],\n contentOriginal: args[\"original\"],\n memoryType: args[\"type\"] as \"fact\" | \"decision\" | \"preference\" | \"event\" | undefined,\n emotionScore: args[\"emotion\"] ? parseInt(args[\"emotion\"], 10) : undefined,\n confidence: args[\"confidence\"] ? parseInt(args[\"confidence\"], 10) : undefined,\n classification: args[\"classification\"] ? parseInt(args[\"classification\"], 10) : undefined,\n caller: (args[\"caller\"] ?? \"kp\") as \"kp\" | \"dreamy\",\n });\n return JSON.stringify(result);\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n }\n return JSON.stringify({ error: MEMORY_BACKEND_ERROR });\n },\n};\n\nconst webBrowseTool: ToolDefinition = {\n name: \"web_browse\",\n description: \"Browse a URL or perform a complex multi-step web task. For quick lookups use execute_bash with curl.\",\n parameters: {\n type: \"object\",\n properties: {\n task: { type: \"string\", description: \"What to do on the web\" },\n chat_id: { type: \"string\", description: \"Chat ID for result delivery\" },\n engine: { type: \"string\", enum: [\"cloakbrowser\"], description: \"Browser engine (default: cloakbrowser)\" },\n },\n required: [\"task\", \"chat_id\"],\n },\n execute: (args) => {\n let cmd = `abtars-browse --task ${JSON.stringify(args[\"task\"] ?? \"\")} --chat-id ${args[\"chat_id\"] ?? \"0\"}`;\n if (args[\"engine\"]) cmd += ` --engine ${args[\"engine\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst todoTool: ToolDefinition = {\n name: \"todo_manage\",\n description: \"Manage TODO items. Add, complete, or list tasks.\",\n parameters: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"add\", \"done\", \"list\", \"remove\"], description: \"Action to perform\" },\n text: { type: \"string\", description: \"TODO text (for add)\" },\n id: { type: \"string\", description: \"TODO ID (for done/remove)\" },\n },\n required: [\"action\"],\n },\n execute: (args) => {\n const action = args[\"action\"] ?? \"list\";\n if (action === \"add\") return runBash(`abtars-todo add ${JSON.stringify(args[\"text\"] ?? \"\")}`, CLI_TIMEOUT_MS);\n if (action === \"done\") return runBash(`abtars-todo done ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"remove\") return runBash(`abtars-todo remove ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n return runBash(\"abtars-todo list\", CLI_TIMEOUT_MS);\n },\n};\n\nlet _enqueueCron: ((id: string, manual?: boolean) => string | null) | null = null;\n\n/** Inject enqueueCron from bridge for task_manage --run. */\nexport function setEnqueueCron(fn: (id: string, manual?: boolean) => string | null): void { _enqueueCron = fn; }\n\nlet _ircSend: ((channel: string, message: string) => void) | null = null;\n\n/** Inject IRC send from bridge for irc_send tool. */\nexport function setIrcSend(fn: (channel: string, message: string) => void): void { _ircSend = fn; }\n\n/** @deprecated \u2014 secret_get now reads from file, not DB. Kept for backward compat (callers may still call this). */\n\nlet _sendDocument: ((path: string, caption?: string) => Promise<number>) | null = null;\n\n/**\n * Inject sendDocument from bridge for the send_document tool.\n * Caller binds main chat id + telegram adapter; tool is a thin wrapper around that.\n */\nexport function setSendDocument(fn: ((path: string, caption?: string) => Promise<number>) | null): void { _sendDocument = fn; }\n\nconst sendDocumentTool: ToolDefinition = {\n name: \"send_document\",\n description: \"Send a file from disk to the user's Telegram chat. Use for delivering reports, daily summaries, logs, or any .md file the user asks for. Do not summarize \u2014 the raw file is sent as an attachment.\",\n parameters: {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Absolute path to the file\" },\n caption: { type: \"string\", description: \"Optional short caption (\u22641024 chars)\" },\n },\n required: [\"path\"],\n },\n execute: async (args) => {\n const path = args[\"path\"];\n if (!path) return JSON.stringify({ error: \"path is required\" });\n if (!_sendDocument) return JSON.stringify({ error: \"Telegram not configured (sendDocument unavailable)\" });\n try {\n const messageId = await _sendDocument(path, args[\"caption\"]);\n return JSON.stringify({ ok: true, message_id: messageId });\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n },\n};\n\nconst taskTool: ToolDefinition = {\n name: \"task_manage\",\n description: \"Manage scheduled/recurring tasks (cron). Add, list, remove, pause, resume, or run tasks. Use action=run to execute a task immediately via the cron queue (isolated subagent).\",\n parameters: {\n type: \"object\",\n properties: {\n action: { type: \"string\", enum: [\"add\", \"list\", \"remove\", \"pause\", \"resume\", \"run\"], description: \"Action\" },\n message: { type: \"string\", description: \"Task message/command (for add)\" },\n schedule: { type: \"string\", description: \"Cron schedule expression (for add)\" },\n type: { type: \"string\", enum: [\"reminder\", \"script\", \"agent\"], description: \"Task type (for add)\" },\n chat_id: { type: \"string\", description: \"Chat ID (for add)\" },\n id: { type: \"string\", description: \"Task ID (for remove/pause/resume/run)\" },\n },\n required: [\"action\"],\n },\n execute: (args) => {\n const action = args[\"action\"] ?? \"list\";\n if (action === \"list\") return runBash(\"abtars-task list\", CLI_TIMEOUT_MS);\n if (action === \"remove\") return runBash(`abtars-task remove ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"pause\") return runBash(`abtars-task pause ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"resume\") return runBash(`abtars-task resume ${args[\"id\"] ?? \"\"}`, CLI_TIMEOUT_MS);\n if (action === \"run\") {\n if (!_enqueueCron) return Promise.resolve(JSON.stringify({ error: \"enqueueCron not available\" }));\n const err = _enqueueCron(args[\"id\"] ?? \"\", true);\n return Promise.resolve(JSON.stringify(err ? { error: err } : { ok: true, message: `Task ${args[\"id\"]} enqueued for immediate execution` }));\n }\n let cmd = `abtars-task add --message ${JSON.stringify(args[\"message\"] ?? \"\")}`;\n if (args[\"schedule\"]) cmd += ` --schedule ${JSON.stringify(args[\"schedule\"])}`;\n if (args[\"type\"]) cmd += ` --type ${args[\"type\"]}`;\n if (args[\"chat_id\"]) cmd += ` --chat-id ${args[\"chat_id\"]}`;\n return runBash(cmd, CLI_TIMEOUT_MS);\n },\n};\n\nconst peerSessionTool: ToolDefinition = {\n name: \"peer_session\",\n description: \"Open or continue a peer-to-peer session with another agent. Messages persist across turns. Use only when the user explicitly asks to contact another agent.\",\n parameters: {\n type: \"object\",\n properties: {\n peer_name: { type: \"string\", description: \"Name of the peer (as in peers.json)\" },\n message: { type: \"string\", description: \"Your message to the peer\" },\n session_id: { type: \"string\", description: \"Session ID from previous call (omit for new conversation)\" },\n },\n required: [\"peer_name\", \"message\"],\n },\n async execute(args) {\n const { callPeer } = await import(\"../peer-client.js\");\n const { loadPeerConfig } = await import(\"../peer-config.js\");\n const { getOrCreateSession, addTurn, isEnded, destroySession } = await import(\"../peer-sessions.js\");\n\n const peerName = args.peer_name?.trim();\n const message = args.message?.trim();\n if (!peerName || !message) return JSON.stringify({ error: \"peer_name and message required\" });\n\n const config = loadPeerConfig();\n if (peerName === config.self.name) return JSON.stringify({ error: \"Cannot chat with yourself\" });\n if (!config.peers[peerName]) return JSON.stringify({ error: `Unknown peer: ${peerName}` });\n\n const session = getOrCreateSession(args.session_id?.trim() || undefined, peerName);\n\n // Check turn cap before sending\n if (session.messages.length >= 20) {\n destroySession(session.id);\n return JSON.stringify({ session_id: session.id, response: \"[SESSION_END] Turn limit reached.\", ended: true, reason: \"max-turns\" });\n }\n\n addTurn(session, \"user\", message);\n\n // Build full conversation for peer (OpenAI messages format)\n const prompt = session.messages.map(m => `${m.role === \"user\" ? \"You\" : \"Peer\"}: ${m.content}`).join(\"\\n\") + \"\\n\\nRespond to the latest message.\";\n\n try {\n const response = await callPeer(peerName, prompt, config.maxHops);\n addTurn(session, \"assistant\", response);\n _peerActivityCb?.(`\uD83E\uDD16 Agents: ${config.self.name} \u2194 ${peerName} session. [turn ${session.messages.length}]`);\n\n const { ended, reason } = isEnded(session, response);\n if (ended) destroySession(session.id);\n\n return JSON.stringify({ session_id: session.id, response, ended, reason });\n } catch (err) {\n destroySession(session.id);\n return JSON.stringify({ error: `peer_session failed: ${err instanceof Error ? err.message : String(err)}`, session_id: session.id, ended: true });\n }\n },\n};\n\nconst peerWakeupTool: ToolDefinition = {\n name: \"peer_wakeup\",\n description: \"Send a wake-up signal to a peer that cannot reach us directly (firewall). The peer's bridge will call us back via A2A within seconds.\",\n parameters: {\n type: \"object\",\n properties: {\n peer_name: { type: \"string\", description: \"Name of the peer to wake up (as in peers.json)\" },\n },\n required: [\"peer_name\"],\n },\n async execute(args) {\n const { sendWakeup } = await import(\"../dns-wakeup.js\");\n const { loadPeerConfig } = await import(\"../peer-config.js\");\n const peerName = args.peer_name?.trim();\n if (!peerName) return JSON.stringify({ error: \"peer_name required\" });\n const config = loadPeerConfig();\n const peer = config.peers[peerName];\n if (!peer) return JSON.stringify({ error: `Unknown peer: ${peerName}` });\n const udpPort = peer.udpPort ?? 5353;\n sendWakeup(config.self.name, peer.host, udpPort, peer.token);\n return JSON.stringify({ ok: true, message: `Wake-up sent to ${peerName}. Expect callback within seconds.` });\n },\n};\n\nconst ircSendTool: ToolDefinition = {\n name: \"irc_send\",\n description: \"Send a message to an IRC channel (e.g. #bridges)\",\n parameters: {\n channel: { type: \"string\", description: \"IRC channel (e.g. #bridges)\" },\n message: { type: \"string\", description: \"Message text to send\" },\n },\n execute: async (args) => {\n if (!_ircSend) return JSON.stringify({ error: \"IRC adapter not connected\" });\n const channel = args[\"channel\"] ?? \"\";\n const message = args[\"message\"] ?? \"\";\n if (!channel || !message) return JSON.stringify({ error: \"channel and message are required\" });\n _ircSend(channel, message);\n return JSON.stringify({ ok: true, channel, sent: message.length + \" chars\" });\n },\n};\n\nconst secretGetTool: ToolDefinition = {\n name: \"secret_get\",\n description: \"Retrieve a secret from ~/.abtars/secret/. For env-var secrets (no extension), returns the value. For files (with extension like .json), returns the full decrypted content. NEVER echo the value to the user.\",\n parameters: {\n properties: {\n name: { type: \"string\", description: \"Exact filename in secret/ dir (e.g. 'OPENROUTER_API_KEY', 'x-cookies.json')\" },\n },\n required: [\"name\"],\n },\n execute: async (args) => {\n const name = args.name?.trim();\n if (!name) return JSON.stringify({ error: \"name is required\" });\n try {\n const { readSecret } = await import(\"../../components/secrets.js\");\n const value = readSecret(name);\n if (value === undefined) return JSON.stringify({ error: `secret '${name}' not found or could not be decrypted` });\n\n // For env-var type (no extension): also inject into process.env\n if (!name.includes(\".\")) {\n process.env[name] = value;\n return JSON.stringify({ ok: true, env_var: `$${name}`, hint: `Use $${name} in commands. NEVER print or echo the value.` });\n }\n return JSON.stringify({ ok: true, content: value });\n } catch (err) {\n return JSON.stringify({ error: `secret_get failed: ${err instanceof Error ? err.message : String(err)}` });\n }\n },\n};\n\nimport { skillCreateTool, skillUpdateTool, skillPatchTool, skillRemoveTool } from \"./skill-authoring.js\";\nimport { mcpTool } from \"./mcp-tool.js\";\nimport { getDelegationTools } from \"./delegation-tools.js\";\nimport { getPeerDelegationTools } from \"./peer-delegation-tools.js\";\nimport { getOrcTools } from \"./orc-tools.js\";\nimport { kanbanTool } from \"./kanban-tool.js\";\nimport { channelPostTool, channelReadTool } from \"./channel-tool.js\";\nimport { artifactPushTool, artifactPullTool, artifactAttachTool } from \"./artifact-tools.js\";\n\nconst ALL_TOOLS: ToolDefinition[] = [bashTool, memoryStoreTool, memoryRecallTool, memoryEditTool, webBrowseTool, todoTool, taskTool, sendDocumentTool, peerSessionTool, peerWakeupTool, ircSendTool, secretGetTool, skillCreateTool, skillUpdateTool, skillPatchTool, skillRemoveTool, mcpTool, kanbanTool, channelPostTool, channelReadTool, artifactAttachTool, ...getDelegationTools(), ...getPeerDelegationTools(), ...getOrcTools()];\n\n// Conditional: artifact store tools (#929)\nif (process.env[\"ARTIFACT_S3_ENDPOINT\"]) {\n ALL_TOOLS.push(artifactPushTool, artifactPullTool);\n}\n\nexport function getToolDefinitions(): ToolDefinition[] { return ALL_TOOLS; }\n\nexport function getToolSchemas(policy?: SandboxPolicy): Array<{ type: \"function\"; function: { name: string; description: string; parameters: Record<string, unknown> } }> {\n const tools = policy ? ALL_TOOLS.filter(t => checkTool(t.name, policy).allowed) : ALL_TOOLS;\n return tools.map(t => ({\n type: \"function\" as const,\n function: { name: t.name, description: t.description, parameters: t.parameters },\n }));\n}\n\nimport { bumpRead } from \"../skill-stats.js\";\n\n/** Check if a bash command result indicates a skill file was read. */\nfunction checkSkillRead(toolName: string, args: Record<string, string>): void {\n if (toolName !== \"execute_bash\") return;\n const cmd = args[\"command\"] ?? \"\";\n if (cmd.includes(\"/.abtars/skills/\") && cmd.includes(\"/SKILL.md\")) {\n const match = cmd.match(/\\/.abtars\\/skills\\/[^/]+\\/([^/]+)\\/SKILL\\.md/);\n if (match) bumpRead(match[1]!);\n }\n}\n\nexport async function executeToolCall(name: string, args: Record<string, string>, context?: { userId: string; signal?: AbortSignal; sandboxPolicy?: SandboxPolicy }): Promise<string> {\n // Sandbox enforcement\n if (context?.sandboxPolicy) {\n const toolCheck = checkTool(name, context.sandboxPolicy);\n if (!toolCheck.allowed) {\n const available = ALL_TOOLS.filter(t => checkTool(t.name, context.sandboxPolicy!).allowed).map(t => t.name);\n auditDeny(name, undefined, \"session\", toolCheck.reason!);\n return JSON.stringify({ error: `Tool '${name}' not available in this session`, available_tools: available, reason: \"peer_sandbox\" });\n }\n const filePath = args[\"path\"] ?? args[\"file_path\"];\n if (filePath) {\n const mode = name.includes(\"read\") || name === \"memory_recall\" ? \"read\" as const : \"write\" as const;\n const pathCheck = checkPath(filePath, mode, context.sandboxPolicy);\n if (!pathCheck.allowed) {\n auditDeny(name, filePath, \"session\", pathCheck.reason!);\n return JSON.stringify({ error: pathCheck.reason, reason: \"peer_sandbox\" });\n }\n }\n }\n\n const tool = ALL_TOOLS.find(t => t.name === name);\n if (!tool) return JSON.stringify({ error: `Unknown tool: ${name}` });\n const ts = Date.now();\n\n // #621: redact abmind_store args based on classification\n const storeClass = (name === \"abmind_store\" || name === \"memory_store\") ? parseInt(args.classification ?? args.class ?? \"1\", 10) : 0;\n const auditArgs = storeClass >= 2\n ? `{\"class\":${storeClass},\"[REDACTED]\":true}`\n : redactSecrets(JSON.stringify(args));\n audit({ ts, tool: name, args: auditArgs, userId: context?.userId });\n\n try {\n const result = await tool.execute(args, context);\n audit({ ts, tool: name, status: \"ok\", chars: result.length });\n checkSkillRead(name, args);\n return result;\n } catch (err) {\n audit({ ts, tool: name, status: \"error\", error: err instanceof Error ? err.message : String(err) });\n throw err;\n }\n}\n", "/**\n * skill-authoring.ts \u2014 skill lifecycle tools (#381, #613, #614).\n * Agent persists procedural knowledge as skills under ~/.abtars/skills/self/.\n */\n\nimport { existsSync, mkdirSync, writeFileSync, readFileSync, renameSync, appendFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { abmind } from \"../../utils/abmind-lazy.js\";\nimport { abtarsHome } from \"../../paths.js\";\nimport { logInfo } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport { setProvenance } from \"../skill-stats.js\";\nimport type { ToolDefinition } from \"./tool-registry.js\";\n\nconst TAG = \"skill-authoring\";\nconst NAME_RE = /^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$/;\nconst MIN_BYTES = 100;\nconst MAX_BYTES = 50_000;\nconst MAX_TAGS = 5;\n\nfunction skillsDir(): string { return join(abtarsHome(), \"skills\"); }\nfunction selfDir(): string { return join(skillsDir(), \"self\"); }\nfunction trashDir(): string { return join(skillsDir(), \".trash\"); }\nfunction auditLogPath(): string { return join(abtarsHome(), \"logs\", \"skill-authoring.log\"); }\n\nfunction audit(entry: string): void {\n const line = `[${new Date().toISOString()}] ${entry}\\n`;\n try {\n const dir = join(abtarsHome(), \"logs\");\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n appendFileSync(auditLogPath(), line);\n } catch (err) { logAndSwallow(TAG, \"audit write\", err); }\n}\n\nfunction validate(name: string, description: string, content: string): string | null {\n if (!NAME_RE.test(name)) return `Invalid name \"${name}\". Must be 3-64 chars, lowercase alphanumeric + hyphens, no leading/trailing hyphens.`;\n const desc = description.trim();\n if (desc.length < 1 || desc.length > 120) return `Description must be 1-120 chars (got ${desc.length}).`;\n const bytes = Buffer.byteLength(content, \"utf-8\");\n if (bytes < MIN_BYTES) return `Content too short (${bytes} bytes, minimum ${MIN_BYTES}). Write a useful skill, not a one-liner.`;\n if (bytes > MAX_BYTES) return `Content too large (${bytes} bytes, maximum ${MAX_BYTES}). Split into a skill + references/ files.`;\n const path = join(selfDir(), name, \"SKILL.md\");\n if (existsSync(path)) return `Skill \"${name}\" already exists. Use skill_update to modify it.`;\n const scan = abmind()?.scanForInjection(content);\n if (scan && !scan.safe) return `Content blocked by injection scanner: ${scan.flags[0]?.category ?? \"unknown\"} (score=${scan.score}). Rephrase the content.`;\n return null;\n}\n\n/** Parse YAML-like frontmatter from SKILL.md content. */\nfunction parseFrontmatter(raw: string): { meta: Record<string, unknown>; body: string } {\n const match = raw.match(/^---\\n([\\s\\S]*?)\\n---\\n\\n?([\\s\\S]*)$/);\n if (!match) return { meta: {}, body: raw };\n const meta: Record<string, unknown> = {};\n for (const line of match[1]!.split(\"\\n\")) {\n const idx = line.indexOf(\":\");\n if (idx < 0) continue;\n const key = line.slice(0, idx).trim();\n let val: unknown = line.slice(idx + 1).trim();\n // Parse array: [a, b, c]\n if (typeof val === \"string\" && val.startsWith(\"[\") && val.endsWith(\"]\")) {\n val = val.slice(1, -1).split(\",\").map(s => s.trim()).filter(Boolean);\n }\n meta[key] = val;\n }\n return { meta, body: match[2]! };\n}\n\n/** Serialize frontmatter fields back to YAML-like string. */\nfunction serializeFrontmatter(meta: Record<string, unknown>): string {\n const lines: string[] = [\"---\"];\n for (const [k, v] of Object.entries(meta)) {\n if (v === undefined || v === null) continue;\n if (Array.isArray(v) && v.length > 0) {\n lines.push(`${k}: [${v.join(\", \")}]`);\n } else if (!Array.isArray(v)) {\n lines.push(`${k}: ${v}`);\n }\n }\n lines.push(\"---\\n\\n\");\n return lines.join(\"\\n\");\n}\n\n/** Guard: skill must exist in self/ dir. Returns error string or null. */\nfunction guardSelfSkill(name: string): string | null {\n if (!NAME_RE.test(name)) return `Invalid name \"${name}\".`;\n const path = join(selfDir(), name, \"SKILL.md\");\n if (!existsSync(path)) return `Skill \"${name}\" not found in self/.`;\n return null;\n}\n\nexport const skillCreateTool: ToolDefinition = {\n name: \"skill_create\",\n description: \"Persist a new procedural skill to disk. Use when you've solved a novel task, discovered a workflow, or received a correction worth remembering as a repeatable recipe. Skills become available in future sessions via the skills_catalog.\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill identifier, kebab-case, e.g. 'fix-stale-node-modules'. 3-64 chars, [a-z0-9-]+.\" },\n description: { type: \"string\", description: \"One-line description, max 120 chars. Shown in skills_catalog.\" },\n content: { type: \"string\", description: \"Skill body in Markdown. Starts with # <Title>. No frontmatter \u2014 the tool writes it.\" },\n tags: { type: \"array\", items: { type: \"string\" }, description: \"Optional tags for categorization (max 5). E.g. ['tools', 'browser', 'debugging'].\" },\n related: { type: \"array\", items: { type: \"string\" }, description: \"Optional related skill names.\" },\n },\n required: [\"name\", \"description\", \"content\"],\n },\n async execute(args) {\n const { name, description, content, tags, related } = args as unknown as { name: string; description: string; content: string; tags?: string[]; related?: string[] };\n const error = validate(name, description, content);\n if (error) {\n audit(`skill_create name=${name} bytes=${content.length} ok=false error=\"${error}\"`);\n return JSON.stringify({ error });\n }\n\n const tagList = (tags ?? []).slice(0, MAX_TAGS).map(t => t.toLowerCase().trim()).filter(Boolean);\n const relList = (related ?? []).filter(Boolean);\n const tagsLine = tagList.length > 0 ? `tags: [${tagList.join(\", \")}]\\n` : \"\";\n const relatedLine = relList.length > 0 ? `related: [${relList.join(\", \")}]\\n` : \"\";\n const frontmatter = `---\\nname: ${name}\\ndescription: ${description.trim()}\\n${tagsLine}${relatedLine}---\\n\\n`;\n const fullContent = frontmatter + content;\n const dir = join(selfDir(), name);\n const filePath = join(dir, \"SKILL.md\");\n const tmpPath = filePath + \".tmp\";\n\n try {\n mkdirSync(dir, { recursive: true });\n writeFileSync(tmpPath, fullContent, \"utf-8\");\n renameSync(tmpPath, filePath);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_create name=${name} bytes=${content.length} ok=false error=\"write failed: ${msg}\"`);\n return JSON.stringify({ error: `Write failed: ${msg}` });\n }\n\n setProvenance(name, \"agent\");\n audit(`skill_create name=${name} tags=[${tagList.join(\",\")}] bytes=${content.length} ok=true`);\n logInfo(TAG, `Created skill: self/${name} (${content.length} bytes)`);\n return JSON.stringify({ ok: true, path: filePath, message: `Skill \"${name}\" created in self/. Available in skills_catalog after /skill reload.` });\n },\n};\n\nexport const skillUpdateTool: ToolDefinition = {\n name: \"skill_update\",\n description: \"Full rewrite of an existing skill's SKILL.md in self/. Preserves frontmatter fields (tags, related, description) when omitted by caller.\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill name (must exist in self/).\" },\n description: { type: \"string\", description: \"New description (optional \u2014 keeps existing if omitted).\" },\n content: { type: \"string\", description: \"New skill body in Markdown (no frontmatter).\" },\n tags: { type: \"array\", items: { type: \"string\" }, description: \"New tags (optional \u2014 keeps existing if omitted).\" },\n related: { type: \"array\", items: { type: \"string\" }, description: \"New related skills (optional \u2014 keeps existing if omitted).\" },\n },\n required: [\"name\", \"content\"],\n },\n async execute(args) {\n const { name, content, description, tags, related } = args as unknown as { name: string; content: string; description?: string; tags?: string[]; related?: string[] };\n const guard = guardSelfSkill(name);\n if (guard) { audit(`skill_update name=${name} ok=false error=\"${guard}\"`); return JSON.stringify({ error: guard }); }\n\n const bytes = Buffer.byteLength(content, \"utf-8\");\n if (bytes < MIN_BYTES) return JSON.stringify({ error: `Content too short (${bytes} bytes, minimum ${MIN_BYTES}).` });\n if (bytes > MAX_BYTES) return JSON.stringify({ error: `Content too large (${bytes} bytes, maximum ${MAX_BYTES}).` });\n\n const scan = abmind()?.scanForInjection(content);\n if (scan && !scan.safe) return JSON.stringify({ error: `Content blocked by injection scanner: ${scan.flags[0]?.category ?? \"unknown\"}.` });\n\n const filePath = join(selfDir(), name, \"SKILL.md\");\n const existing = readFileSync(filePath, \"utf-8\");\n const { meta } = parseFrontmatter(existing);\n\n // Merge: caller fields override, omitted fields preserved\n const merged: Record<string, unknown> = { ...meta, name };\n if (description !== undefined) merged[\"description\"] = description.trim();\n if (tags !== undefined) merged[\"tags\"] = tags.slice(0, MAX_TAGS).map(t => t.toLowerCase().trim()).filter(Boolean);\n if (related !== undefined) merged[\"related\"] = related.filter(Boolean);\n\n const fullContent = serializeFrontmatter(merged) + content;\n const tmpPath = filePath + \".tmp\";\n try {\n writeFileSync(tmpPath, fullContent, \"utf-8\");\n renameSync(tmpPath, filePath);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_update name=${name} ok=false error=\"write failed: ${msg}\"`);\n return JSON.stringify({ error: `Write failed: ${msg}` });\n }\n\n audit(`skill_update name=${name} bytes=${bytes} ok=true`);\n logInfo(TAG, `Updated skill: self/${name} (${bytes} bytes)`);\n return JSON.stringify({ ok: true, path: filePath, message: `Skill \"${name}\" updated.` });\n },\n};\n\nexport const skillPatchTool: ToolDefinition = {\n name: \"skill_patch\",\n description: \"Targeted find-and-replace within a skill's SKILL.md in self/. old_string must match exactly once.\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill name (must exist in self/).\" },\n old_string: { type: \"string\", description: \"Exact string to find (must match once).\" },\n new_string: { type: \"string\", description: \"Replacement string.\" },\n },\n required: [\"name\", \"old_string\", \"new_string\"],\n },\n async execute(args) {\n const { name, old_string, new_string } = args as unknown as { name: string; old_string: string; new_string: string };\n const guard = guardSelfSkill(name);\n if (guard) { audit(`skill_patch name=${name} ok=false error=\"${guard}\"`); return JSON.stringify({ error: guard }); }\n\n const filePath = join(selfDir(), name, \"SKILL.md\");\n const existing = readFileSync(filePath, \"utf-8\");\n\n const count = existing.split(old_string).length - 1;\n if (count === 0) return JSON.stringify({ error: `old_string not found in skill \"${name}\".` });\n if (count > 1) return JSON.stringify({ error: `old_string matches ${count} times \u2014 must match exactly once.` });\n\n const patched = existing.replace(old_string, new_string);\n const scan = abmind()?.scanForInjection(patched);\n if (scan && !scan.safe) return JSON.stringify({ error: `Patched content blocked by injection scanner: ${scan.flags[0]?.category ?? \"unknown\"}.` });\n\n const tmpPath = filePath + \".tmp\";\n try {\n writeFileSync(tmpPath, patched, \"utf-8\");\n renameSync(tmpPath, filePath);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_patch name=${name} ok=false error=\"write failed: ${msg}\"`);\n return JSON.stringify({ error: `Write failed: ${msg}` });\n }\n\n audit(`skill_patch name=${name} ok=true`);\n logInfo(TAG, `Patched skill: self/${name}`);\n return JSON.stringify({ ok: true, path: filePath, message: `Skill \"${name}\" patched.` });\n },\n};\n\nexport const skillRemoveTool: ToolDefinition = {\n name: \"skill_remove\",\n description: \"Soft-delete a skill from self/ by moving it to .trash/ (recoverable for 7 days).\",\n parameters: {\n type: \"object\",\n properties: {\n name: { type: \"string\", description: \"Skill name (must exist in self/).\" },\n },\n required: [\"name\"],\n },\n async execute(args) {\n const { name } = args as unknown as { name: string };\n const guard = guardSelfSkill(name);\n if (guard) { audit(`skill_remove name=${name} ok=false error=\"${guard}\"`); return JSON.stringify({ error: guard }); }\n\n const srcDir = join(selfDir(), name);\n const ts = Date.now();\n const destDir = join(trashDir(), `${name}-${ts}`);\n try {\n mkdirSync(trashDir(), { recursive: true });\n renameSync(srcDir, destDir);\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n audit(`skill_remove name=${name} ok=false error=\"move failed: ${msg}\"`);\n return JSON.stringify({ error: `Move failed: ${msg}` });\n }\n\n audit(`skill_remove name=${name} dest=${destDir} ok=true`);\n logInfo(TAG, `Removed skill: self/${name} \u2192 .trash/`);\n return JSON.stringify({ ok: true, message: `Skill \"${name}\" moved to .trash/. Will be pruned after 7 days.` });\n },\n};\n", "/**\n * mcp-tool.ts \u2014 Generic MCP tool (#471 v2).\n * Single tool that routes to any mcporter server/tool. Daemon starts on-demand.\n */\n\nimport { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { logInfo, logWarn } from \"../logger.js\";\nimport { logAndSwallow } from \"../log-and-swallow.js\";\nimport type { ToolDefinition } from \"./tool-registry.js\";\n\nconst execFileAsync = promisify(execFile);\nconst TAG = \"mcp\";\nlet daemonStarted = false;\n\nasync function ensureDaemon(): Promise<void> {\n if (daemonStarted) return;\n try {\n await execFileAsync(\"mcporter\", [\"daemon\", \"start\"], { timeout: 10_000 });\n daemonStarted = true;\n logInfo(TAG, \"mcporter daemon started (on-demand)\");\n } catch {\n logWarn(TAG, \"mcporter daemon start failed \u2014 calls may still work if already running\");\n daemonStarted = true; // don't retry every call \u2014 assume already running\n }\n}\n\nexport const mcpTool: ToolDefinition = {\n name: \"mcp\",\n description: \"Call an MCP server tool via mcporter. Available servers shown by /mcp command. Use when you need JIRA, presentations, or other MCP-connected services.\",\n parameters: {\n type: \"object\",\n properties: {\n server: { type: \"string\", description: \"Server name (e.g. 'pptx', 'atlassian')\" },\n tool: { type: \"string\", description: \"Tool name (e.g. 'jira_search', 'create_presentation')\" },\n args: { type: \"string\", description: \"Tool arguments as JSON string (e.g. '{\\\"query\\\": \\\"assignee = me\\\"}')\" },\n },\n required: [\"server\", \"tool\"],\n },\n async execute(params) {\n await ensureDaemon();\n const { server, tool, args } = params as { server: string; tool: string; args?: string };\n const cliArgs = [\"call\", `${server}.${tool}`];\n if (args) {\n try {\n const parsed = JSON.parse(args) as Record<string, string>;\n for (const [k, v] of Object.entries(parsed)) cliArgs.push(`${k}=${v}`);\n } catch (err) {\n logAndSwallow(TAG, \"JSON.parse mcp args\", err);\n cliArgs.push(args);\n }\n }\n try {\n const { stdout } = await execFileAsync(\"mcporter\", cliArgs, { timeout: 30_000, encoding: \"utf-8\" });\n return stdout;\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n return JSON.stringify({ error: `mcp call failed: ${msg}` });\n }\n },\n};\n", "/**\n * peer-delegation-tools.ts \u2014 peer_delegate, peer_check, peer_terminate (#675).\n *\n * Remote delegation tools for the Orc. Uses PeerTransport to call\n * remote peers' /v1/tasks endpoints. Results tracked in local kanban\n * with type=\"remote\" and meta JSON for peer + remote_task_id.\n */\n\nimport type { ToolDefinition } from \"./tool-registry.js\";\nimport { getPeerTransport } from \"../peer-transport/index.js\";\nimport { kanbanEnqueue } from \"../tasks/kanban-board.js\";\nimport { logInfo, logWarn, logDebug, logTrace } from \"../logger.js\";\n\nconst TAG = \"peer-delegate\";\n\nexport const peerDelegateTool: ToolDefinition = {\n name: \"peer_delegate\",\n description: \"Delegate a task to a remote peer. If peer is omitted, auto-selects the best capable peer by load. Use 'requires' to specify needed capabilities (gpu, docker, ollama, browser, xcode).\",\n parameters: {\n type: \"object\",\n properties: {\n peer: { type: \"string\", description: \"Peer name (optional \u2014 auto-selects if omitted)\" },\n goal: { type: \"string\", description: \"Task goal/instructions for the remote peer\" },\n priority: { type: \"string\", enum: [\"CRITICAL\", \"HIGH\", \"MEDIUM\", \"LOW\"], description: \"Task priority (default: MEDIUM)\" },\n context: { type: \"string\", description: \"Optional context to include\" },\n requires: { type: \"array\", items: { type: \"string\" }, description: \"Required capabilities (e.g. ['gpu', 'docker'])\" },\n artifacts: { type: \"string\", description: \"JSON array of {name, content} objects (base64-encoded files to send)\" },\n },\n required: [\"goal\"],\n },\n async execute(args: Record<string, string>): Promise<string> {\n const { goal, priority, context } = args;\n let peer = args.peer;\n const requires: string[] = args.requires ? (typeof args.requires === \"string\" ? JSON.parse(args.requires) : args.requires) : [];\n const artifacts: Array<{ name: string; content: string }> | undefined = args.artifacts ? JSON.parse(args.artifacts) : undefined;\n\n if (!goal) return JSON.stringify({ error: \"goal is required\" });\n\n // Auto-select peer if not specified\n if (!peer && requires.length > 0) {\n const { findCapablePeer } = await import(\"../peer-transport/gossip.js\");\n const match = findCapablePeer(requires);\n if (!match) return JSON.stringify({ error: `No alive peer with capabilities: [${requires.join(\", \")}]` });\n peer = match.name;\n logDebug(TAG, `Auto-selected peer ${peer} for requires=[${requires.join(\",\")}] (load=${match.load})`);\n } else if (!peer) {\n // No peer, no requires \u2014 pick least loaded\n const { getPeerTable } = await import(\"../peer-transport/gossip.js\");\n const alive = getPeerTable().sort((a, b) => a.load - b.load);\n if (alive.length === 0) return JSON.stringify({ error: \"No alive peers available\" });\n peer = alive[0]!.name;\n logDebug(TAG, `Auto-selected least-loaded peer ${peer} (load=${alive[0]!.load})`);\n }\n\n // Validate capabilities if requires specified + explicit peer\n if (requires.length > 0 && args.peer) {\n const { getPeerTable } = await import(\"../peer-transport/gossip.js\");\n const entry = getPeerTable(true).find(p => p.name.toLowerCase() === peer!.toLowerCase());\n if (entry && !requires.every(r => entry.capabilities.includes(r))) {\n const missing = requires.filter(r => !entry.capabilities.includes(r));\n return JSON.stringify({ error: `Peer ${peer} lacks capabilities: [${missing.join(\", \")}]` });\n }\n }\n\n logDebug(TAG, `peer_delegate: peer=${peer} priority=${priority ?? \"MEDIUM\"} goal=${goal.length}ch requires=[${requires.join(\",\")}]`);\n logTrace(TAG, `peer_delegate goal: ${goal.slice(0, 500)}`);\n\n try {\n const transport = getPeerTransport();\n const { taskId: remoteTaskId, remoteSessionId } = await transport.delegateTask(peer, goal, { priority, context, artifacts });\n\n const localCardId = kanbanEnqueue(`[remote:${peer}] ${goal.slice(0, 80)}`, \"peer\", undefined, {\n type: \"remote\",\n priority: priority ?? \"MEDIUM\",\n notes: JSON.stringify({ peer, remote_task_id: remoteTaskId, remote_session_id: remoteSessionId, goal, requires }),\n });\n\n // #949: Create hollow session to track remote worker locally\n if (remoteSessionId) {\n const { spin } = await import(\"../spin.js\");\n const { getMasterUserId } = await import(\"../master-user.js\");\n spin.createHollowSession(getMasterUserId(), \"telegram\", \"W\", peer, remoteSessionId);\n }\n\n logInfo(TAG, `Delegated to ${peer}: remote#${remoteTaskId} \u2192 local#${localCardId}`);\n return JSON.stringify({ ok: true, local_card_id: localCardId, remote_task_id: remoteTaskId, remote_session_id: remoteSessionId, peer, status: \"queued\" });\n } catch (err) {\n logWarn(TAG, `peer_delegate failed: ${err instanceof Error ? err.message : String(err)}`);\n return JSON.stringify({ error: `peer_delegate failed: ${err instanceof Error ? err.message : String(err)}` });\n }\n },\n};\n\nexport const peerCheckTool: ToolDefinition = {\n name: \"peer_check\",\n description: \"Check the status of a task delegated to a remote peer. Returns status and result if complete.\",\n parameters: {\n type: \"object\",\n properties: {\n peer: { type: \"string\", description: \"Peer name\" },\n task_id: { type: \"number\", description: \"Remote task ID (from peer_delegate result)\" },\n },\n required: [\"peer\", \"task_id\"],\n },\n async execute(args: Record<string, string>): Promise<string> {\n const peer = args.peer;\n const taskId = parseInt(args.task_id ?? \"\", 10);\n if (!peer || isNaN(taskId)) return JSON.stringify({ error: \"peer and task_id are required\" });\n\n try {\n const transport = getPeerTransport();\n const result = await transport.checkTask(peer, taskId);\n return JSON.stringify({ ok: true, ...result });\n } catch (err) {\n logWarn(TAG, `peer_check failed: ${err instanceof Error ? err.message : String(err)}`);\n return JSON.stringify({ error: `peer_check failed: ${err instanceof Error ? err.message : String(err)}` });\n }\n },\n};\n\nexport const peerTerminateTool: ToolDefinition = {\n name: \"peer_terminate\",\n description: \"Cancel/terminate a task running on a remote peer.\",\n parameters: {\n type: \"object\",\n properties: {\n peer: { type: \"string\", description: \"Peer name\" },\n task_id: { type: \"number\", description: \"Remote task ID to terminate\" },\n },\n required: [\"peer\", \"task_id\"],\n },\n async execute(args: Record<string, string>): Promise<string> {\n const peer = args.peer;\n const taskId = parseInt(args.task_id ?? \"\", 10);\n if (!peer || isNaN(taskId)) return JSON.stringify({ error: \"peer and task_id are required\" });\n\n try {\n const transport = getPeerTransport();\n await transport.terminateTask(peer, taskId);\n logInfo(TAG, `Terminated remote task ${taskId} on ${peer}`);\n return JSON.stringify({ ok: true, terminated: true, peer, task_id: taskId });\n } catch (err) {\n logWarn(TAG, `peer_terminate failed: ${err instanceof Error ? err.message : String(err)}`);\n return JSON.stringify({ error: `peer_terminate failed: ${err instanceof Error ? err.message : String(err)}` });\n }\n },\n};\n\nexport function getPeerDelegationTools(): ToolDefinition[] {\n return [peerDelegateTool, peerCheckTool, peerTerminateTool];\n}\n", "/**\n * kanban-tool.ts \u2014 Agent-facing tool for managing the kanban board.\n */\n\nimport type { ToolDefinition } from \"./tool-registry.js\";\nimport { kanbanEnqueue, kanbanUpdate, kanbanList, type KanbanCard } from \"../tasks/kanban-board.js\";\n\nfunction formatCard(c: KanbanCard): string {\n const icon = c.status === \"delivered\" ? \"*\" : c.status === \"done\" ? \"*\" : c.status === \"running\" ? \"~\" : c.status === \"failed\" ? \"x\" : \"+\";\n const due = c.due_at ? ` due:${c.due_at}` : \"\";\n const lbl = c.labels ? ` [${c.labels}]` : \"\";\n const deps = c.blocked_by ? ` <- #${c.blocked_by}` : \"\";\n const tokens = c.tokens_used ? ` ${c.tokens_used} tok` : \"\";\n const source = c.type === \"remote\" ? (() => { try { return ` [${JSON.parse(c.notes ?? \"{}\").peer}]`; } catch { return \" [remote]\"; } })() : \"\";\n return `${icon} #${c.id} ${c.title} (${c.priority}/${c.status})${tokens}${source}${due}${lbl}${deps}`;\n}\n\nasync function execute(args: Record<string, string>): Promise<string> {\n const action = args.action;\n\n if (action === \"create\") {\n if (!args.title) return \"[err] title required\";\n const id = kanbanEnqueue(args.title, args.source || \"agent\", undefined, {\n priority: args.priority,\n type: args.type,\n labels: args.labels,\n due_at: args.due_at,\n parent_id: args.parent_id ? parseInt(args.parent_id, 10) : undefined,\n notes: args.notes,\n blocked_by: args.blocked_by || undefined,\n });\n return `+ Card #${id} created: \"${args.title}\"${args.blocked_by ? ` (blocked_by: ${args.blocked_by})` : \"\"}`;\n }\n\n if (action === \"update\") {\n if (!args.id) return \"[err] id required\";\n const fields: Record<string, unknown> = {};\n for (const k of [\"title\", \"status\", \"priority\", \"type\", \"labels\", \"due_at\", \"notes\", \"approval\"] as const) {\n if (args[k]) fields[k] = args[k];\n }\n if (args.parent_id) fields.parent_id = parseInt(args.parent_id, 10);\n kanbanUpdate(parseInt(args.id, 10), fields as any);\n return `* Card #${args.id} updated`;\n }\n\n if (action === \"list\") {\n const cards = kanbanList(args.status || undefined);\n if (cards.length === 0) return \"Board is empty\";\n return `Kanban Board (${cards.length}):\\n` + cards.map(formatCard).join(\"\\n\");\n }\n\n return `[err] Unknown action: ${action}. Use create | update | list`;\n}\n\nexport const kanbanTool: ToolDefinition = {\n name: \"kanban_manage\",\n description: \"Create, update, or list cards on the kanban board. Use for tracking work items, user requests, and task decomposition.\",\n parameters: {\n type: \"object\",\n properties: {\n action: { type: \"string\", description: \"create | update | list\", enum: [\"create\", \"update\", \"list\"] },\n title: { type: \"string\", description: \"Card title (required for create)\" },\n id: { type: \"string\", description: \"Card ID (required for update)\" },\n source: { type: \"string\", description: \"Who created: user | agent | cron | peer\" },\n status: { type: \"string\", description: \"New status (for update): queued | running | done | failed\" },\n priority: { type: \"string\", description: \"CRITICAL | HIGH | MEDIUM | LOW\" },\n type: { type: \"string\", description: \"Card type (task, bug, feature, research, report, etc.)\" },\n labels: { type: \"string\", description: \"Comma-separated tags\" },\n due_at: { type: \"string\", description: \"ISO deadline (e.g. 2026-06-08T12:00:00)\" },\n parent_id: { type: \"string\", description: \"Parent card ID for subtasks\" },\n notes: { type: \"string\", description: \"Additional context\" },\n blocked_by: { type: \"string\", description: \"Comma-separated card IDs this card depends on, or 'children' to wait for all child cards\" },\n approval: { type: \"string\", description: \"pending | approved | rejected\" },\n },\n required: [\"action\"],\n },\n execute,\n};\n", "/**\n * channel-tool.ts \u2014 Agent-facing tools for the communication channel (#891).\n */\n\nimport type { ToolDefinition } from \"./tool-registry.js\";\nimport { channelPost, channelRead, type ChannelMessage } from \"../tasks/kanban-channel.js\";\n\nfunction formatMsg(m: ChannelMessage): string {\n const dir = m.directive ? \" \u26A1\" : \"\";\n return `[${m.from_agent}\u2192${m.to_agent}]${dir} ${m.message} (${m.created_at})`;\n}\n\nasync function executePost(args: Record<string, string>, ctx?: { userId?: string }): Promise<string> {\n const cardId = parseInt(args.card_id ?? \"\", 10);\n if (!cardId) return \"\u274C card_id required\";\n if (!args.message) return \"\u274C message required\";\n const from = args.from || ctx?.userId || \"agent\";\n const to = args.to || \"ALL\";\n const directive = args.directive === \"true\" || args.directive === \"1\";\n const msgType = args.type || \"progress\";\n const id = channelPost(cardId, from, to, args.message, directive, msgType);\n return `\u2713 Posted #${id} to card:${cardId} [${from}\u2192${to}]`;\n}\n\nasync function executeRead(args: Record<string, string>): Promise<string> {\n const cardId = parseInt(args.card_id ?? \"\", 10);\n if (!cardId) return \"\u274C card_id required\";\n const msgs = channelRead(cardId, { since: args.since, from: args.from });\n if (msgs.length === 0) return \"No messages.\";\n return msgs.map(formatMsg).join(\"\\n\");\n}\n\nexport const channelPostTool: ToolDefinition = {\n name: \"channel_post\",\n description: \"Post a message to the project discussion channel. Keep messages short (<1000 chars). For long plans, write a file and reference the path.\",\n parameters: {\n type: \"object\",\n properties: {\n card_id: { type: \"string\", description: \"Kanban card ID this message belongs to\" },\n to: { type: \"string\", description: \"Recipient: ALL (default), Worker-01, ORC, MASTER, or peer:name\" },\n message: { type: \"string\", description: \"Short message (max 1000 chars)\" },\n directive: { type: \"string\", description: \"Set to 'true' for priority directive (Orc/master only)\" },\n type: { type: \"string\", enum: [\"progress\", \"question\", \"result\", \"error\"], description: \"Message type (default: progress)\" },\n },\n required: [\"card_id\", \"message\"],\n },\n execute: executePost,\n};\n\nexport const channelReadTool: ToolDefinition = {\n name: \"channel_read\",\n description: \"Read messages from the project discussion channel.\",\n parameters: {\n type: \"object\",\n properties: {\n card_id: { type: \"string\", description: \"Kanban card ID to read messages from\" },\n since: { type: \"string\", description: \"ISO timestamp \u2014 only messages after this time\" },\n from: { type: \"string\", description: \"Filter by sender name\" },\n },\n required: [\"card_id\"],\n },\n execute: executeRead,\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;AACA;AAPA,SAAS,YAAAA,iBAAgB;AACzB,SAAS,kBAAAC,iBAAgB,aAAAC,kBAAiB;AAC1C,SAAS,QAAAC,aAAY;AACrB,SAAS,eAAe;AAMxB;;;ACTA,SAAS,YAAY,WAAW,eAAe,cAAc,YAAY,sBAAsB;AAC/F,SAAS,YAAY;AAErB;AACA;AACA;AAIA,IAAM,MAAM;AACZ,IAAM,UAAU;AAChB,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,WAAW;AAEjB,SAAS,YAAoB;AAAE,SAAO,KAAK,WAAW,GAAG,QAAQ;AAAG;AACpE,SAAS,UAAkB;AAAE,SAAO,KAAK,UAAU,GAAG,MAAM;AAAG;AAC/D,SAAS,WAAmB;AAAE,SAAO,KAAK,UAAU,GAAG,QAAQ;AAAG;AAClE,SAAS,eAAuB;AAAE,SAAO,KAAK,WAAW,GAAG,QAAQ,qBAAqB;AAAG;AAE5F,SAAS,MAAM,OAAqB;AAClC,QAAM,OAAO,KAAI,oBAAI,KAAK,GAAE,YAAY,CAAC,KAAK,KAAK;AAAA;AACnD,MAAI;AACF,UAAM,MAAM,KAAK,WAAW,GAAG,MAAM;AACrC,QAAI,CAAC,WAAW,GAAG,EAAG,WAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AACxD,mBAAe,aAAa,GAAG,IAAI;AAAA,EACrC,SAAS,KAAK;AAAE,kBAAc,KAAK,eAAe,GAAG;AAAA,EAAG;AAC1D;AAEA,SAAS,SAAS,MAAc,aAAqB,SAAgC;AACnF,MAAI,CAAC,QAAQ,KAAK,IAAI,EAAG,QAAO,iBAAiB,IAAI;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