charness 3.10.0 → 3.12.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 (477) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/DEVELOPMENT.md +3 -3
  3. package/README.md +3 -2
  4. package/SETUP.md +6 -5
  5. package/agent-plugin/README.md +15 -6
  6. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +23 -13
  7. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +10 -6
  8. package/agent-plugin/skills/charness-delivery-loop/SKILL.md +92 -0
  9. package/agent-plugin/skills/charness-orchestration/SKILL.md +116 -0
  10. package/dist/adapters/openCodeAdapter.d.ts +15 -0
  11. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  12. package/dist/adapters/openCodeAdapter.js +48 -4
  13. package/dist/adapters/openCodeAdapter.js.map +1 -1
  14. package/dist/agentLogin/agentLogin.d.ts +11 -0
  15. package/dist/agentLogin/agentLogin.d.ts.map +1 -1
  16. package/dist/agentLogin/agentLogin.js +18 -6
  17. package/dist/agentLogin/agentLogin.js.map +1 -1
  18. package/dist/apiErrorRetry.d.ts +5 -0
  19. package/dist/apiErrorRetry.d.ts.map +1 -1
  20. package/dist/apiErrorRetry.js +3 -3
  21. package/dist/apiErrorRetry.js.map +1 -1
  22. package/dist/bot.d.ts.map +1 -1
  23. package/dist/bot.js +331 -152
  24. package/dist/bot.js.map +1 -1
  25. package/dist/cli/claudeProfiles.d.ts +5 -2
  26. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  27. package/dist/cli/claudeProfiles.js +43 -20
  28. package/dist/cli/claudeProfiles.js.map +1 -1
  29. package/dist/cli/claudeProfilesCredit.d.ts +49 -0
  30. package/dist/cli/claudeProfilesCredit.d.ts.map +1 -0
  31. package/dist/cli/claudeProfilesCredit.js +160 -0
  32. package/dist/cli/claudeProfilesCredit.js.map +1 -0
  33. package/dist/cli/flagValue.d.ts +10 -0
  34. package/dist/cli/flagValue.d.ts.map +1 -0
  35. package/dist/cli/flagValue.js +17 -0
  36. package/dist/cli/flagValue.js.map +1 -0
  37. package/dist/connectors/telegram/commands/botCore.d.ts +1 -0
  38. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  39. package/dist/connectors/telegram/commands/botSkills.js +1 -1
  40. package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -1
  41. package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
  42. package/dist/connectors/telegram/commands/claudeAccounts.js +12 -9
  43. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  44. package/dist/connectors/telegram/commands/compaction.d.ts +11 -0
  45. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  46. package/dist/connectors/telegram/commands/compaction.js +208 -22
  47. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  48. package/dist/connectors/telegram/commands/runners.d.ts +5 -1
  49. package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
  50. package/dist/connectors/telegram/commands/runners.js +151 -30
  51. package/dist/connectors/telegram/commands/runners.js.map +1 -1
  52. package/dist/connectors/telegram/foldedMessage.d.ts +24 -0
  53. package/dist/connectors/telegram/foldedMessage.d.ts.map +1 -0
  54. package/dist/connectors/telegram/foldedMessage.js +39 -0
  55. package/dist/connectors/telegram/foldedMessage.js.map +1 -0
  56. package/dist/connectors/telegram/inbound.d.ts +24 -1
  57. package/dist/connectors/telegram/inbound.d.ts.map +1 -1
  58. package/dist/connectors/telegram/inbound.js +77 -1
  59. package/dist/connectors/telegram/inbound.js.map +1 -1
  60. package/dist/connectors/telegram/renderAgentHtml.d.ts +15 -0
  61. package/dist/connectors/telegram/renderAgentHtml.d.ts.map +1 -1
  62. package/dist/connectors/telegram/renderAgentHtml.js +11 -1
  63. package/dist/connectors/telegram/renderAgentHtml.js.map +1 -1
  64. package/dist/connectors/telegram/runnerPairingMessages.d.ts +2 -7
  65. package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
  66. package/dist/connectors/telegram/runnerPairingMessages.js +5 -19
  67. package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
  68. package/dist/connectors/telegram/unpinMessages.d.ts +12 -0
  69. package/dist/connectors/telegram/unpinMessages.d.ts.map +1 -0
  70. package/dist/connectors/telegram/unpinMessages.js +44 -0
  71. package/dist/connectors/telegram/unpinMessages.js.map +1 -0
  72. package/dist/i18n/de.d.ts.map +1 -1
  73. package/dist/i18n/de.js +63 -11
  74. package/dist/i18n/de.js.map +1 -1
  75. package/dist/i18n/en.d.ts.map +1 -1
  76. package/dist/i18n/en.js +63 -11
  77. package/dist/i18n/en.js.map +1 -1
  78. package/dist/i18n/es.d.ts.map +1 -1
  79. package/dist/i18n/es.js +63 -11
  80. package/dist/i18n/es.js.map +1 -1
  81. package/dist/i18n/fr.d.ts.map +1 -1
  82. package/dist/i18n/fr.js +63 -11
  83. package/dist/i18n/fr.js.map +1 -1
  84. package/dist/i18n/hi.d.ts.map +1 -1
  85. package/dist/i18n/hi.js +63 -11
  86. package/dist/i18n/hi.js.map +1 -1
  87. package/dist/i18n/ja.d.ts.map +1 -1
  88. package/dist/i18n/ja.js +63 -11
  89. package/dist/i18n/ja.js.map +1 -1
  90. package/dist/i18n/ka.d.ts.map +1 -1
  91. package/dist/i18n/ka.js +63 -11
  92. package/dist/i18n/ka.js.map +1 -1
  93. package/dist/i18n/pt.d.ts.map +1 -1
  94. package/dist/i18n/pt.js +63 -11
  95. package/dist/i18n/pt.js.map +1 -1
  96. package/dist/i18n/ru.d.ts.map +1 -1
  97. package/dist/i18n/ru.js +63 -11
  98. package/dist/i18n/ru.js.map +1 -1
  99. package/dist/i18n/uk.d.ts.map +1 -1
  100. package/dist/i18n/uk.js +63 -11
  101. package/dist/i18n/uk.js.map +1 -1
  102. package/dist/i18n/uz.d.ts.map +1 -1
  103. package/dist/i18n/uz.js +63 -11
  104. package/dist/i18n/uz.js.map +1 -1
  105. package/dist/i18n/zh.d.ts.map +1 -1
  106. package/dist/i18n/zh.js +63 -11
  107. package/dist/i18n/zh.js.map +1 -1
  108. package/dist/installManager.d.ts.map +1 -1
  109. package/dist/installManager.js +3 -0
  110. package/dist/installManager.js.map +1 -1
  111. package/dist/instanceLock.d.ts.map +1 -1
  112. package/dist/instanceLock.js +2 -1
  113. package/dist/instanceLock.js.map +1 -1
  114. package/dist/outputTrace.d.ts +6 -0
  115. package/dist/outputTrace.d.ts.map +1 -1
  116. package/dist/outputTrace.js +13 -0
  117. package/dist/outputTrace.js.map +1 -1
  118. package/dist/platform/outbound.d.ts +14 -1
  119. package/dist/platform/outbound.d.ts.map +1 -1
  120. package/dist/platform/outbound.js.map +1 -1
  121. package/dist/remoteRun/cleanReport.d.ts +45 -0
  122. package/dist/remoteRun/cleanReport.d.ts.map +1 -0
  123. package/dist/remoteRun/cleanReport.js +84 -0
  124. package/dist/remoteRun/cleanReport.js.map +1 -0
  125. package/dist/remoteRun/cliArgs.d.ts +18 -0
  126. package/dist/remoteRun/cliArgs.d.ts.map +1 -1
  127. package/dist/remoteRun/cliArgs.js +100 -4
  128. package/dist/remoteRun/cliArgs.js.map +1 -1
  129. package/dist/remoteRun/commands.d.ts +30 -1
  130. package/dist/remoteRun/commands.d.ts.map +1 -1
  131. package/dist/remoteRun/commands.js +84 -9
  132. package/dist/remoteRun/commands.js.map +1 -1
  133. package/dist/remoteRun/exitCodes.d.ts +5 -0
  134. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  135. package/dist/remoteRun/exitCodes.js +6 -1
  136. package/dist/remoteRun/exitCodes.js.map +1 -1
  137. package/dist/remoteRun/foreground.d.ts +6 -0
  138. package/dist/remoteRun/foreground.d.ts.map +1 -1
  139. package/dist/remoteRun/foreground.js +13 -1
  140. package/dist/remoteRun/foreground.js.map +1 -1
  141. package/dist/remoteRun/interrupts.d.ts.map +1 -1
  142. package/dist/remoteRun/interrupts.js +2 -2
  143. package/dist/remoteRun/interrupts.js.map +1 -1
  144. package/dist/remoteRun/jobFiles.d.ts +6 -1
  145. package/dist/remoteRun/jobFiles.d.ts.map +1 -1
  146. package/dist/remoteRun/jobFiles.js +14 -0
  147. package/dist/remoteRun/jobFiles.js.map +1 -1
  148. package/dist/remoteRun/jobId.d.ts +5 -0
  149. package/dist/remoteRun/jobId.d.ts.map +1 -1
  150. package/dist/remoteRun/jobId.js +10 -0
  151. package/dist/remoteRun/jobId.js.map +1 -1
  152. package/dist/remoteRun/jobState.d.ts.map +1 -1
  153. package/dist/remoteRun/jobState.js +3 -2
  154. package/dist/remoteRun/jobState.js.map +1 -1
  155. package/dist/remoteRun/pairedRunners.d.ts +1 -1
  156. package/dist/remoteRun/pairedRunners.d.ts.map +1 -1
  157. package/dist/remoteRun/pairedRunners.js +4 -0
  158. package/dist/remoteRun/pairedRunners.js.map +1 -1
  159. package/dist/remoteRun/pathPatterns.d.ts +1 -1
  160. package/dist/remoteRun/pathPatterns.js +1 -1
  161. package/dist/remoteRun/probe.d.ts +58 -5
  162. package/dist/remoteRun/probe.d.ts.map +1 -1
  163. package/dist/remoteRun/probe.js +107 -11
  164. package/dist/remoteRun/probe.js.map +1 -1
  165. package/dist/remoteRun/probeTiming.d.ts +15 -0
  166. package/dist/remoteRun/probeTiming.d.ts.map +1 -0
  167. package/dist/remoteRun/probeTiming.js +23 -0
  168. package/dist/remoteRun/probeTiming.js.map +1 -0
  169. package/dist/remoteRun/project.d.ts +5 -0
  170. package/dist/remoteRun/project.d.ts.map +1 -1
  171. package/dist/remoteRun/project.js +10 -0
  172. package/dist/remoteRun/project.js.map +1 -1
  173. package/dist/remoteRun/projectConfig.d.ts +8 -1
  174. package/dist/remoteRun/projectConfig.d.ts.map +1 -1
  175. package/dist/remoteRun/projectConfig.js +18 -5
  176. package/dist/remoteRun/projectConfig.js.map +1 -1
  177. package/dist/remoteRun/pruneReport.d.ts +48 -0
  178. package/dist/remoteRun/pruneReport.d.ts.map +1 -0
  179. package/dist/remoteRun/pruneReport.js +80 -0
  180. package/dist/remoteRun/pruneReport.js.map +1 -0
  181. package/dist/remoteRun/remoteRunCli.d.ts +1 -1
  182. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
  183. package/dist/remoteRun/remoteRunCli.js +20 -0
  184. package/dist/remoteRun/remoteRunCli.js.map +1 -1
  185. package/dist/remoteRun/runnerClient.d.ts +10 -0
  186. package/dist/remoteRun/runnerClient.d.ts.map +1 -1
  187. package/dist/remoteRun/runnerClient.js +19 -5
  188. package/dist/remoteRun/runnerClient.js.map +1 -1
  189. package/dist/remoteRun/runnerWait.d.ts.map +1 -1
  190. package/dist/remoteRun/runnerWait.js +2 -1
  191. package/dist/remoteRun/runnerWait.js.map +1 -1
  192. package/dist/remoteRun/runners.d.ts +48 -7
  193. package/dist/remoteRun/runners.d.ts.map +1 -1
  194. package/dist/remoteRun/runners.js +105 -40
  195. package/dist/remoteRun/runners.js.map +1 -1
  196. package/dist/remoteRun/runnersConfig.d.ts +24 -0
  197. package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
  198. package/dist/remoteRun/runnersConfig.js +29 -2
  199. package/dist/remoteRun/runnersConfig.js.map +1 -1
  200. package/dist/remoteRun/ssh.d.ts +3 -3
  201. package/dist/remoteRun/ssh.d.ts.map +1 -1
  202. package/dist/remoteRun/ssh.js +19 -5
  203. package/dist/remoteRun/ssh.js.map +1 -1
  204. package/dist/remoteRun/submit.d.ts +1 -1
  205. package/dist/remoteRun/submit.d.ts.map +1 -1
  206. package/dist/remoteRun/submit.js +30 -2
  207. package/dist/remoteRun/submit.js.map +1 -1
  208. package/dist/runnerUtility/adminService.d.ts.map +1 -1
  209. package/dist/runnerUtility/adminService.js +5 -5
  210. package/dist/runnerUtility/adminService.js.map +1 -1
  211. package/dist/runnerUtility/appInstall.d.ts +9 -0
  212. package/dist/runnerUtility/appInstall.d.ts.map +1 -1
  213. package/dist/runnerUtility/appInstall.js +12 -2
  214. package/dist/runnerUtility/appInstall.js.map +1 -1
  215. package/dist/runnerUtility/execEnv.d.ts +1 -1
  216. package/dist/runnerUtility/execEnv.d.ts.map +1 -1
  217. package/dist/runnerUtility/execEnv.js +23 -5
  218. package/dist/runnerUtility/execEnv.js.map +1 -1
  219. package/dist/runnerUtility/guiAgentHeal.d.ts +3 -3
  220. package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -1
  221. package/dist/runnerUtility/guiAgentHeal.js +6 -4
  222. package/dist/runnerUtility/guiAgentHeal.js.map +1 -1
  223. package/dist/runnerUtility/homeFolders.d.ts +1 -0
  224. package/dist/runnerUtility/homeFolders.d.ts.map +1 -1
  225. package/dist/runnerUtility/homeFolders.js +2 -1
  226. package/dist/runnerUtility/homeFolders.js.map +1 -1
  227. package/dist/runnerUtility/iosCheck.d.ts +2 -0
  228. package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
  229. package/dist/runnerUtility/iosCheck.js +12 -3
  230. package/dist/runnerUtility/iosCheck.js.map +1 -1
  231. package/dist/runnerUtility/isolatedCommand.d.ts +0 -2
  232. package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -1
  233. package/dist/runnerUtility/isolatedCommand.js +4 -11
  234. package/dist/runnerUtility/isolatedCommand.js.map +1 -1
  235. package/dist/runnerUtility/keepAwake.d.ts +47 -10
  236. package/dist/runnerUtility/keepAwake.d.ts.map +1 -1
  237. package/dist/runnerUtility/keepAwake.js +108 -31
  238. package/dist/runnerUtility/keepAwake.js.map +1 -1
  239. package/dist/runnerUtility/launcher.d.ts +4 -0
  240. package/dist/runnerUtility/launcher.d.ts.map +1 -1
  241. package/dist/runnerUtility/launcher.js +31 -13
  242. package/dist/runnerUtility/launcher.js.map +1 -1
  243. package/dist/runnerUtility/linkLoop.d.ts +4 -0
  244. package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
  245. package/dist/runnerUtility/linkLoop.js +15 -6
  246. package/dist/runnerUtility/linkLoop.js.map +1 -1
  247. package/dist/runnerUtility/managedNode.d.ts +84 -0
  248. package/dist/runnerUtility/managedNode.d.ts.map +1 -0
  249. package/dist/runnerUtility/managedNode.js +165 -0
  250. package/dist/runnerUtility/managedNode.js.map +1 -0
  251. package/dist/runnerUtility/nodeOnPath.d.ts +10 -0
  252. package/dist/runnerUtility/nodeOnPath.d.ts.map +1 -0
  253. package/dist/runnerUtility/nodeOnPath.js +49 -0
  254. package/dist/runnerUtility/nodeOnPath.js.map +1 -0
  255. package/dist/runnerUtility/nodeUpkeep.d.ts +140 -0
  256. package/dist/runnerUtility/nodeUpkeep.d.ts.map +1 -0
  257. package/dist/runnerUtility/nodeUpkeep.js +348 -0
  258. package/dist/runnerUtility/nodeUpkeep.js.map +1 -0
  259. package/dist/runnerUtility/nodeUpkeepTiming.d.ts +14 -0
  260. package/dist/runnerUtility/nodeUpkeepTiming.d.ts.map +1 -0
  261. package/dist/runnerUtility/nodeUpkeepTiming.js +21 -0
  262. package/dist/runnerUtility/nodeUpkeepTiming.js.map +1 -0
  263. package/dist/runnerUtility/packageManagerShims.d.ts +10 -0
  264. package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -1
  265. package/dist/runnerUtility/packageManagerShims.js +67 -3
  266. package/dist/runnerUtility/packageManagerShims.js.map +1 -1
  267. package/dist/runnerUtility/pueueDaemon.d.ts +73 -8
  268. package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
  269. package/dist/runnerUtility/pueueDaemon.js +90 -15
  270. package/dist/runnerUtility/pueueDaemon.js.map +1 -1
  271. package/dist/runnerUtility/runnerCommands.d.ts +7 -1
  272. package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
  273. package/dist/runnerUtility/runnerCommands.js +119 -16
  274. package/dist/runnerUtility/runnerCommands.js.map +1 -1
  275. package/dist/runnerUtility/runnerHome.d.ts +34 -0
  276. package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
  277. package/dist/runnerUtility/runnerHome.js +17 -3
  278. package/dist/runnerUtility/runnerHome.js.map +1 -1
  279. package/dist/runnerUtility/serviceCommon.d.ts +2 -0
  280. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  281. package/dist/runnerUtility/serviceCommon.js +3 -1
  282. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  283. package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
  284. package/dist/runnerUtility/serviceManager.js +7 -2
  285. package/dist/runnerUtility/serviceManager.js.map +1 -1
  286. package/dist/runnerUtility/simctlGuard.d.ts +38 -0
  287. package/dist/runnerUtility/simctlGuard.d.ts.map +1 -0
  288. package/dist/runnerUtility/simctlGuard.js +166 -0
  289. package/dist/runnerUtility/simctlGuard.js.map +1 -0
  290. package/dist/runners/bootstrapLine.d.ts +3 -4
  291. package/dist/runners/bootstrapLine.d.ts.map +1 -1
  292. package/dist/runners/bootstrapLine.js +108 -83
  293. package/dist/runners/bootstrapLine.js.map +1 -1
  294. package/dist/runners/hubPackage.d.ts +1 -1
  295. package/dist/runners/hubPackage.d.ts.map +1 -1
  296. package/dist/runners/hubPackage.js +5 -6
  297. package/dist/runners/hubPackage.js.map +1 -1
  298. package/dist/runners/hubPairing.d.ts +19 -0
  299. package/dist/runners/hubPairing.d.ts.map +1 -1
  300. package/dist/runners/hubPairing.js +38 -0
  301. package/dist/runners/hubPairing.js.map +1 -1
  302. package/dist/runners/hubRegistry.d.ts +8 -0
  303. package/dist/runners/hubRegistry.d.ts.map +1 -1
  304. package/dist/runners/hubRegistry.js +6 -0
  305. package/dist/runners/hubRegistry.js.map +1 -1
  306. package/dist/runners/pairCode.d.ts +34 -3
  307. package/dist/runners/pairCode.d.ts.map +1 -1
  308. package/dist/runners/pairCode.js +65 -13
  309. package/dist/runners/pairCode.js.map +1 -1
  310. package/dist/runners/runnerGroups.d.ts +22 -0
  311. package/dist/runners/runnerGroups.d.ts.map +1 -0
  312. package/dist/runners/runnerGroups.js +41 -0
  313. package/dist/runners/runnerGroups.js.map +1 -0
  314. package/dist/runners/runnersCli.d.ts +5 -2
  315. package/dist/runners/runnersCli.d.ts.map +1 -1
  316. package/dist/runners/runnersCli.js +59 -9
  317. package/dist/runners/runnersCli.js.map +1 -1
  318. package/dist/runners/runnersList.d.ts +1 -1
  319. package/dist/runners/runnersList.d.ts.map +1 -1
  320. package/dist/runners/runnersList.js +3 -1
  321. package/dist/runners/runnersList.js.map +1 -1
  322. package/dist/runners/runnersOverview.d.ts.map +1 -1
  323. package/dist/runners/runnersOverview.js +8 -4
  324. package/dist/runners/runnersOverview.js.map +1 -1
  325. package/dist/scheduler/checkRun.d.ts +9 -10
  326. package/dist/scheduler/checkRun.d.ts.map +1 -1
  327. package/dist/scheduler/checkRun.js +8 -16
  328. package/dist/scheduler/checkRun.js.map +1 -1
  329. package/dist/scheduler/checkStatus.d.ts +4 -5
  330. package/dist/scheduler/checkStatus.d.ts.map +1 -1
  331. package/dist/scheduler/checkStatus.js +11 -15
  332. package/dist/scheduler/checkStatus.js.map +1 -1
  333. package/dist/scheduler/delivery.d.ts +80 -37
  334. package/dist/scheduler/delivery.d.ts.map +1 -1
  335. package/dist/scheduler/delivery.js +121 -68
  336. package/dist/scheduler/delivery.js.map +1 -1
  337. package/dist/scheduler/mcpSurface.d.ts +13 -5
  338. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  339. package/dist/scheduler/mcpSurface.js +84 -34
  340. package/dist/scheduler/mcpSurface.js.map +1 -1
  341. package/dist/scheduler/recurrence.d.ts +32 -0
  342. package/dist/scheduler/recurrence.d.ts.map +1 -1
  343. package/dist/scheduler/recurrence.js +56 -18
  344. package/dist/scheduler/recurrence.js.map +1 -1
  345. package/dist/scheduler/scheduleText.d.ts +7 -0
  346. package/dist/scheduler/scheduleText.d.ts.map +1 -0
  347. package/dist/scheduler/scheduleText.js +55 -0
  348. package/dist/scheduler/scheduleText.js.map +1 -0
  349. package/dist/scheduler/store.d.ts +8 -2
  350. package/dist/scheduler/store.d.ts.map +1 -1
  351. package/dist/scheduler/store.js +25 -4
  352. package/dist/scheduler/store.js.map +1 -1
  353. package/dist/scheduler/types.d.ts +4 -10
  354. package/dist/scheduler/types.d.ts.map +1 -1
  355. package/dist/scheduler/workerWatch.d.ts +49 -11
  356. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  357. package/dist/scheduler/workerWatch.js +57 -13
  358. package/dist/scheduler/workerWatch.js.map +1 -1
  359. package/dist/state.d.ts +95 -2
  360. package/dist/state.d.ts.map +1 -1
  361. package/dist/state.js +145 -7
  362. package/dist/state.js.map +1 -1
  363. package/dist/testTimings.d.ts +6 -2
  364. package/dist/testTimings.d.ts.map +1 -1
  365. package/dist/testTimings.js +12 -1
  366. package/dist/testTimings.js.map +1 -1
  367. package/dist/types.d.ts +2 -1
  368. package/dist/types.d.ts.map +1 -1
  369. package/dist/utils/agentPlugin.d.ts +2 -1
  370. package/dist/utils/agentPlugin.d.ts.map +1 -1
  371. package/dist/utils/agentPlugin.js +2 -1
  372. package/dist/utils/agentPlugin.js.map +1 -1
  373. package/dist/utils/botSkills.d.ts +1 -1
  374. package/dist/utils/claudeApiAgentStop.d.ts +64 -0
  375. package/dist/utils/claudeApiAgentStop.d.ts.map +1 -0
  376. package/dist/utils/claudeApiAgentStop.js +85 -0
  377. package/dist/utils/claudeApiAgentStop.js.map +1 -0
  378. package/dist/utils/claudeApiCredit.d.ts +168 -0
  379. package/dist/utils/claudeApiCredit.d.ts.map +1 -0
  380. package/dist/utils/claudeApiCredit.js +260 -0
  381. package/dist/utils/claudeApiCredit.js.map +1 -0
  382. package/dist/utils/claudeApiCreditRecheck.d.ts +120 -0
  383. package/dist/utils/claudeApiCreditRecheck.d.ts.map +1 -0
  384. package/dist/utils/claudeApiCreditRecheck.js +173 -0
  385. package/dist/utils/claudeApiCreditRecheck.js.map +1 -0
  386. package/dist/utils/claudeCompactHook.d.ts +18 -10
  387. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  388. package/dist/utils/claudeCompactHook.js +35 -14
  389. package/dist/utils/claudeCompactHook.js.map +1 -1
  390. package/dist/utils/claudeProfileUsageLines.d.ts +13 -1
  391. package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
  392. package/dist/utils/claudeProfileUsageLines.js +75 -4
  393. package/dist/utils/claudeProfileUsageLines.js.map +1 -1
  394. package/dist/utils/claudeProfileUsageViews.d.ts +46 -0
  395. package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -0
  396. package/dist/utils/claudeProfileUsageViews.js +114 -0
  397. package/dist/utils/claudeProfileUsageViews.js.map +1 -0
  398. package/dist/utils/claudeProfiles.d.ts +15 -0
  399. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  400. package/dist/utils/claudeProfiles.js +54 -0
  401. package/dist/utils/claudeProfiles.js.map +1 -1
  402. package/dist/utils/claudeUsage.d.ts +97 -36
  403. package/dist/utils/claudeUsage.d.ts.map +1 -1
  404. package/dist/utils/claudeUsage.js +142 -61
  405. package/dist/utils/claudeUsage.js.map +1 -1
  406. package/dist/utils/claudeUsageRefresher.d.ts +27 -3
  407. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  408. package/dist/utils/claudeUsageRefresher.js +113 -14
  409. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  410. package/dist/utils/compactOnIdle.d.ts +140 -15
  411. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  412. package/dist/utils/compactOnIdle.js +209 -23
  413. package/dist/utils/compactOnIdle.js.map +1 -1
  414. package/dist/utils/compactSelfReviewFlags.d.ts +50 -0
  415. package/dist/utils/compactSelfReviewFlags.d.ts.map +1 -0
  416. package/dist/utils/compactSelfReviewFlags.js +120 -0
  417. package/dist/utils/compactSelfReviewFlags.js.map +1 -0
  418. package/dist/utils/fallbackChain.d.ts +18 -7
  419. package/dist/utils/fallbackChain.d.ts.map +1 -1
  420. package/dist/utils/fallbackChain.js +28 -12
  421. package/dist/utils/fallbackChain.js.map +1 -1
  422. package/dist/utils/forwardedMark.d.ts +54 -0
  423. package/dist/utils/forwardedMark.d.ts.map +1 -0
  424. package/dist/utils/forwardedMark.js +80 -0
  425. package/dist/utils/forwardedMark.js.map +1 -0
  426. package/dist/utils/limitHeldPrompts.d.ts +8 -2
  427. package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
  428. package/dist/utils/limitHeldPrompts.js +11 -4
  429. package/dist/utils/limitHeldPrompts.js.map +1 -1
  430. package/dist/utils/messageContext.d.ts +54 -0
  431. package/dist/utils/messageContext.d.ts.map +1 -0
  432. package/dist/utils/messageContext.js +58 -0
  433. package/dist/utils/messageContext.js.map +1 -0
  434. package/dist/utils/openCodeCompactPlugin.d.ts +28 -7
  435. package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
  436. package/dist/utils/openCodeCompactPlugin.js +80 -15
  437. package/dist/utils/openCodeCompactPlugin.js.map +1 -1
  438. package/dist/utils/openCodeUsage.d.ts +10 -3
  439. package/dist/utils/openCodeUsage.d.ts.map +1 -1
  440. package/dist/utils/openCodeUsage.js +19 -5
  441. package/dist/utils/openCodeUsage.js.map +1 -1
  442. package/dist/utils/replyQuote.d.ts +11 -26
  443. package/dist/utils/replyQuote.d.ts.map +1 -1
  444. package/dist/utils/replyQuote.js +9 -31
  445. package/dist/utils/replyQuote.js.map +1 -1
  446. package/dist/utils/runnersScreenPlan.d.ts +51 -20
  447. package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
  448. package/dist/utils/runnersScreenPlan.js +143 -28
  449. package/dist/utils/runnersScreenPlan.js.map +1 -1
  450. package/dist/utils/streamedCompactionSummary.d.ts +65 -0
  451. package/dist/utils/streamedCompactionSummary.d.ts.map +1 -0
  452. package/dist/utils/streamedCompactionSummary.js +108 -0
  453. package/dist/utils/streamedCompactionSummary.js.map +1 -0
  454. package/dist/utils/stripControlCharacters.d.ts +8 -0
  455. package/dist/utils/stripControlCharacters.d.ts.map +1 -0
  456. package/dist/utils/stripControlCharacters.js +16 -0
  457. package/dist/utils/stripControlCharacters.js.map +1 -0
  458. package/dist/utils/telegramError.d.ts +6 -0
  459. package/dist/utils/telegramError.d.ts.map +1 -1
  460. package/dist/utils/telegramError.js +30 -0
  461. package/dist/utils/telegramError.js.map +1 -1
  462. package/dist/utils/topicRequest.d.ts +13 -0
  463. package/dist/utils/topicRequest.d.ts.map +1 -1
  464. package/dist/utils/topicRequest.js +10 -0
  465. package/dist/utils/topicRequest.js.map +1 -1
  466. package/dist/utils/usageRefreshBudget.d.ts.map +1 -1
  467. package/dist/utils/usageRefreshBudget.js +4 -10
  468. package/dist/utils/usageRefreshBudget.js.map +1 -1
  469. package/dist/utils/waitUpTo.d.ts +8 -0
  470. package/dist/utils/waitUpTo.d.ts.map +1 -0
  471. package/dist/utils/waitUpTo.js +20 -0
  472. package/dist/utils/waitUpTo.js.map +1 -0
  473. package/package.json +2 -2
  474. package/remoteRun/ensureNode.sh +288 -0
  475. package/remoteRun/runner.sh +2252 -115
  476. package/agent-plugin/skills/charness-manager/SKILL.md +0 -156
  477. package/remoteRun/pickNode.sh +0 -65
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkStatusActivityMaxChars = exports.checkStatusSlackMs = exports.checkStatusCommandTimeoutSec = exports.maxCheckStatusRunDirLength = exports.maxCheckStatusCommandLength = exports.maxCheckStatusEveryMinutes = exports.minCheckStatusEveryMinutes = exports.defaultCheckStatusEveryMinutes = void 0;
3
+ exports.msPerMinute = exports.checkStatusActivityMaxChars = exports.checkStatusSlackMs = exports.checkStatusCommandTimeoutSec = exports.maxCheckStatusRunDirLength = exports.maxCheckStatusCommandLength = exports.maxCheckStatusEveryMinutes = exports.minCheckStatusEveryMinutes = exports.defaultCheckStatusEveryMinutes = void 0;
4
4
  exports.getCheckStatusIntervalMs = getCheckStatusIntervalMs;
5
5
  exports.checkIsCheckStatusDue = checkIsCheckStatusDue;
6
6
  exports.getCheckStatusSinceMs = getCheckStatusSinceMs;
7
- exports.checkIsFinalCheckRun = checkIsFinalCheckRun;
8
7
  exports.checkIsCheckStatusShown = checkIsCheckStatusShown;
9
8
  exports.formatCheckStatusActivity = formatCheckStatusActivity;
10
9
  exports.getCheckStatusActivityFromOutput = getCheckStatusActivityFromOutput;
11
10
  exports.getCheckStatusElapsedText = getCheckStatusElapsedText;
11
+ exports.getCheckShownName = getCheckShownName;
12
12
  exports.buildCheckStatusLine = buildCheckStatusLine;
13
13
  const i18n_1 = require("../i18n");
14
14
  const surrogateSafeCut_1 = require("../utils/surrogateSafeCut");
@@ -43,13 +43,14 @@ exports.checkStatusSlackMs = 60_000;
43
43
  const checkStatusSlackShareDivisor = 5;
44
44
  /** The longest «now» part of a line: one line of a phone's width, never a paragraph. */
45
45
  exports.checkStatusActivityMaxChars = 120;
46
- const msPerMinute = 60_000;
46
+ /** Milliseconds in a minute (shared with `delivery.ts`, which turns a recipe window in minutes into an elapsed text). */
47
+ exports.msPerMinute = 60_000;
47
48
  const minutesPerHour = 60;
48
49
  /** A leading `watch ` of a check's name is the recipe's own prefix (`watch builder S2`), noise in the topic. */
49
50
  const leadingWatchWordPattern = /^watch\s+/i;
50
51
  /** @description The status interval of a check, in ms. */
51
52
  function getCheckStatusIntervalMs(job) {
52
- return (job.statusEveryMinutes ?? exports.defaultCheckStatusEveryMinutes) * msPerMinute;
53
+ return (job.statusEveryMinutes ?? exports.defaultCheckStatusEveryMinutes) * exports.msPerMinute;
53
54
  }
54
55
  /**
55
56
  * @description Whether a status line is due: an interval (less the slack) has passed since the last line, or since the
@@ -63,14 +64,6 @@ function checkIsCheckStatusDue(input) {
63
64
  function getCheckStatusSinceMs(job) {
64
65
  return job.lastStatusAt ?? Date.parse(job.createdAt);
65
66
  }
66
- /**
67
- * @description Whether this is the LAST run the job will ever make (a `once` job, or the final run of an N-times cron): its
68
- * line would be deleted at once by the finished check, so none is posted and the existing one goes.
69
- */
70
- function checkIsFinalCheckRun(job) {
71
- const { spec } = job;
72
- return spec.kind === 'once' || (typeof spec.remainingRuns === 'number' && spec.remainingRuns <= 1);
73
- }
74
67
  /**
75
68
  * @description The ONE gate that decides whether a topic shows status lines: a Telegram conversation (a tracker issue gets no
76
69
  * message, no comment, no edited note) whose view shows the agent's stream — the answers-only view shows nothing but answers.
@@ -99,7 +92,7 @@ function getCheckStatusActivityFromOutput(output) {
99
92
  }
100
93
  /** @description «N min» under an hour, «H h M min» from an hour on (rounded to the nearest minute). */
101
94
  function getCheckStatusElapsedText(elapsedMs) {
102
- const totalMinutes = Math.max(0, Math.round(elapsedMs / msPerMinute));
95
+ const totalMinutes = Math.max(0, Math.round(elapsedMs / exports.msPerMinute));
103
96
  if (totalMinutes < minutesPerHour)
104
97
  return (0, i18n_1.t)('schedule.statusElapsedMinutes', { minutes: totalMinutes });
105
98
  return (0, i18n_1.t)('schedule.statusElapsedHours', {
@@ -107,14 +100,17 @@ function getCheckStatusElapsedText(elapsedMs) {
107
100
  minutes: totalMinutes % minutesPerHour,
108
101
  });
109
102
  }
103
+ /** @description A check's name as the topic shows it: without the recipe's leading `watch ` (`watch builder S2` → `builder S2`). */
104
+ function getCheckShownName(name) {
105
+ return name.replace(leadingWatchWordPattern, '').trim() || name;
106
+ }
110
107
  /**
111
108
  * @description The status line: `⏳ <name> · works <elapsed>[ · now: <activity>]`. The name is the check's own without the
112
109
  * recipe's leading `watch `; the «now» part is left out when there is nothing readable to say.
113
110
  */
114
111
  function buildCheckStatusLine(input) {
115
- const shownName = input.name.replace(leadingWatchWordPattern, '').trim() || input.name;
116
112
  return (0, i18n_1.t)('schedule.statusLineText', {
117
- name: shownName,
113
+ name: getCheckShownName(input.name),
118
114
  elapsed: getCheckStatusElapsedText(input.elapsedMs),
119
115
  activity: input.activity === null ? '' : (0, i18n_1.t)('schedule.statusLineActivity', { activity: input.activity }),
120
116
  });
@@ -1 +1 @@
1
- {"version":3,"file":"checkStatus.js","sourceRoot":"","sources":["../../src/scheduler/checkStatus.ts"],"names":[],"mappings":";;;AAqDA,4DAEC;AAMD,sDAGC;AAGD,sDAEC;AAMD,oDAGC;AAMD,0DAEC;AAMD,8DAKC;AAMD,4EAGC;AAGD,8DAOC;AAMD,oDAOC;AAjID,kCAA4B;AAC5B,gEAAiE;AACjE,kDAAwD;AAIxD;;;;;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AAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,KAAmE;IACtG,OAAO,IAAA,QAAC,EAAC,yBAAyB,EAAE;QAClC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,OAAO,EAAE,yBAAyB,CAAC,KAAK,CAAC,SAAS,CAAC;QACnD,QAAQ,EAAE,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,QAAC,EAAC,6BAA6B,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;KACxG,CAAC,CAAC;AACL,CAAC"}
@@ -5,11 +5,10 @@ import { type PostToSessionDeps } from '../postToSession';
5
5
  * @description Scheduler delivery (plan S4): the real `deliver(job, fireContext)`
6
6
  * callback the engine (S3) invokes at fire time. The flow is locked by the plan:
7
7
  *
8
- * 1. announce — post a visible message into the topic (job name + human
9
- * schedule text + the prompt; a "missed at HH:MM" note for a catch-up run).
10
- * 2. pin — pin that announcement (silent ONLY when the job opted in;
11
- * default notifies all members). A pin failure degrades to a `console.warn`
12
- * and the flow continues — the announcement is already visible.
8
+ * 1. announce — post a SILENT message into the topic: «⏰ Scheduled: <name> ·
9
+ * <human schedule>» (+ a "missed at HH:MM" note for a catch-up run), with the
10
+ * prompt folded under it (an agent instruction, not something to read by
11
+ * default). Never pinned: a scheduled run is ordinary output.
13
12
  * 3–4. post the prefixed prompt to the session ({@link postToSession}, shared
14
13
  * with the Jira connector): ensure a session (starting one with the job's
15
14
  * `lastAdapterName` snapshot as the adapter fallback — a topic that never
@@ -18,19 +17,21 @@ import { type PostToSessionDeps } from '../postToSession';
18
17
  * unbound topic → outcome `failed` with a distinct error string the engine
19
18
  * records (S8 turns that into a pause).
20
19
  *
21
- * A REMINDER record (`deliveryKind: 'reminder'`) stops after step 2: its whole
22
- * delivery IS the announcement plus its pin, which is what pierces a muted topic.
23
- * Steps 3–4 are skipped entirely, so a reminder fires in an unbound topic and in
24
- * General — there is no session to ensure, nothing to interrupt, and no agent to
25
- * tell about the run.
20
+ * A REMINDER record (`deliveryKind: 'reminder'`) is the one thing still pinned:
21
+ * its whole delivery IS the announcement plus its pin, which is what pierces a
22
+ * muted topic, and it stops there. Steps 3–4 are skipped entirely, so a reminder
23
+ * fires in an unbound topic and in General — there is no session to ensure,
24
+ * nothing to interrupt, and no agent to tell about the run.
26
25
  *
27
26
  * A CHECK record (`deliveryKind: 'check'`) runs its command FIRST and decides
28
27
  * from the result and its persisted failing flag: a pass after a pass, or a
29
28
  * failure after a failure, posts nothing; a pass after a failure posts one
30
- * unpinned "passes again" line; the first failure posts the alert, pins it, and
31
- * then wakes the agent through steps 3–4 with the failure details ahead of the
32
- * job's prompt. An unbound topic fails with the same distinct error as a prompt
33
- * job, so it is paused the same way.
29
+ * "is back to normal" line; the first failure posts a one-sentence silent notice
30
+ * (never the command; a worker watch says "finished" or "silent", any other check
31
+ * folds the output under "fired") and then wakes the agent through steps 3–4 with
32
+ * the command, the failure details and the output ahead of the job's prompt. An
33
+ * unbound topic fails with the same distinct error as a prompt job, so it is
34
+ * paused the same way.
34
35
  *
35
36
  * It owns NO bot.ts import: every side effect is injected via
36
37
  * {@link ScheduleDeliveryDeps} (announce / pin / busy probe / ensure-session /
@@ -39,6 +40,24 @@ import { type PostToSessionDeps } from '../postToSession';
39
40
  */
40
41
  /** Distinct error string the engine records when a fire hits an unbound topic. */
41
42
  export declare const unboundDeliveryError = "thread is unbound";
43
+ /**
44
+ * @name ScheduleAnnounceOptions
45
+ * @description How a topic message of the scheduler is sent.
46
+ */
47
+ export interface ScheduleAnnounceOptions {
48
+ /** Send without a notification: the bot's ordinary output. Absent only for a reminder, which is meant to ring. */
49
+ isSilent?: boolean;
50
+ /**
51
+ * Text folded under the message: the reader opens it on demand (Telegram: an expandable quote). Plain text — the
52
+ * platform escapes it.
53
+ */
54
+ foldedDetail?: string;
55
+ }
56
+ /** @name ScheduleAnnouncement @description What a fire or an alert says in the topic: the sentence, and the detail folded under it. */
57
+ export interface ScheduleAnnouncement {
58
+ text: string;
59
+ foldedDetail?: string;
60
+ }
42
61
  /**
43
62
  * @name ScheduleDeliveryDeps
44
63
  * @description Everything the delivery callback needs from bot.ts, injected so
@@ -48,19 +67,24 @@ export declare const unboundDeliveryError = "thread is unbound";
48
67
  */
49
68
  export interface ScheduleDeliveryDeps extends PostToSessionDeps {
50
69
  /**
51
- * Post the announcement into the topic (the bot bakes in priority
52
- * `'interactive'`). Resolves with the sent message id, or `null` when the
53
- * send failed — pinning is skipped on `null`.
70
+ * Post a message into the topic (the bot bakes in priority `'interactive'`). Resolves with the sent message id, or
71
+ * `null` when the send failed — a reminder's pin is skipped on `null`.
72
+ */
73
+ announce: (threadKey: string, text: string, options?: ScheduleAnnounceOptions) => Promise<number | null>;
74
+ /** Pin a REMINDER's announcement, notifying (that is how a reminder pierces a muted topic). Rejects on failure. */
75
+ pin: (threadKey: string, messageId: number) => Promise<void>;
76
+ /**
77
+ * Unpin these messages of the topic and resolve with the ids that are STILL pinned and worth another try (Telegram did not
78
+ * answer, asked to slow down, failed on its side). A message that is gone, was never pinned or cannot be unpinned any more
79
+ * is final, so it is not in the list. Never rejects.
54
80
  */
55
- announce: (threadKey: string, text: string) => Promise<number | null>;
56
- /** Pin the announcement. `isSilent` ⇒ `disable_notification`. Rejects on failure. */
57
- pin: (threadKey: string, messageId: number, isSilent: boolean) => Promise<void>;
81
+ unpinMessages: (threadKey: string, messageIds: readonly number[]) => Promise<number[]>;
58
82
  /** Run a check job's command in the thread's bound folder; `null` when the thread is unbound. */
59
83
  runCheck: (threadKey: string, command: string, timeoutMs: number) => Promise<CheckRunResult | null>;
60
84
  /** Persist a check job's failing flag (it decides whether the next run alerts). */
61
85
  setCheckFailing: (jobId: string, isFailing: boolean) => Promise<void>;
62
- /** Remember a check alert's pinned message on its job, so cancelling the job unpins it. */
63
- recordAlertPin: (jobId: string, messageId: number) => Promise<void>;
86
+ /** Forget these alert pins of an earlier version on a job (`ScheduleRecord.alertPinMessageIds`), once they are unpinned. */
87
+ clearAlertPins: (jobId: string, releasedMessageIds: readonly number[]) => Promise<void>;
64
88
  /** Whether this conversation shows status lines at all (a Telegram topic whose view shows the agent's stream). */
65
89
  checkIsStatusShown: (threadKey: string) => boolean;
66
90
  /**
@@ -94,23 +118,42 @@ export declare function prependScheduledRunMarker(jobName: string, prompt: strin
94
118
  dueAtMs?: number;
95
119
  }): string;
96
120
  /**
97
- * @description Build the visible fire-announcement text via i18n, per delivery
98
- * kind: a prompt job frames the run as a scheduled prompt for the agent, a
99
- * reminder leads with its own text (the pin notification previews it, so the
100
- * operator reads the reminder without opening the topic). Both interpolate the
101
- * SAME `{missedNote}` — the catch-up annotation (host-local HH:MM of the missed
102
- * instant) for a `catch-up` fire, empty for an `on-time` run — so a replayed run
103
- * is annotated identically whichever kind it is.
121
+ * @description Build the visible fire announcement via i18n, per delivery kind. A prompt job says «⏰ Scheduled: <name> ·
122
+ * <schedule>» and folds its prompt under it: the prompt is an instruction for the agent, not something a person reads by
123
+ * default. A reminder leads with its own text (the pin notification previews it, so the operator reads the reminder
124
+ * without opening the topic) and carries nothing folded. Both interpolate the SAME `{missedNote}` — the catch-up annotation
125
+ * (host-local HH:MM of the missed instant) for a `catch-up` fire, empty for an `on-time` run.
104
126
  *
105
- * The `{schedule}` text differs per kind ON PURPOSE. A prompt job keeps
106
- * English-only {@link describeSchedule} (its announcement is read alongside the
107
- * agent-facing prompt). A reminder uses the LOCALIZED
108
- * {@link getReminderScheduleText} — the very same words its `/reminders` list row
109
- * and card show, because describing one reminder two different ways is a defect.
127
+ * A reminder's `{schedule}` is always the LOCALIZED {@link getReminderScheduleText} — the very same words its `/reminders`
128
+ * list row and card show, because describing one reminder two different ways is a defect. A prompt job's goes through
129
+ * {@link getAnnouncedScheduleText}, which counts the next run from `nowMs` where nothing phrases the shape.
130
+ */
131
+ export declare function buildFireAnnouncement(job: ScheduleRecord, fireContext: FireContext, nowMs: number): ScheduleAnnouncement;
132
+ /**
133
+ * @name CheckFailedAnnouncementInput
134
+ * @description What the notice of a check's first failure is built from: the job, the failed run, its short description
135
+ * ({@link describeCheckFailure}) and the instant the notice is made at (how long a worker ran).
136
+ */
137
+ export interface CheckFailedAnnouncementInput {
138
+ job: ScheduleRecord;
139
+ result: CheckRunResult;
140
+ failure: string;
141
+ nowMs: number;
142
+ }
143
+ /**
144
+ * @description The topic notice of a check's first failure, in one sentence and never with the command (that goes to the
145
+ * agent's prompt only). A worker watch (a check with a status source of a worker's run directory) says what happened to
146
+ * the worker: finished (its process is gone), silent for {@link workerWatchSilenceMinutes} minutes, or running for
147
+ * {@link workerWatchUnreportedMinutes} minutes since the watch was armed without a report. Any other check — and a
148
+ * worker watch that failed some other way, a timeout say — says it fired, with what failed and the output tail folded under
149
+ * it, because the failure is the only thing a person can use to tell why.
150
+ */
151
+ export declare function buildCheckFailedAnnouncement(input: CheckFailedAnnouncementInput): ScheduleAnnouncement;
152
+ /**
153
+ * @description The line for a check that passes again, in the words of its failure notice: a worker watch speaks of the worker
154
+ * (and its shown name, without the recipe's `watch `), any other check of the check.
110
155
  */
111
- export declare function buildFireAnnouncement(job: ScheduleRecord, fireContext: FireContext): string;
112
- /** @description The topic alert of a check's first failure: what failed, how, and the output tail. */
113
- export declare function buildCheckFailedAnnouncement(job: ScheduleRecord, fireContext: FireContext, failure: string, output: string): string;
156
+ export declare function buildCheckRecoveredText(job: ScheduleRecord): string;
114
157
  /**
115
158
  * @description Take a job's status line out of the topic and out of its record — the ONE place that does it, for a failed or
116
159
  * unbound run, a topic that stopped showing the stream, a final run, and the `/unbind` pause (`unbindPause.ts`). The record is
@@ -1 +1 @@
1
- {"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/scheduler/delivery.ts"],"names":[],"mappings":"AAGA,OAAO,EASL,KAAK,cA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GAAG,oBAAoB,CAmBxH;AASD;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,4BAA4B,GAAG,oBAAoB,CAkBtG;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAInE;AAwED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,GAAG,eAAe,CAAC,EACtE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,WAAW,GAAG,iBAAiB,CAAC,GAChE,OAAO,CAAC,IAAI,CAAC,CAQf;AA4FD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,oBAAoB,GACzB,CAAC,GAAG,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAyB7E"}
@@ -4,6 +4,7 @@ exports.unboundDeliveryError = void 0;
4
4
  exports.prependScheduledRunMarker = prependScheduledRunMarker;
5
5
  exports.buildFireAnnouncement = buildFireAnnouncement;
6
6
  exports.buildCheckFailedAnnouncement = buildCheckFailedAnnouncement;
7
+ exports.buildCheckRecoveredText = buildCheckRecoveredText;
7
8
  exports.clearCheckStatusLine = clearCheckStatusLine;
8
9
  exports.createScheduleDelivery = createScheduleDelivery;
9
10
  const i18n_1 = require("../i18n");
@@ -13,16 +14,17 @@ const checkRun_1 = require("./checkRun");
13
14
  const checkStatus_1 = require("./checkStatus");
14
15
  const deliveryKind_1 = require("./deliveryKind");
15
16
  const recurrence_1 = require("./recurrence");
17
+ const scheduleText_1 = require("./scheduleText");
18
+ const workerWatch_1 = require("./workerWatch");
16
19
  const postToSession_1 = require("../postToSession");
17
20
  /**
18
21
  * @description Scheduler delivery (plan S4): the real `deliver(job, fireContext)`
19
22
  * callback the engine (S3) invokes at fire time. The flow is locked by the plan:
20
23
  *
21
- * 1. announce — post a visible message into the topic (job name + human
22
- * schedule text + the prompt; a "missed at HH:MM" note for a catch-up run).
23
- * 2. pin — pin that announcement (silent ONLY when the job opted in;
24
- * default notifies all members). A pin failure degrades to a `console.warn`
25
- * and the flow continues — the announcement is already visible.
24
+ * 1. announce — post a SILENT message into the topic: «⏰ Scheduled: <name> ·
25
+ * <human schedule>» (+ a "missed at HH:MM" note for a catch-up run), with the
26
+ * prompt folded under it (an agent instruction, not something to read by
27
+ * default). Never pinned: a scheduled run is ordinary output.
26
28
  * 3–4. post the prefixed prompt to the session ({@link postToSession}, shared
27
29
  * with the Jira connector): ensure a session (starting one with the job's
28
30
  * `lastAdapterName` snapshot as the adapter fallback — a topic that never
@@ -31,19 +33,21 @@ const postToSession_1 = require("../postToSession");
31
33
  * unbound topic → outcome `failed` with a distinct error string the engine
32
34
  * records (S8 turns that into a pause).
33
35
  *
34
- * A REMINDER record (`deliveryKind: 'reminder'`) stops after step 2: its whole
35
- * delivery IS the announcement plus its pin, which is what pierces a muted topic.
36
- * Steps 3–4 are skipped entirely, so a reminder fires in an unbound topic and in
37
- * General — there is no session to ensure, nothing to interrupt, and no agent to
38
- * tell about the run.
36
+ * A REMINDER record (`deliveryKind: 'reminder'`) is the one thing still pinned:
37
+ * its whole delivery IS the announcement plus its pin, which is what pierces a
38
+ * muted topic, and it stops there. Steps 3–4 are skipped entirely, so a reminder
39
+ * fires in an unbound topic and in General — there is no session to ensure,
40
+ * nothing to interrupt, and no agent to tell about the run.
39
41
  *
40
42
  * A CHECK record (`deliveryKind: 'check'`) runs its command FIRST and decides
41
43
  * from the result and its persisted failing flag: a pass after a pass, or a
42
44
  * failure after a failure, posts nothing; a pass after a failure posts one
43
- * unpinned "passes again" line; the first failure posts the alert, pins it, and
44
- * then wakes the agent through steps 3–4 with the failure details ahead of the
45
- * job's prompt. An unbound topic fails with the same distinct error as a prompt
46
- * job, so it is paused the same way.
45
+ * "is back to normal" line; the first failure posts a one-sentence silent notice
46
+ * (never the command; a worker watch says "finished" or "silent", any other check
47
+ * folds the output under "fired") and then wakes the agent through steps 3–4 with
48
+ * the command, the failure details and the output ahead of the job's prompt. An
49
+ * unbound topic fails with the same distinct error as a prompt job, so it is
50
+ * paused the same way.
47
51
  *
48
52
  * It owns NO bot.ts import: every side effect is injected via
49
53
  * {@link ScheduleDeliveryDeps} (announce / pin / busy probe / ensure-session /
@@ -67,35 +71,35 @@ function prependScheduledRunMarker(jobName, prompt, options = {}) {
67
71
  return `[Scheduled run "${jobName}"${dueNote}]\n${prompt}`;
68
72
  }
69
73
  /**
70
- * @description Build the visible fire-announcement text via i18n, per delivery
71
- * kind: a prompt job frames the run as a scheduled prompt for the agent, a
72
- * reminder leads with its own text (the pin notification previews it, so the
73
- * operator reads the reminder without opening the topic). Both interpolate the
74
- * SAME `{missedNote}` — the catch-up annotation (host-local HH:MM of the missed
75
- * instant) for a `catch-up` fire, empty for an `on-time` run — so a replayed run
76
- * is annotated identically whichever kind it is.
74
+ * @description Build the visible fire announcement via i18n, per delivery kind. A prompt job says «⏰ Scheduled: <name> ·
75
+ * <schedule>» and folds its prompt under it: the prompt is an instruction for the agent, not something a person reads by
76
+ * default. A reminder leads with its own text (the pin notification previews it, so the operator reads the reminder
77
+ * without opening the topic) and carries nothing folded. Both interpolate the SAME `{missedNote}` — the catch-up annotation
78
+ * (host-local HH:MM of the missed instant) for a `catch-up` fire, empty for an `on-time` run.
77
79
  *
78
- * The `{schedule}` text differs per kind ON PURPOSE. A prompt job keeps
79
- * English-only {@link describeSchedule} (its announcement is read alongside the
80
- * agent-facing prompt). A reminder uses the LOCALIZED
81
- * {@link getReminderScheduleText} — the very same words its `/reminders` list row
82
- * and card show, because describing one reminder two different ways is a defect.
80
+ * A reminder's `{schedule}` is always the LOCALIZED {@link getReminderScheduleText} — the very same words its `/reminders`
81
+ * list row and card show, because describing one reminder two different ways is a defect. A prompt job's goes through
82
+ * {@link getAnnouncedScheduleText}, which counts the next run from `nowMs` where nothing phrases the shape.
83
83
  */
84
- function buildFireAnnouncement(job, fireContext) {
84
+ function buildFireAnnouncement(job, fireContext, nowMs) {
85
85
  const missedNote = getMissedNote(fireContext);
86
86
  if ((0, deliveryKind_1.checkIsReminderSchedule)(job)) {
87
- return (0, i18n_1.t)('reminders.fired', {
88
- text: job.prompt,
89
- schedule: (0, reminderScheduleText_1.getReminderScheduleText)(job.spec),
90
- missedNote,
91
- });
87
+ return {
88
+ text: (0, i18n_1.t)('reminders.fired', {
89
+ text: job.prompt,
90
+ schedule: (0, reminderScheduleText_1.getReminderScheduleText)(job.spec),
91
+ missedNote,
92
+ }),
93
+ };
92
94
  }
93
- return (0, i18n_1.t)('schedule.fired', {
94
- name: job.name,
95
- schedule: (0, recurrence_1.describeSchedule)(job.spec),
96
- prompt: job.prompt,
97
- missedNote,
98
- });
95
+ return {
96
+ text: (0, i18n_1.t)('schedule.fired', {
97
+ name: job.name,
98
+ schedule: (0, scheduleText_1.getAnnouncedScheduleText)(job.spec, nowMs),
99
+ missedNote,
100
+ }),
101
+ foldedDetail: job.prompt,
102
+ };
99
103
  }
100
104
  /** @description The catch-up note of a fire, empty for an on-time run. */
101
105
  function getMissedNote(fireContext) {
@@ -103,32 +107,77 @@ function getMissedNote(fireContext) {
103
107
  ? (0, i18n_1.t)('schedule.missedNote', { time: (0, localClock_1.formatLocalClock)(fireContext.missedAtMs) })
104
108
  : '';
105
109
  }
106
- /** @description The topic alert of a check's first failure: what failed, how, and the output tail. */
107
- function buildCheckFailedAnnouncement(job, fireContext, failure, output) {
108
- return (0, i18n_1.t)('schedule.checkFailed', {
109
- name: job.name,
110
- schedule: (0, recurrence_1.describeSchedule)(job.spec),
111
- missedNote: getMissedNote(fireContext),
112
- failure,
113
- command: (0, checkRun_1.getCheckAlertCommand)(job.checkCommand ?? ''),
114
- output: (0, checkRun_1.getOutputTail)(output.trim(), checkRun_1.checkAlertOutputMaxChars) || '—',
115
- });
110
+ /**
111
+ * @description The topic notice of a check's first failure, in one sentence and never with the command (that goes to the
112
+ * agent's prompt only). A worker watch (a check with a status source of a worker's run directory) says what happened to
113
+ * the worker: finished (its process is gone), silent for {@link workerWatchSilenceMinutes} minutes, or running for
114
+ * {@link workerWatchUnreportedMinutes} minutes since the watch was armed without a report. Any other check — and a
115
+ * worker watch that failed some other way, a timeout say — says it fired, with what failed and the output tail folded under
116
+ * it, because the failure is the only thing a person can use to tell why.
117
+ */
118
+ function buildCheckFailedAnnouncement(input) {
119
+ const { job, result, failure } = input;
120
+ if (job.statusWorkerRunDir !== undefined) {
121
+ const workerEnd = (0, workerWatch_1.getWorkerWatchEnd)(result);
122
+ const name = (0, checkStatus_1.getCheckShownName)(job.name);
123
+ if (workerEnd === 'finished') {
124
+ return { text: (0, i18n_1.t)('schedule.workerFinished', { name, elapsed: (0, checkStatus_1.getCheckStatusElapsedText)(input.nowMs - Date.parse(job.createdAt)) }) };
125
+ }
126
+ if (workerEnd === 'silent')
127
+ return { text: (0, i18n_1.t)('schedule.workerSilent', { name, minutes: workerWatch_1.workerWatchSilenceMinutes }) };
128
+ if (workerEnd === 'unreported') {
129
+ return { text: (0, i18n_1.t)('schedule.workerUnreported', { name, elapsed: (0, checkStatus_1.getCheckStatusElapsedText)(workerWatch_1.workerWatchUnreportedMinutes * checkStatus_1.msPerMinute) }) };
130
+ }
131
+ }
132
+ const outputTail = (0, checkRun_1.getOutputTail)(result.output.trim(), checkRun_1.checkAlertOutputMaxChars);
133
+ return {
134
+ text: (0, i18n_1.t)('schedule.checkFired', { name: job.name }),
135
+ foldedDetail: outputTail === '' ? failure : `${failure}\n\n${outputTail}`,
136
+ };
137
+ }
138
+ /**
139
+ * @description The line for a check that passes again, in the words of its failure notice: a worker watch speaks of the worker
140
+ * (and its shown name, without the recipe's `watch `), any other check of the check.
141
+ */
142
+ function buildCheckRecoveredText(job) {
143
+ return job.statusWorkerRunDir !== undefined
144
+ ? (0, i18n_1.t)('schedule.workerResumed', { name: (0, checkStatus_1.getCheckShownName)(job.name) })
145
+ : (0, i18n_1.t)('schedule.checkRecovered', { name: job.name });
116
146
  }
117
147
  /**
118
- * @description Steps 1–2: post the announcement and pin it; resolves with the pinned message id. A pin failure only
119
- * logs — the announcement is already visible — and resolves null, as a failed send does.
148
+ * @description A REMINDER's step 1–2: post the announcement and pin it (notifying: the pin is what pierces a muted topic);
149
+ * a pin failure only logs — the announcement is already visible. The only pin the scheduler still makes.
120
150
  */
121
- async function announceAndPin(deps, job, text) {
151
+ async function announceAndPinReminder(deps, job, text) {
122
152
  const messageId = await deps.announce(job.threadKey, text);
123
153
  if (messageId === null)
124
- return null;
154
+ return;
125
155
  try {
126
- await deps.pin(job.threadKey, messageId, job.isPinSilent === true);
127
- return messageId;
156
+ await deps.pin(job.threadKey, messageId);
128
157
  }
129
158
  catch (error) {
130
159
  console.warn(`[scheduler] pin announcement for job ${job.id} failed:`, error instanceof Error ? error.message : error);
131
- return null;
160
+ }
161
+ }
162
+ /**
163
+ * @description Earlier versions pinned every check alert and remembered the pinned ids on the job. They are released at the
164
+ * job's next run: unpinned, then forgotten (in that order — a crash in between repeats the harmless unpin). Only the ids that
165
+ * ARE released are forgotten: one Telegram did not answer for stays on the job and is tried again at the next run, so no old
166
+ * alert stays pinned for good. Never rejects — a check must run whatever happens to an old pin. A job that never runs again
167
+ * (paused) keeps them until `schedule_cancel`, which releases them too.
168
+ */
169
+ async function releaseLegacyAlertPins(deps, job) {
170
+ const messageIds = job.alertPinMessageIds ?? [];
171
+ if (messageIds.length === 0)
172
+ return;
173
+ try {
174
+ const stillPinnedIds = await deps.unpinMessages(job.threadKey, messageIds);
175
+ const releasedIds = messageIds.filter((messageId) => !stillPinnedIds.includes(messageId));
176
+ if (releasedIds.length > 0)
177
+ await deps.clearAlertPins(job.id, releasedIds);
178
+ }
179
+ catch (error) {
180
+ console.warn(`[scheduler] releasing the old alert pins of job ${job.id} failed:`, error instanceof Error ? error.message : error);
132
181
  }
133
182
  }
134
183
  /**
@@ -203,7 +252,8 @@ async function updateCheckStatus(deps, job) {
203
252
  if (job.statusWorkerRunDir === undefined && job.statusCommand === undefined)
204
253
  return;
205
254
  try {
206
- if (!deps.checkIsStatusShown(job.threadKey) || (0, checkStatus_1.checkIsFinalCheckRun)(job)) {
255
+ // The job's last run: its line would be deleted at once by the finished check, so none is posted and the existing one goes.
256
+ if (!deps.checkIsStatusShown(job.threadKey) || (0, recurrence_1.checkIsFinalRun)(job.spec)) {
207
257
  await clearCheckStatusLine(deps, job);
208
258
  return;
209
259
  }
@@ -228,13 +278,14 @@ async function updateCheckStatus(deps, job) {
228
278
  }
229
279
  /**
230
280
  * @description The check flow: run the command, then stay quiet, post the
231
- * "passes again" line, or raise the alert and wake the agent. The failing flag is
281
+ * "back to normal" line, or raise the alert and wake the agent. The failing flag is
232
282
  * stored BEFORE the agent is woken, so a restart mid-delivery cannot raise the
233
283
  * same alert twice.
234
284
  */
235
- async function deliverCheck(deps, job, fireContext) {
285
+ async function deliverCheck(deps, job) {
236
286
  const timeoutSec = job.checkTimeoutSec ?? checkRun_1.defaultCheckTimeoutSec;
237
287
  const command = job.checkCommand ?? '';
288
+ await releaseLegacyAlertPins(deps, job);
238
289
  const result = await deps.runCheck(job.threadKey, command, timeoutSec * 1000);
239
290
  if (!result) {
240
291
  // A binding that went without `/unbind` (the unbind itself clears the line when it parks the job — `unbindPause.ts`): the
@@ -252,7 +303,7 @@ async function deliverCheck(deps, job, fireContext) {
252
303
  }
253
304
  if (decision === 'recovered') {
254
305
  await deps.setCheckFailing(job.id, false);
255
- await deps.announce(job.threadKey, (0, i18n_1.t)('schedule.checkRecovered', { name: job.name }));
306
+ await deps.announce(job.threadKey, buildCheckRecoveredText(job), { isSilent: true });
256
307
  await updateCheckStatus(deps, job);
257
308
  return { status: 'delivered' };
258
309
  }
@@ -260,9 +311,8 @@ async function deliverCheck(deps, job, fireContext) {
260
311
  await clearCheckStatusLine(deps, job);
261
312
  await deps.setCheckFailing(job.id, true);
262
313
  const failure = (0, checkRun_1.describeCheckFailure)(result, timeoutSec);
263
- const alertPinId = await announceAndPin(deps, job, buildCheckFailedAnnouncement(job, fireContext, failure, result.output));
264
- if (alertPinId !== null)
265
- await deps.recordAlertPin(job.id, alertPinId);
314
+ const alert = buildCheckFailedAnnouncement({ job, result, failure, nowMs: deps.now() });
315
+ await deps.announce(job.threadKey, alert.text, { isSilent: true, foldedDetail: alert.foldedDetail });
266
316
  return deliverToAgent(deps, job, (0, checkRun_1.buildCheckFailurePrompt)({ name: job.name, command, failure, output: result.output, prompt: job.prompt }));
267
317
  }
268
318
  /**
@@ -272,17 +322,20 @@ async function deliverCheck(deps, job, fireContext) {
272
322
  function createScheduleDelivery(deps) {
273
323
  return async (job, fireContext) => {
274
324
  if ((0, deliveryKind_1.checkIsCheckSchedule)(job))
275
- return deliverCheck(deps, job, fireContext);
276
- // Read before the paced announce and pin, which can take a while under load:
325
+ return deliverCheck(deps, job);
326
+ // Read before the paced announce, which can take a while under load:
277
327
  // a run held over a usage-limit wait says when it was due (R27).
278
328
  const dueAtMs = fireContext.kind === 'catch-up' && fireContext.missedAtMs !== undefined ? fireContext.missedAtMs : deps.now();
279
- // 1–2. announce and pin
280
- await announceAndPin(deps, job, buildFireAnnouncement(job, fireContext));
281
- // A reminder is done here: announced and pinned, with no agent involved at
329
+ // 1. announce
330
+ const announcement = buildFireAnnouncement(job, fireContext, deps.now());
331
+ // A reminder is done after its announcement and its pin, with no agent involved at
282
332
  // all. Returning before `ensureSession` is also what lets it fire in an
283
333
  // unbound topic and in General — there is no session to fail to ensure.
284
- if ((0, deliveryKind_1.checkIsReminderSchedule)(job))
334
+ if ((0, deliveryKind_1.checkIsReminderSchedule)(job)) {
335
+ await announceAndPinReminder(deps, job, announcement.text);
285
336
  return { status: 'delivered' };
337
+ }
338
+ await deps.announce(job.threadKey, announcement.text, { isSilent: true, foldedDetail: announcement.foldedDetail });
286
339
  // 3–4. wake the agent with the prompt. A run held over a usage-limit wait
287
340
  // reaches the agent later: it says when it was due (R27).
288
341
  return deliverToAgent(deps, job, prependScheduledRunMarker(job.name, job.prompt), {