@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 = zod.z.object({
3266
3266
  */
3267
3267
  declaredBytes: zod.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 zod.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 = zod.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 = zod.z.object({
3595
+ name: zod.z.string().regex(/^[a-z][a-z0-9_]{0,31}$/),
3596
+ fields: zod.z.array(RecordFieldPathSchema).min(1).max(4),
3597
+ unique: zod.z.boolean().optional()
3598
+ }).strict();
3599
+ var RecordRetentionSchema = zod.z.union([
3600
+ zod.z.object({
3601
+ ttlMs: zod.z.number().int().positive(),
3602
+ from: zod.z.enum(["at", "write"])
3603
+ }).strict(),
3604
+ zod.z.object({
3605
+ maxRows: zod.z.number().int().positive().optional(),
3606
+ maxRowsPerDevice: zod.z.number().int().positive().optional()
3607
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
3608
+ zod.z.object({
3609
+ owner: zod.z.string().min(1),
3610
+ reason: zod.z.string().min(1)
3611
+ }).strict(),
3612
+ zod.z.object({ none: zod.z.string().min(1) }).strict()
3613
+ ]);
3614
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
3615
+ var EntryDescriptorSchema = zod.z.object({
3616
+ title: zod.z.string().min(1),
3617
+ /** The record body field shown as the entry's name. */
3618
+ nameField: zod.z.string().min(1),
3619
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
3620
+ fields: zod.z.record(zod.z.string(), zod.z.unknown())
3621
+ }).strict();
3622
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
3623
+ var RecordKindDeclarationSchema = zod.z.object({
3624
+ database: zod.z.enum(RECORD_DATABASES).default("settings"),
3625
+ class: zod.z.enum(RECORD_CLASSES),
3626
+ writeTrigger: zod.z.string().min(1),
3627
+ device: zod.z.enum([
3628
+ "required",
3629
+ "optional",
3630
+ "none"
3631
+ ]).default("none"),
3632
+ at: zod.z.enum(["required", "none"]).default("none"),
3633
+ indexes: zod.z.array(RecordIndexSchema).max(8).default([]),
3634
+ retention: RecordRetentionSchema,
3635
+ deviceRemoval: zod.z.enum(["delete", "none"]).default("none"),
3636
+ maxDataBytes: zod.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: zod.z.array(zod.z.string().min(1)).default([]),
3639
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
3640
+ secretArrayKeys: zod.z.record(zod.z.string(), zod.z.string()).default({}),
3641
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
3642
+ adoptsFrom: zod.z.string().min(1).optional(),
3643
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
3644
+ transactFamily: zod.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 = zod.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 = zod.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 zod.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 = zod.z.object({
15831
+ /** `false` (the default of the script) = report only. */
15832
+ apply: zod.z.boolean() });
15833
+ var RawSecretMigrationReportSchema = zod.z.object({
15834
+ apply: zod.z.boolean(),
15835
+ /** Rows that can carry a secret (a profile, an enrolment). */
15836
+ rows: zod.z.number().int(),
15837
+ /** Rows whose secret was plaintext when the run started. */
15838
+ raw: zod.z.number().int(),
15839
+ /** Rows that already held a keychain marker when the run started. */
15840
+ markers: zod.z.number().int(),
15841
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
15842
+ migrated: zod.z.number().int(),
15843
+ /** Plaintext rows left in place because the move or its read-back failed. */
15844
+ failed: zod.z.number().int(),
15845
+ /** After the run: rows still holding plaintext. */
15846
+ remainingRaw: zod.z.number().int(),
15847
+ /** After the run: markers the keychain could not resolve right now. */
15848
+ unresolvedMarkers: zod.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: zod.z.number().int().optional(),
15854
+ /** True when nothing is raw and every marker resolves. */
15855
+ verified: zod.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(zod.z.object({ blockId: zod.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(zod.z.object({
15852
16233
  blockId: zod.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: zod.z.union([zod.z.string(), zod.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 = zod.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 = zod.z.record(zod.z.string(), zod.z.unknown());
16720
+ var RecordInputSchema = zod.z.object({
16721
+ id: RecordIdSchema,
16722
+ /** The device this row belongs to (D865 removal, per-device reads). */
16723
+ deviceId: zod.z.number().int().optional(),
16724
+ /** The domain clock, ms: observed / created / opened. */
16725
+ at: zod.z.number().int().optional(),
16726
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16727
+ expiresAt: zod.z.number().int().optional(),
16728
+ data: RecordBodySchema
16729
+ });
16730
+ var RecordViewSchema = zod.z.object({
16731
+ id: zod.z.string(),
16732
+ deviceId: zod.z.number().int().nullable(),
16733
+ at: zod.z.number().nullable(),
16734
+ expiresAt: zod.z.number().nullable(),
16735
+ rev: zod.z.number().int(),
16736
+ updatedAt: zod.z.number(),
16737
+ data: RecordBodySchema
16738
+ });
16739
+ /** One predicate on a declared index field: equality, a set, or a range. */
16740
+ var RecordWhereValueSchema = zod.z.union([
16741
+ zod.z.string(),
16742
+ zod.z.number(),
16743
+ zod.z.boolean(),
16744
+ zod.z.object({ in: zod.z.array(zod.z.union([
16745
+ zod.z.string(),
16746
+ zod.z.number(),
16747
+ zod.z.boolean()
16748
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16749
+ zod.z.object({
16750
+ gt: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
16751
+ gte: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
16752
+ lt: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
16753
+ lte: zod.z.union([zod.z.string(), zod.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 = zod.z.record(RecordFieldPathSchema, RecordWhereValueSchema);
16758
+ var KindShape = { kind: RecordKindNameSchema };
16759
+ var TimeWindowShape = {
16760
+ deviceId: zod.z.number().int().optional(),
16761
+ atFrom: zod.z.number().optional(),
16762
+ atTo: zod.z.number().optional()
16763
+ };
16764
+ var RecordQueryInputSchema = zod.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: zod.z.enum(["at", "id"]).optional(),
16770
+ desc: zod.z.boolean().optional(),
16771
+ limit: zod.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: zod.z.string().min(1).optional()
16774
+ });
16775
+ var RecordQueryResultSchema = zod.z.object({
16776
+ records: zod.z.array(RecordViewSchema),
16777
+ nextCursor: zod.z.string().nullable()
16778
+ });
16779
+ var RecordKindStateSchema = zod.z.enum([
16780
+ "created",
16781
+ "unchanged",
16782
+ "updated"
16783
+ ]);
16784
+ var DeclareKindResultSchema = zod.z.object({
16785
+ kindId: zod.z.number().int(),
16786
+ state: RecordKindStateSchema,
16787
+ createdIndexes: zod.z.array(zod.z.string()),
16788
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16789
+ adoptionPending: zod.z.object({
16790
+ legacyTable: zod.z.string(),
16791
+ legacyRows: zod.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 = zod.z.array(zod.z.string());
16796
+ var RecordSecretRefsSchema = zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.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(zod.z.object({ kinds: zod.z.record(RecordKindNameSchema, RecordKindDeclarationSchema) }), zod.z.object({ kinds: zod.z.record(zod.z.string(), DeclareKindResultSchema) }), {
16805
+ kind: "mutation",
16806
+ auth: "admin"
16807
+ }),
16808
+ get: method(zod.z.object({
16809
+ ...KindShape,
16810
+ id: RecordIdSchema
16811
+ }), RecordViewSchema.nullable(), { auth: "admin" }),
16812
+ getMany: method(zod.z.object({
16813
+ ...KindShape,
16814
+ ids: zod.z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16815
+ }), zod.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(zod.z.object({
16818
+ ...KindShape,
16819
+ ids: zod.z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16820
+ }), RecordSecretRefsSchema, { auth: "admin" }),
16821
+ put: method(zod.z.object({
16822
+ ...KindShape,
16823
+ record: RecordInputSchema,
16824
+ /** Compare-and-set. `0` means "the row must not exist". */
16825
+ ifRev: zod.z.number().int().min(0).optional()
16826
+ }), zod.z.object({
16827
+ rev: zod.z.number().int(),
16828
+ releasedRefs: SecretRefsList
16829
+ }), {
16830
+ kind: "mutation",
16831
+ auth: "admin"
16832
+ }),
16833
+ putMany: method(zod.z.object({
16834
+ ...KindShape,
16835
+ records: zod.z.array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16836
+ }), zod.z.object({
16837
+ count: zod.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(zod.z.object({
16845
+ ...KindShape,
16846
+ id: RecordIdSchema,
16847
+ data: RecordBodySchema,
16848
+ at: zod.z.number().int().nullable().optional(),
16849
+ expiresAt: zod.z.number().int().nullable().optional(),
16850
+ ifRev: zod.z.number().int().min(1).optional()
16851
+ }), zod.z.object({
16852
+ rev: zod.z.number().int(),
16853
+ releasedRefs: SecretRefsList
16854
+ }), {
16855
+ kind: "mutation",
16856
+ auth: "admin"
16857
+ }),
16858
+ delete: method(zod.z.object({
16859
+ ...KindShape,
16860
+ id: RecordIdSchema
16861
+ }), zod.z.object({
16862
+ deleted: zod.z.boolean(),
16863
+ secretRefs: SecretRefsList
16864
+ }), {
16865
+ kind: "mutation",
16866
+ auth: "admin"
16867
+ }),
16868
+ deleteMany: method(zod.z.object({
16869
+ ...KindShape,
16870
+ ids: zod.z.array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16871
+ }), zod.z.object({
16872
+ deleted: zod.z.number().int(),
16873
+ secretRefs: SecretRefsList
16874
+ }), {
16875
+ kind: "mutation",
16876
+ auth: "admin"
16877
+ }),
16878
+ query: method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }),
16879
+ count: method(zod.z.object({
16880
+ ...KindShape,
16881
+ ...TimeWindowShape,
16882
+ where: RecordWhereSchema.optional()
16883
+ }), zod.z.object({ count: zod.z.number().int() }), { auth: "admin" }),
16884
+ histogram: method(zod.z.object({
16885
+ ...KindShape,
16886
+ deviceId: zod.z.number().int().optional(),
16887
+ from: zod.z.number(),
16888
+ to: zod.z.number(),
16889
+ bucketMs: zod.z.number().int().positive()
16890
+ }), zod.z.object({ buckets: zod.z.array(zod.z.object({
16891
+ bucketStart: zod.z.number(),
16892
+ count: zod.z.number().int()
16893
+ })) }), { auth: "admin" }),
16894
+ /** Index-served only: every field must belong to ONE declared index. */
16895
+ aggregate: method(zod.z.object({
16896
+ ...KindShape,
16897
+ op: zod.z.enum([
16898
+ "sum",
16899
+ "min",
16900
+ "max",
16901
+ "count"
16902
+ ]),
16903
+ field: RecordFieldPathSchema.optional(),
16904
+ groupBy: RecordFieldPathSchema.optional(),
16905
+ where: RecordWhereSchema.optional()
16906
+ }), zod.z.object({ rows: zod.z.array(zod.z.object({
16907
+ group: zod.z.union([
16908
+ zod.z.string(),
16909
+ zod.z.number(),
16910
+ zod.z.null()
16911
+ ]),
16912
+ value: zod.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(zod.z.object({
16916
+ ...KindShape,
16917
+ deviceId: zod.z.number().int().optional(),
16918
+ atBefore: zod.z.number().optional(),
16919
+ where: RecordWhereSchema.optional()
16920
+ }), zod.z.object({
16921
+ deleted: zod.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(zod.z.object({
16929
+ deviceId: zod.z.number().int(),
16930
+ kinds: zod.z.array(RecordKindNameSchema).optional()
16931
+ }), zod.z.object({
16932
+ deleted: zod.z.record(zod.z.string(), zod.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(zod.z.object(KindShape), zod.z.object({ id: zod.z.number().int() }), {
16940
+ kind: "mutation",
16941
+ auth: "admin"
16942
+ })
16943
+ }
16944
+ };
16284
16945
  /** One table of the settings database. */
16285
16946
  var StorageTableSchema = zod.z.object({
16286
16947
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -16293,6 +16954,28 @@ var StorageTableSchema = zod.z.object({
16293
16954
  /** Declared by an addon since this engine process started (a running addon claims it). */
16294
16955
  declaredThisBoot: zod.z.boolean()
16295
16956
  });
16957
+ /** One declared record kind (D881) as System -> Data shows it. */
16958
+ var StorageKindSchema = zod.z.object({
16959
+ owner: zod.z.string(),
16960
+ kind: zod.z.string(),
16961
+ database: zod.z.enum(["settings", "events"]),
16962
+ class: zod.z.string(),
16963
+ state: zod.z.enum([
16964
+ "declared",
16965
+ "orphaned",
16966
+ "dropped"
16967
+ ]),
16968
+ /** `null` when the caller asked for no counts (`counts: false`). */
16969
+ rows: zod.z.number().int().nonnegative().nullable(),
16970
+ /** Rows x the average size of a sample; null for an empty kind. */
16971
+ bytesEstimate: zod.z.number().int().nonnegative().nullable(),
16972
+ writeTrigger: zod.z.string(),
16973
+ retention: RecordRetentionSchema,
16974
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16975
+ entry: zod.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(zod.z.object({
17059
+ owner: zod.z.string().min(1).optional(),
17060
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17061
+ counts: zod.z.boolean().optional()
17062
+ }), zod.z.object({ kinds: zod.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: zod.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(zod.z.object({
17079
+ owner: zod.z.string().min(1),
17080
+ kind: RecordKindNameSchema,
17081
+ records: zod.z.array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX),
17082
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17083
+ complete: zod.z.boolean().optional()
17084
+ }), zod.z.object({ adopted: zod.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 = zod.z.object({
17106
+ owner: zod.z.string(),
17107
+ kind: RecordKindNameSchema,
17108
+ title: zod.z.string(),
17109
+ nameField: zod.z.string(),
17110
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17111
+ fields: zod.z.record(zod.z.string(), zod.z.unknown()),
17112
+ secretPaths: zod.z.array(zod.z.string()),
17113
+ rows: zod.z.number().int().nonnegative()
17114
+ });
17115
+ var EntryViewSchema = zod.z.object({
17116
+ id: RecordIdSchema,
17117
+ name: zod.z.string(),
17118
+ rev: zod.z.number().int(),
17119
+ updatedAt: zod.z.number(),
17120
+ /** Secret fields hold the redaction token. */
17121
+ data: RecordBodySchema
17122
+ });
17123
+ var EntryAddress = {
17124
+ owner: zod.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(zod.z.object({}), zod.z.object({ kinds: zod.z.array(EntryKindInfoSchema) }), { auth: "admin" }),
17133
+ listEntries: method(zod.z.object({ ...EntryAddress }), zod.z.object({ entries: zod.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(zod.z.object({
17136
+ ...EntryAddress,
17137
+ id: RecordIdSchema.optional(),
17138
+ data: RecordBodySchema,
17139
+ ifRev: zod.z.number().int().min(1).optional()
17140
+ }), zod.z.object({
17141
+ id: zod.z.string(),
17142
+ rev: zod.z.number().int()
17143
+ }), {
17144
+ kind: "mutation",
17145
+ auth: "admin"
17146
+ }),
17147
+ deleteEntry: method(zod.z.object({
17148
+ ...EntryAddress,
17149
+ id: RecordIdSchema
17150
+ }), zod.z.object({ deleted: zod.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 = zod.z.object({
41075
- /** `false` (the default of the script) = report only. */
41076
- apply: zod.z.boolean() });
41077
- var RawSecretMigrationReportSchema = zod.z.object({
41078
- apply: zod.z.boolean(),
41079
- /** Rows that can carry a secret (a profile, an enrolment). */
41080
- rows: zod.z.number().int(),
41081
- /** Rows whose secret was plaintext when the run started. */
41082
- raw: zod.z.number().int(),
41083
- /** Rows that already held a keychain marker when the run started. */
41084
- markers: zod.z.number().int(),
41085
- /** Plaintext rows moved by THIS run (always 0 on a dry run). */
41086
- migrated: zod.z.number().int(),
41087
- /** Plaintext rows left in place because the move or its read-back failed. */
41088
- failed: zod.z.number().int(),
41089
- /** After the run: rows still holding plaintext. */
41090
- remainingRaw: zod.z.number().int(),
41091
- /** After the run: markers the keychain could not resolve right now. */
41092
- unresolvedMarkers: zod.z.number().int(),
41093
- /** True when nothing is raw and every marker resolves. */
41094
- verified: zod.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",
@@ -86312,12 +87259,24 @@ Object.defineProperty(exports, "BaseDevice", {
86312
87259
  return BaseDevice;
86313
87260
  }
86314
87261
  });
87262
+ Object.defineProperty(exports, "BatchTooLargeError", {
87263
+ enumerable: true,
87264
+ get: function() {
87265
+ return BatchTooLargeError;
87266
+ }
87267
+ });
86315
87268
  Object.defineProperty(exports, "BatteryStatusSchema", {
86316
87269
  enumerable: true,
86317
87270
  get: function() {
86318
87271
  return BatteryStatusSchema;
86319
87272
  }
86320
87273
  });
87274
+ Object.defineProperty(exports, "CALLER_STAMPED_CAPABILITIES", {
87275
+ enumerable: true,
87276
+ get: function() {
87277
+ return CALLER_STAMPED_CAPABILITIES;
87278
+ }
87279
+ });
86321
87280
  Object.defineProperty(exports, "CAMERA_SWITCH_ORDER", {
86322
87281
  enumerable: true,
86323
87282
  get: function() {
@@ -86474,6 +87433,12 @@ Object.defineProperty(exports, "DEVICE_TOMBSTONE_RETENTION_MS", {
86474
87433
  return DEVICE_TOMBSTONE_RETENTION_MS;
86475
87434
  }
86476
87435
  });
87436
+ Object.defineProperty(exports, "DeclarationRefusedError", {
87437
+ enumerable: true,
87438
+ get: function() {
87439
+ return DeclarationRefusedError;
87440
+ }
87441
+ });
86477
87442
  Object.defineProperty(exports, "DeclaredDevices", {
86478
87443
  enumerable: true,
86479
87444
  get: function() {
@@ -86528,6 +87493,18 @@ Object.defineProperty(exports, "FieldClaimSchema", {
86528
87493
  return FieldClaimSchema;
86529
87494
  }
86530
87495
  });
87496
+ Object.defineProperty(exports, "FilterRequiredError", {
87497
+ enumerable: true,
87498
+ get: function() {
87499
+ return FilterRequiredError;
87500
+ }
87501
+ });
87502
+ Object.defineProperty(exports, "ForeignSecretMarkerError", {
87503
+ enumerable: true,
87504
+ get: function() {
87505
+ return ForeignSecretMarkerError;
87506
+ }
87507
+ });
86531
87508
  Object.defineProperty(exports, "HUB_MDNS_SERVICE_TYPE", {
86532
87509
  enumerable: true,
86533
87510
  get: function() {
@@ -86540,6 +87517,12 @@ Object.defineProperty(exports, "HUB_MDNS_TXT_KEYS", {
86540
87517
  return HUB_MDNS_TXT_KEYS;
86541
87518
  }
86542
87519
  });
87520
+ Object.defineProperty(exports, "InvalidRecordError", {
87521
+ enumerable: true,
87522
+ get: function() {
87523
+ return InvalidRecordError;
87524
+ }
87525
+ });
86543
87526
  Object.defineProperty(exports, "KEYCHAIN_RESET_TRIGGER_ACTOR", {
86544
87527
  enumerable: true,
86545
87528
  get: function() {
@@ -86582,18 +87565,60 @@ Object.defineProperty(exports, "NetworkTunnelStartedDataSchema", {
86582
87565
  return NetworkTunnelStartedDataSchema;
86583
87566
  }
86584
87567
  });
87568
+ Object.defineProperty(exports, "NoCallerError", {
87569
+ enumerable: true,
87570
+ get: function() {
87571
+ return NoCallerError;
87572
+ }
87573
+ });
87574
+ Object.defineProperty(exports, "PlaintextSecretError", {
87575
+ enumerable: true,
87576
+ get: function() {
87577
+ return PlaintextSecretError;
87578
+ }
87579
+ });
86585
87580
  Object.defineProperty(exports, "RECORDING_SOURCE_CAMSTACK_ADDON", {
86586
87581
  enumerable: true,
86587
87582
  get: function() {
86588
87583
  return RECORDING_SOURCE_CAMSTACK_ADDON;
86589
87584
  }
86590
87585
  });
87586
+ Object.defineProperty(exports, "RECORD_BATCH_MAX", {
87587
+ enumerable: true,
87588
+ get: function() {
87589
+ return RECORD_BATCH_MAX;
87590
+ }
87591
+ });
87592
+ Object.defineProperty(exports, "RECORD_BATCH_MAX_BYTES", {
87593
+ enumerable: true,
87594
+ get: function() {
87595
+ return RECORD_BATCH_MAX_BYTES;
87596
+ }
87597
+ });
87598
+ Object.defineProperty(exports, "RECORD_DELETE_BATCH", {
87599
+ enumerable: true,
87600
+ get: function() {
87601
+ return RECORD_DELETE_BATCH;
87602
+ }
87603
+ });
87604
+ Object.defineProperty(exports, "RECORD_SWEEP_INTERVAL_MS", {
87605
+ enumerable: true,
87606
+ get: function() {
87607
+ return RECORD_SWEEP_INTERVAL_MS;
87608
+ }
87609
+ });
86591
87610
  Object.defineProperty(exports, "REDACTED_SECRET", {
86592
87611
  enumerable: true,
86593
87612
  get: function() {
86594
87613
  return REDACTED_SECRET;
86595
87614
  }
86596
87615
  });
87616
+ Object.defineProperty(exports, "REMOVE_LEAF", {
87617
+ enumerable: true,
87618
+ get: function() {
87619
+ return REMOVE_LEAF;
87620
+ }
87621
+ });
86597
87622
  Object.defineProperty(exports, "RUNTIME_DEFAULTS", {
86598
87623
  enumerable: true,
86599
87624
  get: function() {
@@ -86612,12 +87637,42 @@ Object.defineProperty(exports, "ReadinessTimeoutError", {
86612
87637
  return ReadinessTimeoutError;
86613
87638
  }
86614
87639
  });
87640
+ Object.defineProperty(exports, "RecordKindDeclarationSchema", {
87641
+ enumerable: true,
87642
+ get: function() {
87643
+ return RecordKindDeclarationSchema;
87644
+ }
87645
+ });
87646
+ Object.defineProperty(exports, "RecordNotFoundError", {
87647
+ enumerable: true,
87648
+ get: function() {
87649
+ return RecordNotFoundError;
87650
+ }
87651
+ });
87652
+ Object.defineProperty(exports, "RecordTooLargeError", {
87653
+ enumerable: true,
87654
+ get: function() {
87655
+ return RecordTooLargeError;
87656
+ }
87657
+ });
87658
+ Object.defineProperty(exports, "RecordUniqueViolationError", {
87659
+ enumerable: true,
87660
+ get: function() {
87661
+ return RecordUniqueViolationError;
87662
+ }
87663
+ });
86615
87664
  Object.defineProperty(exports, "RecordingStatusSchema", {
86616
87665
  enumerable: true,
86617
87666
  get: function() {
86618
87667
  return RecordingStatusSchema;
86619
87668
  }
86620
87669
  });
87670
+ Object.defineProperty(exports, "RevConflictError", {
87671
+ enumerable: true,
87672
+ get: function() {
87673
+ return RevConflictError;
87674
+ }
87675
+ });
86621
87676
  Object.defineProperty(exports, "SECRET_CLEAR", {
86622
87677
  enumerable: true,
86623
87678
  get: function() {
@@ -86690,6 +87745,18 @@ Object.defineProperty(exports, "StorageMigrationJobSchema", {
86690
87745
  return StorageMigrationJobSchema;
86691
87746
  }
86692
87747
  });
87748
+ Object.defineProperty(exports, "UnindexedFilterError", {
87749
+ enumerable: true,
87750
+ get: function() {
87751
+ return UnindexedFilterError;
87752
+ }
87753
+ });
87754
+ Object.defineProperty(exports, "UnknownRecordKindError", {
87755
+ enumerable: true,
87756
+ get: function() {
87757
+ return UnknownRecordKindError;
87758
+ }
87759
+ });
86693
87760
  Object.defineProperty(exports, "UserRecordSchema", {
86694
87761
  enumerable: true,
86695
87762
  get: function() {
@@ -86744,6 +87811,12 @@ Object.defineProperty(exports, "asString", {
86744
87811
  return asString$1;
86745
87812
  }
86746
87813
  });
87814
+ Object.defineProperty(exports, "assertValidDeclaration", {
87815
+ enumerable: true,
87816
+ get: function() {
87817
+ return assertValidDeclaration;
87818
+ }
87819
+ });
86747
87820
  Object.defineProperty(exports, "authProviderCapability", {
86748
87821
  enumerable: true,
86749
87822
  get: function() {
@@ -86840,6 +87913,18 @@ Object.defineProperty(exports, "collectSecretConfigKeys", {
86840
87913
  return collectSecretConfigKeys;
86841
87914
  }
86842
87915
  });
87916
+ Object.defineProperty(exports, "collectSecretLeaves", {
87917
+ enumerable: true,
87918
+ get: function() {
87919
+ return collectSecretLeaves;
87920
+ }
87921
+ });
87922
+ Object.defineProperty(exports, "collectSecretMarkerRefs", {
87923
+ enumerable: true,
87924
+ get: function() {
87925
+ return collectSecretMarkerRefs;
87926
+ }
87927
+ });
86843
87928
  Object.defineProperty(exports, "collectZodSecretPaths", {
86844
87929
  enumerable: true,
86845
87930
  get: function() {
@@ -87230,6 +88315,12 @@ Object.defineProperty(exports, "isSecretMarkerLike", {
87230
88315
  return isSecretMarkerLike;
87231
88316
  }
87232
88317
  });
88318
+ Object.defineProperty(exports, "isSecretRefOwnedBy", {
88319
+ enumerable: true,
88320
+ get: function() {
88321
+ return isSecretRefOwnedBy;
88322
+ }
88323
+ });
87233
88324
  Object.defineProperty(exports, "isVoidInput", {
87234
88325
  enumerable: true,
87235
88326
  get: function() {
@@ -87308,6 +88399,12 @@ Object.defineProperty(exports, "makeSecretMarker", {
87308
88399
  return makeSecretMarker;
87309
88400
  }
87310
88401
  });
88402
+ Object.defineProperty(exports, "mapSecretLeaves", {
88403
+ enumerable: true,
88404
+ get: function() {
88405
+ return mapSecretLeaves;
88406
+ }
88407
+ });
87311
88408
  Object.defineProperty(exports, "mayReadLocation", {
87312
88409
  enumerable: true,
87313
88410
  get: function() {
@@ -87440,6 +88537,24 @@ Object.defineProperty(exports, "readinessKey", {
87440
88537
  return readinessKey;
87441
88538
  }
87442
88539
  });
88540
+ Object.defineProperty(exports, "recordEntriesCapability", {
88541
+ enumerable: true,
88542
+ get: function() {
88543
+ return recordEntriesCapability;
88544
+ }
88545
+ });
88546
+ Object.defineProperty(exports, "recordSecretRef", {
88547
+ enumerable: true,
88548
+ get: function() {
88549
+ return recordSecretRef;
88550
+ }
88551
+ });
88552
+ Object.defineProperty(exports, "recordsCapability", {
88553
+ enumerable: true,
88554
+ get: function() {
88555
+ return recordsCapability;
88556
+ }
88557
+ });
87443
88558
  Object.defineProperty(exports, "reducePoints", {
87444
88559
  enumerable: true,
87445
88560
  get: function() {
@@ -87548,6 +88663,12 @@ Object.defineProperty(exports, "secretTreeFromPaths", {
87548
88663
  return secretTreeFromPaths;
87549
88664
  }
87550
88665
  });
88666
+ Object.defineProperty(exports, "secretTreeFromSchema", {
88667
+ enumerable: true,
88668
+ get: function() {
88669
+ return secretTreeFromSchema;
88670
+ }
88671
+ });
87551
88672
  Object.defineProperty(exports, "settingsStoreCapability", {
87552
88673
  enumerable: true,
87553
88674
  get: function() {
@@ -87704,3 +88825,9 @@ Object.defineProperty(exports, "withLocationMode", {
87704
88825
  return withLocationMode;
87705
88826
  }
87706
88827
  });
88828
+ Object.defineProperty(exports, "withoutCallerStamp", {
88829
+ enumerable: true,
88830
+ get: function() {
88831
+ return withoutCallerStamp;
88832
+ }
88833
+ });