wave-agent-sdk 0.19.5 → 0.19.7
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 +30 -14
- package/dist/agent.js +70 -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 +0 -1
- package/dist/managers/MemoryRuleManager.d.ts +0 -1
- package/dist/managers/aiManager.d.ts +15 -2
- package/dist/managers/aiManager.js +65 -11
- package/dist/managers/backgroundTaskManager.d.ts +1 -3
- package/dist/managers/backgroundTaskManager.js +20 -22
- package/dist/managers/bangManager.d.ts +0 -1
- package/dist/managers/bangManager.js +2 -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 +7 -1
- package/dist/managers/messageManager.js +64 -5
- package/dist/managers/messageQueue.d.ts +25 -2
- package/dist/managers/messageQueue.js +53 -1
- package/dist/managers/permissionManager.d.ts +0 -1
- package/dist/managers/permissionManager.js +3 -3
- 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 +15 -14
- 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 +3 -2
- package/dist/prompts/index.js +2 -4
- 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 +0 -1
- package/dist/services/fileWatcher.d.ts +0 -1
- package/dist/services/hook.d.ts +0 -1
- package/dist/services/hook.js +6 -0
- 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/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/bashTool.js +7 -5
- 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 +3 -8
- package/dist/tools/exitPlanMode.d.ts +0 -1
- package/dist/tools/exitWorktreeTool.d.ts +0 -1
- package/dist/tools/exitWorktreeTool.js +5 -8
- 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 +0 -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 +2 -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 +2 -1
- package/dist/types/permissions.d.ts +0 -1
- package/dist/types/plugins.d.ts +0 -1
- package/dist/types/processes.d.ts +0 -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 +0 -1
- 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 +3 -3
- 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/shellResolver.js +156 -7
- 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 +6 -7
- package/dist/utils/worktreeSession.js +7 -11
- package/dist/utils/worktreeUtils.d.ts +0 -1
- 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 +0 -1
- package/dist/workflow/workflowApis.d.ts +0 -1
- package/package.json +1 -1
- package/src/agent.ts +80 -67
- package/src/managers/aiManager.ts +79 -12
- package/src/managers/backgroundTaskManager.ts +21 -23
- package/src/managers/bangManager.ts +2 -1
- package/src/managers/messageManager.ts +72 -6
- package/src/managers/messageQueue.ts +60 -2
- package/src/managers/permissionManager.ts +6 -3
- package/src/managers/subagentManager.ts +22 -16
- package/src/managers/workflowManager.ts +5 -5
- package/src/prompts/index.ts +4 -4
- package/src/services/hook.ts +9 -0
- package/src/services/interactionService.ts +11 -0
- package/src/services/taskManager.ts +8 -1
- package/src/tools/bashTool.ts +11 -5
- package/src/tools/enterWorktreeTool.ts +4 -14
- package/src/tools/exitWorktreeTool.ts +5 -13
- package/src/types/hooks.ts +2 -0
- package/src/types/messaging.ts +2 -0
- package/src/utils/containerSetup.ts +3 -3
- package/src/utils/shellResolver.ts +167 -8
- package/src/utils/worktreeSession.ts +6 -16
- 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
|
@@ -4,6 +4,7 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { stripAnsiColors } from "../utils/stringUtils.js";
|
|
6
6
|
import { logger } from "../utils/globalLogger.js";
|
|
7
|
+
import { resolveShellPath } from "../utils/shellResolver.js";
|
|
7
8
|
export class BackgroundTaskManager {
|
|
8
9
|
constructor(container, options) {
|
|
9
10
|
this.container = container;
|
|
@@ -12,9 +13,6 @@ export class BackgroundTaskManager {
|
|
|
12
13
|
this.callbacks = options.callbacks || {};
|
|
13
14
|
this.workdir = options.workdir;
|
|
14
15
|
}
|
|
15
|
-
get notificationQueue() {
|
|
16
|
-
return this.container.get("NotificationQueue");
|
|
17
|
-
}
|
|
18
16
|
/**
|
|
19
17
|
* Fire the onBackgroundTasksChange callback so UI consumers refresh.
|
|
20
18
|
* Public so other managers (e.g. WorkflowManager) can trigger a refresh
|
|
@@ -36,14 +34,14 @@ export class BackgroundTaskManager {
|
|
|
36
34
|
getAllTasks() {
|
|
37
35
|
return Array.from(this.tasks.values());
|
|
38
36
|
}
|
|
39
|
-
startShell(command, timeout) {
|
|
37
|
+
startShell(command, timeout, cwd) {
|
|
40
38
|
const id = this.generateId();
|
|
41
39
|
const startTime = Date.now();
|
|
42
40
|
const child = spawn(command, {
|
|
43
|
-
shell: true,
|
|
41
|
+
shell: resolveShellPath() ?? true,
|
|
44
42
|
stdio: "pipe",
|
|
45
43
|
detached: true,
|
|
46
|
-
cwd: this.workdir,
|
|
44
|
+
cwd: cwd ?? this.workdir,
|
|
47
45
|
env: {
|
|
48
46
|
...process.env,
|
|
49
47
|
},
|
|
@@ -140,13 +138,13 @@ export class BackgroundTaskManager {
|
|
|
140
138
|
this.notifyTasksChange();
|
|
141
139
|
// Skip notification if task was manually killed (user/agent-initiated stop)
|
|
142
140
|
if (!wasKilled) {
|
|
143
|
-
const
|
|
144
|
-
? this.container.get("
|
|
141
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
142
|
+
? this.container.get("MessageQueue")
|
|
145
143
|
: undefined;
|
|
146
|
-
if (
|
|
144
|
+
if (messageQueue) {
|
|
147
145
|
const statusStr = shell.status;
|
|
148
146
|
const summary = `Command "${command}" ${statusStr} with exit code ${code ?? 0}`;
|
|
149
|
-
|
|
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>`);
|
|
150
148
|
}
|
|
151
149
|
}
|
|
152
150
|
};
|
|
@@ -166,12 +164,12 @@ export class BackgroundTaskManager {
|
|
|
166
164
|
shell.runtime = shell.endTime - startTime;
|
|
167
165
|
this.notifyTasksChange();
|
|
168
166
|
// Enqueue error notification
|
|
169
|
-
const
|
|
170
|
-
? this.container.get("
|
|
167
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
168
|
+
? this.container.get("MessageQueue")
|
|
171
169
|
: undefined;
|
|
172
|
-
if (
|
|
170
|
+
if (messageQueue) {
|
|
173
171
|
const summary = `Command "${command}" failed with error: ${stripAnsiColors(error.message)}`;
|
|
174
|
-
|
|
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>`);
|
|
175
173
|
}
|
|
176
174
|
};
|
|
177
175
|
child.stdout?.on("data", onStdout);
|
|
@@ -277,13 +275,13 @@ export class BackgroundTaskManager {
|
|
|
277
275
|
this.notifyTasksChange();
|
|
278
276
|
// Skip notification if task was manually killed (user/agent-initiated stop)
|
|
279
277
|
if (!wasKilled) {
|
|
280
|
-
const
|
|
281
|
-
? this.container.get("
|
|
278
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
279
|
+
? this.container.get("MessageQueue")
|
|
282
280
|
: undefined;
|
|
283
|
-
if (
|
|
281
|
+
if (messageQueue) {
|
|
284
282
|
const statusStr = shell.status;
|
|
285
283
|
const summary = `Command "${command}" ${statusStr} with exit code ${code ?? 0}`;
|
|
286
|
-
|
|
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>`);
|
|
287
285
|
}
|
|
288
286
|
}
|
|
289
287
|
});
|
|
@@ -300,12 +298,12 @@ export class BackgroundTaskManager {
|
|
|
300
298
|
shell.runtime = shell.endTime - startTime;
|
|
301
299
|
this.notifyTasksChange();
|
|
302
300
|
// Enqueue error notification
|
|
303
|
-
const
|
|
304
|
-
? this.container.get("
|
|
301
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
302
|
+
? this.container.get("MessageQueue")
|
|
305
303
|
: undefined;
|
|
306
|
-
if (
|
|
304
|
+
if (messageQueue) {
|
|
307
305
|
const summary = `Command "${command}" failed with error: ${stripAnsiColors(error.message)}`;
|
|
308
|
-
|
|
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>`);
|
|
309
307
|
}
|
|
310
308
|
});
|
|
311
309
|
return id;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn } from "child_process";
|
|
2
|
+
import { resolveShellPath } from "../utils/shellResolver.js";
|
|
2
3
|
export class BangManager {
|
|
3
4
|
constructor(container, options) {
|
|
4
5
|
this.container = container;
|
|
@@ -22,7 +23,7 @@ export class BangManager {
|
|
|
22
23
|
this.messageManager.addBangMessage(command);
|
|
23
24
|
return new Promise((resolve) => {
|
|
24
25
|
const child = spawn(command, {
|
|
25
|
-
shell: true,
|
|
26
|
+
shell: resolveShellPath() ?? true,
|
|
26
27
|
stdio: "pipe",
|
|
27
28
|
cwd: this.workdir,
|
|
28
29
|
env: {
|
|
@@ -190,6 +190,13 @@ export declare class MessageManager {
|
|
|
190
190
|
* Fires incremental callbacks for each finalized block.
|
|
191
191
|
*/
|
|
192
192
|
finalizeStreamingBlocks(): void;
|
|
193
|
+
/**
|
|
194
|
+
* Finalize any tool blocks still in a non-terminal stage (start/streaming/running)
|
|
195
|
+
* by marking them as ended with an error. Called when the AI call is aborted or
|
|
196
|
+
* fails mid-tool-stream so the UI stops showing the "running" spinner.
|
|
197
|
+
* Fires onToolBlockUpdated for each finalized tool block.
|
|
198
|
+
*/
|
|
199
|
+
finalizeAbortedToolBlocks(error?: string): void;
|
|
193
200
|
/**
|
|
194
201
|
* Remove the last user message from the conversation
|
|
195
202
|
* Used for hook error handling when the user prompt needs to be erased
|
|
@@ -247,4 +254,3 @@ export declare class MessageManager {
|
|
|
247
254
|
*/
|
|
248
255
|
rebuildLoadedRuleIds(): void;
|
|
249
256
|
}
|
|
250
|
-
//# sourceMappingURL=messageManager.d.ts.map
|
|
@@ -477,11 +477,22 @@ export class MessageManager {
|
|
|
477
477
|
if (index < 0)
|
|
478
478
|
return false;
|
|
479
479
|
const block = lastMessage.blocks[index];
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
480
|
+
if (block.type === "reasoning") {
|
|
481
|
+
lastMessage.blocks[index] = {
|
|
482
|
+
type: "reasoning",
|
|
483
|
+
content: block.content,
|
|
484
|
+
stage: "end",
|
|
485
|
+
startTime: block.startTime,
|
|
486
|
+
endTime: Date.now(),
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
lastMessage.blocks[index] = {
|
|
491
|
+
type: block.type,
|
|
492
|
+
content: block.content,
|
|
493
|
+
stage: "end",
|
|
494
|
+
};
|
|
495
|
+
}
|
|
485
496
|
// Fire incremental callback to signal finalization
|
|
486
497
|
const callbackParams = {
|
|
487
498
|
messageId: lastMessage.id,
|
|
@@ -564,10 +575,12 @@ export class MessageManager {
|
|
|
564
575
|
const chunk = newAccumulatedReasoning.slice(currentReasoning.length);
|
|
565
576
|
if (reasoningBlockIndex >= 0) {
|
|
566
577
|
// Update existing reasoning block
|
|
578
|
+
const existingStartTime = lastMessage.blocks[reasoningBlockIndex].startTime;
|
|
567
579
|
lastMessage.blocks[reasoningBlockIndex] = {
|
|
568
580
|
type: "reasoning",
|
|
569
581
|
content: newAccumulatedReasoning,
|
|
570
582
|
stage: "streaming",
|
|
583
|
+
startTime: existingStartTime,
|
|
571
584
|
};
|
|
572
585
|
}
|
|
573
586
|
else {
|
|
@@ -576,6 +589,7 @@ export class MessageManager {
|
|
|
576
589
|
type: "reasoning",
|
|
577
590
|
content: newAccumulatedReasoning,
|
|
578
591
|
stage: "streaming",
|
|
592
|
+
startTime: Date.now(),
|
|
579
593
|
});
|
|
580
594
|
}
|
|
581
595
|
// Trigger callbacks with chunk and accumulated reasoning content
|
|
@@ -604,6 +618,51 @@ export class MessageManager {
|
|
|
604
618
|
this.callbacks.onMessagesChange?.([...this.messages]);
|
|
605
619
|
}
|
|
606
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Finalize any tool blocks still in a non-terminal stage (start/streaming/running)
|
|
623
|
+
* by marking them as ended with an error. Called when the AI call is aborted or
|
|
624
|
+
* fails mid-tool-stream so the UI stops showing the "running" spinner.
|
|
625
|
+
* Fires onToolBlockUpdated for each finalized tool block.
|
|
626
|
+
*/
|
|
627
|
+
finalizeAbortedToolBlocks(error) {
|
|
628
|
+
if (this.messages.length === 0)
|
|
629
|
+
return;
|
|
630
|
+
const lastMessage = this.messages[this.messages.length - 1];
|
|
631
|
+
if (lastMessage.role !== "assistant")
|
|
632
|
+
return;
|
|
633
|
+
const errorMessage = error ?? "Tool execution was aborted";
|
|
634
|
+
let finalized = false;
|
|
635
|
+
for (let i = 0; i < lastMessage.blocks.length; i++) {
|
|
636
|
+
const block = lastMessage.blocks[i];
|
|
637
|
+
if (block.type !== "tool" || block.stage === "end")
|
|
638
|
+
continue;
|
|
639
|
+
const timestamp = Date.now();
|
|
640
|
+
lastMessage.blocks[i] = {
|
|
641
|
+
...block,
|
|
642
|
+
stage: "end",
|
|
643
|
+
success: false,
|
|
644
|
+
error: errorMessage,
|
|
645
|
+
timestamp,
|
|
646
|
+
};
|
|
647
|
+
finalized = true;
|
|
648
|
+
this.callbacks.onToolBlockUpdated?.({
|
|
649
|
+
id: block.id ?? "",
|
|
650
|
+
messageId: lastMessage.id ?? "",
|
|
651
|
+
name: block.name,
|
|
652
|
+
parameters: block.parameters,
|
|
653
|
+
parametersChunk: block.parametersChunk,
|
|
654
|
+
compactParams: block.compactParams,
|
|
655
|
+
stage: "end",
|
|
656
|
+
success: false,
|
|
657
|
+
error: errorMessage,
|
|
658
|
+
isManuallyBackgrounded: block.isManuallyBackgrounded,
|
|
659
|
+
timestamp,
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
if (finalized) {
|
|
663
|
+
this.setMessages([...this.messages]);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
607
666
|
/**
|
|
608
667
|
* Remove the last user message from the conversation
|
|
609
668
|
* Used for hook error handling when the user prompt needs to be erased
|
|
@@ -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,12 +19,35 @@ 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[];
|
|
25
29
|
removeAt(index: number): boolean;
|
|
26
30
|
removeById(id: string): boolean;
|
|
31
|
+
updateById(id: string, patch: {
|
|
32
|
+
content?: string;
|
|
33
|
+
images?: Array<{
|
|
34
|
+
path: string;
|
|
35
|
+
mimeType: string;
|
|
36
|
+
}>;
|
|
37
|
+
type?: "message" | "bang";
|
|
38
|
+
}): boolean;
|
|
27
39
|
popLastEditable(): QueuedMessage | null;
|
|
28
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[];
|
|
29
53
|
}
|
|
30
|
-
//# sourceMappingURL=messageQueue.d.ts.map
|
|
@@ -30,8 +30,12 @@ export class MessageQueue {
|
|
|
30
30
|
dequeue() {
|
|
31
31
|
return this.queue.shift() ?? null;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Clear user-facing items (messages, bang commands) but preserve pending
|
|
35
|
+
* notifications so background task results are not lost on abort.
|
|
36
|
+
*/
|
|
33
37
|
clear() {
|
|
34
|
-
this.queue =
|
|
38
|
+
this.queue = this.queue.filter((m) => m.type === "notification");
|
|
35
39
|
this._state = "idle";
|
|
36
40
|
}
|
|
37
41
|
hasPending() {
|
|
@@ -56,6 +60,19 @@ export class MessageQueue {
|
|
|
56
60
|
this.onMessageEnqueued?.();
|
|
57
61
|
return true;
|
|
58
62
|
}
|
|
63
|
+
updateById(id, patch) {
|
|
64
|
+
const m = this.queue.find((x) => x.id === id);
|
|
65
|
+
if (!m)
|
|
66
|
+
return false;
|
|
67
|
+
if (patch.content !== undefined)
|
|
68
|
+
m.content = patch.content;
|
|
69
|
+
if (patch.images !== undefined)
|
|
70
|
+
m.images = patch.images;
|
|
71
|
+
if (patch.type !== undefined)
|
|
72
|
+
m.type = patch.type;
|
|
73
|
+
this.onMessageEnqueued?.();
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
59
76
|
popLastEditable() {
|
|
60
77
|
for (let i = this.queue.length - 1; i >= 0; i--) {
|
|
61
78
|
if (this.queue[i].editable !== false) {
|
|
@@ -78,4 +95,39 @@ export class MessageQueue {
|
|
|
78
95
|
this.queue = remaining;
|
|
79
96
|
return editable;
|
|
80
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Enqueue a background task notification (XML string). Notifications are
|
|
100
|
+
* not user-editable and not surfaced in the queued-messages UI.
|
|
101
|
+
*/
|
|
102
|
+
enqueueNotification(xml) {
|
|
103
|
+
this.queue.push({
|
|
104
|
+
id: `mq-${this.nextId++}`,
|
|
105
|
+
type: "notification",
|
|
106
|
+
content: xml,
|
|
107
|
+
editable: false,
|
|
108
|
+
});
|
|
109
|
+
this.onMessageEnqueued?.();
|
|
110
|
+
}
|
|
111
|
+
/** Whether any notification items are pending. */
|
|
112
|
+
hasNotifications() {
|
|
113
|
+
return this.queue.some((m) => m.type === "notification");
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Drain all notification items, returning their XML content. Non-notification
|
|
117
|
+
* items (messages, bang commands) are preserved in the queue.
|
|
118
|
+
*/
|
|
119
|
+
drainNotifications() {
|
|
120
|
+
const notifications = [];
|
|
121
|
+
const remaining = [];
|
|
122
|
+
for (const msg of this.queue) {
|
|
123
|
+
if (msg.type === "notification") {
|
|
124
|
+
notifications.push(msg.content);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
remaining.push(msg);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.queue = remaining;
|
|
131
|
+
return notifications;
|
|
132
|
+
}
|
|
81
133
|
}
|
|
@@ -11,7 +11,6 @@ import { RESTRICTED_TOOLS } from "../types/permissions.js";
|
|
|
11
11
|
import { splitBashCommand, stripEnvVars, stripRedirections, hasWriteRedirections, getSmartPrefix, isDangerousFind, DANGEROUS_COMMANDS, } from "../utils/bashParser.js";
|
|
12
12
|
import { isPathInside } from "../utils/pathSafety.js";
|
|
13
13
|
import { BASH_TOOL_NAME, EDIT_TOOL_NAME, WRITE_TOOL_NAME, READ_TOOL_NAME, ASK_USER_QUESTION_TOOL_NAME, } from "../constants/tools.js";
|
|
14
|
-
import { getCurrentWorktreeSession } from "../utils/worktreeSession.js";
|
|
15
14
|
const SAFE_COMMANDS = [
|
|
16
15
|
"cd",
|
|
17
16
|
"ls",
|
|
@@ -337,8 +336,9 @@ export class PermissionManager {
|
|
|
337
336
|
}
|
|
338
337
|
}
|
|
339
338
|
// 1.0 Check worktree safety for Write and Edit tools
|
|
340
|
-
// Support both CLI -w sessions (container-registered) and EnterWorktree mid-session
|
|
341
|
-
|
|
339
|
+
// Support both CLI -w sessions (container-registered) and EnterWorktree mid-session
|
|
340
|
+
// (per-agent WorktreeSession stored in this session's container)
|
|
341
|
+
const worktreeSession = this.container.get("WorktreeSession");
|
|
342
342
|
const effectiveWorktreeName = this.worktreeName || worktreeSession?.worktreeName;
|
|
343
343
|
const effectiveWorkdir = this.workdir || worktreeSession?.worktreePath;
|
|
344
344
|
const effectiveMainRepoRoot = this.mainRepoRoot || worktreeSession?.repoRoot;
|
|
@@ -5,7 +5,6 @@ import { AIManager } from "./aiManager.js";
|
|
|
5
5
|
import { MessageManager } from "./messageManager.js";
|
|
6
6
|
import { ToolManager } from "./toolManager.js";
|
|
7
7
|
import { BackgroundTaskManager } from "./backgroundTaskManager.js";
|
|
8
|
-
import { NotificationQueue } from "./notificationQueue.js";
|
|
9
8
|
import { UserMessageParams, type ToolBlockUpdateCallbackParams } from "../utils/messageOperations.js";
|
|
10
9
|
import { Container } from "../utils/container.js";
|
|
11
10
|
import type { PermissionManager } from "./permissionManager.js";
|
|
@@ -46,7 +45,6 @@ export interface SubagentInstance {
|
|
|
46
45
|
toolManager: ToolManager;
|
|
47
46
|
permissionManager: PermissionManager;
|
|
48
47
|
backgroundTaskManager: BackgroundTaskManager;
|
|
49
|
-
notificationQueue: NotificationQueue;
|
|
50
48
|
status: "initializing" | "active" | "completed" | "error" | "aborted";
|
|
51
49
|
messages: Message[];
|
|
52
50
|
usedTools: {
|
|
@@ -156,4 +154,3 @@ export declare class SubagentManager {
|
|
|
156
154
|
*/
|
|
157
155
|
private createSubagentCallbacks;
|
|
158
156
|
}
|
|
159
|
-
//# sourceMappingURL=subagentManager.d.ts.map
|
|
@@ -5,10 +5,9 @@ import * as path from "path";
|
|
|
5
5
|
import { AIManager } from "./aiManager.js";
|
|
6
6
|
import { MessageManager } from "./messageManager.js";
|
|
7
7
|
import { ToolManager } from "./toolManager.js";
|
|
8
|
-
import { AGENT_TOOL_NAME } from "../constants/tools.js";
|
|
8
|
+
import { AGENT_TOOL_NAME, TASK_CREATE_TOOL_NAME, TASK_GET_TOOL_NAME, TASK_LIST_TOOL_NAME, TASK_UPDATE_TOOL_NAME, } from "../constants/tools.js";
|
|
9
9
|
import { addConsolidatedAbortListener, createAbortPromise, } from "../utils/abortUtils.js";
|
|
10
10
|
import { BackgroundTaskManager } from "./backgroundTaskManager.js";
|
|
11
|
-
import { NotificationQueue } from "./notificationQueue.js";
|
|
12
11
|
import { logger } from "../utils/globalLogger.js";
|
|
13
12
|
export class SubagentManager {
|
|
14
13
|
constructor(container, options) {
|
|
@@ -165,6 +164,12 @@ export class SubagentManager {
|
|
|
165
164
|
instanceDeniedRules: [
|
|
166
165
|
...(parentPermissionManager?.getInstanceDeniedRules?.() || []),
|
|
167
166
|
AGENT_TOOL_NAME, // Always deny Agent tool in subagents to prevent recursion
|
|
167
|
+
// Deny Task tools in subagents — they share the parent's TaskManager
|
|
168
|
+
// and could mutate the main agent's task list
|
|
169
|
+
TASK_CREATE_TOOL_NAME,
|
|
170
|
+
TASK_GET_TOOL_NAME,
|
|
171
|
+
TASK_UPDATE_TOOL_NAME,
|
|
172
|
+
TASK_LIST_TOOL_NAME,
|
|
168
173
|
],
|
|
169
174
|
additionalDirectories: parentPermissionManager?.getAdditionalDirectories(),
|
|
170
175
|
systemAdditionalDirectories: parentPermissionManager?.getSystemAdditionalDirectories(),
|
|
@@ -210,9 +215,6 @@ export class SubagentManager {
|
|
|
210
215
|
},
|
|
211
216
|
});
|
|
212
217
|
subagentContainer.register("AIManager", aiManager);
|
|
213
|
-
// Create isolated NotificationQueue for the subagent/forked agent
|
|
214
|
-
const subagentNotificationQueue = new NotificationQueue();
|
|
215
|
-
subagentContainer.register("NotificationQueue", subagentNotificationQueue);
|
|
216
218
|
// Create isolated BackgroundTaskManager for the subagent/forked agent
|
|
217
219
|
const subagentBackgroundTaskManager = new BackgroundTaskManager(subagentContainer, {
|
|
218
220
|
workdir: this.workdir,
|
|
@@ -226,7 +228,6 @@ export class SubagentManager {
|
|
|
226
228
|
toolManager,
|
|
227
229
|
permissionManager: subagentPermissionManager,
|
|
228
230
|
backgroundTaskManager: subagentBackgroundTaskManager,
|
|
229
|
-
notificationQueue: subagentNotificationQueue,
|
|
230
231
|
status: "initializing",
|
|
231
232
|
messages: [],
|
|
232
233
|
usedTools: [], // Initialize usedTools
|
|
@@ -420,12 +421,12 @@ export class SubagentManager {
|
|
|
420
421
|
}
|
|
421
422
|
// Skip notification if task was already stopped (e.g. by main agent shutdown)
|
|
422
423
|
if (!wasAlreadyKilled) {
|
|
423
|
-
const
|
|
424
|
-
? this.container.get("
|
|
424
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
425
|
+
? this.container.get("MessageQueue")
|
|
425
426
|
: undefined;
|
|
426
|
-
if (
|
|
427
|
+
if (messageQueue) {
|
|
427
428
|
const summary = `Agent task "${instance.description}" completed`;
|
|
428
|
-
|
|
429
|
+
messageQueue.enqueueNotification(`<task-notification>\n<task-id>${instance.backgroundTaskId}</task-id>\n<task-type>agent</task-type>\n<status>completed</status>\n<summary>${summary}</summary>\n</task-notification>`);
|
|
429
430
|
}
|
|
430
431
|
}
|
|
431
432
|
}
|
|
@@ -452,13 +453,13 @@ export class SubagentManager {
|
|
|
452
453
|
}
|
|
453
454
|
// Skip notification if task was already stopped (e.g. by main agent shutdown)
|
|
454
455
|
if (!wasAlreadyKilled) {
|
|
455
|
-
const
|
|
456
|
-
? this.container.get("
|
|
456
|
+
const messageQueue = this.container.has("MessageQueue")
|
|
457
|
+
? this.container.get("MessageQueue")
|
|
457
458
|
: undefined;
|
|
458
|
-
if (
|
|
459
|
+
if (messageQueue) {
|
|
459
460
|
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
460
461
|
const summary = `Agent task "${instance.description}" failed: ${errorMsg}`;
|
|
461
|
-
|
|
462
|
+
messageQueue.enqueueNotification(`<task-notification>\n<task-id>${instance.backgroundTaskId}</task-id>\n<task-type>agent</task-type>\n<status>failed</status>\n<summary>${summary}</summary>\n</task-notification>`);
|
|
462
463
|
}
|
|
463
464
|
}
|
|
464
465
|
}
|
|
@@ -9,7 +9,7 @@ export declare class WorkflowManager {
|
|
|
9
9
|
constructor(container: Container);
|
|
10
10
|
private get stateStore();
|
|
11
11
|
private get backgroundTaskManager();
|
|
12
|
-
private get
|
|
12
|
+
private get messageQueue();
|
|
13
13
|
private get subagentManager();
|
|
14
14
|
private get workdir();
|
|
15
15
|
private get sessionDir();
|
|
@@ -62,4 +62,3 @@ export declare class WorkflowManager {
|
|
|
62
62
|
*/
|
|
63
63
|
cleanup(): void;
|
|
64
64
|
}
|
|
65
|
-
//# sourceMappingURL=workflowManager.d.ts.map
|
|
@@ -30,8 +30,8 @@ export class WorkflowManager {
|
|
|
30
30
|
get backgroundTaskManager() {
|
|
31
31
|
return this.container.get("BackgroundTaskManager");
|
|
32
32
|
}
|
|
33
|
-
get
|
|
34
|
-
return this.container.get("
|
|
33
|
+
get messageQueue() {
|
|
34
|
+
return this.container.get("MessageQueue");
|
|
35
35
|
}
|
|
36
36
|
get subagentManager() {
|
|
37
37
|
return this.container.get("SubagentManager");
|
|
@@ -209,7 +209,7 @@ export class WorkflowManager {
|
|
|
209
209
|
}
|
|
210
210
|
// Enqueue completion notification
|
|
211
211
|
const journalPath = journal.filePath;
|
|
212
|
-
this.
|
|
212
|
+
this.messageQueue.enqueueNotification(taskNotificationToXml({
|
|
213
213
|
type: "task_notification",
|
|
214
214
|
taskId: runId,
|
|
215
215
|
taskType: "workflow",
|
|
@@ -244,7 +244,7 @@ export class WorkflowManager {
|
|
|
244
244
|
task.stderr = run.error || "";
|
|
245
245
|
task.endTime = Date.now();
|
|
246
246
|
}
|
|
247
|
-
this.
|
|
247
|
+
this.messageQueue.enqueueNotification(taskNotificationToXml({
|
|
248
248
|
type: "task_notification",
|
|
249
249
|
taskId: runId,
|
|
250
250
|
taskType: "workflow",
|