@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.
Files changed (107) hide show
  1. package/dist/cli.js +354 -278
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +66 -21
  4. package/dist/index.js +841 -392
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +123 -28
  7. package/dist/server.js +860 -411
  8. package/dist/server.js.map +4 -4
  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/fs/refresh-file-lock.js +2 -2
  14. package/dist/src/common-auth-embedded/fs/with-lock.js +37 -10
  15. package/dist/src/common-auth-embedded/quota/format.d.ts +9 -4
  16. package/dist/src/common-auth-embedded/quota/format.js +45 -26
  17. package/dist/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
  18. package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +654 -0
  19. package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
  20. package/dist/src/common-auth-embedded/routing-accessor/index.js +128 -0
  21. package/dist/src/common-auth-embedded/source-output.json +69 -29
  22. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  23. package/dist/src/ga/tui/host-ga.js +2 -2
  24. package/dist/src/ga/tui/host-ga.js.map +1 -1
  25. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  26. package/dist/src/plugin/index.d.ts.map +1 -1
  27. package/dist/src/plugin/index.js +2 -0
  28. package/dist/src/plugin/index.js.map +1 -1
  29. package/dist/src/plugin/request.d.ts.map +1 -1
  30. package/dist/src/plugin/request.js +1 -0
  31. package/dist/src/plugin/request.js.map +1 -1
  32. package/dist/src/plugin/shared/request-services.d.ts +6 -0
  33. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  34. package/dist/src/plugin/shared/request-services.js +89 -2
  35. package/dist/src/plugin/shared/request-services.js.map +1 -1
  36. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  37. package/dist/src/plugin/shared/vault-request-credentials.js +4 -0
  38. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  39. package/dist/src/plugin/shared/vault-routing-purpose.d.ts +12 -0
  40. package/dist/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -0
  41. package/dist/src/plugin/shared/vault-routing-purpose.js +18 -0
  42. package/dist/src/plugin/shared/vault-routing-purpose.js.map +1 -0
  43. package/dist/src/plugin/shared/vault-routing.d.ts +36 -0
  44. package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -0
  45. package/dist/src/plugin/shared/vault-routing.js +213 -0
  46. package/dist/src/plugin/shared/vault-routing.js.map +1 -0
  47. package/dist/src/plugin/types.d.ts +1 -0
  48. package/dist/src/plugin/types.d.ts.map +1 -1
  49. package/dist/src/tui/quota-layout.d.ts +4 -58
  50. package/dist/src/tui/quota-layout.d.ts.map +1 -1
  51. package/dist/src/tui/quota-layout.js +4 -90
  52. package/dist/src/tui/quota-layout.js.map +1 -1
  53. package/dist/src/tui/sidebar-frame.d.ts +4 -34
  54. package/dist/src/tui/sidebar-frame.d.ts.map +1 -1
  55. package/dist/src/tui/sidebar-frame.js +93 -167
  56. package/dist/src/tui/sidebar-frame.js.map +1 -1
  57. package/dist/src/tui.js +2 -2
  58. package/dist/src/tui.js.map +1 -1
  59. package/dist/tui-build-map.json +31 -17
  60. package/dist/tui-ga-build-map.json +32 -17
  61. package/dist/types/src/common-auth-embedded/quota/format.d.ts +9 -4
  62. package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
  63. package/dist/types/src/plugin/index.d.ts.map +1 -1
  64. package/dist/types/src/plugin/request.d.ts.map +1 -1
  65. package/dist/types/src/plugin/shared/request-services.d.ts +6 -0
  66. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  67. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  68. package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts +12 -0
  69. package/dist/types/src/plugin/shared/vault-routing-purpose.d.ts.map +1 -0
  70. package/dist/types/src/plugin/shared/vault-routing.d.ts +36 -0
  71. package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -0
  72. package/dist/types/src/plugin/types.d.ts +1 -0
  73. package/dist/types/src/plugin/types.d.ts.map +1 -1
  74. package/package.json +2 -2
  75. package/src/common-auth-embedded/claustrum/custody.js +25 -0
  76. package/src/common-auth-embedded/claustrum/hub.js +20 -1
  77. package/src/common-auth-embedded/claustrum/insula.js +6 -0
  78. package/src/common-auth-embedded/fs/refresh-file-lock.js +2 -2
  79. package/src/common-auth-embedded/fs/with-lock.js +37 -10
  80. package/src/common-auth-embedded/quota/format.d.ts +9 -4
  81. package/src/common-auth-embedded/quota/format.js +45 -26
  82. package/src/common-auth-embedded/quota-sidebar/index.d.ts +86 -0
  83. package/src/common-auth-embedded/quota-sidebar/index.tsx +654 -0
  84. package/src/common-auth-embedded/routing-accessor/index.d.ts +62 -0
  85. package/src/common-auth-embedded/routing-accessor/index.js +128 -0
  86. package/src/common-auth-embedded/source-output.json +69 -29
  87. package/src/tui-compiled/common-auth-embedded/quota/format.js +45 -26
  88. package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +683 -0
  89. package/src/tui-compiled/tui/quota-layout.js +5 -330
  90. package/src/tui-compiled/tui/sidebar-frame.js +243 -467
  91. package/src/tui-compiled/tui.js +2 -2
  92. package/src/tui-ga-compiled/host-ga.js +2 -2
  93. package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +45 -26
  94. package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +243 -467
  95. package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +5 -330
  96. package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +683 -0
  97. package/src/tui-ga-raw/host-ga.tsx +2 -2
  98. package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +45 -26
  99. package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +214 -400
  100. package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +10 -301
  101. package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +654 -0
  102. package/src/tui-raw/common-auth-embedded/quota/format.js +45 -26
  103. package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +654 -0
  104. package/src/tui-raw/tui/quota-layout.tsx +10 -301
  105. package/src/tui-raw/tui/sidebar-frame.tsx +214 -400
  106. package/src/tui-raw/tui.tsx +2 -2
  107. package/src/tui.tsx +2 -2
@@ -5,10 +5,10 @@
5
5
  //
6
6
  // The rules: a window is named by its length (`5h`, `7d`), or, for a window
7
7
  // that binds only one model family, by the label the plugin stored it under.
8
- // Every figure is "% left". A window the provider did not report (an absence
9
- // record or a retirement tombstone) is left out rather than written as "not
10
- // reported". A reset is a short time from now (`resets 2h`). A reading older
11
- // than fifteen minutes says how old it is (`checked 3h ago`).
8
+ // Every reported window figure is "% left". A window the provider did not
9
+ // report (an absence record or a retirement tombstone) is left out rather than
10
+ // written as "not reported". A reset is a short time from now (`resets 2h`).
11
+ // A reading older than fifteen minutes says how old it is (`checked 3h ago`).
12
12
  //
13
13
  // Like the rest of this module it reads no clock: `now` is a parameter.
14
14
  import { ALL_SCOPE } from "./map.js";
@@ -97,12 +97,14 @@ function displayOrder(left, right) {
97
97
  return left.label < right.label ? -1 : left.label > right.label ? 1 : 0;
98
98
  }
99
99
  /**
100
- * Structured quota wording for layouts that need one row per window. The
101
- * windows use the same filtering and order as `quotaTextParts`; future resets
102
- * and the optional age keep the shared formatter's wording.
100
+ * Structured quota wording for layouts that need one row per window.
101
+ * Windows without a dated percentage remain as explicit unknown parts. Limits
102
+ * marked absent (not reported) or retired (no longer tracked) remain omitted.
103
+ * Reported windows, future resets and the optional age keep the shared
104
+ * formatter's wording and order.
103
105
  */
104
106
  export function quotaWindowParts(quota, options) {
105
- const { windows, age } = scopedWindowParts(quota, options);
107
+ const { windows, age } = scopedWindowParts(quota, options, true);
106
108
  const parts = windows.map(({ part }) => part);
107
109
  return age === undefined ? { windows: parts } : { windows: parts, age };
108
110
  }
@@ -125,34 +127,47 @@ function withShortNames(windows) {
125
127
  }
126
128
  return windows;
127
129
  }
130
+ function hasWindowReading(limit) {
131
+ return (Number.isFinite(limit.remainingPercent) && Number.isFinite(limit.checkedAt));
132
+ }
128
133
  /**
129
134
  * `quotaWindowParts` with each window's scope kept beside it. The narrow form
130
135
  * needs the scope to name and pick model-scoped windows; the public parts do
131
- * not carry it, so their shape stays as it was.
136
+ * not carry the scope.
132
137
  */
133
- function scopedWindowParts(quota, options) {
138
+ function scopedWindowParts(quota, options, includeUnknown = false) {
134
139
  if (!quota)
135
140
  return { windows: [] };
136
141
  const { now } = options;
137
142
  const readings = quota.limits
138
- .filter((limit) => limit.kind === 'reading' && limit.remainingPercent !== undefined)
143
+ .filter((limit) => limit.kind === 'reading' && (includeUnknown || hasWindowReading(limit)))
139
144
  .sort(displayOrder);
140
145
  const windows = readings.map((limit) => {
141
- const remainingPercent = clampPercent(limit.remainingPercent ?? 0);
142
- return {
143
- scope: limit.scope,
144
- ...(limit.windowMinutes === undefined
145
- ? {}
146
- : { windowMinutes: limit.windowMinutes }),
147
- part: {
146
+ const part = hasWindowReading(limit)
147
+ ? {
148
148
  kind: 'window',
149
+ reading: 'known',
149
150
  name: quotaWindowName(limit),
150
151
  short: '',
151
- figure: percentLeft(limit.remainingPercent ?? 0),
152
- remainingPercent,
152
+ figure: percentLeft(limit.remainingPercent),
153
+ remainingPercent: clampPercent(limit.remainingPercent),
153
154
  checkedAt: limit.checkedAt,
154
155
  ...resetDetails(limit.resetsAt, limit.checkedAt, now),
155
- },
156
+ }
157
+ : {
158
+ kind: 'window',
159
+ reading: 'unknown',
160
+ name: quotaWindowName(limit),
161
+ short: '',
162
+ figure: 'no reading',
163
+ resetSinceReading: false,
164
+ };
165
+ return {
166
+ scope: limit.scope,
167
+ ...(limit.windowMinutes === undefined
168
+ ? {}
169
+ : { windowMinutes: limit.windowMinutes }),
170
+ part,
156
171
  };
157
172
  });
158
173
  const budget = quota.budget;
@@ -168,6 +183,7 @@ function scopedWindowParts(quota, options) {
168
183
  spent: budget.reached,
169
184
  part: {
170
185
  kind: 'budget',
186
+ reading: 'known',
171
187
  name: 'credits',
172
188
  short: '',
173
189
  figure,
@@ -180,8 +196,11 @@ function scopedWindowParts(quota, options) {
180
196
  });
181
197
  }
182
198
  withShortNames(windows);
183
- if (windows.length > 0) {
184
- const age = now - Math.min(...windows.map(({ part }) => part.checkedAt));
199
+ const readingTimes = windows.flatMap(({ part }) => part.reading === 'known' && part.checkedAt !== undefined
200
+ ? [part.checkedAt]
201
+ : []);
202
+ if (readingTimes.length > 0) {
203
+ const age = now - Math.min(...readingTimes);
185
204
  if (age > (options.staleAfterMs ?? QUOTA_STALE_AFTER_MS)) {
186
205
  return { windows, age: `checked ${shortSpan(age)} ago` };
187
206
  }
@@ -357,13 +376,13 @@ function narrowTextParts(quota, options) {
357
376
  export function quotaTextParts(quota, options) {
358
377
  if (options.form === 'narrow')
359
378
  return narrowTextParts(quota, options);
360
- const parts = quotaWindowParts(quota, options);
379
+ const { windows, age } = scopedWindowParts(quota, options);
361
380
  const full = (options.form ?? 'full') === 'full';
362
- const text = parts.windows.map((part) => {
381
+ const text = windows.map(({ part }) => {
363
382
  const reset = full && part.resetIn ? `, resets ${part.resetIn}` : '';
364
383
  return `${part.kind === 'budget' ? '' : `${part.name} `}${part.figure}${reset}`;
365
384
  });
366
- return parts.age === undefined ? text : [...text, parts.age];
385
+ return age === undefined ? text : [...text, age];
367
386
  }
368
387
  /**
369
388
  * A row's quota as one line: `5h 58% left · 7d 90% left` in the compact