@camstack/system 1.2.86 → 1.2.87

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 (53) 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 +155 -18
  14. package/dist/builtins/device-manager/device-manager.addon.mjs +155 -18
  15. package/dist/builtins/device-manager/device-state-mirror.d.ts +51 -6
  16. package/dist/builtins/device-manager/runtime-state-persist-gate.d.ts +32 -0
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  19. package/dist/builtins/hub-forwarder/index.js +1 -1
  20. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  25. package/dist/builtins/local-network/local-network.addon.js +1 -1
  26. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  31. package/dist/builtins/platform-probe/index.js +1 -1
  32. package/dist/builtins/platform-probe/index.mjs +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/snapshot/index.js +1 -1
  36. package/dist/builtins/snapshot/index.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +15 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +37 -1
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +37 -1
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  44. package/dist/builtins/system-config/system-config.addon.js +1 -1
  45. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  46. package/dist/builtins/winston-logging/index.js +1 -1
  47. package/dist/builtins/winston-logging/index.mjs +1 -1
  48. package/dist/{dist-B90N7AWO.mjs → dist-CuAaqtdt.mjs} +929 -83
  49. package/dist/{dist-BV5Bug9t.js → dist-D4nuaPdd.js} +934 -82
  50. package/dist/index.js +30 -4
  51. package/dist/index.mjs +30 -4
  52. package/dist/kernel/config-manager.d.ts +32 -0
  53. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -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-BV5Bug9t.js");
3
+ const require_dist = require("./dist-D4nuaPdd.js");
4
4
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
5
5
  require("./builtins/alerts/index.js");
6
6
  const require_formatter = require("./formatter-DqAKDlvN.js");
@@ -9638,6 +9638,32 @@ var ConfigManager = class ConfigManager {
9638
9638
  if (this.settingsStore === null) return;
9639
9639
  this.settingsStore.clearAddonDevice(addonId, deviceId);
9640
9640
  }
9641
+ /**
9642
+ * The device's persisted runtime-state blob. `{}` before the settings store
9643
+ * is wired — the same answer as "this device has never persisted a slice",
9644
+ * which is what every caller already handles.
9645
+ */
9646
+ getDeviceRuntimeState(deviceId) {
9647
+ if (this.settingsStore === null) return {};
9648
+ return this.settingsStore.getDeviceRuntimeState(deviceId);
9649
+ }
9650
+ /**
9651
+ * Replace the device's persisted runtime-state blob.
9652
+ *
9653
+ * THROWS when the store is not wired, and that is deliberate: the caller
9654
+ * (`DeviceStateMirror.scheduleRuntimeStateDiskWrite`) catches and logs, so a
9655
+ * persist that cannot happen leaves a line naming the device. A silent no-op
9656
+ * here is the shape that let a whole collection read zero for months.
9657
+ */
9658
+ setDeviceRuntimeState(deviceId, blob) {
9659
+ if (this.settingsStore === null) throw new Error("[ConfigManager] SettingsStore not initialized -- call setSettingsStore() first");
9660
+ this.settingsStore.setDeviceRuntimeState(deviceId, blob);
9661
+ }
9662
+ /** Forget the device's runtime state. No-op before the store is wired. */
9663
+ clearDeviceRuntimeState(deviceId) {
9664
+ if (this.settingsStore === null) return;
9665
+ this.settingsStore.clearDeviceRuntimeState(deviceId);
9666
+ }
9641
9667
  createSettingsView(addonId) {
9642
9668
  const cm = this;
9643
9669
  return {
@@ -9666,13 +9692,13 @@ var ConfigManager = class ConfigManager {
9666
9692
  cm.clearAddonDevice(addonId, String(deviceId));
9667
9693
  },
9668
9694
  async readDeviceRuntimeState(deviceId) {
9669
- return cm.getAddonDevice("__device-state", String(deviceId));
9695
+ return cm.getDeviceRuntimeState(String(deviceId));
9670
9696
  },
9671
9697
  async writeDeviceRuntimeState(deviceId, data) {
9672
- cm.setAddonDevice("__device-state", String(deviceId), data);
9698
+ cm.setDeviceRuntimeState(String(deviceId), data);
9673
9699
  },
9674
9700
  async clearDeviceRuntimeState(deviceId) {
9675
- cm.clearAddonDevice("__device-state", String(deviceId));
9701
+ cm.clearDeviceRuntimeState(String(deviceId));
9676
9702
  },
9677
9703
  async getSection(section) {
9678
9704
  return cm.getSection(section);
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
- import { $ as objectInputDeclaresAddonId, At as emitDownForOwnedCaps, B as isArrayOutputSchema, Bt as scopeKey, Ct as ReadinessRegistry, Dt as asNumber, Et as asJsonObject$1, G as kebabToCamel, H as isObjectInput, Ht as EventCategory$1, It as parseJsonObject, K as lifecycleJobSchema, Lt as parseJsonUnknown$1, Mt as expandCapMethods, Ot as asString$1, R as extractNestedAddonId, Rt as readinessKey, V as isCollectionArrayMethod, W as isVoidInput, X as looseSchema, Y as logLevelAtMost, _t as DATAPLANE_SECRET_HEADER$1, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, ht as errMsg$1, it as scopesAllowDeviceCap, kt as createEvent, nt as procedureAuthKey, rt as scopesAllowAddon, t as ALL_CAPABILITY_DEFINITIONS, vt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, wt as ReadinessTimeoutError, y as addonSettingsCapability, yt as DEVICE_STATUS_METHOD, zt as resolveCapMount } from "./dist-B90N7AWO.mjs";
2
+ import { $ as objectInputDeclaresAddonId, At as createEvent, B as isArrayOutputSchema, Bt as resolveCapMount, Dt as asJsonObject$1, G as kebabToCamel, H as isObjectInput, K as lifecycleJobSchema, Lt as parseJsonObject, Nt as expandCapMethods, Ot as asNumber, R as extractNestedAddonId, Rt as parseJsonUnknown$1, Tt as ReadinessTimeoutError, Ut as EventCategory$1, V as isCollectionArrayMethod, Vt as scopeKey, W as isVoidInput, X as looseSchema, Y as logLevelAtMost, at as scopesAllowDeviceCap, bt as DEVICE_STATUS_METHOD, d as METHOD_ACCESS_MAP, f as RUNTIME_DEFAULTS, gt as errMsg$1, it as scopesAllowAddon, jt as emitDownForOwnedCaps, kt as asString$1, nt as procedureAuthKey, t as ALL_CAPABILITY_DEFINITIONS, vt as DATAPLANE_SECRET_HEADER$1, wt as ReadinessRegistry, y as addonSettingsCapability, yt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, zt as readinessKey } from "./dist-CuAaqtdt.mjs";
3
3
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
4
4
  import "./builtins/alerts/index.mjs";
5
5
  import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
@@ -9630,6 +9630,32 @@ var ConfigManager = class ConfigManager {
9630
9630
  if (this.settingsStore === null) return;
9631
9631
  this.settingsStore.clearAddonDevice(addonId, deviceId);
9632
9632
  }
9633
+ /**
9634
+ * The device's persisted runtime-state blob. `{}` before the settings store
9635
+ * is wired — the same answer as "this device has never persisted a slice",
9636
+ * which is what every caller already handles.
9637
+ */
9638
+ getDeviceRuntimeState(deviceId) {
9639
+ if (this.settingsStore === null) return {};
9640
+ return this.settingsStore.getDeviceRuntimeState(deviceId);
9641
+ }
9642
+ /**
9643
+ * Replace the device's persisted runtime-state blob.
9644
+ *
9645
+ * THROWS when the store is not wired, and that is deliberate: the caller
9646
+ * (`DeviceStateMirror.scheduleRuntimeStateDiskWrite`) catches and logs, so a
9647
+ * persist that cannot happen leaves a line naming the device. A silent no-op
9648
+ * here is the shape that let a whole collection read zero for months.
9649
+ */
9650
+ setDeviceRuntimeState(deviceId, blob) {
9651
+ if (this.settingsStore === null) throw new Error("[ConfigManager] SettingsStore not initialized -- call setSettingsStore() first");
9652
+ this.settingsStore.setDeviceRuntimeState(deviceId, blob);
9653
+ }
9654
+ /** Forget the device's runtime state. No-op before the store is wired. */
9655
+ clearDeviceRuntimeState(deviceId) {
9656
+ if (this.settingsStore === null) return;
9657
+ this.settingsStore.clearDeviceRuntimeState(deviceId);
9658
+ }
9633
9659
  createSettingsView(addonId) {
9634
9660
  const cm = this;
9635
9661
  return {
@@ -9658,13 +9684,13 @@ var ConfigManager = class ConfigManager {
9658
9684
  cm.clearAddonDevice(addonId, String(deviceId));
9659
9685
  },
9660
9686
  async readDeviceRuntimeState(deviceId) {
9661
- return cm.getAddonDevice("__device-state", String(deviceId));
9687
+ return cm.getDeviceRuntimeState(String(deviceId));
9662
9688
  },
9663
9689
  async writeDeviceRuntimeState(deviceId, data) {
9664
- cm.setAddonDevice("__device-state", String(deviceId), data);
9690
+ cm.setDeviceRuntimeState(String(deviceId), data);
9665
9691
  },
9666
9692
  async clearDeviceRuntimeState(deviceId) {
9667
- cm.clearAddonDevice("__device-state", String(deviceId));
9693
+ cm.clearDeviceRuntimeState(String(deviceId));
9668
9694
  },
9669
9695
  async getSection(section) {
9670
9696
  return cm.getSection(section);
@@ -56,6 +56,21 @@ export interface ISettingsStore {
56
56
  getAddonDevice(addonId: string, deviceId: string): Record<string, unknown>;
57
57
  setAddonDevice(addonId: string, deviceId: string, values: Record<string, unknown>): void;
58
58
  clearAddonDevice(addonId: string, deviceId: string): void;
59
+ /**
60
+ * Per-device runtime state — the whole cap-slice map as ONE row in the
61
+ * `device-runtime-state` collection.
62
+ *
63
+ * These are separate from `getAddonDevice`/`setAddonDevice` because runtime
64
+ * state is not an addon's config: it belongs to the device, it is replaced
65
+ * wholesale on every flush, and it is written orders of magnitude more often.
66
+ * It USED to share that keyspace under a synthetic `__device-state` addonId,
67
+ * which cost one row (and one INSERT) per cap slice per flush and left the
68
+ * collection it is named for empty on every installation. The backend keeps
69
+ * reading the legacy prefix; see `SqliteSettingsBackend.getDeviceRuntimeState`.
70
+ */
71
+ getDeviceRuntimeState(deviceId: string): Record<string, unknown>;
72
+ setDeviceRuntimeState(deviceId: string, blob: Record<string, unknown>): void;
73
+ clearDeviceRuntimeState(deviceId: string): void;
59
74
  }
60
75
  export declare class ConfigManager {
61
76
  private readonly configPath;
@@ -138,6 +153,23 @@ export declare class ConfigManager {
138
153
  * No-op if the settings store is not yet wired.
139
154
  */
140
155
  clearAddonDevice(addonId: string, deviceId: string): void;
156
+ /**
157
+ * The device's persisted runtime-state blob. `{}` before the settings store
158
+ * is wired — the same answer as "this device has never persisted a slice",
159
+ * which is what every caller already handles.
160
+ */
161
+ getDeviceRuntimeState(deviceId: string): Record<string, unknown>;
162
+ /**
163
+ * Replace the device's persisted runtime-state blob.
164
+ *
165
+ * THROWS when the store is not wired, and that is deliberate: the caller
166
+ * (`DeviceStateMirror.scheduleRuntimeStateDiskWrite`) catches and logs, so a
167
+ * persist that cannot happen leaves a line naming the device. A silent no-op
168
+ * here is the shape that let a whole collection read zero for months.
169
+ */
170
+ setDeviceRuntimeState(deviceId: string, blob: Record<string, unknown>): void;
171
+ /** Forget the device's runtime state. No-op before the store is wired. */
172
+ clearDeviceRuntimeState(deviceId: string): void;
141
173
  createSettingsView(addonId: string): AddonSettingsView;
142
174
  /** Get all system-wide activation overrides. */
143
175
  getSystemActivation(): Readonly<Record<string, boolean>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.86",
3
+ "version": "1.2.87",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",