@camstack/system 1.2.59 → 1.2.61

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 (55) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  8. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  9. package/dist/builtins/console-logging/index.js +1 -1
  10. package/dist/builtins/console-logging/index.mjs +1 -1
  11. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  12. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  13. package/dist/builtins/device-manager/device-manager.addon.js +1 -1
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  15. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  16. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  17. package/dist/builtins/hub-forwarder/index.js +1 -1
  18. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  19. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  20. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  21. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  22. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  23. package/dist/builtins/local-network/local-network.addon.js +1 -1
  24. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  25. package/dist/builtins/loki-logging/index.js +1 -1
  26. package/dist/builtins/loki-logging/index.mjs +1 -1
  27. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  28. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  29. package/dist/builtins/platform-probe/index.js +1 -1
  30. package/dist/builtins/platform-probe/index.mjs +1 -1
  31. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  32. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  33. package/dist/builtins/snapshot/index.js +1 -1
  34. package/dist/builtins/snapshot/index.mjs +1 -1
  35. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  36. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/prefix-range.d.ts +50 -0
  38. package/dist/builtins/sqlite-storage/query-bounds.d.ts +116 -0
  39. package/dist/builtins/sqlite-storage/sqlite-pragmas.d.ts +12 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +38 -2
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +281 -19
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +281 -19
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  45. package/dist/builtins/system-config/system-config.addon.js +1 -1
  46. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  47. package/dist/builtins/winston-logging/index.js +1 -1
  48. package/dist/builtins/winston-logging/index.mjs +1 -1
  49. package/dist/{dist-CV6XTApk.js → dist-BN681PgO.js} +974 -18
  50. package/dist/{dist-BqJJWCS8.mjs → dist-L6QPJWsr.mjs} +974 -18
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.js +131 -9
  53. package/dist/index.mjs +126 -9
  54. package/dist/kernel/heap-watch.d.ts +48 -1
  55. package/package.json +1 -1
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { ft as errMsg, m as addonPagesCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { ft as errMsg, m as addonPagesCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as fs from "node:fs";
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
8
8
  let node_crypto = require("node:crypto");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { ft as errMsg, g as addonWidgetsCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { ft as errMsg, g as addonWidgetsCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import * as fs from "node:fs";
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  //#region src/builtins/alerts/prune-policy.ts
8
8
  /**
9
9
  * Ids older than `cutoffMs`, oldest first.
@@ -1,4 +1,4 @@
1
- import { Et as createEvent, _ as alertsCapability, ft as errMsg, n as AlertSchema, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { Et as createEvent, _ as alertsCapability, ft as errMsg, n as AlertSchema, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  //#region src/builtins/alerts/prune-policy.ts
3
3
  /**
4
4
  * Ids older than `cutoffMs`, oldest first.
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs = require("node:fs");
9
9
  let node_fs$1 = require_chunk.__toESM(node_fs, 1);
@@ -1,4 +1,4 @@
1
- import { b as backupCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { b as backupCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  import { randomBytes, randomUUID } from "node:crypto";
3
3
  import * as fs from "node:fs";
4
4
  import Kt from "node:fs";
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/console-logging/console-destination.ts
9
9
  var LEVEL_RANK = {
@@ -1,4 +1,4 @@
1
- import { G as logDestinationCapability, pt as BaseAddon } from "../../dist-BqJJWCS8.mjs";
1
+ import { G as logDestinationCapability, pt as BaseAddon } from "../../dist-L6QPJWsr.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/console-logging/console-destination.ts
4
4
  var LEVEL_RANK = {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CV6XTApk.js");
3
+ const require_dist = require("../../dist-BN681PgO.js");
4
4
  let node_crypto = require("node:crypto");
5
5
  let node_path = require("node:path");
6
6
  node_path = require_chunk.__toESM(node_path);
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM } from "../../chunk-CNf5ZN-e.mjs";
2
- import { C as coreBlocksCapability, o as CoreBlockSchema, pt as BaseAddon } from "../../dist-BqJJWCS8.mjs";
2
+ import { C as coreBlocksCapability, o as CoreBlockSchema, pt as BaseAddon } from "../../dist-L6QPJWsr.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import * as path$1 from "node:path";
5
5
  import * as fs from "node:fs/promises";
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let _camstack_types_node = require("@camstack/types/node");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { D as deviceStateCapability, E as deviceManagerCapability, I as getByPath, M as enumerateSchemaFields, N as evaluateLinkExpression, O as deviceStatusCapability, Rt as sleep, S as buildStreamParamsConfigSchema, St as WELL_KNOWN_TAB_MAP, Y as normalizeUnit, Z as parseStreamParamsFormPatch, _t as DeviceFeature, a as CAP_NAMES_WITH_STATUS, ft as errMsg, j as enumerateItemArrayFields, jt as isDeviceConfigCap, lt as validateExpressionSource, pt as BaseAddon, s as DeviceStatusSchema, st as toExpressionValue, t as ALL_CAPABILITY_DEFINITIONS, tt as setByPath, u as STREAM_PROFILE_META, v as applyTransform, vt as DeviceRole, x as bareAddonId, yt as DeviceType, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { D as deviceStateCapability, E as deviceManagerCapability, I as getByPath, M as enumerateSchemaFields, N as evaluateLinkExpression, O as deviceStatusCapability, Rt as sleep, S as buildStreamParamsConfigSchema, St as WELL_KNOWN_TAB_MAP, Y as normalizeUnit, Z as parseStreamParamsFormPatch, _t as DeviceFeature, a as CAP_NAMES_WITH_STATUS, ft as errMsg, j as enumerateItemArrayFields, jt as isDeviceConfigCap, lt as validateExpressionSource, pt as BaseAddon, s as DeviceStatusSchema, st as toExpressionValue, t as ALL_CAPABILITY_DEFINITIONS, tt as setByPath, u as STREAM_PROFILE_META, v as applyTransform, vt as DeviceRole, x as bareAddonId, yt as DeviceType, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  import { canonicalDeviceFingerprint } from "@camstack/types/node";
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
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  //#region src/builtins/doorbell/trigger-engine.ts
8
8
  /**
9
9
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -1,4 +1,4 @@
1
- import { B as isSameAddonId, Et as createEvent, ft as errMsg, k as doorbellCapability, pt as BaseAddon, x as bareAddonId, yt as DeviceType, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { B as isSameAddonId, Et as createEvent, ft as errMsg, k as doorbellCapability, pt as BaseAddon, x as bareAddonId, yt as DeviceType, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  //#region src/builtins/doorbell/trigger-engine.ts
3
3
  /**
4
4
  * Pure trigger logic for the virtual-doorbell builtin — edge detection over
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
9
9
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -1,4 +1,4 @@
1
- import { G as logDestinationCapability, pt as BaseAddon } from "../../dist-BqJJWCS8.mjs";
1
+ import { G as logDestinationCapability, pt as BaseAddon } from "../../dist-L6QPJWsr.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
4
4
  var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
@@ -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-CV6XTApk.js");
3
+ const require_dist = require("../../dist-BN681PgO.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 { Et as createEvent, ft as errMsg, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { Et as createEvent, ft as errMsg, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.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,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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  node_crypto = require_chunk.__toESM(node_crypto);
9
9
  let crypto$1 = require("crypto");
@@ -1,5 +1,5 @@
1
1
  import { i as __require, o as __toESM, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { ct as userManagementCapability, d as ScopedTokenSchema, p as UserRecordSchema, pt as BaseAddon, r as ApiKeyRecordSchema, y as authProviderCapability } from "../../dist-BqJJWCS8.mjs";
2
+ import { ct as userManagementCapability, d as ScopedTokenSchema, p as UserRecordSchema, pt as BaseAddon, r as ApiKeyRecordSchema, y as authProviderCapability } from "../../dist-L6QPJWsr.mjs";
3
3
  import * as crypto$1 from "node:crypto";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import nodeCrypto from "crypto";
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../../chunk-Cek0wNdY.js");
3
- const require_dist = require("../../dist-CV6XTApk.js");
3
+ const require_dist = require("../../dist-BN681PgO.js");
4
4
  let node_os = require("node:os");
5
5
  node_os = require_chunk.__toESM(node_os);
6
6
  //#region src/builtins/local-network/local-network.addon.ts
@@ -1,4 +1,4 @@
1
- import { W as localNetworkCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { W as localNetworkCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  import * as os from "node:os";
3
3
  //#region src/builtins/local-network/local-network.addon.ts
4
4
  /**
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.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 { G as logDestinationCapability, pt as BaseAddon } from "../../dist-BqJJWCS8.mjs";
1
+ import { G as logDestinationCapability, pt as BaseAddon } from "../../dist-L6QPJWsr.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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let node_fs = require("node:fs");
8
8
  node_fs = require_chunk.__toESM(node_fs);
9
9
  let node_child_process = require("node:child_process");
@@ -1,4 +1,4 @@
1
- import { Et as createEvent, J as metricsProviderCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { Et as createEvent, J as metricsProviderCapability, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
2
2
  import * as fs from "node:fs";
3
3
  import { execFile, execFileSync } from "node:child_process";
4
4
  import { promisify } from "node:util";
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let node_fs = require("node:fs");
8
8
  node_fs = require_chunk.__toESM(node_fs);
9
9
  let node_child_process = require("node:child_process");
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM } from "../../chunk-CNf5ZN-e.mjs";
2
- import { A as enumerateInferenceDevices, Ot as emitReadiness, Q as platformProbeCapability, et as scoreRuntimes, ft as errMsg, pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
2
+ import { A as enumerateInferenceDevices, Ot as emitReadiness, Q as platformProbeCapability, et as scoreRuntimes, ft as errMsg, pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.mjs";
3
3
  import * as fs from "node:fs";
4
4
  import { execFile } from "node:child_process";
5
5
  import { promisify } from "node:util";
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.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 { pt as BaseAddon, zt as EventCategory } from "../../dist-BqJJWCS8.mjs";
1
+ import { pt as BaseAddon, zt as EventCategory } from "../../dist-L6QPJWsr.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
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let node_child_process = require("node:child_process");
8
8
  //#region src/builtins/snapshot/snapshot-coalescing.ts
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { Mt as nodePin, _t as DeviceFeature, ft as errMsg, i as BatteryStatusSchema, ot as streamQualityLabel, pt as BaseAddon, rt as snapshotCapability, x as bareAddonId, yt as DeviceType } from "../../dist-BqJJWCS8.mjs";
1
+ import { Mt as nodePin, _t as DeviceFeature, ft as errMsg, i as BatteryStatusSchema, ot as streamQualityLabel, pt as BaseAddon, rt as snapshotCapability, x as bareAddonId, yt as DeviceType } from "../../dist-L6QPJWsr.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  //#region src/builtins/snapshot/snapshot-coalescing.ts
4
4
  /**
@@ -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-CV6XTApk.js");
6
+ const require_dist = require("../../dist-BN681PgO.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs = require("node:fs");
9
9
  node_fs = require_chunk.__toESM(node_fs);
@@ -1,4 +1,4 @@
1
- import { F as filesystemBrowseCapability, at as storageProviderCapability, pt as BaseAddon } from "../../dist-BqJJWCS8.mjs";
1
+ import { F as filesystemBrowseCapability, at as storageProviderCapability, pt as BaseAddon } from "../../dist-L6QPJWsr.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import * as fs from "node:fs";
4
4
  import * as path$1 from "node:path";
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Turn a key PREFIX into a half-open range SQLite can answer from the index.
3
+ *
4
+ * **The measurement.** The two canonical KV tables (`addon-settings`,
5
+ * `addon-device-settings`) are keyed `"<scope>.<key>"` and every scoped read
6
+ * and write selects by prefix. That was written as `WHERE id LIKE ? || '%'`,
7
+ * and SQLite cannot use an index for it: `LIKE` is case-insensitive for ASCII
8
+ * by default, so the LIKE optimisation requires an index with `COLLATE
9
+ * NOCASE`, which the implicit PRIMARY KEY index is not. `EXPLAIN QUERY PLAN`
10
+ * says so in one word:
11
+ *
12
+ * LIKE => SCAN addon-device-settings
13
+ * RANGE => SEARCH addon-device-settings USING INDEX … (id>? AND id<?)
14
+ *
15
+ * Every `writeDeviceRuntimeState` therefore scanned the whole table before
16
+ * inserting, on the main thread, synchronously — 15.6% of hub-main's CPU in
17
+ * the 2026-08-07 V8 profile sat in this transaction. Measured on a 2 240-row
18
+ * table (far smaller than the live one, and the gap widens linearly with rows):
19
+ *
20
+ * write (1 DELETE + 14 UPSERT, one txn) 0.253 ms → 0.143 ms 1.8x
21
+ * read (getAllScoped) 0.207 ms → 0.011 ms 19.4x
22
+ *
23
+ * **It is also more CORRECT, which was not the goal.** `LIKE` treats `_` and
24
+ * `%` in the PATTERN as wildcards, and the pattern here is built from an addon
25
+ * id and a device id. `clearAddonDevice('a_b', …)` deleted `axb`'s rows too,
26
+ * and `LIKE`'s ASCII case-folding meant `Recorder:615.` matched
27
+ * `recorder:615.`. A byte range matches exactly the keys that start with the
28
+ * prefix and nothing else.
29
+ *
30
+ * **Why it can refuse.** SQLite's BINARY collation compares UTF-8 BYTES; JS
31
+ * compares UTF-16 code units. The two orders agree for ASCII and can disagree
32
+ * above it. Rather than encode a subtle equivalence nobody will re-derive, a
33
+ * non-ASCII prefix returns `null` and the caller keeps the existing `LIKE` —
34
+ * slower, but identical to what shipped. Every prefix in this codebase is an
35
+ * addon id, a device id and separators, so the fast path is the only one that
36
+ * runs in practice; the fallback exists so a future key shape cannot silently
37
+ * lose rows.
38
+ */
39
+ /** Half-open key range `[lo, hi)` covering exactly the keys starting with a prefix. */
40
+ export interface PrefixRange {
41
+ readonly lo: string;
42
+ /** EXCLUSIVE upper bound: the prefix with its last byte incremented. */
43
+ readonly hi: string;
44
+ }
45
+ /**
46
+ * @returns the range for `prefix`, or `null` when the caller must fall back to
47
+ * a `LIKE` scan (empty prefix — which is the whole table and has no upper
48
+ * bound — or any byte outside ASCII).
49
+ */
50
+ export declare function prefixRange(prefix: string): PrefixRange | null;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Defensive row bounds for `data-store-provider.query`.
3
+ *
4
+ * **Why this file exists.** On 2026-08-07 hub-main died with
5
+ * `FATAL ERROR: Reached heap limit` under `Data::GetValueJS` /
6
+ * `Statement::JS_all`, four seconds after reporting `heapUsed=644MB
7
+ * heapLimit=4288MB`. The heap sampler cannot see an allocation that begins and
8
+ * ends between two samples, so the `[mem]` line said everything was fine right
9
+ * up to the kill. The same stack had already killed the hub twice on 01/08 and
10
+ * twice on 02/08.
11
+ *
12
+ * **It was NOT one 3.4 GB statement, and that correction matters.** The whole
13
+ * database measures 153 MiB (134 MB in a backup taken 14 h earlier, with
14
+ * `auto_vacuum=NONE` and `freelist_count=6` proving it had never been larger)
15
+ * — no single `.all()` on it can produce 3.4 GB. What happened was MANY reads
16
+ * live at once: a viewer resumed from background and requested a 12-hour
17
+ * window over 16 cameras, twice, 33 ms apart. The final Mark-Compact reclaimed
18
+ * 4 MB of 4 090 MB, i.e. every byte was still reachable. `Statement::JS_all` is
19
+ * where the wall was hit, not the size of that one call. The caller-side bound
20
+ * for that specific fan-out lives in `track-store.ts`
21
+ * (`RECENT_FANOUT_ROW_BUDGET`); this file is the backstop under everything
22
+ * else.
23
+ *
24
+ * So: a bound on the query, NOT a bigger `--max-old-space-size`. hub-main's
25
+ * routine p95 heap is already 2 108 MB against a 4 288 MB ceiling; a larger
26
+ * ceiling only moves the number the next unbounded read has to beat.
27
+ *
28
+ * **Why a cap and not a required `limit`.** 64 call sites across the repo
29
+ * query a collection with no `limit`, and most of them are correct — a filter
30
+ * narrow enough that the result set is a handful of rows (`where: { trackId }`,
31
+ * `where: { ownerId }`). Making `limit` mandatory would be 64 edits that each
32
+ * have to guess a number, and the 65th call site added next month would be
33
+ * unbounded again. A cap in the ENGINE holds for every caller, including the
34
+ * ones not written yet.
35
+ *
36
+ * **Why the cap is never silent.** A truncated read that looks like a complete
37
+ * one is worse than the OOM: it turns "the hub died" into "the retention sweep
38
+ * quietly stopped deleting". Every cap hit is logged at WARN naming the
39
+ * collection and the bound, and the caller is expected to page.
40
+ */
41
+ /**
42
+ * Rows returned when the caller supplied no `limit` at all.
43
+ *
44
+ * Sized against the MEASURED hub database (2026-08-08), because a row cap is
45
+ * meaningless without knowing what a row weighs:
46
+ *
47
+ * | table | rows | bytes | avg row |
48
+ * | ---------------------------------- | ------- | ------ | ------- |
49
+ * | `pipeline-analytics:tracks` | 4 668 | 54 MB | 11.5 KB |
50
+ * | `pipeline-analytics:media` | 101 953 | 23 MB | 230 B |
51
+ * | `pipeline-analytics:motion-events` | 148 738 | 12 MB | 78 B |
52
+ * | `pipeline-analytics:audio-events` | 99 608 | 8 MB | 80 B |
53
+ * | `pipeline-analytics:faces` | 372 | 4 MB | 10.8 KB |
54
+ *
55
+ * `tracks` is the pacing table: its `positions` JSON alone is 47 MB of the 54,
56
+ * averaging **10 KB per row**, and it is parsed into JS objects on read. 2 000
57
+ * such rows is ~23 MB of text before parsing — an order of magnitude under
58
+ * hub-main's routine p95 heap (2 108 MB) rather than a multiple of it. The
59
+ * same 2 000 rows of `motion-events` is 160 KB, so narrow tables (auth,
60
+ * alerts, integrations, schedules) never notice the cap at all.
61
+ *
62
+ * An earlier draft sized this at 5 000 on the belief that `faces` was the
63
+ * widest table. It is 372 rows and 4 MB — `pruneCapOverflow` keeps it that
64
+ * way. The number was defensible; the stated evidence for it was wrong, which
65
+ * is worse, because the next person reasons from the evidence.
66
+ *
67
+ * It is deliberately NOT tuned to "the largest legitimate result set" — a
68
+ * caller that genuinely wants more says so with an explicit `limit`, which is
69
+ * honoured up to {@link SETTINGS_QUERY_HARD_ROW_CAP}.
70
+ */
71
+ export declare const SETTINGS_QUERY_DEFAULT_ROW_CAP = 2000;
72
+ /**
73
+ * Absolute ceiling, applied even to an explicit `limit`.
74
+ *
75
+ * The default cap can be opted out of; this one cannot, because the failure it
76
+ * prevents is an OOM and there is no result set worth taking the process down
77
+ * for. A caller needing more than 20 000 rows is describing a stream, not a
78
+ * query, and must page (`limit` + `offset`) — every bulk consumer in the repo
79
+ * already does. At the measured 11.5 KB/row of `tracks`, 20 000 rows is
80
+ * ~230 MB: ruinous to serve, but survivable, which is the right place for a
81
+ * ceiling whose only job is to stop the process dying.
82
+ */
83
+ export declare const SETTINGS_QUERY_HARD_ROW_CAP = 20000;
84
+ /** Where the effective row bound came from. */
85
+ export type RowBoundSource =
86
+ /** The caller's own `limit`, honoured verbatim. Not a truncation. */
87
+ 'caller'
88
+ /** No usable `limit` was given — {@link SETTINGS_QUERY_DEFAULT_ROW_CAP}. */
89
+ | 'default-cap'
90
+ /** The caller asked for more than {@link SETTINGS_QUERY_HARD_ROW_CAP}. */
91
+ | 'hard-cap';
92
+ export interface ResolvedRowBound {
93
+ /** Rows the statement is allowed to return. */
94
+ readonly limit: number;
95
+ readonly source: RowBoundSource;
96
+ }
97
+ /**
98
+ * Resolve the row bound a `query` will run under.
99
+ *
100
+ * Treats a non-finite, negative or non-integer `limit` as ABSENT rather than
101
+ * as an error. That is not leniency for its own sake: SQLite reads a negative
102
+ * `LIMIT` as "no limit at all", so `limit: -1` arriving over the wire — the
103
+ * cap schema is `z.number().optional()`, which accepts it — would have been
104
+ * the one input able to reproduce the OOM through a bound that looked applied.
105
+ *
106
+ * `limit: 0` is a real request for zero rows and is honoured.
107
+ */
108
+ export declare function resolveRowBound(requested: number | undefined): ResolvedRowBound;
109
+ /**
110
+ * Whether a bound being hit is something the CALLER did not ask for, and must
111
+ * therefore be told about.
112
+ *
113
+ * A caller that asked for 500 rows and got 500 has not been truncated — it has
114
+ * been served. Only a cap the engine imposed is news.
115
+ */
116
+ export declare function isImposedBound(source: RowBoundSource): boolean;
@@ -81,5 +81,17 @@ export declare const SQLITE_JOURNAL_SIZE_LIMIT_BYTES = 67108864;
81
81
  * looks like verification. `__tests__/sqlite-pragmas.spec.ts` asserts the
82
82
  * effective value instead, so a dependency bump that changes the default is
83
83
  * caught rather than assumed.
84
+ *
85
+ * **When it takes effect, measured (2026-08-08).** The WAL default is applied
86
+ * when the WAL is actually opened — the first read/write transaction — NOT when
87
+ * `PRAGMA journal_mode = WAL` runs. On a brand-new file the sequence reads:
88
+ *
89
+ * after `journal_mode = WAL`, before any write → 2 (FULL)
90
+ * after the first write → 1 (NORMAL)
91
+ *
92
+ * `initialize()` writes (`ensureTable`, `seedDefaults`) before anything can
93
+ * observe the value, so production is at NORMAL on first boot and every boot
94
+ * after. Recorded because reading the pragma immediately after setting the
95
+ * journal mode reports FULL and looks exactly like a regression in this file.
84
96
  */
85
97
  export declare const SQLITE_SYNCHRONOUS_IS_BUILD_DEFAULT = true;
@@ -1,4 +1,4 @@
1
- import { CollectionColumn, CollectionIndex, DataStoreEngineInfo, HistogramBucket, ISettingsBackend, SettingsCountInput, SettingsDeleteInput, SettingsGetInput, SettingsHistogramInput, SettingsInsertInput, SettingsIsEmptyInput, SettingsQueryInput, SettingsRecord, SettingsSetInput, SettingsUpdateInput } from '@camstack/types';
1
+ import { CollectionColumn, CollectionIndex, DataStoreEngineInfo, HistogramBucket, ISettingsBackend, SettingsCountInput, SettingsDeleteInput, SettingsGetInput, SettingsHistogramInput, SettingsInsertInput, SettingsIsEmptyInput, SettingsQueryInput, SettingsRecord, SettingsSetInput, SettingsUpdateInput, IScopedLogger } from '@camstack/types';
2
2
  import { default as Database } from 'better-sqlite3';
3
3
  import { MutationFilterInput } from './filter-compiler.js';
4
4
  /** Input for {@link SqliteSettingsBackend.deleteWhere}. */
@@ -34,6 +34,23 @@ interface SettingsUpdateWhereResult {
34
34
  export declare class SqliteSettingsBackend implements ISettingsBackend {
35
35
  private readonly dbPath;
36
36
  private db;
37
+ /**
38
+ * Table name → fingerprint of the schema this process last materialised.
39
+ *
40
+ * Keyed by FINGERPRINT, not by name, and that is the whole point. An addon
41
+ * declares its schema at every boot, but the backend lives in hub-main,
42
+ * which outlives an addon respawn: `camstack deploy` restarts the addon
43
+ * runner and NOT hub-main. A name-only memo therefore made the second
44
+ * declaration of a table a no-op FOREVER — a redeployed addon whose schema
45
+ * had gained a column never got the `ALTER TABLE … ADD COLUMN`, and, because
46
+ * `compileFilter` silently drops a predicate naming a column the collection
47
+ * cannot express (select mode), the missing column read as "matches
48
+ * everything" instead of failing. That is how `pipeline-analytics:tracks`
49
+ * ran for a whole release with no `retrainStatus`: the retention sweep's
50
+ * `whereIn: { retrainStatus: ['none','trained'] }` pin evaporated, so every
51
+ * operator-staged track was eligible for deletion, and `countStaging`
52
+ * reported the entire history as staged.
53
+ */
37
54
  private readonly structuredTables;
38
55
  /** Map from scoped collection name → set of column names (non-id) that
39
56
  * the structured schema owns. Routes set/get/insert/update/query to
@@ -47,7 +64,15 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
47
64
  * to the previous legacy path; only the routing is unified.
48
65
  */
49
66
  private static readonly CANONICAL_KV_COLLECTIONS;
50
- constructor(dbPath: string, runtimeDefaults?: Record<string, unknown>);
67
+ /**
68
+ * Optional, because the engine is constructed in places that have no addon
69
+ * context (migrations, one-shot tools, most specs). It is NOT optional in
70
+ * production: `sqlite-settings.addon.ts` passes one, and without it a row cap
71
+ * being hit would be silent — which is the failure mode the cap exists to
72
+ * avoid replacing.
73
+ */
74
+ private readonly logger;
75
+ constructor(dbPath: string, runtimeDefaults?: Record<string, unknown>, logger?: IScopedLogger);
51
76
  initialize(): Promise<void>;
52
77
  private requireDeclared;
53
78
  /**
@@ -122,6 +147,17 @@ export declare class SqliteSettingsBackend implements ISettingsBackend {
122
147
  */
123
148
  getDatabase(): Database.Database | null;
124
149
  private getDb;
150
+ /**
151
+ * `WHERE` fragment selecting every key that starts with `prefix`, plus its
152
+ * bound parameters.
153
+ *
154
+ * The range form is what makes the implicit PRIMARY KEY index usable — see
155
+ * `prefix-range.ts` for the `EXPLAIN QUERY PLAN` output and the measured
156
+ * 1.8x/19.4x. The `LIKE` fallback is the SQL that shipped before, kept
157
+ * verbatim for the prefixes a byte range cannot express, so a key shape this
158
+ * function refuses degrades in speed and never in correctness.
159
+ */
160
+ private prefixWhere;
125
161
  private getAllScoped;
126
162
  private setScopedKey;
127
163
  private scopedName;