@cortexkit/opencode-antigravity-auth 3.0.6 → 3.0.8
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/cli.js +1621 -183
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +228 -62
- package/dist/index.js +2728 -883
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +291 -104
- package/dist/server.js +2255 -390
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/availability.d.ts +89 -0
- package/dist/src/common-auth-embedded/claustrum/availability.js +106 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +41 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.js +152 -6
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +135 -14
- package/dist/src/common-auth-embedded/claustrum/custody.js +311 -16
- package/dist/src/common-auth-embedded/claustrum/errors.d.ts +1 -0
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +5 -3
- package/dist/src/common-auth-embedded/claustrum/index.js +4 -1
- package/dist/src/common-auth-embedded/claustrum/insula.d.ts +48 -0
- package/dist/src/common-auth-embedded/claustrum/insula.js +286 -21
- package/dist/src/common-auth-embedded/claustrum/watch.d.ts +141 -0
- package/dist/src/common-auth-embedded/claustrum/watch.js +254 -0
- package/dist/src/common-auth-embedded/fs/private-files.js +10 -2
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +6 -1
- package/dist/src/common-auth-embedded/pi-slot/lock.js +7 -3
- package/dist/src/common-auth-embedded/quota/format.d.ts +17 -3
- package/dist/src/common-auth-embedded/quota/format.js +203 -18
- package/dist/src/common-auth-embedded/quota/index.d.ts +2 -2
- package/dist/src/common-auth-embedded/quota/index.js +1 -1
- package/dist/src/common-auth-embedded/quota/projection.d.ts +16 -0
- package/dist/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/dist/src/common-auth-embedded/setup/command-error.js +79 -0
- package/dist/src/common-auth-embedded/setup/command-runner.js +118 -24
- package/dist/src/common-auth-embedded/setup/command.js +75 -19
- package/dist/src/common-auth-embedded/setup/enroll.js +17 -5
- package/dist/src/common-auth-embedded/setup/index.d.ts +2 -1
- package/dist/src/common-auth-embedded/setup/index.js +1 -0
- package/dist/src/common-auth-embedded/setup/register.js +8 -2
- package/dist/src/common-auth-embedded/setup/types.d.ts +14 -0
- package/dist/src/common-auth-embedded/source-output.json +142 -94
- package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/dist/src/common-auth-embedded/store/pool.js +0 -1
- package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/dist/src/common-auth-embedded/store/refresh-lock.js +0 -1
- package/dist/src/ga/server/index.d.ts +2 -0
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +18 -3
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +37 -3
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/auth-loader.d.ts +2 -1
- package/dist/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/src/plugin/auth-loader.js +5 -4
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +2 -1
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts +2 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +8 -6
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +7 -3
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +2 -5
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +3 -3
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/src/plugin/logging-utils.js +2 -5
- package/dist/src/plugin/logging-utils.js.map +1 -1
- package/dist/src/plugin/request.d.ts +1 -2
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +8 -12
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/after-handoff.d.ts +14 -0
- package/dist/src/plugin/shared/after-handoff.d.ts.map +1 -0
- package/dist/src/plugin/shared/after-handoff.js +89 -0
- package/dist/src/plugin/shared/after-handoff.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +16 -3
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +193 -90
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +13 -4
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +17 -1
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts +16 -1
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +60 -10
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/sidebar-projection.d.ts +4 -0
- package/dist/src/sidebar-projection.d.ts.map +1 -1
- package/dist/src/sidebar-projection.js +6 -2
- package/dist/src/sidebar-projection.js.map +1 -1
- package/dist/src/tui/quota-layout.d.ts +94 -0
- package/dist/src/tui/quota-layout.d.ts.map +1 -0
- package/dist/src/tui/quota-layout.js +139 -0
- package/dist/src/tui/quota-layout.js.map +1 -0
- package/dist/src/tui/route-layout.d.ts +8 -0
- package/dist/src/tui/route-layout.d.ts.map +1 -0
- package/dist/src/tui/route-layout.js +36 -0
- package/dist/src/tui/route-layout.js.map +1 -0
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +105 -191
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +60 -31
- package/dist/tui-ga-build-map.json +46 -17
- package/dist/types/src/common-auth-embedded/claustrum/availability.d.ts +89 -0
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +41 -1
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +135 -14
- package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +1 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +5 -3
- package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +48 -0
- package/dist/types/src/common-auth-embedded/claustrum/watch.d.ts +141 -0
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +17 -3
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +2 -2
- package/dist/types/src/common-auth-embedded/quota/projection.d.ts +16 -0
- package/dist/types/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/dist/types/src/common-auth-embedded/setup/index.d.ts +2 -1
- package/dist/types/src/common-auth-embedded/setup/types.d.ts +14 -0
- package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/dist/types/src/ga/server/index.d.ts +2 -0
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/auth-loader.d.ts +2 -1
- package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts +2 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts +1 -2
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/after-handoff.d.ts +14 -0
- package/dist/types/src/plugin/shared/after-handoff.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +16 -3
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +13 -4
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts +16 -1
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/common-auth-embedded/claustrum/availability.d.ts +89 -0
- package/src/common-auth-embedded/claustrum/availability.js +106 -0
- package/src/common-auth-embedded/claustrum/consumer.d.ts +41 -1
- package/src/common-auth-embedded/claustrum/consumer.js +152 -6
- package/src/common-auth-embedded/claustrum/custody.d.ts +135 -14
- package/src/common-auth-embedded/claustrum/custody.js +311 -16
- package/src/common-auth-embedded/claustrum/errors.d.ts +1 -0
- package/src/common-auth-embedded/claustrum/index.d.ts +5 -3
- package/src/common-auth-embedded/claustrum/index.js +4 -1
- package/src/common-auth-embedded/claustrum/insula.d.ts +48 -0
- package/src/common-auth-embedded/claustrum/insula.js +286 -21
- package/src/common-auth-embedded/claustrum/watch.d.ts +141 -0
- package/src/common-auth-embedded/claustrum/watch.js +254 -0
- package/src/common-auth-embedded/fs/private-files.js +10 -2
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/src/common-auth-embedded/fs/refresh-file-lock.js +6 -1
- package/src/common-auth-embedded/pi-slot/lock.js +7 -3
- package/src/common-auth-embedded/quota/format.d.ts +17 -3
- package/src/common-auth-embedded/quota/format.js +203 -18
- package/src/common-auth-embedded/quota/index.d.ts +2 -2
- package/src/common-auth-embedded/quota/index.js +1 -1
- package/src/common-auth-embedded/quota/projection.d.ts +16 -0
- package/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/src/common-auth-embedded/setup/command-error.js +79 -0
- package/src/common-auth-embedded/setup/command-runner.js +118 -24
- package/src/common-auth-embedded/setup/command.js +75 -19
- package/src/common-auth-embedded/setup/enroll.js +17 -5
- package/src/common-auth-embedded/setup/index.d.ts +2 -1
- package/src/common-auth-embedded/setup/index.js +1 -0
- package/src/common-auth-embedded/setup/register.js +8 -2
- package/src/common-auth-embedded/setup/types.d.ts +14 -0
- package/src/common-auth-embedded/source-output.json +142 -94
- package/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/src/common-auth-embedded/store/pool.js +0 -1
- package/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/src/common-auth-embedded/store/refresh-lock.js +0 -1
- package/src/tui-compiled/common-auth-embedded/fs/private-files.js +10 -2
- package/src/tui-compiled/common-auth-embedded/quota/format.js +203 -18
- package/src/tui-compiled/common-auth-embedded/quota/index.js +1 -1
- package/src/tui-compiled/tui/quota-layout.js +378 -0
- package/src/tui-compiled/tui/route-layout.js +30 -0
- package/src/tui-compiled/tui.js +245 -501
- package/src/tui-ga-compiled/host-ga.js +82 -52
- package/src/tui-ga-compiled/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
- package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +203 -18
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +1 -1
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +378 -0
- package/src/tui-ga-raw/host-ga.tsx +71 -30
- package/src/tui-ga-raw/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
- package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +203 -18
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +1 -1
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +391 -0
- package/src/tui-raw/common-auth-embedded/fs/private-files.js +10 -2
- package/src/tui-raw/common-auth-embedded/quota/format.js +203 -18
- package/src/tui-raw/common-auth-embedded/quota/index.js +1 -1
- package/src/tui-raw/tui/quota-layout.tsx +391 -0
- package/src/tui-raw/tui/route-layout.js +30 -0
- package/src/tui-raw/tui.tsx +171 -411
- package/src/tui.tsx +171 -411
package/src/tui-compiled/tui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
1
2
|
import { createTextNode as _$createTextNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
2
3
|
import { use as _$use } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
3
|
-
import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
4
4
|
import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
5
5
|
import { effect as _$effect } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
6
6
|
import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
@@ -22,14 +22,16 @@ import { createElement as _$createElement } from "opentui:runtime-module:%40open
|
|
|
22
22
|
* score, and per-session routing decisions), so the fleet components are
|
|
23
23
|
* adapted rather than copied verbatim:
|
|
24
24
|
*
|
|
25
|
-
* -
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* - The quota rows come from `tui/quota-layout.tsx`, shared with the
|
|
26
|
+
* OpenCode 2 sidebar: each window reads `remainingPercent + resetAt` from
|
|
27
|
+
* the Antigravity `SidebarQuotaEntry` shape, is colored via `quotaTone`
|
|
28
|
+
* (remaining threshold) instead of `usageTone` (used threshold), and is
|
|
29
|
+
* one line sized from the measured sidebar width.
|
|
29
30
|
* - `AccountBlock` derives its status word (`active` / `idle` /
|
|
30
|
-
* `cooling` / `off`) from the Antigravity account state
|
|
31
|
-
* reading age once per account
|
|
32
|
-
* `Other models` headers. The routing health score is not
|
|
31
|
+
* `cooling` / `off`) from the Antigravity account state; the shared block
|
|
32
|
+
* shows the reading age once per account and groups windows under
|
|
33
|
+
* `Gemini` and `Other models` headers. The routing health score is not
|
|
34
|
+
* shown.
|
|
33
35
|
* - `Routing` shows the mounted session's most recent `activeRouting`
|
|
34
36
|
* entry, or `No request yet` before the session's first request, since
|
|
35
37
|
* Antigravity does not maintain a per-session sidebar state alongside the
|
|
@@ -50,12 +52,14 @@ import { readFileSync } from "node:fs";
|
|
|
50
52
|
import { dirname, join } from "node:path";
|
|
51
53
|
import { fileURLToPath } from "node:url";
|
|
52
54
|
import { createSlot } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
53
|
-
import { createSignal, For, onCleanup, onMount, Show } from "opentui:runtime-module:solid-js";
|
|
54
|
-
import {
|
|
55
|
+
import { createMemo, createSignal, For, onCleanup, onMount, Show } from "opentui:runtime-module:solid-js";
|
|
56
|
+
import { formatQuota, isQuotaStale } from "./common-auth-embedded/quota/index.js";
|
|
55
57
|
import { getRpcDir } from "./rpc/rpc-dir.js";
|
|
56
58
|
import { readSidebarState } from "./sidebar-state.js";
|
|
57
59
|
import { createTuiFileLogger } from "./tui/file-logger.js";
|
|
58
60
|
import { createV1MenuTransport, dispatchV1Notification } from "./tui/host-v1.js";
|
|
61
|
+
import { ASSUMED_CONTENT_WIDTH, accountWindows, fitLabel, GROUP_NAMES, QUOTA_ORDER, QuotaAccountBlock, quotaTone } from "./tui/quota-layout.js";
|
|
62
|
+
import { routeLineFits } from "./tui/route-layout.js";
|
|
59
63
|
import { computeEffectiveOrder, DEFAULT_PREFS, DEFAULT_SLOT_ORDER, PLUGIN_KEY, queueTuiPreferenceUpdate, readTuiPreferencesFile, resolveAntigravityAuthPrefs, watchTuiPreferences } from "./tui-preferences.js";
|
|
60
64
|
const ID = 'cortexkit.antigravity-auth';
|
|
61
65
|
const POLL_INTERVAL_MS = 2000;
|
|
@@ -102,35 +106,6 @@ let rpcInFlight = false;
|
|
|
102
106
|
const GLOBAL_NOTIFICATION_CURSOR = '__global__';
|
|
103
107
|
const MAX_NOTIFICATION_CURSORS = 256;
|
|
104
108
|
|
|
105
|
-
// Group headers name each quota pool in plain words.
|
|
106
|
-
const GROUP_NAMES = {
|
|
107
|
-
gemini: 'Gemini',
|
|
108
|
-
'non-gemini': 'Other models'
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// The collapsed row has room for one word before the window name.
|
|
112
|
-
const COLLAPSED_GROUP_NAMES = {
|
|
113
|
-
gemini: 'Gemini',
|
|
114
|
-
'non-gemini': 'Other'
|
|
115
|
-
};
|
|
116
|
-
const QUOTA_ORDER = ['gemini', 'non-gemini'];
|
|
117
|
-
|
|
118
|
-
// Shown instead of a stored figure once the window has reset since it was
|
|
119
|
-
// read: the stored figure describes the window before the reset.
|
|
120
|
-
const RESET_SINCE_READING = 'reset since last check';
|
|
121
|
-
|
|
122
|
-
// Content width (the panel's width inside its padding) used until the first
|
|
123
|
-
// layout pass reports the real one. It fits the narrowest OpenCode sidebar.
|
|
124
|
-
const ASSUMED_CONTENT_WIDTH = 28;
|
|
125
|
-
|
|
126
|
-
// A window row is `<name> <bar> <figure> <reset>`. The bar shrinks to this
|
|
127
|
-
// before the reset column is dropped; below it the bar is dropped too.
|
|
128
|
-
const MIN_BAR_WIDTH = 4;
|
|
129
|
-
// The widest figure the formatter writes: `100% left`.
|
|
130
|
-
const FIGURE_WIDTH = 9;
|
|
131
|
-
// A window name (`5h`, `7d`) and the space after it.
|
|
132
|
-
const NAME_WIDTH = 3;
|
|
133
|
-
|
|
134
109
|
// --- Theme tokens ----------------------------------------------------------
|
|
135
110
|
//
|
|
136
111
|
// The sidebar pulls its colors from the live host theme (`api.theme.current`
|
|
@@ -218,21 +193,16 @@ function toneColor(theme, tone) {
|
|
|
218
193
|
return theme.text;
|
|
219
194
|
}
|
|
220
195
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
tone
|
|
232
|
-
}, {
|
|
233
|
-
text: appearance.barEmptyChar.repeat(width - usedCells),
|
|
234
|
-
tone
|
|
235
|
-
}].filter(segment => segment.text.length > 0);
|
|
196
|
+
|
|
197
|
+
// The shared quota layout reads its colors through this palette. Muted text
|
|
198
|
+
// and the account label read `textMuted` and `text` straight from the theme,
|
|
199
|
+
// without the `toneColor` fallback chain.
|
|
200
|
+
function themePalette(theme) {
|
|
201
|
+
return {
|
|
202
|
+
text: () => theme().text,
|
|
203
|
+
muted: () => theme().textMuted,
|
|
204
|
+
tone: tone => toneColor(theme(), tone)
|
|
205
|
+
};
|
|
236
206
|
}
|
|
237
207
|
const EMPTY_STATE = {
|
|
238
208
|
version: 2,
|
|
@@ -415,8 +385,8 @@ function StatRow(props) {
|
|
|
415
385
|
}
|
|
416
386
|
|
|
417
387
|
// Fleet CollapsedRow: muted label left, caller-supplied value right. The
|
|
418
|
-
// collapsed view renders one for
|
|
419
|
-
// sides to the measured width, so neither side may wrap.
|
|
388
|
+
// collapsed view renders one row for every visible account. The caller sizes
|
|
389
|
+
// both sides to the measured width, so neither side may wrap.
|
|
420
390
|
function CollapsedRow(props) {
|
|
421
391
|
return (() => {
|
|
422
392
|
var _el$8 = _$createElement("box"),
|
|
@@ -434,171 +404,8 @@ function CollapsedRow(props) {
|
|
|
434
404
|
})();
|
|
435
405
|
}
|
|
436
406
|
|
|
437
|
-
//
|
|
438
|
-
//
|
|
439
|
-
// The OpenCode 1 sidebar is about 32 to 48 columns wide. Every quota line is
|
|
440
|
-
// sized from the measured content width so that it fits on one line: text is
|
|
441
|
-
// never left to the renderer's wrapping, which breaks a row mid-word or down
|
|
442
|
-
// to one character per line once the right-hand column runs out of room.
|
|
443
|
-
|
|
444
|
-
// One entry per stored window, in group order. A pool stored before
|
|
445
|
-
// per-window readings existed contributes one window without a name.
|
|
446
|
-
function accountWindows(account, now) {
|
|
447
|
-
const result = [];
|
|
448
|
-
for (const key of QUOTA_ORDER) {
|
|
449
|
-
const entry = account.quota[key];
|
|
450
|
-
if (!entry) continue;
|
|
451
|
-
const readings = entry.windows && entry.windows.length > 0 ? entry.windows.map(window => ({
|
|
452
|
-
window: window.window,
|
|
453
|
-
remainingPercent: window.remainingPercent,
|
|
454
|
-
resetAt: window.resetAt,
|
|
455
|
-
checkedAt: window.checkedAt
|
|
456
|
-
})) : [{
|
|
457
|
-
remainingPercent: entry.remainingPercent,
|
|
458
|
-
resetAt: entry.resetAt,
|
|
459
|
-
checkedAt: entry.checkedAt
|
|
460
|
-
}];
|
|
461
|
-
for (const reading of readings) result.push({
|
|
462
|
-
key,
|
|
463
|
-
reading,
|
|
464
|
-
text: quotaWindowText(reading, now)
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
return result;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// A window shows its figure only while no reset has happened since it was
|
|
471
|
-
// read and it has a read time at all.
|
|
472
|
-
function showsFigure(window) {
|
|
473
|
-
return window.text.remaining != null && !window.text.resetSinceReading;
|
|
474
|
-
}
|
|
475
|
-
// Column widths for one `<name> <bar> <figure> <reset>` row within `width`
|
|
476
|
-
// cells. The bar shrinks first, down to MIN_BAR_WIDTH; then the reset column
|
|
477
|
-
// is dropped; then the bar.
|
|
478
|
-
function windowRowLayout(width, named, resetWidth, maxBar) {
|
|
479
|
-
const room = width - (named ? NAME_WIDTH : 0) - FIGURE_WIDTH;
|
|
480
|
-
if (resetWidth > 0) {
|
|
481
|
-
const bar = Math.min(maxBar, room - resetWidth - 2);
|
|
482
|
-
if (bar >= MIN_BAR_WIDTH) return {
|
|
483
|
-
bar,
|
|
484
|
-
reset: true
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
const bar = Math.min(maxBar, room - 1);
|
|
488
|
-
return {
|
|
489
|
-
bar: bar >= MIN_BAR_WIDTH ? bar : 0,
|
|
490
|
-
reset: false
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
// Shorten a label to `max` cells, marking the cut with an ellipsis.
|
|
495
|
-
function fitLabel(label, max) {
|
|
496
|
-
if (label.length <= max) return label;
|
|
497
|
-
if (max <= 0) return '';
|
|
498
|
-
if (max === 1) return '…';
|
|
499
|
-
return `${label.slice(0, max - 1)}…`;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// One quota window on one line. The bar fills with remaining quota; the
|
|
503
|
-
// figure and reset come from the shared formatter. A window that reset since
|
|
504
|
-
// its reading shows that fact, dim, in place of the stale figure.
|
|
505
|
-
function WindowRow(props) {
|
|
506
|
-
const text = () => props.window.text;
|
|
507
|
-
const tone = () => quotaTone(100 - (text().remaining ?? 0), props.appearance);
|
|
508
|
-
return (() => {
|
|
509
|
-
var _el$0 = _$createElement("box");
|
|
510
|
-
_$setProp(_el$0, "width", '100%');
|
|
511
|
-
_$setProp(_el$0, "flexDirection", 'row');
|
|
512
|
-
_$insert(_el$0, _$createComponent(Show, {
|
|
513
|
-
get when() {
|
|
514
|
-
return text().name !== '';
|
|
515
|
-
},
|
|
516
|
-
get children() {
|
|
517
|
-
var _el$1 = _$createElement("text");
|
|
518
|
-
_$setProp(_el$1, "width", 3);
|
|
519
|
-
_$setProp(_el$1, "flexShrink", 0);
|
|
520
|
-
_$setProp(_el$1, "wrapMode", 'none');
|
|
521
|
-
_$insert(_el$1, () => text().name);
|
|
522
|
-
_$effect(_$p => _$setProp(_el$1, "fg", props.theme().textMuted, _$p));
|
|
523
|
-
return _el$1;
|
|
524
|
-
}
|
|
525
|
-
}), null);
|
|
526
|
-
_$insert(_el$0, _$createComponent(Show, {
|
|
527
|
-
get when() {
|
|
528
|
-
return showsFigure(props.window);
|
|
529
|
-
},
|
|
530
|
-
get fallback() {
|
|
531
|
-
return (() => {
|
|
532
|
-
var _el$14 = _$createElement("text");
|
|
533
|
-
_$setProp(_el$14, "flexShrink", 1);
|
|
534
|
-
_$setProp(_el$14, "wrapMode", 'none');
|
|
535
|
-
_$insert(_el$14, (() => {
|
|
536
|
-
var _c$ = _$memo(() => !!text().resetSinceReading);
|
|
537
|
-
return () => _c$() ? RESET_SINCE_READING : text().figure;
|
|
538
|
-
})());
|
|
539
|
-
_$effect(_$p => _$setProp(_el$14, "fg", props.theme().textMuted, _$p));
|
|
540
|
-
return _el$14;
|
|
541
|
-
})();
|
|
542
|
-
},
|
|
543
|
-
get children() {
|
|
544
|
-
return [_$createComponent(Show, {
|
|
545
|
-
get when() {
|
|
546
|
-
return props.layout.bar > 0;
|
|
547
|
-
},
|
|
548
|
-
get children() {
|
|
549
|
-
var _el$10 = _$createElement("box");
|
|
550
|
-
_$setProp(_el$10, "flexShrink", 0);
|
|
551
|
-
_$setProp(_el$10, "flexDirection", 'row');
|
|
552
|
-
_$insert(_el$10, _$createComponent(For, {
|
|
553
|
-
get each() {
|
|
554
|
-
return quotaBarSegments(text().remaining ?? 0, props.layout.bar, props.appearance);
|
|
555
|
-
},
|
|
556
|
-
children: segment => (() => {
|
|
557
|
-
var _el$15 = _$createElement("text");
|
|
558
|
-
_$setProp(_el$15, "wrapMode", 'none');
|
|
559
|
-
_$insert(_el$15, () => segment.text);
|
|
560
|
-
_$effect(_$p => _$setProp(_el$15, "fg", toneColor(props.theme(), segment.tone), _$p));
|
|
561
|
-
return _el$15;
|
|
562
|
-
})()
|
|
563
|
-
}));
|
|
564
|
-
_$effect(_$p => _$setProp(_el$10, "width", props.layout.bar + 1, _$p));
|
|
565
|
-
return _el$10;
|
|
566
|
-
}
|
|
567
|
-
}), (() => {
|
|
568
|
-
var _el$11 = _$createElement("text");
|
|
569
|
-
_$setProp(_el$11, "flexShrink", 0);
|
|
570
|
-
_$setProp(_el$11, "wrapMode", 'none');
|
|
571
|
-
_$insert(_el$11, () => text().figure);
|
|
572
|
-
_$effect(_$p => _$setProp(_el$11, "fg", toneColor(props.theme(), tone()), _$p));
|
|
573
|
-
return _el$11;
|
|
574
|
-
})(), (() => {
|
|
575
|
-
var _el$12 = _$createElement("box");
|
|
576
|
-
_$setProp(_el$12, "flexGrow", 1);
|
|
577
|
-
return _el$12;
|
|
578
|
-
})(), _$createComponent(Show, {
|
|
579
|
-
get when() {
|
|
580
|
-
return _$memo(() => !!props.layout.reset)() && text().reset !== '';
|
|
581
|
-
},
|
|
582
|
-
get children() {
|
|
583
|
-
var _el$13 = _$createElement("text");
|
|
584
|
-
_$setProp(_el$13, "flexShrink", 0);
|
|
585
|
-
_$setProp(_el$13, "wrapMode", 'none');
|
|
586
|
-
_$insert(_el$13, () => text().reset);
|
|
587
|
-
_$effect(_$p => _$setProp(_el$13, "fg", props.theme().textMuted, _$p));
|
|
588
|
-
return _el$13;
|
|
589
|
-
}
|
|
590
|
-
})];
|
|
591
|
-
}
|
|
592
|
-
}), null);
|
|
593
|
-
return _el$0;
|
|
594
|
-
})();
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
// Fleet AccountBlock, adapted to Antigravity's per-account data. The header
|
|
598
|
-
// line is the account label, the reading age when the oldest reading is
|
|
599
|
-
// stale, and the status word right-aligned; the age moves to its own dim
|
|
600
|
-
// line when the three do not fit. Below it each quota group present gets a
|
|
601
|
-
// plain-word header and one WindowRow per window. Status word priorities
|
|
407
|
+
// One account in the Quota section: the shared quota block, with the status
|
|
408
|
+
// word computed from the sidebar file's account state. Status word priorities
|
|
602
409
|
// (first match wins):
|
|
603
410
|
// - `off` when the account is disabled
|
|
604
411
|
// - `cooling <wait>` when cooldownUntil is still in the future
|
|
@@ -621,153 +428,74 @@ function AccountBlock(props) {
|
|
|
621
428
|
if (cooldownMs() > 0) return 'warn';
|
|
622
429
|
return active() ? 'ok' : 'muted';
|
|
623
430
|
};
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
431
|
+
return _$createComponent(QuotaAccountBlock, {
|
|
432
|
+
get palette() {
|
|
433
|
+
return themePalette(props.theme);
|
|
434
|
+
},
|
|
435
|
+
get appearance() {
|
|
436
|
+
return props.appearance;
|
|
437
|
+
},
|
|
438
|
+
get account() {
|
|
439
|
+
return props.account;
|
|
440
|
+
},
|
|
441
|
+
get status() {
|
|
442
|
+
return statusWord();
|
|
443
|
+
},
|
|
444
|
+
get statusTone() {
|
|
445
|
+
return statusTone();
|
|
446
|
+
},
|
|
447
|
+
get now() {
|
|
448
|
+
return props.now;
|
|
449
|
+
},
|
|
450
|
+
get width() {
|
|
451
|
+
return props.width;
|
|
452
|
+
},
|
|
453
|
+
get marginTop() {
|
|
454
|
+
return props.marginTop;
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Sidebar snapshots store quota values as percentages and epoch-millisecond
|
|
460
|
+
// reset times. Adapt those values to the shared projection so common-auth, not
|
|
461
|
+
// the renderer, decides how the narrow line reads.
|
|
462
|
+
function sidebarQuotaProjection(account, now) {
|
|
463
|
+
const limits = [];
|
|
464
|
+
for (const {
|
|
632
465
|
key,
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
_$insert(_el$17, _$createComponent(Show, {
|
|
656
|
-
get when() {
|
|
657
|
-
return ageInline();
|
|
658
|
-
},
|
|
659
|
-
get children() {
|
|
660
|
-
var _el$20 = _$createElement("text");
|
|
661
|
-
_$setProp(_el$20, "flexShrink", 0);
|
|
662
|
-
_$setProp(_el$20, "wrapMode", 'none');
|
|
663
|
-
_$insert(_el$20, () => ` · ${age()}`);
|
|
664
|
-
_$effect(_$p => _$setProp(_el$20, "fg", props.theme().textMuted, _$p));
|
|
665
|
-
return _el$20;
|
|
666
|
-
}
|
|
667
|
-
}), _el$21);
|
|
668
|
-
_$setProp(_el$21, "flexGrow", 1);
|
|
669
|
-
_$insertNode(_el$22, _el$23);
|
|
670
|
-
_$setProp(_el$22, "flexShrink", 0);
|
|
671
|
-
_$setProp(_el$22, "wrapMode", 'none');
|
|
672
|
-
_$insert(_el$23, statusWord);
|
|
673
|
-
_$insert(_el$16, _$createComponent(Show, {
|
|
674
|
-
get when() {
|
|
675
|
-
return _$memo(() => age() !== '')() && !ageInline();
|
|
676
|
-
},
|
|
677
|
-
get children() {
|
|
678
|
-
var _el$24 = _$createElement("text");
|
|
679
|
-
_$setProp(_el$24, "wrapMode", 'none');
|
|
680
|
-
_$insert(_el$24, age);
|
|
681
|
-
_$effect(_$p => _$setProp(_el$24, "fg", props.theme().textMuted, _$p));
|
|
682
|
-
return _el$24;
|
|
683
|
-
}
|
|
684
|
-
}), null);
|
|
685
|
-
_$insert(_el$16, _$createComponent(Show, {
|
|
686
|
-
get when() {
|
|
687
|
-
return groups().length > 0;
|
|
688
|
-
},
|
|
689
|
-
get fallback() {
|
|
690
|
-
return (() => {
|
|
691
|
-
var _el$25 = _$createElement("text");
|
|
692
|
-
_$setProp(_el$25, "wrapMode", 'none');
|
|
693
|
-
_$insert(_el$25, NO_QUOTA_READING);
|
|
694
|
-
_$effect(_$p => _$setProp(_el$25, "fg", props.theme().textMuted, _$p));
|
|
695
|
-
return _el$25;
|
|
696
|
-
})();
|
|
697
|
-
},
|
|
698
|
-
get children() {
|
|
699
|
-
return _$createComponent(For, {
|
|
700
|
-
get each() {
|
|
701
|
-
return groups();
|
|
702
|
-
},
|
|
703
|
-
children: group => [(() => {
|
|
704
|
-
var _el$26 = _$createElement("text");
|
|
705
|
-
_$setProp(_el$26, "wrapMode", 'none');
|
|
706
|
-
_$insert(_el$26, () => GROUP_NAMES[group.key]);
|
|
707
|
-
_$effect(_$p => _$setProp(_el$26, "fg", props.theme().textMuted, _$p));
|
|
708
|
-
return _el$26;
|
|
709
|
-
})(), _$createComponent(For, {
|
|
710
|
-
get each() {
|
|
711
|
-
return group.windows;
|
|
712
|
-
},
|
|
713
|
-
children: window => _$createComponent(WindowRow, {
|
|
714
|
-
get theme() {
|
|
715
|
-
return props.theme;
|
|
716
|
-
},
|
|
717
|
-
get appearance() {
|
|
718
|
-
return props.appearance;
|
|
719
|
-
},
|
|
720
|
-
window: window,
|
|
721
|
-
get layout() {
|
|
722
|
-
return layoutFor(window);
|
|
723
|
-
}
|
|
724
|
-
})
|
|
725
|
-
})]
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
}), null);
|
|
729
|
-
_$effect(_p$ => {
|
|
730
|
-
var _v$3 = props.marginTop ?? 0,
|
|
731
|
-
_v$4 = props.theme().text,
|
|
732
|
-
_v$5 = toneColor(props.theme(), statusTone());
|
|
733
|
-
_v$3 !== _p$.e && (_p$.e = _$setProp(_el$16, "marginTop", _v$3, _p$.e));
|
|
734
|
-
_v$4 !== _p$.t && (_p$.t = _$setProp(_el$18, "fg", _v$4, _p$.t));
|
|
735
|
-
_v$5 !== _p$.a && (_p$.a = _$setProp(_el$22, "fg", _v$5, _p$.a));
|
|
736
|
-
return _p$;
|
|
737
|
-
}, {
|
|
738
|
-
e: undefined,
|
|
739
|
-
t: undefined,
|
|
740
|
-
a: undefined
|
|
466
|
+
reading
|
|
467
|
+
} of accountWindows(account, now)) {
|
|
468
|
+
const {
|
|
469
|
+
checkedAt,
|
|
470
|
+
remainingPercent,
|
|
471
|
+
resetAt,
|
|
472
|
+
window
|
|
473
|
+
} = reading;
|
|
474
|
+
if (typeof checkedAt !== 'number' || !Number.isFinite(checkedAt) || checkedAt < 0 || !Number.isFinite(remainingPercent)) continue;
|
|
475
|
+
const resetsAt = typeof resetAt === 'number' && Number.isFinite(resetAt) && Math.abs(resetAt) <= 8.64e15 ? new Date(resetAt).toISOString() : undefined;
|
|
476
|
+
limits.push({
|
|
477
|
+
scope: key,
|
|
478
|
+
label: GROUP_NAMES[key],
|
|
479
|
+
kind: 'reading',
|
|
480
|
+
checkedAt,
|
|
481
|
+
remainingPercent: Math.max(0, Math.min(100, remainingPercent)),
|
|
482
|
+
...(window ? {
|
|
483
|
+
windowMinutes: window === 'weekly' ? 7 * 24 * 60 : 5 * 60
|
|
484
|
+
} : {}),
|
|
485
|
+
...(resetsAt ? {
|
|
486
|
+
resetsAt
|
|
487
|
+
} : {})
|
|
741
488
|
});
|
|
742
|
-
return _el$16;
|
|
743
|
-
})();
|
|
744
|
-
}
|
|
745
|
-
// The collapsed row's figure: the lowest current window across both groups.
|
|
746
|
-
// A window that reset since its reading is not current and never binds.
|
|
747
|
-
function collapsedQuota(account, now) {
|
|
748
|
-
if (account.quota.gemini == null && account.quota['non-gemini'] == null) return {
|
|
749
|
-
prefix: '',
|
|
750
|
-
text: '—',
|
|
751
|
-
remaining: null
|
|
752
|
-
};
|
|
753
|
-
const windows = accountWindows(account, now);
|
|
754
|
-
let lowest;
|
|
755
|
-
for (const window of windows) {
|
|
756
|
-
if (!showsFigure(window)) continue;
|
|
757
|
-
if (lowest === undefined || (window.text.remaining ?? 100) < (lowest.text.remaining ?? 100)) lowest = window;
|
|
758
|
-
}
|
|
759
|
-
if (lowest) {
|
|
760
|
-
const name = lowest.text.name;
|
|
761
|
-
return {
|
|
762
|
-
prefix: `${COLLAPSED_GROUP_NAMES[lowest.key]}${name ? ` ${name}` : ''} `,
|
|
763
|
-
text: lowest.text.figure,
|
|
764
|
-
remaining: lowest.text.remaining
|
|
765
|
-
};
|
|
766
489
|
}
|
|
490
|
+
if (limits.length === 0) return undefined;
|
|
767
491
|
return {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
492
|
+
scope: 'all',
|
|
493
|
+
limits,
|
|
494
|
+
checkedAt: Math.min(...limits.map(limit => limit.checkedAt)),
|
|
495
|
+
groups: QUOTA_ORDER.map(scope => ({
|
|
496
|
+
scope,
|
|
497
|
+
label: GROUP_NAMES[scope]
|
|
498
|
+
}))
|
|
771
499
|
};
|
|
772
500
|
}
|
|
773
501
|
function formatWait(ms) {
|
|
@@ -873,40 +601,40 @@ export function SidebarPanel(props) {
|
|
|
873
601
|
return !hasData() ? name : collapsed() ? `\u25b6 ${name}` : `\u25bc ${name}`;
|
|
874
602
|
};
|
|
875
603
|
return (() => {
|
|
876
|
-
var _el$
|
|
877
|
-
_el$
|
|
878
|
-
_el$
|
|
879
|
-
_el$
|
|
880
|
-
_el$
|
|
881
|
-
_$insertNode(_el$
|
|
882
|
-
_$setProp(_el$
|
|
883
|
-
_$setProp(_el$
|
|
884
|
-
_$setProp(_el$
|
|
885
|
-
_$setProp(_el$
|
|
886
|
-
_$setProp(_el$
|
|
887
|
-
_$setProp(_el$
|
|
888
|
-
_$setProp(_el$
|
|
889
|
-
_$insertNode(_el$
|
|
604
|
+
var _el$0 = _$createElement("box"),
|
|
605
|
+
_el$1 = _$createElement("box"),
|
|
606
|
+
_el$10 = _$createElement("box"),
|
|
607
|
+
_el$11 = _$createElement("text"),
|
|
608
|
+
_el$12 = _$createElement("b");
|
|
609
|
+
_$insertNode(_el$0, _el$1);
|
|
610
|
+
_$setProp(_el$0, "width", '100%');
|
|
611
|
+
_$setProp(_el$0, "flexDirection", 'column');
|
|
612
|
+
_$setProp(_el$0, "border", SINGLE_BORDER);
|
|
613
|
+
_$setProp(_el$0, "paddingTop", 1);
|
|
614
|
+
_$setProp(_el$0, "paddingBottom", 1);
|
|
615
|
+
_$setProp(_el$0, "paddingLeft", 1);
|
|
616
|
+
_$setProp(_el$0, "paddingRight", 1);
|
|
617
|
+
_$insertNode(_el$1, _el$10);
|
|
890
618
|
_$use(element => {
|
|
891
619
|
headerRow = element;
|
|
892
|
-
}, _el$
|
|
893
|
-
_$setProp(_el$
|
|
894
|
-
_$setProp(_el$
|
|
895
|
-
_$setProp(_el$
|
|
896
|
-
_$setProp(_el$
|
|
897
|
-
_$setProp(_el$
|
|
898
|
-
_$setProp(_el$
|
|
620
|
+
}, _el$1);
|
|
621
|
+
_$setProp(_el$1, "onSizeChange", measureContentWidth);
|
|
622
|
+
_$setProp(_el$1, "width", '100%');
|
|
623
|
+
_$setProp(_el$1, "flexDirection", 'row');
|
|
624
|
+
_$setProp(_el$1, "justifyContent", 'space-between');
|
|
625
|
+
_$setProp(_el$1, "alignItems", 'center');
|
|
626
|
+
_$setProp(_el$1, "onMouseDown", () => {
|
|
899
627
|
// Mirror the fleet guard: only toggle when there is data to expand
|
|
900
628
|
// into. Without this a click on the empty-awaiting header would just
|
|
901
629
|
// toggle the affordance for nothing.
|
|
902
630
|
if (hasData()) controller.toggleCollapsed();
|
|
903
631
|
});
|
|
904
|
-
_$insertNode(_el$
|
|
905
|
-
_$setProp(_el$
|
|
906
|
-
_$setProp(_el$
|
|
907
|
-
_$insertNode(_el$
|
|
908
|
-
_$insert(_el$
|
|
909
|
-
_$insert(_el$
|
|
632
|
+
_$insertNode(_el$10, _el$11);
|
|
633
|
+
_$setProp(_el$10, "paddingLeft", 1);
|
|
634
|
+
_$setProp(_el$10, "paddingRight", 1);
|
|
635
|
+
_$insertNode(_el$11, _el$12);
|
|
636
|
+
_$insert(_el$12, headerLabel);
|
|
637
|
+
_$insert(_el$1, _$createComponent(Show, {
|
|
910
638
|
get when() {
|
|
911
639
|
return degraded();
|
|
912
640
|
},
|
|
@@ -916,107 +644,123 @@ export function SidebarPanel(props) {
|
|
|
916
644
|
return prefs().header.showVersion && PLUGIN_VERSION !== '';
|
|
917
645
|
},
|
|
918
646
|
get children() {
|
|
919
|
-
var _el$
|
|
920
|
-
_$insert(_el$
|
|
921
|
-
_$effect(_$p => _$setProp(_el$
|
|
922
|
-
return _el$
|
|
647
|
+
var _el$17 = _$createElement("text");
|
|
648
|
+
_$insert(_el$17, `v${PLUGIN_VERSION}`);
|
|
649
|
+
_$effect(_$p => _$setProp(_el$17, "fg", theme().textMuted, _$p));
|
|
650
|
+
return _el$17;
|
|
923
651
|
}
|
|
924
652
|
});
|
|
925
653
|
},
|
|
926
654
|
get children() {
|
|
927
|
-
var _el$
|
|
928
|
-
_el$
|
|
929
|
-
_el$
|
|
930
|
-
_$insertNode(_el$
|
|
931
|
-
_$setProp(_el$
|
|
932
|
-
_$setProp(_el$
|
|
933
|
-
_$insertNode(_el$
|
|
934
|
-
_$insertNode(_el$
|
|
655
|
+
var _el$13 = _$createElement("box"),
|
|
656
|
+
_el$14 = _$createElement("text"),
|
|
657
|
+
_el$15 = _$createElement("b");
|
|
658
|
+
_$insertNode(_el$13, _el$14);
|
|
659
|
+
_$setProp(_el$13, "paddingLeft", 1);
|
|
660
|
+
_$setProp(_el$13, "paddingRight", 1);
|
|
661
|
+
_$insertNode(_el$14, _el$15);
|
|
662
|
+
_$insertNode(_el$15, _$createTextNode(`LIMITED`));
|
|
935
663
|
_$effect(_p$ => {
|
|
936
|
-
var _v$
|
|
937
|
-
_v$
|
|
938
|
-
_v$
|
|
939
|
-
_v$
|
|
664
|
+
var _v$3 = theme().warning,
|
|
665
|
+
_v$4 = theme().background;
|
|
666
|
+
_v$3 !== _p$.e && (_p$.e = _$setProp(_el$13, "backgroundColor", _v$3, _p$.e));
|
|
667
|
+
_v$4 !== _p$.t && (_p$.t = _$setProp(_el$14, "fg", _v$4, _p$.t));
|
|
940
668
|
return _p$;
|
|
941
669
|
}, {
|
|
942
670
|
e: undefined,
|
|
943
671
|
t: undefined
|
|
944
672
|
});
|
|
945
|
-
return _el$
|
|
673
|
+
return _el$13;
|
|
946
674
|
}
|
|
947
675
|
}), null);
|
|
948
|
-
_$insert(_el$
|
|
676
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
949
677
|
get when() {
|
|
950
678
|
return _$memo(() => !!collapsed())() && hasData();
|
|
951
679
|
},
|
|
952
680
|
get children() {
|
|
953
|
-
return (
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
// group prefix goes first when narrow; then the label is cut.
|
|
971
|
-
const figure = () => {
|
|
972
|
-
const {
|
|
973
|
-
prefix,
|
|
974
|
-
text
|
|
975
|
-
} = quota();
|
|
976
|
-
const full = `${prefix}${text}`;
|
|
977
|
-
return selected().label.length + 1 + full.length + 2 <= contentWidth() ? full : text;
|
|
978
|
-
};
|
|
979
|
-
const label = () => fitLabel(selected().label, contentWidth() - 1 - figure().length - 2);
|
|
980
|
-
return _$createComponent(CollapsedRow, {
|
|
981
|
-
theme: theme,
|
|
982
|
-
get label() {
|
|
983
|
-
return label();
|
|
984
|
-
},
|
|
985
|
-
get children() {
|
|
986
|
-
var _el$37 = _$createElement("box"),
|
|
987
|
-
_el$38 = _$createElement("text"),
|
|
988
|
-
_el$39 = _$createElement("b"),
|
|
989
|
-
_el$40 = _$createElement("text");
|
|
990
|
-
_$insertNode(_el$37, _el$38);
|
|
991
|
-
_$insertNode(_el$37, _el$40);
|
|
992
|
-
_$setProp(_el$37, "flexDirection", 'row');
|
|
993
|
-
_$setProp(_el$37, "flexShrink", 0);
|
|
994
|
-
_$insertNode(_el$38, _el$39);
|
|
995
|
-
_$setProp(_el$38, "flexShrink", 0);
|
|
996
|
-
_$setProp(_el$38, "wrapMode", 'none');
|
|
997
|
-
_$insert(_el$39, figure);
|
|
998
|
-
_$setProp(_el$40, "flexShrink", 0);
|
|
999
|
-
_$setProp(_el$40, "wrapMode", 'none');
|
|
1000
|
-
_$insert(_el$40, () => unavailable() ? ' ⊘' : ' ●');
|
|
1001
|
-
_$effect(_p$ => {
|
|
1002
|
-
var _v$1 = toneColor(theme(), tone()),
|
|
1003
|
-
_v$10 = toneColor(theme(), unavailable() ? 'err' : tone());
|
|
1004
|
-
_v$1 !== _p$.e && (_p$.e = _$setProp(_el$38, "fg", _v$1, _p$.e));
|
|
1005
|
-
_v$10 !== _p$.t && (_p$.t = _$setProp(_el$40, "fg", _v$10, _p$.t));
|
|
1006
|
-
return _p$;
|
|
1007
|
-
}, {
|
|
1008
|
-
e: undefined,
|
|
1009
|
-
t: undefined
|
|
1010
|
-
});
|
|
1011
|
-
return _el$37;
|
|
1012
|
-
}
|
|
681
|
+
return _$createComponent(For, {
|
|
682
|
+
get each() {
|
|
683
|
+
return visibleAccounts();
|
|
684
|
+
},
|
|
685
|
+
children: account => {
|
|
686
|
+
const unavailable = () => !account.enabled || account.cooldownUntil != null && account.cooldownUntil > now();
|
|
687
|
+
const line = createMemo(() => {
|
|
688
|
+
const currentTime = now();
|
|
689
|
+
const projection = sidebarQuotaProjection(account, currentTime);
|
|
690
|
+
const text = formatQuota(projection, {
|
|
691
|
+
now: currentTime,
|
|
692
|
+
form: 'narrow'
|
|
693
|
+
});
|
|
694
|
+
const remaining = projection?.limits.length ? Math.min(...projection.limits.map(limit => limit.remainingPercent ?? 100)) : undefined;
|
|
695
|
+
const tone = remaining === undefined ? 'muted' : quotaTone(100 - remaining, prefs().appearance);
|
|
696
|
+
const stale = isQuotaStale(projection, {
|
|
697
|
+
now: currentTime
|
|
1013
698
|
});
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
699
|
+
const dot = unavailable() ? ' ⊘' : ' ●';
|
|
700
|
+
const width = contentWidth();
|
|
701
|
+
// Keep a complete shared line or omit it; a partial quota can
|
|
702
|
+
// make an account look as if it has less remaining.
|
|
703
|
+
const showQuota = text.length <= width;
|
|
704
|
+
const showDot = dot.length <= width && (!showQuota || text.length + dot.length <= width);
|
|
705
|
+
const rightWidth = (showQuota ? text.length : 0) + (showDot ? dot.length : 0);
|
|
706
|
+
const labelWidth = Math.max(0, width - rightWidth - 1);
|
|
707
|
+
return {
|
|
708
|
+
dot,
|
|
709
|
+
label: fitLabel(account.label, labelWidth),
|
|
710
|
+
showDot,
|
|
711
|
+
showQuota,
|
|
712
|
+
stale,
|
|
713
|
+
text,
|
|
714
|
+
tone
|
|
715
|
+
};
|
|
716
|
+
});
|
|
717
|
+
const quotaColor = () => line().stale ? theme().textMuted : toneColor(theme(), line().tone);
|
|
718
|
+
const dotColor = () => line().stale ? theme().textMuted : toneColor(theme(), unavailable() ? 'err' : line().tone);
|
|
719
|
+
return _$createComponent(CollapsedRow, {
|
|
720
|
+
theme: theme,
|
|
721
|
+
get label() {
|
|
722
|
+
return line().label;
|
|
723
|
+
},
|
|
724
|
+
get children() {
|
|
725
|
+
var _el$18 = _$createElement("box");
|
|
726
|
+
_$setProp(_el$18, "flexDirection", 'row');
|
|
727
|
+
_$setProp(_el$18, "flexShrink", 0);
|
|
728
|
+
_$insert(_el$18, _$createComponent(Show, {
|
|
729
|
+
get when() {
|
|
730
|
+
return line().showQuota;
|
|
731
|
+
},
|
|
732
|
+
get children() {
|
|
733
|
+
var _el$19 = _$createElement("text"),
|
|
734
|
+
_el$20 = _$createElement("b");
|
|
735
|
+
_$insertNode(_el$19, _el$20);
|
|
736
|
+
_$setProp(_el$19, "flexShrink", 0);
|
|
737
|
+
_$setProp(_el$19, "wrapMode", 'none');
|
|
738
|
+
_$insert(_el$20, () => line().text);
|
|
739
|
+
_$effect(_$p => _$setProp(_el$19, "fg", quotaColor(), _$p));
|
|
740
|
+
return _el$19;
|
|
741
|
+
}
|
|
742
|
+
}), null);
|
|
743
|
+
_$insert(_el$18, _$createComponent(Show, {
|
|
744
|
+
get when() {
|
|
745
|
+
return line().showDot;
|
|
746
|
+
},
|
|
747
|
+
get children() {
|
|
748
|
+
var _el$21 = _$createElement("text");
|
|
749
|
+
_$setProp(_el$21, "flexShrink", 0);
|
|
750
|
+
_$setProp(_el$21, "wrapMode", 'none');
|
|
751
|
+
_$insert(_el$21, () => line().dot);
|
|
752
|
+
_$effect(_$p => _$setProp(_el$21, "fg", dotColor(), _$p));
|
|
753
|
+
return _el$21;
|
|
754
|
+
}
|
|
755
|
+
}), null);
|
|
756
|
+
return _el$18;
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
});
|
|
1017
761
|
}
|
|
1018
762
|
}), null);
|
|
1019
|
-
_$insert(_el$
|
|
763
|
+
_$insert(_el$0, _$createComponent(Show, {
|
|
1020
764
|
get when() {
|
|
1021
765
|
return !collapsed() || !hasData();
|
|
1022
766
|
},
|
|
@@ -1027,14 +771,14 @@ export function SidebarPanel(props) {
|
|
|
1027
771
|
},
|
|
1028
772
|
get fallback() {
|
|
1029
773
|
return (() => {
|
|
1030
|
-
var _el$
|
|
1031
|
-
_el$
|
|
1032
|
-
_$insertNode(_el$
|
|
1033
|
-
_$setProp(_el$
|
|
1034
|
-
_$setProp(_el$
|
|
1035
|
-
_$insertNode(_el$
|
|
1036
|
-
_$effect(_$p => _$setProp(_el$
|
|
1037
|
-
return _el$
|
|
774
|
+
var _el$22 = _$createElement("box"),
|
|
775
|
+
_el$23 = _$createElement("text");
|
|
776
|
+
_$insertNode(_el$22, _el$23);
|
|
777
|
+
_$setProp(_el$22, "marginTop", 1);
|
|
778
|
+
_$setProp(_el$22, "width", '100%');
|
|
779
|
+
_$insertNode(_el$23, _$createTextNode(`Waiting for quota…`));
|
|
780
|
+
_$effect(_$p => _$setProp(_el$23, "fg", theme().textMuted, _$p));
|
|
781
|
+
return _el$22;
|
|
1038
782
|
})();
|
|
1039
783
|
},
|
|
1040
784
|
get children() {
|
|
@@ -1078,16 +822,16 @@ export function SidebarPanel(props) {
|
|
|
1078
822
|
},
|
|
1079
823
|
get fallback() {
|
|
1080
824
|
return (() => {
|
|
1081
|
-
var _el$
|
|
1082
|
-
_$insertNode(_el$
|
|
1083
|
-
_$setProp(_el$
|
|
1084
|
-
_$effect(_$p => _$setProp(_el$
|
|
1085
|
-
return _el$
|
|
825
|
+
var _el$25 = _$createElement("text");
|
|
826
|
+
_$insertNode(_el$25, _$createTextNode(`No request yet`));
|
|
827
|
+
_$setProp(_el$25, "wrapMode", 'none');
|
|
828
|
+
_$effect(_$p => _$setProp(_el$25, "fg", theme().textMuted, _$p));
|
|
829
|
+
return _el$25;
|
|
1086
830
|
})();
|
|
1087
831
|
},
|
|
1088
832
|
children: route => _$createComponent(Show, {
|
|
1089
833
|
get when() {
|
|
1090
|
-
return 'Route'
|
|
834
|
+
return routeLineFits('Route', routeValue(route()), contentWidth());
|
|
1091
835
|
},
|
|
1092
836
|
get fallback() {
|
|
1093
837
|
return _$createComponent(For, {
|
|
@@ -1095,13 +839,13 @@ export function SidebarPanel(props) {
|
|
|
1095
839
|
return routeLines(route());
|
|
1096
840
|
},
|
|
1097
841
|
children: line => (() => {
|
|
1098
|
-
var _el$
|
|
1099
|
-
_el$
|
|
1100
|
-
_$insertNode(_el$
|
|
1101
|
-
_$setProp(_el$
|
|
1102
|
-
_$insert(_el$
|
|
1103
|
-
_$effect(_$p => _$setProp(_el$
|
|
1104
|
-
return _el$
|
|
842
|
+
var _el$27 = _$createElement("text"),
|
|
843
|
+
_el$28 = _$createElement("b");
|
|
844
|
+
_$insertNode(_el$27, _el$28);
|
|
845
|
+
_$setProp(_el$27, "wrapMode", 'none');
|
|
846
|
+
_$insert(_el$28, line);
|
|
847
|
+
_$effect(_$p => _$setProp(_el$27, "fg", toneColor(theme(), 'accent'), _$p));
|
|
848
|
+
return _el$27;
|
|
1105
849
|
})()
|
|
1106
850
|
});
|
|
1107
851
|
},
|
|
@@ -1162,19 +906,19 @@ export function SidebarPanel(props) {
|
|
|
1162
906
|
}
|
|
1163
907
|
}), null);
|
|
1164
908
|
_$effect(_p$ => {
|
|
1165
|
-
var _v$
|
|
1166
|
-
_v$
|
|
1167
|
-
_v$
|
|
1168
|
-
_v$
|
|
1169
|
-
_v$
|
|
1170
|
-
_v$
|
|
909
|
+
var _v$5 = theme().borderActive,
|
|
910
|
+
_v$6 = theme().accent,
|
|
911
|
+
_v$7 = theme().background;
|
|
912
|
+
_v$5 !== _p$.e && (_p$.e = _$setProp(_el$0, "borderColor", _v$5, _p$.e));
|
|
913
|
+
_v$6 !== _p$.t && (_p$.t = _$setProp(_el$10, "backgroundColor", _v$6, _p$.t));
|
|
914
|
+
_v$7 !== _p$.a && (_p$.a = _$setProp(_el$11, "fg", _v$7, _p$.a));
|
|
1171
915
|
return _p$;
|
|
1172
916
|
}, {
|
|
1173
917
|
e: undefined,
|
|
1174
918
|
t: undefined,
|
|
1175
919
|
a: undefined
|
|
1176
920
|
});
|
|
1177
|
-
return _el$
|
|
921
|
+
return _el$0;
|
|
1178
922
|
})();
|
|
1179
923
|
}
|
|
1180
924
|
|