@cortexkit/opencode-antigravity-auth 3.1.10 → 3.1.11

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 (158) hide show
  1. package/dist/cli.js +357 -58
  2. package/dist/cli.js.map +3 -3
  3. package/dist/cli.meta.json +37 -32
  4. package/dist/index.js +986 -426
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +86 -63
  7. package/dist/server.js +1131 -551
  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/quota.d.ts +10 -2
  66. package/dist/src/plugin/quota.d.ts.map +1 -1
  67. package/dist/src/plugin/quota.js +38 -10
  68. package/dist/src/plugin/quota.js.map +1 -1
  69. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  70. package/dist/src/plugin/request-helpers.js +51 -19
  71. package/dist/src/plugin/request-helpers.js.map +1 -1
  72. package/dist/src/plugin/request.d.ts +12 -1
  73. package/dist/src/plugin/request.d.ts.map +1 -1
  74. package/dist/src/plugin/request.js +27 -42
  75. package/dist/src/plugin/request.js.map +1 -1
  76. package/dist/src/plugin/shared/request-services.d.ts +4 -1
  77. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  78. package/dist/src/plugin/shared/request-services.js +142 -24
  79. package/dist/src/plugin/shared/request-services.js.map +1 -1
  80. package/dist/src/plugin/shared/runtime.d.ts +3 -4
  81. package/dist/src/plugin/shared/runtime.d.ts.map +1 -1
  82. package/dist/src/plugin/shared/runtime.js +2 -2
  83. package/dist/src/plugin/shared/runtime.js.map +1 -1
  84. package/dist/src/plugin/shared/vault-request-credentials.d.ts +13 -7
  85. package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  86. package/dist/src/plugin/shared/vault-request-credentials.js +24 -18
  87. package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
  88. package/dist/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
  89. package/dist/src/setup.d.ts +3 -0
  90. package/dist/src/setup.d.ts.map +1 -1
  91. package/dist/src/setup.js +18 -6
  92. package/dist/src/setup.js.map +1 -1
  93. package/dist/src/sidebar-state.d.ts +20 -7
  94. package/dist/src/sidebar-state.d.ts.map +1 -1
  95. package/dist/src/sidebar-state.js +57 -8
  96. package/dist/src/sidebar-state.js.map +1 -1
  97. package/dist/src/tui.d.ts.map +1 -1
  98. package/dist/src/tui.js +43 -23
  99. package/dist/src/tui.js.map +1 -1
  100. package/dist/tui-build-map.json +9 -9
  101. package/dist/tui-ga-build-map.json +5 -5
  102. package/dist/types/src/cli.d.ts +3 -1
  103. package/dist/types/src/cli.d.ts.map +1 -1
  104. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
  105. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
  106. package/dist/types/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
  107. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  108. package/dist/types/src/ga/rpc/protocol.d.ts +11 -5
  109. package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
  110. package/dist/types/src/ga/server/index.d.ts.map +1 -1
  111. package/dist/types/src/plugin/account-access.d.ts +1 -0
  112. package/dist/types/src/plugin/account-access.d.ts.map +1 -1
  113. package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
  114. package/dist/types/src/plugin/background-quota-refresh.d.ts +11 -24
  115. package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -1
  116. package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
  117. package/dist/types/src/plugin/cache/signature-cache.d.ts +3 -0
  118. package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -1
  119. package/dist/types/src/plugin/cache.d.ts.map +1 -1
  120. package/dist/types/src/plugin/core/streaming/displayed-thinking.d.ts +23 -0
  121. package/dist/types/src/plugin/core/streaming/displayed-thinking.d.ts.map +1 -0
  122. package/dist/types/src/plugin/fetch/warmup.d.ts +9 -2
  123. package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -1
  124. package/dist/types/src/plugin/quota.d.ts +10 -2
  125. package/dist/types/src/plugin/quota.d.ts.map +1 -1
  126. package/dist/types/src/plugin/request-helpers.d.ts.map +1 -1
  127. package/dist/types/src/plugin/request.d.ts +12 -1
  128. package/dist/types/src/plugin/request.d.ts.map +1 -1
  129. package/dist/types/src/plugin/shared/request-services.d.ts +4 -1
  130. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  131. package/dist/types/src/plugin/shared/runtime.d.ts +3 -4
  132. package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -1
  133. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +13 -7
  134. package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
  135. package/dist/types/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
  136. package/dist/types/src/setup.d.ts +3 -0
  137. package/dist/types/src/setup.d.ts.map +1 -1
  138. package/dist/types/src/sidebar-state.d.ts +20 -7
  139. package/dist/types/src/sidebar-state.d.ts.map +1 -1
  140. package/package.json +3 -3
  141. package/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
  142. package/src/common-auth-embedded/claustrum/consumer.js +32 -0
  143. package/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
  144. package/src/common-auth-embedded/claustrum/custody.js +145 -8
  145. package/src/common-auth-embedded/claustrum/host.js +8 -0
  146. package/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
  147. package/src/common-auth-embedded/claustrum/hub.js +10 -0
  148. package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  149. package/src/common-auth-embedded/routing-accessor/index.js +5 -3
  150. package/src/common-auth-embedded/source-output.json +35 -35
  151. package/src/sidebar-state.ts +77 -8
  152. package/src/tui-compiled/sidebar-state.js +40 -1
  153. package/src/tui-compiled/tui.js +49 -24
  154. package/src/tui-ga-compiled/host-ga.js +11 -5
  155. package/src/tui-ga-raw/host-ga.tsx +17 -6
  156. package/src/tui-raw/sidebar-state.js +40 -1
  157. package/src/tui-raw/tui.tsx +40 -24
  158. package/src/tui.tsx +40 -24
@@ -111,12 +111,13 @@ export interface ClaustrumHubMemberOptions<_Q = QuotaObservation> {
111
111
  logger?: ClaustrumLogger;
112
112
  }
113
113
  /** What a lease may do with the shared custody. */
114
- export type ClaustrumLeasedCustody = Pick<ClaustrumScopedCustody, 'authorize' | 'reportFailure' | 'reportUsage' | 'usageReportState' | 'forget' | 'keptReceiptState'>;
114
+ export type ClaustrumLeasedCustody = Pick<ClaustrumScopedCustody, 'authorize' | 'reportFailure' | 'reportCondition' | 'clearCondition' | 'reportUsage' | 'usageReportState' | 'forget' | 'keptReceiptState'>;
115
115
  /**
116
116
  * One acquisition of the hub's shared custody. `custody` throws `closed`
117
117
  * after `release()`, and once the connection it belongs to ended for any
118
118
  * reason, vault mode going off included. Best-effort `reportUsage` instead
119
- * ignores reports through an ended lease. `release()` is idempotent.
119
+ * ignores reports through an ended lease, and the condition calls resolve
120
+ * `skipped` through one. `release()` is idempotent.
120
121
  */
121
122
  export interface CustodyLease {
122
123
  readonly custody: ClaustrumLeasedCustody;
@@ -533,6 +533,16 @@ export class ClaustrumDiscoveryHub {
533
533
  check();
534
534
  return custody.reportFailure(attempt, status, source);
535
535
  },
536
+ reportCondition: async (attempt, input) => {
537
+ if (state.released || generation.ended)
538
+ return 'skipped';
539
+ return custody.reportCondition(attempt, input);
540
+ },
541
+ clearCondition: async (attempt) => {
542
+ if (state.released || generation.ended)
543
+ return 'skipped';
544
+ return custody.clearCondition(attempt);
545
+ },
536
546
  reportUsage: (input) => {
537
547
  if (!state.released && !generation.ended)
538
548
  custody.reportUsage(input);
@@ -3,7 +3,7 @@ import type { ClaustrumScopedClient } from './custody.js';
3
3
  export { ClaustrumCredentialError, type ClaustrumReporterSource, type EnrollmentTokenFile, } from '@cortexkit/claustrum-client';
4
4
  export { ClaustrumUnreachableError, classifyVaultFailure, VAULT_FAILURE_CLASSES, type VaultFailureClass, } from './availability.js';
5
5
  export { ClaustrumConsumer, type ClaustrumConsumerOptions, type ClaustrumWatchState, DEFAULT_CONNECT_TIMEOUT_MS, type SendOptions, } from './consumer.js';
6
- export { type AccountIdentitySource, type ClassifyingClaustrumFamily, type ClaustrumFamily, type ClaustrumFamilyInput, type ClaustrumRosterWatch, type ClaustrumRosterWatchOptions, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, type KeptReceiptState, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, VAULT_RECEIPT_WAIT_MS, VAULT_YOUNG_OUTAGE_MS, type VaultCredential, type VaultCredentialType, type VaultGrantReach, type VaultGrantTuple, type VaultInventory, type VaultRowFacts, } from './custody.js';
6
+ export { type AccountIdentitySource, type ClassifyingClaustrumFamily, type ClaustrumFamily, type ClaustrumFamilyInput, type ClaustrumRosterWatch, type ClaustrumRosterWatchOptions, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, type KeptReceiptState, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, VAULT_RECEIPT_WAIT_MS, VAULT_YOUNG_OUTAGE_MS, type VaultConditionOutcome, type VaultConditionReason, type VaultCredential, type VaultCredentialType, type VaultGrantReach, type VaultGrantTuple, type VaultInventory, type VaultRowFacts, } from './custody.js';
7
7
  export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, type ClaustrumRequestedGrant, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, validEnrollmentDisplayName, validEnrollmentRequestedGrants, vaultAuthority, } from './enrollment.js';
8
8
  export { ClaustrumConsumerError, type ClaustrumConsumerFailureKind, type ClaustrumLogger, } from './errors.js';
9
9
  export { connectVaultHost, hasVaultHost, VAULT_HOST_CONNECT_REFUSAL, VAULT_HOST_STATUS, } from './host.js';
@@ -184,8 +184,6 @@ function candidateView(candidates) {
184
184
  accounts.push({ account_id: accountId, credential_id: credentialId });
185
185
  }
186
186
  }
187
- if (accounts.length === 0)
188
- return undefined;
189
187
  const lines = accounts
190
188
  .map(({ account_id, credential_id }) => Buffer.from(`${account_id}\t${credential_id}\n`, 'utf8'))
191
189
  .sort(Buffer.compare);
@@ -290,7 +288,11 @@ export async function askRouting(input) {
290
288
  request.warm_credential = warmCredentialId;
291
289
  }
292
290
  const candidates = candidateView(input.candidates);
293
- if (candidates)
291
+ // A first ask with nothing usable sends no view, so routing is unrestricted
292
+ // as before. A continue ask always sends one: an empty view after the only
293
+ // account was refused tells routing nothing is left to offer, where a
294
+ // missing view would let it hand back the refused account.
295
+ if (candidates.accounts.length > 0 || request.mode === 'continue')
294
296
  request.candidates = candidates;
295
297
  const pending = accountFor.call(handle, request, { deadlineMs });
296
298
  if (!isObject(pending) || typeof pending.then !== 'function')
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@cortexkit/common-auth",
4
- "version": "0.55.1",
4
+ "version": "0.56.1",
5
5
  "artifactStatus": "published",
6
- "archiveBytes": 503150,
6
+ "archiveBytes": 505365,
7
7
  "publicRoots": {
8
8
  "./rpc": {
9
9
  "types": "./dist/rpc/index.d.ts",
@@ -74,16 +74,16 @@
74
74
  "import": "./src/quota-sidebar/index.tsx"
75
75
  }
76
76
  },
77
- "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.55.1.tgz",
78
- "tarballSha256": "80a78298cecc98c5b3b7eb3534e2eb77353d582d997962efe9df27a79ef12589",
79
- "sri": "sha512-koCwml7Kbf2u6fIIaNmHbDOp2B15hGQ/9kZUB3VSYlBtvyp9ldDUJU1yVGUmin5gzwTzAF9c7g/OWPlWNqgMPw==",
80
- "shasum": "703dd80358754aa4c3d1b9d6a0d3b9d150860daa",
77
+ "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.56.1.tgz",
78
+ "tarballSha256": "32ce3a411b3a8f8034e4c5eb5b79550d7529834567520943ca962d1b13512aa0",
79
+ "sri": "sha512-5JTuezeHbodZacTXEB6mjoicODWsCYh6J/APShcB11/92KAz8xJjcLG+MVmDK+QtL2VmBNwa7yhHCFiKqqIKww==",
80
+ "shasum": "f8b2504321810ab59a448effc2c485c601a039de",
81
81
  "canonicalFiles": 257,
82
- "canonicalBytes": 1524660,
82
+ "canonicalBytes": 1535775,
83
83
  "generator": {
84
84
  "path": "packages/opencode/scripts/embed-common-auth.ts",
85
85
  "version": 4,
86
- "sha256": "53208174ea6d4a497b8ea378bcb8712971742272d2fd766ea4617866dea60f4b"
86
+ "sha256": "4b56cc532fc60af40ef271ae24ab502d7b03e6b546f968066fe7997fc454de60"
87
87
  },
88
88
  "files": [
89
89
  {
@@ -265,33 +265,33 @@
265
265
  {
266
266
  "source": "package/dist/claustrum/consumer.d.ts",
267
267
  "output": "claustrum/consumer.d.ts",
268
- "bytes": 14722,
269
- "sourceSha256": "b4c4a006089b95a5b553fcc03b598851535ba8e5d184c277b7b2fa5ce172f7d9",
270
- "outputSha256": "b4c4a006089b95a5b553fcc03b598851535ba8e5d184c277b7b2fa5ce172f7d9",
268
+ "bytes": 15756,
269
+ "sourceSha256": "3118eb0112ebb100c4f0ec8528eae840fee076b99e39d30c9c204042a9e2fc5e",
270
+ "outputSha256": "3118eb0112ebb100c4f0ec8528eae840fee076b99e39d30c9c204042a9e2fc5e",
271
271
  "transform": "verbatim"
272
272
  },
273
273
  {
274
274
  "source": "package/dist/claustrum/consumer.js",
275
275
  "output": "claustrum/consumer.js",
276
- "bytes": 41187,
277
- "sourceSha256": "c566f9a86fcd7cacb64901f68d4d0399424e2f27135bbdc1855f5c8262be9604",
278
- "outputSha256": "c566f9a86fcd7cacb64901f68d4d0399424e2f27135bbdc1855f5c8262be9604",
276
+ "bytes": 42662,
277
+ "sourceSha256": "c257a0ed546c9e55ee93a77a3d2247d8e65274f0dfb944b676f9da1ad23a3df5",
278
+ "outputSha256": "c257a0ed546c9e55ee93a77a3d2247d8e65274f0dfb944b676f9da1ad23a3df5",
279
279
  "transform": "verbatim"
280
280
  },
281
281
  {
282
282
  "source": "package/dist/claustrum/custody.d.ts",
283
283
  "output": "claustrum/custody.d.ts",
284
- "bytes": 18601,
285
- "sourceSha256": "9c34f311ef87563256138b5aa070216d9dd027c6ddf4110aba630ba14157bc16",
286
- "outputSha256": "9c34f311ef87563256138b5aa070216d9dd027c6ddf4110aba630ba14157bc16",
284
+ "bytes": 20105,
285
+ "sourceSha256": "3e18a29925889dc0bcae4a23b57df3b6bf683ba9a3e58fe95d3132ca50a2417e",
286
+ "outputSha256": "3e18a29925889dc0bcae4a23b57df3b6bf683ba9a3e58fe95d3132ca50a2417e",
287
287
  "transform": "verbatim"
288
288
  },
289
289
  {
290
290
  "source": "package/dist/claustrum/custody.js",
291
291
  "output": "claustrum/custody.js",
292
- "bytes": 44266,
293
- "sourceSha256": "72d08a16f7fb27c26813501b0e89cddfdf640b9aeac8b89e9c7f9c92663db59c",
294
- "outputSha256": "72d08a16f7fb27c26813501b0e89cddfdf640b9aeac8b89e9c7f9c92663db59c",
292
+ "bytes": 50079,
293
+ "sourceSha256": "fdb2f9a4eee791b44d6bb953d31bb7f560159302e2f83932c03964e1ae24cf22",
294
+ "outputSha256": "fdb2f9a4eee791b44d6bb953d31bb7f560159302e2f83932c03964e1ae24cf22",
295
295
  "transform": "verbatim"
296
296
  },
297
297
  {
@@ -353,33 +353,33 @@
353
353
  {
354
354
  "source": "package/dist/claustrum/host.js",
355
355
  "output": "claustrum/host.js",
356
- "bytes": 4610,
357
- "sourceSha256": "c2eba15f35b996993ba7f0ec849ce84312d5f08e9b15e8f6458c6d8a0e03ae7b",
358
- "outputSha256": "c2eba15f35b996993ba7f0ec849ce84312d5f08e9b15e8f6458c6d8a0e03ae7b",
356
+ "bytes": 4993,
357
+ "sourceSha256": "d2e197db15bfe75de41a892709f4d7d69248293bd80bb5a720b9035e961ec6d7",
358
+ "outputSha256": "d2e197db15bfe75de41a892709f4d7d69248293bd80bb5a720b9035e961ec6d7",
359
359
  "transform": "verbatim"
360
360
  },
361
361
  {
362
362
  "source": "package/dist/claustrum/hub.d.ts",
363
363
  "output": "claustrum/hub.d.ts",
364
- "bytes": 9719,
365
- "sourceSha256": "489a3214a386ad2329d7348288c371d41e79427bfc2daa91e2743cd4ddeccec9",
366
- "outputSha256": "489a3214a386ad2329d7348288c371d41e79427bfc2daa91e2743cd4ddeccec9",
364
+ "bytes": 9816,
365
+ "sourceSha256": "71196e15856a31236ae0f77f2e8b37d5216e5f7d42170a1eda27a154d1542b67",
366
+ "outputSha256": "71196e15856a31236ae0f77f2e8b37d5216e5f7d42170a1eda27a154d1542b67",
367
367
  "transform": "verbatim"
368
368
  },
369
369
  {
370
370
  "source": "package/dist/claustrum/hub.js",
371
371
  "output": "claustrum/hub.js",
372
- "bytes": 48395,
373
- "sourceSha256": "77bb04f1e6956eb2419b4d497fd2c478f59833f0a1bcc7650a090bd5c8a6ec23",
374
- "outputSha256": "77bb04f1e6956eb2419b4d497fd2c478f59833f0a1bcc7650a090bd5c8a6ec23",
372
+ "bytes": 48839,
373
+ "sourceSha256": "31af42582b6e9694ce334403bc3105fce8864c12d69146f4938a7300a1f718ce",
374
+ "outputSha256": "31af42582b6e9694ce334403bc3105fce8864c12d69146f4938a7300a1f718ce",
375
375
  "transform": "verbatim"
376
376
  },
377
377
  {
378
378
  "source": "package/dist/claustrum/index.d.ts",
379
379
  "output": "claustrum/index.d.ts",
380
- "bytes": 5073,
381
- "sourceSha256": "9e6722e2c38df279563804af98297aa6558efd8e50eb253e348a23b22e6e9785",
382
- "outputSha256": "9e6722e2c38df279563804af98297aa6558efd8e50eb253e348a23b22e6e9785",
380
+ "bytes": 5128,
381
+ "sourceSha256": "522249e709781475b8458130a72ea6885e16e8ea59821100bead9f23ae34ddcb",
382
+ "outputSha256": "522249e709781475b8458130a72ea6885e16e8ea59821100bead9f23ae34ddcb",
383
383
  "transform": "verbatim"
384
384
  },
385
385
  {
@@ -2137,9 +2137,9 @@
2137
2137
  {
2138
2138
  "source": "package/dist/routing-accessor/index.js",
2139
2139
  "output": "routing-accessor/index.js",
2140
- "bytes": 22848,
2141
- "sourceSha256": "13f13701391958c2e1f52d614a78da8d276594a90ee54b4f6af33bf81b4ca669",
2142
- "outputSha256": "13f13701391958c2e1f52d614a78da8d276594a90ee54b4f6af33bf81b4ca669",
2140
+ "bytes": 23158,
2141
+ "sourceSha256": "728aa2d9dd16d7e71ff3583aa767b74818850bdd4dbdca1f15e85d0c0c1b09bd",
2142
+ "outputSha256": "728aa2d9dd16d7e71ff3583aa767b74818850bdd4dbdca1f15e85d0c0c1b09bd",
2143
2143
  "transform": "verbatim"
2144
2144
  }
2145
2145
  ],
@@ -39,7 +39,8 @@
39
39
  * 100 entries within 24h.
40
40
  */
41
41
 
42
- import { chmodSync, mkdirSync, readFileSync } from 'node:fs'
42
+ import { chmodSync, mkdirSync, readFileSync, statSync } from 'node:fs'
43
+ import { readFile, stat } from 'node:fs/promises'
43
44
  import { homedir } from 'node:os'
44
45
  import { dirname, join } from 'node:path'
45
46
  // Subpath imports (not the barrel): this file ships into the TUI's
@@ -230,13 +231,7 @@ export function getSidebarStateFile(): string {
230
231
 
231
232
  /**
232
233
  * Read and normalize the sidebar state file. Returns the default state when
233
- * the file is missing, unreadable, malformed, or schema-incompatible — the TUI
234
- * must never throw out of `readSidebarState()`, the panel just shows
235
- * "Awaiting Antigravity state" and the next poll retries.
236
- *
237
- * The read is sync on purpose: the TUI polls on a 2-second timer and the file
238
- * is tiny (a handful of accounts); an async read here would just add race
239
- * surface area against Solid's reactive render cycle.
234
+ * the file is missing, unreadable, malformed, or schema-incompatible.
240
235
  */
241
236
  export function readSidebarState(
242
237
  path: string = getSidebarStateFile(),
@@ -247,6 +242,80 @@ export function readSidebarState(
247
242
  } catch {
248
243
  return { ...DEFAULT_SIDEBAR_STATE }
249
244
  }
245
+ return parseSidebarState(raw)
246
+ }
247
+
248
+ /** Identifies one version of the state file; see `fileSignature`. */
249
+ export interface SidebarStateBaseline {
250
+ path: string
251
+ signature: string | null
252
+ }
253
+
254
+ // Atomic replacement can leave size and mtime unchanged; inode identifies
255
+ // the new file, and ctime invalidates the read on permission changes.
256
+ function fileSignature(info: {
257
+ dev: bigint
258
+ ino: bigint
259
+ size: bigint
260
+ mtimeNs: bigint
261
+ ctimeNs: bigint
262
+ }): string {
263
+ return `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`
264
+ }
265
+
266
+ /**
267
+ * Read the state file synchronously with the signature of the version read.
268
+ * The sidebar uses it once at mount, so the very first frame already has the
269
+ * quota bars; the later polls go through `createSidebarStateReader`.
270
+ */
271
+ export function readSidebarStateWithBaseline(
272
+ path: string = getSidebarStateFile(),
273
+ ): { state: SidebarStateV1; baseline: SidebarStateBaseline } {
274
+ try {
275
+ const signature = fileSignature(statSync(path, { bigint: true }))
276
+ const raw = readFileSync(path, 'utf-8')
277
+ return { state: parseSidebarState(raw), baseline: { path, signature } }
278
+ } catch {
279
+ return {
280
+ state: { ...DEFAULT_SIDEBAR_STATE },
281
+ baseline: { path, signature: null },
282
+ }
283
+ }
284
+ }
285
+
286
+ /**
287
+ * Create a reader for one polling consumer. Polls must not overlap. A reader
288
+ * started from a `baseline` returns nothing until the file changes from it.
289
+ */
290
+ export function createSidebarStateReader(
291
+ baseline?: SidebarStateBaseline,
292
+ ): (path?: string) => Promise<SidebarStateV1 | undefined> {
293
+ let previousPath: string | undefined = baseline?.path
294
+ let previousSignature: string | null = baseline?.signature ?? null
295
+
296
+ return async (path = getSidebarStateFile()) => {
297
+ let raw: string
298
+ let signature: string
299
+ try {
300
+ signature = fileSignature(await stat(path, { bigint: true }))
301
+ if (path === previousPath && signature === previousSignature) return
302
+ raw = await readFile(path, 'utf-8')
303
+ } catch {
304
+ const alreadyUnavailable =
305
+ path === previousPath && previousSignature === null
306
+ previousPath = path
307
+ previousSignature = null
308
+ return alreadyUnavailable ? undefined : { ...DEFAULT_SIDEBAR_STATE }
309
+ }
310
+
311
+ const loaded = parseSidebarState(raw)
312
+ previousPath = path
313
+ previousSignature = signature
314
+ return loaded
315
+ }
316
+ }
317
+
318
+ function parseSidebarState(raw: string): SidebarStateV1 {
250
319
  let parsed: unknown
251
320
  try {
252
321
  parsed = JSON.parse(raw)
@@ -1,4 +1,5 @@
1
- import { chmodSync, mkdirSync, readFileSync } from "node:fs";
1
+ import { chmodSync, mkdirSync, readFileSync, statSync } from "node:fs";
2
+ import { readFile, stat } from "node:fs/promises";
2
3
  import { homedir } from "node:os";
3
4
  import { dirname, join } from "node:path";
4
5
  import { writeJsonAtomic } from "@cortexkit/antigravity-auth-core/atomic-write";
@@ -44,6 +45,44 @@ export function readSidebarState(path = getSidebarStateFile()) {
44
45
  } catch {
45
46
  return { ...DEFAULT_SIDEBAR_STATE };
46
47
  }
48
+ return parseSidebarState(raw);
49
+ }
50
+ function fileSignature(info) {
51
+ return `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`;
52
+ }
53
+ export function readSidebarStateWithBaseline(path = getSidebarStateFile()) {
54
+ try {
55
+ const signature = fileSignature(statSync(path, { bigint: !0 })), raw = readFileSync(path, "utf-8");
56
+ return { state: parseSidebarState(raw), baseline: { path, signature } };
57
+ } catch {
58
+ return {
59
+ state: { ...DEFAULT_SIDEBAR_STATE },
60
+ baseline: { path, signature: null }
61
+ };
62
+ }
63
+ }
64
+ export function createSidebarStateReader(baseline) {
65
+ let previousPath = baseline?.path, previousSignature = baseline?.signature ?? null;
66
+ return async (path = getSidebarStateFile()) => {
67
+ let raw, signature;
68
+ try {
69
+ signature = fileSignature(await stat(path, { bigint: !0 }));
70
+ if (path === previousPath && signature === previousSignature)
71
+ return;
72
+ raw = await readFile(path, "utf-8");
73
+ } catch {
74
+ const alreadyUnavailable = path === previousPath && previousSignature === null;
75
+ previousPath = path;
76
+ previousSignature = null;
77
+ return alreadyUnavailable ? void 0 : { ...DEFAULT_SIDEBAR_STATE };
78
+ }
79
+ const loaded = parseSidebarState(raw);
80
+ previousPath = path;
81
+ previousSignature = signature;
82
+ return loaded;
83
+ };
84
+ }
85
+ function parseSidebarState(raw) {
47
86
  let parsed;
48
87
  try {
49
88
  parsed = JSON.parse(raw);
@@ -48,7 +48,7 @@ import { fileURLToPath } from "node:url";
48
48
  import { createSlot } from "opentui:runtime-module:%40opentui%2Fsolid";
49
49
  import { createSignal, onCleanup, onMount } from "opentui:runtime-module:solid-js";
50
50
  import { getRpcDir } from "./rpc/rpc-dir.js";
51
- import { readSidebarState } from "./sidebar-state.js";
51
+ import { createSidebarStateReader, readSidebarStateWithBaseline } from "./sidebar-state.js";
52
52
  import { createTuiFileLogger } from "./tui/file-logger.js";
53
53
  import { createV1MenuTransport, dispatchV1Notification } from "./tui/host-v1.js";
54
54
  import { AntigravitySidebar } from "./tui/sidebar-frame.js";
@@ -276,7 +276,8 @@ function formatError(value) {
276
276
 
277
277
  export function SidebarPanel(props) {
278
278
  const logger = resolveLogger(props.logger);
279
- const now = props.now ?? (() => Date.now());
279
+ const clock = props.now ?? Date.now;
280
+ const [now, setNow] = createSignal(clock());
280
281
  const pollMs = props.pollIntervalMs ?? POLL_INTERVAL_MS;
281
282
  const controller = props.controller ?? getSidebarController();
282
283
  const collapsed = controller.collapsed;
@@ -287,32 +288,56 @@ export function SidebarPanel(props) {
287
288
  const theme = () => props.theme?.() ?? FALLBACK_THEME;
288
289
  const [state, setState] = createSignal({
289
290
  loaded: EMPTY_STATE,
290
- lastReadAt: 0,
291
291
  lastError: null
292
292
  });
293
- const refresh = () => {
294
- try {
295
- const loaded = readSidebarState(props.stateFile);
296
- setState({
297
- loaded,
298
- lastReadAt: now(),
299
- lastError: null
300
- });
301
- } catch (error) {
302
- logger.warn('sidebar-poll-failed', {
303
- error: formatError(error)
304
- });
305
- setState(prev => ({
306
- ...prev,
307
- lastReadAt: now(),
308
- lastError: formatError(error)
309
- }));
310
- }
311
- };
312
293
  onMount(() => {
313
- refresh();
294
+ // Read synchronously once so the first frame already draws the quota bars;
295
+ // the polls below reread only when the file has changed since.
296
+ const first = readSidebarStateWithBaseline(props.stateFile);
297
+ setState({
298
+ loaded: first.state,
299
+ lastError: null
300
+ });
301
+ const readChanged = createSidebarStateReader(first.baseline);
302
+ let mounted = true;
303
+ let reading = false;
304
+ const refresh = async () => {
305
+ if (!mounted) return;
306
+ setNow(clock());
307
+ if (reading) return;
308
+ reading = true;
309
+ try {
310
+ const loaded = await readChanged(props.stateFile);
311
+ if (!mounted) return;
312
+ if (loaded) setState({
313
+ loaded,
314
+ lastError: null
315
+ });else if (state().lastError !== null) {
316
+ setState(prev => ({
317
+ ...prev,
318
+ lastError: null
319
+ }));
320
+ }
321
+ } catch (error) {
322
+ if (!mounted) return;
323
+ const message = formatError(error);
324
+ logger.warn('sidebar-poll-failed', {
325
+ error: message
326
+ });
327
+ setState(prev => ({
328
+ ...prev,
329
+ lastError: message
330
+ }));
331
+ } finally {
332
+ reading = false;
333
+ }
334
+ };
335
+ void refresh();
314
336
  const interval = setInterval(refresh, pollMs);
315
- onCleanup(() => clearInterval(interval));
337
+ onCleanup(() => {
338
+ mounted = false;
339
+ clearInterval(interval);
340
+ });
316
341
  });
317
342
  const lastError = () => state().lastError ?? state().loaded.lastError;
318
343
  const currentRoute = () => {
@@ -358,14 +358,15 @@ export function parseGaStateAnswer(raw) {
358
358
  issues: ['output.kind: unknown answer']
359
359
  };
360
360
  }
361
- keys(output, ['version', 'kind', 'generation', 'scope', 'reset', 'cursor', 'dropped', 'more', 'notifications', 'readSeq', 'accountsStatus', 'accounts', 'route', 'status', 'settings'], ['vaultHostStatus'], 'output', issues);
361
+ keys(output, ['version', 'kind', 'generation', 'scope', 'reset', 'cursor', 'dropped', 'more', 'notifications', 'readSeq', 'accountsStatus', 'accounts', 'route', 'status', 'settings'], ['vaultHostStatus', 'queueID'], 'output', issues);
362
362
  if (!isCursor(output.readSeq)) issues.push('output.readSeq: expected a count');
363
363
  if (Object.hasOwn(output, 'vaultHostStatus') && output.vaultHostStatus !== 'Served by Thalamus') issues.push('output.vaultHostStatus: expected the hosted vault status');
364
364
  checkAccountsStatus(output.accountsStatus, 'output.accountsStatus', issues);
365
365
  checkSettings(output.settings, 'output.settings', issues);
366
366
  checkGeneration(output.generation, 'output.generation', issues);
367
+ if (Object.hasOwn(output, 'queueID')) checkGeneration(output.queueID, 'output.queueID', issues);
367
368
  checkScope(output.scope, 'output.scope', issues);
368
- if (output.reset !== null && output.reset !== 'initial' && output.reset !== 'generation-changed' && output.reset !== 'cursor-ahead') {
369
+ if (output.reset !== null && output.reset !== 'initial' && output.reset !== 'generation-changed' && output.reset !== 'queue-changed' && output.reset !== 'cursor-ahead') {
369
370
  issues.push('output.reset: unknown reset');
370
371
  }
371
372
  if (!isCursor(output.cursor)) issues.push('output.cursor: expected a cursor');
@@ -472,11 +473,13 @@ export function createGaLocationClient(options) {
472
473
  if (isDisposed) throw new GaClientDisposedError();
473
474
  const sentEpoch = epoch;
474
475
  const key = scopeKey(scope);
476
+ const previous = cursors.get(key);
475
477
  const raw = await call('state', {
476
478
  version: GA_RPC_VERSION,
477
479
  generation,
478
480
  scope,
479
- cursor: cursors.get(key) ?? 0
481
+ cursor: previous?.cursor ?? 0,
482
+ queueID: previous?.queueID ?? null
480
483
  });
481
484
  if (isDisposed || sentEpoch !== epoch) return {
482
485
  kind: 'dropped'
@@ -504,7 +507,10 @@ export function createGaLocationClient(options) {
504
507
  if (output.generation !== generation) {
505
508
  rebind(output.generation);
506
509
  }
507
- cursors.set(key, output.cursor);
510
+ cursors.set(key, {
511
+ cursor: output.cursor,
512
+ queueID: output.queueID ?? null
513
+ });
508
514
  return {
509
515
  kind: 'snapshot',
510
516
  snapshot: output
@@ -512,7 +518,7 @@ export function createGaLocationClient(options) {
512
518
  };
513
519
  return {
514
520
  generation: () => generation,
515
- cursor: scope => cursors.get(scopeKey(scope)) ?? 0,
521
+ cursor: scope => cursors.get(scopeKey(scope))?.cursor ?? 0,
516
522
  disposed: () => isDisposed,
517
523
  dispose() {
518
524
  isDisposed = true;
@@ -235,8 +235,14 @@ export interface GaSnapshot {
235
235
  readonly kind: 'snapshot'
236
236
  readonly generation: string
237
237
  readonly scope: GaScope
238
- readonly reset: 'initial' | 'generation-changed' | 'cursor-ahead' | null
238
+ readonly reset:
239
+ | 'initial'
240
+ | 'generation-changed'
241
+ | 'queue-changed'
242
+ | 'cursor-ahead'
243
+ | null
239
244
  readonly cursor: number
245
+ readonly queueID?: string
240
246
  readonly dropped: number
241
247
  readonly more: boolean
242
248
  readonly notifications: readonly GaNotification[]
@@ -684,7 +690,7 @@ export function parseGaStateAnswer(
684
690
  'status',
685
691
  'settings',
686
692
  ],
687
- ['vaultHostStatus'],
693
+ ['vaultHostStatus', 'queueID'],
688
694
  'output',
689
695
  issues,
690
696
  )
@@ -697,11 +703,14 @@ export function parseGaStateAnswer(
697
703
  checkAccountsStatus(output.accountsStatus, 'output.accountsStatus', issues)
698
704
  checkSettings(output.settings, 'output.settings', issues)
699
705
  checkGeneration(output.generation, 'output.generation', issues)
706
+ if (Object.hasOwn(output, 'queueID'))
707
+ checkGeneration(output.queueID, 'output.queueID', issues)
700
708
  checkScope(output.scope, 'output.scope', issues)
701
709
  if (
702
710
  output.reset !== null &&
703
711
  output.reset !== 'initial' &&
704
712
  output.reset !== 'generation-changed' &&
713
+ output.reset !== 'queue-changed' &&
705
714
  output.reset !== 'cursor-ahead'
706
715
  ) {
707
716
  issues.push('output.reset: unknown reset')
@@ -813,7 +822,7 @@ export function createGaLocationClient(options: {
813
822
  readonly logger?: GaLogger
814
823
  }): GaLocationClient {
815
824
  let generation: string | null = null
816
- const cursors = new Map<string, number>()
825
+ const cursors = new Map<string, { cursor: number; queueID: string | null }>()
817
826
  let isDisposed = false
818
827
  // Bumped on every rebind and on disposal. A request remembers the epoch
819
828
  // it was sent in; an answer from an older epoch is dropped unread.
@@ -842,11 +851,13 @@ export function createGaLocationClient(options: {
842
851
  if (isDisposed) throw new GaClientDisposedError()
843
852
  const sentEpoch = epoch
844
853
  const key = scopeKey(scope)
854
+ const previous = cursors.get(key)
845
855
  const raw = await call('state', {
846
856
  version: GA_RPC_VERSION,
847
857
  generation,
848
858
  scope,
849
- cursor: cursors.get(key) ?? 0,
859
+ cursor: previous?.cursor ?? 0,
860
+ queueID: previous?.queueID ?? null,
850
861
  })
851
862
  if (isDisposed || sentEpoch !== epoch) return { kind: 'dropped' }
852
863
  const parsed = parseGaStateAnswer(raw)
@@ -868,13 +879,13 @@ export function createGaLocationClient(options: {
868
879
  if (output.generation !== generation) {
869
880
  rebind(output.generation)
870
881
  }
871
- cursors.set(key, output.cursor)
882
+ cursors.set(key, { cursor: output.cursor, queueID: output.queueID ?? null })
872
883
  return { kind: 'snapshot', snapshot: output }
873
884
  }
874
885
 
875
886
  return {
876
887
  generation: () => generation,
877
- cursor: (scope) => cursors.get(scopeKey(scope)) ?? 0,
888
+ cursor: (scope) => cursors.get(scopeKey(scope))?.cursor ?? 0,
878
889
  disposed: () => isDisposed,
879
890
  dispose() {
880
891
  isDisposed = true
@@ -1,4 +1,5 @@
1
- import { chmodSync, mkdirSync, readFileSync } from "node:fs";
1
+ import { chmodSync, mkdirSync, readFileSync, statSync } from "node:fs";
2
+ import { readFile, stat } from "node:fs/promises";
2
3
  import { homedir } from "node:os";
3
4
  import { dirname, join } from "node:path";
4
5
  import { writeJsonAtomic } from "@cortexkit/antigravity-auth-core/atomic-write";
@@ -44,6 +45,44 @@ export function readSidebarState(path = getSidebarStateFile()) {
44
45
  } catch {
45
46
  return { ...DEFAULT_SIDEBAR_STATE };
46
47
  }
48
+ return parseSidebarState(raw);
49
+ }
50
+ function fileSignature(info) {
51
+ return `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`;
52
+ }
53
+ export function readSidebarStateWithBaseline(path = getSidebarStateFile()) {
54
+ try {
55
+ const signature = fileSignature(statSync(path, { bigint: !0 })), raw = readFileSync(path, "utf-8");
56
+ return { state: parseSidebarState(raw), baseline: { path, signature } };
57
+ } catch {
58
+ return {
59
+ state: { ...DEFAULT_SIDEBAR_STATE },
60
+ baseline: { path, signature: null }
61
+ };
62
+ }
63
+ }
64
+ export function createSidebarStateReader(baseline) {
65
+ let previousPath = baseline?.path, previousSignature = baseline?.signature ?? null;
66
+ return async (path = getSidebarStateFile()) => {
67
+ let raw, signature;
68
+ try {
69
+ signature = fileSignature(await stat(path, { bigint: !0 }));
70
+ if (path === previousPath && signature === previousSignature)
71
+ return;
72
+ raw = await readFile(path, "utf-8");
73
+ } catch {
74
+ const alreadyUnavailable = path === previousPath && previousSignature === null;
75
+ previousPath = path;
76
+ previousSignature = null;
77
+ return alreadyUnavailable ? void 0 : { ...DEFAULT_SIDEBAR_STATE };
78
+ }
79
+ const loaded = parseSidebarState(raw);
80
+ previousPath = path;
81
+ previousSignature = signature;
82
+ return loaded;
83
+ };
84
+ }
85
+ function parseSidebarState(raw) {
47
86
  let parsed;
48
87
  try {
49
88
  parsed = JSON.parse(raw);