charness 3.9.1 → 3.10.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/CHANGELOG.md +126 -0
- package/DEVELOPMENT.md +4 -1
- package/SETUP.md +6 -4
- package/agent-plugin/README.md +2 -2
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +1 -1
- package/agent-plugin/skills/charness-manager/SKILL.md +8 -4
- package/dist/bot.d.ts +27 -18
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +217 -99
- package/dist/bot.js.map +1 -1
- package/dist/connectors/jira/adf.d.ts.map +1 -1
- package/dist/connectors/jira/adf.js +2 -3
- package/dist/connectors/jira/adf.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +16 -0
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts +10 -1
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +75 -13
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/runnerLinkNotices.d.ts +24 -0
- package/dist/connectors/telegram/runnerLinkNotices.d.ts.map +1 -0
- package/dist/connectors/telegram/runnerLinkNotices.js +95 -0
- package/dist/connectors/telegram/runnerLinkNotices.js.map +1 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +9 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.js +17 -1
- package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +19 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +19 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +19 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +19 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +19 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +19 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +19 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +19 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +19 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +19 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +19 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +19 -0
- package/dist/i18n/zh.js.map +1 -1
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +2 -9
- package/dist/outputTrace.js.map +1 -1
- package/dist/rateLimiter.d.ts +3 -1
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js +3 -1
- package/dist/rateLimiter.js.map +1 -1
- package/dist/remoteRun/cliArgs.d.ts +6 -1
- package/dist/remoteRun/cliArgs.d.ts.map +1 -1
- package/dist/remoteRun/cliArgs.js +39 -2
- package/dist/remoteRun/cliArgs.js.map +1 -1
- package/dist/remoteRun/exitCodes.d.ts +12 -2
- package/dist/remoteRun/exitCodes.d.ts.map +1 -1
- package/dist/remoteRun/exitCodes.js +3 -0
- package/dist/remoteRun/exitCodes.js.map +1 -1
- package/dist/remoteRun/foreground.d.ts +13 -0
- package/dist/remoteRun/foreground.d.ts.map +1 -1
- package/dist/remoteRun/foreground.js +15 -2
- package/dist/remoteRun/foreground.js.map +1 -1
- package/dist/remoteRun/heldBackNotice.d.ts +7 -0
- package/dist/remoteRun/heldBackNotice.d.ts.map +1 -0
- package/dist/remoteRun/heldBackNotice.js +92 -0
- package/dist/remoteRun/heldBackNotice.js.map +1 -0
- package/dist/remoteRun/interrupts.d.ts +6 -2
- package/dist/remoteRun/interrupts.d.ts.map +1 -1
- package/dist/remoteRun/interrupts.js +18 -3
- package/dist/remoteRun/interrupts.js.map +1 -1
- package/dist/remoteRun/leaseTiming.d.ts +1 -2
- package/dist/remoteRun/leaseTiming.d.ts.map +1 -1
- package/dist/remoteRun/leaseTiming.js +3 -17
- package/dist/remoteRun/leaseTiming.js.map +1 -1
- package/dist/remoteRun/output.d.ts +16 -1
- package/dist/remoteRun/output.d.ts.map +1 -1
- package/dist/remoteRun/output.js +28 -2
- package/dist/remoteRun/output.js.map +1 -1
- package/dist/remoteRun/probe.d.ts +40 -2
- package/dist/remoteRun/probe.d.ts.map +1 -1
- package/dist/remoteRun/probe.js +58 -2
- package/dist/remoteRun/probe.js.map +1 -1
- package/dist/remoteRun/project.d.ts +2 -2
- package/dist/remoteRun/project.d.ts.map +1 -1
- package/dist/remoteRun/project.js +5 -4
- package/dist/remoteRun/project.js.map +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
- package/dist/remoteRun/remoteRunCli.js +6 -3
- package/dist/remoteRun/remoteRunCli.js.map +1 -1
- package/dist/remoteRun/runnerWait.d.ts +3 -3
- package/dist/remoteRun/runnerWait.d.ts.map +1 -1
- package/dist/remoteRun/runnerWait.js +12 -6
- package/dist/remoteRun/runnerWait.js.map +1 -1
- package/dist/remoteRun/runnerWaitTiming.d.ts +1 -1
- package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -1
- package/dist/remoteRun/runnerWaitTiming.js +3 -16
- package/dist/remoteRun/runnerWaitTiming.js.map +1 -1
- package/dist/remoteRun/runners.d.ts +16 -3
- package/dist/remoteRun/runners.d.ts.map +1 -1
- package/dist/remoteRun/runners.js +42 -4
- package/dist/remoteRun/runners.js.map +1 -1
- package/dist/remoteRun/sendPlan.d.ts +11 -1
- package/dist/remoteRun/sendPlan.d.ts.map +1 -1
- package/dist/remoteRun/sendPlan.js +29 -5
- package/dist/remoteRun/sendPlan.js.map +1 -1
- package/dist/remoteRun/submit.d.ts.map +1 -1
- package/dist/remoteRun/submit.js +13 -3
- package/dist/remoteRun/submit.js.map +1 -1
- package/dist/runnerUtility/adminService.d.ts +30 -2
- package/dist/runnerUtility/adminService.d.ts.map +1 -1
- package/dist/runnerUtility/adminService.js +104 -6
- package/dist/runnerUtility/adminService.js.map +1 -1
- package/dist/runnerUtility/appInstall.d.ts +13 -4
- package/dist/runnerUtility/appInstall.d.ts.map +1 -1
- package/dist/runnerUtility/appInstall.js +46 -19
- package/dist/runnerUtility/appInstall.js.map +1 -1
- package/dist/runnerUtility/appUpdate.js +1 -1
- package/dist/runnerUtility/appUpdate.js.map +1 -1
- package/dist/runnerUtility/execEnv.d.ts +2 -0
- package/dist/runnerUtility/execEnv.d.ts.map +1 -1
- package/dist/runnerUtility/execEnv.js +6 -2
- package/dist/runnerUtility/execEnv.js.map +1 -1
- package/dist/runnerUtility/guiAgent.d.ts +126 -0
- package/dist/runnerUtility/guiAgent.d.ts.map +1 -0
- package/dist/runnerUtility/guiAgent.js +591 -0
- package/dist/runnerUtility/guiAgent.js.map +1 -0
- package/dist/runnerUtility/guiAgentHeal.d.ts +128 -0
- package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -0
- package/dist/runnerUtility/guiAgentHeal.js +284 -0
- package/dist/runnerUtility/guiAgentHeal.js.map +1 -0
- package/dist/runnerUtility/homeFolders.d.ts +33 -0
- package/dist/runnerUtility/homeFolders.d.ts.map +1 -0
- package/dist/runnerUtility/homeFolders.js +158 -0
- package/dist/runnerUtility/homeFolders.js.map +1 -0
- package/dist/runnerUtility/hubClient.d.ts +12 -2
- package/dist/runnerUtility/hubClient.d.ts.map +1 -1
- package/dist/runnerUtility/hubClient.js +24 -3
- package/dist/runnerUtility/hubClient.js.map +1 -1
- package/dist/runnerUtility/iosCheck.d.ts +7 -1
- package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
- package/dist/runnerUtility/iosCheck.js +14 -5
- package/dist/runnerUtility/iosCheck.js.map +1 -1
- package/dist/runnerUtility/isolatedCommand.d.ts +33 -0
- package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -0
- package/dist/runnerUtility/isolatedCommand.js +139 -0
- package/dist/runnerUtility/isolatedCommand.js.map +1 -0
- package/dist/runnerUtility/keepAwake.d.ts +67 -0
- package/dist/runnerUtility/keepAwake.d.ts.map +1 -0
- package/dist/runnerUtility/keepAwake.js +211 -0
- package/dist/runnerUtility/keepAwake.js.map +1 -0
- package/dist/runnerUtility/lidPollTiming.d.ts +11 -0
- package/dist/runnerUtility/lidPollTiming.d.ts.map +1 -0
- package/dist/runnerUtility/lidPollTiming.js +18 -0
- package/dist/runnerUtility/lidPollTiming.js.map +1 -0
- package/dist/runnerUtility/lidState.d.ts +57 -0
- package/dist/runnerUtility/lidState.d.ts.map +1 -0
- package/dist/runnerUtility/lidState.js +195 -0
- package/dist/runnerUtility/lidState.js.map +1 -0
- package/dist/runnerUtility/linkLoop.d.ts +5 -0
- package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
- package/dist/runnerUtility/linkLoop.js +37 -1
- package/dist/runnerUtility/linkLoop.js.map +1 -1
- package/dist/runnerUtility/packageManagerShims.d.ts +44 -0
- package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -0
- package/dist/runnerUtility/packageManagerShims.js +130 -0
- package/dist/runnerUtility/packageManagerShims.js.map +1 -0
- package/dist/runnerUtility/progress.d.ts +43 -0
- package/dist/runnerUtility/progress.d.ts.map +1 -0
- package/dist/runnerUtility/progress.js +78 -0
- package/dist/runnerUtility/progress.js.map +1 -0
- package/dist/runnerUtility/pueueDaemon.d.ts +8 -4
- package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
- package/dist/runnerUtility/pueueDaemon.js +12 -7
- package/dist/runnerUtility/pueueDaemon.js.map +1 -1
- package/dist/runnerUtility/rootServiceCli.d.ts +23 -3
- package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -1
- package/dist/runnerUtility/rootServiceCli.js +56 -10
- package/dist/runnerUtility/rootServiceCli.js.map +1 -1
- package/dist/runnerUtility/runnerCli.d.ts +1 -0
- package/dist/runnerUtility/runnerCli.d.ts.map +1 -1
- package/dist/runnerUtility/runnerCli.js +14 -7
- package/dist/runnerUtility/runnerCli.js.map +1 -1
- package/dist/runnerUtility/runnerCommands.d.ts +45 -0
- package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
- package/dist/runnerUtility/runnerCommands.js +188 -21
- package/dist/runnerUtility/runnerCommands.js.map +1 -1
- package/dist/runnerUtility/runnerHome.d.ts +8 -0
- package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
- package/dist/runnerUtility/runnerHome.js +7 -0
- package/dist/runnerUtility/runnerHome.js.map +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts +4 -0
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
- package/dist/runnerUtility/serviceCommon.js +8 -1
- package/dist/runnerUtility/serviceCommon.js.map +1 -1
- package/dist/runnerUtility/serviceManager.d.ts +5 -2
- package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
- package/dist/runnerUtility/serviceManager.js +40 -17
- package/dist/runnerUtility/serviceManager.js.map +1 -1
- package/dist/runnerUtility/serviceUnits.d.ts +11 -0
- package/dist/runnerUtility/serviceUnits.d.ts.map +1 -1
- package/dist/runnerUtility/serviceUnits.js +8 -2
- package/dist/runnerUtility/serviceUnits.js.map +1 -1
- package/dist/runnerUtility/simulatorSilencer.d.ts +55 -0
- package/dist/runnerUtility/simulatorSilencer.d.ts.map +1 -0
- package/dist/runnerUtility/simulatorSilencer.js +203 -0
- package/dist/runnerUtility/simulatorSilencer.js.map +1 -0
- package/dist/runnerUtility/stopSignals.d.ts +10 -0
- package/dist/runnerUtility/stopSignals.d.ts.map +1 -0
- package/dist/runnerUtility/stopSignals.js +27 -0
- package/dist/runnerUtility/stopSignals.js.map +1 -0
- package/dist/runnerUtility/versionPollTiming.d.ts +2 -3
- package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -1
- package/dist/runnerUtility/versionPollTiming.js +4 -18
- package/dist/runnerUtility/versionPollTiming.js.map +1 -1
- package/dist/runners/bootstrapLine.d.ts.map +1 -1
- package/dist/runners/bootstrapLine.js +35 -19
- package/dist/runners/bootstrapLine.js.map +1 -1
- package/dist/runners/gate.d.ts.map +1 -1
- package/dist/runners/gate.js +28 -1
- package/dist/runners/gate.js.map +1 -1
- package/dist/runners/gateLink.d.ts +7 -0
- package/dist/runners/gateLink.d.ts.map +1 -1
- package/dist/runners/gateLink.js +36 -3
- package/dist/runners/gateLink.js.map +1 -1
- package/dist/runners/gateProtocol.d.ts +37 -2
- package/dist/runners/gateProtocol.d.ts.map +1 -1
- package/dist/runners/gateProtocol.js +45 -4
- package/dist/runners/gateProtocol.js.map +1 -1
- package/dist/runners/hubPackage.d.ts +2 -1
- package/dist/runners/hubPackage.d.ts.map +1 -1
- package/dist/runners/hubPackage.js +32 -11
- package/dist/runners/hubPackage.js.map +1 -1
- package/dist/runners/hubPairing.d.ts +1 -1
- package/dist/runners/hubPairing.d.ts.map +1 -1
- package/dist/runners/hubPairing.js +8 -1
- package/dist/runners/hubPairing.js.map +1 -1
- package/dist/runners/hubPaths.d.ts +2 -0
- package/dist/runners/hubPaths.d.ts.map +1 -1
- package/dist/runners/hubPaths.js +1 -1
- package/dist/runners/hubPaths.js.map +1 -1
- package/dist/runners/linkConcern.d.ts +75 -0
- package/dist/runners/linkConcern.d.ts.map +1 -0
- package/dist/runners/linkConcern.js +85 -0
- package/dist/runners/linkConcern.js.map +1 -0
- package/dist/runners/linkControl.d.ts +25 -1
- package/dist/runners/linkControl.d.ts.map +1 -1
- package/dist/runners/linkControl.js +46 -4
- package/dist/runners/linkControl.js.map +1 -1
- package/dist/runners/pairingTiming.d.ts +2 -3
- package/dist/runners/pairingTiming.d.ts.map +1 -1
- package/dist/runners/pairingTiming.js +4 -18
- package/dist/runners/pairingTiming.js.map +1 -1
- package/dist/runners/runnerLock.d.ts +112 -0
- package/dist/runners/runnerLock.d.ts.map +1 -0
- package/dist/runners/runnerLock.js +292 -0
- package/dist/runners/runnerLock.js.map +1 -0
- package/dist/runners/runnersCli.d.ts +6 -3
- package/dist/runners/runnersCli.d.ts.map +1 -1
- package/dist/runners/runnersCli.js +33 -6
- package/dist/runners/runnersCli.js.map +1 -1
- package/dist/runners/runnersList.d.ts +3 -3
- package/dist/runners/runnersList.d.ts.map +1 -1
- package/dist/runners/runnersList.js +9 -2
- package/dist/runners/runnersList.js.map +1 -1
- package/dist/runners/runnersOverview.d.ts +29 -3
- package/dist/runners/runnersOverview.d.ts.map +1 -1
- package/dist/runners/runnersOverview.js +71 -6
- package/dist/runners/runnersOverview.js.map +1 -1
- package/dist/runners/serviceRemoval.d.ts +43 -0
- package/dist/runners/serviceRemoval.d.ts.map +1 -0
- package/dist/runners/serviceRemoval.js +114 -0
- package/dist/runners/serviceRemoval.js.map +1 -0
- package/dist/scheduler/checkStatus.d.ts +78 -0
- package/dist/scheduler/checkStatus.d.ts.map +1 -0
- package/dist/scheduler/checkStatus.js +122 -0
- package/dist/scheduler/checkStatus.js.map +1 -0
- package/dist/scheduler/delivery.d.ts +27 -1
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +83 -6
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +2 -0
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +62 -10
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/store.d.ts +16 -1
- package/dist/scheduler/store.d.ts.map +1 -1
- package/dist/scheduler/store.js +33 -0
- package/dist/scheduler/store.js.map +1 -1
- package/dist/scheduler/types.d.ts +22 -0
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/unbindPause.d.ts +27 -0
- package/dist/scheduler/unbindPause.d.ts.map +1 -0
- package/dist/scheduler/unbindPause.js +21 -0
- package/dist/scheduler/unbindPause.js.map +1 -0
- package/dist/scheduler/workerActivity.d.ts +25 -0
- package/dist/scheduler/workerActivity.d.ts.map +1 -0
- package/dist/scheduler/workerActivity.js +195 -0
- package/dist/scheduler/workerActivity.js.map +1 -0
- package/dist/scheduler/workerWatch.d.ts +14 -2
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +15 -3
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/state.d.ts +8 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +30 -0
- package/dist/state.js.map +1 -1
- package/dist/stt/sttRuntime.d.ts.map +1 -1
- package/dist/stt/sttRuntime.js +8 -1
- package/dist/stt/sttRuntime.js.map +1 -1
- package/dist/stt/sttSettings.d.ts +56 -6
- package/dist/stt/sttSettings.d.ts.map +1 -1
- package/dist/stt/sttSettings.js +128 -7
- package/dist/stt/sttSettings.js.map +1 -1
- package/dist/stt/sttSidecarOwner.d.ts +13 -5
- package/dist/stt/sttSidecarOwner.d.ts.map +1 -1
- package/dist/stt/sttSidecarOwner.js +72 -31
- package/dist/stt/sttSidecarOwner.js.map +1 -1
- package/dist/stt/transcribeChain.d.ts +23 -1
- package/dist/stt/transcribeChain.d.ts.map +1 -1
- package/dist/stt/transcribeChain.js +59 -4
- package/dist/stt/transcribeChain.js.map +1 -1
- package/dist/testTimings.d.ts +4 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +7 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/testTimingsSeam.d.ts +10 -0
- package/dist/testTimingsSeam.d.ts.map +1 -0
- package/dist/testTimingsSeam.js +29 -0
- package/dist/testTimingsSeam.js.map +1 -0
- package/dist/utils/runnersScreenPlan.d.ts +14 -0
- package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
- package/dist/utils/runnersScreenPlan.js +49 -5
- package/dist/utils/runnersScreenPlan.js.map +1 -1
- package/dist/utils/surrogateSafeCut.d.ts +14 -0
- package/dist/utils/surrogateSafeCut.d.ts.map +1 -0
- package/dist/utils/surrogateSafeCut.js +30 -0
- package/dist/utils/surrogateSafeCut.js.map +1 -0
- package/dist/utils/telegramError.d.ts +7 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +15 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/transientFrames.d.ts +51 -6
- package/dist/utils/transientFrames.d.ts.map +1 -1
- package/dist/utils/transientFrames.js +52 -2
- package/dist/utils/transientFrames.js.map +1 -1
- package/dist/voiceProgressNote.d.ts +73 -0
- package/dist/voiceProgressNote.d.ts.map +1 -0
- package/dist/voiceProgressNote.js +142 -0
- package/dist/voiceProgressNote.js.map +1 -0
- package/package.json +4 -1
- package/remoteRun/pickNode.sh +65 -0
- package/remoteRun/runner-package-lock.json +59 -0
- package/remoteRun/runner.sh +304 -6
package/dist/bot.js
CHANGED
|
@@ -170,6 +170,7 @@ const topicView_1 = require("./utils/topicView");
|
|
|
170
170
|
const topicRequest_1 = require("./utils/topicRequest");
|
|
171
171
|
const serialQueue_1 = require("./utils/serialQueue");
|
|
172
172
|
const voiceQueue_1 = require("./voiceQueue");
|
|
173
|
+
const voiceProgressNote_1 = require("./voiceProgressNote");
|
|
173
174
|
const claudeLivenessAction_1 = require("./utils/claudeLivenessAction");
|
|
174
175
|
const isoTimestamp_1 = require("./utils/isoTimestamp");
|
|
175
176
|
const effortLevels_1 = require("./effortLevels");
|
|
@@ -195,6 +196,8 @@ const jsonStreamHost_1 = require("./utils/jsonStreamHost");
|
|
|
195
196
|
const runLedger_1 = require("./scheduler/runLedger");
|
|
196
197
|
const delivery_1 = require("./scheduler/delivery");
|
|
197
198
|
const checkRun_1 = require("./scheduler/checkRun");
|
|
199
|
+
const checkStatus_1 = require("./scheduler/checkStatus");
|
|
200
|
+
const workerActivity_1 = require("./scheduler/workerActivity");
|
|
198
201
|
const engine_1 = require("./scheduler/engine");
|
|
199
202
|
const recurrence_1 = require("./scheduler/recurrence");
|
|
200
203
|
const mcpSurface_1 = require("./scheduler/mcpSurface");
|
|
@@ -221,7 +224,8 @@ const wakeUpRules_1 = require("./requests/wakeUpRules");
|
|
|
221
224
|
const requestHeader_1 = require("./requests/requestHeader");
|
|
222
225
|
const directoryThreads_1 = require("./scheduler/directoryThreads");
|
|
223
226
|
const rebindResume_1 = require("./scheduler/rebindResume");
|
|
224
|
-
const
|
|
227
|
+
const store_2 = require("./scheduler/store");
|
|
228
|
+
const unbindPause_1 = require("./scheduler/unbindPause");
|
|
225
229
|
const apiErrorRetry_1 = require("./apiErrorRetry");
|
|
226
230
|
const wedgeRecovery_1 = require("./utils/wedgeRecovery");
|
|
227
231
|
const claudeAuthLogin_1 = require("./utils/claudeAuthLogin");
|
|
@@ -2334,19 +2338,19 @@ function getThreadMessageState(key) {
|
|
|
2334
2338
|
const k = (0, sessionKey_1.keyToString)(key);
|
|
2335
2339
|
let s = threadMessageStates.get(k);
|
|
2336
2340
|
if (!s) {
|
|
2337
|
-
s = { lastMessageId: null, lastMessageText: null, needsNewMessage: true, typingLoaderTimer: null, statusMessageId: null, thinkingMessageId: null, thinkingFrameGeneration: 0, statusFrameGeneration: 0, livenessTimer: null, lastActivityText: null, livenessGlyphIndex: 0, wasBusy: false, workingSince: null, lastLivenessSentAt: 0, statusIdleSuppressed: false, busyOnsetArmedUntil: 0, subagentStatusMessageId: null, subagentStartedAt: null, subagentTitle: null, subagentTimer: null, lastSubagentText: null, subagentEditInFlight: false };
|
|
2341
|
+
s = { lastMessageId: null, lastMessageText: null, needsNewMessage: true, typingLoaderTimer: null, statusMessageId: null, thinkingMessageId: null, thinkingFrameGeneration: 0, statusFrameGeneration: 0, livenessTimer: null, lastActivityText: null, livenessGlyphIndex: 0, wasBusy: false, workingSince: null, lastLivenessSentAt: 0, statusIdleSuppressed: false, busyOnsetArmedUntil: 0, subagentStatusMessageId: null, subagentStartedAt: null, subagentTitle: null, subagentTimer: null, lastSubagentText: null, subagentEditInFlight: false, voiceProgressNoteIds: [], undeletedMessageIds: [] };
|
|
2338
2342
|
threadMessageStates.set(k, s);
|
|
2339
2343
|
}
|
|
2340
2344
|
return s;
|
|
2341
2345
|
}
|
|
2342
2346
|
/**
|
|
2343
|
-
* @description Persist the thread's CURRENT transient
|
|
2344
|
-
* non-null `statusMessageId` / `thinkingMessageId` / `subagentStatusMessageId`
|
|
2345
|
-
* so an UNGRACEFUL restart (crash / SIGKILL — no graceful sweep ran) can delete
|
|
2347
|
+
* @description Persist the thread's CURRENT transient message ids (the
|
|
2348
|
+
* non-null `statusMessageId` / `thinkingMessageId` / `subagentStatusMessageId`
|
|
2349
|
+
* and the `voiceProgressNoteIds` and `undeletedMessageIds`) so an UNGRACEFUL restart (crash / SIGKILL — no graceful sweep ran) can delete
|
|
2346
2350
|
* whatever frame was on screen on the next boot (S2). The in-memory
|
|
2347
2351
|
* `ThreadMessageState` is the live source of truth; this just keeps disk in step.
|
|
2348
|
-
* Debounced + fire-and-forget. Single collection point shared by the
|
|
2349
|
-
*
|
|
2352
|
+
* Debounced + fire-and-forget. Single collection point shared by the frame-id
|
|
2353
|
+
* setters below so memory and disk never drift.
|
|
2350
2354
|
*/
|
|
2351
2355
|
function persistTransientFrames(key) {
|
|
2352
2356
|
const ids = (0, transientFrames_1.getTransientFrameIds)(getThreadMessageState(key));
|
|
@@ -2371,6 +2375,21 @@ function setSubagentFrameId(key, id) {
|
|
|
2371
2375
|
getThreadMessageState(key).subagentStatusMessageId = id;
|
|
2372
2376
|
persistTransientFrames(key);
|
|
2373
2377
|
}
|
|
2378
|
+
/** The voice notes' list is edited by value: a thread can have several, each owned by its own voice message. */
|
|
2379
|
+
function addVoiceProgressNoteId(key, id) {
|
|
2380
|
+
getThreadMessageState(key).voiceProgressNoteIds.push(id);
|
|
2381
|
+
persistTransientFrames(key);
|
|
2382
|
+
}
|
|
2383
|
+
function removeVoiceProgressNoteId(key, id) {
|
|
2384
|
+
const noteState = getThreadMessageState(key);
|
|
2385
|
+
noteState.voiceProgressNoteIds = noteState.voiceProgressNoteIds.filter((noteId) => noteId !== id);
|
|
2386
|
+
persistTransientFrames(key);
|
|
2387
|
+
}
|
|
2388
|
+
/** The leftovers still to delete (see {@link ThreadMessageState.undeletedMessageIds}): replaced as a whole, then mirrored to disk. */
|
|
2389
|
+
function setUndeletedMessageIds(key, ids) {
|
|
2390
|
+
getThreadMessageState(key).undeletedMessageIds = ids;
|
|
2391
|
+
persistTransientFrames(key);
|
|
2392
|
+
}
|
|
2374
2393
|
function getOutputQueueState(key) {
|
|
2375
2394
|
const k = (0, sessionKey_1.keyToString)(key);
|
|
2376
2395
|
let s = outputQueues.get(k);
|
|
@@ -3138,7 +3157,7 @@ async function replyToThread(key, text, extra = {}, options = {}) {
|
|
|
3138
3157
|
return null;
|
|
3139
3158
|
const sendOnce = (sendExtra) => {
|
|
3140
3159
|
const send = () => bot.telegram.sendMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), text, sendExtra);
|
|
3141
|
-
return options.unpaced ? (0, rateLimiter_1.sendUnpaced)(key, send) : (0, rateLimiter_1.enqueueSend)(key, send);
|
|
3160
|
+
return options.unpaced ? (0, rateLimiter_1.sendUnpaced)(key, send, options.signal) : (0, rateLimiter_1.enqueueSend)(key, send, options.signal);
|
|
3142
3161
|
};
|
|
3143
3162
|
// A sent message is tracked for `/clear_messages`, and a `/bind` picker is remembered to be closed by the next bind or leave.
|
|
3144
3163
|
const trackSent = async (sent) => {
|
|
@@ -3153,6 +3172,8 @@ async function replyToThread(key, text, extra = {}, options = {}) {
|
|
|
3153
3172
|
return await trackSent(await sendOnce(buildSendExtra(key, extra)));
|
|
3154
3173
|
}
|
|
3155
3174
|
catch (e) {
|
|
3175
|
+
if (options.signal?.aborted && (0, utils_1.checkIsAbortError)(e))
|
|
3176
|
+
return null;
|
|
3156
3177
|
// Markdown parse failure fallback. Several `t(...)` templates interpolate
|
|
3157
3178
|
// user-controlled content (subdir names, branch names, error strings)
|
|
3158
3179
|
// into Markdown body — a backtick or stray `*` inside the content
|
|
@@ -3199,20 +3220,27 @@ async function replyToThread(key, text, extra = {}, options = {}) {
|
|
|
3199
3220
|
* rendering passes it.
|
|
3200
3221
|
*/
|
|
3201
3222
|
async function editThreadMessage(key, messageId, text, extra = {}, plainFallbackText = text) {
|
|
3223
|
+
return (await editThreadMessageDetailed(key, messageId, text, extra, plainFallbackText)) === 'edited';
|
|
3224
|
+
}
|
|
3225
|
+
/**
|
|
3226
|
+
* @description {@link editThreadMessage} telling a message that is not there (deleted by hand: «message to edit not found») from any
|
|
3227
|
+
* other failure — see {@link ThreadMessageEdit}. The failure is logged either way, as before.
|
|
3228
|
+
*/
|
|
3229
|
+
async function editThreadMessageDetailed(key, messageId, text, extra = {}, plainFallbackText = text) {
|
|
3202
3230
|
if (!checkIsTelegramPrimitiveKey(key, 'editThreadMessage'))
|
|
3203
|
-
return
|
|
3231
|
+
return 'failed';
|
|
3204
3232
|
const editOnce = (editText, editExtra) => (0, rateLimiter_1.enqueueSend)(key, () => bot.telegram.editMessageText((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId, undefined, editText, editExtra));
|
|
3205
3233
|
try {
|
|
3206
3234
|
await editOnce(text, extra);
|
|
3207
|
-
return
|
|
3235
|
+
return 'edited';
|
|
3208
3236
|
}
|
|
3209
3237
|
catch (e) {
|
|
3210
3238
|
const desc = (0, sendErrorClassifier_1.checkIsApiError)(e) ? (0, sendErrorClassifier_1.getErrorDescription)(e) : '';
|
|
3211
3239
|
if (/message is not modified/i.test(desc))
|
|
3212
|
-
return
|
|
3240
|
+
return 'edited'; // benign
|
|
3213
3241
|
if (/thread not found|TOPIC_CLOSED|topic is closed/i.test(desc)) {
|
|
3214
3242
|
await handleSendError(key, e);
|
|
3215
|
-
return
|
|
3243
|
+
return 'failed';
|
|
3216
3244
|
}
|
|
3217
3245
|
// Symmetric markdown-parse-fail fallback to `replyToThread`. See the
|
|
3218
3246
|
// long comment there — same rationale: prefer a plain-text edit over
|
|
@@ -3224,18 +3252,18 @@ async function editThreadMessage(key, messageId, text, extra = {}, plainFallback
|
|
|
3224
3252
|
delete plainExtra.parse_mode;
|
|
3225
3253
|
try {
|
|
3226
3254
|
await editOnce(plainFallbackText, plainExtra);
|
|
3227
|
-
return
|
|
3255
|
+
return 'edited';
|
|
3228
3256
|
}
|
|
3229
3257
|
catch (e2) {
|
|
3230
3258
|
const desc2 = (0, sendErrorClassifier_1.checkIsApiError)(e2) ? (0, sendErrorClassifier_1.getErrorDescription)(e2) : '';
|
|
3231
3259
|
if (/message is not modified/i.test(desc2))
|
|
3232
|
-
return
|
|
3260
|
+
return 'edited';
|
|
3233
3261
|
console.error(`[edit] ${(0, sessionKey_1.keyToString)(key)}#${messageId} retry failed:`, desc2 || e2);
|
|
3234
|
-
return
|
|
3262
|
+
return (0, telegramError_1.checkIsMessageNotFoundError)(e2) ? 'gone' : 'failed';
|
|
3235
3263
|
}
|
|
3236
3264
|
}
|
|
3237
3265
|
console.error(`[edit] ${(0, sessionKey_1.keyToString)(key)}#${messageId}:`, desc || e);
|
|
3238
|
-
return
|
|
3266
|
+
return (0, telegramError_1.checkIsMessageNotFoundError)(e) ? 'gone' : 'failed';
|
|
3239
3267
|
}
|
|
3240
3268
|
}
|
|
3241
3269
|
/**
|
|
@@ -3258,11 +3286,17 @@ async function editThreadKeyboard(key, messageId, keyboard, logTag) {
|
|
|
3258
3286
|
return false;
|
|
3259
3287
|
}
|
|
3260
3288
|
}
|
|
3261
|
-
|
|
3289
|
+
/**
|
|
3290
|
+
* @description {@link deleteThreadMessage} telling a message that was already gone from one that stayed — see {@link ThreadMessageDeletion}. None of them is logged: all are expected.
|
|
3291
|
+
* `isUnpaced` sends the delete outside the global pacer, for a message whose disappearance is part of an answer that is already
|
|
3292
|
+
* on screen (the «transcribing…» note, which must not outlive the 🎤 echo behind queued agent output).
|
|
3293
|
+
*/
|
|
3294
|
+
async function deleteThreadMessageDetailed(key, messageId, options = {}) {
|
|
3262
3295
|
if (!checkIsTelegramPrimitiveKey(key, 'deleteThreadMessage'))
|
|
3263
3296
|
return 'stayed';
|
|
3264
3297
|
try {
|
|
3265
|
-
|
|
3298
|
+
const deleteMessage = () => bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId);
|
|
3299
|
+
await (options.isUnpaced ? (0, rateLimiter_1.sendUnpaced)(key, deleteMessage) : (0, rateLimiter_1.enqueueSend)(key, deleteMessage));
|
|
3266
3300
|
return 'deleted';
|
|
3267
3301
|
}
|
|
3268
3302
|
catch (e) {
|
|
@@ -3772,7 +3806,7 @@ const shutdownFrameSweepMs = 1500;
|
|
|
3772
3806
|
* them up orphans the messages forever in the topic (the reported incident:
|
|
3773
3807
|
* ~25 hot reloads left "✽ работаю…" frames stuck; and a 🔧 tool status stranded
|
|
3774
3808
|
* as a topic's last message when a hot reload landed mid-tool). Iterates every
|
|
3775
|
-
* tracked thread, and for each
|
|
3809
|
+
* tracked thread, and for each `clearTransientFramesForShutdown` (inside `sweepTransientMessages`) BUMPS both
|
|
3776
3810
|
* frame generations (so a `sendStatusFrame`/thinking create still mid-`await`
|
|
3777
3811
|
* discards its just-sent message instead of orphaning it — see that helper) and
|
|
3778
3812
|
* nulls the in-memory ids so a racing per-thread tick can't re-edit a just-deleted
|
|
@@ -3784,43 +3818,52 @@ const shutdownFrameSweepMs = 1500;
|
|
|
3784
3818
|
* an orphan after the sweep. Threads that had nothing on screen still skip the
|
|
3785
3819
|
* (fire-and-forget) persist + delete work.
|
|
3786
3820
|
*
|
|
3821
|
+
* A delete that fails for a reason a later try can fix (no answer from Telegram, a
|
|
3822
|
+
* 429, a 5xx) no longer forgets the message: the collected ids are PARKED in the
|
|
3823
|
+
* thread's in-memory `undeletedMessageIds` (the clear does that), the deletes run, and
|
|
3824
|
+
* the list is replaced by the ones to try again through `setUndeletedMessageIds` — the
|
|
3825
|
+
* same save every other writer of the persisted set uses, so a late frame setter or
|
|
3826
|
+
* note removal that persists the thread meanwhile still carries them, and so does a
|
|
3827
|
+
* sweep cut short by its bound. The next boot's {@link reconcileTransientFrames}
|
|
3828
|
+
* tries again. Final answers (already gone, too old, refused) settle an id.
|
|
3829
|
+
*
|
|
3787
3830
|
* Wired into {@link gracefulShutdown} as `clearTransientFrames`: runs AFTER
|
|
3788
3831
|
* `cleanupTimers()` (no interval re-creates a frame mid-sweep) and BEFORE
|
|
3789
3832
|
* `bot.stop()` (the Telegram client must still send the deletes). Self-bounded by
|
|
3790
3833
|
* {@link shutdownFrameSweepMs} — a slow API must not starve `state.flush()`.
|
|
3791
3834
|
*/
|
|
3792
3835
|
async function sweepTransientFramesOnShutdown() {
|
|
3793
|
-
|
|
3836
|
+
// The voice notes first: their timers and sends in flight are stopped and cleaned (bounded), so nothing can register an id
|
|
3837
|
+
// behind the sweep. `cleanupTimers` already started this; the sweep waits for it.
|
|
3838
|
+
await voiceProgressNotes.shutDown();
|
|
3839
|
+
const threads = [];
|
|
3794
3840
|
for (const [keyStr, msgState] of threadMessageStates) {
|
|
3795
|
-
let key;
|
|
3796
3841
|
try {
|
|
3797
|
-
key
|
|
3842
|
+
threads.push({ key: (0, sessionKey_1.keyFromString)(keyStr), state: msgState });
|
|
3798
3843
|
}
|
|
3799
3844
|
catch {
|
|
3800
3845
|
continue;
|
|
3801
3846
|
}
|
|
3802
|
-
// Bump generations + null ids for EVERY tracked thread (fixes the racing
|
|
3803
|
-
// create that resolves after the sweep). Only threads that HAD a frame on
|
|
3804
|
-
// screen need the persist + delete.
|
|
3805
|
-
const ids = (0, transientFrames_1.clearTransientFramesForShutdown)(msgState);
|
|
3806
|
-
if (ids.length === 0)
|
|
3807
|
-
continue;
|
|
3808
|
-
for (const id of ids) {
|
|
3809
|
-
deletes.push(bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), id).catch(() => { }));
|
|
3810
|
-
}
|
|
3811
|
-
// Clear the S2 persisted set too, so the next boot's reconciliation finds
|
|
3812
|
-
// nothing to redo after a graceful exit.
|
|
3813
|
-
state.setTransientFrames(key, []).catch(() => { });
|
|
3814
3847
|
}
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3848
|
+
const sweeping = (0, transientFrames_1.sweepTransientMessages)(threads, {
|
|
3849
|
+
deleteMessage: async (key, messageId) => { await bot.telegram.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId); },
|
|
3850
|
+
checkIsRetryable: telegramError_1.checkIsRetryableTelegramError,
|
|
3851
|
+
saveKeptIds: setUndeletedMessageIds,
|
|
3852
|
+
logProblem: (line) => console.warn(line),
|
|
3853
|
+
});
|
|
3854
|
+
let boundTimer;
|
|
3855
|
+
try {
|
|
3856
|
+
await Promise.race([
|
|
3857
|
+
sweeping,
|
|
3858
|
+
new Promise((resolve) => {
|
|
3859
|
+
boundTimer = setTimeout(resolve, shutdownFrameSweepMs);
|
|
3860
|
+
boundTimer.unref?.();
|
|
3861
|
+
}),
|
|
3862
|
+
]);
|
|
3863
|
+
}
|
|
3864
|
+
finally {
|
|
3865
|
+
clearTimeout(boundTimer);
|
|
3866
|
+
}
|
|
3824
3867
|
}
|
|
3825
3868
|
/**
|
|
3826
3869
|
* Hard bound (ms) on the whole shutdown output flush (finalize + FIFO drain):
|
|
@@ -3974,7 +4017,7 @@ async function bootSttLocalEngine() {
|
|
|
3974
4017
|
* precedes: queued behind agent output it could land after the retry already
|
|
3975
4018
|
* succeeded.
|
|
3976
4019
|
*/
|
|
3977
|
-
async function transcribeVoiceFile(key, filePath, durationSeconds) {
|
|
4020
|
+
async function transcribeVoiceFile(key, filePath, durationSeconds, warmedEndpoint) {
|
|
3978
4021
|
const { engines, settings } = getResolvedSttSettings();
|
|
3979
4022
|
if (engines.length === 0)
|
|
3980
4023
|
return { ok: false, error: 'no speech engine available' };
|
|
@@ -3982,6 +4025,7 @@ async function transcribeVoiceFile(key, filePath, durationSeconds) {
|
|
|
3982
4025
|
const result = await (0, transcribeChain_1.transcribeWithEngines)(filePath, engines, {
|
|
3983
4026
|
durationSeconds,
|
|
3984
4027
|
language: settings.language,
|
|
4028
|
+
warmedEndpoint,
|
|
3985
4029
|
onFallback: ({ from, to, error }) => {
|
|
3986
4030
|
console.warn(`[transcribe] ${from} failed (${error}); falling back to ${to}`);
|
|
3987
4031
|
},
|
|
@@ -3999,6 +4043,33 @@ async function transcribeVoiceFile(key, filePath, durationSeconds) {
|
|
|
3999
4043
|
}
|
|
4000
4044
|
return result;
|
|
4001
4045
|
}
|
|
4046
|
+
/**
|
|
4047
|
+
* The notes armed right now: a shutdown stops them (`cleanupTimers` and the sweep), so a timer that fires or a send that lands
|
|
4048
|
+
* after the sweep cannot strand a message past the last state flush.
|
|
4049
|
+
*/
|
|
4050
|
+
const voiceProgressNotes = (0, voiceProgressNote_1.createVoiceProgressNoteRegistry)();
|
|
4051
|
+
/**
|
|
4052
|
+
* @description Arm the «🎙 Transcribing the voice message…» note for a voice message that just arrived in `key`. While the
|
|
4053
|
+
* local engine loads (up to 2 minutes, `src/stt/README.md`) the topic would show nothing and the voice would look lost; the note
|
|
4054
|
+
* appears only when the text is later than `voiceProgressNoteDelayMs`, is SILENT (a muted topic stays quiet, an unmuted one makes
|
|
4055
|
+
* no sound), goes out UNPACED like the 🎤 echo it makes way for, and is deleted unpaced the moment the text arrives or the
|
|
4056
|
+
* transcription fails (`VoiceProgressNote.finish`, which the voice job AWAITS before it answers — bounded, so a stalled delete
|
|
4057
|
+
* cannot hold the transcript back). Its id is kept in the thread's transient-message set, so a restart that kills the voice job
|
|
4058
|
+
* still deletes the note: the graceful sweep, or the next boot after a crash.
|
|
4059
|
+
*/
|
|
4060
|
+
function startVoiceProgressNote(key) {
|
|
4061
|
+
return voiceProgressNotes.start({
|
|
4062
|
+
postNote: (signal) => replyToThread(key, withThreadLocale(key, () => (0, i18n_1.t)('voice.transcribing')), { disable_notification: true }, { unpaced: true, signal }),
|
|
4063
|
+
rememberNote: (messageId) => addVoiceProgressNoteId(key, messageId),
|
|
4064
|
+
deleteNote: async (messageId) => {
|
|
4065
|
+
const deletion = await deleteThreadMessageDetailed(key, messageId, { isUnpaced: true });
|
|
4066
|
+
// A note that stayed keeps its place in the set: the next sweep or boot retries it.
|
|
4067
|
+
if (deletion !== 'stayed')
|
|
4068
|
+
removeVoiceProgressNoteId(key, messageId);
|
|
4069
|
+
},
|
|
4070
|
+
logProblem: (line) => console.warn(line),
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4002
4073
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
4003
4074
|
// Adapter lifecycle helpers
|
|
4004
4075
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
@@ -5077,8 +5148,10 @@ const botCore = {
|
|
|
5077
5148
|
getState: () => state,
|
|
5078
5149
|
replyToThread,
|
|
5079
5150
|
editThreadMessage,
|
|
5151
|
+
editThreadMessageDetailed,
|
|
5080
5152
|
editThreadKeyboard,
|
|
5081
5153
|
deleteThreadMessage,
|
|
5154
|
+
deleteThreadMessageDetailed,
|
|
5082
5155
|
authoriseContext,
|
|
5083
5156
|
withThreadLocale,
|
|
5084
5157
|
checkIsGeneral,
|
|
@@ -5541,28 +5614,24 @@ async function stripWelcomeKeyboards(key, messageIds) {
|
|
|
5541
5614
|
await (0, bindSweep_1.stripStaleKeyboards)(messageIds, (messageId) => editThreadKeyboard(key, messageId, null, 'welcome'));
|
|
5542
5615
|
}
|
|
5543
5616
|
/**
|
|
5544
|
-
* @description
|
|
5545
|
-
*
|
|
5546
|
-
*
|
|
5547
|
-
* NOT touched (user decision: pins accumulate). Returns the number paused so the
|
|
5548
|
-
* caller can decide whether anything happened. The engine stays generic — this
|
|
5549
|
-
* unbound-specific policy lives here in bot.ts.
|
|
5550
|
-
*
|
|
5551
|
-
* Reminders are EXEMPT ({@link getUnboundPausableSchedules}): they post + pin with
|
|
5552
|
-
* no agent and no folder, so pausing them on unbind would break the one kind that
|
|
5553
|
-
* could still have fired. A thread holding only reminders pauses nothing and posts
|
|
5554
|
-
* no notice.
|
|
5617
|
+
* @description The ports the status line's CLEARING runs over — shared by the scheduler's delivery (a failed run, a topic that
|
|
5618
|
+
* stopped showing the stream, the final run) and by the unbind pause, so the one `clearCheckStatusLine` works the same from both.
|
|
5619
|
+
* The delete is best effort (`deleteThreadMessage` never rejects: a message that is gone or too old to delete stays).
|
|
5555
5620
|
*/
|
|
5621
|
+
const checkStatusLinePorts = {
|
|
5622
|
+
recordStatusLine: (jobId, line) => (0, store_2.recordCheckStatusLine)(state, jobId, line),
|
|
5623
|
+
deleteMessage: async (threadKeyStr, messageId) => {
|
|
5624
|
+
await deleteThreadMessage((0, sessionKey_1.keyFromString)(threadKeyStr), messageId);
|
|
5625
|
+
},
|
|
5626
|
+
};
|
|
5627
|
+
/** @description The `/unbind` wiring of `pauseSchedulesOnUnbind` (`scheduler/unbindPause.ts`, which holds the policy) over the shared status-line ports. */
|
|
5556
5628
|
async function pauseThreadSchedulesOnUnbind(key) {
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
}
|
|
5564
|
-
await replyToThread(key, (0, i18n_1.t)('schedule.pausedUnbound', { count: records.length }));
|
|
5565
|
-
return records.length;
|
|
5629
|
+
return (0, unbindPause_1.pauseSchedulesOnUnbind)({
|
|
5630
|
+
store: state,
|
|
5631
|
+
disarmJob: (jobId) => schedulerEngine?.disarmJob(jobId),
|
|
5632
|
+
statusLinePorts: checkStatusLinePorts,
|
|
5633
|
+
announcePaused: (count) => replyToThread(key, (0, i18n_1.t)('schedule.pausedUnbound', { count })),
|
|
5634
|
+
}, key);
|
|
5566
5635
|
}
|
|
5567
5636
|
/**
|
|
5568
5637
|
* @description Resume the schedules paused for `'unbound'` on `key` when its
|
|
@@ -6605,6 +6674,11 @@ const { registerRunnersCommands, registerRunnersCallbacks, handleRunnersAddressT
|
|
|
6605
6674
|
hub: runnersHub,
|
|
6606
6675
|
// The pairing messages this instance sent: its own record (the hub registry is shared by every instance of the OS user).
|
|
6607
6676
|
pairingMessagesPath: path.join((0, state_1.resolveDataDir)(), 'runner-pairing-messages.json'),
|
|
6677
|
+
// What this instance has told about where the runners' links come from: once per new concern, pinned in General.
|
|
6678
|
+
linkNoticesPath: path.join((0, state_1.resolveDataDir)(), 'runner-link-notices.json'),
|
|
6679
|
+
cacheDir: runnersCacheDir,
|
|
6680
|
+
getGeneralKey: () => getOperatorGeneralKey(),
|
|
6681
|
+
pinMessage: (key, messageId) => pinMessageQuiet(key, messageId, { disableNotification: false }),
|
|
6608
6682
|
sweepExpiredCodes: async (nowMs) => { await (0, hubPairing_1.sweepExpiredPairings)(runnersHub, nowMs); },
|
|
6609
6683
|
readRunnerHost: (0, instanceSettings_1.createRunnerHostReader)(() => (0, instanceSettings_1.getInstanceSettingsPath)(), (line) => console.error(line)),
|
|
6610
6684
|
saveRunnerHost: (address) => (0, instanceSettings_1.saveInstanceSettingsChange)((0, instanceSettings_1.getInstanceSettingsPath)(), { runnerHost: address }),
|
|
@@ -8456,6 +8530,9 @@ bot.on((0, filters_1.message)('voice'), async (ctx) => {
|
|
|
8456
8530
|
await replyToThread(key, (0, i18n_1.t)((0, sttSettings_1.getNoEngineNoticeCode)(sttSettings)));
|
|
8457
8531
|
return;
|
|
8458
8532
|
}
|
|
8533
|
+
// The local engine may be cold: start its load now, so it overlaps the download and the topic's voice queue. The voice's
|
|
8534
|
+
// job reuses this one ask, so the engine is started once per voice, whatever the outcome.
|
|
8535
|
+
const warmedEndpoint = (0, transcribeChain_1.warmUpFirstEngine)(sttSettings.engines, (line) => console.warn(line));
|
|
8459
8536
|
// Offload the slow download+transcribe+forward off the telegraf update loop:
|
|
8460
8537
|
// awaiting it here would stall intake of EVERY update until Groq replies
|
|
8461
8538
|
// (up to 20s, longer on retries) and freeze the whole bot. The per-thread
|
|
@@ -8470,11 +8547,16 @@ bot.on((0, filters_1.message)('voice'), async (ctx) => {
|
|
|
8470
8547
|
// Compute it HERE (only the handler has `ctx`); the job runs later off the
|
|
8471
8548
|
// update loop and only sees `key`/`bot`.
|
|
8472
8549
|
const replyBlock = getReplyQuoteBlock(key, ctx.message);
|
|
8550
|
+
// Armed LAST, right before the job is queued: nothing between here and the queue may throw and strand an armed note. The
|
|
8551
|
+
// clock runs from the voice's arrival, so a voice waiting in line behind an earlier one gets its note too; the job finishes it
|
|
8552
|
+
// the moment its text arrives, and the `finally` is the backstop for a job that never ran or ended some other way.
|
|
8553
|
+
const progressNote = startVoiceProgressNote(key);
|
|
8473
8554
|
void (0, voiceQueue_1.getVoiceTranscriptionQueue)(key)
|
|
8474
|
-
.run(() => processVoiceJob(key, fileId, durationSeconds, (0, topicRequest_1.getTopicRequesterId)(ctx.from), sentAtMs, replyBlock))
|
|
8555
|
+
.run(() => processVoiceJob(key, fileId, durationSeconds, (0, topicRequest_1.getTopicRequesterId)(ctx.from), warmedEndpoint, progressNote, sentAtMs, replyBlock))
|
|
8475
8556
|
.catch((err) => {
|
|
8476
8557
|
console.error('[Bot] Voice job error (already handled):', err);
|
|
8477
|
-
})
|
|
8558
|
+
})
|
|
8559
|
+
.finally(() => progressNote.finish());
|
|
8478
8560
|
});
|
|
8479
8561
|
/**
|
|
8480
8562
|
* @description Background worker for a single voice note: download → transcribe
|
|
@@ -8487,9 +8569,14 @@ bot.on((0, filters_1.message)('voice'), async (ctx) => {
|
|
|
8487
8569
|
* take ~20s, so "now" at forward time would drift). `replyContext` is the
|
|
8488
8570
|
* reply-quote block the handler built from `ctx.message` (a Telegram REPLY on
|
|
8489
8571
|
* the voice note), plumbed here since the job no longer has `ctx`; so is
|
|
8490
|
-
* `requesterId`, the sender the transcript's request is filed under
|
|
8491
|
-
|
|
8492
|
-
|
|
8572
|
+
* `requesterId`, the sender the transcript's request is filed under, and
|
|
8573
|
+
* `warmedEndpoint`, the first engine's endpoint asked for when the note arrived
|
|
8574
|
+
* (the job reuses that one ask — see `warmUpFirstEngine`), and `progressNote`, the
|
|
8575
|
+
* «transcribing…» note armed on arrival, which the job finishes as soon as the
|
|
8576
|
+
* text is here or the voice failed — BEFORE the echo or the failure notice, never
|
|
8577
|
+
* at the end of the job (delivering the prompt may take long).
|
|
8578
|
+
*/
|
|
8579
|
+
async function processVoiceJob(key, fileId, durationSeconds, requesterId, warmedEndpoint, progressNote, sentAtMs, replyContext) {
|
|
8493
8580
|
try {
|
|
8494
8581
|
// Audit S14 / #33: `getFileLink` builds the bot-token URL in one
|
|
8495
8582
|
// place inside Telegraf instead of us materialising the token in a
|
|
@@ -8516,11 +8603,15 @@ async function processVoiceJob(key, fileId, durationSeconds, requesterId, sentAt
|
|
|
8516
8603
|
catch (downloadErr) {
|
|
8517
8604
|
const msg = downloadErr instanceof Error ? downloadErr.message : String(downloadErr);
|
|
8518
8605
|
console.warn(`[Bot] voice download failed after retries: ${msg}`);
|
|
8606
|
+
await progressNote.finish();
|
|
8519
8607
|
await replyToThread(key, `${(0, i18n_1.t)('voice.failed')} (${msg})`);
|
|
8520
8608
|
return;
|
|
8521
8609
|
}
|
|
8522
|
-
const result = await transcribeVoiceFile(key, tempFile, durationSeconds);
|
|
8610
|
+
const result = await transcribeVoiceFile(key, tempFile, durationSeconds, warmedEndpoint);
|
|
8523
8611
|
fs.unlink(tempFile, () => { });
|
|
8612
|
+
// Text or failure — either way the wait is over. The note is gone BEFORE the echo or the failure notice goes out (the finish is
|
|
8613
|
+
// bounded, so a stalled delete holds the answer back for a moment at most; what it cut short ends in the background).
|
|
8614
|
+
await progressNote.finish();
|
|
8524
8615
|
if (!result.ok) {
|
|
8525
8616
|
await replyToThread(key, `${(0, i18n_1.t)('voice.failed')} (${result.error})`);
|
|
8526
8617
|
return;
|
|
@@ -8601,6 +8692,7 @@ async function processVoiceJob(key, fileId, durationSeconds, requesterId, sentAt
|
|
|
8601
8692
|
}
|
|
8602
8693
|
catch (err) {
|
|
8603
8694
|
console.error('[Bot] Voice handling error:', err);
|
|
8695
|
+
await progressNote.finish();
|
|
8604
8696
|
await replyToThread(key, 'Error processing voice message');
|
|
8605
8697
|
}
|
|
8606
8698
|
}
|
|
@@ -11926,26 +12018,30 @@ function healSchedulerMcpForActiveSessions() {
|
|
|
11926
12018
|
}
|
|
11927
12019
|
const defaultReconcileTransientFramesDeps = {
|
|
11928
12020
|
deleteMessage: (chatId, messageId) => bot.telegram.deleteMessage(chatId, messageId),
|
|
11929
|
-
|
|
12021
|
+
setUndeletedMessageIds,
|
|
12022
|
+
checkIsRetryable: telegramError_1.checkIsRetryableTelegramError,
|
|
11930
12023
|
};
|
|
11931
12024
|
/**
|
|
11932
|
-
* @description Delete transient
|
|
11933
|
-
*
|
|
11934
|
-
* "✽ working…" / thinking /
|
|
11935
|
-
* (S2, the crash safety net
|
|
11936
|
-
* snapshot
|
|
11937
|
-
*
|
|
11938
|
-
*
|
|
11939
|
-
* the
|
|
11940
|
-
*
|
|
11941
|
-
*
|
|
11942
|
-
*
|
|
11943
|
-
*
|
|
11944
|
-
*
|
|
11945
|
-
*
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
12025
|
+
* @description Delete transient messages left on screen by an exit that did not
|
|
12026
|
+
* finish its own cleanup — a crash / SIGKILL (the graceful shutdown sweep never
|
|
12027
|
+
* ran) or a sweep whose deletes hit a bad moment: the "✽ working…" / thinking /
|
|
12028
|
+
* sub-agent frames and the «transcribing…» voice notes (S2, the crash safety net
|
|
12029
|
+
* behind S1). The snapshot MUST be captured BEFORE reattach (see {@link startBot}):
|
|
12030
|
+
* a reattached session's frame setters persist the fresh in-memory state and would
|
|
12031
|
+
* clobber the live persisted set first. Every snapshot id is stale by definition
|
|
12032
|
+
* (the fresh process holds no handle to it; a still-busy reattached session
|
|
12033
|
+
* repaints its OWN fresh frame), so deleting is always safe.
|
|
12034
|
+
*
|
|
12035
|
+
* The stale ids are first parked in the thread's `undeletedMessageIds` (persisted
|
|
12036
|
+
* with the live ids), then deleted; a delete that fails for a reason a later try can
|
|
12037
|
+
* fix (no answer from Telegram, a 429, a 5xx) KEEPS its id there — the next sweep and
|
|
12038
|
+
* the next boot retry it — while a final answer (already gone, too old to delete,
|
|
12039
|
+
* refused) settles it. Before, the persisted set was re-synced to the live ids at
|
|
12040
|
+
* once and a failed delete was forgotten: the frame stayed in the topic with no
|
|
12041
|
+
* record left. Resolves with how many stale ids were settled; never rejects.
|
|
12042
|
+
*/
|
|
12043
|
+
async function reconcileTransientFrames(orphaned, deps = defaultReconcileTransientFramesDeps) {
|
|
12044
|
+
const threads = [];
|
|
11949
12045
|
for (const [keyStr, ids] of Object.entries(orphaned)) {
|
|
11950
12046
|
let key;
|
|
11951
12047
|
try {
|
|
@@ -11956,17 +12052,21 @@ function reconcileTransientFrames(orphaned, deps = defaultReconcileTransientFram
|
|
|
11956
12052
|
// keep booting. Tolerated-and-skipped, like restorePendingQuestions.
|
|
11957
12053
|
continue;
|
|
11958
12054
|
}
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
deleted += 1;
|
|
11962
|
-
}
|
|
11963
|
-
// Sync disk to the LIVE in-memory frames (post-reattach): a still-busy
|
|
11964
|
-
// session that repainted a fresh frame keeps its new id; an idle one clears.
|
|
11965
|
-
deps.persistFrames(key);
|
|
12055
|
+
deps.setUndeletedMessageIds(key, ids);
|
|
12056
|
+
threads.push({ key, ids });
|
|
11966
12057
|
}
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
12058
|
+
const settledCounts = await Promise.all(threads.map(async ({ key, ids }) => {
|
|
12059
|
+
const keptIds = await (0, transientFrames_1.deleteTransientMessages)(ids, async (messageId) => { await deps.deleteMessage((0, sessionKeyCodec_1.getTelegramChatId)(key), messageId); }, deps.checkIsRetryable);
|
|
12060
|
+
deps.setUndeletedMessageIds(key, keptIds);
|
|
12061
|
+
return ids.length - keptIds.length;
|
|
12062
|
+
}));
|
|
12063
|
+
const settled = settledCounts.reduce((total, count) => total + count, 0);
|
|
12064
|
+
const kept = threads.reduce((total, { ids }) => total + ids.length, 0) - settled;
|
|
12065
|
+
if (settled > 0)
|
|
12066
|
+
console.log(`[reattach] transient frames: deleted ${settled} stale`);
|
|
12067
|
+
if (kept > 0)
|
|
12068
|
+
console.warn(`[reattach] transient frames: ${kept} could not be deleted now; they stay recorded and are tried again at the next sweep and boot`);
|
|
12069
|
+
return settled;
|
|
11970
12070
|
}
|
|
11971
12071
|
/**
|
|
11972
12072
|
* Bot composition for the reusable file-send service. Every gateway method
|
|
@@ -12228,6 +12328,7 @@ function wireScheduler(wiring) {
|
|
|
12228
12328
|
const ledger = new runLedger_1.RunLedger();
|
|
12229
12329
|
const delivery = (0, delivery_1.createScheduleDelivery)({
|
|
12230
12330
|
...createSessionPostDeps(),
|
|
12331
|
+
...checkStatusLinePorts,
|
|
12231
12332
|
announce: (threadKeyStr, text) => replyToThread((0, sessionKey_1.keyFromString)(threadKeyStr), text),
|
|
12232
12333
|
pin: async (threadKeyStr, messageId, isSilent) => {
|
|
12233
12334
|
const key = (0, sessionKey_1.keyFromString)(threadKeyStr);
|
|
@@ -12257,6 +12358,18 @@ function wireScheduler(wiring) {
|
|
|
12257
12358
|
// Saved at once, like the failing flag: an id lost in a crash would leave its alert pinned for good.
|
|
12258
12359
|
await state.flush();
|
|
12259
12360
|
},
|
|
12361
|
+
checkIsStatusShown: (threadKeyStr) => {
|
|
12362
|
+
const key = (0, sessionKey_1.keyFromString)(threadKeyStr);
|
|
12363
|
+
return (0, checkStatus_1.checkIsCheckStatusShown)({ isTelegram: (0, sessionKeyCodec_1.checkIsTelegramKey)(key), view: state.getDisplayPrefs(key).view });
|
|
12364
|
+
},
|
|
12365
|
+
// The status line is the bot's own message: silent (a heartbeat must never notify) and never pinned. Nothing here reaches an agent.
|
|
12366
|
+
postStatus: (threadKeyStr, text) => replyToThread((0, sessionKey_1.keyFromString)(threadKeyStr), text, { disable_notification: true }),
|
|
12367
|
+
readWorkerActivity: async (threadKeyStr, runDir) => {
|
|
12368
|
+
const decision = (0, validation_1.resolveBoundWorkDir)(ENV.workRoot, state.getBinding((0, sessionKey_1.keyFromString)(threadKeyStr)));
|
|
12369
|
+
// A relative run directory is read from the bound folder, like a check command's working directory.
|
|
12370
|
+
return decision.kind === 'proceed' ? (0, workerActivity_1.readWorkerActivity)(path.resolve(decision.workDir, runDir)) : null;
|
|
12371
|
+
},
|
|
12372
|
+
statusIntervalOverrideMs: ENV.testTimings.checkStatusIntervalMs,
|
|
12260
12373
|
});
|
|
12261
12374
|
/**
|
|
12262
12375
|
* The engine's deliver callback: the S4 pipeline plus the S8 unbound-pause
|
|
@@ -12297,6 +12410,8 @@ function wireScheduler(wiring) {
|
|
|
12297
12410
|
for (const messageId of messageIds)
|
|
12298
12411
|
await unpinMessageQuiet(key, messageId);
|
|
12299
12412
|
},
|
|
12413
|
+
// A cancelled check's status line goes through the same best-effort delete the delivery uses.
|
|
12414
|
+
deleteMessage: checkStatusLinePorts.deleteMessage,
|
|
12300
12415
|
// Routed through the outbound seam: the agent-facing file tool is a
|
|
12301
12416
|
// connector delivery, not a direct call into the Telegram send pipeline.
|
|
12302
12417
|
// The MCP surface is string-keyed (its `threadKey` arrives as text), so the
|
|
@@ -12946,7 +13061,7 @@ async function startBot() {
|
|
|
12946
13061
|
// repaint). A graceful exit already cleared the set in its sweep, so this
|
|
12947
13062
|
// is normally a no-op. Uses the pre-reattach snapshot (the setters clobber
|
|
12948
13063
|
// the live persisted set during reattach).
|
|
12949
|
-
reconcileTransientFrames(orphanedTransientFrames);
|
|
13064
|
+
void reconcileTransientFrames(orphanedTransientFrames).catch((error) => console.error('[reattach] transient frame cleanup failed:', error));
|
|
12950
13065
|
},
|
|
12951
13066
|
// The bot MCP tools that read session state (compact_conversation) wait
|
|
12952
13067
|
// for this: until now a surviving session would read as not running.
|
|
@@ -13167,6 +13282,9 @@ async function startBot() {
|
|
|
13167
13282
|
// A hot worker's reload keeps the sidecar for the next worker to adopt; the supervisor stops it for good.
|
|
13168
13283
|
stopSidecars: (0, installManager_1.checkIsOpenCodeExternalHost)() ? undefined : () => sttOwner.stop(),
|
|
13169
13284
|
cleanupTimers: () => {
|
|
13285
|
+
// Voice notes that have not posted yet stop NOW (timers cleared, unstarted sends cancelled); the cleanup of the ones on
|
|
13286
|
+
// screen or in flight runs on, and the sweep waits for it.
|
|
13287
|
+
void voiceProgressNotes.shutDown();
|
|
13170
13288
|
clearInterval(inMemoryGcInterval);
|
|
13171
13289
|
clearInterval(heartbeatInterval);
|
|
13172
13290
|
clearInterval(fileSweepInterval);
|