@victor-software-house/pi-multicodex 2.1.0 → 2.1.2

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 CHANGED
@@ -60,11 +60,11 @@ The `/multicodex accounts` panel merges the old `show` and `use` flows into one
60
60
 
61
61
  ![MultiCodex use picker](./assets/multicodex-use-picker.png)
62
62
 
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.
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
 
@@ -32,6 +32,7 @@ export class AccountManager {
32
32
  private warningHandler?: WarningHandler;
33
33
  private manualEmail?: string;
34
34
  private stateChangeHandlers = new Set<StateChangeHandler>();
35
+ private warnedAuthFailureEmails = new Set<string>();
35
36
 
36
37
  constructor() {
37
38
  this.data = loadStorage();
@@ -83,6 +84,23 @@ export class AccountManager {
83
84
  this.warningHandler = handler;
84
85
  }
85
86
 
87
+ resetSessionWarnings(): void {
88
+ this.warnedAuthFailureEmails.clear();
89
+ }
90
+
91
+ notifyRotationSkipForAuthFailure(account: Account, error: unknown): void {
92
+ if (this.warnedAuthFailureEmails.has(account.email)) {
93
+ return;
94
+ }
95
+ this.warnedAuthFailureEmails.add(account.email);
96
+ const hint = account.importSource
97
+ ? "/multicodex reauth"
98
+ : `/multicodex reauth ${account.email}`;
99
+ this.warningHandler?.(
100
+ `Multicodex skipped ${account.email} during rotation: ${normalizeUnknownError(error)}. Account is flagged in /multicodex accounts. Run ${hint} to repair it.`,
101
+ );
102
+ }
103
+
86
104
  private updateAccountEmail(account: Account, email: string): boolean {
87
105
  if (account.email === email) return false;
88
106
  const previousEmail = account.email;
@@ -173,6 +191,7 @@ export class AccountManager {
173
191
  }
174
192
  if (account.needsReauth) {
175
193
  account.needsReauth = undefined;
194
+ this.warnedAuthFailureEmails.delete(account.email);
176
195
  changed = true;
177
196
  }
178
197
  return changed;
package/commands.ts CHANGED
@@ -354,7 +354,7 @@ async function openAccountManagementPanel(
354
354
  new Text(
355
355
  theme.fg(
356
356
  "dim",
357
- "Enter: use U: refresh R: re-auth N: add Backspace: remove Esc: cancel",
357
+ "enter: use u: refresh r: re-auth n: add backspace: remove esc: cancel",
358
358
  ),
359
359
  1,
360
360
  0,
package/extension.ts CHANGED
@@ -28,6 +28,7 @@ export default function multicodexExtension(pi: ExtensionAPI) {
28
28
 
29
29
  pi.on("session_start", (_event: unknown, ctx: ExtensionContext) => {
30
30
  lastContext = ctx;
31
+ accountManager.resetSessionWarnings();
31
32
  handleSessionStart(accountManager, (msg) => ctx.ui.notify(msg, "warning"));
32
33
  statusController.startAutoRefresh();
33
34
  void (async () => {
@@ -41,6 +42,7 @@ export default function multicodexExtension(pi: ExtensionAPI) {
41
42
  (event: { reason?: string }, ctx: ExtensionContext) => {
42
43
  lastContext = ctx;
43
44
  if (event.reason === "new") {
45
+ accountManager.resetSessionWarnings();
44
46
  handleNewSessionSwitch(accountManager, (msg) =>
45
47
  ctx.ui.notify(msg, "warning"),
46
48
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@victor-software-house/pi-multicodex",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Codex account rotation extension for pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/stream-wrapper.ts CHANGED
@@ -68,6 +68,7 @@ export function createStreamWrapper(
68
68
  try {
69
69
  token = await accountManager.ensureValidToken(account);
70
70
  } catch (error) {
71
+ accountManager.notifyRotationSkipForAuthFailure(account, error);
71
72
  if (usingManual) {
72
73
  accountManager.clearManualAccount();
73
74
  }