centaurus-cli 2.8.6 → 2.8.7

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.
Files changed (115) hide show
  1. package/dist/cli-adapter.d.ts +85 -0
  2. package/dist/cli-adapter.d.ts.map +1 -1
  3. package/dist/cli-adapter.js +769 -28
  4. package/dist/cli-adapter.js.map +1 -1
  5. package/dist/config/slash-commands.d.ts +2 -0
  6. package/dist/config/slash-commands.d.ts.map +1 -1
  7. package/dist/config/slash-commands.js +31 -1
  8. package/dist/config/slash-commands.js.map +1 -1
  9. package/dist/context/handlers/docker-handler.js.map +1 -1
  10. package/dist/context/handlers/ssh-handler.d.ts +16 -1
  11. package/dist/context/handlers/ssh-handler.d.ts.map +1 -1
  12. package/dist/context/handlers/ssh-handler.js +57 -12
  13. package/dist/context/handlers/ssh-handler.js.map +1 -1
  14. package/dist/context/subshell-handler.d.ts +14 -0
  15. package/dist/context/subshell-handler.d.ts.map +1 -1
  16. package/dist/hooks/useTerminalDimensions.d.ts +41 -0
  17. package/dist/hooks/useTerminalDimensions.d.ts.map +1 -0
  18. package/dist/hooks/useTerminalDimensions.js +84 -0
  19. package/dist/hooks/useTerminalDimensions.js.map +1 -0
  20. package/dist/index.js +27 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/services/api-client.d.ts +24 -0
  23. package/dist/services/api-client.d.ts.map +1 -1
  24. package/dist/services/api-client.js +27 -0
  25. package/dist/services/api-client.js.map +1 -1
  26. package/dist/services/auth-handler.js +1 -1
  27. package/dist/services/auth-handler.js.map +1 -1
  28. package/dist/services/clipboard-service.d.ts +42 -0
  29. package/dist/services/clipboard-service.d.ts.map +1 -0
  30. package/dist/services/clipboard-service.js +217 -0
  31. package/dist/services/clipboard-service.js.map +1 -0
  32. package/dist/services/local-chat-storage.d.ts +154 -0
  33. package/dist/services/local-chat-storage.d.ts.map +1 -0
  34. package/dist/services/local-chat-storage.js +258 -0
  35. package/dist/services/local-chat-storage.js.map +1 -0
  36. package/dist/tools/grep-search.d.ts +5 -0
  37. package/dist/tools/grep-search.d.ts.map +1 -1
  38. package/dist/tools/grep-search.js +68 -16
  39. package/dist/tools/grep-search.js.map +1 -1
  40. package/dist/tools/plan-mode.d.ts +57 -6
  41. package/dist/tools/plan-mode.d.ts.map +1 -1
  42. package/dist/tools/plan-mode.js +297 -46
  43. package/dist/tools/plan-mode.js.map +1 -1
  44. package/dist/tools/read-binary-file.d.ts +10 -0
  45. package/dist/tools/read-binary-file.d.ts.map +1 -0
  46. package/dist/tools/read-binary-file.js +210 -0
  47. package/dist/tools/read-binary-file.js.map +1 -0
  48. package/dist/types/index.d.ts +7 -1
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/dist/ui/components/App.d.ts +35 -0
  51. package/dist/ui/components/App.d.ts.map +1 -1
  52. package/dist/ui/components/App.js +608 -16
  53. package/dist/ui/components/App.js.map +1 -1
  54. package/dist/ui/components/ClipboardImageAutocomplete.d.ts +14 -0
  55. package/dist/ui/components/ClipboardImageAutocomplete.d.ts.map +1 -0
  56. package/dist/ui/components/ClipboardImageAutocomplete.js +39 -0
  57. package/dist/ui/components/ClipboardImageAutocomplete.js.map +1 -0
  58. package/dist/ui/components/ConnectionStatusMessage.d.ts +1 -1
  59. package/dist/ui/components/ConnectionStatusMessage.d.ts.map +1 -1
  60. package/dist/ui/components/ConnectionStatusMessage.js +21 -0
  61. package/dist/ui/components/ConnectionStatusMessage.js.map +1 -1
  62. package/dist/ui/components/DetailedPlanReviewScreen.d.ts +17 -0
  63. package/dist/ui/components/DetailedPlanReviewScreen.d.ts.map +1 -0
  64. package/dist/ui/components/DetailedPlanReviewScreen.js +110 -0
  65. package/dist/ui/components/DetailedPlanReviewScreen.js.map +1 -0
  66. package/dist/ui/components/InputBox.d.ts +2 -1
  67. package/dist/ui/components/InputBox.d.ts.map +1 -1
  68. package/dist/ui/components/InputBox.js +399 -28
  69. package/dist/ui/components/InputBox.js.map +1 -1
  70. package/dist/ui/components/InteractiveShell.d.ts.map +1 -1
  71. package/dist/ui/components/InteractiveShell.js +20 -6
  72. package/dist/ui/components/InteractiveShell.js.map +1 -1
  73. package/dist/ui/components/MessageDisplay.d.ts +6 -0
  74. package/dist/ui/components/MessageDisplay.d.ts.map +1 -1
  75. package/dist/ui/components/MessageDisplay.js +66 -3
  76. package/dist/ui/components/MessageDisplay.js.map +1 -1
  77. package/dist/ui/components/PlanAcceptedMessage.d.ts +8 -0
  78. package/dist/ui/components/PlanAcceptedMessage.d.ts.map +1 -1
  79. package/dist/ui/components/PlanAcceptedMessage.js +26 -8
  80. package/dist/ui/components/PlanAcceptedMessage.js.map +1 -1
  81. package/dist/ui/components/StreamingMessageDisplay.d.ts +3 -0
  82. package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -1
  83. package/dist/ui/components/StreamingMessageDisplay.js +10 -6
  84. package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
  85. package/dist/ui/components/TaskCompletedMessage.d.ts.map +1 -1
  86. package/dist/ui/components/TaskCompletedMessage.js +4 -4
  87. package/dist/ui/components/TaskCompletedMessage.js.map +1 -1
  88. package/dist/ui/components/TaskProgressIndicator.d.ts +18 -0
  89. package/dist/ui/components/TaskProgressIndicator.d.ts.map +1 -0
  90. package/dist/ui/components/TaskProgressIndicator.js +72 -0
  91. package/dist/ui/components/TaskProgressIndicator.js.map +1 -0
  92. package/dist/ui/components/ThinkingDisplay.d.ts +3 -0
  93. package/dist/ui/components/ThinkingDisplay.d.ts.map +1 -1
  94. package/dist/ui/components/ThinkingDisplay.js +6 -4
  95. package/dist/ui/components/ThinkingDisplay.js.map +1 -1
  96. package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -1
  97. package/dist/ui/components/ToolExecutionMessage.js +85 -15
  98. package/dist/ui/components/ToolExecutionMessage.js.map +1 -1
  99. package/dist/utils/custom-commands-manager.d.ts +59 -0
  100. package/dist/utils/custom-commands-manager.d.ts.map +1 -0
  101. package/dist/utils/custom-commands-manager.js +142 -0
  102. package/dist/utils/custom-commands-manager.js.map +1 -0
  103. package/dist/utils/input-classifier.d.ts +10 -11
  104. package/dist/utils/input-classifier.d.ts.map +1 -1
  105. package/dist/utils/input-classifier.js +299 -75
  106. package/dist/utils/input-classifier.js.map +1 -1
  107. package/dist/utils/terminal-output.d.ts.map +1 -1
  108. package/dist/utils/terminal-output.js +110 -14
  109. package/dist/utils/terminal-output.js.map +1 -1
  110. package/dist/utils/unicode-sanitizer.d.ts +44 -0
  111. package/dist/utils/unicode-sanitizer.d.ts.map +1 -0
  112. package/dist/utils/unicode-sanitizer.js +211 -0
  113. package/dist/utils/unicode-sanitizer.js.map +1 -0
  114. package/models-config.json +2 -3
  115. package/package.json +4 -1
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Clipboard Service
3
+ *
4
+ * Cross-platform clipboard access for images using @crosscopy/clipboard.
5
+ * Also supports detecting image files copied from file explorer using clipboard-files.
6
+ * Supports Windows, macOS, and Linux.
7
+ */
8
+ export interface ClipboardImage {
9
+ id: string;
10
+ base64Data: string;
11
+ mimeType: string;
12
+ tempPath: string;
13
+ displayName: string;
14
+ sizeBytes: number;
15
+ }
16
+ /**
17
+ * Check if the clipboard contains an image (either raw image data or an image file)
18
+ */
19
+ export declare function hasClipboardImage(): Promise<boolean>;
20
+ /**
21
+ * Get image from clipboard and save to temp file
22
+ * Returns ClipboardImage with base64 data and temp file path
23
+ *
24
+ * Supports two modes:
25
+ * 1. Raw image data in clipboard (screenshots, copied from image editors)
26
+ * 2. Image files copied from file explorer
27
+ */
28
+ export declare function getClipboardImage(): Promise<ClipboardImage | null>;
29
+ /**
30
+ * Get all clipboard images (currently just returns single image if present)
31
+ * Future: Could support multiple images from clipboard history
32
+ */
33
+ export declare function getClipboardImages(): Promise<ClipboardImage[]>;
34
+ /**
35
+ * Clean up temp clipboard images
36
+ */
37
+ export declare function cleanupClipboardImage(tempPath: string): void;
38
+ /**
39
+ * Format file size for display
40
+ */
41
+ export declare function formatFileSize(bytes: number): string;
42
+ //# sourceMappingURL=clipboard-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard-service.d.ts","sourceRoot":"","sources":["../../src/services/clipboard-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsCH,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAoB1D;AAsBD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA0GxE;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAGpE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS5D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIpD"}
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Clipboard Service
3
+ *
4
+ * Cross-platform clipboard access for images using @crosscopy/clipboard.
5
+ * Also supports detecting image files copied from file explorer using clipboard-files.
6
+ * Supports Windows, macOS, and Linux.
7
+ */
8
+ import { hasImage as clipboardHasImage, getImageBase64 as clipboardGetImageBase64 } from '@crosscopy/clipboard';
9
+ import clipboardFiles from 'clipboard-files';
10
+ import * as fs from 'fs';
11
+ import * as path from 'path';
12
+ import * as os from 'os';
13
+ import { logDebug, logError } from '../utils/logger.js';
14
+ // Supported image file extensions
15
+ const IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.ico', '.tiff', '.tif', '.svg'];
16
+ /**
17
+ * Check if a file path is an image file based on extension
18
+ */
19
+ function isImageFile(filePath) {
20
+ const ext = path.extname(filePath).toLowerCase();
21
+ return IMAGE_EXTENSIONS.includes(ext);
22
+ }
23
+ /**
24
+ * Get image files from clipboard (copied from file explorer)
25
+ */
26
+ function getClipboardImageFiles() {
27
+ try {
28
+ const files = clipboardFiles.readFiles();
29
+ if (files && files.length > 0) {
30
+ const imageFiles = files.filter(isImageFile);
31
+ logDebug(`Clipboard contains ${files.length} file(s), ${imageFiles.length} are images: ${imageFiles.join(', ')}`);
32
+ return imageFiles;
33
+ }
34
+ return [];
35
+ }
36
+ catch (error) {
37
+ logDebug(`Failed to read files from clipboard: ${error instanceof Error ? error.message : String(error)}`);
38
+ return [];
39
+ }
40
+ }
41
+ /**
42
+ * Check if the clipboard contains an image (either raw image data or an image file)
43
+ */
44
+ export async function hasClipboardImage() {
45
+ try {
46
+ // First check for raw image data (screenshots, etc.)
47
+ if (clipboardHasImage()) {
48
+ logDebug('Clipboard has raw image data');
49
+ return true;
50
+ }
51
+ // Then check for copied image files
52
+ const imageFiles = getClipboardImageFiles();
53
+ if (imageFiles.length > 0) {
54
+ logDebug(`Clipboard has ${imageFiles.length} image file(s)`);
55
+ return true;
56
+ }
57
+ return false;
58
+ }
59
+ catch (error) {
60
+ logError('Failed to check clipboard for image', error instanceof Error ? error : undefined);
61
+ return false;
62
+ }
63
+ }
64
+ /**
65
+ * Get MIME type from file extension
66
+ */
67
+ function getMimeTypeFromExtension(filePath) {
68
+ const ext = path.extname(filePath).toLowerCase();
69
+ const mimeTypes = {
70
+ '.png': 'image/png',
71
+ '.jpg': 'image/jpeg',
72
+ '.jpeg': 'image/jpeg',
73
+ '.gif': 'image/gif',
74
+ '.bmp': 'image/bmp',
75
+ '.webp': 'image/webp',
76
+ '.ico': 'image/x-icon',
77
+ '.tiff': 'image/tiff',
78
+ '.tif': 'image/tiff',
79
+ '.svg': 'image/svg+xml',
80
+ };
81
+ return mimeTypes[ext] || 'image/png';
82
+ }
83
+ /**
84
+ * Get image from clipboard and save to temp file
85
+ * Returns ClipboardImage with base64 data and temp file path
86
+ *
87
+ * Supports two modes:
88
+ * 1. Raw image data in clipboard (screenshots, copied from image editors)
89
+ * 2. Image files copied from file explorer
90
+ */
91
+ export async function getClipboardImage() {
92
+ try {
93
+ logDebug('Starting clipboard image check...');
94
+ // First, try to get raw image data (screenshots, etc.)
95
+ let hasRawImage = false;
96
+ try {
97
+ hasRawImage = clipboardHasImage();
98
+ logDebug(`clipboardHasImage() returned: ${hasRawImage}`);
99
+ }
100
+ catch (e) {
101
+ logDebug(`clipboardHasImage() threw error: ${e instanceof Error ? e.message : String(e)}`);
102
+ }
103
+ if (hasRawImage) {
104
+ logDebug('Image found in clipboard, attempting to get base64 data...');
105
+ // Get base64 image data from clipboard
106
+ let base64Data = null;
107
+ try {
108
+ base64Data = await clipboardGetImageBase64();
109
+ logDebug(`Got base64 data, length: ${base64Data ? base64Data.length : 0}`);
110
+ }
111
+ catch (e) {
112
+ logDebug(`clipboardGetImageBase64() threw error: ${e instanceof Error ? e.message : String(e)}`);
113
+ }
114
+ if (base64Data) {
115
+ // Determine MIME type (clipboard images are typically PNG)
116
+ const mimeType = 'image/png';
117
+ // Generate unique ID and filename
118
+ const id = `clipboard_${Date.now()}_${Math.random().toString(36).substring(7)}`;
119
+ const displayName = `clipboard_image_${Date.now()}.png`;
120
+ // Create temp directory for clipboard images
121
+ const tempDir = path.join(os.tmpdir(), 'centaurus-clipboard');
122
+ if (!fs.existsSync(tempDir)) {
123
+ fs.mkdirSync(tempDir, { recursive: true });
124
+ }
125
+ // Save to temp file
126
+ const tempPath = path.join(tempDir, displayName);
127
+ const imageBuffer = Buffer.from(base64Data, 'base64');
128
+ fs.writeFileSync(tempPath, imageBuffer);
129
+ logDebug(`Clipboard image saved to: ${tempPath}, size: ${imageBuffer.length} bytes`);
130
+ return {
131
+ id,
132
+ base64Data,
133
+ mimeType,
134
+ tempPath,
135
+ displayName,
136
+ sizeBytes: imageBuffer.length,
137
+ };
138
+ }
139
+ }
140
+ // If no raw image data, try to get image files from clipboard
141
+ const imageFiles = getClipboardImageFiles();
142
+ if (imageFiles.length > 0) {
143
+ const imagePath = imageFiles[0]; // Use the first image file
144
+ logDebug(`Using image file from clipboard: ${imagePath}`);
145
+ try {
146
+ // Read the file
147
+ const imageBuffer = fs.readFileSync(imagePath);
148
+ const base64Data = imageBuffer.toString('base64');
149
+ const mimeType = getMimeTypeFromExtension(imagePath);
150
+ const originalName = path.basename(imagePath);
151
+ // Generate unique ID and filename with original extension
152
+ const ext = path.extname(imagePath).toLowerCase();
153
+ const id = `clipboard_file_${Date.now()}_${Math.random().toString(36).substring(7)}`;
154
+ const displayName = `clipboard_image_${Date.now()}${ext}`;
155
+ // Create temp directory for clipboard images
156
+ const tempDir = path.join(os.tmpdir(), 'centaurus-clipboard');
157
+ if (!fs.existsSync(tempDir)) {
158
+ fs.mkdirSync(tempDir, { recursive: true });
159
+ }
160
+ // Copy to temp file (preserving original format)
161
+ const tempPath = path.join(tempDir, displayName);
162
+ fs.writeFileSync(tempPath, imageBuffer);
163
+ logDebug(`Clipboard image file copied to: ${tempPath}, size: ${imageBuffer.length} bytes, original: ${originalName}`);
164
+ return {
165
+ id,
166
+ base64Data,
167
+ mimeType,
168
+ tempPath,
169
+ displayName,
170
+ sizeBytes: imageBuffer.length,
171
+ };
172
+ }
173
+ catch (fileError) {
174
+ logError(`Failed to read image file from clipboard: ${imagePath}`, fileError instanceof Error ? fileError : undefined);
175
+ }
176
+ }
177
+ logDebug('No image found in clipboard (neither raw data nor image files)');
178
+ return null;
179
+ }
180
+ catch (error) {
181
+ logError('Failed to get clipboard image', error instanceof Error ? error : undefined);
182
+ return null;
183
+ }
184
+ }
185
+ /**
186
+ * Get all clipboard images (currently just returns single image if present)
187
+ * Future: Could support multiple images from clipboard history
188
+ */
189
+ export async function getClipboardImages() {
190
+ const image = await getClipboardImage();
191
+ return image ? [image] : [];
192
+ }
193
+ /**
194
+ * Clean up temp clipboard images
195
+ */
196
+ export function cleanupClipboardImage(tempPath) {
197
+ try {
198
+ if (fs.existsSync(tempPath)) {
199
+ fs.unlinkSync(tempPath);
200
+ logDebug(`Cleaned up clipboard temp file: ${tempPath}`);
201
+ }
202
+ }
203
+ catch (error) {
204
+ logError('Failed to cleanup clipboard temp file', error instanceof Error ? error : undefined);
205
+ }
206
+ }
207
+ /**
208
+ * Format file size for display
209
+ */
210
+ export function formatFileSize(bytes) {
211
+ if (bytes < 1024)
212
+ return `${bytes} B`;
213
+ if (bytes < 1024 * 1024)
214
+ return `${(bytes / 1024).toFixed(1)} KB`;
215
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
216
+ }
217
+ //# sourceMappingURL=clipboard-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard-service.js","sourceRoot":"","sources":["../../src/services/clipboard-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,cAAc,IAAI,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAChH,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAExD,kCAAkC;AAClC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7G;;GAEG;AACH,SAAS,WAAW,CAAC,QAAgB;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACjD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,G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,CAAC;YAC1B,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACxB,QAAQ,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,QAAQ,CAAC,uCAAuC,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAClG,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IACxC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACtD,CAAC"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Local Chat Storage Service
3
+ *
4
+ * Provides persistent local storage for CLI conversations.
5
+ * Stores chats in ~/.centaurus/chats/ directory as JSON files.
6
+ */
7
+ /**
8
+ * Message interface matching the AIMessage type from ai-service-client
9
+ */
10
+ export interface StoredMessage {
11
+ role: 'user' | 'assistant' | 'system' | 'tool';
12
+ content: string;
13
+ tool_calls?: Array<{
14
+ id: string;
15
+ name: string;
16
+ arguments: Record<string, any>;
17
+ }>;
18
+ tool_call_id?: string;
19
+ }
20
+ /**
21
+ * UI Message for restoring full chat history display
22
+ * This is a serializable version of the Message type from types/index.ts
23
+ */
24
+ export interface StoredUIMessage {
25
+ id: string;
26
+ role: 'user' | 'assistant' | 'system' | 'tool';
27
+ content: string;
28
+ timestamp?: string;
29
+ toolExecution?: {
30
+ toolName: string;
31
+ status: 'pending' | 'executing' | 'completed' | 'error';
32
+ result?: string;
33
+ error?: string;
34
+ arguments?: Record<string, any>;
35
+ };
36
+ shouldStream?: boolean;
37
+ isCommandMode?: boolean;
38
+ tool_call_id?: string;
39
+ tool_calls?: Array<{
40
+ id: string;
41
+ name: string;
42
+ arguments: Record<string, any>;
43
+ }>;
44
+ thinkingDuration?: number;
45
+ taskCompletion?: {
46
+ taskNumber: number;
47
+ totalTasks: number;
48
+ taskDescription: string;
49
+ completionNote?: string;
50
+ };
51
+ planAccepted?: {
52
+ planTitle?: string;
53
+ totalTasks?: number;
54
+ };
55
+ connectionStatus?: {
56
+ type: 'ssh' | 'wsl' | 'docker';
57
+ status: 'connecting' | 'connected' | 'error' | 'disconnected';
58
+ connectionString?: string;
59
+ error?: string;
60
+ };
61
+ }
62
+ /**
63
+ * Remote environment context for SSH/WSL/Docker sessions
64
+ * Used to restore remote session state when resuming a chat
65
+ */
66
+ export interface StoredRemoteContext {
67
+ type: 'ssh' | 'wsl' | 'docker';
68
+ connectionCommand: string;
69
+ remoteCwd: string;
70
+ localCwdBeforeRemote: string;
71
+ metadata?: {
72
+ hostname?: string;
73
+ username?: string;
74
+ distroName?: string;
75
+ containerId?: string;
76
+ port?: number;
77
+ };
78
+ }
79
+ /**
80
+ * Local chat metadata (without messages, for listing)
81
+ */
82
+ export interface LocalChatMeta {
83
+ id: string;
84
+ title: string;
85
+ createdAt: string;
86
+ updatedAt: string;
87
+ messageCount: number;
88
+ environment?: string;
89
+ }
90
+ /**
91
+ * Full local chat with messages
92
+ */
93
+ export interface LocalChat extends LocalChatMeta {
94
+ messages: StoredMessage[];
95
+ uiMessages?: StoredUIMessage[];
96
+ cwd?: string;
97
+ remoteContext?: StoredRemoteContext;
98
+ backendConversationId?: string;
99
+ }
100
+ /**
101
+ * LocalChatStorage class for managing local conversation persistence
102
+ */
103
+ export declare class LocalChatStorage {
104
+ private chatsDir;
105
+ constructor();
106
+ /**
107
+ * Generate a unique chat ID based on timestamp
108
+ */
109
+ generateChatId(): string;
110
+ /**
111
+ * Generate a title from the first user message
112
+ */
113
+ generateTitle(messages: StoredMessage[]): string;
114
+ /**
115
+ * Get the file path for a chat
116
+ */
117
+ private getChatPath;
118
+ /**
119
+ * Save a chat to disk
120
+ * @param remoteContext - undefined = preserve existing, null = clear, StoredRemoteContext = set new value
121
+ */
122
+ saveChat(chatId: string, messages: StoredMessage[], uiMessages?: StoredUIMessage[], cwd?: string, remoteContext?: StoredRemoteContext | null): LocalChat;
123
+ /**
124
+ * Set the backend conversation ID for a chat
125
+ * This is used to associate local chats with backend file storage
126
+ */
127
+ setBackendConversationId(chatId: string, backendConversationId: string): boolean;
128
+ /**
129
+ * Get the backend conversation ID for a chat (if any)
130
+ */
131
+ getBackendConversationId(chatId: string): string | undefined;
132
+ /**
133
+ * Load a chat by ID
134
+ */
135
+ loadChat(chatId: string): LocalChat | null;
136
+ /**
137
+ * List all chats (metadata only, sorted by updatedAt descending)
138
+ */
139
+ listChats(): LocalChatMeta[];
140
+ /**
141
+ * Delete a chat by ID
142
+ */
143
+ deleteChat(chatId: string): boolean;
144
+ /**
145
+ * Rename a chat by ID
146
+ */
147
+ renameChat(chatId: string, newTitle: string): boolean;
148
+ /**
149
+ * Get the chats directory path
150
+ */
151
+ getChatsDir(): string;
152
+ }
153
+ export declare const localChatStorage: LocalChatStorage;
154
+ //# sourceMappingURL=local-chat-storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-chat-storage.d.ts","sourceRoot":"","sources":["../../src/services/local-chat-storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAA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