@within-7/minto 0.4.1 → 0.4.2
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/Tool.js +7 -0
- package/dist/Tool.js.map +2 -2
- package/dist/commands/agents/AgentsCommand.js +1 -1
- package/dist/commands/agents/AgentsCommand.js.map +2 -2
- package/dist/commands/agents/constants.js +2 -2
- package/dist/commands/agents/constants.js.map +2 -2
- package/dist/commands/clear.js +4 -3
- package/dist/commands/clear.js.map +2 -2
- package/dist/commands/compact.js +2 -2
- package/dist/commands/compact.js.map +1 -1
- package/dist/commands/context.js +3 -1
- package/dist/commands/context.js.map +2 -2
- package/dist/commands/login.js +128 -0
- package/dist/commands/login.js.map +7 -0
- package/dist/commands/memory.js +33 -82
- package/dist/commands/memory.js.map +2 -2
- package/dist/commands/quit.js +3 -1
- package/dist/commands/quit.js.map +2 -2
- package/dist/commands/resume.js +39 -239
- package/dist/commands/resume.js.map +2 -2
- package/dist/commands/tasks.js +1 -1
- package/dist/commands/tasks.js.map +2 -2
- package/dist/commands/terminalSetup.js +6 -2
- package/dist/commands/terminalSetup.js.map +2 -2
- package/dist/commands.js +2 -0
- package/dist/commands.js.map +2 -2
- package/dist/components/AgentDetailView.js +126 -0
- package/dist/components/AgentDetailView.js.map +7 -0
- package/dist/components/AgentThinkingBlock.js +1 -1
- package/dist/components/AgentThinkingBlock.js.map +2 -2
- package/dist/components/AgentViewBanner.js +22 -0
- package/dist/components/AgentViewBanner.js.map +7 -0
- package/dist/components/HeaderBar.js +1 -1
- package/dist/components/HeaderBar.js.map +2 -2
- package/dist/components/Help.js +8 -1
- package/dist/components/Help.js.map +2 -2
- package/dist/components/HotkeyHelpPanel.js +26 -8
- package/dist/components/HotkeyHelpPanel.js.map +2 -2
- package/dist/components/IdleNotificationBar.js +10 -0
- package/dist/components/IdleNotificationBar.js.map +7 -0
- package/dist/components/ModelSelector/ModelSelector.js +55 -20
- package/dist/components/ModelSelector/ModelSelector.js.map +2 -2
- package/dist/components/PromptInput.js +186 -115
- package/dist/components/PromptInput.js.map +2 -2
- package/dist/components/RewindPanel.js +272 -0
- package/dist/components/RewindPanel.js.map +7 -0
- package/dist/components/Spinner.js +10 -21
- package/dist/components/Spinner.js.map +2 -2
- package/dist/components/StreamingTextPreview.js +29 -0
- package/dist/components/StreamingTextPreview.js.map +7 -0
- package/dist/components/SubagentBlock.js +3 -2
- package/dist/components/SubagentBlock.js.map +2 -2
- package/dist/components/SubagentProgress.js +4 -4
- package/dist/components/SubagentProgress.js.map +2 -2
- package/dist/components/TabbedListView/SearchInput.js +1 -1
- package/dist/components/TabbedListView/SearchInput.js.map +2 -2
- package/dist/components/TabbedListView/TabbedListView.js +87 -41
- package/dist/components/TabbedListView/TabbedListView.js.map +2 -2
- package/dist/components/TaskCard.js +4 -4
- package/dist/components/TaskCard.js.map +2 -2
- package/dist/components/TeamMemberPanel.js +107 -0
- package/dist/components/TeamMemberPanel.js.map +7 -0
- package/dist/components/ThinkingSelector.js +84 -0
- package/dist/components/ThinkingSelector.js.map +7 -0
- package/dist/components/TitledDivider.js +26 -0
- package/dist/components/TitledDivider.js.map +7 -0
- package/dist/components/TodoPanel.js +31 -30
- package/dist/components/TodoPanel.js.map +2 -2
- package/dist/components/TokenWarning.js +28 -7
- package/dist/components/TokenWarning.js.map +2 -2
- package/dist/components/messages/AssistantTextMessage.js +5 -2
- package/dist/components/messages/AssistantTextMessage.js.map +2 -2
- package/dist/components/messages/AssistantToolUseMessage.js +9 -1
- package/dist/components/messages/AssistantToolUseMessage.js.map +2 -2
- package/dist/components/messages/DefaultToolResultFallback.js +11 -0
- package/dist/components/messages/DefaultToolResultFallback.js.map +7 -0
- package/dist/components/messages/ParallelTasksGroupView.js +14 -6
- package/dist/components/messages/ParallelTasksGroupView.js.map +2 -2
- package/dist/components/messages/TaskInModuleView.js +27 -27
- package/dist/components/messages/TaskInModuleView.js.map +2 -2
- package/dist/components/messages/UserGuidanceMessage.js +26 -0
- package/dist/components/messages/UserGuidanceMessage.js.map +7 -0
- package/dist/components/messages/UserPromptMessage.js +2 -1
- package/dist/components/messages/UserPromptMessage.js.map +2 -2
- package/dist/components/messages/UserTeamNotificationMessage.js +91 -0
- package/dist/components/messages/UserTeamNotificationMessage.js.map +7 -0
- package/dist/components/messages/UserTextMessage.js +8 -0
- package/dist/components/messages/UserTextMessage.js.map +2 -2
- package/dist/components/messages/UserToolResultMessage/UserToolRejectMessage.js +4 -2
- package/dist/components/messages/UserToolResultMessage/UserToolRejectMessage.js.map +2 -2
- package/dist/components/messages/UserToolResultMessage/UserToolResultMessage.js +18 -1
- package/dist/components/messages/UserToolResultMessage/UserToolResultMessage.js.map +2 -2
- package/dist/components/messages/UserToolResultMessage/UserToolSuccessMessage.js +12 -1
- package/dist/components/messages/UserToolResultMessage/UserToolSuccessMessage.js.map +2 -2
- package/dist/components/permissions/PermissionRequest.js +4 -0
- package/dist/components/permissions/PermissionRequest.js.map +2 -2
- package/dist/components/permissions/PlanApprovalRequest.js +164 -0
- package/dist/components/permissions/PlanApprovalRequest.js.map +7 -0
- package/dist/constants/agentTeams.js +17 -0
- package/dist/constants/agentTeams.js.map +7 -0
- package/dist/constants/macros.js +2 -1
- package/dist/constants/macros.js.map +2 -2
- package/dist/constants/prompts/agentPrompt.js +1 -0
- package/dist/constants/prompts/agentPrompt.js.map +2 -2
- package/dist/constants/prompts/autoMemory.js +39 -0
- package/dist/constants/prompts/autoMemory.js.map +7 -0
- package/dist/constants/prompts/codeConventions.js +1 -13
- package/dist/constants/prompts/codeConventions.js.map +2 -2
- package/dist/constants/prompts/doingTasks.js +21 -2
- package/dist/constants/prompts/doingTasks.js.map +2 -2
- package/dist/constants/prompts/envInfo.js +6 -7
- package/dist/constants/prompts/envInfo.js.map +2 -2
- package/dist/constants/prompts/index.js +27 -5
- package/dist/constants/prompts/index.js.map +2 -2
- package/dist/constants/prompts/taskManagement.js +2 -43
- package/dist/constants/prompts/taskManagement.js.map +2 -2
- package/dist/constants/prompts/teamOverlays.js +50 -0
- package/dist/constants/prompts/teamOverlays.js.map +7 -0
- package/dist/constants/prompts/toneAndStyle.js +4 -29
- package/dist/constants/prompts/toneAndStyle.js.map +2 -2
- package/dist/constants/prompts/toolUsagePolicy.js +7 -22
- package/dist/constants/prompts/toolUsagePolicy.js.map +2 -2
- package/dist/constants/toolInputExamples.js +2 -2
- package/dist/constants/toolInputExamples.js.map +2 -2
- package/dist/context.js +39 -6
- package/dist/context.js.map +2 -2
- package/dist/core/backupManager.js +1 -1
- package/dist/core/backupManager.js.map +2 -2
- package/dist/core/permissions/rules/planModeRule.js +1 -1
- package/dist/core/permissions/rules/planModeRule.js.map +1 -1
- package/dist/core/permissions/rules/safeModeRule.js +1 -1
- package/dist/core/permissions/rules/safeModeRule.js.map +1 -1
- package/dist/engine/AgentEngine.js +902 -0
- package/dist/engine/AgentEngine.js.map +7 -0
- package/dist/engine/EngineRegistry.js +89 -0
- package/dist/engine/EngineRegistry.js.map +7 -0
- package/dist/engine/foregroundAdapter.js +191 -0
- package/dist/engine/foregroundAdapter.js.map +7 -0
- package/dist/engine/index.js +15 -0
- package/dist/engine/index.js.map +7 -0
- package/dist/engine/types.js +1 -0
- package/dist/engine/types.js.map +7 -0
- package/dist/entrypoints/cli.js +410 -79
- package/dist/entrypoints/cli.js.map +3 -3
- package/dist/hooks/useAgentEngine.js +129 -0
- package/dist/hooks/useAgentEngine.js.map +7 -0
- package/dist/hooks/useAgentTokenStats.js +0 -16
- package/dist/hooks/useAgentTokenStats.js.map +2 -2
- package/dist/hooks/useCanUseTool.js +47 -2
- package/dist/hooks/useCanUseTool.js.map +2 -2
- package/dist/hooks/useDeferredLoading.js +4 -1
- package/dist/hooks/useDeferredLoading.js.map +2 -2
- package/dist/hooks/useIdleNotifications.js +66 -0
- package/dist/hooks/useIdleNotifications.js.map +7 -0
- package/dist/hooks/useSessionTracking.js +9 -7
- package/dist/hooks/useSessionTracking.js.map +2 -2
- package/dist/hooks/useTeamMembers.js +51 -0
- package/dist/hooks/useTeamMembers.js.map +7 -0
- package/dist/i18n/locales/en.js +77 -12
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/zh-CN.js +77 -12
- package/dist/i18n/locales/zh-CN.js.map +2 -2
- package/dist/i18n/types.js.map +1 -1
- package/dist/messages.js.map +2 -2
- package/dist/permissions.js +113 -7
- package/dist/permissions.js.map +2 -2
- package/dist/query.js +135 -37
- package/dist/query.js.map +2 -2
- package/dist/screens/REPL.js +504 -361
- package/dist/screens/REPL.js.map +3 -3
- package/dist/screens/ResumeConversation.js +199 -14
- package/dist/screens/ResumeConversation.js.map +2 -2
- package/dist/services/adapters/base.js.map +1 -1
- package/dist/services/agentTeams/backends/headless.js +108 -0
- package/dist/services/agentTeams/backends/headless.js.map +7 -0
- package/dist/services/agentTeams/backends/inProcess.js +102 -0
- package/dist/services/agentTeams/backends/inProcess.js.map +7 -0
- package/dist/services/agentTeams/backends/resolver.js +18 -0
- package/dist/services/agentTeams/backends/resolver.js.map +7 -0
- package/dist/services/agentTeams/backends/tmux.js +168 -0
- package/dist/services/agentTeams/backends/tmux.js.map +7 -0
- package/dist/services/agentTeams/backends/types.js +1 -0
- package/dist/services/agentTeams/backends/types.js.map +7 -0
- package/dist/services/agentTeams/heartbeat.js +88 -0
- package/dist/services/agentTeams/heartbeat.js.map +7 -0
- package/dist/services/agentTeams/index.js +42 -2
- package/dist/services/agentTeams/index.js.map +2 -2
- package/dist/services/agentTeams/injectionChannel.js +105 -0
- package/dist/services/agentTeams/injectionChannel.js.map +7 -0
- package/dist/services/agentTeams/mailbox.js +410 -30
- package/dist/services/agentTeams/mailbox.js.map +2 -2
- package/dist/services/agentTeams/messageFormatter.js +80 -0
- package/dist/services/agentTeams/messageFormatter.js.map +7 -0
- package/dist/services/agentTeams/permissionDelegation.js +71 -0
- package/dist/services/agentTeams/permissionDelegation.js.map +7 -0
- package/dist/services/agentTeams/teamEvents.js +45 -0
- package/dist/services/agentTeams/teamEvents.js.map +7 -0
- package/dist/services/agentTeams/teamManager.js +251 -34
- package/dist/services/agentTeams/teamManager.js.map +2 -2
- package/dist/services/agentTeams/teamTaskStore.js +290 -61
- package/dist/services/agentTeams/teamTaskStore.js.map +2 -2
- package/dist/services/agentTeams/teammateSpawner.js +99 -18
- package/dist/services/agentTeams/teammateSpawner.js.map +2 -2
- package/dist/services/hookExecutor.js +51 -8
- package/dist/services/hookExecutor.js.map +2 -2
- package/dist/services/llm/anthropicProvider.js +56 -59
- package/dist/services/llm/anthropicProvider.js.map +2 -2
- package/dist/services/llm/dispatch.js +24 -5
- package/dist/services/llm/dispatch.js.map +2 -2
- package/dist/services/llm/openaiProvider.js +115 -136
- package/dist/services/llm/openaiProvider.js.map +3 -3
- package/dist/services/llm/types.js +89 -15
- package/dist/services/llm/types.js.map +2 -2
- package/dist/services/mcpClient.js +80 -4
- package/dist/services/mcpClient.js.map +2 -2
- package/dist/services/mintoAuth.js +299 -0
- package/dist/services/mintoAuth.js.map +7 -0
- package/dist/services/oauth.js +3 -3
- package/dist/services/oauth.js.map +2 -2
- package/dist/services/openai.js +91 -20
- package/dist/services/openai.js.map +2 -2
- package/dist/services/plugins/pluginRuntime.js +11 -5
- package/dist/services/plugins/pluginRuntime.js.map +2 -2
- package/dist/services/plugins/pluginValidation.js +4 -2
- package/dist/services/plugins/pluginValidation.js.map +2 -2
- package/dist/services/sandbox/sandboxController.js +11 -3
- package/dist/services/sandbox/sandboxController.js.map +2 -2
- package/dist/services/sessionMemoryInjector.js +77 -0
- package/dist/services/sessionMemoryInjector.js.map +7 -0
- package/dist/services/systemReminder.js +130 -8
- package/dist/services/systemReminder.js.map +2 -2
- package/dist/services/taskStore.js +199 -8
- package/dist/services/taskStore.js.map +3 -3
- package/dist/services/topicDetector.js +169 -0
- package/dist/services/topicDetector.js.map +7 -0
- package/dist/tools/AskExpertModelTool/AskExpertModelTool.js +0 -13
- package/dist/tools/AskExpertModelTool/AskExpertModelTool.js.map +2 -2
- package/dist/tools/BashTool/BashTool.js +51 -28
- package/dist/tools/BashTool/BashTool.js.map +2 -2
- package/dist/tools/BashTool/prompt.js +95 -118
- package/dist/tools/BashTool/prompt.js.map +2 -2
- package/dist/tools/BashTool/utils.js +39 -1
- package/dist/tools/BashTool/utils.js.map +2 -2
- package/dist/tools/EnterWorktreeTool/EnterWorktreeTool.js +121 -0
- package/dist/tools/EnterWorktreeTool/EnterWorktreeTool.js.map +7 -0
- package/dist/tools/EnterWorktreeTool/prompt.js +22 -0
- package/dist/tools/EnterWorktreeTool/prompt.js.map +7 -0
- package/dist/tools/FileEditTool/FileEditTool.js +9 -4
- package/dist/tools/FileEditTool/FileEditTool.js.map +2 -2
- package/dist/tools/FileEditTool/prompt.js +3 -7
- package/dist/tools/FileEditTool/prompt.js.map +2 -2
- package/dist/tools/FileReadTool/FileReadTool.js +125 -3
- package/dist/tools/FileReadTool/FileReadTool.js.map +2 -2
- package/dist/tools/FileReadTool/prompt.js +1 -2
- package/dist/tools/FileReadTool/prompt.js.map +2 -2
- package/dist/tools/FileWriteTool/prompt.js +3 -5
- package/dist/tools/FileWriteTool/prompt.js.map +2 -2
- package/dist/tools/GlobTool/GlobTool.js +3 -2
- package/dist/tools/GlobTool/GlobTool.js.map +2 -2
- package/dist/tools/GrepTool/GrepTool.js +16 -5
- package/dist/tools/GrepTool/GrepTool.js.map +2 -2
- package/dist/tools/ListMcpResourcesTool/ListMcpResourcesTool.js.map +2 -2
- package/dist/tools/MCPSearchTool/MCPSearchTool.js +172 -0
- package/dist/tools/MCPSearchTool/MCPSearchTool.js.map +7 -0
- package/dist/tools/MCPSearchTool/prompt.js +77 -0
- package/dist/tools/MCPSearchTool/prompt.js.map +7 -0
- package/dist/tools/MultiEditTool/prompt.js +4 -7
- package/dist/tools/MultiEditTool/prompt.js.map +2 -2
- package/dist/tools/PlanModeTool/EnterPlanModeTool.js +12 -8
- package/dist/tools/PlanModeTool/EnterPlanModeTool.js.map +2 -2
- package/dist/tools/PlanModeTool/ExitPlanModeTool.js +54 -1
- package/dist/tools/PlanModeTool/ExitPlanModeTool.js.map +2 -2
- package/dist/tools/PlanModeTool/prompt.js +23 -74
- package/dist/tools/PlanModeTool/prompt.js.map +2 -2
- package/dist/tools/SendMessageTool/SendMessageTool.js +341 -0
- package/dist/tools/SendMessageTool/SendMessageTool.js.map +7 -0
- package/dist/tools/SendMessageTool/prompt.js +44 -0
- package/dist/tools/SendMessageTool/prompt.js.map +7 -0
- package/dist/tools/TaskCreateTool/prompt.js +15 -4
- package/dist/tools/TaskCreateTool/prompt.js.map +2 -2
- package/dist/tools/TaskListTool/prompt.js +18 -3
- package/dist/tools/TaskListTool/prompt.js.map +2 -2
- package/dist/tools/TaskOutputTool/prompt.js +4 -3
- package/dist/tools/TaskOutputTool/prompt.js.map +2 -2
- package/dist/tools/TaskTool/TaskTool.js +762 -98
- package/dist/tools/TaskTool/TaskTool.js.map +3 -3
- package/dist/tools/TaskTool/constants.js +8 -2
- package/dist/tools/TaskTool/constants.js.map +2 -2
- package/dist/tools/TaskTool/prompt.js +74 -70
- package/dist/tools/TaskTool/prompt.js.map +2 -2
- package/dist/tools/TaskUpdateTool/TaskUpdateTool.js +15 -1
- package/dist/tools/TaskUpdateTool/TaskUpdateTool.js.map +2 -2
- package/dist/tools/TeamCreateTool/TeamCreateTool.js +129 -0
- package/dist/tools/TeamCreateTool/TeamCreateTool.js.map +7 -0
- package/dist/tools/TeamCreateTool/prompt.js +58 -0
- package/dist/tools/TeamCreateTool/prompt.js.map +7 -0
- package/dist/tools/TeamDeleteTool/TeamDeleteTool.js +151 -0
- package/dist/tools/TeamDeleteTool/TeamDeleteTool.js.map +7 -0
- package/dist/tools/TeamDeleteTool/prompt.js +16 -0
- package/dist/tools/TeamDeleteTool/prompt.js.map +7 -0
- package/dist/tools/URLFetcherTool/URLFetcherTool.js +106 -15
- package/dist/tools/URLFetcherTool/URLFetcherTool.js.map +2 -2
- package/dist/tools/URLFetcherTool/prompt.js +3 -2
- package/dist/tools/URLFetcherTool/prompt.js.map +2 -2
- package/dist/tools/WebSearchTool/WebSearchTool.js +2 -1
- package/dist/tools/WebSearchTool/WebSearchTool.js.map +2 -2
- package/dist/tools/WebSearchTool/prompt.js +5 -4
- package/dist/tools/WebSearchTool/prompt.js.map +2 -2
- package/dist/tools.js +100 -20
- package/dist/tools.js.map +2 -2
- package/dist/types/PermissionMode.js +35 -6
- package/dist/types/PermissionMode.js.map +2 -2
- package/dist/types/hooks.js +2 -0
- package/dist/types/hooks.js.map +2 -2
- package/dist/types/plugin.js +2 -0
- package/dist/types/plugin.js.map +3 -3
- package/dist/utils/CircuitBreaker.js +15 -9
- package/dist/utils/CircuitBreaker.js.map +2 -2
- package/dist/utils/agentLoader.js +249 -112
- package/dist/utils/agentLoader.js.map +2 -2
- package/dist/utils/animationManager.js +40 -3
- package/dist/utils/animationManager.js.map +2 -2
- package/dist/utils/ask.js +7 -6
- package/dist/utils/ask.js.map +2 -2
- package/dist/utils/atomicWrite.js +23 -0
- package/dist/utils/atomicWrite.js.map +7 -0
- package/dist/utils/autoCompactCore.js +73 -56
- package/dist/utils/autoCompactCore.js.map +2 -2
- package/dist/utils/autoMemoryPaths.js +89 -0
- package/dist/utils/autoMemoryPaths.js.map +7 -0
- package/dist/utils/config.js +63 -38
- package/dist/utils/config.js.map +2 -2
- package/dist/utils/configSchema.js +13 -8
- package/dist/utils/configSchema.js.map +2 -2
- package/dist/utils/credentials/index.js +14 -0
- package/dist/utils/credentials/index.js.map +2 -2
- package/dist/utils/dualPath.js +24 -0
- package/dist/utils/dualPath.js.map +7 -0
- package/dist/utils/exit.js +66 -7
- package/dist/utils/exit.js.map +2 -2
- package/dist/utils/externalEditor.js +155 -0
- package/dist/utils/externalEditor.js.map +7 -0
- package/dist/utils/fileLock.js +67 -0
- package/dist/utils/fileLock.js.map +7 -0
- package/dist/utils/format.js +24 -14
- package/dist/utils/format.js.map +2 -2
- package/dist/utils/globalErrorHandler.js +5 -96
- package/dist/utils/globalErrorHandler.js.map +3 -3
- package/dist/utils/groupHandlers/parallelTasksHandler.js +5 -3
- package/dist/utils/groupHandlers/parallelTasksHandler.js.map +2 -2
- package/dist/utils/groupHandlers/taskHandler.js +2 -2
- package/dist/utils/groupHandlers/taskHandler.js.map +2 -2
- package/dist/utils/hookManager.js +64 -6
- package/dist/utils/hookManager.js.map +2 -2
- package/dist/utils/log.js +6 -2
- package/dist/utils/log.js.map +2 -2
- package/dist/utils/markdown.js +237 -19
- package/dist/utils/markdown.js.map +2 -2
- package/dist/utils/messageContextManager.js +18 -5
- package/dist/utils/messageContextManager.js.map +2 -2
- package/dist/utils/messageGroupManager.js +1 -1
- package/dist/utils/messageGroupManager.js.map +2 -2
- package/dist/utils/messages.js +104 -46
- package/dist/utils/messages.js.map +2 -2
- package/dist/utils/model.js +2 -2
- package/dist/utils/model.js.map +2 -2
- package/dist/utils/pasteCache.js +8 -4
- package/dist/utils/pasteCache.js.map +2 -2
- package/dist/utils/pluginLoader.js +18 -0
- package/dist/utils/pluginLoader.js.map +2 -2
- package/dist/utils/secureKeyStorage.js +36 -7
- package/dist/utils/secureKeyStorage.js.map +2 -2
- package/dist/utils/simpleMode.js +7 -0
- package/dist/utils/simpleMode.js.map +7 -0
- package/dist/utils/streamingState.js +11 -1
- package/dist/utils/streamingState.js.map +2 -2
- package/dist/utils/taskDisplayUtils.js +2 -1
- package/dist/utils/taskDisplayUtils.js.map +2 -2
- package/dist/utils/teamConfig.js +2 -2
- package/dist/utils/teamConfig.js.map +2 -2
- package/dist/utils/thinking.js +6 -2
- package/dist/utils/thinking.js.map +3 -3
- package/dist/utils/tokenProgress.js +55 -0
- package/dist/utils/tokenProgress.js.map +7 -0
- package/dist/utils/toolRiskClassification.js +26 -17
- package/dist/utils/toolRiskClassification.js.map +2 -2
- package/dist/utils/tooling/toolError.js +12 -0
- package/dist/utils/tooling/toolError.js.map +7 -0
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/package.json +10 -8
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { getTools, getReadOnlyTools } from "../../tools.js";
|
|
2
|
-
import { TaskTool } from "./TaskTool.js";
|
|
3
|
-
import { FileWriteTool } from "../FileWriteTool/FileWriteTool.js";
|
|
4
|
-
import { GlobTool } from "../GlobTool/GlobTool.js";
|
|
5
|
-
import { FileReadTool } from "../FileReadTool/FileReadTool.js";
|
|
6
2
|
import { getActiveAgents } from "../../utils/agentLoader.js";
|
|
3
|
+
const EXCLUDED_AGENT_TOOLS = /* @__PURE__ */ new Set([
|
|
4
|
+
"Agent",
|
|
5
|
+
// Prevent recursive TaskTool calls (unless explicitly allowed via toolFilter)
|
|
6
|
+
"TeamCreate",
|
|
7
|
+
// Team management is leader-only
|
|
8
|
+
"TeamDelete"
|
|
9
|
+
// Team management is leader-only
|
|
10
|
+
]);
|
|
7
11
|
async function getTaskTools(safeMode) {
|
|
8
12
|
return (await (!safeMode ? getTools() : getReadOnlyTools())).filter(
|
|
9
|
-
(_) => _.name
|
|
13
|
+
(_) => !EXCLUDED_AGENT_TOOLS.has(_.name)
|
|
10
14
|
);
|
|
11
15
|
}
|
|
12
16
|
async function getPrompt(safeMode) {
|
|
@@ -15,100 +19,100 @@ async function getPrompt(safeMode) {
|
|
|
15
19
|
const toolsStr = Array.isArray(agent.tools) ? agent.tools.join(", ") : "*";
|
|
16
20
|
return `- ${agent.agentType}: ${agent.whenToUse} (Tools: ${toolsStr})`;
|
|
17
21
|
}).join("\n");
|
|
18
|
-
return `Launch a new agent to handle complex, multi-step tasks autonomously.
|
|
22
|
+
return `Launch a new agent to handle complex, multi-step tasks autonomously.
|
|
23
|
+
|
|
24
|
+
The Agent tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.
|
|
19
25
|
|
|
20
26
|
Available agent types and the tools they have access to:
|
|
21
27
|
${agentDescriptions}
|
|
22
28
|
|
|
23
|
-
When using the
|
|
29
|
+
When using the Agent tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used.
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
When to use the Agent tool:
|
|
32
|
+
- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Agent(description="Check the file", prompt="/check-file path/to/file.py")
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
34
|
+
When NOT to use the Agent tool:
|
|
35
|
+
- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly
|
|
36
|
+
- If you are searching for a specific class definition like "class Foo", use the Glob tool instead, to find the match more quickly
|
|
37
|
+
- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly
|
|
38
|
+
- Other tasks that are not related to the agent descriptions above
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
1. For market/business analysis \u2192 use "strategic-market-analyzer" or "business-analyst"
|
|
35
|
-
2. For data analysis \u2192 use "data-scientist"
|
|
36
|
-
3. For general tasks \u2192 use "general-purpose"
|
|
37
|
-
4. For code/QA tasks \u2192 use "qa-engineer" or "code-reviewer"
|
|
40
|
+
## Parallel Tasks vs Agent Teams \u2014 Decision Framework
|
|
38
41
|
|
|
39
|
-
If
|
|
42
|
+
**USER INTENT OVERRIDE: If the user explicitly asks for a team, swarm, or multi-agent group, ALWAYS use Agent Teams regardless of the heuristics below.**
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description="Check the file", prompt="/check-file path/to/file.py")
|
|
44
|
+
You have TWO ways to run multiple agents. Choose the right one:
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
46
|
+
### Parallel Tasks (multiple Agent calls in one message) \u2014 DEFAULT CHOICE
|
|
47
|
+
Use when tasks are **independent and fire-and-forget**:
|
|
48
|
+
- Each agent works alone, returns a result, and is done
|
|
49
|
+
- No agent needs to see another agent's output to do its work
|
|
50
|
+
- You (the orchestrator) synthesize all results after they return
|
|
51
|
+
|
|
52
|
+
Examples: analyze 3 files, search 5 code patterns, run independent checks
|
|
53
|
+
|
|
54
|
+
### Agent Teams (TeamCreate + SendMessage) \u2014 for collaboration or user-requested teams
|
|
55
|
+
Use when agents **must communicate with each other** during execution, or when the user explicitly requests a team:
|
|
56
|
+
- Agent A's output feeds into Agent B's work (and B may send findings back to A)
|
|
57
|
+
- Agents need a shared task board to coordinate who does what
|
|
58
|
+
- The work requires multiple rounds of back-and-forth between agents
|
|
59
|
+
- Agents need to persist across rounds and be reassigned new tasks
|
|
60
|
+
|
|
61
|
+
**Important**: Teammates in a team automatically run in background, so you (the team-lead) remain available to process messages and coordinate work.
|
|
62
|
+
|
|
63
|
+
Examples: researcher finds info \u2192 implementer codes it \u2192 tester validates \u2192 implementer fixes issues
|
|
64
|
+
|
|
65
|
+
### Decision Checklist
|
|
66
|
+
Ask yourself: "Did the user ask for a team, OR do agents need to TALK TO EACH OTHER?"
|
|
67
|
+
- **User asked for a team** \u2192 Use Agent Teams (always honor explicit requests)
|
|
68
|
+
- **No communication needed** \u2192 Use parallel Agent calls (simple, fast, no overhead)
|
|
69
|
+
- **Agents must communicate** \u2192 Use Agent Teams (TeamCreate + spawn teammates + SendMessage)
|
|
70
|
+
|
|
71
|
+
**Efficiency tip:** For independent tasks, parallel Agent calls are simpler and faster. But always defer to user intent \u2014 if they ask for a team, create one.
|
|
49
72
|
|
|
50
73
|
Usage notes:
|
|
51
74
|
- Always include a short description (3-5 words) summarizing what the agent will do
|
|
52
75
|
- Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
|
|
53
76
|
- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.
|
|
54
|
-
-
|
|
77
|
+
- **Foreground tasks return results directly** \u2014 when a foreground Agent (including parallel Agents) completes, its result and agentId are returned inline in the tool result. Do NOT call TaskOutput for foreground tasks; their results are already in your context. TaskOutput is ONLY for background tasks started with \`run_in_background: true\`.
|
|
78
|
+
- You can optionally run agents in the background using the run_in_background parameter. When an agent runs in the background, you will be automatically notified when it completes \u2014 do NOT sleep, poll, or proactively check on its progress. Continue with other work or respond to the user instead.
|
|
79
|
+
- **Foreground vs background**: Use foreground (default) when you need the agent's results before you can proceed \u2014 e.g., research agents whose findings inform your next steps. Use background when you have genuinely independent work to do in parallel.
|
|
80
|
+
- When using Agent Teams (TeamCreate), teammates automatically run in background so you remain available to coordinate. After spawning all teammates, respond to the user with a brief status (e.g., "Agents are working...") and STOP \u2014 do NOT manually read files, check inboxes, or use TaskOutput. Teammate results are delivered to you automatically as new messages.
|
|
55
81
|
- Agents can be resumed using the \`resume\` parameter by passing the agent ID from a previous invocation. When resumed, the agent continues with its full previous context preserved. When NOT resuming, each invocation starts fresh and you should provide a detailed task description with all necessary context.
|
|
56
82
|
- When the agent is done, it will return a single message back to you along with its agent ID. You can use this ID to resume the agent later if needed for follow-up work.
|
|
57
83
|
- Provide clear, detailed prompts so the agent can work autonomously and return exactly the information you need.
|
|
58
|
-
- Agents with "access to current context" can see the full conversation history before the tool call. When using these agents, you can write concise prompts that reference earlier context (e.g., "investigate the error discussed above") instead of repeating information. The agent will receive all prior messages and understand the context.
|
|
59
84
|
- The agent's outputs should generally be trusted
|
|
60
85
|
- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent
|
|
61
86
|
- If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
|
|
62
|
-
- If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple
|
|
87
|
+
- If the user specifies that they want you to run agents "in parallel", you MUST send a single message with multiple Agent tool use content blocks.
|
|
63
88
|
|
|
64
89
|
Example usage:
|
|
65
90
|
|
|
66
91
|
<example>
|
|
67
|
-
<scenario>Market research analysis with multiple files</scenario>
|
|
68
|
-
user: "Analyze these 3 market research reports and summarize findings"
|
|
69
|
-
assistant: I'll use multiple subagents to analyze the reports in parallel.
|
|
70
|
-
<uses Task tool>
|
|
71
|
-
subagent_type: "strategic-market-analyzer"
|
|
72
|
-
prompt: "Analyze market_report_1.md and provide key insights..."
|
|
73
|
-
</uses Task tool>
|
|
74
|
-
<uses Task tool>
|
|
75
|
-
subagent_type: "strategic-market-analyzer"
|
|
76
|
-
prompt: "Analyze market_report_2.md and provide key insights..."
|
|
77
|
-
</uses Task tool>
|
|
78
|
-
<uses Task tool>
|
|
79
|
-
subagent_type: "business-analyst"
|
|
80
|
-
prompt: "Analyze financial_report.md and provide key insights..."
|
|
81
|
-
</uses Task tool>
|
|
82
|
-
</example>
|
|
83
|
-
|
|
84
|
-
<example>
|
|
85
|
-
<scenario>Code review after implementation</scenario>
|
|
86
92
|
user: "Please write a function that checks if a number is prime"
|
|
87
|
-
assistant:
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
assistant: I'm going to use the Write tool to write the following code:
|
|
94
|
+
<code>
|
|
95
|
+
function isPrime(n) {
|
|
96
|
+
if (n <= 1) return false
|
|
97
|
+
for (let i = 2; i * i <= n; i++) {
|
|
98
|
+
if (n % i === 0) return false
|
|
99
|
+
}
|
|
100
|
+
return true
|
|
101
|
+
}
|
|
102
|
+
</code>
|
|
103
|
+
<commentary>
|
|
104
|
+
Since a significant piece of code was written and the task was completed, now use the test-runner agent to run the tests
|
|
105
|
+
</commentary>
|
|
106
|
+
assistant: Uses the Agent tool to launch the test-runner agent
|
|
94
107
|
</example>
|
|
95
108
|
|
|
96
109
|
<example>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</uses Task tool>
|
|
104
|
-
</example>
|
|
105
|
-
|
|
106
|
-
\u274C WRONG EXAMPLES (DO NOT DO THIS):
|
|
107
|
-
<wrong_example>
|
|
108
|
-
subagent_type: "researcher" \u2190 WRONG! This agent type doesn't exist
|
|
109
|
-
subagent_type: "market_analyzer" \u2190 WRONG! Uses underscore instead of hyphen
|
|
110
|
-
subagent_type: "data analyst" \u2190 WRONG! Uses space instead of hyphen
|
|
111
|
-
</wrong_example>`;
|
|
110
|
+
user: "Hello"
|
|
111
|
+
<commentary>
|
|
112
|
+
Since the user is greeting, use the greeting-responder agent to respond with a friendly joke
|
|
113
|
+
</commentary>
|
|
114
|
+
assistant: "I'm going to use the Agent tool to launch the greeting-responder agent"
|
|
115
|
+
</example>`;
|
|
112
116
|
}
|
|
113
117
|
export {
|
|
114
118
|
getPrompt,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/TaskTool/prompt.ts"],
|
|
4
|
-
"sourcesContent": ["import { type Tool } from '@tool'\nimport { getTools, getReadOnlyTools } from '@tools'\nimport { TaskTool } from './TaskTool'\nimport {
|
|
5
|
-
"mappings": "AACA,SAAS,UAAU,wBAAwB;
|
|
4
|
+
"sourcesContent": ["import { type Tool } from '@tool'\nimport { getTools, getReadOnlyTools } from '@tools'\nimport { TaskTool } from './TaskTool'\nimport { getModelManager } from '@utils/model'\nimport { getActiveAgents } from '@utils/agentLoader'\n\n/**\n * Agent-internal tools that should never be exposed to subagents.\n * These are either recursive (TaskTool itself) or admin-only.\n */\nconst EXCLUDED_AGENT_TOOLS = new Set([\n 'Agent', // Prevent recursive TaskTool calls (unless explicitly allowed via toolFilter)\n 'TeamCreate', // Team management is leader-only\n 'TeamDelete', // Team management is leader-only\n])\n\nexport async function getTaskTools(safeMode: boolean): Promise<Tool[]> {\n return (await (!safeMode ? getTools() : getReadOnlyTools())).filter(\n _ => !EXCLUDED_AGENT_TOOLS.has(_.name),\n )\n}\n\nexport async function getPrompt(safeMode: boolean): Promise<string> {\n const agents = await getActiveAgents()\n\n // Format: (Tools: tool1, tool2)\n const agentDescriptions = agents\n .map(agent => {\n const toolsStr = Array.isArray(agent.tools) ? agent.tools.join(', ') : '*'\n return `- ${agent.agentType}: ${agent.whenToUse} (Tools: ${toolsStr})`\n })\n .join('\\n')\n\n return `Launch a new agent to handle complex, multi-step tasks autonomously.\n\nThe Agent tool launches specialized agents (subprocesses) that autonomously handle complex tasks. Each agent type has specific capabilities and tools available to it.\n\nAvailable agent types and the tools they have access to:\n${agentDescriptions}\n\nWhen using the Agent tool, specify a subagent_type parameter to select which agent type to use. If omitted, the general-purpose agent is used.\n\nWhen to use the Agent tool:\n- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Agent(description=\"Check the file\", prompt=\"/check-file path/to/file.py\")\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n- Other tasks that are not related to the agent descriptions above\n\n## Parallel Tasks vs Agent Teams \u2014 Decision Framework\n\n**USER INTENT OVERRIDE: If the user explicitly asks for a team, swarm, or multi-agent group, ALWAYS use Agent Teams regardless of the heuristics below.**\n\nYou have TWO ways to run multiple agents. Choose the right one:\n\n### Parallel Tasks (multiple Agent calls in one message) \u2014 DEFAULT CHOICE\nUse when tasks are **independent and fire-and-forget**:\n- Each agent works alone, returns a result, and is done\n- No agent needs to see another agent's output to do its work\n- You (the orchestrator) synthesize all results after they return\n\nExamples: analyze 3 files, search 5 code patterns, run independent checks\n\n### Agent Teams (TeamCreate + SendMessage) \u2014 for collaboration or user-requested teams\nUse when agents **must communicate with each other** during execution, or when the user explicitly requests a team:\n- Agent A's output feeds into Agent B's work (and B may send findings back to A)\n- Agents need a shared task board to coordinate who does what\n- The work requires multiple rounds of back-and-forth between agents\n- Agents need to persist across rounds and be reassigned new tasks\n\n**Important**: Teammates in a team automatically run in background, so you (the team-lead) remain available to process messages and coordinate work.\n\nExamples: researcher finds info \u2192 implementer codes it \u2192 tester validates \u2192 implementer fixes issues\n\n### Decision Checklist\nAsk yourself: \"Did the user ask for a team, OR do agents need to TALK TO EACH OTHER?\"\n- **User asked for a team** \u2192 Use Agent Teams (always honor explicit requests)\n- **No communication needed** \u2192 Use parallel Agent calls (simple, fast, no overhead)\n- **Agents must communicate** \u2192 Use Agent Teams (TeamCreate + spawn teammates + SendMessage)\n\n**Efficiency tip:** For independent tasks, parallel Agent calls are simpler and faster. But always defer to user intent \u2014 if they ask for a team, create one.\n\nUsage notes:\n- Always include a short description (3-5 words) summarizing what the agent will do\n- Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n- When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n- **Foreground tasks return results directly** \u2014 when a foreground Agent (including parallel Agents) completes, its result and agentId are returned inline in the tool result. Do NOT call TaskOutput for foreground tasks; their results are already in your context. TaskOutput is ONLY for background tasks started with \\`run_in_background: true\\`.\n- You can optionally run agents in the background using the run_in_background parameter. When an agent runs in the background, you will be automatically notified when it completes \u2014 do NOT sleep, poll, or proactively check on its progress. Continue with other work or respond to the user instead.\n- **Foreground vs background**: Use foreground (default) when you need the agent's results before you can proceed \u2014 e.g., research agents whose findings inform your next steps. Use background when you have genuinely independent work to do in parallel.\n- When using Agent Teams (TeamCreate), teammates automatically run in background so you remain available to coordinate. After spawning all teammates, respond to the user with a brief status (e.g., \"Agents are working...\") and STOP \u2014 do NOT manually read files, check inboxes, or use TaskOutput. Teammate results are delivered to you automatically as new messages.\n- Agents can be resumed using the \\`resume\\` parameter by passing the agent ID from a previous invocation. When resumed, the agent continues with its full previous context preserved. When NOT resuming, each invocation starts fresh and you should provide a detailed task description with all necessary context.\n- When the agent is done, it will return a single message back to you along with its agent ID. You can use this ID to resume the agent later if needed for follow-up work.\n- Provide clear, detailed prompts so the agent can work autonomously and return exactly the information you need.\n- The agent's outputs should generally be trusted\n- Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n- If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.\n- If the user specifies that they want you to run agents \"in parallel\", you MUST send a single message with multiple Agent tool use content blocks.\n\nExample usage:\n\n<example>\nuser: \"Please write a function that checks if a number is prime\"\nassistant: I'm going to use the Write tool to write the following code:\n<code>\nfunction isPrime(n) {\n if (n <= 1) return false\n for (let i = 2; i * i <= n; i++) {\n if (n % i === 0) return false\n }\n return true\n}\n</code>\n<commentary>\nSince a significant piece of code was written and the task was completed, now use the test-runner agent to run the tests\n</commentary>\nassistant: Uses the Agent tool to launch the test-runner agent\n</example>\n\n<example>\nuser: \"Hello\"\n<commentary>\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n</commentary>\nassistant: \"I'm going to use the Agent tool to launch the greeting-responder agent\"\n</example>`\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,UAAU,wBAAwB;AAG3C,SAAS,uBAAuB;AAMhC,MAAM,uBAAuB,oBAAI,IAAI;AAAA,EACnC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;AAED,eAAsB,aAAa,UAAoC;AACrE,UAAQ,OAAO,CAAC,WAAW,SAAS,IAAI,iBAAiB,IAAI;AAAA,IAC3D,OAAK,CAAC,qBAAqB,IAAI,EAAE,IAAI;AAAA,EACvC;AACF;AAEA,eAAsB,UAAU,UAAoC;AAClE,QAAM,SAAS,MAAM,gBAAgB;AAGrC,QAAM,oBAAoB,OACvB,IAAI,WAAS;AACZ,UAAM,WAAW,MAAM,QAAQ,MAAM,KAAK,IAAI,MAAM,MAAM,KAAK,IAAI,IAAI;AACvE,WAAO,KAAK,MAAM,SAAS,KAAK,MAAM,SAAS,YAAY,QAAQ;AAAA,EACrE,CAAC,EACA,KAAK,IAAI;AAEZ,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKP,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyFnB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -89,7 +89,7 @@ const TaskUpdateTool = {
|
|
|
89
89
|
async *call(input) {
|
|
90
90
|
try {
|
|
91
91
|
const isDeleting = input.status === "deleted";
|
|
92
|
-
const task = updateTask({
|
|
92
|
+
const task = await updateTask({
|
|
93
93
|
taskId: input.taskId,
|
|
94
94
|
status: input.status,
|
|
95
95
|
subject: input.subject,
|
|
@@ -108,6 +108,20 @@ const TaskUpdateTool = {
|
|
|
108
108
|
};
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
+
if (task.metadata?._hookRejected) {
|
|
112
|
+
const feedback = task.metadata._hookFeedback || "Blocked by hook";
|
|
113
|
+
yield {
|
|
114
|
+
type: "result",
|
|
115
|
+
data: {
|
|
116
|
+
taskId: task.id,
|
|
117
|
+
status: task.status,
|
|
118
|
+
hookBlocked: true,
|
|
119
|
+
hookFeedback: feedback
|
|
120
|
+
},
|
|
121
|
+
resultForAssistant: `Task #${task.id} completion was blocked by a hook. Status reverted to in_progress. Feedback: ${feedback}`
|
|
122
|
+
};
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
111
125
|
const result = {
|
|
112
126
|
taskId: task.id,
|
|
113
127
|
status: task.status,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/TaskUpdateTool/TaskUpdateTool.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Box, Text } from 'ink'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool } from '@tool'\nimport { updateTask, getTaskById } from '@services/taskStore'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { getTheme } from '@utils/theme'\n\nconst inputSchema = z.strictObject({\n taskId: z.string().describe('The ID of the task to update'),\n status: z\n .enum(['pending', 'in_progress', 'completed', 'deleted'])\n .optional()\n .describe('New status for the task'),\n subject: z.string().optional().describe('New subject for the task'),\n description: z.string().optional().describe('New description for the task'),\n activeForm: z\n .string()\n .optional()\n .describe(\n 'Present continuous form shown in spinner when in_progress (e.g., \"Running tests\")',\n ),\n owner: z.string().optional().describe('New owner for the task'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe(\n 'Metadata keys to merge into the task. Set a key to null to delete it.',\n ),\n addBlocks: z\n .array(z.string())\n .optional()\n .describe('Task IDs that this task blocks'),\n addBlockedBy: z\n .array(z.string())\n .optional()\n .describe('Task IDs that block this task'),\n})\n\nexport const TaskUpdateTool = {\n name: 'TaskUpdate',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Update Task'\n },\n async isEnabled() {\n return true\n },\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return false\n },\n needsPermissions() {\n return false\n },\n renderToolUseMessage(input: z.infer<typeof inputSchema>) {\n const parts: string[] = [`taskId: ${input.taskId}`]\n if (input.status) {\n parts.push(`status: ${input.status}`)\n }\n return parts.join(', ')\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: {\n taskId: string\n status?: string\n deleted?: boolean\n }) {\n if (!output || !output.taskId) {\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text>Task updated</Text>\n </Box>\n )\n }\n\n if (output.deleted) {\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text color={getTheme().secondaryText}>\n Task #{output.taskId} deleted\n </Text>\n </Box>\n )\n }\n\n const statusColor =\n output.status === 'completed'\n ? getTheme().success\n : output.status === 'in_progress'\n ? getTheme().warning\n : getTheme().secondaryText\n\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text>\n Updated task #{output.taskId}\n {output.status && <Text color={statusColor}> \u2192 {output.status}</Text>}\n </Text>\n </Box>\n )\n },\n renderResultForAssistant(result: {\n taskId: string\n status?: string\n deleted?: boolean\n }) {\n if (result.deleted) {\n return `Task #${result.taskId} has been deleted`\n }\n return `Updated task #${result.taskId}${result.status ? ` status` : ''}`\n },\n async validateInput({ taskId }: z.infer<typeof inputSchema>) {\n if (!taskId?.trim()) {\n return {\n result: false,\n message: 'Task ID is required',\n }\n }\n\n const task = getTaskById(taskId)\n if (!task) {\n return {\n result: false,\n message: `Task with ID '${taskId}' not found`,\n }\n }\n\n return { result: true }\n },\n async *call(input: z.infer<typeof inputSchema>) {\n try {\n const isDeleting = input.status === 'deleted'\n\n const task = updateTask({\n taskId: input.taskId,\n status: input.status,\n subject: input.subject,\n description: input.description,\n activeForm: input.activeForm,\n owner: input.owner,\n metadata: input.metadata,\n addBlocks: input.addBlocks,\n addBlockedBy: input.addBlockedBy,\n })\n\n if (!task) {\n yield {\n type: 'result',\n data: { error: 'Task not found' },\n resultForAssistant: `Error: Task with ID '${input.taskId}' not found`,\n }\n return\n }\n\n const result = {\n taskId: task.id,\n status: task.status,\n deleted: isDeleting,\n }\n\n yield {\n type: 'result',\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error occurred'\n yield {\n type: 'result',\n data: { error: errorMessage },\n resultForAssistant: `Error updating task: ${errorMessage}`,\n }\n }\n },\n} satisfies Tool\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAE/C,SAAS,YAAY,mBAAmB;AACxC,SAAS,aAAa,cAAc;AACpC,SAAS,gBAAgB;AAEzB,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,QAAQ,EAAE,OAAO,EAAE,SAAS,8BAA8B;AAAA,EAC1D,QAAQ,EACL,KAAK,CAAC,WAAW,eAAe,aAAa,SAAS,CAAC,EACvD,SAAS,EACT,SAAS,yBAAyB;AAAA,EACrC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0BAA0B;AAAA,EAClE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,8BAA8B;AAAA,EAC1E,YAAY,EACT,OAAO,EACP,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,wBAAwB;AAAA,EAC9D,UAAU,EACP,OAAO,EAAE,QAAQ,CAAC,EAClB,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,WAAW,EACR,MAAM,EAAE,OAAO,CAAC,EAChB,SAAS,EACT,SAAS,gCAAgC;AAAA,EAC5C,cAAc,EACX,MAAM,EAAE,OAAO,CAAC,EAChB,SAAS,EACT,SAAS,+BAA+B;AAC7C,CAAC;AAEM,MAAM,iBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,iBAAiB;AACf,WAAO;AAAA,EACT;AAAA,EACA,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O,GAAgC;AAC3D,QAAI,CAAC,QAAQ,KAAK,GAAG;AACnB,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,MACX;AAAA,IACF;AAEA,UAAM,OAAO,YAAY,MAAM;AAC/B,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,SAAS,iBAAiB,MAAM;AAAA,MAClC;AAAA,IACF;AAEA,WAAO,EAAE,QAAQ,KAAK;AAAA,EACxB;AAAA,EACA,OAAO,KAAK,OAAoC;AAC9C,QAAI;AACF,YAAM,aAAa,MAAM,WAAW;AAEpC,YAAM,OAAO,WAAW;AAAA,
|
|
4
|
+
"sourcesContent": ["import { Box, Text } from 'ink'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool } from '@tool'\nimport { updateTask, getTaskById } from '@services/taskStore'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { getTheme } from '@utils/theme'\n\nconst inputSchema = z.strictObject({\n taskId: z.string().describe('The ID of the task to update'),\n status: z\n .enum(['pending', 'in_progress', 'completed', 'deleted'])\n .optional()\n .describe('New status for the task'),\n subject: z.string().optional().describe('New subject for the task'),\n description: z.string().optional().describe('New description for the task'),\n activeForm: z\n .string()\n .optional()\n .describe(\n 'Present continuous form shown in spinner when in_progress (e.g., \"Running tests\")',\n ),\n owner: z.string().optional().describe('New owner for the task'),\n metadata: z\n .record(z.unknown())\n .optional()\n .describe(\n 'Metadata keys to merge into the task. Set a key to null to delete it.',\n ),\n addBlocks: z\n .array(z.string())\n .optional()\n .describe('Task IDs that this task blocks'),\n addBlockedBy: z\n .array(z.string())\n .optional()\n .describe('Task IDs that block this task'),\n})\n\nexport const TaskUpdateTool = {\n name: 'TaskUpdate',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Update Task'\n },\n async isEnabled() {\n return true\n },\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return false\n },\n needsPermissions() {\n return false\n },\n renderToolUseMessage(input: z.infer<typeof inputSchema>) {\n const parts: string[] = [`taskId: ${input.taskId}`]\n if (input.status) {\n parts.push(`status: ${input.status}`)\n }\n return parts.join(', ')\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: {\n taskId: string\n status?: string\n deleted?: boolean\n }) {\n if (!output || !output.taskId) {\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text>Task updated</Text>\n </Box>\n )\n }\n\n if (output.deleted) {\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text color={getTheme().secondaryText}>\n Task #{output.taskId} deleted\n </Text>\n </Box>\n )\n }\n\n const statusColor =\n output.status === 'completed'\n ? getTheme().success\n : output.status === 'in_progress'\n ? getTheme().warning\n : getTheme().secondaryText\n\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text>\n Updated task #{output.taskId}\n {output.status && <Text color={statusColor}> \u2192 {output.status}</Text>}\n </Text>\n </Box>\n )\n },\n renderResultForAssistant(result: {\n taskId: string\n status?: string\n deleted?: boolean\n }) {\n if (result.deleted) {\n return `Task #${result.taskId} has been deleted`\n }\n return `Updated task #${result.taskId}${result.status ? ` status` : ''}`\n },\n async validateInput({ taskId }: z.infer<typeof inputSchema>) {\n if (!taskId?.trim()) {\n return {\n result: false,\n message: 'Task ID is required',\n }\n }\n\n const task = getTaskById(taskId)\n if (!task) {\n return {\n result: false,\n message: `Task with ID '${taskId}' not found`,\n }\n }\n\n return { result: true }\n },\n async *call(input: z.infer<typeof inputSchema>) {\n try {\n const isDeleting = input.status === 'deleted'\n\n const task = await updateTask({\n taskId: input.taskId,\n status: input.status,\n subject: input.subject,\n description: input.description,\n activeForm: input.activeForm,\n owner: input.owner,\n metadata: input.metadata,\n addBlocks: input.addBlocks,\n addBlockedBy: input.addBlockedBy,\n })\n\n if (!task) {\n yield {\n type: 'result',\n data: { error: 'Task not found' },\n resultForAssistant: `Error: Task with ID '${input.taskId}' not found`,\n }\n return\n }\n\n // Check if hook blocked task completion\n if (task.metadata?._hookRejected) {\n const feedback = task.metadata._hookFeedback || 'Blocked by hook'\n yield {\n type: 'result',\n data: {\n taskId: task.id,\n status: task.status,\n hookBlocked: true,\n hookFeedback: feedback,\n },\n resultForAssistant: `Task #${task.id} completion was blocked by a hook. Status reverted to in_progress. Feedback: ${feedback}`,\n }\n return\n }\n\n const result = {\n taskId: task.id,\n status: task.status,\n deleted: isDeleting,\n }\n\n yield {\n type: 'result',\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'Unknown error occurred'\n yield {\n type: 'result',\n data: { error: errorMessage },\n resultForAssistant: `Error updating task: ${errorMessage}`,\n }\n }\n },\n} satisfies Tool\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAE/C,SAAS,YAAY,mBAAmB;AACxC,SAAS,aAAa,cAAc;AACpC,SAAS,gBAAgB;AAEzB,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,QAAQ,EAAE,OAAO,EAAE,SAAS,8BAA8B;AAAA,EAC1D,QAAQ,EACL,KAAK,CAAC,WAAW,eAAe,aAAa,SAAS,CAAC,EACvD,SAAS,EACT,SAAS,yBAAyB;AAAA,EACrC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0BAA0B;AAAA,EAClE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,8BAA8B;AAAA,EAC1E,YAAY,EACT,OAAO,EACP,SAAS,EACT;AAAA,IACC;AAAA,EACF;AAAA,EACF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,wBAAwB;AAAA,EAC9D,UAAU,EACP,OAAO,EAAE,QAAQ,CAAC,EAClB,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AAW,KAAK,SAAS,iBAAiB;AAChD,cAAM;AAAA,UACJ,MAAM;AAAA,UACN,MAAM;AAAA,YACJ,QAAQ,KAAK;AAAA,YACb,QAAQ,KAAK;AAAA,YACb,aAAa;AAAA,YACb,cAAc;AAAA,UAChB;AAAA,UACA,oBAAoB,SAAS,KAAK,EAAE,gFAAgF,QAAQ;AAAA,QAC9H;AACA;AAAA,MACF;AAEA,YAAM,SAAS;AAAA,QACb,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK;AAAA,QACb,SAAS;AAAA,MACX;AAEA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,QACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,MAC1D;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eACJ,iBAAiB,QAAQ,MAAM,UAAU;AAC3C,YAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM,EAAE,OAAO,aAAa;AAAA,QAC5B,oBAAoB,wBAAwB,YAAY;AAAA,MAC1D;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Box, Text } from "ink";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { FallbackToolUseRejectedMessage } from "../../components/FallbackToolUseRejectedMessage.js";
|
|
5
|
+
import { createToolErrorResult } from "../../utils/tooling/toolError.js";
|
|
6
|
+
import {
|
|
7
|
+
isAgentTeamsEnabled,
|
|
8
|
+
sanitizeTeamName,
|
|
9
|
+
createTeam,
|
|
10
|
+
addTeammate
|
|
11
|
+
} from "../../services/agentTeams/index.js";
|
|
12
|
+
import { DESCRIPTION, PROMPT } from "./prompt.js";
|
|
13
|
+
import { getTheme } from "../../utils/theme.js";
|
|
14
|
+
const inputSchema = z.strictObject({
|
|
15
|
+
team_name: z.string().describe("Name for the new team to create."),
|
|
16
|
+
description: z.string().optional().describe("Team description/purpose."),
|
|
17
|
+
agent_type: z.string().optional().describe(
|
|
18
|
+
'Type/role of the team lead (e.g., "researcher", "test-runner"). Used for team file and inter-agent coordination.'
|
|
19
|
+
)
|
|
20
|
+
});
|
|
21
|
+
const TeamCreateTool = {
|
|
22
|
+
name: "TeamCreate",
|
|
23
|
+
async description() {
|
|
24
|
+
return DESCRIPTION;
|
|
25
|
+
},
|
|
26
|
+
async prompt() {
|
|
27
|
+
return PROMPT;
|
|
28
|
+
},
|
|
29
|
+
inputSchema,
|
|
30
|
+
userFacingName() {
|
|
31
|
+
return "Create Team";
|
|
32
|
+
},
|
|
33
|
+
async isEnabled() {
|
|
34
|
+
return isAgentTeamsEnabled();
|
|
35
|
+
},
|
|
36
|
+
isReadOnly() {
|
|
37
|
+
return false;
|
|
38
|
+
},
|
|
39
|
+
isConcurrencySafe() {
|
|
40
|
+
return false;
|
|
41
|
+
},
|
|
42
|
+
needsPermissions() {
|
|
43
|
+
return false;
|
|
44
|
+
},
|
|
45
|
+
renderToolUseMessage(input) {
|
|
46
|
+
return `"${input.team_name || ""}"`;
|
|
47
|
+
},
|
|
48
|
+
renderToolUseRejectedMessage() {
|
|
49
|
+
return /* @__PURE__ */ React.createElement(FallbackToolUseRejectedMessage, null);
|
|
50
|
+
},
|
|
51
|
+
renderToolResultMessage(output) {
|
|
52
|
+
if (!output || !output.team_name) {
|
|
53
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React.createElement(Text, null, "Team created"));
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React.createElement(Text, { color: getTheme().success }, 'Team "', output.team_name, '" created'));
|
|
56
|
+
},
|
|
57
|
+
renderResultForAssistant(result) {
|
|
58
|
+
if (result.error) {
|
|
59
|
+
return `Error creating team: ${result.error}`;
|
|
60
|
+
}
|
|
61
|
+
return `Team "${result.team_name}" created successfully.
|
|
62
|
+
team_name: ${result.team_name}
|
|
63
|
+
team_file_path: ${result.team_file_path}
|
|
64
|
+
lead_agent_id: ${result.lead_agent_id}
|
|
65
|
+
|
|
66
|
+
## Next Steps (REQUIRED):
|
|
67
|
+
1. Create tasks with TaskCreate for each unit of work
|
|
68
|
+
2. Spawn teammates with Task tool (team_name="${result.team_name}", name="<agent-name>") \u2014 launch in parallel
|
|
69
|
+
3. Wait for agents to complete (they send idle notifications automatically)
|
|
70
|
+
4. Collect results and summarize for the user
|
|
71
|
+
5. Send shutdown_request to each agent via SendMessage
|
|
72
|
+
6. Call TeamDelete to clean up
|
|
73
|
+
|
|
74
|
+
IMPORTANT: You MUST actually spawn teammates using the Task tool now. Do NOT just tell the user you spawned them \u2014 call the Task tool with team_name and name parameters.
|
|
75
|
+
|
|
76
|
+
CRITICAL: After presenting your final answer, you MUST send shutdown_request to ALL teammates, then call TeamDelete. Skipping cleanup leaves a broken team panel visible to the user.`;
|
|
77
|
+
},
|
|
78
|
+
async validateInput({ team_name }) {
|
|
79
|
+
if (!team_name?.trim()) {
|
|
80
|
+
return {
|
|
81
|
+
result: false,
|
|
82
|
+
message: "Team name cannot be empty"
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const sanitized = sanitizeTeamName(team_name);
|
|
86
|
+
if (!sanitized || !/[a-z0-9]/.test(sanitized)) {
|
|
87
|
+
return {
|
|
88
|
+
result: false,
|
|
89
|
+
message: "Team name must contain at least one alphanumeric character"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return { result: true };
|
|
93
|
+
},
|
|
94
|
+
async *call(input) {
|
|
95
|
+
try {
|
|
96
|
+
const sanitizedName = sanitizeTeamName(input.team_name);
|
|
97
|
+
const team = createTeam({
|
|
98
|
+
name: sanitizedName,
|
|
99
|
+
displayMode: "auto",
|
|
100
|
+
maxTeammates: 10,
|
|
101
|
+
description: input.description
|
|
102
|
+
});
|
|
103
|
+
addTeammate(team.name, {
|
|
104
|
+
id: `team-lead@${team.name}`,
|
|
105
|
+
name: "team-lead",
|
|
106
|
+
agentType: input.agent_type || "leader",
|
|
107
|
+
status: "idle",
|
|
108
|
+
prompt: "",
|
|
109
|
+
color: "white"
|
|
110
|
+
});
|
|
111
|
+
const result = {
|
|
112
|
+
team_name: team.name,
|
|
113
|
+
team_file_path: `~/.minto/teams/${team.name}/config.json`,
|
|
114
|
+
lead_agent_id: `team-lead@${team.name}`
|
|
115
|
+
};
|
|
116
|
+
yield {
|
|
117
|
+
type: "result",
|
|
118
|
+
data: result,
|
|
119
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
120
|
+
};
|
|
121
|
+
} catch (error) {
|
|
122
|
+
yield createToolErrorResult(error, "Error creating team");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
TeamCreateTool
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=TeamCreateTool.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/tools/TeamCreateTool/TeamCreateTool.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Box, Text } from 'ink'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool } from '@tool'\nimport { createToolErrorResult } from '@utils/tooling/toolError'\nimport {\n isAgentTeamsEnabled,\n sanitizeTeamName,\n createTeam,\n addTeammate,\n} from '@services/agentTeams'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { getTheme } from '@utils/theme'\n\nconst inputSchema = z.strictObject({\n team_name: z.string().describe('Name for the new team to create.'),\n description: z.string().optional().describe('Team description/purpose.'),\n agent_type: z\n .string()\n .optional()\n .describe(\n 'Type/role of the team lead (e.g., \"researcher\", \"test-runner\"). Used for team file and inter-agent coordination.',\n ),\n})\n\nexport const TeamCreateTool = {\n name: 'TeamCreate',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Create Team'\n },\n async isEnabled() {\n return isAgentTeamsEnabled()\n },\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return false\n },\n needsPermissions() {\n return false\n },\n renderToolUseMessage(input: z.infer<typeof inputSchema>) {\n return `\"${input.team_name || ''}\"`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: {\n team_name: string\n team_file_path: string\n }) {\n if (!output || !output.team_name) {\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text>Team created</Text>\n </Box>\n )\n }\n\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text color={getTheme().success}>\n Team "{output.team_name}" created\n </Text>\n </Box>\n )\n },\n renderResultForAssistant(result: {\n team_name?: string\n team_file_path?: string\n lead_agent_id?: string\n error?: string\n }) {\n if (result.error) {\n return `Error creating team: ${result.error}`\n }\n return `Team \"${result.team_name}\" created successfully.\nteam_name: ${result.team_name}\nteam_file_path: ${result.team_file_path}\nlead_agent_id: ${result.lead_agent_id}\n\n## Next Steps (REQUIRED):\n1. Create tasks with TaskCreate for each unit of work\n2. Spawn teammates with Task tool (team_name=\"${result.team_name}\", name=\"<agent-name>\") \u2014 launch in parallel\n3. Wait for agents to complete (they send idle notifications automatically)\n4. Collect results and summarize for the user\n5. Send shutdown_request to each agent via SendMessage\n6. Call TeamDelete to clean up\n\nIMPORTANT: You MUST actually spawn teammates using the Task tool now. Do NOT just tell the user you spawned them \u2014 call the Task tool with team_name and name parameters.\n\nCRITICAL: After presenting your final answer, you MUST send shutdown_request to ALL teammates, then call TeamDelete. Skipping cleanup leaves a broken team panel visible to the user.`\n },\n async validateInput({ team_name }: z.infer<typeof inputSchema>) {\n if (!team_name?.trim()) {\n return {\n result: false as const,\n message: 'Team name cannot be empty',\n }\n }\n const sanitized = sanitizeTeamName(team_name)\n if (!sanitized || !/[a-z0-9]/.test(sanitized)) {\n return {\n result: false as const,\n message: 'Team name must contain at least one alphanumeric character',\n }\n }\n return { result: true as const }\n },\n async *call(input: z.infer<typeof inputSchema>) {\n try {\n const sanitizedName = sanitizeTeamName(input.team_name)\n const team = createTeam({\n name: sanitizedName,\n displayMode: 'auto',\n maxTeammates: 10,\n description: input.description,\n })\n\n // Register team-lead as initial member so it appears in the panel\n addTeammate(team.name, {\n id: `team-lead@${team.name}`,\n name: 'team-lead',\n agentType: input.agent_type || 'leader',\n status: 'idle',\n prompt: '',\n color: 'white',\n })\n\n const result = {\n team_name: team.name,\n team_file_path: `~/.minto/teams/${team.name}/config.json`,\n lead_agent_id: `team-lead@${team.name}`,\n }\n\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n } catch (error) {\n yield createToolErrorResult(error, 'Error creating team')\n }\n },\n} satisfies Tool\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,KAAK,YAAY;AAC1B,YAAY,WAAW;AACvB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAE/C,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,cAAc;AACpC,SAAS,gBAAgB;AAEzB,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,WAAW,EAAE,OAAO,EAAE,SAAS,kCAAkC;AAAA,EACjE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,2BAA2B;AAAA,EACvE,YAAY,EACT,OAAO,EACP,SAAS,EACT;AAAA,IACC;AAAA,EACF;AACJ,CAAC;AAEM,MAAM,iBAAiB;AAAA,EAC5B,MAAM;AAAA,EACN,MAAM,cAAc;AAClB,WAAO;AAAA,EACT;AAAA,EACA,MAAM,SAAS;AACb,WAAO;AAAA,EACT;AAAA,EACA;AAAA,EACA,iBAAi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,SAAS;AAAA,MACX;AAAA,IACF;AACA,WAAO,EAAE,QAAQ,KAAc;AAAA,EACjC;AAAA,EACA,OAAO,KAAK,OAAoC;AAC9C,QAAI;AACF,YAAM,gBAAgB,iBAAiB,MAAM,SAAS;AACtD,YAAM,OAAO,WAAW;AAAA,QACtB,MAAM;AAAA,QACN,aAAa;AAAA,QACb,cAAc;AAAA,QACd,aAAa,MAAM;AAAA,MACrB,CAAC;AAGD,kBAAY,KAAK,MAAM;AAAA,QACrB,IAAI,aAAa,KAAK,IAAI;AAAA,QAC1B,MAAM;AAAA,QACN,WAAW,MAAM,cAAc;AAAA,QAC/B,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,OAAO;AAAA,MACT,CAAC;AAED,YAAM,SAAS;AAAA,QACb,WAAW,KAAK;AAAA,QAChB,gBAAgB,kBAAkB,KAAK,IAAI;AAAA,QAC3C,eAAe,aAAa,KAAK,IAAI;AAAA,MACvC;AAEA,YAAM;AAAA,QACJ,MAAM;AAAA,QACN,MAAM;AAAA,QACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,MAC1D;AAAA,IACF,SAAS,OAAO;AACd,YAAM,sBAAsB,OAAO,qBAAqB;AAAA,IAC1D;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const PROMPT = `# TeamCreate
|
|
2
|
+
|
|
3
|
+
## When to Use
|
|
4
|
+
|
|
5
|
+
Use this tool proactively whenever:
|
|
6
|
+
- The user explicitly asks to use a team, swarm, or group of agents
|
|
7
|
+
- A task benefits from parallel work by multiple agents (e.g., full-stack features, multi-step projects)
|
|
8
|
+
|
|
9
|
+
When spawning teammates via the Agent tool, choose the \`subagent_type\` based on what tools the agent needs:
|
|
10
|
+
- **Read-only agents** (Explore, Plan): research/planning only, cannot edit files
|
|
11
|
+
- **Full-capability agents** (general-purpose): all tools including editing and bash
|
|
12
|
+
- **Custom agents** (\`.claude/agents/\`): check their descriptions for tool restrictions
|
|
13
|
+
|
|
14
|
+
**Permission note**: Teammates run with 'acceptEdits' permission mode \u2014 they can edit files and run commands within the project directory without user confirmation.
|
|
15
|
+
|
|
16
|
+
Create a team to coordinate multiple agents working on a project. Teams have a 1:1 correspondence with task lists.
|
|
17
|
+
|
|
18
|
+
## Team Workflow
|
|
19
|
+
|
|
20
|
+
1. **Create a team** with TeamCreate
|
|
21
|
+
2. **Create tasks** using TaskCreate \u2014 they automatically use the team's task list
|
|
22
|
+
3. **Spawn teammates** using the Agent tool with \`team_name\` and \`name\` parameters
|
|
23
|
+
4. **Assign tasks** using TaskUpdate with \`owner\`
|
|
24
|
+
5. **Teammates work** on assigned tasks and mark them completed via TaskUpdate
|
|
25
|
+
6. **Teammates go idle between turns** \u2014 this is normal. Be patient with idle teammates.
|
|
26
|
+
7. **Shutdown your team** \u2014 send shutdown_request via SendMessage, then call TeamDelete to clean up
|
|
27
|
+
|
|
28
|
+
## CRITICAL: Team Cleanup \u2014 NEVER SKIP
|
|
29
|
+
|
|
30
|
+
You MUST call TeamDelete after composing your final answer. Failing to do so leaves stale team state.
|
|
31
|
+
|
|
32
|
+
## Automatic Message Delivery
|
|
33
|
+
|
|
34
|
+
Messages from teammates are delivered automatically as new conversation turns. You do NOT need to manually check inboxes. When reporting on teammate messages, you do NOT need to quote them \u2014 they're already rendered.
|
|
35
|
+
|
|
36
|
+
## Teammate Idle State
|
|
37
|
+
|
|
38
|
+
Teammates go idle after every turn \u2014 this is completely normal. Idle means waiting for input, not done or unavailable. Sending a message to an idle teammate wakes them up. Do not treat idle as an error.
|
|
39
|
+
|
|
40
|
+
## Task List Coordination
|
|
41
|
+
|
|
42
|
+
Teams share a task list at \`~/.minto/tasks/{team-name}/\`. Teammates should:
|
|
43
|
+
1. Check TaskList after completing each task to find available work
|
|
44
|
+
2. Claim unassigned tasks with TaskUpdate (prefer lowest ID first)
|
|
45
|
+
3. Mark tasks completed, then check TaskList for next work
|
|
46
|
+
|
|
47
|
+
**Communication rules**:
|
|
48
|
+
- Always refer to teammates by NAME, never by UUID
|
|
49
|
+
- Your team cannot hear you without SendMessage
|
|
50
|
+
- Do NOT send structured JSON status messages \u2014 use plain text
|
|
51
|
+
- Do NOT reply to simple status/completion notifications \u2014 process silently
|
|
52
|
+
- Use TaskUpdate to mark tasks completed`;
|
|
53
|
+
const DESCRIPTION = `Create a new team to coordinate multiple agents working on a project`;
|
|
54
|
+
export {
|
|
55
|
+
DESCRIPTION,
|
|
56
|
+
PROMPT
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/tools/TeamCreateTool/prompt.ts"],
|
|
4
|
+
"sourcesContent": ["export const PROMPT = `# TeamCreate\n\n## When to Use\n\nUse this tool proactively whenever:\n- The user explicitly asks to use a team, swarm, or group of agents\n- A task benefits from parallel work by multiple agents (e.g., full-stack features, multi-step projects)\n\nWhen spawning teammates via the Agent tool, choose the \\`subagent_type\\` based on what tools the agent needs:\n- **Read-only agents** (Explore, Plan): research/planning only, cannot edit files\n- **Full-capability agents** (general-purpose): all tools including editing and bash\n- **Custom agents** (\\`.claude/agents/\\`): check their descriptions for tool restrictions\n\n**Permission note**: Teammates run with 'acceptEdits' permission mode \u2014 they can edit files and run commands within the project directory without user confirmation.\n\nCreate a team to coordinate multiple agents working on a project. Teams have a 1:1 correspondence with task lists.\n\n## Team Workflow\n\n1. **Create a team** with TeamCreate\n2. **Create tasks** using TaskCreate \u2014 they automatically use the team's task list\n3. **Spawn teammates** using the Agent tool with \\`team_name\\` and \\`name\\` parameters\n4. **Assign tasks** using TaskUpdate with \\`owner\\`\n5. **Teammates work** on assigned tasks and mark them completed via TaskUpdate\n6. **Teammates go idle between turns** \u2014 this is normal. Be patient with idle teammates.\n7. **Shutdown your team** \u2014 send shutdown_request via SendMessage, then call TeamDelete to clean up\n\n## CRITICAL: Team Cleanup \u2014 NEVER SKIP\n\nYou MUST call TeamDelete after composing your final answer. Failing to do so leaves stale team state.\n\n## Automatic Message Delivery\n\nMessages from teammates are delivered automatically as new conversation turns. You do NOT need to manually check inboxes. When reporting on teammate messages, you do NOT need to quote them \u2014 they're already rendered.\n\n## Teammate Idle State\n\nTeammates go idle after every turn \u2014 this is completely normal. Idle means waiting for input, not done or unavailable. Sending a message to an idle teammate wakes them up. Do not treat idle as an error.\n\n## Task List Coordination\n\nTeams share a task list at \\`~/.minto/tasks/{team-name}/\\`. Teammates should:\n1. Check TaskList after completing each task to find available work\n2. Claim unassigned tasks with TaskUpdate (prefer lowest ID first)\n3. Mark tasks completed, then check TaskList for next work\n\n**Communication rules**:\n- Always refer to teammates by NAME, never by UUID\n- Your team cannot hear you without SendMessage\n- Do NOT send structured JSON status messages \u2014 use plain text\n- Do NOT reply to simple status/completion notifications \u2014 process silently\n- Use TaskUpdate to mark tasks completed`\n\nexport const DESCRIPTION = `Create a new team to coordinate multiple agents working on a project`\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqDf,MAAM,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|