wave-agent-sdk 0.19.6 → 0.19.8
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/dist/agent.d.ts +16 -14
- package/dist/agent.js +58 -56
- package/dist/constants/goalPrompts.d.ts +0 -1
- package/dist/constants/subagents.d.ts +0 -1
- package/dist/constants/toolLimits.d.ts +0 -1
- package/dist/constants/tools.d.ts +0 -1
- package/dist/core/plugin.d.ts +0 -1
- package/dist/core/session.d.ts +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/managers/MemoryRuleManager.d.ts +0 -1
- package/dist/managers/aiManager.d.ts +2 -1
- package/dist/managers/aiManager.js +29 -9
- package/dist/managers/backgroundTaskManager.d.ts +0 -2
- package/dist/managers/backgroundTaskManager.js +16 -19
- package/dist/managers/bangManager.d.ts +0 -1
- package/dist/managers/cronManager.d.ts +0 -1
- package/dist/managers/foregroundTaskManager.d.ts +0 -1
- package/dist/managers/forkedAgentManager.d.ts +0 -1
- package/dist/managers/goalManager.d.ts +0 -1
- package/dist/managers/hookManager.d.ts +0 -1
- package/dist/managers/liveConfigManager.d.ts +0 -1
- package/dist/managers/lspManager.d.ts +0 -1
- package/dist/managers/mcpManager.d.ts +0 -1
- package/dist/managers/messageManager.d.ts +0 -1
- package/dist/managers/messageQueue.d.ts +17 -2
- package/dist/managers/messageQueue.js +40 -1
- package/dist/managers/permissionManager.d.ts +0 -1
- package/dist/managers/planManager.d.ts +0 -1
- package/dist/managers/pluginManager.d.ts +0 -1
- package/dist/managers/pluginScopeManager.d.ts +0 -1
- package/dist/managers/reversionManager.d.ts +0 -1
- package/dist/managers/skillManager.d.ts +0 -1
- package/dist/managers/slashCommandManager.d.ts +0 -1
- package/dist/managers/subagentManager.d.ts +0 -3
- package/dist/managers/subagentManager.js +14 -13
- package/dist/managers/toolManager.d.ts +0 -1
- package/dist/managers/workflowManager.d.ts +1 -2
- package/dist/managers/workflowManager.js +4 -4
- package/dist/prompts/autoMemory.d.ts +0 -1
- package/dist/prompts/autoMemoryExtraction.d.ts +0 -1
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/planModeReminders.d.ts +0 -1
- package/dist/services/GitService.d.ts +0 -1
- package/dist/services/MarketplaceService.d.ts +0 -1
- package/dist/services/MemoryRuleService.d.ts +0 -1
- package/dist/services/aiService.d.ts +0 -1
- package/dist/services/authService.d.ts +0 -1
- package/dist/services/autoMemoryService.d.ts +0 -1
- package/dist/services/configurationService.d.ts +6 -1
- package/dist/services/configurationService.js +31 -0
- package/dist/services/fileWatcher.d.ts +0 -1
- package/dist/services/hook.d.ts +0 -1
- package/dist/services/initializationService.d.ts +0 -1
- package/dist/services/interactionService.d.ts +0 -1
- package/dist/services/interactionService.js +10 -0
- package/dist/services/jsonlHandler.d.ts +0 -1
- package/dist/services/memory.d.ts +0 -1
- package/dist/services/pluginLoader.d.ts +0 -1
- package/dist/services/remoteSettingsService.d.ts +0 -1
- package/dist/services/remoteSettingsService.js +2 -0
- package/dist/services/reversionService.d.ts +0 -1
- package/dist/services/session.d.ts +0 -1
- package/dist/services/taskManager.d.ts +0 -1
- package/dist/services/taskManager.js +8 -1
- package/dist/telemetry/events.d.ts +0 -1
- package/dist/telemetry/instrumentation.d.ts +0 -1
- package/dist/telemetry/sessionTracing.d.ts +0 -1
- package/dist/tools/agentTool.d.ts +0 -1
- package/dist/tools/askUserQuestion.d.ts +0 -1
- package/dist/tools/bashTool.d.ts +0 -1
- package/dist/tools/buildTool.d.ts +0 -1
- package/dist/tools/cronCreateTool.d.ts +0 -1
- package/dist/tools/cronDeleteTool.d.ts +0 -1
- package/dist/tools/cronListTool.d.ts +0 -1
- package/dist/tools/editTool.d.ts +0 -1
- package/dist/tools/enterPlanMode.d.ts +0 -1
- package/dist/tools/enterWorktreeTool.d.ts +0 -1
- package/dist/tools/enterWorktreeTool.js +2 -1
- package/dist/tools/exitPlanMode.d.ts +0 -1
- package/dist/tools/exitWorktreeTool.d.ts +0 -1
- package/dist/tools/globTool.d.ts +0 -1
- package/dist/tools/grepTool.d.ts +0 -1
- package/dist/tools/lspTool.d.ts +0 -1
- package/dist/tools/readTool.d.ts +0 -1
- package/dist/tools/skillTool.d.ts +0 -1
- package/dist/tools/taskManagementTools.d.ts +0 -1
- package/dist/tools/taskStopTool.d.ts +0 -1
- package/dist/tools/types.d.ts +0 -1
- package/dist/tools/webFetchTool.d.ts +0 -1
- package/dist/tools/workflowTool.d.ts +0 -1
- package/dist/tools/writeTool.d.ts +0 -1
- package/dist/types/agent.d.ts +0 -1
- package/dist/types/auth.d.ts +0 -1
- package/dist/types/commands.d.ts +0 -1
- package/dist/types/config.d.ts +0 -1
- package/dist/types/configuration.d.ts +5 -1
- package/dist/types/core.d.ts +0 -1
- package/dist/types/cron.d.ts +0 -1
- package/dist/types/environment.d.ts +0 -1
- package/dist/types/fileSearch.d.ts +0 -1
- package/dist/types/history.d.ts +0 -1
- package/dist/types/hooks.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/lsp.d.ts +0 -1
- package/dist/types/marketplace.d.ts +0 -1
- package/dist/types/mcp.d.ts +0 -1
- package/dist/types/memoryRule.d.ts +0 -1
- package/dist/types/messaging.d.ts +0 -1
- package/dist/types/permissions.d.ts +0 -3
- package/dist/types/plugins.d.ts +0 -1
- package/dist/types/processes.d.ts +27 -1
- package/dist/types/reversion.d.ts +0 -1
- package/dist/types/session.d.ts +0 -1
- package/dist/types/skills.d.ts +0 -1
- package/dist/types/tasks.d.ts +0 -1
- package/dist/types/telemetry.d.ts +0 -1
- package/dist/types/tools.d.ts +0 -1
- package/dist/types/workflow.d.ts +1 -2
- package/dist/utils/abortUtils.d.ts +0 -1
- package/dist/utils/atomicWrite.d.ts +0 -1
- package/dist/utils/bashParser.d.ts +0 -1
- package/dist/utils/cacheControlUtils.d.ts +0 -1
- package/dist/utils/commandArgumentParser.d.ts +0 -1
- package/dist/utils/commandPathResolver.d.ts +0 -1
- package/dist/utils/configPaths.d.ts +0 -1
- package/dist/utils/configValidator.d.ts +0 -1
- package/dist/utils/constants.d.ts +0 -1
- package/dist/utils/container.d.ts +0 -1
- package/dist/utils/containerSetup.d.ts +0 -1
- package/dist/utils/containerSetup.js +0 -12
- package/dist/utils/convertMessagesForAPI.d.ts +0 -1
- package/dist/utils/cronTasks.d.ts +0 -1
- package/dist/utils/cronTasksLock.d.ts +0 -1
- package/dist/utils/cronToHuman.d.ts +0 -1
- package/dist/utils/customCommands.d.ts +0 -1
- package/dist/utils/editUtils.d.ts +0 -1
- package/dist/utils/fileFormat.d.ts +0 -1
- package/dist/utils/fileSearch.d.ts +0 -1
- package/dist/utils/fileUtils.d.ts +0 -1
- package/dist/utils/gitUtils.d.ts +0 -1
- package/dist/utils/globalLogger.d.ts +0 -1
- package/dist/utils/groupMessagesByApiRound.d.ts +0 -1
- package/dist/utils/hookMatcher.d.ts +0 -1
- package/dist/utils/markdownParser.d.ts +0 -1
- package/dist/utils/mcpUtils.d.ts +0 -1
- package/dist/utils/messageOperations.d.ts +0 -1
- package/dist/utils/modelCapabilities.d.ts +0 -1
- package/dist/utils/nameGenerator.d.ts +0 -1
- package/dist/utils/notificationXml.d.ts +0 -1
- package/dist/utils/openaiClient.d.ts +0 -1
- package/dist/utils/parseCronExpression.d.ts +0 -1
- package/dist/utils/path.d.ts +0 -1
- package/dist/utils/pathEncoder.d.ts +0 -1
- package/dist/utils/pathSafety.d.ts +0 -1
- package/dist/utils/promptHistory.d.ts +0 -1
- package/dist/utils/ripgrep.d.ts +0 -1
- package/dist/utils/shellResolver.d.ts +0 -1
- package/dist/utils/skillParser.d.ts +0 -1
- package/dist/utils/stringUtils.d.ts +0 -1
- package/dist/utils/subagentParser.d.ts +0 -1
- package/dist/utils/taskReminder.d.ts +0 -1
- package/dist/utils/tokenCalculation.d.ts +0 -1
- package/dist/utils/tokenEstimate.d.ts +0 -1
- package/dist/utils/toolResultStorage.d.ts +0 -1
- package/dist/utils/worktreeSession.d.ts +1 -2
- package/dist/utils/worktreeSession.js +1 -1
- package/dist/utils/worktreeUtils.d.ts +7 -2
- package/dist/utils/worktreeUtils.js +10 -4
- package/dist/workflow/budgetTracker.d.ts +0 -1
- package/dist/workflow/concurrencyLimiter.d.ts +0 -1
- package/dist/workflow/journal.d.ts +0 -1
- package/dist/workflow/progressReporter.d.ts +0 -1
- package/dist/workflow/runState.d.ts +0 -1
- package/dist/workflow/scriptRuntime.d.ts +0 -1
- package/dist/workflow/structuredOutput.d.ts +0 -1
- package/dist/workflow/types.d.ts +5 -1
- package/dist/workflow/workflowApis.d.ts +0 -1
- package/package.json +1 -1
- package/src/agent.ts +59 -67
- package/src/index.ts +1 -0
- package/src/managers/aiManager.ts +34 -10
- package/src/managers/backgroundTaskManager.ts +17 -21
- package/src/managers/messageQueue.ts +43 -2
- package/src/managers/subagentManager.ts +15 -15
- package/src/managers/workflowManager.ts +5 -5
- package/src/services/configurationService.ts +37 -0
- package/src/services/interactionService.ts +11 -0
- package/src/services/remoteSettingsService.ts +1 -0
- package/src/services/taskManager.ts +8 -1
- package/src/tools/enterWorktreeTool.ts +2 -1
- package/src/types/configuration.ts +5 -0
- package/src/types/permissions.ts +0 -2
- package/src/types/processes.ts +29 -0
- package/src/types/workflow.ts +1 -0
- package/src/utils/containerSetup.ts +0 -15
- package/src/utils/worktreeSession.ts +1 -1
- package/src/utils/worktreeUtils.ts +14 -4
- package/src/workflow/types.ts +6 -0
- package/dist/agent.d.ts.map +0 -1
- package/dist/constants/goalPrompts.d.ts.map +0 -1
- package/dist/constants/subagents.d.ts.map +0 -1
- package/dist/constants/toolLimits.d.ts.map +0 -1
- package/dist/constants/tools.d.ts.map +0 -1
- package/dist/core/plugin.d.ts.map +0 -1
- package/dist/core/session.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/managers/MemoryRuleManager.d.ts.map +0 -1
- package/dist/managers/aiManager.d.ts.map +0 -1
- package/dist/managers/backgroundTaskManager.d.ts.map +0 -1
- package/dist/managers/bangManager.d.ts.map +0 -1
- package/dist/managers/cronManager.d.ts.map +0 -1
- package/dist/managers/foregroundTaskManager.d.ts.map +0 -1
- package/dist/managers/forkedAgentManager.d.ts.map +0 -1
- package/dist/managers/goalManager.d.ts.map +0 -1
- package/dist/managers/hookManager.d.ts.map +0 -1
- package/dist/managers/liveConfigManager.d.ts.map +0 -1
- package/dist/managers/lspManager.d.ts.map +0 -1
- package/dist/managers/mcpManager.d.ts.map +0 -1
- package/dist/managers/messageManager.d.ts.map +0 -1
- package/dist/managers/messageQueue.d.ts.map +0 -1
- package/dist/managers/notificationQueue.d.ts +0 -8
- package/dist/managers/notificationQueue.d.ts.map +0 -1
- package/dist/managers/notificationQueue.js +0 -17
- package/dist/managers/permissionManager.d.ts.map +0 -1
- package/dist/managers/planManager.d.ts.map +0 -1
- package/dist/managers/pluginManager.d.ts.map +0 -1
- package/dist/managers/pluginScopeManager.d.ts.map +0 -1
- package/dist/managers/reversionManager.d.ts.map +0 -1
- package/dist/managers/skillManager.d.ts.map +0 -1
- package/dist/managers/slashCommandManager.d.ts.map +0 -1
- package/dist/managers/subagentManager.d.ts.map +0 -1
- package/dist/managers/toolManager.d.ts.map +0 -1
- package/dist/managers/workflowManager.d.ts.map +0 -1
- package/dist/prompts/autoMemory.d.ts.map +0 -1
- package/dist/prompts/autoMemoryExtraction.d.ts.map +0 -1
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/planModeReminders.d.ts.map +0 -1
- package/dist/services/GitService.d.ts.map +0 -1
- package/dist/services/MarketplaceService.d.ts.map +0 -1
- package/dist/services/MemoryRuleService.d.ts.map +0 -1
- package/dist/services/aiService.d.ts.map +0 -1
- package/dist/services/authService.d.ts.map +0 -1
- package/dist/services/autoMemoryService.d.ts.map +0 -1
- package/dist/services/configurationService.d.ts.map +0 -1
- package/dist/services/fileWatcher.d.ts.map +0 -1
- package/dist/services/hook.d.ts.map +0 -1
- package/dist/services/initializationService.d.ts.map +0 -1
- package/dist/services/interactionService.d.ts.map +0 -1
- package/dist/services/jsonlHandler.d.ts.map +0 -1
- package/dist/services/memory.d.ts.map +0 -1
- package/dist/services/pluginLoader.d.ts.map +0 -1
- package/dist/services/remoteSettingsService.d.ts.map +0 -1
- package/dist/services/reversionService.d.ts.map +0 -1
- package/dist/services/session.d.ts.map +0 -1
- package/dist/services/taskManager.d.ts.map +0 -1
- package/dist/telemetry/events.d.ts.map +0 -1
- package/dist/telemetry/instrumentation.d.ts.map +0 -1
- package/dist/telemetry/sessionTracing.d.ts.map +0 -1
- package/dist/tools/agentTool.d.ts.map +0 -1
- package/dist/tools/askUserQuestion.d.ts.map +0 -1
- package/dist/tools/bashTool.d.ts.map +0 -1
- package/dist/tools/buildTool.d.ts.map +0 -1
- package/dist/tools/cronCreateTool.d.ts.map +0 -1
- package/dist/tools/cronDeleteTool.d.ts.map +0 -1
- package/dist/tools/cronListTool.d.ts.map +0 -1
- package/dist/tools/editTool.d.ts.map +0 -1
- package/dist/tools/enterPlanMode.d.ts.map +0 -1
- package/dist/tools/enterWorktreeTool.d.ts.map +0 -1
- package/dist/tools/exitPlanMode.d.ts.map +0 -1
- package/dist/tools/exitWorktreeTool.d.ts.map +0 -1
- package/dist/tools/globTool.d.ts.map +0 -1
- package/dist/tools/grepTool.d.ts.map +0 -1
- package/dist/tools/lspTool.d.ts.map +0 -1
- package/dist/tools/readTool.d.ts.map +0 -1
- package/dist/tools/skillTool.d.ts.map +0 -1
- package/dist/tools/taskManagementTools.d.ts.map +0 -1
- package/dist/tools/taskStopTool.d.ts.map +0 -1
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/webFetchTool.d.ts.map +0 -1
- package/dist/tools/workflowTool.d.ts.map +0 -1
- package/dist/tools/writeTool.d.ts.map +0 -1
- package/dist/types/agent.d.ts.map +0 -1
- package/dist/types/auth.d.ts.map +0 -1
- package/dist/types/commands.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/configuration.d.ts.map +0 -1
- package/dist/types/core.d.ts.map +0 -1
- package/dist/types/cron.d.ts.map +0 -1
- package/dist/types/environment.d.ts.map +0 -1
- package/dist/types/fileSearch.d.ts.map +0 -1
- package/dist/types/history.d.ts.map +0 -1
- package/dist/types/hooks.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lsp.d.ts.map +0 -1
- package/dist/types/marketplace.d.ts.map +0 -1
- package/dist/types/mcp.d.ts.map +0 -1
- package/dist/types/memoryRule.d.ts.map +0 -1
- package/dist/types/messaging.d.ts.map +0 -1
- package/dist/types/permissions.d.ts.map +0 -1
- package/dist/types/plugins.d.ts.map +0 -1
- package/dist/types/processes.d.ts.map +0 -1
- package/dist/types/reversion.d.ts.map +0 -1
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/skills.d.ts.map +0 -1
- package/dist/types/tasks.d.ts.map +0 -1
- package/dist/types/telemetry.d.ts.map +0 -1
- package/dist/types/tools.d.ts.map +0 -1
- package/dist/types/workflow.d.ts.map +0 -1
- package/dist/utils/abortUtils.d.ts.map +0 -1
- package/dist/utils/atomicWrite.d.ts.map +0 -1
- package/dist/utils/bashParser.d.ts.map +0 -1
- package/dist/utils/cacheControlUtils.d.ts.map +0 -1
- package/dist/utils/commandArgumentParser.d.ts.map +0 -1
- package/dist/utils/commandPathResolver.d.ts.map +0 -1
- package/dist/utils/configPaths.d.ts.map +0 -1
- package/dist/utils/configValidator.d.ts.map +0 -1
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/container.d.ts.map +0 -1
- package/dist/utils/containerSetup.d.ts.map +0 -1
- package/dist/utils/convertMessagesForAPI.d.ts.map +0 -1
- package/dist/utils/cronTasks.d.ts.map +0 -1
- package/dist/utils/cronTasksLock.d.ts.map +0 -1
- package/dist/utils/cronToHuman.d.ts.map +0 -1
- package/dist/utils/customCommands.d.ts.map +0 -1
- package/dist/utils/editUtils.d.ts.map +0 -1
- package/dist/utils/fileFormat.d.ts.map +0 -1
- package/dist/utils/fileSearch.d.ts.map +0 -1
- package/dist/utils/fileUtils.d.ts.map +0 -1
- package/dist/utils/gitUtils.d.ts.map +0 -1
- package/dist/utils/globalLogger.d.ts.map +0 -1
- package/dist/utils/groupMessagesByApiRound.d.ts.map +0 -1
- package/dist/utils/hookMatcher.d.ts.map +0 -1
- package/dist/utils/markdownParser.d.ts.map +0 -1
- package/dist/utils/mcpUtils.d.ts.map +0 -1
- package/dist/utils/messageOperations.d.ts.map +0 -1
- package/dist/utils/modelCapabilities.d.ts.map +0 -1
- package/dist/utils/nameGenerator.d.ts.map +0 -1
- package/dist/utils/notificationXml.d.ts.map +0 -1
- package/dist/utils/openaiClient.d.ts.map +0 -1
- package/dist/utils/parseCronExpression.d.ts.map +0 -1
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/pathEncoder.d.ts.map +0 -1
- package/dist/utils/pathSafety.d.ts.map +0 -1
- package/dist/utils/promptHistory.d.ts.map +0 -1
- package/dist/utils/ripgrep.d.ts.map +0 -1
- package/dist/utils/shellResolver.d.ts.map +0 -1
- package/dist/utils/skillParser.d.ts.map +0 -1
- package/dist/utils/stringUtils.d.ts.map +0 -1
- package/dist/utils/subagentParser.d.ts.map +0 -1
- package/dist/utils/taskReminder.d.ts.map +0 -1
- package/dist/utils/tokenCalculation.d.ts.map +0 -1
- package/dist/utils/tokenEstimate.d.ts.map +0 -1
- package/dist/utils/toolResultStorage.d.ts.map +0 -1
- package/dist/utils/worktreeSession.d.ts.map +0 -1
- package/dist/utils/worktreeUtils.d.ts.map +0 -1
- package/dist/workflow/budgetTracker.d.ts.map +0 -1
- package/dist/workflow/concurrencyLimiter.d.ts.map +0 -1
- package/dist/workflow/journal.d.ts.map +0 -1
- package/dist/workflow/progressReporter.d.ts.map +0 -1
- package/dist/workflow/runState.d.ts.map +0 -1
- package/dist/workflow/scriptRuntime.d.ts.map +0 -1
- package/dist/workflow/structuredOutput.d.ts.map +0 -1
- package/dist/workflow/types.d.ts.map +0 -1
- package/dist/workflow/workflowApis.d.ts.map +0 -1
- package/src/managers/notificationQueue.ts +0 -19
package/dist/agent.d.ts
CHANGED
|
@@ -22,9 +22,8 @@ export declare class Agent {
|
|
|
22
22
|
private goalManager;
|
|
23
23
|
private hookManager;
|
|
24
24
|
private reversionManager;
|
|
25
|
-
private notificationQueue;
|
|
26
25
|
private messageQueue;
|
|
27
|
-
private
|
|
26
|
+
private dispatchPromise;
|
|
28
27
|
private memoryRuleManager;
|
|
29
28
|
private liveConfigManager;
|
|
30
29
|
private taskManager;
|
|
@@ -90,7 +89,7 @@ export declare class Agent {
|
|
|
90
89
|
get isCompacting(): boolean;
|
|
91
90
|
/** Get bash command execution status */
|
|
92
91
|
get isCommandRunning(): boolean;
|
|
93
|
-
/** Get queued messages */
|
|
92
|
+
/** Get queued user-facing messages (excludes background notifications) */
|
|
94
93
|
get queuedMessages(): QueuedMessage[];
|
|
95
94
|
/** Get goal status string */
|
|
96
95
|
get goalStatus(): string;
|
|
@@ -128,13 +127,15 @@ export declare class Agent {
|
|
|
128
127
|
type?: "message" | "bang";
|
|
129
128
|
}): boolean;
|
|
130
129
|
/**
|
|
131
|
-
* Unified
|
|
132
|
-
*
|
|
133
|
-
*
|
|
130
|
+
* Unified dispatch trigger — checks state machine before processing.
|
|
131
|
+
* Handles user messages, bang commands, and background task notifications
|
|
132
|
+
* through a single serialized path. Called from onMessageEnqueued,
|
|
133
|
+
* onLoadingChange(false), and onCommandRunningChange(false).
|
|
134
134
|
*/
|
|
135
|
-
private
|
|
135
|
+
private tryDispatch;
|
|
136
136
|
/**
|
|
137
|
-
* Process the next queued
|
|
137
|
+
* Process the next queued item when the agent becomes idle.
|
|
138
|
+
* Handles three item types: user messages, bang commands, and notifications.
|
|
138
139
|
*/
|
|
139
140
|
private processQueuedMessage;
|
|
140
141
|
/** Get background bash shell output */
|
|
@@ -221,11 +222,6 @@ export declare class Agent {
|
|
|
221
222
|
*/
|
|
222
223
|
restoreSession(sessionId: string): Promise<void>;
|
|
223
224
|
abortAIMessage(): void;
|
|
224
|
-
/**
|
|
225
|
-
* Process pending background task notifications by injecting them as user messages
|
|
226
|
-
* and triggering a new AI response cycle.
|
|
227
|
-
*/
|
|
228
|
-
private processPendingNotifications;
|
|
229
225
|
/** Execute bash command (bang command) */
|
|
230
226
|
bang(command: string): Promise<void>;
|
|
231
227
|
clearMessages(): Promise<void>;
|
|
@@ -394,5 +390,11 @@ export declare class Agent {
|
|
|
394
390
|
* Check if there are any running background tasks or active subagents
|
|
395
391
|
*/
|
|
396
392
|
get hasRunningBackgroundWork(): boolean;
|
|
393
|
+
/**
|
|
394
|
+
* Check if there are pending items (messages, bang commands, or background
|
|
395
|
+
* task notifications) in the message queue. Background task completion
|
|
396
|
+
* notifications are enqueued before the main agent's dispatch consumes them,
|
|
397
|
+
* so callers waiting for the agent to fully settle must also wait on this.
|
|
398
|
+
*/
|
|
399
|
+
get hasPendingMessages(): boolean;
|
|
397
400
|
}
|
|
398
|
-
//# sourceMappingURL=agent.d.ts.map
|
package/dist/agent.js
CHANGED
|
@@ -51,7 +51,7 @@ export class Agent {
|
|
|
51
51
|
*/
|
|
52
52
|
constructor(options) {
|
|
53
53
|
this.bangManager = null;
|
|
54
|
-
this.
|
|
54
|
+
this.dispatchPromise = null; // Track current dispatch for teardown
|
|
55
55
|
this.sessionStartTime = Date.now();
|
|
56
56
|
const { logger, workdir, systemPrompt, stream = true } = options;
|
|
57
57
|
// Set working directory early as we need it for loading configuration
|
|
@@ -111,36 +111,27 @@ export class Agent {
|
|
|
111
111
|
this.bangManager = this.container.get("BangManager");
|
|
112
112
|
this.cronManager = this.container.get("CronManager");
|
|
113
113
|
this.goalManager = this.container.get("GoalManager");
|
|
114
|
-
this.notificationQueue = this.container.get("NotificationQueue");
|
|
115
114
|
this.messageQueue = this.container.get("MessageQueue");
|
|
116
|
-
// Wire up notification queue to trigger AI when notifications arrive while idle
|
|
117
|
-
this.notificationQueue.onNotificationsEnqueued = () => {
|
|
118
|
-
// If the AI is NOT loading (idle), trigger a new AI cycle to process notifications
|
|
119
|
-
if (!this.aiManager.isLoading) {
|
|
120
|
-
const pendingPromise = this.processPendingNotifications().catch((error) => {
|
|
121
|
-
this.logger?.error("Failed to process pending notifications:", error);
|
|
122
|
-
});
|
|
123
|
-
this.pendingNotificationPromises.push(pendingPromise);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
115
|
// Wire up CWD change callback from AIManager to sync Agent's workdir
|
|
127
116
|
this.aiManager.setOnCwdChange((newCwd) => {
|
|
128
117
|
this.workdir = newCwd;
|
|
129
118
|
this.container.register("Workdir", newCwd);
|
|
130
119
|
this.options.callbacks?.onWorkdirChange?.(newCwd);
|
|
131
120
|
});
|
|
132
|
-
// Wire up message queue to process when agent becomes idle
|
|
133
|
-
|
|
121
|
+
// Wire up message queue to process when agent becomes idle.
|
|
122
|
+
// Both user messages and background task notifications enqueue here,
|
|
123
|
+
// unified through a single dispatch path (tryDispatch).
|
|
124
|
+
this.messageQueue.onMessageEnqueued = () => this.tryDispatch();
|
|
134
125
|
// Wire up AI loading changes to process queue when AI becomes idle
|
|
135
126
|
this.aiManager.onLoadingChange = (loading) => {
|
|
136
127
|
if (!loading)
|
|
137
|
-
this.
|
|
128
|
+
this.tryDispatch();
|
|
138
129
|
};
|
|
139
130
|
// Wire up bang manager callback for command running changes
|
|
140
131
|
this.bangManager.onCommandRunningChange = (running) => {
|
|
141
132
|
this.options.callbacks?.onCommandRunningChange?.(running);
|
|
142
133
|
if (!running)
|
|
143
|
-
this.
|
|
134
|
+
this.tryDispatch();
|
|
144
135
|
};
|
|
145
136
|
// Set initial permission mode if provided
|
|
146
137
|
if (options.permissionMode) {
|
|
@@ -218,9 +209,11 @@ export class Agent {
|
|
|
218
209
|
get isCommandRunning() {
|
|
219
210
|
return this.bangManager?.isCommandRunning ?? false;
|
|
220
211
|
}
|
|
221
|
-
/** Get queued messages */
|
|
212
|
+
/** Get queued user-facing messages (excludes background notifications) */
|
|
222
213
|
get queuedMessages() {
|
|
223
|
-
return this.messageQueue
|
|
214
|
+
return this.messageQueue
|
|
215
|
+
.getQueue()
|
|
216
|
+
.filter((m) => m.type !== "notification");
|
|
224
217
|
}
|
|
225
218
|
/** Get goal status string */
|
|
226
219
|
get goalStatus() {
|
|
@@ -279,11 +272,12 @@ export class Agent {
|
|
|
279
272
|
return updated;
|
|
280
273
|
}
|
|
281
274
|
/**
|
|
282
|
-
* Unified
|
|
283
|
-
*
|
|
284
|
-
*
|
|
275
|
+
* Unified dispatch trigger — checks state machine before processing.
|
|
276
|
+
* Handles user messages, bang commands, and background task notifications
|
|
277
|
+
* through a single serialized path. Called from onMessageEnqueued,
|
|
278
|
+
* onLoadingChange(false), and onCommandRunningChange(false).
|
|
285
279
|
*/
|
|
286
|
-
|
|
280
|
+
tryDispatch() {
|
|
287
281
|
if (this.messageQueue.state !== "idle")
|
|
288
282
|
return;
|
|
289
283
|
if (!this.messageQueue.hasPending())
|
|
@@ -291,17 +285,19 @@ export class Agent {
|
|
|
291
285
|
if (this.aiManager.isLoading || this.isCommandRunning)
|
|
292
286
|
return;
|
|
293
287
|
this.messageQueue.transitionTo("dispatching");
|
|
294
|
-
this.processQueuedMessage()
|
|
288
|
+
this.dispatchPromise = this.processQueuedMessage()
|
|
295
289
|
.catch((error) => {
|
|
296
290
|
this.logger?.error("Failed to process queued message:", error);
|
|
297
291
|
})
|
|
298
292
|
.finally(() => {
|
|
299
293
|
this.messageQueue.transitionTo("idle");
|
|
300
|
-
this.
|
|
294
|
+
this.dispatchPromise = null;
|
|
295
|
+
this.tryDispatch(); // Re-check after processing
|
|
301
296
|
});
|
|
302
297
|
}
|
|
303
298
|
/**
|
|
304
|
-
* Process the next queued
|
|
299
|
+
* Process the next queued item when the agent becomes idle.
|
|
300
|
+
* Handles three item types: user messages, bang commands, and notifications.
|
|
305
301
|
*/
|
|
306
302
|
async processQueuedMessage() {
|
|
307
303
|
const next = this.messageQueue.dequeue();
|
|
@@ -313,6 +309,26 @@ export class Agent {
|
|
|
313
309
|
await this.bangManager?.executeCommand(next.content);
|
|
314
310
|
await this.messageManager.saveSession();
|
|
315
311
|
}
|
|
312
|
+
else if (next.type === "notification") {
|
|
313
|
+
// Drain all pending notifications and batch them into a single AI turn
|
|
314
|
+
const allNotifications = [
|
|
315
|
+
next.content,
|
|
316
|
+
...this.messageQueue.drainNotifications(),
|
|
317
|
+
];
|
|
318
|
+
for (const xml of allNotifications) {
|
|
319
|
+
const block = parseTaskNotificationXml(xml);
|
|
320
|
+
if (block) {
|
|
321
|
+
this.messageManager.addNotificationMessage({
|
|
322
|
+
taskId: block.taskId,
|
|
323
|
+
taskType: block.taskType,
|
|
324
|
+
status: block.status,
|
|
325
|
+
summary: block.summary,
|
|
326
|
+
outputFile: block.outputFile,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
await this.aiManager.sendAIMessage({ recursionDepth: 0 });
|
|
331
|
+
}
|
|
316
332
|
else {
|
|
317
333
|
await this.sendMessage(next.content, next.images);
|
|
318
334
|
}
|
|
@@ -489,29 +505,6 @@ export class Agent {
|
|
|
489
505
|
abortAIMessage() {
|
|
490
506
|
this.aiManager.abortAIMessage();
|
|
491
507
|
}
|
|
492
|
-
/**
|
|
493
|
-
* Process pending background task notifications by injecting them as user messages
|
|
494
|
-
* and triggering a new AI response cycle.
|
|
495
|
-
*/
|
|
496
|
-
async processPendingNotifications() {
|
|
497
|
-
const notifications = this.notificationQueue.dequeueAll();
|
|
498
|
-
if (notifications.length === 0)
|
|
499
|
-
return;
|
|
500
|
-
for (const notification of notifications) {
|
|
501
|
-
const block = parseTaskNotificationXml(notification);
|
|
502
|
-
if (block) {
|
|
503
|
-
this.messageManager.addNotificationMessage({
|
|
504
|
-
taskId: block.taskId,
|
|
505
|
-
taskType: block.taskType,
|
|
506
|
-
status: block.status,
|
|
507
|
-
summary: block.summary,
|
|
508
|
-
outputFile: block.outputFile,
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
// Trigger AI to process the notifications
|
|
513
|
-
await this.aiManager.sendAIMessage({ recursionDepth: 0 });
|
|
514
|
-
}
|
|
515
508
|
/** Execute bash command (bang command) */
|
|
516
509
|
async bang(command) {
|
|
517
510
|
// If the agent is busy, enqueue the bang command
|
|
@@ -640,8 +633,9 @@ export class Agent {
|
|
|
640
633
|
/** Unified interrupt method, interrupts both AI messages and command execution */
|
|
641
634
|
abortMessage() {
|
|
642
635
|
if (this.aiManager.isLoading || this.isCommandRunning) {
|
|
643
|
-
// Clear queue first to prevent processQueuedMessage
|
|
644
|
-
// when abortAIMessage triggers onLoadingChange(false)
|
|
636
|
+
// Clear user-facing queue items first to prevent processQueuedMessage
|
|
637
|
+
// from dequeuing when abortAIMessage triggers onLoadingChange(false).
|
|
638
|
+
// Notifications are preserved so background task results aren't lost.
|
|
645
639
|
this.messageQueue.clear();
|
|
646
640
|
this.options.callbacks?.onQueuedMessagesChange?.(this.queuedMessages);
|
|
647
641
|
}
|
|
@@ -715,14 +709,13 @@ export class Agent {
|
|
|
715
709
|
exitReason: "destroy",
|
|
716
710
|
}).catch(() => { });
|
|
717
711
|
await shutdownTelemetry();
|
|
718
|
-
// Clear
|
|
712
|
+
// Clear message queue callback first to prevent any late triggers from
|
|
719
713
|
// starting async work during teardown
|
|
720
|
-
this.
|
|
721
|
-
// Await any pending
|
|
714
|
+
this.messageQueue.onMessageEnqueued = undefined;
|
|
715
|
+
// Await any pending dispatch to prevent race conditions
|
|
722
716
|
// with test teardown (e.g., V8 coverage stream cleanup)
|
|
723
|
-
if (this.
|
|
724
|
-
await
|
|
725
|
-
this.pendingNotificationPromises = [];
|
|
717
|
+
if (this.dispatchPromise) {
|
|
718
|
+
await this.dispatchPromise.catch(() => { });
|
|
726
719
|
}
|
|
727
720
|
// Fire SessionEnd hooks (fire-and-forget, don't block shutdown)
|
|
728
721
|
try {
|
|
@@ -985,4 +978,13 @@ export class Agent {
|
|
|
985
978
|
const activeSubagents = this.subagentManager.getActiveInstances().length > 0;
|
|
986
979
|
return runningTasks || activeSubagents;
|
|
987
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* Check if there are pending items (messages, bang commands, or background
|
|
983
|
+
* task notifications) in the message queue. Background task completion
|
|
984
|
+
* notifications are enqueued before the main agent's dispatch consumes them,
|
|
985
|
+
* so callers waiting for the agent to fully settle must also wait on this.
|
|
986
|
+
*/
|
|
987
|
+
get hasPendingMessages() {
|
|
988
|
+
return this.messageQueue.hasPending();
|
|
989
|
+
}
|
|
988
990
|
}
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
export declare const GOAL_EVALUATION_SYSTEM_PROMPT = "You are a goal evaluator. Given a goal condition and a conversation, determine whether the goal has been achieved.\n\nRules:\n- Judge ONLY based on what the conversation shows \u2014 tool outputs, test results, file contents, etc.\n- Do NOT assume work is done without evidence in the conversation.\n- Be strict and conservative: when uncertain, return met: false.\n- Be concise: your reason should be 1-2 sentences.\n\nRespond with JSON only, no other text:\n{\"met\": boolean, \"reason\": \"short explanation\"}";
|
|
2
|
-
//# sourceMappingURL=goalPrompts.d.ts.map
|
|
@@ -9,4 +9,3 @@ export declare const BASH_MAX_OUTPUT_CHARS = 30000;
|
|
|
9
9
|
export declare const SKILL_BASH_MAX_OUTPUT_CHARS = 30000;
|
|
10
10
|
/** Preview size in characters when output is persisted to disk. */
|
|
11
11
|
export declare const PREVIEW_SIZE_BYTES = 2048;
|
|
12
|
-
//# sourceMappingURL=toolLimits.d.ts.map
|
|
@@ -22,4 +22,3 @@ export declare const WEB_FETCH_TOOL_NAME = "WebFetch";
|
|
|
22
22
|
export declare const ENTER_WORKTREE_TOOL_NAME = "EnterWorktree";
|
|
23
23
|
export declare const EXIT_WORKTREE_TOOL_NAME = "ExitWorktree";
|
|
24
24
|
export declare const WORKFLOW_TOOL_NAME = "Workflow";
|
|
25
|
-
//# sourceMappingURL=tools.d.ts.map
|
package/dist/core/plugin.d.ts
CHANGED
package/dist/core/session.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export * from "./utils/tokenCalculation.js";
|
|
|
22
22
|
export * from "./utils/gitUtils.js";
|
|
23
23
|
export * from "./utils/nameGenerator.js";
|
|
24
24
|
export * from "./utils/worktreeSession.js";
|
|
25
|
+
export { loadMergedWaveConfig } from "./services/configurationService.js";
|
|
25
26
|
export * from "./types/index.js";
|
|
26
27
|
export * from "./tools/buildTool.js";
|
|
27
28
|
export type { ToolPlugin, ToolResult, ToolContext } from "./tools/types.js";
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./utils/tokenCalculation.js";
|
|
|
26
26
|
export * from "./utils/gitUtils.js";
|
|
27
27
|
export * from "./utils/nameGenerator.js";
|
|
28
28
|
export * from "./utils/worktreeSession.js";
|
|
29
|
+
export { loadMergedWaveConfig } from "./services/configurationService.js";
|
|
29
30
|
export * from "./types/index.js";
|
|
30
31
|
// Export tool building utilities
|
|
31
32
|
export * from "./tools/buildTool.js";
|
|
@@ -21,6 +21,7 @@ export interface AIManagerOptions {
|
|
|
21
21
|
export declare class AIManager {
|
|
22
22
|
private container;
|
|
23
23
|
isLoading: boolean;
|
|
24
|
+
private turnGeneration;
|
|
24
25
|
private abortController;
|
|
25
26
|
onLoadingChange?: (loading: boolean) => void;
|
|
26
27
|
private toolAbortController;
|
|
@@ -57,6 +58,7 @@ export declare class AIManager {
|
|
|
57
58
|
getMaxInputTokens(): number;
|
|
58
59
|
getLanguage(): string | undefined;
|
|
59
60
|
getAutoMemoryEnabled(): boolean;
|
|
61
|
+
getWorktreeBaseRef(): "fresh" | "head";
|
|
60
62
|
getWorkdir(): string;
|
|
61
63
|
getOriginalWorkdir(): string;
|
|
62
64
|
/**
|
|
@@ -139,4 +141,3 @@ export declare class AIManager {
|
|
|
139
141
|
*/
|
|
140
142
|
private executePostToolUseHooks;
|
|
141
143
|
}
|
|
142
|
-
//# sourceMappingURL=aiManager.d.ts.map
|
|
@@ -53,6 +53,7 @@ export class AIManager {
|
|
|
53
53
|
constructor(container, options) {
|
|
54
54
|
this.container = container;
|
|
55
55
|
this.isLoading = false;
|
|
56
|
+
this.turnGeneration = 0; // Guards against concurrent sendAIMessage turns
|
|
56
57
|
this.abortController = null;
|
|
57
58
|
this.toolAbortController = null;
|
|
58
59
|
this.consecutiveCompactionFailures = 0;
|
|
@@ -127,6 +128,9 @@ export class AIManager {
|
|
|
127
128
|
getAutoMemoryEnabled() {
|
|
128
129
|
return this.configurationService.resolveAutoMemoryEnabled();
|
|
129
130
|
}
|
|
131
|
+
getWorktreeBaseRef() {
|
|
132
|
+
return this.configurationService.resolveWorktreeBaseRef();
|
|
133
|
+
}
|
|
130
134
|
getWorkdir() {
|
|
131
135
|
return this.container.get("Workdir") ?? process.cwd();
|
|
132
136
|
}
|
|
@@ -241,6 +245,9 @@ export class AIManager {
|
|
|
241
245
|
options?.callbacks?.onLoadingChange?.(isLoading);
|
|
242
246
|
}
|
|
243
247
|
abortAIMessage() {
|
|
248
|
+
// Bump generation so the in-flight turn's end-of-turn setIsLoading(false)
|
|
249
|
+
// is skipped (generation mismatch), preventing it from racing with this abort.
|
|
250
|
+
this.turnGeneration++;
|
|
244
251
|
// Interrupt AI service
|
|
245
252
|
if (this.abortController) {
|
|
246
253
|
try {
|
|
@@ -560,6 +567,14 @@ export class AIManager {
|
|
|
560
567
|
async sendAIMessage(options = {}) {
|
|
561
568
|
const { recursionDepth = 0, model, allowedRules, maxTokens } = options;
|
|
562
569
|
let turnOffset = recursionDepth;
|
|
570
|
+
// Reserve this turn synchronously before any async work. Bumping the
|
|
571
|
+
// generation invalidates any in-flight turn's end-of-turn cleanup, and
|
|
572
|
+
// recording myGeneration lets us skip cleanup if a newer turn (or abort)
|
|
573
|
+
// has superseded us. setIsLoading(true) here also closes the "idle but
|
|
574
|
+
// previous turn not finished" race window by marking us busy immediately.
|
|
575
|
+
this.turnGeneration++;
|
|
576
|
+
const myGeneration = this.turnGeneration;
|
|
577
|
+
this.setIsLoading(true);
|
|
563
578
|
outer: while (true) {
|
|
564
579
|
let shouldRestart = false;
|
|
565
580
|
// OpenTelemetry: start interaction span for this turn (initial call only)
|
|
@@ -577,9 +592,8 @@ export class AIManager {
|
|
|
577
592
|
prompt_length: String(userPromptText.length),
|
|
578
593
|
}).catch(() => { }); // Non-blocking
|
|
579
594
|
}
|
|
580
|
-
//
|
|
595
|
+
// Apply allowed rules for the initial call
|
|
581
596
|
if (turnOffset === 0) {
|
|
582
|
-
this.setIsLoading(true);
|
|
583
597
|
if (allowedRules && allowedRules.length > 0) {
|
|
584
598
|
this.permissionManager?.addTemporaryRules(allowedRules);
|
|
585
599
|
}
|
|
@@ -976,8 +990,6 @@ export class AIManager {
|
|
|
976
990
|
endInteractionSpan();
|
|
977
991
|
// Save session in each iteration to ensure message persistence
|
|
978
992
|
await this.messageManager.saveSession();
|
|
979
|
-
// Set loading to false first
|
|
980
|
-
this.setIsLoading(false);
|
|
981
993
|
// Clear temporary rules
|
|
982
994
|
this.permissionManager?.clearTemporaryRules();
|
|
983
995
|
// Clear abort controllers
|
|
@@ -1058,11 +1070,11 @@ export class AIManager {
|
|
|
1058
1070
|
}
|
|
1059
1071
|
// Inject pending notifications from background tasks (after Stop hooks,
|
|
1060
1072
|
// aligned with Claude Code which fires Stop hooks unconditionally)
|
|
1061
|
-
const
|
|
1062
|
-
? this.container.get("
|
|
1073
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
1074
|
+
? this.container.get("MessageQueue")
|
|
1063
1075
|
: undefined;
|
|
1064
|
-
if (
|
|
1065
|
-
const notifications =
|
|
1076
|
+
if (messageQueue && messageQueue.hasNotifications()) {
|
|
1077
|
+
const notifications = messageQueue.drainNotifications();
|
|
1066
1078
|
for (const notification of notifications) {
|
|
1067
1079
|
const block = parseTaskNotificationXml(notification);
|
|
1068
1080
|
if (block) {
|
|
@@ -1080,8 +1092,16 @@ export class AIManager {
|
|
|
1080
1092
|
turnOffset = 0;
|
|
1081
1093
|
}
|
|
1082
1094
|
}
|
|
1083
|
-
if (!shouldRestart)
|
|
1095
|
+
if (!shouldRestart) {
|
|
1096
|
+
// Release loading state only after ALL cleanup is done (session save,
|
|
1097
|
+
// Stop hooks, notification injection). Generation check ensures a
|
|
1098
|
+
// superseded (aborted or newer) turn doesn't clobber the current
|
|
1099
|
+
// loading state.
|
|
1100
|
+
if (myGeneration === this.turnGeneration) {
|
|
1101
|
+
this.setIsLoading(false);
|
|
1102
|
+
}
|
|
1084
1103
|
break outer;
|
|
1104
|
+
}
|
|
1085
1105
|
}
|
|
1086
1106
|
}
|
|
1087
1107
|
/**
|
|
@@ -15,7 +15,6 @@ export declare class BackgroundTaskManager {
|
|
|
15
15
|
private callbacks;
|
|
16
16
|
private workdir;
|
|
17
17
|
constructor(container: Container, options: BackgroundTaskManagerOptions);
|
|
18
|
-
private get notificationQueue();
|
|
19
18
|
/**
|
|
20
19
|
* Fire the onBackgroundTasksChange callback so UI consumers refresh.
|
|
21
20
|
* Public so other managers (e.g. WorkflowManager) can trigger a refresh
|
|
@@ -43,4 +42,3 @@ export declare class BackgroundTaskManager {
|
|
|
43
42
|
stopTask(id: string): boolean;
|
|
44
43
|
cleanup(): void;
|
|
45
44
|
}
|
|
46
|
-
//# sourceMappingURL=backgroundTaskManager.d.ts.map
|
|
@@ -13,9 +13,6 @@ export class BackgroundTaskManager {
|
|
|
13
13
|
this.callbacks = options.callbacks || {};
|
|
14
14
|
this.workdir = options.workdir;
|
|
15
15
|
}
|
|
16
|
-
get notificationQueue() {
|
|
17
|
-
return this.container.get("NotificationQueue");
|
|
18
|
-
}
|
|
19
16
|
/**
|
|
20
17
|
* Fire the onBackgroundTasksChange callback so UI consumers refresh.
|
|
21
18
|
* Public so other managers (e.g. WorkflowManager) can trigger a refresh
|
|
@@ -141,13 +138,13 @@ export class BackgroundTaskManager {
|
|
|
141
138
|
this.notifyTasksChange();
|
|
142
139
|
// Skip notification if task was manually killed (user/agent-initiated stop)
|
|
143
140
|
if (!wasKilled) {
|
|
144
|
-
const
|
|
145
|
-
? this.container.get("
|
|
141
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
142
|
+
? this.container.get("MessageQueue")
|
|
146
143
|
: undefined;
|
|
147
|
-
if (
|
|
144
|
+
if (messageQueue) {
|
|
148
145
|
const statusStr = shell.status;
|
|
149
146
|
const summary = `Command "${command}" ${statusStr} with exit code ${code ?? 0}`;
|
|
150
|
-
|
|
147
|
+
messageQueue.enqueueNotification(`<task-notification>\n<task-id>${id}</task-id>\n<task-type>shell</task-type>\n<output-file>${logPath}</output-file>\n<status>${statusStr}</status>\n<summary>${summary}</summary>\n</task-notification>`);
|
|
151
148
|
}
|
|
152
149
|
}
|
|
153
150
|
};
|
|
@@ -167,12 +164,12 @@ export class BackgroundTaskManager {
|
|
|
167
164
|
shell.runtime = shell.endTime - startTime;
|
|
168
165
|
this.notifyTasksChange();
|
|
169
166
|
// Enqueue error notification
|
|
170
|
-
const
|
|
171
|
-
? this.container.get("
|
|
167
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
168
|
+
? this.container.get("MessageQueue")
|
|
172
169
|
: undefined;
|
|
173
|
-
if (
|
|
170
|
+
if (messageQueue) {
|
|
174
171
|
const summary = `Command "${command}" failed with error: ${stripAnsiColors(error.message)}`;
|
|
175
|
-
|
|
172
|
+
messageQueue.enqueueNotification(`<task-notification>\n<task-id>${id}</task-id>\n<task-type>shell</task-type>\n<output-file>${logPath}</output-file>\n<status>failed</status>\n<summary>${summary}</summary>\n</task-notification>`);
|
|
176
173
|
}
|
|
177
174
|
};
|
|
178
175
|
child.stdout?.on("data", onStdout);
|
|
@@ -278,13 +275,13 @@ export class BackgroundTaskManager {
|
|
|
278
275
|
this.notifyTasksChange();
|
|
279
276
|
// Skip notification if task was manually killed (user/agent-initiated stop)
|
|
280
277
|
if (!wasKilled) {
|
|
281
|
-
const
|
|
282
|
-
? this.container.get("
|
|
278
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
279
|
+
? this.container.get("MessageQueue")
|
|
283
280
|
: undefined;
|
|
284
|
-
if (
|
|
281
|
+
if (messageQueue) {
|
|
285
282
|
const statusStr = shell.status;
|
|
286
283
|
const summary = `Command "${command}" ${statusStr} with exit code ${code ?? 0}`;
|
|
287
|
-
|
|
284
|
+
messageQueue.enqueueNotification(`<task-notification>\n<task-id>${id}</task-id>\n<task-type>shell</task-type>\n<output-file>${logPath}</output-file>\n<status>${statusStr}</status>\n<summary>${summary}</summary>\n</task-notification>`);
|
|
288
285
|
}
|
|
289
286
|
}
|
|
290
287
|
});
|
|
@@ -301,12 +298,12 @@ export class BackgroundTaskManager {
|
|
|
301
298
|
shell.runtime = shell.endTime - startTime;
|
|
302
299
|
this.notifyTasksChange();
|
|
303
300
|
// Enqueue error notification
|
|
304
|
-
const
|
|
305
|
-
? this.container.get("
|
|
301
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
302
|
+
? this.container.get("MessageQueue")
|
|
306
303
|
: undefined;
|
|
307
|
-
if (
|
|
304
|
+
if (messageQueue) {
|
|
308
305
|
const summary = `Command "${command}" failed with error: ${stripAnsiColors(error.message)}`;
|
|
309
|
-
|
|
306
|
+
messageQueue.enqueueNotification(`<task-notification>\n<task-id>${id}</task-id>\n<task-type>shell</task-type>\n<output-file>${logPath}</output-file>\n<status>failed</status>\n<summary>${summary}</summary>\n</task-notification>`);
|
|
310
307
|
}
|
|
311
308
|
});
|
|
312
309
|
return id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type QueueState = "idle" | "dispatching" | "running";
|
|
2
2
|
export interface QueuedMessage {
|
|
3
3
|
id?: string;
|
|
4
|
-
type?: "message" | "bang";
|
|
4
|
+
type?: "message" | "bang" | "notification";
|
|
5
5
|
content: string;
|
|
6
6
|
images?: Array<{
|
|
7
7
|
path: string;
|
|
@@ -19,6 +19,10 @@ export declare class MessageQueue {
|
|
|
19
19
|
transitionTo(newState: QueueState): boolean;
|
|
20
20
|
enqueue(message: QueuedMessage): void;
|
|
21
21
|
dequeue(): QueuedMessage | null;
|
|
22
|
+
/**
|
|
23
|
+
* Clear user-facing items (messages, bang commands) but preserve pending
|
|
24
|
+
* notifications so background task results are not lost on abort.
|
|
25
|
+
*/
|
|
22
26
|
clear(): void;
|
|
23
27
|
hasPending(): boolean;
|
|
24
28
|
getQueue(): QueuedMessage[];
|
|
@@ -34,5 +38,16 @@ export declare class MessageQueue {
|
|
|
34
38
|
}): boolean;
|
|
35
39
|
popLastEditable(): QueuedMessage | null;
|
|
36
40
|
popAllEditable(): QueuedMessage[];
|
|
41
|
+
/**
|
|
42
|
+
* Enqueue a background task notification (XML string). Notifications are
|
|
43
|
+
* not user-editable and not surfaced in the queued-messages UI.
|
|
44
|
+
*/
|
|
45
|
+
enqueueNotification(xml: string): void;
|
|
46
|
+
/** Whether any notification items are pending. */
|
|
47
|
+
hasNotifications(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Drain all notification items, returning their XML content. Non-notification
|
|
50
|
+
* items (messages, bang commands) are preserved in the queue.
|
|
51
|
+
*/
|
|
52
|
+
drainNotifications(): string[];
|
|
37
53
|
}
|
|
38
|
-
//# sourceMappingURL=messageQueue.d.ts.map
|