@cortexkit/opencode-antigravity-auth 3.1.10 → 3.1.12

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 (172) hide show
  1. package/dist/cli.js +357 -58
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +42 -32
  4. package/dist/index.js +1115 -493
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +98 -65
  7. package/dist/server.js +1266 -616
  8. package/dist/server.js.map +4 -4
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/cli.d.ts +3 -1
  11. package/dist/src/cli.d.ts.map +1 -1
  12. package/dist/src/cli.js +19 -6
  13. package/dist/src/cli.js.map +1 -1
  14. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
  15. package/dist/src/common-auth-embedded/claustrum/consumer.js +32 -0
  16. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
  17. package/dist/src/common-auth-embedded/claustrum/custody.js +145 -8
  18. package/dist/src/common-auth-embedded/claustrum/host.js +8 -0
  19. package/dist/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
  20. package/dist/src/common-auth-embedded/claustrum/hub.js +10 -0
  21. package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  22. package/dist/src/common-auth-embedded/routing-accessor/index.js +5 -3
  23. package/dist/src/common-auth-embedded/source-output.json +35 -35
  24. package/dist/src/ga/rpc/protocol.d.ts +11 -5
  25. package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
  26. package/dist/src/ga/rpc/protocol.js +11 -3
  27. package/dist/src/ga/rpc/protocol.js.map +1 -1
  28. package/dist/src/ga/server/index.d.ts.map +1 -1
  29. package/dist/src/ga/server/index.js +30 -14
  30. package/dist/src/ga/server/index.js.map +1 -1
  31. package/dist/src/ga/tui/host-ga.d.ts +2 -1
  32. package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
  33. package/dist/src/ga/tui/host-ga.js +9 -4
  34. package/dist/src/ga/tui/host-ga.js.map +1 -1
  35. package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
  36. package/dist/src/plugin/account-access.d.ts +1 -0
  37. package/dist/src/plugin/account-access.d.ts.map +1 -1
  38. package/dist/src/plugin/account-access.js +28 -0
  39. package/dist/src/plugin/account-access.js.map +1 -1
  40. package/dist/src/plugin/auth-loader.d.ts.map +1 -1
  41. package/dist/src/plugin/auth-loader.js +21 -12
  42. package/dist/src/plugin/auth-loader.js.map +1 -1
  43. package/dist/src/plugin/background-quota-refresh.d.ts +11 -24
  44. package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -1
  45. package/dist/src/plugin/background-quota-refresh.js +54 -60
  46. package/dist/src/plugin/background-quota-refresh.js.map +1 -1
  47. package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  48. package/dist/src/plugin/background-vault-quota-refresh.js +6 -3
  49. package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
  50. package/dist/src/plugin/cache/signature-cache.d.ts +3 -0
  51. package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
  52. package/dist/src/plugin/cache/signature-cache.js +73 -46
  53. package/dist/src/plugin/cache/signature-cache.js.map +1 -1
  54. package/dist/src/plugin/cache.d.ts.map +1 -1
  55. package/dist/src/plugin/cache.js +17 -7
  56. package/dist/src/plugin/cache.js.map +1 -1
  57. package/dist/src/plugin/core/streaming/displayed-thinking.d.ts +23 -0
  58. package/dist/src/plugin/core/streaming/displayed-thinking.d.ts.map +1 -0
  59. package/dist/src/plugin/core/streaming/displayed-thinking.js +58 -0
  60. package/dist/src/plugin/core/streaming/displayed-thinking.js.map +1 -0
  61. package/dist/src/plugin/fetch/warmup.d.ts +9 -2
  62. package/dist/src/plugin/fetch/warmup.d.ts.map +1 -1
  63. package/dist/src/plugin/fetch/warmup.js +22 -14
  64. package/dist/src/plugin/fetch/warmup.js.map +1 -1
  65. package/dist/src/plugin/ga-location-services.d.ts +1 -0
  66. package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
  67. package/dist/src/plugin/ga-location-services.js +2 -0
  68. package/dist/src/plugin/ga-location-services.js.map +1 -1
  69. package/dist/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
  70. package/dist/src/plugin/ga-shared-vault-custody.js +7 -1
  71. package/dist/src/plugin/ga-shared-vault-custody.js.map +1 -1
  72. package/dist/src/plugin/index.d.ts.map +1 -1
  73. package/dist/src/plugin/index.js +6 -1
  74. package/dist/src/plugin/index.js.map +1 -1
  75. package/dist/src/plugin/quota.d.ts +10 -2
  76. package/dist/src/plugin/quota.d.ts.map +1 -1
  77. package/dist/src/plugin/quota.js +38 -10
  78. package/dist/src/plugin/quota.js.map +1 -1
  79. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  80. package/dist/src/plugin/request-helpers.js +51 -19
  81. package/dist/src/plugin/request-helpers.js.map +1 -1
  82. package/dist/src/plugin/request.d.ts +12 -1
  83. package/dist/src/plugin/request.d.ts.map +1 -1
  84. package/dist/src/plugin/request.js +27 -42
  85. package/dist/src/plugin/request.js.map +1 -1
  86. package/dist/src/plugin/shared/request-services.d.ts +4 -1
  87. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  88. package/dist/src/plugin/shared/request-services.js +142 -24
  89. package/dist/src/plugin/shared/request-services.js.map +1 -1
  90. package/dist/src/plugin/shared/runtime.d.ts +3 -4
  91. package/dist/src/plugin/shared/runtime.d.ts.map +1 -1
  92. package/dist/src/plugin/shared/runtime.js +2 -2
  93. package/dist/src/plugin/shared/runtime.js.map +1 -1
  94. package/dist/src/plugin/shared/vault-request-credentials.d.ts +25 -15
  95. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  96. package/dist/src/plugin/shared/vault-request-credentials.js +141 -68
  97. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  98. package/dist/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
  99. package/dist/src/setup.d.ts +3 -0
  100. package/dist/src/setup.d.ts.map +1 -1
  101. package/dist/src/setup.js +18 -6
  102. package/dist/src/setup.js.map +1 -1
  103. package/dist/src/sidebar-state.d.ts +20 -7
  104. package/dist/src/sidebar-state.d.ts.map +1 -1
  105. package/dist/src/sidebar-state.js +57 -8
  106. package/dist/src/sidebar-state.js.map +1 -1
  107. package/dist/src/tui.d.ts.map +1 -1
  108. package/dist/src/tui.js +43 -23
  109. package/dist/src/tui.js.map +1 -1
  110. package/dist/tui-build-map.json +9 -9
  111. package/dist/tui-ga-build-map.json +5 -5
  112. package/dist/types/src/cli.d.ts +3 -1
  113. package/dist/types/src/cli.d.ts.map +1 -1
  114. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
  115. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
  116. package/dist/types/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
  117. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  118. package/dist/types/src/ga/rpc/protocol.d.ts +11 -5
  119. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
  120. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  121. package/dist/types/src/plugin/account-access.d.ts +1 -0
  122. package/dist/types/src/plugin/account-access.d.ts.map +1 -1
  123. package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
  124. package/dist/types/src/plugin/background-quota-refresh.d.ts +11 -24
  125. package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -1
  126. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  127. package/dist/types/src/plugin/cache/signature-cache.d.ts +3 -0
  128. package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -1
  129. package/dist/types/src/plugin/cache.d.ts.map +1 -1
  130. package/dist/types/src/plugin/core/streaming/displayed-thinking.d.ts +23 -0
  131. package/dist/types/src/plugin/core/streaming/displayed-thinking.d.ts.map +1 -0
  132. package/dist/types/src/plugin/fetch/warmup.d.ts +9 -2
  133. package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -1
  134. package/dist/types/src/plugin/ga-location-services.d.ts +1 -0
  135. package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
  136. package/dist/types/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
  137. package/dist/types/src/plugin/index.d.ts.map +1 -1
  138. package/dist/types/src/plugin/quota.d.ts +10 -2
  139. package/dist/types/src/plugin/quota.d.ts.map +1 -1
  140. package/dist/types/src/plugin/request-helpers.d.ts.map +1 -1
  141. package/dist/types/src/plugin/request.d.ts +12 -1
  142. package/dist/types/src/plugin/request.d.ts.map +1 -1
  143. package/dist/types/src/plugin/shared/request-services.d.ts +4 -1
  144. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  145. package/dist/types/src/plugin/shared/runtime.d.ts +3 -4
  146. package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -1
  147. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +25 -15
  148. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  149. package/dist/types/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
  150. package/dist/types/src/setup.d.ts +3 -0
  151. package/dist/types/src/setup.d.ts.map +1 -1
  152. package/dist/types/src/sidebar-state.d.ts +20 -7
  153. package/dist/types/src/sidebar-state.d.ts.map +1 -1
  154. package/package.json +3 -3
  155. package/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
  156. package/src/common-auth-embedded/claustrum/consumer.js +32 -0
  157. package/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
  158. package/src/common-auth-embedded/claustrum/custody.js +145 -8
  159. package/src/common-auth-embedded/claustrum/host.js +8 -0
  160. package/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
  161. package/src/common-auth-embedded/claustrum/hub.js +10 -0
  162. package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  163. package/src/common-auth-embedded/routing-accessor/index.js +5 -3
  164. package/src/common-auth-embedded/source-output.json +35 -35
  165. package/src/sidebar-state.ts +77 -8
  166. package/src/tui-compiled/sidebar-state.js +40 -1
  167. package/src/tui-compiled/tui.js +49 -24
  168. package/src/tui-ga-compiled/host-ga.js +11 -5
  169. package/src/tui-ga-raw/host-ga.tsx +17 -6
  170. package/src/tui-raw/sidebar-state.js +40 -1
  171. package/src/tui-raw/tui.tsx +40 -24
  172. package/src/tui.tsx +40 -24
package/dist/cli.js CHANGED
@@ -383,6 +383,11 @@ function mergeQuotaState(stored, observation) {
383
383
  if (stored === void 0)
384
384
  return incoming;
385
385
  const prior = encodeQuotaState(decodeQuotaState(stored));
386
+ const previousAt = prior.cachedQuotaUpdatedAt;
387
+ const observedAt = incoming.cachedQuotaUpdatedAt;
388
+ if (typeof previousAt === "number" && typeof observedAt === "number" && observedAt < previousAt) {
389
+ throw new StaleQuotaObservationError();
390
+ }
386
391
  return encodeQuotaState(decodeQuotaState({ ...prior, ...incoming }));
387
392
  }
388
393
  function decodeRoutingSettings(raw) {
@@ -418,7 +423,7 @@ function createProviderStateCodec(policy) {
418
423
  }
419
424
  };
420
425
  }
421
- var AccountCodecError, MAX_JSON_DEPTH, IDENTIFIER, jsonValue, string, nonEmptyString, finiteNumber, count, credentialEpoch, boolean, rowId, required, optional, EXTENSIONS, CREDENTIAL_REFUSAL, CREDENTIAL_KEYS, POOL_FIELD_REFUSAL, QUOTA_FIELD_REFUSAL, LEGACY_FIELD_REFUSAL, METADATA_FIELD_REFUSAL, clientMetadataCodec, fingerprintCodec, fingerprintVersionCodec, dailyRequestCountsCodec, metadataShape, quotaShape, metadataForbidden, quotaForbidden, metadataCodec, providerStateCodec, quotaCodec, rowRefCodec, routingCodec, QUOTA_CODEC;
426
+ var AccountCodecError, MAX_JSON_DEPTH, IDENTIFIER, jsonValue, string, nonEmptyString, finiteNumber, count, credentialEpoch, boolean, rowId, required, optional, EXTENSIONS, CREDENTIAL_REFUSAL, CREDENTIAL_KEYS, POOL_FIELD_REFUSAL, QUOTA_FIELD_REFUSAL, LEGACY_FIELD_REFUSAL, METADATA_FIELD_REFUSAL, clientMetadataCodec, fingerprintCodec, fingerprintVersionCodec, dailyRequestCountsCodec, metadataShape, quotaShape, metadataForbidden, quotaForbidden, metadataCodec, providerStateCodec, quotaCodec, rowRefCodec, routingCodec, StaleQuotaObservationError, QUOTA_CODEC;
422
427
  var init_account_repository_codecs = __esm({
423
428
  "../core/dist/account-repository-codecs.js"() {
424
429
  "use strict";
@@ -588,6 +593,11 @@ var init_account_repository_codecs = __esm({
588
593
  gemini: optional(nullable(rowRefCodec))
589
594
  })))
590
595
  }, { forbidden: CREDENTIAL_KEYS });
596
+ StaleQuotaObservationError = class extends Error {
597
+ constructor() {
598
+ super("A newer quota observation is already stored");
599
+ }
600
+ };
591
601
  QUOTA_CODEC = {
592
602
  validate: isValidQuotaState,
593
603
  merge: mergeQuotaState
@@ -5699,11 +5709,21 @@ var init_account_repository = __esm({
5699
5709
  rowId: ref.id
5700
5710
  });
5701
5711
  }
5702
- await this.store.recordQuota(ref.id, credentialFenceOf(ref), encoded);
5703
- await this.updateMetadata(ref, (metadata) => metadata ? {
5704
- kind: "set",
5705
- metadata: applyRateLimitReadingUpdate(metadata, rateLimitReadingUpdateOf(observation), this.now())
5706
- } : { kind: "keep" });
5712
+ try {
5713
+ await this.store.recordQuota(ref.id, credentialFenceOf(ref), encoded);
5714
+ } catch (error) {
5715
+ if (error instanceof StaleQuotaObservationError || error instanceof this.storeFailure && error.cause instanceof StaleQuotaObservationError)
5716
+ return;
5717
+ throw error;
5718
+ }
5719
+ await this.updateMetadata(ref, (metadata, row) => {
5720
+ if (!metadata || observation.cachedQuotaUpdatedAt == null || row.quota.status !== "present" || row.quota.quota.cachedQuotaUpdatedAt !== observation.cachedQuotaUpdatedAt)
5721
+ return { kind: "keep" };
5722
+ return {
5723
+ kind: "set",
5724
+ metadata: applyRateLimitReadingUpdate(metadata, rateLimitReadingUpdateOf(observation), this.now())
5725
+ };
5726
+ });
5707
5727
  });
5708
5728
  }
5709
5729
  // ---- selection and roster ---------------------------------------------
@@ -7456,15 +7476,24 @@ function buildResponseStream(socket, leftover, head, signal, idleTimeoutMs, onDe
7456
7476
  source.write(leftover);
7457
7477
  }
7458
7478
  socket.pipe(source);
7479
+ const stages = [source];
7480
+ let framing;
7459
7481
  let responseBody = source;
7460
7482
  if (head.chunked) {
7461
- responseBody = responseBody.pipe(new ChunkedDecodeStream());
7483
+ framing = new ChunkedDecodeStream();
7462
7484
  } else if (typeof head.contentLength === "number") {
7463
- responseBody = responseBody.pipe(new ContentLengthStream(head.contentLength));
7485
+ framing = new ContentLengthStream(head.contentLength);
7486
+ }
7487
+ if (framing) {
7488
+ responseBody = responseBody.pipe(framing);
7489
+ stages.push(framing);
7464
7490
  }
7465
7491
  if (head.gzip) {
7466
7492
  responseBody = responseBody.pipe(createGunzip());
7493
+ stages.push(responseBody);
7467
7494
  }
7495
+ let settled = false;
7496
+ let socketEnded = false;
7468
7497
  let idleTimer;
7469
7498
  const clearIdle = () => {
7470
7499
  if (idleTimer) {
@@ -7478,31 +7507,55 @@ function buildResponseStream(socket, leftover, head, signal, idleTimeoutMs, onDe
7478
7507
  clearIdle();
7479
7508
  idleTimer = setTimeout(() => {
7480
7509
  onDebug?.(`agy transport idle timeout after ${idleTimeoutMs}ms with no body data`);
7481
- socket.destroy(new Error(`Antigravity response stalled: no data for ${idleTimeoutMs}ms`));
7510
+ settle(new Error("Antigravity response stalled: no body data within the limit"));
7482
7511
  }, idleTimeoutMs);
7483
7512
  };
7484
- socket.on("data", armIdle);
7485
- armIdle();
7486
- const abort = () => socket.destroy(new DOMException("The operation was aborted", "AbortError"));
7487
- const cleanup2 = () => {
7513
+ const abort = () => settle(new DOMException("The operation was aborted", "AbortError"));
7514
+ const onSocketEnd = () => {
7515
+ socketEnded = true;
7516
+ };
7517
+ const onSocketClose = () => {
7518
+ if (!socketEnded && !framing?.complete) {
7519
+ settle(new Error("Antigravity response connection closed before the body ended"));
7520
+ }
7521
+ };
7522
+ const fail2 = (error) => settle(error instanceof Error ? error : new Error(String(error)));
7523
+ function settle(error) {
7524
+ if (settled)
7525
+ return;
7526
+ settled = true;
7488
7527
  clearIdle();
7489
7528
  socket.off("data", armIdle);
7529
+ socket.off("end", onSocketEnd);
7530
+ socket.off("close", onSocketClose);
7490
7531
  signal?.removeEventListener("abort", abort);
7491
- };
7532
+ socket.unpipe(source);
7533
+ socket.destroy();
7534
+ for (const stage of stages) {
7535
+ if (stage !== responseBody && !stage.destroyed)
7536
+ stage.destroy();
7537
+ }
7538
+ if (!responseBody.destroyed) {
7539
+ if (error)
7540
+ responseBody.destroy(error);
7541
+ else if (!responseBody.readableEnded)
7542
+ responseBody.destroy();
7543
+ }
7544
+ }
7545
+ socket.on("error", fail2);
7546
+ socket.on("data", armIdle);
7547
+ socket.once("end", onSocketEnd);
7548
+ socket.once("close", onSocketClose);
7549
+ for (const stage of stages)
7550
+ stage.on("error", fail2);
7551
+ responseBody.once("end", () => settle());
7552
+ responseBody.once("close", () => settle());
7553
+ armIdle();
7492
7554
  if (signal?.aborted) {
7493
7555
  abort();
7494
7556
  } else {
7495
7557
  signal?.addEventListener("abort", abort, { once: true });
7496
7558
  }
7497
- responseBody.once("end", () => {
7498
- cleanup2();
7499
- socket.destroy();
7500
- });
7501
- responseBody.once("error", () => {
7502
- cleanup2();
7503
- socket.destroy();
7504
- });
7505
- responseBody.once("close", cleanup2);
7506
7559
  return Readable.toWeb(responseBody);
7507
7560
  }
7508
7561
  async function fetchWithAgyCliTransport(url, init = {}, options = {}) {
@@ -7560,6 +7613,11 @@ var init_agy_transport = __esm({
7560
7613
  constructor(contentLength) {
7561
7614
  super();
7562
7615
  this.remaining = contentLength;
7616
+ if (this.remaining <= 0)
7617
+ this.push(null);
7618
+ }
7619
+ get complete() {
7620
+ return this.remaining <= 0;
7563
7621
  }
7564
7622
  _transform(chunk, _encoding, callback) {
7565
7623
  if (this.remaining <= 0) {
@@ -7578,10 +7636,21 @@ var init_agy_transport = __esm({
7578
7636
  }
7579
7637
  callback();
7580
7638
  }
7639
+ _flush(callback) {
7640
+ callback(this.remaining > 0 ? new Error("Antigravity response ended before its declared length") : null);
7641
+ }
7581
7642
  };
7582
7643
  ChunkedDecodeStream = class extends Transform {
7583
7644
  buffer = Buffer2.alloc(0);
7645
+ finished = false;
7646
+ get complete() {
7647
+ return this.finished;
7648
+ }
7584
7649
  _transform(chunk, _encoding, callback) {
7650
+ if (this.finished) {
7651
+ callback();
7652
+ return;
7653
+ }
7585
7654
  this.buffer = Buffer2.concat([this.buffer, chunk]);
7586
7655
  try {
7587
7656
  this.flushAvailableChunks();
@@ -7592,8 +7661,9 @@ var init_agy_transport = __esm({
7592
7661
  }
7593
7662
  _flush(callback) {
7594
7663
  try {
7595
- this.flushAvailableChunks();
7596
- callback();
7664
+ if (!this.finished)
7665
+ this.flushAvailableChunks();
7666
+ callback(this.finished ? null : new Error("Antigravity response ended before its final chunk"));
7597
7667
  } catch (error) {
7598
7668
  callback(error instanceof Error ? error : new Error(String(error)));
7599
7669
  }
@@ -7609,16 +7679,19 @@ var init_agy_transport = __esm({
7609
7679
  if (!Number.isFinite(size)) {
7610
7680
  throw new Error(`Invalid chunk size: ${sizeLine}`);
7611
7681
  }
7612
- const chunkStart = lineEnd + 2;
7613
- const chunkEnd = chunkStart + size;
7614
- const nextOffset = chunkEnd + 2;
7615
- if (this.buffer.length < nextOffset)
7616
- return;
7617
7682
  if (size === 0) {
7683
+ if (this.buffer.indexOf("\r\n\r\n", lineEnd) === -1)
7684
+ return;
7685
+ this.finished = true;
7618
7686
  this.buffer = Buffer2.alloc(0);
7619
7687
  this.push(null);
7620
7688
  return;
7621
7689
  }
7690
+ const chunkStart = lineEnd + 2;
7691
+ const chunkEnd = chunkStart + size;
7692
+ const nextOffset = chunkEnd + 2;
7693
+ if (this.buffer.length < nextOffset)
7694
+ return;
7622
7695
  this.push(this.buffer.subarray(chunkStart, chunkEnd));
7623
7696
  this.buffer = this.buffer.subarray(nextOffset);
7624
7697
  }
@@ -16133,6 +16206,8 @@ async function request(operation) {
16133
16206
  function wrapHostClient(client) {
16134
16207
  const watchScoped = client.watchScoped?.bind(client);
16135
16208
  const reportUsageScoped = client.reportUsageScoped?.bind(client);
16209
+ const reportCondition = client.reportCondition?.bind(client);
16210
+ const clearCondition = client.clearCondition?.bind(client);
16136
16211
  return {
16137
16212
  listScoped: (...args) => request(() => client.listScoped(...args)),
16138
16213
  getScoped: (...args) => request(() => client.getScoped(...args)),
@@ -16153,6 +16228,12 @@ function wrapHostClient(client) {
16153
16228
  ...reportUsageScoped && {
16154
16229
  reportUsageScoped: (...args) => request(() => reportUsageScoped(...args))
16155
16230
  },
16231
+ ...reportCondition && {
16232
+ reportCondition: (...args) => request(() => reportCondition(...args))
16233
+ },
16234
+ ...clearCondition && {
16235
+ clearCondition: (...args) => request(() => clearCondition(...args))
16236
+ },
16156
16237
  ...client.insula && {
16157
16238
  insula: wrapInsula(client.insula)
16158
16239
  }
@@ -18890,6 +18971,28 @@ function rowFactsOf(row, { includeProviderIds = true } = {}) {
18890
18971
  authMethod: metadata.authMethod
18891
18972
  };
18892
18973
  }
18974
+ function isVaultConditionReason(reason) {
18975
+ return reason === "provider_verification_required" || reason === "provider_ineligible";
18976
+ }
18977
+ function vaultConditionOf(row) {
18978
+ const condition = row.condition;
18979
+ if (!condition)
18980
+ return void 0;
18981
+ const { reason, sinceMs } = condition;
18982
+ if (isVaultConditionReason(reason) && Number.isSafeInteger(sinceMs) && sinceMs > 0)
18983
+ return Object.freeze({ reason, sinceMs });
18984
+ return void 0;
18985
+ }
18986
+ function httpsActionUrl(actionUrl) {
18987
+ if (typeof actionUrl !== "string")
18988
+ return void 0;
18989
+ try {
18990
+ if (new URL(actionUrl).protocol === "https:")
18991
+ return actionUrl;
18992
+ } catch {
18993
+ }
18994
+ return void 0;
18995
+ }
18893
18996
  function grantReachOf(listed) {
18894
18997
  const { grants, grantTuples } = listed;
18895
18998
  if (grants === void 0 || grantTuples === void 0)
@@ -18928,6 +19031,10 @@ var init_custody = __esm({
18928
19031
  #logger;
18929
19032
  #provenance = /* @__PURE__ */ new WeakMap();
18930
19033
  #reports = /* @__PURE__ */ new WeakMap();
19034
+ #conditionReports = /* @__PURE__ */ new Map();
19035
+ #conditionClears = /* @__PURE__ */ new Map();
19036
+ #conditionsUnsupported = false;
19037
+ #pendingConditionCalls = 0;
18931
19038
  #kept = /* @__PURE__ */ new Map();
18932
19039
  #keptAttempts = /* @__PURE__ */ new WeakMap();
18933
19040
  #usage;
@@ -18946,8 +19053,9 @@ var init_custody = __esm({
18946
19053
  #closed = false;
18947
19054
  /** The view of the last successful `discover()`, for `watchRoster`. */
18948
19055
  #discoveredView;
19056
+ #discoveredConditions = /* @__PURE__ */ new Map();
18949
19057
  #watches = /* @__PURE__ */ new Set();
18950
- #tokenReads = /* @__PURE__ */ new Set();
19058
+ #shutdownWork = /* @__PURE__ */ new Set();
18951
19059
  #warnShutdown;
18952
19060
  #onDrainTimeout;
18953
19061
  #disposing;
@@ -19006,6 +19114,7 @@ var init_custody = __esm({
19006
19114
  if (hasVaultHost() && !isVaultHostClient(next))
19007
19115
  throw new ClaustrumUnreachableError();
19008
19116
  this.#client = next;
19117
+ this.#conditionsUnsupported = false;
19009
19118
  for (const watch of this.#watches)
19010
19119
  watch.restart();
19011
19120
  }
@@ -19074,12 +19183,12 @@ var init_custody = __esm({
19074
19183
  phase: "token read begin"
19075
19184
  });
19076
19185
  const pending = this.#readToken();
19077
- this.#tokenReads.add(pending);
19186
+ this.#shutdownWork.add(pending);
19078
19187
  let value;
19079
19188
  try {
19080
19189
  value = await pending;
19081
19190
  } finally {
19082
- this.#tokenReads.delete(pending);
19191
+ this.#shutdownWork.delete(pending);
19083
19192
  if (phaseDiagnostics.hasSubscribers)
19084
19193
  phaseDiagnostics.publish({
19085
19194
  logger: this.#logger,
@@ -19132,6 +19241,11 @@ var init_custody = __esm({
19132
19241
  async discover(signal) {
19133
19242
  const inventory = await this.#list(signal);
19134
19243
  this.#discoveredView = inventory.view;
19244
+ this.#discoveredConditions.clear();
19245
+ for (const { credentialId, condition } of inventory.credentials) {
19246
+ if (condition)
19247
+ this.#discoveredConditions.set(credentialId, condition);
19248
+ }
19135
19249
  return inventory;
19136
19250
  }
19137
19251
  async #list(signal) {
@@ -19205,6 +19319,7 @@ var init_custody = __esm({
19205
19319
  });
19206
19320
  continue;
19207
19321
  }
19322
+ const condition = vaultConditionOf(row);
19208
19323
  credentials.push(Object.freeze({
19209
19324
  credentialId: row.id,
19210
19325
  credentialType: type,
@@ -19214,7 +19329,8 @@ var init_custody = __esm({
19214
19329
  },
19215
19330
  state: row.state,
19216
19331
  ...row.email !== void 0 && { email: row.email },
19217
- ...row.orgName !== void 0 && { orgName: row.orgName }
19332
+ ...row.orgName !== void 0 && { orgName: row.orgName },
19333
+ ...condition && { condition }
19218
19334
  }));
19219
19335
  }
19220
19336
  for (const record3 of skipped)
@@ -19559,6 +19675,90 @@ var init_custody = __esm({
19559
19675
  throw error;
19560
19676
  }
19561
19677
  }
19678
+ /**
19679
+ * Report a provider login condition as bookkeeping after handing back the
19680
+ * reply, never on the request path. Pass the receipt actually sent with it.
19681
+ */
19682
+ reportCondition(attempt, input) {
19683
+ const provenance = this.#provenance.get(attempt);
19684
+ if (!provenance)
19685
+ return Promise.reject(new ClaustrumConsumerError("no-receipt", "Claustrum condition report requires an original dispatch receipt"));
19686
+ const { reason, providerStatus } = input ?? {};
19687
+ if (this.#closed || this.#keptAttempts.has(attempt) || providerStatus !== 403 || !isVaultConditionReason(reason))
19688
+ return Promise.resolve("skipped");
19689
+ const { credentialId, recordVersion } = attempt;
19690
+ const actionUrl = reason === "provider_verification_required" ? httpsActionUrl(input.actionUrl) : void 0;
19691
+ return this.#conditionOnce(this.#conditionReports, JSON.stringify([credentialId, recordVersion, reason]), { credentialId, recordVersion, reason }, (client) => client.reportCondition?.({
19692
+ credentialId,
19693
+ recordVersion,
19694
+ reason,
19695
+ providerStatus,
19696
+ ...actionUrl !== void 0 && { actionUrl },
19697
+ enrollmentToken: provenance.token
19698
+ }));
19699
+ }
19700
+ /**
19701
+ * Clear a listed condition as bookkeeping after handing back a successful
19702
+ * reply, never on the request path. Pass the receipt actually sent with it.
19703
+ */
19704
+ clearCondition(attempt) {
19705
+ const provenance = this.#provenance.get(attempt);
19706
+ if (!provenance)
19707
+ return Promise.reject(new ClaustrumConsumerError("no-receipt", "Claustrum condition clear requires an original dispatch receipt"));
19708
+ if (this.#closed || this.#keptAttempts.has(attempt))
19709
+ return Promise.resolve("skipped");
19710
+ const { credentialId, recordVersion } = attempt;
19711
+ const condition = this.#discoveredConditions.get(credentialId);
19712
+ if (!condition)
19713
+ return Promise.resolve("skipped");
19714
+ return this.#conditionOnce(this.#conditionClears, JSON.stringify([credentialId, condition.sinceMs]), { credentialId, recordVersion, reason: condition.reason }, (client) => client.clearCondition?.({
19715
+ credentialId,
19716
+ recordVersion,
19717
+ enrollmentToken: provenance.token
19718
+ }));
19719
+ }
19720
+ #conditionOnce(outcomes, key, details, send) {
19721
+ const previous = outcomes.get(key);
19722
+ if (previous)
19723
+ return previous;
19724
+ if (this.#conditionsUnsupported)
19725
+ return Promise.resolve("unsupported");
19726
+ const pending = Promise.resolve().then(async () => {
19727
+ const client = this.#client;
19728
+ if (this.#conditionsUnsupported)
19729
+ return "unsupported";
19730
+ try {
19731
+ const sent = send(client);
19732
+ if (!sent)
19733
+ return "unsupported";
19734
+ if (await sent === false)
19735
+ this.#debugCondition("scoped login condition not cleared", details);
19736
+ return "reported";
19737
+ } catch (error) {
19738
+ if (error instanceof ClaustrumCredentialError5 && error.code === "unknown_method") {
19739
+ if (client === this.#client)
19740
+ this.#conditionsUnsupported = true;
19741
+ return "unsupported";
19742
+ }
19743
+ this.#debugCondition("scoped login condition update failed", details);
19744
+ return "failed";
19745
+ }
19746
+ });
19747
+ outcomes.set(key, pending);
19748
+ this.#pendingConditionCalls++;
19749
+ this.#shutdownWork.add(pending);
19750
+ void pending.then(() => {
19751
+ this.#pendingConditionCalls--;
19752
+ this.#shutdownWork.delete(pending);
19753
+ });
19754
+ return pending;
19755
+ }
19756
+ #debugCondition(message, details) {
19757
+ try {
19758
+ this.#logger.debug(message, details);
19759
+ } catch {
19760
+ }
19761
+ }
19562
19762
  /**
19563
19763
  * Watch this consumer's visible vault accounts instead of listing them on a
19564
19764
  * short timer. Opens one `watchScoped` on this custody's client and calls
@@ -19674,15 +19874,17 @@ var init_custody = __esm({
19674
19874
  this.#watches.clear();
19675
19875
  this.#kept.clear();
19676
19876
  const usage = this.#usage.close();
19877
+ const keepClientOpen = usage !== void 0 || this.#pendingConditionCalls > 0;
19677
19878
  if (usage) {
19678
- this.#tokenReads.add(usage);
19679
- void usage.then(() => this.#tokenReads.delete(usage));
19680
- } else
19879
+ this.#shutdownWork.add(usage);
19880
+ void usage.then(() => this.#shutdownWork.delete(usage));
19881
+ }
19882
+ if (!keepClientOpen)
19681
19883
  this.#client.close();
19682
- this.#disposing = drainShutdown(this.#tokenReads, (count3) => (this.#onDrainTimeout ?? this.#warnShutdown)(count3)).finally(() => {
19884
+ this.#disposing = drainShutdown(this.#shutdownWork, (count3) => (this.#onDrainTimeout ?? this.#warnShutdown)(count3)).finally(() => {
19683
19885
  this.#usage.drop();
19684
19886
  this.#usageServed.clear();
19685
- if (usage)
19887
+ if (keepClientOpen)
19686
19888
  this.#client.close();
19687
19889
  });
19688
19890
  }
@@ -21277,6 +21479,36 @@ var init_consumer = __esm({
21277
21479
  throw new ClaustrumConsumerError("no-receipt", "Claustrum dispatch receipt has no active owner");
21278
21480
  await this.#custody.reportFailure(attempt, status, source);
21279
21481
  }
21482
+ /** The custody (or hub lease) that issued `attempt`, or a `no-receipt` refusal. */
21483
+ #issuingCustody(attempt) {
21484
+ const custody = this.#hub ? this.#issuedBy.get(attempt)?.custody : this.#custody;
21485
+ if (!custody)
21486
+ throw new ClaustrumConsumerError("no-receipt", "Claustrum dispatch receipt has no active owner");
21487
+ return custody;
21488
+ }
21489
+ /**
21490
+ * Report a provider login condition through the custody that issued the
21491
+ * receipt; see `ClaustrumScopedCustody.reportCondition`. Bookkeeping: call it
21492
+ * after handing back the reply, never on the request path. It resolves
21493
+ * `skipped` after shutdown and rejects only with `no-receipt` for a receipt
21494
+ * no live custody of this consumer issued.
21495
+ */
21496
+ async reportCondition(attempt, input) {
21497
+ if (this.#shutdown.signal.aborted)
21498
+ return "skipped";
21499
+ return this.#issuingCustody(attempt).reportCondition(attempt, input);
21500
+ }
21501
+ /**
21502
+ * Clear a listed login condition through the custody that issued the
21503
+ * receipt; see `ClaustrumScopedCustody.clearCondition`. Safe to call after
21504
+ * every successful reply: it sends nothing unless the login is marked.
21505
+ * Same `skipped` and `no-receipt` rules as `reportCondition`.
21506
+ */
21507
+ async clearCondition(attempt) {
21508
+ if (this.#shutdown.signal.aborted)
21509
+ return "skipped";
21510
+ return this.#issuingCustody(attempt).clearCondition(attempt);
21511
+ }
21280
21512
  /**
21281
21513
  * Send on a vault route. `dispatch` builds and sends the request with the
21282
21514
  * receipt's token and may be called twice, so it must be able to rebuild
@@ -21883,6 +22115,16 @@ var init_hub = __esm({
21883
22115
  check();
21884
22116
  return custody.reportFailure(attempt, status, source);
21885
22117
  },
22118
+ reportCondition: async (attempt, input) => {
22119
+ if (state.released || generation.ended)
22120
+ return "skipped";
22121
+ return custody.reportCondition(attempt, input);
22122
+ },
22123
+ clearCondition: async (attempt) => {
22124
+ if (state.released || generation.ended)
22125
+ return "skipped";
22126
+ return custody.clearCondition(attempt);
22127
+ },
21886
22128
  reportUsage: (input) => {
21887
22129
  if (!state.released && !generation.ended)
21888
22130
  custody.reportUsage(input);
@@ -23268,7 +23510,7 @@ function invalidateProjectContextCache(refresh) {
23268
23510
  projectContextResultCache.delete(cacheKey);
23269
23511
  provisionFailedKeys.delete(cacheKey);
23270
23512
  }
23271
- async function loadManagedProject(accessToken, _projectId) {
23513
+ async function loadManagedProject(accessToken, _projectId, admit2) {
23272
23514
  const requestBody = buildBootstrapRequestBody();
23273
23515
  const loadHeaders = buildAntigravityHarnessBootstrapHeaders(accessToken);
23274
23516
  const loadEndpoints = Array.from(/* @__PURE__ */ new Set([
@@ -23276,6 +23518,8 @@ async function loadManagedProject(accessToken, _projectId) {
23276
23518
  ...ANTIGRAVITY_ENDPOINT_FALLBACKS
23277
23519
  ]));
23278
23520
  for (const baseEndpoint of loadEndpoints) {
23521
+ if (admit2)
23522
+ await admit2();
23279
23523
  try {
23280
23524
  const response = await fetchWithAgyCliTransport(`${baseEndpoint}/v1internal:loadCodeAssist`, {
23281
23525
  method: "POST",
@@ -23295,7 +23539,7 @@ async function loadManagedProject(accessToken, _projectId) {
23295
23539
  }
23296
23540
  return null;
23297
23541
  }
23298
- async function onboardManagedProject(accessToken, tierId, projectId, attempts2 = 10, delayMs = 5e3) {
23542
+ async function onboardManagedProject(accessToken, tierId, projectId, attempts2 = 10, delayMs = 5e3, admit2) {
23299
23543
  const requestBody = { tierId };
23300
23544
  const onboardEndpoints = Array.from(/* @__PURE__ */ new Set([
23301
23545
  ANTIGRAVITY_ENDPOINT_PROD,
@@ -23304,6 +23548,8 @@ async function onboardManagedProject(accessToken, tierId, projectId, attempts2 =
23304
23548
  ]));
23305
23549
  for (const baseEndpoint of onboardEndpoints) {
23306
23550
  for (let attempt = 0; attempt < attempts2; attempt += 1) {
23551
+ if (admit2)
23552
+ await admit2();
23307
23553
  try {
23308
23554
  const response = await fetchWithAgyCliTransport(`${baseEndpoint}/v1internal:onboardUser`, {
23309
23555
  method: "POST",
@@ -23338,7 +23584,7 @@ async function onboardManagedProject(accessToken, tierId, projectId, attempts2 =
23338
23584
  }
23339
23585
  return void 0;
23340
23586
  }
23341
- async function ensureProjectContext(auth) {
23587
+ async function ensureProjectContext(auth, admit2) {
23342
23588
  const accessToken = auth.access;
23343
23589
  if (!accessToken) {
23344
23590
  return { auth, effectiveProjectId: "" };
@@ -23382,7 +23628,7 @@ async function ensureProjectContext(auth) {
23382
23628
  capturedTier
23383
23629
  };
23384
23630
  };
23385
- const loadPayload = await loadManagedProject(accessToken, parts.projectId ?? fallbackProjectId);
23631
+ const loadPayload = await loadManagedProject(accessToken, parts.projectId ?? fallbackProjectId, admit2);
23386
23632
  const capturedTierId = loadPayload?.currentTier?.id;
23387
23633
  const paidTierId = typeof loadPayload?.paidTier === "string" ? loadPayload.paidTier : loadPayload?.paidTier?.id;
23388
23634
  const tierFromPayload = capturedTierId ? {
@@ -23399,7 +23645,7 @@ async function ensureProjectContext(auth) {
23399
23645
  tierId,
23400
23646
  projectId: parts.projectId
23401
23647
  });
23402
- const provisionedProjectId = await onboardManagedProject(accessToken, tierId, parts.projectId);
23648
+ const provisionedProjectId = await onboardManagedProject(accessToken, tierId, parts.projectId, void 0, void 0, admit2);
23403
23649
  if (provisionedProjectId) {
23404
23650
  log3.debug("Successfully provisioned managed project", {
23405
23651
  provisionedProjectId
@@ -28365,10 +28611,29 @@ async function checkAccountsQuotaStandalone(accounts, options) {
28365
28611
  }
28366
28612
  }));
28367
28613
  }
28368
- return checkAccountsQuotaWith(
28614
+ const refused2 = new AbortController();
28615
+ const admit2 = options.assertAdmission;
28616
+ const assertAdmission = admit2 && (async () => {
28617
+ refused2.signal.throwIfAborted();
28618
+ try {
28619
+ await admit2();
28620
+ } catch (error) {
28621
+ refused2.abort(error);
28622
+ throw error;
28623
+ }
28624
+ refused2.signal.throwIfAborted();
28625
+ });
28626
+ const results = await checkAccountsQuotaWith(
28369
28627
  accounts,
28370
- makeFetchAccountQuota(void 0, ANTIGRAVITY_PROVIDER_ID)
28628
+ makeFetchAccountQuota(
28629
+ void 0,
28630
+ ANTIGRAVITY_PROVIDER_ID,
28631
+ void 0,
28632
+ assertAdmission
28633
+ )
28371
28634
  );
28635
+ refused2.signal.throwIfAborted();
28636
+ return results;
28372
28637
  }
28373
28638
  async function fetchLegacyModelsFallback(options) {
28374
28639
  try {
@@ -28447,7 +28712,7 @@ function untilQuotaAborted(pending, signal) {
28447
28712
  );
28448
28713
  });
28449
28714
  }
28450
- function makeFetchAccountQuota(client, providerId, fetchVia) {
28715
+ function makeFetchAccountQuota(client, providerId, fetchVia, assertAdmission) {
28451
28716
  return async (account, signal, purpose = "required") => {
28452
28717
  const index = 0;
28453
28718
  const disabled = account.enabled === false;
@@ -28529,6 +28794,8 @@ function makeFetchAccountQuota(client, providerId, fetchVia) {
28529
28794
  }
28530
28795
  try {
28531
28796
  if (accessTokenExpired(auth)) {
28797
+ if (assertAdmission) await assertAdmission();
28798
+ signal.throwIfAborted();
28532
28799
  const refreshed = await refreshAccessToken(
28533
28800
  auth,
28534
28801
  client,
@@ -28542,7 +28809,7 @@ function makeFetchAccountQuota(client, providerId, fetchVia) {
28542
28809
  }
28543
28810
  auth = refreshed;
28544
28811
  }
28545
- const projectContext = await ensureProjectContext(auth);
28812
+ const projectContext = await ensureProjectContext(auth, assertAdmission);
28546
28813
  auth = projectContext.auth;
28547
28814
  const updatedAccount = applyAccountUpdates(
28548
28815
  account,
@@ -28557,11 +28824,20 @@ function makeFetchAccountQuota(client, providerId, fetchVia) {
28557
28824
  let fellBackToLegacy = false;
28558
28825
  const authParts = parseRefreshParts(auth.refresh);
28559
28826
  const managedProjectId = authParts.managedProjectId ?? account.managedProjectId;
28827
+ const guarded = assertAdmission ? async (url, init, extra) => {
28828
+ await assertAdmission();
28829
+ signal.throwIfAborted();
28830
+ return fetchWithActiveTimeout(
28831
+ url,
28832
+ { ...init, signal },
28833
+ { timeoutMs: extra.timeoutMs }
28834
+ );
28835
+ } : fetchVia;
28560
28836
  const payloads = await fetchQuotaPayloads({
28561
28837
  accessToken: auth.access ?? "",
28562
28838
  managedProjectId,
28563
28839
  projectId: projectContext.effectiveProjectId,
28564
- fetchVia,
28840
+ fetchVia: guarded,
28565
28841
  logger: log8
28566
28842
  });
28567
28843
  quotaResult = payloads.quota;
@@ -32703,19 +32979,31 @@ async function readNativeAuth(path2) {
32703
32979
  throw error;
32704
32980
  }
32705
32981
  }
32982
+ async function readOpenCodeAuthority(legacyPath) {
32983
+ try {
32984
+ const claustrum = await loadCommonAuthClaustrum();
32985
+ if (claustrum.hasVaultHost()) return "host";
32986
+ return await vaultAuthority2(
32987
+ claustrum.hostEnrollmentPaths({
32988
+ stateDir: openCodeVaultDir(
32989
+ legacyPath ?? resolve23(accountFileForVault())
32990
+ ),
32991
+ host: "opencode"
32992
+ }),
32993
+ OPENCODE_VAULT_ENROLLMENT_NAME,
32994
+ claustrum
32995
+ );
32996
+ } catch {
32997
+ return "unreadable";
32998
+ }
32999
+ }
32706
33000
  async function assertLocalOpenCodeLogin(legacyPath, generation) {
32707
- const claustrum = await loadCommonAuthClaustrum();
32708
- if (await claustrum.vaultAuthority(
32709
- claustrum.hostEnrollmentPaths({
32710
- stateDir: openCodeVaultDir(legacyPath),
32711
- host: "opencode"
32712
- }),
32713
- OPENCODE_VAULT_ENROLLMENT_NAME
32714
- ) !== "local")
33001
+ if (await readOpenCodeAuthority(legacyPath) !== "local")
32715
33002
  throw new Error(
32716
33003
  "Vault enrollment excludes local sign-in. Resolve vault access before choosing local setup."
32717
33004
  );
32718
33005
  if (generation === "2") return;
33006
+ const claustrum = await loadCommonAuthClaustrum();
32719
33007
  claustrum.assertHostSlotMatchesMode({
32720
33008
  mode: "local",
32721
33009
  auth: (await readNativeAuth(nativeOpenCodeAuthPath()))[OPENCODE_VAULT_PROVIDER],
@@ -33331,6 +33619,16 @@ async function runCli(argv, deps) {
33331
33619
  return 0;
33332
33620
  }
33333
33621
  try {
33622
+ const assertLocalAccounts = async () => {
33623
+ const authority = await (deps.readAuthority ?? readOpenCodeAuthority)();
33624
+ if (authority === "local") return;
33625
+ const source2 = authority === "vault" ? "Accounts are served by the vault, not this computer's local sign-ins." : authority === "host" ? "Accounts are served by Thalamus, not this computer's local sign-ins." : "Account authority could not be read, so this computer's local sign-ins were not used.";
33626
+ throw new Error(
33627
+ `${source2} Use the /antigravity menu in OpenCode to see them and their quota.`
33628
+ );
33629
+ };
33630
+ if (parsed.value.command === "list" || parsed.value.command === "quota")
33631
+ await assertLocalAccounts();
33334
33632
  if (parsed.value.command !== "setup") {
33335
33633
  if (parsed.value.command === "login") await deps.prepareVaultFolder?.();
33336
33634
  await deps.processHeartbeat?.();
@@ -33435,7 +33733,8 @@ async function runCli(argv, deps) {
33435
33733
  return 0;
33436
33734
  }
33437
33735
  const results = await deps.getQuota(storage?.accounts ?? [], {
33438
- refresh: parsed.value.refresh
33736
+ refresh: parsed.value.refresh,
33737
+ ...parsed.value.refresh ? { assertAdmission: assertLocalAccounts } : {}
33439
33738
  });
33440
33739
  deps.stdout.write(
33441
33740
  parsed.value.json ? `${JSON.stringify(quotaSummary(results))}