charness 3.11.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +5 -0
- package/CHANGELOG.md +169 -0
- package/DEVELOPMENT.md +81 -18
- package/README.md +3 -2
- package/SETUP.md +71 -25
- package/agent-plugin/README.md +15 -6
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +37 -18
- 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/accessControl.d.ts +43 -0
- package/dist/accessControl.d.ts.map +1 -1
- package/dist/accessControl.js +50 -1
- package/dist/accessControl.js.map +1 -1
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +9 -4
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/claudePlatformFlags.d.ts +4 -3
- package/dist/adapters/claudePlatformFlags.d.ts.map +1 -1
- package/dist/adapters/claudePlatformFlags.js +4 -3
- package/dist/adapters/claudePlatformFlags.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +52 -13
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +121 -45
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/adapters/terminalAdapter.d.ts.map +1 -1
- package/dist/adapters/terminalAdapter.js +5 -3
- package/dist/adapters/terminalAdapter.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 +20 -20
- 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 +12 -3
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +634 -153
- 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 +45 -22
- 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/jira/client.js +1 -1
- package/dist/connectors/jira/client.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +7 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +12 -1
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +7 -0
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +20 -3
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +4 -3
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +1 -1
- package/dist/connectors/jira/trustedGroup.d.ts +21 -6
- package/dist/connectors/jira/trustedGroup.d.ts.map +1 -1
- package/dist/connectors/jira/trustedGroup.js +46 -6
- package/dist/connectors/jira/trustedGroup.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +19 -2
- 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 +9 -6
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +16 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +216 -27
- 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 +146 -31
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/commands/todo.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/todo.js +2 -2
- package/dist/connectors/telegram/commands/todo.js.map +1 -1
- package/dist/connectors/telegram/commands/topicAccess.d.ts +30 -0
- package/dist/connectors/telegram/commands/topicAccess.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/topicAccess.js +399 -0
- package/dist/connectors/telegram/commands/topicAccess.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +44 -7
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +142 -24
- package/dist/connectors/telegram/inbound.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/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +120 -8
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +120 -8
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +120 -8
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +120 -8
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +120 -8
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +120 -8
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +120 -8
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +120 -8
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +120 -8
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +120 -8
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +120 -8
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +120 -8
- package/dist/i18n/zh.js.map +1 -1
- package/dist/installManager.d.ts +37 -1
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +208 -14
- 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/platform/commandRouter.d.ts +13 -1
- package/dist/platform/commandRouter.d.ts.map +1 -1
- package/dist/platform/commandRouter.js +14 -2
- package/dist/platform/commandRouter.js.map +1 -1
- package/dist/platform/inbound.d.ts +2 -0
- package/dist/platform/inbound.d.ts.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 +4 -2
- 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/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/runnerLock.d.ts +36 -1
- package/dist/runners/runnerLock.d.ts.map +1 -1
- package/dist/runners/runnerLock.js +94 -30
- package/dist/runners/runnerLock.js.map +1 -1
- 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 +0 -2
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +0 -10
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/scheduler/checkStatus.d.ts +2 -0
- package/dist/scheduler/checkStatus.d.ts.map +1 -1
- package/dist/scheduler/checkStatus.js +5 -4
- package/dist/scheduler/checkStatus.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +2 -1
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +5 -1
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +7 -3
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +48 -22
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +33 -10
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +37 -11
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/selfUpdate/bootRollback.d.ts.map +1 -1
- package/dist/selfUpdate/bootRollback.js +3 -2
- package/dist/selfUpdate/bootRollback.js.map +1 -1
- package/dist/selfUpdate/updateRuntime.d.ts.map +1 -1
- package/dist/selfUpdate/updateRuntime.js +6 -3
- package/dist/selfUpdate/updateRuntime.js.map +1 -1
- package/dist/state.d.ts +144 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +257 -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/threadContextPreamble.d.ts +15 -1
- package/dist/threadContextPreamble.d.ts.map +1 -1
- package/dist/threadContextPreamble.js +15 -3
- package/dist/threadContextPreamble.js.map +1 -1
- package/dist/threadRouting.d.ts +47 -4
- package/dist/threadRouting.d.ts.map +1 -1
- package/dist/threadRouting.js +31 -4
- package/dist/threadRouting.js.map +1 -1
- package/dist/todos/projects.d.ts +1 -1
- package/dist/todos/projects.d.ts.map +1 -1
- package/dist/todos/projects.js +3 -14
- package/dist/todos/projects.js.map +1 -1
- package/dist/topicTalkerMemory.d.ts +37 -0
- package/dist/topicTalkerMemory.d.ts.map +1 -0
- package/dist/topicTalkerMemory.js +61 -0
- package/dist/topicTalkerMemory.js.map +1 -0
- package/dist/topicTalkers.d.ts +123 -0
- package/dist/topicTalkers.d.ts.map +1 -0
- package/dist/topicTalkers.js +276 -0
- package/dist/topicTalkers.js.map +1 -0
- package/dist/types.d.ts +7 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.d.ts +23 -0
- package/dist/utils/agentEnvironment.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.js +33 -1
- package/dist/utils/agentEnvironment.js.map +1 -1
- package/dist/utils/agentPlugin.d.ts +9 -3
- package/dist/utils/agentPlugin.d.ts.map +1 -1
- package/dist/utils/agentPlugin.js +13 -6
- package/dist/utils/agentPlugin.js.map +1 -1
- package/dist/utils/authorMark.d.ts +59 -0
- package/dist/utils/authorMark.d.ts.map +1 -0
- package/dist/utils/authorMark.js +86 -0
- package/dist/utils/authorMark.js.map +1 -0
- 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/claudeLimitSwitch.d.ts +5 -1
- package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
- package/dist/utils/claudeLimitSwitch.js +6 -2
- package/dist/utils/claudeLimitSwitch.js.map +1 -1
- package/dist/utils/claudeProfileUsageLines.d.ts +14 -2
- package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
- package/dist/utils/claudeProfileUsageLines.js +78 -7
- 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 +22 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +69 -0
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +145 -51
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +211 -94
- package/dist/utils/claudeUsage.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 +36 -16
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/folderGit.d.ts +9 -0
- package/dist/utils/folderGit.d.ts.map +1 -0
- package/dist/utils/folderGit.js +33 -0
- package/dist/utils/folderGit.js.map +1 -0
- package/dist/utils/forwardedMark.d.ts +8 -0
- package/dist/utils/forwardedMark.d.ts.map +1 -1
- package/dist/utils/forwardedMark.js +2 -0
- package/dist/utils/forwardedMark.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +2 -1
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +4 -2
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/messageContext.d.ts +22 -7
- package/dist/utils/messageContext.d.ts.map +1 -1
- package/dist/utils/messageContext.js +19 -5
- package/dist/utils/messageContext.js.map +1 -1
- 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/personLabel.d.ts +13 -0
- package/dist/utils/personLabel.d.ts.map +1 -0
- package/dist/utils/personLabel.js +15 -0
- package/dist/utils/personLabel.js.map +1 -0
- package/dist/utils/replyQuote.d.ts +17 -3
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +25 -2
- 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/talkerAccess.d.ts +9 -0
- package/dist/utils/talkerAccess.d.ts.map +1 -0
- package/dist/utils/talkerAccess.js +20 -0
- package/dist/utils/talkerAccess.js.map +1 -0
- package/dist/utils/tmuxExec.d.ts +20 -8
- package/dist/utils/tmuxExec.d.ts.map +1 -1
- package/dist/utils/tmuxExec.js +27 -7
- package/dist/utils/tmuxExec.js.map +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts +253 -0
- package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -0
- package/dist/utils/topicAccessScreenPlan.js +287 -0
- package/dist/utils/topicAccessScreenPlan.js.map +1 -0
- package/dist/utils/topicLabel.d.ts +12 -0
- package/dist/utils/topicLabel.d.ts.map +1 -0
- package/dist/utils/topicLabel.js +12 -0
- package/dist/utils/topicLabel.js.map +1 -0
- package/dist/utils/topicRequest.d.ts +8 -5
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +9 -7
- package/dist/utils/topicRequest.js.map +1 -1
- package/npm-shrinkwrap.json +1003 -0
- package/package.json +5 -3
- package/remoteRun/ensureNode.sh +288 -0
- package/remoteRun/runner.sh +2252 -115
- package/agent-plugin/skills/charness-manager/SKILL.md +0 -157
- package/remoteRun/pickNode.sh +0 -65
|
@@ -10,8 +10,11 @@ const sessionKeyCodec_1 = require("../sessionKeyCodec");
|
|
|
10
10
|
const i18n_1 = require("../../../i18n");
|
|
11
11
|
const compactCommandRoute_1 = require("../../../utils/compactCommandRoute");
|
|
12
12
|
const compactOnIdle_1 = require("../../../utils/compactOnIdle");
|
|
13
|
+
const streamedCompactionSummary_1 = require("../../../utils/streamedCompactionSummary");
|
|
14
|
+
const compactSelfReviewFlags_1 = require("../../../utils/compactSelfReviewFlags");
|
|
13
15
|
const questionKeyboards_1 = require("../questionKeyboards");
|
|
14
16
|
const messageSplit_1 = require("../messageSplit");
|
|
17
|
+
const inbound_1 = require("../inbound");
|
|
15
18
|
const openCodeQuestionFlow_1 = require("../../../openCodeQuestionFlow");
|
|
16
19
|
const callbackMessage_1 = require("./callbackMessage");
|
|
17
20
|
const callbackToast_1 = require("./callbackToast");
|
|
@@ -21,8 +24,8 @@ const compactCommandText = '/compact';
|
|
|
21
24
|
const terminalAdapterName = 'terminal';
|
|
22
25
|
/**
|
|
23
26
|
* @description Compose the per-invocation compaction instruction for a thread's
|
|
24
|
-
* backend (D3 summary guidance + the resume guidance —
|
|
25
|
-
* next-steps checklist — + the optional F2 closing section). The general guidance
|
|
27
|
+
* backend (D3 summary guidance + the resume guidance — the self-review section while `/compact_self_review` is on, the loaded
|
|
28
|
+
* skills and the next-steps checklist — + the optional F2 closing section). The general guidance
|
|
26
29
|
* is skipped for OpenCode (baked in its fork prompt) and appended for the Claude
|
|
27
30
|
* backends; the resume guidance is skipped when the backend's own compaction
|
|
28
31
|
* prompt already gets it (an OpenCode server running the bot's compaction
|
|
@@ -33,7 +36,7 @@ async function getCompactionInstruction(adapter, key, opts) {
|
|
|
33
36
|
bakesSummaryGuidance: adapter.name === adapterNames_1.openCodeAdapterName,
|
|
34
37
|
summaryGuidance: compactOnIdle_1.compactionSummaryGuidance,
|
|
35
38
|
bakesResumeGuidance: (await adapter.checkHasCompactionResumeHook?.(key)) ?? false,
|
|
36
|
-
resumeGuidance: compactOnIdle_1.
|
|
39
|
+
resumeGuidance: (0, compactOnIdle_1.getCompactionResumeGuidance)(opts.isWithInstructionGaps),
|
|
37
40
|
closingSectionInstruction: opts.withClosingSection
|
|
38
41
|
? (0, i18n_1.t)('compact.closingSectionInstruction', {
|
|
39
42
|
startMarker: compactOnIdle_1.compactionClosingStartMarker,
|
|
@@ -52,7 +55,7 @@ async function getCompactionInstruction(adapter, key, opts) {
|
|
|
52
55
|
const deferredCompactionPollMs = 3_000;
|
|
53
56
|
/**
|
|
54
57
|
* Build the `/compact_on_idle` picker keyboard: Enable / Disable, then Show / Hide
|
|
55
|
-
* summary, ✓ on the current value of each.
|
|
58
|
+
* summary, then Show / Hide self-review, ✓ on the current value of each.
|
|
56
59
|
*/
|
|
57
60
|
function buildCompactOnIdleKeyboard(picker) {
|
|
58
61
|
return telegraf_1.Markup.inlineKeyboard([
|
|
@@ -64,6 +67,10 @@ function buildCompactOnIdleKeyboard(picker) {
|
|
|
64
67
|
telegraf_1.Markup.button.callback((0, i18n_1.t)('compactOnIdle.summaryShowButton') + (picker.isSummaryEnabled ? ' ✓' : ''), 'coi_sum_on'),
|
|
65
68
|
telegraf_1.Markup.button.callback((0, i18n_1.t)('compactOnIdle.summaryHideButton') + (!picker.isSummaryEnabled ? ' ✓' : ''), 'coi_sum_off'),
|
|
66
69
|
],
|
|
70
|
+
[
|
|
71
|
+
telegraf_1.Markup.button.callback((0, i18n_1.t)('compactOnIdle.selfReviewShowButton') + (picker.isSelfReviewEnabled ? ' ✓' : ''), 'coi_sr_on'),
|
|
72
|
+
telegraf_1.Markup.button.callback((0, i18n_1.t)('compactOnIdle.selfReviewHideButton') + (!picker.isSelfReviewEnabled ? ' ✓' : ''), 'coi_sr_off'),
|
|
73
|
+
],
|
|
67
74
|
]);
|
|
68
75
|
}
|
|
69
76
|
/**
|
|
@@ -72,7 +79,7 @@ function buildCompactOnIdleKeyboard(picker) {
|
|
|
72
79
|
* state the typing loop and the request probe read, and the `register…()` calls.
|
|
73
80
|
*/
|
|
74
81
|
function createCompaction(ports) {
|
|
75
|
-
const { startTypingLoader, forwardPromptToAgent, pendingQuestions, clearPendingQuestion, closeQuestionMessage, idleWindowMs, checkIsLimitWaitArmed, suspendThreadSession, resumeSleepingSessionForCompaction, getThreadAdapter, deliverLabel, resumeSleepingSessionForPrompt, checkIsStarting, closeOrphanQuestionMessage, notePersonActivity, bot, command, getState, replyToThread, editThreadKeyboard, authoriseContext, withThreadLocale, checkIsGeneral, wakeSleepingSession } = ports;
|
|
82
|
+
const { startTypingLoader, forwardPromptToAgent, pendingQuestions, clearPendingQuestion, closeQuestionMessage, idleWindowMs, checkIsLimitWaitArmed, suspendThreadSession, resumeSleepingSessionForCompaction, getThreadAdapter, deliverLabel, resumeSleepingSessionForPrompt, checkIsStarting, closeOrphanQuestionMessage, notePersonActivity, compactSelfReviewFlagDirs, bot, command, getState, replyToThread, editThreadKeyboard, authoriseContext, authoriseSpeaker, withThreadLocale, checkIsGeneral, wakeSleepingSession } = ports;
|
|
76
83
|
/**
|
|
77
84
|
* @description Resolve the `/compact` route for a thread's current backend — the
|
|
78
85
|
* pure {@link getCompactCommandRoute} wrapped with the live adapter reading.
|
|
@@ -132,7 +139,8 @@ function createCompaction(ports) {
|
|
|
132
139
|
// D3: every bot-issued compaction carries the maximally-complete-summary
|
|
133
140
|
// guidance (baked in the OpenCode fork, appended for the Claude backends), plus
|
|
134
141
|
// the F2 closing-section directive when requested.
|
|
135
|
-
const
|
|
142
|
+
const isSelfReviewEnabled = getState().checkIsCompactSelfReviewEnabled(key);
|
|
143
|
+
const instruction = await getCompactionInstruction(adapter, key, { withClosingSection: opts.withClosingSection, isWithInstructionGaps: isSelfReviewEnabled });
|
|
136
144
|
const kStr = (0, sessionKey_1.keyToString)(key);
|
|
137
145
|
threadsCompacting.add(kStr);
|
|
138
146
|
// S3: `threadsCompacting` is set FIRST, so the loader's very first keep-alive
|
|
@@ -157,18 +165,18 @@ function createCompaction(ports) {
|
|
|
157
165
|
const compaction = await adapter.compactContext(key, instruction);
|
|
158
166
|
if (!compaction.ok)
|
|
159
167
|
return { ok: false, error: compaction.error };
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const summary = isWithSummary && adapter.getLatestCompactionSummary
|
|
168
|
+
const isSummaryEnabled = getState().checkIsCompactSummaryEnabled(key);
|
|
169
|
+
const streamsOwnSummary = Boolean(adapter.streamsCompactionSummary);
|
|
170
|
+
const isWithSummary = (0, compactOnIdle_1.checkShouldPostCompactionSummary)({ isEnabled: isSummaryEnabled, streamsOwnSummary, route });
|
|
171
|
+
const isWithInstructionGaps = (0, compactOnIdle_1.checkShouldPostInstructionGaps)({ isEnabled: isSelfReviewEnabled, isSummaryEnabled, streamsOwnSummary, isBotIssued: true, route });
|
|
172
|
+
// A transcript / HTTP read, made only when something of the summary will be posted.
|
|
173
|
+
const summary = (isWithSummary || isWithInstructionGaps) && adapter.getLatestCompactionSummary
|
|
167
174
|
? await adapter.getLatestCompactionSummary(key).catch(() => null)
|
|
168
175
|
: null;
|
|
169
176
|
return {
|
|
170
177
|
ok: true,
|
|
171
|
-
summary: summary ? (0, compactOnIdle_1.
|
|
178
|
+
summary: isWithSummary && summary ? (0, compactOnIdle_1.formatCompactionSummaryForTopic)(summary, (0, i18n_1.t)('compact.selfReviewHeader')) : null,
|
|
179
|
+
instructionGaps: isWithInstructionGaps && summary ? (0, compactOnIdle_1.extractCompactionInstructionGaps)(summary) : null,
|
|
172
180
|
preTokens: compaction.preTokens,
|
|
173
181
|
postTokens: compaction.postTokens,
|
|
174
182
|
};
|
|
@@ -234,6 +242,8 @@ function createCompaction(ports) {
|
|
|
234
242
|
: (0, i18n_1.t)('compact.done'));
|
|
235
243
|
if (result.summary)
|
|
236
244
|
await postCompactionSummary(key, result.summary);
|
|
245
|
+
if (result.instructionGaps)
|
|
246
|
+
await postCompactionInstructionGaps(key, result.instructionGaps);
|
|
237
247
|
}
|
|
238
248
|
/**
|
|
239
249
|
* @description Post a compaction's FULL summary into the topic — the single poster
|
|
@@ -249,10 +259,72 @@ function createCompaction(ports) {
|
|
|
249
259
|
* the `threadsCompacting` guard exists to prevent.
|
|
250
260
|
*/
|
|
251
261
|
async function postCompactionSummary(key, summary) {
|
|
252
|
-
|
|
253
|
-
|
|
262
|
+
await postHeadedPlainText(key, (0, i18n_1.t)('compact.summaryHeader'), summary);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @description Post the SELF-REVIEW section of a compaction summary as a message of its own — the part of the
|
|
266
|
+
* summary the person sees even in `/compact_summary` hide mode ({@link checkShouldPostInstructionGaps}). The agent only
|
|
267
|
+
* proposes these instruction changes; the header says so, so the message reads as a proposal and never as something
|
|
268
|
+
* already changed. Same plain-text, split-never-truncated send as {@link postCompactionSummary}.
|
|
269
|
+
*/
|
|
270
|
+
async function postCompactionInstructionGaps(key, instructionGaps) {
|
|
271
|
+
await postHeadedPlainText(key, (0, i18n_1.t)('compact.selfReviewHeader'), instructionGaps);
|
|
272
|
+
}
|
|
273
|
+
async function postHeadedPlainText(key, header, body) {
|
|
274
|
+
for (const chunk of (0, messageSplit_1.splitMessage)(`${header}\n\n${body}`, messageSplit_1.MAX_MESSAGE_LEN))
|
|
254
275
|
await replyToThread(key, chunk);
|
|
255
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* @description A compaction the bot did NOT issue finished — the CLI's own, at a context overflow (json-stream's
|
|
279
|
+
* `contextCompacted` event): post its self-review section. Nobody posts such a compaction's summary, in show mode
|
|
280
|
+
* no more than in hide mode, so the section is read out of the transcript and posted whatever `/compact_summary` says.
|
|
281
|
+
* A compaction the bot issued is left to its caller (it is in {@link threadsCompacting} when its completion is
|
|
282
|
+
* announced), which posts what the setting asks for.
|
|
283
|
+
*/
|
|
284
|
+
async function postOwnCompactionInstructionGaps(key) {
|
|
285
|
+
if (!(0, sessionKeyCodec_1.checkIsTelegramKey)(key) || threadsCompacting.has((0, sessionKey_1.keyToString)(key)))
|
|
286
|
+
return;
|
|
287
|
+
const adapter = getThreadAdapter(key);
|
|
288
|
+
if (!(0, compactOnIdle_1.checkShouldPostInstructionGaps)({
|
|
289
|
+
isEnabled: getState().checkIsCompactSelfReviewEnabled(key),
|
|
290
|
+
isSummaryEnabled: getState().checkIsCompactSummaryEnabled(key),
|
|
291
|
+
streamsOwnSummary: Boolean(adapter.streamsCompactionSummary),
|
|
292
|
+
isBotIssued: false,
|
|
293
|
+
route: getThreadCompactRoute(key),
|
|
294
|
+
}))
|
|
295
|
+
return;
|
|
296
|
+
const summary = adapter.getLatestCompactionSummary ? await adapter.getLatestCompactionSummary(key).catch(() => null) : null;
|
|
297
|
+
const instructionGaps = summary ? (0, compactOnIdle_1.extractCompactionInstructionGaps)(summary) : null;
|
|
298
|
+
if (instructionGaps)
|
|
299
|
+
await withThreadLocale(key, () => postCompactionInstructionGaps(key, instructionGaps));
|
|
300
|
+
}
|
|
301
|
+
/** The summary each thread's backend is streaming (OpenCode): what `streamedCompactionSummary.ts` follows tail by tail. */
|
|
302
|
+
const streamedSummaryTracker = (0, streamedCompactionSummary_1.createStreamedSummaryTracker)();
|
|
303
|
+
/**
|
|
304
|
+
* @description One tail of a compaction summary that a backend STREAMS (OpenCode), on its way to the topic: the one place
|
|
305
|
+
* that decides what of it the topic sees. Called by `handleAgentOutput` for every tail marked `isCompactionSummary`; the
|
|
306
|
+
* tail goes on to the topic as the returned text (`null`: nothing of it does).
|
|
307
|
+
*
|
|
308
|
+
* - `/compact_summary` ON: the summary is shown, minus the scaffolding the agent was asked to write (the marker lines,
|
|
309
|
+
* the «none» line), with the self-review section under its header;
|
|
310
|
+
* - OFF: nothing is shown, and the section is posted on its own — here, once complete, only for a compaction the BACKEND
|
|
311
|
+
* ran (an overflow). One the bot issued has its section read after the compaction, in order ({@link runThreadCompaction}).
|
|
312
|
+
*
|
|
313
|
+
* A non-Telegram conversation has no topic to post into: its tails go on as they are.
|
|
314
|
+
*/
|
|
315
|
+
function routeStreamedCompactionSummaryTail(key, tail, hints) {
|
|
316
|
+
const isContinuation = hints.isContinuation === true;
|
|
317
|
+
if (!(0, sessionKeyCodec_1.checkIsTelegramKey)(key))
|
|
318
|
+
return { text: tail, isContinuation };
|
|
319
|
+
const kStr = (0, sessionKey_1.keyToString)(key);
|
|
320
|
+
const outcome = streamedSummaryTracker.push(kStr, { text: tail, isContinuation, summaryId: hints.compactionSummaryMessageId ?? null, isBotIssued: hints.isBotIssuedCompaction === true }, { isSummaryShown: getState().checkIsCompactSummaryEnabled(key), isInstructionGapsEnabled: getState().checkIsCompactSelfReviewEnabled(key), gapsHeader: (0, i18n_1.t)('compact.selfReviewHeader') });
|
|
321
|
+
if (outcome.instructionGaps !== null) {
|
|
322
|
+
const instructionGaps = outcome.instructionGaps;
|
|
323
|
+
void withThreadLocale(key, () => postCompactionInstructionGaps(key, instructionGaps))
|
|
324
|
+
.catch((error) => console.warn(`[compact] ${kStr} the self-review section was not posted:`, error instanceof Error ? error.message : error));
|
|
325
|
+
}
|
|
326
|
+
return outcome.shown;
|
|
327
|
+
}
|
|
256
328
|
const threadCompactionStates = new Map();
|
|
257
329
|
function getThreadCompactionState(kStr) {
|
|
258
330
|
let existing = threadCompactionStates.get(kStr);
|
|
@@ -405,6 +477,7 @@ function createCompaction(ports) {
|
|
|
405
477
|
if (compactionState?.idleTimer)
|
|
406
478
|
clearTimeout(compactionState.idleTimer);
|
|
407
479
|
threadCompactionStates.delete(kStr);
|
|
480
|
+
streamedSummaryTracker.clear(kStr);
|
|
408
481
|
// Drop the persisted instants too, so the NEXT session in this topic starts with
|
|
409
482
|
// no history and therefore gets the FULL idle window — which is why the fresh-start
|
|
410
483
|
// path needs no special case (do not "fix" it by adding one).
|
|
@@ -560,12 +633,13 @@ function createCompaction(ports) {
|
|
|
560
633
|
// The compaction failed but the question is already rejected — re-ask it so
|
|
561
634
|
// the user isn't left without the pending decision (no notice: nothing was
|
|
562
635
|
// compacted).
|
|
563
|
-
await postIdleCompactionResult(key, { noticeText: null, summary: null }, reAsked);
|
|
636
|
+
await postIdleCompactionResult(key, { noticeText: null, summary: null, instructionGaps: null }, reAsked);
|
|
564
637
|
return;
|
|
565
638
|
}
|
|
566
639
|
await postIdleCompactionResult(key, {
|
|
567
640
|
noticeText: (0, i18n_1.t)('compactOnIdle.notice'),
|
|
568
641
|
summary: result.summary ?? null,
|
|
642
|
+
instructionGaps: result.instructionGaps ?? null,
|
|
569
643
|
}, reAsked);
|
|
570
644
|
}
|
|
571
645
|
/**
|
|
@@ -848,7 +922,7 @@ function createCompaction(ports) {
|
|
|
848
922
|
/**
|
|
849
923
|
* @description Post the idle-compaction outcome (D1/D2) as SEPARATE messages in
|
|
850
924
|
* the §1.4 order: the short notice → the full summary (when `/compact_summary` is
|
|
851
|
-
* on) → the RE-ASKED question with its option buttons, LAST.
|
|
925
|
+
* on) or else the self-review section alone → the RE-ASKED question with its option buttons, LAST.
|
|
852
926
|
*
|
|
853
927
|
* The three used to be one joined message. They are split because the re-asked
|
|
854
928
|
* question carries inline buttons the operator must be able to reach: glued behind
|
|
@@ -872,6 +946,8 @@ function createCompaction(ports) {
|
|
|
872
946
|
await replyToThread(key, plan.notice);
|
|
873
947
|
if (plan.summary)
|
|
874
948
|
await postCompactionSummary(key, plan.summary);
|
|
949
|
+
if (plan.instructionGaps)
|
|
950
|
+
await postCompactionInstructionGaps(key, plan.instructionGaps);
|
|
875
951
|
if (!reAsked)
|
|
876
952
|
return;
|
|
877
953
|
// From here the re-ask is decided: a record taken meanwhile (a number typed) is not posted, and whoever puts it back finishes it.
|
|
@@ -905,11 +981,13 @@ function createCompaction(ports) {
|
|
|
905
981
|
* the chosen answer in place of the buttons.
|
|
906
982
|
*/
|
|
907
983
|
async function handleReAskedQuestionTap(ctx, optionIndex) {
|
|
908
|
-
|
|
909
|
-
|
|
984
|
+
// A topic member may answer the agent's question: this tap is one of the few they may make (the speaker gate, not the admin one).
|
|
985
|
+
const speaker = await authoriseSpeaker(ctx);
|
|
986
|
+
if (!speaker) {
|
|
910
987
|
await ctx.answerCbQuery((0, i18n_1.t)('cb.access_denied'));
|
|
911
988
|
return;
|
|
912
989
|
}
|
|
990
|
+
const { key } = speaker;
|
|
913
991
|
const tappedMessageId = (0, callbackMessage_1.getCallbackMessageId)(ctx);
|
|
914
992
|
const reAsked = peekReAskedQuestion(key);
|
|
915
993
|
// A re-ask whose send has not returned has no message id, and when the old message has none either there is nothing to tell
|
|
@@ -967,7 +1045,7 @@ function createCompaction(ports) {
|
|
|
967
1045
|
// An answer to the agent's own question is never a request (S7), even delivered as a prompt. Routed at delivery,
|
|
968
1046
|
// not on the `checkIsStarting` read above: the stop may have ended during the toast, and a label buffered into its closed
|
|
969
1047
|
// window was never replayed.
|
|
970
|
-
const outcome = await deliverLabel(key, label);
|
|
1048
|
+
const outcome = await deliverLabel(key, label, speaker.role === 'talker' && ctx.from ? (0, inbound_1.getTelegramTalkerContext)(ctx.from) : undefined);
|
|
971
1049
|
// The label reached no session (the topic was told why): the question is still open, so are its buttons.
|
|
972
1050
|
if (outcome === 'noSession') {
|
|
973
1051
|
await returnReAskedQuestionAfterTap(key, reAsked, reAskedMessageId);
|
|
@@ -984,7 +1062,7 @@ function createCompaction(ports) {
|
|
|
984
1062
|
* number would count as the person writing something else: the question would end «not answered» and the agent would get a
|
|
985
1063
|
* bare «2». Resolves whether the text was such a number (and was handled).
|
|
986
1064
|
*/
|
|
987
|
-
async function answerReAskedQuestionByNumber(key, text) {
|
|
1065
|
+
async function answerReAskedQuestionByNumber(key, text, messageContext) {
|
|
988
1066
|
const reAsked = peekReAskedQuestion(key);
|
|
989
1067
|
if (!reAsked)
|
|
990
1068
|
return false;
|
|
@@ -997,7 +1075,7 @@ function createCompaction(ports) {
|
|
|
997
1075
|
takeReAskedQuestionForAnswer(key);
|
|
998
1076
|
// A person wrote — the latch clears like for any message; the record is gone, so nothing is closed as «not answered».
|
|
999
1077
|
notePersonActivity(key);
|
|
1000
|
-
const outcome = await deliverLabel(key, label);
|
|
1078
|
+
const outcome = await deliverLabel(key, label, messageContext);
|
|
1001
1079
|
if (outcome === 'noSession') {
|
|
1002
1080
|
const isPutBack = await returnReAskedQuestionAfterTap(key, reAsked, reAsked.messageId ?? reAsked.predecessorMessageId);
|
|
1003
1081
|
if (isPutBack)
|
|
@@ -1120,13 +1198,21 @@ function createCompaction(ports) {
|
|
|
1120
1198
|
}
|
|
1121
1199
|
}
|
|
1122
1200
|
/**
|
|
1123
|
-
* @description
|
|
1201
|
+
* @description The switches as the `/compact_on_idle` picker shows them: in General
|
|
1124
1202
|
* the instance-wide defaults, in a regular topic what applies to that topic.
|
|
1125
1203
|
*/
|
|
1126
1204
|
function getCompactOnIdlePickerState(key, isGeneral) {
|
|
1127
1205
|
return isGeneral
|
|
1128
|
-
? {
|
|
1129
|
-
|
|
1206
|
+
? {
|
|
1207
|
+
isIdleEnabled: getState().getCompactOnIdleGlobalDefault(),
|
|
1208
|
+
isSummaryEnabled: getState().getCompactSummaryGlobalDefault(),
|
|
1209
|
+
isSelfReviewEnabled: getState().getCompactSelfReviewGlobalDefault(),
|
|
1210
|
+
}
|
|
1211
|
+
: {
|
|
1212
|
+
isIdleEnabled: getState().checkIsCompactOnIdleEnabled(key),
|
|
1213
|
+
isSummaryEnabled: getState().checkIsCompactSummaryEnabled(key),
|
|
1214
|
+
isSelfReviewEnabled: getState().checkIsCompactSelfReviewEnabled(key),
|
|
1215
|
+
};
|
|
1130
1216
|
}
|
|
1131
1217
|
/**
|
|
1132
1218
|
* @description A tap on the `/compact_on_idle` picker — either row. `apply` writes
|
|
@@ -1197,6 +1283,69 @@ function createCompaction(ports) {
|
|
|
1197
1283
|
if (pickerMessageId !== null)
|
|
1198
1284
|
await editThreadKeyboard(key, pickerMessageId, buildCompactSummaryKeyboard(enabled).reply_markup, 'csum_cb');
|
|
1199
1285
|
}
|
|
1286
|
+
/**
|
|
1287
|
+
* @description Make the hook and plugin flags of `key`'s agent sessions — the current ones and the parked ones — say what
|
|
1288
|
+
* `/compact_self_review` resolves to for its topic. Called when the setting changes for the topic and when a session starts, so
|
|
1289
|
+
* the CLI's and OpenCode's own compactions — which read the flag inside the agent's process — follow the setting of the
|
|
1290
|
+
* session they run in.
|
|
1291
|
+
*/
|
|
1292
|
+
function syncThreadCompactSelfReviewFlags(key) {
|
|
1293
|
+
(0, compactSelfReviewFlags_1.syncCompactSelfReviewFlags)([{ ...getState().getAgentSessionIds(key), isEnabled: getState().checkIsCompactSelfReviewEnabled(key) }], compactSelfReviewFlagDirs);
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* @description {@link syncThreadCompactSelfReviewFlags} for every thread, and the Claude flags no OFF topic owns any more are
|
|
1297
|
+
* removed (a session a topic left, a topic that is gone): at boot, and when the General default changes.
|
|
1298
|
+
*/
|
|
1299
|
+
function syncAllCompactSelfReviewFlags() {
|
|
1300
|
+
const sessions = getState().listAgentSessionIds().map(({ key, claudeSessionIds, opencodeSessionIds }) => ({
|
|
1301
|
+
claudeSessionIds,
|
|
1302
|
+
opencodeSessionIds,
|
|
1303
|
+
isEnabled: getState().checkIsCompactSelfReviewEnabled(key),
|
|
1304
|
+
}));
|
|
1305
|
+
(0, compactSelfReviewFlags_1.syncCompactSelfReviewFlags)(sessions, compactSelfReviewFlagDirs);
|
|
1306
|
+
(0, compactSelfReviewFlags_1.pruneStaleClaudeCompactSelfReviewFlags)(sessions, compactSelfReviewFlagDirs.claudeOffDir);
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* @description Apply the `/compact_self_review` setting and RETURN the confirmation text — the single write path behind the
|
|
1310
|
+
* command, its picker buttons and the self-review row of the `/compact_on_idle` picker. Regular topic → the per-thread
|
|
1311
|
+
* override; General → the instance-wide default. The flags the compactions of the agent's own process read are brought in
|
|
1312
|
+
* step with it before the confirmation goes out.
|
|
1313
|
+
*/
|
|
1314
|
+
async function applyCompactSelfReview(key, isGeneral, enabled) {
|
|
1315
|
+
const stateWord = enabled ? (0, i18n_1.t)('compactSelfReview.on') : (0, i18n_1.t)('compactSelfReview.off');
|
|
1316
|
+
if (isGeneral) {
|
|
1317
|
+
await getState().setCompactSelfReviewGlobalDefault(enabled);
|
|
1318
|
+
syncAllCompactSelfReviewFlags();
|
|
1319
|
+
return (0, i18n_1.t)('compactSelfReview.setGlobal', { state: stateWord });
|
|
1320
|
+
}
|
|
1321
|
+
await getState().setCompactSelfReviewOverride(key, enabled);
|
|
1322
|
+
syncThreadCompactSelfReviewFlags(key);
|
|
1323
|
+
return (0, i18n_1.t)('compactSelfReview.setThisTopic', { state: stateWord });
|
|
1324
|
+
}
|
|
1325
|
+
/** Build the `/compact_self_review` picker keyboard (Enable / Disable, ✓ on current). */
|
|
1326
|
+
function buildCompactSelfReviewKeyboard(isEnabled) {
|
|
1327
|
+
return telegraf_1.Markup.inlineKeyboard([
|
|
1328
|
+
telegraf_1.Markup.button.callback((0, i18n_1.t)('compactSelfReview.enableButton') + (isEnabled ? ' ✓' : ''), 'csr_on'),
|
|
1329
|
+
telegraf_1.Markup.button.callback((0, i18n_1.t)('compactSelfReview.disableButton') + (!isEnabled ? ' ✓' : ''), 'csr_off'),
|
|
1330
|
+
]);
|
|
1331
|
+
}
|
|
1332
|
+
/** `/compact_self_review` picker button. A REPEATED-USE picker, so it re-renders its keyboard in place, like `csum_on` / `csum_off`. */
|
|
1333
|
+
async function handleCompactSelfReviewCallback(ctx, enabled) {
|
|
1334
|
+
const key = await authoriseContext(ctx);
|
|
1335
|
+
if (!key) {
|
|
1336
|
+
await ctx.answerCbQuery((0, i18n_1.t)('cb.access_denied'));
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
const isGeneral = checkIsGeneral(key);
|
|
1340
|
+
// Answered first for the reason given in `handleCompactOnIdleCallback`.
|
|
1341
|
+
await ctx.answerCbQuery();
|
|
1342
|
+
await withThreadLocale(key, async () => {
|
|
1343
|
+
await replyToThread(key, await applyCompactSelfReview(key, isGeneral, enabled));
|
|
1344
|
+
});
|
|
1345
|
+
const pickerMessageId = (0, callbackMessage_1.getCallbackMessageId)(ctx);
|
|
1346
|
+
if (pickerMessageId !== null)
|
|
1347
|
+
await editThreadKeyboard(key, pickerMessageId, buildCompactSelfReviewKeyboard(enabled).reply_markup, 'csr_cb');
|
|
1348
|
+
}
|
|
1200
1349
|
function registerCompactionCommands() {
|
|
1201
1350
|
// `/compact` — shrink the agent's context. BOT-OWNED, because "forward the text
|
|
1202
1351
|
// and hope" only works for a backend that parses slash commands itself: OpenCode's
|
|
@@ -1230,7 +1379,7 @@ function createCompaction(ports) {
|
|
|
1230
1379
|
// → per-thread override; General → the instance-wide default. Bare → a picker:
|
|
1231
1380
|
// Enable/Disable, plus a Show/Hide row for the `/compact_summary` setting, which
|
|
1232
1381
|
// is what decides whether an idle compaction ends in one line or with the whole
|
|
1233
|
-
// summary (✓ on current). Only meaningful for an agent topic with an active
|
|
1382
|
+
// summary, and one for `/compact_self_review` (the self-review section; ✓ on current). Only meaningful for an agent topic with an active
|
|
1234
1383
|
// session (terminal / unbound → the "nothing to compact" reply).
|
|
1235
1384
|
command('compact_on_idle', async (_ctx, key, parsed) => {
|
|
1236
1385
|
const arg = parsed.args.join(' ').toLowerCase();
|
|
@@ -1251,6 +1400,9 @@ function createCompaction(ports) {
|
|
|
1251
1400
|
summaryLine: (0, i18n_1.t)('compactOnIdle.summaryLine', {
|
|
1252
1401
|
state: picker.isSummaryEnabled ? (0, i18n_1.t)('compactSummary.on') : (0, i18n_1.t)('compactSummary.off'),
|
|
1253
1402
|
}),
|
|
1403
|
+
selfReviewLine: (0, i18n_1.t)('compactOnIdle.selfReviewLine', {
|
|
1404
|
+
state: picker.isSelfReviewEnabled ? (0, i18n_1.t)('compactSelfReview.on') : (0, i18n_1.t)('compactSelfReview.off'),
|
|
1405
|
+
}),
|
|
1254
1406
|
};
|
|
1255
1407
|
const title = isGeneral ? (0, i18n_1.t)('compactOnIdle.titleGeneral', vars) : (0, i18n_1.t)('compactOnIdle.title', vars);
|
|
1256
1408
|
await replyToThread(key, title, buildCompactOnIdleKeyboard(picker));
|
|
@@ -1281,6 +1433,31 @@ function createCompaction(ports) {
|
|
|
1281
1433
|
: (0, i18n_1.t)('compactSummary.title', { state: stateWord });
|
|
1282
1434
|
await replyToThread(key, title, buildCompactSummaryKeyboard(isEnabled));
|
|
1283
1435
|
});
|
|
1436
|
+
// `/compact_self_review` — toggle the self-review section of a compaction summary: whether the agent is asked for it
|
|
1437
|
+
// (every kind of compaction, the CLI's and OpenCode's own included) and whether the bot posts it. Regular topic →
|
|
1438
|
+
// per-thread override; General → the instance-wide default. ON by default. Bare → an Enable/Disable picker (✓ on
|
|
1439
|
+
// current). Like `/compact_summary` it is read when a compaction runs, so it is not gated on an active session; only a
|
|
1440
|
+
// raw shell, with no context to compact, is refused.
|
|
1441
|
+
command('compact_self_review', async (_ctx, key, parsed) => {
|
|
1442
|
+
const arg = parsed.args.join(' ').toLowerCase();
|
|
1443
|
+
const isGeneral = checkIsGeneral(key);
|
|
1444
|
+
if (!isGeneral && getThreadCompactRoute(key) === 'notSupported') {
|
|
1445
|
+
await replyToThread(key, (0, i18n_1.t)('compactSelfReview.unsupported'));
|
|
1446
|
+
return;
|
|
1447
|
+
}
|
|
1448
|
+
if (arg === 'on' || arg === 'off') {
|
|
1449
|
+
await replyToThread(key, await applyCompactSelfReview(key, isGeneral, arg === 'on'));
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
const isEnabled = isGeneral
|
|
1453
|
+
? getState().getCompactSelfReviewGlobalDefault()
|
|
1454
|
+
: getState().checkIsCompactSelfReviewEnabled(key);
|
|
1455
|
+
const stateWord = isEnabled ? (0, i18n_1.t)('compactSelfReview.on') : (0, i18n_1.t)('compactSelfReview.off');
|
|
1456
|
+
const title = isGeneral
|
|
1457
|
+
? (0, i18n_1.t)('compactSelfReview.titleGeneral', { state: stateWord })
|
|
1458
|
+
: (0, i18n_1.t)('compactSelfReview.title', { state: stateWord });
|
|
1459
|
+
await replyToThread(key, title, buildCompactSelfReviewKeyboard(isEnabled));
|
|
1460
|
+
});
|
|
1284
1461
|
}
|
|
1285
1462
|
function registerCompactionCallbacks() {
|
|
1286
1463
|
bot.action('coi_on', (ctx) => handleCompactOnIdleCallback(ctx, (key, isGeneral) => applyCompactOnIdle(key, isGeneral, true)));
|
|
@@ -1291,8 +1468,16 @@ function createCompaction(ports) {
|
|
|
1291
1468
|
bot.action('coi_sum_off', (ctx) => handleCompactOnIdleCallback(ctx, async (key, isGeneral) => {
|
|
1292
1469
|
await replyToThread(key, await applyCompactSummary(key, isGeneral, false));
|
|
1293
1470
|
}));
|
|
1471
|
+
bot.action('coi_sr_on', (ctx) => handleCompactOnIdleCallback(ctx, async (key, isGeneral) => {
|
|
1472
|
+
await replyToThread(key, await applyCompactSelfReview(key, isGeneral, true));
|
|
1473
|
+
}));
|
|
1474
|
+
bot.action('coi_sr_off', (ctx) => handleCompactOnIdleCallback(ctx, async (key, isGeneral) => {
|
|
1475
|
+
await replyToThread(key, await applyCompactSelfReview(key, isGeneral, false));
|
|
1476
|
+
}));
|
|
1294
1477
|
bot.action('csum_on', (ctx) => handleCompactSummaryCallback(ctx, true));
|
|
1295
1478
|
bot.action('csum_off', (ctx) => handleCompactSummaryCallback(ctx, false));
|
|
1479
|
+
bot.action('csr_on', (ctx) => handleCompactSelfReviewCallback(ctx, true));
|
|
1480
|
+
bot.action('csr_off', (ctx) => handleCompactSelfReviewCallback(ctx, false));
|
|
1296
1481
|
bot.action(/^reask_(\d+)$/, (ctx) => handleReAskedQuestionTap(ctx, parseInt(ctx.match[1], 10)));
|
|
1297
1482
|
}
|
|
1298
1483
|
return {
|
|
@@ -1300,6 +1485,10 @@ function createCompaction(ports) {
|
|
|
1300
1485
|
noteThreadActivity,
|
|
1301
1486
|
noteThreadUserActivity,
|
|
1302
1487
|
markThreadTurnProducedOutput,
|
|
1488
|
+
postOwnCompactionInstructionGaps,
|
|
1489
|
+
syncThreadCompactSelfReviewFlags,
|
|
1490
|
+
syncAllCompactSelfReviewFlags,
|
|
1491
|
+
routeStreamedCompactionSummaryTail,
|
|
1303
1492
|
clearThreadCompaction,
|
|
1304
1493
|
rearmThreadIdleTimer,
|
|
1305
1494
|
armDeferredCompaction,
|