@cortexkit/opencode-antigravity-auth 3.0.20 → 3.0.21

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.
Files changed (55) hide show
  1. package/dist/cli.js +75 -32
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +31 -11
  4. package/dist/index.js +75 -32
  5. package/dist/index.js.map +3 -3
  6. package/dist/index.meta.json +31 -11
  7. package/dist/server.js +75 -32
  8. package/dist/server.js.map +3 -3
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/claustrum/custody.js +25 -0
  11. package/dist/src/common-auth-embedded/claustrum/hub.js +20 -1
  12. package/dist/src/common-auth-embedded/claustrum/insula.js +6 -0
  13. package/dist/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
  14. package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +630 -0
  15. package/dist/src/common-auth-embedded/source-output.json +37 -17
  16. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  17. package/dist/src/ga/tui/host-ga.js +2 -2
  18. package/dist/src/ga/tui/host-ga.js.map +1 -1
  19. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  20. package/dist/src/tui/quota-layout.d.ts +4 -58
  21. package/dist/src/tui/quota-layout.d.ts.map +1 -1
  22. package/dist/src/tui/quota-layout.js +4 -90
  23. package/dist/src/tui/quota-layout.js.map +1 -1
  24. package/dist/src/tui/sidebar-frame.d.ts +4 -34
  25. package/dist/src/tui/sidebar-frame.d.ts.map +1 -1
  26. package/dist/src/tui/sidebar-frame.js +91 -167
  27. package/dist/src/tui/sidebar-frame.js.map +1 -1
  28. package/dist/src/tui.js +2 -2
  29. package/dist/src/tui.js.map +1 -1
  30. package/dist/tui-build-map.json +27 -13
  31. package/dist/tui-ga-build-map.json +28 -13
  32. package/package.json +2 -2
  33. package/src/common-auth-embedded/claustrum/custody.js +25 -0
  34. package/src/common-auth-embedded/claustrum/hub.js +20 -1
  35. package/src/common-auth-embedded/claustrum/insula.js +6 -0
  36. package/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
  37. package/src/common-auth-embedded/quota-sidebar/index.tsx +630 -0
  38. package/src/common-auth-embedded/source-output.json +37 -17
  39. package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +666 -0
  40. package/src/tui-compiled/tui/quota-layout.js +5 -330
  41. package/src/tui-compiled/tui/sidebar-frame.js +241 -466
  42. package/src/tui-compiled/tui.js +2 -2
  43. package/src/tui-ga-compiled/host-ga.js +2 -2
  44. package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +241 -466
  45. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +5 -330
  46. package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +666 -0
  47. package/src/tui-ga-raw/host-ga.tsx +2 -2
  48. package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +211 -399
  49. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +10 -301
  50. package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +630 -0
  51. package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +630 -0
  52. package/src/tui-raw/tui/quota-layout.tsx +10 -301
  53. package/src/tui-raw/tui/sidebar-frame.tsx +211 -399
  54. package/src/tui-raw/tui.tsx +2 -2
  55. package/src/tui.tsx +2 -2
@@ -1,36 +1,6 @@
1
- import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
2
- import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
3
- import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
4
- import { effect as _$effect } from "opentui:runtime-module:%40opentui%2Fsolid";
5
- import { insert as _$insert } from "opentui:runtime-module:%40opentui%2Fsolid";
6
- import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid";
7
- import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
8
- /** @jsxImportSource @opentui/solid */
9
-
10
- /**
11
- * Quota layout shared by the OpenCode 1 sidebar (`tui.tsx`) and the OpenCode 2
12
- * sidebar (`ga/tui/host-ga.tsx`): one account block with its header line, the
13
- * reading age once per account, plain-word group headers and one width-fitted
14
- * row per quota window.
15
- *
16
- * Each renderer supplies its own data source and colors. This module imports
17
- * only the pure quota presentation helpers, so it stays inside both TUI
18
- * import graphs: no sidebar file, preferences file, RPC, account store,
19
- * OAuth, token or host SDK module, and nothing that writes to the terminal.
20
- */
21
-
22
- import { For, Show } from "opentui:runtime-module:solid-js";
23
- import { NO_QUOTA_READING, quotaReadingAge, quotaWindowText } from "../quota-presentation.js";
24
-
25
- /** A text color; `undefined` leaves the host's default color in place. */
26
-
27
- /**
28
- * How a renderer colors the quota layout. OpenCode 1 maps these onto its live
29
- * host theme; a renderer without a theme returns `undefined` everywhere.
30
- */
31
-
32
- /** The bar and threshold settings the layout reads. */
1
+ /** Pure account-window inputs shared by the two sidebar hosts. */
33
2
 
3
+ import { quotaWindowText } from "../quota-presentation.js";
34
4
  /**
35
5
  * The OpenCode 1 preference defaults for the quota bar, for a renderer that
36
6
  * has no preferences file. A test keeps it equal to `DEFAULT_PREFS.appearance`.
@@ -52,46 +22,11 @@ export const GROUP_NAMES = {
52
22
  'gemini-argon': 'Argon'
53
23
  };
54
24
  export const QUOTA_ORDER = ['gemini', 'non-gemini', 'gemini-argon'];
55
-
56
- // Shown instead of a stored figure once the window has reset since it was
57
- // read: the stored figure describes the window before the reset.
58
- export const RESET_SINCE_READING = 'reset since last check';
59
-
60
- // Content width used until the first layout pass reports the real one. It
61
- // fits the narrowest OpenCode sidebar.
62
- export const ASSUMED_CONTENT_WIDTH = 28;
63
-
64
- // A window row is `<name> <bar> <figure> <reset>`. The bar shrinks to this
65
- // before the reset column is dropped; below it the bar is dropped too.
66
- const MIN_BAR_WIDTH = 4;
67
- // The widest figure the formatter writes: `100% left`.
68
- const FIGURE_WIDTH = 9;
69
- // A window name (`5h`, `7d`) and the space after it.
70
- const NAME_WIDTH = 3;
71
25
  export function quotaTone(usedPct, appearance) {
72
- if (usedPct < appearance.warnThreshold) return 'ok';
73
- if (usedPct < appearance.errorThreshold) return 'warn';
74
- return 'err';
75
- }
76
- function quotaBarSegments(remainingPct, width, appearance) {
77
- const usedCells = Math.max(0, Math.min(Math.round(remainingPct / 100 * width), width));
78
- const tone = quotaTone(100 - remainingPct, appearance);
79
- return [{
80
- text: appearance.barFilledChar.repeat(usedCells),
81
- tone
82
- }, {
83
- text: appearance.barEmptyChar.repeat(width - usedCells),
84
- tone
85
- }].filter(segment => segment.text.length > 0);
26
+ if (usedPct < appearance.warnThreshold) return 'success';
27
+ if (usedPct < appearance.errorThreshold) return 'warning';
28
+ return 'error';
86
29
  }
87
-
88
- // --- Width-fitted quota rows ------------------------------------------------
89
- //
90
- // The host sidebars are about 20 to 48 columns wide. Every quota line is
91
- // sized from the measured content width so that it fits on one line: text is
92
- // never left to the renderer's wrapping, which breaks a row mid-word or down
93
- // to one character per line once the right-hand column runs out of room.
94
-
95
30
  // One entry per stored window, in group order. A pool stored before
96
31
  // per-window readings existed contributes one window without a name.
97
32
  export function accountWindows(account, now) {
@@ -116,264 +51,4 @@ export function accountWindows(account, now) {
116
51
  });
117
52
  }
118
53
  return result;
119
- }
120
-
121
- // A window shows its figure only while no reset has happened since it was
122
- // read and it has a read time at all.
123
- export function showsFigure(window) {
124
- return window.text.remaining != null && !window.text.resetSinceReading;
125
- }
126
- // Column widths for one `<name> <bar> <figure> <reset>` row within `width`
127
- // cells. The bar shrinks first, down to MIN_BAR_WIDTH; then the reset column
128
- // is dropped; when even that leaves less than MIN_BAR_WIDTH cells for the
129
- // bar, the bar is left out and the row is just the name and figure.
130
- function windowRowLayout(width, named, resetWidth, maxBar) {
131
- const room = width - (named ? NAME_WIDTH : 0) - FIGURE_WIDTH;
132
- if (resetWidth > 0) {
133
- const bar = Math.min(maxBar, room - resetWidth - 2);
134
- if (bar >= MIN_BAR_WIDTH) return {
135
- bar,
136
- reset: true
137
- };
138
- }
139
- const bar = Math.min(maxBar, room - 1);
140
- return {
141
- bar: bar >= MIN_BAR_WIDTH ? bar : 0,
142
- reset: false
143
- };
144
- }
145
-
146
- // Shorten a label to `max` cells, marking the cut with an ellipsis.
147
- export function fitLabel(label, max) {
148
- if (label.length <= max) return label;
149
- if (max <= 0) return '';
150
- if (max === 1) return '…';
151
- return `${label.slice(0, max - 1)}…`;
152
- }
153
-
154
- // One quota window on one line. The bar fills with remaining quota; the
155
- // figure and reset come from the shared formatter. A window that reset since
156
- // its reading shows that fact, dim, in place of the stale figure.
157
- function WindowRow(props) {
158
- const text = () => props.window.text;
159
- const tone = () => quotaTone(100 - (text().remaining ?? 0), props.appearance);
160
- return (() => {
161
- var _el$ = _$createElement("box");
162
- _$setProp(_el$, "width", '100%');
163
- _$setProp(_el$, "flexDirection", 'row');
164
- _$insert(_el$, _$createComponent(Show, {
165
- get when() {
166
- return text().name !== '';
167
- },
168
- get children() {
169
- var _el$2 = _$createElement("text");
170
- _$setProp(_el$2, "width", 3);
171
- _$setProp(_el$2, "flexShrink", 0);
172
- _$setProp(_el$2, "wrapMode", 'none');
173
- _$insert(_el$2, () => text().name);
174
- _$effect(_$p => _$setProp(_el$2, "fg", props.palette.muted(), _$p));
175
- return _el$2;
176
- }
177
- }), null);
178
- _$insert(_el$, _$createComponent(Show, {
179
- get when() {
180
- return showsFigure(props.window);
181
- },
182
- get fallback() {
183
- return (() => {
184
- var _el$7 = _$createElement("text");
185
- _$setProp(_el$7, "flexShrink", 1);
186
- _$setProp(_el$7, "wrapMode", 'none');
187
- _$insert(_el$7, (() => {
188
- var _c$ = _$memo(() => !!text().resetSinceReading);
189
- return () => _c$() ? RESET_SINCE_READING : text().figure;
190
- })());
191
- _$effect(_$p => _$setProp(_el$7, "fg", props.palette.muted(), _$p));
192
- return _el$7;
193
- })();
194
- },
195
- get children() {
196
- return [_$createComponent(Show, {
197
- get when() {
198
- return props.layout.bar > 0;
199
- },
200
- get children() {
201
- var _el$3 = _$createElement("box");
202
- _$setProp(_el$3, "flexShrink", 0);
203
- _$setProp(_el$3, "flexDirection", 'row');
204
- _$insert(_el$3, _$createComponent(For, {
205
- get each() {
206
- return quotaBarSegments(text().remaining ?? 0, props.layout.bar, props.appearance);
207
- },
208
- children: segment => (() => {
209
- var _el$8 = _$createElement("text");
210
- _$setProp(_el$8, "wrapMode", 'none');
211
- _$insert(_el$8, () => segment.text);
212
- _$effect(_$p => _$setProp(_el$8, "fg", props.palette.tone(segment.tone), _$p));
213
- return _el$8;
214
- })()
215
- }));
216
- _$effect(_$p => _$setProp(_el$3, "width", props.layout.bar + 1, _$p));
217
- return _el$3;
218
- }
219
- }), (() => {
220
- var _el$4 = _$createElement("text");
221
- _$setProp(_el$4, "flexShrink", 0);
222
- _$setProp(_el$4, "wrapMode", 'none');
223
- _$insert(_el$4, () => text().figure);
224
- _$effect(_$p => _$setProp(_el$4, "fg", props.palette.tone(tone()), _$p));
225
- return _el$4;
226
- })(), (() => {
227
- var _el$5 = _$createElement("box");
228
- _$setProp(_el$5, "flexGrow", 1);
229
- return _el$5;
230
- })(), _$createComponent(Show, {
231
- get when() {
232
- return _$memo(() => !!props.layout.reset)() && text().reset !== '';
233
- },
234
- get children() {
235
- var _el$6 = _$createElement("text");
236
- _$setProp(_el$6, "flexShrink", 0);
237
- _$setProp(_el$6, "wrapMode", 'none');
238
- _$insert(_el$6, () => text().reset);
239
- _$effect(_$p => _$setProp(_el$6, "fg", props.palette.muted(), _$p));
240
- return _el$6;
241
- }
242
- })];
243
- }
244
- }), null);
245
- return _el$;
246
- })();
247
- }
248
-
249
- /**
250
- * One account's quota block. The header line is the account label, the
251
- * reading age when the oldest reading is stale, and the caller's status word
252
- * right-aligned; the age moves to its own dim line when the three do not
253
- * fit. Below it each quota group present gets a plain-word header and one
254
- * row per window, or a single dim line when there is no reading at all.
255
- * `children`, when given, render after the quota rows.
256
- */
257
- export function QuotaAccountBlock(props) {
258
- const windows = () => accountWindows(props.account, props.now());
259
- const age = () => quotaReadingAge(windows().map(window => window.reading), props.now());
260
- const ageInline = () => age() !== '' && props.account.label.length + 3 + age().length + 1 + props.status.length <= props.width();
261
- const label = () => fitLabel(props.account.label, props.width() - 1 - props.status.length);
262
- // One reset column width per account, so bars line up across its rows.
263
- const resetWidth = () => Math.max(0, ...windows().filter(showsFigure).map(window => window.text.reset.length));
264
- const layoutFor = window => windowRowLayout(props.width(), window.text.name !== '', resetWidth(), props.appearance.barWidth);
265
- const groups = () => QUOTA_ORDER.map(key => ({
266
- key,
267
- windows: windows().filter(window => window.key === key)
268
- })).filter(group => group.windows.length > 0);
269
- return (() => {
270
- var _el$9 = _$createElement("box"),
271
- _el$0 = _$createElement("box"),
272
- _el$1 = _$createElement("text"),
273
- _el$10 = _$createElement("b"),
274
- _el$12 = _$createElement("box"),
275
- _el$13 = _$createElement("text"),
276
- _el$14 = _$createElement("b");
277
- _$insertNode(_el$9, _el$0);
278
- _$setProp(_el$9, "width", '100%');
279
- _$setProp(_el$9, "flexDirection", 'column');
280
- _$insertNode(_el$0, _el$1);
281
- _$insertNode(_el$0, _el$12);
282
- _$insertNode(_el$0, _el$13);
283
- _$setProp(_el$0, "width", '100%');
284
- _$setProp(_el$0, "flexDirection", 'row');
285
- _$insertNode(_el$1, _el$10);
286
- _$setProp(_el$1, "flexShrink", 0);
287
- _$setProp(_el$1, "wrapMode", 'none');
288
- _$insert(_el$10, label);
289
- _$insert(_el$0, _$createComponent(Show, {
290
- get when() {
291
- return ageInline();
292
- },
293
- get children() {
294
- var _el$11 = _$createElement("text");
295
- _$setProp(_el$11, "flexShrink", 0);
296
- _$setProp(_el$11, "wrapMode", 'none');
297
- _$insert(_el$11, () => ` · ${age()}`);
298
- _$effect(_$p => _$setProp(_el$11, "fg", props.palette.muted(), _$p));
299
- return _el$11;
300
- }
301
- }), _el$12);
302
- _$setProp(_el$12, "flexGrow", 1);
303
- _$insertNode(_el$13, _el$14);
304
- _$setProp(_el$13, "flexShrink", 0);
305
- _$setProp(_el$13, "wrapMode", 'none');
306
- _$insert(_el$14, () => props.status);
307
- _$insert(_el$9, _$createComponent(Show, {
308
- get when() {
309
- return _$memo(() => age() !== '')() && !ageInline();
310
- },
311
- get children() {
312
- var _el$15 = _$createElement("text");
313
- _$setProp(_el$15, "wrapMode", 'none');
314
- _$insert(_el$15, age);
315
- _$effect(_$p => _$setProp(_el$15, "fg", props.palette.muted(), _$p));
316
- return _el$15;
317
- }
318
- }), null);
319
- _$insert(_el$9, _$createComponent(Show, {
320
- get when() {
321
- return groups().length > 0;
322
- },
323
- get fallback() {
324
- return (() => {
325
- var _el$16 = _$createElement("text");
326
- _$setProp(_el$16, "wrapMode", 'none');
327
- _$insert(_el$16, NO_QUOTA_READING);
328
- _$effect(_$p => _$setProp(_el$16, "fg", props.palette.muted(), _$p));
329
- return _el$16;
330
- })();
331
- },
332
- get children() {
333
- return _$createComponent(For, {
334
- get each() {
335
- return groups();
336
- },
337
- children: group => [(() => {
338
- var _el$17 = _$createElement("text");
339
- _$setProp(_el$17, "wrapMode", 'none');
340
- _$insert(_el$17, () => GROUP_NAMES[group.key]);
341
- _$effect(_$p => _$setProp(_el$17, "fg", props.palette.muted(), _$p));
342
- return _el$17;
343
- })(), _$createComponent(For, {
344
- get each() {
345
- return group.windows;
346
- },
347
- children: window => _$createComponent(WindowRow, {
348
- get palette() {
349
- return props.palette;
350
- },
351
- get appearance() {
352
- return props.appearance;
353
- },
354
- window: window,
355
- get layout() {
356
- return layoutFor(window);
357
- }
358
- })
359
- })]
360
- });
361
- }
362
- }), null);
363
- _$insert(_el$9, () => props.children, null);
364
- _$effect(_p$ => {
365
- var _v$ = props.marginTop ?? 0,
366
- _v$2 = props.palette.text(),
367
- _v$3 = props.palette.tone(props.statusTone);
368
- _v$ !== _p$.e && (_p$.e = _$setProp(_el$9, "marginTop", _v$, _p$.e));
369
- _v$2 !== _p$.t && (_p$.t = _$setProp(_el$1, "fg", _v$2, _p$.t));
370
- _v$3 !== _p$.a && (_p$.a = _$setProp(_el$13, "fg", _v$3, _p$.a));
371
- return _p$;
372
- }, {
373
- e: undefined,
374
- t: undefined,
375
- a: undefined
376
- });
377
- return _el$9;
378
- })();
379
54
  }