@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,3 +1,4 @@
1
+ import { channel } from 'node:diagnostics_channel';
1
2
  import { ClaustrumCredentialError, } from '@cortexkit/claustrum-client';
2
3
  import { createLogger } from '../logger/index.js';
3
4
  import { ClaustrumUnreachableError, classifyVaultFailure, } from './availability.js';
@@ -27,6 +28,8 @@ function scopedRetryReason(served, current) {
27
28
  return 'rotated';
28
29
  }
29
30
  const defaultLogger = createLogger('claustrum');
31
+ // Opt-in diagnostics let tests retain wait phases without logging each vault read.
32
+ const phaseDiagnostics = channel('common-auth.claustrum.phases');
30
33
  /**
31
34
  * Decide whether a request that got a 401 should retry with the freshly
32
35
  * re-authorized receipt, and log the decision. The vault can refresh a
@@ -280,6 +283,11 @@ export class ClaustrumScopedCustody {
280
283
  }
281
284
  async #token(signal) {
282
285
  this.#check(signal);
286
+ if (phaseDiagnostics.hasSubscribers)
287
+ phaseDiagnostics.publish({
288
+ logger: this.#logger,
289
+ phase: 'token read begin',
290
+ });
283
291
  const pending = this.#readToken();
284
292
  this.#tokenReads.add(pending);
285
293
  let value;
@@ -288,6 +296,11 @@ export class ClaustrumScopedCustody {
288
296
  }
289
297
  finally {
290
298
  this.#tokenReads.delete(pending);
299
+ if (phaseDiagnostics.hasSubscribers)
300
+ phaseDiagnostics.publish({
301
+ logger: this.#logger,
302
+ phase: 'token read end',
303
+ });
291
304
  }
292
305
  this.#check(signal);
293
306
  if (!/^[0-9a-f]{64}$/.test(value.token) ||
@@ -359,6 +372,11 @@ export class ClaustrumScopedCustody {
359
372
  this.#kept.clear();
360
373
  throw error;
361
374
  }
375
+ if (phaseDiagnostics.hasSubscribers)
376
+ phaseDiagnostics.publish({
377
+ logger: this.#logger,
378
+ phase: 'list scoped begin',
379
+ });
362
380
  try {
363
381
  inventory = await this.#call(() => this.#client.listScoped(token), signal);
364
382
  }
@@ -366,6 +384,13 @@ export class ClaustrumScopedCustody {
366
384
  this.listFailed(error);
367
385
  throw error;
368
386
  }
387
+ finally {
388
+ if (phaseDiagnostics.hasSubscribers)
389
+ phaseDiagnostics.publish({
390
+ logger: this.#logger,
391
+ phase: 'list scoped end',
392
+ });
393
+ }
369
394
  const skipped = [];
370
395
  const refused = [];
371
396
  let notMine = 0;
@@ -11,6 +11,7 @@
11
11
  // different processes already share, plus the base-view rule, so a commit
12
12
  // never replaces a view another process committed after this hub listed.
13
13
  import { createHash } from 'node:crypto';
14
+ import { channel } from 'node:diagnostics_channel';
14
15
  import { readdir, stat } from 'node:fs/promises';
15
16
  import { dirname, join, resolve } from 'node:path';
16
17
  import { createLogger } from '../logger/index.js';
@@ -766,7 +767,25 @@ export class ClaustrumDiscoveryHub {
766
767
  throw base;
767
768
  // A member's first roster under this key carries the declines and
768
769
  // order of its newest roster under an older key.
769
- const seed = base.file ? undefined : await this.#seed(entry);
770
+ let seed;
771
+ if (!base.file) {
772
+ const phaseDiagnostics = channel('common-auth.claustrum.phases');
773
+ if (phaseDiagnostics.hasSubscribers)
774
+ phaseDiagnostics.publish({
775
+ logger: this.#logger,
776
+ phase: `seed read ${entry.provider} begin`,
777
+ });
778
+ try {
779
+ seed = await this.#seed(entry);
780
+ }
781
+ finally {
782
+ if (phaseDiagnostics.hasSubscribers)
783
+ phaseDiagnostics.publish({
784
+ logger: this.#logger,
785
+ phase: `seed read ${entry.provider} end`,
786
+ });
787
+ }
788
+ }
770
789
  const roster = await refreshVaultRoster({
771
790
  path: entry.path,
772
791
  custody: { discover: async () => share },
@@ -443,6 +443,12 @@ export class InsulaQuotaSource {
443
443
  ...(typeof entry.source === 'string' && { source: entry.source }),
444
444
  },
445
445
  };
446
+ // Kept usage must not trigger a provider poll after a non-local failure.
447
+ // Only an explicitly local failure permits fallback; unknown causes do not.
448
+ if (entry.stale !== undefined &&
449
+ (!record(entry.stale) ||
450
+ entry.stale.class !== 'local_source_unavailable'))
451
+ return { miss: 'upstream-failed', reading };
446
452
  return now >= fetchedAt + MAX_AGE || entry.stale !== undefined
447
453
  ? { miss: 'stale', reading }
448
454
  : { reading };
@@ -0,0 +1,86 @@
1
+ import type { RGBA } from '@opentui/core';
2
+ import type { JSX } from '@opentui/solid';
3
+ import type { QuotaWindowPart } from '../quota/format.js';
4
+ import type { ProjectedQuota } from '../quota/projection.js';
5
+ export type Tone = 'text' | 'textMuted' | 'accent' | 'success' | 'warning' | 'error';
6
+ export type SidebarTheme = Readonly<Partial<Record<Tone | 'background' | 'borderActive', RGBA | string | undefined>>>;
7
+ export interface SidebarAppearance {
8
+ barWidth: number;
9
+ barFilledChar: string;
10
+ barEmptyChar: string;
11
+ warnThreshold: number;
12
+ errorThreshold: number;
13
+ }
14
+ export interface PaceView {
15
+ text: string;
16
+ tone: Tone;
17
+ /** The elapsed-window percentage, not the difference from usage. */
18
+ overlay?: {
19
+ kind: 'reserve' | 'deficit';
20
+ percent: number;
21
+ };
22
+ }
23
+ export interface QuotaGroupView {
24
+ title?: string;
25
+ rows: readonly {
26
+ part: QuotaWindowPart;
27
+ pace?: PaceView;
28
+ }[];
29
+ }
30
+ export interface AccountView {
31
+ id: string;
32
+ label: string;
33
+ titleSuffix?: string;
34
+ status: {
35
+ text: string;
36
+ tone: Tone;
37
+ };
38
+ blocked: boolean;
39
+ indicatorTone: Tone;
40
+ quota: ProjectedQuota | undefined;
41
+ groups: readonly QuotaGroupView[];
42
+ emptyQuotaText?: {
43
+ expanded: string;
44
+ collapsed: string;
45
+ };
46
+ /** Presentation decided by the plugin, never inferred from status or freshness. */
47
+ collapsed?: {
48
+ quotaTone?: Tone;
49
+ muted?: boolean;
50
+ };
51
+ }
52
+ export interface SidebarFrameProps {
53
+ header: {
54
+ badge: string;
55
+ version?: string;
56
+ };
57
+ accounts: readonly AccountView[];
58
+ theme?: SidebarTheme;
59
+ appearance: SidebarAppearance;
60
+ showQuota: boolean;
61
+ now: number;
62
+ collapsed: boolean;
63
+ onToggle: () => void;
64
+ beforeQuota?: (account: AccountView) => JSX.Element;
65
+ afterQuota?: (account: AccountView) => JSX.Element;
66
+ sections?: () => JSX.Element;
67
+ collapsedSections?: () => JSX.Element;
68
+ }
69
+ /** A heading and its plugin-owned rows, with the frame's section spacing. */
70
+ export declare function SidebarSection(props: {
71
+ title: string;
72
+ children?: JSX.Element;
73
+ }): any;
74
+ /** Keep labels whole and reserve one blank cell before an ellipsized value. */
75
+ export declare function SidebarStatRow(props: {
76
+ label: string;
77
+ value: string;
78
+ tone?: Tone;
79
+ }): any;
80
+ export declare function SidebarTextRow(props: {
81
+ text: string;
82
+ tone?: Tone;
83
+ wrapMode?: JSX.IntrinsicElements['text']['wrapMode'];
84
+ }): any;
85
+ /** Borderless, controlled presentation; host registration and provider policy stay in the plugin. */
86
+ export declare function SidebarFrame(props: SidebarFrameProps): any;