opencode-puter-auth 1.0.44 → 1.0.45

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/cli.js CHANGED
File without changes
package/dist/index.d.ts CHANGED
@@ -9,16 +9,25 @@
9
9
  *
10
10
  * @author chindris-mihai-alexandru
11
11
  * @license MIT
12
+ *
13
+ * IMPORTANT: OpenCode's plugin loader iterates through ALL exports and calls them as functions.
14
+ * This means we can ONLY export functions from the main entry point - no classes, no constants,
15
+ * no objects. Exporting non-functions causes errors like:
16
+ * - Classes: "cannot call class constructor without new"
17
+ * - Constants: "fn3 is not a function (fn3 is 300000)"
18
+ *
19
+ * Users needing other exports (FallbackManager, AccountRotationManager, logger utilities, etc.)
20
+ * should import from submodules:
21
+ * - import { FallbackManager } from 'opencode-puter-auth/fallback'
22
+ * - import { AccountRotationManager } from 'opencode-puter-auth/account-rotation'
23
+ * - import { createLogger } from 'opencode-puter-auth/logger'
12
24
  */
13
25
  export { PuterAuthPlugin } from './plugin.js';
14
26
  export { default } from './ai-provider/index.js';
15
27
  export { createPuter, puter } from './ai-provider/index.js';
16
28
  export type { PuterProvider, PuterChatSettings, PuterProviderConfig, PuterChatConfig } from './ai-provider/index.js';
17
- export { nullLogger, LogLevel } from './logger.js';
18
29
  export type { Logger, LoggerOptions } from './logger.js';
19
- export { getGlobalFallbackManager, resetGlobalFallbackManager, isRateLimitError, DEFAULT_FALLBACK_MODELS, DEFAULT_COOLDOWN_MS, } from './fallback.js';
20
- export type { FallbackOptions, FallbackResult, FallbackAttempt, } from './fallback.js';
21
- export { getGlobalAccountRotationManager, resetGlobalAccountRotationManager, DEFAULT_ACCOUNT_COOLDOWN_MS, } from './account-rotation.js';
22
- export type { AccountRotationOptions, AccountRotationResult, AccountStatus, IAuthManager, } from './account-rotation.js';
30
+ export type { FallbackOptions, FallbackResult, FallbackAttempt } from './fallback.js';
31
+ export type { AccountRotationOptions, AccountRotationResult, AccountStatus, IAuthManager } from './account-rotation.js';
23
32
  export type { PuterConfig, PuterAccount, PuterChatOptions, PuterChatResponse, PuterChatMessage, PuterChatStreamChunk, PuterModelInfo } from './types.js';
24
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAK9C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAOrH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAOzD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,eAAe,CAAC;AAKvB,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG5D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrH,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtF,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACxH,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -9,33 +9,24 @@
9
9
  *
10
10
  * @author chindris-mihai-alexandru
11
11
  * @license MIT
12
+ *
13
+ * IMPORTANT: OpenCode's plugin loader iterates through ALL exports and calls them as functions.
14
+ * This means we can ONLY export functions from the main entry point - no classes, no constants,
15
+ * no objects. Exporting non-functions causes errors like:
16
+ * - Classes: "cannot call class constructor without new"
17
+ * - Constants: "fn3 is not a function (fn3 is 300000)"
18
+ *
19
+ * Users needing other exports (FallbackManager, AccountRotationManager, logger utilities, etc.)
20
+ * should import from submodules:
21
+ * - import { FallbackManager } from 'opencode-puter-auth/fallback'
22
+ * - import { AccountRotationManager } from 'opencode-puter-auth/account-rotation'
23
+ * - import { createLogger } from 'opencode-puter-auth/logger'
12
24
  */
13
25
  // Named export - the plugin function for OpenCode
14
- // IMPORTANT: Only export the plugin function, not classes!
15
- // OpenCode's plugin loader calls all exports as functions, so exporting
16
- // classes (PuterClient, PuterAuthManager) causes "cannot call class without new" errors.
17
- // Using plugin.js (not plugin-simple.js) for full OAuth support - see Issue #13
18
26
  export { PuterAuthPlugin } from './plugin.js';
19
27
  // Default export for OpenCode plugin loader AND AI SDK provider
20
- // OpenCode calls sdk.languageModel(modelId) on the default export,
21
- // so we export the puter provider instance (not createPuter factory)
28
+ // OpenCode calls sdk.languageModel(modelId) on the default export
22
29
  export { default } from './ai-provider/index.js';
23
- // AI SDK Provider exports
30
+ // AI SDK Provider exports - ONLY functions
24
31
  export { createPuter, puter } from './ai-provider/index.js';
25
- // Logger exports for debug mode
26
- // NOTE: createLogger and createLoggerFromConfig are NOT exported from main entry point
27
- // because OpenCode's provider loader finds exports starting with "create" and calls them.
28
- // It would find createLogger before createPuter alphabetically, causing errors.
29
- // Users needing direct logger access can import from the logger module directly.
30
- export { nullLogger, LogLevel } from './logger.js';
31
- // Fallback Manager exports for automatic model fallback
32
- // NOTE: FallbackManager and FallbackExhaustedError classes are NOT exported from main entry point
33
- // because OpenCode's plugin loader calls all exports as functions, causing
34
- // "cannot call class constructor without new" errors.
35
- // Users needing direct class access can import from the fallback module directly.
36
- export { getGlobalFallbackManager, resetGlobalFallbackManager, isRateLimitError, DEFAULT_FALLBACK_MODELS, DEFAULT_COOLDOWN_MS, } from './fallback.js';
37
- // Account Rotation Manager exports for multi-account support
38
- // NOTE: AccountRotationManager and AllAccountsOnCooldownError classes are NOT exported
39
- // from main entry point for the same reason as above.
40
- export { getGlobalAccountRotationManager, resetGlobalAccountRotationManager, DEFAULT_ACCOUNT_COOLDOWN_MS, } from './account-rotation.js';
41
32
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,kDAAkD;AAClD,2DAA2D;AAC3D,wEAAwE;AACxE,yFAAyF;AACzF,gFAAgF;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,gEAAgE;AAChE,mEAAmE;AACnE,qEAAqE;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,0BAA0B;AAC1B,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAG5D,gCAAgC;AAChC,uFAAuF;AACvF,0FAA0F;AAC1F,gFAAgF;AAChF,iFAAiF;AACjF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGnD,wDAAwD;AACxD,kGAAkG;AAClG,2EAA2E;AAC3E,sDAAsD;AACtD,kFAAkF;AAClF,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAOvB,6DAA6D;AAC7D,uFAAuF;AACvF,sDAAsD;AACtD,OAAO,EACL,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,kDAAkD;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,gEAAgE;AAChE,kEAAkE;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-puter-auth",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "Puter.com OAuth plugin for OpenCode - Easy access to Claude, GPT, Gemini & 500+ AI models. No API keys needed, credit-based usage.",
5
5
  "bin": {
6
6
  "puter-auth": "dist/cli.js"