@within-7/minto 0.4.0 → 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
package/dist/screens/REPL.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/screens/REPL.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n ToolUseBlockParam,\n ToolResultBlockParam,\n} from '@anthropic-ai/sdk/resources/index.mjs'\nimport { Box, Newline, Static, Text, useApp } from 'ink'\nimport ProjectOnboarding, {\n markProjectOnboardingComplete,\n} from '@components/ProjectOnboarding'\nimport type { SafetyMode } from '@utils/config'\nimport { CostThresholdDialog } from '@components/CostThresholdDialog'\nimport * as React from 'react'\nimport { useEffect, useMemo, useRef, useState, useCallback } from 'react'\nimport { Command } from '@commands'\nimport { Logo } from '@components/Logo'\nimport { Message } from '@components/Message'\nimport { MessageResponse } from '@components/MessageResponse'\nimport { BashStreamingProgress } from '@components/BashStreamingProgress'\nimport { MessageSelector } from '@components/MessageSelector'\nimport { MessageBatchBuffer } from '@utils/MessageBatchBuffer'\nimport {\n PermissionRequest,\n type ToolUseConfirm,\n} from '@components/permissions/PermissionRequest'\nimport PromptInput from '@components/PromptInput'\nimport { getSystemPrompt } from '@constants/prompts'\nimport { getContext } from '@context'\nimport { getTotalCost, useCostSummary } from '@costTracker'\nimport { useLogStartupTime } from '@hooks/useLogStartupTime'\nimport { addToHistory } from '@history'\nimport { useApiKeyVerification } from '@hooks/useApiKeyVerification'\n// useCancelRequest removed - ESC interrupt logic consolidated into onInterrupt callback\nimport useCanUseTool from '@hooks/useCanUseTool'\nimport { useLogMessages, serializeMessageForLog } from '@hooks/useLogMessages'\nimport { overwriteLog } from '@utils/log'\nimport { PermissionProvider } from '@context/PermissionContext'\nimport { useFullscreenExitCallback } from '@hooks/useTerminalSize'\n// ModeIndicator moved to PromptInput footer for lightweight inline display\nimport { TodoPanel } from '@components/TodoPanel'\nimport { TurnCompletionIndicator } from '@components/TurnCompletionIndicator'\nimport { getTodos, initTodoSession } from '@utils/todoStorage'\nimport {\n setMessagesGetter,\n setMessagesSetter,\n setModelConfigChangeHandler,\n setLanguageChangeHandler,\n} from '@messages'\nimport {\n type AssistantMessage,\n type BinaryFeedbackResult,\n type Message as MessageType,\n type ProgressMessage,\n type StreamingProgressContent,\n query,\n} from '@query'\nimport type { WrappedClient } from '@services/mcpClient'\nimport type { Tool } from '@tool'\n// Auto-updater removed; only show a new version banner passed from CLI\nimport {\n getGlobalConfig,\n saveGlobalConfig,\n getVerboseLabel,\n} from '@utils/config'\nimport { loadMessagesFromLog } from '@utils/conversationRecovery'\nimport { useBackgroundShells } from '@hooks/useBackgroundShells'\nimport { useDeferredLoading } from '@hooks/useDeferredLoading'\nimport { useSessionTracking } from '@hooks/useSessionTracking'\nimport { emitReminderEvent } from '@services/systemReminder'\nimport {\n getNextAvailableLogForkNumber,\n loadLogList,\n CACHE_PATHS,\n} from '@utils/log'\nimport {\n getErroredToolUseMessages,\n getInProgressToolUseIDs,\n getLastAssistantMessageId,\n getToolUseID,\n getUnresolvedToolUseIDs,\n INTERRUPT_MESSAGE,\n isNotEmptyMessage,\n type NormalizedMessage,\n normalizeMessages,\n normalizeMessagesForAPI,\n processUserInput,\n reorderMessages,\n extractTag,\n createAssistantMessage,\n createAssistantAPIErrorMessage,\n} from '@utils/messages'\nimport { logError } from '@utils/log'\nimport { getModelManager, ModelManager } from '@utils/model'\nimport { clearTerminal, updateTerminalTitle } from '@utils/terminal'\nimport { BinaryFeedback } from '@components/binary-feedback/BinaryFeedback'\nimport { getMaxThinkingTokens } from '@utils/thinking'\nimport { getOriginalCwd } from '@utils/state'\nimport { handleHashCommand } from '@commands/terminalSetup'\nimport { randomUUID } from 'crypto'\nimport { getMessagesPath } from '@utils/log'\nimport {\n BackgroundShellManager,\n} from '@utils/BackgroundShellManager'\nimport { BackgroundTasksPanel } from '@components/BackgroundTasksPanel'\nimport { AskUserQuestionDialog } from '@components/AskUserQuestionDialog/AskUserQuestionDialog'\nimport {\n getToolUseIdByAgentId,\n getAgentIdByToolUseId,\n restoreToolUseAgentMappings,\n} from '@utils/agentTranscripts'\nimport type { AskUserQuestionContext } from '@minto-types/askUserQuestion'\nimport useAskUser from '@hooks/useAskUser'\n// V1+ hierarchical message display imports\nimport { useMessageGroups } from '@hooks/useMessageGroups'\nimport { useAgentTranscripts } from '@hooks/useAgentTranscripts'\nimport { GroupRenderer } from '@components/messages/GroupRenderer'\nimport { SEMANTIC_COLORS } from '@constants/colors'\nimport {\n recordFirstPrompt,\n incrementMessageCount,\n incrementToolCallCount,\n flushSessionStats,\n} from '@utils/sessionTracker'\n\n// Maximum number of recent messages to display when resuming a conversation\n// Set to Infinity to show all messages (user can scroll to see earlier ones)\nconst RESUME_VISIBLE_MESSAGE_COUNT = Infinity\n\ntype Props = {\n commands: Command[]\n /** @deprecated Use safetyMode instead */\n safeMode?: boolean\n /** Safety mode: 'yolo' | 'smart' | 'strict' */\n safetyMode?: SafetyMode\n debug?: boolean\n initialForkNumber?: number | undefined\n initialPrompt: string | undefined\n // A unique name for the message log file, used to identify the fork\n messageLogName: string\n shouldShowPromptInput: boolean\n tools: Tool[]\n /**\n * Verbose mode: shows full parameters and complete outputs when enabled\n */\n verbose?: boolean | undefined\n // Initial messages to populate the REPL with\n initialMessages?: MessageType[]\n // MCP clients\n mcpClients?: WrappedClient[]\n // Flag to indicate if current model is default\n isDefaultModel?: boolean\n // Update banner info passed from CLI before first render\n initialUpdateVersion?: string | null\n initialUpdateCommands?: string[] | null\n // Whether to use limited input mode (raw mode not supported)\n fallbackMode?: boolean\n // Whether this is a resumed conversation (shows collapsed history indicator)\n isResumedConversation?: boolean\n // Whether architect tool is enabled (needed for deferred getTools() call)\n enableArchitect?: boolean\n // Whether to auto-resume last conversation in background (deferred from CLI)\n autoResume?: boolean\n}\n\nexport type BinaryFeedbackContext = {\n m1: AssistantMessage\n m2: AssistantMessage\n resolve: (result: BinaryFeedbackResult) => void\n}\n\nexport function REPL({\n commands,\n safeMode,\n safetyMode = 'yolo',\n debug = false,\n initialForkNumber = 0,\n initialPrompt,\n messageLogName,\n shouldShowPromptInput,\n tools,\n verbose: verboseFromCLI,\n initialMessages,\n mcpClients = [],\n isDefaultModel = true,\n initialUpdateVersion,\n initialUpdateCommands,\n fallbackMode = false,\n isResumedConversation = false,\n enableArchitect,\n autoResume = false,\n}: Props): React.ReactNode {\n // Verbose mode state - can be toggled at runtime with Ctrl+O\n // Default to normal mode (false), only use verbose if explicitly set via CLI\n const [verbose, setVerbose] = useState<boolean>(\n verboseFromCLI === true ? true : false,\n )\n\n // Used to force the logo to re-render and conversation log to use a new file\n const [forkNumber, setForkNumber] = useState(\n getNextAvailableLogForkNumber(messageLogName, initialForkNumber, 0),\n )\n\n // State to temporarily hide transient UI during resize to prevent ghost artifacts\n const [isResizeClearing, setIsResizeClearing] = useState(false)\n\n // Get exit function from Ink for unmounting (used by /resume command)\n const { exit: unmountREPL } = useApp()\n\n // Re-render UI when significant resize occurs to clear ghost artifacts\n // Strategy: Hide transient UI -> clear terminal -> restore UI\n useFullscreenExitCallback(async () => {\n // Step 1: Hide all transient UI by setting clearing state\n setIsResizeClearing(true)\n\n // Step 2: Wait a frame for React to render the empty state\n await new Promise(resolve => setTimeout(resolve, 50))\n\n // Step 3: Clear the terminal to remove any ghost artifacts\n await clearTerminal()\n\n // Step 4: Increment forkNumber and restore UI\n setForkNumber(prev => prev + 1)\n setIsResizeClearing(false)\n })\n\n const [\n forkConvoWithMessagesOnTheNextRender,\n setForkConvoWithMessagesOnTheNextRender,\n ] = useState<MessageType[] | null>(null)\n\n // \uD83D\uDD27 Simplified AbortController management - inspired by reference system\n const [abortController, setAbortController] =\n useState<AbortController | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n // No auto-updater state\n const [toolJSX, setToolJSX] = useState<{\n jsx: React.ReactNode | null\n shouldHidePromptInput: boolean\n } | null>(null)\n const [toolUseConfirm, setToolUseConfirm] = useState<ToolUseConfirm | null>(\n null,\n )\n const [messages, setMessages] = useState<MessageType[]>(initialMessages ?? [])\n // Ref to track latest messages for synchronous access in onInterrupt\n // This ensures we can save messages even when React state updates are pending\n const messagesRef = useRef<MessageType[]>(initialMessages ?? [])\n // Phase 4.1: Message history stack for Esc Esc rollback\n const [messageHistory, setMessageHistory] = useState<MessageType[][]>([])\n const [inputValue, setInputValue] = useState('')\n const [inputMode, setInputMode] = useState<'bash' | 'prompt' | 'koding'>(\n 'prompt',\n )\n const [submitCount, setSubmitCount] = useState(0)\n const [isMessageSelectorVisible, setIsMessageSelectorVisible] =\n useState(false)\n const [showCostDialog, setShowCostDialog] = useState(false)\n const [haveShownCostDialog, setHaveShownCostDialog] = useState(\n getGlobalConfig().hasAcknowledgedCostThreshold,\n )\n\n const [binaryFeedbackContext, setBinaryFeedbackContext] =\n useState<BinaryFeedbackContext | null>(null)\n const [askUserQuestionContext, setAskUserQuestionContext] =\n useState<AskUserQuestionContext | null>(null)\n // Deferred loading: MCP clients, tools, commands, version check (background)\n const {\n commands: currentCommands,\n tools: currentTools,\n mcpClients: currentMcpClients,\n updateVersion: updateAvailableVersion,\n updateCommands,\n startupItems,\n } = useDeferredLoading({\n initialCommands: commands,\n initialTools: tools,\n initialMcpClients: mcpClients,\n initialUpdateVersion: initialUpdateVersion,\n initialUpdateCommands: initialUpdateCommands,\n enableArchitect,\n })\n\n // TodoPanel state\n const [isTodoPanelVisible, setIsTodoPanelVisible] = useState(true)\n\n // Verbose toggle feedback message - survives PromptInput remount\n const [verboseToggleMessage, setVerboseToggleMessage] = useState<\n string | null\n >(null)\n\n // Turn duration tracking for \"Cogitated\" display\n const turnStartTimeRef = useRef<number | null>(null)\n const [lastTurnDurationMs, setLastTurnDurationMs] = useState<number | null>(\n null,\n )\n\n // Waiting list: queued messages to process after current task completes\n const [queuedPrompts, setQueuedPrompts] = useState<string[]>([])\n // Ref to track latest queued prompts (avoid stale closure issues)\n const queuedPromptsRef = useRef<string[]>([])\n useEffect(() => {\n queuedPromptsRef.current = queuedPrompts\n }, [queuedPrompts])\n\n // Track turn duration for \"Cogitated\" display\n useEffect(() => {\n if (isLoading) {\n // Turn started - record start time, clear previous duration\n turnStartTimeRef.current = Date.now()\n setLastTurnDurationMs(null)\n } else if (turnStartTimeRef.current !== null) {\n // Turn ended - calculate and store duration\n const duration = Date.now() - turnStartTimeRef.current\n setLastTurnDurationMs(duration)\n turnStartTimeRef.current = null\n }\n }, [isLoading])\n\n // Background tasks state (event-driven via hook)\n const {\n shells: backgroundShells,\n isPanelVisible: showBackgroundPanel,\n setIsPanelVisible: setShowBackgroundPanel,\n runningCount: backgroundShellRunningCount,\n } = useBackgroundShells()\n\n // Phase 2.1: Removed recentlyCompletedIDs state - immediate static rendering for better performance\n const prevUnresolvedRef = useRef<Set<string>>(new Set())\n\n // Message batch buffer to eliminate flicker from rapid successive updates\n const messageBatchBufferRef = useRef<MessageBatchBuffer | null>(null)\n\n // Initialize batch buffer on first render\n if (messageBatchBufferRef.current === null) {\n messageBatchBufferRef.current = new MessageBatchBuffer(\n batchedMessages => {\n setMessages(prev => [...prev, ...batchedMessages])\n },\n {\n flushInterval: 100, // Batch messages for 100ms\n maxBatchSize: 50, // Force flush if 50+ messages buffered\n debug: false, // Set to true for debugging\n },\n )\n }\n\n // Cleanup buffer on unmount\n useEffect(() => {\n return () => {\n messageBatchBufferRef.current?.dispose()\n }\n }, [])\n\n const getBinaryFeedbackResponse = useCallback(\n (\n m1: AssistantMessage,\n m2: AssistantMessage,\n ): Promise<BinaryFeedbackResult> => {\n return new Promise<BinaryFeedbackResult>(resolvePromise => {\n setBinaryFeedbackContext({\n m1,\n m2,\n resolve: resolvePromise,\n })\n })\n },\n [],\n )\n\n const readFileTimestamps = useRef<{\n [filename: string]: number\n }>({})\n\n const { status: apiKeyStatus, reverify } = useApiKeyVerification()\n // Unified interrupt handler - called by PromptInput when ESC is pressed with empty input\n // Consolidates all cleanup logic in one place (no separate useCancelRequest hook needed)\n function onInterrupt() {\n if (!isLoading) {\n return\n }\n\n // \uD83D\uDD27 Force save messages before interrupt to prevent conversation loss\n // This is critical because React's useEffect-based saving might not run\n // in time when state changes rapidly during interrupt\n const currentMessages = messagesRef.current\n if (currentMessages.length > 0) {\n const serializedMessages = currentMessages.map(serializeMessageForLog)\n overwriteLog(\n getMessagesPath(messageLogName, forkNumber, 0),\n serializedMessages,\n )\n }\n\n // Clean up UI state\n setToolJSX(null)\n setToolUseConfirm(null)\n setBinaryFeedbackContext(null)\n setIsLoading(false)\n // Abort the request\n if (toolUseConfirm) {\n toolUseConfirm.onAbort()\n } else if (abortController && !abortController.signal.aborted) {\n abortController.abort()\n }\n }\n\n // Legacy onCancel for other callers (e.g., PermissionRequest)\n function onCancel() {\n onInterrupt()\n }\n\n useEffect(() => {\n if (forkConvoWithMessagesOnTheNextRender) {\n setForkNumber(_ => _ + 1)\n setForkConvoWithMessagesOnTheNextRender(null)\n setMessages(forkConvoWithMessagesOnTheNextRender)\n }\n }, [forkConvoWithMessagesOnTheNextRender])\n\n useEffect(() => {\n const totalCost = getTotalCost()\n if (totalCost >= 5 /* $5 */ && !showCostDialog && !haveShownCostDialog) {\n setShowCostDialog(true)\n }\n }, [messages, showCostDialog, haveShownCostDialog])\n\n // Update banner is provided by CLI at startup; no async check here.\n\n const canUseTool = useCanUseTool(setToolUseConfirm)\n const askUser = useAskUser(setAskUserQuestionContext)\n\n async function onInit() {\n reverify()\n\n if (!initialPrompt) {\n return\n }\n\n setIsLoading(true)\n const newAbortController = new AbortController()\n setAbortController(newAbortController)\n\n try {\n // \uD83D\uDD27 Force fresh config read to ensure model switching works\n const model = new ModelManager(getGlobalConfig()).getModelName('main')\n const newMessages = await processUserInput(\n initialPrompt,\n 'prompt',\n setToolJSX,\n {\n abortController: newAbortController,\n options: {\n commands: currentCommands,\n forkNumber,\n messageLogName,\n tools: currentTools,\n verbose,\n maxThinkingTokens: 0,\n },\n messageId: getLastAssistantMessageId(messages),\n setForkConvoWithMessagesOnTheNextRender,\n readFileTimestamps: readFileTimestamps.current,\n },\n null,\n )\n\n if (newMessages.length) {\n for (const message of newMessages) {\n if (message.type === 'user') {\n addToHistory(initialPrompt)\n // History index resets on next prompt via useArrowKeyHistory\n }\n }\n setMessages(_ => [..._, ...newMessages])\n\n // The last message is an assistant message if the user input was a bash command,\n // or if the user input was an invalid slash command.\n const lastMessage = newMessages[newMessages.length - 1]!\n if (lastMessage.type === 'assistant') {\n return\n }\n\n const [systemPrompt, context, model, maxThinkingTokens] =\n await Promise.all([\n getSystemPrompt(),\n getContext(),\n new ModelManager(getGlobalConfig()).getModelName('main'),\n getMaxThinkingTokens([...messages, ...newMessages]),\n ])\n\n for await (const message of query(\n [...messages, ...newMessages],\n systemPrompt,\n context,\n canUseTool,\n {\n options: {\n commands: currentCommands,\n forkNumber,\n messageLogName,\n tools: currentTools,\n verbose,\n safeMode,\n safetyMode,\n maxThinkingTokens,\n },\n messageId: getLastAssistantMessageId([...messages, ...newMessages]),\n readFileTimestamps: readFileTimestamps.current,\n abortController: newAbortController,\n setToolJSX,\n askUser,\n },\n getBinaryFeedbackResponse,\n )) {\n // Use batch buffer to reduce render frequency\n messageBatchBufferRef.current?.add(message)\n }\n\n // Flush any remaining buffered messages immediately after query completes\n messageBatchBufferRef.current?.flush()\n } else {\n addToHistory(initialPrompt)\n // History index resets on next prompt via useArrowKeyHistory\n }\n\n setHaveShownCostDialog(\n getGlobalConfig().hasAcknowledgedCostThreshold || false,\n )\n } catch (error) {\n // \uD83D\uDD27 Fix: Handle errors gracefully and show error to user\n logError(error)\n setMessages(oldMessages => [\n ...oldMessages,\n createAssistantAPIErrorMessage(\n `Request failed: ${error instanceof Error ? error.message : String(error)}`,\n ),\n ])\n } finally {\n // \uD83D\uDD27 Fix: Always clean up state, even on error\n setIsLoading(false)\n setAbortController(null)\n }\n }\n\n // Phase 4.1: Rollback to previous message state\n function rollbackConversation(): boolean {\n if (messageHistory.length === 0) {\n return false // No history to rollback to\n }\n\n // Pop the last snapshot and restore it\n const previousMessages = messageHistory[messageHistory.length - 1]!\n setMessages(previousMessages)\n setMessageHistory(history => history.slice(0, -1))\n\n return true // Successfully rolled back\n }\n\n // Process the next queued prompt (called after current task completes)\n // This is defined as a ref to avoid stale closure issues\n const processNextQueuedPromptRef = useRef<(() => Promise<void>) | null>(null)\n\n async function onQuery(\n newMessages: MessageType[],\n passedAbortController?: AbortController,\n ) {\n // Use passed AbortController or create new one\n const controllerToUse = passedAbortController || new AbortController()\n if (!passedAbortController) {\n setAbortController(controllerToUse)\n }\n // \uD83D\uDD27 Fix: Always set isLoading to true at the start\n setIsLoading(true)\n\n // Reset verbose mode to normal when user starts new task\n // User can manually enable verbose with Ctrl+O during task execution\n setVerbose(false)\n\n // Check if this is a Koding request based on last message's options\n const isKodingRequest =\n newMessages.length > 0 &&\n newMessages[0].type === 'user' &&\n 'options' in newMessages[0] &&\n newMessages[0].options?.isKodingRequest === true\n\n // Phase 4.1: Save message history snapshot before adding new messages\n setMessages(oldMessages => {\n // Save current state to history stack (limit to last 10 snapshots)\n setMessageHistory(history => [...history, oldMessages].slice(-10))\n return [...oldMessages, ...newMessages]\n })\n\n // Mark onboarding as complete when any user message is sent to the assistant\n markProjectOnboardingComplete()\n\n // The last message is an assistant message if the user input was a bash command,\n // or if the user input was an invalid slash command.\n const lastMessage = newMessages[newMessages.length - 1]!\n\n // Track session: record first prompt and increment message count\n if (\n lastMessage.type === 'user' &&\n typeof lastMessage.message.content === 'string'\n ) {\n // Record first prompt for session tracking (no-op if already recorded)\n recordFirstPrompt(lastMessage.message.content)\n // Increment message count for this user message\n incrementMessageCount(1)\n }\n\n // Update terminal title based on user message\n if (\n lastMessage.type === 'user' &&\n typeof lastMessage.message.content === 'string'\n ) {\n // updateTerminalTitle(lastMessage.message.content)\n }\n if (lastMessage.type === 'assistant') {\n setAbortController(null)\n setIsLoading(false)\n return\n }\n\n try {\n const [systemPrompt, context, model, maxThinkingTokens] =\n await Promise.all([\n getSystemPrompt(),\n getContext(),\n new ModelManager(getGlobalConfig()).getModelName('main'),\n getMaxThinkingTokens([...messages, lastMessage]),\n ])\n\n let lastAssistantMessage: MessageType | null = null\n\n // query the API\n for await (const message of query(\n [...messages, lastMessage],\n systemPrompt,\n context,\n canUseTool,\n {\n options: {\n commands: currentCommands,\n forkNumber,\n messageLogName,\n tools: currentTools,\n verbose,\n safeMode,\n safetyMode,\n maxThinkingTokens,\n // If this came from Koding mode, pass that along\n isKodingRequest: isKodingRequest || undefined,\n },\n messageId: getLastAssistantMessageId([...messages, lastMessage]),\n readFileTimestamps: readFileTimestamps.current,\n abortController: controllerToUse,\n setToolJSX,\n askUser,\n },\n getBinaryFeedbackResponse,\n )) {\n // Use batch buffer to reduce render frequency\n messageBatchBufferRef.current?.add(message)\n\n // Keep track of the last assistant message for Koding mode\n if (message.type === 'assistant') {\n lastAssistantMessage = message\n // Track assistant message count\n incrementMessageCount(1)\n\n // Track tool calls in assistant messages\n if (Array.isArray(message.message.content)) {\n const toolUseCount = message.message.content.filter(\n block => typeof block === 'object' && block.type === 'tool_use',\n ).length\n if (toolUseCount > 0) {\n incrementToolCallCount(toolUseCount)\n }\n }\n }\n }\n\n // If this was a Koding request and we got an assistant message back,\n // save it to MINTO.md (and CLAUDE.md if exists)\n if (\n isKodingRequest &&\n lastAssistantMessage &&\n lastAssistantMessage.type === 'assistant'\n ) {\n try {\n const content =\n typeof lastAssistantMessage.message.content === 'string'\n ? lastAssistantMessage.message.content\n : lastAssistantMessage.message.content\n .filter(block => block.type === 'text')\n .map(block => (block.type === 'text' ? block.text : ''))\n .join('\\n')\n\n // Add the content to MINTO.md (and CLAUDE.md if exists)\n if (content && content.trim().length > 0) {\n handleHashCommand(content)\n }\n } catch (error) {\n console.error('Error saving response to project docs:', error)\n }\n }\n\n // Flush any remaining buffered messages immediately after query completes\n messageBatchBufferRef.current?.flush()\n } catch (error) {\n // \uD83D\uDD27 Fix: Handle errors gracefully and show error to user\n logError(error)\n\n // Flush buffer before showing error to ensure all messages are visible\n messageBatchBufferRef.current?.flush()\n setMessages(oldMessages => [\n ...oldMessages,\n createAssistantAPIErrorMessage(\n `Request failed: ${error instanceof Error ? error.message : String(error)}`,\n ),\n ])\n } finally {\n // \uD83D\uDD27 Fix: Always clean up state, even on error\n setIsLoading(false)\n setAbortController(null)\n\n // Flush session stats after each turn completes\n flushSessionStats()\n\n // Process next queued prompt if any (waiting list feature)\n if (queuedPromptsRef.current.length > 0) {\n // Use setTimeout to allow state to settle before processing next\n setTimeout(() => {\n if (processNextQueuedPromptRef.current) {\n processNextQueuedPromptRef.current()\n }\n }, 100)\n }\n }\n }\n\n // Register cost summary tracker\n useCostSummary()\n\n // Register messages getter and setter\n useEffect(() => {\n const getMessages = () => messages\n setMessagesGetter(getMessages)\n setMessagesSetter(setMessages)\n }, [messages])\n\n // Initialize todo session with unique identifier\n // Using messageLogName + forkNumber as session ID to ensure:\n // 1. Each conversation has its own todo list\n // 2. Resumed conversations restore their todos\n useEffect(() => {\n const todoSessionId = `${messageLogName}-${forkNumber}`\n initTodoSession(todoSessionId)\n\n // Restore transcript mappings for history restore\n // This enables proper display of Task tool results from previous sessions\n if (initialMessages && initialMessages.length > 0) {\n restoreToolUseAgentMappings()\n }\n }, [messageLogName, forkNumber, initialMessages])\n\n // Register model config change handler for UI refresh\n useEffect(() => {\n setModelConfigChangeHandler(() => {\n setForkNumber(prev => prev + 1)\n })\n }, [])\n\n // Register language change handler for UI refresh\n // Uses the same flow as verbose toggle: hide UI -> wait -> clear terminal -> re-render\n useEffect(() => {\n setLanguageChangeHandler(async () => {\n // Step 1: Hide all transient UI to prevent ghost artifacts\n setIsResizeClearing(true)\n\n // Step 2: Wait for React to render the empty state\n await new Promise(resolve => setTimeout(resolve, 50))\n\n // Step 3: Clear the terminal\n await clearTerminal()\n\n // Step 4: Trigger re-render and restore UI\n setForkNumber(prev => prev + 1)\n setIsResizeClearing(false)\n })\n }, [])\n\n // Keep messagesRef in sync with messages state for synchronous access\n useEffect(() => {\n messagesRef.current = messages\n }, [messages])\n\n // Record transcripts locally, for debugging and conversation recovery\n useLogMessages(messages, messageLogName, forkNumber)\n\n // Log startup time\n useLogStartupTime()\n\n // Auto-resume last conversation (deferred from CLI startup)\n // IMPORTANT: Do NOT call setForkNumber() here \u2014 changing forkNumber\n // remounts the <Static> wrapper (keyed by forkNumber), causing the\n // entire conversation to be written to stdout a second time.\n // Messages are loaded into the current session; logs save under today's date.\n useEffect(() => {\n if (!autoResume) return\n loadLogList(CACHE_PATHS.messages())\n .then(async logs => {\n for (const log of logs) {\n try {\n const loaded = await loadMessagesFromLog(log.fullPath, tools)\n if (loaded && loaded.length > 0) {\n setMessages(loaded)\n emitReminderEvent('session:continuation', {\n messageCount: loaded.length,\n })\n break\n }\n } catch {\n continue\n }\n }\n })\n .catch(() => {\n // If loading fails, just stay with new conversation\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // Initial load\n useEffect(() => {\n onInit()\n // TODO: fix this\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // Session tracking: plugins, hook manager, session lifecycle\n useSessionTracking(messageLogName, forkNumber)\n\n // Optimize: Cache normalized messages and only recompute when messages actually change\n // This useMemo will only rerun when the messages array reference changes\n const normalizedMessages = useMemo(\n () => normalizeMessages(messages).filter(isNotEmptyMessage),\n [messages],\n )\n\n const unresolvedToolUseIDs = useMemo(\n () => getUnresolvedToolUseIDs(normalizedMessages),\n [normalizedMessages],\n )\n\n // Phase 2.1: Removed 300ms delay useEffect - immediate static rendering\n // Update prevUnresolvedRef when unresolvedToolUseIDs changes\n useEffect(() => {\n prevUnresolvedRef.current = new Set(unresolvedToolUseIDs)\n }, [unresolvedToolUseIDs])\n\n const inProgressToolUseIDs = useMemo(\n () => getInProgressToolUseIDs(normalizedMessages),\n [normalizedMessages],\n )\n\n const erroredToolUseIDs = useMemo(\n () =>\n new Set(\n getErroredToolUseMessages(normalizedMessages).map(\n _ => (_.message.content[0]! as ToolUseBlockParam).id,\n ),\n ),\n [normalizedMessages],\n )\n\n // V1+ Message Groups - identifies parallel task groups for unified rendering\n const {\n groups: messageGroups,\n getGroupForMessage,\n getGroupForToolUse,\n shouldGroupBeStatic,\n displayConfig,\n } = useMessageGroups(\n normalizedMessages,\n unresolvedToolUseIDs,\n inProgressToolUseIDs,\n verbose,\n )\n\n // V1+ Agent Transcripts - real-time transcript access for task display\n // getTranscript enables lazy loading from disk for historical messages\n const { transcripts: agentTranscripts, getTranscript } = useAgentTranscripts()\n\n // V1+ Tool outputs map for group rendering\n const toolOutputs = useMemo(() => {\n const outputs = new Map<string, ToolResultBlockParam>()\n for (const msg of normalizedMessages) {\n if (msg.type === 'user' && msg.message.role === 'user') {\n for (const block of msg.message.content) {\n if (typeof block === 'object' && block.type === 'tool_result') {\n outputs.set(block.tool_use_id, block as ToolResultBlockParam)\n }\n }\n }\n }\n return outputs\n }, [normalizedMessages])\n\n // Type for message JSX items - pre-rendered JSX with static/transient type\n type MessageJSXItem = {\n type: 'static' | 'transient'\n jsx: React.ReactElement\n }\n\n // Static item type for Ink's Static component (requires id for deduplication)\n type StaticItem = { id: string; jsx: React.ReactElement }\n\n const messagesJSX = useMemo(() => {\n const reorderedMessages = reorderMessages(normalizedMessages)\n\n // Calculate how many messages to hide when resuming a conversation\n const hiddenMessageCount =\n isResumedConversation &&\n reorderedMessages.length > RESUME_VISIBLE_MESSAGE_COUNT\n ? reorderedMessages.length - RESUME_VISIBLE_MESSAGE_COUNT\n : 0\n\n // Only show recent messages when resuming, but keep all messages in memory for context\n const visibleMessages =\n hiddenMessageCount > 0\n ? reorderedMessages.slice(-RESUME_VISIBLE_MESSAGE_COUNT)\n : reorderedMessages\n\n // Build the result array\n const result: MessageJSXItem[] = [\n {\n type: 'static',\n jsx: (\n <Box flexDirection=\"column\" width=\"100%\" key=\"logo\">\n <Logo\n mcpClients={currentMcpClients}\n isDefaultModel={isDefaultModel}\n updateBannerVersion={updateAvailableVersion}\n updateBannerCommands={updateCommands}\n />\n <ProjectOnboarding workspaceDir={getOriginalCwd()} />\n </Box>\n ),\n },\n ]\n\n // Show collapsed history indicator when resuming with hidden messages\n if (hiddenMessageCount > 0) {\n result.push({\n type: 'static' as const,\n jsx: (\n <Box key=\"collapsed-history\" paddingLeft={2} marginBottom={1}>\n <Text color={SEMANTIC_COLORS.dim}>\n \u00B7\u00B7\u00B7 {hiddenMessageCount} earlier messages hidden \u00B7\u00B7\u00B7\n </Text>\n </Box>\n ),\n })\n }\n\n // V1+ Track rendered groups to avoid duplicate rendering\n const renderedGroupIds = new Set<string>()\n // V1+ Track tool_use_ids that are part of groups (to skip their tool_result messages)\n const groupToolUseIds = new Set<string>()\n // V1+ Track TaskOutput tool_use_ids that reference grouped tasks (to skip their tool_result messages)\n const taskOutputToolUseIdsToSkip = new Set<string>()\n\n // Render all messages - with V1+ group detection for parallel-tasks and task groups\n for (const _ of visibleMessages) {\n const toolUseID = getToolUseID(_)\n\n // V1+ Check if this message belongs to a group (parallel-tasks or task)\n // For progress messages, use toolUseID to find the group (since progress messages have different UUIDs)\n // For assistant messages, also fallback to toolUseID lookup if UUID lookup fails\n // (this prevents double rendering when a message UUID isn't registered in the group)\n let group = getGroupForMessage(_.uuid)\n if (!group && _.type === 'progress') {\n // This is a progress message for a task - look up by toolUseID\n group = getGroupForToolUse(_.toolUseID)\n }\n if (!group && toolUseID) {\n // Fallback: assistant messages with tool_use blocks may not have their UUID registered\n // but their toolUseID should be tracked by the group manager\n group = getGroupForToolUse(toolUseID)\n }\n\n // V1+ Handle grouped messages (parallel-tasks and single task groups)\n if (group && (group.type === 'parallel-tasks' || group.type === 'task')) {\n // Skip if this group was already rendered\n if (renderedGroupIds.has(group.id)) {\n continue\n }\n renderedGroupIds.add(group.id)\n\n // Track all tool_use_ids in this group to skip their tool_result messages later\n if (group.metadata.siblingToolUseIds) {\n for (const id of group.metadata.siblingToolUseIds as string[]) {\n groupToolUseIds.add(id)\n }\n }\n if (group.metadata.toolUseId) {\n groupToolUseIds.add(group.metadata.toolUseId as string)\n }\n\n // Render the entire group using GroupRenderer\n const isGroupStatic = shouldGroupBeStatic(group)\n const groupType = isGroupStatic ? 'static' : 'transient'\n\n const shouldAnimate =\n !toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !isGroupStatic\n\n result.push({\n type: groupType,\n jsx: (\n <Box key={`group-${group.id}`} width=\"100%\">\n <GroupRenderer\n group={group}\n context={{\n depth: 0,\n isLastChild: true,\n displayConfig,\n shouldAnimate,\n getTranscript,\n }}\n messages={normalizedMessages}\n transcripts={agentTranscripts}\n outputs={toolOutputs}\n />\n </Box>\n ),\n })\n continue\n }\n\n // V1+ Skip tool_result messages for tools that are part of a group\n // (their output is rendered within the group view)\n // Also skip tool_result messages for TaskOutput calls that reference grouped tasks\n if (_.type === 'user' && _.message.role === 'user') {\n const content = _.message.content\n if (Array.isArray(content)) {\n const toolResult = content.find(\n (block): block is ToolResultBlockParam =>\n typeof block === 'object' && block.type === 'tool_result',\n )\n if (\n toolResult &&\n (groupToolUseIds.has(toolResult.tool_use_id) ||\n taskOutputToolUseIdsToSkip.has(toolResult.tool_use_id))\n ) {\n continue\n }\n }\n }\n\n // V1+ Skip TaskOutput tool calls that reference agents belonging to a group\n // (their output is already rendered within the group view)\n if (_.type === 'assistant') {\n const content = _.message.content\n if (Array.isArray(content)) {\n const taskOutputCall = content.find(\n (block): block is ToolUseBlockParam =>\n typeof block === 'object' &&\n block.type === 'tool_use' &&\n block.name === 'TaskOutput',\n )\n if (taskOutputCall) {\n const taskId = (taskOutputCall.input as { task_id?: string })\n ?.task_id\n if (taskId) {\n // Check if this task_id (agentId) corresponds to a tool_use_id in a group\n const correspondingToolUseId = getToolUseIdByAgentId(taskId)\n if (\n correspondingToolUseId &&\n groupToolUseIds.has(correspondingToolUseId)\n ) {\n // Track this TaskOutput's tool_use_id so we can also skip its tool_result\n taskOutputToolUseIdsToSkip.add(taskOutputCall.id)\n continue\n }\n }\n }\n }\n }\n\n // Skip ALL progress messages when their tool is already completed\n // The final tool_result message will show the complete output, avoiding duplicate display\n // This covers both streaming progress (BashTool) and non-streaming progress (Task intermediate state)\n if (_.type === 'progress' && !unresolvedToolUseIDs.has(_.toolUseID)) {\n continue\n }\n\n // Normal message rendering\n const message =\n _.type === 'progress' ? (\n // Check if this is a streaming progress content (e.g., from BashTool)\n 'type' in _.content && _.content.type === 'streaming' ? (\n <BashStreamingProgress\n stdout={(_.content as StreamingProgressContent).stdout}\n stderr={(_.content as StreamingProgressContent).stderr}\n isStreaming={(_.content as StreamingProgressContent).isStreaming}\n />\n ) : (_.content as AssistantMessage).message.content[0]?.type ===\n 'text' &&\n // TaskTool interrupts use Progress messages without extra \u23BF\n // since <Message /> component already adds the margin\n (_.content as AssistantMessage).message.content[0].text ===\n INTERRUPT_MESSAGE ? (\n <Message\n message={_.content as AssistantMessage}\n messages={_.normalizedMessages}\n addMargin={false}\n tools={_.tools}\n verbose={verbose ?? false}\n debug={debug}\n erroredToolUseIDs={new Set()}\n inProgressToolUseIDs={new Set()}\n unresolvedToolUseIDs={new Set()}\n shouldAnimate={false}\n shouldShowDot={false}\n />\n ) : (\n <MessageResponse\n children={\n <Message\n message={_.content as AssistantMessage}\n messages={_.normalizedMessages}\n addMargin={false}\n tools={_.tools}\n verbose={verbose ?? false}\n debug={debug}\n erroredToolUseIDs={new Set()}\n inProgressToolUseIDs={new Set()}\n unresolvedToolUseIDs={\n new Set([\n (\n (_.content as AssistantMessage).message\n .content[0]! as ToolUseBlockParam\n ).id,\n ])\n }\n shouldAnimate={false}\n shouldShowDot={false}\n />\n }\n />\n )\n ) : (\n <Message\n message={_}\n messages={normalizedMessages}\n addMargin={true}\n tools={currentTools}\n verbose={verbose}\n debug={debug}\n erroredToolUseIDs={erroredToolUseIDs}\n inProgressToolUseIDs={inProgressToolUseIDs}\n shouldAnimate={\n !toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n (!toolUseID || inProgressToolUseIDs.has(toolUseID))\n }\n shouldShowDot={true}\n unresolvedToolUseIDs={unresolvedToolUseIDs}\n />\n )\n\n const type = shouldRenderStatically(\n _,\n normalizedMessages,\n unresolvedToolUseIDs,\n )\n ? 'static'\n : 'transient'\n\n if (debug) {\n result.push({\n type,\n jsx: (\n <Box\n borderStyle=\"single\"\n borderColor={type === 'static' ? 'green' : 'red'}\n key={_.uuid}\n width=\"100%\"\n >\n {message}\n </Box>\n ),\n })\n } else {\n result.push({\n type,\n jsx: (\n <Box key={_.uuid} width=\"100%\">\n {message}\n </Box>\n ),\n })\n }\n }\n\n return result\n }, [\n forkNumber,\n normalizedMessages,\n currentTools,\n verbose,\n debug,\n erroredToolUseIDs,\n inProgressToolUseIDs,\n toolJSX,\n toolUseConfirm,\n isMessageSelectorVisible,\n unresolvedToolUseIDs,\n currentMcpClients,\n isDefaultModel,\n isResumedConversation,\n // V1+ dependencies\n messageGroups,\n getGroupForMessage,\n getGroupForToolUse,\n shouldGroupBeStatic,\n displayConfig,\n agentTranscripts,\n toolOutputs,\n ])\n\n // only show the dialog once not loading\n const showingCostDialog = !isLoading && showCostDialog\n\n // Separate static and dynamic messages for proper Ink Static component usage\n // Static messages: completed messages that won't change - protected from Ink's clearTerminal\n // Dynamic messages: in-progress messages that need to re-render\n const { staticItems, dynamicItems } = useMemo(() => {\n const staticItems: StaticItem[] = []\n const dynamicItems: MessageJSXItem[] = []\n\n for (const item of messagesJSX) {\n if (item.type === 'static') {\n // Extract key from jsx element for Static component deduplication\n const key = item.jsx.key?.toString() || `static-${staticItems.length}`\n staticItems.push({ id: key, jsx: item.jsx })\n } else if (item.type === 'transient') {\n dynamicItems.push(item)\n }\n }\n\n return { staticItems, dynamicItems }\n }, [messagesJSX])\n\n // =========================================================================\n // Stable callback functions for PromptInput props\n // Using useCallback prevents memo invalidation on parent re-renders\n // =========================================================================\n\n // Toggle message selector visibility\n const handleShowMessageSelector = useCallback(() => {\n setIsMessageSelectorVisible(prev => !prev)\n }, [])\n\n // Toggle todo panel visibility\n const handleToggleTodoPanel = useCallback(() => {\n setIsTodoPanelVisible(prev => !prev)\n }, [])\n\n // Toggle background panel visibility\n const handleToggleBackgroundPanel = useCallback(() => {\n setShowBackgroundPanel(prev => !prev)\n }, [])\n\n // Handle model change (force re-render with terminal clear to prevent ghosting)\n // Must follow the same pattern as handleToggleVerbose: hide UI -> clear terminal -> re-render\n const handleModelChange = useCallback(async () => {\n setIsResizeClearing(true)\n await new Promise(resolve => setTimeout(resolve, 50))\n await clearTerminal()\n setForkNumber(prev => prev + 1)\n setIsResizeClearing(false)\n }, [])\n\n // Verbose toggle handler - clear screen and force re-render\n // Must increment forkNumber to force Static component to re-render conversation history\n // Sets verboseToggleMessage to show feedback after PromptInput remounts\n //\n // Flow: Hide UI -> wait for empty render -> clear terminal -> update state -> restore UI\n // This prevents ghost artifacts from appearing during the transition\n const handleToggleVerbose = useCallback(async (newVerbose: boolean) => {\n // Set the feedback message BEFORE remount so it survives\n const message = `${getVerboseLabel(newVerbose)} (Ctrl+O)`\n setVerboseToggleMessage(message)\n // Clear after 2 seconds\n setTimeout(() => setVerboseToggleMessage(null), 2000)\n\n // Step 1: Hide all transient UI\n setIsResizeClearing(true)\n\n // Step 2: Wait for React to render the empty state\n await new Promise(resolve => setTimeout(resolve, 50))\n\n // Step 3: Clear the terminal to remove any ghost artifacts\n await clearTerminal()\n\n // Step 4: Update state and restore UI\n setVerbose(newVerbose)\n setForkNumber(prev => prev + 1)\n setIsResizeClearing(false)\n }, [])\n\n // Queue-aware onQuery handler - queues prompts when busy\n const handleQueueAwareQuery = useCallback(\n async (newMessages: MessageType[], abortController?: AbortController) => {\n // If not loading, process immediately\n if (!isLoading) {\n return onQuery(newMessages, abortController)\n }\n\n // Otherwise, extract the user prompt and queue it\n const userMessage = newMessages.find(m => m.type === 'user')\n if (userMessage && userMessage.type === 'user') {\n const promptText =\n typeof userMessage.message.content === 'string'\n ? userMessage.message.content\n : ''\n if (promptText) {\n setQueuedPrompts(prev => [...prev, promptText])\n }\n }\n },\n [isLoading],\n )\n\n // Process next queued prompt - called after current task completes\n useEffect(() => {\n processNextQueuedPromptRef.current = async () => {\n if (queuedPrompts.length === 0) return\n\n // Pop the first queued prompt\n const nextPrompt = queuedPrompts[0]\n setQueuedPrompts(prev => prev.slice(1))\n\n if (!nextPrompt) return\n\n // Process it like a normal user submission\n const userMessage: MessageType = {\n type: 'user',\n uuid: randomUUID(),\n message: {\n role: 'user',\n content: nextPrompt,\n },\n }\n\n // Start the query\n setIsLoading(true)\n const newAbortController = new AbortController()\n setAbortController(newAbortController)\n\n await onQuery([userMessage], newAbortController)\n }\n }, [queuedPrompts])\n\n return (\n <PermissionProvider\n isBypassPermissionsModeAvailable={!safeMode}\n children={\n <React.Fragment>\n {/* Mode indicator moved to PromptInput footer for lightweight display */}\n {/*\n Static/Dynamic separation for proper Ink rendering:\n\n 1. Static messages use Ink's <Static> component:\n - Content written to terminal is PRESERVED (not cleared by Ink)\n - Items are deduped by `id` - same id = same output\n - Perfect for: completed messages, finished tool results\n\n 2. Dynamic messages render normally (below Static):\n - Can be re-rendered without affecting static content above\n - Used for: in-progress tools, current interaction\n\n This architecture solves the clearTerminal issue:\n - When outputHeight >= terminal rows, Ink calls clearTerminal + re-render\n - But Static content is already written to terminal, not affected by this\n - Only dynamic content below gets cleared and re-rendered\n */}\n {/* STATIC SECTION: Completed messages protected from Ink's clearTerminal */}\n {/* Note: Static component uses forkNumber in fragment key to force rebuild on verbose toggle */}\n <React.Fragment key={`static-wrapper-${forkNumber}`}>\n <Static<StaticItem>\n items={staticItems}\n children={item => (\n <React.Fragment key={item.id}>{item.jsx}</React.Fragment>\n )}\n />\n </React.Fragment>\n\n {/* DYNAMIC SECTION: In-progress content that can re-render */}\n <React.Fragment key={`dynamic-messages-${forkNumber}`}>\n {/* Render transient items */}\n {dynamicItems.map(item => item.jsx)}\n </React.Fragment>\n {/*\n IMPORTANT: Key prop tied to forkNumber ensures all transient UI components\n are properly re-rendered when exiting fullscreen mode. This prevents ghost\n artifacts from appearing when the terminal shrinks significantly.\n See useFullscreenExitCallback above which increments forkNumber on fullscreen exit.\n */}\n <Box\n key={`transient-ui-${forkNumber}`}\n borderColor=\"red\"\n borderStyle={debug ? 'single' : undefined}\n flexDirection=\"column\"\n width=\"100%\"\n >\n {/* Unified Spinner + TodoPanel - shows when loading OR when there are incomplete todos */}\n {/* Hidden during resize clearing to prevent ghost artifacts */}\n {!isResizeClearing &&\n !toolJSX &&\n !toolUseConfirm &&\n !binaryFeedbackContext && (\n <TodoPanel\n todos={getTodos()}\n isVisible={isTodoPanelVisible}\n isLoading={isLoading}\n showTodoList={isTodoPanelVisible}\n />\n )}\n {/* Turn completion indicator - shows \"Cogitated for Xm Ys\" after AI turn completes */}\n {/* Hidden when queued prompts are pending to prevent brief flash between tasks */}\n {!isResizeClearing &&\n !isLoading &&\n !toolJSX &&\n !toolUseConfirm &&\n !binaryFeedbackContext &&\n queuedPrompts.length === 0 && (\n <TurnCompletionIndicator\n durationMs={lastTurnDurationMs}\n isVisible={lastTurnDurationMs !== null}\n />\n )}\n {/* Render toolJSX here only when it should hide PromptInput */}\n {toolJSX?.shouldHidePromptInput ? toolJSX.jsx : null}\n {!toolJSX && binaryFeedbackContext && !isMessageSelectorVisible && (\n <BinaryFeedback\n m1={binaryFeedbackContext.m1}\n m2={binaryFeedbackContext.m2}\n resolve={result => {\n binaryFeedbackContext.resolve(result)\n setTimeout(() => setBinaryFeedbackContext(null), 0)\n }}\n verbose={verbose}\n normalizedMessages={normalizedMessages}\n tools={currentTools}\n debug={debug}\n erroredToolUseIDs={erroredToolUseIDs}\n inProgressToolUseIDs={inProgressToolUseIDs}\n unresolvedToolUseIDs={unresolvedToolUseIDs}\n />\n )}\n {!toolJSX &&\n toolUseConfirm &&\n !isMessageSelectorVisible &&\n !binaryFeedbackContext &&\n !askUserQuestionContext && (\n <PermissionRequest\n toolUseConfirm={toolUseConfirm}\n onDone={() => setToolUseConfirm(null)}\n verbose={verbose}\n />\n )}\n {!toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !binaryFeedbackContext &&\n askUserQuestionContext && (\n <AskUserQuestionDialog\n context={askUserQuestionContext}\n onDone={() => setAskUserQuestionContext(null)}\n />\n )}\n {!toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !binaryFeedbackContext &&\n !askUserQuestionContext &&\n showingCostDialog && (\n <CostThresholdDialog\n onDone={() => {\n setShowCostDialog(false)\n setHaveShownCostDialog(true)\n const projectConfig = getGlobalConfig()\n saveGlobalConfig({\n ...projectConfig,\n hasAcknowledgedCostThreshold: true,\n })\n }}\n />\n )}\n\n {!toolUseConfirm &&\n !toolJSX?.shouldHidePromptInput &&\n shouldShowPromptInput &&\n !isMessageSelectorVisible &&\n !binaryFeedbackContext &&\n !askUserQuestionContext &&\n !showingCostDialog && (\n <>\n {/* BackgroundTasksPanel */}\n <BackgroundTasksPanel\n shells={backgroundShells}\n isVisible={showBackgroundPanel}\n onSelect={shell => {\n // View shell details (could show detailed output)\n setShowBackgroundPanel(false)\n }}\n onKill={shell => {\n BackgroundShellManager.getInstance().kill(shell.id)\n }}\n onClose={() => setShowBackgroundPanel(false)}\n />\n <PromptInput\n commands={currentCommands}\n forkNumber={forkNumber}\n messageLogName={messageLogName}\n tools={currentTools}\n isDisabled={apiKeyStatus === 'invalid'}\n isLoading={isLoading}\n onQuery={onQuery}\n debug={debug}\n verbose={verbose}\n verboseToggleMessage={verboseToggleMessage}\n messages={messages}\n setToolJSX={setToolJSX}\n input={inputValue}\n onInputChange={setInputValue}\n mode={inputMode}\n onModeChange={setInputMode}\n submitCount={submitCount}\n onSubmitCountChange={setSubmitCount}\n setIsLoading={setIsLoading}\n setAbortController={setAbortController}\n onShowMessageSelector={handleShowMessageSelector}\n setForkConvoWithMessagesOnTheNextRender={\n setForkConvoWithMessagesOnTheNextRender\n }\n readFileTimestamps={readFileTimestamps.current}\n abortController={abortController}\n onModelChange={handleModelChange}\n onRollbackConversation={rollbackConversation}\n onToggleTodoPanel={handleToggleTodoPanel}\n onToggleVerbose={handleToggleVerbose}\n onToggleBackgroundPanel={handleToggleBackgroundPanel}\n backgroundShellCount={\n backgroundShells.filter(s => s.status === 'running')\n .length\n }\n isBackgroundPanelOpen={showBackgroundPanel}\n fallbackMode={fallbackMode}\n queuedPrompts={queuedPrompts}\n onQueuePrompt={prompt =>\n setQueuedPrompts(prev => [...prev, prompt])\n }\n onPopQueuedPrompt={() => {\n if (queuedPrompts.length === 0) return undefined\n const lastPrompt = queuedPrompts[queuedPrompts.length - 1]\n setQueuedPrompts(prev => prev.slice(0, -1))\n return lastPrompt\n }}\n onInterrupt={onInterrupt}\n isOverlayActive={\n !!(toolJSX && !toolJSX.shouldHidePromptInput)\n }\n unmount={unmountREPL}\n startupItems={startupItems}\n />\n {/* Render toolJSX below PromptInput when shouldHidePromptInput is false */}\n {toolJSX && !toolJSX.shouldHidePromptInput && toolJSX.jsx}\n </>\n )}\n </Box>\n {isMessageSelectorVisible && (\n <React.Fragment key={`message-selector-wrapper-${forkNumber}`}>\n <MessageSelector\n erroredToolUseIDs={erroredToolUseIDs}\n unresolvedToolUseIDs={unresolvedToolUseIDs}\n messages={normalizeMessagesForAPI(messages)}\n onSelect={async message => {\n setIsMessageSelectorVisible(false)\n\n // If the user selected the current prompt, do nothing\n if (!messages.includes(message)) {\n return\n }\n\n // Cancel tool use calls/requests\n onCancel()\n\n // Hack: make sure the \"Interrupted by user\" message is\n // rendered in response to the cancellation. Otherwise,\n // the screen will be cleared but there will remain a\n // vestigial \"Interrupted by user\" message at the top.\n setImmediate(async () => {\n // Clear messages, and re-render\n await clearTerminal()\n setMessages([])\n setForkConvoWithMessagesOnTheNextRender(\n messages.slice(0, messages.indexOf(message)),\n )\n\n // Populate/reset the prompt input\n if (typeof message.message.content === 'string') {\n setInputValue(message.message.content)\n }\n })\n }}\n onEscape={() => setIsMessageSelectorVisible(false)}\n tools={currentTools}\n />\n </React.Fragment>\n )}\n {/** Fix occasional rendering artifact */}\n <Newline />\n </React.Fragment>\n }\n />\n )\n}\n\nfunction shouldRenderStatically(\n message: NormalizedMessage,\n messages: NormalizedMessage[],\n unresolvedToolUseIDs: Set<string>,\n): boolean {\n switch (message.type) {\n case 'user':\n case 'assistant': {\n const toolUseID = getToolUseID(message)\n if (!toolUseID) {\n return true\n }\n if (unresolvedToolUseIDs.has(toolUseID)) {\n return false\n }\n // Phase 2.1: Removed delay - immediately mark as static when resolved\n\n const correspondingProgressMessage = messages.find(\n _ => _.type === 'progress' && _.toolUseID === toolUseID,\n ) as ProgressMessage | null\n if (!correspondingProgressMessage) {\n return true\n }\n\n return !intersects(\n unresolvedToolUseIDs,\n correspondingProgressMessage.siblingToolUseIDs,\n )\n }\n case 'progress':\n // Phase 2.1: Immediately mark as static when resolved - no delay\n return !intersects(unresolvedToolUseIDs, message.siblingToolUseIDs)\n }\n}\n\nfunction intersects<A>(a: Set<A>, b: Set<A>): boolean {\n return a.size > 0 && b.size > 0 && [...a].some(_ => b.has(_))\n}\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,KAAK,SAAS,QAAQ,MAAM,cAAc;AACnD,OAAO;AAAA,EACL;AAAA,OACK;AAEP,SAAS,2BAA2B;AACpC,YAAY,WAAW;AACvB,SAAS,WAAW,SAAS,QAAQ,UAAU,mBAAmB;AAElE,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,OAEK;AACP,OAAO,iBAAiB;AACxB,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAC3B,SAAS,cAAc,sBAAsB;AAC7C,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,6BAA6B;AAEtC,OAAO,mBAAmB;AAC1B,SAAS,gBAAgB,8BAA8B;AACvD,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,iCAAiC;AAE1C,SAAS,iBAAiB;AAC1B,SAAS,+BAA+B;AACxC,SAAS,UAAU,uBAAuB;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,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,CAAC;AAAA,UACH;AAAA,UACA,UAAU,MAAM,4BAA4B,KAAK;AAAA,UACjD,OAAO;AAAA;AAAA,MACT,CACF,GAGF,oCAAC,aAAQ,CACX;AAAA;AAAA,EAEJ;AAEJ;AAEA,SAAS,uBACP,SACA,UACA,sBACS;AACT,UAAQ,QAAQ,MAAM;AAAA,IACpB,KAAK;AAAA,IACL,KAAK,aAAa;AAChB,YAAM,YAAY,aAAa,OAAO;AACtC,UAAI,CAAC,WAAW;AACd,eAAO;AAAA,MACT;AACA,UAAI,qBAAqB,IAAI,SAAS,GAAG;AACvC,eAAO;AAAA,MACT;AAGA,YAAM,+BAA+B,SAAS;AAAA,QAC5C,OAAK,EAAE,SAAS,cAAc,EAAE,cAAc;AAAA,MAChD;AACA,UAAI,CAAC,8BAA8B;AACjC,eAAO;AAAA,MACT;AAEA,aAAO,CAAC;AAAA,QACN;AAAA,QACA,6BAA6B;AAAA,MAC/B;AAAA,IACF;AAAA,IACA,KAAK;AAEH,aAAO,CAAC,WAAW,sBAAsB,QAAQ,iBAAiB;AAAA,EACtE;AACF;AAEA,SAAS,WAAc,GAAW,GAAoB;AACpD,SAAO,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK,OAAK,EAAE,IAAI,CAAC,CAAC;AAC9D;",
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import {\n ToolUseBlockParam,\n ToolResultBlockParam,\n} from '@anthropic-ai/sdk/resources/index.mjs'\nimport { Box, Newline, Static, Text, useApp } from 'ink'\nimport ProjectOnboarding, {\n markProjectOnboardingComplete,\n} from '@components/ProjectOnboarding'\nimport type { SafetyMode } from '@utils/config'\nimport { CostThresholdDialog } from '@components/CostThresholdDialog'\nimport * as React from 'react'\nimport { useEffect, useMemo, useRef, useState, useCallback } from 'react'\nimport { Command } from '@commands'\nimport { Logo } from '@components/Logo'\nimport { Message } from '@components/Message'\nimport { MessageResponse } from '@components/MessageResponse'\nimport { BashStreamingProgress } from '@components/BashStreamingProgress'\nimport { StreamingTextPreview } from '@components/StreamingTextPreview'\nimport { MessageSelector } from '@components/MessageSelector'\nimport {\n RewindPanel,\n type RewindAction,\n type RewindPoint,\n} from '@components/RewindPanel'\nimport {\n PermissionRequest,\n type ToolUseConfirm,\n} from '@components/permissions/PermissionRequest'\nimport PromptInput from '@components/PromptInput'\nimport { getSystemPrompt } from '@constants/prompts'\nimport { getContext } from '@context'\nimport { getTotalCost, useCostSummary } from '@costTracker'\nimport { useLogStartupTime } from '@hooks/useLogStartupTime'\nimport { addToHistory } from '@history'\nimport { useApiKeyVerification } from '@hooks/useApiKeyVerification'\n// useCancelRequest removed - ESC interrupt logic consolidated into onInterrupt callback\nimport useCanUseTool from '@hooks/useCanUseTool'\nimport { useLogMessages, serializeMessageForLog } from '@hooks/useLogMessages'\nimport { overwriteLog } from '@utils/log'\nimport { PermissionProvider } from '@context/PermissionContext'\nimport { useFullscreenExitCallback } from '@hooks/useTerminalSize'\n// ModeIndicator moved to PromptInput footer for lightweight inline display\nimport { TodoPanel } from '@components/TodoPanel'\nimport { ThinkingSelector } from '@components/ThinkingSelector'\nimport { TurnCompletionIndicator } from '@components/TurnCompletionIndicator'\nimport { getTodos, initTodoSession } from '@utils/todoStorage'\nimport {\n setMessagesGetter,\n setMessagesSetter,\n setModelConfigChangeHandler,\n setLanguageChangeHandler,\n} from '@messages'\nimport {\n type AssistantMessage,\n type BinaryFeedbackResult,\n type Message as MessageType,\n type ProgressMessage,\n type StreamingProgressContent,\n} from '@query'\nimport type { WrappedClient } from '@services/mcpClient'\nimport type { Tool } from '@tool'\n// Auto-updater removed; only show a new version banner passed from CLI\nimport { getGlobalConfig, saveGlobalConfig } from '@utils/config'\nimport { useBackgroundShells } from '@hooks/useBackgroundShells'\nimport { useDeferredLoading } from '@hooks/useDeferredLoading'\nimport { useSessionTracking } from '@hooks/useSessionTracking'\nimport { getNextAvailableLogForkNumber } from '@utils/log'\nimport {\n getErroredToolUseMessages,\n getInProgressToolUseIDs,\n getLastAssistantMessageId,\n getToolUseID,\n getUnresolvedToolUseIDs,\n INTERRUPT_MESSAGE,\n isNotEmptyMessage,\n type NormalizedMessage,\n normalizeMessages,\n normalizeMessagesForAPI,\n processUserInput,\n reorderMessages,\n extractTag,\n createAssistantMessage,\n createAssistantAPIErrorMessage,\n createUserMessage,\n} from '@utils/messages'\nimport { logError } from '@utils/log'\nimport { getModelManager, ModelManager } from '@utils/model'\nimport {\n clearTerminal,\n clearScreen,\n updateTerminalTitle,\n} from '@utils/terminal'\nimport { BinaryFeedback } from '@components/binary-feedback/BinaryFeedback'\nimport { getMaxThinkingTokens } from '@utils/thinking'\nimport { getOriginalCwd } from '@utils/state'\nimport { animationManager } from '@utils/animationManager'\nimport { handleHashCommand } from '@commands/terminalSetup'\nimport { randomUUID } from 'crypto'\nimport { getMessagesPath } from '@utils/log'\nimport { BackgroundShellManager } from '@utils/BackgroundShellManager'\nimport { BackgroundTasksPanel } from '@components/BackgroundTasksPanel'\nimport { TeamMemberPanel } from '@components/TeamMemberPanel'\nimport { AgentViewBanner } from '@components/AgentViewBanner'\nimport { TitledDivider } from '@components/TitledDivider'\nimport { t } from '@i18n'\nimport { IdleNotificationBar } from '@components/IdleNotificationBar'\nimport { AskUserQuestionDialog } from '@components/AskUserQuestionDialog/AskUserQuestionDialog'\nimport {\n getToolUseIdByAgentId,\n getAgentIdByToolUseId,\n restoreToolUseAgentMappings,\n} from '@utils/agentTranscripts'\nimport type { AskUserQuestionContext } from '@minto-types/askUserQuestion'\nimport useAskUser from '@hooks/useAskUser'\n// V1+ hierarchical message display imports\nimport { useMessageGroups } from '@hooks/useMessageGroups'\nimport { useAgentTranscripts } from '@hooks/useAgentTranscripts'\nimport { GroupRenderer } from '@components/messages/GroupRenderer'\nimport { SEMANTIC_COLORS } from '@constants/colors'\nimport { useIdleNotifications } from '@hooks/useIdleNotifications'\nimport { useTeamMembers } from '@hooks/useTeamMembers'\nimport {\n recordFirstPrompt,\n incrementMessageCount,\n incrementToolCallCount,\n flushSessionStats,\n} from '@utils/sessionTracker'\nimport {\n getActiveTeams,\n disbandTeam,\n formatUserGuidanceForInjection,\n teamEvents,\n} from '@services/agentTeams'\nimport { AgentEngine } from '../engine/AgentEngine'\nimport { EngineRegistry, setGlobalRegistry } from '../engine/EngineRegistry'\nimport { useAgentEngine } from '@hooks/useAgentEngine'\n\n// Maximum number of recent messages to display when resuming a conversation\n// Set to Infinity to show all messages (user can scroll to see earlier ones)\nconst RESUME_VISIBLE_MESSAGE_COUNT = Infinity\n\n// Number of messages to show initially in transcript mode (Ctrl+O)\n// Ctrl+E toggles between showing last N and showing all\nconst TRANSCRIPT_VISIBLE_COUNT = 10\n\n// Screen mode type: 'prompt' (normal) or 'transcript' (detailed, verbose)\ntype ScreenMode = 'prompt' | 'transcript'\n\ntype Props = {\n commands: Command[]\n /** @deprecated Use safetyMode instead */\n safeMode?: boolean\n /** Safety mode: 'yolo' | 'smart' | 'strict' */\n safetyMode?: SafetyMode\n debug?: boolean\n initialForkNumber?: number | undefined\n initialPrompt: string | undefined\n // A unique name for the message log file, used to identify the fork\n messageLogName: string\n shouldShowPromptInput: boolean\n tools: Tool[]\n /**\n * Verbose mode: shows full parameters and complete outputs when enabled\n */\n verbose?: boolean | undefined\n // Initial messages to populate the REPL with\n initialMessages?: MessageType[]\n // MCP clients\n mcpClients?: WrappedClient[]\n // Flag to indicate if current model is default\n isDefaultModel?: boolean\n // Update banner info passed from CLI before first render\n initialUpdateVersion?: string | null\n initialUpdateCommands?: string[] | null\n // Whether to use limited input mode (raw mode not supported)\n fallbackMode?: boolean\n // Whether this is a resumed conversation (shows collapsed history indicator)\n isResumedConversation?: boolean\n // Whether architect tool is enabled (needed for deferred getTools() call)\n enableArchitect?: boolean\n}\n\nexport type BinaryFeedbackContext = {\n m1: AssistantMessage\n m2: AssistantMessage\n resolve: (result: BinaryFeedbackResult) => void\n}\n\nexport function REPL({\n commands,\n safeMode,\n safetyMode = 'yolo',\n debug = false,\n initialForkNumber = 0,\n initialPrompt,\n messageLogName,\n shouldShowPromptInput,\n tools,\n verbose: verboseFromCLI,\n initialMessages,\n mcpClients = [],\n isDefaultModel = true,\n initialUpdateVersion,\n initialUpdateCommands,\n fallbackMode = false,\n isResumedConversation = false,\n enableArchitect,\n}: Props): React.ReactNode {\n // Screen mode state: 'prompt' (normal) or 'transcript' (detailed verbose view)\n // Ctrl+O toggles between modes; verbose is derived from screen mode\n const [screen, setScreen] = useState<ScreenMode>(\n verboseFromCLI === true ? 'transcript' : 'prompt',\n )\n // Whether to show all messages in transcript mode (toggled by Ctrl+E)\n const [showAllInTranscript, setShowAllInTranscript] = useState(false)\n // Derived verbose flag \u2014 used by all downstream display logic\n const verbose = screen === 'transcript'\n\n // Used to force the logo to re-render and conversation log to use a new file\n const [forkNumber, setForkNumber] = useState(\n getNextAvailableLogForkNumber(messageLogName, initialForkNumber, 0),\n )\n\n // State to temporarily hide transient UI during resize to prevent ghost artifacts\n const [isResizeClearing, setIsResizeClearing] = useState(false)\n\n // Centralized 4-step anti-ghosting protocol for all forkNumber changes.\n // Hides transient UI \u2192 waits for empty render \u2192 clears terminal \u2192 runs optional callback \u2192 re-renders.\n const safeRefork = useCallback(async (beforeRefork?: () => void) => {\n setIsResizeClearing(true)\n await new Promise(resolve => setTimeout(resolve, 50))\n await clearTerminal()\n beforeRefork?.()\n setForkNumber(prev => prev + 1)\n setIsResizeClearing(false)\n }, [])\n\n // Get exit function from Ink for unmounting (used by /resume command)\n const { exit: unmountREPL } = useApp()\n\n // Re-render UI when significant resize occurs to clear ghost artifacts\n useFullscreenExitCallback(() => safeRefork())\n\n // Re-render UI when resuming from background (tab switch, app nap, system sleep).\n // AnimationManager detects tick gaps > 2s and fires onResume callbacks.\n // Without this, Ink's differential rendering gets out of sync while the terminal\n // is invisible, causing ghost artifacts when the user returns.\n useEffect(() => {\n const unsubscribe = animationManager.onResume(() => safeRefork())\n return unsubscribe\n }, [safeRefork])\n\n // Handle SIGCONT: process resumed from suspension (Ctrl+Z \u2192 fg).\n // Same ghost artifact issue \u2014 terminal state is stale after resume.\n useEffect(() => {\n const handler = () => safeRefork()\n process.on('SIGCONT', handler)\n return () => {\n process.off('SIGCONT', handler)\n }\n }, [safeRefork])\n\n const [\n forkConvoWithMessagesOnTheNextRender,\n setForkConvoWithMessagesOnTheNextRender,\n ] = useState<MessageType[] | null>(null)\n\n // \u2500\u2500 Default Engine + Registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Engine is the single source of truth for messages, loading state, and abort.\n const defaultEngine = useMemo(() => {\n const engine = new AgentEngine({\n agentId: 'default',\n name: 'default',\n role: 'default',\n systemPrompt: () => getSystemPrompt(),\n context: () => getContext(),\n tools: tools,\n commands: commands,\n initialMessages: initialMessages ?? [],\n verbose: verboseFromCLI === true,\n safeMode,\n safetyMode,\n messageLogName,\n forkNumber: getNextAvailableLogForkNumber(\n messageLogName,\n initialForkNumber,\n 0,\n ),\n })\n return engine\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const registry = useMemo(() => {\n const r = new EngineRegistry()\n r.register('default', defaultEngine)\n setGlobalRegistry(r)\n return r\n }, [defaultEngine])\n\n // Subscribe to focused engine events \u2192 React state\n const {\n messages,\n isLoading,\n lastTurnDurationMs,\n submitPrompt: engineSubmitPrompt,\n abort: engineAbort,\n setMessages: engineSetMessages,\n appendMessages: engineAppendMessages,\n } = useAgentEngine(registry.focused ?? null)\n\n // No auto-updater state\n const [toolJSX, setToolJSX] = useState<{\n jsx: React.ReactNode | null\n shouldHidePromptInput: boolean\n } | null>(null)\n const [toolUseConfirm, setToolUseConfirm] = useState<ToolUseConfirm | null>(\n null,\n )\n // Phase 4.1: Message history stack for Esc Esc rollback\n const [messageHistory, setMessageHistory] = useState<MessageType[][]>([])\n const [inputValue, setInputValue] = useState('')\n const [inputMode, setInputMode] = useState<'bash' | 'prompt' | 'koding'>(\n 'prompt',\n )\n const [submitCount, setSubmitCount] = useState(0)\n const [isMessageSelectorVisible, setIsMessageSelectorVisible] =\n useState(false)\n const [isRewindPanelVisible, setIsRewindPanelVisible] = useState(false)\n const [showCostDialog, setShowCostDialog] = useState(false)\n const [haveShownCostDialog, setHaveShownCostDialog] = useState(\n getGlobalConfig().hasAcknowledgedCostThreshold,\n )\n\n const [binaryFeedbackContext, setBinaryFeedbackContext] =\n useState<BinaryFeedbackContext | null>(null)\n const [askUserQuestionContext, setAskUserQuestionContext] =\n useState<AskUserQuestionContext | null>(null)\n // Deferred loading: MCP clients, tools, commands, version check (background)\n const {\n commands: currentCommands,\n tools: currentTools,\n mcpClients: currentMcpClients,\n updateVersion: updateAvailableVersion,\n updateCommands,\n startupItems,\n } = useDeferredLoading({\n initialCommands: commands,\n initialTools: tools,\n initialMcpClients: mcpClients,\n initialUpdateVersion: initialUpdateVersion,\n initialUpdateCommands: initialUpdateCommands,\n enableArchitect,\n })\n\n // TodoPanel state\n const [isTodoPanelVisible, setIsTodoPanelVisible] = useState(true)\n\n // ThinkingSelector overlay state\n const [showThinkingSelector, setShowThinkingSelector] = useState(false)\n\n // Turn duration tracking is now handled by the engine (emits turn_end event).\n // lastTurnDurationMs comes from useAgentEngine.\n\n // Background tasks state (event-driven via hook)\n const {\n shells: backgroundShells,\n isPanelVisible: showBackgroundPanel,\n setIsPanelVisible: setShowBackgroundPanel,\n runningCount: backgroundShellRunningCount,\n } = useBackgroundShells()\n\n // Team panel state\n const [showTeamPanel, setShowTeamPanel] = useState(false)\n\n // Current viewed agent: null = team-lead (main REPL), string = teammate agentId\n const [currentViewAgent, setCurrentViewAgent] = useState<string | null>(null)\n\n // Idle notifications (auto-dismissing toasts when teammates go idle)\n const { notifications: idleNotifications } = useIdleNotifications()\n\n // Team member data for inline context display in PromptInput\n const { members: teamMembers, teamName, hasActiveTeam } = useTeamMembers()\n\n // Auto-cleanup when team is disbanded.\n // Two responsibilities:\n // 1. If viewing a teammate: switch back to team-lead view, clear display.\n // 2. Always: demote the default engine from team-lead, cleaning up stale\n // heartbeat/mailbox/channel resources that would otherwise trigger\n // unexpected re-queries after the team is gone.\n // Also defensively reset UI overlay state (toolJSX, toolUseConfirm) that\n // could block input if left stale.\n useEffect(() => {\n if (!hasActiveTeam) {\n setShowTeamPanel(false)\n // Defensive: reset any UI overlay state that could block input\n setToolJSX(null)\n setToolUseConfirm(null)\n if (currentViewAgent) {\n // Full cleanup: switch focus, clear display, re-mount Static.\n // Uses synchronous clearScreen() to ensure terminal is cleared BEFORE\n // React re-renders \u2014 async clearTerminal() would race with Ink's render.\n setIsResizeClearing(true)\n clearScreen()\n registry.setFocus('default')\n setCurrentViewAgent(null)\n setForkNumber(prev => prev + 1)\n setImmediate(() => setIsResizeClearing(false))\n }\n // Remove team-lead overlay \u2014 revert to default system prompt\n defaultEngine.updateConfig({\n systemPrompt: () => getSystemPrompt(),\n })\n // Demote the default engine: stop heartbeat, unsub mailbox, drain\n // stale channel messages. Without this, the engine's channel listener\n // can trigger phantom queries from stale team messages, which can\n // leave the engine stuck in 'querying' and block user input.\n defaultEngine.demoteFromTeamLead()\n }\n }, [hasActiveTeam]) // eslint-disable-line react-hooks/exhaustive-deps\n\n // React to registry focus changes (e.g., teammate engine unregistered while focused).\n // When the registry silently falls back to 'default', sync React state to match.\n useEffect(() => {\n const unsub = registry.onChange(() => {\n // Skip if we're in the middle of a view switch (prevents double forkNumber bump \u2192 ghost messages)\n if (isSwitchingViewRef.current) return\n // If registry focus fell back to default but React still thinks we're viewing a teammate\n if (registry.focusedId === 'default' && currentViewAgent) {\n setIsResizeClearing(true)\n clearScreen()\n setCurrentViewAgent(null)\n setForkNumber(prev => prev + 1)\n setImmediate(() => setIsResizeClearing(false))\n }\n })\n return unsub\n }, [registry, currentViewAgent])\n\n // Phase 2.1: Removed recentlyCompletedIDs state - immediate static rendering for better performance\n const prevUnresolvedRef = useRef<Set<string>>(new Set())\n\n // Guard to prevent onChange listener from double-triggering forkNumber during view switch\n const isSwitchingViewRef = useRef(false)\n\n // Message batching is now handled by the engine + useAgentEngine hook.\n\n const getBinaryFeedbackResponse = useCallback(\n (\n m1: AssistantMessage,\n m2: AssistantMessage,\n ): Promise<BinaryFeedbackResult> => {\n return new Promise<BinaryFeedbackResult>(resolvePromise => {\n setBinaryFeedbackContext({\n m1,\n m2,\n resolve: resolvePromise,\n })\n })\n },\n [],\n )\n\n const readFileTimestamps = useRef<{\n [filename: string]: number\n }>({})\n\n const { status: apiKeyStatus, reverify } = useApiKeyVerification()\n // Unified interrupt handler - called by PromptInput when ESC is pressed with empty input\n const onInterrupt = useCallback(() => {\n if (!isLoading) {\n return\n }\n\n // Force save messages before interrupt using engine as source of truth\n const currentMessages = registry.focused?.messages\n if (currentMessages && currentMessages.length > 0) {\n const serializedMessages = [...currentMessages].map(\n serializeMessageForLog,\n )\n overwriteLog(\n getMessagesPath(messageLogName, forkNumber, 0),\n serializedMessages,\n )\n }\n\n // Clean up UI state\n setToolJSX(null)\n setToolUseConfirm(null)\n setBinaryFeedbackContext(null)\n // Abort the request \u2014 engine handles isLoading transition\n if (toolUseConfirm) {\n toolUseConfirm.onAbort()\n } else {\n engineAbort()\n }\n }, [\n isLoading,\n registry.focused?.messages,\n messageLogName,\n forkNumber,\n toolUseConfirm,\n engineAbort,\n ])\n\n // Legacy onCancel for other callers (e.g., PermissionRequest)\n const onCancel = useCallback(() => {\n onInterrupt()\n }, [onInterrupt])\n\n useEffect(() => {\n if (forkConvoWithMessagesOnTheNextRender) {\n setForkNumber(_ => _ + 1)\n setForkConvoWithMessagesOnTheNextRender(null)\n engineSetMessages(forkConvoWithMessagesOnTheNextRender)\n }\n }, [forkConvoWithMessagesOnTheNextRender, engineSetMessages])\n\n useEffect(() => {\n const totalCost = getTotalCost()\n if (totalCost >= 5 /* $5 */ && !showCostDialog && !haveShownCostDialog) {\n setShowCostDialog(true)\n }\n }, [messages, showCostDialog, haveShownCostDialog])\n\n // Update banner is provided by CLI at startup; no async check here.\n\n const canUseTool = useCanUseTool(setToolUseConfirm)\n const askUser = useAskUser(setAskUserQuestionContext)\n\n async function onInit() {\n reverify()\n\n if (!initialPrompt) {\n return\n }\n\n try {\n const tempAbortController = new AbortController()\n const newMessages = await processUserInput(\n initialPrompt,\n 'prompt',\n setToolJSX,\n {\n abortController: tempAbortController,\n options: {\n commands: currentCommands,\n forkNumber,\n messageLogName,\n tools: currentTools,\n verbose,\n maxThinkingTokens: 0,\n },\n messageId: getLastAssistantMessageId(messages),\n setForkConvoWithMessagesOnTheNextRender,\n readFileTimestamps: readFileTimestamps.current,\n },\n null,\n )\n\n if (newMessages.length) {\n for (const message of newMessages) {\n if (message.type === 'user') {\n addToHistory(initialPrompt)\n }\n }\n // Delegate to onQuery which uses the engine\n await onQuery(newMessages)\n } else {\n addToHistory(initialPrompt)\n }\n\n setHaveShownCostDialog(\n getGlobalConfig().hasAcknowledgedCostThreshold || false,\n )\n } catch (error) {\n logError(error)\n }\n }\n\n // Phase 4.1: Rollback to previous message state\n const rollbackConversation = useCallback((): boolean => {\n if (messageHistory.length === 0) {\n return false // No history to rollback to\n }\n\n // Pop the last snapshot and restore it\n const previousMessages = messageHistory[messageHistory.length - 1]\n if (!previousMessages) return false\n engineSetMessages(previousMessages)\n setMessageHistory(history => history.slice(0, -1))\n\n return true // Successfully rolled back\n }, [messageHistory, engineSetMessages])\n\n // \u2500\u2500 Query handler: delegates to engine \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // The engine handles the query loop, post-query drain, and team message delivery.\n // This wrapper does REPL-layer pre/post-processing.\n async function onQuery(\n newMessages: MessageType[],\n _passedAbortController?: AbortController,\n ) {\n // Reset to normal mode when user starts new task\n setScreen('prompt')\n setShowAllInTranscript(false)\n\n // Check if this is a Koding request based on last message's options\n const firstMessage = newMessages[0]\n const isKodingRequest =\n newMessages.length > 0 &&\n firstMessage !== undefined &&\n firstMessage.type === 'user' &&\n 'options' in firstMessage &&\n (firstMessage as any).options?.isKodingRequest === true\n\n // Save message history snapshot for rollback (limit to last 10)\n setMessageHistory(history => [...history, [...messages]].slice(-10))\n\n // Mark onboarding as complete when any user message is sent\n markProjectOnboardingComplete()\n\n // Session tracking\n const lastMessage = newMessages[newMessages.length - 1]\n if (\n lastMessage &&\n lastMessage.type === 'user' &&\n typeof lastMessage.message.content === 'string'\n ) {\n recordFirstPrompt(lastMessage.message.content)\n incrementMessageCount(1)\n }\n\n // If last message is assistant (bash command result / slash command), just append\n if (lastMessage && lastMessage.type === 'assistant') {\n engineAppendMessages(newMessages)\n return\n }\n\n // Update the focused engine config with current maxThinkingTokens\n const maxThinkingTokens = await getMaxThinkingTokens([\n ...messages,\n ...newMessages,\n ])\n const targetEngine = registry.focused ?? defaultEngine\n targetEngine.updateConfig({ maxThinkingTokens })\n\n // If isKodingRequest, mark it in the engine config so we can handle post-query\n if (isKodingRequest) {\n targetEngine.updateConfig({ isKodingRequest: true })\n }\n\n // Delegate to engine \u2014 it handles the query loop, batching, and drain\n await engineSubmitPrompt(newMessages)\n\n // Post-query: flush session stats\n flushSessionStats()\n\n // Post-query: Koding response save\n if (isKodingRequest) {\n const engineMsgs = registry.focused?.messages ?? []\n const lastAssistantMsg = [...engineMsgs]\n .reverse()\n .find(m => m.type === 'assistant')\n if (lastAssistantMsg && lastAssistantMsg.type === 'assistant') {\n try {\n const content =\n typeof lastAssistantMsg.message.content === 'string'\n ? lastAssistantMsg.message.content\n : lastAssistantMsg.message.content\n .filter(block => block.type === 'text')\n .map(block => (block.type === 'text' ? block.text : ''))\n .join('\\n')\n if (content && content.trim().length > 0) {\n handleHashCommand(content)\n }\n } catch (error) {\n console.error('Error saving response to project docs:', error)\n }\n }\n targetEngine.updateConfig({ isKodingRequest: undefined })\n }\n }\n\n // Register cost summary tracker\n useCostSummary()\n\n // Register messages getter and setter (engine is source of truth)\n useEffect(() => {\n const getMessages = () => messages\n setMessagesGetter(getMessages)\n setMessagesSetter(engineSetMessages)\n }, [messages, engineSetMessages])\n\n // Initialize todo session with unique identifier\n // Using messageLogName + forkNumber as session ID to ensure:\n // 1. Each conversation has its own todo list\n // 2. Resumed conversations restore their todos\n useEffect(() => {\n const todoSessionId = `${messageLogName}-${forkNumber}`\n initTodoSession(todoSessionId)\n\n // Restore transcript mappings for history restore\n // This enables proper display of Task tool results from previous sessions\n if (initialMessages && initialMessages.length > 0) {\n restoreToolUseAgentMappings()\n }\n }, [messageLogName, forkNumber, initialMessages])\n\n // Register model config change handler for UI refresh\n useEffect(() => {\n setModelConfigChangeHandler(() => safeRefork())\n }, [safeRefork])\n\n // Register language change handler for UI refresh\n useEffect(() => {\n setLanguageChangeHandler(() => safeRefork())\n }, [safeRefork])\n\n // messagesRef removed \u2014 engine.messages is the synchronous source of truth\n\n // Record transcripts locally, for debugging and conversation recovery\n useLogMessages(messages, messageLogName, forkNumber)\n\n // Log startup time\n useLogStartupTime()\n\n // Initial load\n useEffect(() => {\n onInit()\n // TODO: fix this\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n // Session tracking: plugins, hook manager, session lifecycle\n useSessionTracking(messageLogName, forkNumber)\n\n // Unified message source: focused engine provides messages via useAgentEngine.\n // For teammate engines, skip the inherited parent messages prefix so only\n // the agent's own activity (its prompt, tool calls, responses) is rendered.\n // This prevents \"mixed content\" where parent messages bleed into the teammate view.\n const activeMessages = useMemo(() => {\n const engine = registry.focused\n if (\n engine &&\n engine !== defaultEngine &&\n engine.ownMessagesStartIndex > 0\n ) {\n return messages.slice(engine.ownMessagesStartIndex)\n }\n return messages\n }, [messages, currentViewAgent, registry, defaultEngine])\n\n const normalizedMessages = useMemo(\n () => normalizeMessages(activeMessages).filter(isNotEmptyMessage),\n [activeMessages],\n )\n\n const unresolvedToolUseIDs = useMemo(\n () => getUnresolvedToolUseIDs(normalizedMessages),\n [normalizedMessages],\n )\n\n // Phase 2.1: Removed 300ms delay useEffect - immediate static rendering\n // Update prevUnresolvedRef when unresolvedToolUseIDs changes\n useEffect(() => {\n prevUnresolvedRef.current = new Set(unresolvedToolUseIDs)\n }, [unresolvedToolUseIDs])\n\n const inProgressToolUseIDs = useMemo(\n () => getInProgressToolUseIDs(normalizedMessages),\n [normalizedMessages],\n )\n\n const erroredToolUseIDs = useMemo(\n () =>\n new Set(\n getErroredToolUseMessages(normalizedMessages).map(\n _ => (_.message.content[0]! as ToolUseBlockParam).id,\n ),\n ),\n [normalizedMessages],\n )\n\n // V1+ Message Groups - identifies parallel task groups for unified rendering\n const {\n groups: messageGroups,\n getGroupForMessage,\n getGroupForToolUse,\n shouldGroupBeStatic,\n displayConfig,\n } = useMessageGroups(\n normalizedMessages,\n unresolvedToolUseIDs,\n inProgressToolUseIDs,\n verbose,\n )\n\n // V1+ Agent Transcripts - real-time transcript access for task display\n // getTranscript enables lazy loading from disk for historical messages\n const { transcripts: agentTranscripts, getTranscript } = useAgentTranscripts()\n\n // V1+ Tool outputs map for group rendering\n const toolOutputs = useMemo(() => {\n const outputs = new Map<string, ToolResultBlockParam>()\n for (const msg of normalizedMessages) {\n if (msg.type === 'user' && msg.message.role === 'user') {\n for (const block of msg.message.content) {\n if (typeof block === 'object' && block.type === 'tool_result') {\n outputs.set(block.tool_use_id, block as ToolResultBlockParam)\n }\n }\n }\n }\n return outputs\n }, [normalizedMessages])\n\n // Type for message JSX items - pre-rendered JSX with static/transient type\n type MessageJSXItem = {\n type: 'static' | 'transient'\n jsx: React.ReactElement\n }\n\n // Static item type for Ink's Static component (requires id for deduplication)\n type StaticItem = { id: string; jsx: React.ReactElement }\n\n const messagesJSX = useMemo(() => {\n const reorderedMessages = reorderMessages(normalizedMessages)\n const isTranscript = screen === 'transcript'\n\n // Message truncation: transcript mode (last 10) or resume mode\n const shouldTruncateTranscript = isTranscript && !showAllInTranscript\n const totalMessageCount = reorderedMessages.length\n const transcriptTruncatedCount =\n shouldTruncateTranscript && totalMessageCount > TRANSCRIPT_VISIBLE_COUNT\n ? totalMessageCount - TRANSCRIPT_VISIBLE_COUNT\n : 0\n\n // Resume truncation (separate, lower priority)\n const resumeHiddenCount =\n !isTranscript &&\n isResumedConversation &&\n reorderedMessages.length > RESUME_VISIBLE_MESSAGE_COUNT\n ? reorderedMessages.length - RESUME_VISIBLE_MESSAGE_COUNT\n : 0\n\n // Apply truncation: transcript mode takes precedence\n const visibleMessages =\n transcriptTruncatedCount > 0\n ? reorderedMessages.slice(-TRANSCRIPT_VISIBLE_COUNT)\n : resumeHiddenCount > 0\n ? reorderedMessages.slice(-RESUME_VISIBLE_MESSAGE_COUNT)\n : reorderedMessages\n\n // Build the result array with conditional header\n const result: MessageJSXItem[] = []\n\n // Unified header: Logo + Onboarding for all agents\n // In team mode with a focused teammate, also show the agent indicator\n result.push({\n type: 'static',\n jsx: (\n <Box flexDirection=\"column\" width=\"100%\" key=\"logo\">\n <Logo\n mcpClients={currentMcpClients}\n isDefaultModel={isDefaultModel}\n updateBannerVersion={updateAvailableVersion}\n updateBannerCommands={updateCommands}\n />\n <ProjectOnboarding workspaceDir={getOriginalCwd()} />\n {currentViewAgent &&\n (() => {\n const focusedEngine = registry.get(registry.focusedId)\n const engineName = focusedEngine?.engineConfig?.name ?? 'unknown'\n const engineState = focusedEngine?.state ?? 'pending'\n return (\n <AgentViewBanner\n displayName={\n currentViewAgent.includes('@')\n ? currentViewAgent.split('@')[0]!\n : currentViewAgent\n }\n agentType={engineName}\n status={engineState}\n />\n )\n })()}\n </Box>\n ),\n })\n\n // Transcript mode: show \"ctrl+e to show/hide N previous messages\" divider\n if (transcriptTruncatedCount > 0) {\n result.push({\n type: 'static' as const,\n jsx: (\n <Box key={`transcript-truncation-${forkNumber}`} width=\"100%\">\n <TitledDivider\n title={t('ui.transcript.showPrevious').replace(\n '{count}',\n String(transcriptTruncatedCount),\n )}\n />\n </Box>\n ),\n })\n } else if (\n isTranscript &&\n showAllInTranscript &&\n totalMessageCount > TRANSCRIPT_VISIBLE_COUNT\n ) {\n result.push({\n type: 'static' as const,\n jsx: (\n <Box key={`transcript-hide-${forkNumber}`} width=\"100%\">\n <TitledDivider\n title={t('ui.transcript.hidePrevious').replace(\n '{count}',\n String(totalMessageCount - TRANSCRIPT_VISIBLE_COUNT),\n )}\n />\n </Box>\n ),\n })\n }\n\n // Show collapsed history indicator when resuming with hidden messages\n if (resumeHiddenCount > 0) {\n result.push({\n type: 'static' as const,\n jsx: (\n <Box key=\"collapsed-history\" paddingLeft={2} marginBottom={1}>\n <Text color={SEMANTIC_COLORS.dim}>\n \u00B7\u00B7\u00B7 {resumeHiddenCount} earlier messages hidden \u00B7\u00B7\u00B7\n </Text>\n </Box>\n ),\n })\n }\n\n // V1+ Track rendered groups to avoid duplicate rendering\n const renderedGroupIds = new Set<string>()\n // V1+ Track tool_use_ids that are part of groups (to skip their tool_result messages)\n const groupToolUseIds = new Set<string>()\n // V1+ Track TaskOutput tool_use_ids that reference grouped tasks (to skip their tool_result messages)\n const taskOutputToolUseIdsToSkip = new Set<string>()\n\n // Render all messages - with V1+ group detection for parallel-tasks and task groups\n for (const _ of visibleMessages) {\n const toolUseID = getToolUseID(_)\n\n // V1+ Check if this message belongs to a group (parallel-tasks or task)\n // For progress messages, use toolUseID to find the group (since progress messages have different UUIDs)\n // For assistant messages, also fallback to toolUseID lookup if UUID lookup fails\n // (this prevents double rendering when a message UUID isn't registered in the group)\n let group = getGroupForMessage(_.uuid)\n if (!group && _.type === 'progress') {\n // This is a progress message for a task - look up by toolUseID\n group = getGroupForToolUse(_.toolUseID)\n }\n if (!group && toolUseID) {\n // Fallback: assistant messages with tool_use blocks may not have their UUID registered\n // but their toolUseID should be tracked by the group manager\n group = getGroupForToolUse(toolUseID)\n }\n\n // V1+ Handle grouped messages (parallel-tasks and single task groups)\n if (group && (group.type === 'parallel-tasks' || group.type === 'task')) {\n // Skip if this group was already rendered\n if (renderedGroupIds.has(group.id)) {\n continue\n }\n renderedGroupIds.add(group.id)\n\n // Track all tool_use_ids in this group to skip their tool_result messages later\n if (group.metadata.siblingToolUseIds) {\n for (const id of group.metadata.siblingToolUseIds as string[]) {\n groupToolUseIds.add(id)\n }\n }\n if (group.metadata.toolUseId) {\n groupToolUseIds.add(group.metadata.toolUseId as string)\n }\n\n // Render the entire group using GroupRenderer\n const isGroupStatic = shouldGroupBeStatic(group)\n const groupType = isGroupStatic ? 'static' : 'transient'\n\n const shouldAnimate =\n !toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible &&\n !isGroupStatic\n\n result.push({\n type: groupType,\n jsx: (\n <Box key={`group-${group.id}`} width=\"100%\">\n <GroupRenderer\n group={group}\n context={{\n depth: 0,\n isLastChild: true,\n displayConfig,\n shouldAnimate,\n getTranscript,\n }}\n messages={normalizedMessages}\n transcripts={agentTranscripts}\n outputs={toolOutputs}\n />\n </Box>\n ),\n })\n continue\n }\n\n // V1+ Skip tool_result messages for tools that are part of a group\n // (their output is rendered within the group view)\n // Also skip tool_result messages for TaskOutput calls that reference grouped tasks\n if (_.type === 'user' && _.message.role === 'user') {\n const content = _.message.content\n if (Array.isArray(content)) {\n const toolResult = content.find(\n (block): block is ToolResultBlockParam =>\n typeof block === 'object' && block.type === 'tool_result',\n )\n if (\n toolResult &&\n (groupToolUseIds.has(toolResult.tool_use_id) ||\n taskOutputToolUseIdsToSkip.has(toolResult.tool_use_id))\n ) {\n continue\n }\n }\n }\n\n // V1+ Skip TaskOutput tool calls that reference agents belonging to a group\n // (their output is already rendered within the group view)\n if (_.type === 'assistant') {\n const content = _.message.content\n if (Array.isArray(content)) {\n const taskOutputCall = content.find(\n (block): block is ToolUseBlockParam =>\n typeof block === 'object' &&\n block.type === 'tool_use' &&\n block.name === 'TaskOutput',\n )\n if (taskOutputCall) {\n const taskId = (taskOutputCall.input as { task_id?: string })\n ?.task_id\n if (taskId) {\n // Check if this task_id (agentId) corresponds to a tool_use_id in a group\n const correspondingToolUseId = getToolUseIdByAgentId(taskId)\n if (\n correspondingToolUseId &&\n groupToolUseIds.has(correspondingToolUseId)\n ) {\n // Track this TaskOutput's tool_use_id so we can also skip its tool_result\n taskOutputToolUseIdsToSkip.add(taskOutputCall.id)\n continue\n }\n }\n }\n }\n }\n\n // Skip ALL progress messages when their tool is already completed\n // The final tool_result message will show the complete output, avoiding duplicate display\n // This covers both streaming progress (BashTool) and non-streaming progress (Task intermediate state)\n if (_.type === 'progress' && !unresolvedToolUseIDs.has(_.toolUseID)) {\n continue\n }\n\n // Skip empty text-only assistant messages (API often returns empty text blocks between tool_use blocks)\n // Without this, each empty block renders an empty <Box> which produces a blank line in the output\n if (!isNotEmptyMessage(_)) {\n continue\n }\n\n // Normal message rendering\n const message =\n _.type === 'progress' ? (\n // Check if this is a streaming progress content (e.g., from BashTool)\n 'type' in _.content && _.content.type === 'streaming' ? (\n <BashStreamingProgress\n stdout={(_.content as StreamingProgressContent).stdout}\n stderr={(_.content as StreamingProgressContent).stderr}\n isStreaming={(_.content as StreamingProgressContent).isStreaming}\n />\n ) : (_.content as AssistantMessage).message.content[0]?.type ===\n 'text' &&\n // TaskTool interrupts use Progress messages without extra \u23BF\n // since <Message /> component already adds the margin\n (_.content as AssistantMessage).message.content[0].text ===\n INTERRUPT_MESSAGE ? (\n <Message\n message={_.content as AssistantMessage}\n messages={_.normalizedMessages}\n addMargin={false}\n tools={_.tools}\n verbose={verbose ?? false}\n debug={debug}\n erroredToolUseIDs={new Set()}\n inProgressToolUseIDs={new Set()}\n unresolvedToolUseIDs={new Set()}\n shouldAnimate={false}\n shouldShowDot={false}\n />\n ) : (\n <MessageResponse\n children={\n <Message\n message={_.content as AssistantMessage}\n messages={_.normalizedMessages}\n addMargin={false}\n tools={_.tools}\n verbose={verbose ?? false}\n debug={debug}\n erroredToolUseIDs={new Set()}\n inProgressToolUseIDs={new Set()}\n unresolvedToolUseIDs={\n new Set([\n (\n (_.content as AssistantMessage).message\n .content[0]! as ToolUseBlockParam\n ).id,\n ])\n }\n shouldAnimate={false}\n shouldShowDot={false}\n />\n }\n />\n )\n ) : (\n <Message\n message={_}\n messages={normalizedMessages}\n addMargin={true}\n tools={currentTools}\n verbose={verbose}\n debug={debug}\n erroredToolUseIDs={erroredToolUseIDs}\n inProgressToolUseIDs={inProgressToolUseIDs}\n shouldAnimate={\n !toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible &&\n (!toolUseID || inProgressToolUseIDs.has(toolUseID))\n }\n shouldShowDot={true}\n unresolvedToolUseIDs={unresolvedToolUseIDs}\n />\n )\n\n const type = shouldRenderStatically(\n _,\n normalizedMessages,\n unresolvedToolUseIDs,\n )\n ? 'static'\n : 'transient'\n\n if (debug) {\n result.push({\n type,\n jsx: (\n <Box\n borderStyle=\"single\"\n borderColor={type === 'static' ? 'green' : 'red'}\n key={_.uuid}\n width=\"100%\"\n >\n {message}\n </Box>\n ),\n })\n } else {\n result.push({\n type,\n jsx: (\n <Box key={_.uuid} width=\"100%\">\n {message}\n </Box>\n ),\n })\n }\n }\n\n return result\n }, [\n forkNumber,\n normalizedMessages,\n currentTools,\n verbose,\n debug,\n erroredToolUseIDs,\n inProgressToolUseIDs,\n toolJSX,\n toolUseConfirm,\n isMessageSelectorVisible,\n isRewindPanelVisible,\n unresolvedToolUseIDs,\n currentMcpClients,\n isDefaultModel,\n isResumedConversation,\n // Transcript mode dependencies\n screen,\n showAllInTranscript,\n // V1+ dependencies\n messageGroups,\n getGroupForMessage,\n getGroupForToolUse,\n shouldGroupBeStatic,\n displayConfig,\n agentTranscripts,\n toolOutputs,\n // Agent view dependencies\n currentViewAgent,\n ])\n\n // only show the dialog once not loading\n const showingCostDialog = !isLoading && showCostDialog\n\n // Separate static and dynamic messages for proper Ink Static component usage\n // Static messages: completed messages that won't change - protected from Ink's clearTerminal\n // Dynamic messages: in-progress messages that need to re-render\n const { staticItems, dynamicItems } = useMemo(() => {\n const staticItems: StaticItem[] = []\n const dynamicItems: MessageJSXItem[] = []\n\n for (const item of messagesJSX) {\n if (item.type === 'static') {\n // Extract key from jsx element for Static component deduplication\n const key = item.jsx.key?.toString() || `static-${staticItems.length}`\n staticItems.push({ id: key, jsx: item.jsx })\n } else if (item.type === 'transient') {\n dynamicItems.push(item)\n }\n }\n\n return { staticItems, dynamicItems }\n }, [messagesJSX])\n\n // =========================================================================\n // Stable callback functions for PromptInput props\n // Using useCallback prevents memo invalidation on parent re-renders\n // =========================================================================\n\n // No-op callbacks for PromptInput (engine manages these)\n const noopSetBool = useCallback((_: boolean) => {}, [])\n const noopSetAbort = useCallback((_: AbortController | null) => {}, [])\n\n // Toggle message selector visibility\n const handleShowMessageSelector = useCallback(() => {\n setIsMessageSelectorVisible(prev => !prev)\n }, [])\n\n // Show rewind panel (double-Esc)\n const handleShowRewindPanel = useCallback(() => {\n if (messages.length === 0) return\n setIsRewindPanelVisible(true)\n }, [messages.length])\n\n // Handle rewind action selection\n const handleRewindAction = useCallback(\n (action: RewindAction, point: RewindPoint) => {\n setIsRewindPanelVisible(false)\n\n if (action === 'never_mind') return\n\n if (\n action === 'restore_code_and_conversation' ||\n action === 'restore_conversation'\n ) {\n // Cancel any running task\n onCancel()\n setImmediate(async () => {\n await clearTerminal()\n // Truncate messages to before the selected user message\n const truncatedMessages = messages.slice(0, point.messageIndex)\n engineSetMessages([])\n setForkConvoWithMessagesOnTheNextRender(truncatedMessages)\n // Pre-fill input with the selected prompt text for re-editing\n if (point.userText) {\n setInputValue(point.userText)\n }\n })\n return\n }\n\n if (action === 'restore_code') {\n // Code-only restore: keep conversation, revert files\n // File restoration relies on CheckpointManager data if available\n // TODO: wire CheckpointManager.restore() when checkpoints are created per turn\n return\n }\n\n if (action === 'summarize_from_here') {\n // Summarize messages from the selected point forward\n // Keep messages before the selected point, compact the rest\n onCancel()\n setImmediate(async () => {\n await clearTerminal()\n const preserved = messages.slice(0, point.messageIndex)\n engineSetMessages([])\n setForkConvoWithMessagesOnTheNextRender(preserved)\n // Pre-fill with the original prompt for re-submission\n if (point.userText) {\n setInputValue(point.userText)\n }\n })\n }\n },\n [\n messages,\n onCancel,\n engineSetMessages,\n setForkConvoWithMessagesOnTheNextRender,\n ],\n )\n\n // Toggle todo panel visibility\n const handleToggleTodoPanel = useCallback(() => {\n setIsTodoPanelVisible(prev => !prev)\n }, [])\n\n // Toggle thinking selector overlay\n const handleToggleThinkingSelector = useCallback(() => {\n setShowThinkingSelector(prev => !prev)\n }, [])\n\n // Toggle background panel visibility\n const handleToggleBackgroundPanel = useCallback(() => {\n setShowBackgroundPanel(prev => !prev)\n }, [])\n\n // Toggle team panel visibility\n const handleToggleTeamPanel = useCallback(() => {\n setShowTeamPanel(prev => !prev)\n }, [])\n\n // Kill all background agents (Ctrl+F double-tap)\n const handleKillAllAgents = useCallback(() => {\n const teams = getActiveTeams()\n for (const team of teams) {\n disbandTeam(team.name)\n }\n }, [])\n\n // Unified view switch: clear terminal + swap message source via currentViewAgent\n // All agents (team-lead + teammates) use the same rendering pipeline.\n // Switching = clear screen + set currentViewAgent + increment forkNumber to force Static re-emit.\n const handleSwitchView = useCallback(\n async (agentId: string | null) => {\n isSwitchingViewRef.current = true\n setShowTeamPanel(false)\n const isTeamLead =\n agentId === null ||\n agentId.startsWith('team-lead') ||\n agentId === 'team-lead'\n\n // Pause idle timeout on old focused engine, resume on switch away\n const oldFocused = registry.focused\n if (oldFocused && oldFocused !== defaultEngine) {\n oldFocused.setIdlePaused(false)\n }\n\n await safeRefork(() => {\n setCurrentViewAgent(isTeamLead ? null : agentId)\n const targetId = isTeamLead ? 'default' : agentId!\n if (registry.get(targetId)) {\n registry.setFocus(targetId)\n const newFocused = registry.get(targetId)\n if (newFocused && newFocused !== defaultEngine) {\n newFocused.setIdlePaused(true)\n }\n } else {\n registry.setFocus('default')\n }\n })\n isSwitchingViewRef.current = false\n },\n [registry, defaultEngine],\n )\n\n const handleBackFromAgent = useCallback(async () => {\n await handleSwitchView(null)\n }, [handleSwitchView])\n\n // Cycle through teammates (Shift+Down/Up)\n // List includes team-lead (null) + all active teammates\n const handleCycleTeammate = useCallback(\n (direction: 'next' | 'prev') => {\n const activeMembers = teamMembers.filter(m => m.status !== 'stopped')\n if (activeMembers.length === 0) return\n\n // Build member list: null (team-lead) + all active teammates\n const memberIds: (string | null)[] = [\n null,\n ...activeMembers.map(m => m.name),\n ]\n\n // Find current focused index\n const currentIdx =\n currentViewAgent === null\n ? 0\n : memberIds.findIndex(\n id =>\n id !== null &&\n (currentViewAgent.includes(id) ||\n id.includes(currentViewAgent?.split('@')[0] || '')),\n )\n\n let nextIdx: number\n if (direction === 'next') {\n nextIdx = currentIdx < 0 ? 0 : (currentIdx + 1) % memberIds.length\n } else {\n nextIdx =\n currentIdx < 0\n ? memberIds.length - 1\n : (currentIdx - 1 + memberIds.length) % memberIds.length\n }\n\n const nextId = memberIds[nextIdx]\n if (nextId) handleSwitchView(nextId)\n },\n [teamMembers, currentViewAgent, handleSwitchView],\n )\n\n // Toggle agent view (Ctrl+J)\n const handleToggleAgentView = useCallback(() => {\n if (currentViewAgent) {\n // Already in agent view \u2014 go back to main REPL\n handleBackFromAgent()\n } else {\n // Enter agent view \u2014 focus first active teammate\n const activeMembers = teamMembers.filter(m => m.status !== 'stopped')\n const firstActive = activeMembers[0]\n if (firstActive) {\n handleSwitchView(firstActive.name)\n }\n }\n }, [currentViewAgent, teamMembers, handleBackFromAgent, handleSwitchView])\n\n // Handle model change (force re-render with terminal clear to prevent ghosting)\n const handleModelChange = useCallback(() => safeRefork(), [safeRefork])\n\n // Screen mode toggle handler (Ctrl+O) - switch between prompt and transcript\n const handleToggleScreen = useCallback(async () => {\n setShowAllInTranscript(false)\n await safeRefork(() =>\n setScreen(prev => (prev === 'transcript' ? 'prompt' : 'transcript')),\n )\n }, [safeRefork])\n\n // Show/hide previous messages in transcript mode (Ctrl+E)\n const handleToggleShowAll = useCallback(async () => {\n await safeRefork(() => setShowAllInTranscript(prev => !prev))\n }, [safeRefork])\n\n // Event-driven re-query: handled by the engine's injection channel listener.\n\n // Reactive team engine: promote default engine to team-lead when team is created\n useEffect(() => {\n const unsubscribe = teamEvents.onTeamChange(\n (data: { teamName: string; event: string }) => {\n if (data.event === 'created') {\n defaultEngine.promoteToTeamLead(data.teamName)\n // Inject team-lead overlay into system prompt\n defaultEngine.updateConfig({\n systemPrompt: () => getSystemPrompt('team-lead'),\n })\n } else if (data.event === 'disbanded') {\n // Remove team-lead overlay \u2014 revert to default system prompt\n defaultEngine.updateConfig({\n systemPrompt: () => getSystemPrompt(),\n })\n }\n },\n )\n return unsubscribe\n }, [defaultEngine])\n\n // Wire interactive callbacks to the focused engine\n useEffect(() => {\n const engine = registry.focused\n if (!engine) return\n engine.setCanUseTool(canUseTool)\n engine.setAskUser(askUser)\n engine.setToolJSX(setToolJSX)\n engine.setBinaryFeedbackResponse(getBinaryFeedbackResponse)\n }, [registry.focusedId, canUseTool, askUser, getBinaryFeedbackResponse])\n\n // Start the default engine on mount\n useEffect(() => {\n defaultEngine.start()\n return () => {\n defaultEngine.stop()\n }\n }, [defaultEngine])\n\n // Update engine config when tools/commands change\n useEffect(() => {\n defaultEngine.updateConfig({\n tools: currentTools,\n commands: currentCommands,\n })\n }, [currentTools, currentCommands, defaultEngine])\n\n // Update engine config when verbose/safeMode/safetyMode change\n useEffect(() => {\n defaultEngine.updateConfig({ verbose, safeMode, safetyMode })\n }, [verbose, safeMode, safetyMode, defaultEngine])\n\n return (\n <PermissionProvider\n isBypassPermissionsModeAvailable={!safeMode}\n children={\n <React.Fragment>\n {/* Single unified rendering pipeline \u2014 all agents (team-lead + teammates) render here */}\n <>\n {/*\n Static/Dynamic separation for proper Ink rendering:\n\n 1. Static messages use Ink's <Static> component:\n - Content written to terminal is PRESERVED (not cleared by Ink)\n - Items are deduped by `id` - same id = same output\n - Perfect for: completed messages, finished tool results\n\n 2. Dynamic messages render normally (below Static):\n - Can be re-rendered without affecting static content above\n - Used for: in-progress tools, current interaction\n\n This architecture solves the clearTerminal issue:\n - When outputHeight >= terminal rows, Ink calls clearTerminal + re-render\n - But Static content is already written to terminal, not affected by this\n - Only dynamic content below gets cleared and re-rendered\n */}\n {/* STATIC SECTION: Completed messages protected from Ink's clearTerminal */}\n {/* Note: Static component uses forkNumber in fragment key to force rebuild on verbose toggle */}\n <React.Fragment key={`static-wrapper-${forkNumber}`}>\n <Static<StaticItem>\n items={staticItems}\n children={item => (\n <React.Fragment key={item.id}>{item.jsx}</React.Fragment>\n )}\n />\n </React.Fragment>\n\n {/* DYNAMIC SECTION: In-progress content that can re-render */}\n <React.Fragment key={`dynamic-messages-${forkNumber}`}>\n {/* Render transient items */}\n {dynamicItems.map(item => item.jsx)}\n </React.Fragment>\n {/* Streaming text preview \u2014 typewriter display of LLM output as it generates */}\n {isLoading && !isResizeClearing && <StreamingTextPreview />}\n {/*\n IMPORTANT: Key prop tied to forkNumber ensures all transient UI components\n are properly re-rendered when exiting fullscreen mode. This prevents ghost\n artifacts from appearing when the terminal shrinks significantly.\n See useFullscreenExitCallback above which increments forkNumber on fullscreen exit.\n */}\n <Box\n key={`transient-ui-${forkNumber}`}\n borderColor=\"red\"\n borderStyle={debug ? 'single' : undefined}\n flexDirection=\"column\"\n width=\"100%\"\n >\n {/* Unified Spinner + TodoPanel - shown for ALL focused agents */}\n {/* Hidden during resize clearing to prevent ghost artifacts */}\n {!isResizeClearing &&\n !toolJSX &&\n !toolUseConfirm &&\n !binaryFeedbackContext && (\n <TodoPanel\n todos={getTodos()}\n isVisible={isTodoPanelVisible}\n isLoading={isLoading}\n showTodoList={isTodoPanelVisible}\n focusedAgentId={currentViewAgent}\n />\n )}\n {/* Turn completion indicator - shown for ALL focused agents */}\n {!isResizeClearing &&\n !isLoading &&\n !toolJSX &&\n !toolUseConfirm &&\n !binaryFeedbackContext &&\n !defaultEngine.injectionChannel.hasMessages() && (\n <TurnCompletionIndicator\n durationMs={lastTurnDurationMs}\n isVisible={lastTurnDurationMs !== null}\n />\n )}\n {/* Render toolJSX here only when it should hide PromptInput */}\n {toolJSX?.shouldHidePromptInput ? toolJSX.jsx : null}\n {!toolJSX &&\n binaryFeedbackContext &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible && (\n <BinaryFeedback\n m1={binaryFeedbackContext.m1}\n m2={binaryFeedbackContext.m2}\n resolve={result => {\n binaryFeedbackContext.resolve(result)\n setTimeout(() => setBinaryFeedbackContext(null), 0)\n }}\n verbose={verbose}\n normalizedMessages={normalizedMessages}\n tools={currentTools}\n debug={debug}\n erroredToolUseIDs={erroredToolUseIDs}\n inProgressToolUseIDs={inProgressToolUseIDs}\n unresolvedToolUseIDs={unresolvedToolUseIDs}\n />\n )}\n {!toolJSX &&\n toolUseConfirm &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible &&\n !binaryFeedbackContext &&\n !askUserQuestionContext && (\n <PermissionRequest\n toolUseConfirm={toolUseConfirm}\n onDone={() => setToolUseConfirm(null)}\n verbose={verbose}\n />\n )}\n {!toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible &&\n !binaryFeedbackContext &&\n askUserQuestionContext && (\n <AskUserQuestionDialog\n context={askUserQuestionContext}\n onDone={() => setAskUserQuestionContext(null)}\n />\n )}\n {!toolJSX &&\n !toolUseConfirm &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible &&\n !binaryFeedbackContext &&\n !askUserQuestionContext &&\n showingCostDialog && (\n <CostThresholdDialog\n onDone={() => {\n setShowCostDialog(false)\n setHaveShownCostDialog(true)\n const projectConfig = getGlobalConfig()\n saveGlobalConfig({\n ...projectConfig,\n hasAcknowledgedCostThreshold: true,\n })\n }}\n />\n )}\n\n {!toolUseConfirm &&\n !toolJSX?.shouldHidePromptInput &&\n shouldShowPromptInput &&\n !isMessageSelectorVisible &&\n !isRewindPanelVisible &&\n !showThinkingSelector &&\n !binaryFeedbackContext &&\n !askUserQuestionContext &&\n !showingCostDialog && (\n <>\n {/* BackgroundTasksPanel */}\n <BackgroundTasksPanel\n shells={backgroundShells}\n isVisible={showBackgroundPanel}\n onSelect={shell => {\n // View shell details (could show detailed output)\n setShowBackgroundPanel(false)\n }}\n onKill={shell => {\n BackgroundShellManager.getInstance().kill(shell.id)\n }}\n onClose={() => setShowBackgroundPanel(false)}\n />\n {/* Idle notifications - brief inline toasts when teammates go idle */}\n {!isResizeClearing && (\n <IdleNotificationBar notifications={idleNotifications} />\n )}\n <PromptInput\n commands={currentCommands}\n forkNumber={forkNumber}\n focusedAgentName={\n currentViewAgent\n ? (teamMembers.find(m => m.id === currentViewAgent)\n ?.name ?? currentViewAgent.split('@')[0])\n : hasActiveTeam\n ? 'team-lead'\n : null\n }\n messageLogName={messageLogName}\n tools={currentTools}\n isDisabled={apiKeyStatus === 'invalid'}\n isLoading={isLoading}\n onQuery={onQuery}\n debug={debug}\n verbose={verbose}\n messages={messages}\n setToolJSX={setToolJSX}\n input={inputValue}\n onInputChange={setInputValue}\n mode={inputMode}\n onModeChange={setInputMode}\n submitCount={submitCount}\n onSubmitCountChange={setSubmitCount}\n setIsLoading={noopSetBool}\n setAbortController={noopSetAbort}\n onShowMessageSelector={handleShowMessageSelector}\n setForkConvoWithMessagesOnTheNextRender={\n setForkConvoWithMessagesOnTheNextRender\n }\n readFileTimestamps={readFileTimestamps.current}\n abortController={null}\n onModelChange={handleModelChange}\n onShowRewindPanel={handleShowRewindPanel}\n onToggleTodoPanel={handleToggleTodoPanel}\n onToggleThinkingSelector={handleToggleThinkingSelector}\n onToggleScreen={handleToggleScreen}\n onToggleShowAllInTranscript={handleToggleShowAll}\n screen={screen}\n onToggleBackgroundPanel={handleToggleBackgroundPanel}\n onToggleTeamPanel={handleToggleTeamPanel}\n onCycleTeammate={handleCycleTeammate}\n onToggleAgentView={handleToggleAgentView}\n onKillAllAgents={handleKillAllAgents}\n backgroundShellCount={\n backgroundShells.filter(s => s.status === 'running')\n .length\n }\n isBackgroundPanelOpen={showBackgroundPanel}\n fallbackMode={fallbackMode}\n onInjectMessage={input => {\n const formatted = formatUserGuidanceForInjection(input)\n const focusedEng = registry.focused ?? defaultEngine\n focusedEng.injectionChannel.push(\n formatted,\n 'user',\n input,\n )\n }}\n onRemoveQueuedMessage={() => {\n const focusedEng = registry.focused ?? defaultEngine\n return focusedEng.injectionChannel.removeLastUserMessage()\n }}\n injectionPending={\n (registry.focused ?? defaultEngine).injectionChannel\n .size > 0\n }\n getQueuedUserMessages={() =>\n (\n registry.focused ?? defaultEngine\n ).injectionChannel.peekUserDisplayTexts()\n }\n onInterrupt={onInterrupt}\n isOverlayActive={\n showTeamPanel ||\n !!(toolJSX && !toolJSX.shouldHidePromptInput)\n }\n unmount={unmountREPL}\n startupItems={startupItems}\n teamMembers={teamMembers}\n hasActiveTeam={hasActiveTeam}\n />\n {/* Render toolJSX below PromptInput when shouldHidePromptInput is false */}\n {toolJSX && !toolJSX.shouldHidePromptInput && toolJSX.jsx}\n {/* TeamMemberPanel - rendered below PromptInput like TabbedListView overlays */}\n <TeamMemberPanel\n isVisible={showTeamPanel}\n onClose={() => setShowTeamPanel(false)}\n onFocusAgent={handleSwitchView}\n />\n {/* Transcript mode bottom bar */}\n {screen === 'transcript' && (\n <Box\n width=\"100%\"\n paddingLeft={2}\n marginTop={1}\n borderStyle=\"single\"\n borderTop={true}\n borderBottom={false}\n borderLeft={false}\n borderRight={false}\n borderColor={SEMANTIC_COLORS.dim}\n >\n <Text dimColor>{t('ui.transcript.showing')}</Text>\n </Box>\n )}\n </>\n )}\n </Box>\n {isMessageSelectorVisible && (\n <React.Fragment key={`message-selector-wrapper-${forkNumber}`}>\n <MessageSelector\n erroredToolUseIDs={erroredToolUseIDs}\n unresolvedToolUseIDs={unresolvedToolUseIDs}\n messages={normalizeMessagesForAPI(messages)}\n onSelect={async message => {\n setIsMessageSelectorVisible(false)\n\n // If the user selected the current prompt, do nothing\n if (!messages.includes(message)) {\n return\n }\n\n // Cancel tool use calls/requests\n onCancel()\n\n // Hack: make sure the \"Interrupted by user\" message is\n // rendered in response to the cancellation. Otherwise,\n // the screen will be cleared but there will remain a\n // vestigial \"Interrupted by user\" message at the top.\n setImmediate(async () => {\n // Clear messages, and re-render\n await clearTerminal()\n engineSetMessages([])\n setForkConvoWithMessagesOnTheNextRender(\n messages.slice(0, messages.indexOf(message)),\n )\n\n // Populate/reset the prompt input\n if (typeof message.message.content === 'string') {\n setInputValue(message.message.content)\n }\n })\n }}\n onEscape={() => setIsMessageSelectorVisible(false)}\n tools={currentTools}\n />\n </React.Fragment>\n )}\n {isRewindPanelVisible && (\n <RewindPanel\n messages={messages}\n onAction={handleRewindAction}\n onEscape={() => setIsRewindPanelVisible(false)}\n />\n )}\n {showThinkingSelector && (\n <ThinkingSelector\n onClose={() => setShowThinkingSelector(false)}\n />\n )}\n {/** Fix occasional rendering artifact */}\n <Newline />\n </>\n </React.Fragment>\n }\n />\n )\n}\n\nfunction shouldRenderStatically(\n message: NormalizedMessage,\n messages: NormalizedMessage[],\n unresolvedToolUseIDs: Set<string>,\n): boolean {\n switch (message.type) {\n case 'user':\n case 'assistant': {\n const toolUseID = getToolUseID(message)\n if (!toolUseID) {\n return true\n }\n if (unresolvedToolUseIDs.has(toolUseID)) {\n return false\n }\n // Phase 2.1: Removed delay - immediately mark as static when resolved\n\n const correspondingProgressMessage = messages.find(\n _ => _.type === 'progress' && _.toolUseID === toolUseID,\n ) as ProgressMessage | null\n if (!correspondingProgressMessage) {\n return true\n }\n\n return !intersects(\n unresolvedToolUseIDs,\n correspondingProgressMessage.siblingToolUseIDs,\n )\n }\n case 'progress':\n // Phase 2.1: Immediately mark as static when resolved - no delay\n return !intersects(unresolvedToolUseIDs, message.siblingToolUseIDs)\n }\n}\n\nfunction intersects<A>(a: Set<A>, b: Set<A>): boolean {\n return a.size > 0 && b.size > 0 && [...a].some(_ => b.has(_))\n}\n"],
|
|
5
|
+
"mappings": "AAIA,SAAS,KAAK,SAAS,QAAQ,MAAM,cAAc;AACnD,OAAO;AAAA,EACL;AAAA,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