charness 0.0.0-stage → 3.0.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 (988) hide show
  1. package/.env.example +88 -0
  2. package/DEVELOPMENT.md +110 -0
  3. package/LICENSE +21 -0
  4. package/MIGRATION_1_TO_2.md +24 -0
  5. package/README.md +1024 -2
  6. package/dist/accessControl.d.ts +71 -0
  7. package/dist/accessControl.d.ts.map +1 -0
  8. package/dist/accessControl.js +108 -0
  9. package/dist/accessControl.js.map +1 -0
  10. package/dist/adapters/adapterEventRouting.d.ts +51 -0
  11. package/dist/adapters/adapterEventRouting.d.ts.map +1 -0
  12. package/dist/adapters/adapterEventRouting.js +74 -0
  13. package/dist/adapters/adapterEventRouting.js.map +1 -0
  14. package/dist/adapters/adapterNames.d.ts +19 -0
  15. package/dist/adapters/adapterNames.d.ts.map +1 -0
  16. package/dist/adapters/adapterNames.js +25 -0
  17. package/dist/adapters/adapterNames.js.map +1 -0
  18. package/dist/adapters/claudeCliAdapter.d.ts +1336 -0
  19. package/dist/adapters/claudeCliAdapter.d.ts.map +1 -0
  20. package/dist/adapters/claudeCliAdapter.js +4204 -0
  21. package/dist/adapters/claudeCliAdapter.js.map +1 -0
  22. package/dist/adapters/claudeJsonStreamAdapter.d.ts +548 -0
  23. package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -0
  24. package/dist/adapters/claudeJsonStreamAdapter.js +1810 -0
  25. package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -0
  26. package/dist/adapters/claudePlatformFlags.d.ts +35 -0
  27. package/dist/adapters/claudePlatformFlags.d.ts.map +1 -0
  28. package/dist/adapters/claudePlatformFlags.js +46 -0
  29. package/dist/adapters/claudePlatformFlags.js.map +1 -0
  30. package/dist/adapters/createAdapter.d.ts +252 -0
  31. package/dist/adapters/createAdapter.d.ts.map +1 -0
  32. package/dist/adapters/createAdapter.js +475 -0
  33. package/dist/adapters/createAdapter.js.map +1 -0
  34. package/dist/adapters/openCodeAdapter.d.ts +1446 -0
  35. package/dist/adapters/openCodeAdapter.d.ts.map +1 -0
  36. package/dist/adapters/openCodeAdapter.js +4540 -0
  37. package/dist/adapters/openCodeAdapter.js.map +1 -0
  38. package/dist/adapters/sessionLaunchDefaults.d.ts +28 -0
  39. package/dist/adapters/sessionLaunchDefaults.d.ts.map +1 -0
  40. package/dist/adapters/sessionLaunchDefaults.js +15 -0
  41. package/dist/adapters/sessionLaunchDefaults.js.map +1 -0
  42. package/dist/adapters/terminalAdapter.d.ts +68 -0
  43. package/dist/adapters/terminalAdapter.d.ts.map +1 -0
  44. package/dist/adapters/terminalAdapter.js +371 -0
  45. package/dist/adapters/terminalAdapter.js.map +1 -0
  46. package/dist/agentLogin/agentLogin.d.ts +31 -0
  47. package/dist/agentLogin/agentLogin.d.ts.map +1 -0
  48. package/dist/agentLogin/agentLogin.js +493 -0
  49. package/dist/agentLogin/agentLogin.js.map +1 -0
  50. package/dist/agentTrigger.d.ts +28 -0
  51. package/dist/agentTrigger.d.ts.map +1 -0
  52. package/dist/agentTrigger.js +53 -0
  53. package/dist/agentTrigger.js.map +1 -0
  54. package/dist/apiErrorRetry.d.ts +209 -0
  55. package/dist/apiErrorRetry.d.ts.map +1 -0
  56. package/dist/apiErrorRetry.js +351 -0
  57. package/dist/apiErrorRetry.js.map +1 -0
  58. package/dist/apiRetryKick.d.ts +148 -0
  59. package/dist/apiRetryKick.d.ts.map +1 -0
  60. package/dist/apiRetryKick.js +158 -0
  61. package/dist/apiRetryKick.js.map +1 -0
  62. package/dist/bootClassifier.d.ts +46 -0
  63. package/dist/bootClassifier.d.ts.map +1 -0
  64. package/dist/bootClassifier.js +43 -0
  65. package/dist/bootClassifier.js.map +1 -0
  66. package/dist/bot.d.ts +207 -0
  67. package/dist/bot.d.ts.map +1 -0
  68. package/dist/bot.js +10611 -0
  69. package/dist/bot.js.map +1 -0
  70. package/dist/botFileStorage.d.ts +60 -0
  71. package/dist/botFileStorage.d.ts.map +1 -0
  72. package/dist/botFileStorage.js +205 -0
  73. package/dist/botFileStorage.js.map +1 -0
  74. package/dist/cli/applyDnsFix.d.ts +7 -0
  75. package/dist/cli/applyDnsFix.d.ts.map +1 -0
  76. package/dist/cli/applyDnsFix.js +46 -0
  77. package/dist/cli/applyDnsFix.js.map +1 -0
  78. package/dist/cli/bot.d.ts +27 -0
  79. package/dist/cli/bot.d.ts.map +1 -0
  80. package/dist/cli/bot.js +98 -0
  81. package/dist/cli/bot.js.map +1 -0
  82. package/dist/cli/botEntry.d.ts +3 -0
  83. package/dist/cli/botEntry.d.ts.map +1 -0
  84. package/dist/cli/botEntry.js +11 -0
  85. package/dist/cli/botEntry.js.map +1 -0
  86. package/dist/cli/connectorGuards.d.ts +31 -0
  87. package/dist/cli/connectorGuards.d.ts.map +1 -0
  88. package/dist/cli/connectorGuards.js +159 -0
  89. package/dist/cli/connectorGuards.js.map +1 -0
  90. package/dist/cli/envLoader.d.ts +34 -0
  91. package/dist/cli/envLoader.d.ts.map +1 -0
  92. package/dist/cli/envLoader.js +132 -0
  93. package/dist/cli/envLoader.js.map +1 -0
  94. package/dist/cli/hot.d.ts +82 -0
  95. package/dist/cli/hot.d.ts.map +1 -0
  96. package/dist/cli/hot.js +323 -0
  97. package/dist/cli/hot.js.map +1 -0
  98. package/dist/cli.d.ts +3 -0
  99. package/dist/cli.d.ts.map +1 -0
  100. package/dist/cli.js +130 -0
  101. package/dist/cli.js.map +1 -0
  102. package/dist/connectors/jira/adf.d.ts +72 -0
  103. package/dist/connectors/jira/adf.d.ts.map +1 -0
  104. package/dist/connectors/jira/adf.js +407 -0
  105. package/dist/connectors/jira/adf.js.map +1 -0
  106. package/dist/connectors/jira/agentBinaries.d.ts +14 -0
  107. package/dist/connectors/jira/agentBinaries.d.ts.map +1 -0
  108. package/dist/connectors/jira/agentBinaries.js +75 -0
  109. package/dist/connectors/jira/agentBinaries.js.map +1 -0
  110. package/dist/connectors/jira/answerSink.d.ts +52 -0
  111. package/dist/connectors/jira/answerSink.d.ts.map +1 -0
  112. package/dist/connectors/jira/answerSink.js +220 -0
  113. package/dist/connectors/jira/answerSink.js.map +1 -0
  114. package/dist/connectors/jira/attachmentDownload.d.ts +41 -0
  115. package/dist/connectors/jira/attachmentDownload.d.ts.map +1 -0
  116. package/dist/connectors/jira/attachmentDownload.js +92 -0
  117. package/dist/connectors/jira/attachmentDownload.js.map +1 -0
  118. package/dist/connectors/jira/attachmentTool.d.ts +43 -0
  119. package/dist/connectors/jira/attachmentTool.d.ts.map +1 -0
  120. package/dist/connectors/jira/attachmentTool.js +150 -0
  121. package/dist/connectors/jira/attachmentTool.js.map +1 -0
  122. package/dist/connectors/jira/client.d.ts +490 -0
  123. package/dist/connectors/jira/client.d.ts.map +1 -0
  124. package/dist/connectors/jira/client.js +453 -0
  125. package/dist/connectors/jira/client.js.map +1 -0
  126. package/dist/connectors/jira/config.d.ts +117 -0
  127. package/dist/connectors/jira/config.d.ts.map +1 -0
  128. package/dist/connectors/jira/config.js +350 -0
  129. package/dist/connectors/jira/config.js.map +1 -0
  130. package/dist/connectors/jira/configFile.d.ts +10 -0
  131. package/dist/connectors/jira/configFile.d.ts.map +1 -0
  132. package/dist/connectors/jira/configFile.js +50 -0
  133. package/dist/connectors/jira/configFile.js.map +1 -0
  134. package/dist/connectors/jira/connector.d.ts +68 -0
  135. package/dist/connectors/jira/connector.d.ts.map +1 -0
  136. package/dist/connectors/jira/connector.js +257 -0
  137. package/dist/connectors/jira/connector.js.map +1 -0
  138. package/dist/connectors/jira/contextLedger.d.ts +59 -0
  139. package/dist/connectors/jira/contextLedger.d.ts.map +1 -0
  140. package/dist/connectors/jira/contextLedger.js +194 -0
  141. package/dist/connectors/jira/contextLedger.js.map +1 -0
  142. package/dist/connectors/jira/contextPreamble.d.ts +18 -0
  143. package/dist/connectors/jira/contextPreamble.d.ts.map +1 -0
  144. package/dist/connectors/jira/contextPreamble.js +31 -0
  145. package/dist/connectors/jira/contextPreamble.js.map +1 -0
  146. package/dist/connectors/jira/inbound.d.ts +132 -0
  147. package/dist/connectors/jira/inbound.d.ts.map +1 -0
  148. package/dist/connectors/jira/inbound.js +316 -0
  149. package/dist/connectors/jira/inbound.js.map +1 -0
  150. package/dist/connectors/jira/issueBlocks.d.ts +51 -0
  151. package/dist/connectors/jira/issueBlocks.d.ts.map +1 -0
  152. package/dist/connectors/jira/issueBlocks.js +182 -0
  153. package/dist/connectors/jira/issueBlocks.js.map +1 -0
  154. package/dist/connectors/jira/issueContext.d.ts +25 -0
  155. package/dist/connectors/jira/issueContext.d.ts.map +1 -0
  156. package/dist/connectors/jira/issueContext.js +53 -0
  157. package/dist/connectors/jira/issueContext.js.map +1 -0
  158. package/dist/connectors/jira/issueDelta.d.ts +35 -0
  159. package/dist/connectors/jira/issueDelta.d.ts.map +1 -0
  160. package/dist/connectors/jira/issueDelta.js +50 -0
  161. package/dist/connectors/jira/issueDelta.js.map +1 -0
  162. package/dist/connectors/jira/mediaPlaceholders.d.ts +20 -0
  163. package/dist/connectors/jira/mediaPlaceholders.d.ts.map +1 -0
  164. package/dist/connectors/jira/mediaPlaceholders.js +92 -0
  165. package/dist/connectors/jira/mediaPlaceholders.js.map +1 -0
  166. package/dist/connectors/jira/outbound.d.ts +6 -0
  167. package/dist/connectors/jira/outbound.d.ts.map +1 -0
  168. package/dist/connectors/jira/outbound.js +38 -0
  169. package/dist/connectors/jira/outbound.js.map +1 -0
  170. package/dist/connectors/jira/prompt.d.ts +37 -0
  171. package/dist/connectors/jira/prompt.d.ts.map +1 -0
  172. package/dist/connectors/jira/prompt.js +99 -0
  173. package/dist/connectors/jira/prompt.js.map +1 -0
  174. package/dist/connectors/jira/promptSpill.d.ts +50 -0
  175. package/dist/connectors/jira/promptSpill.d.ts.map +1 -0
  176. package/dist/connectors/jira/promptSpill.js +157 -0
  177. package/dist/connectors/jira/promptSpill.js.map +1 -0
  178. package/dist/connectors/jira/promptText.d.ts +7 -0
  179. package/dist/connectors/jira/promptText.d.ts.map +1 -0
  180. package/dist/connectors/jira/promptText.js +26 -0
  181. package/dist/connectors/jira/promptText.js.map +1 -0
  182. package/dist/connectors/jira/sessionKeyCodec.d.ts +16 -0
  183. package/dist/connectors/jira/sessionKeyCodec.d.ts.map +1 -0
  184. package/dist/connectors/jira/sessionKeyCodec.js +101 -0
  185. package/dist/connectors/jira/sessionKeyCodec.js.map +1 -0
  186. package/dist/connectors/jira/trigger.d.ts +50 -0
  187. package/dist/connectors/jira/trigger.d.ts.map +1 -0
  188. package/dist/connectors/jira/trigger.js +93 -0
  189. package/dist/connectors/jira/trigger.js.map +1 -0
  190. package/dist/connectors/jira/triggerLog.d.ts +51 -0
  191. package/dist/connectors/jira/triggerLog.d.ts.map +1 -0
  192. package/dist/connectors/jira/triggerLog.js +78 -0
  193. package/dist/connectors/jira/triggerLog.js.map +1 -0
  194. package/dist/connectors/jira/unconfirmedPosts.d.ts +58 -0
  195. package/dist/connectors/jira/unconfirmedPosts.d.ts.map +1 -0
  196. package/dist/connectors/jira/unconfirmedPosts.js +105 -0
  197. package/dist/connectors/jira/unconfirmedPosts.js.map +1 -0
  198. package/dist/connectors/telegram/answerSink.d.ts +46 -0
  199. package/dist/connectors/telegram/answerSink.d.ts.map +1 -0
  200. package/dist/connectors/telegram/answerSink.js +71 -0
  201. package/dist/connectors/telegram/answerSink.js.map +1 -0
  202. package/dist/connectors/telegram/commands/autoContinueLimits.d.ts +31 -0
  203. package/dist/connectors/telegram/commands/autoContinueLimits.d.ts.map +1 -0
  204. package/dist/connectors/telegram/commands/autoContinueLimits.js +142 -0
  205. package/dist/connectors/telegram/commands/autoContinueLimits.js.map +1 -0
  206. package/dist/connectors/telegram/commands/botCore.d.ts +46 -0
  207. package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -0
  208. package/dist/connectors/telegram/commands/botCore.js +3 -0
  209. package/dist/connectors/telegram/commands/botCore.js.map +1 -0
  210. package/dist/connectors/telegram/commands/callbackMessage.d.ts +12 -0
  211. package/dist/connectors/telegram/commands/callbackMessage.d.ts.map +1 -0
  212. package/dist/connectors/telegram/commands/callbackMessage.js +13 -0
  213. package/dist/connectors/telegram/commands/callbackMessage.js.map +1 -0
  214. package/dist/connectors/telegram/commands/compaction.d.ts +47 -0
  215. package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -0
  216. package/dist/connectors/telegram/commands/compaction.js +868 -0
  217. package/dist/connectors/telegram/commands/compaction.js.map +1 -0
  218. package/dist/connectors/telegram/commands/displayModes.d.ts +13 -0
  219. package/dist/connectors/telegram/commands/displayModes.d.ts.map +1 -0
  220. package/dist/connectors/telegram/commands/displayModes.js +335 -0
  221. package/dist/connectors/telegram/commands/displayModes.js.map +1 -0
  222. package/dist/connectors/telegram/commands/modelProviders.d.ts +95 -0
  223. package/dist/connectors/telegram/commands/modelProviders.d.ts.map +1 -0
  224. package/dist/connectors/telegram/commands/modelProviders.js +841 -0
  225. package/dist/connectors/telegram/commands/modelProviders.js.map +1 -0
  226. package/dist/connectors/telegram/commands/reminders.d.ts +54 -0
  227. package/dist/connectors/telegram/commands/reminders.d.ts.map +1 -0
  228. package/dist/connectors/telegram/commands/reminders.js +624 -0
  229. package/dist/connectors/telegram/commands/reminders.js.map +1 -0
  230. package/dist/connectors/telegram/fileIntake.d.ts +166 -0
  231. package/dist/connectors/telegram/fileIntake.d.ts.map +1 -0
  232. package/dist/connectors/telegram/fileIntake.js +304 -0
  233. package/dist/connectors/telegram/fileIntake.js.map +1 -0
  234. package/dist/connectors/telegram/fileSendGateway.d.ts +57 -0
  235. package/dist/connectors/telegram/fileSendGateway.d.ts.map +1 -0
  236. package/dist/connectors/telegram/fileSendGateway.js +221 -0
  237. package/dist/connectors/telegram/fileSendGateway.js.map +1 -0
  238. package/dist/connectors/telegram/foreignKeyFallbacks.d.ts +52 -0
  239. package/dist/connectors/telegram/foreignKeyFallbacks.d.ts.map +1 -0
  240. package/dist/connectors/telegram/foreignKeyFallbacks.js +71 -0
  241. package/dist/connectors/telegram/foreignKeyFallbacks.js.map +1 -0
  242. package/dist/connectors/telegram/inbound.d.ts +131 -0
  243. package/dist/connectors/telegram/inbound.d.ts.map +1 -0
  244. package/dist/connectors/telegram/inbound.js +278 -0
  245. package/dist/connectors/telegram/inbound.js.map +1 -0
  246. package/dist/connectors/telegram/languagePicker.d.ts +32 -0
  247. package/dist/connectors/telegram/languagePicker.d.ts.map +1 -0
  248. package/dist/connectors/telegram/languagePicker.js +55 -0
  249. package/dist/connectors/telegram/languagePicker.js.map +1 -0
  250. package/dist/connectors/telegram/messageSplit.d.ts +62 -0
  251. package/dist/connectors/telegram/messageSplit.d.ts.map +1 -0
  252. package/dist/connectors/telegram/messageSplit.js +119 -0
  253. package/dist/connectors/telegram/messageSplit.js.map +1 -0
  254. package/dist/connectors/telegram/outbound.d.ts +62 -0
  255. package/dist/connectors/telegram/outbound.d.ts.map +1 -0
  256. package/dist/connectors/telegram/outbound.js +116 -0
  257. package/dist/connectors/telegram/outbound.js.map +1 -0
  258. package/dist/connectors/telegram/output/createOutputTransport.d.ts +34 -0
  259. package/dist/connectors/telegram/output/createOutputTransport.d.ts.map +1 -0
  260. package/dist/connectors/telegram/output/createOutputTransport.js +77 -0
  261. package/dist/connectors/telegram/output/createOutputTransport.js.map +1 -0
  262. package/dist/connectors/telegram/output/dmOutputTransport.d.ts +47 -0
  263. package/dist/connectors/telegram/output/dmOutputTransport.d.ts.map +1 -0
  264. package/dist/connectors/telegram/output/dmOutputTransport.js +412 -0
  265. package/dist/connectors/telegram/output/dmOutputTransport.js.map +1 -0
  266. package/dist/connectors/telegram/outputBacklogGlue.d.ts +38 -0
  267. package/dist/connectors/telegram/outputBacklogGlue.d.ts.map +1 -0
  268. package/dist/connectors/telegram/outputBacklogGlue.js +49 -0
  269. package/dist/connectors/telegram/outputBacklogGlue.js.map +1 -0
  270. package/dist/connectors/telegram/outputFlushPlan.d.ts +93 -0
  271. package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -0
  272. package/dist/connectors/telegram/outputFlushPlan.js +120 -0
  273. package/dist/connectors/telegram/outputFlushPlan.js.map +1 -0
  274. package/dist/connectors/telegram/questionKeyboards.d.ts +30 -0
  275. package/dist/connectors/telegram/questionKeyboards.d.ts.map +1 -0
  276. package/dist/connectors/telegram/questionKeyboards.js +37 -0
  277. package/dist/connectors/telegram/questionKeyboards.js.map +1 -0
  278. package/dist/connectors/telegram/renderAgentHtml.d.ts +27 -0
  279. package/dist/connectors/telegram/renderAgentHtml.d.ts.map +1 -0
  280. package/dist/connectors/telegram/renderAgentHtml.js +97 -0
  281. package/dist/connectors/telegram/renderAgentHtml.js.map +1 -0
  282. package/dist/connectors/telegram/sessionKeyCodec.d.ts +28 -0
  283. package/dist/connectors/telegram/sessionKeyCodec.d.ts.map +1 -0
  284. package/dist/connectors/telegram/sessionKeyCodec.js +107 -0
  285. package/dist/connectors/telegram/sessionKeyCodec.js.map +1 -0
  286. package/dist/connectors/telegram/telegramCallGuard.d.ts +19 -0
  287. package/dist/connectors/telegram/telegramCallGuard.d.ts.map +1 -0
  288. package/dist/connectors/telegram/telegramCallGuard.js +35 -0
  289. package/dist/connectors/telegram/telegramCallGuard.js.map +1 -0
  290. package/dist/connectors/telegram/timezonePicker.d.ts +85 -0
  291. package/dist/connectors/telegram/timezonePicker.d.ts.map +1 -0
  292. package/dist/connectors/telegram/timezonePicker.js +142 -0
  293. package/dist/connectors/telegram/timezonePicker.js.map +1 -0
  294. package/dist/connectors/telegram/updateDispatcher.d.ts +85 -0
  295. package/dist/connectors/telegram/updateDispatcher.d.ts.map +1 -0
  296. package/dist/connectors/telegram/updateDispatcher.js +159 -0
  297. package/dist/connectors/telegram/updateDispatcher.js.map +1 -0
  298. package/dist/connectors/test/connector.d.ts +52 -0
  299. package/dist/connectors/test/connector.d.ts.map +1 -0
  300. package/dist/connectors/test/connector.js +143 -0
  301. package/dist/connectors/test/connector.js.map +1 -0
  302. package/dist/connectors/test/sessionKeyCodec.d.ts +25 -0
  303. package/dist/connectors/test/sessionKeyCodec.d.ts.map +1 -0
  304. package/dist/connectors/test/sessionKeyCodec.js +50 -0
  305. package/dist/connectors/test/sessionKeyCodec.js.map +1 -0
  306. package/dist/diagLog.d.ts +6 -0
  307. package/dist/diagLog.d.ts.map +1 -0
  308. package/dist/diagLog.js +58 -0
  309. package/dist/diagLog.js.map +1 -0
  310. package/dist/effortLevels.d.ts +68 -0
  311. package/dist/effortLevels.d.ts.map +1 -0
  312. package/dist/effortLevels.js +114 -0
  313. package/dist/effortLevels.js.map +1 -0
  314. package/dist/folderName.d.ts +42 -0
  315. package/dist/folderName.d.ts.map +1 -0
  316. package/dist/folderName.js +51 -0
  317. package/dist/folderName.js.map +1 -0
  318. package/dist/i18n/de.d.ts +2 -0
  319. package/dist/i18n/de.d.ts.map +1 -0
  320. package/dist/i18n/de.js +537 -0
  321. package/dist/i18n/de.js.map +1 -0
  322. package/dist/i18n/en.d.ts +7 -0
  323. package/dist/i18n/en.d.ts.map +1 -0
  324. package/dist/i18n/en.js +566 -0
  325. package/dist/i18n/en.js.map +1 -0
  326. package/dist/i18n/es.d.ts +2 -0
  327. package/dist/i18n/es.d.ts.map +1 -0
  328. package/dist/i18n/es.js +537 -0
  329. package/dist/i18n/es.js.map +1 -0
  330. package/dist/i18n/fr.d.ts +2 -0
  331. package/dist/i18n/fr.d.ts.map +1 -0
  332. package/dist/i18n/fr.js +537 -0
  333. package/dist/i18n/fr.js.map +1 -0
  334. package/dist/i18n/hi.d.ts +2 -0
  335. package/dist/i18n/hi.d.ts.map +1 -0
  336. package/dist/i18n/hi.js +537 -0
  337. package/dist/i18n/hi.js.map +1 -0
  338. package/dist/i18n/ja.d.ts +2 -0
  339. package/dist/i18n/ja.d.ts.map +1 -0
  340. package/dist/i18n/ja.js +537 -0
  341. package/dist/i18n/ja.js.map +1 -0
  342. package/dist/i18n/ka.d.ts +2 -0
  343. package/dist/i18n/ka.d.ts.map +1 -0
  344. package/dist/i18n/ka.js +537 -0
  345. package/dist/i18n/ka.js.map +1 -0
  346. package/dist/i18n/pt.d.ts +2 -0
  347. package/dist/i18n/pt.d.ts.map +1 -0
  348. package/dist/i18n/pt.js +537 -0
  349. package/dist/i18n/pt.js.map +1 -0
  350. package/dist/i18n/ru.d.ts +6 -0
  351. package/dist/i18n/ru.d.ts.map +1 -0
  352. package/dist/i18n/ru.js +540 -0
  353. package/dist/i18n/ru.js.map +1 -0
  354. package/dist/i18n/uk.d.ts +8 -0
  355. package/dist/i18n/uk.d.ts.map +1 -0
  356. package/dist/i18n/uk.js +542 -0
  357. package/dist/i18n/uk.js.map +1 -0
  358. package/dist/i18n/uz.d.ts +2 -0
  359. package/dist/i18n/uz.d.ts.map +1 -0
  360. package/dist/i18n/uz.js +537 -0
  361. package/dist/i18n/uz.js.map +1 -0
  362. package/dist/i18n/zh.d.ts +2 -0
  363. package/dist/i18n/zh.d.ts.map +1 -0
  364. package/dist/i18n/zh.js +537 -0
  365. package/dist/i18n/zh.js.map +1 -0
  366. package/dist/i18n.d.ts +115 -0
  367. package/dist/i18n.d.ts.map +1 -0
  368. package/dist/i18n.js +233 -0
  369. package/dist/i18n.js.map +1 -0
  370. package/dist/index.d.ts +3 -0
  371. package/dist/index.d.ts.map +1 -0
  372. package/dist/index.js +10 -0
  373. package/dist/index.js.map +1 -0
  374. package/dist/installManager.d.ts +99 -0
  375. package/dist/installManager.d.ts.map +1 -0
  376. package/dist/installManager.js +943 -0
  377. package/dist/installManager.js.map +1 -0
  378. package/dist/instanceLock.d.ts +161 -0
  379. package/dist/instanceLock.d.ts.map +1 -0
  380. package/dist/instanceLock.js +388 -0
  381. package/dist/instanceLock.js.map +1 -0
  382. package/dist/mcpConfig.d.ts +76 -0
  383. package/dist/mcpConfig.d.ts.map +1 -0
  384. package/dist/mcpConfig.js +270 -0
  385. package/dist/mcpConfig.js.map +1 -0
  386. package/dist/openCodeOpenQuestion.d.ts +44 -0
  387. package/dist/openCodeOpenQuestion.d.ts.map +1 -0
  388. package/dist/openCodeOpenQuestion.js +64 -0
  389. package/dist/openCodeOpenQuestion.js.map +1 -0
  390. package/dist/openCodeQuestionFlow.d.ts +105 -0
  391. package/dist/openCodeQuestionFlow.d.ts.map +1 -0
  392. package/dist/openCodeQuestionFlow.js +143 -0
  393. package/dist/openCodeQuestionFlow.js.map +1 -0
  394. package/dist/openCodeSessionRouting.d.ts +133 -0
  395. package/dist/openCodeSessionRouting.d.ts.map +1 -0
  396. package/dist/openCodeSessionRouting.js +253 -0
  397. package/dist/openCodeSessionRouting.js.map +1 -0
  398. package/dist/openCodeSessionTitle.d.ts +50 -0
  399. package/dist/openCodeSessionTitle.d.ts.map +1 -0
  400. package/dist/openCodeSessionTitle.js +84 -0
  401. package/dist/openCodeSessionTitle.js.map +1 -0
  402. package/dist/outputTrace.d.ts +108 -0
  403. package/dist/outputTrace.d.ts.map +1 -0
  404. package/dist/outputTrace.js +430 -0
  405. package/dist/outputTrace.js.map +1 -0
  406. package/dist/pendingQuestionRepost.d.ts +47 -0
  407. package/dist/pendingQuestionRepost.d.ts.map +1 -0
  408. package/dist/pendingQuestionRepost.js +29 -0
  409. package/dist/pendingQuestionRepost.js.map +1 -0
  410. package/dist/pinnedStatus.d.ts +52 -0
  411. package/dist/pinnedStatus.d.ts.map +1 -0
  412. package/dist/pinnedStatus.js +36 -0
  413. package/dist/pinnedStatus.js.map +1 -0
  414. package/dist/platform/answerSink.d.ts +93 -0
  415. package/dist/platform/answerSink.d.ts.map +1 -0
  416. package/dist/platform/answerSink.js +31 -0
  417. package/dist/platform/answerSink.js.map +1 -0
  418. package/dist/platform/capabilityFallback.d.ts +39 -0
  419. package/dist/platform/capabilityFallback.d.ts.map +1 -0
  420. package/dist/platform/capabilityFallback.js +55 -0
  421. package/dist/platform/capabilityFallback.js.map +1 -0
  422. package/dist/platform/commandRouter.d.ts +51 -0
  423. package/dist/platform/commandRouter.d.ts.map +1 -0
  424. package/dist/platform/commandRouter.js +53 -0
  425. package/dist/platform/commandRouter.js.map +1 -0
  426. package/dist/platform/connectorSet.d.ts +39 -0
  427. package/dist/platform/connectorSet.d.ts.map +1 -0
  428. package/dist/platform/connectorSet.js +55 -0
  429. package/dist/platform/connectorSet.js.map +1 -0
  430. package/dist/platform/inbound.d.ts +147 -0
  431. package/dist/platform/inbound.d.ts.map +1 -0
  432. package/dist/platform/inbound.js +18 -0
  433. package/dist/platform/inbound.js.map +1 -0
  434. package/dist/platform/outbound.d.ts +225 -0
  435. package/dist/platform/outbound.d.ts.map +1 -0
  436. package/dist/platform/outbound.js +30 -0
  437. package/dist/platform/outbound.js.map +1 -0
  438. package/dist/platform/unservedStateGuard.d.ts +27 -0
  439. package/dist/platform/unservedStateGuard.d.ts.map +1 -0
  440. package/dist/platform/unservedStateGuard.js +42 -0
  441. package/dist/platform/unservedStateGuard.js.map +1 -0
  442. package/dist/postToSession.d.ts +94 -0
  443. package/dist/postToSession.d.ts.map +1 -0
  444. package/dist/postToSession.js +56 -0
  445. package/dist/postToSession.js.map +1 -0
  446. package/dist/progressLine.d.ts +180 -0
  447. package/dist/progressLine.d.ts.map +1 -0
  448. package/dist/progressLine.js +293 -0
  449. package/dist/progressLine.js.map +1 -0
  450. package/dist/rateLimiter.d.ts +246 -0
  451. package/dist/rateLimiter.d.ts.map +1 -0
  452. package/dist/rateLimiter.js +555 -0
  453. package/dist/rateLimiter.js.map +1 -0
  454. package/dist/requests/answerRequest.d.ts +57 -0
  455. package/dist/requests/answerRequest.d.ts.map +1 -0
  456. package/dist/requests/answerRequest.js +96 -0
  457. package/dist/requests/answerRequest.js.map +1 -0
  458. package/dist/requests/answerTail.d.ts +83 -0
  459. package/dist/requests/answerTail.d.ts.map +1 -0
  460. package/dist/requests/answerTail.js +102 -0
  461. package/dist/requests/answerTail.js.map +1 -0
  462. package/dist/requests/limitWaitAnswer.d.ts +87 -0
  463. package/dist/requests/limitWaitAnswer.d.ts.map +1 -0
  464. package/dist/requests/limitWaitAnswer.js +83 -0
  465. package/dist/requests/limitWaitAnswer.js.map +1 -0
  466. package/dist/requests/requestGroup.d.ts +44 -0
  467. package/dist/requests/requestGroup.d.ts.map +1 -0
  468. package/dist/requests/requestGroup.js +63 -0
  469. package/dist/requests/requestGroup.js.map +1 -0
  470. package/dist/requests/requestHeader.d.ts +70 -0
  471. package/dist/requests/requestHeader.d.ts.map +1 -0
  472. package/dist/requests/requestHeader.js +83 -0
  473. package/dist/requests/requestHeader.js.map +1 -0
  474. package/dist/requests/requestLedger.d.ts +217 -0
  475. package/dist/requests/requestLedger.d.ts.map +1 -0
  476. package/dist/requests/requestLedger.js +468 -0
  477. package/dist/requests/requestLedger.js.map +1 -0
  478. package/dist/requests/sessionTurnProbe.d.ts +52 -0
  479. package/dist/requests/sessionTurnProbe.d.ts.map +1 -0
  480. package/dist/requests/sessionTurnProbe.js +29 -0
  481. package/dist/requests/sessionTurnProbe.js.map +1 -0
  482. package/dist/requests/types.d.ts +181 -0
  483. package/dist/requests/types.d.ts.map +1 -0
  484. package/dist/requests/types.js +9 -0
  485. package/dist/requests/types.js.map +1 -0
  486. package/dist/requests/wakeUpEngine.d.ts +160 -0
  487. package/dist/requests/wakeUpEngine.d.ts.map +1 -0
  488. package/dist/requests/wakeUpEngine.js +399 -0
  489. package/dist/requests/wakeUpEngine.js.map +1 -0
  490. package/dist/requests/wakeUpRules.d.ts +151 -0
  491. package/dist/requests/wakeUpRules.d.ts.map +1 -0
  492. package/dist/requests/wakeUpRules.js +167 -0
  493. package/dist/requests/wakeUpRules.js.map +1 -0
  494. package/dist/resumeContext.d.ts +87 -0
  495. package/dist/resumeContext.d.ts.map +1 -0
  496. package/dist/resumeContext.js +114 -0
  497. package/dist/resumeContext.js.map +1 -0
  498. package/dist/scheduler/checkRun.d.ts +95 -0
  499. package/dist/scheduler/checkRun.d.ts.map +1 -0
  500. package/dist/scheduler/checkRun.js +172 -0
  501. package/dist/scheduler/checkRun.js.map +1 -0
  502. package/dist/scheduler/delivery.d.ts +99 -0
  503. package/dist/scheduler/delivery.d.ts.map +1 -0
  504. package/dist/scheduler/delivery.js +212 -0
  505. package/dist/scheduler/delivery.js.map +1 -0
  506. package/dist/scheduler/deliveryKind.d.ts +29 -0
  507. package/dist/scheduler/deliveryKind.d.ts.map +1 -0
  508. package/dist/scheduler/deliveryKind.js +39 -0
  509. package/dist/scheduler/deliveryKind.js.map +1 -0
  510. package/dist/scheduler/directoryThreads.d.ts +19 -0
  511. package/dist/scheduler/directoryThreads.d.ts.map +1 -0
  512. package/dist/scheduler/directoryThreads.js +28 -0
  513. package/dist/scheduler/directoryThreads.js.map +1 -0
  514. package/dist/scheduler/engine.d.ts +77 -0
  515. package/dist/scheduler/engine.d.ts.map +1 -0
  516. package/dist/scheduler/engine.js +337 -0
  517. package/dist/scheduler/engine.js.map +1 -0
  518. package/dist/scheduler/injection.d.ts +102 -0
  519. package/dist/scheduler/injection.d.ts.map +1 -0
  520. package/dist/scheduler/injection.js +122 -0
  521. package/dist/scheduler/injection.js.map +1 -0
  522. package/dist/scheduler/mcpBoot.d.ts +65 -0
  523. package/dist/scheduler/mcpBoot.d.ts.map +1 -0
  524. package/dist/scheduler/mcpBoot.js +60 -0
  525. package/dist/scheduler/mcpBoot.js.map +1 -0
  526. package/dist/scheduler/mcpSurface.d.ts +355 -0
  527. package/dist/scheduler/mcpSurface.d.ts.map +1 -0
  528. package/dist/scheduler/mcpSurface.js +1257 -0
  529. package/dist/scheduler/mcpSurface.js.map +1 -0
  530. package/dist/scheduler/rebindResume.d.ts +27 -0
  531. package/dist/scheduler/rebindResume.d.ts.map +1 -0
  532. package/dist/scheduler/rebindResume.js +17 -0
  533. package/dist/scheduler/rebindResume.js.map +1 -0
  534. package/dist/scheduler/recurrence.d.ts +58 -0
  535. package/dist/scheduler/recurrence.d.ts.map +1 -0
  536. package/dist/scheduler/recurrence.js +210 -0
  537. package/dist/scheduler/recurrence.js.map +1 -0
  538. package/dist/scheduler/runLedger.d.ts +59 -0
  539. package/dist/scheduler/runLedger.d.ts.map +1 -0
  540. package/dist/scheduler/runLedger.js +54 -0
  541. package/dist/scheduler/runLedger.js.map +1 -0
  542. package/dist/scheduler/store.d.ts +97 -0
  543. package/dist/scheduler/store.d.ts.map +1 -0
  544. package/dist/scheduler/store.js +124 -0
  545. package/dist/scheduler/store.js.map +1 -0
  546. package/dist/scheduler/timezoneRecompute.d.ts +61 -0
  547. package/dist/scheduler/timezoneRecompute.d.ts.map +1 -0
  548. package/dist/scheduler/timezoneRecompute.js +46 -0
  549. package/dist/scheduler/timezoneRecompute.js.map +1 -0
  550. package/dist/scheduler/types.d.ts +139 -0
  551. package/dist/scheduler/types.d.ts.map +1 -0
  552. package/dist/scheduler/types.js +8 -0
  553. package/dist/scheduler/types.js.map +1 -0
  554. package/dist/sendErrorClassifier.d.ts +45 -0
  555. package/dist/sendErrorClassifier.d.ts.map +1 -0
  556. package/dist/sendErrorClassifier.js +65 -0
  557. package/dist/sendErrorClassifier.js.map +1 -0
  558. package/dist/sessionKey.d.ts +136 -0
  559. package/dist/sessionKey.d.ts.map +1 -0
  560. package/dist/sessionKey.js +153 -0
  561. package/dist/sessionKey.js.map +1 -0
  562. package/dist/sessionPick.d.ts +42 -0
  563. package/dist/sessionPick.d.ts.map +1 -0
  564. package/dist/sessionPick.js +39 -0
  565. package/dist/sessionPick.js.map +1 -0
  566. package/dist/shutdown.d.ts +126 -0
  567. package/dist/shutdown.d.ts.map +1 -0
  568. package/dist/shutdown.js +164 -0
  569. package/dist/shutdown.js.map +1 -0
  570. package/dist/startupPromptBuffer.d.ts +85 -0
  571. package/dist/startupPromptBuffer.d.ts.map +1 -0
  572. package/dist/startupPromptBuffer.js +123 -0
  573. package/dist/startupPromptBuffer.js.map +1 -0
  574. package/dist/state.d.ts +1245 -0
  575. package/dist/state.d.ts.map +1 -0
  576. package/dist/state.js +1830 -0
  577. package/dist/state.js.map +1 -0
  578. package/dist/threadContextPreamble.d.ts +89 -0
  579. package/dist/threadContextPreamble.d.ts.map +1 -0
  580. package/dist/threadContextPreamble.js +102 -0
  581. package/dist/threadContextPreamble.js.map +1 -0
  582. package/dist/threadRouting.d.ts +164 -0
  583. package/dist/threadRouting.d.ts.map +1 -0
  584. package/dist/threadRouting.js +182 -0
  585. package/dist/threadRouting.js.map +1 -0
  586. package/dist/types.d.ts +1015 -0
  587. package/dist/types.d.ts.map +1 -0
  588. package/dist/types.js +3 -0
  589. package/dist/types.js.map +1 -0
  590. package/dist/utils/abortableFifo.d.ts +10 -0
  591. package/dist/utils/abortableFifo.d.ts.map +1 -0
  592. package/dist/utils/abortableFifo.js +55 -0
  593. package/dist/utils/abortableFifo.js.map +1 -0
  594. package/dist/utils/adoptedToolList.d.ts +27 -0
  595. package/dist/utils/adoptedToolList.d.ts.map +1 -0
  596. package/dist/utils/adoptedToolList.js +22 -0
  597. package/dist/utils/adoptedToolList.js.map +1 -0
  598. package/dist/utils/agentEnvironment.d.ts +42 -0
  599. package/dist/utils/agentEnvironment.d.ts.map +1 -0
  600. package/dist/utils/agentEnvironment.js +122 -0
  601. package/dist/utils/agentEnvironment.js.map +1 -0
  602. package/dist/utils/ansiClean.d.ts +11 -0
  603. package/dist/utils/ansiClean.d.ts.map +1 -0
  604. package/dist/utils/ansiClean.js +139 -0
  605. package/dist/utils/ansiClean.js.map +1 -0
  606. package/dist/utils/autoContinueOnLimit.d.ts +49 -0
  607. package/dist/utils/autoContinueOnLimit.d.ts.map +1 -0
  608. package/dist/utils/autoContinueOnLimit.js +69 -0
  609. package/dist/utils/autoContinueOnLimit.js.map +1 -0
  610. package/dist/utils/canonicalPathContainment.d.ts +7 -0
  611. package/dist/utils/canonicalPathContainment.d.ts.map +1 -0
  612. package/dist/utils/canonicalPathContainment.js +48 -0
  613. package/dist/utils/canonicalPathContainment.js.map +1 -0
  614. package/dist/utils/claudeAuthLogin.d.ts +71 -0
  615. package/dist/utils/claudeAuthLogin.d.ts.map +1 -0
  616. package/dist/utils/claudeAuthLogin.js +93 -0
  617. package/dist/utils/claudeAuthLogin.js.map +1 -0
  618. package/dist/utils/claudeChunkClassifier.d.ts +97 -0
  619. package/dist/utils/claudeChunkClassifier.d.ts.map +1 -0
  620. package/dist/utils/claudeChunkClassifier.js +254 -0
  621. package/dist/utils/claudeChunkClassifier.js.map +1 -0
  622. package/dist/utils/claudeCodeVersion.d.ts +31 -0
  623. package/dist/utils/claudeCodeVersion.d.ts.map +1 -0
  624. package/dist/utils/claudeCodeVersion.js +62 -0
  625. package/dist/utils/claudeCodeVersion.js.map +1 -0
  626. package/dist/utils/claudeCompactHook.d.ts +64 -0
  627. package/dist/utils/claudeCompactHook.d.ts.map +1 -0
  628. package/dist/utils/claudeCompactHook.js +98 -0
  629. package/dist/utils/claudeCompactHook.js.map +1 -0
  630. package/dist/utils/claudeLivenessAction.d.ts +208 -0
  631. package/dist/utils/claudeLivenessAction.d.ts.map +1 -0
  632. package/dist/utils/claudeLivenessAction.js +135 -0
  633. package/dist/utils/claudeLivenessAction.js.map +1 -0
  634. package/dist/utils/claudeMcpHeal.d.ts +92 -0
  635. package/dist/utils/claudeMcpHeal.d.ts.map +1 -0
  636. package/dist/utils/claudeMcpHeal.js +91 -0
  637. package/dist/utils/claudeMcpHeal.js.map +1 -0
  638. package/dist/utils/claudeRelayRouting.d.ts +86 -0
  639. package/dist/utils/claudeRelayRouting.d.ts.map +1 -0
  640. package/dist/utils/claudeRelayRouting.js +159 -0
  641. package/dist/utils/claudeRelayRouting.js.map +1 -0
  642. package/dist/utils/claudeRuntimeInfo.d.ts +26 -0
  643. package/dist/utils/claudeRuntimeInfo.d.ts.map +1 -0
  644. package/dist/utils/claudeRuntimeInfo.js +151 -0
  645. package/dist/utils/claudeRuntimeInfo.js.map +1 -0
  646. package/dist/utils/claudeScrapeShapes.d.ts +256 -0
  647. package/dist/utils/claudeScrapeShapes.d.ts.map +1 -0
  648. package/dist/utils/claudeScrapeShapes.js +290 -0
  649. package/dist/utils/claudeScrapeShapes.js.map +1 -0
  650. package/dist/utils/claudeSessionTitle.d.ts +27 -0
  651. package/dist/utils/claudeSessionTitle.d.ts.map +1 -0
  652. package/dist/utils/claudeSessionTitle.js +90 -0
  653. package/dist/utils/claudeSessionTitle.js.map +1 -0
  654. package/dist/utils/claudeStreamJson.d.ts +202 -0
  655. package/dist/utils/claudeStreamJson.d.ts.map +1 -0
  656. package/dist/utils/claudeStreamJson.js +351 -0
  657. package/dist/utils/claudeStreamJson.js.map +1 -0
  658. package/dist/utils/claudeSubagentTail.d.ts +93 -0
  659. package/dist/utils/claudeSubagentTail.d.ts.map +1 -0
  660. package/dist/utils/claudeSubagentTail.js +136 -0
  661. package/dist/utils/claudeSubagentTail.js.map +1 -0
  662. package/dist/utils/clearThreadOutputQueues.d.ts +43 -0
  663. package/dist/utils/clearThreadOutputQueues.d.ts.map +1 -0
  664. package/dist/utils/clearThreadOutputQueues.js +39 -0
  665. package/dist/utils/clearThreadOutputQueues.js.map +1 -0
  666. package/dist/utils/compactCommandRoute.d.ts +45 -0
  667. package/dist/utils/compactCommandRoute.d.ts.map +1 -0
  668. package/dist/utils/compactCommandRoute.js +36 -0
  669. package/dist/utils/compactCommandRoute.js.map +1 -0
  670. package/dist/utils/compactOnIdle.d.ts +329 -0
  671. package/dist/utils/compactOnIdle.d.ts.map +1 -0
  672. package/dist/utils/compactOnIdle.js +379 -0
  673. package/dist/utils/compactOnIdle.js.map +1 -0
  674. package/dist/utils/consoleFileTap.d.ts +51 -0
  675. package/dist/utils/consoleFileTap.d.ts.map +1 -0
  676. package/dist/utils/consoleFileTap.js +86 -0
  677. package/dist/utils/consoleFileTap.js.map +1 -0
  678. package/dist/utils/displayVerbosity.d.ts +44 -0
  679. package/dist/utils/displayVerbosity.d.ts.map +1 -0
  680. package/dist/utils/displayVerbosity.js +75 -0
  681. package/dist/utils/displayVerbosity.js.map +1 -0
  682. package/dist/utils/download.d.ts +72 -0
  683. package/dist/utils/download.d.ts.map +1 -0
  684. package/dist/utils/download.js +216 -0
  685. package/dist/utils/download.js.map +1 -0
  686. package/dist/utils/draftFinalize.d.ts +110 -0
  687. package/dist/utils/draftFinalize.d.ts.map +1 -0
  688. package/dist/utils/draftFinalize.js +100 -0
  689. package/dist/utils/draftFinalize.js.map +1 -0
  690. package/dist/utils/draftId.d.ts +36 -0
  691. package/dist/utils/draftId.d.ts.map +1 -0
  692. package/dist/utils/draftId.js +46 -0
  693. package/dist/utils/draftId.js.map +1 -0
  694. package/dist/utils/draftPacer.d.ts +72 -0
  695. package/dist/utils/draftPacer.d.ts.map +1 -0
  696. package/dist/utils/draftPacer.js +53 -0
  697. package/dist/utils/draftPacer.js.map +1 -0
  698. package/dist/utils/effortStartupKeystroke.d.ts +20 -0
  699. package/dist/utils/effortStartupKeystroke.d.ts.map +1 -0
  700. package/dist/utils/effortStartupKeystroke.js +28 -0
  701. package/dist/utils/effortStartupKeystroke.js.map +1 -0
  702. package/dist/utils/ensureSessionPlan.d.ts +70 -0
  703. package/dist/utils/ensureSessionPlan.d.ts.map +1 -0
  704. package/dist/utils/ensureSessionPlan.js +54 -0
  705. package/dist/utils/ensureSessionPlan.js.map +1 -0
  706. package/dist/utils/fileSendPlan.d.ts +217 -0
  707. package/dist/utils/fileSendPlan.d.ts.map +1 -0
  708. package/dist/utils/fileSendPlan.js +291 -0
  709. package/dist/utils/fileSendPlan.js.map +1 -0
  710. package/dist/utils/fileSendService.d.ts +94 -0
  711. package/dist/utils/fileSendService.d.ts.map +1 -0
  712. package/dist/utils/fileSendService.js +387 -0
  713. package/dist/utils/fileSendService.js.map +1 -0
  714. package/dist/utils/groupFinalizePlan.d.ts +38 -0
  715. package/dist/utils/groupFinalizePlan.d.ts.map +1 -0
  716. package/dist/utils/groupFinalizePlan.js +35 -0
  717. package/dist/utils/groupFinalizePlan.js.map +1 -0
  718. package/dist/utils/identicalOutputGuard.d.ts +83 -0
  719. package/dist/utils/identicalOutputGuard.d.ts.map +1 -0
  720. package/dist/utils/identicalOutputGuard.js +99 -0
  721. package/dist/utils/identicalOutputGuard.js.map +1 -0
  722. package/dist/utils/isoTimestamp.d.ts +16 -0
  723. package/dist/utils/isoTimestamp.d.ts.map +1 -0
  724. package/dist/utils/isoTimestamp.js +34 -0
  725. package/dist/utils/isoTimestamp.js.map +1 -0
  726. package/dist/utils/jsonStreamBusyWatchdog.d.ts +130 -0
  727. package/dist/utils/jsonStreamBusyWatchdog.d.ts.map +1 -0
  728. package/dist/utils/jsonStreamBusyWatchdog.js +122 -0
  729. package/dist/utils/jsonStreamBusyWatchdog.js.map +1 -0
  730. package/dist/utils/jsonStreamHost.d.ts +227 -0
  731. package/dist/utils/jsonStreamHost.d.ts.map +1 -0
  732. package/dist/utils/jsonStreamHost.js +417 -0
  733. package/dist/utils/jsonStreamHost.js.map +1 -0
  734. package/dist/utils/keyedTransitionQueue.d.ts +18 -0
  735. package/dist/utils/keyedTransitionQueue.d.ts.map +1 -0
  736. package/dist/utils/keyedTransitionQueue.js +34 -0
  737. package/dist/utils/keyedTransitionQueue.js.map +1 -0
  738. package/dist/utils/limitEpisodeRecovery.d.ts +92 -0
  739. package/dist/utils/limitEpisodeRecovery.d.ts.map +1 -0
  740. package/dist/utils/limitEpisodeRecovery.js +133 -0
  741. package/dist/utils/limitEpisodeRecovery.js.map +1 -0
  742. package/dist/utils/limitHeldPromptQueue.d.ts +48 -0
  743. package/dist/utils/limitHeldPromptQueue.d.ts.map +1 -0
  744. package/dist/utils/limitHeldPromptQueue.js +59 -0
  745. package/dist/utils/limitHeldPromptQueue.js.map +1 -0
  746. package/dist/utils/limitHeldPrompts.d.ts +58 -0
  747. package/dist/utils/limitHeldPrompts.d.ts.map +1 -0
  748. package/dist/utils/limitHeldPrompts.js +65 -0
  749. package/dist/utils/limitHeldPrompts.js.map +1 -0
  750. package/dist/utils/linkPreviewSuppression.d.ts +18 -0
  751. package/dist/utils/linkPreviewSuppression.d.ts.map +1 -0
  752. package/dist/utils/linkPreviewSuppression.js +37 -0
  753. package/dist/utils/linkPreviewSuppression.js.map +1 -0
  754. package/dist/utils/localClock.d.ts +15 -0
  755. package/dist/utils/localClock.d.ts.map +1 -0
  756. package/dist/utils/localClock.js +29 -0
  757. package/dist/utils/localClock.js.map +1 -0
  758. package/dist/utils/markdownTableRender.d.ts +83 -0
  759. package/dist/utils/markdownTableRender.d.ts.map +1 -0
  760. package/dist/utils/markdownTableRender.js +298 -0
  761. package/dist/utils/markdownTableRender.js.map +1 -0
  762. package/dist/utils/mediaGroupCollector.d.ts +51 -0
  763. package/dist/utils/mediaGroupCollector.d.ts.map +1 -0
  764. package/dist/utils/mediaGroupCollector.js +90 -0
  765. package/dist/utils/mediaGroupCollector.js.map +1 -0
  766. package/dist/utils/messageSendService.d.ts +136 -0
  767. package/dist/utils/messageSendService.d.ts.map +1 -0
  768. package/dist/utils/messageSendService.js +165 -0
  769. package/dist/utils/messageSendService.js.map +1 -0
  770. package/dist/utils/minutesOverride.d.ts +7 -0
  771. package/dist/utils/minutesOverride.d.ts.map +1 -0
  772. package/dist/utils/minutesOverride.js +16 -0
  773. package/dist/utils/minutesOverride.js.map +1 -0
  774. package/dist/utils/modelPickerPlan.d.ts +119 -0
  775. package/dist/utils/modelPickerPlan.d.ts.map +1 -0
  776. package/dist/utils/modelPickerPlan.js +171 -0
  777. package/dist/utils/modelPickerPlan.js.map +1 -0
  778. package/dist/utils/modelSetReplyDecision.d.ts +67 -0
  779. package/dist/utils/modelSetReplyDecision.d.ts.map +1 -0
  780. package/dist/utils/modelSetReplyDecision.js +27 -0
  781. package/dist/utils/modelSetReplyDecision.js.map +1 -0
  782. package/dist/utils/openCodeAuthLogin.d.ts +181 -0
  783. package/dist/utils/openCodeAuthLogin.d.ts.map +1 -0
  784. package/dist/utils/openCodeAuthLogin.js +393 -0
  785. package/dist/utils/openCodeAuthLogin.js.map +1 -0
  786. package/dist/utils/openCodeCompactPlugin.d.ts +81 -0
  787. package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -0
  788. package/dist/utils/openCodeCompactPlugin.js +146 -0
  789. package/dist/utils/openCodeCompactPlugin.js.map +1 -0
  790. package/dist/utils/openCodeTurnActivity.d.ts +67 -0
  791. package/dist/utils/openCodeTurnActivity.d.ts.map +1 -0
  792. package/dist/utils/openCodeTurnActivity.js +27 -0
  793. package/dist/utils/openCodeTurnActivity.js.map +1 -0
  794. package/dist/utils/outputDebounce.d.ts +24 -0
  795. package/dist/utils/outputDebounce.d.ts.map +1 -0
  796. package/dist/utils/outputDebounce.js +30 -0
  797. package/dist/utils/outputDebounce.js.map +1 -0
  798. package/dist/utils/outputFlushTiming.d.ts +54 -0
  799. package/dist/utils/outputFlushTiming.d.ts.map +1 -0
  800. package/dist/utils/outputFlushTiming.js +48 -0
  801. package/dist/utils/outputFlushTiming.js.map +1 -0
  802. package/dist/utils/paginateList.d.ts +25 -0
  803. package/dist/utils/paginateList.d.ts.map +1 -0
  804. package/dist/utils/paginateList.js +32 -0
  805. package/dist/utils/paginateList.js.map +1 -0
  806. package/dist/utils/paneDiff.d.ts +55 -0
  807. package/dist/utils/paneDiff.d.ts.map +1 -0
  808. package/dist/utils/paneDiff.js +88 -0
  809. package/dist/utils/paneDiff.js.map +1 -0
  810. package/dist/utils/paneResizeGuard.d.ts +69 -0
  811. package/dist/utils/paneResizeGuard.d.ts.map +1 -0
  812. package/dist/utils/paneResizeGuard.js +91 -0
  813. package/dist/utils/paneResizeGuard.js.map +1 -0
  814. package/dist/utils/persistAdapterSessionIds.d.ts +39 -0
  815. package/dist/utils/persistAdapterSessionIds.d.ts.map +1 -0
  816. package/dist/utils/persistAdapterSessionIds.js +28 -0
  817. package/dist/utils/persistAdapterSessionIds.js.map +1 -0
  818. package/dist/utils/pinnedBannerSkipDecision.d.ts +44 -0
  819. package/dist/utils/pinnedBannerSkipDecision.d.ts.map +1 -0
  820. package/dist/utils/pinnedBannerSkipDecision.js +20 -0
  821. package/dist/utils/pinnedBannerSkipDecision.js.map +1 -0
  822. package/dist/utils/pollBackoff.d.ts +45 -0
  823. package/dist/utils/pollBackoff.d.ts.map +1 -0
  824. package/dist/utils/pollBackoff.js +44 -0
  825. package/dist/utils/pollBackoff.js.map +1 -0
  826. package/dist/utils/promptDelivery.d.ts +46 -0
  827. package/dist/utils/promptDelivery.d.ts.map +1 -0
  828. package/dist/utils/promptDelivery.js +49 -0
  829. package/dist/utils/promptDelivery.js.map +1 -0
  830. package/dist/utils/providerDisconnectPlan.d.ts +82 -0
  831. package/dist/utils/providerDisconnectPlan.d.ts.map +1 -0
  832. package/dist/utils/providerDisconnectPlan.js +110 -0
  833. package/dist/utils/providerDisconnectPlan.js.map +1 -0
  834. package/dist/utils/rateLimitLog.d.ts +48 -0
  835. package/dist/utils/rateLimitLog.d.ts.map +1 -0
  836. package/dist/utils/rateLimitLog.js +43 -0
  837. package/dist/utils/rateLimitLog.js.map +1 -0
  838. package/dist/utils/recentRelayWindow.d.ts +165 -0
  839. package/dist/utils/recentRelayWindow.d.ts.map +1 -0
  840. package/dist/utils/recentRelayWindow.js +284 -0
  841. package/dist/utils/recentRelayWindow.js.map +1 -0
  842. package/dist/utils/recvPreviewRedaction.d.ts +23 -0
  843. package/dist/utils/recvPreviewRedaction.d.ts.map +1 -0
  844. package/dist/utils/recvPreviewRedaction.js +39 -0
  845. package/dist/utils/recvPreviewRedaction.js.map +1 -0
  846. package/dist/utils/reminderFlow.d.ts +148 -0
  847. package/dist/utils/reminderFlow.d.ts.map +1 -0
  848. package/dist/utils/reminderFlow.js +122 -0
  849. package/dist/utils/reminderFlow.js.map +1 -0
  850. package/dist/utils/reminderScheduleText.d.ts +87 -0
  851. package/dist/utils/reminderScheduleText.d.ts.map +1 -0
  852. package/dist/utils/reminderScheduleText.js +135 -0
  853. package/dist/utils/reminderScheduleText.js.map +1 -0
  854. package/dist/utils/reminderWizard.d.ts +710 -0
  855. package/dist/utils/reminderWizard.d.ts.map +1 -0
  856. package/dist/utils/reminderWizard.js +1164 -0
  857. package/dist/utils/reminderWizard.js.map +1 -0
  858. package/dist/utils/replyQuote.d.ts +111 -0
  859. package/dist/utils/replyQuote.d.ts.map +1 -0
  860. package/dist/utils/replyQuote.js +122 -0
  861. package/dist/utils/replyQuote.js.map +1 -0
  862. package/dist/utils/resolveBinary.d.ts +25 -0
  863. package/dist/utils/resolveBinary.d.ts.map +1 -0
  864. package/dist/utils/resolveBinary.js +99 -0
  865. package/dist/utils/resolveBinary.js.map +1 -0
  866. package/dist/utils/retryAfterHeader.d.ts +7 -0
  867. package/dist/utils/retryAfterHeader.d.ts.map +1 -0
  868. package/dist/utils/retryAfterHeader.js +17 -0
  869. package/dist/utils/retryAfterHeader.js.map +1 -0
  870. package/dist/utils/rotatingJsonlFile.d.ts +40 -0
  871. package/dist/utils/rotatingJsonlFile.d.ts.map +1 -0
  872. package/dist/utils/rotatingJsonlFile.js +106 -0
  873. package/dist/utils/rotatingJsonlFile.js.map +1 -0
  874. package/dist/utils/rotatingLogFile.d.ts +25 -0
  875. package/dist/utils/rotatingLogFile.d.ts.map +1 -0
  876. package/dist/utils/rotatingLogFile.js +74 -0
  877. package/dist/utils/rotatingLogFile.js.map +1 -0
  878. package/dist/utils/sendRateTracker.d.ts +59 -0
  879. package/dist/utils/sendRateTracker.d.ts.map +1 -0
  880. package/dist/utils/sendRateTracker.js +144 -0
  881. package/dist/utils/sendRateTracker.js.map +1 -0
  882. package/dist/utils/serialQueue.d.ts +5 -0
  883. package/dist/utils/serialQueue.d.ts.map +1 -0
  884. package/dist/utils/serialQueue.js +14 -0
  885. package/dist/utils/serialQueue.js.map +1 -0
  886. package/dist/utils/sseStreamLifecycle.d.ts +32 -0
  887. package/dist/utils/sseStreamLifecycle.d.ts.map +1 -0
  888. package/dist/utils/sseStreamLifecycle.js +41 -0
  889. package/dist/utils/sseStreamLifecycle.js.map +1 -0
  890. package/dist/utils/startupReadiness.d.ts +119 -0
  891. package/dist/utils/startupReadiness.d.ts.map +1 -0
  892. package/dist/utils/startupReadiness.js +148 -0
  893. package/dist/utils/startupReadiness.js.map +1 -0
  894. package/dist/utils/statusFlushDecision.d.ts +18 -0
  895. package/dist/utils/statusFlushDecision.d.ts.map +1 -0
  896. package/dist/utils/statusFlushDecision.js +53 -0
  897. package/dist/utils/statusFlushDecision.js.map +1 -0
  898. package/dist/utils/subagentRender.d.ts +52 -0
  899. package/dist/utils/subagentRender.d.ts.map +1 -0
  900. package/dist/utils/subagentRender.js +66 -0
  901. package/dist/utils/subagentRender.js.map +1 -0
  902. package/dist/utils/subagentStatusRender.d.ts +90 -0
  903. package/dist/utils/subagentStatusRender.d.ts.map +1 -0
  904. package/dist/utils/subagentStatusRender.js +124 -0
  905. package/dist/utils/subagentStatusRender.js.map +1 -0
  906. package/dist/utils/telegramError.d.ts +2 -0
  907. package/dist/utils/telegramError.d.ts.map +1 -0
  908. package/dist/utils/telegramError.js +16 -0
  909. package/dist/utils/telegramError.js.map +1 -0
  910. package/dist/utils/terminalEmitPlan.d.ts +74 -0
  911. package/dist/utils/terminalEmitPlan.d.ts.map +1 -0
  912. package/dist/utils/terminalEmitPlan.js +86 -0
  913. package/dist/utils/terminalEmitPlan.js.map +1 -0
  914. package/dist/utils/thinkingRender.d.ts +74 -0
  915. package/dist/utils/thinkingRender.d.ts.map +1 -0
  916. package/dist/utils/thinkingRender.js +85 -0
  917. package/dist/utils/thinkingRender.js.map +1 -0
  918. package/dist/utils/threadStatusReport.d.ts +55 -0
  919. package/dist/utils/threadStatusReport.d.ts.map +1 -0
  920. package/dist/utils/threadStatusReport.js +65 -0
  921. package/dist/utils/threadStatusReport.js.map +1 -0
  922. package/dist/utils/threadToggle.d.ts +29 -0
  923. package/dist/utils/threadToggle.d.ts.map +1 -0
  924. package/dist/utils/threadToggle.js +39 -0
  925. package/dist/utils/threadToggle.js.map +1 -0
  926. package/dist/utils/timezone.d.ts +125 -0
  927. package/dist/utils/timezone.d.ts.map +1 -0
  928. package/dist/utils/timezone.js +278 -0
  929. package/dist/utils/timezone.js.map +1 -0
  930. package/dist/utils/tmuxExec.d.ts +61 -0
  931. package/dist/utils/tmuxExec.d.ts.map +1 -0
  932. package/dist/utils/tmuxExec.js +109 -0
  933. package/dist/utils/tmuxExec.js.map +1 -0
  934. package/dist/utils/tmuxSessionName.d.ts +34 -0
  935. package/dist/utils/tmuxSessionName.d.ts.map +1 -0
  936. package/dist/utils/tmuxSessionName.js +51 -0
  937. package/dist/utils/tmuxSessionName.js.map +1 -0
  938. package/dist/utils/toolResultRender.d.ts +61 -0
  939. package/dist/utils/toolResultRender.d.ts.map +1 -0
  940. package/dist/utils/toolResultRender.js +62 -0
  941. package/dist/utils/toolResultRender.js.map +1 -0
  942. package/dist/utils/topicRequest.d.ts +61 -0
  943. package/dist/utils/topicRequest.d.ts.map +1 -0
  944. package/dist/utils/topicRequest.js +68 -0
  945. package/dist/utils/topicRequest.js.map +1 -0
  946. package/dist/utils/topicView.d.ts +55 -0
  947. package/dist/utils/topicView.d.ts.map +1 -0
  948. package/dist/utils/topicView.js +56 -0
  949. package/dist/utils/topicView.js.map +1 -0
  950. package/dist/utils/transcribeAudio.d.ts +89 -0
  951. package/dist/utils/transcribeAudio.d.ts.map +1 -0
  952. package/dist/utils/transcribeAudio.js +249 -0
  953. package/dist/utils/transcribeAudio.js.map +1 -0
  954. package/dist/utils/transientFrames.d.ts +52 -0
  955. package/dist/utils/transientFrames.d.ts.map +1 -0
  956. package/dist/utils/transientFrames.js +41 -0
  957. package/dist/utils/transientFrames.js.map +1 -0
  958. package/dist/utils/typingActive.d.ts +35 -0
  959. package/dist/utils/typingActive.d.ts.map +1 -0
  960. package/dist/utils/typingActive.js +22 -0
  961. package/dist/utils/typingActive.js.map +1 -0
  962. package/dist/utils/typingLoopBackstop.d.ts +64 -0
  963. package/dist/utils/typingLoopBackstop.d.ts.map +1 -0
  964. package/dist/utils/typingLoopBackstop.js +68 -0
  965. package/dist/utils/typingLoopBackstop.js.map +1 -0
  966. package/dist/utils/verbosityRender.d.ts +18 -0
  967. package/dist/utils/verbosityRender.d.ts.map +1 -0
  968. package/dist/utils/verbosityRender.js +17 -0
  969. package/dist/utils/verbosityRender.js.map +1 -0
  970. package/dist/utils/wedgeRecovery.d.ts +57 -0
  971. package/dist/utils/wedgeRecovery.d.ts.map +1 -0
  972. package/dist/utils/wedgeRecovery.js +24 -0
  973. package/dist/utils/wedgeRecovery.js.map +1 -0
  974. package/dist/utils.d.ts +30 -0
  975. package/dist/utils.d.ts.map +1 -0
  976. package/dist/utils.js +61 -0
  977. package/dist/utils.js.map +1 -0
  978. package/dist/validation.d.ts +113 -0
  979. package/dist/validation.d.ts.map +1 -0
  980. package/dist/validation.js +226 -0
  981. package/dist/validation.js.map +1 -0
  982. package/dist/voiceQueue.d.ts +7 -0
  983. package/dist/voiceQueue.d.ts.map +1 -0
  984. package/dist/voiceQueue.js +33 -0
  985. package/dist/voiceQueue.js.map +1 -0
  986. package/examples/.env.example +17 -0
  987. package/examples/docker-compose.yml +36 -0
  988. package/package.json +83 -4
@@ -0,0 +1,1446 @@
1
+ import { EventEmitter } from 'events';
2
+ import type { AgentAdapter, AgentRuntimeInfo, AgentSession, CompactionResult, DisplayPrefsReader, OpenCodePendingQuestion, ReattachRecap, RecentTurn, ResumeSessionOptions, SeenWatermark, SeenWatermarkWriter, ThreadLocaleReader } from '../types';
3
+ import type { SessionKey } from '../sessionKey';
4
+ import { type OpenCodeAuthMethod } from '../utils/openCodeAuthLogin';
5
+ interface OpenCodeModelOverride {
6
+ providerID: string;
7
+ modelID: string;
8
+ }
9
+ export interface OpenCodeSession {
10
+ key: SessionKey;
11
+ sessionId: string;
12
+ workDir: string;
13
+ isActive: boolean;
14
+ /** Accumulated text parts for current response */
15
+ currentResponseText: string;
16
+ /**
17
+ * Length (chars) of {@link currentResponseText} that has already been
18
+ * emitted as an `output` event. Both emit sites (the debounce timer in
19
+ * `handleTextDelta` and `flushOutput`) send only the unsent tail
20
+ * `currentResponseText.slice(lastEmittedLength)` and advance this, so the
21
+ * full response reaches Telegram exactly once. Reset to 0 wherever
22
+ * `currentResponseText` is reset to `''`.
23
+ */
24
+ lastEmittedLength: number;
25
+ /** Timer for batching SSE deltas before emitting output */
26
+ outputTimer: NodeJS.Timeout | null;
27
+ /** Id of the newest compaction summary message (`message.updated` with `summary: true`), learned
28
+ * before its text streams, so its parts can be told apart from an ordinary answer. */
29
+ compactionSummaryMessageId: string | null;
30
+ /** {@link currentResponseText} holds that summary: its tails carry `isCompactionSummary`. Reset alongside it. */
31
+ isResponseCompactionSummary: boolean;
32
+ /**
33
+ * Accumulated SUB-AGENT (child session) text for the current turn, streamed
34
+ * only in `/subagent full` mode. Kept strictly SEPARATE from
35
+ * {@link currentResponseText}: a child transcript must never advance the
36
+ * parent's emit cursor / continuation accounting. Reset wherever
37
+ * `currentResponseText` is reset.
38
+ */
39
+ childResponseText: string;
40
+ /** Emit cursor over {@link childResponseText} (same tail-emit discipline as
41
+ * {@link lastEmittedLength}). Reset alongside it. */
42
+ childLastEmittedLength: number;
43
+ /** Debounce timer for child text deltas — mirrors {@link outputTimer} but
44
+ * over the child accumulator, so the two streams never share a flush. */
45
+ childOutputTimer: NodeJS.Timeout | null;
46
+ /**
47
+ * Title of the delegation currently running in a child session, recorded
48
+ * from the parent's `task` tool part (`state.title` / `state.input.description`)
49
+ * while it is pending/running and cleared when it completes/errors. Drives
50
+ * the status-only-mode "🤖 sub-agent: <title> …" status (S4) and is the field
51
+ * the S5 "Delegating" activity status will reuse. v1 tracks ONE delegation —
52
+ * parallel tasks are last-writer-wins and the first completion clears.
53
+ */
54
+ activeSubagentTitle: string | null;
55
+ /** Whether model info has been shown to the user (shown once on first response) */
56
+ isModelInfoShown: boolean;
57
+ /** Model override for this session (passed with each prompt) */
58
+ modelOverride: OpenCodeModelOverride | null;
59
+ /** Last known model label from SSE events */
60
+ currentModelLabel: string | null;
61
+ /** Latest valid parent-assistant context observation, kept as an atomic tuple. */
62
+ latestParentRuntimeContext: OpenCodeParentAssistantContext | null;
63
+ /** Increments for each live parent-assistant observation from SSE. */
64
+ parentAssistantObservationVersion: number;
65
+ /** Map partID -> part type for resolving delta events */
66
+ partTypes: Map<string, string>;
67
+ /** Timer for debouncing status (tool/reasoning) updates */
68
+ statusDebounceTimer: NodeJS.Timeout | null;
69
+ /** Latest status text pending emission */
70
+ pendingStatus: string | null;
71
+ /**
72
+ * Accumulated reasoning (chain-of-thought) text for the CURRENT response,
73
+ * kept strictly SEPARATE from {@link currentResponseText} so it never leaks
74
+ * into the answer (or its continuation accounting). Reset to `''` when a new
75
+ * reasoning stream starts or the response's reasoning ends.
76
+ */
77
+ reasoningText: string;
78
+ /**
79
+ * Epoch ms of the FIRST reasoning delta of the current response, or `null`
80
+ * when no reasoning is in flight. Drives the "thought for {N}s" duration on
81
+ * the `thinking` `done` emit; reset on reasoning end.
82
+ */
83
+ reasoningStartedAt: number | null;
84
+ /**
85
+ * Debounce timer for the live `thinking` emit — the reasoning delta stream is
86
+ * chatty, so live emits are coalesced the same way text deltas are.
87
+ */
88
+ reasoningTimer: NodeJS.Timeout | null;
89
+ /**
90
+ * Part ids whose completed tool OUTPUT has already been emitted as a
91
+ * `toolResult` event — OpenCode re-sends a part on every state change (and
92
+ * may re-deliver the completed shape), so without this guard one result
93
+ * would reach the topic several times. Cleared on the NEXT prompt (not on
94
+ * the turn flush): part re-deliveries can straddle the finish/idle flush,
95
+ * and since part ids are unique a late clear can never suppress a genuine
96
+ * new result — while an early clear would re-open the double-emit window.
97
+ */
98
+ emittedToolResultPartIds: Set<string>;
99
+ /** Pending question awaiting user's answer */
100
+ pendingQuestion: OpenCodePendingQuestion | null;
101
+ /**
102
+ * Currently selected reasoning-effort level (a model variant) for this
103
+ * thread, or `null` if none has been chosen. Applied per-prompt by
104
+ * `sendPromptAsync` as `body.variant` on the prompt request.
105
+ */
106
+ effortLevel: string | null;
107
+ /**
108
+ * Whether this session is mid-generation. Tracked from SSE `session.status`
109
+ * (and cleared on `session.idle`); set optimistically when a prompt is sent.
110
+ * Drives {@link checkIsOpenCodeSessionBusy} (the scheduler's wait-for-idle
111
+ * probe). A normal busy turn queues new prompts, but a provider-managed
112
+ * `retry` is different: OpenCode will not read the queue until its retry time,
113
+ * so the next user prompt aborts that stale turn before using the current
114
+ * model override.
115
+ */
116
+ isBusy: boolean;
117
+ /**
118
+ * Whether a prompt was sent and we are still waiting for the turn it started
119
+ * to resolve at the next own-session `session.idle`. Reset on each prompt send;
120
+ * cleared on the resolving idle. With {@link sawTurnActivity} it drives the
121
+ * "prompt delivered but the agent never ran a turn" detector (a WEDGED session
122
+ * accepts the prompt then idles with no assistant activity — live 2026-08-15).
123
+ */
124
+ awaitingTurnResponse: boolean;
125
+ /**
126
+ * Prompts sent that OpenCode has not yet shown as a NEW user message on the
127
+ * event stream (a prompt sent while a turn runs is queued into it), and the
128
+ * user message ids already counted. See `checkHasUnconsumedInput`.
129
+ */
130
+ unconsumedInputCount: number;
131
+ seenUserMessageIds: Set<string>;
132
+ /**
133
+ * Whether ANY assistant activity (message.updated / part, own OR sub-agent
134
+ * child) was observed since the last prompt was sent. Reset false on prompt
135
+ * send; a healthy turn always sets it. Its absence at idle is the wedge signal.
136
+ */
137
+ sawTurnActivity: boolean;
138
+ /**
139
+ * Signature of the current provider-managed `session.status=retry`, or null.
140
+ * Doubles as the one-notice-per-retry dedup key and the signal that the next
141
+ * user prompt must interrupt the wait instead of queueing behind it.
142
+ */
143
+ providerRetrySignature: string | null;
144
+ /** Ignore stale model updates until the post-abort selected-model turn starts. */
145
+ isAwaitingModelAfterProviderRetryAbort: boolean;
146
+ /** Consume the idle emitted by an aborted provider-retry turn before handling the replacement turn. */
147
+ isAwaitingProviderRetryAbortIdle: boolean;
148
+ /**
149
+ * Wait for the post-abort replacement's own `busy` status before arming wedge
150
+ * detection. Never open-ended — {@link providerRetryReplacementStartTimer}
151
+ * bounds it, because while this is set the idle handler swallows every own idle.
152
+ */
153
+ isAwaitingProviderRetryReplacementStart: boolean;
154
+ /**
155
+ * Bound on that wait, or `null` when no replacement boundary is armed. A
156
+ * wedged session accepts the replacement prompt and never runs it, so its
157
+ * `busy` never arrives and the boundary would latch forever — swallowing every
158
+ * later idle, pinning {@link isBusy}, and disarming wedge detection. On expiry
159
+ * the adapter ends the episode and emits `noResponse` so the bot's recovery
160
+ * escalation runs. Cleared whenever the boundary resolves or the session is
161
+ * torn down; `unref`ed so it can never hold the process open.
162
+ */
163
+ providerRetryReplacementStartTimer: NodeJS.Timeout | null;
164
+ /** Shared abort request so concurrent prompts cannot race abort-after-prompt. */
165
+ providerRetryAbortPromise: Promise<void> | null;
166
+ /**
167
+ * Whether context compaction is in flight (between
168
+ * `session.next.compaction.started` and `…ended` / `session.compacted`).
169
+ * Counts as busy for {@link checkIsOpenCodeSessionBusy}.
170
+ */
171
+ isCompacting: boolean;
172
+ /**
173
+ * Child (sub-agent) session ids currently busy, learned from routed
174
+ * `session.status` events. A running sub-agent counts as busy for
175
+ * {@link checkIsOpenCodeSessionBusy}. Cleared per-child when that child
176
+ * goes idle.
177
+ */
178
+ busyChildSessionIds: Set<string>;
179
+ /**
180
+ * Id of the LAST completed parent assistant message of the turn, captured from
181
+ * the message events (no extra HTTP). Advanced to the persisted
182
+ * {@link SeenWatermark} on each parent-message `finish` (S7 — so a mid-turn
183
+ * restart re-counts nothing already relayed) and again on `session.idle` (the
184
+ * safety net), so a bot restart can count only the assistant messages produced
185
+ * after it (the reattach recap). `undefined` until the first assistant message
186
+ * finishes.
187
+ */
188
+ lastMessageId?: string;
189
+ /**
190
+ * Whether this session may still be renamed by the bot-side fallback. Set
191
+ * `true` only for sessions the bot created WITHOUT explicit `/opencode args`
192
+ * (those rely on opencode's native auto-title — R1). Cleared on the first
193
+ * meaningful prompt once the fallback has run (or decided auto-title already
194
+ * named it), so the bot never overwrites a real name and PATCHes at most
195
+ * once. Resumed / args-titled sessions start `false` — never auto-renamed.
196
+ */
197
+ isAutoNamePending: boolean;
198
+ }
199
+ /**
200
+ * @description SSE event envelope from OpenCode server.
201
+ * All SSE messages are `data:` lines containing JSON with { type, properties }.
202
+ * There are no `event:` lines — the event type is inside the JSON payload.
203
+ */
204
+ interface OpenCodeSseEvent {
205
+ type: string;
206
+ properties: Record<string, unknown>;
207
+ /**
208
+ * Owning project-instance directory from the `/global/event` envelope
209
+ * (`{ directory, payload }`). The server multiplexes one PROJECT INSTANCE
210
+ * per directory, and instance-local state (pending questions, permissions)
211
+ * is only reachable when the request selects that instance via
212
+ * `?directory=` — a reply sent without it lands in the serve-cwd default
213
+ * instance and 404s (`QuestionNotFoundError`). Absent on the bare
214
+ * `/event` shape, which is instance-local by construction.
215
+ */
216
+ directory?: string;
217
+ }
218
+ /**
219
+ * OpenCode `/global/event` wraps the real event in `payload`, while `/event`
220
+ * emits it directly. Normalise both shapes before dispatching.
221
+ */
222
+ export declare function normaliseOpenCodeSseEvent(raw: unknown): OpenCodeSseEvent | null;
223
+ /**
224
+ * @description Append the `?directory=` instance selector to an API path when
225
+ * the owning instance is known. Without it the server resolves its serve-cwd
226
+ * default instance, whose in-memory state (questions, permissions) does not
227
+ * contain requests raised in other project instances — the reply then fails
228
+ * with 404 even though the request is alive in its own instance.
229
+ */
230
+ export declare function buildDirectoryScopedPath(basePath: string, directory: string | undefined): string;
231
+ export type { OpenCodeQuestionOption, OpenCodeQuestion, OpenCodePendingQuestion, } from '../types';
232
+ export interface OpenCodeParentAssistantContext {
233
+ messageId: string;
234
+ /** Omitted when OpenCode did not report a usable provider/model reference. */
235
+ model?: OpenCodeModelOverride;
236
+ contextUsedTokens: number;
237
+ }
238
+ /**
239
+ * @description Map raw `GET /session/:id/message` records to the last `limit`
240
+ * conversational turns (oldest→newest) for the resume context block.
241
+ *
242
+ * Pure + exported (no I/O) so it is unit-testable. For each record it joins the
243
+ * text of every `{ type: 'text' }` part (skipping tool / step / empty parts),
244
+ * trims, and emits a {@link RecentTurn} only when the role is user/assistant
245
+ * AND the joined text is non-empty. Every field is guarded with `typeof` /
246
+ * `Array.isArray` so a malformed record is skipped, never crashes — no casts.
247
+ * Keeps only the last `limit` turns.
248
+ */
249
+ export declare function mapOpenCodeMessagesToTurns(records: unknown, limit: number): RecentTurn[];
250
+ /**
251
+ * @description Count the renderable assistant messages that appear AFTER the
252
+ * watermark message in a `GET /session/:id/message` payload — the OpenCode side
253
+ * of "how many agent messages did the user miss while the bot was down".
254
+ *
255
+ * Pure + exported (no I/O) so it is unit-testable against a records array. Walks
256
+ * the chronological records (oldest→newest), skipping everything up to and
257
+ * including the message whose `info.id === watermarkId`, then counts each later
258
+ * `assistant`-role record that carries at least one non-empty text part (the
259
+ * same renderability rule as {@link mapOpenCodeMessagesToTurns}, so the count
260
+ * matches what a turn body would show).
261
+ *
262
+ * `isWatermarkKnown` is `false` — and `missedCount` `0` — when the payload is
263
+ * not an array, no `watermarkId` was given, or the id is absent from the records
264
+ * (pruned / different session). The caller treats that as the fallback
265
+ * (no-count) recap, never a crash.
266
+ */
267
+ export declare function countOpenCodeAssistantMessagesSinceId(records: unknown, watermarkId: string | undefined): {
268
+ missedCount: number;
269
+ isWatermarkKnown: boolean;
270
+ };
271
+ /**
272
+ * @description Last assistant message `id` in a `GET /session/:id/message`
273
+ * payload — the OpenCode reattach-recap HEAD watermark ("everything currently in
274
+ * the record is accounted for"). Pure + exported (no I/O) so it is unit-testable.
275
+ *
276
+ * Walks the chronological records and returns the `info.id` of the LAST record
277
+ * whose `info.role === 'assistant'` and whose `info.id` is a string; returns
278
+ * `undefined` for a non-array payload or when no assistant message carries an id
279
+ * (head unknown → the caller omits the watermark and retries next reattach).
280
+ *
281
+ * Anchors on the last ASSISTANT message (not the last record of any role) to
282
+ * mirror the live-advance watermark ({@link OpenCodeSession.lastMessageId}, set
283
+ * on the parent turn's final assistant message) and the count keyed off it in
284
+ * {@link countOpenCodeAssistantMessagesSinceId} — so the next reattach's
285
+ * `[watermark, …)` window starts at the true tail and yields 0 on a clean
286
+ * reattach. Unlike the missed-count it does NOT require renderable text: the
287
+ * watermark must advance past every assistant message seen, tool-only ones too.
288
+ */
289
+ export declare function getLatestOpenCodeAssistantMessageId(records: unknown): string | undefined;
290
+ /**
291
+ * @description Text of the NEWEST compaction summary in a `GET /session/:id/message`
292
+ * payload — the assistant message the fork stored with `info.summary === true`.
293
+ * Joins its renderable text parts (same rule as {@link mapOpenCodeMessagesToTurns}).
294
+ * Pure + exported (no I/O) so it is unit-testable. Returns `null` for a non-array
295
+ * payload or when no summary message with text is present, so F2's notice omits
296
+ * the closing block rather than posting an empty one.
297
+ */
298
+ export declare function getLatestOpenCodeCompactionSummary(records: unknown): string | null;
299
+ /**
300
+ * @description Best-effort "the turn is still in flight" signal for the reattach
301
+ * recap, derived from the already-fetched `GET /session/:id/message` payload —
302
+ * NO extra HTTP probe. True only when the LAST record is an `assistant` message
303
+ * with no `finish` reason yet (a turn the agent was mid-way through when the bot
304
+ * went down). Any uncertainty (empty / non-array payload, last record not a
305
+ * finished-less assistant message) → `false`, so the trailing "still working"
306
+ * line is never shown on a guess.
307
+ */
308
+ export declare function checkIsOpenCodeTurnInFlight(records: unknown): boolean;
309
+ /** Bound silent-restart metadata reads so many active sessions do not overload OpenCode. */
310
+ export declare const openCodeRuntimeContextHydrationConcurrency = 3;
311
+ /**
312
+ * SSE event types whose loss makes a turn silently hang — diag-logged on drop.
313
+ * `question.asked` / `permission.asked` are here so an unrouted one is LOGGED
314
+ * (the user's question vanishing silently was the worst failure mode): they DO
315
+ * carry a real top-level `sessionID` in the current OpenCode build (verified
316
+ * live 2026-06-08), so they resolve like any other event — by sessionID, with a
317
+ * directory fallback — and a genuine miss is loud, never a no-op.
318
+ */
319
+ export declare const criticalSseEventTypes: Set<string>;
320
+ /**
321
+ * @description How long a post-provider-retry replacement prompt may take to
322
+ * produce its first `busy` status before the adapter declares that it never
323
+ * started a turn. Derived from the SSE bounds rather than a flat number: the
324
+ * `busy` arrives sub-second on the happy path, but it is DELIVERED over the
325
+ * event stream, so a stall detected at {@link sseStallTimeoutMs} followed by a
326
+ * fully backed-off reconnect ({@link maxSseReconnectDelayMs}) can hide it for
327
+ * their sum. A flat 60s sat inside that window, so a stream hiccup would have
328
+ * been read as a dead turn and forked/restarted a session that was answering.
329
+ * Waiting only delays recovery; firing early discards live work.
330
+ */
331
+ export declare const providerRetryReplacementStartTimeoutMs: number;
332
+ /**
333
+ * @description Whether a `session.error` message is the bot-issued abort of a
334
+ * running generation (`POST /session/:id/abort`) — the ONLY source of an
335
+ * "Aborted" error in OpenCode (the user has no other abort trigger). It fires
336
+ * on the question-cancel SIGINT, `/esc`, and the provider-retry interrupt, and
337
+ * must be SWALLOWED rather than surfaced as "OpenCode error: Aborted" — that
338
+ * bogus line was the third message on the question-cancel path (parity with the
339
+ * json-stream "Claude error: API error" swallow). Matched as the exact bare
340
+ * word so a real provider error that merely quotes "aborted" still surfaces.
341
+ */
342
+ export declare function checkIsOpenCodeAbortError(errorMsg: string): boolean;
343
+ /**
344
+ * Cap for a surfaced error string. A provider can attach a whole
345
+ * request/response dump; the head carries the readable reason, the tail is
346
+ * noise that would flood the topic.
347
+ */
348
+ export declare const openCodeErrorMessageMaxLength = 500;
349
+ /**
350
+ * @description Extract the readable, SAFE-TO-SURFACE error form from OpenCode's
351
+ * persisted and SSE payload shapes. Every return value of this function reaches
352
+ * a Telegram topic and the console log, so a payload whose shape carries no
353
+ * known message field yields the fixed {@link genericOpenCodeErrorMessage}: such
354
+ * a payload is an arbitrary provider dump (a rejected request body, a header
355
+ * list, a response echo) and `/connect` PUTs the user's provider key, so
356
+ * rendering it is a credential-leak path that name-based redaction cannot close.
357
+ * The retry classifier reads {@link getOpenCodeErrorClassificationText} instead.
358
+ */
359
+ export declare function getOpenCodeErrorMessage(error: unknown): string;
360
+ /**
361
+ * @description Live busy-relevant state of an OpenCode session, derived from
362
+ * SSE events (not an HTTP poll — the stream catches sub-100 ms busy/idle
363
+ * transitions an HTTP poll races past).
364
+ */
365
+ export interface OpenCodeBusyState {
366
+ /** Own session is mid-generation (`session.status` = busy). */
367
+ isBusy: boolean;
368
+ /** Context compaction is in flight. */
369
+ isCompacting: boolean;
370
+ /** Number of child (sub-agent) sessions currently busy. */
371
+ busyChildCount: number;
372
+ }
373
+ /**
374
+ * @description Sync "is this session occupied with a turn?" decision for the
375
+ * scheduler's wait-for-idle loop ({@link AgentAdapter.checkIsBusy}): busy when
376
+ * its own generation runs, a sub-agent runs, or context is compacting. This is
377
+ * a read-only probe — a new prompt to a busy session is never aborted; OpenCode
378
+ * queues it via `prompt_async` and reads it promptly, so unlike the Claude TUI
379
+ * there is no interrupt-before-prompt (user decision 2026-06-06). Pure +
380
+ * exported for unit testing.
381
+ */
382
+ export declare function checkIsOpenCodeSessionBusy(state: OpenCodeBusyState): boolean;
383
+ /** Mutable busy-tracking slice of a session, updated from SSE status/idle events. */
384
+ export interface OpenCodeBusyTracking {
385
+ isBusy: boolean;
386
+ busyChildSessionIds: Set<string>;
387
+ }
388
+ /**
389
+ * @description Apply a busy/idle transition (from `session.status` or
390
+ * `session.idle`) to a session's busy-tracking state. The own session's status
391
+ * drives `isBusy`; a lineage-VERIFIED descendant's (sub-agent child session's)
392
+ * status maintains `busyChildSessionIds` — a child going idle must NOT clear
393
+ * the parent's `isBusy`. A foreign non-descendant id (e.g. a wedged sibling
394
+ * top-level session routed in via the directory fallback) is never recorded:
395
+ * its busy=true is ignored — recording it would pin the thread busy forever,
396
+ * since a wedged session never goes idle (live incident 2026-06-10) — while
397
+ * its busy=false still deletes, self-healing ids that slipped in before
398
+ * verification existed. Pure + exported so the routing is unit-testable.
399
+ *
400
+ * @returns `true` when a foreign non-descendant busy=true was ignored, so the
401
+ * caller can diag-log it (throttled — never per event).
402
+ */
403
+ export declare function applyOpenCodeStatusEvent(tracking: OpenCodeBusyTracking, ownSessionId: string, eventSessionId: string | null, isBusy: boolean, isVerifiedDescendant: boolean): boolean;
404
+ /**
405
+ * @description Provider → model configuration map. Keys are provider ids
406
+ * (e.g. `"anthropic"`, `"openai"`), values are model ids (e.g.
407
+ * `"claude-3-5-sonnet"`) mapping to its variants and context limit. A model
408
+ * with no `variants` entry maps to `[]`, which the picker treats as "this model
409
+ * has no effort concept".
410
+ */
411
+ export interface ParsedProvidersConfig {
412
+ providers: Map<string, Map<string, OpenCodeProviderModel>>;
413
+ }
414
+ export interface OpenCodeProviderModel {
415
+ variants: string[];
416
+ contextWindowTokens: number | null;
417
+ }
418
+ /**
419
+ * @description Build the JSON body for a `prompt_async` POST. Pure + exported
420
+ * so the two per-prompt overrides — the model selector and the reasoning-effort
421
+ * `variant` — can be unit-tested without a live session. Both are optional and
422
+ * ride the same body, parallel to each other.
423
+ *
424
+ * @returns Body with `parts` always present; `model` only when a model override
425
+ * is set; `variant` only when an effort level is set.
426
+ */
427
+ export declare function buildPromptBody(input: string, modelOverride: {
428
+ providerID: string;
429
+ modelID: string;
430
+ } | null, effortLevel: string | null): Record<string, unknown>;
431
+ export declare function checkIsValidProviderId(providerId: string): boolean;
432
+ /**
433
+ * @description Return the newest parent assistant message with a valid complete
434
+ * input-context usage total from a session-history payload. A malformed or
435
+ * foreign record is ignored rather than making a previous valid observation
436
+ * unusable.
437
+ */
438
+ export declare function getLatestOpenCodeParentAssistantContext(records: unknown, sessionId: string): OpenCodeParentAssistantContext | null;
439
+ export declare function buildProviderAuthPath(providerId: string): string;
440
+ /**
441
+ * @description Pure decision for the boot self-heal: given opencode's live
442
+ * `GET /mcp` status map (`{ <serverName>: { status, error? }, … }`), does the
443
+ * bot-owned `telegramBot` server need a (re)registration? True when the entry is
444
+ * ABSENT (never registered on this server generation) or its `status` is
445
+ * anything other than `connected` (e.g. `failed` — a stale registration to a
446
+ * dead port left by a previous bot generation). A malformed/empty response is
447
+ * treated as "needs register": a redundant POST is a harmless overwrite on the
448
+ * server, whereas skipping a real failure would leave agents without the tools.
449
+ */
450
+ export declare function checkNeedsSchedulerMcpReregister(mcpStatus: unknown): boolean;
451
+ /**
452
+ * Pauses before each retry of a failed scheduler-MCP registration. A server that
453
+ * was just (re)started can take longer than the request timeout to create a
454
+ * folder's instance — live, the first POST after a restart timed out at 30 s and
455
+ * the folder's agent ran without the bot's tools until the next bot boot. After
456
+ * the last pause the bot stops; the next session start or bot boot tries again.
457
+ */
458
+ export declare const schedulerMcpRetryDelaysMs: readonly number[];
459
+ /** @description The pause before retry number `attempt` (0-based), or `null` once the retries are used up. */
460
+ export declare function getSchedulerMcpRetryDelayMs(attempt: number): number | null;
461
+ export declare function buildProviderApiAuthPayload(apiKey: string): Record<string, string>;
462
+ /**
463
+ * @description Drop the cached model list + provider config so the next read
464
+ * re-fetches. Called after a credential change (`/connect`), which can change
465
+ * which providers/models the server exposes; also the isolation seam tests use
466
+ * to keep the module-level cache from leaking between cases.
467
+ */
468
+ export declare function resetOpenCodeProviderCaches(): void;
469
+ export declare function parseProvidersResponse(raw: unknown): ParsedProvidersConfig;
470
+ export declare class OpenCodeAdapter extends EventEmitter implements AgentAdapter {
471
+ readonly name = "opencode";
472
+ readonly label = "OpenCode";
473
+ /**
474
+ * `summarize` produces a real assistant message, which rides the SSE stream into
475
+ * the topic as agent output marked `isCompactionSummary` — so the bot must not
476
+ * post its own copy of the summary here, or the operator would read it twice.
477
+ */
478
+ readonly streamsCompactionSummary = true;
479
+ /**
480
+ * Map of serialised `SessionKey` (`"<chatId>:<threadId>"`) → live session.
481
+ * Keyed by string rather than `SessionKey` object so map lookups work — JS
482
+ * `Map` compares object identity, not structural equality.
483
+ */
484
+ private sessions;
485
+ /**
486
+ * The ONE `/global/event` SSE stream for the whole adapter (plan 2026-06-17).
487
+ * It multiplexes every project instance's events, each tagged with a top-level
488
+ * `directory` field, so a single reader parses each event once and routes it
489
+ * by envelope `directory` + `sessionID`. Opened when the FIRST active session
490
+ * (any folder) appears, closed when the LAST one goes away. `null` while no
491
+ * session is active.
492
+ */
493
+ private globalStream;
494
+ /**
495
+ * Directories whose OpenCode instance already has the bot's scheduler MCP
496
+ * server registered for the CURRENT server generation (plan 2026-06-17 S3).
497
+ * Registration is now per directory on session start (decoupled from the
498
+ * stream, which is no longer per-folder); the Set gates it to once per
499
+ * directory per generation and is cleared on `restartServer` so each dir is
500
+ * re-registered after the server (and its in-memory MCP table) restarts.
501
+ */
502
+ private registeredSchedulerMcpDirs;
503
+ /**
504
+ * Directories whose scheduler-MCP registration failed and is waiting for a
505
+ * retry: the number of retries already scheduled, and the pending timer (null
506
+ * while the retry itself runs). Cleared by a registration that succeeds.
507
+ */
508
+ private schedulerMcpRetries;
509
+ /**
510
+ * child sessionID → parent sessionID, learned from `session.updated` events.
511
+ * OpenCode runs subagents (e.g. `@explore`) in child sessions whose SSE
512
+ * events carry the child id; this map routes them back to the topic bound to
513
+ * the parent. Bounded by `maxTrackedSessionLineageEntries`.
514
+ */
515
+ private sessionLineage;
516
+ /**
517
+ * Last diag-log timestamp per `"<eventType>|<eventSessionId>"`, so a flood of
518
+ * dropped events for an orphaned session logs at most once per
519
+ * `sseDropLogThrottleMs` instead of once per delta per bound thread (B19).
520
+ */
521
+ private sseDropLogThrottle;
522
+ private baseUrl;
523
+ private authHeader;
524
+ /**
525
+ * Grace period (ms) the fallback rename waits for opencode's native
526
+ * auto-title before stepping in. Instance field (initialised from
527
+ * {@link fallbackRenameGraceMs}) purely so the naming test can drive it to 0
528
+ * and assert the PATCH path deterministically — production never changes it.
529
+ */
530
+ private fallbackRenameGraceMs;
531
+ /**
532
+ * @description Per-key start/stop serialisation queue (audit S8 / #13).
533
+ * Two near-simultaneous `startSession(key, …)` calls otherwise both
534
+ * progress through `POST /session`; the second's `stopSession(key)`
535
+ * (line 529) clears whatever the first inserted into `this.sessions`,
536
+ * but the losing thread still has its SSE stream and a server-side
537
+ * session id with no owner.
538
+ */
539
+ private lifecycleChains;
540
+ /** Number of in-flight optional history reads used to hydrate `/status` metadata. */
541
+ private runtimeContextHydrationCount;
542
+ /** Callers waiting for one of the bounded runtime-context hydration slots. */
543
+ private runtimeContextHydrationWaiters;
544
+ /** Whether a server restart is already in progress (prevents concurrent restart attempts) */
545
+ private isServerRestarting;
546
+ /**
547
+ * Per-thread display-prefs reader, injected by the bot at boot via
548
+ * `createAdapter.registerDisplayPrefsReader` (S4). DELIBERATE deviation from
549
+ * the S2/S3 "adapter stays mode-agnostic" pattern: the sub-agent branch
550
+ * decides WHAT to accumulate (non-`full` = refresh a status, `full` = stream
551
+ * into the separate child accumulator), which cannot be deferred to the
552
+ * bot's render time. `null` until wired → reads fall back to all-`minimal`.
553
+ */
554
+ private displayPrefsReader;
555
+ /** @description Inject the per-thread display-prefs reader (see the field's JSDoc). */
556
+ setDisplayPrefsReader(reader: DisplayPrefsReader): void;
557
+ /** Per-thread locale reader, injected at boot via `createAdapter.registerThreadLocaleReader`. */
558
+ private threadLocaleReader;
559
+ /** @description Inject the per-thread locale reader (for adapter-side `t(...)` calls). */
560
+ setThreadLocaleReader(reader: ThreadLocaleReader): void;
561
+ /** @description Run `fn` inside the thread's locale context so `t(...)` resolves correctly. */
562
+ private tl;
563
+ /**
564
+ * Per-thread seen-watermark writer, injected by the bot at boot via
565
+ * `createAdapter.registerSeenWatermarkWriter`. Called at turn end
566
+ * (`session.idle`) to persist how far the live relay had shown the record.
567
+ * `null` until wired → {@link advanceSeenWatermark} is a no-op.
568
+ */
569
+ private seenWatermarkWriter;
570
+ /** @description Inject the per-thread seen-watermark writer (see the field's JSDoc). */
571
+ setSeenWatermarkWriter(writer: SeenWatermarkWriter): void;
572
+ /** @description Advance the persisted seen-watermark for `key` (no-op until the
573
+ * writer is wired). Skips a watermark with no anchor id so the bot's recap
574
+ * cleanly falls back to its no-count path. */
575
+ private advanceSeenWatermark;
576
+ /** @description Resolve the thread's full display prefs, defaulting every
577
+ * field to `minimal` for any read before the bot wires the reader at boot. */
578
+ private getDisplayPrefs;
579
+ /** @description Resolve the thread's `/subagent` mode (the only pref the
580
+ * OpenCode adapter consults today), via the full prefs reader. */
581
+ private getSubagentMode;
582
+ constructor();
583
+ private restoreSavedModel;
584
+ /**
585
+ * @description Handle unexpected server process death.
586
+ * Notifies all active users and attempts to restart the server.
587
+ * SSE reconnect loop will detect the restart and recover automatically.
588
+ */
589
+ private handleServerCrash;
590
+ /**
591
+ * @description Restart the OpenCode server process.
592
+ * Prevents concurrent restart attempts. If restart is already in progress,
593
+ * waits for it to complete and returns its result.
594
+ */
595
+ private restartServer;
596
+ /**
597
+ * @description Reload credentials written by the out-of-band `opencode auth
598
+ * login` CLI. The CLI updates auth.json directly, but a running OpenCode
599
+ * server retains its prior provider credential in memory until restarted.
600
+ * Reuses the normal restart + active-session restoration path.
601
+ */
602
+ reloadProviderAuth(): Promise<boolean>;
603
+ private getHeaders;
604
+ private apiRequest;
605
+ /**
606
+ * @description Serialise start/stop ops per key. Returns the queued
607
+ * promise so callers still see the original result/throw. Audit S8.
608
+ */
609
+ private withLifecycleLock;
610
+ startSession(key: SessionKey, workDir: string, args?: string, _sessionId?: string): Promise<void>;
611
+ stopSession(key: SessionKey): void;
612
+ /** Lock-free body of `stopSession`; safe to call from start/resume paths
613
+ * that already hold the lifecycle lock. */
614
+ private stopSessionInner;
615
+ checkIsActive(key: SessionKey): boolean;
616
+ checkHasUnconsumedInput(key: SessionKey): boolean;
617
+ /**
618
+ * Count a parent-session user message the first time it shows up: OpenCode
619
+ * re-sends `message.updated` for one message, so ids are de-duplicated (the set
620
+ * is bounded — only recent ids can still repeat).
621
+ */
622
+ private noteUserMessageSeen;
623
+ checkIsBusy(key: SessionKey): boolean;
624
+ sendInput(key: SessionKey, input: string): void;
625
+ /**
626
+ * @description Send message via async endpoint (returns 204, response streams via SSE).
627
+ * Fire-and-forget — errors are logged but don't block.
628
+ *
629
+ * A normal busy turn is preserved and receives the prompt through OpenCode's
630
+ * queue. A provider-managed retry is interrupted first: otherwise a model
631
+ * switch plus "continue" is accepted into the transcript but remains unread
632
+ * behind the old provider's retry window.
633
+ *
634
+ * **Per-prompt effort apply:** if the thread has a stored effort level
635
+ * (a model variant), it's sent as `body.variant` alongside `body.model`
636
+ * — the same per-prompt override the prompt endpoint already uses for the
637
+ * model selector. No separate request, no env configuration.
638
+ */
639
+ private sendPromptAsync;
640
+ /**
641
+ * @description Return the one shared abort request for a provider-managed
642
+ * retry. Concurrent prompts await the same request, preventing a later abort
643
+ * from cancelling a prompt that an earlier caller already posted.
644
+ */
645
+ private getProviderRetryAbortPromise;
646
+ /**
647
+ * @description Arm the post-abort replacement boundary together with the bound
648
+ * on how long that boundary may stay armed.
649
+ *
650
+ * The boundary exists because `session.status` carries no turn identifier: the
651
+ * first observed `busy` is taken as the replacement turn's start. A wedged
652
+ * session never produces that `busy`, so without a bound the boundary latches
653
+ * forever and the topic hangs with nothing able to recover it.
654
+ */
655
+ private armProviderRetryReplacementStart;
656
+ /** Drop a pending replacement-start bound (teardown, or before re-arming). */
657
+ private clearProviderRetryReplacementStartTimer;
658
+ /**
659
+ * @description Resolve the replacement boundary: the flag and its bound are
660
+ * cleared together so the invariant "boundary disarmed ⇒ no pending timer"
661
+ * holds at every site, and a resolved boundary can never fire a late
662
+ * `noResponse` against a turn that did start.
663
+ */
664
+ private clearProviderRetryReplacementBoundary;
665
+ /**
666
+ * @description The single emit point for "the delivered prompt produced no
667
+ * turn". Both detectors watch the SAME prompt from different angles — the
668
+ * idle-time wedge check and the replacement-start bound — so every trigger is
669
+ * disarmed here before emitting, and one prompt can never reach the bot's
670
+ * recovery escalation twice.
671
+ */
672
+ private reportNoTurnResponse;
673
+ /**
674
+ * @description Bot-side fallback for naming an untitled session (R1 safety
675
+ * net). The primary mechanism is opencode's own LLM auto-title; this runs
676
+ * ONLY if that never lands.
677
+ *
678
+ * On the first MEANINGFUL prompt of an eligible (untitled, not-yet-renamed)
679
+ * session it clears the pending flag — so it tries at most once — then, after
680
+ * a grace period that lets auto-title land, reads the live title and PATCHes a
681
+ * snippet ONLY when the title is still the bare placeholder. The snippet
682
+ * derives from the RAW user text (preamble stripped) so it can never carry the
683
+ * thread-context header. Fire-and-forget; a failure leaves the placeholder.
684
+ */
685
+ private maybeScheduleFallbackRename;
686
+ sendSignal(key: SessionKey, signal: string): void;
687
+ /**
688
+ * @description Connect an OpenCode provider through the same API-key auth
689
+ * endpoint the OpenCode UI uses (`PUT /auth/{providerID}`). Providers with a
690
+ * custom auth entry must expose a one-field API method; ordinary providers
691
+ * (including OpenRouter) use the generic API-key method synthesized from the
692
+ * full `/provider` catalog.
693
+ */
694
+ connectProvider(_key: SessionKey, providerId: string, apiKey: string): Promise<string | null>;
695
+ /**
696
+ * @description Disconnect a provider through the same auth endpoint
697
+ * `/connect` writes to (`DELETE /auth/{providerID}`), then report what the
698
+ * delete actually achieved.
699
+ *
700
+ * `DELETE /auth` only clears OpenCode's own credential store. A provider
701
+ * OpenCode enables from an ENVIRONMENT VARIABLE (`openrouter` ←
702
+ * `OPENROUTER_API_KEY`) is still fully active afterwards, so we re-read
703
+ * `GET /config/providers` (caches dropped first, exactly like
704
+ * `connectProvider` does after a credential change) and hand the still-active
705
+ * provider ids to {@link getProviderDisconnectOutcome}. Claiming a clean
706
+ * disconnect there would be a lie — that case is what the bot-side "hide
707
+ * provider" toggle in `/model` exists for.
708
+ */
709
+ disconnectProvider(_key: SessionKey, providerId: string): Promise<string | null>;
710
+ private ensureProviderAuthServerReady;
711
+ /**
712
+ * @description Fetch a provider's auth methods for the `/connect` picker.
713
+ * Custom OAuth/multi-step methods come from `/provider/auth`; a provider that
714
+ * only appears in the full `/provider` catalog gets OpenCode's ordinary
715
+ * one-field API-key method. Throws on a server/transport error.
716
+ */
717
+ fetchProviderAuthMethods(providerId: string): Promise<OpenCodeAuthMethod[]>;
718
+ /**
719
+ * @description Set model override for the current session.
720
+ * Accepts either "provider/modelId" format or partial name to search.
721
+ * @returns Error message if model not found, null on success
722
+ */
723
+ setModel(key: SessionKey, modelId: string): Promise<string | null>;
724
+ /**
725
+ * @description Get list of available models from OpenCode CLI.
726
+ */
727
+ getAvailableModels(): Promise<string[]>;
728
+ getCurrentModel(key: SessionKey): string | null;
729
+ getRuntimeInfo(key: SessionKey): Promise<AgentRuntimeInfo>;
730
+ /**
731
+ * @description Fetch + cache the provider/variant config
732
+ * (`GET /config/providers`). 5-minute TTL — variant maps change about as
733
+ * often as the model list. The response is not logged because provider
734
+ * configuration can contain credentials.
735
+ */
736
+ private getProvidersConfig;
737
+ /**
738
+ * @description Variant names a `{providerID, modelID}` model exposes, or
739
+ * `[]` when the ref is incomplete or the model declares no variants.
740
+ *
741
+ * Takes a model ref (not a session) so the no-session `setModel` path can
742
+ * validate a freshly-picked model's variants before any session exists —
743
+ * `getAvailableEffortLevels` resolves the ref from the live session.
744
+ */
745
+ private getModelVariants;
746
+ /**
747
+ * @description Resolve the live session's current model into a
748
+ * `{providerID, modelID}` ref from the override (preferred) or the label.
749
+ */
750
+ private getSessionModelRef;
751
+ /**
752
+ * @description Seed the bot's default reasoning effort onto a freshly
753
+ * started/resumed session that has NO explicit per-thread `/effort` pref.
754
+ *
755
+ * Explicit prefs always win and are left untouched (early return). With no
756
+ * pref, the default (`defaultEffortLevel`) is clamped to the resolved
757
+ * model's variants — OpenCode effort is a model variant and not every model
758
+ * ships `xhigh`, so an unclamped value would POST an invalid `body.variant`.
759
+ * A model with no variants resolves to `null` (no effort), which is correct.
760
+ *
761
+ * Never persisted: the default stays a derived fallback, the prefs file
762
+ * remains "explicit choices only".
763
+ */
764
+ private applyDefaultEffortIfUnset;
765
+ /**
766
+ * @description Resolve the model the thread's effort applies to, WITHOUT
767
+ * requiring a live session — the prospective model the NEXT session will
768
+ * use. Priority mirrors `fetchModelInfo`'s resolution order so the
769
+ * pre-session effort surface lines up with what a started session would
770
+ * actually run:
771
+ * 1. live session's model ref (active session wins), else
772
+ * 2. the thread's saved `/model` pref (`loadSavedModel`), else
773
+ * 3. the OpenCode server's default model (`GET /config`
774
+ * `defaultModel` / `model`).
775
+ * Returns `null` only when none of these yield a complete `{providerID,
776
+ * modelID}` ref, so `/effort` pre-session validates against the same model
777
+ * `/model` would persist.
778
+ */
779
+ private getProspectiveModelRef;
780
+ /**
781
+ * @description Effort levels the thread can use: exactly the variants its
782
+ * model declares. Works pre-session too — with no live session it resolves
783
+ * the PROSPECTIVE model (saved `/model` pref → server default) so the
784
+ * `/effort` picker can list the next session's variants before `/opencode`,
785
+ * mirroring how `/model` works pre-session. Empty when the (live or
786
+ * prospective) model declares no variants or can't be resolved.
787
+ */
788
+ getAvailableEffortLevels(key: SessionKey): Promise<string[]>;
789
+ getEffort(key: SessionKey): string | null;
790
+ /**
791
+ * @description Set the per-thread effort (variant). Validates against the
792
+ * thread's available variants — live model when a session is running, the
793
+ * PROSPECTIVE model (saved `/model` pref → server default) when not — then
794
+ * persists on success (applied per-prompt by `sendPromptAsync`, plan D3; a
795
+ * later session seeds `effortLevel` from this pref at creation). Returns a
796
+ * user-facing notice string on any non-success, `null` on success.
797
+ *
798
+ * Mirrors `setModel`'s persist-first symmetry (no `'No active session'`
799
+ * hard-fail): a level picked BEFORE `/opencode` is saved and replayed by the
800
+ * next session, instead of being lost — same intent as the model pref.
801
+ */
802
+ setEffort(key: SessionKey, level: string): Promise<string | null>;
803
+ /**
804
+ * @description Human label for the model the thread's effort validates
805
+ * against — the live session's label when active, else the prospective
806
+ * model's `provider/model` — for the `effort.not_supported` notice. `'?'`
807
+ * only when no model can be resolved at all.
808
+ */
809
+ private getEffortModelLabel;
810
+ /**
811
+ * @description Manually rename the live session via `PATCH /session/:id
812
+ * { title }`, scoped to the session's owning project instance
813
+ * (`?directory=<workDir>`) so it hits the same instance the session was
814
+ * created in. Reuses {@link apiRequest} — no duplicate HTTP code.
815
+ *
816
+ * A manual rename is final: it clears `isAutoNamePending` so the bot-side
817
+ * auto-name fallback can never overwrite the user's title later (the
818
+ * fallback only fires while that flag is set — see
819
+ * {@link maybeScheduleFallbackRename}).
820
+ */
821
+ renameSession(key: SessionKey, title: string): Promise<string | null>;
822
+ /**
823
+ * @description Compact the live session's context via `POST /session/:id/
824
+ * summarize`, scoped to the session's owning project instance
825
+ * (`?directory=<workDir>`) so it hits the same instance the session was
826
+ * created in. Reuses {@link apiRequest} — no duplicate HTTP code.
827
+ *
828
+ * This is the REAL compaction path. `prompt_async` (the only other transport)
829
+ * does no slash-command parsing server-side, so forwarding the literal
830
+ * `/compact` text there just burned a model turn answering a two-word prompt
831
+ * — the bug this method fixes.
832
+ *
833
+ * `summarize` runs a summarisation turn, so it REQUIRES a complete model ref:
834
+ * the session's `modelOverride` (populated from the server default at session
835
+ * start) wins, else {@link getProspectiveModelRef} resolves it exactly the way
836
+ * `/effort` does (saved `/model` pref → server `defaultModel`). Unresolvable →
837
+ * a notice, never a partial/empty `providerID`/`modelID`.
838
+ *
839
+ * `auto` is deliberately omitted: this is a MANUAL compaction and the server
840
+ * defaults the flag to false (the automatic, overflow-triggered compaction is
841
+ * server-side and untouched by this).
842
+ */
843
+ compactContext(key: SessionKey, instruction?: string): Promise<CompactionResult>;
844
+ /**
845
+ * @description Whether this thread's directory instance loaded the bot's
846
+ * compaction plugin, read from its merged config (`GET /config`, directory
847
+ * scoped). An instance created before the plugin was installed lacks it until
848
+ * it is recreated, and then the bot must keep sending the skills guidance
849
+ * itself. A read failure answers `false`: the guidance then appears twice,
850
+ * which beats not at all.
851
+ */
852
+ checkHasCompactionSkillsHook(key: SessionKey): Promise<boolean>;
853
+ /**
854
+ * @description Read the newest compaction summary for the live session via
855
+ * `GET /session/:id/message` (directory-scoped) and lift its text out with the
856
+ * pure {@link getLatestOpenCodeCompactionSummary}. Used by F2 to surface the
857
+ * appended "Where we stopped" closing section in the idle-compaction notice. A
858
+ * read failure / no summary yields `null` (the notice then omits the block).
859
+ */
860
+ getLatestCompactionSummary(key: SessionKey): Promise<string | null>;
861
+ getOpenCodeSessionId(key: SessionKey): string | null;
862
+ getSessions(_key: SessionKey, workDir: string): Promise<AgentSession[]>;
863
+ /**
864
+ * @description Read the last `limit` conversational turns of a session for the
865
+ * resume context block via `GET /session/:id/message`. `key`/`workDir` are
866
+ * unused — OpenCode scopes messages by session id, server-side. Maps the raw
867
+ * records with the pure {@link mapOpenCodeMessagesToTurns}; a request failure
868
+ * yields `[]`, so the caller posts no context block.
869
+ */
870
+ getRecentTurns(_key: SessionKey, _workDir: string, sessionId: string, limit: number): Promise<RecentTurn[]>;
871
+ /**
872
+ * @description Assemble the silent-reattach recap for OpenCode: ONE
873
+ * `GET /session/:id/message` read serves both the missed-message count (since
874
+ * the watermark id) and the last-{@link resumeContextTurnLimit} turns. A read
875
+ * failure degrades to an empty, watermark-unknown recap (the caller posts
876
+ * nothing). The watermark only counts when its `sessionId` matches the session
877
+ * being recapped — a stale watermark from a different session (`/new`,
878
+ * `/sessions` resume keep the agent row) is treated as unknown. `isActive` is
879
+ * derived from the fetched records (last record = an unfinished assistant
880
+ * turn), never a blocking server probe.
881
+ */
882
+ getReattachRecap(_key: SessionKey, _workDir: string, sessionId: string, watermark: SeenWatermark | null): Promise<ReattachRecap>;
883
+ resumeSession(key: SessionKey, workDir: string, sessionId: string, options?: ResumeSessionOptions): Promise<void>;
884
+ /**
885
+ * @description Fork the thread's CURRENT session into a new one that carries
886
+ * the full conversation, and attach to it. Used by the bot's wedged-turn
887
+ * recovery (tier 2) to restore the last dialog into a fresh, unwedged session
888
+ * before replaying the prompt — so a stuck session doesn't lose context. The
889
+ * new session's id is exposed via {@link getOpenCodeSessionId}, so the bot
890
+ * persists it with the shared `persistAdapterSessionIds`. Returns the new
891
+ * session id, or null when there is no active session or the fork failed.
892
+ */
893
+ forkSession(key: SessionKey): Promise<string | null>;
894
+ /**
895
+ * @description Detach any RUNNING sub-agent that is synchronously blocking the
896
+ * thread's session, so a new prompt can be answered while the sub-agent keeps
897
+ * working in the background (OpenCode injects its result back when it finishes).
898
+ * No-op (returns false) when the session is inactive or has no busy sub-agent.
899
+ * Needs the server started with `OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true`
900
+ * (the bot always sets it); if not enabled the endpoint 400s and we swallow it.
901
+ * Best-effort — a failure must never block the prompt that follows it.
902
+ */
903
+ detachRunningSubagents(key: SessionKey): Promise<boolean>;
904
+ private resumeSessionInner;
905
+ /**
906
+ * @description Best-effort hydration for an idle resumed session's context
907
+ * usage. A live SSE observation wins over this historical read even when the
908
+ * history request resolves later.
909
+ */
910
+ private hydrateLatestParentAssistantContext;
911
+ /** @description Wait for a bounded slot before fetching optional history metadata. */
912
+ private acquireRuntimeContextHydrationSlot;
913
+ /** @description Hand a completed metadata-read slot to the next queued session. */
914
+ private releaseRuntimeContextHydrationSlot;
915
+ /**
916
+ * @description Ensure the single global SSE stream is open and the session's
917
+ * directory has its scheduler MCP registered (plan 2026-06-17). Called after
918
+ * a session is inserted active into `this.sessions` (start / resume / restart).
919
+ * The stream is shared by ALL sessions, so it opens only for the FIRST active
920
+ * session anywhere; later calls reuse it. Scheduler-MCP registration is per
921
+ * directory (decoupled from the stream), gated to once per dir per server
922
+ * generation. Keeps the `(key)` signature so the lifecycle paths and tests
923
+ * (which stub `connectSse` / `pollSseStream`) are unchanged.
924
+ */
925
+ private connectSse;
926
+ /**
927
+ * Re-register active directories once the bot scheduler listener is ready,
928
+ * for sessions that connected while injection was still inert. Boot binds
929
+ * the listener before re-attaching sessions, so it does not call this.
930
+ */
931
+ registerSchedulerMcpForActiveSessions(): void;
932
+ /**
933
+ * @description Boot self-heal for the adopt path. When the bot restarts and
934
+ * ADOPTS an already-running opencode (the server outlived the bot), that
935
+ * server still holds the PREVIOUS bot generation's `telegramBot` registration
936
+ * pointing at a now-dead ephemeral port — so every session in the directory
937
+ * reports the MCP `failed` and loses its scheduling / file-send tools. For
938
+ * each active session's directory (de-duped — a folder can host several
939
+ * threads), read the LIVE `GET /mcp` status and, when the `telegramBot` entry
940
+ * is missing or not `connected`, drop the Set gate and force a fresh POST (the
941
+ * server overwrites a same-name registration with the current port). A dir
942
+ * already `connected` is left untouched. Best-effort per directory: a read /
943
+ * registration error is logged and swallowed — it must never throw out of
944
+ * boot. Supersedes {@link registerSchedulerMcpForActiveSessions} at the boot
945
+ * call site (a not-yet-registered dir has no entry → treated as needing one).
946
+ */
947
+ reconcileSchedulerMcpForActiveSessions(): Promise<void>;
948
+ /**
949
+ * @description Boot step that makes every active directory's instance load the
950
+ * bot's compaction plugin. OpenCode reads plugins once per directory instance,
951
+ * so an instance created before the plugin file existed (a server that outlived
952
+ * the bot, actagent's included) never gets it on its own. Installs the file,
953
+ * then per directory (de-duped, concurrently) recreates the instance when it
954
+ * lacks the plugin and nothing in it is running. A recreated directory loses
955
+ * its runtime `telegramBot` registration, so its Set gate is dropped here and
956
+ * the boot caller reconciles the MCP right after.
957
+ */
958
+ activateCompactionPluginForActiveSessions(): Promise<void>;
959
+ /**
960
+ * @description One directory of {@link activateCompactionPluginForActiveSessions}:
961
+ * read its instance's plugin list and session status, and recreate it
962
+ * (`POST /instance/dispose`) only when the plugin is missing and every session
963
+ * is idle. Best-effort — errors are logged and swallowed.
964
+ */
965
+ private activateCompactionPluginForDirectory;
966
+ /**
967
+ * @description Reconcile ONE directory: read the live `GET /mcp` status and,
968
+ * when `telegramBot` is missing or not `connected`, drop the Set gate and
969
+ * force a fresh POST. Best-effort — a read/registration error is logged,
970
+ * scheduled for a retry, and swallowed so it never rejects out of
971
+ * {@link reconcileSchedulerMcpForActiveSessions}.
972
+ */
973
+ private reconcileSchedulerMcpForDirectory;
974
+ /**
975
+ * @description Retry a failed scheduler-MCP registration for `directory` after
976
+ * the next pause of {@link schedulerMcpRetryDelaysMs}. The retry runs the
977
+ * reconcile rather than a bare POST: a registration that timed out may have
978
+ * landed after all, and then nothing needs sending. A retry already pending
979
+ * covers a second failure, and one that fires after the folder's last session
980
+ * ended does nothing.
981
+ */
982
+ private scheduleSchedulerMcpRetry;
983
+ /** @description Forget `directory`'s pending registration retry: it is registered now. */
984
+ private clearSchedulerMcpRetry;
985
+ /**
986
+ * @description Mark a session inactive and tear down the global SSE stream IFF
987
+ * it was the LAST active session anywhere. The stream is reference-counted by
988
+ * the TOTAL active-session count (recomputed from `this.sessions` so it can
989
+ * never drift): any other active session — in any folder — keeps it open.
990
+ *
991
+ * Order-independent: callers vary in whether they pre-set `isActive = false`
992
+ * (`stopSessionInner` does, before calling here), so the decision counts OTHER
993
+ * active sessions and treats this one as departing. `before = other + 1`,
994
+ * `after = other` → `close` exactly when no sibling keeps the stream alive.
995
+ */
996
+ private disconnectSse;
997
+ /**
998
+ * @description Total count of currently-active sessions, optionally excluding
999
+ * one key (the departing session in a teardown decision) — the reference count
1000
+ * the single global stream's lifecycle keys on.
1001
+ */
1002
+ private countActiveSessions;
1003
+ /**
1004
+ * @description Open the single `/global/event` stream if it is not already
1005
+ * open (plan 2026-06-17). Idempotent — a second active session finds the
1006
+ * stream present and no-ops. The reader runs detached; a fatal start error
1007
+ * surfaces to every active session so the user isn't left with a silently-dead
1008
+ * session (audit S10 / #43).
1009
+ */
1010
+ private ensureGlobalStream;
1011
+ /**
1012
+ * @description Register the bot's scheduler MCP server for `directory`'s
1013
+ * OpenCode instance via the runtime `POST /mcp?directory=` endpoint (plan
1014
+ * 2026-06-17 S3). Idempotent on the server (re-POSTing the same `name`
1015
+ * overwrites/no-ops) and gated by `registeredSchedulerMcpDirs` so it runs once
1016
+ * per directory per server generation — `restartServer` clears the Set so a
1017
+ * dir is re-registered after the server's MCP table is wiped. Inert until
1018
+ * injection is configured — the builder returns `null` and this no-ops. A
1019
+ * registration FAILURE is logged, scheduled for a retry, and swallowed:
1020
+ * scheduling tools are an enhancement, the session must still start.
1021
+ */
1022
+ private registerSchedulerMcpForDirectory;
1023
+ /**
1024
+ * @description Tear down the global SSE stream: latch it closed, abort the
1025
+ * in-flight reader (unblocks `reader.read()` immediately — audit S7 / #12),
1026
+ * cancel its stall + reconnect timers, and drop the reference.
1027
+ */
1028
+ private closeGlobalStream;
1029
+ /** Emit an event to every active session. */
1030
+ private emitToAllActiveSessions;
1031
+ /**
1032
+ * @description Resolve model for the session. Priority:
1033
+ * 1. Thread's saved preference (from previous /model selection)
1034
+ * 2. OpenCode server's defaultModel (config.model -> model.json recent -> first provider)
1035
+ * 3. "not set"
1036
+ *
1037
+ * `emitOutput` controls whether the resolved `Model: <label>` line is sent to
1038
+ * the topic. A fresh `startSession` emits it (the user just opened the
1039
+ * session); a `resumeSession` after a bot restart re-resolves the SAME model
1040
+ * silently — the label is already in the topic from the previous run, so
1041
+ * re-emitting on every hot-restart is noise (B17). Resolution must still run
1042
+ * to repopulate `modelOverride`/`currentModelLabel` so `/effort` can read them.
1043
+ */
1044
+ private fetchModelInfo;
1045
+ /**
1046
+ * @description Fetch-based SSE reader for the single `/global/event` stream
1047
+ * (plan 2026-06-17). OpenCode sends every event as a `data:` line with a JSON
1048
+ * envelope `{ directory, payload: { type, properties } }`; this one stream
1049
+ * multiplexes every project instance, so each line is parsed once here and
1050
+ * routed by the envelope `directory` + `sessionID` to its owning session.
1051
+ *
1052
+ * On connection failure: checks if the server is alive, attempts a restart if
1053
+ * dead, and retries forever with capped exponential backoff until reconnect
1054
+ * succeeds — as long as the stream is still wanted (not closed).
1055
+ */
1056
+ private pollSseStream;
1057
+ /**
1058
+ * @description (Re)arm a stream's stall watchdog. OpenCode emits a
1059
+ * `server.heartbeat` every ~10 s, so a live stream always delivers bytes
1060
+ * within `sseStallTimeoutMs`; if none arrive the socket is silently dead
1061
+ * (open TCP, no FIN/RST) and `reader.read()` would park forever. Aborting the
1062
+ * controller unblocks the reader so `pollSseStream`'s catch path reconnects.
1063
+ * Re-armed on every chunk, so heartbeats keep a healthy stream alive.
1064
+ */
1065
+ private armSseStallWatchdog;
1066
+ /** Cancel a stream's stall watchdog if armed. Idempotent. */
1067
+ private clearStreamStallTimer;
1068
+ /**
1069
+ * @description Handle reconnection for the single global stream with server
1070
+ * health check, auto-restart, and exponential backoff. If the server is dead,
1071
+ * attempts a restart before reconnecting. Never gives up while the stream is
1072
+ * still wanted — reconnects until success — with backoff capped at
1073
+ * `maxSseReconnectDelayMs`. The only exits are an unrestartable server
1074
+ * (handled by `restartServer`) or a closed stream.
1075
+ */
1076
+ private handleSseReconnect;
1077
+ /**
1078
+ * @description Route a single raw SSE `data:` line from the global stream
1079
+ * (plan 2026-06-17). The JSON is parsed ONCE here, the owning session is
1080
+ * resolved from its sessionID/lineage (with an envelope-directory fallback),
1081
+ * and the event is dispatched to that session. The owning project instance
1082
+ * comes from the event ENVELOPE'S `directory` field — `/global/event` tags
1083
+ * every session event with it — so instance-local replies
1084
+ * (questions/permissions) target the right instance.
1085
+ *
1086
+ * Also the entry the SSE unit tests drive (a session injected into the map +
1087
+ * synthesized payload-wrapped envelope), so the real parse→route→dispatch
1088
+ * path is exercised end to end.
1089
+ */
1090
+ private routeSseData;
1091
+ /**
1092
+ * @description Resolve which thread (if any) should process `event`, applying
1093
+ * the single-owner invariant (B20) and recording subagent lineage. Owner
1094
+ * resolution is by sessionID (direct id, else lineage ancestor) with a
1095
+ * DIRECTORY fallback off the event ENVELOPE'S `directory` when both miss
1096
+ * (plan 2026-06-17). Returns:
1097
+ * - the owning thread's serialised key for a per-session event;
1098
+ * - `null` for a session-less event (`server.connected`/`heartbeat`) that
1099
+ * every reader handles directly;
1100
+ * - `undefined` to signal "do not dispatch" (missing sessionID, or no bound
1101
+ * thread owns the session — a genuine drop, loud-logged for every critical
1102
+ * type incl. question/permission, so a routable event is never a no-op).
1103
+ * Events for directories the bot does not own (the user's by-hand opencode
1104
+ * in other folders, now visible on the global stream) drop here cheaply.
1105
+ */
1106
+ private resolveSseEventOwner;
1107
+ /**
1108
+ * @description Handle a session-less event (`server.connected` /
1109
+ * `server.heartbeat`) — server-wide by design, with no owning topic. Kept
1110
+ * separate from {@link dispatchSseEvent} so the latter always has a real
1111
+ * owner key.
1112
+ */
1113
+ private dispatchSessionLessEvent;
1114
+ /**
1115
+ * @description Dispatch a normalised, OWNED SSE event to its owning session's
1116
+ * handlers. `key` is the resolved single owner (B20); `directory` is the
1117
+ * owning project instance (the event envelope's `directory`), used for
1118
+ * instance-scoped question / permission replies.
1119
+ */
1120
+ private dispatchSseEvent;
1121
+ private getSessionIdFromEvent;
1122
+ /**
1123
+ * @description Record a child→parent session link from ANY event that exposes
1124
+ * `parentID`, so subagent (child-session) events route to the topic bound to
1125
+ * the parent. Reliably populated by `session.updated` (its `info` carries the
1126
+ * child id + `parentID`); also reads a top-level `properties.parentID`
1127
+ * (paired with the event's session id) when a build emits it on other events,
1128
+ * so a child's link is known BEFORE its first routed event instead of dropping
1129
+ * "no owner" until the next `session.updated` beat (S2 durability). Root
1130
+ * sessions (no `parentID`) and non-session ids are ignored by
1131
+ * {@link updateSessionLineage}; the map is bounded by
1132
+ * `maxTrackedSessionLineageEntries`.
1133
+ */
1134
+ private trackSessionLineage;
1135
+ /** @description Store one child→parent link and diag-log it when it is new. */
1136
+ private recordSessionLineageLink;
1137
+ /**
1138
+ * @description Tear down any OTHER active thread already bound to
1139
+ * `sessionId` before `keyStr` adopts it (B20 prevention). One server-side
1140
+ * OpenCode session belongs to exactly one thread; if two threads held the
1141
+ * same id (e.g. resuming a session already live in another topic), the
1142
+ * server's multiplexed events would match BOTH and the same answer would
1143
+ * land in two topics. Detaching the stale owner keeps the single-owner
1144
+ * invariant true at the source, not just in dispatch.
1145
+ */
1146
+ private detachDuplicateSessionOwners;
1147
+ /**
1148
+ * @description Tear down a thread's local session tracking WITHOUT aborting
1149
+ * the server-side session. Used when another thread is adopting the same
1150
+ * server session (B20 prevention) — a normal `stopSessionInner` would abort
1151
+ * the shared generation. Mirrors `stopSessionInner` minus the abort POST.
1152
+ */
1153
+ private softDetachSession;
1154
+ /**
1155
+ * @description Resolve the SINGLE active thread that owns an SSE event for
1156
+ * `eventSessionId` (single-owner delivery, B20). Direct session-id match wins
1157
+ * over lineage descent; ties resolve deterministically. Returns the owning
1158
+ * thread's serialised key, or `null` if no active thread owns it.
1159
+ *
1160
+ * `refreshLineageOnUse` marks the lineage links walked to reach the owner as
1161
+ * most-recently-used, so an actively-routing child can never be the eviction
1162
+ * victim of the bounded lineage map (S2 durability) — only set on the live
1163
+ * routing path, never when merely probing.
1164
+ */
1165
+ private resolveEventOwnerKey;
1166
+ /** @description Every currently-active session as a routing `BoundSessionRef`. */
1167
+ private getActiveBoundSessions;
1168
+ /**
1169
+ * @description Directory fallback (plan 2026-06-17): resolve an owner from the
1170
+ * event envelope's `directory` when id/lineage resolution already failed.
1171
+ * `/global/event` tags every session event with its owning folder, so an event
1172
+ * provably belongs to a thread bound to that folder — and an event for a
1173
+ * directory with no active bound session (the user's by-hand opencode
1174
+ * elsewhere) resolves to `null` and is dropped. SYNC — uses only in-memory
1175
+ * session state, NEVER an HTTP call on the per-event hot path. Delegates the
1176
+ * decision to the pure {@link resolveOwnerByDirectoryFallbackPure}; the wiring
1177
+ * here is just selecting the directory's active sessions.
1178
+ */
1179
+ private resolveOwnerByDirectoryFallback;
1180
+ /**
1181
+ * @description Diag-log one "sse drop" line for an event no thread owns,
1182
+ * throttled to at most once per (eventType, eventSessionId) per
1183
+ * `sseDropLogThrottleMs`. Without throttling an orphaned session's delta
1184
+ * firehose floods the diag log — once per delta per bound thread (B19).
1185
+ */
1186
+ private logSseDropOncePerWindow;
1187
+ /**
1188
+ * @description Handle streaming part updates from assistant response.
1189
+ * Two event formats:
1190
+ * message.part.updated: { part: OpenCodePart, delta?: string }
1191
+ * message.part.delta: { sessionID, messageID, partID, field, delta }
1192
+ *
1193
+ * Text parts are accumulated and emitted as 'output' (permanent messages).
1194
+ * Tool, reasoning, step-* parts are emitted as 'status' (transient messages).
1195
+ *
1196
+ * `isSubagent` (resolved ONCE in `dispatchSseEvent`) marks parts streamed by
1197
+ * a CHILD session (sub-agent); they are routed per the
1198
+ * {@link getSubagentPartAction} matrix instead of the parent's handlers, so
1199
+ * a child transcript can never merge unmarked into the parent's reply (S4).
1200
+ */
1201
+ private handlePartUpdate;
1202
+ /**
1203
+ * @description Handle text delta — accumulate and emit as 'output'. Text of the
1204
+ * compaction summary message marks the accumulated response as that summary.
1205
+ */
1206
+ private handleTextDelta;
1207
+ /**
1208
+ * @description Emit only the part of `currentResponseText` not yet sent as
1209
+ * an `output` event, then advance `lastEmittedLength`. The bot does not
1210
+ * delta-render OpenCode output (`outputsDeltas` is unset), so each emit is a
1211
+ * raw tail of the in-flight response — possibly cut mid-word.
1212
+ *
1213
+ * Every tail except the FIRST of a response carries `isContinuation: true`
1214
+ * (a {@link OutboundHints}). The bot appends a continuation tail to the
1215
+ * same growing Telegram message instead of starting a new one, so the long
1216
+ * reply reads as one message rather than each edit replacing the previous
1217
+ * text. `lastEmittedLength === 0` means this is the first tail of a fresh
1218
+ * response (nothing emitted yet), so it is NOT a continuation. `flushOutput`
1219
+ * resets `lastEmittedLength` to 0 after the final tail, so the next response
1220
+ * again starts with a non-continuation first tail.
1221
+ */
1222
+ private emitResponseTail;
1223
+ /**
1224
+ * @description Handle a SUB-AGENT (child session) text part per the
1225
+ * mode×kind matrix ({@link getSubagentPartAction}):
1226
+ *
1227
+ * - `compact` → never touch any accumulator; signal the dedicated
1228
+ * `subagentStatus` event instead (the bot owns a single self-updating
1229
+ * "🤖 sub-agent: <title> · m:ss" message + elapsed timer). This replaced
1230
+ * the old shared-status refresh, whose lost single-message identity between
1231
+ * sparse bursts re-`sendMessage`d a new message each time (the flood bug).
1232
+ * - `full` → accumulate into the SEPARATE child accumulator and flush via
1233
+ * the same debounce discipline as {@link handleTextDelta} — never through
1234
+ * `currentResponseText` (a child transcript in the parent accumulator
1235
+ * would corrupt the parent reply's continuation accounting).
1236
+ */
1237
+ private handleSubagentTextPart;
1238
+ /**
1239
+ * @description Emit the unsent tail of the CHILD (sub-agent) accumulator as
1240
+ * a marked `output` event (`meta.isSubagent`, `/subagent full` mode only).
1241
+ * Mirrors {@link emitResponseTail} over the dedicated child fields so the
1242
+ * parent's emit cursor is never advanced by child text. Carries NO
1243
+ * `isContinuation`: the bot renders every sub-agent chunk as its own marked
1244
+ * message outside the parent's edit-in-place chain (acceptable v1 — `full`
1245
+ * is opt-in). The empty-string guard doubles as runtime tolerance for test
1246
+ * fixtures that inject minimal session shapes.
1247
+ */
1248
+ private emitChildResponseTail;
1249
+ /**
1250
+ * @description Is this part the delegation (`task`) tool still in flight
1251
+ * (pending/running)? Drives both the delegation-title tracking and the
1252
+ * dedicated "🤖 Delegating: <title> …" activity status (S5) — once the
1253
+ * delegation completes/errors the generic ✅/❌ status forms take over.
1254
+ */
1255
+ private checkIsDelegationInFlight;
1256
+ /**
1257
+ * @description Read the delegation's title off a `task` tool part's state:
1258
+ * the explicit `title` when present, else the prompt `description` from the
1259
+ * tool input. `null` when the part carries neither (the status builders fall
1260
+ * back to a localized generic label).
1261
+ */
1262
+ private getDelegationTitle;
1263
+ /**
1264
+ * @description Record / clear the CURRENT delegation's title from the
1265
+ * PARENT's `task` tool part: stored while the delegation is pending/running
1266
+ * (feeds the dedicated sub-agent status message; S5's "Delegating" activity
1267
+ * status reuses this field), cleared once it completes/errors. Only ever
1268
+ * called for the parent's own parts — a child's nested `task` must not
1269
+ * overwrite the parent-level title.
1270
+ *
1271
+ * The title is STICKY (D2 fix): while in-flight we only OVERWRITE it with a
1272
+ * non-null title — a beat where the `task` part momentarily lacks
1273
+ * title/description leaves the last known title intact, instead of clobbering
1274
+ * it to `null` mid-run (which made the line read "sub-agent: sub-agent").
1275
+ * It is cleared to `null` only on the terminal (completed/error) part.
1276
+ */
1277
+ private trackDelegationTitle;
1278
+ /**
1279
+ * @description Handle tool part — format and emit as 'status'.
1280
+ */
1281
+ private handleToolPart;
1282
+ /**
1283
+ * @description Emit the dedicated MODE-AGNOSTIC `toolResult` event once a
1284
+ * tool part reaches `completed` with a non-empty output (S3). The bot
1285
+ * resolves the per-thread tool-results mode (`minimal` drops it there) — the
1286
+ * adapter emits every result exactly once, guarded by
1287
+ * {@link OpenCodeSession.emittedToolResultPartIds} against the re-sent part
1288
+ * shapes. The output is kept strictly OUT of `currentResponseText` so it can
1289
+ * never pollute the answer or its continuation accounting.
1290
+ */
1291
+ private maybeEmitToolResult;
1292
+ /** Debounce delay (ms) for live `thinking` emits — the reasoning delta
1293
+ * stream is chatty, so live frames are coalesced like text deltas. */
1294
+ private static readonly reasoningLiveEmitMs;
1295
+ /**
1296
+ * @description Handle a reasoning (chain-of-thought) part.
1297
+ *
1298
+ * Reasoning text is accumulated into {@link OpenCodeSession.reasoningText}
1299
+ * — kept STRICTLY separate from `currentResponseText` so it never leaks into
1300
+ * the answer — and surfaced through the DEDICATED `thinking` event (not the
1301
+ * generic `status` coalescer), so the thinking indicator can persist
1302
+ * independently of tool status. The adapter stays MODE-AGNOSTIC: it emits the
1303
+ * raw accumulated text + phase, and the bot applies the per-thread mode.
1304
+ *
1305
+ * On the FIRST reasoning delta of a response we record `reasoningStartedAt`
1306
+ * (drives the "thought for {N}s" duration on the eventual `done` emit). Live
1307
+ * emits are debounced.
1308
+ */
1309
+ private handleReasoningPart;
1310
+ /**
1311
+ * @description Emit the `thinking` event for the current phase. `live` carries
1312
+ * the accumulated reasoning text so far; `done` adds the elapsed `durationMs`.
1313
+ */
1314
+ private emitThinking;
1315
+ /**
1316
+ * @description End the current response's reasoning stream, if one is active.
1317
+ * Flushes any pending live frame, emits the `thinking` `done` event (so the
1318
+ * bot can collapse / persist per mode), and resets the per-response reasoning
1319
+ * accumulator. Idempotent — a no-op when no reasoning is in flight, so it can
1320
+ * be called from every "reasoning end" signal (first non-reasoning part,
1321
+ * `message.updated` finish, `session.idle`) without double-emitting.
1322
+ */
1323
+ private endReasoning;
1324
+ /** Debounce delay (ms) for status updates to avoid Telegram rate limits */
1325
+ private static readonly statusDebounceMs;
1326
+ /**
1327
+ * @description Debounced emit of 'status' event.
1328
+ * Rapid status updates (e.g. multiple tool state changes) are batched —
1329
+ * only the latest status text is emitted after a quiet period.
1330
+ */
1331
+ private emitStatus;
1332
+ /**
1333
+ * @description Handle message completion.
1334
+ * Event properties: { info: OpenCodeMessageInfo }
1335
+ */
1336
+ private handleMessageUpdate;
1337
+ /**
1338
+ * @description Handle session becoming idle (AI done processing).
1339
+ * Flush any remaining accumulated output.
1340
+ */
1341
+ private handleSessionIdle;
1342
+ /**
1343
+ * @description Track live busy/idle/retry from `session.status`. The own
1344
+ * session's status drives {@link OpenCodeSession.isBusy}; provider-managed
1345
+ * retry remains busy and is surfaced once, because OpenCode otherwise accepts
1346
+ * later prompts into an unread queue with no user-visible explanation. A
1347
+ * lineage-verified child
1348
+ * (sub-agent) status maintains {@link OpenCodeSession.busyChildSessionIds}
1349
+ * so a new prompt never aborts a running sub-agent. A foreign non-descendant
1350
+ * session's busy=true (dir-fallback-routed wedged sibling) is ignored —
1351
+ * see {@link applyOpenCodeStatusEvent}.
1352
+ */
1353
+ private handleSessionStatus;
1354
+ /**
1355
+ * @description Strict-descendant verification for busy tracking: `true` only
1356
+ * when `eventSessionId` walks up the lineage map to `ownSessionId` — never
1357
+ * for the own id itself or a foreign sibling. Distinct from
1358
+ * {@link checkIsEventForSession} (own-or-descendant), which routing uses.
1359
+ */
1360
+ private checkIsVerifiedDescendant;
1361
+ /**
1362
+ * @description Diag-log one "busy-ignored" line for a foreign non-descendant
1363
+ * busy=true that busy tracking refused to record, throttled per session id
1364
+ * like {@link logSseDropOncePerWindow} — a wedged sibling re-emits
1365
+ * `session.status` every ~30 s and would otherwise flood the diag log.
1366
+ */
1367
+ private logForeignBusyIgnoredOncePerWindow;
1368
+ /**
1369
+ * @description Flip the compaction flag from `session.next.compaction.*` /
1370
+ * `session.compacted` events. While set, a new prompt queues instead of
1371
+ * aborting (an abort would discard the in-progress summary).
1372
+ */
1373
+ private setCompacting;
1374
+ private handleSessionError;
1375
+ private handlePermissionAsked;
1376
+ /**
1377
+ * @description Handle question.asked events from OpenCode.
1378
+ * Stores the pending question and emits a 'question' event so the bot
1379
+ * can display it to the user with interactive buttons.
1380
+ *
1381
+ * Event properties: { id, sessionID, questions: QuestionInfo[], tool? }
1382
+ */
1383
+ private handleQuestionAsked;
1384
+ /**
1385
+ * @description Re-surface a question that was still open on the server when
1386
+ * the bot lost track of it — the reattach/resume path rebuilds the session
1387
+ * with `pendingQuestion: null`, so after ANY bot restart an unanswered
1388
+ * question would otherwise be forgotten and the topic hangs forever (the
1389
+ * break-out that turns a user message into the ANSWER never fires, and a
1390
+ * fresh prompt just queues behind the still-blocked turn).
1391
+ *
1392
+ * `GET /question?directory=<workDir>` returns the instance's live open
1393
+ * questions; we pick the entry owned by this session, rebuild
1394
+ * `session.pendingQuestion`, and emit `question` so the existing bot handler
1395
+ * re-posts the option buttons and repopulates (and persists) its pending map.
1396
+ * Reply id is the entry's top-level `id` (`que_…`), resolved by the pure
1397
+ * {@link getOpenQuestionForSession} helper.
1398
+ *
1399
+ * Best-effort: a read/parse failure is logged and swallowed — it must never
1400
+ * throw out of reattach. Only meaningful on the resume/reattach path; a
1401
+ * brand-new session (startSession) has no history and thus no open question,
1402
+ * so it is deliberately NOT called there.
1403
+ */
1404
+ private restoreOpenQuestion;
1405
+ /**
1406
+ * @description Backstop predicate (G2): is this session's turn wedged behind
1407
+ * an open interactive question? The authoritative signal is the server's own
1408
+ * `GET /question?directory=<workDir>` returning an entry for this session —
1409
+ * a turn that is merely streaming text / running a normal tool / has a live
1410
+ * sub-agent has NO open question, so it is never reported wedged (no
1411
+ * regression: an arriving prompt still queues-and-is-picked-up for a healthy
1412
+ * busy turn). The bot consults this only when a fresh prompt would otherwise
1413
+ * queue behind a busy session with no known pending question; on `true` it
1414
+ * aborts the dead turn before forwarding instead of queueing forever.
1415
+ *
1416
+ * Best-effort: a read/parse failure returns `false` (don't abort on doubt).
1417
+ */
1418
+ checkIsWedgedOnQuestion(key: SessionKey): Promise<boolean>;
1419
+ /**
1420
+ * @description Reply to a pending question with user-selected answers.
1421
+ * Called by the bot when the user clicks an inline button or types a custom answer.
1422
+ */
1423
+ answerQuestion(key: SessionKey, answers: string[][]): void;
1424
+ /**
1425
+ * @description Reject a pending question server-side WITHOUT answering it —
1426
+ * called when the user ABANDONS the question (sends a fresh prompt instead of
1427
+ * answering, or the session is torn down while it is pending). Mirrors
1428
+ * {@link answerQuestion} but POSTs to `/question/:id/reject` (empty body)
1429
+ * instead of `/reply`. Without it the question stays "open" in the server's
1430
+ * registry and {@link restoreOpenQuestion} re-surfaces it on every reattach.
1431
+ * No-op if no active session / no pending question.
1432
+ */
1433
+ rejectQuestion(key: SessionKey): void;
1434
+ private flushOutput;
1435
+ /**
1436
+ * @description Defensive close of the dedicated sub-agent status when the
1437
+ * PARENT's own turn ends (its assistant message finishes, or its session goes
1438
+ * idle) so a dangling "working" indicator can't outlive the turn if the
1439
+ * terminal `task` part was missed. Strictly parent-only: a CHILD (sub-agent)
1440
+ * message finishing / going idle must NOT close it — the delegation is still
1441
+ * in flight (its child events route here via lineage). The bot no-ops the
1442
+ * close when nothing is open.
1443
+ */
1444
+ private closeSubagentStatusOnParentTurnEnd;
1445
+ }
1446
+ //# sourceMappingURL=openCodeAdapter.d.ts.map