@camstack/types 1.2.586 → 1.2.587

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 (75) hide show
  1. package/CHANGELOG.md +27 -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 +422 -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 +58 -5
  21. package/dist/client.mjs +58 -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-management.d.ts +10 -0
  38. package/dist/device/device-type.d.ts +22 -2
  39. package/dist/device/hero/build-hero-model.d.ts +15 -0
  40. package/dist/device/hero/hero-fragment.d.ts +11 -0
  41. package/dist/device/hero/hero-layout.d.ts +1 -0
  42. package/dist/device/hero/hero-look.d.ts +12 -0
  43. package/dist/device/hero/hero-model.d.ts +4 -4
  44. package/dist/device/hero/hero-scene.d.ts +7 -0
  45. package/dist/device/index.d.ts +5 -1
  46. package/dist/enums/event-category.d.ts +8 -0
  47. package/dist/enums.js +1 -1
  48. package/dist/enums.mjs +1 -1
  49. package/dist/{event-category-d9kiqCqC.js → event-category-CE_VCE2G.js} +8 -0
  50. package/dist/{event-category-Dhcd0TRH.mjs → event-category-Hwx_JSCU.mjs} +8 -0
  51. package/dist/generated/addon-api.d.ts +92 -14
  52. package/dist/generated/addon-cap-facts.d.ts +1 -1
  53. package/dist/generated/cap-status-types.d.ts +3 -1
  54. package/dist/generated/cap-vocabulary.d.ts +1 -1
  55. package/dist/generated/capability-router-map.d.ts +5 -2
  56. package/dist/generated/collection-array-methods.d.ts +1 -1
  57. package/dist/generated/customize-catalog.d.ts +1 -1
  58. package/dist/generated/device-local-state.d.ts +3 -0
  59. package/dist/generated/device-proxy.d.ts +4 -1
  60. package/dist/generated/device-scoped-caps.d.ts +1 -1
  61. package/dist/generated/history-catalog.d.ts +2 -2
  62. package/dist/generated/method-access-map.d.ts +1 -1
  63. package/dist/generated/method-device-selectors.d.ts +2 -2
  64. package/dist/generated/runtime-state-durability.d.ts +1 -1
  65. package/dist/generated/system-proxy.d.ts +1 -1
  66. package/dist/{implemented-methods-C7ScGvEz.js → implemented-methods-ChtdIofW.js} +128 -1
  67. package/dist/{implemented-methods-C5FMXLGP.mjs → implemented-methods-u7ddjc-_.mjs} +57 -2
  68. package/dist/index.d.ts +7 -3
  69. package/dist/index.js +1979 -429
  70. package/dist/index.mjs +1923 -428
  71. package/dist/node.js +2 -2
  72. package/dist/node.mjs +2 -2
  73. package/dist/{sleep-DwRtgB2i.js → sleep-CsZJsb8n.js} +692 -35
  74. package/dist/{sleep-Ch7Q7UtE.mjs → sleep-D6Pih0Qt.mjs} +669 -36
  75. 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,274 @@ 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
56469
56825
  //#region src/capabilities/device-search.ts
56470
56826
  /**
56471
56827
  * `deviceManager.search` — the query behind the device → value picker.
@@ -57048,6 +57404,10 @@ var DeviceInfoSchema = zod.z.object({
57048
57404
  /** Hardware + identity blob (manufacturer / model / firmware / sn /
57049
57405
  * uid / mac / …). Populated by drivers; editable via setMetadata. */
57050
57406
  metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
57407
+ /** Provider-declared identifiers (D1059): typed, normalised, written only by
57408
+ * the owning provider via `setIdentifiers`; read-only for the operator.
57409
+ * Absent ⇒ the provider declared none. */
57410
+ identifiers: DeviceIdentifiersSchema.optional(),
57051
57411
  /** Optional upstream-system identity + rendering envelope. See
57052
57412
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
57053
57413
  sourceInfo: SourceInfoSchema.optional(),
@@ -57214,6 +57574,8 @@ var DeviceMetaSchema = zod.z.object({
57214
57574
  disabled: zod.z.boolean(),
57215
57575
  parentDeviceId: zod.z.number().nullable(),
57216
57576
  metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
57577
+ /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
57578
+ identifiers: DeviceIdentifiersSchema.optional(),
57217
57579
  /** Optional upstream-system identity + rendering envelope. See
57218
57580
  * `SourceInfo`. Present when the device has been persisted with a
57219
57581
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -57695,6 +58057,26 @@ var deviceManagerCapability = {
57695
58057
  kind: "mutation",
57696
58058
  auth: "admin"
57697
58059
  }),
58060
+ /** Declare the device's identifiers (D1059) — the typed, normalised keys
58061
+ * (`mac`, `serial`, `machine-uuid`, `vendor-uid`, `hostname`, `ip`) a later
58062
+ * step matches across integrations. Each kind is REPLACED by what this call
58063
+ * says (absent = read and found absent, removed) EXCEPT the kinds listed in
58064
+ * `unread` — the reads that FAILED this time — which keep their stored value.
58065
+ * An unchanged value keeps its first `readAt`; a call that changes nothing
58066
+ * writes and emits nothing. `null` clears every read kind. Accepted only from the provider that OWNS the device: the
58067
+ * caller stamp the transport sets (`callerAddonId`) must equal the row's
58068
+ * `addonId`, so an operator session — which carries no stamp — is refused.
58069
+ * Build the value with `normaliseIdentifiers` (`@camstack/types`); a device
58070
+ * calls it through `BaseDevice.declareIdentifiers`. */
58071
+ setIdentifiers: require_sleep.method(zod.z.object({
58072
+ deviceId: zod.z.number(),
58073
+ identifiers: DeviceIdentifiersSchema.nullable(),
58074
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
58075
+ unread: zod.z.array(DeviceIdentifierKeySchema).optional()
58076
+ }), zod.z.void(), {
58077
+ kind: "mutation",
58078
+ auth: "admin"
58079
+ }),
57698
58080
  /** Operator-curated location registry. Returns the union of:
57699
58081
  * (1) labels persisted in the registry via `addLocation`, and
57700
58082
  * (2) labels currently in use on at least one device's
@@ -64623,6 +65005,7 @@ var HERO_SCENE_BY_TYPE = {
64623
65005
  [require_composed_stable_id.DeviceType.WaterHeater]: "heater",
64624
65006
  [require_composed_stable_id.DeviceType.HeatPump]: "heat-pump",
64625
65007
  [require_composed_stable_id.DeviceType.EnergySystem]: "generic",
65008
+ [require_composed_stable_id.DeviceType.Workload]: "generic",
64626
65009
  [require_composed_stable_id.DeviceType.Fan]: "fan",
64627
65010
  [require_composed_stable_id.DeviceType.MediaPlayer]: "tv",
64628
65011
  [require_composed_stable_id.DeviceType.AlarmPanel]: "alarm",
@@ -64665,6 +65048,7 @@ var HERO_SCENE_BY_ROLE = {
64665
65048
  [require_composed_stable_id.DeviceRole.SwitchHeater]: "heater",
64666
65049
  [require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
64667
65050
  [require_composed_stable_id.DeviceRole.SwitchLight]: "light",
65051
+ [require_composed_stable_id.DeviceRole.PoePort]: "plug",
64668
65052
  [require_composed_stable_id.DeviceRole.ClimateAc]: "ac",
64669
65053
  [require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
64670
65054
  [require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
@@ -64709,7 +65093,12 @@ var HERO_SCENE_BY_ROLE = {
64709
65093
  [require_composed_stable_id.DeviceRole.MessagingNotifier]: "inherit",
64710
65094
  [require_composed_stable_id.DeviceRole.EmailNotifier]: "inherit",
64711
65095
  [require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
64712
- [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
65096
+ [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit",
65097
+ [require_composed_stable_id.DeviceRole.Vm]: "inherit",
65098
+ [require_composed_stable_id.DeviceRole.AppContainer]: "inherit",
65099
+ [require_composed_stable_id.DeviceRole.Lxc]: "inherit",
65100
+ [require_composed_stable_id.DeviceRole.App]: "inherit",
65101
+ [require_composed_stable_id.DeviceRole.Host]: "inherit"
64713
65102
  };
64714
65103
  function isDeviceType$3(type) {
64715
65104
  return Object.values(require_composed_stable_id.DeviceType).includes(type);
@@ -65057,8 +65446,12 @@ var HeroPowerSupplySlotSchema = zod.z.object({
65057
65446
  /** Off asks for a confirmation while the device runs. */
65058
65447
  confirmOffWhileRunning: zod.z.boolean(),
65059
65448
  running: zod.z.boolean().nullable(),
65060
- powerOn: HeroActionSchema,
65061
- powerOff: HeroActionSchema,
65449
+ /**
65450
+ * `null` when the linked switch ANSWERED it only reports (a PoE port seen through an
65451
+ * API key): power on / off would always be refused. The restart stays (D1058).
65452
+ */
65453
+ powerOn: HeroActionSchema.nullable(),
65454
+ powerOff: HeroActionSchema.nullable(),
65062
65455
  restart: HeroActionSchema
65063
65456
  });
65064
65457
  var HeroStateBackdropSchema = zod.z.object({
@@ -79536,6 +79929,19 @@ var NetworkLinkStatusSchema = zod.z.object({
79536
79929
  rssi: zod.z.number().optional().meta(require_sleep.readingMeta("signal-level")),
79537
79930
  /** Network name of a wireless link, when the firmware reports it. */
79538
79931
  ssid: zod.z.string().optional(),
79932
+ /**
79933
+ * Negotiated link speed of a wired port, the `bitrate` quantity in its base
79934
+ * unit, kbit/s (a gigabit port is 1 000 000); the display picks the unit.
79935
+ * `null` = the port is down or the speed is not known; absent = the provider
79936
+ * never reports one.
79937
+ */
79938
+ speedKbps: zod.z.number().nonnegative().nullable().optional().meta(require_sleep.readingMeta("bitrate")),
79939
+ /**
79940
+ * Whether the link is up. `type` names the medium, not its state, so a wired
79941
+ * port that lost its link is `ethernet` + `linkUp: false`. `null` = not known;
79942
+ * absent = the provider never reports it.
79943
+ */
79944
+ linkUp: zod.z.boolean().nullable().optional(),
79539
79945
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
79540
79946
  lastUpdated: zod.z.number().meta(require_sleep.readingMeta("none"))
79541
79947
  });
@@ -92048,7 +92454,18 @@ var videoclipsCapability = {
92048
92454
  * older than this field keeps working unchanged (D382 — an unstated
92049
92455
  * ask is zero).
92050
92456
  */
92051
- audio: ClipStreamAudioSchema.optional()
92457
+ audio: ClipStreamAudioSchema.optional(),
92458
+ /**
92459
+ * The operator's authorisation to wake a sleeping camera for this
92460
+ * dial — the same {@link ClipWakeSchema} the byte reads carry. Absent
92461
+ * — the default — means a sleeping standalone battery camera is
92462
+ * REFUSED by name before any URL is minted. A caller sets it only
92463
+ * when a viewer itself asked for the clip (the broker's `playClip`);
92464
+ * a prefetch, a reconcile or a retry never does. With it, the
92465
+ * provider wakes the camera and waits under a bound; a camera that
92466
+ * does not come up is refused `wake-timeout`, naming the wait.
92467
+ */
92468
+ wake: ClipWakeSchema.optional()
92052
92469
  }), ClipStreamDialSchema, {
92053
92470
  kind: "query",
92054
92471
  auth: "protected"
@@ -92414,7 +92831,8 @@ var ClipExportFailureSchema = zod.z.enum([
92414
92831
  "camera-refused",
92415
92832
  "fetch-failed",
92416
92833
  "too-large-to-transfer",
92417
- "wake-expired"
92834
+ "wake-expired",
92835
+ "wake-timeout"
92418
92836
  ]);
92419
92837
  /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
92420
92838
  function clipExportFailure(code, detail) {
@@ -95272,6 +95690,16 @@ var SirenOptionsSchema = zod.z.object({
95272
95690
  rangeSeconds: SirenDurationRangeSchema.nullable(),
95273
95691
  /** The camera's default duration, seconds. */
95274
95692
  defaultSeconds: zod.z.number().positive(),
95693
+ /**
95694
+ * Discrete play counts the operator may pick; `null` when the camera gives a
95695
+ * range or does not count plays. Defaults to `null` so a provider that
95696
+ * predates plays (#589) reads as declaring none.
95697
+ */
95698
+ allowedPlays: zod.z.array(zod.z.number().int().positive()).nullable().default(null),
95699
+ /** Continuous range of play counts; `null` when listed or not counted. */
95700
+ rangePlays: SirenDurationRangeSchema.nullable().default(null),
95701
+ /** The camera's default play count; `null` when the camera does not count plays. */
95702
+ defaultPlays: zod.z.number().int().positive().nullable().default(null),
95275
95703
  /** What the camera counts natively. */
95276
95704
  unit: zod.z.enum([SirenDurationUnit.Seconds, SirenDurationUnit.Plays]),
95277
95705
  /** Seconds one play lasts, when `unit` is `plays`; `null` for a seconds camera. */
@@ -95288,9 +95716,28 @@ var SirenStatusSchema = zod.z.object({
95288
95716
  activeUntil: zod.z.number().nullable(),
95289
95717
  /** Duration of the current / last activation, seconds; `null` when none yet. */
95290
95718
  durationSeconds: zod.z.number().nullable(),
95719
+ /**
95720
+ * The play count of the current / last activation when it was asked in plays;
95721
+ * `null` when it was asked in seconds (or none yet). The unit that was asked.
95722
+ */
95723
+ plays: zod.z.number().int().positive().nullable().default(null),
95724
+ /**
95725
+ * True when `activeUntil` comes from a seconds-per-play factor the camera did
95726
+ * not report — the siren may fall silent somewhat earlier or later.
95727
+ */
95728
+ activeUntilEstimated: zod.z.boolean().default(false),
95291
95729
  /** Ms epoch of the last trigger (0 = never). */
95292
95730
  lastTriggeredAt: zod.z.number()
95293
95731
  });
95732
+ /** A trigger asks seconds OR plays (#589); neither means the camera default. */
95733
+ var SirenTriggerInputSchema = zod.z.object({
95734
+ deviceId: zod.z.number().int().nonnegative(),
95735
+ durationSeconds: zod.z.number().positive().optional(),
95736
+ plays: zod.z.number().int().positive().optional()
95737
+ }).refine((input) => input.durationSeconds === void 0 || input.plays === void 0, {
95738
+ message: "a siren trigger takes durationSeconds or plays, not both",
95739
+ path: ["plays"]
95740
+ });
95294
95741
  var SirenRuntimeStateSchema = SirenStatusSchema.extend({
95295
95742
  /** Ms epoch of the last successful camera read of the options (0 = never). */
95296
95743
  lastFetchedAt: zod.z.number() });
@@ -95307,13 +95754,20 @@ var sirenCapability = {
95307
95754
  auth: "protected"
95308
95755
  }),
95309
95756
  /**
95310
- * Sound the siren. Without `durationSeconds` the camera default applies.
95311
- * Answers the state at the moment of the trigger (`activeUntil` included).
95757
+ * The play counts a rule may pick: what `getOptions` declares as a list, or
95758
+ * its range spelled out. Empty for a siren that counts seconds.
95312
95759
  */
95313
- trigger: require_sleep.method(zod.z.object({
95314
- deviceId: zod.z.number().int().nonnegative(),
95315
- durationSeconds: zod.z.number().positive().optional()
95316
- }), SirenStatusSchema, {
95760
+ getPlayChoices: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), zod.z.array(zod.z.number().int().positive()), {
95761
+ kind: "query",
95762
+ auth: "protected"
95763
+ }),
95764
+ /**
95765
+ * Sound the siren for `durationSeconds` OR `plays` — never both. With
95766
+ * neither the camera default applies. A count on a siren that declares no
95767
+ * plays is refused. Answers the state at the moment of the trigger
95768
+ * (`activeUntil` included).
95769
+ */
95770
+ trigger: require_sleep.method(SirenTriggerInputSchema, SirenStatusSchema, {
95317
95771
  kind: "mutation",
95318
95772
  auth: "protected",
95319
95773
  actions: [{
@@ -95322,6 +95776,21 @@ var sirenCapability = {
95322
95776
  phrase: require_sleep.t("Sound {device}", "Fai suonare {device}"),
95323
95777
  icon: "siren",
95324
95778
  args: {}
95779
+ }, {
95780
+ id: "siren.triggerPlays",
95781
+ label: require_sleep.t("Sound the siren N times", "Fai suonare la sirena N volte"),
95782
+ phrase: require_sleep.t("Sound {device} {plays} times", "Fai suonare {device} {plays} volte"),
95783
+ icon: "siren",
95784
+ openArgs: [{
95785
+ key: "plays",
95786
+ label: require_sleep.t("Plays", "Riproduzioni"),
95787
+ offer: {
95788
+ kind: "dynamic",
95789
+ from: "method",
95790
+ method: "getPlayChoices",
95791
+ valueKind: "number"
95792
+ }
95793
+ }]
95325
95794
  }]
95326
95795
  }),
95327
95796
  /** Silence the siren now. */
@@ -97082,6 +97551,27 @@ var SwitchStatusSchema = zod.z.object({
97082
97551
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
97083
97552
  lastChangedAt: zod.z.number()
97084
97553
  });
97554
+ /**
97555
+ * What a switch can do, from its provider (`getOptions`). A provider that writes no
97556
+ * `getOptions` is a plain on/off switch: the defaults are the old contract.
97557
+ *
97558
+ * - `supportsSetState: false` — the switch reports its state but cannot be set (a PoE port seen only
97559
+ * through an API key). Its provider refuses `setState`; these surfaces withdraw on/off once the
97560
+ * device ANSWERED this (`switchRefusesSetState`): the device hero, the automation action picker
97561
+ * (`offeredWhen` on `switch.on` / `switch.off` / `switch.toggle`), the default `toggle`, the
97562
+ * HomeKit, Alexa and Google exporters, and `power-source` on a device the switch powers
97563
+ * (`getStatus().switchSettable`, `offeredWhen` on `powerSource.on` / `.off`, `not-settable`). A
97564
+ * read that failed or is pending changes nothing (D315).
97565
+ * - `supportsPowerCycle: true` — the device behind the switch can cut and restore its own output in
97566
+ * one native call (a PoE port's power cycle). It has no control of its own: a linked
97567
+ * `power-source.forceRestart` uses it instead of off / wait / on.
97568
+ */
97569
+ var SwitchOptionsSchema = zod.z.object({
97570
+ supportsSetState: zod.z.boolean().default(true),
97571
+ supportsPowerCycle: zod.z.boolean().default(false)
97572
+ });
97573
+ /** The options of a provider that did not answer `getOptions`: a plain on/off switch. */
97574
+ var SWITCH_DEFAULT_OPTIONS = SwitchOptionsSchema.parse({});
97085
97575
  var switchCapability = {
97086
97576
  name: "switch",
97087
97577
  scope: "device",
@@ -97109,7 +97599,8 @@ var switchCapability = {
97109
97599
  field: "on",
97110
97600
  value: true
97111
97601
  },
97112
- args: { on: true }
97602
+ args: { on: true },
97603
+ offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
97113
97604
  }, {
97114
97605
  id: "switch.off",
97115
97606
  label: require_sleep.t("Turn off", "Spegni"),
@@ -97119,9 +97610,16 @@ var switchCapability = {
97119
97610
  field: "on",
97120
97611
  value: false
97121
97612
  },
97122
- args: { on: false }
97613
+ args: { on: false },
97614
+ offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
97123
97615
  }]
97124
97616
  }),
97617
+ getOptions: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), SwitchOptionsSchema, { auth: "protected" }),
97618
+ powerCycle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
97619
+ kind: "mutation",
97620
+ auth: "protected",
97621
+ notOperatorFacing: "a power cycle is the forced restart of the device the switch powers (power-source), never a step of its own"
97622
+ }),
97125
97623
  toggle: require_sleep.optionalMethod(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), {
97126
97624
  kind: "mutation",
97127
97625
  auth: "protected",
@@ -97129,7 +97627,8 @@ var switchCapability = {
97129
97627
  id: "switch.toggle",
97130
97628
  label: require_sleep.t("Toggle", "Commuta"),
97131
97629
  phrase: require_sleep.t("Toggle {device}", "Commuta {device}"),
97132
- icon: "toggle-right"
97630
+ icon: "toggle-right",
97631
+ offeredWhen: require_sleep.SWITCH_SETTABLE_GATE
97133
97632
  }]
97134
97633
  })
97135
97634
  },
@@ -97151,6 +97650,16 @@ var switchCapability = {
97151
97650
  * not need to re-query the provider after a setState mutation.
97152
97651
  */
97153
97652
  runtimeState: SwitchStatusSchema,
97653
+ composedMethods: {
97654
+ getOptions: {
97655
+ kind: "answer",
97656
+ value: SWITCH_DEFAULT_OPTIONS
97657
+ },
97658
+ powerCycle: {
97659
+ kind: "refuse",
97660
+ reason: "a composed switch has no native power cycle"
97661
+ }
97662
+ },
97154
97663
  /**
97155
97664
  * Runtime-state durability: **restored** — device state an operator reads as authoritative; 55 devices, transition-driven.
97156
97665
  *
@@ -97324,6 +97833,26 @@ var switchCapability = {
97324
97833
  "switch.off": { icon: "plug" }
97325
97834
  },
97326
97835
  state: { on: { icon: "plug-zap" } }
97836
+ },
97837
+ [require_composed_stable_id.DeviceRole.PoePort]: {
97838
+ actions: {
97839
+ "switch.on": {
97840
+ label: require_sleep.t("Power on", "Alimenta"),
97841
+ phrase: require_sleep.t("Power on {device}", "Alimenta {device}"),
97842
+ icon: "plug-zap"
97843
+ },
97844
+ "switch.off": {
97845
+ label: require_sleep.t("Power off", "Togli alimentazione"),
97846
+ phrase: require_sleep.t("Power off {device}", "Togli alimentazione a {device}"),
97847
+ icon: "unplug"
97848
+ }
97849
+ },
97850
+ state: { on: {
97851
+ label: require_sleep.t("Powered", "Alimentata"),
97852
+ whenTrue: require_sleep.t("When {device} is powered", "Quando {device} viene alimentata"),
97853
+ whenFalse: require_sleep.t("When {device} loses power", "Quando {device} perde l’alimentazione"),
97854
+ icon: "plug-zap"
97855
+ } }
97327
97856
  }
97328
97857
  }
97329
97858
  }
@@ -99212,7 +99741,6 @@ var templateCapability = {
99212
99741
  //#region src/capabilities/terminal-session.cap.ts
99213
99742
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
99214
99743
  var ProfileSettingsSchemaBridge = zod.z.unknown().nullable();
99215
- var ProfileSettingsBagSchema = zod.z.record(zod.z.string(), zod.z.unknown());
99216
99744
  /**
99217
99745
  * A live terminal session hosted by the provider addon. Output and input do
99218
99746
  * NOT flow through the capability — they use the addon data plane
@@ -99255,39 +99783,6 @@ var TerminalProfileInfoSchema = zod.z.object({
99255
99783
  /** ConfigUISchema for instance knobs, or null when the profile has none. */
99256
99784
  settingsSchema: ProfileSettingsSchemaBridge.optional()
99257
99785
  });
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
99786
  var TerminalOutputEventSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
99292
99787
  seq: zod.z.number().int().positive(),
99293
99788
  kind: zod.z.literal("data"),
@@ -99319,8 +99814,8 @@ var TerminalOutputBatchSchema = zod.z.object({
99319
99814
  * terminal-session — singleton system capability for interactive TTY sessions.
99320
99815
  *
99321
99816
  * 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.
99817
+ * Profiles are allowlisted templates; a Terminal camera is a core block naming
99818
+ * one Terminal (planning#580).
99324
99819
  */
99325
99820
  var terminalSessionCapability = {
99326
99821
  name: "terminal-session",
@@ -99329,16 +99824,6 @@ var terminalSessionCapability = {
99329
99824
  methods: {
99330
99825
  /** Pre-declared profiles the operator may open. */
99331
99826
  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
99827
  /** Live sessions currently hosted by the provider. */
99343
99828
  listSessions: require_sleep.method(zod.z.void(), zod.z.array(TerminalSessionInfoSchema).readonly(), { auth: "admin" }),
99344
99829
  /**
@@ -102551,6 +103036,534 @@ var webrtcSessionCapability = {
102551
103036
  }
102552
103037
  };
102553
103038
  //#endregion
103039
+ //#region src/capabilities/workload.cap.ts
103040
+ /**
103041
+ * Workload (#585, D1056): ONE capability for everything that runs on a machine
103042
+ * and for the machine itself — a VM, an app container, an LXC, an app, a host.
103043
+ *
103044
+ * There is no `kind` field: the device ROLE is the only discriminator. It picks
103045
+ * the wording and icons (`vocabulary.overrides.byRole`) and `deviceRoles` keeps
103046
+ * the cap on `workload` devices that carry one of the five roles.
103047
+ *
103048
+ * What a device can do is declared by its provider through `getOptions`, probed,
103049
+ * never assumed: a Docker container has no force stop, a host may offer only a
103050
+ * restart. The derived UI shows only what is declared ({@link deriveWorkloadControls}).
103051
+ *
103052
+ * A value the provider did not report is `null`, never `0` / `false` (D393);
103053
+ * `state: null` is unknown, never stopped.
103054
+ */
103055
+ /** The lifecycle of a workload. `crashed` = stopped without a request. */
103056
+ var WORKLOAD_STATES = [
103057
+ "running",
103058
+ "paused",
103059
+ "stopped",
103060
+ "starting",
103061
+ "stopping",
103062
+ "crashed"
103063
+ ];
103064
+ var WorkloadStateSchema = zod.z.enum(WORKLOAD_STATES);
103065
+ /** The five kinds of workload, as roles of the `workload` device type (D1033). */
103066
+ var WORKLOAD_ROLES = [
103067
+ require_composed_stable_id.DeviceRole.Vm,
103068
+ require_composed_stable_id.DeviceRole.AppContainer,
103069
+ require_composed_stable_id.DeviceRole.Lxc,
103070
+ require_composed_stable_id.DeviceRole.App,
103071
+ require_composed_stable_id.DeviceRole.Host
103072
+ ];
103073
+ /**
103074
+ * What the workload uses. Every value is `null` when not reported (D393). A host
103075
+ * fills `load1` and `temperature`; its uptime is `since` while it runs.
103076
+ */
103077
+ var WorkloadResourcesSchema = zod.z.object({
103078
+ /** CPU use, percent of the CPUs it may use (0–100). */
103079
+ cpuPercent: zod.z.number().nullable().meta(require_sleep.readingMeta("percentage", { precision: 1 })),
103080
+ memoryUsedBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103081
+ /**
103082
+ * Memory use, percent of `memoryLimitBytes`, for a source that reports a share
103083
+ * and not bytes (a Docker container's stats). Absent or `null` = not reported.
103084
+ */
103085
+ memoryPercent: zod.z.number().nullable().optional().meta(require_sleep.readingMeta("percentage", { precision: 1 })),
103086
+ /** The memory it may use: the limit of a container, the RAM of a VM or host. */
103087
+ memoryLimitBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103088
+ vcpus: zod.z.number().nullable().meta(require_sleep.readingMeta("count")),
103089
+ diskUsedBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103090
+ diskTotalBytes: zod.z.number().nullable().meta(require_sleep.readingMeta("information")),
103091
+ /** Network received, kbit/s. */
103092
+ netRxKbps: zod.z.number().nullable().meta(require_sleep.readingMeta("bitrate")),
103093
+ /** Network sent, kbit/s. */
103094
+ netTxKbps: zod.z.number().nullable().meta(require_sleep.readingMeta("bitrate")),
103095
+ /** One-minute load average (a host). */
103096
+ load1: zod.z.number().nullable().meta(require_sleep.readingMeta("index", { precision: 2 })),
103097
+ /** CPU / board temperature (a host). */
103098
+ temperature: zod.z.number().nullable().meta(require_sleep.readingMeta("temperature", { precision: 1 }))
103099
+ });
103100
+ var WorkloadPortProtocolSchema = zod.z.enum(["tcp", "udp"]);
103101
+ /** One published port: the workload's own port and where the host exposes it. */
103102
+ var WorkloadPortSchema = zod.z.object({
103103
+ port: zod.z.number().int().meta(require_sleep.readingMeta("none")),
103104
+ /** The host port it is published on; null = not published. */
103105
+ hostPort: zod.z.number().int().nullable().meta(require_sleep.readingMeta("none")),
103106
+ /** The host address it is bound to; null = every address. */
103107
+ hostIp: zod.z.string().nullable(),
103108
+ protocol: WorkloadPortProtocolSchema
103109
+ });
103110
+ var WorkloadStatusSchema = zod.z.object({
103111
+ /** null = unknown, never stopped (D393). */
103112
+ state: WorkloadStateSchema.nullable().meta({ label: "State" }),
103113
+ /** Epoch ms the current state began (uptime while running); null when unknown. */
103114
+ since: zod.z.number().nullable().meta(require_sleep.readingMeta("none")),
103115
+ /** The `host` device this runs on, when the provider has adopted it. */
103116
+ hostDeviceId: zod.z.number().int().nullable().meta(require_sleep.readingMeta("device")),
103117
+ /** The image a container runs (`nginx:1.27`). */
103118
+ image: zod.z.string().nullable(),
103119
+ /** The operating system (a VM, an LXC, a host). */
103120
+ os: zod.z.string().nullable(),
103121
+ /** The version or firmware it runs. */
103122
+ version: zod.z.string().nullable(),
103123
+ /** Starts with its host; null when the platform does not say. */
103124
+ autostart: zod.z.boolean().nullable(),
103125
+ resources: WorkloadResourcesSchema,
103126
+ ports: zod.z.array(WorkloadPortSchema),
103127
+ /** The addresses it is reachable on (IPs or host names). */
103128
+ addresses: zod.z.array(zod.z.string()),
103129
+ /** A newer image / version exists. Installing it stays the `update` cap. */
103130
+ updateAvailable: zod.z.boolean().nullable(),
103131
+ lastFetchedAt: zod.z.number()
103132
+ });
103133
+ /**
103134
+ * What this device can do, probed by its provider (D14 honesty): a flag is
103135
+ * `true` only when the platform really serves it for THIS device.
103136
+ */
103137
+ var WorkloadOptionsSchema = zod.z.object({
103138
+ supportsStart: zod.z.boolean(),
103139
+ supportsStop: zod.z.boolean(),
103140
+ supportsRestart: zod.z.boolean(),
103141
+ /** Pause AND resume. */
103142
+ supportsPause: zod.z.boolean(),
103143
+ supportsForceStop: zod.z.boolean(),
103144
+ hasResources: zod.z.boolean(),
103145
+ hasPorts: zod.z.boolean(),
103146
+ hasAddresses: zod.z.boolean(),
103147
+ hasAutostart: zod.z.boolean(),
103148
+ hasUpdateCheck: zod.z.boolean()
103149
+ });
103150
+ var WorkloadDeviceInputSchema = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
103151
+ var WorkloadTransitionEventDataSchema = zod.z.object({
103152
+ deviceId: zod.z.number(),
103153
+ state: WorkloadStateSchema,
103154
+ previous: WorkloadStateSchema,
103155
+ since: zod.z.number().nullable()
103156
+ });
103157
+ var WORKLOAD_ACTIONS = [
103158
+ "start",
103159
+ "stop",
103160
+ "restart",
103161
+ "pause",
103162
+ "resume",
103163
+ "forceStop"
103164
+ ];
103165
+ function actionDeclared(options, action) {
103166
+ switch (action) {
103167
+ case "start": return options.supportsStart;
103168
+ case "stop": return options.supportsStop;
103169
+ case "restart": return options.supportsRestart;
103170
+ case "pause":
103171
+ case "resume": return options.supportsPause;
103172
+ case "forceStop": return options.supportsForceStop;
103173
+ }
103174
+ }
103175
+ /** The states an action makes sense in. Unknown (`null`) allows what is not
103176
+ * state-bound, never pause / resume. */
103177
+ var ACTION_STATES = {
103178
+ start: ["stopped", "crashed"],
103179
+ stop: [
103180
+ "running",
103181
+ "paused",
103182
+ "starting"
103183
+ ],
103184
+ restart: ["running", "paused"],
103185
+ pause: ["running"],
103186
+ resume: ["paused"],
103187
+ forceStop: [
103188
+ "running",
103189
+ "paused",
103190
+ "starting",
103191
+ "stopping"
103192
+ ]
103193
+ };
103194
+ function actionEnabled(action, state) {
103195
+ if (state === null) return action !== "pause" && action !== "resume";
103196
+ return ACTION_STATES[action].includes(state);
103197
+ }
103198
+ /**
103199
+ * The controls and sections of a workload, derived from what its provider
103200
+ * declared and the state it is in. An undeclared feature is absent — never a
103201
+ * disabled button that could never work.
103202
+ */
103203
+ function deriveWorkloadControls(options, state) {
103204
+ return {
103205
+ controls: WORKLOAD_ACTIONS.filter((action) => actionDeclared(options, action)).map((action) => ({
103206
+ action,
103207
+ enabled: actionEnabled(action, state)
103208
+ })),
103209
+ sections: {
103210
+ resources: options.hasResources,
103211
+ ports: options.hasPorts,
103212
+ addresses: options.hasAddresses,
103213
+ autostart: options.hasAutostart,
103214
+ update: options.hasUpdateCheck
103215
+ }
103216
+ };
103217
+ }
103218
+ function isWorkloadSettled(state) {
103219
+ return state !== "starting" && state !== "stopping";
103220
+ }
103221
+ /**
103222
+ * The event a move from the last SETTLED state to `next` raises, or null.
103223
+ * A first sight (`previous` undefined) raises nothing: it is not a change.
103224
+ * Unknown (`next` null) raises nothing and is not remembered.
103225
+ */
103226
+ function workloadTransition(previous, next) {
103227
+ if (previous === void 0 || next === null || next === previous) return null;
103228
+ switch (next) {
103229
+ case "running":
103230
+ if (previous === "crashed") return "recovered";
103231
+ return previous === "stopped" ? "started" : null;
103232
+ case "stopped": return previous === "running" || previous === "paused" ? "stopped" : null;
103233
+ case "crashed": return "crashed";
103234
+ case "paused":
103235
+ case "starting":
103236
+ case "stopping": return null;
103237
+ }
103238
+ }
103239
+ /** The bus category of each transition. */
103240
+ var WORKLOAD_TRANSITION_CATEGORY = {
103241
+ started: require_event_category.EventCategory.WorkloadStarted,
103242
+ stopped: require_event_category.EventCategory.WorkloadStopped,
103243
+ crashed: require_event_category.EventCategory.WorkloadCrashed,
103244
+ recovered: require_event_category.EventCategory.WorkloadRecovered
103245
+ };
103246
+ var workloadCapability = {
103247
+ name: "workload",
103248
+ scope: "device",
103249
+ deviceNative: true,
103250
+ mode: "singleton",
103251
+ deviceTypes: [require_composed_stable_id.DeviceType.Workload],
103252
+ deviceRoles: { [require_composed_stable_id.DeviceType.Workload]: WORKLOAD_ROLES },
103253
+ /**
103254
+ * On / off is the state (#462): stopped or crashed is off, anything else on.
103255
+ * The owner registers `switch` through `registerPowerSwitch`; there is no
103256
+ * second on/off state. A device whose provider serves no start / stop gets no
103257
+ * switch.
103258
+ */
103259
+ power: {
103260
+ kind: "methods",
103261
+ field: "state",
103262
+ offValues: ["stopped", "crashed"],
103263
+ on: "start",
103264
+ off: "stop"
103265
+ },
103266
+ methods: {
103267
+ start: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103268
+ kind: "mutation",
103269
+ auth: "protected",
103270
+ actions: [{
103271
+ id: "workload.start",
103272
+ label: require_sleep.t("Start", "Avvia"),
103273
+ phrase: require_sleep.t("Start {device}", "Avvia {device}"),
103274
+ icon: "play",
103275
+ effect: {
103276
+ field: "state",
103277
+ value: "running"
103278
+ }
103279
+ }]
103280
+ }),
103281
+ stop: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103282
+ kind: "mutation",
103283
+ auth: "protected",
103284
+ actions: [{
103285
+ id: "workload.stop",
103286
+ label: require_sleep.t("Stop", "Arresta"),
103287
+ phrase: require_sleep.t("Stop {device}", "Arresta {device}"),
103288
+ icon: "square",
103289
+ effect: {
103290
+ field: "state",
103291
+ value: "stopped"
103292
+ }
103293
+ }]
103294
+ }),
103295
+ restart: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103296
+ kind: "mutation",
103297
+ auth: "protected",
103298
+ actions: [{
103299
+ id: "workload.restart",
103300
+ label: require_sleep.t("Restart", "Riavvia"),
103301
+ phrase: require_sleep.t("Restart {device}", "Riavvia {device}"),
103302
+ icon: "rotate-ccw"
103303
+ }]
103304
+ }),
103305
+ pause: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103306
+ kind: "mutation",
103307
+ auth: "protected",
103308
+ actions: [{
103309
+ id: "workload.pause",
103310
+ label: require_sleep.t("Pause", "Metti in pausa"),
103311
+ phrase: require_sleep.t("Pause {device}", "Metti in pausa {device}"),
103312
+ icon: "pause",
103313
+ effect: {
103314
+ field: "state",
103315
+ value: "paused"
103316
+ }
103317
+ }]
103318
+ }),
103319
+ resume: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103320
+ kind: "mutation",
103321
+ auth: "protected",
103322
+ actions: [{
103323
+ id: "workload.resume",
103324
+ label: require_sleep.t("Resume", "Riprendi"),
103325
+ phrase: require_sleep.t("Resume {device}", "Riprendi {device}"),
103326
+ icon: "circle-play",
103327
+ effect: {
103328
+ field: "state",
103329
+ value: "running"
103330
+ }
103331
+ }]
103332
+ }),
103333
+ forceStop: require_sleep.optionalMethod(WorkloadDeviceInputSchema, zod.z.void(), {
103334
+ kind: "mutation",
103335
+ auth: "admin",
103336
+ actions: [{
103337
+ id: "workload.forceStop",
103338
+ label: require_sleep.t("Force stop", "Arresto forzato"),
103339
+ phrase: require_sleep.t("Force {device} to stop", "Forza l’arresto di {device}"),
103340
+ icon: "octagon-x",
103341
+ effect: {
103342
+ field: "state",
103343
+ value: "stopped"
103344
+ }
103345
+ }]
103346
+ }),
103347
+ /** What THIS device can do, probed — the UI is derived from it. */
103348
+ getOptions: require_sleep.method(WorkloadDeviceInputSchema, WorkloadOptionsSchema, { auth: "protected" })
103349
+ },
103350
+ events: {
103351
+ onStarted: {
103352
+ data: WorkloadTransitionEventDataSchema,
103353
+ trigger: {
103354
+ category: require_event_category.EventCategory.WorkloadStarted,
103355
+ label: require_sleep.t("Started", "Avviato"),
103356
+ phrase: require_sleep.t("When {device} starts", "Quando {device} si avvia"),
103357
+ icon: "play"
103358
+ }
103359
+ },
103360
+ onStopped: {
103361
+ data: WorkloadTransitionEventDataSchema,
103362
+ trigger: {
103363
+ category: require_event_category.EventCategory.WorkloadStopped,
103364
+ label: require_sleep.t("Stopped", "Arrestato"),
103365
+ phrase: require_sleep.t("When {device} stops", "Quando {device} si arresta"),
103366
+ icon: "square"
103367
+ }
103368
+ },
103369
+ onCrashed: {
103370
+ data: WorkloadTransitionEventDataSchema,
103371
+ trigger: {
103372
+ category: require_event_category.EventCategory.WorkloadCrashed,
103373
+ label: require_sleep.t("Crashed", "Arrestato in modo anomalo"),
103374
+ phrase: require_sleep.t("When {device} stops without being asked", "Quando {device} si arresta senza che sia stato richiesto"),
103375
+ icon: "triangle-alert"
103376
+ }
103377
+ },
103378
+ onRecovered: {
103379
+ data: WorkloadTransitionEventDataSchema,
103380
+ trigger: {
103381
+ category: require_event_category.EventCategory.WorkloadRecovered,
103382
+ label: require_sleep.t("Recovered", "Ripristinato"),
103383
+ phrase: require_sleep.t("When {device} runs again after a crash", "Quando {device} riparte dopo un arresto anomalo"),
103384
+ icon: "heart-pulse"
103385
+ }
103386
+ }
103387
+ },
103388
+ status: {
103389
+ schema: WorkloadStatusSchema,
103390
+ kind: "poll"
103391
+ },
103392
+ runtimeState: WorkloadStatusSchema,
103393
+ /**
103394
+ * Runtime-state durability: **session** — the provider answers on its next
103395
+ * poll; the series are recorded, so a restart that clears the slice loses
103396
+ * nothing a reader needs. The events are judged from the first state seen.
103397
+ */
103398
+ durability: "session",
103399
+ /**
103400
+ * History (D850): the state as an enum, CPU / memory / network as gauges, so
103401
+ * the charts need no per-metric child device.
103402
+ */
103403
+ history: {
103404
+ primary: "resources.cpuPercent",
103405
+ priority: 40,
103406
+ fields: {
103407
+ state: { kind: "enum" },
103408
+ "resources.cpuPercent": {
103409
+ kind: "gauge",
103410
+ unit: "%",
103411
+ deadband: 2,
103412
+ displayName: "CPU"
103413
+ },
103414
+ "resources.memoryUsedBytes": {
103415
+ kind: "gauge",
103416
+ unit: "bytes",
103417
+ displayName: "Memory used"
103418
+ },
103419
+ "resources.memoryPercent": {
103420
+ kind: "gauge",
103421
+ unit: "%",
103422
+ deadband: 2,
103423
+ displayName: "Memory"
103424
+ },
103425
+ "resources.netRxKbps": {
103426
+ group: "network",
103427
+ kind: "gauge",
103428
+ unit: "kbps",
103429
+ displayName: "Network received"
103430
+ },
103431
+ "resources.netTxKbps": {
103432
+ group: "network",
103433
+ kind: "gauge",
103434
+ unit: "kbps",
103435
+ displayName: "Network sent"
103436
+ }
103437
+ }
103438
+ },
103439
+ volatileStateFields: ["lastFetchedAt"],
103440
+ vocabulary: {
103441
+ noun: require_sleep.t("Workload", "Carico di lavoro"),
103442
+ order: 2400,
103443
+ state: [
103444
+ {
103445
+ kind: "enum",
103446
+ field: "state",
103447
+ label: require_sleep.t("State", "Stato"),
103448
+ values: [
103449
+ {
103450
+ value: "running",
103451
+ label: require_sleep.t("Running", "In esecuzione"),
103452
+ phrase: require_sleep.t("When {device} is running", "Quando {device} è in esecuzione")
103453
+ },
103454
+ {
103455
+ value: "paused",
103456
+ label: require_sleep.t("Paused", "In pausa")
103457
+ },
103458
+ {
103459
+ value: "stopped",
103460
+ label: require_sleep.t("Stopped", "Arrestato"),
103461
+ phrase: require_sleep.t("When {device} is stopped", "Quando {device} è arrestato")
103462
+ },
103463
+ {
103464
+ value: "starting",
103465
+ label: require_sleep.t("Starting", "In avvio")
103466
+ },
103467
+ {
103468
+ value: "stopping",
103469
+ label: require_sleep.t("Stopping", "In arresto")
103470
+ },
103471
+ {
103472
+ value: "crashed",
103473
+ label: require_sleep.t("Crashed", "Arrestato in modo anomalo"),
103474
+ phrase: require_sleep.t("When {device} has crashed", "Quando {device} è arrestato in modo anomalo")
103475
+ }
103476
+ ],
103477
+ icon: "activity"
103478
+ },
103479
+ {
103480
+ kind: "numeric",
103481
+ field: "resources.cpuPercent",
103482
+ quantity: require_sleep.t("the CPU use", "l'uso della CPU"),
103483
+ label: require_sleep.t("CPU", "CPU"),
103484
+ unit: "%",
103485
+ icon: "cpu"
103486
+ },
103487
+ {
103488
+ kind: "numeric",
103489
+ field: "resources.memoryPercent",
103490
+ quantity: require_sleep.t("the memory use", "l'uso della memoria"),
103491
+ label: require_sleep.t("Memory", "Memoria"),
103492
+ unit: "%",
103493
+ icon: "memory-stick"
103494
+ },
103495
+ {
103496
+ kind: "numeric",
103497
+ field: "resources.temperature",
103498
+ quantity: require_sleep.t("the temperature", "la temperatura"),
103499
+ label: require_sleep.t("Temperature", "Temperatura"),
103500
+ unit: "°C",
103501
+ icon: "thermometer"
103502
+ }
103503
+ ],
103504
+ overrides: { byRole: {
103505
+ [require_composed_stable_id.DeviceRole.Vm]: {
103506
+ actions: { "workload.start": { icon: "monitor" } },
103507
+ state: { state: { icon: "monitor" } }
103508
+ },
103509
+ [require_composed_stable_id.DeviceRole.AppContainer]: {
103510
+ actions: { "workload.start": { icon: "container" } },
103511
+ state: { state: { icon: "container" } }
103512
+ },
103513
+ [require_composed_stable_id.DeviceRole.Lxc]: {
103514
+ actions: { "workload.start": { icon: "box" } },
103515
+ state: { state: { icon: "box" } }
103516
+ },
103517
+ [require_composed_stable_id.DeviceRole.App]: {
103518
+ actions: { "workload.start": { icon: "app-window" } },
103519
+ state: { state: { icon: "app-window" } }
103520
+ },
103521
+ [require_composed_stable_id.DeviceRole.Host]: {
103522
+ actions: {
103523
+ "workload.start": {
103524
+ label: require_sleep.t("Power on", "Accendi"),
103525
+ phrase: require_sleep.t("Power on {device}", "Accendi {device}"),
103526
+ icon: "power"
103527
+ },
103528
+ "workload.stop": {
103529
+ label: require_sleep.t("Shut down", "Spegni"),
103530
+ phrase: require_sleep.t("Shut down {device}", "Spegni {device}"),
103531
+ icon: "power-off"
103532
+ },
103533
+ "workload.restart": {
103534
+ label: require_sleep.t("Reboot", "Riavvia"),
103535
+ phrase: require_sleep.t("Reboot {device}", "Riavvia {device}"),
103536
+ icon: "refresh-cw"
103537
+ }
103538
+ },
103539
+ state: { state: { icon: "server" } },
103540
+ events: {
103541
+ onStarted: {
103542
+ label: require_sleep.t("Came online", "Tornato in linea"),
103543
+ phrase: require_sleep.t("When {device} comes online", "Quando {device} torna in linea"),
103544
+ icon: "server"
103545
+ },
103546
+ onStopped: {
103547
+ label: require_sleep.t("Shut down", "Spento"),
103548
+ phrase: require_sleep.t("When {device} shuts down", "Quando {device} si spegne"),
103549
+ icon: "server-off"
103550
+ },
103551
+ onCrashed: {
103552
+ label: require_sleep.t("Went down", "Caduto"),
103553
+ phrase: require_sleep.t("When {device} goes down unexpectedly", "Quando {device} cade inaspettatamente"),
103554
+ icon: "server-crash"
103555
+ },
103556
+ onRecovered: {
103557
+ label: require_sleep.t("Came online", "Tornato in linea"),
103558
+ phrase: require_sleep.t("When {device} comes back online after going down", "Quando {device} torna in linea dopo essere caduto"),
103559
+ icon: "server"
103560
+ }
103561
+ }
103562
+ }
103563
+ } }
103564
+ }
103565
+ };
103566
+ //#endregion
102554
103567
  //#region src/capabilities/zone-analytics.cap.ts
102555
103568
  /**
102556
103569
  * Per-zone occupancy aggregation produced by the analytics frame
@@ -103218,6 +104231,7 @@ var CAPABILITY_NAMES = {
103218
104231
  weather: "weather",
103219
104232
  weatherStation: "weather-station",
103220
104233
  webrtcSession: "webrtc-session",
104234
+ workload: "workload",
103221
104235
  zoneAnalytics: "zone-analytics",
103222
104236
  zoneRules: "zone-rules",
103223
104237
  zones: "zones"
@@ -104052,6 +105066,10 @@ var CAPABILITY_ROUTER_KEYS = [
104052
105066
  key: "webrtcSession",
104053
105067
  name: "webrtc-session"
104054
105068
  },
105069
+ {
105070
+ key: "workload",
105071
+ name: "workload"
105072
+ },
104055
105073
  {
104056
105074
  key: "zoneAnalytics",
104057
105075
  name: "zone-analytics"
@@ -104282,6 +105300,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
104282
105300
  weatherCapability,
104283
105301
  weatherStationCapability,
104284
105302
  webrtcSessionCapability,
105303
+ workloadCapability,
104285
105304
  zoneAnalyticsCapability,
104286
105305
  zoneRulesCapability,
104287
105306
  zonesCapability
@@ -106051,34 +107070,36 @@ function selectNavigationMethods(getStatus, setValue) {
106051
107070
  * Pure duration maths for the `siren` cap, shared by every provider so a
106052
107071
  * trigger and the countdown it publishes mean the same thing everywhere.
106053
107072
  */
107073
+ /** The longest range `sirenPlayChoices` spells out; a picker of more entries is not a picker. */
107074
+ var MAX_PLAY_CHOICES = 200;
106054
107075
  /** The state of a siren that is not sounding. Keeps the last activation's facts. */
106055
107076
  function sirenIdleStatus(previous) {
106056
107077
  return {
106057
107078
  active: false,
106058
107079
  activeUntil: null,
106059
107080
  durationSeconds: previous?.durationSeconds ?? null,
107081
+ plays: previous?.plays ?? null,
107082
+ activeUntilEstimated: false,
106060
107083
  lastTriggeredAt: previous?.lastTriggeredAt ?? 0
106061
107084
  };
106062
107085
  }
106063
- /** The state right after a timed trigger: sounding until `now + seconds`. */
106064
- function sirenTriggeredStatus(nowMs, seconds) {
107086
+ /**
107087
+ * The state right after a timed trigger: sounding until `now + seconds`. A
107088
+ * trigger asked in plays passes its count, and whether that end is an estimate.
107089
+ */
107090
+ function sirenTriggeredStatus(nowMs, seconds, activation) {
106065
107091
  return {
106066
107092
  active: true,
106067
107093
  activeUntil: nowMs + Math.round(seconds * 1e3),
106068
107094
  durationSeconds: seconds,
107095
+ plays: activation?.plays ?? null,
107096
+ activeUntilEstimated: activation?.estimated ?? false,
106069
107097
  lastTriggeredAt: nowMs
106070
107098
  };
106071
107099
  }
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;
107100
+ /** The nearest listed value, or the value clamped and stepped inside the range. */
107101
+ function snap(list, range, wanted) {
106080
107102
  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
107103
  if (range !== null) {
106083
107104
  const clamped = Math.min(range.max, Math.max(range.min, wanted));
106084
107105
  const steps = Math.min(Math.round((clamped - range.min) / range.step), Math.floor((range.max - range.min) / range.step));
@@ -106086,6 +107107,60 @@ function resolveSirenSeconds(options, requested) {
106086
107107
  }
106087
107108
  return wanted;
106088
107109
  }
107110
+ /**
107111
+ * The duration a trigger will really use: the request (or the camera default)
107112
+ * snapped to what the camera allows — the nearest listed value, or clamped and
107113
+ * stepped inside the range. Never longer or shorter than the camera can play.
107114
+ */
107115
+ function resolveSirenSeconds(options, requested) {
107116
+ return snap(options.allowedSeconds, options.rangeSeconds, requested ?? options.defaultSeconds);
107117
+ }
107118
+ /**
107119
+ * The play count a trigger will really use, snapped like the seconds; `null`
107120
+ * when the camera declares no plays (it counts seconds).
107121
+ */
107122
+ function resolveSirenPlays(options, requested) {
107123
+ if (options.defaultPlays === null) return null;
107124
+ return snap(options.allowedPlays, options.rangePlays, requested ?? options.defaultPlays);
107125
+ }
107126
+ /** The counts a rule may pick: the list, or the range spelled out; empty without plays. */
107127
+ function sirenPlayChoices(options) {
107128
+ if (options.allowedPlays !== null) return [...options.allowedPlays];
107129
+ const range = options.rangePlays;
107130
+ if (range === null) return [];
107131
+ const count = Math.min(MAX_PLAY_CHOICES, Math.floor((range.max - range.min) / range.step) + 1);
107132
+ return Array.from({ length: count }, (_, i) => range.min + i * range.step);
107133
+ }
107134
+ /** Whether an end computed through `secondsPerPlay` is an estimate. */
107135
+ function playsEndIsEstimate(options) {
107136
+ return options.source !== SirenOptionsSource.Camera;
107137
+ }
107138
+ /**
107139
+ * Decides a trigger: a count on a siren that declares no plays is refused; a
107140
+ * count is snapped and timed through `secondsPerPlay`; seconds keep the old
107141
+ * snapping. Never both — the input schema refuses that before it gets here.
107142
+ */
107143
+ function planSirenTrigger(options, request) {
107144
+ if (request.plays !== void 0) {
107145
+ const plays = resolveSirenPlays(options, request.plays);
107146
+ if (plays === null) return {
107147
+ asked: "refused",
107148
+ reason: "this siren counts seconds, not plays"
107149
+ };
107150
+ const factor = options.secondsPerPlay;
107151
+ return {
107152
+ asked: "plays",
107153
+ plays,
107154
+ seconds: factor === null ? null : plays * factor,
107155
+ estimated: factor === null || playsEndIsEstimate(options)
107156
+ };
107157
+ }
107158
+ return {
107159
+ asked: "seconds",
107160
+ seconds: resolveSirenSeconds(options, request.durationSeconds),
107161
+ estimated: options.unit === "plays" && playsEndIsEstimate(options)
107162
+ };
107163
+ }
106089
107164
  //#endregion
106090
107165
  //#region src/capabilities/recording-onboard-rules.ts
106091
107166
  /** Minutes in a day. `endMinute === 1440` means "to end of day". */
@@ -109122,6 +110197,444 @@ function runningFollowsSwitch(composition) {
109122
110197
  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
110198
  }
109124
110199
  //#endregion
110200
+ //#region src/device/declared-device.ts
110201
+ /** Marker written to a declared integration's `info`. */
110202
+ var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
110203
+ /**
110204
+ * Give a declared integration its instance record, ONCE. The record is read first and left
110205
+ * exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
110206
+ * never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
110207
+ * True when the record was written by this call.
110208
+ */
110209
+ async function seedInstanceOnce(instances, seed) {
110210
+ const existing = await instances.getInstance({ id: seed.id });
110211
+ if (existing !== null && existing !== void 0) return false;
110212
+ await instances.createInstance({
110213
+ id: seed.id,
110214
+ name: seed.name
110215
+ });
110216
+ return true;
110217
+ }
110218
+ /**
110219
+ * Strip the `<node>/<addon>` suffix a forked child carries.
110220
+ *
110221
+ * Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
110222
+ * that was supposed to act — because on the hub it reads `hub/<addon>`.
110223
+ */
110224
+ function declarationOwnerNodeId(localNodeId) {
110225
+ const raw = localNodeId ?? "hub";
110226
+ if (!raw.includes("/")) return raw;
110227
+ return raw.split("/")[0] ?? "hub";
110228
+ }
110229
+ /** Cap on how many rows one withdrawal pass may delete. */
110230
+ var DECLARED_DEVICE_SWEEP_LIMIT = 32;
110231
+ /**
110232
+ * The one way an addon owns a device it declares.
110233
+ *
110234
+ * Construct once with the addon's ports, then call {@link reconcile} on boot and
110235
+ * on every convergence tick. There is no second get-or-create helper — a guard
110236
+ * in `scripts/` enforces that.
110237
+ */
110238
+ var DeclaredDevices = class {
110239
+ ports;
110240
+ constructor(ports) {
110241
+ const addonId = ports.addonId;
110242
+ 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\`.`);
110243
+ this.ports = ports;
110244
+ }
110245
+ /**
110246
+ * Converge the declared set. Idempotent, and safe to call repeatedly.
110247
+ *
110248
+ * Throws only what the ports throw on the FIRST index read; every other
110249
+ * failure is per-device and logged, so one bad declaration never takes the
110250
+ * others down.
110251
+ */
110252
+ async reconcile(spec) {
110253
+ if ((spec.placement ?? "hub") === "hub") {
110254
+ const nodeId = declarationOwnerNodeId(this.ports.localNodeId);
110255
+ if (nodeId !== "hub") {
110256
+ this.ports.logger.info("declared devices are hub-owned — skipping on this node", { meta: {
110257
+ nodeId,
110258
+ rawNodeId: this.ports.localNodeId ?? null
110259
+ } });
110260
+ return {
110261
+ integrationId: null,
110262
+ devices: [],
110263
+ removed: [],
110264
+ owned: false
110265
+ };
110266
+ }
110267
+ }
110268
+ let integrationId;
110269
+ if (spec.integrationId !== void 0) integrationId = spec.integrationId;
110270
+ else {
110271
+ const own = await this.ensureIntegration(spec.integrationName);
110272
+ integrationId = own.id;
110273
+ await this.seedInstance(own);
110274
+ }
110275
+ const index = await this.readIndex();
110276
+ const live = await this.readLiveByStableId();
110277
+ const outcomes = [];
110278
+ for (const declaration of spec.devices) {
110279
+ const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
110280
+ if (outcome !== null) outcomes.push(outcome);
110281
+ }
110282
+ const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
110283
+ return {
110284
+ integrationId,
110285
+ devices: outcomes,
110286
+ removed,
110287
+ owned: true
110288
+ };
110289
+ }
110290
+ /**
110291
+ * Get-or-create the FIXED integration, and RE-ASSERT the flag every pass.
110292
+ *
110293
+ * The re-assertion is the fix for the defect the hand-rolled version shipped
110294
+ * with: writing `info.fixed` only on the create path left every pre-existing
110295
+ * install without it, and the kernel kept offering to delete an integration
110296
+ * the addon owns.
110297
+ */
110298
+ async ensureIntegration(integrationName) {
110299
+ const existing = await this.ports.getIntegration(this.ports.addonId);
110300
+ if (existing === null) {
110301
+ const created = await this.ports.createIntegration({
110302
+ addonId: this.ports.addonId,
110303
+ name: integrationName,
110304
+ info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
110305
+ });
110306
+ this.ports.logger.info("declared a fixed integration", { meta: {
110307
+ integrationId: created.id,
110308
+ name: integrationName
110309
+ } });
110310
+ return {
110311
+ id: created.id,
110312
+ name: integrationName
110313
+ };
110314
+ }
110315
+ if (existing.info?.["fixed"] !== true) {
110316
+ await this.ports.updateIntegration({
110317
+ id: existing.id,
110318
+ info: { [DECLARED_INTEGRATION_FIXED_KEY]: true }
110319
+ });
110320
+ this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
110321
+ }
110322
+ return {
110323
+ id: existing.id,
110324
+ name: existing.name ?? integrationName
110325
+ };
110326
+ }
110327
+ /** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
110328
+ async seedInstance(integration) {
110329
+ const { seedInstance } = this.ports;
110330
+ if (seedInstance === void 0) return;
110331
+ try {
110332
+ await seedInstance({
110333
+ id: integration.id,
110334
+ name: integration.name
110335
+ });
110336
+ } catch (err) {
110337
+ this.ports.logger.warn("could not seed the instance record of a declared integration", {
110338
+ tags: { integrationId: integration.id },
110339
+ meta: { error: require_composed_stable_id.errMsg(err) }
110340
+ });
110341
+ }
110342
+ }
110343
+ async readIndex() {
110344
+ const rows = await this.ports.listOwnDevices();
110345
+ return new Map(rows.map((row) => [row.stableId, row]));
110346
+ }
110347
+ /**
110348
+ * Devices this kernel already has CONSTRUCTED, by stableId.
110349
+ *
110350
+ * Distinct from {@link readIndex}, and the distinction is the bug: the index
110351
+ * is persisted rows, this is live objects. A row without an object must be
110352
+ * adopted; an object must be left exactly as it is.
110353
+ *
110354
+ * Failure is non-fatal and deliberately so — an empty map degrades to the
110355
+ * previous behaviour (attempt the adopt) rather than skipping a device that
110356
+ * genuinely needs bringing up.
110357
+ */
110358
+ async readLiveByStableId() {
110359
+ try {
110360
+ const devices = await this.ports.devices.getAll();
110361
+ return new Map(devices.map((device) => [device.stableId, device]));
110362
+ } catch (err) {
110363
+ this.ports.logger.warn("could not read live devices — falling back to adopt-by-row", { meta: { error: err instanceof Error ? err.message : String(err) } });
110364
+ return /* @__PURE__ */ new Map();
110365
+ }
110366
+ }
110367
+ /**
110368
+ * One declaration: adopt what exists, create what does not.
110369
+ *
110370
+ * The create branch is the destructive one — it seeds `initialMeta`, and
110371
+ * `initialMeta.name` lands as an unconditional `setName`. A transiently empty
110372
+ * index therefore looks exactly like a first boot and would silently re-stamp
110373
+ * the declared name over the operator's rename. D49: that branch needs a
110374
+ * second read to agree.
110375
+ */
110376
+ async applyDeclaration(declaration, integrationId, index, live) {
110377
+ try {
110378
+ const alreadyLive = live.get(declaration.stableId);
110379
+ if (alreadyLive !== void 0) return {
110380
+ stableId: declaration.stableId,
110381
+ deviceId: alreadyLive.id,
110382
+ device: alreadyLive,
110383
+ created: false
110384
+ };
110385
+ let existing = index.get(declaration.stableId);
110386
+ if (existing === void 0) {
110387
+ existing = (await this.readIndex()).get(declaration.stableId);
110388
+ if (existing !== void 0) this.ports.logger.warn("device index disagreed with itself — adopting instead of re-creating", {
110389
+ tags: { deviceId: existing.id },
110390
+ meta: {
110391
+ stableId: declaration.stableId,
110392
+ addonId: this.ports.addonId
110393
+ }
110394
+ });
110395
+ }
110396
+ if (existing !== void 0) {
110397
+ const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, {}, null, void 0);
110398
+ this.ports.logger.info("declared device adopted", {
110399
+ tags: { deviceId: device.id },
110400
+ meta: {
110401
+ stableId: declaration.stableId,
110402
+ integrationId
110403
+ }
110404
+ });
110405
+ return {
110406
+ stableId: declaration.stableId,
110407
+ deviceId: device.id,
110408
+ device,
110409
+ created: false
110410
+ };
110411
+ }
110412
+ const device = await this.ports.devices.create(declaration.stableId, declaration.DeviceClass, declaration.config ?? {}, null, {
110413
+ type: declaration.type,
110414
+ name: declaration.name,
110415
+ integrationId,
110416
+ ...declaration.role === void 0 ? {} : { role: declaration.role }
110417
+ });
110418
+ this.ports.logger.info("declared device created", {
110419
+ tags: { deviceId: device.id },
110420
+ meta: {
110421
+ stableId: declaration.stableId,
110422
+ integrationId
110423
+ }
110424
+ });
110425
+ return {
110426
+ stableId: declaration.stableId,
110427
+ deviceId: device.id,
110428
+ device,
110429
+ created: true
110430
+ };
110431
+ } catch (err) {
110432
+ this.ports.logger.warn("a declared device could not be brought up", { meta: {
110433
+ stableId: declaration.stableId,
110434
+ error: err instanceof Error ? err.message : String(err)
110435
+ } });
110436
+ return null;
110437
+ }
110438
+ }
110439
+ /**
110440
+ * Remove rows under the addon's FIXED integration whose declaration is gone.
110441
+ *
110442
+ * Bounded to that integration: a declared integration has no operator
110443
+ * add-flow, so every row under it got there by declaration. Devices this
110444
+ * addon owns OUTSIDE it (a provider's adopted devices) are never candidates.
110445
+ *
110446
+ * Bounded in count, and every deletion is logged with its `deviceId` — a
110447
+ * withdrawal that removes an operator-visible row silently is the failure
110448
+ * mode, not the removal itself.
110449
+ */
110450
+ async sweepWithdrawn(declarations, integrationId, index) {
110451
+ const declared = new Set(declarations.map((d) => d.stableId));
110452
+ const candidates = [...index.values()].filter((row) => row.integrationId === integrationId && !declared.has(row.stableId));
110453
+ if (candidates.length === 0) return [];
110454
+ if (candidates.length > 32) {
110455
+ this.ports.logger.warn("withdrawal sweep exceeded its bound — removing nothing", { meta: {
110456
+ integrationId,
110457
+ candidates: candidates.length,
110458
+ bound: 32
110459
+ } });
110460
+ return [];
110461
+ }
110462
+ const removed = [];
110463
+ for (const row of candidates) try {
110464
+ await this.ports.devices.remove(row.id);
110465
+ removed.push(row.id);
110466
+ this.ports.logger.info("declared device removed — its declaration was withdrawn", {
110467
+ tags: { deviceId: row.id },
110468
+ meta: {
110469
+ stableId: row.stableId,
110470
+ integrationId
110471
+ }
110472
+ });
110473
+ } catch (err) {
110474
+ this.ports.logger.warn("a withdrawn declared device could not be removed", {
110475
+ tags: { deviceId: row.id },
110476
+ meta: {
110477
+ stableId: row.stableId,
110478
+ error: err instanceof Error ? err.message : String(err)
110479
+ }
110480
+ });
110481
+ }
110482
+ return removed;
110483
+ }
110484
+ };
110485
+ //#endregion
110486
+ //#region src/composition/engine-hosted-blocks.ts
110487
+ function isSpecOfKind(spec, kind) {
110488
+ return spec !== void 0 && spec.kind === kind;
110489
+ }
110490
+ /**
110491
+ * The blocks of `kind` whose composer row exists. A block whose row the
110492
+ * composer has not declared yet is left out: nothing can be hosted on it until
110493
+ * its next apply, and the next pass picks it up.
110494
+ */
110495
+ function selectEngineHostedBlocks(kind, compositions, composerRows) {
110496
+ if (compositions.state === "not-loaded") return {
110497
+ kind: "untrusted",
110498
+ reason: compositions.reason
110499
+ };
110500
+ const rowByStableId = new Map(composerRows.map((row) => [row.stableId, row]));
110501
+ const blocks = [];
110502
+ for (const view of compositions.views) {
110503
+ const block = view.block;
110504
+ const composition = block.source?.kind === "composition" ? block.source.composition : null;
110505
+ if (composition === null) continue;
110506
+ const spec = composition.helper;
110507
+ if (!isSpecOfKind(spec, kind)) continue;
110508
+ const stableId = `${require_composed_stable_id.COMPOSED_DEVICE_STABLE_ID_PREFIX}${block.id}`;
110509
+ const row = rowByStableId.get(stableId);
110510
+ if (row === void 0) continue;
110511
+ blocks.push({
110512
+ blockId: block.id,
110513
+ deviceId: row.id,
110514
+ stableId,
110515
+ name: block.name,
110516
+ enabled: block.enabled,
110517
+ updatedAt: block.updatedAt,
110518
+ composition,
110519
+ spec
110520
+ });
110521
+ }
110522
+ return {
110523
+ kind: "trusted",
110524
+ blocks
110525
+ };
110526
+ }
110527
+ var WITHDRAWAL_CONFIRMATIONS = 2;
110528
+ /**
110529
+ * D49 for an engine's hosted set: a block missing from ONE trusted read is
110530
+ * kept; a second consecutive trusted read that agrees withdraws it. An
110531
+ * untrusted read is never fed here, so it neither counts nor resets.
110532
+ */
110533
+ var HostedWithdrawalGate = class {
110534
+ misses = /* @__PURE__ */ new Map();
110535
+ /**
110536
+ * `hosted`: what the engine serves now; `present`: what this trusted read
110537
+ * names. Returns the ids to withdraw now, and the ids kept on a first miss.
110538
+ */
110539
+ judge(hosted, present) {
110540
+ const withdraw = [];
110541
+ const held = [];
110542
+ const misses = /* @__PURE__ */ new Map();
110543
+ for (const id of hosted) {
110544
+ if (present.has(id)) continue;
110545
+ const count = (this.misses.get(id) ?? 0) + 1;
110546
+ if (count < WITHDRAWAL_CONFIRMATIONS) {
110547
+ held.push(id);
110548
+ misses.set(id, count);
110549
+ } else withdraw.push(id);
110550
+ }
110551
+ this.misses = misses;
110552
+ return {
110553
+ withdraw,
110554
+ held
110555
+ };
110556
+ }
110557
+ };
110558
+ /**
110559
+ * Build `DeviceClass` on the composer's row `(stableId, id)`. The context is
110560
+ * `loadContext` (D677: a caller that BUILDS a device hydrates its stored
110561
+ * runtime state first); a kernel without it is refused by name rather than
110562
+ * building on an empty state. The device is never `register`ed and its config
110563
+ * never persisted: the row, its name and its lifetime are the composer's.
110564
+ */
110565
+ async function hostEngineDevice(devices, row, config, DeviceClass) {
110566
+ 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`);
110567
+ const base = await devices.loadContext(row.stableId, row.id, null, config);
110568
+ const registered = [];
110569
+ const device = new DeviceClass({
110570
+ ...base,
110571
+ registerNativeCap: (cap, provider) => {
110572
+ base.registerNativeCap(cap, provider);
110573
+ registered.push(cap.name);
110574
+ }
110575
+ });
110576
+ return {
110577
+ device,
110578
+ withdraw: async () => {
110579
+ await device.removeDevice();
110580
+ for (const capName of registered) base.unregisterNativeCap?.(capName);
110581
+ }
110582
+ };
110583
+ }
110584
+ /**
110585
+ * Whether an engine may stop sweeping: only once a pass found no old row left.
110586
+ * `none` is not done — a registry that has not answered the integration yet
110587
+ * reads as null too, and the sweep is one indexed read per pass.
110588
+ */
110589
+ function legacySweepDone(sweep) {
110590
+ return sweep.kind === "swept" && sweep.drained;
110591
+ }
110592
+ /**
110593
+ * The legacy rows, one bounded batch at a time: only the rows under the old
110594
+ * integration, ordered by id, at most `DECLARED_DEVICE_SWEEP_LIMIT` — a large
110595
+ * leftover set drains over passes instead of being refused whole by the
110596
+ * sweep's own bound.
110597
+ */
110598
+ function legacyEngineRowsIndex(rows, integrationId) {
110599
+ return rows.filter((row) => row.integrationId === integrationId).toSorted((left, right) => left.id - right.id).slice(0, 32);
110600
+ }
110601
+ /**
110602
+ * Remove every camera row an engine declared itself before its cameras were
110603
+ * blocks, unconditionally, through the declared sweep (`removeDevice` →
110604
+ * tombstone, D865). No integration means nothing was ever declared, and
110605
+ * nothing is minted to find out. A failed read throws: the caller retries.
110606
+ */
110607
+ async function sweepLegacyEngineRows(ports, integrationName) {
110608
+ const integration = await ports.getIntegration(ports.addonId);
110609
+ if (integration === null) return { kind: "none" };
110610
+ let found = 0;
110611
+ return {
110612
+ kind: "swept",
110613
+ removed: (await new DeclaredDevices({
110614
+ logger: ports.logger,
110615
+ addonId: ports.addonId,
110616
+ devices: ports.devices,
110617
+ localNodeId: ports.localNodeId,
110618
+ getIntegration: async () => integration,
110619
+ createIntegration: async () => {
110620
+ throw new Error(`${ports.addonId}: the legacy sweep never mints an integration`);
110621
+ },
110622
+ updateIntegration: async () => void 0,
110623
+ listOwnDevices: async () => {
110624
+ const index = legacyEngineRowsIndex(await ports.listAddonRows(ports.addonId), integration.id);
110625
+ found = index.length;
110626
+ return index;
110627
+ }
110628
+ }).reconcile({
110629
+ integrationName,
110630
+ integrationId: integration.id,
110631
+ placement: "hub",
110632
+ devices: []
110633
+ })).removed,
110634
+ drained: found === 0
110635
+ };
110636
+ }
110637
+ //#endregion
109125
110638
  //#region src/composition/composition-link-kinds.ts
109126
110639
  /**
109127
110640
  * Every link a device keeps in its STORED composition that a surface must
@@ -111920,11 +113433,67 @@ var DEVICE_LOCAL_STATE_CAPS = {
111920
113433
  waterHeater: waterHeaterCapability,
111921
113434
  weather: weatherCapability,
111922
113435
  weatherStation: weatherStationCapability,
113436
+ workload: workloadCapability,
111923
113437
  zoneAnalytics: zoneAnalyticsCapability,
111924
113438
  zoneRules: zoneRulesCapability,
111925
113439
  zones: zonesCapability
111926
113440
  };
111927
113441
  //#endregion
113442
+ //#region src/device/declare-identifiers.ts
113443
+ /**
113444
+ * Normalise `raw` and declare it: every kind it carries replaces the stored one,
113445
+ * every kind it lacks is removed, except the kinds in `options.unread` (a failed
113446
+ * read keeps what was stored) — pass everything the provider read in one call.
113447
+ */
113448
+ async function declareDeviceIdentifiers(deps, raw, options = {}) {
113449
+ const { deviceId, logger, writer } = deps;
113450
+ const { unread, ...normaliseOptions } = options;
113451
+ const { identifiers, rejected } = normaliseIdentifiers(raw, normaliseOptions);
113452
+ for (const r of rejected) logger.warn("identifier refused — not declared", {
113453
+ tags: { deviceId },
113454
+ meta: {
113455
+ key: r.key,
113456
+ value: r.value,
113457
+ reason: r.reason
113458
+ }
113459
+ });
113460
+ const unreadKinds = new Set(unread ?? []);
113461
+ if (isEmptyIdentifiers(identifiers) && DEVICE_IDENTIFIER_KEYS.every((key) => unreadKinds.has(key))) {
113462
+ logger.debug("no identifier read — nothing declared", { tags: { deviceId } });
113463
+ return {
113464
+ outcome: "nothing-to-declare",
113465
+ identifiers
113466
+ };
113467
+ }
113468
+ if (writer === void 0) {
113469
+ logger.warn("identifiers not declared — device-manager unreachable", { tags: { deviceId } });
113470
+ return {
113471
+ outcome: "unavailable",
113472
+ identifiers
113473
+ };
113474
+ }
113475
+ try {
113476
+ await writer.mutate({
113477
+ deviceId,
113478
+ identifiers,
113479
+ ...unread !== void 0 && unread.length > 0 ? { unread } : {}
113480
+ });
113481
+ return {
113482
+ outcome: "declared",
113483
+ identifiers
113484
+ };
113485
+ } catch (err) {
113486
+ logger.warn("identifiers not declared — setIdentifiers failed", {
113487
+ tags: { deviceId },
113488
+ meta: { error: require_composed_stable_id.errMsg(err) }
113489
+ });
113490
+ return {
113491
+ outcome: "failed",
113492
+ identifiers
113493
+ };
113494
+ }
113495
+ }
113496
+ //#endregion
111928
113497
  //#region src/device/device-error-episode.ts
111929
113498
  /**
111930
113499
  * The edge between two readings, or `null` for no edge.
@@ -111980,6 +113549,8 @@ var BaseDevice = class {
111980
113549
  id;
111981
113550
  stableId;
111982
113551
  type;
113552
+ /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
113553
+ statusIsExternal;
111983
113554
  name;
111984
113555
  parentDeviceId;
111985
113556
  role;
@@ -112128,21 +113699,26 @@ var BaseDevice = class {
112128
113699
  };
112129
113700
  this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
112130
113701
  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
- });
113702
+ this.statusIsExternal = options.deviceStatus === "external";
113703
+ if (!this.statusIsExternal) ctx.registerNativeCap?.(deviceStatusCapability, {});
113704
+ if (!this.statusIsExternal) {
113705
+ const seed = {
113706
+ online: true,
113707
+ lastChangedAt: Date.now()
113708
+ };
113709
+ this.runtimeState.setCapState("device-status", seed);
113710
+ }
113711
+ if (!this.statusIsExternal) {
113712
+ ctx.registerNativeCap?.(featureProbeCapability, {});
113713
+ this.runtimeState.setCapState("feature-probe", {
113714
+ flags: {},
113715
+ deviceType: null,
113716
+ model: null,
113717
+ channelCount: null,
113718
+ lastProbedAt: 0,
113719
+ lastFetchedAt: 0
113720
+ });
113721
+ }
112146
113722
  }
112147
113723
  deviceActions = /* @__PURE__ */ new Map();
112148
113724
  /** Declare a device custom action + its typed handler. Idempotent per name. */
@@ -112170,7 +113746,7 @@ var BaseDevice = class {
112170
113746
  * override to gate side effects on the transition.
112171
113747
  */
112172
113748
  markOnline(online) {
112173
- if (this.online === online) return;
113749
+ if (this.statusIsExternal || this.online === online) return;
112174
113750
  const next = {
112175
113751
  online,
112176
113752
  lastChangedAt: Date.now()
@@ -112240,6 +113816,24 @@ var BaseDevice = class {
112240
113816
  }));
112241
113817
  }
112242
113818
  /**
113819
+ * Declare this device's identifiers (D1059): MAC(s), serial, vendor uid,
113820
+ * machine uuid, hostname, IP — what a later step matches across integrations.
113821
+ * Normalises `raw` (`normaliseIdentifiers`), logs every refused value, and
113822
+ * writes the result through `device-manager.setIdentifiers`, which accepts it
113823
+ * only from the provider that owns this device. Each kind it carries replaces
113824
+ * the stored one and each kind it lacks is removed — except the kinds listed in
113825
+ * `options.unread` (reads that FAILED), which keep their stored value. Pass
113826
+ * everything read in one call; a call where every kind is unread writes
113827
+ * nothing. Best-effort: never throws.
113828
+ */
113829
+ async declareIdentifiers(raw, options) {
113830
+ return declareDeviceIdentifiers({
113831
+ deviceId: this.id,
113832
+ logger: this.ctx.logger,
113833
+ writer: this.ctx.api.deviceManager?.setIdentifiers
113834
+ }, raw, options);
113835
+ }
113836
+ /**
112243
113837
  * Re-publish the device's current `features` array to the persisted
112244
113838
  * meta blob. Drivers call this after a probe finishes when the live
112245
113839
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -112444,6 +114038,7 @@ var BaseDevice = class {
112444
114038
  * `lastProbedAt`) once their probe actually succeeds.
112445
114039
  */
112446
114040
  async onProbe() {
114041
+ if (this.statusIsExternal) return;
112447
114042
  const base = this.runtimeState.getCapState("feature-probe") ?? {
112448
114043
  flags: {},
112449
114044
  deviceType: null,
@@ -113654,292 +115249,6 @@ function legacyAutoLinkIds(params) {
113654
115249
  return [...ids];
113655
115250
  }
113656
115251
  //#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
115252
  //#region src/device/block-declared-devices.ts
113944
115253
  /**
113945
115254
  * Helper for core-block scripts that declare devices on the shared Blocks
@@ -114109,6 +115418,7 @@ var DEVICE_TYPE_CONTROL_KIND = {
114109
115418
  [require_composed_stable_id.DeviceType.WaterHeater]: "water-heater",
114110
115419
  [require_composed_stable_id.DeviceType.HeatPump]: "dummy",
114111
115420
  [require_composed_stable_id.DeviceType.EnergySystem]: "energy-system",
115421
+ [require_composed_stable_id.DeviceType.Workload]: "workload",
114112
115422
  [require_composed_stable_id.DeviceType.Camera]: "dummy",
114113
115423
  [require_composed_stable_id.DeviceType.Switch]: "switch",
114114
115424
  [require_composed_stable_id.DeviceType.Siren]: "switch",
@@ -116525,10 +117835,12 @@ function durationText(seconds) {
116525
117835
  const text = `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")}`;
116526
117836
  return require_sleep.t(text, text);
116527
117837
  }
116528
- var switchContribution = contribution("switch", SwitchStatusSchema, (slice) => {
117838
+ var switchContribution = contribution("switch", SwitchStatusSchema, (slice, ctx) => {
116529
117839
  const on = slice?.on ?? null;
117840
+ const state = reading("switch", on === null ? "unknown" : on ? "on" : "off");
117841
+ if (ctx.switchOptions?.supportsSetState === false) return { reading: state };
116530
117842
  return {
116531
- reading: reading("switch", on === null ? "unknown" : on ? "on" : "off"),
117843
+ reading: state,
116532
117844
  ownPower: {
116533
117845
  source: "switch",
116534
117846
  on,
@@ -116738,14 +118050,17 @@ var timedRunContribution = contribution("timed-run", TimedRunStatusSchema, (slic
116738
118050
  tiles: armed
116739
118051
  };
116740
118052
  });
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
- } }));
118053
+ var powerSourceContribution = contribution("power-source", PowerSourceStateSchema, (slice, ctx) => {
118054
+ const settable = ctx.powerSupplySettable !== false;
118055
+ return { powerSupply: {
118056
+ on: slice?.switchOn ?? null,
118057
+ confirmOffWhileRunning: ctx.running === true,
118058
+ running: ctx.running ?? null,
118059
+ powerOn: settable ? action("power-supply.on", require_sleep.t("Power on", "Alimenta"), "plug", "power-source", "powerOn") : null,
118060
+ powerOff: settable ? action("power-supply.off", require_sleep.t("Power off", "Togli alimentazione"), "plug-zap", "power-source", "powerOff", {}, "normal", "off-while-running") : null,
118061
+ restart: action("power-supply.restart", require_sleep.t("Restart", "Riavvia"), "rotate-cw", "power-source", "forceRestart")
118062
+ } };
118063
+ });
116749
118064
  /** The remote cap has no status: the model's input carries how many commands it holds. */
116750
118065
  var remoteContribution = {
116751
118066
  cap: "remote",
@@ -117164,6 +118479,7 @@ var HERO_LAYOUT_BY_TYPE = {
117164
118479
  [require_composed_stable_id.DeviceType.WaterHeater]: CLIMATE_LAYOUT,
117165
118480
  [require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LAYOUT,
117166
118481
  [require_composed_stable_id.DeviceType.EnergySystem]: HERO_LAYOUT_DEFAULT,
118482
+ [require_composed_stable_id.DeviceType.Workload]: HERO_LAYOUT_DEFAULT,
117167
118483
  [require_composed_stable_id.DeviceType.Fan]: FAN_LAYOUT,
117168
118484
  [require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LAYOUT,
117169
118485
  [require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LAYOUT,
@@ -117890,6 +119206,7 @@ var HERO_LOOK_BY_TYPE = {
117890
119206
  [require_composed_stable_id.DeviceType.WaterHeater]: WATER_HEATER_LOOK,
117891
119207
  [require_composed_stable_id.DeviceType.HeatPump]: HEAT_PUMP_LOOK,
117892
119208
  [require_composed_stable_id.DeviceType.EnergySystem]: HERO_LOOK_DEFAULT,
119209
+ [require_composed_stable_id.DeviceType.Workload]: HERO_LOOK_DEFAULT,
117893
119210
  [require_composed_stable_id.DeviceType.Fan]: FAN_LOOK,
117894
119211
  [require_composed_stable_id.DeviceType.MediaPlayer]: MEDIA_PLAYER_LOOK,
117895
119212
  [require_composed_stable_id.DeviceType.AlarmPanel]: ALARM_LOOK,
@@ -117932,6 +119249,7 @@ var HERO_LOOK_BY_ROLE = {
117932
119249
  [require_composed_stable_id.DeviceRole.SwitchHeater]: HEATER_LOOK,
117933
119250
  [require_composed_stable_id.DeviceRole.SwitchFan]: FAN_LOOK,
117934
119251
  [require_composed_stable_id.DeviceRole.SwitchLight]: LIGHT_LOOK,
119252
+ [require_composed_stable_id.DeviceRole.PoePort]: "inherit",
117935
119253
  [require_composed_stable_id.DeviceRole.ClimateAc]: "inherit",
117936
119254
  [require_composed_stable_id.DeviceRole.ClimateThermostat]: "inherit",
117937
119255
  [require_composed_stable_id.DeviceRole.ClimateFloor]: "inherit",
@@ -117976,7 +119294,12 @@ var HERO_LOOK_BY_ROLE = {
117976
119294
  [require_composed_stable_id.DeviceRole.MessagingNotifier]: "inherit",
117977
119295
  [require_composed_stable_id.DeviceRole.EmailNotifier]: "inherit",
117978
119296
  [require_composed_stable_id.DeviceRole.GenericNotifier]: "inherit",
117979
- [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit"
119297
+ [require_composed_stable_id.DeviceRole.IrTransmitter]: "inherit",
119298
+ [require_composed_stable_id.DeviceRole.Vm]: "inherit",
119299
+ [require_composed_stable_id.DeviceRole.AppContainer]: "inherit",
119300
+ [require_composed_stable_id.DeviceRole.Lxc]: "inherit",
119301
+ [require_composed_stable_id.DeviceRole.App]: "inherit",
119302
+ [require_composed_stable_id.DeviceRole.Host]: "inherit"
117980
119303
  };
117981
119304
  function isDeviceType$1(type) {
117982
119305
  return Object.values(require_composed_stable_id.DeviceType).includes(type);
@@ -118023,16 +119346,6 @@ function resolveOwnPower(offers) {
118023
119346
  }
118024
119347
  //#endregion
118025
119348
  //#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
119349
  /** The first source with a known answer wins. */
118037
119350
  var STATE_SOURCE_ORDER = [
118038
119351
  "media-player",
@@ -118198,7 +119511,9 @@ function buildHeroModel(input) {
118198
119511
  running: runningOf(input),
118199
119512
  remoteCommands: input.remoteCommands,
118200
119513
  caps: input.caps,
118201
- quantity: device.quantity ?? null
119514
+ quantity: device.quantity ?? null,
119515
+ ...input.switchOptions !== void 0 ? { switchOptions: input.switchOptions } : {},
119516
+ ...input.powerSupplySettable !== void 0 ? { powerSupplySettable: input.powerSupplySettable } : {}
118202
119517
  };
118203
119518
  const contributed = HERO_CAP_CONTRIBUTIONS.filter((c) => input.caps.includes(c.cap)).map((c) => ({
118204
119519
  cap: c.cap,
@@ -118403,6 +119718,7 @@ var HERO_CAP_COVERAGE = {
118403
119718
  weather: "contributes",
118404
119719
  "weather-station": "contributes",
118405
119720
  "webrtc-session": { none: NOT_A_HERO_FACT },
119721
+ 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
119722
  "zone-analytics": { none: NOT_A_HERO_FACT },
118407
119723
  "zone-rules": { none: NOT_A_HERO_FACT },
118408
119724
  zones: { none: NOT_A_HERO_FACT }
@@ -121085,6 +122401,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
121085
122401
  access: "create",
121086
122402
  role: "admin"
121087
122403
  },
122404
+ "deviceManager.setIdentifiers": {
122405
+ capName: "device-manager",
122406
+ capScope: "system",
122407
+ addonId: null,
122408
+ access: "create",
122409
+ role: "admin"
122410
+ },
121088
122411
  "deviceManager.setIntegrationId": {
121089
122412
  capName: "device-manager",
121090
122413
  capScope: "system",
@@ -127007,6 +128330,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
127007
128330
  access: "view",
127008
128331
  role: "viewer"
127009
128332
  },
128333
+ "siren.getPlayChoices": {
128334
+ capName: "siren",
128335
+ capScope: "device",
128336
+ addonId: null,
128337
+ access: "view",
128338
+ role: "viewer"
128339
+ },
127010
128340
  "siren.getStatus": {
127011
128341
  capName: "siren",
127012
128342
  capScope: "device",
@@ -127819,6 +129149,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
127819
129149
  access: "view",
127820
129150
  role: "viewer"
127821
129151
  },
129152
+ "switch.getOptions": {
129153
+ capName: "switch",
129154
+ capScope: "device",
129155
+ addonId: null,
129156
+ access: "view",
129157
+ role: "viewer"
129158
+ },
127822
129159
  "switch.getStatus": {
127823
129160
  capName: "switch",
127824
129161
  capScope: "device",
@@ -127826,6 +129163,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
127826
129163
  access: "view",
127827
129164
  role: "viewer"
127828
129165
  },
129166
+ "switch.powerCycle": {
129167
+ capName: "switch",
129168
+ capScope: "device",
129169
+ addonId: null,
129170
+ access: "create",
129171
+ role: "viewer"
129172
+ },
127829
129173
  "switch.setState": {
127830
129174
  capName: "switch",
127831
129175
  capScope: "device",
@@ -128029,13 +129373,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
128029
129373
  access: "create",
128030
129374
  role: "admin"
128031
129375
  },
128032
- "terminalSession.adoptLegacyMonitor": {
128033
- capName: "terminal-session",
128034
- capScope: "system",
128035
- addonId: null,
128036
- access: "create",
128037
- role: "admin"
128038
- },
128039
129376
  "terminalSession.close": {
128040
129377
  capName: "terminal-session",
128041
129378
  capScope: "system",
@@ -128043,13 +129380,6 @@ var METHOD_ACCESS_MAP = Object.freeze({
128043
129380
  access: "create",
128044
129381
  role: "admin"
128045
129382
  },
128046
- "terminalSession.listLegacyCameras": {
128047
- capName: "terminal-session",
128048
- capScope: "system",
128049
- addonId: null,
128050
- access: "view",
128051
- role: "admin"
128052
- },
128053
129383
  "terminalSession.listProfiles": {
128054
129384
  capName: "terminal-session",
128055
129385
  capScope: "system",
@@ -128911,6 +130241,62 @@ var METHOD_ACCESS_MAP = Object.freeze({
128911
130241
  access: "view",
128912
130242
  role: "viewer"
128913
130243
  },
130244
+ "workload.forceStop": {
130245
+ capName: "workload",
130246
+ capScope: "device",
130247
+ addonId: null,
130248
+ access: "create",
130249
+ role: "admin"
130250
+ },
130251
+ "workload.getOptions": {
130252
+ capName: "workload",
130253
+ capScope: "device",
130254
+ addonId: null,
130255
+ access: "view",
130256
+ role: "viewer"
130257
+ },
130258
+ "workload.getStatus": {
130259
+ capName: "workload",
130260
+ capScope: "device",
130261
+ addonId: null,
130262
+ access: "view",
130263
+ role: "viewer"
130264
+ },
130265
+ "workload.pause": {
130266
+ capName: "workload",
130267
+ capScope: "device",
130268
+ addonId: null,
130269
+ access: "create",
130270
+ role: "viewer"
130271
+ },
130272
+ "workload.restart": {
130273
+ capName: "workload",
130274
+ capScope: "device",
130275
+ addonId: null,
130276
+ access: "create",
130277
+ role: "viewer"
130278
+ },
130279
+ "workload.resume": {
130280
+ capName: "workload",
130281
+ capScope: "device",
130282
+ addonId: null,
130283
+ access: "create",
130284
+ role: "viewer"
130285
+ },
130286
+ "workload.start": {
130287
+ capName: "workload",
130288
+ capScope: "device",
130289
+ addonId: null,
130290
+ access: "create",
130291
+ role: "viewer"
130292
+ },
130293
+ "workload.stop": {
130294
+ capName: "workload",
130295
+ capScope: "device",
130296
+ addonId: null,
130297
+ access: "create",
130298
+ role: "viewer"
130299
+ },
128914
130300
  "zoneAnalytics.getCameraHistory": {
128915
130301
  capName: "zone-analytics",
128916
130302
  capScope: "device",
@@ -129198,6 +130584,7 @@ var KNOWN_CAP_NAMES = [
129198
130584
  "weather",
129199
130585
  "weather-station",
129200
130586
  "webrtc-session",
130587
+ "workload",
129201
130588
  "zone-analytics",
129202
130589
  "zone-rules",
129203
130590
  "zones"
@@ -129309,6 +130696,7 @@ var DEVICE_CAP_NAMES = [
129309
130696
  "weather",
129310
130697
  "weather-station",
129311
130698
  "webrtc-session",
130699
+ "workload",
129312
130700
  "zone-analytics",
129313
130701
  "zone-rules",
129314
130702
  "zones"
@@ -129522,7 +130910,8 @@ function resolveAction(cap, action, wordings) {
129522
130910
  icon: w.icon ?? action.icon,
129523
130911
  args: action.args ?? {},
129524
130912
  openArgs: action.openArgs ?? [],
129525
- access
130913
+ access,
130914
+ offeredWhen: action.offeredWhen ?? null
129526
130915
  };
129527
130916
  }
129528
130917
  /**
@@ -129551,6 +130940,41 @@ function deviceOffersActions(bindings, actionIds, mode = "any", deviceType) {
129551
130940
  const offered = new Set(actionsForDevice(bindings, deviceType).map((action) => action.id));
129552
130941
  return mode === "all" ? actionIds.every((id) => offered.has(id)) : actionIds.some((id) => offered.has(id));
129553
130942
  }
130943
+ var GATE_PENDING = { kind: "pending" };
130944
+ /**
130945
+ * A gate's answer from what its read returned: closed only when the answer is
130946
+ * an object whose `field` is `false`. A shape that is not an object is not an
130947
+ * answer — it reads as `failed` and keeps the action offered.
130948
+ */
130949
+ function actionGateAnswerFrom(raw, gate) {
130950
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { kind: "failed" };
130951
+ return {
130952
+ kind: "answered",
130953
+ open: Reflect.get(raw, gate.field) !== false
130954
+ };
130955
+ }
130956
+ /**
130957
+ * Whether one device is offered an action, given what it answered: withdrawn
130958
+ * when its `offeredWhen` read ANSWERED `false` (a switch that only reports has
130959
+ * no on/off), or when a dynamic list its arguments read ANSWERED empty (a
130960
+ * siren that counts no plays has nothing to sound N times). A read that failed
130961
+ * or is pending keeps it offered.
130962
+ */
130963
+ function actionOfferedWith(action, answerOf, gateOf = () => GATE_PENDING) {
130964
+ if (action.offeredWhen !== null) {
130965
+ const gate = gateOf(action.cap, action.offeredWhen);
130966
+ if (gate.kind === "answered" && !gate.open) return false;
130967
+ }
130968
+ return action.openArgs.every((arg) => {
130969
+ if (arg.offer.kind !== "dynamic") return true;
130970
+ const answer = answerOf(action.cap, arg.offer);
130971
+ return answer.kind !== "answered" || answer.choiceCount > 0;
130972
+ });
130973
+ }
130974
+ /** One device's actions, minus those {@link actionOfferedWith} withdraws. */
130975
+ function offeredActionsWith(actions, answerOf, gateOf) {
130976
+ return actions.filter((action) => actionOfferedWith(action, answerOf, gateOf));
130977
+ }
129554
130978
  function resolveEnumValue(v) {
129555
130979
  const phrase = v.phrase ?? fill(BECOMES, {
129556
130980
  en: { value: v.label.en },
@@ -129983,6 +131407,7 @@ var DEVICE_TYPE_ICON = {
129983
131407
  [require_composed_stable_id.DeviceType.Climate]: "thermometer",
129984
131408
  [require_composed_stable_id.DeviceType.HeatPump]: "flame",
129985
131409
  [require_composed_stable_id.DeviceType.EnergySystem]: "solar-panel",
131410
+ [require_composed_stable_id.DeviceType.Workload]: "server",
129986
131411
  [require_composed_stable_id.DeviceType.Button]: "circle-dot",
129987
131412
  [require_composed_stable_id.DeviceType.EventEmitter]: "zap",
129988
131413
  [require_composed_stable_id.DeviceType.Update]: "refresh-cw",
@@ -130037,6 +131462,7 @@ var DEVICE_ROLE_ICON = {
130037
131462
  [require_composed_stable_id.DeviceRole.SwitchHeater]: "flame",
130038
131463
  [require_composed_stable_id.DeviceRole.SwitchFan]: "fan",
130039
131464
  [require_composed_stable_id.DeviceRole.SwitchLight]: "lightbulb",
131465
+ [require_composed_stable_id.DeviceRole.PoePort]: "ethernet-port",
130040
131466
  [require_composed_stable_id.DeviceRole.ClimateAc]: "air-vent",
130041
131467
  [require_composed_stable_id.DeviceRole.ClimateThermostat]: "thermometer",
130042
131468
  [require_composed_stable_id.DeviceRole.ClimateFloor]: "waves",
@@ -130081,7 +131507,12 @@ var DEVICE_ROLE_ICON = {
130081
131507
  [require_composed_stable_id.DeviceRole.MessagingNotifier]: "message-square",
130082
131508
  [require_composed_stable_id.DeviceRole.EmailNotifier]: "mail",
130083
131509
  [require_composed_stable_id.DeviceRole.GenericNotifier]: "bell",
130084
- [require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower"
131510
+ [require_composed_stable_id.DeviceRole.IrTransmitter]: "radio-tower",
131511
+ [require_composed_stable_id.DeviceRole.Vm]: "monitor",
131512
+ [require_composed_stable_id.DeviceRole.AppContainer]: "container",
131513
+ [require_composed_stable_id.DeviceRole.Lxc]: "box",
131514
+ [require_composed_stable_id.DeviceRole.App]: "app-window",
131515
+ [require_composed_stable_id.DeviceRole.Host]: "server"
130085
131516
  };
130086
131517
  var TYPE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceType));
130087
131518
  var ROLE_VALUES = new Set(Object.values(require_composed_stable_id.DeviceRole));
@@ -131431,7 +132862,8 @@ var CAP_NAMES_WITH_STATUS = [
131431
132862
  "vibration",
131432
132863
  "water-heater",
131433
132864
  "weather",
131434
- "weather-station"
132865
+ "weather-station",
132866
+ "workload"
131435
132867
  ];
131436
132868
  //#endregion
131437
132869
  //#region src/generated/method-device-selectors.ts
@@ -132134,6 +133566,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
132134
133566
  form: "single",
132135
133567
  optional: false
132136
133568
  }],
133569
+ "deviceManager.setIdentifiers": [{
133570
+ name: "deviceId",
133571
+ form: "single",
133572
+ optional: false
133573
+ }],
132137
133574
  "deviceManager.setIntegrationId": [{
132138
133575
  name: "deviceId",
132139
133576
  form: "single",
@@ -134128,6 +135565,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134128
135565
  form: "single",
134129
135566
  optional: false
134130
135567
  }],
135568
+ "siren.getPlayChoices": [{
135569
+ name: "deviceId",
135570
+ form: "single",
135571
+ optional: false
135572
+ }],
134131
135573
  "siren.getStatus": [{
134132
135574
  name: "deviceId",
134133
135575
  form: "single",
@@ -134310,11 +135752,21 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134310
135752
  form: "single",
134311
135753
  optional: false
134312
135754
  }],
135755
+ "switch.getOptions": [{
135756
+ name: "deviceId",
135757
+ form: "single",
135758
+ optional: false
135759
+ }],
134313
135760
  "switch.getStatus": [{
134314
135761
  name: "deviceId",
134315
135762
  form: "single",
134316
135763
  optional: false
134317
135764
  }],
135765
+ "switch.powerCycle": [{
135766
+ name: "deviceId",
135767
+ form: "single",
135768
+ optional: false
135769
+ }],
134318
135770
  "switch.setState": [{
134319
135771
  name: "deviceId",
134320
135772
  form: "single",
@@ -134555,6 +136007,46 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134555
136007
  form: "single",
134556
136008
  optional: false
134557
136009
  }],
136010
+ "workload.forceStop": [{
136011
+ name: "deviceId",
136012
+ form: "single",
136013
+ optional: false
136014
+ }],
136015
+ "workload.getOptions": [{
136016
+ name: "deviceId",
136017
+ form: "single",
136018
+ optional: false
136019
+ }],
136020
+ "workload.getStatus": [{
136021
+ name: "deviceId",
136022
+ form: "single",
136023
+ optional: false
136024
+ }],
136025
+ "workload.pause": [{
136026
+ name: "deviceId",
136027
+ form: "single",
136028
+ optional: false
136029
+ }],
136030
+ "workload.restart": [{
136031
+ name: "deviceId",
136032
+ form: "single",
136033
+ optional: false
136034
+ }],
136035
+ "workload.resume": [{
136036
+ name: "deviceId",
136037
+ form: "single",
136038
+ optional: false
136039
+ }],
136040
+ "workload.start": [{
136041
+ name: "deviceId",
136042
+ form: "single",
136043
+ optional: false
136044
+ }],
136045
+ "workload.stop": [{
136046
+ name: "deviceId",
136047
+ form: "single",
136048
+ optional: false
136049
+ }],
134558
136050
  "zoneAnalytics.getCameraHistory": [{
134559
136051
  name: "deviceId",
134560
136052
  form: "single",
@@ -134673,6 +136165,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
134673
136165
  "deviceManager.setChildLayout",
134674
136166
  "deviceManager.setDisabled",
134675
136167
  "deviceManager.setDisplay",
136168
+ "deviceManager.setIdentifiers",
134676
136169
  "deviceManager.setIntegrationId",
134677
136170
  "deviceManager.setLinkDeviceId",
134678
136171
  "deviceManager.setLocation",
@@ -134849,7 +136342,7 @@ function getCapsByProviderKind(kind) {
134849
136342
  //#region src/generated/runtime-state-durability.ts
134850
136343
  /**
134851
136344
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
134852
- * `runtimeState`. 86 caps: 43 `restored`, 43 `session`.
136345
+ * `runtimeState`. 87 caps: 43 `restored`, 44 `session`.
134853
136346
  *
134854
136347
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
134855
136348
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -135189,6 +136682,10 @@ var RUNTIME_STATE_POLICY = {
135189
136682
  durability: "session",
135190
136683
  volatileFields: ["lastFetchedAt"]
135191
136684
  },
136685
+ "workload": {
136686
+ durability: "session",
136687
+ volatileFields: ["lastFetchedAt"]
136688
+ },
135192
136689
  "zone-analytics": {
135193
136690
  durability: "session",
135194
136691
  volatileFields: []
@@ -136616,8 +138113,6 @@ function createSystemProxy(api) {
136616
138113
  },
136617
138114
  terminalSession: {
136618
138115
  listProfiles: (input) => dispatch("terminalSession", "listProfiles", "query", input),
136619
- listLegacyCameras: (input) => dispatch("terminalSession", "listLegacyCameras", "query", input),
136620
- adoptLegacyMonitor: (input) => dispatch("terminalSession", "adoptLegacyMonitor", "mutation", input),
136621
138116
  listSessions: (input) => dispatch("terminalSession", "listSessions", "query", input),
136622
138117
  serverShellStatus: (input) => dispatch("terminalSession", "serverShellStatus", "query", input),
136623
138118
  openSession: (input) => dispatch("terminalSession", "openSession", "mutation", input),
@@ -149186,6 +150681,7 @@ exports.CAPABILITY_NAMES = CAPABILITY_NAMES;
149186
150681
  exports.CAPABILITY_ROUTER_KEYS = CAPABILITY_ROUTER_KEYS;
149187
150682
  exports.CAP_COMMAND_ORIGIN_CONTEXT_KEY = require_sleep.CAP_COMMAND_ORIGIN_CONTEXT_KEY;
149188
150683
  exports.CAP_CUSTOMIZE_CATALOG = CAP_CUSTOMIZE_CATALOG;
150684
+ exports.CAP_METHOD_NOT_IMPLEMENTED = require_sleep.CAP_METHOD_NOT_IMPLEMENTED;
149189
150685
  exports.CAP_NAMES_WITH_STATUS = CAP_NAMES_WITH_STATUS;
149190
150686
  exports.CAP_NODE_PIN_CONTEXT_KEY = require_sleep.CAP_NODE_PIN_CONTEXT_KEY;
149191
150687
  exports.CAP_PROVIDER_KIND_MAP = CAP_PROVIDER_KIND_MAP;
@@ -149469,6 +150965,8 @@ exports.DEFAULT_EVENTS_BAND_BUFFER_SEC = DEFAULT_EVENTS_BAND_BUFFER_SEC;
149469
150965
  exports.DEFAULT_EVENT_COLOR = DEFAULT_EVENT_COLOR;
149470
150966
  exports.DEFAULT_FEATURES = DEFAULT_FEATURES;
149471
150967
  exports.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = require_implemented_methods.DEFAULT_FIRST_SIGHTING_FRESHNESS_MS;
150968
+ exports.DEFAULT_GRID_FPS = require_implemented_methods.DEFAULT_GRID_FPS;
150969
+ exports.DEFAULT_GRID_PROFILES = require_implemented_methods.DEFAULT_GRID_PROFILES;
149472
150970
  exports.DEFAULT_HEADROOM = DEFAULT_HEADROOM;
149473
150971
  exports.DEFAULT_HISTORY_RETENTION = require_implemented_methods.DEFAULT_HISTORY_RETENTION;
149474
150972
  exports.DEFAULT_HOLD_OVERRIDE = DEFAULT_HOLD_OVERRIDE;
@@ -149517,6 +151015,7 @@ exports.DEVICE_HISTORY_ENERGY_KEY = DEVICE_HISTORY_ENERGY_KEY;
149517
151015
  exports.DEVICE_HISTORY_ORPHAN_DELETE_MAX = DEVICE_HISTORY_ORPHAN_DELETE_MAX;
149518
151016
  exports.DEVICE_HISTORY_ORPHAN_LIST_MAX = DEVICE_HISTORY_ORPHAN_LIST_MAX;
149519
151017
  exports.DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS = DEVICE_HISTORY_QUERY_MANY_MAX_ITEMS;
151018
+ exports.DEVICE_IDENTIFIER_KEYS = DEVICE_IDENTIFIER_KEYS;
149520
151019
  exports.DEVICE_ID_FIELD = DEVICE_ID_FIELD;
149521
151020
  exports.DEVICE_NONCE_TTL_MS = DEVICE_NONCE_TTL_MS;
149522
151021
  exports.DEVICE_PROFILES = DEVICE_PROFILES;
@@ -149622,6 +151121,10 @@ exports.DeviceHistoryRefusalReasonSchema = DeviceHistoryRefusalReasonSchema;
149622
151121
  exports.DeviceHistoryResolutionSchema = DeviceHistoryResolutionSchema;
149623
151122
  exports.DeviceHistoryStatusSchema = DeviceHistoryStatusSchema;
149624
151123
  exports.DeviceHistorySubjectSchema = DeviceHistorySubjectSchema;
151124
+ exports.DeviceIdentifierEntrySchema = DeviceIdentifierEntrySchema;
151125
+ exports.DeviceIdentifierKeySchema = DeviceIdentifierKeySchema;
151126
+ exports.DeviceIdentifierOriginSchema = DeviceIdentifierOriginSchema;
151127
+ exports.DeviceIdentifiersSchema = DeviceIdentifiersSchema;
149625
151128
  exports.DeviceInfoSchema = DeviceInfoSchema;
149626
151129
  exports.DeviceModelChoiceSchema = DeviceModelChoiceSchema;
149627
151130
  exports.DeviceNetworkStatsSchema = DeviceNetworkStatsSchema;
@@ -149702,6 +151205,7 @@ exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
149702
151205
  exports.EMPTY_AUTOMATION_STATE = EMPTY_AUTOMATION_STATE;
149703
151206
  exports.EMPTY_REMOTE_ASSUMED_STATE = EMPTY_REMOTE_ASSUMED_STATE;
149704
151207
  exports.EMPTY_REMOTE_CONFIG = EMPTY_REMOTE_CONFIG;
151208
+ exports.ENGINE_HOSTED_HELPER_KINDS = require_implemented_methods.ENGINE_HOSTED_HELPER_KINDS;
149705
151209
  exports.ERROR_STATUS_COLD = ERROR_STATUS_COLD;
149706
151210
  exports.ESTIMATE_COMPUTE_RATIO_MAX = ESTIMATE_COMPUTE_RATIO_MAX;
149707
151211
  exports.ESTIMATE_COMPUTE_RATIO_MIN = ESTIMATE_COMPUTE_RATIO_MIN;
@@ -149886,14 +151390,18 @@ exports.FrameLazyCountersSchema = FrameLazyCountersSchema;
149886
151390
  exports.FrameLazyMetricsSchema = FrameLazyMetricsSchema;
149887
151391
  exports.G711_SCALE_CORRECTION_DB = G711_SCALE_CORRECTION_DB;
149888
151392
  exports.GRAMMAR_MAX_LINES = GRAMMAR_MAX_LINES;
151393
+ exports.GRID_PROFILES = require_implemented_methods.GRID_PROFILES;
149889
151394
  exports.GROUP_TEMPLATES = GROUP_TEMPLATES;
149890
151395
  exports.GROUP_TEMPLATE_IDS = require_implemented_methods.GROUP_TEMPLATE_IDS;
149891
151396
  exports.GasStatusSchema = GasStatusSchema;
149892
151397
  exports.GetLoggingSettingsInputSchema = GetLoggingSettingsInputSchema;
149893
151398
  exports.GetStreamWithCodecInputSchema = GetStreamWithCodecInputSchema;
149894
151399
  exports.GlobalMetricsSchema = GlobalMetricsSchema;
151400
+ exports.GridCellSpecSchema = require_implemented_methods.GridCellSpecSchema;
151401
+ exports.GridHelperSpecSchema = require_implemented_methods.GridHelperSpecSchema;
149895
151402
  exports.GridLayoutPatchSchema = GridLayoutPatchSchema;
149896
151403
  exports.GridLayoutViewSchema = GridLayoutViewSchema;
151404
+ exports.GridRectSchema = require_implemented_methods.GridRectSchema;
149897
151405
  exports.GroupActiveSchema = GroupActiveSchema;
149898
151406
  exports.GroupCommandResultSchema = GroupCommandResultSchema;
149899
151407
  exports.GroupCommandsSchema = GroupCommandsSchema;
@@ -149986,6 +151494,7 @@ exports.HoldSpecSchema = HoldSpecSchema;
149986
151494
  exports.HoldTargetStatusSchema = HoldTargetStatusSchema;
149987
151495
  exports.HoldTraceSchema = HoldTraceSchema;
149988
151496
  exports.HoldTracker = HoldTracker;
151497
+ exports.HostedWithdrawalGate = HostedWithdrawalGate;
149989
151498
  exports.HttpsLeafInfoSchema = HttpsLeafInfoSchema;
149990
151499
  exports.HubAddressRoleSchema = HubAddressRoleSchema;
149991
151500
  exports.HumidifierStatusSchema = HumidifierStatusSchema;
@@ -150201,6 +151710,7 @@ exports.MAX_EXPRESSION_BINDINGS = require_implemented_methods.MAX_EXPRESSION_BIN
150201
151710
  exports.MAX_EXPRESSION_CALL_ARGS = require_implemented_methods.MAX_EXPRESSION_CALL_ARGS;
150202
151711
  exports.MAX_EXPRESSION_EVAL_STEPS = require_implemented_methods.MAX_EXPRESSION_EVAL_STEPS;
150203
151712
  exports.MAX_EXPRESSION_SOURCE_LENGTH = require_implemented_methods.MAX_EXPRESSION_SOURCE_LENGTH;
151713
+ exports.MAX_GRID_CELLS = require_implemented_methods.MAX_GRID_CELLS;
150204
151714
  exports.MAX_HELPER_MEMBERS = require_implemented_methods.MAX_HELPER_MEMBERS;
150205
151715
  exports.MAX_HOLD_ATTEMPTS_LIMIT = MAX_HOLD_ATTEMPTS_LIMIT;
150206
151716
  exports.MAX_KEYS = MAX_KEYS;
@@ -151162,6 +152672,8 @@ exports.SUBJECT_PATH_FULL_FRAME_COVERAGE = SUBJECT_PATH_FULL_FRAME_COVERAGE;
151162
152672
  exports.SUBJECT_PATH_MAX_POINTS = SUBJECT_PATH_MAX_POINTS;
151163
152673
  exports.SUB_DETECTION_TYPES = SUB_DETECTION_TYPES;
151164
152674
  exports.SUNRISE_ALTITUDE_DEG = SUNRISE_ALTITUDE_DEG;
152675
+ exports.SWITCH_DEFAULT_OPTIONS = SWITCH_DEFAULT_OPTIONS;
152676
+ exports.SWITCH_SETTABLE_GATE = require_sleep.SWITCH_SETTABLE_GATE;
151165
152677
  exports.SYSTEM_CAP_NAMES = SYSTEM_CAP_NAMES;
151166
152678
  exports.SYSTEM_SCOPE_DEVICE_METHODS = SYSTEM_SCOPE_DEVICE_METHODS;
151167
152679
  exports.SceneCheckSchema = SceneCheckSchema;
@@ -151231,6 +152743,7 @@ exports.SirenOptionsSchema = SirenOptionsSchema;
151231
152743
  exports.SirenOptionsSource = SirenOptionsSource;
151232
152744
  exports.SirenRuntimeStateSchema = SirenRuntimeStateSchema;
151233
152745
  exports.SirenStatusSchema = SirenStatusSchema;
152746
+ exports.SirenTriggerInputSchema = SirenTriggerInputSchema;
151234
152747
  exports.SiteLocationSchema = SiteLocationSchema;
151235
152748
  exports.SiteLocationSourceSchema = SiteLocationSourceSchema;
151236
152749
  exports.SiteLocationStatusSchema = SiteLocationStatusSchema;
@@ -151330,6 +152843,7 @@ exports.SuggestedDeviceShareSchema = SuggestedDeviceShareSchema;
151330
152843
  exports.SuggestedNodeShareSchema = SuggestedNodeShareSchema;
151331
152844
  exports.SunEventSchema = SunEventSchema;
151332
152845
  exports.SuppliedRootOutputSchema = SuppliedRootOutputSchema;
152846
+ exports.SwitchOptionsSchema = SwitchOptionsSchema;
151333
152847
  exports.SwitchStatusSchema = SwitchStatusSchema;
151334
152848
  exports.SystemHeldSecretNameSchema = SystemHeldSecretNameSchema;
151335
152849
  exports.SystemMetricsSchema = SystemMetricsSchema;
@@ -151406,8 +152920,7 @@ exports.TemplateTimeWindowValueSchema = TemplateTimeWindowValueSchema;
151406
152920
  exports.TemplateUserSchema = TemplateUserSchema;
151407
152921
  exports.TemplateValueBindingSchema = TemplateValueBindingSchema;
151408
152922
  exports.TemplateWriteResultSchema = TemplateWriteResultSchema;
151409
- exports.TerminalInstanceInfoSchema = TerminalInstanceInfoSchema;
151410
- exports.TerminalLegacyCameraSchema = TerminalLegacyCameraSchema;
152923
+ exports.TerminalHelperSpecSchema = require_implemented_methods.TerminalHelperSpecSchema;
151411
152924
  exports.TerminalOutputBatchSchema = TerminalOutputBatchSchema;
151412
152925
  exports.TerminalOutputEventSchema = TerminalOutputEventSchema;
151413
152926
  exports.TerminalProfileInfoSchema = TerminalProfileInfoSchema;
@@ -151571,6 +153084,10 @@ exports.WEEKLY_MASK_LENGTH = WEEKLY_MASK_LENGTH;
151571
153084
  exports.WELL_KNOWN_TABS = require_sleep.WELL_KNOWN_TABS;
151572
153085
  exports.WELL_KNOWN_TAB_MAP = require_sleep.WELL_KNOWN_TAB_MAP;
151573
153086
  exports.WHEN_UNROLL_DEPTH = WHEN_UNROLL_DEPTH;
153087
+ exports.WORKLOAD_ACTIONS = WORKLOAD_ACTIONS;
153088
+ exports.WORKLOAD_ROLES = WORKLOAD_ROLES;
153089
+ exports.WORKLOAD_STATES = WORKLOAD_STATES;
153090
+ exports.WORKLOAD_TRANSITION_CATEGORY = WORKLOAD_TRANSITION_CATEGORY;
151574
153091
  exports.WaterHeaterStatusSchema = WaterHeaterStatusSchema;
151575
153092
  exports.WeatherStationStatusSchema = WeatherStationStatusSchema;
151576
153093
  exports.WeatherStatusSchema = WeatherStatusSchema;
@@ -151587,6 +153104,12 @@ exports.WidgetLoginMethodSchema = WidgetLoginMethodSchema;
151587
153104
  exports.WidgetMetadataSchema = WidgetMetadataSchema;
151588
153105
  exports.WidgetRemoteSchema = WidgetRemoteSchema;
151589
153106
  exports.WidgetSizeEnum = WidgetSizeEnum;
153107
+ exports.WorkloadOptionsSchema = WorkloadOptionsSchema;
153108
+ exports.WorkloadPortProtocolSchema = WorkloadPortProtocolSchema;
153109
+ exports.WorkloadPortSchema = WorkloadPortSchema;
153110
+ exports.WorkloadResourcesSchema = WorkloadResourcesSchema;
153111
+ exports.WorkloadStateSchema = WorkloadStateSchema;
153112
+ exports.WorkloadStatusSchema = WorkloadStatusSchema;
151590
153113
  exports.WrapperActivationReadSchema = WrapperActivationReadSchema;
151591
153114
  exports.WrapperEvidenceSchema = WrapperEvidenceSchema;
151592
153115
  exports.WrapperIdentitySchema = WrapperIdentitySchema;
@@ -151609,6 +153132,8 @@ exports.accessoryChildrenComplete = accessoryChildrenComplete;
151609
153132
  exports.accessoryChildrenUnknown = accessoryChildrenUnknown;
151610
153133
  exports.accessoryStableId = accessoryStableId;
151611
153134
  exports.actionEffect = require_sleep.actionEffect;
153135
+ exports.actionGateAnswerFrom = actionGateAnswerFrom;
153136
+ exports.actionOfferedWith = actionOfferedWith;
151612
153137
  exports.actionSourceCapability = actionSourceCapability;
151613
153138
  exports.actionWaitTotalMs = actionWaitTotalMs;
151614
153139
  exports.actionsCapability = actionsCapability;
@@ -151914,6 +153439,7 @@ exports.dayNightCapability = dayNightCapability;
151914
153439
  exports.dayOfWeekToIndex = dayOfWeekToIndex;
151915
153440
  exports.declarationOwnerNodeId = declarationOwnerNodeId;
151916
153441
  exports.declarationsOf = require_sleep.declarationsOf;
153442
+ exports.declareDeviceIdentifiers = declareDeviceIdentifiers;
151917
153443
  exports.declareLinkKind = declareLinkKind;
151918
153444
  exports.declareLogChannel = declareLogChannel;
151919
153445
  exports.declaredSeriesKind = declaredSeriesKind;
@@ -151959,6 +153485,7 @@ exports.derivePostTriggeredAction = derivePostTriggeredAction;
151959
153485
  exports.deriveRecordingMode = deriveRecordingMode;
151960
153486
  exports.deriveRootFaceRefineRect = deriveRootFaceRefineRect;
151961
153487
  exports.deriveRootSupplies = deriveRootSupplies;
153488
+ exports.deriveWorkloadControls = deriveWorkloadControls;
151962
153489
  exports.describeComposableCaps = describeComposableCaps;
151963
153490
  exports.describeCustomActions = require_sleep.describeCustomActions;
151964
153491
  exports.describeHold = describeHold;
@@ -152195,6 +153722,7 @@ exports.heatPumpControlCapability = heatPumpControlCapability;
152195
153722
  exports.heatPumpInstantCop = heatPumpInstantCop;
152196
153723
  exports.heatPumpStatusCapability = heatPumpStatusCapability;
152197
153724
  exports.heatingValveCapability = heatingValveCapability;
153725
+ exports.helperDeviceRefs = require_implemented_methods.helperDeviceRefs;
152198
153726
  exports.helperMembers = require_implemented_methods.helperMembers;
152199
153727
  exports.helperSaveProblems = helperSaveProblems;
152200
153728
  exports.heroArgsWithValue = heroArgsWithValue;
@@ -152208,6 +153736,7 @@ exports.historyUnitFor = require_sleep.historyUnitFor;
152208
153736
  exports.holdOf = holdOf;
152209
153737
  exports.holdRefusalOf = holdRefusalOf;
152210
153738
  exports.holdVarSlots = holdVarSlots;
153739
+ exports.hostEngineDevice = hostEngineDevice;
152211
153740
  exports.htmlToText = htmlToText;
152212
153741
  exports.hubAddressHostname = hubAddressHostname;
152213
153742
  exports.hubMotionNativeProvider = hubMotionNativeProvider;
@@ -152219,6 +153748,7 @@ exports.iconCategoryLabel = iconCategoryLabel;
152219
153748
  exports.iconEntry = iconEntry;
152220
153749
  exports.iconsInCategory = iconsInCategory;
152221
153750
  exports.identifiedEventLeaves = identifiedEventLeaves;
153751
+ exports.identifierStrength = identifierStrength;
152222
153752
  exports.imageCapability = imageCapability;
152223
153753
  exports.imageModesForKind = imageModesForKind;
152224
153754
  exports.imageSettingsCapability = imageSettingsCapability;
@@ -152275,6 +153805,7 @@ exports.isAutomaticShareSource = isAutomaticShareSource;
152275
153805
  exports.isBaseConditionKey = isBaseConditionKey;
152276
153806
  exports.isBatteryPresenceFault = isBatteryPresenceFault;
152277
153807
  exports.isBuiltinTemplateId = isBuiltinTemplateId;
153808
+ exports.isCapMethodAbsent = require_sleep.isCapMethodAbsent;
152278
153809
  exports.isClusterScopedStep = isClusterScopedStep;
152279
153810
  exports.isCollectionArrayMethod = isCollectionArrayMethod;
152280
153811
  exports.isCommand = require_sleep.isCommand;
@@ -152290,6 +153821,8 @@ exports.isDeviceScopedCap = require_sleep.isDeviceScopedCap;
152290
153821
  exports.isDoPickerDeviceType = isDoPickerDeviceType;
152291
153822
  exports.isDrawableSubjectPath = isDrawableSubjectPath;
152292
153823
  exports.isEmbeddingModelFailed = isEmbeddingModelFailed;
153824
+ exports.isEmptyIdentifiers = isEmptyIdentifiers;
153825
+ exports.isEngineHostedHelper = require_implemented_methods.isEngineHostedHelper;
152293
153826
  exports.isEvent = require_sleep.isEvent;
152294
153827
  exports.isEventKindLabelKey = isEventKindLabelKey;
152295
153828
  exports.isEventLeaf = isEventLeaf;
@@ -152364,6 +153897,7 @@ exports.isUnfilledRequiredProblem = isUnfilledRequiredProblem;
152364
153897
  exports.isUsableTimeZone = isUsableTimeZone;
152365
153898
  exports.isVectorIndexDimConflict = isVectorIndexDimConflict;
152366
153899
  exports.isVoidInput = isVoidInput;
153900
+ exports.isWorkloadSettled = isWorkloadSettled;
152367
153901
  exports.isZodSecret = require_sleep.isZodSecret;
152368
153902
  exports.ituDbfsFromPreEpoch = ituDbfsFromPreEpoch;
152369
153903
  exports.jobKindSchema = jobKindSchema;
@@ -152380,8 +153914,10 @@ exports.lawnMowerControlCapability = lawnMowerControlCapability;
152380
153914
  exports.leafCatalogEntry = leafCatalogEntry;
152381
153915
  exports.leafKindsFor = leafKindsFor;
152382
153916
  exports.legacyAutoLinkIds = legacyAutoLinkIds;
153917
+ exports.legacyEngineRowsIndex = legacyEngineRowsIndex;
152383
153918
  exports.legacyImageMode = legacyImageMode;
152384
153919
  exports.legacyModeOf = legacyModeOf;
153920
+ exports.legacySweepDone = legacySweepDone;
152385
153921
  exports.legacyTargetsOver = legacyTargetsOver;
152386
153922
  exports.lifecycleJobSchema = lifecycleJobSchema;
152387
153923
  exports.lifecycleJobScopeSchema = lifecycleJobScopeSchema;
@@ -152435,6 +153971,7 @@ exports.mediaPlayerExtensionCommands = mediaPlayerExtensionCommands;
152435
153971
  exports.mediaPlayerFeaturesOfRoles = mediaPlayerFeaturesOfRoles;
152436
153972
  exports.memoizePinnedFfmpeg = memoizePinnedFfmpeg;
152437
153973
  exports.mergeClipLabels = mergeClipLabels;
153974
+ exports.mergeIdentifiers = mergeIdentifiers;
152438
153975
  exports.mergeKeyedArrayItem = mergeKeyedArrayItem;
152439
153976
  exports.mergeOverrides = mergeOverrides;
152440
153977
  exports.mergeScalarTarget = mergeScalarTarget;
@@ -152483,6 +154020,7 @@ exports.nestedStepsOf = nestedStepsOf;
152483
154020
  exports.networkAccessCapability = networkAccessCapability;
152484
154021
  exports.networkLinkCapability = networkLinkCapability;
152485
154022
  exports.networkQualityCapability = networkQualityCapability;
154023
+ exports.newGridHelperSpec = require_implemented_methods.newGridHelperSpec;
152486
154024
  exports.nextLocalMidnight = require_implemented_methods.nextLocalMidnight;
152487
154025
  exports.nextOccurrence = nextOccurrence;
152488
154026
  exports.nextTimeBoundaryInMs = nextTimeBoundaryInMs;
@@ -152493,6 +154031,8 @@ exports.nodePickerItems = nodePickerItems;
152493
154031
  exports.nodePin = require_sleep.nodePin;
152494
154032
  exports.nodeRemovalHookCapability = nodeRemovalHookCapability;
152495
154033
  exports.nodesCapability = nodesCapability;
154034
+ exports.normaliseIdentifiers = normaliseIdentifiers;
154035
+ exports.normaliseMac = normaliseMac;
152496
154036
  exports.normalizeActionUnits = normalizeActionUnits;
152497
154037
  exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
152498
154038
  exports.normalizeAudioLabel = normalizeAudioLabel;
@@ -152526,6 +154066,7 @@ exports.objectInputDeclaresRequiredDeviceId = objectInputDeclaresRequiredDeviceI
152526
154066
  exports.observeHoldLeaves = observeHoldLeaves;
152527
154067
  exports.occupancyScope = occupancyScope;
152528
154068
  exports.occurrenceOn = occurrenceOn;
154069
+ exports.offeredActionsWith = offeredActionsWith;
152529
154070
  exports.omitTransientConfig = require_sleep.omitTransientConfig;
152530
154071
  exports.openReset = require_implemented_methods.openReset;
152531
154072
  exports.openStatistic = require_implemented_methods.openStatistic;
@@ -152611,6 +154152,7 @@ exports.planMotionCropRegions = planMotionCropRegions;
152611
154152
  exports.planMotionCrops = planMotionCrops;
152612
154153
  exports.planRecoveryCrops = planRecoveryCrops;
152613
154154
  exports.planResetTier = require_implemented_methods.planResetTier;
154155
+ exports.planSirenTrigger = planSirenTrigger;
152614
154156
  exports.planStatisticTier = require_implemented_methods.planStatisticTier;
152615
154157
  exports.plateGalleryCapability = plateGalleryCapability;
152616
154158
  exports.platformProbeCapability = platformProbeCapability;
@@ -152787,6 +154329,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
152787
154329
  exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
152788
154330
  exports.resolveSelectStep = resolveSelectStep;
152789
154331
  exports.resolveServerName = resolveServerName;
154332
+ exports.resolveSirenPlays = resolveSirenPlays;
152790
154333
  exports.resolveSirenSeconds = resolveSirenSeconds;
152791
154334
  exports.resolveStepArgs = resolveStepArgs;
152792
154335
  exports.resolveStepArgsWithTemplates = resolveStepArgsWithTemplates;
@@ -152843,6 +154386,7 @@ exports.runtimeDevices = runtimeDevices;
152843
154386
  exports.runtimeFieldUnit = runtimeFieldUnit;
152844
154387
  exports.runtimeStatePolicyFor = runtimeStatePolicyFor;
152845
154388
  exports.sameHelperBody = sameHelperBody;
154389
+ exports.sameIdentifiers = sameIdentifiers;
152846
154390
  exports.sameRead = sameRead;
152847
154391
  exports.sameTag = sameTag;
152848
154392
  exports.sanitizeTargetOverride = sanitizeTargetOverride;
@@ -152877,6 +154421,7 @@ exports.seedLeaf = seedLeaf;
152877
154421
  exports.seekPatch = seekPatch;
152878
154422
  exports.selectAppConnectionEndpoints = selectAppConnectionEndpoints;
152879
154423
  exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
154424
+ exports.selectEngineHostedBlocks = selectEngineHostedBlocks;
152880
154425
  exports.selectFewShots = selectFewShots;
152881
154426
  exports.selectNavigationMethods = selectNavigationMethods;
152882
154427
  exports.selectRecoveryStep = selectRecoveryStep;
@@ -152909,6 +154454,7 @@ exports.signalPercentFromBars = signalPercentFromBars;
152909
154454
  exports.signalPercentFromRssi = signalPercentFromRssi;
152910
154455
  exports.sirenCapability = sirenCapability;
152911
154456
  exports.sirenIdleStatus = sirenIdleStatus;
154457
+ exports.sirenPlayChoices = sirenPlayChoices;
152912
154458
  exports.sirenTriggeredStatus = sirenTriggeredStatus;
152913
154459
  exports.siteFor = siteFor;
152914
154460
  exports.siteZoneKey = siteZoneKey;
@@ -152980,8 +154526,10 @@ exports.sunTimes = sunTimes;
152980
154526
  exports.supplyFor = supplyFor;
152981
154527
  exports.supportedRuntimes = supportedRuntimes;
152982
154528
  exports.swatchHex = swatchHex;
154529
+ exports.sweepLegacyEngineRows = sweepLegacyEngineRows;
152983
154530
  exports.switchCapability = switchCapability;
152984
154531
  exports.switchRecordsOverMigrationApi = require_sleep.switchRecordsOverMigrationApi;
154532
+ exports.switchRefusesSetState = require_sleep.switchRefusesSetState;
152985
154533
  exports.switchStateOfMode = switchStateOfMode;
152986
154534
  exports.switchedOffIds = switchedOffIds;
152987
154535
  exports.syncActiveAlarmProfileSettings = syncActiveAlarmProfileSettings;
@@ -153128,6 +154676,8 @@ exports.withSystemEventModes = withSystemEventModes;
153128
154676
  exports.withoutCallerStamp = require_sleep.withoutCallerStamp;
153129
154677
  exports.withoutField = withoutField;
153130
154678
  exports.withoutKeyedArrayItem = withoutKeyedArrayItem;
154679
+ exports.workloadCapability = workloadCapability;
154680
+ exports.workloadTransition = workloadTransition;
153131
154681
  exports.writeModelBoundSetting = writeModelBoundSetting;
153132
154682
  exports.zodEntriesToConfigUI = zodEntriesToConfigUI;
153133
154683
  exports.zoneAnalyticsCapability = zoneAnalyticsCapability;