erosolar-cli 1.7.14 → 1.7.16
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/core/responseVerifier.d.ts +79 -0
- package/dist/core/responseVerifier.d.ts.map +1 -0
- package/dist/core/responseVerifier.js +443 -0
- package/dist/core/responseVerifier.js.map +1 -0
- package/dist/shell/interactiveShell.d.ts +10 -0
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +80 -0
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/ui/ShellUIAdapter.d.ts +3 -0
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
- package/dist/ui/ShellUIAdapter.js +4 -10
- package/dist/ui/ShellUIAdapter.js.map +1 -1
- package/dist/ui/persistentPrompt.d.ts +4 -0
- package/dist/ui/persistentPrompt.d.ts.map +1 -1
- package/dist/ui/persistentPrompt.js +10 -11
- package/dist/ui/persistentPrompt.js.map +1 -1
- package/package.json +1 -1
- package/dist/bin/core/agent.js +0 -362
- package/dist/bin/core/agentProfileManifest.js +0 -187
- package/dist/bin/core/agentProfiles.js +0 -34
- package/dist/bin/core/agentRulebook.js +0 -135
- package/dist/bin/core/agentSchemaLoader.js +0 -233
- package/dist/bin/core/contextManager.js +0 -412
- package/dist/bin/core/contextWindow.js +0 -122
- package/dist/bin/core/customCommands.js +0 -80
- package/dist/bin/core/errors/apiKeyErrors.js +0 -114
- package/dist/bin/core/errors/errorTypes.js +0 -340
- package/dist/bin/core/errors/safetyValidator.js +0 -304
- package/dist/bin/core/errors.js +0 -32
- package/dist/bin/core/modelDiscovery.js +0 -755
- package/dist/bin/core/preferences.js +0 -224
- package/dist/bin/core/schemaValidator.js +0 -92
- package/dist/bin/core/secretStore.js +0 -199
- package/dist/bin/core/sessionStore.js +0 -187
- package/dist/bin/core/toolRuntime.js +0 -290
- package/dist/bin/core/types.js +0 -1
- package/dist/bin/shell/bracketedPasteManager.js +0 -350
- package/dist/bin/shell/fileChangeTracker.js +0 -65
- package/dist/bin/shell/interactiveShell.js +0 -2908
- package/dist/bin/shell/liveStatus.js +0 -78
- package/dist/bin/shell/shellApp.js +0 -290
- package/dist/bin/shell/systemPrompt.js +0 -60
- package/dist/bin/shell/updateManager.js +0 -108
- package/dist/bin/ui/ShellUIAdapter.js +0 -459
- package/dist/bin/ui/UnifiedUIController.js +0 -183
- package/dist/bin/ui/animation/AnimationScheduler.js +0 -430
- package/dist/bin/ui/codeHighlighter.js +0 -854
- package/dist/bin/ui/designSystem.js +0 -121
- package/dist/bin/ui/display.js +0 -1222
- package/dist/bin/ui/interrupts/InterruptManager.js +0 -437
- package/dist/bin/ui/layout.js +0 -139
- package/dist/bin/ui/orchestration/StatusOrchestrator.js +0 -403
- package/dist/bin/ui/outputMode.js +0 -38
- package/dist/bin/ui/persistentPrompt.js +0 -183
- package/dist/bin/ui/richText.js +0 -338
- package/dist/bin/ui/shortcutsHelp.js +0 -87
- package/dist/bin/ui/telemetry/UITelemetry.js +0 -443
- package/dist/bin/ui/textHighlighter.js +0 -210
- package/dist/bin/ui/theme.js +0 -116
- package/dist/bin/ui/toolDisplay.js +0 -423
- package/dist/bin/ui/toolDisplayAdapter.js +0 -357
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { MissingSecretError, getSecretDefinitionForProvider, } from '../secretStore.js';
|
|
2
|
-
export function detectApiKeyError(error, provider) {
|
|
3
|
-
if (error instanceof MissingSecretError) {
|
|
4
|
-
const primaryProvider = error.secret.providers[0] ?? null;
|
|
5
|
-
return {
|
|
6
|
-
type: 'missing',
|
|
7
|
-
provider: provider ?? primaryProvider,
|
|
8
|
-
secret: error.secret,
|
|
9
|
-
message: error.message,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
if (isUnauthorizedError(error)) {
|
|
13
|
-
const labelProvider = provider ?? extractProviderFromError(error);
|
|
14
|
-
const secret = labelProvider ? getSecretDefinitionForProvider(labelProvider) : null;
|
|
15
|
-
return {
|
|
16
|
-
type: 'invalid',
|
|
17
|
-
provider: labelProvider,
|
|
18
|
-
secret,
|
|
19
|
-
message: extractErrorMessage(error),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
function isUnauthorizedError(error) {
|
|
25
|
-
const status = extractStatus(error);
|
|
26
|
-
if (status === 401 || status === 403) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
const payload = extractStructuredError(error);
|
|
30
|
-
if (payload) {
|
|
31
|
-
const normalizedType = normalize(payload.type) || normalize(payload.code);
|
|
32
|
-
if (normalizedType && containsAuthKeyword(normalizedType)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
if (payload.message && containsAuthKeyword(normalize(payload.message))) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const message = normalize(extractErrorMessage(error));
|
|
40
|
-
if (!message) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return containsAuthKeyword(message);
|
|
44
|
-
}
|
|
45
|
-
function extractStatus(error) {
|
|
46
|
-
if (!error || typeof error !== 'object') {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
const directStatus = error.status;
|
|
50
|
-
if (typeof directStatus === 'number') {
|
|
51
|
-
return directStatus;
|
|
52
|
-
}
|
|
53
|
-
const response = error.response;
|
|
54
|
-
if (response && typeof response.status === 'number') {
|
|
55
|
-
return response.status;
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
function extractStructuredError(error) {
|
|
60
|
-
if (!error || typeof error !== 'object') {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
if ('error' in error) {
|
|
64
|
-
const candidate = error.error;
|
|
65
|
-
if (candidate && typeof candidate === 'object') {
|
|
66
|
-
return candidate;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
function extractProviderFromError(error) {
|
|
72
|
-
if (!error || typeof error !== 'object') {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
const provider = error.provider;
|
|
76
|
-
if (typeof provider === 'string' && provider.trim()) {
|
|
77
|
-
return provider.trim();
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
function extractErrorMessage(error) {
|
|
82
|
-
if (typeof error === 'string') {
|
|
83
|
-
return error;
|
|
84
|
-
}
|
|
85
|
-
if (error instanceof Error) {
|
|
86
|
-
return error.message ?? '';
|
|
87
|
-
}
|
|
88
|
-
if (error && typeof error === 'object') {
|
|
89
|
-
const payload = extractStructuredError(error);
|
|
90
|
-
if (payload?.message) {
|
|
91
|
-
return payload.message;
|
|
92
|
-
}
|
|
93
|
-
if ('message' in error && typeof error.message === 'string') {
|
|
94
|
-
return error.message;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return '';
|
|
98
|
-
}
|
|
99
|
-
function containsAuthKeyword(value) {
|
|
100
|
-
if (!value) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
return (value.includes('api key') ||
|
|
104
|
-
value.includes('apikey') ||
|
|
105
|
-
value.includes('api-key') ||
|
|
106
|
-
value.includes('authentication') ||
|
|
107
|
-
value.includes('unauthorized'));
|
|
108
|
-
}
|
|
109
|
-
function normalize(value) {
|
|
110
|
-
if (!value) {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
return value.toLowerCase();
|
|
114
|
-
}
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehensive Error Classification System
|
|
3
|
-
*
|
|
4
|
-
* Provides structured error handling with:
|
|
5
|
-
* - Error categorization (dangerous, blocked, invalid, etc.)
|
|
6
|
-
* - Severity levels (critical, error, warning, info)
|
|
7
|
-
* - Auto-fixing suggestions
|
|
8
|
-
* - Recovery strategies
|
|
9
|
-
*/
|
|
10
|
-
export var ErrorSeverity;
|
|
11
|
-
(function (ErrorSeverity) {
|
|
12
|
-
ErrorSeverity["CRITICAL"] = "critical";
|
|
13
|
-
ErrorSeverity["ERROR"] = "error";
|
|
14
|
-
ErrorSeverity["WARNING"] = "warning";
|
|
15
|
-
ErrorSeverity["INFO"] = "info";
|
|
16
|
-
})(ErrorSeverity || (ErrorSeverity = {}));
|
|
17
|
-
export var ErrorCategory;
|
|
18
|
-
(function (ErrorCategory) {
|
|
19
|
-
ErrorCategory["DANGEROUS"] = "dangerous";
|
|
20
|
-
ErrorCategory["BLOCKED"] = "blocked";
|
|
21
|
-
ErrorCategory["INVALID"] = "invalid";
|
|
22
|
-
ErrorCategory["PERMISSION"] = "permission";
|
|
23
|
-
ErrorCategory["RESOURCE"] = "resource";
|
|
24
|
-
ErrorCategory["NETWORK"] = "network";
|
|
25
|
-
ErrorCategory["TIMEOUT"] = "timeout";
|
|
26
|
-
ErrorCategory["VALIDATION"] = "validation";
|
|
27
|
-
ErrorCategory["CONTEXT_OVERFLOW"] = "context_overflow";
|
|
28
|
-
ErrorCategory["NOT_FOUND"] = "not_found";
|
|
29
|
-
ErrorCategory["UNKNOWN"] = "unknown";
|
|
30
|
-
})(ErrorCategory || (ErrorCategory = {}));
|
|
31
|
-
/**
|
|
32
|
-
* Base class for all structured errors
|
|
33
|
-
*/
|
|
34
|
-
export class StructuredError extends Error {
|
|
35
|
-
constructor(details) {
|
|
36
|
-
super(details.message);
|
|
37
|
-
this.name = this.constructor.name;
|
|
38
|
-
this.severity = details.severity;
|
|
39
|
-
this.category = details.category;
|
|
40
|
-
this.suggestions = details.suggestions;
|
|
41
|
-
this.originalInput = details.originalInput;
|
|
42
|
-
this.metadata = details.metadata;
|
|
43
|
-
this.timestamp = details.timestamp;
|
|
44
|
-
this.recoverable = details.recoverable;
|
|
45
|
-
// Maintain proper stack trace
|
|
46
|
-
Error.captureStackTrace(this, this.constructor);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Format error for display with suggestions
|
|
50
|
-
*/
|
|
51
|
-
toDisplayString() {
|
|
52
|
-
const parts = [
|
|
53
|
-
`[${this.severity.toUpperCase()}] ${this.message}`,
|
|
54
|
-
];
|
|
55
|
-
if (this.originalInput) {
|
|
56
|
-
parts.push(` Input: ${this.originalInput}`);
|
|
57
|
-
}
|
|
58
|
-
if (this.suggestions.length > 0) {
|
|
59
|
-
parts.push('\nSuggestions:');
|
|
60
|
-
for (const suggestion of this.suggestions) {
|
|
61
|
-
parts.push(` • ${suggestion.action}`);
|
|
62
|
-
if (suggestion.example) {
|
|
63
|
-
parts.push(` Example: ${suggestion.example}`);
|
|
64
|
-
}
|
|
65
|
-
if (suggestion.autoFixable) {
|
|
66
|
-
parts.push(` [Auto-fixable]`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return parts.join('\n');
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Convert to JSON for logging/telemetry
|
|
74
|
-
*/
|
|
75
|
-
toJSON() {
|
|
76
|
-
return {
|
|
77
|
-
name: this.name,
|
|
78
|
-
severity: this.severity,
|
|
79
|
-
category: this.category,
|
|
80
|
-
message: this.message,
|
|
81
|
-
originalInput: this.originalInput,
|
|
82
|
-
suggestions: this.suggestions.map(s => ({
|
|
83
|
-
action: s.action,
|
|
84
|
-
example: s.example,
|
|
85
|
-
autoFixable: s.autoFixable,
|
|
86
|
-
})),
|
|
87
|
-
metadata: this.metadata,
|
|
88
|
-
timestamp: this.timestamp,
|
|
89
|
-
recoverable: this.recoverable,
|
|
90
|
-
stack: this.stack,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Try to auto-fix the error if possible
|
|
95
|
-
*/
|
|
96
|
-
tryAutoFix() {
|
|
97
|
-
for (const suggestion of this.suggestions) {
|
|
98
|
-
if (suggestion.autoFixable && suggestion.autoFix) {
|
|
99
|
-
try {
|
|
100
|
-
const result = suggestion.autoFix();
|
|
101
|
-
return { fixed: true, result };
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
// Continue to next suggestion
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return { fixed: false };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Dangerous operation error - operation could harm the system
|
|
113
|
-
*/
|
|
114
|
-
export class DangerousOperationError extends StructuredError {
|
|
115
|
-
constructor(operation, reason, safeAlternative) {
|
|
116
|
-
const suggestions = [];
|
|
117
|
-
if (safeAlternative) {
|
|
118
|
-
suggestions.push({
|
|
119
|
-
action: `Use safer alternative: ${safeAlternative}`,
|
|
120
|
-
example: safeAlternative,
|
|
121
|
-
autoFixable: true,
|
|
122
|
-
autoFix: () => safeAlternative,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
suggestions.push({
|
|
127
|
-
action: 'Review operation for safety before retrying',
|
|
128
|
-
autoFixable: false,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
super({
|
|
132
|
-
severity: ErrorSeverity.CRITICAL,
|
|
133
|
-
category: ErrorCategory.DANGEROUS,
|
|
134
|
-
message: `Dangerous operation blocked: ${operation}. Reason: ${reason}`,
|
|
135
|
-
originalInput: operation,
|
|
136
|
-
suggestions,
|
|
137
|
-
recoverable: safeAlternative !== undefined,
|
|
138
|
-
timestamp: new Date().toISOString(),
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Blocked operation error - explicitly forbidden by policy
|
|
144
|
-
*/
|
|
145
|
-
export class BlockedOperationError extends StructuredError {
|
|
146
|
-
constructor(operation, policy, allowedAlternatives) {
|
|
147
|
-
const suggestions = [];
|
|
148
|
-
if (allowedAlternatives && allowedAlternatives.length > 0) {
|
|
149
|
-
for (const alt of allowedAlternatives) {
|
|
150
|
-
suggestions.push({
|
|
151
|
-
action: `Try allowed alternative: ${alt}`,
|
|
152
|
-
example: alt,
|
|
153
|
-
autoFixable: true,
|
|
154
|
-
autoFix: () => alt,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
suggestions.push({
|
|
160
|
-
action: 'This operation is not permitted by policy',
|
|
161
|
-
autoFixable: false,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
super({
|
|
165
|
-
severity: ErrorSeverity.ERROR,
|
|
166
|
-
category: ErrorCategory.BLOCKED,
|
|
167
|
-
message: `Operation blocked by policy "${policy}": ${operation}`,
|
|
168
|
-
originalInput: operation,
|
|
169
|
-
suggestions,
|
|
170
|
-
recoverable: allowedAlternatives !== undefined && allowedAlternatives.length > 0,
|
|
171
|
-
timestamp: new Date().toISOString(),
|
|
172
|
-
metadata: { policy, allowedAlternatives },
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Context overflow error - token/character limits exceeded
|
|
178
|
-
*/
|
|
179
|
-
export class ContextOverflowError extends StructuredError {
|
|
180
|
-
constructor(actual, limit, unit, truncatable = true) {
|
|
181
|
-
const percentage = Math.round((actual / limit) * 100);
|
|
182
|
-
const suggestions = [];
|
|
183
|
-
if (truncatable) {
|
|
184
|
-
suggestions.push({
|
|
185
|
-
action: `Auto-truncate to ${limit} ${unit}`,
|
|
186
|
-
example: `Content will be reduced from ${actual} to ${limit} ${unit}`,
|
|
187
|
-
autoFixable: true,
|
|
188
|
-
autoFix: () => ({ truncate: true, limit }),
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
suggestions.push({
|
|
192
|
-
action: `Reduce scope to use less than ${limit} ${unit}`,
|
|
193
|
-
autoFixable: false,
|
|
194
|
-
});
|
|
195
|
-
super({
|
|
196
|
-
severity: ErrorSeverity.CRITICAL,
|
|
197
|
-
category: ErrorCategory.CONTEXT_OVERFLOW,
|
|
198
|
-
message: `Context overflow: ${actual} ${unit} exceeds limit of ${limit} ${unit} (${percentage}%)`,
|
|
199
|
-
suggestions,
|
|
200
|
-
recoverable: truncatable,
|
|
201
|
-
timestamp: new Date().toISOString(),
|
|
202
|
-
metadata: { actual, limit, unit, percentage },
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Validation error - with auto-fix suggestions
|
|
208
|
-
*/
|
|
209
|
-
export class ValidationError extends StructuredError {
|
|
210
|
-
constructor(field, value, constraint, correctExample) {
|
|
211
|
-
const suggestions = [];
|
|
212
|
-
if (correctExample) {
|
|
213
|
-
suggestions.push({
|
|
214
|
-
action: `Use correct format: ${correctExample}`,
|
|
215
|
-
example: correctExample,
|
|
216
|
-
autoFixable: true,
|
|
217
|
-
autoFix: () => correctExample,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
super({
|
|
221
|
-
severity: ErrorSeverity.ERROR,
|
|
222
|
-
category: ErrorCategory.VALIDATION,
|
|
223
|
-
message: `Validation failed for "${field}": ${constraint}`,
|
|
224
|
-
originalInput: String(value),
|
|
225
|
-
suggestions,
|
|
226
|
-
recoverable: correctExample !== undefined,
|
|
227
|
-
timestamp: new Date().toISOString(),
|
|
228
|
-
metadata: { field, value, constraint },
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Resource error - limits exceeded
|
|
234
|
-
*/
|
|
235
|
-
export class ResourceLimitError extends StructuredError {
|
|
236
|
-
constructor(resource, actual, limit, reducible = true) {
|
|
237
|
-
const suggestions = [];
|
|
238
|
-
if (reducible) {
|
|
239
|
-
const safeValue = Math.floor(limit * 0.8); // 80% of limit
|
|
240
|
-
suggestions.push({
|
|
241
|
-
action: `Reduce ${resource} to ${safeValue} (80% of limit)`,
|
|
242
|
-
example: `Set ${resource}=${safeValue}`,
|
|
243
|
-
autoFixable: true,
|
|
244
|
-
autoFix: () => safeValue,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
super({
|
|
248
|
-
severity: ErrorSeverity.ERROR,
|
|
249
|
-
category: ErrorCategory.RESOURCE,
|
|
250
|
-
message: `Resource limit exceeded: ${resource} is ${actual}, maximum is ${limit}`,
|
|
251
|
-
suggestions,
|
|
252
|
-
recoverable: reducible,
|
|
253
|
-
timestamp: new Date().toISOString(),
|
|
254
|
-
metadata: { resource, actual, limit },
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Format any error as a structured error
|
|
260
|
-
*/
|
|
261
|
-
export function toStructuredError(error) {
|
|
262
|
-
// Already structured
|
|
263
|
-
if (error instanceof StructuredError) {
|
|
264
|
-
return error;
|
|
265
|
-
}
|
|
266
|
-
// Convert standard errors
|
|
267
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
268
|
-
// Detect error category from message
|
|
269
|
-
const category = detectErrorCategory(message);
|
|
270
|
-
const severity = detectErrorSeverity(category);
|
|
271
|
-
class GenericStructuredError extends StructuredError {
|
|
272
|
-
}
|
|
273
|
-
return new GenericStructuredError({
|
|
274
|
-
severity,
|
|
275
|
-
category,
|
|
276
|
-
message,
|
|
277
|
-
suggestions: [],
|
|
278
|
-
recoverable: false,
|
|
279
|
-
timestamp: new Date().toISOString(),
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Detect error category from error message
|
|
284
|
-
*/
|
|
285
|
-
function detectErrorCategory(message) {
|
|
286
|
-
const lower = message.toLowerCase();
|
|
287
|
-
if (lower.includes('dangerous') || lower.includes('unsafe') || lower.includes('harmful')) {
|
|
288
|
-
return ErrorCategory.DANGEROUS;
|
|
289
|
-
}
|
|
290
|
-
if (lower.includes('blocked') || lower.includes('forbidden') || lower.includes('not allowed')) {
|
|
291
|
-
return ErrorCategory.BLOCKED;
|
|
292
|
-
}
|
|
293
|
-
if (lower.includes('invalid') || lower.includes('malformed')) {
|
|
294
|
-
return ErrorCategory.INVALID;
|
|
295
|
-
}
|
|
296
|
-
if (lower.includes('permission') || lower.includes('unauthorized') || lower.includes('access denied')) {
|
|
297
|
-
return ErrorCategory.PERMISSION;
|
|
298
|
-
}
|
|
299
|
-
if (lower.includes('limit') || lower.includes('exceeded') || lower.includes('too large')) {
|
|
300
|
-
return ErrorCategory.RESOURCE;
|
|
301
|
-
}
|
|
302
|
-
if (lower.includes('timeout') || lower.includes('timed out')) {
|
|
303
|
-
return ErrorCategory.TIMEOUT;
|
|
304
|
-
}
|
|
305
|
-
if (lower.includes('network') || lower.includes('connection')) {
|
|
306
|
-
return ErrorCategory.NETWORK;
|
|
307
|
-
}
|
|
308
|
-
if (lower.includes('validation') || lower.includes('schema')) {
|
|
309
|
-
return ErrorCategory.VALIDATION;
|
|
310
|
-
}
|
|
311
|
-
if (lower.includes('context') || lower.includes('token') || lower.includes('overflow')) {
|
|
312
|
-
return ErrorCategory.CONTEXT_OVERFLOW;
|
|
313
|
-
}
|
|
314
|
-
if (lower.includes('not found') || lower.includes('does not exist')) {
|
|
315
|
-
return ErrorCategory.NOT_FOUND;
|
|
316
|
-
}
|
|
317
|
-
return ErrorCategory.UNKNOWN;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Determine severity from category
|
|
321
|
-
*/
|
|
322
|
-
function detectErrorSeverity(category) {
|
|
323
|
-
switch (category) {
|
|
324
|
-
case ErrorCategory.DANGEROUS:
|
|
325
|
-
case ErrorCategory.CONTEXT_OVERFLOW:
|
|
326
|
-
return ErrorSeverity.CRITICAL;
|
|
327
|
-
case ErrorCategory.BLOCKED:
|
|
328
|
-
case ErrorCategory.PERMISSION:
|
|
329
|
-
case ErrorCategory.VALIDATION:
|
|
330
|
-
case ErrorCategory.INVALID:
|
|
331
|
-
case ErrorCategory.RESOURCE:
|
|
332
|
-
return ErrorSeverity.ERROR;
|
|
333
|
-
case ErrorCategory.TIMEOUT:
|
|
334
|
-
case ErrorCategory.NETWORK:
|
|
335
|
-
case ErrorCategory.NOT_FOUND:
|
|
336
|
-
return ErrorSeverity.WARNING;
|
|
337
|
-
default:
|
|
338
|
-
return ErrorSeverity.ERROR;
|
|
339
|
-
}
|
|
340
|
-
}
|