@camstack/server 1.2.894 → 1.2.895

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 (92) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/trpc/generated-cap-mounts.js +3 -1
  3. package/dist/api/trpc/generated-cap-routers.js +1528 -1499
  4. package/package.json +27 -17
  5. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  6. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  7. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  8. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  9. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  10. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  11. package/system/dist/builtins/autotrack/index.js +1 -1
  12. package/system/dist/builtins/autotrack/index.mjs +1 -1
  13. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  14. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  15. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  16. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  17. package/system/dist/builtins/camera-grid/index.js +1 -1
  18. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  19. package/system/dist/builtins/composer/composer.addon.js +5 -5
  20. package/system/dist/builtins/composer/composer.addon.mjs +5 -5
  21. package/system/dist/builtins/composer/graft-host.d.ts +1 -1
  22. package/system/dist/builtins/console-logging/index.js +1 -1
  23. package/system/dist/builtins/console-logging/index.mjs +1 -1
  24. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  26. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  27. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  28. package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
  29. package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  30. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  31. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  32. package/system/dist/builtins/keychain/index.js +4 -4
  33. package/system/dist/builtins/keychain/index.mjs +4 -4
  34. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  35. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  36. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  37. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  38. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  39. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  40. package/system/dist/builtins/loki-logging/index.js +1 -1
  41. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  42. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  43. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  44. package/system/dist/builtins/platform-probe/index.js +1 -1
  45. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  46. package/system/dist/builtins/record-entries/index.js +1 -1
  47. package/system/dist/builtins/record-entries/index.mjs +1 -1
  48. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  49. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  50. package/system/dist/builtins/snapshot/index.js +14 -12
  51. package/system/dist/builtins/snapshot/index.mjs +14 -12
  52. package/system/dist/builtins/snapshot/snapshot.addon.d.ts +6 -4
  53. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  54. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  55. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  56. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  57. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  58. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  59. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  60. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  61. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  62. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  63. package/system/dist/builtins/winston-logging/index.js +1 -1
  64. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  65. package/system/dist/{capture-engine-DhqkkOfH.js → capture-engine-BgIjQWh6.js} +1 -1
  66. package/system/dist/{capture-engine-6UsbHfRF.mjs → capture-engine-DPn6JaPc.mjs} +1 -1
  67. package/system/dist/{composition-sources-DmDAqBqM.mjs → composition-sources-B0rdPm85.mjs} +1 -1
  68. package/system/dist/{composition-sources-AbyhP_uF.js → composition-sources-Bec_hQMM.js} +1 -1
  69. package/system/dist/{constants-CLyC9O9i.js → constants-CsYMak6g.js} +1 -1
  70. package/system/dist/{constants-DMeh8SL7.mjs → constants-DsQsO8PD.mjs} +1 -1
  71. package/system/dist/{device-ca-C4odTE-a.js → device-ca-BeK8EI_7.js} +1 -1
  72. package/system/dist/{device-ca-BJ714blt.mjs → device-ca-BuDqRFZd.mjs} +1 -1
  73. package/system/dist/{dist-BDciHA-9.js → dist-CHC8tlB1.js} +253 -88
  74. package/system/dist/{dist-DLp5CYDy.mjs → dist-DiknL6UU.mjs} +236 -77
  75. package/system/dist/file-host-worker.js +1 -1
  76. package/system/dist/file-host-worker.mjs +1 -1
  77. package/system/dist/{hub-identity-BLkehzWw.js → hub-identity-BM26oLpK.js} +1 -1
  78. package/system/dist/{hub-identity-C6c6E6Xn.mjs → hub-identity-Dt-mbtkY.mjs} +1 -1
  79. package/system/dist/{hub-mdns-ciao-ByOblmkT.js → hub-mdns-ciao-BDgSHCPM.js} +2 -2
  80. package/system/dist/{hub-mdns-ciao-oQtUklUf.mjs → hub-mdns-ciao-CHq7b1FX.mjs} +2 -2
  81. package/system/dist/index.js +8 -8
  82. package/system/dist/index.mjs +8 -8
  83. package/system/dist/kernel/status-overlay.d.ts +1 -1
  84. package/system/dist/{legacy-integration-rows-door-D_FBo1b1.mjs → legacy-integration-rows-door-1WauJNCy.mjs} +1 -1
  85. package/system/dist/{legacy-integration-rows-door-CVwsY9u6.js → legacy-integration-rows-door-BYJa0xPI.js} +1 -1
  86. package/system/dist/{rename-composition-block-CnA_Dslb.mjs → rename-composition-block-BOoAElGp.mjs} +1 -1
  87. package/system/dist/{rename-composition-block-_LotNQv9.js → rename-composition-block-fMaUic9d.js} +1 -1
  88. package/system/dist/{restore-archive-CXPBPM61.js → restore-archive-CeZV08vh.js} +1 -1
  89. package/system/dist/{restore-archive-WMuoi9Ve.mjs → restore-archive-DZDV10KN.mjs} +82 -82
  90. package/system/dist/{wal-maintenance-COXWd5qA.mjs → wal-maintenance-CekT_qH6.mjs} +0 -0
  91. package/system/dist/{wal-maintenance-h2cm6gDJ.js → wal-maintenance-CmCCUKZO.js} +0 -0
  92. package/system/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  let zod = require("zod");
2
2
  require("node:crypto");
3
- //#region ../types/dist/event-category-Hwx_JSCU.mjs
3
+ //#region ../types/dist/event-category-CY27-fF0.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -500,7 +500,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
500
500
  */
501
501
  EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
502
502
  /**
503
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
503
+ * Emitted by the battery cap provider WHEN `wakeUp` enters the
504
504
  * "wake in progress" window — between the Baichuan wake-up issue and
505
505
  * the camera's first dialed-back RTP packet. The stream-broker
506
506
  * manager subscribes to flip the per-broker placeholder reason to
@@ -832,7 +832,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
832
832
  return EventCategory;
833
833
  }({});
834
834
  //#endregion
835
- //#region ../types/dist/composed-stable-id-Kt5VKzGZ.mjs
835
+ //#region ../types/dist/composed-stable-id-BNTaDZEh.mjs
836
836
  /**
837
837
  import { errMsg } from '@camstack/types'
838
838
  * Extract a human-readable message from an unknown error value.
@@ -971,12 +971,19 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
971
971
  return DeviceType;
972
972
  }({});
973
973
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
974
+ /** The device reports a battery reading (the `battery` cap). Says nothing about sleep. */
974
975
  DeviceFeature["BatteryOperated"] = "battery-operated";
976
+ /**
977
+ * The device goes into low-power sleep and must be WOKEN before it streams
978
+ * (the `low-power-sleep` cap, `wakeUp`). A battery reading alone is
979
+ * not this: a battery sensor reports charge and never sleeps (#459, Q2).
980
+ */
981
+ DeviceFeature["Sleeps"] = "sleeps";
975
982
  DeviceFeature["Rebootable"] = "rebootable";
976
983
  /**
977
984
  * Device supports an on-demand re-sync of its derived spec with its
978
- * upstream source — drives the generic Re-sync button. The owning
979
- * provider implements the action via the `device-adoption.resync` cap.
985
+ * upstream source — drives the generic Re-sync button. Present when the
986
+ * device has the `resync` cap bound (#459, Q6).
980
987
  */
981
988
  DeviceFeature["Resyncable"] = "resyncable";
982
989
  DeviceFeature["NativeSnapshot"] = "native-snapshot";
@@ -1109,15 +1116,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1109
1116
  /** Automation `trigger` accepts a skipCondition flag — fires the
1110
1117
  * automation's actions while bypassing its condition block. */
1111
1118
  DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
1112
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
1113
- * map tile in the vacuum UI. */
1114
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
1115
1119
  /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
1116
1120
  * switches group. */
1117
1121
  DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
1118
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
1119
- * mower map tile. */
1120
- DeviceFeature["MowerHasMap"] = "mower-has-map";
1121
1122
  /** Robot mower exposes targeted mowing (all-area / zones / edges /
1122
1123
  * spots) — gates the Mow action + map selectors. */
1123
1124
  DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
@@ -1297,7 +1298,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1297
1298
  */
1298
1299
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1299
1300
  //#endregion
1300
- //#region ../types/dist/sleep-CFN40XWx.mjs
1301
+ //#region ../types/dist/sleep-BT1bLgPq.mjs
1301
1302
  /**
1302
1303
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1303
1304
  * window to float samples (D455).
@@ -13487,6 +13488,14 @@ var CAP_VOCABULARY_BY_NAME = {
13487
13488
  icon: "refresh-cw"
13488
13489
  }]
13489
13490
  },
13491
+ "resync": {
13492
+ scope: "device",
13493
+ noun: {
13494
+ en: "Re-sync",
13495
+ it: "Risincronizzazione"
13496
+ },
13497
+ notOperatorFacing: { resync: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action" }
13498
+ },
13490
13499
  "recording": {
13491
13500
  scope: "device",
13492
13501
  noun: {
@@ -15498,7 +15507,6 @@ var CAP_VOCABULARY_BY_NAME = {
15498
15507
  en: "Battery",
15499
15508
  it: "Batteria"
15500
15509
  },
15501
- notOperatorFacing: { wakeForStream: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" },
15502
15510
  state: [
15503
15511
  {
15504
15512
  kind: "numeric",
@@ -15608,6 +15616,14 @@ var CAP_VOCABULARY_BY_NAME = {
15608
15616
  icon: "moon"
15609
15617
  }]
15610
15618
  },
15619
+ "low-power-sleep": {
15620
+ scope: "device",
15621
+ noun: {
15622
+ en: "Low-power sleep",
15623
+ it: "Sospensione a basso consumo"
15624
+ },
15625
+ notOperatorFacing: { wakeUp: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage" }
15626
+ },
15611
15627
  "network-link": {
15612
15628
  scope: "device",
15613
15629
  noun: {
@@ -16823,6 +16839,7 @@ var CAP_NAMES = Object.freeze([
16823
16839
  "log-channels",
16824
16840
  "log-destination",
16825
16841
  "login-method",
16842
+ "low-power-sleep",
16826
16843
  "media-player",
16827
16844
  "mesh-network",
16828
16845
  "meter",
@@ -16876,6 +16893,7 @@ var CAP_NAMES = Object.freeze([
16876
16893
  "records",
16877
16894
  "remote",
16878
16895
  "remote-layout-components",
16896
+ "resync",
16879
16897
  "running-state",
16880
16898
  "scene-monitor",
16881
16899
  "schedulers",
@@ -18051,6 +18069,20 @@ Object.freeze({
18051
18069
  "path": "codeRequired",
18052
18070
  "valueType": "boolean"
18053
18071
  }],
18072
+ "low-power-sleep": [
18073
+ {
18074
+ "path": "sleeping",
18075
+ "valueType": "boolean"
18076
+ },
18077
+ {
18078
+ "path": "lastContactAt",
18079
+ "valueType": "number"
18080
+ },
18081
+ {
18082
+ "path": "lastUpdated",
18083
+ "valueType": "number"
18084
+ }
18085
+ ],
18054
18086
  "media-player": [
18055
18087
  {
18056
18088
  "path": "state",
@@ -19359,7 +19391,7 @@ function sleep(ms) {
19359
19391
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
19360
19392
  }
19361
19393
  //#endregion
19362
- //#region ../types/dist/implemented-methods-BiV3Y-40.mjs
19394
+ //#region ../types/dist/implemented-methods-k3KProJd.mjs
19363
19395
  var AUDIO_ENCODER_BY_CODEC = {
19364
19396
  opus: "libopus",
19365
19397
  aac: "aac",
@@ -58562,9 +58594,9 @@ var backupCapability = {
58562
58594
  vocabulary: { notOperatorFacing: "system backups — run and restored from the Backups page" }
58563
58595
  };
58564
58596
  /**
58565
- * Battery status snapshot. Emitted by providers whose device is
58566
- * battery-operated (cameras with `DeviceFeature.BatteryOperated`,
58567
- * future sensor/button accessories). Consumers build their own "low
58597
+ * Battery status snapshot. Emitted by providers whose device reports a
58598
+ * battery (`DeviceFeature.BatteryOperated`): battery cameras, sensors,
58599
+ * buttons. Whether the device SLEEPS is `low-power-sleep`, not this cap. Consumers build their own "low
58568
58600
  * battery" alerting on top — the cap deliberately does NOT enforce a
58569
58601
  * threshold.
58570
58602
  */
@@ -58721,47 +58753,12 @@ var batteryCapability = {
58721
58753
  deviceNative: true,
58722
58754
  mode: "singleton",
58723
58755
  deviceTypes: BATTERY_DEVICE_TYPES,
58724
- methods: {
58725
58756
  /**
58726
- * Explicitly wake the camera from low-power sleep ahead of a
58727
- * streaming session start. Consumers that initiate a stream
58728
- * against a sleeping battery cam (HomeKit Secure Video, Alexa
58729
- * RTCSession, snapshot wrappers) call this with a short timeout
58730
- * before establishing the media pipeline — the broker's own
58731
- * passive wake-on-dial works but adds 5–7 seconds to first-frame,
58732
- * during which the consumer renders a black screen. Pre-waking
58733
- * compresses that gap.
58734
- *
58735
- * Returns `awoke: true` when the firmware acknowledged the wake
58736
- * before `timeoutMs`. Returns `awoke: false` when it timed out OR
58737
- * the cap surface is unavailable (no Baichuan / firmware
58738
- * channel); the caller should still attempt the stream — the
58739
- * passive broker wake remains as fallback.
58757
+ * No methods: waking a sleeping camera is `low-power-sleep.wakeUp`
58758
+ * (#459, Q2). A battery reading says nothing about sleep — a battery sensor
58759
+ * reports charge and never needs waking.
58740
58760
  */
58741
- wakeForStream: method(zod.z.object({
58742
- deviceId: zod.z.number(),
58743
- /** Bound on the wait. Sensible range 3000–10000ms. */
58744
- timeoutMs: zod.z.number().int().min(500).max(3e4).default(8e3)
58745
- }), zod.z.object({
58746
- awoke: zod.z.boolean(),
58747
- durationMs: zod.z.number()
58748
- }), {
58749
- kind: "mutation",
58750
- notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
58751
- }) },
58752
- /**
58753
- * A composed provider (battery ADDED to a pet feeder or container that has
58754
- * no wake surface) answers `wakeForStream` with the same "unavailable"
58755
- * result the contract already defines above: "Returns `awoke: false` when
58756
- * … the cap surface is unavailable." (D663).
58757
- */
58758
- composedMethods: { wakeForStream: {
58759
- kind: "answer",
58760
- value: {
58761
- awoke: false,
58762
- durationMs: 0
58763
- }
58764
- } },
58761
+ methods: {},
58765
58762
  events: {
58766
58763
  /**
58767
58764
  * Emitted whenever the cached status changes (firmware push OR
@@ -66488,7 +66485,7 @@ function groupTemplate(id) {
66488
66485
  }
66489
66486
  /**
66490
66487
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
66491
- * 47 caps with series (130 series), 39 caps answered `'none'`.
66488
+ * 47 caps with series (130 series), 40 caps answered `'none'`.
66492
66489
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
66493
66490
  */
66494
66491
  var HISTORY_CATALOG = {
@@ -84033,6 +84030,90 @@ var loginMethodCapability = {
84033
84030
  vocabulary: { notOperatorFacing: NOT_A_DEVICE.IDENTITY }
84034
84031
  };
84035
84032
  /**
84033
+ * low-power-sleep — a device that goes into low-power sleep and must be WOKEN
84034
+ * before it streams (#459, Q2). A battery camera (Reolink Argus, a robot's
84035
+ * on-board camera) is one; a battery SENSOR is not: it reports charge on the
84036
+ * `battery` cap and never sleeps. The two meanings used to share
84037
+ * `DeviceFeature.BatteryOperated`; this cap is the one that answers "sleeps",
84038
+ * and `DeviceFeature.Sleeps` is derived from it being bound with
84039
+ * `wakeUp` implemented.
84040
+ *
84041
+ * The state is the sleep inputs (`deriveBatteryPresence`): whether the device
84042
+ * is asleep, and the last time it PROVED it was reachable. Read from this slice
84043
+ * by the stream broker (`readBatterySleepFacts`), the recorder
84044
+ * (`recordingWakeDeps`) and the snapshot builtin. The broker's per-device
84045
+ * mirror is still also fed by `BatteryOnStatusChanged` events.
84046
+ */
84047
+ var LowPowerSleepStatusSchema = zod.z.object({
84048
+ /**
84049
+ * True while the firmware is in low-power mode. A provider MUST avoid polling
84050
+ * during sleep — a read wakes the device and drains charge.
84051
+ */
84052
+ sleeping: zod.z.boolean().meta({ label: "Sleeping" }),
84053
+ /**
84054
+ * Ms epoch of the last time the device proved it was reachable, from
84055
+ * PASSIVE signals only (a completed round-trip, an observed wake, a push).
84056
+ * Absent = never since this slice was born. The only input that separates
84057
+ * "asleep" from "gone".
84058
+ */
84059
+ lastContactAt: zod.z.number().optional(),
84060
+ /** Ms epoch of the last observation. */
84061
+ lastUpdated: zod.z.number().meta(readingMeta("none"))
84062
+ });
84063
+ var lowPowerSleepCapability = {
84064
+ name: "low-power-sleep",
84065
+ scope: "device",
84066
+ deviceNative: true,
84067
+ mode: "singleton",
84068
+ deviceTypes: [DeviceType.Camera],
84069
+ methods: {
84070
+ /**
84071
+ * Explicitly wake the device from low-power sleep ahead of a streaming
84072
+ * session start. Consumers that initiate a stream against a sleeping
84073
+ * camera (wake-on-play, the recorder, HomeKit, Alexa, snapshot wrappers)
84074
+ * call this with a short timeout before establishing the media pipeline —
84075
+ * the broker's own passive wake-on-dial works but adds 5–7 seconds to
84076
+ * first-frame. Pre-waking compresses that gap.
84077
+ *
84078
+ * Returns `awoke: true` when the firmware acknowledged the wake before
84079
+ * `timeoutMs`, `awoke: false` when it timed out; the caller should still
84080
+ * attempt the stream — the passive broker wake remains as fallback.
84081
+ */
84082
+ wakeUp: method(zod.z.object({
84083
+ deviceId: zod.z.number(),
84084
+ /** Bound on the wait. Sensible range 3000–10000ms. */
84085
+ timeoutMs: zod.z.number().int().min(500).max(3e4).default(8e3)
84086
+ }), zod.z.object({
84087
+ awoke: zod.z.boolean(),
84088
+ durationMs: zod.z.number()
84089
+ }), {
84090
+ kind: "mutation",
84091
+ notOperatorFacing: "a stream consumer wakes a sleeping camera to watch it; an automation that wants footage asks for the footage"
84092
+ }) },
84093
+ status: {
84094
+ schema: LowPowerSleepStatusSchema,
84095
+ kind: "push",
84096
+ empty: {
84097
+ sleeping: false,
84098
+ lastUpdated: 0
84099
+ }
84100
+ },
84101
+ runtimeState: LowPowerSleepStatusSchema,
84102
+ /**
84103
+ * Runtime-state durability: **restored** — a sleeping camera may not report
84104
+ * for hours; the restored sleep inputs are the only thing the sleep gate and
84105
+ * the presence derivation have (the same argument as `battery`).
84106
+ */
84107
+ durability: "restored",
84108
+ /** History (D850): none — battery never recorded a sleep series either. */
84109
+ history: "none",
84110
+ volatileStateFields: ["lastUpdated"],
84111
+ vocabulary: {
84112
+ noun: t("Low-power sleep", "Sospensione a basso consumo"),
84113
+ order: 5245
84114
+ }
84115
+ };
84116
+ /**
84036
84117
  * mesh-network — collection cap for mesh-VPN providers.
84037
84118
  *
84038
84119
  * Different shape from `network-access` (public tunnels):
@@ -104840,6 +104921,42 @@ var remoteLayoutComponentsCapability = {
104840
104921
  methods: { listComponents: method(zod.z.object({}), zod.z.array(RemoteLayoutComponentSchema), { auth: "protected" }) },
104841
104922
  vocabulary: { notOperatorFacing: "the palette of the remote template editor — read-only data, never actuated" }
104842
104923
  };
104924
+ /**
104925
+ * resync — a device whose derived spec can be re-aligned on demand with its
104926
+ * upstream source (#459, Q6). Registered by the containers an integration
104927
+ * adopted; `DeviceFeature.Resyncable` (the generic Re-sync button) is derived
104928
+ * from it being bound with `resync` implemented.
104929
+ *
104930
+ * The work itself stays where it is: the owning addon's `device-adoption`
104931
+ * provider, reached through `deviceManager.adoptionResync` (which also owns
104932
+ * the "resync from zero" child purge). A provider answers this method by
104933
+ * asking for exactly that — see `resyncThroughAdoption`.
104934
+ */
104935
+ var ResyncDeviceInputSchema = zod.z.object({
104936
+ deviceId: zod.z.number().int().nonnegative(),
104937
+ /** "Resync from zero": purge the accessory children before re-deriving. */
104938
+ resetToSource: zod.z.boolean().optional()
104939
+ });
104940
+ var resyncCapability = {
104941
+ name: "resync",
104942
+ scope: "device",
104943
+ deviceNative: true,
104944
+ mode: "singleton",
104945
+ deviceTypes: [
104946
+ DeviceType.Container,
104947
+ DeviceType.Workload,
104948
+ DeviceType.WeatherStation
104949
+ ],
104950
+ methods: { resync: method(ResyncDeviceInputSchema, ResyncResultSchema, {
104951
+ kind: "mutation",
104952
+ auth: "admin",
104953
+ notOperatorFacing: "device adoption — re-aligning a device with its source is an onboarding step, not an automation action"
104954
+ }) },
104955
+ vocabulary: {
104956
+ noun: t("Re-sync", "Risincronizzazione"),
104957
+ order: 3245
104958
+ }
104959
+ };
104843
104960
  var RUNNING_POWER_START_DELAY_MS = 3e4;
104844
104961
  var RUNNING_POWER_STOP_DELAY_MS = 18e4;
104845
104962
  /** What every type without its own row starts from. */
@@ -114187,6 +114304,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
114187
114304
  logChannelsCapability,
114188
114305
  logDestinationCapability,
114189
114306
  loginMethodCapability,
114307
+ lowPowerSleepCapability,
114190
114308
  mediaPlayerCapability,
114191
114309
  meshNetworkCapability,
114192
114310
  meterCapability,
@@ -114240,6 +114358,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
114240
114358
  recordsCapability,
114241
114359
  remoteCapability,
114242
114360
  remoteLayoutComponentsCapability,
114361
+ resyncCapability,
114243
114362
  runningStateCapability,
114244
114363
  sceneMonitorCapability,
114245
114364
  schedulersCapability,
@@ -117341,6 +117460,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
117341
117460
  irTransmitter: irTransmitterCapability,
117342
117461
  lawnMowerControl: lawnMowerControlCapability,
117343
117462
  lockControl: lockControlCapability,
117463
+ lowPowerSleep: lowPowerSleepCapability,
117344
117464
  mediaPlayer: mediaPlayerCapability,
117345
117465
  meter: meterCapability,
117346
117466
  motion: motionCapability,
@@ -118096,6 +118216,18 @@ function deriveBatteryPresence(input) {
118096
118216
  return input.nowMs - lastContactAt > budget ? "unreachable" : "sleeping";
118097
118217
  }
118098
118218
  /**
118219
+ * Does this device SLEEP and need waking before it streams (#459, Q2)?
118220
+ *
118221
+ * The one predicate every data-plane consumer asks (prebuffer, wake-on-play,
118222
+ * the recorder, sentry, the snapshot wrapper, the detection profile). It reads
118223
+ * `DeviceFeature.Sleeps`, derived from the `low-power-sleep` cap — never
118224
+ * `DeviceFeature.BatteryOperated`, which only says the device reports a
118225
+ * battery: a battery sensor reports charge and never sleeps.
118226
+ */
118227
+ function deviceSleeps(features) {
118228
+ return features.includes(DeviceFeature.Sleeps);
118229
+ }
118230
+ /**
118099
118231
  * WHICH child a container stands for — one definition, for every consumer.
118100
118232
  *
118101
118233
  * A CONTAINER device has no controllable surface of its own: it groups entity
@@ -123320,13 +123452,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
123320
123452
  access: "view",
123321
123453
  role: "viewer"
123322
123454
  },
123323
- "battery.wakeForStream": {
123324
- capName: "battery",
123325
- capScope: "device",
123326
- addonId: null,
123327
- access: "create",
123328
- role: "viewer"
123329
- },
123330
123455
  "binary.getStatus": {
123331
123456
  capName: "binary",
123332
123457
  capScope: "device",
@@ -126981,6 +127106,20 @@ var METHOD_ACCESS_MAP = Object.freeze({
126981
127106
  access: "view",
126982
127107
  role: "admin"
126983
127108
  },
127109
+ "lowPowerSleep.getStatus": {
127110
+ capName: "low-power-sleep",
127111
+ capScope: "device",
127112
+ addonId: null,
127113
+ access: "view",
127114
+ role: "viewer"
127115
+ },
127116
+ "lowPowerSleep.wakeUp": {
127117
+ capName: "low-power-sleep",
127118
+ capScope: "device",
127119
+ addonId: null,
127120
+ access: "create",
127121
+ role: "viewer"
127122
+ },
126984
127123
  "mediaPlayer.channelDown": {
126985
127124
  capName: "media-player",
126986
127125
  capScope: "device",
@@ -130656,6 +130795,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
130656
130795
  access: "view",
130657
130796
  role: "admin"
130658
130797
  },
130798
+ "resync.resync": {
130799
+ capName: "resync",
130800
+ capScope: "device",
130801
+ addonId: null,
130802
+ access: "create",
130803
+ role: "admin"
130804
+ },
130659
130805
  "runningState.getStatus": {
130660
130806
  capName: "running-state",
130661
130807
  capScope: "device",
@@ -133129,7 +133275,7 @@ function deviceOffersActions(bindings, actionIds, mode = "any", deviceType) {
133129
133275
  const offered = new Set(actionsForDevice(bindings, deviceType).map((action) => action.id));
133130
133276
  return mode === "all" ? actionIds.every((id) => offered.has(id)) : actionIds.some((id) => offered.has(id));
133131
133277
  }
133132
- DeviceFeature.BatteryOperated;
133278
+ DeviceFeature.Sleeps;
133133
133279
  function bound(cap, methods = [], authority = "reported") {
133134
133280
  return {
133135
133281
  kind: "cap",
@@ -133147,13 +133293,13 @@ function reported(reason) {
133147
133293
  reason
133148
133294
  };
133149
133295
  }
133150
- var SLEEP_PENDING = "splits into a sleeping cap in a later phase of #459";
133151
133296
  var CAP_PENDING = "becomes a cap or is dropped in a later phase of #459";
133152
133297
  /** Exhaustive: a new `DeviceFeature` without a row does not compile. */
133153
133298
  var DEVICE_FEATURE_REQUIREMENTS = {
133154
- [DeviceFeature.BatteryOperated]: reported(SLEEP_PENDING),
133299
+ [DeviceFeature.BatteryOperated]: bound("battery"),
133300
+ [DeviceFeature.Sleeps]: derived("low-power-sleep", ["wakeUp"]),
133155
133301
  [DeviceFeature.Rebootable]: derived("reboot", ["reboot"]),
133156
- [DeviceFeature.Resyncable]: reported(CAP_PENDING),
133302
+ [DeviceFeature.Resyncable]: derived("resync", ["resync"]),
133157
133303
  [DeviceFeature.NativeSnapshot]: reported(CAP_PENDING),
133158
133304
  [DeviceFeature.DoorbellButton]: derived("doorbell"),
133159
133305
  [DeviceFeature.TwoWayAudio]: derived("intercom", [
@@ -133205,9 +133351,7 @@ var DEVICE_FEATURE_REQUIREMENTS = {
133205
133351
  [DeviceFeature.NotifierRecipients]: reported(CAP_PENDING),
133206
133352
  [DeviceFeature.ScriptVariables]: reported(CAP_PENDING),
133207
133353
  [DeviceFeature.AutomationSkipCondition]: reported(CAP_PENDING),
133208
- [DeviceFeature.VacuumHasMap]: reported(CAP_PENDING),
133209
133354
  [DeviceFeature.VacuumHasAi]: reported(CAP_PENDING),
133210
- [DeviceFeature.MowerHasMap]: reported(CAP_PENDING),
133211
133355
  [DeviceFeature.MowerHasTargetedMowing]: reported(CAP_PENDING),
133212
133356
  [DeviceFeature.Navigation]: derived("navigation"),
133213
133357
  [DeviceFeature.NetworkLink]: derived("network-link")
@@ -133396,6 +133540,7 @@ var CAP_NAMES_WITH_STATUS = [
133396
133540
  "intercom",
133397
133541
  "lawn-mower-control",
133398
133542
  "lock-control",
133543
+ "low-power-sleep",
133399
133544
  "media-player",
133400
133545
  "meter",
133401
133546
  "motion",
@@ -133590,11 +133735,6 @@ Object.freeze({
133590
133735
  form: "single",
133591
133736
  optional: false
133592
133737
  }],
133593
- "battery.wakeForStream": [{
133594
- name: "deviceId",
133595
- form: "single",
133596
- optional: false
133597
- }],
133598
133738
  "binary.getStatus": [{
133599
133739
  name: "deviceId",
133600
133740
  form: "single",
@@ -134778,6 +134918,16 @@ Object.freeze({
134778
134918
  form: "single",
134779
134919
  optional: true
134780
134920
  }],
134921
+ "lowPowerSleep.getStatus": [{
134922
+ name: "deviceId",
134923
+ form: "single",
134924
+ optional: false
134925
+ }],
134926
+ "lowPowerSleep.wakeUp": [{
134927
+ name: "deviceId",
134928
+ form: "single",
134929
+ optional: false
134930
+ }],
134781
134931
  "mediaPlayer.channelDown": [{
134782
134932
  name: "deviceId",
134783
134933
  form: "single",
@@ -136063,6 +136213,11 @@ Object.freeze({
136063
136213
  form: "single",
136064
136214
  optional: false
136065
136215
  }],
136216
+ "resync.resync": [{
136217
+ name: "deviceId",
136218
+ form: "single",
136219
+ optional: false
136220
+ }],
136066
136221
  "runningState.getStatus": [{
136067
136222
  name: "deviceId",
136068
136223
  form: "single",
@@ -136688,7 +136843,7 @@ Object.freeze({
136688
136843
  });
136689
136844
  /**
136690
136845
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
136691
- * `runtimeState`. 87 caps: 43 `restored`, 44 `session`.
136846
+ * `runtimeState`. 88 caps: 44 `restored`, 44 `session`.
136692
136847
  *
136693
136848
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
136694
136849
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -136868,6 +137023,10 @@ var RUNTIME_STATE_POLICY = {
136868
137023
  durability: "restored",
136869
137024
  volatileFields: ["lastChangedAt"]
136870
137025
  },
137026
+ "low-power-sleep": {
137027
+ durability: "restored",
137028
+ volatileFields: ["lastUpdated"]
137029
+ },
136871
137030
  "media-player": {
136872
137031
  durability: "session",
136873
137032
  volatileFields: []
@@ -139212,12 +139371,6 @@ Object.defineProperty(exports, "BatchTooLargeError", {
139212
139371
  return BatchTooLargeError;
139213
139372
  }
139214
139373
  });
139215
- Object.defineProperty(exports, "BatteryStatusSchema", {
139216
- enumerable: true,
139217
- get: function() {
139218
- return BatteryStatusSchema;
139219
- }
139220
- });
139221
139374
  Object.defineProperty(exports, "CALLER_STAMPED_CAPABILITIES", {
139222
139375
  enumerable: true,
139223
139376
  get: function() {
@@ -139764,6 +139917,12 @@ Object.defineProperty(exports, "LOG_LEVEL_RANK", {
139764
139917
  return LOG_LEVEL_RANK;
139765
139918
  }
139766
139919
  });
139920
+ Object.defineProperty(exports, "LowPowerSleepStatusSchema", {
139921
+ enumerable: true,
139922
+ get: function() {
139923
+ return LowPowerSleepStatusSchema;
139924
+ }
139925
+ });
139767
139926
  Object.defineProperty(exports, "METHOD_ACCESS_MAP", {
139768
139927
  enumerable: true,
139769
139928
  get: function() {
@@ -140352,12 +140511,6 @@ Object.defineProperty(exports, "bareAddonId", {
140352
140511
  return bareAddonId;
140353
140512
  }
140354
140513
  });
140355
- Object.defineProperty(exports, "batteryCapability", {
140356
- enumerable: true,
140357
- get: function() {
140358
- return batteryCapability;
140359
- }
140360
- });
140361
140514
  Object.defineProperty(exports, "brightnessCapability", {
140362
140515
  enumerable: true,
140363
140516
  get: function() {
@@ -140832,6 +140985,12 @@ Object.defineProperty(exports, "deviceRunsCapability", {
140832
140985
  return deviceRunsCapability;
140833
140986
  }
140834
140987
  });
140988
+ Object.defineProperty(exports, "deviceSleeps", {
140989
+ enumerable: true,
140990
+ get: function() {
140991
+ return deviceSleeps;
140992
+ }
140993
+ });
140835
140994
  Object.defineProperty(exports, "deviceStateCapability", {
140836
140995
  enumerable: true,
140837
140996
  get: function() {
@@ -141444,6 +141603,12 @@ Object.defineProperty(exports, "looseSchema", {
141444
141603
  return looseSchema;
141445
141604
  }
141446
141605
  });
141606
+ Object.defineProperty(exports, "lowPowerSleepCapability", {
141607
+ enumerable: true,
141608
+ get: function() {
141609
+ return lowPowerSleepCapability;
141610
+ }
141611
+ });
141447
141612
  Object.defineProperty(exports, "makeSecretMarker", {
141448
141613
  enumerable: true,
141449
141614
  get: function() {