@camstack/system 1.2.442 → 1.2.444

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 (107) hide show
  1. package/assets/record-entries/icon.svg +8 -0
  2. package/dist/addon-runner.js +41 -11
  3. package/dist/addon-runner.mjs +42 -12
  4. package/dist/addon-utils.js +1 -1
  5. package/dist/addon-utils.mjs +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  10. package/dist/builtins/alerts/alerts.addon.d.ts +10 -2
  11. package/dist/builtins/alerts/alerts.addon.js +43 -10
  12. package/dist/builtins/alerts/alerts.addon.mjs +43 -10
  13. package/dist/builtins/autotrack/index.js +1 -1
  14. package/dist/builtins/autotrack/index.mjs +1 -1
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  17. package/dist/builtins/calendars/calendars.addon.js +1 -1
  18. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  19. package/dist/builtins/camera-grid/index.js +1 -1
  20. package/dist/builtins/camera-grid/index.mjs +1 -1
  21. package/dist/builtins/composer/composer.addon.js +2 -2
  22. package/dist/builtins/composer/composer.addon.mjs +2 -2
  23. package/dist/builtins/console-logging/index.js +1 -1
  24. package/dist/builtins/console-logging/index.mjs +1 -1
  25. package/dist/builtins/core-blocks/block-package.d.ts +4 -2
  26. package/dist/builtins/core-blocks/block-settings-store.d.ts +65 -19
  27. package/dist/builtins/core-blocks/core-blocks.addon.js +365 -38
  28. package/dist/builtins/core-blocks/core-blocks.addon.mjs +365 -38
  29. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  30. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  31. package/dist/builtins/hub-forwarder/index.js +1 -1
  32. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  33. package/dist/builtins/keychain/index.js +3 -3
  34. package/dist/builtins/keychain/index.mjs +3 -3
  35. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  36. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  37. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  38. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  39. package/dist/builtins/local-network/local-network.addon.js +2 -2
  40. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  41. package/dist/builtins/loki-logging/index.js +1 -1
  42. package/dist/builtins/loki-logging/index.mjs +1 -1
  43. package/dist/builtins/native-metrics/native-metrics.addon.js +2 -2
  44. package/dist/builtins/native-metrics/native-metrics.addon.mjs +2 -2
  45. package/dist/builtins/platform-probe/index.js +2 -2
  46. package/dist/builtins/platform-probe/index.mjs +2 -2
  47. package/dist/builtins/record-entries/entries-service.d.ts +42 -0
  48. package/dist/builtins/record-entries/index.d.ts +1 -0
  49. package/dist/builtins/record-entries/index.js +142 -0
  50. package/dist/builtins/record-entries/index.mjs +136 -0
  51. package/dist/builtins/record-entries/record-entries.addon.d.ts +13 -0
  52. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/dist/builtins/snapshot/index.js +1 -1
  55. package/dist/builtins/snapshot/index.mjs +1 -1
  56. package/dist/builtins/sqlite-storage/file-host-client.d.ts +2 -0
  57. package/dist/builtins/sqlite-storage/file-host-handlers.d.ts +4 -0
  58. package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +7 -1
  59. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  60. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  61. package/dist/builtins/sqlite-storage/index.js +1 -1
  62. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  63. package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +7 -0
  64. package/dist/builtins/sqlite-storage/placement-router.d.ts +5 -0
  65. package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +29 -0
  66. package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +46 -0
  67. package/dist/builtins/sqlite-storage/records/records-engine.d.ts +90 -0
  68. package/dist/builtins/sqlite-storage/records/records-explain.d.ts +18 -0
  69. package/dist/builtins/sqlite-storage/records/records-plan.d.ts +90 -0
  70. package/dist/builtins/sqlite-storage/records/records-probe.d.ts +33 -0
  71. package/dist/builtins/sqlite-storage/records/records-provider.d.ts +59 -0
  72. package/dist/builtins/sqlite-storage/records/records-rows.d.ts +46 -0
  73. package/dist/builtins/sqlite-storage/records/records-sql.d.ts +41 -0
  74. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -10
  75. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +8 -0
  76. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +337 -4
  77. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +337 -4
  78. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +7 -1
  79. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  80. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  81. package/dist/builtins/system-config/system-config.addon.js +2 -2
  82. package/dist/builtins/system-config/system-config.addon.mjs +2 -2
  83. package/dist/builtins/winston-logging/index.js +1 -1
  84. package/dist/builtins/winston-logging/index.mjs +1 -1
  85. package/dist/{composition-sources-CftPpY4O.mjs → composition-sources-C3rKncIF.mjs} +1 -1
  86. package/dist/{composition-sources-DmSEMtUD.js → composition-sources-NAPZddic.js} +1 -1
  87. package/dist/{constants-2iWQ-Nx-.mjs → constants-BKX2QnIg.mjs} +1 -1
  88. package/dist/{constants-b7kpjuO4.js → constants-BXiNEIeV.js} +1 -1
  89. package/dist/{device-ca-tKY_ZS9H.js → device-ca-DT9X2S6d.js} +1 -1
  90. package/dist/{device-ca-BJpYTAPg.mjs → device-ca-jxjSL8Ov.mjs} +1 -1
  91. package/dist/{dist-CyIHDLCg.js → dist-D1vECb_6.js} +1247 -120
  92. package/dist/{dist-DsrQYcLm.mjs → dist-DERK-gP5.mjs} +1068 -121
  93. package/dist/file-host-worker.js +11 -1
  94. package/dist/file-host-worker.mjs +11 -1
  95. package/dist/{hub-mdns-ciao-BS2akjWx.mjs → hub-mdns-ciao-CRaC97V0.mjs} +1 -1
  96. package/dist/{hub-mdns-ciao-Da-0NEyr.js → hub-mdns-ciao-Cah9GCIg.js} +1 -1
  97. package/dist/index.js +53 -21
  98. package/dist/index.mjs +54 -22
  99. package/dist/kernel/moleculer/records-api-transport.d.ts +9 -0
  100. package/dist/kernel/settings-view-types.d.ts +0 -7
  101. package/dist/{restore-archive-Cdf09dHm.js → restore-archive-Dy-qKTdF.js} +1 -1
  102. package/dist/{restore-archive-RaA3uZ7H.mjs → restore-archive-daKyE24F.mjs} +1 -1
  103. package/dist/{wal-maintenance-C-bmkDhm.js → wal-maintenance-dAv4IdzC.js} +0 -0
  104. package/dist/{wal-maintenance-DE8QrreK.mjs → wal-maintenance-zRc24mOC.mjs} +0 -0
  105. package/package.json +22 -1
  106. package/dist/{custom-action-registry-BKmoaqG0.js → custom-action-registry-COyb49zm.js} +1 -1
  107. package/dist/{custom-action-registry-CyUuhATc.mjs → custom-action-registry-stpC3Zy-.mjs} +1 -1
@@ -736,7 +736,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
736
736
  return EventCategory;
737
737
  }({});
738
738
  //#endregion
739
- //#region ../types/dist/sleep-bgZLodYc.mjs
739
+ //#region ../types/dist/sleep-WsrozGDL.mjs
740
740
  /**
741
741
  * The audio chunk plane's byte format, and the ONE expansion from a coded
742
742
  * window to float samples (D455).
@@ -848,21 +848,21 @@ function collectSecretConfigKeys(schema) {
848
848
  for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) walkField(field, keys);
849
849
  return keys;
850
850
  }
851
- function isRecord$3(value) {
851
+ function isRecord$5(value) {
852
852
  return typeof value === "object" && value !== null && !Array.isArray(value);
853
853
  }
854
854
  function sectionsOf(schema) {
855
- if (!isRecord$3(schema)) return [];
855
+ if (!isRecord$5(schema)) return [];
856
856
  const sections = schema["sections"];
857
857
  return Array.isArray(sections) ? sections : [];
858
858
  }
859
859
  function fieldsOf(node) {
860
- if (!isRecord$3(node)) return [];
860
+ if (!isRecord$5(node)) return [];
861
861
  const fields = node["fields"];
862
862
  return Array.isArray(fields) ? fields : [];
863
863
  }
864
864
  function walkField(field, out) {
865
- if (!isRecord$3(field)) return;
865
+ if (!isRecord$5(field)) return;
866
866
  const type = field["type"];
867
867
  const key = field["key"];
868
868
  if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
@@ -900,7 +900,7 @@ function walkField(field, out) {
900
900
  var SECRET_CLEAR = { $secretClear: true };
901
901
  /** The `'***'` token D634 redaction writes for non-admins. */
902
902
  var LEGACY_DEVICE_REDACTION = "***";
903
- function isRecord$2(value) {
903
+ function isRecord$4(value) {
904
904
  return typeof value === "object" && value !== null && !Array.isArray(value);
905
905
  }
906
906
  function makeSecretMarker(ref) {
@@ -911,16 +911,16 @@ function makeSecretMarker(ref) {
911
911
  }
912
912
  /** A stored marker: an object whose `$secret` is a non-empty string. */
913
913
  function isSecretMarker(value) {
914
- if (!isRecord$2(value)) return false;
914
+ if (!isRecord$4(value)) return false;
915
915
  const ref = value["$secret"];
916
916
  return typeof ref === "string" && ref.length > 0;
917
917
  }
918
918
  /** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
919
919
  function isSecretMarkerLike(value) {
920
- return isRecord$2(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
920
+ return isRecord$4(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
921
921
  }
922
922
  function isSecretClear(value) {
923
- return isRecord$2(value) && value["$secretClear"] === true;
923
+ return isRecord$4(value) && value["$secretClear"] === true;
924
924
  }
925
925
  /**
926
926
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -1589,7 +1589,7 @@ var KeychainWriteRefusedError = class extends Error {
1589
1589
  }
1590
1590
  };
1591
1591
  var KEEP = { kind: "keep" };
1592
- function isRecord$1(value) {
1592
+ function isRecord$3(value) {
1593
1593
  return typeof value === "object" && value !== null && !Array.isArray(value);
1594
1594
  }
1595
1595
  function defaultMintId() {
@@ -1602,7 +1602,7 @@ function collectSecretMarkerRefs(value, out = []) {
1602
1602
  return out;
1603
1603
  }
1604
1604
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
1605
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
1605
+ else if (isRecord$3(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
1606
1606
  return out;
1607
1607
  }
1608
1608
  async function storedValueEquals(secrets, marker, candidate) {
@@ -1657,7 +1657,7 @@ function rowId(row, idKey) {
1657
1657
  return null;
1658
1658
  }
1659
1659
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
1660
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
1660
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$3) : [];
1661
1661
  if (!Array.isArray(incoming)) {
1662
1662
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
1663
1663
  return {
@@ -1673,7 +1673,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
1673
1673
  const kept = /* @__PURE__ */ new Set();
1674
1674
  const rows = [];
1675
1675
  for (const row of incoming) {
1676
- if (!isRecord$1(row)) {
1676
+ if (!isRecord$3(row)) {
1677
1677
  rows.push(row);
1678
1678
  continue;
1679
1679
  }
@@ -1698,7 +1698,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
1698
1698
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
1699
1699
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
1700
1700
  case "object": {
1701
- if (!isRecord$1(incoming)) {
1701
+ if (!isRecord$3(incoming)) {
1702
1702
  if (incoming === void 0) return KEEP;
1703
1703
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
1704
1704
  return {
@@ -1706,7 +1706,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
1706
1706
  value: incoming
1707
1707
  };
1708
1708
  }
1709
- const storedObj = isRecord$1(stored) ? stored : {};
1709
+ const storedObj = isRecord$3(stored) ? stored : {};
1710
1710
  return {
1711
1711
  kind: "value",
1712
1712
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -1829,7 +1829,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
1829
1829
  value: items
1830
1830
  };
1831
1831
  }
1832
- if (isRecord$1(v)) {
1832
+ if (isRecord$3(v)) {
1833
1833
  const out = {};
1834
1834
  for (const [k, child] of Object.entries(v)) {
1835
1835
  const s = substitute(child);
@@ -1861,7 +1861,7 @@ var SecretOverwriteRefusedError = class extends Error {
1861
1861
  this.name = "SecretOverwriteRefusedError";
1862
1862
  }
1863
1863
  };
1864
- function isRecord(value) {
1864
+ function isRecord$2(value) {
1865
1865
  return typeof value === "object" && value !== null && !Array.isArray(value);
1866
1866
  }
1867
1867
  function resolvedValue(pass, marker) {
@@ -1890,7 +1890,7 @@ function inArray(pass, incoming, stored) {
1890
1890
  return incoming.map((item, index) => {
1891
1891
  const twin = stored[index];
1892
1892
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
1893
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
1893
+ if (isRecord$2(item) && isRecord$2(twin)) return inArrayRow(pass, item, twin);
1894
1894
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
1895
1895
  return item;
1896
1896
  });
@@ -1901,7 +1901,7 @@ function inArrayRow(pass, incoming, stored) {
1901
1901
  const twin = stored[key];
1902
1902
  if (isSecretMarker(twin)) {
1903
1903
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
1904
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
1904
+ } else if (isRecord$2(value) && isRecord$2(twin)) out[key] = inArrayRow(pass, value, twin);
1905
1905
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
1906
1906
  }
1907
1907
  return out;
@@ -1909,7 +1909,7 @@ function inArrayRow(pass, incoming, stored) {
1909
1909
  async function walk(pass, incoming, stored) {
1910
1910
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
1911
1911
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
1912
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
1912
+ if (!isRecord$2(incoming) || !isRecord$2(stored)) return incoming;
1913
1913
  const out = { ...incoming };
1914
1914
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
1915
1915
  return out;
@@ -1940,7 +1940,7 @@ async function restoreUnchangedSecrets(input) {
1940
1940
  function isJsonEqual(a, b) {
1941
1941
  if (Object.is(a, b)) return true;
1942
1942
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
1943
- if (isRecord(a) && isRecord(b)) {
1943
+ if (isRecord$2(a) && isRecord$2(b)) {
1944
1944
  const keys = Object.keys(a);
1945
1945
  if (keys.length !== Object.keys(b).length) return false;
1946
1946
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -1964,7 +1964,7 @@ function markerKeysOf(blob, owner) {
1964
1964
  }
1965
1965
  function nodeFromStored(value, owner) {
1966
1966
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
1967
- if (!isRecord(value)) return null;
1967
+ if (!isRecord$2(value)) return null;
1968
1968
  const children = /* @__PURE__ */ new Map();
1969
1969
  for (const [key, child] of Object.entries(value)) {
1970
1970
  const node = nodeFromStored(child, owner);
@@ -3266,6 +3266,413 @@ var PeerBytesTicketSchema = z.object({
3266
3266
  */
3267
3267
  declaredBytes: z.number().int().nonnegative().nullable()
3268
3268
  });
3269
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
3270
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
3271
+ var RECORD_DATABASES = ["settings", "events"];
3272
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
3273
+ var RECORD_CLASSES = [
3274
+ "config",
3275
+ "ledger",
3276
+ "audit",
3277
+ "mirror",
3278
+ "ephemeral"
3279
+ ];
3280
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
3281
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
3282
+ var RECORD_BATCH_MAX = 1e3;
3283
+ var RECORD_BATCH_MAX_BYTES = 4 * 1024 * 1024;
3284
+ var RECORD_QUERY_MAX = 1e3;
3285
+ /** Rows one DELETE statement removes before the serving thread yields. */
3286
+ var RECORD_DELETE_BATCH = 5e3;
3287
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
3288
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
3289
+ /** The engine's TTL sweep cadence. */
3290
+ var RECORD_SWEEP_INTERVAL_MS = 10 * 6e4;
3291
+ /** The `Column`-free proof prefix: a ref collection for a kind's secret fields. */
3292
+ var RECORD_SECRET_COLLECTION_PREFIX = "records:";
3293
+ var PREFIX = "records/";
3294
+ /** The base of every records failure. `detail` is the human part of the message. */
3295
+ var RecordsError = class extends Error {
3296
+ code;
3297
+ detail;
3298
+ constructor(code, detail) {
3299
+ super(`${PREFIX}${code}: ${detail}`);
3300
+ this.name = "RecordsError";
3301
+ this.code = code;
3302
+ this.detail = detail;
3303
+ }
3304
+ };
3305
+ /** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
3306
+ var RevConflictError = class extends RecordsError {
3307
+ constructor(detail) {
3308
+ super("rev-conflict", detail);
3309
+ this.name = "RevConflictError";
3310
+ }
3311
+ };
3312
+ /** `data` exceeds the kind's `maxDataBytes`. Bytes are never record fields (D613). */
3313
+ var RecordTooLargeError = class extends RecordsError {
3314
+ constructor(detail) {
3315
+ super("too-large", detail);
3316
+ this.name = "RecordTooLargeError";
3317
+ }
3318
+ };
3319
+ /** A filter, order or aggregate names a field no declared index serves. */
3320
+ var UnindexedFilterError = class extends RecordsError {
3321
+ constructor(detail) {
3322
+ super("unindexed-filter", detail);
3323
+ this.name = "UnindexedFilterError";
3324
+ }
3325
+ };
3326
+ /** A bulk delete with no predicate at all. */
3327
+ var FilterRequiredError = class extends RecordsError {
3328
+ constructor(detail) {
3329
+ super("filter-required", detail);
3330
+ this.name = "FilterRequiredError";
3331
+ }
3332
+ };
3333
+ /** The caller declared no such kind (another addon's kind is indistinguishable from none). */
3334
+ var UnknownRecordKindError = class extends RecordsError {
3335
+ constructor(detail) {
3336
+ super("unknown-kind", detail);
3337
+ this.name = "UnknownRecordKindError";
3338
+ }
3339
+ };
3340
+ var RecordNotFoundError = class extends RecordsError {
3341
+ constructor(detail) {
3342
+ super("not-found", detail);
3343
+ this.name = "RecordNotFoundError";
3344
+ }
3345
+ };
3346
+ /** A unique index refused the write. */
3347
+ var RecordUniqueViolationError = class extends RecordsError {
3348
+ constructor(detail) {
3349
+ super("unique-violation", detail);
3350
+ this.name = "RecordUniqueViolationError";
3351
+ }
3352
+ };
3353
+ /** A secret field held a plain string where only a keychain marker may be stored. */
3354
+ var PlaintextSecretError = class extends RecordsError {
3355
+ constructor(detail) {
3356
+ super("plaintext-secret", detail);
3357
+ this.name = "PlaintextSecretError";
3358
+ }
3359
+ };
3360
+ /** A marker whose ref is not the row's own (the D878 rule). */
3361
+ var ForeignSecretMarkerError = class extends RecordsError {
3362
+ constructor(detail) {
3363
+ super("foreign-marker", detail);
3364
+ this.name = "ForeignSecretMarkerError";
3365
+ }
3366
+ };
3367
+ var InvalidRecordError = class extends RecordsError {
3368
+ constructor(detail) {
3369
+ super("invalid-record", detail);
3370
+ this.name = "InvalidRecordError";
3371
+ }
3372
+ };
3373
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
3374
+ var DeclarationRefusedError = class extends RecordsError {
3375
+ constructor(detail) {
3376
+ super("declaration-refused", detail);
3377
+ this.name = "DeclarationRefusedError";
3378
+ }
3379
+ };
3380
+ var NoCallerError = class extends RecordsError {
3381
+ constructor(detail) {
3382
+ super("no-caller", detail);
3383
+ this.name = "NoCallerError";
3384
+ }
3385
+ };
3386
+ var BatchTooLargeError = class extends RecordsError {
3387
+ constructor(detail) {
3388
+ super("batch-too-large", detail);
3389
+ this.name = "BatchTooLargeError";
3390
+ }
3391
+ };
3392
+ function defOf(schema) {
3393
+ return schema._zod?.def ?? {};
3394
+ }
3395
+ function declaredHere(schema) {
3396
+ return z.globalRegistry.get(schema)?.secret === true;
3397
+ }
3398
+ /** Wrapper kinds whose `innerType` is the field itself. */
3399
+ var WRAPPERS = new Set([
3400
+ "optional",
3401
+ "nullable",
3402
+ "default",
3403
+ "prefault",
3404
+ "catch",
3405
+ "readonly",
3406
+ "nonoptional"
3407
+ ]);
3408
+ /**
3409
+ * The schema layers that make up ONE field: the schema itself and every
3410
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
3411
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
3412
+ * `.transform` on `in`).
3413
+ */
3414
+ function layersOf(schema) {
3415
+ const out = [];
3416
+ const queue = [schema];
3417
+ while (queue.length > 0) {
3418
+ const s = queue.shift();
3419
+ if (!s || out.includes(s)) continue;
3420
+ out.push(s);
3421
+ const def = defOf(s);
3422
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
3423
+ if (def.type === "pipe") {
3424
+ if (def.in) queue.push(def.in);
3425
+ if (def.out) queue.push(def.out);
3426
+ }
3427
+ }
3428
+ return out;
3429
+ }
3430
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
3431
+ function isZodSecret(schema) {
3432
+ return layersOf(schema).some(declaredHere);
3433
+ }
3434
+ /**
3435
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
3436
+ * element of this array" (`connection.password`, `rows[].token`). A declared
3437
+ * object or array is reported as one path and not descended into — everything
3438
+ * under it is secret.
3439
+ */
3440
+ function collectZodSecretPaths(schema, prefix = "") {
3441
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
3442
+ const paths = [];
3443
+ for (const layer of layersOf(schema)) {
3444
+ const def = defOf(layer);
3445
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
3446
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
3447
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
3448
+ else if (def.type === "intersection") {
3449
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
3450
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
3451
+ }
3452
+ }
3453
+ return [...new Set(paths)];
3454
+ }
3455
+ /**
3456
+ * Secret fields of a record, addressed the way a Zod schema declares them
3457
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
3458
+ * (`auth.accessToken`, `headers[].value`).
3459
+ *
3460
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
3461
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
3462
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
3463
+ * leaf names its element: `headers[X-Api].value`.
3464
+ *
3465
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
3466
+ */
3467
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
3468
+ function parseSecretPath(path) {
3469
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
3470
+ return path.split(".").map((raw) => {
3471
+ const each = raw.endsWith("[]");
3472
+ const key = each ? raw.slice(0, -2) : raw;
3473
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
3474
+ return {
3475
+ key,
3476
+ each
3477
+ };
3478
+ });
3479
+ }
3480
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
3481
+ function secretArrayPrefixes(path) {
3482
+ const segments = parseSecretPath(path);
3483
+ const prefixes = [];
3484
+ const walked = [];
3485
+ for (const segment of segments) {
3486
+ walked.push(segment.key);
3487
+ if (segment.each) prefixes.push(walked.join("."));
3488
+ }
3489
+ return prefixes;
3490
+ }
3491
+ function isRecord$1(value) {
3492
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3493
+ }
3494
+ function elementId(element, idKey, declared, prefix) {
3495
+ const id = isRecord$1(element) ? element[idKey] : void 0;
3496
+ if (typeof id !== "string" || id.length === 0) throw new InvalidRecordError(`"${declared}": every element of "${prefix}" needs a non-empty string "${idKey}" to carry a secret`);
3497
+ return id;
3498
+ }
3499
+ /**
3500
+ * Visit every secret leaf PRESENT in `data` (an absent branch has nothing to
3501
+ * visit). `replace` returns the new leaf value, or {@link REMOVE_LEAF}; the
3502
+ * result is a new body, `data` is untouched.
3503
+ */
3504
+ var REMOVE_LEAF = Symbol("remove-leaf");
3505
+ function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
3506
+ if (!isRecord$1(node)) return node;
3507
+ const segment = segments[index];
3508
+ if (segment === void 0) return node;
3509
+ if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
3510
+ const child = node[segment.key];
3511
+ const keys = [...walkedKeys, segment.key];
3512
+ const last = index === segments.length - 1;
3513
+ if (segment.each) {
3514
+ if (!Array.isArray(child)) return node;
3515
+ const prefix = keys.join(".");
3516
+ const idKey = arrayKeys[prefix];
3517
+ if (idKey === void 0) throw new InvalidRecordError(`"${declared}": no id key declared for the array "${prefix}"`);
3518
+ const mapped = child.map((element) => {
3519
+ const id = elementId(element, idKey, declared, prefix);
3520
+ const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}[${encodeURIComponent(id)}]`;
3521
+ return last ? element : mapAt(element, segments, index + 1, keys, concrete, declared, arrayKeys, visit);
3522
+ });
3523
+ return {
3524
+ ...node,
3525
+ [segment.key]: mapped
3526
+ };
3527
+ }
3528
+ const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
3529
+ if (last) {
3530
+ const replacement = visit({
3531
+ declared,
3532
+ concrete,
3533
+ value: child
3534
+ });
3535
+ if (replacement === REMOVE_LEAF) return Object.fromEntries(Object.entries(node).filter(([key]) => key !== segment.key));
3536
+ return {
3537
+ ...node,
3538
+ [segment.key]: replacement
3539
+ };
3540
+ }
3541
+ return {
3542
+ ...node,
3543
+ [segment.key]: mapAt(child, segments, index + 1, keys, concrete, declared, arrayKeys, visit)
3544
+ };
3545
+ }
3546
+ /** Replace/remove every present secret leaf; returns a NEW body. */
3547
+ function mapSecretLeaves(data, paths, arrayKeys, visit) {
3548
+ let current = data;
3549
+ for (const declared of paths) current = mapAt(current, parseSecretPath(declared), 0, [], "", declared, arrayKeys, visit);
3550
+ return current;
3551
+ }
3552
+ /** Every present secret leaf, read-only. */
3553
+ function collectSecretLeaves(data, paths, arrayKeys) {
3554
+ const found = [];
3555
+ mapSecretLeaves(data, paths, arrayKeys, (leaf) => {
3556
+ found.push(leaf);
3557
+ return leaf.value;
3558
+ });
3559
+ return found;
3560
+ }
3561
+ /**
3562
+ * The keychain collection name a kind's secrets live under. Prefixed so a
3563
+ * record's refs never collide with the refs a legacy collection of the same name
3564
+ * already holds during an adoption.
3565
+ */
3566
+ function recordSecretCollection(kind) {
3567
+ return `${RECORD_SECRET_COLLECTION_PREFIX}${kind}`;
3568
+ }
3569
+ /** The ONE ref a row's secret field may carry: the engine and the facade both build it here. */
3570
+ function recordSecretRef(owner, kind, rowId, concretePath) {
3571
+ return buildSecretRef({
3572
+ owner,
3573
+ scope: {
3574
+ kind: "row",
3575
+ collection: recordSecretCollection(kind),
3576
+ rowId
3577
+ },
3578
+ fieldPath: concretePath
3579
+ });
3580
+ }
3581
+ /**
3582
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
3583
+ * Zod row schema that describes it, and the helper that turns the two into the
3584
+ * JSON the engine stores.
3585
+ *
3586
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
3587
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
3588
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
3589
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
3590
+ * never a field name (D879).
3591
+ */
3592
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
3593
+ var RecordFieldPathSchema = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
3594
+ var RecordIndexSchema = z.object({
3595
+ name: z.string().regex(/^[a-z][a-z0-9_]{0,31}$/),
3596
+ fields: z.array(RecordFieldPathSchema).min(1).max(4),
3597
+ unique: z.boolean().optional()
3598
+ }).strict();
3599
+ var RecordRetentionSchema = z.union([
3600
+ z.object({
3601
+ ttlMs: z.number().int().positive(),
3602
+ from: z.enum(["at", "write"])
3603
+ }).strict(),
3604
+ z.object({
3605
+ maxRows: z.number().int().positive().optional(),
3606
+ maxRowsPerDevice: z.number().int().positive().optional()
3607
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
3608
+ z.object({
3609
+ owner: z.string().min(1),
3610
+ reason: z.string().min(1)
3611
+ }).strict(),
3612
+ z.object({ none: z.string().min(1) }).strict()
3613
+ ]);
3614
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
3615
+ var EntryDescriptorSchema = z.object({
3616
+ title: z.string().min(1),
3617
+ /** The record body field shown as the entry's name. */
3618
+ nameField: z.string().min(1),
3619
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
3620
+ fields: z.record(z.string(), z.unknown())
3621
+ }).strict();
3622
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
3623
+ var RecordKindDeclarationSchema = z.object({
3624
+ database: z.enum(RECORD_DATABASES).default("settings"),
3625
+ class: z.enum(RECORD_CLASSES),
3626
+ writeTrigger: z.string().min(1),
3627
+ device: z.enum([
3628
+ "required",
3629
+ "optional",
3630
+ "none"
3631
+ ]).default("none"),
3632
+ at: z.enum(["required", "none"]).default("none"),
3633
+ indexes: z.array(RecordIndexSchema).max(8).default([]),
3634
+ retention: RecordRetentionSchema,
3635
+ deviceRemoval: z.enum(["delete", "none"]).default("none"),
3636
+ maxDataBytes: z.number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
3637
+ /** Derived from the Zod schema; never written by hand. */
3638
+ secretPaths: z.array(z.string().min(1)).default([]),
3639
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
3640
+ secretArrayKeys: z.record(z.string(), z.string()).default({}),
3641
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
3642
+ adoptsFrom: z.string().min(1).optional(),
3643
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
3644
+ transactFamily: z.string().min(1).optional(),
3645
+ entry: EntryDescriptorSchema.optional()
3646
+ }).strict();
3647
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
3648
+ var RecordKindNameSchema = z.string().regex(/^[a-z][a-z0-9-]{0,47}$/);
3649
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
3650
+ function assertValidDeclaration(name, decl) {
3651
+ const refuse = (why) => {
3652
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
3653
+ };
3654
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
3655
+ const seen = /* @__PURE__ */ new Set();
3656
+ for (const index of decl.indexes) {
3657
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
3658
+ seen.add(index.name);
3659
+ }
3660
+ const { retention } = decl;
3661
+ const hasSecrets = decl.secretPaths.length > 0;
3662
+ if ("ttlMs" in retention) {
3663
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
3664
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
3665
+ }
3666
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
3667
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
3668
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
3669
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
3670
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
3671
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
3672
+ }
3673
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
3674
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
3675
+ }
3269
3676
  /** Shared Zod schemas used across streaming capabilities. */
3270
3677
  var CamProfileSchema = z.enum([
3271
3678
  "high",
@@ -4467,69 +4874,6 @@ var RUNTIME_DEFAULTS = {
4467
4874
  "ffmpeg.threadCount": 0,
4468
4875
  "auth.tokenExpiry": "30d"
4469
4876
  };
4470
- function defOf(schema) {
4471
- return schema._zod?.def ?? {};
4472
- }
4473
- function declaredHere(schema) {
4474
- return z.globalRegistry.get(schema)?.secret === true;
4475
- }
4476
- /** Wrapper kinds whose `innerType` is the field itself. */
4477
- var WRAPPERS = new Set([
4478
- "optional",
4479
- "nullable",
4480
- "default",
4481
- "prefault",
4482
- "catch",
4483
- "readonly",
4484
- "nonoptional"
4485
- ]);
4486
- /**
4487
- * The schema layers that make up ONE field: the schema itself and every
4488
- * wrapper below it (optional / default / nullable / readonly / catch), plus
4489
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
4490
- * `.transform` on `in`).
4491
- */
4492
- function layersOf(schema) {
4493
- const out = [];
4494
- const queue = [schema];
4495
- while (queue.length > 0) {
4496
- const s = queue.shift();
4497
- if (!s || out.includes(s)) continue;
4498
- out.push(s);
4499
- const def = defOf(s);
4500
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
4501
- if (def.type === "pipe") {
4502
- if (def.in) queue.push(def.in);
4503
- if (def.out) queue.push(def.out);
4504
- }
4505
- }
4506
- return out;
4507
- }
4508
- /** True when any layer of this field declares `.meta({ secret: true })`. */
4509
- function isZodSecret(schema) {
4510
- return layersOf(schema).some(declaredHere);
4511
- }
4512
- /**
4513
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
4514
- * element of this array" (`connection.password`, `rows[].token`). A declared
4515
- * object or array is reported as one path and not descended into — everything
4516
- * under it is secret.
4517
- */
4518
- function collectZodSecretPaths(schema, prefix = "") {
4519
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
4520
- const paths = [];
4521
- for (const layer of layersOf(schema)) {
4522
- const def = defOf(layer);
4523
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
4524
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
4525
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
4526
- else if (def.type === "intersection") {
4527
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
4528
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
4529
- }
4530
- }
4531
- return [...new Set(paths)];
4532
- }
4533
4877
  /**
4534
4878
  * A user-facing error with a STABLE code (D863).
4535
4879
  *
@@ -15476,6 +15820,41 @@ function describeComposableCaps(defs, deviceType) {
15476
15820
  }).toSorted((a, b) => a.cap.localeCompare(b.cap));
15477
15821
  }
15478
15822
  /**
15823
+ * The report of a one-shot "move this owner's plaintext secrets into the
15824
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
15825
+ *
15826
+ * The owner runs it on its own rows, through its own write path; an operator
15827
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
15828
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
15829
+ */
15830
+ var RawSecretMigrationInputSchema = z.object({
15831
+ /** `false` (the default of the script) = report only. */
15832
+ apply: z.boolean() });
15833
+ var RawSecretMigrationReportSchema = z.object({
15834
+ apply: z.boolean(),
15835
+ /** Rows that can carry a secret (a profile, an enrolment). */
15836
+ rows: z.number().int(),
15837
+ /** Rows whose secret was plaintext when the run started. */
15838
+ raw: z.number().int(),
15839
+ /** Rows that already held a keychain marker when the run started. */
15840
+ markers: z.number().int(),
15841
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15842
+ migrated: z.number().int(),
15843
+ /** Plaintext rows left in place because the move or its read-back failed. */
15844
+ failed: z.number().int(),
15845
+ /** After the run: rows still holding plaintext. */
15846
+ remainingRaw: z.number().int(),
15847
+ /** After the run: markers the keychain could not resolve right now. */
15848
+ unresolvedMarkers: z.number().int(),
15849
+ /**
15850
+ * A second, redundant copy of the secrets' rows that the run found (and, on
15851
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
15852
+ */
15853
+ redundantCopies: z.number().int().optional(),
15854
+ /** True when nothing is raw and every marker resolves. */
15855
+ verified: z.boolean()
15856
+ });
15857
+ /**
15479
15858
  * core-blocks — user-authored TypeScript, stored in the kernel and executed in
15480
15859
  * its own process.
15481
15860
  *
@@ -15839,14 +16218,16 @@ var coreBlocksCapability = {
15839
16218
  /**
15840
16219
  * Hydrated settings form for one block, or null until a `settingsSchema`
15841
16220
  * is known (extracted from the compiled entry's named export, or set on
15842
- * the block). Values live in the `core-blocks:settings` collection.
16221
+ * the block). Values live in the block addon's `addon-settings` rows (D880);
16222
+ * a password field answers as a "set" view, never the value.
15843
16223
  */
15844
16224
  getBlockSettings: method(z.object({ blockId: z.string() }), SettingsSchemaWithValuesSchema.nullable(), { auth: "admin" }),
15845
16225
  /**
15846
16226
  * Patch persisted preference values for one block. The schema is not
15847
- * rewritten here — only values. Scripts read the same blob via
15848
- * `ctx.settings.readAddonStore()` (mirrored into the block addon's
15849
- * `addon-settings` namespace on every patch).
16227
+ * rewritten here — only values. Scripts read the same rows via
16228
+ * `ctx.settings.readAddonStore()`. A field the schema declares `password` /
16229
+ * `secret: true` is stored in the keychain (owner = the block's addon id)
16230
+ * and the row holds a marker; a REDACTED or view value keeps the stored one.
15850
16231
  */
15851
16232
  updateBlockSettings: method(z.object({
15852
16233
  blockId: z.string(),
@@ -15856,6 +16237,16 @@ var coreBlocksCapability = {
15856
16237
  auth: "admin"
15857
16238
  }),
15858
16239
  /**
16240
+ * D880: move every plaintext password a block's `settingsSchema` declares
16241
+ * into the keychain and delete the legacy `core-blocks:settings` copy. Dry
16242
+ * run unless `apply`; idempotent; counts only. A secret is read back from
16243
+ * the keychain before its row is rewritten.
16244
+ */
16245
+ migrateRawSecrets: method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16246
+ kind: "mutation",
16247
+ auth: "admin"
16248
+ }),
16249
+ /**
15859
16250
  * The declaration files the editor type-checks against.
15860
16251
  *
15861
16252
  * Served rather than bundled: the graph is 3.4 MB across 344 files, and
@@ -16281,6 +16672,276 @@ id: z.union([z.string(), z.number()]) }), {
16281
16672
  })
16282
16673
  }
16283
16674
  };
16675
+ /**
16676
+ * Every cap whose provider reads a `callerAddonId` in its input (the keychain's
16677
+ * owner check, device-history's `not-owner`, records' owner).
16678
+ *
16679
+ * The stamp is set ONLY by the transport (`stampCallerAddonId`, or stated by a
16680
+ * hub in-process caller). The generated HTTP/tRPC mount parses input with
16681
+ * `.loose()`, so without this a session could add the key itself and act as
16682
+ * another addon. The mount strips it for these caps.
16683
+ */
16684
+ var CALLER_STAMPED_CAPABILITIES = [
16685
+ "keychain",
16686
+ "device-history",
16687
+ "records",
16688
+ "integrations",
16689
+ "device-manager"
16690
+ ];
16691
+ /** A copy of `input` without the caller stamp. Anything that is not a plain object passes through. */
16692
+ function withoutCallerStamp(input) {
16693
+ if (input === null || typeof input !== "object" || Array.isArray(input)) return input;
16694
+ if (!Object.prototype.hasOwnProperty.call(input, "callerAddonId")) return input;
16695
+ return Object.fromEntries(Object.entries(input).filter(([key]) => key !== "callerAddonId"));
16696
+ }
16697
+ /**
16698
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16699
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16700
+ * (operator intent, D870) and device-history (numbers over time, D850).
16701
+ *
16702
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16703
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16704
+ * that with the addon id closed over). It is deliberately NOT in any input
16705
+ * schema, so a session can never supply it, and a call with no stamp is refused
16706
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16707
+ * addons go through the owner's capability.
16708
+ *
16709
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16710
+ * never `[]`. Secret fields are never on the wire: a read shows the
16711
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16712
+ * resolves itself, and a write may carry only a keychain marker bound to the
16713
+ * row's own ref.
16714
+ *
16715
+ * Internal: addons reach it through `ctx.records`, never directly.
16716
+ */
16717
+ var RecordIdSchema = z.string().min(1).max(256);
16718
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16719
+ var RecordBodySchema = z.record(z.string(), z.unknown());
16720
+ var RecordInputSchema = z.object({
16721
+ id: RecordIdSchema,
16722
+ /** The device this row belongs to (D865 removal, per-device reads). */
16723
+ deviceId: z.number().int().optional(),
16724
+ /** The domain clock, ms: observed / created / opened. */
16725
+ at: z.number().int().optional(),
16726
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16727
+ expiresAt: z.number().int().optional(),
16728
+ data: RecordBodySchema
16729
+ });
16730
+ var RecordViewSchema = z.object({
16731
+ id: z.string(),
16732
+ deviceId: z.number().int().nullable(),
16733
+ at: z.number().nullable(),
16734
+ expiresAt: z.number().nullable(),
16735
+ rev: z.number().int(),
16736
+ updatedAt: z.number(),
16737
+ data: RecordBodySchema
16738
+ });
16739
+ /** One predicate on a declared index field: equality, a set, or a range. */
16740
+ var RecordWhereValueSchema = z.union([
16741
+ z.string(),
16742
+ z.number(),
16743
+ z.boolean(),
16744
+ z.object({ in: z.array(z.union([
16745
+ z.string(),
16746
+ z.number(),
16747
+ z.boolean()
16748
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16749
+ z.object({
16750
+ gt: z.union([z.string(), z.number()]).optional(),
16751
+ gte: z.union([z.string(), z.number()]).optional(),
16752
+ lt: z.union([z.string(), z.number()]).optional(),
16753
+ lte: z.union([z.string(), z.number()]).optional()
16754
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16755
+ ]);
16756
+ /** Declared index fields only. Anything else does not compile, by design. */
16757
+ var RecordWhereSchema = z.record(RecordFieldPathSchema, RecordWhereValueSchema);
16758
+ var KindShape = { kind: RecordKindNameSchema };
16759
+ var TimeWindowShape = {
16760
+ deviceId: z.number().int().optional(),
16761
+ atFrom: z.number().optional(),
16762
+ atTo: z.number().optional()
16763
+ };
16764
+ var RecordQueryInputSchema = z.object({
16765
+ ...KindShape,
16766
+ ...TimeWindowShape,
16767
+ where: RecordWhereSchema.optional(),
16768
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16769
+ order: z.enum(["at", "id"]).optional(),
16770
+ desc: z.boolean().optional(),
16771
+ limit: z.number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16772
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16773
+ cursor: z.string().min(1).optional()
16774
+ });
16775
+ var RecordQueryResultSchema = z.object({
16776
+ records: z.array(RecordViewSchema),
16777
+ nextCursor: z.string().nullable()
16778
+ });
16779
+ var RecordKindStateSchema = z.enum([
16780
+ "created",
16781
+ "unchanged",
16782
+ "updated"
16783
+ ]);
16784
+ var DeclareKindResultSchema = z.object({
16785
+ kindId: z.number().int(),
16786
+ state: RecordKindStateSchema,
16787
+ createdIndexes: z.array(z.string()),
16788
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16789
+ adoptionPending: z.object({
16790
+ legacyTable: z.string(),
16791
+ legacyRows: z.number().int()
16792
+ }).nullable()
16793
+ });
16794
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16795
+ var SecretRefsList = z.array(z.string());
16796
+ var RecordSecretRefsSchema = z.record(z.string(), z.record(z.string(), z.string()));
16797
+ var recordsCapability = {
16798
+ name: "records",
16799
+ scope: "system",
16800
+ mode: "singleton",
16801
+ internal: true,
16802
+ methods: {
16803
+ /** Reconcile this addon's kinds: create the catalog rows and the declared indexes. Additive only. */
16804
+ declareKinds: method(z.object({ kinds: z.record(RecordKindNameSchema, RecordKindDeclarationSchema) }), z.object({ kinds: z.record(z.string(), DeclareKindResultSchema) }), {
16805
+ kind: "mutation",
16806
+ auth: "admin"
16807
+ }),
16808
+ get: method(z.object({
16809
+ ...KindShape,
16810
+ id: RecordIdSchema
16811
+ }), RecordViewSchema.nullable(), { auth: "admin" }),
16812
+ getMany: method(z.object({
16813
+ ...KindShape,
16814
+ ids: z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16815
+ }), z.array(RecordViewSchema), { auth: "admin" }),
16816
+ /** The keychain refs of the rows' secret fields, by id and concrete path. For the owner's `ctx.secrets`. */
16817
+ secretRefs: method(z.object({
16818
+ ...KindShape,
16819
+ ids: z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16820
+ }), RecordSecretRefsSchema, { auth: "admin" }),
16821
+ put: method(z.object({
16822
+ ...KindShape,
16823
+ record: RecordInputSchema,
16824
+ /** Compare-and-set. `0` means "the row must not exist". */
16825
+ ifRev: z.number().int().min(0).optional()
16826
+ }), z.object({
16827
+ rev: z.number().int(),
16828
+ releasedRefs: SecretRefsList
16829
+ }), {
16830
+ kind: "mutation",
16831
+ auth: "admin"
16832
+ }),
16833
+ putMany: method(z.object({
16834
+ ...KindShape,
16835
+ records: z.array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16836
+ }), z.object({
16837
+ count: z.number().int(),
16838
+ releasedRefs: SecretRefsList
16839
+ }), {
16840
+ kind: "mutation",
16841
+ auth: "admin"
16842
+ }),
16843
+ /** One-statement RFC 7396 merge: `null` removes a field; a merge never reads. */
16844
+ patch: method(z.object({
16845
+ ...KindShape,
16846
+ id: RecordIdSchema,
16847
+ data: RecordBodySchema,
16848
+ at: z.number().int().nullable().optional(),
16849
+ expiresAt: z.number().int().nullable().optional(),
16850
+ ifRev: z.number().int().min(1).optional()
16851
+ }), z.object({
16852
+ rev: z.number().int(),
16853
+ releasedRefs: SecretRefsList
16854
+ }), {
16855
+ kind: "mutation",
16856
+ auth: "admin"
16857
+ }),
16858
+ delete: method(z.object({
16859
+ ...KindShape,
16860
+ id: RecordIdSchema
16861
+ }), z.object({
16862
+ deleted: z.boolean(),
16863
+ secretRefs: SecretRefsList
16864
+ }), {
16865
+ kind: "mutation",
16866
+ auth: "admin"
16867
+ }),
16868
+ deleteMany: method(z.object({
16869
+ ...KindShape,
16870
+ ids: z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16871
+ }), z.object({
16872
+ deleted: z.number().int(),
16873
+ secretRefs: SecretRefsList
16874
+ }), {
16875
+ kind: "mutation",
16876
+ auth: "admin"
16877
+ }),
16878
+ query: method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }),
16879
+ count: method(z.object({
16880
+ ...KindShape,
16881
+ ...TimeWindowShape,
16882
+ where: RecordWhereSchema.optional()
16883
+ }), z.object({ count: z.number().int() }), { auth: "admin" }),
16884
+ histogram: method(z.object({
16885
+ ...KindShape,
16886
+ deviceId: z.number().int().optional(),
16887
+ from: z.number(),
16888
+ to: z.number(),
16889
+ bucketMs: z.number().int().positive()
16890
+ }), z.object({ buckets: z.array(z.object({
16891
+ bucketStart: z.number(),
16892
+ count: z.number().int()
16893
+ })) }), { auth: "admin" }),
16894
+ /** Index-served only: every field must belong to ONE declared index. */
16895
+ aggregate: method(z.object({
16896
+ ...KindShape,
16897
+ op: z.enum([
16898
+ "sum",
16899
+ "min",
16900
+ "max",
16901
+ "count"
16902
+ ]),
16903
+ field: RecordFieldPathSchema.optional(),
16904
+ groupBy: RecordFieldPathSchema.optional(),
16905
+ where: RecordWhereSchema.optional()
16906
+ }), z.object({ rows: z.array(z.object({
16907
+ group: z.union([
16908
+ z.string(),
16909
+ z.number(),
16910
+ z.null()
16911
+ ]),
16912
+ value: z.number().nullable()
16913
+ })) }), { auth: "admin" }),
16914
+ /** Batched (5 000 rows per statement, yielding between). Needs a predicate: there is no "delete all". */
16915
+ deleteWhere: method(z.object({
16916
+ ...KindShape,
16917
+ deviceId: z.number().int().optional(),
16918
+ atBefore: z.number().optional(),
16919
+ where: RecordWhereSchema.optional()
16920
+ }), z.object({
16921
+ deleted: z.number().int(),
16922
+ secretRefs: SecretRefsList
16923
+ }), {
16924
+ kind: "mutation",
16925
+ auth: "admin"
16926
+ }),
16927
+ /** The D865 hook body: every kind of this addon declared `deviceRemoval: 'delete'`. */
16928
+ deleteDevice: method(z.object({
16929
+ deviceId: z.number().int(),
16930
+ kinds: z.array(RecordKindNameSchema).optional()
16931
+ }), z.object({
16932
+ deleted: z.record(z.string(), z.number().int()),
16933
+ secretRefs: SecretRefsList
16934
+ }), {
16935
+ kind: "mutation",
16936
+ auth: "admin"
16937
+ }),
16938
+ /** A monotonically increasing integer per kind (replaces "resume from the highest"). */
16939
+ allocateId: method(z.object(KindShape), z.object({ id: z.number().int() }), {
16940
+ kind: "mutation",
16941
+ auth: "admin"
16942
+ })
16943
+ }
16944
+ };
16284
16945
  /** One table of the settings database. */
16285
16946
  var StorageTableSchema = z.object({
16286
16947
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -16293,6 +16954,28 @@ var StorageTableSchema = z.object({
16293
16954
  /** Declared by an addon since this engine process started (a running addon claims it). */
16294
16955
  declaredThisBoot: z.boolean()
16295
16956
  });
16957
+ /** One declared record kind (D881) as System -> Data shows it. */
16958
+ var StorageKindSchema = z.object({
16959
+ owner: z.string(),
16960
+ kind: z.string(),
16961
+ database: z.enum(["settings", "events"]),
16962
+ class: z.string(),
16963
+ state: z.enum([
16964
+ "declared",
16965
+ "orphaned",
16966
+ "dropped"
16967
+ ]),
16968
+ /** `null` when the caller asked for no counts (`counts: false`). */
16969
+ rows: z.number().int().nonnegative().nullable(),
16970
+ /** Rows x the average size of a sample; null for an empty kind. */
16971
+ bytesEstimate: z.number().int().nonnegative().nullable(),
16972
+ writeTrigger: z.string(),
16973
+ retention: RecordRetentionSchema,
16974
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16975
+ entry: z.boolean(),
16976
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16977
+ declaration: RecordKindDeclarationSchema
16978
+ });
16296
16979
  /**
16297
16980
  * The collections retired by exact name: the D870 ones (their data became keys
16298
16981
  * of the camera's settings) and the three D871 leftovers (the `stats-5m` tables
@@ -16311,7 +16994,16 @@ var STORAGE_ADMIN_MOVED_COLLECTIONS = [
16311
16994
  "pipeline-orchestrator:device-features",
16312
16995
  "pipeline-analytics:stats-5m",
16313
16996
  "pipeline-orchestrator:stats-5m",
16314
- "vec_object_clip"
16997
+ "vec_object_clip",
16998
+ "addon-devices",
16999
+ "sections",
17000
+ "provider-settings",
17001
+ "device-settings",
17002
+ "ai:budgets",
17003
+ "pipeline-analytics:retrain-dataset-versions",
17004
+ "training:dataset-versions",
17005
+ "benchmark:replay-runs",
17006
+ "viewer-settings-snapshots"
16315
17007
  ];
16316
17008
  /** The per-addon blob tables a scoped name may carry. */
16317
17009
  var STORAGE_ADMIN_SCOPED_BASES = [
@@ -16361,6 +17053,103 @@ var storageAdminCapability = {
16361
17053
  }), {
16362
17054
  kind: "mutation",
16363
17055
  auth: "admin"
17056
+ }),
17057
+ /** Every record kind of both files with rows, a size estimate, class and retention (D881). */
17058
+ listKinds: method(z.object({
17059
+ owner: z.string().min(1).optional(),
17060
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17061
+ counts: z.boolean().optional()
17062
+ }), z.object({ kinds: z.array(StorageKindSchema) }), { auth: "admin" }),
17063
+ /**
17064
+ * Read-only diagnosis of ANY owner's kind: the same indexed query as the
17065
+ * owner's, secret fields redacted, audited in the engine log.
17066
+ */
17067
+ readRecords: method(RecordQueryInputSchema.extend({
17068
+ owner: z.string().min(1),
17069
+ kind: RecordKindNameSchema
17070
+ }), RecordQueryResultSchema, { auth: "admin" }),
17071
+ /**
17072
+ * The migration copy path (D881): write rows into a kind AS ITS DECLARED
17073
+ * OWNER. Refused when that owner's manifest does not declare the kind.
17074
+ * Idempotent (a put by id, so a re-run resumes). A secret field carries a
17075
+ * keychain marker bound to the row's own ref - the operator script imports
17076
+ * the value first - and a plain string there is refused.
17077
+ */
17078
+ adoptRecords: method(z.object({
17079
+ owner: z.string().min(1),
17080
+ kind: RecordKindNameSchema,
17081
+ records: z.array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX),
17082
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17083
+ complete: z.boolean().optional()
17084
+ }), z.object({ adopted: z.number().int() }), {
17085
+ kind: "mutation",
17086
+ auth: "admin"
17087
+ })
17088
+ }
17089
+ };
17090
+ /**
17091
+ * record-entries - the ONE admin surface for every list of user-created entries
17092
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17093
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17094
+ *
17095
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17096
+ * the entry body with `secret: true` on every credential field, so a password
17097
+ * field is derived from the schema and never from a name. `putEntry` takes the
17098
+ * redaction token for an untouched secret (the stored value is kept), a string
17099
+ * for a new one, and the clear instruction to remove one. A read never carries
17100
+ * a secret value, and a locked keychain refuses the write with
17101
+ * `records/secret-unavailable` instead of storing plaintext.
17102
+ *
17103
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17104
+ */
17105
+ var EntryKindInfoSchema = z.object({
17106
+ owner: z.string(),
17107
+ kind: RecordKindNameSchema,
17108
+ title: z.string(),
17109
+ nameField: z.string(),
17110
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17111
+ fields: z.record(z.string(), z.unknown()),
17112
+ secretPaths: z.array(z.string()),
17113
+ rows: z.number().int().nonnegative()
17114
+ });
17115
+ var EntryViewSchema = z.object({
17116
+ id: RecordIdSchema,
17117
+ name: z.string(),
17118
+ rev: z.number().int(),
17119
+ updatedAt: z.number(),
17120
+ /** Secret fields hold the redaction token. */
17121
+ data: RecordBodySchema
17122
+ });
17123
+ var EntryAddress = {
17124
+ owner: z.string().min(1),
17125
+ kind: RecordKindNameSchema
17126
+ };
17127
+ var recordEntriesCapability = {
17128
+ name: "record-entries",
17129
+ scope: "system",
17130
+ mode: "singleton",
17131
+ methods: {
17132
+ listEntryKinds: method(z.object({}), z.object({ kinds: z.array(EntryKindInfoSchema) }), { auth: "admin" }),
17133
+ listEntries: method(z.object({ ...EntryAddress }), z.object({ entries: z.array(EntryViewSchema) }), { auth: "admin" }),
17134
+ /** Create (no `id`: one is generated) or edit. `ifRev` guards an edit against a concurrent one. */
17135
+ putEntry: method(z.object({
17136
+ ...EntryAddress,
17137
+ id: RecordIdSchema.optional(),
17138
+ data: RecordBodySchema,
17139
+ ifRev: z.number().int().min(1).optional()
17140
+ }), z.object({
17141
+ id: z.string(),
17142
+ rev: z.number().int()
17143
+ }), {
17144
+ kind: "mutation",
17145
+ auth: "admin"
17146
+ }),
17147
+ deleteEntry: method(z.object({
17148
+ ...EntryAddress,
17149
+ id: RecordIdSchema
17150
+ }), z.object({ deleted: z.boolean() }), {
17151
+ kind: "mutation",
17152
+ auth: "admin"
16364
17153
  })
16365
17154
  }
16366
17155
  };
@@ -41064,36 +41853,6 @@ var llmRuntimeCapability = {
41064
41853
  }
41065
41854
  };
41066
41855
  /**
41067
- * The report of a one-shot "move this owner's plaintext secrets into the
41068
- * keychain" run (D878). COUNTS only - never a value, never a ref.
41069
- *
41070
- * The owner runs it on its own rows, through its own write path; an operator
41071
- * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
41072
- * Dry run (`apply: false`) reports what WOULD move and changes nothing.
41073
- */
41074
- var RawSecretMigrationInputSchema = z.object({
41075
- /** `false` (the default of the script) = report only. */
41076
- apply: z.boolean() });
41077
- var RawSecretMigrationReportSchema = z.object({
41078
- apply: z.boolean(),
41079
- /** Rows that can carry a secret (a profile, an enrolment). */
41080
- rows: z.number().int(),
41081
- /** Rows whose secret was plaintext when the run started. */
41082
- raw: z.number().int(),
41083
- /** Rows that already held a keychain marker when the run started. */
41084
- markers: z.number().int(),
41085
- /** Plaintext rows moved by THIS run (always 0 on a dry run). */
41086
- migrated: z.number().int(),
41087
- /** Plaintext rows left in place because the move or its read-back failed. */
41088
- failed: z.number().int(),
41089
- /** After the run: rows still holding plaintext. */
41090
- remainingRaw: z.number().int(),
41091
- /** After the run: markers the keychain could not resolve right now. */
41092
- unresolvedMarkers: z.number().int(),
41093
- /** True when nothing is raw and every marker resolves. */
41094
- verified: z.boolean()
41095
- });
41096
- /**
41097
41856
  * `llm` — consumer-facing LLM surface (spec §1-§3). Collection-mode: array
41098
41857
  * methods concat-fan across providers; single-row methods route to ONE
41099
41858
  * provider by the `addonId` in the call input (the notification-output
@@ -74755,6 +75514,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
74755
75514
  addonId: null,
74756
75515
  access: "view"
74757
75516
  },
75517
+ "coreBlocks.migrateRawSecrets": {
75518
+ capName: "core-blocks",
75519
+ capScope: "system",
75520
+ addonId: null,
75521
+ access: "create"
75522
+ },
74758
75523
  "coreBlocks.restart": {
74759
75524
  capName: "core-blocks",
74760
75525
  capScope: "system",
@@ -79507,6 +80272,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
79507
80272
  addonId: null,
79508
80273
  access: "create"
79509
80274
  },
80275
+ "recordEntries.deleteEntry": {
80276
+ capName: "record-entries",
80277
+ capScope: "system",
80278
+ addonId: null,
80279
+ access: "delete"
80280
+ },
80281
+ "recordEntries.listEntries": {
80282
+ capName: "record-entries",
80283
+ capScope: "system",
80284
+ addonId: null,
80285
+ access: "view"
80286
+ },
80287
+ "recordEntries.listEntryKinds": {
80288
+ capName: "record-entries",
80289
+ capScope: "system",
80290
+ addonId: null,
80291
+ access: "view"
80292
+ },
80293
+ "recordEntries.putEntry": {
80294
+ capName: "record-entries",
80295
+ capScope: "system",
80296
+ addonId: null,
80297
+ access: "create"
80298
+ },
79510
80299
  "recording.getAvailability": {
79511
80300
  capName: "recording",
79512
80301
  capScope: "device",
@@ -79807,6 +80596,102 @@ var METHOD_ACCESS_MAP = Object.freeze({
79807
80596
  addonId: null,
79808
80597
  access: "view"
79809
80598
  },
80599
+ "records.aggregate": {
80600
+ capName: "records",
80601
+ capScope: "system",
80602
+ addonId: null,
80603
+ access: "view"
80604
+ },
80605
+ "records.allocateId": {
80606
+ capName: "records",
80607
+ capScope: "system",
80608
+ addonId: null,
80609
+ access: "create"
80610
+ },
80611
+ "records.count": {
80612
+ capName: "records",
80613
+ capScope: "system",
80614
+ addonId: null,
80615
+ access: "view"
80616
+ },
80617
+ "records.declareKinds": {
80618
+ capName: "records",
80619
+ capScope: "system",
80620
+ addonId: null,
80621
+ access: "create"
80622
+ },
80623
+ "records.delete": {
80624
+ capName: "records",
80625
+ capScope: "system",
80626
+ addonId: null,
80627
+ access: "delete"
80628
+ },
80629
+ "records.deleteDevice": {
80630
+ capName: "records",
80631
+ capScope: "system",
80632
+ addonId: null,
80633
+ access: "delete"
80634
+ },
80635
+ "records.deleteMany": {
80636
+ capName: "records",
80637
+ capScope: "system",
80638
+ addonId: null,
80639
+ access: "delete"
80640
+ },
80641
+ "records.deleteWhere": {
80642
+ capName: "records",
80643
+ capScope: "system",
80644
+ addonId: null,
80645
+ access: "delete"
80646
+ },
80647
+ "records.get": {
80648
+ capName: "records",
80649
+ capScope: "system",
80650
+ addonId: null,
80651
+ access: "view"
80652
+ },
80653
+ "records.getMany": {
80654
+ capName: "records",
80655
+ capScope: "system",
80656
+ addonId: null,
80657
+ access: "view"
80658
+ },
80659
+ "records.histogram": {
80660
+ capName: "records",
80661
+ capScope: "system",
80662
+ addonId: null,
80663
+ access: "view"
80664
+ },
80665
+ "records.patch": {
80666
+ capName: "records",
80667
+ capScope: "system",
80668
+ addonId: null,
80669
+ access: "create"
80670
+ },
80671
+ "records.put": {
80672
+ capName: "records",
80673
+ capScope: "system",
80674
+ addonId: null,
80675
+ access: "create"
80676
+ },
80677
+ "records.putMany": {
80678
+ capName: "records",
80679
+ capScope: "system",
80680
+ addonId: null,
80681
+ access: "create"
80682
+ },
80683
+ "records.query": {
80684
+ capName: "records",
80685
+ capScope: "system",
80686
+ addonId: null,
80687
+ access: "view"
80688
+ },
80689
+ "records.secretRefs": {
80690
+ capName: "records",
80691
+ capScope: "system",
80692
+ addonId: null,
80693
+ access: "view"
80694
+ },
79810
80695
  "sceneMonitor.captureReference": {
79811
80696
  capName: "scene-monitor",
79812
80697
  capScope: "device",
@@ -80239,18 +81124,36 @@ var METHOD_ACCESS_MAP = Object.freeze({
80239
81124
  addonId: null,
80240
81125
  access: "create"
80241
81126
  },
81127
+ "storageAdmin.adoptRecords": {
81128
+ capName: "storage-admin",
81129
+ capScope: "system",
81130
+ addonId: null,
81131
+ access: "create"
81132
+ },
80242
81133
  "storageAdmin.dropCollection": {
80243
81134
  capName: "storage-admin",
80244
81135
  capScope: "system",
80245
81136
  addonId: null,
80246
81137
  access: "delete"
80247
81138
  },
81139
+ "storageAdmin.listKinds": {
81140
+ capName: "storage-admin",
81141
+ capScope: "system",
81142
+ addonId: null,
81143
+ access: "view"
81144
+ },
80248
81145
  "storageAdmin.listTables": {
80249
81146
  capName: "storage-admin",
80250
81147
  capScope: "system",
80251
81148
  addonId: null,
80252
81149
  access: "view"
80253
81150
  },
81151
+ "storageAdmin.readRecords": {
81152
+ capName: "storage-admin",
81153
+ capScope: "system",
81154
+ addonId: null,
81155
+ access: "view"
81156
+ },
80254
81157
  "storageEvictable.evict": {
80255
81158
  capName: "storage-evictable",
80256
81159
  capScope: "system",
@@ -81887,11 +82790,13 @@ var ALL_CAPABILITY_DEFINITIONS = [
81887
82790
  ptzCapability,
81888
82791
  ptzAutotrackCapability,
81889
82792
  rebootCapability,
82793
+ recordEntriesCapability,
81890
82794
  recordingCapability,
81891
82795
  recordingArchiveCapability,
81892
82796
  recordingExportCapability,
81893
82797
  recordingOnboardCapability,
81894
82798
  recordingSignalCapability,
82799
+ recordsCapability,
81895
82800
  sceneMonitorCapability,
81896
82801
  scriptRunnerCapability,
81897
82802
  serverManagementCapability,
@@ -84110,6 +85015,37 @@ Object.freeze({
84110
85015
  form: "single",
84111
85016
  optional: false
84112
85017
  }],
85018
+ "records.count": [{
85019
+ name: "deviceId",
85020
+ form: "single",
85021
+ optional: true
85022
+ }],
85023
+ "records.deleteDevice": [{
85024
+ name: "deviceId",
85025
+ form: "single",
85026
+ optional: false
85027
+ }],
85028
+ "records.deleteWhere": [{
85029
+ name: "deviceId",
85030
+ form: "single",
85031
+ optional: true
85032
+ }],
85033
+ "records.histogram": [{
85034
+ name: "deviceId",
85035
+ form: "single",
85036
+ optional: true
85037
+ }],
85038
+ "records.putMany": [{
85039
+ name: "records",
85040
+ form: "object-array",
85041
+ optional: false,
85042
+ itemField: "deviceId"
85043
+ }],
85044
+ "records.query": [{
85045
+ name: "deviceId",
85046
+ form: "single",
85047
+ optional: true
85048
+ }],
84113
85049
  "sceneMonitor.captureReference": [{
84114
85050
  name: "deviceId",
84115
85051
  form: "single",
@@ -84226,6 +85162,17 @@ Object.freeze({
84226
85162
  form: "single",
84227
85163
  optional: false
84228
85164
  }],
85165
+ "storageAdmin.adoptRecords": [{
85166
+ name: "records",
85167
+ form: "object-array",
85168
+ optional: false,
85169
+ itemField: "deviceId"
85170
+ }],
85171
+ "storageAdmin.readRecords": [{
85172
+ name: "deviceId",
85173
+ form: "single",
85174
+ optional: true
85175
+ }],
84229
85176
  "streamBroker.acquireEgressTranscode": [{
84230
85177
  name: "deviceId",
84231
85178
  form: "single",
@@ -86270,4 +87217,4 @@ function enumerateInferenceDevices(hw) {
86270
87217
  return out;
86271
87218
  }
86272
87219
  //#endregion
86273
- export { StorageCleanupJobSchema as $, splitTranslationRef as $n, formatSecretScope as $r, gbToBytes as $t, DeclaredDevices as A, pickAppLinkHub as An, errMsg as Ar, databaseSnapshotCapability as At, METHOD_ACCESS_MAP as B, resolveCoreBlockFiles as Bn, WELL_KNOWN_TAB_MAP as Br, deviceStatusCapability as Bt, DAY_NAMES as C, EventCategory as Ci, modeMayWrite as Cn, compositionSourceKey as Cr, coreBlockAddonId as Ct, DEVICE_SAN_CREDENTIAL_PREFIX as D, objectInputDeclaresAddonId as Dn, DeviceFeature as Dr, coreBlocksCapability as Dt, DEVICE_NONCE_TTL_MS as E, normalizeUnit as En, toExpressionValue as Er, coreBlockSourceKind as Et, HUB_MDNS_SERVICE_TYPE as F, reducePoints as Fn, REDACTED_SECRET as Fr, describeComposableCaps as Ft, RecordingStatusSchema as G, runtimeStatePolicyFor as Gn, collectSecretConfigKeys as Gr, evictionPolicyOfLocation as Gt, MOTION_CLOSE_AFTER_MS as H, resolveLocationMode as Hn, asNumber as Hr, enumerateItemArrayFields as Ht, HUB_MDNS_TXT_KEYS as I, replacedFieldKeys as In, RUNTIME_DEFAULTS as Ir, deviceCredentialsCapability as It, STORAGE_ADMIN_SCOPED_BASES as J, scoreRuntimes as Jn, customAction as Jr, extractNestedAddonId as Jt, STORAGE_ACCESS_FALLBACK as K, scopesAllowAddon as Kn, collectZodSecretPaths as Kr, expandContainer as Kt, KEYCHAIN_RESET_TRIGGER_ACTOR as L, resolveAppConnections as Ln, ReadinessRegistry as Lr, deviceExtensionCapability as Lt, FIRST_LEVEL_MACRO_CLASSES as M, platformProbeCapability as Mn, DATAPLANE_SECRET_HEADER as Mr, decodeVectorBase64 as Mt, FieldClaimModeSchema as N, procedureAuthKey as Nn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Nr, defineExtensionSlotProvider as Nt, DEVICE_SAN_USER_PREFIX as O, objectInputDeclaresRequiredDeviceId as On, DeviceRole as Or, createDeviceExtensionProvider as Ot, FieldClaimSchema as P, ptzAutotrackCapability as Pn, DEVICE_STATUS_METHOD as Pr, deriveBatteryPresence as Pt, SsoBridgeClaimsSchema as Q, snapshotCapability as Qn, expandCapMethods as Qr, formatMinutes as Qt, LOG_LEVEL_RANK as R, resolveBucketMs as Rn, ReadinessTimeoutError as Rr, deviceManagerCapability as Rt, DATA_STORE_DATABASES as S, userError as Si, metricsProviderCapability as Sn, compositionSliceKey as Sr, compositionSourceRefs as St, DEVICE_ENROLLMENT_TTL_MS as T, normalizeCoreBlockWrite as Tn, disarmRoseMemory as Tr, coreBlockIdFromAddonId as Tt, NetworkTunnelStartedDataSchema as U, resolveMethodAuth as Un, asString$1 as Ur, enumerateSchemaFields as Ut, MINUTES_PER_DAY as V, resolveHubAddressRoles as Vn, asJsonObject as Vr, enumerateInferenceDevices as Vt, RECORDING_SOURCE_CAMSTACK_ADDON as W, resolveNotificationTapAddress as Wn, buildSecretRef as Wr, evaluateCompositionField as Wt, ScopedTokenSchema as X, shortHostname as Xn, emitDownForOwnedCaps as Xr, foldSnapshotByFunction as Xt, STREAM_PROFILE_META as Y, settingsStoreCapability as Yn, defineCustomActions as Yr, filesystemBrowseCapability as Yt, ServerNameSchema as Z, siteZoneKey as Zn, emitReadiness as Zr, formatDeviceRevoker as Zt, CatalogFileSchema as _, secretTreeFromPaths as _i, logLevelAtMost as _n, cloneStatefulExpressionMemory as _r, cameraGridLayoutCapability as _t, ApiKeyRecordSchema as a, isSecretMarker as ai, isLocationEnabled as an, streamCatalogCapability as ar, addonSettingsCapability as at, DATABASE_SNAPSHOT_SUFFIX as b, toSecretFieldView as bi, mayWriteToLocation as bn, compositionFeatureEnabled as br, composerCapability as bt, CAMERA_SWITCH_ORDER as c, nodePin as ci, kebabToCamel as cn, userManagementCapability as cr, authProviderCapability as ct, CATALOG_LANGS as d, parseJsonUnknown as di, legacyAutoLinkIds as dn, vectorDimFromBase64 as dr, batteryCapability as dt, hydrateSchema as ei, interpolate as en, storageAdminCapability as er, StorageLocationModeSchema as et, COMPOSED_ITEM_FIXED_FIELDS as f, parseSecretRef as fi, legacyModeOf as fn, vectorIndexDimConflictError as fr, buildCapabilityLookup as ft, CalendarPreferencesSchema as g, scopeKey as gi, logDestinationCapability as gn, buildFfmpegArgs as gr, calendarsCapability as gt, CORE_BLOCK_ADDON_PREFIX as h, resolveSecretMarkers as hi, locationIconKey as hn, COMPOSER_ADDON_ID as hr, buildStreamParamsConfigSchema as ht, AlertSchema as i, isSecretClear as ii, isDefaultAppConnectionEndpoint as in, storageProviderCapability as ir, addonPagesCapability as it, DeviceStatusSchema as j, planComposition as jn, BaseAddon as jr, declarationOwnerNodeId as jt, DEVICE_TOMBSTONE_RETENTION_MS as k, parseStreamParamsFormPatch as kn, DeviceType as kr, dataStoreProviderCapability as kt, CAMSTACK_APP_LINK_ORIGIN as l, normalizeSecretOwner as li, keychainAdminCapability as ln, validateComposition as lr, backupCapability as lt, CORE_BLOCKS_ADDON_ID as m, resolveCapMount as mi, localNetworkCapability as mn, withLocationMode as mr, buildDeviceSignatureMessage as mt, AGENT_MDNS_TXT_KEYS as n, isEvent as ni, isArrayOutputSchema as nn, storageMigrationCapability as nr, StorageMigrationJobSchema as nt, BaseDevice as o, isSecretMarkerLike as oi, isObjectInput as on, streamQualityLabel as or, addonWidgetsCapability as ot, COMPOSER_RUNNER_ID as p, readinessKey as pi, lifecycleJobSchema as pn, vectorStoreCapability as pr, buildDeviceEnrollmentLink as pt, STORAGE_ADMIN_MOVED_COLLECTIONS as q, scopesAllowDeviceCap as qn, createEvent as qr, expressionContainsBuiltinCall as qt, ALL_CAPABILITY_DEFINITIONS as r, isKeychainStoredField as ri, isCollectionArrayMethod as rn, storageOccupancyCapability as rr, UserRecordSchema as rt, BatteryStatusSchema as s, makeSecretMarker as si, isVoidInput as sn, supportedRuntimes as sr, alertsCapability as st, AGENT_MDNS_SERVICE_TYPE as t, isDeviceConfigCap as ti, isAppLinkBase as tn, storageCapability as tr, StorageLocationTypeSchema as tt, CAP_NAMES_WITH_STATUS as u, parseJsonObject as ui, keychainCapability as un, validateCustomAddress as ur, bareAddonId as ut, CoreBlockSchema as v, sleep as vi, looseSchema as vn, composedDeviceRef as vr, canonicalIconKey as vt, DERIVED_CAMERA_SILENCED_CAP_NAMES as w, motionCapability as wn, createStatefulExpressionMemory as wr, coreBlockComposition as wt, DATABASE_SNAPSHOT_TIMEOUT_MS as x, transformSecretWrite as xi, memoizePinnedFfmpeg as xn, compositionItemFieldPath as xr, compositionFieldKey as xt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as y, toNodeId as yi, mayReadLocation as yn, composedDeviceStableId as yr, checkRoleAddress as yt, LegacyStorageLocationDefaultSchema as z, resolveCoreBlockEntry as zn, SECRET_CLEAR as zr, deviceStateCapability as zt };
87220
+ export { SsoBridgeClaimsSchema as $, EventCategory as $i, shortHostname as $n, ReadinessRegistry as $r, formatMinutes as $t, DEVICE_TOMBSTONE_RETENTION_MS as A, isSecretClear as Ai, parseStreamParamsFormPatch as An, toExpressionValue as Ar, dataStoreProviderCapability as At, LegacyStorageLocationDefaultSchema as B, parseSecretRef as Bi, resolveAppConnections as Bn, DeclarationRefusedError as Br, deviceStateCapability as Bt, DATA_STORE_DATABASES as C, emitReadiness as Ci, metricsProviderCapability as Cn, composedDeviceStableId as Cr, compositionSourceRefs as Ct, DEVICE_NONCE_TTL_MS as D, isDeviceConfigCap as Di, normalizeUnit as Dn, compositionSourceKey as Dr, coreBlockSourceKind as Dt, DEVICE_ENROLLMENT_TTL_MS as E, hydrateSchema as Ei, normalizeCoreBlockWrite as En, compositionSliceKey as Er, coreBlockIdFromAddonId as Et, FieldClaimSchema as F, mapSecretLeaves as Fi, ptzAutotrackCapability as Fn, BaseAddon as Fr, deriveBatteryPresence as Ft, RECORDING_SOURCE_CAMSTACK_ADDON as G, scopeKey as Gi, resolveLocationMode as Gn, PlaintextSecretError as Gr, evaluateCompositionField as Gt, MINUTES_PER_DAY as H, recordSecretRef as Hi, resolveCoreBlockEntry as Hn, ForeignSecretMarkerError as Hr, enumerateInferenceDevices as Ht, HUB_MDNS_SERVICE_TYPE as I, nodePin as Ii, recordEntriesCapability as In, BatchTooLargeError as Ir, describeComposableCaps as It, STORAGE_ADMIN_MOVED_COLLECTIONS as J, sleep as Ji, runtimeStatePolicyFor as Jn, RECORD_DELETE_BATCH as Jr, expressionContainsBuiltinCall as Jt, RecordingStatusSchema as K, secretTreeFromPaths as Ki, resolveMethodAuth as Kn, RECORD_BATCH_MAX as Kr, evictionPolicyOfLocation as Kt, HUB_MDNS_TXT_KEYS as L, normalizeSecretOwner as Li, recordsCapability as Ln, DATAPLANE_SECRET_HEADER as Lr, deviceCredentialsCapability as Lt, DeviceStatusSchema as M, isSecretMarkerLike as Mi, planComposition as Mn, DeviceRole as Mr, declarationOwnerNodeId as Mt, FIRST_LEVEL_MACRO_CLASSES as N, isSecretRefOwnedBy as Ni, platformProbeCapability as Nn, DeviceType as Nr, decodeVectorBase64 as Nt, DEVICE_SAN_CREDENTIAL_PREFIX as O, isEvent as Oi, objectInputDeclaresAddonId as On, createStatefulExpressionMemory as Or, coreBlocksCapability as Ot, FieldClaimModeSchema as P, makeSecretMarker as Pi, procedureAuthKey as Pn, errMsg as Pr, defineExtensionSlotProvider as Pt, ServerNameSchema as Q, userError as Qi, settingsStoreCapability as Qn, RUNTIME_DEFAULTS as Qr, formatDeviceRevoker as Qt, KEYCHAIN_RESET_TRIGGER_ACTOR as R, parseJsonObject as Ri, reducePoints as Rn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Rr, deviceExtensionCapability as Rt, DATABASE_SNAPSHOT_TIMEOUT_MS as S, emitDownForOwnedCaps as Si, memoizePinnedFfmpeg as Sn, composedDeviceRef as Sr, compositionFieldKey as St, DERIVED_CAMERA_SILENCED_CAP_NAMES as T, formatSecretScope as Ti, motionCapability as Tn, compositionItemFieldPath as Tr, coreBlockComposition as Tt, MOTION_CLOSE_AFTER_MS as U, resolveCapMount as Ui, resolveCoreBlockFiles as Un, InvalidRecordError as Ur, enumerateItemArrayFields as Ut, METHOD_ACCESS_MAP as V, readinessKey as Vi, resolveBucketMs as Vn, FilterRequiredError as Vr, deviceStatusCapability as Vt, NetworkTunnelStartedDataSchema as W, resolveSecretMarkers as Wi, resolveHubAddressRoles as Wn, NoCallerError as Wr, enumerateSchemaFields as Wt, STREAM_PROFILE_META as X, toSecretFieldView as Xi, scopesAllowDeviceCap as Xn, REDACTED_SECRET as Xr, filesystemBrowseCapability as Xt, STORAGE_ADMIN_SCOPED_BASES as Y, toNodeId as Yi, scopesAllowAddon as Yn, RECORD_SWEEP_INTERVAL_MS as Yr, extractNestedAddonId as Yt, ScopedTokenSchema as Z, transformSecretWrite as Zi, scoreRuntimes as Zn, REMOVE_LEAF as Zr, foldSnapshotByFunction as Zt, CalendarPreferencesSchema as _, collectSecretMarkerRefs as _i, logDestinationCapability as _n, withLocationMode as _r, calendarsCapability as _t, ApiKeyRecordSchema as a, RevConflictError as ai, isDefaultAppConnectionEndpoint as an, storageMigrationCapability as ar, addonPagesCapability as at, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as b, customAction as bi, mayReadLocation as bn, buildFfmpegArgs as br, checkRoleAddress as bt, CALLER_STAMPED_CAPABILITIES as c, UnknownRecordKindError as ci, isVoidInput as cn, streamCatalogCapability as cr, alertsCapability as ct, CAP_NAMES_WITH_STATUS as d, asNumber as di, keychainCapability as dn, userManagementCapability as dr, bareAddonId as dt, ReadinessTimeoutError as ei, gbToBytes as en, siteZoneKey as er, StorageCleanupJobSchema as et, CATALOG_LANGS as f, asString$1 as fi, legacyAutoLinkIds as fn, validateComposition as fr, batteryCapability as ft, CORE_BLOCK_ADDON_PREFIX as g, collectSecretLeaves as gi, locationIconKey as gn, vectorStoreCapability as gr, buildStreamParamsConfigSchema as gt, CORE_BLOCKS_ADDON_ID as h, collectSecretConfigKeys as hi, localNetworkCapability as hn, vectorIndexDimConflictError as hr, buildDeviceSignatureMessage as ht, AlertSchema as i, RecordUniqueViolationError as ii, isCollectionArrayMethod as in, storageCapability as ir, UserRecordSchema as it, DeclaredDevices as j, isSecretMarker as ji, pickAppLinkHub as jn, DeviceFeature as jr, databaseSnapshotCapability as jt, DEVICE_SAN_USER_PREFIX as k, isKeychainStoredField as ki, objectInputDeclaresRequiredDeviceId as kn, disarmRoseMemory as kr, createDeviceExtensionProvider as kt, CAMERA_SWITCH_ORDER as l, WELL_KNOWN_TAB_MAP as li, kebabToCamel as ln, streamQualityLabel as lr, authProviderCapability as lt, COMPOSER_RUNNER_ID as m, buildSecretRef as mi, lifecycleJobSchema as mn, vectorDimFromBase64 as mr, buildDeviceEnrollmentLink as mt, AGENT_MDNS_TXT_KEYS as n, RecordNotFoundError as ni, isAppLinkBase as nn, splitTranslationRef as nr, StorageLocationTypeSchema as nt, BaseDevice as o, SECRET_CLEAR as oi, isLocationEnabled as on, storageOccupancyCapability as or, addonSettingsCapability as ot, COMPOSED_ITEM_FIXED_FIELDS as p, assertValidDeclaration as pi, legacyModeOf as pn, validateCustomAddress as pr, buildCapabilityLookup as pt, STORAGE_ACCESS_FALLBACK as q, secretTreeFromSchema as qi, resolveNotificationTapAddress as qn, RECORD_BATCH_MAX_BYTES as qr, expandContainer as qt, ALL_CAPABILITY_DEFINITIONS as r, RecordTooLargeError as ri, isArrayOutputSchema as rn, storageAdminCapability as rr, StorageMigrationJobSchema as rt, BatteryStatusSchema as s, UnindexedFilterError as si, isObjectInput as sn, storageProviderCapability as sr, addonWidgetsCapability as st, AGENT_MDNS_SERVICE_TYPE as t, RecordKindDeclarationSchema as ti, interpolate as tn, snapshotCapability as tr, StorageLocationModeSchema as tt, CAMSTACK_APP_LINK_ORIGIN as u, asJsonObject as ui, keychainAdminCapability as un, supportedRuntimes as ur, backupCapability as ut, CatalogFileSchema as v, collectZodSecretPaths as vi, logLevelAtMost as vn, withoutCallerStamp as vr, cameraGridLayoutCapability as vt, DAY_NAMES as w, expandCapMethods as wi, modeMayWrite as wn, compositionFeatureEnabled as wr, coreBlockAddonId as wt, DATABASE_SNAPSHOT_SUFFIX as x, defineCustomActions as xi, mayWriteToLocation as xn, cloneStatefulExpressionMemory as xr, composerCapability as xt, CoreBlockSchema as y, createEvent as yi, looseSchema as yn, COMPOSER_ADDON_ID as yr, canonicalIconKey as yt, LOG_LEVEL_RANK as z, parseJsonUnknown as zi, replacedFieldKeys as zn, DEVICE_STATUS_METHOD as zr, deviceManagerCapability as zt };