@camstack/system 1.2.316 → 1.2.317

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 (87) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/auth/auth-manager.d.ts +11 -0
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  8. package/dist/builtins/alerts/alerts.addon.js +1 -1
  9. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  10. package/dist/builtins/autotrack/index.js +1 -1
  11. package/dist/builtins/autotrack/index.mjs +1 -1
  12. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  14. package/dist/builtins/camera-grid/index.js +1 -1
  15. package/dist/builtins/camera-grid/index.mjs +1 -1
  16. package/dist/builtins/composer/composer.addon.js +347 -181
  17. package/dist/builtins/composer/composer.addon.mjs +347 -181
  18. package/dist/builtins/composer/composition-evaluation.d.ts +37 -0
  19. package/dist/builtins/composer/composition-runtime.d.ts +11 -52
  20. package/dist/builtins/composer/composition-target.d.ts +50 -0
  21. package/dist/builtins/composer/existing-target.d.ts +19 -1
  22. package/dist/builtins/composer/own-field-reads.d.ts +19 -0
  23. package/dist/builtins/console-logging/index.js +1 -1
  24. package/dist/builtins/console-logging/index.mjs +1 -1
  25. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  26. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  27. package/dist/builtins/device-manager/device-manager.addon.js +265 -29
  28. package/dist/builtins/device-manager/device-manager.addon.mjs +265 -29
  29. package/dist/builtins/device-manager/device-provider-context.d.ts +6 -0
  30. package/dist/builtins/device-manager/device-source-activation.d.ts +26 -1
  31. package/dist/builtins/device-manager/device-state-mirror.d.ts +41 -9
  32. package/dist/builtins/device-manager/mirror-row-writer.d.ts +59 -1
  33. package/dist/builtins/doorbell/binding-mirror.d.ts +45 -81
  34. package/dist/builtins/doorbell/doorbell-extension-slot.d.ts +4 -3
  35. package/dist/builtins/doorbell/virtual-doorbell.addon.d.ts +53 -11
  36. package/dist/builtins/doorbell/virtual-doorbell.addon.js +207 -82
  37. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +207 -82
  38. package/dist/builtins/hub-forwarder/index.js +1 -1
  39. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  40. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  41. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  42. package/dist/builtins/local-auth/local-auth.addon.js +47 -3
  43. package/dist/builtins/local-auth/local-auth.addon.mjs +46 -4
  44. package/dist/builtins/local-network/local-network.addon.js +1 -1
  45. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  46. package/dist/builtins/loki-logging/index.js +1 -1
  47. package/dist/builtins/loki-logging/index.mjs +1 -1
  48. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  49. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  50. package/dist/builtins/platform-probe/index.js +1 -1
  51. package/dist/builtins/platform-probe/index.mjs +1 -1
  52. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/dist/builtins/snapshot/index.js +1 -1
  55. package/dist/builtins/snapshot/index.mjs +1 -1
  56. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  57. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  58. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  59. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  60. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  61. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  62. package/dist/builtins/system-config/system-config.addon.js +4 -4
  63. package/dist/builtins/system-config/system-config.addon.mjs +4 -4
  64. package/dist/builtins/winston-logging/index.js +1 -1
  65. package/dist/builtins/winston-logging/index.mjs +1 -1
  66. package/dist/{child-cap-dispatch-AAltfBUH.mjs → child-cap-dispatch-C2VINHu1.mjs} +70 -18
  67. package/dist/{child-cap-dispatch-DzcUd_ct.js → child-cap-dispatch-C8uts1P4.js} +70 -18
  68. package/dist/{composition-sources-fUyF4z39.mjs → composition-sources-DVClu006.mjs} +1 -1
  69. package/dist/{composition-sources-BwE1POnF.js → composition-sources-Dep7nBwu.js} +1 -1
  70. package/dist/{dist-BPvku43i.mjs → dist-Dori4pf3.mjs} +85 -6
  71. package/dist/{dist-RAl10EfG.js → dist-a6p0V-IL.js} +85 -6
  72. package/dist/index.js +739 -350
  73. package/dist/index.mjs +737 -352
  74. package/dist/kernel/bootstrap-config.d.ts +8 -0
  75. package/dist/kernel/capability-registry.d.ts +30 -0
  76. package/dist/kernel/config-manager.d.ts +75 -129
  77. package/dist/kernel/index.d.ts +5 -2
  78. package/dist/kernel/moleculer/runtime-state-load.d.ts +19 -0
  79. package/dist/kernel/settings-door-view.d.ts +24 -1
  80. package/dist/kernel/settings-read-error.d.ts +37 -0
  81. package/dist/kernel/settings-view-types.d.ts +105 -0
  82. package/dist/kernel/store-settings-view.d.ts +17 -0
  83. package/dist/kernel/system-settings-mirror.d.ts +34 -0
  84. package/dist/kernel/system-settings-policy.d.ts +47 -0
  85. package/dist/{retired-settings-keys-D3rGTGq5.js → retired-settings-keys-DC1uHWPZ.js} +1 -1
  86. package/dist/{retired-settings-keys-DqVWSrVw.mjs → retired-settings-keys-DVcKRgzm.mjs} +1 -1
  87. package/package.json +1 -1
@@ -701,7 +701,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
701
701
  return EventCategory;
702
702
  }({});
703
703
  //#endregion
704
- //#region ../types/dist/sleep-E6eD4yQS.mjs
704
+ //#region ../types/dist/sleep-DlrgY4Qb.mjs
705
705
  /**
706
706
  * The audio chunk plane's byte format, and the ONE expansion from a coded
707
707
  * window to float samples (D455).
@@ -3512,7 +3512,7 @@ function errMsg(err) {
3512
3512
  return String(err);
3513
3513
  }
3514
3514
  //#endregion
3515
- //#region ../types/dist/composition-D5BQywfe.mjs
3515
+ //#region ../types/dist/composition-BK-GTFYb.mjs
3516
3516
  var AUDIO_ENCODER_BY_CODEC = {
3517
3517
  opus: "libopus",
3518
3518
  aac: "aac",
@@ -4153,14 +4153,37 @@ function evaluateRose(level, changedAt, debounceMs, call, field, env) {
4153
4153
  field.acceptedEdgeAt = verdict.timestamp;
4154
4154
  return verdict.timestamp;
4155
4155
  }
4156
+ /**
4157
+ * `count(x)`: how many times `x` strictly advanced (D670). It starts on the
4158
+ * first ANSWERED read of `x`:
4159
+ * - an answered `null` ("never happened") primes it with no high-water, so the
4160
+ * next finite value is a real advance and counts 1;
4161
+ * - an answered finite value primes it with that value as the high-water and
4162
+ * no increment — it is history, not an event;
4163
+ * - anything else (a read that did not answer reaches here as neither) does
4164
+ * NOT prime it (D393: unknown is not null).
4165
+ * An unavailable binding never reaches this function at all: the field is
4166
+ * judged unavailable before the expression runs.
4167
+ *
4168
+ * Edge case, accepted: an input that answers `null` and LATER reports a
4169
+ * historical value (a sensor's `lastChangedAt` that was null until its first
4170
+ * report) counts that value once. For the doorbell it cannot happen — its
4171
+ * input is its own `lastPressedAt`, which only advances on a `rose` edge that
4172
+ * also emits the press — but an external input can overcount by one.
4173
+ */
4156
4174
  function evaluateCount(input, call, currentOutput) {
4157
4175
  const currentCount = typeof currentOutput === "number" && Number.isFinite(currentOutput) && currentOutput >= 0 ? currentOutput : 0;
4176
+ if (input === null) {
4177
+ call.primed = true;
4178
+ return currentCount;
4179
+ }
4158
4180
  if (typeof input !== "number" || !Number.isFinite(input)) return currentCount;
4159
- if (call.highWater === null) {
4181
+ if (!call.primed) {
4182
+ call.primed = true;
4160
4183
  call.highWater = input;
4161
4184
  return currentCount;
4162
4185
  }
4163
- if (input <= call.highWater) return currentCount;
4186
+ if (call.highWater !== null && input <= call.highWater) return currentCount;
4164
4187
  call.highWater = input;
4165
4188
  return currentCount + 1;
4166
4189
  }
@@ -4876,7 +4899,8 @@ function evaluateStatefulExpressionCall(invocation, memory, env) {
4876
4899
  case "count": {
4877
4900
  const call = existing?.kind === "count" ? existing : {
4878
4901
  kind: "count",
4879
- highWater: null
4902
+ highWater: null,
4903
+ primed: false
4880
4904
  };
4881
4905
  memory.calls.set(invocation.path, call);
4882
4906
  return evaluateCount(invocation.args[0], call, env.currentOutput);
@@ -14038,6 +14062,34 @@ var DeviceBindingsForDeviceSchema = z.object({
14038
14062
  nativeAddonId: z.string()
14039
14063
  }))
14040
14064
  });
14065
+ /**
14066
+ * The STORED wrapper activation for one `(device, capability)` pair — the row
14067
+ * `setWrapperActive` writes, read back three-way (D675):
14068
+ *
14069
+ * - `value` — the store answered and holds an activation: the bound wrapper's
14070
+ * addon id, or `null`, the operator's explicit "off" marker (D62);
14071
+ * - `missing` — the store answered, its activation map exists, and it holds
14072
+ * nothing for this pair: the operator never activated or deactivated a
14073
+ * wrapper here;
14074
+ * - `failed` — the store could not be read, holds no activation map at all
14075
+ * (an empty or unready snapshot, D44), or holds something that is not an
14076
+ * activation. It carries NO information: a consumer must never read it as
14077
+ * `missing` (D315, D393).
14078
+ *
14079
+ * This is the persisted INPUT, not the derived `getBindings` view — no registry
14080
+ * resolution, no `defaultActive` auto-binding, no cluster native-cap folding.
14081
+ */
14082
+ var WrapperActivationReadSchema = z.discriminatedUnion("kind", [
14083
+ z.object({
14084
+ kind: z.literal("value"),
14085
+ wrapperAddonId: z.string().nullable()
14086
+ }),
14087
+ z.object({ kind: z.literal("missing") }),
14088
+ z.object({
14089
+ kind: z.literal("failed"),
14090
+ error: z.string()
14091
+ })
14092
+ ]);
14041
14093
  var SavedDeviceRowSchema = z.object({
14042
14094
  /** Numeric id reserved at allocateDeviceId time. */
14043
14095
  id: z.number(),
@@ -14836,6 +14888,21 @@ var deviceManagerCapability = {
14836
14888
  auth: "admin"
14837
14889
  }),
14838
14890
  /**
14891
+ * The STORED wrapper activation for one `(device, capName)` pair, three-way
14892
+ * (`value` / `missing` / `failed`, see {@link WrapperActivationReadSchema}).
14893
+ *
14894
+ * The narrow read of the durable authority behind `getBindings`: a
14895
+ * consumer that must know what the operator PERSISTED (virtual-doorbell,
14896
+ * before it drops a press) asks this instead of pulling device-manager's
14897
+ * whole addon store through `addonSettingsRaw.getGlobal` — which answered
14898
+ * `{}` on every isolated-engine hub and so never worked (D675). It reads
14899
+ * ONE row (the activation map, ~1.6 KB), never the ~625 KB store.
14900
+ */
14901
+ getWrapperActivation: method(z.object({
14902
+ deviceId: z.number(),
14903
+ capName: z.string().min(1)
14904
+ }), WrapperActivationReadSchema),
14905
+ /**
14839
14906
  * Return the addon ids that declared a wrapper provider for `capName`.
14840
14907
  * Backs the device-bindings UI's wrapper-picker dropdown. Entries are
14841
14908
  * sourced from `CapabilityRegistry.wrapperProviders`, populated when
@@ -43527,7 +43594,8 @@ function expressionOutcome(source, read, now, stateful) {
43527
43594
  state: "stale",
43528
43595
  value: evaluateCount(null, {
43529
43596
  kind: "count",
43530
- highWater: null
43597
+ highWater: null,
43598
+ primed: false
43531
43599
  }, stateful.currentOutput),
43532
43600
  reason: `${unavailable.reason}; holding the last accumulator value`,
43533
43601
  deadline: null
@@ -48579,6 +48647,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
48579
48647
  addonId: null,
48580
48648
  access: "view"
48581
48649
  },
48650
+ "deviceManager.getWrapperActivation": {
48651
+ capName: "device-manager",
48652
+ capScope: "system",
48653
+ addonId: null,
48654
+ access: "view"
48655
+ },
48582
48656
  "deviceManager.listAll": {
48583
48657
  capName: "device-manager",
48584
48658
  capScope: "system",
@@ -54388,6 +54462,11 @@ Object.freeze({
54388
54462
  form: "single",
54389
54463
  optional: false
54390
54464
  }],
54465
+ "deviceManager.getWrapperActivation": [{
54466
+ name: "deviceId",
54467
+ form: "single",
54468
+ optional: false
54469
+ }],
54391
54470
  "deviceManager.listAll": [{
54392
54471
  name: "deviceIds",
54393
54472
  form: "array",
@@ -701,7 +701,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
701
701
  return EventCategory;
702
702
  }({});
703
703
  //#endregion
704
- //#region ../types/dist/sleep-E6eD4yQS.mjs
704
+ //#region ../types/dist/sleep-DlrgY4Qb.mjs
705
705
  /**
706
706
  * The audio chunk plane's byte format, and the ONE expansion from a coded
707
707
  * window to float samples (D455).
@@ -3512,7 +3512,7 @@ function errMsg(err) {
3512
3512
  return String(err);
3513
3513
  }
3514
3514
  //#endregion
3515
- //#region ../types/dist/composition-D5BQywfe.mjs
3515
+ //#region ../types/dist/composition-BK-GTFYb.mjs
3516
3516
  var AUDIO_ENCODER_BY_CODEC = {
3517
3517
  opus: "libopus",
3518
3518
  aac: "aac",
@@ -4153,14 +4153,37 @@ function evaluateRose(level, changedAt, debounceMs, call, field, env) {
4153
4153
  field.acceptedEdgeAt = verdict.timestamp;
4154
4154
  return verdict.timestamp;
4155
4155
  }
4156
+ /**
4157
+ * `count(x)`: how many times `x` strictly advanced (D670). It starts on the
4158
+ * first ANSWERED read of `x`:
4159
+ * - an answered `null` ("never happened") primes it with no high-water, so the
4160
+ * next finite value is a real advance and counts 1;
4161
+ * - an answered finite value primes it with that value as the high-water and
4162
+ * no increment — it is history, not an event;
4163
+ * - anything else (a read that did not answer reaches here as neither) does
4164
+ * NOT prime it (D393: unknown is not null).
4165
+ * An unavailable binding never reaches this function at all: the field is
4166
+ * judged unavailable before the expression runs.
4167
+ *
4168
+ * Edge case, accepted: an input that answers `null` and LATER reports a
4169
+ * historical value (a sensor's `lastChangedAt` that was null until its first
4170
+ * report) counts that value once. For the doorbell it cannot happen — its
4171
+ * input is its own `lastPressedAt`, which only advances on a `rose` edge that
4172
+ * also emits the press — but an external input can overcount by one.
4173
+ */
4156
4174
  function evaluateCount(input, call, currentOutput) {
4157
4175
  const currentCount = typeof currentOutput === "number" && Number.isFinite(currentOutput) && currentOutput >= 0 ? currentOutput : 0;
4176
+ if (input === null) {
4177
+ call.primed = true;
4178
+ return currentCount;
4179
+ }
4158
4180
  if (typeof input !== "number" || !Number.isFinite(input)) return currentCount;
4159
- if (call.highWater === null) {
4181
+ if (!call.primed) {
4182
+ call.primed = true;
4160
4183
  call.highWater = input;
4161
4184
  return currentCount;
4162
4185
  }
4163
- if (input <= call.highWater) return currentCount;
4186
+ if (call.highWater !== null && input <= call.highWater) return currentCount;
4164
4187
  call.highWater = input;
4165
4188
  return currentCount + 1;
4166
4189
  }
@@ -4876,7 +4899,8 @@ function evaluateStatefulExpressionCall(invocation, memory, env) {
4876
4899
  case "count": {
4877
4900
  const call = existing?.kind === "count" ? existing : {
4878
4901
  kind: "count",
4879
- highWater: null
4902
+ highWater: null,
4903
+ primed: false
4880
4904
  };
4881
4905
  memory.calls.set(invocation.path, call);
4882
4906
  return evaluateCount(invocation.args[0], call, env.currentOutput);
@@ -14038,6 +14062,34 @@ var DeviceBindingsForDeviceSchema = zod.z.object({
14038
14062
  nativeAddonId: zod.z.string()
14039
14063
  }))
14040
14064
  });
14065
+ /**
14066
+ * The STORED wrapper activation for one `(device, capability)` pair — the row
14067
+ * `setWrapperActive` writes, read back three-way (D675):
14068
+ *
14069
+ * - `value` — the store answered and holds an activation: the bound wrapper's
14070
+ * addon id, or `null`, the operator's explicit "off" marker (D62);
14071
+ * - `missing` — the store answered, its activation map exists, and it holds
14072
+ * nothing for this pair: the operator never activated or deactivated a
14073
+ * wrapper here;
14074
+ * - `failed` — the store could not be read, holds no activation map at all
14075
+ * (an empty or unready snapshot, D44), or holds something that is not an
14076
+ * activation. It carries NO information: a consumer must never read it as
14077
+ * `missing` (D315, D393).
14078
+ *
14079
+ * This is the persisted INPUT, not the derived `getBindings` view — no registry
14080
+ * resolution, no `defaultActive` auto-binding, no cluster native-cap folding.
14081
+ */
14082
+ var WrapperActivationReadSchema = zod.z.discriminatedUnion("kind", [
14083
+ zod.z.object({
14084
+ kind: zod.z.literal("value"),
14085
+ wrapperAddonId: zod.z.string().nullable()
14086
+ }),
14087
+ zod.z.object({ kind: zod.z.literal("missing") }),
14088
+ zod.z.object({
14089
+ kind: zod.z.literal("failed"),
14090
+ error: zod.z.string()
14091
+ })
14092
+ ]);
14041
14093
  var SavedDeviceRowSchema = zod.z.object({
14042
14094
  /** Numeric id reserved at allocateDeviceId time. */
14043
14095
  id: zod.z.number(),
@@ -14836,6 +14888,21 @@ var deviceManagerCapability = {
14836
14888
  auth: "admin"
14837
14889
  }),
14838
14890
  /**
14891
+ * The STORED wrapper activation for one `(device, capName)` pair, three-way
14892
+ * (`value` / `missing` / `failed`, see {@link WrapperActivationReadSchema}).
14893
+ *
14894
+ * The narrow read of the durable authority behind `getBindings`: a
14895
+ * consumer that must know what the operator PERSISTED (virtual-doorbell,
14896
+ * before it drops a press) asks this instead of pulling device-manager's
14897
+ * whole addon store through `addonSettingsRaw.getGlobal` — which answered
14898
+ * `{}` on every isolated-engine hub and so never worked (D675). It reads
14899
+ * ONE row (the activation map, ~1.6 KB), never the ~625 KB store.
14900
+ */
14901
+ getWrapperActivation: method(zod.z.object({
14902
+ deviceId: zod.z.number(),
14903
+ capName: zod.z.string().min(1)
14904
+ }), WrapperActivationReadSchema),
14905
+ /**
14839
14906
  * Return the addon ids that declared a wrapper provider for `capName`.
14840
14907
  * Backs the device-bindings UI's wrapper-picker dropdown. Entries are
14841
14908
  * sourced from `CapabilityRegistry.wrapperProviders`, populated when
@@ -43527,7 +43594,8 @@ function expressionOutcome(source, read, now, stateful) {
43527
43594
  state: "stale",
43528
43595
  value: evaluateCount(null, {
43529
43596
  kind: "count",
43530
- highWater: null
43597
+ highWater: null,
43598
+ primed: false
43531
43599
  }, stateful.currentOutput),
43532
43600
  reason: `${unavailable.reason}; holding the last accumulator value`,
43533
43601
  deadline: null
@@ -48579,6 +48647,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
48579
48647
  addonId: null,
48580
48648
  access: "view"
48581
48649
  },
48650
+ "deviceManager.getWrapperActivation": {
48651
+ capName: "device-manager",
48652
+ capScope: "system",
48653
+ addonId: null,
48654
+ access: "view"
48655
+ },
48582
48656
  "deviceManager.listAll": {
48583
48657
  capName: "device-manager",
48584
48658
  capScope: "system",
@@ -54388,6 +54462,11 @@ Object.freeze({
54388
54462
  form: "single",
54389
54463
  optional: false
54390
54464
  }],
54465
+ "deviceManager.getWrapperActivation": [{
54466
+ name: "deviceId",
54467
+ form: "single",
54468
+ optional: false
54469
+ }],
54391
54470
  "deviceManager.listAll": [{
54392
54471
  name: "deviceIds",
54393
54472
  form: "array",