charness 3.6.1 → 3.7.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 (578) hide show
  1. package/CHANGELOG.md +267 -0
  2. package/DEVELOPMENT.md +31 -5
  3. package/MIGRATION_RENAME_TO_CHARNESS.md +3 -2
  4. package/README.md +84 -782
  5. package/SETUP.md +37 -10
  6. package/agent-plugin/.claude-plugin/plugin.json +7 -0
  7. package/agent-plugin/README.md +35 -0
  8. package/agent-plugin/skills/charness-delegate-claude/SKILL.md +85 -0
  9. package/agent-plugin/skills/charness-delegate-claude/summarize-events.py +90 -0
  10. package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +68 -0
  11. package/agent-plugin/skills/charness-manager/SKILL.md +152 -0
  12. package/dist/adapters/adapterNames.d.ts +6 -0
  13. package/dist/adapters/adapterNames.d.ts.map +1 -1
  14. package/dist/adapters/adapterNames.js +8 -2
  15. package/dist/adapters/adapterNames.js.map +1 -1
  16. package/dist/adapters/claudeCliAdapter.d.ts +8 -0
  17. package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
  18. package/dist/adapters/claudeCliAdapter.js +42 -5
  19. package/dist/adapters/claudeCliAdapter.js.map +1 -1
  20. package/dist/adapters/claudeJsonStreamAdapter.d.ts +10 -9
  21. package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
  22. package/dist/adapters/claudeJsonStreamAdapter.js +53 -55
  23. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
  24. package/dist/adapters/createAdapter.d.ts +8 -0
  25. package/dist/adapters/createAdapter.d.ts.map +1 -1
  26. package/dist/adapters/createAdapter.js +14 -2
  27. package/dist/adapters/createAdapter.js.map +1 -1
  28. package/dist/adapters/openCodeAdapter.d.ts +43 -6
  29. package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
  30. package/dist/adapters/openCodeAdapter.js +95 -6
  31. package/dist/adapters/openCodeAdapter.js.map +1 -1
  32. package/dist/agentLogin/agentLogin.d.ts +1 -1
  33. package/dist/agentLogin/agentLogin.d.ts.map +1 -1
  34. package/dist/apiRetryKick.d.ts +4 -3
  35. package/dist/apiRetryKick.d.ts.map +1 -1
  36. package/dist/apiRetryKick.js +16 -9
  37. package/dist/apiRetryKick.js.map +1 -1
  38. package/dist/bot.d.ts.map +1 -1
  39. package/dist/bot.js +1313 -381
  40. package/dist/bot.js.map +1 -1
  41. package/dist/cli/claudeProfiles.d.ts +11 -6
  42. package/dist/cli/claudeProfiles.d.ts.map +1 -1
  43. package/dist/cli/claudeProfiles.js +50 -22
  44. package/dist/cli/claudeProfiles.js.map +1 -1
  45. package/dist/cli/hot.d.ts +5 -0
  46. package/dist/cli/hot.d.ts.map +1 -1
  47. package/dist/cli/hot.js +71 -25
  48. package/dist/cli/hot.js.map +1 -1
  49. package/dist/cli/tscWatchGuard.d.ts +95 -0
  50. package/dist/cli/tscWatchGuard.d.ts.map +1 -0
  51. package/dist/cli/tscWatchGuard.js +295 -0
  52. package/dist/cli/tscWatchGuard.js.map +1 -0
  53. package/dist/cli.js +12 -1
  54. package/dist/cli.js.map +1 -1
  55. package/dist/connectors/jira/answerSink.d.ts +10 -0
  56. package/dist/connectors/jira/answerSink.d.ts.map +1 -1
  57. package/dist/connectors/jira/answerSink.js +13 -0
  58. package/dist/connectors/jira/answerSink.js.map +1 -1
  59. package/dist/connectors/jira/config.d.ts +2 -0
  60. package/dist/connectors/jira/config.d.ts.map +1 -1
  61. package/dist/connectors/jira/config.js +9 -1
  62. package/dist/connectors/jira/config.js.map +1 -1
  63. package/dist/connectors/jira/connector.d.ts +11 -1
  64. package/dist/connectors/jira/connector.d.ts.map +1 -1
  65. package/dist/connectors/jira/connector.js +7 -0
  66. package/dist/connectors/jira/connector.js.map +1 -1
  67. package/dist/connectors/jira/inbound.d.ts +27 -4
  68. package/dist/connectors/jira/inbound.d.ts.map +1 -1
  69. package/dist/connectors/jira/inbound.js +69 -8
  70. package/dist/connectors/jira/inbound.js.map +1 -1
  71. package/dist/connectors/jira/issueBlocks.d.ts +5 -0
  72. package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
  73. package/dist/connectors/jira/issueBlocks.js +11 -0
  74. package/dist/connectors/jira/issueBlocks.js.map +1 -1
  75. package/dist/connectors/telegram/bindPicker.d.ts +5 -0
  76. package/dist/connectors/telegram/bindPicker.d.ts.map +1 -1
  77. package/dist/connectors/telegram/bindPicker.js +18 -1
  78. package/dist/connectors/telegram/bindPicker.js.map +1 -1
  79. package/dist/connectors/telegram/bindPickerClaims.d.ts +46 -0
  80. package/dist/connectors/telegram/bindPickerClaims.d.ts.map +1 -0
  81. package/dist/connectors/telegram/bindPickerClaims.js +83 -0
  82. package/dist/connectors/telegram/bindPickerClaims.js.map +1 -0
  83. package/dist/connectors/telegram/bindSweep.d.ts +32 -0
  84. package/dist/connectors/telegram/bindSweep.d.ts.map +1 -0
  85. package/dist/connectors/telegram/bindSweep.js +47 -0
  86. package/dist/connectors/telegram/bindSweep.js.map +1 -0
  87. package/dist/connectors/telegram/bindingWelcome.d.ts +23 -0
  88. package/dist/connectors/telegram/bindingWelcome.d.ts.map +1 -0
  89. package/dist/connectors/telegram/bindingWelcome.js +26 -0
  90. package/dist/connectors/telegram/bindingWelcome.js.map +1 -0
  91. package/dist/connectors/telegram/botApiConnection.d.ts +74 -0
  92. package/dist/connectors/telegram/botApiConnection.d.ts.map +1 -0
  93. package/dist/connectors/telegram/botApiConnection.js +201 -0
  94. package/dist/connectors/telegram/botApiConnection.js.map +1 -0
  95. package/dist/connectors/telegram/commands/botCore.d.ts +8 -2
  96. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
  97. package/dist/connectors/telegram/commands/botSkills.d.ts +21 -0
  98. package/dist/connectors/telegram/commands/botSkills.d.ts.map +1 -0
  99. package/dist/connectors/telegram/commands/botSkills.js +133 -0
  100. package/dist/connectors/telegram/commands/botSkills.js.map +1 -0
  101. package/dist/connectors/telegram/commands/callbackMessage.d.ts +5 -0
  102. package/dist/connectors/telegram/commands/callbackMessage.d.ts.map +1 -1
  103. package/dist/connectors/telegram/commands/callbackMessage.js +9 -0
  104. package/dist/connectors/telegram/commands/callbackMessage.js.map +1 -1
  105. package/dist/connectors/telegram/commands/compaction.d.ts +65 -3
  106. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
  107. package/dist/connectors/telegram/commands/compaction.js +512 -94
  108. package/dist/connectors/telegram/commands/compaction.js.map +1 -1
  109. package/dist/connectors/telegram/commands/displayModes.d.ts +1 -1
  110. package/dist/connectors/telegram/commands/displayModes.d.ts.map +1 -1
  111. package/dist/connectors/telegram/commands/displayModes.js +6 -18
  112. package/dist/connectors/telegram/commands/displayModes.js.map +1 -1
  113. package/dist/connectors/telegram/commands/fallbackChain.js +5 -5
  114. package/dist/connectors/telegram/commands/fallbackChain.js.map +1 -1
  115. package/dist/connectors/telegram/commands/reminders.d.ts +1 -1
  116. package/dist/connectors/telegram/commands/reminders.d.ts.map +1 -1
  117. package/dist/connectors/telegram/commands/reminders.js +4 -15
  118. package/dist/connectors/telegram/commands/reminders.js.map +1 -1
  119. package/dist/connectors/telegram/commands/selfUpdate.d.ts.map +1 -1
  120. package/dist/connectors/telegram/commands/selfUpdate.js +1 -11
  121. package/dist/connectors/telegram/commands/selfUpdate.js.map +1 -1
  122. package/dist/connectors/telegram/commands/taskAgents.d.ts +22 -0
  123. package/dist/connectors/telegram/commands/taskAgents.d.ts.map +1 -0
  124. package/dist/connectors/telegram/commands/taskAgents.js +104 -0
  125. package/dist/connectors/telegram/commands/taskAgents.js.map +1 -0
  126. package/dist/connectors/telegram/commands/todo.d.ts +82 -0
  127. package/dist/connectors/telegram/commands/todo.d.ts.map +1 -0
  128. package/dist/connectors/telegram/commands/todo.js +384 -0
  129. package/dist/connectors/telegram/commands/todo.js.map +1 -0
  130. package/dist/connectors/telegram/commands/topicCommand.d.ts +6 -2
  131. package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
  132. package/dist/connectors/telegram/commands/topicCommand.js +6 -9
  133. package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
  134. package/dist/connectors/telegram/openBindMessages.d.ts +45 -0
  135. package/dist/connectors/telegram/openBindMessages.d.ts.map +1 -0
  136. package/dist/connectors/telegram/openBindMessages.js +67 -0
  137. package/dist/connectors/telegram/openBindMessages.js.map +1 -0
  138. package/dist/connectors/telegram/outputFlushPlan.d.ts +49 -0
  139. package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
  140. package/dist/connectors/telegram/outputFlushPlan.js +46 -0
  141. package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
  142. package/dist/connectors/telegram/pendingTopicName.d.ts +26 -0
  143. package/dist/connectors/telegram/pendingTopicName.d.ts.map +1 -0
  144. package/dist/connectors/telegram/pendingTopicName.js +27 -0
  145. package/dist/connectors/telegram/pendingTopicName.js.map +1 -0
  146. package/dist/connectors/test/connector.d.ts.map +1 -1
  147. package/dist/connectors/test/connector.js +6 -1
  148. package/dist/connectors/test/connector.js.map +1 -1
  149. package/dist/i18n/de.d.ts.map +1 -1
  150. package/dist/i18n/de.js +90 -7
  151. package/dist/i18n/de.js.map +1 -1
  152. package/dist/i18n/en.d.ts.map +1 -1
  153. package/dist/i18n/en.js +90 -7
  154. package/dist/i18n/en.js.map +1 -1
  155. package/dist/i18n/es.d.ts.map +1 -1
  156. package/dist/i18n/es.js +90 -7
  157. package/dist/i18n/es.js.map +1 -1
  158. package/dist/i18n/fr.d.ts.map +1 -1
  159. package/dist/i18n/fr.js +90 -7
  160. package/dist/i18n/fr.js.map +1 -1
  161. package/dist/i18n/hi.d.ts.map +1 -1
  162. package/dist/i18n/hi.js +90 -7
  163. package/dist/i18n/hi.js.map +1 -1
  164. package/dist/i18n/ja.d.ts.map +1 -1
  165. package/dist/i18n/ja.js +90 -7
  166. package/dist/i18n/ja.js.map +1 -1
  167. package/dist/i18n/ka.d.ts.map +1 -1
  168. package/dist/i18n/ka.js +90 -7
  169. package/dist/i18n/ka.js.map +1 -1
  170. package/dist/i18n/pt.d.ts.map +1 -1
  171. package/dist/i18n/pt.js +90 -7
  172. package/dist/i18n/pt.js.map +1 -1
  173. package/dist/i18n/ru.d.ts.map +1 -1
  174. package/dist/i18n/ru.js +90 -7
  175. package/dist/i18n/ru.js.map +1 -1
  176. package/dist/i18n/uk.d.ts.map +1 -1
  177. package/dist/i18n/uk.js +90 -7
  178. package/dist/i18n/uk.js.map +1 -1
  179. package/dist/i18n/uz.d.ts.map +1 -1
  180. package/dist/i18n/uz.js +90 -7
  181. package/dist/i18n/uz.js.map +1 -1
  182. package/dist/i18n/zh.d.ts.map +1 -1
  183. package/dist/i18n/zh.js +90 -7
  184. package/dist/i18n/zh.js.map +1 -1
  185. package/dist/i18n.d.ts +1 -1
  186. package/dist/i18n.js +1 -1
  187. package/dist/installManager.d.ts +13 -0
  188. package/dist/installManager.d.ts.map +1 -1
  189. package/dist/installManager.js +38 -4
  190. package/dist/installManager.js.map +1 -1
  191. package/dist/instanceSettings.d.ts +40 -1
  192. package/dist/instanceSettings.d.ts.map +1 -1
  193. package/dist/instanceSettings.js +105 -26
  194. package/dist/instanceSettings.js.map +1 -1
  195. package/dist/openCodeQuestionFlow.d.ts +30 -0
  196. package/dist/openCodeQuestionFlow.d.ts.map +1 -1
  197. package/dist/openCodeQuestionFlow.js +43 -0
  198. package/dist/openCodeQuestionFlow.js.map +1 -1
  199. package/dist/postToSession.d.ts +20 -5
  200. package/dist/postToSession.d.ts.map +1 -1
  201. package/dist/postToSession.js +38 -7
  202. package/dist/postToSession.js.map +1 -1
  203. package/dist/remoteRun/cliArgs.d.ts +73 -0
  204. package/dist/remoteRun/cliArgs.d.ts.map +1 -0
  205. package/dist/remoteRun/cliArgs.js +197 -0
  206. package/dist/remoteRun/cliArgs.js.map +1 -0
  207. package/dist/remoteRun/commands.d.ts +56 -0
  208. package/dist/remoteRun/commands.d.ts.map +1 -0
  209. package/dist/remoteRun/commands.js +306 -0
  210. package/dist/remoteRun/commands.js.map +1 -0
  211. package/dist/remoteRun/depsPlan.d.ts +16 -0
  212. package/dist/remoteRun/depsPlan.d.ts.map +1 -0
  213. package/dist/remoteRun/depsPlan.js +82 -0
  214. package/dist/remoteRun/depsPlan.js.map +1 -0
  215. package/dist/remoteRun/exitCodes.d.ts +34 -0
  216. package/dist/remoteRun/exitCodes.d.ts.map +1 -0
  217. package/dist/remoteRun/exitCodes.js +38 -0
  218. package/dist/remoteRun/exitCodes.js.map +1 -0
  219. package/dist/remoteRun/foreground.d.ts +29 -0
  220. package/dist/remoteRun/foreground.d.ts.map +1 -0
  221. package/dist/remoteRun/foreground.js +159 -0
  222. package/dist/remoteRun/foreground.js.map +1 -0
  223. package/dist/remoteRun/interrupts.d.ts +17 -0
  224. package/dist/remoteRun/interrupts.d.ts.map +1 -0
  225. package/dist/remoteRun/interrupts.js +41 -0
  226. package/dist/remoteRun/interrupts.js.map +1 -0
  227. package/dist/remoteRun/jobFiles.d.ts +31 -0
  228. package/dist/remoteRun/jobFiles.d.ts.map +1 -0
  229. package/dist/remoteRun/jobFiles.js +84 -0
  230. package/dist/remoteRun/jobFiles.js.map +1 -0
  231. package/dist/remoteRun/jobFormat.d.ts +16 -0
  232. package/dist/remoteRun/jobFormat.d.ts.map +1 -0
  233. package/dist/remoteRun/jobFormat.js +130 -0
  234. package/dist/remoteRun/jobFormat.js.map +1 -0
  235. package/dist/remoteRun/jobId.d.ts +15 -0
  236. package/dist/remoteRun/jobId.d.ts.map +1 -0
  237. package/dist/remoteRun/jobId.js +85 -0
  238. package/dist/remoteRun/jobId.js.map +1 -0
  239. package/dist/remoteRun/jobMeta.d.ts +18 -0
  240. package/dist/remoteRun/jobMeta.d.ts.map +1 -0
  241. package/dist/remoteRun/jobMeta.js +33 -0
  242. package/dist/remoteRun/jobMeta.js.map +1 -0
  243. package/dist/remoteRun/jobQuery.d.ts +12 -0
  244. package/dist/remoteRun/jobQuery.d.ts.map +1 -0
  245. package/dist/remoteRun/jobQuery.js +22 -0
  246. package/dist/remoteRun/jobQuery.js.map +1 -0
  247. package/dist/remoteRun/jobRecords.d.ts +22 -0
  248. package/dist/remoteRun/jobRecords.d.ts.map +1 -0
  249. package/dist/remoteRun/jobRecords.js +145 -0
  250. package/dist/remoteRun/jobRecords.js.map +1 -0
  251. package/dist/remoteRun/jobState.d.ts +62 -0
  252. package/dist/remoteRun/jobState.d.ts.map +1 -0
  253. package/dist/remoteRun/jobState.js +132 -0
  254. package/dist/remoteRun/jobState.js.map +1 -0
  255. package/dist/remoteRun/leaseTiming.d.ts +18 -0
  256. package/dist/remoteRun/leaseTiming.d.ts.map +1 -0
  257. package/dist/remoteRun/leaseTiming.js +43 -0
  258. package/dist/remoteRun/leaseTiming.js.map +1 -0
  259. package/dist/remoteRun/output.d.ts +35 -0
  260. package/dist/remoteRun/output.d.ts.map +1 -0
  261. package/dist/remoteRun/output.js +82 -0
  262. package/dist/remoteRun/output.js.map +1 -0
  263. package/dist/remoteRun/pathPatterns.d.ts +33 -0
  264. package/dist/remoteRun/pathPatterns.d.ts.map +1 -0
  265. package/dist/remoteRun/pathPatterns.js +115 -0
  266. package/dist/remoteRun/pathPatterns.js.map +1 -0
  267. package/dist/remoteRun/probe.d.ts +56 -0
  268. package/dist/remoteRun/probe.d.ts.map +1 -0
  269. package/dist/remoteRun/probe.js +123 -0
  270. package/dist/remoteRun/probe.js.map +1 -0
  271. package/dist/remoteRun/project.d.ts +26 -0
  272. package/dist/remoteRun/project.d.ts.map +1 -0
  273. package/dist/remoteRun/project.js +159 -0
  274. package/dist/remoteRun/project.js.map +1 -0
  275. package/dist/remoteRun/projectConfig.d.ts +38 -0
  276. package/dist/remoteRun/projectConfig.d.ts.map +1 -0
  277. package/dist/remoteRun/projectConfig.js +87 -0
  278. package/dist/remoteRun/projectConfig.js.map +1 -0
  279. package/dist/remoteRun/remoteRunCli.d.ts +15 -0
  280. package/dist/remoteRun/remoteRunCli.d.ts.map +1 -0
  281. package/dist/remoteRun/remoteRunCli.js +144 -0
  282. package/dist/remoteRun/remoteRunCli.js.map +1 -0
  283. package/dist/remoteRun/remoteRunError.d.ts +14 -0
  284. package/dist/remoteRun/remoteRunError.d.ts.map +1 -0
  285. package/dist/remoteRun/remoteRunError.js +28 -0
  286. package/dist/remoteRun/remoteRunError.js.map +1 -0
  287. package/dist/remoteRun/rsync.d.ts +17 -0
  288. package/dist/remoteRun/rsync.d.ts.map +1 -0
  289. package/dist/remoteRun/rsync.js +39 -0
  290. package/dist/remoteRun/rsync.js.map +1 -0
  291. package/dist/remoteRun/runnerClient.d.ts +50 -0
  292. package/dist/remoteRun/runnerClient.d.ts.map +1 -0
  293. package/dist/remoteRun/runnerClient.js +139 -0
  294. package/dist/remoteRun/runnerClient.js.map +1 -0
  295. package/dist/remoteRun/runners.d.ts +57 -0
  296. package/dist/remoteRun/runners.d.ts.map +1 -0
  297. package/dist/remoteRun/runners.js +181 -0
  298. package/dist/remoteRun/runners.js.map +1 -0
  299. package/dist/remoteRun/runnersConfig.d.ts +44 -0
  300. package/dist/remoteRun/runnersConfig.d.ts.map +1 -0
  301. package/dist/remoteRun/runnersConfig.js +107 -0
  302. package/dist/remoteRun/runnersConfig.js.map +1 -0
  303. package/dist/remoteRun/safeCopy.d.ts +31 -0
  304. package/dist/remoteRun/safeCopy.d.ts.map +1 -0
  305. package/dist/remoteRun/safeCopy.js +137 -0
  306. package/dist/remoteRun/safeCopy.js.map +1 -0
  307. package/dist/remoteRun/sendPlan.d.ts +67 -0
  308. package/dist/remoteRun/sendPlan.d.ts.map +1 -0
  309. package/dist/remoteRun/sendPlan.js +139 -0
  310. package/dist/remoteRun/sendPlan.js.map +1 -0
  311. package/dist/remoteRun/ssh.d.ts +62 -0
  312. package/dist/remoteRun/ssh.d.ts.map +1 -0
  313. package/dist/remoteRun/ssh.js +202 -0
  314. package/dist/remoteRun/ssh.js.map +1 -0
  315. package/dist/remoteRun/submit.d.ts +29 -0
  316. package/dist/remoteRun/submit.d.ts.map +1 -0
  317. package/dist/remoteRun/submit.js +142 -0
  318. package/dist/remoteRun/submit.js.map +1 -0
  319. package/dist/requests/answerRequest.d.ts +5 -0
  320. package/dist/requests/answerRequest.d.ts.map +1 -1
  321. package/dist/requests/answerRequest.js +16 -1
  322. package/dist/requests/answerRequest.js.map +1 -1
  323. package/dist/requests/requestLedger.d.ts +13 -0
  324. package/dist/requests/requestLedger.d.ts.map +1 -1
  325. package/dist/requests/requestLedger.js +9 -0
  326. package/dist/requests/requestLedger.js.map +1 -1
  327. package/dist/requests/topicRequestSettle.d.ts +30 -0
  328. package/dist/requests/topicRequestSettle.d.ts.map +1 -0
  329. package/dist/requests/topicRequestSettle.js +23 -0
  330. package/dist/requests/topicRequestSettle.js.map +1 -0
  331. package/dist/requests/wakeUpEngine.d.ts +4 -0
  332. package/dist/requests/wakeUpEngine.d.ts.map +1 -1
  333. package/dist/requests/wakeUpEngine.js +5 -1
  334. package/dist/requests/wakeUpEngine.js.map +1 -1
  335. package/dist/scheduler/delivery.d.ts +2 -0
  336. package/dist/scheduler/delivery.d.ts.map +1 -1
  337. package/dist/scheduler/delivery.js +8 -4
  338. package/dist/scheduler/delivery.js.map +1 -1
  339. package/dist/scheduler/mcpSurface.d.ts +59 -10
  340. package/dist/scheduler/mcpSurface.d.ts.map +1 -1
  341. package/dist/scheduler/mcpSurface.js +276 -79
  342. package/dist/scheduler/mcpSurface.js.map +1 -1
  343. package/dist/scheduler/recurrence.d.ts +5 -0
  344. package/dist/scheduler/recurrence.d.ts.map +1 -1
  345. package/dist/scheduler/recurrence.js +12 -2
  346. package/dist/scheduler/recurrence.js.map +1 -1
  347. package/dist/scheduler/strictToolInput.d.ts +45 -0
  348. package/dist/scheduler/strictToolInput.d.ts.map +1 -0
  349. package/dist/scheduler/strictToolInput.js +155 -0
  350. package/dist/scheduler/strictToolInput.js.map +1 -0
  351. package/dist/scheduler/types.d.ts +5 -0
  352. package/dist/scheduler/types.d.ts.map +1 -1
  353. package/dist/scheduler/workerWatch.d.ts +23 -0
  354. package/dist/scheduler/workerWatch.d.ts.map +1 -0
  355. package/dist/scheduler/workerWatch.js +26 -0
  356. package/dist/scheduler/workerWatch.js.map +1 -0
  357. package/dist/selfUpdate/emittedSource.d.ts +11 -0
  358. package/dist/selfUpdate/emittedSource.d.ts.map +1 -0
  359. package/dist/selfUpdate/emittedSource.js +24 -0
  360. package/dist/selfUpdate/emittedSource.js.map +1 -0
  361. package/dist/selfUpdate/gitSource.d.ts +0 -6
  362. package/dist/selfUpdate/gitSource.d.ts.map +1 -1
  363. package/dist/selfUpdate/gitSource.js +2 -18
  364. package/dist/selfUpdate/gitSource.js.map +1 -1
  365. package/dist/selfUpdate/updatePending.d.ts +1 -1
  366. package/dist/sendErrorClassifier.d.ts +10 -0
  367. package/dist/sendErrorClassifier.d.ts.map +1 -1
  368. package/dist/sendErrorClassifier.js +22 -0
  369. package/dist/sendErrorClassifier.js.map +1 -1
  370. package/dist/state.d.ts +78 -7
  371. package/dist/state.d.ts.map +1 -1
  372. package/dist/state.js +125 -8
  373. package/dist/state.js.map +1 -1
  374. package/dist/stateFile.d.ts +9 -0
  375. package/dist/stateFile.d.ts.map +1 -0
  376. package/dist/stateFile.js +57 -0
  377. package/dist/stateFile.js.map +1 -0
  378. package/dist/stt/sttInstall.d.ts +7 -3
  379. package/dist/stt/sttInstall.d.ts.map +1 -1
  380. package/dist/stt/sttInstall.js +8 -4
  381. package/dist/stt/sttInstall.js.map +1 -1
  382. package/dist/stt/sttSettings.d.ts +2 -1
  383. package/dist/stt/sttSettings.d.ts.map +1 -1
  384. package/dist/stt/sttSettings.js +3 -2
  385. package/dist/stt/sttSettings.js.map +1 -1
  386. package/dist/stt/transcribeChain.js +2 -0
  387. package/dist/stt/transcribeChain.js.map +1 -1
  388. package/dist/testTimings.d.ts +13 -3
  389. package/dist/testTimings.d.ts.map +1 -1
  390. package/dist/testTimings.js +26 -2
  391. package/dist/testTimings.js.map +1 -1
  392. package/dist/todos/board.d.ts +83 -0
  393. package/dist/todos/board.d.ts.map +1 -0
  394. package/dist/todos/board.js +227 -0
  395. package/dist/todos/board.js.map +1 -0
  396. package/dist/todos/format.d.ts +33 -0
  397. package/dist/todos/format.d.ts.map +1 -0
  398. package/dist/todos/format.js +90 -0
  399. package/dist/todos/format.js.map +1 -0
  400. package/dist/todos/merge.d.ts +46 -0
  401. package/dist/todos/merge.d.ts.map +1 -0
  402. package/dist/todos/merge.js +137 -0
  403. package/dist/todos/merge.js.map +1 -0
  404. package/dist/todos/midTurn.d.ts +75 -0
  405. package/dist/todos/midTurn.d.ts.map +1 -0
  406. package/dist/todos/midTurn.js +214 -0
  407. package/dist/todos/midTurn.js.map +1 -0
  408. package/dist/todos/nag.d.ts +85 -0
  409. package/dist/todos/nag.d.ts.map +1 -0
  410. package/dist/todos/nag.js +103 -0
  411. package/dist/todos/nag.js.map +1 -0
  412. package/dist/todos/order.d.ts +25 -0
  413. package/dist/todos/order.d.ts.map +1 -0
  414. package/dist/todos/order.js +61 -0
  415. package/dist/todos/order.js.map +1 -0
  416. package/dist/todos/projects.d.ts +102 -0
  417. package/dist/todos/projects.d.ts.map +1 -0
  418. package/dist/todos/projects.js +342 -0
  419. package/dist/todos/projects.js.map +1 -0
  420. package/dist/todos/registry.d.ts +64 -0
  421. package/dist/todos/registry.d.ts.map +1 -0
  422. package/dist/todos/registry.js +116 -0
  423. package/dist/todos/registry.js.map +1 -0
  424. package/dist/todos/reminderEngine.d.ts +78 -0
  425. package/dist/todos/reminderEngine.d.ts.map +1 -0
  426. package/dist/todos/reminderEngine.js +162 -0
  427. package/dist/todos/reminderEngine.js.map +1 -0
  428. package/dist/todos/store.d.ts +34 -0
  429. package/dist/todos/store.d.ts.map +1 -0
  430. package/dist/todos/store.js +208 -0
  431. package/dist/todos/store.js.map +1 -0
  432. package/dist/todos/tools.d.ts +26 -0
  433. package/dist/todos/tools.d.ts.map +1 -0
  434. package/dist/todos/tools.js +25 -0
  435. package/dist/todos/tools.js.map +1 -0
  436. package/dist/todos/types.d.ts +85 -0
  437. package/dist/todos/types.d.ts.map +1 -0
  438. package/dist/todos/types.js +30 -0
  439. package/dist/todos/types.js.map +1 -0
  440. package/dist/trackers/taskAgentLimit.d.ts +58 -0
  441. package/dist/trackers/taskAgentLimit.d.ts.map +1 -0
  442. package/dist/trackers/taskAgentLimit.js +62 -0
  443. package/dist/trackers/taskAgentLimit.js.map +1 -0
  444. package/dist/trackers/taskAgentSlots.d.ts +109 -0
  445. package/dist/trackers/taskAgentSlots.d.ts.map +1 -0
  446. package/dist/trackers/taskAgentSlots.js +227 -0
  447. package/dist/trackers/taskAgentSlots.js.map +1 -0
  448. package/dist/trackers/types.d.ts +14 -0
  449. package/dist/trackers/types.d.ts.map +1 -0
  450. package/dist/trackers/types.js +3 -0
  451. package/dist/trackers/types.js.map +1 -0
  452. package/dist/types.d.ts +80 -4
  453. package/dist/types.d.ts.map +1 -1
  454. package/dist/utils/adoptReplayGate.d.ts +16 -0
  455. package/dist/utils/adoptReplayGate.d.ts.map +1 -0
  456. package/dist/utils/adoptReplayGate.js +35 -0
  457. package/dist/utils/adoptReplayGate.js.map +1 -0
  458. package/dist/utils/agentPlugin.d.ts +113 -0
  459. package/dist/utils/agentPlugin.d.ts.map +1 -0
  460. package/dist/utils/agentPlugin.js +192 -0
  461. package/dist/utils/agentPlugin.js.map +1 -0
  462. package/dist/utils/autoContinueOnLimit.d.ts +7 -4
  463. package/dist/utils/autoContinueOnLimit.d.ts.map +1 -1
  464. package/dist/utils/autoContinueOnLimit.js +8 -5
  465. package/dist/utils/autoContinueOnLimit.js.map +1 -1
  466. package/dist/utils/botSkills.d.ts +62 -0
  467. package/dist/utils/botSkills.d.ts.map +1 -0
  468. package/dist/utils/botSkills.js +53 -0
  469. package/dist/utils/botSkills.js.map +1 -0
  470. package/dist/utils/botSkillsSetting.d.ts +7 -0
  471. package/dist/utils/botSkillsSetting.d.ts.map +1 -0
  472. package/dist/utils/botSkillsSetting.js +9 -0
  473. package/dist/utils/botSkillsSetting.js.map +1 -0
  474. package/dist/utils/claudeCodeVersion.d.ts +7 -0
  475. package/dist/utils/claudeCodeVersion.d.ts.map +1 -1
  476. package/dist/utils/claudeCodeVersion.js +14 -1
  477. package/dist/utils/claudeCodeVersion.js.map +1 -1
  478. package/dist/utils/claudeCompactHook.d.ts +33 -15
  479. package/dist/utils/claudeCompactHook.d.ts.map +1 -1
  480. package/dist/utils/claudeCompactHook.js +36 -17
  481. package/dist/utils/claudeCompactHook.js.map +1 -1
  482. package/dist/utils/claudeCompactSummary.d.ts +15 -0
  483. package/dist/utils/claudeCompactSummary.d.ts.map +1 -0
  484. package/dist/utils/claudeCompactSummary.js +96 -0
  485. package/dist/utils/claudeCompactSummary.js.map +1 -0
  486. package/dist/utils/claudeLimitSwitch.d.ts +11 -9
  487. package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
  488. package/dist/utils/claudeLimitSwitch.js +18 -16
  489. package/dist/utils/claudeLimitSwitch.js.map +1 -1
  490. package/dist/utils/claudeProfiles.d.ts +5 -0
  491. package/dist/utils/claudeProfiles.d.ts.map +1 -1
  492. package/dist/utils/claudeProfiles.js +14 -0
  493. package/dist/utils/claudeProfiles.js.map +1 -1
  494. package/dist/utils/claudeSessionTitle.d.ts +2 -1
  495. package/dist/utils/claudeSessionTitle.d.ts.map +1 -1
  496. package/dist/utils/claudeSessionTitle.js +14 -14
  497. package/dist/utils/claudeSessionTitle.js.map +1 -1
  498. package/dist/utils/claudeUsage.d.ts +95 -15
  499. package/dist/utils/claudeUsage.d.ts.map +1 -1
  500. package/dist/utils/claudeUsage.js +241 -41
  501. package/dist/utils/claudeUsage.js.map +1 -1
  502. package/dist/utils/claudeUsageRefresher.d.ts +10 -0
  503. package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
  504. package/dist/utils/claudeUsageRefresher.js +11 -0
  505. package/dist/utils/claudeUsageRefresher.js.map +1 -1
  506. package/dist/utils/claudeUserEntry.d.ts +50 -0
  507. package/dist/utils/claudeUserEntry.d.ts.map +1 -0
  508. package/dist/utils/claudeUserEntry.js +120 -0
  509. package/dist/utils/claudeUserEntry.js.map +1 -0
  510. package/dist/utils/clearThreadOutputQueues.d.ts +4 -3
  511. package/dist/utils/clearThreadOutputQueues.d.ts.map +1 -1
  512. package/dist/utils/clearThreadOutputQueues.js +1 -1
  513. package/dist/utils/clearThreadOutputQueues.js.map +1 -1
  514. package/dist/utils/compactOnIdle.d.ts +33 -13
  515. package/dist/utils/compactOnIdle.d.ts.map +1 -1
  516. package/dist/utils/compactOnIdle.js +35 -15
  517. package/dist/utils/compactOnIdle.js.map +1 -1
  518. package/dist/utils/fallbackBridge.d.ts +5 -0
  519. package/dist/utils/fallbackBridge.d.ts.map +1 -1
  520. package/dist/utils/fallbackBridge.js +19 -3
  521. package/dist/utils/fallbackBridge.js.map +1 -1
  522. package/dist/utils/fallbackChain.d.ts +9 -3
  523. package/dist/utils/fallbackChain.d.ts.map +1 -1
  524. package/dist/utils/fallbackChain.js +21 -3
  525. package/dist/utils/fallbackChain.js.map +1 -1
  526. package/dist/utils/fileSendPlan.d.ts +6 -0
  527. package/dist/utils/fileSendPlan.d.ts.map +1 -1
  528. package/dist/utils/fileSendPlan.js +11 -0
  529. package/dist/utils/fileSendPlan.js.map +1 -1
  530. package/dist/utils/fileSendService.d.ts +7 -1
  531. package/dist/utils/fileSendService.d.ts.map +1 -1
  532. package/dist/utils/fileSendService.js +6 -2
  533. package/dist/utils/fileSendService.js.map +1 -1
  534. package/dist/utils/groupFinalizePlan.d.ts +8 -10
  535. package/dist/utils/groupFinalizePlan.d.ts.map +1 -1
  536. package/dist/utils/groupFinalizePlan.js +8 -12
  537. package/dist/utils/groupFinalizePlan.js.map +1 -1
  538. package/dist/utils/jsonStreamHost.d.ts +13 -0
  539. package/dist/utils/jsonStreamHost.d.ts.map +1 -1
  540. package/dist/utils/jsonStreamHost.js +13 -0
  541. package/dist/utils/jsonStreamHost.js.map +1 -1
  542. package/dist/utils/messageSendService.d.ts +5 -3
  543. package/dist/utils/messageSendService.d.ts.map +1 -1
  544. package/dist/utils/messageSendService.js +12 -5
  545. package/dist/utils/messageSendService.js.map +1 -1
  546. package/dist/utils/openCodeCompactPlugin.d.ts +39 -14
  547. package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
  548. package/dist/utils/openCodeCompactPlugin.js +106 -38
  549. package/dist/utils/openCodeCompactPlugin.js.map +1 -1
  550. package/dist/utils/promptDelivery.d.ts +29 -12
  551. package/dist/utils/promptDelivery.d.ts.map +1 -1
  552. package/dist/utils/promptDelivery.js +13 -5
  553. package/dist/utils/promptDelivery.js.map +1 -1
  554. package/dist/utils/sentKindsSummary.d.ts +10 -0
  555. package/dist/utils/sentKindsSummary.d.ts.map +1 -0
  556. package/dist/utils/sentKindsSummary.js +18 -0
  557. package/dist/utils/sentKindsSummary.js.map +1 -0
  558. package/dist/utils/telegramError.d.ts +6 -0
  559. package/dist/utils/telegramError.d.ts.map +1 -1
  560. package/dist/utils/telegramError.js +12 -0
  561. package/dist/utils/telegramError.js.map +1 -1
  562. package/dist/utils/topicView.d.ts +1 -1
  563. package/dist/utils/topicView.js +1 -1
  564. package/dist/utils/transcribeAudio.d.ts +10 -0
  565. package/dist/utils/transcribeAudio.d.ts.map +1 -1
  566. package/dist/utils/transcribeAudio.js +22 -3
  567. package/dist/utils/transcribeAudio.js.map +1 -1
  568. package/dist/utils/transcriptErrorTime.d.ts +8 -0
  569. package/dist/utils/transcriptErrorTime.d.ts.map +1 -0
  570. package/dist/utils/transcriptErrorTime.js +56 -0
  571. package/dist/utils/transcriptErrorTime.js.map +1 -0
  572. package/dist/utils/wedgeRecovery.d.ts +2 -0
  573. package/dist/utils/wedgeRecovery.d.ts.map +1 -1
  574. package/dist/utils/wedgeRecovery.js +1 -1
  575. package/dist/utils/wedgeRecovery.js.map +1 -1
  576. package/package.json +11 -3
  577. package/remoteRun/runner.sh +1242 -0
  578. package/stt/gigaam_sidecar.py +555 -50
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  /**
3
3
  * @description The OpenCode plugin the bot installs so that a compaction OpenCode
4
- * runs ON ITS OWN when the context overflows also tells the next session which
5
- * skills to load again.
4
+ * runs ON ITS OWN when the context overflows also gets the resume guidance — the
5
+ * skills to load again and the next-steps checklist that ends the summary
6
+ * (`compactionResumeGuidance`).
6
7
  *
7
- * WHY this exists: the loaded-skills guidance rides the bot's per-invocation
8
+ * WHY this exists: the resume guidance rides the bot's per-invocation
8
9
  * `instruction` (`POST /session/:id/summarize`), which an overflow compaction
9
10
  * never receives, and unlike D3 it is not baked into the fork's prompt. OpenCode
10
11
  * runs the plugin hook `experimental.session.compacting` before EVERY compaction
@@ -18,6 +19,15 @@
18
19
  * file and rewrites it only when its content changed; the user's `opencode.json`
19
20
  * is never touched.
20
21
  *
22
+ * The file name carries a hash of the plugin's content. `GET /config` reports a
23
+ * loaded plugin only by that name, so a name that is the same for every version
24
+ * would make an instance that loaded an OLDER text read as up to date: it would
25
+ * never be recreated, and the bot would leave the guidance out of its own
26
+ * instruction on the strength of a plugin that carries less than the current
27
+ * one. With the hash only an instance that loaded the current text counts
28
+ * ({@link checkHasOpenCodeCompactPlugin}); an older copy of the file is removed on
29
+ * install, so a new instance never loads two.
30
+ *
21
31
  * A RUNNING instance does not rescan: OpenCode loads plugins once per project
22
32
  * folder. `POST /instance/dispose?directory=` makes the next request recreate the
23
33
  * folder's instance, which then loads the plugin — no server restart, sessions
@@ -29,34 +39,41 @@
29
39
  *
30
40
  * The hook only sees the session id, never the bot's per-invocation instruction,
31
41
  * so it cannot skip a compaction that already carries the guidance. The bot
32
- * therefore leaves the skills guidance out of its instruction when the folder's
33
- * instance has this plugin ({@link checkHasOpenCodeCompactPlugin} over
42
+ * therefore leaves the resume guidance out of its instruction when the folder's
43
+ * instance has the CURRENT plugin ({@link checkHasOpenCodeCompactPlugin} over
34
44
  * `GET /config`), and keeps it otherwise.
35
45
  */
36
46
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
47
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
48
  };
39
49
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.legacyOpenCodeCompactPluginId = exports.legacyOpenCodeCompactPluginFileName = exports.openCodeCompactPluginId = exports.openCodeCompactPluginFileName = void 0;
50
+ exports.openCodeCompactPluginFileName = exports.legacyOpenCodeCompactPluginId = exports.legacyOpenCodeCompactPluginFileName = exports.openCodeCompactPluginId = void 0;
41
51
  exports.getOpenCodeCompactPluginContext = getOpenCodeCompactPluginContext;
42
52
  exports.buildOpenCodeCompactPluginSource = buildOpenCodeCompactPluginSource;
53
+ exports.getOpenCodeCompactPluginFileName = getOpenCodeCompactPluginFileName;
43
54
  exports.resolveOpenCodeGlobalPluginDir = resolveOpenCodeGlobalPluginDir;
44
55
  exports.checkHasOpenCodeCompactPlugin = checkHasOpenCodeCompactPlugin;
45
56
  exports.getCompactPluginActivation = getCompactPluginActivation;
57
+ exports.checkIsOpenCodeSessionStatusIdle = checkIsOpenCodeSessionStatusIdle;
46
58
  exports.installOpenCodeCompactPlugin = installOpenCodeCompactPlugin;
59
+ const crypto_1 = __importDefault(require("crypto"));
47
60
  const fs_1 = __importDefault(require("fs"));
48
61
  const os_1 = __importDefault(require("os"));
49
62
  const path_1 = __importDefault(require("path"));
50
63
  const compactOnIdle_1 = require("./compactOnIdle");
51
64
  const legacyNames_1 = require("../legacyNames");
52
- /** File name of the plugin in OpenCode's plugin folder; also how the bot recognises it in `GET /config`. */
53
- exports.openCodeCompactPluginFileName = 'charness-compaction.js';
54
65
  /** OpenCode requires a path plugin to export an id. */
55
66
  exports.openCodeCompactPluginId = 'charness-compaction';
67
+ /** The part of the plugin's file name before the content hash. */
68
+ const openCodeCompactPluginFileStem = 'charness-compaction';
69
+ /** Hex digits of the content hash in the file name: enough that two texts never share one, short enough to read. */
70
+ const openCodeCompactPluginHashLength = 8;
71
+ /** The file name of any version of the plugin: the stem, an optional content hash (the first release had none). */
72
+ const openCodeCompactPluginFileNamePattern = new RegExp(`^${openCodeCompactPluginFileStem}(?:-[0-9a-f]{${openCodeCompactPluginHashLength}})?\\.js$`);
56
73
  /**
57
- * The file and id the same plugin had before the rename. A folder instance that
58
- * loaded it keeps it in memory, so it still counts as "has the plugin"; the FILE
59
- * is removed on install so a new instance does not load both.
74
+ * The file and id the same plugin had before the rename. The file is removed on
75
+ * install so a new instance does not load both; an instance that loaded it carries
76
+ * an older text, so it no longer counts as "has the plugin".
60
77
  */
61
78
  exports.legacyOpenCodeCompactPluginFileName = 'telegramcode-compaction.js';
62
79
  exports.legacyOpenCodeCompactPluginId = 'telegramcode-compaction';
@@ -64,10 +81,10 @@ exports.legacyOpenCodeCompactPluginId = 'telegramcode-compaction';
64
81
  * @description The text the plugin adds to every compaction prompt. OpenCode
65
82
  * appends it AFTER the bot's per-invocation instruction, which may end with the
66
83
  * F2 closing-section directive ("write nothing after the end marker"), so the text
67
- * says outright that the skills list belongs inside the summary.
84
+ * says outright that the skills list and the checklist belong inside the summary.
68
85
  */
69
86
  function getOpenCodeCompactPluginContext() {
70
- return `Additional instruction for the summary itself (put it inside the summary, never after a closing section the instructions above require): ${compactOnIdle_1.compactionSkillsGuidance}`;
87
+ return `Additional instruction for the summary itself (put it inside the summary, never after a closing section the instructions above require): ${compactOnIdle_1.compactionResumeGuidance}`;
71
88
  }
72
89
  /** @description The plugin module source: a v1 plugin (`default` export with `id` + `server`). */
73
90
  function buildOpenCodeCompactPluginSource(context) {
@@ -85,24 +102,36 @@ function buildOpenCodeCompactPluginSource(context) {
85
102
  '',
86
103
  ].join('\n');
87
104
  }
105
+ /**
106
+ * @description The plugin's file name for a given source: the stem and a hash of the source. `GET /config` names a
107
+ * loaded plugin by this file name alone, so the name is what tells an instance that loaded this text from one that
108
+ * loaded an older one.
109
+ */
110
+ function getOpenCodeCompactPluginFileName(source) {
111
+ const contentHash = crypto_1.default.createHash('sha256').update(source).digest('hex').slice(0, openCodeCompactPluginHashLength);
112
+ return `${openCodeCompactPluginFileStem}-${contentHash}.js`;
113
+ }
114
+ /** File name of the CURRENT plugin in OpenCode's plugin folder; also how the bot recognises it in `GET /config`. */
115
+ exports.openCodeCompactPluginFileName = getOpenCodeCompactPluginFileName(buildOpenCodeCompactPluginSource(getOpenCodeCompactPluginContext()));
88
116
  /** @description OpenCode's global plugin folder, resolved the way OpenCode resolves it (XDG config home). */
89
117
  function resolveOpenCodeGlobalPluginDir(env) {
90
118
  const configHome = env.XDG_CONFIG_HOME || path_1.default.join(os_1.default.homedir(), '.config');
91
119
  return path_1.default.join(configHome, 'opencode', 'plugins');
92
120
  }
93
121
  /**
94
- * @description Whether a `GET /config` `plugin` list contains the bot's plugin. A
122
+ * @description Whether a `GET /config` `plugin` list contains the CURRENT bot plugin. A
95
123
  * spec is a string or a `[spec, options]` tuple; OpenCode reports a path plugin as
96
- * a `file://` URL.
124
+ * a `file://` URL. Only the current file name counts: an instance that loaded an
125
+ * older version of the plugin (another content hash, the unhashed first release, the
126
+ * pre-rename file) keeps the older text in memory, so it must be recreated and the
127
+ * bot must still send the guidance itself.
97
128
  */
98
129
  function checkHasOpenCodeCompactPlugin(pluginSpecs) {
99
130
  if (!Array.isArray(pluginSpecs))
100
131
  return false;
101
132
  return pluginSpecs.some((entry) => {
102
133
  const spec = Array.isArray(entry) ? entry[0] : entry;
103
- return (typeof spec === 'string' &&
104
- (spec.endsWith(`/${exports.openCodeCompactPluginFileName}`) ||
105
- spec.endsWith(`/${exports.legacyOpenCodeCompactPluginFileName}`)));
134
+ return typeof spec === 'string' && spec.endsWith(`/${exports.openCodeCompactPluginFileName}`);
106
135
  });
107
136
  }
108
137
  /**
@@ -114,11 +143,16 @@ function checkHasOpenCodeCompactPlugin(pluginSpecs) {
114
143
  function getCompactPluginActivation(input) {
115
144
  if (checkHasOpenCodeCompactPlugin(input.pluginSpecs))
116
145
  return 'loaded';
117
- const status = input.sessionStatus;
118
- if (!status || typeof status !== 'object' || Array.isArray(status))
119
- return 'busy';
120
- const isAnyBusy = Object.values(status).some((entry) => !entry || typeof entry !== 'object' || entry.type !== 'idle');
121
- return isAnyBusy ? 'busy' : 'recreate';
146
+ return checkIsOpenCodeSessionStatusIdle(input.sessionStatus) ? 'recreate' : 'busy';
147
+ }
148
+ /**
149
+ * @description Whether a `GET /session/status` map says every session of the instance is idle. A status the bot
150
+ * cannot read counts as busy: an instance or a server is never recreated on a guess.
151
+ */
152
+ function checkIsOpenCodeSessionStatusIdle(sessionStatus) {
153
+ if (!sessionStatus || typeof sessionStatus !== 'object' || Array.isArray(sessionStatus))
154
+ return false;
155
+ return Object.values(sessionStatus).every((entry) => typeof entry === 'object' && entry !== null && 'type' in entry && entry.type === 'idle');
122
156
  }
123
157
  /**
124
158
  * @description Remove the plugin file a pre-rename release installed, so a folder
@@ -140,39 +174,73 @@ function removeLegacyOpenCodeCompactPlugin(pluginDir) {
140
174
  }
141
175
  (0, legacyNames_1.warnLegacyNameOnce)('opencode-compact-plugin', `${(0, legacyNames_1.formatDeprecation)(legacyPath, path_1.default.join(pluginDir, exports.openCodeCompactPluginFileName))}; the old file was removed`);
142
176
  }
177
+ /**
178
+ * @description Remove every OTHER version of the plugin from the folder, so a new
179
+ * folder instance loads one copy of the guidance, not an older text beside the
180
+ * current one. Only a file that is the bot's own (its name fits the plugin's and it
181
+ * exports the plugin's id) goes; anything else stays. Best-effort: a failure leaves a
182
+ * duplicate guidance, which is harmless.
183
+ */
184
+ function removeOutdatedOpenCodeCompactPlugins(pluginDir) {
185
+ let fileNames;
186
+ try {
187
+ fileNames = fs_1.default.readdirSync(pluginDir);
188
+ }
189
+ catch {
190
+ return;
191
+ }
192
+ for (const fileName of fileNames) {
193
+ if (fileName === exports.openCodeCompactPluginFileName || !openCodeCompactPluginFileNamePattern.test(fileName))
194
+ continue;
195
+ const outdatedPath = path_1.default.join(pluginDir, fileName);
196
+ try {
197
+ if (!fs_1.default.readFileSync(outdatedPath, 'utf-8').includes(JSON.stringify(exports.openCodeCompactPluginId)))
198
+ continue;
199
+ fs_1.default.unlinkSync(outdatedPath);
200
+ console.log(`[compact-plugin] removed the outdated plugin file ${outdatedPath}`);
201
+ }
202
+ catch {
203
+ // Gone already or not ours to read: it stays.
204
+ }
205
+ }
206
+ }
143
207
  /**
144
208
  * @description Put the plugin into OpenCode's global plugin folder. Idempotent:
145
209
  * an identical file is left alone, a stale one is replaced atomically (a folder
146
210
  * instance being created concurrently never reads half a file). Any failure is
147
211
  * logged and returned — the plugin improves a summary, it must never block an
148
212
  * OpenCode start or the bot's boot. The file a pre-rename release installed is
149
- * removed first.
213
+ * removed first; the older versions of the current name, once the current file is
214
+ * in place (a folder instance created in between loads both, never none).
150
215
  */
151
216
  function installOpenCodeCompactPlugin(pluginDir = resolveOpenCodeGlobalPluginDir(process.env)) {
152
217
  removeLegacyOpenCodeCompactPlugin(pluginDir);
153
218
  const pluginPath = path_1.default.join(pluginDir, exports.openCodeCompactPluginFileName);
154
219
  const source = buildOpenCodeCompactPluginSource(getOpenCodeCompactPluginContext());
220
+ let isCurrentFileInPlace = false;
155
221
  try {
156
- if (fs_1.default.readFileSync(pluginPath, 'utf-8') === source)
157
- return 'unchanged';
222
+ isCurrentFileInPlace = fs_1.default.readFileSync(pluginPath, 'utf-8') === source;
158
223
  }
159
224
  catch {
160
225
  // Missing or unreadable: (re)write below.
161
226
  }
162
- const tmpPath = `${pluginPath}.${process.pid}.${Date.now()}.tmp`;
163
- try {
164
- fs_1.default.mkdirSync(pluginDir, { recursive: true });
165
- fs_1.default.writeFileSync(tmpPath, source);
166
- fs_1.default.renameSync(tmpPath, pluginPath);
167
- }
168
- catch (e) {
169
- console.warn(`[compact-plugin] cannot write ${pluginPath}:`, e);
227
+ if (!isCurrentFileInPlace) {
228
+ const tmpPath = `${pluginPath}.${process.pid}.${Date.now()}.tmp`;
170
229
  try {
171
- fs_1.default.unlinkSync(tmpPath);
230
+ fs_1.default.mkdirSync(pluginDir, { recursive: true });
231
+ fs_1.default.writeFileSync(tmpPath, source);
232
+ fs_1.default.renameSync(tmpPath, pluginPath);
233
+ }
234
+ catch (e) {
235
+ console.warn(`[compact-plugin] cannot write ${pluginPath}:`, e);
236
+ try {
237
+ fs_1.default.unlinkSync(tmpPath);
238
+ }
239
+ catch { /* never written */ }
240
+ return 'failed';
172
241
  }
173
- catch { /* never written */ }
174
- return 'failed';
175
242
  }
176
- return 'written';
243
+ removeOutdatedOpenCodeCompactPlugins(pluginDir);
244
+ return isCurrentFileInPlace ? 'unchanged' : 'written';
177
245
  }
178
246
  //# sourceMappingURL=openCodeCompactPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"openCodeCompactPlugin.js","sourceRoot":"","sources":["../../src/utils/openCodeCompactPlugin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;;;;;AA4BH,0EAEC;AAGD,4EAcC;AAGD,wEAGC;AAOD,sEAUC;AAcD,gEAWC;AAmCD,oEAsBC;AAtJD,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AACxB,mDAA2D;AAC3D,gDAAuE;AAEvE,4GAA4G;AAC/F,QAAA,6BAA6B,GAAG,wBAAwB,CAAC;AAEtE,uDAAuD;AAC1C,QAAA,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D;;;;GAIG;AACU,QAAA,mCAAmC,GAAG,4BAA4B,CAAC;AACnE,QAAA,6BAA6B,GAAG,yBAAyB,CAAC;AAEvE;;;;;GAKG;AACH,SAAgB,+BAA+B;IAC7C,OAAO,4IAA4I,wCAAwB,EAAE,CAAC;AAChL,CAAC;AAED,kGAAkG;AAClG,SAAgB,gCAAgC,CAAC,OAAe;IAC9D,OAAO;QACL,oFAAoF;QACpF,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG;QAC7C,kBAAkB;QAClB,SAAS,IAAI,CAAC,SAAS,CAAC,+BAAuB,CAAC,GAAG;QACnD,0BAA0B;QAC1B,oEAAoE;QACpE,qCAAqC;QACrC,QAAQ;QACR,OAAO;QACP,IAAI;QACJ,EAAE;KACH,CAAC,IAAI,CAAC,IAA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,CAAC;AACxD,CAAC"}
@@ -2,22 +2,26 @@ import { type SessionKey } from '../sessionKey';
2
2
  import type { BufferedPromptSettled, StartupPromptBuffer } from '../startupPromptBuffer';
3
3
  /**
4
4
  * @name PromptDeliveryDeps
5
- * @description What {@link deliverPromptOrBuffer} acts through. `announceQueued`
6
- * tells the person their prompt waits for the session to come up — a topic
7
- * message, so it is only called for a Telegram conversation.
5
+ * @description What {@link deliverPromptOrBuffer} acts through. `forwardPrompt` says where the
6
+ * forward put the prompt ({@link LatePromptOutcome}); `announceQueued` tells the person their
7
+ * prompt waits for the session to come up — a topic message, so it is only called for a
8
+ * Telegram conversation.
8
9
  */
9
10
  export interface PromptDeliveryDeps {
10
11
  startupBuffer: Pick<StartupPromptBuffer, 'addPrompt'>;
11
- forwardPrompt: (key: SessionKey, text: string) => Promise<void>;
12
+ forwardPrompt: (key: SessionKey, text: string) => Promise<LatePromptOutcome>;
12
13
  announceQueued: (key: SessionKey) => Promise<void>;
13
14
  }
14
15
  /**
15
16
  * @name PromptDelivery
16
17
  * @description Where {@link deliverPromptOrBuffer} put the prompt: `forwarded` to the
17
- * session (done), or `buffered` behind a session start (it waits in memory until the
18
- * start ends — see `onBufferedSettled`).
18
+ * session (done), `buffered` behind a session start (it waits in memory until the
19
+ * start ends — see `onBufferedSettled`), or `noSession` — the forward found no session
20
+ * left to take it (a prompt that waited for a bot restart's replay; the person was
21
+ * told), so nothing will ever answer it: what the caller opened for it must not wait
22
+ * for a turn.
19
23
  */
20
- export type PromptDelivery = 'forwarded' | 'buffered';
24
+ export type PromptDelivery = 'forwarded' | 'buffered' | 'noSession';
21
25
  /**
22
26
  * @description Deliver `text` to a conversation's agent while honouring the startup
23
27
  * window: mid-startup the prompt is buffered (it replays in order once the session
@@ -47,18 +51,24 @@ export declare function deliverPromptOrBuffer(deps: PromptDeliveryDeps, key: Ses
47
51
  * @name LatePromptRoute
48
52
  * @description How a prompt decided on when it ARRIVED is delivered once its handler is ready to forward it:
49
53
  * `buffer` — a start or the idle stop is under way (its window is open: the prompt waits there, and the stop resumes the
50
- * session for it); `wake` — the process is gone meanwhile (the conversation sleeps: wake it, then forward); `forward`.
54
+ * session for it); `wake` — the process is gone meanwhile (the conversation sleeps: wake it, then forward); `forward`;
55
+ * `drop` — only for a technical prompt that finds no live session without a window: nothing is done for it.
51
56
  */
52
- export type LatePromptRoute = 'buffer' | 'wake' | 'forward';
57
+ export type LatePromptRoute = 'buffer' | 'wake' | 'forward' | 'drop';
53
58
  /**
54
59
  * @description The {@link LatePromptRoute} of a prompt, read at the moment it is forwarded. The idle stop posts a
55
60
  * re-asked question just before it stops the process, and a handler awaits between reading the session's state and the
56
61
  * forward (the tap's toast, the request it opens): written into a process being stopped the prompt was lost, and
57
62
  * into one already gone it was dropped.
63
+ *
64
+ * A bot-made TECHNICAL prompt (the todo list's standalone reminder) is posted only into a live session that is idle at
65
+ * this moment — never a resume, never held for a later one, never reported to the person: where a user's prompt would be
66
+ * buffered or wake the conversation, it is dropped.
58
67
  */
59
68
  export declare function getLatePromptRoute(input: {
60
69
  isWindowOpen: boolean;
61
70
  isSessionActive: boolean;
71
+ isTechnical?: boolean;
62
72
  }): LatePromptRoute;
63
73
  /** @description What a wake did: whether a session is up to forward to, and whether it already told the topic something. */
64
74
  export interface LateWakeResult {
@@ -74,15 +84,22 @@ export interface LateWakeResult {
74
84
  * already said why (`isAlreadyTold`), where a second, generic line would contradict it.
75
85
  */
76
86
  export interface LatePromptDeliveryPorts {
87
+ /** A bot-made technical prompt: dropped, not buffered or woken for, where a session is not live (see {@link getLatePromptRoute}). */
88
+ isTechnical?: boolean;
77
89
  checkIsWindowOpen: () => boolean;
78
90
  checkIsSessionActive: () => boolean;
79
91
  buffer: () => Promise<void>;
80
92
  wake: () => Promise<LateWakeResult>;
81
- forward: () => Promise<void>;
93
+ /** Where the forward put the prompt: `forwarded`, or what a forward that routes it again itself (a prompt that waited for an adopt replay) ended in — passed on as the answer. */
94
+ forward: () => Promise<LatePromptOutcome>;
82
95
  reportNoSession: (isAlreadyTold: boolean) => Promise<void>;
83
96
  }
84
- /** @description Where {@link deliverLatePrompt} put the prompt; `noSession` — nowhere: nothing to deliver it to. */
85
- export type LatePromptOutcome = 'buffered' | 'forwarded' | 'noSession';
97
+ /**
98
+ * @description Where {@link deliverLatePrompt} put the prompt; `noSession` — nowhere: nothing to deliver it to (the wake found
99
+ * nothing to resume, or the forward itself ended so); `dropped` — a technical prompt that found no live session, left alone
100
+ * on purpose (nothing buffered, woken or said).
101
+ */
102
+ export type LatePromptOutcome = 'buffered' | 'forwarded' | 'noSession' | 'dropped';
86
103
  /**
87
104
  * @description Deliver a prompt whose handler decided, when it arrived, that the session is live — routed again by
88
105
  * {@link getLatePromptRoute} now, after the handler's awaits. A wake that finds nothing never forwards: the forward
@@ -1 +1 @@
1
- {"version":3,"file":"promptDelivery.d.ts","sourceRoot":"","sources":["../../src/utils/promptDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAEzF;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;IACtD,aAAa,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,cAAc,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,OAAO,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,CAAC,CAAC;IACpC,kLAAkL;IAClL,OAAO,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC1C,eAAe,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAC;AAEnF;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAelG"}
@@ -31,8 +31,9 @@ const sessionKeyCodec_1 = require("../connectors/telegram/sessionKeyCodec");
31
31
  */
32
32
  async function deliverPromptOrBuffer(deps, key, text, isStarting, onBufferedSettled) {
33
33
  if (!isStarting) {
34
- await deps.forwardPrompt(key, text);
35
- return 'forwarded';
34
+ // Only `noSession` is told apart: a forward that re-routed the prompt behind a stop window itself registered no
35
+ // `onBufferedSettled`, so it reads as forwarded, as it always did.
36
+ return (await deps.forwardPrompt(key, text)) === 'noSession' ? 'noSession' : 'forwarded';
36
37
  }
37
38
  const isFirstBuffered = deps.startupBuffer.addPrompt((0, sessionKey_1.keyToString)(key), text, onBufferedSettled);
38
39
  if (isFirstBuffered && (0, sessionKeyCodec_1.checkIsTelegramKey)(key)) {
@@ -53,8 +54,14 @@ async function deliverPromptOrBuffer(deps, key, text, isStarting, onBufferedSett
53
54
  * re-asked question just before it stops the process, and a handler awaits between reading the session's state and the
54
55
  * forward (the tap's toast, the request it opens): written into a process being stopped the prompt was lost, and
55
56
  * into one already gone it was dropped.
57
+ *
58
+ * A bot-made TECHNICAL prompt (the todo list's standalone reminder) is posted only into a live session that is idle at
59
+ * this moment — never a resume, never held for a later one, never reported to the person: where a user's prompt would be
60
+ * buffered or wake the conversation, it is dropped.
56
61
  */
57
62
  function getLatePromptRoute(input) {
63
+ if (input.isTechnical === true)
64
+ return input.isWindowOpen || !input.isSessionActive ? 'drop' : 'forward';
58
65
  if (input.isWindowOpen)
59
66
  return 'buffer';
60
67
  return input.isSessionActive ? 'forward' : 'wake';
@@ -65,7 +72,9 @@ function getLatePromptRoute(input) {
65
72
  * would show the topic as working while the adapter drops the text.
66
73
  */
67
74
  async function deliverLatePrompt(ports) {
68
- const route = getLatePromptRoute({ isWindowOpen: ports.checkIsWindowOpen(), isSessionActive: ports.checkIsSessionActive() });
75
+ const route = getLatePromptRoute({ isWindowOpen: ports.checkIsWindowOpen(), isSessionActive: ports.checkIsSessionActive(), isTechnical: ports.isTechnical });
76
+ if (route === 'drop')
77
+ return 'dropped';
69
78
  if (route === 'buffer') {
70
79
  await ports.buffer();
71
80
  return 'buffered';
@@ -77,7 +86,6 @@ async function deliverLatePrompt(ports) {
77
86
  return 'noSession';
78
87
  }
79
88
  }
80
- await ports.forward();
81
- return 'forwarded';
89
+ return ports.forward();
82
90
  }
83
91
  //# sourceMappingURL=promptDelivery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"promptDelivery.js","sourceRoot":"","sources":["../../src/utils/promptDelivery.ts"],"names":[],"mappings":";;AAgDA,sDAuBC;AAgBD,gDAGC;AAiCD,8CAeC;AA1ID,8CAA6D;AAC7D,4EAA4E;AAuB5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,KAAK,UAAU,qBAAqB,CACzC,IAAwB,EACxB,GAAe,EACf,IAAY,EACZ,UAAmB,EACnB,iBAAyC;IAEzC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpC,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAA,wBAAW,EAAC,GAAG,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAChG,IAAI,eAAe,IAAI,IAAA,oCAAkB,EAAC,GAAG,CAAC,EAAE,CAAC;QAC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C;IACxC,OAAO,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACpD,CAAC;AAmCD;;;;GAIG;AACI,KAAK,UAAU,iBAAiB,CAAC,KAA8B;IACpE,MAAM,KAAK,GAAG,kBAAkB,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,iBAAiB,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,oBAAoB,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7J,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IACvC,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvB,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YACjD,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { FileSendKind } from './fileSendPlan';
2
+ /** What one message of a delivery was: a text, or the kind of file Telegram was asked to render. */
3
+ export type SentKind = 'text' | FileSendKind;
4
+ /**
5
+ * @description "1 text, 2 photos" — what actually went out, per kind: the wording `send_messages_to_user` and
6
+ * `send_file_to_user` both answer with. The agent reads it to notice a file that did not go out as it meant (an
7
+ * image that arrived as a document or as text), which a bare count hides. Empty when nothing went out.
8
+ */
9
+ export declare function formatSentKinds(kinds: readonly SentKind[]): string;
10
+ //# sourceMappingURL=sentKindsSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentKindsSummary.d.ts","sourceRoot":"","sources":["../../src/utils/sentKindsSummary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,oGAAoG;AACpG,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAC;AAK7C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAMlE"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatSentKinds = formatSentKinds;
4
+ /** The order a summary names the kinds in, so the same delivery always reads the same. */
5
+ const sentKindOrder = ['text', 'photo', 'video', 'animation', 'document'];
6
+ /**
7
+ * @description "1 text, 2 photos" — what actually went out, per kind: the wording `send_messages_to_user` and
8
+ * `send_file_to_user` both answer with. The agent reads it to notice a file that did not go out as it meant (an
9
+ * image that arrived as a document or as text), which a bare count hides. Empty when nothing went out.
10
+ */
11
+ function formatSentKinds(kinds) {
12
+ return sentKindOrder
13
+ .map((kind) => ({ kind, count: kinds.filter((sentKind) => sentKind === kind).length }))
14
+ .filter(({ count }) => count > 0)
15
+ .map(({ kind, count }) => `${count} ${kind}${count === 1 ? '' : 's'}`)
16
+ .join(', ');
17
+ }
18
+ //# sourceMappingURL=sentKindsSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentKindsSummary.js","sourceRoot":"","sources":["../../src/utils/sentKindsSummary.ts"],"names":[],"mappings":";;AAaA,0CAMC;AAdD,0FAA0F;AAC1F,MAAM,aAAa,GAAwB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAE/F;;;;GAIG;AACH,SAAgB,eAAe,CAAC,KAA0B;IACxD,OAAO,aAAa;SACjB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;SACtF,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;SAChC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SACrE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -1,2 +1,8 @@
1
1
  export declare function checkIsStaleAnswerCallbackQueryError(err: unknown): boolean;
2
+ /**
3
+ * @description Whether a Telegram error says the message is not there (any more): the answer to deleting or editing a
4
+ * message that was already deleted, by the person or by someone else. Not the one for a message Telegram refuses to delete
5
+ * (older than 48 hours, no right) — that message stays.
6
+ */
7
+ export declare function checkIsMessageNotFoundError(err: unknown): boolean;
2
8
  //# sourceMappingURL=telegramError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telegramError.d.ts","sourceRoot":"","sources":["../../src/utils/telegramError.ts"],"names":[],"mappings":"AAcA,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAS1E"}
1
+ {"version":3,"file":"telegramError.d.ts","sourceRoot":"","sources":["../../src/utils/telegramError.ts"],"names":[],"mappings":"AAcA,wBAAgB,oCAAoC,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAS1E;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIjE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkIsStaleAnswerCallbackQueryError = checkIsStaleAnswerCallbackQueryError;
4
+ exports.checkIsMessageNotFoundError = checkIsMessageNotFoundError;
4
5
  function checkIsRecord(value) {
5
6
  return typeof value === 'object' && value !== null;
6
7
  }
@@ -13,4 +14,15 @@ function checkIsStaleAnswerCallbackQueryError(err) {
13
14
  e.on?.method === 'answerCallbackQuery' &&
14
15
  /query is too old|query ID is invalid/i.test(description));
15
16
  }
17
+ /**
18
+ * @description Whether a Telegram error says the message is not there (any more): the answer to deleting or editing a
19
+ * message that was already deleted, by the person or by someone else. Not the one for a message Telegram refuses to delete
20
+ * (older than 48 hours, no right) — that message stays.
21
+ */
22
+ function checkIsMessageNotFoundError(err) {
23
+ if (!checkIsRecord(err))
24
+ return false;
25
+ const e = err;
26
+ return e.response?.error_code === 400 && /message to (delete|edit) not found/i.test(e.response.description ?? '');
27
+ }
16
28
  //# sourceMappingURL=telegramError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"telegramError.js","sourceRoot":"","sources":["../../src/utils/telegramError.ts"],"names":[],"mappings":";;AAcA,oFASC;AAbD,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAgB,oCAAoC,CAAC,GAAY;IAC/D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,CAAC,GAAG,GAAwB,CAAC;IACnC,MAAM,WAAW,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,IAAI,EAAE,CAAC;IAClD,OAAO,CACL,CAAC,CAAC,QAAQ,EAAE,UAAU,KAAK,GAAG;QAC9B,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB;QACtC,uCAAuC,CAAC,IAAI,CAAC,WAAW,CAAC,CAC1D,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"telegramError.js","sourceRoot":"","sources":["../../src/utils/telegramError.ts"],"names":[],"mappings":";;AAcA,oFASC;AAOD,kEAIC;AAxBD,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAgB,oCAAoC,CAAC,GAAY;IAC/D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,CAAC,GAAG,GAAwB,CAAC;IACnC,MAAM,WAAW,GAAG,CAAC,CAAC,QAAQ,EAAE,WAAW,IAAI,EAAE,CAAC;IAClD,OAAO,CACL,CAAC,CAAC,QAAQ,EAAE,UAAU,KAAK,GAAG;QAC9B,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,qBAAqB;QACtC,uCAAuC,CAAC,IAAI,CAAC,WAAW,CAAC,CAC1D,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,2BAA2B,CAAC,GAAY;IACtD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,CAAC,GAAG,GAAwB,CAAC;IACnC,OAAO,CAAC,CAAC,QAAQ,EAAE,UAAU,KAAK,GAAG,IAAI,qCAAqC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;AACpH,CAAC"}
@@ -22,7 +22,7 @@ export declare const topicViewOptions: readonly TopicView[];
22
22
  export declare const defaultTopicView: TopicView;
23
23
  /**
24
24
  * @description The typed `/verbosity` spelling of each view — the words the
25
- * public README documents (`/verbosity stream|stream_answers|answers`).
25
+ * public command reference (`docs/commands.md`) documents (`/verbosity stream|stream_answers|answers`).
26
26
  */
27
27
  export declare const topicViewArguments: Readonly<Record<TopicView, string>>;
28
28
  /** @description Type guard over the persisted spelling (a `state.json` value or a callback payload). */
@@ -12,7 +12,7 @@ exports.topicViewOptions = ['stream', 'streamAnswers', 'answers'];
12
12
  exports.defaultTopicView = 'stream';
13
13
  /**
14
14
  * @description The typed `/verbosity` spelling of each view — the words the
15
- * public README documents (`/verbosity stream|stream_answers|answers`).
15
+ * public command reference (`docs/commands.md`) documents (`/verbosity stream|stream_answers|answers`).
16
16
  */
17
17
  exports.topicViewArguments = {
18
18
  stream: 'stream',
@@ -17,6 +17,11 @@
17
17
  */
18
18
  /** Pauses before the automatic retries: the 1st after 5 s, the 2nd after 15 s. */
19
19
  export declare const transcribeRetryDelaysMs: readonly number[];
20
+ /**
21
+ * The interim (1xx) response header in which the local engine names the seconds of audio queued ahead of this upload:
22
+ * it recognises voices strictly in arrival order, so a voice may wait in line before its own recognition starts.
23
+ */
24
+ export declare const queuedAudioSecondsHeader = "x-charness-queued-audio-seconds";
20
25
  /**
21
26
  * @description Where and how a voice note is transcribed.
22
27
  */
@@ -66,6 +71,11 @@ export interface TranscribeAudioOptions {
66
71
  * rejection ends the attempts with its message.
67
72
  */
68
73
  refreshEndpoint?: () => Promise<TranscriptionEndpoint>;
74
+ /**
75
+ * The timeout once the engine reports the audio queued ahead of the upload ({@link queuedAudioSecondsHeader}), so the
76
+ * wait in line does not count against a budget sized for the voice alone. Without it a report changes nothing.
77
+ */
78
+ getTimeoutMsForQueuedAudio?: (queuedAudioSeconds: number) => number;
69
79
  }
70
80
  /** @description The Groq Whisper endpoint for `apiKey`. */
71
81
  export declare function createGroqEndpoint(apiKey: string): TranscriptionEndpoint;
@@ -1 +1 @@
1
- {"version":3,"file":"transcribeAudio.d.ts","sourceRoot":"","sources":["../../src/utils/transcribeAudio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAAoB,CAAC;AAe1E;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,oGAAoG;IACpG,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,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