@kaitranntt/ccs 7.36.0-dev.6 → 7.37.0-dev.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/dist/cliproxy/account-manager.d.ts +5 -207
- package/dist/cliproxy/account-manager.d.ts.map +1 -1
- package/dist/cliproxy/account-manager.js +35 -795
- package/dist/cliproxy/account-manager.js.map +1 -1
- package/dist/cliproxy/accounts/bulk-ops.d.ts +22 -0
- package/dist/cliproxy/accounts/bulk-ops.d.ts.map +1 -0
- package/dist/cliproxy/accounts/bulk-ops.js +88 -0
- package/dist/cliproxy/accounts/bulk-ops.js.map +1 -0
- package/dist/cliproxy/accounts/index.d.ts +19 -0
- package/dist/cliproxy/accounts/index.d.ts.map +1 -0
- package/dist/cliproxy/accounts/index.js +54 -0
- package/dist/cliproxy/accounts/index.js.map +1 -0
- package/dist/cliproxy/accounts/query.d.ts +36 -0
- package/dist/cliproxy/accounts/query.d.ts.map +1 -0
- package/dist/cliproxy/accounts/query.js +94 -0
- package/dist/cliproxy/accounts/query.js.map +1 -0
- package/dist/cliproxy/accounts/registry.d.ts +74 -0
- package/dist/cliproxy/accounts/registry.d.ts.map +1 -0
- package/dist/cliproxy/accounts/registry.js +510 -0
- package/dist/cliproxy/accounts/registry.js.map +1 -0
- package/dist/cliproxy/accounts/token-file-ops.d.ts +64 -0
- package/dist/cliproxy/accounts/token-file-ops.d.ts.map +1 -0
- package/dist/cliproxy/accounts/token-file-ops.js +206 -0
- package/dist/cliproxy/accounts/token-file-ops.js.map +1 -0
- package/dist/cliproxy/accounts/types.d.ts +66 -0
- package/dist/cliproxy/accounts/types.d.ts.map +1 -0
- package/dist/cliproxy/accounts/types.js +12 -0
- package/dist/cliproxy/accounts/types.js.map +1 -0
- package/dist/cliproxy/auth/token-expiry-checker.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-expiry-checker.js +5 -1
- package/dist/cliproxy/auth/token-expiry-checker.js.map +1 -1
- package/dist/cliproxy/cliproxy-executor.d.ts +11 -28
- package/dist/cliproxy/cliproxy-executor.d.ts.map +1 -1
- package/dist/cliproxy/cliproxy-executor.js +20 -1028
- package/dist/cliproxy/cliproxy-executor.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts +60 -0
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -0
- package/dist/cliproxy/config/env-builder.js +311 -0
- package/dist/cliproxy/config/env-builder.js.map +1 -0
- package/dist/cliproxy/config/generator.d.ts +63 -0
- package/dist/cliproxy/config/generator.d.ts.map +1 -0
- package/dist/cliproxy/config/generator.js +336 -0
- package/dist/cliproxy/config/generator.js.map +1 -0
- package/dist/cliproxy/config/index.d.ts +10 -0
- package/dist/cliproxy/config/index.d.ts.map +1 -0
- package/dist/cliproxy/config/index.js +26 -0
- package/dist/cliproxy/config/index.js.map +1 -0
- package/dist/cliproxy/config/path-resolver.d.ts +47 -0
- package/dist/cliproxy/config/path-resolver.d.ts.map +1 -0
- package/dist/cliproxy/config/path-resolver.js +104 -0
- package/dist/cliproxy/config/path-resolver.js.map +1 -0
- package/dist/cliproxy/config/port-manager.d.ts +33 -0
- package/dist/cliproxy/config/port-manager.d.ts.map +1 -0
- package/dist/cliproxy/config/port-manager.js +68 -0
- package/dist/cliproxy/config/port-manager.js.map +1 -0
- package/dist/cliproxy/config/thinking-config.d.ts +39 -0
- package/dist/cliproxy/config/thinking-config.d.ts.map +1 -0
- package/dist/cliproxy/config/thinking-config.js +143 -0
- package/dist/cliproxy/config/thinking-config.js.map +1 -0
- package/dist/cliproxy/config-generator.d.ts +9 -221
- package/dist/cliproxy/config-generator.d.ts.map +1 -1
- package/dist/cliproxy/config-generator.js +12 -856
- package/dist/cliproxy/config-generator.js.map +1 -1
- package/dist/cliproxy/executor/env-resolver.d.ts +45 -0
- package/dist/cliproxy/executor/env-resolver.d.ts.map +1 -0
- package/dist/cliproxy/executor/env-resolver.js +106 -0
- package/dist/cliproxy/executor/env-resolver.js.map +1 -0
- package/dist/cliproxy/executor/index.d.ts +24 -0
- package/dist/cliproxy/executor/index.d.ts.map +1 -0
- package/dist/cliproxy/executor/index.js +669 -0
- package/dist/cliproxy/executor/index.js.map +1 -0
- package/dist/cliproxy/executor/lifecycle-manager.d.ts +33 -0
- package/dist/cliproxy/executor/lifecycle-manager.d.ts.map +1 -0
- package/dist/cliproxy/executor/lifecycle-manager.js +161 -0
- package/dist/cliproxy/executor/lifecycle-manager.js.map +1 -0
- package/dist/cliproxy/executor/retry-handler.d.ts +27 -0
- package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -0
- package/dist/cliproxy/executor/retry-handler.js +109 -0
- package/dist/cliproxy/executor/retry-handler.js.map +1 -0
- package/dist/cliproxy/executor/session-bridge.d.ts +30 -0
- package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -0
- package/dist/cliproxy/executor/session-bridge.js +232 -0
- package/dist/cliproxy/executor/session-bridge.js.map +1 -0
- package/dist/commands/cliproxy/auth-subcommand.d.ts +10 -0
- package/dist/commands/cliproxy/auth-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/auth-subcommand.js +55 -0
- package/dist/commands/cliproxy/auth-subcommand.js.map +1 -0
- package/dist/commands/cliproxy/help-subcommand.d.ts +8 -0
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/help-subcommand.js +87 -0
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -0
- package/dist/commands/cliproxy/index.d.ts +11 -0
- package/dist/commands/cliproxy/index.d.ts.map +1 -0
- package/dist/commands/cliproxy/index.js +196 -0
- package/dist/commands/cliproxy/index.js.map +1 -0
- package/dist/commands/cliproxy/install-subcommand.d.ts +14 -0
- package/dist/commands/cliproxy/install-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/install-subcommand.js +112 -0
- package/dist/commands/cliproxy/install-subcommand.js.map +1 -0
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +10 -0
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +54 -0
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand.d.ts +16 -0
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand.js +383 -0
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -0
- package/dist/commands/cliproxy/variant-subcommand.d.ts +11 -0
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -0
- package/dist/commands/cliproxy/variant-subcommand.js +292 -0
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -0
- package/dist/commands/cliproxy-command.d.ts +4 -15
- package/dist/commands/cliproxy-command.d.ts.map +1 -1
- package/dist/commands/cliproxy-command.js +5 -1090
- package/dist/commands/cliproxy-command.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Account Manager for CLIProxyAPI Multi-Account Support
|
|
3
3
|
*
|
|
4
|
+
* DEPRECATED: This file is now a re-export shim for backwards compatibility.
|
|
5
|
+
* New code should import directly from './accounts/' module.
|
|
6
|
+
*
|
|
4
7
|
* Manages multiple OAuth accounts per provider (Gemini, Codex, etc.).
|
|
5
8
|
* Each provider can have multiple accounts, with one designated as default.
|
|
6
9
|
*
|
|
@@ -8,211 +11,6 @@
|
|
|
8
11
|
* Token storage: ~/.ccs/cliproxy/auth/ (flat structure, CLIProxyAPI discovers by type field)
|
|
9
12
|
* Paused tokens: ~/.ccs/cliproxy/auth-paused/ (sibling dir, outside CLIProxyAPI scan path)
|
|
10
13
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export type AccountTier = 'free' | 'pro' | 'ultra' | 'unknown';
|
|
14
|
-
/**
|
|
15
|
-
* Providers that typically have empty email in OAuth token files.
|
|
16
|
-
* For these providers, nickname is used as accountId instead of email.
|
|
17
|
-
*/
|
|
18
|
-
export declare const PROVIDERS_WITHOUT_EMAIL: CLIProxyProvider[];
|
|
19
|
-
/** Account information */
|
|
20
|
-
export interface AccountInfo {
|
|
21
|
-
/** Account identifier (email or custom name) */
|
|
22
|
-
id: string;
|
|
23
|
-
/** Email address from OAuth (if available) */
|
|
24
|
-
email?: string;
|
|
25
|
-
/** User-friendly nickname for quick reference (auto-generated from email prefix) */
|
|
26
|
-
nickname?: string;
|
|
27
|
-
/** Provider this account belongs to */
|
|
28
|
-
provider: CLIProxyProvider;
|
|
29
|
-
/** Whether this is the default account for the provider */
|
|
30
|
-
isDefault: boolean;
|
|
31
|
-
/** Token file name in auth directory */
|
|
32
|
-
tokenFile: string;
|
|
33
|
-
/** When account was added */
|
|
34
|
-
createdAt: string;
|
|
35
|
-
/** Last usage time */
|
|
36
|
-
lastUsedAt?: string;
|
|
37
|
-
/** User-paused state (skip in quota rotation) */
|
|
38
|
-
paused?: boolean;
|
|
39
|
-
/** ISO timestamp when paused */
|
|
40
|
-
pausedAt?: string;
|
|
41
|
-
/** Account tier: ultra, pro, or free */
|
|
42
|
-
tier?: AccountTier;
|
|
43
|
-
/** GCP Project ID (Antigravity only) - read-only, fetched from auth token */
|
|
44
|
-
projectId?: string;
|
|
45
|
-
}
|
|
46
|
-
/** Provider accounts configuration */
|
|
47
|
-
interface ProviderAccounts {
|
|
48
|
-
/** Default account ID for this provider */
|
|
49
|
-
default: string;
|
|
50
|
-
/** Map of account ID to account metadata */
|
|
51
|
-
accounts: Record<string, Omit<AccountInfo, 'id' | 'provider' | 'isDefault'>>;
|
|
52
|
-
}
|
|
53
|
-
/** Accounts registry structure */
|
|
54
|
-
interface AccountsRegistry {
|
|
55
|
-
/** Version for future migrations */
|
|
56
|
-
version: number;
|
|
57
|
-
/** Accounts organized by provider */
|
|
58
|
-
providers: Partial<Record<CLIProxyProvider, ProviderAccounts>>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Extract unique account ID from token filename when email is unavailable
|
|
62
|
-
* For Kiro/GHCP OAuth, filenames are: <provider>-<oauth>-<profile_id>.json
|
|
63
|
-
* Extracts: <oauth>-<profile_id> as unique identifier
|
|
64
|
-
* @example kiro-github-ABC123.json → github-ABC123
|
|
65
|
-
* @example ghcp-amazon-XYZ789.json → amazon-XYZ789
|
|
66
|
-
* @example kiro-nomail.json → default (no OAuth structure)
|
|
67
|
-
*/
|
|
68
|
-
export declare function extractAccountIdFromTokenFile(filename: string, email?: string): string;
|
|
69
|
-
/**
|
|
70
|
-
* Generate nickname from email
|
|
71
|
-
* Takes prefix before @ symbol, sanitizes whitespace
|
|
72
|
-
* Validation: 1-50 chars, any non-whitespace (permissive per user preference)
|
|
73
|
-
*/
|
|
74
|
-
export declare function generateNickname(email?: string): string;
|
|
75
|
-
/**
|
|
76
|
-
* Validate nickname
|
|
77
|
-
* Rules: 1-50 chars, no whitespace, URL-safe, no reserved patterns
|
|
78
|
-
* @returns null if valid, error message if invalid
|
|
79
|
-
*/
|
|
80
|
-
export declare function validateNickname(nickname: string): string | null;
|
|
81
|
-
/**
|
|
82
|
-
* Get path to accounts registry file
|
|
83
|
-
*/
|
|
84
|
-
export declare function getAccountsRegistryPath(): string;
|
|
85
|
-
/**
|
|
86
|
-
* Get path to paused tokens directory
|
|
87
|
-
* Paused tokens are moved here so CLIProxyAPI won't discover them
|
|
88
|
-
*
|
|
89
|
-
* Uses sibling directory (auth-paused/) instead of subdirectory (auth/paused/)
|
|
90
|
-
* because CLIProxyAPI's watcher uses filepath.Walk() which recursively scans
|
|
91
|
-
* all subdirectories of auth/. A sibling directory is completely outside
|
|
92
|
-
* CLIProxyAPI's scan path, preventing token refresh loops.
|
|
93
|
-
*/
|
|
94
|
-
export declare function getPausedDir(): string;
|
|
95
|
-
/**
|
|
96
|
-
* Load accounts registry
|
|
97
|
-
*/
|
|
98
|
-
export declare function loadAccountsRegistry(): AccountsRegistry;
|
|
99
|
-
/**
|
|
100
|
-
* Save accounts registry
|
|
101
|
-
*/
|
|
102
|
-
export declare function saveAccountsRegistry(registry: AccountsRegistry): void;
|
|
103
|
-
/**
|
|
104
|
-
* Get all accounts for a provider
|
|
105
|
-
*/
|
|
106
|
-
export declare function getProviderAccounts(provider: CLIProxyProvider): AccountInfo[];
|
|
107
|
-
/**
|
|
108
|
-
* Get default account for a provider
|
|
109
|
-
*/
|
|
110
|
-
export declare function getDefaultAccount(provider: CLIProxyProvider): AccountInfo | null;
|
|
111
|
-
/**
|
|
112
|
-
* Get specific account by ID
|
|
113
|
-
*/
|
|
114
|
-
export declare function getAccount(provider: CLIProxyProvider, accountId: string): AccountInfo | null;
|
|
115
|
-
/**
|
|
116
|
-
* Find account by query (nickname, email, or id)
|
|
117
|
-
* Supports partial matching for convenience
|
|
118
|
-
*/
|
|
119
|
-
export declare function findAccountByQuery(provider: CLIProxyProvider, query: string): AccountInfo | null;
|
|
120
|
-
/**
|
|
121
|
-
* Register a new account
|
|
122
|
-
* Called after successful OAuth to record the account
|
|
123
|
-
*
|
|
124
|
-
* For providers without email (kiro, ghcp):
|
|
125
|
-
* - nickname is REQUIRED and used as accountId
|
|
126
|
-
* - Uniqueness is enforced to prevent overwriting
|
|
127
|
-
*
|
|
128
|
-
* For providers with email:
|
|
129
|
-
* - email is used as accountId
|
|
130
|
-
* - nickname is auto-generated from email if not provided
|
|
131
|
-
*/
|
|
132
|
-
export declare function registerAccount(provider: CLIProxyProvider, tokenFile: string, email?: string, nickname?: string, projectId?: string): AccountInfo;
|
|
133
|
-
/**
|
|
134
|
-
* Set default account for a provider
|
|
135
|
-
*/
|
|
136
|
-
export declare function setDefaultAccount(provider: CLIProxyProvider, accountId: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Pause an account (skip in quota rotation)
|
|
139
|
-
* Moves token file to paused/ subdir so CLIProxyAPI won't discover it
|
|
140
|
-
*/
|
|
141
|
-
export declare function pauseAccount(provider: CLIProxyProvider, accountId: string): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* Resume a paused account
|
|
144
|
-
* Moves token file back from paused/ to auth/ so CLIProxyAPI can discover it
|
|
145
|
-
*/
|
|
146
|
-
export declare function resumeAccount(provider: CLIProxyProvider, accountId: string): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Check if an account is paused
|
|
149
|
-
*/
|
|
150
|
-
export declare function isAccountPaused(provider: CLIProxyProvider, accountId: string): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Update account tier
|
|
153
|
-
*/
|
|
154
|
-
export declare function setAccountTier(provider: CLIProxyProvider, accountId: string, tier: AccountTier): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Get non-paused accounts for a provider
|
|
157
|
-
*/
|
|
158
|
-
export declare function getActiveAccounts(provider: CLIProxyProvider): AccountInfo[];
|
|
159
|
-
/**
|
|
160
|
-
* Remove an account
|
|
161
|
-
*/
|
|
162
|
-
export declare function removeAccount(provider: CLIProxyProvider, accountId: string): boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Rename an account's nickname
|
|
165
|
-
*/
|
|
166
|
-
export declare function renameAccount(provider: CLIProxyProvider, accountId: string, newNickname: string): boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Update last used timestamp for an account
|
|
169
|
-
*/
|
|
170
|
-
export declare function touchAccount(provider: CLIProxyProvider, accountId: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* Get token file path for an account
|
|
173
|
-
* Returns path in paused/ dir if account is paused, otherwise auth/
|
|
174
|
-
*/
|
|
175
|
-
export declare function getAccountTokenPath(provider: CLIProxyProvider, accountId?: string): string | null;
|
|
176
|
-
/**
|
|
177
|
-
* Auto-discover accounts from existing token files
|
|
178
|
-
* Called during migration or first run to populate accounts registry
|
|
179
|
-
*
|
|
180
|
-
* For kiro/ghcp providers without email, generates unique accountId from:
|
|
181
|
-
* 1. OAuth provider + profile ID from filename (e.g., github-ABC123)
|
|
182
|
-
* 2. Fallback: provider + index (e.g., kiro-1, kiro-2)
|
|
183
|
-
*/
|
|
184
|
-
export declare function discoverExistingAccounts(): void;
|
|
185
|
-
/** Result of bulk pause/resume operations */
|
|
186
|
-
export interface BulkOperationResult {
|
|
187
|
-
succeeded: string[];
|
|
188
|
-
failed: Array<{
|
|
189
|
-
id: string;
|
|
190
|
-
reason: string;
|
|
191
|
-
}>;
|
|
192
|
-
}
|
|
193
|
-
/** Result of solo account operation */
|
|
194
|
-
export interface SoloOperationResult {
|
|
195
|
-
activated: string;
|
|
196
|
-
paused: string[];
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Bulk pause multiple accounts
|
|
200
|
-
* Pauses each account, collecting successes and failures (no fail-fast)
|
|
201
|
-
*/
|
|
202
|
-
export declare function bulkPauseAccounts(provider: CLIProxyProvider, accountIds: string[]): BulkOperationResult;
|
|
203
|
-
/**
|
|
204
|
-
* Bulk resume multiple accounts
|
|
205
|
-
* Resumes each account, collecting successes and failures (no fail-fast)
|
|
206
|
-
*/
|
|
207
|
-
export declare function bulkResumeAccounts(provider: CLIProxyProvider, accountIds: string[]): BulkOperationResult;
|
|
208
|
-
/**
|
|
209
|
-
* Solo mode: activate one account, pause all others in same provider
|
|
210
|
-
* Per validation: auto-resumes target if paused, keeps default unchanged
|
|
211
|
-
*/
|
|
212
|
-
export declare function soloAccount(provider: CLIProxyProvider, accountId: string): Promise<SoloOperationResult | null>;
|
|
213
|
-
/**
|
|
214
|
-
* Get summary of all accounts across providers
|
|
215
|
-
*/
|
|
216
|
-
export declare function getAllAccountsSummary(): Record<CLIProxyProvider, AccountInfo[]>;
|
|
217
|
-
export {};
|
|
14
|
+
export type { AccountInfo, AccountTier, AccountsRegistry, ProviderAccounts, BulkOperationResult, SoloOperationResult, } from './accounts';
|
|
15
|
+
export { PROVIDERS_WITHOUT_EMAIL, getAccountsRegistryPath, getPausedDir, getAccountTokenPath, extractAccountIdFromTokenFile, generateNickname, validateNickname, tokenFileExists, loadAccountsRegistry, saveAccountsRegistry, syncRegistryWithTokenFiles, registerAccount, setDefaultAccount, pauseAccount, resumeAccount, removeAccount, renameAccount, touchAccount, setAccountTier, discoverExistingAccounts, getProviderAccounts, getDefaultAccount, getAccount, findAccountByQuery, getActiveAccounts, isAccountPaused, getAllAccountsSummary, bulkPauseAccounts, bulkResumeAccounts, soloAccount, } from './accounts';
|
|
218
16
|
//# sourceMappingURL=account-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/cliproxy/account-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/cliproxy/account-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,mBAAmB,EACnB,6BAA6B,EAC7B,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,GACZ,MAAM,YAAY,CAAC"}
|