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