charness 4.2.0 → 4.3.1
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 +168 -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 +62 -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 +18 -7
- package/dist/apiRetryKick.d.ts.map +1 -1
- package/dist/apiRetryKick.js +26 -13
- 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 +2055 -653
- 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 +366 -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 +70 -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 +26 -3
- package/dist/requests/sessionTurnProbe.d.ts.map +1 -1
- package/dist/requests/sessionTurnProbe.js +22 -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 +26 -5
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.d.ts +201 -12
- package/dist/requests/wakeUpEngine.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.js +514 -44
- package/dist/requests/wakeUpEngine.js.map +1 -1
- package/dist/requests/wakeUpRules.d.ts +185 -14
- package/dist/requests/wakeUpRules.d.ts.map +1 -1
- package/dist/requests/wakeUpRules.js +169 -36
- 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 +68 -4
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +363 -189
- 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/shutdown.d.ts +12 -0
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +11 -0
- package/dist/shutdown.js.map +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/limitSwitchPlan.d.ts +51 -14
- package/dist/utils/limitSwitchPlan.d.ts.map +1 -1
- package/dist/utils/limitSwitchPlan.js +33 -15
- package/dist/utils/limitSwitchPlan.js.map +1 -1
- 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 +59 -0
- package/dist/utils/workingSignals.d.ts.map +1 -0
- package/dist/utils/workingSignals.js +60 -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
|
@@ -2,30 +2,33 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @description The pure decision behind «a conversation hit its usage limit — may it move on, and where to»
|
|
4
4
|
* (`bot.ts` `planFallbackSwitch` wires it): the candidates (the operator's fallback chain, or, with none, the ranking of the
|
|
5
|
-
* signed-in Claude accounts — `utils/claudeLimitSwitch.ts`), then auto / offer / none (`decideFallbackSwitch`), and the
|
|
6
|
-
* wait with nothing to switch to
|
|
5
|
+
* signed-in Claude accounts — `utils/claudeLimitSwitch.ts`), then auto / offer / none (`decideFallbackSwitch`), and the rung a
|
|
6
|
+
* wait with nothing to switch to is aimed at.
|
|
7
7
|
*
|
|
8
8
|
* WHO it applies to. A Telegram topic takes all of it. A conversation of another platform (a Jira issue; no `checkIsTelegramKey`)
|
|
9
|
-
* takes the AUTOMATIC
|
|
9
|
+
* takes the AUTOMATIC moves between Claude accounts only: the chain's Claude rungs (an OpenCode rung is a cross-backend hand-over
|
|
10
10
|
* that has no surface outside Telegram; a list with no Claude rung restricts no account, as for agents —
|
|
11
|
-
* `getClaudeLaunchChainScope`), never the offer (its «🔁 Switch to …» buttons are a topic's)
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `getClaudeLaunchChainScope`), never the offer (its «🔁 Switch to …» buttons are a topic's). With no account free it waits for
|
|
12
|
+
* the Claude account whose limit resets EARLIEST and the retry kick moves it there — the same automatic move, made later. With
|
|
13
|
+
* auto-switch OFF it waits for its own account's reset — also when the switch is turned OFF during such a wait
|
|
14
|
+
* (`decideAimedWaitEnd`) — and on OpenCode it has nothing to decide.
|
|
14
15
|
*
|
|
15
16
|
* No I/O, no `Date.now()`: the caller passes the clock and the detection, so every rule is unit-tested.
|
|
16
17
|
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
19
|
exports.checkIsLimitSwitchPossible = checkIsLimitSwitchPossible;
|
|
19
20
|
exports.decideLimitSwitch = decideLimitSwitch;
|
|
21
|
+
exports.decideAimedWaitEnd = decideAimedWaitEnd;
|
|
20
22
|
const claudeLimitSwitch_1 = require("./claudeLimitSwitch");
|
|
21
23
|
const fallbackChain_1 = require("./fallbackChain");
|
|
22
24
|
/**
|
|
23
|
-
* @description Whether
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* @description Whether the rung `rung` can take part in a usage-limit move at all — as the one a conversation runs on when the limit
|
|
26
|
+
* hits (does it lead to a switch decision), or as the one it moves onto, now or when a wait aimed at it ends: in a Telegram topic any
|
|
27
|
+
* rung, elsewhere only a Claude account — a hand-over to OpenCode has no surface outside Telegram. (The caller has already dropped a
|
|
28
|
+
* conversation with no rung to leave — a terminal, no agent, an OpenCode server on its default model.)
|
|
26
29
|
*/
|
|
27
|
-
function checkIsLimitSwitchPossible(isTelegram,
|
|
28
|
-
return isTelegram ||
|
|
30
|
+
function checkIsLimitSwitchPossible(isTelegram, rung) {
|
|
31
|
+
return isTelegram || rung.backend === 'claude';
|
|
29
32
|
}
|
|
30
33
|
/**
|
|
31
34
|
* @description What the usage limit of the rung `from` leads to. `chain` is the operator's fallback chain as stored (empty = none);
|
|
@@ -33,7 +36,7 @@ function checkIsLimitSwitchPossible(isTelegram, from) {
|
|
|
33
36
|
*/
|
|
34
37
|
function decideLimitSwitch(input) {
|
|
35
38
|
const { isTelegram, from, detection, nowMs } = input;
|
|
36
|
-
const explicit =
|
|
39
|
+
const explicit = input.chain.filter((entry) => checkIsLimitSwitchPossible(isTelegram, entry));
|
|
37
40
|
// Without a configured chain a Claude conversation falls back to the within-Claude ranking (the soonest weekly reset first).
|
|
38
41
|
const ranked = explicit.length === 0 && from.backend === 'claude'
|
|
39
42
|
? (0, claudeLimitSwitch_1.pickClaudeLimitSwitchCandidates)({ profiles: detection.claudeProfiles, currentName: from.profile, model: from.model, nowMs })
|
|
@@ -42,13 +45,28 @@ function decideLimitSwitch(input) {
|
|
|
42
45
|
const candidates = (0, fallbackChain_1.pickFallbackCandidates)({ chain: ranked, current: from, detection, nowMs });
|
|
43
46
|
const decided = (0, fallbackChain_1.decideFallbackSwitch)({ candidates, isAutoSwitchEnabled: input.isAutoSwitchEnabled });
|
|
44
47
|
const plan = !isTelegram && decided.action === 'offer' ? { action: 'none' } : decided;
|
|
45
|
-
if (plan.action !== 'none' || !isTelegram)
|
|
46
|
-
return { plan,
|
|
48
|
+
if (plan.action !== 'none' || (!isTelegram && !input.isAutoSwitchEnabled))
|
|
49
|
+
return { plan, waitTarget: null };
|
|
47
50
|
const implicit = from.backend === 'claude'
|
|
48
51
|
? detection.claudeProfiles
|
|
49
52
|
.filter((profile) => profile.loggedIn !== false && profile.billing !== 'api')
|
|
50
53
|
.map((profile) => ({ backend: 'claude', profile: profile.name, model: null }))
|
|
51
54
|
: [];
|
|
52
|
-
|
|
55
|
+
const waitRungs = explicit.length > 0 ? explicit : implicit;
|
|
56
|
+
const found = waitRungs.length > 0 ? (0, fallbackChain_1.pickEarliestResetRung)({ chain: waitRungs, current: from, detection, nowMs }) : null;
|
|
57
|
+
return { plan, waitTarget: found && !found.isCurrent ? { entry: found.entry, untilMs: found.untilMs } : null };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @description What the end of a usage-limit wait aimed at another rung (the retry record's `resumeOn`) does. A topic moves there
|
|
61
|
+
* whatever its switch says: its aimed wait is armed with auto-switch OFF too. Outside Telegram only the automatic switch moves a
|
|
62
|
+
* conversation, and the wait was aimed only while it was ON: turned OFF since, the conversation stays on its own account — waiting
|
|
63
|
+
* again until that account is back (`ownLimitedUntilMs`, its limit mark) while that lies ahead, rather than resuming into a limit
|
|
64
|
+
* it is known to hit; resumed now when its account names no reset ahead.
|
|
65
|
+
*/
|
|
66
|
+
function decideAimedWaitEnd(input) {
|
|
67
|
+
if (input.isTelegram || input.isAutoSwitchEnabled)
|
|
68
|
+
return { action: 'move' };
|
|
69
|
+
const untilMs = input.ownLimitedUntilMs;
|
|
70
|
+
return untilMs !== null && Number.isFinite(untilMs) && untilMs > input.nowMs ? { action: 'waitOwnReset', untilMs } : { action: 'resumeHere' };
|
|
53
71
|
}
|
|
54
72
|
//# sourceMappingURL=limitSwitchPlan.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitSwitchPlan.js","sourceRoot":"","sources":["../../src/utils/limitSwitchPlan.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"limitSwitchPlan.js","sourceRoot":"","sources":["../../src/utils/limitSwitchPlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAkBH,gEAEC;AAwBD,8CA2BC;AAkBD,gDAIC;AA3FD,2DAAsE;AACtE,mDAOyB;AAEzB;;;;;GAKG;AACH,SAAgB,0BAA0B,CAAC,UAAmB,EAAE,IAAwB;IACtF,OAAO,UAAU,IAAI,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC;AACjD,CAAC;AAoBD;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAOjC;IACC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,0BAA0B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 -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description The `/limits` switch board in two pure pieces:
|
|
3
3
|
*
|
|
4
|
-
* - the ROWS — one per
|
|
4
|
+
* - the ROWS — one per Claude account (in `/accounts` order), then one per connected OpenCode provider (in
|
|
5
5
|
* catalog order), each labelled `[✓ ]<program> · <account or provider>` and nothing else: the buttons carry no usage,
|
|
6
6
|
* no reset and no model (the figures do not fit a phone's button) — only an account billed to API credits ends in
|
|
7
7
|
* ` 💳` (a tap on it spends money). The `✓` marks the active row only — where the
|
|
8
|
-
* topic runs now, in General the default Claude account.
|
|
8
|
+
* topic runs now, in General the default Claude account. An account that CANNOT WORK and that a sign-in mends (signed out, its
|
|
9
|
+
* login expired, refused by the API) stays on the board as a row that is no switch target — `🔑 <program> · <account>`: a tap
|
|
10
|
+
* signs it in again (the 🔑 of `/accounts`), it never moves a topic; one its organization turned off has no row (a sign-in does not mend it).
|
|
9
11
|
* - the USAGE BLOCK of the message above them — `Usage (% used)` and one line per signed-in Claude account that has
|
|
10
|
-
* a figure or a limit (an account billed to API credits always: `console — 💳 API · pay per use`),
|
|
12
|
+
* a figure or a limit (an account billed to API credits always: `console — 💳 API · pay per use`), a line by WHY for one that cannot
|
|
13
|
+
* work — `<name> — 🔑 not signed in`, `🔑 sign-in expired`, `🔑 refused by the API (401/403)`, `🚫 its organization turned it off` —, then per
|
|
11
14
|
* connected OpenCode provider that reports usage (the ChatGPT subscription), each
|
|
12
15
|
* `<name> — <first usage line>` in exactly the wording `/accounts` prints under a row
|
|
13
16
|
* (`formatClaudeProfileUsageLines`, the one renderer both screens share).
|
|
@@ -18,7 +21,8 @@
|
|
|
18
21
|
import { type FallbackChainEntry, type FallbackDetection } from './fallbackChain';
|
|
19
22
|
import { type OpenCodeProviderUsageRecord } from './openCodeUsage';
|
|
20
23
|
export interface LimitsBoardRow {
|
|
21
|
-
|
|
24
|
+
/** `claudeSignIn`: a Claude account that cannot work and that a sign-in mends — its tap starts the sign-in, it is never a switch target. */
|
|
25
|
+
kind: 'claude' | 'claudeSignIn' | 'opencode';
|
|
22
26
|
/** The Claude account's name, or the OpenCode provider's id — what a tap acts on. */
|
|
23
27
|
id: string;
|
|
24
28
|
label: string;
|
|
@@ -35,7 +39,11 @@ export interface LimitsBoardInput {
|
|
|
35
39
|
openCode: string;
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* @description The board's rows: the Claude accounts — one that cannot work as a sign-in row where a sign-in mends it (signed out, expired,
|
|
44
|
+
* refused by the API), and none where it does not (its organization turned Claude subscription use off: the usage block says so) —, then
|
|
45
|
+
* connected OpenCode providers.
|
|
46
|
+
*/
|
|
39
47
|
export declare function buildLimitsBoardRows(input: LimitsBoardInput): LimitsBoardRow[];
|
|
40
48
|
export interface LimitsUsageBlockInput {
|
|
41
49
|
detection: FallbackDetection;
|
|
@@ -46,8 +54,9 @@ export interface LimitsUsageBlockInput {
|
|
|
46
54
|
timezone: string;
|
|
47
55
|
}
|
|
48
56
|
/**
|
|
49
|
-
* @description The usage block of the `/limits` message: the heading and the entries —
|
|
50
|
-
* `/accounts` order
|
|
57
|
+
* @description The usage block of the `/limits` message: the heading and the entries — Claude accounts in
|
|
58
|
+
* `/accounts` order (one that cannot work says why, `<name> — 🔑 sign-in expired`, whatever it was last polled at), then connected
|
|
59
|
+
* OpenCode providers with a recorded usage in catalog order. A signed-in account never polled
|
|
51
60
|
* and not limited, and a provider without usage, have no entry; with no entry at all there is no block (`''`, no heading).
|
|
52
61
|
*/
|
|
53
62
|
export declare function formatLimitsUsageBlock(input: LimitsUsageBlockInput): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitsBoardPlan.d.ts","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"limitsBoardPlan.d.ts","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAqB,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAsBtF,MAAM,WAAW,cAAc;IAC7B,4IAA4I;IAC5I,IAAI,EAAE,QAAQ,GAAG,cAAc,GAAG,UAAU,CAAC;IAC7C,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,+HAA+H;IAC/H,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,2DAA2D;IAC3D,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C;AAWD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,cAAc,EAAE,CA0B9E;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,6FAA6F;IAC7F,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAiBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAoB3E"}
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @description The `/limits` switch board in two pure pieces:
|
|
4
4
|
*
|
|
5
|
-
* - the ROWS — one per
|
|
5
|
+
* - the ROWS — one per Claude account (in `/accounts` order), then one per connected OpenCode provider (in
|
|
6
6
|
* catalog order), each labelled `[✓ ]<program> · <account or provider>` and nothing else: the buttons carry no usage,
|
|
7
7
|
* no reset and no model (the figures do not fit a phone's button) — only an account billed to API credits ends in
|
|
8
8
|
* ` 💳` (a tap on it spends money). The `✓` marks the active row only — where the
|
|
9
|
-
* topic runs now, in General the default Claude account.
|
|
9
|
+
* topic runs now, in General the default Claude account. An account that CANNOT WORK and that a sign-in mends (signed out, its
|
|
10
|
+
* login expired, refused by the API) stays on the board as a row that is no switch target — `🔑 <program> · <account>`: a tap
|
|
11
|
+
* signs it in again (the 🔑 of `/accounts`), it never moves a topic; one its organization turned off has no row (a sign-in does not mend it).
|
|
10
12
|
* - the USAGE BLOCK of the message above them — `Usage (% used)` and one line per signed-in Claude account that has
|
|
11
|
-
* a figure or a limit (an account billed to API credits always: `console — 💳 API · pay per use`),
|
|
13
|
+
* a figure or a limit (an account billed to API credits always: `console — 💳 API · pay per use`), a line by WHY for one that cannot
|
|
14
|
+
* work — `<name> — 🔑 not signed in`, `🔑 sign-in expired`, `🔑 refused by the API (401/403)`, `🚫 its organization turned it off` —, then per
|
|
12
15
|
* connected OpenCode provider that reports usage (the ChatGPT subscription), each
|
|
13
16
|
* `<name> — <first usage line>` in exactly the wording `/accounts` prints under a row
|
|
14
17
|
* (`formatClaudeProfileUsageLines`, the one renderer both screens share).
|
|
@@ -20,25 +23,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
23
|
exports.buildLimitsBoardRows = buildLimitsBoardRows;
|
|
21
24
|
exports.formatLimitsUsageBlock = formatLimitsUsageBlock;
|
|
22
25
|
const i18n_1 = require("../i18n");
|
|
26
|
+
const claudeAuthRefusal_1 = require("./claudeAuthRefusal");
|
|
23
27
|
const claudeProfileUsageLines_1 = require("./claudeProfileUsageLines");
|
|
24
28
|
const fallbackChain_1 = require("./fallbackChain");
|
|
25
29
|
const openCodeUsage_1 = require("./openCodeUsage");
|
|
26
30
|
const activeMark = '✓ ';
|
|
31
|
+
/** Before the label of an account's sign-in row, and before the words of an account a sign-in mends: its tap signs the account in again, like the 🔑 of `/accounts`. */
|
|
32
|
+
const signInMark = '🔑 ';
|
|
33
|
+
/** Before the words of an account no sign-in mends (its organization turned Claude subscription use off). */
|
|
34
|
+
const blockedMark = '🚫 ';
|
|
35
|
+
/** The words after an unusable account's name in the usage block, by why it cannot work (`account.row.loggedOut` is `/accounts`' own «not signed in»). */
|
|
36
|
+
const unusableMarkKeys = {
|
|
37
|
+
notSignedIn: 'account.row.loggedOut',
|
|
38
|
+
signedOut: 'limits.signedOutMark',
|
|
39
|
+
rejected: 'limits.rejectedMark',
|
|
40
|
+
orgDisabled: 'limits.orgDisabledMark',
|
|
41
|
+
};
|
|
42
|
+
/** `<mark> <why>` — what the usage block says of an account that cannot work. */
|
|
43
|
+
function formatUnusableMark(usability) {
|
|
44
|
+
return `${(0, claudeAuthRefusal_1.checkIsClaudeUsabilityMendedBySignIn)(usability) ? signInMark : blockedMark}${(0, i18n_1.t)(unusableMarkKeys[usability])}`;
|
|
45
|
+
}
|
|
27
46
|
/** The ChatGPT subscription's name beside its provider id in the usage block: `openai (ChatGPT)`. */
|
|
28
47
|
const chatGptBrandName = 'ChatGPT';
|
|
29
48
|
/** The mark after an account billed to API credits: every request on it costs money. */
|
|
30
49
|
const meteredMark = ' 💳';
|
|
31
50
|
function buildRow(row) {
|
|
32
51
|
const { program, isMetered, ...rest } = row;
|
|
33
|
-
|
|
52
|
+
const mark = row.kind === 'claudeSignIn' ? signInMark : row.isActive ? activeMark : '';
|
|
53
|
+
return { ...rest, label: `${mark}${program} · ${row.id}${isMetered ? meteredMark : ''}` };
|
|
34
54
|
}
|
|
35
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* @description The board's rows: the Claude accounts — one that cannot work as a sign-in row where a sign-in mends it (signed out, expired,
|
|
57
|
+
* refused by the API), and none where it does not (its organization turned Claude subscription use off: the usage block says so) —, then
|
|
58
|
+
* connected OpenCode providers.
|
|
59
|
+
*/
|
|
36
60
|
function buildLimitsBoardRows(input) {
|
|
37
61
|
const rows = [];
|
|
38
62
|
const { current } = input;
|
|
39
63
|
for (const profile of input.detection.claudeProfiles) {
|
|
40
|
-
|
|
64
|
+
const usability = (0, claudeAuthRefusal_1.getClaudeProfileUsability)(profile);
|
|
65
|
+
if (usability !== 'usable') {
|
|
66
|
+
if ((0, claudeAuthRefusal_1.checkIsClaudeUsabilityMendedBySignIn)(usability))
|
|
67
|
+
rows.push(buildRow({ kind: 'claudeSignIn', id: profile.name, program: input.words.claude, isActive: false }));
|
|
41
68
|
continue;
|
|
69
|
+
}
|
|
42
70
|
rows.push(buildRow({
|
|
43
71
|
kind: 'claude',
|
|
44
72
|
id: profile.name,
|
|
@@ -72,15 +100,19 @@ function formatUsageProviderName(providerId) {
|
|
|
72
100
|
return providerId === openCodeUsage_1.chatGptProviderId ? `${providerId} (${chatGptBrandName})` : providerId;
|
|
73
101
|
}
|
|
74
102
|
/**
|
|
75
|
-
* @description The usage block of the `/limits` message: the heading and the entries —
|
|
76
|
-
* `/accounts` order
|
|
103
|
+
* @description The usage block of the `/limits` message: the heading and the entries — Claude accounts in
|
|
104
|
+
* `/accounts` order (one that cannot work says why, `<name> — 🔑 sign-in expired`, whatever it was last polled at), then connected
|
|
105
|
+
* OpenCode providers with a recorded usage in catalog order. A signed-in account never polled
|
|
77
106
|
* and not limited, and a provider without usage, have no entry; with no entry at all there is no block (`''`, no heading).
|
|
78
107
|
*/
|
|
79
108
|
function formatLimitsUsageBlock(input) {
|
|
80
109
|
const entries = [];
|
|
81
110
|
for (const profile of input.detection.claudeProfiles) {
|
|
82
|
-
|
|
111
|
+
const usability = (0, claudeAuthRefusal_1.getClaudeProfileUsability)(profile);
|
|
112
|
+
if (usability !== 'usable') {
|
|
113
|
+
entries.push(`${profile.name} — ${formatUnusableMark(usability)}`);
|
|
83
114
|
continue;
|
|
115
|
+
}
|
|
84
116
|
const usageLines = (0, claudeProfileUsageLines_1.formatClaudeProfileUsageLines)(profile, input.timezone, input.nowMs);
|
|
85
117
|
// An account billed to API credits has no windows: its entry says how it pays, the used-up mark hangs under it.
|
|
86
118
|
const entry = formatUsageEntry(profile.name, profile.billing === 'api' ? [(0, i18n_1.t)('account.kind.api'), ...usageLines] : usageLines);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitsBoardPlan.js","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"limitsBoardPlan.js","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAiEH,oDA0BC;AAgCD,wDAoBC;AA7ID,kCAA4B;AAC5B,2DAAmI;AACnI,uEAA0E;AAC1E,mDAKyB;AACzB,mDAAsF;AAEtF,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,wKAAwK;AACxK,MAAM,UAAU,GAAG,KAAK,CAAC;AACzB,6GAA6G;AAC7G,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,0JAA0J;AAC1J,MAAM,gBAAgB,GAAwE;IAC5F,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE,qBAAqB;IAC/B,WAAW,EAAE,wBAAwB;CACtC,CAAC;AAEF,iFAAiF;AACjF,SAAS,kBAAkB,CAAC,SAAoD;IAC9E,OAAO,GAAG,IAAA,wDAAoC,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,GAAG,IAAA,QAAC,EAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;AAC1H,CAAC;AACD,qGAAqG;AACrG,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAoBnC,wFAAwF;AACxF,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,SAAS,QAAQ,CAAC,GAA6E;IAC7F,MAAM,EAAE,OAAO,EAAE,SAA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,CAAC"}
|
package/dist/utils/lostWork.d.ts
CHANGED
|
@@ -103,11 +103,25 @@ export declare function getHeldLostWorkPlan(input: {
|
|
|
103
103
|
reason: LostWorkReason;
|
|
104
104
|
isLimitWaitArmed: boolean;
|
|
105
105
|
}): LostWorkPlan;
|
|
106
|
+
/**
|
|
107
|
+
* @name LostWorkTelling
|
|
108
|
+
* @description How the lost-work note asks the agent to tell about the loss:
|
|
109
|
+
* - `plain` — «tell the user in one or two lines what happened» (a topic, a request that owes an answer);
|
|
110
|
+
* - `watchHeld` — the wake of a tracker request a passing watch holds and that owes nobody an answer: the watch is still armed, so
|
|
111
|
+
* carry on without a comment and tell the requester only if they must know;
|
|
112
|
+
* - `runHeader` — the note rides a tracker fire: the run's header says when to answer, so tell the requester about the loss only if
|
|
113
|
+
* it changes what they wait for. No claim about a watch: the fire may be a check that just failed, a one-shot, or have no request open.
|
|
114
|
+
* A comment on an issue notifies the requester and the issue's watchers, which is why the two tracker wordings exist.
|
|
115
|
+
*/
|
|
116
|
+
export type LostWorkTelling = 'plain' | 'watchHeld' | 'runHeader';
|
|
106
117
|
/**
|
|
107
118
|
* @description The note the agent gets — as the automatic resume's prompt, or ahead of the next prompt. English with
|
|
108
|
-
* the baked reply-language directive (`replyLanguage` is the topic's language endonym).
|
|
119
|
+
* the baked reply-language directive (`replyLanguage` is the topic's language endonym). `telling` — how it asks to tell about the loss
|
|
120
|
+
* ({@link LostWorkTelling}; `plain` by default).
|
|
109
121
|
*/
|
|
110
|
-
export declare function buildLostWorkNote(record: LostWorkRecord, replyLanguage: string
|
|
122
|
+
export declare function buildLostWorkNote(record: LostWorkRecord, replyLanguage: string, options?: {
|
|
123
|
+
telling?: LostWorkTelling;
|
|
124
|
+
}): string;
|
|
111
125
|
/**
|
|
112
126
|
* @description One loss from two: a loss the agent was not told about yet stays, and a newer one adds to it — the
|
|
113
127
|
* tasks by id, the larger job count, the reason and time of the newer loss. The parts another agent was told first
|
|
@@ -1 +1 @@
|
|
|
1
|
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E,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,CAAA;CAAO,GAAG,MAAM,CAapI;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,KAAK,EAAE,cAAc,GAAG,cAAc,CAW9G;AAyBD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAQnI"}
|
package/dist/utils/lostWork.js
CHANGED
|
@@ -112,11 +112,24 @@ function describeLostWorkForAgent(lostWork) {
|
|
|
112
112
|
parts.push('the turn you were in the middle of, which was cut off');
|
|
113
113
|
return parts.join('; ');
|
|
114
114
|
}
|
|
115
|
+
/** The note's last line: what to do about the loss and when to tell, per {@link LostWorkTelling}. */
|
|
116
|
+
function buildLostWorkTellingLine(telling, replyLanguage) {
|
|
117
|
+
const stateReviewSentence = 'Check its state yourself (output files, processes, the repository), start again what is still needed — prefer the bot\'s schedule_* tools for anything that must survive a restart';
|
|
118
|
+
if (telling === 'watchHeld') {
|
|
119
|
+
return `${stateReviewSentence}. Your watch is still armed and nothing the requester wrote is waiting for your answer, so carry on without a comment, ` +
|
|
120
|
+
`and tell the requester about it, IN ${replyLanguage}, only if they must know (it changes what they are waiting for).`;
|
|
121
|
+
}
|
|
122
|
+
if (telling === 'runHeader') {
|
|
123
|
+
return `${stateReviewSentence}. This run's header says when to answer; tell the requester about the loss, IN ${replyLanguage}, only if it changes what they are waiting for.`;
|
|
124
|
+
}
|
|
125
|
+
return `${stateReviewSentence} — and tell the user in one or two lines what happened, IN ${replyLanguage}.`;
|
|
126
|
+
}
|
|
115
127
|
/**
|
|
116
128
|
* @description The note the agent gets — as the automatic resume's prompt, or ahead of the next prompt. English with
|
|
117
|
-
* the baked reply-language directive (`replyLanguage` is the topic's language endonym).
|
|
129
|
+
* the baked reply-language directive (`replyLanguage` is the topic's language endonym). `telling` — how it asks to tell about the loss
|
|
130
|
+
* ({@link LostWorkTelling}; `plain` by default).
|
|
118
131
|
*/
|
|
119
|
-
function buildLostWorkNote(record, replyLanguage) {
|
|
132
|
+
function buildLostWorkNote(record, replyLanguage, options = {}) {
|
|
120
133
|
// Only what the other agent could have started again: its tasks and jobs, not a result or a cut-off turn.
|
|
121
134
|
const restartableTold = record.otherAgentTold
|
|
122
135
|
? { ...noLostWork, backgroundTasks: record.otherAgentTold.backgroundTasks, scheduledJobCount: record.otherAgentTold.scheduledJobCount }
|
|
@@ -127,7 +140,7 @@ function buildLostWorkNote(record, replyLanguage) {
|
|
|
127
140
|
...(restartableTold && checkHasLostWork(restartableTold)
|
|
128
141
|
? [`The agent this conversation moved to meanwhile was told first about ${describeLostWorkForAgent(restartableTold)}, and may have started some of it again: look before you start that twice.`]
|
|
129
142
|
: []),
|
|
130
|
-
|
|
143
|
+
buildLostWorkTellingLine(options.telling ?? 'plain', replyLanguage),
|
|
131
144
|
].join('\n');
|
|
132
145
|
}
|
|
133
146
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lostWork.js","sourceRoot":"","sources":["../../src/utils/lostWork.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA+CH,4CAEC;AAMD,gEAEC;AAWD,8DAWC;AAGD,0EAGC;AAwBD,0CAWC;AAOD,kDAGC;
|
|
1
|
+
{"version":3,"file":"lostWork.js","sourceRoot":"","sources":["../../src/utils/lostWork.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA+CH,4CAEC;AAMD,gEAEC;AAWD,8DAWC;AAGD,0EAGC;AAwBD,0CAWC;AAOD,kDAGC;AAsDD,8CAaC;AAOD,oDAWC;AA8BD,0DAQC;AArND;;;GAGG;AACU,QAAA,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvD,8CAA8C;AAC9C,SAAgB,gBAAgB,CAAC,QAA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AAI,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACvJ,IAAI,MAAM,CAAC,iBAAiB,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC;IACnH,IAAI,MAAM,CAAC,mBAAmB;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC,CAAC;IACpF,IAAI,MAAM,CAAC,eAAe;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,SAAS,CAAC,mBAAmB,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACnF,OAAO,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -36,8 +36,8 @@ export interface MessageContext {
|
|
|
36
36
|
export declare function joinMessageContextBlocks(blocks: ReadonlyArray<string | null | undefined>): string | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* @description Whether the words of a message are somebody else's: it was FORWARDED, or a person who is not the operator sent
|
|
39
|
-
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a
|
|
40
|
-
*
|
|
39
|
+
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a reminder
|
|
40
|
+
* step's capture, a context wipe), so none of them can be missed for one kind of sender.
|
|
41
41
|
*/
|
|
42
42
|
export declare function checkIsForeignWords(context: MessageContext | undefined): boolean;
|
|
43
43
|
/**
|
|
@@ -31,8 +31,8 @@ function joinMessageContextBlocks(blocks) {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* @description Whether the words of a message are somebody else's: it was FORWARDED, or a person who is not the operator sent
|
|
34
|
-
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a
|
|
35
|
-
*
|
|
34
|
+
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a reminder
|
|
35
|
+
* step's capture, a context wipe), so none of them can be missed for one kind of sender.
|
|
36
36
|
*/
|
|
37
37
|
function checkIsForeignWords(context) {
|
|
38
38
|
return context?.isForwarded === true || context?.nonOperatorSender !== undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type SessionKey } from '../sessionKey';
|
|
2
|
+
/**
|
|
3
|
+
* @description The per-session mid-turn INBOX of a running Claude agent: text the bot wants the agent to read inside its turn, not
|
|
4
|
+
* only at its next prompt. A `PostToolUse` hook (no matcher) in the launch `--settings` file prints the session's inbox file,
|
|
5
|
+
* `DATA_DIR/todos/inbox/<session id>.json`, after the agent's next tool call: ready hook JSON whose `additionalContext` Claude reads
|
|
6
|
+
* with that tool's result (probed on Claude Code 2.1.310). The hook moves the file before printing it, so a text is delivered once;
|
|
7
|
+
* with no file it prints nothing. The directory is the project board's (it predates the accounts note); the hook command and the
|
|
8
|
+
* single `PostToolUse` entry that carries it are unchanged by there being more than one kind of text in it.
|
|
9
|
+
*
|
|
10
|
+
* One file holds one or more SECTIONS, joined by a blank line: the accounts note (`limitNotes/`) and the project board's changes
|
|
11
|
+
* (`todos/midTurn.ts`). Each section is offered and withdrawn on its own rules — a section's withdrawal never touches another's, and
|
|
12
|
+
* a section is withdrawn wherever no tool call of the session can take it any more (a turn start the bot makes, a turn's end, a turn
|
|
13
|
+
* held open, the session's start, stop or end) — but the FILE is taken whole: when the hook moved it, every section it held counts as
|
|
14
|
+
* taken, and each section's `onTaken` fires once. A section withdrawn unseen keeps its owner's state (the board's changes stay unseen,
|
|
15
|
+
* the note stays due), so the inbox dir is empty between turns. A restart forgets what was written: at worst a text is delivered
|
|
16
|
+
* twice, never lost.
|
|
17
|
+
*
|
|
18
|
+
* Nothing here writes to an agent's input, stamps activity, wakes a session or opens a request: it writes and removes files.
|
|
19
|
+
*/
|
|
20
|
+
/** The sections of an inbox, in the order they are joined: the short accounts note first, so the cut of an over-long board never takes it. */
|
|
21
|
+
export declare const midTurnInboxSections: readonly ["accounts", "todoBoard"];
|
|
22
|
+
export type MidTurnInboxSection = (typeof midTurnInboxSections)[number];
|
|
23
|
+
/** Claude Code caps a hook's `additionalContext`; the text is cut below it. */
|
|
24
|
+
export declare const midTurnInboxMaxChars = 10000;
|
|
25
|
+
/** @description Where the inboxes live: `DATA_DIR/todos/inbox`. */
|
|
26
|
+
export declare function getMidTurnInboxDir(dataDir: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* @description The `PostToolUse` hook's shell command. With the inbox dir empty — nearly every tool call — it reads
|
|
29
|
+
* the input whole (the CLI must never write into a closed pipe) and exits; only while an inbox waits does it start
|
|
30
|
+
* `nodePath` (the bot's own, written at every launch) to parse the input ({@link inboxHookScript}). It always exits 0 —
|
|
31
|
+
* a hook failure must never stop the agent's tool.
|
|
32
|
+
*
|
|
33
|
+
* Only the MAIN agent takes the inbox. A sub-agent's tool call fires the hook too, with the SAME `session_id` and an
|
|
34
|
+
* `agent_id` of its own (measured on Claude Code 2.1.310); taken there, the text would land in the sub-agent's
|
|
35
|
+
* context and count as delivered while the main agent never got it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildMidTurnInboxHookCommand(inboxDir: string, nodePath?: string): string;
|
|
38
|
+
/** @description The hook output Claude reads `text` from: `additionalContext` of a `PostToolUse` hook, within the cap. */
|
|
39
|
+
export declare function buildMidTurnInboxHookOutput(text: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* @name MidTurnInboxOffer
|
|
42
|
+
* @description A section's text and what its owner does about it: `onTaken` — the hook took the file, the text reached the agent;
|
|
43
|
+
* `onWithdrawn` — it was taken back unseen (a turn start, a turn's end, the session's end, a newer offer, boot).
|
|
44
|
+
*/
|
|
45
|
+
export interface MidTurnInboxOffer {
|
|
46
|
+
text: string;
|
|
47
|
+
onTaken: () => void;
|
|
48
|
+
onWithdrawn?: () => void;
|
|
49
|
+
}
|
|
50
|
+
/** @name MidTurnInbox @description What the todo board's mid-turn path and the accounts engine call. */
|
|
51
|
+
export interface MidTurnInbox {
|
|
52
|
+
/**
|
|
53
|
+
* Offer `section` to the Claude session `sessionId` of the conversation, replacing the text it already waits with (the replaced
|
|
54
|
+
* offer is withdrawn). `false`, nothing written, for a session id that is no file name.
|
|
55
|
+
*/
|
|
56
|
+
offer: (key: SessionKey, sessionId: string, section: MidTurnInboxSection, offer: MidTurnInboxOffer) => boolean;
|
|
57
|
+
/** Whether `section` of the conversation waits for the agent's next tool call. */
|
|
58
|
+
checkIsWaiting: (key: SessionKey, section: MidTurnInboxSection) => boolean;
|
|
59
|
+
/** The files the hook took since the last look: the sections they held count as taken, each `onTaken` once. One conversation's, or every one's. */
|
|
60
|
+
reconcile: (key?: SessionKey) => void;
|
|
61
|
+
/**
|
|
62
|
+
* No tool call of the session can take `section` any more: withdrawn — counted as taken if the hook took the file meanwhile — and
|
|
63
|
+
* the copies hooks that are gone moved aside and never removed go with it. Another section of the same file stays and is written
|
|
64
|
+
* again without it.
|
|
65
|
+
*/
|
|
66
|
+
withdraw: (key: SessionKey, section: MidTurnInboxSection) => void;
|
|
67
|
+
/**
|
|
68
|
+
* At boot: every inbox left is withdrawn — this process does not know what it carries, and a session that ended never takes its
|
|
69
|
+
* own. What they carried is still unseen or still due, so the next prompt (or poll) delivers it again.
|
|
70
|
+
*/
|
|
71
|
+
clearAll: () => void;
|
|
72
|
+
}
|
|
73
|
+
/** @name MidTurnInboxDeps @description `checkIsProcessAlive` — whether a process runs (the hook that moved a file aside, run as the bot's own user); `kill(pid, 0)` by default. */
|
|
74
|
+
export interface MidTurnInboxDeps {
|
|
75
|
+
inboxDir: string;
|
|
76
|
+
checkIsProcessAlive?: (pid: number) => boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare function createMidTurnInbox(deps: MidTurnInboxDeps): MidTurnInbox;
|
|
79
|
+
//# sourceMappingURL=midTurnInbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"midTurnInbox.d.ts","sourceRoot":"","sources":["../../src/utils/midTurnInbox.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAI7D;;;;;;;;;;;;;;;;;GAiBG;AAEH,8IAA8I;AAC9I,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIxE,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAW3C,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAyB,GAAG,MAAM,CAO1G;AAED,0HAA0H;AAC1H,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wGAAwG;AACxG,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,iBAAiB,KAAK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