@camstack/server 1.2.859 → 1.2.861

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 (95) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/api/trpc/generated-cap-routers.js +16 -0
  3. package/dist/core/cluster-update/cluster-update-steps.js +10 -2
  4. package/dist/server-root/index.js +1125 -45
  5. package/package.json +10 -9
  6. package/system/dist/addon-runner.js +76 -1
  7. package/system/dist/addon-runner.mjs +76 -1
  8. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  9. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  10. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  11. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  12. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  13. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  14. package/system/dist/builtins/autotrack/index.js +1 -1
  15. package/system/dist/builtins/autotrack/index.mjs +1 -1
  16. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  17. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  18. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  19. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  20. package/system/dist/builtins/camera-grid/index.js +1 -1
  21. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  22. package/system/dist/builtins/composer/composer.addon.js +4 -4
  23. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  24. package/system/dist/builtins/console-logging/index.js +1 -1
  25. package/system/dist/builtins/console-logging/index.mjs +1 -1
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  28. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  29. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  30. package/system/dist/builtins/device-manager/device-manager.addon.js +32 -23
  31. package/system/dist/builtins/device-manager/device-manager.addon.mjs +32 -23
  32. package/system/dist/builtins/device-manager/device-search.d.ts +4 -3
  33. package/system/dist/builtins/device-manager/removal-fence.d.ts +2 -2
  34. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  35. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  36. package/system/dist/builtins/keychain/index.js +4 -4
  37. package/system/dist/builtins/keychain/index.mjs +4 -4
  38. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  39. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  40. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  41. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  42. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  43. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  44. package/system/dist/builtins/loki-logging/index.js +1 -1
  45. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  46. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  47. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  48. package/system/dist/builtins/platform-probe/index.js +1 -1
  49. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  50. package/system/dist/builtins/record-entries/index.js +1 -1
  51. package/system/dist/builtins/record-entries/index.mjs +1 -1
  52. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/system/dist/builtins/snapshot/index.js +1 -1
  55. package/system/dist/builtins/snapshot/index.mjs +1 -1
  56. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  57. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  58. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  59. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  60. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  61. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  62. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  63. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  64. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  65. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  66. package/system/dist/builtins/winston-logging/index.js +1 -1
  67. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  68. package/system/dist/{capture-engine-B4_fq2JB.mjs → capture-engine-B5OYzCH1.mjs} +1 -1
  69. package/system/dist/{capture-engine-yhFFC7F8.js → capture-engine-BManwD48.js} +1 -1
  70. package/system/dist/{composition-sources-BQOEYCJG.mjs → composition-sources-B8hoUx1K.mjs} +1 -1
  71. package/system/dist/{composition-sources-CKSSe5ny.js → composition-sources-DWu-IL2w.js} +1 -1
  72. package/system/dist/{constants-dfnEfsX7.js → constants-CUAopsxj.js} +1 -1
  73. package/system/dist/{constants-h8wJE_8O.mjs → constants-qDKQ7NaY.mjs} +1 -1
  74. package/system/dist/{device-ca-h54CenJx.mjs → device-ca-BOUTrISA.mjs} +1 -1
  75. package/system/dist/{device-ca-_o0-3jJ6.js → device-ca-DNrM4Ao-.js} +1 -1
  76. package/system/dist/{dist-atHH8IeD.mjs → dist-3MQdfUTG.mjs} +254 -71
  77. package/system/dist/{dist-WEGVb8qV.js → dist-B9Kzw974.js} +259 -70
  78. package/system/dist/file-host-worker.js +1 -1
  79. package/system/dist/file-host-worker.mjs +1 -1
  80. package/system/dist/{hub-identity-nIMYA24i.js → hub-identity-BQIE6w3g.js} +1 -1
  81. package/system/dist/{hub-identity-DLF698tj.mjs → hub-identity-DEbxcoVh.mjs} +1 -1
  82. package/system/dist/{hub-mdns-ciao-B6ZHStt1.js → hub-mdns-ciao-Bj_RdJiH.js} +2 -2
  83. package/system/dist/{hub-mdns-ciao-DchpUVAk.mjs → hub-mdns-ciao-BzKGywE2.mjs} +2 -2
  84. package/system/dist/index.js +84 -9
  85. package/system/dist/index.mjs +84 -9
  86. package/system/dist/kernel/moleculer/switch-toggle.d.ts +41 -0
  87. package/system/dist/{legacy-integration-rows-door-BbaIE1qF.js → legacy-integration-rows-door-CRfEC_HP.js} +1 -1
  88. package/system/dist/{legacy-integration-rows-door-DBO3ZLmn.mjs → legacy-integration-rows-door-rgL9olef.mjs} +1 -1
  89. package/system/dist/{rename-composition-block-IIfaFnEl.js → rename-composition-block-Bbt43q6n.js} +1 -1
  90. package/system/dist/{rename-composition-block-6ISzMLgj.mjs → rename-composition-block-DlgSgxch.mjs} +1 -1
  91. package/system/dist/{restore-archive-ChRNoqGg.js → restore-archive-DJBACMC0.js} +1 -1
  92. package/system/dist/{restore-archive-DeDRh7Lf.mjs → restore-archive-aQzQt2Kv.mjs} +82 -82
  93. package/system/dist/{wal-maintenance-BXj9xnDD.mjs → wal-maintenance-Bu6vjJlR.mjs} +0 -0
  94. package/system/dist/{wal-maintenance-l3CsKEaJ.js → wal-maintenance-BvIEU1r1.js} +0 -0
  95. package/system/package.json +1 -1
@@ -1261,7 +1261,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1261
1261
  */
1262
1262
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1263
1263
  //#endregion
1264
- //#region ../types/dist/sleep-Cykc2bzi.mjs
1264
+ //#region ../types/dist/sleep-BCWQQG52.mjs
1265
1265
  /**
1266
1266
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1267
1267
  * window to float samples (D455).
@@ -6736,41 +6736,57 @@ var CAP_VOCABULARY_BY_NAME = {
6736
6736
  en: "Switch",
6737
6737
  it: "Interruttore"
6738
6738
  },
6739
- actions: [{
6740
- id: "switch.on",
6741
- method: "setState",
6742
- label: {
6743
- en: "Turn on",
6744
- it: "Accendi"
6745
- },
6746
- phrase: {
6747
- en: "Turn on {device}",
6748
- it: "Accendi {device}"
6749
- },
6750
- icon: "power",
6751
- args: { on: true },
6752
- effect: {
6753
- field: "on",
6754
- value: true
6755
- }
6756
- }, {
6757
- id: "switch.off",
6758
- method: "setState",
6759
- label: {
6760
- en: "Turn off",
6761
- it: "Spegni"
6739
+ actions: [
6740
+ {
6741
+ id: "switch.on",
6742
+ method: "setState",
6743
+ label: {
6744
+ en: "Turn on",
6745
+ it: "Accendi"
6746
+ },
6747
+ phrase: {
6748
+ en: "Turn on {device}",
6749
+ it: "Accendi {device}"
6750
+ },
6751
+ icon: "power",
6752
+ args: { on: true },
6753
+ effect: {
6754
+ field: "on",
6755
+ value: true
6756
+ }
6762
6757
  },
6763
- phrase: {
6764
- en: "Turn off {device}",
6765
- it: "Spegni {device}"
6758
+ {
6759
+ id: "switch.off",
6760
+ method: "setState",
6761
+ label: {
6762
+ en: "Turn off",
6763
+ it: "Spegni"
6764
+ },
6765
+ phrase: {
6766
+ en: "Turn off {device}",
6767
+ it: "Spegni {device}"
6768
+ },
6769
+ icon: "power-off",
6770
+ args: { on: false },
6771
+ effect: {
6772
+ field: "on",
6773
+ value: false
6774
+ }
6766
6775
  },
6767
- icon: "power-off",
6768
- args: { on: false },
6769
- effect: {
6770
- field: "on",
6771
- value: false
6776
+ {
6777
+ id: "switch.toggle",
6778
+ method: "toggle",
6779
+ label: {
6780
+ en: "Toggle",
6781
+ it: "Commuta"
6782
+ },
6783
+ phrase: {
6784
+ en: "Toggle {device}",
6785
+ it: "Commuta {device}"
6786
+ },
6787
+ icon: "toggle-right"
6772
6788
  }
6773
- }],
6789
+ ],
6774
6790
  state: [{
6775
6791
  kind: "boolean",
6776
6792
  field: "on",
@@ -59735,7 +59751,9 @@ var ClusterUpdateFailureReasonSchema = zod.z.enum([
59735
59751
  "status-unreadable",
59736
59752
  "addon-update-failed",
59737
59753
  "addons-not-converged",
59738
- "interrupted"
59754
+ "interrupted",
59755
+ "timeout-stall",
59756
+ "timeout-ceiling"
59739
59757
  ]);
59740
59758
  var ClusterUpdateStepSchema = zod.z.object({
59741
59759
  kind: ClusterUpdateStepKindSchema,
@@ -63360,9 +63378,17 @@ function forwardSourceRefs(composition) {
63360
63378
  const refs = composition.features.flatMap((feature, index) => feature.kind === "fields" && compositionFeatureEnabled(feature) ? featureForwards(feature, index).map((forward) => forward.command.source) : []);
63361
63379
  return [...new Map(refs.map((ref) => [compositionSourceKey(ref), ref])).values()];
63362
63380
  }
63381
+ /**
63382
+ * `switch.toggle` is not a forward. Native-cap registration installs one
63383
+ * default that reads the slice and calls this provider's `setState`, and a
63384
+ * composed switch already forwards `setState`.
63385
+ */
63386
+ function servedByRegistrationDefault(def, method) {
63387
+ return def.name === "switch" && method === "toggle";
63388
+ }
63363
63389
  /** The methods a BUILT cap must give a command: served, and not answered by the composer itself. */
63364
63390
  function commandedMethods(def) {
63365
- return Object.entries(def.methods).filter(([name, m]) => m.systemOnly !== true && def.composedMethods?.[name] === void 0).map(([name]) => name);
63391
+ return Object.entries(def.methods).filter(([name, m]) => m.systemOnly !== true && def.composedMethods?.[name] === void 0 && !servedByRegistrationDefault(def, name)).map(([name]) => name);
63366
63392
  }
63367
63393
  var NO_INPUT = {
63368
63394
  all: /* @__PURE__ */ new Set(),
@@ -68290,9 +68316,15 @@ function siteZoneKey(label) {
68290
68316
  return label.trim().toLowerCase();
68291
68317
  }
68292
68318
  var DeviceSearchRequiresSchema = zod.z.object({
68293
- /** Capability names the field wants a value of. */
68294
- caps: zod.z.array(zod.z.string()).readonly(),
68295
- /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
68319
+ /** Capability names the field wants a value of. Absent when the field wants actions only. */
68320
+ caps: zod.z.array(zod.z.string()).readonly().optional(),
68321
+ /**
68322
+ * Vocabulary action ids (`cover.open`) the device must offer. Compatible means
68323
+ * the device's bindings resolve those actions; `values` stays empty when no
68324
+ * cap was required. `mode` applies the same way as for `caps`.
68325
+ */
68326
+ actions: zod.z.array(zod.z.string()).readonly().optional(),
68327
+ /** `any` (default): one of the named caps, and one of the named actions, is enough. `all`: every one. */
68296
68328
  mode: zod.z.enum(["any", "all"]).optional()
68297
68329
  });
68298
68330
  var DeviceSearchFiltersSchema = zod.z.object({
@@ -92135,6 +92167,13 @@ var NcHistoryEntrySchema = zod.z.object({
92135
92167
  error: zod.z.string().optional(),
92136
92168
  subject: NcHistorySubjectSchema,
92137
92169
  /**
92170
+ * The title and body actually sent, frozen at delivery. Absent on a row
92171
+ * still pending, a row suppressed before a notification was built, and a
92172
+ * row delivered before this field shipped.
92173
+ */
92174
+ title: zod.z.string().optional(),
92175
+ body: zod.z.string().optional(),
92176
+ /**
92138
92177
  * Ids of the artefacts (still, then gif, then clip) this row's successful
92139
92178
  * delivery indexed in the artefact library — a REFERENCE, never the bytes
92140
92179
  * (an artefact is often megabytes; this row is durable JSON rewritten on
@@ -102336,7 +102375,8 @@ var ServerUpdateActionResultSchema = zod.z.object({
102336
102375
  outcome: ServerUpdateOutcomeSchema.optional(),
102337
102376
  /**
102338
102377
  * Stable, greppable cause for `refused` / `failed` (the engine's
102339
- * `UpdateRefusalReason`, `staging-failed`, …). `null` on success.
102378
+ * `UpdateRefusalReason`, `staging-failed`, `timeout-stall`,
102379
+ * `timeout-ceiling`). `null` on success.
102340
102380
  */
102341
102381
  reason: zod.z.string().nullable().optional(),
102342
102382
  /**
@@ -102502,6 +102542,14 @@ var smokeCapability = {
102502
102542
  }]
102503
102543
  }
102504
102544
  };
102545
+ var EmailImagePartSchema = zod.z.object({
102546
+ ticket: PeerBytesTicketSchema,
102547
+ mime: zod.z.string().min(1),
102548
+ name: zod.z.string().min(1),
102549
+ contentId: zod.z.string().min(1),
102550
+ placement: zod.z.enum(["inline", "attachment"]),
102551
+ deviceId: zod.z.number().int().nonnegative().optional()
102552
+ });
102505
102553
  /**
102506
102554
  * `smtp-provider` — pluggable email delivery surface.
102507
102555
  *
@@ -102511,8 +102559,8 @@ var smokeCapability = {
102511
102559
  * ready provider OR target a specific addonId.
102512
102560
  *
102513
102561
  * The shape stays small on purpose — `sendEmail` is enough for the
102514
- * 90% case. Attachments / HTML templating / multi-part are room for
102515
- * future fields without breaking the existing call sites.
102562
+ * 90% case. An image is not a byte field on this method (D613): `images`
102563
+ * names `peerBytes` tickets the sender opens and folds into one MIME body.
102516
102564
  */
102517
102565
  var EmailAddressSchema = zod.z.email();
102518
102566
  /**
@@ -102539,7 +102587,12 @@ var SendEmailInputSchema = zod.z.object({
102539
102587
  * for clients that strip HTML — including most spam filters). */
102540
102588
  text: zod.z.string(),
102541
102589
  /** Optional HTML body. Renders alongside `text` as multi-part. */
102542
- html: zod.z.string().optional()
102590
+ html: zod.z.string().optional(),
102591
+ /**
102592
+ * Images the caller already offered over `peerBytes`. Absent = a mail with
102593
+ * no image. The sender opens each ticket; one it cannot read is left out.
102594
+ */
102595
+ images: zod.z.array(EmailImagePartSchema).max(3).optional()
102543
102596
  });
102544
102597
  var SendEmailResultSchema = zod.z.object({
102545
102598
  messageId: zod.z.string(),
@@ -103976,34 +104029,46 @@ var switchCapability = {
103976
104029
  DeviceType.Light,
103977
104030
  DeviceType.Fan
103978
104031
  ],
103979
- methods: { setState: method(zod.z.object({
103980
- deviceId: zod.z.number(),
103981
- on: zod.z.boolean()
103982
- }), zod.z.void(), {
103983
- kind: "mutation",
103984
- auth: "protected",
103985
- actions: [{
103986
- id: "switch.on",
103987
- label: t("Turn on", "Accendi"),
103988
- phrase: t("Turn on {device}", "Accendi {device}"),
103989
- icon: "power",
103990
- effect: {
103991
- field: "on",
103992
- value: true
103993
- },
103994
- args: { on: true }
103995
- }, {
103996
- id: "switch.off",
103997
- label: t("Turn off", "Spegni"),
103998
- phrase: t("Turn off {device}", "Spegni {device}"),
103999
- icon: "power-off",
104000
- effect: {
104001
- field: "on",
104002
- value: false
104003
- },
104004
- args: { on: false }
104005
- }]
104006
- }) },
104032
+ methods: {
104033
+ setState: method(zod.z.object({
104034
+ deviceId: zod.z.number(),
104035
+ on: zod.z.boolean()
104036
+ }), zod.z.void(), {
104037
+ kind: "mutation",
104038
+ auth: "protected",
104039
+ actions: [{
104040
+ id: "switch.on",
104041
+ label: t("Turn on", "Accendi"),
104042
+ phrase: t("Turn on {device}", "Accendi {device}"),
104043
+ icon: "power",
104044
+ effect: {
104045
+ field: "on",
104046
+ value: true
104047
+ },
104048
+ args: { on: true }
104049
+ }, {
104050
+ id: "switch.off",
104051
+ label: t("Turn off", "Spegni"),
104052
+ phrase: t("Turn off {device}", "Spegni {device}"),
104053
+ icon: "power-off",
104054
+ effect: {
104055
+ field: "on",
104056
+ value: false
104057
+ },
104058
+ args: { on: false }
104059
+ }]
104060
+ }),
104061
+ toggle: optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
104062
+ kind: "mutation",
104063
+ auth: "protected",
104064
+ actions: [{
104065
+ id: "switch.toggle",
104066
+ label: t("Toggle", "Commuta"),
104067
+ phrase: t("Toggle {device}", "Commuta {device}"),
104068
+ icon: "toggle-right"
104069
+ }]
104070
+ })
104071
+ },
104007
104072
  events: { onStateChanged: {
104008
104073
  data: zod.z.object({
104009
104074
  deviceId: zod.z.number(),
@@ -126284,6 +126349,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
126284
126349
  access: "create",
126285
126350
  role: "viewer"
126286
126351
  },
126352
+ "switch.toggle": {
126353
+ capName: "switch",
126354
+ capScope: "device",
126355
+ addonId: null,
126356
+ access: "create",
126357
+ role: "viewer"
126358
+ },
126287
126359
  "system.debugWatch": {
126288
126360
  capName: "system",
126289
126361
  capScope: "system",
@@ -127391,6 +127463,83 @@ var METHOD_ACCESS_MAP = Object.freeze({
127391
127463
  role: "admin"
127392
127464
  }
127393
127465
  });
127466
+ function isBindingList(bindings) {
127467
+ return Array.isArray(bindings);
127468
+ }
127469
+ function capNamesOf(bindings) {
127470
+ const names = [];
127471
+ if (isBindingList(bindings)) {
127472
+ for (const item of bindings) names.push(typeof item === "string" ? item : item.capName);
127473
+ return names;
127474
+ }
127475
+ for (const entry of bindings.entries) names.push(entry.capName);
127476
+ return names;
127477
+ }
127478
+ /** The device-scoped entries the device binds, in the map's order. */
127479
+ function boundEntries(bindings) {
127480
+ const bound = new Set(capNamesOf(bindings));
127481
+ return Object.entries(CAP_VOCABULARY_BY_NAME).filter(([cap, entry]) => bound.has(cap) && entry.scope === "device");
127482
+ }
127483
+ /** The wordings that apply: the type's first, then the role's (a role wins). */
127484
+ function wordingsFor(entry, deviceType, role) {
127485
+ const out = [];
127486
+ const byType = deviceType === void 0 ? void 0 : entry.overrides?.byType?.[deviceType];
127487
+ if (byType !== void 0) out.push(byType);
127488
+ const byRole = role === void 0 || role === null ? void 0 : entry.overrides?.byRole?.[role];
127489
+ if (byRole !== void 0) out.push(byRole);
127490
+ return out;
127491
+ }
127492
+ function actionWording(wordings, id) {
127493
+ return wordings.reduce((acc, w) => ({
127494
+ ...acc,
127495
+ ...w.actions?.[id]
127496
+ }), {});
127497
+ }
127498
+ function accessOf(cap, method) {
127499
+ return METHOD_ACCESS_MAP[`${kebabToCamel(cap)}.${method}`]?.access;
127500
+ }
127501
+ function resolveAction(cap, action, wordings) {
127502
+ const access = accessOf(cap, action.method);
127503
+ if (access === void 0 || access === "view") return null;
127504
+ const w = actionWording(wordings, action.id);
127505
+ return {
127506
+ id: action.id,
127507
+ cap,
127508
+ method: action.method,
127509
+ label: w.label ?? action.label,
127510
+ phrase: w.phrase ?? action.phrase,
127511
+ icon: w.icon ?? action.icon,
127512
+ args: action.args ?? {},
127513
+ openArgs: action.openArgs ?? [],
127514
+ access
127515
+ };
127516
+ }
127517
+ /**
127518
+ * The actions a device can be made to do, phrased for its type and role.
127519
+ * An action whose method is no longer routable (absent from
127520
+ * METHOD_ACCESS_MAP, or a read) is dropped.
127521
+ */
127522
+ function actionsForDevice(bindings, deviceType, role) {
127523
+ const out = [];
127524
+ for (const [cap, entry] of boundEntries(bindings)) {
127525
+ const wordings = wordingsFor(entry, deviceType, role);
127526
+ for (const action of entry.actions ?? []) {
127527
+ const resolved = resolveAction(cap, action, wordings);
127528
+ if (resolved !== null) out.push(resolved);
127529
+ }
127530
+ }
127531
+ return out;
127532
+ }
127533
+ /**
127534
+ * Whether a device offers the vocabulary actions, with the same `any` / `all`
127535
+ * rule a cap require uses. An empty list passes. This is the one check the
127536
+ * device search and the command picker share.
127537
+ */
127538
+ function deviceOffersActions(bindings, actionIds, mode = "any", deviceType) {
127539
+ if (actionIds.length === 0) return true;
127540
+ const offered = new Set(actionsForDevice(bindings, deviceType).map((action) => action.id));
127541
+ return mode === "all" ? actionIds.every((id) => offered.has(id)) : actionIds.some((id) => offered.has(id));
127542
+ }
127394
127543
  DeviceFeature.BatteryOperated;
127395
127544
  function bound(cap, methods = [], authority = "reported") {
127396
127545
  return {
@@ -130358,6 +130507,12 @@ Object.freeze({
130358
130507
  form: "single",
130359
130508
  optional: false
130360
130509
  }],
130510
+ "smtpProvider.sendEmail": [{
130511
+ name: "images",
130512
+ form: "object-array",
130513
+ optional: true,
130514
+ itemField: "deviceId"
130515
+ }],
130361
130516
  "snapshot.applyDeviceSettingsPatch": [{
130362
130517
  name: "deviceId",
130363
130518
  form: "single",
@@ -130524,6 +130679,11 @@ Object.freeze({
130524
130679
  form: "single",
130525
130680
  optional: false
130526
130681
  }],
130682
+ "switch.toggle": [{
130683
+ name: "deviceId",
130684
+ form: "single",
130685
+ optional: false
130686
+ }],
130527
130687
  "system.debugWatch": [{
130528
130688
  name: "deviceIds",
130529
130689
  form: "array",
@@ -131793,6 +131953,28 @@ var STATE_SUMMARY_VARS = [
131793
131953
  systemEventKinds: [...SUMMARISABLE],
131794
131954
  systemEventDeliveries: ["summary"]
131795
131955
  },
131956
+ {
131957
+ name: "offlineCount",
131958
+ label: "Summary: how many went offline",
131959
+ example: "2",
131960
+ group: "system",
131961
+ families: ["rule"],
131962
+ fields: [...RULE_TEXT],
131963
+ kinds: ["system"],
131964
+ systemEventKinds: [...SUMMARISABLE],
131965
+ systemEventDeliveries: ["summary"]
131966
+ },
131967
+ {
131968
+ name: "onlineCount",
131969
+ label: "Summary: how many came back",
131970
+ example: "5",
131971
+ group: "system",
131972
+ families: ["rule"],
131973
+ fields: [...RULE_TEXT],
131974
+ kinds: ["system"],
131975
+ systemEventKinds: [...SUMMARISABLE],
131976
+ systemEventDeliveries: ["summary"]
131977
+ },
131796
131978
  {
131797
131979
  name: "summaryCount",
131798
131980
  label: "Summary: items reported",
@@ -131834,6 +132016,7 @@ var STATE_SUMMARY_VARS = [
131834
132016
  ([...RULE_TEXT], [...COMBINED_ALARM]),
131835
132017
  ([...RULE_TEXT], [...COMBINED_ALARM]),
131836
132018
  [...RULE_TEXT],
132019
+ [...RULE_TEXT],
131837
132020
  ([...RULE_TEXT], [...COMBINED_ALARM]),
131838
132021
  ([...RULE_TEXT], [...PACKAGE_UPDATES]),
131839
132022
  [...RULE_TEXT],
@@ -134659,6 +134842,12 @@ Object.defineProperty(exports, "deviceManagerCapability", {
134659
134842
  return deviceManagerCapability;
134660
134843
  }
134661
134844
  });
134845
+ Object.defineProperty(exports, "deviceOffersActions", {
134846
+ enumerable: true,
134847
+ get: function() {
134848
+ return deviceOffersActions;
134849
+ }
134850
+ });
134662
134851
  Object.defineProperty(exports, "deviceRemovalHookCapability", {
134663
134852
  enumerable: true,
134664
134853
  get: function() {
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-l3CsKEaJ.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-BvIEU1r1.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-BXj9xnDD.mjs";
1
+ import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-Bu6vjJlR.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-WEGVb8qV.js");
2
+ const require_dist = require("./dist-B9Kzw974.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
4
  let zod = require("zod");
5
5
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { Ic as defineRecordKinds } from "./dist-atHH8IeD.mjs";
1
+ import { Lc as defineRecordKinds } from "./dist-3MQdfUTG.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, _ as NameConstraints, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, g as GeneralSubtrees, h as GeneralSubtree, i as Extension, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension, v as GeneralName, x as AsnConvert } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { z } from "zod";
4
4
  import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-WEGVb8qV.js");
2
+ const require_dist = require("./dist-B9Kzw974.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_hub_identity = require("./hub-identity-nIMYA24i.js");
4
+ const require_hub_identity = require("./hub-identity-BQIE6w3g.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs = require("node:fs");
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { El as userError } from "./dist-atHH8IeD.mjs";
2
+ import { Dl as userError } from "./dist-3MQdfUTG.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-DLF698tj.mjs";
4
+ import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-DEbxcoVh.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -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-WEGVb8qV.js");
4
- const require_device_ca = require("./device-ca-_o0-3jJ6.js");
3
+ const require_dist = require("./dist-B9Kzw974.js");
4
+ const require_device_ca = require("./device-ca-DNrM4Ao-.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_log_redactor = require("./log-redactor-BhIEMaG9.js");
7
7
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
@@ -28,22 +28,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
28
28
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
29
29
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
30
30
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
31
- const require_wal_maintenance = require("./wal-maintenance-l3CsKEaJ.js");
32
- const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-BbaIE1qF.js");
31
+ const require_wal_maintenance = require("./wal-maintenance-BvIEU1r1.js");
32
+ const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-CRfEC_HP.js");
33
33
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
34
34
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
35
35
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
36
36
  require("./builtins/storage-orchestrator/index.js");
37
- const require_hub_identity = require("./hub-identity-nIMYA24i.js");
38
- const require_constants = require("./constants-dfnEfsX7.js");
37
+ const require_hub_identity = require("./hub-identity-BQIE6w3g.js");
38
+ const require_constants = require("./constants-CUAopsxj.js");
39
39
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
40
40
  require("./builtins/system-config/index.js");
41
41
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
42
42
  const require_custom_action_registry = require("./custom-action-registry-CmWpSeMS.js");
43
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-B6ZHStt1.js");
43
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-Bj_RdJiH.js");
44
44
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
45
45
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
46
- const require_restore_archive = require("./restore-archive-ChRNoqGg.js");
46
+ const require_restore_archive = require("./restore-archive-DJBACMC0.js");
47
47
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
48
48
  let zod = require("zod");
49
49
  let node_crypto = require("node:crypto");
@@ -13729,6 +13729,76 @@ function recordsTransportOf(api) {
13729
13729
  };
13730
13730
  }
13731
13731
  //#endregion
13732
+ //#region src/kernel/moleculer/switch-toggle.ts
13733
+ var REFUSAL_TEXT = {
13734
+ "no-slice": "switch has no state slice",
13735
+ stale: "switch state is unknown"
13736
+ };
13737
+ var SwitchToggleRefusedError = class extends Error {
13738
+ reason;
13739
+ deviceId;
13740
+ constructor(reason, deviceId) {
13741
+ super(`device ${deviceId}: ${REFUSAL_TEXT[reason]}; refusing to guess on or off`);
13742
+ this.name = "SwitchToggleRefusedError";
13743
+ this.reason = reason;
13744
+ this.deviceId = deviceId;
13745
+ }
13746
+ };
13747
+ /** `on` when the slice states it, otherwise the reason the toggle must refuse. */
13748
+ function classifySwitchOn(slice) {
13749
+ if (slice === void 0 || slice === null) return {
13750
+ known: false,
13751
+ reason: "no-slice"
13752
+ };
13753
+ if (typeof slice !== "object" || Array.isArray(slice)) return {
13754
+ known: false,
13755
+ reason: "stale"
13756
+ };
13757
+ const on = Reflect.get(slice, "on");
13758
+ if (typeof on !== "boolean") return {
13759
+ known: false,
13760
+ reason: "stale"
13761
+ };
13762
+ return {
13763
+ known: true,
13764
+ on
13765
+ };
13766
+ }
13767
+ function isSetState(fn) {
13768
+ return typeof fn === "function";
13769
+ }
13770
+ function refuse$1(read, deviceId, reason) {
13771
+ read.logger.warn(`switch.toggle refused: ${REFUSAL_TEXT[reason]}`, {
13772
+ tags: { deviceId },
13773
+ meta: { reason }
13774
+ });
13775
+ throw new SwitchToggleRefusedError(reason, deviceId);
13776
+ }
13777
+ async function runToggle(provider, setState, read, input) {
13778
+ const deviceId = typeof input?.deviceId === "number" ? input.deviceId : read.deviceId;
13779
+ const state = classifySwitchOn(deviceId === read.deviceId ? read.readSlice() : void 0);
13780
+ if (!state.known) refuse$1(read, deviceId, state.reason);
13781
+ await setState.call(provider, {
13782
+ deviceId,
13783
+ on: !state.on
13784
+ });
13785
+ }
13786
+ /**
13787
+ * `provider`, plus `toggle` when `capName` is `switch` and the provider did
13788
+ * not write one. Any other cap is returned as the same object.
13789
+ */
13790
+ function withDefaultSwitchToggle(capName, provider, read) {
13791
+ if (capName !== "switch") return provider;
13792
+ if (typeof Reflect.get(provider, "toggle") === "function") return provider;
13793
+ const setState = Reflect.get(provider, "setState");
13794
+ if (!isSetState(setState)) return provider;
13795
+ const toggle = (input) => runToggle(provider, setState, read, input);
13796
+ return {
13797
+ ...provider,
13798
+ toggle
13799
+ };
13800
+ }
13801
+ //#endregion
13732
13802
  //#region src/kernel/moleculer/children-batch-loader.ts
13733
13803
  /**
13734
13804
  * Narrow an untyped cap answer to the fields the reconcile reads.
@@ -14281,7 +14351,7 @@ function createBrokerDeviceManagerApi(opts) {
14281
14351
  }
14282
14352
  });
14283
14353
  }
14284
- const finalProvider = (() => {
14354
+ const withStatus = (() => {
14285
14355
  if (!cap.status || !cap.runtimeState || !runtimeStateRef) return provider;
14286
14356
  if (typeof Reflect.get(provider, "getStatus") === "function") return provider;
14287
14357
  const rsRef = runtimeStateRef;
@@ -14294,6 +14364,11 @@ function createBrokerDeviceManagerApi(opts) {
14294
14364
  getStatus: defaultGetStatus
14295
14365
  };
14296
14366
  })();
14367
+ const finalProvider = withDefaultSwitchToggle(cap.name, withStatus, {
14368
+ deviceId: id,
14369
+ readSlice: () => runtimeStateRef?.getCapState("switch"),
14370
+ logger: opts.logger
14371
+ });
14297
14372
  if (opts.capabilityRegistry) opts.capabilityRegistry.registerNativeProvider(cap.name, id, addonId, finalProvider);
14298
14373
  else if (opts.broker || opts.udsMode) {
14299
14374
  let perCap = workerNativeCaps.get(cap.name);