opencode-puter-auth 1.0.44 → 1.0.46
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/ai-provider/puter-provider.d.ts +5 -0
- package/dist/ai-provider/puter-provider.d.ts.map +1 -1
- package/dist/ai-provider/puter-provider.js +21 -1
- package/dist/ai-provider/puter-provider.js.map +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -53,6 +53,11 @@ export declare function createPuter(options?: PuterProviderConfig): PuterProvide
|
|
|
53
53
|
*
|
|
54
54
|
* This is a proxy that lazily creates the provider when first accessed.
|
|
55
55
|
* It requires the PUTER_AUTH_TOKEN environment variable to be set.
|
|
56
|
+
*
|
|
57
|
+
* IMPORTANT: OpenCode's plugin loader iterates through exports and may try to access
|
|
58
|
+
* properties like `.config` expecting a function. We must explicitly return undefined
|
|
59
|
+
* for properties that aren't part of the ProviderV3 interface to avoid leaking
|
|
60
|
+
* internal properties from the underlying provider.
|
|
56
61
|
*/
|
|
57
62
|
export declare const puter: PuterProvider;
|
|
58
63
|
//# sourceMappingURL=puter-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"puter-provider.d.ts","sourceRoot":"","sources":["../../src/ai-provider/puter-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAmB,MAAM,0BAA0B,CAAC;AAExG;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C;;;;OAIG;IACH,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;IAExE;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;IAErF;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;CAC7E;AAYD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,mBAAwB,GAAG,aAAa,CAgH5E;AAkCD
|
|
1
|
+
{"version":3,"file":"puter-provider.d.ts","sourceRoot":"","sources":["../../src/ai-provider/puter-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAmB,MAAM,0BAA0B,CAAC;AAExG;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C;;;;OAIG;IACH,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;IAExE;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;IAErF;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,sBAAsB,CAAC;CAC7E;AAYD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,mBAAwB,GAAG,aAAa,CAgH5E;AAkCD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,EAAE,aAwCnB,CAAC"}
|
|
@@ -154,12 +154,18 @@ function getPuterInstance() {
|
|
|
154
154
|
*
|
|
155
155
|
* This is a proxy that lazily creates the provider when first accessed.
|
|
156
156
|
* It requires the PUTER_AUTH_TOKEN environment variable to be set.
|
|
157
|
+
*
|
|
158
|
+
* IMPORTANT: OpenCode's plugin loader iterates through exports and may try to access
|
|
159
|
+
* properties like `.config` expecting a function. We must explicitly return undefined
|
|
160
|
+
* for properties that aren't part of the ProviderV3 interface to avoid leaking
|
|
161
|
+
* internal properties from the underlying provider.
|
|
157
162
|
*/
|
|
158
163
|
export const puter = new Proxy(function () { }, {
|
|
159
164
|
apply(_target, _thisArg, args) {
|
|
160
165
|
return getPuterInstance()(...args);
|
|
161
166
|
},
|
|
162
167
|
get(_target, prop) {
|
|
168
|
+
// ProviderV3 interface methods
|
|
163
169
|
if (prop === 'languageModel' || prop === 'chat') {
|
|
164
170
|
return (...args) => getPuterInstance()[prop](...args);
|
|
165
171
|
}
|
|
@@ -171,7 +177,21 @@ export const puter = new Proxy(function () { }, {
|
|
|
171
177
|
throw new Error(`Puter does not support ${String(prop).replace('Model', '')} models`);
|
|
172
178
|
};
|
|
173
179
|
}
|
|
174
|
-
return
|
|
180
|
+
// OpenCode plugin loader checks for these - return undefined to avoid errors
|
|
181
|
+
// The loader expects hooks to have .config() method but we're not a hook
|
|
182
|
+
if (prop === 'config' || prop === 'event' || prop === 'auth' || prop === 'tool') {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
// Standard function/object properties that should work normally
|
|
186
|
+
if (prop === 'name' || prop === 'length' || prop === 'prototype' ||
|
|
187
|
+
prop === 'call' || prop === 'apply' || prop === 'bind' ||
|
|
188
|
+
prop === Symbol.toStringTag || prop === Symbol.iterator ||
|
|
189
|
+
prop === 'then' || prop === 'catch' || prop === 'finally') {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
// For any other property, return undefined rather than leaking internal state
|
|
193
|
+
// This prevents errors when OpenCode iterates through exports
|
|
194
|
+
return undefined;
|
|
175
195
|
},
|
|
176
196
|
});
|
|
177
197
|
//# sourceMappingURL=puter-provider.js.map
|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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 {
|
|
20
|
-
export type {
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
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
|
|
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.
|
|
3
|
+
"version": "1.0.46",
|
|
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"
|