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
package/dist/utils/fileDialog.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { exec } from 'child_process';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import * as os from 'os';
|
|
5
|
-
const execAsync = promisify(exec);
|
|
6
|
-
/**
|
|
7
|
-
* Cross-platform file save dialog
|
|
8
|
-
* Opens a native file save dialog and returns the selected path
|
|
9
|
-
*/
|
|
10
|
-
export async function showSaveDialog(defaultFilename = 'export.txt', title = 'Save File') {
|
|
11
|
-
const platform = os.platform();
|
|
12
|
-
try {
|
|
13
|
-
if (platform === 'darwin') {
|
|
14
|
-
// macOS - use osascript (AppleScript)
|
|
15
|
-
const defaultPath = path.join(os.homedir(), 'Downloads', defaultFilename);
|
|
16
|
-
const script = `
|
|
17
|
-
set defaultPath to POSIX file "${defaultPath}"
|
|
18
|
-
set saveFile to choose file name with prompt "${title}" default location (POSIX file "${os.homedir()}/Downloads") default name "${defaultFilename}"
|
|
19
|
-
return POSIX path of saveFile
|
|
20
|
-
`;
|
|
21
|
-
const { stdout } = await execAsync(`osascript -e '${script.replace(/'/g, "'\\''")}'`);
|
|
22
|
-
return stdout.trim();
|
|
23
|
-
}
|
|
24
|
-
else if (platform === 'win32') {
|
|
25
|
-
// Windows - use PowerShell
|
|
26
|
-
const script = `
|
|
27
|
-
Add-Type -AssemblyName System.Windows.Forms
|
|
28
|
-
$dialog = New-Object System.Windows.Forms.SaveFileDialog
|
|
29
|
-
$dialog.Title = "${title}"
|
|
30
|
-
$dialog.Filter = "Text files (*.txt)|*.txt|Markdown files (*.md)|*.md|All files (*.*)|*.*"
|
|
31
|
-
$dialog.FileName = "${defaultFilename}"
|
|
32
|
-
$dialog.InitialDirectory = "${path.join(os.homedir(), 'Downloads').replace(/\\/g, '\\\\')}"
|
|
33
|
-
$result = $dialog.ShowDialog()
|
|
34
|
-
if ($result -eq 'OK') {
|
|
35
|
-
Write-Output $dialog.FileName
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
const { stdout } = await execAsync(`powershell -NoProfile -Command "${script.replace(/"/g, '\\"')}"`);
|
|
39
|
-
const result = stdout.trim();
|
|
40
|
-
return result || null;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
// Linux - use zenity (most common) or kdialog as fallback
|
|
44
|
-
try {
|
|
45
|
-
const defaultPath = path.join(os.homedir(), 'Downloads', defaultFilename);
|
|
46
|
-
const { stdout } = await execAsync(`zenity --file-selection --save --title="${title}" --filename="${defaultPath}" --confirm-overwrite`);
|
|
47
|
-
return stdout.trim();
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
// Try kdialog as fallback for KDE systems
|
|
51
|
-
try {
|
|
52
|
-
const defaultPath = path.join(os.homedir(), 'Downloads', defaultFilename);
|
|
53
|
-
const { stdout } = await execAsync(`kdialog --getsavefilename "${defaultPath}" "*.*|All Files" --title "${title}"`);
|
|
54
|
-
return stdout.trim();
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
// If both fail, return null
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
// User cancelled or error occurred
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Check if native file dialogs are available on this platform
|
|
70
|
-
*/
|
|
71
|
-
export function isFileDialogSupported() {
|
|
72
|
-
const platform = os.platform();
|
|
73
|
-
return platform === 'darwin' || platform === 'win32' || platform === 'linux';
|
|
74
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface SelectedFile {
|
|
2
|
-
path: string;
|
|
3
|
-
lineCount: number;
|
|
4
|
-
exists: boolean;
|
|
5
|
-
isImage?: boolean;
|
|
6
|
-
imageData?: string;
|
|
7
|
-
mimeType?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Get line count for a file
|
|
11
|
-
*/
|
|
12
|
-
export declare function getFileLineCount(filePath: string): Promise<number>;
|
|
13
|
-
/**
|
|
14
|
-
* Get file information including line count
|
|
15
|
-
*/
|
|
16
|
-
export declare function getFileInfo(filePath: string): Promise<SelectedFile>;
|
|
17
|
-
/**
|
|
18
|
-
* Format file tree display for messages
|
|
19
|
-
*/
|
|
20
|
-
export declare function formatFileTree(files: SelectedFile[]): string;
|
|
21
|
-
/**
|
|
22
|
-
* Parse @file references from message content and check if they exist
|
|
23
|
-
* Also supports direct file paths (pasted from VSCode drag & drop)
|
|
24
|
-
*/
|
|
25
|
-
export declare function parseAndValidateFileReferences(content: string): Promise<{
|
|
26
|
-
cleanContent: string;
|
|
27
|
-
validFiles: SelectedFile[];
|
|
28
|
-
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Create message with file read instructions for AI
|
|
31
|
-
*/
|
|
32
|
-
export declare function createMessageWithFileInstructions(content: string, files: SelectedFile[], editorContext?: {
|
|
33
|
-
activeFile?: string;
|
|
34
|
-
selectedText?: string;
|
|
35
|
-
cursorPosition?: {
|
|
36
|
-
line: number;
|
|
37
|
-
character: number;
|
|
38
|
-
};
|
|
39
|
-
workspaceFolder?: string;
|
|
40
|
-
}): string;
|
package/dist/utils/fileUtils.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
/**
|
|
4
|
-
* Get line count for a file
|
|
5
|
-
*/
|
|
6
|
-
export function getFileLineCount(filePath) {
|
|
7
|
-
return new Promise((resolve) => {
|
|
8
|
-
try {
|
|
9
|
-
if (!fs.existsSync(filePath)) {
|
|
10
|
-
resolve(0);
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
14
|
-
const lines = content.split('\n').length;
|
|
15
|
-
resolve(lines);
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
resolve(0);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Check if file is an image based on extension
|
|
24
|
-
*/
|
|
25
|
-
function isImageFile(filePath) {
|
|
26
|
-
const imageExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.bmp', '.svg'];
|
|
27
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
28
|
-
return imageExtensions.includes(ext);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get MIME type from file extension
|
|
32
|
-
*/
|
|
33
|
-
function getMimeType(filePath) {
|
|
34
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
35
|
-
const mimeTypes = {
|
|
36
|
-
'.png': 'image/png',
|
|
37
|
-
'.jpg': 'image/jpeg',
|
|
38
|
-
'.jpeg': 'image/jpeg',
|
|
39
|
-
'.gif': 'image/gif',
|
|
40
|
-
'.webp': 'image/webp',
|
|
41
|
-
'.bmp': 'image/bmp',
|
|
42
|
-
'.svg': 'image/svg+xml'
|
|
43
|
-
};
|
|
44
|
-
return mimeTypes[ext] || 'application/octet-stream';
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get file information including line count
|
|
48
|
-
*/
|
|
49
|
-
export async function getFileInfo(filePath) {
|
|
50
|
-
try {
|
|
51
|
-
// Try multiple path resolutions in order of preference
|
|
52
|
-
const pathsToTry = [
|
|
53
|
-
filePath, // Original path as provided
|
|
54
|
-
path.resolve(process.cwd(), filePath), // Relative to current working directory
|
|
55
|
-
path.resolve(filePath), // Absolute resolution
|
|
56
|
-
];
|
|
57
|
-
// Remove duplicates while preserving order
|
|
58
|
-
const uniquePaths = [...new Set(pathsToTry)];
|
|
59
|
-
let actualPath = filePath;
|
|
60
|
-
let exists = false;
|
|
61
|
-
// Try each path until we find one that exists
|
|
62
|
-
for (const tryPath of uniquePaths) {
|
|
63
|
-
if (fs.existsSync(tryPath)) {
|
|
64
|
-
actualPath = tryPath;
|
|
65
|
-
exists = true;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Check if it's an image file
|
|
70
|
-
const isImage = isImageFile(actualPath);
|
|
71
|
-
let imageData;
|
|
72
|
-
let mimeType;
|
|
73
|
-
let lineCount = 0;
|
|
74
|
-
if (exists) {
|
|
75
|
-
if (isImage) {
|
|
76
|
-
// Read image as base64
|
|
77
|
-
const buffer = fs.readFileSync(actualPath);
|
|
78
|
-
const base64 = buffer.toString('base64');
|
|
79
|
-
mimeType = getMimeType(actualPath);
|
|
80
|
-
imageData = `data:${mimeType};base64,${base64}`;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
lineCount = await getFileLineCount(actualPath);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
path: filePath, // Keep original path for display
|
|
88
|
-
lineCount,
|
|
89
|
-
exists,
|
|
90
|
-
isImage,
|
|
91
|
-
imageData,
|
|
92
|
-
mimeType
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
return {
|
|
97
|
-
path: filePath,
|
|
98
|
-
lineCount: 0,
|
|
99
|
-
exists: false
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Format file tree display for messages
|
|
105
|
-
*/
|
|
106
|
-
export function formatFileTree(files) {
|
|
107
|
-
if (files.length === 0)
|
|
108
|
-
return '';
|
|
109
|
-
return files.map(file => `└─ Read \`${file.path}\`${file.exists ? ` (total line ${file.lineCount})` : ' (file not found)'}`).join('\n');
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Parse @file references from message content and check if they exist
|
|
113
|
-
* Also supports direct file paths (pasted from VSCode drag & drop)
|
|
114
|
-
*/
|
|
115
|
-
export async function parseAndValidateFileReferences(content) {
|
|
116
|
-
const foundFiles = [];
|
|
117
|
-
// Pattern 1: @file references (e.g., @path/to/file.ts)
|
|
118
|
-
const atFileRegex = /@([A-Za-z0-9\-._/\\:]+\.[a-zA-Z]+)(?=\s|$)/g;
|
|
119
|
-
let match;
|
|
120
|
-
while ((match = atFileRegex.exec(content)) !== null) {
|
|
121
|
-
if (match[1]) {
|
|
122
|
-
foundFiles.push(match[1]);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// Pattern 2: Direct absolute/relative paths (e.g., c:\Users\...\file.ts or ./src/file.ts)
|
|
126
|
-
// Match paths that look like file paths with extensions, but NOT @-prefixed ones
|
|
127
|
-
const directPathRegex = /(?<!@)(?:^|\s)((?:[a-zA-Z]:[\\\/]|\.{1,2}[\\\/]|[\\\/])(?:[A-Za-z0-9\-._/\\:()[\] ]+)\.[a-zA-Z]+)(?=\s|$)/g;
|
|
128
|
-
while ((match = directPathRegex.exec(content)) !== null) {
|
|
129
|
-
if (match[1]) {
|
|
130
|
-
const trimmedPath = match[1].trim();
|
|
131
|
-
// Only add if it looks like a real file path
|
|
132
|
-
if (trimmedPath && !foundFiles.includes(trimmedPath)) {
|
|
133
|
-
foundFiles.push(trimmedPath);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// Remove duplicates
|
|
138
|
-
const uniqueFiles = [...new Set(foundFiles)];
|
|
139
|
-
// Check which files actually exist
|
|
140
|
-
const fileInfos = await Promise.all(uniqueFiles.map(async (filePath) => {
|
|
141
|
-
const info = await getFileInfo(filePath);
|
|
142
|
-
return info;
|
|
143
|
-
}));
|
|
144
|
-
// Filter only existing files
|
|
145
|
-
const validFiles = fileInfos.filter(file => file.exists);
|
|
146
|
-
// Clean content - keep paths as user typed them
|
|
147
|
-
const cleanContent = content;
|
|
148
|
-
return {
|
|
149
|
-
cleanContent,
|
|
150
|
-
validFiles
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Create message with file read instructions for AI
|
|
155
|
-
*/
|
|
156
|
-
export function createMessageWithFileInstructions(content, files, editorContext) {
|
|
157
|
-
const parts = [content];
|
|
158
|
-
// Add editor context if provided (from VSCode connection)
|
|
159
|
-
if (editorContext) {
|
|
160
|
-
const editorLines = [];
|
|
161
|
-
if (editorContext.workspaceFolder) {
|
|
162
|
-
editorLines.push(`└─ VSCode Workspace: ${editorContext.workspaceFolder}`);
|
|
163
|
-
}
|
|
164
|
-
if (editorContext.activeFile) {
|
|
165
|
-
editorLines.push(`└─ Active File: ${editorContext.activeFile}`);
|
|
166
|
-
}
|
|
167
|
-
if (editorContext.cursorPosition) {
|
|
168
|
-
editorLines.push(`└─ Cursor: Line ${editorContext.cursorPosition.line + 1}, Column ${editorContext.cursorPosition.character + 1}`);
|
|
169
|
-
}
|
|
170
|
-
if (editorContext.selectedText) {
|
|
171
|
-
editorLines.push(`└─ Selected Code:\n\`\`\`\n${editorContext.selectedText}\n\`\`\``);
|
|
172
|
-
}
|
|
173
|
-
if (editorLines.length > 0) {
|
|
174
|
-
parts.push(editorLines.join('\n'));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
// Add file instructions if provided
|
|
178
|
-
if (files.length > 0) {
|
|
179
|
-
const fileInstructions = files
|
|
180
|
-
.map(f => `└─ Read \`${f.path}\` (total line ${f.lineCount})`)
|
|
181
|
-
.join('\n');
|
|
182
|
-
parts.push(fileInstructions);
|
|
183
|
-
}
|
|
184
|
-
return parts.join('\n');
|
|
185
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface HistoryEntry {
|
|
2
|
-
content: string;
|
|
3
|
-
timestamp: number;
|
|
4
|
-
}
|
|
5
|
-
export interface HistoryData {
|
|
6
|
-
entries: HistoryEntry[];
|
|
7
|
-
lastCleanup: number;
|
|
8
|
-
}
|
|
9
|
-
declare class HistoryManager {
|
|
10
|
-
private readonly historyFile;
|
|
11
|
-
private readonly maxAge;
|
|
12
|
-
private readonly maxEntries;
|
|
13
|
-
private historyData;
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* Ensure the .snow directory exists
|
|
17
|
-
*/
|
|
18
|
-
private ensureSnowDir;
|
|
19
|
-
/**
|
|
20
|
-
* Load history from file
|
|
21
|
-
*/
|
|
22
|
-
loadHistory(): Promise<HistoryEntry[]>;
|
|
23
|
-
/**
|
|
24
|
-
* Add a new entry to history
|
|
25
|
-
*/
|
|
26
|
-
addEntry(content: string): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Get all history entries (newest first)
|
|
29
|
-
*/
|
|
30
|
-
getEntries(): Promise<HistoryEntry[]>;
|
|
31
|
-
/**
|
|
32
|
-
* Clean up entries older than maxAge
|
|
33
|
-
*/
|
|
34
|
-
private cleanupOldEntries;
|
|
35
|
-
/**
|
|
36
|
-
* Save history to file
|
|
37
|
-
*/
|
|
38
|
-
private saveHistory;
|
|
39
|
-
/**
|
|
40
|
-
* Clear all history
|
|
41
|
-
*/
|
|
42
|
-
clearHistory(): Promise<void>;
|
|
43
|
-
}
|
|
44
|
-
export declare const historyManager: HistoryManager;
|
|
45
|
-
export {};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import os from 'os';
|
|
4
|
-
import { logger } from './logger.js';
|
|
5
|
-
class HistoryManager {
|
|
6
|
-
constructor() {
|
|
7
|
-
Object.defineProperty(this, "historyFile", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
value: void 0
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(this, "maxAge", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: 24 * 60 * 60 * 1000
|
|
18
|
-
}); // 1 day in milliseconds
|
|
19
|
-
Object.defineProperty(this, "maxEntries", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: 1000
|
|
24
|
-
}); // Maximum number of entries to keep
|
|
25
|
-
Object.defineProperty(this, "historyData", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: null
|
|
30
|
-
});
|
|
31
|
-
const snowDir = path.join(os.homedir(), '.snow');
|
|
32
|
-
this.historyFile = path.join(snowDir, 'history.json');
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Ensure the .snow directory exists
|
|
36
|
-
*/
|
|
37
|
-
async ensureSnowDir() {
|
|
38
|
-
try {
|
|
39
|
-
const snowDir = path.dirname(this.historyFile);
|
|
40
|
-
await fs.mkdir(snowDir, { recursive: true });
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
// Directory already exists or other error
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Load history from file
|
|
48
|
-
*/
|
|
49
|
-
async loadHistory() {
|
|
50
|
-
try {
|
|
51
|
-
await this.ensureSnowDir();
|
|
52
|
-
// Try to read existing history file
|
|
53
|
-
const data = await fs.readFile(this.historyFile, 'utf-8');
|
|
54
|
-
this.historyData = JSON.parse(data);
|
|
55
|
-
// Clean up old entries if needed
|
|
56
|
-
await this.cleanupOldEntries();
|
|
57
|
-
return this.historyData.entries;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
// File doesn't exist or is corrupted, start fresh
|
|
61
|
-
this.historyData = {
|
|
62
|
-
entries: [],
|
|
63
|
-
lastCleanup: Date.now(),
|
|
64
|
-
};
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Add a new entry to history
|
|
70
|
-
*/
|
|
71
|
-
async addEntry(content) {
|
|
72
|
-
// Don't add empty or whitespace-only entries
|
|
73
|
-
if (!content || !content.trim()) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// Load history if not already loaded
|
|
77
|
-
if (!this.historyData) {
|
|
78
|
-
await this.loadHistory();
|
|
79
|
-
}
|
|
80
|
-
// Don't add duplicate of the last entry
|
|
81
|
-
const lastEntry = this.historyData.entries[this.historyData.entries.length - 1];
|
|
82
|
-
if (lastEntry && lastEntry.content === content) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
// Add new entry
|
|
86
|
-
const newEntry = {
|
|
87
|
-
content,
|
|
88
|
-
timestamp: Date.now(),
|
|
89
|
-
};
|
|
90
|
-
this.historyData.entries.push(newEntry);
|
|
91
|
-
// Limit the number of entries
|
|
92
|
-
if (this.historyData.entries.length > this.maxEntries) {
|
|
93
|
-
this.historyData.entries = this.historyData.entries.slice(-this.maxEntries);
|
|
94
|
-
}
|
|
95
|
-
// Save to file
|
|
96
|
-
await this.saveHistory();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Get all history entries (newest first)
|
|
100
|
-
*/
|
|
101
|
-
async getEntries() {
|
|
102
|
-
if (!this.historyData) {
|
|
103
|
-
await this.loadHistory();
|
|
104
|
-
}
|
|
105
|
-
// Return a copy in reverse order (newest first)
|
|
106
|
-
return [...this.historyData.entries].reverse();
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Clean up entries older than maxAge
|
|
110
|
-
*/
|
|
111
|
-
async cleanupOldEntries() {
|
|
112
|
-
if (!this.historyData) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const now = Date.now();
|
|
116
|
-
const cutoffTime = now - this.maxAge;
|
|
117
|
-
// Only cleanup once per hour to avoid excessive file writes
|
|
118
|
-
if (now - this.historyData.lastCleanup < 60 * 60 * 1000) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
// Filter out old entries
|
|
122
|
-
const originalLength = this.historyData.entries.length;
|
|
123
|
-
this.historyData.entries = this.historyData.entries.filter(entry => entry.timestamp > cutoffTime);
|
|
124
|
-
// Update last cleanup time
|
|
125
|
-
this.historyData.lastCleanup = now;
|
|
126
|
-
// Save if we removed any entries
|
|
127
|
-
if (this.historyData.entries.length < originalLength) {
|
|
128
|
-
await this.saveHistory();
|
|
129
|
-
logger.debug(`Cleaned up ${originalLength - this.historyData.entries.length} old history entries`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Save history to file
|
|
134
|
-
*/
|
|
135
|
-
async saveHistory() {
|
|
136
|
-
if (!this.historyData) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
try {
|
|
140
|
-
await this.ensureSnowDir();
|
|
141
|
-
await fs.writeFile(this.historyFile, JSON.stringify(this.historyData, null, 2), 'utf-8');
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
logger.error('Failed to save history:', error);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Clear all history
|
|
149
|
-
*/
|
|
150
|
-
async clearHistory() {
|
|
151
|
-
this.historyData = {
|
|
152
|
-
entries: [],
|
|
153
|
-
lastCleanup: Date.now(),
|
|
154
|
-
};
|
|
155
|
-
await this.saveHistory();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
// Export singleton instance
|
|
159
|
-
export const historyManager = new HistoryManager();
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File backup entry
|
|
3
|
-
*/
|
|
4
|
-
interface FileBackup {
|
|
5
|
-
path: string;
|
|
6
|
-
content: string | null;
|
|
7
|
-
existed: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Snapshot metadata
|
|
11
|
-
*/
|
|
12
|
-
interface SnapshotMetadata {
|
|
13
|
-
sessionId: string;
|
|
14
|
-
messageIndex: number;
|
|
15
|
-
timestamp: number;
|
|
16
|
-
backups: FileBackup[];
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Incremental Snapshot Manager
|
|
20
|
-
* Only backs up files that are actually modified by tools
|
|
21
|
-
*/
|
|
22
|
-
declare class IncrementalSnapshotManager {
|
|
23
|
-
private readonly snapshotsDir;
|
|
24
|
-
private activeSnapshot;
|
|
25
|
-
constructor();
|
|
26
|
-
/**
|
|
27
|
-
* Ensure snapshots directory exists
|
|
28
|
-
*/
|
|
29
|
-
private ensureSnapshotsDir;
|
|
30
|
-
/**
|
|
31
|
-
* Get snapshot file path
|
|
32
|
-
*/
|
|
33
|
-
private getSnapshotPath;
|
|
34
|
-
/**
|
|
35
|
-
* Create a new snapshot for a message
|
|
36
|
-
*/
|
|
37
|
-
createSnapshot(sessionId: string, messageIndex: number): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Backup a file before modification
|
|
40
|
-
* Call this BEFORE modifying the file
|
|
41
|
-
*/
|
|
42
|
-
backupFile(filePath: string): Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Save current snapshot to disk
|
|
45
|
-
*/
|
|
46
|
-
private saveSnapshot;
|
|
47
|
-
/**
|
|
48
|
-
* Commit snapshot (called after message completes successfully)
|
|
49
|
-
*/
|
|
50
|
-
commitSnapshot(): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* List all snapshots for a session
|
|
53
|
-
*/
|
|
54
|
-
listSnapshots(sessionId: string): Promise<Array<{
|
|
55
|
-
messageIndex: number;
|
|
56
|
-
timestamp: number;
|
|
57
|
-
fileCount: number;
|
|
58
|
-
}>>;
|
|
59
|
-
/**
|
|
60
|
-
* Rollback to a specific snapshot
|
|
61
|
-
*/
|
|
62
|
-
rollbackToSnapshot(sessionId: string, messageIndex: number): Promise<boolean>;
|
|
63
|
-
/**
|
|
64
|
-
* Get list of files that will be affected by rollback to a specific message index
|
|
65
|
-
* @param sessionId Session ID
|
|
66
|
-
* @param targetMessageIndex The message index to rollback to (inclusive)
|
|
67
|
-
* @returns Array of file paths that will be rolled back
|
|
68
|
-
*/
|
|
69
|
-
getFilesToRollback(sessionId: string, targetMessageIndex: number): Promise<string[]>;
|
|
70
|
-
/**
|
|
71
|
-
* Rollback all snapshots after a specific message index
|
|
72
|
-
* This is used when user selects to rollback to a specific message
|
|
73
|
-
* @param sessionId Session ID
|
|
74
|
-
* @param targetMessageIndex The message index to rollback to (inclusive)
|
|
75
|
-
* @returns Number of files rolled back
|
|
76
|
-
*/
|
|
77
|
-
rollbackToMessageIndex(sessionId: string, targetMessageIndex: number): Promise<number>;
|
|
78
|
-
/**
|
|
79
|
-
* Delete all snapshots >= targetMessageIndex
|
|
80
|
-
* This is used when user rolls back conversation to clean up snapshot files
|
|
81
|
-
* @param sessionId Session ID
|
|
82
|
-
* @param targetMessageIndex The message index to delete from (inclusive)
|
|
83
|
-
*/
|
|
84
|
-
deleteSnapshotsFromIndex(sessionId: string, targetMessageIndex: number): Promise<number>;
|
|
85
|
-
/**
|
|
86
|
-
* Clear all snapshots for a session
|
|
87
|
-
*/
|
|
88
|
-
clearAllSnapshots(sessionId: string): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* Get active snapshot
|
|
91
|
-
*/
|
|
92
|
-
getActiveSnapshot(): SnapshotMetadata | null;
|
|
93
|
-
/**
|
|
94
|
-
* Capture workspace state before terminal command
|
|
95
|
-
*/
|
|
96
|
-
captureWorkspaceState(workspaceRoot?: string): Promise<Map<string, {
|
|
97
|
-
mtime: number;
|
|
98
|
-
size: number;
|
|
99
|
-
}>>;
|
|
100
|
-
/**
|
|
101
|
-
* Detect and backup changed files after terminal command
|
|
102
|
-
*/
|
|
103
|
-
backupChangedFiles(beforeState: Map<string, {
|
|
104
|
-
mtime: number;
|
|
105
|
-
size: number;
|
|
106
|
-
}>, workspaceRoot?: string): Promise<void>;
|
|
107
|
-
}
|
|
108
|
-
export declare const incrementalSnapshotManager: IncrementalSnapshotManager;
|
|
109
|
-
export {};
|