charness 4.2.0 → 4.3.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 +157 -2
- package/DEVELOPMENT.md +58 -10
- package/LICENSE +331 -151
- package/MIGRATION_3_TO_4.md +8 -5
- package/README.md +21 -9
- package/SETUP.md +54 -10
- package/agent-plugin/README.md +10 -3
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +18 -27
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +5 -3
- package/agent-plugin/skills/charness-orchestration/SKILL.md +56 -16
- package/dist/adapters/claudeCliAdapter.d.ts +4 -0
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +13 -0
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.d.ts +136 -10
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +365 -77
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/createAdapter.d.ts +12 -3
- package/dist/adapters/createAdapter.d.ts.map +1 -1
- package/dist/adapters/createAdapter.js +39 -13
- package/dist/adapters/createAdapter.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +34 -0
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +118 -11
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/apiErrorRetry.d.ts +11 -3
- package/dist/apiErrorRetry.d.ts.map +1 -1
- package/dist/apiErrorRetry.js +33 -3
- package/dist/apiErrorRetry.js.map +1 -1
- package/dist/apiRetryKick.d.ts +3 -2
- package/dist/apiRetryKick.d.ts.map +1 -1
- package/dist/apiRetryKick.js +13 -5
- package/dist/apiRetryKick.js.map +1 -1
- package/dist/bot.d.ts +2 -6
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +2009 -634
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +28 -6
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +89 -22
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/connectors/jira/answerSink.d.ts +102 -7
- package/dist/connectors/jira/answerSink.d.ts.map +1 -1
- package/dist/connectors/jira/answerSink.js +364 -60
- package/dist/connectors/jira/answerSink.js.map +1 -1
- package/dist/connectors/jira/answerThreads.d.ts +44 -0
- package/dist/connectors/jira/answerThreads.d.ts.map +1 -0
- package/dist/connectors/jira/answerThreads.js +85 -0
- package/dist/connectors/jira/answerThreads.js.map +1 -0
- package/dist/connectors/jira/client.d.ts +67 -2
- package/dist/connectors/jira/client.d.ts.map +1 -1
- package/dist/connectors/jira/client.js +176 -4
- package/dist/connectors/jira/client.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +6 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +14 -1
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +19 -0
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +68 -6
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/contextPreamble.d.ts.map +1 -1
- package/dist/connectors/jira/contextPreamble.js +6 -1
- package/dist/connectors/jira/contextPreamble.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts +21 -6
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +22 -16
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +8 -1
- package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
- package/dist/connectors/jira/issueBlocks.js +38 -2
- package/dist/connectors/jira/issueBlocks.js.map +1 -1
- package/dist/connectors/jira/operatorIssue.d.ts +28 -0
- package/dist/connectors/jira/operatorIssue.d.ts.map +1 -0
- package/dist/connectors/jira/operatorIssue.js +81 -0
- package/dist/connectors/jira/operatorIssue.js.map +1 -0
- package/dist/connectors/jira/outbound.d.ts +8 -4
- package/dist/connectors/jira/outbound.d.ts.map +1 -1
- package/dist/connectors/jira/outbound.js +16 -8
- package/dist/connectors/jira/outbound.js.map +1 -1
- package/dist/connectors/jira/outgoingFileCheck.d.ts +37 -0
- package/dist/connectors/jira/outgoingFileCheck.d.ts.map +1 -0
- package/dist/connectors/jira/outgoingFileCheck.js +279 -0
- package/dist/connectors/jira/outgoingFileCheck.js.map +1 -0
- package/dist/connectors/jira/outgoingFiles.d.ts +81 -0
- package/dist/connectors/jira/outgoingFiles.d.ts.map +1 -0
- package/dist/connectors/jira/outgoingFiles.js +268 -0
- package/dist/connectors/jira/outgoingFiles.js.map +1 -0
- package/dist/connectors/jira/progressComments.d.ts +69 -0
- package/dist/connectors/jira/progressComments.d.ts.map +1 -0
- package/dist/connectors/jira/progressComments.js +136 -0
- package/dist/connectors/jira/progressComments.js.map +1 -0
- package/dist/connectors/jira/prompt.d.ts +5 -1
- package/dist/connectors/jira/prompt.d.ts.map +1 -1
- package/dist/connectors/jira/prompt.js +23 -3
- package/dist/connectors/jira/prompt.js.map +1 -1
- package/dist/connectors/jira/promptSpill.js +1 -1
- package/dist/connectors/jira/promptSpill.js.map +1 -1
- package/dist/connectors/jira/trigger.d.ts +13 -5
- package/dist/connectors/jira/trigger.d.ts.map +1 -1
- package/dist/connectors/jira/trigger.js +13 -7
- package/dist/connectors/jira/trigger.js.map +1 -1
- package/dist/connectors/jira/uploadedFiles.d.ts +48 -0
- package/dist/connectors/jira/uploadedFiles.d.ts.map +1 -0
- package/dist/connectors/jira/uploadedFiles.js +123 -0
- package/dist/connectors/jira/uploadedFiles.js.map +1 -0
- package/dist/connectors/telegram/commands/backendSwitch.d.ts +9 -1
- package/dist/connectors/telegram/commands/backendSwitch.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/backendSwitch.js +17 -8
- package/dist/connectors/telegram/commands/backendSwitch.js.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.d.ts +2 -0
- package/dist/connectors/telegram/commands/botSkills.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.js +17 -2
- package/dist/connectors/telegram/commands/botSkills.js.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -0
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +22 -4
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +14 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +261 -96
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/limitReminders.d.ts +21 -0
- package/dist/connectors/telegram/commands/limitReminders.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/limitReminders.js +95 -0
- package/dist/connectors/telegram/commands/limitReminders.js.map +1 -0
- package/dist/connectors/telegram/commands/limitsBoard.d.ts +4 -0
- package/dist/connectors/telegram/commands/limitsBoard.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/limitsBoard.js +27 -6
- package/dist/connectors/telegram/commands/limitsBoard.js.map +1 -1
- package/dist/connectors/telegram/commands/modelProviders.d.ts +2 -2
- package/dist/connectors/telegram/commands/modelProviders.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/modelProviders.js +27 -16
- package/dist/connectors/telegram/commands/modelProviders.js.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.js +7 -2
- package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
- package/dist/connectors/telegram/commands/workerRoles.d.ts +25 -0
- package/dist/connectors/telegram/commands/workerRoles.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/workerRoles.js +259 -0
- package/dist/connectors/telegram/commands/workerRoles.js.map +1 -0
- package/dist/connectors/telegram/groupWelcome.d.ts +12 -0
- package/dist/connectors/telegram/groupWelcome.d.ts.map +1 -0
- package/dist/connectors/telegram/groupWelcome.js +12 -0
- package/dist/connectors/telegram/groupWelcome.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +7 -0
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +10 -0
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/connectors/telegram/outputFlushPlan.d.ts +12 -0
- package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
- package/dist/connectors/telegram/outputFlushPlan.js +12 -0
- package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +1 -1
- package/dist/connectors/telegram/topicIndicator.d.ts +1 -1
- package/dist/connectors/telegram/topicIndicator.d.ts.map +1 -1
- package/dist/connectors/telegram/topicIndicator.js +103 -5
- package/dist/connectors/telegram/topicIndicator.js.map +1 -1
- package/dist/effortLevels.d.ts +6 -0
- package/dist/effortLevels.d.ts.map +1 -1
- package/dist/effortLevels.js +6 -1
- package/dist/effortLevels.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +95 -14
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +95 -14
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +95 -14
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +95 -14
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +95 -14
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +95 -14
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +95 -14
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +95 -14
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +95 -14
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +95 -14
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +95 -14
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +95 -14
- package/dist/i18n/zh.js.map +1 -1
- package/dist/instanceSettings.d.ts +24 -2
- package/dist/instanceSettings.d.ts.map +1 -1
- package/dist/instanceSettings.js +75 -3
- package/dist/instanceSettings.js.map +1 -1
- package/dist/limitNotes/engine.d.ts +47 -0
- package/dist/limitNotes/engine.d.ts.map +1 -0
- package/dist/limitNotes/engine.js +98 -0
- package/dist/limitNotes/engine.js.map +1 -0
- package/dist/limitNotes/noteText.d.ts +33 -0
- package/dist/limitNotes/noteText.d.ts.map +1 -0
- package/dist/limitNotes/noteText.js +55 -0
- package/dist/limitNotes/noteText.js.map +1 -0
- package/dist/limitNotes/plan.d.ts +147 -0
- package/dist/limitNotes/plan.d.ts.map +1 -0
- package/dist/limitNotes/plan.js +323 -0
- package/dist/limitNotes/plan.js.map +1 -0
- package/dist/limitNotes/reminderChoices.d.ts +30 -0
- package/dist/limitNotes/reminderChoices.d.ts.map +1 -0
- package/dist/limitNotes/reminderChoices.js +48 -0
- package/dist/limitNotes/reminderChoices.js.map +1 -0
- package/dist/limitNotes/service.d.ts +106 -0
- package/dist/limitNotes/service.d.ts.map +1 -0
- package/dist/limitNotes/service.js +169 -0
- package/dist/limitNotes/service.js.map +1 -0
- package/dist/openCodeSessionTitle.js +1 -1
- package/dist/openCodeSessionTitle.js.map +1 -1
- package/dist/outputTrace.d.ts +19 -0
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +23 -2
- package/dist/outputTrace.js.map +1 -1
- package/dist/platform/answerSink.d.ts +23 -0
- package/dist/platform/answerSink.d.ts.map +1 -1
- package/dist/platform/answerSink.js.map +1 -1
- package/dist/platform/operatorAlert.d.ts +24 -0
- package/dist/platform/operatorAlert.d.ts.map +1 -0
- package/dist/platform/operatorAlert.js +9 -0
- package/dist/platform/operatorAlert.js.map +1 -0
- package/dist/postToSession.d.ts +34 -2
- package/dist/postToSession.d.ts.map +1 -1
- package/dist/postToSession.js +31 -2
- package/dist/postToSession.js.map +1 -1
- package/dist/remoteRun/exitCodes.d.ts +2 -2
- package/dist/remoteRun/exitCodes.d.ts.map +1 -1
- package/dist/remoteRun/exitCodes.js +2 -2
- package/dist/remoteRun/exitCodes.js.map +1 -1
- package/dist/remoteRun/foreground.d.ts.map +1 -1
- package/dist/remoteRun/foreground.js +5 -1
- package/dist/remoteRun/foreground.js.map +1 -1
- package/dist/remoteRun/runnerClient.d.ts +1 -1
- package/dist/remoteRun/runnerClient.d.ts.map +1 -1
- package/dist/remoteRun/runnerClient.js +3 -3
- package/dist/remoteRun/runnerClient.js.map +1 -1
- package/dist/requests/answerRequest.d.ts +3 -0
- package/dist/requests/answerRequest.d.ts.map +1 -1
- package/dist/requests/answerRequest.js +9 -2
- package/dist/requests/answerRequest.js.map +1 -1
- package/dist/requests/limitWaitAnswer.d.ts +14 -0
- package/dist/requests/limitWaitAnswer.d.ts.map +1 -1
- package/dist/requests/limitWaitAnswer.js +26 -4
- package/dist/requests/limitWaitAnswer.js.map +1 -1
- package/dist/requests/requestHeader.d.ts +37 -5
- package/dist/requests/requestHeader.d.ts.map +1 -1
- package/dist/requests/requestHeader.js +46 -17
- package/dist/requests/requestHeader.js.map +1 -1
- package/dist/requests/scheduleWait.d.ts +79 -0
- package/dist/requests/scheduleWait.d.ts.map +1 -0
- package/dist/requests/scheduleWait.js +101 -0
- package/dist/requests/scheduleWait.js.map +1 -0
- package/dist/requests/sessionTurnProbe.d.ts +21 -3
- package/dist/requests/sessionTurnProbe.d.ts.map +1 -1
- package/dist/requests/sessionTurnProbe.js +18 -3
- package/dist/requests/sessionTurnProbe.js.map +1 -1
- package/dist/requests/topicRequestSettle.d.ts +13 -7
- package/dist/requests/topicRequestSettle.d.ts.map +1 -1
- package/dist/requests/topicRequestSettle.js +2 -2
- package/dist/requests/topicRequestSettle.js.map +1 -1
- package/dist/requests/trackerTurnPoster.d.ts +30 -0
- package/dist/requests/trackerTurnPoster.d.ts.map +1 -0
- package/dist/requests/trackerTurnPoster.js +36 -0
- package/dist/requests/trackerTurnPoster.js.map +1 -0
- package/dist/requests/types.d.ts +9 -2
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.d.ts +188 -11
- package/dist/requests/wakeUpEngine.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.js +452 -43
- package/dist/requests/wakeUpEngine.js.map +1 -1
- package/dist/requests/wakeUpRules.d.ts +122 -12
- package/dist/requests/wakeUpRules.d.ts.map +1 -1
- package/dist/requests/wakeUpRules.js +117 -15
- package/dist/requests/wakeUpRules.js.map +1 -1
- package/dist/resumeContext.d.ts +2 -2
- package/dist/resumeContext.js +3 -3
- package/dist/resumeContext.js.map +1 -1
- package/dist/runnerUtility/adminService.js +1 -1
- package/dist/runnerUtility/adminService.js.map +1 -1
- package/dist/runnerUtility/guiAgent.d.ts +1 -1
- package/dist/runnerUtility/guiAgent.d.ts.map +1 -1
- package/dist/runnerUtility/guiAgent.js +1 -1
- package/dist/runnerUtility/guiAgent.js.map +1 -1
- package/dist/runnerUtility/managedNode.d.ts +3 -3
- package/dist/runnerUtility/managedNode.d.ts.map +1 -1
- package/dist/runnerUtility/managedNode.js +2 -2
- package/dist/runnerUtility/managedNode.js.map +1 -1
- package/dist/runnerUtility/runnerConfig.d.ts +1 -1
- package/dist/runnerUtility/runnerHome.d.ts +1 -1
- package/dist/runnerUtility/runnerHome.js +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
- package/dist/runnerUtility/serviceCommon.js +1 -1
- package/dist/runnerUtility/serviceCommon.js.map +1 -1
- package/dist/runners/bootstrapLine.js +1 -1
- package/dist/runners/hubPackage.d.ts +1 -1
- package/dist/runners/hubPackage.js +3 -3
- package/dist/runners/hubPackage.js.map +1 -1
- package/dist/runners/hubPaths.d.ts +1 -1
- package/dist/runners/hubPaths.d.ts.map +1 -1
- package/dist/runners/runnerLock.d.ts +2 -2
- package/dist/runners/runnerLock.d.ts.map +1 -1
- package/dist/runners/runnerLock.js +2 -2
- package/dist/runners/runnerLock.js.map +1 -1
- package/dist/scheduler/checkRun.d.ts +2 -0
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +5 -1
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +57 -0
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +152 -14
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/injection.d.ts +6 -0
- package/dist/scheduler/injection.d.ts.map +1 -1
- package/dist/scheduler/injection.js +10 -0
- package/dist/scheduler/injection.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +38 -3
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +291 -175
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/rebindResume.d.ts +24 -0
- package/dist/scheduler/rebindResume.d.ts.map +1 -1
- package/dist/scheduler/rebindResume.js +32 -0
- package/dist/scheduler/rebindResume.js.map +1 -1
- package/dist/scheduler/scheduleToolWording.d.ts +29 -0
- package/dist/scheduler/scheduleToolWording.d.ts.map +1 -0
- package/dist/scheduler/scheduleToolWording.js +117 -0
- package/dist/scheduler/scheduleToolWording.js.map +1 -0
- package/dist/scheduler/scheduledRunTarget.d.ts +90 -0
- package/dist/scheduler/scheduledRunTarget.d.ts.map +1 -0
- package/dist/scheduler/scheduledRunTarget.js +92 -0
- package/dist/scheduler/scheduledRunTarget.js.map +1 -0
- package/dist/scheduler/store.d.ts +2 -0
- package/dist/scheduler/store.d.ts.map +1 -1
- package/dist/scheduler/store.js +2 -0
- package/dist/scheduler/store.js.map +1 -1
- package/dist/scheduler/types.d.ts +10 -0
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +2 -0
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +3 -3
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/selfUpdate/constants.d.ts +2 -0
- package/dist/selfUpdate/constants.d.ts.map +1 -1
- package/dist/selfUpdate/constants.js +3 -1
- package/dist/selfUpdate/constants.js.map +1 -1
- package/dist/selfUpdate/emittedSource.d.ts.map +1 -1
- package/dist/selfUpdate/emittedSource.js +1 -1
- package/dist/selfUpdate/emittedSource.js.map +1 -1
- package/dist/selfUpdate/updateRuntime.js +1 -1
- package/dist/selfUpdate/updateRuntime.js.map +1 -1
- package/dist/sessionPick.d.ts +1 -1
- package/dist/sessionPick.js +1 -1
- package/dist/startupPromptBuffer.d.ts +35 -6
- package/dist/startupPromptBuffer.d.ts.map +1 -1
- package/dist/startupPromptBuffer.js +70 -21
- package/dist/startupPromptBuffer.js.map +1 -1
- package/dist/state.d.ts +173 -25
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +282 -58
- package/dist/state.js.map +1 -1
- package/dist/testTimings.d.ts +8 -3
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +15 -2
- package/dist/testTimings.js.map +1 -1
- package/dist/threadContextPreamble.d.ts +7 -0
- package/dist/threadContextPreamble.d.ts.map +1 -1
- package/dist/threadContextPreamble.js +11 -0
- package/dist/threadContextPreamble.js.map +1 -1
- package/dist/threadRouting.d.ts +12 -0
- package/dist/threadRouting.d.ts.map +1 -1
- package/dist/threadRouting.js +15 -0
- package/dist/threadRouting.js.map +1 -1
- package/dist/todos/midTurn.d.ts +15 -41
- package/dist/todos/midTurn.d.ts.map +1 -1
- package/dist/todos/midTurn.js +27 -171
- package/dist/todos/midTurn.js.map +1 -1
- package/dist/types.d.ts +147 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/backendSwitchPlan.d.ts +3 -3
- package/dist/utils/backendSwitchPlan.js +3 -3
- package/dist/utils/claudeAccountAlert.d.ts +104 -0
- package/dist/utils/claudeAccountAlert.d.ts.map +1 -0
- package/dist/utils/claudeAccountAlert.js +130 -0
- package/dist/utils/claudeAccountAlert.js.map +1 -0
- package/dist/utils/claudeAccountPickerPlan.d.ts +7 -0
- package/dist/utils/claudeAccountPickerPlan.d.ts.map +1 -1
- package/dist/utils/claudeAccountPickerPlan.js +13 -2
- package/dist/utils/claudeAccountPickerPlan.js.map +1 -1
- package/dist/utils/claudeAuthRefusal.d.ts +122 -0
- package/dist/utils/claudeAuthRefusal.d.ts.map +1 -0
- package/dist/utils/claudeAuthRefusal.js +228 -0
- package/dist/utils/claudeAuthRefusal.js.map +1 -0
- package/dist/utils/claudeCompactHook.d.ts +6 -6
- package/dist/utils/claudeCompactHook.js +8 -8
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeProfileUsageViews.d.ts +54 -2
- package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -1
- package/dist/utils/claudeProfileUsageViews.js +44 -1
- package/dist/utils/claudeProfileUsageViews.js.map +1 -1
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +10 -1
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeRuntimeInfo.d.ts +24 -0
- package/dist/utils/claudeRuntimeInfo.d.ts.map +1 -1
- package/dist/utils/claudeRuntimeInfo.js +128 -3
- package/dist/utils/claudeRuntimeInfo.js.map +1 -1
- package/dist/utils/claudeScheduledJobs.d.ts +6 -2
- package/dist/utils/claudeScheduledJobs.d.ts.map +1 -1
- package/dist/utils/claudeScheduledJobs.js +10 -2
- package/dist/utils/claudeScheduledJobs.js.map +1 -1
- package/dist/utils/claudeSessionTitle.js +1 -1
- package/dist/utils/claudeSessionTitle.js.map +1 -1
- package/dist/utils/claudeStreamJson.d.ts +28 -2
- package/dist/utils/claudeStreamJson.d.ts.map +1 -1
- package/dist/utils/claudeStreamJson.js +33 -3
- package/dist/utils/claudeStreamJson.js.map +1 -1
- package/dist/utils/claudeTranscriptEpoch.d.ts +14 -0
- package/dist/utils/claudeTranscriptEpoch.d.ts.map +1 -1
- package/dist/utils/claudeTranscriptEpoch.js +79 -19
- package/dist/utils/claudeTranscriptEpoch.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +103 -7
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +108 -15
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/compactOnIdle.d.ts +139 -29
- package/dist/utils/compactOnIdle.d.ts.map +1 -1
- package/dist/utils/compactOnIdle.js +163 -36
- package/dist/utils/compactOnIdle.js.map +1 -1
- package/dist/utils/conversationEnding.d.ts +76 -0
- package/dist/utils/conversationEnding.d.ts.map +1 -0
- package/dist/utils/conversationEnding.js +117 -0
- package/dist/utils/conversationEnding.js.map +1 -0
- package/dist/utils/doctorLine.d.ts +10 -0
- package/dist/utils/doctorLine.d.ts.map +1 -1
- package/dist/utils/doctorLine.js +16 -0
- package/dist/utils/doctorLine.js.map +1 -1
- package/dist/utils/fallbackBridge.d.ts.map +1 -1
- package/dist/utils/fallbackBridge.js +2 -1
- package/dist/utils/fallbackBridge.js.map +1 -1
- package/dist/utils/fallbackChain.d.ts +2 -0
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +4 -3
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/fallbackSwitchNotice.d.ts +11 -4
- package/dist/utils/fallbackSwitchNotice.d.ts.map +1 -1
- package/dist/utils/fallbackSwitchNotice.js +9 -5
- package/dist/utils/fallbackSwitchNotice.js.map +1 -1
- package/dist/utils/fileSendService.d.ts +31 -0
- package/dist/utils/fileSendService.d.ts.map +1 -1
- package/dist/utils/fileSendService.js +45 -2
- package/dist/utils/fileSendService.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +2 -0
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +4 -1
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/jsonStreamPendingWork.d.ts +14 -2
- package/dist/utils/jsonStreamPendingWork.d.ts.map +1 -1
- package/dist/utils/jsonStreamPendingWork.js +25 -5
- package/dist/utils/jsonStreamPendingWork.js.map +1 -1
- package/dist/utils/jsonStreamUnconsumedInput.d.ts +80 -0
- package/dist/utils/jsonStreamUnconsumedInput.d.ts.map +1 -0
- package/dist/utils/jsonStreamUnconsumedInput.js +99 -0
- package/dist/utils/jsonStreamUnconsumedInput.js.map +1 -0
- package/dist/utils/limitEpisodeRecovery.d.ts +43 -4
- package/dist/utils/limitEpisodeRecovery.d.ts.map +1 -1
- package/dist/utils/limitEpisodeRecovery.js +107 -20
- package/dist/utils/limitEpisodeRecovery.js.map +1 -1
- package/dist/utils/limitHeldPrompts.d.ts +21 -11
- package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
- package/dist/utils/limitHeldPrompts.js +12 -9
- package/dist/utils/limitHeldPrompts.js.map +1 -1
- package/dist/utils/limitRemindersScreenPlan.d.ts +63 -0
- package/dist/utils/limitRemindersScreenPlan.d.ts.map +1 -0
- package/dist/utils/limitRemindersScreenPlan.js +121 -0
- package/dist/utils/limitRemindersScreenPlan.js.map +1 -0
- package/dist/utils/limitsBoardPlan.d.ts +16 -7
- package/dist/utils/limitsBoardPlan.d.ts.map +1 -1
- package/dist/utils/limitsBoardPlan.js +41 -9
- package/dist/utils/limitsBoardPlan.js.map +1 -1
- package/dist/utils/lostWork.d.ts +16 -2
- package/dist/utils/lostWork.d.ts.map +1 -1
- package/dist/utils/lostWork.js +16 -3
- package/dist/utils/lostWork.js.map +1 -1
- package/dist/utils/messageContext.d.ts +2 -2
- package/dist/utils/messageContext.js +2 -2
- package/dist/utils/midTurnInbox.d.ts +79 -0
- package/dist/utils/midTurnInbox.d.ts.map +1 -0
- package/dist/utils/midTurnInbox.js +265 -0
- package/dist/utils/midTurnInbox.js.map +1 -0
- package/dist/utils/promptDelivery.d.ts +70 -22
- package/dist/utils/promptDelivery.d.ts.map +1 -1
- package/dist/utils/promptDelivery.js +100 -42
- package/dist/utils/promptDelivery.js.map +1 -1
- package/dist/utils/topicIndicatorPlan.d.ts +13 -3
- package/dist/utils/topicIndicatorPlan.d.ts.map +1 -1
- package/dist/utils/topicIndicatorPlan.js +26 -4
- package/dist/utils/topicIndicatorPlan.js.map +1 -1
- package/dist/utils/topicRequest.d.ts +3 -0
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +4 -0
- package/dist/utils/topicRequest.js.map +1 -1
- package/dist/utils/workerRoles.d.ts +122 -0
- package/dist/utils/workerRoles.d.ts.map +1 -0
- package/dist/utils/workerRoles.js +160 -0
- package/dist/utils/workerRoles.js.map +1 -0
- package/dist/utils/workerRolesScreenPlan.d.ts +118 -0
- package/dist/utils/workerRolesScreenPlan.d.ts.map +1 -0
- package/dist/utils/workerRolesScreenPlan.js +232 -0
- package/dist/utils/workerRolesScreenPlan.js.map +1 -0
- package/dist/utils/workingSignals.d.ts +49 -0
- package/dist/utils/workingSignals.d.ts.map +1 -0
- package/dist/utils/workingSignals.js +41 -0
- package/dist/utils/workingSignals.js.map +1 -0
- package/licensing.json +88 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +7 -7
- package/{remoteRun → runner-scripts}/runner.sh +6 -3
- package/LICENSE-COMMERCIAL.md +0 -142
- package/dist/agentTrigger.d.ts +0 -28
- package/dist/agentTrigger.d.ts.map +0 -1
- package/dist/agentTrigger.js +0 -53
- package/dist/agentTrigger.js.map +0 -1
- /package/{remoteRun → runner-scripts}/ensureNode.sh +0 -0
- /package/{remoteRun → runner-scripts}/runner-package-lock.json +0 -0
package/dist/state.js
CHANGED
|
@@ -57,6 +57,7 @@ const autoContinueOnLimit_1 = require("./utils/autoContinueOnLimit");
|
|
|
57
57
|
const claudeProfiles_1 = require("./utils/claudeProfiles");
|
|
58
58
|
const modelRecentPlan_1 = require("./utils/modelRecentPlan");
|
|
59
59
|
const questionWaitChoices_1 = require("./utils/questionWaitChoices");
|
|
60
|
+
const reminderChoices_1 = require("./limitNotes/reminderChoices");
|
|
60
61
|
const topicIndicatorPlan_1 = require("./utils/topicIndicatorPlan");
|
|
61
62
|
const fallbackChain_1 = require("./utils/fallbackChain");
|
|
62
63
|
const requestGroup_1 = require("./requests/requestGroup");
|
|
@@ -110,6 +111,24 @@ function emptyState() {
|
|
|
110
111
|
const MESSAGE_ID_RING_CAP = 500;
|
|
111
112
|
/** Byte length of the lazily-minted scheduler MCP HMAC secret (32 bytes → 64 hex chars). */
|
|
112
113
|
const schedulerMcpSecretByteLength = 32;
|
|
114
|
+
/** A stored time (epoch ms) when it is a finite number; a hand-edited file may hold anything. */
|
|
115
|
+
function getValidStoredStamp(value) {
|
|
116
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
117
|
+
}
|
|
118
|
+
/** `record` with only its valid fields; `undefined` when none is left (a hand-edited file may hold anything). */
|
|
119
|
+
function getValidLimitNoteRecord(record) {
|
|
120
|
+
const lastNoteAt = getValidStoredStamp(record.lastNoteAt);
|
|
121
|
+
const lastOrchestratedAt = getValidStoredStamp(record.lastOrchestratedAt);
|
|
122
|
+
const lastProfilesCallAt = getValidStoredStamp(record.lastProfilesCallAt);
|
|
123
|
+
const fingerprint = typeof record.fingerprint === 'string' && record.fingerprint !== '' ? record.fingerprint : undefined;
|
|
124
|
+
const clean = {
|
|
125
|
+
...(lastNoteAt === undefined ? {} : { lastNoteAt }),
|
|
126
|
+
...(fingerprint === undefined ? {} : { fingerprint }),
|
|
127
|
+
...(lastOrchestratedAt === undefined ? {} : { lastOrchestratedAt }),
|
|
128
|
+
...(lastProfilesCallAt === undefined ? {} : { lastProfilesCallAt }),
|
|
129
|
+
};
|
|
130
|
+
return Object.keys(clean).length === 0 ? undefined : clean;
|
|
131
|
+
}
|
|
113
132
|
/**
|
|
114
133
|
* @description Promise-chain per-key lock. The map holds the tail of each
|
|
115
134
|
* key's queue; new callers attach to the tail and append themselves. Errors
|
|
@@ -374,6 +393,8 @@ class StateStore {
|
|
|
374
393
|
this.state.bindings ??= {};
|
|
375
394
|
this.state.agents ??= {};
|
|
376
395
|
this.state.messages ??= {};
|
|
396
|
+
// The idle-compaction user-latch is retired: drop its dead key from an older file.
|
|
397
|
+
delete this.state.compactIdleLatchedThreads;
|
|
377
398
|
}
|
|
378
399
|
else if (loaded.reason === 'missing') {
|
|
379
400
|
this.state = emptyState();
|
|
@@ -579,9 +600,11 @@ class StateStore {
|
|
|
579
600
|
delete this.state.agents[k];
|
|
580
601
|
delete this.state.messages[k];
|
|
581
602
|
// The thread is gone (unbind / deleted topic) → so is anything a boot
|
|
582
|
-
// recovery could resume for it,
|
|
603
|
+
// recovery could resume for it, the record of its pinned answer and what
|
|
604
|
+
// the accounts notes remembered of it.
|
|
583
605
|
this.dropLimitEpisodeRecovered(k);
|
|
584
606
|
this.dropOptionalMapEntry('answerPins', k);
|
|
607
|
+
this.dropOptionalMapEntry('limitNotes', k);
|
|
585
608
|
this.scheduleSave();
|
|
586
609
|
});
|
|
587
610
|
}
|
|
@@ -1345,37 +1368,39 @@ class StateStore {
|
|
|
1345
1368
|
this.scheduleSave();
|
|
1346
1369
|
});
|
|
1347
1370
|
}
|
|
1371
|
+
// ── idle-compaction growth threshold (`/compact_on_idle`) ──
|
|
1348
1372
|
/**
|
|
1349
|
-
* @description
|
|
1350
|
-
*
|
|
1351
|
-
* message has re-armed it since. Read by the idle watchdog's fire guard and by
|
|
1352
|
-
* the timer-arming path (a latched thread never re-arms — so a restart can't
|
|
1353
|
-
* re-fire). Default `false` (never latched).
|
|
1373
|
+
* @description The instance-wide growth threshold (driven from the General topic), in context tokens:
|
|
1374
|
+
* {@link defaultCompactGrowthTokens} when General never set one.
|
|
1354
1375
|
*/
|
|
1355
|
-
|
|
1356
|
-
return this.state.
|
|
1376
|
+
getCompactGrowthGlobalDefault() {
|
|
1377
|
+
return this.state.compactGrowthTokens ?? compactOnIdle_1.defaultCompactGrowthTokens;
|
|
1357
1378
|
}
|
|
1358
|
-
/**
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
if (
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
current.delete(keyStr);
|
|
1372
|
-
const uniqueKeys = [...current].sort();
|
|
1373
|
-
if (uniqueKeys.length > 0)
|
|
1374
|
-
this.state.compactIdleLatchedThreads = uniqueKeys;
|
|
1375
|
-
else
|
|
1376
|
-
delete this.state.compactIdleLatchedThreads;
|
|
1379
|
+
/** @description The topic's own growth threshold, or `undefined` when it follows the instance default. */
|
|
1380
|
+
getCompactGrowthOverride(key) {
|
|
1381
|
+
return this.state.compactGrowthOverrides?.[(0, sessionKey_1.keyToString)(key)];
|
|
1382
|
+
}
|
|
1383
|
+
/** @description The growth threshold in force for `key`: its own value, else the instance default. */
|
|
1384
|
+
getCompactGrowthTokens(key) {
|
|
1385
|
+
return (0, compactOnIdle_1.resolveCompactGrowthTokens)(this.state.compactGrowthTokens, this.getCompactGrowthOverride(key));
|
|
1386
|
+
}
|
|
1387
|
+
/** @description Set the instance-wide growth threshold (from General). Stored explicitly, so a chosen value is durable whatever the default becomes. Debounced. */
|
|
1388
|
+
async setCompactGrowthGlobalDefault(tokens) {
|
|
1389
|
+
if (this.state.compactGrowthTokens === tokens)
|
|
1390
|
+
return;
|
|
1391
|
+
this.state.compactGrowthTokens = tokens;
|
|
1377
1392
|
this.scheduleSave();
|
|
1378
1393
|
}
|
|
1394
|
+
/** @description Set the topic's own growth threshold (from a regular topic); a present value wins over the default. Debounced. */
|
|
1395
|
+
async setCompactGrowthOverride(key, tokens) {
|
|
1396
|
+
const k = (0, sessionKey_1.keyToString)(key);
|
|
1397
|
+
await this.withLock(key, async () => {
|
|
1398
|
+
if (this.state.compactGrowthOverrides?.[k] === tokens)
|
|
1399
|
+
return;
|
|
1400
|
+
(this.state.compactGrowthOverrides ??= {})[k] = tokens;
|
|
1401
|
+
this.scheduleSave();
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1379
1404
|
// ── compact-on-idle per-thread bookkeeping (the countdown's restart guard) ──
|
|
1380
1405
|
/**
|
|
1381
1406
|
* @description `key`'s persisted compact-on-idle instants, with every absent
|
|
@@ -1397,12 +1422,15 @@ class StateStore {
|
|
|
1397
1422
|
const entry = this.state.compactIdleTracking?.[k];
|
|
1398
1423
|
const sessionId = this.getAgentSessionId(k);
|
|
1399
1424
|
if (!entry || !sessionId || entry.sessionId !== sessionId) {
|
|
1400
|
-
return { lastActivityAt: 0, lastTurnEndAt: 0, lastCompactionAt: 0 };
|
|
1425
|
+
return { lastActivityAt: 0, lastTurnEndAt: 0, lastCompactionAt: 0, lastHeldMarkAt: 0, baselineContextTokens: null, lastContextTokens: null };
|
|
1401
1426
|
}
|
|
1402
1427
|
return {
|
|
1403
1428
|
lastActivityAt: entry.lastActivityAt ?? 0,
|
|
1404
1429
|
lastTurnEndAt: entry.lastTurnEndAt ?? 0,
|
|
1405
1430
|
lastCompactionAt: entry.lastCompactionAt ?? 0,
|
|
1431
|
+
lastHeldMarkAt: entry.lastHeldMarkAt ?? 0,
|
|
1432
|
+
baselineContextTokens: entry.baselineContextTokens ?? null,
|
|
1433
|
+
lastContextTokens: entry.lastContextTokens ?? null,
|
|
1406
1434
|
};
|
|
1407
1435
|
}
|
|
1408
1436
|
/**
|
|
@@ -1446,7 +1474,59 @@ class StateStore {
|
|
|
1446
1474
|
// A stamp under a DIFFERENT session starts the entry fresh: the previous
|
|
1447
1475
|
// session's instants describe a context this one no longer has.
|
|
1448
1476
|
const base = existing?.sessionId === sessionId ? existing : {};
|
|
1449
|
-
|
|
1477
|
+
// The context sizes of before the compaction are no longer the conversation's: the next turn that ends starts the baseline over.
|
|
1478
|
+
const { baselineContextTokens: droppedBaseline, lastContextTokens: droppedLast, ...kept } = base;
|
|
1479
|
+
tracking[k] = { ...kept, sessionId, lastCompactionAt: now };
|
|
1480
|
+
this.scheduleSave();
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* @description Record what was read at the end of a turn of `key`: the context size after it (`lastContextTokens`, the growth's
|
|
1485
|
+
* upper end) and, when the conversation had no baseline, the size its epoch's FIRST model call saw (`firstCallContextTokens`, `null`
|
|
1486
|
+
* while it cannot be told). The baseline is then that figure; one that is already there stays, unless a compaction the bot did not
|
|
1487
|
+
* issue replaced the epoch since the last reading (`isNewEpoch`) or the context is now smaller than it — it is replaced or dropped
|
|
1488
|
+
* to be read from the new epoch; a RECHECK (`isBaselineRecheck`, the first call read again beside a baseline) replaces it with a
|
|
1489
|
+
* figure that was read and keeps it when none was ({@link getContextBaselineAfterReading}). Rare — once per turn — so it always
|
|
1490
|
+
* schedules a save: a restart must keep the baseline.
|
|
1491
|
+
*/
|
|
1492
|
+
noteCompactIdleContext(key, reading) {
|
|
1493
|
+
const k = (0, sessionKey_1.keyToString)(key);
|
|
1494
|
+
const sessionId = this.getAgentSessionId(k);
|
|
1495
|
+
if (!sessionId)
|
|
1496
|
+
return; // nothing to bind the figures to — see `getAgentSessionId`
|
|
1497
|
+
const tracking = (this.state.compactIdleTracking ??= {});
|
|
1498
|
+
const existing = tracking[k];
|
|
1499
|
+
const entry = existing?.sessionId === sessionId ? existing : { sessionId };
|
|
1500
|
+
const baseline = (0, compactOnIdle_1.getContextBaselineAfterReading)({
|
|
1501
|
+
baselineContextTokens: entry.baselineContextTokens ?? null,
|
|
1502
|
+
lastContextTokens: reading.lastContextTokens,
|
|
1503
|
+
firstCallContextTokens: reading.firstCallContextTokens,
|
|
1504
|
+
isNewEpoch: reading.isNewEpoch ?? false,
|
|
1505
|
+
isBaselineRecheck: reading.isBaselineRecheck ?? false,
|
|
1506
|
+
});
|
|
1507
|
+
if (baseline === null)
|
|
1508
|
+
delete entry.baselineContextTokens;
|
|
1509
|
+
else
|
|
1510
|
+
entry.baselineContextTokens = baseline;
|
|
1511
|
+
entry.lastContextTokens = reading.lastContextTokens;
|
|
1512
|
+
tracking[k] = entry;
|
|
1513
|
+
this.scheduleSave();
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* @description Stamp that the idle mark of `key` found its process working and forwent the compaction (see
|
|
1517
|
+
* {@link CompactIdleTrackingEntry.lastHeldMarkAt}). Rare — once per held idle period — so it always schedules a save: a
|
|
1518
|
+
* restart right after must still know the mark was spent.
|
|
1519
|
+
*/
|
|
1520
|
+
async setCompactIdleMarkHeldAt(key, now = Date.now()) {
|
|
1521
|
+
const k = (0, sessionKey_1.keyToString)(key);
|
|
1522
|
+
await this.withLock(key, async () => {
|
|
1523
|
+
const sessionId = this.getAgentSessionId(k);
|
|
1524
|
+
if (!sessionId)
|
|
1525
|
+
return; // nothing to bind the marker to — see `getAgentSessionId`
|
|
1526
|
+
const tracking = (this.state.compactIdleTracking ??= {});
|
|
1527
|
+
const existing = tracking[k];
|
|
1528
|
+
const base = existing?.sessionId === sessionId ? existing : {};
|
|
1529
|
+
tracking[k] = { ...base, sessionId, lastHeldMarkAt: now };
|
|
1450
1530
|
this.scheduleSave();
|
|
1451
1531
|
});
|
|
1452
1532
|
}
|
|
@@ -1575,6 +1655,33 @@ class StateStore {
|
|
|
1575
1655
|
dropMap();
|
|
1576
1656
|
this.scheduleSave();
|
|
1577
1657
|
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Set one topic's own choice in an optional `state.json` map of such choices (`field` of `this.state`, keyed by {@link SessionKey}
|
|
1660
|
+
* string), or, with `null`, drop it — the map with its last entry. Under the topic's lock, saved debounced; writing the value
|
|
1661
|
+
* already stored is no write. ONE body for the choice-typed overrides (`/question_wait`, `/limits_reminders`, `/topic_status`),
|
|
1662
|
+
* so they can never drift apart; the boolean toggles keep {@link dropToggleOverride}.
|
|
1663
|
+
*/
|
|
1664
|
+
async setTopicChoiceOverride(field, key, choice, overrides) {
|
|
1665
|
+
const k = (0, sessionKey_1.keyToString)(key);
|
|
1666
|
+
await this.withLock(key, async () => {
|
|
1667
|
+
const map = overrides[field];
|
|
1668
|
+
if (choice === null) {
|
|
1669
|
+
if (!map || !(k in map))
|
|
1670
|
+
return;
|
|
1671
|
+
delete map[k];
|
|
1672
|
+
if (Object.keys(map).length === 0)
|
|
1673
|
+
delete overrides[field];
|
|
1674
|
+
this.scheduleSave();
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
if (map?.[k] === choice)
|
|
1678
|
+
return;
|
|
1679
|
+
const target = map ?? {};
|
|
1680
|
+
target[k] = choice;
|
|
1681
|
+
overrides[field] = target;
|
|
1682
|
+
this.scheduleSave();
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1578
1685
|
// ── «Bot skills» switch (`/bot_skills`) ──
|
|
1579
1686
|
/**
|
|
1580
1687
|
* @description The General value of the switch, or `undefined` while General never chose (then `settings.json` and the
|
|
@@ -1619,22 +1726,54 @@ class StateStore {
|
|
|
1619
1726
|
}
|
|
1620
1727
|
/** @description Set the topic's own question wait (`null` = follow the instance value again; an emptied map is dropped). Debounced. */
|
|
1621
1728
|
async setQuestionWaitOverride(key, choice) {
|
|
1729
|
+
await this.setTopicChoiceOverride('questionWaitOverrides', key, choice, this.state);
|
|
1730
|
+
}
|
|
1731
|
+
// ── The limit reminders (`/limits_reminders`) and the accounts notes (`limitNotes/`) ──
|
|
1732
|
+
/** @description The topic's own limit-reminder interval (`0` = Off), or `undefined` when it follows the instance value (a value no choice names counts as none). */
|
|
1733
|
+
getLimitRemindersOverride(key) {
|
|
1734
|
+
const choice = this.state.limitRemindersOverrides?.[(0, sessionKey_1.keyToString)(key)];
|
|
1735
|
+
return (0, reminderChoices_1.checkIsLimitReminderChoice)(choice) ? choice : undefined;
|
|
1736
|
+
}
|
|
1737
|
+
/** @description Set the topic's own limit-reminder interval (`null` = follow the instance value again; an emptied map is dropped). Debounced. */
|
|
1738
|
+
async setLimitRemindersOverride(key, choice) {
|
|
1739
|
+
await this.setTopicChoiceOverride('limitRemindersOverrides', key, choice, this.state);
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* @description What the bot remembers of `key`'s accounts notes ({@link StateV1.limitNotes}), or `undefined` when nothing valid is
|
|
1743
|
+
* stored. A copy; a field of the wrong type (a hand-edited file) counts as absent.
|
|
1744
|
+
*/
|
|
1745
|
+
getLimitNoteRecord(key) {
|
|
1746
|
+
const stored = this.state.limitNotes?.[(0, sessionKey_1.keyToString)(key)];
|
|
1747
|
+
return stored === undefined ? undefined : getValidLimitNoteRecord(stored);
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* @description Replace `key`'s note record (`null`, or a record with nothing valid in it, drops it and, with the last entry, the
|
|
1751
|
+
* map). Synchronous in memory — the caller reads the record, works out the next one and writes it in one tick, so two
|
|
1752
|
+
* recordings never interleave — and saved debounced.
|
|
1753
|
+
*/
|
|
1754
|
+
setLimitNoteRecord(key, record) {
|
|
1622
1755
|
const k = (0, sessionKey_1.keyToString)(key);
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
return;
|
|
1627
|
-
delete this.state.questionWaitOverrides[k];
|
|
1628
|
-
if (Object.keys(this.state.questionWaitOverrides).length === 0)
|
|
1629
|
-
delete this.state.questionWaitOverrides;
|
|
1756
|
+
const clean = record === null ? undefined : getValidLimitNoteRecord(record);
|
|
1757
|
+
if (clean === undefined) {
|
|
1758
|
+
if (this.dropOptionalMapEntry('limitNotes', k))
|
|
1630
1759
|
this.scheduleSave();
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
(this.state.limitNotes ??= {})[k] = clean;
|
|
1763
|
+
this.scheduleSave();
|
|
1764
|
+
}
|
|
1765
|
+
/**
|
|
1766
|
+
* @description The agent of `key` lost its context (a fresh session, a stop, `/clear`, a completed compaction, a lost
|
|
1767
|
+
* transcript): it no longer holds the picture its last note showed, so the next summary is «changed» whatever it was. Clears the
|
|
1768
|
+
* fingerprint ONLY — the time of the last note and of the last `claude_profiles` call keep the reminder clock, so a fresh context
|
|
1769
|
+
* is never a reason for an early reminder. No-op (no save) without a fingerprint.
|
|
1770
|
+
*/
|
|
1771
|
+
clearLimitNoteFingerprint(key) {
|
|
1772
|
+
const record = this.getLimitNoteRecord(key);
|
|
1773
|
+
if (record?.fingerprint === undefined)
|
|
1774
|
+
return;
|
|
1775
|
+
const { fingerprint: _forgotten, ...rest } = record;
|
|
1776
|
+
this.setLimitNoteRecord(key, rest);
|
|
1638
1777
|
}
|
|
1639
1778
|
// ── The status marks of a topic's name (`/topic_status`) ──
|
|
1640
1779
|
/** @description The topic's own set of status switches, or `undefined` when it follows the instance value (a set that is not whole booleans counts as none). */
|
|
@@ -1644,20 +1783,8 @@ class StateStore {
|
|
|
1644
1783
|
}
|
|
1645
1784
|
/** @description Set the topic's own set of status switches (`null` = follow the instance value again; an emptied map is dropped). Debounced. */
|
|
1646
1785
|
async setTopicStatusOverride(key, prefs) {
|
|
1647
|
-
|
|
1648
|
-
await this.
|
|
1649
|
-
if (prefs === null) {
|
|
1650
|
-
if (!this.state.topicStatusOverrides || !(k in this.state.topicStatusOverrides))
|
|
1651
|
-
return;
|
|
1652
|
-
delete this.state.topicStatusOverrides[k];
|
|
1653
|
-
if (Object.keys(this.state.topicStatusOverrides).length === 0)
|
|
1654
|
-
delete this.state.topicStatusOverrides;
|
|
1655
|
-
this.scheduleSave();
|
|
1656
|
-
return;
|
|
1657
|
-
}
|
|
1658
|
-
(this.state.topicStatusOverrides ??= {})[k] = { ...prefs };
|
|
1659
|
-
this.scheduleSave();
|
|
1660
|
-
});
|
|
1786
|
+
// A copy: the stored set is never the caller's object, and it never equals the one stored before, so a set always writes.
|
|
1787
|
+
await this.setTopicChoiceOverride('topicStatusOverrides', key, prefs === null ? null : { ...prefs }, this.state);
|
|
1661
1788
|
}
|
|
1662
1789
|
// ── The cap on tracker task agents (`/task_agents`) and its wait list ──
|
|
1663
1790
|
/** @description The General value of the cap (`0` = no limit), or `undefined` while General never chose (then `settings.json` and the built-in default apply). */
|
|
@@ -1845,6 +1972,101 @@ class StateStore {
|
|
|
1845
1972
|
record.limitedUntil = limitedUntil;
|
|
1846
1973
|
this.scheduleSave();
|
|
1847
1974
|
}
|
|
1975
|
+
/**
|
|
1976
|
+
* The CLI's refusal of the account (`null` ends it; see {@link ClaudeProfileRecord.authRefusal}); same record rules as the usage.
|
|
1977
|
+
* Flushed at once, not debounced: the next conversation's launch reads it, and a refusal lost to a crash would send the
|
|
1978
|
+
* conversations after a restart back into it.
|
|
1979
|
+
*/
|
|
1980
|
+
async setClaudeProfileAuthRefusal(name, refusal) {
|
|
1981
|
+
const record = this.touchClaudeProfileInfo(name);
|
|
1982
|
+
if (!record || (refusal === null && record.authRefusal === undefined && record.authRefusalEndedByStatusCheck === undefined))
|
|
1983
|
+
return;
|
|
1984
|
+
if (refusal === null) {
|
|
1985
|
+
// `null` is a new login (a sign-in, or the folder's login changed): what a status check ended before no longer counts either.
|
|
1986
|
+
delete record.authRefusal;
|
|
1987
|
+
delete record.authRefusalEndedByStatusCheck;
|
|
1988
|
+
}
|
|
1989
|
+
else {
|
|
1990
|
+
record.authRefusal = refusal;
|
|
1991
|
+
}
|
|
1992
|
+
await this.flush();
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* End a bare 401 / 403 refusal because a status check found the account signed in at `atIso` — no sign-in: the end is kept
|
|
1996
|
+
* ({@link ClaudeProfileRecord.authRefusalEndedByStatusCheck}) with the refused login, so a repeat of that refusal is held. Flushed at once.
|
|
1997
|
+
*/
|
|
1998
|
+
async endClaudeProfileAuthRefusalByStatusCheck(name, atIso) {
|
|
1999
|
+
const record = this.touchClaudeProfileInfo(name);
|
|
2000
|
+
const refusal = record?.authRefusal;
|
|
2001
|
+
if (!record || !refusal)
|
|
2002
|
+
return;
|
|
2003
|
+
delete record.authRefusal;
|
|
2004
|
+
record.authRefusalEndedByStatusCheck = { at: atIso, ...(refusal.login !== undefined ? { login: refusal.login } : {}) };
|
|
2005
|
+
await this.flush();
|
|
2006
|
+
}
|
|
2007
|
+
/** What the operator was told about the Claude accounts (see the persisted field); `undefined` before the first round. */
|
|
2008
|
+
getClaudeAccountAlertState() {
|
|
2009
|
+
return this.state.claudeAccountAlerts;
|
|
2010
|
+
}
|
|
2011
|
+
/** Keep what the operator was told. Flushed at once: an alert told twice after a crash is what the record exists to prevent. */
|
|
2012
|
+
async setClaudeAccountAlertState(alertState) {
|
|
2013
|
+
this.state.claudeAccountAlerts = alertState;
|
|
2014
|
+
await this.flush();
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Change ONLY the pinned alert of the record as it is now (`null` drops it), never the rest: a post that waited on Telegram must
|
|
2018
|
+
* not write back what it read before — a round in between may have told another account. Flushed at once.
|
|
2019
|
+
*/
|
|
2020
|
+
async setClaudeAccountAlertPinnedMessageId(messageId) {
|
|
2021
|
+
const current = this.state.claudeAccountAlerts;
|
|
2022
|
+
if (!current || (current.pinnedMessageId ?? null) === messageId)
|
|
2023
|
+
return;
|
|
2024
|
+
if (messageId === null)
|
|
2025
|
+
delete current.pinnedMessageId;
|
|
2026
|
+
else
|
|
2027
|
+
current.pinnedMessageId = messageId;
|
|
2028
|
+
await this.flush();
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* Keep (`messageId`) or drop (`null`) ONE account's private sign-out message in the record as it is now, never the rest — the send
|
|
2032
|
+
* waited on Telegram, and a round in between may have told another account. Flushed at once; nothing when no round has run yet.
|
|
2033
|
+
*/
|
|
2034
|
+
async setClaudeAccountAlertSignOutMessageId(name, messageId) {
|
|
2035
|
+
const current = this.state.claudeAccountAlerts;
|
|
2036
|
+
if (!current)
|
|
2037
|
+
return;
|
|
2038
|
+
const messageIds = { ...(current.signOutMessageIds ?? {}) };
|
|
2039
|
+
if (messageId === null)
|
|
2040
|
+
delete messageIds[name];
|
|
2041
|
+
else
|
|
2042
|
+
messageIds[name] = messageId;
|
|
2043
|
+
if (Object.keys(messageIds).length === 0)
|
|
2044
|
+
delete current.signOutMessageIds;
|
|
2045
|
+
else
|
|
2046
|
+
current.signOutMessageIds = messageIds;
|
|
2047
|
+
await this.flush();
|
|
2048
|
+
}
|
|
2049
|
+
/** The conversations waiting for a Claude account that can work (see the persisted field), oldest first. */
|
|
2050
|
+
listClaudeAccountWaits() {
|
|
2051
|
+
return (this.state.claudeAccountWaits ?? []).map((keyStr) => (0, sessionKey_1.tryKeyFromString)(keyStr)).filter((key) => key !== null);
|
|
2052
|
+
}
|
|
2053
|
+
/** Whether the conversation waits for a Claude account that can work. */
|
|
2054
|
+
checkIsWaitingForClaudeAccount(key) {
|
|
2055
|
+
return this.state.claudeAccountWaits?.includes((0, sessionKey_1.keyToString)(key)) === true;
|
|
2056
|
+
}
|
|
2057
|
+
/** Mark (`true`) or end (`false`) the conversation's wait for a Claude account. Flushed at once: a restart must still resume it. */
|
|
2058
|
+
async setWaitingForClaudeAccount(key, isWaiting) {
|
|
2059
|
+
const k = (0, sessionKey_1.keyToString)(key);
|
|
2060
|
+
const waits = this.state.claudeAccountWaits ?? [];
|
|
2061
|
+
if (waits.includes(k) === isWaiting)
|
|
2062
|
+
return;
|
|
2063
|
+
const next = isWaiting ? [...waits, k] : waits.filter((entry) => entry !== k);
|
|
2064
|
+
if (next.length === 0)
|
|
2065
|
+
delete this.state.claudeAccountWaits;
|
|
2066
|
+
else
|
|
2067
|
+
this.state.claudeAccountWaits = next;
|
|
2068
|
+
await this.flush();
|
|
2069
|
+
}
|
|
1848
2070
|
/** The agents-only hold (`null` clears it; see {@link ClaudeProfileRecord.agentHoldUntil}); same record rules as the usage. Debounced. */
|
|
1849
2071
|
setClaudeProfileAgentHoldUntil(name, agentHoldUntil) {
|
|
1850
2072
|
const record = this.touchClaudeProfileInfo(name);
|
|
@@ -2633,7 +2855,9 @@ class StateStore {
|
|
|
2633
2855
|
/**
|
|
2634
2856
|
* Drop `k` from one of the optional per-conversation maps, and the map itself
|
|
2635
2857
|
* with its last entry (an idle bot leaves a clean `state.json`). `false` when
|
|
2636
|
-
* there was no entry. Caller must hold the key lock
|
|
2858
|
+
* there was no entry. Caller must hold the key lock, or do its whole
|
|
2859
|
+
* read-modify-write synchronously in one tick (`setLimitNoteRecord`, like
|
|
2860
|
+
* `setLimitHeldPrompts`), so that no other write can interleave.
|
|
2637
2861
|
*/
|
|
2638
2862
|
dropOptionalMapEntry(field, k) {
|
|
2639
2863
|
const map = this.state[field];
|