oc-codex-multi-auth 6.20.0 → 6.22.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/LICENSE +21 -21
- package/README.md +729 -568
- package/assets/icon.svg +7 -7
- package/assets/opencode-logo-ornate-dark.svg +18 -18
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +177 -177
- package/config/minimal-opencode.json +14 -14
- package/config/opencode-legacy.json +1496 -1496
- package/config/opencode-modern.json +555 -555
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +567 -102
- package/dist/index.js.map +1 -1
- package/dist/lib/account-display.d.ts +46 -0
- package/dist/lib/account-display.d.ts.map +1 -1
- package/dist/lib/account-display.js +263 -1
- package/dist/lib/account-display.js.map +1 -1
- package/dist/lib/accounts/persistence.d.ts +3 -1
- package/dist/lib/accounts/persistence.d.ts.map +1 -1
- package/dist/lib/accounts/persistence.js +27 -3
- package/dist/lib/accounts/persistence.js.map +1 -1
- package/dist/lib/accounts/stale-state.d.ts +1 -0
- package/dist/lib/accounts/stale-state.d.ts.map +1 -1
- package/dist/lib/accounts/stale-state.js +30 -0
- package/dist/lib/accounts/stale-state.js.map +1 -1
- package/dist/lib/accounts/warm-recovery.d.ts +8 -0
- package/dist/lib/accounts/warm-recovery.d.ts.map +1 -0
- package/dist/lib/accounts/warm-recovery.js +70 -0
- package/dist/lib/accounts/warm-recovery.js.map +1 -0
- package/dist/lib/accounts/warm-request.d.ts +2 -0
- package/dist/lib/accounts/warm-request.d.ts.map +1 -1
- package/dist/lib/accounts/warm-request.js +4 -2
- package/dist/lib/accounts/warm-request.js.map +1 -1
- package/dist/lib/accounts.d.ts +5 -1
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +22 -17
- package/dist/lib/accounts.js.map +1 -1
- package/dist/lib/auth/login-runner.d.ts.map +1 -1
- package/dist/lib/auth/login-runner.js +79 -2
- package/dist/lib/auth/login-runner.js.map +1 -1
- package/dist/lib/auto-update-checker.d.ts +17 -1
- package/dist/lib/auto-update-checker.d.ts.map +1 -1
- package/dist/lib/auto-update-checker.js +49 -3
- package/dist/lib/auto-update-checker.js.map +1 -1
- package/dist/lib/circuit-breaker.d.ts +5 -0
- package/dist/lib/circuit-breaker.d.ts.map +1 -1
- package/dist/lib/circuit-breaker.js +23 -6
- package/dist/lib/circuit-breaker.js.map +1 -1
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +9 -3
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/codex-reset.d.ts +7 -1
- package/dist/lib/codex-reset.d.ts.map +1 -1
- package/dist/lib/codex-reset.js +9 -2
- package/dist/lib/codex-reset.js.map +1 -1
- package/dist/lib/codex-usage.d.ts +7 -4
- package/dist/lib/codex-usage.d.ts.map +1 -1
- package/dist/lib/codex-usage.js +48 -13
- package/dist/lib/codex-usage.js.map +1 -1
- package/dist/lib/config.d.ts +77 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +190 -15
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/desktop-notifications.js +6 -6
- package/dist/lib/oauth-success.js +202 -202
- package/dist/lib/parallel-probe.d.ts.map +1 -1
- package/dist/lib/parallel-probe.js +2 -1
- package/dist/lib/parallel-probe.js.map +1 -1
- package/dist/lib/plan-allotment.d.ts +72 -0
- package/dist/lib/plan-allotment.d.ts.map +1 -0
- package/dist/lib/plan-allotment.js +142 -0
- package/dist/lib/plan-allotment.js.map +1 -0
- package/dist/lib/plugin-origin.d.ts +77 -0
- package/dist/lib/plugin-origin.d.ts.map +1 -0
- package/dist/lib/plugin-origin.js +301 -0
- package/dist/lib/plugin-origin.js.map +1 -0
- package/dist/lib/prompts/codex-opencode-bridge.js +67 -67
- package/dist/lib/prompts/codex.js +75 -75
- package/dist/lib/quota-display.d.ts +40 -0
- package/dist/lib/quota-display.d.ts.map +1 -0
- package/dist/lib/quota-display.js +45 -0
- package/dist/lib/quota-display.js.map +1 -0
- package/dist/lib/quota-notifications.d.ts +2 -1
- package/dist/lib/quota-notifications.d.ts.map +1 -1
- package/dist/lib/quota-notifications.js +43 -14
- package/dist/lib/quota-notifications.js.map +1 -1
- package/dist/lib/quota-overview.d.ts +253 -0
- package/dist/lib/quota-overview.d.ts.map +1 -0
- package/dist/lib/quota-overview.js +707 -0
- package/dist/lib/quota-overview.js.map +1 -0
- package/dist/lib/request/fetch-helpers.js +22 -18
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/response-handler.d.ts.map +1 -1
- package/dist/lib/request/response-handler.js +85 -43
- package/dist/lib/request/response-handler.js.map +1 -1
- package/dist/lib/request/retry-budget.d.ts +26 -0
- package/dist/lib/request/retry-budget.d.ts.map +1 -1
- package/dist/lib/request/retry-budget.js +43 -0
- package/dist/lib/request/retry-budget.js.map +1 -1
- package/dist/lib/rotation.d.ts +1 -1
- package/dist/lib/schemas.d.ts +67 -0
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +53 -0
- package/dist/lib/schemas.js.map +1 -1
- package/dist/lib/storage/backup.d.ts +33 -0
- package/dist/lib/storage/backup.d.ts.map +1 -1
- package/dist/lib/storage/backup.js +43 -7
- package/dist/lib/storage/backup.js.map +1 -1
- package/dist/lib/storage/credential-snapshots.d.ts +78 -0
- package/dist/lib/storage/credential-snapshots.d.ts.map +1 -0
- package/dist/lib/storage/credential-snapshots.js +302 -0
- package/dist/lib/storage/credential-snapshots.js.map +1 -0
- package/dist/lib/storage/export-import.d.ts.map +1 -1
- package/dist/lib/storage/export-import.js +7 -0
- package/dist/lib/storage/export-import.js.map +1 -1
- package/dist/lib/storage/flagged.d.ts.map +1 -1
- package/dist/lib/storage/flagged.js +23 -1
- package/dist/lib/storage/flagged.js.map +1 -1
- package/dist/lib/storage/load-save.d.ts +5 -0
- package/dist/lib/storage/load-save.d.ts.map +1 -1
- package/dist/lib/storage/load-save.js +61 -0
- package/dist/lib/storage/load-save.js.map +1 -1
- package/dist/lib/storage/normalize.d.ts.map +1 -1
- package/dist/lib/storage/normalize.js +38 -2
- package/dist/lib/storage/normalize.js.map +1 -1
- package/dist/lib/storage/paths.d.ts +1 -0
- package/dist/lib/storage/paths.d.ts.map +1 -1
- package/dist/lib/storage/paths.js +1 -1
- package/dist/lib/storage/paths.js.map +1 -1
- package/dist/lib/storage/state.d.ts +1 -0
- package/dist/lib/storage/state.d.ts.map +1 -1
- package/dist/lib/storage/state.js +12 -0
- package/dist/lib/storage/state.js.map +1 -1
- package/dist/lib/storage/test-home-guard.d.ts +35 -0
- package/dist/lib/storage/test-home-guard.d.ts.map +1 -0
- package/dist/lib/storage/test-home-guard.js +59 -0
- package/dist/lib/storage/test-home-guard.js.map +1 -0
- package/dist/lib/tools/codex-dashboard.d.ts.map +1 -1
- package/dist/lib/tools/codex-dashboard.js +3 -2
- package/dist/lib/tools/codex-dashboard.js.map +1 -1
- package/dist/lib/tools/codex-doctor.d.ts.map +1 -1
- package/dist/lib/tools/codex-doctor.js +16 -0
- package/dist/lib/tools/codex-doctor.js.map +1 -1
- package/dist/lib/tools/codex-health.d.ts.map +1 -1
- package/dist/lib/tools/codex-health.js +10 -2
- package/dist/lib/tools/codex-health.js.map +1 -1
- package/dist/lib/tools/codex-label.d.ts.map +1 -1
- package/dist/lib/tools/codex-label.js +1 -0
- package/dist/lib/tools/codex-label.js.map +1 -1
- package/dist/lib/tools/codex-limits.d.ts.map +1 -1
- package/dist/lib/tools/codex-limits.js +26 -10
- package/dist/lib/tools/codex-limits.js.map +1 -1
- package/dist/lib/tools/codex-list.d.ts.map +1 -1
- package/dist/lib/tools/codex-list.js +28 -3
- package/dist/lib/tools/codex-list.js.map +1 -1
- package/dist/lib/tools/codex-note.d.ts.map +1 -1
- package/dist/lib/tools/codex-note.js +4 -1
- package/dist/lib/tools/codex-note.js.map +1 -1
- package/dist/lib/tools/codex-pool.d.ts.map +1 -1
- package/dist/lib/tools/codex-pool.js +6 -2
- package/dist/lib/tools/codex-pool.js.map +1 -1
- package/dist/lib/tools/codex-refresh.d.ts.map +1 -1
- package/dist/lib/tools/codex-refresh.js +4 -1
- package/dist/lib/tools/codex-refresh.js.map +1 -1
- package/dist/lib/tools/codex-remove.d.ts.map +1 -1
- package/dist/lib/tools/codex-remove.js +1 -0
- package/dist/lib/tools/codex-remove.js.map +1 -1
- package/dist/lib/tools/codex-reset.d.ts.map +1 -1
- package/dist/lib/tools/codex-reset.js +53 -8
- package/dist/lib/tools/codex-reset.js.map +1 -1
- package/dist/lib/tools/codex-status.d.ts.map +1 -1
- package/dist/lib/tools/codex-status.js +25 -2
- package/dist/lib/tools/codex-status.js.map +1 -1
- package/dist/lib/tools/codex-switch.d.ts.map +1 -1
- package/dist/lib/tools/codex-switch.js +1 -0
- package/dist/lib/tools/codex-switch.js.map +1 -1
- package/dist/lib/tools/codex-tag.d.ts.map +1 -1
- package/dist/lib/tools/codex-tag.js +4 -1
- package/dist/lib/tools/codex-tag.js.map +1 -1
- package/dist/lib/tools/codex-warm.d.ts +2 -1
- package/dist/lib/tools/codex-warm.d.ts.map +1 -1
- package/dist/lib/tools/codex-warm.js +49 -5
- package/dist/lib/tools/codex-warm.js.map +1 -1
- package/dist/lib/tools/index.d.ts +10 -1
- package/dist/lib/tools/index.d.ts.map +1 -1
- package/dist/lib/tools/index.js.map +1 -1
- package/dist/lib/tui-quota-cache.d.ts +35 -0
- package/dist/lib/tui-quota-cache.d.ts.map +1 -1
- package/dist/lib/tui-quota-cache.js +79 -12
- package/dist/lib/tui-quota-cache.js.map +1 -1
- package/dist/lib/tui-quota-overview.d.ts +55 -0
- package/dist/lib/tui-quota-overview.d.ts.map +1 -0
- package/dist/lib/tui-quota-overview.js +209 -0
- package/dist/lib/tui-quota-overview.js.map +1 -0
- package/dist/lib/tui-status.d.ts +55 -0
- package/dist/lib/tui-status.d.ts.map +1 -1
- package/dist/lib/tui-status.js +155 -14
- package/dist/lib/tui-status.js.map +1 -1
- package/dist/lib/ui/auth-menu.d.ts +2 -0
- package/dist/lib/ui/auth-menu.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu.js +10 -6
- package/dist/lib/ui/auth-menu.js.map +1 -1
- package/dist/tui.d.ts +59 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +535 -43
- package/dist/tui.js.map +1 -1
- package/package.json +155 -155
- package/scripts/audit-dev-allowlist.js +114 -114
- package/scripts/clean-dist.js +27 -27
- package/scripts/copy-oauth-success.js +47 -47
- package/scripts/install-oc-codex-multi-auth-core.js +2003 -1469
- package/scripts/install-oc-codex-multi-auth.js +37 -37
- package/scripts/test-all-models.sh +260 -260
- package/scripts/validate-model-map.sh +97 -97
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One constant line describing the whole account pool.
|
|
3
|
+
*
|
|
4
|
+
* The prompt status line names whichever account served the most recent
|
|
5
|
+
* request, so on a pool of several accounts it changes identity as rotation
|
|
6
|
+
* moves - and a reader who wants to know where the pool stands has to watch it
|
|
7
|
+
* long enough to see every account go past. This module renders the pool
|
|
8
|
+
* instead: every account at once, in a fixed order, so the line only changes
|
|
9
|
+
* when the underlying quota does.
|
|
10
|
+
*
|
|
11
|
+
* ```text
|
|
12
|
+
* 24%: #1 5x 13%, #2 20x 100% 3d 1r, #3 1x 12%
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* The leading figure is the pool total, and it is a WEIGHTED mean rather than
|
|
16
|
+
* a plain one. A Pro seat spent to 50% has given up twenty times the capacity
|
|
17
|
+
* a Business Standard seat does at 50%, so averaging the percentages
|
|
18
|
+
* unweighted describes a pool nobody has; `lib/plan-allotment.ts` supplies the
|
|
19
|
+
* per-plan ratio the mean is taken over.
|
|
20
|
+
*
|
|
21
|
+
* Percentages follow `quotaDisplay` like every other surface, so the same pool
|
|
22
|
+
* reads `24%` as headroom or `76%` as consumption. Only the wording changes:
|
|
23
|
+
* every decision here - which window governs an account, which account is
|
|
24
|
+
* closest to recovering, whether a reset time is worth the characters - stays
|
|
25
|
+
* keyed on the percentage remaining.
|
|
26
|
+
*
|
|
27
|
+
* Everything below is pure string work over already-gathered readings, so the
|
|
28
|
+
* whole rendering can be exercised without a network, a clock or a terminal.
|
|
29
|
+
*/
|
|
30
|
+
import { toQuotaDisplayPercent, type QuotaDisplayMode } from "./quota-display.js";
|
|
31
|
+
/**
|
|
32
|
+
* Under `resetTimes: "low"`, only an account at or below this headroom gets
|
|
33
|
+
* its reset time printed.
|
|
34
|
+
*
|
|
35
|
+
* Every account has a reset, and printing all of them triples the length of
|
|
36
|
+
* the line to say "this account you are not waiting on recovers at some point
|
|
37
|
+
* too". The threshold matches the one the single-account status line already
|
|
38
|
+
* uses to decide the same question, so an account near exhaustion reads the
|
|
39
|
+
* same way in either mode. `resetTimes: "always"` opts out of the threshold,
|
|
40
|
+
* because 90% spent with an hour to go and 90% spent with six days to go are
|
|
41
|
+
* not the same situation.
|
|
42
|
+
*/
|
|
43
|
+
export declare const OVERVIEW_RESET_LEFT_PERCENT = 25;
|
|
44
|
+
export type QuotaOverviewWindow = {
|
|
45
|
+
/** Percentage of this window still free, 0-100. */
|
|
46
|
+
leftPercent?: number;
|
|
47
|
+
resetAtMs?: number;
|
|
48
|
+
};
|
|
49
|
+
export type QuotaOverviewAccount = {
|
|
50
|
+
/** 1-based position, as `codex-list` and `codex-switch` number accounts. */
|
|
51
|
+
index: number;
|
|
52
|
+
/**
|
|
53
|
+
* The account's own name for itself: a `codex-label` label when one is
|
|
54
|
+
* set, otherwise whatever identity the account storage carries. May be an
|
|
55
|
+
* email address, which is why every rendering of it goes through
|
|
56
|
+
* {@link resolveAccountName} rather than printing it directly.
|
|
57
|
+
*/
|
|
58
|
+
label?: string;
|
|
59
|
+
/** ChatGPT email, used by the reset-credit line and as a label fallback. */
|
|
60
|
+
email?: string;
|
|
61
|
+
/** `plan_type` as reported by `/wham/usage`, used for the weighting only. */
|
|
62
|
+
planType?: string;
|
|
63
|
+
windows: readonly QuotaOverviewWindow[];
|
|
64
|
+
/** Banked rate-limit resets redeemable now, rendered as `1r`. */
|
|
65
|
+
resetCredits?: number;
|
|
66
|
+
};
|
|
67
|
+
/** How the accounts are arranged on the line. */
|
|
68
|
+
export type QuotaOverviewLayout =
|
|
69
|
+
/** One segment per account: `#1 13%, #2 100% 3d`. */
|
|
70
|
+
"accounts"
|
|
71
|
+
/** Accounts sharing a percentage collapse: `100% 3d 4d 5d`. */
|
|
72
|
+
| "aggregate"
|
|
73
|
+
/** No accounts at all, just how many there are: `3 accounts`. */
|
|
74
|
+
| "count";
|
|
75
|
+
/** What identifies an account on the line. */
|
|
76
|
+
export type QuotaOverviewNames =
|
|
77
|
+
/** `#1`, the number `codex-switch` takes. */
|
|
78
|
+
"number"
|
|
79
|
+
/** The account's label, or its email's local part: `damian`, `work`. */
|
|
80
|
+
| "label"
|
|
81
|
+
/** Nothing; the accounts are told apart by position alone. */
|
|
82
|
+
| "none";
|
|
83
|
+
/** The order accounts appear in. */
|
|
84
|
+
export type QuotaOverviewOrder = "number"
|
|
85
|
+
/** Least headroom first - the accounts rotation is about to stop using. */
|
|
86
|
+
| "most-used"
|
|
87
|
+
/** Most headroom first - the accounts with work left in them. */
|
|
88
|
+
| "least-used"
|
|
89
|
+
/** Soonest reset first. Accounts with no known reset sort last. */
|
|
90
|
+
| "renewing-earliest"
|
|
91
|
+
/** Latest reset first, which is redemption order for a banked reset. */
|
|
92
|
+
| "renewing-latest";
|
|
93
|
+
/** Which accounts get a reset countdown printed beside them. */
|
|
94
|
+
export type QuotaOverviewResetTimes = "never"
|
|
95
|
+
/** Only accounts at or below {@link OVERVIEW_RESET_LEFT_PERCENT}. */
|
|
96
|
+
| "low" | "always";
|
|
97
|
+
export type QuotaOverviewOptions = {
|
|
98
|
+
mode: QuotaDisplayMode;
|
|
99
|
+
layout: QuotaOverviewLayout;
|
|
100
|
+
names: QuotaOverviewNames;
|
|
101
|
+
order: QuotaOverviewOrder;
|
|
102
|
+
/** `5x` / `20x` allotment badges beside each account. */
|
|
103
|
+
multipliers: boolean;
|
|
104
|
+
/** `66% of 65x`: what the pool the percentage is taken over adds up to. */
|
|
105
|
+
allotment: boolean;
|
|
106
|
+
resetTimes: QuotaOverviewResetTimes;
|
|
107
|
+
/** `1r` for redeemable banked resets. */
|
|
108
|
+
resetCredits: boolean;
|
|
109
|
+
/** `+12% in 3d`: how far the pool total moves at the next reset. */
|
|
110
|
+
recovery: boolean;
|
|
111
|
+
/** Masks any email this line would otherwise print in full. */
|
|
112
|
+
maskEmail?: boolean;
|
|
113
|
+
now?: number;
|
|
114
|
+
};
|
|
115
|
+
export type QuotaOverviewRecovery = {
|
|
116
|
+
/**
|
|
117
|
+
* Pool-total movement at {@link atMs}, in percentage points, always
|
|
118
|
+
* positive - it is capacity returning. The rendered sign follows the
|
|
119
|
+
* display mode, since the number a reader is watching moves up under
|
|
120
|
+
* `free` and down under `used`.
|
|
121
|
+
*/
|
|
122
|
+
deltaPercent: number;
|
|
123
|
+
atMs: number;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Render a duration the way a countdown reads: the largest unit that fits,
|
|
127
|
+
* floored, so `2d` never claims more time remains than actually does. A gap
|
|
128
|
+
* under a minute still reads `1m` rather than `0m`, because a reset that has
|
|
129
|
+
* not happened yet is not zero away.
|
|
130
|
+
*/
|
|
131
|
+
export declare function formatCompactDuration(ms: number): string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* The window that decides what an account can still do.
|
|
134
|
+
*
|
|
135
|
+
* An account reports several windows at once - typically a 5-hour and a weekly
|
|
136
|
+
* one - and the one with the least headroom is the one that stops a request,
|
|
137
|
+
* so it is the one the account is described by. On a tie the window that
|
|
138
|
+
* blocks for longer governs: two windows both fully spent are not equally
|
|
139
|
+
* costly when one returns in four hours and the other in three days.
|
|
140
|
+
*/
|
|
141
|
+
export declare function resolveGoverningWindow(account: QuotaOverviewAccount): QuotaOverviewWindow | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Weighted mean headroom across the pool, or `undefined` when no account
|
|
144
|
+
* reported a readable window.
|
|
145
|
+
*
|
|
146
|
+
* Accounts with no readable window are left out rather than counted as full:
|
|
147
|
+
* a quota we could not read is not capacity we know we have.
|
|
148
|
+
*/
|
|
149
|
+
export declare function computeWeightedLeftPercent(accounts: readonly QuotaOverviewAccount[]): number | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* What the pool the percentage is taken over adds up to, in 1x seats.
|
|
152
|
+
*
|
|
153
|
+
* Deliberately the same sum {@link computeWeightedLeftPercent} divides by, and
|
|
154
|
+
* over the same accounts, so `66% of 65x` is one statement rather than two
|
|
155
|
+
* that can disagree. An account whose plan states no ratio therefore
|
|
156
|
+
* contributes its fallback weight here exactly as it does to the mean.
|
|
157
|
+
*/
|
|
158
|
+
export declare function computePoolAllotment(accounts: readonly QuotaOverviewAccount[]): number | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* The next moment the pool gets capacity back, and how much.
|
|
161
|
+
*
|
|
162
|
+
* Only the window that actually resets is refilled, and the account's
|
|
163
|
+
* governing window is then resolved again: an account whose 5-hour window
|
|
164
|
+
* resets while its weekly window is still spent gains nothing, and reporting
|
|
165
|
+
* the 5-hour refill as pool recovery would promise headroom that does not
|
|
166
|
+
* arrive. Movement below one point is dropped rather than rendered as `+0%`.
|
|
167
|
+
*/
|
|
168
|
+
export declare function resolveQuotaOverviewRecovery(accounts: readonly QuotaOverviewAccount[], now?: number): QuotaOverviewRecovery | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Whether nothing in the pool has capacity left.
|
|
171
|
+
*
|
|
172
|
+
* This is the condition the reset-credit line exists for: while any account
|
|
173
|
+
* can still serve a request, which one recovers when is a detail, and once
|
|
174
|
+
* none can it is the only question left. Accounts whose quota could not be
|
|
175
|
+
* read do not count either way - an unknown reading is not evidence of
|
|
176
|
+
* exhaustion, but it is not capacity either, so a pool of nothing but
|
|
177
|
+
* unreadable accounts is reported as not spent rather than as dead.
|
|
178
|
+
*/
|
|
179
|
+
export declare function isPoolFullySpent(accounts: readonly QuotaOverviewAccount[]): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Arrange the accounts for display.
|
|
182
|
+
*
|
|
183
|
+
* Every comparison falls back to the account number, so two accounts reading
|
|
184
|
+
* the same percentage never trade places between renders. An order that let
|
|
185
|
+
* them would reintroduce exactly the movement this mode exists to remove.
|
|
186
|
+
*/
|
|
187
|
+
export declare function orderOverviewAccounts(accounts: readonly QuotaOverviewAccount[], order: QuotaOverviewOrder): QuotaOverviewAccount[];
|
|
188
|
+
/**
|
|
189
|
+
* What this account is called on the line.
|
|
190
|
+
*
|
|
191
|
+
* Under `label` a user-set label wins, because it is the one name the user
|
|
192
|
+
* chose; an account that only knows its email falls back to that email's local
|
|
193
|
+
* part, and an account with neither falls back to its number rather than
|
|
194
|
+
* rendering nothing - a nameless segment in a named line reads as a missing
|
|
195
|
+
* account.
|
|
196
|
+
*/
|
|
197
|
+
export declare function resolveAccountName(account: QuotaOverviewAccount, names: QuotaOverviewNames, maskEmail?: boolean): string | undefined;
|
|
198
|
+
/** `3 accounts` -> `3 acct.` -> `3`, in the order they are given up. */
|
|
199
|
+
export type QuotaOverviewCountStyle = "long" | "short" | "bare";
|
|
200
|
+
/**
|
|
201
|
+
* Every rendering of this pool, longest first.
|
|
202
|
+
*
|
|
203
|
+
* The caller takes the first that fits its width. Detail is dropped in the
|
|
204
|
+
* order that costs a reader the least: the recovery clause and then the
|
|
205
|
+
* annotations (badges, banked resets) that sit beside a figure which stays
|
|
206
|
+
* either way, then the per-account breakdown, leaving the pool total - the one
|
|
207
|
+
* thing the line exists to say - as the last to go.
|
|
208
|
+
*
|
|
209
|
+
* Order is preference, NOT length: a stripped-down rung is occasionally a
|
|
210
|
+
* character or two longer than the rung above it. Sorting by length instead
|
|
211
|
+
* would let a form win or lose by two characters as a percentage crosses from
|
|
212
|
+
* `9%` to `10%`, and the line would change shape while the reader watches -
|
|
213
|
+
* the flicker this whole mode exists to remove.
|
|
214
|
+
*
|
|
215
|
+
* Candidates never exceed what {@link QuotaOverviewOptions} asked for, so a
|
|
216
|
+
* switch left off cannot reappear because the terminal happened to be wide.
|
|
217
|
+
*/
|
|
218
|
+
export declare function formatQuotaOverviewCandidates(accounts: readonly QuotaOverviewAccount[], options: QuotaOverviewOptions): string[];
|
|
219
|
+
/** The fullest rendering, for surfaces with a line to themselves. */
|
|
220
|
+
export declare function formatQuotaOverviewText(accounts: readonly QuotaOverviewAccount[], options: QuotaOverviewOptions): string;
|
|
221
|
+
/**
|
|
222
|
+
* Every rendering of the banked reset credits, longest first.
|
|
223
|
+
*
|
|
224
|
+
* ```text
|
|
225
|
+
* Free resets: 6d 1r damian@nowaker.net, 4d 2r work@example.com
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* Sorted by the LATEST reset first, which is redemption order rather than
|
|
229
|
+
* reading order: redeeming a credit on an account that renews by itself
|
|
230
|
+
* tomorrow throws the credit away, while the account six days out is the one
|
|
231
|
+
* worth spending it on.
|
|
232
|
+
*
|
|
233
|
+
* Returns nothing at all unless the pool is spent and something is redeemable.
|
|
234
|
+
* A reset credit is only an answer to "everything is used up"; offered while
|
|
235
|
+
* accounts still have headroom it is an invitation to waste it.
|
|
236
|
+
*/
|
|
237
|
+
export declare function formatQuotaResetsCandidates(accounts: readonly QuotaOverviewAccount[], options: Pick<QuotaOverviewOptions, "maskEmail"> & {
|
|
238
|
+
names?: QuotaOverviewNames;
|
|
239
|
+
now?: number;
|
|
240
|
+
}): string[];
|
|
241
|
+
/**
|
|
242
|
+
* Headroom of the account with the most room left, for the caller that
|
|
243
|
+
* colours the line.
|
|
244
|
+
*
|
|
245
|
+
* Deliberately the best account rather than the worst: a pool is only in
|
|
246
|
+
* trouble when nothing in it has room left, and keying on the worst account
|
|
247
|
+
* would paint the line red for one spent seat that rotation has already
|
|
248
|
+
* stopped selecting while every other account serves requests normally.
|
|
249
|
+
*/
|
|
250
|
+
export declare function resolveQuotaOverviewTonePercent(accounts: readonly QuotaOverviewAccount[]): number | undefined;
|
|
251
|
+
/** Re-exported so callers rendering a bare total need only this module. */
|
|
252
|
+
export { toQuotaDisplayPercent };
|
|
253
|
+
//# sourceMappingURL=quota-overview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-overview.d.ts","sourceRoot":"","sources":["../../lib/quota-overview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAEN,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAK9C,MAAM,MAAM,mBAAmB,GAAG;IACjC,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACxC,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,mBAAmB;AAC9B,qDAAqD;AACnD,UAAU;AACZ,+DAA+D;GAC7D,WAAW;AACb,iEAAiE;GAC/D,OAAO,CAAC;AAEX,8CAA8C;AAC9C,MAAM,MAAM,kBAAkB;AAC7B,6CAA6C;AAC3C,QAAQ;AACV,wEAAwE;GACtE,OAAO;AACT,8DAA8D;GAC5D,MAAM,CAAC;AAEV,oCAAoC;AACpC,MAAM,MAAM,kBAAkB,GAC3B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