abtars 0.3.4-alpha.7 → 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 (348) hide show
  1. package/bundle/{_registry.generated-WGR4WOPT.js → _registry.generated-AVR7DK2A.js} +17 -14
  2. package/bundle/{_registry.generated-WGR4WOPT.js.map → _registry.generated-AVR7DK2A.js.map} +1 -1
  3. package/bundle/{abmind-lazy-7Z44NODV.js → abmind-lazy-E3YCFKQ5.js} +15 -5
  4. package/bundle/abtars-browser.js +4 -4
  5. package/bundle/abtars-cli.js +23 -13
  6. package/bundle/abtars-cli.js.map +2 -2
  7. package/bundle/abtars-restart.js +3 -3
  8. package/bundle/abtars-task.js +3 -3
  9. package/bundle/abtars-task.js.map +2 -2
  10. package/bundle/abtars.js +610 -455
  11. package/bundle/abtars.js.map +4 -4
  12. package/bundle/{acp-raw-client-E6FM45NC.js → acp-raw-client-UCNK3OTU.js} +2 -2
  13. package/bundle/{action-gate-G2V47NHW.js → action-gate-V4FCBHFB.js} +2 -2
  14. package/bundle/{agent-api-adapter-YAHKQMMZ.js → agent-api-adapter-7HEPYSIN.js} +3 -3
  15. package/bundle/{agent-api-rate-limit-WCFXJMGY.js → agent-api-rate-limit-RZSAM3SW.js} +4 -4
  16. package/bundle/{agent-registry-GI6CLT3Z.js → agent-registry-46A2R5KP.js} +7 -7
  17. package/bundle/{bootstrap-X2QYIZIJ.js → bootstrap-MIHJJSWU.js} +2 -2
  18. package/bundle/{bridge-lock-transport-4ZH7QTJP.js → bridge-lock-transport-7RSN7OLJ.js} +4 -4
  19. package/bundle/{browser-DMARZJIN.js → browser-F6BCWJWW.js} +6 -6
  20. package/bundle/{budget-45QOBDWA.js → budget-WUM3SPKW.js} +3 -3
  21. package/bundle/{capability-JFWX3IQF.js → capability-QVRKGRFC.js} +5 -5
  22. package/bundle/{chunk-YSKCQH6E.js → chunk-2IYJ4I66.js} +2 -2
  23. package/bundle/{chunk-KTYGKPYM.js → chunk-2NLUT5S2.js} +6 -6
  24. package/bundle/chunk-3BG3AIDP.js +191 -0
  25. package/bundle/chunk-3BG3AIDP.js.map +7 -0
  26. package/bundle/{chunk-OKAQICWY.js → chunk-3GQX34S2.js} +3 -3
  27. package/bundle/{chunk-QROWBWLL.js → chunk-3XZ773BS.js} +2 -2
  28. package/bundle/{chunk-DYBW4XXL.js → chunk-467SRLLR.js} +2 -2
  29. package/bundle/{chunk-LGP6TYFI.js → chunk-4AILRHUI.js} +97 -8
  30. package/bundle/chunk-4AILRHUI.js.map +7 -0
  31. package/bundle/{chunk-GPZNXY2U.js → chunk-4S3H4OK7.js} +4 -4
  32. package/bundle/{chunk-NDCRWEEJ.js → chunk-4Y5MJQRE.js} +6 -6
  33. package/bundle/{chunk-FRKW6LWB.js → chunk-55UWKI5C.js} +3 -3
  34. package/bundle/{chunk-4UL3KINB.js → chunk-5PNJFDSW.js} +8 -8
  35. package/bundle/{chunk-LUNA6PM5.js → chunk-5RVOEFGT.js} +4 -2
  36. package/bundle/{chunk-LUNA6PM5.js.map → chunk-5RVOEFGT.js.map} +2 -2
  37. package/bundle/{chunk-OXTSWQCX.js → chunk-5Y3FJ2Y7.js} +2 -2
  38. package/bundle/{chunk-TMUYFERL.js → chunk-6B5ZFUPD.js} +2 -2
  39. package/bundle/{chunk-65VCEC32.js → chunk-6PA5JBUU.js} +2 -2
  40. package/bundle/chunk-BNXV7SZI.js +195 -0
  41. package/bundle/chunk-BNXV7SZI.js.map +7 -0
  42. package/bundle/{chunk-AFREM7FX.js → chunk-CK7YTA2F.js} +2 -2
  43. package/bundle/{chunk-NRUSRJXR.js → chunk-DZJ5QZFD.js} +2 -2
  44. package/bundle/{chunk-YRSMGJFP.js → chunk-E67KESEG.js} +2 -2
  45. package/bundle/{chunk-ZV4IWKDJ.js → chunk-E7XD5UGB.js} +3 -3
  46. package/bundle/{chunk-GXL7HJPT.js → chunk-EAX5ZZUL.js} +63 -39
  47. package/bundle/chunk-EAX5ZZUL.js.map +7 -0
  48. package/bundle/{chunk-PEDX56EL.js → chunk-EFGBM555.js} +2 -2
  49. package/bundle/{chunk-EQSG2CRM.js → chunk-FGYDIX54.js} +22 -15
  50. package/bundle/chunk-FGYDIX54.js.map +7 -0
  51. package/bundle/{chunk-XWRADSXO.js → chunk-GF6NVNA7.js} +15 -5
  52. package/bundle/chunk-GF6NVNA7.js.map +7 -0
  53. package/bundle/{chunk-SIFPBTI4.js → chunk-HGSHCQ5F.js} +113 -73
  54. package/bundle/chunk-HGSHCQ5F.js.map +7 -0
  55. package/bundle/{chunk-YRU2K3O6.js → chunk-IMIGG5EO.js} +39 -39
  56. package/bundle/chunk-IMIGG5EO.js.map +7 -0
  57. package/bundle/{chunk-W4EA4GCA.js → chunk-ITOFPJAV.js} +43 -31
  58. package/bundle/chunk-ITOFPJAV.js.map +7 -0
  59. package/bundle/{chunk-UPRZDU6T.js → chunk-IY6UKLPS.js} +3 -3
  60. package/bundle/{chunk-EUZDKV3C.js → chunk-J4RUFAPK.js} +3 -3
  61. package/bundle/{chunk-HZDLFLRP.js → chunk-J7DRPVMU.js} +35 -5
  62. package/bundle/chunk-J7DRPVMU.js.map +7 -0
  63. package/bundle/{chunk-EGL6UMAO.js → chunk-JG4BKXBN.js} +7 -1
  64. package/bundle/chunk-JG4BKXBN.js.map +7 -0
  65. package/bundle/{chunk-5B5B6EHL.js → chunk-JLWYPGWI.js} +5 -5
  66. package/bundle/{chunk-5QUTMUIK.js → chunk-JXYWDAHD.js} +12 -12
  67. package/bundle/{chunk-GRVWZO4C.js → chunk-KOSFXW2S.js} +24 -3
  68. package/bundle/{chunk-GRVWZO4C.js.map → chunk-KOSFXW2S.js.map} +1 -1
  69. package/bundle/{chunk-ONBF5DDU.js → chunk-L72RIPEC.js} +248 -182
  70. package/bundle/chunk-L72RIPEC.js.map +7 -0
  71. package/bundle/{chunk-TEFZ4JA4.js → chunk-NHPLD3C7.js} +2 -2
  72. package/bundle/{chunk-2KC5G3EA.js → chunk-OWUO5RS3.js} +5 -5
  73. package/bundle/{chunk-4MULJ5SS.js → chunk-OY4Q6AMY.js} +71 -49
  74. package/bundle/chunk-OY4Q6AMY.js.map +7 -0
  75. package/bundle/{chunk-WBTJ2E62.js → chunk-P3NODAHF.js} +2 -5
  76. package/bundle/{chunk-WBTJ2E62.js.map → chunk-P3NODAHF.js.map} +2 -2
  77. package/bundle/{chunk-BROFMHC2.js → chunk-PB5GF4FG.js} +334 -237
  78. package/bundle/chunk-PB5GF4FG.js.map +7 -0
  79. package/bundle/{chunk-WYHGNI56.js → chunk-PMD5BLFS.js} +6 -6
  80. package/bundle/{chunk-URQPDCK5.js → chunk-Q66LQMMZ.js} +3 -3
  81. package/bundle/{chunk-HKRSMUXJ.js → chunk-SC2Y5NR2.js} +71 -132
  82. package/bundle/chunk-SC2Y5NR2.js.map +7 -0
  83. package/bundle/chunk-SFL4EPCZ.js +555 -0
  84. package/bundle/chunk-SFL4EPCZ.js.map +7 -0
  85. package/bundle/{chunk-LDUOOKQY.js → chunk-SJPUNDZ3.js} +5 -5
  86. package/bundle/{chunk-LDUOOKQY.js.map → chunk-SJPUNDZ3.js.map} +1 -1
  87. package/bundle/{chunk-JQDJPUHM.js → chunk-TWB2ZGVH.js} +2 -2
  88. package/bundle/{chunk-IJT4KWXT.js → chunk-U4U47YE7.js} +2 -2
  89. package/bundle/{chunk-2FAZIA37.js → chunk-W546CU3A.js} +3 -3
  90. package/bundle/chunk-WC5O5KOE.js +211 -0
  91. package/bundle/chunk-WC5O5KOE.js.map +7 -0
  92. package/bundle/{chunk-JNIHEDKF.js → chunk-XPWYDNWL.js} +2 -2
  93. package/bundle/{chunk-GWILHZPT.js → chunk-XRTXYN66.js} +10 -7
  94. package/bundle/{chunk-GWILHZPT.js.map → chunk-XRTXYN66.js.map} +2 -2
  95. package/bundle/{chunk-EFJVUJBE.js → chunk-Y5FEFKGM.js} +6 -6
  96. package/bundle/chunk-YJZE4OK3.js +169 -0
  97. package/bundle/chunk-YJZE4OK3.js.map +7 -0
  98. package/bundle/{chunk-GVM5YU5I.js → chunk-Z4FZPB42.js} +2 -2
  99. package/bundle/{chunk-7BSQ5UQO.js → chunk-ZSIDQ66D.js} +3 -3
  100. package/bundle/{chunk-XX6BGTPO.js → chunk-ZZZCJJEO.js} +4 -4
  101. package/bundle/{commands-XYEGVUZF.js → commands-2ZW6CMLC.js} +17 -16
  102. package/bundle/{config-M3P5IOAI.js → config-YMY5YHKN.js} +6 -6
  103. package/bundle/{context-2RJHC2LE.js → context-CL2RSLII.js} +7 -5
  104. package/bundle/context-CL2RSLII.js.map +7 -0
  105. package/bundle/{daemon-TB23FFWY.js → daemon-D7SU63OY.js} +3 -3
  106. package/bundle/{delegation-tools-QKNYQGTQ.js → delegation-tools-WS7Z56KZ.js} +12 -12
  107. package/bundle/{deploy-EPDWNHJU.js → deploy-AMTVKIMU.js} +2 -2
  108. package/bundle/{deps-WVK553KF.js → deps-T63AVJKJ.js} +3 -3
  109. package/bundle/{direct-api-transport-E3LNDBJT.js → direct-api-transport-QNNY2WWP.js} +56 -33
  110. package/bundle/direct-api-transport-QNNY2WWP.js.map +7 -0
  111. package/bundle/{discord-adapter-IT3KP3VB.js → discord-adapter-ABAD56Y2.js} +21 -20
  112. package/bundle/{discord-adapter-IT3KP3VB.js.map → discord-adapter-ABAD56Y2.js.map} +1 -1
  113. package/bundle/{dns-wakeup-IDOJIXBX.js → dns-wakeup-V3LEFXPE.js} +9 -33
  114. package/bundle/dns-wakeup-V3LEFXPE.js.map +7 -0
  115. package/bundle/{doctor-probes-B54JFIW3.js → doctor-probes-O6YI6XSZ.js} +6 -2
  116. package/bundle/{env-schema-4JXQUOH4.js → env-schema-B5RB32DC.js} +3 -3
  117. package/bundle/{gossip-3C3BSNPN.js → gossip-SKRCPOBS.js} +9 -5
  118. package/bundle/{guardrails-DL7ZSWVN.js → guardrails-64GQ5Y5K.js} +4 -4
  119. package/bundle/{heartbeat-system-MVTRS4GP.js → heartbeat-system-X4MUTKJD.js} +6 -6
  120. package/bundle/{heartbeat-tier3-ABWL3P7M.js → heartbeat-tier3-2PTPWEQQ.js} +53 -76
  121. package/bundle/heartbeat-tier3-2PTPWEQQ.js.map +7 -0
  122. package/bundle/{hook-system-M3POLUIB.js → hook-system-YB635OC4.js} +3 -3
  123. package/bundle/{hotskills-FWX4QI7V.js → hotskills-Q75D2DK3.js} +5 -5
  124. package/bundle/{install-OS3CU7NF.js → install-RFKKFSGS.js} +17 -30
  125. package/bundle/install-RFKKFSGS.js.map +7 -0
  126. package/bundle/{install-manifest-5PPWMD2W.js → install-manifest-J7ICPCJN.js} +2 -2
  127. package/bundle/{irc-adapter-PTTZD32W.js → irc-adapter-TVEV4R6H.js} +3 -3
  128. package/bundle/{irc-config-CP7ZMUOX.js → irc-config-M676FOFI.js} +4 -4
  129. package/bundle/{kanban-board-M326B2XJ.js → kanban-board-DLEJUCNN.js} +9 -7
  130. package/bundle/{kanban-channel-IJ52OMNA.js → kanban-channel-XOLUHJZJ.js} +6 -6
  131. package/bundle/kanban-delivery-C4QPBNPX.js +45 -0
  132. package/bundle/kanban-delivery-C4QPBNPX.js.map +7 -0
  133. package/bundle/{lazy-require-KCRVT4SI.js → lazy-require-JKQSALXN.js} +3 -3
  134. package/bundle/{logger-OWCSNYCA.js → logger-3EGHBD4R.js} +2 -2
  135. package/bundle/{main-chat-ZNUZCTNS.js → main-chat-3H63REKK.js} +4 -4
  136. package/bundle/{master-user-HSKM4ZFN.js → master-user-MUBUP3KD.js} +5 -5
  137. package/bundle/{media-utils-3ZYOD7SK.js → media-utils-HUUIALAJ.js} +3 -3
  138. package/bundle/{message-pipeline-P5GAQU4Z.js → message-pipeline-GRDRWONR.js} +17 -16
  139. package/bundle/meta.json +3699 -3138
  140. package/bundle/{metrics-collector-L3VPEHII.js → metrics-collector-YMUGY3PI.js} +31 -2
  141. package/bundle/metrics-collector-YMUGY3PI.js.map +7 -0
  142. package/bundle/{model-health-registry-MLEIZSTV.js → model-health-registry-QADMFQFQ.js} +2 -2
  143. package/bundle/{nerve-IGSXBKZZ.js → nerve-QPAEBRKX.js} +3 -3
  144. package/bundle/{notification-BFSIEECG.js → notification-3JICGXWU.js} +6 -6
  145. package/bundle/{openrouter-credits-NTVZDRYM.js → openrouter-credits-7NEIPYJN.js} +3 -3
  146. package/bundle/{orc-tools-4CHEFWSN.js → orc-tools-UZVPONKY.js} +5 -3
  147. package/bundle/{peer-auth-QC4EF2PM.js → peer-auth-RI43DKJE.js} +24 -15
  148. package/bundle/{peer-client-RGEU5HOK.js → peer-client-UITTMWJ2.js} +34 -29
  149. package/bundle/peer-client-UITTMWJ2.js.map +7 -0
  150. package/bundle/{peer-config-TN55LFDC.js → peer-config-URM7DCW6.js} +9 -4
  151. package/bundle/{peer-transport-I6JPLFZ2.js → peer-transport-SI7I72DB.js} +12 -10
  152. package/bundle/{phase-transport-PGKU2KD4.js → phase-transport-ESWWACZI.js} +17 -17
  153. package/bundle/{reconcile-CTFCLQRN.js → reconcile-GFDQYNBD.js} +3 -3
  154. package/bundle/{reconciler-EBKH3JNU.js → reconciler-IEUJXJN2.js} +12 -12
  155. package/bundle/{restore-IFHPI7I7.js → restore-FARTGLQQ.js} +3 -3
  156. package/bundle/{rollback-ANRI3T5Z.js → rollback-GEWPZABG.js} +2 -2
  157. package/bundle/{sandbox-runtime-QROWHDCS.js → sandbox-runtime-DV6E25J6.js} +2 -2
  158. package/bundle/{self-healer-utils-IFAYOQO2.js → self-healer-utils-P4SKNNEM.js} +3 -3
  159. package/bundle/{sha-tracker-ZWBP6CIJ.js → sha-tracker-77SHLYNY.js} +3 -3
  160. package/bundle/{skill-session-BMSRQSHV.js → skill-session-5HSMXY54.js} +3 -3
  161. package/bundle/{skill-stats-JORH5DGM.js → skill-stats-MI3RSWWL.js} +4 -4
  162. package/bundle/{skill-watcher-E4MGLKLS.js → skill-watcher-5L7JE6TN.js} +4 -4
  163. package/bundle/{sleep-36XS6MHJ.js → sleep-I4JFASCY.js} +11 -8
  164. package/bundle/{soul-bundle-VWAVHCZ6.js → soul-bundle-522C3IRH.js} +9 -8
  165. package/bundle/{spin-TI3TSVVT.js → spin-VHNGNWTD.js} +11 -11
  166. package/bundle/{spin-notifications-SE2HVZI7.js → spin-notifications-7NC5XZEM.js} +5 -5
  167. package/bundle/{spin-types-BLPYAETA.js → spin-types-C5KOQOPD.js} +7 -3
  168. package/bundle/{sse-parser-anthropic-A6R4Z2TB.js → sse-parser-anthropic-MMTVWHLI.js} +3 -3
  169. package/bundle/{sse-parser-responses-HSZY3QGJ.js → sse-parser-responses-3AOFN64C.js} +3 -3
  170. package/bundle/{ssrf-guard-O6SHIK6Q.js → ssrf-guard-U2JA72TC.js} +3 -3
  171. package/bundle/{start-7QZIWO3S.js → start-H5IUFAWF.js} +4 -2
  172. package/bundle/{start-7QZIWO3S.js.map → start-H5IUFAWF.js.map} +2 -2
  173. package/bundle/{stt-LGVPXMVR.js → stt-PSOPPBV4.js} +4 -4
  174. package/bundle/{system-status-JZU5FO7B.js → system-status-4LYGOFNO.js} +38 -24
  175. package/bundle/system-status-4LYGOFNO.js.map +7 -0
  176. package/bundle/{task-store-W5BFIAIH.js → task-store-MNCW42BW.js} +4 -4
  177. package/bundle/{telegram-adapter-H6PMFPMB.js → telegram-adapter-O6KIZDY6.js} +69 -46
  178. package/bundle/telegram-adapter-O6KIZDY6.js.map +7 -0
  179. package/bundle/{tool-registry-IZX2IOBM.js → tool-registry-JJMWCQKZ.js} +26 -24
  180. package/bundle/{tool-sandbox-4UC6GAKA.js → tool-sandbox-CNL6V6IH.js} +4 -4
  181. package/bundle/{transport-config-KBF5W2DP.js → transport-config-6MB2K2XC.js} +7 -7
  182. package/bundle/tribe-GDTFYJTK.js +111 -0
  183. package/bundle/tribe-GDTFYJTK.js.map +7 -0
  184. package/bundle/{update-MESYO4LO.js → update-HGQAOC5L.js} +3 -3
  185. package/bundle/{usage-tracker-NXD364VX.js → usage-tracker-SR4BI6ZT.js} +2 -2
  186. package/bundle/{user-registry-35BW4XKM.js → user-registry-4PACZJIJ.js} +4 -4
  187. package/bundle/wire-platform-KKPWNNNQ.js +88 -0
  188. package/bundle/wire-platform-KKPWNNNQ.js.map +7 -0
  189. package/bundle/ws-peer-client-U3NNPOK7.js +370 -0
  190. package/bundle/ws-peer-client-U3NNPOK7.js.map +7 -0
  191. package/package.json +1 -1
  192. package/scripts/abtars-watchdog.service +2 -1
  193. package/scripts/abtars-watchdog.sh +1 -5
  194. package/scripts/emergency-deploy.sh +2 -2
  195. package/scripts/emergency-update.sh +88 -41
  196. package/bundle/chunk-3AAENI2K.js +0 -210
  197. package/bundle/chunk-3AAENI2K.js.map +0 -7
  198. package/bundle/chunk-4MULJ5SS.js.map +0 -7
  199. package/bundle/chunk-4S554KLW.js +0 -105
  200. package/bundle/chunk-4S554KLW.js.map +0 -7
  201. package/bundle/chunk-5GCLBUBS.js +0 -257
  202. package/bundle/chunk-5GCLBUBS.js.map +0 -7
  203. package/bundle/chunk-BROFMHC2.js.map +0 -7
  204. package/bundle/chunk-EGL6UMAO.js.map +0 -7
  205. package/bundle/chunk-EQSG2CRM.js.map +0 -7
  206. package/bundle/chunk-GXL7HJPT.js.map +0 -7
  207. package/bundle/chunk-HKRSMUXJ.js.map +0 -7
  208. package/bundle/chunk-HT2BPTZY.js +0 -241
  209. package/bundle/chunk-HT2BPTZY.js.map +0 -7
  210. package/bundle/chunk-HZDLFLRP.js.map +0 -7
  211. package/bundle/chunk-IKUZPMVA.js +0 -82
  212. package/bundle/chunk-IKUZPMVA.js.map +0 -7
  213. package/bundle/chunk-LGP6TYFI.js.map +0 -7
  214. package/bundle/chunk-ONBF5DDU.js.map +0 -7
  215. package/bundle/chunk-RWRRGE4U.js +0 -72
  216. package/bundle/chunk-RWRRGE4U.js.map +0 -7
  217. package/bundle/chunk-SIFPBTI4.js.map +0 -7
  218. package/bundle/chunk-VUIX5AGB.js +0 -65
  219. package/bundle/chunk-VUIX5AGB.js.map +0 -7
  220. package/bundle/chunk-W4EA4GCA.js.map +0 -7
  221. package/bundle/chunk-XWRADSXO.js.map +0 -7
  222. package/bundle/chunk-Y76VUJSF.js +0 -75
  223. package/bundle/chunk-Y76VUJSF.js.map +0 -7
  224. package/bundle/chunk-YRU2K3O6.js.map +0 -7
  225. package/bundle/context-2RJHC2LE.js.map +0 -7
  226. package/bundle/direct-api-transport-E3LNDBJT.js.map +0 -7
  227. package/bundle/dns-wakeup-IDOJIXBX.js.map +0 -7
  228. package/bundle/heartbeat-tier3-ABWL3P7M.js.map +0 -7
  229. package/bundle/install-OS3CU7NF.js.map +0 -7
  230. package/bundle/metrics-collector-L3VPEHII.js.map +0 -7
  231. package/bundle/peer-client-RGEU5HOK.js.map +0 -7
  232. package/bundle/peer-jwt-NCCPXJRX.js +0 -18
  233. package/bundle/public/css/dashboard.css +0 -542
  234. package/bundle/public/index.html +0 -180
  235. package/bundle/public/js/app.js +0 -437
  236. package/bundle/public/memory-universe.js +0 -384
  237. package/bundle/stream-single-RFJNUTL6.js +0 -34
  238. package/bundle/stream-single-RFJNUTL6.js.map +0 -7
  239. package/bundle/subagent-runtime-5QUVES3W.js +0 -14
  240. package/bundle/system-status-JZU5FO7B.js.map +0 -7
  241. package/bundle/telegram-adapter-H6PMFPMB.js.map +0 -7
  242. package/bundle/usage-tracker-NXD364VX.js.map +0 -7
  243. package/bundle/user-registry-35BW4XKM.js.map +0 -7
  244. package/bundle/ws-peer-client-AIXCXF7V.js +0 -173
  245. package/bundle/ws-peer-client-AIXCXF7V.js.map +0 -7
  246. /package/bundle/{abmind-lazy-7Z44NODV.js.map → abmind-lazy-E3YCFKQ5.js.map} +0 -0
  247. /package/bundle/{acp-raw-client-E6FM45NC.js.map → acp-raw-client-UCNK3OTU.js.map} +0 -0
  248. /package/bundle/{action-gate-G2V47NHW.js.map → action-gate-V4FCBHFB.js.map} +0 -0
  249. /package/bundle/{agent-api-adapter-YAHKQMMZ.js.map → agent-api-adapter-7HEPYSIN.js.map} +0 -0
  250. /package/bundle/{agent-api-rate-limit-WCFXJMGY.js.map → agent-api-rate-limit-RZSAM3SW.js.map} +0 -0
  251. /package/bundle/{agent-registry-GI6CLT3Z.js.map → agent-registry-46A2R5KP.js.map} +0 -0
  252. /package/bundle/{bootstrap-X2QYIZIJ.js.map → bootstrap-MIHJJSWU.js.map} +0 -0
  253. /package/bundle/{bridge-lock-transport-4ZH7QTJP.js.map → bridge-lock-transport-7RSN7OLJ.js.map} +0 -0
  254. /package/bundle/{browser-DMARZJIN.js.map → browser-F6BCWJWW.js.map} +0 -0
  255. /package/bundle/{budget-45QOBDWA.js.map → budget-WUM3SPKW.js.map} +0 -0
  256. /package/bundle/{capability-JFWX3IQF.js.map → capability-QVRKGRFC.js.map} +0 -0
  257. /package/bundle/{chunk-YSKCQH6E.js.map → chunk-2IYJ4I66.js.map} +0 -0
  258. /package/bundle/{chunk-KTYGKPYM.js.map → chunk-2NLUT5S2.js.map} +0 -0
  259. /package/bundle/{chunk-OKAQICWY.js.map → chunk-3GQX34S2.js.map} +0 -0
  260. /package/bundle/{chunk-QROWBWLL.js.map → chunk-3XZ773BS.js.map} +0 -0
  261. /package/bundle/{chunk-DYBW4XXL.js.map → chunk-467SRLLR.js.map} +0 -0
  262. /package/bundle/{chunk-GPZNXY2U.js.map → chunk-4S3H4OK7.js.map} +0 -0
  263. /package/bundle/{chunk-NDCRWEEJ.js.map → chunk-4Y5MJQRE.js.map} +0 -0
  264. /package/bundle/{chunk-FRKW6LWB.js.map → chunk-55UWKI5C.js.map} +0 -0
  265. /package/bundle/{chunk-4UL3KINB.js.map → chunk-5PNJFDSW.js.map} +0 -0
  266. /package/bundle/{chunk-OXTSWQCX.js.map → chunk-5Y3FJ2Y7.js.map} +0 -0
  267. /package/bundle/{chunk-TMUYFERL.js.map → chunk-6B5ZFUPD.js.map} +0 -0
  268. /package/bundle/{chunk-65VCEC32.js.map → chunk-6PA5JBUU.js.map} +0 -0
  269. /package/bundle/{chunk-AFREM7FX.js.map → chunk-CK7YTA2F.js.map} +0 -0
  270. /package/bundle/{chunk-NRUSRJXR.js.map → chunk-DZJ5QZFD.js.map} +0 -0
  271. /package/bundle/{chunk-YRSMGJFP.js.map → chunk-E67KESEG.js.map} +0 -0
  272. /package/bundle/{chunk-ZV4IWKDJ.js.map → chunk-E7XD5UGB.js.map} +0 -0
  273. /package/bundle/{chunk-PEDX56EL.js.map → chunk-EFGBM555.js.map} +0 -0
  274. /package/bundle/{chunk-UPRZDU6T.js.map → chunk-IY6UKLPS.js.map} +0 -0
  275. /package/bundle/{chunk-EUZDKV3C.js.map → chunk-J4RUFAPK.js.map} +0 -0
  276. /package/bundle/{chunk-5B5B6EHL.js.map → chunk-JLWYPGWI.js.map} +0 -0
  277. /package/bundle/{chunk-5QUTMUIK.js.map → chunk-JXYWDAHD.js.map} +0 -0
  278. /package/bundle/{chunk-TEFZ4JA4.js.map → chunk-NHPLD3C7.js.map} +0 -0
  279. /package/bundle/{chunk-2KC5G3EA.js.map → chunk-OWUO5RS3.js.map} +0 -0
  280. /package/bundle/{chunk-WYHGNI56.js.map → chunk-PMD5BLFS.js.map} +0 -0
  281. /package/bundle/{chunk-URQPDCK5.js.map → chunk-Q66LQMMZ.js.map} +0 -0
  282. /package/bundle/{chunk-JQDJPUHM.js.map → chunk-TWB2ZGVH.js.map} +0 -0
  283. /package/bundle/{chunk-IJT4KWXT.js.map → chunk-U4U47YE7.js.map} +0 -0
  284. /package/bundle/{chunk-2FAZIA37.js.map → chunk-W546CU3A.js.map} +0 -0
  285. /package/bundle/{chunk-JNIHEDKF.js.map → chunk-XPWYDNWL.js.map} +0 -0
  286. /package/bundle/{chunk-EFJVUJBE.js.map → chunk-Y5FEFKGM.js.map} +0 -0
  287. /package/bundle/{chunk-GVM5YU5I.js.map → chunk-Z4FZPB42.js.map} +0 -0
  288. /package/bundle/{chunk-7BSQ5UQO.js.map → chunk-ZSIDQ66D.js.map} +0 -0
  289. /package/bundle/{chunk-XX6BGTPO.js.map → chunk-ZZZCJJEO.js.map} +0 -0
  290. /package/bundle/{commands-XYEGVUZF.js.map → commands-2ZW6CMLC.js.map} +0 -0
  291. /package/bundle/{config-M3P5IOAI.js.map → config-YMY5YHKN.js.map} +0 -0
  292. /package/bundle/{daemon-TB23FFWY.js.map → daemon-D7SU63OY.js.map} +0 -0
  293. /package/bundle/{delegation-tools-QKNYQGTQ.js.map → delegation-tools-WS7Z56KZ.js.map} +0 -0
  294. /package/bundle/{deploy-EPDWNHJU.js.map → deploy-AMTVKIMU.js.map} +0 -0
  295. /package/bundle/{deps-WVK553KF.js.map → deps-T63AVJKJ.js.map} +0 -0
  296. /package/bundle/{doctor-probes-B54JFIW3.js.map → doctor-probes-O6YI6XSZ.js.map} +0 -0
  297. /package/bundle/{env-schema-4JXQUOH4.js.map → env-schema-B5RB32DC.js.map} +0 -0
  298. /package/bundle/{gossip-3C3BSNPN.js.map → gossip-SKRCPOBS.js.map} +0 -0
  299. /package/bundle/{guardrails-DL7ZSWVN.js.map → guardrails-64GQ5Y5K.js.map} +0 -0
  300. /package/bundle/{heartbeat-system-MVTRS4GP.js.map → heartbeat-system-X4MUTKJD.js.map} +0 -0
  301. /package/bundle/{hook-system-M3POLUIB.js.map → hook-system-YB635OC4.js.map} +0 -0
  302. /package/bundle/{hotskills-FWX4QI7V.js.map → hotskills-Q75D2DK3.js.map} +0 -0
  303. /package/bundle/{install-manifest-5PPWMD2W.js.map → install-manifest-J7ICPCJN.js.map} +0 -0
  304. /package/bundle/{irc-adapter-PTTZD32W.js.map → irc-adapter-TVEV4R6H.js.map} +0 -0
  305. /package/bundle/{irc-config-CP7ZMUOX.js.map → irc-config-M676FOFI.js.map} +0 -0
  306. /package/bundle/{kanban-board-M326B2XJ.js.map → kanban-board-DLEJUCNN.js.map} +0 -0
  307. /package/bundle/{kanban-channel-IJ52OMNA.js.map → kanban-channel-XOLUHJZJ.js.map} +0 -0
  308. /package/bundle/{lazy-require-KCRVT4SI.js.map → lazy-require-JKQSALXN.js.map} +0 -0
  309. /package/bundle/{logger-OWCSNYCA.js.map → logger-3EGHBD4R.js.map} +0 -0
  310. /package/bundle/{main-chat-ZNUZCTNS.js.map → main-chat-3H63REKK.js.map} +0 -0
  311. /package/bundle/{master-user-HSKM4ZFN.js.map → master-user-MUBUP3KD.js.map} +0 -0
  312. /package/bundle/{media-utils-3ZYOD7SK.js.map → media-utils-HUUIALAJ.js.map} +0 -0
  313. /package/bundle/{message-pipeline-P5GAQU4Z.js.map → message-pipeline-GRDRWONR.js.map} +0 -0
  314. /package/bundle/{model-health-registry-MLEIZSTV.js.map → model-health-registry-QADMFQFQ.js.map} +0 -0
  315. /package/bundle/{nerve-IGSXBKZZ.js.map → nerve-QPAEBRKX.js.map} +0 -0
  316. /package/bundle/{notification-BFSIEECG.js.map → notification-3JICGXWU.js.map} +0 -0
  317. /package/bundle/{openrouter-credits-NTVZDRYM.js.map → openrouter-credits-7NEIPYJN.js.map} +0 -0
  318. /package/bundle/{orc-tools-4CHEFWSN.js.map → orc-tools-UZVPONKY.js.map} +0 -0
  319. /package/bundle/{peer-auth-QC4EF2PM.js.map → peer-auth-RI43DKJE.js.map} +0 -0
  320. /package/bundle/{peer-config-TN55LFDC.js.map → peer-config-URM7DCW6.js.map} +0 -0
  321. /package/bundle/{peer-jwt-NCCPXJRX.js.map → peer-transport-SI7I72DB.js.map} +0 -0
  322. /package/bundle/{peer-transport-I6JPLFZ2.js.map → phase-transport-ESWWACZI.js.map} +0 -0
  323. /package/bundle/{phase-transport-PGKU2KD4.js.map → reconcile-GFDQYNBD.js.map} +0 -0
  324. /package/bundle/{reconciler-EBKH3JNU.js.map → reconciler-IEUJXJN2.js.map} +0 -0
  325. /package/bundle/{restore-IFHPI7I7.js.map → restore-FARTGLQQ.js.map} +0 -0
  326. /package/bundle/{reconcile-CTFCLQRN.js.map → rollback-GEWPZABG.js.map} +0 -0
  327. /package/bundle/{sandbox-runtime-QROWHDCS.js.map → sandbox-runtime-DV6E25J6.js.map} +0 -0
  328. /package/bundle/{self-healer-utils-IFAYOQO2.js.map → self-healer-utils-P4SKNNEM.js.map} +0 -0
  329. /package/bundle/{rollback-ANRI3T5Z.js.map → sha-tracker-77SHLYNY.js.map} +0 -0
  330. /package/bundle/{skill-session-BMSRQSHV.js.map → skill-session-5HSMXY54.js.map} +0 -0
  331. /package/bundle/{sha-tracker-ZWBP6CIJ.js.map → skill-stats-MI3RSWWL.js.map} +0 -0
  332. /package/bundle/{skill-stats-JORH5DGM.js.map → skill-watcher-5L7JE6TN.js.map} +0 -0
  333. /package/bundle/{skill-watcher-E4MGLKLS.js.map → sleep-I4JFASCY.js.map} +0 -0
  334. /package/bundle/{sleep-36XS6MHJ.js.map → soul-bundle-522C3IRH.js.map} +0 -0
  335. /package/bundle/{soul-bundle-VWAVHCZ6.js.map → spin-VHNGNWTD.js.map} +0 -0
  336. /package/bundle/{spin-notifications-SE2HVZI7.js.map → spin-notifications-7NC5XZEM.js.map} +0 -0
  337. /package/bundle/{spin-TI3TSVVT.js.map → spin-types-C5KOQOPD.js.map} +0 -0
  338. /package/bundle/{sse-parser-anthropic-A6R4Z2TB.js.map → sse-parser-anthropic-MMTVWHLI.js.map} +0 -0
  339. /package/bundle/{sse-parser-responses-HSZY3QGJ.js.map → sse-parser-responses-3AOFN64C.js.map} +0 -0
  340. /package/bundle/{ssrf-guard-O6SHIK6Q.js.map → ssrf-guard-U2JA72TC.js.map} +0 -0
  341. /package/bundle/{spin-types-BLPYAETA.js.map → stt-PSOPPBV4.js.map} +0 -0
  342. /package/bundle/{stt-LGVPXMVR.js.map → task-store-MNCW42BW.js.map} +0 -0
  343. /package/bundle/{subagent-runtime-5QUVES3W.js.map → tool-registry-JJMWCQKZ.js.map} +0 -0
  344. /package/bundle/{task-store-W5BFIAIH.js.map → tool-sandbox-CNL6V6IH.js.map} +0 -0
  345. /package/bundle/{tool-registry-IZX2IOBM.js.map → transport-config-6MB2K2XC.js.map} +0 -0
  346. /package/bundle/{tool-sandbox-4UC6GAKA.js.map → update-HGQAOC5L.js.map} +0 -0
  347. /package/bundle/{transport-config-KBF5W2DP.js.map → usage-tracker-SR4BI6ZT.js.map} +0 -0
  348. /package/bundle/{update-MESYO4LO.js.map → user-registry-4PACZJIJ.js.map} +0 -0
@@ -1,21 +1,23 @@
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
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";
11
- import {
4
+ init_spin_profiles,
12
5
  init_spin_types,
13
6
  parseSessionType,
7
+ profileFor,
14
8
  sessionCreatedAt,
15
9
  sessionType,
16
10
  typeAgent,
17
11
  typeLabel
18
- } from "./chunk-Y76VUJSF.js";
12
+ } from "./chunk-BNXV7SZI.js";
13
+ import {
14
+ getMasterUserId,
15
+ init_master_user
16
+ } from "./chunk-CK7YTA2F.js";
17
+ import {
18
+ init_user_registry,
19
+ loadUsers
20
+ } from "./chunk-E7XD5UGB.js";
19
21
  import {
20
22
  init_kanban_board,
21
23
  isUnblocked,
@@ -26,17 +28,17 @@ import {
26
28
  kanbanList,
27
29
  kanbanRetryOrFail,
28
30
  kanbanRunning
29
- } from "./chunk-EQSG2CRM.js";
31
+ } from "./chunk-FGYDIX54.js";
30
32
  import {
31
33
  init_log_and_swallow,
32
34
  logAndSwallow
33
- } from "./chunk-YSKCQH6E.js";
35
+ } from "./chunk-2IYJ4I66.js";
34
36
  import {
35
37
  init_logger,
36
38
  logDebug,
37
39
  logInfo,
38
40
  logWarn
39
- } from "./chunk-GWILHZPT.js";
41
+ } from "./chunk-XRTXYN66.js";
40
42
  import {
41
43
  init_paths,
42
44
  paths_exports
@@ -378,7 +380,7 @@ __export(spin_exports, {
378
380
  });
379
381
  async function fireCallback(peerName, taskId, status, result, error, artifacts, tokensUsed) {
380
382
  try {
381
- const { getPeerTransport } = await import("./peer-transport-I6JPLFZ2.js");
383
+ const { getPeerTransport } = await import("./peer-transport-SI7I72DB.js");
382
384
  const transport = getPeerTransport();
383
385
  const payload = { action: "callback", task_id: taskId, status, result_summary: result, error, tokens_used: tokensUsed ?? 0 };
384
386
  if (artifacts?.length) payload.artifacts = artifacts;
@@ -397,6 +399,7 @@ var init_spin = __esm({
397
399
  init_user_registry();
398
400
  init_master_user();
399
401
  init_spin_types();
402
+ init_spin_profiles();
400
403
  init_spin_sessions();
401
404
  init_spin_sessions();
402
405
  init_spin_types();
@@ -461,6 +464,17 @@ var init_spin = __esm({
461
464
  this.nextIndex = r.nextIndex;
462
465
  return r.session;
463
466
  }
467
+ /** Allocate a named Dreamy (D) session upfront for the duration of a sleep cycle (#1280).
468
+ * Non-active, platform="background" — visible in master /session (showAll) for the full cycle.
469
+ * Call at sleep start before the first runtime.complete(); the caller holds the returned id
470
+ * and passes it as sessionId to subsequent spin({ type:"D", sessionId }) calls. */
471
+ allocateDreamySession(name) {
472
+ const userId = getMasterUserId();
473
+ const r = allocateSession(this.sessions, this.nextIndex, "D", userId, "background", 0, { active: false });
474
+ this.nextIndex = r.nextIndex;
475
+ r.session.name = name;
476
+ return r.session;
477
+ }
464
478
  switchSession(userId, platform, index) {
465
479
  return switchSession(this.sessions, userId, platform, index);
466
480
  }
@@ -688,19 +702,177 @@ var init_spin = __esm({
688
702
  getOrcSession() {
689
703
  return this.orcSession?.isReady ? this.orcSession : null;
690
704
  }
705
+ /** @deprecated Use `spin({ type:"O", sessionId, prompt:"[USER] "+msg, await:true })`. */
691
706
  async sendUserToOrc(message) {
692
- const orc = this.getOrcSession();
693
- if (!orc) return null;
694
- const response = await orc.sendPrompt("orc:user", `[USER] ${message}`);
695
- return response;
707
+ const orcSession = [...this.sessions.values()].find((s) => s.id.includes("_O_") && s.status !== "ended");
708
+ if (!orcSession) return null;
709
+ const { result } = await this.spin({ type: "O", sessionId: orcSession.id, prompt: `[USER] ${message}`, await: true });
710
+ return result ?? null;
711
+ }
712
+ // ── #1271: unified session API ────────────────────────────────────────
713
+ //
714
+ // spin(spec) is the single chokepoint for issuing a model prompt. Per-type
715
+ // behavior lives in SESSION_PROFILES (spin-profiles.ts) — no `type === "…"`
716
+ // branches here. Continuation (pipeline main turn, sleep step N) is just
717
+ // spin() with a sessionId.
718
+ async spin(spec) {
719
+ if (!this.runtime) throw new Error("Spin: runtime not set");
720
+ const profile = profileFor(spec.type);
721
+ const userId = spec.userId ?? getMasterUserId();
722
+ const platform = spec.platform ?? "background";
723
+ const chatId = spec.chatId ?? 0;
724
+ const agent = spec.agent ?? profile.agent;
725
+ const timeoutMs = spec.timeoutMs ?? DEFAULT_TIMEOUT_MS;
726
+ const terminate = spec.terminateAfter ?? profile.terminateAfter;
727
+ const persistent = spec.persistent ?? profile.transportMode === "persistent";
728
+ let session;
729
+ if (spec.sessionId) {
730
+ const found = this.sessions.get(spec.sessionId);
731
+ if (!found) throw new Error(`Spin: sessionId ${spec.sessionId} not found`);
732
+ if (found.status === "ended") throw new Error(`Spin: sessionId ${spec.sessionId} is ended`);
733
+ session = found;
734
+ } else if (spec.active || profile.resolution === "active") {
735
+ session = this.getActiveSession(userId, platform);
736
+ } else if (profile.resolution === "singleton") {
737
+ session = this.getOrCreateVisibleSession(userId, spec.type);
738
+ } else {
739
+ const r = allocateSession(this.sessions, this.nextIndex, spec.type, userId, platform, chatId);
740
+ this.nextIndex = r.nextIndex;
741
+ session = r.session;
742
+ if (spec.metadata) session.metadata = { ...spec.metadata };
743
+ }
744
+ const stepIndex = (session.messageCount >> 1) + 1;
745
+ let cardId = spec.cardId;
746
+ if (cardId === void 0 && spec.goal !== void 0) {
747
+ cardId = kanbanEnqueue(spec.title ?? spec.goal.slice(0, 80), spec.source ?? "user", void 0, {
748
+ priority: spec.priority ?? "MEDIUM",
749
+ type: spec.type,
750
+ parent_id: spec.parentCardId,
751
+ deliveryMode: spec.deliveryMode,
752
+ chatId: chatId ? String(chatId) : void 0,
753
+ notes: spec.callbackPeer ? JSON.stringify({ callback_peer: spec.callbackPeer }) : void 0,
754
+ sourcePeer: spec.sourcePeer
755
+ });
756
+ }
757
+ if (cardId !== void 0 && this.canDispatch(spec.type, cardId)) {
758
+ this.markRunning(spec.type, cardId);
759
+ kanbanRunning(cardId);
760
+ }
761
+ const started = Date.now();
762
+ try {
763
+ await profile.beforePrompt?.(session, cardId);
764
+ let sessionTransport = session.transport;
765
+ if (persistent && !sessionTransport) {
766
+ const agentSession = await this.runtime.session(agent, profile.resolution === "active" ? userId : void 0);
767
+ sessionTransport = agentSession.transport;
768
+ session.transport = sessionTransport;
769
+ session.status = "ready";
770
+ }
771
+ let prompt = spec.prompt ?? spec.goal ?? "";
772
+ for (const decorate of profile.decorators) {
773
+ prompt = await decorate(prompt, { session, cardId, parentCardId: spec.parentCardId });
774
+ }
775
+ pushLog(session, `spin type=${spec.type} agent=${agent} step=${stepIndex}`);
776
+ const exec = sessionTransport ? sessionTransport.sendPrompt(session.id, prompt, spec.imageContent, spec.userId ?? userId) : this.runtime.complete(agent, prompt, { timeoutMs, session: "fresh", maxToolRounds: spec.maxToolRounds });
777
+ if (!spec.await) {
778
+ exec.then((r) => this.finishSpin(spec, profile, session, cardId, stepIndex, started, r || "(no output)", terminate)).catch((e) => this.failSpin(spec, profile, session, cardId, stepIndex, started, e, terminate));
779
+ return { sessionId: session.id, cardId };
780
+ }
781
+ const result = await exec || "(no output)";
782
+ await this.finishSpin(spec, profile, session, cardId, stepIndex, started, result, terminate);
783
+ return { sessionId: session.id, cardId, result };
784
+ } catch (err) {
785
+ await this.failSpin(spec, profile, session, cardId, stepIndex, started, err, terminate);
786
+ if (spec.await) throw err;
787
+ return { sessionId: session.id, cardId };
788
+ }
789
+ }
790
+ async finishSpin(spec, profile, session, cardId, stepIndex, started, result, terminate) {
791
+ const usage = session.transport?.lastUsage?.() ?? this.runtime?.lastUsage ?? null;
792
+ session.messageCount += 2;
793
+ session.lastActiveAt = Date.now();
794
+ session.tokenCount = usage ? usage.input + usage.output : session.tokenCount;
795
+ pushLog(session, "complete");
796
+ if (this.memory) {
797
+ const sid = cardId !== void 0 ? `${spec.type}_card${cardId}` : `${spec.type}_${session.id}`;
798
+ this.memory.recordMessage({ role: "user", content: spec.goal ?? spec.prompt ?? "", timestamp: Date.now(), userId: "system", sessionId: sid });
799
+ this.memory.recordMessage({ role: "assistant", content: result, timestamp: Date.now(), userId: "system", sessionId: sid });
800
+ }
801
+ if (cardId !== void 0) {
802
+ let artifacts = [];
803
+ try {
804
+ const { drainArtifacts: drainArtifacts2 } = (init_artifact_tools(), __toCommonJS(artifact_tools_exports));
805
+ artifacts = drainArtifacts2(cardId) ?? [];
806
+ } catch {
807
+ }
808
+ kanbanComplete(cardId, null, result.slice(0, 500));
809
+ if (spec.callbackPeer) {
810
+ const card = kanbanGetCard(cardId);
811
+ fireCallback(spec.callbackPeer, cardId, "done", result.slice(0, 500), void 0, artifacts, card?.tokens_used ?? 0);
812
+ }
813
+ }
814
+ await profile.afterPrompt?.(session, cardId);
815
+ const stepEvent = {
816
+ sessionId: session.id,
817
+ cardId,
818
+ stepIndex,
819
+ result,
820
+ durationMs: Date.now() - started,
821
+ inputTokens: usage?.input,
822
+ outputTokens: usage?.output
823
+ };
824
+ await spec.onStepComplete?.(stepEvent);
825
+ this.applyTerminate(session, terminate);
826
+ if (cardId !== void 0) {
827
+ this.markDone(spec.type, cardId);
828
+ this.drainQueued();
829
+ }
830
+ }
831
+ async failSpin(spec, profile, session, cardId, stepIndex, started, err, terminate) {
832
+ const msg = (err instanceof Error ? err.message : String(err)).slice(0, 1e3);
833
+ logWarn(TAG, `${spec.type} spin failed: ${msg}`);
834
+ pushLog(session, `failed: ${msg.slice(0, 80)}`);
835
+ if (cardId !== void 0) {
836
+ kanbanRetryOrFail(cardId, msg);
837
+ if (spec.callbackPeer) fireCallback(spec.callbackPeer, cardId, "failed", void 0, msg);
838
+ }
839
+ await profile.afterPrompt?.(session, cardId);
840
+ const stepEvent = {
841
+ sessionId: session.id,
842
+ cardId,
843
+ stepIndex,
844
+ error: err instanceof Error ? err : new Error(msg),
845
+ durationMs: Date.now() - started
846
+ };
847
+ await spec.onStepComplete?.(stepEvent);
848
+ this.applyTerminate(session, terminate);
849
+ if (cardId !== void 0) {
850
+ this.markDone(spec.type, cardId);
851
+ this.drainQueued();
852
+ }
853
+ }
854
+ applyTerminate(session, terminate) {
855
+ if (terminate === "call") this.sessions.delete(session.id);
856
+ else if (terminate === "response") {
857
+ session.status = "ended";
858
+ session.active = false;
859
+ }
696
860
  }
697
- async getOrCreateOrc() {
698
- if (this.orcSession?.isReady) return this.orcSession;
699
- logInfo(TAG, "Spawning persistent Orc session");
700
- this.orcSession = await this.runtime.session("browsie");
701
- return this.orcSession;
861
+ /** #1271: Background one-shot (e.g. compaction summary). Returns the result string. */
862
+ async dispatchBackground(opts) {
863
+ const { result } = await this.spin({
864
+ type: opts.type ?? "S",
865
+ prompt: opts.prompt,
866
+ timeoutMs: opts.timeoutMs,
867
+ agent: opts.agent,
868
+ await: true
869
+ });
870
+ return result ?? "";
702
871
  }
703
- // ── Dispatch ───────────────────────────────────────────────────────────
872
+ // ── Dispatch (legacy wrappers, #1271) ───────────────────────────────────
873
+ // dispatch / dispatchAwait / getOrCreateOrc / sendUserToOrc are thin wrappers
874
+ // around the unified spin(spec) chokepoint. dispatchBackground is the new
875
+ // background-only entry point.
704
876
  /** #1010: O-type reuses existing session (one Orc). All others create new. */
705
877
  getOrCreateVisibleSession(userId, type) {
706
878
  if (type === "O") {
@@ -711,6 +883,11 @@ var init_spin = __esm({
711
883
  const sub = this.createSubSession(userId, "telegram", type);
712
884
  return typeof sub === "string" ? void 0 : sub;
713
885
  }
886
+ /**
887
+ * @deprecated Use `spin({ type, goal, …, await: false })` instead.
888
+ * Backward-compat wrapper: creates a kanban card, then dispatches via spin().
889
+ * Returns the cardId synchronously; the model call runs in the background.
890
+ */
714
891
  dispatch(request) {
715
892
  const cardTitle = request.title ?? request.goal.slice(0, 80);
716
893
  const cardId = request.cardId ?? kanbanEnqueue(cardTitle, request.source, void 0, {
@@ -722,76 +899,57 @@ var init_spin = __esm({
722
899
  chatId: request.chatId,
723
900
  sourcePeer: request.sourcePeer
724
901
  });
725
- if (!this.canDispatch(request.type, cardId)) {
726
- logInfo(TAG, `${request.type} card:${cardId} queued (concurrency gate)`);
902
+ const aliveSessions = [...this.sessions.values()].filter((s) => s.status !== "ended").length;
903
+ if (aliveSessions >= MAX_TOTAL_SESSIONS || !this.canDispatch(request.type, cardId)) {
904
+ const reason = aliveSessions >= MAX_TOTAL_SESSIONS ? "session cap" : "concurrency gate";
905
+ logInfo(TAG, `${request.type} card:${cardId} queued (${reason})`);
727
906
  return { cardId };
728
907
  }
729
- this.markRunning(request.type, cardId);
730
- kanbanRunning(cardId);
731
- const masterUserId = getMasterUserId();
732
- const session = this.getOrCreateVisibleSession(masterUserId, request.type);
733
- if (session) {
734
- session.name = request.title?.slice(0, 20);
735
- pushLog(session, `dispatch card:${cardId}`);
736
- }
737
- const timeout = request.timeoutMs ?? DEFAULT_TIMEOUT_MS;
738
- this.execute(request, cardId, timeout).then((result) => {
739
- const { drainArtifacts: drainArtifacts2 } = (init_artifact_tools(), __toCommonJS(artifact_tools_exports));
740
- const artifacts = drainArtifacts2(cardId);
741
- kanbanComplete(cardId, null, result.slice(0, 500));
742
- if (request.callbackPeer) {
743
- const card = kanbanGetCard(cardId);
744
- fireCallback(request.callbackPeer, cardId, "done", result.slice(0, 500), void 0, artifacts, card?.tokens_used ?? 0);
745
- }
746
- }).catch((err) => {
747
- const msg = (err instanceof Error ? err.message : String(err)).slice(0, 1e3);
748
- logWarn(TAG, `${request.type} card:${cardId} failed: ${msg}`);
749
- kanbanRetryOrFail(cardId, msg);
750
- if (request.callbackPeer) fireCallback(request.callbackPeer, cardId, "failed", void 0, msg);
751
- }).finally(() => {
752
- this.markDone(request.type, cardId);
753
- if (session) {
754
- session.status = "ended";
755
- session.active = false;
756
- pushLog(session, "completed");
757
- }
758
- this.drainQueued();
908
+ void this.spin({
909
+ type: request.type,
910
+ goal: request.goal,
911
+ cardId,
912
+ parentCardId: request.parentCardId,
913
+ title: request.title,
914
+ priority: request.priority,
915
+ source: request.source,
916
+ deliveryMode: request.deliveryMode,
917
+ agent: request.agent,
918
+ timeoutMs: request.timeoutMs,
919
+ callbackPeer: request.callbackPeer,
920
+ sourcePeer: request.sourcePeer,
921
+ chatId: request.chatId ? Number(request.chatId) : void 0,
922
+ await: false
759
923
  });
760
- return { cardId, sessionId: session?.id };
924
+ return { cardId };
761
925
  }
926
+ /**
927
+ * @deprecated Use `spin({ type, goal, …, await: true })` instead.
928
+ * Backward-compat wrapper: synchronously dispatches and returns the result.
929
+ */
762
930
  async dispatchAwait(request) {
931
+ const aliveSessions = [...this.sessions.values()].filter((s) => s.status !== "ended").length;
932
+ if (aliveSessions >= MAX_TOTAL_SESSIONS) {
933
+ throw new Error("System busy \u2014 max sessions reached.");
934
+ }
763
935
  if (!this.canDispatch(request.type, 0)) {
764
936
  throw new Error(`${request.type} session busy or in cooldown \u2014 skipping`);
765
937
  }
766
- const cardTitle = request.title ?? request.goal.slice(0, 80);
767
- const cardId = request.cardId ?? kanbanEnqueue(cardTitle, request.source, void 0, {
768
- priority: request.priority ?? "MEDIUM",
938
+ const { cardId, result } = await this.spin({
769
939
  type: request.type,
770
- parent_id: request.parentCardId,
940
+ goal: request.goal,
941
+ title: request.title,
942
+ priority: request.priority,
943
+ source: request.source,
771
944
  deliveryMode: request.deliveryMode,
772
- chatId: request.chatId
945
+ agent: request.agent,
946
+ timeoutMs: request.timeoutMs,
947
+ maxToolRounds: request.maxToolRounds,
948
+ parentCardId: request.parentCardId,
949
+ chatId: request.chatId ? Number(request.chatId) : void 0,
950
+ await: true
773
951
  });
774
- this.markRunning(request.type, cardId);
775
- kanbanRunning(cardId);
776
- const masterUserId = getMasterUserId();
777
- const session = this.getOrCreateVisibleSession(masterUserId, request.type);
778
- if (session) {
779
- session.name = request.title?.slice(0, 20);
780
- pushLog(session, `dispatchAwait card:${cardId}`);
781
- }
782
- const timeout = request.timeoutMs ?? DEFAULT_TIMEOUT_MS;
783
- try {
784
- const result = await this.execute(request, cardId, timeout);
785
- return { cardId, result };
786
- } finally {
787
- this.markDone(request.type, cardId);
788
- if (session && request.type !== "O") {
789
- session.status = "ended";
790
- session.active = false;
791
- pushLog(session, "completed");
792
- }
793
- this.drainQueued();
794
- }
952
+ return { cardId, result };
795
953
  }
796
954
  spawnChild(parentCardId, request) {
797
955
  if (request.type === "O") throw new Error("Cannot nest orchestrators");
@@ -825,17 +983,21 @@ var init_spin = __esm({
825
983
  checkStaleWorkers() {
826
984
  const STALE_MS = parseInt(process.env["WORKER_STALE_MS"] || "300000", 10);
827
985
  const now = Date.now();
828
- for (const [, cardIds] of this.running) {
829
- for (const cardId of cardIds) {
986
+ let freed = false;
987
+ for (const [type, cardIds] of this.running) {
988
+ for (const cardId of [...cardIds]) {
830
989
  const card = kanbanGetCard(cardId);
831
990
  if (!card || card.status !== "running") continue;
832
991
  const lastActivity = (/* @__PURE__ */ new Date(card.updated_at + "Z")).getTime();
833
992
  if (now - lastActivity > STALE_MS) {
834
993
  logWarn(TAG, `Stale card ${cardId} (${Math.round((now - lastActivity) / 1e3)}s no activity) \u2014 failing`);
835
994
  kanbanFail(cardId, "stale \u2014 no activity");
995
+ this.markDone(type, cardId);
996
+ freed = true;
836
997
  }
837
998
  }
838
999
  }
1000
+ if (freed) this.drainQueued();
839
1001
  }
840
1002
  /** #613: Prune .trash/ entries older than 7 days (~hourly). */
841
1003
  pruneSkillTrash() {
@@ -907,7 +1069,7 @@ var init_spin = __esm({
907
1069
  async pollRemoteCards() {
908
1070
  const remoteCards = kanbanList("running", "status").filter((c) => c.type === "remote");
909
1071
  if (remoteCards.length === 0) return;
910
- const { getPeerTransport } = await import("./peer-transport-I6JPLFZ2.js");
1072
+ const { getPeerTransport } = await import("./peer-transport-SI7I72DB.js");
911
1073
  const transport = getPeerTransport();
912
1074
  const REMOTE_MAX_AGE_MS = 15 * 60 * 1e3;
913
1075
  for (const card of remoteCards) {
@@ -941,102 +1103,6 @@ var init_spin = __esm({
941
1103
  this.running.get(type)?.delete(cardId);
942
1104
  if (type === "H") this._lastHealerDoneAt = Date.now();
943
1105
  }
944
- async execute(request, cardId, timeoutMs) {
945
- if (!this.runtime) throw new Error("Spin: runtime not set");
946
- if (request.type === "O") return this.executeOrc(request, cardId, timeoutMs);
947
- const agentName = request.agent ?? typeAgent(request.type);
948
- logInfo(TAG, `\u25B6 ${request.type} card:${cardId} agent=${agentName}`);
949
- try {
950
- const { buildSoulBundle } = await import("./soul-bundle-VWAVHCZ6.js");
951
- const bundle = buildSoulBundle(request.type);
952
- let fullPrompt = bundle ? `${bundle}
953
-
954
- ---
955
-
956
- ${request.goal}` : request.goal;
957
- if (request.type === "W" || request.type === "T") {
958
- const { channelUnread } = await import("./kanban-channel-IJ52OMNA.js");
959
- const workerName = `Worker-${String(cardId).padStart(2, "0")}`;
960
- const parentCard = request.parentCardId ?? cardId;
961
- const msgs = channelUnread(parentCard, workerName);
962
- if (msgs.length > 0) {
963
- const lines = msgs.map((m) => `[${m.from_agent}\u2192${m.to_agent}]${m.directive ? " \u26A1" : ""} ${m.message}`);
964
- fullPrompt = `[CHANNEL \u2014 ${msgs.length} message(s) for ${workerName}]
965
- ${lines.join("\n")}
966
- [/CHANNEL]
967
-
968
- ${fullPrompt}`;
969
- }
970
- }
971
- const result = await this.runtime.complete(agentName, fullPrompt, { timeoutMs, session: "fresh" }) || "(no output)";
972
- if (this.memory) {
973
- const sid = `${request.type}_card${cardId}`;
974
- this.memory.recordMessage({ role: "user", content: request.goal, timestamp: Date.now(), userId: "system", sessionId: sid });
975
- this.memory.recordMessage({ role: "assistant", content: result, timestamp: Date.now(), userId: "system", sessionId: sid });
976
- }
977
- return result;
978
- } finally {
979
- }
980
- }
981
- async executeOrc(request, cardId, timeoutMs) {
982
- const { updateBridgeLockField } = await import("./bridge-lock-transport-4ZH7QTJP.js");
983
- const { setActiveOrcCard } = await import("./orc-tools-4CHEFWSN.js");
984
- updateBridgeLockField("orc_active", cardId);
985
- setActiveOrcCard(cardId);
986
- const orc = await this.getOrCreateOrc();
987
- logInfo(TAG, `\u25B6 O card:${cardId} (persistent Orc)`);
988
- let orcSessionKey = "orc:project";
989
- for (const [, s] of this.sessions) {
990
- if (s.id.includes("_O_") && s.status !== "ended") {
991
- s.transport = orc.transport;
992
- s.status = "ready";
993
- orcSessionKey = s.id;
994
- break;
995
- }
996
- }
997
- const timer = setTimeout(() => {
998
- logWarn(TAG, `\u23F1\uFE0F O card:${cardId} timed out`);
999
- }, timeoutMs);
1000
- try {
1001
- const { buildSoulBundle } = await import("./soul-bundle-VWAVHCZ6.js");
1002
- const bundle = buildSoulBundle("O");
1003
- const { localDateTime } = await import("./local-time-HT7A7OGW.js");
1004
- const context = `[CONTEXT \u2014 do not respond to this section]
1005
- [PROJECT] card #${cardId}
1006
- [CURRENT TIME] ${localDateTime()}
1007
- [/CONTEXT]
1008
-
1009
- `;
1010
- let fullPrompt = context + (bundle ? `${bundle}
1011
-
1012
- ---
1013
-
1014
- ${request.goal}` : request.goal);
1015
- const { drainOrcNotifications } = await import("./spin-notifications-SE2HVZI7.js");
1016
- const notifications = drainOrcNotifications(cardId);
1017
- if (notifications.length) fullPrompt = notifications.join("\n") + "\n\n" + fullPrompt;
1018
- const { channelUnread } = await import("./kanban-channel-IJ52OMNA.js");
1019
- const orcMsgs = channelUnread(cardId, "Orc");
1020
- if (orcMsgs.length > 0) {
1021
- const lines = orcMsgs.map((m) => `[${m.from_agent}\u2192${m.to_agent}]${m.directive ? " \u26A1" : ""} ${m.message}`);
1022
- fullPrompt = `[CHANNEL \u2014 ${orcMsgs.length} message(s)]
1023
- ${lines.join("\n")}
1024
- [/CHANNEL]
1025
-
1026
- ${fullPrompt}`;
1027
- }
1028
- const result = await orc.sendPrompt(orcSessionKey, fullPrompt) || "(no output)";
1029
- if (this.memory) {
1030
- this.memory.recordMessage({ role: "user", content: request.goal, timestamp: Date.now(), userId: "system", sessionId: orcSessionKey });
1031
- this.memory.recordMessage({ role: "assistant", content: result, timestamp: Date.now(), userId: "system", sessionId: orcSessionKey });
1032
- }
1033
- return result;
1034
- } finally {
1035
- clearTimeout(timer);
1036
- updateBridgeLockField("orc_active", null);
1037
- setActiveOrcCard(null);
1038
- }
1039
- }
1040
1106
  };
1041
1107
  spin = new Spin();
1042
1108
  }
@@ -1053,4 +1119,4 @@ export {
1053
1119
  spin_exports,
1054
1120
  init_spin
1055
1121
  };
1056
- //# sourceMappingURL=chunk-ONBF5DDU.js.map
1122
+ //# sourceMappingURL=chunk-L72RIPEC.js.map