@vybestack/llxprt-code 0.7.0 → 0.8.0-nightly.251231.feb9158c8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +4 -3
- package/dist/src/auth/BucketFailoverHandlerImpl.spec.js +1 -1
- package/dist/src/auth/BucketFailoverHandlerImpl.spec.js.map +1 -1
- package/dist/src/auth/__tests__/oauthManager.safety.test.js +2 -2
- package/dist/src/auth/__tests__/oauthManager.safety.test.js.map +1 -1
- package/dist/src/auth/anthropic-oauth-provider.d.ts +3 -1
- package/dist/src/auth/anthropic-oauth-provider.js +40 -29
- package/dist/src/auth/anthropic-oauth-provider.js.map +1 -1
- package/dist/src/auth/codex-oauth-provider.d.ts +3 -2
- package/dist/src/auth/codex-oauth-provider.js +41 -2
- package/dist/src/auth/codex-oauth-provider.js.map +1 -1
- package/dist/src/auth/gemini-oauth-provider.d.ts +2 -1
- package/dist/src/auth/gemini-oauth-provider.js +5 -1
- package/dist/src/auth/gemini-oauth-provider.js.map +1 -1
- package/dist/src/auth/oauth-manager.bucketFailover.spec.js +1 -1
- package/dist/src/auth/oauth-manager.bucketFailover.spec.js.map +1 -1
- package/dist/src/auth/oauth-manager.bucketRefresh.spec.d.ts +6 -0
- package/dist/src/auth/oauth-manager.bucketRefresh.spec.js +56 -0
- package/dist/src/auth/oauth-manager.bucketRefresh.spec.js.map +1 -0
- package/dist/src/auth/oauth-manager.concurrency.spec.js +1 -1
- package/dist/src/auth/oauth-manager.concurrency.spec.js.map +1 -1
- package/dist/src/auth/oauth-manager.d.ts +19 -2
- package/dist/src/auth/oauth-manager.js +262 -10
- package/dist/src/auth/oauth-manager.js.map +1 -1
- package/dist/src/auth/oauth-manager.logout.spec.js +3 -3
- package/dist/src/auth/oauth-manager.logout.spec.js.map +1 -1
- package/dist/src/auth/oauth-manager.spec.js +2 -1
- package/dist/src/auth/oauth-manager.spec.js.map +1 -1
- package/dist/src/auth/qwen-oauth-provider.d.ts +3 -1
- package/dist/src/auth/qwen-oauth-provider.js +87 -21
- package/dist/src/auth/qwen-oauth-provider.js.map +1 -1
- package/dist/src/commands/extensions/install.js +2 -2
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/install.test.js +28 -28
- package/dist/src/commands/extensions/install.test.js.map +1 -1
- package/dist/src/commands/extensions/link.js +2 -2
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/uninstall.js +1 -1
- package/dist/src/commands/extensions/uninstall.js.map +1 -1
- package/dist/src/commands/mcp/list.js +2 -2
- package/dist/src/commands/mcp/list.js.map +1 -1
- package/dist/src/config/__tests__/sandboxConfig.test.d.ts +6 -0
- package/dist/src/config/__tests__/sandboxConfig.test.js +81 -0
- package/dist/src/config/__tests__/sandboxConfig.test.js.map +1 -0
- package/dist/src/config/config.d.ts +6 -4
- package/dist/src/config/config.js +50 -13
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.loadMemory.test.js +4 -1
- package/dist/src/config/config.loadMemory.test.js.map +1 -1
- package/dist/src/config/extension.d.ts +19 -18
- package/dist/src/config/extension.js +68 -55
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.d.ts +2 -2
- package/dist/src/config/extensions/extensionEnablement.js +1 -1
- package/dist/src/config/extensions/extensionEnablement.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.test.js +4 -4
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
- package/dist/src/config/extensions/github.js +1 -1
- package/dist/src/config/extensions/github.js.map +1 -1
- package/dist/src/config/extensions/github.test.js +5 -0
- package/dist/src/config/extensions/github.test.js.map +1 -1
- package/dist/src/config/extensions/update.js +3 -4
- package/dist/src/config/extensions/update.js.map +1 -1
- package/dist/src/config/sandboxConfig.d.ts +2 -0
- package/dist/src/config/sandboxConfig.js +309 -9
- package/dist/src/config/sandboxConfig.js.map +1 -1
- package/dist/src/config/sandboxProfiles.d.ts +32 -0
- package/dist/src/config/sandboxProfiles.js +81 -0
- package/dist/src/config/sandboxProfiles.js.map +1 -0
- package/dist/src/config/settings.js +56 -1
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settingsSchema.d.ts +31 -9
- package/dist/src/config/settingsSchema.js +31 -9
- package/dist/src/config/settingsSchema.js.map +1 -1
- package/dist/src/extensions/extensionAutoUpdater.d.ts +1 -2
- package/dist/src/extensions/extensionAutoUpdater.js +14 -13
- package/dist/src/extensions/extensionAutoUpdater.js.map +1 -1
- package/dist/src/extensions/extensionAutoUpdater.test.js +5 -6
- package/dist/src/extensions/extensionAutoUpdater.test.js.map +1 -1
- package/dist/src/gemini.js +69 -19
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.renderOptions.test.js +1 -1
- package/dist/src/gemini.renderOptions.test.js.map +1 -1
- package/dist/src/gemini.test.js +20 -8
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/integration-tests/__tests__/oauth-buckets.integration.spec.js +2 -2
- package/dist/src/integration-tests/__tests__/oauth-buckets.integration.spec.js.map +1 -1
- package/dist/src/integration-tests/todo-continuation.integration.test.js +3 -3
- package/dist/src/integration-tests/todo-continuation.integration.test.js.map +1 -1
- package/dist/src/nonInteractiveCli.js +47 -11
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/providers/aliases/mistral.config +8 -0
- package/dist/src/runtime/runtimeSettings.js +8 -0
- package/dist/src/runtime/runtimeSettings.js.map +1 -1
- package/dist/src/services/FileCommandLoader.d.ts +1 -1
- package/dist/src/services/FileCommandLoader.js +4 -4
- package/dist/src/services/FileCommandLoader.js.map +1 -1
- package/dist/src/ui/AppContainer.js +66 -9
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.d.ts +1 -1
- package/dist/src/ui/commands/memoryCommand.js +8 -5
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/restoreCommand.js +1 -1
- package/dist/src/ui/commands/restoreCommand.js.map +1 -1
- package/dist/src/ui/components/Composer.js +1 -1
- package/dist/src/ui/components/Composer.js.map +1 -1
- package/dist/src/ui/components/DialogManager.js +3 -3
- package/dist/src/ui/components/DialogManager.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.js +10 -4
- package/dist/src/ui/components/FolderTrustDialog.js.map +1 -1
- package/dist/src/ui/components/FolderTrustDialog.test.js +6 -10
- package/dist/src/ui/components/FolderTrustDialog.test.js.map +1 -1
- package/dist/src/ui/components/WorkspaceMigrationDialog.d.ts +2 -2
- package/dist/src/ui/components/WorkspaceMigrationDialog.js +2 -2
- package/dist/src/ui/components/WorkspaceMigrationDialog.js.map +1 -1
- package/dist/src/ui/components/messages/CompressionMessage.js +28 -4
- package/dist/src/ui/components/messages/CompressionMessage.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.js +7 -0
- package/dist/src/ui/contexts/KeypressContext.js.map +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js +1 -1
- package/dist/src/ui/contexts/KeypressContext.test.js.map +1 -1
- package/dist/src/ui/contexts/UIStateContext.d.ts +4 -5
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.js +25 -9
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +3 -0
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/hooks/useFolderTrust.d.ts +4 -1
- package/dist/src/ui/hooks/useFolderTrust.js +18 -3
- package/dist/src/ui/hooks/useFolderTrust.js.map +1 -1
- package/dist/src/ui/hooks/useGeminiStream.js +55 -5
- package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
- package/dist/src/ui/hooks/useHistoryManager.d.ts +1 -1
- package/dist/src/ui/hooks/useHistoryManager.js +2 -2
- package/dist/src/ui/hooks/useHistoryManager.js.map +1 -1
- package/dist/src/ui/hooks/useReactToolScheduler.js +6 -2
- package/dist/src/ui/hooks/useReactToolScheduler.js.map +1 -1
- package/dist/src/ui/hooks/useWorkspaceMigration.d.ts +2 -2
- package/dist/src/ui/hooks/useWorkspaceMigration.js +13 -8
- package/dist/src/ui/hooks/useWorkspaceMigration.js.map +1 -1
- package/dist/src/ui/oauth-submission.test.js +2 -2
- package/dist/src/ui/oauth-submission.test.js.map +1 -1
- package/dist/src/ui/utils/ui-sizing.d.ts +7 -0
- package/dist/src/ui/utils/ui-sizing.js +22 -0
- package/dist/src/ui/utils/ui-sizing.js.map +1 -0
- package/dist/src/utils/commentJson.d.ts +9 -0
- package/dist/src/utils/commentJson.js +130 -0
- package/dist/src/utils/commentJson.js.map +1 -0
- package/dist/src/utils/commentJson.test.d.ts +6 -0
- package/dist/src/utils/commentJson.test.js +307 -0
- package/dist/src/utils/commentJson.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +25 -0
- package/dist/src/utils/errors.js +78 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.d.ts +6 -0
- package/dist/src/utils/errors.test.js +178 -0
- package/dist/src/utils/errors.test.js.map +1 -0
- package/dist/src/utils/math.d.ts +13 -0
- package/dist/src/utils/math.js +14 -0
- package/dist/src/utils/math.js.map +1 -0
- package/dist/src/utils/sandbox.d.ts +1 -1
- package/dist/src/utils/sandbox.js +186 -13
- package/dist/src/utils/sandbox.js.map +1 -1
- package/dist/src/validateNonInterActiveAuth.js +58 -3
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
7
|
+
import * as fs from 'node:fs';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import * as os from 'node:os';
|
|
10
|
+
import { updateSettingsFilePreservingFormat } from './commentJson.js';
|
|
11
|
+
describe('commentJson', () => {
|
|
12
|
+
let tempDir;
|
|
13
|
+
let testFilePath;
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
// Create a temporary directory for test files
|
|
16
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'preserve-format-test-'));
|
|
17
|
+
testFilePath = path.join(tempDir, 'settings.json');
|
|
18
|
+
});
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
// Clean up temporary directory
|
|
21
|
+
if (fs.existsSync(tempDir)) {
|
|
22
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
describe('updateSettingsFilePreservingFormat', () => {
|
|
26
|
+
it('should preserve comments when updating settings', () => {
|
|
27
|
+
const originalContent = `{
|
|
28
|
+
// Model configuration
|
|
29
|
+
"model": "gemini-2.5-pro",
|
|
30
|
+
"ui": {
|
|
31
|
+
// Theme setting
|
|
32
|
+
"theme": "dark"
|
|
33
|
+
}
|
|
34
|
+
}`;
|
|
35
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
36
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
37
|
+
model: 'gemini-2.5-flash',
|
|
38
|
+
ui: {
|
|
39
|
+
theme: 'dark',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
43
|
+
expect(updatedContent).toContain('// Model configuration');
|
|
44
|
+
expect(updatedContent).toContain('// Theme setting');
|
|
45
|
+
expect(updatedContent).toContain('"model": "gemini-2.5-flash"');
|
|
46
|
+
expect(updatedContent).toContain('"theme": "dark"');
|
|
47
|
+
});
|
|
48
|
+
it('should handle nested object updates', () => {
|
|
49
|
+
const originalContent = `{
|
|
50
|
+
"ui": {
|
|
51
|
+
"theme": "dark",
|
|
52
|
+
"showLineNumbers": true
|
|
53
|
+
}
|
|
54
|
+
}`;
|
|
55
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
56
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
57
|
+
ui: {
|
|
58
|
+
theme: 'light',
|
|
59
|
+
showLineNumbers: true,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
63
|
+
expect(updatedContent).toContain('"theme": "light"');
|
|
64
|
+
expect(updatedContent).toContain('"showLineNumbers": true');
|
|
65
|
+
});
|
|
66
|
+
it('should add new fields while preserving existing structure', () => {
|
|
67
|
+
const originalContent = `{
|
|
68
|
+
// Existing config
|
|
69
|
+
"model": "gemini-2.5-pro"
|
|
70
|
+
}`;
|
|
71
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
72
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
73
|
+
model: 'gemini-2.5-pro',
|
|
74
|
+
newField: 'newValue',
|
|
75
|
+
});
|
|
76
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
77
|
+
expect(updatedContent).toContain('// Existing config');
|
|
78
|
+
expect(updatedContent).toContain('"newField": "newValue"');
|
|
79
|
+
});
|
|
80
|
+
it('should create file if it does not exist', () => {
|
|
81
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
82
|
+
model: 'gemini-2.5-pro',
|
|
83
|
+
});
|
|
84
|
+
expect(fs.existsSync(testFilePath)).toBe(true);
|
|
85
|
+
const content = fs.readFileSync(testFilePath, 'utf-8');
|
|
86
|
+
expect(content).toContain('"model": "gemini-2.5-pro"');
|
|
87
|
+
});
|
|
88
|
+
it('should handle complex real-world scenario', () => {
|
|
89
|
+
const complexContent = `{
|
|
90
|
+
// Settings
|
|
91
|
+
"model": "gemini-2.5-pro",
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
// Active server
|
|
94
|
+
"context7": {
|
|
95
|
+
"headers": {
|
|
96
|
+
"API_KEY": "test-key" // API key
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}`;
|
|
101
|
+
fs.writeFileSync(testFilePath, complexContent, 'utf-8');
|
|
102
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
103
|
+
model: 'gemini-2.5-flash',
|
|
104
|
+
mcpServers: {
|
|
105
|
+
context7: {
|
|
106
|
+
headers: {
|
|
107
|
+
API_KEY: 'new-test-key',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
newSection: {
|
|
112
|
+
setting: 'value',
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
116
|
+
// Verify comments preserved
|
|
117
|
+
expect(updatedContent).toContain('// Settings');
|
|
118
|
+
expect(updatedContent).toContain('// Active server');
|
|
119
|
+
expect(updatedContent).toContain('// API key');
|
|
120
|
+
// Verify updates applied
|
|
121
|
+
expect(updatedContent).toContain('"model": "gemini-2.5-flash"');
|
|
122
|
+
expect(updatedContent).toContain('"newSection"');
|
|
123
|
+
expect(updatedContent).toContain('"API_KEY": "new-test-key"');
|
|
124
|
+
});
|
|
125
|
+
it('should handle corrupted JSON files gracefully', () => {
|
|
126
|
+
const corruptedContent = `{
|
|
127
|
+
"model": "gemini-2.5-pro",
|
|
128
|
+
"ui": {
|
|
129
|
+
"theme": "dark"
|
|
130
|
+
// Missing closing brace
|
|
131
|
+
`;
|
|
132
|
+
fs.writeFileSync(testFilePath, corruptedContent, 'utf-8');
|
|
133
|
+
const consoleSpy = vi
|
|
134
|
+
.spyOn(console, 'error')
|
|
135
|
+
.mockImplementation(() => { });
|
|
136
|
+
expect(() => {
|
|
137
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
138
|
+
model: 'gemini-2.5-flash',
|
|
139
|
+
});
|
|
140
|
+
}).not.toThrow();
|
|
141
|
+
expect(consoleSpy).toHaveBeenCalledWith('Error parsing settings file:', expect.any(Error));
|
|
142
|
+
expect(consoleSpy).toHaveBeenCalledWith('Settings file may be corrupted. Please check the JSON syntax.');
|
|
143
|
+
const unchangedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
144
|
+
expect(unchangedContent).toBe(corruptedContent);
|
|
145
|
+
consoleSpy.mockRestore();
|
|
146
|
+
});
|
|
147
|
+
it('should handle array updates while preserving comments', () => {
|
|
148
|
+
const originalContent = `{
|
|
149
|
+
// Server configurations
|
|
150
|
+
"servers": [
|
|
151
|
+
// First server
|
|
152
|
+
"server1",
|
|
153
|
+
"server2" // Second server
|
|
154
|
+
]
|
|
155
|
+
}`;
|
|
156
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
157
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
158
|
+
servers: ['server1', 'server3'],
|
|
159
|
+
});
|
|
160
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
161
|
+
expect(updatedContent).toContain('// Server configurations');
|
|
162
|
+
expect(updatedContent).toContain('"server1"');
|
|
163
|
+
expect(updatedContent).toContain('"server3"');
|
|
164
|
+
expect(updatedContent).not.toContain('"server2"');
|
|
165
|
+
});
|
|
166
|
+
it('should sync nested objects, removing omitted fields', () => {
|
|
167
|
+
const originalContent = `{
|
|
168
|
+
// Configuration
|
|
169
|
+
"model": "gemini-2.5-pro",
|
|
170
|
+
"ui": {
|
|
171
|
+
"theme": "dark",
|
|
172
|
+
"existingSetting": "value"
|
|
173
|
+
},
|
|
174
|
+
"preservedField": "keep me"
|
|
175
|
+
}`;
|
|
176
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
177
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
178
|
+
model: 'gemini-2.5-flash',
|
|
179
|
+
ui: {
|
|
180
|
+
theme: 'light',
|
|
181
|
+
},
|
|
182
|
+
preservedField: 'keep me',
|
|
183
|
+
});
|
|
184
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
185
|
+
expect(updatedContent).toContain('// Configuration');
|
|
186
|
+
expect(updatedContent).toContain('"model": "gemini-2.5-flash"');
|
|
187
|
+
expect(updatedContent).toContain('"theme": "light"');
|
|
188
|
+
expect(updatedContent).not.toContain('"existingSetting": "value"');
|
|
189
|
+
expect(updatedContent).toContain('"preservedField": "keep me"');
|
|
190
|
+
});
|
|
191
|
+
it('should handle mcpServers field deletion properly', () => {
|
|
192
|
+
const originalContent = `{
|
|
193
|
+
"model": "gemini-2.5-pro",
|
|
194
|
+
"mcpServers": {
|
|
195
|
+
// Server to keep
|
|
196
|
+
"context7": {
|
|
197
|
+
"command": "node",
|
|
198
|
+
"args": ["server.js"]
|
|
199
|
+
},
|
|
200
|
+
// Server to remove
|
|
201
|
+
"oldServer": {
|
|
202
|
+
"command": "old",
|
|
203
|
+
"args": ["old.js"]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}`;
|
|
207
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
208
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
209
|
+
model: 'gemini-2.5-pro',
|
|
210
|
+
mcpServers: {
|
|
211
|
+
context7: {
|
|
212
|
+
command: 'node',
|
|
213
|
+
args: ['server.js'],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
218
|
+
expect(updatedContent).toContain('// Server to keep');
|
|
219
|
+
expect(updatedContent).toContain('"context7"');
|
|
220
|
+
expect(updatedContent).not.toContain('"oldServer"');
|
|
221
|
+
// The comment for the removed server should still be preserved
|
|
222
|
+
expect(updatedContent).toContain('// Server to remove');
|
|
223
|
+
});
|
|
224
|
+
it('preserves sibling-level commented-out blocks when removing another key', () => {
|
|
225
|
+
const originalContent = `{
|
|
226
|
+
"mcpServers": {
|
|
227
|
+
// "sleep": {
|
|
228
|
+
// "command": "node",
|
|
229
|
+
// "args": [
|
|
230
|
+
// "/Users/testUser/test-mcp-server/sleep-mcp/build/index.js"
|
|
231
|
+
// ],
|
|
232
|
+
// "timeout": 300000
|
|
233
|
+
// },
|
|
234
|
+
"playwright": {
|
|
235
|
+
"command": "npx",
|
|
236
|
+
"args": [
|
|
237
|
+
"@playwright/mcp@latest",
|
|
238
|
+
"--headless",
|
|
239
|
+
"--isolated"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}`;
|
|
244
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
245
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
246
|
+
mcpServers: {},
|
|
247
|
+
});
|
|
248
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
249
|
+
expect(updatedContent).toContain('// "sleep": {');
|
|
250
|
+
expect(updatedContent).toContain('"mcpServers"');
|
|
251
|
+
expect(updatedContent).not.toContain('"playwright"');
|
|
252
|
+
});
|
|
253
|
+
it('should handle type conversion from object to array', () => {
|
|
254
|
+
const originalContent = `{
|
|
255
|
+
"data": {
|
|
256
|
+
"key": "value"
|
|
257
|
+
}
|
|
258
|
+
}`;
|
|
259
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
260
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
261
|
+
data: ['item1', 'item2'],
|
|
262
|
+
});
|
|
263
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
264
|
+
expect(updatedContent).toContain('"data": [');
|
|
265
|
+
expect(updatedContent).toContain('"item1"');
|
|
266
|
+
expect(updatedContent).toContain('"item2"');
|
|
267
|
+
});
|
|
268
|
+
it('should remove both nested and non-nested objects when omitted', () => {
|
|
269
|
+
const originalContent = `{
|
|
270
|
+
// Top-level config
|
|
271
|
+
"topLevelObject": {
|
|
272
|
+
"field1": "value1",
|
|
273
|
+
"field2": "value2"
|
|
274
|
+
},
|
|
275
|
+
// Parent object
|
|
276
|
+
"parent": {
|
|
277
|
+
"nestedObject": {
|
|
278
|
+
"nestedField1": "value1",
|
|
279
|
+
"nestedField2": "value2"
|
|
280
|
+
},
|
|
281
|
+
"keepThis": "value"
|
|
282
|
+
},
|
|
283
|
+
// This should be preserved
|
|
284
|
+
"preservedObject": {
|
|
285
|
+
"data": "keep"
|
|
286
|
+
}
|
|
287
|
+
}`;
|
|
288
|
+
fs.writeFileSync(testFilePath, originalContent, 'utf-8');
|
|
289
|
+
updateSettingsFilePreservingFormat(testFilePath, {
|
|
290
|
+
parent: {
|
|
291
|
+
keepThis: 'value',
|
|
292
|
+
},
|
|
293
|
+
preservedObject: {
|
|
294
|
+
data: 'keep',
|
|
295
|
+
},
|
|
296
|
+
});
|
|
297
|
+
const updatedContent = fs.readFileSync(testFilePath, 'utf-8');
|
|
298
|
+
expect(updatedContent).not.toContain('"topLevelObject"');
|
|
299
|
+
expect(updatedContent).not.toContain('"nestedObject"');
|
|
300
|
+
expect(updatedContent).toContain('"keepThis": "value"');
|
|
301
|
+
expect(updatedContent).toContain('"preservedObject"');
|
|
302
|
+
expect(updatedContent).toContain('"data": "keep"');
|
|
303
|
+
expect(updatedContent).toContain('// This should be preserved');
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
//# sourceMappingURL=commentJson.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commentJson.test.js","sourceRoot":"","sources":["../../../src/utils/commentJson.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS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CAAC,CAAC;YACtD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;YAEnD,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -3,7 +3,32 @@
|
|
|
3
3
|
* Copyright 2025 Vybestack LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import type { Config } from '@vybestack/llxprt-code-core';
|
|
6
7
|
/**
|
|
7
8
|
* Extracts a string error message from an unknown error type
|
|
8
9
|
*/
|
|
9
10
|
export declare function getErrorMessage(error: unknown): string;
|
|
11
|
+
/**
|
|
12
|
+
* Handles errors consistently.
|
|
13
|
+
* Outputs error message to stderr and re-throws the error.
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleError(error: unknown, config: Config, customErrorCode?: string | number): never;
|
|
16
|
+
/**
|
|
17
|
+
* Handles tool execution errors specifically.
|
|
18
|
+
*
|
|
19
|
+
* Fatal errors (e.g., NO_SPACE_LEFT) cause the CLI to exit immediately,
|
|
20
|
+
* as they indicate unrecoverable system state.
|
|
21
|
+
*
|
|
22
|
+
* Non-fatal errors (e.g., INVALID_TOOL_PARAMS, FILE_NOT_FOUND, PATH_NOT_IN_WORKSPACE)
|
|
23
|
+
* are logged to stderr and the error response is sent back to the model,
|
|
24
|
+
* allowing it to self-correct.
|
|
25
|
+
*/
|
|
26
|
+
export declare function handleToolError(toolName: string, toolError: Error, config: Config, errorType?: string, resultDisplay?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Handles cancellation/abort signals consistently.
|
|
29
|
+
*/
|
|
30
|
+
export declare function handleCancellationError(_config: Config): never;
|
|
31
|
+
/**
|
|
32
|
+
* Handles max session turns exceeded consistently.
|
|
33
|
+
*/
|
|
34
|
+
export declare function handleMaxTurnsExceededError(_config: Config): never;
|
package/dist/src/utils/errors.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Vybestack LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { parseAndFormatApiError, FatalTurnLimitedError, FatalCancellationError, FatalToolExecutionError, isFatalToolError, } from '@vybestack/llxprt-code-core';
|
|
6
7
|
/**
|
|
7
8
|
* Extracts a string error message from an unknown error type
|
|
8
9
|
*/
|
|
@@ -15,4 +16,81 @@ export function getErrorMessage(error) {
|
|
|
15
16
|
}
|
|
16
17
|
return String(error);
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Extracts the appropriate error code from an error object.
|
|
21
|
+
*/
|
|
22
|
+
function extractErrorCode(error) {
|
|
23
|
+
const errorWithCode = error;
|
|
24
|
+
// Prioritize exitCode for FatalError types, fall back to other codes
|
|
25
|
+
if (typeof errorWithCode.exitCode === 'number') {
|
|
26
|
+
return errorWithCode.exitCode;
|
|
27
|
+
}
|
|
28
|
+
if (errorWithCode.code !== undefined) {
|
|
29
|
+
return errorWithCode.code;
|
|
30
|
+
}
|
|
31
|
+
if (errorWithCode.status !== undefined) {
|
|
32
|
+
return errorWithCode.status;
|
|
33
|
+
}
|
|
34
|
+
return 1; // Default exit code
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Converts an error code to a numeric exit code.
|
|
38
|
+
*/
|
|
39
|
+
function getNumericExitCode(errorCode) {
|
|
40
|
+
return typeof errorCode === 'number' ? errorCode : 1;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Handles errors consistently.
|
|
44
|
+
* Outputs error message to stderr and re-throws the error.
|
|
45
|
+
*/
|
|
46
|
+
export function handleError(error, config, customErrorCode) {
|
|
47
|
+
const errorMessage = parseAndFormatApiError(error, config.getContentGeneratorConfig()?.authType);
|
|
48
|
+
console.error(errorMessage);
|
|
49
|
+
// If we have a custom error code or the error has an exit code, exit with that code
|
|
50
|
+
if (customErrorCode !== undefined) {
|
|
51
|
+
process.exit(getNumericExitCode(customErrorCode));
|
|
52
|
+
}
|
|
53
|
+
const errorCode = extractErrorCode(error);
|
|
54
|
+
if (typeof errorCode === 'number') {
|
|
55
|
+
process.exit(errorCode);
|
|
56
|
+
}
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Handles tool execution errors specifically.
|
|
61
|
+
*
|
|
62
|
+
* Fatal errors (e.g., NO_SPACE_LEFT) cause the CLI to exit immediately,
|
|
63
|
+
* as they indicate unrecoverable system state.
|
|
64
|
+
*
|
|
65
|
+
* Non-fatal errors (e.g., INVALID_TOOL_PARAMS, FILE_NOT_FOUND, PATH_NOT_IN_WORKSPACE)
|
|
66
|
+
* are logged to stderr and the error response is sent back to the model,
|
|
67
|
+
* allowing it to self-correct.
|
|
68
|
+
*/
|
|
69
|
+
export function handleToolError(toolName, toolError, config, errorType, resultDisplay) {
|
|
70
|
+
const errorMessage = `Error executing tool ${toolName}: ${resultDisplay || toolError.message}`;
|
|
71
|
+
const isFatal = isFatalToolError(errorType);
|
|
72
|
+
if (isFatal) {
|
|
73
|
+
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
74
|
+
console.error(errorMessage);
|
|
75
|
+
process.exit(toolExecutionError.exitCode);
|
|
76
|
+
}
|
|
77
|
+
// Non-fatal: log and continue
|
|
78
|
+
console.error(errorMessage);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Handles cancellation/abort signals consistently.
|
|
82
|
+
*/
|
|
83
|
+
export function handleCancellationError(_config) {
|
|
84
|
+
const cancellationError = new FatalCancellationError('Operation cancelled.');
|
|
85
|
+
console.error(cancellationError.message);
|
|
86
|
+
process.exit(cancellationError.exitCode);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Handles max session turns exceeded consistently.
|
|
90
|
+
*/
|
|
91
|
+
export function handleMaxTurnsExceededError(_config) {
|
|
92
|
+
const maxTurnsError = new FatalTurnLimitedError('Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json.');
|
|
93
|
+
console.error(maxTurnsError.message);
|
|
94
|
+
process.exit(maxTurnsError.exitCode);
|
|
95
|
+
}
|
|
18
96
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAQD;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,MAAM,aAAa,GAAG,KAAsB,CAAC;IAE7C,qEAAqE;IACrE,IAAI,OAAO,aAAa,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,aAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IACD,IAAI,aAAa,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,aAAa,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACvC,OAAO,aAAa,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,CAAC,CAAC,oBAAo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,KAAK,CAAC,YAAY,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,iBAAiB,GAAG,IAAI,sBAAsB,CAAC,sBAAsB,CAAC,CAAC;IAC7E,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAe;IACzD,MAAM,aAAa,GAAG,IAAI,qBAAqB,CAC7C,0HAA0H,CAC3H,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { vi } from 'vitest';
|
|
7
|
+
import { FatalInputError } from '@vybestack/llxprt-code-core';
|
|
8
|
+
import { getErrorMessage, handleError, handleToolError, handleCancellationError, handleMaxTurnsExceededError, } from './errors.js';
|
|
9
|
+
// Mock the core modules
|
|
10
|
+
vi.mock('@vybestack/llxprt-code-core', async (importOriginal) => {
|
|
11
|
+
const original = await importOriginal();
|
|
12
|
+
return {
|
|
13
|
+
...original,
|
|
14
|
+
parseAndFormatApiError: vi.fn((error) => {
|
|
15
|
+
if (error instanceof Error) {
|
|
16
|
+
return `API Error: ${error.message}`;
|
|
17
|
+
}
|
|
18
|
+
return `API Error: ${String(error)}`;
|
|
19
|
+
}),
|
|
20
|
+
FatalToolExecutionError: class extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'FatalToolExecutionError';
|
|
24
|
+
this.exitCode = 54;
|
|
25
|
+
}
|
|
26
|
+
exitCode;
|
|
27
|
+
},
|
|
28
|
+
FatalCancellationError: class extends Error {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'FatalCancellationError';
|
|
32
|
+
this.exitCode = 130;
|
|
33
|
+
}
|
|
34
|
+
exitCode;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
describe('errors', () => {
|
|
39
|
+
let mockConfig;
|
|
40
|
+
let processExitSpy;
|
|
41
|
+
let consoleErrorSpy;
|
|
42
|
+
beforeEach(() => {
|
|
43
|
+
// Reset mocks
|
|
44
|
+
vi.clearAllMocks();
|
|
45
|
+
// Mock console.error
|
|
46
|
+
consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => { });
|
|
47
|
+
// Mock process.exit to throw instead of actually exiting
|
|
48
|
+
processExitSpy = vi.spyOn(process, 'exit').mockImplementation((code) => {
|
|
49
|
+
throw new Error(`process.exit called with code: ${code}`);
|
|
50
|
+
});
|
|
51
|
+
// Create mock config
|
|
52
|
+
mockConfig = {
|
|
53
|
+
getContentGeneratorConfig: vi.fn().mockReturnValue({ authType: 'test' }),
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
afterEach(() => {
|
|
57
|
+
consoleErrorSpy.mockRestore();
|
|
58
|
+
processExitSpy.mockRestore();
|
|
59
|
+
});
|
|
60
|
+
describe('getErrorMessage', () => {
|
|
61
|
+
it('should return error message for Error instances', () => {
|
|
62
|
+
const error = new Error('Test error message');
|
|
63
|
+
expect(getErrorMessage(error)).toBe('Test error message');
|
|
64
|
+
});
|
|
65
|
+
it('should convert non-Error values to strings', () => {
|
|
66
|
+
expect(getErrorMessage('string error')).toBe('string error');
|
|
67
|
+
expect(getErrorMessage(123)).toBe('123');
|
|
68
|
+
expect(getErrorMessage(null)).toBe('null');
|
|
69
|
+
expect(getErrorMessage(undefined)).toBe('undefined');
|
|
70
|
+
});
|
|
71
|
+
it('should handle objects', () => {
|
|
72
|
+
const obj = { message: 'test' };
|
|
73
|
+
expect(getErrorMessage(obj)).toBe('[object Object]');
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('handleError', () => {
|
|
77
|
+
it('should log error message and exit with default code 1', () => {
|
|
78
|
+
const testError = new Error('Test error');
|
|
79
|
+
expect(() => {
|
|
80
|
+
handleError(testError, mockConfig);
|
|
81
|
+
}).toThrow('process.exit called with code: 1');
|
|
82
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('API Error: Test error');
|
|
83
|
+
});
|
|
84
|
+
it('should handle non-Error objects and exit with default code 1', () => {
|
|
85
|
+
const testError = 'String error';
|
|
86
|
+
expect(() => {
|
|
87
|
+
handleError(testError, mockConfig);
|
|
88
|
+
}).toThrow('process.exit called with code: 1');
|
|
89
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('API Error: String error');
|
|
90
|
+
});
|
|
91
|
+
it('should use custom error code when provided', () => {
|
|
92
|
+
const testError = new Error('Test error');
|
|
93
|
+
expect(() => {
|
|
94
|
+
handleError(testError, mockConfig, 42);
|
|
95
|
+
}).toThrow('process.exit called with code: 42');
|
|
96
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('API Error: Test error');
|
|
97
|
+
});
|
|
98
|
+
it('should extract exitCode from FatalError instances', () => {
|
|
99
|
+
const fatalError = new FatalInputError('Fatal error');
|
|
100
|
+
expect(() => {
|
|
101
|
+
handleError(fatalError, mockConfig);
|
|
102
|
+
}).toThrow('process.exit called with code: 42');
|
|
103
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('API Error: Fatal error');
|
|
104
|
+
});
|
|
105
|
+
it('should handle error with code property', () => {
|
|
106
|
+
const errorWithCode = new Error('Error with code');
|
|
107
|
+
errorWithCode.code = 404;
|
|
108
|
+
expect(() => {
|
|
109
|
+
handleError(errorWithCode, mockConfig);
|
|
110
|
+
}).toThrow('process.exit called with code: 404');
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
describe('handleToolError', () => {
|
|
114
|
+
const toolName = 'test-tool';
|
|
115
|
+
const toolError = new Error('Tool failed');
|
|
116
|
+
it('should log error message to stderr', () => {
|
|
117
|
+
handleToolError(toolName, toolError, mockConfig);
|
|
118
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Tool failed');
|
|
119
|
+
});
|
|
120
|
+
it('should use resultDisplay when provided', () => {
|
|
121
|
+
handleToolError(toolName, toolError, mockConfig, 'CUSTOM_ERROR', 'Custom display message');
|
|
122
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Custom display message');
|
|
123
|
+
});
|
|
124
|
+
describe('non-fatal errors', () => {
|
|
125
|
+
it('should log error message to stderr without exiting for recoverable errors', () => {
|
|
126
|
+
handleToolError(toolName, toolError, mockConfig, 'invalid_tool_params');
|
|
127
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Tool failed');
|
|
128
|
+
// Should not exit for non-fatal errors
|
|
129
|
+
expect(processExitSpy).not.toHaveBeenCalled();
|
|
130
|
+
});
|
|
131
|
+
it('should not exit for file not found errors', () => {
|
|
132
|
+
handleToolError(toolName, toolError, mockConfig, 'file_not_found');
|
|
133
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Tool failed');
|
|
134
|
+
expect(processExitSpy).not.toHaveBeenCalled();
|
|
135
|
+
});
|
|
136
|
+
it('should not exit for permission denied errors', () => {
|
|
137
|
+
handleToolError(toolName, toolError, mockConfig, 'permission_denied');
|
|
138
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Tool failed');
|
|
139
|
+
expect(processExitSpy).not.toHaveBeenCalled();
|
|
140
|
+
});
|
|
141
|
+
it('should not exit for path not in workspace errors', () => {
|
|
142
|
+
handleToolError(toolName, toolError, mockConfig, 'path_not_in_workspace');
|
|
143
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Tool failed');
|
|
144
|
+
expect(processExitSpy).not.toHaveBeenCalled();
|
|
145
|
+
});
|
|
146
|
+
it('should prefer resultDisplay over error message', () => {
|
|
147
|
+
handleToolError(toolName, toolError, mockConfig, 'invalid_tool_params', 'Display message');
|
|
148
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Display message');
|
|
149
|
+
expect(processExitSpy).not.toHaveBeenCalled();
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe('fatal errors', () => {
|
|
153
|
+
it('should exit immediately for NO_SPACE_LEFT errors', () => {
|
|
154
|
+
expect(() => {
|
|
155
|
+
handleToolError(toolName, toolError, mockConfig, 'no_space_left');
|
|
156
|
+
}).toThrow('process.exit called with code: 54');
|
|
157
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Error executing tool test-tool: Tool failed');
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
describe('handleCancellationError', () => {
|
|
162
|
+
it('should log cancellation message and exit with 130', () => {
|
|
163
|
+
expect(() => {
|
|
164
|
+
handleCancellationError(mockConfig);
|
|
165
|
+
}).toThrow('process.exit called with code: 130');
|
|
166
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Operation cancelled.');
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe('handleMaxTurnsExceededError', () => {
|
|
170
|
+
it('should log max turns message and exit with 53', () => {
|
|
171
|
+
expect(() => {
|
|
172
|
+
handleMaxTurnsExceededError(mockConfig);
|
|
173
|
+
}).toThrow('process.exit called with code: 53');
|
|
174
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json.');
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
//# sourceMappingURL=errors.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.test.js","sourceRoot":"","sources":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