@cortexkit/opencode-antigravity-auth 3.0.11 → 3.0.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 (80) hide show
  1. package/dist/cli.js +1607 -1189
  2. package/dist/cli.js.map +4 -4
  3. package/dist/cli.meta.json +164 -102
  4. package/dist/index.js +1752 -1333
  5. package/dist/index.js.map +4 -4
  6. package/dist/index.meta.json +167 -105
  7. package/dist/server.js +1752 -1333
  8. package/dist/server.js.map +4 -4
  9. package/dist/server.meta.json +1 -1
  10. package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +7 -1
  11. package/dist/src/common-auth-embedded/claustrum/consumer.js +17 -2
  12. package/dist/src/common-auth-embedded/claustrum/errors.d.ts +1 -1
  13. package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  14. package/dist/src/common-auth-embedded/claustrum/index.js +1 -1
  15. package/dist/src/common-auth-embedded/claustrum/quota-writer.js +4 -54
  16. package/dist/src/common-auth-embedded/claustrum/roster.d.ts +31 -0
  17. package/dist/src/common-auth-embedded/claustrum/roster.js +72 -0
  18. package/dist/src/common-auth-embedded/commands/builtins.d.ts +37 -0
  19. package/dist/src/common-auth-embedded/commands/builtins.js +95 -13
  20. package/dist/src/common-auth-embedded/commands/index.d.ts +1 -1
  21. package/dist/src/common-auth-embedded/opencode2/install.d.ts +3 -2
  22. package/dist/src/common-auth-embedded/opencode2/install.js +184 -63
  23. package/dist/src/common-auth-embedded/opencode2/types.d.ts +43 -6
  24. package/dist/src/common-auth-embedded/quota/pending.js +48 -0
  25. package/dist/src/common-auth-embedded/setup/enroll.d.ts +1 -1
  26. package/dist/src/common-auth-embedded/setup/enroll.js +1 -1
  27. package/dist/src/common-auth-embedded/source-output.json +89 -73
  28. package/dist/src/common-auth-embedded/store/attribution.d.ts +5 -0
  29. package/dist/src/common-auth-embedded/store/attribution.js +39 -25
  30. package/dist/src/common-auth-embedded/store/pool.d.ts +17 -0
  31. package/dist/src/common-auth-embedded/store/pool.js +18 -3
  32. package/dist/src/common-auth-embedded/store/pull.js +3 -1
  33. package/dist/src/common-auth-embedded/store/quota-writer.js +298 -0
  34. package/dist/src/common-auth-embedded/store/runtime.d.ts +2 -0
  35. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  36. package/dist/src/plugin/shared/request-services.js +1 -0
  37. package/dist/src/plugin/shared/request-services.js.map +1 -1
  38. package/dist/src/plugin/vault-custody.js +2 -2
  39. package/dist/src/plugin/vault-custody.js.map +1 -1
  40. package/dist/tui-build-map.json +1 -1
  41. package/dist/tui-ga-build-map.json +1 -1
  42. package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +7 -1
  43. package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +1 -1
  44. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  45. package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +31 -0
  46. package/dist/types/src/common-auth-embedded/commands/builtins.d.ts +37 -0
  47. package/dist/types/src/common-auth-embedded/commands/index.d.ts +1 -1
  48. package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +3 -2
  49. package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +43 -6
  50. package/dist/types/src/common-auth-embedded/setup/enroll.d.ts +1 -1
  51. package/dist/types/src/common-auth-embedded/store/attribution.d.ts +5 -0
  52. package/dist/types/src/common-auth-embedded/store/pool.d.ts +17 -0
  53. package/dist/types/src/common-auth-embedded/store/runtime.d.ts +2 -0
  54. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  55. package/package.json +2 -2
  56. package/src/common-auth-embedded/claustrum/consumer.d.ts +7 -1
  57. package/src/common-auth-embedded/claustrum/consumer.js +17 -2
  58. package/src/common-auth-embedded/claustrum/errors.d.ts +1 -1
  59. package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  60. package/src/common-auth-embedded/claustrum/index.js +1 -1
  61. package/src/common-auth-embedded/claustrum/quota-writer.js +4 -54
  62. package/src/common-auth-embedded/claustrum/roster.d.ts +31 -0
  63. package/src/common-auth-embedded/claustrum/roster.js +72 -0
  64. package/src/common-auth-embedded/commands/builtins.d.ts +37 -0
  65. package/src/common-auth-embedded/commands/builtins.js +95 -13
  66. package/src/common-auth-embedded/commands/index.d.ts +1 -1
  67. package/src/common-auth-embedded/opencode2/install.d.ts +3 -2
  68. package/src/common-auth-embedded/opencode2/install.js +184 -63
  69. package/src/common-auth-embedded/opencode2/types.d.ts +43 -6
  70. package/src/common-auth-embedded/quota/pending.js +48 -0
  71. package/src/common-auth-embedded/setup/enroll.d.ts +1 -1
  72. package/src/common-auth-embedded/setup/enroll.js +1 -1
  73. package/src/common-auth-embedded/source-output.json +89 -73
  74. package/src/common-auth-embedded/store/attribution.d.ts +5 -0
  75. package/src/common-auth-embedded/store/attribution.js +39 -25
  76. package/src/common-auth-embedded/store/pool.d.ts +17 -0
  77. package/src/common-auth-embedded/store/pool.js +18 -3
  78. package/src/common-auth-embedded/store/pull.js +3 -1
  79. package/src/common-auth-embedded/store/quota-writer.js +298 -0
  80. package/src/common-auth-embedded/store/runtime.d.ts +2 -0
@@ -53,6 +53,8 @@ export interface EventVerdict<Q> {
53
53
  */
54
54
  export type HeaderEdits = Readonly<Record<string, string | null>>;
55
55
  export interface ChooseAccountInput extends RequestScope {
56
+ /** Informational: the retry hook's advance choice, or a request's own choice. */
57
+ readonly phase: 'retry' | 'request';
56
58
  /**
57
59
  * The account of the attempt this one retries, when the retry hook just
58
60
  * asked the host to retry an attempt of this session and kind; otherwise
@@ -61,8 +63,9 @@ export interface ChooseAccountInput extends RequestScope {
61
63
  readonly previousAccountId?: string;
62
64
  /**
63
65
  * Set when the attempt this one retries was refused for a limit before any
64
- * output and the retry hook asked the host to try again. The adapter
65
- * should not pick `accountId` again unless it has nothing else.
66
+ * output. The adapter should not pick `accountId` again unless it has
67
+ * nothing else; returning it, or `undefined`, tells the retry hook that no
68
+ * other account can serve, so the host's own retry decision stands.
66
69
  */
67
70
  readonly rerouteFrom?: {
68
71
  readonly accountId: string;
@@ -166,11 +169,32 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown> {
166
169
  /** Every hook is scoped to this provider; other providers are untouched. */
167
170
  readonly providerID: string;
168
171
  /**
169
- * Picks the account for one model request. Called again for every retry,
170
- * so a refused account can be skipped. Returning `undefined` stops the
171
- * request with `OpenCode2AuthError` kind `no-account`.
172
+ * Commits an account for one attempt. An undefined answer commits nothing
173
+ * to routing state: no consumed retry entry, no queued choice, and no session
174
+ * pin created, moved or deleted. Idempotent maintenance (credential refresh
175
+ * to check usability and recording quota readings) is allowed. On a request,
176
+ * undefined stops with kind `no-account`.
177
+ *
178
+ * After a limit before any output, the retry hook makes this call itself,
179
+ * with `phase: 'retry'` and `rerouteFrom` set. Every returned account,
180
+ * including the refused one, is kept for the next attempt of that session
181
+ * and kind: it does not choose again. Another account retries at once;
182
+ * the refused account keeps the host's decision and wait. `undefined` or a
183
+ * throw commits nothing: the host decides, and the next attempt chooses
184
+ * with `phase: 'request'`, `previousAccountId` and no `rerouteFrom`.
172
185
  */
173
186
  chooseAccount(input: ChooseAccountInput): Promise<string | undefined> | string | undefined;
187
+ /**
188
+ * Releases a kept retry choice that will not be used: no retry, a changed
189
+ * model or agent, session forgetting/deletion, disposal or record eviction.
190
+ * Called once with the original choose input plus its returned accountId,
191
+ * never for a used choice. Awaited before any later chooseAccount for the
192
+ * same session; errors are logged and swallowed. A model/agent change
193
+ * releases the old choice before choosing afresh.
194
+ */
195
+ dropChoice?(input: ChooseAccountInput & {
196
+ readonly accountId: string;
197
+ }): Promise<void> | void;
174
198
  /**
175
199
  * The credential and per-account headers for an account, applied in
176
200
  * `model.request`, `http.request` and `experimental.ws.handshake`. The last
@@ -337,7 +361,20 @@ export interface InstallOpenCode2AuthOptions {
337
361
  readonly maxRecords?: number;
338
362
  readonly logger?: OpenCode2AuthLogger;
339
363
  }
340
- export type RetryReason = 'reroute' | 'output-started' | 'no-account' | 'host-decides';
364
+ /**
365
+ * Why the retry hook decided as it did:
366
+ *
367
+ * - `reroute`: refused for a limit before any output, and `chooseAccount`
368
+ * named another account for the next attempt, so the host retries at once;
369
+ * - `output-started`: output had reached the user, so no retry;
370
+ * - `no-account`: the attempt had no account, so no retry;
371
+ * - `host-decides-last-account`: refused for a limit before any output, but
372
+ * no other account can serve the next attempt, so the host's own decision
373
+ * (its wait, or its refusal to retry) stands and the next attempt may go
374
+ * to the refused account again;
375
+ * - `host-decides`: no limit was recognised, so the host's decision stands.
376
+ */
377
+ export type RetryReason = 'reroute' | 'output-started' | 'no-account' | 'host-decides-last-account' | 'host-decides';
341
378
  /**
342
379
  * The hook that picked an account. Normally `model.request`; a transport hook
343
380
  * picks only when the host skipped `model.request` for that request, which a
@@ -1,7 +1,7 @@
1
1
  import { type MenuTerminal } from '../auth-menu/terminal.js';
2
2
  import type { SetupHost, SetupIO, SetupPlugin } from './types.js';
3
3
  /** Fixed text: no version, host or account detail, so it is safe to print anywhere. */
4
- export declare const UNSUPPORTED_VAULT_MESSAGE = "This Claustrum vault does not support connecting plugins yet, so setup cannot connect to it. Run setup without --claustrum to use local accounts.";
4
+ export declare const UNSUPPORTED_VAULT_MESSAGE = "This Claustrum vault is too old to connect plugins. Run ck upgrade to move to Claustrum v0.2.0 or newer (read \"Upgrading from v0.1.3\" in its release notes first), or run setup without --claustrum to use local accounts.";
5
5
  /**
6
6
  * The longest setup waits, in total, for the vault to create the enrollment
7
7
  * request and for an operator to approve it. It matches the wait setup always
@@ -1,4 +1,6 @@
1
+ import { type StoreContext } from './mutate.js';
1
2
  import { type StoreRuntime } from './runtime.js';
3
+ import { type PoolRow } from './schema.js';
2
4
  /**
3
5
  * What a pull or refresh captured about its row (named by id alongside) when
4
6
  * it was issued. A result applies only while the row with that id still has
@@ -20,6 +22,9 @@ export interface Attribution {
20
22
  credentialEpoch: number;
21
23
  identity?: string;
22
24
  }
25
+ export declare function assertQuotaEpoch(id: string, attribution: Attribution): void;
26
+ export declare function assertQuotaRow(id: string, attribution: Attribution, row: PoolRow | undefined): asserts row is PoolRow;
27
+ export declare function mergedQuota(ctx: StoreContext, id: string, stored: unknown, observation: unknown): unknown;
23
28
  /**
24
29
  * Merges a quota observation into a row's stored map under the store locks,
25
30
  * after attribution passes. Needs no row lock, so it is permitted from
@@ -16,6 +16,19 @@ export interface OpenPoolStoreOptions {
16
16
  configPath: string;
17
17
  statePath: string;
18
18
  quota: QuotaCodec;
19
+ /**
20
+ * Opt in to detached, coalesced quota publication, with any `quota` codec.
21
+ * Each accepted observation is queued whole for its row and binding, and
22
+ * the queue is applied in arrival order through `quota.merge` under the
23
+ * store locks, so the codec's own merge decides which fields a newer or
24
+ * older reading replaces. Accepted readings appear in read/load
25
+ * immediately, merged the same way; the returned promise still rejects
26
+ * current-row refusals before queueing. Await dispose or close at shutdown
27
+ * to drain.
28
+ */
29
+ coalesceQuota?: boolean;
30
+ /** Bounded quota drain on close/dispose, in milliseconds; defaults to 1,000. */
31
+ quotaDrainTimeoutMs?: number;
19
32
  /**
20
33
  * The codec of the provider state kept beside each row's credential (see
21
34
  * `ProviderStateCodec`). Without it no row shows a provider state, and
@@ -189,6 +202,10 @@ export interface PoolStore {
189
202
  }>;
190
203
  refresh(id: string, provider: ProviderRefresh, options?: RefreshOptions): Promise<RefreshOutcome>;
191
204
  recordQuota(id: string, attribution: Attribution, observation: unknown): Promise<void>;
205
+ /** Drain opted-in quota publication; subsequent coalesced readings refuse. Idempotent. */
206
+ close(): Promise<void>;
207
+ /** Same bounded quota drain as close(). Does not wait for provider pull hooks. */
208
+ dispose(): Promise<void>;
192
209
  /** Fires a pull for a row admission refused for want of a reading. */
193
210
  requestReading(id: string): void;
194
211
  /** Resolves once every pull fired so far has settled. */
@@ -1,3 +1,4 @@
1
+ import type { Attribution } from './attribution.js';
1
2
  import { type PoolOperation, PoolOperationError } from './errors.js';
2
3
  import { type ReadResult, type StoreContext } from './mutate.js';
3
4
  import type { PoolLockOptions, PoolLockSpec } from './refresh-lock.js';
@@ -10,6 +11,7 @@ export interface StoreRuntime {
10
11
  providerLock: PoolLockSpec;
11
12
  rowLockOptions: Partial<PoolLockOptions>;
12
13
  firePull(id: string, reason: PullReason): void;
14
+ publishQuota?: (id: string, attribution: Attribution, observation: unknown) => Promise<void>;
13
15
  }
14
16
  /**
15
17
  * The row lock's (name, path): keyed by the row's recorded wire identity when
@@ -1 +1 @@
1
- {"version":3,"file":"request-services.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/shared/request-services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,cAAc,IAAI,kBAAkB,EAGzC,KAAK,WAAW,EAIhB,KAAK,kBAAkB,EAIvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EAGrB,KAAK,oBAAoB,EAKzB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAMjB,KAAK,kBAAkB,EAExB,MAAM,kCAAkC,CAAA;AAMzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAgB7C,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,gBAAgB,CAAA;AAE7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AAMnB,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,KAAK,kBAAk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,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,EACrE,GAAG,EAAE,MAAM,GACV,CACD,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,IAAI,CAAC,CA0DjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,iBAAiB,EAC/D,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC3B,0BAA0B,CAkqE5B"}
1
+ {"version":3,"file":"request-services.d.ts","sourceRoot":"","sources":["../../../../../src/plugin/shared/request-services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,cAAc,IAAI,kBAAkB,EAGzC,KAAK,WAAW,EAIhB,KAAK,kBAAkB,EAIvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EAGrB,KAAK,oBAAoB,EAKzB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAMjB,KAAK,kBAAkB,EAExB,MAAM,kCAAkC,CAAA;AAMzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAgB7C,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,gBAAgB,CAAA;AAE7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC7B,MAAM,YAAY,CAAA;AAMnB,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,uBAAuB,EAC7B,MAAM,oBAA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Ac,EAAE,IAAI,CAClB,kBAAkB,EAChB,aAAa,GACb,0BAA0B,GAC1B,kBAAkB,GAClB,mBAAmB,CACtB,EACD,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,CAAC,EACrE,GAAG,EAAE,MAAM,GACV,CACD,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,MAAM,EACvB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,IAAI,CAAC,CA0DjB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,iBAAiB,EAC/D,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC3B,0BAA0B,CAmqE5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-antigravity-auth",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "Google Antigravity OAuth auth plugin for OpenCode - access Gemini and Claude models using Google credentials",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -130,7 +130,7 @@
130
130
  "dependencies": {
131
131
  "@cortexkit/claustrum-client": "0.12.0",
132
132
  "@cortexkit/subc-client": "0.22.5",
133
- "@cortexkit/antigravity-auth-core": "3.0.11",
133
+ "@cortexkit/antigravity-auth-core": "3.0.12",
134
134
  "@cortexkit/private-files": "0.2.1",
135
135
  "jsonc-parser": "^3.3.1",
136
136
  "xdg-basedir": "^5.1.0",
@@ -4,7 +4,7 @@ import type { RoutingRow } from '../routing/index.js';
4
4
  import { type ClaustrumFamily, type ClaustrumScopedAttempt, type ClaustrumScopedClient, type IdentityParser, type KeptReceiptState, type VaultGrantReach } from './custody.js';
5
5
  import { type ClaustrumLogger } from './errors.js';
6
6
  import { type InsulaQuotaOptions, type InsulaQuotaResult } from './insula.js';
7
- import { type AccountMapper, type QuotaReceipt, type VaultRosterFile } from './roster.js';
7
+ import { type AccountMapper, type QuotaReceipt, type ReorderVaultRosterResult, type VaultRosterFile } from './roster.js';
8
8
  import { type WatchMode } from './watch.js';
9
9
  export interface ClaustrumConsumerOptions<Q = QuotaObservation> {
10
10
  /**
@@ -157,6 +157,12 @@ export declare class ClaustrumConsumer<Q = QuotaObservation> {
157
157
  /** Decline a vault account: it stays listed and never routes until accepted. */
158
158
  decline(routeId: string): Promise<void>;
159
159
  accept(routeId: string): Promise<void>;
160
+ /**
161
+ * Set the order vault accounts are tried in (`reorderVaultRoster`), then
162
+ * re-read the roster, so the next routing decision in this process uses
163
+ * the new order without waiting for a discovery. Never contacts the vault.
164
+ */
165
+ reorder(routeIds: readonly string[]): Promise<ReorderVaultRosterResult>;
160
166
  /**
161
167
  * Store a quota or profile observation for a vault route. The receipt the
162
168
  * reading was taken with is required: the observation lands only while the
@@ -5,7 +5,7 @@ import { readClaustrumEnrollmentToken } from './enrollment.js';
5
5
  import { ClaustrumConsumerError } from './errors.js';
6
6
  import { acquireInsulaQuotaSource, } from './insula.js';
7
7
  import { pendingVaultQuota, retainVaultQuotaWriter } from './quota-writer.js';
8
- import { acceptVaultRoute, applyVaultQuota, declineVaultRoute, forgetPendingVaultDiscovery, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, vaultRoutingRows, } from './roster.js';
8
+ import { acceptVaultRoute, applyVaultQuota, declineVaultRoute, forgetPendingVaultDiscovery, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, reorderVaultRoster, vaultRoutingRows, } from './roster.js';
9
9
  import { SAFETY_POLL_MS } from './watch.js';
10
10
  /**
11
11
  * One plugin host's view of its vault accounts. It turns vault credentials
@@ -485,8 +485,12 @@ export class ClaustrumConsumer {
485
485
  let current;
486
486
  try {
487
487
  current = await this.authorize(routeId, signal);
488
+ // Cancellation can land after authorize settles, before this continuation.
489
+ signal?.throwIfAborted();
488
490
  }
489
- catch {
491
+ catch (error) {
492
+ if (signal?.aborted)
493
+ throw error;
490
494
  // Re-authorization failed: keep this 401 and report it against the
491
495
  // receipt (served record version) this request was sent with.
492
496
  }
@@ -522,6 +526,17 @@ export class ClaustrumConsumer {
522
526
  await acceptVaultRoute(this.#options.rosterPath, routeId);
523
527
  this.#roster = pendingVaultQuota(this.#options.rosterPath, await readVaultRoster(this.#options.rosterPath));
524
528
  }
529
+ /**
530
+ * Set the order vault accounts are tried in (`reorderVaultRoster`), then
531
+ * re-read the roster, so the next routing decision in this process uses
532
+ * the new order without waiting for a discovery. Never contacts the vault.
533
+ */
534
+ async reorder(routeIds) {
535
+ this.#assertOpen();
536
+ const result = await reorderVaultRoster(this.#options.rosterPath, routeIds);
537
+ this.#roster = pendingVaultQuota(this.#options.rosterPath, await readVaultRoster(this.#options.rosterPath));
538
+ return result;
539
+ }
525
540
  /**
526
541
  * Store a quota or profile observation for a vault route. The receipt the
527
542
  * reading was taken with is required: the observation lands only while the
@@ -4,7 +4,7 @@
4
4
  * `code`, a `class` and an `action`), so callers can tell the vault's verdict
5
5
  * apart from a check made on this side.
6
6
  */
7
- export type ClaustrumConsumerFailureKind = 'closed' | 'not-enrolled' | 'invalid-token' | 'unavailable' | 'identity-changed' | 'identity-unasserted' | 'insufficient-validity' | 'invalid-material' | 'not-active' | 'route-unavailable' | 'route-declined' | 'no-receipt' | 'unsafe-file' | 'invalid-state' | 'wrong-consumer' | 'roster-busy' | 'host-slot-login' | 'host-slot-placeholder' | 'placeholder-refresh';
7
+ export type ClaustrumConsumerFailureKind = 'closed' | 'not-enrolled' | 'invalid-token' | 'unavailable' | 'identity-changed' | 'identity-unasserted' | 'insufficient-validity' | 'invalid-material' | 'not-active' | 'route-unavailable' | 'route-declined' | 'no-receipt' | 'unsafe-file' | 'invalid-state' | 'wrong-consumer' | 'roster-busy' | 'host-slot-login' | 'host-slot-placeholder' | 'placeholder-refresh' | 'invalid-order';
8
8
  export declare class ClaustrumConsumerError extends Error {
9
9
  readonly kind: ClaustrumConsumerFailureKind;
10
10
  constructor(kind: ClaustrumConsumerFailureKind, message: string);
@@ -10,7 +10,7 @@ export { assertHostSlotMatchesMode, assertNotCustodyPlaceholder, CUSTODY_PLACEHO
10
10
  export { acquireInsulaQuotaSource, type InsulaQuotaContext, type InsulaQuotaLookup, type InsulaQuotaMiss, type InsulaQuotaOptions, type InsulaQuotaReading, type InsulaQuotaResult, type InsulaQuotaSource, type InsulaUsageEntry, type InsulaUsageTransport, type InsulaUsageWatch, type InsulaUsageWindow, type InsulaWatchOptions, } from './insula.js';
11
11
  export { acceptAccount, type DeclinedAccount, declineAccount, isDeclined, } from './interlock.js';
12
12
  export { drainVaultQuota } from './quota-writer.js';
13
- export { type AccountMapper, acceptVaultRoute, DEFAULT_ROUTE_PREFIX, declineVaultRoute, type MutateVaultRosterOptions, mutateVaultRoster, type ProjectionOptions, projectVaultRoster, type QuotaReceipt, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, resolveVaultPrimary, type VaultPrimary, type VaultPrimaryBinding, type VaultPrimaryUnavailableReason, type VaultRosterFile, type VaultRosterLockContext, type VaultRosterRow, vaultRoutingRows, } from './roster.js';
13
+ export { type AccountMapper, acceptVaultRoute, DEFAULT_ROUTE_PREFIX, declineVaultRoute, type MutateVaultRosterOptions, mutateVaultRoster, type ProjectionOptions, projectVaultRoster, type QuotaReceipt, type ReorderVaultRosterOptions, type ReorderVaultRosterResult, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, reorderVaultRoster, resolveVaultPrimary, type VaultPrimary, type VaultPrimaryBinding, type VaultPrimaryUnavailableReason, type VaultRosterFile, type VaultRosterLockContext, type VaultRosterRow, vaultRoutingRows, } from './roster.js';
14
14
  export { type ChangeNotice, ChangeNoticeReader, RESUBSCRIBE_BACKOFF_MS, SAFETY_POLL_MS, ScopedRosterWatch, type ScopedRosterWatchOptions, type ScopedWatchEnd, type ScopedWatchHandle, type ScopedWatchNoticeShape, type ScopedWatchSource, WATCH_RETRY_MS, type WatchMode, } from './watch.js';
15
15
  /**
16
16
  * Connect the client that lists and fetches this consumer's vault credentials
@@ -15,7 +15,7 @@ export { assertHostSlotMatchesMode, assertNotCustodyPlaceholder, CUSTODY_PLACEHO
15
15
  export { acquireInsulaQuotaSource, } from './insula.js';
16
16
  export { acceptAccount, declineAccount, isDeclined, } from './interlock.js';
17
17
  export { drainVaultQuota } from './quota-writer.js';
18
- export { acceptVaultRoute, DEFAULT_ROUTE_PREFIX, declineVaultRoute, mutateVaultRoster, projectVaultRoster, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, resolveVaultPrimary, vaultRoutingRows, } from './roster.js';
18
+ export { acceptVaultRoute, DEFAULT_ROUTE_PREFIX, declineVaultRoute, mutateVaultRoster, projectVaultRoster, readVaultRoster, recordVaultAccountQuota, recordVaultQuota, refreshVaultRoster, reorderVaultRoster, resolveVaultPrimary, vaultRoutingRows, } from './roster.js';
19
19
  export { ChangeNoticeReader, RESUBSCRIBE_BACKOFF_MS, SAFETY_POLL_MS, ScopedRosterWatch, WATCH_RETRY_MS, } from './watch.js';
20
20
  /**
21
21
  * Connect the client that lists and fetches this consumer's vault credentials
@@ -1,6 +1,7 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { createLogger } from '../logger/index.js';
3
3
  import { isQuotaObservation } from '../quota/index.js';
4
+ import { quotaFields } from '../quota/pending.js';
4
5
  import { applyVaultQuota, mutateVaultRoster, } from './roster.js';
5
6
  // Every consumer of the same file shares one mailbox and one lock waiter.
6
7
  const writers = new Map();
@@ -34,65 +35,14 @@ export function retainVaultQuotaWriter(path, listener) {
34
35
  return writer.listeners.size ? Promise.resolve() : drainVaultQuota(path);
35
36
  })());
36
37
  }
37
- // Split one observation into its independently dated parts: each rate-limit
38
- // window (scope and label), each covered-but-unread window, the budget, each
39
- // counter and the credits record. The mailbox keeps the newest of each part on
40
- // its own, so a later observation that carries only some parts can't erase an
41
- // older but still newest reading of another part, which is how
42
- // mergeQuotaObservation treats them on disk. Each key also carries the
43
- // receipt's identity, so the identity fence still applies to every part.
38
+ // Each field retains the receipt fence as well as its independent timestamp.
44
39
  function fields(publication) {
45
- const result = new Map();
46
- const { observation } = publication;
47
- const witness = JSON.stringify([
40
+ return quotaFields(publication, JSON.stringify([
48
41
  publication.routeId,
49
42
  publication.receipt?.credentialId,
50
43
  publication.receipt?.accountIdentitySource,
51
44
  publication.receipt?.expectedAccountIdentity,
52
- ]);
53
- const add = (key, at, part) => result.set(`${witness}:${key}`, {
54
- at,
55
- order: 0,
56
- publication: { ...publication, observation: part },
57
- });
58
- const keyFor = (scope, label) => JSON.stringify([scope ?? 'all', label]);
59
- const read = new Set();
60
- for (const reading of observation.readings ?? []) {
61
- const key = keyFor(reading.scope, reading.label);
62
- read.add(key);
63
- add(key, observation.checkedAt, {
64
- checkedAt: observation.checkedAt,
65
- readings: [{ ...reading }],
66
- });
67
- }
68
- for (const pair of observation.coverage ?? []) {
69
- const key = keyFor(pair.scope, pair.label);
70
- if (!read.has(key))
71
- add(key, observation.checkedAt, {
72
- checkedAt: observation.checkedAt,
73
- coverage: [{ ...pair }],
74
- });
75
- }
76
- if (observation.budget)
77
- add('budget', observation.checkedAt, {
78
- checkedAt: observation.checkedAt,
79
- budget: { ...observation.budget },
80
- });
81
- for (const [name, counter] of Object.entries(observation.counters ?? {})) {
82
- add(`counter:${name}`, counter.checkedAt, {
83
- checkedAt: observation.checkedAt,
84
- counters: { [name]: { ...counter } },
85
- });
86
- }
87
- if (observation.credits)
88
- add('credits', observation.credits.checkedAt, {
89
- checkedAt: observation.checkedAt,
90
- credits: { ...observation.credits },
91
- });
92
- // Even an empty observation can bind an account proved by its receipt.
93
- if (!result.size)
94
- add('empty', observation.checkedAt, { checkedAt: observation.checkedAt });
95
- return result;
45
+ ]));
96
46
  }
97
47
  /** Enqueue without filesystem work; each quota field retains its own receipt fence. */
98
48
  export function enqueueVaultQuota(path, publication) {
@@ -119,6 +119,37 @@ export declare function mutateVaultRoster<T>(path: string, change: (current: Vau
119
119
  export declare function declineVaultRoute(path: string, routeId: string): Promise<undefined>;
120
120
  /** Lift the user's decline for a vault account and every alias of it. */
121
121
  export declare function acceptVaultRoute(path: string, routeId: string): Promise<undefined>;
122
+ /** Options of `reorderVaultRoster`. */
123
+ export interface ReorderVaultRosterOptions {
124
+ /** Aborts the wait for the roster's write lock. */
125
+ signal?: AbortSignal;
126
+ }
127
+ export interface ReorderVaultRosterResult {
128
+ /** The route id order now on disk. */
129
+ ids: string[];
130
+ /** `unchanged` when the roster was already in this order; nothing was written. */
131
+ outcome: 'reordered' | 'unchanged';
132
+ }
133
+ /**
134
+ * Set the order vault accounts are tried in. Routing reads that order from
135
+ * the roster's row order (`vaultRoutingRows`), and a later discovery keeps
136
+ * each account at its position, so the order lasts until the next reorder.
137
+ * The order is this host's routing preference: the vault has no order of its
138
+ * own, and this never contacts it.
139
+ *
140
+ * `routeIds` must name every roster route id exactly once; anything else
141
+ * (an unknown, missing or repeated id) refuses with `invalid-order` and
142
+ * writes nothing. It runs under the roster's write lock, like every other
143
+ * roster write, so a quota reading or decline committed meanwhile is kept.
144
+ * Each row is kept as the same object, so only the positions change: every
145
+ * row's fields and the rest of the file stay as they were. An order equal to
146
+ * the current one writes nothing. A host with no roster file yet has no
147
+ * routes, so only the empty order is accepted.
148
+ *
149
+ * A `ClaustrumConsumer` in the same process does not see the new order until
150
+ * it re-reads the file: call `consumer.reorder` instead to update both.
151
+ */
152
+ export declare function reorderVaultRoster(path: string, routeIds: readonly string[], options?: ReorderVaultRosterOptions): Promise<ReorderVaultRosterResult>;
122
153
  /**
123
154
  * The receipt fields a quota or profile observation must carry to say which
124
155
  * send (credential and account) it came from. Pass the
@@ -378,6 +378,78 @@ export function acceptVaultRoute(path, routeId) {
378
378
  };
379
379
  });
380
380
  }
381
+ function invalidOrder(message) {
382
+ return new ClaustrumConsumerError('invalid-order', message);
383
+ }
384
+ /**
385
+ * Why `routeIds` is not an order of these rows: it must name every distinct
386
+ * route id exactly once and nothing else. The message quotes only ids the
387
+ * caller supplied; route ids it left out are counted, not named.
388
+ */
389
+ function vaultOrderProblem(rows, routeIds) {
390
+ if (!Array.isArray(routeIds))
391
+ return 'route ids must be an array of route ids';
392
+ const rosterIds = new Set(rows.map((row) => row.routeId));
393
+ const given = new Set();
394
+ for (const id of routeIds) {
395
+ if (typeof id !== 'string')
396
+ return 'route ids must be an array of route ids';
397
+ if (given.has(id))
398
+ return `route id ${id} appears more than once`;
399
+ if (!rosterIds.has(id))
400
+ return `route id ${id} is not in the roster`;
401
+ given.add(id);
402
+ }
403
+ const missing = [...rosterIds].filter((id) => !given.has(id)).length;
404
+ if (missing > 0)
405
+ return `the order leaves out ${missing} roster route id${missing === 1 ? '' : 's'}`;
406
+ return undefined;
407
+ }
408
+ /**
409
+ * Set the order vault accounts are tried in. Routing reads that order from
410
+ * the roster's row order (`vaultRoutingRows`), and a later discovery keeps
411
+ * each account at its position, so the order lasts until the next reorder.
412
+ * The order is this host's routing preference: the vault has no order of its
413
+ * own, and this never contacts it.
414
+ *
415
+ * `routeIds` must name every roster route id exactly once; anything else
416
+ * (an unknown, missing or repeated id) refuses with `invalid-order` and
417
+ * writes nothing. It runs under the roster's write lock, like every other
418
+ * roster write, so a quota reading or decline committed meanwhile is kept.
419
+ * Each row is kept as the same object, so only the positions change: every
420
+ * row's fields and the rest of the file stay as they were. An order equal to
421
+ * the current one writes nothing. A host with no roster file yet has no
422
+ * routes, so only the empty order is accepted.
423
+ *
424
+ * A `ClaustrumConsumer` in the same process does not see the new order until
425
+ * it re-reads the file: call `consumer.reorder` instead to update both.
426
+ */
427
+ export function reorderVaultRoster(path, routeIds, options = {}) {
428
+ return mutateVaultRoster(path, (current) => {
429
+ const rows = current?.rows ?? [];
430
+ const problem = vaultOrderProblem(rows, routeIds);
431
+ if (problem)
432
+ throw invalidOrder(problem);
433
+ // Group by route id so a hand-edited file that repeats one keeps every
434
+ // copy: the later copies travel right after the first.
435
+ const byId = new Map();
436
+ for (const row of rows) {
437
+ const group = byId.get(row.routeId);
438
+ if (group)
439
+ group.push(row);
440
+ else
441
+ byId.set(row.routeId, [row]);
442
+ }
443
+ const ids = [...routeIds];
444
+ const next = ids.flatMap((id) => byId.get(id) ?? []);
445
+ if (!current || next.every((row, index) => row === rows[index]))
446
+ return { result: { ids, outcome: 'unchanged' } };
447
+ return {
448
+ next: { ...current, rows: next },
449
+ result: { ids, outcome: 'reordered' },
450
+ };
451
+ }, { ...(options.signal && { signal: options.signal }) });
452
+ }
381
453
  /**
382
454
  * What a receipt may do to a row's quota: `hold` (the row holds the receipt's
383
455
  * credential and account), `bind` (the row has never had a known account and
@@ -48,6 +48,43 @@ export interface RoutingSectionOptions {
48
48
  */
49
49
  orderedVariants?: MenuChoice[];
50
50
  formerMainId?: string;
51
+ /**
52
+ * The vault accounts' routing order, for a plugin that can run in vault
53
+ * mode. Called on each build; return the order while the plugin routes
54
+ * through vault accounts and undefined otherwise. While it returns one, the
55
+ * section shows and sets the vault accounts' order (by the name the menu
56
+ * shows for each account) instead of the pool roster's. Wire it to
57
+ * `ClaustrumConsumer.snapshot()` and `ClaustrumConsumer.reorder`, or to
58
+ * `readVaultRoster` and `reorderVaultRoster` for a plugin without a
59
+ * consumer.
60
+ */
61
+ vaultOrder?: () => VaultRoutingOrder | undefined | Promise<VaultRoutingOrder | undefined>;
62
+ }
63
+ /**
64
+ * The order vault accounts are tried in, as the Routing section reads and
65
+ * sets it in vault mode. Shaped after `/claustrum`'s roster, without
66
+ * importing it, so the menu does not need the vault client.
67
+ */
68
+ export interface VaultRoutingOrder {
69
+ /**
70
+ * Every vault roster row, in roster (routing) order: its route id and the
71
+ * name the plugin shows for that account (the roster row's `label`, or its
72
+ * email). Route ids are long and opaque, so the section shows and accepts
73
+ * labels; a route id is still accepted wherever a label is.
74
+ */
75
+ rows: readonly {
76
+ id: string;
77
+ label: string;
78
+ }[];
79
+ /**
80
+ * Sets the order. `ids` are route ids, every one exactly once. Wire it to
81
+ * `ClaustrumConsumer.reorder` or `reorderVaultRoster`, which refuse any
82
+ * other list without writing.
83
+ */
84
+ reorder(ids: readonly string[]): Promise<{
85
+ ids: readonly string[];
86
+ outcome: 'reordered' | 'unchanged';
87
+ }>;
51
88
  }
52
89
  export interface LimitsSectionOptions {
53
90
  /**