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