@camstack/system 1.2.317 → 1.2.319

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 (75) 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/autotrack/index.js +1 -1
  8. package/dist/builtins/autotrack/index.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +3 -77
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +3 -77
  11. package/dist/builtins/camera-grid/index.js +1 -1
  12. package/dist/builtins/camera-grid/index.mjs +1 -1
  13. package/dist/builtins/composer/composer-apply-waits.d.ts +21 -0
  14. package/dist/builtins/composer/composer-live-set.d.ts +22 -0
  15. package/dist/builtins/composer/composer-runtime-factory.d.ts +22 -0
  16. package/dist/builtins/composer/composer-seeds.d.ts +22 -0
  17. package/dist/builtins/composer/composer.addon.js +1905 -1809
  18. package/dist/builtins/composer/composer.addon.mjs +1905 -1809
  19. package/dist/builtins/composer/composer.d.ts +3 -15
  20. package/dist/builtins/console-logging/index.js +1 -1
  21. package/dist/builtins/console-logging/index.mjs +1 -1
  22. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  23. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  24. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  25. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  26. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  27. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  28. package/dist/builtins/hub-forwarder/index.js +1 -1
  29. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  30. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  31. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  32. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  33. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  34. package/dist/builtins/local-network/local-network.addon.js +1 -1
  35. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  36. package/dist/builtins/loki-logging/index.js +1 -1
  37. package/dist/builtins/loki-logging/index.mjs +1 -1
  38. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  39. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  40. package/dist/builtins/platform-probe/index.js +1 -1
  41. package/dist/builtins/platform-probe/index.mjs +1 -1
  42. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  43. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  44. package/dist/builtins/snapshot/index.js +1 -1
  45. package/dist/builtins/snapshot/index.mjs +1 -1
  46. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  47. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  48. package/dist/builtins/sqlite-storage/shm-lock-canary.d.ts +60 -0
  49. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +1 -0
  50. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  51. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  52. package/dist/builtins/sqlite-storage/wal-checkpoint-policy.d.ts +115 -34
  53. package/dist/builtins/sqlite-storage/wal-checkpointer.d.ts +6 -0
  54. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  55. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  56. package/dist/builtins/system-backup/system-backup.service.d.ts +2 -17
  57. package/dist/builtins/system-config/system-config.addon.js +1 -1
  58. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  59. package/dist/builtins/winston-logging/index.js +1 -1
  60. package/dist/builtins/winston-logging/index.mjs +1 -1
  61. package/dist/{composition-sources-Dep7nBwu.js → composition-sources-BjRPhWtU.js} +1 -1
  62. package/dist/{composition-sources-DVClu006.mjs → composition-sources-Cg2MP-qf.mjs} +1 -1
  63. package/dist/{dist-Dori4pf3.mjs → dist-CQ9vXSUh.mjs} +135 -2
  64. package/dist/{dist-a6p0V-IL.js → dist-Dcy0gVHu.js} +135 -2
  65. package/dist/index.js +1 -1
  66. package/dist/index.mjs +1 -1
  67. package/dist/{retired-settings-keys-DVcKRgzm.mjs → retired-settings-keys-DNIbyfTR.mjs} +1 -1
  68. package/dist/{retired-settings-keys-DC1uHWPZ.js → retired-settings-keys-pzlrLUbA.js} +1 -1
  69. package/dist/wal-checkpoint-policy-BahrTtyD.mjs +186 -0
  70. package/dist/wal-checkpoint-policy-d2z2qPqx.js +233 -0
  71. package/dist/wal-checkpoint-worker.js +63 -57
  72. package/dist/wal-checkpoint-worker.mjs +63 -57
  73. package/package.json +1 -1
  74. package/dist/wal-checkpoint-policy-CAcg63o-.mjs +0 -92
  75. package/dist/wal-checkpoint-policy-CCJZngds.js +0 -127
@@ -47,10 +47,8 @@ export declare class Composer {
47
47
  private live;
48
48
  /** The composed devices of `new`-target blocks, and the rows that exist. */
49
49
  private readonly composed;
50
- /** Consecutive applies refused because `core_blocks` had not loaded: warned once per run. */
51
- private storeWaitApplies;
52
- /** Consecutive applies refused because the Blocks integration had not reconciled: warned once per run. */
53
- private integrationWaitApplies;
50
+ /** The store / integration preconditions every apply waits on first (D49, R2). */
51
+ private readonly waits;
54
52
  private readonly gate;
55
53
  private readonly claimGate;
56
54
  private readonly targets;
@@ -84,27 +82,17 @@ export declare class Composer {
84
82
  /** Run `work` after every apply already queued, whether that settled or failed. */
85
83
  private chained;
86
84
  private applyNow;
87
- private waiting;
88
85
  private plan;
89
86
  private rebuildRuntimes;
90
87
  private ungraftGone;
91
- /** Where a block's runtime writes: its composed device, or a claim-backed target on the existing device. */
92
- private writerFor;
93
88
  /** C-1/N-1: the tracker follows the block's OWN claim as the hub answers it; every answer re-reads the native once. */
94
89
  private onClaimEvent;
95
90
  private heldFieldsFor;
96
- private newRuntime;
97
91
  private applyName;
98
92
  private syncSources;
99
93
  /** A failed sync leaves the tracker as it was: the runtimes read what it holds. */
100
94
  private syncTracker;
101
- /**
102
- * Rule 3: the claims every live customization WANTS this apply; everything
103
- * else the gate knows is a release candidate, handed back once two applies
104
- * agree. A block that cannot plan — waiting, unreadable, failed, or with its
105
- * target gone — HOLDS its claims (rule 4, rule 5): they are wanted as they
106
- * are. A disabled block wants none (rule 7).
107
- */
95
+ /** Rule 3: release what no live customization wants, once two applies agree (`wantedClaims`). */
108
96
  private reconcileClaims;
109
97
  private release;
110
98
  /**
@@ -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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, Rt as logDestinationCapability } from "../../dist-Dori4pf3.mjs";
1
+ import { Gn as BaseAddon, Rt as logDestinationCapability } from "../../dist-CQ9vXSUh.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,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-a6p0V-IL.js");
4
- const require_composition_sources = require("../../composition-sources-Dep7nBwu.js");
3
+ const require_dist = require("../../dist-Dcy0gVHu.js");
4
+ const require_composition_sources = require("../../composition-sources-BjRPhWtU.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs_promises = require("node:fs/promises");
@@ -1,5 +1,5 @@
1
- import { $ as coreBlockAddonId, Gn as BaseAddon, In as compositionSourceKey, K as buildCapabilityLookup, Q as compositionSourceRefs, Wn as errMsg, Xt as planComposition, d as CORE_BLOCK_ADDON_PREFIX, et as coreBlockComposition, f as CoreBlockSchema, h as DeclaredDevices, jn as composedDeviceRef, l as COMPOSER_RUNNER_ID, nt as coreBlockSourceKind, rt as coreBlocksCapability, t as ALL_CAPABILITY_DEFINITIONS, tn as replacedFieldKeys, tt as coreBlockIdFromAddonId, u as CORE_BLOCKS_ADDON_ID, yn as validateComposition } from "../../dist-Dori4pf3.mjs";
2
- import { t as describeCompositionSources } from "../../composition-sources-DVClu006.mjs";
1
+ import { $ as coreBlockAddonId, Gn as BaseAddon, In as compositionSourceKey, K as buildCapabilityLookup, Q as compositionSourceRefs, Wn as errMsg, Xt as planComposition, d as CORE_BLOCK_ADDON_PREFIX, et as coreBlockComposition, f as CoreBlockSchema, h as DeclaredDevices, jn as composedDeviceRef, l as COMPOSER_RUNNER_ID, nt as coreBlockSourceKind, rt as coreBlocksCapability, t as ALL_CAPABILITY_DEFINITIONS, tn as replacedFieldKeys, tt as coreBlockIdFromAddonId, u as CORE_BLOCKS_ADDON_ID, yn as validateComposition } from "../../dist-CQ9vXSUh.mjs";
2
+ import { t as describeCompositionSources } from "../../composition-sources-Cg2MP-qf.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { customizationBlockName } from "@camstack/types/node";
5
5
  import * as fs from "node:fs/promises";
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-a6p0V-IL.js");
7
- const require_retired_settings_keys = require("../../retired-settings-keys-DC1uHWPZ.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.js");
7
+ const require_retired_settings_keys = require("../../retired-settings-keys-pzlrLUbA.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
10
10
  let _camstack_types_node = require("@camstack/types/node");
@@ -1,5 +1,5 @@
1
- import { Gn as BaseAddon, Hn as DeviceRole, Kt as normalizeUnit, Lt as locationIconKey, Nt as legacyAutoLinkIds, S as LocationIconIdSchema, Un as DeviceType, Vn as DeviceFeature, Wn as errMsg, Yt as parseStreamParamsFormPatch, Zn as WELL_KNOWN_TAB_MAP, _t as enumerateSchemaFields, an as runtimeStatePolicyFor, bt as expandContainer, ct as defineExtensionSlotProvider, dt as deviceManagerCapability, ft as deviceStateCapability, g as DeviceStatusSchema, gt as enumerateItemArrayFields, hr as EventCategory, it as createDeviceExtensionProvider, j as STREAM_PROFILE_META, mr as sleep$1, o as CAMERA_SWITCH_ORDER, or as isDeviceConfigCap, p as DAY_NAMES, pt as deviceStatusCapability, q as buildStreamParamsConfigSchema, s as CAP_NAMES_WITH_STATUS, t as ALL_CAPABILITY_DEFINITIONS, un as siteZoneKey, ut as deviceExtensionCapability, v as FieldClaimModeSchema, w as MINUTES_PER_DAY, wt as formatMinutes, y as FieldClaimSchema } from "../../dist-Dori4pf3.mjs";
2
- import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-DVcKRgzm.mjs";
1
+ import { Gn as BaseAddon, Hn as DeviceRole, Kt as normalizeUnit, Lt as locationIconKey, Nt as legacyAutoLinkIds, S as LocationIconIdSchema, Un as DeviceType, Vn as DeviceFeature, Wn as errMsg, Yt as parseStreamParamsFormPatch, Zn as WELL_KNOWN_TAB_MAP, _t as enumerateSchemaFields, an as runtimeStatePolicyFor, bt as expandContainer, ct as defineExtensionSlotProvider, dt as deviceManagerCapability, ft as deviceStateCapability, g as DeviceStatusSchema, gt as enumerateItemArrayFields, hr as EventCategory, it as createDeviceExtensionProvider, j as STREAM_PROFILE_META, mr as sleep$1, o as CAMERA_SWITCH_ORDER, or as isDeviceConfigCap, p as DAY_NAMES, pt as deviceStatusCapability, q as buildStreamParamsConfigSchema, s as CAP_NAMES_WITH_STATUS, t as ALL_CAPABILITY_DEFINITIONS, un as siteZoneKey, ut as deviceExtensionCapability, v as FieldClaimModeSchema, w as MINUTES_PER_DAY, wt as formatMinutes, y as FieldClaimSchema } from "../../dist-CQ9vXSUh.mjs";
2
+ import { n as purgeRetiredSettingsRows } from "../../retired-settings-keys-DNIbyfTR.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { canonicalDeviceFingerprint } from "@camstack/types/node";
@@ -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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.js");
7
7
  const require_device_state_changed = require("../../device-state-changed-Bk7cvTnz.js");
8
8
  let zod = require("zod");
9
9
  //#region src/builtins/doorbell/trigger-engine.ts
@@ -1,4 +1,4 @@
1
- import { At as isSameAddonId, Dn as SOURCE_CAP_ACTIVE_FIELD, En as SOURCE_CAPS, Gn as BaseAddon, On as SOURCE_CAP_CHANGED_AT_FIELD, Rn as evaluateSensorEdge, Un as DeviceType, W as bareAddonId, Wn as errMsg, ct as defineExtensionSlotProvider, hr as EventCategory, it as createDeviceExtensionProvider, mt as doorbellCapability, tr as createEvent, ut as deviceExtensionCapability, zn as isSourceCap } from "../../dist-Dori4pf3.mjs";
1
+ import { At as isSameAddonId, Dn as SOURCE_CAP_ACTIVE_FIELD, En as SOURCE_CAPS, Gn as BaseAddon, On as SOURCE_CAP_CHANGED_AT_FIELD, Rn as evaluateSensorEdge, Un as DeviceType, W as bareAddonId, Wn as errMsg, ct as defineExtensionSlotProvider, hr as EventCategory, it as createDeviceExtensionProvider, mt as doorbellCapability, tr as createEvent, ut as deviceExtensionCapability, zn as isSourceCap } from "../../dist-CQ9vXSUh.mjs";
2
2
  import { n as parseDeviceStateChanged } from "../../device-state-changed-DoBbkyEI.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/builtins/doorbell/trigger-engine.ts
@@ -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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, Rt as logDestinationCapability } from "../../dist-Dori4pf3.mjs";
1
+ import { Gn as BaseAddon, Rt as logDestinationCapability } from "../../dist-CQ9vXSUh.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-a6p0V-IL.js");
3
+ const require_dist = require("../../dist-Dcy0gVHu.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 { E as RECORDING_SOURCE_CAMSTACK_ADDON, Gn as BaseAddon, Wn as errMsg, hr as EventCategory, k as RecordingStatusSchema, tr as createEvent } from "../../dist-Dori4pf3.mjs";
1
+ import { E as RECORDING_SOURCE_CAMSTACK_ADDON, Gn as BaseAddon, Wn as errMsg, hr as EventCategory, k as RecordingStatusSchema, tr as createEvent } from "../../dist-CQ9vXSUh.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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, H as authProviderCapability, L as UserRecordSchema, M as ScopedTokenSchema, r as ApiKeyRecordSchema, vn as userManagementCapability } from "../../dist-Dori4pf3.mjs";
2
+ import { Gn as BaseAddon, H as authProviderCapability, L as UserRecordSchema, M as ScopedTokenSchema, r as ApiKeyRecordSchema, vn as userManagementCapability } from "../../dist-CQ9vXSUh.mjs";
3
3
  import * as crypto$2 from "node:crypto";
4
4
  import { createHash, randomUUID, timingSafeEqual } 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-a6p0V-IL.js");
3
+ const require_dist = require("../../dist-Dcy0gVHu.js");
4
4
  const require_tls = require("../../tls-D_wUeOTD.js");
5
5
  let node_fs_promises = require("node:fs/promises");
6
6
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Gn as BaseAddon, It as localNetworkCapability, hr as EventCategory } from "../../dist-Dori4pf3.mjs";
1
+ import { Gn as BaseAddon, It as localNetworkCapability, hr as EventCategory } from "../../dist-CQ9vXSUh.mjs";
2
2
  import { S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, i as writeExtraSans, l as reissueTlsLeaf, n as readTlsAccessStatus, o as validateUploadedTls, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, y as applyLanHttp } from "../../tls-IM-v7JV4.mjs";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import { join } from "node:path";
@@ -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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, Rt as logDestinationCapability } from "../../dist-Dori4pf3.mjs";
1
+ import { Gn as BaseAddon, Rt as logDestinationCapability } from "../../dist-CQ9vXSUh.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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.js");
7
7
  const require_proc_stat = require("../../proc-stat-DL-WUOhl.js");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { Ct as foldSnapshotByFunction, Gn as BaseAddon, Ut as metricsProviderCapability, Wn as errMsg, en as reducePoints, hr as EventCategory, nn as resolveBucketMs, tr as createEvent } from "../../dist-Dori4pf3.mjs";
1
+ import { Ct as foldSnapshotByFunction, Gn as BaseAddon, Ut as metricsProviderCapability, Wn as errMsg, en as reducePoints, hr as EventCategory, nn as resolveBucketMs, tr as createEvent } from "../../dist-CQ9vXSUh.mjs";
2
2
  import { a as parseProcStat, i as nodeProcReader, n as elapsedSecSince, o as parseProcStatusRss, r as lifetimeCpuPercent, t as commandFromCmdline } from "../../proc-stat-CbC55Kqi.mjs";
3
3
  import { access, readFile, readdir } from "node:fs/promises";
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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, Wn as errMsg, Zt as platformProbeCapability, cn as scoreRuntimes, hr as EventCategory, ht as enumerateInferenceDevices, rr as emitReadiness } from "../../dist-Dori4pf3.mjs";
2
+ import { Gn as BaseAddon, Wn as errMsg, Zt as platformProbeCapability, cn as scoreRuntimes, hr as EventCategory, ht as enumerateInferenceDevices, rr as emitReadiness } from "../../dist-CQ9vXSUh.mjs";
3
3
  import * as fs from "node:fs";
4
4
  import { execFile } from "node:child_process";
5
5
  import * as os 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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, hr as EventCategory } from "../../dist-Dori4pf3.mjs";
1
+ import { Gn as BaseAddon, hr as EventCategory } from "../../dist-CQ9vXSUh.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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.js");
7
7
  const require_snapshot_courtesy = require("../../snapshot-courtesy-Cqs7GkOV.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { G as batteryCapability, Gn as BaseAddon, Un as DeviceType, Vn as DeviceFeature, W as bareAddonId, Wn as errMsg, _n as streamQualityLabel, a as BatteryStatusSchema, cr as nodePin, dn as snapshotCapability, hr as EventCategory, lt as deriveBatteryPresence } from "../../dist-Dori4pf3.mjs";
1
+ import { G as batteryCapability, Gn as BaseAddon, Un as DeviceType, Vn as DeviceFeature, W as bareAddonId, Wn as errMsg, _n as streamQualityLabel, a as BatteryStatusSchema, cr as nodePin, dn as snapshotCapability, hr as EventCategory, lt as deriveBatteryPresence } from "../../dist-CQ9vXSUh.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CZPvteq2.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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.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 { Gn as BaseAddon, St as filesystemBrowseCapability, hn as storageProviderCapability } from "../../dist-Dori4pf3.mjs";
1
+ import { Gn as BaseAddon, St as filesystemBrowseCapability, hn as storageProviderCapability } from "../../dist-CQ9vXSUh.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";
@@ -0,0 +1,60 @@
1
+ import { IScopedLogger } from '@camstack/types';
2
+ /** `UNIX_SHM_DMS`: the byte of the `-shm` a live connection holds shared. */
3
+ export declare const SQLITE_SHM_DMS_BYTE = 128;
4
+ /** How often the canary looks, in ms. One small procfs read. */
5
+ export declare const SHM_LOCK_CANARY_INTERVAL_MS: number;
6
+ /** One HELD lock from `/proc/locks`. Waiters (`->` lines) are not locks. */
7
+ export interface ProcLock {
8
+ readonly pid: number;
9
+ /** The inode, as the decimal string procfs prints — never rounded through a double. */
10
+ readonly inode: string;
11
+ readonly start: number;
12
+ /** `null` = to end of file (`EOF`). */
13
+ readonly end: number | null;
14
+ }
15
+ /**
16
+ * Parse `/proc/locks`. Line shape:
17
+ * `1: POSIX ADVISORY READ 3490531 08:31:3769403373 128 128`
18
+ * (`id: TYPE MODE ACCESS PID MAJ:MIN:INODE START END`). A blocked waiter is
19
+ * printed as `1: -> POSIX …` and holds nothing, so it is skipped; a line that
20
+ * does not parse is skipped rather than guessed at.
21
+ */
22
+ export declare function parseProcLocks(text: string): readonly ProcLock[];
23
+ /** Does a lock owned by `pid` on `inode` cover the DMS byte? */
24
+ export declare function holdsDmsLock(locks: readonly ProcLock[], pid: number, inode: string): boolean;
25
+ /**
26
+ * `unavailable` = this platform has no `/proc/locks` (said once, then the
27
+ * canary stops). `unreadable` = Linux, but this look failed (the `-shm` absent,
28
+ * procfs unreadable) — a different fact, and on the hub a worrying one.
29
+ */
30
+ export type ShmLockState = 'held' | 'missing' | 'unavailable' | 'unreadable';
31
+ /** The canary's impure edges, injectable so a spec drives them. */
32
+ export interface ShmLockCanaryDeps {
33
+ readonly platform: NodeJS.Platform;
34
+ readonly pid: number;
35
+ /** The `-shm` inode as a decimal string; throws when the file is absent. */
36
+ readonly shmInode: (shmPath: string) => string;
37
+ readonly readProcLocks: () => string;
38
+ }
39
+ export interface ShmLockCanaryOptions {
40
+ readonly dbPath: string;
41
+ readonly logger: IScopedLogger;
42
+ readonly intervalMs?: number;
43
+ readonly deps?: Partial<ShmLockCanaryDeps>;
44
+ }
45
+ export declare class ShmLockCanary {
46
+ private readonly shmPath;
47
+ private readonly logger;
48
+ private readonly intervalMs;
49
+ private readonly deps;
50
+ private timer;
51
+ private last;
52
+ private lastError;
53
+ constructor(options: ShmLockCanaryOptions);
54
+ start(): void;
55
+ stop(): void;
56
+ /** One look. Logs only a change of state. Public for the spec. */
57
+ check(): ShmLockState;
58
+ private observe;
59
+ private report;
60
+ }
@@ -22,6 +22,7 @@ export declare class SqliteSettingsAddon extends BaseAddon {
22
22
  private vectorIndex;
23
23
  private walMaintenance;
24
24
  private walCheckpointer;
25
+ private shmLockCanary;
25
26
  constructor();
26
27
  /**
27
28
  * The engine behind `settings-store` cannot read that door during
@@ -33,22 +33,64 @@
33
33
  *
34
34
  * The auto-checkpoint's own rule: fold when 1000 frames are pending. The
35
35
  * point of moving the checkpoint is to change WHO waits on the disk, not how
36
- * often the disk is asked to sync — a worker that checkpointed every second
37
- * would multiply the fsync count by ten on a drive the media plane already
38
- * saturates. The threshold is read from the wal-index header (`mxFrame`,
39
- * `nBackfill`), which costs a 136-byte read and no lock; when that read is
40
- * unavailable the worker falls back to a fixed interval, so an unreadable
41
- * header can never mean "nothing to do".
36
+ * often the disk is asked to sync — a worker that folded every second would
37
+ * multiply the fsync count on a drive the media plane already saturates.
38
+ *
39
+ * ## How the worker knows how much is pending — and how it must NOT learn it
40
+ *
41
+ * Until 2026-09-29 the worker read the wal-index header straight out of the
42
+ * `-shm` file, once a second, with `openSync` / `readSync` / `closeSync`. That
43
+ * `closeSync` was the SIGBUS of D468 (corrected by D679): on POSIX, closing
44
+ * ANY descriptor of a file drops EVERY fcntl lock the process holds on that
45
+ * file — including the shared lock on `-shm` byte 128 (the "DMS" lock) that
46
+ * SQLite takes for the life of a connection and that tells every OTHER
47
+ * process "a live connection is using this wal-index, do not rebuild it". With
48
+ * the lock gone, the next process to open the database believed it was
49
+ * first, truncated and re-initialised the `-shm` under the runner's mappings,
50
+ * and the runner's next write past a 32 KiB wal-index region hit a page
51
+ * beyond end-of-file.
52
+ *
53
+ * So the worker never touches a SQLite file except through its connection.
54
+ * What it knows about the WAL it learns from the checkpoint it just ran:
55
+ * `PRAGMA wal_checkpoint(PASSIVE)` answers `log` (frames in the WAL) and
56
+ * `checkpointed` (frames now backfilled). Two consecutive answers give the
57
+ * frames appended between them, hence a rate, hence WHEN the next 1000 frames
58
+ * will have accumulated. The next checkpoint is scheduled for then —
59
+ * {@link nextCheckpointPlan} — clamped between the worker's poll interval and
60
+ * {@link WAL_CHECKPOINT_MAX_DELAY_MS}. A PASSIVE with nothing to fold performs
61
+ * no fsync (the copy and both syncs sit behind `nBackfill < mxFrame` in
62
+ * `wal.c`), so the clamp costs a quiet database nothing, and it bounds how
63
+ * long a burst that follows a quiet spell goes unseen.
42
64
  */
43
65
  /** The engine's own `wal_autocheckpoint` default, in frames. Reproduced, not changed. */
44
66
  export declare const WAL_CHECKPOINT_THRESHOLD_FRAMES = 1000;
45
67
  /**
46
- * Longest the worker lets pending frames sit before folding them, in ms. A
47
- * quiet database (a developer machine, an agent with little to persist) still
48
- * gets its WAL folded and its pages made durable within a minute.
68
+ * Longest the worker waits between two checkpoints, in ms, whatever the
69
+ * measured rate says. It is the bound on how late a burst after a steady or
70
+ * quiet spell is noticed, and it is sized against the engine's own fallback
71
+ * (`SQLITE_WAL_AUTOCHECKPOINT_BOUND_PAGES` = 10 000 frames), which runs INSIDE
72
+ * a settings-thread commit — the stall D452 moved off that thread. No burst
73
+ * rate has been measured on the hub (D452's 54 frames/s is the steady rate),
74
+ * so the design point is 1 000 frames/s, ~18× steady: 8 s of it is 8 000
75
+ * frames, under the fallback, so the worker looks before the engine has to.
76
+ * A pass that finds more than {@link WAL_CHECKPOINT_LARGE_PASS_FRAMES} is
77
+ * reported so this number can be tuned from the field.
78
+ *
79
+ * The cost, stated against D452: at the steady 54 frames/s the threshold
80
+ * would fold every ~18.5 s; this clamp folds every 8 s, ~2.3× the fsync pairs
81
+ * (≈ 432 frames per fold instead of 1 000). They are paid on the WORKER, a
82
+ * thread nobody waits on — the settings thread's commits stay appends. A pass
83
+ * with nothing pending does no fsync at all.
84
+ */
85
+ export declare const WAL_CHECKPOINT_MAX_DELAY_MS = 8000;
86
+ /**
87
+ * A pass that folded more than this many appended frames is reported (WARN,
88
+ * sampled: the first of each summary window, the rest counted). Half the
89
+ * engine's fallback bound: a gap that let this much accumulate was within 2×
90
+ * of handing the checkpoint back to the settings thread.
49
91
  */
50
- export declare const WAL_CHECKPOINT_MAX_INTERVAL_MS = 60000;
51
- /** How often the worker looks at the wal-index, in ms. A 136-byte read. */
92
+ export declare const WAL_CHECKPOINT_LARGE_PASS_FRAMES = 5000;
93
+ /** Shortest gap between two checkpoints, in ms — the worker's poll interval. */
52
94
  export declare const WAL_CHECKPOINT_POLL_MS = 1000;
53
95
  /**
54
96
  * A checkpoint that took this long is reported at WARN with its numbers.
@@ -56,38 +98,74 @@ export declare const WAL_CHECKPOINT_POLL_MS = 1000;
56
98
  * the profiler used to file as a slow `set`, now on the thread that paid it.
57
99
  */
58
100
  export declare const WAL_CHECKPOINT_SLOW_MS = 1000;
59
- /** The two wal-index counters the judgement reads, or `null` when unreadable. */
60
- export interface WalIndexCounters {
61
- /** Frames in the WAL that are valid for the current cycle. */
62
- readonly mxFrame: number | null;
63
- /** Frames already copied back into the database file. */
64
- readonly nBackfill: number | null;
101
+ /** What one `PRAGMA wal_checkpoint(PASSIVE)` answered, and when. */
102
+ export interface CheckpointObservation {
103
+ /** ms epoch at which the checkpoint returned. */
104
+ readonly at: number;
105
+ /** `log`: frames in the WAL when the checkpoint ran. */
106
+ readonly walFrames: number;
107
+ /** `checkpointed`: frames backfilled into the database file. */
108
+ readonly checkpointedFrames: number;
65
109
  }
66
- export interface CheckpointDecisionInput extends WalIndexCounters {
67
- readonly sinceLastRunMs: number;
110
+ /**
111
+ * Frames appended to the WAL between two checkpoints.
112
+ *
113
+ * When the previous checkpoint backfilled EVERYTHING, the next writer restarts
114
+ * the WAL from frame 1, so every frame now in it is new. When it did not (a
115
+ * reader pinned a snapshot), the WAL kept growing and the difference is what
116
+ * was added — unless it shrank, which only a restart can do.
117
+ *
118
+ * An IDLE WAL is the exception to "complete means restarted": the WAL restarts
119
+ * only at the next write, so a fully checkpointed WAL nobody writes answers
120
+ * the same `log == checkpointed` pass after pass. Identical answers after a
121
+ * complete checkpoint are therefore 0 appended, not the whole WAL again —
122
+ * otherwise an idle node would be scheduled at the poll interval forever and
123
+ * every summary would count the same frames once per pass. (A restart that
124
+ * appended exactly as many frames as the previous cycle is read as idle too;
125
+ * it is scheduled at the max delay, which is the bounded case anyway.)
126
+ *
127
+ * The one remaining ambiguity — a complete checkpoint followed by writes the
128
+ * writer could NOT restart the WAL for — counts old frames as new, which
129
+ * over-estimates the rate and checkpoints EARLY: the safe direction. `-1`
130
+ * (not a WAL database, or a busy pass) reads as 0.
131
+ */
132
+ export declare function framesAppendedBetween(previous: CheckpointObservation, current: CheckpointObservation): number;
133
+ /**
134
+ * What the worker "saw" before its first checkpoint: nothing, at the moment it
135
+ * started. Against it, the first checkpoint counts every frame then in the WAL
136
+ * as appended since the start — which over-estimates the rate when the WAL
137
+ * held older frames, and so schedules the second checkpoint EARLY: the safe
138
+ * direction, and the second one measures the real rate.
139
+ */
140
+ export declare function workerStartObservation(at: number): CheckpointObservation;
141
+ export type CheckpointReason = 'first' | 'scheduled';
142
+ export interface CheckpointPlan {
143
+ /** Frames appended since the previous checkpoint (or the worker's start). */
144
+ readonly appendedFrames: number;
145
+ /** How long until the next checkpoint, in ms. */
146
+ readonly nextDelayMs: number;
68
147
  }
69
- export type CheckpointReason = 'threshold' | 'interval' | 'unknown-interval' | 'below-threshold' | 'unknown-below-interval' | 'nothing-pending';
70
- export interface CheckpointDecision {
71
- readonly run: boolean;
72
- readonly reason: CheckpointReason;
73
- readonly pendingFrames: number | null;
148
+ export interface CheckpointPlanInput {
149
+ readonly previous: CheckpointObservation;
150
+ readonly current: CheckpointObservation;
151
+ readonly minDelayMs: number;
152
+ readonly maxDelayMs: number;
74
153
  }
75
- /** Should the worker run `wal_checkpoint(PASSIVE)` now? */
76
- export declare function decideCheckpoint(input: CheckpointDecisionInput): CheckpointDecision;
77
- /** Bytes needed to read both fields. */
78
- export declare const WAL_INDEX_HEADER_READ_BYTES: number;
79
154
  /**
80
- * `mxFrame` and `nBackfill` from the first {@link WAL_INDEX_HEADER_READ_BYTES}
81
- * of the `-shm` file, or `null` when the buffer is short or the two header
82
- * copies disagree (a writer was updating them — SQLite's own readers retry on
83
- * exactly that comparison; this caller simply waits for the next poll).
155
+ * When to run the next checkpoint: the moment the measured rate says
156
+ * {@link WAL_CHECKPOINT_THRESHOLD_FRAMES} more frames will be pending,
157
+ * clamped to `[minDelayMs, maxDelayMs]`. Nothing appended since the last one
158
+ * is `maxDelayMs`.
84
159
  */
85
- export declare function parseWalIndexHeader(buffer: Buffer): WalIndexCounters | null;
160
+ export declare function nextCheckpointPlan(input: CheckpointPlanInput): CheckpointPlan;
86
161
  /** What the worker tells the parent after one checkpoint. */
87
162
  export interface CheckpointReport {
88
163
  readonly kind: 'checkpointed';
89
164
  readonly reason: CheckpointReason;
90
- readonly pendingFrames: number | null;
165
+ /** Frames appended since the previous checkpoint (or the worker's start). */
166
+ readonly appendedFrames: number;
167
+ /** When the worker will checkpoint next, in ms. */
168
+ readonly nextDelayMs: number;
91
169
  /** `PRAGMA wal_checkpoint` row: frames in the WAL, frames now backfilled, busy flag. */
92
170
  readonly walFrames: number;
93
171
  readonly checkpointedFrames: number;
@@ -108,7 +186,10 @@ export interface WorkerStop {
108
186
  /** What the worker is started with. */
109
187
  export interface WalCheckpointWorkerData {
110
188
  readonly dbPath: string;
189
+ /** Shortest gap between two checkpoints. */
111
190
  readonly pollMs: number;
191
+ /** Longest gap between two checkpoints. */
192
+ readonly maxDelayMs: number;
112
193
  }
113
194
  /** Narrow a message off the worker port without a cast. */
114
195
  export declare function isWorkerMessage(value: unknown): value is WorkerMessage;
@@ -10,6 +10,10 @@ export interface WalCheckpointStats {
10
10
  readonly maxMs: number;
11
11
  readonly totalMs: number;
12
12
  readonly busy: number;
13
+ /** Passes that folded more than `WAL_CHECKPOINT_LARGE_PASS_FRAMES` appended frames. */
14
+ readonly large: number;
15
+ /** The most appended frames one pass found. */
16
+ readonly maxAppended: number;
13
17
  }
14
18
  /**
15
19
  * The members of a `Worker` this class touches. Structural, so the unit spec
@@ -35,6 +39,7 @@ export interface WalCheckpointerOptions {
35
39
  readonly dbPath: string;
36
40
  readonly logger: IScopedLogger;
37
41
  readonly pollMs?: number;
42
+ readonly maxDelayMs?: number;
38
43
  readonly slowMs?: number;
39
44
  readonly summaryIntervalMs?: number;
40
45
  /** Overrides the built entry — a spec points this at the TypeScript source. */
@@ -47,6 +52,7 @@ export declare class WalCheckpointer {
47
52
  private readonly dbPath;
48
53
  private readonly logger;
49
54
  private readonly pollMs;
55
+ private readonly maxDelayMs;
50
56
  private readonly slowMs;
51
57
  private readonly summaryIntervalMs;
52
58
  private readonly spawn;
@@ -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-a6p0V-IL.js");
6
+ const require_dist = require("../../dist-Dcy0gVHu.js");
7
7
  const require_hub_cap_forward = require("../../hub-cap-forward-DmHNjbB0.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Cn as withLocationMode, D as REDACTED_SECRET, F as StorageLocationTypeSchema, Gn as BaseAddon, Ht as mayWriteToLocation, I as StorageMigrationJobSchema, N as StorageCleanupJobSchema, Ot as isLocationEnabled, P as StorageLocationModeSchema, Pt as legacyModeOf, Tt as gbToBytes, Vt as mayReadLocation, Wt as modeMayWrite, Y as collectSecretConfigKeys, fn as storageCapability, hr as EventCategory, ln as settingsStoreCapability, lr as parseJsonObject, pn as storageMigrationCapability, rn as resolveLocationMode, x as LegacyStorageLocationDefaultSchema, yt as evictionPolicyOfLocation } from "../../dist-Dori4pf3.mjs";
1
+ import { Cn as withLocationMode, D as REDACTED_SECRET, F as StorageLocationTypeSchema, Gn as BaseAddon, Ht as mayWriteToLocation, I as StorageMigrationJobSchema, N as StorageCleanupJobSchema, Ot as isLocationEnabled, P as StorageLocationModeSchema, Pt as legacyModeOf, Tt as gbToBytes, Vt as mayReadLocation, Wt as modeMayWrite, Y as collectSecretConfigKeys, fn as storageCapability, hr as EventCategory, ln as settingsStoreCapability, lr as parseJsonObject, pn as storageMigrationCapability, rn as resolveLocationMode, x as LegacyStorageLocationDefaultSchema, yt as evictionPolicyOfLocation } from "../../dist-CQ9vXSUh.mjs";
2
2
  import { t as HUB_CAP_FWD_ACTION } from "../../hub-cap-forward-BdT320dq.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";