@vybestack/llxprt-code-core 0.1.23-nightly.250823.4e884e4a → 0.1.23-nightly.250825.6cba9007
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/src/auth/oauth-errors.d.ts +173 -0
- package/dist/src/auth/oauth-errors.js +461 -0
- package/dist/src/auth/oauth-errors.js.map +1 -0
- package/dist/src/auth/precedence.d.ts +0 -4
- package/dist/src/auth/precedence.js +19 -44
- package/dist/src/auth/precedence.js.map +1 -1
- package/dist/src/auth/token-store.js +2 -2
- package/dist/src/auth/token-store.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +7 -0
- package/dist/src/code_assist/oauth2.js +82 -32
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/providers/BaseProvider.d.ts +6 -6
- package/dist/src/providers/BaseProvider.js +24 -7
- package/dist/src/providers/BaseProvider.js.map +1 -1
- package/dist/src/providers/IProvider.d.ts +8 -0
- package/dist/src/providers/ProviderManager.d.ts +4 -0
- package/dist/src/providers/ProviderManager.js +6 -0
- package/dist/src/providers/ProviderManager.js.map +1 -1
- package/dist/src/providers/anthropic/AnthropicProvider.d.ts +7 -0
- package/dist/src/providers/anthropic/AnthropicProvider.js +32 -20
- package/dist/src/providers/anthropic/AnthropicProvider.js.map +1 -1
- package/dist/src/providers/gemini/GeminiProvider.d.ts +9 -0
- package/dist/src/providers/gemini/GeminiProvider.js +63 -14
- package/dist/src/providers/gemini/GeminiProvider.js.map +1 -1
- package/dist/src/providers/openai/OpenAIProvider.d.ts +0 -8
- package/dist/src/providers/openai/OpenAIProvider.js +119 -111
- package/dist/src/providers/openai/OpenAIProvider.js.map +1 -1
- package/dist/src/services/ClipboardService.d.ts +19 -0
- package/dist/src/services/ClipboardService.js +66 -0
- package/dist/src/services/ClipboardService.js.map +1 -0
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/services/index.js +1 -0
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +6 -1
- package/dist/src/tools/read-file.js +21 -10
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/tools.js +13 -0
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +6 -1
- package/dist/src/tools/write-file.js +44 -25
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +16 -1
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* OAuth Error Handling System
|
|
8
|
+
*
|
|
9
|
+
* Provides comprehensive error classification, user-friendly messaging,
|
|
10
|
+
* and recovery mechanisms for OAuth providers.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* OAuth error categories for classification and handling
|
|
14
|
+
*/
|
|
15
|
+
export declare enum OAuthErrorCategory {
|
|
16
|
+
/** User must take action (re-authenticate, grant permissions) */
|
|
17
|
+
USER_ACTION_REQUIRED = "user_action_required",
|
|
18
|
+
/** Network or temporary service issues that can be retried */
|
|
19
|
+
TRANSIENT = "transient",
|
|
20
|
+
/** System issues (file permissions, storage problems) */
|
|
21
|
+
SYSTEM = "system",
|
|
22
|
+
/** Critical security or data corruption issues */
|
|
23
|
+
CRITICAL = "critical",
|
|
24
|
+
/** Configuration or setup problems */
|
|
25
|
+
CONFIGURATION = "configuration"
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Specific OAuth error types with detailed classification
|
|
29
|
+
*/
|
|
30
|
+
export declare enum OAuthErrorType {
|
|
31
|
+
AUTHENTICATION_REQUIRED = "authentication_required",
|
|
32
|
+
AUTHORIZATION_EXPIRED = "authorization_expired",
|
|
33
|
+
INSUFFICIENT_PERMISSIONS = "insufficient_permissions",
|
|
34
|
+
USER_CANCELLED = "user_cancelled",
|
|
35
|
+
INVALID_CREDENTIALS = "invalid_credentials",
|
|
36
|
+
NETWORK_ERROR = "network_error",
|
|
37
|
+
SERVICE_UNAVAILABLE = "service_unavailable",
|
|
38
|
+
RATE_LIMITED = "rate_limited",
|
|
39
|
+
TIMEOUT = "timeout",
|
|
40
|
+
STORAGE_ERROR = "storage_error",
|
|
41
|
+
FILE_PERMISSIONS = "file_permissions",
|
|
42
|
+
CORRUPTED_DATA = "corrupted_data",
|
|
43
|
+
SECURITY_VIOLATION = "security_violation",
|
|
44
|
+
MALFORMED_TOKEN = "malformed_token",
|
|
45
|
+
INVALID_CLIENT_ID = "invalid_client_id",
|
|
46
|
+
INVALID_ENDPOINT = "invalid_endpoint",
|
|
47
|
+
MISSING_CONFIGURATION = "missing_configuration",
|
|
48
|
+
UNKNOWN = "unknown"
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Retry strategy configuration
|
|
52
|
+
*/
|
|
53
|
+
export interface RetryConfig {
|
|
54
|
+
/** Maximum number of retry attempts */
|
|
55
|
+
maxAttempts: number;
|
|
56
|
+
/** Base delay between retries in milliseconds */
|
|
57
|
+
baseDelayMs: number;
|
|
58
|
+
/** Multiplier for exponential backoff */
|
|
59
|
+
backoffMultiplier: number;
|
|
60
|
+
/** Maximum delay between retries in milliseconds */
|
|
61
|
+
maxDelayMs: number;
|
|
62
|
+
/** Whether to add random jitter to delays */
|
|
63
|
+
jitter: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Default retry configuration for transient errors
|
|
67
|
+
*/
|
|
68
|
+
export declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
69
|
+
/**
|
|
70
|
+
* Comprehensive OAuth error with classification and user guidance
|
|
71
|
+
*/
|
|
72
|
+
export declare class OAuthError extends Error {
|
|
73
|
+
readonly category: OAuthErrorCategory;
|
|
74
|
+
readonly type: OAuthErrorType;
|
|
75
|
+
readonly provider: string;
|
|
76
|
+
readonly userMessage: string;
|
|
77
|
+
readonly actionRequired: string | null;
|
|
78
|
+
readonly isRetryable: boolean;
|
|
79
|
+
readonly retryAfterMs: number | null;
|
|
80
|
+
readonly technicalDetails: Record<string, unknown>;
|
|
81
|
+
readonly originalError: Error | null;
|
|
82
|
+
constructor(type: OAuthErrorType, provider: string, message: string, options?: {
|
|
83
|
+
userMessage?: string;
|
|
84
|
+
actionRequired?: string;
|
|
85
|
+
retryAfterMs?: number;
|
|
86
|
+
technicalDetails?: Record<string, unknown>;
|
|
87
|
+
originalError?: Error;
|
|
88
|
+
cause?: Error;
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* Categorizes error type into handling categories
|
|
92
|
+
*/
|
|
93
|
+
private categorizeError;
|
|
94
|
+
/**
|
|
95
|
+
* Determines if error type is retryable
|
|
96
|
+
*/
|
|
97
|
+
private determineRetryability;
|
|
98
|
+
/**
|
|
99
|
+
* Generates user-friendly error message
|
|
100
|
+
*/
|
|
101
|
+
private generateUserMessage;
|
|
102
|
+
/**
|
|
103
|
+
* Generates actionable guidance for users
|
|
104
|
+
*/
|
|
105
|
+
private generateActionRequired;
|
|
106
|
+
/**
|
|
107
|
+
* Creates a sanitized version of the error for logging
|
|
108
|
+
*/
|
|
109
|
+
toLogEntry(): Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Error factory for common OAuth error scenarios
|
|
113
|
+
*/
|
|
114
|
+
export declare class OAuthErrorFactory {
|
|
115
|
+
/**
|
|
116
|
+
* Creates an authentication required error
|
|
117
|
+
*/
|
|
118
|
+
static authenticationRequired(provider: string, details?: Record<string, unknown>): OAuthError;
|
|
119
|
+
/**
|
|
120
|
+
* Creates an expired authorization error
|
|
121
|
+
*/
|
|
122
|
+
static authorizationExpired(provider: string, details?: Record<string, unknown>): OAuthError;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a network error with retry capability
|
|
125
|
+
*/
|
|
126
|
+
static networkError(provider: string, originalError?: Error, details?: Record<string, unknown>): OAuthError;
|
|
127
|
+
/**
|
|
128
|
+
* Creates a rate limited error with specific retry delay
|
|
129
|
+
*/
|
|
130
|
+
static rateLimited(provider: string, retryAfterSeconds?: number, details?: Record<string, unknown>): OAuthError;
|
|
131
|
+
/**
|
|
132
|
+
* Creates a storage error
|
|
133
|
+
*/
|
|
134
|
+
static storageError(provider: string, originalError?: Error, details?: Record<string, unknown>): OAuthError;
|
|
135
|
+
/**
|
|
136
|
+
* Creates a corrupted data error
|
|
137
|
+
*/
|
|
138
|
+
static corruptedData(provider: string, details?: Record<string, unknown>): OAuthError;
|
|
139
|
+
/**
|
|
140
|
+
* Creates an error from an unknown error, attempting classification
|
|
141
|
+
*/
|
|
142
|
+
static fromUnknown(provider: string, error: unknown, context?: string): OAuthError;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Retry handler with exponential backoff and jitter
|
|
146
|
+
*/
|
|
147
|
+
export declare class RetryHandler {
|
|
148
|
+
private config;
|
|
149
|
+
constructor(config?: RetryConfig);
|
|
150
|
+
/**
|
|
151
|
+
* Executes operation with retry logic for transient errors
|
|
152
|
+
*/
|
|
153
|
+
executeWithRetry<T>(operation: () => Promise<T>, provider: string, context?: string): Promise<T>;
|
|
154
|
+
/**
|
|
155
|
+
* Sleep utility
|
|
156
|
+
*/
|
|
157
|
+
private sleep;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Graceful error handler for OAuth operations
|
|
161
|
+
*/
|
|
162
|
+
export declare class GracefulErrorHandler {
|
|
163
|
+
private retryHandler;
|
|
164
|
+
constructor(retryHandler?: RetryHandler);
|
|
165
|
+
/**
|
|
166
|
+
* Handles errors gracefully, providing fallback behavior when possible
|
|
167
|
+
*/
|
|
168
|
+
handleGracefully<T>(operation: () => Promise<T>, fallback: T | (() => T | Promise<T>), provider: string, context?: string): Promise<T>;
|
|
169
|
+
/**
|
|
170
|
+
* Wraps a method to handle errors gracefully with logging
|
|
171
|
+
*/
|
|
172
|
+
wrapMethod<TArgs extends unknown[], TReturn>(method: (...args: TArgs) => Promise<TReturn>, provider: string, methodName: string, fallback?: TReturn | ((...args: TArgs) => TReturn | Promise<TReturn>)): (...args: TArgs) => Promise<TReturn>;
|
|
173
|
+
}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Vybestack LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* OAuth Error Handling System
|
|
8
|
+
*
|
|
9
|
+
* Provides comprehensive error classification, user-friendly messaging,
|
|
10
|
+
* and recovery mechanisms for OAuth providers.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* OAuth error categories for classification and handling
|
|
14
|
+
*/
|
|
15
|
+
export var OAuthErrorCategory;
|
|
16
|
+
(function (OAuthErrorCategory) {
|
|
17
|
+
/** User must take action (re-authenticate, grant permissions) */
|
|
18
|
+
OAuthErrorCategory["USER_ACTION_REQUIRED"] = "user_action_required";
|
|
19
|
+
/** Network or temporary service issues that can be retried */
|
|
20
|
+
OAuthErrorCategory["TRANSIENT"] = "transient";
|
|
21
|
+
/** System issues (file permissions, storage problems) */
|
|
22
|
+
OAuthErrorCategory["SYSTEM"] = "system";
|
|
23
|
+
/** Critical security or data corruption issues */
|
|
24
|
+
OAuthErrorCategory["CRITICAL"] = "critical";
|
|
25
|
+
/** Configuration or setup problems */
|
|
26
|
+
OAuthErrorCategory["CONFIGURATION"] = "configuration";
|
|
27
|
+
})(OAuthErrorCategory || (OAuthErrorCategory = {}));
|
|
28
|
+
/**
|
|
29
|
+
* Specific OAuth error types with detailed classification
|
|
30
|
+
*/
|
|
31
|
+
export var OAuthErrorType;
|
|
32
|
+
(function (OAuthErrorType) {
|
|
33
|
+
// User-actionable errors
|
|
34
|
+
OAuthErrorType["AUTHENTICATION_REQUIRED"] = "authentication_required";
|
|
35
|
+
OAuthErrorType["AUTHORIZATION_EXPIRED"] = "authorization_expired";
|
|
36
|
+
OAuthErrorType["INSUFFICIENT_PERMISSIONS"] = "insufficient_permissions";
|
|
37
|
+
OAuthErrorType["USER_CANCELLED"] = "user_cancelled";
|
|
38
|
+
OAuthErrorType["INVALID_CREDENTIALS"] = "invalid_credentials";
|
|
39
|
+
// Transient errors
|
|
40
|
+
OAuthErrorType["NETWORK_ERROR"] = "network_error";
|
|
41
|
+
OAuthErrorType["SERVICE_UNAVAILABLE"] = "service_unavailable";
|
|
42
|
+
OAuthErrorType["RATE_LIMITED"] = "rate_limited";
|
|
43
|
+
OAuthErrorType["TIMEOUT"] = "timeout";
|
|
44
|
+
// System errors
|
|
45
|
+
OAuthErrorType["STORAGE_ERROR"] = "storage_error";
|
|
46
|
+
OAuthErrorType["FILE_PERMISSIONS"] = "file_permissions";
|
|
47
|
+
OAuthErrorType["CORRUPTED_DATA"] = "corrupted_data";
|
|
48
|
+
// Critical errors
|
|
49
|
+
OAuthErrorType["SECURITY_VIOLATION"] = "security_violation";
|
|
50
|
+
OAuthErrorType["MALFORMED_TOKEN"] = "malformed_token";
|
|
51
|
+
// Configuration errors
|
|
52
|
+
OAuthErrorType["INVALID_CLIENT_ID"] = "invalid_client_id";
|
|
53
|
+
OAuthErrorType["INVALID_ENDPOINT"] = "invalid_endpoint";
|
|
54
|
+
OAuthErrorType["MISSING_CONFIGURATION"] = "missing_configuration";
|
|
55
|
+
// Generic fallback
|
|
56
|
+
OAuthErrorType["UNKNOWN"] = "unknown";
|
|
57
|
+
})(OAuthErrorType || (OAuthErrorType = {}));
|
|
58
|
+
/**
|
|
59
|
+
* Default retry configuration for transient errors
|
|
60
|
+
*/
|
|
61
|
+
export const DEFAULT_RETRY_CONFIG = {
|
|
62
|
+
maxAttempts: 3,
|
|
63
|
+
baseDelayMs: 1000,
|
|
64
|
+
backoffMultiplier: 2,
|
|
65
|
+
maxDelayMs: 30000,
|
|
66
|
+
jitter: true,
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Comprehensive OAuth error with classification and user guidance
|
|
70
|
+
*/
|
|
71
|
+
export class OAuthError extends Error {
|
|
72
|
+
category;
|
|
73
|
+
type;
|
|
74
|
+
provider;
|
|
75
|
+
userMessage;
|
|
76
|
+
actionRequired;
|
|
77
|
+
isRetryable;
|
|
78
|
+
retryAfterMs;
|
|
79
|
+
technicalDetails;
|
|
80
|
+
originalError;
|
|
81
|
+
constructor(type, provider, message, options = {}) {
|
|
82
|
+
super(message);
|
|
83
|
+
this.name = 'OAuthError';
|
|
84
|
+
this.type = type;
|
|
85
|
+
this.provider = provider;
|
|
86
|
+
this.category = this.categorizeError(type);
|
|
87
|
+
this.isRetryable = this.determineRetryability(type);
|
|
88
|
+
this.userMessage =
|
|
89
|
+
options.userMessage || this.generateUserMessage(type, provider);
|
|
90
|
+
this.actionRequired =
|
|
91
|
+
options.actionRequired || this.generateActionRequired(type, provider);
|
|
92
|
+
this.retryAfterMs = options.retryAfterMs || null;
|
|
93
|
+
this.technicalDetails = options.technicalDetails || {};
|
|
94
|
+
this.originalError = options.originalError || null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Categorizes error type into handling categories
|
|
98
|
+
*/
|
|
99
|
+
categorizeError(type) {
|
|
100
|
+
switch (type) {
|
|
101
|
+
case OAuthErrorType.AUTHENTICATION_REQUIRED:
|
|
102
|
+
case OAuthErrorType.AUTHORIZATION_EXPIRED:
|
|
103
|
+
case OAuthErrorType.INSUFFICIENT_PERMISSIONS:
|
|
104
|
+
case OAuthErrorType.USER_CANCELLED:
|
|
105
|
+
case OAuthErrorType.INVALID_CREDENTIALS:
|
|
106
|
+
return OAuthErrorCategory.USER_ACTION_REQUIRED;
|
|
107
|
+
case OAuthErrorType.NETWORK_ERROR:
|
|
108
|
+
case OAuthErrorType.SERVICE_UNAVAILABLE:
|
|
109
|
+
case OAuthErrorType.RATE_LIMITED:
|
|
110
|
+
case OAuthErrorType.TIMEOUT:
|
|
111
|
+
return OAuthErrorCategory.TRANSIENT;
|
|
112
|
+
case OAuthErrorType.STORAGE_ERROR:
|
|
113
|
+
case OAuthErrorType.FILE_PERMISSIONS:
|
|
114
|
+
case OAuthErrorType.CORRUPTED_DATA:
|
|
115
|
+
return OAuthErrorCategory.SYSTEM;
|
|
116
|
+
case OAuthErrorType.SECURITY_VIOLATION:
|
|
117
|
+
case OAuthErrorType.MALFORMED_TOKEN:
|
|
118
|
+
return OAuthErrorCategory.CRITICAL;
|
|
119
|
+
case OAuthErrorType.INVALID_CLIENT_ID:
|
|
120
|
+
case OAuthErrorType.INVALID_ENDPOINT:
|
|
121
|
+
case OAuthErrorType.MISSING_CONFIGURATION:
|
|
122
|
+
return OAuthErrorCategory.CONFIGURATION;
|
|
123
|
+
default:
|
|
124
|
+
return OAuthErrorCategory.SYSTEM;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Determines if error type is retryable
|
|
129
|
+
*/
|
|
130
|
+
determineRetryability(type) {
|
|
131
|
+
switch (type) {
|
|
132
|
+
case OAuthErrorType.NETWORK_ERROR:
|
|
133
|
+
case OAuthErrorType.SERVICE_UNAVAILABLE:
|
|
134
|
+
case OAuthErrorType.TIMEOUT:
|
|
135
|
+
return true;
|
|
136
|
+
case OAuthErrorType.RATE_LIMITED:
|
|
137
|
+
return true; // But with specific delay
|
|
138
|
+
default:
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Generates user-friendly error message
|
|
144
|
+
*/
|
|
145
|
+
generateUserMessage(type, provider) {
|
|
146
|
+
const providerName = provider.charAt(0).toUpperCase() + provider.slice(1);
|
|
147
|
+
switch (type) {
|
|
148
|
+
case OAuthErrorType.AUTHENTICATION_REQUIRED:
|
|
149
|
+
return `You need to sign in to ${providerName} to continue.`;
|
|
150
|
+
case OAuthErrorType.AUTHORIZATION_EXPIRED:
|
|
151
|
+
return `Your ${providerName} session has expired. Please sign in again.`;
|
|
152
|
+
case OAuthErrorType.INSUFFICIENT_PERMISSIONS:
|
|
153
|
+
return `${providerName} access was denied. Please grant the required permissions.`;
|
|
154
|
+
case OAuthErrorType.USER_CANCELLED:
|
|
155
|
+
return `${providerName} authentication was cancelled.`;
|
|
156
|
+
case OAuthErrorType.INVALID_CREDENTIALS:
|
|
157
|
+
return `The ${providerName} credentials are invalid. Please sign in again.`;
|
|
158
|
+
case OAuthErrorType.NETWORK_ERROR:
|
|
159
|
+
return `Unable to connect to ${providerName}. Please check your internet connection.`;
|
|
160
|
+
case OAuthErrorType.SERVICE_UNAVAILABLE:
|
|
161
|
+
return `${providerName} is currently unavailable. Please try again later.`;
|
|
162
|
+
case OAuthErrorType.RATE_LIMITED:
|
|
163
|
+
return `Too many requests to ${providerName}. Please wait a moment and try again.`;
|
|
164
|
+
case OAuthErrorType.TIMEOUT:
|
|
165
|
+
return `Connection to ${providerName} timed out. Please try again.`;
|
|
166
|
+
case OAuthErrorType.STORAGE_ERROR:
|
|
167
|
+
return `Unable to save ${providerName} authentication data. Please check file permissions.`;
|
|
168
|
+
case OAuthErrorType.FILE_PERMISSIONS:
|
|
169
|
+
return `Permission denied when accessing ${providerName} authentication files.`;
|
|
170
|
+
case OAuthErrorType.CORRUPTED_DATA:
|
|
171
|
+
return `${providerName} authentication data is corrupted. Please sign in again.`;
|
|
172
|
+
case OAuthErrorType.SECURITY_VIOLATION:
|
|
173
|
+
return `${providerName} authentication failed due to a security issue.`;
|
|
174
|
+
case OAuthErrorType.MALFORMED_TOKEN:
|
|
175
|
+
return `${providerName} returned invalid authentication data. Please try again.`;
|
|
176
|
+
case OAuthErrorType.INVALID_CLIENT_ID:
|
|
177
|
+
return `${providerName} configuration error: invalid client ID.`;
|
|
178
|
+
case OAuthErrorType.INVALID_ENDPOINT:
|
|
179
|
+
return `${providerName} configuration error: invalid server endpoint.`;
|
|
180
|
+
case OAuthErrorType.MISSING_CONFIGURATION:
|
|
181
|
+
return `${providerName} is not properly configured.`;
|
|
182
|
+
default:
|
|
183
|
+
return `An unexpected error occurred with ${providerName} authentication.`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Generates actionable guidance for users
|
|
188
|
+
*/
|
|
189
|
+
generateActionRequired(type, provider) {
|
|
190
|
+
switch (type) {
|
|
191
|
+
case OAuthErrorType.AUTHENTICATION_REQUIRED:
|
|
192
|
+
case OAuthErrorType.AUTHORIZATION_EXPIRED:
|
|
193
|
+
case OAuthErrorType.INVALID_CREDENTIALS:
|
|
194
|
+
return `Run 'llxprt auth login ${provider}' to sign in again.`;
|
|
195
|
+
case OAuthErrorType.INSUFFICIENT_PERMISSIONS:
|
|
196
|
+
return `Grant the required permissions during ${provider} authentication.`;
|
|
197
|
+
case OAuthErrorType.USER_CANCELLED:
|
|
198
|
+
return `Complete the ${provider} authentication process to continue.`;
|
|
199
|
+
case OAuthErrorType.NETWORK_ERROR:
|
|
200
|
+
return 'Check your internet connection and try again.';
|
|
201
|
+
case OAuthErrorType.SERVICE_UNAVAILABLE:
|
|
202
|
+
case OAuthErrorType.RATE_LIMITED:
|
|
203
|
+
case OAuthErrorType.TIMEOUT:
|
|
204
|
+
return 'Wait a few minutes and try again.';
|
|
205
|
+
case OAuthErrorType.STORAGE_ERROR:
|
|
206
|
+
case OAuthErrorType.FILE_PERMISSIONS:
|
|
207
|
+
return 'Check that you have write permissions to ~/.llxprt directory.';
|
|
208
|
+
case OAuthErrorType.CORRUPTED_DATA:
|
|
209
|
+
return `Run 'llxprt auth logout ${provider}' then sign in again.`;
|
|
210
|
+
case OAuthErrorType.SECURITY_VIOLATION:
|
|
211
|
+
return 'Contact support if this problem persists.';
|
|
212
|
+
case OAuthErrorType.MALFORMED_TOKEN:
|
|
213
|
+
return `Sign out and back in to ${provider}.`;
|
|
214
|
+
case OAuthErrorType.INVALID_CLIENT_ID:
|
|
215
|
+
case OAuthErrorType.INVALID_ENDPOINT:
|
|
216
|
+
case OAuthErrorType.MISSING_CONFIGURATION:
|
|
217
|
+
return 'Check your application configuration.';
|
|
218
|
+
default:
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Creates a sanitized version of the error for logging
|
|
224
|
+
*/
|
|
225
|
+
toLogEntry() {
|
|
226
|
+
return {
|
|
227
|
+
type: this.type,
|
|
228
|
+
category: this.category,
|
|
229
|
+
provider: this.provider,
|
|
230
|
+
isRetryable: this.isRetryable,
|
|
231
|
+
retryAfterMs: this.retryAfterMs,
|
|
232
|
+
message: this.message,
|
|
233
|
+
userMessage: this.userMessage,
|
|
234
|
+
actionRequired: this.actionRequired,
|
|
235
|
+
technicalDetails: this.technicalDetails,
|
|
236
|
+
stack: this.stack,
|
|
237
|
+
originalError: this.originalError
|
|
238
|
+
? {
|
|
239
|
+
name: this.originalError.name,
|
|
240
|
+
message: this.originalError.message,
|
|
241
|
+
stack: this.originalError.stack,
|
|
242
|
+
}
|
|
243
|
+
: null,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Error factory for common OAuth error scenarios
|
|
249
|
+
*/
|
|
250
|
+
export class OAuthErrorFactory {
|
|
251
|
+
/**
|
|
252
|
+
* Creates an authentication required error
|
|
253
|
+
*/
|
|
254
|
+
static authenticationRequired(provider, details) {
|
|
255
|
+
return new OAuthError(OAuthErrorType.AUTHENTICATION_REQUIRED, provider, `Authentication required for ${provider}`, { technicalDetails: details });
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Creates an expired authorization error
|
|
259
|
+
*/
|
|
260
|
+
static authorizationExpired(provider, details) {
|
|
261
|
+
return new OAuthError(OAuthErrorType.AUTHORIZATION_EXPIRED, provider, `Authorization expired for ${provider}`, { technicalDetails: details });
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Creates a network error with retry capability
|
|
265
|
+
*/
|
|
266
|
+
static networkError(provider, originalError, details) {
|
|
267
|
+
return new OAuthError(OAuthErrorType.NETWORK_ERROR, provider, `Network error connecting to ${provider}`, {
|
|
268
|
+
originalError,
|
|
269
|
+
technicalDetails: details,
|
|
270
|
+
retryAfterMs: 1000, // Retry after 1 second
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Creates a rate limited error with specific retry delay
|
|
275
|
+
*/
|
|
276
|
+
static rateLimited(provider, retryAfterSeconds = 60, details) {
|
|
277
|
+
return new OAuthError(OAuthErrorType.RATE_LIMITED, provider, `Rate limited by ${provider}`, {
|
|
278
|
+
technicalDetails: details,
|
|
279
|
+
retryAfterMs: retryAfterSeconds * 1000,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Creates a storage error
|
|
284
|
+
*/
|
|
285
|
+
static storageError(provider, originalError, details) {
|
|
286
|
+
return new OAuthError(OAuthErrorType.STORAGE_ERROR, provider, `Storage error for ${provider}`, { originalError, technicalDetails: details });
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Creates a corrupted data error
|
|
290
|
+
*/
|
|
291
|
+
static corruptedData(provider, details) {
|
|
292
|
+
return new OAuthError(OAuthErrorType.CORRUPTED_DATA, provider, `Corrupted data for ${provider}`, { technicalDetails: details });
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Creates an error from an unknown error, attempting classification
|
|
296
|
+
*/
|
|
297
|
+
static fromUnknown(provider, error, context) {
|
|
298
|
+
let originalError = null;
|
|
299
|
+
let message = 'Unknown error';
|
|
300
|
+
let type = OAuthErrorType.UNKNOWN;
|
|
301
|
+
if (error instanceof Error) {
|
|
302
|
+
originalError = error;
|
|
303
|
+
message = error.message;
|
|
304
|
+
// Attempt to classify based on error message or type
|
|
305
|
+
const errorWithCode = error;
|
|
306
|
+
if (error.message.toLowerCase().includes('network') ||
|
|
307
|
+
error.message.toLowerCase().includes('connection') ||
|
|
308
|
+
errorWithCode.code === 'ENOTFOUND' ||
|
|
309
|
+
errorWithCode.code === 'ECONNREFUSED') {
|
|
310
|
+
type = OAuthErrorType.NETWORK_ERROR;
|
|
311
|
+
}
|
|
312
|
+
else if (error.message.toLowerCase().includes('timeout')) {
|
|
313
|
+
type = OAuthErrorType.TIMEOUT;
|
|
314
|
+
}
|
|
315
|
+
else if (error.message.toLowerCase().includes('permission') ||
|
|
316
|
+
errorWithCode.code === 'EACCES' ||
|
|
317
|
+
errorWithCode.code === 'EPERM') {
|
|
318
|
+
type = OAuthErrorType.FILE_PERMISSIONS;
|
|
319
|
+
}
|
|
320
|
+
else if (error.message.toLowerCase().includes('unauthorized') ||
|
|
321
|
+
error.message.toLowerCase().includes('invalid_grant') ||
|
|
322
|
+
error.message.toLowerCase().includes('expired')) {
|
|
323
|
+
type = OAuthErrorType.AUTHORIZATION_EXPIRED;
|
|
324
|
+
}
|
|
325
|
+
else if (error.message.toLowerCase().includes('rate') ||
|
|
326
|
+
error.message.toLowerCase().includes('too many')) {
|
|
327
|
+
type = OAuthErrorType.RATE_LIMITED;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else if (typeof error === 'string') {
|
|
331
|
+
message = error;
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
message = String(error);
|
|
335
|
+
}
|
|
336
|
+
return new OAuthError(type, provider, context ? `${context}: ${message}` : message, {
|
|
337
|
+
originalError: originalError || undefined,
|
|
338
|
+
technicalDetails: { context, originalErrorType: typeof error },
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Retry handler with exponential backoff and jitter
|
|
344
|
+
*/
|
|
345
|
+
export class RetryHandler {
|
|
346
|
+
config;
|
|
347
|
+
constructor(config = DEFAULT_RETRY_CONFIG) {
|
|
348
|
+
this.config = config;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Executes operation with retry logic for transient errors
|
|
352
|
+
*/
|
|
353
|
+
async executeWithRetry(operation, provider, context) {
|
|
354
|
+
let lastError = null;
|
|
355
|
+
for (let attempt = 1; attempt <= this.config.maxAttempts; attempt++) {
|
|
356
|
+
try {
|
|
357
|
+
return await operation();
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
// Convert to OAuthError if not already
|
|
361
|
+
const oauthError = error instanceof OAuthError
|
|
362
|
+
? error
|
|
363
|
+
: OAuthErrorFactory.fromUnknown(provider, error, context);
|
|
364
|
+
lastError = oauthError;
|
|
365
|
+
// Don't retry non-transient errors
|
|
366
|
+
if (!oauthError.isRetryable) {
|
|
367
|
+
throw oauthError;
|
|
368
|
+
}
|
|
369
|
+
// Don't retry on the last attempt
|
|
370
|
+
if (attempt >= this.config.maxAttempts) {
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
// Calculate delay with exponential backoff and jitter
|
|
374
|
+
let delay = oauthError.retryAfterMs ||
|
|
375
|
+
Math.min(this.config.baseDelayMs *
|
|
376
|
+
Math.pow(this.config.backoffMultiplier, attempt - 1), this.config.maxDelayMs);
|
|
377
|
+
if (this.config.jitter) {
|
|
378
|
+
delay = delay * (0.5 + Math.random() * 0.5); // 50-100% of calculated delay
|
|
379
|
+
}
|
|
380
|
+
console.debug(`${provider} operation failed (attempt ${attempt}/${this.config.maxAttempts}), retrying in ${delay}ms...`);
|
|
381
|
+
await this.sleep(delay);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// All retries exhausted
|
|
385
|
+
throw (lastError ||
|
|
386
|
+
OAuthErrorFactory.fromUnknown(provider, new Error('Max retries exceeded'), context));
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Sleep utility
|
|
390
|
+
*/
|
|
391
|
+
sleep(ms) {
|
|
392
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Graceful error handler for OAuth operations
|
|
397
|
+
*/
|
|
398
|
+
export class GracefulErrorHandler {
|
|
399
|
+
retryHandler;
|
|
400
|
+
constructor(retryHandler = new RetryHandler()) {
|
|
401
|
+
this.retryHandler = retryHandler;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Handles errors gracefully, providing fallback behavior when possible
|
|
405
|
+
*/
|
|
406
|
+
async handleGracefully(operation, fallback, provider, context) {
|
|
407
|
+
try {
|
|
408
|
+
return await this.retryHandler.executeWithRetry(operation, provider, context);
|
|
409
|
+
}
|
|
410
|
+
catch (error) {
|
|
411
|
+
const oauthError = error instanceof OAuthError
|
|
412
|
+
? error
|
|
413
|
+
: OAuthErrorFactory.fromUnknown(provider, error, context);
|
|
414
|
+
// Log the error for debugging
|
|
415
|
+
console.debug('OAuth operation failed gracefully:', oauthError.toLogEntry());
|
|
416
|
+
// Critical errors should not be handled gracefully
|
|
417
|
+
if (oauthError.category === OAuthErrorCategory.CRITICAL) {
|
|
418
|
+
throw oauthError;
|
|
419
|
+
}
|
|
420
|
+
// Return fallback for non-critical errors
|
|
421
|
+
if (typeof fallback === 'function') {
|
|
422
|
+
return await fallback();
|
|
423
|
+
}
|
|
424
|
+
return fallback;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Wraps a method to handle errors gracefully with logging
|
|
429
|
+
*/
|
|
430
|
+
wrapMethod(method, provider, methodName, fallback) {
|
|
431
|
+
return async (...args) => {
|
|
432
|
+
try {
|
|
433
|
+
return await this.retryHandler.executeWithRetry(() => method(...args), provider, methodName);
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
const oauthError = error instanceof OAuthError
|
|
437
|
+
? error
|
|
438
|
+
: OAuthErrorFactory.fromUnknown(provider, error, methodName);
|
|
439
|
+
// Always show user-friendly error message for user-actionable errors
|
|
440
|
+
if (oauthError.category === OAuthErrorCategory.USER_ACTION_REQUIRED) {
|
|
441
|
+
console.error(oauthError.userMessage);
|
|
442
|
+
if (oauthError.actionRequired) {
|
|
443
|
+
console.error(`Action required: ${oauthError.actionRequired}`);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// Log technical details for debugging
|
|
447
|
+
console.debug(`${provider}.${methodName} failed:`, oauthError.toLogEntry());
|
|
448
|
+
// Use fallback if provided and error is not critical
|
|
449
|
+
if (fallback !== undefined &&
|
|
450
|
+
oauthError.category !== OAuthErrorCategory.CRITICAL) {
|
|
451
|
+
if (typeof fallback === 'function') {
|
|
452
|
+
return await fallback(...args);
|
|
453
|
+
}
|
|
454
|
+
return fallback;
|
|
455
|
+
}
|
|
456
|
+
throw oauthError;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
//# sourceMappingURL=oauth-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-errors.js","sourceRoot":"","sources":["../../../src/auth/oauth-errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,iEAAiE;IACjE,mEAA6C,CAAA;IAC7C,8DAA8D;IAC9D,6CAAuB,CAAA;IACvB,yDAAyD;IACzD,uCAAiB,CAAA;IACjB,kDAAkD;IAClD,2CAAqB,CAAA;IACrB,sCAAsC;IACtC,qDAA+B,CAAA;AACjC,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cA8BX;AA9BD,WAAY,cAAc;IACxB,yBAAyB;IACzB,qEAAmD,CAAA;IACnD,iEAA+C,CAAA;IAC/C,uEAAqD,CAAA;IACrD,mDAAiC,CAAA;IACjC,6DAA2C,CAAA;IAE3C,mBAAmB;IACnB,iDAA+B,CAAA;IAC/B,6DAA2C,CAAA;IAC3C,+CAA6B,CAAA;IAC7B,qCAAmB,CAAA;IAEnB,gBAAgB;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apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
export interface AuthPrecedenceConfig {
|
|
7
|
-
commandKey?: string;
|
|
8
|
-
commandKeyfile?: string;
|
|
9
|
-
cliKey?: string;
|
|
10
|
-
cliKeyfile?: string;
|
|
11
7
|
envKeyNames?: string[];
|
|
12
8
|
isOAuthEnabled?: boolean;
|
|
13
9
|
supportsOAuth?: boolean;
|