@camstack/system 1.2.439 → 1.2.441

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 (103) hide show
  1. package/dist/addon-runner.js +743 -79
  2. package/dist/addon-runner.mjs +743 -79
  3. package/dist/addon-utils.js +1 -1
  4. package/dist/addon-utils.mjs +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  9. package/dist/builtins/alerts/alerts.addon.js +1 -1
  10. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  11. package/dist/builtins/autotrack/index.js +1 -1
  12. package/dist/builtins/autotrack/index.mjs +1 -1
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  14. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  15. package/dist/builtins/calendars/calendars.addon.js +1 -1
  16. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  17. package/dist/builtins/camera-grid/index.js +1 -1
  18. package/dist/builtins/camera-grid/index.mjs +1 -1
  19. package/dist/builtins/composer/composer.addon.js +2 -2
  20. package/dist/builtins/composer/composer.addon.mjs +2 -2
  21. package/dist/builtins/console-logging/index.js +1 -1
  22. package/dist/builtins/console-logging/index.mjs +1 -1
  23. package/dist/builtins/core-blocks/block-settings-store.d.ts +1 -1
  24. package/dist/builtins/core-blocks/core-blocks.addon.js +77 -11
  25. package/dist/builtins/core-blocks/core-blocks.addon.mjs +77 -12
  26. package/dist/builtins/core-blocks/index.mjs +1 -1
  27. package/dist/builtins/device-manager/device-manager.addon.js +181 -59
  28. package/dist/builtins/device-manager/device-manager.addon.mjs +180 -60
  29. package/dist/builtins/device-manager/device-removal-hooks.d.ts +0 -11
  30. package/dist/builtins/hub-forwarder/index.js +1 -1
  31. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  32. package/dist/builtins/keychain/index.js +29 -11
  33. package/dist/builtins/keychain/index.mjs +29 -11
  34. package/dist/builtins/keychain/keychain-service.d.ts +8 -0
  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 +1 -1
  44. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  45. package/dist/builtins/platform-probe/index.js +1 -1
  46. package/dist/builtins/platform-probe/index.mjs +1 -1
  47. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  48. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  49. package/dist/builtins/snapshot/index.js +1 -1
  50. package/dist/builtins/snapshot/index.mjs +1 -1
  51. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  52. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  53. package/dist/builtins/sqlite-storage/index.js +1 -1
  54. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  55. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +38 -7
  56. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +69 -3
  57. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +69 -3
  58. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +31 -0
  59. package/dist/builtins/storage-orchestrator/hub-settings-forward.d.ts +3 -3
  60. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +4 -4
  61. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +4 -4
  62. package/dist/builtins/system-config/system-config.addon.js +2 -2
  63. package/dist/builtins/system-config/system-config.addon.mjs +2 -2
  64. package/dist/builtins/winston-logging/index.js +1 -1
  65. package/dist/builtins/winston-logging/index.mjs +1 -1
  66. package/dist/{composition-sources-B4jC2FC7.js → composition-sources-BG-W2U0d.js} +1 -1
  67. package/dist/{composition-sources-BGOSCGWa.mjs → composition-sources-ByNISOnW.mjs} +1 -1
  68. package/dist/{constants-B92BjObl.mjs → constants-DJILnUSb.mjs} +1 -1
  69. package/dist/{constants-BRsjQwi-.js → constants-UojhAJcm.js} +1 -1
  70. package/dist/{device-ca-DHG9OW2m.js → device-ca-196DAEZT.js} +1 -1
  71. package/dist/{device-ca-46BUsWD1.mjs → device-ca-D8Ri9TVz.mjs} +1 -1
  72. package/dist/{dist-yI6kF6r6.mjs → dist-BWvkuc31.mjs} +248 -27
  73. package/dist/{dist-BOWdLjoK.js → dist-BiTCcaf-.js} +265 -26
  74. package/dist/file-host-worker.js +1 -1
  75. package/dist/file-host-worker.mjs +1 -1
  76. package/dist/{hub-mdns-ciao-DGwVc2uh.mjs → hub-mdns-ciao-Cnd0bTB9.mjs} +1 -1
  77. package/dist/{hub-mdns-ciao-D7S5AJRU.js → hub-mdns-ciao-DOBTq8qr.js} +1 -1
  78. package/dist/index.js +336 -336
  79. package/dist/index.mjs +337 -337
  80. package/dist/kernel/addon-settings-store.d.ts +43 -0
  81. package/dist/kernel/config-manager.d.ts +0 -19
  82. package/dist/kernel/device-settings-store.d.ts +74 -0
  83. package/dist/kernel/legacy-blob-guard.d.ts +58 -0
  84. package/dist/kernel/moleculer/runner-addon-settings.d.ts +34 -0
  85. package/dist/kernel/moleculer/runner-device-settings.d.ts +39 -0
  86. package/dist/kernel/prefix-walk.d.ts +39 -0
  87. package/dist/kernel/sections-store.d.ts +20 -0
  88. package/dist/kernel/settings-door-view.d.ts +2 -2
  89. package/dist/kernel/settings-view-types.d.ts +5 -30
  90. package/dist/kernel/store-settings-view.d.ts +0 -3
  91. package/dist/prefix-range-D_KueXbQ.js +27 -0
  92. package/dist/prefix-range-Dl0znowN.mjs +22 -0
  93. package/dist/prefix-walk-DAOBSyH1.mjs +88 -0
  94. package/dist/prefix-walk-Dv6MLZlM.js +99 -0
  95. package/dist/{restore-archive-CpdUO-uS.mjs → restore-archive-4ziluTU3.mjs} +1 -1
  96. package/dist/{restore-archive-DiGiI6Jp.js → restore-archive-CfSSjKnA.js} +1 -1
  97. package/dist/{retired-settings-keys-UsVtLOT0.mjs → retired-settings-keys-Bhwe4ymb.mjs} +2 -2
  98. package/dist/{retired-settings-keys-CyQ7uvta.js → retired-settings-keys-D_VwZiDt.js} +10 -4
  99. package/dist/{wal-maintenance-xsvdT5Go.mjs → wal-maintenance-B57SAp4a.mjs} +0 -0
  100. package/dist/{wal-maintenance-DEL_jeG0.js → wal-maintenance-CgZTNWAz.js} +0 -0
  101. package/package.json +5 -2
  102. package/dist/{custom-action-registry-Bf_YnagS.js → custom-action-registry-BKmoaqG0.js} +1 -1
  103. package/dist/{custom-action-registry-BQnbN0DP.mjs → custom-action-registry-CyUuhATc.mjs} +1 -1
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
7
- const require_device_ca = require("../../device-ca-DHG9OW2m.js");
8
- const require_constants = require("../../constants-BRsjQwi-.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
+ const require_device_ca = require("../../device-ca-196DAEZT.js");
8
+ const require_constants = require("../../constants-UojhAJcm.js");
9
9
  const require_platform_key_source = require("../../platform-key-source-Di7HrlGR.js");
10
10
  let node_crypto = require("node:crypto");
11
11
  let _camstack_types_node = require("@camstack/types/node");
@@ -388,6 +388,8 @@ var NOT_INITIALIZED = {
388
388
  state: "locked",
389
389
  reason: "not-initialized"
390
390
  };
391
+ /** The only refs `importSecret` accepts: a camera's restream tokens (D870 migration). */
392
+ var IMPORTABLE_REF = /^secret:\/\/stream-broker\/device\/[0-9]+\/rtspTokens$/;
391
393
  var KeychainService = class {
392
394
  deps;
393
395
  unlock = NOT_INITIALIZED;
@@ -782,6 +784,17 @@ var KeychainService = class {
782
784
  const ref = SYSTEM_HELD_SECRET_REFS[name];
783
785
  return this.put(require_device_ca.SYSTEM_SECRET_OWNER, ref, value, `user:${userId}`);
784
786
  }
787
+ /**
788
+ * An operator tool stores a carried-over value at an addon's own ref (D870).
789
+ * Stored under the ref's owner, audited as the operator.
790
+ */
791
+ async importSecret(userId, ref, value) {
792
+ if (!IMPORTABLE_REF.test(ref)) throw new Error(`keychain: "${ref}" is not an importable ref (restream tokens only)`);
793
+ if ((await this.deps.repo.getSecrets([ref])).has(ref)) throw new Error(`keychain: a value is already stored at ${ref} - import refuses to overwrite`);
794
+ const parts = require_dist.parseSecretRef(ref);
795
+ if (parts === null) throw new Error(`keychain: "${ref}" is not a secret ref`);
796
+ return this.put(parts.owner, ref, value, `user:${userId}`);
797
+ }
785
798
  async listAudit(limit) {
786
799
  return this.deps.repo.listAudit(limit);
787
800
  }
@@ -1670,24 +1683,28 @@ async function blobsFor(door, owner, scope) {
1670
1683
  switch (scope.kind) {
1671
1684
  case "global":
1672
1685
  case "node": {
1673
- const forked = await door.get({
1686
+ const legacyBlob = await door.get({
1674
1687
  namespace: owner,
1675
1688
  collection: "addon-settings",
1676
1689
  key: "root"
1677
1690
  });
1678
- const inProcess = await prefixRows(door, "addon-settings", `${owner}.`);
1679
- if (inProcess === null) return null;
1680
- return [forked, ...inProcess];
1691
+ const rows = await prefixRows(door, "addon-settings", `${owner}.`);
1692
+ return rows === null ? null : [legacyBlob, ...rows];
1681
1693
  }
1682
1694
  case "device": {
1683
- const forked = await door.get({
1695
+ const legacyBlob = await door.get({
1684
1696
  namespace: owner,
1685
1697
  collection: "addon-devices",
1686
1698
  key: String(scope.deviceId)
1687
1699
  });
1688
- const doorRows = await prefixRows(door, "addon-device-settings", `device-manager:${scope.deviceId}.`);
1689
- if (doorRows === null) return null;
1690
- return [forked, ...doorRows];
1700
+ const own = await prefixRows(door, "addon-device-settings", `${owner}:${scope.deviceId}.`);
1701
+ const connection = owner === "device-manager" ? [] : await prefixRows(door, "addon-device-settings", `device-manager:${scope.deviceId}.`);
1702
+ if (own === null || connection === null) return null;
1703
+ return [
1704
+ legacyBlob,
1705
+ ...own,
1706
+ ...connection
1707
+ ];
1691
1708
  }
1692
1709
  case "integration": return (await door.query({
1693
1710
  collection: "integration_settings",
@@ -1861,6 +1878,7 @@ var KeychainAddon = class extends require_dist.BaseAddon {
1861
1878
  listAudit: (input) => service.listAudit(input.limit ?? 100),
1862
1879
  reveal: (input) => service.reveal(input.caller.userId, input.ref),
1863
1880
  setSystemSecret: (input) => service.setSystemSecret(input.caller.userId, input.name, input.value),
1881
+ importSecret: (input) => service.importSecret(input.caller.userId, input.ref, input.value),
1864
1882
  deleteOrphans: (input) => service.deleteOrphans(input.caller.userId, input.refs),
1865
1883
  rotateMasterKey: (input) => service.rotateMasterKey(input.caller.userId),
1866
1884
  purgeRetiredKeys: async (input) => ({ purged: await service.purgeRetiredKeys(input.caller.userId) }),
@@ -1,6 +1,6 @@
1
- import { L as KEYCHAIN_RESET_TRIGGER_ACTOR, Or as BaseAddon, Xr as formatSecretScope, ai as normalizeSecretOwner, ci as parseSecretRef, cn as keychainCapability, sn as keychainAdminCapability, yi as EventCategory } from "../../dist-yI6kF6r6.mjs";
2
- import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-46BUsWD1.mjs";
3
- import { a as MESH_CA_KEY_REF } from "../../constants-B92BjObl.mjs";
1
+ import { $r as formatSecretScope, L as KEYCHAIN_RESET_TRIGGER_ACTOR, Si as EventCategory, ci as normalizeSecretOwner, di as parseSecretRef, jr as BaseAddon, ln as keychainAdminCapability, un as keychainCapability } from "../../dist-BWvkuc31.mjs";
2
+ import { d as JWT_SIGNING_KEY_REF, n as DEVICE_CA_KEY_REF, p as SYSTEM_SECRET_OWNER } from "../../device-ca-D8Ri9TVz.mjs";
3
+ import { a as MESH_CA_KEY_REF } from "../../constants-DJILnUSb.mjs";
4
4
  import { n as getPlatformKeychainKey } from "../../platform-key-source-BWlq0jjn.mjs";
5
5
  import { createCipheriv, createDecipheriv, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
6
6
  import { restrictDirToOwnerSync, restrictFileToOwnerSync, writeOwnerOnlyFileSync } from "@camstack/types/node";
@@ -382,6 +382,8 @@ var NOT_INITIALIZED = {
382
382
  state: "locked",
383
383
  reason: "not-initialized"
384
384
  };
385
+ /** The only refs `importSecret` accepts: a camera's restream tokens (D870 migration). */
386
+ var IMPORTABLE_REF = /^secret:\/\/stream-broker\/device\/[0-9]+\/rtspTokens$/;
385
387
  var KeychainService = class {
386
388
  deps;
387
389
  unlock = NOT_INITIALIZED;
@@ -776,6 +778,17 @@ var KeychainService = class {
776
778
  const ref = SYSTEM_HELD_SECRET_REFS[name];
777
779
  return this.put(SYSTEM_SECRET_OWNER, ref, value, `user:${userId}`);
778
780
  }
781
+ /**
782
+ * An operator tool stores a carried-over value at an addon's own ref (D870).
783
+ * Stored under the ref's owner, audited as the operator.
784
+ */
785
+ async importSecret(userId, ref, value) {
786
+ if (!IMPORTABLE_REF.test(ref)) throw new Error(`keychain: "${ref}" is not an importable ref (restream tokens only)`);
787
+ if ((await this.deps.repo.getSecrets([ref])).has(ref)) throw new Error(`keychain: a value is already stored at ${ref} - import refuses to overwrite`);
788
+ const parts = parseSecretRef(ref);
789
+ if (parts === null) throw new Error(`keychain: "${ref}" is not a secret ref`);
790
+ return this.put(parts.owner, ref, value, `user:${userId}`);
791
+ }
779
792
  async listAudit(limit) {
780
793
  return this.deps.repo.listAudit(limit);
781
794
  }
@@ -1664,24 +1677,28 @@ async function blobsFor(door, owner, scope) {
1664
1677
  switch (scope.kind) {
1665
1678
  case "global":
1666
1679
  case "node": {
1667
- const forked = await door.get({
1680
+ const legacyBlob = await door.get({
1668
1681
  namespace: owner,
1669
1682
  collection: "addon-settings",
1670
1683
  key: "root"
1671
1684
  });
1672
- const inProcess = await prefixRows(door, "addon-settings", `${owner}.`);
1673
- if (inProcess === null) return null;
1674
- return [forked, ...inProcess];
1685
+ const rows = await prefixRows(door, "addon-settings", `${owner}.`);
1686
+ return rows === null ? null : [legacyBlob, ...rows];
1675
1687
  }
1676
1688
  case "device": {
1677
- const forked = await door.get({
1689
+ const legacyBlob = await door.get({
1678
1690
  namespace: owner,
1679
1691
  collection: "addon-devices",
1680
1692
  key: String(scope.deviceId)
1681
1693
  });
1682
- const doorRows = await prefixRows(door, "addon-device-settings", `device-manager:${scope.deviceId}.`);
1683
- if (doorRows === null) return null;
1684
- return [forked, ...doorRows];
1694
+ const own = await prefixRows(door, "addon-device-settings", `${owner}:${scope.deviceId}.`);
1695
+ const connection = owner === "device-manager" ? [] : await prefixRows(door, "addon-device-settings", `device-manager:${scope.deviceId}.`);
1696
+ if (own === null || connection === null) return null;
1697
+ return [
1698
+ legacyBlob,
1699
+ ...own,
1700
+ ...connection
1701
+ ];
1685
1702
  }
1686
1703
  case "integration": return (await door.query({
1687
1704
  collection: "integration_settings",
@@ -1855,6 +1872,7 @@ var KeychainAddon = class extends BaseAddon {
1855
1872
  listAudit: (input) => service.listAudit(input.limit ?? 100),
1856
1873
  reveal: (input) => service.reveal(input.caller.userId, input.ref),
1857
1874
  setSystemSecret: (input) => service.setSystemSecret(input.caller.userId, input.name, input.value),
1875
+ importSecret: (input) => service.importSecret(input.caller.userId, input.ref, input.value),
1858
1876
  deleteOrphans: (input) => service.deleteOrphans(input.caller.userId, input.refs),
1859
1877
  rotateMasterKey: (input) => service.rotateMasterKey(input.caller.userId),
1860
1878
  purgeRetiredKeys: async (input) => ({ purged: await service.purgeRetiredKeys(input.caller.userId) }),
@@ -96,6 +96,14 @@ export declare class KeychainService {
96
96
  ref: string;
97
97
  version: number;
98
98
  }>;
99
+ /**
100
+ * An operator tool stores a carried-over value at an addon's own ref (D870).
101
+ * Stored under the ref's owner, audited as the operator.
102
+ */
103
+ importSecret(userId: string, ref: string, value: string): Promise<{
104
+ ref: string;
105
+ version: number;
106
+ }>;
99
107
  listAudit(limit: number): Promise<readonly KeychainAuditEntry[]>;
100
108
  reveal(userId: string, ref: string): Promise<{
101
109
  value: string;
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-BOWdLjoK.js");
3
+ const require_dist = require("../../dist-BiTCcaf-.js");
4
4
  //#region src/builtins/liveness-monitor/liveness-checks.ts
5
5
  var NO_DEVICES = "liveness:no-devices";
6
6
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -1,4 +1,4 @@
1
- import { Dr as errMsg, G as RecordingStatusSchema, Or as BaseAddon, W as RECORDING_SOURCE_CAMSTACK_ADDON, Wr as createEvent, yi as EventCategory } from "../../dist-yI6kF6r6.mjs";
1
+ import { Ar as errMsg, G as RecordingStatusSchema, Si as EventCategory, W as RECORDING_SOURCE_CAMSTACK_ADDON, jr as BaseAddon, qr as createEvent } from "../../dist-BWvkuc31.mjs";
2
2
  //#region src/builtins/liveness-monitor/liveness-checks.ts
3
3
  var NO_DEVICES = "liveness:no-devices";
4
4
  var ALL_OFFLINE = "liveness:all-devices-offline";
@@ -3,10 +3,10 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  const require_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_ms$1 = require("../../ms-LB3giGoU.js");
9
- const require_device_ca = require("../../device-ca-DHG9OW2m.js");
9
+ const require_device_ca = require("../../device-ca-196DAEZT.js");
10
10
  let node_crypto = require("node:crypto");
11
11
  node_crypto = require_chunk.__toESM(node_crypto);
12
12
  let crypto$1 = require("crypto");
@@ -1,8 +1,8 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { E as DEVICE_NONCE_TTL_MS, J as ScopedTokenSchema, Or as BaseAddon, Pt as deviceCredentialsCapability, T as DEVICE_ENROLLMENT_TTL_MS, X as SsoBridgeClaimsSchema, Yt as formatDeviceRevoker, a as ApiKeyRecordSchema, ar as userManagementCapability, dt as buildDeviceEnrollmentLink, ft as buildDeviceSignatureMessage, ot as authProviderCapability, tt as UserRecordSchema, vi as userError } from "../../dist-yI6kF6r6.mjs";
2
+ import { E as DEVICE_NONCE_TTL_MS, It as deviceCredentialsCapability, Q as SsoBridgeClaimsSchema, T as DEVICE_ENROLLMENT_TTL_MS, X as ScopedTokenSchema, Zt as formatDeviceRevoker, a as ApiKeyRecordSchema, cr as userManagementCapability, ct as authProviderCapability, jr as BaseAddon, mt as buildDeviceSignatureMessage, pt as buildDeviceEnrollmentLink, rt as UserRecordSchema, xi as userError } from "../../dist-BWvkuc31.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
4
  import { t as require_ms } from "../../ms-CgH2OFlD.mjs";
5
- import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-46BUsWD1.mjs";
5
+ import { _ as setProcessJwtSigningKey, a as importDevicePublicKey, c as rebuildDeviceCaCertificate, d as JWT_SIGNING_KEY_REF, g as processJwtSigningKey, h as loadJwtSigningKey, i as generateDeviceCa, l as verifyDeviceLeaf, m as getProcessJwtSigningKeyState, n as DEVICE_CA_KEY_REF, o as issueDeviceLeaf, r as DEVICE_CA_SETTINGS_SECTION, s as loadDeviceCa, t as DEVICE_CA_FIELD, u as verifyDeviceSignature } from "../../device-ca-D8Ri9TVz.mjs";
6
6
  import * as crypto$1 from "node:crypto";
7
7
  import { X509Certificate, createHash, randomUUID, timingSafeEqual } from "node:crypto";
8
8
  import nodeCrypto from "crypto";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-BOWdLjoK.js");
4
- const require_hub_mdns_ciao = require("../../hub-mdns-ciao-D7S5AJRU.js");
3
+ const require_dist = require("../../dist-BiTCcaf-.js");
4
+ const require_hub_mdns_ciao = require("../../hub-mdns-ciao-DOBTq8qr.js");
5
5
  let zod = require("zod");
6
6
  let node_net = require("node:net");
7
7
  let node_os = require("node:os");
@@ -1,5 +1,5 @@
1
- import { $t as isAppLinkBase, F as HUB_MDNS_SERVICE_TYPE, Fn as resolveAppConnections, Hn as resolveNotificationTapAddress, I as HUB_MDNS_TXT_KEYS, On as pickAppLinkHub, Or as BaseAddon, U as NetworkTunnelStartedDataSchema, _t as checkRoleAddress, fn as localNetworkCapability, l as CAMSTACK_APP_LINK_ORIGIN, nn as isDefaultAppConnectionEndpoint, sr as validateCustomAddress, yi as EventCategory, zn as resolveHubAddressRoles } from "../../dist-yI6kF6r6.mjs";
2
- import { P as readLanHttpState, a as storeUploadedCertificate, d as servedHttpsLeafFingerprint, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, v as writeExtraSans, w as ensureTlsCert } from "../../hub-mdns-ciao-DGwVc2uh.mjs";
1
+ import { An as pickAppLinkHub, F as HUB_MDNS_SERVICE_TYPE, I as HUB_MDNS_TXT_KEYS, Ln as resolveAppConnections, Si as EventCategory, U as NetworkTunnelStartedDataSchema, Vn as resolveHubAddressRoles, Wn as resolveNotificationTapAddress, in as isDefaultAppConnectionEndpoint, jr as BaseAddon, l as CAMSTACK_APP_LINK_ORIGIN, mn as localNetworkCapability, tn as isAppLinkBase, ur as validateCustomAddress, yt as checkRoleAddress } from "../../dist-BWvkuc31.mjs";
2
+ import { P as readLanHttpState, a as storeUploadedCertificate, d as servedHttpsLeafFingerprint, g as readTlsMode, h as readTlsAccessStatus, i as revertToGeneratedCertificate, j as applyLanHttp, k as DEFAULT_LAN_HTTP_PORT, m as readExtraSans, n as applyCertificateToListener, o as useStoredUploadedCertificate, r as regenerateCertificate, t as createCiaoPublisher, v as writeExtraSans, w as ensureTlsCert } from "../../hub-mdns-ciao-Cnd0bTB9.mjs";
3
3
  import { z } from "zod";
4
4
  import { isIP } from "node:net";
5
5
  import * as os$1 from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  //#region src/builtins/loki-logging/loki-payload.ts
8
8
  /**
9
9
  * Loki rejects a label name that is not a valid Prometheus label
@@ -1,4 +1,4 @@
1
- import { Or as BaseAddon, mn as logDestinationCapability } from "../../dist-yI6kF6r6.mjs";
1
+ import { gn as logDestinationCapability, jr as BaseAddon } from "../../dist-BWvkuc31.mjs";
2
2
  //#region src/builtins/loki-logging/loki-payload.ts
3
3
  /**
4
4
  * Loki rejects a label name that is not a valid Prometheus label
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_os = require("node:os");
9
9
  node_os = require_chunk.__toESM(node_os);
@@ -1,4 +1,4 @@
1
- import { Dr as errMsg, In as resolveBucketMs, Jt as foldSnapshotByFunction, Nn as reducePoints, Or as BaseAddon, Wr as createEvent, bn as metricsProviderCapability, yi as EventCategory } from "../../dist-yI6kF6r6.mjs";
1
+ import { Ar as errMsg, Fn as reducePoints, Rn as resolveBucketMs, Si as EventCategory, Sn as metricsProviderCapability, Xt as foldSnapshotByFunction, jr as BaseAddon, qr as createEvent } from "../../dist-BWvkuc31.mjs";
2
2
  import { access, readFile, readdir } from "node:fs/promises";
3
3
  import * as os$1 from "node:os";
4
4
  import { platform } from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  let node_os = require("node:os");
8
8
  node_os = require_chunk.__toESM(node_os);
9
9
  let node_fs = require("node:fs");
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { An as platformProbeCapability, Dr as errMsg, Jr as emitReadiness, Kn as scoreRuntimes, Or as BaseAddon, yi as EventCategory, zt as enumerateInferenceDevices } from "../../dist-yI6kF6r6.mjs";
2
+ import { Ar as errMsg, Jn as scoreRuntimes, Mn as platformProbeCapability, Si as EventCategory, Vt as enumerateInferenceDevices, Zr as emitReadiness, jr as BaseAddon } from "../../dist-BWvkuc31.mjs";
3
3
  import * as os$1 from "node:os";
4
4
  import * as fs from "node:fs";
5
5
  import { execFile } from "node:child_process";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { Or as BaseAddon, yi as EventCategory } from "../../dist-yI6kF6r6.mjs";
1
+ import { Si as EventCategory, jr as BaseAddon } from "../../dist-BWvkuc31.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Dr as errMsg, Er as DeviceType, Mt as deriveBatteryPresence, Or as BaseAddon, Xn as snapshotCapability, ct as bareAddonId, ii as nodePin, lt as batteryCapability, rr as streamQualityLabel, s as BatteryStatusSchema, wr as DeviceFeature, yi as EventCategory, yn as memoizePinnedFfmpeg } from "../../dist-yI6kF6r6.mjs";
1
+ import { Ar as errMsg, Dr as DeviceFeature, Pt as deriveBatteryPresence, Qn as snapshotCapability, Si as EventCategory, dt as batteryCapability, jr as BaseAddon, kr as DeviceType, or as streamQualityLabel, s as BatteryStatusSchema, si as nodePin, ut as bareAddonId, xn as memoizePinnedFfmpeg } from "../../dist-BWvkuc31.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Or as BaseAddon, qt as filesystemBrowseCapability, tr as storageProviderCapability } from "../../dist-yI6kF6r6.mjs";
1
+ import { Yt as filesystemBrowseCapability, ir as storageProviderCapability, jr as BaseAddon } from "../../dist-BWvkuc31.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-DEL_jeG0.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-CgZTNWAz.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- import { A as SQLITE_PAGE_CACHE_CEILING_KIB, B as sqliteEngineStorm, D as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, F as SQLITE_PROFILE_REPORT_FLOOR_MS, I as SQLITE_PROFILE_REPORT_INTERVAL_MS, L as SQLITE_PROFILE_TOP_N, M as sqliteMmapSizeFor, N as sqlitePageCacheKibFor, O as SQLITE_MMAP_CEILING_BYTES, P as SQLITE_ENGINE_STORM_WALL_SHARE, R as SQLITE_SLOW_CALL_MS, a as WalMaintenance, c as SqliteSettingsBackend, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_PAGE_CACHE_FLOOR_KIB, k as SQLITE_MMAP_FLOOR_BYTES, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SqliteOpProfiler } from "../../wal-maintenance-xsvdT5Go.mjs";
2
+ import { A as SQLITE_PAGE_CACHE_FLOOR_KIB, D as SQLITE_MMAP_CEILING_BYTES, E as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, F as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PROFILE_TOP_N, L as SQLITE_SLOW_CALL_MS, M as sqlitePageCacheKibFor, N as SQLITE_ENGINE_STORM_WALL_SHARE, O as SQLITE_MMAP_FLOOR_BYTES, P as SQLITE_PROFILE_REPORT_FLOOR_MS, R as SqliteOpProfiler, a as WalMaintenance, c as SqliteSettingsBackend, i as WAL_MAINTENANCE_INTERVAL_MS, j as sqliteMmapSizeFor, k as SQLITE_PAGE_CACHE_CEILING_KIB, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqliteEngineStorm } from "../../wal-maintenance-B57SAp4a.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -167,6 +167,8 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
167
167
  * the structured schema owns. Routes set/get/insert/update/query to
168
168
  * typed columns. Every collection MUST be declared here before use. */
169
169
  private readonly declaredCollections;
170
+ /** Tables an addon declared since THIS process started - a running addon claims them. */
171
+ private readonly declaredThisBoot;
170
172
  private readonly runtimeDefaults;
171
173
  /**
172
174
  * Canonical key/value collections — declared with a `(id TEXT PK,
@@ -193,6 +195,23 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
193
195
  private readonly options;
194
196
  constructor(dbPath: string, runtimeDefaults?: Record<string, unknown>, logger?: IScopedLogger, options?: SqliteSettingsBackendOptions);
195
197
  initialize(): Promise<void>;
198
+ /**
199
+ * The declaration a READ needs, or `null` when the table does not exist.
200
+ *
201
+ * A per-addon scoped canonical table (`<addonId>:addon-settings`, ...) is
202
+ * auto-declared on first use, and that used to include a READ: asking
203
+ * `count` or `get` about a scoped name that was never written CREATED the
204
+ * table. A read of a table nobody wrote is "absent" (D870), and creating an
205
+ * empty table per probed name is how an enumeration litters the database.
206
+ */
207
+ private declaredForRead;
208
+ /**
209
+ * Per-addon tables the runner used to keep (`<addonId>:addon-devices`, D870).
210
+ * Nothing writes them any more; they stay READABLE, by their old name, until
211
+ * the migration's drop phase removes them.
212
+ */
213
+ private static readonly LEGACY_SCOPED_KV_COLLECTIONS;
214
+ private declareLegacyScopedKv;
196
215
  private requireDeclared;
197
216
  /**
198
217
  * Decode a single column value off a SQLite row into the JS shape the
@@ -392,13 +411,8 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
392
411
  getAllDevice(deviceId: string): Record<string, unknown>;
393
412
  /** Set a device setting */
394
413
  setDevice(deviceId: string, key: string, value: unknown): void;
395
- getAddonDevice(addonId: string, deviceId: string): Record<string, unknown>;
396
- setAddonDevice(addonId: string, deviceId: string, values: Record<string, unknown>): void;
397
- clearAddonDevice(addonId: string, deviceId: string): void;
398
- private static readonly LEGACY_RUNTIME_STATE_ADDON_ID;
399
414
  /**
400
- * The device's whole cap-slice map. Canonical row first, legacy prefix as the
401
- * fallback. `{}` — never null — when the device has never persisted a slice,
415
+ * The device's whole cap-slice map. `{}` — never null — when the device has never persisted a slice,
402
416
  * because every caller treats the result as a cap map to iterate.
403
417
  */
404
418
  getDeviceRuntimeState(deviceId: string): Record<string, unknown>;
@@ -408,7 +422,7 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
408
422
  * slice the durability policy has since stopped persisting.
409
423
  */
410
424
  setDeviceRuntimeState(deviceId: string, blob: Record<string, unknown>): void;
411
- /** Forget the device's runtime state in BOTH stores (device removal). */
425
+ /** Forget the device's runtime state (device removal). */
412
426
  clearDeviceRuntimeState(deviceId: string): void;
413
427
  /** Seed system-settings with runtime defaults (first boot) */
414
428
  private seedDefaults;
@@ -421,6 +435,23 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
421
435
  /** Which file this backend serves. */
422
436
  getDatabaseId(): DataStoreDatabase;
423
437
  /**
438
+ * Every table of this file with rows and size. READ-ONLY: nothing is created,
439
+ * and no declaration is consulted or changed.
440
+ */
441
+ listTables(ownerPrefix?: string): readonly {
442
+ name: string;
443
+ owner: string | null;
444
+ rows: number;
445
+ bytes: number | null;
446
+ declaredThisBoot: boolean;
447
+ }[];
448
+ /**
449
+ * Drop one table nobody owns (D870 migration, one-shot). Refuses a canonical
450
+ * or engine table, one a running addon declared since boot, a table that is
451
+ * not there, and a row count other than the one the caller stated.
452
+ */
453
+ dropTable(name: string, expectRows: number): number;
454
+ /**
424
455
  * The tables this file's own `_collection_declarations` names — the
425
456
  * placement authority (D851). Read from DISK, not from memory, so a table
426
457
  * created and declared by an earlier life of the process still counts.
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BOWdLjoK.js");
7
- const require_retired_settings_keys = require("../../retired-settings-keys-CyQ7uvta.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-DEL_jeG0.js");
6
+ const require_dist = require("../../dist-BiTCcaf-.js");
7
+ const require_retired_settings_keys = require("../../retired-settings-keys-D_VwZiDt.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-CgZTNWAz.js");
9
9
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
10
10
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
11
11
  let node_fs_promises = require("node:fs/promises");
@@ -1204,6 +1204,68 @@ var PlacementRouter = class {
1204
1204
  }
1205
1205
  };
1206
1206
  //#endregion
1207
+ //#region src/builtins/sqlite-storage/storage-admin-provider.ts
1208
+ /**
1209
+ * The `storage-admin` provider of the SQLite engine (D870): the operator's
1210
+ * maintenance reach into the settings database - list its tables, drop one that
1211
+ * nothing owns any more. Every call is logged with its table and counts.
1212
+ *
1213
+ * `dropCollection` is a one-shot of the D870 migration: remove it, and the
1214
+ * capability's method, once the last hub ran `migrate-device-store.ts --drop`.
1215
+ */
1216
+ var StorageAdminProvider = class {
1217
+ backend;
1218
+ logger;
1219
+ installedOwners;
1220
+ constructor(backend, logger, installedOwners) {
1221
+ this.backend = backend;
1222
+ this.logger = logger;
1223
+ this.installedOwners = installedOwners;
1224
+ }
1225
+ /** May this table be dropped AT ALL? Throws with the reason when not. */
1226
+ async assertDroppable(collection) {
1227
+ const colon = collection.indexOf(":");
1228
+ const base = colon > 0 ? collection.slice(colon + 1) : "";
1229
+ if (colon > 0 && require_dist.STORAGE_ADMIN_SCOPED_BASES.includes(base)) return;
1230
+ if (require_dist.STORAGE_ADMIN_MOVED_COLLECTIONS.includes(collection)) return;
1231
+ if (colon <= 0) throw new Error(`drop refused: "${collection}" is not a scoped table`);
1232
+ const installed = await this.installedOwners().catch((err) => {
1233
+ throw new Error(`drop refused: the installed addons could not be read (${err instanceof Error ? err.message : String(err)})`);
1234
+ });
1235
+ const owner = collection.slice(0, colon);
1236
+ if (installed.has(owner)) throw new Error(`drop refused: "${collection}" belongs to the installed addon "${owner}"`);
1237
+ }
1238
+ async listTables(input) {
1239
+ const tables = this.backend.listTables(input.ownerPrefix);
1240
+ this.logger.info("storage-admin: listed tables", { meta: {
1241
+ tables: tables.length,
1242
+ ownerPrefix: input.ownerPrefix ?? null
1243
+ } });
1244
+ return { tables: [...tables] };
1245
+ }
1246
+ async dropCollection(input) {
1247
+ try {
1248
+ await this.assertDroppable(input.collection);
1249
+ const rows = this.backend.dropTable(input.collection, input.expectRows);
1250
+ this.logger.warn("storage-admin: DROPPED a table", { meta: {
1251
+ collection: input.collection,
1252
+ rows
1253
+ } });
1254
+ return {
1255
+ dropped: true,
1256
+ rows
1257
+ };
1258
+ } catch (err) {
1259
+ this.logger.warn("storage-admin: drop refused", { meta: {
1260
+ collection: input.collection,
1261
+ expectRows: input.expectRows,
1262
+ error: err instanceof Error ? err.message : String(err)
1263
+ } });
1264
+ throw err;
1265
+ }
1266
+ }
1267
+ };
1268
+ //#endregion
1207
1269
  //#region src/builtins/sqlite-storage/retired-collections.ts
1208
1270
  /**
1209
1271
  * The dead tables.
@@ -1420,6 +1482,10 @@ var SqliteSettingsAddon = class extends require_dist.BaseAddon {
1420
1482
  {
1421
1483
  capability: require_dist.databaseSnapshotCapability,
1422
1484
  provider: new DatabaseSnapshotProvider(router)
1485
+ },
1486
+ {
1487
+ capability: require_dist.storageAdminCapability,
1488
+ provider: new StorageAdminProvider(settings.backend, this.ctx.logger.child("StorageAdmin"), async () => new Set((await this.ctx.api.addons.list.query()).map((addon) => addon.manifest.id)))
1423
1489
  }
1424
1490
  ];
1425
1491
  }