@cortexkit/antigravity-auth-core 3.0.10 → 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 (42) hide show
  1. package/dist/agy-transport.d.ts.map +1 -1
  2. package/dist/agy-transport.js +4 -0
  3. package/dist/agy-transport.js.map +1 -1
  4. package/dist/common-auth-embedded/claustrum/consumer.d.ts +7 -1
  5. package/dist/common-auth-embedded/claustrum/consumer.js +17 -2
  6. package/dist/common-auth-embedded/claustrum/enrollment.d.ts +5 -0
  7. package/dist/common-auth-embedded/claustrum/enrollment.js +27 -0
  8. package/dist/common-auth-embedded/claustrum/errors.d.ts +1 -1
  9. package/dist/common-auth-embedded/claustrum/index.d.ts +1 -1
  10. package/dist/common-auth-embedded/claustrum/index.js +1 -1
  11. package/dist/common-auth-embedded/claustrum/quota-writer.js +4 -54
  12. package/dist/common-auth-embedded/claustrum/roster.d.ts +31 -0
  13. package/dist/common-auth-embedded/claustrum/roster.js +72 -0
  14. package/dist/common-auth-embedded/commands/builtins.d.ts +37 -0
  15. package/dist/common-auth-embedded/commands/builtins.js +95 -13
  16. package/dist/common-auth-embedded/commands/index.d.ts +1 -1
  17. package/dist/common-auth-embedded/fs/private-files.d.ts +2 -0
  18. package/dist/common-auth-embedded/fs/private-files.js +49 -3
  19. package/dist/common-auth-embedded/quota/pending.js +48 -0
  20. package/dist/common-auth-embedded/source-output.json +86 -70
  21. package/dist/common-auth-embedded/store/attribution.d.ts +5 -0
  22. package/dist/common-auth-embedded/store/attribution.js +39 -25
  23. package/dist/common-auth-embedded/store/pool.d.ts +17 -0
  24. package/dist/common-auth-embedded/store/pool.js +18 -3
  25. package/dist/common-auth-embedded/store/pull.js +3 -1
  26. package/dist/common-auth-embedded/store/quota-writer.js +298 -0
  27. package/dist/common-auth-embedded/store/runtime.d.ts +2 -0
  28. package/dist/pre-response-deadline.d.ts.map +1 -1
  29. package/dist/pre-response-deadline.js +6 -5
  30. package/dist/pre-response-deadline.js.map +1 -1
  31. package/dist/quota-manager.d.ts +3 -3
  32. package/dist/quota-manager.d.ts.map +1 -1
  33. package/dist/quota-manager.js +59 -36
  34. package/dist/quota-manager.js.map +1 -1
  35. package/dist/transform/gemini.d.ts.map +1 -1
  36. package/dist/transform/gemini.js +12 -0
  37. package/dist/transform/gemini.js.map +1 -1
  38. package/dist/vault-enrollment-authority.d.ts +2 -0
  39. package/dist/vault-enrollment-authority.d.ts.map +1 -1
  40. package/dist/vault-enrollment-authority.js +2 -0
  41. package/dist/vault-enrollment-authority.js.map +1 -1
  42. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  // the same locks as any other writer of those files.
5
5
  import { formatQuota, isQuotaMap, projectQuota, quotaWindowName, } from '../quota/index.js';
6
6
  import { DEFAULT_FORMER_MAIN_ID, orderForPlacement, resolveRoutingMode, } from '../routing/index.js';
7
- import { projectFailure, } from './seam.js';
7
+ import { CommandError, projectFailure, } from './seam.js';
8
8
  /** `disabledReason` recorded when the user disables an account from the menu. */
9
9
  export const MENU_DISABLED_REASON = 'disabled from the command menu';
10
10
  function isRecord(value) {
@@ -65,13 +65,16 @@ function addedText(name, result) {
65
65
  function failureMessage(error) {
66
66
  return projectFailure(error).text;
67
67
  }
68
- async function snapshot(store) {
68
+ async function snapshot(options) {
69
+ const { store } = options;
69
70
  const load = await store.read();
70
71
  const read = await store.readSettings();
72
+ const vault = await options.routing?.vaultOrder?.();
71
73
  return {
72
74
  load,
73
75
  rows: distinctRows(load),
74
76
  settings: read.status === 'error' ? {} : read.settings,
77
+ ...(vault ? { vault } : {}),
75
78
  };
76
79
  }
77
80
  function accountView(row, options) {
@@ -323,6 +326,73 @@ function quotaSection(options, snap) {
323
326
  },
324
327
  };
325
328
  }
329
+ /**
330
+ * Sets the vault order. The roster's own refusal of the list (`invalid-order`:
331
+ * an account left out, which it counts without naming) is shown with its own
332
+ * message; any other failure is projected as usual. The kind is read from
333
+ * the error object so the menu does not import the vault client.
334
+ */
335
+ async function reorderVault(vault, order) {
336
+ try {
337
+ return await vault.reorder(order);
338
+ }
339
+ catch (error) {
340
+ if (error instanceof Error &&
341
+ error.name === 'ClaustrumConsumerError' &&
342
+ error.kind === 'invalid-order')
343
+ throw new CommandError('vault-invalid-order', error.message, {
344
+ cause: error,
345
+ });
346
+ throw error;
347
+ }
348
+ }
349
+ function invalidVaultOrder(message) {
350
+ return new CommandError('vault-invalid-order', message);
351
+ }
352
+ /**
353
+ * How the Routing section names vault accounts: by label, since route ids
354
+ * are long and opaque. A typed entry may be a label or a route id, and must
355
+ * name exactly one account. Refusals quote only the entry the user typed.
356
+ */
357
+ function vaultNames(vault) {
358
+ const rows = vault.rows.map((row) => ({
359
+ id: row.id,
360
+ label: row.label.trim() || row.id,
361
+ }));
362
+ const matches = (entry) => rows.filter((row) => row.id === entry || row.label === entry);
363
+ return {
364
+ ids: rows.map((row) => row.id),
365
+ nameOf: (id) => rows.find((row) => row.id === id)?.label ?? id,
366
+ /**
367
+ * What the order input starts with for an account: its label when
368
+ * typing that label back names this account alone, else its route id
369
+ * (two accounts sharing a label, or a label with a comma or line break
370
+ * in it, either of which would split it into two entries).
371
+ */
372
+ entryOf: (id) => {
373
+ const row = rows.find((entry) => entry.id === id);
374
+ return row && !/[,\n]/.test(row.label) && matches(row.label).length === 1
375
+ ? row.label
376
+ : id;
377
+ },
378
+ /** The route ids the typed entries name, in order; refuses before any write. */
379
+ resolve: (entries) => {
380
+ const ids = [];
381
+ for (const entry of entries) {
382
+ const found = matches(entry);
383
+ if (found.length === 0)
384
+ throw invalidVaultOrder(`"${entry}" is not a vault account.`);
385
+ if (found.length > 1)
386
+ throw invalidVaultOrder(`"${entry}" matches more than one vault account; enter those accounts by route id.`);
387
+ const id = found[0].id;
388
+ if (ids.includes(id))
389
+ throw invalidVaultOrder(`"${entry}" names an account already in the order.`);
390
+ ids.push(id);
391
+ }
392
+ return ids;
393
+ },
394
+ };
395
+ }
326
396
  function routingSection(options, snap) {
327
397
  const { store, extraLocks } = options;
328
398
  const locks = extraLocks ? { extraLocks } : {};
@@ -336,14 +406,18 @@ function routingSection(options, snap) {
336
406
  ? raw
337
407
  : 'ordered';
338
408
  const resolved = resolveRoutingMode(current);
339
- const ids = snap.rows.map((row) => row.id);
409
+ // In vault mode routing tries the vault accounts, so their order is the
410
+ // one shown and set here; the pool roster's order is not used.
411
+ const vault = snap.vault ? vaultNames(snap.vault) : undefined;
412
+ const ids = vault ? vault.ids : snap.rows.map((row) => row.id);
413
+ const nameOf = (id) => (vault ? vault.nameOf(id) : id);
340
414
  const tried = orderForPlacement(ids, resolved.placement, options.routing?.formerMainId ?? DEFAULT_FORMER_MAIN_ID);
341
415
  const label = choices.find((choice) => choice.value === current)?.label ?? current;
342
416
  const lines = [`Mode: ${label}`];
343
417
  if (ids.length > 0)
344
- lines.push(`Roster order: ${ids.join(', ')}`);
418
+ lines.push(`${vault ? 'Vault account order' : 'Roster order'}: ${ids.map(nameOf).join(', ')}`);
345
419
  if (resolved.mode === 'ordered' && tried.join() !== ids.join())
346
- lines.push(`Tried in order: ${tried.join(', ')}`);
420
+ lines.push(`Tried in order: ${tried.map(nameOf).join(', ')}`);
347
421
  const actions = [
348
422
  {
349
423
  id: 'mode',
@@ -371,19 +445,27 @@ function routingSection(options, snap) {
371
445
  {
372
446
  kind: 'text',
373
447
  id: 'order',
374
- label: 'Account ids, first to last',
375
- value: ids.join(', '),
448
+ label: vault
449
+ ? 'Vault accounts, first to last, separated by commas'
450
+ : 'Account ids, first to last',
451
+ value: vault ? ids.map(vault.entryOf).join(', ') : ids.join(', '),
376
452
  required: true,
377
453
  },
378
454
  ],
379
455
  run: async ({ values }) => {
380
- const order = String(values.order)
381
- .split(/[\s,]+/)
382
- .filter((id) => id.length > 0);
383
- const result = await store.reorder(order, locks);
456
+ const text = String(values.order);
457
+ // A vault label may contain spaces, so vault entries are separated by
458
+ // commas or line breaks, not spaces; pool ids never contain spaces.
459
+ const entries = text
460
+ .split(vault ? /[,\n]+/ : /[\s,]+/)
461
+ .map((entry) => entry.trim())
462
+ .filter((entry) => entry.length > 0);
463
+ const result = snap.vault && vault
464
+ ? await reorderVault(snap.vault, vault.resolve(entries))
465
+ : await store.reorder(entries, locks);
384
466
  return result.outcome === 'unchanged'
385
467
  ? 'The order is unchanged.'
386
- : `Order set to ${result.ids.join(', ')}.`;
468
+ : `Order set to ${result.ids.map(nameOf).join(', ')}.`;
387
469
  },
388
470
  });
389
471
  return {
@@ -524,7 +606,7 @@ function limitsSection(options, snap) {
524
606
  }
525
607
  /** The four built-in sections, in their fixed order, from one read of the store. */
526
608
  export async function builtinSections(options) {
527
- const snap = await snapshot(options.store);
609
+ const snap = await snapshot(options);
528
610
  return [
529
611
  accountsSection(options, snap),
530
612
  quotaSection(options, snap),
@@ -1,4 +1,4 @@
1
- export type { AccountsSectionOptions, LimitsSectionOptions, LoginOutcome, QuotaSectionOptions, RoutingSectionOptions, } from './builtins.js';
1
+ export type { AccountsSectionOptions, LimitsSectionOptions, LoginOutcome, QuotaSectionOptions, RoutingSectionOptions, VaultRoutingOrder, } from './builtins.js';
2
2
  export { MENU_DISABLED_REASON } from './builtins.js';
3
3
  export type { CommandMenu, CommandMenuOptions, StoreSectionSlot, } from './menu.js';
4
4
  export { createCommandMenu, parseApplyRequest } from './menu.js';
@@ -5,6 +5,8 @@ type Backend = typeof import('@cortexkit/private-files');
5
5
  type Kind = 'file' | 'directory';
6
6
  /** Tests inject a backend here; production always imports the private-files package. */
7
7
  export declare function setPrivateFilesBackendForTest(api?: Backend): void;
8
+ /** The fixed `reason` of a refusal because the Windows native addon did not load. */
9
+ export declare const PRIVATE_FILES_UNAVAILABLE_REASON = "native-addon-unavailable";
8
10
  export declare class PrivateFileError extends Error {
9
11
  readonly path: string;
10
12
  readonly stage: string;
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { lstat, readFile, rename, unlink } from 'node:fs/promises';
3
- import { dirname, resolve } from 'node:path';
3
+ import { tmpdir } from 'node:os';
4
+ import { dirname, join, resolve } from 'node:path';
4
5
  export const windowsPrivateFiles = process.platform === 'win32';
5
6
  const migrationNotices = new Set();
6
7
  function ioCode(detail) {
@@ -20,8 +21,51 @@ let backend;
20
21
  export function setPrivateFilesBackendForTest(api) {
21
22
  backend = api ? Promise.resolve(api) : undefined;
22
23
  }
24
+ /** The fixed `reason` of a refusal because the Windows native addon did not load. */
25
+ export const PRIVATE_FILES_UNAVAILABLE_REASON = 'native-addon-unavailable';
26
+ function privateFilesUnavailable(cause) {
27
+ return Object.assign(new Error('Windows private-files native addon is unavailable', { cause }), {
28
+ code: 'ERR_PRIVATE_FILES_UNAVAILABLE',
29
+ reason: PRIVATE_FILES_UNAVAILABLE_REASON,
30
+ });
31
+ }
32
+ function isUnavailable(api, error) {
33
+ return (error instanceof api.PrivateFilesUnavailableError ||
34
+ error?.code ===
35
+ 'ERR_PRIVATE_FILES_UNAVAILABLE');
36
+ }
37
+ /**
38
+ * Importing @cortexkit/private-files succeeds even when its Windows addon
39
+ * cannot load: the package loads the addon on first use, and some of its
40
+ * checks then report the failure as an ordinary refusal such as
41
+ * `unsupported-filesystem`. So prove the addon loads before handing the
42
+ * package out. Verifying a path that does not exist loads the addon first and
43
+ * then fails harmlessly; only the package's own "unavailable" error means the
44
+ * addon is missing.
45
+ */
46
+ async function assertNativeAddonLoads(api) {
47
+ try {
48
+ await api.verifyPrivatePath(join(tmpdir(), `.common-auth-private-files-probe-${randomUUID()}`), 'file');
49
+ }
50
+ catch (error) {
51
+ if (isUnavailable(api, error))
52
+ throw privateFilesUnavailable(error);
53
+ }
54
+ }
55
+ /**
56
+ * Load the package once per process. On Windows a failed import or addon load
57
+ * is kept, so every later private-file operation refuses at once with
58
+ * ERR_PRIVATE_FILES_UNAVAILABLE. There is no fallback to permission bits:
59
+ * they do not protect files on Windows.
60
+ */
23
61
  function loadBackend() {
24
- backend ??= import('@cortexkit/private-files');
62
+ backend ??= import('@cortexkit/private-files').then(async (api) => {
63
+ if (windowsPrivateFiles)
64
+ await assertNativeAddonLoads(api);
65
+ return api;
66
+ }, (cause) => {
67
+ throw windowsPrivateFiles ? privateFilesUnavailable(cause) : cause;
68
+ });
25
69
  return backend;
26
70
  }
27
71
  export class PrivateFileError extends Error {
@@ -38,7 +82,9 @@ export class PrivateFileError extends Error {
38
82
  orphanPath;
39
83
  constructor(path, stage, cause) {
40
84
  const detail = cause;
41
- super(`Private file refused at ${stage}: ${path} (${detail?.reason ?? detail?.code ?? 'io-error'}). Use a safe parent directory. Repair only a named secret file in safe ancestry whose owner the published policy trusts, without changing its owner or any existing directory. Previously exposed credentials may need rotation. Windows requires the private-files native prebuild and an ACL-persisting local filesystem such as NTFS.`, { cause });
85
+ super(detail?.code === 'ERR_PRIVATE_FILES_UNAVAILABLE'
86
+ ? `Private file refused at ${stage}: ${path} (${PRIVATE_FILES_UNAVAILABLE_REASON}). The Windows native addon of @cortexkit/private-files could not be loaded, so owner-only access cannot be enforced and nothing was read or written. Reinstall the plugin so the private-files Windows prebuild for this architecture is present; Windows has no safe fallback to permission bits.`
87
+ : `Private file refused at ${stage}: ${path} (${detail?.reason ?? detail?.code ?? 'io-error'}). Keep this file in a folder that only you, the system or administrators can change, such as a folder in your home directory. If other users could read the file before, sign in again to replace the credentials it held. On Windows the file must also be on a local drive that keeps Windows file permissions, such as NTFS.`, { cause });
42
88
  this.path = path;
43
89
  this.stage = stage;
44
90
  this.name = 'PrivateFileError';
@@ -0,0 +1,48 @@
1
+ // Use the same independently dated parts as mergeQuotaObservation. A header
2
+ // reading cannot erase a poll-only window, counter, credits record or budget.
3
+ export function quotaFields(publication, witness = '') {
4
+ const result = new Map();
5
+ const { observation } = publication;
6
+ const add = (key, at, part) => result.set(`${witness}:${key}`, {
7
+ at,
8
+ order: 0,
9
+ publication: { ...publication, observation: part },
10
+ });
11
+ const keyFor = (scope, label) => JSON.stringify([scope ?? 'all', label]);
12
+ const read = new Set();
13
+ for (const reading of observation.readings ?? []) {
14
+ const key = keyFor(reading.scope, reading.label);
15
+ read.add(key);
16
+ add(key, observation.checkedAt, {
17
+ checkedAt: observation.checkedAt,
18
+ readings: [{ ...reading }],
19
+ });
20
+ }
21
+ for (const pair of observation.coverage ?? []) {
22
+ const key = keyFor(pair.scope, pair.label);
23
+ if (!read.has(key))
24
+ add(key, observation.checkedAt, {
25
+ checkedAt: observation.checkedAt,
26
+ coverage: [{ ...pair }],
27
+ });
28
+ }
29
+ if (observation.budget)
30
+ add('budget', observation.checkedAt, {
31
+ checkedAt: observation.checkedAt,
32
+ budget: { ...observation.budget },
33
+ });
34
+ for (const [name, counter] of Object.entries(observation.counters ?? {})) {
35
+ add(`counter:${name}`, counter.checkedAt, {
36
+ checkedAt: observation.checkedAt,
37
+ counters: { [name]: { ...counter } },
38
+ });
39
+ }
40
+ if (observation.credits)
41
+ add('credits', observation.credits.checkedAt, {
42
+ checkedAt: observation.checkedAt,
43
+ credits: { ...observation.credits },
44
+ });
45
+ if (!result.size)
46
+ add('empty', observation.checkedAt, { checkedAt: observation.checkedAt });
47
+ return result;
48
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@cortexkit/common-auth",
4
- "version": "0.23.0",
4
+ "version": "0.26.0",
5
5
  "artifactStatus": "published",
6
6
  "publicRoots": {
7
7
  "./store": {
@@ -37,15 +37,15 @@
37
37
  "import": "./dist/pi-slot/index.js"
38
38
  }
39
39
  },
40
- "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.23.0.tgz",
41
- "tarballSha256": "8a2cd4a5df7c056c4f815c8cd59b109ceb02135eb7b7b0e14a1b3d9891af2cfb",
42
- "sri": "sha512-WwCjPwOhbZBomCAPxEooCiSDgvcaIsEn5yjTqmEy0PU0ZJUKSr3cE8Il0AsW7xU2h2Wo267rsciZhV3rPlUPCA==",
43
- "canonicalFiles": 139,
44
- "canonicalBytes": 857682,
40
+ "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.26.0.tgz",
41
+ "tarballSha256": "a5a6cb7051ee8c45e86e19cf7a918d0e28ce1b6a80301e982efbc7bb4b98208d",
42
+ "sri": "sha512-qTmQ9aMG+HcyDbhKie8Nq9wxKMRQ6GXH2hKq8Fab9kHqFfzswdp2NpXofGY52RhQ2VxuyMOQr5T6lUrkbny5VQ==",
43
+ "canonicalFiles": 141,
44
+ "canonicalBytes": 888503,
45
45
  "generator": {
46
46
  "path": "packages/opencode/scripts/embed-common-auth.ts",
47
47
  "version": 3,
48
- "sha256": "886385f4eedd9fcd82bcb3e7751e0c7193fbb6c59238fa35be82909635955dbf"
48
+ "sha256": "89dbeb07d77e0657abeb72a40fcc03a900e98292956865252349a01a15999ed0"
49
49
  },
50
50
  "files": [
51
51
  {
@@ -227,17 +227,17 @@
227
227
  {
228
228
  "source": "package/dist/claustrum/consumer.d.ts",
229
229
  "output": "claustrum/consumer.d.ts",
230
- "bytes": 9548,
231
- "sourceSha256": "150eac9038881740a78e5664501a6ef0aa5e177a6dd46854cbeaf38513463e90",
232
- "outputSha256": "150eac9038881740a78e5664501a6ef0aa5e177a6dd46854cbeaf38513463e90",
230
+ "bytes": 9907,
231
+ "sourceSha256": "8001ce3f928af1bc9124223071eb9c85ea3273436cd7be073c588217f942b248",
232
+ "outputSha256": "8001ce3f928af1bc9124223071eb9c85ea3273436cd7be073c588217f942b248",
233
233
  "transform": "verbatim"
234
234
  },
235
235
  {
236
236
  "source": "package/dist/claustrum/consumer.js",
237
237
  "output": "claustrum/consumer.js",
238
- "bytes": 25698,
239
- "sourceSha256": "ec47dc016bf4d95655c17093a78d9c214b623214c821d352f73ea60f830c0d83",
240
- "outputSha256": "ec47dc016bf4d95655c17093a78d9c214b623214c821d352f73ea60f830c0d83",
238
+ "bytes": 26470,
239
+ "sourceSha256": "b2087accd6e8759fb49173dc744243ed703520d5011386ef514672be8fe79fbe",
240
+ "outputSha256": "b2087accd6e8759fb49173dc744243ed703520d5011386ef514672be8fe79fbe",
241
241
  "transform": "verbatim"
242
242
  },
243
243
  {
@@ -259,25 +259,25 @@
259
259
  {
260
260
  "source": "package/dist/claustrum/enrollment.d.ts",
261
261
  "output": "claustrum/enrollment.d.ts",
262
- "bytes": 7743,
263
- "sourceSha256": "7503e56a09f94e77a94a7ae15fd616f149ec9f675ec7c79bdea4a014ca014143",
264
- "outputSha256": "7503e56a09f94e77a94a7ae15fd616f149ec9f675ec7c79bdea4a014ca014143",
262
+ "bytes": 7976,
263
+ "sourceSha256": "d6b4e8561ccc0ff2f9b4386856c5fe3dc7c475e13f98314a0666d0b20458d43b",
264
+ "outputSha256": "d6b4e8561ccc0ff2f9b4386856c5fe3dc7c475e13f98314a0666d0b20458d43b",
265
265
  "transform": "verbatim"
266
266
  },
267
267
  {
268
268
  "source": "package/dist/claustrum/enrollment.js",
269
269
  "output": "claustrum/enrollment.js",
270
- "bytes": 33520,
271
- "sourceSha256": "eeac604495c093503007478ab803c05b6e0bce8bf281f8bf9bbfee44c8ff85f1",
272
- "outputSha256": "eeac604495c093503007478ab803c05b6e0bce8bf281f8bf9bbfee44c8ff85f1",
270
+ "bytes": 35060,
271
+ "sourceSha256": "a9ca3a23778cc86ab9798051ba19dcb3b2b8e3dc4c4fda356cbd56eca50097db",
272
+ "outputSha256": "a9ca3a23778cc86ab9798051ba19dcb3b2b8e3dc4c4fda356cbd56eca50097db",
273
273
  "transform": "verbatim"
274
274
  },
275
275
  {
276
276
  "source": "package/dist/claustrum/errors.d.ts",
277
277
  "output": "claustrum/errors.d.ts",
278
- "bytes": 1145,
279
- "sourceSha256": "b7533d4c281807224d6d05f4bb7a596006862a6c05dc4462fae02af388054bce",
280
- "outputSha256": "b7533d4c281807224d6d05f4bb7a596006862a6c05dc4462fae02af388054bce",
278
+ "bytes": 1163,
279
+ "sourceSha256": "a6e5ec8be3ae7160b78456e642b440494604c2e2cdc987550744521dc873fb40",
280
+ "outputSha256": "a6e5ec8be3ae7160b78456e642b440494604c2e2cdc987550744521dc873fb40",
281
281
  "transform": "verbatim"
282
282
  },
283
283
  {
@@ -307,17 +307,17 @@
307
307
  {
308
308
  "source": "package/dist/claustrum/index.d.ts",
309
309
  "output": "claustrum/index.d.ts",
310
- "bytes": 3761,
311
- "sourceSha256": "f2c1b8d99048666c068805b08b430492b2632be08e2beda466ee56b871572847",
312
- "outputSha256": "f2c1b8d99048666c068805b08b430492b2632be08e2beda466ee56b871572847",
310
+ "bytes": 3844,
311
+ "sourceSha256": "36c0b94c5e18972463f48bfd7e1506d9655372aa8df065786b3a47d199cdb5e0",
312
+ "outputSha256": "36c0b94c5e18972463f48bfd7e1506d9655372aa8df065786b3a47d199cdb5e0",
313
313
  "transform": "verbatim"
314
314
  },
315
315
  {
316
316
  "source": "package/dist/claustrum/index.js",
317
317
  "output": "claustrum/index.js",
318
- "bytes": 2509,
319
- "sourceSha256": "5f8b4bebfc2dec055b69769adcd1ce48ad7acc2c26256edbe4a2e984dc788147",
320
- "outputSha256": "5f8b4bebfc2dec055b69769adcd1ce48ad7acc2c26256edbe4a2e984dc788147",
318
+ "bytes": 2529,
319
+ "sourceSha256": "42c9e67bb5ec6749de488933a56fb3ee253c3b9e3588d692f171d87c59bcbd89",
320
+ "outputSha256": "42c9e67bb5ec6749de488933a56fb3ee253c3b9e3588d692f171d87c59bcbd89",
321
321
  "transform": "verbatim"
322
322
  },
323
323
  {
@@ -363,25 +363,25 @@
363
363
  {
364
364
  "source": "package/dist/claustrum/quota-writer.js",
365
365
  "output": "claustrum/quota-writer.js",
366
- "bytes": 9694,
367
- "sourceSha256": "5a7d5d1059dcadc06aa41e81e0707cc444636473822047f0ec72da7589c770f1",
368
- "outputSha256": "5a7d5d1059dcadc06aa41e81e0707cc444636473822047f0ec72da7589c770f1",
366
+ "bytes": 7579,
367
+ "sourceSha256": "0054a12ca94aab2eecf50f9b5e090879ff184e7f286cc979f32d311e22011906",
368
+ "outputSha256": "0054a12ca94aab2eecf50f9b5e090879ff184e7f286cc979f32d311e22011906",
369
369
  "transform": "verbatim"
370
370
  },
371
371
  {
372
372
  "source": "package/dist/claustrum/roster.d.ts",
373
373
  "output": "claustrum/roster.d.ts",
374
- "bytes": 10931,
375
- "sourceSha256": "c394bc08c7cce4dc68fd539ac03cb200727534693600c7daf5ba7c9c4d0618ce",
376
- "outputSha256": "c394bc08c7cce4dc68fd539ac03cb200727534693600c7daf5ba7c9c4d0618ce",
374
+ "bytes": 12574,
375
+ "sourceSha256": "c9ab3a89e04f72de09c5f15ccf1436b91f8a245e2253f24ec5998120058aebe7",
376
+ "outputSha256": "c9ab3a89e04f72de09c5f15ccf1436b91f8a245e2253f24ec5998120058aebe7",
377
377
  "transform": "verbatim"
378
378
  },
379
379
  {
380
380
  "source": "package/dist/claustrum/roster.js",
381
381
  "output": "claustrum/roster.js",
382
- "bytes": 27602,
383
- "sourceSha256": "45ed2d4e69fad154ce86f5ff4f839c2ae9269dd9146ce7a8b2e5b6f49476ddf8",
384
- "outputSha256": "45ed2d4e69fad154ce86f5ff4f839c2ae9269dd9146ce7a8b2e5b6f49476ddf8",
382
+ "bytes": 30876,
383
+ "sourceSha256": "d02184fd4d32aa8917369919edea4c44328e7332e30f3ddc41ce350e5fd1df07",
384
+ "outputSha256": "d02184fd4d32aa8917369919edea4c44328e7332e30f3ddc41ce350e5fd1df07",
385
385
  "transform": "verbatim"
386
386
  },
387
387
  {
@@ -403,25 +403,25 @@
403
403
  {
404
404
  "source": "package/dist/commands/builtins.d.ts",
405
405
  "output": "commands/builtins.d.ts",
406
- "bytes": 2931,
407
- "sourceSha256": "b70028ea58b51d344e83ac62f36fa95499ab32af753e657ade8116491488bab9",
408
- "outputSha256": "b70028ea58b51d344e83ac62f36fa95499ab32af753e657ade8116491488bab9",
406
+ "bytes": 4576,
407
+ "sourceSha256": "5ab6cbab696c91fef0fc7288d4b82803cd0bac809b68f939d73671505fc1d894",
408
+ "outputSha256": "5ab6cbab696c91fef0fc7288d4b82803cd0bac809b68f939d73671505fc1d894",
409
409
  "transform": "verbatim"
410
410
  },
411
411
  {
412
412
  "source": "package/dist/commands/builtins.js",
413
413
  "output": "commands/builtins.js",
414
- "bytes": 21323,
415
- "sourceSha256": "9b3461ace8a585dde5eff3f9b709ddc766ab3d77e680b687499efd1871a341ce",
416
- "outputSha256": "9b3461ace8a585dde5eff3f9b709ddc766ab3d77e680b687499efd1871a341ce",
414
+ "bytes": 25155,
415
+ "sourceSha256": "c5f7fca0e36dc2f3253b88e7600d3dbed6a193d2b8abbf07d16913b6b46551e6",
416
+ "outputSha256": "c5f7fca0e36dc2f3253b88e7600d3dbed6a193d2b8abbf07d16913b6b46551e6",
417
417
  "transform": "verbatim"
418
418
  },
419
419
  {
420
420
  "source": "package/dist/commands/index.d.ts",
421
421
  "output": "commands/index.d.ts",
422
- "bytes": 1081,
423
- "sourceSha256": "cfe14cdf7ae83a3bf37cfc3e4199c8f80e7720b982a0e875064113b1461c2967",
424
- "outputSha256": "cfe14cdf7ae83a3bf37cfc3e4199c8f80e7720b982a0e875064113b1461c2967",
422
+ "bytes": 1100,
423
+ "sourceSha256": "4be7eec728211b7ad707121b1f2bbe2c219574aaa4e1c5be3f8964b185d4377c",
424
+ "outputSha256": "4be7eec728211b7ad707121b1f2bbe2c219574aaa4e1c5be3f8964b185d4377c",
425
425
  "transform": "verbatim"
426
426
  },
427
427
  {
@@ -547,17 +547,17 @@
547
547
  {
548
548
  "source": "package/dist/fs/private-files.d.ts",
549
549
  "output": "fs/private-files.d.ts",
550
- "bytes": 3228,
551
- "sourceSha256": "1882d869cfebb3cebc8b9db47fb15083f8300c51c26c71666e898377fcd9a1ba",
552
- "outputSha256": "1882d869cfebb3cebc8b9db47fb15083f8300c51c26c71666e898377fcd9a1ba",
550
+ "bytes": 3398,
551
+ "sourceSha256": "b344509a32fcd983f09e5814286630a53c8e577ad1b973eabe19f8e58659e8d3",
552
+ "outputSha256": "b344509a32fcd983f09e5814286630a53c8e577ad1b973eabe19f8e58659e8d3",
553
553
  "transform": "verbatim"
554
554
  },
555
555
  {
556
556
  "source": "package/dist/fs/private-files.js",
557
557
  "output": "fs/private-files.js",
558
- "bytes": 12448,
559
- "sourceSha256": "1c8f34202b535d774d8c1a53bd403255f02701760c7378e020756c02c55a97c4",
560
- "outputSha256": "1c8f34202b535d774d8c1a53bd403255f02701760c7378e020756c02c55a97c4",
558
+ "bytes": 14779,
559
+ "sourceSha256": "114c06ce4c0998087878d99c5dc37425e90d5fad205f57fe0bdf9694e3c8e31d",
560
+ "outputSha256": "114c06ce4c0998087878d99c5dc37425e90d5fad205f57fe0bdf9694e3c8e31d",
561
561
  "transform": "verbatim"
562
562
  },
563
563
  {
@@ -776,6 +776,14 @@
776
776
  "outputSha256": "b1d76faf1fb480b97ef1886ce75dbd2156002baedc39249468559cb4eece5bbb",
777
777
  "transform": "verbatim"
778
778
  },
779
+ {
780
+ "source": "package/dist/quota/pending.js",
781
+ "output": "quota/pending.js",
782
+ "bytes": 1876,
783
+ "sourceSha256": "e757a3fa9f8440190668c6154468a5baec8a84e20d6c831a6d7935c3b9bebe29",
784
+ "outputSha256": "e757a3fa9f8440190668c6154468a5baec8a84e20d6c831a6d7935c3b9bebe29",
785
+ "transform": "verbatim"
786
+ },
779
787
  {
780
788
  "source": "package/dist/quota/projection.d.ts",
781
789
  "output": "quota/projection.d.ts",
@@ -875,17 +883,17 @@
875
883
  {
876
884
  "source": "package/dist/store/attribution.d.ts",
877
885
  "output": "store/attribution.d.ts",
878
- "bytes": 1528,
879
- "sourceSha256": "441dba300556a927e872597c1df3e4fbb1ac61c0a3989e98dcd3a94a773b8ed7",
880
- "outputSha256": "441dba300556a927e872597c1df3e4fbb1ac61c0a3989e98dcd3a94a773b8ed7",
886
+ "bytes": 1951,
887
+ "sourceSha256": "16919a55fe944b459ff511c125ac2ba34714949d38db006c8ab047dd48ab51a6",
888
+ "outputSha256": "16919a55fe944b459ff511c125ac2ba34714949d38db006c8ab047dd48ab51a6",
881
889
  "transform": "verbatim"
882
890
  },
883
891
  {
884
892
  "source": "package/dist/store/attribution.js",
885
893
  "output": "store/attribution.js",
886
- "bytes": 2880,
887
- "sourceSha256": "4bda762db5756c0d498d987aa3bc97eeee94be1c1ad2f005ed0ed46785e242d9",
888
- "outputSha256": "4bda762db5756c0d498d987aa3bc97eeee94be1c1ad2f005ed0ed46785e242d9",
894
+ "bytes": 3280,
895
+ "sourceSha256": "5b54980a4f158c9b61cd90c4a83a14e83268fe98101fc88409500bb73d1126bb",
896
+ "outputSha256": "5b54980a4f158c9b61cd90c4a83a14e83268fe98101fc88409500bb73d1126bb",
889
897
  "transform": "verbatim"
890
898
  },
891
899
  {
@@ -971,17 +979,17 @@
971
979
  {
972
980
  "source": "package/dist/store/pool.d.ts",
973
981
  "output": "store/pool.d.ts",
974
- "bytes": 10785,
975
- "sourceSha256": "192ea359d2ce746b31693cf06795a281f2e06804c567975f127ea05fa6fb4aef",
976
- "outputSha256": "192ea359d2ce746b31693cf06795a281f2e06804c567975f127ea05fa6fb4aef",
982
+ "bytes": 11743,
983
+ "sourceSha256": "0693e165ef937c22c375a3f63d01209c844d101ddf1a6702c8acc99bb5fc2a9d",
984
+ "outputSha256": "0693e165ef937c22c375a3f63d01209c844d101ddf1a6702c8acc99bb5fc2a9d",
977
985
  "transform": "verbatim"
978
986
  },
979
987
  {
980
988
  "source": "package/dist/store/pool.js",
981
989
  "output": "store/pool.js",
982
- "bytes": 5671,
983
- "sourceSha256": "8dc0d27b37204c2c3229296e8efbbfac6bcb30538b39d8d95771267487a06292",
984
- "outputSha256": "8dc0d27b37204c2c3229296e8efbbfac6bcb30538b39d8d95771267487a06292",
990
+ "bytes": 6332,
991
+ "sourceSha256": "45a696753691027dfcadd8e94b38b111ad5085ba1cb4f769225b15efc68125d7",
992
+ "outputSha256": "45a696753691027dfcadd8e94b38b111ad5085ba1cb4f769225b15efc68125d7",
985
993
  "transform": "verbatim"
986
994
  },
987
995
  {
@@ -1027,9 +1035,17 @@
1027
1035
  {
1028
1036
  "source": "package/dist/store/pull.js",
1029
1037
  "output": "store/pull.js",
1030
- "bytes": 5470,
1031
- "sourceSha256": "4db913a0d196ed634277e4f3569c275579038f948e4adf6eb4dbbae257a41c92",
1032
- "outputSha256": "4db913a0d196ed634277e4f3569c275579038f948e4adf6eb4dbbae257a41c92",
1038
+ "bytes": 5602,
1039
+ "sourceSha256": "512a723a49dae3be50aa8c67ca8f6a5c165ec72e8a991a166d8d93e33e895350",
1040
+ "outputSha256": "512a723a49dae3be50aa8c67ca8f6a5c165ec72e8a991a166d8d93e33e895350",
1041
+ "transform": "verbatim"
1042
+ },
1043
+ {
1044
+ "source": "package/dist/store/quota-writer.js",
1045
+ "output": "store/quota-writer.js",
1046
+ "bytes": 12396,
1047
+ "sourceSha256": "ade5fdda516011baf11e40f672263364cea07c45bdcbfc11107e22794e9aef21",
1048
+ "outputSha256": "ade5fdda516011baf11e40f672263364cea07c45bdcbfc11107e22794e9aef21",
1033
1049
  "transform": "verbatim"
1034
1050
  },
1035
1051
  {
@@ -1091,9 +1107,9 @@
1091
1107
  {
1092
1108
  "source": "package/dist/store/runtime.d.ts",
1093
1109
  "output": "store/runtime.d.ts",
1094
- "bytes": 1949,
1095
- "sourceSha256": "6838abdf1de68578c8403f76d3404a86e0d286c28a99ff32cb8bd84544a718cb",
1096
- "outputSha256": "6838abdf1de68578c8403f76d3404a86e0d286c28a99ff32cb8bd84544a718cb",
1110
+ "bytes": 2100,
1111
+ "sourceSha256": "34efe7252b6c0aead222cab6164340e76e9c22202049158164c56c3b46bab91f",
1112
+ "outputSha256": "34efe7252b6c0aead222cab6164340e76e9c22202049158164c56c3b46bab91f",
1097
1113
  "transform": "verbatim"
1098
1114
  },
1099
1115
  {
@@ -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