opencode-qwen-cli-auth 2.2.9 → 2.3.1
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 +273 -62
- package/README.vi.md +273 -0
- package/dist/index.js +413 -92
- package/dist/lib/auth/auth.d.ts +51 -1
- package/dist/lib/auth/auth.js +738 -3
- package/dist/lib/auth/browser.js +14 -4
- package/dist/lib/config.d.ts +8 -0
- package/dist/lib/config.js +99 -1
- package/dist/lib/constants.js +99 -18
- package/dist/lib/logger.js +58 -12
- package/package.json +1 -1
package/dist/lib/auth/auth.d.ts
CHANGED
|
@@ -38,6 +38,56 @@ export declare function clearStoredToken(): void;
|
|
|
38
38
|
* @param tokenResult - Token result from OAuth flow
|
|
39
39
|
*/
|
|
40
40
|
export declare function saveToken(tokenResult: TokenResult): void;
|
|
41
|
+
/**
|
|
42
|
+
* Upsert OAuth account into ~/.qwen/oauth_accounts.json
|
|
43
|
+
*/
|
|
44
|
+
export declare function upsertOAuthAccount(tokenResult: TokenResult, options?: {
|
|
45
|
+
accountId?: string;
|
|
46
|
+
accountKey?: string;
|
|
47
|
+
setActive?: boolean;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
accountId: string;
|
|
50
|
+
accessToken: string;
|
|
51
|
+
resourceUrl?: string;
|
|
52
|
+
exhaustedUntil: number;
|
|
53
|
+
healthyAccountCount: number;
|
|
54
|
+
totalAccountCount: number;
|
|
55
|
+
} | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Get active OAuth account token from multi-account store
|
|
58
|
+
*/
|
|
59
|
+
export declare function getActiveOAuthAccount(options?: {
|
|
60
|
+
allowExhausted?: boolean;
|
|
61
|
+
requireHealthy?: boolean;
|
|
62
|
+
preferredAccountId?: string;
|
|
63
|
+
}): Promise<{
|
|
64
|
+
accountId: string;
|
|
65
|
+
accessToken: string;
|
|
66
|
+
resourceUrl?: string;
|
|
67
|
+
exhaustedUntil: number;
|
|
68
|
+
healthyAccountCount: number;
|
|
69
|
+
totalAccountCount: number;
|
|
70
|
+
} | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Mark account as exhausted by insufficient_quota
|
|
73
|
+
*/
|
|
74
|
+
export declare function markOAuthAccountQuotaExhausted(accountId: string, errorCode?: string): Promise<{
|
|
75
|
+
accountId: string;
|
|
76
|
+
exhaustedUntil: number;
|
|
77
|
+
healthyAccountCount: number;
|
|
78
|
+
totalAccountCount: number;
|
|
79
|
+
} | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Switch active account to next healthy one
|
|
82
|
+
*/
|
|
83
|
+
export declare function switchToNextHealthyOAuthAccount(excludedAccountIds?: string[]): Promise<{
|
|
84
|
+
accountId: string;
|
|
85
|
+
accessToken: string;
|
|
86
|
+
resourceUrl?: string;
|
|
87
|
+
exhaustedUntil: number;
|
|
88
|
+
healthyAccountCount: number;
|
|
89
|
+
totalAccountCount: number;
|
|
90
|
+
} | null>;
|
|
41
91
|
/**
|
|
42
92
|
* Check if token is expired (with 5 minute buffer)
|
|
43
93
|
* @param expiresAt - Expiration timestamp in milliseconds
|
|
@@ -62,4 +112,4 @@ export declare function getValidToken(): Promise<{
|
|
|
62
112
|
* - Chat API: /v1/ (for completions)
|
|
63
113
|
*/
|
|
64
114
|
export declare function getApiBaseUrl(resourceUrl?: string): string;
|
|
65
|
-
//# sourceMappingURL=auth.d.ts.map
|
|
115
|
+
//# sourceMappingURL=auth.d.ts.map
|