omp-multi-auth 1.4.2 → 1.4.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 +2 -0
- package/extensions/lib/quota.ts +7 -4
- package/extensions/lib/ui.ts +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,6 +40,8 @@ omp install git:github.com/tuandinh0801/omp-multi-auth
|
|
|
40
40
|
| `/multi-auth status` | Show account and authentication status |
|
|
41
41
|
| `/multi-auth limits` | Check provider quota and usage |
|
|
42
42
|
|
|
43
|
+
On OMP 19's legacy extension bridge, account menus use OMP's built-in selection dialog and quota checks show a progress notification.
|
|
44
|
+
|
|
43
45
|
### `/multi-auth-preset`
|
|
44
46
|
|
|
45
47
|
| Command | Description |
|
package/extensions/lib/quota.ts
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// ========================================================================
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import type { ExtensionCommandContext, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
|
|
6
|
-
import
|
|
6
|
+
import * as agent from "@oh-my-pi/pi-coding-agent";
|
|
7
7
|
import type { Api, Model } from "@oh-my-pi/pi-ai";
|
|
8
8
|
import { getBaseProvider, subDisplayName, PROVIDER_TEMPLATES } from "./providers.ts";
|
|
9
9
|
import { getAuthStorage, adaptAuthStorage, getModels, subProviderName, type AuthStorageEntry, type MultiAuthConfig, type QuotaAccount, type QuotaCheckResult, type QuotaStatusKind, type ProviderQuotaChecker, type AuthStorage } from "./core.ts";
|
|
10
10
|
import { loadGlobalConfig, loadProjectConfig, parseEnvConfig, mergeConfigs, normalizeEntries } from "./config.ts";
|
|
11
|
-
import {
|
|
11
|
+
import { showWrappedSelect } from "./ui.ts";
|
|
12
12
|
import type { SelectItem } from "@oh-my-pi/pi-tui";
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_CODEX_USAGE_BASE_URL = "https://chatgpt.com/backend-api";
|
|
@@ -426,7 +426,10 @@ export async function loadQuotaResults(
|
|
|
426
426
|
accounts: QuotaAccount[],
|
|
427
427
|
authStorage: AuthStorage,
|
|
428
428
|
): Promise<QuotaCheckResult[] | null> {
|
|
429
|
-
|
|
429
|
+
const { BorderedLoader } = agent;
|
|
430
|
+
const message = `Checking limits across ${accounts.length} ${accounts.length === 1 ? "account" : "accounts"}...`;
|
|
431
|
+
if (!ctx.hasUI || !BorderedLoader) {
|
|
432
|
+
if (ctx.hasUI) ctx.ui.notify(message, "info");
|
|
430
433
|
return runQuotaChecks(accounts, authStorage);
|
|
431
434
|
}
|
|
432
435
|
|
|
@@ -434,7 +437,7 @@ export async function loadQuotaResults(
|
|
|
434
437
|
const loader = new BorderedLoader(
|
|
435
438
|
tui,
|
|
436
439
|
theme,
|
|
437
|
-
|
|
440
|
+
message,
|
|
438
441
|
);
|
|
439
442
|
loader.onAbort = () => done(null);
|
|
440
443
|
|
package/extensions/lib/ui.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// Shared TUI select helpers.
|
|
2
2
|
import type { ExtensionCommandContext } from "@oh-my-pi/pi-coding-agent";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import * as agent from "@oh-my-pi/pi-coding-agent";
|
|
4
|
+
import * as tuiComponents from "@oh-my-pi/pi-tui";
|
|
5
|
+
import type { SelectItem } from "@oh-my-pi/pi-tui";
|
|
6
|
+
|
|
7
|
+
const { DynamicBorder, keyHint } = agent;
|
|
8
|
+
const { Container, Key, SelectList, Text, matchesKey } = tuiComponents;
|
|
5
9
|
|
|
6
10
|
export function getWrappedSelectIndex(items: SelectItem[], value: string | undefined): number {
|
|
7
11
|
if (!value) return 0;
|
|
@@ -22,7 +26,8 @@ export async function showWrappedSelect(
|
|
|
22
26
|
): Promise<string | undefined> {
|
|
23
27
|
if (options.items.length === 0) return undefined;
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
// OMP 19's legacy bridge provides native dialogs but omits the TUI components.
|
|
30
|
+
if (!ctx.hasUI || !DynamicBorder || !keyHint || !Container || !Key || !SelectList || !Text || !matchesKey) {
|
|
26
31
|
const renderedItems = options.items.map((item) =>
|
|
27
32
|
item.description ? `${item.label} — ${item.description}` : item.label,
|
|
28
33
|
);
|
package/package.json
CHANGED