charness 4.1.1 → 4.3.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 (643) hide show
  1. package/CHANGELOG.md +186 -2
  2. package/DEVELOPMENT.md +65 -11
  3. package/LICENSE +331 -151
  4. package/MIGRATION_3_TO_4.md +8 -5
  5. package/README.md +23 -8
  6. package/SETUP.md +57 -11
  7. package/agent-plugin/README.md +10 -3
  8. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +18 -26
  9. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +5 -3
  10. package/agent-plugin/skills/charness-orchestration/SKILL.md +57 -16
  11. package/dist/adapters/adapterNames.d.ts +2 -0
  12. package/dist/adapters/adapterNames.d.ts.map +1 -1
  13. package/dist/adapters/adapterNames.js +3 -1
  14. package/dist/adapters/adapterNames.js.map +1 -1
  15. package/dist/adapters/claudeCliAdapter.d.ts +4 -0
  16. package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
  17. package/dist/adapters/claudeCliAdapter.js +13 -0
  18. package/dist/adapters/claudeCliAdapter.js.map +1 -1
  19. package/dist/adapters/claudeJsonStreamAdapter.d.ts +150 -10
  20. package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
  21. package/dist/adapters/claudeJsonStreamAdapter.js +401 -83
  22. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
  23. package/dist/adapters/createAdapter.d.ts +12 -3
  24. package/dist/adapters/createAdapter.d.ts.map +1 -1
  25. package/dist/adapters/createAdapter.js +39 -13
  26. package/dist/adapters/createAdapter.js.map +1 -1
  27. package/dist/adapters/openCodeAdapter.d.ts +65 -2
  28. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  29. package/dist/adapters/openCodeAdapter.js +202 -19
  30. package/dist/adapters/openCodeAdapter.js.map +1 -1
  31. package/dist/adapters/terminalAdapter.d.ts.map +1 -1
  32. package/dist/adapters/terminalAdapter.js +2 -1
  33. package/dist/adapters/terminalAdapter.js.map +1 -1
  34. package/dist/apiErrorRetry.d.ts +11 -3
  35. package/dist/apiErrorRetry.d.ts.map +1 -1
  36. package/dist/apiErrorRetry.js +33 -3
  37. package/dist/apiErrorRetry.js.map +1 -1
  38. package/dist/apiRetryKick.d.ts +3 -2
  39. package/dist/apiRetryKick.d.ts.map +1 -1
  40. package/dist/apiRetryKick.js +13 -5
  41. package/dist/apiRetryKick.js.map +1 -1
  42. package/dist/bot.d.ts +2 -6
  43. package/dist/bot.d.ts.map +1 -1
  44. package/dist/bot.js +2586 -693
  45. package/dist/bot.js.map +1 -1
  46. package/dist/cli/claudeProfiles.d.ts +31 -6
  47. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  48. package/dist/cli/claudeProfiles.js +97 -22
  49. package/dist/cli/claudeProfiles.js.map +1 -1
  50. package/dist/cli.d.ts.map +1 -1
  51. package/dist/cli.js +2 -1
  52. package/dist/cli.js.map +1 -1
  53. package/dist/connectors/jira/answerSink.d.ts +102 -7
  54. package/dist/connectors/jira/answerSink.d.ts.map +1 -1
  55. package/dist/connectors/jira/answerSink.js +364 -60
  56. package/dist/connectors/jira/answerSink.js.map +1 -1
  57. package/dist/connectors/jira/answerThreads.d.ts +44 -0
  58. package/dist/connectors/jira/answerThreads.d.ts.map +1 -0
  59. package/dist/connectors/jira/answerThreads.js +85 -0
  60. package/dist/connectors/jira/answerThreads.js.map +1 -0
  61. package/dist/connectors/jira/client.d.ts +67 -2
  62. package/dist/connectors/jira/client.d.ts.map +1 -1
  63. package/dist/connectors/jira/client.js +176 -4
  64. package/dist/connectors/jira/client.js.map +1 -1
  65. package/dist/connectors/jira/config.d.ts +6 -0
  66. package/dist/connectors/jira/config.d.ts.map +1 -1
  67. package/dist/connectors/jira/config.js +14 -1
  68. package/dist/connectors/jira/config.js.map +1 -1
  69. package/dist/connectors/jira/connector.d.ts +19 -0
  70. package/dist/connectors/jira/connector.d.ts.map +1 -1
  71. package/dist/connectors/jira/connector.js +68 -6
  72. package/dist/connectors/jira/connector.js.map +1 -1
  73. package/dist/connectors/jira/contextPreamble.d.ts.map +1 -1
  74. package/dist/connectors/jira/contextPreamble.js +6 -1
  75. package/dist/connectors/jira/contextPreamble.js.map +1 -1
  76. package/dist/connectors/jira/inbound.d.ts +21 -6
  77. package/dist/connectors/jira/inbound.d.ts.map +1 -1
  78. package/dist/connectors/jira/inbound.js +22 -16
  79. package/dist/connectors/jira/inbound.js.map +1 -1
  80. package/dist/connectors/jira/issueBlocks.d.ts +8 -1
  81. package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
  82. package/dist/connectors/jira/issueBlocks.js +38 -2
  83. package/dist/connectors/jira/issueBlocks.js.map +1 -1
  84. package/dist/connectors/jira/operatorIssue.d.ts +28 -0
  85. package/dist/connectors/jira/operatorIssue.d.ts.map +1 -0
  86. package/dist/connectors/jira/operatorIssue.js +81 -0
  87. package/dist/connectors/jira/operatorIssue.js.map +1 -0
  88. package/dist/connectors/jira/outbound.d.ts +8 -4
  89. package/dist/connectors/jira/outbound.d.ts.map +1 -1
  90. package/dist/connectors/jira/outbound.js +16 -8
  91. package/dist/connectors/jira/outbound.js.map +1 -1
  92. package/dist/connectors/jira/outgoingFileCheck.d.ts +37 -0
  93. package/dist/connectors/jira/outgoingFileCheck.d.ts.map +1 -0
  94. package/dist/connectors/jira/outgoingFileCheck.js +279 -0
  95. package/dist/connectors/jira/outgoingFileCheck.js.map +1 -0
  96. package/dist/connectors/jira/outgoingFiles.d.ts +81 -0
  97. package/dist/connectors/jira/outgoingFiles.d.ts.map +1 -0
  98. package/dist/connectors/jira/outgoingFiles.js +268 -0
  99. package/dist/connectors/jira/outgoingFiles.js.map +1 -0
  100. package/dist/connectors/jira/progressComments.d.ts +69 -0
  101. package/dist/connectors/jira/progressComments.d.ts.map +1 -0
  102. package/dist/connectors/jira/progressComments.js +136 -0
  103. package/dist/connectors/jira/progressComments.js.map +1 -0
  104. package/dist/connectors/jira/prompt.d.ts +5 -1
  105. package/dist/connectors/jira/prompt.d.ts.map +1 -1
  106. package/dist/connectors/jira/prompt.js +23 -3
  107. package/dist/connectors/jira/prompt.js.map +1 -1
  108. package/dist/connectors/jira/promptSpill.js +1 -1
  109. package/dist/connectors/jira/promptSpill.js.map +1 -1
  110. package/dist/connectors/jira/trigger.d.ts +13 -5
  111. package/dist/connectors/jira/trigger.d.ts.map +1 -1
  112. package/dist/connectors/jira/trigger.js +13 -7
  113. package/dist/connectors/jira/trigger.js.map +1 -1
  114. package/dist/connectors/jira/uploadedFiles.d.ts +48 -0
  115. package/dist/connectors/jira/uploadedFiles.d.ts.map +1 -0
  116. package/dist/connectors/jira/uploadedFiles.js +123 -0
  117. package/dist/connectors/jira/uploadedFiles.js.map +1 -0
  118. package/dist/connectors/telegram/commands/backendSwitch.d.ts +9 -1
  119. package/dist/connectors/telegram/commands/backendSwitch.d.ts.map +1 -1
  120. package/dist/connectors/telegram/commands/backendSwitch.js +17 -8
  121. package/dist/connectors/telegram/commands/backendSwitch.js.map +1 -1
  122. package/dist/connectors/telegram/commands/botCore.d.ts +5 -2
  123. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  124. package/dist/connectors/telegram/commands/botSkills.d.ts +2 -0
  125. package/dist/connectors/telegram/commands/botSkills.d.ts.map +1 -1
  126. package/dist/connectors/telegram/commands/botSkills.js +17 -2
  127. package/dist/connectors/telegram/commands/botSkills.js.map +1 -1
  128. package/dist/connectors/telegram/commands/claudeAccounts.d.ts +11 -0
  129. package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
  130. package/dist/connectors/telegram/commands/claudeAccounts.js +36 -42
  131. package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
  132. package/dist/connectors/telegram/commands/compaction.d.ts +20 -3
  133. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  134. package/dist/connectors/telegram/commands/compaction.js +268 -96
  135. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  136. package/dist/connectors/telegram/commands/limitReminders.d.ts +21 -0
  137. package/dist/connectors/telegram/commands/limitReminders.d.ts.map +1 -0
  138. package/dist/connectors/telegram/commands/limitReminders.js +95 -0
  139. package/dist/connectors/telegram/commands/limitReminders.js.map +1 -0
  140. package/dist/connectors/telegram/commands/limitsBoard.d.ts +4 -0
  141. package/dist/connectors/telegram/commands/limitsBoard.d.ts.map +1 -1
  142. package/dist/connectors/telegram/commands/limitsBoard.js +27 -6
  143. package/dist/connectors/telegram/commands/limitsBoard.js.map +1 -1
  144. package/dist/connectors/telegram/commands/modelProviders.d.ts +2 -2
  145. package/dist/connectors/telegram/commands/modelProviders.d.ts.map +1 -1
  146. package/dist/connectors/telegram/commands/modelProviders.js +27 -16
  147. package/dist/connectors/telegram/commands/modelProviders.js.map +1 -1
  148. package/dist/connectors/telegram/commands/questionSetAside.d.ts +111 -0
  149. package/dist/connectors/telegram/commands/questionSetAside.d.ts.map +1 -0
  150. package/dist/connectors/telegram/commands/questionSetAside.js +637 -0
  151. package/dist/connectors/telegram/commands/questionSetAside.js.map +1 -0
  152. package/dist/connectors/telegram/commands/questionWait.d.ts +21 -0
  153. package/dist/connectors/telegram/commands/questionWait.d.ts.map +1 -0
  154. package/dist/connectors/telegram/commands/questionWait.js +109 -0
  155. package/dist/connectors/telegram/commands/questionWait.js.map +1 -0
  156. package/dist/connectors/telegram/commands/topicAccess.js +1 -1
  157. package/dist/connectors/telegram/commands/topicAccess.js.map +1 -1
  158. package/dist/connectors/telegram/commands/topicCommand.d.ts +0 -2
  159. package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
  160. package/dist/connectors/telegram/commands/topicCommand.js +11 -7
  161. package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
  162. package/dist/connectors/telegram/commands/topicStatus.d.ts +24 -0
  163. package/dist/connectors/telegram/commands/topicStatus.d.ts.map +1 -0
  164. package/dist/connectors/telegram/commands/topicStatus.js +148 -0
  165. package/dist/connectors/telegram/commands/topicStatus.js.map +1 -0
  166. package/dist/connectors/telegram/commands/workerRoles.d.ts +25 -0
  167. package/dist/connectors/telegram/commands/workerRoles.d.ts.map +1 -0
  168. package/dist/connectors/telegram/commands/workerRoles.js +259 -0
  169. package/dist/connectors/telegram/commands/workerRoles.js.map +1 -0
  170. package/dist/connectors/telegram/firstUpdateBatchNote.d.ts +30 -0
  171. package/dist/connectors/telegram/firstUpdateBatchNote.d.ts.map +1 -0
  172. package/dist/connectors/telegram/firstUpdateBatchNote.js +39 -0
  173. package/dist/connectors/telegram/firstUpdateBatchNote.js.map +1 -0
  174. package/dist/connectors/telegram/groupWelcome.d.ts +12 -0
  175. package/dist/connectors/telegram/groupWelcome.d.ts.map +1 -0
  176. package/dist/connectors/telegram/groupWelcome.js +12 -0
  177. package/dist/connectors/telegram/groupWelcome.js.map +1 -0
  178. package/dist/connectors/telegram/inbound.d.ts +19 -0
  179. package/dist/connectors/telegram/inbound.d.ts.map +1 -1
  180. package/dist/connectors/telegram/inbound.js +41 -3
  181. package/dist/connectors/telegram/inbound.js.map +1 -1
  182. package/dist/connectors/telegram/outputFlushPlan.d.ts +12 -0
  183. package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
  184. package/dist/connectors/telegram/outputFlushPlan.js +12 -0
  185. package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
  186. package/dist/connectors/telegram/runnerPairingMessages.d.ts +1 -1
  187. package/dist/connectors/telegram/topicIndicator.d.ts +86 -0
  188. package/dist/connectors/telegram/topicIndicator.d.ts.map +1 -0
  189. package/dist/connectors/telegram/topicIndicator.js +588 -0
  190. package/dist/connectors/telegram/topicIndicator.js.map +1 -0
  191. package/dist/connectors/telegram/waitingTopicRenames.d.ts +39 -0
  192. package/dist/connectors/telegram/waitingTopicRenames.d.ts.map +1 -0
  193. package/dist/connectors/telegram/waitingTopicRenames.js +48 -0
  194. package/dist/connectors/telegram/waitingTopicRenames.js.map +1 -0
  195. package/dist/effortLevels.d.ts +6 -0
  196. package/dist/effortLevels.d.ts.map +1 -1
  197. package/dist/effortLevels.js +6 -1
  198. package/dist/effortLevels.js.map +1 -1
  199. package/dist/i18n/de.d.ts.map +1 -1
  200. package/dist/i18n/de.js +141 -13
  201. package/dist/i18n/de.js.map +1 -1
  202. package/dist/i18n/en.d.ts.map +1 -1
  203. package/dist/i18n/en.js +141 -13
  204. package/dist/i18n/en.js.map +1 -1
  205. package/dist/i18n/es.d.ts.map +1 -1
  206. package/dist/i18n/es.js +141 -13
  207. package/dist/i18n/es.js.map +1 -1
  208. package/dist/i18n/fr.d.ts.map +1 -1
  209. package/dist/i18n/fr.js +141 -13
  210. package/dist/i18n/fr.js.map +1 -1
  211. package/dist/i18n/hi.d.ts.map +1 -1
  212. package/dist/i18n/hi.js +141 -13
  213. package/dist/i18n/hi.js.map +1 -1
  214. package/dist/i18n/ja.d.ts.map +1 -1
  215. package/dist/i18n/ja.js +141 -13
  216. package/dist/i18n/ja.js.map +1 -1
  217. package/dist/i18n/ka.d.ts.map +1 -1
  218. package/dist/i18n/ka.js +141 -13
  219. package/dist/i18n/ka.js.map +1 -1
  220. package/dist/i18n/pt.d.ts.map +1 -1
  221. package/dist/i18n/pt.js +141 -13
  222. package/dist/i18n/pt.js.map +1 -1
  223. package/dist/i18n/ru.d.ts.map +1 -1
  224. package/dist/i18n/ru.js +141 -13
  225. package/dist/i18n/ru.js.map +1 -1
  226. package/dist/i18n/uk.d.ts.map +1 -1
  227. package/dist/i18n/uk.js +141 -13
  228. package/dist/i18n/uk.js.map +1 -1
  229. package/dist/i18n/uz.d.ts.map +1 -1
  230. package/dist/i18n/uz.js +141 -13
  231. package/dist/i18n/uz.js.map +1 -1
  232. package/dist/i18n/zh.d.ts.map +1 -1
  233. package/dist/i18n/zh.js +141 -13
  234. package/dist/i18n/zh.js.map +1 -1
  235. package/dist/instanceSettings.d.ts +43 -3
  236. package/dist/instanceSettings.d.ts.map +1 -1
  237. package/dist/instanceSettings.js +109 -4
  238. package/dist/instanceSettings.js.map +1 -1
  239. package/dist/limitNotes/engine.d.ts +47 -0
  240. package/dist/limitNotes/engine.d.ts.map +1 -0
  241. package/dist/limitNotes/engine.js +98 -0
  242. package/dist/limitNotes/engine.js.map +1 -0
  243. package/dist/limitNotes/noteText.d.ts +33 -0
  244. package/dist/limitNotes/noteText.d.ts.map +1 -0
  245. package/dist/limitNotes/noteText.js +55 -0
  246. package/dist/limitNotes/noteText.js.map +1 -0
  247. package/dist/limitNotes/plan.d.ts +147 -0
  248. package/dist/limitNotes/plan.d.ts.map +1 -0
  249. package/dist/limitNotes/plan.js +323 -0
  250. package/dist/limitNotes/plan.js.map +1 -0
  251. package/dist/limitNotes/reminderChoices.d.ts +30 -0
  252. package/dist/limitNotes/reminderChoices.d.ts.map +1 -0
  253. package/dist/limitNotes/reminderChoices.js +48 -0
  254. package/dist/limitNotes/reminderChoices.js.map +1 -0
  255. package/dist/limitNotes/service.d.ts +106 -0
  256. package/dist/limitNotes/service.d.ts.map +1 -0
  257. package/dist/limitNotes/service.js +169 -0
  258. package/dist/limitNotes/service.js.map +1 -0
  259. package/dist/openCodeOpenQuestion.d.ts +12 -4
  260. package/dist/openCodeOpenQuestion.d.ts.map +1 -1
  261. package/dist/openCodeOpenQuestion.js +16 -7
  262. package/dist/openCodeOpenQuestion.js.map +1 -1
  263. package/dist/openCodeQuestionFlow.d.ts +10 -2
  264. package/dist/openCodeQuestionFlow.d.ts.map +1 -1
  265. package/dist/openCodeQuestionFlow.js +27 -5
  266. package/dist/openCodeQuestionFlow.js.map +1 -1
  267. package/dist/openCodeSessionTitle.js +1 -1
  268. package/dist/openCodeSessionTitle.js.map +1 -1
  269. package/dist/outputTrace.d.ts +19 -0
  270. package/dist/outputTrace.d.ts.map +1 -1
  271. package/dist/outputTrace.js +23 -2
  272. package/dist/outputTrace.js.map +1 -1
  273. package/dist/platform/answerSink.d.ts +23 -0
  274. package/dist/platform/answerSink.d.ts.map +1 -1
  275. package/dist/platform/answerSink.js.map +1 -1
  276. package/dist/platform/operatorAlert.d.ts +24 -0
  277. package/dist/platform/operatorAlert.d.ts.map +1 -0
  278. package/dist/platform/operatorAlert.js +9 -0
  279. package/dist/platform/operatorAlert.js.map +1 -0
  280. package/dist/postToSession.d.ts +43 -2
  281. package/dist/postToSession.d.ts.map +1 -1
  282. package/dist/postToSession.js +46 -4
  283. package/dist/postToSession.js.map +1 -1
  284. package/dist/remoteRun/exitCodes.d.ts +2 -2
  285. package/dist/remoteRun/exitCodes.d.ts.map +1 -1
  286. package/dist/remoteRun/exitCodes.js +2 -2
  287. package/dist/remoteRun/exitCodes.js.map +1 -1
  288. package/dist/remoteRun/foreground.d.ts.map +1 -1
  289. package/dist/remoteRun/foreground.js +5 -1
  290. package/dist/remoteRun/foreground.js.map +1 -1
  291. package/dist/remoteRun/runnerClient.d.ts +1 -1
  292. package/dist/remoteRun/runnerClient.d.ts.map +1 -1
  293. package/dist/remoteRun/runnerClient.js +3 -3
  294. package/dist/remoteRun/runnerClient.js.map +1 -1
  295. package/dist/requests/answerRequest.d.ts +3 -0
  296. package/dist/requests/answerRequest.d.ts.map +1 -1
  297. package/dist/requests/answerRequest.js +9 -2
  298. package/dist/requests/answerRequest.js.map +1 -1
  299. package/dist/requests/limitWaitAnswer.d.ts +14 -0
  300. package/dist/requests/limitWaitAnswer.d.ts.map +1 -1
  301. package/dist/requests/limitWaitAnswer.js +26 -4
  302. package/dist/requests/limitWaitAnswer.js.map +1 -1
  303. package/dist/requests/requestHeader.d.ts +37 -5
  304. package/dist/requests/requestHeader.d.ts.map +1 -1
  305. package/dist/requests/requestHeader.js +46 -17
  306. package/dist/requests/requestHeader.js.map +1 -1
  307. package/dist/requests/scheduleWait.d.ts +79 -0
  308. package/dist/requests/scheduleWait.d.ts.map +1 -0
  309. package/dist/requests/scheduleWait.js +101 -0
  310. package/dist/requests/scheduleWait.js.map +1 -0
  311. package/dist/requests/sessionTurnProbe.d.ts +21 -3
  312. package/dist/requests/sessionTurnProbe.d.ts.map +1 -1
  313. package/dist/requests/sessionTurnProbe.js +18 -3
  314. package/dist/requests/sessionTurnProbe.js.map +1 -1
  315. package/dist/requests/topicRequestSettle.d.ts +13 -7
  316. package/dist/requests/topicRequestSettle.d.ts.map +1 -1
  317. package/dist/requests/topicRequestSettle.js +2 -2
  318. package/dist/requests/topicRequestSettle.js.map +1 -1
  319. package/dist/requests/trackerTurnPoster.d.ts +30 -0
  320. package/dist/requests/trackerTurnPoster.d.ts.map +1 -0
  321. package/dist/requests/trackerTurnPoster.js +36 -0
  322. package/dist/requests/trackerTurnPoster.js.map +1 -0
  323. package/dist/requests/types.d.ts +9 -2
  324. package/dist/requests/types.d.ts.map +1 -1
  325. package/dist/requests/wakeUpEngine.d.ts +188 -11
  326. package/dist/requests/wakeUpEngine.d.ts.map +1 -1
  327. package/dist/requests/wakeUpEngine.js +452 -43
  328. package/dist/requests/wakeUpEngine.js.map +1 -1
  329. package/dist/requests/wakeUpRules.d.ts +122 -12
  330. package/dist/requests/wakeUpRules.d.ts.map +1 -1
  331. package/dist/requests/wakeUpRules.js +117 -15
  332. package/dist/requests/wakeUpRules.js.map +1 -1
  333. package/dist/resumeContext.d.ts +2 -2
  334. package/dist/resumeContext.js +3 -3
  335. package/dist/resumeContext.js.map +1 -1
  336. package/dist/runnerUtility/adminService.js +1 -1
  337. package/dist/runnerUtility/adminService.js.map +1 -1
  338. package/dist/runnerUtility/guiAgent.d.ts +1 -1
  339. package/dist/runnerUtility/guiAgent.d.ts.map +1 -1
  340. package/dist/runnerUtility/guiAgent.js +1 -1
  341. package/dist/runnerUtility/guiAgent.js.map +1 -1
  342. package/dist/runnerUtility/managedNode.d.ts +3 -3
  343. package/dist/runnerUtility/managedNode.d.ts.map +1 -1
  344. package/dist/runnerUtility/managedNode.js +2 -2
  345. package/dist/runnerUtility/managedNode.js.map +1 -1
  346. package/dist/runnerUtility/runnerConfig.d.ts +1 -1
  347. package/dist/runnerUtility/runnerHome.d.ts +1 -1
  348. package/dist/runnerUtility/runnerHome.js +1 -1
  349. package/dist/runnerUtility/serviceCommon.d.ts +1 -1
  350. package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
  351. package/dist/runnerUtility/serviceCommon.js +1 -1
  352. package/dist/runnerUtility/serviceCommon.js.map +1 -1
  353. package/dist/runners/bootstrapLine.js +1 -1
  354. package/dist/runners/hubPackage.d.ts +1 -1
  355. package/dist/runners/hubPackage.js +3 -3
  356. package/dist/runners/hubPackage.js.map +1 -1
  357. package/dist/runners/hubPaths.d.ts +1 -1
  358. package/dist/runners/hubPaths.d.ts.map +1 -1
  359. package/dist/runners/runnerLock.d.ts +2 -2
  360. package/dist/runners/runnerLock.d.ts.map +1 -1
  361. package/dist/runners/runnerLock.js +2 -2
  362. package/dist/runners/runnerLock.js.map +1 -1
  363. package/dist/scheduler/checkRun.d.ts +2 -0
  364. package/dist/scheduler/checkRun.d.ts.map +1 -1
  365. package/dist/scheduler/checkRun.js +5 -1
  366. package/dist/scheduler/checkRun.js.map +1 -1
  367. package/dist/scheduler/delivery.d.ts +57 -0
  368. package/dist/scheduler/delivery.d.ts.map +1 -1
  369. package/dist/scheduler/delivery.js +152 -14
  370. package/dist/scheduler/delivery.js.map +1 -1
  371. package/dist/scheduler/injection.d.ts +6 -0
  372. package/dist/scheduler/injection.d.ts.map +1 -1
  373. package/dist/scheduler/injection.js +10 -0
  374. package/dist/scheduler/injection.js.map +1 -1
  375. package/dist/scheduler/mcpSurface.d.ts +38 -3
  376. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  377. package/dist/scheduler/mcpSurface.js +291 -175
  378. package/dist/scheduler/mcpSurface.js.map +1 -1
  379. package/dist/scheduler/rebindResume.d.ts +24 -0
  380. package/dist/scheduler/rebindResume.d.ts.map +1 -1
  381. package/dist/scheduler/rebindResume.js +32 -0
  382. package/dist/scheduler/rebindResume.js.map +1 -1
  383. package/dist/scheduler/scheduleToolWording.d.ts +29 -0
  384. package/dist/scheduler/scheduleToolWording.d.ts.map +1 -0
  385. package/dist/scheduler/scheduleToolWording.js +117 -0
  386. package/dist/scheduler/scheduleToolWording.js.map +1 -0
  387. package/dist/scheduler/scheduledRunTarget.d.ts +90 -0
  388. package/dist/scheduler/scheduledRunTarget.d.ts.map +1 -0
  389. package/dist/scheduler/scheduledRunTarget.js +92 -0
  390. package/dist/scheduler/scheduledRunTarget.js.map +1 -0
  391. package/dist/scheduler/store.d.ts +2 -0
  392. package/dist/scheduler/store.d.ts.map +1 -1
  393. package/dist/scheduler/store.js +2 -0
  394. package/dist/scheduler/store.js.map +1 -1
  395. package/dist/scheduler/types.d.ts +10 -0
  396. package/dist/scheduler/types.d.ts.map +1 -1
  397. package/dist/scheduler/workerWatch.d.ts +2 -0
  398. package/dist/scheduler/workerWatch.d.ts.map +1 -1
  399. package/dist/scheduler/workerWatch.js +3 -3
  400. package/dist/scheduler/workerWatch.js.map +1 -1
  401. package/dist/selfUpdate/constants.d.ts +2 -0
  402. package/dist/selfUpdate/constants.d.ts.map +1 -1
  403. package/dist/selfUpdate/constants.js +3 -1
  404. package/dist/selfUpdate/constants.js.map +1 -1
  405. package/dist/selfUpdate/emittedSource.d.ts.map +1 -1
  406. package/dist/selfUpdate/emittedSource.js +1 -1
  407. package/dist/selfUpdate/emittedSource.js.map +1 -1
  408. package/dist/selfUpdate/updateRuntime.js +1 -1
  409. package/dist/selfUpdate/updateRuntime.js.map +1 -1
  410. package/dist/sessionPick.d.ts +1 -1
  411. package/dist/sessionPick.js +1 -1
  412. package/dist/startupPromptBuffer.d.ts +35 -6
  413. package/dist/startupPromptBuffer.d.ts.map +1 -1
  414. package/dist/startupPromptBuffer.js +70 -21
  415. package/dist/startupPromptBuffer.js.map +1 -1
  416. package/dist/state.d.ts +270 -30
  417. package/dist/state.d.ts.map +1 -1
  418. package/dist/state.js +403 -37
  419. package/dist/state.js.map +1 -1
  420. package/dist/testTimings.d.ts +17 -4
  421. package/dist/testTimings.d.ts.map +1 -1
  422. package/dist/testTimings.js +35 -3
  423. package/dist/testTimings.js.map +1 -1
  424. package/dist/threadContextPreamble.d.ts +7 -0
  425. package/dist/threadContextPreamble.d.ts.map +1 -1
  426. package/dist/threadContextPreamble.js +11 -0
  427. package/dist/threadContextPreamble.js.map +1 -1
  428. package/dist/threadRouting.d.ts +12 -0
  429. package/dist/threadRouting.d.ts.map +1 -1
  430. package/dist/threadRouting.js +15 -0
  431. package/dist/threadRouting.js.map +1 -1
  432. package/dist/todos/midTurn.d.ts +15 -41
  433. package/dist/todos/midTurn.d.ts.map +1 -1
  434. package/dist/todos/midTurn.js +27 -171
  435. package/dist/todos/midTurn.js.map +1 -1
  436. package/dist/todos/registry.d.ts +2 -0
  437. package/dist/todos/registry.d.ts.map +1 -1
  438. package/dist/todos/registry.js +3 -1
  439. package/dist/todos/registry.js.map +1 -1
  440. package/dist/types.d.ts +235 -23
  441. package/dist/types.d.ts.map +1 -1
  442. package/dist/types.js +10 -0
  443. package/dist/types.js.map +1 -1
  444. package/dist/utils/backendSwitchPlan.d.ts +3 -3
  445. package/dist/utils/backendSwitchPlan.js +3 -3
  446. package/dist/utils/claudeAccountAlert.d.ts +104 -0
  447. package/dist/utils/claudeAccountAlert.d.ts.map +1 -0
  448. package/dist/utils/claudeAccountAlert.js +130 -0
  449. package/dist/utils/claudeAccountAlert.js.map +1 -0
  450. package/dist/utils/claudeAccountPickerPlan.d.ts +7 -0
  451. package/dist/utils/claudeAccountPickerPlan.d.ts.map +1 -1
  452. package/dist/utils/claudeAccountPickerPlan.js +13 -2
  453. package/dist/utils/claudeAccountPickerPlan.js.map +1 -1
  454. package/dist/utils/claudeAuthRefusal.d.ts +122 -0
  455. package/dist/utils/claudeAuthRefusal.d.ts.map +1 -0
  456. package/dist/utils/claudeAuthRefusal.js +228 -0
  457. package/dist/utils/claudeAuthRefusal.js.map +1 -0
  458. package/dist/utils/claudeCompactHook.d.ts +9 -7
  459. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  460. package/dist/utils/claudeCompactHook.js +11 -9
  461. package/dist/utils/claudeCompactHook.js.map +1 -1
  462. package/dist/utils/claudeLimitSwitch.d.ts +1 -1
  463. package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
  464. package/dist/utils/claudeLimitSwitch.js +1 -1
  465. package/dist/utils/claudeLimitSwitch.js.map +1 -1
  466. package/dist/utils/claudeProfileSync.d.ts +88 -0
  467. package/dist/utils/claudeProfileSync.d.ts.map +1 -0
  468. package/dist/utils/claudeProfileSync.js +198 -0
  469. package/dist/utils/claudeProfileSync.js.map +1 -0
  470. package/dist/utils/claudeProfileUsageViews.d.ts +54 -2
  471. package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -1
  472. package/dist/utils/claudeProfileUsageViews.js +44 -1
  473. package/dist/utils/claudeProfileUsageViews.js.map +1 -1
  474. package/dist/utils/claudeProfiles.d.ts +101 -6
  475. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  476. package/dist/utils/claudeProfiles.js +297 -23
  477. package/dist/utils/claudeProfiles.js.map +1 -1
  478. package/dist/utils/claudeRuntimeInfo.d.ts +24 -0
  479. package/dist/utils/claudeRuntimeInfo.d.ts.map +1 -1
  480. package/dist/utils/claudeRuntimeInfo.js +128 -3
  481. package/dist/utils/claudeRuntimeInfo.js.map +1 -1
  482. package/dist/utils/claudeScheduledJobs.d.ts +6 -2
  483. package/dist/utils/claudeScheduledJobs.d.ts.map +1 -1
  484. package/dist/utils/claudeScheduledJobs.js +10 -2
  485. package/dist/utils/claudeScheduledJobs.js.map +1 -1
  486. package/dist/utils/claudeSessionTitle.js +1 -1
  487. package/dist/utils/claudeSessionTitle.js.map +1 -1
  488. package/dist/utils/claudeStreamJson.d.ts +28 -2
  489. package/dist/utils/claudeStreamJson.d.ts.map +1 -1
  490. package/dist/utils/claudeStreamJson.js +33 -3
  491. package/dist/utils/claudeStreamJson.js.map +1 -1
  492. package/dist/utils/claudeTranscriptEpoch.d.ts +14 -0
  493. package/dist/utils/claudeTranscriptEpoch.d.ts.map +1 -1
  494. package/dist/utils/claudeTranscriptEpoch.js +79 -19
  495. package/dist/utils/claudeTranscriptEpoch.js.map +1 -1
  496. package/dist/utils/claudeUsage.d.ts +103 -7
  497. package/dist/utils/claudeUsage.d.ts.map +1 -1
  498. package/dist/utils/claudeUsage.js +108 -15
  499. package/dist/utils/claudeUsage.js.map +1 -1
  500. package/dist/utils/claudeUsageRefresher.d.ts +8 -1
  501. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  502. package/dist/utils/claudeUsageRefresher.js +11 -1
  503. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  504. package/dist/utils/compactOnIdle.d.ts +139 -29
  505. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  506. package/dist/utils/compactOnIdle.js +163 -36
  507. package/dist/utils/compactOnIdle.js.map +1 -1
  508. package/dist/utils/conversationEnding.d.ts +76 -0
  509. package/dist/utils/conversationEnding.d.ts.map +1 -0
  510. package/dist/utils/conversationEnding.js +117 -0
  511. package/dist/utils/conversationEnding.js.map +1 -0
  512. package/dist/utils/cutButtonLabel.d.ts +7 -0
  513. package/dist/utils/cutButtonLabel.d.ts.map +1 -0
  514. package/dist/utils/cutButtonLabel.js +17 -0
  515. package/dist/utils/cutButtonLabel.js.map +1 -0
  516. package/dist/utils/doctorLine.d.ts +10 -0
  517. package/dist/utils/doctorLine.d.ts.map +1 -1
  518. package/dist/utils/doctorLine.js +16 -0
  519. package/dist/utils/doctorLine.js.map +1 -1
  520. package/dist/utils/fallbackBridge.d.ts.map +1 -1
  521. package/dist/utils/fallbackBridge.js +2 -1
  522. package/dist/utils/fallbackBridge.js.map +1 -1
  523. package/dist/utils/fallbackChain.d.ts +2 -0
  524. package/dist/utils/fallbackChain.d.ts.map +1 -1
  525. package/dist/utils/fallbackChain.js +4 -3
  526. package/dist/utils/fallbackChain.js.map +1 -1
  527. package/dist/utils/fallbackSwitchNotice.d.ts +11 -4
  528. package/dist/utils/fallbackSwitchNotice.d.ts.map +1 -1
  529. package/dist/utils/fallbackSwitchNotice.js +9 -5
  530. package/dist/utils/fallbackSwitchNotice.js.map +1 -1
  531. package/dist/utils/fileSendService.d.ts +31 -0
  532. package/dist/utils/fileSendService.d.ts.map +1 -1
  533. package/dist/utils/fileSendService.js +45 -2
  534. package/dist/utils/fileSendService.js.map +1 -1
  535. package/dist/utils/jsonStreamHost.d.ts +2 -0
  536. package/dist/utils/jsonStreamHost.d.ts.map +1 -1
  537. package/dist/utils/jsonStreamHost.js +4 -1
  538. package/dist/utils/jsonStreamHost.js.map +1 -1
  539. package/dist/utils/jsonStreamPendingWork.d.ts +14 -2
  540. package/dist/utils/jsonStreamPendingWork.d.ts.map +1 -1
  541. package/dist/utils/jsonStreamPendingWork.js +25 -5
  542. package/dist/utils/jsonStreamPendingWork.js.map +1 -1
  543. package/dist/utils/jsonStreamUnconsumedInput.d.ts +80 -0
  544. package/dist/utils/jsonStreamUnconsumedInput.d.ts.map +1 -0
  545. package/dist/utils/jsonStreamUnconsumedInput.js +99 -0
  546. package/dist/utils/jsonStreamUnconsumedInput.js.map +1 -0
  547. package/dist/utils/limitEpisodeRecovery.d.ts +43 -4
  548. package/dist/utils/limitEpisodeRecovery.d.ts.map +1 -1
  549. package/dist/utils/limitEpisodeRecovery.js +107 -20
  550. package/dist/utils/limitEpisodeRecovery.js.map +1 -1
  551. package/dist/utils/limitHeldPrompts.d.ts +21 -11
  552. package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
  553. package/dist/utils/limitHeldPrompts.js +12 -9
  554. package/dist/utils/limitHeldPrompts.js.map +1 -1
  555. package/dist/utils/limitRemindersScreenPlan.d.ts +63 -0
  556. package/dist/utils/limitRemindersScreenPlan.d.ts.map +1 -0
  557. package/dist/utils/limitRemindersScreenPlan.js +121 -0
  558. package/dist/utils/limitRemindersScreenPlan.js.map +1 -0
  559. package/dist/utils/limitSwitchPlan.d.ts +44 -0
  560. package/dist/utils/limitSwitchPlan.d.ts.map +1 -0
  561. package/dist/utils/limitSwitchPlan.js +54 -0
  562. package/dist/utils/limitSwitchPlan.js.map +1 -0
  563. package/dist/utils/limitsBoardPlan.d.ts +16 -7
  564. package/dist/utils/limitsBoardPlan.d.ts.map +1 -1
  565. package/dist/utils/limitsBoardPlan.js +41 -9
  566. package/dist/utils/limitsBoardPlan.js.map +1 -1
  567. package/dist/utils/lostWork.d.ts +16 -2
  568. package/dist/utils/lostWork.d.ts.map +1 -1
  569. package/dist/utils/lostWork.js +16 -3
  570. package/dist/utils/lostWork.js.map +1 -1
  571. package/dist/utils/messageContext.d.ts +2 -2
  572. package/dist/utils/messageContext.js +2 -2
  573. package/dist/utils/midTurnInbox.d.ts +79 -0
  574. package/dist/utils/midTurnInbox.d.ts.map +1 -0
  575. package/dist/utils/midTurnInbox.js +265 -0
  576. package/dist/utils/midTurnInbox.js.map +1 -0
  577. package/dist/utils/promptDelivery.d.ts +70 -22
  578. package/dist/utils/promptDelivery.d.ts.map +1 -1
  579. package/dist/utils/promptDelivery.js +100 -42
  580. package/dist/utils/promptDelivery.js.map +1 -1
  581. package/dist/utils/questionWaitChoices.d.ts +20 -0
  582. package/dist/utils/questionWaitChoices.d.ts.map +1 -0
  583. package/dist/utils/questionWaitChoices.js +31 -0
  584. package/dist/utils/questionWaitChoices.js.map +1 -0
  585. package/dist/utils/questionWaitPlan.d.ts +166 -0
  586. package/dist/utils/questionWaitPlan.d.ts.map +1 -0
  587. package/dist/utils/questionWaitPlan.js +237 -0
  588. package/dist/utils/questionWaitPlan.js.map +1 -0
  589. package/dist/utils/replyQuote.d.ts +10 -0
  590. package/dist/utils/replyQuote.d.ts.map +1 -1
  591. package/dist/utils/replyQuote.js +18 -7
  592. package/dist/utils/replyQuote.js.map +1 -1
  593. package/dist/utils/talkerAccess.d.ts +2 -2
  594. package/dist/utils/talkerAccess.d.ts.map +1 -1
  595. package/dist/utils/talkerAccess.js +5 -4
  596. package/dist/utils/talkerAccess.js.map +1 -1
  597. package/dist/utils/telegramError.d.ts +6 -0
  598. package/dist/utils/telegramError.d.ts.map +1 -1
  599. package/dist/utils/telegramError.js +12 -0
  600. package/dist/utils/telegramError.js.map +1 -1
  601. package/dist/utils/topicAccessScreenPlan.d.ts +1 -1
  602. package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -1
  603. package/dist/utils/topicAccessScreenPlan.js +3 -7
  604. package/dist/utils/topicAccessScreenPlan.js.map +1 -1
  605. package/dist/utils/topicIndicatorPlan.d.ts +153 -0
  606. package/dist/utils/topicIndicatorPlan.d.ts.map +1 -0
  607. package/dist/utils/topicIndicatorPlan.js +224 -0
  608. package/dist/utils/topicIndicatorPlan.js.map +1 -0
  609. package/dist/utils/topicIndicatorSources.d.ts +40 -0
  610. package/dist/utils/topicIndicatorSources.d.ts.map +1 -0
  611. package/dist/utils/topicIndicatorSources.js +31 -0
  612. package/dist/utils/topicIndicatorSources.js.map +1 -0
  613. package/dist/utils/topicRequest.d.ts +3 -0
  614. package/dist/utils/topicRequest.d.ts.map +1 -1
  615. package/dist/utils/topicRequest.js +4 -0
  616. package/dist/utils/topicRequest.js.map +1 -1
  617. package/dist/utils/topicStatusPlan.d.ts +90 -0
  618. package/dist/utils/topicStatusPlan.d.ts.map +1 -0
  619. package/dist/utils/topicStatusPlan.js +160 -0
  620. package/dist/utils/topicStatusPlan.js.map +1 -0
  621. package/dist/utils/workerRoles.d.ts +122 -0
  622. package/dist/utils/workerRoles.d.ts.map +1 -0
  623. package/dist/utils/workerRoles.js +160 -0
  624. package/dist/utils/workerRoles.js.map +1 -0
  625. package/dist/utils/workerRolesScreenPlan.d.ts +118 -0
  626. package/dist/utils/workerRolesScreenPlan.d.ts.map +1 -0
  627. package/dist/utils/workerRolesScreenPlan.js +232 -0
  628. package/dist/utils/workerRolesScreenPlan.js.map +1 -0
  629. package/dist/utils/workingSignals.d.ts +49 -0
  630. package/dist/utils/workingSignals.d.ts.map +1 -0
  631. package/dist/utils/workingSignals.js +41 -0
  632. package/dist/utils/workingSignals.js.map +1 -0
  633. package/licensing.json +88 -0
  634. package/npm-shrinkwrap.json +2 -2
  635. package/package.json +7 -7
  636. package/{remoteRun → runner-scripts}/runner.sh +6 -3
  637. package/COMMERCIAL-LICENSE.md +0 -142
  638. package/dist/agentTrigger.d.ts +0 -28
  639. package/dist/agentTrigger.d.ts.map +0 -1
  640. package/dist/agentTrigger.js +0 -53
  641. package/dist/agentTrigger.js.map +0 -1
  642. /package/{remoteRun → runner-scripts}/ensureNode.sh +0 -0
  643. /package/{remoteRun → runner-scripts}/runner-package-lock.json +0 -0
@@ -17,6 +17,7 @@ exports.resolveTargetThreadKey = resolveTargetThreadKey;
17
17
  exports.buildSpecFromCreateArgs = buildSpecFromCreateArgs;
18
18
  exports.checkIsConversationInScope = checkIsConversationInScope;
19
19
  exports.createSchedulerMcpCancellationLifecycle = createSchedulerMcpCancellationLifecycle;
20
+ exports.checkIsSchedulingPlatform = checkIsSchedulingPlatform;
20
21
  exports.createSchedulerMcpServer = createSchedulerMcpServer;
21
22
  const node_crypto_1 = require("node:crypto");
22
23
  const node_http_1 = require("node:http");
@@ -25,10 +26,12 @@ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamable
25
26
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
26
27
  const zod_1 = require("zod");
27
28
  const adapterNames_1 = require("../adapters/adapterNames");
29
+ const noteText_1 = require("../limitNotes/noteText");
28
30
  const sessionKey_1 = require("../sessionKey");
29
31
  const botSkills_1 = require("../utils/botSkills");
30
32
  const claudeProfiles_1 = require("../utils/claudeProfiles");
31
33
  const claudeUsage_1 = require("../utils/claudeUsage");
34
+ const workerRoles_1 = require("../utils/workerRoles");
32
35
  const fileSendPlan_1 = require("../utils/fileSendPlan");
33
36
  const isoTimestamp_1 = require("../utils/isoTimestamp");
34
37
  const localClock_1 = require("../utils/localClock");
@@ -37,7 +40,7 @@ const utils_1 = require("../utils");
37
40
  const checkRun_1 = require("./checkRun");
38
41
  const checkStatus_1 = require("./checkStatus");
39
42
  const deliveryKind_1 = require("./deliveryKind");
40
- const workerWatch_1 = require("./workerWatch");
43
+ const scheduleToolWording_1 = require("./scheduleToolWording");
41
44
  const recurrence_1 = require("./recurrence");
42
45
  const strictToolInput_1 = require("./strictToolInput");
43
46
  const store_1 = require("./store");
@@ -166,23 +169,38 @@ const orchestrationInstructionHead = '• You orchestrate detached workers (a `c
166
169
  /** What the worker-watch recipe says once a tool is named: shared by both wordings of the Telegram bullet. */
167
170
  const workerWatchRecipeText = 'its description has the recipe (checkCommand, cron, status arguments); never `kill -0` alone: it never fires on a hung worker.';
168
171
  /**
169
- * The orchestration bullet of a conversation on a tracker, which has no scheduling tools: only the manager-skill hint, so
170
- * with the bot's skills off (`/bot_skills`) there is nothing left of it and `null` drops it.
172
+ * The orchestration bullet of a conversation on a tracker that has no scheduling tools (the `test` platform, a key no codec
173
+ * reads): only the manager-skill hint, so with the bot's skills off (`/bot_skills`) there is nothing left of it and `null` drops it.
171
174
  */
172
175
  function buildTrackerOrchestrationInstruction(isBotSkillsEnabled) {
173
176
  return isBotSkillsEnabled ? `${orchestrationInstructionHead} ${managerSkillInstruction}.` : null;
174
177
  }
178
+ /** What a Jira agent does after it armed a worker's watch: the bot stops its idle process and the watch wakes it in the same issue. */
179
+ const jiraEndTurnSentence = 'After the launch answer_request "progress", then END your turn: the watch wakes you in this issue when the worker is done (nothing of it is shown there).';
180
+ /**
181
+ * The orchestration bullet of a Jira issue: Telegram's (the manager-skill hint dropped with the skills off, the worker-watch
182
+ * recipe — a tool fact — staying) and what differs on an issue: the agent answers `progress`, then ENDS its turn, because the
183
+ * watch wakes it in the same issue and nothing of the watch is shown there.
184
+ */
185
+ function buildJiraOrchestrationInstruction(isBotSkillsEnabled) {
186
+ return isBotSkillsEnabled
187
+ ? `${orchestrationInstructionHead} ${managerSkillInstruction}. Watch EACH worker with schedule_create — ${workerWatchRecipeText} ${jiraEndTurnSentence}`
188
+ : `${orchestrationInstructionHead} schedule_create to watch EACH worker — ${workerWatchRecipeText} ${jiraEndTurnSentence}`;
189
+ }
175
190
  /** The orchestration bullet of a Telegram topic: the manager-skill hint (dropped with the skills off) and the worker-watch recipe, which is a tool fact and stays. */
176
191
  function buildTelegramOrchestrationInstruction(isBotSkillsEnabled) {
177
192
  return isBotSkillsEnabled
178
193
  ? `${orchestrationInstructionHead} ${managerSkillInstruction}. Watch EACH worker with schedule_create — ${workerWatchRecipeText}`
179
194
  : `${orchestrationInstructionHead} schedule_create to watch EACH worker — ${workerWatchRecipeText}`;
180
195
  }
181
- const claudeProfilesInstruction = '• Before you start or resume a child `claude` process (worker, reviewer, planner) → claude_profiles with the model you will launch, and start the child under the account it names (`CLAUDE_CONFIG_DIR=<configDir>`): without it the child inherits YOUR account and drains the same limits. The tool description has the rest (resuming, `recommended: null`).';
196
+ const claudeProfilesInstruction = '• Before you start or resume a child worker → claude_profiles with its model, or its role when nothing you follow names one; start a `claude` under the account it names (`CLAUDE_CONFIG_DIR=<configDir>`), else it drains YOUR account. An `[Accounts …]` note means the limits moved: ask again before your next launch. More in the tool description.';
197
+ /** The longest `lastRunEndedAt` the tool takes: an ISO 8601 instant with fractional seconds and an offset is 35 characters. */
198
+ const claudeResumeInstantMaxLength = 40;
182
199
  /** @description Which optional tools `deps` offers. */
183
200
  function getOptionalBotTools(deps) {
184
201
  return {
185
202
  isJiraAttachmentToolOffered: deps.fetchJiraAttachment !== undefined,
203
+ isJiraFileSendOffered: deps.sendJiraFiles !== undefined,
186
204
  isTodoToolOffered: deps.todos !== undefined,
187
205
  remoteRunRunnerLines: deps.getRemoteRunRunnerLines?.() ?? [],
188
206
  };
@@ -192,21 +210,25 @@ function buildTelegramInstructions(isTodoToolOffered, remoteRunInstructionText,
192
210
 
193
211
  When to use it:
194
212
  • The user asks to run/finish a plan or task LATER ("in 2h", "tomorrow 9am", "every weekday") → schedule_create. Put the work in \`prompt\`; the future run is a fresh session with no memory of this chat. Not CronCreate / ScheduleWakeup for anything that must happen: they die with your process, which the bot stops after a long idle stretch.
195
- • You produced a file/chart/screenshot/video to deliver → send_file_to_user (images over ${fileSendPlan_1.telegramPhotoMaxSidePx} px go as a file). Videos MUST be H.264 .mp4, never as_file/document/.webm/.mov (they render as GIFs or don't play); transcode if needed (see tool description).
196
- • You want to deliver SEVERAL discrete messages (each its own message, e.g. a per-item news digest) → send_messages_to_user; an item may attach ONE file (the text becomes its caption).
213
+ • You produced a file/chart/screenshot/video to deliver → send_file_to_user (images over ${fileSendPlan_1.telegramPhotoMaxSidePx} px go as a file). Videos MUST be H.264 .mp4, never as_file/document/.webm/.mov (they render as GIFs or don't play); transcode if needed.
214
+ • You want to deliver SEVERAL discrete messages (e.g. a per-item news digest) → send_messages_to_user; an item may attach ONE file (the text becomes its caption).
197
215
  ${compactConversationInstruction}
198
216
  ${isTodoToolOffered ? `${todoInstruction}\n` : ''}• You need to review or remove scheduled jobs → schedule_list / schedule_cancel.
199
217
  • You need a watchdog — keep an eye on a service, build, deploy, disk, URL… → schedule_create with \`checkCommand\` (cron): the bot runs it in this folder, stays silent while it exits 0, and on the first failure posts a notice and wakes you with \`prompt\` + the exit code and output tail. Checks survive restarts and crashes. NEVER build your own watcher (background loop, nohup, sleep loop, tmux pane, shell crontab): it dies with your session or a restart, silently.
200
218
  ${buildTelegramOrchestrationInstruction(isBotSkillsEnabled)}
201
- ${answerRequestInstruction} The requester may not see your plain text: anything they must read goes through answer_request — yet your plain text is relayed into the topic too, so end the turn WITHOUT a recap of what you answered (it would show twice).
219
+ ${answerRequestInstruction} An "only when you have a result" header may go unanswered. The requester may not see your plain text: anything they must read goes through answer_request — yet your plain text reaches the topic too, so end the turn WITHOUT a recap of your answer (it would show twice).
202
220
  ${claudeProfilesInstruction}${remoteRunInstructionText === null ? '' : `\n${remoteRunInstructionText}`}
203
221
 
204
222
  Tool descriptions hold the argument recipes.`;
205
223
  }
206
224
  /** What a Jira session's instructions add: the tool that reaches the issue's original files (C10). */
207
225
  const jiraAttachmentInstruction = '• The issue lists a file (an attachment id in the attachments list, or in a placeholder such as "[image: shot.png — attachment 10234]") you need to look at → jira_get_attachment with that id; it saves the original file and returns its path.';
226
+ /** What a Jira session's instructions add when it can show files on its issue. */
227
+ const jiraFileSendInstruction = '• You made a screenshot, a video or a file the requester should see → put its path in answer_request\'s `files`: it is attached to the issue and shown in your answer\'s comment (an image shown, an H.264 .mp4 playing, any other file linked); send_file_to_user posts files in a comment of their own.';
228
+ /** What a Jira session's instructions add for scheduling: nothing a fire, a check or a status does is shown on the issue. */
229
+ const jiraScheduleInstruction = '• Something must happen LATER, or you need a watchdog (a service, build, deploy, URL…) → schedule_create (`onceAt` / `cron` + `prompt`; `checkCommand` runs in this folder, silent while it exits 0, wakes you on the first failure): it resumes you in this issue. The bot posts nothing on the issue for it; answer the open request only with a result the requester needs. schedule_list / schedule_cancel. NEVER build your own watcher (loop, nohup, sleep, tmux, crontab): it dies with your session or a restart. Not CronCreate / ScheduleWakeup.';
208
230
  /** For a conversation on a tracker: the requester sees nothing but the answers; `extraInstructions` name the platform's own tools. */
209
- function buildTrackerInstructions(extraInstructions, isBotSkillsEnabled) {
231
+ function buildTrackerInstructions(extraInstructions, orchestrationInstruction) {
210
232
  return `This MCP connects the agent to the conversation that asked for its work.
211
233
 
212
234
  When to use it:
@@ -215,7 +237,7 @@ ${[
215
237
  ...extraInstructions,
216
238
  compactConversationInstruction,
217
239
  claudeProfilesInstruction,
218
- buildTrackerOrchestrationInstruction(isBotSkillsEnabled),
240
+ orchestrationInstruction,
219
241
  ].filter((instruction) => instruction !== null).join('\n')}
220
242
 
221
243
  Each tool's own description has the exact argument recipe.`;
@@ -228,9 +250,9 @@ Each tool's own description has the exact argument recipe.`;
228
250
  * already carries those in full. Kept terse on purpose.
229
251
  *
230
252
  * @description The connect-time instructions for a session of `platform`: only
231
- * a Telegram session has the scheduling and send-to-topic tools, so only its
232
- * instructions name them (Jira connector plan J2, D18); an optional tool is named
233
- * only where it is offered. With the bot's skills off for the session
253
+ * a Telegram or a Jira session has the scheduling tools and only a Telegram one the send-to-topic tools, so only their
254
+ * instructions name them (Jira connector plan J2, D18 — superseded for `schedule_*` by the Jira scheduling plan); an
255
+ * optional tool is named only where it is offered. With the bot's skills off for the session
234
256
  * (`isBotSkillsEnabled`, `/bot_skills`) the orchestration bullet no longer tells it to load `charness-orchestration`.
235
257
  */
236
258
  function buildMcpServerInstructions(platform, offered, isBotSkillsEnabled) {
@@ -239,12 +261,14 @@ function buildMcpServerInstructions(platform, offered, isBotSkillsEnabled) {
239
261
  return buildTelegramInstructions(offered.isTodoToolOffered, remoteRunInstructionText, isBotSkillsEnabled);
240
262
  const remoteRunInstructions = remoteRunInstructionText === null ? [] : [remoteRunInstructionText];
241
263
  if (platform !== 'jira')
242
- return buildTrackerInstructions(remoteRunInstructions, isBotSkillsEnabled);
264
+ return buildTrackerInstructions(remoteRunInstructions, buildTrackerOrchestrationInstruction(isBotSkillsEnabled));
243
265
  return buildTrackerInstructions([
244
266
  ...(offered.isJiraAttachmentToolOffered ? [jiraAttachmentInstruction] : []),
267
+ ...(offered.isJiraFileSendOffered ? [jiraFileSendInstruction] : []),
268
+ jiraScheduleInstruction,
245
269
  ...(offered.isTodoToolOffered ? [todoInstruction] : []),
246
270
  ...remoteRunInstructions,
247
- ], isBotSkillsEnabled);
271
+ ], buildJiraOrchestrationInstruction(isBotSkillsEnabled));
248
272
  };
249
273
  const runnerCount = offered.remoteRunRunnerLines.length;
250
274
  if (runnerCount === 0)
@@ -467,96 +491,80 @@ const threadKeyArgSchema = zod_1.z
467
491
  .string()
468
492
  .optional()
469
493
  .describe('Target thread "<chatId>:<threadId>". Required when a directory scope has more than one bound thread.');
470
- const scheduleCreateShape = {
471
- name: zod_1.z.string().min(1).max(maxNameLength).describe('Short human name for the job (shown in announcements/lists).'),
472
- cron: zod_1.z
473
- .string()
474
- .optional()
475
- .describe('5-field host-local cron expression for a RECURRING job (e.g. "0 9 * * 1-5"). ' +
476
- 'For a single future run use onceAt instead, NOT a cron (a cron has no year and would ' +
477
- 'fire on the same date every year). Omit onceAt when you pass cron.'),
478
- onceAt: zod_1.z
479
- .string()
480
- .optional()
481
- .describe('ISO 8601 instant for a ONE-SHOT run (e.g. "2026-06-07T09:00:00"). This is the right field for ' +
482
- '"run it once at <time>". Omit cron AND repeatCount when you pass onceAt — a one-shot always runs ' +
483
- 'exactly once.'),
484
- repeatCount: zod_1.z
485
- .number()
486
- .int()
487
- .positive()
488
- .optional()
489
- .describe('Number of CRON fires before the job auto-deletes (N-times recurring). ONLY for cron jobs. ' +
490
- 'Do NOT set it for a one-shot (onceAt) — a one-shot already runs exactly once, so repeatCount ' +
491
- 'is ignored there.'),
492
- prompt: zod_1.z
493
- .string()
494
- .min(1)
495
- .max(maxPromptLength)
496
- .describe('The prompt forwarded to the agent at fire time (for a check: only when the check fails, after ' +
497
- 'the failure details). Make it SELF-CONTAINED — the future run starts ' +
498
- 'with no memory of this conversation. Bake in everything it needs: the plan file path + scope, ' +
499
- 'whether to delegate to a sub-agent, and any constraints. Put the WORK in the prompt; do the ' +
500
- 'investigation later, when it fires.'),
501
- checkCommand: zod_1.z
502
- .string()
503
- .max(checkRun_1.maxCheckCommandLength)
504
- .optional()
505
- .describe('Makes the job a WATCHDOG CHECK: a shell command (run with /bin/sh -c in the bound folder) the bot ' +
506
- 'executes at every fire instead of waking you. Exit 0 = healthy, nothing is posted. The first ' +
507
- 'non-zero exit or timeout tells the topic in one line (never the command) and wakes you with `prompt` plus the exit ' +
508
- 'code and output tail; later failures stay silent until a run passes again (the topic is told). ' +
509
- 'Keep it a quick probe, e.g. `systemctl --user is-active myapp`, `curl -fsS -m 10 http://127.0.0.1:8080/health`, ' +
510
- '`test $(df --output=pcent / | tail -1 | tr -dc 0-9) -lt 90`; a detached worker: the recipe in the tool description. ' +
511
- 'Use ABSOLUTE paths only: it runs in the topic\'s folder, so a relative path or `~` points elsewhere.'),
512
- checkTimeoutSeconds: zod_1.z
513
- .number()
514
- .int()
515
- .positive()
516
- .max(checkRun_1.maxCheckTimeoutSec)
517
- .optional()
518
- .describe(`Seconds a check run may take before it is stopped and counted as a failure (default ${checkRun_1.defaultCheckTimeoutSec}). ` +
519
- 'Only with checkCommand.'),
520
- statusWorkerRunDir: zod_1.z
521
- .string()
522
- .max(checkStatus_1.maxCheckStatusRunDirLength)
523
- .optional()
524
- .describe('A check\'s STATUS SOURCE for a detached worker: its run directory (absolute, or relative to the bound folder). While the ' +
525
- 'check passes, the BOT itself posts a short silent status line into the topic every statusEveryMinutes — how long the ' +
526
- 'worker has run and what it did last (its last text or tool call, read from the newest events*.jsonl there) — and ' +
527
- 'deletes the previous one. No agent wake, no tokens. Only with checkCommand; not together with statusCommand. ' +
528
- 'A topic on the answers-only view, and a tracker issue, get no line.'),
529
- statusCommand: zod_1.z
530
- .string()
531
- .max(checkStatus_1.maxCheckStatusCommandLength)
532
- .optional()
533
- .describe('A check\'s STATUS SOURCE for anything else: a shell command (run in the bound folder, at most ' +
534
- `${checkStatus_1.checkStatusCommandTimeoutSec} s) whose first output line is the «now» of the same bot-posted status line ` +
535
- '(e.g. `tail -n 1 build.log`). Only with checkCommand; not together with statusWorkerRunDir.'),
536
- statusEveryMinutes: zod_1.z
537
- .number()
538
- .int()
539
- .min(checkStatus_1.minCheckStatusEveryMinutes)
540
- .max(checkStatus_1.maxCheckStatusEveryMinutes)
541
- .optional()
542
- .describe(`Minutes between two status lines (${checkStatus_1.minCheckStatusEveryMinutes}-${checkStatus_1.maxCheckStatusEveryMinutes}, default ${checkStatus_1.defaultCheckStatusEveryMinutes}). ` +
543
- 'Only with a status source.'),
494
+ /**
495
+ * The arguments of `schedule_create` both platforms take, with `wording`'s own descriptions where the platforms differ. The
496
+ * key order is the order an agent reads the tool's schema in: Telegram's is the original and must not move.
497
+ */
498
+ function buildScheduleCreateCommonShape(wording) {
499
+ return {
500
+ name: zod_1.z.string().min(1).max(maxNameLength).describe(wording.nameDescription),
501
+ cron: zod_1.z
502
+ .string()
503
+ .optional()
504
+ .describe('5-field host-local cron expression for a RECURRING job (e.g. "0 9 * * 1-5"). ' +
505
+ 'For a single future run use onceAt instead, NOT a cron (a cron has no year and would ' +
506
+ 'fire on the same date every year). Omit onceAt when you pass cron.'),
507
+ onceAt: zod_1.z
508
+ .string()
509
+ .optional()
510
+ .describe('ISO 8601 instant for a ONE-SHOT run (e.g. "2026-06-07T09:00:00"). This is the right field for ' +
511
+ '"run it once at <time>". Omit cron AND repeatCount when you pass onceAt — a one-shot always runs ' +
512
+ 'exactly once.'),
513
+ repeatCount: zod_1.z
514
+ .number()
515
+ .int()
516
+ .positive()
517
+ .optional()
518
+ .describe('Number of CRON fires before the job auto-deletes (N-times recurring). ONLY for cron jobs. ' +
519
+ 'Do NOT set it for a one-shot (onceAt) — a one-shot already runs exactly once, so repeatCount ' +
520
+ 'is ignored there.'),
521
+ prompt: zod_1.z
522
+ .string()
523
+ .min(1)
524
+ .max(maxPromptLength)
525
+ .describe('The prompt forwarded to the agent at fire time (for a check: only when the check fails, after ' +
526
+ 'the failure details). Make it SELF-CONTAINED — the future run starts ' +
527
+ 'with no memory of this conversation. Bake in everything it needs: the plan file path + scope, ' +
528
+ 'whether to delegate to a sub-agent, and any constraints. Put the WORK in the prompt; do the ' +
529
+ 'investigation later, when it fires.'),
530
+ checkCommand: zod_1.z.string().max(checkRun_1.maxCheckCommandLength).optional().describe(wording.checkCommandDescription),
531
+ checkTimeoutSeconds: zod_1.z
532
+ .number()
533
+ .int()
534
+ .positive()
535
+ .max(checkRun_1.maxCheckTimeoutSec)
536
+ .optional()
537
+ .describe(scheduleToolWording_1.checkTimeoutSecondsDescription),
538
+ statusWorkerRunDir: zod_1.z.string().max(checkStatus_1.maxCheckStatusRunDirLength).optional().describe(wording.statusWorkerRunDirDescription),
539
+ statusCommand: zod_1.z.string().max(checkStatus_1.maxCheckStatusCommandLength).optional().describe(wording.statusCommandDescription),
540
+ statusEveryMinutes: zod_1.z
541
+ .number()
542
+ .int()
543
+ .min(checkStatus_1.minCheckStatusEveryMinutes)
544
+ .max(checkStatus_1.maxCheckStatusEveryMinutes)
545
+ .optional()
546
+ .describe(wording.statusEveryMinutesDescription),
547
+ };
548
+ }
549
+ /** A Telegram topic's `schedule_create`: the common arguments, the deprecated pin switch and the target thread. */
550
+ const scheduleCreateTelegramInput = (0, strictToolInput_1.createStrictToolInput)({
551
+ ...buildScheduleCreateCommonShape((0, scheduleToolWording_1.getScheduleToolWording)('telegram')),
544
552
  isPinSilent: zod_1.z
545
553
  .boolean()
546
554
  .optional()
547
555
  .describe('DEPRECATED, has no effect: scheduled messages and check alerts are never pinned. Do not pass it.'),
548
556
  threadKey: threadKeyArgSchema,
549
- };
550
- const scheduleCreateInput = (0, strictToolInput_1.createStrictToolInput)(scheduleCreateShape);
551
- const scheduleListShape = {
552
- threadKey: threadKeyArgSchema,
553
- };
554
- const scheduleListInput = (0, strictToolInput_1.createStrictToolInput)(scheduleListShape);
555
- const scheduleCancelShape = {
556
- id: zod_1.z.string().min(1).describe('The schedule id to cancel (from schedule_list).'),
557
- threadKey: threadKeyArgSchema,
558
- };
559
- const scheduleCancelInput = (0, strictToolInput_1.createStrictToolInput)(scheduleCancelShape);
557
+ });
558
+ /**
559
+ * A tracker conversation's `schedule_create`: the common arguments only — no `threadKey` (a tracker session's token names
560
+ * its one conversation, as `send_file_to_user` there) and no `isPinSilent` (deprecated, and nothing is pinned on a tracker).
561
+ */
562
+ const scheduleCreateTrackerInput = (0, strictToolInput_1.createStrictToolInput)(buildScheduleCreateCommonShape((0, scheduleToolWording_1.getScheduleToolWording)('jira')));
563
+ const scheduleListTelegramInput = (0, strictToolInput_1.createStrictToolInput)({ threadKey: threadKeyArgSchema });
564
+ const scheduleListTrackerInput = (0, strictToolInput_1.createStrictToolInput)({});
565
+ const scheduleCancelIdSchema = zod_1.z.string().min(1).describe('The schedule id to cancel (from schedule_list).');
566
+ const scheduleCancelTelegramInput = (0, strictToolInput_1.createStrictToolInput)({ id: scheduleCancelIdSchema, threadKey: threadKeyArgSchema });
567
+ const scheduleCancelTrackerInput = (0, strictToolInput_1.createStrictToolInput)({ id: scheduleCancelIdSchema });
560
568
  /**
561
569
  * Coerces an ARRAY tool argument into an actual array before validation. Some
562
570
  * MCP bridges (observed: Claude-agent harnesses AND OpenCode) serialize an array
@@ -713,6 +721,14 @@ function textResult(text) {
713
721
  function errorResult(message) {
714
722
  return { content: [{ type: 'text', text: message }], isError: true };
715
723
  }
724
+ /**
725
+ * The result text of a send tool, with the accounts note as its last block when one is due for the conversation `threadKey`
726
+ * (`limitNotes/`): the bot cuts it from the tool-result block it shows in the topic. Without the port, the text as it is.
727
+ */
728
+ function addLimitNoteToResult(deps, threadKey, text) {
729
+ const note = deps.takeLimitNoteForSend?.(threadKey) ?? null;
730
+ return note === null ? text : (0, noteText_1.appendLimitNote)(text, note);
731
+ }
716
732
  /** Report an ambiguous delivery without inviting MCP clients to retry it. */
717
733
  function deliveryUnknownResult(message) {
718
734
  return {
@@ -758,42 +774,13 @@ function summarizeCreated(record) {
758
774
  * @description Register the three scoped tools onto a fresh {@link McpServer}.
759
775
  * Every handler resolves the target thread from `scope` first (scope isolation),
760
776
  * then operates only on that thread's jobs. Bound to `deps` + the request's
761
- * verified `scope`.
777
+ * verified `scope`. `platform` picks the wording and the input shape (`scheduleToolWording.ts`): a Telegram
778
+ * topic's original, or a tracker conversation's (no `threadKey`, no `isPinSilent`, nothing said of a topic).
762
779
  */
763
- function registerSchedulerTools(server, deps, scope) {
764
- server.registerTool('schedule_create', {
765
- title: 'Create a scheduled prompt',
766
- description: 'Schedule a prompt to be delivered to this topic later. At fire time the bot posts a short silent line ' +
767
- '(name and schedule, the prompt folded under it) and forwards the prompt to the agent. The line is never pinned.\n\n' +
768
- 'Pick exactly ONE mode:\n' +
769
- '• one-shot (run once at a time): pass onceAt (ISO 8601); omit cron and repeatCount.\n' +
770
- '• recurring: pass cron (5-field); omit onceAt.\n' +
771
- '• recurring N times: pass cron AND repeatCount; omit onceAt.\n' +
772
- 'For a single future run ALWAYS use onceAt — never a cron with repeatCount:1 ' +
773
- '(a cron has no year, so it would fire on that date every year). repeatCount counts CRON ' +
774
- 'fires only and is ignored for a one-shot.\n\n' +
775
- 'USE THIS whenever the user asks to schedule execution of a plan or task for later ' +
776
- "(e.g. \"schedule finishing plan X in 2h\", \"run this plan tomorrow morning\"). " +
777
- 'Schedule IMMEDIATELY: write the request straight into `prompt` and create the job FIRST — ' +
778
- 'do NOT read code, explore the repo, or deliberate before scheduling. Plan now, figure out the ' +
779
- 'details at fire time. The future run does the investigation, not this call.\n\n' +
780
- 'WATCHDOG: to monitor something (a service, process, build, deploy, disk, URL), pass checkCommand ' +
781
- 'with a cron — the bot runs it in this folder and wakes you only when it starts failing. This is ' +
782
- 'the ONLY reliable watcher: it survives bot restarts and crashes. Never build your own (a ' +
783
- 'background loop, nohup, a sleep loop, a tmux pane, a shell crontab) — it dies with your session ' +
784
- 'or a restart and then fails silently.\n\n' +
785
- `A DETACHED WORKER you launched (a \`claude -p\` / \`opencode run\` process): cron \`${workerWatch_1.workerWatchCheckCron}\`, ` +
786
- `\`${workerWatch_1.workerWatchStatusArguments}\`, checkCommand \`${workerWatch_1.workerWatchCheckCommand}\` with its PID and run dir (an absolute path) — it fails when ` +
787
- `the worker exits, OR nothing in its run dir changed for ${workerWatch_1.workerWatchSilenceMinutes} min, OR the watch was armed ${workerWatch_1.workerWatchUnreportedMinutes} min ago (\`touch <run-dir>/${workerWatch_1.workerWatchArmedFileName}\` ` +
788
- 'right before you arm it — a resumed worker\'s reused run dir too — and again when you looked and found the worker fine: the same check then passes and watches on, ' +
789
- 'so do not arm a second one; a run dir without the file fails at once with exit 4), so the first failure is also the "worker finished" ' +
790
- 'signal (the topic then reads «worker finished», «worker silent» or «running without a report», never the command). Never `kill -0` alone: it stays green ' +
791
- 'while a worker hangs. The status arguments make the BOT post a silent status line into the topic every ' +
792
- `${workerWatch_1.workerWatchStatusEveryMinutes} min while the worker lives (works N min, its last action), so the topic never looks frozen — ` +
793
- 'without waking you or spending tokens: never arm a schedule of your own for status lines. One check per worker run; ' +
794
- 'schedule_cancel it once its wake is handled (that also deletes its status line).',
795
- inputSchema: scheduleCreateInput,
796
- }, async (args) => {
780
+ function registerSchedulerTools(server, deps, scope, platform) {
781
+ const wording = (0, scheduleToolWording_1.getScheduleToolWording)(platform);
782
+ const isTracker = platform === 'jira';
783
+ const handleCreate = async (args) => {
797
784
  const resolved = resolveTargetThreadKey(scope, args.threadKey, deps.getThreadsForDirectory);
798
785
  if (!resolved.ok)
799
786
  return errorResult(resolved.error);
@@ -826,6 +813,8 @@ function registerSchedulerTools(server, deps, scope) {
826
813
  if (args.statusEveryMinutes !== undefined && !isStatusKept) {
827
814
  notes.push('statusEveryMinutes was ignored — it only applies with checkCommand and a status source (statusWorkerRunDir or statusCommand).');
828
815
  }
816
+ // The request this job is armed under: it decides which request a fire rides and whether the request waits for the job.
817
+ const requestId = deps.getArmingRequestId?.(resolved.threadKey);
829
818
  const created = await (0, store_1.createScheduleForThread)(deps.store, {
830
819
  threadKey,
831
820
  name: args.name,
@@ -838,6 +827,7 @@ function registerSchedulerTools(server, deps, scope) {
838
827
  ? { deliveryKind: 'check', checkCommand, checkTimeoutSec: args.checkTimeoutSeconds }
839
828
  : {}),
840
829
  ...(isStatusKept ? { statusWorkerRunDir, statusCommand, statusEveryMinutes: args.statusEveryMinutes } : {}),
830
+ ...(requestId === undefined ? {} : { requestId }),
841
831
  });
842
832
  if (!created.ok) {
843
833
  // The cap counts only the agent-prompt jobs `schedule_list` shows, so the
@@ -847,14 +837,18 @@ function registerSchedulerTools(server, deps, scope) {
847
837
  }
848
838
  const record = created.record;
849
839
  deps.armJob(record);
840
+ // A worker watch is what an agent that launches detached workers arms: the conversation orchestrates them (`limitNotes/`).
841
+ if (isStatusKept && statusWorkerRunDir !== undefined)
842
+ deps.noteLimitWorkerWatch?.(resolved.threadKey);
850
843
  const noteSuffix = notes.map((note) => `\n\nℹ️ ${note}`).join('');
851
844
  return textResult(`${summarizeCreated(record)}${noteSuffix}`);
852
- });
853
- server.registerTool('schedule_list', {
854
- title: 'List scheduled prompts',
855
- description: 'List the scheduled prompts for this topic (id, name, schedule, next run, paused flag).',
856
- inputSchema: scheduleListInput,
857
- }, async (args) => {
845
+ };
846
+ const createDefinition = { title: 'Create a scheduled prompt', description: wording.createDescription };
847
+ if (isTracker)
848
+ server.registerTool('schedule_create', { ...createDefinition, inputSchema: scheduleCreateTrackerInput }, handleCreate);
849
+ else
850
+ server.registerTool('schedule_create', { ...createDefinition, inputSchema: scheduleCreateTelegramInput }, handleCreate);
851
+ const handleList = async (args) => {
858
852
  const resolved = resolveTargetThreadKey(scope, args.threadKey, deps.getThreadsForDirectory);
859
853
  if (!resolved.ok)
860
854
  return errorResult(resolved.error);
@@ -874,18 +868,17 @@ function registerSchedulerTools(server, deps, scope) {
874
868
  .getThreadSchedules(threadKey)
875
869
  .filter((record) => !(0, deliveryKind_1.checkIsReminderSchedule)(record));
876
870
  if (records.length === 0) {
877
- return textResult('No schedules for this topic.');
871
+ return textResult(wording.listEmptyText);
878
872
  }
879
873
  const lines = records.map((record, index) => `${index + 1}. ${summarizeRecord(record)}`);
880
874
  return textResult(lines.join('\n'));
881
- });
882
- server.registerTool('schedule_cancel', {
883
- title: 'Cancel a scheduled prompt',
884
- description: 'Cancel (delete) a scheduled prompt by its id. Only schedules owned by this topic can be cancelled. Cancelling a ' +
885
- 'watchdog check also deletes its status line — cancel a worker watch once its wake is handled, so a finished worker ' +
886
- 'leaves no status line behind.',
887
- inputSchema: scheduleCancelInput,
888
- }, async (args) => {
875
+ };
876
+ const listDefinition = { title: 'List scheduled prompts', description: wording.listDescription };
877
+ if (isTracker)
878
+ server.registerTool('schedule_list', { ...listDefinition, inputSchema: scheduleListTrackerInput }, handleList);
879
+ else
880
+ server.registerTool('schedule_list', { ...listDefinition, inputSchema: scheduleListTelegramInput }, handleList);
881
+ const handleCancel = async (args) => {
889
882
  const resolved = resolveTargetThreadKey(scope, args.threadKey, deps.getThreadsForDirectory);
890
883
  if (!resolved.ok)
891
884
  return errorResult(resolved.error);
@@ -896,7 +889,7 @@ function registerSchedulerTools(server, deps, scope) {
896
889
  // genuinely does not exist, and a distinct refusal would only tell it there
897
890
  // is an id here worth retrying.
898
891
  if (!record || record.threadKey !== resolved.threadKey || (0, deliveryKind_1.checkIsReminderSchedule)(record)) {
899
- return errorResult(`no schedule with id "${args.id}" in this topic`);
892
+ return errorResult(wording.getCancelNotFoundText(args.id));
900
893
  }
901
894
  await deps.store.removeSchedule(args.id);
902
895
  deps.disarmJob(args.id);
@@ -918,7 +911,12 @@ function registerSchedulerTools(server, deps, scope) {
918
911
  }
919
912
  const cleanupNote = cleanedUp.length > 0 ? `; ${cleanedUp.join('; ')}` : '';
920
913
  return textResult(`Cancelled "${record.name}" (id: ${record.id})${cleanupNote}.`);
921
- });
914
+ };
915
+ const cancelDefinition = { title: 'Cancel a scheduled prompt', description: wording.cancelDescription };
916
+ if (isTracker)
917
+ server.registerTool('schedule_cancel', { ...cancelDefinition, inputSchema: scheduleCancelTrackerInput }, handleCancel);
918
+ else
919
+ server.registerTool('schedule_cancel', { ...cancelDefinition, inputSchema: scheduleCancelTelegramInput }, handleCancel);
922
920
  }
923
921
  /**
924
922
  * @description Register the agent→Telegram `send_file_to_user` tool onto a fresh
@@ -964,7 +962,7 @@ function registerFileSendTool(server, deps, scope, requestSignal) {
964
962
  signal,
965
963
  });
966
964
  if (result.ok)
967
- return textResult(result.summary);
965
+ return textResult(addLimitNoteToResult(deps, resolved.threadKey, result.summary));
968
966
  return 'kind' in result && result.kind === 'deliveryUnknown'
969
967
  ? deliveryUnknownResult(result.error)
970
968
  : errorResult(result.error);
@@ -1018,7 +1016,7 @@ function registerMessageSendTool(server, deps, scope, requestSignal) {
1018
1016
  signal,
1019
1017
  });
1020
1018
  if (result.ok)
1021
- return textResult(result.summary);
1019
+ return textResult(addLimitNoteToResult(deps, resolved.threadKey, result.summary));
1022
1020
  return 'kind' in result && result.kind === 'deliveryUnknown'
1023
1021
  ? deliveryUnknownResult(result.error)
1024
1022
  : errorResult(result.error);
@@ -1212,9 +1210,32 @@ const jiraAnswerRequestShape = {
1212
1210
  .max(exports.answerReplyToCommentIdsMaxCount)
1213
1211
  .optional()
1214
1212
  .describe('Ids of the issue\'s comments this answer replies to, e.g. ["10240"]. The bot mentions each comment\'s ' +
1215
- 'author at the top of your answer so they are notified. Only comments you were shown in this conversation count.'),
1213
+ 'author at the top of your answer so they are notified, and posts the answer in the thread of the first one ' +
1214
+ '(without it, an answer goes into the thread of the reply that opened its request, else it is a new comment). ' +
1215
+ 'Only comments you were shown in this conversation count.'),
1216
1216
  };
1217
1217
  const jiraAnswerRequestInput = (0, strictToolInput_1.createStrictToolInput)(jiraAnswerRequestShape);
1218
+ /** The most files a Jira answer or comment carries ({@link jiraFilesMaxCount} of the connector: Telegram's album cap). */
1219
+ const jiraFilesMaxCount = 10;
1220
+ const jiraFilesDescription = 'Files to show in this answer\'s comment, as 1..10 paths RELATIVE to the issue\'s folder (absolute paths only if they resolve ' +
1221
+ 'inside it): each is attached to the issue and shown after your text — a .png/.jpg/.jpeg/.gif/.webp image shown, an H.264 .mp4 ' +
1222
+ 'playing, any other file listed as a link to its attachment. An image must be whole and what its name says; an .mp4 must be H.264 ' +
1223
+ '(convert: ffmpeg -i in.webm -c:v libx264 -pix_fmt yuv420p -movflags +faststart out.mp4). If one cannot be attached, nothing is ' +
1224
+ 'posted; sending the same answer again reuses the files already attached.';
1225
+ /** `answer_request` in a Jira session that can show files: the Jira shape, and the files the answer carries. */
1226
+ const jiraFilesAnswerRequestShape = {
1227
+ ...jiraAnswerRequestShape,
1228
+ files: zod_1.z.preprocess(coerceJsonArrayArg, zod_1.z.array(zod_1.z.string().min(1)).min(1).max(jiraFilesMaxCount)).optional().describe(jiraFilesDescription),
1229
+ };
1230
+ const jiraFilesAnswerRequestInput = (0, strictToolInput_1.createStrictToolInput)(jiraFilesAnswerRequestShape);
1231
+ /** `send_file_to_user` in a Jira session: the Telegram tool's arguments, but `threadKey` (a Jira session's token names its issue). */
1232
+ const jiraSendFileShape = {
1233
+ paths: zod_1.z.preprocess(coerceJsonArrayArg, zod_1.z.array(zod_1.z.string().min(1)).min(1).max(jiraFilesMaxCount))
1234
+ .describe('Files to show, as 1..10 paths RELATIVE to the issue\'s folder (absolute paths only if they resolve inside it). A path outside it is rejected and nothing is attached.'),
1235
+ caption: zod_1.z.string().optional().describe('Optional text of the comment, in Markdown, above the files.'),
1236
+ as_file: zod_1.z.boolean().optional().describe('List every file as a link to its attachment instead of showing images and videos in the comment.'),
1237
+ };
1238
+ const jiraSendFileInput = (0, strictToolInput_1.createStrictToolInput)(jiraSendFileShape);
1218
1239
  /**
1219
1240
  * @description Register `answer_request` (request/answer core S3): the agent's
1220
1241
  * answer to a request, delivered to the surface the request came from. The
@@ -1238,16 +1259,47 @@ function registerAnswerRequestTool(server, deps, scope, platform) {
1238
1259
  kind: args.kind,
1239
1260
  body: args.body,
1240
1261
  ...(args.replyToCommentIds === undefined ? {} : { replyToCommentIds: args.replyToCommentIds }),
1262
+ ...(args.files === undefined ? {} : { files: args.files }),
1241
1263
  checkIsConversationInScope: (conversationKey) => checkIsConversationInScope(scope, conversationKey, deps.getThreadsForDirectory),
1242
1264
  });
1243
- return outcome.ok ? textResult(outcome.message) : errorResult(outcome.error);
1265
+ return outcome.ok ? textResult(addLimitNoteToResult(deps, outcome.conversationKey, outcome.message)) : errorResult(outcome.error);
1244
1266
  };
1245
- // The reply field names a tracker's comments: only a Jira session is offered it.
1246
- if (platform === 'jira')
1267
+ // The reply field names a tracker's comments: only a Jira session is offered it — and the files, where the connector can attach them.
1268
+ if (platform === 'jira' && deps.sendJiraFiles)
1269
+ server.registerTool('answer_request', { ...definition, inputSchema: jiraFilesAnswerRequestInput }, handle);
1270
+ else if (platform === 'jira')
1247
1271
  server.registerTool('answer_request', { ...definition, inputSchema: jiraAnswerRequestInput }, handle);
1248
1272
  else
1249
1273
  server.registerTool('answer_request', { ...definition, inputSchema: answerRequestInput }, handle);
1250
1274
  }
1275
+ /**
1276
+ * `send_file_to_user` in a Jira session — the tool a Telegram session sends files with, under the same name and
1277
+ * arguments, so one instruction («send the video with send_file_to_user») works on both: the files are attached to the
1278
+ * issue and shown in ONE comment, the caption as its text. The issue is the session's own (its scoped token).
1279
+ */
1280
+ function registerJiraFileSendTool(server, deps, sendJiraFiles, scope) {
1281
+ server.registerTool('send_file_to_user', {
1282
+ title: 'Show files on this issue',
1283
+ description: 'Attach one or more files from THIS issue\'s folder to the Jira issue and post ONE comment that shows them, the caption as ' +
1284
+ 'its text: a .png/.jpg/.jpeg/.gif/.webp image is shown in the comment, an H.264 .mp4 plays in it, any other file is listed ' +
1285
+ 'as a link to its attachment (as_file:true lists every file that way). To put files INTO your answer instead, pass them in ' +
1286
+ 'answer_request\'s `files`. The comment goes into the thread your newest open request answers in. An image must be whole ' +
1287
+ 'and what its name says, an .mp4 must be H.264 (convert: ffmpeg -i in.webm -c:v libx264 -pix_fmt yuv420p -movflags ' +
1288
+ '+faststart out.mp4), and no file may be over the site\'s upload limit: otherwise nothing is attached. A file you attached ' +
1289
+ 'before with the same name and the same content is reused, so sending again attaches nothing twice. If a send fails, say so ' +
1290
+ 'in your answer and go on.',
1291
+ inputSchema: jiraSendFileInput,
1292
+ }, async (args) => {
1293
+ await deps.whenSessionsRestored();
1294
+ const resolved = resolveTargetThreadKey(scope, undefined, deps.getThreadsForDirectory);
1295
+ if (!resolved.ok)
1296
+ return errorResult(resolved.error);
1297
+ const result = await sendJiraFiles(resolved.threadKey, { paths: args.paths, caption: args.caption, asFile: args.as_file });
1298
+ if (result.ok)
1299
+ return textResult(addLimitNoteToResult(deps, resolved.threadKey, result.summary));
1300
+ return 'kind' in result && result.kind === 'deliveryUnknown' ? deliveryUnknownResult(result.error) : errorResult(result.error);
1301
+ });
1302
+ }
1251
1303
  /**
1252
1304
  * @description Correlate stateless MCP requests with cancellation notifications.
1253
1305
  * Active controllers are isolated by verified token + validated client identity
@@ -1372,42 +1424,62 @@ function buildRequestServer(deps, scope, requestSignal) {
1372
1424
  registerBotTools(server, deps, scope, platform, requestSignal);
1373
1425
  return server;
1374
1426
  }
1427
+ /**
1428
+ * @description Whether a conversation of `platform` gets the `schedule_*` tools: a Telegram topic and a Jira issue (the wording
1429
+ * of each is `scheduleToolWording.ts`). The `test` platform and a key no codec reads keep the platform-neutral tool set.
1430
+ */
1431
+ function checkIsSchedulingPlatform(platform) {
1432
+ return platform === 'telegram' || platform === 'jira';
1433
+ }
1375
1434
  /** The tools a session of `platform` gets — the one list the request path serves and the digest records. */
1376
1435
  function registerBotTools(server, deps, scope, platform, requestSignal) {
1377
- // These deliver into a Telegram topic; for another platform's key they would throw (D18).
1436
+ // Scheduling belongs to a conversation of a platform that can be woken by it: a topic or a Jira issue (this superseded D18 for
1437
+ // the `schedule_*` tools). A key no codec reads, or the test platform, keeps the neutral set.
1438
+ if (checkIsSchedulingPlatform(platform))
1439
+ registerSchedulerTools(server, deps, scope, platform);
1440
+ // These deliver into a Telegram topic; for another platform's key they would throw (D18 stands for them).
1378
1441
  if (platform === 'telegram') {
1379
- registerSchedulerTools(server, deps, scope);
1380
1442
  registerFileSendTool(server, deps, scope, requestSignal);
1381
1443
  registerMessageSendTool(server, deps, scope, requestSignal);
1382
1444
  }
1383
1445
  // The original files of the conversation's own issue: only a Jira session, and only with the connector loaded.
1384
1446
  if (platform === 'jira' && deps.fetchJiraAttachment)
1385
1447
  registerJiraAttachmentTool(server, deps, deps.fetchJiraAttachment, scope);
1448
+ // Files shown on the conversation's own issue: only a Jira session, and only with the connector loaded.
1449
+ if (platform === 'jira' && deps.sendJiraFiles)
1450
+ registerJiraFileSendTool(server, deps, deps.sendJiraFiles, scope);
1386
1451
  registerCompactConversationTool(server, deps, scope);
1387
1452
  // A published list belongs to a conversation of a platform that has one (D54): a topic or a Jira issue.
1388
1453
  if (deps.todos && (platform === 'telegram' || platform === 'jira'))
1389
1454
  registerTodoTools(server, deps, deps.todos, scope);
1390
1455
  registerAnswerRequestTool(server, deps, scope, platform);
1391
1456
  if (deps.listClaudeProfiles)
1392
- registerClaudeProfilesTool(server, deps.listClaudeProfiles);
1457
+ registerClaudeProfilesTool(server, deps, deps.listClaudeProfiles, scope);
1393
1458
  }
1394
- /** The first line of the `claude_profiles` answer: the pick with how to launch it and why, or that nothing is usable and when something is. */
1459
+ /** The first line of the `claude_profiles` answer: with a `role`, the role's launch leads (`describeWorkerRoleVerdict`); then the account verdict. */
1395
1460
  function buildClaudeProfilesVerdict(report, currentProfile) {
1461
+ const accountVerdict = buildClaudeAccountVerdict(report, currentProfile);
1462
+ return report.worker === undefined ? accountVerdict : (0, workerRoles_1.describeWorkerRoleVerdict)(report.worker, accountVerdict);
1463
+ }
1464
+ /** The account part of the first line: the pick with how to launch it and why, a hand-over, or that nothing is usable and when something is. */
1465
+ function buildClaudeAccountVerdict(report, currentProfile) {
1466
+ // A worker that must not be resumed on another account: the hand-over leads, the pick is in the JSON.
1467
+ const handOver = (0, claudeUsage_1.describeClaudeResumeHandOver)(report, currentProfile);
1468
+ if (handOver !== null)
1469
+ return handOver;
1396
1470
  const outcome = (0, claudeUsage_1.describeClaudeLaunchOutcome)(report, currentProfile);
1397
1471
  const exclusions = (0, claudeUsage_1.describeClaudeChainExclusions)(report);
1398
1472
  const notOffered = exclusions === null ? '' : ` [${exclusions}]`;
1399
1473
  if (report.recommended === null)
1400
1474
  return `${outcome}${notOffered}`;
1401
- const dir = report.profiles.find((profile) => profile.name === report.recommended)?.configDir ?? null;
1402
- const launch = dir === null ? 'default profile, set no CLAUDE_CONFIG_DIR' : `CLAUDE_CONFIG_DIR=${dir}`;
1403
- return `recommended: ${report.recommended} → ${launch} (${outcome})${notOffered}`;
1475
+ return `recommended: ${report.recommended} → ${(0, claudeUsage_1.describeClaudeProfileLaunch)(report, report.recommended)} (${outcome})${notOffered}`;
1404
1476
  }
1405
1477
  /**
1406
1478
  * `claude_profiles`: which Claude account a child process should run on. Reads the bot's per-profile usage
1407
1479
  * cache (refreshed on demand by the port); touches no conversation, so it needs no scope resolution. The
1408
1480
  * answer is the report as JSON with a one-line verdict first, so an agent can act on it without parsing.
1409
1481
  */
1410
- function registerClaudeProfilesTool(server, listClaudeProfiles) {
1482
+ function registerClaudeProfilesTool(server, deps, listClaudeProfiles, scope) {
1411
1483
  server.registerTool('claude_profiles', {
1412
1484
  title: 'Claude accounts and their usage',
1413
1485
  description: 'The Claude account profiles signed in on this host, each with its usage windows — session (5 h), weekly ' +
@@ -1417,33 +1489,60 @@ function registerClaudeProfilesTool(server, listClaudeProfiles) {
1417
1489
  'session you resume). A NEW agent (omit `currentProfile`) goes to an `api`-billed account of the list first while its ' +
1418
1490
  'credit lasts (a Claude Console balance, no windows), then to the usable subscription whose weekly limit resets ' +
1419
1491
  'SOONEST — what burns soonest is spent first; an account whose five-hour window is at 90 % or more is skipped until ' +
1420
- 'it resets. Take the account `recommended` names; no need to ask the operator. A session you RESUME (pass ' +
1421
- '`currentProfile`, the profile it last ran on) stays on it unless that account is signed out, limited, out of the ' +
1422
- 'list or at 100 % on a window the model drains; when it broke off on a usage limit — or on "Credit balance is too ' +
1423
- 'low" — pass `isStoppedByLimit: true` and resume the SAME session at once on the answer (for an `api` account the bot ' +
1424
- 'first checks the balance with one tiny request: it marks the credit used up only if the API refuses for it, else it ' +
1425
- 'keeps the account off agents for an hour). The session window and the shared weekly window bound every model, Fable ' +
1492
+ 'it resets. Take the account of `recommended` — on a resume, of `resume.profile` (below); no need to ask the operator. Calling it IS looking at the limits: ' +
1493
+ 'the bot\'s `[Accounts …]` reminders then wait another interval. A worker you RESUME: pass `currentProfile` (the profile it last ran on) ' +
1494
+ 'and `lastRunEndedAt` (when its last run ended — the last write of its log; omitted = cold). The answer then carries ' +
1495
+ '`resume`: `resume` → continue the session under `resume.profile`; `handOver` → do NOT resume that worker on another ' +
1496
+ 'account: give its work to a NEW worker on `resume.profile` (a reviewer already running there may apply its own findings, ' +
1497
+ 'then a fresh reviewer checks). It hands over when the worker\'s account is signed out, limited, out of the list or at 100 % ' +
1498
+ 'on a window the model drains, or when its last run ended 55 min ago or more (the prompt cache is cold) and another ' +
1499
+ 'account is now the pick; otherwise it resumes where it ran. A worker cut off MID-RUN by a usage limit — or by "Credit ' +
1500
+ 'balance is too low" — is the exception: pass `isStoppedByLimit: true` and resume the SAME session at once on the answer ' +
1501
+ '(for an `api` account the bot first checks the balance with one tiny request: it marks the credit used up only if the API ' +
1502
+ 'refuses for it, else it keeps the account off agents for an hour). The session window and the shared weekly window bound every model, Fable ' +
1426
1503
  'included; Fable also drains its own weekly window; signed-out and limited accounts are skipped. An `api` entry ' +
1427
1504
  'also carries the bot\'s own estimate of its API credit — `spentUsd` through the bot in the current credit period, ' +
1428
1505
  '`remainingEstimateUsd` and `expiresOn` when the operator gave a Console figure (null otherwise; `expiresOn` stays null ' +
1429
1506
  'after a renewal), `probablyUsedUp` after a refusal for the balance (the bot cannot be sure; it rechecks daily) and ' +
1430
1507
  '`renewedAt` once it saw the credit come back — never the Console balance; past a given `expiresOn` it is not put ' +
1431
- 'first. `recommended: null` means nothing is usable now: ' +
1508
+ 'first. `launchOrder` lists the accounts a launch would go to, best first (`recommended` is its head for a new agent). ' +
1509
+ '`recommended: null` means nothing is usable now: ' +
1432
1510
  '`nextAvailable` names the account and instant that frees up first — schedule ONE resume at that time instead ' +
1433
1511
  'of retrying; when `nextAvailable` is null too, tell the user and retry once in about 30 minutes. Call it BEFORE launching or resuming a child `claude` and start the child with ' +
1434
1512
  'CLAUDE_CONFIG_DIR=<configDir> in its environment — configDir null means the default profile: set nothing. ' +
1435
- 'Without the variable the child inherits the account of this very session.',
1513
+ 'Without the variable the child inherits the account of this very session. ' +
1514
+ 'Pass `role` instead of `model` when nothing you follow names the worker\'s model: `worker` (and the first line) then gives ' +
1515
+ 'the operator\'s default CLI, model and effort for it (/workers) — the bot\'s DEFAULT: a model the user names, or a general ' +
1516
+ 'delegate skill you follow names for the role, wins. `worker.cli: opencode` with `worker.unavailable` null needs no Claude account ' +
1517
+ '(`recommended`, `resume` and `nextAvailable` do not apply to it); `worker.unavailable` set → launch the worker on the CLI, ' +
1518
+ 'model and effort this conversation runs on — on Claude, call this tool again with that model and take its account. A worker you resume keeps its first run\'s ' +
1519
+ 'model and effort: pass that `model`, not the role.',
1436
1520
  inputSchema: (0, strictToolInput_1.createStrictToolInput)({
1437
1521
  model: zod_1.z
1438
1522
  .string()
1439
1523
  .max(64)
1440
1524
  .optional()
1441
- .describe('The model the child will run (e.g. "fable", "opus", "sonnet"); decides whether the Fable weekly window counts besides the shared ones. Omit for the shared windows.'),
1525
+ .describe('The model the child will run (e.g. "fable", "opus", "sonnet"); decides whether the Fable weekly window counts besides the shared ones. Omit for the shared windows. Not with `role`.'),
1526
+ role: zod_1.z
1527
+ .enum(workerRoles_1.workerRoleIds)
1528
+ .optional()
1529
+ .describe('The worker\'s role, when neither the user nor a general delegate skill you follow names its model (they do → pass `model` instead): ' +
1530
+ '`builder` — code, tests, debugging, e2e and live runs, rework, fixes after a full run; ' +
1531
+ '`storageBuilder` — a builder whose work touches data persistence (storage, DB schema and migrations, sync, merge and conflict resolution, backups — anything that can lose or corrupt user data); ' +
1532
+ '`investigator` — a cause still unclear after a builder failed on it twice (also UX or platform behaviour); ' +
1533
+ '`reviewer` — the independent review of a task or commit; ' +
1534
+ '`miniReviewer` — a small diff, a reviewer\'s own fix, applied fixes; ' +
1535
+ '`planner` — a planner, and the research that feeds a plan (a researcher, an analyst).'),
1442
1536
  currentProfile: zod_1.z
1443
1537
  .string()
1444
1538
  .max(claudeProfiles_1.claudeProfileNameMaxLength)
1445
1539
  .optional()
1446
1540
  .describe('The profile the session you RESUME last ran on (the `name` you recorded at its launch); omit for a new agent.'),
1541
+ lastRunEndedAt: zod_1.z
1542
+ .string()
1543
+ .max(claudeResumeInstantMaxLength)
1544
+ .optional()
1545
+ .describe('When the resumed worker\'s last run ended, an ISO 8601 instant (the last write of its log, e.g. 2026-11-21T12:30:00Z). Omit = unknown, so cold. Needs `currentProfile`.'),
1447
1546
  isStoppedByLimit: zod_1.z
1448
1547
  .boolean()
1449
1548
  .optional()
@@ -1451,10 +1550,27 @@ function registerClaudeProfilesTool(server, listClaudeProfiles) {
1451
1550
  }),
1452
1551
  }, async (args) => {
1453
1552
  const currentProfile = args.currentProfile?.trim() || null;
1553
+ const model = args.model?.trim() || null;
1554
+ if (args.role !== undefined && model !== null) {
1555
+ return errorResult('Pass `model` OR `role`, not both: `model` when the user or a general delegate skill you follow names the worker\'s model, `role` when nothing does.');
1556
+ }
1454
1557
  if (args.isStoppedByLimit === true && currentProfile === null) {
1455
1558
  return errorResult('isStoppedByLimit needs currentProfile — the profile the session that hit the limit last ran on.');
1456
1559
  }
1457
- const report = await listClaudeProfiles({ model: args.model?.trim() || null, currentProfile, isStoppedByLimit: args.isStoppedByLimit === true });
1560
+ let lastRunEndedAtMs = null;
1561
+ if (args.lastRunEndedAt !== undefined) {
1562
+ if (currentProfile === null)
1563
+ return errorResult('lastRunEndedAt needs currentProfile — the profile the worker you resume last ran on.');
1564
+ lastRunEndedAtMs = Date.parse(args.lastRunEndedAt);
1565
+ if (Number.isNaN(lastRunEndedAtMs))
1566
+ return errorResult('lastRunEndedAt must be an ISO 8601 instant, e.g. 2026-11-21T12:30:00Z.');
1567
+ }
1568
+ const report = await listClaudeProfiles({ model, role: args.role ?? null, currentProfile, isStoppedByLimit: args.isStoppedByLimit === true, lastRunEndedAtMs });
1569
+ // The agent looked at the accounts, and launching workers is what it does: the reminder clock restarts, the conversation
1570
+ // orchestrates (`limitNotes/`). Resolved like the send tools; a `dir` scope with several bound topics names none: nothing is recorded.
1571
+ const resolved = resolveTargetThreadKey(scope, undefined, deps.getThreadsForDirectory);
1572
+ if (resolved.ok)
1573
+ deps.noteLimitProfilesCall?.(resolved.threadKey);
1458
1574
  return textResult(`${buildClaudeProfilesVerdict(report, currentProfile)}\n${JSON.stringify(report, null, 1)}`);
1459
1575
  });
1460
1576
  }