charness 4.2.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +168 -2
- package/DEVELOPMENT.md +58 -10
- package/LICENSE +331 -151
- package/MIGRATION_3_TO_4.md +8 -5
- package/README.md +21 -9
- package/SETUP.md +54 -10
- package/agent-plugin/README.md +10 -3
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +18 -27
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +5 -3
- package/agent-plugin/skills/charness-orchestration/SKILL.md +62 -16
- package/dist/adapters/claudeCliAdapter.d.ts +4 -0
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +13 -0
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.d.ts +136 -10
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +365 -77
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/createAdapter.d.ts +12 -3
- package/dist/adapters/createAdapter.d.ts.map +1 -1
- package/dist/adapters/createAdapter.js +39 -13
- package/dist/adapters/createAdapter.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +34 -0
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +118 -11
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/apiErrorRetry.d.ts +11 -3
- package/dist/apiErrorRetry.d.ts.map +1 -1
- package/dist/apiErrorRetry.js +33 -3
- package/dist/apiErrorRetry.js.map +1 -1
- package/dist/apiRetryKick.d.ts +18 -7
- package/dist/apiRetryKick.d.ts.map +1 -1
- package/dist/apiRetryKick.js +26 -13
- package/dist/apiRetryKick.js.map +1 -1
- package/dist/bot.d.ts +2 -6
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +2055 -653
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +28 -6
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +89 -22
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/connectors/jira/answerSink.d.ts +102 -7
- package/dist/connectors/jira/answerSink.d.ts.map +1 -1
- package/dist/connectors/jira/answerSink.js +366 -60
- package/dist/connectors/jira/answerSink.js.map +1 -1
- package/dist/connectors/jira/answerThreads.d.ts +44 -0
- package/dist/connectors/jira/answerThreads.d.ts.map +1 -0
- package/dist/connectors/jira/answerThreads.js +85 -0
- package/dist/connectors/jira/answerThreads.js.map +1 -0
- package/dist/connectors/jira/client.d.ts +67 -2
- package/dist/connectors/jira/client.d.ts.map +1 -1
- package/dist/connectors/jira/client.js +176 -4
- package/dist/connectors/jira/client.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +6 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +14 -1
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +19 -0
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +68 -6
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/contextPreamble.d.ts.map +1 -1
- package/dist/connectors/jira/contextPreamble.js +6 -1
- package/dist/connectors/jira/contextPreamble.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts +21 -6
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +22 -16
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +8 -1
- package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
- package/dist/connectors/jira/issueBlocks.js +38 -2
- package/dist/connectors/jira/issueBlocks.js.map +1 -1
- package/dist/connectors/jira/operatorIssue.d.ts +28 -0
- package/dist/connectors/jira/operatorIssue.d.ts.map +1 -0
- package/dist/connectors/jira/operatorIssue.js +81 -0
- package/dist/connectors/jira/operatorIssue.js.map +1 -0
- package/dist/connectors/jira/outbound.d.ts +8 -4
- package/dist/connectors/jira/outbound.d.ts.map +1 -1
- package/dist/connectors/jira/outbound.js +16 -8
- package/dist/connectors/jira/outbound.js.map +1 -1
- package/dist/connectors/jira/outgoingFileCheck.d.ts +37 -0
- package/dist/connectors/jira/outgoingFileCheck.d.ts.map +1 -0
- package/dist/connectors/jira/outgoingFileCheck.js +279 -0
- package/dist/connectors/jira/outgoingFileCheck.js.map +1 -0
- package/dist/connectors/jira/outgoingFiles.d.ts +81 -0
- package/dist/connectors/jira/outgoingFiles.d.ts.map +1 -0
- package/dist/connectors/jira/outgoingFiles.js +268 -0
- package/dist/connectors/jira/outgoingFiles.js.map +1 -0
- package/dist/connectors/jira/progressComments.d.ts +69 -0
- package/dist/connectors/jira/progressComments.d.ts.map +1 -0
- package/dist/connectors/jira/progressComments.js +136 -0
- package/dist/connectors/jira/progressComments.js.map +1 -0
- package/dist/connectors/jira/prompt.d.ts +5 -1
- package/dist/connectors/jira/prompt.d.ts.map +1 -1
- package/dist/connectors/jira/prompt.js +23 -3
- package/dist/connectors/jira/prompt.js.map +1 -1
- package/dist/connectors/jira/promptSpill.js +1 -1
- package/dist/connectors/jira/promptSpill.js.map +1 -1
- package/dist/connectors/jira/trigger.d.ts +13 -5
- package/dist/connectors/jira/trigger.d.ts.map +1 -1
- package/dist/connectors/jira/trigger.js +13 -7
- package/dist/connectors/jira/trigger.js.map +1 -1
- package/dist/connectors/jira/uploadedFiles.d.ts +48 -0
- package/dist/connectors/jira/uploadedFiles.d.ts.map +1 -0
- package/dist/connectors/jira/uploadedFiles.js +123 -0
- package/dist/connectors/jira/uploadedFiles.js.map +1 -0
- package/dist/connectors/telegram/commands/backendSwitch.d.ts +9 -1
- package/dist/connectors/telegram/commands/backendSwitch.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/backendSwitch.js +17 -8
- package/dist/connectors/telegram/commands/backendSwitch.js.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.d.ts +2 -0
- package/dist/connectors/telegram/commands/botSkills.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.js +17 -2
- package/dist/connectors/telegram/commands/botSkills.js.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -0
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +22 -4
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +14 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +261 -96
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/limitReminders.d.ts +21 -0
- package/dist/connectors/telegram/commands/limitReminders.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/limitReminders.js +95 -0
- package/dist/connectors/telegram/commands/limitReminders.js.map +1 -0
- package/dist/connectors/telegram/commands/limitsBoard.d.ts +4 -0
- package/dist/connectors/telegram/commands/limitsBoard.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/limitsBoard.js +27 -6
- package/dist/connectors/telegram/commands/limitsBoard.js.map +1 -1
- package/dist/connectors/telegram/commands/modelProviders.d.ts +2 -2
- package/dist/connectors/telegram/commands/modelProviders.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/modelProviders.js +27 -16
- package/dist/connectors/telegram/commands/modelProviders.js.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.js +7 -2
- package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
- package/dist/connectors/telegram/commands/workerRoles.d.ts +25 -0
- package/dist/connectors/telegram/commands/workerRoles.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/workerRoles.js +259 -0
- package/dist/connectors/telegram/commands/workerRoles.js.map +1 -0
- package/dist/connectors/telegram/groupWelcome.d.ts +12 -0
- package/dist/connectors/telegram/groupWelcome.d.ts.map +1 -0
- package/dist/connectors/telegram/groupWelcome.js +12 -0
- package/dist/connectors/telegram/groupWelcome.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +7 -0
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +10 -0
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/connectors/telegram/outputFlushPlan.d.ts +12 -0
- package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
- package/dist/connectors/telegram/outputFlushPlan.js +12 -0
- package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +1 -1
- package/dist/connectors/telegram/topicIndicator.d.ts +1 -1
- package/dist/connectors/telegram/topicIndicator.d.ts.map +1 -1
- package/dist/connectors/telegram/topicIndicator.js +103 -5
- package/dist/connectors/telegram/topicIndicator.js.map +1 -1
- package/dist/effortLevels.d.ts +6 -0
- package/dist/effortLevels.d.ts.map +1 -1
- package/dist/effortLevels.js +6 -1
- package/dist/effortLevels.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +95 -14
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +95 -14
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +95 -14
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +95 -14
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +95 -14
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +95 -14
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +95 -14
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +95 -14
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +95 -14
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +95 -14
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +95 -14
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +95 -14
- package/dist/i18n/zh.js.map +1 -1
- package/dist/instanceSettings.d.ts +24 -2
- package/dist/instanceSettings.d.ts.map +1 -1
- package/dist/instanceSettings.js +75 -3
- package/dist/instanceSettings.js.map +1 -1
- package/dist/limitNotes/engine.d.ts +47 -0
- package/dist/limitNotes/engine.d.ts.map +1 -0
- package/dist/limitNotes/engine.js +98 -0
- package/dist/limitNotes/engine.js.map +1 -0
- package/dist/limitNotes/noteText.d.ts +33 -0
- package/dist/limitNotes/noteText.d.ts.map +1 -0
- package/dist/limitNotes/noteText.js +55 -0
- package/dist/limitNotes/noteText.js.map +1 -0
- package/dist/limitNotes/plan.d.ts +147 -0
- package/dist/limitNotes/plan.d.ts.map +1 -0
- package/dist/limitNotes/plan.js +323 -0
- package/dist/limitNotes/plan.js.map +1 -0
- package/dist/limitNotes/reminderChoices.d.ts +30 -0
- package/dist/limitNotes/reminderChoices.d.ts.map +1 -0
- package/dist/limitNotes/reminderChoices.js +48 -0
- package/dist/limitNotes/reminderChoices.js.map +1 -0
- package/dist/limitNotes/service.d.ts +106 -0
- package/dist/limitNotes/service.d.ts.map +1 -0
- package/dist/limitNotes/service.js +169 -0
- package/dist/limitNotes/service.js.map +1 -0
- package/dist/openCodeSessionTitle.js +1 -1
- package/dist/openCodeSessionTitle.js.map +1 -1
- package/dist/outputTrace.d.ts +19 -0
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +23 -2
- package/dist/outputTrace.js.map +1 -1
- package/dist/platform/answerSink.d.ts +23 -0
- package/dist/platform/answerSink.d.ts.map +1 -1
- package/dist/platform/answerSink.js.map +1 -1
- package/dist/platform/operatorAlert.d.ts +24 -0
- package/dist/platform/operatorAlert.d.ts.map +1 -0
- package/dist/platform/operatorAlert.js +9 -0
- package/dist/platform/operatorAlert.js.map +1 -0
- package/dist/postToSession.d.ts +34 -2
- package/dist/postToSession.d.ts.map +1 -1
- package/dist/postToSession.js +31 -2
- package/dist/postToSession.js.map +1 -1
- package/dist/remoteRun/exitCodes.d.ts +2 -2
- package/dist/remoteRun/exitCodes.d.ts.map +1 -1
- package/dist/remoteRun/exitCodes.js +2 -2
- package/dist/remoteRun/exitCodes.js.map +1 -1
- package/dist/remoteRun/foreground.d.ts.map +1 -1
- package/dist/remoteRun/foreground.js +5 -1
- package/dist/remoteRun/foreground.js.map +1 -1
- package/dist/remoteRun/runnerClient.d.ts +1 -1
- package/dist/remoteRun/runnerClient.d.ts.map +1 -1
- package/dist/remoteRun/runnerClient.js +3 -3
- package/dist/remoteRun/runnerClient.js.map +1 -1
- package/dist/requests/answerRequest.d.ts +3 -0
- package/dist/requests/answerRequest.d.ts.map +1 -1
- package/dist/requests/answerRequest.js +9 -2
- package/dist/requests/answerRequest.js.map +1 -1
- package/dist/requests/limitWaitAnswer.d.ts +14 -0
- package/dist/requests/limitWaitAnswer.d.ts.map +1 -1
- package/dist/requests/limitWaitAnswer.js +26 -4
- package/dist/requests/limitWaitAnswer.js.map +1 -1
- package/dist/requests/requestHeader.d.ts +37 -5
- package/dist/requests/requestHeader.d.ts.map +1 -1
- package/dist/requests/requestHeader.js +70 -17
- package/dist/requests/requestHeader.js.map +1 -1
- package/dist/requests/scheduleWait.d.ts +79 -0
- package/dist/requests/scheduleWait.d.ts.map +1 -0
- package/dist/requests/scheduleWait.js +101 -0
- package/dist/requests/scheduleWait.js.map +1 -0
- package/dist/requests/sessionTurnProbe.d.ts +26 -3
- package/dist/requests/sessionTurnProbe.d.ts.map +1 -1
- package/dist/requests/sessionTurnProbe.js +22 -3
- package/dist/requests/sessionTurnProbe.js.map +1 -1
- package/dist/requests/topicRequestSettle.d.ts +13 -7
- package/dist/requests/topicRequestSettle.d.ts.map +1 -1
- package/dist/requests/topicRequestSettle.js +2 -2
- package/dist/requests/topicRequestSettle.js.map +1 -1
- package/dist/requests/trackerTurnPoster.d.ts +30 -0
- package/dist/requests/trackerTurnPoster.d.ts.map +1 -0
- package/dist/requests/trackerTurnPoster.js +36 -0
- package/dist/requests/trackerTurnPoster.js.map +1 -0
- package/dist/requests/types.d.ts +26 -5
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.d.ts +201 -12
- package/dist/requests/wakeUpEngine.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.js +514 -44
- package/dist/requests/wakeUpEngine.js.map +1 -1
- package/dist/requests/wakeUpRules.d.ts +185 -14
- package/dist/requests/wakeUpRules.d.ts.map +1 -1
- package/dist/requests/wakeUpRules.js +169 -36
- package/dist/requests/wakeUpRules.js.map +1 -1
- package/dist/resumeContext.d.ts +2 -2
- package/dist/resumeContext.js +3 -3
- package/dist/resumeContext.js.map +1 -1
- package/dist/runnerUtility/adminService.js +1 -1
- package/dist/runnerUtility/adminService.js.map +1 -1
- package/dist/runnerUtility/guiAgent.d.ts +1 -1
- package/dist/runnerUtility/guiAgent.d.ts.map +1 -1
- package/dist/runnerUtility/guiAgent.js +1 -1
- package/dist/runnerUtility/guiAgent.js.map +1 -1
- package/dist/runnerUtility/managedNode.d.ts +3 -3
- package/dist/runnerUtility/managedNode.d.ts.map +1 -1
- package/dist/runnerUtility/managedNode.js +2 -2
- package/dist/runnerUtility/managedNode.js.map +1 -1
- package/dist/runnerUtility/runnerConfig.d.ts +1 -1
- package/dist/runnerUtility/runnerHome.d.ts +1 -1
- package/dist/runnerUtility/runnerHome.js +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
- package/dist/runnerUtility/serviceCommon.js +1 -1
- package/dist/runnerUtility/serviceCommon.js.map +1 -1
- package/dist/runners/bootstrapLine.js +1 -1
- package/dist/runners/hubPackage.d.ts +1 -1
- package/dist/runners/hubPackage.js +3 -3
- package/dist/runners/hubPackage.js.map +1 -1
- package/dist/runners/hubPaths.d.ts +1 -1
- package/dist/runners/hubPaths.d.ts.map +1 -1
- package/dist/runners/runnerLock.d.ts +2 -2
- package/dist/runners/runnerLock.d.ts.map +1 -1
- package/dist/runners/runnerLock.js +2 -2
- package/dist/runners/runnerLock.js.map +1 -1
- package/dist/scheduler/checkRun.d.ts +2 -0
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +5 -1
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +57 -0
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +152 -14
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/injection.d.ts +6 -0
- package/dist/scheduler/injection.d.ts.map +1 -1
- package/dist/scheduler/injection.js +10 -0
- package/dist/scheduler/injection.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +68 -4
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +363 -189
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/rebindResume.d.ts +24 -0
- package/dist/scheduler/rebindResume.d.ts.map +1 -1
- package/dist/scheduler/rebindResume.js +32 -0
- package/dist/scheduler/rebindResume.js.map +1 -1
- package/dist/scheduler/scheduleToolWording.d.ts +29 -0
- package/dist/scheduler/scheduleToolWording.d.ts.map +1 -0
- package/dist/scheduler/scheduleToolWording.js +117 -0
- package/dist/scheduler/scheduleToolWording.js.map +1 -0
- package/dist/scheduler/scheduledRunTarget.d.ts +90 -0
- package/dist/scheduler/scheduledRunTarget.d.ts.map +1 -0
- package/dist/scheduler/scheduledRunTarget.js +92 -0
- package/dist/scheduler/scheduledRunTarget.js.map +1 -0
- package/dist/scheduler/store.d.ts +2 -0
- package/dist/scheduler/store.d.ts.map +1 -1
- package/dist/scheduler/store.js +2 -0
- package/dist/scheduler/store.js.map +1 -1
- package/dist/scheduler/types.d.ts +10 -0
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +2 -0
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +3 -3
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/selfUpdate/constants.d.ts +2 -0
- package/dist/selfUpdate/constants.d.ts.map +1 -1
- package/dist/selfUpdate/constants.js +3 -1
- package/dist/selfUpdate/constants.js.map +1 -1
- package/dist/selfUpdate/emittedSource.d.ts.map +1 -1
- package/dist/selfUpdate/emittedSource.js +1 -1
- package/dist/selfUpdate/emittedSource.js.map +1 -1
- package/dist/selfUpdate/updateRuntime.js +1 -1
- package/dist/selfUpdate/updateRuntime.js.map +1 -1
- package/dist/sessionPick.d.ts +1 -1
- package/dist/sessionPick.js +1 -1
- package/dist/shutdown.d.ts +12 -0
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +11 -0
- package/dist/shutdown.js.map +1 -1
- package/dist/startupPromptBuffer.d.ts +35 -6
- package/dist/startupPromptBuffer.d.ts.map +1 -1
- package/dist/startupPromptBuffer.js +70 -21
- package/dist/startupPromptBuffer.js.map +1 -1
- package/dist/state.d.ts +173 -25
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +282 -58
- package/dist/state.js.map +1 -1
- package/dist/testTimings.d.ts +8 -3
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +15 -2
- package/dist/testTimings.js.map +1 -1
- package/dist/threadContextPreamble.d.ts +7 -0
- package/dist/threadContextPreamble.d.ts.map +1 -1
- package/dist/threadContextPreamble.js +11 -0
- package/dist/threadContextPreamble.js.map +1 -1
- package/dist/threadRouting.d.ts +12 -0
- package/dist/threadRouting.d.ts.map +1 -1
- package/dist/threadRouting.js +15 -0
- package/dist/threadRouting.js.map +1 -1
- package/dist/todos/midTurn.d.ts +15 -41
- package/dist/todos/midTurn.d.ts.map +1 -1
- package/dist/todos/midTurn.js +27 -171
- package/dist/todos/midTurn.js.map +1 -1
- package/dist/types.d.ts +147 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/backendSwitchPlan.d.ts +3 -3
- package/dist/utils/backendSwitchPlan.js +3 -3
- package/dist/utils/claudeAccountAlert.d.ts +104 -0
- package/dist/utils/claudeAccountAlert.d.ts.map +1 -0
- package/dist/utils/claudeAccountAlert.js +130 -0
- package/dist/utils/claudeAccountAlert.js.map +1 -0
- package/dist/utils/claudeAccountPickerPlan.d.ts +7 -0
- package/dist/utils/claudeAccountPickerPlan.d.ts.map +1 -1
- package/dist/utils/claudeAccountPickerPlan.js +13 -2
- package/dist/utils/claudeAccountPickerPlan.js.map +1 -1
- package/dist/utils/claudeAuthRefusal.d.ts +122 -0
- package/dist/utils/claudeAuthRefusal.d.ts.map +1 -0
- package/dist/utils/claudeAuthRefusal.js +228 -0
- package/dist/utils/claudeAuthRefusal.js.map +1 -0
- package/dist/utils/claudeCompactHook.d.ts +6 -6
- package/dist/utils/claudeCompactHook.js +8 -8
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeProfileUsageViews.d.ts +54 -2
- package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -1
- package/dist/utils/claudeProfileUsageViews.js +44 -1
- package/dist/utils/claudeProfileUsageViews.js.map +1 -1
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +10 -1
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeRuntimeInfo.d.ts +24 -0
- package/dist/utils/claudeRuntimeInfo.d.ts.map +1 -1
- package/dist/utils/claudeRuntimeInfo.js +128 -3
- package/dist/utils/claudeRuntimeInfo.js.map +1 -1
- package/dist/utils/claudeScheduledJobs.d.ts +6 -2
- package/dist/utils/claudeScheduledJobs.d.ts.map +1 -1
- package/dist/utils/claudeScheduledJobs.js +10 -2
- package/dist/utils/claudeScheduledJobs.js.map +1 -1
- package/dist/utils/claudeSessionTitle.js +1 -1
- package/dist/utils/claudeSessionTitle.js.map +1 -1
- package/dist/utils/claudeStreamJson.d.ts +28 -2
- package/dist/utils/claudeStreamJson.d.ts.map +1 -1
- package/dist/utils/claudeStreamJson.js +33 -3
- package/dist/utils/claudeStreamJson.js.map +1 -1
- package/dist/utils/claudeTranscriptEpoch.d.ts +14 -0
- package/dist/utils/claudeTranscriptEpoch.d.ts.map +1 -1
- package/dist/utils/claudeTranscriptEpoch.js +79 -19
- package/dist/utils/claudeTranscriptEpoch.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +103 -7
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +108 -15
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/compactOnIdle.d.ts +139 -29
- package/dist/utils/compactOnIdle.d.ts.map +1 -1
- package/dist/utils/compactOnIdle.js +163 -36
- package/dist/utils/compactOnIdle.js.map +1 -1
- package/dist/utils/conversationEnding.d.ts +76 -0
- package/dist/utils/conversationEnding.d.ts.map +1 -0
- package/dist/utils/conversationEnding.js +117 -0
- package/dist/utils/conversationEnding.js.map +1 -0
- package/dist/utils/doctorLine.d.ts +10 -0
- package/dist/utils/doctorLine.d.ts.map +1 -1
- package/dist/utils/doctorLine.js +16 -0
- package/dist/utils/doctorLine.js.map +1 -1
- package/dist/utils/fallbackBridge.d.ts.map +1 -1
- package/dist/utils/fallbackBridge.js +2 -1
- package/dist/utils/fallbackBridge.js.map +1 -1
- package/dist/utils/fallbackChain.d.ts +2 -0
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +4 -3
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/fallbackSwitchNotice.d.ts +11 -4
- package/dist/utils/fallbackSwitchNotice.d.ts.map +1 -1
- package/dist/utils/fallbackSwitchNotice.js +9 -5
- package/dist/utils/fallbackSwitchNotice.js.map +1 -1
- package/dist/utils/fileSendService.d.ts +31 -0
- package/dist/utils/fileSendService.d.ts.map +1 -1
- package/dist/utils/fileSendService.js +45 -2
- package/dist/utils/fileSendService.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +2 -0
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +4 -1
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/jsonStreamPendingWork.d.ts +14 -2
- package/dist/utils/jsonStreamPendingWork.d.ts.map +1 -1
- package/dist/utils/jsonStreamPendingWork.js +25 -5
- package/dist/utils/jsonStreamPendingWork.js.map +1 -1
- package/dist/utils/jsonStreamUnconsumedInput.d.ts +80 -0
- package/dist/utils/jsonStreamUnconsumedInput.d.ts.map +1 -0
- package/dist/utils/jsonStreamUnconsumedInput.js +99 -0
- package/dist/utils/jsonStreamUnconsumedInput.js.map +1 -0
- package/dist/utils/limitEpisodeRecovery.d.ts +43 -4
- package/dist/utils/limitEpisodeRecovery.d.ts.map +1 -1
- package/dist/utils/limitEpisodeRecovery.js +107 -20
- package/dist/utils/limitEpisodeRecovery.js.map +1 -1
- package/dist/utils/limitHeldPrompts.d.ts +21 -11
- package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
- package/dist/utils/limitHeldPrompts.js +12 -9
- package/dist/utils/limitHeldPrompts.js.map +1 -1
- package/dist/utils/limitRemindersScreenPlan.d.ts +63 -0
- package/dist/utils/limitRemindersScreenPlan.d.ts.map +1 -0
- package/dist/utils/limitRemindersScreenPlan.js +121 -0
- package/dist/utils/limitRemindersScreenPlan.js.map +1 -0
- package/dist/utils/limitSwitchPlan.d.ts +51 -14
- package/dist/utils/limitSwitchPlan.d.ts.map +1 -1
- package/dist/utils/limitSwitchPlan.js +33 -15
- package/dist/utils/limitSwitchPlan.js.map +1 -1
- package/dist/utils/limitsBoardPlan.d.ts +16 -7
- package/dist/utils/limitsBoardPlan.d.ts.map +1 -1
- package/dist/utils/limitsBoardPlan.js +41 -9
- package/dist/utils/limitsBoardPlan.js.map +1 -1
- package/dist/utils/lostWork.d.ts +16 -2
- package/dist/utils/lostWork.d.ts.map +1 -1
- package/dist/utils/lostWork.js +16 -3
- package/dist/utils/lostWork.js.map +1 -1
- package/dist/utils/messageContext.d.ts +2 -2
- package/dist/utils/messageContext.js +2 -2
- package/dist/utils/midTurnInbox.d.ts +79 -0
- package/dist/utils/midTurnInbox.d.ts.map +1 -0
- package/dist/utils/midTurnInbox.js +265 -0
- package/dist/utils/midTurnInbox.js.map +1 -0
- package/dist/utils/promptDelivery.d.ts +70 -22
- package/dist/utils/promptDelivery.d.ts.map +1 -1
- package/dist/utils/promptDelivery.js +100 -42
- package/dist/utils/promptDelivery.js.map +1 -1
- package/dist/utils/topicIndicatorPlan.d.ts +13 -3
- package/dist/utils/topicIndicatorPlan.d.ts.map +1 -1
- package/dist/utils/topicIndicatorPlan.js +26 -4
- package/dist/utils/topicIndicatorPlan.js.map +1 -1
- package/dist/utils/topicRequest.d.ts +3 -0
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +4 -0
- package/dist/utils/topicRequest.js.map +1 -1
- package/dist/utils/workerRoles.d.ts +122 -0
- package/dist/utils/workerRoles.d.ts.map +1 -0
- package/dist/utils/workerRoles.js +160 -0
- package/dist/utils/workerRoles.js.map +1 -0
- package/dist/utils/workerRolesScreenPlan.d.ts +118 -0
- package/dist/utils/workerRolesScreenPlan.d.ts.map +1 -0
- package/dist/utils/workerRolesScreenPlan.js +232 -0
- package/dist/utils/workerRolesScreenPlan.js.map +1 -0
- package/dist/utils/workingSignals.d.ts +59 -0
- package/dist/utils/workingSignals.d.ts.map +1 -0
- package/dist/utils/workingSignals.js +60 -0
- package/dist/utils/workingSignals.js.map +1 -0
- package/licensing.json +88 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +7 -7
- package/{remoteRun → runner-scripts}/runner.sh +6 -3
- package/LICENSE-COMMERCIAL.md +0 -142
- package/dist/agentTrigger.d.ts +0 -28
- package/dist/agentTrigger.d.ts.map +0 -1
- package/dist/agentTrigger.js +0 -53
- package/dist/agentTrigger.js.map +0 -1
- /package/{remoteRun → runner-scripts}/ensureNode.sh +0 -0
- /package/{remoteRun → runner-scripts}/runner-package-lock.json +0 -0
|
@@ -19,13 +19,25 @@ import type { OpenRequestState, RequestWakeUpReason } from './types';
|
|
|
19
19
|
* mid-turn and gives one answer, or — Claude Code delivers a message written
|
|
20
20
|
* mid-turn only after that turn ends — it has already answered the replaced
|
|
21
21
|
* request and must not do the work twice.
|
|
22
|
+
* `isAnswerOnlyWithResult` — a scheduled run's request (the scheduler's own, `src/requests/README.md` § Scheduled runs): a woken agent
|
|
23
|
+
* with nothing to report stays silent, so the answer line asks for an answer only with a result ({@link buildResultOnlyAnswerLine}),
|
|
24
|
+
* not a `final` at the end of every turn, and no superseded line is added (the only request it replaces is one the bot gave up on, and
|
|
25
|
+
* nothing of that one is to be repeated).
|
|
22
26
|
*/
|
|
23
27
|
export interface RequestHeaderOptions {
|
|
24
28
|
requestId: string;
|
|
25
29
|
originDescription: string;
|
|
26
30
|
isPlainTextHidden: boolean;
|
|
27
31
|
supersededRequestIds?: readonly string[];
|
|
32
|
+
isAnswerOnlyWithResult?: boolean;
|
|
28
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* @description The answer line of every scheduled run's header — the scheduler's own request's and the one of a request a fire rides —
|
|
36
|
+
* so the two cannot drift: answer only with a result the requester needs, else stay silent (a woken agent with nothing to report).
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildResultOnlyAnswerLine(requestId: string): string;
|
|
39
|
+
/** The line that tells the agent its requester sees only its answers (a Telegram topic's answers-only view). */
|
|
40
|
+
export declare const plainTextHiddenSentence = "The requester does not see your plain text output or your thinking \u2014 only what you send through answer_request reaches them.";
|
|
29
41
|
/** @description The header's line naming the requests this one replaced; empty when it replaced none. */
|
|
30
42
|
export declare function buildSupersededRequestsLine(supersededRequestIds: readonly string[]): string;
|
|
31
43
|
/** @description The header block, ending with a blank line before the request's own text. */
|
|
@@ -39,6 +51,13 @@ export interface WakeUpMessage {
|
|
|
39
51
|
reason: RequestWakeUpReason;
|
|
40
52
|
text: string;
|
|
41
53
|
isRequestPrompt: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The reminder asks for an answer only with what the requester must know — the request waits for a passing watch and owes nobody an
|
|
56
|
+
* answer, and the wake is a lost-work one (the agent's own work died with its process): the fire header's wording, so the agent
|
|
57
|
+
* writes only when it did something. Never for a request's own prompt (R21: the agent never read it). The lost-work note the wake
|
|
58
|
+
* carries follows it (`buildLostWorkNote`).
|
|
59
|
+
*/
|
|
60
|
+
isAnswerOptional?: boolean;
|
|
42
61
|
}
|
|
43
62
|
/**
|
|
44
63
|
* @description The request's own prompt while the session never took it in — its
|
|
@@ -47,25 +66,38 @@ export interface WakeUpMessage {
|
|
|
47
66
|
* (`refreshStoredPrompt`): it may have waited hours.
|
|
48
67
|
*/
|
|
49
68
|
export declare function getPromptNotTakenIn(request: OpenRequestState | null | undefined): string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* @name PromptsNotTakenIn
|
|
71
|
+
* @description The prompts a resume re-posts in ONE text, and the requests they are: what the message carries is named when it is
|
|
72
|
+
* built, and the turn it starts is tracked with those ids — never read again when it is tracked, which for a buffered message is its
|
|
73
|
+
* replay, after other requests may have opened (review 21 nit 3).
|
|
74
|
+
*/
|
|
75
|
+
export interface PromptsNotTakenIn {
|
|
76
|
+
text: string;
|
|
77
|
+
requestIds: string[];
|
|
78
|
+
}
|
|
50
79
|
/**
|
|
51
80
|
* @description The prompts of every request in `requests` the session never took
|
|
52
81
|
* in, in the given order, as ONE text to post — a conversation may hold one open
|
|
53
|
-
* request per requester, and a resume must re-post each of them
|
|
54
|
-
* none is left to post.
|
|
82
|
+
* request per requester, and a resume must re-post each of them — with the ids of
|
|
83
|
+
* those requests. `undefined` when none is left to post.
|
|
55
84
|
*/
|
|
56
|
-
export declare function
|
|
85
|
+
export declare function getPromptsNotTakenIn(requests: readonly OpenRequestState[]): PromptsNotTakenIn | undefined;
|
|
57
86
|
/**
|
|
58
87
|
* @description R21: a request whose prompt was never taken in by the session gets
|
|
59
88
|
* the prompt itself; a bare reminder would name a request the agent never read.
|
|
60
89
|
*/
|
|
61
|
-
export declare function getWakeUpMessage(request: OpenRequestState, reason: RequestWakeUpReason
|
|
90
|
+
export declare function getWakeUpMessage(request: OpenRequestState, reason: RequestWakeUpReason, options?: {
|
|
91
|
+
isAnswerOptional?: boolean;
|
|
92
|
+
}): WakeUpMessage;
|
|
62
93
|
/**
|
|
63
94
|
* @description The reminder the wake-up engine forwards into the SAME session for
|
|
64
95
|
* an open request. It is not a request itself: it names the open one and asks
|
|
65
|
-
* for the answer through `answer_request
|
|
96
|
+
* for the answer through `answer_request` — or, with `isAnswerOptional`, only for what the requester must know.
|
|
66
97
|
*/
|
|
67
98
|
export declare function buildWakeUpReminder(options: {
|
|
68
99
|
requestId: string;
|
|
69
100
|
reason: RequestWakeUpReason;
|
|
101
|
+
isAnswerOptional?: boolean;
|
|
70
102
|
}): string;
|
|
71
103
|
//# sourceMappingURL=requestHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHeader.d.ts","sourceRoot":"","sources":["../../src/requests/requestHeader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"requestHeader.d.ts","sourceRo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;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,aAAa,CAUpJ;AAyBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAQnI"}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.plainTextHiddenSentence = void 0;
|
|
4
|
+
exports.buildResultOnlyAnswerLine = buildResultOnlyAnswerLine;
|
|
3
5
|
exports.buildSupersededRequestsLine = buildSupersededRequestsLine;
|
|
4
6
|
exports.buildRequestHeader = buildRequestHeader;
|
|
5
7
|
exports.getPromptNotTakenIn = getPromptNotTakenIn;
|
|
6
|
-
exports.
|
|
8
|
+
exports.getPromptsNotTakenIn = getPromptsNotTakenIn;
|
|
7
9
|
exports.getWakeUpMessage = getWakeUpMessage;
|
|
8
10
|
exports.buildWakeUpReminder = buildWakeUpReminder;
|
|
9
11
|
const answerStyle_1 = require("./answerStyle");
|
|
10
12
|
const storedPromptRefresh_1 = require("./storedPromptRefresh");
|
|
13
|
+
const wakeUpRules_1 = require("./wakeUpRules");
|
|
14
|
+
/**
|
|
15
|
+
* @description The answer line of every scheduled run's header — the scheduler's own request's and the one of a request a fire rides —
|
|
16
|
+
* so the two cannot drift: answer only with a result the requester needs, else stay silent (a woken agent with nothing to report).
|
|
17
|
+
*/
|
|
18
|
+
function buildResultOnlyAnswerLine(requestId) {
|
|
19
|
+
return `Answer it through answer_request (requestId "${requestId}") only when you have a result the requester needs.`;
|
|
20
|
+
}
|
|
21
|
+
/** The line that tells the agent its requester sees only its answers (a Telegram topic's answers-only view). */
|
|
22
|
+
exports.plainTextHiddenSentence = 'The requester does not see your plain text output or your thinking — only what you send through answer_request reaches them.';
|
|
11
23
|
/** @description The header's line naming the requests this one replaced; empty when it replaced none. */
|
|
12
24
|
function buildSupersededRequestsLine(supersededRequestIds) {
|
|
13
25
|
if (supersededRequestIds.length === 0)
|
|
@@ -19,24 +31,32 @@ function buildSupersededRequestsLine(supersededRequestIds) {
|
|
|
19
31
|
}
|
|
20
32
|
/** @description The header block, ending with a blank line before the request's own text. */
|
|
21
33
|
function buildRequestHeader(options) {
|
|
34
|
+
const isAnswerOnlyWithResult = options.isAnswerOnlyWithResult === true;
|
|
22
35
|
const lines = [
|
|
23
36
|
`[Request ${options.requestId} · from: ${options.originDescription}]`,
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
isAnswerOnlyWithResult
|
|
38
|
+
? buildResultOnlyAnswerLine(options.requestId)
|
|
39
|
+
: `Answer it with the answer_request tool (requestId "${options.requestId}"): kind "final" with the full result at the end of your turn, ` +
|
|
40
|
+
'"question" if you need the requester before you can go on, "progress" for an interim note.',
|
|
26
41
|
answerStyle_1.answerStyleInstruction,
|
|
27
42
|
];
|
|
28
|
-
const supersededLine = buildSupersededRequestsLine(options.supersededRequestIds ?? []);
|
|
43
|
+
const supersededLine = isAnswerOnlyWithResult ? '' : buildSupersededRequestsLine(options.supersededRequestIds ?? []);
|
|
29
44
|
if (supersededLine !== '')
|
|
30
45
|
lines.push(supersededLine);
|
|
31
|
-
if (options.isPlainTextHidden)
|
|
32
|
-
lines.push(
|
|
33
|
-
}
|
|
46
|
+
if (options.isPlainTextHidden)
|
|
47
|
+
lines.push(exports.plainTextHiddenSentence);
|
|
34
48
|
return `${lines.join('\n')}\n\n`;
|
|
35
49
|
}
|
|
50
|
+
/** The bound of the agent's own work's hold is said in hours. */
|
|
51
|
+
const msPerHour = 60 * 60 * 1000;
|
|
36
52
|
/** What the reminder tells the agent, per wake-up reason. */
|
|
37
53
|
const wakeUpReasonLines = {
|
|
38
54
|
silentTurn: 'Your last turn ended without answering it.',
|
|
39
55
|
progressFollowUp: 'Some time has passed since your last progress note on it.',
|
|
56
|
+
nothingArmed: 'Your last turn ended with it still open and nothing set to wake you again: no job under it (or only a watch that ' +
|
|
57
|
+
'already fired) and no background work of yours running. Nothing reminds you on a clock.',
|
|
58
|
+
ownWorkHoldLapsed: `Your own background work has held it for ${wakeUpRules_1.ownWorkHoldMaxMs / msPerHour} hours since your last prompt or reminder; ` +
|
|
59
|
+
'your notes do not extend that.',
|
|
40
60
|
backstop: 'Nothing has been seen working on it for a long time (the session may have restarted).',
|
|
41
61
|
postRetry: 'It could not be delivered to you earlier.',
|
|
42
62
|
restarted: 'Your session ended and was resumed while you were working on it (the bot or your process restarted); carry on.',
|
|
@@ -57,34 +77,67 @@ const joinedPromptsSeparator = '\n\n';
|
|
|
57
77
|
/**
|
|
58
78
|
* @description The prompts of every request in `requests` the session never took
|
|
59
79
|
* in, in the given order, as ONE text to post — a conversation may hold one open
|
|
60
|
-
* request per requester, and a resume must re-post each of them
|
|
61
|
-
* none is left to post.
|
|
80
|
+
* request per requester, and a resume must re-post each of them — with the ids of
|
|
81
|
+
* those requests. `undefined` when none is left to post.
|
|
62
82
|
*/
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
|
|
83
|
+
function getPromptsNotTakenIn(requests) {
|
|
84
|
+
const untaken = requests.flatMap((request) => {
|
|
85
|
+
const prompt = getPromptNotTakenIn(request);
|
|
86
|
+
return prompt === undefined ? [] : [{ requestId: request.id, prompt }];
|
|
87
|
+
});
|
|
88
|
+
if (untaken.length === 0)
|
|
89
|
+
return undefined;
|
|
90
|
+
return { text: untaken.map((entry) => entry.prompt).join(joinedPromptsSeparator), requestIds: untaken.map((entry) => entry.requestId) };
|
|
66
91
|
}
|
|
67
92
|
/**
|
|
68
93
|
* @description R21: a request whose prompt was never taken in by the session gets
|
|
69
94
|
* the prompt itself; a bare reminder would name a request the agent never read.
|
|
70
95
|
*/
|
|
71
|
-
function getWakeUpMessage(request, reason) {
|
|
96
|
+
function getWakeUpMessage(request, reason, options = {}) {
|
|
72
97
|
const prompt = getPromptNotTakenIn(request);
|
|
73
98
|
if (prompt !== undefined)
|
|
74
99
|
return { reason, text: prompt, isRequestPrompt: true };
|
|
75
|
-
|
|
100
|
+
const isAnswerOptional = options.isAnswerOptional === true;
|
|
101
|
+
return {
|
|
102
|
+
reason,
|
|
103
|
+
text: buildWakeUpReminder({ requestId: request.id, reason, isAnswerOptional }),
|
|
104
|
+
isRequestPrompt: false,
|
|
105
|
+
...(isAnswerOptional ? { isAnswerOptional } : {}),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** What the reminder asks for: the nudge of a tracker request nothing is armed to wake says how to wait; a watch still armed asks only for what matters. */
|
|
109
|
+
function getWakeUpAnswerLine(options) {
|
|
110
|
+
if (options.reason === 'ownWorkHoldLapsed') {
|
|
111
|
+
return `Answer it with answer_request (requestId "${options.requestId}"): kind "final" if the work is done, "question" if you need the requester. ` +
|
|
112
|
+
'If you still wait on a run, arm a watch for it (schedule_create with a checkCommand) — a watch holds the request for as long as ' +
|
|
113
|
+
'it passes — say in a "progress" note what you wait for and when it should end, and end your turn. If the next ' +
|
|
114
|
+
`${wakeUpRules_1.ownWorkHoldMaxMs / msPerHour} hours pass the same way, you are taken to have stopped: the requester is told and it is given up.`;
|
|
115
|
+
}
|
|
116
|
+
if (options.reason === 'nothingArmed') {
|
|
117
|
+
return `Finish it with answer_request (requestId "${options.requestId}"): kind "final" if the work is done, "question" if you need the requester. ` +
|
|
118
|
+
'If you wait on a worker or a run, arm a watch for it (schedule_create with a checkCommand), say in a "progress" note what you wait for ' +
|
|
119
|
+
'and when it should end, and end your turn: the watch wakes you. If your next turn also ends with it open and nothing set to wake you, ' +
|
|
120
|
+
'you are taken to have stopped: the requester is told and it is given up.';
|
|
121
|
+
}
|
|
122
|
+
if (options.isAnswerOptional === true) {
|
|
123
|
+
return `Your watch for it is still armed and nothing the requester wrote is waiting for your answer, so answer it with answer_request (requestId "${options.requestId}") ` +
|
|
124
|
+
'only with what the requester must know — a short "progress" note if what was lost changes what they wait for, "final" if the work is ' +
|
|
125
|
+
'done — otherwise continue without a comment.';
|
|
126
|
+
}
|
|
127
|
+
return `Answer it with answer_request (requestId "${options.requestId}"): kind "final" if the work is done, ` +
|
|
128
|
+
'"question" if you need the requester, or a short "progress" note if you are still working — then continue.';
|
|
76
129
|
}
|
|
77
130
|
/**
|
|
78
131
|
* @description The reminder the wake-up engine forwards into the SAME session for
|
|
79
132
|
* an open request. It is not a request itself: it names the open one and asks
|
|
80
|
-
* for the answer through `answer_request
|
|
133
|
+
* for the answer through `answer_request` — or, with `isAnswerOptional`, only for what the requester must know.
|
|
81
134
|
*/
|
|
82
135
|
function buildWakeUpReminder(options) {
|
|
136
|
+
const answerLine = getWakeUpAnswerLine(options);
|
|
83
137
|
return [
|
|
84
138
|
`[Reminder · request ${options.requestId} is still open]`,
|
|
85
139
|
wakeUpReasonLines[options.reason],
|
|
86
|
-
|
|
87
|
-
'"question" if you need the requester, or a short "progress" note if you are still working — then continue.',
|
|
140
|
+
answerLine,
|
|
88
141
|
answerStyle_1.answerStyleInstruction,
|
|
89
142
|
].join('\n');
|
|
90
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHeader.js","sourceRoot":"","sources":["../../src/requests/requestHeader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requestHeader.js","sourceRoot":"","sources":["../../src/requests/requestHeader.ts"],"names":[],"mappings":";;;AA2CA,8DAEC;AAMD,kEAMC;AAGD,gDAcC;AA0CD,kDAGC;AAsBD,oDAOC;AAMD,4CAUC;AA8BD,kDAQC;AA1MD,+CAAuD;AACvD,+DAA4D;AAE5D,+CAAiD;AAoCjD;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,SAAiB;IACzD,OAAO,gDAAgD,SAAS,qDAAqD,CAAC;AACxH,CAAC;AAED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C;IACD,OAAO,6CAA6C,OAAO,CAAC,SAAS,wCAAwC;QAC3G,4GAA4G,CAAC;AACjH,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,OAAuF;IACzH,MAAM,UAAU,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO;QACL,uBAAuB,OAAO,CAAC,SAAS,iBAAiB;QACzD,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,UAAU;QACV,oCAAsB;KACvB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ScheduleRecord } from '../scheduler/types';
|
|
2
|
+
import type { OpenRequestState } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @description «A request waits for its schedule»: the one neutral reading the wake-up rules take of an open request's
|
|
5
|
+
* armed jobs, so an agent that launched a worker, armed its watch and ended its turn is not prodded by the engine
|
|
6
|
+
* (a follow-up every 15 minutes, ten wake-ups, then «could not finish») — the watch wakes it when there is something to do.
|
|
7
|
+
*
|
|
8
|
+
* A job counts when it is armed under the request (`ScheduleRecord.requestId` is the request's id or the id of a request
|
|
9
|
+
* this one replaced), is an agent job (a prompt job or a check; a reminder wakes nobody) and is not paused.
|
|
10
|
+
*
|
|
11
|
+
* none — no job counts: the normal rules apply
|
|
12
|
+
* watching — a job counts and is not a failing check: between turns nothing wakes the request
|
|
13
|
+
* armed — every counting job is a failing check: a watch that just fired. Only the END of a turn a FIRE started reads it
|
|
14
|
+
* as waiting (the agent that handled the wake is not silent; any other turn reads it as `none`); between turns a
|
|
15
|
+
* failing check nobody handled (the agent died in the wake) must not hold the request forever, so it does not count there
|
|
16
|
+
*
|
|
17
|
+
* Platform-neutral: a Telegram topic in a view with requests gets the same reading from the jobs its agent armed.
|
|
18
|
+
*
|
|
19
|
+
* A reading never decides alone: between turns it holds a request only while the request owes nobody an answer
|
|
20
|
+
* (`checkIsHeldBetweenTurns`), and at a turn's end it quiets a turn only while nothing is owed (`decideTurnEnd`) — the owed reading
|
|
21
|
+
* and the schedule wait decide, whatever the kind of the turn. The complete table is `src/requests/README.md` § Wake-ups.
|
|
22
|
+
*/
|
|
23
|
+
export type RequestScheduleWait = 'none' | 'armed' | 'watching';
|
|
24
|
+
/** @description Whether `job` was armed under `request`: under it, or under a request it replaced. */
|
|
25
|
+
export declare function checkIsJobArmedUnderRequest(job: Pick<ScheduleRecord, 'requestId'>, request: Pick<OpenRequestState, 'id' | 'supersededRequestIds'>): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @description The reading of `request` over its conversation's jobs (`jobs` need not be filtered: every job of the
|
|
28
|
+
* conversation may be passed).
|
|
29
|
+
*/
|
|
30
|
+
export declare function getRequestScheduleWait(jobs: readonly ScheduleRecord[], request: Pick<OpenRequestState, 'id' | 'supersededRequestIds'>): RequestScheduleWait;
|
|
31
|
+
/**
|
|
32
|
+
* @description Whether the end of a watched turn reads the request as waiting for its schedule. `watching` always does. `armed` — a
|
|
33
|
+
* watch that fired and was not re-armed — does only for the turn a fire of the request's OWN job started (`isRequestFire`: a scheduled
|
|
34
|
+
* run whose job is armed under the request, a «continue» of it included): the agent that handled the wake is not silent. A fire of
|
|
35
|
+
* another job that only rides the request did not handle that watch (a check forwards only at its first failure, so every later fire
|
|
36
|
+
* on an `armed` request is another job's). A reminder's or a person's turn is not the alarm: nothing else will ever wake the agent
|
|
37
|
+
* on a request whose watch is gone, so for them `armed` reads as `none` — a silent reminder is a silent turn, and the chain ends in
|
|
38
|
+
* the give-up instead of ten backstop reminders ninety minutes apart.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkIsWaitingAtTurnEnd(wait: RequestScheduleWait, isRequestFire: boolean): boolean;
|
|
41
|
+
/** @description Whether, between turns, nothing may wake the request: only a watch that is not failing holds it. */
|
|
42
|
+
export declare function checkIsWaitingBetweenTurns(wait: RequestScheduleWait): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* @description Whether the request owes a person an answer — what a watch must never hide. It does while a silent turn is pending
|
|
45
|
+
* (`silentTurnCount`), while a person's words reached the agent after the last answer (`isPersonInputUnanswered`, persisted), and
|
|
46
|
+
* for a person's request that was never answered at all. The scheduler's request (`scheduledRun`) is no person's, so it owes nobody
|
|
47
|
+
* their words. Everything here is read from the persisted request, so it survives a restart that loses the engine's
|
|
48
|
+
* in-memory watches.
|
|
49
|
+
*/
|
|
50
|
+
export declare function checkIsAnswerOwed(request: Pick<OpenRequestState, 'silentTurnCount' | 'isPersonInputUnanswered' | 'progressAnswerCount' | 'origin'>): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @description Whether `request` is the scheduler's request (a Telegram topic's `scheduledRun`) the agent NEVER answered: nobody was told
|
|
53
|
+
* anything about it and nobody is owed its answer, so any turn of it that ends without an answer closes it without a word
|
|
54
|
+
* (`decideTurnEnd`). Once the operator was told «working on it» it is an ordinary answered request and a later silence is chased. Nothing
|
|
55
|
+
* else reads a request to decide what its turns are: a turn's kind is said by its forward (`src/requests/README.md` § Scheduled runs).
|
|
56
|
+
*/
|
|
57
|
+
export declare function checkIsUnansweredFireRequest(request: Pick<OpenRequestState, 'origin' | 'progressAnswerCount'>): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @description Whether, between turns, the request is held by its schedule: a watch that is not failing holds it, but only while it
|
|
60
|
+
* owes nobody an answer. A person's turn whose watch was lost (a restart, a dead process) is then taken back by the backstop,
|
|
61
|
+
* as it is without a watch.
|
|
62
|
+
*/
|
|
63
|
+
export declare function checkIsHeldBetweenTurns(request: Pick<OpenRequestState, 'silentTurnCount' | 'isPersonInputUnanswered' | 'progressAnswerCount' | 'origin'>, wait: RequestScheduleWait): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @description The request a job `schedule_create` arms now is armed under — the one the agent is WORKING ON, which is what must
|
|
66
|
+
* wait for the job. Tiers, the first that has a request wins: a request whose turn the engine watches because a forward of its OWN
|
|
67
|
+
* started the watch (`ownForwardRequestIds`, OLDEST first: its prompt, an update, a fire riding it, a reminder for it) — the first is
|
|
68
|
+
* the request whose forward STARTED the running turn, which is what the agent works on, whoever's words or fire joined the turn later;
|
|
69
|
+
* a request whose turn is watched only because a conversation-wide forward carried it along (a «continue» nudge, a restart wake —
|
|
70
|
+
* those watch EVERY open request, which says nothing about the one the agent works on); the open requests. Inside those last two
|
|
71
|
+
* tiers the newest wins, a tracker HAND-OVER (`trackerEvent`) before a mention (`trackerMention`): a mention hands nothing over and
|
|
72
|
+
* long work belongs to the hand-over. The scheduler's request (`scheduledRun`: a Telegram topic's) counts in the first tier — the
|
|
73
|
+
* watch an agent arms while handling the alarm that started the turn belongs to that alarm — and is passed over for any other in the
|
|
74
|
+
* two tiers that do not know the turn: a person's work outlives an alarm. (A watch's own fire rides the request the watch was armed
|
|
75
|
+
* under, so re-arming in that turn keeps the job where it was.) `undefined` when no request is open (a topic's stream view has none).
|
|
76
|
+
* `openRequests` is oldest first, as `RequestLedger.listOpenRequestsOf` returns it: the newest of a list is its last.
|
|
77
|
+
*/
|
|
78
|
+
export declare function pickRequestToArmUnder(openRequests: readonly OpenRequestState[], watchedRequestIds: readonly string[], ownForwardRequestIds?: readonly string[]): string | undefined;
|
|
79
|
+
//# sourceMappingURL=scheduleWait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleWait.d.ts","sourceRoot":"","sources":["../../src/requests/scheduleWait.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAEhE,sGAAsG;AACtG,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,gB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exports.getRequestScheduleWait = getRequestScheduleWait;
|
|
5
|
+
exports.checkIsWaitingAtTurnEnd = checkIsWaitingAtTurnEnd;
|
|
6
|
+
exports.checkIsWaitingBetweenTurns = checkIsWaitingBetweenTurns;
|
|
7
|
+
exports.checkIsAnswerOwed = checkIsAnswerOwed;
|
|
8
|
+
exports.checkIsUnansweredFireRequest = checkIsUnansweredFireRequest;
|
|
9
|
+
exports.checkIsHeldBetweenTurns = checkIsHeldBetweenTurns;
|
|
10
|
+
exports.pickRequestToArmUnder = pickRequestToArmUnder;
|
|
11
|
+
const deliveryKind_1 = require("../scheduler/deliveryKind");
|
|
12
|
+
/** @description Whether `job` was armed under `request`: under it, or under a request it replaced. */
|
|
13
|
+
function checkIsJobArmedUnderRequest(job, request) {
|
|
14
|
+
if (job.requestId === undefined)
|
|
15
|
+
return false;
|
|
16
|
+
return job.requestId === request.id || (request.supersededRequestIds ?? []).includes(job.requestId);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @description The reading of `request` over its conversation's jobs (`jobs` need not be filtered: every job of the
|
|
20
|
+
* conversation may be passed).
|
|
21
|
+
*/
|
|
22
|
+
function getRequestScheduleWait(jobs, request) {
|
|
23
|
+
let wait = 'none';
|
|
24
|
+
for (const job of jobs) {
|
|
25
|
+
if ((0, deliveryKind_1.checkIsReminderSchedule)(job) || job.isPaused === true || !checkIsJobArmedUnderRequest(job, request))
|
|
26
|
+
continue;
|
|
27
|
+
if (job.isCheckFailing !== true)
|
|
28
|
+
return 'watching';
|
|
29
|
+
wait = 'armed';
|
|
30
|
+
}
|
|
31
|
+
return wait;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @description Whether the end of a watched turn reads the request as waiting for its schedule. `watching` always does. `armed` — a
|
|
35
|
+
* watch that fired and was not re-armed — does only for the turn a fire of the request's OWN job started (`isRequestFire`: a scheduled
|
|
36
|
+
* run whose job is armed under the request, a «continue» of it included): the agent that handled the wake is not silent. A fire of
|
|
37
|
+
* another job that only rides the request did not handle that watch (a check forwards only at its first failure, so every later fire
|
|
38
|
+
* on an `armed` request is another job's). A reminder's or a person's turn is not the alarm: nothing else will ever wake the agent
|
|
39
|
+
* on a request whose watch is gone, so for them `armed` reads as `none` — a silent reminder is a silent turn, and the chain ends in
|
|
40
|
+
* the give-up instead of ten backstop reminders ninety minutes apart.
|
|
41
|
+
*/
|
|
42
|
+
function checkIsWaitingAtTurnEnd(wait, isRequestFire) {
|
|
43
|
+
return wait === 'watching' || (wait === 'armed' && isRequestFire);
|
|
44
|
+
}
|
|
45
|
+
/** @description Whether, between turns, nothing may wake the request: only a watch that is not failing holds it. */
|
|
46
|
+
function checkIsWaitingBetweenTurns(wait) {
|
|
47
|
+
return wait === 'watching';
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description Whether the request owes a person an answer — what a watch must never hide. It does while a silent turn is pending
|
|
51
|
+
* (`silentTurnCount`), while a person's words reached the agent after the last answer (`isPersonInputUnanswered`, persisted), and
|
|
52
|
+
* for a person's request that was never answered at all. The scheduler's request (`scheduledRun`) is no person's, so it owes nobody
|
|
53
|
+
* their words. Everything here is read from the persisted request, so it survives a restart that loses the engine's
|
|
54
|
+
* in-memory watches.
|
|
55
|
+
*/
|
|
56
|
+
function checkIsAnswerOwed(request) {
|
|
57
|
+
if (request.silentTurnCount > 0 || request.isPersonInputUnanswered === true)
|
|
58
|
+
return true;
|
|
59
|
+
return request.origin.kind !== 'scheduledRun' && request.progressAnswerCount === 0;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @description Whether `request` is the scheduler's request (a Telegram topic's `scheduledRun`) the agent NEVER answered: nobody was told
|
|
63
|
+
* anything about it and nobody is owed its answer, so any turn of it that ends without an answer closes it without a word
|
|
64
|
+
* (`decideTurnEnd`). Once the operator was told «working on it» it is an ordinary answered request and a later silence is chased. Nothing
|
|
65
|
+
* else reads a request to decide what its turns are: a turn's kind is said by its forward (`src/requests/README.md` § Scheduled runs).
|
|
66
|
+
*/
|
|
67
|
+
function checkIsUnansweredFireRequest(request) {
|
|
68
|
+
return request.origin.kind === 'scheduledRun' && request.progressAnswerCount === 0;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @description Whether, between turns, the request is held by its schedule: a watch that is not failing holds it, but only while it
|
|
72
|
+
* owes nobody an answer. A person's turn whose watch was lost (a restart, a dead process) is then taken back by the backstop,
|
|
73
|
+
* as it is without a watch.
|
|
74
|
+
*/
|
|
75
|
+
function checkIsHeldBetweenTurns(request, wait) {
|
|
76
|
+
return checkIsWaitingBetweenTurns(wait) && !checkIsAnswerOwed(request);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @description The request a job `schedule_create` arms now is armed under — the one the agent is WORKING ON, which is what must
|
|
80
|
+
* wait for the job. Tiers, the first that has a request wins: a request whose turn the engine watches because a forward of its OWN
|
|
81
|
+
* started the watch (`ownForwardRequestIds`, OLDEST first: its prompt, an update, a fire riding it, a reminder for it) — the first is
|
|
82
|
+
* the request whose forward STARTED the running turn, which is what the agent works on, whoever's words or fire joined the turn later;
|
|
83
|
+
* a request whose turn is watched only because a conversation-wide forward carried it along (a «continue» nudge, a restart wake —
|
|
84
|
+
* those watch EVERY open request, which says nothing about the one the agent works on); the open requests. Inside those last two
|
|
85
|
+
* tiers the newest wins, a tracker HAND-OVER (`trackerEvent`) before a mention (`trackerMention`): a mention hands nothing over and
|
|
86
|
+
* long work belongs to the hand-over. The scheduler's request (`scheduledRun`: a Telegram topic's) counts in the first tier — the
|
|
87
|
+
* watch an agent arms while handling the alarm that started the turn belongs to that alarm — and is passed over for any other in the
|
|
88
|
+
* two tiers that do not know the turn: a person's work outlives an alarm. (A watch's own fire rides the request the watch was armed
|
|
89
|
+
* under, so re-arming in that turn keeps the job where it was.) `undefined` when no request is open (a topic's stream view has none).
|
|
90
|
+
* `openRequests` is oldest first, as `RequestLedger.listOpenRequestsOf` returns it: the newest of a list is its last.
|
|
91
|
+
*/
|
|
92
|
+
function pickRequestToArmUnder(openRequests, watchedRequestIds, ownForwardRequestIds = []) {
|
|
93
|
+
const isWorkRequest = (request) => request.origin.kind !== 'scheduledRun';
|
|
94
|
+
const getNewestPreferringHandOver = (requests) => requests.filter((request) => request.origin.kind === 'trackerEvent').at(-1) ?? requests.at(-1);
|
|
95
|
+
const workRequests = openRequests.filter(isWorkRequest);
|
|
96
|
+
const watched = workRequests.filter((request) => watchedRequestIds.includes(request.id));
|
|
97
|
+
// The starter of the running turn: the first own-forward id (the engine lists them oldest first) that is an open request.
|
|
98
|
+
const turnStarter = ownForwardRequestIds.map((id) => openRequests.find((request) => request.id === id)).find((request) => request !== undefined);
|
|
99
|
+
return (turnStarter ?? getNewestPreferringHandOver(watched) ?? getNewestPreferringHandOver(workRequests) ?? openRequests.at(-1))?.id;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=scheduleWait.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduleWait.js","sourceRoot":"","sources":["../../src/requests/scheduleWait.ts"],"names":[],"mappings":";;AA2BA,kEAGC;AAMD,wDAQC;AAWD,0DAEC;AAGD,gEAEC;AASD,8CAKC;AAQD,oEAEC;AAOD,0DAKC;AAgBD,sDAaC;AA/HD,4DAAoE;AA0BpE,sGAAsG;AACtG,SAAgB,2BAA2B,CAAC,GAAsC,EAAE,OAA8D;IAChJ,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACtG,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,IAA+B,EAAE,OAA8D;IACpI,IAAI,IAAI,GAAwB,MAAM,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;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C,MAAM,aAAa,GAAG,CAAC,OAAyB,EAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC;IACrG,MAAM,2BAA2B,GAAG,CAAC,QAAqC,EAAgC,EAAE,CAC1G,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjG,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IACzF,0HAA0H;IAC1H,MAAM,WAAW,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;IACjJ,OAAO,CAAC,WAAW,IAAI,2BAA2B,CAAC,OAAO,CAAC,IAAI,2BAA2B,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACvI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SessionKey } from '../sessionKey';
|
|
2
|
-
import type
|
|
2
|
+
import { type AgentAdapter } from '../types';
|
|
3
3
|
import type { SessionTurnProbe } from './wakeUpRules';
|
|
4
4
|
/**
|
|
5
5
|
* @description How the wake-up engine sees a conversation's session right now
|
|
@@ -20,14 +20,33 @@ import type { SessionTurnProbe } from './wakeUpRules';
|
|
|
20
20
|
* - an API-error retry or limit resume being KICKED: from the moment its timer
|
|
21
21
|
* fired until its "continue" nudge was forwarded the retry is no longer armed,
|
|
22
22
|
* yet the idle the error left behind is not a turn end either;
|
|
23
|
+
* - an API error the bot is still HANDLING with nothing armed («wait for reset» off,
|
|
24
|
+
* a used-up credit balance, an account refusal): the adapter reports the error right
|
|
25
|
+
* before the turn's end, and until the bot's stop, move or wait has landed that turn
|
|
26
|
+
* is no silent one — decided at once, its reminder would go into the limited or refused
|
|
27
|
+
* session and end on the same error, the give-up;
|
|
28
|
+
* - a RE-SPAWN of the process under way or about to start (`checkIsRespawnPending`: a model, effort
|
|
29
|
+
* or account change; an account switch deferred while the turn worked starts one tick after its
|
|
30
|
+
* end): the turn is decided once the new process is up, and its reminder goes into it — the process
|
|
31
|
+
* down for the re-spawn would otherwise read as a session gone (an ensure waits for the re-spawn:
|
|
32
|
+
* `waitForRespawn`);
|
|
23
33
|
* - a session START under way: a request's first post is starting the session it
|
|
24
34
|
* will run in, so nothing has gone quiet — without this the sweep reads the
|
|
25
35
|
* request as one nobody works on and wakes it (or raises an alert) once the
|
|
26
|
-
* backstop window is shorter than the start
|
|
36
|
+
* backstop window is shorter than the start;
|
|
37
|
+
* - the REPLAY of the prompts buffered during that start: the window closes before
|
|
38
|
+
* the first replayed write, and a fresh session reports nothing unread, so without
|
|
39
|
+
* this every watch made while the session started reads as an ENDED turn at the
|
|
40
|
+
* replay's first write — a silent turn the agent never had.
|
|
27
41
|
*
|
|
28
42
|
* A session still starting has not taken in what was forwarded to it either: the
|
|
29
43
|
* prompt waits in the startup buffer, while a backend may already report itself
|
|
30
44
|
* active with nothing unread.
|
|
45
|
+
*
|
|
46
|
+
* The agent's own pending work (`hasOwnPendingWork`) is what the backend names among its background signals: a background command
|
|
47
|
+
* or sub-agent, a session job, a finished task's turn on its way — never unread input or a compaction, which the fields above cover.
|
|
48
|
+
* Its LASTING part (`hasOwnLastingWork`) leaves out the turn on its way: that task already ended. Only a tracker's rules read them
|
|
49
|
+
* (`wakeUpRules.ts`).
|
|
31
50
|
*/
|
|
32
51
|
/**
|
|
33
52
|
* @name SessionTurnProbeDeps
|
|
@@ -36,15 +55,19 @@ import type { SessionTurnProbe } from './wakeUpRules';
|
|
|
36
55
|
* record's timer already fired, the timer while it is armed.
|
|
37
56
|
*/
|
|
38
57
|
export interface SessionTurnProbeDeps {
|
|
39
|
-
getAdapter: (key: SessionKey) => Pick<AgentAdapter, 'checkIsActive' | 'checkIsBusy' | 'checkHasUnconsumedInput' | 'isQuestionPending' | 'isLoginPastePending'>;
|
|
58
|
+
getAdapter: (key: SessionKey) => Pick<AgentAdapter, 'checkIsActive' | 'checkIsBusy' | 'checkHasUnconsumedInput' | 'isQuestionPending' | 'isLoginPastePending' | 'checkIsRespawnPending' | 'checkIsTurnOnItsWay' | 'checkIsCliOwnTurn' | 'getProcessGeneration' | 'getBackgroundWorkSignals'>;
|
|
40
59
|
checkHasPendingQuestion: (keyString: string) => boolean;
|
|
41
60
|
checkHasQuestionPin: (keyString: string) => boolean;
|
|
42
61
|
checkIsCompacting: (keyString: string) => boolean;
|
|
43
62
|
getApiRetryTimer: (keyString: string) => NodeJS.Timeout | null | undefined;
|
|
44
63
|
checkIsWedgeRecoveryInFlight: (keyString: string) => boolean;
|
|
45
64
|
checkIsRetryKickInFlight: (keyString: string) => boolean;
|
|
65
|
+
/** An API error that armed nothing is being handled: its stop, move or wait has not landed yet. */
|
|
66
|
+
checkIsApiErrorInHandling: (keyString: string) => boolean;
|
|
46
67
|
/** The session is in its startup window: prompts forwarded now are buffered, not written. */
|
|
47
68
|
checkIsSessionStarting: (keyString: string) => boolean;
|
|
69
|
+
/** The prompts buffered during the start are being written now (`StartupPromptBuffer.checkIsReplaying`): still the start. */
|
|
70
|
+
checkIsReplayingBufferedPrompts: (keyString: string) => boolean;
|
|
48
71
|
serializeKey: (key: SessionKey) => string;
|
|
49
72
|
}
|
|
50
73
|
/** @description Build the probe the wake-up engine polls. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionTurnProbe.d.ts","sourceRoot":"","sources":["../../src/requests/sessionTurnProbe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"sessionTurnProbe.d.ts","sourceRoot":"","sources":["../../src/requests/sessionTurnProbe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CACnC,YAAY,EACZ,eAAe,GAAG,aAAa,GAAG,yBAAyB,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,uBAAuB,GACjI,qBAAqB,GAAG,mBAAmB,GAAG,sBAAsB,GAAG,0BAA0B,CACpG,CAAC;IACF,uBAAuB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACxD,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACpD,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAClD,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3E,4BAA4B,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7D,wBAAwB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACzD,mGAAmG;IACnG,yBAAyB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1D,6FAA6F;IAC7F,sBAAsB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACvD,6HAA6H;IAC7H,+BAA+B,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAChE,YAAY,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM,CAAC;CAC3C;AAED,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,gBAAgB,CAyCxG"}
|
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSessionTurnProbe = createSessionTurnProbe;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const workingSignals_1 = require("../utils/workingSignals");
|
|
4
6
|
/** @description Build the probe the wake-up engine polls. */
|
|
5
7
|
function createSessionTurnProbe(deps) {
|
|
6
8
|
return (key) => {
|
|
7
9
|
const keyString = deps.serializeKey(key);
|
|
8
10
|
const adapter = deps.getAdapter(key);
|
|
9
11
|
const isActive = adapter.checkIsActive(key);
|
|
12
|
+
const isWindowOpen = deps.checkIsSessionStarting(keyString);
|
|
13
|
+
const isStarting = isWindowOpen || deps.checkIsReplayingBufferedPrompts(keyString);
|
|
10
14
|
const isTurnEndBlocked = deps.checkHasPendingQuestion(keyString) ||
|
|
11
15
|
deps.checkHasQuestionPin(keyString) ||
|
|
12
16
|
(adapter.isQuestionPending?.(key) ?? false) ||
|
|
13
17
|
(adapter.isLoginPastePending?.(key) ?? false) ||
|
|
18
|
+
(adapter.checkIsRespawnPending?.(key) ?? false) ||
|
|
14
19
|
deps.checkIsCompacting(keyString) ||
|
|
15
20
|
Boolean(deps.getApiRetryTimer(keyString)) ||
|
|
16
21
|
deps.checkIsWedgeRecoveryInFlight(keyString) ||
|
|
17
22
|
deps.checkIsRetryKickInFlight(keyString) ||
|
|
18
|
-
deps.
|
|
23
|
+
deps.checkIsApiErrorInHandling(keyString) ||
|
|
24
|
+
isStarting;
|
|
25
|
+
const backgroundSignals = adapter.getBackgroundWorkSignals?.(key) ?? [];
|
|
26
|
+
// A finished task's own turn on its way is busy already: the watched turn runs on into it (the agent may answer there).
|
|
27
|
+
const isBusy = isActive && ((adapter.checkIsBusy?.(key) ?? false) || (adapter.checkIsTurnOnItsWay?.(key) ?? false));
|
|
28
|
+
// The replay writes into the process the start brought up, so it is named during the replay; an open window names none. A backend
|
|
29
|
+
// that cannot number its processes names its live one all the same: a prompt written there is never left unnamed (review 21 #1 b).
|
|
30
|
+
const processGeneration = isActive && !isWindowOpen
|
|
31
|
+
? (adapter.getProcessGeneration ? adapter.getProcessGeneration(key) : types_1.unnumberedProcessGeneration)
|
|
32
|
+
: undefined;
|
|
19
33
|
return {
|
|
20
34
|
isActive,
|
|
21
|
-
isBusy
|
|
22
|
-
|
|
35
|
+
isBusy,
|
|
36
|
+
...(isBusy && (adapter.checkIsCliOwnTurn?.(key) ?? false) ? { isCliOwnTurn: true } : {}),
|
|
37
|
+
...(isActive && (0, workingSignals_1.checkHasOwnPendingWork)(backgroundSignals) ? { hasOwnPendingWork: true } : {}),
|
|
38
|
+
...(isActive && (0, workingSignals_1.checkHasOwnLastingWork)(backgroundSignals) ? { hasOwnLastingWork: true } : {}),
|
|
39
|
+
...(processGeneration === undefined ? {} : { processGeneration }),
|
|
40
|
+
...(isWindowOpen ? { isWindowOpen: true } : {}),
|
|
41
|
+
hasUnconsumedInput: isStarting
|
|
23
42
|
? true
|
|
24
43
|
: adapter.checkHasUnconsumedInput ? adapter.checkHasUnconsumedInput(key) : null,
|
|
25
44
|
isTurnEndBlocked,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionTurnProbe.js","sourceRoot":"","sources":["../../src/requests/sessionTurnProbe.ts"],"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