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
|
@@ -17,6 +17,7 @@ exports.resolveTargetThreadKey = resolveTargetThreadKey;
|
|
|
17
17
|
exports.buildSpecFromCreateArgs = buildSpecFromCreateArgs;
|
|
18
18
|
exports.checkIsConversationInScope = checkIsConversationInScope;
|
|
19
19
|
exports.createSchedulerMcpCancellationLifecycle = createSchedulerMcpCancellationLifecycle;
|
|
20
|
+
exports.checkIsSchedulingPlatform = checkIsSchedulingPlatform;
|
|
20
21
|
exports.createSchedulerMcpServer = createSchedulerMcpServer;
|
|
21
22
|
const node_crypto_1 = require("node:crypto");
|
|
22
23
|
const node_http_1 = require("node:http");
|
|
@@ -25,10 +26,12 @@ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamable
|
|
|
25
26
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
26
27
|
const zod_1 = require("zod");
|
|
27
28
|
const adapterNames_1 = require("../adapters/adapterNames");
|
|
29
|
+
const noteText_1 = require("../limitNotes/noteText");
|
|
28
30
|
const sessionKey_1 = require("../sessionKey");
|
|
29
31
|
const botSkills_1 = require("../utils/botSkills");
|
|
30
32
|
const claudeProfiles_1 = require("../utils/claudeProfiles");
|
|
31
33
|
const claudeUsage_1 = require("../utils/claudeUsage");
|
|
34
|
+
const workerRoles_1 = require("../utils/workerRoles");
|
|
32
35
|
const fileSendPlan_1 = require("../utils/fileSendPlan");
|
|
33
36
|
const isoTimestamp_1 = require("../utils/isoTimestamp");
|
|
34
37
|
const localClock_1 = require("../utils/localClock");
|
|
@@ -37,7 +40,7 @@ const utils_1 = require("../utils");
|
|
|
37
40
|
const checkRun_1 = require("./checkRun");
|
|
38
41
|
const checkStatus_1 = require("./checkStatus");
|
|
39
42
|
const deliveryKind_1 = require("./deliveryKind");
|
|
40
|
-
const
|
|
43
|
+
const scheduleToolWording_1 = require("./scheduleToolWording");
|
|
41
44
|
const recurrence_1 = require("./recurrence");
|
|
42
45
|
const strictToolInput_1 = require("./strictToolInput");
|
|
43
46
|
const store_1 = require("./store");
|
|
@@ -166,23 +169,38 @@ const orchestrationInstructionHead = '• You orchestrate detached workers (a `c
|
|
|
166
169
|
/** What the worker-watch recipe says once a tool is named: shared by both wordings of the Telegram bullet. */
|
|
167
170
|
const workerWatchRecipeText = 'its description has the recipe (checkCommand, cron, status arguments); never `kill -0` alone: it never fires on a hung worker.';
|
|
168
171
|
/**
|
|
169
|
-
* The orchestration bullet of a conversation on a tracker
|
|
170
|
-
* with the bot's skills off (`/bot_skills`) there is nothing left of it and `null` drops it.
|
|
172
|
+
* The orchestration bullet of a conversation on a tracker that has no scheduling tools (the `test` platform, a key no codec
|
|
173
|
+
* reads): only the manager-skill hint, so with the bot's skills off (`/bot_skills`) there is nothing left of it and `null` drops it.
|
|
171
174
|
*/
|
|
172
175
|
function buildTrackerOrchestrationInstruction(isBotSkillsEnabled) {
|
|
173
176
|
return isBotSkillsEnabled ? `${orchestrationInstructionHead} ${managerSkillInstruction}.` : null;
|
|
174
177
|
}
|
|
178
|
+
/** What a Jira agent does after it armed a worker's watch: the bot stops its idle process and the watch wakes it in the same issue. */
|
|
179
|
+
const jiraEndTurnSentence = 'After the launch answer_request "progress", then END your turn: the watch wakes you in this issue when the worker is done (nothing of it is shown there).';
|
|
180
|
+
/**
|
|
181
|
+
* The orchestration bullet of a Jira issue: Telegram's (the manager-skill hint dropped with the skills off, the worker-watch
|
|
182
|
+
* recipe — a tool fact — staying) and what differs on an issue: the agent answers `progress`, then ENDS its turn, because the
|
|
183
|
+
* watch wakes it in the same issue and nothing of the watch is shown there.
|
|
184
|
+
*/
|
|
185
|
+
function buildJiraOrchestrationInstruction(isBotSkillsEnabled) {
|
|
186
|
+
return isBotSkillsEnabled
|
|
187
|
+
? `${orchestrationInstructionHead} ${managerSkillInstruction}. Watch EACH worker with schedule_create — ${workerWatchRecipeText} ${jiraEndTurnSentence}`
|
|
188
|
+
: `${orchestrationInstructionHead} schedule_create to watch EACH worker — ${workerWatchRecipeText} ${jiraEndTurnSentence}`;
|
|
189
|
+
}
|
|
175
190
|
/** The orchestration bullet of a Telegram topic: the manager-skill hint (dropped with the skills off) and the worker-watch recipe, which is a tool fact and stays. */
|
|
176
191
|
function buildTelegramOrchestrationInstruction(isBotSkillsEnabled) {
|
|
177
192
|
return isBotSkillsEnabled
|
|
178
193
|
? `${orchestrationInstructionHead} ${managerSkillInstruction}. Watch EACH worker with schedule_create — ${workerWatchRecipeText}`
|
|
179
194
|
: `${orchestrationInstructionHead} schedule_create to watch EACH worker — ${workerWatchRecipeText}`;
|
|
180
195
|
}
|
|
181
|
-
const claudeProfilesInstruction = '• Before you start or resume a child
|
|
196
|
+
const claudeProfilesInstruction = '• Before you start or resume a child worker → claude_profiles with its model, or its role when nothing you follow names one; start a `claude` under the account it names (`CLAUDE_CONFIG_DIR=<configDir>`), else it drains YOUR account. An `[Accounts …]` note means the limits moved: ask again before your next launch. More in the tool description.';
|
|
197
|
+
/** The longest `lastRunEndedAt` the tool takes: an ISO 8601 instant with fractional seconds and an offset is 35 characters. */
|
|
198
|
+
const claudeResumeInstantMaxLength = 40;
|
|
182
199
|
/** @description Which optional tools `deps` offers. */
|
|
183
200
|
function getOptionalBotTools(deps) {
|
|
184
201
|
return {
|
|
185
202
|
isJiraAttachmentToolOffered: deps.fetchJiraAttachment !== undefined,
|
|
203
|
+
isJiraFileSendOffered: deps.sendJiraFiles !== undefined,
|
|
186
204
|
isTodoToolOffered: deps.todos !== undefined,
|
|
187
205
|
remoteRunRunnerLines: deps.getRemoteRunRunnerLines?.() ?? [],
|
|
188
206
|
};
|
|
@@ -192,21 +210,25 @@ function buildTelegramInstructions(isTodoToolOffered, remoteRunInstructionText,
|
|
|
192
210
|
|
|
193
211
|
When to use it:
|
|
194
212
|
• The user asks to run/finish a plan or task LATER ("in 2h", "tomorrow 9am", "every weekday") → schedule_create. Put the work in \`prompt\`; the future run is a fresh session with no memory of this chat. Not CronCreate / ScheduleWakeup for anything that must happen: they die with your process, which the bot stops after a long idle stretch.
|
|
195
|
-
• You produced a file/chart/screenshot/video to deliver → send_file_to_user (images over ${fileSendPlan_1.telegramPhotoMaxSidePx} px go as a file). Videos MUST be H.264 .mp4, never as_file/document/.webm/.mov (they render as GIFs or don't play); transcode if needed
|
|
196
|
-
• You want to deliver SEVERAL discrete messages (
|
|
213
|
+
• You produced a file/chart/screenshot/video to deliver → send_file_to_user (images over ${fileSendPlan_1.telegramPhotoMaxSidePx} px go as a file). Videos MUST be H.264 .mp4, never as_file/document/.webm/.mov (they render as GIFs or don't play); transcode if needed.
|
|
214
|
+
• You want to deliver SEVERAL discrete messages (e.g. a per-item news digest) → send_messages_to_user; an item may attach ONE file (the text becomes its caption).
|
|
197
215
|
${compactConversationInstruction}
|
|
198
216
|
${isTodoToolOffered ? `${todoInstruction}\n` : ''}• You need to review or remove scheduled jobs → schedule_list / schedule_cancel.
|
|
199
217
|
• You need a watchdog — keep an eye on a service, build, deploy, disk, URL… → schedule_create with \`checkCommand\` (cron): the bot runs it in this folder, stays silent while it exits 0, and on the first failure posts a notice and wakes you with \`prompt\` + the exit code and output tail. Checks survive restarts and crashes. NEVER build your own watcher (background loop, nohup, sleep loop, tmux pane, shell crontab): it dies with your session or a restart, silently.
|
|
200
218
|
${buildTelegramOrchestrationInstruction(isBotSkillsEnabled)}
|
|
201
|
-
${answerRequestInstruction} The requester may not see your plain text: anything they must read goes through answer_request — yet your plain text
|
|
219
|
+
${answerRequestInstruction} An "only when you have a result" header may go unanswered. The requester may not see your plain text: anything they must read goes through answer_request — yet your plain text reaches the topic too, so end the turn WITHOUT a recap of your answer (it would show twice).
|
|
202
220
|
${claudeProfilesInstruction}${remoteRunInstructionText === null ? '' : `\n${remoteRunInstructionText}`}
|
|
203
221
|
|
|
204
222
|
Tool descriptions hold the argument recipes.`;
|
|
205
223
|
}
|
|
206
224
|
/** What a Jira session's instructions add: the tool that reaches the issue's original files (C10). */
|
|
207
225
|
const jiraAttachmentInstruction = '• The issue lists a file (an attachment id in the attachments list, or in a placeholder such as "[image: shot.png — attachment 10234]") you need to look at → jira_get_attachment with that id; it saves the original file and returns its path.';
|
|
226
|
+
/** What a Jira session's instructions add when it can show files on its issue. */
|
|
227
|
+
const jiraFileSendInstruction = '• You made a screenshot, a video or a file the requester should see → put its path in answer_request\'s `files`: it is attached to the issue and shown in your answer\'s comment (an image shown, an H.264 .mp4 playing, any other file linked); send_file_to_user posts files in a comment of their own.';
|
|
228
|
+
/** What a Jira session's instructions add for scheduling: nothing a fire, a check or a status does is shown on the issue. */
|
|
229
|
+
const jiraScheduleInstruction = '• Something must happen LATER, or you need a watchdog (a service, build, deploy, URL…) → schedule_create (`onceAt` / `cron` + `prompt`; `checkCommand` runs in this folder, silent while it exits 0, wakes you on the first failure): it resumes you in this issue. The bot posts nothing on the issue for it; answer the open request only with a result the requester needs. schedule_list / schedule_cancel. NEVER build your own watcher (loop, nohup, sleep, tmux, crontab): it dies with your session or a restart. Not CronCreate / ScheduleWakeup.';
|
|
208
230
|
/** For a conversation on a tracker: the requester sees nothing but the answers; `extraInstructions` name the platform's own tools. */
|
|
209
|
-
function buildTrackerInstructions(extraInstructions,
|
|
231
|
+
function buildTrackerInstructions(extraInstructions, orchestrationInstruction) {
|
|
210
232
|
return `This MCP connects the agent to the conversation that asked for its work.
|
|
211
233
|
|
|
212
234
|
When to use it:
|
|
@@ -215,7 +237,7 @@ ${[
|
|
|
215
237
|
...extraInstructions,
|
|
216
238
|
compactConversationInstruction,
|
|
217
239
|
claudeProfilesInstruction,
|
|
218
|
-
|
|
240
|
+
orchestrationInstruction,
|
|
219
241
|
].filter((instruction) => instruction !== null).join('\n')}
|
|
220
242
|
|
|
221
243
|
Each tool's own description has the exact argument recipe.`;
|
|
@@ -228,9 +250,9 @@ Each tool's own description has the exact argument recipe.`;
|
|
|
228
250
|
* already carries those in full. Kept terse on purpose.
|
|
229
251
|
*
|
|
230
252
|
* @description The connect-time instructions for a session of `platform`: only
|
|
231
|
-
* a Telegram session has the scheduling and send-to-topic tools, so only
|
|
232
|
-
* instructions name them (Jira connector plan J2, D18
|
|
233
|
-
* only where it is offered. With the bot's skills off for the session
|
|
253
|
+
* a Telegram or a Jira session has the scheduling tools and only a Telegram one the send-to-topic tools, so only their
|
|
254
|
+
* instructions name them (Jira connector plan J2, D18 — superseded for `schedule_*` by the Jira scheduling plan); an
|
|
255
|
+
* optional tool is named only where it is offered. With the bot's skills off for the session
|
|
234
256
|
* (`isBotSkillsEnabled`, `/bot_skills`) the orchestration bullet no longer tells it to load `charness-orchestration`.
|
|
235
257
|
*/
|
|
236
258
|
function buildMcpServerInstructions(platform, offered, isBotSkillsEnabled) {
|
|
@@ -239,12 +261,14 @@ function buildMcpServerInstructions(platform, offered, isBotSkillsEnabled) {
|
|
|
239
261
|
return buildTelegramInstructions(offered.isTodoToolOffered, remoteRunInstructionText, isBotSkillsEnabled);
|
|
240
262
|
const remoteRunInstructions = remoteRunInstructionText === null ? [] : [remoteRunInstructionText];
|
|
241
263
|
if (platform !== 'jira')
|
|
242
|
-
return buildTrackerInstructions(remoteRunInstructions, isBotSkillsEnabled);
|
|
264
|
+
return buildTrackerInstructions(remoteRunInstructions, buildTrackerOrchestrationInstruction(isBotSkillsEnabled));
|
|
243
265
|
return buildTrackerInstructions([
|
|
244
266
|
...(offered.isJiraAttachmentToolOffered ? [jiraAttachmentInstruction] : []),
|
|
267
|
+
...(offered.isJiraFileSendOffered ? [jiraFileSendInstruction] : []),
|
|
268
|
+
jiraScheduleInstruction,
|
|
245
269
|
...(offered.isTodoToolOffered ? [todoInstruction] : []),
|
|
246
270
|
...remoteRunInstructions,
|
|
247
|
-
], isBotSkillsEnabled);
|
|
271
|
+
], buildJiraOrchestrationInstruction(isBotSkillsEnabled));
|
|
248
272
|
};
|
|
249
273
|
const runnerCount = offered.remoteRunRunnerLines.length;
|
|
250
274
|
if (runnerCount === 0)
|
|
@@ -467,96 +491,80 @@ const threadKeyArgSchema = zod_1.z
|
|
|
467
491
|
.string()
|
|
468
492
|
.optional()
|
|
469
493
|
.describe('Target thread "<chatId>:<threadId>". Required when a directory scope has more than one bound thread.');
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
.
|
|
515
|
-
.
|
|
516
|
-
.
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
'A topic on the answers-only view, and a tracker issue, get no line.'),
|
|
529
|
-
statusCommand: zod_1.z
|
|
530
|
-
.string()
|
|
531
|
-
.max(checkStatus_1.maxCheckStatusCommandLength)
|
|
532
|
-
.optional()
|
|
533
|
-
.describe('A check\'s STATUS SOURCE for anything else: a shell command (run in the bound folder, at most ' +
|
|
534
|
-
`${checkStatus_1.checkStatusCommandTimeoutSec} s) whose first output line is the «now» of the same bot-posted status line ` +
|
|
535
|
-
'(e.g. `tail -n 1 build.log`). Only with checkCommand; not together with statusWorkerRunDir.'),
|
|
536
|
-
statusEveryMinutes: zod_1.z
|
|
537
|
-
.number()
|
|
538
|
-
.int()
|
|
539
|
-
.min(checkStatus_1.minCheckStatusEveryMinutes)
|
|
540
|
-
.max(checkStatus_1.maxCheckStatusEveryMinutes)
|
|
541
|
-
.optional()
|
|
542
|
-
.describe(`Minutes between two status lines (${checkStatus_1.minCheckStatusEveryMinutes}-${checkStatus_1.maxCheckStatusEveryMinutes}, default ${checkStatus_1.defaultCheckStatusEveryMinutes}). ` +
|
|
543
|
-
'Only with a status source.'),
|
|
494
|
+
/**
|
|
495
|
+
* The arguments of `schedule_create` both platforms take, with `wording`'s own descriptions where the platforms differ. The
|
|
496
|
+
* key order is the order an agent reads the tool's schema in: Telegram's is the original and must not move.
|
|
497
|
+
*/
|
|
498
|
+
function buildScheduleCreateCommonShape(wording) {
|
|
499
|
+
return {
|
|
500
|
+
name: zod_1.z.string().min(1).max(maxNameLength).describe(wording.nameDescription),
|
|
501
|
+
cron: zod_1.z
|
|
502
|
+
.string()
|
|
503
|
+
.optional()
|
|
504
|
+
.describe('5-field host-local cron expression for a RECURRING job (e.g. "0 9 * * 1-5"). ' +
|
|
505
|
+
'For a single future run use onceAt instead, NOT a cron (a cron has no year and would ' +
|
|
506
|
+
'fire on the same date every year). Omit onceAt when you pass cron.'),
|
|
507
|
+
onceAt: zod_1.z
|
|
508
|
+
.string()
|
|
509
|
+
.optional()
|
|
510
|
+
.describe('ISO 8601 instant for a ONE-SHOT run (e.g. "2026-06-07T09:00:00"). This is the right field for ' +
|
|
511
|
+
'"run it once at <time>". Omit cron AND repeatCount when you pass onceAt — a one-shot always runs ' +
|
|
512
|
+
'exactly once.'),
|
|
513
|
+
repeatCount: zod_1.z
|
|
514
|
+
.number()
|
|
515
|
+
.int()
|
|
516
|
+
.positive()
|
|
517
|
+
.optional()
|
|
518
|
+
.describe('Number of CRON fires before the job auto-deletes (N-times recurring). ONLY for cron jobs. ' +
|
|
519
|
+
'Do NOT set it for a one-shot (onceAt) — a one-shot already runs exactly once, so repeatCount ' +
|
|
520
|
+
'is ignored there.'),
|
|
521
|
+
prompt: zod_1.z
|
|
522
|
+
.string()
|
|
523
|
+
.min(1)
|
|
524
|
+
.max(maxPromptLength)
|
|
525
|
+
.describe('The prompt forwarded to the agent at fire time (for a check: only when the check fails, after ' +
|
|
526
|
+
'the failure details). Make it SELF-CONTAINED — the future run starts ' +
|
|
527
|
+
'with no memory of this conversation. Bake in everything it needs: the plan file path + scope, ' +
|
|
528
|
+
'whether to delegate to a sub-agent, and any constraints. Put the WORK in the prompt; do the ' +
|
|
529
|
+
'investigation later, when it fires.'),
|
|
530
|
+
checkCommand: zod_1.z.string().max(checkRun_1.maxCheckCommandLength).optional().describe(wording.checkCommandDescription),
|
|
531
|
+
checkTimeoutSeconds: zod_1.z
|
|
532
|
+
.number()
|
|
533
|
+
.int()
|
|
534
|
+
.positive()
|
|
535
|
+
.max(checkRun_1.maxCheckTimeoutSec)
|
|
536
|
+
.optional()
|
|
537
|
+
.describe(scheduleToolWording_1.checkTimeoutSecondsDescription),
|
|
538
|
+
statusWorkerRunDir: zod_1.z.string().max(checkStatus_1.maxCheckStatusRunDirLength).optional().describe(wording.statusWorkerRunDirDescription),
|
|
539
|
+
statusCommand: zod_1.z.string().max(checkStatus_1.maxCheckStatusCommandLength).optional().describe(wording.statusCommandDescription),
|
|
540
|
+
statusEveryMinutes: zod_1.z
|
|
541
|
+
.number()
|
|
542
|
+
.int()
|
|
543
|
+
.min(checkStatus_1.minCheckStatusEveryMinutes)
|
|
544
|
+
.max(checkStatus_1.maxCheckStatusEveryMinutes)
|
|
545
|
+
.optional()
|
|
546
|
+
.describe(wording.statusEveryMinutesDescription),
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
/** A Telegram topic's `schedule_create`: the common arguments, the deprecated pin switch and the target thread. */
|
|
550
|
+
const scheduleCreateTelegramInput = (0, strictToolInput_1.createStrictToolInput)({
|
|
551
|
+
...buildScheduleCreateCommonShape((0, scheduleToolWording_1.getScheduleToolWording)('telegram')),
|
|
544
552
|
isPinSilent: zod_1.z
|
|
545
553
|
.boolean()
|
|
546
554
|
.optional()
|
|
547
555
|
.describe('DEPRECATED, has no effect: scheduled messages and check alerts are never pinned. Do not pass it.'),
|
|
548
556
|
threadKey: threadKeyArgSchema,
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
};
|
|
559
|
-
const
|
|
557
|
+
});
|
|
558
|
+
/**
|
|
559
|
+
* A tracker conversation's `schedule_create`: the common arguments only — no `threadKey` (a tracker session's token names
|
|
560
|
+
* its one conversation, as `send_file_to_user` there) and no `isPinSilent` (deprecated, and nothing is pinned on a tracker).
|
|
561
|
+
*/
|
|
562
|
+
const scheduleCreateTrackerInput = (0, strictToolInput_1.createStrictToolInput)(buildScheduleCreateCommonShape((0, scheduleToolWording_1.getScheduleToolWording)('jira')));
|
|
563
|
+
const scheduleListTelegramInput = (0, strictToolInput_1.createStrictToolInput)({ threadKey: threadKeyArgSchema });
|
|
564
|
+
const scheduleListTrackerInput = (0, strictToolInput_1.createStrictToolInput)({});
|
|
565
|
+
const scheduleCancelIdSchema = zod_1.z.string().min(1).describe('The schedule id to cancel (from schedule_list).');
|
|
566
|
+
const scheduleCancelTelegramInput = (0, strictToolInput_1.createStrictToolInput)({ id: scheduleCancelIdSchema, threadKey: threadKeyArgSchema });
|
|
567
|
+
const scheduleCancelTrackerInput = (0, strictToolInput_1.createStrictToolInput)({ id: scheduleCancelIdSchema });
|
|
560
568
|
/**
|
|
561
569
|
* Coerces an ARRAY tool argument into an actual array before validation. Some
|
|
562
570
|
* MCP bridges (observed: Claude-agent harnesses AND OpenCode) serialize an array
|
|
@@ -713,6 +721,14 @@ function textResult(text) {
|
|
|
713
721
|
function errorResult(message) {
|
|
714
722
|
return { content: [{ type: 'text', text: message }], isError: true };
|
|
715
723
|
}
|
|
724
|
+
/**
|
|
725
|
+
* The result text of a send tool, with the accounts note as its last block when one is due for the conversation `threadKey`
|
|
726
|
+
* (`limitNotes/`): the bot cuts it from the tool-result block it shows in the topic. Without the port, the text as it is.
|
|
727
|
+
*/
|
|
728
|
+
function addLimitNoteToResult(deps, threadKey, text) {
|
|
729
|
+
const note = deps.takeLimitNoteForSend?.(threadKey) ?? null;
|
|
730
|
+
return note === null ? text : (0, noteText_1.appendLimitNote)(text, note);
|
|
731
|
+
}
|
|
716
732
|
/** Report an ambiguous delivery without inviting MCP clients to retry it. */
|
|
717
733
|
function deliveryUnknownResult(message) {
|
|
718
734
|
return {
|
|
@@ -758,42 +774,13 @@ function summarizeCreated(record) {
|
|
|
758
774
|
* @description Register the three scoped tools onto a fresh {@link McpServer}.
|
|
759
775
|
* Every handler resolves the target thread from `scope` first (scope isolation),
|
|
760
776
|
* then operates only on that thread's jobs. Bound to `deps` + the request's
|
|
761
|
-
* verified `scope`.
|
|
777
|
+
* verified `scope`. `platform` picks the wording and the input shape (`scheduleToolWording.ts`): a Telegram
|
|
778
|
+
* topic's original, or a tracker conversation's (no `threadKey`, no `isPinSilent`, nothing said of a topic).
|
|
762
779
|
*/
|
|
763
|
-
function registerSchedulerTools(server, deps, scope) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
'(name and schedule, the prompt folded under it) and forwards the prompt to the agent. The line is never pinned.\n\n' +
|
|
768
|
-
'Pick exactly ONE mode:\n' +
|
|
769
|
-
'• one-shot (run once at a time): pass onceAt (ISO 8601); omit cron and repeatCount.\n' +
|
|
770
|
-
'• recurring: pass cron (5-field); omit onceAt.\n' +
|
|
771
|
-
'• recurring N times: pass cron AND repeatCount; omit onceAt.\n' +
|
|
772
|
-
'For a single future run ALWAYS use onceAt — never a cron with repeatCount:1 ' +
|
|
773
|
-
'(a cron has no year, so it would fire on that date every year). repeatCount counts CRON ' +
|
|
774
|
-
'fires only and is ignored for a one-shot.\n\n' +
|
|
775
|
-
'USE THIS whenever the user asks to schedule execution of a plan or task for later ' +
|
|
776
|
-
"(e.g. \"schedule finishing plan X in 2h\", \"run this plan tomorrow morning\"). " +
|
|
777
|
-
'Schedule IMMEDIATELY: write the request straight into `prompt` and create the job FIRST — ' +
|
|
778
|
-
'do NOT read code, explore the repo, or deliberate before scheduling. Plan now, figure out the ' +
|
|
779
|
-
'details at fire time. The future run does the investigation, not this call.\n\n' +
|
|
780
|
-
'WATCHDOG: to monitor something (a service, process, build, deploy, disk, URL), pass checkCommand ' +
|
|
781
|
-
'with a cron — the bot runs it in this folder and wakes you only when it starts failing. This is ' +
|
|
782
|
-
'the ONLY reliable watcher: it survives bot restarts and crashes. Never build your own (a ' +
|
|
783
|
-
'background loop, nohup, a sleep loop, a tmux pane, a shell crontab) — it dies with your session ' +
|
|
784
|
-
'or a restart and then fails silently.\n\n' +
|
|
785
|
-
`A DETACHED WORKER you launched (a \`claude -p\` / \`opencode run\` process): cron \`${workerWatch_1.workerWatchCheckCron}\`, ` +
|
|
786
|
-
`\`${workerWatch_1.workerWatchStatusArguments}\`, checkCommand \`${workerWatch_1.workerWatchCheckCommand}\` with its PID and run dir (an absolute path) — it fails when ` +
|
|
787
|
-
`the worker exits, OR nothing in its run dir changed for ${workerWatch_1.workerWatchSilenceMinutes} min, OR the watch was armed ${workerWatch_1.workerWatchUnreportedMinutes} min ago (\`touch <run-dir>/${workerWatch_1.workerWatchArmedFileName}\` ` +
|
|
788
|
-
'right before you arm it — a resumed worker\'s reused run dir too — and again when you looked and found the worker fine: the same check then passes and watches on, ' +
|
|
789
|
-
'so do not arm a second one; a run dir without the file fails at once with exit 4), so the first failure is also the "worker finished" ' +
|
|
790
|
-
'signal (the topic then reads «worker finished», «worker silent» or «running without a report», never the command). Never `kill -0` alone: it stays green ' +
|
|
791
|
-
'while a worker hangs. The status arguments make the BOT post a silent status line into the topic every ' +
|
|
792
|
-
`${workerWatch_1.workerWatchStatusEveryMinutes} min while the worker lives (works N min, its last action), so the topic never looks frozen — ` +
|
|
793
|
-
'without waking you or spending tokens: never arm a schedule of your own for status lines. One check per worker run; ' +
|
|
794
|
-
'schedule_cancel it once its wake is handled (that also deletes its status line).',
|
|
795
|
-
inputSchema: scheduleCreateInput,
|
|
796
|
-
}, async (args) => {
|
|
780
|
+
function registerSchedulerTools(server, deps, scope, platform) {
|
|
781
|
+
const wording = (0, scheduleToolWording_1.getScheduleToolWording)(platform);
|
|
782
|
+
const isTracker = platform === 'jira';
|
|
783
|
+
const handleCreate = async (args) => {
|
|
797
784
|
const resolved = resolveTargetThreadKey(scope, args.threadKey, deps.getThreadsForDirectory);
|
|
798
785
|
if (!resolved.ok)
|
|
799
786
|
return errorResult(resolved.error);
|
|
@@ -826,6 +813,8 @@ function registerSchedulerTools(server, deps, scope) {
|
|
|
826
813
|
if (args.statusEveryMinutes !== undefined && !isStatusKept) {
|
|
827
814
|
notes.push('statusEveryMinutes was ignored — it only applies with checkCommand and a status source (statusWorkerRunDir or statusCommand).');
|
|
828
815
|
}
|
|
816
|
+
// The request this job is armed under: it decides which request a fire rides and whether the request waits for the job.
|
|
817
|
+
const requestId = deps.getArmingRequestId?.(resolved.threadKey);
|
|
829
818
|
const created = await (0, store_1.createScheduleForThread)(deps.store, {
|
|
830
819
|
threadKey,
|
|
831
820
|
name: args.name,
|
|
@@ -838,6 +827,7 @@ function registerSchedulerTools(server, deps, scope) {
|
|
|
838
827
|
? { deliveryKind: 'check', checkCommand, checkTimeoutSec: args.checkTimeoutSeconds }
|
|
839
828
|
: {}),
|
|
840
829
|
...(isStatusKept ? { statusWorkerRunDir, statusCommand, statusEveryMinutes: args.statusEveryMinutes } : {}),
|
|
830
|
+
...(requestId === undefined ? {} : { requestId }),
|
|
841
831
|
});
|
|
842
832
|
if (!created.ok) {
|
|
843
833
|
// The cap counts only the agent-prompt jobs `schedule_list` shows, so the
|
|
@@ -847,14 +837,18 @@ function registerSchedulerTools(server, deps, scope) {
|
|
|
847
837
|
}
|
|
848
838
|
const record = created.record;
|
|
849
839
|
deps.armJob(record);
|
|
840
|
+
// A worker watch is what an agent that launches detached workers arms: the conversation orchestrates them (`limitNotes/`).
|
|
841
|
+
if (isStatusKept && statusWorkerRunDir !== undefined)
|
|
842
|
+
deps.noteLimitWorkerWatch?.(resolved.threadKey);
|
|
850
843
|
const noteSuffix = notes.map((note) => `\n\nℹ️ ${note}`).join('');
|
|
851
844
|
return textResult(`${summarizeCreated(record)}${noteSuffix}`);
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
845
|
+
};
|
|
846
|
+
const createDefinition = { title: 'Create a scheduled prompt', description: wording.createDescription };
|
|
847
|
+
if (isTracker)
|
|
848
|
+
server.registerTool('schedule_create', { ...createDefinition, inputSchema: scheduleCreateTrackerInput }, handleCreate);
|
|
849
|
+
else
|
|
850
|
+
server.registerTool('schedule_create', { ...createDefinition, inputSchema: scheduleCreateTelegramInput }, handleCreate);
|
|
851
|
+
const handleList = async (args) => {
|
|
858
852
|
const resolved = resolveTargetThreadKey(scope, args.threadKey, deps.getThreadsForDirectory);
|
|
859
853
|
if (!resolved.ok)
|
|
860
854
|
return errorResult(resolved.error);
|
|
@@ -874,18 +868,17 @@ function registerSchedulerTools(server, deps, scope) {
|
|
|
874
868
|
.getThreadSchedules(threadKey)
|
|
875
869
|
.filter((record) => !(0, deliveryKind_1.checkIsReminderSchedule)(record));
|
|
876
870
|
if (records.length === 0) {
|
|
877
|
-
return textResult(
|
|
871
|
+
return textResult(wording.listEmptyText);
|
|
878
872
|
}
|
|
879
873
|
const lines = records.map((record, index) => `${index + 1}. ${summarizeRecord(record)}`);
|
|
880
874
|
return textResult(lines.join('\n'));
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}, async (args) => {
|
|
875
|
+
};
|
|
876
|
+
const listDefinition = { title: 'List scheduled prompts', description: wording.listDescription };
|
|
877
|
+
if (isTracker)
|
|
878
|
+
server.registerTool('schedule_list', { ...listDefinition, inputSchema: scheduleListTrackerInput }, handleList);
|
|
879
|
+
else
|
|
880
|
+
server.registerTool('schedule_list', { ...listDefinition, inputSchema: scheduleListTelegramInput }, handleList);
|
|
881
|
+
const handleCancel = async (args) => {
|
|
889
882
|
const resolved = resolveTargetThreadKey(scope, args.threadKey, deps.getThreadsForDirectory);
|
|
890
883
|
if (!resolved.ok)
|
|
891
884
|
return errorResult(resolved.error);
|
|
@@ -896,7 +889,7 @@ function registerSchedulerTools(server, deps, scope) {
|
|
|
896
889
|
// genuinely does not exist, and a distinct refusal would only tell it there
|
|
897
890
|
// is an id here worth retrying.
|
|
898
891
|
if (!record || record.threadKey !== resolved.threadKey || (0, deliveryKind_1.checkIsReminderSchedule)(record)) {
|
|
899
|
-
return errorResult(
|
|
892
|
+
return errorResult(wording.getCancelNotFoundText(args.id));
|
|
900
893
|
}
|
|
901
894
|
await deps.store.removeSchedule(args.id);
|
|
902
895
|
deps.disarmJob(args.id);
|
|
@@ -918,7 +911,12 @@ function registerSchedulerTools(server, deps, scope) {
|
|
|
918
911
|
}
|
|
919
912
|
const cleanupNote = cleanedUp.length > 0 ? `; ${cleanedUp.join('; ')}` : '';
|
|
920
913
|
return textResult(`Cancelled "${record.name}" (id: ${record.id})${cleanupNote}.`);
|
|
921
|
-
}
|
|
914
|
+
};
|
|
915
|
+
const cancelDefinition = { title: 'Cancel a scheduled prompt', description: wording.cancelDescription };
|
|
916
|
+
if (isTracker)
|
|
917
|
+
server.registerTool('schedule_cancel', { ...cancelDefinition, inputSchema: scheduleCancelTrackerInput }, handleCancel);
|
|
918
|
+
else
|
|
919
|
+
server.registerTool('schedule_cancel', { ...cancelDefinition, inputSchema: scheduleCancelTelegramInput }, handleCancel);
|
|
922
920
|
}
|
|
923
921
|
/**
|
|
924
922
|
* @description Register the agent→Telegram `send_file_to_user` tool onto a fresh
|
|
@@ -964,7 +962,7 @@ function registerFileSendTool(server, deps, scope, requestSignal) {
|
|
|
964
962
|
signal,
|
|
965
963
|
});
|
|
966
964
|
if (result.ok)
|
|
967
|
-
return textResult(result.summary);
|
|
965
|
+
return textResult(addLimitNoteToResult(deps, resolved.threadKey, result.summary));
|
|
968
966
|
return 'kind' in result && result.kind === 'deliveryUnknown'
|
|
969
967
|
? deliveryUnknownResult(result.error)
|
|
970
968
|
: errorResult(result.error);
|
|
@@ -1018,7 +1016,7 @@ function registerMessageSendTool(server, deps, scope, requestSignal) {
|
|
|
1018
1016
|
signal,
|
|
1019
1017
|
});
|
|
1020
1018
|
if (result.ok)
|
|
1021
|
-
return textResult(result.summary);
|
|
1019
|
+
return textResult(addLimitNoteToResult(deps, resolved.threadKey, result.summary));
|
|
1022
1020
|
return 'kind' in result && result.kind === 'deliveryUnknown'
|
|
1023
1021
|
? deliveryUnknownResult(result.error)
|
|
1024
1022
|
: errorResult(result.error);
|
|
@@ -1212,9 +1210,32 @@ const jiraAnswerRequestShape = {
|
|
|
1212
1210
|
.max(exports.answerReplyToCommentIdsMaxCount)
|
|
1213
1211
|
.optional()
|
|
1214
1212
|
.describe('Ids of the issue\'s comments this answer replies to, e.g. ["10240"]. The bot mentions each comment\'s ' +
|
|
1215
|
-
'author at the top of your answer so they are notified
|
|
1213
|
+
'author at the top of your answer so they are notified, and posts the answer in the thread of the first one ' +
|
|
1214
|
+
'(without it, an answer goes into the thread of the reply that opened its request, else it is a new comment). ' +
|
|
1215
|
+
'Only comments you were shown in this conversation count.'),
|
|
1216
1216
|
};
|
|
1217
1217
|
const jiraAnswerRequestInput = (0, strictToolInput_1.createStrictToolInput)(jiraAnswerRequestShape);
|
|
1218
|
+
/** The most files a Jira answer or comment carries ({@link jiraFilesMaxCount} of the connector: Telegram's album cap). */
|
|
1219
|
+
const jiraFilesMaxCount = 10;
|
|
1220
|
+
const jiraFilesDescription = 'Files to show in this answer\'s comment, as 1..10 paths RELATIVE to the issue\'s folder (absolute paths only if they resolve ' +
|
|
1221
|
+
'inside it): each is attached to the issue and shown after your text — a .png/.jpg/.jpeg/.gif/.webp image shown, an H.264 .mp4 ' +
|
|
1222
|
+
'playing, any other file listed as a link to its attachment. An image must be whole and what its name says; an .mp4 must be H.264 ' +
|
|
1223
|
+
'(convert: ffmpeg -i in.webm -c:v libx264 -pix_fmt yuv420p -movflags +faststart out.mp4). If one cannot be attached, nothing is ' +
|
|
1224
|
+
'posted; sending the same answer again reuses the files already attached.';
|
|
1225
|
+
/** `answer_request` in a Jira session that can show files: the Jira shape, and the files the answer carries. */
|
|
1226
|
+
const jiraFilesAnswerRequestShape = {
|
|
1227
|
+
...jiraAnswerRequestShape,
|
|
1228
|
+
files: zod_1.z.preprocess(coerceJsonArrayArg, zod_1.z.array(zod_1.z.string().min(1)).min(1).max(jiraFilesMaxCount)).optional().describe(jiraFilesDescription),
|
|
1229
|
+
};
|
|
1230
|
+
const jiraFilesAnswerRequestInput = (0, strictToolInput_1.createStrictToolInput)(jiraFilesAnswerRequestShape);
|
|
1231
|
+
/** `send_file_to_user` in a Jira session: the Telegram tool's arguments, but `threadKey` (a Jira session's token names its issue). */
|
|
1232
|
+
const jiraSendFileShape = {
|
|
1233
|
+
paths: zod_1.z.preprocess(coerceJsonArrayArg, zod_1.z.array(zod_1.z.string().min(1)).min(1).max(jiraFilesMaxCount))
|
|
1234
|
+
.describe('Files to show, as 1..10 paths RELATIVE to the issue\'s folder (absolute paths only if they resolve inside it). A path outside it is rejected and nothing is attached.'),
|
|
1235
|
+
caption: zod_1.z.string().optional().describe('Optional text of the comment, in Markdown, above the files.'),
|
|
1236
|
+
as_file: zod_1.z.boolean().optional().describe('List every file as a link to its attachment instead of showing images and videos in the comment.'),
|
|
1237
|
+
};
|
|
1238
|
+
const jiraSendFileInput = (0, strictToolInput_1.createStrictToolInput)(jiraSendFileShape);
|
|
1218
1239
|
/**
|
|
1219
1240
|
* @description Register `answer_request` (request/answer core S3): the agent's
|
|
1220
1241
|
* answer to a request, delivered to the surface the request came from. The
|
|
@@ -1238,16 +1259,47 @@ function registerAnswerRequestTool(server, deps, scope, platform) {
|
|
|
1238
1259
|
kind: args.kind,
|
|
1239
1260
|
body: args.body,
|
|
1240
1261
|
...(args.replyToCommentIds === undefined ? {} : { replyToCommentIds: args.replyToCommentIds }),
|
|
1262
|
+
...(args.files === undefined ? {} : { files: args.files }),
|
|
1241
1263
|
checkIsConversationInScope: (conversationKey) => checkIsConversationInScope(scope, conversationKey, deps.getThreadsForDirectory),
|
|
1242
1264
|
});
|
|
1243
|
-
return outcome.ok ? textResult(outcome.message) : errorResult(outcome.error);
|
|
1265
|
+
return outcome.ok ? textResult(addLimitNoteToResult(deps, outcome.conversationKey, outcome.message)) : errorResult(outcome.error);
|
|
1244
1266
|
};
|
|
1245
|
-
// The reply field names a tracker's comments: only a Jira session is offered it.
|
|
1246
|
-
if (platform === 'jira')
|
|
1267
|
+
// The reply field names a tracker's comments: only a Jira session is offered it — and the files, where the connector can attach them.
|
|
1268
|
+
if (platform === 'jira' && deps.sendJiraFiles)
|
|
1269
|
+
server.registerTool('answer_request', { ...definition, inputSchema: jiraFilesAnswerRequestInput }, handle);
|
|
1270
|
+
else if (platform === 'jira')
|
|
1247
1271
|
server.registerTool('answer_request', { ...definition, inputSchema: jiraAnswerRequestInput }, handle);
|
|
1248
1272
|
else
|
|
1249
1273
|
server.registerTool('answer_request', { ...definition, inputSchema: answerRequestInput }, handle);
|
|
1250
1274
|
}
|
|
1275
|
+
/**
|
|
1276
|
+
* `send_file_to_user` in a Jira session — the tool a Telegram session sends files with, under the same name and
|
|
1277
|
+
* arguments, so one instruction («send the video with send_file_to_user») works on both: the files are attached to the
|
|
1278
|
+
* issue and shown in ONE comment, the caption as its text. The issue is the session's own (its scoped token).
|
|
1279
|
+
*/
|
|
1280
|
+
function registerJiraFileSendTool(server, deps, sendJiraFiles, scope) {
|
|
1281
|
+
server.registerTool('send_file_to_user', {
|
|
1282
|
+
title: 'Show files on this issue',
|
|
1283
|
+
description: 'Attach one or more files from THIS issue\'s folder to the Jira issue and post ONE comment that shows them, the caption as ' +
|
|
1284
|
+
'its text: a .png/.jpg/.jpeg/.gif/.webp image is shown in the comment, an H.264 .mp4 plays in it, any other file is listed ' +
|
|
1285
|
+
'as a link to its attachment (as_file:true lists every file that way). To put files INTO your answer instead, pass them in ' +
|
|
1286
|
+
'answer_request\'s `files`. The comment goes into the thread your newest open request answers in. An image must be whole ' +
|
|
1287
|
+
'and what its name says, an .mp4 must be H.264 (convert: ffmpeg -i in.webm -c:v libx264 -pix_fmt yuv420p -movflags ' +
|
|
1288
|
+
'+faststart out.mp4), and no file may be over the site\'s upload limit: otherwise nothing is attached. A file you attached ' +
|
|
1289
|
+
'before with the same name and the same content is reused, so sending again attaches nothing twice. If a send fails, say so ' +
|
|
1290
|
+
'in your answer and go on.',
|
|
1291
|
+
inputSchema: jiraSendFileInput,
|
|
1292
|
+
}, async (args) => {
|
|
1293
|
+
await deps.whenSessionsRestored();
|
|
1294
|
+
const resolved = resolveTargetThreadKey(scope, undefined, deps.getThreadsForDirectory);
|
|
1295
|
+
if (!resolved.ok)
|
|
1296
|
+
return errorResult(resolved.error);
|
|
1297
|
+
const result = await sendJiraFiles(resolved.threadKey, { paths: args.paths, caption: args.caption, asFile: args.as_file });
|
|
1298
|
+
if (result.ok)
|
|
1299
|
+
return textResult(addLimitNoteToResult(deps, resolved.threadKey, result.summary));
|
|
1300
|
+
return 'kind' in result && result.kind === 'deliveryUnknown' ? deliveryUnknownResult(result.error) : errorResult(result.error);
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1251
1303
|
/**
|
|
1252
1304
|
* @description Correlate stateless MCP requests with cancellation notifications.
|
|
1253
1305
|
* Active controllers are isolated by verified token + validated client identity
|
|
@@ -1372,42 +1424,62 @@ function buildRequestServer(deps, scope, requestSignal) {
|
|
|
1372
1424
|
registerBotTools(server, deps, scope, platform, requestSignal);
|
|
1373
1425
|
return server;
|
|
1374
1426
|
}
|
|
1427
|
+
/**
|
|
1428
|
+
* @description Whether a conversation of `platform` gets the `schedule_*` tools: a Telegram topic and a Jira issue (the wording
|
|
1429
|
+
* of each is `scheduleToolWording.ts`). The `test` platform and a key no codec reads keep the platform-neutral tool set.
|
|
1430
|
+
*/
|
|
1431
|
+
function checkIsSchedulingPlatform(platform) {
|
|
1432
|
+
return platform === 'telegram' || platform === 'jira';
|
|
1433
|
+
}
|
|
1375
1434
|
/** The tools a session of `platform` gets — the one list the request path serves and the digest records. */
|
|
1376
1435
|
function registerBotTools(server, deps, scope, platform, requestSignal) {
|
|
1377
|
-
//
|
|
1436
|
+
// Scheduling belongs to a conversation of a platform that can be woken by it: a topic or a Jira issue (this superseded D18 for
|
|
1437
|
+
// the `schedule_*` tools). A key no codec reads, or the test platform, keeps the neutral set.
|
|
1438
|
+
if (checkIsSchedulingPlatform(platform))
|
|
1439
|
+
registerSchedulerTools(server, deps, scope, platform);
|
|
1440
|
+
// These deliver into a Telegram topic; for another platform's key they would throw (D18 stands for them).
|
|
1378
1441
|
if (platform === 'telegram') {
|
|
1379
|
-
registerSchedulerTools(server, deps, scope);
|
|
1380
1442
|
registerFileSendTool(server, deps, scope, requestSignal);
|
|
1381
1443
|
registerMessageSendTool(server, deps, scope, requestSignal);
|
|
1382
1444
|
}
|
|
1383
1445
|
// The original files of the conversation's own issue: only a Jira session, and only with the connector loaded.
|
|
1384
1446
|
if (platform === 'jira' && deps.fetchJiraAttachment)
|
|
1385
1447
|
registerJiraAttachmentTool(server, deps, deps.fetchJiraAttachment, scope);
|
|
1448
|
+
// Files shown on the conversation's own issue: only a Jira session, and only with the connector loaded.
|
|
1449
|
+
if (platform === 'jira' && deps.sendJiraFiles)
|
|
1450
|
+
registerJiraFileSendTool(server, deps, deps.sendJiraFiles, scope);
|
|
1386
1451
|
registerCompactConversationTool(server, deps, scope);
|
|
1387
1452
|
// A published list belongs to a conversation of a platform that has one (D54): a topic or a Jira issue.
|
|
1388
1453
|
if (deps.todos && (platform === 'telegram' || platform === 'jira'))
|
|
1389
1454
|
registerTodoTools(server, deps, deps.todos, scope);
|
|
1390
1455
|
registerAnswerRequestTool(server, deps, scope, platform);
|
|
1391
1456
|
if (deps.listClaudeProfiles)
|
|
1392
|
-
registerClaudeProfilesTool(server, deps.listClaudeProfiles);
|
|
1457
|
+
registerClaudeProfilesTool(server, deps, deps.listClaudeProfiles, scope);
|
|
1393
1458
|
}
|
|
1394
|
-
/** The first line of the `claude_profiles` answer:
|
|
1459
|
+
/** The first line of the `claude_profiles` answer: with a `role`, the role's launch leads (`describeWorkerRoleVerdict`); then the account verdict. */
|
|
1395
1460
|
function buildClaudeProfilesVerdict(report, currentProfile) {
|
|
1461
|
+
const accountVerdict = buildClaudeAccountVerdict(report, currentProfile);
|
|
1462
|
+
return report.worker === undefined ? accountVerdict : (0, workerRoles_1.describeWorkerRoleVerdict)(report.worker, accountVerdict);
|
|
1463
|
+
}
|
|
1464
|
+
/** The account part of the first line: the pick with how to launch it and why, a hand-over, or that nothing is usable and when something is. */
|
|
1465
|
+
function buildClaudeAccountVerdict(report, currentProfile) {
|
|
1466
|
+
// A worker that must not be resumed on another account: the hand-over leads, the pick is in the JSON.
|
|
1467
|
+
const handOver = (0, claudeUsage_1.describeClaudeResumeHandOver)(report, currentProfile);
|
|
1468
|
+
if (handOver !== null)
|
|
1469
|
+
return handOver;
|
|
1396
1470
|
const outcome = (0, claudeUsage_1.describeClaudeLaunchOutcome)(report, currentProfile);
|
|
1397
1471
|
const exclusions = (0, claudeUsage_1.describeClaudeChainExclusions)(report);
|
|
1398
1472
|
const notOffered = exclusions === null ? '' : ` [${exclusions}]`;
|
|
1399
1473
|
if (report.recommended === null)
|
|
1400
1474
|
return `${outcome}${notOffered}`;
|
|
1401
|
-
|
|
1402
|
-
const launch = dir === null ? 'default profile, set no CLAUDE_CONFIG_DIR' : `CLAUDE_CONFIG_DIR=${dir}`;
|
|
1403
|
-
return `recommended: ${report.recommended} → ${launch} (${outcome})${notOffered}`;
|
|
1475
|
+
return `recommended: ${report.recommended} → ${(0, claudeUsage_1.describeClaudeProfileLaunch)(report, report.recommended)} (${outcome})${notOffered}`;
|
|
1404
1476
|
}
|
|
1405
1477
|
/**
|
|
1406
1478
|
* `claude_profiles`: which Claude account a child process should run on. Reads the bot's per-profile usage
|
|
1407
1479
|
* cache (refreshed on demand by the port); touches no conversation, so it needs no scope resolution. The
|
|
1408
1480
|
* answer is the report as JSON with a one-line verdict first, so an agent can act on it without parsing.
|
|
1409
1481
|
*/
|
|
1410
|
-
function registerClaudeProfilesTool(server, listClaudeProfiles) {
|
|
1482
|
+
function registerClaudeProfilesTool(server, deps, listClaudeProfiles, scope) {
|
|
1411
1483
|
server.registerTool('claude_profiles', {
|
|
1412
1484
|
title: 'Claude accounts and their usage',
|
|
1413
1485
|
description: 'The Claude account profiles signed in on this host, each with its usage windows — session (5 h), weekly ' +
|
|
@@ -1417,33 +1489,60 @@ function registerClaudeProfilesTool(server, listClaudeProfiles) {
|
|
|
1417
1489
|
'session you resume). A NEW agent (omit `currentProfile`) goes to an `api`-billed account of the list first while its ' +
|
|
1418
1490
|
'credit lasts (a Claude Console balance, no windows), then to the usable subscription whose weekly limit resets ' +
|
|
1419
1491
|
'SOONEST — what burns soonest is spent first; an account whose five-hour window is at 90 % or more is skipped until ' +
|
|
1420
|
-
'it resets. Take the account `recommended`
|
|
1421
|
-
'`
|
|
1422
|
-
'
|
|
1423
|
-
'
|
|
1424
|
-
'
|
|
1425
|
-
'
|
|
1492
|
+
'it resets. Take the account of `recommended` — on a resume, of `resume.profile` (below); no need to ask the operator. Calling it IS looking at the limits: ' +
|
|
1493
|
+
'the bot\'s `[Accounts …]` reminders then wait another interval. A worker you RESUME: pass `currentProfile` (the profile it last ran on) ' +
|
|
1494
|
+
'and `lastRunEndedAt` (when its last run ended — the last write of its log; omitted = cold). The answer then carries ' +
|
|
1495
|
+
'`resume`: `resume` → continue the session under `resume.profile`; `handOver` → do NOT resume that worker on another ' +
|
|
1496
|
+
'account: give its work to a NEW worker on `resume.profile` (a reviewer already running there may apply its own findings, ' +
|
|
1497
|
+
'then a fresh reviewer checks). It hands over when the worker\'s account is signed out, limited, out of the list or at 100 % ' +
|
|
1498
|
+
'on a window the model drains, or when its last run ended 55 min ago or more (the prompt cache is cold) and another ' +
|
|
1499
|
+
'account is now the pick; otherwise it resumes where it ran. A worker cut off MID-RUN by a usage limit — or by "Credit ' +
|
|
1500
|
+
'balance is too low" — is the exception: pass `isStoppedByLimit: true` and resume the SAME session at once on the answer ' +
|
|
1501
|
+
'(for an `api` account the bot first checks the balance with one tiny request: it marks the credit used up only if the API ' +
|
|
1502
|
+
'refuses for it, else it keeps the account off agents for an hour). The session window and the shared weekly window bound every model, Fable ' +
|
|
1426
1503
|
'included; Fable also drains its own weekly window; signed-out and limited accounts are skipped. An `api` entry ' +
|
|
1427
1504
|
'also carries the bot\'s own estimate of its API credit — `spentUsd` through the bot in the current credit period, ' +
|
|
1428
1505
|
'`remainingEstimateUsd` and `expiresOn` when the operator gave a Console figure (null otherwise; `expiresOn` stays null ' +
|
|
1429
1506
|
'after a renewal), `probablyUsedUp` after a refusal for the balance (the bot cannot be sure; it rechecks daily) and ' +
|
|
1430
1507
|
'`renewedAt` once it saw the credit come back — never the Console balance; past a given `expiresOn` it is not put ' +
|
|
1431
|
-
'first. `
|
|
1508
|
+
'first. `launchOrder` lists the accounts a launch would go to, best first (`recommended` is its head for a new agent). ' +
|
|
1509
|
+
'`recommended: null` means nothing is usable now: ' +
|
|
1432
1510
|
'`nextAvailable` names the account and instant that frees up first — schedule ONE resume at that time instead ' +
|
|
1433
1511
|
'of retrying; when `nextAvailable` is null too, tell the user and retry once in about 30 minutes. Call it BEFORE launching or resuming a child `claude` and start the child with ' +
|
|
1434
1512
|
'CLAUDE_CONFIG_DIR=<configDir> in its environment — configDir null means the default profile: set nothing. ' +
|
|
1435
|
-
'Without the variable the child inherits the account of this very session.'
|
|
1513
|
+
'Without the variable the child inherits the account of this very session. ' +
|
|
1514
|
+
'Pass `role` instead of `model` when nothing you follow names the worker\'s model: `worker` (and the first line) then gives ' +
|
|
1515
|
+
'the operator\'s default CLI, model and effort for it (/workers) — the bot\'s DEFAULT: a model the user names, or a general ' +
|
|
1516
|
+
'delegate skill you follow names for the role, wins. `worker.cli: opencode` with `worker.unavailable` null needs no Claude account ' +
|
|
1517
|
+
'(`recommended`, `resume` and `nextAvailable` do not apply to it); `worker.unavailable` set → launch the worker on the CLI, ' +
|
|
1518
|
+
'model and effort this conversation runs on — on Claude, call this tool again with that model and take its account. A worker you resume keeps its first run\'s ' +
|
|
1519
|
+
'model and effort: pass that `model`, not the role.',
|
|
1436
1520
|
inputSchema: (0, strictToolInput_1.createStrictToolInput)({
|
|
1437
1521
|
model: zod_1.z
|
|
1438
1522
|
.string()
|
|
1439
1523
|
.max(64)
|
|
1440
1524
|
.optional()
|
|
1441
|
-
.describe('The model the child will run (e.g. "fable", "opus", "sonnet"); decides whether the Fable weekly window counts besides the shared ones. Omit for the shared windows.'),
|
|
1525
|
+
.describe('The model the child will run (e.g. "fable", "opus", "sonnet"); decides whether the Fable weekly window counts besides the shared ones. Omit for the shared windows. Not with `role`.'),
|
|
1526
|
+
role: zod_1.z
|
|
1527
|
+
.enum(workerRoles_1.workerRoleIds)
|
|
1528
|
+
.optional()
|
|
1529
|
+
.describe('The worker\'s role, when neither the user nor a general delegate skill you follow names its model (they do → pass `model` instead): ' +
|
|
1530
|
+
'`builder` — code, tests, debugging, e2e and live runs, rework, fixes after a full run; ' +
|
|
1531
|
+
'`storageBuilder` — a builder whose work touches data persistence (storage, DB schema and migrations, sync, merge and conflict resolution, backups — anything that can lose or corrupt user data); ' +
|
|
1532
|
+
'`investigator` — a cause still unclear after a builder failed on it twice (also UX or platform behaviour); ' +
|
|
1533
|
+
'`reviewer` — the independent review of a task or commit; ' +
|
|
1534
|
+
'`miniReviewer` — a small diff, a reviewer\'s own fix, applied fixes; ' +
|
|
1535
|
+
'`planner` — a planner, and the research that feeds a plan (a researcher, an analyst).'),
|
|
1442
1536
|
currentProfile: zod_1.z
|
|
1443
1537
|
.string()
|
|
1444
1538
|
.max(claudeProfiles_1.claudeProfileNameMaxLength)
|
|
1445
1539
|
.optional()
|
|
1446
1540
|
.describe('The profile the session you RESUME last ran on (the `name` you recorded at its launch); omit for a new agent.'),
|
|
1541
|
+
lastRunEndedAt: zod_1.z
|
|
1542
|
+
.string()
|
|
1543
|
+
.max(claudeResumeInstantMaxLength)
|
|
1544
|
+
.optional()
|
|
1545
|
+
.describe('When the resumed worker\'s last run ended, an ISO 8601 instant (the last write of its log, e.g. 2026-11-21T12:30:00Z). Omit = unknown, so cold. Needs `currentProfile`.'),
|
|
1447
1546
|
isStoppedByLimit: zod_1.z
|
|
1448
1547
|
.boolean()
|
|
1449
1548
|
.optional()
|
|
@@ -1451,10 +1550,27 @@ function registerClaudeProfilesTool(server, listClaudeProfiles) {
|
|
|
1451
1550
|
}),
|
|
1452
1551
|
}, async (args) => {
|
|
1453
1552
|
const currentProfile = args.currentProfile?.trim() || null;
|
|
1553
|
+
const model = args.model?.trim() || null;
|
|
1554
|
+
if (args.role !== undefined && model !== null) {
|
|
1555
|
+
return errorResult('Pass `model` OR `role`, not both: `model` when the user or a general delegate skill you follow names the worker\'s model, `role` when nothing does.');
|
|
1556
|
+
}
|
|
1454
1557
|
if (args.isStoppedByLimit === true && currentProfile === null) {
|
|
1455
1558
|
return errorResult('isStoppedByLimit needs currentProfile — the profile the session that hit the limit last ran on.');
|
|
1456
1559
|
}
|
|
1457
|
-
|
|
1560
|
+
let lastRunEndedAtMs = null;
|
|
1561
|
+
if (args.lastRunEndedAt !== undefined) {
|
|
1562
|
+
if (currentProfile === null)
|
|
1563
|
+
return errorResult('lastRunEndedAt needs currentProfile — the profile the worker you resume last ran on.');
|
|
1564
|
+
lastRunEndedAtMs = Date.parse(args.lastRunEndedAt);
|
|
1565
|
+
if (Number.isNaN(lastRunEndedAtMs))
|
|
1566
|
+
return errorResult('lastRunEndedAt must be an ISO 8601 instant, e.g. 2026-11-21T12:30:00Z.');
|
|
1567
|
+
}
|
|
1568
|
+
const report = await listClaudeProfiles({ model, role: args.role ?? null, currentProfile, isStoppedByLimit: args.isStoppedByLimit === true, lastRunEndedAtMs });
|
|
1569
|
+
// The agent looked at the accounts, and launching workers is what it does: the reminder clock restarts, the conversation
|
|
1570
|
+
// orchestrates (`limitNotes/`). Resolved like the send tools; a `dir` scope with several bound topics names none: nothing is recorded.
|
|
1571
|
+
const resolved = resolveTargetThreadKey(scope, undefined, deps.getThreadsForDirectory);
|
|
1572
|
+
if (resolved.ok)
|
|
1573
|
+
deps.noteLimitProfilesCall?.(resolved.threadKey);
|
|
1458
1574
|
return textResult(`${buildClaudeProfilesVerdict(report, currentProfile)}\n${JSON.stringify(report, null, 1)}`);
|
|
1459
1575
|
});
|
|
1460
1576
|
}
|