@cortexkit/opencode-antigravity-auth 3.0.20 → 3.0.22
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 +354 -278
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +66 -21
- package/dist/index.js +841 -392
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +123 -28
- package/dist/server.js +860 -411
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/custody.js +25 -0
- package/dist/src/common-auth-embedded/claustrum/hub.js +20 -1
- package/dist/src/common-auth-embedded/claustrum/insula.js +6 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +2 -2
- package/dist/src/common-auth-embedded/fs/with-lock.js +37 -10
- package/dist/src/common-auth-embedded/quota/format.d.ts +9 -4
- package/dist/src/common-auth-embedded/quota/format.js +45 -26
- package/dist/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
- package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +654 -0
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
- package/dist/src/common-auth-embedded/routing-accessor/index.js +128 -0
- package/dist/src/common-auth-embedded/source-output.json +69 -29
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +2 -2
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +2 -0
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +1 -0
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +6 -0
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +89 -2
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +4 -0
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/shared/vault-routing-purpose.d.ts +12 -0
- package/dist/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-routing-purpose.js +18 -0
- package/dist/src/plugin/shared/vault-routing-purpose.js.map +1 -0
- package/dist/src/plugin/shared/vault-routing.d.ts +36 -0
- package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-routing.js +213 -0
- package/dist/src/plugin/shared/vault-routing.js.map +1 -0
- package/dist/src/plugin/types.d.ts +1 -0
- package/dist/src/plugin/types.d.ts.map +1 -1
- package/dist/src/tui/quota-layout.d.ts +4 -58
- package/dist/src/tui/quota-layout.d.ts.map +1 -1
- package/dist/src/tui/quota-layout.js +4 -90
- package/dist/src/tui/quota-layout.js.map +1 -1
- package/dist/src/tui/sidebar-frame.d.ts +4 -34
- package/dist/src/tui/sidebar-frame.d.ts.map +1 -1
- package/dist/src/tui/sidebar-frame.js +93 -167
- package/dist/src/tui/sidebar-frame.js.map +1 -1
- package/dist/src/tui.js +2 -2
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +31 -17
- package/dist/tui-ga-build-map.json +32 -17
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +9 -4
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts +6 -0
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts +12 -0
- package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/vault-routing.d.ts +36 -0
- package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -0
- package/dist/types/src/plugin/types.d.ts +1 -0
- package/dist/types/src/plugin/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/claustrum/custody.js +25 -0
- package/src/common-auth-embedded/claustrum/hub.js +20 -1
- package/src/common-auth-embedded/claustrum/insula.js +6 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.js +2 -2
- package/src/common-auth-embedded/fs/with-lock.js +37 -10
- package/src/common-auth-embedded/quota/format.d.ts +9 -4
- package/src/common-auth-embedded/quota/format.js +45 -26
- package/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
- package/src/common-auth-embedded/quota-sidebar/index.tsx +654 -0
- package/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
- package/src/common-auth-embedded/routing-accessor/index.js +128 -0
- package/src/common-auth-embedded/source-output.json +69 -29
- package/src/tui-compiled/common-auth-embedded/quota/format.js +45 -26
- package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +683 -0
- package/src/tui-compiled/tui/quota-layout.js +5 -330
- package/src/tui-compiled/tui/sidebar-frame.js +243 -467
- package/src/tui-compiled/tui.js +2 -2
- package/src/tui-ga-compiled/host-ga.js +2 -2
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +45 -26
- package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +243 -467
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +5 -330
- package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +683 -0
- package/src/tui-ga-raw/host-ga.tsx +2 -2
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +45 -26
- package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +214 -400
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +10 -301
- package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +654 -0
- package/src/tui-raw/common-auth-embedded/quota/format.js +45 -26
- package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +654 -0
- package/src/tui-raw/tui/quota-layout.tsx +10 -301
- package/src/tui-raw/tui/sidebar-frame.tsx +214 -400
- package/src/tui-raw/tui.tsx +2 -2
- package/src/tui.tsx +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { createTextNode as _$createTextNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
2
|
-
import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
3
1
|
import { use as _$use } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
2
|
+
import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
4
3
|
import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
5
4
|
import { effect as _$effect } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
6
5
|
import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
@@ -9,29 +8,13 @@ import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid"
|
|
|
9
8
|
import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
10
9
|
/** @jsxImportSource @opentui/solid */
|
|
11
10
|
|
|
12
|
-
/**
|
|
13
|
-
* The Antigravity sidebar frame, shared by the OpenCode 1 sidebar (`tui.tsx`)
|
|
14
|
-
* and the OpenCode 2 sidebar (`ga/tui/host-ga.tsx`): the padded
|
|
15
|
-
* panel, the clickable `▼`/`▶` header badge with the optional plugin version
|
|
16
|
-
* at the right, one line per account when collapsed, and the
|
|
17
|
-
* `Quota`, `Routing` and `Health` sections when expanded.
|
|
18
|
-
*
|
|
19
|
-
* Each renderer reads its own data source (the sidebar file, or the
|
|
20
|
-
* location's `state` answer), maps its own host theme onto `FrameTheme` and
|
|
21
|
-
* owns its own collapse state; everything drawn is decided here, so a change
|
|
22
|
-
* of shape is made once for both hosts.
|
|
23
|
-
*
|
|
24
|
-
* This module stays inside both TUI import graphs: besides Solid and
|
|
25
|
-
* OpenTUI it imports only the pure quota and sidebar-projection helpers and
|
|
26
|
-
* the shared layouts. No sidebar file, preferences file, RPC, account
|
|
27
|
-
* store, OAuth, token or host SDK module, no Node built-in, and nothing
|
|
28
|
-
* that writes to the terminal.
|
|
29
|
-
*/
|
|
11
|
+
/** Plugin-owned projection and Routing/Health sections for the shared quota frame. */
|
|
30
12
|
|
|
31
13
|
import { createMemo, createSignal, For, Show } from "opentui:runtime-module:solid-js";
|
|
32
|
-
import {
|
|
14
|
+
import { isQuotaStale, NO_QUOTA_READING } from "./bf17cbee28e58197-index.js";
|
|
15
|
+
import { SidebarFrame, SidebarSection, SidebarTextRow } from "./e4ec36f367492969-index.js";
|
|
33
16
|
import { formatResetIn, formatWait } from "./8ae1927e5910ea81-sidebar-projection.js";
|
|
34
|
-
import {
|
|
17
|
+
import { accountWindows, DEFAULT_QUOTA_APPEARANCE, GROUP_NAMES, QUOTA_ORDER, quotaTone } from "./dd4c9e1a907f8ef0-quota-layout.js";
|
|
35
18
|
import { routeLineFits } from "./6ca47cd4ec33fe72-route-layout.js";
|
|
36
19
|
|
|
37
20
|
// --- Theme -----------------------------------------------------------------
|
|
@@ -45,36 +28,6 @@ import { routeLineFits } from "./6ca47cd4ec33fe72-route-layout.js";
|
|
|
45
28
|
* sibling token or to the host's default color, never to a fixed color.
|
|
46
29
|
*/
|
|
47
30
|
|
|
48
|
-
// Every tone falls through to a sibling token, so a sparse custom theme still
|
|
49
|
-
// renders readably.
|
|
50
|
-
export function toneColor(theme, tone) {
|
|
51
|
-
switch (tone) {
|
|
52
|
-
case 'ok':
|
|
53
|
-
return theme.success ?? theme.accent;
|
|
54
|
-
case 'warn':
|
|
55
|
-
return theme.warning ?? theme.accent;
|
|
56
|
-
case 'err':
|
|
57
|
-
return theme.error ?? theme.accent;
|
|
58
|
-
case 'muted':
|
|
59
|
-
return theme.textMuted ?? theme.text;
|
|
60
|
-
case 'accent':
|
|
61
|
-
return theme.accent ?? theme.text;
|
|
62
|
-
default:
|
|
63
|
-
return theme.text;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// The shared quota layout reads its colors through this palette. Muted text
|
|
68
|
-
// and the account label read `textMuted` and `text` straight from the theme,
|
|
69
|
-
// without the `toneColor` fallback chain.
|
|
70
|
-
export function themePalette(theme) {
|
|
71
|
-
return {
|
|
72
|
-
text: () => theme().text,
|
|
73
|
-
muted: () => theme().textMuted,
|
|
74
|
-
tone: tone => toneColor(theme(), tone)
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
31
|
// --- Frame inputs ----------------------------------------------------------
|
|
79
32
|
|
|
80
33
|
/** The account fields the frame reads: the quota layout's plus the state. */
|
|
@@ -105,126 +58,6 @@ export const DEFAULT_FRAME_SETTINGS = {
|
|
|
105
58
|
appearance: DEFAULT_QUOTA_APPEARANCE
|
|
106
59
|
};
|
|
107
60
|
|
|
108
|
-
// --- Rows ------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
// Section header: bold title, themed text color, top margin for vertical
|
|
111
|
-
// breathing room between sections.
|
|
112
|
-
export function SectionHeader(props) {
|
|
113
|
-
return (() => {
|
|
114
|
-
var _el$ = _$createElement("box"),
|
|
115
|
-
_el$2 = _$createElement("text"),
|
|
116
|
-
_el$3 = _$createElement("b");
|
|
117
|
-
_$insertNode(_el$, _el$2);
|
|
118
|
-
_$setProp(_el$, "width", '100%');
|
|
119
|
-
_$setProp(_el$, "marginTop", 1);
|
|
120
|
-
_$insertNode(_el$2, _el$3);
|
|
121
|
-
_$insert(_el$3, () => props.title);
|
|
122
|
-
_$effect(_$p => _$setProp(_el$2, "fg", toneColor(props.theme(), 'text'), _$p));
|
|
123
|
-
return _el$;
|
|
124
|
-
})();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Muted label left, value (optionally tone-tinted, bold) right, for the
|
|
128
|
-
// routing and health rows.
|
|
129
|
-
export function StatRow(props) {
|
|
130
|
-
return (() => {
|
|
131
|
-
var _el$4 = _$createElement("box"),
|
|
132
|
-
_el$5 = _$createElement("text"),
|
|
133
|
-
_el$6 = _$createElement("text"),
|
|
134
|
-
_el$7 = _$createElement("b");
|
|
135
|
-
_$insertNode(_el$4, _el$5);
|
|
136
|
-
_$insertNode(_el$4, _el$6);
|
|
137
|
-
_$setProp(_el$4, "width", '100%');
|
|
138
|
-
_$setProp(_el$4, "flexDirection", 'row');
|
|
139
|
-
_$setProp(_el$4, "justifyContent", 'space-between');
|
|
140
|
-
_$insert(_el$5, () => props.label);
|
|
141
|
-
_$insertNode(_el$6, _el$7);
|
|
142
|
-
_$insert(_el$7, () => props.value);
|
|
143
|
-
_$effect(_p$ => {
|
|
144
|
-
var _v$ = props.theme().textMuted,
|
|
145
|
-
_v$2 = toneColor(props.theme(), props.tone ?? 'text');
|
|
146
|
-
_v$ !== _p$.e && (_p$.e = _$setProp(_el$5, "fg", _v$, _p$.e));
|
|
147
|
-
_v$2 !== _p$.t && (_p$.t = _$setProp(_el$6, "fg", _v$2, _p$.t));
|
|
148
|
-
return _p$;
|
|
149
|
-
}, {
|
|
150
|
-
e: undefined,
|
|
151
|
-
t: undefined
|
|
152
|
-
});
|
|
153
|
-
return _el$4;
|
|
154
|
-
})();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Muted label left, caller-supplied value right. The collapsed view renders
|
|
158
|
-
// one row for every visible account. The caller sizes both sides to the
|
|
159
|
-
// measured width, so neither side may wrap.
|
|
160
|
-
function CollapsedRow(props) {
|
|
161
|
-
return (() => {
|
|
162
|
-
var _el$8 = _$createElement("box"),
|
|
163
|
-
_el$9 = _$createElement("text");
|
|
164
|
-
_$insertNode(_el$8, _el$9);
|
|
165
|
-
_$setProp(_el$8, "width", '100%');
|
|
166
|
-
_$setProp(_el$8, "flexDirection", 'row');
|
|
167
|
-
_$setProp(_el$8, "justifyContent", 'space-between');
|
|
168
|
-
_$setProp(_el$9, "flexShrink", 0);
|
|
169
|
-
_$setProp(_el$9, "wrapMode", 'none');
|
|
170
|
-
_$insert(_el$9, () => props.label);
|
|
171
|
-
_$insert(_el$8, () => props.children, null);
|
|
172
|
-
_$effect(_$p => _$setProp(_el$9, "fg", props.theme().textMuted, _$p));
|
|
173
|
-
return _el$8;
|
|
174
|
-
})();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// One account in the Quota section: the shared quota block, with the status
|
|
178
|
-
// word computed from the account state. Status word priorities (first match
|
|
179
|
-
// wins):
|
|
180
|
-
// - `off` when the account is disabled
|
|
181
|
-
// - `cooling <wait>` when cooldownUntil is still in the future
|
|
182
|
-
// - `active` when current === true
|
|
183
|
-
// - `idle` for the fallback (current === false) case
|
|
184
|
-
function AccountBlock(props) {
|
|
185
|
-
const cooldownMs = () => {
|
|
186
|
-
const cd = props.account.cooldownUntil;
|
|
187
|
-
if (typeof cd !== 'number') return 0;
|
|
188
|
-
return Math.max(0, cd - props.now());
|
|
189
|
-
};
|
|
190
|
-
const statusWord = () => {
|
|
191
|
-
if (!props.account.enabled) return 'off';
|
|
192
|
-
if (cooldownMs() > 0) return `cooling ${formatWait(cooldownMs())}`;
|
|
193
|
-
return props.account.current ? 'active' : 'idle';
|
|
194
|
-
};
|
|
195
|
-
const statusTone = () => {
|
|
196
|
-
if (!props.account.enabled) return 'muted';
|
|
197
|
-
if (cooldownMs() > 0) return 'warn';
|
|
198
|
-
return props.account.current ? 'ok' : 'muted';
|
|
199
|
-
};
|
|
200
|
-
return _$createComponent(QuotaAccountBlock, {
|
|
201
|
-
get palette() {
|
|
202
|
-
return themePalette(props.theme);
|
|
203
|
-
},
|
|
204
|
-
get appearance() {
|
|
205
|
-
return props.appearance;
|
|
206
|
-
},
|
|
207
|
-
get account() {
|
|
208
|
-
return props.account;
|
|
209
|
-
},
|
|
210
|
-
get status() {
|
|
211
|
-
return statusWord();
|
|
212
|
-
},
|
|
213
|
-
get statusTone() {
|
|
214
|
-
return statusTone();
|
|
215
|
-
},
|
|
216
|
-
get now() {
|
|
217
|
-
return props.now;
|
|
218
|
-
},
|
|
219
|
-
get width() {
|
|
220
|
-
return props.width;
|
|
221
|
-
},
|
|
222
|
-
get marginTop() {
|
|
223
|
-
return props.marginTop;
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
61
|
// Stored quota values are percentages and epoch-millisecond reset times.
|
|
229
62
|
// Adapt them to the shared projection so common-auth, not the renderer,
|
|
230
63
|
// decides how the narrow line reads.
|
|
@@ -268,353 +101,296 @@ export function sidebarQuotaProjection(account, now) {
|
|
|
268
101
|
};
|
|
269
102
|
}
|
|
270
103
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
now: currentTime
|
|
291
|
-
});
|
|
292
|
-
const dot = unavailable() ? ' ⊘' : ' ●';
|
|
293
|
-
const width = props.width();
|
|
294
|
-
// Keep a complete shared line or omit it; a partial quota can make an
|
|
295
|
-
// account look as if it has less remaining.
|
|
296
|
-
const showQuota = text.length <= width;
|
|
297
|
-
const showDot = dot.length <= width && (!showQuota || text.length + dot.length <= width);
|
|
298
|
-
const rightWidth = (showQuota ? text.length : 0) + (showDot ? dot.length : 0);
|
|
299
|
-
const labelWidth = Math.max(0, width - rightWidth - 1);
|
|
300
|
-
return {
|
|
301
|
-
dot,
|
|
302
|
-
label: fitLabel(account.label, labelWidth),
|
|
303
|
-
showDot,
|
|
304
|
-
showQuota,
|
|
305
|
-
stale,
|
|
306
|
-
text,
|
|
307
|
-
tone
|
|
308
|
-
};
|
|
104
|
+
/** Preserve provider status and projection policy; the library owns all quota layout. */
|
|
105
|
+
function accountView(account, now, appearance) {
|
|
106
|
+
const cooldown = Math.max(0, (account.cooldownUntil ?? 0) - now);
|
|
107
|
+
const status = !account.enabled ? {
|
|
108
|
+
text: 'off',
|
|
109
|
+
tone: 'textMuted'
|
|
110
|
+
} : cooldown > 0 ? {
|
|
111
|
+
text: `cooling ${formatWait(cooldown)}`,
|
|
112
|
+
tone: 'warning'
|
|
113
|
+
} : account.current ? {
|
|
114
|
+
text: 'active',
|
|
115
|
+
tone: 'success'
|
|
116
|
+
} : {
|
|
117
|
+
text: 'idle',
|
|
118
|
+
tone: 'textMuted'
|
|
119
|
+
};
|
|
120
|
+
const quota = sidebarQuotaProjection(account, now);
|
|
121
|
+
const stale = isQuotaStale(quota, {
|
|
122
|
+
now
|
|
309
123
|
});
|
|
310
|
-
const
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
124
|
+
const remaining = quota?.limits.length ? Math.min(...quota.limits.map(limit => limit.remainingPercent ?? 100)) : undefined;
|
|
125
|
+
const quotaColor = remaining === undefined ? 'textMuted' : quotaTone(100 - remaining, appearance);
|
|
126
|
+
const blocked = !account.enabled || cooldown > 0;
|
|
127
|
+
const windows = accountWindows(account, now);
|
|
128
|
+
return {
|
|
129
|
+
id: account.id,
|
|
130
|
+
label: account.label,
|
|
131
|
+
status,
|
|
132
|
+
blocked,
|
|
133
|
+
indicatorTone: stale ? 'textMuted' : blocked ? 'error' : quotaColor,
|
|
134
|
+
quota,
|
|
135
|
+
collapsed: {
|
|
136
|
+
quotaTone: quotaColor,
|
|
137
|
+
muted: stale || status.text !== 'active'
|
|
316
138
|
},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
}), null);
|
|
349
|
-
return _el$0;
|
|
350
|
-
}
|
|
351
|
-
});
|
|
139
|
+
emptyQuotaText: {
|
|
140
|
+
expanded: NO_QUOTA_READING,
|
|
141
|
+
collapsed: NO_QUOTA_READING
|
|
142
|
+
},
|
|
143
|
+
groups: QUOTA_ORDER.flatMap(key => {
|
|
144
|
+
const rows = windows.filter(window => window.key === key).map(({
|
|
145
|
+
reading,
|
|
146
|
+
text
|
|
147
|
+
}) => {
|
|
148
|
+
const name = text.name || (reading.window === 'weekly' ? '7d' : reading.window ?? '');
|
|
149
|
+
return {
|
|
150
|
+
part: {
|
|
151
|
+
kind: 'window',
|
|
152
|
+
reading: text.remaining === null ? 'unknown' : 'known',
|
|
153
|
+
name,
|
|
154
|
+
short: name,
|
|
155
|
+
figure: text.remaining === null ? 'no reading' : text.figure,
|
|
156
|
+
remainingPercent: text.remaining ?? undefined,
|
|
157
|
+
resetIn: text.reset || undefined,
|
|
158
|
+
checkedAt: text.remaining === null ? undefined : reading.checkedAt,
|
|
159
|
+
resetSinceReading: text.resetSinceReading
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
return rows.length ? [{
|
|
164
|
+
title: GROUP_NAMES[key],
|
|
165
|
+
rows
|
|
166
|
+
}] : [];
|
|
167
|
+
})
|
|
168
|
+
};
|
|
352
169
|
}
|
|
353
170
|
|
|
354
171
|
// --- Frame -----------------------------------------------------------------
|
|
355
172
|
|
|
356
|
-
|
|
357
|
-
|
|
173
|
+
function StatRow(props) {
|
|
174
|
+
return (() => {
|
|
175
|
+
var _el$ = _$createElement("box"),
|
|
176
|
+
_el$2 = _$createElement("text"),
|
|
177
|
+
_el$3 = _$createElement("text"),
|
|
178
|
+
_el$4 = _$createElement("b");
|
|
179
|
+
_$insertNode(_el$, _el$2);
|
|
180
|
+
_$insertNode(_el$, _el$3);
|
|
181
|
+
_$setProp(_el$, "width", '100%');
|
|
182
|
+
_$setProp(_el$, "flexDirection", 'row');
|
|
183
|
+
_$setProp(_el$, "justifyContent", 'space-between');
|
|
184
|
+
_$insert(_el$2, () => props.label);
|
|
185
|
+
_$insertNode(_el$3, _el$4);
|
|
186
|
+
_$insert(_el$4, () => props.value);
|
|
187
|
+
_$effect(_p$ => {
|
|
188
|
+
var _v$ = props.theme().textMuted,
|
|
189
|
+
_v$2 = props.theme()[props.tone ?? 'text'];
|
|
190
|
+
_v$ !== _p$.e && (_p$.e = _$setProp(_el$2, "fg", _v$, _p$.e));
|
|
191
|
+
_v$2 !== _p$.t && (_p$.t = _$setProp(_el$3, "fg", _v$2, _p$.t));
|
|
192
|
+
return _p$;
|
|
193
|
+
}, {
|
|
194
|
+
e: undefined,
|
|
195
|
+
t: undefined
|
|
196
|
+
});
|
|
197
|
+
return _el$;
|
|
198
|
+
})();
|
|
199
|
+
}
|
|
200
|
+
export function AntigravitySidebar(props) {
|
|
358
201
|
const prefs = props.settings;
|
|
359
|
-
const collapsed = props.collapsed;
|
|
360
202
|
const now = props.now;
|
|
361
203
|
const hasData = () => props.accounts().length > 0;
|
|
362
204
|
const backoffActive = () => {
|
|
363
205
|
const until = props.quotaBackoffUntil();
|
|
364
206
|
return typeof until === 'number' && until > now();
|
|
365
207
|
};
|
|
366
|
-
const
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
208
|
+
const visibleAccounts = createMemo(() => props.accounts().filter(account => prefs().sections.fallbackAccounts || account.current).map(account => accountView(account, now(), prefs().appearance)));
|
|
209
|
+
const theme = () => {
|
|
210
|
+
const source = props.theme();
|
|
211
|
+
return {
|
|
212
|
+
...source,
|
|
213
|
+
textMuted: source.textMuted ?? source.text,
|
|
214
|
+
accent: source.accent ?? source.text,
|
|
215
|
+
success: source.success ?? source.accent ?? source.text,
|
|
216
|
+
warning: source.warning ?? source.accent ?? source.text,
|
|
217
|
+
error: source.error ?? source.accent ?? source.text
|
|
218
|
+
};
|
|
375
219
|
};
|
|
376
220
|
|
|
377
|
-
//
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const routeLines = route => [`${route.family}: ${route.style}`, route.strategy ?? ''].filter(line => line !== '');
|
|
381
|
-
|
|
382
|
-
// The width available to content: the header row spans the panel inside
|
|
383
|
-
// its padding. Layout reports it during a render pass, so the
|
|
384
|
-
// signal is updated afterwards rather than rebuilding rows mid-pass.
|
|
385
|
-
const [contentWidth, setContentWidth] = createSignal(ASSUMED_CONTENT_WIDTH);
|
|
386
|
-
let headerRow;
|
|
221
|
+
// Routing keeps whole parts on separate lines when the single stat row is too wide.
|
|
222
|
+
const [contentWidth, setContentWidth] = createSignal(28);
|
|
223
|
+
let sections;
|
|
387
224
|
const measureContentWidth = () => {
|
|
388
|
-
const width =
|
|
389
|
-
if (
|
|
390
|
-
queueMicrotask(() => {
|
|
391
|
-
if (width !== contentWidth()) setContentWidth(width);
|
|
392
|
-
});
|
|
225
|
+
const width = sections?.width;
|
|
226
|
+
if (width && width !== contentWidth()) queueMicrotask(() => setContentWidth(width));
|
|
393
227
|
};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
// affordance for nothing.
|
|
426
|
-
if (hasData()) props.onToggleCollapsed();
|
|
427
|
-
});
|
|
428
|
-
_$insertNode(_el$14, _el$15);
|
|
429
|
-
_$setProp(_el$14, "paddingLeft", 1);
|
|
430
|
-
_$setProp(_el$14, "paddingRight", 1);
|
|
431
|
-
_$insertNode(_el$15, _el$16);
|
|
432
|
-
_$insert(_el$16, headerLabel);
|
|
433
|
-
_$insert(_el$13, _$createComponent(Show, {
|
|
434
|
-
get when() {
|
|
435
|
-
return _$memo(() => !!prefs().header.showVersion)() && props.version !== '';
|
|
436
|
-
},
|
|
437
|
-
get children() {
|
|
438
|
-
var _el$17 = _$createElement("text");
|
|
439
|
-
_$insert(_el$17, () => `v${props.version}`);
|
|
440
|
-
_$effect(_$p => _$setProp(_el$17, "fg", theme().textMuted, _$p));
|
|
441
|
-
return _el$17;
|
|
442
|
-
}
|
|
443
|
-
}), null);
|
|
444
|
-
_$insert(_el$12, _$createComponent(Show, {
|
|
445
|
-
get when() {
|
|
446
|
-
return _$memo(() => !!collapsed())() && hasData();
|
|
447
|
-
},
|
|
448
|
-
get children() {
|
|
449
|
-
return _$createComponent(For, {
|
|
450
|
-
get each() {
|
|
451
|
-
return visibleAccounts();
|
|
452
|
-
},
|
|
453
|
-
children: account => _$createComponent(CollapsedAccount, {
|
|
454
|
-
theme: theme,
|
|
455
|
-
appearance: () => prefs().appearance,
|
|
456
|
-
account: account,
|
|
457
|
-
now: now,
|
|
458
|
-
width: contentWidth
|
|
459
|
-
})
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
}), null);
|
|
463
|
-
_$insert(_el$12, _$createComponent(Show, {
|
|
228
|
+
const routeValue = route => `${route.strategy ? `${route.strategy} · ` : ''}${route.family}: ${route.style}`;
|
|
229
|
+
const routeLines = route => [`${route.family}: ${route.style}`, route.strategy ?? ''].filter(Boolean);
|
|
230
|
+
return _$createComponent(SidebarFrame, {
|
|
231
|
+
get header() {
|
|
232
|
+
return {
|
|
233
|
+
badge: prefs().header.label,
|
|
234
|
+
version: prefs().header.showVersion && props.version ? `v${props.version}` : undefined
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
get theme() {
|
|
238
|
+
return theme();
|
|
239
|
+
},
|
|
240
|
+
get appearance() {
|
|
241
|
+
return prefs().appearance;
|
|
242
|
+
},
|
|
243
|
+
get accounts() {
|
|
244
|
+
return visibleAccounts();
|
|
245
|
+
},
|
|
246
|
+
get showQuota() {
|
|
247
|
+
return prefs().sections.quota;
|
|
248
|
+
},
|
|
249
|
+
get now() {
|
|
250
|
+
return now();
|
|
251
|
+
},
|
|
252
|
+
get collapsed() {
|
|
253
|
+
return props.collapsed();
|
|
254
|
+
},
|
|
255
|
+
get onToggle() {
|
|
256
|
+
return props.onToggleCollapsed;
|
|
257
|
+
},
|
|
258
|
+
sections: () => _$createComponent(Show, {
|
|
464
259
|
get when() {
|
|
465
|
-
return !collapsed() || !hasData();
|
|
260
|
+
return !props.collapsed() || !hasData();
|
|
466
261
|
},
|
|
467
262
|
get children() {
|
|
468
|
-
|
|
263
|
+
var _el$5 = _$createElement("box");
|
|
264
|
+
_$use(element => {
|
|
265
|
+
sections = element;
|
|
266
|
+
}, _el$5);
|
|
267
|
+
_$setProp(_el$5, "width", '100%');
|
|
268
|
+
_$setProp(_el$5, "flexDirection", 'column');
|
|
269
|
+
_$setProp(_el$5, "onSizeChange", measureContentWidth);
|
|
270
|
+
_$insert(_el$5, _$createComponent(Show, {
|
|
469
271
|
get when() {
|
|
470
272
|
return hasData();
|
|
471
273
|
},
|
|
472
274
|
get fallback() {
|
|
473
275
|
return (() => {
|
|
474
|
-
var _el$
|
|
475
|
-
|
|
476
|
-
_$
|
|
477
|
-
_$
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
return _el$
|
|
276
|
+
var _el$6 = _$createElement("box");
|
|
277
|
+
_$setProp(_el$6, "marginTop", 1);
|
|
278
|
+
_$setProp(_el$6, "width", '100%');
|
|
279
|
+
_$insert(_el$6, _$createComponent(SidebarTextRow, {
|
|
280
|
+
text: "Waiting for quota\u2026",
|
|
281
|
+
wrapMode: "none"
|
|
282
|
+
}));
|
|
283
|
+
return _el$6;
|
|
482
284
|
})();
|
|
483
285
|
},
|
|
484
286
|
get children() {
|
|
485
287
|
return [_$createComponent(Show, {
|
|
486
288
|
get when() {
|
|
487
|
-
return prefs().sections.quota;
|
|
289
|
+
return _$memo(() => !!prefs().sections.quota)() && visibleAccounts().length === 0;
|
|
488
290
|
},
|
|
489
291
|
get children() {
|
|
490
|
-
return
|
|
491
|
-
theme: theme,
|
|
292
|
+
return _$createComponent(SidebarSection, {
|
|
492
293
|
title: "Quota"
|
|
493
|
-
})
|
|
494
|
-
get each() {
|
|
495
|
-
return visibleAccounts();
|
|
496
|
-
},
|
|
497
|
-
children: (account, index) => _$createComponent(AccountBlock, {
|
|
498
|
-
theme: theme,
|
|
499
|
-
get appearance() {
|
|
500
|
-
return prefs().appearance;
|
|
501
|
-
},
|
|
502
|
-
account: account,
|
|
503
|
-
now: now,
|
|
504
|
-
width: contentWidth,
|
|
505
|
-
get marginTop() {
|
|
506
|
-
return index() === 0 ? 0 : 1;
|
|
507
|
-
}
|
|
508
|
-
})
|
|
509
|
-
})];
|
|
294
|
+
});
|
|
510
295
|
}
|
|
511
296
|
}), _$createComponent(Show, {
|
|
512
297
|
get when() {
|
|
513
298
|
return prefs().sections.routing;
|
|
514
299
|
},
|
|
515
300
|
get children() {
|
|
516
|
-
return
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
children: route => _$createComponent(Show, {
|
|
533
|
-
get when() {
|
|
534
|
-
return routeLineFits('Route', routeValue(route()), contentWidth());
|
|
535
|
-
},
|
|
536
|
-
get fallback() {
|
|
537
|
-
return _$createComponent(For, {
|
|
538
|
-
get each() {
|
|
539
|
-
return routeLines(route());
|
|
301
|
+
return _$createComponent(SidebarSection, {
|
|
302
|
+
title: "Routing",
|
|
303
|
+
get children() {
|
|
304
|
+
return _$createComponent(Show, {
|
|
305
|
+
get when() {
|
|
306
|
+
return props.route();
|
|
307
|
+
},
|
|
308
|
+
get fallback() {
|
|
309
|
+
return _$createComponent(SidebarTextRow, {
|
|
310
|
+
text: "No request yet",
|
|
311
|
+
wrapMode: "none"
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
children: route => _$createComponent(Show, {
|
|
315
|
+
get when() {
|
|
316
|
+
return routeLineFits('Route', routeValue(route()), contentWidth());
|
|
540
317
|
},
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
get value() {
|
|
557
|
-
return routeValue(route());
|
|
318
|
+
get fallback() {
|
|
319
|
+
return _$createComponent(For, {
|
|
320
|
+
get each() {
|
|
321
|
+
return routeLines(route());
|
|
322
|
+
},
|
|
323
|
+
children: line => (() => {
|
|
324
|
+
var _el$7 = _$createElement("text"),
|
|
325
|
+
_el$8 = _$createElement("b");
|
|
326
|
+
_$insertNode(_el$7, _el$8);
|
|
327
|
+
_$setProp(_el$7, "wrapMode", 'none');
|
|
328
|
+
_$insert(_el$8, line);
|
|
329
|
+
_$effect(_$p => _$setProp(_el$7, "fg", theme().accent, _$p));
|
|
330
|
+
return _el$7;
|
|
331
|
+
})()
|
|
332
|
+
});
|
|
558
333
|
},
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
334
|
+
get children() {
|
|
335
|
+
return _$createComponent(StatRow, {
|
|
336
|
+
theme: theme,
|
|
337
|
+
label: "Route",
|
|
338
|
+
get value() {
|
|
339
|
+
return routeValue(route());
|
|
340
|
+
},
|
|
341
|
+
tone: "accent"
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
})
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
});
|
|
564
348
|
}
|
|
565
349
|
}), _$createComponent(Show, {
|
|
566
350
|
get when() {
|
|
567
|
-
return _$memo(() => !!
|
|
351
|
+
return _$memo(() => !!(backoffActive() || !!props.lastError()))() && prefs().sections.health;
|
|
568
352
|
},
|
|
569
353
|
get children() {
|
|
570
|
-
return
|
|
571
|
-
|
|
572
|
-
title: "Health"
|
|
573
|
-
}), _$createComponent(Show, {
|
|
574
|
-
get when() {
|
|
575
|
-
return backoffActive();
|
|
576
|
-
},
|
|
354
|
+
return _$createComponent(SidebarSection, {
|
|
355
|
+
title: "Health",
|
|
577
356
|
get children() {
|
|
578
|
-
return _$createComponent(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
get value() {
|
|
582
|
-
return `backoff ${formatResetIn(props.quotaBackoffUntil(), now())}`;
|
|
357
|
+
return [_$createComponent(Show, {
|
|
358
|
+
get when() {
|
|
359
|
+
return backoffActive();
|
|
583
360
|
},
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
get
|
|
596
|
-
return lastError()
|
|
361
|
+
get children() {
|
|
362
|
+
return _$createComponent(StatRow, {
|
|
363
|
+
theme: theme,
|
|
364
|
+
label: "Quota API",
|
|
365
|
+
get value() {
|
|
366
|
+
return `backoff ${formatResetIn(props.quotaBackoffUntil(), now())}`;
|
|
367
|
+
},
|
|
368
|
+
tone: "warning"
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
}), _$createComponent(Show, {
|
|
372
|
+
get when() {
|
|
373
|
+
return props.lastError();
|
|
597
374
|
},
|
|
598
|
-
|
|
599
|
-
|
|
375
|
+
get children() {
|
|
376
|
+
return _$createComponent(StatRow, {
|
|
377
|
+
theme: theme,
|
|
378
|
+
label: "Last error",
|
|
379
|
+
get value() {
|
|
380
|
+
return props.lastError() ?? '';
|
|
381
|
+
},
|
|
382
|
+
tone: "error"
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
})];
|
|
600
386
|
}
|
|
601
|
-
})
|
|
387
|
+
});
|
|
602
388
|
}
|
|
603
389
|
})];
|
|
604
390
|
}
|
|
605
|
-
});
|
|
391
|
+
}));
|
|
392
|
+
return _el$5;
|
|
606
393
|
}
|
|
607
|
-
})
|
|
608
|
-
|
|
609
|
-
var _v$3 = theme().accent,
|
|
610
|
-
_v$4 = theme().background;
|
|
611
|
-
_v$3 !== _p$.e && (_p$.e = _$setProp(_el$14, "backgroundColor", _v$3, _p$.e));
|
|
612
|
-
_v$4 !== _p$.t && (_p$.t = _$setProp(_el$15, "fg", _v$4, _p$.t));
|
|
613
|
-
return _p$;
|
|
614
|
-
}, {
|
|
615
|
-
e: undefined,
|
|
616
|
-
t: undefined
|
|
617
|
-
});
|
|
618
|
-
return _el$12;
|
|
619
|
-
})();
|
|
394
|
+
})
|
|
395
|
+
});
|
|
620
396
|
}
|