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
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @description The `/limits` switch board in two pure pieces:
|
|
4
4
|
*
|
|
5
|
-
* - the ROWS — one per
|
|
5
|
+
* - the ROWS — one per Claude account (in `/accounts` order), then one per connected OpenCode provider (in
|
|
6
6
|
* catalog order), each labelled `[✓ ]<program> · <account or provider>` and nothing else: the buttons carry no usage,
|
|
7
7
|
* no reset and no model (the figures do not fit a phone's button) — only an account billed to API credits ends in
|
|
8
8
|
* ` 💳` (a tap on it spends money). The `✓` marks the active row only — where the
|
|
9
|
-
* topic runs now, in General the default Claude account.
|
|
9
|
+
* topic runs now, in General the default Claude account. An account that CANNOT WORK and that a sign-in mends (signed out, its
|
|
10
|
+
* login expired, refused by the API) stays on the board as a row that is no switch target — `🔑 <program> · <account>`: a tap
|
|
11
|
+
* signs it in again (the 🔑 of `/accounts`), it never moves a topic; one its organization turned off has no row (a sign-in does not mend it).
|
|
10
12
|
* - the USAGE BLOCK of the message above them — `Usage (% used)` and one line per signed-in Claude account that has
|
|
11
|
-
* a figure or a limit (an account billed to API credits always: `console — 💳 API · pay per use`),
|
|
13
|
+
* a figure or a limit (an account billed to API credits always: `console — 💳 API · pay per use`), a line by WHY for one that cannot
|
|
14
|
+
* work — `<name> — 🔑 not signed in`, `🔑 sign-in expired`, `🔑 refused by the API (401/403)`, `🚫 its organization turned it off` —, then per
|
|
12
15
|
* connected OpenCode provider that reports usage (the ChatGPT subscription), each
|
|
13
16
|
* `<name> — <first usage line>` in exactly the wording `/accounts` prints under a row
|
|
14
17
|
* (`formatClaudeProfileUsageLines`, the one renderer both screens share).
|
|
@@ -20,25 +23,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
23
|
exports.buildLimitsBoardRows = buildLimitsBoardRows;
|
|
21
24
|
exports.formatLimitsUsageBlock = formatLimitsUsageBlock;
|
|
22
25
|
const i18n_1 = require("../i18n");
|
|
26
|
+
const claudeAuthRefusal_1 = require("./claudeAuthRefusal");
|
|
23
27
|
const claudeProfileUsageLines_1 = require("./claudeProfileUsageLines");
|
|
24
28
|
const fallbackChain_1 = require("./fallbackChain");
|
|
25
29
|
const openCodeUsage_1 = require("./openCodeUsage");
|
|
26
30
|
const activeMark = '✓ ';
|
|
31
|
+
/** Before the label of an account's sign-in row, and before the words of an account a sign-in mends: its tap signs the account in again, like the 🔑 of `/accounts`. */
|
|
32
|
+
const signInMark = '🔑 ';
|
|
33
|
+
/** Before the words of an account no sign-in mends (its organization turned Claude subscription use off). */
|
|
34
|
+
const blockedMark = '🚫 ';
|
|
35
|
+
/** The words after an unusable account's name in the usage block, by why it cannot work (`account.row.loggedOut` is `/accounts`' own «not signed in»). */
|
|
36
|
+
const unusableMarkKeys = {
|
|
37
|
+
notSignedIn: 'account.row.loggedOut',
|
|
38
|
+
signedOut: 'limits.signedOutMark',
|
|
39
|
+
rejected: 'limits.rejectedMark',
|
|
40
|
+
orgDisabled: 'limits.orgDisabledMark',
|
|
41
|
+
};
|
|
42
|
+
/** `<mark> <why>` — what the usage block says of an account that cannot work. */
|
|
43
|
+
function formatUnusableMark(usability) {
|
|
44
|
+
return `${(0, claudeAuthRefusal_1.checkIsClaudeUsabilityMendedBySignIn)(usability) ? signInMark : blockedMark}${(0, i18n_1.t)(unusableMarkKeys[usability])}`;
|
|
45
|
+
}
|
|
27
46
|
/** The ChatGPT subscription's name beside its provider id in the usage block: `openai (ChatGPT)`. */
|
|
28
47
|
const chatGptBrandName = 'ChatGPT';
|
|
29
48
|
/** The mark after an account billed to API credits: every request on it costs money. */
|
|
30
49
|
const meteredMark = ' 💳';
|
|
31
50
|
function buildRow(row) {
|
|
32
51
|
const { program, isMetered, ...rest } = row;
|
|
33
|
-
|
|
52
|
+
const mark = row.kind === 'claudeSignIn' ? signInMark : row.isActive ? activeMark : '';
|
|
53
|
+
return { ...rest, label: `${mark}${program} · ${row.id}${isMetered ? meteredMark : ''}` };
|
|
34
54
|
}
|
|
35
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* @description The board's rows: the Claude accounts — one that cannot work as a sign-in row where a sign-in mends it (signed out, expired,
|
|
57
|
+
* refused by the API), and none where it does not (its organization turned Claude subscription use off: the usage block says so) —, then
|
|
58
|
+
* connected OpenCode providers.
|
|
59
|
+
*/
|
|
36
60
|
function buildLimitsBoardRows(input) {
|
|
37
61
|
const rows = [];
|
|
38
62
|
const { current } = input;
|
|
39
63
|
for (const profile of input.detection.claudeProfiles) {
|
|
40
|
-
|
|
64
|
+
const usability = (0, claudeAuthRefusal_1.getClaudeProfileUsability)(profile);
|
|
65
|
+
if (usability !== 'usable') {
|
|
66
|
+
if ((0, claudeAuthRefusal_1.checkIsClaudeUsabilityMendedBySignIn)(usability))
|
|
67
|
+
rows.push(buildRow({ kind: 'claudeSignIn', id: profile.name, program: input.words.claude, isActive: false }));
|
|
41
68
|
continue;
|
|
69
|
+
}
|
|
42
70
|
rows.push(buildRow({
|
|
43
71
|
kind: 'claude',
|
|
44
72
|
id: profile.name,
|
|
@@ -72,15 +100,19 @@ function formatUsageProviderName(providerId) {
|
|
|
72
100
|
return providerId === openCodeUsage_1.chatGptProviderId ? `${providerId} (${chatGptBrandName})` : providerId;
|
|
73
101
|
}
|
|
74
102
|
/**
|
|
75
|
-
* @description The usage block of the `/limits` message: the heading and the entries —
|
|
76
|
-
* `/accounts` order
|
|
103
|
+
* @description The usage block of the `/limits` message: the heading and the entries — Claude accounts in
|
|
104
|
+
* `/accounts` order (one that cannot work says why, `<name> — 🔑 sign-in expired`, whatever it was last polled at), then connected
|
|
105
|
+
* OpenCode providers with a recorded usage in catalog order. A signed-in account never polled
|
|
77
106
|
* and not limited, and a provider without usage, have no entry; with no entry at all there is no block (`''`, no heading).
|
|
78
107
|
*/
|
|
79
108
|
function formatLimitsUsageBlock(input) {
|
|
80
109
|
const entries = [];
|
|
81
110
|
for (const profile of input.detection.claudeProfiles) {
|
|
82
|
-
|
|
111
|
+
const usability = (0, claudeAuthRefusal_1.getClaudeProfileUsability)(profile);
|
|
112
|
+
if (usability !== 'usable') {
|
|
113
|
+
entries.push(`${profile.name} — ${formatUnusableMark(usability)}`);
|
|
83
114
|
continue;
|
|
115
|
+
}
|
|
84
116
|
const usageLines = (0, claudeProfileUsageLines_1.formatClaudeProfileUsageLines)(profile, input.timezone, input.nowMs);
|
|
85
117
|
// An account billed to API credits has no windows: its entry says how it pays, the used-up mark hangs under it.
|
|
86
118
|
const entry = formatUsageEntry(profile.name, profile.billing === 'api' ? [(0, i18n_1.t)('account.kind.api'), ...usageLines] : usageLines);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitsBoardPlan.js","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"limitsBoardPlan.js","sourceRoot":"","sources":["../../src/utils/limitsBoardPlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAiEH,oDA0BC;AAgCD,wDAoBC;AA7ID,kCAA4B;AAC5B,2DAAmI;AACnI,uEAA0E;AAC1E,mDAKyB;AACzB,mDAAsF;AAEtF,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,wKAAwK;AACxK,MAAM,UAAU,GAAG,KAAK,CAAC;AACzB,6GAA6G;AAC7G,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,0JAA0J;AAC1J,MAAM,gBAAgB,GAAwE;IAC5F,WAAW,EAAE,uBAAuB;IACpC,SAAS,EAAE,sBAAsB;IACjC,QAAQ,EAAE,qBAAqB;IAC/B,WAAW,EAAE,wBAAwB;CACtC,CAAC;A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AAU,CAAC,EAAE,IAAA,uDAA6B,EAAC,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3I,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAC,qBAAqB,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvF,CAAC"}
|
package/dist/utils/lostWork.d.ts
CHANGED
|
@@ -103,11 +103,25 @@ export declare function getHeldLostWorkPlan(input: {
|
|
|
103
103
|
reason: LostWorkReason;
|
|
104
104
|
isLimitWaitArmed: boolean;
|
|
105
105
|
}): LostWorkPlan;
|
|
106
|
+
/**
|
|
107
|
+
* @name LostWorkTelling
|
|
108
|
+
* @description How the lost-work note asks the agent to tell about the loss:
|
|
109
|
+
* - `plain` — «tell the user in one or two lines what happened» (a topic, a request that owes an answer);
|
|
110
|
+
* - `watchHeld` — the wake of a tracker request a passing watch holds and that owes nobody an answer: the watch is still armed, so
|
|
111
|
+
* carry on without a comment and tell the requester only if they must know;
|
|
112
|
+
* - `runHeader` — the note rides a tracker fire: the run's header says when to answer, so tell the requester about the loss only if
|
|
113
|
+
* it changes what they wait for. No claim about a watch: the fire may be a check that just failed, a one-shot, or have no request open.
|
|
114
|
+
* A comment on an issue notifies the requester and the issue's watchers, which is why the two tracker wordings exist.
|
|
115
|
+
*/
|
|
116
|
+
export type LostWorkTelling = 'plain' | 'watchHeld' | 'runHeader';
|
|
106
117
|
/**
|
|
107
118
|
* @description The note the agent gets — as the automatic resume's prompt, or ahead of the next prompt. English with
|
|
108
|
-
* the baked reply-language directive (`replyLanguage` is the topic's language endonym).
|
|
119
|
+
* the baked reply-language directive (`replyLanguage` is the topic's language endonym). `telling` — how it asks to tell about the loss
|
|
120
|
+
* ({@link LostWorkTelling}; `plain` by default).
|
|
109
121
|
*/
|
|
110
|
-
export declare function buildLostWorkNote(record: LostWorkRecord, replyLanguage: string
|
|
122
|
+
export declare function buildLostWorkNote(record: LostWorkRecord, replyLanguage: string, options?: {
|
|
123
|
+
telling?: LostWorkTelling;
|
|
124
|
+
}): string;
|
|
111
125
|
/**
|
|
112
126
|
* @description One loss from two: a loss the agent was not told about yet stays, and a newer one adds to it — the
|
|
113
127
|
* tasks by id, the larger job count, the reason and time of the newer loss. The parts another agent was told first
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lostWork.d.ts","sourceRoot":"","sources":["../../src/utils/lostWork.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,sGAAsG;AACtG,MAAM,WAAW,QAAQ;IACvB,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC,8FAA8F;IAC9F,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wGAAwG;IACxG,mBAAmB,EAAE,OAAO,CAAC;IAC7B,8FAA8F;IAC9F,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;AAE/F,kHAAkH;AAClH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,QAAiB,CA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C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB,GAAG,YAAY,CAKf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GAAG,YAAY,CAG9G;AAwBD;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,WAAW,GAAG,WAAW,CAAC;AAelE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,CAAA;CAAO,GAAG,MAAM,CAapI;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,KAAK,EAAE,cAAc,GAAG,cAAc,CAW9G;AAyBD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAQnI"}
|
package/dist/utils/lostWork.js
CHANGED
|
@@ -112,11 +112,24 @@ function describeLostWorkForAgent(lostWork) {
|
|
|
112
112
|
parts.push('the turn you were in the middle of, which was cut off');
|
|
113
113
|
return parts.join('; ');
|
|
114
114
|
}
|
|
115
|
+
/** The note's last line: what to do about the loss and when to tell, per {@link LostWorkTelling}. */
|
|
116
|
+
function buildLostWorkTellingLine(telling, replyLanguage) {
|
|
117
|
+
const stateReviewSentence = 'Check its state yourself (output files, processes, the repository), start again what is still needed — prefer the bot\'s schedule_* tools for anything that must survive a restart';
|
|
118
|
+
if (telling === 'watchHeld') {
|
|
119
|
+
return `${stateReviewSentence}. Your watch is still armed and nothing the requester wrote is waiting for your answer, so carry on without a comment, ` +
|
|
120
|
+
`and tell the requester about it, IN ${replyLanguage}, only if they must know (it changes what they are waiting for).`;
|
|
121
|
+
}
|
|
122
|
+
if (telling === 'runHeader') {
|
|
123
|
+
return `${stateReviewSentence}. This run's header says when to answer; tell the requester about the loss, IN ${replyLanguage}, only if it changes what they are waiting for.`;
|
|
124
|
+
}
|
|
125
|
+
return `${stateReviewSentence} — and tell the user in one or two lines what happened, IN ${replyLanguage}.`;
|
|
126
|
+
}
|
|
115
127
|
/**
|
|
116
128
|
* @description The note the agent gets — as the automatic resume's prompt, or ahead of the next prompt. English with
|
|
117
|
-
* the baked reply-language directive (`replyLanguage` is the topic's language endonym).
|
|
129
|
+
* the baked reply-language directive (`replyLanguage` is the topic's language endonym). `telling` — how it asks to tell about the loss
|
|
130
|
+
* ({@link LostWorkTelling}; `plain` by default).
|
|
118
131
|
*/
|
|
119
|
-
function buildLostWorkNote(record, replyLanguage) {
|
|
132
|
+
function buildLostWorkNote(record, replyLanguage, options = {}) {
|
|
120
133
|
// Only what the other agent could have started again: its tasks and jobs, not a result or a cut-off turn.
|
|
121
134
|
const restartableTold = record.otherAgentTold
|
|
122
135
|
? { ...noLostWork, backgroundTasks: record.otherAgentTold.backgroundTasks, scheduledJobCount: record.otherAgentTold.scheduledJobCount }
|
|
@@ -127,7 +140,7 @@ function buildLostWorkNote(record, replyLanguage) {
|
|
|
127
140
|
...(restartableTold && checkHasLostWork(restartableTold)
|
|
128
141
|
? [`The agent this conversation moved to meanwhile was told first about ${describeLostWorkForAgent(restartableTold)}, and may have started some of it again: look before you start that twice.`]
|
|
129
142
|
: []),
|
|
130
|
-
|
|
143
|
+
buildLostWorkTellingLine(options.telling ?? 'plain', replyLanguage),
|
|
131
144
|
].join('\n');
|
|
132
145
|
}
|
|
133
146
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lostWork.js","sourceRoot":"","sources":["../../src/utils/lostWork.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA+CH,4CAEC;AAMD,gEAEC;AAWD,8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AE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -36,8 +36,8 @@ export interface MessageContext {
|
|
|
36
36
|
export declare function joinMessageContextBlocks(blocks: ReadonlyArray<string | null | undefined>): string | undefined;
|
|
37
37
|
/**
|
|
38
38
|
* @description Whether the words of a message are somebody else's: it was FORWARDED, or a person who is not the operator sent
|
|
39
|
-
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a
|
|
40
|
-
*
|
|
39
|
+
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a reminder
|
|
40
|
+
* step's capture, a context wipe), so none of them can be missed for one kind of sender.
|
|
41
41
|
*/
|
|
42
42
|
export declare function checkIsForeignWords(context: MessageContext | undefined): boolean;
|
|
43
43
|
/**
|
|
@@ -31,8 +31,8 @@ function joinMessageContextBlocks(blocks) {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* @description Whether the words of a message are somebody else's: it was FORWARDED, or a person who is not the operator sent
|
|
34
|
-
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a
|
|
35
|
-
*
|
|
34
|
+
* it. Such words are content, never control input — the ONE predicate every control guard asks (a slash command, a reminder
|
|
35
|
+
* step's capture, a context wipe), so none of them can be missed for one kind of sender.
|
|
36
36
|
*/
|
|
37
37
|
function checkIsForeignWords(context) {
|
|
38
38
|
return context?.isForwarded === true || context?.nonOperatorSender !== undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type SessionKey } from '../sessionKey';
|
|
2
|
+
/**
|
|
3
|
+
* @description The per-session mid-turn INBOX of a running Claude agent: text the bot wants the agent to read inside its turn, not
|
|
4
|
+
* only at its next prompt. A `PostToolUse` hook (no matcher) in the launch `--settings` file prints the session's inbox file,
|
|
5
|
+
* `DATA_DIR/todos/inbox/<session id>.json`, after the agent's next tool call: ready hook JSON whose `additionalContext` Claude reads
|
|
6
|
+
* with that tool's result (probed on Claude Code 2.1.310). The hook moves the file before printing it, so a text is delivered once;
|
|
7
|
+
* with no file it prints nothing. The directory is the project board's (it predates the accounts note); the hook command and the
|
|
8
|
+
* single `PostToolUse` entry that carries it are unchanged by there being more than one kind of text in it.
|
|
9
|
+
*
|
|
10
|
+
* One file holds one or more SECTIONS, joined by a blank line: the accounts note (`limitNotes/`) and the project board's changes
|
|
11
|
+
* (`todos/midTurn.ts`). Each section is offered and withdrawn on its own rules — a section's withdrawal never touches another's, and
|
|
12
|
+
* a section is withdrawn wherever no tool call of the session can take it any more (a turn start the bot makes, a turn's end, a turn
|
|
13
|
+
* held open, the session's start, stop or end) — but the FILE is taken whole: when the hook moved it, every section it held counts as
|
|
14
|
+
* taken, and each section's `onTaken` fires once. A section withdrawn unseen keeps its owner's state (the board's changes stay unseen,
|
|
15
|
+
* the note stays due), so the inbox dir is empty between turns. A restart forgets what was written: at worst a text is delivered
|
|
16
|
+
* twice, never lost.
|
|
17
|
+
*
|
|
18
|
+
* Nothing here writes to an agent's input, stamps activity, wakes a session or opens a request: it writes and removes files.
|
|
19
|
+
*/
|
|
20
|
+
/** The sections of an inbox, in the order they are joined: the short accounts note first, so the cut of an over-long board never takes it. */
|
|
21
|
+
export declare const midTurnInboxSections: readonly ["accounts", "todoBoard"];
|
|
22
|
+
export type MidTurnInboxSection = (typeof midTurnInboxSections)[number];
|
|
23
|
+
/** Claude Code caps a hook's `additionalContext`; the text is cut below it. */
|
|
24
|
+
export declare const midTurnInboxMaxChars = 10000;
|
|
25
|
+
/** @description Where the inboxes live: `DATA_DIR/todos/inbox`. */
|
|
26
|
+
export declare function getMidTurnInboxDir(dataDir: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* @description The `PostToolUse` hook's shell command. With the inbox dir empty — nearly every tool call — it reads
|
|
29
|
+
* the input whole (the CLI must never write into a closed pipe) and exits; only while an inbox waits does it start
|
|
30
|
+
* `nodePath` (the bot's own, written at every launch) to parse the input ({@link inboxHookScript}). It always exits 0 —
|
|
31
|
+
* a hook failure must never stop the agent's tool.
|
|
32
|
+
*
|
|
33
|
+
* Only the MAIN agent takes the inbox. A sub-agent's tool call fires the hook too, with the SAME `session_id` and an
|
|
34
|
+
* `agent_id` of its own (measured on Claude Code 2.1.310); taken there, the text would land in the sub-agent's
|
|
35
|
+
* context and count as delivered while the main agent never got it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildMidTurnInboxHookCommand(inboxDir: string, nodePath?: string): string;
|
|
38
|
+
/** @description The hook output Claude reads `text` from: `additionalContext` of a `PostToolUse` hook, within the cap. */
|
|
39
|
+
export declare function buildMidTurnInboxHookOutput(text: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* @name MidTurnInboxOffer
|
|
42
|
+
* @description A section's text and what its owner does about it: `onTaken` — the hook took the file, the text reached the agent;
|
|
43
|
+
* `onWithdrawn` — it was taken back unseen (a turn start, a turn's end, the session's end, a newer offer, boot).
|
|
44
|
+
*/
|
|
45
|
+
export interface MidTurnInboxOffer {
|
|
46
|
+
text: string;
|
|
47
|
+
onTaken: () => void;
|
|
48
|
+
onWithdrawn?: () => void;
|
|
49
|
+
}
|
|
50
|
+
/** @name MidTurnInbox @description What the todo board's mid-turn path and the accounts engine call. */
|
|
51
|
+
export interface MidTurnInbox {
|
|
52
|
+
/**
|
|
53
|
+
* Offer `section` to the Claude session `sessionId` of the conversation, replacing the text it already waits with (the replaced
|
|
54
|
+
* offer is withdrawn). `false`, nothing written, for a session id that is no file name.
|
|
55
|
+
*/
|
|
56
|
+
offer: (key: SessionKey, sessionId: string, section: MidTurnInboxSection, offer: MidTurnInboxOffer) => boolean;
|
|
57
|
+
/** Whether `section` of the conversation waits for the agent's next tool call. */
|
|
58
|
+
checkIsWaiting: (key: SessionKey, section: MidTurnInboxSection) => boolean;
|
|
59
|
+
/** The files the hook took since the last look: the sections they held count as taken, each `onTaken` once. One conversation's, or every one's. */
|
|
60
|
+
reconcile: (key?: SessionKey) => void;
|
|
61
|
+
/**
|
|
62
|
+
* No tool call of the session can take `section` any more: withdrawn — counted as taken if the hook took the file meanwhile — and
|
|
63
|
+
* the copies hooks that are gone moved aside and never removed go with it. Another section of the same file stays and is written
|
|
64
|
+
* again without it.
|
|
65
|
+
*/
|
|
66
|
+
withdraw: (key: SessionKey, section: MidTurnInboxSection) => void;
|
|
67
|
+
/**
|
|
68
|
+
* At boot: every inbox left is withdrawn — this process does not know what it carries, and a session that ended never takes its
|
|
69
|
+
* own. What they carried is still unseen or still due, so the next prompt (or poll) delivers it again.
|
|
70
|
+
*/
|
|
71
|
+
clearAll: () => void;
|
|
72
|
+
}
|
|
73
|
+
/** @name MidTurnInboxDeps @description `checkIsProcessAlive` — whether a process runs (the hook that moved a file aside, run as the bot's own user); `kill(pid, 0)` by default. */
|
|
74
|
+
export interface MidTurnInboxDeps {
|
|
75
|
+
inboxDir: string;
|
|
76
|
+
checkIsProcessAlive?: (pid: number) => boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare function createMidTurnInbox(deps: MidTurnInboxDeps): MidTurnInbox;
|
|
79
|
+
//# sourceMappingURL=midTurnInbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"midTurnInbox.d.ts","sourceRoot":"","sources":["../../src/utils/midTurnInbox.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAI7D;;;;;;;;;;;;;;;;;GAiBG;AAEH,8IAA8I;AAC9I,eAAO,MAAM,oBAAoB,oCAAqC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIxE,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAW3C,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAyB,GAAG,MAAM,CAO1G;AAED,0HAA0H;AAC1H,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,wGAAwG;AACxG,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC/G,kFAAkF;IAClF,cAAc,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC;IAC3E,mJAAmJ;IACnJ,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClE;;;OAGG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,mLAAmL;AACnL,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CAChD;AASD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CA8HvE"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.midTurnInboxMaxChars = exports.midTurnInboxSections = void 0;
|
|
37
|
+
exports.getMidTurnInboxDir = getMidTurnInboxDir;
|
|
38
|
+
exports.buildMidTurnInboxHookCommand = buildMidTurnInboxHookCommand;
|
|
39
|
+
exports.buildMidTurnInboxHookOutput = buildMidTurnInboxHookOutput;
|
|
40
|
+
exports.createMidTurnInbox = createMidTurnInbox;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const store_1 = require("../todos/store");
|
|
44
|
+
const sessionKey_1 = require("../sessionKey");
|
|
45
|
+
const jsonStreamHost_1 = require("./jsonStreamHost");
|
|
46
|
+
const tmuxExec_1 = require("./tmuxExec");
|
|
47
|
+
/**
|
|
48
|
+
* @description The per-session mid-turn INBOX of a running Claude agent: text the bot wants the agent to read inside its turn, not
|
|
49
|
+
* only at its next prompt. A `PostToolUse` hook (no matcher) in the launch `--settings` file prints the session's inbox file,
|
|
50
|
+
* `DATA_DIR/todos/inbox/<session id>.json`, after the agent's next tool call: ready hook JSON whose `additionalContext` Claude reads
|
|
51
|
+
* with that tool's result (probed on Claude Code 2.1.310). The hook moves the file before printing it, so a text is delivered once;
|
|
52
|
+
* with no file it prints nothing. The directory is the project board's (it predates the accounts note); the hook command and the
|
|
53
|
+
* single `PostToolUse` entry that carries it are unchanged by there being more than one kind of text in it.
|
|
54
|
+
*
|
|
55
|
+
* One file holds one or more SECTIONS, joined by a blank line: the accounts note (`limitNotes/`) and the project board's changes
|
|
56
|
+
* (`todos/midTurn.ts`). Each section is offered and withdrawn on its own rules — a section's withdrawal never touches another's, and
|
|
57
|
+
* a section is withdrawn wherever no tool call of the session can take it any more (a turn start the bot makes, a turn's end, a turn
|
|
58
|
+
* held open, the session's start, stop or end) — but the FILE is taken whole: when the hook moved it, every section it held counts as
|
|
59
|
+
* taken, and each section's `onTaken` fires once. A section withdrawn unseen keeps its owner's state (the board's changes stay unseen,
|
|
60
|
+
* the note stays due), so the inbox dir is empty between turns. A restart forgets what was written: at worst a text is delivered
|
|
61
|
+
* twice, never lost.
|
|
62
|
+
*
|
|
63
|
+
* Nothing here writes to an agent's input, stamps activity, wakes a session or opens a request: it writes and removes files.
|
|
64
|
+
*/
|
|
65
|
+
/** The sections of an inbox, in the order they are joined: the short accounts note first, so the cut of an over-long board never takes it. */
|
|
66
|
+
exports.midTurnInboxSections = ['accounts', 'todoBoard'];
|
|
67
|
+
/** The inbox directory under the todos' (`DATA_DIR/todos/inbox`). */
|
|
68
|
+
const inboxDirName = 'inbox';
|
|
69
|
+
/** Claude Code caps a hook's `additionalContext`; the text is cut below it. */
|
|
70
|
+
exports.midTurnInboxMaxChars = 10_000;
|
|
71
|
+
/** A session id names a file: only these characters, so no id can reach outside the inbox. */
|
|
72
|
+
const sessionIdRe = /^[A-Za-z0-9_-]+$/;
|
|
73
|
+
const inboxFileExtension = '.json';
|
|
74
|
+
/** A copy the hook moved aside: `<session id>.json.<the hook's process id>` (never the bot's `….tmp`). */
|
|
75
|
+
const takenCopyNameRe = /^[A-Za-z0-9_-]+\.json\.(\d+)$/;
|
|
76
|
+
/** Private: what the agents work on. */
|
|
77
|
+
const inboxFileMode = 0o600;
|
|
78
|
+
/** What joins the sections of one inbox. */
|
|
79
|
+
const sectionSeparator = '\n\n';
|
|
80
|
+
/** @description Where the inboxes live: `DATA_DIR/todos/inbox`. */
|
|
81
|
+
function getMidTurnInboxDir(dataDir) {
|
|
82
|
+
return path.join((0, store_1.getTodosDir)(dataDir), inboxDirName);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The parse of a hook input, run by the bot's own `node` with the inbox dir as its argument: the input's TOP-LEVEL
|
|
86
|
+
* fields alone decide, in whatever order they come — a tool's own input or output naming `agent_id` or `session_id`
|
|
87
|
+
* is never mistaken for them. A sub-agent's call (an `agent_id`) and an id outside {@link sessionIdRe} print nothing;
|
|
88
|
+
* otherwise the session's inbox is moved aside, printed and removed.
|
|
89
|
+
*/
|
|
90
|
+
const inboxHookScript = [
|
|
91
|
+
'const fs = require("fs"), path = require("path");',
|
|
92
|
+
'let text = "";',
|
|
93
|
+
'process.stdin.setEncoding("utf8").on("data", (chunk) => { text += chunk; }).on("end", () => {',
|
|
94
|
+
' try {',
|
|
95
|
+
' const input = JSON.parse(text);',
|
|
96
|
+
' if (input === null || typeof input !== "object" || "agent_id" in input) return;',
|
|
97
|
+
` if (typeof input.session_id !== "string" || !${sessionIdRe.toString()}.test(input.session_id)) return;`,
|
|
98
|
+
` const file = path.join(process.argv[1], input.session_id + "${inboxFileExtension}"), taken = file + "." + process.pid;`,
|
|
99
|
+
' try { fs.renameSync(file, taken); } catch { return; }',
|
|
100
|
+
' process.stdout.write(fs.readFileSync(taken, "utf8"));',
|
|
101
|
+
' fs.rmSync(taken, { force: true });',
|
|
102
|
+
' } catch {}',
|
|
103
|
+
'});',
|
|
104
|
+
].join(' ');
|
|
105
|
+
/**
|
|
106
|
+
* @description The `PostToolUse` hook's shell command. With the inbox dir empty — nearly every tool call — it reads
|
|
107
|
+
* the input whole (the CLI must never write into a closed pipe) and exits; only while an inbox waits does it start
|
|
108
|
+
* `nodePath` (the bot's own, written at every launch) to parse the input ({@link inboxHookScript}). It always exits 0 —
|
|
109
|
+
* a hook failure must never stop the agent's tool.
|
|
110
|
+
*
|
|
111
|
+
* Only the MAIN agent takes the inbox. A sub-agent's tool call fires the hook too, with the SAME `session_id` and an
|
|
112
|
+
* `agent_id` of its own (measured on Claude Code 2.1.310); taken there, the text would land in the sub-agent's
|
|
113
|
+
* context and count as delivered while the main agent never got it.
|
|
114
|
+
*/
|
|
115
|
+
function buildMidTurnInboxHookCommand(inboxDir, nodePath = process.execPath) {
|
|
116
|
+
const dir = (0, tmuxExec_1.shellSingleQuote)(inboxDir);
|
|
117
|
+
return [
|
|
118
|
+
`[ -n "$(ls -A ${dir} 2>/dev/null)" ] || { cat > /dev/null; exit 0; }`,
|
|
119
|
+
`${(0, tmuxExec_1.shellSingleQuote)(nodePath)} -e ${(0, tmuxExec_1.shellSingleQuote)(inboxHookScript)} ${dir}`,
|
|
120
|
+
'exit 0',
|
|
121
|
+
].join('; ');
|
|
122
|
+
}
|
|
123
|
+
/** @description The hook output Claude reads `text` from: `additionalContext` of a `PostToolUse` hook, within the cap. */
|
|
124
|
+
function buildMidTurnInboxHookOutput(text) {
|
|
125
|
+
const characters = [...text];
|
|
126
|
+
const fitted = characters.length <= exports.midTurnInboxMaxChars ? text : `${characters.slice(0, exports.midTurnInboxMaxChars - 1).join('')}…`;
|
|
127
|
+
return JSON.stringify({ hookSpecificOutput: { hookEventName: 'PostToolUse', additionalContext: fitted } });
|
|
128
|
+
}
|
|
129
|
+
function createMidTurnInbox(deps) {
|
|
130
|
+
const { inboxDir, checkIsProcessAlive = jsonStreamHost_1.checkIsPidAlive } = deps;
|
|
131
|
+
const pendingInboxes = new Map();
|
|
132
|
+
function getInboxFilePath(sessionId) {
|
|
133
|
+
return path.join(inboxDir, `${sessionId}${inboxFileExtension}`);
|
|
134
|
+
}
|
|
135
|
+
function writeInbox(pending) {
|
|
136
|
+
const text = exports.midTurnInboxSections.flatMap((section) => pending.sections.get(section)?.text ?? []).join(sectionSeparator);
|
|
137
|
+
fs.mkdirSync(path.dirname(pending.filePath), { recursive: true, mode: 0o700 });
|
|
138
|
+
const tempPath = `${pending.filePath}.${process.pid}.tmp`;
|
|
139
|
+
fs.writeFileSync(tempPath, buildMidTurnInboxHookOutput(text), { mode: inboxFileMode });
|
|
140
|
+
fs.renameSync(tempPath, pending.filePath);
|
|
141
|
+
}
|
|
142
|
+
/** The hook took the file: every section it held counts as taken. */
|
|
143
|
+
function reconcileOne(conversationKey) {
|
|
144
|
+
const pending = pendingInboxes.get(conversationKey);
|
|
145
|
+
if (pending === undefined || fs.existsSync(pending.filePath))
|
|
146
|
+
return;
|
|
147
|
+
pendingInboxes.delete(conversationKey);
|
|
148
|
+
for (const section of exports.midTurnInboxSections)
|
|
149
|
+
pending.sections.get(section)?.onTaken();
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A copy the hook moved aside and never removed (its `node` ended between the move and the removal) would keep the inbox dir
|
|
153
|
+
* non-empty until boot. Any session's copy goes — but only once the hook that moved it is gone: a live one may be reading it this
|
|
154
|
+
* very moment, and its text already counts as taken.
|
|
155
|
+
*/
|
|
156
|
+
function removeTakenLeftovers() {
|
|
157
|
+
let names;
|
|
158
|
+
try {
|
|
159
|
+
names = fs.readdirSync(inboxDir);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
for (const name of names) {
|
|
165
|
+
const hookPid = takenCopyNameRe.exec(name)?.[1];
|
|
166
|
+
if (hookPid !== undefined && !checkIsProcessAlive(Number(hookPid)))
|
|
167
|
+
fs.rmSync(path.join(inboxDir, name), { force: true });
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Withdraw every section of the conversation's inbox and remove its file. */
|
|
171
|
+
function withdrawAll(conversationKey) {
|
|
172
|
+
const pending = pendingInboxes.get(conversationKey);
|
|
173
|
+
if (pending === undefined)
|
|
174
|
+
return;
|
|
175
|
+
pendingInboxes.delete(conversationKey);
|
|
176
|
+
fs.rmSync(pending.filePath, { force: true });
|
|
177
|
+
for (const section of exports.midTurnInboxSections)
|
|
178
|
+
pending.sections.get(section)?.onWithdrawn?.();
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
offer(key, sessionId, section, offer) {
|
|
182
|
+
if (!sessionIdRe.test(sessionId))
|
|
183
|
+
return false;
|
|
184
|
+
const conversationKey = (0, sessionKey_1.keyToString)(key);
|
|
185
|
+
reconcileOne(conversationKey);
|
|
186
|
+
// Another session of the conversation (a restart, a resume under a new id) never takes the old session's file.
|
|
187
|
+
if (pendingInboxes.get(conversationKey)?.sessionId !== sessionId)
|
|
188
|
+
withdrawAll(conversationKey);
|
|
189
|
+
const pending = pendingInboxes.get(conversationKey) ?? { sessionId, filePath: getInboxFilePath(sessionId), sections: new Map() };
|
|
190
|
+
const replaced = pending.sections.get(section);
|
|
191
|
+
pending.sections.set(section, offer);
|
|
192
|
+
try {
|
|
193
|
+
writeInbox(pending);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
// The file kept its old text, so the old offer stays what the agent will read; the new one is the caller's to give back.
|
|
197
|
+
if (replaced === undefined)
|
|
198
|
+
pending.sections.delete(section);
|
|
199
|
+
else
|
|
200
|
+
pending.sections.set(section, replaced);
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
pendingInboxes.set(conversationKey, pending);
|
|
204
|
+
replaced?.onWithdrawn?.();
|
|
205
|
+
return true;
|
|
206
|
+
},
|
|
207
|
+
checkIsWaiting(key, section) {
|
|
208
|
+
const conversationKey = (0, sessionKey_1.keyToString)(key);
|
|
209
|
+
reconcileOne(conversationKey);
|
|
210
|
+
return pendingInboxes.get(conversationKey)?.sections.has(section) === true;
|
|
211
|
+
},
|
|
212
|
+
reconcile(key) {
|
|
213
|
+
if (key !== undefined) {
|
|
214
|
+
reconcileOne((0, sessionKey_1.keyToString)(key));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
for (const conversationKey of [...pendingInboxes.keys()])
|
|
218
|
+
reconcileOne(conversationKey);
|
|
219
|
+
},
|
|
220
|
+
withdraw(key, section) {
|
|
221
|
+
removeTakenLeftovers();
|
|
222
|
+
const conversationKey = (0, sessionKey_1.keyToString)(key);
|
|
223
|
+
reconcileOne(conversationKey);
|
|
224
|
+
const pending = pendingInboxes.get(conversationKey);
|
|
225
|
+
const withdrawn = pending?.sections.get(section);
|
|
226
|
+
if (pending === undefined || withdrawn === undefined)
|
|
227
|
+
return;
|
|
228
|
+
pending.sections.delete(section);
|
|
229
|
+
const remaining = exports.midTurnInboxSections.flatMap((name) => pending.sections.get(name) ?? []);
|
|
230
|
+
try {
|
|
231
|
+
if (remaining.length === 0) {
|
|
232
|
+
pendingInboxes.delete(conversationKey);
|
|
233
|
+
fs.rmSync(pending.filePath, { force: true });
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
writeInbox(pending);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
// The file would keep the withdrawn text — a hook could hand it to the agent in a LATER turn, the double note the withdrawal
|
|
241
|
+
// exists to prevent. Remove it whole and withdraw every section it held: «withdrawn» only means «stays due / stays unseen».
|
|
242
|
+
pendingInboxes.delete(conversationKey);
|
|
243
|
+
try {
|
|
244
|
+
fs.rmSync(pending.filePath, { force: true });
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
for (const offer of remaining)
|
|
248
|
+
offer.onWithdrawn?.();
|
|
249
|
+
withdrawn.onWithdrawn?.();
|
|
250
|
+
}
|
|
251
|
+
throw error;
|
|
252
|
+
}
|
|
253
|
+
withdrawn.onWithdrawn?.();
|
|
254
|
+
},
|
|
255
|
+
clearAll() {
|
|
256
|
+
const pendings = [...pendingInboxes.values()];
|
|
257
|
+
pendingInboxes.clear();
|
|
258
|
+
fs.rmSync(inboxDir, { recursive: true, force: true });
|
|
259
|
+
for (const pending of pendings)
|
|
260
|
+
for (const section of exports.midTurnInboxSections)
|
|
261
|
+
pending.sections.get(section)?.onWithdrawn?.();
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=midTurnInbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"midTurnInbox.js","sourceRoot":"","sources":["../../src/utils/midTurnInbox.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,gDAEC;AAkCD,oEAOC;AAGD,kEAIC;AAkDD,gDA8HC;AA/QD,uCAAyB;AACzB,2CAA6B;AAC7B,0CAA6C;AAC7C,8CAA6D;AAC7D,qDAAmD;AACnD,yCAA8C;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AAEH,8IAA8I;AACjI,QAAA,oBAAoB,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAC;AAGvE,qEAAqE;AACrE,MAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,+EAA+E;AAClE,QAAA,oBAAoB,GAAG,MAAM,CAAC;AAC3C,8FAA8F;AAC9F,MAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,MAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,0GAA0G;AAC1G,MAAM,eAAe,GAAG,+BAA+B,CAAC;AACxD,wCAAwC;AACxC,MAAM,aAAa,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