@camstack/types 1.2.586 → 1.2.588

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 (76) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/addon.d.ts +2 -0
  3. package/dist/addon.js +21 -5
  4. package/dist/addon.mjs +18 -6
  5. package/dist/capabilities/camera-grid-layout.cap.d.ts +3 -5
  6. package/dist/capabilities/cap-method-absent.d.ts +19 -0
  7. package/dist/capabilities/device-manager.cap.d.ts +464 -0
  8. package/dist/capabilities/hero-layout.cap.d.ts +2 -2
  9. package/dist/capabilities/index.d.ts +9 -5
  10. package/dist/capabilities/network-link.cap.d.ts +10 -0
  11. package/dist/capabilities/power-source.cap.d.ts +20 -0
  12. package/dist/capabilities/recording-export.cap.d.ts +1 -0
  13. package/dist/capabilities/siren-duration.d.ts +45 -7
  14. package/dist/capabilities/siren.cap.d.ts +45 -2
  15. package/dist/capabilities/switch-settable.d.ts +15 -0
  16. package/dist/capabilities/switch.cap.d.ts +71 -0
  17. package/dist/capabilities/terminal-session.cap.d.ts +3 -60
  18. package/dist/capabilities/videoclips.cap.d.ts +3 -0
  19. package/dist/capabilities/workload.cap.d.ts +655 -0
  20. package/dist/client.js +59 -5
  21. package/dist/client.mjs +59 -5
  22. package/dist/{composed-stable-id-RvQIEpqg.mjs → composed-stable-id-BBL71oUQ.mjs} +20 -0
  23. package/dist/{composed-stable-id-C3NfRTj8.js → composed-stable-id-CVbyajE5.js} +20 -0
  24. package/dist/composition/engine-hosted-blocks.d.ts +131 -0
  25. package/dist/composition/helpers/index.d.ts +1 -1
  26. package/dist/composition/helpers/spec.d.ts +56 -2
  27. package/dist/composition/index.d.ts +1 -0
  28. package/dist/device/base-device.d.ts +29 -0
  29. package/dist/device/cap-vocabulary/declaration.d.ts +12 -1
  30. package/dist/device/cap-vocabulary/index.d.ts +4 -4
  31. package/dist/device/cap-vocabulary/resolve.d.ts +47 -1
  32. package/dist/device/cap-vocabulary/types.d.ts +26 -1
  33. package/dist/device/declare-identifiers.d.ts +58 -0
  34. package/dist/device/device-control-resolution.d.ts +1 -1
  35. package/dist/device/device-icon.d.ts +7 -0
  36. package/dist/device/device-identifiers.d.ts +190 -0
  37. package/dist/device/device-identity-candidates.d.ts +124 -0
  38. package/dist/device/device-management.d.ts +10 -0
  39. package/dist/device/device-type.d.ts +22 -2
  40. package/dist/device/hero/build-hero-model.d.ts +15 -0
  41. package/dist/device/hero/hero-fragment.d.ts +11 -0
  42. package/dist/device/hero/hero-layout.d.ts +1 -0
  43. package/dist/device/hero/hero-look.d.ts +12 -0
  44. package/dist/device/hero/hero-model.d.ts +4 -4
  45. package/dist/device/hero/hero-scene.d.ts +7 -0
  46. package/dist/device/index.d.ts +7 -1
  47. package/dist/enums/event-category.d.ts +8 -0
  48. package/dist/enums.js +1 -1
  49. package/dist/enums.mjs +1 -1
  50. package/dist/{event-category-d9kiqCqC.js → event-category-CE_VCE2G.js} +8 -0
  51. package/dist/{event-category-Dhcd0TRH.mjs → event-category-Hwx_JSCU.mjs} +8 -0
  52. package/dist/generated/addon-api.d.ts +99 -14
  53. package/dist/generated/addon-cap-facts.d.ts +1 -1
  54. package/dist/generated/cap-status-types.d.ts +3 -1
  55. package/dist/generated/cap-vocabulary.d.ts +1 -1
  56. package/dist/generated/capability-router-map.d.ts +5 -2
  57. package/dist/generated/collection-array-methods.d.ts +1 -1
  58. package/dist/generated/customize-catalog.d.ts +1 -1
  59. package/dist/generated/device-local-state.d.ts +3 -0
  60. package/dist/generated/device-proxy.d.ts +4 -1
  61. package/dist/generated/device-scoped-caps.d.ts +1 -1
  62. package/dist/generated/history-catalog.d.ts +2 -2
  63. package/dist/generated/method-access-map.d.ts +1 -1
  64. package/dist/generated/method-device-selectors.d.ts +2 -2
  65. package/dist/generated/runtime-state-durability.d.ts +1 -1
  66. package/dist/generated/system-proxy.d.ts +2 -2
  67. package/dist/{implemented-methods-C7ScGvEz.js → implemented-methods-ChtdIofW.js} +128 -1
  68. package/dist/{implemented-methods-C5FMXLGP.mjs → implemented-methods-u7ddjc-_.mjs} +57 -2
  69. package/dist/index.d.ts +9 -3
  70. package/dist/index.js +2069 -429
  71. package/dist/index.mjs +2008 -428
  72. package/dist/node.js +2 -2
  73. package/dist/node.mjs +2 -2
  74. package/dist/{sleep-DwRtgB2i.js → sleep-CsZJsb8n.js} +692 -35
  75. package/dist/{sleep-Ch7Q7UtE.mjs → sleep-D6Pih0Qt.mjs} +669 -36
  76. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DwRtgB2i.js");
3
- const require_event_category = require("./event-category-d9kiqCqC.js");
4
- const require_composed_stable_id = require("./composed-stable-id-C3NfRTj8.js");
5
- const require_implemented_methods = require("./implemented-methods-C7ScGvEz.js");
2
+ const require_sleep = require("./sleep-CsZJsb8n.js");
3
+ const require_event_category = require("./event-category-CE_VCE2G.js");
4
+ const require_composed_stable_id = require("./composed-stable-id-CVbyajE5.js");
5
+ const require_implemented_methods = require("./implemented-methods-ChtdIofW.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BI8iTXn6.js");
8
8
  const require_device_template_catalogue = require("./device-template-catalogue.js");
@@ -44503,9 +44503,10 @@ var GridProfileOfferSchema = zod.z.object({
44503
44503
  published: zod.z.boolean()
44504
44504
  });
44505
44505
  var GridLayoutViewSchema = zod.z.object({
44506
- /** The persisted grid row this camera was declared from. */
44507
- instanceId: zod.z.string(),
44506
+ /** The grid block (planning#580) whose camera this is. */
44507
+ blockId: zod.z.string(),
44508
44508
  deviceId: zod.z.number().int().nonnegative(),
44509
+ /** The device row's name — the only name a grid has; it is renamed on the block or the device. */
44509
44510
  name: zod.z.string(),
44510
44511
  /**
44511
44512
  * NO canvas size. A grid's resolution is not authored: each profile derives
@@ -44521,7 +44522,6 @@ var GridLayoutViewSchema = zod.z.object({
44521
44522
  });
44522
44523
  var GridLayoutPatchSchema = zod.z.object({
44523
44524
  deviceId: zod.z.number().int().nonnegative(),
44524
- name: zod.z.string().min(1).max(160).optional(),
44525
44525
  fps: zod.z.number().int().min(1).max(60).optional(),
44526
44526
  /** Which profiles to publish. See `GridProfileOffer.published`. */
44527
44527
  publishedProfiles: zod.z.array(zod.z.enum([
@@ -49057,7 +49057,8 @@ var CAP_CUSTOMIZE_CATALOG = {
49057
49057
  require_composed_stable_id.DeviceType.Dryer,
49058
49058
  require_composed_stable_id.DeviceType.Gateway,
49059
49059
  require_composed_stable_id.DeviceType.HeatPump,
49060
- require_composed_stable_id.DeviceType.EnergySystem
49060
+ require_composed_stable_id.DeviceType.EnergySystem,
49061
+ require_composed_stable_id.DeviceType.Workload
49061
49062
  ],
49062
49063
  apply: "add",
49063
49064
  vocabularyCap: "consumables",
@@ -51454,7 +51455,7 @@ function groupTemplate(id) {
51454
51455
  //#region src/generated/history-catalog.ts
51455
51456
  /**
51456
51457
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
51457
- * 46 caps with series (124 series), 39 caps answered `'none'`.
51458
+ * 47 caps with series (130 series), 39 caps answered `'none'`.
51458
51459
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
51459
51460
  */
51460
51461
  var HISTORY_CATALOG = {
@@ -52087,6 +52088,48 @@ var HISTORY_CATALOG = {
52087
52088
  unit: "mm",
52088
52089
  deadband: .1
52089
52090
  }
52091
+ },
52092
+ "workload": {
52093
+ "state": {
52094
+ kind: "enum",
52095
+ values: [
52096
+ "running",
52097
+ "paused",
52098
+ "stopped",
52099
+ "starting",
52100
+ "stopping",
52101
+ "crashed"
52102
+ ]
52103
+ },
52104
+ "resources.cpuPercent": {
52105
+ kind: "gauge",
52106
+ unit: "%",
52107
+ deadband: 2,
52108
+ displayName: "CPU"
52109
+ },
52110
+ "resources.memoryUsedBytes": {
52111
+ kind: "gauge",
52112
+ unit: "bytes",
52113
+ displayName: "Memory used"
52114
+ },
52115
+ "resources.memoryPercent": {
52116
+ kind: "gauge",
52117
+ unit: "%",
52118
+ deadband: 2,
52119
+ displayName: "Memory"
52120
+ },
52121
+ "resources.netRxKbps": {
52122
+ group: "network",
52123
+ kind: "gauge",
52124
+ unit: "kbps",
52125
+ displayName: "Network received"
52126
+ },
52127
+ "resources.netTxKbps": {
52128
+ group: "network",
52129
+ kind: "gauge",
52130
+ unit: "kbps",
52131
+ displayName: "Network sent"
52132
+ }
52090
52133
  }
52091
52134
  };
52092
52135
  /**
@@ -52150,7 +52193,7 @@ var HISTORY_ITEM_CATALOG = {
52150
52193
  };
52151
52194
  /**
52152
52195
  * The series a device card trends, per cap (`history.primary` + `history.priority`):
52153
- * 6 caps. The card shows the primary of the enabled cap with the highest priority.
52196
+ * 7 caps. The card shows the primary of the enabled cap with the highest priority.
52154
52197
  */
52155
52198
  var HISTORY_PRIMARY = {
52156
52199
  "climate-control": {
@@ -52176,6 +52219,10 @@ var HISTORY_PRIMARY = {
52176
52219
  "weather-station": {
52177
52220
  field: "temperature",
52178
52221
  priority: 60
52222
+ },
52223
+ "workload": {
52224
+ field: "resources.cpuPercent",
52225
+ priority: 40
52179
52226
  }
52180
52227
  };
52181
52228
  /** Caps that declared `history: 'none'`, sorted. */
@@ -52827,6 +52874,10 @@ function expressionDraft(spec) {
52827
52874
  }
52828
52875
  //#endregion
52829
52876
  //#region src/composition/helpers/compile.ts
52877
+ /**
52878
+ * Project a helper spec onto the composition the composer already runs (D944).
52879
+ * Pure: it stores nothing. A group does not compile to `avg(...)` / `any(...)`.
52880
+ */
52830
52881
  function sameSource(a, b) {
52831
52882
  return a.addonId === b.addonId && a.stableId === b.stableId;
52832
52883
  }
@@ -52949,8 +53000,25 @@ function compileHelper(spec, retention = require_implemented_methods.DEFAULT_HIS
52949
53000
  case "threshold": return compileMath(thresholdDraft(spec));
52950
53001
  case "arithmetic": return compileMath(arithmeticDraft(spec));
52951
53002
  case "expression": return compileMath(expressionDraft(spec));
53003
+ case "grid":
53004
+ case "terminal": return parseDraft(engineHostedDraft(spec));
52952
53005
  }
52953
53006
  }
53007
+ /**
53008
+ * A grid or a Terminal camera (planning#580): a bare `new` Camera. The composer
53009
+ * declares the row; the engine serves every cap on it, so there is nothing to
53010
+ * compose.
53011
+ */
53012
+ function engineHostedDraft(spec) {
53013
+ return {
53014
+ target: {
53015
+ kind: "new",
53016
+ type: require_composed_stable_id.DeviceType.Camera
53017
+ },
53018
+ helper: spec,
53019
+ features: []
53020
+ };
53021
+ }
52954
53022
  function compileMath(built) {
52955
53023
  if (built.problems.length > 0) return {
52956
53024
  ok: false,
@@ -53246,6 +53314,9 @@ function findCandidateCycles(candidate, stored) {
53246
53314
  * `core-blocks` system provider, so they are `systemMethod`s and carry a
53247
53315
  * top-level `deviceId`.
53248
53316
  *
53317
+ * Power on / off are withdrawn — and refused as `not-settable` — when the linked
53318
+ * switch ANSWERED it only reports (D1058); the forced restart stays.
53319
+ *
53249
53320
  * Every action answers a typed result and never throws for an expected
53250
53321
  * refusal, so a caller tells "the switch is offline" from "a restart is
53251
53322
  * already running" without parsing text.
@@ -53261,6 +53332,8 @@ var PowerSourceRefusalReasonSchema = zod.z.enum([
53261
53332
  "switch-unknown",
53262
53333
  "restart-in-progress",
53263
53334
  "switch-call-failed",
53335
+ "switch-options-unreadable",
53336
+ "not-settable",
53264
53337
  "switch-is-actuator"
53265
53338
  ]);
53266
53339
  var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
@@ -53277,6 +53350,14 @@ var PowerSourceInfoSchema = zod.z.object({
53277
53350
  /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
53278
53351
  switchOn: zod.z.boolean().nullable(),
53279
53352
  switchOnline: zod.z.boolean().nullable(),
53353
+ /**
53354
+ * Whether the linked switch can be set (`switch.getOptions().supportsSetState`; a provider
53355
+ * without the method is a plain switch, `true`). `null` = not known: no link, the switch is
53356
+ * missing, or the read FAILED. Absent = a provider that predates the field. Only `false`
53357
+ * withdraws power on / off (`offeredWhen` of `powerSource.on` / `.off`, the device hero) —
53358
+ * unknown keeps them (D315, D1058).
53359
+ */
53360
+ switchSettable: zod.z.boolean().nullable().optional(),
53280
53361
  restartInProgress: zod.z.boolean(),
53281
53362
  offSeconds: zod.z.number().int()
53282
53363
  });
@@ -53334,6 +53415,11 @@ var powerSourceCustomize = {
53334
53415
  }]
53335
53416
  };
53336
53417
  var deviceInput$2 = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
53418
+ /** The read that decides whether power on / off are offered (`offeredWhen`, D1058). */
53419
+ var POWER_SOURCE_SETTABLE_GATE = {
53420
+ method: "getStatus",
53421
+ field: "switchSettable"
53422
+ };
53337
53423
  var powerSourceCapability = {
53338
53424
  name: "power-source",
53339
53425
  scope: "device",
@@ -53348,7 +53434,8 @@ var powerSourceCapability = {
53348
53434
  id: "powerSource.on",
53349
53435
  label: require_sleep.t("Power on", "Dai corrente"),
53350
53436
  phrase: require_sleep.t("Power on {device}", "Dai corrente a {device}"),
53351
- icon: "power"
53437
+ icon: "power",
53438
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
53352
53439
  }]
53353
53440
  }),
53354
53441
  powerOff: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -53358,7 +53445,8 @@ var powerSourceCapability = {
53358
53445
  id: "powerSource.off",
53359
53446
  label: require_sleep.t("Power off", "Togli corrente"),
53360
53447
  phrase: require_sleep.t("Cut the power of {device}", "Togli la corrente a {device}"),
53361
- icon: "power-off"
53448
+ icon: "power-off",
53449
+ offeredWhen: POWER_SOURCE_SETTABLE_GATE
53362
53450
  }]
53363
53451
  }),
53364
53452
  forceRestart: require_sleep.systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
@@ -56466,6 +56554,339 @@ function siteZoneKey(label) {
56466
56554
  return label.trim().toLowerCase();
56467
56555
  }
56468
56556
  //#endregion
56557
+ //#region src/device/device-identifiers.ts
56558
+ /**
56559
+ * Provider-declared device identifiers (D1059, planning#590).
56560
+ *
56561
+ * What a device IS, as its owning provider read it from the hardware: the keys a
56562
+ * later step matches across integrations to tell that two devices are the same
56563
+ * physical object. Separate from `DeviceMetadata` on purpose — metadata is a
56564
+ * free-form blob the operator can edit, identifiers are typed, normalised and
56565
+ * written ONLY by the provider that owns the device (`device-manager.
56566
+ * setIdentifiers`, owner-checked on the transport's caller stamp).
56567
+ *
56568
+ * | Key | Stored form | Strength |
56569
+ * | -------------- | ----------------------------------- | -------- |
56570
+ * | `mac` | `aa:bb:cc:dd:ee:ff`, several | strong |
56571
+ * | `serial` | `<manufacturer>:<serial>` | strong |
56572
+ * | `machine-uuid` | SMBIOS / VM / container uuid | strong |
56573
+ * | `vendor-uid` | `<vendor>:<id>` | strong |
56574
+ * | `hostname` | lower-case, no domain | weak |
56575
+ * | `ip` | IPv4 / IPv6 | weak |
56576
+ *
56577
+ * Strength is a property of the KEY, derived by {@link identifierStrength} —
56578
+ * never stored, so it cannot drift from the table above. A weak key never links
56579
+ * two devices on its own.
56580
+ *
56581
+ * The schema refuses a value that is not in its stored form, so whatever is
56582
+ * persisted is already normalised. Build a declaration with
56583
+ * {@link normaliseIdentifiers}, which turns the raw values a driver read into
56584
+ * that form and names every value it refused.
56585
+ */
56586
+ var DEVICE_IDENTIFIER_KEYS = [
56587
+ "mac",
56588
+ "serial",
56589
+ "machine-uuid",
56590
+ "vendor-uid",
56591
+ "hostname",
56592
+ "ip"
56593
+ ];
56594
+ var DeviceIdentifierKeySchema = zod.z.enum(DEVICE_IDENTIFIER_KEYS);
56595
+ /** `read` — the provider read it from the device; `derived` — computed from something else it read. */
56596
+ var DeviceIdentifierOriginSchema = zod.z.enum(["read", "derived"]);
56597
+ var MAC_PATTERN = /^[0-9a-f]{2}(?::[0-9a-f]{2}){5}$/;
56598
+ /** `<prefix>:<value>` — prefix a lower-case slug, value lower-case and non-blank. */
56599
+ var PREFIXED_PATTERN = /^[a-z0-9][a-z0-9._-]*:[^\sA-Z]+$/;
56600
+ var MACHINE_UUID_PATTERN = /^[0-9a-f][0-9a-f-]{7,}$/;
56601
+ var HOSTNAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
56602
+ function entrySchema(value) {
56603
+ return zod.z.object({
56604
+ value,
56605
+ origin: DeviceIdentifierOriginSchema,
56606
+ /** Epoch ms of the FIRST read that produced this value (and origin). A later
56607
+ * read of the same value does not move it — see {@link mergeIdentifiers}. */
56608
+ readAt: zod.z.number().int().nonnegative()
56609
+ }).strict();
56610
+ }
56611
+ var MacEntrySchema = entrySchema(zod.z.string().regex(MAC_PATTERN));
56612
+ var SerialEntrySchema = entrySchema(zod.z.string().regex(PREFIXED_PATTERN));
56613
+ var MachineUuidEntrySchema = entrySchema(zod.z.string().regex(MACHINE_UUID_PATTERN));
56614
+ var VendorUidEntrySchema = entrySchema(zod.z.string().regex(PREFIXED_PATTERN));
56615
+ var HostnameEntrySchema = entrySchema(zod.z.string().regex(HOSTNAME_PATTERN));
56616
+ var IpEntrySchema = entrySchema(zod.z.union([zod.z.ipv4(), zod.z.ipv6()]));
56617
+ var DeviceIdentifierEntrySchema = zod.z.object({
56618
+ value: zod.z.string().min(1),
56619
+ origin: DeviceIdentifierOriginSchema,
56620
+ readAt: zod.z.number().int().nonnegative()
56621
+ }).strict();
56622
+ /** The typed declaration. Every key optional; `mac` the only one that holds several. */
56623
+ var DeviceIdentifiersSchema = zod.z.object({
56624
+ mac: zod.z.array(MacEntrySchema).min(1).readonly().optional(),
56625
+ serial: SerialEntrySchema.optional(),
56626
+ "machine-uuid": MachineUuidEntrySchema.optional(),
56627
+ "vendor-uid": VendorUidEntrySchema.optional(),
56628
+ hostname: HostnameEntrySchema.optional(),
56629
+ ip: IpEntrySchema.optional()
56630
+ }).strict();
56631
+ var STRENGTH = {
56632
+ mac: "strong",
56633
+ serial: "strong",
56634
+ "machine-uuid": "strong",
56635
+ "vendor-uid": "strong",
56636
+ hostname: "weak",
56637
+ ip: "weak"
56638
+ };
56639
+ /** How much a match on this key says about two devices being the same object. */
56640
+ function identifierStrength(key) {
56641
+ return STRENGTH[key];
56642
+ }
56643
+ /** True when the declaration carries no key at all. */
56644
+ function isEmptyIdentifiers(identifiers) {
56645
+ return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
56646
+ }
56647
+ /** Values devices report when they do not know: never an identity. */
56648
+ var PLACEHOLDER_PATTERN = /^(?:unknown|none|n\/?a|null|undefined|default|0+|-+)$/i;
56649
+ var NULL_MACS = new Set(["00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff"]);
56650
+ function rejected(reason) {
56651
+ return {
56652
+ ok: false,
56653
+ reason
56654
+ };
56655
+ }
56656
+ /** `AA-BB-CC-DD-EE-FF`, `aabb.ccdd.eeff`, `AABBCCDDEEFF` → `aa:bb:cc:dd:ee:ff`. */
56657
+ function normaliseMac(raw) {
56658
+ const hex = raw.trim().toLowerCase().replace(/[\s:.-]/g, "");
56659
+ if (!/^[0-9a-f]{12}$/.test(hex)) return rejected("not a 48-bit MAC");
56660
+ const mac = (hex.match(/../g) ?? []).join(":");
56661
+ if (NULL_MACS.has(mac)) return rejected("placeholder MAC");
56662
+ return {
56663
+ ok: true,
56664
+ value: mac
56665
+ };
56666
+ }
56667
+ function slug$2(raw) {
56668
+ return raw.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[-._]+|[-._]+$/g, "");
56669
+ }
56670
+ function normalisePrefixed(prefixRaw, valueRaw, what) {
56671
+ const prefix = slug$2(prefixRaw);
56672
+ if (prefix.length === 0) return rejected(`no ${what}`);
56673
+ const value = valueRaw.trim().toLowerCase().replace(/\s+/g, "");
56674
+ if (value.length === 0) return rejected("blank value");
56675
+ if (PLACEHOLDER_PATTERN.test(value)) return rejected("placeholder value");
56676
+ return {
56677
+ ok: true,
56678
+ value: `${prefix}:${value}`
56679
+ };
56680
+ }
56681
+ function normaliseMachineUuid(raw) {
56682
+ const value = raw.trim().toLowerCase().replace(/^\{|\}$/g, "");
56683
+ if (!MACHINE_UUID_PATTERN.test(value)) return rejected("not a uuid");
56684
+ if (/^[0-]+$/.test(value) || /^[f-]+$/.test(value)) return rejected("placeholder uuid");
56685
+ return {
56686
+ ok: true,
56687
+ value
56688
+ };
56689
+ }
56690
+ function isIp(value) {
56691
+ return zod.z.union([zod.z.ipv4(), zod.z.ipv6()]).safeParse(value).success;
56692
+ }
56693
+ function normaliseHostname(raw) {
56694
+ const full = raw.trim().toLowerCase().replace(/\.$/, "");
56695
+ if (full.length === 0) return rejected("blank hostname");
56696
+ if (isIp(full)) return rejected("an address, not a hostname");
56697
+ const label = full.split(".")[0] ?? "";
56698
+ if (!HOSTNAME_PATTERN.test(label)) return rejected("not a hostname");
56699
+ if (label === "localhost") return rejected("placeholder hostname");
56700
+ return {
56701
+ ok: true,
56702
+ value: label
56703
+ };
56704
+ }
56705
+ function normaliseIp(raw) {
56706
+ const value = raw.trim().toLowerCase().replace(/^\[|\]$/g, "");
56707
+ if (!isIp(value)) return rejected("not an IP address");
56708
+ if (value === "0.0.0.0" || value === "::" || value === "::1" || value.startsWith("127.")) return rejected("loopback or unspecified address");
56709
+ return {
56710
+ ok: true,
56711
+ value
56712
+ };
56713
+ }
56714
+ function isBlank(value) {
56715
+ return value === null || value === void 0 || value.trim().length === 0;
56716
+ }
56717
+ /**
56718
+ * Turn what a driver read into a valid {@link DeviceIdentifiers}: MACs lower-case
56719
+ * with colons and de-duplicated, a hostname without its domain, an IP validated,
56720
+ * a serial prefixed by its manufacturer, a vendor uid by its vendor. A value that
56721
+ * cannot be normalised is left out and listed in `rejected` — the caller logs it
56722
+ * (with `tags: { deviceId }`), it is never dropped in silence.
56723
+ */
56724
+ function normaliseIdentifiers(raw, options = {}) {
56725
+ const readAt = options.readAt ?? Date.now();
56726
+ const originOf = (key) => options.originByKey?.[key] ?? options.origin ?? "read";
56727
+ const entry = (key, value) => ({
56728
+ value,
56729
+ origin: originOf(key),
56730
+ readAt
56731
+ });
56732
+ const refused = [];
56733
+ const take = (key, input, result) => {
56734
+ if (result.ok) return entry(key, result.value);
56735
+ refused.push({
56736
+ key,
56737
+ value: input,
56738
+ reason: result.reason
56739
+ });
56740
+ };
56741
+ const macInputs = raw.mac === null || raw.mac === void 0 ? [] : [raw.mac].flat();
56742
+ const macs = [];
56743
+ for (const input of macInputs) {
56744
+ if (isBlank(input)) continue;
56745
+ const taken = take("mac", input, normaliseMac(input));
56746
+ if (taken !== void 0 && !macs.some((m) => m.value === taken.value)) macs.push(taken);
56747
+ }
56748
+ const serial = raw.serial === null || raw.serial === void 0 || isBlank(raw.serial.serial) ? void 0 : take("serial", `${raw.serial.manufacturer}:${raw.serial.serial}`, normalisePrefixed(raw.serial.manufacturer, raw.serial.serial, "manufacturer"));
56749
+ const vendorUid = raw.vendorUid === null || raw.vendorUid === void 0 || isBlank(raw.vendorUid.id) ? void 0 : take("vendor-uid", `${raw.vendorUid.vendor}:${raw.vendorUid.id}`, normalisePrefixed(raw.vendorUid.vendor, raw.vendorUid.id, "vendor"));
56750
+ const machineUuid = isBlank(raw.machineUuid) ? void 0 : take("machine-uuid", raw.machineUuid, normaliseMachineUuid(raw.machineUuid));
56751
+ const host = isBlank(raw.host) ? null : raw.host.trim();
56752
+ const hostIsIp = host !== null && isIp(host.toLowerCase().replace(/^\[|\]$/g, ""));
56753
+ const hostnameInput = isBlank(raw.hostname) ? hostIsIp ? null : host : raw.hostname;
56754
+ const ipInput = isBlank(raw.ip) ? hostIsIp ? host : null : raw.ip;
56755
+ const hostname = hostnameInput === null ? void 0 : take("hostname", hostnameInput, normaliseHostname(hostnameInput));
56756
+ const ip = ipInput === null ? void 0 : take("ip", ipInput, normaliseIp(ipInput));
56757
+ return {
56758
+ identifiers: {
56759
+ ...macs.length > 0 ? { mac: macs } : {},
56760
+ ...serial !== void 0 ? { serial } : {},
56761
+ ...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
56762
+ ...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
56763
+ ...hostname !== void 0 ? { hostname } : {},
56764
+ ...ip !== void 0 ? { ip } : {}
56765
+ },
56766
+ rejected: refused
56767
+ };
56768
+ }
56769
+ function sameEntry(a, b) {
56770
+ return a.value === b.value && a.origin === b.origin;
56771
+ }
56772
+ /** `next`, but with the stored entry wherever value and origin are unchanged. */
56773
+ function keepStoredEntry(next, stored) {
56774
+ return stored !== void 0 && sameEntry(next, stored) ? stored : next;
56775
+ }
56776
+ /**
56777
+ * The declaration to store when the owning provider declares `next` over
56778
+ * `stored` (D1059).
56779
+ *
56780
+ * - A kind in `unread` — the provider TRIED to read it and the read failed —
56781
+ * keeps its stored entry: a failed read changes nothing (D49).
56782
+ * - Every other kind is what `next` says: a kind absent from `next` was read and
56783
+ * found absent, so it is removed.
56784
+ * - An entry whose value and origin are unchanged keeps its stored `readAt`:
56785
+ * `readAt` is when that value was FIRST read, so a provider re-declaring on every
56786
+ * boot writes nothing and emits nothing.
56787
+ *
56788
+ * Returns `null` when nothing is left.
56789
+ */
56790
+ function mergeIdentifiers(stored, next, unread = []) {
56791
+ const before = stored ?? {};
56792
+ const after = next ?? {};
56793
+ const failed = new Set(unread);
56794
+ const macs = failed.has("mac") ? before.mac : after.mac?.map((m) => keepStoredEntry(m, before.mac?.find((s) => sameEntry(s, m))));
56795
+ const single = (key) => {
56796
+ if (failed.has(key)) return before[key];
56797
+ const entry = after[key];
56798
+ return entry === void 0 ? void 0 : keepStoredEntry(entry, before[key]);
56799
+ };
56800
+ const serial = single("serial");
56801
+ const machineUuid = single("machine-uuid");
56802
+ const vendorUid = single("vendor-uid");
56803
+ const hostname = single("hostname");
56804
+ const ip = single("ip");
56805
+ const merged = {
56806
+ ...macs !== void 0 && macs.length > 0 ? { mac: macs } : {},
56807
+ ...serial !== void 0 ? { serial } : {},
56808
+ ...machineUuid !== void 0 ? { "machine-uuid": machineUuid } : {},
56809
+ ...vendorUid !== void 0 ? { "vendor-uid": vendorUid } : {},
56810
+ ...hostname !== void 0 ? { hostname } : {},
56811
+ ...ip !== void 0 ? { ip } : {}
56812
+ };
56813
+ return isEmptyIdentifiers(merged) ? null : merged;
56814
+ }
56815
+ /** True when two declarations hold the same entries, `readAt` included (key order ignored). */
56816
+ function sameIdentifiers(a, b) {
56817
+ const canonical = (v) => v === null || v === void 0 || isEmptyIdentifiers(v) ? "" : JSON.stringify(DEVICE_IDENTIFIER_KEYS.map((key) => [key, v[key] ?? null]).map(([key, e]) => [key, e === null ? null : [e].flat().map((x) => [
56818
+ x.value,
56819
+ x.origin,
56820
+ x.readAt
56821
+ ])]));
56822
+ return canonical(a) === canonical(b);
56823
+ }
56824
+ //#endregion
56825
+ //#region src/device/device-identity-candidates.ts
56826
+ /**
56827
+ * Cross-integration identity candidates (planning#593, step 2 of D1059's epic).
56828
+ *
56829
+ * Two devices brought by DIFFERENT integrations that share provider-declared
56830
+ * identifiers ({@link DeviceIdentifiers}) are candidates for being the same
56831
+ * physical object. This module holds the answer's shape; the device-manager
56832
+ * keeps the index that finds the pairs and the ONE rule that grades a match
56833
+ * (`classifyIdentityMatch`, `device-identity-index.ts`).
56834
+ *
56835
+ * The rule (operator, planning#590):
56836
+ *
56837
+ * | Matched keys | Confidence |
56838
+ * | ---------------------------------------------- | ----------- |
56839
+ * | two strong KINDS (e.g. `mac` + `serial`) | `auto` |
56840
+ * | `mac` + `ip` | `auto` |
56841
+ * | exactly one strong kind | `proposal` |
56842
+ * | weak keys only (`hostname`, `ip`) | no candidate|
56843
+ *
56844
+ * Strength counts distinct KINDS, not values: two MACs of one device matching
56845
+ * the other's two MACs are still one kind of evidence, so a proposal. In doubt,
56846
+ * no match.
56847
+ *
56848
+ * Read-only: a candidate is NOT a link. Links are step 3.
56849
+ */
56850
+ var IdentityConfidenceSchema = zod.z.enum(["auto", "proposal"]);
56851
+ /** One identifier both devices declared, with the same normalised value. */
56852
+ var IdentityMatchedKeySchema = zod.z.object({
56853
+ key: DeviceIdentifierKeySchema,
56854
+ value: zod.z.string()
56855
+ });
56856
+ /** One side of a pair: the device and the integration that brought it. */
56857
+ var IdentityCandidateDeviceSchema = zod.z.object({
56858
+ deviceId: zod.z.number().int(),
56859
+ addonId: zod.z.string(),
56860
+ /** The integration instance (`int_NNNN`) that adopted it; `null` when none was stamped. */
56861
+ integrationId: zod.z.string().nullable()
56862
+ });
56863
+ /** Two devices of different integrations sharing at least one strong identifier. `a.deviceId < b.deviceId`. */
56864
+ var IdentityCandidatePairSchema = zod.z.object({
56865
+ a: IdentityCandidateDeviceSchema,
56866
+ b: IdentityCandidateDeviceSchema,
56867
+ /** Every identifier the two share, weak ones included, ordered by key then value. */
56868
+ keys: zod.z.array(IdentityMatchedKeySchema).readonly(),
56869
+ confidence: IdentityConfidenceSchema
56870
+ });
56871
+ /**
56872
+ * The answer of `device-manager.listIdentityCandidates`.
56873
+ *
56874
+ * - `unknown` — the index has not loaded yet: nothing can be said, and it is
56875
+ * NOT an empty list (D315).
56876
+ * - `answered` — `pairs` holds every candidate. `undeclaredDeviceIds` are the
56877
+ * devices with no identifiers on record: whether they match anything is
56878
+ * UNKNOWN, never "no match" (D393). A device absent from both lists declared
56879
+ * identifiers and matched nobody.
56880
+ */
56881
+ var IdentityCandidatesSchema = zod.z.discriminatedUnion("status", [zod.z.object({
56882
+ status: zod.z.literal("unknown"),
56883
+ reason: zod.z.string()
56884
+ }), zod.z.object({
56885
+ status: zod.z.literal("answered"),
56886
+ pairs: zod.z.array(IdentityCandidatePairSchema).readonly(),
56887
+ undeclaredDeviceIds: zod.z.array(zod.z.number().int()).readonly()
56888
+ })]);
56889
+ //#endregion
56469
56890
  //#region src/capabilities/device-search.ts
56470
56891
  /**
56471
56892
  * `deviceManager.search` — the query behind the device → value picker.
@@ -57048,6 +57469,10 @@ var DeviceInfoSchema = zod.z.object({
57048
57469
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
57049
57470
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
57050
57471
  metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
57472
+ /** Provider-declared identifiers (D1059): typed, normalised, written only by
57473
+ * the owning provider via `setIdentifiers`; read-only for the operator.
57474
+ * Absent ⇒ the provider declared none. */
57475
+ identifiers: DeviceIdentifiersSchema.optional(),
57051
57476
  /** Optional upstream-system identity + rendering envelope. See
57052
57477
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
57053
57478
  sourceInfo: SourceInfoSchema.optional(),
@@ -57214,6 +57639,8 @@ var DeviceMetaSchema = zod.z.object({
57214
57639
  disabled: zod.z.boolean(),
57215
57640
  parentDeviceId: zod.z.number().nullable(),
57216
57641
  metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
57642
+ /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
57643
+ identifiers: DeviceIdentifiersSchema.optional(),
57217
57644
  /** Optional upstream-system identity + rendering envelope. See
57218
57645
  * `SourceInfo`. Present when the device has been persisted with a
57219
57646
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -57695,6 +58122,38 @@ var deviceManagerCapability = {
57695
58122
  kind: "mutation",
57696
58123
  auth: "admin"
57697
58124
  }),
58125
+ /** Declare the device's identifiers (D1059) — the typed, normalised keys
58126
+ * (`mac`, `serial`, `machine-uuid`, `vendor-uid`, `hostname`, `ip`) a later
58127
+ * step matches across integrations. Each kind is REPLACED by what this call
58128
+ * says (absent = read and found absent, removed) EXCEPT the kinds listed in
58129
+ * `unread` — the reads that FAILED this time — which keep their stored value.
58130
+ * An unchanged value keeps its first `readAt`; a call that changes nothing
58131
+ * writes and emits nothing. `null` clears every read kind. Accepted only from the provider that OWNS the device: the
58132
+ * caller stamp the transport sets (`callerAddonId`) must equal the row's
58133
+ * `addonId`, so an operator session — which carries no stamp — is refused.
58134
+ * Build the value with `normaliseIdentifiers` (`@camstack/types`); a device
58135
+ * calls it through `BaseDevice.declareIdentifiers`. */
58136
+ setIdentifiers: require_sleep.method(zod.z.object({
58137
+ deviceId: zod.z.number(),
58138
+ identifiers: DeviceIdentifiersSchema.nullable(),
58139
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
58140
+ unread: zod.z.array(DeviceIdentifierKeySchema).optional()
58141
+ }), zod.z.void(), {
58142
+ kind: "mutation",
58143
+ auth: "admin"
58144
+ }),
58145
+ /** Cross-integration identity candidates (planning#593) — READ-ONLY, links
58146
+ * nothing. Every pair of devices from DIFFERENT integrations that share a
58147
+ * strong identifier, with the keys they share and a confidence: `auto` (two
58148
+ * strong kinds, or `mac` + `ip`), `proposal` (one strong kind). Weak keys
58149
+ * alone never pair; a same-integration match is no candidate. Answered from
58150
+ * the device-manager's identifier index, never a fleet scan. `unknown`
58151
+ * until the index has loaded (never an empty list); `undeclaredDeviceIds`
58152
+ * are the devices whose identity is unknown, never "no match". */
58153
+ listIdentityCandidates: require_sleep.method(zod.z.object({}), IdentityCandidatesSchema, {
58154
+ kind: "query",
58155
+ auth: "admin"
58156
+ }),
57698
58157
  /** Operator-curated location registry. Returns the union of:
57699
58158
  * (1) labels persisted in the registry via `addLocation`, and
57700
58159
  * (2) labels currently in use on at least one device's
@@ -64623,6 +65082,7 @@ var HERO_SCENE_BY_TYPE = {
64623
65082
  [require_composed_stable_id.DeviceType.WaterHeater]: "heater",
64624
65083
  [require_composed_stable_id.DeviceType.HeatPump]: "heat-pump",
64625
65084
  [require_composed_stable_id.DeviceType.EnergySystem]: "generic",
65085
+ [require_composed_stable_id.DeviceType.Workload]: "generic",
64626
65086
  [require_composed_stable_id.DeviceType.Fan]: "fan",
64627
65087
  [require_composed_stable_id.DeviceType.MediaPlayer]: "tv",
64628
65088
  [require_composed_stable_id.DeviceType.AlarmPanel]: "alarm",
@@ -64665,6 +65125,7 @@ var HERO_SCENE_BY_ROLE = {
64665
65125
  [require_composed_stable_id.DeviceRole.SwitchHeater]: "heater",
64666
65126
  [require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
64667
65127
  [require_composed_stable_id.DeviceRole.SwitchLight]: "light",
65128
+ [require_composed_stable_id.DeviceRole.PoePort]: "plug",
64668
65129
  [require_composed_stable_id.DeviceRole.ClimateAc]: "ac",
64669
65130
  [require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
64670
65131
  [require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
@@ -64709,7 +65170,12 @@ var HERO_SCENE_BY_ROLE = {
64709
65170
  [require_composed_stable_id.DeviceRole.MessagingNotifier]: "inherit",
64710
65171
  [require_composed_stable_id.DeviceRole.EmailNotifier]: "inherit",
64711
65172
  [require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
64712
- [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
65173
+ [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit",
65174
+ [require_composed_stable_id.DeviceRole.Vm]: "inherit",
65175
+ [require_composed_stable_id.DeviceRole.AppContainer]: "inherit",
65176
+ [require_composed_stable_id.DeviceRole.Lxc]: "inherit",
65177
+ [require_composed_stable_id.DeviceRole.App]: "inherit",
65178
+ [require_composed_stable_id.DeviceRole.Host]: "inherit"
64713
65179
  };
64714
65180
  function isDeviceType$3(type) {
64715
65181
  return Object.values(require_composed_stable_id.DeviceType).includes(type);
@@ -65057,8 +65523,12 @@ var HeroPowerSupplySlotSchema = zod.z.object({
65057
65523
  /** Off asks for a confirmation while the device runs. */
65058
65524
  confirmOffWhileRunning: zod.z.boolean(),
65059
65525
  running: zod.z.boolean().nullable(),
65060
- powerOn: HeroActionSchema,
65061
- powerOff: HeroActionSchema,
65526
+ /**
65527
+ * `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
65528
+ * API key): power on / off would always be refused. The restart stays (D1058).
65529
+ */
65530
+ powerOn: HeroActionSchema.nullable(),
65531
+ powerOff: HeroActionSchema.nullable(),
65062
65532
  restart: HeroActionSchema
65063
65533
  });
65064
65534
  var HeroStateBackdropSchema = zod.z.object({
@@ -79536,6 +80006,19 @@ var NetworkLinkStatusSchema = zod.z.object({
79536
80006
  rssi: zod.z.number().optional().meta(require_sleep.readingMeta("signal-level")),
79537
80007
  /** Network name of a wireless link, when the firmware reports it. */
79538
80008
  ssid: zod.z.string().optional(),
80009
+ /**
80010
+ * Negotiated link speed of a wired port, the `bitrate` quantity in its base
80011
+ * unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
80012
+ * `null` = the port is down or the speed is not known; absent = the provider
80013
+ * never reports one.
80014
+ */
80015
+ speedKbps: zod.z.number().nonnegative().nullable().optional().meta(require_sleep.readingMeta("bitrate")),
80016
+ /**
80017
+ * Whether the link is up. `type` names the medium, not its state, so a wired
80018
+ * port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
80019
+ * absent = the provider never reports it.
80020
+ */
80021
+ linkUp: zod.z.boolean().nullable().optional(),
79539
80022
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
79540
80023
  lastUpdated: zod.z.number().meta(require_sleep.readingMeta("none"))
79541
80024
  });
@@ -92048,7 +92531,18 @@ var videoclipsCapability = {
92048
92531
  * older than this field keeps working unchanged (D382 — an unstated
92049
92532
  * ask is zero).
92050
92533
  */
92051
- audio: ClipStreamAudioSchema.optional()
92534
+ audio: ClipStreamAudioSchema.optional(),
92535
+ /**
92536
+ * The operator's authorisation to wake a sleeping camera for this
92537
+ * dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
92538
+ * — the default — means a sleeping standalone battery camera is
92539
+ * REFUSED by name before any URL is minted. A caller sets it only
92540
+ * when a viewer itself asked for the clip (the broker's `playClip`);
92541
+ * a prefetch, a reconcile or a retry never does. With it, the
92542
+ * provider wakes the camera and waits under a bound; a camera that
92543
+ * does not come up is refused `wake-timeout`, naming the wait.
92544
+ */
92545
+ wake: ClipWakeSchema.optional()
92052
92546
  }), ClipStreamDialSchema, {
92053
92547
  kind: "query",
92054
92548
  auth: "protected"
@@ -92414,7 +92908,8 @@ var ClipExportFailureSchema = zod.z.enum([
92414
92908
  "camera-refused",
92415
92909
  "fetch-failed",
92416
92910
  "too-large-to-transfer",
92417
- "wake-expired"
92911
+ "wake-expired",
92912
+ "wake-timeout"
92418
92913
  ]);
92419
92914
  /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
92420
92915
  function clipExportFailure(code, detail) {
@@ -95272,6 +95767,16 @@ var SirenOptionsSchema = zod.z.object({
95272
95767
  rangeSeconds: SirenDurationRangeSchema.nullable(),
95273
95768
  /** The camera's default duration, seconds. */
95274
95769
  defaultSeconds: zod.z.number().positive(),
95770
+ /**
95771
+ * Discrete play counts the operator may pick; `null` when the camera gives a
95772
+ * range or does not count plays. Defaults to `null` so a provider that
95773
+ * predates plays (#589) reads as declaring none.
95774
+ */
95775
+ allowedPlays: zod.z.array(zod.z.number().int().positive()).nullable().default(null),
95776
+ /** Continuous range of play counts; `null` when listed or not counted. */
95777
+ rangePlays: SirenDurationRangeSchema.nullable().default(null),
95778
+ /** The camera's default play count; `null` when the camera does not count plays. */
95779
+ defaultPlays: zod.z.number().int().positive().nullable().default(null),
95275
95780
  /** What the camera counts natively. */
95276
95781
  unit: zod.z.enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
95277
95782
  /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
@@ -95288,9 +95793,28 @@ var SirenStatusSchema = zod.z.object({
95288
95793
  activeUntil: zod.z.number().nullable(),
95289
95794
  /** Duration of the current / last activation, seconds; `null` when none yet. */
95290
95795
  durationSeconds: zod.z.number().nullable(),
95796
+ /**
95797
+ * The play count of the current / last activation when it was asked in plays;
95798
+ * `null` when it was asked in seconds (or none yet). The unit that was asked.
95799
+ */
95800
+ plays: zod.z.number().int().positive().nullable().default(null),
95801
+ /**
95802
+ * True when `activeUntil` comes from a seconds-per-play factor the camera did
95803
+ * not report — the siren may fall silent somewhat earlier or later.
95804
+ */
95805
+ activeUntilEstimated: zod.z.boolean().default(false),
95291
95806
  /** Ms epoch of the last trigger (0 = never). */
95292
95807
  lastTriggeredAt: zod.z.number()
95293
95808
  });
95809
+ /** A trigger asks seconds OR plays (#589); neither means the camera default. */
95810
+ var SirenTriggerInputSchema = zod.z.object({
95811
+ deviceId: zod.z.number().int().nonnegative(),
95812
+ durationSeconds: zod.z.number().positive().optional(),
95813
+ plays: zod.z.number().int().positive().optional()
95814
+ }).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
95815
+ message: "a siren trigger takes durationSeconds or plays, not both",
95816
+ path: ["plays"]
95817
+ });
95294
95818
  var SirenRuntimeStateSchema = SirenStatusSchema.extend({
95295
95819
  /** Ms epoch of the last successful camera read of the options (0 = never). */
95296
95820
  lastFetchedAt: zod.z.number() });
@@ -95307,13 +95831,20 @@ var sirenCapability = {
95307
95831
  auth: "protected"
95308
95832
  }),
95309
95833
  /**
95310
- * Sound the siren. Without `durationSeconds` the camera default applies.
95311
- * Answers the state at the moment of the trigger (`activeUntil` included).
95834
+ * The play counts a rule may pick: what `getOptions` declares as a list, or
95835
+ * its range spelled out. Empty for a siren that counts seconds.
95312
95836
  */
95313
- trigger: require_sleep.method(zod.z.object({
95314
- deviceId: zod.z.number().int().nonnegative(),
95315
- durationSeconds: zod.z.number().positive().optional()
95316
- }), SirenStatusSchema, {
95837
+ getPlayChoices: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.array(zod.z.number().int().positive()), {
95838
+ kind: "query",
95839
+ auth: "protected"
95840
+ }),
95841
+ /**
95842
+ * Sound the siren for `durationSeconds` OR `plays` — never both. With
95843
+ * neither the camera default applies. A count on a siren that declares no
95844
+ * plays is refused. Answers the state at the moment of the trigger
95845
+ * (`activeUntil` included).
95846
+ */
95847
+ trigger: require_sleep.method(SirenTriggerInputSchema, SirenStatusSchema, {
95317
95848
  kind: "mutation",
95318
95849
  auth: "protected",
95319
95850
  actions: [{
@@ -95322,6 +95853,21 @@ var sirenCapability = {
95322
95853
  phrase: require_sleep.t("Sound {device}", "Fai suonare {device}"),
95323
95854
  icon: "siren",
95324
95855
  args: {}
95856
+ }, {
95857
+ id: "siren.triggerPlays",
95858
+ label: require_sleep.t("Sound the siren N times", "Fai suonare la sirena N volte"),
95859
+ phrase: require_sleep.t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
95860
+ icon: "siren",
95861
+ openArgs: [{
95862
+ key: "plays",
95863
+ label: require_sleep.t("Plays", "Riproduzioni"),
95864
+ offer: {
95865
+ kind: "dynamic",
95866
+ from: "method",
95867
+ method: "getPlayChoices",
95868
+ valueKind: "number"
95869
+ }
95870
+ }]
95325
95871
  }]
95326
95872
  }),
95327
95873
  /** Silence the siren now. */
@@ -97082,6 +97628,27 @@ var SwitchStatusSchema = zod.z.object({
97082
97628
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
97083
97629
  lastChangedAt: zod.z.number()
97084
97630
  });
97631
+ /**
97632
+ * What a switch can do, from its provider (`getOptions`). A provider that writes no
97633
+ * `getOptions` is a plain on/off switch: the defaults are the old contract.
97634
+ *
97635
+ * - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
97636
+ * through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
97637
+ * device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
97638
+ * (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
97639
+ * HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
97640
+ * (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
97641
+ * read that failed or is pending changes nothing (D315).
97642
+ * - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
97643
+ * one native call (a PoE port's power cycle). It has no control of its own: a linked
97644
+ * `power-source.forceRestart` uses it instead of off / wait / on.
97645
+ */
97646
+ var SwitchOptionsSchema = zod.z.object({
97647
+ supportsSetState: zod.z.boolean().default(true),
97648
+ supportsPowerCycle: zod.z.boolean().default(false)
97649
+ });
97650
+ /** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
97651
+ var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
97085
97652
  var switchCapability = {
97086
97653
  name: "switch",
97087
97654
  scope: "device",
@@ -97109,7 +97676,8 @@ var switchCapability = {
97109
97676
  field: "on",
97110
97677
  value: true
97111
97678
  },
97112
- args: { on: true }
97679
+ args: { on: true },
97680
+ offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
97113
97681
  }, {
97114
97682
  id: "switch.off",
97115
97683
  label: require_sleep.t("Turn off", "Spegni"),
@@ -97119,9 +97687,16 @@ var switchCapability = {
97119
97687
  field: "on",
97120
97688
  value: false
97121
97689
  },
97122
- args: { on: false }
97690
+ args: { on: false },
97691
+ offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
97123
97692
  }]
97124
97693
  }),
97694
+ getOptions: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), SwitchOptionsSchema, { auth: "protected" }),
97695
+ powerCycle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
97696
+ kind: "mutation",
97697
+ auth: "protected",
97698
+ notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
97699
+ }),
97125
97700
  toggle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
97126
97701
  kind: "mutation",
97127
97702
  auth: "protected",
@@ -97129,7 +97704,8 @@ var switchCapability = {
97129
97704
  id: "switch.toggle",
97130
97705
  label: require_sleep.t("Toggle", "Commuta"),
97131
97706
  phrase: require_sleep.t("Toggle {device}", "Commuta {device}"),
97132
- icon: "toggle-right"
97707
+ icon: "toggle-right",
97708
+ offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
97133
97709
  }]
97134
97710
  })
97135
97711
  },
@@ -97151,6 +97727,16 @@ var switchCapability = {
97151
97727
  * not need to re-query the provider after a setState mutation.
97152
97728
  */
97153
97729
  runtimeState: SwitchStatusSchema,
97730
+ composedMethods: {
97731
+ getOptions: {
97732
+ kind: "answer",
97733
+ value: SWITCH_DEFAULT_OPTIONS
97734
+ },
97735
+ powerCycle: {
97736
+ kind: "refuse",
97737
+ reason: "a composed switch has no native power cycle"
97738
+ }
97739
+ },
97154
97740
  /**
97155
97741
  * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
97156
97742
  *
@@ -97324,6 +97910,26 @@ var switchCapability = {
97324
97910
  "switch.off": { icon: "plug" }
97325
97911
  },
97326
97912
  state: { on: { icon: "plug-zap" } }
97913
+ },
97914
+ [require_composed_stable_id.DeviceRole.PoePort]: {
97915
+ actions: {
97916
+ "switch.on": {
97917
+ label: require_sleep.t("Power on", "Alimenta"),
97918
+ phrase: require_sleep.t("Power on {device}", "Alimenta {device}"),
97919
+ icon: "plug-zap"
97920
+ },
97921
+ "switch.off": {
97922
+ label: require_sleep.t("Power off", "Togli alimentazione"),
97923
+ phrase: require_sleep.t("Power off {device}", "Togli alimentazione a {device}"),
97924
+ icon: "unplug"
97925
+ }
97926
+ },
97927
+ state: { on: {
97928
+ label: require_sleep.t("Powered", "Alimentata"),
97929
+ whenTrue: require_sleep.t("When {device} is powered", "Quando {device} viene alimentata"),
97930
+ whenFalse: require_sleep.t("When {device} loses power", "Quando {device} perde l’alimentazione"),
97931
+ icon: "plug-zap"
97932
+ } }
97327
97933
  }
97328
97934
  }
97329
97935
  }
@@ -99212,7 +99818,6 @@ var templateCapability = {
99212
99818
  //#region src/capabilities/terminal-session.cap.ts
99213
99819
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
99214
99820
  var ProfileSettingsSchemaBridge = zod.z.unknown().nullable();
99215
- var ProfileSettingsBagSchema = zod.z.record(zod.z.string(), zod.z.unknown());
99216
99821
  /**
99217
99822
  * A live terminal session hosted by the provider addon. Output and input do
99218
99823
  * NOT flow through the capability — they use the addon data plane
@@ -99255,39 +99860,6 @@ var TerminalProfileInfoSchema = zod.z.object({
99255
99860
  /** ConfigUISchema for instance knobs, or null when the profile has none. */
99256
99861
  settingsSchema: ProfileSettingsSchemaBridge.optional()
99257
99862
  });
99258
- /**
99259
- * A durable operator-created Terminal instance. Profiles are templates; only
99260
- * an instance declares a camera.
99261
- */
99262
- var TerminalInstanceInfoSchema = zod.z.object({
99263
- instanceId: zod.z.string(),
99264
- cameraStableId: zod.z.string(),
99265
- nodeId: zod.z.string(),
99266
- /**
99267
- * False while the node the instance is bound to is not in the cluster
99268
- * topology (forgotten, renamed, re-paired). The instance is kept; the
99269
- * operator re-points it on the Terminal page.
99270
- */
99271
- nodeInCluster: zod.z.boolean(),
99272
- profileId: zod.z.string(),
99273
- profileLabel: zod.z.string(),
99274
- name: zod.z.string(),
99275
- enabled: zod.z.boolean(),
99276
- executable: zod.z.string(),
99277
- args: zod.z.array(zod.z.string()).readonly(),
99278
- cwd: zod.z.string(),
99279
- environment: zod.z.array(zod.z.string()).readonly(),
99280
- profileSettings: ProfileSettingsBagSchema
99281
- });
99282
- var TerminalLegacyCameraSchema = zod.z.object({
99283
- stableId: zod.z.string(),
99284
- nodeId: zod.z.string(),
99285
- profileId: zod.z.string(),
99286
- profileLabel: zod.z.string(),
99287
- name: zod.z.string(),
99288
- /** Only legacy monitor cameras can retain their historic stable identity. */
99289
- adoptable: zod.z.boolean()
99290
- });
99291
99863
  var TerminalOutputEventSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
99292
99864
  seq: zod.z.number().int().positive(),
99293
99865
  kind: zod.z.literal("data"),
@@ -99319,8 +99891,8 @@ var TerminalOutputBatchSchema = zod.z.object({
99319
99891
  * terminal-session — singleton system capability for interactive TTY sessions.
99320
99892
  *
99321
99893
  * Owns both live PTY lifecycle and durable Terminal instance management.
99322
- * Profiles are allowlisted templates; an explicit instance is the only path
99323
- * that declares a camera.
99894
+ * Profiles are allowlisted templates; a Terminal camera is a core block naming
99895
+ * one Terminal (planning#580).
99324
99896
  */
99325
99897
  var terminalSessionCapability = {
99326
99898
  name: "terminal-session",
@@ -99329,16 +99901,6 @@ var terminalSessionCapability = {
99329
99901
  methods: {
99330
99902
  /** Pre-declared profiles the operator may open. */
99331
99903
  listProfiles: require_sleep.method(zod.z.void(), zod.z.array(TerminalProfileInfoSchema).readonly(), { auth: "admin" }),
99332
- /** Existing automatic cameras are shown for explicit migration only. */
99333
- listLegacyCameras: require_sleep.method(zod.z.void(), zod.z.array(TerminalLegacyCameraSchema).readonly(), { auth: "admin" }),
99334
- /** Explicitly adopt one legacy monitor camera, retaining its stable id. */
99335
- adoptLegacyMonitor: require_sleep.method(zod.z.object({
99336
- stableId: zod.z.string().min(1),
99337
- name: zod.z.string().trim().min(1).max(160).optional()
99338
- }), TerminalInstanceInfoSchema, {
99339
- kind: "mutation",
99340
- auth: "admin"
99341
- }),
99342
99904
  /** Live sessions currently hosted by the provider. */
99343
99905
  listSessions: require_sleep.method(zod.z.void(), zod.z.array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }),
99344
99906
  /**
@@ -102551,6 +103113,534 @@ var webrtcSessionCapability = {
102551
103113
  }
102552
103114
  };
102553
103115
  //#endregion
103116
+ //#region src/capabilities/workload.cap.ts
103117
+ /**
103118
+ * Workload (#585, D1056): ONE capability for everything that runs on a machine
103119
+ * and for the machine itself — a VM, an app container, an LXC, an app, a host.
103120
+ *
103121
+ * There is no `kind` field: the device ROLE is the only discriminator. It picks
103122
+ * the wording and icons (`vocabulary.overrides.byRole`) and `deviceRoles` keeps
103123
+ * the cap on `workload` devices that carry one of the five roles.
103124
+ *
103125
+ * What a device can do is declared by its provider through `getOptions`, probed,
103126
+ * never assumed: a Docker container has no force stop, a host may offer only a
103127
+ * restart. The derived UI shows only what is declared ({@link deriveWorkloadControls}).
103128
+ *
103129
+ * A value the provider did not report is `null`, never `0` / `false` (D393);
103130
+ * `state: null` is unknown, never stopped.
103131
+ */
103132
+ /** The lifecycle of a workload. `crashed` = stopped without a request. */
103133
+ var WORKLOAD_STATES = [
103134
+ "running",
103135
+ "paused",
103136
+ "stopped",
103137
+ "starting",
103138
+ "stopping",
103139
+ "crashed"
103140
+ ];
103141
+ var WorkloadStateSchema = zod.z.enum(WORKLOAD_STATES);
103142
+ /** The five kinds of workload, as roles of the `workload` device type (D1033). */
103143
+ var WORKLOAD_ROLES = [
103144
+ require_composed_stable_id.DeviceRole.Vm,
103145
+ require_composed_stable_id.DeviceRole.AppContainer,
103146
+ require_composed_stable_id.DeviceRole.Lxc,
103147
+ require_composed_stable_id.DeviceRole.App,
103148
+ require_composed_stable_id.DeviceRole.Host
103149
+ ];
103150
+ /**
103151
+ * What the workload uses. Every value is `null` when not reported (D393). A host
103152
+ * fills `load1` and `temperature`; its uptime is `since` while it runs.
103153
+ */
103154
+ var WorkloadResourcesSchema = zod.z.object({
103155
+ /** CPU use, percent of the CPUs it may use (0–100). */
103156
+ cpuPercent: zod.z.number().nullable().meta(require_sleep.readingMeta("percentage", { precision: 1 })),
103157
+ memoryUsedBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103158
+ /**
103159
+ * Memory use, percent of `memoryLimitBytes`, for a source that reports a share
103160
+ * and not bytes (a Docker container's stats). Absent or `null` = not reported.
103161
+ */
103162
+ memoryPercent: zod.z.number().nullable().optional().meta(require_sleep.readingMeta("percentage", { precision: 1 })),
103163
+ /** The memory it may use: the limit of a container, the RAM of a VM or host. */
103164
+ memoryLimitBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103165
+ vcpus: zod.z.number().nullable().meta(require_sleep.readingMeta("count")),
103166
+ diskUsedBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103167
+ diskTotalBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103168
+ /** Network received, kbit/s. */
103169
+ netRxKbps: zod.z.number().nullable().meta(require_sleep.readingMeta("bitrate")),
103170
+ /** Network sent, kbit/s. */
103171
+ netTxKbps: zod.z.number().nullable().meta(require_sleep.readingMeta("bitrate")),
103172
+ /** One-minute load average (a host). */
103173
+ load1: zod.z.number().nullable().meta(require_sleep.readingMeta("index", { precision: 2 })),
103174
+ /** CPU / board temperature (a host). */
103175
+ temperature: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature", { precision: 1 }))
103176
+ });
103177
+ var WorkloadPortProtocolSchema = zod.z.enum(["tcp", "udp"]);
103178
+ /** One published port: the workload's own port and where the host exposes it. */
103179
+ var WorkloadPortSchema = zod.z.object({
103180
+ port: zod.z.number().int().meta(require_sleep.readingMeta("none")),
103181
+ /** The host port it is published on; null = not published. */
103182
+ hostPort: zod.z.number().int().nullable().meta(require_sleep.readingMeta("none")),
103183
+ /** The host address it is bound to; null = every address. */
103184
+ hostIp: zod.z.string().nullable(),
103185
+ protocol: WorkloadPortProtocolSchema
103186
+ });
103187
+ var WorkloadStatusSchema = zod.z.object({
103188
+ /** null = unknown, never stopped (D393). */
103189
+ state: WorkloadStateSchema.nullable().meta({ label: "State" }),
103190
+ /** Epoch ms the current state began (uptime while running); null when unknown. */
103191
+ since: zod.z.number().nullable().meta(require_sleep.readingMeta("none")),
103192
+ /** The `host` device this runs on, when the provider has adopted it. */
103193
+ hostDeviceId: zod.z.number().int().nullable().meta(require_sleep.readingMeta("device")),
103194
+ /** The image a container runs (`nginx:1.27`). */
103195
+ image: zod.z.string().nullable(),
103196
+ /** The operating system (a VM, an LXC, a host). */
103197
+ os: zod.z.string().nullable(),
103198
+ /** The version or firmware it runs. */
103199
+ version: zod.z.string().nullable(),
103200
+ /** Starts with its host; null when the platform does not say. */
103201
+ autostart: zod.z.boolean().nullable(),
103202
+ resources: WorkloadResourcesSchema,
103203
+ ports: zod.z.array(WorkloadPortSchema),
103204
+ /** The addresses it is reachable on (IPs or host names). */
103205
+ addresses: zod.z.array(zod.z.string()),
103206
+ /** A newer image / version exists. Installing it stays the `update` cap. */
103207
+ updateAvailable: zod.z.boolean().nullable(),
103208
+ lastFetchedAt: zod.z.number()
103209
+ });
103210
+ /**
103211
+ * What this device can do, probed by its provider (D14 honesty): a flag is
103212
+ * `true` only when the platform really serves it for THIS device.
103213
+ */
103214
+ var WorkloadOptionsSchema = zod.z.object({
103215
+ supportsStart: zod.z.boolean(),
103216
+ supportsStop: zod.z.boolean(),
103217
+ supportsRestart: zod.z.boolean(),
103218
+ /** Pause AND resume. */
103219
+ supportsPause: zod.z.boolean(),
103220
+ supportsForceStop: zod.z.boolean(),
103221
+ hasResources: zod.z.boolean(),
103222
+ hasPorts: zod.z.boolean(),
103223
+ hasAddresses: zod.z.boolean(),
103224
+ hasAutostart: zod.z.boolean(),
103225
+ hasUpdateCheck: zod.z.boolean()
103226
+ });
103227
+ var WorkloadDeviceInputSchema = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
103228
+ var WorkloadTransitionEventDataSchema = zod.z.object({
103229
+ deviceId: zod.z.number(),
103230
+ state: WorkloadStateSchema,
103231
+ previous: WorkloadStateSchema,
103232
+ since: zod.z.number().nullable()
103233
+ });
103234
+ var WORKLOAD_ACTIONS = [
103235
+ "start",
103236
+ "stop",
103237
+ "restart",
103238
+ "pause",
103239
+ "resume",
103240
+ "forceStop"
103241
+ ];
103242
+ function actionDeclared(options, action) {
103243
+ switch (action) {
103244
+ case "start": return options.supportsStart;
103245
+ case "stop": return options.supportsStop;
103246
+ case "restart": return options.supportsRestart;
103247
+ case "pause":
103248
+ case "resume": return options.supportsPause;
103249
+ case "forceStop": return options.supportsForceStop;
103250
+ }
103251
+ }
103252
+ /** The states an action makes sense in. Unknown (`null`) allows what is not
103253
+ * state-bound, never pause / resume. */
103254
+ var ACTION_STATES = {
103255
+ start: ["stopped", "crashed"],
103256
+ stop: [
103257
+ "running",
103258
+ "paused",
103259
+ "starting"
103260
+ ],
103261
+ restart: ["running", "paused"],
103262
+ pause: ["running"],
103263
+ resume: ["paused"],
103264
+ forceStop: [
103265
+ "running",
103266
+ "paused",
103267
+ "starting",
103268
+ "stopping"
103269
+ ]
103270
+ };
103271
+ function actionEnabled(action, state) {
103272
+ if (state === null) return action !== "pause" && action !== "resume";
103273
+ return ACTION_STATES[action].includes(state);
103274
+ }
103275
+ /**
103276
+ * The controls and sections of a workload, derived from what its provider
103277
+ * declared and the state it is in. An undeclared feature is absent — never a
103278
+ * disabled button that could never work.
103279
+ */
103280
+ function deriveWorkloadControls(options, state) {
103281
+ return {
103282
+ controls: WORKLOAD_ACTIONS.filter((action) => actionDeclared(options, action)).map((action) => ({
103283
+ action,
103284
+ enabled: actionEnabled(action, state)
103285
+ })),
103286
+ sections: {
103287
+ resources: options.hasResources,
103288
+ ports: options.hasPorts,
103289
+ addresses: options.hasAddresses,
103290
+ autostart: options.hasAutostart,
103291
+ update: options.hasUpdateCheck
103292
+ }
103293
+ };
103294
+ }
103295
+ function isWorkloadSettled(state) {
103296
+ return state !== "starting" && state !== "stopping";
103297
+ }
103298
+ /**
103299
+ * The event a move from the last SETTLED state to `next` raises, or null.
103300
+ * A first sight (`previous` undefined) raises nothing: it is not a change.
103301
+ * Unknown (`next` null) raises nothing and is not remembered.
103302
+ */
103303
+ function workloadTransition(previous, next) {
103304
+ if (previous === void 0 || next === null || next === previous) return null;
103305
+ switch (next) {
103306
+ case "running":
103307
+ if (previous === "crashed") return "recovered";
103308
+ return previous === "stopped" ? "started" : null;
103309
+ case "stopped": return previous === "running" || previous === "paused" ? "stopped" : null;
103310
+ case "crashed": return "crashed";
103311
+ case "paused":
103312
+ case "starting":
103313
+ case "stopping": return null;
103314
+ }
103315
+ }
103316
+ /** The bus category of each transition. */
103317
+ var WORKLOAD_TRANSITION_CATEGORY = {
103318
+ started: require_event_category.EventCategory.WorkloadStarted,
103319
+ stopped: require_event_category.EventCategory.WorkloadStopped,
103320
+ crashed: require_event_category.EventCategory.WorkloadCrashed,
103321
+ recovered: require_event_category.EventCategory.WorkloadRecovered
103322
+ };
103323
+ var workloadCapability = {
103324
+ name: "workload",
103325
+ scope: "device",
103326
+ deviceNative: true,
103327
+ mode: "singleton",
103328
+ deviceTypes: [require_composed_stable_id.DeviceType.Workload],
103329
+ deviceRoles: { [require_composed_stable_id.DeviceType.Workload]: WORKLOAD_ROLES },
103330
+ /**
103331
+ * On / off is the state (#462): stopped or crashed is off, anything else on.
103332
+ * The owner registers `switch` through `registerPowerSwitch`; there is no
103333
+ * second on/off state. A device whose provider serves no start / stop gets no
103334
+ * switch.
103335
+ */
103336
+ power: {
103337
+ kind: "methods",
103338
+ field: "state",
103339
+ offValues: ["stopped", "crashed"],
103340
+ on: "start",
103341
+ off: "stop"
103342
+ },
103343
+ methods: {
103344
+ start: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103345
+ kind: "mutation",
103346
+ auth: "protected",
103347
+ actions: [{
103348
+ id: "workload.start",
103349
+ label: require_sleep.t("Start", "Avvia"),
103350
+ phrase: require_sleep.t("Start {device}", "Avvia {device}"),
103351
+ icon: "play",
103352
+ effect: {
103353
+ field: "state",
103354
+ value: "running"
103355
+ }
103356
+ }]
103357
+ }),
103358
+ stop: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103359
+ kind: "mutation",
103360
+ auth: "protected",
103361
+ actions: [{
103362
+ id: "workload.stop",
103363
+ label: require_sleep.t("Stop", "Arresta"),
103364
+ phrase: require_sleep.t("Stop {device}", "Arresta {device}"),
103365
+ icon: "square",
103366
+ effect: {
103367
+ field: "state",
103368
+ value: "stopped"
103369
+ }
103370
+ }]
103371
+ }),
103372
+ restart: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103373
+ kind: "mutation",
103374
+ auth: "protected",
103375
+ actions: [{
103376
+ id: "workload.restart",
103377
+ label: require_sleep.t("Restart", "Riavvia"),
103378
+ phrase: require_sleep.t("Restart {device}", "Riavvia {device}"),
103379
+ icon: "rotate-ccw"
103380
+ }]
103381
+ }),
103382
+ pause: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103383
+ kind: "mutation",
103384
+ auth: "protected",
103385
+ actions: [{
103386
+ id: "workload.pause",
103387
+ label: require_sleep.t("Pause", "Metti in pausa"),
103388
+ phrase: require_sleep.t("Pause {device}", "Metti in pausa {device}"),
103389
+ icon: "pause",
103390
+ effect: {
103391
+ field: "state",
103392
+ value: "paused"
103393
+ }
103394
+ }]
103395
+ }),
103396
+ resume: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103397
+ kind: "mutation",
103398
+ auth: "protected",
103399
+ actions: [{
103400
+ id: "workload.resume",
103401
+ label: require_sleep.t("Resume", "Riprendi"),
103402
+ phrase: require_sleep.t("Resume {device}", "Riprendi {device}"),
103403
+ icon: "circle-play",
103404
+ effect: {
103405
+ field: "state",
103406
+ value: "running"
103407
+ }
103408
+ }]
103409
+ }),
103410
+ forceStop: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103411
+ kind: "mutation",
103412
+ auth: "admin",
103413
+ actions: [{
103414
+ id: "workload.forceStop",
103415
+ label: require_sleep.t("Force stop", "Arresto forzato"),
103416
+ phrase: require_sleep.t("Force {device} to stop", "Forza l’arresto di {device}"),
103417
+ icon: "octagon-x",
103418
+ effect: {
103419
+ field: "state",
103420
+ value: "stopped"
103421
+ }
103422
+ }]
103423
+ }),
103424
+ /** What THIS device can do, probed — the UI is derived from it. */
103425
+ getOptions: require_sleep.method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
103426
+ },
103427
+ events: {
103428
+ onStarted: {
103429
+ data: WorkloadTransitionEventDataSchema,
103430
+ trigger: {
103431
+ category: require_event_category.EventCategory.WorkloadStarted,
103432
+ label: require_sleep.t("Started", "Avviato"),
103433
+ phrase: require_sleep.t("When {device} starts", "Quando {device} si avvia"),
103434
+ icon: "play"
103435
+ }
103436
+ },
103437
+ onStopped: {
103438
+ data: WorkloadTransitionEventDataSchema,
103439
+ trigger: {
103440
+ category: require_event_category.EventCategory.WorkloadStopped,
103441
+ label: require_sleep.t("Stopped", "Arrestato"),
103442
+ phrase: require_sleep.t("When {device} stops", "Quando {device} si arresta"),
103443
+ icon: "square"
103444
+ }
103445
+ },
103446
+ onCrashed: {
103447
+ data: WorkloadTransitionEventDataSchema,
103448
+ trigger: {
103449
+ category: require_event_category.EventCategory.WorkloadCrashed,
103450
+ label: require_sleep.t("Crashed", "Arrestato in modo anomalo"),
103451
+ phrase: require_sleep.t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
103452
+ icon: "triangle-alert"
103453
+ }
103454
+ },
103455
+ onRecovered: {
103456
+ data: WorkloadTransitionEventDataSchema,
103457
+ trigger: {
103458
+ category: require_event_category.EventCategory.WorkloadRecovered,
103459
+ label: require_sleep.t("Recovered", "Ripristinato"),
103460
+ phrase: require_sleep.t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
103461
+ icon: "heart-pulse"
103462
+ }
103463
+ }
103464
+ },
103465
+ status: {
103466
+ schema: WorkloadStatusSchema,
103467
+ kind: "poll"
103468
+ },
103469
+ runtimeState: WorkloadStatusSchema,
103470
+ /**
103471
+ * Runtime-state durability: **session** — the provider answers on its next
103472
+ * poll; the series are recorded, so a restart that clears the slice loses
103473
+ * nothing a reader needs. The events are judged from the first state seen.
103474
+ */
103475
+ durability: "session",
103476
+ /**
103477
+ * History (D850): the state as an enum, CPU / memory / network as gauges, so
103478
+ * the charts need no per-metric child device.
103479
+ */
103480
+ history: {
103481
+ primary: "resources.cpuPercent",
103482
+ priority: 40,
103483
+ fields: {
103484
+ state: { kind: "enum" },
103485
+ "resources.cpuPercent": {
103486
+ kind: "gauge",
103487
+ unit: "%",
103488
+ deadband: 2,
103489
+ displayName: "CPU"
103490
+ },
103491
+ "resources.memoryUsedBytes": {
103492
+ kind: "gauge",
103493
+ unit: "bytes",
103494
+ displayName: "Memory used"
103495
+ },
103496
+ "resources.memoryPercent": {
103497
+ kind: "gauge",
103498
+ unit: "%",
103499
+ deadband: 2,
103500
+ displayName: "Memory"
103501
+ },
103502
+ "resources.netRxKbps": {
103503
+ group: "network",
103504
+ kind: "gauge",
103505
+ unit: "kbps",
103506
+ displayName: "Network received"
103507
+ },
103508
+ "resources.netTxKbps": {
103509
+ group: "network",
103510
+ kind: "gauge",
103511
+ unit: "kbps",
103512
+ displayName: "Network sent"
103513
+ }
103514
+ }
103515
+ },
103516
+ volatileStateFields: ["lastFetchedAt"],
103517
+ vocabulary: {
103518
+ noun: require_sleep.t("Workload", "Carico di lavoro"),
103519
+ order: 2400,
103520
+ state: [
103521
+ {
103522
+ kind: "enum",
103523
+ field: "state",
103524
+ label: require_sleep.t("State", "Stato"),
103525
+ values: [
103526
+ {
103527
+ value: "running",
103528
+ label: require_sleep.t("Running", "In esecuzione"),
103529
+ phrase: require_sleep.t("When {device} is running", "Quando {device} è in esecuzione")
103530
+ },
103531
+ {
103532
+ value: "paused",
103533
+ label: require_sleep.t("Paused", "In pausa")
103534
+ },
103535
+ {
103536
+ value: "stopped",
103537
+ label: require_sleep.t("Stopped", "Arrestato"),
103538
+ phrase: require_sleep.t("When {device} is stopped", "Quando {device} è arrestato")
103539
+ },
103540
+ {
103541
+ value: "starting",
103542
+ label: require_sleep.t("Starting", "In avvio")
103543
+ },
103544
+ {
103545
+ value: "stopping",
103546
+ label: require_sleep.t("Stopping", "In arresto")
103547
+ },
103548
+ {
103549
+ value: "crashed",
103550
+ label: require_sleep.t("Crashed", "Arrestato in modo anomalo"),
103551
+ phrase: require_sleep.t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
103552
+ }
103553
+ ],
103554
+ icon: "activity"
103555
+ },
103556
+ {
103557
+ kind: "numeric",
103558
+ field: "resources.cpuPercent",
103559
+ quantity: require_sleep.t("the CPU use", "l'uso della CPU"),
103560
+ label: require_sleep.t("CPU", "CPU"),
103561
+ unit: "%",
103562
+ icon: "cpu"
103563
+ },
103564
+ {
103565
+ kind: "numeric",
103566
+ field: "resources.memoryPercent",
103567
+ quantity: require_sleep.t("the memory use", "l'uso della memoria"),
103568
+ label: require_sleep.t("Memory", "Memoria"),
103569
+ unit: "%",
103570
+ icon: "memory-stick"
103571
+ },
103572
+ {
103573
+ kind: "numeric",
103574
+ field: "resources.temperature",
103575
+ quantity: require_sleep.t("the temperature", "la temperatura"),
103576
+ label: require_sleep.t("Temperature", "Temperatura"),
103577
+ unit: "°C",
103578
+ icon: "thermometer"
103579
+ }
103580
+ ],
103581
+ overrides: { byRole: {
103582
+ [require_composed_stable_id.DeviceRole.Vm]: {
103583
+ actions: { "workload.start": { icon: "monitor" } },
103584
+ state: { state: { icon: "monitor" } }
103585
+ },
103586
+ [require_composed_stable_id.DeviceRole.AppContainer]: {
103587
+ actions: { "workload.start": { icon: "container" } },
103588
+ state: { state: { icon: "container" } }
103589
+ },
103590
+ [require_composed_stable_id.DeviceRole.Lxc]: {
103591
+ actions: { "workload.start": { icon: "box" } },
103592
+ state: { state: { icon: "box" } }
103593
+ },
103594
+ [require_composed_stable_id.DeviceRole.App]: {
103595
+ actions: { "workload.start": { icon: "app-window" } },
103596
+ state: { state: { icon: "app-window" } }
103597
+ },
103598
+ [require_composed_stable_id.DeviceRole.Host]: {
103599
+ actions: {
103600
+ "workload.start": {
103601
+ label: require_sleep.t("Power on", "Accendi"),
103602
+ phrase: require_sleep.t("Power on {device}", "Accendi {device}"),
103603
+ icon: "power"
103604
+ },
103605
+ "workload.stop": {
103606
+ label: require_sleep.t("Shut down", "Spegni"),
103607
+ phrase: require_sleep.t("Shut down {device}", "Spegni {device}"),
103608
+ icon: "power-off"
103609
+ },
103610
+ "workload.restart": {
103611
+ label: require_sleep.t("Reboot", "Riavvia"),
103612
+ phrase: require_sleep.t("Reboot {device}", "Riavvia {device}"),
103613
+ icon: "refresh-cw"
103614
+ }
103615
+ },
103616
+ state: { state: { icon: "server" } },
103617
+ events: {
103618
+ onStarted: {
103619
+ label: require_sleep.t("Came online", "Tornato in linea"),
103620
+ phrase: require_sleep.t("When {device} comes online", "Quando {device} torna in linea"),
103621
+ icon: "server"
103622
+ },
103623
+ onStopped: {
103624
+ label: require_sleep.t("Shut down", "Spento"),
103625
+ phrase: require_sleep.t("When {device} shuts down", "Quando {device} si spegne"),
103626
+ icon: "server-off"
103627
+ },
103628
+ onCrashed: {
103629
+ label: require_sleep.t("Went down", "Caduto"),
103630
+ phrase: require_sleep.t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
103631
+ icon: "server-crash"
103632
+ },
103633
+ onRecovered: {
103634
+ label: require_sleep.t("Came online", "Tornato in linea"),
103635
+ phrase: require_sleep.t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
103636
+ icon: "server"
103637
+ }
103638
+ }
103639
+ }
103640
+ } }
103641
+ }
103642
+ };
103643
+ //#endregion
102554
103644
  //#region src/capabilities/zone-analytics.cap.ts
102555
103645
  /**
102556
103646
  * Per-zone occupancy aggregation produced by the analytics frame
@@ -103218,6 +104308,7 @@ var CAPABILITY_NAMES = {
103218
104308
  weather: "weather",
103219
104309
  weatherStation: "weather-station",
103220
104310
  webrtcSession: "webrtc-session",
104311
+ workload: "workload",
103221
104312
  zoneAnalytics: "zone-analytics",
103222
104313
  zoneRules: "zone-rules",
103223
104314
  zones: "zones"
@@ -104052,6 +105143,10 @@ var CAPABILITY_ROUTER_KEYS = [
104052
105143
  key: "webrtcSession",
104053
105144
  name: "webrtc-session"
104054
105145
  },
105146
+ {
105147
+ key: "workload",
105148
+ name: "workload"
105149
+ },
104055
105150
  {
104056
105151
  key: "zoneAnalytics",
104057
105152
  name: "zone-analytics"
@@ -104282,6 +105377,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
104282
105377
  weatherCapability,
104283
105378
  weatherStationCapability,
104284
105379
  webrtcSessionCapability,
105380
+ workloadCapability,
104285
105381
  zoneAnalyticsCapability,
104286
105382
  zoneRulesCapability,
104287
105383
  zonesCapability
@@ -106051,34 +107147,36 @@ function selectNavigationMethods(getStatus, setValue) {
106051
107147
  * Pure duration maths for the `siren` cap, shared by every provider so a
106052
107148
  * trigger and the countdown it publishes mean the same thing everywhere.
106053
107149
  */
107150
+ /** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
107151
+ var MAX_PLAY_CHOICES = 200;
106054
107152
  /** The state of a siren that is not sounding. Keeps the last activation's facts. */
106055
107153
  function sirenIdleStatus(previous) {
106056
107154
  return {
106057
107155
  active: false,
106058
107156
  activeUntil: null,
106059
107157
  durationSeconds: previous?.durationSeconds ?? null,
107158
+ plays: previous?.plays ?? null,
107159
+ activeUntilEstimated: false,
106060
107160
  lastTriggeredAt: previous?.lastTriggeredAt ?? 0
106061
107161
  };
106062
107162
  }
106063
- /** The state right after a timed trigger: sounding until `now + seconds`. */
106064
- function sirenTriggeredStatus(nowMs, seconds) {
107163
+ /**
107164
+ * The state right after a timed trigger: sounding until `now + seconds`. A
107165
+ * trigger asked in plays passes its count, and whether that end is an estimate.
107166
+ */
107167
+ function sirenTriggeredStatus(nowMs, seconds, activation) {
106065
107168
  return {
106066
107169
  active: true,
106067
107170
  activeUntil: nowMs + Math.round(seconds * 1e3),
106068
107171
  durationSeconds: seconds,
107172
+ plays: activation?.plays ?? null,
107173
+ activeUntilEstimated: activation?.estimated ?? false,
106069
107174
  lastTriggeredAt: nowMs
106070
107175
  };
106071
107176
  }
106072
- /**
106073
- * The duration a trigger will really use: the request (or the camera default)
106074
- * snapped to what the camera allows — the nearest listed value, or clamped and
106075
- * stepped inside the range. Never longer or shorter than the camera can play.
106076
- */
106077
- function resolveSirenSeconds(options, requested) {
106078
- const wanted = requested ?? options.defaultSeconds;
106079
- const list = options.allowedSeconds;
107177
+ /** The nearest listed value, or the value clamped and stepped inside the range. */
107178
+ function snap(list, range, wanted) {
106080
107179
  if (list !== null && list.length > 0) return list.reduce((best, candidate) => Math.abs(candidate - wanted) < Math.abs(best - wanted) ? candidate : best);
106081
- const range = options.rangeSeconds;
106082
107180
  if (range !== null) {
106083
107181
  const clamped = Math.min(range.max, Math.max(range.min, wanted));
106084
107182
  const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
@@ -106086,6 +107184,60 @@ function resolveSirenSeconds(options, requested) {
106086
107184
  }
106087
107185
  return wanted;
106088
107186
  }
107187
+ /**
107188
+ * The duration a trigger will really use: the request (or the camera default)
107189
+ * snapped to what the camera allows — the nearest listed value, or clamped and
107190
+ * stepped inside the range. Never longer or shorter than the camera can play.
107191
+ */
107192
+ function resolveSirenSeconds(options, requested) {
107193
+ return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
107194
+ }
107195
+ /**
107196
+ * The play count a trigger will really use, snapped like the seconds; `null`
107197
+ * when the camera declares no plays (it counts seconds).
107198
+ */
107199
+ function resolveSirenPlays(options, requested) {
107200
+ if (options.defaultPlays === null) return null;
107201
+ return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
107202
+ }
107203
+ /** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
107204
+ function sirenPlayChoices(options) {
107205
+ if (options.allowedPlays !== null) return [...options.allowedPlays];
107206
+ const range = options.rangePlays;
107207
+ if (range === null) return [];
107208
+ const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
107209
+ return Array.from({ length: count }, (_, i) => range.min + i * range.step);
107210
+ }
107211
+ /** Whether an end computed through `secondsPerPlay` is an estimate. */
107212
+ function playsEndIsEstimate(options) {
107213
+ return options.source !== SirenOptionsSource.Camera;
107214
+ }
107215
+ /**
107216
+ * Decides a trigger: a count on a siren that declares no plays is refused; a
107217
+ * count is snapped and timed through `secondsPerPlay`; seconds keep the old
107218
+ * snapping. Never both — the input schema refuses that before it gets here.
107219
+ */
107220
+ function planSirenTrigger(options, request) {
107221
+ if (request.plays !== void 0) {
107222
+ const plays = resolveSirenPlays(options, request.plays);
107223
+ if (plays === null) return {
107224
+ asked: "refused",
107225
+ reason: "this siren counts seconds, not plays"
107226
+ };
107227
+ const factor = options.secondsPerPlay;
107228
+ return {
107229
+ asked: "plays",
107230
+ plays,
107231
+ seconds: factor === null ? null : plays * factor,
107232
+ estimated: factor === null || playsEndIsEstimate(options)
107233
+ };
107234
+ }
107235
+ return {
107236
+ asked: "seconds",
107237
+ seconds: resolveSirenSeconds(options, request.durationSeconds),
107238
+ estimated: options.unit === "plays" && playsEndIsEstimate(options)
107239
+ };
107240
+ }
106089
107241
  //#endregion
106090
107242
  //#region src/capabilities/recording-onboard-rules.ts
106091
107243
  /** Minutes in a day. `endMinute === 1440` means "to end of day". */
@@ -109122,6 +110274,444 @@ function runningFollowsSwitch(composition) {
109122
110274
  return read !== null && stored.kind === "from" && stored.cap === read.cap && stored.fieldPath === read.fieldPath && stored.source.addonId === read.source.addonId && stored.source.stableId === read.source.stableId;
109123
110275
  }
109124
110276
  //#endregion
110277
+ //#region src/device/declared-device.ts
110278
+ /** Marker written to a declared integration's `info`. */
110279
+ var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
110280
+ /**
110281
+ * Give a declared integration its instance record, ONCE. The record is read first and left
110282
+ * exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
110283
+ * never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
110284
+ * True when the record was written by this call.
110285
+ */
110286
+ async function seedInstanceOnce(instances, seed) {
110287
+ const existing = await instances.getInstance({ id: seed.id });
110288
+ if (existing !== null && existing !== void 0) return false;
110289
+ await instances.createInstance({
110290
+ id: seed.id,
110291
+ name: seed.name
110292
+ });
110293
+ return true;
110294
+ }
110295
+ /**
110296
+ * Strip the `<node>/<addon>` suffix a forked child carries.
110297
+ *
110298
+ * Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
110299
+ * that was supposed to act — because on the hub it reads `hub/<addon>`.
110300
+ */
110301
+ function declarationOwnerNodeId(localNodeId) {
110302
+ const raw = localNodeId ?? "hub";
110303
+ if (!raw.includes("/")) return raw;
110304
+ return raw.split("/")[0] ?? "hub";
110305
+ }
110306
+ /** Cap on how many rows one withdrawal pass may delete. */
110307
+ var DECLARED_DEVICE_SWEEP_LIMIT = 32;
110308
+ /**
110309
+ * The one way an addon owns a device it declares.
110310
+ *
110311
+ * Construct once with the addon's ports, then call {@link reconcile} on boot and
110312
+ * on every convergence tick. There is no second get-or-create helper — a guard
110313
+ * in `scripts/` enforces that.
110314
+ */
110315
+ var DeclaredDevices = class {
110316
+ ports;
110317
+ constructor(ports) {
110318
+ const addonId = ports.addonId;
110319
+ if (typeof addonId !== "string" || addonId.length === 0) throw new Error(`DeclaredDevices: addonId must be the declaring addon's id, got ${JSON.stringify(addonId)}. On an addon context it is \`ctx.id\` — there is no \`ctx.addonId\`.`);
110320
+ this.ports = ports;
110321
+ }
110322
+ /**
110323
+ * Converge the declared set. Idempotent, and safe to call repeatedly.
110324
+ *
110325
+ * Throws only what the ports throw on the FIRST index read; every other
110326
+ * failure is per-device and logged, so one bad declaration never takes the
110327
+ * others down.
110328
+ */
110329
+ async reconcile(spec) {
110330
+ if ((spec.placement ?? "hub") === "hub") {
110331
+ const nodeId = declarationOwnerNodeId(this.ports.localNodeId);
110332
+ if (nodeId !== "hub") {
110333
+ this.ports.logger.info("declared devices are hub-owned — skipping on this node", { meta: {
110334
+ nodeId,
110335
+ rawNodeId: this.ports.localNodeId ?? null
110336
+ } });
110337
+ return {
110338
+ integrationId: null,
110339
+ devices: [],
110340
+ removed: [],
110341
+ owned: false
110342
+ };
110343
+ }
110344
+ }
110345
+ let integrationId;
110346
+ if (spec.integrationId !== void 0) integrationId = spec.integrationId;
110347
+ else {
110348
+ const own = await this.ensureIntegration(spec.integrationName);
110349
+ integrationId = own.id;
110350
+ await this.seedInstance(own);
110351
+ }
110352
+ const index = await this.readIndex();
110353
+ const live = await this.readLiveByStableId();
110354
+ const outcomes = [];
110355
+ for (const declaration of spec.devices) {
110356
+ const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
110357
+ if (outcome !== null) outcomes.push(outcome);
110358
+ }
110359
+ const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
110360
+ return {
110361
+ integrationId,
110362
+ devices: outcomes,
110363
+ removed,
110364
+ owned: true
110365
+ };
110366
+ }
110367
+ /**
110368
+ * Get-or-create the FIXED integration, and RE-ASSERT the flag every pass.
110369
+ *
110370
+ * The re-assertion is the fix for the defect the hand-rolled version shipped
110371
+ * with: writing `info.fixed` only on the create path left every pre-existing
110372
+ * install without it, and the kernel kept offering to delete an integration
110373
+ * the addon owns.
110374
+ */
110375
+ async ensureIntegration(integrationName) {
110376
+ const existing = await this.ports.getIntegration(this.ports.addonId);
110377
+ if (existing === null) {
110378
+ const created = await this.ports.createIntegration({
110379
+ addonId: this.ports.addonId,
110380
+ name: integrationName,
110381
+ info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
110382
+ });
110383
+ this.ports.logger.info("declared a fixed integration", { meta: {
110384
+ integrationId: created.id,
110385
+ name: integrationName
110386
+ } });
110387
+ return {
110388
+ id: created.id,
110389
+ name: integrationName
110390
+ };
110391
+ }
110392
+ if (existing.info?.["fixed"] !== true) {
110393
+ await this.ports.updateIntegration({
110394
+ id: existing.id,
110395
+ info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
110396
+ });
110397
+ this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
110398
+ }
110399
+ return {
110400
+ id: existing.id,
110401
+ name: existing.name ?? integrationName
110402
+ };
110403
+ }
110404
+ /** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
110405
+ async seedInstance(integration) {
110406
+ const { seedInstance } = this.ports;
110407
+ if (seedInstance === void 0) return;
110408
+ try {
110409
+ await seedInstance({
110410
+ id: integration.id,
110411
+ name: integration.name
110412
+ });
110413
+ } catch (err) {
110414
+ this.ports.logger.warn("could not seed the instance record of a declared integration", {
110415
+ tags: { integrationId: integration.id },
110416
+ meta: { error: require_composed_stable_id.errMsg(err) }
110417
+ });
110418
+ }
110419
+ }
110420
+ async readIndex() {
110421
+ const rows = await this.ports.listOwnDevices();
110422
+ return new Map(rows.map((row) => [row.stableId, row]));
110423
+ }
110424
+ /**
110425
+ * Devices this kernel already has CONSTRUCTED, by stableId.
110426
+ *
110427
+ * Distinct from {@link readIndex}, and the distinction is the bug: the index
110428
+ * is persisted rows, this is live objects. A row without an object must be
110429
+ * adopted; an object must be left exactly as it is.
110430
+ *
110431
+ * Failure is non-fatal and deliberately so — an empty map degrades to the
110432
+ * previous behaviour (attempt the adopt) rather than skipping a device that
110433
+ * genuinely needs bringing up.
110434
+ */
110435
+ async readLiveByStableId() {
110436
+ try {
110437
+ const devices = await this.ports.devices.getAll();
110438
+ return new Map(devices.map((device) => [device.stableId, device]));
110439
+ } catch (err) {
110440
+ this.ports.logger.warn("could not read live devices — falling back to adopt-by-row", { meta: { error: err instanceof Error ? err.message : String(err) } });
110441
+ return /* @__PURE__ */ new Map();
110442
+ }
110443
+ }
110444
+ /**
110445
+ * One declaration: adopt what exists, create what does not.
110446
+ *
110447
+ * The create branch is the destructive one — it seeds `initialMeta`, and
110448
+ * `initialMeta.name` lands as an unconditional `setName`. A transiently empty
110449
+ * index therefore looks exactly like a first boot and would silently re-stamp
110450
+ * the declared name over the operator's rename. D49: that branch needs a
110451
+ * second read to agree.
110452
+ */
110453
+ async applyDeclaration(declaration, integrationId, index, live) {
110454
+ try {
110455
+ const alreadyLive = live.get(declaration.stableId);
110456
+ if (alreadyLive !== void 0) return {
110457
+ stableId: declaration.stableId,
110458
+ deviceId: alreadyLive.id,
110459
+ device: alreadyLive,
110460
+ created: false
110461
+ };
110462
+ let existing = index.get(declaration.stableId);
110463
+ if (existing === void 0) {
110464
+ existing = (await this.readIndex()).get(declaration.stableId);
110465
+ if (existing !== void 0) this.ports.logger.warn("device index disagreed with itself — adopting instead of re-creating", {
110466
+ tags: { deviceId: existing.id },
110467
+ meta: {
110468
+ stableId: declaration.stableId,
110469
+ addonId: this.ports.addonId
110470
+ }
110471
+ });
110472
+ }
110473
+ if (existing !== void 0) {
110474
+ const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, {}, null, void 0);
110475
+ this.ports.logger.info("declared device adopted", {
110476
+ tags: { deviceId: device.id },
110477
+ meta: {
110478
+ stableId: declaration.stableId,
110479
+ integrationId
110480
+ }
110481
+ });
110482
+ return {
110483
+ stableId: declaration.stableId,
110484
+ deviceId: device.id,
110485
+ device,
110486
+ created: false
110487
+ };
110488
+ }
110489
+ const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, declaration.config ?? {}, null, {
110490
+ type: declaration.type,
110491
+ name: declaration.name,
110492
+ integrationId,
110493
+ ...declaration.role === void 0 ? {} : { role: declaration.role }
110494
+ });
110495
+ this.ports.logger.info("declared device created", {
110496
+ tags: { deviceId: device.id },
110497
+ meta: {
110498
+ stableId: declaration.stableId,
110499
+ integrationId
110500
+ }
110501
+ });
110502
+ return {
110503
+ stableId: declaration.stableId,
110504
+ deviceId: device.id,
110505
+ device,
110506
+ created: true
110507
+ };
110508
+ } catch (err) {
110509
+ this.ports.logger.warn("a declared device could not be brought up", { meta: {
110510
+ stableId: declaration.stableId,
110511
+ error: err instanceof Error ? err.message : String(err)
110512
+ } });
110513
+ return null;
110514
+ }
110515
+ }
110516
+ /**
110517
+ * Remove rows under the addon's FIXED integration whose declaration is gone.
110518
+ *
110519
+ * Bounded to that integration: a declared integration has no operator
110520
+ * add-flow, so every row under it got there by declaration. Devices this
110521
+ * addon owns OUTSIDE it (a provider's adopted devices) are never candidates.
110522
+ *
110523
+ * Bounded in count, and every deletion is logged with its `deviceId` — a
110524
+ * withdrawal that removes an operator-visible row silently is the failure
110525
+ * mode, not the removal itself.
110526
+ */
110527
+ async sweepWithdrawn(declarations, integrationId, index) {
110528
+ const declared = new Set(declarations.map((d) => d.stableId));
110529
+ const candidates = [...index.values()].filter((row) => row.integrationId === integrationId && !declared.has(row.stableId));
110530
+ if (candidates.length === 0) return [];
110531
+ if (candidates.length > 32) {
110532
+ this.ports.logger.warn("withdrawal sweep exceeded its bound — removing nothing", { meta: {
110533
+ integrationId,
110534
+ candidates: candidates.length,
110535
+ bound: 32
110536
+ } });
110537
+ return [];
110538
+ }
110539
+ const removed = [];
110540
+ for (const row of candidates) try {
110541
+ await this.ports.devices.remove(row.id);
110542
+ removed.push(row.id);
110543
+ this.ports.logger.info("declared device removed — its declaration was withdrawn", {
110544
+ tags: { deviceId: row.id },
110545
+ meta: {
110546
+ stableId: row.stableId,
110547
+ integrationId
110548
+ }
110549
+ });
110550
+ } catch (err) {
110551
+ this.ports.logger.warn("a withdrawn declared device could not be removed", {
110552
+ tags: { deviceId: row.id },
110553
+ meta: {
110554
+ stableId: row.stableId,
110555
+ error: err instanceof Error ? err.message : String(err)
110556
+ }
110557
+ });
110558
+ }
110559
+ return removed;
110560
+ }
110561
+ };
110562
+ //#endregion
110563
+ //#region src/composition/engine-hosted-blocks.ts
110564
+ function isSpecOfKind(spec, kind) {
110565
+ return spec !== void 0 && spec.kind === kind;
110566
+ }
110567
+ /**
110568
+ * The blocks of `kind` whose composer row exists. A block whose row the
110569
+ * composer has not declared yet is left out: nothing can be hosted on it until
110570
+ * its next apply, and the next pass picks it up.
110571
+ */
110572
+ function selectEngineHostedBlocks(kind, compositions, composerRows) {
110573
+ if (compositions.state === "not-loaded") return {
110574
+ kind: "untrusted",
110575
+ reason: compositions.reason
110576
+ };
110577
+ const rowByStableId = new Map(composerRows.map((row) => [row.stableId, row]));
110578
+ const blocks = [];
110579
+ for (const view of compositions.views) {
110580
+ const block = view.block;
110581
+ const composition = block.source?.kind === "composition" ? block.source.composition : null;
110582
+ if (composition === null) continue;
110583
+ const spec = composition.helper;
110584
+ if (!isSpecOfKind(spec, kind)) continue;
110585
+ const stableId = `${require_composed_stable_id.COMPOSED_DEVICE_STABLE_ID_PREFIX}${block.id}`;
110586
+ const row = rowByStableId.get(stableId);
110587
+ if (row === void 0) continue;
110588
+ blocks.push({
110589
+ blockId: block.id,
110590
+ deviceId: row.id,
110591
+ stableId,
110592
+ name: block.name,
110593
+ enabled: block.enabled,
110594
+ updatedAt: block.updatedAt,
110595
+ composition,
110596
+ spec
110597
+ });
110598
+ }
110599
+ return {
110600
+ kind: "trusted",
110601
+ blocks
110602
+ };
110603
+ }
110604
+ var WITHDRAWAL_CONFIRMATIONS = 2;
110605
+ /**
110606
+ * D49 for an engine's hosted set: a block missing from ONE trusted read is
110607
+ * kept; a second consecutive trusted read that agrees withdraws it. An
110608
+ * untrusted read is never fed here, so it neither counts nor resets.
110609
+ */
110610
+ var HostedWithdrawalGate = class {
110611
+ misses = /* @__PURE__ */ new Map();
110612
+ /**
110613
+ * `hosted`: what the engine serves now; `present`: what this trusted read
110614
+ * names. Returns the ids to withdraw now, and the ids kept on a first miss.
110615
+ */
110616
+ judge(hosted, present) {
110617
+ const withdraw = [];
110618
+ const held = [];
110619
+ const misses = /* @__PURE__ */ new Map();
110620
+ for (const id of hosted) {
110621
+ if (present.has(id)) continue;
110622
+ const count = (this.misses.get(id) ?? 0) + 1;
110623
+ if (count < WITHDRAWAL_CONFIRMATIONS) {
110624
+ held.push(id);
110625
+ misses.set(id, count);
110626
+ } else withdraw.push(id);
110627
+ }
110628
+ this.misses = misses;
110629
+ return {
110630
+ withdraw,
110631
+ held
110632
+ };
110633
+ }
110634
+ };
110635
+ /**
110636
+ * Build `DeviceClass` on the composer's row `(stableId, id)`. The context is
110637
+ * `loadContext` (D677: a caller that BUILDS a device hydrates its stored
110638
+ * runtime state first); a kernel without it is refused by name rather than
110639
+ * building on an empty state. The device is never `register`ed and its config
110640
+ * never persisted: the row, its name and its lifetime are the composer's.
110641
+ */
110642
+ async function hostEngineDevice(devices, row, config, DeviceClass) {
110643
+ if (devices.loadContext === void 0) throw new Error(`this kernel cannot build a device on a row it does not own (no loadContext) — device ${String(row.id)} is not hosted`);
110644
+ const base = await devices.loadContext(row.stableId, row.id, null, config);
110645
+ const registered = [];
110646
+ const device = new DeviceClass({
110647
+ ...base,
110648
+ registerNativeCap: (cap, provider) => {
110649
+ base.registerNativeCap(cap, provider);
110650
+ registered.push(cap.name);
110651
+ }
110652
+ });
110653
+ return {
110654
+ device,
110655
+ withdraw: async () => {
110656
+ await device.removeDevice();
110657
+ for (const capName of registered) base.unregisterNativeCap?.(capName);
110658
+ }
110659
+ };
110660
+ }
110661
+ /**
110662
+ * Whether an engine may stop sweeping: only once a pass found no old row left.
110663
+ * `none` is not done — a registry that has not answered the integration yet
110664
+ * reads as null too, and the sweep is one indexed read per pass.
110665
+ */
110666
+ function legacySweepDone(sweep) {
110667
+ return sweep.kind === "swept" && sweep.drained;
110668
+ }
110669
+ /**
110670
+ * The legacy rows, one bounded batch at a time: only the rows under the old
110671
+ * integration, ordered by id, at most `DECLARED_DEVICE_SWEEP_LIMIT` — a large
110672
+ * leftover set drains over passes instead of being refused whole by the
110673
+ * sweep's own bound.
110674
+ */
110675
+ function legacyEngineRowsIndex(rows, integrationId) {
110676
+ return rows.filter((row) => row.integrationId === integrationId).toSorted((left, right) => left.id - right.id).slice(0, 32);
110677
+ }
110678
+ /**
110679
+ * Remove every camera row an engine declared itself before its cameras were
110680
+ * blocks, unconditionally, through the declared sweep (`removeDevice` →
110681
+ * tombstone, D865). No integration means nothing was ever declared, and
110682
+ * nothing is minted to find out. A failed read throws: the caller retries.
110683
+ */
110684
+ async function sweepLegacyEngineRows(ports, integrationName) {
110685
+ const integration = await ports.getIntegration(ports.addonId);
110686
+ if (integration === null) return { kind: "none" };
110687
+ let found = 0;
110688
+ return {
110689
+ kind: "swept",
110690
+ removed: (await new DeclaredDevices({
110691
+ logger: ports.logger,
110692
+ addonId: ports.addonId,
110693
+ devices: ports.devices,
110694
+ localNodeId: ports.localNodeId,
110695
+ getIntegration: async () => integration,
110696
+ createIntegration: async () => {
110697
+ throw new Error(`${ports.addonId}: the legacy sweep never mints an integration`);
110698
+ },
110699
+ updateIntegration: async () => void 0,
110700
+ listOwnDevices: async () => {
110701
+ const index = legacyEngineRowsIndex(await ports.listAddonRows(ports.addonId), integration.id);
110702
+ found = index.length;
110703
+ return index;
110704
+ }
110705
+ }).reconcile({
110706
+ integrationName,
110707
+ integrationId: integration.id,
110708
+ placement: "hub",
110709
+ devices: []
110710
+ })).removed,
110711
+ drained: found === 0
110712
+ };
110713
+ }
110714
+ //#endregion
109125
110715
  //#region src/composition/composition-link-kinds.ts
109126
110716
  /**
109127
110717
  * Every link a device keeps in its STORED composition that a surface must
@@ -111920,11 +113510,67 @@ var DEVICE_LOCAL_STATE_CAPS = {
111920
113510
  waterHeater: waterHeaterCapability,
111921
113511
  weather: weatherCapability,
111922
113512
  weatherStation: weatherStationCapability,
113513
+ workload: workloadCapability,
111923
113514
  zoneAnalytics: zoneAnalyticsCapability,
111924
113515
  zoneRules: zoneRulesCapability,
111925
113516
  zones: zonesCapability
111926
113517
  };
111927
113518
  //#endregion
113519
+ //#region src/device/declare-identifiers.ts
113520
+ /**
113521
+ * Normalise `raw` and declare it: every kind it carries replaces the stored one,
113522
+ * every kind it lacks is removed, except the kinds in `options.unread` (a failed
113523
+ * read keeps what was stored) — pass everything the provider read in one call.
113524
+ */
113525
+ async function declareDeviceIdentifiers(deps, raw, options = {}) {
113526
+ const { deviceId, logger, writer } = deps;
113527
+ const { unread, ...normaliseOptions } = options;
113528
+ const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
113529
+ for (const r of rejected) logger.warn("identifier refused — not declared", {
113530
+ tags: { deviceId },
113531
+ meta: {
113532
+ key: r.key,
113533
+ value: r.value,
113534
+ reason: r.reason
113535
+ }
113536
+ });
113537
+ const unreadKinds = new Set(unread ?? []);
113538
+ if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
113539
+ logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
113540
+ return {
113541
+ outcome: "nothing-to-declare",
113542
+ identifiers
113543
+ };
113544
+ }
113545
+ if (writer === void 0) {
113546
+ logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
113547
+ return {
113548
+ outcome: "unavailable",
113549
+ identifiers
113550
+ };
113551
+ }
113552
+ try {
113553
+ await writer.mutate({
113554
+ deviceId,
113555
+ identifiers,
113556
+ ...unread !== void 0 && unread.length > 0 ? { unread } : {}
113557
+ });
113558
+ return {
113559
+ outcome: "declared",
113560
+ identifiers
113561
+ };
113562
+ } catch (err) {
113563
+ logger.warn("identifiers not declared — setIdentifiers failed", {
113564
+ tags: { deviceId },
113565
+ meta: { error: require_composed_stable_id.errMsg(err) }
113566
+ });
113567
+ return {
113568
+ outcome: "failed",
113569
+ identifiers
113570
+ };
113571
+ }
113572
+ }
113573
+ //#endregion
111928
113574
  //#region src/device/device-error-episode.ts
111929
113575
  /**
111930
113576
  * The edge between two readings, or `null` for no edge.
@@ -111980,6 +113626,8 @@ var BaseDevice = class {
111980
113626
  id;
111981
113627
  stableId;
111982
113628
  type;
113629
+ /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
113630
+ statusIsExternal;
111983
113631
  name;
111984
113632
  parentDeviceId;
111985
113633
  role;
@@ -112128,21 +113776,26 @@ var BaseDevice = class {
112128
113776
  };
112129
113777
  this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
112130
113778
  ctx.bindRuntimeState?.(this.runtimeState);
112131
- ctx.registerNativeCap?.(deviceStatusCapability, {});
112132
- const seed = {
112133
- online: true,
112134
- lastChangedAt: Date.now()
112135
- };
112136
- this.runtimeState.setCapState("device-status", seed);
112137
- ctx.registerNativeCap?.(featureProbeCapability, {});
112138
- this.runtimeState.setCapState("feature-probe", {
112139
- flags: {},
112140
- deviceType: null,
112141
- model: null,
112142
- channelCount: null,
112143
- lastProbedAt: 0,
112144
- lastFetchedAt: 0
112145
- });
113779
+ this.statusIsExternal = options.deviceStatus === "external";
113780
+ if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
113781
+ if (!this.statusIsExternal) {
113782
+ const seed = {
113783
+ online: true,
113784
+ lastChangedAt: Date.now()
113785
+ };
113786
+ this.runtimeState.setCapState("device-status", seed);
113787
+ }
113788
+ if (!this.statusIsExternal) {
113789
+ ctx.registerNativeCap?.(featureProbeCapability, {});
113790
+ this.runtimeState.setCapState("feature-probe", {
113791
+ flags: {},
113792
+ deviceType: null,
113793
+ model: null,
113794
+ channelCount: null,
113795
+ lastProbedAt: 0,
113796
+ lastFetchedAt: 0
113797
+ });
113798
+ }
112146
113799
  }
112147
113800
  deviceActions = /* @__PURE__ */ new Map();
112148
113801
  /** Declare a device custom action + its typed handler. Idempotent per name. */
@@ -112170,7 +113823,7 @@ var BaseDevice = class {
112170
113823
  * override to gate side effects on the transition.
112171
113824
  */
112172
113825
  markOnline(online) {
112173
- if (this.online === online) return;
113826
+ if (this.statusIsExternal || this.online === online) return;
112174
113827
  const next = {
112175
113828
  online,
112176
113829
  lastChangedAt: Date.now()
@@ -112240,6 +113893,24 @@ var BaseDevice = class {
112240
113893
  }));
112241
113894
  }
112242
113895
  /**
113896
+ * Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
113897
+ * machine uuid, hostname, IP — what a later step matches across integrations.
113898
+ * Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
113899
+ * writes the result through `device-manager.setIdentifiers`, which accepts it
113900
+ * only from the provider that owns this device. Each kind it carries replaces
113901
+ * the stored one and each kind it lacks is removed — except the kinds listed in
113902
+ * `options.unread` (reads that FAILED), which keep their stored value. Pass
113903
+ * everything read in one call; a call where every kind is unread writes
113904
+ * nothing. Best-effort: never throws.
113905
+ */
113906
+ async declareIdentifiers(raw, options) {
113907
+ return declareDeviceIdentifiers({
113908
+ deviceId: this.id,
113909
+ logger: this.ctx.logger,
113910
+ writer: this.ctx.api.deviceManager?.setIdentifiers
113911
+ }, raw, options);
113912
+ }
113913
+ /**
112243
113914
  * Re-publish the device's current `features` array to the persisted
112244
113915
  * meta blob. Drivers call this after a probe finishes when the live
112245
113916
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -112444,6 +114115,7 @@ var BaseDevice = class {
112444
114115
  * `lastProbedAt`) once their probe actually succeeds.
112445
114116
  */
112446
114117
  async onProbe() {
114118
+ if (this.statusIsExternal) return;
112447
114119
  const base = this.runtimeState.getCapState("feature-probe") ?? {
112448
114120
  flags: {},
112449
114121
  deviceType: null,
@@ -113654,292 +115326,6 @@ function legacyAutoLinkIds(params) {
113654
115326
  return [...ids];
113655
115327
  }
113656
115328
  //#endregion
113657
- //#region src/device/declared-device.ts
113658
- /** Marker written to a declared integration's `info`. */
113659
- var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
113660
- /**
113661
- * Give a declared integration its instance record, ONCE. The record is read first and left
113662
- * exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
113663
- * never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
113664
- * True when the record was written by this call.
113665
- */
113666
- async function seedInstanceOnce(instances, seed) {
113667
- const existing = await instances.getInstance({ id: seed.id });
113668
- if (existing !== null && existing !== void 0) return false;
113669
- await instances.createInstance({
113670
- id: seed.id,
113671
- name: seed.name
113672
- });
113673
- return true;
113674
- }
113675
- /**
113676
- * Strip the `<node>/<addon>` suffix a forked child carries.
113677
- *
113678
- * Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
113679
- * that was supposed to act — because on the hub it reads `hub/<addon>`.
113680
- */
113681
- function declarationOwnerNodeId(localNodeId) {
113682
- const raw = localNodeId ?? "hub";
113683
- if (!raw.includes("/")) return raw;
113684
- return raw.split("/")[0] ?? "hub";
113685
- }
113686
- /** Cap on how many rows one withdrawal pass may delete. */
113687
- var DECLARED_DEVICE_SWEEP_LIMIT = 32;
113688
- /**
113689
- * The one way an addon owns a device it declares.
113690
- *
113691
- * Construct once with the addon's ports, then call {@link reconcile} on boot and
113692
- * on every convergence tick. There is no second get-or-create helper — a guard
113693
- * in `scripts/` enforces that.
113694
- */
113695
- var DeclaredDevices = class {
113696
- ports;
113697
- constructor(ports) {
113698
- const addonId = ports.addonId;
113699
- if (typeof addonId !== "string" || addonId.length === 0) throw new Error(`DeclaredDevices: addonId must be the declaring addon's id, got ${JSON.stringify(addonId)}. On an addon context it is \`ctx.id\` — there is no \`ctx.addonId\`.`);
113700
- this.ports = ports;
113701
- }
113702
- /**
113703
- * Converge the declared set. Idempotent, and safe to call repeatedly.
113704
- *
113705
- * Throws only what the ports throw on the FIRST index read; every other
113706
- * failure is per-device and logged, so one bad declaration never takes the
113707
- * others down.
113708
- */
113709
- async reconcile(spec) {
113710
- if ((spec.placement ?? "hub") === "hub") {
113711
- const nodeId = declarationOwnerNodeId(this.ports.localNodeId);
113712
- if (nodeId !== "hub") {
113713
- this.ports.logger.info("declared devices are hub-owned — skipping on this node", { meta: {
113714
- nodeId,
113715
- rawNodeId: this.ports.localNodeId ?? null
113716
- } });
113717
- return {
113718
- integrationId: null,
113719
- devices: [],
113720
- removed: [],
113721
- owned: false
113722
- };
113723
- }
113724
- }
113725
- let integrationId;
113726
- if (spec.integrationId !== void 0) integrationId = spec.integrationId;
113727
- else {
113728
- const own = await this.ensureIntegration(spec.integrationName);
113729
- integrationId = own.id;
113730
- await this.seedInstance(own);
113731
- }
113732
- const index = await this.readIndex();
113733
- const live = await this.readLiveByStableId();
113734
- const outcomes = [];
113735
- for (const declaration of spec.devices) {
113736
- const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
113737
- if (outcome !== null) outcomes.push(outcome);
113738
- }
113739
- const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
113740
- return {
113741
- integrationId,
113742
- devices: outcomes,
113743
- removed,
113744
- owned: true
113745
- };
113746
- }
113747
- /**
113748
- * Get-or-create the FIXED integration, and RE-ASSERT the flag every pass.
113749
- *
113750
- * The re-assertion is the fix for the defect the hand-rolled version shipped
113751
- * with: writing `info.fixed` only on the create path left every pre-existing
113752
- * install without it, and the kernel kept offering to delete an integration
113753
- * the addon owns.
113754
- */
113755
- async ensureIntegration(integrationName) {
113756
- const existing = await this.ports.getIntegration(this.ports.addonId);
113757
- if (existing === null) {
113758
- const created = await this.ports.createIntegration({
113759
- addonId: this.ports.addonId,
113760
- name: integrationName,
113761
- info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
113762
- });
113763
- this.ports.logger.info("declared a fixed integration", { meta: {
113764
- integrationId: created.id,
113765
- name: integrationName
113766
- } });
113767
- return {
113768
- id: created.id,
113769
- name: integrationName
113770
- };
113771
- }
113772
- if (existing.info?.["fixed"] !== true) {
113773
- await this.ports.updateIntegration({
113774
- id: existing.id,
113775
- info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
113776
- });
113777
- this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
113778
- }
113779
- return {
113780
- id: existing.id,
113781
- name: existing.name ?? integrationName
113782
- };
113783
- }
113784
- /** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
113785
- async seedInstance(integration) {
113786
- const { seedInstance } = this.ports;
113787
- if (seedInstance === void 0) return;
113788
- try {
113789
- await seedInstance({
113790
- id: integration.id,
113791
- name: integration.name
113792
- });
113793
- } catch (err) {
113794
- this.ports.logger.warn("could not seed the instance record of a declared integration", {
113795
- tags: { integrationId: integration.id },
113796
- meta: { error: require_composed_stable_id.errMsg(err) }
113797
- });
113798
- }
113799
- }
113800
- async readIndex() {
113801
- const rows = await this.ports.listOwnDevices();
113802
- return new Map(rows.map((row) => [row.stableId, row]));
113803
- }
113804
- /**
113805
- * Devices this kernel already has CONSTRUCTED, by stableId.
113806
- *
113807
- * Distinct from {@link readIndex}, and the distinction is the bug: the index
113808
- * is persisted rows, this is live objects. A row without an object must be
113809
- * adopted; an object must be left exactly as it is.
113810
- *
113811
- * Failure is non-fatal and deliberately so — an empty map degrades to the
113812
- * previous behaviour (attempt the adopt) rather than skipping a device that
113813
- * genuinely needs bringing up.
113814
- */
113815
- async readLiveByStableId() {
113816
- try {
113817
- const devices = await this.ports.devices.getAll();
113818
- return new Map(devices.map((device) => [device.stableId, device]));
113819
- } catch (err) {
113820
- this.ports.logger.warn("could not read live devices — falling back to adopt-by-row", { meta: { error: err instanceof Error ? err.message : String(err) } });
113821
- return /* @__PURE__ */ new Map();
113822
- }
113823
- }
113824
- /**
113825
- * One declaration: adopt what exists, create what does not.
113826
- *
113827
- * The create branch is the destructive one — it seeds `initialMeta`, and
113828
- * `initialMeta.name` lands as an unconditional `setName`. A transiently empty
113829
- * index therefore looks exactly like a first boot and would silently re-stamp
113830
- * the declared name over the operator's rename. D49: that branch needs a
113831
- * second read to agree.
113832
- */
113833
- async applyDeclaration(declaration, integrationId, index, live) {
113834
- try {
113835
- const alreadyLive = live.get(declaration.stableId);
113836
- if (alreadyLive !== void 0) return {
113837
- stableId: declaration.stableId,
113838
- deviceId: alreadyLive.id,
113839
- device: alreadyLive,
113840
- created: false
113841
- };
113842
- let existing = index.get(declaration.stableId);
113843
- if (existing === void 0) {
113844
- existing = (await this.readIndex()).get(declaration.stableId);
113845
- if (existing !== void 0) this.ports.logger.warn("device index disagreed with itself — adopting instead of re-creating", {
113846
- tags: { deviceId: existing.id },
113847
- meta: {
113848
- stableId: declaration.stableId,
113849
- addonId: this.ports.addonId
113850
- }
113851
- });
113852
- }
113853
- if (existing !== void 0) {
113854
- const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, {}, null, void 0);
113855
- this.ports.logger.info("declared device adopted", {
113856
- tags: { deviceId: device.id },
113857
- meta: {
113858
- stableId: declaration.stableId,
113859
- integrationId
113860
- }
113861
- });
113862
- return {
113863
- stableId: declaration.stableId,
113864
- deviceId: device.id,
113865
- device,
113866
- created: false
113867
- };
113868
- }
113869
- const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, declaration.config ?? {}, null, {
113870
- type: declaration.type,
113871
- name: declaration.name,
113872
- integrationId,
113873
- ...declaration.role === void 0 ? {} : { role: declaration.role }
113874
- });
113875
- this.ports.logger.info("declared device created", {
113876
- tags: { deviceId: device.id },
113877
- meta: {
113878
- stableId: declaration.stableId,
113879
- integrationId
113880
- }
113881
- });
113882
- return {
113883
- stableId: declaration.stableId,
113884
- deviceId: device.id,
113885
- device,
113886
- created: true
113887
- };
113888
- } catch (err) {
113889
- this.ports.logger.warn("a declared device could not be brought up", { meta: {
113890
- stableId: declaration.stableId,
113891
- error: err instanceof Error ? err.message : String(err)
113892
- } });
113893
- return null;
113894
- }
113895
- }
113896
- /**
113897
- * Remove rows under the addon's FIXED integration whose declaration is gone.
113898
- *
113899
- * Bounded to that integration: a declared integration has no operator
113900
- * add-flow, so every row under it got there by declaration. Devices this
113901
- * addon owns OUTSIDE it (a provider's adopted devices) are never candidates.
113902
- *
113903
- * Bounded in count, and every deletion is logged with its `deviceId` — a
113904
- * withdrawal that removes an operator-visible row silently is the failure
113905
- * mode, not the removal itself.
113906
- */
113907
- async sweepWithdrawn(declarations, integrationId, index) {
113908
- const declared = new Set(declarations.map((d) => d.stableId));
113909
- const candidates = [...index.values()].filter((row) => row.integrationId === integrationId && !declared.has(row.stableId));
113910
- if (candidates.length === 0) return [];
113911
- if (candidates.length > 32) {
113912
- this.ports.logger.warn("withdrawal sweep exceeded its bound — removing nothing", { meta: {
113913
- integrationId,
113914
- candidates: candidates.length,
113915
- bound: 32
113916
- } });
113917
- return [];
113918
- }
113919
- const removed = [];
113920
- for (const row of candidates) try {
113921
- await this.ports.devices.remove(row.id);
113922
- removed.push(row.id);
113923
- this.ports.logger.info("declared device removed — its declaration was withdrawn", {
113924
- tags: { deviceId: row.id },
113925
- meta: {
113926
- stableId: row.stableId,
113927
- integrationId
113928
- }
113929
- });
113930
- } catch (err) {
113931
- this.ports.logger.warn("a withdrawn declared device could not be removed", {
113932
- tags: { deviceId: row.id },
113933
- meta: {
113934
- stableId: row.stableId,
113935
- error: err instanceof Error ? err.message : String(err)
113936
- }
113937
- });
113938
- }
113939
- return removed;
113940
- }
113941
- };
113942
- //#endregion
113943
115329
  //#region src/device/block-declared-devices.ts
113944
115330
  /**
113945
115331
  * Helper for core-block scripts that declare devices on the shared Blocks
@@ -114109,6 +115495,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
114109
115495
  [require_composed_stable_id.DeviceType.WaterHeater]: "water-heater",
114110
115496
  [require_composed_stable_id.DeviceType.HeatPump]: "dummy",
114111
115497
  [require_composed_stable_id.DeviceType.EnergySystem]: "energy-system",
115498
+ [require_composed_stable_id.DeviceType.Workload]: "workload",
114112
115499
  [require_composed_stable_id.DeviceType.Camera]: "dummy",
114113
115500
  [require_composed_stable_id.DeviceType.Switch]: "switch",
114114
115501
  [require_composed_stable_id.DeviceType.Siren]: "switch",
@@ -116525,10 +117912,12 @@ function durationText(seconds) {
116525
117912
  const text = `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")}`;
116526
117913
  return require_sleep.t(text, text);
116527
117914
  }
116528
- var switchContribution = contribution("switch", SwitchStatusSchema, (slice) => {
117915
+ var switchContribution = contribution("switch", SwitchStatusSchema, (slice, ctx) => {
116529
117916
  const on = slice?.on ?? null;
117917
+ const state = reading("switch", on === null ? "unknown" : on ? "on" : "off");
117918
+ if (ctx.switchOptions?.supportsSetState === false) return { reading: state };
116530
117919
  return {
116531
- reading: reading("switch", on === null ? "unknown" : on ? "on" : "off"),
117920
+ reading: state,
116532
117921
  ownPower: {
116533
117922
  source: "switch",
116534
117923
  on,
@@ -116738,14 +118127,17 @@ var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slic
116738
118127
  tiles: armed
116739
118128
  };
116740
118129
  });
116741
- var powerSourceContribution = contribution("power-source", PowerSourceStateSchema, (slice, ctx) => ({ powerSupply: {
116742
- on: slice?.switchOn ?? null,
116743
- confirmOffWhileRunning: ctx.running === true,
116744
- running: ctx.running ?? null,
116745
- powerOn: action("power-supply.on", require_sleep.t("Power on", "Alimenta"), "plug", "power-source", "powerOn"),
116746
- powerOff: action("power-supply.off", require_sleep.t("Power off", "Togli alimentazione"), "plug-zap", "power-source", "powerOff", {}, "normal", "off-while-running"),
116747
- restart: action("power-supply.restart", require_sleep.t("Restart", "Riavvia"), "rotate-cw", "power-source", "forceRestart")
116748
- } }));
118130
+ var powerSourceContribution = contribution("power-source", PowerSourceStateSchema, (slice, ctx) => {
118131
+ const settable = ctx.powerSupplySettable !== false;
118132
+ return { powerSupply: {
118133
+ on: slice?.switchOn ?? null,
118134
+ confirmOffWhileRunning: ctx.running === true,
118135
+ running: ctx.running ?? null,
118136
+ powerOn: settable ? action("power-supply.on", require_sleep.t("Power on", "Alimenta"), "plug", "power-source", "powerOn") : null,
118137
+ powerOff: settable ? action("power-supply.off", require_sleep.t("Power off", "Togli alimentazione"), "plug-zap", "power-source", "powerOff", {}, "normal", "off-while-running") : null,
118138
+ restart: action("power-supply.restart", require_sleep.t("Restart", "Riavvia"), "rotate-cw", "power-source", "forceRestart")
118139
+ } };
118140
+ });
116749
118141
  /** The remote cap has no status: the model's input carries how many commands it holds. */
116750
118142
  var remoteContribution = {
116751
118143
  cap: "remote",
@@ -117164,6 +118556,7 @@ var HERO_LAYOUT_BY_TYPE = {
117164
118556
  [require_composed_stable_id.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
117165
118557
  [require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LAYOUT,
117166
118558
  [require_composed_stable_id.DeviceType.EnergySystem]: HERO_LAYOUT_DEFAULT,
118559
+ [require_composed_stable_id.DeviceType.Workload]: HERO_LAYOUT_DEFAULT,
117167
118560
  [require_composed_stable_id.DeviceType.Fan]: FAN_LAYOUT,
117168
118561
  [require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
117169
118562
  [require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LAYOUT,
@@ -117890,6 +119283,7 @@ var HERO_LOOK_BY_TYPE = {
117890
119283
  [require_composed_stable_id.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
117891
119284
  [require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LOOK,
117892
119285
  [require_composed_stable_id.DeviceType.EnergySystem]: HERO_LOOK_DEFAULT,
119286
+ [require_composed_stable_id.DeviceType.Workload]: HERO_LOOK_DEFAULT,
117893
119287
  [require_composed_stable_id.DeviceType.Fan]: FAN_LOOK,
117894
119288
  [require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
117895
119289
  [require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LOOK,
@@ -117932,6 +119326,7 @@ var HERO_LOOK_BY_ROLE = {
117932
119326
  [require_composed_stable_id.DeviceRole.SwitchHeater]: HEATER_LOOK,
117933
119327
  [require_composed_stable_id.DeviceRole.SwitchFan]: FAN_LOOK,
117934
119328
  [require_composed_stable_id.DeviceRole.SwitchLight]: LIGHT_LOOK,
119329
+ [require_composed_stable_id.DeviceRole.PoePort]: "inherit",
117935
119330
  [require_composed_stable_id.DeviceRole.ClimateAc]: "inherit",
117936
119331
  [require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
117937
119332
  [require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
@@ -117976,7 +119371,12 @@ var HERO_LOOK_BY_ROLE = {
117976
119371
  [require_composed_stable_id.DeviceRole.MessagingNotifier]: "inherit",
117977
119372
  [require_composed_stable_id.DeviceRole.EmailNotifier]: "inherit",
117978
119373
  [require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
117979
- [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
119374
+ [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit",
119375
+ [require_composed_stable_id.DeviceRole.Vm]: "inherit",
119376
+ [require_composed_stable_id.DeviceRole.AppContainer]: "inherit",
119377
+ [require_composed_stable_id.DeviceRole.Lxc]: "inherit",
119378
+ [require_composed_stable_id.DeviceRole.App]: "inherit",
119379
+ [require_composed_stable_id.DeviceRole.Host]: "inherit"
117980
119380
  };
117981
119381
  function isDeviceType$1(type) {
117982
119382
  return Object.values(require_composed_stable_id.DeviceType).includes(type);
@@ -118023,16 +119423,6 @@ function resolveOwnPower(offers) {
118023
119423
  }
118024
119424
  //#endregion
118025
119425
  //#region src/device/hero/build-hero-model.ts
118026
- /**
118027
- * `buildHeroModel` — the ONE pure function behind every device hero (D1023).
118028
- * The admin device page, the admin quick-detail dialog and the viewer's device
118029
- * screen all draw what it returns; none of them decides anything.
118030
- *
118031
- * Inputs are the device, the caps it is bound to (`getBindings`, per device —
118032
- * never the global cap list, D12), its features and one raw slice per cap. A
118033
- * slice that is missing or does not parse is "not answered": unknown is never
118034
- * off (D315/D393), a heater whose switch has not reported renders `unknown`.
118035
- */
118036
119426
  /** The first source with a known answer wins. */
118037
119427
  var STATE_SOURCE_ORDER = [
118038
119428
  "media-player",
@@ -118198,7 +119588,9 @@ function buildHeroModel(input) {
118198
119588
  running: runningOf(input),
118199
119589
  remoteCommands: input.remoteCommands,
118200
119590
  caps: input.caps,
118201
- quantity: device.quantity ?? null
119591
+ quantity: device.quantity ?? null,
119592
+ ...input.switchOptions !== void 0 ? { switchOptions: input.switchOptions } : {},
119593
+ ...input.powerSupplySettable !== void 0 ? { powerSupplySettable: input.powerSupplySettable } : {}
118202
119594
  };
118203
119595
  const contributed = HERO_CAP_CONTRIBUTIONS.filter((c) => input.caps.includes(c.cap)).map((c) => ({
118204
119596
  cap: c.cap,
@@ -118403,6 +119795,7 @@ var HERO_CAP_COVERAGE = {
118403
119795
  weather: "contributes",
118404
119796
  "weather-station": "contributes",
118405
119797
  "webrtc-session": { none: NOT_A_HERO_FACT },
119798
+ workload: { none: "drawn by the workload device card (state, the controls getOptions declares, resources), which replaces the hero on the device page; its on / off is the switch its power hint registers" },
118406
119799
  "zone-analytics": { none: NOT_A_HERO_FACT },
118407
119800
  "zone-rules": { none: NOT_A_HERO_FACT },
118408
119801
  zones: { none: NOT_A_HERO_FACT }
@@ -120868,6 +122261,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
120868
122261
  access: "view",
120869
122262
  role: "admin"
120870
122263
  },
122264
+ "deviceManager.listIdentityCandidates": {
122265
+ capName: "device-manager",
122266
+ capScope: "system",
122267
+ addonId: null,
122268
+ access: "view",
122269
+ role: "admin"
122270
+ },
120871
122271
  "deviceManager.listLocationDescriptions": {
120872
122272
  capName: "device-manager",
120873
122273
  capScope: "system",
@@ -121085,6 +122485,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
121085
122485
  access: "create",
121086
122486
  role: "admin"
121087
122487
  },
122488
+ "deviceManager.setIdentifiers": {
122489
+ capName: "device-manager",
122490
+ capScope: "system",
122491
+ addonId: null,
122492
+ access: "create",
122493
+ role: "admin"
122494
+ },
121088
122495
  "deviceManager.setIntegrationId": {
121089
122496
  capName: "device-manager",
121090
122497
  capScope: "system",
@@ -127007,6 +128414,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
127007
128414
  access: "view",
127008
128415
  role: "viewer"
127009
128416
  },
128417
+ "siren.getPlayChoices": {
128418
+ capName: "siren",
128419
+ capScope: "device",
128420
+ addonId: null,
128421
+ access: "view",
128422
+ role: "viewer"
128423
+ },
127010
128424
  "siren.getStatus": {
127011
128425
  capName: "siren",
127012
128426
  capScope: "device",
@@ -127819,6 +129233,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
127819
129233
  access: "view",
127820
129234
  role: "viewer"
127821
129235
  },
129236
+ "switch.getOptions": {
129237
+ capName: "switch",
129238
+ capScope: "device",
129239
+ addonId: null,
129240
+ access: "view",
129241
+ role: "viewer"
129242
+ },
127822
129243
  "switch.getStatus": {
127823
129244
  capName: "switch",
127824
129245
  capScope: "device",
@@ -127826,6 +129247,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
127826
129247
  access: "view",
127827
129248
  role: "viewer"
127828
129249
  },
129250
+ "switch.powerCycle": {
129251
+ capName: "switch",
129252
+ capScope: "device",
129253
+ addonId: null,
129254
+ access: "create",
129255
+ role: "viewer"
129256
+ },
127829
129257
  "switch.setState": {
127830
129258
  capName: "switch",
127831
129259
  capScope: "device",
@@ -128029,13 +129457,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
128029
129457
  access: "create",
128030
129458
  role: "admin"
128031
129459
  },
128032
- "terminalSession.adoptLegacyMonitor": {
128033
- capName: "terminal-session",
128034
- capScope: "system",
128035
- addonId: null,
128036
- access: "create",
128037
- role: "admin"
128038
- },
128039
129460
  "terminalSession.close": {
128040
129461
  capName: "terminal-session",
128041
129462
  capScope: "system",
@@ -128043,13 +129464,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
128043
129464
  access: "create",
128044
129465
  role: "admin"
128045
129466
  },
128046
- "terminalSession.listLegacyCameras": {
128047
- capName: "terminal-session",
128048
- capScope: "system",
128049
- addonId: null,
128050
- access: "view",
128051
- role: "admin"
128052
- },
128053
129467
  "terminalSession.listProfiles": {
128054
129468
  capName: "terminal-session",
128055
129469
  capScope: "system",
@@ -128911,6 +130325,62 @@ var METHOD_ACCESS_MAP = Object.freeze({
128911
130325
  access: "view",
128912
130326
  role: "viewer"
128913
130327
  },
130328
+ "workload.forceStop": {
130329
+ capName: "workload",
130330
+ capScope: "device",
130331
+ addonId: null,
130332
+ access: "create",
130333
+ role: "admin"
130334
+ },
130335
+ "workload.getOptions": {
130336
+ capName: "workload",
130337
+ capScope: "device",
130338
+ addonId: null,
130339
+ access: "view",
130340
+ role: "viewer"
130341
+ },
130342
+ "workload.getStatus": {
130343
+ capName: "workload",
130344
+ capScope: "device",
130345
+ addonId: null,
130346
+ access: "view",
130347
+ role: "viewer"
130348
+ },
130349
+ "workload.pause": {
130350
+ capName: "workload",
130351
+ capScope: "device",
130352
+ addonId: null,
130353
+ access: "create",
130354
+ role: "viewer"
130355
+ },
130356
+ "workload.restart": {
130357
+ capName: "workload",
130358
+ capScope: "device",
130359
+ addonId: null,
130360
+ access: "create",
130361
+ role: "viewer"
130362
+ },
130363
+ "workload.resume": {
130364
+ capName: "workload",
130365
+ capScope: "device",
130366
+ addonId: null,
130367
+ access: "create",
130368
+ role: "viewer"
130369
+ },
130370
+ "workload.start": {
130371
+ capName: "workload",
130372
+ capScope: "device",
130373
+ addonId: null,
130374
+ access: "create",
130375
+ role: "viewer"
130376
+ },
130377
+ "workload.stop": {
130378
+ capName: "workload",
130379
+ capScope: "device",
130380
+ addonId: null,
130381
+ access: "create",
130382
+ role: "viewer"
130383
+ },
128914
130384
  "zoneAnalytics.getCameraHistory": {
128915
130385
  capName: "zone-analytics",
128916
130386
  capScope: "device",
@@ -129198,6 +130668,7 @@ var KNOWN_CAP_NAMES = [
129198
130668
  "weather",
129199
130669
  "weather-station",
129200
130670
  "webrtc-session",
130671
+ "workload",
129201
130672
  "zone-analytics",
129202
130673
  "zone-rules",
129203
130674
  "zones"
@@ -129309,6 +130780,7 @@ var DEVICE_CAP_NAMES = [
129309
130780
  "weather",
129310
130781
  "weather-station",
129311
130782
  "webrtc-session",
130783
+ "workload",
129312
130784
  "zone-analytics",
129313
130785
  "zone-rules",
129314
130786
  "zones"
@@ -129522,7 +130994,8 @@ function resolveAction(cap, action, wordings) {
129522
130994
  icon: w.icon ?? action.icon,
129523
130995
  args: action.args ?? {},
129524
130996
  openArgs: action.openArgs ?? [],
129525
- access
130997
+ access,
130998
+ offeredWhen: action.offeredWhen ?? null
129526
130999
  };
129527
131000
  }
129528
131001
  /**
@@ -129551,6 +131024,41 @@ function deviceOffersActions(bindings, actionIds, mode = "any", deviceType) {
129551
131024
  const offered = new Set(actionsForDevice(bindings, deviceType).map((action) => action.id));
129552
131025
  return mode === "all" ? actionIds.every((id) => offered.has(id)) : actionIds.some((id) => offered.has(id));
129553
131026
  }
131027
+ var GATE_PENDING = { kind: "pending" };
131028
+ /**
131029
+ * A gate's answer from what its read returned: closed only when the answer is
131030
+ * an object whose `field` is `false`. A shape that is not an object is not an
131031
+ * answer — it reads as `failed` and keeps the action offered.
131032
+ */
131033
+ function actionGateAnswerFrom(raw, gate) {
131034
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { kind: "failed" };
131035
+ return {
131036
+ kind: "answered",
131037
+ open: Reflect.get(raw, gate.field) !== false
131038
+ };
131039
+ }
131040
+ /**
131041
+ * Whether one device is offered an action, given what it answered: withdrawn
131042
+ * when its `offeredWhen` read ANSWERED `false` (a switch that only reports has
131043
+ * no on/off), or when a dynamic list its arguments read ANSWERED empty (a
131044
+ * siren that counts no plays has nothing to sound N times). A read that failed
131045
+ * or is pending keeps it offered.
131046
+ */
131047
+ function actionOfferedWith(action, answerOf, gateOf = () => GATE_PENDING) {
131048
+ if (action.offeredWhen !== null) {
131049
+ const gate = gateOf(action.cap, action.offeredWhen);
131050
+ if (gate.kind === "answered" && !gate.open) return false;
131051
+ }
131052
+ return action.openArgs.every((arg) => {
131053
+ if (arg.offer.kind !== "dynamic") return true;
131054
+ const answer = answerOf(action.cap, arg.offer);
131055
+ return answer.kind !== "answered" || answer.choiceCount > 0;
131056
+ });
131057
+ }
131058
+ /** One device's actions, minus those {@link actionOfferedWith} withdraws. */
131059
+ function offeredActionsWith(actions, answerOf, gateOf) {
131060
+ return actions.filter((action) => actionOfferedWith(action, answerOf, gateOf));
131061
+ }
129554
131062
  function resolveEnumValue(v) {
129555
131063
  const phrase = v.phrase ?? fill(BECOMES, {
129556
131064
  en: { value: v.label.en },
@@ -129983,6 +131491,7 @@ var DEVICE_TYPE_ICON = {
129983
131491
  [require_composed_stable_id.DeviceType.Climate]: "thermometer",
129984
131492
  [require_composed_stable_id.DeviceType.HeatPump]: "flame",
129985
131493
  [require_composed_stable_id.DeviceType.EnergySystem]: "solar-panel",
131494
+ [require_composed_stable_id.DeviceType.Workload]: "server",
129986
131495
  [require_composed_stable_id.DeviceType.Button]: "circle-dot",
129987
131496
  [require_composed_stable_id.DeviceType.EventEmitter]: "zap",
129988
131497
  [require_composed_stable_id.DeviceType.Update]: "refresh-cw",
@@ -130037,6 +131546,7 @@ var DEVICE_ROLE_ICON = {
130037
131546
  [require_composed_stable_id.DeviceRole.SwitchHeater]: "flame",
130038
131547
  [require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
130039
131548
  [require_composed_stable_id.DeviceRole.SwitchLight]: "lightbulb",
131549
+ [require_composed_stable_id.DeviceRole.PoePort]: "ethernet-port",
130040
131550
  [require_composed_stable_id.DeviceRole.ClimateAc]: "air-vent",
130041
131551
  [require_composed_stable_id.DeviceRole.ClimateThermostat]: "thermometer",
130042
131552
  [require_composed_stable_id.DeviceRole.ClimateFloor]: "waves",
@@ -130081,7 +131591,12 @@ var DEVICE_ROLE_ICON = {
130081
131591
  [require_composed_stable_id.DeviceRole.MessagingNotifier]: "message-square",
130082
131592
  [require_composed_stable_id.DeviceRole.EmailNotifier]: "mail",
130083
131593
  [require_composed_stable_id.DeviceRole.GenericNotifier]: "bell",
130084
- [require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower"
131594
+ [require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower",
131595
+ [require_composed_stable_id.DeviceRole.Vm]: "monitor",
131596
+ [require_composed_stable_id.DeviceRole.AppContainer]: "container",
131597
+ [require_composed_stable_id.DeviceRole.Lxc]: "box",
131598
+ [require_composed_stable_id.DeviceRole.App]: "app-window",
131599
+ [require_composed_stable_id.DeviceRole.Host]: "server"
130085
131600
  };
130086
131601
  var TYPE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceType));
130087
131602
  var ROLE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceRole));
@@ -131431,7 +132946,8 @@ var CAP_NAMES_WITH_STATUS = [
131431
132946
  "vibration",
131432
132947
  "water-heater",
131433
132948
  "weather",
131434
- "weather-station"
132949
+ "weather-station",
132950
+ "workload"
131435
132951
  ];
131436
132952
  //#endregion
131437
132953
  //#region src/generated/method-device-selectors.ts
@@ -132134,6 +133650,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
132134
133650
  form: "single",
132135
133651
  optional: false
132136
133652
  }],
133653
+ "deviceManager.setIdentifiers": [{
133654
+ name: "deviceId",
133655
+ form: "single",
133656
+ optional: false
133657
+ }],
132137
133658
  "deviceManager.setIntegrationId": [{
132138
133659
  name: "deviceId",
132139
133660
  form: "single",
@@ -134128,6 +135649,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134128
135649
  form: "single",
134129
135650
  optional: false
134130
135651
  }],
135652
+ "siren.getPlayChoices": [{
135653
+ name: "deviceId",
135654
+ form: "single",
135655
+ optional: false
135656
+ }],
134131
135657
  "siren.getStatus": [{
134132
135658
  name: "deviceId",
134133
135659
  form: "single",
@@ -134310,11 +135836,21 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134310
135836
  form: "single",
134311
135837
  optional: false
134312
135838
  }],
135839
+ "switch.getOptions": [{
135840
+ name: "deviceId",
135841
+ form: "single",
135842
+ optional: false
135843
+ }],
134313
135844
  "switch.getStatus": [{
134314
135845
  name: "deviceId",
134315
135846
  form: "single",
134316
135847
  optional: false
134317
135848
  }],
135849
+ "switch.powerCycle": [{
135850
+ name: "deviceId",
135851
+ form: "single",
135852
+ optional: false
135853
+ }],
134318
135854
  "switch.setState": [{
134319
135855
  name: "deviceId",
134320
135856
  form: "single",
@@ -134555,6 +136091,46 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134555
136091
  form: "single",
134556
136092
  optional: false
134557
136093
  }],
136094
+ "workload.forceStop": [{
136095
+ name: "deviceId",
136096
+ form: "single",
136097
+ optional: false
136098
+ }],
136099
+ "workload.getOptions": [{
136100
+ name: "deviceId",
136101
+ form: "single",
136102
+ optional: false
136103
+ }],
136104
+ "workload.getStatus": [{
136105
+ name: "deviceId",
136106
+ form: "single",
136107
+ optional: false
136108
+ }],
136109
+ "workload.pause": [{
136110
+ name: "deviceId",
136111
+ form: "single",
136112
+ optional: false
136113
+ }],
136114
+ "workload.restart": [{
136115
+ name: "deviceId",
136116
+ form: "single",
136117
+ optional: false
136118
+ }],
136119
+ "workload.resume": [{
136120
+ name: "deviceId",
136121
+ form: "single",
136122
+ optional: false
136123
+ }],
136124
+ "workload.start": [{
136125
+ name: "deviceId",
136126
+ form: "single",
136127
+ optional: false
136128
+ }],
136129
+ "workload.stop": [{
136130
+ name: "deviceId",
136131
+ form: "single",
136132
+ optional: false
136133
+ }],
134558
136134
  "zoneAnalytics.getCameraHistory": [{
134559
136135
  name: "deviceId",
134560
136136
  form: "single",
@@ -134673,6 +136249,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
134673
136249
  "deviceManager.setChildLayout",
134674
136250
  "deviceManager.setDisabled",
134675
136251
  "deviceManager.setDisplay",
136252
+ "deviceManager.setIdentifiers",
134676
136253
  "deviceManager.setIntegrationId",
134677
136254
  "deviceManager.setLinkDeviceId",
134678
136255
  "deviceManager.setLocation",
@@ -134849,7 +136426,7 @@ function getCapsByProviderKind(kind) {
134849
136426
  //#region src/generated/runtime-state-durability.ts
134850
136427
  /**
134851
136428
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
134852
- * `runtimeState`. 86 caps: 43 `restored`, 43 `session`.
136429
+ * `runtimeState`. 87 caps: 43 `restored`, 44 `session`.
134853
136430
  *
134854
136431
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
134855
136432
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -135189,6 +136766,10 @@ var RUNTIME_STATE_POLICY = {
135189
136766
  durability: "session",
135190
136767
  volatileFields: ["lastFetchedAt"]
135191
136768
  },
136769
+ "workload": {
136770
+ durability: "session",
136771
+ volatileFields: ["lastFetchedAt"]
136772
+ },
135192
136773
  "zone-analytics": {
135193
136774
  durability: "session",
135194
136775
  volatileFields: []
@@ -136042,6 +137623,7 @@ function createSystemProxy(api) {
136042
137623
  checkDeviceTemplates: (input) => dispatch("deviceManager", "checkDeviceTemplates", "query", input),
136043
137624
  getRoleDisplayDefaults: (input) => dispatch("deviceManager", "getRoleDisplayDefaults", "query", input),
136044
137625
  setRoleDisplayDefaults: (input) => dispatch("deviceManager", "setRoleDisplayDefaults", "mutation", input),
137626
+ listIdentityCandidates: (input) => dispatch("deviceManager", "listIdentityCandidates", "query", input),
136045
137627
  listLocations: (input) => dispatch("deviceManager", "listLocations", "query", input),
136046
137628
  addLocation: (input) => dispatch("deviceManager", "addLocation", "mutation", input),
136047
137629
  removeLocation: (input) => dispatch("deviceManager", "removeLocation", "mutation", input),
@@ -136616,8 +138198,6 @@ function createSystemProxy(api) {
136616
138198
  },
136617
138199
  terminalSession: {
136618
138200
  listProfiles: (input) => dispatch("terminalSession", "listProfiles", "query", input),
136619
- listLegacyCameras: (input) => dispatch("terminalSession", "listLegacyCameras", "query", input),
136620
- adoptLegacyMonitor: (input) => dispatch("terminalSession", "adoptLegacyMonitor", "mutation", input),
136621
138201
  listSessions: (input) => dispatch("terminalSession", "listSessions", "query", input),
136622
138202
  serverShellStatus: (input) => dispatch("terminalSession", "serverShellStatus", "query", input),
136623
138203
  openSession: (input) => dispatch("terminalSession", "openSession", "mutation", input),
@@ -149186,6 +150766,7 @@ exports.CAPABILITY_NAMES = CAPABILITY_NAMES;
149186
150766
  exports.CAPABILITY_ROUTER_KEYS = CAPABILITY_ROUTER_KEYS;
149187
150767
  exports.CAP_COMMAND_ORIGIN_CONTEXT_KEY = require_sleep.CAP_COMMAND_ORIGIN_CONTEXT_KEY;
149188
150768
  exports.CAP_CUSTOMIZE_CATALOG = CAP_CUSTOMIZE_CATALOG;
150769
+ exports.CAP_METHOD_NOT_IMPLEMENTED = require_sleep.CAP_METHOD_NOT_IMPLEMENTED;
149189
150770
  exports.CAP_NAMES_WITH_STATUS = CAP_NAMES_WITH_STATUS;
149190
150771
  exports.CAP_NODE_PIN_CONTEXT_KEY = require_sleep.CAP_NODE_PIN_CONTEXT_KEY;
149191
150772
  exports.CAP_PROVIDER_KIND_MAP = CAP_PROVIDER_KIND_MAP;
@@ -149469,6 +151050,8 @@ exports.DEFAULT_EVENTS_BAND_BUFFER_SEC = DEFAULT_EVENTS_BAND_BUFFER_SEC;
149469
151050
  exports.DEFAULT_EVENT_COLOR = DEFAULT_EVENT_COLOR;
149470
151051
  exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
149471
151052
  exports.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = require_implemented_methods.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS;
151053
+ exports.DEFAULT_GRID_FPS = require_implemented_methods.DEFAULT_GRID_FPS;
151054
+ exports.DEFAULT_GRID_PROFILES = require_implemented_methods.DEFAULT_GRID_PROFILES;
149472
151055
  exports.DEFAULT_HEADROOM = DEFAULT_HEADROOM;
149473
151056
  exports.DEFAULT_HISTORY_RETENTION = require_implemented_methods.DEFAULT_HISTORY_RETENTION;
149474
151057
  exports.DEFAULT_HOLD_OVERRIDE = DEFAULT_HOLD_OVERRIDE;
@@ -149517,6 +151100,7 @@ exports.DEVICE_HISTORY_ENERGY_KEY = DEVICE_HISTORY_ENERGY_KEY;
149517
151100
  exports.DEVICE_HISTORY_ORPHAN_DELETE_MAX = DEVICE_HISTORY_ORPHAN_DELETE_MAX;
149518
151101
  exports.DEVICE_HISTORY_ORPHAN_LIST_MAX = DEVICE_HISTORY_ORPHAN_LIST_MAX;
149519
151102
  exports.DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS = DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS;
151103
+ exports.DEVICE_IDENTIFIER_KEYS = DEVICE_IDENTIFIER_KEYS;
149520
151104
  exports.DEVICE_ID_FIELD = DEVICE_ID_FIELD;
149521
151105
  exports.DEVICE_NONCE_TTL_MS = DEVICE_NONCE_TTL_MS;
149522
151106
  exports.DEVICE_PROFILES = DEVICE_PROFILES;
@@ -149622,6 +151206,10 @@ exports.DeviceHistoryRefusalReasonSchema = DeviceHistoryRefusalReasonSchema;
149622
151206
  exports.DeviceHistoryResolutionSchema = DeviceHistoryResolutionSchema;
149623
151207
  exports.DeviceHistoryStatusSchema = DeviceHistoryStatusSchema;
149624
151208
  exports.DeviceHistorySubjectSchema = DeviceHistorySubjectSchema;
151209
+ exports.DeviceIdentifierEntrySchema = DeviceIdentifierEntrySchema;
151210
+ exports.DeviceIdentifierKeySchema = DeviceIdentifierKeySchema;
151211
+ exports.DeviceIdentifierOriginSchema = DeviceIdentifierOriginSchema;
151212
+ exports.DeviceIdentifiersSchema = DeviceIdentifiersSchema;
149625
151213
  exports.DeviceInfoSchema = DeviceInfoSchema;
149626
151214
  exports.DeviceModelChoiceSchema = DeviceModelChoiceSchema;
149627
151215
  exports.DeviceNetworkStatsSchema = DeviceNetworkStatsSchema;
@@ -149702,6 +151290,7 @@ exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
149702
151290
  exports.EMPTY_AUTOMATION_STATE = EMPTY_AUTOMATION_STATE;
149703
151291
  exports.EMPTY_REMOTE_ASSUMED_STATE = EMPTY_REMOTE_ASSUMED_STATE;
149704
151292
  exports.EMPTY_REMOTE_CONFIG = EMPTY_REMOTE_CONFIG;
151293
+ exports.ENGINE_HOSTED_HELPER_KINDS = require_implemented_methods.ENGINE_HOSTED_HELPER_KINDS;
149705
151294
  exports.ERROR_STATUS_COLD = ERROR_STATUS_COLD;
149706
151295
  exports.ESTIMATE_COMPUTE_RATIO_MAX = ESTIMATE_COMPUTE_RATIO_MAX;
149707
151296
  exports.ESTIMATE_COMPUTE_RATIO_MIN = ESTIMATE_COMPUTE_RATIO_MIN;
@@ -149886,14 +151475,18 @@ exports.FrameLazyCountersSchema = FrameLazyCountersSchema;
149886
151475
  exports.FrameLazyMetricsSchema = FrameLazyMetricsSchema;
149887
151476
  exports.G711_SCALE_CORRECTION_DB = G711_SCALE_CORRECTION_DB;
149888
151477
  exports.GRAMMAR_MAX_LINES = GRAMMAR_MAX_LINES;
151478
+ exports.GRID_PROFILES = require_implemented_methods.GRID_PROFILES;
149889
151479
  exports.GROUP_TEMPLATES = GROUP_TEMPLATES;
149890
151480
  exports.GROUP_TEMPLATE_IDS = require_implemented_methods.GROUP_TEMPLATE_IDS;
149891
151481
  exports.GasStatusSchema = GasStatusSchema;
149892
151482
  exports.GetLoggingSettingsInputSchema = GetLoggingSettingsInputSchema;
149893
151483
  exports.GetStreamWithCodecInputSchema = GetStreamWithCodecInputSchema;
149894
151484
  exports.GlobalMetricsSchema = GlobalMetricsSchema;
151485
+ exports.GridCellSpecSchema = require_implemented_methods.GridCellSpecSchema;
151486
+ exports.GridHelperSpecSchema = require_implemented_methods.GridHelperSpecSchema;
149895
151487
  exports.GridLayoutPatchSchema = GridLayoutPatchSchema;
149896
151488
  exports.GridLayoutViewSchema = GridLayoutViewSchema;
151489
+ exports.GridRectSchema = require_implemented_methods.GridRectSchema;
149897
151490
  exports.GroupActiveSchema = GroupActiveSchema;
149898
151491
  exports.GroupCommandResultSchema = GroupCommandResultSchema;
149899
151492
  exports.GroupCommandsSchema = GroupCommandsSchema;
@@ -149986,6 +151579,7 @@ exports.HoldSpecSchema = HoldSpecSchema;
149986
151579
  exports.HoldTargetStatusSchema = HoldTargetStatusSchema;
149987
151580
  exports.HoldTraceSchema = HoldTraceSchema;
149988
151581
  exports.HoldTracker = HoldTracker;
151582
+ exports.HostedWithdrawalGate = HostedWithdrawalGate;
149989
151583
  exports.HttpsLeafInfoSchema = HttpsLeafInfoSchema;
149990
151584
  exports.HubAddressRoleSchema = HubAddressRoleSchema;
149991
151585
  exports.HumidifierStatusSchema = HumidifierStatusSchema;
@@ -150010,6 +151604,11 @@ exports.IR_NATIVE_CODECS = IR_NATIVE_CODECS;
150010
151604
  exports.IR_NATIVE_CODE_MAX_CHARS = IR_NATIVE_CODE_MAX_CHARS;
150011
151605
  exports.IR_TIMINGS_MAX = IR_TIMINGS_MAX;
150012
151606
  exports.IconKeySchema = IconKeySchema;
151607
+ exports.IdentityCandidateDeviceSchema = IdentityCandidateDeviceSchema;
151608
+ exports.IdentityCandidatePairSchema = IdentityCandidatePairSchema;
151609
+ exports.IdentityCandidatesSchema = IdentityCandidatesSchema;
151610
+ exports.IdentityConfidenceSchema = IdentityConfidenceSchema;
151611
+ exports.IdentityMatchedKeySchema = IdentityMatchedKeySchema;
150013
151612
  exports.ImageContractSchema = ImageContractSchema;
150014
151613
  exports.ImageContractStateSchema = ImageContractStateSchema;
150015
151614
  exports.ImageRotateSchema = ImageRotateSchema;
@@ -150201,6 +151800,7 @@ exports.MAX_EXPRESSION_BINDINGS = require_implemented_methods.MAX_EXPRESSION_BIN
150201
151800
  exports.MAX_EXPRESSION_CALL_ARGS = require_implemented_methods.MAX_EXPRESSION_CALL_ARGS;
150202
151801
  exports.MAX_EXPRESSION_EVAL_STEPS = require_implemented_methods.MAX_EXPRESSION_EVAL_STEPS;
150203
151802
  exports.MAX_EXPRESSION_SOURCE_LENGTH = require_implemented_methods.MAX_EXPRESSION_SOURCE_LENGTH;
151803
+ exports.MAX_GRID_CELLS = require_implemented_methods.MAX_GRID_CELLS;
150204
151804
  exports.MAX_HELPER_MEMBERS = require_implemented_methods.MAX_HELPER_MEMBERS;
150205
151805
  exports.MAX_HOLD_ATTEMPTS_LIMIT = MAX_HOLD_ATTEMPTS_LIMIT;
150206
151806
  exports.MAX_KEYS = MAX_KEYS;
@@ -151162,6 +152762,8 @@ exports.SUBJECT_PATH_FULL_FRAME_COVERAGE = SUBJECT_PATH_FULL_FRAME_COVERAGE;
151162
152762
  exports.SUBJECT_PATH_MAX_POINTS = SUBJECT_PATH_MAX_POINTS;
151163
152763
  exports.SUB_DETECTION_TYPES = SUB_DETECTION_TYPES;
151164
152764
  exports.SUNRISE_ALTITUDE_DEG = SUNRISE_ALTITUDE_DEG;
152765
+ exports.SWITCH_DEFAULT_OPTIONS = SWITCH_DEFAULT_OPTIONS;
152766
+ exports.SWITCH_SETTABLE_GATE = require_sleep.SWITCH_SETTABLE_GATE;
151165
152767
  exports.SYSTEM_CAP_NAMES = SYSTEM_CAP_NAMES;
151166
152768
  exports.SYSTEM_SCOPE_DEVICE_METHODS = SYSTEM_SCOPE_DEVICE_METHODS;
151167
152769
  exports.SceneCheckSchema = SceneCheckSchema;
@@ -151231,6 +152833,7 @@ exports.SirenOptionsSchema = SirenOptionsSchema;
151231
152833
  exports.SirenOptionsSource = SirenOptionsSource;
151232
152834
  exports.SirenRuntimeStateSchema = SirenRuntimeStateSchema;
151233
152835
  exports.SirenStatusSchema = SirenStatusSchema;
152836
+ exports.SirenTriggerInputSchema = SirenTriggerInputSchema;
151234
152837
  exports.SiteLocationSchema = SiteLocationSchema;
151235
152838
  exports.SiteLocationSourceSchema = SiteLocationSourceSchema;
151236
152839
  exports.SiteLocationStatusSchema = SiteLocationStatusSchema;
@@ -151330,6 +152933,7 @@ exports.SuggestedDeviceShareSchema = SuggestedDeviceShareSchema;
151330
152933
  exports.SuggestedNodeShareSchema = SuggestedNodeShareSchema;
151331
152934
  exports.SunEventSchema = SunEventSchema;
151332
152935
  exports.SuppliedRootOutputSchema = SuppliedRootOutputSchema;
152936
+ exports.SwitchOptionsSchema = SwitchOptionsSchema;
151333
152937
  exports.SwitchStatusSchema = SwitchStatusSchema;
151334
152938
  exports.SystemHeldSecretNameSchema = SystemHeldSecretNameSchema;
151335
152939
  exports.SystemMetricsSchema = SystemMetricsSchema;
@@ -151406,8 +153010,7 @@ exports.TemplateTimeWindowValueSchema = TemplateTimeWindowValueSchema;
151406
153010
  exports.TemplateUserSchema = TemplateUserSchema;
151407
153011
  exports.TemplateValueBindingSchema = TemplateValueBindingSchema;
151408
153012
  exports.TemplateWriteResultSchema = TemplateWriteResultSchema;
151409
- exports.TerminalInstanceInfoSchema = TerminalInstanceInfoSchema;
151410
- exports.TerminalLegacyCameraSchema = TerminalLegacyCameraSchema;
153013
+ exports.TerminalHelperSpecSchema = require_implemented_methods.TerminalHelperSpecSchema;
151411
153014
  exports.TerminalOutputBatchSchema = TerminalOutputBatchSchema;
151412
153015
  exports.TerminalOutputEventSchema = TerminalOutputEventSchema;
151413
153016
  exports.TerminalProfileInfoSchema = TerminalProfileInfoSchema;
@@ -151571,6 +153174,10 @@ exports.WEEKLY_MASK_LENGTH = WEEKLY_MASK_LENGTH;
151571
153174
  exports.WELL_KNOWN_TABS = require_sleep.WELL_KNOWN_TABS;
151572
153175
  exports.WELL_KNOWN_TAB_MAP = require_sleep.WELL_KNOWN_TAB_MAP;
151573
153176
  exports.WHEN_UNROLL_DEPTH = WHEN_UNROLL_DEPTH;
153177
+ exports.WORKLOAD_ACTIONS = WORKLOAD_ACTIONS;
153178
+ exports.WORKLOAD_ROLES = WORKLOAD_ROLES;
153179
+ exports.WORKLOAD_STATES = WORKLOAD_STATES;
153180
+ exports.WORKLOAD_TRANSITION_CATEGORY = WORKLOAD_TRANSITION_CATEGORY;
151574
153181
  exports.WaterHeaterStatusSchema = WaterHeaterStatusSchema;
151575
153182
  exports.WeatherStationStatusSchema = WeatherStationStatusSchema;
151576
153183
  exports.WeatherStatusSchema = WeatherStatusSchema;
@@ -151587,6 +153194,12 @@ exports.WidgetLoginMethodSchema = WidgetLoginMethodSchema;
151587
153194
  exports.WidgetMetadataSchema = WidgetMetadataSchema;
151588
153195
  exports.WidgetRemoteSchema = WidgetRemoteSchema;
151589
153196
  exports.WidgetSizeEnum = WidgetSizeEnum;
153197
+ exports.WorkloadOptionsSchema = WorkloadOptionsSchema;
153198
+ exports.WorkloadPortProtocolSchema = WorkloadPortProtocolSchema;
153199
+ exports.WorkloadPortSchema = WorkloadPortSchema;
153200
+ exports.WorkloadResourcesSchema = WorkloadResourcesSchema;
153201
+ exports.WorkloadStateSchema = WorkloadStateSchema;
153202
+ exports.WorkloadStatusSchema = WorkloadStatusSchema;
151590
153203
  exports.WrapperActivationReadSchema = WrapperActivationReadSchema;
151591
153204
  exports.WrapperEvidenceSchema = WrapperEvidenceSchema;
151592
153205
  exports.WrapperIdentitySchema = WrapperIdentitySchema;
@@ -151609,6 +153222,8 @@ exports.accessoryChildrenComplete = accessoryChildrenComplete;
151609
153222
  exports.accessoryChildrenUnknown = accessoryChildrenUnknown;
151610
153223
  exports.accessoryStableId = accessoryStableId;
151611
153224
  exports.actionEffect = require_sleep.actionEffect;
153225
+ exports.actionGateAnswerFrom = actionGateAnswerFrom;
153226
+ exports.actionOfferedWith = actionOfferedWith;
151612
153227
  exports.actionSourceCapability = actionSourceCapability;
151613
153228
  exports.actionWaitTotalMs = actionWaitTotalMs;
151614
153229
  exports.actionsCapability = actionsCapability;
@@ -151914,6 +153529,7 @@ exports.dayNightCapability = dayNightCapability;
151914
153529
  exports.dayOfWeekToIndex = dayOfWeekToIndex;
151915
153530
  exports.declarationOwnerNodeId = declarationOwnerNodeId;
151916
153531
  exports.declarationsOf = require_sleep.declarationsOf;
153532
+ exports.declareDeviceIdentifiers = declareDeviceIdentifiers;
151917
153533
  exports.declareLinkKind = declareLinkKind;
151918
153534
  exports.declareLogChannel = declareLogChannel;
151919
153535
  exports.declaredSeriesKind = declaredSeriesKind;
@@ -151959,6 +153575,7 @@ exports.derivePostTriggeredAction = derivePostTriggeredAction;
151959
153575
  exports.deriveRecordingMode = deriveRecordingMode;
151960
153576
  exports.deriveRootFaceRefineRect = deriveRootFaceRefineRect;
151961
153577
  exports.deriveRootSupplies = deriveRootSupplies;
153578
+ exports.deriveWorkloadControls = deriveWorkloadControls;
151962
153579
  exports.describeComposableCaps = describeComposableCaps;
151963
153580
  exports.describeCustomActions = require_sleep.describeCustomActions;
151964
153581
  exports.describeHold = describeHold;
@@ -152195,6 +153812,7 @@ exports.heatPumpControlCapability = heatPumpControlCapability;
152195
153812
  exports.heatPumpInstantCop = heatPumpInstantCop;
152196
153813
  exports.heatPumpStatusCapability = heatPumpStatusCapability;
152197
153814
  exports.heatingValveCapability = heatingValveCapability;
153815
+ exports.helperDeviceRefs = require_implemented_methods.helperDeviceRefs;
152198
153816
  exports.helperMembers = require_implemented_methods.helperMembers;
152199
153817
  exports.helperSaveProblems = helperSaveProblems;
152200
153818
  exports.heroArgsWithValue = heroArgsWithValue;
@@ -152208,6 +153826,7 @@ exports.historyUnitFor = require_sleep.historyUnitFor;
152208
153826
  exports.holdOf = holdOf;
152209
153827
  exports.holdRefusalOf = holdRefusalOf;
152210
153828
  exports.holdVarSlots = holdVarSlots;
153829
+ exports.hostEngineDevice = hostEngineDevice;
152211
153830
  exports.htmlToText = htmlToText;
152212
153831
  exports.hubAddressHostname = hubAddressHostname;
152213
153832
  exports.hubMotionNativeProvider = hubMotionNativeProvider;
@@ -152219,6 +153838,7 @@ exports.iconCategoryLabel = iconCategoryLabel;
152219
153838
  exports.iconEntry = iconEntry;
152220
153839
  exports.iconsInCategory = iconsInCategory;
152221
153840
  exports.identifiedEventLeaves = identifiedEventLeaves;
153841
+ exports.identifierStrength = identifierStrength;
152222
153842
  exports.imageCapability = imageCapability;
152223
153843
  exports.imageModesForKind = imageModesForKind;
152224
153844
  exports.imageSettingsCapability = imageSettingsCapability;
@@ -152275,6 +153895,7 @@ exports.isAutomaticShareSource = isAutomaticShareSource;
152275
153895
  exports.isBaseConditionKey = isBaseConditionKey;
152276
153896
  exports.isBatteryPresenceFault = isBatteryPresenceFault;
152277
153897
  exports.isBuiltinTemplateId = isBuiltinTemplateId;
153898
+ exports.isCapMethodAbsent = require_sleep.isCapMethodAbsent;
152278
153899
  exports.isClusterScopedStep = isClusterScopedStep;
152279
153900
  exports.isCollectionArrayMethod = isCollectionArrayMethod;
152280
153901
  exports.isCommand = require_sleep.isCommand;
@@ -152290,6 +153911,8 @@ exports.isDeviceScopedCap = require_sleep.isDeviceScopedCap;
152290
153911
  exports.isDoPickerDeviceType = isDoPickerDeviceType;
152291
153912
  exports.isDrawableSubjectPath = isDrawableSubjectPath;
152292
153913
  exports.isEmbeddingModelFailed = isEmbeddingModelFailed;
153914
+ exports.isEmptyIdentifiers = isEmptyIdentifiers;
153915
+ exports.isEngineHostedHelper = require_implemented_methods.isEngineHostedHelper;
152293
153916
  exports.isEvent = require_sleep.isEvent;
152294
153917
  exports.isEventKindLabelKey = isEventKindLabelKey;
152295
153918
  exports.isEventLeaf = isEventLeaf;
@@ -152364,6 +153987,7 @@ exports.isUnfilledRequiredProblem = isUnfilledRequiredProblem;
152364
153987
  exports.isUsableTimeZone = isUsableTimeZone;
152365
153988
  exports.isVectorIndexDimConflict = isVectorIndexDimConflict;
152366
153989
  exports.isVoidInput = isVoidInput;
153990
+ exports.isWorkloadSettled = isWorkloadSettled;
152367
153991
  exports.isZodSecret = require_sleep.isZodSecret;
152368
153992
  exports.ituDbfsFromPreEpoch = ituDbfsFromPreEpoch;
152369
153993
  exports.jobKindSchema = jobKindSchema;
@@ -152380,8 +154004,10 @@ exports.lawnMowerControlCapability = lawnMowerControlCapability;
152380
154004
  exports.leafCatalogEntry = leafCatalogEntry;
152381
154005
  exports.leafKindsFor = leafKindsFor;
152382
154006
  exports.legacyAutoLinkIds = legacyAutoLinkIds;
154007
+ exports.legacyEngineRowsIndex = legacyEngineRowsIndex;
152383
154008
  exports.legacyImageMode = legacyImageMode;
152384
154009
  exports.legacyModeOf = legacyModeOf;
154010
+ exports.legacySweepDone = legacySweepDone;
152385
154011
  exports.legacyTargetsOver = legacyTargetsOver;
152386
154012
  exports.lifecycleJobSchema = lifecycleJobSchema;
152387
154013
  exports.lifecycleJobScopeSchema = lifecycleJobScopeSchema;
@@ -152435,6 +154061,7 @@ exports.mediaPlayerExtensionCommands = mediaPlayerExtensionCommands;
152435
154061
  exports.mediaPlayerFeaturesOfRoles = mediaPlayerFeaturesOfRoles;
152436
154062
  exports.memoizePinnedFfmpeg = memoizePinnedFfmpeg;
152437
154063
  exports.mergeClipLabels = mergeClipLabels;
154064
+ exports.mergeIdentifiers = mergeIdentifiers;
152438
154065
  exports.mergeKeyedArrayItem = mergeKeyedArrayItem;
152439
154066
  exports.mergeOverrides = mergeOverrides;
152440
154067
  exports.mergeScalarTarget = mergeScalarTarget;
@@ -152483,6 +154110,7 @@ exports.nestedStepsOf = nestedStepsOf;
152483
154110
  exports.networkAccessCapability = networkAccessCapability;
152484
154111
  exports.networkLinkCapability = networkLinkCapability;
152485
154112
  exports.networkQualityCapability = networkQualityCapability;
154113
+ exports.newGridHelperSpec = require_implemented_methods.newGridHelperSpec;
152486
154114
  exports.nextLocalMidnight = require_implemented_methods.nextLocalMidnight;
152487
154115
  exports.nextOccurrence = nextOccurrence;
152488
154116
  exports.nextTimeBoundaryInMs = nextTimeBoundaryInMs;
@@ -152493,6 +154121,8 @@ exports.nodePickerItems = nodePickerItems;
152493
154121
  exports.nodePin = require_sleep.nodePin;
152494
154122
  exports.nodeRemovalHookCapability = nodeRemovalHookCapability;
152495
154123
  exports.nodesCapability = nodesCapability;
154124
+ exports.normaliseIdentifiers = normaliseIdentifiers;
154125
+ exports.normaliseMac = normaliseMac;
152496
154126
  exports.normalizeActionUnits = normalizeActionUnits;
152497
154127
  exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
152498
154128
  exports.normalizeAudioLabel = normalizeAudioLabel;
@@ -152526,6 +154156,7 @@ exports.objectInputDeclaresRequiredDeviceId = objectInputDeclaresRequiredDeviceI
152526
154156
  exports.observeHoldLeaves = observeHoldLeaves;
152527
154157
  exports.occupancyScope = occupancyScope;
152528
154158
  exports.occurrenceOn = occurrenceOn;
154159
+ exports.offeredActionsWith = offeredActionsWith;
152529
154160
  exports.omitTransientConfig = require_sleep.omitTransientConfig;
152530
154161
  exports.openReset = require_implemented_methods.openReset;
152531
154162
  exports.openStatistic = require_implemented_methods.openStatistic;
@@ -152611,6 +154242,7 @@ exports.planMotionCropRegions = planMotionCropRegions;
152611
154242
  exports.planMotionCrops = planMotionCrops;
152612
154243
  exports.planRecoveryCrops = planRecoveryCrops;
152613
154244
  exports.planResetTier = require_implemented_methods.planResetTier;
154245
+ exports.planSirenTrigger = planSirenTrigger;
152614
154246
  exports.planStatisticTier = require_implemented_methods.planStatisticTier;
152615
154247
  exports.plateGalleryCapability = plateGalleryCapability;
152616
154248
  exports.platformProbeCapability = platformProbeCapability;
@@ -152787,6 +154419,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
152787
154419
  exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
152788
154420
  exports.resolveSelectStep = resolveSelectStep;
152789
154421
  exports.resolveServerName = resolveServerName;
154422
+ exports.resolveSirenPlays = resolveSirenPlays;
152790
154423
  exports.resolveSirenSeconds = resolveSirenSeconds;
152791
154424
  exports.resolveStepArgs = resolveStepArgs;
152792
154425
  exports.resolveStepArgsWithTemplates = resolveStepArgsWithTemplates;
@@ -152843,6 +154476,7 @@ exports.runtimeDevices = runtimeDevices;
152843
154476
  exports.runtimeFieldUnit = runtimeFieldUnit;
152844
154477
  exports.runtimeStatePolicyFor = runtimeStatePolicyFor;
152845
154478
  exports.sameHelperBody = sameHelperBody;
154479
+ exports.sameIdentifiers = sameIdentifiers;
152846
154480
  exports.sameRead = sameRead;
152847
154481
  exports.sameTag = sameTag;
152848
154482
  exports.sanitizeTargetOverride = sanitizeTargetOverride;
@@ -152877,6 +154511,7 @@ exports.seedLeaf = seedLeaf;
152877
154511
  exports.seekPatch = seekPatch;
152878
154512
  exports.selectAppConnectionEndpoints = selectAppConnectionEndpoints;
152879
154513
  exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
154514
+ exports.selectEngineHostedBlocks = selectEngineHostedBlocks;
152880
154515
  exports.selectFewShots = selectFewShots;
152881
154516
  exports.selectNavigationMethods = selectNavigationMethods;
152882
154517
  exports.selectRecoveryStep = selectRecoveryStep;
@@ -152909,6 +154544,7 @@ exports.signalPercentFromBars = signalPercentFromBars;
152909
154544
  exports.signalPercentFromRssi = signalPercentFromRssi;
152910
154545
  exports.sirenCapability = sirenCapability;
152911
154546
  exports.sirenIdleStatus = sirenIdleStatus;
154547
+ exports.sirenPlayChoices = sirenPlayChoices;
152912
154548
  exports.sirenTriggeredStatus = sirenTriggeredStatus;
152913
154549
  exports.siteFor = siteFor;
152914
154550
  exports.siteZoneKey = siteZoneKey;
@@ -152980,8 +154616,10 @@ exports.sunTimes = sunTimes;
152980
154616
  exports.supplyFor = supplyFor;
152981
154617
  exports.supportedRuntimes = supportedRuntimes;
152982
154618
  exports.swatchHex = swatchHex;
154619
+ exports.sweepLegacyEngineRows = sweepLegacyEngineRows;
152983
154620
  exports.switchCapability = switchCapability;
152984
154621
  exports.switchRecordsOverMigrationApi = require_sleep.switchRecordsOverMigrationApi;
154622
+ exports.switchRefusesSetState = require_sleep.switchRefusesSetState;
152985
154623
  exports.switchStateOfMode = switchStateOfMode;
152986
154624
  exports.switchedOffIds = switchedOffIds;
152987
154625
  exports.syncActiveAlarmProfileSettings = syncActiveAlarmProfileSettings;
@@ -153128,6 +154766,8 @@ exports.withSystemEventModes = withSystemEventModes;
153128
154766
  exports.withoutCallerStamp = require_sleep.withoutCallerStamp;
153129
154767
  exports.withoutField = withoutField;
153130
154768
  exports.withoutKeyedArrayItem = withoutKeyedArrayItem;
154769
+ exports.workloadCapability = workloadCapability;
154770
+ exports.workloadTransition = workloadTransition;
153131
154771
  exports.writeModelBoundSetting = writeModelBoundSetting;
153132
154772
  exports.zodEntriesToConfigUI = zodEntriesToConfigUI;
153133
154773
  exports.zoneAnalyticsCapability = zoneAnalyticsCapability;