@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,88 +1,37 @@
|
|
|
1
1
|
const ENTER_TOOL_NAME = "EnterPlanMode";
|
|
2
2
|
const EXIT_TOOL_NAME = "ExitPlanMode";
|
|
3
3
|
const ENTER_DESCRIPTION = "Requests permission to enter plan mode for complex tasks requiring exploration and design";
|
|
4
|
-
const ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment.
|
|
4
|
+
const ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment.
|
|
5
5
|
|
|
6
|
-
## When to Use
|
|
6
|
+
## When to Use
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Prefer using EnterPlanMode for implementation tasks unless they're simple. Use when:
|
|
9
|
+
- New features with design decisions needed
|
|
10
|
+
- Multiple valid technical approaches exist
|
|
11
|
+
- Modifying existing code behavior or structure
|
|
12
|
+
- Architectural decisions (patterns, technologies)
|
|
13
|
+
- Changes spanning 3+ files
|
|
14
|
+
- Requirements need exploration first
|
|
15
|
+
- If you would use AskUserQuestion to clarify approach, use EnterPlanMode instead
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
- Example: "Add a logout button" - where should it go? What should happen on click?
|
|
12
|
-
- Example: "Add form validation" - what rules? What error messages?
|
|
17
|
+
## When NOT to Use
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
- Simple fixes (typos, obvious bugs, minor tweaks)
|
|
20
|
+
- Single-function additions with clear specs
|
|
21
|
+
- Tasks with explicit, detailed user instructions
|
|
22
|
+
- Pure research/exploration (use Agent tool with Explore type instead)
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
- Example: "Update the login flow" - what exactly should change?
|
|
20
|
-
- Example: "Refactor this component" - what's the target architecture?
|
|
24
|
+
## Important
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Example: "Implement state management" - Redux vs Context vs custom solution
|
|
25
|
-
|
|
26
|
-
5. **Multi-File Changes**: The task will likely touch more than 2-3 files
|
|
27
|
-
- Example: "Refactor the authentication system"
|
|
28
|
-
- Example: "Add a new API endpoint with tests"
|
|
29
|
-
|
|
30
|
-
6. **Unclear Requirements**: You need to explore before understanding the full scope
|
|
31
|
-
- Example: "Make the app faster" - need to profile and identify bottlenecks
|
|
32
|
-
- Example: "Fix the bug in checkout" - need to investigate root cause
|
|
33
|
-
|
|
34
|
-
7. **User Preferences Matter**: The implementation could reasonably go multiple ways
|
|
35
|
-
- If you would use AskUserQuestion to clarify the approach, use EnterPlanMode instead
|
|
36
|
-
- Plan mode lets you explore first, then present options with context
|
|
37
|
-
|
|
38
|
-
## When NOT to Use This Tool
|
|
39
|
-
|
|
40
|
-
Only skip EnterPlanMode for simple tasks:
|
|
41
|
-
- Single-line or few-line fixes (typos, obvious bugs, small tweaks)
|
|
42
|
-
- Adding a single function with clear requirements
|
|
43
|
-
- Tasks where the user has given very specific, detailed instructions
|
|
44
|
-
- Pure research/exploration tasks (use the Task tool with explore agent instead)
|
|
45
|
-
|
|
46
|
-
## What Happens in Plan Mode
|
|
47
|
-
|
|
48
|
-
In plan mode, you'll:
|
|
49
|
-
1. Thoroughly explore the codebase using Glob, Grep, and View tools
|
|
50
|
-
2. Understand existing patterns and architecture
|
|
51
|
-
3. Design an implementation approach
|
|
52
|
-
4. Present your plan to the user for approval
|
|
53
|
-
5. Use AskUserQuestion if you need to clarify approaches
|
|
54
|
-
6. Exit plan mode with ExitPlanMode when ready to implement
|
|
55
|
-
|
|
56
|
-
## Important Notes
|
|
57
|
-
|
|
58
|
-
- This tool REQUIRES user approval - they must consent to entering plan mode
|
|
59
|
-
- If unsure whether to use it, err on the side of planning - it's better to get alignment upfront than to redo work
|
|
60
|
-
- Users appreciate being consulted before significant changes are made to their codebase`;
|
|
26
|
+
- This tool REQUIRES user approval \u2014 they must consent to entering plan mode
|
|
27
|
+
- If unsure, err on the side of planning \u2014 better to align upfront than redo work`;
|
|
61
28
|
const EXIT_DESCRIPTION = "Prompts the user to exit plan mode and start coding";
|
|
62
|
-
const EXIT_PROMPT = `Use this tool when you are in plan mode
|
|
63
|
-
|
|
64
|
-
## How This Tool Works
|
|
65
|
-
- You should have already written your plan to the plan file specified in the plan mode system message
|
|
66
|
-
- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
|
|
67
|
-
- This tool simply signals that you're done planning and ready for the user to review and approve
|
|
68
|
-
- The user will see the contents of your plan file when they review it
|
|
69
|
-
|
|
70
|
-
## When to Use This Tool
|
|
71
|
-
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
72
|
-
|
|
73
|
-
## Handling Ambiguity in Plans
|
|
74
|
-
Before using this tool, ensure your plan is clear and unambiguous. If there are multiple valid approaches or unclear requirements:
|
|
75
|
-
1. Use the AskUserQuestion tool to clarify with the user
|
|
76
|
-
2. Ask about specific implementation choices (e.g., architectural patterns, which library to use)
|
|
77
|
-
3. Clarify any assumptions that could affect the implementation
|
|
78
|
-
4. Edit your plan file to incorporate user feedback
|
|
79
|
-
5. Only proceed with ExitPlanMode after resolving ambiguities and updating the plan file
|
|
80
|
-
|
|
81
|
-
## Examples
|
|
29
|
+
const EXIT_PROMPT = `Use this tool when you are in plan mode, have finished writing your plan to the plan file, and are ready for user approval.
|
|
82
30
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
31
|
+
- This tool reads the plan from the file you wrote \u2014 it does NOT take plan content as a parameter
|
|
32
|
+
- Only use for implementation planning tasks, NOT for pure research/exploration
|
|
33
|
+
- Before calling, ensure your plan is clear and unambiguous \u2014 use AskUserQuestion to resolve ambiguities first
|
|
34
|
+
- Do NOT use this tool to ask "Is this plan okay?" \u2014 that's its inherent function`;
|
|
86
35
|
export {
|
|
87
36
|
ENTER_DESCRIPTION,
|
|
88
37
|
ENTER_PROMPT,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/tools/PlanModeTool/prompt.ts"],
|
|
4
|
-
"sourcesContent": ["export const ENTER_TOOL_NAME = 'EnterPlanMode'\nexport const EXIT_TOOL_NAME = 'ExitPlanMode'\n\nexport const ENTER_DESCRIPTION =\n 'Requests permission to enter plan mode for complex tasks requiring exploration and design'\n\nexport const ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment
|
|
5
|
-
"mappings": "AAAO,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AAEvB,MAAM,oBACX;AAEK,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["export const ENTER_TOOL_NAME = 'EnterPlanMode'\nexport const EXIT_TOOL_NAME = 'ExitPlanMode'\n\nexport const ENTER_DESCRIPTION =\n 'Requests permission to enter plan mode for complex tasks requiring exploration and design'\n\nexport const ENTER_PROMPT = `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment.\n\n## When to Use\n\nPrefer using EnterPlanMode for implementation tasks unless they're simple. Use when:\n- New features with design decisions needed\n- Multiple valid technical approaches exist\n- Modifying existing code behavior or structure\n- Architectural decisions (patterns, technologies)\n- Changes spanning 3+ files\n- Requirements need exploration first\n- If you would use AskUserQuestion to clarify approach, use EnterPlanMode instead\n\n## When NOT to Use\n\n- Simple fixes (typos, obvious bugs, minor tweaks)\n- Single-function additions with clear specs\n- Tasks with explicit, detailed user instructions\n- Pure research/exploration (use Agent tool with Explore type instead)\n\n## Important\n\n- This tool REQUIRES user approval \u2014 they must consent to entering plan mode\n- If unsure, err on the side of planning \u2014 better to align upfront than redo work`\n\nexport const EXIT_DESCRIPTION =\n 'Prompts the user to exit plan mode and start coding'\n\nexport const EXIT_PROMPT = `Use this tool when you are in plan mode, have finished writing your plan to the plan file, and are ready for user approval.\n\n- This tool reads the plan from the file you wrote \u2014 it does NOT take plan content as a parameter\n- Only use for implementation planning tasks, NOT for pure research/exploration\n- Before calling, ensure your plan is clear and unambiguous \u2014 use AskUserQuestion to resolve ambiguities first\n- Do NOT use this tool to ask \"Is this plan okay?\" \u2014 that's its inherent function`\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AAEvB,MAAM,oBACX;AAEK,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBrB,MAAM,mBACX;AAEK,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,341 @@
|
|
|
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
|
+
getTeam,
|
|
9
|
+
getActiveTeams
|
|
10
|
+
} from "../../services/agentTeams/index.js";
|
|
11
|
+
import { DESCRIPTION, PROMPT } from "./prompt.js";
|
|
12
|
+
import { getTheme } from "../../utils/theme.js";
|
|
13
|
+
const inputSchema = z.strictObject({
|
|
14
|
+
type: z.enum([
|
|
15
|
+
"message",
|
|
16
|
+
"broadcast",
|
|
17
|
+
"shutdown_request",
|
|
18
|
+
"shutdown_response",
|
|
19
|
+
"plan_approval_response"
|
|
20
|
+
]).describe(
|
|
21
|
+
'Message type: "message" for DMs, "broadcast" to all teammates, "shutdown_request" to request shutdown, "shutdown_response" to respond to shutdown, "plan_approval_response" to approve/reject plans'
|
|
22
|
+
),
|
|
23
|
+
recipient: z.string().optional().describe(
|
|
24
|
+
"Agent name of the recipient (required for message, shutdown_request, plan_approval_response)"
|
|
25
|
+
),
|
|
26
|
+
content: z.string().optional().describe("Message text, reason, or feedback"),
|
|
27
|
+
summary: z.string().optional().describe(
|
|
28
|
+
"A 5-10 word summary of the message, shown as a preview in the UI (required for message, broadcast)"
|
|
29
|
+
),
|
|
30
|
+
request_id: z.string().optional().describe(
|
|
31
|
+
"Request ID to respond to (required for shutdown_response, plan_approval_response)"
|
|
32
|
+
),
|
|
33
|
+
approve: z.boolean().optional().describe(
|
|
34
|
+
"Whether to approve the request (required for shutdown_response, plan_approval_response)"
|
|
35
|
+
)
|
|
36
|
+
});
|
|
37
|
+
function findActiveTeam() {
|
|
38
|
+
const teams = getActiveTeams();
|
|
39
|
+
if (teams.length === 0) return null;
|
|
40
|
+
const teamName = teams[0].name;
|
|
41
|
+
return getTeam(teamName);
|
|
42
|
+
}
|
|
43
|
+
function resolveRecipientId(team, recipientName) {
|
|
44
|
+
if (recipientName.includes("@")) return recipientName;
|
|
45
|
+
const member = team.members.find((m) => m.name === recipientName);
|
|
46
|
+
if (member) return member.id;
|
|
47
|
+
return `${recipientName}@${team.name}`;
|
|
48
|
+
}
|
|
49
|
+
const SendMessageTool = {
|
|
50
|
+
name: "SendMessage",
|
|
51
|
+
async description() {
|
|
52
|
+
return DESCRIPTION;
|
|
53
|
+
},
|
|
54
|
+
async prompt() {
|
|
55
|
+
return PROMPT;
|
|
56
|
+
},
|
|
57
|
+
inputSchema,
|
|
58
|
+
userFacingName() {
|
|
59
|
+
return "Send Message";
|
|
60
|
+
},
|
|
61
|
+
async isEnabled() {
|
|
62
|
+
return isAgentTeamsEnabled();
|
|
63
|
+
},
|
|
64
|
+
isReadOnly() {
|
|
65
|
+
return false;
|
|
66
|
+
},
|
|
67
|
+
isConcurrencySafe() {
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
needsPermissions() {
|
|
71
|
+
return false;
|
|
72
|
+
},
|
|
73
|
+
renderToolUseMessage(input) {
|
|
74
|
+
const type = input.type || "message";
|
|
75
|
+
const target = input.recipient || "all";
|
|
76
|
+
const summary = input.summary || "";
|
|
77
|
+
if (type === "broadcast") {
|
|
78
|
+
return `broadcast: "${summary}"`;
|
|
79
|
+
}
|
|
80
|
+
return `\u2192 ${target}: "${summary}"`;
|
|
81
|
+
},
|
|
82
|
+
renderToolUseRejectedMessage() {
|
|
83
|
+
return /* @__PURE__ */ React.createElement(FallbackToolUseRejectedMessage, null);
|
|
84
|
+
},
|
|
85
|
+
renderToolResultMessage(output) {
|
|
86
|
+
if (!output) {
|
|
87
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React.createElement(Text, null, "Message sent"));
|
|
88
|
+
}
|
|
89
|
+
const color = output.success ? getTheme().success : getTheme().error;
|
|
90
|
+
const text = output.success ? `Sent${output.target ? ` to ${output.target}` : ""}` : output.message;
|
|
91
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "row" }, /* @__PURE__ */ React.createElement(Text, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React.createElement(Text, { color }, text));
|
|
92
|
+
},
|
|
93
|
+
renderResultForAssistant(result) {
|
|
94
|
+
return JSON.stringify(result);
|
|
95
|
+
},
|
|
96
|
+
async validateInput(input) {
|
|
97
|
+
const { type, recipient, content, request_id, approve, summary } = input;
|
|
98
|
+
switch (type) {
|
|
99
|
+
case "message":
|
|
100
|
+
if (!recipient?.trim()) {
|
|
101
|
+
return {
|
|
102
|
+
result: false,
|
|
103
|
+
message: "recipient is required for direct messages"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (!content?.trim()) {
|
|
107
|
+
return {
|
|
108
|
+
result: false,
|
|
109
|
+
message: "content is required for direct messages"
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (!summary?.trim()) {
|
|
113
|
+
return {
|
|
114
|
+
result: false,
|
|
115
|
+
message: "summary is required for direct messages"
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
case "broadcast":
|
|
120
|
+
if (!content?.trim()) {
|
|
121
|
+
return {
|
|
122
|
+
result: false,
|
|
123
|
+
message: "content is required for broadcast messages"
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (!summary?.trim()) {
|
|
127
|
+
return {
|
|
128
|
+
result: false,
|
|
129
|
+
message: "summary is required for broadcast messages"
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
case "shutdown_request":
|
|
134
|
+
if (!recipient?.trim()) {
|
|
135
|
+
return {
|
|
136
|
+
result: false,
|
|
137
|
+
message: "recipient is required for shutdown requests"
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
case "shutdown_response":
|
|
142
|
+
if (request_id == null || !request_id.trim()) {
|
|
143
|
+
return {
|
|
144
|
+
result: false,
|
|
145
|
+
message: "request_id is required for shutdown responses"
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (approve == null) {
|
|
149
|
+
return {
|
|
150
|
+
result: false,
|
|
151
|
+
message: "approve is required for shutdown responses"
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case "plan_approval_response":
|
|
156
|
+
if (request_id == null || !request_id.trim()) {
|
|
157
|
+
return {
|
|
158
|
+
result: false,
|
|
159
|
+
message: "request_id is required for plan approval responses"
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (!recipient?.trim()) {
|
|
163
|
+
return {
|
|
164
|
+
result: false,
|
|
165
|
+
message: "recipient is required for plan approval responses"
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (approve == null) {
|
|
169
|
+
return {
|
|
170
|
+
result: false,
|
|
171
|
+
message: "approve is required for plan approval responses"
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
return { result: true };
|
|
177
|
+
},
|
|
178
|
+
async *call(input, context) {
|
|
179
|
+
try {
|
|
180
|
+
const teamEntry = findActiveTeam();
|
|
181
|
+
if (!teamEntry) {
|
|
182
|
+
yield {
|
|
183
|
+
type: "result",
|
|
184
|
+
data: { success: false, message: "No active team found" },
|
|
185
|
+
resultForAssistant: JSON.stringify({
|
|
186
|
+
success: false,
|
|
187
|
+
message: "No active team found. Create a team first with TeamCreate."
|
|
188
|
+
})
|
|
189
|
+
};
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const { team, mailbox } = teamEntry;
|
|
193
|
+
const senderId = context?.agentId || `team-lead@${team.name}`;
|
|
194
|
+
switch (input.type) {
|
|
195
|
+
case "message": {
|
|
196
|
+
const resolvedRecipient = resolveRecipientId(team, input.recipient);
|
|
197
|
+
const msg = mailbox.send(
|
|
198
|
+
senderId,
|
|
199
|
+
resolvedRecipient,
|
|
200
|
+
input.content,
|
|
201
|
+
{
|
|
202
|
+
summary: input.summary
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
const result = {
|
|
206
|
+
success: true,
|
|
207
|
+
message: `Message sent to ${input.recipient}`,
|
|
208
|
+
target: input.recipient
|
|
209
|
+
};
|
|
210
|
+
yield {
|
|
211
|
+
type: "result",
|
|
212
|
+
data: result,
|
|
213
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
214
|
+
};
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case "broadcast": {
|
|
218
|
+
mailbox.send(senderId, "all", input.content, {
|
|
219
|
+
summary: input.summary
|
|
220
|
+
});
|
|
221
|
+
const result = {
|
|
222
|
+
success: true,
|
|
223
|
+
message: `Broadcast sent to all teammates`
|
|
224
|
+
};
|
|
225
|
+
yield {
|
|
226
|
+
type: "result",
|
|
227
|
+
data: result,
|
|
228
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
229
|
+
};
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case "shutdown_request": {
|
|
233
|
+
const resolvedShutdownRecipient = resolveRecipientId(
|
|
234
|
+
team,
|
|
235
|
+
input.recipient
|
|
236
|
+
);
|
|
237
|
+
const requestId = `shutdown-${Date.now()}@${input.recipient}`;
|
|
238
|
+
const shutdownMsg = JSON.stringify({
|
|
239
|
+
type: "shutdown_request",
|
|
240
|
+
requestId,
|
|
241
|
+
from: senderId,
|
|
242
|
+
reason: input.content,
|
|
243
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
244
|
+
});
|
|
245
|
+
mailbox.send(senderId, resolvedShutdownRecipient, shutdownMsg);
|
|
246
|
+
const result = {
|
|
247
|
+
success: true,
|
|
248
|
+
message: `Shutdown request sent to ${input.recipient}. Request ID: ${requestId}`,
|
|
249
|
+
request_id: requestId,
|
|
250
|
+
target: input.recipient
|
|
251
|
+
};
|
|
252
|
+
yield {
|
|
253
|
+
type: "result",
|
|
254
|
+
data: result,
|
|
255
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
256
|
+
};
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
case "shutdown_response": {
|
|
260
|
+
if (input.approve) {
|
|
261
|
+
const responseMsg = JSON.stringify({
|
|
262
|
+
type: "shutdown_approved",
|
|
263
|
+
requestId: input.request_id,
|
|
264
|
+
from: senderId,
|
|
265
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
266
|
+
});
|
|
267
|
+
const leadId = `team-lead@${team.name}`;
|
|
268
|
+
mailbox.send(senderId, leadId, responseMsg);
|
|
269
|
+
const { updateTeammateStatus } = await import("../../services/agentTeams/teamManager.js");
|
|
270
|
+
updateTeammateStatus(team.name, senderId, "stopped");
|
|
271
|
+
const result = {
|
|
272
|
+
success: true,
|
|
273
|
+
message: "Shutdown approved. Terminating.",
|
|
274
|
+
shouldTerminate: true
|
|
275
|
+
};
|
|
276
|
+
yield {
|
|
277
|
+
type: "result",
|
|
278
|
+
data: result,
|
|
279
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
280
|
+
};
|
|
281
|
+
if (context?.abortController) {
|
|
282
|
+
context.abortController.abort();
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
const responseMsg = JSON.stringify({
|
|
286
|
+
type: "shutdown_rejected",
|
|
287
|
+
requestId: input.request_id,
|
|
288
|
+
from: senderId,
|
|
289
|
+
reason: input.content || "Rejected"
|
|
290
|
+
});
|
|
291
|
+
const rejectLeadId = `team-lead@${team.name}`;
|
|
292
|
+
mailbox.send(senderId, rejectLeadId, responseMsg);
|
|
293
|
+
const result = {
|
|
294
|
+
success: true,
|
|
295
|
+
message: `Shutdown rejected: ${input.content || "No reason given"}`
|
|
296
|
+
};
|
|
297
|
+
yield {
|
|
298
|
+
type: "result",
|
|
299
|
+
data: result,
|
|
300
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
case "plan_approval_response": {
|
|
306
|
+
const resolvedPlanRecipient = resolveRecipientId(
|
|
307
|
+
team,
|
|
308
|
+
input.recipient
|
|
309
|
+
);
|
|
310
|
+
const agentId = context?.agentId || senderId;
|
|
311
|
+
const baseResponse = {
|
|
312
|
+
type: input.approve ? "plan_approved" : "plan_rejected",
|
|
313
|
+
requestId: input.request_id,
|
|
314
|
+
from: agentId,
|
|
315
|
+
feedback: input.approve ? input.content || "" : input.content || "Plan rejected",
|
|
316
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
317
|
+
};
|
|
318
|
+
const responseMsg = JSON.stringify(baseResponse);
|
|
319
|
+
mailbox.send(senderId, resolvedPlanRecipient, responseMsg);
|
|
320
|
+
const result = {
|
|
321
|
+
success: true,
|
|
322
|
+
message: input.approve ? `Plan approved for ${input.recipient}` : `Plan rejected for ${input.recipient}: ${input.content || ""}`,
|
|
323
|
+
target: input.recipient
|
|
324
|
+
};
|
|
325
|
+
yield {
|
|
326
|
+
type: "result",
|
|
327
|
+
data: result,
|
|
328
|
+
resultForAssistant: this.renderResultForAssistant(result)
|
|
329
|
+
};
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
} catch (error) {
|
|
334
|
+
yield createToolErrorResult(error, "Error sending message");
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
export {
|
|
339
|
+
SendMessageTool
|
|
340
|
+
};
|
|
341
|
+
//# sourceMappingURL=SendMessageTool.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/tools/SendMessageTool/SendMessageTool.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Box, Text } from 'ink'\nimport * as React from 'react'\nimport { z } from 'zod'\nimport { FallbackToolUseRejectedMessage } from '@components/FallbackToolUseRejectedMessage'\nimport { Tool, ToolUseContext } from '@tool'\nimport { createToolErrorResult } from '@utils/tooling/toolError'\nimport type { Team } from '../../types/agentTeams'\nimport {\n isAgentTeamsEnabled,\n getTeam,\n getActiveTeams,\n} from '@services/agentTeams'\nimport { DESCRIPTION, PROMPT } from './prompt'\nimport { getTheme } from '@utils/theme'\n\nconst inputSchema = z.strictObject({\n type: z\n .enum([\n 'message',\n 'broadcast',\n 'shutdown_request',\n 'shutdown_response',\n 'plan_approval_response',\n ])\n .describe(\n 'Message type: \"message\" for DMs, \"broadcast\" to all teammates, \"shutdown_request\" to request shutdown, \"shutdown_response\" to respond to shutdown, \"plan_approval_response\" to approve/reject plans',\n ),\n recipient: z\n .string()\n .optional()\n .describe(\n 'Agent name of the recipient (required for message, shutdown_request, plan_approval_response)',\n ),\n content: z.string().optional().describe('Message text, reason, or feedback'),\n summary: z\n .string()\n .optional()\n .describe(\n 'A 5-10 word summary of the message, shown as a preview in the UI (required for message, broadcast)',\n ),\n request_id: z\n .string()\n .optional()\n .describe(\n 'Request ID to respond to (required for shutdown_response, plan_approval_response)',\n ),\n approve: z\n .boolean()\n .optional()\n .describe(\n 'Whether to approve the request (required for shutdown_response, plan_approval_response)',\n ),\n})\n\n/**\n * Find the active team for the current session\n */\nfunction findActiveTeam() {\n const teams = getActiveTeams()\n if (teams.length === 0) return null\n // Use the first active team (typically there's only one per session)\n const teamName = teams[0]!.name\n return getTeam(teamName)\n}\n\n/**\n * Resolve a recipient name to a full mailbox ID.\n *\n * AI models typically use short names like \"researcher\", but the mailbox\n * routes by full IDs like \"researcher@team-name\". This function bridges\n * the gap by looking up the member's ID from the team registry.\n */\nfunction resolveRecipientId(team: Team, recipientName: string): string {\n // Already a full ID (contains @) \u2014 pass through\n if (recipientName.includes('@')) return recipientName\n // Look up by member name\n const member = team.members.find(m => m.name === recipientName)\n if (member) return member.id\n // Fallback: construct conventional ID\n return `${recipientName}@${team.name}`\n}\n\nexport const SendMessageTool = {\n name: 'SendMessage',\n async description() {\n return DESCRIPTION\n },\n async prompt() {\n return PROMPT\n },\n inputSchema,\n userFacingName() {\n return 'Send Message'\n },\n async isEnabled() {\n return isAgentTeamsEnabled()\n },\n isReadOnly() {\n return false\n },\n isConcurrencySafe() {\n return true\n },\n needsPermissions() {\n return false\n },\n renderToolUseMessage(input: z.infer<typeof inputSchema>) {\n const type = input.type || 'message'\n const target = input.recipient || 'all'\n const summary = input.summary || ''\n if (type === 'broadcast') {\n return `broadcast: \"${summary}\"`\n }\n return `\u2192 ${target}: \"${summary}\"`\n },\n renderToolUseRejectedMessage() {\n return <FallbackToolUseRejectedMessage />\n },\n renderToolResultMessage(output: {\n success: boolean\n message: string\n target?: string\n }) {\n if (!output) {\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text>Message sent</Text>\n </Box>\n )\n }\n\n const color = output.success ? getTheme().success : getTheme().error\n const text = output.success\n ? `Sent${output.target ? ` to ${output.target}` : ''}`\n : output.message\n return (\n <Box flexDirection=\"row\">\n <Text> \u23BF </Text>\n <Text color={color}>{text}</Text>\n </Box>\n )\n },\n renderResultForAssistant(result: {\n success: boolean\n message: string\n request_id?: string\n target?: string\n }) {\n return JSON.stringify(result)\n },\n async validateInput(input: z.infer<typeof inputSchema>) {\n const { type, recipient, content, request_id, approve, summary } = input\n\n // Validate required fields per message type\n switch (type) {\n case 'message':\n if (!recipient?.trim()) {\n return {\n result: false as const,\n message: 'recipient is required for direct messages',\n }\n }\n if (!content?.trim()) {\n return {\n result: false as const,\n message: 'content is required for direct messages',\n }\n }\n if (!summary?.trim()) {\n return {\n result: false as const,\n message: 'summary is required for direct messages',\n }\n }\n break\n\n case 'broadcast':\n if (!content?.trim()) {\n return {\n result: false as const,\n message: 'content is required for broadcast messages',\n }\n }\n if (!summary?.trim()) {\n return {\n result: false as const,\n message: 'summary is required for broadcast messages',\n }\n }\n break\n\n case 'shutdown_request':\n if (!recipient?.trim()) {\n return {\n result: false as const,\n message: 'recipient is required for shutdown requests',\n }\n }\n break\n\n case 'shutdown_response':\n if (request_id == null || !request_id.trim()) {\n return {\n result: false as const,\n message: 'request_id is required for shutdown responses',\n }\n }\n if (approve == null) {\n return {\n result: false as const,\n message: 'approve is required for shutdown responses',\n }\n }\n break\n\n case 'plan_approval_response':\n if (request_id == null || !request_id.trim()) {\n return {\n result: false as const,\n message: 'request_id is required for plan approval responses',\n }\n }\n if (!recipient?.trim()) {\n return {\n result: false as const,\n message: 'recipient is required for plan approval responses',\n }\n }\n if (approve == null) {\n return {\n result: false as const,\n message: 'approve is required for plan approval responses',\n }\n }\n break\n }\n\n return { result: true as const }\n },\n async *call(input: z.infer<typeof inputSchema>, context: ToolUseContext) {\n try {\n const teamEntry = findActiveTeam()\n if (!teamEntry) {\n yield {\n type: 'result' as const,\n data: { success: false, message: 'No active team found' },\n resultForAssistant: JSON.stringify({\n success: false,\n message:\n 'No active team found. Create a team first with TeamCreate.',\n }),\n }\n return\n }\n\n const { team, mailbox } = teamEntry\n // Use the caller's agentId from context, fall back to team-lead@teamname\n const senderId = context?.agentId || `team-lead@${team.name}`\n\n switch (input.type) {\n case 'message': {\n const resolvedRecipient = resolveRecipientId(team, input.recipient!)\n const msg = mailbox.send(\n senderId,\n resolvedRecipient,\n input.content!,\n {\n summary: input.summary,\n },\n )\n const result = {\n success: true,\n message: `Message sent to ${input.recipient}`,\n target: input.recipient,\n }\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n break\n }\n\n case 'broadcast': {\n mailbox.send(senderId, 'all', input.content!, {\n summary: input.summary,\n })\n const result = {\n success: true,\n message: `Broadcast sent to all teammates`,\n }\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n break\n }\n\n case 'shutdown_request': {\n const resolvedShutdownRecipient = resolveRecipientId(\n team,\n input.recipient!,\n )\n const requestId = `shutdown-${Date.now()}@${input.recipient}`\n const shutdownMsg = JSON.stringify({\n type: 'shutdown_request',\n requestId,\n from: senderId,\n reason: input.content,\n timestamp: new Date().toISOString(),\n })\n mailbox.send(senderId, resolvedShutdownRecipient, shutdownMsg)\n const result = {\n success: true,\n message: `Shutdown request sent to ${input.recipient}. Request ID: ${requestId}`,\n request_id: requestId,\n target: input.recipient,\n }\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n break\n }\n\n case 'shutdown_response': {\n if (input.approve) {\n const responseMsg = JSON.stringify({\n type: 'shutdown_approved',\n requestId: input.request_id,\n from: senderId,\n timestamp: new Date().toISOString(),\n })\n const leadId = `team-lead@${team.name}`\n mailbox.send(senderId, leadId, responseMsg)\n\n // Mark teammate as stopped in team registry\n const { updateTeammateStatus } = await import(\n '@services/agentTeams/teamManager'\n )\n updateTeammateStatus(team.name, senderId, 'stopped')\n\n const result = {\n success: true,\n message: 'Shutdown approved. Terminating.',\n shouldTerminate: true,\n }\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n\n // Signal the abort controller to terminate the running agent\n if (context?.abortController) {\n context.abortController.abort()\n }\n } else {\n const responseMsg = JSON.stringify({\n type: 'shutdown_rejected',\n requestId: input.request_id,\n from: senderId,\n reason: input.content || 'Rejected',\n })\n const rejectLeadId = `team-lead@${team.name}`\n mailbox.send(senderId, rejectLeadId, responseMsg)\n const result = {\n success: true,\n message: `Shutdown rejected: ${input.content || 'No reason given'}`,\n }\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n }\n break\n }\n\n case 'plan_approval_response': {\n const resolvedPlanRecipient = resolveRecipientId(\n team,\n input.recipient!,\n )\n const agentId = context?.agentId || senderId\n const baseResponse: Record<string, unknown> = {\n type: input.approve ? 'plan_approved' : 'plan_rejected',\n requestId: input.request_id,\n from: agentId,\n feedback: input.approve\n ? input.content || ''\n : input.content || 'Plan rejected',\n timestamp: new Date().toISOString(),\n }\n const responseMsg = JSON.stringify(baseResponse)\n mailbox.send(senderId, resolvedPlanRecipient, responseMsg)\n const result = {\n success: true,\n message: input.approve\n ? `Plan approved for ${input.recipient}`\n : `Plan rejected for ${input.recipient}: ${input.content || ''}`,\n target: input.recipient,\n }\n yield {\n type: 'result' as const,\n data: result,\n resultForAssistant: this.renderResultForAssistant(result),\n }\n break\n }\n }\n } catch (error) {\n yield createToolErrorResult(error, 'Error sending message')\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;AAEtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,cAAc;AACpC,SAAS,gBAAgB;AAEzB,MAAM,cAAc,EAAE,aAAa;AAAA,EACjC,MAAM,EACH,KAAK;AAAA,IACJ;AAAA,IACA;A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AK,0BAA0B;AAC7B,gBAAM,wBAAwB;AAAA,YAC5B;AAAA,YACA,MAAM;AAAA,UACR;AACA,gBAAM,UAAU,SAAS,WAAW;AACpC,gBAAM,eAAwC;AAAA,YAC5C,MAAM,MAAM,UAAU,kBAAkB;AAAA,YACxC,WAAW,MAAM;AAAA,YACjB,MAAM;AAAA,YACN,UAAU,MAAM,UACZ,MAAM,WAAW,KACjB,MAAM,WAAW;AAAA,YACrB,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,UACpC;AACA,gBAAM,cAAc,KAAK,UAAU,YAAY;AAC/C,kBAAQ,KAAK,UAAU,uBAAuB,WAAW;AACzD,gBAAM,SAAS;AAAA,YACb,SAAS;AAAA,YACT,SAAS,MAAM,UACX,qBAAqB,MAAM,SAAS,KACpC,qBAAqB,MAAM,SAAS,KAAK,MAAM,WAAW,EAAE;AAAA,YAChE,QAAQ,MAAM;AAAA,UAChB;AACA,gBAAM;AAAA,YACJ,MAAM;AAAA,YACN,MAAM;AAAA,YACN,oBAAoB,KAAK,yBAAyB,MAAM;AAAA,UAC1D;AACA;AAAA,QACF;AAAA,MACF;AAAA,IACF,SAAS,OAAO;AACd,YAAM,sBAAsB,OAAO,uBAAuB;AAAA,IAC5D;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const PROMPT = `Send messages to agent teammates and handle protocol requests/responses in a team.
|
|
2
|
+
|
|
3
|
+
## Message Types
|
|
4
|
+
|
|
5
|
+
### type: "message" \u2014 Send a Direct Message (DEFAULT)
|
|
6
|
+
Send a message to a specific teammate. You MUST specify the recipient.
|
|
7
|
+
|
|
8
|
+
**IMPORTANT**: Your plain text output is NOT visible to teammates. You MUST use this tool to communicate.
|
|
9
|
+
|
|
10
|
+
Parameters: recipient (name, required), content (required), summary (5-10 word preview, required)
|
|
11
|
+
|
|
12
|
+
### type: "broadcast" \u2014 Send to ALL Teammates (USE SPARINGLY)
|
|
13
|
+
Send the same message to everyone. Broadcasting is expensive (N teammates = N deliveries).
|
|
14
|
+
Only use for critical team-wide issues. Default to "message" for normal communication.
|
|
15
|
+
|
|
16
|
+
Parameters: content (required), summary (required)
|
|
17
|
+
|
|
18
|
+
### type: "shutdown_request" \u2014 Request Teammate Shutdown
|
|
19
|
+
Ask a teammate to gracefully shut down. They can approve (exit) or reject (continue).
|
|
20
|
+
|
|
21
|
+
Parameters: recipient (required), content (optional reason)
|
|
22
|
+
|
|
23
|
+
### type: "shutdown_response" \u2014 Respond to Shutdown Request
|
|
24
|
+
When you receive a shutdown request JSON with \`type: "shutdown_request"\`, you MUST respond by calling this tool (not just text). Extract the \`requestId\` from the JSON and pass it as \`request_id\`.
|
|
25
|
+
|
|
26
|
+
Parameters: request_id (from the request JSON, required), approve (boolean, required), content (reason if rejecting)
|
|
27
|
+
|
|
28
|
+
### type: "plan_approval_response" \u2014 Approve/Reject Teammate Plan
|
|
29
|
+
When a teammate with \`plan_mode_required\` sends a plan approval request, respond here.
|
|
30
|
+
|
|
31
|
+
Parameters: request_id (required), recipient (required), approve (boolean, required), content (feedback if rejecting)
|
|
32
|
+
|
|
33
|
+
## Important Notes
|
|
34
|
+
- Messages from teammates are automatically delivered. No manual inbox checking needed.
|
|
35
|
+
- Always refer to teammates by NAME, never by UUID.
|
|
36
|
+
- Do NOT send structured JSON status messages. Communicate in plain text.
|
|
37
|
+
- Use TaskUpdate to mark tasks completed.
|
|
38
|
+
`;
|
|
39
|
+
const DESCRIPTION = `Send messages to agent teammates and handle protocol requests/responses in a team`;
|
|
40
|
+
export {
|
|
41
|
+
DESCRIPTION,
|
|
42
|
+
PROMPT
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/tools/SendMessageTool/prompt.ts"],
|
|
4
|
+
"sourcesContent": ["export const PROMPT = `Send messages to agent teammates and handle protocol requests/responses in a team.\n\n## Message Types\n\n### type: \"message\" \u2014 Send a Direct Message (DEFAULT)\nSend a message to a specific teammate. You MUST specify the recipient.\n\n**IMPORTANT**: Your plain text output is NOT visible to teammates. You MUST use this tool to communicate.\n\nParameters: recipient (name, required), content (required), summary (5-10 word preview, required)\n\n### type: \"broadcast\" \u2014 Send to ALL Teammates (USE SPARINGLY)\nSend the same message to everyone. Broadcasting is expensive (N teammates = N deliveries).\nOnly use for critical team-wide issues. Default to \"message\" for normal communication.\n\nParameters: content (required), summary (required)\n\n### type: \"shutdown_request\" \u2014 Request Teammate Shutdown\nAsk a teammate to gracefully shut down. They can approve (exit) or reject (continue).\n\nParameters: recipient (required), content (optional reason)\n\n### type: \"shutdown_response\" \u2014 Respond to Shutdown Request\nWhen you receive a shutdown request JSON with \\`type: \"shutdown_request\"\\`, you MUST respond by calling this tool (not just text). Extract the \\`requestId\\` from the JSON and pass it as \\`request_id\\`.\n\nParameters: request_id (from the request JSON, required), approve (boolean, required), content (reason if rejecting)\n\n### type: \"plan_approval_response\" \u2014 Approve/Reject Teammate Plan\nWhen a teammate with \\`plan_mode_required\\` sends a plan approval request, respond here.\n\nParameters: request_id (required), recipient (required), approve (boolean, required), content (feedback if rejecting)\n\n## Important Notes\n- Messages from teammates are automatically delivered. No manual inbox checking needed.\n- Always refer to teammates by NAME, never by UUID.\n- Do NOT send structured JSON status messages. Communicate in plain text.\n- Use TaskUpdate to mark tasks completed.\n`\n\nexport const DESCRIPTION = `Send messages to agent teammates and handle protocol requests/responses in a team`\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;AAuCf,MAAM,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
function getPrompt() {
|
|
2
|
+
const isTeamContext = !!process.env.MINTO_TEAM_NAME;
|
|
3
|
+
const teammateNote = isTeamContext ? `
|
|
4
|
+
- When working as a teammate - Create tasks to track your assigned work and any sub-tasks you identify` : "";
|
|
5
|
+
const teamTips = isTeamContext ? `
|
|
6
|
+
- New tasks are created with status 'pending' and no owner. Use TaskUpdate to assign.
|
|
7
|
+
- Include enough detail in the description for another agent to understand and complete the task independently.
|
|
8
|
+
- Set up dependencies with TaskUpdate (addBlocks/addBlockedBy) immediately after creating related tasks.` : "";
|
|
9
|
+
return `Use this tool to create a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
|
|
2
10
|
It also helps the user understand the progress of the task and overall progress of their requests.
|
|
3
11
|
|
|
4
12
|
## When to Use This Tool
|
|
@@ -6,7 +14,7 @@ It also helps the user understand the progress of the task and overall progress
|
|
|
6
14
|
Use this tool proactively in these scenarios:
|
|
7
15
|
|
|
8
16
|
- Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
|
|
9
|
-
- Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
|
|
17
|
+
- Non-trivial and complex tasks - Tasks that require careful planning or multiple operations${teammateNote}
|
|
10
18
|
- Plan mode - When using plan mode, create a task list to track the work
|
|
11
19
|
- User explicitly requests todo list - When the user directly asks you to use the todo list
|
|
12
20
|
- User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
|
|
@@ -36,12 +44,15 @@ NOTE that you should not use this tool if there is only one trivial task to do.
|
|
|
36
44
|
|
|
37
45
|
- Create tasks with clear, specific subjects that describe the outcome
|
|
38
46
|
- Include enough detail in the description for another agent to understand and complete the task
|
|
39
|
-
- After creating tasks, use TaskUpdate to set up dependencies (blocks/blockedBy) if needed
|
|
47
|
+
- After creating tasks, use TaskUpdate to set up dependencies (blocks/blockedBy) if needed${teamTips}
|
|
40
48
|
- Check TaskList first to avoid creating duplicate tasks
|
|
41
49
|
`;
|
|
50
|
+
}
|
|
51
|
+
const PROMPT = getPrompt();
|
|
42
52
|
const DESCRIPTION = "Create a new task to track progress on complex work";
|
|
43
53
|
export {
|
|
44
54
|
DESCRIPTION,
|
|
45
|
-
PROMPT
|
|
55
|
+
PROMPT,
|
|
56
|
+
getPrompt
|
|
46
57
|
};
|
|
47
58
|
//# sourceMappingURL=prompt.js.map
|