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
|
@@ -39,26 +39,48 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.checkIsCompactBoundaryLine = checkIsCompactBoundaryLine;
|
|
42
43
|
exports.readClaudeTranscriptEpochLines = readClaudeTranscriptEpochLines;
|
|
44
|
+
exports.scanClaudeTranscriptEpochBackwards = scanClaudeTranscriptEpochBackwards;
|
|
43
45
|
const fs = __importStar(require("fs"));
|
|
44
46
|
const checkIsRecord_1 = require("./checkIsRecord");
|
|
45
47
|
/** How much of the file one read takes. */
|
|
46
48
|
const readChunkBytes = 1024 * 1024;
|
|
47
49
|
const newlineByte = 0x0a;
|
|
48
|
-
/** The key a line must carry to be a compaction boundary: checked on the raw
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
/** The key a line must carry to be a compaction boundary: checked on the raw line before anything is decoded. */
|
|
51
|
+
const compactBoundaryKeyText = '"compact_boundary"';
|
|
52
|
+
const compactBoundaryKey = Buffer.from(compactBoundaryKeyText);
|
|
53
|
+
/**
|
|
54
|
+
* @description Whether a transcript line (its bytes, or its text) is a compaction boundary record — the ONE epoch rule of every reader
|
|
55
|
+
* that walks the transcript backwards, so none of them reaches into the epoch before it.
|
|
56
|
+
*/
|
|
57
|
+
function checkIsCompactBoundaryLine(line) {
|
|
58
|
+
if (typeof line === 'string' ? !line.includes(compactBoundaryKeyText) : line.indexOf(compactBoundaryKey) < 0)
|
|
53
59
|
return false;
|
|
54
60
|
try {
|
|
55
|
-
const record = JSON.parse(
|
|
61
|
+
const record = JSON.parse(typeof line === 'string' ? line : line.toString('utf8'));
|
|
56
62
|
return (0, checkIsRecord_1.checkIsRecord)(record) && record.type === 'system' && record.subtype === 'compact_boundary';
|
|
57
63
|
}
|
|
58
64
|
catch {
|
|
59
65
|
return false;
|
|
60
66
|
}
|
|
61
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Feeds `takeLine` the complete lines of `bytes` — a chunk joined to the bytes of the line that began in the chunk after it — newest
|
|
70
|
+
* first, until it asks to stop (it returns `true`: the boundary was found). Resolves the bytes before the chunk's first newline,
|
|
71
|
+
* which belong to a line that began in an earlier chunk, or `null` when `takeLine` stopped the walk.
|
|
72
|
+
*/
|
|
73
|
+
function takeLinesBackwards(bytes, takeLine) {
|
|
74
|
+
let lineEnd = bytes.length;
|
|
75
|
+
for (let index = bytes.length - 1; index >= 0; index -= 1) {
|
|
76
|
+
if (bytes[index] !== newlineByte)
|
|
77
|
+
continue;
|
|
78
|
+
if (takeLine(bytes.subarray(index + 1, lineEnd)))
|
|
79
|
+
return null;
|
|
80
|
+
lineEnd = index;
|
|
81
|
+
}
|
|
82
|
+
return Buffer.from(bytes.subarray(0, lineEnd));
|
|
83
|
+
}
|
|
62
84
|
/**
|
|
63
85
|
* @description The lines of `transcriptPath` after its LAST `compact_boundary` record (the whole file when there is none),
|
|
64
86
|
* oldest first, keeping only those that hold one of `wantedKeys` — matched on the RAW bytes, so a line that holds none is never
|
|
@@ -92,20 +114,13 @@ function readClaudeTranscriptEpochLines(transcriptPath, wantedKeys) {
|
|
|
92
114
|
position -= length;
|
|
93
115
|
const chunk = Buffer.alloc(length);
|
|
94
116
|
fs.readSync(fd, chunk, 0, length, position);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
continue;
|
|
100
|
-
if (takeLine(bytes.subarray(index + 1, lineEnd)))
|
|
101
|
-
return newestFirst.reverse();
|
|
102
|
-
lineEnd = index;
|
|
103
|
-
}
|
|
104
|
-
bytes = bytes.subarray(0, lineEnd);
|
|
105
|
-
carry = Buffer.from(bytes);
|
|
117
|
+
const rest = takeLinesBackwards(Buffer.concat([chunk, carry]), takeLine);
|
|
118
|
+
if (rest === null)
|
|
119
|
+
return newestFirst.reverse();
|
|
120
|
+
carry = rest;
|
|
106
121
|
}
|
|
107
|
-
if (carry.length > 0
|
|
108
|
-
|
|
122
|
+
if (carry.length > 0)
|
|
123
|
+
takeLine(carry);
|
|
109
124
|
return newestFirst.reverse();
|
|
110
125
|
}
|
|
111
126
|
catch {
|
|
@@ -117,4 +132,49 @@ function readClaudeTranscriptEpochLines(transcriptPath, wantedKeys) {
|
|
|
117
132
|
fs.closeSync(fd);
|
|
118
133
|
}
|
|
119
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* @description Walks the lines of `transcriptPath` after its LAST `compact_boundary` record (the whole file when there is none) from
|
|
137
|
+
* the NEWEST to the oldest, handing each to `onLine` — the same walk as {@link readClaudeTranscriptEpochLines} (a line is split only
|
|
138
|
+
* at newline bytes, a last line without a newline is handed as it is), but asynchronous and holding no line beyond the one in hand, so
|
|
139
|
+
* the bot can look for one record of an epoch of tens of megabytes without blocking its event loop or keeping the epoch in memory.
|
|
140
|
+
* `onLine` returns `true` to stop the walk (the record it looked for was found), `false` to go on. Resolves `false` for a file that
|
|
141
|
+
* cannot be read (what was handed before the failure stands).
|
|
142
|
+
*/
|
|
143
|
+
async function scanClaudeTranscriptEpochBackwards(transcriptPath, onLine) {
|
|
144
|
+
let file;
|
|
145
|
+
try {
|
|
146
|
+
file = await fs.promises.open(transcriptPath, 'r');
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
let position = (await file.stat()).size;
|
|
153
|
+
let carry = Buffer.alloc(0);
|
|
154
|
+
const takeLine = (lineBytes) => {
|
|
155
|
+
if (checkIsCompactBoundaryLine(lineBytes))
|
|
156
|
+
return true;
|
|
157
|
+
return lineBytes.length > 0 && onLine(lineBytes);
|
|
158
|
+
};
|
|
159
|
+
while (position > 0) {
|
|
160
|
+
const length = Math.min(readChunkBytes, position);
|
|
161
|
+
position -= length;
|
|
162
|
+
const chunk = Buffer.alloc(length);
|
|
163
|
+
await file.read(chunk, 0, length, position);
|
|
164
|
+
const rest = takeLinesBackwards(Buffer.concat([chunk, carry]), takeLine);
|
|
165
|
+
if (rest === null)
|
|
166
|
+
return true;
|
|
167
|
+
carry = rest;
|
|
168
|
+
}
|
|
169
|
+
if (carry.length > 0)
|
|
170
|
+
takeLine(carry);
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
await file.close();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
120
180
|
//# sourceMappingURL=claudeTranscriptEpoch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeTranscriptEpoch.js","sourceRoot":"","sources":["../../src/utils/claudeTranscriptEpoch.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"claudeTranscriptEpoch.js","sourceRoot":"","sources":["../../src/utils/claudeTranscriptEpoch.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBH,gEAQC;AAwBD,wEAoCC;AAUD,gFA8BC;AA1HD,uCAAyB;AACzB,mDAAgD;AAEhD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AACnC,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,iHAAiH;AACjH,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AACpD,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAE/D;;;GAGG;AACH,SAAgB,0BAA0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AAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;YAClD,QAAQ,IAAI,MAAM,CAAC;YACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC5C,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;YACzE,IAAI,IAAI,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YAC/B,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
import type { ClaudeProfileRecord } from '../state';
|
|
29
29
|
import { type ClaudeAccountKind, type ClaudeProfileBilling } from './claudeProfiles';
|
|
30
30
|
import type { ClaudeApiSpend } from './claudeApiSpend';
|
|
31
|
+
import type { ClaudeAuthRefusal } from './claudeAuthRefusal';
|
|
31
32
|
import type { ClaudeApiCreditAnchor, ClaudeApiCreditSpend } from './claudeApiCredit';
|
|
33
|
+
import type { WorkerRoleReport } from './workerRoles';
|
|
32
34
|
export declare const claudeUsageEndpoint = "https://api.anthropic.com/api/oauth/usage";
|
|
33
35
|
export declare const claudeUsageFetchTimeoutMs = 15000;
|
|
34
36
|
/** The one usage window kind set, named by what it bounds rather than by the API's spelling. */
|
|
@@ -159,9 +161,14 @@ export declare function checkHasHeadroomForClaudeModel(usage: ClaudeUsageSnapsho
|
|
|
159
161
|
* @description Whether the usage reading SHOWS a window `model` drains at 100 % NOW (`nowMs`) — the proof an
|
|
160
162
|
* unconfirmed usage-limit wording lacks. Unknown figures prove nothing (`false`), unlike
|
|
161
163
|
* {@link checkHasHeadroomForClaudeModel}, which takes an unknown window as covering the model; neither does an
|
|
162
|
-
* out-of-date reading — a snapshot marked stale,
|
|
164
|
+
* out-of-date reading — a snapshot marked stale, a 100 % window whose reset has passed since it was read, or (with
|
|
165
|
+
* `readNotBeforeMs`) one read BEFORE that instant: the boot recovery of a parked error passes the error's own time, since a
|
|
166
|
+
* reading older than the error says nothing about it, and the boot's usage poll — which would mark an unreadable one stale —
|
|
167
|
+
* may not have run yet.
|
|
163
168
|
*/
|
|
164
|
-
export declare function checkIsClaudeUsageExhausted(usage: ClaudeUsageSnapshot | undefined, model: string | null, nowMs: number
|
|
169
|
+
export declare function checkIsClaudeUsageExhausted(usage: ClaudeUsageSnapshot | undefined, model: string | null, nowMs: number, options?: {
|
|
170
|
+
readNotBeforeMs?: number;
|
|
171
|
+
}): boolean;
|
|
165
172
|
/**
|
|
166
173
|
* @description Whether every window a launch of `model` drains that the snapshot carries has passed its reset instant by
|
|
167
174
|
* `nowMs` — the clock proves the windows that were read are OVER, whether or not the snapshot could be re-read (an account no
|
|
@@ -188,6 +195,8 @@ export interface ClaudeProfileUsageView {
|
|
|
188
195
|
subscriptionType: string | null;
|
|
189
196
|
usage: ClaudeUsageSnapshot | undefined;
|
|
190
197
|
limitedUntil: string | null;
|
|
198
|
+
/** The CLI refused the account on a turn (`utils/claudeAuthRefusal.ts`); `loggedIn` is `false` while it stands. Absent = none. */
|
|
199
|
+
authRefusal?: ClaudeAuthRefusal;
|
|
191
200
|
/** How the account pays; `null` when never recorded (a subscription account added before billing was). */
|
|
192
201
|
billing: ClaudeProfileBilling | null;
|
|
193
202
|
/** Until when agents are not pointed at it (a worker's stop report not proven by the API, `claudeApiAgentStop.ts`); absent = no hold. Read by the agent pick ONLY — topics read `limitedUntil`. */
|
|
@@ -219,8 +228,10 @@ export interface ClaudeProfileReportEntry {
|
|
|
219
228
|
* credit lasts); with no such rung only a warm session already on it stays. `null`: a subscription not recorded as such.
|
|
220
229
|
*/
|
|
221
230
|
billing: ClaudeProfileBilling | null;
|
|
222
|
-
/** `null` when never probed. */
|
|
231
|
+
/** `null` when never probed; `false` also while the CLI's refusal of it stands (`authRefusal`). */
|
|
223
232
|
loggedIn: boolean | null;
|
|
233
|
+
/** The CLI refused the account on a turn and it was not signed in again since (`utils/claudeAuthRefusal.ts`); `null` = no refusal. */
|
|
234
|
+
authRefusal: ClaudeAuthRefusal | null;
|
|
224
235
|
/** The windows as read, their used percent against the clock ({@link getClaudeUsagePercentAsOf}): one whose reset has passed since it was read is 0 % — its `resetsAt` stays the instant that passed, no next reset is estimated. */
|
|
225
236
|
buckets: ClaudeUsageBucket[];
|
|
226
237
|
usageFetchedAt: string | null;
|
|
@@ -258,6 +269,20 @@ export interface ClaudeProfilesReport {
|
|
|
258
269
|
pickReason: ClaudeLaunchPickReason;
|
|
259
270
|
/** With nothing usable: the account and instant that frees up first, so a resume can be scheduled for it. */
|
|
260
271
|
nextAvailable: ClaudeNextAvailable | null;
|
|
272
|
+
/**
|
|
273
|
+
* The accounts a launch of `model` may go to, best first — what `recommended` is the head of for a new agent (a resumed session's
|
|
274
|
+
* own account is left out of it, see {@link getClaudeLaunchOrder}). An API-billed account is in it only when a launch would
|
|
275
|
+
* really use it: the `/limits` list holds it, it is signed in, not limited, not held off agents, its credit not used up.
|
|
276
|
+
*/
|
|
277
|
+
launchOrder: string[];
|
|
278
|
+
/**
|
|
279
|
+
* What to do with the worker whose session is being resumed (only when the caller passed `currentProfile`): resume it where it
|
|
280
|
+
* ran, or hand its work to a NEW worker on another account ({@link getClaudeResumeAdvice}). `null`: nothing is usable, so there is
|
|
281
|
+
* nothing to advise — `nextAvailable` says when to try again.
|
|
282
|
+
*/
|
|
283
|
+
resume?: ClaudeResumeAdvice | null;
|
|
284
|
+
/** Only for a query by worker role: the role's default CLI, model and effort, and whether it can run here (`utils/workerRoles.ts`). */
|
|
285
|
+
worker?: WorkerRoleReport;
|
|
261
286
|
profiles: ClaudeProfileReportEntry[];
|
|
262
287
|
}
|
|
263
288
|
/** A new agent never starts on an account whose five-hour window is already this full: it would hit the limit within minutes. */
|
|
@@ -295,6 +320,10 @@ export interface ClaudeLaunchPickOptions {
|
|
|
295
320
|
/** API accounts whose credit has run out by the operator's own expiry day: not sent a NEW agent first (the credit module is out of this file's reach, the caller works it out). */
|
|
296
321
|
expiredApiNames?: ReadonlySet<string>;
|
|
297
322
|
}
|
|
323
|
+
/** What a report needs besides the pick's own options: when the resumed worker's last run ended (`null` / absent = unknown, so cold). */
|
|
324
|
+
export interface ClaudeProfilesReportOptions extends ClaudeLaunchPickOptions {
|
|
325
|
+
lastRunEndedAtMs?: number | null;
|
|
326
|
+
}
|
|
298
327
|
/**
|
|
299
328
|
* What the operator's `/limits` auto-switch list (the fallback chain) says about the Claude accounts an AGENT may be pointed
|
|
300
329
|
* at: once the list names any Claude account, only the accounts with an ENABLED rung are recommended — to a new agent and
|
|
@@ -343,6 +372,19 @@ export declare function checkIsClaudeProfileLaunchable(profile: ClaudeProfileUsa
|
|
|
343
372
|
* own topic switch (`claudeLimitSwitch.ts`) — ONE ranking.
|
|
344
373
|
*/
|
|
345
374
|
export declare function sortClaudeProfilesByLaunchRank<T extends ClaudeProfileUsageView>(profiles: readonly T[], model: string | null, nowMs: number): T[];
|
|
375
|
+
/**
|
|
376
|
+
* @description The accounts a launch of `model` may go to, best first — THE one order of the launch rule, which
|
|
377
|
+
* {@link getClaudeLaunchPick} takes its head from and the report hands to its readers as `launchOrder`: first the accounts billed
|
|
378
|
+
* to API credits the operator's `/limits` list holds that can launch ({@link checkIsClaudeApiProfileLaunchable}; the list's own
|
|
379
|
+
* order among them), then the usable subscription accounts in {@link sortClaudeProfilesByLaunchRank} order. An account the list
|
|
380
|
+
* keeps off agents is never in it; `excludedName` is the account a resumed session leaves.
|
|
381
|
+
*/
|
|
382
|
+
export declare function getClaudeLaunchOrder(input: Pick<ClaudeLaunchPickOptions, 'chainScope' | 'expiredApiNames'> & {
|
|
383
|
+
profiles: readonly ClaudeProfileUsageView[];
|
|
384
|
+
model: string | null;
|
|
385
|
+
nowMs: number;
|
|
386
|
+
excludedName?: string | null;
|
|
387
|
+
}): ClaudeProfileUsageView[];
|
|
346
388
|
/**
|
|
347
389
|
* @description The account a process of `model` should run on.
|
|
348
390
|
*
|
|
@@ -368,7 +410,7 @@ export declare function sortClaudeProfilesByLaunchRank<T extends ClaudeProfileUs
|
|
|
368
410
|
* follows the new-agent rule, and the reason says the session moved (`movedFromLimited`, or `movedFromUnavailable` when the
|
|
369
411
|
* account could no longer run by its own figures or the list).
|
|
370
412
|
*
|
|
371
|
-
*
|
|
413
|
+
* Whoever is not warm gets the head of {@link getClaudeLaunchOrder}; nothing usable → `pick: null` and {@link ClaudeLaunchPick.nextAvailable}.
|
|
372
414
|
*/
|
|
373
415
|
export declare function getClaudeLaunchPick(input: ClaudeLaunchPickOptions & {
|
|
374
416
|
profiles: readonly ClaudeProfileUsageView[];
|
|
@@ -377,10 +419,64 @@ export declare function getClaudeLaunchPick(input: ClaudeLaunchPickOptions & {
|
|
|
377
419
|
}): ClaudeLaunchPick;
|
|
378
420
|
/**
|
|
379
421
|
* @description The pick in words, for the first line of the `claude_profiles` answer and the CLI: why the account was chosen
|
|
380
|
-
* (`stays on the warm account`,
|
|
422
|
+
* (`stays on the warm account`, or with a cold worker the resume advice keeps in place `stays on its own account — cold, but nothing better is
|
|
423
|
+
* open`, `moved: <name> stopped on a limit` / `can no longer run`, `soonest weekly reset`, `API credit first`), or that nothing is usable
|
|
381
424
|
* and which account frees up when. `currentProfile` is the account the caller passed for a resumed session.
|
|
382
425
|
*/
|
|
383
|
-
export declare function describeClaudeLaunchOutcome(report: Pick<ClaudeProfilesReport, 'pickReason' | 'nextAvailable'>, currentProfile: string | null): string;
|
|
426
|
+
export declare function describeClaudeLaunchOutcome(report: Pick<ClaudeProfilesReport, 'pickReason' | 'nextAvailable' | 'resume'>, currentProfile: string | null): string;
|
|
427
|
+
/**
|
|
428
|
+
* A worker whose last run ended less than this ago still has a warm prompt cache: the idle mark, which sits just inside the cache's
|
|
429
|
+
* hour (`idleCompactMs`). Past it a resume re-reads everything anyway, so it gains nothing by staying on its account.
|
|
430
|
+
*/
|
|
431
|
+
export declare const claudeResumeWarmWindowMs: number;
|
|
432
|
+
/** `resume`: the worker's session goes on under `profile`; `handOver`: its work goes to a NEW worker on `profile`. */
|
|
433
|
+
export type ClaudeResumeVerdict = 'resume' | 'handOver';
|
|
434
|
+
/**
|
|
435
|
+
* Why: `warm` — it can run where it ran and its cache is warm; `coldStays` — cold, but nothing better is open than its own account;
|
|
436
|
+
* `stoppedByLimit` — it broke off MID-RUN on a usage limit, so its same session goes on at once under the next account (a fresh worker
|
|
437
|
+
* would redo the unfinished run); `cannotRun` — its account can no longer run it (signed out, limited, out of the `/limits` list,
|
|
438
|
+
* full); `cold` — its cache is cold and the launch rule now names another account.
|
|
439
|
+
*/
|
|
440
|
+
export type ClaudeResumeReason = 'warm' | 'coldStays' | 'stoppedByLimit' | 'cannotRun' | 'cold';
|
|
441
|
+
/** What to do with a worker being resumed, and under which account. */
|
|
442
|
+
export interface ClaudeResumeAdvice {
|
|
443
|
+
verdict: ClaudeResumeVerdict;
|
|
444
|
+
/** `resume`: the account to resume the session under; `handOver`: the account of the NEW worker. */
|
|
445
|
+
profile: string;
|
|
446
|
+
reason: ClaudeResumeReason;
|
|
447
|
+
/**
|
|
448
|
+
* Why the launch rule named `profile`. A worker's own account reads `warm` — that only means «the launch rule keeps the worker on its
|
|
449
|
+
* own account» (it can run there), NOT that its prompt cache is warm: `reason` says that (`warm` against `coldStays`).
|
|
450
|
+
*/
|
|
451
|
+
pickReason: ClaudeLaunchPickReason;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* @description Resume the worker where it ran, or give its work to a NEW worker on another account — the owner's rule: an old worker is
|
|
455
|
+
* never dragged onto another account, except one cut off mid-run by a usage limit (its same session resumes at once on the next
|
|
456
|
+
* account). `warmPick` is {@link getClaudeLaunchPick} with the worker's `currentProfile` (and the limit stop), `freshPick` the same
|
|
457
|
+
* without them — what a NEW worker would get. In order:
|
|
458
|
+
* - nothing usable (`warmPick.pick` null) → `null`;
|
|
459
|
+
* - stopped mid-run by a limit → `resume` on `warmPick.pick`;
|
|
460
|
+
* - its account can no longer run (`warmPick` names another) → `handOver` to `warmPick.pick`;
|
|
461
|
+
* - its last run ended less than {@link claudeResumeWarmWindowMs} ago → `resume` where it ran (the cache is warm, the cheapest step);
|
|
462
|
+
* - cold (also when `lastRunEndedAtMs` is unknown) and `freshPick` names another account → `handOver` to it; else `resume` where it ran.
|
|
463
|
+
*/
|
|
464
|
+
export declare function getClaudeResumeAdvice(input: {
|
|
465
|
+
warmPick: ClaudeLaunchPick;
|
|
466
|
+
freshPick: ClaudeLaunchPick;
|
|
467
|
+
currentProfile: string;
|
|
468
|
+
lastRunEndedAtMs: number | null;
|
|
469
|
+
isStoppedByLimit: boolean;
|
|
470
|
+
nowMs: number;
|
|
471
|
+
}): ClaudeResumeAdvice | null;
|
|
472
|
+
/** How to start a process on the account `name`: its `CLAUDE_CONFIG_DIR`, or «set nothing» for the default profile. */
|
|
473
|
+
export declare function describeClaudeProfileLaunch(report: Pick<ClaudeProfilesReport, 'profiles'>, name: string): string;
|
|
474
|
+
/**
|
|
475
|
+
* @description The hand-over in words, for the first line of the `claude_profiles` answer and the CLI: why the old worker is not resumed
|
|
476
|
+
* on another account, which account the NEW worker goes to and how it starts, and who may take over the old worker's findings.
|
|
477
|
+
* `null` for any other verdict (and without `resume`).
|
|
478
|
+
*/
|
|
479
|
+
export declare function describeClaudeResumeHandOver(report: Pick<ClaudeProfilesReport, 'resume' | 'profiles'>, currentProfile: string | null): string | null;
|
|
384
480
|
/**
|
|
385
481
|
* @description The accounts the `/limits` list keeps agents off, one clause per reason (`not offered — not in the /limits list:
|
|
386
482
|
* a, b; switched off in the /limits list: c`), or `null` when there are none. The first lines of the `claude_profiles` answer
|
|
@@ -400,7 +496,7 @@ export declare function describeClaudeChainExclusions(report: Pick<ClaudeProfile
|
|
|
400
496
|
* an agent or an operator — the `claude_profiles` tool, `charness claude-profiles` — uses `buildClaudeProfilesCreditReport`
|
|
401
497
|
* (`utils/claudeProfileUsageViews.ts`) instead; this builder is for the ranking (`fallbackChain.ts` reads `isEligible`).
|
|
402
498
|
*/
|
|
403
|
-
export declare function buildClaudeProfilesReport(profiles: readonly ClaudeProfileUsageView[], model: string | null, nowMs: number, options?:
|
|
499
|
+
export declare function buildClaudeProfilesReport(profiles: readonly ClaudeProfileUsageView[], model: string | null, nowMs: number, options?: ClaudeProfilesReportOptions): ClaudeProfilesReport;
|
|
404
500
|
/** The profile registry out of a `state.json` already read (`stateFile.ts`): entries without a creation time are dropped. */
|
|
405
501
|
export declare function getClaudeProfileRecordsFromState(stateFile: Readonly<Record<string, unknown>>): Readonly<Record<string, ClaudeProfileRecord>>;
|
|
406
502
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeUsage.d.ts","sourceRoot":"","sources":["../../src/utils/claudeUsage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAA8C,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACjI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGrF,eAAO,MAAM,mBAAmB,8CAA8C,CAAC;AAK/E,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAKhD,gGAAgG;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C,KAAK,CAAC,EAAE,wBAAwB,CAAA;CAAO,GAC5F,MAAM,CASR"}
|
|
@@ -60,7 +60,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
60
60
|
};
|
|
61
61
|
})();
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports.englishRelativeResetWords = exports.claudeChainExclusionWords = exports.claudeChainExclusions = exports.claudeSessionWindowMs = exports.claudeWeeklyWindowMs = exports.claudeLaunchResetTieMs = exports.claudeLaunchSessionCeilingPercent = exports.claudeUsageBucketKinds = exports.claudeUsageFetchTimeoutMs = exports.claudeUsageEndpoint = void 0;
|
|
63
|
+
exports.englishRelativeResetWords = exports.claudeResumeWarmWindowMs = exports.claudeChainExclusionWords = exports.claudeChainExclusions = exports.claudeSessionWindowMs = exports.claudeWeeklyWindowMs = exports.claudeLaunchResetTieMs = exports.claudeLaunchSessionCeilingPercent = exports.claudeUsageBucketKinds = exports.claudeUsageFetchTimeoutMs = exports.claudeUsageEndpoint = void 0;
|
|
64
64
|
exports.readClaudeOAuthToken = readClaudeOAuthToken;
|
|
65
65
|
exports.checkIsClaudeTokenExpired = checkIsClaudeTokenExpired;
|
|
66
66
|
exports.fetchUsageBuckets = fetchUsageBuckets;
|
|
@@ -82,8 +82,12 @@ exports.getClaudeUsagePercentAsOf = getClaudeUsagePercentAsOf;
|
|
|
82
82
|
exports.getClaudeUsageBucketAsOf = getClaudeUsageBucketAsOf;
|
|
83
83
|
exports.checkIsClaudeProfileLaunchable = checkIsClaudeProfileLaunchable;
|
|
84
84
|
exports.sortClaudeProfilesByLaunchRank = sortClaudeProfilesByLaunchRank;
|
|
85
|
+
exports.getClaudeLaunchOrder = getClaudeLaunchOrder;
|
|
85
86
|
exports.getClaudeLaunchPick = getClaudeLaunchPick;
|
|
86
87
|
exports.describeClaudeLaunchOutcome = describeClaudeLaunchOutcome;
|
|
88
|
+
exports.getClaudeResumeAdvice = getClaudeResumeAdvice;
|
|
89
|
+
exports.describeClaudeProfileLaunch = describeClaudeProfileLaunch;
|
|
90
|
+
exports.describeClaudeResumeHandOver = describeClaudeResumeHandOver;
|
|
87
91
|
exports.describeClaudeChainExclusions = describeClaudeChainExclusions;
|
|
88
92
|
exports.buildClaudeProfilesReport = buildClaudeProfilesReport;
|
|
89
93
|
exports.getClaudeProfileRecordsFromState = getClaudeProfileRecordsFromState;
|
|
@@ -94,6 +98,7 @@ const fs = __importStar(require("fs"));
|
|
|
94
98
|
const path = __importStar(require("path"));
|
|
95
99
|
const claudeProfiles_1 = require("./claudeProfiles");
|
|
96
100
|
const checkIsRecord_1 = require("./checkIsRecord");
|
|
101
|
+
const compactOnIdle_1 = require("./compactOnIdle");
|
|
97
102
|
exports.claudeUsageEndpoint = 'https://api.anthropic.com/api/oauth/usage';
|
|
98
103
|
/** The OAuth beta header the CLI sends with its subscription token. */
|
|
99
104
|
const claudeOAuthBetaHeader = 'oauth-2025-04-20';
|
|
@@ -295,11 +300,19 @@ function checkHasHeadroomForClaudeModel(usage, model, nowMs) {
|
|
|
295
300
|
* @description Whether the usage reading SHOWS a window `model` drains at 100 % NOW (`nowMs`) — the proof an
|
|
296
301
|
* unconfirmed usage-limit wording lacks. Unknown figures prove nothing (`false`), unlike
|
|
297
302
|
* {@link checkHasHeadroomForClaudeModel}, which takes an unknown window as covering the model; neither does an
|
|
298
|
-
* out-of-date reading — a snapshot marked stale,
|
|
303
|
+
* out-of-date reading — a snapshot marked stale, a 100 % window whose reset has passed since it was read, or (with
|
|
304
|
+
* `readNotBeforeMs`) one read BEFORE that instant: the boot recovery of a parked error passes the error's own time, since a
|
|
305
|
+
* reading older than the error says nothing about it, and the boot's usage poll — which would mark an unreadable one stale —
|
|
306
|
+
* may not have run yet.
|
|
299
307
|
*/
|
|
300
|
-
function checkIsClaudeUsageExhausted(usage, model, nowMs) {
|
|
308
|
+
function checkIsClaudeUsageExhausted(usage, model, nowMs, options = {}) {
|
|
301
309
|
if (!usage || usage.isStale === true)
|
|
302
310
|
return false;
|
|
311
|
+
if (options.readNotBeforeMs !== undefined) {
|
|
312
|
+
const fetchedAtMs = Date.parse(usage.fetchedAt);
|
|
313
|
+
if (!Number.isFinite(fetchedAtMs) || fetchedAtMs < options.readNotBeforeMs)
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
303
316
|
return getRelevantClaudeUsageKinds(model).some((kind) => {
|
|
304
317
|
const bucket = getClaudeUsageBucket(usage, kind);
|
|
305
318
|
return bucket !== null && getClaudeUsagePercentAsOf(bucket, nowMs) >= 100;
|
|
@@ -552,6 +565,24 @@ function checkIsClaudeApiProfileLaunchable(profile, chainScope, expiredApiNames,
|
|
|
552
565
|
return chainScope !== null && chainScope.enabledNames.has(profile.name) && !expiredApiNames.has(profile.name)
|
|
553
566
|
&& !checkIsClaudeProfileHeldFromAgents(profile, nowMs) && checkIsClaudeProfileEligible(profile, [], nowMs);
|
|
554
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* @description The accounts a launch of `model` may go to, best first — THE one order of the launch rule, which
|
|
570
|
+
* {@link getClaudeLaunchPick} takes its head from and the report hands to its readers as `launchOrder`: first the accounts billed
|
|
571
|
+
* to API credits the operator's `/limits` list holds that can launch ({@link checkIsClaudeApiProfileLaunchable}; the list's own
|
|
572
|
+
* order among them), then the usable subscription accounts in {@link sortClaudeProfilesByLaunchRank} order. An account the list
|
|
573
|
+
* keeps off agents is never in it; `excludedName` is the account a resumed session leaves.
|
|
574
|
+
*/
|
|
575
|
+
function getClaudeLaunchOrder(input) {
|
|
576
|
+
const chainScope = input.chainScope ?? null;
|
|
577
|
+
const expiredApiNames = input.expiredApiNames ?? new Set();
|
|
578
|
+
const allowed = input.profiles.filter((profile) => profile.name !== (input.excludedName ?? null) && getClaudeChainExclusion(profile.name, chainScope) === null);
|
|
579
|
+
const chainOrder = chainScope === null ? [] : [...chainScope.enabledNames];
|
|
580
|
+
const apiFirst = allowed
|
|
581
|
+
.filter((profile) => profile.billing === 'api' && checkIsClaudeApiProfileLaunchable(profile, chainScope, expiredApiNames, input.nowMs))
|
|
582
|
+
.sort((a, b) => chainOrder.indexOf(a.name) - chainOrder.indexOf(b.name));
|
|
583
|
+
const subscriptions = sortClaudeProfilesByLaunchRank(allowed.filter((profile) => profile.billing !== 'api' && checkIsClaudeProfileLaunchable(profile, input.model, input.nowMs)), input.model, input.nowMs);
|
|
584
|
+
return [...apiFirst, ...subscriptions];
|
|
585
|
+
}
|
|
555
586
|
/**
|
|
556
587
|
* @description The account a process of `model` should run on.
|
|
557
588
|
*
|
|
@@ -577,27 +608,21 @@ function checkIsClaudeApiProfileLaunchable(profile, chainScope, expiredApiNames,
|
|
|
577
608
|
* follows the new-agent rule, and the reason says the session moved (`movedFromLimited`, or `movedFromUnavailable` when the
|
|
578
609
|
* account could no longer run by its own figures or the list).
|
|
579
610
|
*
|
|
580
|
-
*
|
|
611
|
+
* Whoever is not warm gets the head of {@link getClaudeLaunchOrder}; nothing usable → `pick: null` and {@link ClaudeLaunchPick.nextAvailable}.
|
|
581
612
|
*/
|
|
582
613
|
function getClaudeLaunchPick(input) {
|
|
583
614
|
const chainScope = input.chainScope ?? null;
|
|
584
615
|
const expiredApiNames = input.expiredApiNames ?? new Set();
|
|
585
616
|
const current = input.currentProfile ? input.profiles.find((profile) => profile.name === input.currentProfile) : undefined;
|
|
586
617
|
const isStopped = current !== undefined && input.isStoppedByLimit === true;
|
|
618
|
+
const movedFrom = current?.name ?? null;
|
|
587
619
|
if (current && !isStopped
|
|
588
620
|
&& getClaudeChainExclusion(current.name, chainScope) === null
|
|
589
621
|
&& !checkIsClaudeProfileHeldFromAgents(current, input.nowMs)
|
|
590
622
|
&& checkIsClaudeProfileEligible(current, getRelevantClaudeBucketsAsOf(current, input.model, input.nowMs), input.nowMs)) {
|
|
591
623
|
return { pick: current.name, reason: 'warm', nextAvailable: null };
|
|
592
624
|
}
|
|
593
|
-
const
|
|
594
|
-
const allowed = input.profiles.filter((profile) => profile.name !== movedFrom && getClaudeChainExclusion(profile.name, chainScope) === null);
|
|
595
|
-
const chainOrder = chainScope === null ? [] : [...chainScope.enabledNames];
|
|
596
|
-
const apiFirst = allowed
|
|
597
|
-
.filter((profile) => profile.billing === 'api' && checkIsClaudeApiProfileLaunchable(profile, chainScope, expiredApiNames, input.nowMs))
|
|
598
|
-
.sort((a, b) => chainOrder.indexOf(a.name) - chainOrder.indexOf(b.name));
|
|
599
|
-
const subscriptions = sortClaudeProfilesByLaunchRank(allowed.filter((profile) => profile.billing !== 'api' && checkIsClaudeProfileLaunchable(profile, input.model, input.nowMs)), input.model, input.nowMs);
|
|
600
|
-
const [first] = [...apiFirst, ...subscriptions];
|
|
625
|
+
const [first] = getClaudeLaunchOrder({ ...input, excludedName: movedFrom });
|
|
601
626
|
if (first) {
|
|
602
627
|
const reason = movedFrom !== null ? (isStopped ? 'movedFromLimited' : 'movedFromUnavailable') : first.billing === 'api' ? 'apiCreditFirst' : 'soonestWeeklyReset';
|
|
603
628
|
return { pick: first.name, reason, nextAvailable: null };
|
|
@@ -610,13 +635,15 @@ function getClaudeLaunchPick(input) {
|
|
|
610
635
|
}
|
|
611
636
|
/**
|
|
612
637
|
* @description The pick in words, for the first line of the `claude_profiles` answer and the CLI: why the account was chosen
|
|
613
|
-
* (`stays on the warm account`,
|
|
638
|
+
* (`stays on the warm account`, or with a cold worker the resume advice keeps in place `stays on its own account — cold, but nothing better is
|
|
639
|
+
* open`, `moved: <name> stopped on a limit` / `can no longer run`, `soonest weekly reset`, `API credit first`), or that nothing is usable
|
|
614
640
|
* and which account frees up when. `currentProfile` is the account the caller passed for a resumed session.
|
|
615
641
|
*/
|
|
616
642
|
function describeClaudeLaunchOutcome(report, currentProfile) {
|
|
617
643
|
switch (report.pickReason) {
|
|
618
644
|
case 'warm':
|
|
619
|
-
|
|
645
|
+
// `warm` is the launch rule's word for «keeps its own account»; with a resume advice the cache's own state is known.
|
|
646
|
+
return report.resume?.reason === 'coldStays' ? 'stays on its own account — cold, but nothing better is open' : 'stays on the warm account';
|
|
620
647
|
case 'movedFromLimited':
|
|
621
648
|
return `moved: ${currentProfile ?? 'the warm account'} stopped on a limit`;
|
|
622
649
|
case 'movedFromUnavailable':
|
|
@@ -631,6 +658,57 @@ function describeClaudeLaunchOutcome(report, currentProfile) {
|
|
|
631
658
|
: `none usable — next: ${report.nextAvailable.profile} at ${report.nextAvailable.at}`;
|
|
632
659
|
}
|
|
633
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* A worker whose last run ended less than this ago still has a warm prompt cache: the idle mark, which sits just inside the cache's
|
|
663
|
+
* hour (`idleCompactMs`). Past it a resume re-reads everything anyway, so it gains nothing by staying on its account.
|
|
664
|
+
*/
|
|
665
|
+
exports.claudeResumeWarmWindowMs = compactOnIdle_1.idleCompactMs;
|
|
666
|
+
const msPerMinute = 60_000;
|
|
667
|
+
/**
|
|
668
|
+
* @description Resume the worker where it ran, or give its work to a NEW worker on another account — the owner's rule: an old worker is
|
|
669
|
+
* never dragged onto another account, except one cut off mid-run by a usage limit (its same session resumes at once on the next
|
|
670
|
+
* account). `warmPick` is {@link getClaudeLaunchPick} with the worker's `currentProfile` (and the limit stop), `freshPick` the same
|
|
671
|
+
* without them — what a NEW worker would get. In order:
|
|
672
|
+
* - nothing usable (`warmPick.pick` null) → `null`;
|
|
673
|
+
* - stopped mid-run by a limit → `resume` on `warmPick.pick`;
|
|
674
|
+
* - its account can no longer run (`warmPick` names another) → `handOver` to `warmPick.pick`;
|
|
675
|
+
* - its last run ended less than {@link claudeResumeWarmWindowMs} ago → `resume` where it ran (the cache is warm, the cheapest step);
|
|
676
|
+
* - cold (also when `lastRunEndedAtMs` is unknown) and `freshPick` names another account → `handOver` to it; else `resume` where it ran.
|
|
677
|
+
*/
|
|
678
|
+
function getClaudeResumeAdvice(input) {
|
|
679
|
+
const { warmPick, freshPick, currentProfile } = input;
|
|
680
|
+
if (warmPick.pick === null)
|
|
681
|
+
return null;
|
|
682
|
+
if (input.isStoppedByLimit)
|
|
683
|
+
return { verdict: 'resume', profile: warmPick.pick, reason: 'stoppedByLimit', pickReason: warmPick.reason };
|
|
684
|
+
if (warmPick.pick !== currentProfile)
|
|
685
|
+
return { verdict: 'handOver', profile: warmPick.pick, reason: 'cannotRun', pickReason: warmPick.reason };
|
|
686
|
+
const isWarm = input.lastRunEndedAtMs !== null && input.nowMs - input.lastRunEndedAtMs < exports.claudeResumeWarmWindowMs;
|
|
687
|
+
if (!isWarm && freshPick.pick !== null && freshPick.pick !== currentProfile) {
|
|
688
|
+
return { verdict: 'handOver', profile: freshPick.pick, reason: 'cold', pickReason: freshPick.reason };
|
|
689
|
+
}
|
|
690
|
+
return { verdict: 'resume', profile: currentProfile, reason: isWarm ? 'warm' : 'coldStays', pickReason: warmPick.reason };
|
|
691
|
+
}
|
|
692
|
+
/** How to start a process on the account `name`: its `CLAUDE_CONFIG_DIR`, or «set nothing» for the default profile. */
|
|
693
|
+
function describeClaudeProfileLaunch(report, name) {
|
|
694
|
+
const configDir = report.profiles.find((profile) => profile.name === name)?.configDir ?? null;
|
|
695
|
+
return configDir === null ? 'default profile, set no CLAUDE_CONFIG_DIR' : `CLAUDE_CONFIG_DIR=${configDir}`;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* @description The hand-over in words, for the first line of the `claude_profiles` answer and the CLI: why the old worker is not resumed
|
|
699
|
+
* on another account, which account the NEW worker goes to and how it starts, and who may take over the old worker's findings.
|
|
700
|
+
* `null` for any other verdict (and without `resume`).
|
|
701
|
+
*/
|
|
702
|
+
function describeClaudeResumeHandOver(report, currentProfile) {
|
|
703
|
+
const advice = report.resume;
|
|
704
|
+
if (advice?.verdict !== 'handOver')
|
|
705
|
+
return null;
|
|
706
|
+
const old = currentProfile ?? 'its account';
|
|
707
|
+
const why = advice.reason === 'cold'
|
|
708
|
+
? `${old} is cold (its last run ended ${Math.round(exports.claudeResumeWarmWindowMs / msPerMinute)} min ago or more, or at an unknown time) and ${advice.profile} is the pick now (${describeClaudeLaunchOutcome({ pickReason: advice.pickReason, nextAvailable: null }, currentProfile)})`
|
|
709
|
+
: `${old} can no longer run this worker`;
|
|
710
|
+
return `hand over: ${why} → start a NEW worker on ${advice.profile} (${describeClaudeProfileLaunch(report, advice.profile)}); a reviewer already on ${advice.profile} may apply its own findings, then a fresh reviewer checks.`;
|
|
711
|
+
}
|
|
634
712
|
/**
|
|
635
713
|
* @description The accounts the `/limits` list keeps agents off, one clause per reason (`not offered — not in the /limits list:
|
|
636
714
|
* a, b; switched off in the /limits list: c`), or `null` when there are none. The first lines of the `claude_profiles` answer
|
|
@@ -682,6 +760,7 @@ function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
|
|
|
682
760
|
subscriptionType: profile.subscriptionType,
|
|
683
761
|
billing: profile.billing,
|
|
684
762
|
loggedIn: profile.loggedIn ?? null,
|
|
763
|
+
authRefusal: profile.authRefusal ?? null,
|
|
685
764
|
buckets: (profile.usage?.buckets ?? []).map((bucket) => ({ ...bucket, percent: getClaudeUsagePercentAsOf(bucket, nowMs) })),
|
|
686
765
|
usageFetchedAt: profile.usage?.fetchedAt ?? null,
|
|
687
766
|
isUsageStale: profile.usage?.isStale === true,
|
|
@@ -695,10 +774,24 @@ function buildClaudeProfilesReport(profiles, model, nowMs, options = {}) {
|
|
|
695
774
|
};
|
|
696
775
|
});
|
|
697
776
|
const launch = getClaudeLaunchPick({ ...options, profiles, model, nowMs });
|
|
777
|
+
const launchOrder = getClaudeLaunchOrder({ ...options, profiles, model, nowMs, excludedName: options.currentProfile ?? null }).map((profile) => profile.name);
|
|
698
778
|
const recommended = entries.find((entry) => entry.name === launch.pick);
|
|
699
779
|
if (recommended)
|
|
700
780
|
recommended.isRecommended = true;
|
|
701
|
-
|
|
781
|
+
const report = { model, relevantBuckets, recommended: launch.pick, pickReason: launch.reason, nextAvailable: launch.nextAvailable, launchOrder, profiles: entries };
|
|
782
|
+
if (options.currentProfile) {
|
|
783
|
+
// What a NEW worker would get: the same pick without the warm account and the limit stop.
|
|
784
|
+
const freshPick = getClaudeLaunchPick({ ...options, currentProfile: null, isStoppedByLimit: false, profiles, model, nowMs });
|
|
785
|
+
report.resume = getClaudeResumeAdvice({
|
|
786
|
+
warmPick: launch,
|
|
787
|
+
freshPick,
|
|
788
|
+
currentProfile: options.currentProfile,
|
|
789
|
+
lastRunEndedAtMs: options.lastRunEndedAtMs ?? null,
|
|
790
|
+
isStoppedByLimit: options.isStoppedByLimit === true,
|
|
791
|
+
nowMs,
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
return report;
|
|
702
795
|
}
|
|
703
796
|
/** The profile registry out of a `state.json` already read (`stateFile.ts`): entries without a creation time are dropped. */
|
|
704
797
|
function getClaudeProfileRecordsFromState(stateFile) {
|