@kaitranntt/ccs 7.37.0-dev.2 → 7.37.0
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 +207 -5
- package/dist/cliproxy/account-manager.d.ts.map +1 -1
- package/dist/cliproxy/account-manager.js +795 -35
- package/dist/cliproxy/account-manager.js.map +1 -1
- package/dist/cliproxy/auth/token-expiry-checker.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-expiry-checker.js +1 -5
- package/dist/cliproxy/auth/token-expiry-checker.js.map +1 -1
- package/dist/cliproxy/cliproxy-executor.d.ts +28 -11
- package/dist/cliproxy/cliproxy-executor.d.ts.map +1 -1
- package/dist/cliproxy/cliproxy-executor.js +1028 -20
- package/dist/cliproxy/cliproxy-executor.js.map +1 -1
- package/dist/cliproxy/config-generator.d.ts +221 -9
- package/dist/cliproxy/config-generator.d.ts.map +1 -1
- package/dist/cliproxy/config-generator.js +856 -12
- package/dist/cliproxy/config-generator.js.map +1 -1
- package/dist/commands/cliproxy-command.d.ts +15 -4
- package/dist/commands/cliproxy-command.d.ts.map +1 -1
- package/dist/commands/cliproxy-command.js +1090 -5
- package/dist/commands/cliproxy-command.js.map +1 -1
- package/dist/ui/assets/{accounts-D0KU1a-4.js → accounts-DmKrgrCj.js} +1 -1
- package/dist/ui/assets/{alert-dialog-BNRDV_Kh.js → alert-dialog-CHcjWgRn.js} +1 -1
- package/dist/ui/assets/{api-ClkFu9LY.js → api-BFHZ3RKb.js} +1 -1
- package/dist/ui/assets/{auth-section-CNhNN1Jp.js → auth-section-DAI6Q5vU.js} +1 -1
- package/dist/ui/assets/{backups-section-CZ721HIu.js → backups-section-B1O8i4FM.js} +1 -1
- package/dist/ui/assets/cliproxy-BsSI8qFW.js +3 -0
- package/dist/ui/assets/{cliproxy-control-panel-T9i_Ldh0.js → cliproxy-control-panel-3zVE7jZH.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-Cy1__gRc.js → confirm-dialog-DV0JzL4A.js} +1 -1
- package/dist/ui/assets/{copilot-Cdqs2Jbh.js → copilot-BX8vT5RR.js} +3 -3
- package/dist/ui/assets/{globalenv-section-BEKtYN6I.js → globalenv-section-BAft0m9b.js} +1 -1
- package/dist/ui/assets/{health-BaHazGgS.js → health-ct5TpFUE.js} +1 -1
- package/dist/ui/assets/{index-C2MS84sf.js → index-B8-K01HW.js} +1 -1
- package/dist/ui/assets/{index-BTBpI5th.js → index-BOsGipAU.js} +1 -1
- package/dist/ui/assets/{index-BZn6kF0u.js → index-CU3zgD6n.js} +1 -1
- package/dist/ui/assets/{index-PjscK1jS.js → index-RZ6b7YTz.js} +1 -1
- package/dist/ui/assets/{index-CiULLjNI.js → index-gfWiPznS.js} +8 -8
- package/dist/ui/assets/{proxy-status-widget-BY6Lnr80.js → proxy-status-widget-Ng9oZdrw.js} +1 -1
- package/dist/ui/assets/{shared-dZGNvBe9.js → shared-DpInRmag.js} +1 -1
- package/dist/ui/assets/{switch-BCFbehJz.js → switch-DkRSlAu-.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/cliproxy/accounts/bulk-ops.d.ts +0 -22
- package/dist/cliproxy/accounts/bulk-ops.d.ts.map +0 -1
- package/dist/cliproxy/accounts/bulk-ops.js +0 -88
- package/dist/cliproxy/accounts/bulk-ops.js.map +0 -1
- package/dist/cliproxy/accounts/index.d.ts +0 -19
- package/dist/cliproxy/accounts/index.d.ts.map +0 -1
- package/dist/cliproxy/accounts/index.js +0 -54
- package/dist/cliproxy/accounts/index.js.map +0 -1
- package/dist/cliproxy/accounts/query.d.ts +0 -36
- package/dist/cliproxy/accounts/query.d.ts.map +0 -1
- package/dist/cliproxy/accounts/query.js +0 -94
- package/dist/cliproxy/accounts/query.js.map +0 -1
- package/dist/cliproxy/accounts/registry.d.ts +0 -74
- package/dist/cliproxy/accounts/registry.d.ts.map +0 -1
- package/dist/cliproxy/accounts/registry.js +0 -510
- package/dist/cliproxy/accounts/registry.js.map +0 -1
- package/dist/cliproxy/accounts/token-file-ops.d.ts +0 -64
- package/dist/cliproxy/accounts/token-file-ops.d.ts.map +0 -1
- package/dist/cliproxy/accounts/token-file-ops.js +0 -206
- package/dist/cliproxy/accounts/token-file-ops.js.map +0 -1
- package/dist/cliproxy/accounts/types.d.ts +0 -66
- package/dist/cliproxy/accounts/types.d.ts.map +0 -1
- package/dist/cliproxy/accounts/types.js +0 -12
- package/dist/cliproxy/accounts/types.js.map +0 -1
- package/dist/cliproxy/config/env-builder.d.ts +0 -60
- package/dist/cliproxy/config/env-builder.d.ts.map +0 -1
- package/dist/cliproxy/config/env-builder.js +0 -311
- package/dist/cliproxy/config/env-builder.js.map +0 -1
- package/dist/cliproxy/config/generator.d.ts +0 -63
- package/dist/cliproxy/config/generator.d.ts.map +0 -1
- package/dist/cliproxy/config/generator.js +0 -336
- package/dist/cliproxy/config/generator.js.map +0 -1
- package/dist/cliproxy/config/index.d.ts +0 -10
- package/dist/cliproxy/config/index.d.ts.map +0 -1
- package/dist/cliproxy/config/index.js +0 -26
- package/dist/cliproxy/config/index.js.map +0 -1
- package/dist/cliproxy/config/path-resolver.d.ts +0 -47
- package/dist/cliproxy/config/path-resolver.d.ts.map +0 -1
- package/dist/cliproxy/config/path-resolver.js +0 -104
- package/dist/cliproxy/config/path-resolver.js.map +0 -1
- package/dist/cliproxy/config/port-manager.d.ts +0 -33
- package/dist/cliproxy/config/port-manager.d.ts.map +0 -1
- package/dist/cliproxy/config/port-manager.js +0 -68
- package/dist/cliproxy/config/port-manager.js.map +0 -1
- package/dist/cliproxy/config/thinking-config.d.ts +0 -39
- package/dist/cliproxy/config/thinking-config.d.ts.map +0 -1
- package/dist/cliproxy/config/thinking-config.js +0 -143
- package/dist/cliproxy/config/thinking-config.js.map +0 -1
- package/dist/cliproxy/executor/env-resolver.d.ts +0 -45
- package/dist/cliproxy/executor/env-resolver.d.ts.map +0 -1
- package/dist/cliproxy/executor/env-resolver.js +0 -106
- package/dist/cliproxy/executor/env-resolver.js.map +0 -1
- package/dist/cliproxy/executor/index.d.ts +0 -24
- package/dist/cliproxy/executor/index.d.ts.map +0 -1
- package/dist/cliproxy/executor/index.js +0 -669
- package/dist/cliproxy/executor/index.js.map +0 -1
- package/dist/cliproxy/executor/lifecycle-manager.d.ts +0 -33
- package/dist/cliproxy/executor/lifecycle-manager.d.ts.map +0 -1
- package/dist/cliproxy/executor/lifecycle-manager.js +0 -161
- package/dist/cliproxy/executor/lifecycle-manager.js.map +0 -1
- package/dist/cliproxy/executor/retry-handler.d.ts +0 -27
- package/dist/cliproxy/executor/retry-handler.d.ts.map +0 -1
- package/dist/cliproxy/executor/retry-handler.js +0 -109
- package/dist/cliproxy/executor/retry-handler.js.map +0 -1
- package/dist/cliproxy/executor/session-bridge.d.ts +0 -30
- package/dist/cliproxy/executor/session-bridge.d.ts.map +0 -1
- package/dist/cliproxy/executor/session-bridge.js +0 -232
- package/dist/cliproxy/executor/session-bridge.js.map +0 -1
- package/dist/commands/cliproxy/auth-subcommand.d.ts +0 -10
- package/dist/commands/cliproxy/auth-subcommand.d.ts.map +0 -1
- package/dist/commands/cliproxy/auth-subcommand.js +0 -55
- package/dist/commands/cliproxy/auth-subcommand.js.map +0 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts +0 -8
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +0 -1
- package/dist/commands/cliproxy/help-subcommand.js +0 -87
- package/dist/commands/cliproxy/help-subcommand.js.map +0 -1
- package/dist/commands/cliproxy/index.d.ts +0 -11
- package/dist/commands/cliproxy/index.d.ts.map +0 -1
- package/dist/commands/cliproxy/index.js +0 -196
- package/dist/commands/cliproxy/index.js.map +0 -1
- package/dist/commands/cliproxy/install-subcommand.d.ts +0 -14
- package/dist/commands/cliproxy/install-subcommand.d.ts.map +0 -1
- package/dist/commands/cliproxy/install-subcommand.js +0 -112
- package/dist/commands/cliproxy/install-subcommand.js.map +0 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +0 -10
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +0 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +0 -54
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +0 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts +0 -16
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +0 -1
- package/dist/commands/cliproxy/quota-subcommand.js +0 -383
- package/dist/commands/cliproxy/quota-subcommand.js.map +0 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts +0 -11
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +0 -1
- package/dist/commands/cliproxy/variant-subcommand.js +0 -292
- package/dist/commands/cliproxy/variant-subcommand.js.map +0 -1
- package/dist/ui/assets/cliproxy-DeGucfVg.js +0 -3
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Token file operations and path management
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.validateNickname = exports.generateNickname = exports.extractAccountIdFromTokenFile = exports.tokenFileExists = exports.deleteTokenFile = exports.moveTokenFromPaused = exports.moveTokenToPaused = exports.getAccountTokenPath = exports.getPausedDir = exports.getAccountsRegistryPath = void 0;
|
|
30
|
-
const fs = __importStar(require("fs"));
|
|
31
|
-
const path = __importStar(require("path"));
|
|
32
|
-
const config_generator_1 = require("../config-generator");
|
|
33
|
-
/**
|
|
34
|
-
* Get path to accounts registry file
|
|
35
|
-
*/
|
|
36
|
-
function getAccountsRegistryPath() {
|
|
37
|
-
return path.join((0, config_generator_1.getCliproxyDir)(), 'accounts.json');
|
|
38
|
-
}
|
|
39
|
-
exports.getAccountsRegistryPath = getAccountsRegistryPath;
|
|
40
|
-
/**
|
|
41
|
-
* Get path to paused tokens directory
|
|
42
|
-
* Paused tokens are moved here so CLIProxyAPI won't discover them
|
|
43
|
-
*
|
|
44
|
-
* Uses sibling directory (auth-paused/) instead of subdirectory (auth/paused/)
|
|
45
|
-
* because CLIProxyAPI's watcher uses filepath.Walk() which recursively scans
|
|
46
|
-
* all subdirectories of auth/. A sibling directory is completely outside
|
|
47
|
-
* CLIProxyAPI's scan path, preventing token refresh loops.
|
|
48
|
-
*/
|
|
49
|
-
function getPausedDir() {
|
|
50
|
-
return path.join((0, config_generator_1.getCliproxyDir)(), 'auth-paused');
|
|
51
|
-
}
|
|
52
|
-
exports.getPausedDir = getPausedDir;
|
|
53
|
-
/**
|
|
54
|
-
* Get token file path for an account
|
|
55
|
-
* Returns path in paused/ dir if account is paused, otherwise auth/
|
|
56
|
-
*/
|
|
57
|
-
function getAccountTokenPath(account) {
|
|
58
|
-
const baseDir = account.paused ? getPausedDir() : (0, config_generator_1.getAuthDir)();
|
|
59
|
-
return path.join(baseDir, account.tokenFile);
|
|
60
|
-
}
|
|
61
|
-
exports.getAccountTokenPath = getAccountTokenPath;
|
|
62
|
-
/**
|
|
63
|
-
* Move token file to paused directory
|
|
64
|
-
* Creates paused directory if needed, idempotent
|
|
65
|
-
*/
|
|
66
|
-
function moveTokenToPaused(tokenFile) {
|
|
67
|
-
const authDir = (0, config_generator_1.getAuthDir)();
|
|
68
|
-
const pausedDir = getPausedDir();
|
|
69
|
-
const tokenPath = path.join(authDir, tokenFile);
|
|
70
|
-
const pausedPath = path.join(pausedDir, tokenFile);
|
|
71
|
-
// Skip if already in paused directory
|
|
72
|
-
if (!fs.existsSync(tokenPath)) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
// Create paused directory if it doesn't exist
|
|
77
|
-
if (!fs.existsSync(pausedDir)) {
|
|
78
|
-
fs.mkdirSync(pausedDir, { recursive: true, mode: 0o700 });
|
|
79
|
-
}
|
|
80
|
-
fs.renameSync(tokenPath, pausedPath);
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
// File operation failed, caller handles recovery
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.moveTokenToPaused = moveTokenToPaused;
|
|
89
|
-
/**
|
|
90
|
-
* Move token file from paused directory back to auth
|
|
91
|
-
* Idempotent
|
|
92
|
-
*/
|
|
93
|
-
function moveTokenFromPaused(tokenFile) {
|
|
94
|
-
const authDir = (0, config_generator_1.getAuthDir)();
|
|
95
|
-
const pausedDir = getPausedDir();
|
|
96
|
-
const tokenPath = path.join(authDir, tokenFile);
|
|
97
|
-
const pausedPath = path.join(pausedDir, tokenFile);
|
|
98
|
-
// Skip if already in auth directory
|
|
99
|
-
if (!fs.existsSync(pausedPath)) {
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
|
-
try {
|
|
103
|
-
fs.renameSync(pausedPath, tokenPath);
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
// File operation failed, caller handles recovery
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.moveTokenFromPaused = moveTokenFromPaused;
|
|
112
|
-
/**
|
|
113
|
-
* Delete token file from both auth and paused directories
|
|
114
|
-
* Idempotent
|
|
115
|
-
*/
|
|
116
|
-
function deleteTokenFile(tokenFile) {
|
|
117
|
-
const tokenPath = path.join((0, config_generator_1.getAuthDir)(), tokenFile);
|
|
118
|
-
const pausedPath = path.join(getPausedDir(), tokenFile);
|
|
119
|
-
// Delete from auth directory
|
|
120
|
-
if (fs.existsSync(tokenPath)) {
|
|
121
|
-
try {
|
|
122
|
-
fs.unlinkSync(tokenPath);
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
// Ignore deletion errors
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Also delete from paused directory if it exists there
|
|
129
|
-
if (fs.existsSync(pausedPath)) {
|
|
130
|
-
try {
|
|
131
|
-
fs.unlinkSync(pausedPath);
|
|
132
|
-
}
|
|
133
|
-
catch {
|
|
134
|
-
// Ignore deletion errors
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.deleteTokenFile = deleteTokenFile;
|
|
139
|
-
/**
|
|
140
|
-
* Check if token file exists in either auth or paused directory
|
|
141
|
-
*/
|
|
142
|
-
function tokenFileExists(tokenFile) {
|
|
143
|
-
const tokenPath = path.join((0, config_generator_1.getAuthDir)(), tokenFile);
|
|
144
|
-
const pausedPath = path.join(getPausedDir(), tokenFile);
|
|
145
|
-
return fs.existsSync(tokenPath) || fs.existsSync(pausedPath);
|
|
146
|
-
}
|
|
147
|
-
exports.tokenFileExists = tokenFileExists;
|
|
148
|
-
/**
|
|
149
|
-
* Extract unique account ID from token filename when email is unavailable
|
|
150
|
-
* For Kiro/GHCP OAuth, filenames are: <provider>-<oauth>-<profile_id>.json
|
|
151
|
-
* Extracts: <oauth>-<profile_id> as unique identifier
|
|
152
|
-
* @example kiro-github-ABC123.json → github-ABC123
|
|
153
|
-
* @example ghcp-amazon-XYZ789.json → amazon-XYZ789
|
|
154
|
-
* @example kiro-nomail.json → default (no OAuth structure)
|
|
155
|
-
*/
|
|
156
|
-
function extractAccountIdFromTokenFile(filename, email) {
|
|
157
|
-
if (email)
|
|
158
|
-
return email;
|
|
159
|
-
// Pattern: <provider>-<oauth>-<profile_id>.json → extract <oauth>-<profile_id>
|
|
160
|
-
// Requires at least 2 hyphens to distinguish from simple filenames like "kiro-nomail.json"
|
|
161
|
-
const match = filename.match(/^[^-]+-([^-]+-[^.]+)\.json$/);
|
|
162
|
-
if (match)
|
|
163
|
-
return match[1];
|
|
164
|
-
return 'default';
|
|
165
|
-
}
|
|
166
|
-
exports.extractAccountIdFromTokenFile = extractAccountIdFromTokenFile;
|
|
167
|
-
/**
|
|
168
|
-
* Generate nickname from email
|
|
169
|
-
* Takes prefix before @ symbol, sanitizes whitespace
|
|
170
|
-
* Validation: 1-50 chars, any non-whitespace (permissive per user preference)
|
|
171
|
-
*/
|
|
172
|
-
function generateNickname(email) {
|
|
173
|
-
if (!email)
|
|
174
|
-
return 'default';
|
|
175
|
-
const prefix = email.split('@')[0];
|
|
176
|
-
// Sanitize: remove whitespace, limit to 50 chars
|
|
177
|
-
return prefix.replace(/\s+/g, '').slice(0, 50) || 'default';
|
|
178
|
-
}
|
|
179
|
-
exports.generateNickname = generateNickname;
|
|
180
|
-
/**
|
|
181
|
-
* Validate nickname
|
|
182
|
-
* Rules: 1-50 chars, no whitespace, URL-safe, no reserved patterns
|
|
183
|
-
* @returns null if valid, error message if invalid
|
|
184
|
-
*/
|
|
185
|
-
function validateNickname(nickname) {
|
|
186
|
-
if (!nickname || nickname.length === 0) {
|
|
187
|
-
return 'Nickname is required';
|
|
188
|
-
}
|
|
189
|
-
if (nickname.length > 50) {
|
|
190
|
-
return 'Nickname must be 50 characters or less';
|
|
191
|
-
}
|
|
192
|
-
if (/\s/.test(nickname)) {
|
|
193
|
-
return 'Nickname cannot contain whitespace';
|
|
194
|
-
}
|
|
195
|
-
// Block URL-unsafe chars that break routing
|
|
196
|
-
if (/[%\/&?#]/.test(nickname)) {
|
|
197
|
-
return 'Nickname cannot contain special URL characters (%, /, &, ?, #)';
|
|
198
|
-
}
|
|
199
|
-
// Block reserved patterns used by auto-discovery (kiro-1, ghcp-2, etc.)
|
|
200
|
-
if (/^(kiro|ghcp)-\d+$/i.test(nickname)) {
|
|
201
|
-
return 'Nickname cannot match reserved pattern (kiro-N, ghcp-N)';
|
|
202
|
-
}
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
exports.validateNickname = validateNickname;
|
|
206
|
-
//# sourceMappingURL=token-file-ops.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-file-ops.js","sourceRoot":"","sources":["../../../src/cliproxy/accounts/token-file-ops.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,0DAAiE;AAGjE;;GAEG;AACH,SAAgB,uBAAuB;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAA,iCAAc,GAAE,EAAE,eAAe,CAAC,CAAC;AACtD,CAAC;AAFD,0DAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAA,iCAAc,GAAE,EAAE,aAAa,CAAC,CAAC;AACpD,CAAC;AAFD,oCAEC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,OAAoB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAA,6BAAU,GAAE,CAAC;IAC/D,OAAO,IA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AoB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,yDAAyD,CAAC;IACnE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAnBD,4CAmBC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types and constants for account management
|
|
3
|
-
*/
|
|
4
|
-
import { CLIProxyProvider } from '../types';
|
|
5
|
-
/** Account tier for quota management: ultra > pro > free */
|
|
6
|
-
export type AccountTier = 'free' | 'pro' | 'ultra' | 'unknown';
|
|
7
|
-
/**
|
|
8
|
-
* Providers that typically have empty email in OAuth token files.
|
|
9
|
-
* For these providers, nickname is used as accountId instead of email.
|
|
10
|
-
*/
|
|
11
|
-
export declare const PROVIDERS_WITHOUT_EMAIL: CLIProxyProvider[];
|
|
12
|
-
/** Account information */
|
|
13
|
-
export interface AccountInfo {
|
|
14
|
-
/** Account identifier (email or custom name) */
|
|
15
|
-
id: string;
|
|
16
|
-
/** Email address from OAuth (if available) */
|
|
17
|
-
email?: string;
|
|
18
|
-
/** User-friendly nickname for quick reference (auto-generated from email prefix) */
|
|
19
|
-
nickname?: string;
|
|
20
|
-
/** Provider this account belongs to */
|
|
21
|
-
provider: CLIProxyProvider;
|
|
22
|
-
/** Whether this is the default account for the provider */
|
|
23
|
-
isDefault: boolean;
|
|
24
|
-
/** Token file name in auth directory */
|
|
25
|
-
tokenFile: string;
|
|
26
|
-
/** When account was added */
|
|
27
|
-
createdAt: string;
|
|
28
|
-
/** Last usage time */
|
|
29
|
-
lastUsedAt?: string;
|
|
30
|
-
/** User-paused state (skip in quota rotation) */
|
|
31
|
-
paused?: boolean;
|
|
32
|
-
/** ISO timestamp when paused */
|
|
33
|
-
pausedAt?: string;
|
|
34
|
-
/** Account tier: ultra, pro, or free */
|
|
35
|
-
tier?: AccountTier;
|
|
36
|
-
/** GCP Project ID (Antigravity only) - read-only, fetched from auth token */
|
|
37
|
-
projectId?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Provider accounts configuration */
|
|
40
|
-
export interface ProviderAccounts {
|
|
41
|
-
/** Default account ID for this provider */
|
|
42
|
-
default: string;
|
|
43
|
-
/** Map of account ID to account metadata */
|
|
44
|
-
accounts: Record<string, Omit<AccountInfo, 'id' | 'provider' | 'isDefault'>>;
|
|
45
|
-
}
|
|
46
|
-
/** Accounts registry structure */
|
|
47
|
-
export interface AccountsRegistry {
|
|
48
|
-
/** Version for future migrations */
|
|
49
|
-
version: number;
|
|
50
|
-
/** Accounts organized by provider */
|
|
51
|
-
providers: Partial<Record<CLIProxyProvider, ProviderAccounts>>;
|
|
52
|
-
}
|
|
53
|
-
/** Result of bulk pause/resume operations */
|
|
54
|
-
export interface BulkOperationResult {
|
|
55
|
-
succeeded: string[];
|
|
56
|
-
failed: Array<{
|
|
57
|
-
id: string;
|
|
58
|
-
reason: string;
|
|
59
|
-
}>;
|
|
60
|
-
}
|
|
61
|
-
/** Result of solo account operation */
|
|
62
|
-
export interface SoloOperationResult {
|
|
63
|
-
activated: string;
|
|
64
|
-
paused: string[];
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cliproxy/accounts/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,EAAqB,CAAC;AAE5E,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAA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
/**
|
|
3
|
-
* Shared types and constants for account management
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PROVIDERS_WITHOUT_EMAIL = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Providers that typically have empty email in OAuth token files.
|
|
9
|
-
* For these providers, nickname is used as accountId instead of email.
|
|
10
|
-
*/
|
|
11
|
-
exports.PROVIDERS_WITHOUT_EMAIL = ['kiro', 'ghcp'];
|
|
12
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cliproxy/accounts/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAOH;;;GAGG;AACU,QAAA,uBAAuB,GAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment variable builder for CLIProxy
|
|
3
|
-
* Handles env var construction, merging, and remote URL rewriting
|
|
4
|
-
*/
|
|
5
|
-
/// <reference types="node" />
|
|
6
|
-
import { CLIProxyProvider, ProviderModelMapping } from '../types';
|
|
7
|
-
/** Remote proxy configuration for URL rewriting */
|
|
8
|
-
export interface RemoteProxyRewriteConfig {
|
|
9
|
-
host: string;
|
|
10
|
-
port?: number;
|
|
11
|
-
protocol: 'http' | 'https';
|
|
12
|
-
authToken?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Get model mapping for provider
|
|
16
|
-
* Loads from config/base-{provider}.settings.json
|
|
17
|
-
*/
|
|
18
|
-
export declare function getModelMapping(provider: CLIProxyProvider): ProviderModelMapping;
|
|
19
|
-
/**
|
|
20
|
-
* Get environment variables for Claude CLI (bundled defaults)
|
|
21
|
-
* Uses provider-specific endpoint (e.g., /api/provider/gemini) for explicit routing.
|
|
22
|
-
* This enables concurrent gemini/codex usage - each session routes to its provider via URL path.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getClaudeEnvVars(provider: CLIProxyProvider, port?: number): NodeJS.ProcessEnv;
|
|
25
|
-
/**
|
|
26
|
-
* Get effective environment variables for provider
|
|
27
|
-
*
|
|
28
|
-
* Priority order:
|
|
29
|
-
* 1. Custom settings path (for user-defined CLIProxy variants)
|
|
30
|
-
* 2. User settings file (~/.ccs/{provider}.settings.json) if exists
|
|
31
|
-
* 3. Bundled defaults from PROVIDER_CONFIGS
|
|
32
|
-
*
|
|
33
|
-
* All results are merged with global_env vars (telemetry/reporting disables).
|
|
34
|
-
* User takes full responsibility for custom settings.
|
|
35
|
-
*
|
|
36
|
-
* If remoteRewriteConfig is provided, localhost URLs are rewritten to remote server.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getEffectiveEnvVars(provider: CLIProxyProvider, port?: number, customSettingsPath?: string, remoteRewriteConfig?: RemoteProxyRewriteConfig): NodeJS.ProcessEnv;
|
|
39
|
-
/**
|
|
40
|
-
* Copy bundled settings template to user directory if not exists
|
|
41
|
-
* Called during installation/first run
|
|
42
|
-
*/
|
|
43
|
-
export declare function ensureProviderSettings(provider: CLIProxyProvider): void;
|
|
44
|
-
/**
|
|
45
|
-
* Get environment variables for remote proxy mode.
|
|
46
|
-
* Uses the remote proxy's provider endpoint as the base URL.
|
|
47
|
-
* Respects user model settings from custom settings path or provider settings file.
|
|
48
|
-
*
|
|
49
|
-
* @param provider CLIProxy provider (gemini, codex, agy, qwen, iflow)
|
|
50
|
-
* @param remoteConfig Remote proxy connection details
|
|
51
|
-
* @param customSettingsPath Optional path to user's custom settings file
|
|
52
|
-
* @returns Environment variables for Claude CLI
|
|
53
|
-
*/
|
|
54
|
-
export declare function getRemoteEnvVars(provider: CLIProxyProvider, remoteConfig: {
|
|
55
|
-
host: string;
|
|
56
|
-
port?: number;
|
|
57
|
-
protocol: 'http' | 'https';
|
|
58
|
-
authToken?: string;
|
|
59
|
-
}, customSettingsPath?: string): Record<string, string>;
|
|
60
|
-
//# sourceMappingURL=env-builder.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