charness 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (394) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/DEVELOPMENT.md +4 -1
  3. package/SETUP.md +6 -4
  4. package/agent-plugin/README.md +2 -2
  5. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +1 -1
  6. package/agent-plugin/skills/charness-manager/SKILL.md +8 -4
  7. package/dist/bot.d.ts +27 -18
  8. package/dist/bot.d.ts.map +1 -1
  9. package/dist/bot.js +217 -99
  10. package/dist/bot.js.map +1 -1
  11. package/dist/connectors/jira/adf.d.ts.map +1 -1
  12. package/dist/connectors/jira/adf.js +2 -3
  13. package/dist/connectors/jira/adf.js.map +1 -1
  14. package/dist/connectors/jira/inbound.d.ts +25 -1
  15. package/dist/connectors/jira/inbound.d.ts.map +1 -1
  16. package/dist/connectors/jira/inbound.js +74 -2
  17. package/dist/connectors/jira/inbound.js.map +1 -1
  18. package/dist/connectors/jira/issueContext.d.ts +11 -2
  19. package/dist/connectors/jira/issueContext.d.ts.map +1 -1
  20. package/dist/connectors/jira/issueContext.js +22 -2
  21. package/dist/connectors/jira/issueContext.js.map +1 -1
  22. package/dist/connectors/jira/prompt.d.ts +12 -2
  23. package/dist/connectors/jira/prompt.d.ts.map +1 -1
  24. package/dist/connectors/jira/prompt.js +59 -5
  25. package/dist/connectors/jira/prompt.js.map +1 -1
  26. package/dist/connectors/telegram/commands/botCore.d.ts +16 -0
  27. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  28. package/dist/connectors/telegram/commands/runners.d.ts +10 -1
  29. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  30. package/dist/connectors/telegram/commands/runners.js +75 -13
  31. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  32. package/dist/connectors/telegram/runnerLinkNotices.d.ts +24 -0
  33. package/dist/connectors/telegram/runnerLinkNotices.d.ts.map +1 -0
  34. package/dist/connectors/telegram/runnerLinkNotices.js +95 -0
  35. package/dist/connectors/telegram/runnerLinkNotices.js.map +1 -0
  36. package/dist/connectors/telegram/runnerPairingMessages.d.ts +9 -0
  37. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
  38. package/dist/connectors/telegram/runnerPairingMessages.js +17 -1
  39. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
  40. package/dist/i18n/de.d.ts.map +1 -1
  41. package/dist/i18n/de.js +19 -0
  42. package/dist/i18n/de.js.map +1 -1
  43. package/dist/i18n/en.d.ts.map +1 -1
  44. package/dist/i18n/en.js +19 -0
  45. package/dist/i18n/en.js.map +1 -1
  46. package/dist/i18n/es.d.ts.map +1 -1
  47. package/dist/i18n/es.js +19 -0
  48. package/dist/i18n/es.js.map +1 -1
  49. package/dist/i18n/fr.d.ts.map +1 -1
  50. package/dist/i18n/fr.js +19 -0
  51. package/dist/i18n/fr.js.map +1 -1
  52. package/dist/i18n/hi.d.ts.map +1 -1
  53. package/dist/i18n/hi.js +19 -0
  54. package/dist/i18n/hi.js.map +1 -1
  55. package/dist/i18n/ja.d.ts.map +1 -1
  56. package/dist/i18n/ja.js +19 -0
  57. package/dist/i18n/ja.js.map +1 -1
  58. package/dist/i18n/ka.d.ts.map +1 -1
  59. package/dist/i18n/ka.js +19 -0
  60. package/dist/i18n/ka.js.map +1 -1
  61. package/dist/i18n/pt.d.ts.map +1 -1
  62. package/dist/i18n/pt.js +19 -0
  63. package/dist/i18n/pt.js.map +1 -1
  64. package/dist/i18n/ru.d.ts.map +1 -1
  65. package/dist/i18n/ru.js +19 -0
  66. package/dist/i18n/ru.js.map +1 -1
  67. package/dist/i18n/uk.d.ts.map +1 -1
  68. package/dist/i18n/uk.js +19 -0
  69. package/dist/i18n/uk.js.map +1 -1
  70. package/dist/i18n/uz.d.ts.map +1 -1
  71. package/dist/i18n/uz.js +19 -0
  72. package/dist/i18n/uz.js.map +1 -1
  73. package/dist/i18n/zh.d.ts.map +1 -1
  74. package/dist/i18n/zh.js +19 -0
  75. package/dist/i18n/zh.js.map +1 -1
  76. package/dist/outputTrace.d.ts.map +1 -1
  77. package/dist/outputTrace.js +2 -9
  78. package/dist/outputTrace.js.map +1 -1
  79. package/dist/rateLimiter.d.ts +3 -1
  80. package/dist/rateLimiter.d.ts.map +1 -1
  81. package/dist/rateLimiter.js +3 -1
  82. package/dist/rateLimiter.js.map +1 -1
  83. package/dist/remoteRun/cliArgs.d.ts +6 -1
  84. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  85. package/dist/remoteRun/cliArgs.js +39 -2
  86. package/dist/remoteRun/cliArgs.js.map +1 -1
  87. package/dist/remoteRun/exitCodes.d.ts +12 -2
  88. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  89. package/dist/remoteRun/exitCodes.js +3 -0
  90. package/dist/remoteRun/exitCodes.js.map +1 -1
  91. package/dist/remoteRun/foreground.d.ts +13 -0
  92. package/dist/remoteRun/foreground.d.ts.map +1 -1
  93. package/dist/remoteRun/foreground.js +15 -2
  94. package/dist/remoteRun/foreground.js.map +1 -1
  95. package/dist/remoteRun/heldBackNotice.d.ts +7 -0
  96. package/dist/remoteRun/heldBackNotice.d.ts.map +1 -0
  97. package/dist/remoteRun/heldBackNotice.js +92 -0
  98. package/dist/remoteRun/heldBackNotice.js.map +1 -0
  99. package/dist/remoteRun/interrupts.d.ts +6 -2
  100. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  101. package/dist/remoteRun/interrupts.js +18 -3
  102. package/dist/remoteRun/interrupts.js.map +1 -1
  103. package/dist/remoteRun/leaseTiming.d.ts +1 -2
  104. package/dist/remoteRun/leaseTiming.d.ts.map +1 -1
  105. package/dist/remoteRun/leaseTiming.js +3 -17
  106. package/dist/remoteRun/leaseTiming.js.map +1 -1
  107. package/dist/remoteRun/output.d.ts +16 -1
  108. package/dist/remoteRun/output.d.ts.map +1 -1
  109. package/dist/remoteRun/output.js +28 -2
  110. package/dist/remoteRun/output.js.map +1 -1
  111. package/dist/remoteRun/probe.d.ts +40 -2
  112. package/dist/remoteRun/probe.d.ts.map +1 -1
  113. package/dist/remoteRun/probe.js +58 -2
  114. package/dist/remoteRun/probe.js.map +1 -1
  115. package/dist/remoteRun/project.d.ts +2 -2
  116. package/dist/remoteRun/project.d.ts.map +1 -1
  117. package/dist/remoteRun/project.js +5 -4
  118. package/dist/remoteRun/project.js.map +1 -1
  119. package/dist/remoteRun/remoteRunCli.d.ts +1 -1
  120. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  121. package/dist/remoteRun/remoteRunCli.js +6 -3
  122. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  123. package/dist/remoteRun/runnerWait.d.ts +3 -3
  124. package/dist/remoteRun/runnerWait.d.ts.map +1 -1
  125. package/dist/remoteRun/runnerWait.js +12 -6
  126. package/dist/remoteRun/runnerWait.js.map +1 -1
  127. package/dist/remoteRun/runnerWaitTiming.d.ts +1 -1
  128. package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -1
  129. package/dist/remoteRun/runnerWaitTiming.js +3 -16
  130. package/dist/remoteRun/runnerWaitTiming.js.map +1 -1
  131. package/dist/remoteRun/runners.d.ts +16 -3
  132. package/dist/remoteRun/runners.d.ts.map +1 -1
  133. package/dist/remoteRun/runners.js +42 -4
  134. package/dist/remoteRun/runners.js.map +1 -1
  135. package/dist/remoteRun/sendPlan.d.ts +11 -1
  136. package/dist/remoteRun/sendPlan.d.ts.map +1 -1
  137. package/dist/remoteRun/sendPlan.js +29 -5
  138. package/dist/remoteRun/sendPlan.js.map +1 -1
  139. package/dist/remoteRun/submit.d.ts.map +1 -1
  140. package/dist/remoteRun/submit.js +13 -3
  141. package/dist/remoteRun/submit.js.map +1 -1
  142. package/dist/requests/requestHeader.d.ts +2 -1
  143. package/dist/requests/requestHeader.d.ts.map +1 -1
  144. package/dist/requests/requestHeader.js +6 -2
  145. package/dist/requests/requestHeader.js.map +1 -1
  146. package/dist/requests/storedPromptRefresh.d.ts +16 -0
  147. package/dist/requests/storedPromptRefresh.d.ts.map +1 -0
  148. package/dist/requests/storedPromptRefresh.js +36 -0
  149. package/dist/requests/storedPromptRefresh.js.map +1 -0
  150. package/dist/runnerUtility/adminService.d.ts +30 -2
  151. package/dist/runnerUtility/adminService.d.ts.map +1 -1
  152. package/dist/runnerUtility/adminService.js +104 -6
  153. package/dist/runnerUtility/adminService.js.map +1 -1
  154. package/dist/runnerUtility/appInstall.d.ts +13 -4
  155. package/dist/runnerUtility/appInstall.d.ts.map +1 -1
  156. package/dist/runnerUtility/appInstall.js +46 -19
  157. package/dist/runnerUtility/appInstall.js.map +1 -1
  158. package/dist/runnerUtility/appUpdate.js +1 -1
  159. package/dist/runnerUtility/appUpdate.js.map +1 -1
  160. package/dist/runnerUtility/execEnv.d.ts +2 -0
  161. package/dist/runnerUtility/execEnv.d.ts.map +1 -1
  162. package/dist/runnerUtility/execEnv.js +6 -2
  163. package/dist/runnerUtility/execEnv.js.map +1 -1
  164. package/dist/runnerUtility/guiAgent.d.ts +126 -0
  165. package/dist/runnerUtility/guiAgent.d.ts.map +1 -0
  166. package/dist/runnerUtility/guiAgent.js +591 -0
  167. package/dist/runnerUtility/guiAgent.js.map +1 -0
  168. package/dist/runnerUtility/guiAgentHeal.d.ts +128 -0
  169. package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -0
  170. package/dist/runnerUtility/guiAgentHeal.js +284 -0
  171. package/dist/runnerUtility/guiAgentHeal.js.map +1 -0
  172. package/dist/runnerUtility/homeFolders.d.ts +33 -0
  173. package/dist/runnerUtility/homeFolders.d.ts.map +1 -0
  174. package/dist/runnerUtility/homeFolders.js +158 -0
  175. package/dist/runnerUtility/homeFolders.js.map +1 -0
  176. package/dist/runnerUtility/hubClient.d.ts +12 -2
  177. package/dist/runnerUtility/hubClient.d.ts.map +1 -1
  178. package/dist/runnerUtility/hubClient.js +24 -3
  179. package/dist/runnerUtility/hubClient.js.map +1 -1
  180. package/dist/runnerUtility/iosCheck.d.ts +7 -1
  181. package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
  182. package/dist/runnerUtility/iosCheck.js +14 -5
  183. package/dist/runnerUtility/iosCheck.js.map +1 -1
  184. package/dist/runnerUtility/isolatedCommand.d.ts +33 -0
  185. package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -0
  186. package/dist/runnerUtility/isolatedCommand.js +139 -0
  187. package/dist/runnerUtility/isolatedCommand.js.map +1 -0
  188. package/dist/runnerUtility/keepAwake.d.ts +67 -0
  189. package/dist/runnerUtility/keepAwake.d.ts.map +1 -0
  190. package/dist/runnerUtility/keepAwake.js +211 -0
  191. package/dist/runnerUtility/keepAwake.js.map +1 -0
  192. package/dist/runnerUtility/lidPollTiming.d.ts +11 -0
  193. package/dist/runnerUtility/lidPollTiming.d.ts.map +1 -0
  194. package/dist/runnerUtility/lidPollTiming.js +18 -0
  195. package/dist/runnerUtility/lidPollTiming.js.map +1 -0
  196. package/dist/runnerUtility/lidState.d.ts +57 -0
  197. package/dist/runnerUtility/lidState.d.ts.map +1 -0
  198. package/dist/runnerUtility/lidState.js +195 -0
  199. package/dist/runnerUtility/lidState.js.map +1 -0
  200. package/dist/runnerUtility/linkLoop.d.ts +5 -0
  201. package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
  202. package/dist/runnerUtility/linkLoop.js +37 -1
  203. package/dist/runnerUtility/linkLoop.js.map +1 -1
  204. package/dist/runnerUtility/packageManagerShims.d.ts +44 -0
  205. package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -0
  206. package/dist/runnerUtility/packageManagerShims.js +130 -0
  207. package/dist/runnerUtility/packageManagerShims.js.map +1 -0
  208. package/dist/runnerUtility/progress.d.ts +43 -0
  209. package/dist/runnerUtility/progress.d.ts.map +1 -0
  210. package/dist/runnerUtility/progress.js +78 -0
  211. package/dist/runnerUtility/progress.js.map +1 -0
  212. package/dist/runnerUtility/pueueDaemon.d.ts +8 -4
  213. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
  214. package/dist/runnerUtility/pueueDaemon.js +12 -7
  215. package/dist/runnerUtility/pueueDaemon.js.map +1 -1
  216. package/dist/runnerUtility/rootServiceCli.d.ts +23 -3
  217. package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -1
  218. package/dist/runnerUtility/rootServiceCli.js +56 -10
  219. package/dist/runnerUtility/rootServiceCli.js.map +1 -1
  220. package/dist/runnerUtility/runnerCli.d.ts +1 -0
  221. package/dist/runnerUtility/runnerCli.d.ts.map +1 -1
  222. package/dist/runnerUtility/runnerCli.js +14 -7
  223. package/dist/runnerUtility/runnerCli.js.map +1 -1
  224. package/dist/runnerUtility/runnerCommands.d.ts +45 -0
  225. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
  226. package/dist/runnerUtility/runnerCommands.js +188 -21
  227. package/dist/runnerUtility/runnerCommands.js.map +1 -1
  228. package/dist/runnerUtility/runnerHome.d.ts +8 -0
  229. package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
  230. package/dist/runnerUtility/runnerHome.js +7 -0
  231. package/dist/runnerUtility/runnerHome.js.map +1 -1
  232. package/dist/runnerUtility/serviceCommon.d.ts +4 -0
  233. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  234. package/dist/runnerUtility/serviceCommon.js +8 -1
  235. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  236. package/dist/runnerUtility/serviceManager.d.ts +5 -2
  237. package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
  238. package/dist/runnerUtility/serviceManager.js +40 -17
  239. package/dist/runnerUtility/serviceManager.js.map +1 -1
  240. package/dist/runnerUtility/serviceUnits.d.ts +11 -0
  241. package/dist/runnerUtility/serviceUnits.d.ts.map +1 -1
  242. package/dist/runnerUtility/serviceUnits.js +8 -2
  243. package/dist/runnerUtility/serviceUnits.js.map +1 -1
  244. package/dist/runnerUtility/simulatorSilencer.d.ts +55 -0
  245. package/dist/runnerUtility/simulatorSilencer.d.ts.map +1 -0
  246. package/dist/runnerUtility/simulatorSilencer.js +203 -0
  247. package/dist/runnerUtility/simulatorSilencer.js.map +1 -0
  248. package/dist/runnerUtility/stopSignals.d.ts +10 -0
  249. package/dist/runnerUtility/stopSignals.d.ts.map +1 -0
  250. package/dist/runnerUtility/stopSignals.js +27 -0
  251. package/dist/runnerUtility/stopSignals.js.map +1 -0
  252. package/dist/runnerUtility/versionPollTiming.d.ts +2 -3
  253. package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -1
  254. package/dist/runnerUtility/versionPollTiming.js +4 -18
  255. package/dist/runnerUtility/versionPollTiming.js.map +1 -1
  256. package/dist/runners/bootstrapLine.d.ts.map +1 -1
  257. package/dist/runners/bootstrapLine.js +35 -19
  258. package/dist/runners/bootstrapLine.js.map +1 -1
  259. package/dist/runners/gate.d.ts.map +1 -1
  260. package/dist/runners/gate.js +28 -1
  261. package/dist/runners/gate.js.map +1 -1
  262. package/dist/runners/gateLink.d.ts +7 -0
  263. package/dist/runners/gateLink.d.ts.map +1 -1
  264. package/dist/runners/gateLink.js +36 -3
  265. package/dist/runners/gateLink.js.map +1 -1
  266. package/dist/runners/gateProtocol.d.ts +37 -2
  267. package/dist/runners/gateProtocol.d.ts.map +1 -1
  268. package/dist/runners/gateProtocol.js +45 -4
  269. package/dist/runners/gateProtocol.js.map +1 -1
  270. package/dist/runners/hubPackage.d.ts +2 -1
  271. package/dist/runners/hubPackage.d.ts.map +1 -1
  272. package/dist/runners/hubPackage.js +32 -11
  273. package/dist/runners/hubPackage.js.map +1 -1
  274. package/dist/runners/hubPairing.d.ts +1 -1
  275. package/dist/runners/hubPairing.d.ts.map +1 -1
  276. package/dist/runners/hubPairing.js +8 -1
  277. package/dist/runners/hubPairing.js.map +1 -1
  278. package/dist/runners/hubPaths.d.ts +2 -0
  279. package/dist/runners/hubPaths.d.ts.map +1 -1
  280. package/dist/runners/hubPaths.js +1 -1
  281. package/dist/runners/hubPaths.js.map +1 -1
  282. package/dist/runners/linkConcern.d.ts +75 -0
  283. package/dist/runners/linkConcern.d.ts.map +1 -0
  284. package/dist/runners/linkConcern.js +85 -0
  285. package/dist/runners/linkConcern.js.map +1 -0
  286. package/dist/runners/linkControl.d.ts +25 -1
  287. package/dist/runners/linkControl.d.ts.map +1 -1
  288. package/dist/runners/linkControl.js +46 -4
  289. package/dist/runners/linkControl.js.map +1 -1
  290. package/dist/runners/pairingTiming.d.ts +2 -3
  291. package/dist/runners/pairingTiming.d.ts.map +1 -1
  292. package/dist/runners/pairingTiming.js +4 -18
  293. package/dist/runners/pairingTiming.js.map +1 -1
  294. package/dist/runners/runnerLock.d.ts +112 -0
  295. package/dist/runners/runnerLock.d.ts.map +1 -0
  296. package/dist/runners/runnerLock.js +292 -0
  297. package/dist/runners/runnerLock.js.map +1 -0
  298. package/dist/runners/runnersCli.d.ts +6 -3
  299. package/dist/runners/runnersCli.d.ts.map +1 -1
  300. package/dist/runners/runnersCli.js +33 -6
  301. package/dist/runners/runnersCli.js.map +1 -1
  302. package/dist/runners/runnersList.d.ts +3 -3
  303. package/dist/runners/runnersList.d.ts.map +1 -1
  304. package/dist/runners/runnersList.js +9 -2
  305. package/dist/runners/runnersList.js.map +1 -1
  306. package/dist/runners/runnersOverview.d.ts +29 -3
  307. package/dist/runners/runnersOverview.d.ts.map +1 -1
  308. package/dist/runners/runnersOverview.js +71 -6
  309. package/dist/runners/runnersOverview.js.map +1 -1
  310. package/dist/runners/serviceRemoval.d.ts +43 -0
  311. package/dist/runners/serviceRemoval.d.ts.map +1 -0
  312. package/dist/runners/serviceRemoval.js +114 -0
  313. package/dist/runners/serviceRemoval.js.map +1 -0
  314. package/dist/scheduler/checkStatus.d.ts +78 -0
  315. package/dist/scheduler/checkStatus.d.ts.map +1 -0
  316. package/dist/scheduler/checkStatus.js +122 -0
  317. package/dist/scheduler/checkStatus.js.map +1 -0
  318. package/dist/scheduler/delivery.d.ts +27 -1
  319. package/dist/scheduler/delivery.d.ts.map +1 -1
  320. package/dist/scheduler/delivery.js +83 -6
  321. package/dist/scheduler/delivery.js.map +1 -1
  322. package/dist/scheduler/mcpSurface.d.ts +2 -0
  323. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  324. package/dist/scheduler/mcpSurface.js +62 -10
  325. package/dist/scheduler/mcpSurface.js.map +1 -1
  326. package/dist/scheduler/store.d.ts +16 -1
  327. package/dist/scheduler/store.d.ts.map +1 -1
  328. package/dist/scheduler/store.js +33 -0
  329. package/dist/scheduler/store.js.map +1 -1
  330. package/dist/scheduler/types.d.ts +22 -0
  331. package/dist/scheduler/types.d.ts.map +1 -1
  332. package/dist/scheduler/unbindPause.d.ts +27 -0
  333. package/dist/scheduler/unbindPause.d.ts.map +1 -0
  334. package/dist/scheduler/unbindPause.js +21 -0
  335. package/dist/scheduler/unbindPause.js.map +1 -0
  336. package/dist/scheduler/workerActivity.d.ts +25 -0
  337. package/dist/scheduler/workerActivity.d.ts.map +1 -0
  338. package/dist/scheduler/workerActivity.js +195 -0
  339. package/dist/scheduler/workerActivity.js.map +1 -0
  340. package/dist/scheduler/workerWatch.d.ts +14 -2
  341. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  342. package/dist/scheduler/workerWatch.js +15 -3
  343. package/dist/scheduler/workerWatch.js.map +1 -1
  344. package/dist/state.d.ts +8 -0
  345. package/dist/state.d.ts.map +1 -1
  346. package/dist/state.js +30 -0
  347. package/dist/state.js.map +1 -1
  348. package/dist/stt/sttRuntime.d.ts.map +1 -1
  349. package/dist/stt/sttRuntime.js +8 -1
  350. package/dist/stt/sttRuntime.js.map +1 -1
  351. package/dist/stt/sttSettings.d.ts +56 -6
  352. package/dist/stt/sttSettings.d.ts.map +1 -1
  353. package/dist/stt/sttSettings.js +128 -7
  354. package/dist/stt/sttSettings.js.map +1 -1
  355. package/dist/stt/sttSidecarOwner.d.ts +13 -5
  356. package/dist/stt/sttSidecarOwner.d.ts.map +1 -1
  357. package/dist/stt/sttSidecarOwner.js +72 -31
  358. package/dist/stt/sttSidecarOwner.js.map +1 -1
  359. package/dist/stt/transcribeChain.d.ts +23 -1
  360. package/dist/stt/transcribeChain.d.ts.map +1 -1
  361. package/dist/stt/transcribeChain.js +59 -4
  362. package/dist/stt/transcribeChain.js.map +1 -1
  363. package/dist/testTimings.d.ts +4 -2
  364. package/dist/testTimings.d.ts.map +1 -1
  365. package/dist/testTimings.js +7 -1
  366. package/dist/testTimings.js.map +1 -1
  367. package/dist/testTimingsSeam.d.ts +10 -0
  368. package/dist/testTimingsSeam.d.ts.map +1 -0
  369. package/dist/testTimingsSeam.js +29 -0
  370. package/dist/testTimingsSeam.js.map +1 -0
  371. package/dist/utils/runnersScreenPlan.d.ts +14 -0
  372. package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
  373. package/dist/utils/runnersScreenPlan.js +49 -5
  374. package/dist/utils/runnersScreenPlan.js.map +1 -1
  375. package/dist/utils/surrogateSafeCut.d.ts +14 -0
  376. package/dist/utils/surrogateSafeCut.d.ts.map +1 -0
  377. package/dist/utils/surrogateSafeCut.js +30 -0
  378. package/dist/utils/surrogateSafeCut.js.map +1 -0
  379. package/dist/utils/telegramError.d.ts +7 -0
  380. package/dist/utils/telegramError.d.ts.map +1 -1
  381. package/dist/utils/telegramError.js +15 -0
  382. package/dist/utils/telegramError.js.map +1 -1
  383. package/dist/utils/transientFrames.d.ts +51 -6
  384. package/dist/utils/transientFrames.d.ts.map +1 -1
  385. package/dist/utils/transientFrames.js +52 -2
  386. package/dist/utils/transientFrames.js.map +1 -1
  387. package/dist/voiceProgressNote.d.ts +73 -0
  388. package/dist/voiceProgressNote.d.ts.map +1 -0
  389. package/dist/voiceProgressNote.js +142 -0
  390. package/dist/voiceProgressNote.js.map +1 -0
  391. package/package.json +4 -1
  392. package/remoteRun/pickNode.sh +65 -0
  393. package/remoteRun/runner-package-lock.json +59 -0
  394. package/remoteRun/runner.sh +304 -6
package/dist/bot.js CHANGED
@@ -170,6 +170,7 @@ const topicView_1 = require("./utils/topicView");
170
170
  const topicRequest_1 = require("./utils/topicRequest");
171
171
  const serialQueue_1 = require("./utils/serialQueue");
172
172
  const voiceQueue_1 = require("./voiceQueue");
173
+ const voiceProgressNote_1 = require("./voiceProgressNote");
173
174
  const claudeLivenessAction_1 = require("./utils/claudeLivenessAction");
174
175
  const isoTimestamp_1 = require("./utils/isoTimestamp");
175
176
  const effortLevels_1 = require("./effortLevels");
@@ -195,6 +196,8 @@ const jsonStreamHost_1 = require("./utils/jsonStreamHost");
195
196
  const runLedger_1 = require("./scheduler/runLedger");
196
197
  const delivery_1 = require("./scheduler/delivery");
197
198
  const checkRun_1 = require("./scheduler/checkRun");
199
+ const checkStatus_1 = require("./scheduler/checkStatus");
200
+ const workerActivity_1 = require("./scheduler/workerActivity");
198
201
  const engine_1 = require("./scheduler/engine");
199
202
  const recurrence_1 = require("./scheduler/recurrence");
200
203
  const mcpSurface_1 = require("./scheduler/mcpSurface");
@@ -221,7 +224,8 @@ const wakeUpRules_1 = require("./requests/wakeUpRules");
221
224
  const requestHeader_1 = require("./requests/requestHeader");
222
225
  const directoryThreads_1 = require("./scheduler/directoryThreads");
223
226
  const rebindResume_1 = require("./scheduler/rebindResume");
224
- const deliveryKind_1 = require("./scheduler/deliveryKind");
227
+ const store_2 = require("./scheduler/store");
228
+ const unbindPause_1 = require("./scheduler/unbindPause");
225
229
  const apiErrorRetry_1 = require("./apiErrorRetry");
226
230
  const wedgeRecovery_1 = require("./utils/wedgeRecovery");
227
231
  const claudeAuthLogin_1 = require("./utils/claudeAuthLogin");
@@ -2334,19 +2338,19 @@ function getThreadMessageState(key) {
2334
2338
  const k = (0, sessionKey_1.keyToString)(key);
2335
2339
  let s = threadMessageStates.get(k);
2336
2340
  if (!s) {
2337
- s = { lastMessageId: null, lastMessageText: null, needsNewMessage: true, typingLoaderTimer: null, statusMessageId: null, thinkingMessageId: null, thinkingFrameGeneration: 0, statusFrameGeneration: 0, livenessTimer: null, lastActivityText: null, livenessGlyphIndex: 0, wasBusy: false, workingSince: null, lastLivenessSentAt: 0, statusIdleSuppressed: false, busyOnsetArmedUntil: 0, subagentStatusMessageId: null, subagentStartedAt: null, subagentTitle: null, subagentTimer: null, lastSubagentText: null, subagentEditInFlight: false };
2341
+ s = { lastMessageId: null, lastMessageText: null, needsNewMessage: true, typingLoaderTimer: null, statusMessageId: null, thinkingMessageId: null, thinkingFrameGeneration: 0, statusFrameGeneration: 0, livenessTimer: null, lastActivityText: null, livenessGlyphIndex: 0, wasBusy: false, workingSince: null, lastLivenessSentAt: 0, statusIdleSuppressed: false, busyOnsetArmedUntil: 0, subagentStatusMessageId: null, subagentStartedAt: null, subagentTitle: null, subagentTimer: null, lastSubagentText: null, subagentEditInFlight: false, voiceProgressNoteIds: [], undeletedMessageIds: [] };
2338
2342
  threadMessageStates.set(k, s);
2339
2343
  }
2340
2344
  return s;
2341
2345
  }
2342
2346
  /**
2343
- * @description Persist the thread's CURRENT transient status-frame ids (the
2344
- * non-null `statusMessageId` / `thinkingMessageId` / `subagentStatusMessageId`)
2345
- * so an UNGRACEFUL restart (crash / SIGKILL — no graceful sweep ran) can delete
2347
+ * @description Persist the thread's CURRENT transient message ids (the
2348
+ * non-null `statusMessageId` / `thinkingMessageId` / `subagentStatusMessageId`
2349
+ * and the `voiceProgressNoteIds` and `undeletedMessageIds`) so an UNGRACEFUL restart (crash / SIGKILL — no graceful sweep ran) can delete
2346
2350
  * whatever frame was on screen on the next boot (S2). The in-memory
2347
2351
  * `ThreadMessageState` is the live source of truth; this just keeps disk in step.
2348
- * Debounced + fire-and-forget. Single collection point shared by the three
2349
- * frame-id setters below so memory and disk never drift.
2352
+ * Debounced + fire-and-forget. Single collection point shared by the frame-id
2353
+ * setters below so memory and disk never drift.
2350
2354
  */
2351
2355
  function persistTransientFrames(key) {
2352
2356
  const ids = (0, transientFrames_1.getTransientFrameIds)(getThreadMessageState(key));
@@ -2371,6 +2375,21 @@ function setSubagentFrameId(key, id) {
2371
2375
  getThreadMessageState(key).subagentStatusMessageId = id;
2372
2376
  persistTransientFrames(key);
2373
2377
  }
2378
+ /** The voice notes' list is edited by value: a thread can have several, each owned by its own voice message. */
2379
+ function addVoiceProgressNoteId(key, id) {
2380
+ getThreadMessageState(key).voiceProgressNoteIds.push(id);
2381
+ persistTransientFrames(key);
2382
+ }
2383
+ function removeVoiceProgressNoteId(key, id) {
2384
+ const noteState = getThreadMessageState(key);
2385
+ noteState.voiceProgressNoteIds = noteState.voiceProgressNoteIds.filter((noteId) => noteId !== id);
2386
+ persistTransientFrames(key);
2387
+ }
2388
+ /** The leftovers still to delete (see {@link ThreadMessageState.undeletedMessageIds}): replaced as a whole, then mirrored to disk. */
2389
+ function setUndeletedMessageIds(key, ids) {
2390
+ getThreadMessageState(key).undeletedMessageIds = ids;
2391
+ persistTransientFrames(key);
2392
+ }
2374
2393
  function getOutputQueueState(key) {
2375
2394
  const k = (0, sessionKey_1.keyToString)(key);
2376
2395
  let s = outputQueues.get(k);
@@ -3138,7 +3157,7 @@ async function replyToThread(key, text, extra = {}, options = {}) {
3138
3157
  return null;
3139
3158
  const sendOnce = (sendExtra) => {
3140
3159
  const send = () => bot.telegram.sendMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), text, sendExtra);
3141
- return options.unpaced ? (0, rateLimiter_1.sendUnpaced)(key, send) : (0, rateLimiter_1.enqueueSend)(key, send);
3160
+ return options.unpaced ? (0, rateLimiter_1.sendUnpaced)(key, send, options.signal) : (0, rateLimiter_1.enqueueSend)(key, send, options.signal);
3142
3161
  };
3143
3162
  // A sent message is tracked for `/clear_messages`, and a `/bind` picker is remembered to be closed by the next bind or leave.
3144
3163
  const trackSent = async (sent) => {
@@ -3153,6 +3172,8 @@ async function replyToThread(key, text, extra = {}, options = {}) {
3153
3172
  return await trackSent(await sendOnce(buildSendExtra(key, extra)));
3154
3173
  }
3155
3174
  catch (e) {
3175
+ if (options.signal?.aborted && (0, utils_1.checkIsAbortError)(e))
3176
+ return null;
3156
3177
  // Markdown parse failure fallback. Several `t(...)` templates interpolate
3157
3178
  // user-controlled content (subdir names, branch names, error strings)
3158
3179
  // into Markdown body — a backtick or stray `*` inside the content
@@ -3199,20 +3220,27 @@ async function replyToThread(key, text, extra = {}, options = {}) {
3199
3220
  * rendering passes it.
3200
3221
  */
3201
3222
  async function editThreadMessage(key, messageId, text, extra = {}, plainFallbackText = text) {
3223
+ return (await editThreadMessageDetailed(key, messageId, text, extra, plainFallbackText)) === 'edited';
3224
+ }
3225
+ /**
3226
+ * @description {@link editThreadMessage} telling a message that is not there (deleted by hand: «message to edit not found») from any
3227
+ * other failure — see {@link ThreadMessageEdit}. The failure is logged either way, as before.
3228
+ */
3229
+ async function editThreadMessageDetailed(key, messageId, text, extra = {}, plainFallbackText = text) {
3202
3230
  if (!checkIsTelegramPrimitiveKey(key, 'editThreadMessage'))
3203
- return false;
3231
+ return 'failed';
3204
3232
  const editOnce = (editText, editExtra) => (0, rateLimiter_1.enqueueSend)(key, () => bot.telegram.editMessageText((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId, undefined, editText, editExtra));
3205
3233
  try {
3206
3234
  await editOnce(text, extra);
3207
- return true;
3235
+ return 'edited';
3208
3236
  }
3209
3237
  catch (e) {
3210
3238
  const desc = (0, sendErrorClassifier_1.checkIsApiError)(e) ? (0, sendErrorClassifier_1.getErrorDescription)(e) : '';
3211
3239
  if (/message is not modified/i.test(desc))
3212
- return true; // benign
3240
+ return 'edited'; // benign
3213
3241
  if (/thread not found|TOPIC_CLOSED|topic is closed/i.test(desc)) {
3214
3242
  await handleSendError(key, e);
3215
- return false;
3243
+ return 'failed';
3216
3244
  }
3217
3245
  // Symmetric markdown-parse-fail fallback to `replyToThread`. See the
3218
3246
  // long comment there — same rationale: prefer a plain-text edit over
@@ -3224,18 +3252,18 @@ async function editThreadMessage(key, messageId, text, extra = {}, plainFallback
3224
3252
  delete plainExtra.parse_mode;
3225
3253
  try {
3226
3254
  await editOnce(plainFallbackText, plainExtra);
3227
- return true;
3255
+ return 'edited';
3228
3256
  }
3229
3257
  catch (e2) {
3230
3258
  const desc2 = (0, sendErrorClassifier_1.checkIsApiError)(e2) ? (0, sendErrorClassifier_1.getErrorDescription)(e2) : '';
3231
3259
  if (/message is not modified/i.test(desc2))
3232
- return true;
3260
+ return 'edited';
3233
3261
  console.error(`[edit] ${(0, sessionKey_1.keyToString)(key)}#${messageId} retry failed:`, desc2 || e2);
3234
- return false;
3262
+ return (0, telegramError_1.checkIsMessageNotFoundError)(e2) ? 'gone' : 'failed';
3235
3263
  }
3236
3264
  }
3237
3265
  console.error(`[edit] ${(0, sessionKey_1.keyToString)(key)}#${messageId}:`, desc || e);
3238
- return false;
3266
+ return (0, telegramError_1.checkIsMessageNotFoundError)(e) ? 'gone' : 'failed';
3239
3267
  }
3240
3268
  }
3241
3269
  /**
@@ -3258,11 +3286,17 @@ async function editThreadKeyboard(key, messageId, keyboard, logTag) {
3258
3286
  return false;
3259
3287
  }
3260
3288
  }
3261
- async function deleteThreadMessageDetailed(key, messageId) {
3289
+ /**
3290
+ * @description {@link deleteThreadMessage} telling a message that was already gone from one that stayed — see {@link ThreadMessageDeletion}. None of them is logged: all are expected.
3291
+ * `isUnpaced` sends the delete outside the global pacer, for a message whose disappearance is part of an answer that is already
3292
+ * on screen (the «transcribing…» note, which must not outlive the 🎤 echo behind queued agent output).
3293
+ */
3294
+ async function deleteThreadMessageDetailed(key, messageId, options = {}) {
3262
3295
  if (!checkIsTelegramPrimitiveKey(key, 'deleteThreadMessage'))
3263
3296
  return 'stayed';
3264
3297
  try {
3265
- await (0, rateLimiter_1.enqueueSend)(key, () => bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId));
3298
+ const deleteMessage = () => bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId);
3299
+ await (options.isUnpaced ? (0, rateLimiter_1.sendUnpaced)(key, deleteMessage) : (0, rateLimiter_1.enqueueSend)(key, deleteMessage));
3266
3300
  return 'deleted';
3267
3301
  }
3268
3302
  catch (e) {
@@ -3772,7 +3806,7 @@ const shutdownFrameSweepMs = 1500;
3772
3806
  * them up orphans the messages forever in the topic (the reported incident:
3773
3807
  * ~25 hot reloads left "✽ работаю…" frames stuck; and a 🔧 tool status stranded
3774
3808
  * as a topic's last message when a hot reload landed mid-tool). Iterates every
3775
- * tracked thread, and for each {@link clearTransientFramesForShutdown} BUMPS both
3809
+ * tracked thread, and for each `clearTransientFramesForShutdown` (inside `sweepTransientMessages`) BUMPS both
3776
3810
  * frame generations (so a `sendStatusFrame`/thinking create still mid-`await`
3777
3811
  * discards its just-sent message instead of orphaning it — see that helper) and
3778
3812
  * nulls the in-memory ids so a racing per-thread tick can't re-edit a just-deleted
@@ -3784,43 +3818,52 @@ const shutdownFrameSweepMs = 1500;
3784
3818
  * an orphan after the sweep. Threads that had nothing on screen still skip the
3785
3819
  * (fire-and-forget) persist + delete work.
3786
3820
  *
3821
+ * A delete that fails for a reason a later try can fix (no answer from Telegram, a
3822
+ * 429, a 5xx) no longer forgets the message: the collected ids are PARKED in the
3823
+ * thread's in-memory `undeletedMessageIds` (the clear does that), the deletes run, and
3824
+ * the list is replaced by the ones to try again through `setUndeletedMessageIds` — the
3825
+ * same save every other writer of the persisted set uses, so a late frame setter or
3826
+ * note removal that persists the thread meanwhile still carries them, and so does a
3827
+ * sweep cut short by its bound. The next boot's {@link reconcileTransientFrames}
3828
+ * tries again. Final answers (already gone, too old, refused) settle an id.
3829
+ *
3787
3830
  * Wired into {@link gracefulShutdown} as `clearTransientFrames`: runs AFTER
3788
3831
  * `cleanupTimers()` (no interval re-creates a frame mid-sweep) and BEFORE
3789
3832
  * `bot.stop()` (the Telegram client must still send the deletes). Self-bounded by
3790
3833
  * {@link shutdownFrameSweepMs} — a slow API must not starve `state.flush()`.
3791
3834
  */
3792
3835
  async function sweepTransientFramesOnShutdown() {
3793
- const deletes = [];
3836
+ // The voice notes first: their timers and sends in flight are stopped and cleaned (bounded), so nothing can register an id
3837
+ // behind the sweep. `cleanupTimers` already started this; the sweep waits for it.
3838
+ await voiceProgressNotes.shutDown();
3839
+ const threads = [];
3794
3840
  for (const [keyStr, msgState] of threadMessageStates) {
3795
- let key;
3796
3841
  try {
3797
- key = (0, sessionKey_1.keyFromString)(keyStr);
3842
+ threads.push({ key: (0, sessionKey_1.keyFromString)(keyStr), state: msgState });
3798
3843
  }
3799
3844
  catch {
3800
3845
  continue;
3801
3846
  }
3802
- // Bump generations + null ids for EVERY tracked thread (fixes the racing
3803
- // create that resolves after the sweep). Only threads that HAD a frame on
3804
- // screen need the persist + delete.
3805
- const ids = (0, transientFrames_1.clearTransientFramesForShutdown)(msgState);
3806
- if (ids.length === 0)
3807
- continue;
3808
- for (const id of ids) {
3809
- deletes.push(bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), id).catch(() => { }));
3810
- }
3811
- // Clear the S2 persisted set too, so the next boot's reconciliation finds
3812
- // nothing to redo after a graceful exit.
3813
- state.setTransientFrames(key, []).catch(() => { });
3814
3847
  }
3815
- if (deletes.length === 0)
3816
- return;
3817
- await Promise.race([
3818
- Promise.allSettled(deletes),
3819
- new Promise((resolve) => {
3820
- const timer = setTimeout(resolve, shutdownFrameSweepMs);
3821
- timer.unref?.();
3822
- }),
3823
- ]);
3848
+ const sweeping = (0, transientFrames_1.sweepTransientMessages)(threads, {
3849
+ deleteMessage: async (key, messageId) => { await bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId); },
3850
+ checkIsRetryable: telegramError_1.checkIsRetryableTelegramError,
3851
+ saveKeptIds: setUndeletedMessageIds,
3852
+ logProblem: (line) => console.warn(line),
3853
+ });
3854
+ let boundTimer;
3855
+ try {
3856
+ await Promise.race([
3857
+ sweeping,
3858
+ new Promise((resolve) => {
3859
+ boundTimer = setTimeout(resolve, shutdownFrameSweepMs);
3860
+ boundTimer.unref?.();
3861
+ }),
3862
+ ]);
3863
+ }
3864
+ finally {
3865
+ clearTimeout(boundTimer);
3866
+ }
3824
3867
  }
3825
3868
  /**
3826
3869
  * Hard bound (ms) on the whole shutdown output flush (finalize + FIFO drain):
@@ -3974,7 +4017,7 @@ async function bootSttLocalEngine() {
3974
4017
  * precedes: queued behind agent output it could land after the retry already
3975
4018
  * succeeded.
3976
4019
  */
3977
- async function transcribeVoiceFile(key, filePath, durationSeconds) {
4020
+ async function transcribeVoiceFile(key, filePath, durationSeconds, warmedEndpoint) {
3978
4021
  const { engines, settings } = getResolvedSttSettings();
3979
4022
  if (engines.length === 0)
3980
4023
  return { ok: false, error: 'no speech engine available' };
@@ -3982,6 +4025,7 @@ async function transcribeVoiceFile(key, filePath, durationSeconds) {
3982
4025
  const result = await (0, transcribeChain_1.transcribeWithEngines)(filePath, engines, {
3983
4026
  durationSeconds,
3984
4027
  language: settings.language,
4028
+ warmedEndpoint,
3985
4029
  onFallback: ({ from, to, error }) => {
3986
4030
  console.warn(`[transcribe] ${from} failed (${error}); falling back to ${to}`);
3987
4031
  },
@@ -3999,6 +4043,33 @@ async function transcribeVoiceFile(key, filePath, durationSeconds) {
3999
4043
  }
4000
4044
  return result;
4001
4045
  }
4046
+ /**
4047
+ * The notes armed right now: a shutdown stops them (`cleanupTimers` and the sweep), so a timer that fires or a send that lands
4048
+ * after the sweep cannot strand a message past the last state flush.
4049
+ */
4050
+ const voiceProgressNotes = (0, voiceProgressNote_1.createVoiceProgressNoteRegistry)();
4051
+ /**
4052
+ * @description Arm the «🎙 Transcribing the voice message…» note for a voice message that just arrived in `key`. While the
4053
+ * local engine loads (up to 2 minutes, `src/stt/README.md`) the topic would show nothing and the voice would look lost; the note
4054
+ * appears only when the text is later than `voiceProgressNoteDelayMs`, is SILENT (a muted topic stays quiet, an unmuted one makes
4055
+ * no sound), goes out UNPACED like the 🎤 echo it makes way for, and is deleted unpaced the moment the text arrives or the
4056
+ * transcription fails (`VoiceProgressNote.finish`, which the voice job AWAITS before it answers — bounded, so a stalled delete
4057
+ * cannot hold the transcript back). Its id is kept in the thread's transient-message set, so a restart that kills the voice job
4058
+ * still deletes the note: the graceful sweep, or the next boot after a crash.
4059
+ */
4060
+ function startVoiceProgressNote(key) {
4061
+ return voiceProgressNotes.start({
4062
+ postNote: (signal) => replyToThread(key, withThreadLocale(key, () => (0, i18n_1.t)('voice.transcribing')), { disable_notification: true }, { unpaced: true, signal }),
4063
+ rememberNote: (messageId) => addVoiceProgressNoteId(key, messageId),
4064
+ deleteNote: async (messageId) => {
4065
+ const deletion = await deleteThreadMessageDetailed(key, messageId, { isUnpaced: true });
4066
+ // A note that stayed keeps its place in the set: the next sweep or boot retries it.
4067
+ if (deletion !== 'stayed')
4068
+ removeVoiceProgressNoteId(key, messageId);
4069
+ },
4070
+ logProblem: (line) => console.warn(line),
4071
+ });
4072
+ }
4002
4073
  // ═══════════════════════════════════════════════════════════════════════════════
4003
4074
  // Adapter lifecycle helpers
4004
4075
  // ═══════════════════════════════════════════════════════════════════════════════
@@ -5077,8 +5148,10 @@ const botCore = {
5077
5148
  getState: () => state,
5078
5149
  replyToThread,
5079
5150
  editThreadMessage,
5151
+ editThreadMessageDetailed,
5080
5152
  editThreadKeyboard,
5081
5153
  deleteThreadMessage,
5154
+ deleteThreadMessageDetailed,
5082
5155
  authoriseContext,
5083
5156
  withThreadLocale,
5084
5157
  checkIsGeneral,
@@ -5541,28 +5614,24 @@ async function stripWelcomeKeyboards(key, messageIds) {
5541
5614
  await (0, bindSweep_1.stripStaleKeyboards)(messageIds, (messageId) => editThreadKeyboard(key, messageId, null, 'welcome'));
5542
5615
  }
5543
5616
  /**
5544
- * @description Pause the AGENT-PROMPT schedules owned by `key` because its topic
5545
- * was just unbound (S8): flag each `isPaused` with reason `'unbound'`, disarm its
5546
- * timer, and post ONE notice naming the count (only when > 0). Scheduler pins are
5547
- * NOT touched (user decision: pins accumulate). Returns the number paused so the
5548
- * caller can decide whether anything happened. The engine stays generic — this
5549
- * unbound-specific policy lives here in bot.ts.
5550
- *
5551
- * Reminders are EXEMPT ({@link getUnboundPausableSchedules}): they post + pin with
5552
- * no agent and no folder, so pausing them on unbind would break the one kind that
5553
- * could still have fired. A thread holding only reminders pauses nothing and posts
5554
- * no notice.
5617
+ * @description The ports the status line's CLEARING runs over — shared by the scheduler's delivery (a failed run, a topic that
5618
+ * stopped showing the stream, the final run) and by the unbind pause, so the one `clearCheckStatusLine` works the same from both.
5619
+ * The delete is best effort (`deleteThreadMessage` never rejects: a message that is gone or too old to delete stays).
5555
5620
  */
5621
+ const checkStatusLinePorts = {
5622
+ recordStatusLine: (jobId, line) => (0, store_2.recordCheckStatusLine)(state, jobId, line),
5623
+ deleteMessage: async (threadKeyStr, messageId) => {
5624
+ await deleteThreadMessage((0, sessionKey_1.keyFromString)(threadKeyStr), messageId);
5625
+ },
5626
+ };
5627
+ /** @description The `/unbind` wiring of `pauseSchedulesOnUnbind` (`scheduler/unbindPause.ts`, which holds the policy) over the shared status-line ports. */
5556
5628
  async function pauseThreadSchedulesOnUnbind(key) {
5557
- const records = (0, deliveryKind_1.getUnboundPausableSchedules)(state.getThreadSchedules(key));
5558
- if (records.length === 0)
5559
- return 0;
5560
- for (const record of records) {
5561
- await state.setSchedulePaused(record.id, true, 'unbound');
5562
- schedulerEngine?.disarmJob(record.id);
5563
- }
5564
- await replyToThread(key, (0, i18n_1.t)('schedule.pausedUnbound', { count: records.length }));
5565
- return records.length;
5629
+ return (0, unbindPause_1.pauseSchedulesOnUnbind)({
5630
+ store: state,
5631
+ disarmJob: (jobId) => schedulerEngine?.disarmJob(jobId),
5632
+ statusLinePorts: checkStatusLinePorts,
5633
+ announcePaused: (count) => replyToThread(key, (0, i18n_1.t)('schedule.pausedUnbound', { count })),
5634
+ }, key);
5566
5635
  }
5567
5636
  /**
5568
5637
  * @description Resume the schedules paused for `'unbound'` on `key` when its
@@ -6605,6 +6674,11 @@ const { registerRunnersCommands, registerRunnersCallbacks, handleRunnersAddressT
6605
6674
  hub: runnersHub,
6606
6675
  // The pairing messages this instance sent: its own record (the hub registry is shared by every instance of the OS user).
6607
6676
  pairingMessagesPath: path.join((0, state_1.resolveDataDir)(), 'runner-pairing-messages.json'),
6677
+ // What this instance has told about where the runners' links come from: once per new concern, pinned in General.
6678
+ linkNoticesPath: path.join((0, state_1.resolveDataDir)(), 'runner-link-notices.json'),
6679
+ cacheDir: runnersCacheDir,
6680
+ getGeneralKey: () => getOperatorGeneralKey(),
6681
+ pinMessage: (key, messageId) => pinMessageQuiet(key, messageId, { disableNotification: false }),
6608
6682
  sweepExpiredCodes: async (nowMs) => { await (0, hubPairing_1.sweepExpiredPairings)(runnersHub, nowMs); },
6609
6683
  readRunnerHost: (0, instanceSettings_1.createRunnerHostReader)(() => (0, instanceSettings_1.getInstanceSettingsPath)(), (line) => console.error(line)),
6610
6684
  saveRunnerHost: (address) => (0, instanceSettings_1.saveInstanceSettingsChange)((0, instanceSettings_1.getInstanceSettingsPath)(), { runnerHost: address }),
@@ -8456,6 +8530,9 @@ bot.on((0, filters_1.message)('voice'), async (ctx) => {
8456
8530
  await replyToThread(key, (0, i18n_1.t)((0, sttSettings_1.getNoEngineNoticeCode)(sttSettings)));
8457
8531
  return;
8458
8532
  }
8533
+ // The local engine may be cold: start its load now, so it overlaps the download and the topic's voice queue. The voice's
8534
+ // job reuses this one ask, so the engine is started once per voice, whatever the outcome.
8535
+ const warmedEndpoint = (0, transcribeChain_1.warmUpFirstEngine)(sttSettings.engines, (line) => console.warn(line));
8459
8536
  // Offload the slow download+transcribe+forward off the telegraf update loop:
8460
8537
  // awaiting it here would stall intake of EVERY update until Groq replies
8461
8538
  // (up to 20s, longer on retries) and freeze the whole bot. The per-thread
@@ -8470,11 +8547,16 @@ bot.on((0, filters_1.message)('voice'), async (ctx) => {
8470
8547
  // Compute it HERE (only the handler has `ctx`); the job runs later off the
8471
8548
  // update loop and only sees `key`/`bot`.
8472
8549
  const replyBlock = getReplyQuoteBlock(key, ctx.message);
8550
+ // Armed LAST, right before the job is queued: nothing between here and the queue may throw and strand an armed note. The
8551
+ // clock runs from the voice's arrival, so a voice waiting in line behind an earlier one gets its note too; the job finishes it
8552
+ // the moment its text arrives, and the `finally` is the backstop for a job that never ran or ended some other way.
8553
+ const progressNote = startVoiceProgressNote(key);
8473
8554
  void (0, voiceQueue_1.getVoiceTranscriptionQueue)(key)
8474
- .run(() => processVoiceJob(key, fileId, durationSeconds, (0, topicRequest_1.getTopicRequesterId)(ctx.from), sentAtMs, replyBlock))
8555
+ .run(() => processVoiceJob(key, fileId, durationSeconds, (0, topicRequest_1.getTopicRequesterId)(ctx.from), warmedEndpoint, progressNote, sentAtMs, replyBlock))
8475
8556
  .catch((err) => {
8476
8557
  console.error('[Bot] Voice job error (already handled):', err);
8477
- });
8558
+ })
8559
+ .finally(() => progressNote.finish());
8478
8560
  });
8479
8561
  /**
8480
8562
  * @description Background worker for a single voice note: download → transcribe
@@ -8487,9 +8569,14 @@ bot.on((0, filters_1.message)('voice'), async (ctx) => {
8487
8569
  * take ~20s, so "now" at forward time would drift). `replyContext` is the
8488
8570
  * reply-quote block the handler built from `ctx.message` (a Telegram REPLY on
8489
8571
  * the voice note), plumbed here since the job no longer has `ctx`; so is
8490
- * `requesterId`, the sender the transcript's request is filed under.
8491
- */
8492
- async function processVoiceJob(key, fileId, durationSeconds, requesterId, sentAtMs, replyContext) {
8572
+ * `requesterId`, the sender the transcript's request is filed under, and
8573
+ * `warmedEndpoint`, the first engine's endpoint asked for when the note arrived
8574
+ * (the job reuses that one ask — see `warmUpFirstEngine`), and `progressNote`, the
8575
+ * «transcribing…» note armed on arrival, which the job finishes as soon as the
8576
+ * text is here or the voice failed — BEFORE the echo or the failure notice, never
8577
+ * at the end of the job (delivering the prompt may take long).
8578
+ */
8579
+ async function processVoiceJob(key, fileId, durationSeconds, requesterId, warmedEndpoint, progressNote, sentAtMs, replyContext) {
8493
8580
  try {
8494
8581
  // Audit S14 / #33: `getFileLink` builds the bot-token URL in one
8495
8582
  // place inside Telegraf instead of us materialising the token in a
@@ -8516,11 +8603,15 @@ async function processVoiceJob(key, fileId, durationSeconds, requesterId, sentAt
8516
8603
  catch (downloadErr) {
8517
8604
  const msg = downloadErr instanceof Error ? downloadErr.message : String(downloadErr);
8518
8605
  console.warn(`[Bot] voice download failed after retries: ${msg}`);
8606
+ await progressNote.finish();
8519
8607
  await replyToThread(key, `${(0, i18n_1.t)('voice.failed')} (${msg})`);
8520
8608
  return;
8521
8609
  }
8522
- const result = await transcribeVoiceFile(key, tempFile, durationSeconds);
8610
+ const result = await transcribeVoiceFile(key, tempFile, durationSeconds, warmedEndpoint);
8523
8611
  fs.unlink(tempFile, () => { });
8612
+ // Text or failure — either way the wait is over. The note is gone BEFORE the echo or the failure notice goes out (the finish is
8613
+ // bounded, so a stalled delete holds the answer back for a moment at most; what it cut short ends in the background).
8614
+ await progressNote.finish();
8524
8615
  if (!result.ok) {
8525
8616
  await replyToThread(key, `${(0, i18n_1.t)('voice.failed')} (${result.error})`);
8526
8617
  return;
@@ -8601,6 +8692,7 @@ async function processVoiceJob(key, fileId, durationSeconds, requesterId, sentAt
8601
8692
  }
8602
8693
  catch (err) {
8603
8694
  console.error('[Bot] Voice handling error:', err);
8695
+ await progressNote.finish();
8604
8696
  await replyToThread(key, 'Error processing voice message');
8605
8697
  }
8606
8698
  }
@@ -11926,26 +12018,30 @@ function healSchedulerMcpForActiveSessions() {
11926
12018
  }
11927
12019
  const defaultReconcileTransientFramesDeps = {
11928
12020
  deleteMessage: (chatId, messageId) => bot.telegram.deleteMessage(chatId, messageId),
11929
- persistFrames: persistTransientFrames,
12021
+ setUndeletedMessageIds,
12022
+ checkIsRetryable: telegramError_1.checkIsRetryableTelegramError,
11930
12023
  };
11931
12024
  /**
11932
- * @description Delete transient status frames left on screen by an UNGRACEFUL
11933
- * exit (crash / SIGKILL — the graceful shutdown sweep never ran), so a
11934
- * "✽ working…" / thinking / sub-agent frame doesn't stick forever in a topic
11935
- * (S2, the crash safety net behind S1). Deletes every id in the `orphaned`
11936
- * snapshot best-effort (swallowing "message not found" / too-old). The snapshot
11937
- * MUST be captured BEFORE reattach (see {@link startBot}): a reattached
11938
- * session's frame setters persist the fresh in-memory state and would clobber
11939
- * the live persisted set first. Every snapshot id is stale by definition (the
11940
- * fresh process holds no handle to it; a still-busy reattached session repaints
11941
- * its OWN fresh frame), so deleting is always safe. After deleting, re-persist
11942
- * the CURRENT live frame ids per thread so disk reflects post-reattach truth
11943
- * (the repainted frame's id, or empty) instead of the consumed stale ids. A
11944
- * graceful exit already cleared the set in its sweep, so this is normally a
11945
- * no-op.
11946
- */
11947
- function reconcileTransientFrames(orphaned, deps = defaultReconcileTransientFramesDeps) {
11948
- let deleted = 0;
12025
+ * @description Delete transient messages left on screen by an exit that did not
12026
+ * finish its own cleanup — a crash / SIGKILL (the graceful shutdown sweep never
12027
+ * ran) or a sweep whose deletes hit a bad moment: the "✽ working…" / thinking /
12028
+ * sub-agent frames and the «transcribing…» voice notes (S2, the crash safety net
12029
+ * behind S1). The snapshot MUST be captured BEFORE reattach (see {@link startBot}):
12030
+ * a reattached session's frame setters persist the fresh in-memory state and would
12031
+ * clobber the live persisted set first. Every snapshot id is stale by definition
12032
+ * (the fresh process holds no handle to it; a still-busy reattached session
12033
+ * repaints its OWN fresh frame), so deleting is always safe.
12034
+ *
12035
+ * The stale ids are first parked in the thread's `undeletedMessageIds` (persisted
12036
+ * with the live ids), then deleted; a delete that fails for a reason a later try can
12037
+ * fix (no answer from Telegram, a 429, a 5xx) KEEPS its id there — the next sweep and
12038
+ * the next boot retry it — while a final answer (already gone, too old to delete,
12039
+ * refused) settles it. Before, the persisted set was re-synced to the live ids at
12040
+ * once and a failed delete was forgotten: the frame stayed in the topic with no
12041
+ * record left. Resolves with how many stale ids were settled; never rejects.
12042
+ */
12043
+ async function reconcileTransientFrames(orphaned, deps = defaultReconcileTransientFramesDeps) {
12044
+ const threads = [];
11949
12045
  for (const [keyStr, ids] of Object.entries(orphaned)) {
11950
12046
  let key;
11951
12047
  try {
@@ -11956,17 +12052,21 @@ function reconcileTransientFrames(orphaned, deps = defaultReconcileTransientFram
11956
12052
  // keep booting. Tolerated-and-skipped, like restorePendingQuestions.
11957
12053
  continue;
11958
12054
  }
11959
- for (const id of ids) {
11960
- void deps.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), id).catch(() => { });
11961
- deleted += 1;
11962
- }
11963
- // Sync disk to the LIVE in-memory frames (post-reattach): a still-busy
11964
- // session that repainted a fresh frame keeps its new id; an idle one clears.
11965
- deps.persistFrames(key);
12055
+ deps.setUndeletedMessageIds(key, ids);
12056
+ threads.push({ key, ids });
11966
12057
  }
11967
- if (deleted > 0)
11968
- console.log(`[reattach] transient frames: deleted ${deleted} stale`);
11969
- return deleted;
12058
+ const settledCounts = await Promise.all(threads.map(async ({ key, ids }) => {
12059
+ const keptIds = await (0, transientFrames_1.deleteTransientMessages)(ids, async (messageId) => { await deps.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId); }, deps.checkIsRetryable);
12060
+ deps.setUndeletedMessageIds(key, keptIds);
12061
+ return ids.length - keptIds.length;
12062
+ }));
12063
+ const settled = settledCounts.reduce((total, count) => total + count, 0);
12064
+ const kept = threads.reduce((total, { ids }) => total + ids.length, 0) - settled;
12065
+ if (settled > 0)
12066
+ console.log(`[reattach] transient frames: deleted ${settled} stale`);
12067
+ if (kept > 0)
12068
+ console.warn(`[reattach] transient frames: ${kept} could not be deleted now; they stay recorded and are tried again at the next sweep and boot`);
12069
+ return settled;
11970
12070
  }
11971
12071
  /**
11972
12072
  * Bot composition for the reusable file-send service. Every gateway method
@@ -12228,6 +12328,7 @@ function wireScheduler(wiring) {
12228
12328
  const ledger = new runLedger_1.RunLedger();
12229
12329
  const delivery = (0, delivery_1.createScheduleDelivery)({
12230
12330
  ...createSessionPostDeps(),
12331
+ ...checkStatusLinePorts,
12231
12332
  announce: (threadKeyStr, text) => replyToThread((0, sessionKey_1.keyFromString)(threadKeyStr), text),
12232
12333
  pin: async (threadKeyStr, messageId, isSilent) => {
12233
12334
  const key = (0, sessionKey_1.keyFromString)(threadKeyStr);
@@ -12257,6 +12358,18 @@ function wireScheduler(wiring) {
12257
12358
  // Saved at once, like the failing flag: an id lost in a crash would leave its alert pinned for good.
12258
12359
  await state.flush();
12259
12360
  },
12361
+ checkIsStatusShown: (threadKeyStr) => {
12362
+ const key = (0, sessionKey_1.keyFromString)(threadKeyStr);
12363
+ return (0, checkStatus_1.checkIsCheckStatusShown)({ isTelegram: (0, sessionKeyCodec_1.checkIsTelegramKey)(key), view: state.getDisplayPrefs(key).view });
12364
+ },
12365
+ // The status line is the bot's own message: silent (a heartbeat must never notify) and never pinned. Nothing here reaches an agent.
12366
+ postStatus: (threadKeyStr, text) => replyToThread((0, sessionKey_1.keyFromString)(threadKeyStr), text, { disable_notification: true }),
12367
+ readWorkerActivity: async (threadKeyStr, runDir) => {
12368
+ const decision = (0, validation_1.resolveBoundWorkDir)(ENV.workRoot, state.getBinding((0, sessionKey_1.keyFromString)(threadKeyStr)));
12369
+ // A relative run directory is read from the bound folder, like a check command's working directory.
12370
+ return decision.kind === 'proceed' ? (0, workerActivity_1.readWorkerActivity)(path.resolve(decision.workDir, runDir)) : null;
12371
+ },
12372
+ statusIntervalOverrideMs: ENV.testTimings.checkStatusIntervalMs,
12260
12373
  });
12261
12374
  /**
12262
12375
  * The engine's deliver callback: the S4 pipeline plus the S8 unbound-pause
@@ -12297,6 +12410,8 @@ function wireScheduler(wiring) {
12297
12410
  for (const messageId of messageIds)
12298
12411
  await unpinMessageQuiet(key, messageId);
12299
12412
  },
12413
+ // A cancelled check's status line goes through the same best-effort delete the delivery uses.
12414
+ deleteMessage: checkStatusLinePorts.deleteMessage,
12300
12415
  // Routed through the outbound seam: the agent-facing file tool is a
12301
12416
  // connector delivery, not a direct call into the Telegram send pipeline.
12302
12417
  // The MCP surface is string-keyed (its `threadKey` arrives as text), so the
@@ -12946,7 +13061,7 @@ async function startBot() {
12946
13061
  // repaint). A graceful exit already cleared the set in its sweep, so this
12947
13062
  // is normally a no-op. Uses the pre-reattach snapshot (the setters clobber
12948
13063
  // the live persisted set during reattach).
12949
- reconcileTransientFrames(orphanedTransientFrames);
13064
+ void reconcileTransientFrames(orphanedTransientFrames).catch((error) => console.error('[reattach] transient frame cleanup failed:', error));
12950
13065
  },
12951
13066
  // The bot MCP tools that read session state (compact_conversation) wait
12952
13067
  // for this: until now a surviving session would read as not running.
@@ -13167,6 +13282,9 @@ async function startBot() {
13167
13282
  // A hot worker's reload keeps the sidecar for the next worker to adopt; the supervisor stops it for good.
13168
13283
  stopSidecars: (0, installManager_1.checkIsOpenCodeExternalHost)() ? undefined : () => sttOwner.stop(),
13169
13284
  cleanupTimers: () => {
13285
+ // Voice notes that have not posted yet stop NOW (timers cleared, unstarted sends cancelled); the cleanup of the ones on
13286
+ // screen or in flight runs on, and the sweep waits for it.
13287
+ void voiceProgressNotes.shutDown();
13170
13288
  clearInterval(inMemoryGcInterval);
13171
13289
  clearInterval(heartbeatInterval);
13172
13290
  clearInterval(fileSweepInterval);