@camstack/types 1.2.266 → 1.2.268

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 (57) hide show
  1. package/dist/addon.js +4 -4
  2. package/dist/addon.mjs +3 -3
  3. package/dist/capabilities/battery.cap.d.ts +17 -2
  4. package/dist/capabilities/capability-definition.d.ts +22 -0
  5. package/dist/capabilities/composer.cap.d.ts +99 -0
  6. package/dist/capabilities/consumables.cap.d.ts +79 -0
  7. package/dist/capabilities/core-blocks.cap.d.ts +1149 -91
  8. package/dist/capabilities/device-extension.cap.d.ts +12 -13
  9. package/dist/capabilities/device-state.cap.d.ts +186 -2
  10. package/dist/capabilities/index.d.ts +3 -3
  11. package/dist/capabilities/pipeline-analytics.cap.d.ts +14 -0
  12. package/dist/composition/composition-graph.d.ts +42 -9
  13. package/dist/composition/composition-items.d.ts +25 -0
  14. package/dist/composition/composition-report.d.ts +93 -2
  15. package/dist/composition/composition.d.ts +154 -3
  16. package/dist/composition/customization-name.d.ts +6 -0
  17. package/dist/composition/evaluate-field.d.ts +12 -0
  18. package/dist/composition/examples.d.ts +33 -0
  19. package/dist/composition/field-kinds.d.ts +42 -0
  20. package/dist/composition/index.d.ts +1 -0
  21. package/dist/composition/plan-result.d.ts +16 -0
  22. package/dist/composition/state-fields.d.ts +6 -0
  23. package/dist/composition/validate-composition.d.ts +44 -9
  24. package/dist/composition-CPFIlFfw.mjs +1759 -0
  25. package/dist/composition-QlOB7QTG.js +2184 -0
  26. package/dist/device/device-context.d.ts +9 -0
  27. package/dist/device/device-runtime-state.d.ts +15 -1
  28. package/dist/device/index.d.ts +1 -1
  29. package/dist/device-extension/slot-descriptor.d.ts +8 -11
  30. package/dist/device-extension/slot-provider.d.ts +0 -2
  31. package/dist/enums/event-category.d.ts +25 -0
  32. package/dist/enums.js +1 -1
  33. package/dist/enums.mjs +1 -1
  34. package/dist/err-msg-DX6i_MY4.mjs +339 -0
  35. package/dist/err-msg-Dx2Kor0g.js +368 -0
  36. package/dist/{event-category-BVDXG4tB.mjs → event-category-C5xZWqz6.mjs} +31 -1
  37. package/dist/{event-category-BVfsrBYA.js → event-category-MbnB-6AN.js} +48 -0
  38. package/dist/generated/addon-api.d.ts +42 -0
  39. package/dist/generated/device-proxy.d.ts +1 -1
  40. package/dist/generated/method-access-map.d.ts +1 -1
  41. package/dist/generated/method-device-selectors.d.ts +2 -2
  42. package/dist/generated/system-proxy.d.ts +2 -2
  43. package/dist/index.d.ts +4 -3
  44. package/dist/index.js +1548 -1660
  45. package/dist/index.mjs +1243 -1388
  46. package/dist/interfaces/kernel-abstractions.d.ts +16 -0
  47. package/dist/interfaces/status-overlay.d.ts +42 -0
  48. package/dist/node.d.ts +1 -0
  49. package/dist/node.js +29 -8
  50. package/dist/node.mjs +23 -3
  51. package/dist/{sleep-8K9gue-H.js → sleep-BSzia-xT.js} +6 -352
  52. package/dist/{sleep-DC-wdyeS.mjs → sleep-jkRQgtSc.mjs} +7 -329
  53. package/package.json +1 -1
  54. package/dist/canonical-hash-CPK2Dy60.mjs +0 -715
  55. package/dist/canonical-hash-CSE4ioRi.js +0 -792
  56. package/dist/err-msg-COpsHMw2.js +0 -18
  57. package/dist/err-msg-IQTHeDzc.mjs +0 -13
@@ -10,6 +10,7 @@ import type { FrameInput } from '../types/io.js';
10
10
  import type { CropInput } from '../types/detection.js';
11
11
  import type { InferenceOutput } from './pipeline-runner.js';
12
12
  import type { CapabilityProviderMap } from './capability.js';
13
+ import type { StatusOverlay, StatusOverlayAnswer } from './status-overlay.js';
13
14
  /**
14
15
  * Capability registry interface exposing what core/addon consumers need.
15
16
  * The full CapabilityRegistry in @camstack/system implements this and more.
@@ -37,6 +38,21 @@ export interface ICapabilityRegistry {
37
38
  * `getNativeProvider` and `getProviderByAddon`.
38
39
  */
39
40
  getProviderForDevice<T = unknown>(capName: string, deviceId: number): T | null;
41
+ /**
42
+ * Install (or remove, with `null`) the claimed-status overlay (D663, S3).
43
+ * While installed, `getNativeProvider` / `getProviderForDevice` answer
44
+ * `getStatus` of a CLAIMED `(cap, device)` from it; every other method is
45
+ * the provider's own. The device-manager installs it over its mirror.
46
+ */
47
+ setStatusOverlay(overlay: StatusOverlay | null): void;
48
+ /**
49
+ * The one question every resolution of a device-scoped `getStatus` awaits
50
+ * before answering: resolves the device's claims first (index, then its row,
51
+ * single-flight) and answers `claimed` / `unclaimed`; `unknown` only when the
52
+ * row cannot be read — and then the answer is "not reported", never the
53
+ * native (D315, D49).
54
+ */
55
+ resolveClaimedStatus(capName: string, deviceId: number): Promise<StatusOverlayAnswer>;
40
56
  /** Get the addonId that registered a native provider for (cap, device). */
41
57
  getNativeAddonId(capName: string, deviceId: number): string | null;
42
58
  /** List all capability names with a native registration for a device. */
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The claimed-status overlay (D663, ruling S3) — the ONE question every
3
+ * resolution of a device-scoped `getStatus` asks before it is answered: is this
4
+ * `(cap, device)` claimed on the hub, and if so, what does the merged slice say?
5
+ *
6
+ * Declared here, in `@camstack/types`, because `ICapabilityRegistry` carries
7
+ * the setter and the question; the kernel's `status-overlay.ts` re-exports the
8
+ * types so the registry and the transport both import from it and neither
9
+ * imports the other.
10
+ */
11
+ /**
12
+ * - `claimed`: `slice` is ALREADY parsed with the cap's `status.schema`; `null`
13
+ * means the claim is HELD (a claimed field with no value yet) or the merged
14
+ * slice did not parse — "not reported" (D315), never the native value.
15
+ * - `unclaimed`: the device is KNOWN to carry no claim on this cap — the only
16
+ * answer that lets the native provider's own `getStatus` speak.
17
+ * - `unknown`: the device's claims are not known — its row has not been read
18
+ * and the claims index cannot vouch for it, or the row could not be read. A
19
+ * consumer answers `null` ("not reported"), never the native: not-yet-known
20
+ * must not look like not-claimed (D315, D49).
21
+ */
22
+ export type StatusOverlayAnswer = {
23
+ readonly kind: 'claimed';
24
+ readonly slice: Readonly<Record<string, unknown>> | null;
25
+ } | {
26
+ readonly kind: 'unclaimed';
27
+ } | {
28
+ readonly kind: 'unknown';
29
+ };
30
+ /**
31
+ * Installed by the device-manager over its `DeviceStateMirror`.
32
+ *
33
+ * `peek` is synchronous and costs one in-memory lookup: it answers from what is
34
+ * already known and says `unknown` otherwise. `resolve` makes the claims known
35
+ * first — the claims index, and when that cannot vouch for the device, its
36
+ * runtime-state row read once (single-flight) — and answers `unknown` only when
37
+ * the row cannot be read.
38
+ */
39
+ export interface StatusOverlay {
40
+ peek(capName: string, deviceId: number): StatusOverlayAnswer;
41
+ resolve(capName: string, deviceId: number): Promise<StatusOverlayAnswer>;
42
+ }
package/dist/node.d.ts CHANGED
@@ -17,6 +17,7 @@ export { writeFileAtomic } from './storage/atomic-write.js';
17
17
  export type { PhysicalRoot, RealpathSync } from './storage/physical-root.js';
18
18
  export { containsOrEquals, physicalRootOf } from './storage/physical-root.js';
19
19
  export { canonicalHash } from './utils/canonical-hash.js';
20
+ export { customizationBlockName } from './composition/customization-name.js';
20
21
  export type { VerifyExpiringUrlInput } from './utils/expiring-url-signature.js';
21
22
  export { signExpiringUrl, verifyExpiringUrl } from './utils/expiring-url-signature.js';
22
23
  export type { DeviceExportShape, ExportDelta, ExportTargetEntry, } from './utils/export-reconciler.js';
package/dist/node.js CHANGED
@@ -21,8 +21,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_canonical_hash = require("./canonical-hash-CSE4ioRi.js");
25
- const require_err_msg = require("./err-msg-COpsHMw2.js");
24
+ const require_composition = require("./composition-QlOB7QTG.js");
25
+ const require_err_msg = require("./err-msg-Dx2Kor0g.js");
26
26
  let node_crypto = require("node:crypto");
27
27
  let node_fs = require("node:fs");
28
28
  node_fs = __toESM(node_fs);
@@ -794,7 +794,7 @@ var Fmp4FragmentChild = class {
794
794
  deps;
795
795
  args;
796
796
  child = null;
797
- splitter = new require_canonical_hash.Fmp4BoxSplitter();
797
+ splitter = new require_composition.Fmp4BoxSplitter();
798
798
  stopped = false;
799
799
  unitsOut = 0;
800
800
  activeHwAccel = null;
@@ -811,7 +811,7 @@ var Fmp4FragmentChild = class {
811
811
  return;
812
812
  } catch (err) {
813
813
  if (this.stopped) throw err;
814
- if (requested === null || require_canonical_hash.isSoftwareDecode(requested)) throw err;
814
+ if (requested === null || require_composition.isSoftwareDecode(requested)) throw err;
815
815
  this.deps.logger.warn("fmp4 fragment child: hardware decode produced NO fragment — retrying in SOFTWARE", {
816
816
  tags: { deviceId: this.args.deviceId },
817
817
  meta: {
@@ -821,7 +821,7 @@ var Fmp4FragmentChild = class {
821
821
  }
822
822
  });
823
823
  this.killChild();
824
- this.splitter = new require_canonical_hash.Fmp4BoxSplitter();
824
+ this.splitter = new require_composition.Fmp4BoxSplitter();
825
825
  this.activeHwAccel = null;
826
826
  await this.spawnAttempt(null);
827
827
  }
@@ -839,7 +839,7 @@ var Fmp4FragmentChild = class {
839
839
  this.args.plane.end("the fragment child stopped");
840
840
  }
841
841
  spawnAttempt(decodeHwAccel) {
842
- const args = require_canonical_hash.buildFfmpegArgs({
842
+ const args = require_composition.buildFfmpegArgs({
843
843
  ...this.args.invocation,
844
844
  decodeHwAccel,
845
845
  sink: {
@@ -2010,6 +2010,26 @@ function containsOrEquals(outer, inner) {
2010
2010
  return relative !== "" && !relative.startsWith("..") && !node_path.default.isAbsolute(relative);
2011
2011
  }
2012
2012
  //#endregion
2013
+ //#region src/composition/customization-name.ts
2014
+ /**
2015
+ * The stored name of the implicit block that customizes an existing device
2016
+ * (D663). The ONLY composition file that imports `node:crypto`, which is why it
2017
+ * is exported from `@camstack/types/node` and never from the browser barrel.
2018
+ */
2019
+ /** `CompositionBlockInputSchema.name` is `max(120)` (`core-blocks.cap.ts`). */
2020
+ var MAX_BLOCK_NAME_LENGTH = 120;
2021
+ var HASH_HEX_LENGTH = 32;
2022
+ /**
2023
+ * Derived by the SERVER on save, never sent by the client; never shown as the
2024
+ * device's name. Unique per target: the plain ref when it fits, else a hash.
2025
+ */
2026
+ function customizationBlockName(ref) {
2027
+ const key = require_composition.compositionSourceKey(ref);
2028
+ const plain = `${require_composition.CUSTOMIZATION_BLOCK_NAME_PREFIX}${key}`;
2029
+ if (plain.length <= MAX_BLOCK_NAME_LENGTH) return plain;
2030
+ return `${require_composition.CUSTOMIZATION_BLOCK_NAME_PREFIX}#${(0, node_crypto.createHash)("sha256").update(key).digest("hex").slice(0, HASH_HEX_LENGTH)}`;
2031
+ }
2032
+ //#endregion
2013
2033
  //#region src/utils/expiring-url-signature.ts
2014
2034
  /**
2015
2035
  * The ONE derivation of "a signed, expiring URL".
@@ -2073,7 +2093,7 @@ function verifyExpiringUrl(input) {
2073
2093
  */
2074
2094
  function canonicalDeviceFingerprint(shape) {
2075
2095
  const features = [...new Set(shape.features)].toSorted();
2076
- return require_canonical_hash.canonicalHash({
2096
+ return require_composition.canonicalHash({
2077
2097
  deviceType: shape.deviceType,
2078
2098
  features
2079
2099
  });
@@ -2131,8 +2151,9 @@ exports.NO_COST_CLAIM = NO_COST_CLAIM;
2131
2151
  exports.PYTHON_VERSION = PYTHON_VERSION;
2132
2152
  exports.buildBinaryPath = buildBinaryPath;
2133
2153
  exports.canonicalDeviceFingerprint = canonicalDeviceFingerprint;
2134
- exports.canonicalHash = require_canonical_hash.canonicalHash;
2154
+ exports.canonicalHash = require_composition.canonicalHash;
2135
2155
  exports.containsOrEquals = containsOrEquals;
2156
+ exports.customizationBlockName = customizationBlockName;
2136
2157
  exports.diffExportTargets = diffExportTargets;
2137
2158
  exports.downloadBinary = downloadBinary;
2138
2159
  exports.ensureBinary = ensureBinary;
package/dist/node.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as Fmp4BoxSplitter, o as buildFfmpegArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-CPK2Dy60.mjs";
2
- import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
1
+ import { N as compositionSourceKey, a as CUSTOMIZATION_BLOCK_NAME_PREFIX, at as canonicalHash, mt as isSoftwareDecode, ot as Fmp4BoxSplitter, ut as buildFfmpegArgs } from "./composition-CPFIlFfw.mjs";
2
+ import { t as errMsg } from "./err-msg-DX6i_MY4.mjs";
3
3
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
4
4
  import * as fs from "node:fs";
5
5
  import { chmodSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
@@ -1987,6 +1987,26 @@ function containsOrEquals(outer, inner) {
1987
1987
  return relative !== "" && !relative.startsWith("..") && !path.isAbsolute(relative);
1988
1988
  }
1989
1989
  //#endregion
1990
+ //#region src/composition/customization-name.ts
1991
+ /**
1992
+ * The stored name of the implicit block that customizes an existing device
1993
+ * (D663). The ONLY composition file that imports `node:crypto`, which is why it
1994
+ * is exported from `@camstack/types/node` and never from the browser barrel.
1995
+ */
1996
+ /** `CompositionBlockInputSchema.name` is `max(120)` (`core-blocks.cap.ts`). */
1997
+ var MAX_BLOCK_NAME_LENGTH = 120;
1998
+ var HASH_HEX_LENGTH = 32;
1999
+ /**
2000
+ * Derived by the SERVER on save, never sent by the client; never shown as the
2001
+ * device's name. Unique per target: the plain ref when it fits, else a hash.
2002
+ */
2003
+ function customizationBlockName(ref) {
2004
+ const key = compositionSourceKey(ref);
2005
+ const plain = `${CUSTOMIZATION_BLOCK_NAME_PREFIX}${key}`;
2006
+ if (plain.length <= MAX_BLOCK_NAME_LENGTH) return plain;
2007
+ return `${CUSTOMIZATION_BLOCK_NAME_PREFIX}#${createHash("sha256").update(key).digest("hex").slice(0, HASH_HEX_LENGTH)}`;
2008
+ }
2009
+ //#endregion
1990
2010
  //#region src/utils/expiring-url-signature.ts
1991
2011
  /**
1992
2012
  * The ONE derivation of "a signed, expiring URL".
@@ -2098,4 +2118,4 @@ function resolveExportFingerprint(input) {
2098
2118
  return input.persisted ?? input.fresh;
2099
2119
  }
2100
2120
  //#endregion
2101
- export { ChildCostRegistry, FFMPEG_RELEASE, FfmpegProcess, FilesystemStorageProvider, Fmp4FragmentChild, Fmp4FragmentPlane, NO_COST_CLAIM, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, containsOrEquals, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegArtifact, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, nodeProcStatReader, parseFfmpegCapabilities, parseProcCpuSeconds, parseProcRssBytes, physicalRootOf, probeFfmpegBinary, readProcessCost, resolveExportFingerprint, signExpiringUrl, verifyExpiringUrl, writeFileAtomic };
2121
+ export { ChildCostRegistry, FFMPEG_RELEASE, FfmpegProcess, FilesystemStorageProvider, Fmp4FragmentChild, Fmp4FragmentPlane, NO_COST_CLAIM, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, containsOrEquals, customizationBlockName, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegArtifact, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, nodeProcStatReader, parseFfmpegCapabilities, parseProcCpuSeconds, parseProcRssBytes, physicalRootOf, probeFfmpegBinary, readProcessCost, resolveExportFingerprint, signExpiringUrl, verifyExpiringUrl, writeFileAtomic };
@@ -1,4 +1,4 @@
1
- const require_event_category = require("./event-category-BVfsrBYA.js");
1
+ const require_event_category = require("./event-category-MbnB-6AN.js");
2
2
  let zod = require("zod");
3
3
  //#region src/audio/audio-chunk-format.ts
4
4
  /**
@@ -2589,332 +2589,6 @@ var adminUiCapability = {
2589
2589
  }
2590
2590
  };
2591
2591
  //#endregion
2592
- //#region src/device/device-type.ts
2593
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
2594
- DeviceType["Camera"] = "camera";
2595
- DeviceType["Hub"] = "hub";
2596
- DeviceType["Light"] = "light";
2597
- DeviceType["Siren"] = "siren";
2598
- DeviceType["Switch"] = "switch";
2599
- DeviceType["Sensor"] = "sensor";
2600
- DeviceType["Thermostat"] = "thermostat";
2601
- /** Air-conditioner / heat-pump climate device (HVAC) — shares the
2602
- * `climate-control` cap surface with `Thermostat` but renders a
2603
- * dedicated AC-appropriate control UI (mode chips, fan speed,
2604
- * independent vertical/horizontal swing). Sources: native Gree, and
2605
- * reusable by other AC integrations. */
2606
- DeviceType["Climate"] = "climate";
2607
- DeviceType["Button"] = "button";
2608
- /** Generic stateless event emitter — carries a device's EXACT declared
2609
- * event vocabulary verbatim (no normalization). Installed with the
2610
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
2611
- * HA bus events (e.g. `zha_event`, generic). */
2612
- DeviceType["EventEmitter"] = "event-emitter";
2613
- /** Firmware/software update entity — current vs available version,
2614
- * updatable flag, update state, and an install action. Installed with
2615
- * the `update` cap. Sources: Homematic firmware-update channels (and
2616
- * reusable by other providers, e.g. HA `update.*` entities). */
2617
- DeviceType["Update"] = "update";
2618
- DeviceType["Generic"] = "generic";
2619
- /** Generic notification delivery target (HA `notify.<service>`, future
2620
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
2621
- * endpoint; the `notifier` cap defines the send surface. */
2622
- DeviceType["Notifier"] = "notifier";
2623
- /** Pre-recorded action sequence with optional parameters
2624
- * (HA `script.*`). Runnable via `script-runner` cap. */
2625
- DeviceType["Script"] = "script";
2626
- /** Automation rule (HA `automation.*`) — enable/disable + manual
2627
- * trigger surface exposed via `automation-control` cap. */
2628
- DeviceType["Automation"] = "automation";
2629
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
2630
- DeviceType["Lock"] = "lock";
2631
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
2632
- * `valve.*`). `cover` cap with sub-roles for variant. */
2633
- DeviceType["Cover"] = "cover";
2634
- /** Pipe / water / gas valve with open/close/stop and optional
2635
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
2636
- * modelled on the same open/closed lifecycle. */
2637
- DeviceType["Valve"] = "valve";
2638
- /** Humidifier / dehumidifier with on/off + target humidity + mode
2639
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
2640
- * modelled on the same target / mode lifecycle. */
2641
- DeviceType["Humidifier"] = "humidifier";
2642
- /** Water heater / boiler with target temperature + operation mode +
2643
- * away mode (HA `water_heater.*`). `water-heater` cap — a
2644
- * climate-family actuator. */
2645
- DeviceType["WaterHeater"] = "water-heater";
2646
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
2647
- DeviceType["Fan"] = "fan";
2648
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
2649
- * the camera surface — those use `Camera`. `media-player` cap. */
2650
- DeviceType["MediaPlayer"] = "media-player";
2651
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
2652
- * `alarm-panel` cap. */
2653
- DeviceType["AlarmPanel"] = "alarm-panel";
2654
- /** Generic user-settable input (HA `number` / `input_number` / `select`
2655
- * / `input_select` / `text` / `input_text` / `input_datetime`).
2656
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
2657
- * TextControl / DateTimeControl. */
2658
- DeviceType["Control"] = "control";
2659
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
2660
- * `presence` cap. */
2661
- DeviceType["Presence"] = "presence";
2662
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
2663
- * `weather` cap. */
2664
- DeviceType["Weather"] = "weather";
2665
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
2666
- DeviceType["Vacuum"] = "vacuum";
2667
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
2668
- * `lawn-mower-control` cap. */
2669
- DeviceType["LawnMower"] = "lawn-mower";
2670
- /** Physical HA device group — parent container for entity-children
2671
- * adopted from a single HA device entry. Not renderable as a
2672
- * standalone device; exists only to anchor child entities. */
2673
- DeviceType["Container"] = "container";
2674
- /** Single still-image entity (HA `image.*`). Read-only display of an
2675
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
2676
- DeviceType["Image"] = "image";
2677
- /** Smart pet feeder — cloud-connected food dispenser with a bowl food
2678
- * level, battery, desiccant life, feeding state and manual-feed /
2679
- * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
2680
- * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
2681
- * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
2682
- * integrations sharing the same food/desiccant/hopper surface. */
2683
- DeviceType["PetFeeder"] = "pet-feeder";
2684
- return DeviceType;
2685
- }({});
2686
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
2687
- DeviceFeature["BatteryOperated"] = "battery-operated";
2688
- DeviceFeature["Rebootable"] = "rebootable";
2689
- /**
2690
- * Device supports an on-demand re-sync of its derived spec with its
2691
- * upstream source — drives the generic Re-sync button. The owning
2692
- * provider implements the action via the `device-adoption.resync` cap.
2693
- */
2694
- DeviceFeature["Resyncable"] = "resyncable";
2695
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
2696
- DeviceFeature["DoorbellButton"] = "doorbell-button";
2697
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
2698
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
2699
- /**
2700
- * Camera supports the on-firmware autotrack subsystem (subject-
2701
- * following). Distinct from `PanTiltZoom` because not every PTZ
2702
- * camera ships autotrack — the admin UI uses this flag to gate
2703
- * the autotrack toggle / settings card without re-deriving from
2704
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
2705
- * driver sets this feature when probe confirms the firmware
2706
- * surface, and registers the cap in the same code path.
2707
- */
2708
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
2709
- /**
2710
- * Accessory exposes a "trigger on motion" toggle — the parent camera's
2711
- * motion detection automatically activates this device. Mirrors
2712
- * `motion-trigger` cap registration: drivers set this feature in the
2713
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
2714
- *
2715
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
2716
- * fast scalar without binding fetch), notifier rules, and `listAll`
2717
- * filters that want "all devices with on-motion behaviour".
2718
- */
2719
- DeviceFeature["MotionTrigger"] = "motion-trigger";
2720
- /** Light supports rgb-triplet color via `color` cap. */
2721
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
2722
- /** Light supports HSV color via `color` cap. */
2723
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
2724
- /** Light supports color-temperature (mired) via `color` cap. */
2725
- DeviceFeature["LightColorMired"] = "light-color-mired";
2726
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
2727
- * targetHigh). Gates the range slider UI. */
2728
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
2729
- /** Thermostat exposes target humidity and/or current humidity
2730
- * readings. Gates the humidity controls. */
2731
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
2732
- /** Thermostat exposes a fan-mode selector. */
2733
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
2734
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
2735
- DeviceFeature["ClimatePreset"] = "climate-preset";
2736
- /** Thermostat exposes a vertical louver swing toggle. Gates the
2737
- * vertical-swing switch in the climate UI. Independent of horizontal. */
2738
- DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
2739
- /** Thermostat exposes a horizontal louver swing toggle. Gates the
2740
- * horizontal-swing switch in the climate UI. Independent of vertical. */
2741
- DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
2742
- /** Cover exposes intermediate position control (0..100). Gates the
2743
- * position slider UI. */
2744
- DeviceFeature["CoverPositionable"] = "cover-positionable";
2745
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
2746
- DeviceFeature["CoverTilt"] = "cover-tilt";
2747
- /** Valve exposes intermediate position control (0..100). Gates the
2748
- * position slider / drag surface UI. */
2749
- DeviceFeature["ValvePositionable"] = "valve-positionable";
2750
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
2751
- DeviceFeature["FanSpeed"] = "fan-speed";
2752
- /** Fan exposes a preset mode selector. */
2753
- DeviceFeature["FanPreset"] = "fan-preset";
2754
- /** Fan exposes blade direction (forward/reverse) — typical of
2755
- * ceiling fans. */
2756
- DeviceFeature["FanDirection"] = "fan-direction";
2757
- /** Fan exposes an oscillation toggle. */
2758
- DeviceFeature["FanOscillating"] = "fan-oscillating";
2759
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
2760
- * field on the UI lock-controls panel. */
2761
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
2762
- /** Lock supports a latch-release ("open door") action distinct from
2763
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
2764
- * `supported_features`. Gates the Open Door button in the UI. */
2765
- DeviceFeature["LockOpen"] = "lock-open";
2766
- /** Media player exposes a seek-to-position surface. */
2767
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
2768
- /** Media player exposes a volume-level setter. */
2769
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
2770
- /** Media player exposes a mute toggle distinct from volume=0. */
2771
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
2772
- /** Media player exposes a shuffle toggle. */
2773
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
2774
- /** Media player exposes a repeat mode (off / all / one). */
2775
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
2776
- /** Media player exposes a source / input selector. */
2777
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
2778
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
2779
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
2780
- /** Media player exposes next-track. */
2781
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
2782
- /** Media player exposes previous-track. */
2783
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
2784
- /** Media player exposes stop distinct from pause. */
2785
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
2786
- /** Alarm panel requires a PIN code on arm/disarm. */
2787
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
2788
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
2789
- * addition to a textual location. */
2790
- DeviceFeature["PresenceGps"] = "presence-gps";
2791
- /** Notifier accepts an inline / URL image attachment. */
2792
- DeviceFeature["NotifierImage"] = "notifier-image";
2793
- /** Notifier accepts a priority hint (high/normal/low). */
2794
- DeviceFeature["NotifierPriority"] = "notifier-priority";
2795
- /** Notifier accepts a free-form `data` payload for platform-specific
2796
- * fields. */
2797
- DeviceFeature["NotifierData"] = "notifier-data";
2798
- /** Notifier supports interactive action buttons / callbacks. */
2799
- DeviceFeature["NotifierActions"] = "notifier-actions";
2800
- /** Notifier supports per-call recipient targeting (multi-user). */
2801
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
2802
- /** Script runner accepts a variables map on each run invocation. */
2803
- DeviceFeature["ScriptVariables"] = "script-variables";
2804
- /** Automation `trigger` accepts a skipCondition flag — fires the
2805
- * automation's actions while bypassing its condition block. */
2806
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
2807
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
2808
- * map tile in the vacuum UI. */
2809
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
2810
- /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
2811
- * switches group. */
2812
- DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
2813
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
2814
- * mower map tile. */
2815
- DeviceFeature["MowerHasMap"] = "mower-has-map";
2816
- /** Robot mower exposes targeted mowing (all-area / zones / edges /
2817
- * spots) — gates the Mow action + map selectors. */
2818
- DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
2819
- return DeviceFeature;
2820
- }({});
2821
- var ChargingStatus = /* @__PURE__ */ function(ChargingStatus) {
2822
- ChargingStatus["ChargingDC"] = "charging-dc";
2823
- ChargingStatus["ChargingSolar"] = "charging-solar";
2824
- ChargingStatus["NotCharging"] = "not-charging";
2825
- return ChargingStatus;
2826
- }({});
2827
- /**
2828
- * Semantic role a device plays within its parent. Populated by driver
2829
- * addons when creating accessory devices (Reolink siren/floodlight/
2830
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
2831
- * admin UI to pick icons, labels, and widgets — a `Switch` with
2832
- * `role: Floodlight` renders as a bulb with a brightness slider,
2833
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
2834
- *
2835
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
2836
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
2837
- */
2838
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
2839
- DeviceRole["Siren"] = "siren";
2840
- DeviceRole["Floodlight"] = "floodlight";
2841
- DeviceRole["Spotlight"] = "spotlight";
2842
- DeviceRole["PirSensor"] = "pir-sensor";
2843
- DeviceRole["Chime"] = "chime";
2844
- DeviceRole["Autotrack"] = "autotrack";
2845
- DeviceRole["Nightvision"] = "nightvision";
2846
- DeviceRole["PrivacyMask"] = "privacy-mask";
2847
- DeviceRole["Doorbell"] = "doorbell";
2848
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
2849
- * real Switch device for UI rendering / export adapters. */
2850
- DeviceRole["BinaryHelper"] = "binary-helper";
2851
- /** Generic motion / occupancy / moving event source. Distinct from
2852
- * the camera accessory PirSensor role: that one is a camera child;
2853
- * this is a standalone HA / 3rd-party motion sensor. */
2854
- DeviceRole["MotionSensor"] = "motion-sensor";
2855
- DeviceRole["ContactSensor"] = "contact-sensor";
2856
- DeviceRole["LeakSensor"] = "leak-sensor";
2857
- DeviceRole["SmokeSensor"] = "smoke-sensor";
2858
- DeviceRole["COSensor"] = "co-sensor";
2859
- DeviceRole["GasSensor"] = "gas-sensor";
2860
- DeviceRole["TamperSensor"] = "tamper-sensor";
2861
- DeviceRole["VibrationSensor"] = "vibration-sensor";
2862
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
2863
- DeviceRole["SoundSensor"] = "sound-sensor";
2864
- /** Fallback for `binary_sensor` without a known `device_class`. */
2865
- DeviceRole["BinarySensor"] = "binary-sensor";
2866
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
2867
- DeviceRole["HumiditySensor"] = "humidity-sensor";
2868
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
2869
- DeviceRole["PressureSensor"] = "pressure-sensor";
2870
- /** Wind speed or direction (weather-station `wind-sensor` cap). */
2871
- DeviceRole["WindSensor"] = "wind-sensor";
2872
- /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
2873
- DeviceRole["RainSensor"] = "rain-sensor";
2874
- /** UV index (weather-station `uv-sensor` cap). */
2875
- DeviceRole["UvSensor"] = "uv-sensor";
2876
- /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
2877
- * Distinct from AmbientLightSensor (lux). */
2878
- DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
2879
- /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
2880
- DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
2881
- DeviceRole["PowerSensor"] = "power-sensor";
2882
- DeviceRole["EnergySensor"] = "energy-sensor";
2883
- DeviceRole["VoltageSensor"] = "voltage-sensor";
2884
- DeviceRole["CurrentSensor"] = "current-sensor";
2885
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
2886
- /** Battery level (numeric % via `sensor` OR low-bool via
2887
- * `binary_sensor` — the cap distinguishes via the value type). */
2888
- DeviceRole["BatterySensor"] = "battery-sensor";
2889
- /** Fallback for `sensor` numeric without a known `device_class`. */
2890
- DeviceRole["NumericSensor"] = "numeric-sensor";
2891
- /** String / enum state (HA `sensor` with `state_class: enum` or
2892
- * `attributes.options`). */
2893
- DeviceRole["EnumSensor"] = "enum-sensor";
2894
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
2895
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
2896
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
2897
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
2898
- /** Last-resort fallback when nothing else matches. */
2899
- DeviceRole["GenericSensor"] = "generic-sensor";
2900
- DeviceRole["NumericControl"] = "numeric-control";
2901
- DeviceRole["SelectControl"] = "select-control";
2902
- DeviceRole["TextControl"] = "text-control";
2903
- DeviceRole["DateTimeControl"] = "datetime-control";
2904
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
2905
- * rich features (image, priority, channel routing). */
2906
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
2907
- /** Chat / messaging service (HA `notify.telegram_*`,
2908
- * `notify.discord_*`, etc.). */
2909
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
2910
- /** Email-based delivery (HA `notify.smtp`, etc.). */
2911
- DeviceRole["EmailNotifier"] = "email-notifier";
2912
- /** Fallback when the notifier service name doesn't match a known
2913
- * pattern. */
2914
- DeviceRole["GenericNotifier"] = "generic-notifier";
2915
- return DeviceRole;
2916
- }({});
2917
- //#endregion
2918
2592
  //#region src/capabilities/custom-actions.ts
2919
2593
  /**
2920
2594
  * Identity — preserves literal types for downstream inference.
@@ -4083,7 +3757,11 @@ function createDeviceProxy(api, binding, opts) {
4083
3757
  deviceState: {
4084
3758
  getSnapshot: (input) => dispatchSystem("deviceState", "getSnapshot", "query", input),
4085
3759
  getCapSlice: (input) => dispatchSystem("deviceState", "getCapSlice", "query", input),
4086
- setCapSlice: (input) => dispatchSystem("deviceState", "setCapSlice", "mutation", input)
3760
+ setCapSlice: (input) => dispatchSystem("deviceState", "setCapSlice", "mutation", input),
3761
+ claimFields: (input) => dispatchSystem("deviceState", "claimFields", "mutation", input),
3762
+ patchOwnedFields: (input) => dispatchSystem("deviceState", "patchOwnedFields", "mutation", input),
3763
+ releaseClaim: (input) => dispatchSystem("deviceState", "releaseClaim", "mutation", input),
3764
+ getNativeCapSlice: (input) => dispatchSystem("deviceState", "getNativeCapSlice", "query", input)
4087
3765
  },
4088
3766
  faceGallery: {
4089
3767
  listRecentFaces: (input) => dispatchSystem("faceGallery", "listRecentFaces", "query", input),
@@ -4519,12 +4197,6 @@ Object.defineProperty(exports, "CameraStreamSchema", {
4519
4197
  return CameraStreamSchema;
4520
4198
  }
4521
4199
  });
4522
- Object.defineProperty(exports, "ChargingStatus", {
4523
- enumerable: true,
4524
- get: function() {
4525
- return ChargingStatus;
4526
- }
4527
- });
4528
4200
  Object.defineProperty(exports, "DATAPLANE_SECRET_HEADER", {
4529
4201
  enumerable: true,
4530
4202
  get: function() {
@@ -4573,24 +4245,6 @@ Object.defineProperty(exports, "DecodedFrameSchema", {
4573
4245
  return DecodedFrameSchema;
4574
4246
  }
4575
4247
  });
4576
- Object.defineProperty(exports, "DeviceFeature", {
4577
- enumerable: true,
4578
- get: function() {
4579
- return DeviceFeature;
4580
- }
4581
- });
4582
- Object.defineProperty(exports, "DeviceRole", {
4583
- enumerable: true,
4584
- get: function() {
4585
- return DeviceRole;
4586
- }
4587
- });
4588
- Object.defineProperty(exports, "DeviceType", {
4589
- enumerable: true,
4590
- get: function() {
4591
- return DeviceType;
4592
- }
4593
- });
4594
4248
  Object.defineProperty(exports, "DisposerChain", {
4595
4249
  enumerable: true,
4596
4250
  get: function() {