charness 4.1.1 → 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 +186 -2
- package/DEVELOPMENT.md +65 -11
- package/LICENSE +331 -151
- package/MIGRATION_3_TO_4.md +8 -5
- package/README.md +23 -8
- package/SETUP.md +57 -11
- package/agent-plugin/README.md +10 -3
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +18 -26
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +5 -3
- package/agent-plugin/skills/charness-orchestration/SKILL.md +57 -16
- package/dist/adapters/adapterNames.d.ts +2 -0
- package/dist/adapters/adapterNames.d.ts.map +1 -1
- package/dist/adapters/adapterNames.js +3 -1
- package/dist/adapters/adapterNames.js.map +1 -1
- 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 +150 -10
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +401 -83
- 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 +65 -2
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +202 -19
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/adapters/terminalAdapter.d.ts.map +1 -1
- package/dist/adapters/terminalAdapter.js +2 -1
- package/dist/adapters/terminalAdapter.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 +2586 -693
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +31 -6
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +97 -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/botCore.d.ts +5 -2
- package/dist/connectors/telegram/commands/botCore.d.ts.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 +11 -0
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +36 -42
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +20 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +268 -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/questionSetAside.d.ts +111 -0
- package/dist/connectors/telegram/commands/questionSetAside.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/questionSetAside.js +637 -0
- package/dist/connectors/telegram/commands/questionSetAside.js.map +1 -0
- package/dist/connectors/telegram/commands/questionWait.d.ts +21 -0
- package/dist/connectors/telegram/commands/questionWait.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/questionWait.js +109 -0
- package/dist/connectors/telegram/commands/questionWait.js.map +1 -0
- package/dist/connectors/telegram/commands/topicAccess.js +1 -1
- package/dist/connectors/telegram/commands/topicAccess.js.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.d.ts +0 -2
- package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.js +11 -7
- package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
- package/dist/connectors/telegram/commands/topicStatus.d.ts +24 -0
- package/dist/connectors/telegram/commands/topicStatus.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/topicStatus.js +148 -0
- package/dist/connectors/telegram/commands/topicStatus.js.map +1 -0
- 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/firstUpdateBatchNote.d.ts +30 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.d.ts.map +1 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.js +39 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.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 +19 -0
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +41 -3
- 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 +86 -0
- package/dist/connectors/telegram/topicIndicator.d.ts.map +1 -0
- package/dist/connectors/telegram/topicIndicator.js +588 -0
- package/dist/connectors/telegram/topicIndicator.js.map +1 -0
- package/dist/connectors/telegram/waitingTopicRenames.d.ts +39 -0
- package/dist/connectors/telegram/waitingTopicRenames.d.ts.map +1 -0
- package/dist/connectors/telegram/waitingTopicRenames.js +48 -0
- package/dist/connectors/telegram/waitingTopicRenames.js.map +1 -0
- 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 +141 -13
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +141 -13
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +141 -13
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +141 -13
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +141 -13
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +141 -13
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +141 -13
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +141 -13
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +141 -13
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +141 -13
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +141 -13
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +141 -13
- package/dist/i18n/zh.js.map +1 -1
- package/dist/instanceSettings.d.ts +43 -3
- package/dist/instanceSettings.d.ts.map +1 -1
- package/dist/instanceSettings.js +109 -4
- 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/openCodeOpenQuestion.d.ts +12 -4
- package/dist/openCodeOpenQuestion.d.ts.map +1 -1
- package/dist/openCodeOpenQuestion.js +16 -7
- package/dist/openCodeOpenQuestion.js.map +1 -1
- package/dist/openCodeQuestionFlow.d.ts +10 -2
- package/dist/openCodeQuestionFlow.d.ts.map +1 -1
- package/dist/openCodeQuestionFlow.js +27 -5
- package/dist/openCodeQuestionFlow.js.map +1 -1
- 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 +43 -2
- package/dist/postToSession.d.ts.map +1 -1
- package/dist/postToSession.js +46 -4
- 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 +270 -30
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +403 -37
- package/dist/state.js.map +1 -1
- package/dist/testTimings.d.ts +17 -4
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +35 -3
- 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/todos/registry.d.ts +2 -0
- package/dist/todos/registry.d.ts.map +1 -1
- package/dist/todos/registry.js +3 -1
- package/dist/todos/registry.js.map +1 -1
- package/dist/types.d.ts +235 -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 +9 -7
- package/dist/utils/claudeCompactHook.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.js +11 -9
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeLimitSwitch.d.ts +1 -1
- package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
- package/dist/utils/claudeLimitSwitch.js +1 -1
- package/dist/utils/claudeLimitSwitch.js.map +1 -1
- package/dist/utils/claudeProfileSync.d.ts +88 -0
- package/dist/utils/claudeProfileSync.d.ts.map +1 -0
- package/dist/utils/claudeProfileSync.js +198 -0
- package/dist/utils/claudeProfileSync.js.map +1 -0
- 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 +101 -6
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +297 -23
- 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/claudeUsageRefresher.d.ts +8 -1
- package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
- package/dist/utils/claudeUsageRefresher.js +11 -1
- package/dist/utils/claudeUsageRefresher.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/cutButtonLabel.d.ts +7 -0
- package/dist/utils/cutButtonLabel.d.ts.map +1 -0
- package/dist/utils/cutButtonLabel.js +17 -0
- package/dist/utils/cutButtonLabel.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 +44 -0
- package/dist/utils/limitSwitchPlan.d.ts.map +1 -0
- package/dist/utils/limitSwitchPlan.js +54 -0
- package/dist/utils/limitSwitchPlan.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/questionWaitChoices.d.ts +20 -0
- package/dist/utils/questionWaitChoices.d.ts.map +1 -0
- package/dist/utils/questionWaitChoices.js +31 -0
- package/dist/utils/questionWaitChoices.js.map +1 -0
- package/dist/utils/questionWaitPlan.d.ts +166 -0
- package/dist/utils/questionWaitPlan.d.ts.map +1 -0
- package/dist/utils/questionWaitPlan.js +237 -0
- package/dist/utils/questionWaitPlan.js.map +1 -0
- package/dist/utils/replyQuote.d.ts +10 -0
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +18 -7
- package/dist/utils/replyQuote.js.map +1 -1
- package/dist/utils/talkerAccess.d.ts +2 -2
- package/dist/utils/talkerAccess.d.ts.map +1 -1
- package/dist/utils/talkerAccess.js +5 -4
- package/dist/utils/talkerAccess.js.map +1 -1
- package/dist/utils/telegramError.d.ts +6 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +12 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -1
- package/dist/utils/topicAccessScreenPlan.js +3 -7
- package/dist/utils/topicAccessScreenPlan.js.map +1 -1
- package/dist/utils/topicIndicatorPlan.d.ts +153 -0
- package/dist/utils/topicIndicatorPlan.d.ts.map +1 -0
- package/dist/utils/topicIndicatorPlan.js +224 -0
- package/dist/utils/topicIndicatorPlan.js.map +1 -0
- package/dist/utils/topicIndicatorSources.d.ts +40 -0
- package/dist/utils/topicIndicatorSources.d.ts.map +1 -0
- package/dist/utils/topicIndicatorSources.js +31 -0
- package/dist/utils/topicIndicatorSources.js.map +1 -0
- 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/topicStatusPlan.d.ts +90 -0
- package/dist/utils/topicStatusPlan.d.ts.map +1 -0
- package/dist/utils/topicStatusPlan.js +160 -0
- package/dist/utils/topicStatusPlan.js.map +1 -0
- 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/COMMERCIAL-LICENSE.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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description The json-stream adapter's account of the user messages it wrote that the CLI has not taken in yet ("unconsumed
|
|
3
|
+
* input"): the part of "working" that keeps a process from being stopped, compacted or switched while a message to the agent
|
|
4
|
+
* would be lost. Pure: every function takes the list and the clock and returns the next list.
|
|
5
|
+
*
|
|
6
|
+
* Measured on the real CLI 2.1.329 (`-p`, stream-json, `--replay-user-messages`): a message written while a turn runs is taken in
|
|
7
|
+
* either at a point of that turn (a tool boundary), each with an echo of its own, or — when the turn ends first — together with
|
|
8
|
+
* every other message queued by then, as ONE turn whose single echo carries their texts joined by a newline: four writes, two
|
|
9
|
+
* echoes. A bare write-versus-echo count therefore never returns to zero after such a drain, which is how a topic's process was
|
|
10
|
+
* once held "working" for hours. So a message is kept WITH ITS TEXT and taken off by the echo that carries it, and — since no
|
|
11
|
+
* account of the CLI's queue can be exact for ever — it holds a turn-less process only for a bounded time, and a message the CLI
|
|
12
|
+
* took in in a shape nothing here can match (a "phantom") is dropped at the end of the turn that echoed it (see
|
|
13
|
+
* {@link getInputsAfterTurnEnd}).
|
|
14
|
+
*/
|
|
15
|
+
/** A user message written to the CLI's stdin and not yet echoed back. */
|
|
16
|
+
export interface UnconsumedInput {
|
|
17
|
+
text: string;
|
|
18
|
+
/**
|
|
19
|
+
* The moment the CLI's chance to take it in last began: its write, then every turn end — a queued message is taken in right
|
|
20
|
+
* after the turn that ran ahead of it, so the wait for that starts at the turn's end, not at the write.
|
|
21
|
+
*/
|
|
22
|
+
since: number;
|
|
23
|
+
/**
|
|
24
|
+
* An echo of ours that matched nothing arrived in the running turn, and this is the entry it is counted against (the oldest
|
|
25
|
+
* unmarked one at that moment): the message the turn took in, in a shape nothing here matches. The turn's end drops marked
|
|
26
|
+
* entries ({@link getInputsAfterTurnEnd}); a turn that really opens (`init`, a job's firing, a `running` with none running), an
|
|
27
|
+
* interrupt or the busy watchdog forgets the marks (see {@link getInputsWithoutEchoMarks}).
|
|
28
|
+
*/
|
|
29
|
+
hasUnmatchedEcho: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @description The messages still unconsumed after a user line of the CLI with `echoText`: the run that text carries is taken in.
|
|
33
|
+
* A line that is no echo of anything written (`null` text, or the CLI's own `[Request interrupted…]` marker) takes nothing in —
|
|
34
|
+
* counting it as an echo would drop a message that is still queued.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getInputsAfterEcho(inputs: readonly UnconsumedInput[], echoText: string | null): UnconsumedInput[];
|
|
37
|
+
/**
|
|
38
|
+
* @description The messages after an echo of ours that matched NONE of them: the oldest one not yet marked is marked as the one the
|
|
39
|
+
* echo carried (the CLI takes its queue in order) — a message the turn took in, in a shape nothing matches. Tied to the entry, not
|
|
40
|
+
* counted: a message written after the echo, or one a later echo takes off, is never the one that goes.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getInputsWithOldestEchoMarked(inputs: readonly UnconsumedInput[]): UnconsumedInput[];
|
|
43
|
+
/**
|
|
44
|
+
* @description The messages after a turn ended. Every one's wait for the turn that takes it in starts from now (the CLI starts it a
|
|
45
|
+
* moment after this end — measured on 2.1.329, its echo follows within a second). The marked ones are DROPPED: the turn took them
|
|
46
|
+
* in, in a shape nothing matches (the CLI changed their text), so nothing can match them any more and an entry kept would hold the
|
|
47
|
+
* readers that decide at a turn end — the claude-per-turn stop, a deferred account switch — at every turn end for good. A turn that
|
|
48
|
+
* carried no echo of ours (a finished task's notification, a scheduled job, the bot's own `/compact`) marked nothing and drops
|
|
49
|
+
* nothing: a real message the CLI queued behind it stays counted until its own echo, or its grace is out — dropping it here would
|
|
50
|
+
* let the stop or the account switch kill the process a moment before the turn that takes that message in. (Measured on 2.1.329:
|
|
51
|
+
* such a turn writes no `user` line of its own at all, and a message written behind it is echoed in its own turn after it.)
|
|
52
|
+
* A turn that ended in an ERROR result keeps its queue too, like any other turn end. Measured on 2.1.330 with
|
|
53
|
+
* `claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages --permission-mode default`
|
|
54
|
+
* (no `CLAUDE_CONFIG_DIR`, the default sign-in, a throwaway folder; a second user message written 0.3 s after the first, stdin held open),
|
|
55
|
+
* the first turn failing on `--model claude-nonexistent-model-x`, and on an HTTP 400 and an HTTP 429 (after the CLI's ten retries) from a
|
|
56
|
+
* loopback API through `ANTHROPIC_BASE_URL`: the CLI wrote a new `system/init` 0.02–0.2 s after the error `result` and ran the queued
|
|
57
|
+
* message as its own turn (in a turn that fails, the echo comes at its end, right before its `result`). Emptied here as it once was, the
|
|
58
|
+
* list read the message as taken in before its turn began: the per-turn stop killed the process ahead of that turn, and the bot decided
|
|
59
|
+
* the request's turn ended.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getInputsAfterTurnEnd(inputs: readonly UnconsumedInput[], now: number): UnconsumedInput[];
|
|
62
|
+
/**
|
|
63
|
+
* @description The messages as a turn OPENS (its `init`, a job's firing, a `running` after none), or the running one is interrupted or
|
|
64
|
+
* cleared by the busy watchdog: the marks of the turn before are forgotten. A turn that never reported a `result` (an aborted one,
|
|
65
|
+
* one the watchdog cleared) must not leave its marks to drop a real message at some later turn's end. The marker the CLI writes for
|
|
66
|
+
* an interrupt arrives AFTER the interrupt request and may still mark an entry: the next turn's `init` forgets that mark.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getInputsWithoutEchoMarks(inputs: readonly UnconsumedInput[]): UnconsumedInput[];
|
|
69
|
+
/**
|
|
70
|
+
* @description The messages that may still be on their way to the CLI's turn: all of them while a turn runs (it takes them in or
|
|
71
|
+
* ends, and a turn end starts their wait over), and with no turn only those written or left behind by a turn end less than
|
|
72
|
+
* {@link unconsumedInputGraceMs} ago. A message the CLI never echoes — dropped, transformed past recognition — stops holding the
|
|
73
|
+
* process there instead of for good.
|
|
74
|
+
*/
|
|
75
|
+
export declare function getInputsOnTheirWay(input: {
|
|
76
|
+
inputs: readonly UnconsumedInput[];
|
|
77
|
+
isBusy: boolean;
|
|
78
|
+
now: number;
|
|
79
|
+
}): UnconsumedInput[];
|
|
80
|
+
//# sourceMappingURL=jsonStreamUnconsumedInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonStreamUnconsumedInput.d.ts","sourceRoot":"","sources":["../../src/utils/jsonStreamUnconsumedInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAkBD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,EAAE,CAIjH;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAGnG;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAExG;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,EAAE,CAGlI"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description The json-stream adapter's account of the user messages it wrote that the CLI has not taken in yet ("unconsumed
|
|
4
|
+
* input"): the part of "working" that keeps a process from being stopped, compacted or switched while a message to the agent
|
|
5
|
+
* would be lost. Pure: every function takes the list and the clock and returns the next list.
|
|
6
|
+
*
|
|
7
|
+
* Measured on the real CLI 2.1.329 (`-p`, stream-json, `--replay-user-messages`): a message written while a turn runs is taken in
|
|
8
|
+
* either at a point of that turn (a tool boundary), each with an echo of its own, or — when the turn ends first — together with
|
|
9
|
+
* every other message queued by then, as ONE turn whose single echo carries their texts joined by a newline: four writes, two
|
|
10
|
+
* echoes. A bare write-versus-echo count therefore never returns to zero after such a drain, which is how a topic's process was
|
|
11
|
+
* once held "working" for hours. So a message is kept WITH ITS TEXT and taken off by the echo that carries it, and — since no
|
|
12
|
+
* account of the CLI's queue can be exact for ever — it holds a turn-less process only for a bounded time, and a message the CLI
|
|
13
|
+
* took in in a shape nothing here can match (a "phantom") is dropped at the end of the turn that echoed it (see
|
|
14
|
+
* {@link getInputsAfterTurnEnd}).
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getInputsAfterEcho = getInputsAfterEcho;
|
|
18
|
+
exports.getInputsWithOldestEchoMarked = getInputsWithOldestEchoMarked;
|
|
19
|
+
exports.getInputsAfterTurnEnd = getInputsAfterTurnEnd;
|
|
20
|
+
exports.getInputsWithoutEchoMarks = getInputsWithoutEchoMarks;
|
|
21
|
+
exports.getInputsOnTheirWay = getInputsOnTheirWay;
|
|
22
|
+
const jsonStreamPendingWork_1 = require("./jsonStreamPendingWork");
|
|
23
|
+
/** What the CLI joins the texts of messages it takes in together with (measured). */
|
|
24
|
+
const mergedInputSeparator = '\n';
|
|
25
|
+
/** The first run of messages whose texts, joined as the CLI joins them, are exactly `echoText`: `[start, end)`; `null` for none. */
|
|
26
|
+
function findEchoedRange(inputs, echoText) {
|
|
27
|
+
for (let start = 0; start < inputs.length; start += 1) {
|
|
28
|
+
let joinedText = '';
|
|
29
|
+
// A longer join can never shrink back to the echo: stop growing it past the echo's length.
|
|
30
|
+
for (let end = start; end < inputs.length && joinedText.length <= echoText.length; end += 1) {
|
|
31
|
+
joinedText = end === start ? inputs[end].text : `${joinedText}${mergedInputSeparator}${inputs[end].text}`;
|
|
32
|
+
if (joinedText === echoText)
|
|
33
|
+
return { start, end: end + 1 };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @description The messages still unconsumed after a user line of the CLI with `echoText`: the run that text carries is taken in.
|
|
40
|
+
* A line that is no echo of anything written (`null` text, or the CLI's own `[Request interrupted…]` marker) takes nothing in —
|
|
41
|
+
* counting it as an echo would drop a message that is still queued.
|
|
42
|
+
*/
|
|
43
|
+
function getInputsAfterEcho(inputs, echoText) {
|
|
44
|
+
const echoedRange = echoText === null ? null : findEchoedRange(inputs, echoText);
|
|
45
|
+
if (echoedRange === null)
|
|
46
|
+
return [...inputs];
|
|
47
|
+
return [...inputs.slice(0, echoedRange.start), ...inputs.slice(echoedRange.end)];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description The messages after an echo of ours that matched NONE of them: the oldest one not yet marked is marked as the one the
|
|
51
|
+
* echo carried (the CLI takes its queue in order) — a message the turn took in, in a shape nothing matches. Tied to the entry, not
|
|
52
|
+
* counted: a message written after the echo, or one a later echo takes off, is never the one that goes.
|
|
53
|
+
*/
|
|
54
|
+
function getInputsWithOldestEchoMarked(inputs) {
|
|
55
|
+
const unmarkedIndex = inputs.findIndex((input) => !input.hasUnmatchedEcho);
|
|
56
|
+
return inputs.map((input, index) => (index === unmarkedIndex ? { ...input, hasUnmatchedEcho: true } : input));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @description The messages after a turn ended. Every one's wait for the turn that takes it in starts from now (the CLI starts it a
|
|
60
|
+
* moment after this end — measured on 2.1.329, its echo follows within a second). The marked ones are DROPPED: the turn took them
|
|
61
|
+
* in, in a shape nothing matches (the CLI changed their text), so nothing can match them any more and an entry kept would hold the
|
|
62
|
+
* readers that decide at a turn end — the claude-per-turn stop, a deferred account switch — at every turn end for good. A turn that
|
|
63
|
+
* carried no echo of ours (a finished task's notification, a scheduled job, the bot's own `/compact`) marked nothing and drops
|
|
64
|
+
* nothing: a real message the CLI queued behind it stays counted until its own echo, or its grace is out — dropping it here would
|
|
65
|
+
* let the stop or the account switch kill the process a moment before the turn that takes that message in. (Measured on 2.1.329:
|
|
66
|
+
* such a turn writes no `user` line of its own at all, and a message written behind it is echoed in its own turn after it.)
|
|
67
|
+
* A turn that ended in an ERROR result keeps its queue too, like any other turn end. Measured on 2.1.330 with
|
|
68
|
+
* `claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages --permission-mode default`
|
|
69
|
+
* (no `CLAUDE_CONFIG_DIR`, the default sign-in, a throwaway folder; a second user message written 0.3 s after the first, stdin held open),
|
|
70
|
+
* the first turn failing on `--model claude-nonexistent-model-x`, and on an HTTP 400 and an HTTP 429 (after the CLI's ten retries) from a
|
|
71
|
+
* loopback API through `ANTHROPIC_BASE_URL`: the CLI wrote a new `system/init` 0.02–0.2 s after the error `result` and ran the queued
|
|
72
|
+
* message as its own turn (in a turn that fails, the echo comes at its end, right before its `result`). Emptied here as it once was, the
|
|
73
|
+
* list read the message as taken in before its turn began: the per-turn stop killed the process ahead of that turn, and the bot decided
|
|
74
|
+
* the request's turn ended.
|
|
75
|
+
*/
|
|
76
|
+
function getInputsAfterTurnEnd(inputs, now) {
|
|
77
|
+
return inputs.filter((input) => !input.hasUnmatchedEcho).map((input) => ({ ...input, since: now }));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @description The messages as a turn OPENS (its `init`, a job's firing, a `running` after none), or the running one is interrupted or
|
|
81
|
+
* cleared by the busy watchdog: the marks of the turn before are forgotten. A turn that never reported a `result` (an aborted one,
|
|
82
|
+
* one the watchdog cleared) must not leave its marks to drop a real message at some later turn's end. The marker the CLI writes for
|
|
83
|
+
* an interrupt arrives AFTER the interrupt request and may still mark an entry: the next turn's `init` forgets that mark.
|
|
84
|
+
*/
|
|
85
|
+
function getInputsWithoutEchoMarks(inputs) {
|
|
86
|
+
return inputs.map((input) => (input.hasUnmatchedEcho ? { ...input, hasUnmatchedEcho: false } : input));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @description The messages that may still be on their way to the CLI's turn: all of them while a turn runs (it takes them in or
|
|
90
|
+
* ends, and a turn end starts their wait over), and with no turn only those written or left behind by a turn end less than
|
|
91
|
+
* {@link unconsumedInputGraceMs} ago. A message the CLI never echoes — dropped, transformed past recognition — stops holding the
|
|
92
|
+
* process there instead of for good.
|
|
93
|
+
*/
|
|
94
|
+
function getInputsOnTheirWay(input) {
|
|
95
|
+
if (input.isBusy)
|
|
96
|
+
return [...input.inputs];
|
|
97
|
+
return input.inputs.filter((pending) => input.now - pending.since < jsonStreamPendingWork_1.unconsumedInputGraceMs);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=jsonStreamUnconsumedInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonStreamUnconsumedInput.js","sourceRoot":"","sources":["../../src/utils/jsonStreamUnconsumedInput.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AA0CH,gDAIC;AAOD,sEAGC;AAoBD,sDAEC;AAQD,8DAEC;AAQD,kDAGC;AAjGD,mEAAiE;AAmBjE,qFAAqF;AACrF,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,oIAAoI;AACpI,SAAS,eAAe,CAAC,MAAkC,EAAE,QAAgB;IAC3E,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACtD,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,2FAA2F;QAC3F,KAAK,IAAI,GAAG,GAAG,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;YAC5F,UAAU,GAAG,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,C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AC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AACtG,CAAC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,MAAkC;IAC1E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AACzG,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,KAA2E;IAC7G,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,KAAK,GAAG,8CAAsB,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -55,6 +55,38 @@ export declare const limitEpisodeMaxAgeMs: number;
|
|
|
55
55
|
* leaving the sub-agent's out loses nothing and keeps a parked topic parked.
|
|
56
56
|
*/
|
|
57
57
|
export declare function getLastTerminalErrorText(tailText: string): string | null;
|
|
58
|
+
/** The error a session is parked on, and where its terminal frame ends in the session's `stdout.jsonl`. */
|
|
59
|
+
export interface ParkedTerminalError {
|
|
60
|
+
text: string;
|
|
61
|
+
/**
|
|
62
|
+
* The byte offset in the log right after the error's `result` line (its newline included): WHERE the episode is. Frames
|
|
63
|
+
* appended after it — the reply to the bot's boot `mcp_status`, a rate-limit event — move the log's size and mtime, never this.
|
|
64
|
+
*/
|
|
65
|
+
endOffset: number;
|
|
66
|
+
/**
|
|
67
|
+
* {@link getLimitEpisodeLineStamp} of that whole `result` line — WHICH turn it ended: the line carries the turn's own `uuid`,
|
|
68
|
+
* `duration_ms` and `session_id`. The log is deleted and written anew whenever the agent process starts or exits, so a
|
|
69
|
+
* resumed process can hit the same limit text at the same byte offset (the same start frames, the bot's fixed «continue»
|
|
70
|
+
* prompt, a clock-only reset that repeats every day); the offset and the text alone would take that new limit for the old one.
|
|
71
|
+
*/
|
|
72
|
+
stamp: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* @description {@link getLastTerminalErrorText} with the position of the error: `tail` is the log's tail as read (`tailStartOffset`
|
|
76
|
+
* is where it starts in the log), split on its newline bytes — a newline is never part of a multi-byte UTF-8 character, so the
|
|
77
|
+
* offsets are exact even when the tail starts in the middle of one (that torn first line is skipped).
|
|
78
|
+
*/
|
|
79
|
+
export declare function findParkedTerminalError(tail: Buffer, tailStartOffset: number): ParkedTerminalError | null;
|
|
80
|
+
/**
|
|
81
|
+
* @description The stamp of a parked error's whole `result` line (its bytes, the newline left out) an episode marker keeps beside
|
|
82
|
+
* its offset: a hash — the line's text, the error included, is not kept.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getLimitEpisodeLineStamp(resultLine: Buffer | string): string;
|
|
85
|
+
/**
|
|
86
|
+
* @description The marker that records an episode as handled: the log's identity now, and — when the log is parked on an error —
|
|
87
|
+
* that error's place and the stamp of its `result` line, which is what later boots compare ({@link decideLimitEpisodeRecovery}).
|
|
88
|
+
*/
|
|
89
|
+
export declare function buildLimitEpisodeMarker(log: Pick<LimitEpisodeMarker, 'sizeBytes' | 'mtimeMs'>, parked: ParkedTerminalError | null): LimitEpisodeMarker;
|
|
58
90
|
/**
|
|
59
91
|
* @description When the parked error was written, read off the Claude transcript tail: the `timestamp` of the LAST
|
|
60
92
|
* API-error entry (`isApiErrorMessage`) whose text is the error's. `null` when there is no such entry or its timestamp
|
|
@@ -79,11 +111,14 @@ export type LimitEpisodeDecision =
|
|
|
79
111
|
* pushing a surprise prompt into a topic:
|
|
80
112
|
* - only when no persisted retry record already covers the thread (that one is
|
|
81
113
|
* re-armed by the normal restore path — arming twice would double-notice);
|
|
82
|
-
* - only when the
|
|
83
|
-
* ({@link
|
|
114
|
+
* - only when the parked error is not the episode a previous boot, or a settled
|
|
115
|
+
* wait, already handled ({@link checkIsSameHandledEpisode});
|
|
84
116
|
* - only the `usageLimit` class (a transient error is long past by restart time,
|
|
85
117
|
* and an `auth` error needs a human, not a wait);
|
|
86
|
-
* - only when the
|
|
118
|
+
* - only when the ERROR is younger than {@link limitEpisodeMaxAgeMs} — its own time
|
|
119
|
+
* (`errorWrittenAtMs`) when known: the log's mtime moves with every frame written
|
|
120
|
+
* after it, a boot's own `mcp_status` reply included, so it would keep an old error
|
|
121
|
+
* young for ever.
|
|
87
122
|
* The reset the error names is resolved against the moment it was WRITTEN —
|
|
88
123
|
* `errorWrittenAtMs` (the transcript's own timestamp, {@link getParkedErrorWrittenAtMs}),
|
|
89
124
|
* else the log's mtime — not against the boot: a clock-only reset (`resets 10:50pm`)
|
|
@@ -94,11 +129,15 @@ export type LimitEpisodeDecision =
|
|
|
94
129
|
*/
|
|
95
130
|
export declare function decideLimitEpisodeRecovery(input: {
|
|
96
131
|
errorText: string | null;
|
|
132
|
+
/** Where the parked error's frame ends in the log ({@link findParkedTerminalError}); absent → the episode is told by the log's identity. */
|
|
133
|
+
errorEndOffset?: number | null;
|
|
134
|
+
/** The stamp of that error's whole `result` line ({@link ParkedTerminalError.stamp}); with `errorEndOffset`, WHICH turn's error it is. */
|
|
135
|
+
errorStamp?: string | null;
|
|
97
136
|
/** When the error was written, from the transcript; absent → the log's mtime. */
|
|
98
137
|
errorWrittenAtMs?: number | null;
|
|
99
138
|
/** Identity (size + mtime) of the session's `stdout.jsonl` right now. */
|
|
100
139
|
log: LimitEpisodeMarker;
|
|
101
|
-
/**
|
|
140
|
+
/** The marker of the episode a previous boot or a settled wait handled, if any ({@link buildLimitEpisodeMarker}). */
|
|
102
141
|
handled?: LimitEpisodeMarker;
|
|
103
142
|
now: number;
|
|
104
143
|
hasArmedRetry: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitEpisodeRecovery.d.ts","sourceRoot":"","sources":["../../src/utils/limitEpisodeRecovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"limitEpisodeRecovery.d.ts","sourceRoot":"","sources":["../../src/utils/limitEpisodeRecovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAExE;AAED,2GAA2G;AAC3G,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAsBzG;AAKD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE5E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,kBAAkB,CAMtJ;AAiCD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBlG;AAED,MAAM,MAAM,oBAAoB;AAC9B,6DAA6D;AAC3D;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,kBAAkB,CAAA;CAAE;AAC5C,wDAAwD;GACtD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,eAAe,GAAG,OAAO,GAAG,cAAc,GAAG,gBAAgB,CAAA;CAAE,CAAC;AA6B1G;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4IAA4I;IAC5I,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,0IAA0I;IAC1I,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,yEAAyE;IACzE,GAAG,EAAE,kBAAkB,CAAC;IACxB,qHAAqH;IACrH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,GAAG,oBAAoB,CAUvB"}
|
|
@@ -20,11 +20,48 @@
|
|
|
20
20
|
* Only the decisions live here; the fs read and the `handleApiError` call stay in
|
|
21
21
|
* `bot.ts` (the apiErrorRetry pure-layer / manager split).
|
|
22
22
|
*/
|
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
+
var ownKeys = function(o) {
|
|
41
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
+
var ar = [];
|
|
43
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
return ownKeys(o);
|
|
47
|
+
};
|
|
48
|
+
return function (mod) {
|
|
49
|
+
if (mod && mod.__esModule) return mod;
|
|
50
|
+
var result = {};
|
|
51
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
23
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
57
|
exports.limitEpisodeMaxAgeMs = exports.limitEpisodeTailMaxBytes = void 0;
|
|
25
58
|
exports.getLastTerminalErrorText = getLastTerminalErrorText;
|
|
59
|
+
exports.findParkedTerminalError = findParkedTerminalError;
|
|
60
|
+
exports.getLimitEpisodeLineStamp = getLimitEpisodeLineStamp;
|
|
61
|
+
exports.buildLimitEpisodeMarker = buildLimitEpisodeMarker;
|
|
26
62
|
exports.getParkedErrorWrittenAtMs = getParkedErrorWrittenAtMs;
|
|
27
63
|
exports.decideLimitEpisodeRecovery = decideLimitEpisodeRecovery;
|
|
64
|
+
const crypto = __importStar(require("crypto"));
|
|
28
65
|
const apiErrorRetry_1 = require("../apiErrorRetry");
|
|
29
66
|
const claudeStreamJson_1 = require("./claudeStreamJson");
|
|
30
67
|
/**
|
|
@@ -62,22 +99,58 @@ exports.limitEpisodeMaxAgeMs = 12 * 60 * 60 * 1000;
|
|
|
62
99
|
* leaving the sub-agent's out loses nothing and keeps a parked topic parked.
|
|
63
100
|
*/
|
|
64
101
|
function getLastTerminalErrorText(tailText) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
102
|
+
return findParkedTerminalError(Buffer.from(tailText, 'utf8'), 0)?.text ?? null;
|
|
103
|
+
}
|
|
104
|
+
const newlineByte = 0x0a;
|
|
105
|
+
/**
|
|
106
|
+
* @description {@link getLastTerminalErrorText} with the position of the error: `tail` is the log's tail as read (`tailStartOffset`
|
|
107
|
+
* is where it starts in the log), split on its newline bytes — a newline is never part of a multi-byte UTF-8 character, so the
|
|
108
|
+
* offsets are exact even when the tail starts in the middle of one (that torn first line is skipped).
|
|
109
|
+
*/
|
|
110
|
+
function findParkedTerminalError(tail, tailStartOffset) {
|
|
111
|
+
let parked = null;
|
|
112
|
+
let lineStart = 0;
|
|
113
|
+
while (lineStart < tail.length) {
|
|
114
|
+
const newlineAt = tail.indexOf(newlineByte, lineStart);
|
|
115
|
+
const lineEnd = newlineAt === -1 ? tail.length : newlineAt + 1;
|
|
116
|
+
const line = tail.subarray(lineStart, newlineAt === -1 ? tail.length : newlineAt);
|
|
117
|
+
const parsed = (0, claudeStreamJson_1.parseStreamJsonLine)(line.toString('utf8'));
|
|
118
|
+
lineStart = lineEnd;
|
|
68
119
|
if (!parsed)
|
|
69
120
|
continue; // blank, or the tail's torn first line
|
|
70
121
|
for (const action of (0, claudeStreamJson_1.classifyClaudeStreamMessage)(parsed)) {
|
|
71
122
|
if (action.kind === 'turnEnd') {
|
|
72
123
|
// A later healthy turn CLEARS the verdict — the session recovered.
|
|
73
|
-
|
|
124
|
+
parked = action.isError && action.errorText !== null
|
|
125
|
+
? { text: action.errorText, endOffset: tailStartOffset + lineEnd, stamp: getLimitEpisodeLineStamp(line) }
|
|
126
|
+
: null;
|
|
74
127
|
}
|
|
75
128
|
else if (checkIsSessionActivity(action)) {
|
|
76
|
-
|
|
129
|
+
parked = null;
|
|
77
130
|
}
|
|
78
131
|
}
|
|
79
132
|
}
|
|
80
|
-
return
|
|
133
|
+
return parked;
|
|
134
|
+
}
|
|
135
|
+
/** How many hex digits of the `result` line's hash an episode marker keeps: enough to tell two turns apart. */
|
|
136
|
+
const lineStampLength = 16;
|
|
137
|
+
/**
|
|
138
|
+
* @description The stamp of a parked error's whole `result` line (its bytes, the newline left out) an episode marker keeps beside
|
|
139
|
+
* its offset: a hash — the line's text, the error included, is not kept.
|
|
140
|
+
*/
|
|
141
|
+
function getLimitEpisodeLineStamp(resultLine) {
|
|
142
|
+
return crypto.createHash('sha256').update(resultLine).digest('hex').slice(0, lineStampLength);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @description The marker that records an episode as handled: the log's identity now, and — when the log is parked on an error —
|
|
146
|
+
* that error's place and the stamp of its `result` line, which is what later boots compare ({@link decideLimitEpisodeRecovery}).
|
|
147
|
+
*/
|
|
148
|
+
function buildLimitEpisodeMarker(log, parked) {
|
|
149
|
+
return {
|
|
150
|
+
sizeBytes: log.sizeBytes,
|
|
151
|
+
mtimeMs: log.mtimeMs,
|
|
152
|
+
...(parked !== null ? { errorEndOffset: parked.endOffset, errorStamp: parked.stamp } : {}),
|
|
153
|
+
};
|
|
81
154
|
}
|
|
82
155
|
/** Frames that only a running PARENT session writes (not the ambient rate-limit /
|
|
83
156
|
* status ones, and not a sub-agent's — see {@link getLastTerminalErrorText}). */
|
|
@@ -125,18 +198,28 @@ function getParkedErrorWrittenAtMs(transcriptTail, errorText) {
|
|
|
125
198
|
return writtenAtMs;
|
|
126
199
|
}
|
|
127
200
|
/**
|
|
128
|
-
* @description Whether this thread's trailing error is the one a previous boot
|
|
129
|
-
* already
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
201
|
+
* @description Whether this thread's trailing error is the one a previous boot (or a settled wait) already acted on, so re-arming
|
|
202
|
+
* would resurrect a wait that was already settled — skipped by «⏭ Skip once», by a user takeover, by the retry giving up, or armed by
|
|
203
|
+
* the recovery of an earlier boot. This matters on every code change, because hot mode reloads the bot.
|
|
204
|
+
*
|
|
205
|
+
* The episode is the parked error ITSELF: the same `result` line (`errorStamp`, the stamp of the whole line — its turn's `uuid`,
|
|
206
|
+
* `duration_ms`, `session_id` and the error) at the same place in the log (`errorEndOffset`). Frames written after it that are no
|
|
207
|
+
* activity of the session — above all the reply to the `mcp_status` request every boot sends an adopted session, and rate-limit
|
|
208
|
+
* events — change the log's size and mtime but not the episode; compared on those, every restart re-armed the last parked error. A
|
|
209
|
+
* genuinely NEW trailing error is a new line — at a new offset, or, in a log a new process wrote anew, at the same offset with the
|
|
210
|
+
* same text but another turn's fields — so it still arms; a stamp missing on either side counts as another line. A marker written
|
|
211
|
+
* before the episode was kept (no `errorEndOffset`), or a log read without its error's place, is compared the old way: both the
|
|
212
|
+
* log's size and its mtime.
|
|
135
213
|
*/
|
|
136
|
-
function
|
|
214
|
+
function checkIsSameHandledEpisode(handled, current) {
|
|
137
215
|
if (!handled)
|
|
138
216
|
return false;
|
|
139
|
-
|
|
217
|
+
if (handled.errorEndOffset !== undefined && current.errorEndOffset !== undefined && current.errorEndOffset !== null && current.errorText !== null) {
|
|
218
|
+
return handled.errorEndOffset === current.errorEndOffset
|
|
219
|
+
&& handled.errorStamp !== undefined && current.errorStamp !== undefined && current.errorStamp !== null
|
|
220
|
+
&& handled.errorStamp === current.errorStamp;
|
|
221
|
+
}
|
|
222
|
+
return handled.sizeBytes === current.log.sizeBytes && handled.mtimeMs === current.log.mtimeMs;
|
|
140
223
|
}
|
|
141
224
|
/**
|
|
142
225
|
* @description Decide whether a session's trailing error should re-arm a limit
|
|
@@ -144,11 +227,14 @@ function checkIsSameHandledLog(handled, log) {
|
|
|
144
227
|
* pushing a surprise prompt into a topic:
|
|
145
228
|
* - only when no persisted retry record already covers the thread (that one is
|
|
146
229
|
* re-armed by the normal restore path — arming twice would double-notice);
|
|
147
|
-
* - only when the
|
|
148
|
-
* ({@link
|
|
230
|
+
* - only when the parked error is not the episode a previous boot, or a settled
|
|
231
|
+
* wait, already handled ({@link checkIsSameHandledEpisode});
|
|
149
232
|
* - only the `usageLimit` class (a transient error is long past by restart time,
|
|
150
233
|
* and an `auth` error needs a human, not a wait);
|
|
151
|
-
* - only when the
|
|
234
|
+
* - only when the ERROR is younger than {@link limitEpisodeMaxAgeMs} — its own time
|
|
235
|
+
* (`errorWrittenAtMs`) when known: the log's mtime moves with every frame written
|
|
236
|
+
* after it, a boot's own `mcp_status` reply included, so it would keep an old error
|
|
237
|
+
* young for ever.
|
|
152
238
|
* The reset the error names is resolved against the moment it was WRITTEN —
|
|
153
239
|
* `errorWrittenAtMs` (the transcript's own timestamp, {@link getParkedErrorWrittenAtMs}),
|
|
154
240
|
* else the log's mtime — not against the boot: a clock-only reset (`resets 10:50pm`)
|
|
@@ -160,11 +246,12 @@ function checkIsSameHandledLog(handled, log) {
|
|
|
160
246
|
function decideLimitEpisodeRecovery(input) {
|
|
161
247
|
if (input.hasArmedRetry)
|
|
162
248
|
return { action: 'skip', reason: 'alreadyArmed' };
|
|
163
|
-
if (
|
|
249
|
+
if (checkIsSameHandledEpisode(input.handled, { log: input.log, errorText: input.errorText, errorEndOffset: input.errorEndOffset, errorStamp: input.errorStamp })) {
|
|
164
250
|
return { action: 'skip', reason: 'alreadyHandled' };
|
|
251
|
+
}
|
|
165
252
|
if (!input.errorText)
|
|
166
253
|
return { action: 'skip', reason: 'noError' };
|
|
167
|
-
if (input.now - input.log.mtimeMs > exports.limitEpisodeMaxAgeMs)
|
|
254
|
+
if (input.now - (input.errorWrittenAtMs ?? input.log.mtimeMs) > exports.limitEpisodeMaxAgeMs)
|
|
168
255
|
return { action: 'skip', reason: 'stale' };
|
|
169
256
|
const cls = (0, apiErrorRetry_1.classifyAgentApiError)(input.errorText, input.errorWrittenAtMs ?? input.log.mtimeMs);
|
|
170
257
|
if (cls?.kind !== 'usageLimit')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitEpisodeRecovery.js","sourceRoot":"","sources":["../../src/utils/limitEpisodeRecovery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG
|
|
1
|
+
{"version":3,"file":"limitEpisodeRecovery.js","sourceRoot":"","sources":["../../src/utils/limitEpisodeRecovery.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CH,4DAEC;AA0BD,0DAsBC;AASD,4DAEC;AAMD,0DAMC;AAuCD,8DAgBC;AAyDD,gEAwBC;AA1PD,+CAAiC;AACjC,oDAAyD;AACzD,yDAA+G;AAG/G;;;;;GAKG;AACU,QAAA,wBAAwB,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,wBAAwB,CAAC,QAAgB;IACvD,OAAO,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;AACjF,CAAC;AAmBD,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,IAAY,EAAE,eAAuB;IAC3E,IAAI,MAAM,GAA+B,IAAI,CAAC;IAC9C,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,OAAO,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC/B,MAAM,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MAAM,GAAG,GAAG,IAAA,qCAAqB,EAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChG,IAAI,GAAG,EAAE,IAAI,KAAK,YAAY;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACnF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
* delivered once nothing holds them any more. They are never dropped: they ride
|
|
5
5
|
* the first prompt forwarded after the wait — its resume, the operator's next
|
|
6
6
|
* message, a later post — or, when a new session starts with nothing to
|
|
7
|
-
* forward, go to it on their own
|
|
8
|
-
*
|
|
7
|
+
* forward, go to it on their own; except a start made while a command ends or
|
|
8
|
+
* replaces the conversation (`/new`, a move, a start onto another agent or a
|
|
9
|
+
* shell): they wait for the first prompt that command hands over, or the next
|
|
10
|
+
* one (`requests/README.md` § Turn starts, review 26 #5). The scheduler's fire
|
|
11
|
+
* and a tracker's request share the hold through `postToSession`.
|
|
9
12
|
*/
|
|
13
|
+
import type { PromptsNotTakenIn } from '../requests/requestHeader';
|
|
10
14
|
/** Held per conversation at most; a scheduler firing all through a long wait must not flood the resume. */
|
|
11
15
|
export declare const limitHeldPromptsMax = 10;
|
|
12
16
|
/**
|
|
@@ -47,18 +51,24 @@ export declare function getTextWithHeldPrompts(text: string, held: readonly Limi
|
|
|
47
51
|
* nothing else to forward; `null` when nothing is held.
|
|
48
52
|
*/
|
|
49
53
|
export declare function getHeldPromptsText(held: readonly LimitHeldPrompt[]): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* @name LimitResumeMessage
|
|
56
|
+
* @description What a resume forwards, and the requests whose own prompts it carries (`carriedRequestIds`, named as it is built:
|
|
57
|
+
* empty for the plain «continue» nudge and for a context bridge).
|
|
58
|
+
*/
|
|
59
|
+
export interface LimitResumeMessage {
|
|
60
|
+
text: string;
|
|
61
|
+
carriedRequestIds: readonly string[];
|
|
62
|
+
}
|
|
50
63
|
/**
|
|
51
64
|
* @description What the resume of a usage-limit wait forwards: the open
|
|
52
|
-
*
|
|
53
|
-
* wait, or
|
|
54
|
-
* the limit interrupted. Held prompts are not part of it: they ride whichever
|
|
55
|
-
* forwarded.
|
|
65
|
+
* requests' prompts when the agent never took them in (R21 — they arrived during
|
|
66
|
+
* the wait, or their post failed), else the "continue" nudge, which resumes the
|
|
67
|
+
* turn the limit interrupted. Held prompts are not part of it: they ride whichever
|
|
68
|
+
* is forwarded.
|
|
56
69
|
*/
|
|
57
70
|
export declare function getLimitResumeMessage(input: {
|
|
58
71
|
continueNudge: string;
|
|
59
|
-
|
|
60
|
-
}):
|
|
61
|
-
text: string;
|
|
62
|
-
isRequestPrompt: boolean;
|
|
63
|
-
};
|
|
72
|
+
untakenRequestPrompts: PromptsNotTakenIn | undefined;
|
|
73
|
+
}): LimitResumeMessage;
|
|
64
74
|
//# sourceMappingURL=limitHeldPrompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitHeldPrompts.d.ts","sourceRoot":"","sources":["../../src/utils/limitHeldPrompts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"limitHeldPrompts.d.ts","sourceRoot":"","sources":["../../src/utils/limitHeldPrompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,2GAA2G;AAC3G,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAGtC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0EAAqE,CAAC;AAEpG;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAOD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,eAAe,EAAE,EAChC,MAAM,EAAE,eAAe,GACtB;IAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAKnD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,CAG7F;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,GAAG,MAAM,GAAG,IAAI,CAElF;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,iBAAiB,GAAG,SAAS,CAAC;CACtD,GAAG,kBAAkB,CAIrB"}
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
* delivered once nothing holds them any more. They are never dropped: they ride
|
|
6
6
|
* the first prompt forwarded after the wait — its resume, the operator's next
|
|
7
7
|
* message, a later post — or, when a new session starts with nothing to
|
|
8
|
-
* forward, go to it on their own
|
|
9
|
-
*
|
|
8
|
+
* forward, go to it on their own; except a start made while a command ends or
|
|
9
|
+
* replaces the conversation (`/new`, a move, a start onto another agent or a
|
|
10
|
+
* shell): they wait for the first prompt that command hands over, or the next
|
|
11
|
+
* one (`requests/README.md` § Turn starts, review 26 #5). The scheduler's fire
|
|
12
|
+
* and a tracker's request share the hold through `postToSession`.
|
|
10
13
|
*/
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.heldPromptsHeader = exports.limitHeldPromptsMax = void 0;
|
|
@@ -59,14 +62,14 @@ function getHeldPromptsText(held) {
|
|
|
59
62
|
}
|
|
60
63
|
/**
|
|
61
64
|
* @description What the resume of a usage-limit wait forwards: the open
|
|
62
|
-
*
|
|
63
|
-
* wait, or
|
|
64
|
-
* the limit interrupted. Held prompts are not part of it: they ride whichever
|
|
65
|
-
* forwarded.
|
|
65
|
+
* requests' prompts when the agent never took them in (R21 — they arrived during
|
|
66
|
+
* the wait, or their post failed), else the "continue" nudge, which resumes the
|
|
67
|
+
* turn the limit interrupted. Held prompts are not part of it: they ride whichever
|
|
68
|
+
* is forwarded.
|
|
66
69
|
*/
|
|
67
70
|
function getLimitResumeMessage(input) {
|
|
68
|
-
return input.
|
|
69
|
-
? { text: input.continueNudge,
|
|
70
|
-
: { text: input.
|
|
71
|
+
return input.untakenRequestPrompts === undefined
|
|
72
|
+
? { text: input.continueNudge, carriedRequestIds: [] }
|
|
73
|
+
: { text: input.untakenRequestPrompts.text, carriedRequestIds: input.untakenRequestPrompts.requestIds };
|
|
71
74
|
}
|
|
72
75
|
//# sourceMappingURL=limitHeldPrompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitHeldPrompts.js","sourceRoot":"","sources":["../../src/utils/limitHeldPrompts.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"limitHeldPrompts.js","sourceRoot":"","sources":["../../src/utils/limitHeldPrompts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAqCH,gDAQC;AAQD,wDAGC;AAMD,gDAEC;AAmBD,sDAOC;AAtFD,2GAA2G;AAC9F,QAAA,mBAAmB,GAAG,EAAE,CAAC;AACtC,yEAAyE;AACzE,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC;;;GAGG;AACU,QAAA,iBAAiB,GAAG,kEAAkE,CAAC;AAcpG,4DAA4D;AAC5D,SAAS,gBAAgB,CAAC,MAAuB;IAC/C,OAAO,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB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