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
@@ -1,13 +1,18 @@
1
1
  /**
2
- * @description Pure collector for a thread's TRANSIENT status-frame message ids
3
- * — the three SEPARATE bot messages the turn lifecycle creates-then-deletes:
2
+ * @description Pure collector for a thread's TRANSIENT message ids — the bot
3
+ * messages that are created, shown for a moment and deleted again:
4
4
  *
5
5
  * - `statusMessageId` — the "✽ working…" liveness/spinner frame
6
6
  * - `thinkingMessageId` — the live "☁️ thinking …" chain-of-thought frame
7
7
  * - `subagentStatusMessageId` — the dedicated "🤖 sub-agent …" delegation frame
8
+ * - `voiceProgressNoteIds` — the "🎙 Transcribing the voice message…" notes (one per
9
+ * voice message still waiting for its text, so a list)
10
+ * - `undeletedMessageIds` — leftovers of an earlier process whose delete FAILED in a way a
11
+ * retry can fix (a network error, a 429, a 5xx): kept so the next
12
+ * sweep / boot tries again instead of forgetting them
8
13
  *
9
- * Returns only the non-null ones, in that fixed order, so the graceful-shutdown
10
- * sweep and the boot reconciliation can delete exactly the frames currently on
14
+ * Returns only the ones on screen, in that fixed order, so the graceful-shutdown
15
+ * sweep and the boot reconciliation can delete exactly the messages currently on
11
16
  * screen. These ids live ONLY in volatile in-memory `ThreadMessageState`, so a
12
17
  * restart that doesn't clean them up orphans the messages forever in the topic.
13
18
  *
@@ -20,6 +25,8 @@ export interface TransientFrameState {
20
25
  statusMessageId: number | null;
21
26
  thinkingMessageId: number | null;
22
27
  subagentStatusMessageId: number | null;
28
+ voiceProgressNoteIds: readonly number[];
29
+ undeletedMessageIds: readonly number[];
23
30
  }
24
31
  export declare function getTransientFrameIds(state: TransientFrameState): number[];
25
32
  /**
@@ -33,8 +40,13 @@ export interface ShutdownFrameState extends TransientFrameState {
33
40
  }
34
41
  /**
35
42
  * @description Graceful-shutdown clear of a thread's transient frames: returns the
36
- * ids currently on screen (for the caller to delete), then bumps BOTH frame
37
- * generations and nulls all three ids.
43
+ * ids currently on screen (for the caller to delete), bumps BOTH frame
44
+ * generations, nulls the frame fields and empties the voice notes' list — and PARKS
45
+ * every collected id in `undeletedMessageIds`, the thread's list of messages still
46
+ * to delete. The caller deletes them and replaces that list with the ones to try
47
+ * again; until then ANY save of the thread's transient ids — a late frame setter, a
48
+ * late note removal, which rewrite the persisted set from memory — still carries
49
+ * every pending id. (Keeping the retained ids only on disk let such a save drop them.)
38
50
  *
39
51
  * The generation bump is the load-bearing part, and the reason this must run for
40
52
  * EVERY tracked thread — including one whose ids are all null right now. A
@@ -49,4 +61,37 @@ export interface ShutdownFrameState extends TransientFrameState {
49
61
  * so it sat outside that race protection.
50
62
  */
51
63
  export declare function clearTransientFramesForShutdown(state: ShutdownFrameState): number[];
64
+ /**
65
+ * @description Delete transient messages and say which ones must be KEPT for a later try. A delete that fails in a way a
66
+ * retry can fix (`checkIsRetryable`: no answer from Telegram, a 429, a 5xx) keeps its id; one that succeeded, found the message
67
+ * already gone, or was refused for good (a message Telegram will not delete, a chat the bot left) is settled — keeping it would
68
+ * only retry what can never work. Never rejects. The one place the shutdown sweep and the boot reconciliation share, so neither
69
+ * can forget a message whose delete merely hit a bad moment (the stranded frame would stay in the topic with no record left).
70
+ */
71
+ export declare function deleteTransientMessages(messageIds: readonly number[], deleteMessage: (messageId: number) => Promise<void>, checkIsRetryable: (error: unknown) => boolean): Promise<number[]>;
72
+ export interface TransientSweepThread<Key> {
73
+ key: Key;
74
+ state: ShutdownFrameState;
75
+ }
76
+ export interface TransientSweepPorts<Key> {
77
+ deleteMessage: (key: Key, messageId: number) => Promise<void>;
78
+ checkIsRetryable: (error: unknown) => boolean;
79
+ /**
80
+ * Replace the thread's pending-delete list (`undeletedMessageIds`, in memory) with `keptIds` — the ones whose delete must be
81
+ * tried again at the next start (none: the list empties) — and save it with the thread's other transient ids through the one
82
+ * save every writer of the set uses. Synchronous: it replaces the list in memory and schedules the disk write, which the
83
+ * shutdown's `state.flush()` lands — the sweep does not wait for the disk. Must not throw. Called once the deletes have
84
+ * settled; until then the list holds every collected id (see {@link clearTransientFramesForShutdown}), so a save that
85
+ * interleaves, or a sweep cut short by its time bound, leaves a complete record for the boot reconciliation.
86
+ */
87
+ saveKeptIds: (key: Key, keptIds: number[]) => void;
88
+ logProblem: (line: string) => void;
89
+ }
90
+ /**
91
+ * @description The graceful-shutdown sweep over every tracked thread: {@link clearTransientFramesForShutdown} for EACH (the
92
+ * generation bump must reach a thread whose ids are all null too), then the messages that were on screen are deleted in
93
+ * parallel and the ones that could not be deleted yet stay in the thread's pending list, which is saved with its other ids.
94
+ * Resolves when every thread's deletes have settled (the ports must not throw, so it never rejects). The caller bounds the wait.
95
+ */
96
+ export declare function sweepTransientMessages<Key>(threads: readonly TransientSweepThread<Key>[], ports: TransientSweepPorts<Key>): Promise<void>;
52
97
  //# sourceMappingURL=transientFrames.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transientFrames.d.ts","sourceRoot":"","sources":["../../src/utils/transientFrames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAMzE;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC7D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAQnF"}
1
+ {"version":3,"file":"transientFrames.d.ts","sourceRoot":"","sources":["../../src/utils/transientFrames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,oBA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,EAAE,EAC7C,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAYf"}
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTransientFrameIds = getTransientFrameIds;
4
4
  exports.clearTransientFramesForShutdown = clearTransientFramesForShutdown;
5
+ exports.deleteTransientMessages = deleteTransientMessages;
6
+ exports.sweepTransientMessages = sweepTransientMessages;
5
7
  function getTransientFrameIds(state) {
6
8
  const ids = [];
7
9
  if (state.statusMessageId !== null)
@@ -10,12 +12,18 @@ function getTransientFrameIds(state) {
10
12
  ids.push(state.thinkingMessageId);
11
13
  if (state.subagentStatusMessageId !== null)
12
14
  ids.push(state.subagentStatusMessageId);
15
+ ids.push(...state.voiceProgressNoteIds, ...state.undeletedMessageIds);
13
16
  return ids;
14
17
  }
15
18
  /**
16
19
  * @description Graceful-shutdown clear of a thread's transient frames: returns the
17
- * ids currently on screen (for the caller to delete), then bumps BOTH frame
18
- * generations and nulls all three ids.
20
+ * ids currently on screen (for the caller to delete), bumps BOTH frame
21
+ * generations, nulls the frame fields and empties the voice notes' list — and PARKS
22
+ * every collected id in `undeletedMessageIds`, the thread's list of messages still
23
+ * to delete. The caller deletes them and replaces that list with the ones to try
24
+ * again; until then ANY save of the thread's transient ids — a late frame setter, a
25
+ * late note removal, which rewrite the persisted set from memory — still carries
26
+ * every pending id. (Keeping the retained ids only on disk let such a save drop them.)
19
27
  *
20
28
  * The generation bump is the load-bearing part, and the reason this must run for
21
29
  * EVERY tracked thread — including one whose ids are all null right now. A
@@ -36,6 +44,48 @@ function clearTransientFramesForShutdown(state) {
36
44
  state.statusMessageId = null;
37
45
  state.thinkingMessageId = null;
38
46
  state.subagentStatusMessageId = null;
47
+ state.voiceProgressNoteIds = [];
48
+ state.undeletedMessageIds = ids;
39
49
  return ids;
40
50
  }
51
+ /**
52
+ * @description Delete transient messages and say which ones must be KEPT for a later try. A delete that fails in a way a
53
+ * retry can fix (`checkIsRetryable`: no answer from Telegram, a 429, a 5xx) keeps its id; one that succeeded, found the message
54
+ * already gone, or was refused for good (a message Telegram will not delete, a chat the bot left) is settled — keeping it would
55
+ * only retry what can never work. Never rejects. The one place the shutdown sweep and the boot reconciliation share, so neither
56
+ * can forget a message whose delete merely hit a bad moment (the stranded frame would stay in the topic with no record left).
57
+ */
58
+ async function deleteTransientMessages(messageIds, deleteMessage, checkIsRetryable) {
59
+ const keptIds = await Promise.all(messageIds.map(async (messageId) => {
60
+ try {
61
+ await deleteMessage(messageId);
62
+ return null;
63
+ }
64
+ catch (error) {
65
+ return checkIsRetryable(error) ? messageId : null;
66
+ }
67
+ }));
68
+ return keptIds.filter((messageId) => messageId !== null);
69
+ }
70
+ /**
71
+ * @description The graceful-shutdown sweep over every tracked thread: {@link clearTransientFramesForShutdown} for EACH (the
72
+ * generation bump must reach a thread whose ids are all null too), then the messages that were on screen are deleted in
73
+ * parallel and the ones that could not be deleted yet stay in the thread's pending list, which is saved with its other ids.
74
+ * Resolves when every thread's deletes have settled (the ports must not throw, so it never rejects). The caller bounds the wait.
75
+ */
76
+ async function sweepTransientMessages(threads, ports) {
77
+ const settlements = [];
78
+ for (const { key, state } of threads) {
79
+ const messageIds = clearTransientFramesForShutdown(state);
80
+ if (messageIds.length === 0)
81
+ continue;
82
+ settlements.push((async () => {
83
+ const keptIds = await deleteTransientMessages(messageIds, (messageId) => ports.deleteMessage(key, messageId), ports.checkIsRetryable);
84
+ if (keptIds.length > 0)
85
+ ports.logProblem(`[shutdown] ${keptIds.length} transient message(s) could not be deleted now; they stay recorded for the next start`);
86
+ ports.saveKeptIds(key, keptIds);
87
+ })());
88
+ }
89
+ await Promise.all(settlements);
90
+ }
41
91
  //# sourceMappingURL=transientFrames.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transientFrames.js","sourceRoot":"","sources":["../../src/utils/transientFrames.ts"],"names":[],"mappings":";;AAwBA,oDAMC;AA6BD,0EAQC;AA3CD,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IAAI,CAAC,CAAC;AAChF,CAAC;AAsBD;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAA6C,EAC7C,KAA+B;IAE/B,MAAM,WAAW,GAAoB,EAAE,CAAC;IACxC,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC;QACrC,MAAM,UAAU,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACtC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE;YAC3B,MAAM,OAAO,GAAG,MAAM,uBAAuB,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;gBAAE,KAAK,CAAC,UAAU,CAAC,cAAc,OAAO,CAAC,MAAM,uFAAuF,CAAC,CAAC;YAC9J,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,EAAE,CAAC,CAAC;IACR,CAAC;IACD,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @description The «transcribing…» note of a voice message: a silent message in the topic that appears only when the
3
+ * text is late and is deleted the moment the text arrives (or the transcription fails). A warm engine answers within
4
+ * {@link voiceProgressNoteDelayMs} and the topic shows nothing; a local engine that is still loading its model (up to 2
5
+ * minutes, see `stt/README.md`) would otherwise leave the topic silent, and the voice note would look lost.
6
+ *
7
+ * Pure timing over three ports — the bot posts and deletes the message and keeps the id where a restart can still clean it
8
+ * up (`bot.ts`, the transient-message set). Nothing here rejects: a note is cosmetic and must never fail a voice, and it must
9
+ * never hold the answer back for long: {@link VoiceProgressNote.finish} waits for the cleanup at most
10
+ * {@link voiceProgressNoteCleanupBudgetMs}; a cleanup that is still going then ends by itself in the background.
11
+ */
12
+ /**
13
+ * How long a voice message may wait for its text before the topic gets the note. Counted from the moment the voice
14
+ * ARRIVES, so a voice waiting in line behind an earlier one in the same topic gets its note too. Long enough that a
15
+ * warm engine (recognition ≈ 1.5 s for an 18 s voice) and a hosted one never flash it.
16
+ */
17
+ export declare const voiceProgressNoteDelayMs = 3000;
18
+ /**
19
+ * How long the voice's own job (and the shutdown) waits for the note to be gone before it goes on with the answer. A delete is
20
+ * one Bot API round trip (tens of milliseconds); this bound is for a stalled one — a 429 wait, a dead connection — which must
21
+ * not hold the 🎤 transcript back. What the bound cuts short is not abandoned: it finishes in the background.
22
+ */
23
+ export declare const voiceProgressNoteCleanupBudgetMs = 1500;
24
+ export interface VoiceProgressNotePorts {
25
+ /**
26
+ * Send the silent note. Resolves its message id, or `null` when nothing was sent (the sender reports its own failure, and
27
+ * stays quiet about a send that `signal` cancelled). `signal` aborts a send that has NOT started yet — one waiting out a 429;
28
+ * a request already on the wire cannot be called back.
29
+ */
30
+ postNote: (signal: AbortSignal) => Promise<number | null>;
31
+ /** The note is on screen and still wanted: keep its id where a restart can find it. */
32
+ rememberNote: (messageId: number) => void;
33
+ /** Delete a note that was sent, and forget it. Best effort: a message that is already gone is no failure. */
34
+ deleteNote: (messageId: number) => Promise<void>;
35
+ /** A port threw, which it should not: one line for the log, the voice goes on. */
36
+ logProblem: (line: string) => void;
37
+ }
38
+ export interface VoiceProgressNote {
39
+ /**
40
+ * The text is here (or the transcription failed, or the voice was dropped): no note is posted from now on, a send that has
41
+ * not started is cancelled, and a note that is on screen — or being sent right now — is deleted. Resolves when the note is
42
+ * gone, or after {@link voiceProgressNoteCleanupBudgetMs} when the cleanup stalls (it then goes on in the background: a send
43
+ * that lands late is deleted at once and never remembered). Safe to call any number of times; never rejects.
44
+ */
45
+ finish: () => Promise<void>;
46
+ }
47
+ export interface VoiceProgressNoteOptions {
48
+ delayMs?: number;
49
+ cleanupBudgetMs?: number;
50
+ /** Called once when the cleanup after `finish()` has fully ended — also when `finish()` stopped waiting for it. */
51
+ onSettled?: () => void;
52
+ }
53
+ /**
54
+ * @description Arm the note for one voice message. Call it when the voice arrives and {@link VoiceProgressNote.finish}
55
+ * when its text arrives or the transcription fails; an armed note that is never finished posts itself after the delay.
56
+ */
57
+ export declare function createVoiceProgressNote(ports: VoiceProgressNotePorts, options?: VoiceProgressNoteOptions): VoiceProgressNote;
58
+ export interface VoiceProgressNoteRegistry {
59
+ /** Arm a note. After {@link shutDown} began, an inert one: it never posts anything. */
60
+ start: (ports: VoiceProgressNotePorts) => VoiceProgressNote;
61
+ /**
62
+ * The bot is shutting down: every note that is armed stops posting (timers cleared, unstarted sends cancelled) and gets
63
+ * cleaned up — a note on screen is deleted, a send in flight is waited for (bounded) and its message deleted when it lands.
64
+ * The stopping part runs synchronously, before the first await, so it can sit in a sync shutdown step. Idempotent.
65
+ */
66
+ shutDown: () => Promise<void>;
67
+ }
68
+ /**
69
+ * @description The notes that are armed right now, so a shutdown can stop them: the timer of a note and its send in flight
70
+ * belong to nobody else, and one that fires or lands after the shutdown sweep would strand a message past the final state flush.
71
+ */
72
+ export declare function createVoiceProgressNoteRegistry(options?: VoiceProgressNoteOptions): VoiceProgressNoteRegistry;
73
+ //# sourceMappingURL=voiceProgressNote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceProgressNote.d.ts","sourceRoot":"","sources":["../src/voiceProgressNote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,OAAQ,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1D,uFAAuF;IACvF,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,6GAA6G;IAC7G,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,kFAAkF;IAClF,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mHAAmH;IACnH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAiBD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,GAAE,wBAA6B,GACrC,iBAAiB,CAmEnB;AAED,MAAM,WAAW,yBAAyB;IACxC,uFAAuF;IACvF,KAAK,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,iBAAiB,CAAC;IAC5D;;;;OAIG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAID;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,GAAE,wBAA6B,GAAG,yBAAyB,CAkBjH"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ /**
3
+ * @description The «transcribing…» note of a voice message: a silent message in the topic that appears only when the
4
+ * text is late and is deleted the moment the text arrives (or the transcription fails). A warm engine answers within
5
+ * {@link voiceProgressNoteDelayMs} and the topic shows nothing; a local engine that is still loading its model (up to 2
6
+ * minutes, see `stt/README.md`) would otherwise leave the topic silent, and the voice note would look lost.
7
+ *
8
+ * Pure timing over three ports — the bot posts and deletes the message and keeps the id where a restart can still clean it
9
+ * up (`bot.ts`, the transient-message set). Nothing here rejects: a note is cosmetic and must never fail a voice, and it must
10
+ * never hold the answer back for long: {@link VoiceProgressNote.finish} waits for the cleanup at most
11
+ * {@link voiceProgressNoteCleanupBudgetMs}; a cleanup that is still going then ends by itself in the background.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.voiceProgressNoteCleanupBudgetMs = exports.voiceProgressNoteDelayMs = void 0;
15
+ exports.createVoiceProgressNote = createVoiceProgressNote;
16
+ exports.createVoiceProgressNoteRegistry = createVoiceProgressNoteRegistry;
17
+ /**
18
+ * How long a voice message may wait for its text before the topic gets the note. Counted from the moment the voice
19
+ * ARRIVES, so a voice waiting in line behind an earlier one in the same topic gets its note too. Long enough that a
20
+ * warm engine (recognition ≈ 1.5 s for an 18 s voice) and a hosted one never flash it.
21
+ */
22
+ exports.voiceProgressNoteDelayMs = 3_000;
23
+ /**
24
+ * How long the voice's own job (and the shutdown) waits for the note to be gone before it goes on with the answer. A delete is
25
+ * one Bot API round trip (tens of milliseconds); this bound is for a stalled one — a 429 wait, a dead connection — which must
26
+ * not hold the 🎤 transcript back. What the bound cuts short is not abandoned: it finishes in the background.
27
+ */
28
+ exports.voiceProgressNoteCleanupBudgetMs = 1_500;
29
+ /** `pending`, or the end of `budgetMs`, whichever comes first; `pending` itself runs on either way. */
30
+ async function waitAtMost(pending, budgetMs) {
31
+ let timer;
32
+ const budget = new Promise((resolve) => { timer = setTimeout(resolve, budgetMs); });
33
+ try {
34
+ await Promise.race([pending, budget]);
35
+ }
36
+ finally {
37
+ clearTimeout(timer);
38
+ }
39
+ }
40
+ function describeError(error) {
41
+ return error instanceof Error ? error.message : 'unknown error';
42
+ }
43
+ /**
44
+ * @description Arm the note for one voice message. Call it when the voice arrives and {@link VoiceProgressNote.finish}
45
+ * when its text arrives or the transcription fails; an armed note that is never finished posts itself after the delay.
46
+ */
47
+ function createVoiceProgressNote(ports, options = {}) {
48
+ const delayMs = options.delayMs ?? exports.voiceProgressNoteDelayMs;
49
+ const cleanupBudgetMs = options.cleanupBudgetMs ?? exports.voiceProgressNoteCleanupBudgetMs;
50
+ const sendAbort = new AbortController();
51
+ let isFinished = false;
52
+ let postedMessageId = null;
53
+ let posting = Promise.resolve();
54
+ let cleanup = null;
55
+ const removeNote = async () => {
56
+ const messageId = postedMessageId;
57
+ if (messageId === null)
58
+ return;
59
+ // Taken before the await: a second caller must not delete the same note twice.
60
+ postedMessageId = null;
61
+ try {
62
+ await ports.deleteNote(messageId);
63
+ }
64
+ catch (error) {
65
+ ports.logProblem(`[voice] could not delete the transcribing note: ${describeError(error)}`);
66
+ }
67
+ };
68
+ const postNote = async () => {
69
+ let messageId;
70
+ try {
71
+ messageId = await ports.postNote(sendAbort.signal);
72
+ }
73
+ catch (error) {
74
+ if (!sendAbort.signal.aborted)
75
+ ports.logProblem(`[voice] could not post the transcribing note: ${describeError(error)}`);
76
+ return;
77
+ }
78
+ if (messageId === null)
79
+ return;
80
+ postedMessageId = messageId;
81
+ // The text came (or the bot is shutting down) while the note was on its way: it is deleted at once and never remembered as live.
82
+ if (isFinished) {
83
+ await removeNote();
84
+ return;
85
+ }
86
+ try {
87
+ ports.rememberNote(messageId);
88
+ }
89
+ catch (error) {
90
+ ports.logProblem(`[voice] could not remember the transcribing note: ${describeError(error)}`);
91
+ }
92
+ };
93
+ const timer = setTimeout(() => {
94
+ if (!isFinished)
95
+ posting = postNote();
96
+ }, delayMs);
97
+ // An armed note never keeps a stopping process alive.
98
+ timer.unref?.();
99
+ const runCleanup = async () => {
100
+ try {
101
+ await posting;
102
+ await removeNote();
103
+ }
104
+ finally {
105
+ options.onSettled?.();
106
+ }
107
+ };
108
+ return {
109
+ finish: async () => {
110
+ isFinished = true;
111
+ clearTimeout(timer);
112
+ sendAbort.abort();
113
+ cleanup ??= runCleanup();
114
+ await waitAtMost(cleanup, cleanupBudgetMs);
115
+ },
116
+ };
117
+ }
118
+ const inertNote = { finish: async () => { } };
119
+ /**
120
+ * @description The notes that are armed right now, so a shutdown can stop them: the timer of a note and its send in flight
121
+ * belong to nobody else, and one that fires or lands after the shutdown sweep would strand a message past the final state flush.
122
+ */
123
+ function createVoiceProgressNoteRegistry(options = {}) {
124
+ const activeNotes = new Set();
125
+ let shutDownPromise = null;
126
+ return {
127
+ start: (ports) => {
128
+ if (shutDownPromise !== null)
129
+ return inertNote;
130
+ const note = createVoiceProgressNote(ports, { ...options, onSettled: () => { activeNotes.delete(note); } });
131
+ activeNotes.add(note);
132
+ return note;
133
+ },
134
+ shutDown: () => {
135
+ shutDownPromise ??= (async () => {
136
+ await Promise.all([...activeNotes].map((note) => note.finish()));
137
+ })();
138
+ return shutDownPromise;
139
+ },
140
+ };
141
+ }
142
+ //# sourceMappingURL=voiceProgressNote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voiceProgressNote.js","sourceRoot":"","sources":["../src/voiceProgressNote.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAmEH,0DAsEC;AAmBD,0EAkBC;AA5KD;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,KAAK,CAAC;AAE9C;;;;GAIG;AACU,QAAA,gCAAgC,GAAG,KAAK,CAAC;AAkCtD,uGAAuG;AACvG,KAAK,UAAU,UAAU,CAAC,OAAsB,EAAE,QAAgB;IAChE,IAAI,KAAiC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACxC,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAA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AI,eAAe,GAAyB,IAAI,CAAC;IAEjD,OAAO;QACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;YACf,IAAI,eAAe,KAAK,IAAI;gBAAE,OAAO,SAAS,CAAC;YAC/C,MAAM,IAAI,GAAsB,uBAAuB,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC/H,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE;YACb,eAAe,KAAK,CAAC,KAAK,IAAI,EAAE;gBAC9B,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,EAAE,CAAC;YACL,OAAO,eAAe,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "charness",
3
- "version": "3.9.0",
3
+ "version": "3.10.0",
4
4
  "license": "MIT",
5
5
  "author": "Sergei Solo",
6
6
  "description": "Harness for running Claude Code / OpenCode agents in the cloud or on your laptop, controlled from Telegram or Jira.",
@@ -32,6 +32,8 @@
32
32
  "dist/",
33
33
  "stt/gigaam_sidecar.py",
34
34
  "remoteRun/runner.sh",
35
+ "remoteRun/runner-package-lock.json",
36
+ "remoteRun/pickNode.sh",
35
37
  "agent-plugin/",
36
38
  "CHANGELOG.md",
37
39
  "README.md",
@@ -69,6 +71,7 @@
69
71
  "hot": "node dist/cli.js hot",
70
72
  "install-link": "yarn install && yarn build && npm link",
71
73
  "typecheck": "tsc -p tsconfig.typecheck.json",
74
+ "runner-lock": "tsx src/release/updateRunnerLock.ts",
72
75
  "prepublishOnly": "yarn typecheck && yarn build",
73
76
  "preversion": "yarn typecheck && yarn build && yarn test",
74
77
  "version": "tsx src/release/cli.ts changelog && git add CHANGELOG.md",
@@ -0,0 +1,65 @@
1
+ #!/bin/sh
2
+ # pickNode.sh <account> — run as ROOT by the admin pairing line, from its root-owned copy of the package (never from the account's folder), BEFORE
3
+ # anything is started under Node. Prints the real path of the Node.js that root and the runner's service will run under, or says why there is none
4
+ # (exit 1). A Node qualifies only when ALL of these hold:
5
+ # - its real path (links followed) is outside every home folder: /Users/<name>, /home/<name>, root's own. A program in a home is the other user's to
6
+ # change, and the runner's launcher and daemons would stop working the day that home is closed (chmod 700) or its version manager moves on;
7
+ # - the account can run it (`sudo -u <account> test -x`) and CANNOT write it, nor any folder above it (`test -w`): root runs it, and root must never
8
+ # execute anything the account — which runs the agents' code — can change;
9
+ # - it is Node.js 22.12 or newer.
10
+ # Candidates: the `node` of sudo's own PATH first, then Homebrew's (Apple Silicon, Intel).
11
+ #
12
+ # The account is judged with `sudo -u <account> test …` only: nothing of the account's is executed. `$1` is validated by the line (a plain account name).
13
+ # Test seam, used by the unit tests and not by the line: `$2` replaces the home patterns (space-separated `case` patterns), `$3` the system candidates.
14
+ set -u
15
+ a=$1
16
+ homes=${2:-"/Users/* /home/* */root/*"}
17
+ candidates=${3:-"/opt/homebrew/bin/node /usr/local/bin/node"}
18
+ min_major=22
19
+ min_minor=12
20
+
21
+ fail() { echo "charness-runner: $*" >&2; exit 1; }
22
+
23
+ # The real path of $1, links followed. Without `readlink -f` (macOS before 12.3) the links are followed by hand and the folder is resolved by `cd -P`.
24
+ real_path() {
25
+ readlink -f "$1" 2>/dev/null && return 0
26
+ p=$1; hops=0
27
+ while [ -L "$p" ] && [ "$hops" -lt 20 ]; do
28
+ l=$(readlink "$p") || return 1
29
+ case $l in /*) p=$l;; *) p=${p%/*}/$l;; esac
30
+ hops=$((hops + 1))
31
+ done
32
+ [ -e "$p" ] || return 1
33
+ d=$(cd -P "$(dirname "$p")" 2>/dev/null && pwd -P) || return 1
34
+ printf '%s/%s\n' "$d" "${p##*/}"
35
+ }
36
+
37
+ # Is $1, or a folder above it, writable by the account?
38
+ account_can_write() {
39
+ w=$1
40
+ while [ -n "$w" ] && [ "$w" != / ]; do
41
+ sudo -u "$a" test -w "$w" && return 0
42
+ w=${w%/*}
43
+ done
44
+ return 1
45
+ }
46
+
47
+ in_a_home() {
48
+ set -f
49
+ for pattern in $homes; do
50
+ case $1 in $pattern) set +f; return 0;; esac
51
+ done
52
+ set +f
53
+ return 1
54
+ }
55
+
56
+ for c in $(command -v node 2>/dev/null) $candidates; do
57
+ r=$(real_path "$c") || continue
58
+ in_a_home "$r" && continue
59
+ sudo -u "$a" test -x "$r" || continue
60
+ account_can_write "$r" && continue
61
+ "$r" -e "var v=process.versions.node.split(/[.]/);process.exit(v[0]>$min_major||v[0]==$min_major&&v[1]>=$min_minor?0:1)" || continue
62
+ printf '%s\n' "$r"
63
+ exit 0
64
+ done
65
+ fail "no Node.js $min_major.$min_minor+ outside home folders that $a cannot write: install one system-wide (macOS: brew install node), paste again"
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "charness",
3
+ "version": "0.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "charness",
9
+ "version": "0.0.0",
10
+ "dependencies": {
11
+ "ssh2": "^1.17.0",
12
+ "zod": "^4.4.3"
13
+ },
14
+ "engines": {
15
+ "node": ">=22.12"
16
+ }
17
+ },
18
+ "node_modules/asn1": {
19
+ "version": "0.2.6",
20
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
21
+ "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
22
+ "dependencies": {
23
+ "safer-buffer": "~2.1.0"
24
+ }
25
+ },
26
+ "node_modules/bcrypt-pbkdf": {
27
+ "version": "1.0.2",
28
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
29
+ "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
30
+ "dependencies": {
31
+ "tweetnacl": "^0.14.3"
32
+ }
33
+ },
34
+ "node_modules/safer-buffer": {
35
+ "version": "2.1.2",
36
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
37
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
38
+ },
39
+ "node_modules/ssh2": {
40
+ "version": "1.17.0",
41
+ "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.17.0.tgz",
42
+ "integrity": "sha512-wPldCk3asibAjQ/kziWQQt1Wh3PgDFpC0XpwclzKcdT1vql6KeYxf5LIt4nlFkUeR8WuphYMKqUA56X4rjbfgQ==",
43
+ "dependencies": {
44
+ "asn1": "^0.2.6",
45
+ "bcrypt-pbkdf": "^1.0.2"
46
+ }
47
+ },
48
+ "node_modules/tweetnacl": {
49
+ "version": "0.14.5",
50
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
51
+ "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA=="
52
+ },
53
+ "node_modules/zod": {
54
+ "version": "4.4.3",
55
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
56
+ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="
57
+ }
58
+ }
59
+ }