snow-ai 0.4.16 → 0.4.17
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/bundle/cli.mjs +477445 -0
- package/bundle/sql-wasm.wasm +0 -0
- package/package.json +31 -26
- package/dist/agents/codebaseIndexAgent.d.ts +0 -102
- package/dist/agents/codebaseIndexAgent.js +0 -641
- package/dist/agents/codebaseReviewAgent.d.ts +0 -61
- package/dist/agents/codebaseReviewAgent.js +0 -301
- package/dist/agents/compactAgent.d.ts +0 -55
- package/dist/agents/compactAgent.js +0 -306
- package/dist/agents/promptOptimizeAgent.d.ts +0 -54
- package/dist/agents/promptOptimizeAgent.js +0 -268
- package/dist/agents/reviewAgent.d.ts +0 -50
- package/dist/agents/reviewAgent.js +0 -265
- package/dist/agents/summaryAgent.d.ts +0 -57
- package/dist/agents/summaryAgent.js +0 -260
- package/dist/api/anthropic.d.ts +0 -44
- package/dist/api/anthropic.js +0 -598
- package/dist/api/chat.d.ts +0 -73
- package/dist/api/chat.js +0 -386
- package/dist/api/embedding.d.ts +0 -34
- package/dist/api/embedding.js +0 -80
- package/dist/api/gemini.d.ts +0 -31
- package/dist/api/gemini.js +0 -445
- package/dist/api/models.d.ts +0 -15
- package/dist/api/models.js +0 -139
- package/dist/api/responses.d.ts +0 -38
- package/dist/api/responses.js +0 -515
- package/dist/api/systemPrompt.d.ts +0 -4
- package/dist/api/systemPrompt.js +0 -408
- package/dist/api/types.d.ts +0 -53
- package/dist/api/types.js +0 -4
- package/dist/app.d.ts +0 -8
- package/dist/app.js +0 -112
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -199
- package/dist/hooks/useAgentPicker.d.ts +0 -14
- package/dist/hooks/useAgentPicker.js +0 -119
- package/dist/hooks/useClipboard.d.ts +0 -4
- package/dist/hooks/useClipboard.js +0 -175
- package/dist/hooks/useCommandHandler.d.ts +0 -35
- package/dist/hooks/useCommandHandler.js +0 -346
- package/dist/hooks/useCommandPanel.d.ts +0 -17
- package/dist/hooks/useCommandPanel.js +0 -114
- package/dist/hooks/useConversation.d.ts +0 -49
- package/dist/hooks/useConversation.js +0 -1052
- package/dist/hooks/useFilePicker.d.ts +0 -18
- package/dist/hooks/useFilePicker.js +0 -224
- package/dist/hooks/useGlobalExit.d.ts +0 -5
- package/dist/hooks/useGlobalExit.js +0 -34
- package/dist/hooks/useGlobalNavigation.d.ts +0 -6
- package/dist/hooks/useGlobalNavigation.js +0 -17
- package/dist/hooks/useHistoryNavigation.d.ts +0 -35
- package/dist/hooks/useHistoryNavigation.js +0 -133
- package/dist/hooks/useInputBuffer.d.ts +0 -6
- package/dist/hooks/useInputBuffer.js +0 -45
- package/dist/hooks/useKeyboardInput.d.ts +0 -80
- package/dist/hooks/useKeyboardInput.js +0 -608
- package/dist/hooks/useSessionManagement.d.ts +0 -10
- package/dist/hooks/useSessionManagement.js +0 -43
- package/dist/hooks/useSessionSave.d.ts +0 -8
- package/dist/hooks/useSessionSave.js +0 -63
- package/dist/hooks/useSnapshotState.d.ts +0 -26
- package/dist/hooks/useSnapshotState.js +0 -28
- package/dist/hooks/useStreamingState.d.ts +0 -33
- package/dist/hooks/useStreamingState.js +0 -105
- package/dist/hooks/useTerminalFocus.d.ts +0 -28
- package/dist/hooks/useTerminalFocus.js +0 -87
- package/dist/hooks/useTerminalSize.d.ts +0 -4
- package/dist/hooks/useTerminalSize.js +0 -20
- package/dist/hooks/useTodoPicker.d.ts +0 -16
- package/dist/hooks/useTodoPicker.js +0 -94
- package/dist/hooks/useToolConfirmation.d.ts +0 -19
- package/dist/hooks/useToolConfirmation.js +0 -61
- package/dist/hooks/useVSCodeState.d.ts +0 -8
- package/dist/hooks/useVSCodeState.js +0 -81
- package/dist/i18n/I18nContext.d.ts +0 -14
- package/dist/i18n/I18nContext.js +0 -24
- package/dist/i18n/index.d.ts +0 -3
- package/dist/i18n/index.js +0 -2
- package/dist/i18n/lang/en.d.ts +0 -2
- package/dist/i18n/lang/en.js +0 -502
- package/dist/i18n/lang/es.d.ts +0 -2
- package/dist/i18n/lang/es.js +0 -502
- package/dist/i18n/lang/ja.d.ts +0 -2
- package/dist/i18n/lang/ja.js +0 -502
- package/dist/i18n/lang/ko.d.ts +0 -2
- package/dist/i18n/lang/ko.js +0 -502
- package/dist/i18n/lang/zh-TW.d.ts +0 -2
- package/dist/i18n/lang/zh-TW.js +0 -502
- package/dist/i18n/lang/zh.d.ts +0 -2
- package/dist/i18n/lang/zh.js +0 -502
- package/dist/i18n/translations.d.ts +0 -2
- package/dist/i18n/translations.js +0 -14
- package/dist/i18n/types.d.ts +0 -478
- package/dist/i18n/types.js +0 -1
- package/dist/mcp/aceCodeSearch.d.ts +0 -247
- package/dist/mcp/aceCodeSearch.js +0 -1058
- package/dist/mcp/bash.d.ts +0 -50
- package/dist/mcp/bash.js +0 -153
- package/dist/mcp/codebaseSearch.d.ts +0 -44
- package/dist/mcp/codebaseSearch.js +0 -275
- package/dist/mcp/filesystem.d.ts +0 -392
- package/dist/mcp/filesystem.js +0 -1445
- package/dist/mcp/ideDiagnostics.d.ts +0 -36
- package/dist/mcp/ideDiagnostics.js +0 -90
- package/dist/mcp/notebook.d.ts +0 -10
- package/dist/mcp/notebook.js +0 -367
- package/dist/mcp/subagent.d.ts +0 -37
- package/dist/mcp/subagent.js +0 -113
- package/dist/mcp/todo.d.ts +0 -46
- package/dist/mcp/todo.js +0 -511
- package/dist/mcp/types/aceCodeSearch.types.d.ts +0 -92
- package/dist/mcp/types/aceCodeSearch.types.js +0 -4
- package/dist/mcp/types/bash.types.d.ts +0 -13
- package/dist/mcp/types/bash.types.js +0 -4
- package/dist/mcp/types/filesystem.types.d.ts +0 -210
- package/dist/mcp/types/filesystem.types.js +0 -27
- package/dist/mcp/types/todo.types.d.ts +0 -27
- package/dist/mcp/types/todo.types.js +0 -4
- package/dist/mcp/types/websearch.types.d.ts +0 -30
- package/dist/mcp/types/websearch.types.js +0 -4
- package/dist/mcp/utils/aceCodeSearch/filesystem.utils.d.ts +0 -34
- package/dist/mcp/utils/aceCodeSearch/filesystem.utils.js +0 -146
- package/dist/mcp/utils/aceCodeSearch/language.utils.d.ts +0 -14
- package/dist/mcp/utils/aceCodeSearch/language.utils.js +0 -418
- package/dist/mcp/utils/aceCodeSearch/search.utils.d.ts +0 -31
- package/dist/mcp/utils/aceCodeSearch/search.utils.js +0 -136
- package/dist/mcp/utils/aceCodeSearch/symbol.utils.d.ts +0 -20
- package/dist/mcp/utils/aceCodeSearch/symbol.utils.js +0 -141
- package/dist/mcp/utils/bash/security.utils.d.ts +0 -20
- package/dist/mcp/utils/bash/security.utils.js +0 -34
- package/dist/mcp/utils/filesystem/batch-operations.utils.d.ts +0 -39
- package/dist/mcp/utils/filesystem/batch-operations.utils.js +0 -182
- package/dist/mcp/utils/filesystem/code-analysis.utils.d.ts +0 -18
- package/dist/mcp/utils/filesystem/code-analysis.utils.js +0 -165
- package/dist/mcp/utils/filesystem/match-finder.utils.d.ts +0 -16
- package/dist/mcp/utils/filesystem/match-finder.utils.js +0 -85
- package/dist/mcp/utils/filesystem/office-parser.utils.d.ts +0 -43
- package/dist/mcp/utils/filesystem/office-parser.utils.js +0 -163
- package/dist/mcp/utils/filesystem/path-fixer.utils.d.ts +0 -7
- package/dist/mcp/utils/filesystem/path-fixer.utils.js +0 -60
- package/dist/mcp/utils/filesystem/similarity.utils.d.ts +0 -22
- package/dist/mcp/utils/filesystem/similarity.utils.js +0 -75
- package/dist/mcp/utils/todo/date.utils.d.ts +0 -9
- package/dist/mcp/utils/todo/date.utils.js +0 -14
- package/dist/mcp/utils/websearch/browser.utils.d.ts +0 -8
- package/dist/mcp/utils/websearch/browser.utils.js +0 -58
- package/dist/mcp/utils/websearch/text.utils.d.ts +0 -16
- package/dist/mcp/utils/websearch/text.utils.js +0 -39
- package/dist/mcp/websearch.d.ts +0 -88
- package/dist/mcp/websearch.js +0 -375
- package/dist/test/logger-test.d.ts +0 -1
- package/dist/test/logger-test.js +0 -7
- package/dist/types/index.d.ts +0 -15
- package/dist/types/index.js +0 -1
- package/dist/ui/components/AgentPickerPanel.d.ts +0 -10
- package/dist/ui/components/AgentPickerPanel.js +0 -74
- package/dist/ui/components/ChatInput.d.ts +0 -46
- package/dist/ui/components/ChatInput.js +0 -384
- package/dist/ui/components/CommandPanel.d.ts +0 -15
- package/dist/ui/components/CommandPanel.js +0 -80
- package/dist/ui/components/DiffViewer.d.ts +0 -11
- package/dist/ui/components/DiffViewer.js +0 -178
- package/dist/ui/components/FileList.d.ts +0 -15
- package/dist/ui/components/FileList.js +0 -360
- package/dist/ui/components/FileRollbackConfirmation.d.ts +0 -8
- package/dist/ui/components/FileRollbackConfirmation.js +0 -108
- package/dist/ui/components/HelpPanel.d.ts +0 -2
- package/dist/ui/components/HelpPanel.js +0 -67
- package/dist/ui/components/MCPInfoPanel.d.ts +0 -2
- package/dist/ui/components/MCPInfoPanel.js +0 -108
- package/dist/ui/components/MCPInfoScreen.d.ts +0 -7
- package/dist/ui/components/MCPInfoScreen.js +0 -115
- package/dist/ui/components/MarkdownRenderer.d.ts +0 -6
- package/dist/ui/components/MarkdownRenderer.js +0 -70
- package/dist/ui/components/Menu.d.ts +0 -17
- package/dist/ui/components/Menu.js +0 -88
- package/dist/ui/components/MessageList.d.ts +0 -56
- package/dist/ui/components/MessageList.js +0 -97
- package/dist/ui/components/PendingMessages.d.ts +0 -13
- package/dist/ui/components/PendingMessages.js +0 -29
- package/dist/ui/components/PendingToolCalls.d.ts +0 -11
- package/dist/ui/components/PendingToolCalls.js +0 -35
- package/dist/ui/components/ScrollableSelectInput.d.ts +0 -29
- package/dist/ui/components/ScrollableSelectInput.js +0 -157
- package/dist/ui/components/SessionListPanel.d.ts +0 -7
- package/dist/ui/components/SessionListPanel.js +0 -175
- package/dist/ui/components/SessionListScreen.d.ts +0 -7
- package/dist/ui/components/SessionListScreen.js +0 -217
- package/dist/ui/components/SessionListScreenWrapper.d.ts +0 -7
- package/dist/ui/components/SessionListScreenWrapper.js +0 -14
- package/dist/ui/components/ShimmerText.d.ts +0 -9
- package/dist/ui/components/ShimmerText.js +0 -30
- package/dist/ui/components/TodoPickerPanel.d.ts +0 -14
- package/dist/ui/components/TodoPickerPanel.js +0 -119
- package/dist/ui/components/TodoTree.d.ts +0 -15
- package/dist/ui/components/TodoTree.js +0 -60
- package/dist/ui/components/ToolConfirmation.d.ts +0 -21
- package/dist/ui/components/ToolConfirmation.js +0 -204
- package/dist/ui/components/ToolResultPreview.d.ts +0 -13
- package/dist/ui/components/ToolResultPreview.js +0 -337
- package/dist/ui/components/UsagePanel.d.ts +0 -2
- package/dist/ui/components/UsagePanel.js +0 -394
- package/dist/ui/contexts/ThemeContext.d.ts +0 -13
- package/dist/ui/contexts/ThemeContext.js +0 -28
- package/dist/ui/pages/ChatScreen.d.ts +0 -6
- package/dist/ui/pages/ChatScreen.js +0 -1519
- package/dist/ui/pages/CodeBaseConfigScreen.d.ts +0 -8
- package/dist/ui/pages/CodeBaseConfigScreen.js +0 -350
- package/dist/ui/pages/ConfigScreen.d.ts +0 -8
- package/dist/ui/pages/ConfigScreen.js +0 -1101
- package/dist/ui/pages/CustomHeadersScreen.d.ts +0 -6
- package/dist/ui/pages/CustomHeadersScreen.js +0 -502
- package/dist/ui/pages/HeadlessModeScreen.d.ts +0 -7
- package/dist/ui/pages/HeadlessModeScreen.js +0 -381
- package/dist/ui/pages/LanguageSettingsScreen.d.ts +0 -7
- package/dist/ui/pages/LanguageSettingsScreen.js +0 -91
- package/dist/ui/pages/MCPConfigScreen.d.ts +0 -6
- package/dist/ui/pages/MCPConfigScreen.js +0 -55
- package/dist/ui/pages/ProxyConfigScreen.d.ts +0 -8
- package/dist/ui/pages/ProxyConfigScreen.js +0 -149
- package/dist/ui/pages/SensitiveCommandConfigScreen.d.ts +0 -7
- package/dist/ui/pages/SensitiveCommandConfigScreen.js +0 -271
- package/dist/ui/pages/SubAgentConfigScreen.d.ts +0 -9
- package/dist/ui/pages/SubAgentConfigScreen.js +0 -435
- package/dist/ui/pages/SubAgentListScreen.d.ts +0 -9
- package/dist/ui/pages/SubAgentListScreen.js +0 -131
- package/dist/ui/pages/SystemPromptConfigScreen.d.ts +0 -6
- package/dist/ui/pages/SystemPromptConfigScreen.js +0 -326
- package/dist/ui/pages/ThemeSettingsScreen.d.ts +0 -7
- package/dist/ui/pages/ThemeSettingsScreen.js +0 -106
- package/dist/ui/pages/WelcomeScreen.d.ts +0 -7
- package/dist/ui/pages/WelcomeScreen.js +0 -217
- package/dist/ui/themes/index.d.ts +0 -23
- package/dist/ui/themes/index.js +0 -140
- package/dist/utils/apiConfig.d.ts +0 -126
- package/dist/utils/apiConfig.js +0 -423
- package/dist/utils/autoCompress.d.ts +0 -15
- package/dist/utils/autoCompress.js +0 -24
- package/dist/utils/chatExporter.d.ts +0 -9
- package/dist/utils/chatExporter.js +0 -118
- package/dist/utils/checkpointManager.d.ts +0 -74
- package/dist/utils/checkpointManager.js +0 -181
- package/dist/utils/codebaseConfig.d.ts +0 -16
- package/dist/utils/codebaseConfig.js +0 -67
- package/dist/utils/codebaseDatabase.d.ts +0 -102
- package/dist/utils/codebaseDatabase.js +0 -333
- package/dist/utils/codebaseSearchEvents.d.ts +0 -16
- package/dist/utils/codebaseSearchEvents.js +0 -13
- package/dist/utils/commandExecutor.d.ts +0 -13
- package/dist/utils/commandExecutor.js +0 -26
- package/dist/utils/commands/agent.d.ts +0 -2
- package/dist/utils/commands/agent.js +0 -12
- package/dist/utils/commands/clear.d.ts +0 -2
- package/dist/utils/commands/clear.js +0 -12
- package/dist/utils/commands/compact.d.ts +0 -2
- package/dist/utils/commands/compact.js +0 -12
- package/dist/utils/commands/export.d.ts +0 -2
- package/dist/utils/commands/export.js +0 -12
- package/dist/utils/commands/help.d.ts +0 -2
- package/dist/utils/commands/help.js +0 -11
- package/dist/utils/commands/home.d.ts +0 -2
- package/dist/utils/commands/home.js +0 -34
- package/dist/utils/commands/ide.d.ts +0 -2
- package/dist/utils/commands/ide.js +0 -32
- package/dist/utils/commands/init.d.ts +0 -2
- package/dist/utils/commands/init.js +0 -93
- package/dist/utils/commands/mcp.d.ts +0 -2
- package/dist/utils/commands/mcp.js +0 -12
- package/dist/utils/commands/resume.d.ts +0 -2
- package/dist/utils/commands/resume.js +0 -12
- package/dist/utils/commands/review.d.ts +0 -2
- package/dist/utils/commands/review.js +0 -81
- package/dist/utils/commands/role.d.ts +0 -2
- package/dist/utils/commands/role.js +0 -37
- package/dist/utils/commands/todoPicker.d.ts +0 -2
- package/dist/utils/commands/todoPicker.js +0 -12
- package/dist/utils/commands/usage.d.ts +0 -2
- package/dist/utils/commands/usage.js +0 -12
- package/dist/utils/commands/yolo.d.ts +0 -2
- package/dist/utils/commands/yolo.js +0 -12
- package/dist/utils/configManager.d.ts +0 -45
- package/dist/utils/configManager.js +0 -303
- package/dist/utils/contextCompressor.d.ts +0 -16
- package/dist/utils/contextCompressor.js +0 -334
- package/dist/utils/devMode.d.ts +0 -13
- package/dist/utils/devMode.js +0 -54
- package/dist/utils/escapeHandler.d.ts +0 -79
- package/dist/utils/escapeHandler.js +0 -153
- package/dist/utils/fileDialog.d.ts +0 -9
- package/dist/utils/fileDialog.js +0 -74
- package/dist/utils/fileUtils.d.ts +0 -40
- package/dist/utils/fileUtils.js +0 -185
- package/dist/utils/historyManager.d.ts +0 -45
- package/dist/utils/historyManager.js +0 -159
- package/dist/utils/incrementalSnapshot.d.ts +0 -109
- package/dist/utils/incrementalSnapshot.js +0 -383
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/index.js +0 -18
- package/dist/utils/languageConfig.d.ts +0 -21
- package/dist/utils/languageConfig.js +0 -61
- package/dist/utils/logger.d.ts +0 -37
- package/dist/utils/logger.js +0 -122
- package/dist/utils/mcpToolsManager.d.ts +0 -52
- package/dist/utils/mcpToolsManager.js +0 -878
- package/dist/utils/messageFormatter.d.ts +0 -12
- package/dist/utils/messageFormatter.js +0 -115
- package/dist/utils/notebookManager.d.ts +0 -59
- package/dist/utils/notebookManager.js +0 -213
- package/dist/utils/patch-highlight.d.ts +0 -5
- package/dist/utils/patch-highlight.js +0 -23
- package/dist/utils/processManager.d.ts +0 -27
- package/dist/utils/processManager.js +0 -75
- package/dist/utils/proxyUtils.d.ts +0 -15
- package/dist/utils/proxyUtils.js +0 -50
- package/dist/utils/resourceMonitor.d.ts +0 -65
- package/dist/utils/resourceMonitor.js +0 -175
- package/dist/utils/retryUtils.d.ts +0 -49
- package/dist/utils/retryUtils.js +0 -303
- package/dist/utils/sensitiveCommandManager.d.ts +0 -53
- package/dist/utils/sensitiveCommandManager.js +0 -308
- package/dist/utils/sessionConverter.d.ts +0 -7
- package/dist/utils/sessionConverter.js +0 -306
- package/dist/utils/sessionManager.d.ts +0 -53
- package/dist/utils/sessionManager.js +0 -371
- package/dist/utils/subAgentConfig.d.ts +0 -50
- package/dist/utils/subAgentConfig.js +0 -221
- package/dist/utils/subAgentExecutor.d.ts +0 -40
- package/dist/utils/subAgentExecutor.js +0 -434
- package/dist/utils/terminal.d.ts +0 -5
- package/dist/utils/terminal.js +0 -13
- package/dist/utils/textBuffer.d.ts +0 -99
- package/dist/utils/textBuffer.js +0 -547
- package/dist/utils/textUtils.d.ts +0 -37
- package/dist/utils/textUtils.js +0 -102
- package/dist/utils/themeConfig.d.ts +0 -21
- package/dist/utils/themeConfig.js +0 -61
- package/dist/utils/todoPreprocessor.d.ts +0 -5
- package/dist/utils/todoPreprocessor.js +0 -18
- package/dist/utils/todoScanner.d.ts +0 -8
- package/dist/utils/todoScanner.js +0 -148
- package/dist/utils/toolDisplayConfig.d.ts +0 -16
- package/dist/utils/toolDisplayConfig.js +0 -47
- package/dist/utils/toolExecutor.d.ts +0 -37
- package/dist/utils/toolExecutor.js +0 -224
- package/dist/utils/usageLogger.d.ts +0 -11
- package/dist/utils/usageLogger.js +0 -114
- package/dist/utils/vscodeConnection.d.ts +0 -76
- package/dist/utils/vscodeConnection.js +0 -430
- package/dist/utils/workspaceSnapshot.d.ts +0 -63
- package/dist/utils/workspaceSnapshot.js +0 -300
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import { useI18n } from '../../i18n/index.js';
|
|
4
|
-
// Get platform-specific paste key
|
|
5
|
-
const getPasteKey = () => {
|
|
6
|
-
return process.platform === 'darwin' ? 'Ctrl+V' : 'Alt+V';
|
|
7
|
-
};
|
|
8
|
-
export default function HelpPanel() {
|
|
9
|
-
const pasteKey = getPasteKey();
|
|
10
|
-
const { t } = useI18n();
|
|
11
|
-
return (React.createElement(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1 },
|
|
12
|
-
React.createElement(Box, { marginBottom: 1 },
|
|
13
|
-
React.createElement(Text, { bold: true, color: "cyan" }, t.helpPanel.title)),
|
|
14
|
-
React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
|
|
15
|
-
React.createElement(Text, { bold: true, color: "yellow" }, t.helpPanel.textEditingTitle),
|
|
16
|
-
React.createElement(Text, null,
|
|
17
|
-
" \u2022 ",
|
|
18
|
-
t.helpPanel.deleteToStart),
|
|
19
|
-
React.createElement(Text, null,
|
|
20
|
-
" \u2022 ",
|
|
21
|
-
t.helpPanel.deleteToEnd),
|
|
22
|
-
React.createElement(Text, null,
|
|
23
|
-
' ',
|
|
24
|
-
"\u2022 ",
|
|
25
|
-
t.helpPanel.pasteImages.replace('{pasteKey}', pasteKey))),
|
|
26
|
-
React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
|
|
27
|
-
React.createElement(Text, { bold: true, color: "green" }, t.helpPanel.quickAccessTitle),
|
|
28
|
-
React.createElement(Text, null,
|
|
29
|
-
" \u2022 ",
|
|
30
|
-
t.helpPanel.insertFiles),
|
|
31
|
-
React.createElement(Text, null,
|
|
32
|
-
" \u2022 ",
|
|
33
|
-
t.helpPanel.searchContent),
|
|
34
|
-
React.createElement(Text, null,
|
|
35
|
-
" \u2022 ",
|
|
36
|
-
t.helpPanel.selectAgent),
|
|
37
|
-
React.createElement(Text, null,
|
|
38
|
-
" \u2022 ",
|
|
39
|
-
t.helpPanel.showCommands)),
|
|
40
|
-
React.createElement(Box, { flexDirection: "column", marginBottom: 1 },
|
|
41
|
-
React.createElement(Text, { bold: true, color: "blue" }, t.helpPanel.navigationTitle),
|
|
42
|
-
React.createElement(Text, null,
|
|
43
|
-
" \u2022 ",
|
|
44
|
-
t.helpPanel.navigateHistory),
|
|
45
|
-
React.createElement(Text, null,
|
|
46
|
-
" \u2022 ",
|
|
47
|
-
t.helpPanel.selectItem),
|
|
48
|
-
React.createElement(Text, null,
|
|
49
|
-
" \u2022 ",
|
|
50
|
-
t.helpPanel.cancelClose),
|
|
51
|
-
React.createElement(Text, null,
|
|
52
|
-
" \u2022 ",
|
|
53
|
-
t.helpPanel.toggleYolo)),
|
|
54
|
-
React.createElement(Box, { flexDirection: "column" },
|
|
55
|
-
React.createElement(Text, { bold: true, color: "magenta" }, t.helpPanel.tipsTitle),
|
|
56
|
-
React.createElement(Text, null,
|
|
57
|
-
" \u2022 ",
|
|
58
|
-
t.helpPanel.tipUseHelp),
|
|
59
|
-
React.createElement(Text, null,
|
|
60
|
-
" \u2022 ",
|
|
61
|
-
t.helpPanel.tipShowCommands),
|
|
62
|
-
React.createElement(Text, null,
|
|
63
|
-
" \u2022 ",
|
|
64
|
-
t.helpPanel.tipInterrupt)),
|
|
65
|
-
React.createElement(Box, { marginTop: 1 },
|
|
66
|
-
React.createElement(Text, { dimColor: true, color: "gray" }, t.helpPanel.closeHint))));
|
|
67
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import SelectInput from 'ink-select-input';
|
|
4
|
-
import { getMCPServicesInfo, refreshMCPToolsCache, reconnectMCPService } from '../../utils/mcpToolsManager.js';
|
|
5
|
-
export default function MCPInfoPanel() {
|
|
6
|
-
const [mcpStatus, setMcpStatus] = useState([]);
|
|
7
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
8
|
-
const [errorMessage, setErrorMessage] = useState(null);
|
|
9
|
-
const [isReconnecting, setIsReconnecting] = useState(false);
|
|
10
|
-
const loadMCPStatus = async () => {
|
|
11
|
-
try {
|
|
12
|
-
const servicesInfo = await getMCPServicesInfo();
|
|
13
|
-
const statusList = servicesInfo.map(service => ({
|
|
14
|
-
name: service.serviceName,
|
|
15
|
-
connected: service.connected,
|
|
16
|
-
tools: service.tools.map(tool => tool.name),
|
|
17
|
-
connectionMethod: service.isBuiltIn ? 'Built-in' : 'External',
|
|
18
|
-
isBuiltIn: service.isBuiltIn,
|
|
19
|
-
error: service.error
|
|
20
|
-
}));
|
|
21
|
-
setMcpStatus(statusList);
|
|
22
|
-
setErrorMessage(null);
|
|
23
|
-
setIsLoading(false);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
setErrorMessage(error instanceof Error ? error.message : 'Failed to load MCP services');
|
|
27
|
-
setIsLoading(false);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
let isMounted = true;
|
|
32
|
-
const load = async () => {
|
|
33
|
-
await loadMCPStatus();
|
|
34
|
-
};
|
|
35
|
-
if (isMounted) {
|
|
36
|
-
load();
|
|
37
|
-
}
|
|
38
|
-
return () => {
|
|
39
|
-
isMounted = false;
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
const handleServiceSelect = async (item) => {
|
|
43
|
-
setIsReconnecting(true);
|
|
44
|
-
try {
|
|
45
|
-
if (item.value === 'refresh-all') {
|
|
46
|
-
// Refresh all services
|
|
47
|
-
await refreshMCPToolsCache();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// Reconnect specific service
|
|
51
|
-
await reconnectMCPService(item.value);
|
|
52
|
-
}
|
|
53
|
-
await loadMCPStatus();
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
setErrorMessage(error instanceof Error ? error.message : 'Failed to reconnect');
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
59
|
-
setIsReconnecting(false);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
// Build select items from all services
|
|
63
|
-
const selectItems = [
|
|
64
|
-
{ label: 'Refresh all services', value: 'refresh-all', isRefreshAll: true },
|
|
65
|
-
...mcpStatus.map(s => ({
|
|
66
|
-
label: s.name,
|
|
67
|
-
value: s.name,
|
|
68
|
-
connected: s.connected,
|
|
69
|
-
isBuiltIn: s.isBuiltIn,
|
|
70
|
-
error: s.error
|
|
71
|
-
}))
|
|
72
|
-
];
|
|
73
|
-
// Custom item component to render with colors
|
|
74
|
-
const ItemComponent = ({ isSelected, label }) => {
|
|
75
|
-
const item = selectItems.find(i => i.label === label);
|
|
76
|
-
if (!item)
|
|
77
|
-
return React.createElement(Text, null, label);
|
|
78
|
-
if (item.isRefreshAll) {
|
|
79
|
-
return (React.createElement(Text, { color: isSelected ? 'cyan' : 'blue' },
|
|
80
|
-
"\u21BB ",
|
|
81
|
-
label));
|
|
82
|
-
}
|
|
83
|
-
const statusColor = item.connected ? 'green' : 'red';
|
|
84
|
-
const suffix = item.isBuiltIn ? ' (System)' : item.connected ? ' (External)' : ` - ${item.error || 'Failed'}`;
|
|
85
|
-
return (React.createElement(Box, null,
|
|
86
|
-
React.createElement(Text, { color: statusColor }, "\u25CF "),
|
|
87
|
-
React.createElement(Text, { color: isSelected ? 'cyan' : 'white' }, label),
|
|
88
|
-
React.createElement(Text, { color: "gray", dimColor: true }, suffix)));
|
|
89
|
-
};
|
|
90
|
-
if (isLoading) {
|
|
91
|
-
return (React.createElement(Text, { color: "gray" }, "Loading MCP services..."));
|
|
92
|
-
}
|
|
93
|
-
if (errorMessage) {
|
|
94
|
-
return (React.createElement(Box, { borderColor: "red", borderStyle: "round", paddingX: 2, paddingY: 0 },
|
|
95
|
-
React.createElement(Text, { color: "red", dimColor: true },
|
|
96
|
-
"Error: ",
|
|
97
|
-
errorMessage)));
|
|
98
|
-
}
|
|
99
|
-
if (mcpStatus.length === 0) {
|
|
100
|
-
return (React.createElement(Box, { borderColor: "cyan", borderStyle: "round", paddingX: 2, paddingY: 0 },
|
|
101
|
-
React.createElement(Text, { color: "gray", dimColor: true }, "No available MCP services detected")));
|
|
102
|
-
}
|
|
103
|
-
return (React.createElement(Box, { borderColor: "cyan", borderStyle: "round", paddingX: 2, paddingY: 0 },
|
|
104
|
-
React.createElement(Box, { flexDirection: "column" },
|
|
105
|
-
React.createElement(Text, { color: "cyan", bold: true }, isReconnecting ? 'Refreshing services...' : 'MCP Services'),
|
|
106
|
-
!isReconnecting && (React.createElement(SelectInput, { items: selectItems, onSelect: handleServiceSelect, itemComponent: ItemComponent })),
|
|
107
|
-
isReconnecting && (React.createElement(Text, { color: "yellow", dimColor: true }, "Please wait...")))));
|
|
108
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Box, Text, useInput } from 'ink';
|
|
3
|
-
import SelectInput from 'ink-select-input';
|
|
4
|
-
import { getMCPServicesInfo, refreshMCPToolsCache, reconnectMCPService } from '../../utils/mcpToolsManager.js';
|
|
5
|
-
export default function MCPInfoScreen({ onClose, panelKey }) {
|
|
6
|
-
const [mcpStatus, setMcpStatus] = useState([]);
|
|
7
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
8
|
-
const [errorMessage, setErrorMessage] = useState(null);
|
|
9
|
-
const [isReconnecting, setIsReconnecting] = useState(false);
|
|
10
|
-
const loadMCPStatus = async () => {
|
|
11
|
-
try {
|
|
12
|
-
const servicesInfo = await getMCPServicesInfo();
|
|
13
|
-
const statusList = servicesInfo.map(service => ({
|
|
14
|
-
name: service.serviceName,
|
|
15
|
-
connected: service.connected,
|
|
16
|
-
tools: service.tools.map(tool => tool.name),
|
|
17
|
-
connectionMethod: service.isBuiltIn ? 'Built-in' : 'External',
|
|
18
|
-
isBuiltIn: service.isBuiltIn,
|
|
19
|
-
error: service.error
|
|
20
|
-
}));
|
|
21
|
-
setMcpStatus(statusList);
|
|
22
|
-
setErrorMessage(null);
|
|
23
|
-
setIsLoading(false);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
setErrorMessage(error instanceof Error ? error.message : 'Failed to load MCP services');
|
|
27
|
-
setIsLoading(false);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
process.stdout.write('\x1B[?1049h');
|
|
32
|
-
process.stdout.write('\x1B[2J');
|
|
33
|
-
process.stdout.write('\x1B[H');
|
|
34
|
-
return () => {
|
|
35
|
-
process.stdout.write('\x1B[2J');
|
|
36
|
-
process.stdout.write('\x1B[?1049l');
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
loadMCPStatus();
|
|
41
|
-
}, [panelKey]);
|
|
42
|
-
useInput((_, key) => {
|
|
43
|
-
if (key.escape) {
|
|
44
|
-
onClose();
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
const handleServiceSelect = async (item) => {
|
|
48
|
-
setIsReconnecting(true);
|
|
49
|
-
try {
|
|
50
|
-
if (item.value === 'refresh-all') {
|
|
51
|
-
// Refresh all services
|
|
52
|
-
await refreshMCPToolsCache();
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// Reconnect specific service
|
|
56
|
-
await reconnectMCPService(item.value);
|
|
57
|
-
}
|
|
58
|
-
await loadMCPStatus();
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
setErrorMessage(error instanceof Error ? error.message : 'Failed to reconnect');
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
setIsReconnecting(false);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
// Build select items from all services
|
|
68
|
-
const selectItems = [
|
|
69
|
-
{ label: 'Refresh all services', value: 'refresh-all', isRefreshAll: true },
|
|
70
|
-
...mcpStatus.map(s => ({
|
|
71
|
-
label: s.name,
|
|
72
|
-
value: s.name,
|
|
73
|
-
connected: s.connected,
|
|
74
|
-
isBuiltIn: s.isBuiltIn,
|
|
75
|
-
error: s.error
|
|
76
|
-
}))
|
|
77
|
-
];
|
|
78
|
-
// Custom item component to render with colors
|
|
79
|
-
const ItemComponent = ({ isSelected, label }) => {
|
|
80
|
-
const item = selectItems.find(i => i.label === label);
|
|
81
|
-
if (!item)
|
|
82
|
-
return React.createElement(Text, null, label);
|
|
83
|
-
if (item.isRefreshAll) {
|
|
84
|
-
return (React.createElement(Text, { color: isSelected ? 'cyan' : 'blue' },
|
|
85
|
-
"\u21BB ",
|
|
86
|
-
label));
|
|
87
|
-
}
|
|
88
|
-
const statusColor = item.connected ? 'green' : 'red';
|
|
89
|
-
const suffix = item.isBuiltIn ? ' (System)' : item.connected ? ' (External)' : ` - ${item.error || 'Failed'}`;
|
|
90
|
-
return (React.createElement(Box, null,
|
|
91
|
-
React.createElement(Text, { color: statusColor }, "\u25CF "),
|
|
92
|
-
React.createElement(Text, { color: isSelected ? 'cyan' : 'white' }, label),
|
|
93
|
-
React.createElement(Text, { color: "gray", dimColor: true }, suffix)));
|
|
94
|
-
};
|
|
95
|
-
if (isLoading) {
|
|
96
|
-
return (React.createElement(Box, { flexDirection: "column", padding: 1 },
|
|
97
|
-
React.createElement(Text, { color: "gray" }, "Loading MCP services...")));
|
|
98
|
-
}
|
|
99
|
-
return (React.createElement(Box, { flexDirection: "column", padding: 1 },
|
|
100
|
-
React.createElement(Box, { borderStyle: "double", paddingX: 2, paddingY: 0, borderColor: "cyan" },
|
|
101
|
-
React.createElement(Box, { flexDirection: "column" },
|
|
102
|
-
React.createElement(Text, { color: "white", bold: true },
|
|
103
|
-
React.createElement(Text, { color: "cyan" }, "\u2746 "),
|
|
104
|
-
"MCP Services Overview"),
|
|
105
|
-
React.createElement(Text, { color: "gray", dimColor: true }, "Press ESC to return | Use \u2191\u2193 and Enter to refresh"))),
|
|
106
|
-
errorMessage && (React.createElement(Box, { borderColor: "red", borderStyle: "round", paddingX: 2, paddingY: 0, marginTop: 1 },
|
|
107
|
-
React.createElement(Text, { color: "red", dimColor: true },
|
|
108
|
-
"Error: ",
|
|
109
|
-
errorMessage))),
|
|
110
|
-
React.createElement(Box, { borderColor: "cyan", borderStyle: "round", paddingX: 2, paddingY: 0, marginTop: 1 },
|
|
111
|
-
React.createElement(Box, { flexDirection: "column" },
|
|
112
|
-
React.createElement(Text, { color: "cyan", bold: true }, isReconnecting ? 'Refreshing services...' : 'MCP Services'),
|
|
113
|
-
!isReconnecting && (React.createElement(SelectInput, { items: selectItems, onSelect: handleServiceSelect, itemComponent: ItemComponent })),
|
|
114
|
-
isReconnecting && (React.createElement(Text, { color: "yellow", dimColor: true }, "Please wait..."))))));
|
|
115
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, Box } from 'ink';
|
|
3
|
-
import { marked } from 'marked';
|
|
4
|
-
import TerminalRenderer from 'marked-terminal';
|
|
5
|
-
import logger from '../../utils/logger.js';
|
|
6
|
-
// Configure marked to use terminal renderer
|
|
7
|
-
marked.setOptions({
|
|
8
|
-
// @ts-expect-error - marked-terminal types mismatch with marked v15
|
|
9
|
-
renderer: new TerminalRenderer({
|
|
10
|
-
reflowText: true,
|
|
11
|
-
width: 80,
|
|
12
|
-
emoji: false,
|
|
13
|
-
tab: 2,
|
|
14
|
-
}),
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* Sanitize markdown content to prevent number-to-alphabet errors
|
|
18
|
-
* Fixes invalid ordered list start attributes (0 or negative values)
|
|
19
|
-
*/
|
|
20
|
-
function sanitizeMarkdownContent(content) {
|
|
21
|
-
// Replace <ol start="0">, <ol start="-1">, etc. with <ol start="1">
|
|
22
|
-
return content.replace(/<ol\s+start=["']?(0|-\d+)["']?>/gi, '<ol start="1">');
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Fallback renderer for when cli-markdown fails
|
|
26
|
-
* Renders content as plain text to ensure visibility
|
|
27
|
-
*/
|
|
28
|
-
function renderFallback(content) {
|
|
29
|
-
const lines = content.split('\n');
|
|
30
|
-
return (React.createElement(Box, { flexDirection: "column" }, lines.map((line, index) => (React.createElement(Text, { key: index }, line)))));
|
|
31
|
-
}
|
|
32
|
-
export default function MarkdownRenderer({ content }) {
|
|
33
|
-
// Use marked + marked-terminal for elegant markdown rendering with syntax highlighting
|
|
34
|
-
// marked provides better stability and cross-platform support
|
|
35
|
-
try {
|
|
36
|
-
// Stage 1: Sanitize content to prevent invalid list numbering
|
|
37
|
-
const sanitizedContent = sanitizeMarkdownContent(content);
|
|
38
|
-
// Stage 2: Render with marked
|
|
39
|
-
const rendered = marked.parse(sanitizedContent);
|
|
40
|
-
// Split into lines and render each separately
|
|
41
|
-
// This prevents Ink's Text component from creating mysterious whitespace
|
|
42
|
-
// when handling multi-line content with \n characters
|
|
43
|
-
const lines = rendered.split('\n');
|
|
44
|
-
// Safety check: prevent rendering issues with excessively long output
|
|
45
|
-
if (lines.length > 500) {
|
|
46
|
-
logger.warn('[MarkdownRenderer] Rendered output has too many lines', {
|
|
47
|
-
totalLines: lines.length,
|
|
48
|
-
truncatedTo: 500,
|
|
49
|
-
});
|
|
50
|
-
return (React.createElement(Box, { flexDirection: "column" }, lines.slice(0, 500).map((line, index) => (React.createElement(Text, { key: index }, line)))));
|
|
51
|
-
}
|
|
52
|
-
return (React.createElement(Box, { flexDirection: "column" }, lines.map((line, index) => (React.createElement(Text, { key: index }, line)))));
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
// Stage 3: Error handling - catch number-to-alphabet errors
|
|
56
|
-
if (error?.message?.includes('Number must be >')) {
|
|
57
|
-
logger.warn('[MarkdownRenderer] Invalid list numbering detected, falling back to plain text', {
|
|
58
|
-
error: error.message,
|
|
59
|
-
});
|
|
60
|
-
return renderFallback(content);
|
|
61
|
-
}
|
|
62
|
-
// Re-throw other errors for debugging
|
|
63
|
-
logger.error('[MarkdownRenderer] Unexpected error during markdown rendering', {
|
|
64
|
-
error: error.message,
|
|
65
|
-
stack: error.stack,
|
|
66
|
-
});
|
|
67
|
-
// Still provide fallback to prevent crash
|
|
68
|
-
return renderFallback(content);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type MenuOption = {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
color?: string;
|
|
6
|
-
infoText?: string;
|
|
7
|
-
clearTerminal?: boolean;
|
|
8
|
-
};
|
|
9
|
-
type Props = {
|
|
10
|
-
options: MenuOption[];
|
|
11
|
-
onSelect: (value: string) => void;
|
|
12
|
-
onSelectionChange?: (infoText: string, value: string) => void;
|
|
13
|
-
maxHeight?: number;
|
|
14
|
-
};
|
|
15
|
-
declare function Menu({ options, onSelect, onSelectionChange, maxHeight }: Props): React.JSX.Element;
|
|
16
|
-
declare const _default: React.MemoExoticComponent<typeof Menu>;
|
|
17
|
-
export default _default;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import { Box, Text, useInput, useStdout } from 'ink';
|
|
3
|
-
import { resetTerminal } from '../../utils/terminal.js';
|
|
4
|
-
import { useI18n } from '../../i18n/index.js';
|
|
5
|
-
import { useTheme } from '../contexts/ThemeContext.js';
|
|
6
|
-
function Menu({ options, onSelect, onSelectionChange, maxHeight }) {
|
|
7
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
8
|
-
const [scrollOffset, setScrollOffset] = useState(0);
|
|
9
|
-
const { stdout } = useStdout();
|
|
10
|
-
const { t } = useI18n();
|
|
11
|
-
const { theme } = useTheme();
|
|
12
|
-
// Calculate available height
|
|
13
|
-
const terminalHeight = stdout?.rows || 24;
|
|
14
|
-
const headerHeight = 8; // Space for header, borders, etc.
|
|
15
|
-
const defaultMaxHeight = Math.max(5, terminalHeight - headerHeight);
|
|
16
|
-
const visibleItemCount = maxHeight || defaultMaxHeight;
|
|
17
|
-
React.useEffect(() => {
|
|
18
|
-
const currentOption = options[selectedIndex];
|
|
19
|
-
if (onSelectionChange && currentOption?.infoText) {
|
|
20
|
-
onSelectionChange(currentOption.infoText, currentOption.value);
|
|
21
|
-
}
|
|
22
|
-
}, [selectedIndex, options, onSelectionChange]);
|
|
23
|
-
// Auto-scroll to keep selected item visible
|
|
24
|
-
React.useEffect(() => {
|
|
25
|
-
if (selectedIndex < scrollOffset) {
|
|
26
|
-
setScrollOffset(selectedIndex);
|
|
27
|
-
}
|
|
28
|
-
else if (selectedIndex >= scrollOffset + visibleItemCount) {
|
|
29
|
-
setScrollOffset(selectedIndex - visibleItemCount + 1);
|
|
30
|
-
}
|
|
31
|
-
}, [selectedIndex, scrollOffset, visibleItemCount]);
|
|
32
|
-
const clearTerminal = useCallback(() => {
|
|
33
|
-
resetTerminal(stdout);
|
|
34
|
-
}, [stdout]);
|
|
35
|
-
const handleInput = useCallback((_input, key) => {
|
|
36
|
-
if (key.upArrow) {
|
|
37
|
-
setSelectedIndex(prev => (prev > 0 ? prev - 1 : options.length - 1));
|
|
38
|
-
}
|
|
39
|
-
else if (key.downArrow) {
|
|
40
|
-
setSelectedIndex(prev => (prev < options.length - 1 ? prev + 1 : 0));
|
|
41
|
-
}
|
|
42
|
-
else if (key.return) {
|
|
43
|
-
const selectedOption = options[selectedIndex];
|
|
44
|
-
if (selectedOption) {
|
|
45
|
-
if (selectedOption.clearTerminal) {
|
|
46
|
-
clearTerminal();
|
|
47
|
-
}
|
|
48
|
-
onSelect(selectedOption.value);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}, [options, selectedIndex, onSelect, clearTerminal]);
|
|
52
|
-
useInput(handleInput);
|
|
53
|
-
// Calculate visible options and "more" counts
|
|
54
|
-
const visibleOptions = options.slice(scrollOffset, scrollOffset + visibleItemCount);
|
|
55
|
-
const hasMoreAbove = scrollOffset > 0;
|
|
56
|
-
const hasMoreBelow = scrollOffset + visibleItemCount < options.length;
|
|
57
|
-
const moreAboveCount = scrollOffset;
|
|
58
|
-
const moreBelowCount = options.length - (scrollOffset + visibleItemCount);
|
|
59
|
-
return (React.createElement(Box, { flexDirection: "column", width: '100%', padding: 1 },
|
|
60
|
-
React.createElement(Box, { marginBottom: 1 },
|
|
61
|
-
React.createElement(Text, { color: theme.colors.menuInfo }, t.menu.navigate)),
|
|
62
|
-
hasMoreAbove && (React.createElement(Box, null,
|
|
63
|
-
React.createElement(Text, { color: theme.colors.menuSecondary, dimColor: true },
|
|
64
|
-
"\u2191 +",
|
|
65
|
-
moreAboveCount,
|
|
66
|
-
" more above"))),
|
|
67
|
-
visibleOptions.map((option, index) => {
|
|
68
|
-
const actualIndex = scrollOffset + index;
|
|
69
|
-
return (React.createElement(Box, { key: option.value },
|
|
70
|
-
React.createElement(Text, { color: actualIndex === selectedIndex
|
|
71
|
-
? theme.colors.menuSelected
|
|
72
|
-
: option.color || theme.colors.menuNormal, bold: true },
|
|
73
|
-
actualIndex === selectedIndex ? '❯ ' : ' ',
|
|
74
|
-
option.label)));
|
|
75
|
-
}),
|
|
76
|
-
hasMoreBelow && (React.createElement(Box, null,
|
|
77
|
-
React.createElement(Text, { color: theme.colors.menuSecondary, dimColor: true },
|
|
78
|
-
"\u2193 +",
|
|
79
|
-
moreBelowCount,
|
|
80
|
-
" more below")))));
|
|
81
|
-
}
|
|
82
|
-
// Memoize to prevent unnecessary re-renders
|
|
83
|
-
export default React.memo(Menu, (prevProps, nextProps) => {
|
|
84
|
-
return (prevProps.options === nextProps.options &&
|
|
85
|
-
prevProps.onSelect === nextProps.onSelect &&
|
|
86
|
-
prevProps.onSelectionChange === nextProps.onSelectionChange &&
|
|
87
|
-
prevProps.maxHeight === nextProps.maxHeight);
|
|
88
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SelectedFile } from '../../utils/fileUtils.js';
|
|
3
|
-
export interface Message {
|
|
4
|
-
role: 'user' | 'assistant' | 'command' | 'subagent';
|
|
5
|
-
content: string;
|
|
6
|
-
streaming?: boolean;
|
|
7
|
-
discontinued?: boolean;
|
|
8
|
-
commandName?: string;
|
|
9
|
-
files?: SelectedFile[];
|
|
10
|
-
images?: Array<{
|
|
11
|
-
type: 'image';
|
|
12
|
-
data: string;
|
|
13
|
-
mimeType: string;
|
|
14
|
-
}>;
|
|
15
|
-
toolCall?: {
|
|
16
|
-
name: string;
|
|
17
|
-
arguments: any;
|
|
18
|
-
};
|
|
19
|
-
toolDisplay?: {
|
|
20
|
-
toolName: string;
|
|
21
|
-
args: Array<{
|
|
22
|
-
key: string;
|
|
23
|
-
value: string;
|
|
24
|
-
isLast: boolean;
|
|
25
|
-
}>;
|
|
26
|
-
};
|
|
27
|
-
toolResult?: string;
|
|
28
|
-
toolCallId?: string;
|
|
29
|
-
toolPending?: boolean;
|
|
30
|
-
terminalResult?: {
|
|
31
|
-
stdout?: string;
|
|
32
|
-
stderr?: string;
|
|
33
|
-
exitCode?: number;
|
|
34
|
-
command?: string;
|
|
35
|
-
};
|
|
36
|
-
subAgent?: {
|
|
37
|
-
agentId: string;
|
|
38
|
-
agentName: string;
|
|
39
|
-
isComplete?: boolean;
|
|
40
|
-
};
|
|
41
|
-
subAgentInternal?: boolean;
|
|
42
|
-
subAgentUsage?: {
|
|
43
|
-
inputTokens: number;
|
|
44
|
-
outputTokens: number;
|
|
45
|
-
cacheCreationInputTokens?: number;
|
|
46
|
-
cacheReadInputTokens?: number;
|
|
47
|
-
};
|
|
48
|
-
parallelGroup?: string;
|
|
49
|
-
}
|
|
50
|
-
interface Props {
|
|
51
|
-
messages: Message[];
|
|
52
|
-
animationFrame: number;
|
|
53
|
-
maxMessages?: number;
|
|
54
|
-
}
|
|
55
|
-
declare const MessageList: React.MemoExoticComponent<({ messages, animationFrame, maxMessages }: Props) => React.JSX.Element | null>;
|
|
56
|
-
export default MessageList;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import MarkdownRenderer from './MarkdownRenderer.js';
|
|
4
|
-
const STREAM_COLORS = ['#FF6EBF', 'green', 'blue', 'cyan', '#B588F8'];
|
|
5
|
-
const MessageList = memo(({ messages, animationFrame, maxMessages = 6 }) => {
|
|
6
|
-
if (messages.length === 0) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
return (React.createElement(Box, { flexDirection: "column", overflow: "hidden" }, messages.slice(-maxMessages).map((message, index) => {
|
|
10
|
-
const iconColor = message.role === 'user'
|
|
11
|
-
? 'green'
|
|
12
|
-
: message.role === 'command'
|
|
13
|
-
? 'gray'
|
|
14
|
-
: message.role === 'subagent'
|
|
15
|
-
? 'magenta'
|
|
16
|
-
: message.streaming
|
|
17
|
-
? STREAM_COLORS[animationFrame]
|
|
18
|
-
: 'cyan';
|
|
19
|
-
return (React.createElement(Box, { key: index },
|
|
20
|
-
React.createElement(Text, { color: iconColor, bold: true }, message.role === 'user'
|
|
21
|
-
? '⛇'
|
|
22
|
-
: message.role === 'command'
|
|
23
|
-
? '⌘'
|
|
24
|
-
: message.role === 'subagent'
|
|
25
|
-
? '◈'
|
|
26
|
-
: '❆'),
|
|
27
|
-
React.createElement(Box, { marginLeft: 1, flexDirection: "column" }, message.role === 'command' ? (React.createElement(Text, { color: "gray" },
|
|
28
|
-
"\u2514\u2500 ",
|
|
29
|
-
message.commandName)) : message.role === 'subagent' ? (React.createElement(React.Fragment, null,
|
|
30
|
-
React.createElement(Text, { color: "magenta", dimColor: true },
|
|
31
|
-
"\u2514\u2500 Sub-Agent: ",
|
|
32
|
-
message.subAgent?.agentName,
|
|
33
|
-
message.subAgent?.isComplete ? ' ✓' : ' ...'),
|
|
34
|
-
React.createElement(Box, { marginLeft: 2 },
|
|
35
|
-
React.createElement(Text, { color: "gray" }, message.content || ' ')))) : (React.createElement(React.Fragment, null,
|
|
36
|
-
message.role === 'user' ? (React.createElement(Text, { color: "white", backgroundColor: "#4a4a4a" }, message.content || ' ')) : (React.createElement(MarkdownRenderer, { content: message.content || ' ' })),
|
|
37
|
-
(message.files || message.images) && (React.createElement(Box, { flexDirection: "column" },
|
|
38
|
-
message.files && message.files.length > 0 && (React.createElement(React.Fragment, null, message.files.map((file, fileIndex) => (React.createElement(Text, { key: fileIndex, color: "gray", dimColor: true }, file.isImage
|
|
39
|
-
? `└─ [image #{fileIndex + 1}] ${file.path}`
|
|
40
|
-
: `└─ Read \`${file.path}\`${file.exists
|
|
41
|
-
? ` (total line ${file.lineCount})`
|
|
42
|
-
: ' (file not found)'}`))))),
|
|
43
|
-
message.images && message.images.length > 0 && (React.createElement(React.Fragment, null, message.images.map((_image, imageIndex) => (React.createElement(Text, { key: imageIndex, color: "gray", dimColor: true },
|
|
44
|
-
"\u2514\u2500 [image #",
|
|
45
|
-
imageIndex + 1,
|
|
46
|
-
"]"))))))),
|
|
47
|
-
message.toolCall &&
|
|
48
|
-
message.toolCall.name === 'terminal-execute' &&
|
|
49
|
-
message.toolCall.arguments.command && (React.createElement(Box, { marginTop: 1, flexDirection: "column" },
|
|
50
|
-
React.createElement(Text, { color: "gray", dimColor: true },
|
|
51
|
-
"\u2514\u2500 Command:",
|
|
52
|
-
' ',
|
|
53
|
-
React.createElement(Text, { color: "white" }, message.toolCall.arguments.command)),
|
|
54
|
-
React.createElement(Text, { color: "gray", dimColor: true },
|
|
55
|
-
"\u2514\u2500 Exit Code:",
|
|
56
|
-
' ',
|
|
57
|
-
React.createElement(Text, { color: message.toolCall.arguments.exitCode === 0
|
|
58
|
-
? 'green'
|
|
59
|
-
: 'red' }, message.toolCall.arguments.exitCode)),
|
|
60
|
-
message.toolCall.arguments.stdout &&
|
|
61
|
-
message.toolCall.arguments.stdout.trim().length >
|
|
62
|
-
0 && (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
|
|
63
|
-
React.createElement(Text, { color: "green", dimColor: true }, "\u2514\u2500 stdout:"),
|
|
64
|
-
React.createElement(Box, { paddingLeft: 2 },
|
|
65
|
-
React.createElement(Text, { color: "white" }, message.toolCall.arguments.stdout
|
|
66
|
-
.trim()
|
|
67
|
-
.split('\n')
|
|
68
|
-
.slice(0, 20)
|
|
69
|
-
.join('\n')),
|
|
70
|
-
message.toolCall.arguments.stdout
|
|
71
|
-
.trim()
|
|
72
|
-
.split('\n').length > 20 && (React.createElement(Text, { color: "gray", dimColor: true }, "... (output truncated)"))))),
|
|
73
|
-
message.toolCall.arguments.stderr &&
|
|
74
|
-
message.toolCall.arguments.stderr.trim().length >
|
|
75
|
-
0 && (React.createElement(Box, { flexDirection: "column", marginTop: 1 },
|
|
76
|
-
React.createElement(Text, { color: "red", dimColor: true }, "\u2514\u2500 stderr:"),
|
|
77
|
-
React.createElement(Box, { paddingLeft: 2 },
|
|
78
|
-
React.createElement(Text, { color: "red" }, message.toolCall.arguments.stderr
|
|
79
|
-
.trim()
|
|
80
|
-
.split('\n')
|
|
81
|
-
.slice(0, 10)
|
|
82
|
-
.join('\n')),
|
|
83
|
-
message.toolCall.arguments.stderr
|
|
84
|
-
.trim()
|
|
85
|
-
.split('\n').length > 10 && (React.createElement(Text, { color: "gray", dimColor: true }, "... (output truncated)"))))))),
|
|
86
|
-
message.discontinued && (React.createElement(Text, { color: "red", bold: true }, "\u2514\u2500 user discontinue")))))));
|
|
87
|
-
})));
|
|
88
|
-
}, (prevProps, nextProps) => {
|
|
89
|
-
const hasStreamingMessage = nextProps.messages.some(m => m.streaming);
|
|
90
|
-
if (hasStreamingMessage) {
|
|
91
|
-
return (prevProps.messages === nextProps.messages &&
|
|
92
|
-
prevProps.animationFrame === nextProps.animationFrame);
|
|
93
|
-
}
|
|
94
|
-
return prevProps.messages === nextProps.messages;
|
|
95
|
-
});
|
|
96
|
-
MessageList.displayName = 'MessageList';
|
|
97
|
-
export default MessageList;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface PendingMessage {
|
|
3
|
-
text: string;
|
|
4
|
-
images?: Array<{
|
|
5
|
-
data: string;
|
|
6
|
-
mimeType: string;
|
|
7
|
-
}>;
|
|
8
|
-
}
|
|
9
|
-
interface Props {
|
|
10
|
-
pendingMessages: PendingMessage[];
|
|
11
|
-
}
|
|
12
|
-
export default function PendingMessages({ pendingMessages }: Props): React.JSX.Element | null;
|
|
13
|
-
export {};
|