opencode-puter-auth 1.0.38 → 1.0.41
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 +194 -0
- package/dist/account-rotation.d.ts +243 -0
- package/dist/account-rotation.d.ts.map +1 -0
- package/dist/account-rotation.js +431 -0
- package/dist/account-rotation.js.map +1 -0
- package/dist/ai-provider/puter-chat-language-model.d.ts +19 -0
- package/dist/ai-provider/puter-chat-language-model.d.ts.map +1 -1
- package/dist/ai-provider/puter-chat-language-model.js +85 -8
- package/dist/ai-provider/puter-chat-language-model.js.map +1 -1
- package/dist/ai-provider/puter-chat-settings.d.ts +18 -0
- package/dist/ai-provider/puter-chat-settings.d.ts.map +1 -1
- package/dist/ai-provider/puter-provider.d.ts.map +1 -1
- package/dist/ai-provider/puter-provider.js +1 -0
- package/dist/ai-provider/puter-provider.js.map +1 -1
- package/dist/auth.d.ts +166 -18
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +167 -20
- package/dist/auth.js.map +1 -1
- package/dist/fallback.d.ts +200 -0
- package/dist/fallback.d.ts.map +1 -0
- package/dist/fallback.js +380 -0
- package/dist/fallback.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Puter Authentication Manager
|
|
3
3
|
*
|
|
4
|
-
* Handles OAuth authentication with Puter.com via browser popup
|
|
4
|
+
* Handles OAuth authentication with Puter.com via browser popup.
|
|
5
|
+
* Supports multiple accounts with automatic persistence and seamless switching.
|
|
6
|
+
*
|
|
7
|
+
* Authentication Flow:
|
|
8
|
+
* 1. Start local HTTP server to serve auth HTML and receive callback
|
|
9
|
+
* 2. Open browser to the local server serving Puter SDK auth page
|
|
10
|
+
* 3. User signs in via Puter popup (puter.auth.signIn())
|
|
11
|
+
* 4. Page redirects to /callback with token and username
|
|
12
|
+
* 5. Token is stored locally and server shuts down
|
|
5
13
|
*
|
|
6
14
|
* IMPORTANT: Puter uses popup-based auth (puter.auth.signIn()) which returns a token.
|
|
7
15
|
* For CLI tools, we serve an HTML page that handles the popup auth flow,
|
|
8
16
|
* then redirects to our local callback with the token.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { createPuterAuthManager } from 'opencode-puter-auth';
|
|
21
|
+
*
|
|
22
|
+
* const authManager = createPuterAuthManager('~/.config/opencode');
|
|
23
|
+
* await authManager.init();
|
|
24
|
+
*
|
|
25
|
+
* if (!authManager.isAuthenticated()) {
|
|
26
|
+
* const result = await authManager.login();
|
|
27
|
+
* if (result.success) {
|
|
28
|
+
* console.log('Logged in as:', result.account?.username);
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* const account = authManager.getActiveAccount();
|
|
33
|
+
* console.log('Token:', account?.authToken);
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @module auth
|
|
9
37
|
*/
|
|
10
38
|
import { promises as fs } from 'node:fs';
|
|
11
39
|
import path from 'node:path';
|
|
@@ -13,8 +41,10 @@ import http from 'node:http';
|
|
|
13
41
|
import { URL } from 'node:url';
|
|
14
42
|
import { PuterAccountsStorageSchema } from './types.js';
|
|
15
43
|
import { createLoggerFromConfig } from './logger.js';
|
|
44
|
+
/** Default port for the local OAuth callback server */
|
|
16
45
|
const DEFAULT_CALLBACK_PORT = 19847;
|
|
17
|
-
|
|
46
|
+
/** Authentication timeout duration (5 minutes) */
|
|
47
|
+
const AUTH_TIMEOUT_MS = 300000;
|
|
18
48
|
/**
|
|
19
49
|
* HTML page that handles Puter popup auth flow
|
|
20
50
|
* This page loads the Puter SDK, triggers signIn(), and redirects to our callback
|
|
@@ -94,7 +124,7 @@ const getAuthHtml = (callbackUrl) => `
|
|
|
94
124
|
<div class="card">
|
|
95
125
|
<div class="logo">🟣</div>
|
|
96
126
|
<h1>Connect to Puter</h1>
|
|
97
|
-
<p class="subtitle">
|
|
127
|
+
<p class="subtitle">Access Claude, GPT-5, Gemini and 500+ AI models through Puter.com</p>
|
|
98
128
|
|
|
99
129
|
<div id="status" class="status loading">Initializing Puter SDK...</div>
|
|
100
130
|
|
|
@@ -106,7 +136,7 @@ const getAuthHtml = (callbackUrl) => `
|
|
|
106
136
|
<div class="feature"><span class="feature-icon">✓</span> Claude Opus 4.5 & Sonnet 4.5</div>
|
|
107
137
|
<div class="feature"><span class="feature-icon">✓</span> GPT-5.2 & o3-mini</div>
|
|
108
138
|
<div class="feature"><span class="feature-icon">✓</span> Gemini 2.5 Pro (1M context)</div>
|
|
109
|
-
<div class="feature"><span class="feature-icon">✓</span> No
|
|
139
|
+
<div class="feature"><span class="feature-icon">✓</span> No API keys required</div>
|
|
110
140
|
</div>
|
|
111
141
|
</div>
|
|
112
142
|
|
|
@@ -184,20 +214,44 @@ const getAuthHtml = (callbackUrl) => `
|
|
|
184
214
|
</body>
|
|
185
215
|
</html>
|
|
186
216
|
`;
|
|
217
|
+
/**
|
|
218
|
+
* Internal implementation of PuterAuthManager.
|
|
219
|
+
*
|
|
220
|
+
* Not exported directly to avoid OpenCode plugin loader issues.
|
|
221
|
+
* OpenCode iterates through all exports and calls them as functions,
|
|
222
|
+
* which causes "cannot call class without new" errors.
|
|
223
|
+
*
|
|
224
|
+
* Use {@link createPuterAuthManager} factory function instead.
|
|
225
|
+
*/
|
|
187
226
|
// Internal class - not exported to avoid OpenCode plugin loader issues
|
|
188
227
|
// OpenCode iterates through all exports and calls them as functions
|
|
189
228
|
class PuterAuthManagerInternal {
|
|
229
|
+
/** Directory where config files are stored */
|
|
190
230
|
configDir;
|
|
231
|
+
/** Path to the accounts JSON file */
|
|
191
232
|
accountsFile;
|
|
233
|
+
/** In-memory account storage (synced with disk) */
|
|
192
234
|
storage = null;
|
|
235
|
+
/** Logger instance for debugging */
|
|
193
236
|
logger;
|
|
237
|
+
/**
|
|
238
|
+
* Create a new PuterAuthManager instance.
|
|
239
|
+
*
|
|
240
|
+
* @param configDir - Directory to store account data (e.g., ~/.config/opencode)
|
|
241
|
+
* @param config - Optional configuration overrides
|
|
242
|
+
*/
|
|
194
243
|
constructor(configDir, config = {}) {
|
|
195
244
|
this.configDir = configDir;
|
|
196
245
|
this.accountsFile = path.join(configDir, 'puter-accounts.json');
|
|
197
246
|
this.logger = createLoggerFromConfig(config);
|
|
198
247
|
}
|
|
199
248
|
/**
|
|
200
|
-
* Initialize the auth manager and load existing accounts
|
|
249
|
+
* Initialize the auth manager and load existing accounts from disk.
|
|
250
|
+
*
|
|
251
|
+
* Must be called before using other methods. Creates the config
|
|
252
|
+
* directory if it doesn't exist and loads any saved accounts.
|
|
253
|
+
*
|
|
254
|
+
* @throws Error if unable to create config directory
|
|
201
255
|
*/
|
|
202
256
|
async init() {
|
|
203
257
|
this.logger.debug('Initializing auth manager');
|
|
@@ -218,7 +272,8 @@ class PuterAuthManagerInternal {
|
|
|
218
272
|
}
|
|
219
273
|
}
|
|
220
274
|
/**
|
|
221
|
-
* Load accounts from
|
|
275
|
+
* Load accounts from the persisted JSON file.
|
|
276
|
+
* If file doesn't exist or is invalid, initializes with empty storage.
|
|
222
277
|
*/
|
|
223
278
|
async loadAccounts() {
|
|
224
279
|
try {
|
|
@@ -236,7 +291,8 @@ class PuterAuthManagerInternal {
|
|
|
236
291
|
}
|
|
237
292
|
}
|
|
238
293
|
/**
|
|
239
|
-
*
|
|
294
|
+
* Persist current account storage to disk.
|
|
295
|
+
* Called automatically after any account modification.
|
|
240
296
|
*/
|
|
241
297
|
async saveAccounts() {
|
|
242
298
|
if (!this.storage)
|
|
@@ -245,7 +301,12 @@ class PuterAuthManagerInternal {
|
|
|
245
301
|
await fs.writeFile(this.accountsFile, data, 'utf-8');
|
|
246
302
|
}
|
|
247
303
|
/**
|
|
248
|
-
* Get the active account
|
|
304
|
+
* Get the currently active Puter account.
|
|
305
|
+
*
|
|
306
|
+
* The active account is used for all API calls. Use {@link switchAccount}
|
|
307
|
+
* to change which account is active.
|
|
308
|
+
*
|
|
309
|
+
* @returns The active account, or null if not authenticated
|
|
249
310
|
*/
|
|
250
311
|
getActiveAccount() {
|
|
251
312
|
if (!this.storage || this.storage.accounts.length === 0) {
|
|
@@ -254,22 +315,47 @@ class PuterAuthManagerInternal {
|
|
|
254
315
|
return this.storage.accounts[this.storage.activeIndex] || null;
|
|
255
316
|
}
|
|
256
317
|
/**
|
|
257
|
-
* Get all accounts
|
|
318
|
+
* Get all stored Puter accounts.
|
|
319
|
+
*
|
|
320
|
+
* Useful for displaying account selection UI or implementing
|
|
321
|
+
* account rotation when rate limits are hit.
|
|
322
|
+
*
|
|
323
|
+
* @returns Array of all accounts (may be empty)
|
|
258
324
|
*/
|
|
259
325
|
getAllAccounts() {
|
|
260
326
|
return this.storage?.accounts || [];
|
|
261
327
|
}
|
|
262
328
|
/**
|
|
263
|
-
* Check if
|
|
329
|
+
* Check if there is at least one authenticated account.
|
|
330
|
+
*
|
|
331
|
+
* @returns true if at least one account is available
|
|
264
332
|
*/
|
|
265
333
|
isAuthenticated() {
|
|
266
334
|
return this.getActiveAccount() !== null;
|
|
267
335
|
}
|
|
268
336
|
/**
|
|
269
|
-
* Start the OAuth flow
|
|
337
|
+
* Start the OAuth flow by opening a browser for Puter authentication.
|
|
270
338
|
*
|
|
271
|
-
* This
|
|
272
|
-
*
|
|
339
|
+
* This method:
|
|
340
|
+
* 1. Starts a local HTTP server on port 19847
|
|
341
|
+
* 2. Opens the browser to serve the Puter SDK auth page
|
|
342
|
+
* 3. Waits for the user to complete sign-in via Puter popup
|
|
343
|
+
* 4. Receives the token via redirect to /callback
|
|
344
|
+
* 5. Stores the account and shuts down the server
|
|
345
|
+
*
|
|
346
|
+
* The browser window can be closed after successful authentication.
|
|
347
|
+
*
|
|
348
|
+
* @returns Authentication result with success status and account details
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```ts
|
|
352
|
+
* const result = await authManager.login();
|
|
353
|
+
* if (result.success) {
|
|
354
|
+
* console.log('Authenticated as:', result.account?.username);
|
|
355
|
+
* } else {
|
|
356
|
+
* console.error('Auth failed:', result.error);
|
|
357
|
+
* }
|
|
358
|
+
* ```
|
|
273
359
|
*/
|
|
274
360
|
async login() {
|
|
275
361
|
return new Promise((resolve) => {
|
|
@@ -374,7 +460,22 @@ class PuterAuthManagerInternal {
|
|
|
374
460
|
});
|
|
375
461
|
}
|
|
376
462
|
/**
|
|
377
|
-
* Add a new account
|
|
463
|
+
* Add a new account or update an existing one.
|
|
464
|
+
*
|
|
465
|
+
* If an account with the same username exists, it will be updated
|
|
466
|
+
* with the new token. The added/updated account becomes the active account.
|
|
467
|
+
*
|
|
468
|
+
* @param account - The account to add or update
|
|
469
|
+
*
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* await authManager.addAccount({
|
|
473
|
+
* username: 'john_doe',
|
|
474
|
+
* authToken: 'puter-token-xyz',
|
|
475
|
+
* addedAt: Date.now(),
|
|
476
|
+
* isTemporary: false,
|
|
477
|
+
* });
|
|
478
|
+
* ```
|
|
378
479
|
*/
|
|
379
480
|
async addAccount(account) {
|
|
380
481
|
if (!this.storage) {
|
|
@@ -397,7 +498,21 @@ class PuterAuthManagerInternal {
|
|
|
397
498
|
await this.saveAccounts();
|
|
398
499
|
}
|
|
399
500
|
/**
|
|
400
|
-
* Switch to a different account
|
|
501
|
+
* Switch to a different account by index.
|
|
502
|
+
*
|
|
503
|
+
* The index corresponds to the account's position in {@link getAllAccounts}.
|
|
504
|
+
* The switched account becomes the active account for all API calls.
|
|
505
|
+
*
|
|
506
|
+
* @param index - Zero-based index of the account to switch to
|
|
507
|
+
* @returns true if switch was successful, false if index is invalid
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```ts
|
|
511
|
+
* const accounts = authManager.getAllAccounts();
|
|
512
|
+
* if (accounts.length > 1) {
|
|
513
|
+
* await authManager.switchAccount(1); // Switch to second account
|
|
514
|
+
* }
|
|
515
|
+
* ```
|
|
401
516
|
*/
|
|
402
517
|
async switchAccount(index) {
|
|
403
518
|
if (!this.storage || index < 0 || index >= this.storage.accounts.length) {
|
|
@@ -411,7 +526,13 @@ class PuterAuthManagerInternal {
|
|
|
411
526
|
return true;
|
|
412
527
|
}
|
|
413
528
|
/**
|
|
414
|
-
* Remove an account
|
|
529
|
+
* Remove an account by index.
|
|
530
|
+
*
|
|
531
|
+
* If the removed account was active, the active index is adjusted
|
|
532
|
+
* to point to the previous account (or first if none remain).
|
|
533
|
+
*
|
|
534
|
+
* @param index - Zero-based index of the account to remove
|
|
535
|
+
* @returns true if removal was successful, false if index is invalid
|
|
415
536
|
*/
|
|
416
537
|
async removeAccount(index) {
|
|
417
538
|
if (!this.storage || index < 0 || index >= this.storage.accounts.length) {
|
|
@@ -428,7 +549,10 @@ class PuterAuthManagerInternal {
|
|
|
428
549
|
return true;
|
|
429
550
|
}
|
|
430
551
|
/**
|
|
431
|
-
* Update the
|
|
552
|
+
* Update the lastUsed timestamp for the active account.
|
|
553
|
+
*
|
|
554
|
+
* Called automatically by PuterClient after successful API calls.
|
|
555
|
+
* Useful for implementing least-recently-used account rotation.
|
|
432
556
|
*/
|
|
433
557
|
async touchActiveAccount() {
|
|
434
558
|
const account = this.getActiveAccount();
|
|
@@ -438,7 +562,10 @@ class PuterAuthManagerInternal {
|
|
|
438
562
|
}
|
|
439
563
|
}
|
|
440
564
|
/**
|
|
441
|
-
* Logout
|
|
565
|
+
* Logout and remove all stored accounts.
|
|
566
|
+
*
|
|
567
|
+
* This clears all account data from memory and disk.
|
|
568
|
+
* A new login will be required to use the plugin.
|
|
442
569
|
*/
|
|
443
570
|
async logout() {
|
|
444
571
|
this.logger.auth('Logging out', 'all accounts');
|
|
@@ -451,8 +578,28 @@ class PuterAuthManagerInternal {
|
|
|
451
578
|
}
|
|
452
579
|
}
|
|
453
580
|
/**
|
|
454
|
-
* Factory function to create a PuterAuthManager instance
|
|
455
|
-
*
|
|
581
|
+
* Factory function to create a PuterAuthManager instance.
|
|
582
|
+
*
|
|
583
|
+
* This is the recommended way to create an auth manager.
|
|
584
|
+
* Direct class instantiation is not exposed to avoid plugin loader issues.
|
|
585
|
+
*
|
|
586
|
+
* @param configDir - Directory to store account data (e.g., ~/.config/opencode)
|
|
587
|
+
* @param config - Optional configuration overrides
|
|
588
|
+
* @returns A new PuterAuthManager instance (call .init() before use)
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts
|
|
592
|
+
* import { createPuterAuthManager } from 'opencode-puter-auth';
|
|
593
|
+
*
|
|
594
|
+
* const authManager = createPuterAuthManager('~/.config/my-app');
|
|
595
|
+
* await authManager.init();
|
|
596
|
+
*
|
|
597
|
+
* if (!authManager.isAuthenticated()) {
|
|
598
|
+
* await authManager.login();
|
|
599
|
+
* }
|
|
600
|
+
*
|
|
601
|
+
* const token = authManager.getActiveAccount()?.authToken;
|
|
602
|
+
* ```
|
|
456
603
|
*/
|
|
457
604
|
export function createPuterAuthManager(configDir, config = {}) {
|
|
458
605
|
return new PuterAuthManagerInternal(configDir, config);
|
package/dist/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAA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CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,kBAAkB;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxC,IAAI,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC5B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC9B,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,GAAG;YACb,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,CAAC;SACf,CAAC;QACF,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IAC5B,CAAC;CACF;AAUD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,SAA+B,EAAE;IACzF,OAAO,IAAI,wBAAwB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback Manager for opencode-puter-auth
|
|
3
|
+
*
|
|
4
|
+
* Provides automatic model fallback when rate limits are encountered.
|
|
5
|
+
* When a model returns a rate limit error (429/403), the manager:
|
|
6
|
+
* 1. Adds the model to a cooldown list
|
|
7
|
+
* 2. Tries alternative free models in order
|
|
8
|
+
* 3. Returns to the original model after cooldown expires
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const manager = new FallbackManager({
|
|
13
|
+
* fallbackModels: ['openrouter:xiaomi/mimo-v2-flash:free'],
|
|
14
|
+
* cooldownMs: 60000,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* const result = await manager.executeWithFallback(
|
|
18
|
+
* 'claude-opus-4-5',
|
|
19
|
+
* async (model) => puter.ai.chat(messages, { model }),
|
|
20
|
+
* logger
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* if (result.wasFallback) {
|
|
24
|
+
* console.log(`Used fallback model: ${result.usedModel}`);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
import type { Logger } from './logger.js';
|
|
29
|
+
/**
|
|
30
|
+
* Default fallback models - FREE OpenRouter models via Puter gateway.
|
|
31
|
+
* Ordered by quality/capability (best first).
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_FALLBACK_MODELS: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Default cooldown duration in milliseconds (60 seconds)
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_COOLDOWN_MS = 60000;
|
|
38
|
+
/**
|
|
39
|
+
* Configuration options for FallbackManager
|
|
40
|
+
*/
|
|
41
|
+
export interface FallbackOptions {
|
|
42
|
+
/** List of fallback models to try when primary fails */
|
|
43
|
+
fallbackModels?: string[];
|
|
44
|
+
/** Cooldown duration in milliseconds */
|
|
45
|
+
cooldownMs?: number;
|
|
46
|
+
/** Whether fallback is enabled */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Record of a single model attempt
|
|
51
|
+
*/
|
|
52
|
+
export interface FallbackAttempt {
|
|
53
|
+
/** Model that was tried */
|
|
54
|
+
model: string;
|
|
55
|
+
/** Whether the attempt succeeded */
|
|
56
|
+
success: boolean;
|
|
57
|
+
/** Error message if failed */
|
|
58
|
+
error?: string;
|
|
59
|
+
/** Whether the error was a rate limit */
|
|
60
|
+
isRateLimit?: boolean;
|
|
61
|
+
/** Duration of the attempt in ms */
|
|
62
|
+
durationMs?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Result of executeWithFallback
|
|
66
|
+
*/
|
|
67
|
+
export interface FallbackResult<T> {
|
|
68
|
+
/** The result from the successful model */
|
|
69
|
+
result: T;
|
|
70
|
+
/** The model that was actually used */
|
|
71
|
+
usedModel: string;
|
|
72
|
+
/** Whether a fallback model was used instead of the primary */
|
|
73
|
+
wasFallback: boolean;
|
|
74
|
+
/** All attempts made (for debugging/logging) */
|
|
75
|
+
attempts: FallbackAttempt[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Error thrown when all models (primary + fallbacks) have failed
|
|
79
|
+
*/
|
|
80
|
+
export declare class FallbackExhaustedError extends Error {
|
|
81
|
+
readonly attempts: FallbackAttempt[];
|
|
82
|
+
constructor(attempts: FallbackAttempt[]);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if an error indicates a rate limit
|
|
86
|
+
*
|
|
87
|
+
* Detects various rate limit error patterns from different providers:
|
|
88
|
+
* - HTTP 429 (Too Many Requests)
|
|
89
|
+
* - HTTP 403 (Forbidden) - Puter uses this for account limits
|
|
90
|
+
* - Various error message patterns
|
|
91
|
+
*
|
|
92
|
+
* @param error - The error to check
|
|
93
|
+
* @returns true if the error is a rate limit error
|
|
94
|
+
*/
|
|
95
|
+
export declare function isRateLimitError(error: unknown): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Manages automatic model fallback when rate limits are encountered.
|
|
98
|
+
*
|
|
99
|
+
* This is a singleton-style class designed to be shared across all
|
|
100
|
+
* PuterChatLanguageModel instances so cooldown state is consistent.
|
|
101
|
+
*/
|
|
102
|
+
export declare class FallbackManager {
|
|
103
|
+
private cooldownMap;
|
|
104
|
+
private fallbackModels;
|
|
105
|
+
private cooldownMs;
|
|
106
|
+
private enabled;
|
|
107
|
+
constructor(options?: FallbackOptions);
|
|
108
|
+
/**
|
|
109
|
+
* Check if a model is currently on cooldown
|
|
110
|
+
*
|
|
111
|
+
* @param model - Model ID to check
|
|
112
|
+
* @returns true if the model is on cooldown
|
|
113
|
+
*/
|
|
114
|
+
isModelOnCooldown(model: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Get remaining cooldown time for a model in milliseconds
|
|
117
|
+
*
|
|
118
|
+
* @param model - Model ID to check
|
|
119
|
+
* @returns Remaining cooldown in ms, or 0 if not on cooldown
|
|
120
|
+
*/
|
|
121
|
+
getCooldownRemaining(model: string): number;
|
|
122
|
+
/**
|
|
123
|
+
* Add a model to the cooldown list
|
|
124
|
+
*
|
|
125
|
+
* @param model - Model ID to add to cooldown
|
|
126
|
+
* @param reason - Reason for the cooldown (e.g., error message)
|
|
127
|
+
* @param durationMs - Optional custom cooldown duration
|
|
128
|
+
*/
|
|
129
|
+
addToCooldown(model: string, reason: string, durationMs?: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Remove a model from cooldown (e.g., if it's working again)
|
|
132
|
+
*
|
|
133
|
+
* @param model - Model ID to remove from cooldown
|
|
134
|
+
*/
|
|
135
|
+
removeFromCooldown(model: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* Get all models currently on cooldown
|
|
138
|
+
*
|
|
139
|
+
* @returns Map of model IDs to their cooldown info
|
|
140
|
+
*/
|
|
141
|
+
getCooldownStatus(): Map<string, {
|
|
142
|
+
remainingMs: number;
|
|
143
|
+
reason: string;
|
|
144
|
+
}>;
|
|
145
|
+
/**
|
|
146
|
+
* Build the queue of models to try, respecting cooldowns
|
|
147
|
+
*
|
|
148
|
+
* @param primaryModel - The primary model requested
|
|
149
|
+
* @returns Ordered array of models to try
|
|
150
|
+
*/
|
|
151
|
+
buildModelQueue(primaryModel: string): string[];
|
|
152
|
+
/**
|
|
153
|
+
* Execute an operation with automatic model fallback
|
|
154
|
+
*
|
|
155
|
+
* Tries the primary model first, and if it fails with a rate limit error,
|
|
156
|
+
* automatically tries fallback models in order.
|
|
157
|
+
*
|
|
158
|
+
* @param primaryModel - The primary model to try first
|
|
159
|
+
* @param operation - Function that performs the API call with the given model
|
|
160
|
+
* @param logger - Optional logger for debugging
|
|
161
|
+
* @returns Result including which model was used and all attempts
|
|
162
|
+
* @throws FallbackExhaustedError if all models fail
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* const result = await manager.executeWithFallback(
|
|
167
|
+
* 'claude-opus-4-5',
|
|
168
|
+
* async (model) => {
|
|
169
|
+
* return await puter.ai.chat(messages, { model });
|
|
170
|
+
* },
|
|
171
|
+
* logger
|
|
172
|
+
* );
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
executeWithFallback<T>(primaryModel: string, operation: (model: string) => Promise<T>, logger?: Logger): Promise<FallbackResult<T>>;
|
|
176
|
+
/**
|
|
177
|
+
* Clear all cooldowns (useful for testing or manual reset)
|
|
178
|
+
*/
|
|
179
|
+
clearCooldowns(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Update configuration
|
|
182
|
+
*/
|
|
183
|
+
configure(options: Partial<FallbackOptions>): void;
|
|
184
|
+
/**
|
|
185
|
+
* Get current configuration
|
|
186
|
+
*/
|
|
187
|
+
getConfig(): Required<FallbackOptions>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get the global FallbackManager instance, creating it if needed
|
|
191
|
+
*
|
|
192
|
+
* @param options - Configuration options (only used when creating)
|
|
193
|
+
* @returns The global FallbackManager instance
|
|
194
|
+
*/
|
|
195
|
+
export declare function getGlobalFallbackManager(options?: FallbackOptions): FallbackManager;
|
|
196
|
+
/**
|
|
197
|
+
* Reset the global FallbackManager (useful for testing)
|
|
198
|
+
*/
|
|
199
|
+
export declare function resetGlobalFallbackManager(): void;
|
|
200
|
+
//# sourceMappingURL=fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../src/fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,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