abtars 0.3.4-alpha.0 → 0.3.4-alpha.2

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 (392) hide show
  1. package/bundle/{_registry.generated-7DRCE4V6.js → _registry.generated-RC6PEH6Z.js} +16 -15
  2. package/bundle/{_registry.generated-7DRCE4V6.js.map → _registry.generated-RC6PEH6Z.js.map} +1 -1
  3. package/bundle/abtars-browser.js +6 -5
  4. package/bundle/abtars-browser.js.map +1 -1
  5. package/bundle/abtars-cli.js +73 -46
  6. package/bundle/abtars-cli.js.map +3 -3
  7. package/bundle/abtars-restart.js +7 -7
  8. package/bundle/abtars-rss.js +2 -1
  9. package/bundle/abtars-rss.js.map +2 -2
  10. package/bundle/abtars-task.js +6 -5
  11. package/bundle/abtars-task.js.map +1 -1
  12. package/bundle/abtars-todo.js +2 -1
  13. package/bundle/abtars-todo.js.map +1 -1
  14. package/bundle/abtars.js +307 -212
  15. package/bundle/abtars.js.map +4 -4
  16. package/bundle/{acp-raw-client-AZJCEB6S.js → acp-raw-client-E6FM45NC.js} +4 -3
  17. package/bundle/{acp-raw-client-AZJCEB6S.js.map → acp-raw-client-E6FM45NC.js.map} +1 -1
  18. package/bundle/{action-gate-QYJL57IX.js → action-gate-G2V47NHW.js} +4 -3
  19. package/bundle/{action-gate-QYJL57IX.js.map → action-gate-G2V47NHW.js.map} +1 -1
  20. package/bundle/{agent-api-adapter-PYMNQXHE.js → agent-api-adapter-PTJYZKQK.js} +5 -4
  21. package/bundle/{agent-api-adapter-PYMNQXHE.js.map → agent-api-adapter-PTJYZKQK.js.map} +1 -1
  22. package/bundle/{agent-api-rate-limit-4GEZ4YN5.js → agent-api-rate-limit-WCFXJMGY.js} +6 -5
  23. package/bundle/{agent-registry-563P4EUJ.js → agent-registry-GU7ABOK5.js} +9 -8
  24. package/bundle/bootstrap-POWWTU6I.js +63 -0
  25. package/bundle/bootstrap-POWWTU6I.js.map +7 -0
  26. package/bundle/{bridge-lock-transport-LXCF2IVN.js → bridge-lock-transport-4ZH7QTJP.js} +6 -5
  27. package/bundle/{browser-2VZOGOGX.js → browser-EJNS35NT.js} +8 -7
  28. package/bundle/{budget-PPA7WY3D.js → budget-45QOBDWA.js} +5 -4
  29. package/bundle/{budget-PPA7WY3D.js.map → budget-45QOBDWA.js.map} +1 -1
  30. package/bundle/{capability-WXEA2WFK.js → capability-JFWX3IQF.js} +7 -6
  31. package/bundle/{chunk-CB6S3ZRF.js → chunk-2FAZIA37.js} +3 -3
  32. package/bundle/{chunk-VJATH7AN.js → chunk-2KC5G3EA.js} +9 -8
  33. package/bundle/chunk-2KC5G3EA.js.map +7 -0
  34. package/bundle/{chunk-OY2HAK33.js → chunk-36ZEYDKZ.js} +1 -1
  35. package/bundle/chunk-36ZEYDKZ.js.map +7 -0
  36. package/bundle/{chunk-2FZJDMAF.js → chunk-3CACHBDI.js} +10 -10
  37. package/bundle/{chunk-O4GKI3Q3.js → chunk-4S554KLW.js} +4 -4
  38. package/bundle/{chunk-3QW2K53E.js → chunk-5GCLBUBS.js} +11 -19
  39. package/bundle/chunk-5GCLBUBS.js.map +7 -0
  40. package/bundle/{chunk-RJX45XIC.js → chunk-5HDSQFT6.js} +9 -4
  41. package/bundle/chunk-5HDSQFT6.js.map +7 -0
  42. package/bundle/{chunk-EDZGF6BC.js → chunk-5NY2YULC.js} +11 -4
  43. package/bundle/chunk-5NY2YULC.js.map +7 -0
  44. package/bundle/{chunk-LE23VPN3.js → chunk-63A7ZRIH.js} +4 -4
  45. package/bundle/{chunk-LE23VPN3.js.map → chunk-63A7ZRIH.js.map} +1 -1
  46. package/bundle/{chunk-SSCGWDIC.js → chunk-65VCEC32.js} +2 -2
  47. package/bundle/{chunk-V2QIAXWZ.js → chunk-7BSQ5UQO.js} +3 -3
  48. package/bundle/{chunk-E7MV7WFT.js → chunk-7Z3HBPRY.js} +6 -6
  49. package/bundle/{chunk-TY26WMQY.js → chunk-AFREM7FX.js} +2 -2
  50. package/bundle/{chunk-GCFIK6OB.js → chunk-AO32N2VB.js} +92 -20
  51. package/bundle/chunk-AO32N2VB.js.map +7 -0
  52. package/bundle/{chunk-N5VROZ7A.js → chunk-B6ZN6COK.js} +5 -5
  53. package/bundle/{chunk-M6Q3IQ4H.js → chunk-BFDBGESM.js} +259 -122
  54. package/bundle/chunk-BFDBGESM.js.map +7 -0
  55. package/bundle/{chunk-YEOZN5IE.js → chunk-DYBW4XXL.js} +2 -2
  56. package/bundle/{chunk-56D3Y44D.js → chunk-EFJVUJBE.js} +10 -10
  57. package/bundle/{chunk-S6HEHCCG.js → chunk-EQSG2CRM.js} +83 -46
  58. package/bundle/chunk-EQSG2CRM.js.map +7 -0
  59. package/bundle/{chunk-FIAVVKGN.js → chunk-EUZDKV3C.js} +3 -3
  60. package/bundle/{chunk-2LKQV2ND.js → chunk-FRKW6LWB.js} +3 -3
  61. package/bundle/{chunk-H2K23MOF.js → chunk-GALQBVKO.js} +21 -5
  62. package/bundle/chunk-GALQBVKO.js.map +7 -0
  63. package/bundle/{chunk-DNDYD5SL.js → chunk-GP4XUKI5.js} +3 -3
  64. package/bundle/{chunk-SXNY6HC4.js → chunk-GPZNXY2U.js} +6 -6
  65. package/bundle/chunk-GPZNXY2U.js.map +7 -0
  66. package/bundle/{chunk-W726UGI6.js → chunk-GRVWZO4C.js} +3 -3
  67. package/bundle/{chunk-IXKQ4JMX.js → chunk-GVM5YU5I.js} +33 -17
  68. package/bundle/chunk-GVM5YU5I.js.map +7 -0
  69. package/bundle/{chunk-OOKNHOCB.js → chunk-GWILHZPT.js} +2 -2
  70. package/bundle/{chunk-3LQOJVTB.js → chunk-HFOCNYEO.js} +1842 -1220
  71. package/bundle/{chunk-3LQOJVTB.js.map → chunk-HFOCNYEO.js.map} +4 -4
  72. package/bundle/{chunk-NP72ZB7P.js → chunk-HMKVL7AX.js} +53 -47
  73. package/bundle/chunk-HMKVL7AX.js.map +7 -0
  74. package/bundle/{chunk-BNBC4T45.js → chunk-HT2BPTZY.js} +3 -3
  75. package/bundle/{chunk-BU7LTI2W.js → chunk-HZDLFLRP.js} +6 -7
  76. package/bundle/chunk-HZDLFLRP.js.map +7 -0
  77. package/bundle/{chunk-FVUL44T4.js → chunk-IJT4KWXT.js} +2 -2
  78. package/bundle/{chunk-IK4R3RBZ.js → chunk-JNIHEDKF.js} +3 -3
  79. package/bundle/{chunk-J5NOL4DB.js → chunk-JQDJPUHM.js} +16 -6
  80. package/bundle/chunk-JQDJPUHM.js.map +7 -0
  81. package/bundle/{chunk-SESM4GBM.js → chunk-KTYGKPYM.js} +52 -25
  82. package/bundle/chunk-KTYGKPYM.js.map +7 -0
  83. package/bundle/chunk-LME23AA2.js +37 -0
  84. package/bundle/chunk-LME23AA2.js.map +7 -0
  85. package/bundle/{chunk-4PIVWXUJ.js → chunk-LUNA6PM5.js} +2 -2
  86. package/bundle/{chunk-37EX63K4.js → chunk-LUW62WGO.js} +6998 -3621
  87. package/bundle/chunk-LUW62WGO.js.map +7 -0
  88. package/bundle/{chunk-MV5KOWOR.js → chunk-NDCRWEEJ.js} +7 -7
  89. package/bundle/{chunk-7WHXTCVD.js → chunk-NRUSRJXR.js} +8 -3
  90. package/bundle/chunk-NRUSRJXR.js.map +7 -0
  91. package/bundle/{chunk-C3EYYJN3.js → chunk-O7KQG6ME.js} +17 -5
  92. package/bundle/chunk-O7KQG6ME.js.map +7 -0
  93. package/bundle/{chunk-ZOCEBV62.js → chunk-OKAQICWY.js} +3 -3
  94. package/bundle/{chunk-TCI6FZTP.js → chunk-OLAURO5G.js} +9 -9
  95. package/bundle/{chunk-YME7NRGP.js → chunk-OXTSWQCX.js} +2 -2
  96. package/bundle/{chunk-HDOFJVFS.js → chunk-PEDX56EL.js} +3 -3
  97. package/bundle/{chunk-7RAGSHSH.js → chunk-PROPYS3P.js} +12 -10
  98. package/bundle/chunk-PROPYS3P.js.map +7 -0
  99. package/bundle/{chunk-ASYX43OU.js → chunk-Q32H6VPU.js} +26 -26
  100. package/bundle/{chunk-P5O6QZDC.js → chunk-QROWBWLL.js} +10 -6
  101. package/bundle/chunk-QROWBWLL.js.map +7 -0
  102. package/bundle/{chunk-S7ZIGIR5.js → chunk-R76K6L6H.js} +27 -27
  103. package/bundle/{chunk-S7ZIGIR5.js.map → chunk-R76K6L6H.js.map} +1 -1
  104. package/bundle/{chunk-MQJG7OJX.js → chunk-RIHQ37U5.js} +38 -36
  105. package/bundle/chunk-RIHQ37U5.js.map +7 -0
  106. package/bundle/{chunk-IQKADER4.js → chunk-RWRRGE4U.js} +2 -2
  107. package/bundle/{chunk-72T2Q7IG.js → chunk-S5GD5EJ5.js} +271 -282
  108. package/bundle/chunk-S5GD5EJ5.js.map +7 -0
  109. package/bundle/{chunk-ULO2PX3T.js → chunk-TEFZ4JA4.js} +3 -3
  110. package/bundle/{chunk-2RGR3LSV.js → chunk-TMUYFERL.js} +2 -2
  111. package/bundle/{chunk-KBPVJGD7.js → chunk-URQPDCK5.js} +3 -3
  112. package/bundle/chunk-UUIHL65U.js +77 -0
  113. package/bundle/chunk-UUIHL65U.js.map +7 -0
  114. package/bundle/{chunk-FJF42RZY.js → chunk-VUIX5AGB.js} +3 -3
  115. package/bundle/{chunk-5V4VHKEA.js → chunk-WBTJ2E62.js} +5 -4
  116. package/bundle/chunk-WBTJ2E62.js.map +7 -0
  117. package/bundle/{chunk-ZY6DH2S4.js → chunk-WTIGZO3N.js} +80 -70
  118. package/bundle/chunk-WTIGZO3N.js.map +7 -0
  119. package/bundle/{chunk-4HNCOQSK.js → chunk-WYHGNI56.js} +7 -7
  120. package/bundle/{chunk-24V4A6RP.js → chunk-XX6BGTPO.js} +4 -4
  121. package/bundle/{chunk-T7TAWGBX.js → chunk-Y76VUJSF.js} +2 -2
  122. package/bundle/{chunk-TVSPVZTX.js → chunk-YDY6QVWJ.js} +3 -3
  123. package/bundle/{chunk-V6CV3QPH.js → chunk-YRSMGJFP.js} +2 -2
  124. package/bundle/{chunk-WP7FZHMI.js → chunk-YSKCQH6E.js} +2 -2
  125. package/bundle/{chunk-NGZVJ52F.js → chunk-ZKJOFASV.js} +7 -7
  126. package/bundle/{chunk-WGWM4IZM.js → chunk-ZT5ZBGWS.js} +4 -4
  127. package/bundle/{chunk-WGWM4IZM.js.map → chunk-ZT5ZBGWS.js.map} +1 -1
  128. package/bundle/{chunk-43DKPXTP.js → chunk-ZV4IWKDJ.js} +4 -4
  129. package/bundle/{commands-XXFU2ZF7.js → commands-EWA4HNCM.js} +20 -20
  130. package/bundle/{config-EWDZ234X.js → config-M3P5IOAI.js} +8 -7
  131. package/bundle/{config-show-6J33O4TE.js → config-show-3DHPP26D.js} +5 -5
  132. package/bundle/{context-OCS7HLJP.js → context-5P7IYYU2.js} +5 -2
  133. package/bundle/{context-OCS7HLJP.js.map → context-5P7IYYU2.js.map} +1 -1
  134. package/bundle/{daemon-LTDAXNA2.js → daemon-TB23FFWY.js} +7 -7
  135. package/bundle/{delegation-tools-YDTWQMZD.js → delegation-tools-P2SCNL23.js} +14 -11
  136. package/bundle/{registry-client-VN2MM2HI.js → deploy-YYUCGGP3.js} +10 -6
  137. package/bundle/{deploy-lib-import-RGZJ3CGC.js → deploy-lib-import-T3UP4G6G.js} +5 -3
  138. package/bundle/{deps-PHSLIA77.js → deps-WVK553KF.js} +21 -19
  139. package/bundle/deps-WVK553KF.js.map +7 -0
  140. package/bundle/{direct-api-transport-OAKYQBJR.js → direct-api-transport-WQ6HA5OX.js} +30 -28
  141. package/bundle/direct-api-transport-WQ6HA5OX.js.map +7 -0
  142. package/bundle/{discord-adapter-WUNYPTDE.js → discord-adapter-4TTETYDI.js} +26 -26
  143. package/bundle/{dist-7HEHHQI2.js → dist-KMK7TZGN.js} +376 -348
  144. package/bundle/dist-KMK7TZGN.js.map +7 -0
  145. package/bundle/{dns-wakeup-F55ALHXJ.js → dns-wakeup-IDOJIXBX.js} +4 -3
  146. package/bundle/{dns-wakeup-F55ALHXJ.js.map → dns-wakeup-IDOJIXBX.js.map} +1 -1
  147. package/bundle/{doctor-probes-3SLIUGKS.js → doctor-probes-VDWFJKUB.js} +4 -3
  148. package/bundle/{env-schema-MSDP2YBO.js → env-schema-4JXQUOH4.js} +5 -4
  149. package/bundle/{gossip-CS3G3447.js → gossip-3C3BSNPN.js} +7 -6
  150. package/bundle/{guardrails-24XK2COI.js → guardrails-DL7ZSWVN.js} +6 -5
  151. package/bundle/{health-check-FRUNRVNQ.js → health-check-YKWFD2LZ.js} +5 -6
  152. package/bundle/{health-check-FRUNRVNQ.js.map → health-check-YKWFD2LZ.js.map} +2 -2
  153. package/bundle/{heartbeat-system-G4IFQXT6.js → heartbeat-system-TDDIOVTC.js} +7 -6
  154. package/bundle/{heartbeat-tier3-3ZO3EVXP.js → heartbeat-tier3-55T2HUNE.js} +45 -44
  155. package/bundle/heartbeat-tier3-55T2HUNE.js.map +7 -0
  156. package/bundle/{hook-system-X6INNJGV.js → hook-system-M3POLUIB.js} +5 -4
  157. package/bundle/{hotskills-6FQYTJIO.js → hotskills-FWX4QI7V.js} +7 -6
  158. package/bundle/{install-ZAHTZ5M5.js → install-4MXBYIUG.js} +23 -20
  159. package/bundle/install-4MXBYIUG.js.map +7 -0
  160. package/bundle/{install-manifest-QX7KVDCA.js → install-manifest-5PPWMD2W.js} +4 -3
  161. package/bundle/{install-manifest-QX7KVDCA.js.map → install-manifest-5PPWMD2W.js.map} +1 -1
  162. package/bundle/{irc-adapter-IEJQKKJF.js → irc-adapter-PTTZD32W.js} +5 -4
  163. package/bundle/{irc-adapter-IEJQKKJF.js.map → irc-adapter-PTTZD32W.js.map} +1 -1
  164. package/bundle/{irc-config-TTWNYFLH.js → irc-config-CP7ZMUOX.js} +6 -5
  165. package/bundle/{irc-config-TTWNYFLH.js.map → irc-config-CP7ZMUOX.js.map} +1 -1
  166. package/bundle/{kanban-board-J6RO3ZU7.js → kanban-board-M326B2XJ.js} +7 -5
  167. package/bundle/{kanban-channel-5EIXBFSA.js → kanban-channel-IJ52OMNA.js} +8 -6
  168. package/bundle/{lazy-require-V6EFUATC.js → lazy-require-KCRVT4SI.js} +11 -6
  169. package/bundle/{logger-Y3VILPRH.js → logger-OWCSNYCA.js} +4 -3
  170. package/bundle/{logs-YS3GDURO.js → logs-FXS4SCEM.js} +5 -5
  171. package/bundle/{main-chat-YLZDNQPO.js → main-chat-ZNUZCTNS.js} +6 -5
  172. package/bundle/{master-user-Z4M7KCJE.js → master-user-HSKM4ZFN.js} +7 -6
  173. package/bundle/{media-utils-P6RZ2K3U.js → media-utils-3ZYOD7SK.js} +44 -43
  174. package/bundle/{media-utils-P6RZ2K3U.js.map → media-utils-3ZYOD7SK.js.map} +2 -2
  175. package/bundle/{message-pipeline-MHEBDJLH.js → message-pipeline-KSONH4MT.js} +20 -20
  176. package/bundle/meta.json +9327 -8582
  177. package/bundle/{migrate-layout-RJJQLVGR.js → migrate-layout-IJIEJY3A.js} +8 -4
  178. package/bundle/migrate-layout-IJIEJY3A.js.map +7 -0
  179. package/bundle/{nerve-VZNMFDGY.js → nerve-IGSXBKZZ.js} +5 -4
  180. package/bundle/{notification-VV2OR6NW.js → notification-BFSIEECG.js} +8 -7
  181. package/bundle/{openrouter-credits-LXC7P4G6.js → openrouter-credits-NTVZDRYM.js} +5 -4
  182. package/bundle/{openrouter-credits-LXC7P4G6.js.map → openrouter-credits-NTVZDRYM.js.map} +1 -1
  183. package/bundle/{orc-KC4USP55.js → orc-EIGVTHAV.js} +4 -4
  184. package/bundle/{orc-tools-CHRSXSAS.js → orc-tools-A3G7WCSJ.js} +5 -4
  185. package/bundle/{paths-EDK6KWHG.js → paths-3ZVW3NFL.js} +6 -2
  186. package/bundle/{paths-RZF6WDMG.js → paths-X4LRYUI6.js} +3 -2
  187. package/bundle/{peer-auth-SRONOLNG.js → peer-auth-QC4EF2PM.js} +9 -8
  188. package/bundle/{peer-client-VOF77T6C.js → peer-client-RGEU5HOK.js} +9 -8
  189. package/bundle/{peer-client-VOF77T6C.js.map → peer-client-RGEU5HOK.js.map} +1 -1
  190. package/bundle/{peer-config-FRWLEYQ5.js → peer-config-TN55LFDC.js} +6 -5
  191. package/bundle/{peer-jwt-XY3XRIA2.js → peer-jwt-NCCPXJRX.js} +6 -5
  192. package/bundle/{peer-transport-UBBXTDRP.js → peer-transport-I6JPLFZ2.js} +8 -7
  193. package/bundle/{phase-transport-4NQHZX75.js → phase-transport-2BRWACDF.js} +18 -16
  194. package/bundle/public/css/dashboard.css +542 -0
  195. package/bundle/public/index.html +180 -0
  196. package/bundle/public/js/app.js +437 -0
  197. package/bundle/public/memory-universe.js +384 -0
  198. package/bundle/{reconcile-2EUXJ6W5.js → reconcile-CTFCLQRN.js} +5 -4
  199. package/bundle/{reconciler-FFQGV4DO.js → reconciler-FHESO6OC.js} +14 -11
  200. package/bundle/{reconciler-FFQGV4DO.js.map → reconciler-FHESO6OC.js.map} +1 -1
  201. package/bundle/{restore-NFDE2RG6.js → restore-IFHPI7I7.js} +13 -9
  202. package/bundle/{restore-NFDE2RG6.js.map → restore-IFHPI7I7.js.map} +3 -3
  203. package/bundle/{rollback-MVZ53XS4.js → rollback-ANRI3T5Z.js} +5 -5
  204. package/bundle/{chunk-SKY6656M.js → sandbox-runtime-QROWHDCS.js} +11 -28
  205. package/bundle/{chunk-SKY6656M.js.map → sandbox-runtime-QROWHDCS.js.map} +1 -1
  206. package/bundle/{self-healer-utils-KD6LV63S.js → self-healer-utils-IFAYOQO2.js} +5 -4
  207. package/bundle/{self-healer-utils-KD6LV63S.js.map → self-healer-utils-IFAYOQO2.js.map} +1 -1
  208. package/bundle/{sha-tracker-2DB4R2TW.js → sha-tracker-ZWBP6CIJ.js} +5 -4
  209. package/bundle/{skill-session-BPDVA6ZG.js → skill-session-AXBDQSLQ.js} +5 -4
  210. package/bundle/{skill-session-BPDVA6ZG.js.map → skill-session-AXBDQSLQ.js.map} +1 -1
  211. package/bundle/{skill-stats-TPD2NROA.js → skill-stats-JORH5DGM.js} +6 -5
  212. package/bundle/{skill-watcher-D7QYYYON.js → skill-watcher-E4MGLKLS.js} +6 -5
  213. package/bundle/{sleep-GH6DLBJJ.js → sleep-SRCSXY6T.js} +10 -9
  214. package/bundle/{soul-bundle-GXLMDBCC.js → soul-bundle-VWAVHCZ6.js} +10 -9
  215. package/bundle/{spin-4DBYHS3E.js → spin-IMW2MZOH.js} +13 -10
  216. package/bundle/{spin-notifications-IKYJPER5.js → spin-notifications-SE2HVZI7.js} +7 -5
  217. package/bundle/{spin-notifications-IKYJPER5.js.map → spin-notifications-SE2HVZI7.js.map} +1 -1
  218. package/bundle/{spin-types-PLJH3SIK.js → spin-types-BLPYAETA.js} +5 -4
  219. package/bundle/{src-SUFZ27S5.js → src-6BTCMOD3.js} +4 -4
  220. package/bundle/{sse-parser-anthropic-U7ILHOY5.js → sse-parser-anthropic-A6R4Z2TB.js} +5 -4
  221. package/bundle/{sse-parser-anthropic-U7ILHOY5.js.map → sse-parser-anthropic-A6R4Z2TB.js.map} +1 -1
  222. package/bundle/{sse-parser-responses-OI73R3AH.js → sse-parser-responses-HSZY3QGJ.js} +5 -4
  223. package/bundle/{sse-parser-responses-OI73R3AH.js.map → sse-parser-responses-HSZY3QGJ.js.map} +1 -1
  224. package/bundle/{ssrf-guard-6GP4QYVA.js → ssrf-guard-O6SHIK6Q.js} +5 -4
  225. package/bundle/{ssrf-guard-6GP4QYVA.js.map → ssrf-guard-O6SHIK6Q.js.map} +1 -1
  226. package/bundle/{start-JT2BPMSW.js → start-7QZIWO3S.js} +5 -5
  227. package/bundle/start-7QZIWO3S.js.map +7 -0
  228. package/bundle/{stt-KD3AABKG.js → stt-LGVPXMVR.js} +6 -5
  229. package/bundle/{subagent-runtime-LVECAUPV.js → subagent-runtime-3UJB4HUB.js} +6 -5
  230. package/bundle/system-status-ATGKRRQI.js +349 -0
  231. package/bundle/system-status-ATGKRRQI.js.map +7 -0
  232. package/bundle/{task-store-2XRDM3AW.js → task-store-W5BFIAIH.js} +6 -5
  233. package/bundle/{telegram-adapter-UJ3RYYV6.js → telegram-adapter-7G773NII.js} +35 -35
  234. package/bundle/{tool-registry-YU6WBXPA.js → tool-registry-J6TE3I2T.js} +25 -23
  235. package/bundle/{tool-sandbox-RNNPDR5M.js → tool-sandbox-4UC6GAKA.js} +6 -5
  236. package/bundle/{transport-config-OK3MZPJK.js → transport-config-KBF5W2DP.js} +9 -8
  237. package/bundle/{update-ENNPRW7Y.js → update-424ZZQQ6.js} +6 -6
  238. package/bundle/{update-check-SJB6GV3A.js → update-check-7UWKBJOP.js} +3 -2
  239. package/bundle/{update-check-SJB6GV3A.js.map → update-check-7UWKBJOP.js.map} +1 -1
  240. package/bundle/{usage-tracker-HRSGC7QC.js → usage-tracker-NXD364VX.js} +2 -2
  241. package/bundle/{user-registry-6PUJJ5J2.js → user-registry-35BW4XKM.js} +6 -5
  242. package/bundle/{wrapper-WLHLG4MI.js → wrapper-W66YICNZ.js} +3 -3
  243. package/bundle/{ws-peer-client-WHW3RJTD.js → ws-peer-client-AIXCXF7V.js} +15 -14
  244. package/bundle/{ws-peer-client-WHW3RJTD.js.map → ws-peer-client-AIXCXF7V.js.map} +2 -2
  245. package/package.json +4 -8
  246. package/scripts/emergency-deploy.sh +11 -8
  247. package/scripts/emergency-update.sh +156 -23
  248. package/templates/config/.env +1 -1
  249. package/templates/config/models.json +13 -0
  250. package/bundle/chunk-37EX63K4.js.map +0 -7
  251. package/bundle/chunk-3QW2K53E.js.map +0 -7
  252. package/bundle/chunk-5V4VHKEA.js.map +0 -7
  253. package/bundle/chunk-72T2Q7IG.js.map +0 -7
  254. package/bundle/chunk-7RAGSHSH.js.map +0 -7
  255. package/bundle/chunk-7WHXTCVD.js.map +0 -7
  256. package/bundle/chunk-BU7LTI2W.js.map +0 -7
  257. package/bundle/chunk-C3EYYJN3.js.map +0 -7
  258. package/bundle/chunk-CAOIIVFP.js +0 -110
  259. package/bundle/chunk-CAOIIVFP.js.map +0 -7
  260. package/bundle/chunk-EDZGF6BC.js.map +0 -7
  261. package/bundle/chunk-GCFIK6OB.js.map +0 -7
  262. package/bundle/chunk-H2K23MOF.js.map +0 -7
  263. package/bundle/chunk-HAZHNBBY.js +0 -156
  264. package/bundle/chunk-HAZHNBBY.js.map +0 -7
  265. package/bundle/chunk-IXKQ4JMX.js.map +0 -7
  266. package/bundle/chunk-J5NOL4DB.js.map +0 -7
  267. package/bundle/chunk-JAJ3DUQ2.js +0 -30
  268. package/bundle/chunk-JAJ3DUQ2.js.map +0 -7
  269. package/bundle/chunk-KMFR5AVY.js +0 -45
  270. package/bundle/chunk-KMFR5AVY.js.map +0 -7
  271. package/bundle/chunk-M6Q3IQ4H.js.map +0 -7
  272. package/bundle/chunk-MQJG7OJX.js.map +0 -7
  273. package/bundle/chunk-NP72ZB7P.js.map +0 -7
  274. package/bundle/chunk-OY2HAK33.js.map +0 -7
  275. package/bundle/chunk-P5O6QZDC.js.map +0 -7
  276. package/bundle/chunk-RJX45XIC.js.map +0 -7
  277. package/bundle/chunk-S6HEHCCG.js.map +0 -7
  278. package/bundle/chunk-SESM4GBM.js.map +0 -7
  279. package/bundle/chunk-SXNY6HC4.js.map +0 -7
  280. package/bundle/chunk-VJATH7AN.js.map +0 -7
  281. package/bundle/chunk-ZY6DH2S4.js.map +0 -7
  282. package/bundle/deps-PHSLIA77.js.map +0 -7
  283. package/bundle/direct-api-transport-OAKYQBJR.js.map +0 -7
  284. package/bundle/dist-7HEHHQI2.js.map +0 -7
  285. package/bundle/heartbeat-tier3-3ZO3EVXP.js.map +0 -7
  286. package/bundle/install-ZAHTZ5M5.js.map +0 -7
  287. package/bundle/migrate-layout-RJJQLVGR.js.map +0 -7
  288. package/bundle/phase-config-V4XETN5F.js +0 -18
  289. package/bundle/sandbox-runtime-WHACQLLN.js +0 -22
  290. package/bundle/start-JT2BPMSW.js.map +0 -7
  291. package/bundle/system-status-XXJWTVJN.js +0 -243
  292. package/bundle/system-status-XXJWTVJN.js.map +0 -7
  293. package/bundle/user-registry-6PUJJ5J2.js.map +0 -7
  294. package/bundle/wrapper-WLHLG4MI.js.map +0 -7
  295. /package/bundle/{agent-api-rate-limit-4GEZ4YN5.js.map → agent-api-rate-limit-WCFXJMGY.js.map} +0 -0
  296. /package/bundle/{agent-registry-563P4EUJ.js.map → agent-registry-GU7ABOK5.js.map} +0 -0
  297. /package/bundle/{bridge-lock-transport-LXCF2IVN.js.map → bridge-lock-transport-4ZH7QTJP.js.map} +0 -0
  298. /package/bundle/{browser-2VZOGOGX.js.map → browser-EJNS35NT.js.map} +0 -0
  299. /package/bundle/{capability-WXEA2WFK.js.map → capability-JFWX3IQF.js.map} +0 -0
  300. /package/bundle/{chunk-CB6S3ZRF.js.map → chunk-2FAZIA37.js.map} +0 -0
  301. /package/bundle/{chunk-2FZJDMAF.js.map → chunk-3CACHBDI.js.map} +0 -0
  302. /package/bundle/{chunk-O4GKI3Q3.js.map → chunk-4S554KLW.js.map} +0 -0
  303. /package/bundle/{chunk-SSCGWDIC.js.map → chunk-65VCEC32.js.map} +0 -0
  304. /package/bundle/{chunk-V2QIAXWZ.js.map → chunk-7BSQ5UQO.js.map} +0 -0
  305. /package/bundle/{chunk-E7MV7WFT.js.map → chunk-7Z3HBPRY.js.map} +0 -0
  306. /package/bundle/{chunk-TY26WMQY.js.map → chunk-AFREM7FX.js.map} +0 -0
  307. /package/bundle/{chunk-N5VROZ7A.js.map → chunk-B6ZN6COK.js.map} +0 -0
  308. /package/bundle/{chunk-YEOZN5IE.js.map → chunk-DYBW4XXL.js.map} +0 -0
  309. /package/bundle/{chunk-56D3Y44D.js.map → chunk-EFJVUJBE.js.map} +0 -0
  310. /package/bundle/{chunk-FIAVVKGN.js.map → chunk-EUZDKV3C.js.map} +0 -0
  311. /package/bundle/{chunk-2LKQV2ND.js.map → chunk-FRKW6LWB.js.map} +0 -0
  312. /package/bundle/{chunk-DNDYD5SL.js.map → chunk-GP4XUKI5.js.map} +0 -0
  313. /package/bundle/{chunk-W726UGI6.js.map → chunk-GRVWZO4C.js.map} +0 -0
  314. /package/bundle/{chunk-OOKNHOCB.js.map → chunk-GWILHZPT.js.map} +0 -0
  315. /package/bundle/{chunk-BNBC4T45.js.map → chunk-HT2BPTZY.js.map} +0 -0
  316. /package/bundle/{chunk-FVUL44T4.js.map → chunk-IJT4KWXT.js.map} +0 -0
  317. /package/bundle/{chunk-IK4R3RBZ.js.map → chunk-JNIHEDKF.js.map} +0 -0
  318. /package/bundle/{chunk-4PIVWXUJ.js.map → chunk-LUNA6PM5.js.map} +0 -0
  319. /package/bundle/{chunk-MV5KOWOR.js.map → chunk-NDCRWEEJ.js.map} +0 -0
  320. /package/bundle/{chunk-ZOCEBV62.js.map → chunk-OKAQICWY.js.map} +0 -0
  321. /package/bundle/{chunk-TCI6FZTP.js.map → chunk-OLAURO5G.js.map} +0 -0
  322. /package/bundle/{chunk-YME7NRGP.js.map → chunk-OXTSWQCX.js.map} +0 -0
  323. /package/bundle/{chunk-HDOFJVFS.js.map → chunk-PEDX56EL.js.map} +0 -0
  324. /package/bundle/{chunk-ASYX43OU.js.map → chunk-Q32H6VPU.js.map} +0 -0
  325. /package/bundle/{chunk-IQKADER4.js.map → chunk-RWRRGE4U.js.map} +0 -0
  326. /package/bundle/{chunk-ULO2PX3T.js.map → chunk-TEFZ4JA4.js.map} +0 -0
  327. /package/bundle/{chunk-2RGR3LSV.js.map → chunk-TMUYFERL.js.map} +0 -0
  328. /package/bundle/{chunk-KBPVJGD7.js.map → chunk-URQPDCK5.js.map} +0 -0
  329. /package/bundle/{chunk-FJF42RZY.js.map → chunk-VUIX5AGB.js.map} +0 -0
  330. /package/bundle/{chunk-4HNCOQSK.js.map → chunk-WYHGNI56.js.map} +0 -0
  331. /package/bundle/{chunk-24V4A6RP.js.map → chunk-XX6BGTPO.js.map} +0 -0
  332. /package/bundle/{chunk-T7TAWGBX.js.map → chunk-Y76VUJSF.js.map} +0 -0
  333. /package/bundle/{chunk-TVSPVZTX.js.map → chunk-YDY6QVWJ.js.map} +0 -0
  334. /package/bundle/{chunk-V6CV3QPH.js.map → chunk-YRSMGJFP.js.map} +0 -0
  335. /package/bundle/{chunk-WP7FZHMI.js.map → chunk-YSKCQH6E.js.map} +0 -0
  336. /package/bundle/{chunk-NGZVJ52F.js.map → chunk-ZKJOFASV.js.map} +0 -0
  337. /package/bundle/{chunk-43DKPXTP.js.map → chunk-ZV4IWKDJ.js.map} +0 -0
  338. /package/bundle/{commands-XXFU2ZF7.js.map → commands-EWA4HNCM.js.map} +0 -0
  339. /package/bundle/{config-EWDZ234X.js.map → config-M3P5IOAI.js.map} +0 -0
  340. /package/bundle/{config-show-6J33O4TE.js.map → config-show-3DHPP26D.js.map} +0 -0
  341. /package/bundle/{daemon-LTDAXNA2.js.map → daemon-TB23FFWY.js.map} +0 -0
  342. /package/bundle/{delegation-tools-YDTWQMZD.js.map → delegation-tools-P2SCNL23.js.map} +0 -0
  343. /package/bundle/{deploy-lib-import-RGZJ3CGC.js.map → deploy-YYUCGGP3.js.map} +0 -0
  344. /package/bundle/{doctor-probes-3SLIUGKS.js.map → deploy-lib-import-T3UP4G6G.js.map} +0 -0
  345. /package/bundle/{discord-adapter-WUNYPTDE.js.map → discord-adapter-4TTETYDI.js.map} +0 -0
  346. /package/bundle/{env-schema-MSDP2YBO.js.map → doctor-probes-VDWFJKUB.js.map} +0 -0
  347. /package/bundle/{gossip-CS3G3447.js.map → env-schema-4JXQUOH4.js.map} +0 -0
  348. /package/bundle/{guardrails-24XK2COI.js.map → gossip-3C3BSNPN.js.map} +0 -0
  349. /package/bundle/{heartbeat-system-G4IFQXT6.js.map → guardrails-DL7ZSWVN.js.map} +0 -0
  350. /package/bundle/{hook-system-X6INNJGV.js.map → heartbeat-system-TDDIOVTC.js.map} +0 -0
  351. /package/bundle/{hotskills-6FQYTJIO.js.map → hook-system-M3POLUIB.js.map} +0 -0
  352. /package/bundle/{kanban-board-J6RO3ZU7.js.map → hotskills-FWX4QI7V.js.map} +0 -0
  353. /package/bundle/{kanban-channel-5EIXBFSA.js.map → kanban-board-M326B2XJ.js.map} +0 -0
  354. /package/bundle/{lazy-require-V6EFUATC.js.map → kanban-channel-IJ52OMNA.js.map} +0 -0
  355. /package/bundle/{logger-Y3VILPRH.js.map → lazy-require-KCRVT4SI.js.map} +0 -0
  356. /package/bundle/{main-chat-YLZDNQPO.js.map → logger-OWCSNYCA.js.map} +0 -0
  357. /package/bundle/{logs-YS3GDURO.js.map → logs-FXS4SCEM.js.map} +0 -0
  358. /package/bundle/{master-user-Z4M7KCJE.js.map → main-chat-ZNUZCTNS.js.map} +0 -0
  359. /package/bundle/{message-pipeline-MHEBDJLH.js.map → master-user-HSKM4ZFN.js.map} +0 -0
  360. /package/bundle/{nerve-VZNMFDGY.js.map → message-pipeline-KSONH4MT.js.map} +0 -0
  361. /package/bundle/{notification-VV2OR6NW.js.map → nerve-IGSXBKZZ.js.map} +0 -0
  362. /package/bundle/{orc-tools-CHRSXSAS.js.map → notification-BFSIEECG.js.map} +0 -0
  363. /package/bundle/{orc-KC4USP55.js.map → orc-EIGVTHAV.js.map} +0 -0
  364. /package/bundle/{paths-EDK6KWHG.js.map → orc-tools-A3G7WCSJ.js.map} +0 -0
  365. /package/bundle/{paths-RZF6WDMG.js.map → paths-3ZVW3NFL.js.map} +0 -0
  366. /package/bundle/{peer-auth-SRONOLNG.js.map → paths-X4LRYUI6.js.map} +0 -0
  367. /package/bundle/{peer-config-FRWLEYQ5.js.map → peer-auth-QC4EF2PM.js.map} +0 -0
  368. /package/bundle/{peer-jwt-XY3XRIA2.js.map → peer-config-TN55LFDC.js.map} +0 -0
  369. /package/bundle/{peer-transport-UBBXTDRP.js.map → peer-jwt-NCCPXJRX.js.map} +0 -0
  370. /package/bundle/{phase-config-V4XETN5F.js.map → peer-transport-I6JPLFZ2.js.map} +0 -0
  371. /package/bundle/{phase-transport-4NQHZX75.js.map → phase-transport-2BRWACDF.js.map} +0 -0
  372. /package/bundle/{reconcile-2EUXJ6W5.js.map → reconcile-CTFCLQRN.js.map} +0 -0
  373. /package/bundle/{registry-client-VN2MM2HI.js.map → rollback-ANRI3T5Z.js.map} +0 -0
  374. /package/bundle/{rollback-MVZ53XS4.js.map → sha-tracker-ZWBP6CIJ.js.map} +0 -0
  375. /package/bundle/{sandbox-runtime-WHACQLLN.js.map → skill-stats-JORH5DGM.js.map} +0 -0
  376. /package/bundle/{sha-tracker-2DB4R2TW.js.map → skill-watcher-E4MGLKLS.js.map} +0 -0
  377. /package/bundle/{skill-stats-TPD2NROA.js.map → sleep-SRCSXY6T.js.map} +0 -0
  378. /package/bundle/{skill-watcher-D7QYYYON.js.map → soul-bundle-VWAVHCZ6.js.map} +0 -0
  379. /package/bundle/{sleep-GH6DLBJJ.js.map → spin-IMW2MZOH.js.map} +0 -0
  380. /package/bundle/{soul-bundle-GXLMDBCC.js.map → spin-types-BLPYAETA.js.map} +0 -0
  381. /package/bundle/{spin-4DBYHS3E.js.map → src-6BTCMOD3.js.map} +0 -0
  382. /package/bundle/{spin-types-PLJH3SIK.js.map → stt-LGVPXMVR.js.map} +0 -0
  383. /package/bundle/{src-SUFZ27S5.js.map → subagent-runtime-3UJB4HUB.js.map} +0 -0
  384. /package/bundle/{stt-KD3AABKG.js.map → task-store-W5BFIAIH.js.map} +0 -0
  385. /package/bundle/{telegram-adapter-UJ3RYYV6.js.map → telegram-adapter-7G773NII.js.map} +0 -0
  386. /package/bundle/{subagent-runtime-LVECAUPV.js.map → tool-registry-J6TE3I2T.js.map} +0 -0
  387. /package/bundle/{task-store-2XRDM3AW.js.map → tool-sandbox-4UC6GAKA.js.map} +0 -0
  388. /package/bundle/{tool-registry-YU6WBXPA.js.map → transport-config-KBF5W2DP.js.map} +0 -0
  389. /package/bundle/{tool-sandbox-RNNPDR5M.js.map → update-424ZZQQ6.js.map} +0 -0
  390. /package/bundle/{transport-config-OK3MZPJK.js.map → usage-tracker-NXD364VX.js.map} +0 -0
  391. /package/bundle/{update-ENNPRW7Y.js.map → user-registry-35BW4XKM.js.map} +0 -0
  392. /package/bundle/{usage-tracker-HRSGC7QC.js.map → wrapper-W66YICNZ.js.map} +0 -0
@@ -5,20 +5,20 @@ import {
5
5
  BrowserManager,
6
6
  BrowserTool,
7
7
  DomainAllowlist
8
- } from "./chunk-VJATH7AN.js";
8
+ } from "./chunk-2KC5G3EA.js";
9
9
  import {
10
10
  getEnv,
11
11
  init_env_schema
12
- } from "./chunk-SSCGWDIC.js";
12
+ } from "./chunk-65VCEC32.js";
13
13
  import {
14
14
  init_logger,
15
15
  logError,
16
16
  logInfo
17
- } from "./chunk-OOKNHOCB.js";
17
+ } from "./chunk-GWILHZPT.js";
18
18
  import {
19
19
  abtarsHome,
20
20
  init_paths
21
- } from "./chunk-H2K23MOF.js";
21
+ } from "./chunk-GALQBVKO.js";
22
22
  import {
23
23
  __export
24
24
  } from "./chunk-7K2YZTLD.js";
@@ -66,7 +66,7 @@ function register(api) {
66
66
  buf = buf.slice(nl + 1);
67
67
  try {
68
68
  const { taskId, prompt, timeoutMs } = JSON.parse(line);
69
- import("./spin-4DBYHS3E.js").then(({ spin: s }) => {
69
+ import("./spin-IMW2MZOH.js").then(({ spin: s }) => {
70
70
  const { cardId } = s.dispatch({ type: "B", goal: prompt, source: "agent", timeoutMs });
71
71
  conn.write(JSON.stringify({ ok: true, taskId, cardId, status: "spawned" }) + "\n");
72
72
  }).catch((err) => {
@@ -98,4 +98,4 @@ export {
98
98
  register,
99
99
  browser_exports
100
100
  };
101
- //# sourceMappingURL=chunk-E7MV7WFT.js.map
101
+ //# sourceMappingURL=chunk-7Z3HBPRY.js.map
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  init_user_registry,
5
5
  loadUsers
6
- } from "./chunk-43DKPXTP.js";
6
+ } from "./chunk-ZV4IWKDJ.js";
7
7
  import {
8
8
  __esm
9
9
  } from "./chunk-7K2YZTLD.js";
@@ -24,4 +24,4 @@ export {
24
24
  getMasterUserId,
25
25
  init_master_user
26
26
  };
27
- //# sourceMappingURL=chunk-TY26WMQY.js.map
27
+ //# sourceMappingURL=chunk-AFREM7FX.js.map
@@ -1,5 +1,13 @@
1
1
  #!/usr/bin/env node
2
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
+ getMasterUserId,
5
+ init_master_user
6
+ } from "./chunk-AFREM7FX.js";
7
+ import {
8
+ init_user_registry,
9
+ loadUsers
10
+ } from "./chunk-ZV4IWKDJ.js";
3
11
  import {
4
12
  init_spin_types,
5
13
  parseSessionType,
@@ -7,7 +15,7 @@ import {
7
15
  sessionType,
8
16
  typeAgent,
9
17
  typeLabel
10
- } from "./chunk-T7TAWGBX.js";
18
+ } from "./chunk-Y76VUJSF.js";
11
19
  import {
12
20
  init_kanban_board,
13
21
  isUnblocked,
@@ -18,23 +26,24 @@ import {
18
26
  kanbanList,
19
27
  kanbanRetryOrFail,
20
28
  kanbanRunning
21
- } from "./chunk-S6HEHCCG.js";
29
+ } from "./chunk-EQSG2CRM.js";
22
30
  import {
23
- getMasterUserId,
24
- init_master_user
25
- } from "./chunk-TY26WMQY.js";
26
- import {
27
- init_user_registry,
28
- loadUsers
29
- } from "./chunk-43DKPXTP.js";
31
+ init_log_and_swallow,
32
+ logAndSwallow
33
+ } from "./chunk-YSKCQH6E.js";
30
34
  import {
31
35
  init_logger,
32
36
  logInfo,
33
37
  logWarn
34
- } from "./chunk-OOKNHOCB.js";
38
+ } from "./chunk-GWILHZPT.js";
39
+ import {
40
+ init_paths,
41
+ paths_exports
42
+ } from "./chunk-GALQBVKO.js";
35
43
  import {
36
44
  __esm,
37
45
  __export,
46
+ __require,
38
47
  __toCommonJS
39
48
  } from "./chunk-7K2YZTLD.js";
40
49
 
@@ -368,7 +377,7 @@ __export(spin_exports, {
368
377
  });
369
378
  async function fireCallback(peerName, taskId, status, result, error, artifacts, tokensUsed) {
370
379
  try {
371
- const { getPeerTransport } = await import("./peer-transport-UBBXTDRP.js");
380
+ const { getPeerTransport } = await import("./peer-transport-I6JPLFZ2.js");
372
381
  const transport = getPeerTransport();
373
382
  const payload = { action: "callback", task_id: taskId, status, result_summary: result, error, tokens_used: tokensUsed ?? 0 };
374
383
  if (artifacts?.length) payload.artifacts = artifacts;
@@ -382,6 +391,7 @@ var TAG, USER_SESSION_IDLE_MS, GUEST_SESSION_IDLE_MS, MAX_TOTAL_SESSIONS, SESSIO
382
391
  var init_spin = __esm({
383
392
  "src/components/spin.ts"() {
384
393
  init_logger();
394
+ init_log_and_swallow();
385
395
  init_kanban_board();
386
396
  init_user_registry();
387
397
  init_master_user();
@@ -411,6 +421,7 @@ var init_spin = __esm({
411
421
  memory = null;
412
422
  orcSession = null;
413
423
  _lastHealerDoneAt = 0;
424
+ _housekeepCounter = 0;
414
425
  setRuntime(runtime) {
415
426
  this.runtime = runtime;
416
427
  }
@@ -826,6 +837,11 @@ var init_spin = __esm({
826
837
  this.drainQueued();
827
838
  this.checkStaleWorkers();
828
839
  await this.pollRemoteCards();
840
+ this._housekeepCounter++;
841
+ if (this._housekeepCounter % 72 === 0) {
842
+ this.pruneSkillTrash();
843
+ this.rotateAuditLog();
844
+ }
829
845
  }
830
846
  checkStaleWorkers() {
831
847
  const STALE_MS = parseInt(process.env["WORKER_STALE_MS"] || "300000", 10);
@@ -842,10 +858,66 @@ var init_spin = __esm({
842
858
  }
843
859
  }
844
860
  }
861
+ /** #613: Prune .trash/ entries older than 7 days (~hourly). */
862
+ pruneSkillTrash() {
863
+ const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1e3;
864
+ const { existsSync, readdirSync, rmSync, statSync: statSync2 } = __require("node:fs");
865
+ const { join: join2 } = __require("node:path");
866
+ const { abtarsHome } = (init_paths(), __toCommonJS(paths_exports));
867
+ const trashPath = join2(abtarsHome(), "skills", ".trash");
868
+ if (!existsSync(trashPath)) return;
869
+ const now = Date.now();
870
+ for (const entry of readdirSync(trashPath)) {
871
+ try {
872
+ const full = join2(trashPath, entry);
873
+ const stat = statSync2(full);
874
+ if (now - stat.mtimeMs > SEVEN_DAYS_MS) {
875
+ rmSync(full, { recursive: true });
876
+ logInfo("skill-trash-prune", `Pruned: ${entry}`);
877
+ }
878
+ } catch (err) {
879
+ logAndSwallow(TAG, "prune entry", err);
880
+ }
881
+ }
882
+ }
883
+ /** #681: Rotate audit.jsonl when > 10MB, prune files older than 30 days (~hourly). */
884
+ rotateAuditLog() {
885
+ const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1e3;
886
+ const { existsSync, statSync: statSync2, renameSync, readdirSync, unlinkSync } = __require("node:fs");
887
+ const { join: join2 } = __require("node:path");
888
+ const { abtarsHome } = (init_paths(), __toCommonJS(paths_exports));
889
+ const logsDir = join2(abtarsHome(), "logs");
890
+ const auditPath = join2(logsDir, "audit.jsonl");
891
+ if (!existsSync(auditPath)) return;
892
+ try {
893
+ const stat = statSync2(auditPath);
894
+ if (stat.size > 10 * 1024 * 1024) {
895
+ const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
896
+ renameSync(auditPath, join2(logsDir, `audit-${date}.jsonl`));
897
+ logInfo("audit-rotation", `Rotated audit.jsonl (${(stat.size / 1024 / 1024).toFixed(1)}MB)`);
898
+ }
899
+ } catch (err) {
900
+ logAndSwallow(TAG, "audit rotate", err);
901
+ }
902
+ const now = Date.now();
903
+ try {
904
+ for (const f of readdirSync(logsDir)) {
905
+ if (!f.startsWith("audit-") || !f.endsWith(".jsonl")) continue;
906
+ const full = join2(logsDir, f);
907
+ const stat = statSync2(full);
908
+ if (now - stat.mtimeMs > THIRTY_DAYS_MS) {
909
+ unlinkSync(full);
910
+ logInfo("audit-rotation", `Pruned: ${f}`);
911
+ }
912
+ }
913
+ } catch (err) {
914
+ logAndSwallow(TAG, "audit prune", err);
915
+ }
916
+ }
845
917
  async pollRemoteCards() {
846
918
  const remoteCards = kanbanList("running", "status").filter((c) => c.type === "remote");
847
919
  if (remoteCards.length === 0) return;
848
- const { getPeerTransport } = await import("./peer-transport-UBBXTDRP.js");
920
+ const { getPeerTransport } = await import("./peer-transport-I6JPLFZ2.js");
849
921
  const transport = getPeerTransport();
850
922
  const REMOTE_MAX_AGE_MS = 15 * 60 * 1e3;
851
923
  for (const card of remoteCards) {
@@ -897,7 +969,7 @@ var init_spin = __esm({
897
969
  }
898
970
  }, 6e4);
899
971
  try {
900
- const { buildSoulBundle } = await import("./soul-bundle-GXLMDBCC.js");
972
+ const { buildSoulBundle } = await import("./soul-bundle-VWAVHCZ6.js");
901
973
  const bundle = buildSoulBundle(request.type);
902
974
  let fullPrompt = bundle ? `${bundle}
903
975
 
@@ -905,7 +977,7 @@ var init_spin = __esm({
905
977
 
906
978
  ${request.goal}` : request.goal;
907
979
  if (request.type === "W" || request.type === "T") {
908
- const { channelUnread } = await import("./kanban-channel-5EIXBFSA.js");
980
+ const { channelUnread } = await import("./kanban-channel-IJ52OMNA.js");
909
981
  const workerName = `Worker-${String(cardId).padStart(2, "0")}`;
910
982
  const parentCard = request.parentCardId ?? cardId;
911
983
  const msgs = channelUnread(parentCard, workerName);
@@ -931,8 +1003,8 @@ ${fullPrompt}`;
931
1003
  }
932
1004
  }
933
1005
  async executeOrc(request, cardId, timeoutMs) {
934
- const { updateBridgeLockField } = await import("./bridge-lock-transport-LXCF2IVN.js");
935
- const { setActiveOrcCard } = await import("./orc-tools-CHRSXSAS.js");
1006
+ const { updateBridgeLockField } = await import("./bridge-lock-transport-4ZH7QTJP.js");
1007
+ const { setActiveOrcCard } = await import("./orc-tools-A3G7WCSJ.js");
936
1008
  updateBridgeLockField("orc_active", cardId);
937
1009
  setActiveOrcCard(cardId);
938
1010
  const orc = await this.getOrCreateOrc();
@@ -950,7 +1022,7 @@ ${fullPrompt}`;
950
1022
  logWarn(TAG, `\u23F1\uFE0F O card:${cardId} timed out`);
951
1023
  }, timeoutMs);
952
1024
  try {
953
- const { buildSoulBundle } = await import("./soul-bundle-GXLMDBCC.js");
1025
+ const { buildSoulBundle } = await import("./soul-bundle-VWAVHCZ6.js");
954
1026
  const bundle = buildSoulBundle("O");
955
1027
  const { localDateTime } = await import("./local-time-HT7A7OGW.js");
956
1028
  const context = `[CONTEXT \u2014 do not respond to this section]
@@ -964,10 +1036,10 @@ ${fullPrompt}`;
964
1036
  ---
965
1037
 
966
1038
  ${request.goal}` : request.goal);
967
- const { drainOrcNotifications } = await import("./spin-notifications-IKYJPER5.js");
1039
+ const { drainOrcNotifications } = await import("./spin-notifications-SE2HVZI7.js");
968
1040
  const notifications = drainOrcNotifications(cardId);
969
1041
  if (notifications.length) fullPrompt = notifications.join("\n") + "\n\n" + fullPrompt;
970
- const { channelUnread } = await import("./kanban-channel-5EIXBFSA.js");
1042
+ const { channelUnread } = await import("./kanban-channel-IJ52OMNA.js");
971
1043
  const orcMsgs = channelUnread(cardId, "Orc");
972
1044
  if (orcMsgs.length > 0) {
973
1045
  const lines = orcMsgs.map((m) => `[${m.from_agent}\u2192${m.to_agent}]${m.directive ? " \u26A1" : ""} ${m.message}`);
@@ -1005,4 +1077,4 @@ export {
1005
1077
  spin_exports,
1006
1078
  init_spin
1007
1079
  };
1008
- //# sourceMappingURL=chunk-GCFIK6OB.js.map
1080
+ //# sourceMappingURL=chunk-AO32N2VB.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/components/spin-sessions.ts", "../src/components/artifact-store.ts", "../src/components/transport/artifact-tools.ts", "../src/components/spin.ts"],
4
+ "sourcesContent": ["/**\n * spin-sessions.ts \u2014 Session CRUD on a flat Map<id, ManagedSession> (#953).\n * No PlatformState, no bucketing. Filter/find on the one map.\n */\n\nimport type { ManagedSession, SessionType } from \"./spin-types.js\";\nimport { sessionType, sessionCreatedAt, typeLabel } from \"./spin-types.js\";\n\nconst MAX_LOG = 5;\n\nexport function pushLog(session: ManagedSession, event: string): void {\n session.log.push(`${new Date().toISOString().slice(11, 19)} ${event}`);\n if (session.log.length > MAX_LOG) session.log.shift();\n}\n\nexport function allocateSession(\n sessions: Map<string, ManagedSession>, nextIndex: number,\n type: SessionType, userId: string, platform: string, chatId: number,\n opts?: { active?: boolean; motherId?: string },\n): { session: ManagedSession; nextIndex: number } {\n const idx = nextIndex + 1;\n const ts = Math.floor(Date.now() / 1000);\n const session: ManagedSession = {\n id: `${ts}_${type}_${String(idx).padStart(2, \"0\")}`,\n userId, platform, chatId,\n delivery: \"simple\",\n active: opts?.active ?? false,\n status: \"ready\",\n idleTimeoutMs: 7200000,\n lastActiveAt: Date.now(),\n motherId: opts?.motherId,\n messageCount: 0, tokenCount: 0, toolCallCount: 0,\n log: [],\n shortIndex: idx,\n // Pipeline state defaults (#1040)\n busy: false, queue: [], fullMode: false, pendingStart: false,\n seen: false, compacting: false, ctxWarned: false, compactFailures: 0,\n primingTerms: [], completions: [],\n };\n sessions.set(session.id, session);\n pushLog(session, \"created\");\n return { session, nextIndex: idx };\n}\n\nexport function getActiveSession(sessions: Map<string, ManagedSession>, userId: string, platform: string): ManagedSession | undefined {\n for (const s of sessions.values()) {\n if (s.userId === userId && s.platform === platform && s.active && s.status !== \"ended\") return s;\n }\n return undefined;\n}\n\nexport function createSession(\n sessions: Map<string, ManagedSession>, nextIndex: number,\n userId: string, platform: string, type: SessionType, chatId: number, maxSessions: number,\n): { session: ManagedSession; nextIndex: number } | string {\n const alive = [...sessions.values()].filter(s => s.status !== \"ended\");\n if (alive.length >= maxSessions) return `Max sessions reached (${maxSessions}). End or kill a session first.`;\n\n // Deactivate current active\n const cur = getActiveSession(sessions, userId, platform);\n if (cur) cur.active = false;\n\n const result = allocateSession(sessions, nextIndex, type, userId, platform, chatId, { active: true });\n return result;\n}\n\nexport function createSubSession(\n sessions: Map<string, ManagedSession>, nextIndex: number,\n userId: string, platform: string, type: SessionType, chatId: number, maxSessions: number,\n): { session: ManagedSession; nextIndex: number } | string {\n const alive = [...sessions.values()].filter(s => s.status !== \"ended\");\n if (alive.length >= maxSessions) return `Max sessions reached \u2014 auto-spawn skipped.`;\n\n const active = getActiveSession(sessions, userId, platform);\n return allocateSession(sessions, nextIndex, type, userId, platform, chatId, { active: false, motherId: active?.id });\n}\n\nexport function isHollow(session: ManagedSession): boolean { return !!session.peer; }\n\nexport function createHollowSession(\n sessions: Map<string, ManagedSession>, nextIndex: number,\n userId: string, platform: string, type: SessionType, chatId: number,\n peer: string, remoteSessionId: string, maxSessions: number,\n): { session: ManagedSession; nextIndex: number } | string {\n const alive = [...sessions.values()].filter(s => s.status !== \"ended\");\n if (alive.length >= maxSessions) return `Max sessions reached \u2014 cannot create hollow session.`;\n\n const result = allocateSession(sessions, nextIndex, type, userId, platform, chatId, { active: false });\n result.session.peer = peer;\n result.session.remoteSessionId = remoteSessionId;\n pushLog(result.session, `hollow (${peer})`);\n return result;\n}\n\nexport function switchSession(sessions: Map<string, ManagedSession>, userId: string, platform: string, index: number): ManagedSession | string {\n const target = [...sessions.values()].find(s => s.shortIndex === index && s.status !== \"ended\" && s.userId === userId);\n if (!target) return `Session #${index} not found or not switchable.`;\n const cur = getActiveSession(sessions, userId, platform);\n if (cur) cur.active = false;\n target.active = true;\n return target;\n}\n\nexport function endSession(sessions: Map<string, ManagedSession>, nextIndex: number, userId: string, platform: string, index?: number): { ended: ManagedSession; nextIndex: number } | string {\n const targetIdx = index ?? getActiveSession(sessions, userId, platform)?.shortIndex;\n if (!targetIdx) return `No active session found.`;\n const target = [...sessions.values()].find(s => s.shortIndex === targetIdx && s.status !== \"ended\" && s.userId === userId);\n if (!target) return `Session #${targetIdx} not found.`;\n\n const aliveMains = [...sessions.values()].filter(s => sessionType(s) === \"A\" && s.status !== \"ended\" && s.userId === userId);\n\n target.status = \"ended\";\n target.active = false;\n pushLog(target, \"ended\");\n\n // If ended the last Main, create a replacement\n if (sessionType(target) === \"A\" && aliveMains.length <= 1) {\n const result = allocateSession(sessions, nextIndex, \"A\", userId, platform, target.chatId, { active: true });\n return { ended: target, nextIndex: result.nextIndex };\n }\n\n // If ended the active session, activate first available Main\n if (index === undefined || target.active) {\n const main = [...sessions.values()].find(s => sessionType(s) === \"A\" && s.status !== \"ended\" && s.userId === userId);\n if (main) main.active = true;\n }\n\n return { ended: target, nextIndex };\n}\n\nexport function killSession(sessions: Map<string, ManagedSession>, nextIndex: number, userId: string, platform: string, index: number): { killed: ManagedSession; nextIndex: number } | string {\n const target = [...sessions.values()].find(s => s.shortIndex === index && s.status !== \"ended\" && s.userId === userId);\n if (!target) return `Session #${index} not found.`;\n\n target.status = \"ended\";\n target.active = false;\n pushLog(target, \"killed\");\n\n // If killed a Main and it was the last, create replacement\n const aliveMains = [...sessions.values()].filter(s => sessionType(s) === \"A\" && s.status !== \"ended\" && s.userId === userId);\n if (sessionType(target) === \"A\" && aliveMains.length === 0) {\n const result = allocateSession(sessions, nextIndex, \"A\", userId, platform, target.chatId, { active: true });\n return { killed: target, nextIndex: result.nextIndex };\n }\n\n // If killed the active, activate a Main\n if (!getActiveSession(sessions, userId, platform)) {\n const main = [...sessions.values()].find(s => sessionType(s) === \"A\" && s.status !== \"ended\" && s.userId === userId);\n if (main) main.active = true;\n }\n\n return { killed: target, nextIndex };\n}\n\nexport function pauseSession(sessions: Map<string, ManagedSession>, userId: string, platform: string, index?: number): ManagedSession | string {\n const targetIdx = index ?? getActiveSession(sessions, userId, platform)?.shortIndex;\n if (!targetIdx) return `No active session found.`;\n const target = [...sessions.values()].find(s => s.shortIndex === targetIdx && s.status !== \"ended\" && s.userId === userId);\n if (!target) return `Session #${targetIdx} not found.`;\n if (target.status === \"paused\") return `Session #${targetIdx} is already paused.`;\n target.status = \"paused\";\n pushLog(target, \"paused\");\n return target;\n}\n\nexport function resumeSession(sessions: Map<string, ManagedSession>, userId: string, platform: string, index?: number): ManagedSession | string {\n const targetIdx = index ?? getActiveSession(sessions, userId, platform)?.shortIndex;\n if (!targetIdx) return `No active session found.`;\n const target = [...sessions.values()].find(s => s.shortIndex === targetIdx && s.status !== \"ended\" && s.userId === userId);\n if (!target) return `Session #${targetIdx} not found.`;\n if (target.status !== \"paused\") return `Session #${targetIdx} is not paused.`;\n target.status = \"ready\";\n pushLog(target, \"resumed\");\n return target;\n}\n\nexport function listSessions(sessions: Map<string, ManagedSession>, userId: string, platform: string): ManagedSession[] {\n return [...sessions.values()].filter(s => s.userId === userId && s.platform === platform && s.status !== \"ended\");\n}\n\nexport function listAllSessions(sessions: Map<string, ManagedSession>): ManagedSession[] {\n return [...sessions.values()].filter(s => s.status !== \"ended\");\n}\n\nexport function getSessionById(sessions: Map<string, ManagedSession>, sessionId: string): ManagedSession | undefined {\n return sessions.get(sessionId);\n}\n\nexport function formatList(sessions: Map<string, ManagedSession>, userId: string, platform: string, showAll = false): string {\n const list = showAll ? listAllSessions(sessions) : listSessions(sessions, userId, platform);\n if (list.length === 0) return \"No active sessions.\";\n return list.map(s => {\n const marker = s.active && s.userId === userId ? \" *\" : \"\";\n const owner = showAll && s.userId !== userId ? ` (${s.userId})` : \"\";\n const bg = !s.active && sessionType(s) !== \"A\" ? \" (bg)\" : \"\";\n const paused = s.status === \"paused\" ? \" \u23F8\" : \"\";\n const remote = s.peer ? ` (remote: ${s.peer})` : \"\";\n const model = s.model ? ` ${s.model}` : \"\";\n const nm = s.name ? ` \"${s.name}\"` : \"\";\n const time = new Date(sessionCreatedAt(s)).toLocaleTimeString(\"en-GB\", { hour: \"2-digit\", minute: \"2-digit\" });\n const idle = s.busy ? \"busy\" : `idle ${Math.round((Date.now() - s.lastActiveAt) / 60000)}m`;\n const metrics = s.messageCount ? ` | ${s.messageCount} msgs` : \"\";\n return `#${s.shortIndex} ${typeLabel(sessionType(s))}${owner}${nm}${remote}${bg}${model} \u2014 ${time}${paused}${marker} | ${idle}${metrics}`;\n }).join(\"\\n\");\n}\n", "/**\n * artifact-store.ts \u2014 S3-compatible artifact store with lazy SDK loading (#929).\n */\n\nimport { createReadStream, createWriteStream } from \"node:fs\";\nimport { pipeline } from \"node:stream/promises\";\nimport { execSync } from \"node:child_process\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { Readable } from \"node:stream\";\n\nconst LIB_DIR = join(process.env[\"ABTARS_HOME\"] ?? join(homedir(), \".abtars\"), \"lib\");\nconst localRequire = createRequire(join(LIB_DIR, \"node_modules\", \"_placeholder.js\"));\n\nlet _s3: any;\nlet _presigner: any;\n\nfunction loadSdk(): void {\n if (_s3) return;\n try {\n _s3 = localRequire(\"@aws-sdk/client-s3\");\n _presigner = localRequire(\"@aws-sdk/s3-request-presigner\");\n } catch {\n execSync(`npm install --prefix \"${LIB_DIR}\" @aws-sdk/client-s3 @aws-sdk/s3-request-presigner`, { stdio: \"pipe\" });\n _s3 = localRequire(\"@aws-sdk/client-s3\");\n _presigner = localRequire(\"@aws-sdk/s3-request-presigner\");\n }\n}\n\nfunction getClient(): any {\n const endpoint = process.env[\"ARTIFACT_S3_ENDPOINT\"];\n if (!endpoint) throw new Error(\"Artifact store not configured\");\n loadSdk();\n return new _s3.S3Client({\n endpoint,\n region: process.env[\"ARTIFACT_S3_REGION\"] || \"auto\",\n credentials: { accessKeyId: process.env[\"ARTIFACT_S3_KEY\"] ?? \"\", secretAccessKey: process.env[\"ARTIFACT_S3_SECRET\"] ?? \"\" },\n });\n}\n\nfunction bucket(): string {\n return process.env[\"ARTIFACT_S3_BUCKET\"] || \"abtars-artifacts\";\n}\n\nexport async function upload(localPath: string, remotePath: string): Promise<string> {\n const client = getClient();\n const stream = createReadStream(localPath);\n await client.send(new _s3.PutObjectCommand({ Bucket: bucket(), Key: remotePath, Body: stream }));\n return `${process.env[\"ARTIFACT_S3_ENDPOINT\"]}/${bucket()}/${remotePath}`;\n}\n\nexport async function download(remotePath: string, localPath: string): Promise<void> {\n const client = getClient();\n const resp = await client.send(new _s3.GetObjectCommand({ Bucket: bucket(), Key: remotePath }));\n await pipeline(resp.Body as Readable, createWriteStream(localPath));\n}\n\nexport async function presign(remotePath: string, expiresIn = 3600): Promise<string> {\n const client = getClient();\n const cmd = new _s3.GetObjectCommand({ Bucket: bucket(), Key: remotePath });\n return _presigner.getSignedUrl(client, cmd, { expiresIn });\n}\n\nexport async function exists(remotePath: string): Promise<boolean> {\n const client = getClient();\n try {\n await client.send(new _s3.HeadObjectCommand({ Bucket: bucket(), Key: remotePath }));\n return true;\n } catch { return false; }\n}\n\nexport async function remove(remotePath: string): Promise<void> {\n const client = getClient();\n await client.send(new _s3.DeleteObjectCommand({ Bucket: bucket(), Key: remotePath }));\n}\n", "/**\n * artifact-tools.ts \u2014 Agent tools for S3 artifact store (#929) + inline transfer (#928).\n */\n\nimport type { ToolDefinition } from \"./tool-registry.js\";\nimport { upload, download } from \"../artifact-store.js\";\nimport { readFileSync, statSync } from \"node:fs\";\nimport { basename } from \"node:path\";\n\n// \u2500\u2500 Inline artifact queue (#928) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface InlineArtifact { name: string; content: string }\n\nconst pendingArtifacts = new Map<number, InlineArtifact[]>();\n\nconst MAX_FILE_BYTES = 1_000_000; // 1MB raw\n\nexport function drainArtifacts(cardId: number): InlineArtifact[] | undefined {\n const arts = pendingArtifacts.get(cardId);\n if (arts) pendingArtifacts.delete(cardId);\n return arts;\n}\n\nexport const artifactAttachTool: ToolDefinition = {\n name: \"artifact_attach\",\n description: \"Attach a local file to the task result. The file is base64-encoded and sent back to the delegating peer on task completion. Max 1MB per file.\",\n parameters: {\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Absolute path to the file to attach\" },\n card_id: { type: \"number\", description: \"Current card ID (from environment)\" },\n },\n required: [\"path\", \"card_id\"],\n },\n async execute(args): Promise<string> {\n const filePath = args[\"path\"];\n const cardId = parseInt(args[\"card_id\"] ?? \"0\", 10);\n if (!filePath) return JSON.stringify({ error: \"path is required\" });\n if (!cardId) return JSON.stringify({ error: \"card_id is required\" });\n\n try {\n const stat = statSync(filePath);\n if (stat.size > MAX_FILE_BYTES) {\n return JSON.stringify({ error: `File too large: ${stat.size} bytes (max ${MAX_FILE_BYTES})` });\n }\n const content = readFileSync(filePath).toString(\"base64\");\n const name = basename(filePath);\n const list = pendingArtifacts.get(cardId) ?? [];\n list.push({ name, content });\n pendingArtifacts.set(cardId, list);\n return JSON.stringify({ ok: true, name, size: stat.size, queued: list.length });\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n },\n};\n\nexport const artifactPushTool: ToolDefinition = {\n name: \"artifact_push\",\n description: \"Upload a local file to the shared artifact store (S3). Returns the artifact URL.\",\n parameters: {\n type: \"object\",\n properties: {\n local_path: { type: \"string\", description: \"Absolute path to local file\" },\n remote_path: { type: \"string\", description: \"Remote key/path in the artifact store\" },\n },\n required: [\"local_path\", \"remote_path\"],\n },\n async execute(args): Promise<string> {\n try {\n const url = await upload(args[\"local_path\"] ?? \"\", args[\"remote_path\"] ?? \"\");\n return JSON.stringify({ ok: true, url });\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n },\n};\n\nexport const artifactPullTool: ToolDefinition = {\n name: \"artifact_pull\",\n description: \"Download a file from the shared artifact store (S3) to a local path.\",\n parameters: {\n type: \"object\",\n properties: {\n remote_path: { type: \"string\", description: \"Remote key/path in the artifact store\" },\n local_path: { type: \"string\", description: \"Absolute local path to save the file\" },\n },\n required: [\"remote_path\", \"local_path\"],\n },\n async execute(args): Promise<string> {\n try {\n await download(args[\"remote_path\"] ?? \"\", args[\"local_path\"] ?? \"\");\n return JSON.stringify({ ok: true, path: args[\"local_path\"] });\n } catch (err) {\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n }\n },\n};\n", "/**\n * spin.ts \u2014 Unified session router (#943, #953).\n * Single flat Map<sessionId, ManagedSession>. No bucketing. No PlatformState.\n */\n\nimport { logInfo, logWarn } from \"./logger.js\";\nimport { logAndSwallow } from \"./log-and-swallow.js\";\nimport { kanbanEnqueue, kanbanRunning, kanbanComplete, kanbanFail, kanbanRetryOrFail, kanbanList, kanbanGetCard, isUnblocked } from \"./tasks/kanban-board.js\";\nimport type { SubagentRuntime, AgentSession } from \"./subagent-runtime.js\";\nimport type { IKiroTransport } from \"./transport/kiro-transport.js\";\nimport { loadUsers } from \"./user-registry.js\";\nimport { getMasterUserId } from \"./master-user.js\";\nimport type { ManagedSession, SpinRequest, SessionType } from \"./spin-types.js\";\nimport { typeAgent, sessionType } from \"./spin-types.js\";\nimport * as Sessions from \"./spin-sessions.js\";\nimport { pushLog, isHollow } from \"./spin-sessions.js\";\n\nexport type { ManagedSession, SpinRequest, SessionType } from \"./spin-types.js\";\nexport { sessionType, sessionCreatedAt, typeLabel, typeAgent, parseSessionType } from \"./spin-types.js\";\nexport { isHollow };\n\nconst TAG = \"spin\";\nconst USER_SESSION_IDLE_MS = parseInt(process.env[\"USER_SESSION_IDLE_MS\"] ?? \"7200000\", 10);\nconst GUEST_SESSION_IDLE_MS = parseInt(process.env[\"GUEST_SESSION_IDLE_MS\"] ?? \"1800000\", 10);\nconst MAX_TOTAL_SESSIONS = parseInt(process.env[\"MAX_TOTAL_SESSIONS\"] ?? \"12\", 10);\nconst SESSION_CREATE_TIMEOUT_MS = 30_000;\nconst DEFAULT_TIMEOUT_MS = 30 * 60_000;\n\nconst MAX_CONCURRENT: Partial<Record<SessionType, number>> = {\n T: 1, O: 1, B: 1, D: 1, H: 1, W: 3,\n};\n\nexport class Spin {\n private sessions = new Map<string, ManagedSession>();\n private nextIndex = 0;\n private running = new Map<SessionType, Set<number>>();\n private runtime: SubagentRuntime | null = null;\n private memory: { recordMessage(opts: { role: string; content: string; timestamp: number; userId: string; sessionId: string }): void } | null = null;\n private orcSession: AgentSession | null = null;\n private _lastHealerDoneAt = 0;\n private _housekeepCounter = 0;\n\n setRuntime(runtime: SubagentRuntime): void { this.runtime = runtime; }\n setMemory(memory: Spin[\"memory\"]): void { this.memory = memory; }\n\n // \u2500\u2500 Session CRUD \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getActiveSession(userId: string, platform: string): ManagedSession {\n let s = Sessions.getActiveSession(this.sessions, userId, platform);\n if (!s) {\n // Auto-create initial Main session\n const r = Sessions.allocateSession(this.sessions, this.nextIndex, \"A\", userId, platform, 0, { active: true });\n this.nextIndex = r.nextIndex;\n s = r.session;\n }\n return s;\n }\n\n getActiveSessionId(userId: string, platform: string): string {\n return this.getActiveSession(userId, platform).id;\n }\n\n createSession(userId: string, platform: string, type: SessionType): ManagedSession | string {\n // Ensure a Main session exists before creating additional ones\n this.getActiveSession(userId, platform);\n const r = Sessions.createSession(this.sessions, this.nextIndex, userId, platform, type, 0, MAX_TOTAL_SESSIONS);\n if (typeof r === \"string\") return r;\n this.nextIndex = r.nextIndex;\n return r.session;\n }\n\n createSubSession(userId: string, platform: string, type: SessionType): ManagedSession | string {\n const r = Sessions.createSubSession(this.sessions, this.nextIndex, userId, platform, type, 0, MAX_TOTAL_SESSIONS);\n if (typeof r === \"string\") return r;\n this.nextIndex = r.nextIndex;\n return r.session;\n }\n\n createHollowSession(userId: string, platform: string, type: SessionType, peer: string, remoteSessionId: string): ManagedSession | string {\n const r = Sessions.createHollowSession(this.sessions, this.nextIndex, userId, platform, type, 0, peer, remoteSessionId, MAX_TOTAL_SESSIONS);\n if (typeof r === \"string\") return r;\n this.nextIndex = r.nextIndex;\n return r.session;\n }\n\n switchSession(userId: string, platform: string, index: number): ManagedSession | string {\n return Sessions.switchSession(this.sessions, userId, platform, index);\n }\n\n endSession(userId: string, platform: string, index?: number): ManagedSession | string {\n const r = Sessions.endSession(this.sessions, this.nextIndex, userId, platform, index);\n if (typeof r === \"string\") return r;\n this.nextIndex = r.nextIndex;\n return r.ended;\n }\n\n killSession(userId: string, platform: string, index: number): ManagedSession | string {\n const r = Sessions.killSession(this.sessions, this.nextIndex, userId, platform, index);\n if (typeof r === \"string\") return r;\n this.nextIndex = r.nextIndex;\n return r.killed;\n }\n\n pauseSession(userId: string, platform: string, index?: number): ManagedSession | string {\n return Sessions.pauseSession(this.sessions, userId, platform, index);\n }\n\n resumeSession(userId: string, platform: string, index?: number): ManagedSession | string {\n return Sessions.resumeSession(this.sessions, userId, platform, index);\n }\n\n listSessions(userId: string, platform: string): { sessions: ManagedSession[]; activeIndex: number } {\n const list = Sessions.listSessions(this.sessions, userId, platform);\n const active = list.find(s => s.active);\n return { sessions: list, activeIndex: active?.shortIndex ?? 0 };\n }\n\n listAllSessions(): ManagedSession[] {\n return Sessions.listAllSessions(this.sessions);\n }\n\n getSessionById(sessionId: string): ManagedSession | undefined {\n return this.sessions.get(sessionId);\n }\n\n formatList(userId: string, platform: string, showAll = false): string {\n return Sessions.formatList(this.sessions, userId, platform, showAll);\n }\n\n clearAll(): void { this.sessions.clear(); this.nextIndex = 0; }\n\n // \u2500\u2500 Interactive session lifecycle \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n private _greetingSent = false;\n private _greetingAdapter: { injectMessage: (msg: any) => void } | null = null;\n\n registerMasterSession(opts: { userId: string; chatId: number; platform: string; transport: IKiroTransport }): void {\n const session = this.getActiveSession(opts.userId, opts.platform);\n session.transport = opts.transport;\n session.delivery = \"streaming\";\n session.idleTimeoutMs = Infinity;\n session.chatId = opts.chatId;\n session.status = \"ready\";\n session.lastActiveAt = Date.now();\n const t = opts.transport as any;\n session.pid = t?._rawClient?.pid ?? t?.agent?.pid ?? undefined;\n pushLog(session, \"master transport attached\");\n logInfo(TAG, `Master session registered: ${opts.userId} (${opts.platform}:${opts.chatId}${session.pid ? ` pid=${session.pid}` : \"\"})`);\n\n // #980: Fire greeting once adapter is set (deferred via setGreetingAdapter)\n this._masterOpts = { userId: opts.userId, chatId: opts.chatId, platform: opts.platform };\n this.tryFireGreeting();\n }\n\n /** Set the adapter for boot greeting. Called after platforms are up. */\n setGreetingAdapter(adapter: { injectMessage: (msg: any) => void }): void {\n this._greetingAdapter = adapter;\n this.tryFireGreeting();\n }\n\n private _masterOpts: { userId: string; chatId: number; platform: string } | null = null;\n\n private tryFireGreeting(): void {\n if (this._greetingSent || !this._greetingAdapter || !this._masterOpts) return;\n this._greetingSent = true;\n const { userId, chatId, platform } = this._masterOpts;\n const session = this.getActiveSession(userId, platform);\n this.greetSession(session, chatId, userId);\n }\n\n /** Inject a greeting into an interactive session (A/C only). */\n greetSession(session: ManagedSession, chatId: number, userId: string, adapter?: { injectMessage: (msg: any) => void }): void {\n const type = sessionType(session);\n if (type !== \"A\" && type !== \"C\") return;\n if (session.messageCount > 0) return;\n const a = adapter ?? this._greetingAdapter;\n if (!a) return;\n\n let attempt = 0;\n const inject = (): void => {\n attempt++;\n a.injectMessage({\n platform: session.platform,\n channelId: String(chatId),\n userId,\n senderId: String(chatId),\n senderName: userId,\n text: \"[SESSION START] You just came online. Greet the user.\",\n timestamp: Date.now(),\n isGroup: false,\n isVoice: false,\n });\n setTimeout(() => {\n if (session.messageCount > 0) return;\n if (session.busy) return;\n if (attempt >= 3) { logWarn(TAG, \"Greeting failed after 3 attempts\"); return; }\n logWarn(TAG, `Greeting attempt ${attempt}/3 \u2014 no response, retrying`);\n inject();\n }, 60_000);\n };\n\n if (session.transport?.isReady) {\n inject();\n } else if (session.transport) {\n session.transport.onReady = () => inject();\n }\n }\n\n async resolveSession(userId: string, platform: string, chatId: number): Promise<ManagedSession> {\n const session = this.getActiveSession(userId, platform);\n\n if (session.transport) {\n session.lastActiveAt = Date.now();\n return session;\n }\n if (session.status === \"ended\") throw new Error(\"Session ended \u2014 use /session new\");\n\n const total = this.listAllSessions().filter(s => s.transport).length;\n if (total >= MAX_TOTAL_SESSIONS) throw new Error(\"System busy, try again in a few minutes.\");\n\n session.status = \"creating\";\n session.chatId = chatId;\n const registry = loadUsers();\n const user = registry.byUserId.get(userId);\n const role = user?.role ?? \"guest\";\n session.idleTimeoutMs = role === \"master\" ? Infinity : role === \"guest\" ? GUEST_SESSION_IDLE_MS : USER_SESSION_IDLE_MS;\n session.delivery = role === \"master\" ? \"streaming\" : \"simple\";\n\n pushLog(session, `creating transport (${role})`);\n logInfo(TAG, `Creating transport for ${userId} (${role})`);\n\n try {\n const agentSession = await Promise.race([\n this.runtime!.session(\"professor\", userId),\n new Promise<never>((_, rej) => setTimeout(() => rej(new Error(\"Session creation timed out\")), SESSION_CREATE_TIMEOUT_MS)),\n ]);\n session.transport = agentSession.transport!;\n session.status = \"ready\";\n session.lastActiveAt = Date.now();\n const t = session.transport as any;\n session.pid = t?._rawClient?.pid ?? t?.agent?.pid ?? undefined;\n pushLog(session, \"transport ready\");\n logInfo(TAG, `Session ready: ${userId} id=${session.id}${session.pid ? ` pid=${session.pid}` : \"\"}`);\n return session;\n } catch (err) {\n session.status = \"ended\";\n pushLog(session, `error: ${err instanceof Error ? err.message : String(err)}`);\n logWarn(TAG, `Session creation failed for ${userId}: ${err instanceof Error ? err.message : String(err)}`);\n throw err;\n }\n }\n\n destroySession(userId: string, sessionId?: string): void {\n for (const s of this.sessions.values()) {\n if (s.userId !== userId) continue;\n if (sessionId && s.id !== sessionId) continue;\n if (s.idleTimeoutMs === Infinity) continue;\n if (s.transport) { try { s.transport.destroy(); } catch {} s.transport = undefined; }\n s.status = \"ended\";\n s.active = false;\n pushLog(s, \"destroyed\");\n logInfo(TAG, `Session destroyed: ${userId} id=${s.id}`);\n }\n }\n\n destroyAll(): void {\n for (const s of this.sessions.values()) {\n if (s.transport) { try { s.transport.destroy(); } catch {} }\n }\n if (this.orcSession) { try { this.orcSession.destroy(); } catch {} this.orcSession = null; }\n this.sessions.clear();\n this.nextIndex = 0;\n logInfo(TAG, \"All sessions destroyed (shutdown)\");\n }\n\n // \u2500\u2500 inject() \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n async inject(userId: string, prompt: string, opts?: { deliver?: boolean }): Promise<string | null> {\n const registry = loadUsers();\n const user = registry.byUserId.get(userId);\n if (!user) { logWarn(TAG, `inject: unknown user ${userId}`); return null; }\n const chatId = user.platforms.telegram ?? user.platforms.discord;\n if (!chatId) { logWarn(TAG, `inject: no chatId for ${userId}`); return null; }\n const platform = user.platforms.telegram ? \"telegram\" : \"discord\";\n const numericChatId = typeof chatId === \"number\" ? chatId : parseInt(String(chatId), 10);\n\n try {\n const session = await this.resolveSession(userId, platform, numericChatId);\n if (!session.transport) { logWarn(TAG, `inject: no transport for ${userId}`); return null; }\n const response = await session.transport.sendPrompt(`${userId}:inject`, prompt, undefined, userId);\n session.messageCount++;\n pushLog(session, `inject (deliver=${opts?.deliver ?? true})`);\n logInfo(TAG, `inject delivered to ${userId} (${response.length} chars, deliver=${opts?.deliver ?? true})`);\n return (opts?.deliver ?? true) ? response : null;\n } catch (err) {\n logWarn(TAG, `inject failed for ${userId}: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n }\n\n async injectGreeting(userId: string, prompt: string): Promise<string | null> {\n if (!this._greetingAdapter) { logWarn(TAG, \"injectGreeting: no adapter\"); return null; }\n const registry = loadUsers();\n const user = registry.byUserId.get(userId);\n if (!user) { logWarn(TAG, `inject: unknown user ${userId}`); return null; }\n const chatId = user.platforms.telegram ?? user.platforms.discord;\n if (!chatId) { logWarn(TAG, `inject: no chatId for ${userId}`); return null; }\n const platform = user.platforms.telegram ? \"telegram\" : \"discord\";\n this._greetingAdapter.injectMessage({\n platform,\n channelId: String(chatId),\n userId,\n senderId: String(chatId),\n senderName: userId,\n text: prompt,\n timestamp: Date.now(),\n isGroup: false,\n isVoice: false,\n });\n logInfo(TAG, `injectGreeting: routed to pipeline for ${userId}`);\n return \"routed\";\n }\n\n // \u2500\u2500 Orc \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n getOrcSession(): AgentSession | null { return this.orcSession?.isReady ? this.orcSession : null; }\n\n async sendUserToOrc(message: string): Promise<string | null> {\n const orc = this.getOrcSession();\n if (!orc) return null;\n const response = await orc.sendPrompt(\"orc:user\", `[USER] ${message}`);\n return response;\n }\n\n private async getOrCreateOrc(): Promise<AgentSession> {\n if (this.orcSession?.isReady) return this.orcSession;\n logInfo(TAG, \"Spawning persistent Orc session\");\n this.orcSession = await this.runtime!.session(\"browsie\");\n return this.orcSession;\n }\n\n // \u2500\u2500 Dispatch \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /** #1010: O-type reuses existing session (one Orc). All others create new. */\n private getOrCreateVisibleSession(userId: string, type: SessionType): ManagedSession | undefined {\n if (type === \"O\") {\n for (const s of this.sessions.values()) {\n if (s.id.includes(\"_O_\") && s.status !== \"ended\") return s;\n }\n }\n const sub = this.createSubSession(userId, \"telegram\", type);\n return typeof sub === \"string\" ? undefined : sub;\n }\n\n dispatch(request: SpinRequest): { cardId: number; sessionId?: string } {\n const cardTitle = request.title ?? request.goal.slice(0, 80);\n const cardId = request.cardId ?? kanbanEnqueue(cardTitle, request.source, undefined, {\n priority: request.priority ?? \"MEDIUM\", type: request.type,\n parent_id: request.parentCardId, deliveryMode: request.deliveryMode,\n notes: request.callbackPeer ? JSON.stringify({ callback_peer: request.callbackPeer }) : undefined,\n chatId: request.chatId, sourcePeer: request.sourcePeer,\n });\n\n if (!this.canDispatch(request.type, cardId)) {\n logInfo(TAG, `${request.type} card:${cardId} queued (concurrency gate)`);\n return { cardId };\n }\n\n this.markRunning(request.type, cardId);\n kanbanRunning(cardId);\n\n const masterUserId = getMasterUserId();\n const session = this.getOrCreateVisibleSession(masterUserId, request.type);\n if (session) { session.name = request.title?.slice(0, 20); pushLog(session, `dispatch card:${cardId}`); }\n\n const timeout = request.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n this.execute(request, cardId, timeout)\n .then(result => {\n const { drainArtifacts } = require(\"./transport/artifact-tools.js\") as typeof import(\"./transport/artifact-tools.js\");\n const artifacts = drainArtifacts(cardId);\n kanbanComplete(cardId, null, result.slice(0, 500));\n if (request.callbackPeer) {\n const card = kanbanGetCard(cardId);\n fireCallback(request.callbackPeer, cardId, \"done\", result.slice(0, 500), undefined, artifacts, card?.tokens_used ?? 0);\n }\n })\n .catch(err => {\n const msg = (err instanceof Error ? err.message : String(err)).slice(0, 1000);\n logWarn(TAG, `${request.type} card:${cardId} failed: ${msg}`);\n kanbanRetryOrFail(cardId, msg);\n if (request.callbackPeer) fireCallback(request.callbackPeer, cardId, \"failed\", undefined, msg);\n })\n .finally(() => {\n this.markDone(request.type, cardId);\n if (session) { session.status = \"ended\"; session.active = false; pushLog(session, \"completed\"); }\n this.drainQueued();\n });\n\n return { cardId, sessionId: session?.id };\n }\n\n async dispatchAwait(request: SpinRequest): Promise<{ cardId: number; result: string }> {\n // #987: enforce concurrency + cooldown gates (same as dispatch)\n if (!this.canDispatch(request.type, 0)) {\n throw new Error(`${request.type} session busy or in cooldown \u2014 skipping`);\n }\n\n const cardTitle = request.title ?? request.goal.slice(0, 80);\n const cardId = request.cardId ?? kanbanEnqueue(cardTitle, request.source, undefined, {\n priority: request.priority ?? \"MEDIUM\", type: request.type,\n parent_id: request.parentCardId, deliveryMode: request.deliveryMode,\n chatId: request.chatId,\n });\n\n this.markRunning(request.type, cardId);\n kanbanRunning(cardId);\n\n const masterUserId = getMasterUserId();\n const session = this.getOrCreateVisibleSession(masterUserId, request.type);\n if (session) { session.name = request.title?.slice(0, 20); pushLog(session, `dispatchAwait card:${cardId}`); }\n\n const timeout = request.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n try {\n const result = await this.execute(request, cardId, timeout);\n return { cardId, result };\n } finally {\n this.markDone(request.type, cardId);\n // O-type: session stays alive until Orc idle timeout (visible in /session)\n if (session && request.type !== \"O\") { session.status = \"ended\"; session.active = false; pushLog(session, \"completed\"); }\n this.drainQueued();\n }\n }\n\n spawnChild(parentCardId: number, request: Omit<SpinRequest, \"type\"> & { type?: SessionType }): number {\n if (request.type === \"O\") throw new Error(\"Cannot nest orchestrators\");\n return this.dispatch({ ...request, type: \"W\", parentCardId }).cardId;\n }\n\n // \u2500\u2500 Internal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n private drainQueued(): void {\n const queued = kanbanList(\"queued\");\n const now = new Date().toISOString();\n for (const card of queued) {\n // #897: respect retry backoff\n if ((card as any).next_retry_at && (card as any).next_retry_at > now) continue;\n // #677: respect DAG dependencies\n if (!isUnblocked(card)) continue;\n const type = (card.type as SessionType) ?? \"T\";\n if (this.canDispatch(type, card.id)) {\n this.dispatch({ type, goal: card.title, source: (card.source as SpinRequest[\"source\"]) ?? \"task\", cardId: card.id });\n }\n }\n }\n\n /** Periodic housekeeping \u2014 registered as HB task (#980). */\n async tick(): Promise<void> {\n this.drainQueued();\n this.checkStaleWorkers();\n await this.pollRemoteCards();\n this._housekeepCounter++;\n if (this._housekeepCounter % 72 === 0) {\n this.pruneSkillTrash();\n this.rotateAuditLog();\n }\n }\n\n private checkStaleWorkers(): void {\n const STALE_MS = parseInt(process.env[\"WORKER_STALE_MS\"] || \"300000\", 10);\n const now = Date.now();\n for (const [, cardIds] of this.running) {\n for (const cardId of cardIds) {\n const card = kanbanGetCard(cardId);\n if (!card || card.status !== \"running\") continue;\n const lastActivity = new Date(card.updated_at + \"Z\").getTime();\n if (now - lastActivity > STALE_MS) {\n logWarn(TAG, `Stale card ${cardId} (${Math.round((now - lastActivity) / 1000)}s no activity) \u2014 failing`);\n kanbanFail(cardId, \"stale \u2014 no activity\");\n }\n }\n }\n }\n\n /** #613: Prune .trash/ entries older than 7 days (~hourly). */\n private pruneSkillTrash(): void {\n const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;\n const { existsSync, readdirSync, rmSync, statSync } = require(\"node:fs\") as typeof import(\"node:fs\");\n const { join } = require(\"node:path\") as typeof import(\"node:path\");\n const { abtarsHome } = require(\"../paths.js\") as typeof import(\"../paths.js\");\n const trashPath = join(abtarsHome(), \"skills\", \".trash\");\n if (!existsSync(trashPath)) return;\n const now = Date.now();\n for (const entry of readdirSync(trashPath)) {\n try {\n const full = join(trashPath, entry);\n const stat = statSync(full);\n if (now - stat.mtimeMs > SEVEN_DAYS_MS) {\n rmSync(full, { recursive: true });\n logInfo(\"skill-trash-prune\", `Pruned: ${entry}`);\n }\n } catch (err) { logAndSwallow(TAG, \"prune entry\", err); }\n }\n }\n\n /** #681: Rotate audit.jsonl when > 10MB, prune files older than 30 days (~hourly). */\n private rotateAuditLog(): void {\n const THIRTY_DAYS_MS = 30 * 24 * 60 * 60 * 1000;\n const { existsSync, statSync, renameSync, readdirSync, unlinkSync } = require(\"node:fs\") as typeof import(\"node:fs\");\n const { join } = require(\"node:path\") as typeof import(\"node:path\");\n const { abtarsHome } = require(\"../paths.js\") as typeof import(\"../paths.js\");\n const logsDir = join(abtarsHome(), \"logs\");\n const auditPath = join(logsDir, \"audit.jsonl\");\n if (!existsSync(auditPath)) return;\n try {\n const stat = statSync(auditPath);\n if (stat.size > 10 * 1024 * 1024) {\n const date = new Date().toISOString().slice(0, 10);\n renameSync(auditPath, join(logsDir, `audit-${date}.jsonl`));\n logInfo(\"audit-rotation\", `Rotated audit.jsonl (${(stat.size / 1024 / 1024).toFixed(1)}MB)`);\n }\n } catch (err) { logAndSwallow(TAG, \"audit rotate\", err); }\n const now = Date.now();\n try {\n for (const f of readdirSync(logsDir)) {\n if (!f.startsWith(\"audit-\") || !f.endsWith(\".jsonl\")) continue;\n const full = join(logsDir, f);\n const stat = statSync(full);\n if (now - stat.mtimeMs > THIRTY_DAYS_MS) {\n unlinkSync(full);\n logInfo(\"audit-rotation\", `Pruned: ${f}`);\n }\n }\n } catch (err) { logAndSwallow(TAG, \"audit prune\", err); }\n }\n\n private async pollRemoteCards(): Promise<void> {\n const remoteCards = kanbanList(\"running\", \"status\").filter(c => c.type === \"remote\");\n if (remoteCards.length === 0) return;\n const { getPeerTransport } = await import(\"./peer-transport/index.js\");\n const transport = getPeerTransport();\n const REMOTE_MAX_AGE_MS = 15 * 60 * 1000;\n for (const card of remoteCards) {\n try {\n const meta = JSON.parse(card.notes ?? \"{}\") as { peer?: string; remote_task_id?: number };\n if (!meta.peer || !meta.remote_task_id) continue;\n const cardAge = Date.now() - new Date(card.created_at + \"Z\").getTime();\n if (cardAge > REMOTE_MAX_AGE_MS) {\n kanbanFail(card.id, `remote task timeout (${Math.round(cardAge / 60000)}min)`);\n continue;\n }\n const result = await transport.checkTask(meta.peer, meta.remote_task_id);\n if (result.status === \"done\") kanbanComplete(card.id, null, result.result?.slice(0, 500) ?? \"completed\");\n else if (result.status === \"failed\") kanbanFail(card.id, result.error ?? \"remote task failed\");\n } catch {}\n }\n }\n\n private canDispatch(type: SessionType, _cardId: number): boolean {\n const max = MAX_CONCURRENT[type] ?? 5;\n if ((this.running.get(type)?.size ?? 0) >= max) return false;\n // #987: 2-min cooldown after H session ends\n if (type === \"H\" && Date.now() - this._lastHealerDoneAt < 120_000) return false;\n return true;\n }\n\n private markRunning(type: SessionType, cardId: number): void {\n if (!this.running.has(type)) this.running.set(type, new Set());\n this.running.get(type)!.add(cardId);\n }\n\n private markDone(type: SessionType, cardId: number): void {\n this.running.get(type)?.delete(cardId);\n if (type === \"H\") this._lastHealerDoneAt = Date.now();\n }\n\n private async execute(request: SpinRequest, cardId: number, timeoutMs: number): Promise<string> {\n if (!this.runtime) throw new Error(\"Spin: runtime not set\");\n if (request.type === \"O\") return this.executeOrc(request, cardId, timeoutMs);\n\n const agentName = request.agent ?? typeAgent(request.type);\n logInfo(TAG, `\u25B6 ${request.type} card:${cardId} agent=${agentName}`);\n\n const staleMs = parseInt(process.env[\"WORKER_STALE_MS\"] ?? \"300000\", 10);\n let lastActivityAt = Date.now();\n\n const timer = setTimeout(() => {\n logWarn(TAG, `\u23F1\uFE0F ${request.type} card:${cardId} timed out`);\n this.runtime?.interruptSpawn(`spin-${cardId}`);\n }, timeoutMs);\n\n const staleCheck = setInterval(() => {\n if (Date.now() - lastActivityAt > staleMs) {\n clearInterval(staleCheck);\n logWarn(TAG, `\u23F1\uFE0F ${request.type} card:${cardId} stale (no activity ${staleMs / 1000}s)`);\n this.runtime?.interruptSpawn(`spin-${cardId}`);\n }\n }, 60_000);\n\n try {\n const { buildSoulBundle } = await import(\"./soul-bundle.js\");\n const bundle = buildSoulBundle(request.type);\n let fullPrompt = bundle ? `${bundle}\\n\\n---\\n\\n${request.goal}` : request.goal;\n\n // #891: auto-inject channel messages for W/O sessions\n if (request.type === \"W\" || request.type === \"T\") {\n const { channelUnread } = await import(\"./tasks/kanban-channel.js\");\n const workerName = `Worker-${String(cardId).padStart(2, \"0\")}`;\n const parentCard = request.parentCardId ?? cardId;\n const msgs = channelUnread(parentCard, workerName);\n if (msgs.length > 0) {\n const lines = msgs.map(m => `[${m.from_agent}\u2192${m.to_agent}]${m.directive ? \" \u26A1\" : \"\"} ${m.message}`);\n fullPrompt = `[CHANNEL \u2014 ${msgs.length} message(s) for ${workerName}]\\n${lines.join(\"\\n\")}\\n[/CHANNEL]\\n\\n${fullPrompt}`;\n }\n }\n\n const result = (await this.runtime.complete(agentName, fullPrompt, { timeoutMs, session: \"fresh\" })) || \"(no output)\";\n if (this.memory) {\n const sid = `${request.type}_card${cardId}`;\n this.memory.recordMessage({ role: \"user\", content: request.goal, timestamp: Date.now(), userId: \"system\", sessionId: sid });\n this.memory.recordMessage({ role: \"assistant\", content: result, timestamp: Date.now(), userId: \"system\", sessionId: sid });\n }\n return result;\n } finally { clearTimeout(timer); clearInterval(staleCheck); }\n }\n\n private async executeOrc(request: SpinRequest, cardId: number, timeoutMs: number): Promise<string> {\n const { updateBridgeLockField } = await import(\"./transport/bridge-lock-transport.js\");\n const { setActiveOrcCard } = await import(\"./transport/orc-tools.js\");\n updateBridgeLockField(\"orc_active\", cardId);\n setActiveOrcCard(cardId);\n const orc = await this.getOrCreateOrc();\n logInfo(TAG, `\u25B6 O card:${cardId} (persistent Orc)`);\n\n // #993: Attach Orc transport to visible session \u2014 user can sneak in\n let orcSessionKey = \"orc:project\"; // fallback\n for (const [, s] of this.sessions) {\n if (s.id.includes(\"_O_\") && s.status !== \"ended\") {\n s.transport = orc.transport as any;\n s.status = \"ready\";\n orcSessionKey = s.id; // use proper ManagedSession ID as ACP session key\n break;\n }\n }\n const timer = setTimeout(() => { logWarn(TAG, `\u23F1\uFE0F O card:${cardId} timed out`); }, timeoutMs);\n try {\n const { buildSoulBundle } = await import(\"./soul-bundle.js\");\n const bundle = buildSoulBundle(\"O\");\n\n // #1005: CONTEXT wrapper (same pattern as Main)\n const { localDateTime } = await import(\"../utils/local-time.js\");\n const context = `[CONTEXT \u2014 do not respond to this section]\\n[PROJECT] card #${cardId}\\n[CURRENT TIME] ${localDateTime()}\\n[/CONTEXT]\\n\\n`;\n\n let fullPrompt = context + (bundle ? `${bundle}\\n\\n---\\n\\n${request.goal}` : request.goal);\n const { drainOrcNotifications } = await import(\"./spin-notifications.js\");\n const notifications = drainOrcNotifications(cardId);\n if (notifications.length) fullPrompt = notifications.join(\"\\n\") + \"\\n\\n\" + fullPrompt;\n\n // #891: Orc sees ALL channel messages on its card\n const { channelUnread } = await import(\"./tasks/kanban-channel.js\");\n const orcMsgs = channelUnread(cardId, \"Orc\");\n if (orcMsgs.length > 0) {\n const lines = orcMsgs.map(m => `[${m.from_agent}\u2192${m.to_agent}]${m.directive ? \" \u26A1\" : \"\"} ${m.message}`);\n fullPrompt = `[CHANNEL \u2014 ${orcMsgs.length} message(s)]\\n${lines.join(\"\\n\")}\\n[/CHANNEL]\\n\\n${fullPrompt}`;\n }\n\n const result = (await orc.sendPrompt(orcSessionKey, fullPrompt)) || \"(no output)\";\n if (this.memory) {\n this.memory.recordMessage({ role: \"user\", content: request.goal, timestamp: Date.now(), userId: \"system\", sessionId: orcSessionKey });\n this.memory.recordMessage({ role: \"assistant\", content: result, timestamp: Date.now(), userId: \"system\", sessionId: orcSessionKey });\n }\n return result;\n } finally { clearTimeout(timer); updateBridgeLockField(\"orc_active\", null); setActiveOrcCard(null); }\n }\n}\n\n/** #675: Fire result callback to the delegating peer. Fire-and-forget. */\nasync function fireCallback(peerName: string, taskId: number, status: \"done\" | \"failed\", result?: string, error?: string, artifacts?: Array<{ name: string; content: string }>, tokensUsed?: number): Promise<void> {\n try {\n const { getPeerTransport } = await import(\"./peer-transport/index.js\");\n const transport = getPeerTransport();\n const payload: Record<string, unknown> = { action: \"callback\", task_id: taskId, status, result_summary: result, error, tokens_used: tokensUsed ?? 0 };\n if (artifacts?.length) payload.artifacts = artifacts;\n await transport.send(peerName, { type: \"task\", payload });\n logInfo(TAG, `Callback fired to ${peerName} for card:${taskId} (${status})`);\n } catch (err) {\n logWarn(TAG, `Callback to ${peerName} failed (card:${taskId}): ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n\nexport const spin = new Spin();\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAAS,QAAQ,SAAyB,OAAqB;AACpE,UAAQ,IAAI,KAAK,IAAG,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,IAAI,EAAE,CAAC,IAAI,KAAK,EAAE;AACrE,MAAI,QAAQ,IAAI,SAAS,QAAS,SAAQ,IAAI,MAAM;AACtD;AAEO,SAAS,gBACd,UAAuC,WACvC,MAAmB,QAAgB,UAAkB,QACrD,MACgD;AAChD,QAAM,MAAM,YAAY;AACxB,QAAM,KAAK,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;AACvC,QAAM,UAA0B;AAAA,IAC9B,IAAI,GAAG,EAAE,IAAI,IAAI,IAAI,OAAO,GAAG,EAAE,SAAS,GAAG,GAAG,CAAC;AAAA,IACjD;AAAA,IAAQ;AAAA,IAAU;AAAA,IAClB,UAAU;AAAA,IACV,QAAQ,MAAM,UAAU;AAAA,IACxB,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,cAAc,KAAK,IAAI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,QAAQ;AACf,iBAAK,OAAO,cAAc,EAAE,MAAM,QAAQ,SAAS,QAAQ,MAAM,WAAW,KAAK,IAAI,GAAG,QAAQ,UAAU,WAAW,cAAc,CAAC;AACpI,iBAAK,OAAO,cAAc,EAAE,MAAM,aAAa,SAAS,QAAQ,WAAW,KAAK,IAAI,GAAG,QAAQ,UAAU,WAAW,cAAc,CAAC;AAAA,UACrI;AACA,iBAAO;AAAA,QACT,UAAE;AAAU,uBAAa,KAAK;AAAG,gCAAsB,cAAc,IAAI;AAAG,2BAAiB,IAAI;AAAA,QAAG;AAAA,MACtG;AAAA,IACF;AAgBO,IAAM,OAAO,IAAI,KAAK;AAAA;AAAA;",
6
+ "names": ["drainArtifacts", "statSync", "join"]
7
+ }
@@ -3,19 +3,19 @@
3
3
  import {
4
4
  init_spin,
5
5
  spin
6
- } from "./chunk-GCFIK6OB.js";
6
+ } from "./chunk-AO32N2VB.js";
7
7
  import {
8
8
  addCompletion
9
9
  } from "./chunk-MV6CJFWR.js";
10
10
  import {
11
11
  getEnv,
12
12
  init_env_schema
13
- } from "./chunk-SSCGWDIC.js";
13
+ } from "./chunk-65VCEC32.js";
14
14
  import {
15
15
  init_logger,
16
16
  logInfo,
17
17
  logWarn
18
- } from "./chunk-OOKNHOCB.js";
18
+ } from "./chunk-GWILHZPT.js";
19
19
 
20
20
  // src/components/transport/delegation-tools.ts
21
21
  init_spin();
@@ -56,7 +56,7 @@ var spawnSessionTool = {
56
56
  if (running.length >= MAX_BACKGROUND) {
57
57
  return JSON.stringify({ error: `Max ${MAX_BACKGROUND} concurrent background sessions. Wait for one to finish or terminate it.` });
58
58
  }
59
- const masterUid = (await import("./master-user-Z4M7KCJE.js")).getMasterUserId();
59
+ const masterUid = (await import("./master-user-HSKM4ZFN.js")).getMasterUserId();
60
60
  const session = spin.createSubSession(masterUid, "telegram", typeInfo.sessionType);
61
61
  if (typeof session === "string") return JSON.stringify({ error: session });
62
62
  const goal = args.goal ?? "No goal specified";
@@ -216,4 +216,4 @@ export {
216
216
  consumePendingInstruction,
217
217
  getDelegationTools
218
218
  };
219
- //# sourceMappingURL=chunk-N5VROZ7A.js.map
219
+ //# sourceMappingURL=chunk-B6ZN6COK.js.map