@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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@cortexkit/common-auth",
4
- "version": "0.24.0",
4
+ "version": "0.26.0",
5
5
  "artifactStatus": "published",
6
6
  "publicRoots": {
7
7
  "./rpc": {
@@ -61,15 +61,15 @@
61
61
  "import": "./dist/opencode2/index.js"
62
62
  }
63
63
  },
64
- "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.24.0.tgz",
65
- "tarballSha256": "7b96e74e4017df1678050b1fe18ca821a548da4412414d4df222307a7c1d0ca0",
66
- "sri": "sha512-dHGHnWBbVC/NHTq22GlFaqYFWg7M1TcCYZvYVIML1bx/rQiIoG05t/ojXjRWdrymHV7GYoaE+yx0YdYHHrPByQ==",
67
- "canonicalFiles": 185,
68
- "canonicalBytes": 1068841,
64
+ "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.26.0.tgz",
65
+ "tarballSha256": "a5a6cb7051ee8c45e86e19cf7a918d0e28ce1b6a80301e982efbc7bb4b98208d",
66
+ "sri": "sha512-qTmQ9aMG+HcyDbhKie8Nq9wxKMRQ6GXH2hKq8Fab9kHqFfzswdp2NpXofGY52RhQ2VxuyMOQr5T6lUrkbny5VQ==",
67
+ "canonicalFiles": 187,
68
+ "canonicalBytes": 1104078,
69
69
  "generator": {
70
70
  "path": "packages/opencode/scripts/embed-common-auth.ts",
71
71
  "version": 3,
72
- "sha256": "0d093bc6e05261723f521904c32a328d890fdac5d00bf8b7035708ae44674103"
72
+ "sha256": "89dbeb07d77e0657abeb72a40fcc03a900e98292956865252349a01a15999ed0"
73
73
  },
74
74
  "files": [
75
75
  {
@@ -251,17 +251,17 @@
251
251
  {
252
252
  "source": "package/dist/claustrum/consumer.d.ts",
253
253
  "output": "claustrum/consumer.d.ts",
254
- "bytes": 9548,
255
- "sourceSha256": "150eac9038881740a78e5664501a6ef0aa5e177a6dd46854cbeaf38513463e90",
256
- "outputSha256": "150eac9038881740a78e5664501a6ef0aa5e177a6dd46854cbeaf38513463e90",
254
+ "bytes": 9907,
255
+ "sourceSha256": "8001ce3f928af1bc9124223071eb9c85ea3273436cd7be073c588217f942b248",
256
+ "outputSha256": "8001ce3f928af1bc9124223071eb9c85ea3273436cd7be073c588217f942b248",
257
257
  "transform": "verbatim"
258
258
  },
259
259
  {
260
260
  "source": "package/dist/claustrum/consumer.js",
261
261
  "output": "claustrum/consumer.js",
262
- "bytes": 25698,
263
- "sourceSha256": "ec47dc016bf4d95655c17093a78d9c214b623214c821d352f73ea60f830c0d83",
264
- "outputSha256": "ec47dc016bf4d95655c17093a78d9c214b623214c821d352f73ea60f830c0d83",
262
+ "bytes": 26470,
263
+ "sourceSha256": "b2087accd6e8759fb49173dc744243ed703520d5011386ef514672be8fe79fbe",
264
+ "outputSha256": "b2087accd6e8759fb49173dc744243ed703520d5011386ef514672be8fe79fbe",
265
265
  "transform": "verbatim"
266
266
  },
267
267
  {
@@ -299,9 +299,9 @@
299
299
  {
300
300
  "source": "package/dist/claustrum/errors.d.ts",
301
301
  "output": "claustrum/errors.d.ts",
302
- "bytes": 1145,
303
- "sourceSha256": "b7533d4c281807224d6d05f4bb7a596006862a6c05dc4462fae02af388054bce",
304
- "outputSha256": "b7533d4c281807224d6d05f4bb7a596006862a6c05dc4462fae02af388054bce",
302
+ "bytes": 1163,
303
+ "sourceSha256": "a6e5ec8be3ae7160b78456e642b440494604c2e2cdc987550744521dc873fb40",
304
+ "outputSha256": "a6e5ec8be3ae7160b78456e642b440494604c2e2cdc987550744521dc873fb40",
305
305
  "transform": "verbatim"
306
306
  },
307
307
  {
@@ -331,17 +331,17 @@
331
331
  {
332
332
  "source": "package/dist/claustrum/index.d.ts",
333
333
  "output": "claustrum/index.d.ts",
334
- "bytes": 3761,
335
- "sourceSha256": "f2c1b8d99048666c068805b08b430492b2632be08e2beda466ee56b871572847",
336
- "outputSha256": "f2c1b8d99048666c068805b08b430492b2632be08e2beda466ee56b871572847",
334
+ "bytes": 3844,
335
+ "sourceSha256": "36c0b94c5e18972463f48bfd7e1506d9655372aa8df065786b3a47d199cdb5e0",
336
+ "outputSha256": "36c0b94c5e18972463f48bfd7e1506d9655372aa8df065786b3a47d199cdb5e0",
337
337
  "transform": "verbatim"
338
338
  },
339
339
  {
340
340
  "source": "package/dist/claustrum/index.js",
341
341
  "output": "claustrum/index.js",
342
- "bytes": 2509,
343
- "sourceSha256": "5f8b4bebfc2dec055b69769adcd1ce48ad7acc2c26256edbe4a2e984dc788147",
344
- "outputSha256": "5f8b4bebfc2dec055b69769adcd1ce48ad7acc2c26256edbe4a2e984dc788147",
342
+ "bytes": 2529,
343
+ "sourceSha256": "42c9e67bb5ec6749de488933a56fb3ee253c3b9e3588d692f171d87c59bcbd89",
344
+ "outputSha256": "42c9e67bb5ec6749de488933a56fb3ee253c3b9e3588d692f171d87c59bcbd89",
345
345
  "transform": "verbatim"
346
346
  },
347
347
  {
@@ -387,25 +387,25 @@
387
387
  {
388
388
  "source": "package/dist/claustrum/quota-writer.js",
389
389
  "output": "claustrum/quota-writer.js",
390
- "bytes": 9694,
391
- "sourceSha256": "5a7d5d1059dcadc06aa41e81e0707cc444636473822047f0ec72da7589c770f1",
392
- "outputSha256": "5a7d5d1059dcadc06aa41e81e0707cc444636473822047f0ec72da7589c770f1",
390
+ "bytes": 7579,
391
+ "sourceSha256": "0054a12ca94aab2eecf50f9b5e090879ff184e7f286cc979f32d311e22011906",
392
+ "outputSha256": "0054a12ca94aab2eecf50f9b5e090879ff184e7f286cc979f32d311e22011906",
393
393
  "transform": "verbatim"
394
394
  },
395
395
  {
396
396
  "source": "package/dist/claustrum/roster.d.ts",
397
397
  "output": "claustrum/roster.d.ts",
398
- "bytes": 10931,
399
- "sourceSha256": "c394bc08c7cce4dc68fd539ac03cb200727534693600c7daf5ba7c9c4d0618ce",
400
- "outputSha256": "c394bc08c7cce4dc68fd539ac03cb200727534693600c7daf5ba7c9c4d0618ce",
398
+ "bytes": 12574,
399
+ "sourceSha256": "c9ab3a89e04f72de09c5f15ccf1436b91f8a245e2253f24ec5998120058aebe7",
400
+ "outputSha256": "c9ab3a89e04f72de09c5f15ccf1436b91f8a245e2253f24ec5998120058aebe7",
401
401
  "transform": "verbatim"
402
402
  },
403
403
  {
404
404
  "source": "package/dist/claustrum/roster.js",
405
405
  "output": "claustrum/roster.js",
406
- "bytes": 27602,
407
- "sourceSha256": "45ed2d4e69fad154ce86f5ff4f839c2ae9269dd9146ce7a8b2e5b6f49476ddf8",
408
- "outputSha256": "45ed2d4e69fad154ce86f5ff4f839c2ae9269dd9146ce7a8b2e5b6f49476ddf8",
406
+ "bytes": 30876,
407
+ "sourceSha256": "d02184fd4d32aa8917369919edea4c44328e7332e30f3ddc41ce350e5fd1df07",
408
+ "outputSha256": "d02184fd4d32aa8917369919edea4c44328e7332e30f3ddc41ce350e5fd1df07",
409
409
  "transform": "verbatim"
410
410
  },
411
411
  {
@@ -427,25 +427,25 @@
427
427
  {
428
428
  "source": "package/dist/commands/builtins.d.ts",
429
429
  "output": "commands/builtins.d.ts",
430
- "bytes": 2931,
431
- "sourceSha256": "b70028ea58b51d344e83ac62f36fa95499ab32af753e657ade8116491488bab9",
432
- "outputSha256": "b70028ea58b51d344e83ac62f36fa95499ab32af753e657ade8116491488bab9",
430
+ "bytes": 4576,
431
+ "sourceSha256": "5ab6cbab696c91fef0fc7288d4b82803cd0bac809b68f939d73671505fc1d894",
432
+ "outputSha256": "5ab6cbab696c91fef0fc7288d4b82803cd0bac809b68f939d73671505fc1d894",
433
433
  "transform": "verbatim"
434
434
  },
435
435
  {
436
436
  "source": "package/dist/commands/builtins.js",
437
437
  "output": "commands/builtins.js",
438
- "bytes": 21323,
439
- "sourceSha256": "9b3461ace8a585dde5eff3f9b709ddc766ab3d77e680b687499efd1871a341ce",
440
- "outputSha256": "9b3461ace8a585dde5eff3f9b709ddc766ab3d77e680b687499efd1871a341ce",
438
+ "bytes": 25155,
439
+ "sourceSha256": "c5f7fca0e36dc2f3253b88e7600d3dbed6a193d2b8abbf07d16913b6b46551e6",
440
+ "outputSha256": "c5f7fca0e36dc2f3253b88e7600d3dbed6a193d2b8abbf07d16913b6b46551e6",
441
441
  "transform": "verbatim"
442
442
  },
443
443
  {
444
444
  "source": "package/dist/commands/index.d.ts",
445
445
  "output": "commands/index.d.ts",
446
- "bytes": 1081,
447
- "sourceSha256": "cfe14cdf7ae83a3bf37cfc3e4199c8f80e7720b982a0e875064113b1461c2967",
448
- "outputSha256": "cfe14cdf7ae83a3bf37cfc3e4199c8f80e7720b982a0e875064113b1461c2967",
446
+ "bytes": 1100,
447
+ "sourceSha256": "4be7eec728211b7ad707121b1f2bbe2c219574aaa4e1c5be3f8964b185d4377c",
448
+ "outputSha256": "4be7eec728211b7ad707121b1f2bbe2c219574aaa4e1c5be3f8964b185d4377c",
449
449
  "transform": "verbatim"
450
450
  },
451
451
  {
@@ -715,17 +715,17 @@
715
715
  {
716
716
  "source": "package/dist/opencode2/install.d.ts",
717
717
  "output": "opencode2/install.d.ts",
718
- "bytes": 3566,
719
- "sourceSha256": "9bdc589d379c353b74b401b3b4fc3eff6ab2fef19ab8a6737f4595b8155c9025",
720
- "outputSha256": "9bdc589d379c353b74b401b3b4fc3eff6ab2fef19ab8a6737f4595b8155c9025",
718
+ "bytes": 3658,
719
+ "sourceSha256": "7d7ee46966c9dba09c706a799496e798752780d0967c62fa922e243df3038ad5",
720
+ "outputSha256": "7d7ee46966c9dba09c706a799496e798752780d0967c62fa922e243df3038ad5",
721
721
  "transform": "verbatim"
722
722
  },
723
723
  {
724
724
  "source": "package/dist/opencode2/install.js",
725
725
  "output": "opencode2/install.js",
726
- "bytes": 36235,
727
- "sourceSha256": "9b16eb3d63bf5167d2f0fa660eb6576f66d012af245d592d59062014cc8669e7",
728
- "outputSha256": "9b16eb3d63bf5167d2f0fa660eb6576f66d012af245d592d59062014cc8669e7",
726
+ "bytes": 42489,
727
+ "sourceSha256": "82b12a88456d3fec034cf52dad13aa0a2736bc4c0dbbfb4b32bb98e6fcc899b6",
728
+ "outputSha256": "82b12a88456d3fec034cf52dad13aa0a2736bc4c0dbbfb4b32bb98e6fcc899b6",
729
729
  "transform": "verbatim"
730
730
  },
731
731
  {
@@ -763,9 +763,9 @@
763
763
  {
764
764
  "source": "package/dist/opencode2/types.d.ts",
765
765
  "output": "opencode2/types.d.ts",
766
- "bytes": 19205,
767
- "sourceSha256": "b612e0737e370f83e492afa59cb6f4205b6ab9743f0ec53c6272c754f24d2271",
768
- "outputSha256": "b612e0737e370f83e492afa59cb6f4205b6ab9743f0ec53c6272c754f24d2271",
766
+ "bytes": 21401,
767
+ "sourceSha256": "70033152b714eebab005a0b7fc5f84b95b0f14d1af579dc710200bbca3f8570f",
768
+ "outputSha256": "70033152b714eebab005a0b7fc5f84b95b0f14d1af579dc710200bbca3f8570f",
769
769
  "transform": "verbatim"
770
770
  },
771
771
  {
@@ -888,6 +888,14 @@
888
888
  "outputSha256": "b1d76faf1fb480b97ef1886ce75dbd2156002baedc39249468559cb4eece5bbb",
889
889
  "transform": "verbatim"
890
890
  },
891
+ {
892
+ "source": "package/dist/quota/pending.js",
893
+ "output": "quota/pending.js",
894
+ "bytes": 1876,
895
+ "sourceSha256": "e757a3fa9f8440190668c6154468a5baec8a84e20d6c831a6d7935c3b9bebe29",
896
+ "outputSha256": "e757a3fa9f8440190668c6154468a5baec8a84e20d6c831a6d7935c3b9bebe29",
897
+ "transform": "verbatim"
898
+ },
891
899
  {
892
900
  "source": "package/dist/quota/projection.d.ts",
893
901
  "output": "quota/projection.d.ts",
@@ -1163,17 +1171,17 @@
1163
1171
  {
1164
1172
  "source": "package/dist/setup/enroll.d.ts",
1165
1173
  "output": "setup/enroll.d.ts",
1166
- "bytes": 2199,
1167
- "sourceSha256": "d7599ee67d3906d57f599447d243c6695d53b22d2105af317d36120e9f7c8ca7",
1168
- "outputSha256": "d7599ee67d3906d57f599447d243c6695d53b22d2105af317d36120e9f7c8ca7",
1174
+ "bytes": 2274,
1175
+ "sourceSha256": "067d636aea631befae2548b5aeed01dc10c22e9c44efb43c31496fe8c0a9ab68",
1176
+ "outputSha256": "067d636aea631befae2548b5aeed01dc10c22e9c44efb43c31496fe8c0a9ab68",
1169
1177
  "transform": "verbatim"
1170
1178
  },
1171
1179
  {
1172
1180
  "source": "package/dist/setup/enroll.js",
1173
1181
  "output": "setup/enroll.js",
1174
- "bytes": 8484,
1175
- "sourceSha256": "2ec864a300326a2ce9b8dd79750704e438af04ef5fa9e3b744a8ecdd7e0e41d6",
1176
- "outputSha256": "2ec864a300326a2ce9b8dd79750704e438af04ef5fa9e3b744a8ecdd7e0e41d6",
1182
+ "bytes": 8557,
1183
+ "sourceSha256": "dd21599c916733c327bca81c48372034a349a2840e50fac7d2d30b33668a1537",
1184
+ "outputSha256": "dd21599c916733c327bca81c48372034a349a2840e50fac7d2d30b33668a1537",
1177
1185
  "transform": "verbatim"
1178
1186
  },
1179
1187
  {
@@ -1251,17 +1259,17 @@
1251
1259
  {
1252
1260
  "source": "package/dist/store/attribution.d.ts",
1253
1261
  "output": "store/attribution.d.ts",
1254
- "bytes": 1528,
1255
- "sourceSha256": "441dba300556a927e872597c1df3e4fbb1ac61c0a3989e98dcd3a94a773b8ed7",
1256
- "outputSha256": "441dba300556a927e872597c1df3e4fbb1ac61c0a3989e98dcd3a94a773b8ed7",
1262
+ "bytes": 1951,
1263
+ "sourceSha256": "16919a55fe944b459ff511c125ac2ba34714949d38db006c8ab047dd48ab51a6",
1264
+ "outputSha256": "16919a55fe944b459ff511c125ac2ba34714949d38db006c8ab047dd48ab51a6",
1257
1265
  "transform": "verbatim"
1258
1266
  },
1259
1267
  {
1260
1268
  "source": "package/dist/store/attribution.js",
1261
1269
  "output": "store/attribution.js",
1262
- "bytes": 2880,
1263
- "sourceSha256": "4bda762db5756c0d498d987aa3bc97eeee94be1c1ad2f005ed0ed46785e242d9",
1264
- "outputSha256": "4bda762db5756c0d498d987aa3bc97eeee94be1c1ad2f005ed0ed46785e242d9",
1270
+ "bytes": 3280,
1271
+ "sourceSha256": "5b54980a4f158c9b61cd90c4a83a14e83268fe98101fc88409500bb73d1126bb",
1272
+ "outputSha256": "5b54980a4f158c9b61cd90c4a83a14e83268fe98101fc88409500bb73d1126bb",
1265
1273
  "transform": "verbatim"
1266
1274
  },
1267
1275
  {
@@ -1347,17 +1355,17 @@
1347
1355
  {
1348
1356
  "source": "package/dist/store/pool.d.ts",
1349
1357
  "output": "store/pool.d.ts",
1350
- "bytes": 10785,
1351
- "sourceSha256": "192ea359d2ce746b31693cf06795a281f2e06804c567975f127ea05fa6fb4aef",
1352
- "outputSha256": "192ea359d2ce746b31693cf06795a281f2e06804c567975f127ea05fa6fb4aef",
1358
+ "bytes": 11743,
1359
+ "sourceSha256": "0693e165ef937c22c375a3f63d01209c844d101ddf1a6702c8acc99bb5fc2a9d",
1360
+ "outputSha256": "0693e165ef937c22c375a3f63d01209c844d101ddf1a6702c8acc99bb5fc2a9d",
1353
1361
  "transform": "verbatim"
1354
1362
  },
1355
1363
  {
1356
1364
  "source": "package/dist/store/pool.js",
1357
1365
  "output": "store/pool.js",
1358
- "bytes": 5671,
1359
- "sourceSha256": "8dc0d27b37204c2c3229296e8efbbfac6bcb30538b39d8d95771267487a06292",
1360
- "outputSha256": "8dc0d27b37204c2c3229296e8efbbfac6bcb30538b39d8d95771267487a06292",
1366
+ "bytes": 6332,
1367
+ "sourceSha256": "45a696753691027dfcadd8e94b38b111ad5085ba1cb4f769225b15efc68125d7",
1368
+ "outputSha256": "45a696753691027dfcadd8e94b38b111ad5085ba1cb4f769225b15efc68125d7",
1361
1369
  "transform": "verbatim"
1362
1370
  },
1363
1371
  {
@@ -1403,9 +1411,17 @@
1403
1411
  {
1404
1412
  "source": "package/dist/store/pull.js",
1405
1413
  "output": "store/pull.js",
1406
- "bytes": 5470,
1407
- "sourceSha256": "4db913a0d196ed634277e4f3569c275579038f948e4adf6eb4dbbae257a41c92",
1408
- "outputSha256": "4db913a0d196ed634277e4f3569c275579038f948e4adf6eb4dbbae257a41c92",
1414
+ "bytes": 5602,
1415
+ "sourceSha256": "512a723a49dae3be50aa8c67ca8f6a5c165ec72e8a991a166d8d93e33e895350",
1416
+ "outputSha256": "512a723a49dae3be50aa8c67ca8f6a5c165ec72e8a991a166d8d93e33e895350",
1417
+ "transform": "verbatim"
1418
+ },
1419
+ {
1420
+ "source": "package/dist/store/quota-writer.js",
1421
+ "output": "store/quota-writer.js",
1422
+ "bytes": 12396,
1423
+ "sourceSha256": "ade5fdda516011baf11e40f672263364cea07c45bdcbfc11107e22794e9aef21",
1424
+ "outputSha256": "ade5fdda516011baf11e40f672263364cea07c45bdcbfc11107e22794e9aef21",
1409
1425
  "transform": "verbatim"
1410
1426
  },
1411
1427
  {
@@ -1467,9 +1483,9 @@
1467
1483
  {
1468
1484
  "source": "package/dist/store/runtime.d.ts",
1469
1485
  "output": "store/runtime.d.ts",
1470
- "bytes": 1949,
1471
- "sourceSha256": "6838abdf1de68578c8403f76d3404a86e0d286c28a99ff32cb8bd84544a718cb",
1472
- "outputSha256": "6838abdf1de68578c8403f76d3404a86e0d286c28a99ff32cb8bd84544a718cb",
1486
+ "bytes": 2100,
1487
+ "sourceSha256": "34efe7252b6c0aead222cab6164340e76e9c22202049158164c56c3b46bab91f",
1488
+ "outputSha256": "34efe7252b6c0aead222cab6164340e76e9c22202049158164c56c3b46bab91f",
1473
1489
  "transform": "verbatim"
1474
1490
  },
1475
1491
  {
@@ -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
@@ -1,8 +1,41 @@
1
1
  import { PoolOperationError } from './errors.js';
2
- import { toFailure, withTransaction } from './mutate.js';
2
+ import { toFailure, withTransaction, } from './mutate.js';
3
3
  import { LockStack } from './refresh-lock.js';
4
4
  import { refusal, requireBound, unknownRow, } from './runtime.js';
5
5
  import { isCredentialEpoch } from './schema.js';
6
+ export function assertQuotaEpoch(id, attribution) {
7
+ if (!isCredentialEpoch(attribution?.credentialEpoch))
8
+ throw refusal('pull', id, 'invalid-input', 'the credential epoch the reading was issued for must be a positive safe integer');
9
+ }
10
+ // Shared by preflight and the locked commit: accepting into memory must never
11
+ // hide a refusal the immediate writer would have returned to its caller.
12
+ export function assertQuotaRow(id, attribution, row) {
13
+ if (!row)
14
+ throw unknownRow('pull', id);
15
+ if (row.invalid)
16
+ throw refusal('pull', id, 'invalid-row', `row ${id} is invalid`);
17
+ if (!row.credential)
18
+ throw refusal('pull', id, 'no-credential', `row ${id} holds no credential`);
19
+ requireBound('pull', row);
20
+ if (row.torn ||
21
+ !row.hasEntry ||
22
+ row.credentialEpoch !== attribution.credentialEpoch ||
23
+ row.identity !== attribution.identity)
24
+ throw new PoolOperationError({
25
+ operation: 'pull',
26
+ rowId: id,
27
+ phase: 'pull',
28
+ retryable: true,
29
+ kind: 'attribution',
30
+ message: `quota for ${id} was issued for a credential the row no longer holds`,
31
+ });
32
+ }
33
+ export function mergedQuota(ctx, id, stored, observation) {
34
+ const merged = ctx.codec.merge(stored, observation);
35
+ if (!ctx.codec.validate(merged))
36
+ throw refusal('pull', id, 'invalid-quota', 'the quota codec rejected the merged map');
37
+ return merged;
38
+ }
6
39
  /**
7
40
  * Merges a quota observation into a row's stored map under the store locks,
8
41
  * after attribution passes. Needs no row lock, so it is permitted from
@@ -13,37 +46,18 @@ export async function recordQuota(rt, id, attribution, observation) {
13
46
  const locks = new LockStack(ctx.lockDefaults, ctx.lockEnv);
14
47
  const progress = { writes: 0 };
15
48
  try {
16
- if (!isCredentialEpoch(attribution?.credentialEpoch))
17
- throw refusal('pull', id, 'invalid-input', 'the credential epoch the reading was issued for must be a positive safe integer');
49
+ assertQuotaEpoch(id, attribution);
18
50
  await withTransaction(ctx, locks, progress, { operation: 'pull', rowId: id }, async (tx) => {
19
51
  tx.assertNotStaged(id);
20
52
  const row = tx.row(id);
21
- if (!row)
22
- throw unknownRow('pull', id);
23
- if (row.invalid)
24
- throw refusal('pull', id, 'invalid-row', `row ${id} is invalid`);
25
53
  // A reading belongs to one (epoch, identity, credential). A row
26
54
  // holding no credential, or torn between the writes of a replace,
27
55
  // has no such triple on disk, so no reading is recorded for it.
28
- if (!row.credential)
29
- throw refusal('pull', id, 'no-credential', `row ${id} holds no credential`);
30
- requireBound('pull', row);
56
+ assertQuotaRow(id, attribution, row);
31
57
  const entry = tx.entry(id);
32
- if (row.torn ||
33
- !entry ||
34
- entry.credentialEpoch !== attribution.credentialEpoch ||
35
- row.identity !== attribution.identity)
36
- throw new PoolOperationError({
37
- operation: 'pull',
38
- rowId: id,
39
- phase: 'pull',
40
- retryable: true,
41
- kind: 'attribution',
42
- message: `quota for ${id} was issued for a credential the row no longer holds`,
43
- });
44
- const merged = ctx.codec.merge(entry.quota, observation);
45
- if (!ctx.codec.validate(merged))
46
- throw refusal('pull', id, 'invalid-quota', 'the quota codec rejected the merged map');
58
+ if (!entry)
59
+ throw unknownRow('pull', id);
60
+ const merged = mergedQuota(ctx, id, entry.quota, observation);
47
61
  tx.setEntry(id, { ...entry, quota: merged, needsFirstReading: false });
48
62
  await tx.commitConfig();
49
63
  },
@@ -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. */
@@ -3,6 +3,7 @@ import { initializePool, readPool, } from './mutate.js';
3
3
  import { updateProviderStateRow, } from './provider-state.js';
4
4
  import { publication, publishRoster, } from './publication.js';
5
5
  import { PullScheduler } from './pull.js';
6
+ import { PoolQuotaWriter } from './quota-writer.js';
6
7
  import { refreshRow, } from './refresh.js';
7
8
  import { POOL_LOCK_DEFAULTS, } from './refresh-lock.js';
8
9
  import { addRow, disableRow, enableRow, recordRowIdentity, removeRow, reorderRows, replaceRow, rotateRow, } from './rows.js';
@@ -80,9 +81,21 @@ export function openPoolStore(options) {
80
81
  rowLockOptions: options.rowLockOptions ?? {},
81
82
  firePull: (id, reason) => pulls.fire(id, reason),
82
83
  };
84
+ const quotaWriter = options.coalesceQuota
85
+ ? new PoolQuotaWriter(rt, options.quotaDrainTimeoutMs)
86
+ : undefined;
87
+ const record = (id, attribution, observation) => quotaWriter
88
+ ? quotaWriter.record(id, attribution, observation)
89
+ : recordQuota(rt, id, attribution, observation);
90
+ rt.publishQuota = record;
91
+ const overlay = (result) => {
92
+ if (result.status === 'ready' && quotaWriter)
93
+ return { ...result, rows: quotaWriter.overlay(result.rows) };
94
+ return result;
95
+ };
83
96
  return {
84
97
  async load() {
85
- const result = await readPool(ctx);
98
+ const result = overlay(await readPool(ctx));
86
99
  if (result.status === 'ready') {
87
100
  // A torn row is no candidate, but its pull is fired too: the pull
88
101
  // completes the row on disk before reading it, so an interrupted
@@ -96,7 +109,7 @@ export function openPoolStore(options) {
96
109
  return toLoad(result);
97
110
  },
98
111
  async read() {
99
- return toLoad(await readPool(ctx));
112
+ return toLoad(overlay(await readPool(ctx)));
100
113
  },
101
114
  async initialize(input = {}) {
102
115
  return { status: await initializePool(ctx, input.dropKeys ?? []) };
@@ -115,7 +128,9 @@ export function openPoolStore(options) {
115
128
  updateSettings: (mutator, callOptions) => updatePoolSettings(rt, mutator, callOptions),
116
129
  recordIdentity: (id, identity, attribution, callOptions) => recordRowIdentity(rt, id, identity, attribution, callOptions),
117
130
  refresh: (id, provider, callOptions) => refreshRow(rt, id, provider, callOptions),
118
- recordQuota: (id, attribution, observation) => recordQuota(rt, id, attribution, observation),
131
+ recordQuota: record,
132
+ close: () => quotaWriter?.close() ?? Promise.resolve(),
133
+ dispose: () => quotaWriter?.close() ?? Promise.resolve(),
119
134
  requestReading: (id) => pulls.fire(id, 'admission'),
120
135
  pullsSettled: () => pulls.settled(),
121
136
  };
@@ -105,7 +105,9 @@ export class PullScheduler {
105
105
  cause,
106
106
  });
107
107
  }
108
- await recordQuota(rt, id, {
108
+ const publish = rt.publishQuota ??
109
+ ((rowId, attribution, value) => recordQuota(rt, rowId, attribution, value));
110
+ await publish(id, {
109
111
  credentialEpoch: request.credentialEpoch,
110
112
  ...(request.identity !== undefined
111
113
  ? { identity: request.identity }