opencode-puter-auth 1.0.1 → 1.0.3
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/README.md +29 -3
- package/dist/ai-provider/index.d.ts +28 -0
- package/dist/ai-provider/index.d.ts.map +1 -0
- package/dist/ai-provider/index.js +28 -0
- package/dist/ai-provider/index.js.map +1 -0
- package/dist/ai-provider/puter-chat-language-model.d.ts +53 -0
- package/dist/ai-provider/puter-chat-language-model.d.ts.map +1 -0
- package/dist/ai-provider/puter-chat-language-model.js +405 -0
- package/dist/ai-provider/puter-chat-language-model.js.map +1 -0
- package/dist/ai-provider/puter-chat-settings.d.ts +106 -0
- package/dist/ai-provider/puter-chat-settings.d.ts.map +1 -0
- package/dist/ai-provider/puter-chat-settings.js +7 -0
- package/dist/ai-provider/puter-chat-settings.js.map +1 -0
- package/dist/ai-provider/puter-provider.d.ts +58 -0
- package/dist/ai-provider/puter-provider.d.ts.map +1 -0
- package/dist/ai-provider/puter-provider.js +149 -0
- package/dist/ai-provider/puter-provider.js.map +1 -0
- package/dist/client.d.ts +71 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +159 -66
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +18 -4
- package/dist/plugin.js.map +1 -1
- package/dist/provider.d.ts +228 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +611 -0
- package/dist/provider.js.map +1 -0
- package/dist/retry.d.ts +103 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +175 -0
- package/dist/retry.js.map +1 -0
- package/package.json +3 -1
package/dist/retry.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry utilities with exponential backoff and jitter
|
|
3
|
+
*
|
|
4
|
+
* Provides robust retry logic for handling transient failures
|
|
5
|
+
* in API calls to Puter.com
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for retry behavior
|
|
9
|
+
*/
|
|
10
|
+
export interface RetryOptions {
|
|
11
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
/** Initial delay in milliseconds (default: 1000) */
|
|
14
|
+
initialDelay?: number;
|
|
15
|
+
/** Maximum delay in milliseconds (default: 30000) */
|
|
16
|
+
maxDelay?: number;
|
|
17
|
+
/** Backoff multiplier (default: 2) */
|
|
18
|
+
backoffFactor?: number;
|
|
19
|
+
/** Add random jitter to delays (default: true) */
|
|
20
|
+
jitter?: boolean;
|
|
21
|
+
/** HTTP status codes that should trigger a retry (default: [429, 500, 502, 503, 504]) */
|
|
22
|
+
retryableStatuses?: number[];
|
|
23
|
+
/** Callback called before each retry attempt */
|
|
24
|
+
onRetry?: (attempt: number, error: Error, delay: number) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Error class for retry-related failures
|
|
28
|
+
*/
|
|
29
|
+
export declare class RetryError extends Error {
|
|
30
|
+
readonly attempts: number;
|
|
31
|
+
readonly lastError: Error;
|
|
32
|
+
constructor(message: string, attempts: number, lastError: Error);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Calculate delay with exponential backoff and optional jitter
|
|
36
|
+
*
|
|
37
|
+
* @param attempt - Current attempt number (0-indexed)
|
|
38
|
+
* @param options - Retry options
|
|
39
|
+
* @returns Delay in milliseconds
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* // Attempt 0: ~1000ms
|
|
44
|
+
* // Attempt 1: ~2000ms
|
|
45
|
+
* // Attempt 2: ~4000ms
|
|
46
|
+
* const delay = calculateDelay(2, { initialDelay: 1000, backoffFactor: 2 });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function calculateDelay(attempt: number, options?: Pick<RetryOptions, 'initialDelay' | 'maxDelay' | 'backoffFactor' | 'jitter'>): number;
|
|
50
|
+
/**
|
|
51
|
+
* Sleep for a specified duration
|
|
52
|
+
*
|
|
53
|
+
* @param ms - Duration in milliseconds
|
|
54
|
+
* @returns Promise that resolves after the delay
|
|
55
|
+
*/
|
|
56
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Check if an error is retryable based on HTTP status
|
|
59
|
+
*
|
|
60
|
+
* @param error - The error to check
|
|
61
|
+
* @param retryableStatuses - List of HTTP status codes that should trigger retry
|
|
62
|
+
* @returns true if the error should trigger a retry
|
|
63
|
+
*/
|
|
64
|
+
export declare function isRetryableError(error: unknown, retryableStatuses?: number[]): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Execute an async operation with retry logic
|
|
67
|
+
*
|
|
68
|
+
* Uses exponential backoff with jitter to handle transient failures.
|
|
69
|
+
* Only retries on specific error conditions (rate limits, server errors, network issues).
|
|
70
|
+
*
|
|
71
|
+
* @param operation - Async function to execute
|
|
72
|
+
* @param options - Retry configuration options
|
|
73
|
+
* @returns Result of the operation
|
|
74
|
+
* @throws RetryError if all retry attempts fail
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const result = await withRetry(
|
|
79
|
+
* () => fetch('https://api.example.com/data'),
|
|
80
|
+
* {
|
|
81
|
+
* maxRetries: 3,
|
|
82
|
+
* onRetry: (attempt, error, delay) => {
|
|
83
|
+
* console.log(`Retry ${attempt} after ${delay}ms: ${error.message}`);
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
* );
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function withRetry<T>(operation: () => Promise<T>, options?: RetryOptions): Promise<T>;
|
|
90
|
+
/**
|
|
91
|
+
* Create a fetch wrapper with built-in retry logic
|
|
92
|
+
*
|
|
93
|
+
* @param options - Retry configuration options
|
|
94
|
+
* @returns A fetch function with retry capabilities
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const fetchWithRetry = createRetryFetch({ maxRetries: 3 });
|
|
99
|
+
* const response = await fetchWithRetry('https://api.example.com/data');
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function createRetryFetch(options?: RetryOptions): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
103
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,KAAK,CAAC;gBAErB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK;CAMhE;AAcD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,UAAU,GAAG,eAAe,GAAG,QAAQ,CAAM,GACzF,MAAM,CAsBR;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,iBAAiB,GAAE,MAAM,EAA4C,GACpE,OAAO,CA0BT;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,CAAC,CAAC,CA8CZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,YAAiB,IAEvD,OAAO,WAAW,GAAG,GAAG,EACxB,OAAO,WAAW,KACjB,OAAO,CAAC,QAAQ,CAAC,CAarB"}
|
package/dist/retry.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry utilities with exponential backoff and jitter
|
|
3
|
+
*
|
|
4
|
+
* Provides robust retry logic for handling transient failures
|
|
5
|
+
* in API calls to Puter.com
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Error class for retry-related failures
|
|
9
|
+
*/
|
|
10
|
+
export class RetryError extends Error {
|
|
11
|
+
attempts;
|
|
12
|
+
lastError;
|
|
13
|
+
constructor(message, attempts, lastError) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'RetryError';
|
|
16
|
+
this.attempts = attempts;
|
|
17
|
+
this.lastError = lastError;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Default retry options
|
|
22
|
+
*/
|
|
23
|
+
const DEFAULT_RETRY_OPTIONS = {
|
|
24
|
+
maxRetries: 3,
|
|
25
|
+
initialDelay: 1000,
|
|
26
|
+
maxDelay: 30000,
|
|
27
|
+
backoffFactor: 2,
|
|
28
|
+
jitter: true,
|
|
29
|
+
retryableStatuses: [429, 500, 502, 503, 504],
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Calculate delay with exponential backoff and optional jitter
|
|
33
|
+
*
|
|
34
|
+
* @param attempt - Current attempt number (0-indexed)
|
|
35
|
+
* @param options - Retry options
|
|
36
|
+
* @returns Delay in milliseconds
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* // Attempt 0: ~1000ms
|
|
41
|
+
* // Attempt 1: ~2000ms
|
|
42
|
+
* // Attempt 2: ~4000ms
|
|
43
|
+
* const delay = calculateDelay(2, { initialDelay: 1000, backoffFactor: 2 });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function calculateDelay(attempt, options = {}) {
|
|
47
|
+
const { initialDelay = DEFAULT_RETRY_OPTIONS.initialDelay, maxDelay = DEFAULT_RETRY_OPTIONS.maxDelay, backoffFactor = DEFAULT_RETRY_OPTIONS.backoffFactor, jitter = DEFAULT_RETRY_OPTIONS.jitter, } = options;
|
|
48
|
+
// Calculate base delay with exponential backoff
|
|
49
|
+
const baseDelay = initialDelay * Math.pow(backoffFactor, attempt);
|
|
50
|
+
// Cap at maxDelay
|
|
51
|
+
const cappedDelay = Math.min(baseDelay, maxDelay);
|
|
52
|
+
// Add jitter (±25% randomness) to prevent thundering herd
|
|
53
|
+
if (jitter) {
|
|
54
|
+
const jitterRange = cappedDelay * 0.25;
|
|
55
|
+
const randomJitter = (Math.random() - 0.5) * 2 * jitterRange;
|
|
56
|
+
return Math.max(0, Math.round(cappedDelay + randomJitter));
|
|
57
|
+
}
|
|
58
|
+
return Math.round(cappedDelay);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sleep for a specified duration
|
|
62
|
+
*
|
|
63
|
+
* @param ms - Duration in milliseconds
|
|
64
|
+
* @returns Promise that resolves after the delay
|
|
65
|
+
*/
|
|
66
|
+
export function sleep(ms) {
|
|
67
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check if an error is retryable based on HTTP status
|
|
71
|
+
*
|
|
72
|
+
* @param error - The error to check
|
|
73
|
+
* @param retryableStatuses - List of HTTP status codes that should trigger retry
|
|
74
|
+
* @returns true if the error should trigger a retry
|
|
75
|
+
*/
|
|
76
|
+
export function isRetryableError(error, retryableStatuses = DEFAULT_RETRY_OPTIONS.retryableStatuses) {
|
|
77
|
+
if (error instanceof Error) {
|
|
78
|
+
const message = error.message.toLowerCase();
|
|
79
|
+
// Check for status codes in error message
|
|
80
|
+
for (const status of retryableStatuses) {
|
|
81
|
+
if (message.includes(`(${status})`) || message.includes(`status ${status}`)) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Check for common transient error patterns
|
|
86
|
+
if (message.includes('timeout') ||
|
|
87
|
+
message.includes('econnreset') ||
|
|
88
|
+
message.includes('econnrefused') ||
|
|
89
|
+
message.includes('network') ||
|
|
90
|
+
message.includes('socket hang up') ||
|
|
91
|
+
message.includes('rate limit') ||
|
|
92
|
+
message.includes('too many requests')) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Execute an async operation with retry logic
|
|
100
|
+
*
|
|
101
|
+
* Uses exponential backoff with jitter to handle transient failures.
|
|
102
|
+
* Only retries on specific error conditions (rate limits, server errors, network issues).
|
|
103
|
+
*
|
|
104
|
+
* @param operation - Async function to execute
|
|
105
|
+
* @param options - Retry configuration options
|
|
106
|
+
* @returns Result of the operation
|
|
107
|
+
* @throws RetryError if all retry attempts fail
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const result = await withRetry(
|
|
112
|
+
* () => fetch('https://api.example.com/data'),
|
|
113
|
+
* {
|
|
114
|
+
* maxRetries: 3,
|
|
115
|
+
* onRetry: (attempt, error, delay) => {
|
|
116
|
+
* console.log(`Retry ${attempt} after ${delay}ms: ${error.message}`);
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
* );
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export async function withRetry(operation, options = {}) {
|
|
123
|
+
const { maxRetries = DEFAULT_RETRY_OPTIONS.maxRetries, initialDelay = DEFAULT_RETRY_OPTIONS.initialDelay, maxDelay = DEFAULT_RETRY_OPTIONS.maxDelay, backoffFactor = DEFAULT_RETRY_OPTIONS.backoffFactor, jitter = DEFAULT_RETRY_OPTIONS.jitter, retryableStatuses = DEFAULT_RETRY_OPTIONS.retryableStatuses, onRetry, } = options;
|
|
124
|
+
let lastError = new Error('Unknown error');
|
|
125
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
126
|
+
try {
|
|
127
|
+
return await operation();
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
131
|
+
// Check if we should retry
|
|
132
|
+
const isLastAttempt = attempt === maxRetries;
|
|
133
|
+
const shouldRetry = !isLastAttempt && isRetryableError(error, retryableStatuses);
|
|
134
|
+
if (!shouldRetry) {
|
|
135
|
+
throw lastError;
|
|
136
|
+
}
|
|
137
|
+
// Calculate delay for next attempt
|
|
138
|
+
const delay = calculateDelay(attempt, { initialDelay, maxDelay, backoffFactor, jitter });
|
|
139
|
+
// Call onRetry callback if provided
|
|
140
|
+
if (onRetry) {
|
|
141
|
+
onRetry(attempt + 1, lastError, delay);
|
|
142
|
+
}
|
|
143
|
+
// Wait before retrying
|
|
144
|
+
await sleep(delay);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// This should never be reached, but TypeScript needs it
|
|
148
|
+
throw new RetryError(`Operation failed after ${maxRetries + 1} attempts`, maxRetries + 1, lastError);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Create a fetch wrapper with built-in retry logic
|
|
152
|
+
*
|
|
153
|
+
* @param options - Retry configuration options
|
|
154
|
+
* @returns A fetch function with retry capabilities
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const fetchWithRetry = createRetryFetch({ maxRetries: 3 });
|
|
159
|
+
* const response = await fetchWithRetry('https://api.example.com/data');
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export function createRetryFetch(options = {}) {
|
|
163
|
+
return async function retryFetch(input, init) {
|
|
164
|
+
return withRetry(async () => {
|
|
165
|
+
const response = await fetch(input, init);
|
|
166
|
+
// Check if response status indicates a retryable error
|
|
167
|
+
const retryableStatuses = options.retryableStatuses || DEFAULT_RETRY_OPTIONS.retryableStatuses;
|
|
168
|
+
if (retryableStatuses.includes(response.status)) {
|
|
169
|
+
throw new Error(`HTTP error (${response.status}): ${response.statusText}`);
|
|
170
|
+
}
|
|
171
|
+
return response;
|
|
172
|
+
}, options);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnB,QAAQ,CAAS;IACjB,SAAS,CAAQ;IAEjC,YAAY,OAAe,EAAE,QAAgB,EAAE,SAAgB;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,qBAAqB,GAA4C;IACrE,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,IAAI;IAClB,QAAQ,EAA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B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAE1C,uDAAuD;YACvD,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,qBAAqB,CAAC,iBAAiB,CAAC;YAC/F,IAAI,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChD,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAC7E,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-puter-auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Puter.com OAuth auth plugin for OpenCode - FREE UNLIMITED access to Claude Opus 4.5, Sonnet 4.5, GPT-5, Gemini, and 500+ AI models",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -69,6 +69,8 @@
|
|
|
69
69
|
"vitest": "^4.0.0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
+
"@ai-sdk/provider": "^3.0.3",
|
|
73
|
+
"@ai-sdk/provider-utils": "^4.0.7",
|
|
72
74
|
"open": "^11.0.0",
|
|
73
75
|
"xdg-basedir": "^5.1.0",
|
|
74
76
|
"zod": "^4.3.5"
|