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,1022 @@
1
+ import { EventEmitter } from 'events';
2
+ import type { Locale } from './i18n';
3
+ import type { OpenCodeAuthMethod } from './utils/openCodeAuthLogin';
4
+ import type { McpHealOutcome } from './utils/claudeMcpHeal';
5
+ import type { SessionKey } from './sessionKey';
6
+ import type { OutboundHints } from './platform/outbound';
7
+ import type { FallbackChainEntry } from './utils/fallbackChain';
8
+ export interface AgentSession {
9
+ id: string;
10
+ title: string;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ }
14
+ /**
15
+ * @description One conversational turn (a single user OR assistant message that
16
+ * carries renderable text) of a resumable session, used to build the short
17
+ * "↩️ Resumed — last N messages" context block shown on resume instead of
18
+ * flooding the topic with the whole restored transcript. Tool-call / step /
19
+ * meta records are NOT turns. See `src/resumeContext.ts`.
20
+ */
21
+ export interface RecentTurn {
22
+ role: 'user' | 'assistant';
23
+ text: string;
24
+ }
25
+ /**
26
+ * @description Per-thread "seen" watermark — how far the LIVE relay had shown
27
+ * the agent's persistent record at the last turn end. Persisted in `state.json`
28
+ * on the agent row (next to the session ids) so a bot restart can tell how much
29
+ * output the agent produced WHILE the bot was down (and recover it via the
30
+ * reattach recap) instead of silently losing it.
31
+ *
32
+ * Backend representations live side by side (only one is set per row, mirroring
33
+ * `claudeSessionId` / `opencodeSessionId`):
34
+ * - OpenCode → the last completed assistant message `id` of the turn.
35
+ * - Claude → the transcript `.jsonl` byte offset (file size) at turn end.
36
+ *
37
+ * `sessionId` scopes the watermark to the session it was taken against: it
38
+ * survives `/new` (which keeps the agent row) and `/sessions` resume (which
39
+ * merges onto it), so on a later read the recap MUST verify the stored id still
40
+ * matches the session being recapped — otherwise an old session's offset/id
41
+ * cross-applies to a different transcript and yields a garbage count. A
42
+ * mismatch is treated as "watermark unknown" (the no-count fallback).
43
+ */
44
+ export interface SeenWatermark {
45
+ sessionId: string;
46
+ opencodeMessageId?: string;
47
+ claudeTranscriptOffset?: number;
48
+ }
49
+ /**
50
+ * @description Adapter-side callback that advances the per-thread
51
+ * {@link SeenWatermark} at turn end. Injected at boot via the same DI seam as
52
+ * {@link DisplayPrefsReader} (`createAdapter.registerSeenWatermarkWriter`),
53
+ * wired in `bot.ts` to `state.setSeenWatermark`. Inert (no-op) until registered,
54
+ * so an embedded / test caller that never wires it simply skips watermarking.
55
+ */
56
+ export type SeenWatermarkWriter = (key: SessionKey, watermark: SeenWatermark) => void;
57
+ /**
58
+ * @description Per-thread json-stream stdout tail position — how far the bot
59
+ * has consumed the EXTERNAL claude process's `stdout.jsonl` (plan
60
+ * 2026-07-05-jsonstream-restart-isolation). Persisted in `state.json` on the
61
+ * agent row so a restarted bot resumes tailing exactly where it left off and
62
+ * replays only what was produced during the downtime. `offsetBytes` always
63
+ * lands on a LINE BOUNDARY (see `getStdoutLineBoundaryOffset`), so the resumed
64
+ * tail never starts on a torn JSON line. `sessionId` scopes the offset to the
65
+ * session's own stdout file — a mismatch on adopt means the file belongs to a
66
+ * different run and the tail seeds to the current EOF instead.
67
+ */
68
+ export interface JsonStreamTailOffset {
69
+ sessionId: string;
70
+ offsetBytes: number;
71
+ /**
72
+ * The CLI's background-task list as of `offsetBytes` (`task_id`s of the last
73
+ * `background_tasks_changed` frame before it). Frames before the offset are
74
+ * not replayed on adopt, so the list rides along with the offset; a row
75
+ * written before the list was tracked has none, which reads as "no tasks".
76
+ */
77
+ backgroundTaskIds?: string[];
78
+ /** The CLI version the process reported on its `init` (`claude_code_version`), restored on adopt for the auto-stop gate (L-D10). */
79
+ claudeCodeVersion?: string;
80
+ /**
81
+ * Whether a turn was in flight as of `offsetBytes` — set when a user turn is
82
+ * written, cleared by its `result`. Restored on adopt so a process in a long,
83
+ * silent tool call across a restart (no frame after the offset to rebuild it
84
+ * from) still reads as working (L-D2) and is never stopped mid-turn.
85
+ */
86
+ isTurnInFlight?: boolean;
87
+ /**
88
+ * The tool calls in flight as of `offsetBytes` (`tool_use` ids whose
89
+ * `tool_result` had not returned). Restored on adopt with the flag above:
90
+ * an outstanding tool is what vetoes the busy-idle watchdog, so without it a
91
+ * restored turn in a long, silent tool call would be declared idle after the
92
+ * watchdog's silence window and stopped mid-call after all.
93
+ */
94
+ outstandingToolUseIds?: string[];
95
+ }
96
+ /**
97
+ * @description Adapter-side callback that persists the {@link JsonStreamTailOffset}
98
+ * as the json-stream tail consumes stdout lines. Same DI seam and inert-until-
99
+ * registered semantics as {@link SeenWatermarkWriter}; wired in `bot.ts` to
100
+ * `state.setJsonStreamTail`.
101
+ */
102
+ export type JsonStreamTailWriter = (key: SessionKey, tail: JsonStreamTailOffset) => void;
103
+ /**
104
+ * @description Result of {@link AgentAdapter.getReattachRecap} — the data the
105
+ * bot needs to assemble the post-restart recap for one thread.
106
+ *
107
+ * - `missedCount` — number of AGENT (assistant) messages produced during the
108
+ * downtime, computed from the persisted {@link SeenWatermark}. `0` when none
109
+ * were missed (a clean hot reload) → the bot posts nothing.
110
+ * - `turns` — the last few conversational turns (already capped), rendered as
111
+ * the recap body regardless of `missedCount` (the count line conveys scale).
112
+ * - `isWatermarkKnown` — whether the watermark was trusted and located in the
113
+ * record. `false` (first run after ship, pruned transcript, crash before any
114
+ * watermark) → the bot uses the no-number fallback header.
115
+ * - `isActive` — best-effort "the agent is still working right now" signal,
116
+ * read cheaply from in-memory state; drives the trailing status line.
117
+ * - `headWatermark` — the watermark value meaning "everything currently in the
118
+ * session's record is accounted for" (the session's CURRENT tail: Claude →
119
+ * transcript byte size, OpenCode → latest assistant message id). The bot
120
+ * persists this AFTER computing the recap — whether or not a recap posted —
121
+ * so the same gap can never re-report on the next reattach (idempotency).
122
+ * Absent when the record was unreadable (head unknown → the bot skips the
123
+ * advance and retries on the next reattach).
124
+ */
125
+ export interface ReattachRecap {
126
+ missedCount: number;
127
+ turns: RecentTurn[];
128
+ isWatermarkKnown: boolean;
129
+ isActive: boolean;
130
+ headWatermark?: SeenWatermark;
131
+ }
132
+ /**
133
+ * @description Options for {@link AgentAdapter.resumeSession}.
134
+ */
135
+ export interface ResumeSessionOptions {
136
+ /**
137
+ * Post the "↩️ Resumed — last N messages" context block to the topic.
138
+ * Set ONLY on the explicit user resume (`/sessions` pick) — silent
139
+ * re-attach after a bot restart and crash-recovery resumes must stay
140
+ * quiet, otherwise every hot rebuild spams every active topic.
141
+ */
142
+ isWithRecentContext?: boolean;
143
+ }
144
+ /**
145
+ * @description One tappable option of an interactive agent question
146
+ * (OpenCode's `ask`/question tool). `description` is shown beneath the label
147
+ * when present.
148
+ */
149
+ export interface OpenCodeQuestionOption {
150
+ label: string;
151
+ description?: string;
152
+ }
153
+ /**
154
+ * @description One question of an interactive agent prompt. `multiple` means
155
+ * several options may be selected. The bot renders one Telegram message per
156
+ * question with an inline button per option.
157
+ */
158
+ export interface OpenCodeQuestion {
159
+ question: string;
160
+ header?: string;
161
+ options: OpenCodeQuestionOption[];
162
+ multiple?: boolean;
163
+ }
164
+ /**
165
+ * @description A pending interactive question the agent is blocked on, awaiting
166
+ * the user's answer. Plain serialisable data (no functions / class instances)
167
+ * so it can be persisted in `state.json` and restored after a bot restart —
168
+ * which is the whole point: without persistence the in-memory pending-question
169
+ * map is lost on restart, the agent's question tool hangs forever, and the
170
+ * existing Telegram option buttons go dead. Lives here (a leaf module both
171
+ * `bot.ts` and `state.ts` already import) rather than in `openCodeAdapter.ts`
172
+ * so persisting it does not create a `state.ts → adapter → types` import cycle.
173
+ */
174
+ export interface OpenCodePendingQuestion {
175
+ requestId: string;
176
+ questions: OpenCodeQuestion[];
177
+ /**
178
+ * Project-instance directory that owns the question request (from the
179
+ * `/global/event` envelope). The reply must select the same instance via
180
+ * `?directory=` — see `buildDirectoryScopedPath` in `openCodeAdapter.ts`.
181
+ */
182
+ directory?: string;
183
+ }
184
+ /**
185
+ * @description The bot's per-thread record of an interactive question on screen:
186
+ * the question {@link OpenCodePendingQuestion} plus the Telegram `messageId`
187
+ * of the posted option-button message (`null` until `replyToThread` resolves).
188
+ * All fields are serialisable, so the whole record is persisted to `state.json`
189
+ * and restored at boot for threads whose session reattached — re-arming the
190
+ * existing buttons so a restart no longer hangs the agent.
191
+ *
192
+ * Sequential multi-question: when the agent asks more than one question in a
193
+ * turn, the bot shows them ONE AT A TIME and collects the answers locally,
194
+ * replying to the agent only once EVERY question is answered (OpenCode's reply
195
+ * API takes the whole answer matrix at once). The progress lives here so it
196
+ * survives a restart:
197
+ * - `answers` — one slot per question (same order as `data.questions`), `null`
198
+ * until that question is answered, then the chosen labels/text;
199
+ * - `currentIndex` — which question is currently on screen;
200
+ * - `messageId` — the Telegram message id of the CURRENTLY shown question.
201
+ */
202
+ export interface PendingQuestionState {
203
+ data: OpenCodePendingQuestion;
204
+ messageId: number | null;
205
+ /** One slot per question (null = unanswered). Length === questions.length. */
206
+ answers: (string[] | null)[];
207
+ /** Index into `data.questions` of the question currently on screen. */
208
+ currentIndex: number;
209
+ }
210
+ /**
211
+ * @description Classification of a provider-side API error surfaced by either
212
+ * agent backend (Claude terminal "API Error" line or OpenCode `session.error`).
213
+ * Drives the retry/surface decision: `transient` (rate-limit / overloaded —
214
+ * short backoff) vs `usageLimit` (subscription / quota exhausted — long wait)
215
+ * vs `auth` (logged out / bad credentials). `auth` is SURFACED, not retried — a
216
+ * wait never fixes it (the user must re-`/login`, or the OpenCode server needs a
217
+ * restart) — so the bot posts a pinned notice instead of arming a timer.
218
+ */
219
+ export interface AgentApiErrorClass {
220
+ kind: 'transient' | 'usageLimit' | 'auth';
221
+ /** Epoch ms when a usage window resets, if the error text exposed one. */
222
+ resetAt?: number;
223
+ }
224
+ /**
225
+ * @description The bot's per-thread record of an armed auto-retry after a
226
+ * provider-side API error: the error {@link AgentApiErrorClass.kind} that armed
227
+ * it, the 1-based attempt already scheduled, and the epoch-ms `fireAt` when the
228
+ * retry timer should fire. No prompt is stored — the kick is a neutral "continue"
229
+ * nudge that resumes the agent's intact session, not a re-send of the original
230
+ * prompt. No adapter name either — the kick reuses the thread's existing
231
+ * last-used adapter via `ensureAgentSession`. All fields are serialisable, so the
232
+ * whole record is persisted to `state.json` and re-armed at boot — a multi-hour
233
+ * usage-limit wait survives a restart. The record means ARMED: it is removed when
234
+ * the retry stops being armed (cancelled, given up, or its kick ran its course — the
235
+ * nudge forwarded, or dropped for good), so a restart never restores a retry that is
236
+ * already spent. A nudge still waiting in the startup buffer behind a session start
237
+ * has not run its course: the buffer is in memory, so the record stays until the
238
+ * buffer replays or drops it.
239
+ */
240
+ export interface ApiRetryState {
241
+ kind: AgentApiErrorClass['kind'];
242
+ /** 1-based attempt already scheduled. */
243
+ attempt: number;
244
+ /** Epoch ms when the retry timer should fire. */
245
+ fireAt: number;
246
+ /**
247
+ * A usage-limit wait that ends on ANOTHER rung of the fallback chain (the one whose limit resets earliest,
248
+ * `utils/fallbackChain.ts`): the resume moves the topic there before the continue nudge. Absent = the topic
249
+ * continues where it is. Persisted, so a restart keeps the target.
250
+ */
251
+ resumeOn?: FallbackChainEntry;
252
+ }
253
+ /**
254
+ * @description IDENTITY of a json-stream session's `stdout.jsonl` — its byte size
255
+ * plus mtime. Recorded (`state.json` `limitEpisodesRecovered`) when the boot
256
+ * recovery arms a limit wait from that log's trailing error, and compared against
257
+ * the live stat on every later boot: an UNCHANGED log means nothing has happened
258
+ * since we handled that error, so re-arming would resurrect a wait the user (or a
259
+ * give-up) already settled. Any real turn appends frames, which changes the
260
+ * identity — so a genuinely NEW trailing error is handled again.
261
+ */
262
+ export interface LimitEpisodeMarker {
263
+ sizeBytes: number;
264
+ mtimeMs: number;
265
+ }
266
+ /**
267
+ * @description THE unified verbosity vocabulary for every per-thread display
268
+ * preference (`/thinking`, `/tool_results`, `/subagent`). Per-thread, persisted
269
+ * (see `state.ts` `displayPrefs`). A bot-RENDERING concern only — it never
270
+ * changes what is sent to the agent. Default for every pref is `minimal`.
271
+ *
272
+ * Per-command semantics (the live "working" indicators show in ALL modes;
273
+ * the mode only controls what REMAINS in the topic):
274
+ *
275
+ * - thinking:
276
+ * - `full` → the full reasoning text streams in and STAYS after the answer.
277
+ * - `short` → live "thinking …" while reasoning, then collapses to a single
278
+ * "thought for {N}s" line that STAYS.
279
+ * - `minimal` → live "thinking …" shown, but REMOVED once the answer starts.
280
+ * - toolResults:
281
+ * - `full` → the tool result is rendered in full, fenced.
282
+ * - `short` → the result is truncated to a cap (lines + chars) with a footer.
283
+ * - `minimal` → only the transient "🔧 …" status, no result body.
284
+ * - subagent (OpenCode: child session; Claude: Task-tool child, tailed from its
285
+ * on-disk transcript) — the "working" indicator is NEVER hidden (locked):
286
+ * - `full` → child TEXT is additionally streamed, each chunk marked as
287
+ * sub-agent.
288
+ * - `short` → child transcript is NOT streamed (OpenCode shows a single live
289
+ * "🤖 sub-agent: <title> …" status; Claude's own ◯ task-panel
290
+ * line rolls inside the coalesced status frame).
291
+ * - `minimal` → v1: EXACTLY the same as `short` (status-only) — accepted so
292
+ * the vocabulary stays uniform across the three commands.
293
+ *
294
+ * Old persisted/typed names (`detailed`/`brief`/`hide`/`compact`) are mapped
295
+ * to this vocabulary at read/parse time — see
296
+ * `utils/displayVerbosity.normalizeDisplayVerbosityMode`.
297
+ */
298
+ export type DisplayVerbosityMode = 'minimal' | 'short' | 'full';
299
+ /**
300
+ * @description What a Telegram topic SHOWS of the agent's work (request/answer
301
+ * plan S6), set per topic through `/verbosity` and persisted with the display
302
+ * prefs. `stream` is today's behaviour (the default); `streamAnswers` adds the
303
+ * agent's `answer_request` answers, pinned, and turns requests on; `answers`
304
+ * hides the agent's stream and shows only the pinned answers, the typing
305
+ * indicator, native questions, files and the bot's own notices. Rules live in
306
+ * `utils/topicView.ts`.
307
+ */
308
+ export type TopicView = 'stream' | 'streamAnswers' | 'answers';
309
+ /**
310
+ * @description Reader for a thread's FULL resolved display preferences, injected
311
+ * into BOTH adapters at boot (`createAdapter.registerDisplayPrefsReader`, S4).
312
+ * Generalises the former single-pref `SubagentModeReader`: the adapters now need
313
+ * more than the sub-agent mode at PRODUCE time — Claude's relay classifies each
314
+ * scraped chunk and routes tool / panel segments per the `toolResults` pref too
315
+ * (S4), so one reader returning every pref is wired instead of N parallel
316
+ * injections. The sub-agent branch still derives `.subagent` from it.
317
+ *
318
+ * Why a live read (not the bot's render-time resolution used for thinking /
319
+ * tool-result OpenCode events): OpenCode branches a child part on its SSE hot
320
+ * path (compact refreshes a status, full streams into a separate child
321
+ * accumulator) and Claude's poll loop decides whether to read + relay tool
322
+ * bodies — both are adapter-side decisions that cannot be deferred. Until
323
+ * registered, both adapters fall back to all-fields-`minimal`.
324
+ */
325
+ export type DisplayPrefsReader = (key: SessionKey) => ResolvedThreadDisplayPrefs;
326
+ /**
327
+ * @description Reader for a thread's resolved UI locale, injected into BOTH
328
+ * adapters at boot (`createAdapter.registerThreadLocaleReader`). The adapters
329
+ * call `t(...)` on their own hot paths (Claude's poll loop formats question
330
+ * hints / tool-result status; OpenCode's SSE handler builds delegation status)
331
+ * OUTSIDE the bot's `withThreadLocale` wrapper — those `t(...)` calls would
332
+ * otherwise fall back to `en` regardless of the chat's locale. With this
333
+ * reader the adapter wraps the `t(...)` call in `runWithLocale(reader(key))`.
334
+ * Until registered, the adapters fall back to {@link defaultLocale} (`en`).
335
+ */
336
+ export type ThreadLocaleReader = (key: SessionKey) => Locale;
337
+ /**
338
+ * @description Per-thread bot-rendering preferences for agent output
339
+ * verbosity. Each field is optional: an absent field means "use the locked
340
+ * default" (`minimal` for all three), so the persisted record only stores
341
+ * non-default overrides — keeping `state.json` clean (same
342
+ * delete-when-default idiom as the `/trace` toggle).
343
+ *
344
+ * On disk a field may still hold a LEGACY mode name
345
+ * (`detailed`/`brief`/`hide`/`compact`) written before the vocabulary was
346
+ * unified; `state.ts`'s `getDisplayPrefs` normalizes those at read time, so
347
+ * the declared {@link DisplayVerbosityMode} type holds for every consumer.
348
+ *
349
+ * These are bot-side rendering concerns, NOT agent behavior: they live in
350
+ * `state.json` per-thread (NOT the adapter pref files) and do not change what
351
+ * is sent to the agent.
352
+ */
353
+ export interface ThreadDisplayPrefs {
354
+ thinking?: DisplayVerbosityMode;
355
+ toolResults?: DisplayVerbosityMode;
356
+ subagent?: DisplayVerbosityMode;
357
+ view?: TopicView;
358
+ }
359
+ /**
360
+ * @description Fully-resolved per-thread display preferences — every field is
361
+ * present because the locked default is applied when the persisted record omits
362
+ * it. Returned by the state store's getter so callers on the hot path never have
363
+ * to re-apply defaults themselves.
364
+ */
365
+ export interface ResolvedThreadDisplayPrefs {
366
+ thinking: DisplayVerbosityMode;
367
+ toolResults: DisplayVerbosityMode;
368
+ subagent: DisplayVerbosityMode;
369
+ view: TopicView;
370
+ }
371
+ /**
372
+ * @description The per-surface output path, selected ONCE at boot from
373
+ * `CHAT_MODE` (mirroring the {@link AgentAdapter} pattern) instead of a per-call
374
+ * surface branch at every output site. The group impl is thin (`queueOutput`
375
+ * edit-in-place + a noop finalize); the DM impl owns the draft-cursor manager;
376
+ * `both` dispatches per key. Built by `createOutputTransport`.
377
+ */
378
+ export interface OutputTransport {
379
+ /** Route one `output` event to its message path (the mode's own logic). */
380
+ deliverOutput(key: SessionKey, output: string, meta?: OutboundHints): void;
381
+ /**
382
+ * Finalize any in-flight content for the thread (DM: the live draft → a
383
+ * permanent message; group: noop). The STATUS site awaits this so the status
384
+ * frame lands below content; the two TEARDOWN sites fire-and-forget.
385
+ */
386
+ finalizeInFlight(key: SessionKey): Promise<void>;
387
+ /**
388
+ * Drop the thread's per-transport state on a full teardown (`/unbind`, topic
389
+ * deleted) so it doesn't leak across a rebind. DM drops the reset draft entry;
390
+ * group has nothing to drop (noop). Called AFTER `finalizeInFlight`.
391
+ */
392
+ disposeThread(key: SessionKey): void;
393
+ /**
394
+ * True while in-flight content "owns" the live message (DM: a draft turn is
395
+ * active). The Claude liveness loop ORs this into `checkIsOutputStreaming` so a
396
+ * heartbeat status frame can't be created between prose deltas — which would
397
+ * trip a mid-answer `needsNewMessage` and chop the draft. Group: always false
398
+ * (its streaming is already tracked via the output queue).
399
+ */
400
+ checkIsStreaming(key: SessionKey): boolean;
401
+ /**
402
+ * Thread keys whose TRANSPORT-OWNED in-flight state holds content to finalize
403
+ * (DM: threads with an active draft turn). The graceful-shutdown flush
404
+ * enumerates these so every live draft lands as a permanent message before the
405
+ * process exits. Group: always empty — its coalesced-but-unsent state lives in
406
+ * the bot's output queues, which the shutdown flush enumerates directly.
407
+ */
408
+ getInFlightThreadKeys(): SessionKey[];
409
+ }
410
+ /**
411
+ * @description Lifecycle phase of a {@link ThinkingEvent}.
412
+ *
413
+ * - `live` → the agent is actively reasoning; the bot shows the live
414
+ * "thinking …" indicator (and, in `full` mode, the accumulated text).
415
+ * - `done` → reasoning ended for this response; `durationMs` is how long it
416
+ * took, used to render the collapsed "thought for {N}s" line in `short` mode.
417
+ */
418
+ export type ThinkingPhase = 'live' | 'done';
419
+ /**
420
+ * @description Payload of the adapter `thinking` event — a chain-of-thought
421
+ * lifecycle signal for ONE response. Emitted on a DEDICATED channel (not the
422
+ * generic `status` coalescer) so the thinking indicator can persist
423
+ * independently of transient tool status.
424
+ *
425
+ * The adapter stays MODE-AGNOSTIC: it emits the raw accumulated reasoning text
426
+ * and the phase, and the BOT applies the per-thread thinking
427
+ * {@link DisplayVerbosityMode} (which controls only what remains AFTER
428
+ * reasoning ends). Reasoning text is kept SEPARATE from the answer accumulator
429
+ * and never leaks into `output`.
430
+ */
431
+ export interface ThinkingEvent {
432
+ /** Lifecycle phase of this emit. */
433
+ phase: ThinkingPhase;
434
+ /**
435
+ * Reasoning text accumulated so far for this response. Grows across `live`
436
+ * emits; carried on `done` too so a late-arriving `full`-mode render has
437
+ * the full text. Empty until the first reasoning delta produces content.
438
+ */
439
+ text: string;
440
+ /**
441
+ * How long reasoning took, in ms. Present only on the `done` phase — the bot
442
+ * formats it into the collapsed "thought for {N}s" line for `short` mode.
443
+ */
444
+ durationMs?: number;
445
+ }
446
+ /**
447
+ * @description Payload of the adapter `toolResult` event — a completed tool
448
+ * call's OUTPUT for one response (S3). Emitted on a DEDICATED channel so the
449
+ * result is rendered as its own message and never pollutes the answer
450
+ * accumulator (`currentResponseText`) or its continuation accounting.
451
+ *
452
+ * The adapter stays MODE-AGNOSTIC: it emits every completed tool output once,
453
+ * and the BOT applies the per-thread tool-results {@link DisplayVerbosityMode}
454
+ * (`minimal` drops it, `short` truncates, `full` renders the whole body).
455
+ */
456
+ export interface ToolResultEvent {
457
+ /** Tool name as reported by the tool part (e.g. `bash`, `read`). */
458
+ tool: string;
459
+ /** Human-readable title from the tool state (e.g. the command description),
460
+ * when the backend provided one. */
461
+ title?: string;
462
+ /** The tool's output body, untruncated. Non-empty by adapter contract. */
463
+ output: string;
464
+ }
465
+ /**
466
+ * @description Payload of the adapter `subagentStatus` event — the lifecycle of
467
+ * a single OpenCode delegation (sub-agent) for the `minimal`/`short`
468
+ * `/subagent` modes. Emitted on a DEDICATED channel (not the generic `status`
469
+ * coalescer) so the "working" indicator gets its OWN message + ticking elapsed
470
+ * timer in the bot, edited in place, instead of riding the shared transient
471
+ * status (which re-`sendMessage`d a new message on every child-text burst — the
472
+ * flood bug). `/subagent full` does NOT use this event (the streamed child
473
+ * transcript IS the indicator there).
474
+ *
475
+ * The adapter stays MODE-AGNOSTIC about presentation: it only signals whether a
476
+ * delegation is in flight (`active`) and the current sticky title; the BOT owns
477
+ * the message lifecycle and the elapsed counter.
478
+ */
479
+ export interface SubagentStatusEvent {
480
+ /**
481
+ * `true` = a delegation is in flight (start / keep-alive / title refresh) →
482
+ * the bot opens or refreshes the dedicated status message.
483
+ * `false` = the delegation ended → the bot removes the message.
484
+ */
485
+ active: boolean;
486
+ /**
487
+ * The delegation's sticky title (last non-null one seen for this run), or
488
+ * `null` when the `task` part never carried a title/description — the bot
489
+ * falls back to the localized generic label.
490
+ */
491
+ title: string | null;
492
+ }
493
+ /**
494
+ * @description One option of a Claude CLI bare-digit survey (e.g. the periodic
495
+ * session-feedback prompt: `1: Bad 2: Fine 3: Good 0: Dismiss`). The TUI
496
+ * submits on the bare digit alone — no Enter — so `digit` is exactly the
497
+ * keystroke to send.
498
+ */
499
+ export interface ClaudeSurveyOption {
500
+ /** The bare digit keystroke that selects this option (e.g. `'1'`, `'0'`). */
501
+ digit: string;
502
+ /** Human-readable label shown on the button (e.g. `'Bad'`, `'Dismiss'`). */
503
+ label: string;
504
+ }
505
+ /**
506
+ * @description Per-call options for {@link AgentAdapter.sendInput}.
507
+ */
508
+ export interface SendInputOptions {
509
+ /**
510
+ * Whether the adapter appends an Enter after the literal keystrokes. Defaults
511
+ * to `true` so every existing caller is byte-for-byte unchanged. Pass `false`
512
+ * for a keystroke that auto-submits on its own (no Enter needed) — appending
513
+ * one would otherwise submit a spurious empty prompt line afterwards.
514
+ */
515
+ appendEnter?: boolean;
516
+ }
517
+ /**
518
+ * @description Read-only metadata from a live agent runtime. Null means the
519
+ * backend could not determine that value and callers must render it as unknown.
520
+ */
521
+ export interface AgentRuntimeInfo {
522
+ version: string | null;
523
+ /**
524
+ * The model the runtime ACTUALLY ran last, as the backend itself reports it
525
+ * (Claude: the newest main-session assistant record; OpenCode: the live
526
+ * `provider/model` of the last parent turn). This is the fallback `/status`
527
+ * needs for a backend whose sync {@link AgentAdapter.getCurrentModel} cannot
528
+ * know the answer — the Claude tmux backend never can (its model lives inside
529
+ * the TUI), so before this field `/status` named no model at all there.
530
+ */
531
+ model: string | null;
532
+ contextWindowTokens: number | null;
533
+ contextUsedTokens: number | null;
534
+ }
535
+ /**
536
+ * @name CompactionResult
537
+ * @description Outcome of ONE {@link AgentAdapter.compactContext} call.
538
+ *
539
+ * A discriminated result rather than the old `string | null` (an error message,
540
+ * or `null` for success), because a success has data worth reporting: the Claude
541
+ * backend's confirmation frame carries the pre/post context token counts, which
542
+ * the bot posts in its completion message. With the old shape those counts had
543
+ * nowhere to go — the adapter logged and dropped them — and a side-channel getter
544
+ * would be a second source of truth for one call's outcome.
545
+ *
546
+ * `preTokens`/`postTokens` are `null` when the backend reports no counts:
547
+ * OpenCode's `/summarize` returns none at all, and the Claude wait can confirm a
548
+ * compaction (`compact_status success`) without ever seeing the boundary frame
549
+ * that carries them. `null` therefore means "compacted, counts unknown", never
550
+ * "zero" — the completion message drops the numbers instead of printing zeros.
551
+ *
552
+ * `error` is the user-facing text the bot posts verbatim (already localised by
553
+ * the adapter), same convention as {@link AgentAdapter.renameSession}'s string.
554
+ */
555
+ export type CompactionResult = {
556
+ ok: true;
557
+ preTokens: number | null;
558
+ postTokens: number | null;
559
+ } | {
560
+ ok: false;
561
+ error: string;
562
+ };
563
+ /**
564
+ * @description Unified interface for AI agent backends (Claude CLI, OpenCode, etc.).
565
+ * Each adapter manages sessions keyed by `SessionKey` and communicates via EventEmitter.
566
+ *
567
+ * Events emitted (all carry the `SessionKey` as the first argument):
568
+ * - 'output' (key: SessionKey, text: string, meta?: OutboundHints) — permanent text response
569
+ * - 'status' (key: SessionKey, text: string) — transient status (tool calls, thinking); shown as editable message
570
+ * - 'question' (key: SessionKey, question: { requestId: string, questions: QuestionInfo[] }) — interactive question for user
571
+ * - 'questionGone' (key: SessionKey) — Claude-only; the scraped TUI selector left the screen (answered / dismissed), so the bot removes its pin. Claude has no `pendingQuestions` entry, so it can't lean on the OpenCode `clearPendingQuestion` unpin path; this event is the normal-answer unpin trigger. Hard-teardown paths (stop / quit / unbind / closed / error) still route through `clearPendingQuestion` for BOTH backends.
572
+ * - 'thinking' (key: SessionKey, payload: ThinkingEvent) — chain-of-thought lifecycle (OpenCode); the bot applies the per-thread thinking {@link DisplayVerbosityMode}
573
+ * - 'toolResult' (key: SessionKey, payload: ToolResultEvent) — a completed tool call's output (OpenCode); the bot applies the per-thread tool-results {@link DisplayVerbosityMode}
574
+ * - 'subagentStatus' (key: SessionKey, payload: SubagentStatusEvent) — OpenCode delegation lifecycle for `minimal`/`short` `/subagent` modes; the bot owns a dedicated self-updating status message with a ticking elapsed timer
575
+ * - 'apiError' (key: SessionKey, error: AgentApiErrorClass) — provider-side API error at the proxy boundary (auto-retry trigger; only when {@link AgentApiErrorClass} classification matched)
576
+ * - 'started' (key: SessionKey) — session is up and ready
577
+ * - 'stopped' (key: SessionKey) — `stopSession` completed (explicit teardown)
578
+ * - 'suspended' (key: SessionKey) — `suspendSession` completed: the process is gone, the session stays resumable (the idle stop; lifecycle plan L3)
579
+ * - 'turnEnded' (key: SessionKey) — a turn's terminal `result` was processed (json-stream); the per-turn lifecycle stops the process on it (L5)
580
+ * - 'contextCompacted' (key: SessionKey, trigger: string | null) — a compaction COMPLETED (json-stream): one the bot issued, or the CLI's own overflow compaction; the conversation's context was replaced by a summary (Jira prompt context C6)
581
+ * - 'closed' (key: SessionKey) — session died on its own (process exit, SSE giveup, server crash)
582
+ * - 'error' (key: SessionKey, error: Error) — asynchronous failure AFTER successful startSession resolution
583
+ *
584
+ * Audit S10 / #16 contract clarifications (enforced by every adapter):
585
+ *
586
+ * - `startSession` / `resumeSession` rejects (throws) if the session
587
+ * could not be started or recovered. Successful resolution implies
588
+ * `checkIsActive(key) === true` and that subsequent events will fire.
589
+ *
590
+ * - `emit('error', …)` is for failures that happen AFTER a successful
591
+ * start (network blip, SSE drop with no recovery). Synchronous start
592
+ * failures must throw, never emit error+return.
593
+ *
594
+ * - `emit('closed', …)` is for unsolicited deaths only. If the user
595
+ * called `stopSession`, the adapter emits `stopped` instead. Both
596
+ * events MUST come with the same teardown (in-memory state freed).
597
+ */
598
+ export interface AgentAdapter extends EventEmitter {
599
+ /** Unique adapter identifier, e.g. 'claude', 'opencode' */
600
+ readonly name: string;
601
+ /** Human-readable label for Telegram UI */
602
+ readonly label: string;
603
+ /**
604
+ * Start a new session bound to `key` in `workDir`.
605
+ *
606
+ * `sessionId` is the externally-assigned id for backends that support it
607
+ * (Claude CLI's `--session-id <uuid>`). The bot owns sessionId generation
608
+ * and persists it in state.json so resumes survive bot restarts (see plan §13.1, D14).
609
+ * If omitted, the adapter falls back to backend defaults — for Claude this means
610
+ * a CLI-generated UUID that the adapter still exposes via `getClaudeSessionId(key)`.
611
+ *
612
+ * **Throws** if the session could not be started (audit S10 / #16). The
613
+ * returned promise rejecting means no `started` event will fire and no
614
+ * in-memory state was retained.
615
+ */
616
+ startSession(key: SessionKey, workDir: string, args?: string, sessionId?: string): Promise<void>;
617
+ stopSession(key: SessionKey): void;
618
+ /**
619
+ * @description Stop the process but keep the session RESUMABLE (lifecycle plan
620
+ * L3): the next trigger resumes the conversation by its persisted id. Converges
621
+ * on `suspended`, never `stopped`. Optional: only a backend whose process can be
622
+ * stopped without losing the conversation (json-stream Claude) offers it; the
623
+ * tmux TUI and OpenCode are never auto-stopped (L-D8).
624
+ */
625
+ suspendSession?(key: SessionKey): Promise<void>;
626
+ checkIsActive(key: SessionKey): boolean;
627
+ /**
628
+ * @description Read runtime metadata for the live session without sending the
629
+ * agent a prompt or command. Backends that cannot expose trustworthy model or
630
+ * context data (such as Terminal) omit this method.
631
+ */
632
+ getRuntimeInfo?(key: SessionKey): Promise<AgentRuntimeInfo>;
633
+ /**
634
+ * @description Whether the session bound to `key` is mid-turn (an in-progress
635
+ * reply). `false` when there is no session or it is idle. Sync and read from
636
+ * in-memory state only (no tmux/HTTP call) so a caller can poll it cheaply —
637
+ * the scheduler's wait-for-idle loop polls this before forwarding a scheduled
638
+ * prompt, so a fire never interrupts live work.
639
+ *
640
+ * Per-backend signal:
641
+ * - **Claude** — the same pane busy marker `interruptAndWaitIdle` polls
642
+ * (`esc to interrupt` footer), evaluated against the session's last cached
643
+ * capture.
644
+ * - **OpenCode** — the in-flight response state tracked from SSE (own
645
+ * generation running, a sub-agent running, or context compacting).
646
+ *
647
+ * Optional (optional-method pattern, like {@link setModel}): adapters that
648
+ * can't report busy-ness omit it and a caller treats the session as never
649
+ * busy.
650
+ */
651
+ checkIsBusy?(key: SessionKey): boolean;
652
+ /**
653
+ * Whether input the bot wrote has not yet been TAKEN IN by the backend. A
654
+ * message written while a turn runs waits until the backend reads it (Claude
655
+ * json-stream and OpenCode accept it mid-turn and merge it into the running
656
+ * turn), so for that window the backend can report the END of the earlier
657
+ * turn. The request wake-up engine counts a turn end only once this is false.
658
+ * - **Claude json-stream** — user messages written minus their
659
+ * `--replay-user-messages` echoes (the echo arrives when Claude reads it).
660
+ * - **OpenCode** — prompts sent minus the new user messages seen on the event
661
+ * stream.
662
+ * Optional: a backend without such a signal omits it, and the engine falls
663
+ * back to busy or output seen since the forward. That fallback is exact for
664
+ * the tmux Claude backend only because it interrupts the running turn before
665
+ * typing — except while a sub-agent or compaction runs, when it queues the
666
+ * prompt behind that turn and the earlier turn's busy already satisfies it.
667
+ */
668
+ checkHasUnconsumedInput?(key: SessionKey): boolean;
669
+ /**
670
+ * Whether the process is WORKING and must not be stopped (lifecycle plan L-D2):
671
+ * a running turn, a background task it still runs (a background Bash / Monitor /
672
+ * sub-agent — a stop would kill them), input written but not yet taken in, or a
673
+ * compaction in flight. Optional: a backend without the signal omits it and the
674
+ * idle stop falls back to `checkIsBusy`.
675
+ * - **Claude json-stream** — busy, or the CLI's `background_tasks_changed` list
676
+ * is non-empty, or an input echo is outstanding, or a bot-issued `/compact` runs.
677
+ */
678
+ checkIsWorking?(key: SessionKey): boolean;
679
+ /**
680
+ * The part of "working" that is NOT the running turn: a background task the
681
+ * process still runs, input written but not yet taken in, a compaction in
682
+ * flight. Read apart from `checkIsBusy` by the idle fire, which excuses a busy
683
+ * turn that only waits on an interactive question (D1) but never this — with a
684
+ * question pending AND a background task running, the process is working (L-D2).
685
+ * Optional, like `checkIsWorking`.
686
+ */
687
+ checkHasBackgroundWork?(key: SessionKey): boolean;
688
+ /**
689
+ * Whether the live process may be stopped automatically (lifecycle plan L-D10):
690
+ * its CLI reports the background-task list (`claude_code_version` ≥ 2.1.287).
691
+ * Unknown version → `false`. Optional: a backend that is never auto-stopped omits it.
692
+ */
693
+ checkIsAutoStopSupported?(key: SessionKey): boolean;
694
+ /**
695
+ * Re-register the bot-owned scheduler MCP for active OpenCode directories,
696
+ * for a listener that became available after those sessions connected. Boot
697
+ * no longer needs it: the listener is bound before sessions are re-attached,
698
+ * and {@link reconcileSchedulerMcpForActiveSessions} heals stale entries.
699
+ */
700
+ registerSchedulerMcpForActiveSessions?(): void;
701
+ /**
702
+ * Reconcile the bot-owned scheduler MCP registration for active OpenCode
703
+ * directories against the server's LIVE status: force a re-registration for
704
+ * any directory whose `telegramBot` entry is missing or not `connected`. Used
705
+ * at boot when the bot adopts an already-running opencode that may still hold
706
+ * a stale registration (dead port) from a previous bot generation.
707
+ */
708
+ reconcileSchedulerMcpForActiveSessions?(): Promise<void>;
709
+ /**
710
+ * Make every active OpenCode directory's instance load the bot's compaction
711
+ * plugin (`utils/openCodeCompactPlugin.ts`): install the plugin file, then
712
+ * recreate each IDLE directory instance that predates it. Recreating drops the
713
+ * directory's runtime MCP registrations, so the boot caller must run
714
+ * {@link reconcileSchedulerMcpForActiveSessions} AFTER this resolves. Best-effort,
715
+ * never rejects; a busy directory is left for the next boot.
716
+ */
717
+ activateCompactionPluginForActiveSessions?(): Promise<void>;
718
+ /**
719
+ * Heal the bot-owned MCP server `serverName` INSIDE one live session: read the
720
+ * status the backend holds for it and reconnect it when it reports `failed`.
721
+ * The Claude-side counterpart of {@link reconcileSchedulerMcpForActiveSessions}
722
+ * — a json-stream session outlives every bot restart, and its MCP client never
723
+ * retries a server it once failed to reach, so without this the bot's own
724
+ * tools stay gone for the rest of that session. The resolved
725
+ * {@link McpHealOutcome} says what actually happened, so a caller can log only
726
+ * the sessions it really repaired.
727
+ *
728
+ * Optional (optional-method pattern, like {@link compactContext}): only the
729
+ * json-stream Claude backend has a control channel to ask over.
730
+ */
731
+ healMcpServer?(key: SessionKey, serverName: string): Promise<McpHealOutcome>;
732
+ sendInput(key: SessionKey, input: string, options?: SendInputOptions): void;
733
+ sendSignal(key: SessionKey, signal: string): void;
734
+ /**
735
+ * List resumable sessions for this `key`. `workDir` is supplied by the
736
+ * bot from the thread's binding because a thread may have NO live
737
+ * adapter session when listing (e.g. right after a restart, or to pick
738
+ * up a conversation started by hand on the laptop), so the folder can't
739
+ * be inferred from adapter state. Claude reads real
740
+ * `~/.claude/projects/<cwd>/*.jsonl` transcripts filtered to `workDir`;
741
+ * OpenCode ignores `workDir` (its server API exposes no folder field).
742
+ */
743
+ getSessions(key: SessionKey, workDir: string): Promise<AgentSession[]>;
744
+ /**
745
+ * Rename the CURRENT live session bound to `key` to `title`. Same
746
+ * convention as {@link setModel}: resolves to `null` on success, or a
747
+ * short user-facing error string on failure.
748
+ *
749
+ * Optional (optional-method pattern, like {@link setModel}): only backends
750
+ * with a real session-title concept implement it. OpenCode does
751
+ * (`PATCH /session/:id { title }`); Claude does NOT — its transcripts have
752
+ * no title — so the bot replies "not supported" for adapters lacking it.
753
+ *
754
+ * A manual rename is final: it must suppress any later automatic title
755
+ * overwrite (OpenCode's bot-side auto-name fallback).
756
+ */
757
+ renameSession?(key: SessionKey, title: string): Promise<string | null>;
758
+ /**
759
+ * Compact (summarize) the CURRENT live session's context so the conversation
760
+ * can keep going in a smaller window. Resolves a {@link CompactionResult}: a
761
+ * success optionally carrying the pre/post context token counts, or a failure
762
+ * carrying the user-facing error text. Awaits the compaction to actually
763
+ * COMPLETE before resolving (OpenCode's summarize blocks until the summary is
764
+ * generated; the json-stream backend waits for the CLI's `compact_boundary`),
765
+ * so the caller can post its notice AFTER the context was really compacted.
766
+ *
767
+ * `instruction`, when set, is appended to the backend's baked compaction
768
+ * prompt (NOT a replacement) so the summary can carry an extra closing
769
+ * section (F2's "where we stopped" recap). OpenCode threads it into the
770
+ * summarize request body; the json-stream Claude backend sends it as
771
+ * `/compact <instruction>`.
772
+ *
773
+ * Optional (optional-method pattern, like {@link renameSession}): only
774
+ * backends that can perform a REAL, confirmable compaction implement it —
775
+ * OpenCode (`POST /session/:id/summarize`) and the json-stream Claude backend
776
+ * (`/compact` over the stream-json control turn). The tmux Claude backend
777
+ * deliberately does NOT: its TUI owns `/compact`, so the bot forwards the
778
+ * literal slash command to it instead. Adapters with neither (Terminal) get
779
+ * the "not supported" reply.
780
+ */
781
+ compactContext?(key: SessionKey, instruction?: string): Promise<CompactionResult>;
782
+ /**
783
+ * Whether this backend's own compaction prompt already receives the
784
+ * loaded-skills guidance for this thread's session, so the bot must leave it
785
+ * out of the `compactContext` instruction. OpenCode: true when the server
786
+ * loaded the bot's compaction plugin (`utils/openCodeCompactPlugin.ts`), which
787
+ * cannot see the instruction and so cannot skip a duplicate itself. Optional —
788
+ * absent means "no", and the Claude backends leave it unset because their
789
+ * `PreCompact` hook skips a compaction that already carries the guidance.
790
+ */
791
+ checkHasCompactionSkillsHook?(key: SessionKey): Promise<boolean>;
792
+ /**
793
+ * Whether this backend's OWN compaction summary already reaches the topic as
794
+ * ordinary agent output, so the bot must NOT post a second copy of it.
795
+ *
796
+ * True for OpenCode: its `POST /session/:id/summarize` produces a real assistant
797
+ * message, which rides the SSE stream into the topic marked
798
+ * `OutboundHints.isCompactionSummary` (the bot drops it unless `/compact_summary`
799
+ * is on). The Claude
800
+ * backends write the summary only into their on-disk transcript (an
801
+ * `isCompactSummary: true` record) and emit no assistant text at all, so they
802
+ * leave this unset and the bot posts the summary itself.
803
+ *
804
+ * A CAPABILITY flag, not an adapter-name check, so a future backend that streams
805
+ * its own summary is handled by declaring it here.
806
+ */
807
+ readonly streamsCompactionSummary?: boolean;
808
+ /**
809
+ * Read the most recent compaction summary text for the live session, or
810
+ * `null` when none is available / the read failed. Used by F2 to lift the
811
+ * appended "Where we stopped" closing section out of the freshly-generated
812
+ * summary and surface it in the idle-compaction notice. Optional — only
813
+ * backends whose summary is retrievable implement it; a missing method just
814
+ * means the notice omits the closing prose.
815
+ */
816
+ getLatestCompactionSummary?(key: SessionKey): Promise<string | null>;
817
+ /**
818
+ * Resume an existing backend session under this `key` and `workDir`.
819
+ *
820
+ * `workDir` is now a required argument: the adapter cannot infer it after
821
+ * a bot restart, and silently falling back to `process.env.WORK_DIR` was a
822
+ * source of mis-routing in the old single-folder architecture (plan §10.3,
823
+ * fix to openCodeAdapter.ts:599).
824
+ *
825
+ * `options.isWithRecentContext` posts the short "↩️ Resumed — last N
826
+ * messages" context block. ONLY the explicit user resume (`/sessions` pick)
827
+ * sets it: the same method also runs on silent re-attach after every bot
828
+ * restart (hot reload) and on opencode crash-recovery, and posting the
829
+ * block there spammed every active topic on every rebuild.
830
+ */
831
+ resumeSession(key: SessionKey, workDir: string, sessionId: string, options?: ResumeSessionOptions): Promise<void>;
832
+ /**
833
+ * @description Fork the thread's CURRENT session into a new one that carries
834
+ * the full conversation, and attach to it; returns the new session id (or null
835
+ * if inactive / failed). Optional (optional-method pattern like {@link setModel}):
836
+ * OpenCode implements it via `POST /session/:id/fork`; the bot's wedged-turn
837
+ * recovery uses it to restore the last dialog into a fresh, unwedged session
838
+ * before replaying. Adapters that can't fork omit it (recovery falls back to a
839
+ * blank restart).
840
+ */
841
+ forkSession?(key: SessionKey): Promise<string | null>;
842
+ /**
843
+ * @description Detach any RUNNING sub-agent synchronously blocking the thread's
844
+ * session, so a new prompt is answered promptly while the sub-agent keeps
845
+ * working in the background (its result is injected back when it finishes).
846
+ * Returns whether anything was backgrounded. Optional (optional-method pattern):
847
+ * OpenCode implements it via `POST /experimental/session/:id/background`; other
848
+ * adapters omit it. Best-effort — never blocks the prompt that follows.
849
+ */
850
+ detachRunningSubagents?(key: SessionKey): Promise<boolean>;
851
+ /**
852
+ * @description Read the last `limit` conversational turns (user/assistant
853
+ * messages with renderable text, oldest→newest) of `sessionId` from the
854
+ * backend's own transcript — Claude reads its `.jsonl`, OpenCode calls
855
+ * `GET /session/:id/message`. Optional (optional-method pattern, like
856
+ * {@link setModel}): adapters that can't cheaply read history omit it and
857
+ * the resume context block is simply skipped. The result is already capped
858
+ * to `limit`; an empty array means no renderable turns (brand-new / pruned
859
+ * session). Used by `resumeSession` to post the short resume context block.
860
+ */
861
+ getRecentTurns?(key: SessionKey, workDir: string, sessionId: string, limit: number): Promise<RecentTurn[]>;
862
+ /**
863
+ * @description Assemble the post-restart recap for `sessionId`: how many
864
+ * assistant messages were produced while the bot was down (vs the persisted
865
+ * {@link SeenWatermark}) plus the last few turns and a best-effort
866
+ * still-working signal. Called by `reattachExistingSessions` after a SILENT
867
+ * re-adopt (NOT the explicit `/sessions` resume, which keeps its own context
868
+ * block). Optional (optional-method pattern, like {@link getRecentTurns}):
869
+ * adapters that keep no structured record omit it (Terminal) and the reattach
870
+ * recap is simply skipped. `watermark` is `null` when none was ever persisted
871
+ * → the implementation returns `isWatermarkKnown: false` (the fallback path).
872
+ */
873
+ getReattachRecap?(key: SessionKey, workDir: string, sessionId: string, watermark: SeenWatermark | null): Promise<ReattachRecap>;
874
+ /**
875
+ * Connect a provider account for this backend using an API key. Same return
876
+ * convention as {@link setModel}: resolves to `null` on success, or a short
877
+ * user-facing error string on failure.
878
+ *
879
+ * Optional (optional-method pattern): OpenCode implements provider auth;
880
+ * Claude/Terminal do not.
881
+ */
882
+ connectProvider?(key: SessionKey, providerId: string, apiKey: string): Promise<string | null>;
883
+ /**
884
+ * Disconnect a provider: remove the credentials this backend stores for it.
885
+ * Same return convention as {@link connectProvider} — `null` means a clean
886
+ * disconnect (the caller shows its own success copy), a non-null string is a
887
+ * user-facing notice to show verbatim. The notice covers BOTH a failure and
888
+ * the honest-caveat case: a provider the backend enables from an environment
889
+ * variable stays active after its stored credentials are gone.
890
+ *
891
+ * Optional (optional-method pattern): OpenCode implements provider auth;
892
+ * Claude/Terminal do not.
893
+ */
894
+ disconnectProvider?(key: SessionKey, providerId: string): Promise<string | null>;
895
+ /**
896
+ * Fetch a provider's auth methods for the `/connect` method picker. OpenCode
897
+ * returns custom OAuth methods from its auth catalog and a generic API-key
898
+ * method for ordinary providers in its full provider catalog.
899
+ */
900
+ fetchProviderAuthMethods?(providerId: string): Promise<OpenCodeAuthMethod[]>;
901
+ /**
902
+ * Reload provider credentials after an out-of-band OAuth login. OpenCode
903
+ * caches auth in its live server process, so its adapter performs a
904
+ * controlled restart and restores its active sessions before resolving.
905
+ * Optional (OpenCode only, same optional-method pattern as provider auth).
906
+ */
907
+ reloadProviderAuth?(): Promise<boolean>;
908
+ /**
909
+ * Set model override. Returns error message on failure, `null` on
910
+ * success. Audit S10 / #39: unified to `Promise<string | null>` —
911
+ * callers used to branch on `void` vs `Promise<string | null>`.
912
+ */
913
+ setModel?(key: SessionKey, modelId: string): Promise<string | null>;
914
+ getCurrentModel?(key: SessionKey): string | null;
915
+ /** Get available models from backend */
916
+ getAvailableModels?(): Promise<string[]>;
917
+ /**
918
+ * Set the reasoning-effort level for this thread. Same convention as
919
+ * {@link setModel}: returns `null` on success, a short user-facing
920
+ * message on failure / notice (e.g. "level X is not valid for model Y").
921
+ *
922
+ * Per-backend semantics:
923
+ *
924
+ * - **Claude** applies immediately by writing `/effort <level>` into the
925
+ * running TUI; the value is also stored for menu/banner display.
926
+ * - **OpenCode** persists the choice but does NOT mutate the live session
927
+ * here — the level (a model variant) is applied **per-prompt** inside the
928
+ * adapter's prompt-send path, sent as `body.variant` alongside the model
929
+ * override (no separate request, no env configuration).
930
+ */
931
+ setEffort?(key: SessionKey, level: string): Promise<string | null>;
932
+ /**
933
+ * Currently selected reasoning-effort level for this thread, or `null`
934
+ * if none has been chosen (adapter default in effect). Mirrors
935
+ * {@link getCurrentModel}'s sync read pattern.
936
+ */
937
+ getEffort?(key: SessionKey): string | null;
938
+ /**
939
+ * Levels valid for the thread's current backend + model. Returns an
940
+ * empty array when the adapter has no opinion on effort (e.g. an OpenCode
941
+ * model that declares no `variants`) — the caller surfaces a "not
942
+ * supported" notice instead of an empty picker.
943
+ *
944
+ * Async because OpenCode needs to query `/config/providers`; Claude
945
+ * resolves locally and just wraps the canonical list in `Promise.resolve`.
946
+ */
947
+ getAvailableEffortLevels?(key: SessionKey): Promise<string[]>;
948
+ /** Reply to a pending question with selected answers */
949
+ answerQuestion?(key: SessionKey, answers: string[][]): void;
950
+ /**
951
+ * @description Reject (close) a pending question server-side WITHOUT answering
952
+ * it — used when the user ABANDONS the question (sends a fresh prompt instead
953
+ * of answering, or tears the session down while it is pending). Without this
954
+ * the question stays "open" in OpenCode's registry and a later reattach
955
+ * re-surfaces the stale question. OpenCode-only (Claude has no server-side
956
+ * question concept, so it does not implement it); a no-op when no question is
957
+ * pending. Must run while the session is still active — a stopped session
958
+ * can't accept the reject POST.
959
+ */
960
+ rejectQuestion?(key: SessionKey): void;
961
+ /**
962
+ * @description Whether this session's turn is wedged behind an open
963
+ * interactive question (the agent's `question` tool is blocking the turn and
964
+ * the bot has no `pendingQuestions` entry to break out with). OpenCode-only:
965
+ * a queued `prompt_async` would sit behind the dead turn forever, so the bot
966
+ * aborts the turn before forwarding a fresh prompt. The check is strict —
967
+ * `true` only when the server reports an open question for THIS session, so a
968
+ * genuinely streaming turn / live sub-agent is never reported wedged (and the
969
+ * normal queue-and-pick-up behaviour is preserved). Async because the
970
+ * authoritative signal is `GET /question` on the owning instance.
971
+ */
972
+ checkIsWedgedOnQuestion?(key: SessionKey): Promise<boolean>;
973
+ /**
974
+ * @description When true, adapter emits incremental text deltas (not accumulated content).
975
+ * After a status/thinking break, the bot will force a new message to avoid
976
+ * overwriting previous substantial content with new delta text.
977
+ */
978
+ readonly outputsDeltas?: boolean;
979
+ /**
980
+ * @description When true, the backend prints its OWN visible greeting to the
981
+ * topic shortly after the session starts (Claude's TUI banner). The bot then
982
+ * suppresses its `agent.ready` notice (the bot's text would be a redundant lie
983
+ * seconds before the agent's real banner) and instead keeps the typing loader
984
+ * up from start until that first output. Backends that emit nothing on session
985
+ * create (OpenCode = HTTP; terminal = a bare shell) leave it falsy and keep the
986
+ * `agent.ready` / `terminal.ready` cue — without it the user would stare at a
987
+ * loader forever, since nothing ever greets.
988
+ */
989
+ readonly selfGreetsOnStart?: boolean;
990
+ sendEnter?(key: SessionKey): void;
991
+ sendArrow?(key: SessionKey, direction: 'Up' | 'Down'): void;
992
+ sendTab?(key: SessionKey): void;
993
+ sendEscape?(key: SessionKey): void;
994
+ /**
995
+ * @description Interrupt the current turn and resolve only once the agent is
996
+ * idle again, so the caller can forward a fresh prompt without it being
997
+ * queued behind the running turn. Implement it ONLY when the backend ignores
998
+ * queued input while busy: Claude's TUI does (Escape — which also cancels an
999
+ * on-screen selector — then a poll until the busy state clears). OpenCode
1000
+ * deliberately does NOT implement it — `prompt_async` queues the new prompt
1001
+ * and the turn picks it up quickly, so aborting live work would only lose it
1002
+ * (user decision 2026-06-06). Adapters without the method forward directly.
1003
+ */
1004
+ interruptAndWaitIdle?(key: SessionKey): Promise<void>;
1005
+ /**
1006
+ * @description Whether an interactive selector/question is currently on the
1007
+ * TUI screen. Lets the bot decide whether a short reply (a bare option
1008
+ * number or y/n) should DRIVE the selector, versus a free-form message that
1009
+ * should break out of it (Escape + send as a fresh instruction).
1010
+ */
1011
+ isQuestionPending?(key: SessionKey): boolean;
1012
+ /**
1013
+ * @description Whether Claude's `/login` OAuth "Paste code here" box is on
1014
+ * the TUI screen. While it is, the bot routes ANY text reply verbatim into
1015
+ * the box (the pasted code is a long free-form string, not a control reply),
1016
+ * skipping the prompt path whose Escape would cancel the login and whose
1017
+ * preamble would corrupt the code. Only Claude implements it.
1018
+ */
1019
+ isLoginPastePending?(key: SessionKey): boolean;
1020
+ getFullOutput?(key: SessionKey, lines?: number): string | null;
1021
+ }
1022
+ //# sourceMappingURL=types.d.ts.map