charness 3.10.0 → 3.12.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 +171 -0
- package/DEVELOPMENT.md +3 -3
- package/README.md +3 -2
- package/SETUP.md +6 -5
- package/agent-plugin/README.md +15 -6
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +23 -13
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +10 -6
- package/agent-plugin/skills/charness-delivery-loop/SKILL.md +92 -0
- package/agent-plugin/skills/charness-orchestration/SKILL.md +116 -0
- package/dist/adapters/openCodeAdapter.d.ts +15 -0
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +48 -4
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/agentLogin/agentLogin.d.ts +11 -0
- package/dist/agentLogin/agentLogin.d.ts.map +1 -1
- package/dist/agentLogin/agentLogin.js +18 -6
- package/dist/agentLogin/agentLogin.js.map +1 -1
- package/dist/apiErrorRetry.d.ts +5 -0
- package/dist/apiErrorRetry.d.ts.map +1 -1
- package/dist/apiErrorRetry.js +3 -3
- package/dist/apiErrorRetry.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +331 -152
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +5 -2
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +43 -20
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/cli/claudeProfilesCredit.d.ts +49 -0
- package/dist/cli/claudeProfilesCredit.d.ts.map +1 -0
- package/dist/cli/claudeProfilesCredit.js +160 -0
- package/dist/cli/claudeProfilesCredit.js.map +1 -0
- package/dist/cli/flagValue.d.ts +10 -0
- package/dist/cli/flagValue.d.ts.map +1 -0
- package/dist/cli/flagValue.js +17 -0
- package/dist/cli/flagValue.js.map +1 -0
- package/dist/connectors/telegram/commands/botCore.d.ts +1 -0
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.js +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +12 -9
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +11 -0
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +208 -22
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts +5 -1
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +151 -30
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/foldedMessage.d.ts +24 -0
- package/dist/connectors/telegram/foldedMessage.d.ts.map +1 -0
- package/dist/connectors/telegram/foldedMessage.js +39 -0
- package/dist/connectors/telegram/foldedMessage.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +24 -1
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +77 -1
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/connectors/telegram/renderAgentHtml.d.ts +15 -0
- package/dist/connectors/telegram/renderAgentHtml.d.ts.map +1 -1
- package/dist/connectors/telegram/renderAgentHtml.js +11 -1
- package/dist/connectors/telegram/renderAgentHtml.js.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +2 -7
- package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.js +5 -19
- package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
- package/dist/connectors/telegram/unpinMessages.d.ts +12 -0
- package/dist/connectors/telegram/unpinMessages.d.ts.map +1 -0
- package/dist/connectors/telegram/unpinMessages.js +44 -0
- package/dist/connectors/telegram/unpinMessages.js.map +1 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +63 -11
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +63 -11
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +63 -11
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +63 -11
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +63 -11
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +63 -11
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +63 -11
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +63 -11
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +63 -11
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +63 -11
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +63 -11
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +63 -11
- package/dist/i18n/zh.js.map +1 -1
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +3 -0
- package/dist/installManager.js.map +1 -1
- package/dist/instanceLock.d.ts.map +1 -1
- package/dist/instanceLock.js +2 -1
- package/dist/instanceLock.js.map +1 -1
- package/dist/outputTrace.d.ts +6 -0
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +13 -0
- package/dist/outputTrace.js.map +1 -1
- package/dist/platform/outbound.d.ts +14 -1
- package/dist/platform/outbound.d.ts.map +1 -1
- package/dist/platform/outbound.js.map +1 -1
- package/dist/remoteRun/cleanReport.d.ts +45 -0
- package/dist/remoteRun/cleanReport.d.ts.map +1 -0
- package/dist/remoteRun/cleanReport.js +84 -0
- package/dist/remoteRun/cleanReport.js.map +1 -0
- package/dist/remoteRun/cliArgs.d.ts +18 -0
- package/dist/remoteRun/cliArgs.d.ts.map +1 -1
- package/dist/remoteRun/cliArgs.js +100 -4
- package/dist/remoteRun/cliArgs.js.map +1 -1
- package/dist/remoteRun/commands.d.ts +30 -1
- package/dist/remoteRun/commands.d.ts.map +1 -1
- package/dist/remoteRun/commands.js +84 -9
- package/dist/remoteRun/commands.js.map +1 -1
- package/dist/remoteRun/exitCodes.d.ts +5 -0
- package/dist/remoteRun/exitCodes.d.ts.map +1 -1
- package/dist/remoteRun/exitCodes.js +6 -1
- package/dist/remoteRun/exitCodes.js.map +1 -1
- package/dist/remoteRun/foreground.d.ts +6 -0
- package/dist/remoteRun/foreground.d.ts.map +1 -1
- package/dist/remoteRun/foreground.js +13 -1
- package/dist/remoteRun/foreground.js.map +1 -1
- package/dist/remoteRun/interrupts.d.ts.map +1 -1
- package/dist/remoteRun/interrupts.js +2 -2
- package/dist/remoteRun/interrupts.js.map +1 -1
- package/dist/remoteRun/jobFiles.d.ts +6 -1
- package/dist/remoteRun/jobFiles.d.ts.map +1 -1
- package/dist/remoteRun/jobFiles.js +14 -0
- package/dist/remoteRun/jobFiles.js.map +1 -1
- package/dist/remoteRun/jobId.d.ts +5 -0
- package/dist/remoteRun/jobId.d.ts.map +1 -1
- package/dist/remoteRun/jobId.js +10 -0
- package/dist/remoteRun/jobId.js.map +1 -1
- package/dist/remoteRun/jobState.d.ts.map +1 -1
- package/dist/remoteRun/jobState.js +3 -2
- package/dist/remoteRun/jobState.js.map +1 -1
- package/dist/remoteRun/pairedRunners.d.ts +1 -1
- package/dist/remoteRun/pairedRunners.d.ts.map +1 -1
- package/dist/remoteRun/pairedRunners.js +4 -0
- package/dist/remoteRun/pairedRunners.js.map +1 -1
- package/dist/remoteRun/pathPatterns.d.ts +1 -1
- package/dist/remoteRun/pathPatterns.js +1 -1
- package/dist/remoteRun/probe.d.ts +58 -5
- package/dist/remoteRun/probe.d.ts.map +1 -1
- package/dist/remoteRun/probe.js +107 -11
- package/dist/remoteRun/probe.js.map +1 -1
- package/dist/remoteRun/probeTiming.d.ts +15 -0
- package/dist/remoteRun/probeTiming.d.ts.map +1 -0
- package/dist/remoteRun/probeTiming.js +23 -0
- package/dist/remoteRun/probeTiming.js.map +1 -0
- package/dist/remoteRun/project.d.ts +5 -0
- package/dist/remoteRun/project.d.ts.map +1 -1
- package/dist/remoteRun/project.js +10 -0
- package/dist/remoteRun/project.js.map +1 -1
- package/dist/remoteRun/projectConfig.d.ts +8 -1
- package/dist/remoteRun/projectConfig.d.ts.map +1 -1
- package/dist/remoteRun/projectConfig.js +18 -5
- package/dist/remoteRun/projectConfig.js.map +1 -1
- package/dist/remoteRun/pruneReport.d.ts +48 -0
- package/dist/remoteRun/pruneReport.d.ts.map +1 -0
- package/dist/remoteRun/pruneReport.js +80 -0
- package/dist/remoteRun/pruneReport.js.map +1 -0
- package/dist/remoteRun/remoteRunCli.d.ts +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
- package/dist/remoteRun/remoteRunCli.js +20 -0
- package/dist/remoteRun/remoteRunCli.js.map +1 -1
- package/dist/remoteRun/runnerClient.d.ts +10 -0
- package/dist/remoteRun/runnerClient.d.ts.map +1 -1
- package/dist/remoteRun/runnerClient.js +19 -5
- package/dist/remoteRun/runnerClient.js.map +1 -1
- package/dist/remoteRun/runnerWait.d.ts.map +1 -1
- package/dist/remoteRun/runnerWait.js +2 -1
- package/dist/remoteRun/runnerWait.js.map +1 -1
- package/dist/remoteRun/runners.d.ts +48 -7
- package/dist/remoteRun/runners.d.ts.map +1 -1
- package/dist/remoteRun/runners.js +105 -40
- package/dist/remoteRun/runners.js.map +1 -1
- package/dist/remoteRun/runnersConfig.d.ts +24 -0
- package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
- package/dist/remoteRun/runnersConfig.js +29 -2
- package/dist/remoteRun/runnersConfig.js.map +1 -1
- package/dist/remoteRun/ssh.d.ts +3 -3
- package/dist/remoteRun/ssh.d.ts.map +1 -1
- package/dist/remoteRun/ssh.js +19 -5
- package/dist/remoteRun/ssh.js.map +1 -1
- package/dist/remoteRun/submit.d.ts +1 -1
- package/dist/remoteRun/submit.d.ts.map +1 -1
- package/dist/remoteRun/submit.js +30 -2
- package/dist/remoteRun/submit.js.map +1 -1
- package/dist/runnerUtility/adminService.d.ts.map +1 -1
- package/dist/runnerUtility/adminService.js +5 -5
- package/dist/runnerUtility/adminService.js.map +1 -1
- package/dist/runnerUtility/appInstall.d.ts +9 -0
- package/dist/runnerUtility/appInstall.d.ts.map +1 -1
- package/dist/runnerUtility/appInstall.js +12 -2
- package/dist/runnerUtility/appInstall.js.map +1 -1
- package/dist/runnerUtility/execEnv.d.ts +1 -1
- package/dist/runnerUtility/execEnv.d.ts.map +1 -1
- package/dist/runnerUtility/execEnv.js +23 -5
- package/dist/runnerUtility/execEnv.js.map +1 -1
- package/dist/runnerUtility/guiAgentHeal.d.ts +3 -3
- package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -1
- package/dist/runnerUtility/guiAgentHeal.js +6 -4
- package/dist/runnerUtility/guiAgentHeal.js.map +1 -1
- package/dist/runnerUtility/homeFolders.d.ts +1 -0
- package/dist/runnerUtility/homeFolders.d.ts.map +1 -1
- package/dist/runnerUtility/homeFolders.js +2 -1
- package/dist/runnerUtility/homeFolders.js.map +1 -1
- package/dist/runnerUtility/iosCheck.d.ts +2 -0
- package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
- package/dist/runnerUtility/iosCheck.js +12 -3
- package/dist/runnerUtility/iosCheck.js.map +1 -1
- package/dist/runnerUtility/isolatedCommand.d.ts +0 -2
- package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -1
- package/dist/runnerUtility/isolatedCommand.js +4 -11
- package/dist/runnerUtility/isolatedCommand.js.map +1 -1
- package/dist/runnerUtility/keepAwake.d.ts +47 -10
- package/dist/runnerUtility/keepAwake.d.ts.map +1 -1
- package/dist/runnerUtility/keepAwake.js +108 -31
- package/dist/runnerUtility/keepAwake.js.map +1 -1
- package/dist/runnerUtility/launcher.d.ts +4 -0
- package/dist/runnerUtility/launcher.d.ts.map +1 -1
- package/dist/runnerUtility/launcher.js +31 -13
- package/dist/runnerUtility/launcher.js.map +1 -1
- package/dist/runnerUtility/linkLoop.d.ts +4 -0
- package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
- package/dist/runnerUtility/linkLoop.js +15 -6
- package/dist/runnerUtility/linkLoop.js.map +1 -1
- package/dist/runnerUtility/managedNode.d.ts +84 -0
- package/dist/runnerUtility/managedNode.d.ts.map +1 -0
- package/dist/runnerUtility/managedNode.js +165 -0
- package/dist/runnerUtility/managedNode.js.map +1 -0
- package/dist/runnerUtility/nodeOnPath.d.ts +10 -0
- package/dist/runnerUtility/nodeOnPath.d.ts.map +1 -0
- package/dist/runnerUtility/nodeOnPath.js +49 -0
- package/dist/runnerUtility/nodeOnPath.js.map +1 -0
- package/dist/runnerUtility/nodeUpkeep.d.ts +140 -0
- package/dist/runnerUtility/nodeUpkeep.d.ts.map +1 -0
- package/dist/runnerUtility/nodeUpkeep.js +348 -0
- package/dist/runnerUtility/nodeUpkeep.js.map +1 -0
- package/dist/runnerUtility/nodeUpkeepTiming.d.ts +14 -0
- package/dist/runnerUtility/nodeUpkeepTiming.d.ts.map +1 -0
- package/dist/runnerUtility/nodeUpkeepTiming.js +21 -0
- package/dist/runnerUtility/nodeUpkeepTiming.js.map +1 -0
- package/dist/runnerUtility/packageManagerShims.d.ts +10 -0
- package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -1
- package/dist/runnerUtility/packageManagerShims.js +67 -3
- package/dist/runnerUtility/packageManagerShims.js.map +1 -1
- package/dist/runnerUtility/pueueDaemon.d.ts +73 -8
- package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
- package/dist/runnerUtility/pueueDaemon.js +90 -15
- package/dist/runnerUtility/pueueDaemon.js.map +1 -1
- package/dist/runnerUtility/runnerCommands.d.ts +7 -1
- package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
- package/dist/runnerUtility/runnerCommands.js +119 -16
- package/dist/runnerUtility/runnerCommands.js.map +1 -1
- package/dist/runnerUtility/runnerHome.d.ts +34 -0
- package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
- package/dist/runnerUtility/runnerHome.js +17 -3
- package/dist/runnerUtility/runnerHome.js.map +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts +2 -0
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
- package/dist/runnerUtility/serviceCommon.js +3 -1
- package/dist/runnerUtility/serviceCommon.js.map +1 -1
- package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
- package/dist/runnerUtility/serviceManager.js +7 -2
- package/dist/runnerUtility/serviceManager.js.map +1 -1
- package/dist/runnerUtility/simctlGuard.d.ts +38 -0
- package/dist/runnerUtility/simctlGuard.d.ts.map +1 -0
- package/dist/runnerUtility/simctlGuard.js +166 -0
- package/dist/runnerUtility/simctlGuard.js.map +1 -0
- package/dist/runners/bootstrapLine.d.ts +3 -4
- package/dist/runners/bootstrapLine.d.ts.map +1 -1
- package/dist/runners/bootstrapLine.js +108 -83
- package/dist/runners/bootstrapLine.js.map +1 -1
- package/dist/runners/hubPackage.d.ts +1 -1
- package/dist/runners/hubPackage.d.ts.map +1 -1
- package/dist/runners/hubPackage.js +5 -6
- package/dist/runners/hubPackage.js.map +1 -1
- package/dist/runners/hubPairing.d.ts +19 -0
- package/dist/runners/hubPairing.d.ts.map +1 -1
- package/dist/runners/hubPairing.js +38 -0
- package/dist/runners/hubPairing.js.map +1 -1
- package/dist/runners/hubRegistry.d.ts +8 -0
- package/dist/runners/hubRegistry.d.ts.map +1 -1
- package/dist/runners/hubRegistry.js +6 -0
- package/dist/runners/hubRegistry.js.map +1 -1
- package/dist/runners/pairCode.d.ts +34 -3
- package/dist/runners/pairCode.d.ts.map +1 -1
- package/dist/runners/pairCode.js +65 -13
- package/dist/runners/pairCode.js.map +1 -1
- package/dist/runners/runnerGroups.d.ts +22 -0
- package/dist/runners/runnerGroups.d.ts.map +1 -0
- package/dist/runners/runnerGroups.js +41 -0
- package/dist/runners/runnerGroups.js.map +1 -0
- package/dist/runners/runnersCli.d.ts +5 -2
- package/dist/runners/runnersCli.d.ts.map +1 -1
- package/dist/runners/runnersCli.js +59 -9
- package/dist/runners/runnersCli.js.map +1 -1
- package/dist/runners/runnersList.d.ts +1 -1
- package/dist/runners/runnersList.d.ts.map +1 -1
- package/dist/runners/runnersList.js +3 -1
- package/dist/runners/runnersList.js.map +1 -1
- package/dist/runners/runnersOverview.d.ts.map +1 -1
- package/dist/runners/runnersOverview.js +8 -4
- package/dist/runners/runnersOverview.js.map +1 -1
- package/dist/scheduler/checkRun.d.ts +9 -10
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +8 -16
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/scheduler/checkStatus.d.ts +4 -5
- package/dist/scheduler/checkStatus.d.ts.map +1 -1
- package/dist/scheduler/checkStatus.js +11 -15
- package/dist/scheduler/checkStatus.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +80 -37
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +121 -68
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +13 -5
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +84 -34
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/recurrence.d.ts +32 -0
- package/dist/scheduler/recurrence.d.ts.map +1 -1
- package/dist/scheduler/recurrence.js +56 -18
- package/dist/scheduler/recurrence.js.map +1 -1
- package/dist/scheduler/scheduleText.d.ts +7 -0
- package/dist/scheduler/scheduleText.d.ts.map +1 -0
- package/dist/scheduler/scheduleText.js +55 -0
- package/dist/scheduler/scheduleText.js.map +1 -0
- package/dist/scheduler/store.d.ts +8 -2
- package/dist/scheduler/store.d.ts.map +1 -1
- package/dist/scheduler/store.js +25 -4
- package/dist/scheduler/store.js.map +1 -1
- package/dist/scheduler/types.d.ts +4 -10
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +49 -11
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +57 -13
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/state.d.ts +95 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +145 -7
- package/dist/state.js.map +1 -1
- package/dist/testTimings.d.ts +6 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +12 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agentPlugin.d.ts +2 -1
- package/dist/utils/agentPlugin.d.ts.map +1 -1
- package/dist/utils/agentPlugin.js +2 -1
- package/dist/utils/agentPlugin.js.map +1 -1
- package/dist/utils/botSkills.d.ts +1 -1
- package/dist/utils/claudeApiAgentStop.d.ts +64 -0
- package/dist/utils/claudeApiAgentStop.d.ts.map +1 -0
- package/dist/utils/claudeApiAgentStop.js +85 -0
- package/dist/utils/claudeApiAgentStop.js.map +1 -0
- package/dist/utils/claudeApiCredit.d.ts +168 -0
- package/dist/utils/claudeApiCredit.d.ts.map +1 -0
- package/dist/utils/claudeApiCredit.js +260 -0
- package/dist/utils/claudeApiCredit.js.map +1 -0
- package/dist/utils/claudeApiCreditRecheck.d.ts +120 -0
- package/dist/utils/claudeApiCreditRecheck.d.ts.map +1 -0
- package/dist/utils/claudeApiCreditRecheck.js +173 -0
- package/dist/utils/claudeApiCreditRecheck.js.map +1 -0
- package/dist/utils/claudeCompactHook.d.ts +18 -10
- package/dist/utils/claudeCompactHook.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.js +35 -14
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeProfileUsageLines.d.ts +13 -1
- package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
- package/dist/utils/claudeProfileUsageLines.js +75 -4
- package/dist/utils/claudeProfileUsageLines.js.map +1 -1
- package/dist/utils/claudeProfileUsageViews.d.ts +46 -0
- package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -0
- package/dist/utils/claudeProfileUsageViews.js +114 -0
- package/dist/utils/claudeProfileUsageViews.js.map +1 -0
- package/dist/utils/claudeProfiles.d.ts +15 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +54 -0
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +97 -36
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +142 -61
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/claudeUsageRefresher.d.ts +27 -3
- package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
- package/dist/utils/claudeUsageRefresher.js +113 -14
- package/dist/utils/claudeUsageRefresher.js.map +1 -1
- package/dist/utils/compactOnIdle.d.ts +140 -15
- package/dist/utils/compactOnIdle.d.ts.map +1 -1
- package/dist/utils/compactOnIdle.js +209 -23
- package/dist/utils/compactOnIdle.js.map +1 -1
- package/dist/utils/compactSelfReviewFlags.d.ts +50 -0
- package/dist/utils/compactSelfReviewFlags.d.ts.map +1 -0
- package/dist/utils/compactSelfReviewFlags.js +120 -0
- package/dist/utils/compactSelfReviewFlags.js.map +1 -0
- package/dist/utils/fallbackChain.d.ts +18 -7
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +28 -12
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/forwardedMark.d.ts +54 -0
- package/dist/utils/forwardedMark.d.ts.map +1 -0
- package/dist/utils/forwardedMark.js +80 -0
- package/dist/utils/forwardedMark.js.map +1 -0
- package/dist/utils/limitHeldPrompts.d.ts +8 -2
- package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
- package/dist/utils/limitHeldPrompts.js +11 -4
- package/dist/utils/limitHeldPrompts.js.map +1 -1
- package/dist/utils/messageContext.d.ts +54 -0
- package/dist/utils/messageContext.d.ts.map +1 -0
- package/dist/utils/messageContext.js +58 -0
- package/dist/utils/messageContext.js.map +1 -0
- package/dist/utils/openCodeCompactPlugin.d.ts +28 -7
- package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
- package/dist/utils/openCodeCompactPlugin.js +80 -15
- package/dist/utils/openCodeCompactPlugin.js.map +1 -1
- package/dist/utils/openCodeUsage.d.ts +10 -3
- package/dist/utils/openCodeUsage.d.ts.map +1 -1
- package/dist/utils/openCodeUsage.js +19 -5
- package/dist/utils/openCodeUsage.js.map +1 -1
- package/dist/utils/replyQuote.d.ts +11 -26
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +9 -31
- package/dist/utils/replyQuote.js.map +1 -1
- package/dist/utils/runnersScreenPlan.d.ts +51 -20
- package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
- package/dist/utils/runnersScreenPlan.js +143 -28
- package/dist/utils/runnersScreenPlan.js.map +1 -1
- package/dist/utils/streamedCompactionSummary.d.ts +65 -0
- package/dist/utils/streamedCompactionSummary.d.ts.map +1 -0
- package/dist/utils/streamedCompactionSummary.js +108 -0
- package/dist/utils/streamedCompactionSummary.js.map +1 -0
- package/dist/utils/stripControlCharacters.d.ts +8 -0
- package/dist/utils/stripControlCharacters.d.ts.map +1 -0
- package/dist/utils/stripControlCharacters.js +16 -0
- package/dist/utils/stripControlCharacters.js.map +1 -0
- package/dist/utils/telegramError.d.ts +6 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +30 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/topicRequest.d.ts +13 -0
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +10 -0
- package/dist/utils/topicRequest.js.map +1 -1
- package/dist/utils/usageRefreshBudget.d.ts.map +1 -1
- package/dist/utils/usageRefreshBudget.js +4 -10
- package/dist/utils/usageRefreshBudget.js.map +1 -1
- package/dist/utils/waitUpTo.d.ts +8 -0
- package/dist/utils/waitUpTo.d.ts.map +1 -0
- package/dist/utils/waitUpTo.js +20 -0
- package/dist/utils/waitUpTo.js.map +1 -0
- package/package.json +2 -2
- package/remoteRun/ensureNode.sh +288 -0
- package/remoteRun/runner.sh +2252 -115
- package/agent-plugin/skills/charness-manager/SKILL.md +0 -156
- package/remoteRun/pickNode.sh +0 -65
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkStatusActivityMaxChars = exports.checkStatusSlackMs = exports.checkStatusCommandTimeoutSec = exports.maxCheckStatusRunDirLength = exports.maxCheckStatusCommandLength = exports.maxCheckStatusEveryMinutes = exports.minCheckStatusEveryMinutes = exports.defaultCheckStatusEveryMinutes = void 0;
|
|
3
|
+
exports.msPerMinute = exports.checkStatusActivityMaxChars = exports.checkStatusSlackMs = exports.checkStatusCommandTimeoutSec = exports.maxCheckStatusRunDirLength = exports.maxCheckStatusCommandLength = exports.maxCheckStatusEveryMinutes = exports.minCheckStatusEveryMinutes = exports.defaultCheckStatusEveryMinutes = void 0;
|
|
4
4
|
exports.getCheckStatusIntervalMs = getCheckStatusIntervalMs;
|
|
5
5
|
exports.checkIsCheckStatusDue = checkIsCheckStatusDue;
|
|
6
6
|
exports.getCheckStatusSinceMs = getCheckStatusSinceMs;
|
|
7
|
-
exports.checkIsFinalCheckRun = checkIsFinalCheckRun;
|
|
8
7
|
exports.checkIsCheckStatusShown = checkIsCheckStatusShown;
|
|
9
8
|
exports.formatCheckStatusActivity = formatCheckStatusActivity;
|
|
10
9
|
exports.getCheckStatusActivityFromOutput = getCheckStatusActivityFromOutput;
|
|
11
10
|
exports.getCheckStatusElapsedText = getCheckStatusElapsedText;
|
|
11
|
+
exports.getCheckShownName = getCheckShownName;
|
|
12
12
|
exports.buildCheckStatusLine = buildCheckStatusLine;
|
|
13
13
|
const i18n_1 = require("../i18n");
|
|
14
14
|
const surrogateSafeCut_1 = require("../utils/surrogateSafeCut");
|
|
@@ -43,13 +43,14 @@ exports.checkStatusSlackMs = 60_000;
|
|
|
43
43
|
const checkStatusSlackShareDivisor = 5;
|
|
44
44
|
/** The longest «now» part of a line: one line of a phone's width, never a paragraph. */
|
|
45
45
|
exports.checkStatusActivityMaxChars = 120;
|
|
46
|
-
|
|
46
|
+
/** Milliseconds in a minute (shared with `delivery.ts`, which turns a recipe window in minutes into an elapsed text). */
|
|
47
|
+
exports.msPerMinute = 60_000;
|
|
47
48
|
const minutesPerHour = 60;
|
|
48
49
|
/** A leading `watch ` of a check's name is the recipe's own prefix (`watch builder S2`), noise in the topic. */
|
|
49
50
|
const leadingWatchWordPattern = /^watch\s+/i;
|
|
50
51
|
/** @description The status interval of a check, in ms. */
|
|
51
52
|
function getCheckStatusIntervalMs(job) {
|
|
52
|
-
return (job.statusEveryMinutes ?? exports.defaultCheckStatusEveryMinutes) * msPerMinute;
|
|
53
|
+
return (job.statusEveryMinutes ?? exports.defaultCheckStatusEveryMinutes) * exports.msPerMinute;
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
56
|
* @description Whether a status line is due: an interval (less the slack) has passed since the last line, or since the
|
|
@@ -63,14 +64,6 @@ function checkIsCheckStatusDue(input) {
|
|
|
63
64
|
function getCheckStatusSinceMs(job) {
|
|
64
65
|
return job.lastStatusAt ?? Date.parse(job.createdAt);
|
|
65
66
|
}
|
|
66
|
-
/**
|
|
67
|
-
* @description Whether this is the LAST run the job will ever make (a `once` job, or the final run of an N-times cron): its
|
|
68
|
-
* line would be deleted at once by the finished check, so none is posted and the existing one goes.
|
|
69
|
-
*/
|
|
70
|
-
function checkIsFinalCheckRun(job) {
|
|
71
|
-
const { spec } = job;
|
|
72
|
-
return spec.kind === 'once' || (typeof spec.remainingRuns === 'number' && spec.remainingRuns <= 1);
|
|
73
|
-
}
|
|
74
67
|
/**
|
|
75
68
|
* @description The ONE gate that decides whether a topic shows status lines: a Telegram conversation (a tracker issue gets no
|
|
76
69
|
* message, no comment, no edited note) whose view shows the agent's stream — the answers-only view shows nothing but answers.
|
|
@@ -99,7 +92,7 @@ function getCheckStatusActivityFromOutput(output) {
|
|
|
99
92
|
}
|
|
100
93
|
/** @description «N min» under an hour, «H h M min» from an hour on (rounded to the nearest minute). */
|
|
101
94
|
function getCheckStatusElapsedText(elapsedMs) {
|
|
102
|
-
const totalMinutes = Math.max(0, Math.round(elapsedMs / msPerMinute));
|
|
95
|
+
const totalMinutes = Math.max(0, Math.round(elapsedMs / exports.msPerMinute));
|
|
103
96
|
if (totalMinutes < minutesPerHour)
|
|
104
97
|
return (0, i18n_1.t)('schedule.statusElapsedMinutes', { minutes: totalMinutes });
|
|
105
98
|
return (0, i18n_1.t)('schedule.statusElapsedHours', {
|
|
@@ -107,14 +100,17 @@ function getCheckStatusElapsedText(elapsedMs) {
|
|
|
107
100
|
minutes: totalMinutes % minutesPerHour,
|
|
108
101
|
});
|
|
109
102
|
}
|
|
103
|
+
/** @description A check's name as the topic shows it: without the recipe's leading `watch ` (`watch builder S2` → `builder S2`). */
|
|
104
|
+
function getCheckShownName(name) {
|
|
105
|
+
return name.replace(leadingWatchWordPattern, '').trim() || name;
|
|
106
|
+
}
|
|
110
107
|
/**
|
|
111
108
|
* @description The status line: `⏳ <name> · works <elapsed>[ · now: <activity>]`. The name is the check's own without the
|
|
112
109
|
* recipe's leading `watch `; the «now» part is left out when there is nothing readable to say.
|
|
113
110
|
*/
|
|
114
111
|
function buildCheckStatusLine(input) {
|
|
115
|
-
const shownName = input.name.replace(leadingWatchWordPattern, '').trim() || input.name;
|
|
116
112
|
return (0, i18n_1.t)('schedule.statusLineText', {
|
|
117
|
-
name:
|
|
113
|
+
name: getCheckShownName(input.name),
|
|
118
114
|
elapsed: getCheckStatusElapsedText(input.elapsedMs),
|
|
119
115
|
activity: input.activity === null ? '' : (0, i18n_1.t)('schedule.statusLineActivity', { activity: input.activity }),
|
|
120
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkStatus.js","sourceRoot":"","sources":["../../src/scheduler/checkStatus.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"checkStatus.js","sourceRoot":"","sources":["../../src/scheduler/checkStatus.ts"],"names":[],"mappings":";;;AAsDA,4DAEC;AAMD,sDAGC;AAGD,sDAEC;AAMD,0DAEC;AAMD,8DAKC;AAMD,4EAGC;AAGD,8DAOC;AAGD,8CAEC;AAMD,oDAMC;AA7HD,kCAA4B;AAC5B,gEAAiE;AACjE,kDAAwD;AAIxD;;;;;;;GAOG;AAEH,+FAA+F;AAClF,QAAA,8BAA8B,GAAG,EAAE,CAAC;AAEjD,2HAA2H;AAC9G,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAE5C,8CAA8C;AACjC,QAAA,0BAA0B,GAAG,GAAG,CAAC;AAE9C,2EAA2E;AAC9D,QAAA,2BAA2B,GAAG,IAAI,CAAC;AAEhD,6CAA6C;AAChC,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAE/C,kGAAkG;AACrF,QAAA,4BAA4B,GAAG,EAAE,CAAC;AAE/C;;;;GAIG;AACU,QAAA,kBAAkB,GAAG,MAAM,CAAC;AAEzC,oHAAoH;AACpH,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC,wFAAwF;AAC3E,QAAA,2BAA2B,GAAG,GAAG,CAAC;AAE/C,yHAAyH;AAC5G,QAAA,WAAW,GAAG,MAAM,CAAC;A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AC,6BAA6B,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;KACxG,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,11 +5,10 @@ import { type PostToSessionDeps } from '../postToSession';
|
|
|
5
5
|
* @description Scheduler delivery (plan S4): the real `deliver(job, fireContext)`
|
|
6
6
|
* callback the engine (S3) invokes at fire time. The flow is locked by the plan:
|
|
7
7
|
*
|
|
8
|
-
* 1. announce — post a
|
|
9
|
-
* schedule
|
|
10
|
-
*
|
|
11
|
-
* default
|
|
12
|
-
* and the flow continues — the announcement is already visible.
|
|
8
|
+
* 1. announce — post a SILENT message into the topic: «⏰ Scheduled: <name> ·
|
|
9
|
+
* <human schedule>» (+ a "missed at HH:MM" note for a catch-up run), with the
|
|
10
|
+
* prompt folded under it (an agent instruction, not something to read by
|
|
11
|
+
* default). Never pinned: a scheduled run is ordinary output.
|
|
13
12
|
* 3–4. post the prefixed prompt to the session ({@link postToSession}, shared
|
|
14
13
|
* with the Jira connector): ensure a session (starting one with the job's
|
|
15
14
|
* `lastAdapterName` snapshot as the adapter fallback — a topic that never
|
|
@@ -18,19 +17,21 @@ import { type PostToSessionDeps } from '../postToSession';
|
|
|
18
17
|
* unbound topic → outcome `failed` with a distinct error string the engine
|
|
19
18
|
* records (S8 turns that into a pause).
|
|
20
19
|
*
|
|
21
|
-
* A REMINDER record (`deliveryKind: 'reminder'`)
|
|
22
|
-
* delivery IS the announcement plus its pin, which is what pierces a
|
|
23
|
-
* Steps 3–4 are skipped entirely, so a reminder
|
|
24
|
-
* General — there is no session to ensure,
|
|
25
|
-
* tell about the run.
|
|
20
|
+
* A REMINDER record (`deliveryKind: 'reminder'`) is the one thing still pinned:
|
|
21
|
+
* its whole delivery IS the announcement plus its pin, which is what pierces a
|
|
22
|
+
* muted topic, and it stops there. Steps 3–4 are skipped entirely, so a reminder
|
|
23
|
+
* fires in an unbound topic and in General — there is no session to ensure,
|
|
24
|
+
* nothing to interrupt, and no agent to tell about the run.
|
|
26
25
|
*
|
|
27
26
|
* A CHECK record (`deliveryKind: 'check'`) runs its command FIRST and decides
|
|
28
27
|
* from the result and its persisted failing flag: a pass after a pass, or a
|
|
29
28
|
* failure after a failure, posts nothing; a pass after a failure posts one
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* "is back to normal" line; the first failure posts a one-sentence silent notice
|
|
30
|
+
* (never the command; a worker watch says "finished" or "silent", any other check
|
|
31
|
+
* folds the output under "fired") and then wakes the agent through steps 3–4 with
|
|
32
|
+
* the command, the failure details and the output ahead of the job's prompt. An
|
|
33
|
+
* unbound topic fails with the same distinct error as a prompt job, so it is
|
|
34
|
+
* paused the same way.
|
|
34
35
|
*
|
|
35
36
|
* It owns NO bot.ts import: every side effect is injected via
|
|
36
37
|
* {@link ScheduleDeliveryDeps} (announce / pin / busy probe / ensure-session /
|
|
@@ -39,6 +40,24 @@ import { type PostToSessionDeps } from '../postToSession';
|
|
|
39
40
|
*/
|
|
40
41
|
/** Distinct error string the engine records when a fire hits an unbound topic. */
|
|
41
42
|
export declare const unboundDeliveryError = "thread is unbound";
|
|
43
|
+
/**
|
|
44
|
+
* @name ScheduleAnnounceOptions
|
|
45
|
+
* @description How a topic message of the scheduler is sent.
|
|
46
|
+
*/
|
|
47
|
+
export interface ScheduleAnnounceOptions {
|
|
48
|
+
/** Send without a notification: the bot's ordinary output. Absent only for a reminder, which is meant to ring. */
|
|
49
|
+
isSilent?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Text folded under the message: the reader opens it on demand (Telegram: an expandable quote). Plain text — the
|
|
52
|
+
* platform escapes it.
|
|
53
|
+
*/
|
|
54
|
+
foldedDetail?: string;
|
|
55
|
+
}
|
|
56
|
+
/** @name ScheduleAnnouncement @description What a fire or an alert says in the topic: the sentence, and the detail folded under it. */
|
|
57
|
+
export interface ScheduleAnnouncement {
|
|
58
|
+
text: string;
|
|
59
|
+
foldedDetail?: string;
|
|
60
|
+
}
|
|
42
61
|
/**
|
|
43
62
|
* @name ScheduleDeliveryDeps
|
|
44
63
|
* @description Everything the delivery callback needs from bot.ts, injected so
|
|
@@ -48,19 +67,24 @@ export declare const unboundDeliveryError = "thread is unbound";
|
|
|
48
67
|
*/
|
|
49
68
|
export interface ScheduleDeliveryDeps extends PostToSessionDeps {
|
|
50
69
|
/**
|
|
51
|
-
* Post
|
|
52
|
-
* `
|
|
53
|
-
|
|
70
|
+
* Post a message into the topic (the bot bakes in priority `'interactive'`). Resolves with the sent message id, or
|
|
71
|
+
* `null` when the send failed — a reminder's pin is skipped on `null`.
|
|
72
|
+
*/
|
|
73
|
+
announce: (threadKey: string, text: string, options?: ScheduleAnnounceOptions) => Promise<number | null>;
|
|
74
|
+
/** Pin a REMINDER's announcement, notifying (that is how a reminder pierces a muted topic). Rejects on failure. */
|
|
75
|
+
pin: (threadKey: string, messageId: number) => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Unpin these messages of the topic and resolve with the ids that are STILL pinned and worth another try (Telegram did not
|
|
78
|
+
* answer, asked to slow down, failed on its side). A message that is gone, was never pinned or cannot be unpinned any more
|
|
79
|
+
* is final, so it is not in the list. Never rejects.
|
|
54
80
|
*/
|
|
55
|
-
|
|
56
|
-
/** Pin the announcement. `isSilent` ⇒ `disable_notification`. Rejects on failure. */
|
|
57
|
-
pin: (threadKey: string, messageId: number, isSilent: boolean) => Promise<void>;
|
|
81
|
+
unpinMessages: (threadKey: string, messageIds: readonly number[]) => Promise<number[]>;
|
|
58
82
|
/** Run a check job's command in the thread's bound folder; `null` when the thread is unbound. */
|
|
59
83
|
runCheck: (threadKey: string, command: string, timeoutMs: number) => Promise<CheckRunResult | null>;
|
|
60
84
|
/** Persist a check job's failing flag (it decides whether the next run alerts). */
|
|
61
85
|
setCheckFailing: (jobId: string, isFailing: boolean) => Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
|
|
86
|
+
/** Forget these alert pins of an earlier version on a job (`ScheduleRecord.alertPinMessageIds`), once they are unpinned. */
|
|
87
|
+
clearAlertPins: (jobId: string, releasedMessageIds: readonly number[]) => Promise<void>;
|
|
64
88
|
/** Whether this conversation shows status lines at all (a Telegram topic whose view shows the agent's stream). */
|
|
65
89
|
checkIsStatusShown: (threadKey: string) => boolean;
|
|
66
90
|
/**
|
|
@@ -94,23 +118,42 @@ export declare function prependScheduledRunMarker(jobName: string, prompt: strin
|
|
|
94
118
|
dueAtMs?: number;
|
|
95
119
|
}): string;
|
|
96
120
|
/**
|
|
97
|
-
* @description Build the visible fire
|
|
98
|
-
*
|
|
99
|
-
* reminder leads with its own text (the pin notification previews it, so the
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* instant) for a `catch-up` fire, empty for an `on-time` run — so a replayed run
|
|
103
|
-
* is annotated identically whichever kind it is.
|
|
121
|
+
* @description Build the visible fire announcement via i18n, per delivery kind. A prompt job says «⏰ Scheduled: <name> ·
|
|
122
|
+
* <schedule>» and folds its prompt under it: the prompt is an instruction for the agent, not something a person reads by
|
|
123
|
+
* default. A reminder leads with its own text (the pin notification previews it, so the operator reads the reminder
|
|
124
|
+
* without opening the topic) and carries nothing folded. Both interpolate the SAME `{missedNote}` — the catch-up annotation
|
|
125
|
+
* (host-local HH:MM of the missed instant) for a `catch-up` fire, empty for an `on-time` run.
|
|
104
126
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
* A reminder's `{schedule}` is always the LOCALIZED {@link getReminderScheduleText} — the very same words its `/reminders`
|
|
128
|
+
* list row and card show, because describing one reminder two different ways is a defect. A prompt job's goes through
|
|
129
|
+
* {@link getAnnouncedScheduleText}, which counts the next run from `nowMs` where nothing phrases the shape.
|
|
130
|
+
*/
|
|
131
|
+
export declare function buildFireAnnouncement(job: ScheduleRecord, fireContext: FireContext, nowMs: number): ScheduleAnnouncement;
|
|
132
|
+
/**
|
|
133
|
+
* @name CheckFailedAnnouncementInput
|
|
134
|
+
* @description What the notice of a check's first failure is built from: the job, the failed run, its short description
|
|
135
|
+
* ({@link describeCheckFailure}) and the instant the notice is made at (how long a worker ran).
|
|
136
|
+
*/
|
|
137
|
+
export interface CheckFailedAnnouncementInput {
|
|
138
|
+
job: ScheduleRecord;
|
|
139
|
+
result: CheckRunResult;
|
|
140
|
+
failure: string;
|
|
141
|
+
nowMs: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @description The topic notice of a check's first failure, in one sentence and never with the command (that goes to the
|
|
145
|
+
* agent's prompt only). A worker watch (a check with a status source of a worker's run directory) says what happened to
|
|
146
|
+
* the worker: finished (its process is gone), silent for {@link workerWatchSilenceMinutes} minutes, or running for
|
|
147
|
+
* {@link workerWatchUnreportedMinutes} minutes since the watch was armed without a report. Any other check — and a
|
|
148
|
+
* worker watch that failed some other way, a timeout say — says it fired, with what failed and the output tail folded under
|
|
149
|
+
* it, because the failure is the only thing a person can use to tell why.
|
|
150
|
+
*/
|
|
151
|
+
export declare function buildCheckFailedAnnouncement(input: CheckFailedAnnouncementInput): ScheduleAnnouncement;
|
|
152
|
+
/**
|
|
153
|
+
* @description The line for a check that passes again, in the words of its failure notice: a worker watch speaks of the worker
|
|
154
|
+
* (and its shown name, without the recipe's `watch `), any other check of the check.
|
|
110
155
|
*/
|
|
111
|
-
export declare function
|
|
112
|
-
/** @description The topic alert of a check's first failure: what failed, how, and the output tail. */
|
|
113
|
-
export declare function buildCheckFailedAnnouncement(job: ScheduleRecord, fireContext: FireContext, failure: string, output: string): string;
|
|
156
|
+
export declare function buildCheckRecoveredText(job: ScheduleRecord): string;
|
|
114
157
|
/**
|
|
115
158
|
* @description Take a job's status line out of the topic and out of its record — the ONE place that does it, for a failed or
|
|
116
159
|
* unbound run, a topic that stopped showing the stream, a final run, and the `/unbind` pause (`unbindPause.ts`). The record is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/sche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,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAmBxH;AASD;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,4BAA4B,GAAG,oBAAoB,CAkBtG;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAInE;AAwED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE,kBAAkB,GAAG,eAAe,CAAC,EACtE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,GAAG,WAAW,GAAG,iBAAiB,CAAC,GAChE,OAAO,CAAC,IAAI,CAAC,CAQf;AA4FD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,oBAAoB,GACzB,CAAC,GAAG,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAyB7E"}
|
|
@@ -4,6 +4,7 @@ exports.unboundDeliveryError = void 0;
|
|
|
4
4
|
exports.prependScheduledRunMarker = prependScheduledRunMarker;
|
|
5
5
|
exports.buildFireAnnouncement = buildFireAnnouncement;
|
|
6
6
|
exports.buildCheckFailedAnnouncement = buildCheckFailedAnnouncement;
|
|
7
|
+
exports.buildCheckRecoveredText = buildCheckRecoveredText;
|
|
7
8
|
exports.clearCheckStatusLine = clearCheckStatusLine;
|
|
8
9
|
exports.createScheduleDelivery = createScheduleDelivery;
|
|
9
10
|
const i18n_1 = require("../i18n");
|
|
@@ -13,16 +14,17 @@ const checkRun_1 = require("./checkRun");
|
|
|
13
14
|
const checkStatus_1 = require("./checkStatus");
|
|
14
15
|
const deliveryKind_1 = require("./deliveryKind");
|
|
15
16
|
const recurrence_1 = require("./recurrence");
|
|
17
|
+
const scheduleText_1 = require("./scheduleText");
|
|
18
|
+
const workerWatch_1 = require("./workerWatch");
|
|
16
19
|
const postToSession_1 = require("../postToSession");
|
|
17
20
|
/**
|
|
18
21
|
* @description Scheduler delivery (plan S4): the real `deliver(job, fireContext)`
|
|
19
22
|
* callback the engine (S3) invokes at fire time. The flow is locked by the plan:
|
|
20
23
|
*
|
|
21
|
-
* 1. announce — post a
|
|
22
|
-
* schedule
|
|
23
|
-
*
|
|
24
|
-
* default
|
|
25
|
-
* and the flow continues — the announcement is already visible.
|
|
24
|
+
* 1. announce — post a SILENT message into the topic: «⏰ Scheduled: <name> ·
|
|
25
|
+
* <human schedule>» (+ a "missed at HH:MM" note for a catch-up run), with the
|
|
26
|
+
* prompt folded under it (an agent instruction, not something to read by
|
|
27
|
+
* default). Never pinned: a scheduled run is ordinary output.
|
|
26
28
|
* 3–4. post the prefixed prompt to the session ({@link postToSession}, shared
|
|
27
29
|
* with the Jira connector): ensure a session (starting one with the job's
|
|
28
30
|
* `lastAdapterName` snapshot as the adapter fallback — a topic that never
|
|
@@ -31,19 +33,21 @@ const postToSession_1 = require("../postToSession");
|
|
|
31
33
|
* unbound topic → outcome `failed` with a distinct error string the engine
|
|
32
34
|
* records (S8 turns that into a pause).
|
|
33
35
|
*
|
|
34
|
-
* A REMINDER record (`deliveryKind: 'reminder'`)
|
|
35
|
-
* delivery IS the announcement plus its pin, which is what pierces a
|
|
36
|
-
* Steps 3–4 are skipped entirely, so a reminder
|
|
37
|
-
* General — there is no session to ensure,
|
|
38
|
-
* tell about the run.
|
|
36
|
+
* A REMINDER record (`deliveryKind: 'reminder'`) is the one thing still pinned:
|
|
37
|
+
* its whole delivery IS the announcement plus its pin, which is what pierces a
|
|
38
|
+
* muted topic, and it stops there. Steps 3–4 are skipped entirely, so a reminder
|
|
39
|
+
* fires in an unbound topic and in General — there is no session to ensure,
|
|
40
|
+
* nothing to interrupt, and no agent to tell about the run.
|
|
39
41
|
*
|
|
40
42
|
* A CHECK record (`deliveryKind: 'check'`) runs its command FIRST and decides
|
|
41
43
|
* from the result and its persisted failing flag: a pass after a pass, or a
|
|
42
44
|
* failure after a failure, posts nothing; a pass after a failure posts one
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* "is back to normal" line; the first failure posts a one-sentence silent notice
|
|
46
|
+
* (never the command; a worker watch says "finished" or "silent", any other check
|
|
47
|
+
* folds the output under "fired") and then wakes the agent through steps 3–4 with
|
|
48
|
+
* the command, the failure details and the output ahead of the job's prompt. An
|
|
49
|
+
* unbound topic fails with the same distinct error as a prompt job, so it is
|
|
50
|
+
* paused the same way.
|
|
47
51
|
*
|
|
48
52
|
* It owns NO bot.ts import: every side effect is injected via
|
|
49
53
|
* {@link ScheduleDeliveryDeps} (announce / pin / busy probe / ensure-session /
|
|
@@ -67,35 +71,35 @@ function prependScheduledRunMarker(jobName, prompt, options = {}) {
|
|
|
67
71
|
return `[Scheduled run "${jobName}"${dueNote}]\n${prompt}`;
|
|
68
72
|
}
|
|
69
73
|
/**
|
|
70
|
-
* @description Build the visible fire
|
|
71
|
-
*
|
|
72
|
-
* reminder leads with its own text (the pin notification previews it, so the
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* instant) for a `catch-up` fire, empty for an `on-time` run — so a replayed run
|
|
76
|
-
* is annotated identically whichever kind it is.
|
|
74
|
+
* @description Build the visible fire announcement via i18n, per delivery kind. A prompt job says «⏰ Scheduled: <name> ·
|
|
75
|
+
* <schedule>» and folds its prompt under it: the prompt is an instruction for the agent, not something a person reads by
|
|
76
|
+
* default. A reminder leads with its own text (the pin notification previews it, so the operator reads the reminder
|
|
77
|
+
* without opening the topic) and carries nothing folded. Both interpolate the SAME `{missedNote}` — the catch-up annotation
|
|
78
|
+
* (host-local HH:MM of the missed instant) for a `catch-up` fire, empty for an `on-time` run.
|
|
77
79
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* {@link getReminderScheduleText} — the very same words its `/reminders` list row
|
|
82
|
-
* and card show, because describing one reminder two different ways is a defect.
|
|
80
|
+
* A reminder's `{schedule}` is always the LOCALIZED {@link getReminderScheduleText} — the very same words its `/reminders`
|
|
81
|
+
* list row and card show, because describing one reminder two different ways is a defect. A prompt job's goes through
|
|
82
|
+
* {@link getAnnouncedScheduleText}, which counts the next run from `nowMs` where nothing phrases the shape.
|
|
83
83
|
*/
|
|
84
|
-
function buildFireAnnouncement(job, fireContext) {
|
|
84
|
+
function buildFireAnnouncement(job, fireContext, nowMs) {
|
|
85
85
|
const missedNote = getMissedNote(fireContext);
|
|
86
86
|
if ((0, deliveryKind_1.checkIsReminderSchedule)(job)) {
|
|
87
|
-
return
|
|
88
|
-
text:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
return {
|
|
88
|
+
text: (0, i18n_1.t)('reminders.fired', {
|
|
89
|
+
text: job.prompt,
|
|
90
|
+
schedule: (0, reminderScheduleText_1.getReminderScheduleText)(job.spec),
|
|
91
|
+
missedNote,
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
92
94
|
}
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
return {
|
|
96
|
+
text: (0, i18n_1.t)('schedule.fired', {
|
|
97
|
+
name: job.name,
|
|
98
|
+
schedule: (0, scheduleText_1.getAnnouncedScheduleText)(job.spec, nowMs),
|
|
99
|
+
missedNote,
|
|
100
|
+
}),
|
|
101
|
+
foldedDetail: job.prompt,
|
|
102
|
+
};
|
|
99
103
|
}
|
|
100
104
|
/** @description The catch-up note of a fire, empty for an on-time run. */
|
|
101
105
|
function getMissedNote(fireContext) {
|
|
@@ -103,32 +107,77 @@ function getMissedNote(fireContext) {
|
|
|
103
107
|
? (0, i18n_1.t)('schedule.missedNote', { time: (0, localClock_1.formatLocalClock)(fireContext.missedAtMs) })
|
|
104
108
|
: '';
|
|
105
109
|
}
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
110
|
+
/**
|
|
111
|
+
* @description The topic notice of a check's first failure, in one sentence and never with the command (that goes to the
|
|
112
|
+
* agent's prompt only). A worker watch (a check with a status source of a worker's run directory) says what happened to
|
|
113
|
+
* the worker: finished (its process is gone), silent for {@link workerWatchSilenceMinutes} minutes, or running for
|
|
114
|
+
* {@link workerWatchUnreportedMinutes} minutes since the watch was armed without a report. Any other check — and a
|
|
115
|
+
* worker watch that failed some other way, a timeout say — says it fired, with what failed and the output tail folded under
|
|
116
|
+
* it, because the failure is the only thing a person can use to tell why.
|
|
117
|
+
*/
|
|
118
|
+
function buildCheckFailedAnnouncement(input) {
|
|
119
|
+
const { job, result, failure } = input;
|
|
120
|
+
if (job.statusWorkerRunDir !== undefined) {
|
|
121
|
+
const workerEnd = (0, workerWatch_1.getWorkerWatchEnd)(result);
|
|
122
|
+
const name = (0, checkStatus_1.getCheckShownName)(job.name);
|
|
123
|
+
if (workerEnd === 'finished') {
|
|
124
|
+
return { text: (0, i18n_1.t)('schedule.workerFinished', { name, elapsed: (0, checkStatus_1.getCheckStatusElapsedText)(input.nowMs - Date.parse(job.createdAt)) }) };
|
|
125
|
+
}
|
|
126
|
+
if (workerEnd === 'silent')
|
|
127
|
+
return { text: (0, i18n_1.t)('schedule.workerSilent', { name, minutes: workerWatch_1.workerWatchSilenceMinutes }) };
|
|
128
|
+
if (workerEnd === 'unreported') {
|
|
129
|
+
return { text: (0, i18n_1.t)('schedule.workerUnreported', { name, elapsed: (0, checkStatus_1.getCheckStatusElapsedText)(workerWatch_1.workerWatchUnreportedMinutes * checkStatus_1.msPerMinute) }) };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const outputTail = (0, checkRun_1.getOutputTail)(result.output.trim(), checkRun_1.checkAlertOutputMaxChars);
|
|
133
|
+
return {
|
|
134
|
+
text: (0, i18n_1.t)('schedule.checkFired', { name: job.name }),
|
|
135
|
+
foldedDetail: outputTail === '' ? failure : `${failure}\n\n${outputTail}`,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @description The line for a check that passes again, in the words of its failure notice: a worker watch speaks of the worker
|
|
140
|
+
* (and its shown name, without the recipe's `watch `), any other check of the check.
|
|
141
|
+
*/
|
|
142
|
+
function buildCheckRecoveredText(job) {
|
|
143
|
+
return job.statusWorkerRunDir !== undefined
|
|
144
|
+
? (0, i18n_1.t)('schedule.workerResumed', { name: (0, checkStatus_1.getCheckShownName)(job.name) })
|
|
145
|
+
: (0, i18n_1.t)('schedule.checkRecovered', { name: job.name });
|
|
116
146
|
}
|
|
117
147
|
/**
|
|
118
|
-
* @description
|
|
119
|
-
* logs — the announcement is already visible
|
|
148
|
+
* @description A REMINDER's step 1–2: post the announcement and pin it (notifying: the pin is what pierces a muted topic);
|
|
149
|
+
* a pin failure only logs — the announcement is already visible. The only pin the scheduler still makes.
|
|
120
150
|
*/
|
|
121
|
-
async function
|
|
151
|
+
async function announceAndPinReminder(deps, job, text) {
|
|
122
152
|
const messageId = await deps.announce(job.threadKey, text);
|
|
123
153
|
if (messageId === null)
|
|
124
|
-
return
|
|
154
|
+
return;
|
|
125
155
|
try {
|
|
126
|
-
await deps.pin(job.threadKey, messageId
|
|
127
|
-
return messageId;
|
|
156
|
+
await deps.pin(job.threadKey, messageId);
|
|
128
157
|
}
|
|
129
158
|
catch (error) {
|
|
130
159
|
console.warn(`[scheduler] pin announcement for job ${job.id} failed:`, error instanceof Error ? error.message : error);
|
|
131
|
-
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @description Earlier versions pinned every check alert and remembered the pinned ids on the job. They are released at the
|
|
164
|
+
* job's next run: unpinned, then forgotten (in that order — a crash in between repeats the harmless unpin). Only the ids that
|
|
165
|
+
* ARE released are forgotten: one Telegram did not answer for stays on the job and is tried again at the next run, so no old
|
|
166
|
+
* alert stays pinned for good. Never rejects — a check must run whatever happens to an old pin. A job that never runs again
|
|
167
|
+
* (paused) keeps them until `schedule_cancel`, which releases them too.
|
|
168
|
+
*/
|
|
169
|
+
async function releaseLegacyAlertPins(deps, job) {
|
|
170
|
+
const messageIds = job.alertPinMessageIds ?? [];
|
|
171
|
+
if (messageIds.length === 0)
|
|
172
|
+
return;
|
|
173
|
+
try {
|
|
174
|
+
const stillPinnedIds = await deps.unpinMessages(job.threadKey, messageIds);
|
|
175
|
+
const releasedIds = messageIds.filter((messageId) => !stillPinnedIds.includes(messageId));
|
|
176
|
+
if (releasedIds.length > 0)
|
|
177
|
+
await deps.clearAlertPins(job.id, releasedIds);
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
console.warn(`[scheduler] releasing the old alert pins of job ${job.id} failed:`, error instanceof Error ? error.message : error);
|
|
132
181
|
}
|
|
133
182
|
}
|
|
134
183
|
/**
|
|
@@ -203,7 +252,8 @@ async function updateCheckStatus(deps, job) {
|
|
|
203
252
|
if (job.statusWorkerRunDir === undefined && job.statusCommand === undefined)
|
|
204
253
|
return;
|
|
205
254
|
try {
|
|
206
|
-
|
|
255
|
+
// The job's last run: its line would be deleted at once by the finished check, so none is posted and the existing one goes.
|
|
256
|
+
if (!deps.checkIsStatusShown(job.threadKey) || (0, recurrence_1.checkIsFinalRun)(job.spec)) {
|
|
207
257
|
await clearCheckStatusLine(deps, job);
|
|
208
258
|
return;
|
|
209
259
|
}
|
|
@@ -228,13 +278,14 @@ async function updateCheckStatus(deps, job) {
|
|
|
228
278
|
}
|
|
229
279
|
/**
|
|
230
280
|
* @description The check flow: run the command, then stay quiet, post the
|
|
231
|
-
* "
|
|
281
|
+
* "back to normal" line, or raise the alert and wake the agent. The failing flag is
|
|
232
282
|
* stored BEFORE the agent is woken, so a restart mid-delivery cannot raise the
|
|
233
283
|
* same alert twice.
|
|
234
284
|
*/
|
|
235
|
-
async function deliverCheck(deps, job
|
|
285
|
+
async function deliverCheck(deps, job) {
|
|
236
286
|
const timeoutSec = job.checkTimeoutSec ?? checkRun_1.defaultCheckTimeoutSec;
|
|
237
287
|
const command = job.checkCommand ?? '';
|
|
288
|
+
await releaseLegacyAlertPins(deps, job);
|
|
238
289
|
const result = await deps.runCheck(job.threadKey, command, timeoutSec * 1000);
|
|
239
290
|
if (!result) {
|
|
240
291
|
// A binding that went without `/unbind` (the unbind itself clears the line when it parks the job — `unbindPause.ts`): the
|
|
@@ -252,7 +303,7 @@ async function deliverCheck(deps, job, fireContext) {
|
|
|
252
303
|
}
|
|
253
304
|
if (decision === 'recovered') {
|
|
254
305
|
await deps.setCheckFailing(job.id, false);
|
|
255
|
-
await deps.announce(job.threadKey, (
|
|
306
|
+
await deps.announce(job.threadKey, buildCheckRecoveredText(job), { isSilent: true });
|
|
256
307
|
await updateCheckStatus(deps, job);
|
|
257
308
|
return { status: 'delivered' };
|
|
258
309
|
}
|
|
@@ -260,9 +311,8 @@ async function deliverCheck(deps, job, fireContext) {
|
|
|
260
311
|
await clearCheckStatusLine(deps, job);
|
|
261
312
|
await deps.setCheckFailing(job.id, true);
|
|
262
313
|
const failure = (0, checkRun_1.describeCheckFailure)(result, timeoutSec);
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
await deps.recordAlertPin(job.id, alertPinId);
|
|
314
|
+
const alert = buildCheckFailedAnnouncement({ job, result, failure, nowMs: deps.now() });
|
|
315
|
+
await deps.announce(job.threadKey, alert.text, { isSilent: true, foldedDetail: alert.foldedDetail });
|
|
266
316
|
return deliverToAgent(deps, job, (0, checkRun_1.buildCheckFailurePrompt)({ name: job.name, command, failure, output: result.output, prompt: job.prompt }));
|
|
267
317
|
}
|
|
268
318
|
/**
|
|
@@ -272,17 +322,20 @@ async function deliverCheck(deps, job, fireContext) {
|
|
|
272
322
|
function createScheduleDelivery(deps) {
|
|
273
323
|
return async (job, fireContext) => {
|
|
274
324
|
if ((0, deliveryKind_1.checkIsCheckSchedule)(job))
|
|
275
|
-
return deliverCheck(deps, job
|
|
276
|
-
// Read before the paced announce
|
|
325
|
+
return deliverCheck(deps, job);
|
|
326
|
+
// Read before the paced announce, which can take a while under load:
|
|
277
327
|
// a run held over a usage-limit wait says when it was due (R27).
|
|
278
328
|
const dueAtMs = fireContext.kind === 'catch-up' && fireContext.missedAtMs !== undefined ? fireContext.missedAtMs : deps.now();
|
|
279
|
-
// 1
|
|
280
|
-
|
|
281
|
-
// A reminder is done
|
|
329
|
+
// 1. announce
|
|
330
|
+
const announcement = buildFireAnnouncement(job, fireContext, deps.now());
|
|
331
|
+
// A reminder is done after its announcement and its pin, with no agent involved at
|
|
282
332
|
// all. Returning before `ensureSession` is also what lets it fire in an
|
|
283
333
|
// unbound topic and in General — there is no session to fail to ensure.
|
|
284
|
-
if ((0, deliveryKind_1.checkIsReminderSchedule)(job))
|
|
334
|
+
if ((0, deliveryKind_1.checkIsReminderSchedule)(job)) {
|
|
335
|
+
await announceAndPinReminder(deps, job, announcement.text);
|
|
285
336
|
return { status: 'delivered' };
|
|
337
|
+
}
|
|
338
|
+
await deps.announce(job.threadKey, announcement.text, { isSilent: true, foldedDetail: announcement.foldedDetail });
|
|
286
339
|
// 3–4. wake the agent with the prompt. A run held over a usage-limit wait
|
|
287
340
|
// reaches the agent later: it says when it was due (R27).
|
|
288
341
|
return deliverToAgent(deps, job, prependScheduledRunMarker(job.name, job.prompt), {
|