@victor-software-house/pi-multicodex 2.1.1 → 2.1.3
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 +5 -5
- package/account-manager.ts +47 -12
- package/commands.ts +1 -1
- package/package.json +1 -1
- package/storage.ts +1 -0
package/README.md
CHANGED
|
@@ -60,11 +60,11 @@ The `/multicodex accounts` panel merges the old `show` and `use` flows into one
|
|
|
60
60
|
|
|
61
61
|

|
|
62
62
|
|
|
63
|
-
- **
|
|
64
|
-
- **
|
|
65
|
-
- **
|
|
66
|
-
- **
|
|
67
|
-
- **
|
|
63
|
+
- **enter** activates the highlighted account.
|
|
64
|
+
- **u** refreshes token and usage health for the selected account.
|
|
65
|
+
- **r** re-authenticates the selected account.
|
|
66
|
+
- **n** starts login for a new managed account.
|
|
67
|
+
- **backspace** removes the selected account after confirmation.
|
|
68
68
|
|
|
69
69
|
Each row shows the account identifier, active/manual state, reauth state, quota state, linked imported auth state, and cached 5-hour and weekly usage windows.
|
|
70
70
|
|
package/account-manager.ts
CHANGED
|
@@ -153,6 +153,7 @@ export class AccountManager {
|
|
|
153
153
|
creds: OAuthCredentials,
|
|
154
154
|
options?: {
|
|
155
155
|
importSource?: "pi-openai-codex";
|
|
156
|
+
importMode?: "linked" | "synthetic";
|
|
156
157
|
importFingerprint?: string;
|
|
157
158
|
},
|
|
158
159
|
): boolean {
|
|
@@ -182,6 +183,10 @@ export class AccountManager {
|
|
|
182
183
|
account.importSource = options.importSource;
|
|
183
184
|
changed = true;
|
|
184
185
|
}
|
|
186
|
+
if (options?.importMode && account.importMode !== options.importMode) {
|
|
187
|
+
account.importMode = options.importMode;
|
|
188
|
+
changed = true;
|
|
189
|
+
}
|
|
185
190
|
if (
|
|
186
191
|
options?.importFingerprint &&
|
|
187
192
|
account.importFingerprint !== options.importFingerprint
|
|
@@ -202,6 +207,7 @@ export class AccountManager {
|
|
|
202
207
|
creds: OAuthCredentials,
|
|
203
208
|
options?: {
|
|
204
209
|
importSource?: "pi-openai-codex";
|
|
210
|
+
importMode?: "linked" | "synthetic";
|
|
205
211
|
importFingerprint?: string;
|
|
206
212
|
preserveActive?: boolean;
|
|
207
213
|
},
|
|
@@ -221,7 +227,13 @@ export class AccountManager {
|
|
|
221
227
|
) {
|
|
222
228
|
changed = this.updateAccountEmail(duplicate, email) || changed;
|
|
223
229
|
}
|
|
224
|
-
changed =
|
|
230
|
+
changed =
|
|
231
|
+
this.applyCredentials(target, creds, {
|
|
232
|
+
...options,
|
|
233
|
+
importMode:
|
|
234
|
+
options?.importMode ??
|
|
235
|
+
(duplicate?.importMode === "synthetic" ? "linked" : undefined),
|
|
236
|
+
}) || changed;
|
|
225
237
|
} else {
|
|
226
238
|
target = {
|
|
227
239
|
email,
|
|
@@ -231,6 +243,7 @@ export class AccountManager {
|
|
|
231
243
|
accountId:
|
|
232
244
|
typeof creds.accountId === "string" ? creds.accountId : undefined,
|
|
233
245
|
importSource: options?.importSource,
|
|
246
|
+
importMode: options?.importMode,
|
|
234
247
|
importFingerprint: options?.importFingerprint,
|
|
235
248
|
};
|
|
236
249
|
this.data.accounts.push(target);
|
|
@@ -300,6 +313,23 @@ export class AccountManager {
|
|
|
300
313
|
);
|
|
301
314
|
}
|
|
302
315
|
|
|
316
|
+
private clearImportedLink(account: Account): boolean {
|
|
317
|
+
let changed = false;
|
|
318
|
+
if (account.importSource) {
|
|
319
|
+
account.importSource = undefined;
|
|
320
|
+
changed = true;
|
|
321
|
+
}
|
|
322
|
+
if (account.importMode) {
|
|
323
|
+
account.importMode = undefined;
|
|
324
|
+
changed = true;
|
|
325
|
+
}
|
|
326
|
+
if (account.importFingerprint) {
|
|
327
|
+
account.importFingerprint = undefined;
|
|
328
|
+
changed = true;
|
|
329
|
+
}
|
|
330
|
+
return changed;
|
|
331
|
+
}
|
|
332
|
+
|
|
303
333
|
async syncImportedOpenAICodexAuth(): Promise<boolean> {
|
|
304
334
|
const imported = await loadImportedOpenAICodexAuth();
|
|
305
335
|
if (!imported) return false;
|
|
@@ -314,25 +344,20 @@ export class AccountManager {
|
|
|
314
344
|
existingImported?.email,
|
|
315
345
|
);
|
|
316
346
|
if (matchingAccount) {
|
|
317
|
-
const wasActiveImported =
|
|
318
|
-
existingImported && this.data.activeEmail === existingImported.email;
|
|
319
|
-
const wasManualImported =
|
|
320
|
-
existingImported && this.manualEmail === existingImported.email;
|
|
321
347
|
let changed = this.applyCredentials(
|
|
322
348
|
matchingAccount,
|
|
323
349
|
imported.credentials,
|
|
324
350
|
{
|
|
325
351
|
importSource: "pi-openai-codex",
|
|
352
|
+
importMode: "linked",
|
|
326
353
|
importFingerprint: imported.fingerprint,
|
|
327
354
|
},
|
|
328
355
|
);
|
|
329
356
|
if (existingImported && existingImported !== matchingAccount) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (wasManualImported) {
|
|
335
|
-
this.manualEmail = matchingAccount.email;
|
|
357
|
+
if (existingImported.importMode === "synthetic") {
|
|
358
|
+
changed = this.removeAccountRecord(existingImported) || changed;
|
|
359
|
+
} else {
|
|
360
|
+
changed = this.clearImportedLink(existingImported) || changed;
|
|
336
361
|
}
|
|
337
362
|
}
|
|
338
363
|
if (changed) {
|
|
@@ -342,7 +367,7 @@ export class AccountManager {
|
|
|
342
367
|
return changed;
|
|
343
368
|
}
|
|
344
369
|
|
|
345
|
-
if (existingImported) {
|
|
370
|
+
if (existingImported?.importMode === "synthetic") {
|
|
346
371
|
const target = this.getAccount(imported.identifier);
|
|
347
372
|
let changed = false;
|
|
348
373
|
if (!target && existingImported.email !== imported.identifier) {
|
|
@@ -354,6 +379,7 @@ export class AccountManager {
|
|
|
354
379
|
changed =
|
|
355
380
|
this.applyCredentials(existingImported, imported.credentials, {
|
|
356
381
|
importSource: "pi-openai-codex",
|
|
382
|
+
importMode: "synthetic",
|
|
357
383
|
importFingerprint: imported.fingerprint,
|
|
358
384
|
}) || changed;
|
|
359
385
|
if (changed) {
|
|
@@ -363,8 +389,17 @@ export class AccountManager {
|
|
|
363
389
|
return changed;
|
|
364
390
|
}
|
|
365
391
|
|
|
392
|
+
if (existingImported) {
|
|
393
|
+
const changed = this.clearImportedLink(existingImported);
|
|
394
|
+
if (changed) {
|
|
395
|
+
this.save();
|
|
396
|
+
this.notifyStateChanged();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
366
400
|
this.addOrUpdateAccount(imported.identifier, imported.credentials, {
|
|
367
401
|
importSource: "pi-openai-codex",
|
|
402
|
+
importMode: "synthetic",
|
|
368
403
|
importFingerprint: imported.fingerprint,
|
|
369
404
|
preserveActive: true,
|
|
370
405
|
});
|
package/commands.ts
CHANGED
|
@@ -354,7 +354,7 @@ async function openAccountManagementPanel(
|
|
|
354
354
|
new Text(
|
|
355
355
|
theme.fg(
|
|
356
356
|
"dim",
|
|
357
|
-
"
|
|
357
|
+
"enter: use u: refresh r: re-auth n: add backspace: remove esc: cancel",
|
|
358
358
|
),
|
|
359
359
|
1,
|
|
360
360
|
0,
|
package/package.json
CHANGED