@camstack/addon-export-hap 1.2.184 → 1.2.186

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.
@@ -49,7 +49,7 @@ let node_fs_promises = require("node:fs/promises");
49
49
  node_fs_promises = __toESM(node_fs_promises, 1);
50
50
  let node_events = require("node:events");
51
51
  let node_dgram = require("node:dgram");
52
- //#region ../types/dist/event-category-CT-hz5Rb.mjs
52
+ //#region ../types/dist/event-category-DmZDPDf_.mjs
53
53
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
54
54
  EventCategory["SystemBoot"] = "system.boot";
55
55
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -676,7 +676,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
676
676
  * (a track was promoted to a stationary-registry entry) or departs (the
677
677
  * object moved / was removed). Telemetry (D8): lossy, drives a UI refresh of
678
678
  * the dedicated "Stationary" section — never the live event feed. Payload:
679
- * `{ deviceId, entryId, className, phase:'appeared'|'departed', timestamp }`.
679
+ * `{ deviceId, entryId, className, phase:'appeared'|'departed', timestamp, observedAt, zones }`.
680
680
  */
681
681
  EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
682
682
  /**
@@ -814,6 +814,11 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
814
814
  */
815
815
  EventCategory["AccessoriesChanged"] = "accessories.onAccessoriesChanged";
816
816
  /**
817
+ * An action run started or ended. Emitted by the `actions` surface.
818
+ * Payload: `ActionRunChanged` (`{ actionId, runId, isRunning, outcome?, lastRunAt, lastError }`).
819
+ */
820
+ EventCategory["ActionsRunChanged"] = "actions.onRunChanged";
821
+ /**
817
822
  * Progress update from a running model conversion job.
818
823
  * Payload: `{ kind: 'model-convert', phase, sessionId?, pct?, detail? }`.
819
824
  * Emitted by `addon-model-studio` on the converting node.
@@ -1386,7 +1391,7 @@ var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-
1386
1391
  /** Returns a regex for validating an RFC 9562/4122 UUID.
1387
1392
  *
1388
1393
  * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
1389
- var uuid$3 = (version) => {
1394
+ var uuid$4 = (version) => {
1390
1395
  if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
1391
1396
  return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
1392
1397
  };
@@ -1956,8 +1961,8 @@ var $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
1956
1961
  v8: 8
1957
1962
  }[def.version];
1958
1963
  if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1959
- def.pattern ?? (def.pattern = uuid$3(v));
1960
- } else def.pattern ?? (def.pattern = uuid$3());
1964
+ def.pattern ?? (def.pattern = uuid$4(v));
1965
+ } else def.pattern ?? (def.pattern = uuid$4());
1961
1966
  $ZodStringFormat.init(inst, def);
1962
1967
  });
1963
1968
  var $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
@@ -5113,6 +5118,14 @@ function object(shape, params) {
5113
5118
  ...normalizeParams(params)
5114
5119
  });
5115
5120
  }
5121
+ function strictObject(shape, params) {
5122
+ return new ZodObject({
5123
+ type: "object",
5124
+ shape,
5125
+ catchall: never(),
5126
+ ...normalizeParams(params)
5127
+ });
5128
+ }
5116
5129
  function looseObject(shape, params) {
5117
5130
  return new ZodObject({
5118
5131
  type: "object",
@@ -5492,7 +5505,7 @@ var ZodIssueCode = {
5492
5505
  var ZodFirstPartyTypeKind;
5493
5506
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5494
5507
  //#endregion
5495
- //#region ../types/dist/sleep--jXS9hWo.mjs
5508
+ //#region ../types/dist/sleep-6eG9C8Xl.mjs
5496
5509
  /**
5497
5510
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5498
5511
  * window to float samples (D455).
@@ -8380,65 +8393,6 @@ var MODEL_FORMATS = [
8380
8393
  "pt",
8381
8394
  "gguf"
8382
8395
  ];
8383
- /**
8384
- * Per-call node pinning for `ctx.api` capability calls.
8385
- *
8386
- * A capability call normally resolves to its DEFAULT provider — a `singleton`
8387
- * cap resolves to the hub, a device-scoped cap to the device's owning node. To
8388
- * query a SPECIFIC node's provider instead (e.g. a remote agent's own
8389
- * in-process `platform-probe` hardware, which the hub cannot probe), pin the
8390
- * call to that node.
8391
- *
8392
- * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
8393
- * method args), so capability method signatures stay `nodeId`-free — node
8394
- * targeting is a property of the CALL, not of the method. The transport lifts
8395
- * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
8396
- * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
8397
- * which classifies a pinned agent node as `agent-child-forward`
8398
- * (`$agent-cap-fwd.forward` → the agent's in-process provider).
8399
- *
8400
- * Usage at a call site:
8401
- *
8402
- * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
8403
- */
8404
- /** tRPC `op.context` key carrying a per-call node pin. */
8405
- var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
8406
- /**
8407
- * Build the tRPC request options that pin a single capability call to `nodeId`.
8408
- * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
8409
- *
8410
- * ## The id is normalised here, and it has to be
8411
- *
8412
- * A forked addon reads its own node from `ctx.kernel.localNodeId`, and inside a
8413
- * worker that value is a RUNNER id — `hub/export-hap`, not `hub`. Routing
8414
- * compares a pin against real node ids, so such a pin matches nothing and the
8415
- * call fails with `no provider registered for cap "…"`. The local-first
8416
- * resolver already guarded against this (`localNodeId.split('/')[0]`), which
8417
- * made the hazard invisible: unpinned calls worked, and only an explicit pin —
8418
- * the thing you reach for when you specifically need THIS node — silently
8419
- * addressed a node that does not exist.
8420
- *
8421
- * Cost of it being missing: `addon-export-hap` pinned `decoder.getInfo` to its
8422
- * own node to read the host's hardware-decode backend. It never once answered,
8423
- * so every HomeKit egress transcode decoded in SOFTWARE — including 4K H.265 —
8424
- * while D67's whole premise was that the decoder addon is the authority on
8425
- * hardware. The warn said `decoding in SOFTWARE` and read as "this node has no
8426
- * hardware", which was false.
8427
- *
8428
- * Normalising in the ONE constructor fixes every caller at once, which is why
8429
- * it is here and not at the call sites.
8430
- */
8431
- function nodePin(nodeId) {
8432
- return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: toNodeId(nodeId) } };
8433
- }
8434
- /**
8435
- * A runner id is `<nodeId>/<addonId>`; a node id has no slash. Taking the head
8436
- * is idempotent, so passing an already-clean id costs nothing.
8437
- */
8438
- function toNodeId(idOrRunnerId) {
8439
- const head = idOrRunnerId.split("/")[0];
8440
- return head === void 0 || head.length === 0 ? idOrRunnerId : head;
8441
- }
8442
8396
  object({
8443
8397
  field: string().min(1),
8444
8398
  on: literal("advance")
@@ -8527,9 +8481,135 @@ function optionalMethod(input, output, options) {
8527
8481
  providerOptional: true
8528
8482
  };
8529
8483
  }
8484
+ /**
8485
+ * Per-call node pinning for `ctx.api` capability calls.
8486
+ *
8487
+ * A capability call normally resolves to its DEFAULT provider — a `singleton`
8488
+ * cap resolves to the hub, a device-scoped cap to the device's owning node. To
8489
+ * query a SPECIFIC node's provider instead (e.g. a remote agent's own
8490
+ * in-process `platform-probe` hardware, which the hub cannot probe), pin the
8491
+ * call to that node.
8492
+ *
8493
+ * The nodeId rides OUT-OF-BAND in the tRPC call context (NOT in the validated
8494
+ * method args), so capability method signatures stay `nodeId`-free — node
8495
+ * targeting is a property of the CALL, not of the method. The transport lifts
8496
+ * it from `op.context` onto the `CapCallInput.nodeId` field (`ipcParentLink`),
8497
+ * and the hub parent's `onUnownedCall` passes it to the `CapRouteResolver`,
8498
+ * which classifies a pinned agent node as `agent-child-forward`
8499
+ * (`$agent-cap-fwd.forward` → the agent's in-process provider).
8500
+ *
8501
+ * Usage at a call site:
8502
+ *
8503
+ * await api.platformProbe.getCapabilities.query(undefined, nodePin(nodeId))
8504
+ */
8505
+ /** tRPC `op.context` key carrying a per-call node pin. */
8506
+ var CAP_NODE_PIN_CONTEXT_KEY = "__camstackNodePin";
8507
+ /**
8508
+ * Build the tRPC request options that pin a single capability call to `nodeId`.
8509
+ * Pass as the second argument to `.query(input, …)` / `.mutate(input, …)`.
8510
+ *
8511
+ * ## The id is normalised here, and it has to be
8512
+ *
8513
+ * A forked addon reads its own node from `ctx.kernel.localNodeId`, and inside a
8514
+ * worker that value is a RUNNER id — `hub/export-hap`, not `hub`. Routing
8515
+ * compares a pin against real node ids, so such a pin matches nothing and the
8516
+ * call fails with `no provider registered for cap "…"`. The local-first
8517
+ * resolver already guarded against this (`localNodeId.split('/')[0]`), which
8518
+ * made the hazard invisible: unpinned calls worked, and only an explicit pin —
8519
+ * the thing you reach for when you specifically need THIS node — silently
8520
+ * addressed a node that does not exist.
8521
+ *
8522
+ * Cost of it being missing: `addon-export-hap` pinned `decoder.getInfo` to its
8523
+ * own node to read the host's hardware-decode backend. It never once answered,
8524
+ * so every HomeKit egress transcode decoded in SOFTWARE — including 4K H.265 —
8525
+ * while D67's whole premise was that the decoder addon is the authority on
8526
+ * hardware. The warn said `decoding in SOFTWARE` and read as "this node has no
8527
+ * hardware", which was false.
8528
+ *
8529
+ * Normalising in the ONE constructor fixes every caller at once, which is why
8530
+ * it is here and not at the call sites.
8531
+ */
8532
+ function nodePin(nodeId) {
8533
+ return { context: { [CAP_NODE_PIN_CONTEXT_KEY]: toNodeId(nodeId) } };
8534
+ }
8535
+ /**
8536
+ * A runner id is `<nodeId>/<addonId>`; a node id has no slash. Taking the head
8537
+ * is idempotent, so passing an already-clean id costs nothing.
8538
+ */
8539
+ function toNodeId(idOrRunnerId) {
8540
+ const head = idOrRunnerId.split("/")[0];
8541
+ return head === void 0 || head.length === 0 ? idOrRunnerId : head;
8542
+ }
8543
+ /**
8544
+ * `addon-pages-source` — collection cap exposing per-provider raw page
8545
+ * declarations. Every addon that contributes a UI page registers a
8546
+ * provider here. The hub-side singleton aggregator (`addon-pages` cap,
8547
+ * see `addon-pages.cap.ts`) walks this collection, stamps versioned
8548
+ * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
8549
+ * that admin-ui consumes.
8550
+ *
8551
+ * The split exists because the public listing has a different output
8552
+ * shape than the per-provider raw declarations, and we want both ends
8553
+ * to flow through codegen instead of relying on a hand-written wrapper.
8554
+ */
8555
+ var AddonPageDeclarationSchema = object({
8556
+ id: string(),
8557
+ label: string(),
8558
+ icon: string(),
8559
+ path: string(),
8560
+ /**
8561
+ * Module Federation remote name — must match the `name` field on the
8562
+ * page addon's `federation()` plugin config. Used by admin-ui's
8563
+ * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
8564
+ * Conventionally `addon_<id>_page` (snake_case; MF names cannot
8565
+ * contain hyphens).
8566
+ */
8567
+ remoteName: string(),
8568
+ /**
8569
+ * Bundle filename inside the addon's `dist/` dir served at
8570
+ * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
8571
+ * is always `'remoteEntry.js'`; the value is kept on the metadata so
8572
+ * the static-file route can compute an mtime-based cache-buster URL
8573
+ * without a separate filesystem stat.
8574
+ */
8575
+ bundle: string(),
8576
+ /**
8577
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
8578
+ * `'cluster'`, `'administration'` — the page renders inside that group.
8579
+ * Any OTHER string creates (or joins) a custom section rendered after
8580
+ * the built-in groups; its label comes from `sectionLabel` (first
8581
+ * declaration wins), falling back to the id. Absent → the legacy
8582
+ * "Addon Pages" group.
8583
+ */
8584
+ section: string().optional(),
8585
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
8586
+ sectionLabel: string().optional()
8587
+ });
8588
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
8530
8589
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
8531
8590
  var VersionOutputSchema$1 = object({ version: string() });
8532
8591
  method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
8592
+ /**
8593
+ * The pipeline step-input shape and the run-result bridge, in a module that
8594
+ * imports nothing but zod and types.
8595
+ *
8596
+ * WHY A SEPARATE FILE (addon footprint, D28): both were declared in
8597
+ * `pipeline-executor.cap.ts`, whose import evaluates the whole executor schema
8598
+ * graph. An addon that only needs these two (the benchmark's `runPipelineTest`
8599
+ * action) paid ~130 MB of heap at load. `pipeline-executor.cap.ts` re-exports
8600
+ * them, so every existing import keeps working; addon server code takes them
8601
+ * from `@camstack/types/addon`.
8602
+ */
8603
+ var PipelineStepInputSchema = lazy(() => object({
8604
+ addonId: string(),
8605
+ modelId: string().optional(),
8606
+ enabled: boolean().default(true),
8607
+ children: array(PipelineStepInputSchema).optional(),
8608
+ settings: record(string(), unknown()).optional(),
8609
+ jumpDeviceKey: string().optional()
8610
+ }));
8611
+ /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
8612
+ var PipelineRunResultBridge = custom();
8533
8613
  var StaticDirOutputSchema = object({ staticDir: string() });
8534
8614
  var VersionOutputSchema = object({ version: string() });
8535
8615
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
@@ -8600,6 +8680,8 @@ Object.freeze({ "doorbell": "lastPressedAt" });
8600
8680
  /** Every capability name, so addon code can check a name without the schema graph. */
8601
8681
  var CAP_NAMES = Object.freeze([
8602
8682
  "accessories",
8683
+ "action-source",
8684
+ "actions",
8603
8685
  "addon-pages",
8604
8686
  "addon-pages-source",
8605
8687
  "addon-routes",
@@ -8683,6 +8765,7 @@ var CAP_NAMES = Object.freeze([
8683
8765
  "image-settings",
8684
8766
  "integrations",
8685
8767
  "intercom",
8768
+ "ir-transmitter",
8686
8769
  "keychain",
8687
8770
  "keychain-admin",
8688
8771
  "lawn-mower-control",
@@ -8711,6 +8794,7 @@ var CAP_NAMES = Object.freeze([
8711
8794
  "network-link",
8712
8795
  "network-quality",
8713
8796
  "node-certificates",
8797
+ "node-removal-hook",
8714
8798
  "nodes",
8715
8799
  "notification-output",
8716
8800
  "notification-rules",
@@ -8721,6 +8805,7 @@ var CAP_NAMES = Object.freeze([
8721
8805
  "osd",
8722
8806
  "osd-manager",
8723
8807
  "pet-feeder",
8808
+ "pet-fountain",
8724
8809
  "pipeline-analytics",
8725
8810
  "pipeline-executor",
8726
8811
  "pipeline-orchestrator",
@@ -8741,6 +8826,7 @@ var CAP_NAMES = Object.freeze([
8741
8826
  "recording-onboard",
8742
8827
  "recording-signal",
8743
8828
  "records",
8829
+ "remote",
8744
8830
  "running-state",
8745
8831
  "scene-monitor",
8746
8832
  "script-runner",
@@ -8764,6 +8850,7 @@ var CAP_NAMES = Object.freeze([
8764
8850
  "system",
8765
8851
  "tamper",
8766
8852
  "temperature-sensor",
8853
+ "template",
8767
8854
  "terminal-session",
8768
8855
  "toast",
8769
8856
  "training",
@@ -8788,11 +8875,11 @@ var CAP_NAMES = Object.freeze([
8788
8875
  Object.freeze({
8789
8876
  "air-quality-sensor": [
8790
8877
  {
8791
- "path": "co2Ppm",
8878
+ "path": "co2",
8792
8879
  "valueType": "number"
8793
8880
  },
8794
8881
  {
8795
- "path": "vocPpb",
8882
+ "path": "voc",
8796
8883
  "valueType": "number"
8797
8884
  },
8798
8885
  {
@@ -8842,7 +8929,7 @@ Object.freeze({
8842
8929
  }
8843
8930
  ],
8844
8931
  "ambient-light-sensor": [{
8845
- "path": "lux",
8932
+ "path": "illuminance",
8846
8933
  "valueType": "number"
8847
8934
  }],
8848
8935
  "audio-metrics": [
@@ -8903,7 +8990,7 @@ Object.freeze({
8903
8990
  ],
8904
8991
  "battery": [
8905
8992
  {
8906
- "path": "percentage",
8993
+ "path": "level",
8907
8994
  "valueType": "number"
8908
8995
  },
8909
8996
  {
@@ -8925,7 +9012,7 @@ Object.freeze({
8925
9012
  "valueType": "number"
8926
9013
  },
8927
9014
  {
8928
- "path": "volts",
9015
+ "path": "voltage",
8929
9016
  "valueType": "number"
8930
9017
  },
8931
9018
  {
@@ -8946,7 +9033,7 @@ Object.freeze({
8946
9033
  "valueType": "boolean"
8947
9034
  }],
8948
9035
  "brightness": [{
8949
- "path": "percentage",
9036
+ "path": "level",
8950
9037
  "valueType": "number"
8951
9038
  }],
8952
9039
  "broker": [{
@@ -9147,7 +9234,7 @@ Object.freeze({
9147
9234
  "valueType": "number"
9148
9235
  },
9149
9236
  {
9150
- "path": "mireds",
9237
+ "path": "colorTemperature",
9151
9238
  "valueType": "number"
9152
9239
  }
9153
9240
  ],
@@ -9326,15 +9413,15 @@ Object.freeze({
9326
9413
  "valueType": "string"
9327
9414
  },
9328
9415
  {
9329
- "path": "remainingSeconds",
9416
+ "path": "remaining",
9330
9417
  "valueType": "number"
9331
9418
  },
9332
9419
  {
9333
- "path": "delayedStartSeconds",
9420
+ "path": "delayedStart",
9334
9421
  "valueType": "number"
9335
9422
  },
9336
9423
  {
9337
- "path": "progressPercent",
9424
+ "path": "progress",
9338
9425
  "valueType": "number"
9339
9426
  },
9340
9427
  {
@@ -9448,7 +9535,7 @@ Object.freeze({
9448
9535
  ],
9449
9536
  "fan-control": [
9450
9537
  {
9451
- "path": "percentage",
9538
+ "path": "speed",
9452
9539
  "valueType": "number"
9453
9540
  },
9454
9541
  {
@@ -9548,7 +9635,7 @@ Object.freeze({
9548
9635
  }
9549
9636
  ],
9550
9637
  "humidity-sensor": [{
9551
- "path": "percent",
9638
+ "path": "humidity",
9552
9639
  "valueType": "number"
9553
9640
  }],
9554
9641
  "image": [{
@@ -9658,7 +9745,7 @@ Object.freeze({
9658
9745
  "valueType": "number"
9659
9746
  },
9660
9747
  {
9661
- "path": "progressPercent",
9748
+ "path": "progress",
9662
9749
  "valueType": "number"
9663
9750
  },
9664
9751
  {
@@ -9704,6 +9791,11 @@ Object.freeze({
9704
9791
  "standby"
9705
9792
  ]
9706
9793
  },
9794
+ {
9795
+ "path": "stateSource",
9796
+ "valueType": "enum",
9797
+ "enumValues": ["reported", "assumed"]
9798
+ },
9707
9799
  {
9708
9800
  "path": "volumeLevel",
9709
9801
  "valueType": "number"
@@ -9737,11 +9829,11 @@ Object.freeze({
9737
9829
  "valueType": "string"
9738
9830
  },
9739
9831
  {
9740
- "path": "positionMs",
9832
+ "path": "position",
9741
9833
  "valueType": "number"
9742
9834
  },
9743
9835
  {
9744
- "path": "durationMs",
9836
+ "path": "duration",
9745
9837
  "valueType": "number"
9746
9838
  },
9747
9839
  {
@@ -9843,11 +9935,11 @@ Object.freeze({
9843
9935
  ]
9844
9936
  },
9845
9937
  {
9846
- "path": "signalPercent",
9938
+ "path": "signal",
9847
9939
  "valueType": "number"
9848
9940
  },
9849
9941
  {
9850
- "path": "rssiDbm",
9942
+ "path": "rssi",
9851
9943
  "valueType": "number"
9852
9944
  },
9853
9945
  {
@@ -9902,6 +9994,18 @@ Object.freeze({
9902
9994
  "path": "foodLevel",
9903
9995
  "valueType": "number"
9904
9996
  },
9997
+ {
9998
+ "path": "bowlFood",
9999
+ "valueType": "number"
10000
+ },
10001
+ {
10002
+ "path": "eating",
10003
+ "valueType": "boolean"
10004
+ },
10005
+ {
10006
+ "path": "supportsMarkRefilled",
10007
+ "valueType": "boolean"
10008
+ },
9905
10009
  {
9906
10010
  "path": "food1",
9907
10011
  "valueType": "number"
@@ -9918,6 +10022,11 @@ Object.freeze({
9918
10022
  "path": "batteryPower",
9919
10023
  "valueType": "number"
9920
10024
  },
10025
+ {
10026
+ "path": "powerSource",
10027
+ "valueType": "enum",
10028
+ "enumValues": ["mains", "battery"]
10029
+ },
9921
10030
  {
9922
10031
  "path": "desiccantLeftDays",
9923
10032
  "valueType": "number"
@@ -9962,27 +10071,89 @@ Object.freeze({
9962
10071
  {
9963
10072
  "path": "volume",
9964
10073
  "valueType": "number"
10074
+ },
10075
+ {
10076
+ "path": "lastFeedGrams",
10077
+ "valueType": "number"
10078
+ },
10079
+ {
10080
+ "path": "lastFeedHopper1",
10081
+ "valueType": "number"
10082
+ },
10083
+ {
10084
+ "path": "lastFeedHopper2",
10085
+ "valueType": "number"
10086
+ }
10087
+ ],
10088
+ "pet-fountain": [
10089
+ {
10090
+ "path": "waterLevel",
10091
+ "valueType": "number"
10092
+ },
10093
+ {
10094
+ "path": "waterVolume",
10095
+ "valueType": "number"
10096
+ },
10097
+ {
10098
+ "path": "empty",
10099
+ "valueType": "boolean"
10100
+ },
10101
+ {
10102
+ "path": "pumpRunning",
10103
+ "valueType": "boolean"
10104
+ },
10105
+ {
10106
+ "path": "pumpIntervalEnabled",
10107
+ "valueType": "boolean"
10108
+ },
10109
+ {
10110
+ "path": "pumpOnTime",
10111
+ "valueType": "number"
10112
+ },
10113
+ {
10114
+ "path": "pumpOffTime",
10115
+ "valueType": "number"
10116
+ },
10117
+ {
10118
+ "path": "lastDrink",
10119
+ "valueType": "number"
10120
+ },
10121
+ {
10122
+ "path": "currentHourDrink",
10123
+ "valueType": "number"
10124
+ },
10125
+ {
10126
+ "path": "last24hDrink",
10127
+ "valueType": "number"
10128
+ },
10129
+ {
10130
+ "path": "todayDrink",
10131
+ "valueType": "number"
10132
+ },
10133
+ {
10134
+ "path": "error",
10135
+ "valueType": "string"
9965
10136
  }
9966
10137
  ],
9967
10138
  "power-meter": [
9968
10139
  {
9969
- "path": "watts",
10140
+ "path": "power",
9970
10141
  "valueType": "number"
9971
10142
  },
9972
10143
  {
9973
- "path": "kwhTotal",
10144
+ "path": "energy",
9974
10145
  "valueType": "number"
9975
10146
  },
9976
10147
  {
9977
- "path": "volts",
10148
+ "path": "voltage",
9978
10149
  "valueType": "number"
9979
10150
  },
9980
10151
  {
9981
- "path": "amps",
10152
+ "path": "current",
9982
10153
  "valueType": "number"
9983
10154
  },
9984
10155
  {
9985
- "path": "va",
10156
+ "path": "apparentPower",
9986
10157
  "valueType": "number"
9987
10158
  },
9988
10159
  {
@@ -10010,14 +10181,10 @@ Object.freeze({
10010
10181
  {
10011
10182
  "path": "gps.accuracyMeters",
10012
10183
  "valueType": "number"
10013
- },
10014
- {
10015
- "path": "batteryPercent",
10016
- "valueType": "number"
10017
10184
  }
10018
10185
  ],
10019
10186
  "pressure-sensor": [{
10020
- "path": "hpa",
10187
+ "path": "pressure",
10021
10188
  "valueType": "number"
10022
10189
  }],
10023
10190
  "privacy-mask": [{
@@ -10331,7 +10498,7 @@ Object.freeze({
10331
10498
  "valueType": "boolean"
10332
10499
  }],
10333
10500
  "temperature-sensor": [{
10334
- "path": "celsius",
10501
+ "path": "temperature",
10335
10502
  "valueType": "number"
10336
10503
  }],
10337
10504
  "update": [
@@ -10379,7 +10546,7 @@ Object.freeze({
10379
10546
  "valueType": "string"
10380
10547
  },
10381
10548
  {
10382
- "path": "progressPercent",
10549
+ "path": "progress",
10383
10550
  "valueType": "number"
10384
10551
  },
10385
10552
  {
@@ -10505,7 +10672,7 @@ object({
10505
10672
  params: record(string(), union([string(), number()])).optional()
10506
10673
  });
10507
10674
  //#endregion
10508
- //#region ../types/dist/err-msg-DIorGYeC.mjs
10675
+ //#region ../types/dist/err-msg-DWXWc0Di.mjs
10509
10676
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10510
10677
  DeviceType["Camera"] = "camera";
10511
10678
  DeviceType["Hub"] = "hub";
@@ -10597,6 +10764,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10597
10764
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10598
10765
  * integrations sharing the same food/desiccant/hopper surface. */
10599
10766
  DeviceType["PetFeeder"] = "pet-feeder";
10767
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
10768
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
10769
+ * of a container and is BUILT as a composed device (D967). */
10770
+ DeviceType["PetFountain"] = "pet-fountain";
10600
10771
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10601
10772
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10602
10773
  * Sources: native Bosch Home Connect, reusable by similar integrations.
@@ -10851,6 +11022,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10851
11022
  /** Fallback when the notifier service name doesn't match a known
10852
11023
  * pattern. */
10853
11024
  DeviceRole["GenericNotifier"] = "generic-notifier";
11025
+ /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
11026
+ * cap. A `DeviceType.Generic` device. */
11027
+ DeviceRole["IrTransmitter"] = "ir-transmitter";
10854
11028
  return DeviceRole;
10855
11029
  }({});
10856
11030
  /**
@@ -10858,13 +11032,13 @@ import { errMsg } from '@camstack/types'
10858
11032
  * Extract a human-readable message from an unknown error value.
10859
11033
  * Replaces the ubiquitous `errMsg(err)` pattern.
10860
11034
  */
10861
- function errMsg$16(err) {
11035
+ function errMsg$17(err) {
10862
11036
  if (err instanceof Error) return err.message;
10863
11037
  if (typeof err === "string") return err;
10864
11038
  return String(err);
10865
11039
  }
10866
11040
  //#endregion
10867
- //#region ../types/dist/composition-Bb8iwHEJ.mjs
11041
+ //#region ../types/dist/composition-kSuOifuG.mjs
10868
11042
  var AUDIO_ENCODER_BY_CODEC = {
10869
11043
  opus: "libopus",
10870
11044
  aac: "aac",
@@ -12544,12 +12718,28 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
12544
12718
  ])
12545
12719
  })
12546
12720
  ]);
12547
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
12721
+ var forwardArgUnion = union([
12722
+ string(),
12723
+ number(),
12724
+ boolean(),
12725
+ strictObject({ ["$input"]: string().min(1) }),
12726
+ record(string().min(1), lazy(() => forwardArgUnion))
12727
+ ]);
12728
+ var CompositionForwardArgSchema = forwardArgUnion;
12729
+ /**
12730
+ * `forward` (D659, amended by D967): one method of a BUILT capability is one
12731
+ * call of `cap.method` on `source`. Without `args` the built method's input
12732
+ * passes through minus `deviceId`; with `args` the template IS the source's
12733
+ * whole input. `deviceId` is always the source's own, never an argument.
12734
+ */
12735
+ var CompositionForwardCommandSchema = object({
12548
12736
  kind: literal("forward"),
12549
12737
  source: CompositionSourceRefSchema,
12550
12738
  cap: string().min(1),
12551
- method: string().min(1)
12552
- }), CompositionCodeSourceSchema]);
12739
+ method: string().min(1),
12740
+ args: record(string().min(1), CompositionForwardArgSchema).optional()
12741
+ });
12742
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
12553
12743
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
12554
12744
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
12555
12745
  /**
@@ -12559,7 +12749,13 @@ var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
12559
12749
  */
12560
12750
  var CompositionItemEntrySchema = object({
12561
12751
  label: string().min(1).max(80),
12562
- fields: record(string().min(1), CompositionFieldSourceSchema)
12752
+ fields: record(string().min(1), CompositionFieldSourceSchema),
12753
+ /**
12754
+ * What the cap's `reset` does for THIS item (consumables). Present = the item
12755
+ * is resettable and a `reset` call naming its key forwards here. The item key
12756
+ * selects the command, so it is never an argument: there is no pass-through.
12757
+ */
12758
+ reset: CompositionForwardCommandSchema.optional()
12563
12759
  });
12564
12760
  var CompositionFeatureSchema = discriminatedUnion("kind", [object({
12565
12761
  kind: literal("fields"),
@@ -12571,7 +12767,7 @@ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
12571
12767
  * owns the WHOLE array field: the composed value holds exactly these items.
12572
12768
  */
12573
12769
  items: record(string().regex(COMPOSITION_ITEM_KEY_RE), CompositionItemEntrySchema).refine((items) => Object.keys(items).length <= 16, { message: `at most 16 items` }).optional(),
12574
- /** RESERVED for slice 3; refused by the validator when non-empty. */
12770
+ /** Method name → what serves it. Only a BUILT capability takes commands (D967). */
12575
12771
  commands: record(string().min(1), CompositionCommandTargetSchema).optional()
12576
12772
  }), object({
12577
12773
  kind: literal("passthrough"),
@@ -16203,6 +16399,14 @@ var AutomationConditionLeafSchema = object({
16203
16399
  array(union([string(), number()]))
16204
16400
  ])
16205
16401
  });
16402
+ var AutomationConditionStationaryPresentSchema = object({
16403
+ kind: literal("stationary-present"),
16404
+ deviceId: number().int().nonnegative(),
16405
+ /** Class names; a macro class matches every raw class that maps to it. */
16406
+ classes: array(string().min(1)).min(1).optional(),
16407
+ /** The parked object must be in at least one of these zones. */
16408
+ zones: array(string().min(1)).min(1).optional()
16409
+ });
16206
16410
  /**
16207
16411
  * The expression leaf, declared as a plain object rather than an intersection
16208
16412
  * with {@link ExpressionSourceSchema}: a discriminated union has to be able to
@@ -16236,7 +16440,8 @@ var AutomationConditionSchema = lazy(() => discriminatedUnion("kind", [
16236
16440
  child: AutomationConditionSchema
16237
16441
  }),
16238
16442
  AutomationConditionLeafSchema,
16239
- AutomationConditionExpressionSchema
16443
+ AutomationConditionExpressionSchema,
16444
+ AutomationConditionStationaryPresentSchema
16240
16445
  ]));
16241
16446
  /**
16242
16447
  * What starts a run.
@@ -16277,7 +16482,34 @@ var AutomationTriggerSchema = discriminatedUnion("kind", [
16277
16482
  kind: literal("schedule"),
16278
16483
  cron: string().min(1).max(120)
16279
16484
  }),
16280
- object({ kind: literal("manual") })
16485
+ object({ kind: literal("manual") }),
16486
+ object({
16487
+ kind: literal("detection"),
16488
+ /** Class names. A macro class (`animal`, `vehicle`, `person`, `package`)
16489
+ * matches every raw class that maps to it; any other name matches
16490
+ * exactly. */
16491
+ classes: array(string().min(1)).min(1),
16492
+ deviceIds: array(number().int().nonnegative()).min(1),
16493
+ /** The track must have visited at least one of these zones. */
16494
+ zones: array(string().min(1)).min(1).optional(),
16495
+ /** Best-so-far confidence the track must reach. */
16496
+ minScore: number().min(0).max(1).optional()
16497
+ }),
16498
+ object({
16499
+ kind: literal("stationary"),
16500
+ deviceIds: array(number().int().nonnegative()).min(1),
16501
+ /** Class names; a macro class matches like the detection trigger. */
16502
+ classes: array(string().min(1)).min(1).optional(),
16503
+ /** The parked object must be in at least one of these zones. */
16504
+ zones: array(string().min(1)).min(1).optional(),
16505
+ /** `appeared`: it became parked. `departed`: the registry retired it.
16506
+ * The vocabulary of `PipelineAnalyticsStationaryChanged`. */
16507
+ phase: _enum(["appeared", "departed"])
16508
+ }),
16509
+ object({
16510
+ kind: literal("interval"),
16511
+ minutes: number().int().min(1).max(1440)
16512
+ })
16281
16513
  ]);
16282
16514
  /**
16283
16515
  * One action step.
@@ -16297,28 +16529,47 @@ var AutomationTriggerSchema = discriminatedUnion("kind", [
16297
16529
  * is called. The runner still receives a number and is untouched; the
16298
16530
  * resolution is the recipe's job, not the runner's.
16299
16531
  */
16532
+ var AutomationWaitStepSchema = object({
16533
+ kind: literal("wait"),
16534
+ seconds: number().min(0).max(300)
16535
+ });
16536
+ var AutomationCapStepSchema = object({
16537
+ kind: literal("cap"),
16538
+ /**
16539
+ * One device, several same-family devices (locks / climate family / …),
16540
+ * or `{ $var }` for the device that triggered the run. An array is
16541
+ * fan-out at codegen — each id gets the same cap.method call.
16542
+ */
16543
+ deviceId: union([
16544
+ number().int(),
16545
+ array(number().int()).min(1),
16546
+ object({ $var: string().min(1) })
16547
+ ]),
16548
+ cap: string().min(1),
16549
+ method: string().min(1),
16550
+ /** Values may carry `{{vars.x}}` slots, or be exactly `{ $var: 'name' }`, which
16551
+ * SUBSTITUTE and do not evaluate (§3.2.3). Anything beyond substitution is
16552
+ * the expression leaf. */
16553
+ args: record(string(), unknown()).optional()
16554
+ });
16555
+ /**
16556
+ * The steps an internal Action may contain: cap and wait, and nothing that can
16557
+ * call back into an Action — so an Action can never reach itself (no cycles).
16558
+ */
16559
+ var ActionStepSchema = discriminatedUnion("kind", [AutomationWaitStepSchema, AutomationCapStepSchema]);
16300
16560
  var AutomationActionSchema = discriminatedUnion("kind", [
16561
+ AutomationWaitStepSchema,
16562
+ AutomationCapStepSchema,
16301
16563
  object({
16302
- kind: literal("wait"),
16303
- seconds: number().min(0).max(300)
16304
- }),
16305
- object({
16306
- kind: literal("cap"),
16307
- /**
16308
- * One device, several same-family devices (locks / climate family / …),
16309
- * or `{ $var }` for the device that triggered the run. An array is
16310
- * fan-out at codegen — each id gets the same cap.method call.
16311
- */
16312
- deviceId: union([
16313
- number().int(),
16314
- array(number().int()).min(1),
16315
- object({ $var: string().min(1) })
16316
- ]),
16317
- cap: string().min(1),
16318
- method: string().min(1),
16319
- /** Values may carry `{{vars.x}}` slots, which SUBSTITUTE and do not
16320
- * evaluate (§3.2.3). Anything beyond substitution is the expression leaf. */
16321
- args: record(string(), unknown()).optional()
16564
+ kind: literal("action"),
16565
+ /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
16566
+ actionId: string().min(1),
16567
+ /** Values for the action's declared variables; the others take their default. */
16568
+ variables: record(string(), union([
16569
+ string(),
16570
+ number(),
16571
+ boolean()
16572
+ ])).optional()
16322
16573
  }),
16323
16574
  object({
16324
16575
  kind: literal("code"),
@@ -16327,11 +16578,862 @@ var AutomationActionSchema = discriminatedUnion("kind", [
16327
16578
  code: string().min(1).max(2e4)
16328
16579
  })
16329
16580
  ]);
16581
+ /**
16582
+ * How a trigger that arrives while the automation is busy (or cooling down) is
16583
+ * handled. One of the automation's execution modes, never a property of its
16584
+ * actions. Absent means `single`.
16585
+ *
16586
+ * - `single` — drop the trigger while a run is in progress (traced + logged).
16587
+ * - `restart` — abort the run in progress (at its next step boundary), start fresh.
16588
+ * - `queued` — queue up to `max` triggers, drop the rest (traced).
16589
+ * - `parallel` — up to `max` runs at once, drop the rest (traced).
16590
+ * - `cooldown` — `single`, and no new run until `minutes` after the last run
16591
+ * STARTED; persisted across a restart. A manual trigger bypasses only this
16592
+ * wait, never the single/queued limits.
16593
+ */
16594
+ var AutomationRunModeSchema = discriminatedUnion("mode", [
16595
+ object({ mode: literal("single") }),
16596
+ object({ mode: literal("restart") }),
16597
+ object({
16598
+ mode: literal("queued"),
16599
+ max: number().int().min(1).max(10)
16600
+ }),
16601
+ object({
16602
+ mode: literal("parallel"),
16603
+ max: number().int().min(1).max(10)
16604
+ }),
16605
+ object({
16606
+ mode: literal("cooldown"),
16607
+ minutes: number().int().min(1).max(1440)
16608
+ })
16609
+ ]);
16330
16610
  var AutomationRecipeSchema = object({
16331
16611
  triggers: array(AutomationTriggerSchema),
16332
16612
  conditions: AutomationConditionSchema.optional(),
16333
- actions: array(AutomationActionSchema)
16613
+ actions: array(AutomationActionSchema),
16614
+ runMode: AutomationRunModeSchema.optional(),
16615
+ /** How many run traces the automation keeps (default {@link DEFAULT_TRACE_KEEP}). */
16616
+ keepTraces: number().int().min(1).max(100).optional()
16334
16617
  });
16618
+ new Set([
16619
+ {
16620
+ id: "person",
16621
+ name: "Person"
16622
+ },
16623
+ {
16624
+ id: "vehicle",
16625
+ name: "Vehicle"
16626
+ },
16627
+ {
16628
+ id: "animal",
16629
+ name: "Animal"
16630
+ },
16631
+ {
16632
+ id: "package",
16633
+ name: "Package"
16634
+ }
16635
+ ].map((l) => l.id));
16636
+ var COCO_TO_MACRO = {
16637
+ mapping: {
16638
+ person: "person",
16639
+ bicycle: "vehicle",
16640
+ car: "vehicle",
16641
+ motorcycle: "vehicle",
16642
+ airplane: "vehicle",
16643
+ bus: "vehicle",
16644
+ train: "vehicle",
16645
+ truck: "vehicle",
16646
+ boat: "vehicle",
16647
+ bird: "animal",
16648
+ cat: "animal",
16649
+ dog: "animal",
16650
+ horse: "animal",
16651
+ sheep: "animal",
16652
+ cow: "animal",
16653
+ elephant: "animal",
16654
+ bear: "animal",
16655
+ zebra: "animal",
16656
+ giraffe: "animal",
16657
+ suitcase: "package",
16658
+ backpack: "package",
16659
+ handbag: "package"
16660
+ },
16661
+ preserveOriginal: false
16662
+ };
16663
+ new Set(Object.values(COCO_TO_MACRO.mapping));
16664
+ /**
16665
+ * Run traces — what an automation (or, later, an Action run) DID, node by node,
16666
+ * so the editor can paint every block green or red with its reason.
16667
+ *
16668
+ * A trace is data, not a log: it covers the WHOLE tree — the trigger stage,
16669
+ * every condition node (containers and leaves, including the ones a
16670
+ * short-circuit never reached), the run-mode verdict and every action step —
16671
+ * each addressed by a stable path (`conditions.0.1`, `actions.2`, or `steps.N`
16672
+ * for an Action run). Skipped
16673
+ * evaluations are traced too, and identical consecutive skips collapse into a
16674
+ * repeat count so a trigger that fails every 5 minutes cannot flush real runs.
16675
+ *
16676
+ * {@link AutomationStepTraceSchema} is deliberately free of automation
16677
+ * vocabulary so an Action run records the same step shape.
16678
+ */
16679
+ /** A value a trace may show: JSON primitives and short lists, nothing deeper. */
16680
+ var TraceValueSchema = union([
16681
+ string(),
16682
+ number(),
16683
+ boolean(),
16684
+ _null(),
16685
+ array(union([string(), number()]))
16686
+ ]);
16687
+ var AutomationRunOutcomeSchema = _enum([
16688
+ "ran",
16689
+ "skipped-trigger",
16690
+ "skipped-conditions",
16691
+ "skipped-cooldown",
16692
+ "skipped-overlap",
16693
+ "failed",
16694
+ "aborted"
16695
+ ]);
16696
+ /** `not-evaluated` = a short-circuit never reached the node. */
16697
+ var TraceNodeOutcomeSchema = _enum([
16698
+ "pass",
16699
+ "fail",
16700
+ "not-evaluated"
16701
+ ]);
16702
+ var AutomationTriggerTraceSchema = object({
16703
+ kind: string().min(1),
16704
+ outcome: _enum(["pass", "fail"]),
16705
+ /** Why an event was rejected ("class person not in [dog]") or what fired. */
16706
+ reason: string(),
16707
+ /** deviceId, className, trackId, score … — only what the trigger exposes. */
16708
+ vars: record(string(), TraceValueSchema)
16709
+ });
16710
+ var AutomationConditionTraceNodeSchema = object({
16711
+ /** `conditions` for the root, `conditions.<i>` for its i-th child, … */
16712
+ path: string().min(1),
16713
+ kind: _enum([
16714
+ "all",
16715
+ "any",
16716
+ "not",
16717
+ "condition",
16718
+ "expression",
16719
+ "stationary-present"
16720
+ ]),
16721
+ outcome: TraceNodeOutcomeSchema,
16722
+ reason: string(),
16723
+ deviceId: number().int().optional(),
16724
+ cap: string().optional(),
16725
+ fieldPath: string().optional(),
16726
+ operator: string().optional(),
16727
+ expected: TraceValueSchema.optional(),
16728
+ /** What the mirror held; `null` when it held nothing (unknown). */
16729
+ observed: TraceValueSchema.optional()
16730
+ });
16731
+ var AutomationRunVerdictSchema = object({
16732
+ mode: AutomationRunModeSchema,
16733
+ decision: _enum([
16734
+ "run",
16735
+ "queued",
16736
+ "restart",
16737
+ "drop",
16738
+ "cooldown",
16739
+ "bypass"
16740
+ ]),
16741
+ reason: string()
16742
+ });
16743
+ /** One executed (or not-run) step — shared by automations and Action runs. */
16744
+ var AutomationStepTraceSchema = object({
16745
+ /** `actions.<i>` */
16746
+ path: string().min(1),
16747
+ kind: string().min(1),
16748
+ cap: string().optional(),
16749
+ method: string().optional(),
16750
+ deviceId: number().int().optional(),
16751
+ startedAt: number().optional(),
16752
+ endedAt: number().optional(),
16753
+ outcome: _enum([
16754
+ "ok",
16755
+ "error",
16756
+ "not-run"
16757
+ ]),
16758
+ message: string().optional()
16759
+ });
16760
+ var AutomationRunTraceSchema = object({
16761
+ runId: string().min(1),
16762
+ startedAt: number(),
16763
+ endedAt: number(),
16764
+ trigger: AutomationTriggerTraceSchema,
16765
+ conditions: array(AutomationConditionTraceNodeSchema),
16766
+ verdict: AutomationRunVerdictSchema.optional(),
16767
+ steps: array(AutomationStepTraceSchema),
16768
+ outcome: AutomationRunOutcomeSchema,
16769
+ /** How many identical consecutive skips this trace stands for (>= 1). */
16770
+ repeat: number().int().min(1),
16771
+ /** When the latest of those repeats happened. */
16772
+ lastAt: number()
16773
+ });
16774
+ /**
16775
+ * What the hub's `runs` ledger holds for one owner (`automation:<blockId>` or
16776
+ * `action:<actionId>`): the cooldown stamp and the trace ring.
16777
+ */
16778
+ var AutomationStateDocSchema = object({
16779
+ version: literal(1),
16780
+ lastRunStartedAt: number().nullable(),
16781
+ traces: array(AutomationRunTraceSchema)
16782
+ });
16783
+ /**
16784
+ * Actions — named, runnable things an operator (or an automation) can start,
16785
+ * declared as LIST ENTRIES, never as devices.
16786
+ *
16787
+ * An entry is either **internal** (a short list of cap/wait steps kept in the
16788
+ * hub's `actions` record kind) or declared by an addon through the
16789
+ * `action-source` collection (a Home Assistant script, a scene …). The one
16790
+ * surface the UI and automations talk to is the `actions` cap; it keeps no
16791
+ * catalog of its own (D3) — every `list` asks the providers live.
16792
+ *
16793
+ * This file is the data half: the entry schema, the variables an entry may
16794
+ * declare, and the pure resolution of the values a run was given. It holds no
16795
+ * runtime.
16796
+ */
16797
+ /** What a variable's value is. `select` takes one of `options`. */
16798
+ var ActionVariableTypeSchema = _enum([
16799
+ "string",
16800
+ "number",
16801
+ "boolean",
16802
+ "select"
16803
+ ]);
16804
+ var ACTION_VARIABLE_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
16805
+ var ActionVariableValueSchema = union([
16806
+ string(),
16807
+ number(),
16808
+ boolean()
16809
+ ]);
16810
+ /**
16811
+ * One declared variable. Steps reference it as `{ $var: 'name' }` (the whole
16812
+ * value) or `{{vars.name}}` (inside a string) in their args.
16813
+ */
16814
+ var ActionVariableSchema = object({
16815
+ name: string().regex(ACTION_VARIABLE_NAME_RE),
16816
+ label: string().min(1).max(120).optional(),
16817
+ type: ActionVariableTypeSchema,
16818
+ required: boolean().optional(),
16819
+ default: ActionVariableValueSchema.optional(),
16820
+ /** The allowed values of a `select`. */
16821
+ options: array(string().min(1)).min(1).optional()
16822
+ }).superRefine((v, ctx) => {
16823
+ if (v.type === "select" && v.options === void 0) ctx.addIssue({
16824
+ code: "custom",
16825
+ message: "a select variable needs options",
16826
+ path: ["options"]
16827
+ });
16828
+ if (v.default !== void 0 && variableValueError(v, v.default) !== null) ctx.addIssue({
16829
+ code: "custom",
16830
+ message: variableValueError(v, v.default) ?? "invalid default",
16831
+ path: ["default"]
16832
+ });
16833
+ });
16834
+ /** Why `value` is not a legal value for the variable, or null when it is. */
16835
+ function variableValueError(variable, value) {
16836
+ switch (variable.type) {
16837
+ case "string": return typeof value === "string" ? null : `variable "${variable.name}" must be a string`;
16838
+ case "number": return typeof value === "number" && Number.isFinite(value) ? null : `variable "${variable.name}" must be a number`;
16839
+ case "boolean": return typeof value === "boolean" ? null : `variable "${variable.name}" must be true or false`;
16840
+ case "select": return typeof value === "string" && (variable.options ?? []).includes(value) ? null : `variable "${variable.name}" must be one of ${(variable.options ?? []).join(", ")}`;
16841
+ }
16842
+ }
16843
+ var ActionSourceKindSchema = _enum(["internal", "addon"]);
16844
+ function isInternalActionId(actionId) {
16845
+ return actionId.startsWith("internal:") && actionId.length > 9;
16846
+ }
16847
+ /** The addon behind a `<addonId>:<localId>` id, or null for anything else (internal included). */
16848
+ function addonIdOfActionId(actionId) {
16849
+ if (isInternalActionId(actionId)) return null;
16850
+ const at = actionId.indexOf(":");
16851
+ return at > 0 && at < actionId.length - 1 ? actionId.slice(0, at) : null;
16852
+ }
16853
+ var ActionStatusSchema = object({
16854
+ isRunning: boolean(),
16855
+ /** Ms epoch the latest run STARTED; null when it never ran. */
16856
+ lastRunAt: number().nullable(),
16857
+ /** The latest run's failure; null on success or when it never ran. */
16858
+ lastError: string().nullable()
16859
+ });
16860
+ var ActionEntrySchema = object({
16861
+ /** `internal:<uuid>` or `<addonId>:<localId>`. */
16862
+ id: string().min(3),
16863
+ name: string().min(1).max(120),
16864
+ /** The addon that declared it; `core-blocks` for an internal one. */
16865
+ addonId: string().min(1),
16866
+ source: ActionSourceKindSchema,
16867
+ /** An addon-declared entry is edited where it was declared. */
16868
+ readOnly: boolean(),
16869
+ /** Internal only: cap and wait steps. No action-in-action, so no cycles. */
16870
+ steps: array(ActionStepSchema).min(1).max(50).optional(),
16871
+ variables: array(ActionVariableSchema).max(20).optional(),
16872
+ status: ActionStatusSchema
16873
+ }).superRefine((entry, ctx) => {
16874
+ if (entry.source === "internal") {
16875
+ if (!isInternalActionId(entry.id)) ctx.addIssue({
16876
+ code: "custom",
16877
+ message: "an internal action id is internal:<uuid>",
16878
+ path: ["id"]
16879
+ });
16880
+ return;
16881
+ }
16882
+ if (entry.steps !== void 0) ctx.addIssue({
16883
+ code: "custom",
16884
+ message: "only an internal action carries steps",
16885
+ path: ["steps"]
16886
+ });
16887
+ if (!entry.readOnly) ctx.addIssue({
16888
+ code: "custom",
16889
+ message: "an addon action is read-only here",
16890
+ path: ["readOnly"]
16891
+ });
16892
+ if (addonIdOfActionId(entry.id) === null) ctx.addIssue({
16893
+ code: "custom",
16894
+ message: "an addon action id is <addonId>:<localId>",
16895
+ path: ["id"]
16896
+ });
16897
+ });
16898
+ /** What an operator writes for an internal action. */
16899
+ var ActionInputSchema = object({
16900
+ name: string().min(1).max(120),
16901
+ steps: array(ActionStepSchema).min(1).max(50),
16902
+ variables: array(ActionVariableSchema).max(20).optional()
16903
+ });
16904
+ /** Who started a run. Absent = the operator pressed it. */
16905
+ var ActionRunOriginSchema = object({
16906
+ /** The automation block whose step started it. */
16907
+ blockId: string().min(1).optional() });
16908
+ /** `started` = the caller did not ask to wait. */
16909
+ var ActionRunOutcomeSchema = union([AutomationRunOutcomeSchema, literal("started")]);
16910
+ var ActionRunResultSchema = object({
16911
+ runId: string().min(1),
16912
+ outcome: ActionRunOutcomeSchema,
16913
+ /** Why it did not run, or what failed. */
16914
+ message: string().optional()
16915
+ });
16916
+ _enum([
16917
+ "not-found",
16918
+ "read-only",
16919
+ "invalid-variables",
16920
+ "invalid-steps",
16921
+ "not-linked",
16922
+ "busy"
16923
+ ]);
16924
+ object({
16925
+ actionId: string(),
16926
+ runId: string(),
16927
+ isRunning: boolean(),
16928
+ /** Set when the run ended. */
16929
+ outcome: AutomationRunOutcomeSchema.optional(),
16930
+ lastRunAt: number().nullable(),
16931
+ lastError: string().nullable()
16932
+ });
16933
+ /**
16934
+ * notification-output — canonical, capability-gated notification delivery.
16935
+ *
16936
+ * Apprise-derived model (see
16937
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
16938
+ * callers emit ONE canonical `Notification`; each provider declares a
16939
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
16940
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
16941
+ * message to what the kind supports — callers never special-case a service.
16942
+ *
16943
+ * DESIGN DECISIONS (locked):
16944
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
16945
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
16946
+ * cap. Rationale: the admin UI needs one uniform surface across the
16947
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
16948
+ * alternative would fork the UI per addon and cannot host the
16949
+ * discovery→adopt flow.
16950
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
16951
+ * the generated cap-mount auto-`concatCollection`-fans them across every
16952
+ * registered provider (notifiers addon + HA addon) so one catalog is
16953
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
16954
+ * `addonId` the generated collection router extracts from the call input.
16955
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
16956
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
16957
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
16958
+ * base64 fallback needed.
16959
+ *
16960
+ * TODO (deferred, closed-set change — separate decision): add
16961
+ * `providerKind: 'notify'` so notification providers surface on the unified
16962
+ * admin "Integrations" page.
16963
+ */
16964
+ /**
16965
+ * Zentik-derived typed-media enum — the superset across every kind. Each
16966
+ * adapter picks what it supports and the degrade engine filters the rest.
16967
+ */
16968
+ var AttachmentMediaTypeSchema = _enum([
16969
+ "image",
16970
+ "video",
16971
+ "gif",
16972
+ "audio",
16973
+ "icon"
16974
+ ]);
16975
+ /**
16976
+ * A single attachment. Exactly one of `url` (remote source, most adapters
16977
+ * prefer this) or `bytes` (inline source; required for Pushover-style
16978
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
16979
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
16980
+ */
16981
+ var AttachmentSchema = object({
16982
+ mediaType: AttachmentMediaTypeSchema,
16983
+ url: string().optional(),
16984
+ bytes: _instanceof(Uint8Array).optional(),
16985
+ mime: string().optional(),
16986
+ name: string().optional()
16987
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
16988
+ var NotificationFormatSchema = _enum([
16989
+ "text",
16990
+ "markdown",
16991
+ "html"
16992
+ ]);
16993
+ /**
16994
+ * The CLOSED icon vocabulary an action button may use.
16995
+ *
16996
+ * A closed set, not a free string, and that is the whole point: an arbitrary
16997
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
16998
+ * notices — the same class of gap as a zone vocabulary nothing produced
16999
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
17000
+ * declares `actionIcons: false` and the degrade engine strips the field.
17001
+ *
17002
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
17003
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
17004
+ * differently.
17005
+ *
17006
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
17007
+ *
17008
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
17009
+ * the whole set onto its own renderer's vocabulary through a
17010
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
17011
+ * fallback, so adding a member here fails every adapter's build until someone
17012
+ * decides its glyph, which is the only place that decision can be made
17013
+ * honestly.
17014
+ *
17015
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
17016
+ * `disarm` straight through; iOS feeds that string to
17017
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
17018
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
17019
+ * mapping, and "the field is documented" is not "the value renders".
17020
+ *
17021
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
17022
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
17023
+ * so an addon that emits a token the running hub does not know does not lose an
17024
+ * icon — its whole `send` fails Zod validation and the notification never
17025
+ * arrives. Never emit a new token from an addon before the train carrying it.
17026
+ */
17027
+ var NotificationActionIconSchema = _enum([
17028
+ "acknowledge",
17029
+ "dismiss",
17030
+ "silence",
17031
+ "snooze",
17032
+ "view",
17033
+ "play",
17034
+ "open",
17035
+ "close",
17036
+ "lock",
17037
+ "unlock",
17038
+ "arm",
17039
+ "arm-home",
17040
+ "arm-away",
17041
+ "arm-night",
17042
+ "disarm",
17043
+ "light",
17044
+ "alert",
17045
+ "camera"
17046
+ ]);
17047
+ /** A single tap-through action button. */
17048
+ var NotificationActionSchema = object({
17049
+ id: string(),
17050
+ label: string(),
17051
+ url: string().optional(),
17052
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
17053
+ icon: NotificationActionIconSchema.optional(),
17054
+ /**
17055
+ * Renders in a warning style where the notifier supports it.
17056
+ *
17057
+ * A HINT, never a gate. The callback's authority is its token and nothing
17058
+ * else — see `notification-center/action-token.ts` for what that does and
17059
+ * does not buy.
17060
+ */
17061
+ destructive: boolean().optional(),
17062
+ /**
17063
+ * How the tap should REACH the url.
17064
+ *
17065
+ * `navigate` (absent, and every button authored before this field) opens it:
17066
+ * the phone leaves the notification and shows whatever the callback returns.
17067
+ * That is right for a button whose answer the operator wants to read.
17068
+ *
17069
+ * `background` fires it as a POST and stays put. It exists for the buttons
17070
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
17071
+ * an answer to the notification, and being thrown into a browser tab to
17072
+ * confirm it costs more attention than the notification did. A backend that
17073
+ * cannot do a background call renders it as an ordinary link (the adapters
17074
+ * fall back rather than dropping the button), so this is a preference, never
17075
+ * a requirement.
17076
+ */
17077
+ mode: _enum(["navigate", "background"]).optional()
17078
+ });
17079
+ /** A delivery parameter value: what a notifier declared it takes. */
17080
+ var DeliveryParamValueSchema = union([
17081
+ string(),
17082
+ number(),
17083
+ boolean()
17084
+ ]);
17085
+ /**
17086
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
17087
+ * addresses a target of that kind may set it; a kind that declares nothing is
17088
+ * never handed one. The admin UI derives its control from this descriptor —
17089
+ * no editor knows a service by name.
17090
+ *
17091
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
17092
+ * run on the addon cap path).
17093
+ */
17094
+ var DeliveryParamSchema = object({
17095
+ key: string().min(1),
17096
+ label: string(),
17097
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
17098
+ labelKey: string().optional(),
17099
+ type: _enum([
17100
+ "enum",
17101
+ "number",
17102
+ "boolean",
17103
+ "string"
17104
+ ]),
17105
+ /** `enum` only: the closed set of accepted values. */
17106
+ options: array(object({
17107
+ value: string(),
17108
+ label: string()
17109
+ })).optional(),
17110
+ /** `number` only. */
17111
+ min: number().optional(),
17112
+ max: number().optional(),
17113
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
17114
+ default: DeliveryParamValueSchema.optional()
17115
+ });
17116
+ /**
17117
+ * The canonical notification. `body` is the only hard field (Apprise model).
17118
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
17119
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
17120
+ * the adapter maps this ordinal onto its native level. `level?` is an
17121
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
17122
+ * `priority` for that one target.
17123
+ */
17124
+ var NotificationSchema = object({
17125
+ body: string(),
17126
+ title: string().optional(),
17127
+ format: NotificationFormatSchema.default("text"),
17128
+ priority: number().int().min(1).max(5).default(3),
17129
+ level: string().optional(),
17130
+ attachments: array(AttachmentSchema).optional(),
17131
+ clickUrl: string().optional(),
17132
+ actions: array(NotificationActionSchema).optional(),
17133
+ sound: string().optional(),
17134
+ ttl: number().optional(),
17135
+ tag: string().optional(),
17136
+ deviceId: number().optional(),
17137
+ eventId: string().optional(),
17138
+ metadata: record(string(), unknown()).optional(),
17139
+ /**
17140
+ * Values for the parameters the target's kind DECLARES in
17141
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
17142
+ * declaration by the sender; a notifier reads only the keys it declared.
17143
+ */
17144
+ delivery: record(string(), DeliveryParamValueSchema).optional()
17145
+ });
17146
+ /** One declared native severity/priority level for a kind. */
17147
+ var TargetKindLevelSchema = object({
17148
+ id: string(),
17149
+ label: string(),
17150
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
17151
+ ordinal: number().int().min(1).max(5).nullable(),
17152
+ flags: object({
17153
+ critical: boolean().optional(),
17154
+ silent: boolean().optional(),
17155
+ noPush: boolean().optional()
17156
+ }).optional(),
17157
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
17158
+ requires: array(string()).optional(),
17159
+ description: string().optional()
17160
+ });
17161
+ /** The full capability block consulted before dispatch. */
17162
+ var TargetKindCapsSchema = object({
17163
+ attachments: object({
17164
+ mediaTypes: array(AttachmentMediaTypeSchema),
17165
+ mode: _enum([
17166
+ "url",
17167
+ "bytes",
17168
+ "both"
17169
+ ]),
17170
+ max: number().int().nonnegative(),
17171
+ maxBytes: number().int().positive().optional()
17172
+ }),
17173
+ /** Max action buttons (0 = none). */
17174
+ actions: number().int().nonnegative(),
17175
+ /**
17176
+ * Whether this kind renders a per-action ICON.
17177
+ *
17178
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
17179
+ * run on the addon cap path — three production failures in one day taught
17180
+ * this repo that once. Absent is read as false by the degrade engine, which
17181
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
17182
+ * assumed and dropped costs the operator's trust in the field.
17183
+ */
17184
+ actionIcons: boolean().optional(),
17185
+ levels: array(TargetKindLevelSchema),
17186
+ format: array(NotificationFormatSchema),
17187
+ clickUrl: boolean(),
17188
+ sound: boolean(),
17189
+ ttl: boolean(),
17190
+ bodyMaxLen: number().int().positive()
17191
+ });
17192
+ /**
17193
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
17194
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
17195
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
17196
+ * the union is large and not meant for runtime validation here; the exported
17197
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
17198
+ */
17199
+ var ConfigSchemaPassthrough$3 = unknown();
17200
+ var TargetKindSchema = object({
17201
+ kind: string(),
17202
+ label: string(),
17203
+ icon: string(),
17204
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
17205
+ addonId: string(),
17206
+ /**
17207
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
17208
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
17209
+ * when the addon bundles no icon for that kind — the client then falls back
17210
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
17211
+ *
17212
+ * Root-relative on purpose: it resolves against whatever origin serves a web
17213
+ * client, and a native client joins it onto its own hub base.
17214
+ *
17215
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
17216
+ * field that survived only because the runtime cap-router forwards provider
17217
+ * output verbatim — so every consumer had to re-declare it by hand to stop
17218
+ * its own Zod parse from stripping it, and the whole arrangement would have
17219
+ * broken silently the moment output validation was tightened anywhere.
17220
+ */
17221
+ iconUrl: string().optional(),
17222
+ /**
17223
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
17224
+ *
17225
+ * The server knows this and therefore says it, because the client cannot
17226
+ * safely guess: a React-Native client renders SVG and raster through two
17227
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
17228
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
17229
+ * placeholder glyph for every vector icon while the web build looked fine.
17230
+ *
17231
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
17232
+ * not been updated — a client that cannot determine the type should prefer
17233
+ * its raster path, which is the safe default for an unknown image.
17234
+ */
17235
+ iconMediaType: string().optional(),
17236
+ configSchema: ConfigSchemaPassthrough$3,
17237
+ /**
17238
+ * The config keys that decide WHERE this kind's secrets are sent (server,
17239
+ * base URL, instance, chat, recipient). A save that changes any of them
17240
+ * while leaving a secret redacted is refused by the provider (D634), so an
17241
+ * editor uses this to ask for the secret on exactly those edits instead of
17242
+ * on every edit.
17243
+ *
17244
+ * Optional: absent from a provider that holds no secret (the Home Assistant
17245
+ * kinds) and from a provider older than this field — an editor that finds
17246
+ * it absent must assume ANY edit may need the secret.
17247
+ */
17248
+ destinationKeys: array(string()).optional(),
17249
+ supportsDiscovery: boolean(),
17250
+ /**
17251
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
17252
+ * Absent = none; the rule editor then offers nothing.
17253
+ */
17254
+ deliveryParams: array(DeliveryParamSchema).optional(),
17255
+ caps: TargetKindCapsSchema
17256
+ });
17257
+ /**
17258
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
17259
+ * (return a presence marker only) when serving `listTargets` — never
17260
+ * round-trip a stored secret to the UI.
17261
+ */
17262
+ var TargetSchema = object({
17263
+ id: string(),
17264
+ name: string(),
17265
+ kind: string(),
17266
+ addonId: string(),
17267
+ enabled: boolean(),
17268
+ config: record(string(), unknown())
17269
+ });
17270
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
17271
+ var DiscoveredTargetSchema = object({
17272
+ kind: string(),
17273
+ suggestedName: string(),
17274
+ config: record(string(), unknown())
17275
+ });
17276
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
17277
+ var RenderedAsSchema = object({
17278
+ level: string(),
17279
+ format: NotificationFormatSchema,
17280
+ attachmentsSent: number().int().nonnegative(),
17281
+ actionsSent: number().int().nonnegative(),
17282
+ truncated: boolean(),
17283
+ dropped: array(string())
17284
+ });
17285
+ var SendResultSchema = object({
17286
+ success: boolean(),
17287
+ error: string().optional(),
17288
+ renderedAs: RenderedAsSchema.optional()
17289
+ });
17290
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
17291
+ var TestResultSchema = SendResultSchema;
17292
+ /**
17293
+ * Pre-save credential probe against a partial (unsaved) target config.
17294
+ * `resolvedUrl` never includes secrets (token stripped from path).
17295
+ */
17296
+ var ProbeTargetConfigResultSchema = object({
17297
+ ok: boolean(),
17298
+ resolvedUrl: string(),
17299
+ httpStatus: number().int().optional(),
17300
+ stateInstance: string().optional(),
17301
+ error: string().optional()
17302
+ });
17303
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
17304
+ kind: string(),
17305
+ config: record(string(), unknown()).optional(),
17306
+ /**
17307
+ * When editing / duplicating, the blank password field never round-trips
17308
+ * the stored token. Pass the source target id so the provider can restore
17309
+ * secrets server-side before dialling (same merge as upsert).
17310
+ */
17311
+ targetId: string().optional()
17312
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
17313
+ kind: string(),
17314
+ config: record(string(), unknown()),
17315
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
17316
+ targetId: string().optional()
17317
+ }), ProbeTargetConfigResultSchema, {
17318
+ kind: "mutation",
17319
+ auth: "admin"
17320
+ }), method(object({
17321
+ targetId: string(),
17322
+ notification: NotificationSchema
17323
+ }), SendResultSchema, {
17324
+ kind: "mutation",
17325
+ auth: "admin"
17326
+ }), method(object({
17327
+ targetId: string(),
17328
+ sample: NotificationSchema.optional()
17329
+ }), TestResultSchema, {
17330
+ kind: "mutation",
17331
+ auth: "admin"
17332
+ }), method(object({
17333
+ target: TargetSchema,
17334
+ /**
17335
+ * Duplicate flow: create a NEW target id while copying secrets from an
17336
+ * existing row. The UI never holds the stored token; blank / redacted
17337
+ * password fields are restored from this source (D634 still applies if
17338
+ * destinations diverge without a re-typed secret).
17339
+ */
17340
+ cloneSecretsFrom: string().optional()
17341
+ }), TargetSchema, {
17342
+ kind: "mutation",
17343
+ auth: "admin"
17344
+ }), method(object({ targetId: string() }), _void(), {
17345
+ kind: "mutation",
17346
+ auth: "admin"
17347
+ }), method(object({
17348
+ targetId: string(),
17349
+ enabled: boolean()
17350
+ }), _void(), {
17351
+ kind: "mutation",
17352
+ auth: "admin"
17353
+ });
17354
+ function errorText$1(err) {
17355
+ return err instanceof Error ? err.message : String(err);
17356
+ }
17357
+ /** `actions.run` flattens a refusal to `[code] text`; the code leads. */
17358
+ function refusalFromThrown(message) {
17359
+ if (message.startsWith("[busy]")) return "already-running";
17360
+ if (message.startsWith("[not-found]")) return "not-found";
17361
+ return null;
17362
+ }
17363
+ async function runExportedAction(api, log, input) {
17364
+ const { exporter, actionId } = input;
17365
+ const tags = { actionId };
17366
+ const refuse = (reason, detail) => {
17367
+ log.warn(`${exporter}: exported action not run — ${reason}`, {
17368
+ tags,
17369
+ meta: {
17370
+ reason,
17371
+ ...detail ? { detail } : {}
17372
+ }
17373
+ });
17374
+ return {
17375
+ status: "refused",
17376
+ reason
17377
+ };
17378
+ };
17379
+ try {
17380
+ const result = await api.actions.run.mutate({ actionId });
17381
+ if (result.outcome === "skipped-overlap") return refuse("already-running", result.message);
17382
+ if (result.outcome === "skipped-cooldown") return refuse("cooldown", result.message);
17383
+ if (result.outcome === "failed" || result.outcome === "aborted") {
17384
+ const message = result.message ?? result.outcome;
17385
+ log.warn(`${exporter}: exported action failed`, {
17386
+ tags,
17387
+ meta: {
17388
+ outcome: result.outcome,
17389
+ message
17390
+ }
17391
+ });
17392
+ return {
17393
+ status: "failed",
17394
+ message
17395
+ };
17396
+ }
17397
+ log.info(`${exporter}: exported action ran`, {
17398
+ tags,
17399
+ meta: { outcome: result.outcome }
17400
+ });
17401
+ return { status: "started" };
17402
+ } catch (err) {
17403
+ const message = errorText$1(err);
17404
+ const reason = refusalFromThrown(message);
17405
+ if (reason !== null) return refuse(reason, message);
17406
+ log.warn(`${exporter}: exported action failed`, {
17407
+ tags,
17408
+ meta: { message }
17409
+ });
17410
+ return {
17411
+ status: "failed",
17412
+ message
17413
+ };
17414
+ }
17415
+ }
17416
+ /**
17417
+ * Split an exporter's selection into what still exists and what was deleted.
17418
+ * Devices are never judged here (their lifecycle is the tombstone, D865).
17419
+ * Callers pass ids from a query that ANSWERED — an unanswered list must not
17420
+ * reach this function (D49: a failed read changes nothing).
17421
+ */
17422
+ function pruneDeletedEntities(selection, live, log, exporter) {
17423
+ const kept = [];
17424
+ const dropped = [];
17425
+ for (const ref of selection) if (ref.kind === "action" && !live.actionIds.has(ref.actionId)) {
17426
+ dropped.push(ref);
17427
+ log.warn(`${exporter}: exported action was deleted — dropped from the export`, { tags: { actionId: ref.actionId } });
17428
+ } else if (ref.kind === "notifier" && !live.targetIds.has(ref.targetId)) {
17429
+ dropped.push(ref);
17430
+ log.warn(`${exporter}: exported notifier target was deleted — dropped from the export`, { tags: { targetId: ref.targetId } });
17431
+ } else kept.push(ref);
17432
+ return {
17433
+ kept,
17434
+ dropped
17435
+ };
17436
+ }
16335
17437
  /**
16336
17438
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16337
17439
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
@@ -16364,52 +17466,6 @@ var AddonPageInfoSchema = object({
16364
17466
  bundleUrl: string()
16365
17467
  });
16366
17468
  method(_void(), array(AddonPageInfoSchema).readonly());
16367
- /**
16368
- * `addon-pages-source` — collection cap exposing per-provider raw page
16369
- * declarations. Every addon that contributes a UI page registers a
16370
- * provider here. The hub-side singleton aggregator (`addon-pages` cap,
16371
- * see `addon-pages.cap.ts`) walks this collection, stamps versioned
16372
- * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
16373
- * that admin-ui consumes.
16374
- *
16375
- * The split exists because the public listing has a different output
16376
- * shape than the per-provider raw declarations, and we want both ends
16377
- * to flow through codegen instead of relying on a hand-written wrapper.
16378
- */
16379
- var AddonPageDeclarationSchema = object({
16380
- id: string(),
16381
- label: string(),
16382
- icon: string(),
16383
- path: string(),
16384
- /**
16385
- * Module Federation remote name — must match the `name` field on the
16386
- * page addon's `federation()` plugin config. Used by admin-ui's
16387
- * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
16388
- * Conventionally `addon_<id>_page` (snake_case; MF names cannot
16389
- * contain hyphens).
16390
- */
16391
- remoteName: string(),
16392
- /**
16393
- * Bundle filename inside the addon's `dist/` dir served at
16394
- * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
16395
- * is always `'remoteEntry.js'`; the value is kept on the metadata so
16396
- * the static-file route can compute an mtime-based cache-buster URL
16397
- * without a separate filesystem stat.
16398
- */
16399
- bundle: string(),
16400
- /**
16401
- * Sidebar section this page docks into. Well-known ids: `'detection'`,
16402
- * `'cluster'`, `'administration'` — the page renders inside that group.
16403
- * Any OTHER string creates (or joins) a custom section rendered after
16404
- * the built-in groups; its label comes from `sectionLabel` (first
16405
- * declaration wins), falling back to the id. Absent → the legacy
16406
- * "Addon Pages" group.
16407
- */
16408
- section: string().optional(),
16409
- /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
16410
- sectionLabel: string().optional()
16411
- });
16412
- method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
16413
17469
  var AddonHttpRouteSchema = object({
16414
17470
  method: _enum([
16415
17471
  "GET",
@@ -16691,9 +17747,21 @@ var AlertSeveritySchema = _enum([
16691
17747
  "error",
16692
17748
  "critical"
16693
17749
  ]);
17750
+ /**
17751
+ * An action that RUNS something instead of going somewhere: the admin UI calls
17752
+ * the addon's custom action (`addons.custom`) with exactly these fields. The
17753
+ * producer owns the meaning; the UI knows nothing about the addon or the kind.
17754
+ */
17755
+ var AlertActionInvokeSchema = object({
17756
+ addonId: string().min(1),
17757
+ action: string().min(1),
17758
+ input: record(string(), unknown()).optional()
17759
+ });
17760
+ /** An action has `href` (a link) OR `invoke` (a button that runs a custom action). */
16694
17761
  var AlertActionSchema = object({
16695
17762
  label: string(),
16696
17763
  href: string().optional(),
17764
+ invoke: AlertActionInvokeSchema.optional(),
16697
17765
  /**
16698
17766
  * How `href` is followed. Absent / `app`: an admin-ui route (client-side).
16699
17767
  * `server`: a route the HUB serves (an addon HTTP route such as an OAuth
@@ -18911,7 +19979,7 @@ var CompositionEventPlanSchema = object({
18911
19979
  stateField: string(),
18912
19980
  fieldKey: string()
18913
19981
  });
18914
- /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.celsius`. */
19982
+ /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.temperature`. */
18915
19983
  var CompositionProblemSchema = object({
18916
19984
  code: _enum([
18917
19985
  "reserved-variant",
@@ -18940,7 +20008,11 @@ var CompositionProblemSchema = object({
18940
20008
  "mixed-quantity",
18941
20009
  "helper-mismatch",
18942
20010
  "member-constraint",
18943
- "retention"
20011
+ "retention",
20012
+ "command-method-unknown",
20013
+ "command-source-unknown",
20014
+ "command-input-unknown",
20015
+ "command-input-missing"
18944
20016
  ]),
18945
20017
  path: string(),
18946
20018
  message: string()
@@ -18979,7 +20051,9 @@ var CompositionFieldRoleSchema = _enum([
18979
20051
  var CompositionFieldItemSchema = object({
18980
20052
  arrayPath: string(),
18981
20053
  key: string(),
18982
- label: string()
20054
+ label: string(),
20055
+ /** True when the item carries a `reset` forward: the composer writes `resettable` from this (D967). */
20056
+ resettable: boolean().optional()
18983
20057
  });
18984
20058
  var CompositionFieldPlanSchema = object({
18985
20059
  cap: string(),
@@ -19184,7 +20258,7 @@ Object.freeze({
19184
20258
  * One catalog row per base reading a group helper can build (D944 §3).
19185
20259
  * Data, not a form default written into the block.
19186
20260
  */
19187
- var NOW$2 = {
20261
+ var NOW$3 = {
19188
20262
  fieldPath: "lastFetchedAt",
19189
20263
  expr: "now"
19190
20264
  };
@@ -19193,12 +20267,13 @@ var CHANGED = {
19193
20267
  expr: "now"
19194
20268
  };
19195
20269
  function numeric(input) {
20270
+ const { alsoFrom, ...base } = input;
19196
20271
  return {
19197
- ...input,
20272
+ ...base,
19198
20273
  family: "numeric",
19199
20274
  deviceType: DeviceType.Sensor,
19200
20275
  memberDeviceType: DeviceType.Sensor,
19201
- memberDeviceTypes: [DeviceType.Sensor],
20276
+ memberDeviceTypes: [DeviceType.Sensor, ...alsoFrom?.deviceTypes ?? []],
19202
20277
  activeWhen: void 0,
19203
20278
  commandCaps: [],
19204
20279
  baseUnit: baseUnitOf(input.quantity),
@@ -19206,9 +20281,10 @@ function numeric(input) {
19206
20281
  accept: [{
19207
20282
  cap: input.outputCap,
19208
20283
  fieldPath: input.outputField
19209
- }]
20284
+ }, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
19210
20285
  };
19211
20286
  }
20287
+ var CLIMATE_DEVICES = [DeviceType.Thermostat, DeviceType.Climate];
19212
20288
  function binary(input) {
19213
20289
  return {
19214
20290
  ...input,
@@ -19230,73 +20306,87 @@ var GROUP_TEMPLATES = [
19230
20306
  summary: "Mean, median, min, max or sum of temperatures. Offline and unknown members are left out, never read as 0 °C.",
19231
20307
  role: DeviceRole.TemperatureSensor,
19232
20308
  outputCap: "temperature-sensor",
19233
- outputField: "celsius",
20309
+ outputField: "temperature",
19234
20310
  quantity: "temperature",
19235
20311
  defaultAggregate: "mean",
19236
20312
  empty: "null",
19237
- companions: [NOW$2]
20313
+ companions: [NOW$3],
20314
+ alsoFrom: {
20315
+ deviceTypes: CLIMATE_DEVICES,
20316
+ accept: {
20317
+ cap: "climate-control",
20318
+ fieldPath: "currentTemp"
20319
+ }
20320
+ }
19238
20321
  }),
19239
20322
  numeric({
19240
20323
  id: "humidity",
19241
20324
  summary: "Humidity in percent. Offline and unknown members are left out, never read as 0 %.",
19242
20325
  role: DeviceRole.HumiditySensor,
19243
20326
  outputCap: "humidity-sensor",
19244
- outputField: "percent",
20327
+ outputField: "humidity",
19245
20328
  quantity: "humidity",
19246
20329
  defaultAggregate: "mean",
19247
20330
  empty: "null",
19248
- companions: [NOW$2]
20331
+ companions: [NOW$3],
20332
+ alsoFrom: {
20333
+ deviceTypes: CLIMATE_DEVICES,
20334
+ accept: {
20335
+ cap: "climate-control",
20336
+ fieldPath: "currentHumidity"
20337
+ }
20338
+ }
19249
20339
  }),
19250
20340
  numeric({
19251
20341
  id: "pressure",
19252
20342
  summary: "Pressure in hectopascals. Offline and unknown members are left out, never read as 0 hPa.",
19253
20343
  role: DeviceRole.PressureSensor,
19254
20344
  outputCap: "pressure-sensor",
19255
- outputField: "hpa",
20345
+ outputField: "pressure",
19256
20346
  quantity: "pressure",
19257
20347
  defaultAggregate: "mean",
19258
20348
  empty: "null",
19259
- companions: [NOW$2]
20349
+ companions: [NOW$3]
19260
20350
  }),
19261
20351
  numeric({
19262
20352
  id: "illuminance",
19263
20353
  summary: "Illuminance in lux. Offline and unknown members are left out, never read as 0 lx.",
19264
20354
  role: DeviceRole.AmbientLightSensor,
19265
20355
  outputCap: "ambient-light-sensor",
19266
- outputField: "lux",
20356
+ outputField: "illuminance",
19267
20357
  quantity: "illuminance",
19268
20358
  defaultAggregate: "mean",
19269
20359
  empty: "null",
19270
- companions: [NOW$2]
20360
+ companions: [NOW$3]
19271
20361
  }),
19272
20362
  numeric({
19273
20363
  id: "power",
19274
20364
  summary: "Power in watts, summed by default. Nobody reporting omits the key rather than writing 0 W.",
19275
20365
  role: DeviceRole.PowerSensor,
19276
20366
  outputCap: "power-meter",
19277
- outputField: "watts",
20367
+ outputField: "power",
19278
20368
  quantity: "power",
19279
20369
  defaultAggregate: "sum",
19280
20370
  empty: "omit",
19281
- companions: [NOW$2]
20371
+ companions: [NOW$3]
19282
20372
  }),
19283
20373
  numeric({
19284
20374
  id: "energy",
19285
20375
  summary: "Energy in kilowatt-hours, summed by default. Nobody reporting omits the key rather than writing 0 kWh.",
19286
20376
  role: DeviceRole.EnergySensor,
19287
20377
  outputCap: "power-meter",
19288
- outputField: "kwhTotal",
20378
+ outputField: "energy",
19289
20379
  quantity: "energy",
19290
20380
  defaultAggregate: "sum",
19291
20381
  empty: "omit",
19292
- companions: [NOW$2]
20382
+ companions: [NOW$3]
19293
20383
  }),
19294
20384
  numeric({
19295
20385
  id: "battery",
19296
20386
  summary: "Battery charge in percent. Offline and unknown members are left out, never read as 0 %.",
19297
20387
  role: DeviceRole.BatterySensor,
19298
20388
  outputCap: "battery",
19299
- outputField: "percentage",
20389
+ outputField: "level",
19300
20390
  quantity: "percentage",
19301
20391
  defaultAggregate: "mean",
19302
20392
  empty: "null",
@@ -19324,7 +20414,7 @@ var GROUP_TEMPLATES = [
19324
20414
  quantity: "device",
19325
20415
  defaultAggregate: "mean",
19326
20416
  empty: "null",
19327
- companions: [NOW$2]
20417
+ companions: [NOW$3]
19328
20418
  }),
19329
20419
  binary({
19330
20420
  id: "motion",
@@ -19874,7 +20964,18 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
19874
20964
  kind: "mutation",
19875
20965
  auth: "admin",
19876
20966
  access: "view"
19877
- });
20967
+ }), method(object({
20968
+ blockId: string().min(1),
20969
+ trace: AutomationRunTraceSchema.optional(),
20970
+ runStartedAt: number().optional(),
20971
+ keepTraces: number().int().min(1).max(100).optional()
20972
+ }), _void(), {
20973
+ kind: "mutation",
20974
+ auth: "admin"
20975
+ }), method(object({ blockId: string().min(1) }), AutomationStateDocSchema, { auth: "admin" }), method(object({ blockId: string().min(1) }), object({
20976
+ traces: array(AutomationRunTraceSchema),
20977
+ lastError: string().nullable()
20978
+ }), { auth: "admin" });
19878
20979
  /**
19879
20980
  * `custom-model-registry` — collection cap exposing operator-registered
19880
20981
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -21715,6 +22816,36 @@ var ExposeInputSchema = object({
21715
22816
  capabilities: array(string()).optional()
21716
22817
  });
21717
22818
  var UnexposeInputSchema = object({ deviceId: string() });
22819
+ /**
22820
+ * What an exporter may expose besides devices (D968). An action and a
22821
+ * notification target are LIST ENTRIES, never devices (D954): they enter an
22822
+ * exporter's own selection, not the device registry.
22823
+ */
22824
+ var ExportEntityKindSchema = _enum([
22825
+ "device",
22826
+ "action",
22827
+ "notifier"
22828
+ ]);
22829
+ var ExportEntityRefSchema = discriminatedUnion("kind", [
22830
+ object({
22831
+ kind: literal("device"),
22832
+ deviceId: string()
22833
+ }),
22834
+ object({
22835
+ kind: literal("action"),
22836
+ actionId: string().min(1)
22837
+ }),
22838
+ object({
22839
+ kind: literal("notifier"),
22840
+ targetId: string().min(1)
22841
+ })
22842
+ ]);
22843
+ var ExposedEntitySchema = object({
22844
+ entity: ExportEntityRefSchema,
22845
+ exposedAs: string().optional()
22846
+ });
22847
+ var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
22848
+ var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
21718
22849
  var deviceExportCapability = {
21719
22850
  name: "device-export",
21720
22851
  scope: "system",
@@ -21744,6 +22875,16 @@ var deviceExportCapability = {
21744
22875
  unexposeDevice: method(UnexposeInputSchema, _void(), {
21745
22876
  kind: "mutation",
21746
22877
  auth: "admin"
22878
+ }),
22879
+ listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
22880
+ listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
22881
+ exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
22882
+ kind: "mutation",
22883
+ auth: "admin"
22884
+ }),
22885
+ unexposeEntity: optionalMethod(UnexposeEntityInputSchema, _void(), {
22886
+ kind: "mutation",
22887
+ auth: "admin"
21747
22888
  })
21748
22889
  }
21749
22890
  };
@@ -42886,6 +44027,14 @@ method(object({
42886
44027
  kind: "mutation",
42887
44028
  auth: "admin"
42888
44029
  });
44030
+ method(object({
44031
+ nodeId: string().min(1),
44032
+ /** Epoch ms the node was forgotten (the tombstone's `removedAt`). */
44033
+ removedAt: number()
44034
+ }), object({ counts: record(string(), number().int().nonnegative()) }), {
44035
+ kind: "mutation",
44036
+ auth: "admin"
44037
+ });
42889
44038
  /**
42890
44039
  * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
42891
44040
  * so it can delete what it keeps for that device (D865).
@@ -43533,6 +44682,17 @@ var LlmProfileSchema = object({
43533
44682
  * field in its editor only when its descriptor lists it in `profileFields`. */
43534
44683
  topK: number().int().positive().optional(),
43535
44684
  maxTokens: number().int().positive().optional(),
44685
+ /** How hard the model "thinks" before it answers. Omitted = the model's own
44686
+ * default. `off` matters for structured output: a thinking model can spend
44687
+ * the whole completion on reasoning and return an empty `content`. Carried
44688
+ * only by the wires that have it — a kind offers the field in its editor
44689
+ * only when its descriptor lists it in `profileFields`. */
44690
+ reasoningEffort: _enum([
44691
+ "off",
44692
+ "low",
44693
+ "medium",
44694
+ "high"
44695
+ ]).optional(),
43536
44696
  /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
43537
44697
  contextLength: number().int().positive().optional(),
43538
44698
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
@@ -43571,6 +44731,7 @@ var LlmProfileFieldSchema = _enum([
43571
44731
  "topP",
43572
44732
  "topK",
43573
44733
  "maxTokens",
44734
+ "reasoningEffort",
43574
44735
  "contextLength",
43575
44736
  "systemPrompt",
43576
44737
  "timeoutMs",
@@ -43594,7 +44755,7 @@ var LlmProviderWidgetSchema = object({
43594
44755
  /** ConfigUISchema tree passed through untyped on the wire (the
43595
44756
  * notification-output `ConfigSchemaPassthrough` precedent at
43596
44757
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
43597
- var ConfigSchemaPassthrough$3 = unknown();
44758
+ var ConfigSchemaPassthrough$2 = unknown();
43598
44759
  var LlmProfileKindDescriptorSchema = object({
43599
44760
  kind: LlmProfileKindSchema,
43600
44761
  label: string(),
@@ -43603,9 +44764,9 @@ var LlmProfileKindDescriptorSchema = object({
43603
44764
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
43604
44765
  addonId: string(),
43605
44766
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
43606
- connectionSchema: ConfigSchemaPassthrough$3,
44767
+ connectionSchema: ConfigSchemaPassthrough$2,
43607
44768
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
43608
- advancedSchema: ConfigSchemaPassthrough$3.optional(),
44769
+ advancedSchema: ConfigSchemaPassthrough$2.optional(),
43609
44770
  /** The kind's defaults; a model from `listModels` may override any of them. */
43610
44771
  features: LlmModelFeaturesSchema,
43611
44772
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -44131,10 +45292,10 @@ var CpuBreakdownSchema = object({
44131
45292
  cores: number()
44132
45293
  });
44133
45294
  var MemoryInfoSchema = object({
44134
- percent: number(),
45295
+ percent: number().nullable(),
44135
45296
  totalBytes: number(),
44136
- usedBytes: number(),
44137
- availableBytes: number(),
45297
+ usedBytes: number().nullable(),
45298
+ availableBytes: number().nullable(),
44138
45299
  swapUsedBytes: number(),
44139
45300
  swapTotalBytes: number()
44140
45301
  });
@@ -44438,8 +45599,9 @@ var GetLoadSeriesInputSchema = object({
44438
45599
  });
44439
45600
  var SystemMetricsSchema = object({
44440
45601
  cpuPercent: number(),
44441
- memoryPercent: number(),
44442
- memoryUsedMB: number(),
45602
+ /** `null` when the memory sample failed or was not taken yet (D393). */
45603
+ memoryPercent: number().nullable(),
45604
+ memoryUsedMB: number().nullable(),
44443
45605
  memoryTotalMB: number(),
44444
45606
  diskPercent: number().optional(),
44445
45607
  temperature: number().optional(),
@@ -44675,424 +45837,6 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
44675
45837
  sourcePort: number().optional()
44676
45838
  });
44677
45839
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
44678
- /**
44679
- * notification-output — canonical, capability-gated notification delivery.
44680
- *
44681
- * Apprise-derived model (see
44682
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44683
- * callers emit ONE canonical `Notification`; each provider declares a
44684
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44685
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44686
- * message to what the kind supports — callers never special-case a service.
44687
- *
44688
- * DESIGN DECISIONS (locked):
44689
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44690
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44691
- * cap. Rationale: the admin UI needs one uniform surface across the
44692
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44693
- * alternative would fork the UI per addon and cannot host the
44694
- * discovery→adopt flow.
44695
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44696
- * the generated cap-mount auto-`concatCollection`-fans them across every
44697
- * registered provider (notifiers addon + HA addon) so one catalog is
44698
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44699
- * `addonId` the generated collection router extracts from the call input.
44700
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44701
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44702
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44703
- * base64 fallback needed.
44704
- *
44705
- * TODO (deferred, closed-set change — separate decision): add
44706
- * `providerKind: 'notify'` so notification providers surface on the unified
44707
- * admin "Integrations" page.
44708
- */
44709
- /**
44710
- * Zentik-derived typed-media enum — the superset across every kind. Each
44711
- * adapter picks what it supports and the degrade engine filters the rest.
44712
- */
44713
- var AttachmentMediaTypeSchema = _enum([
44714
- "image",
44715
- "video",
44716
- "gif",
44717
- "audio",
44718
- "icon"
44719
- ]);
44720
- /**
44721
- * A single attachment. Exactly one of `url` (remote source, most adapters
44722
- * prefer this) or `bytes` (inline source; required for Pushover-style
44723
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44724
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44725
- */
44726
- var AttachmentSchema = object({
44727
- mediaType: AttachmentMediaTypeSchema,
44728
- url: string().optional(),
44729
- bytes: _instanceof(Uint8Array).optional(),
44730
- mime: string().optional(),
44731
- name: string().optional()
44732
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44733
- var NotificationFormatSchema = _enum([
44734
- "text",
44735
- "markdown",
44736
- "html"
44737
- ]);
44738
- /**
44739
- * The CLOSED icon vocabulary an action button may use.
44740
- *
44741
- * A closed set, not a free string, and that is the whole point: an arbitrary
44742
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44743
- * notices — the same class of gap as a zone vocabulary nothing produced
44744
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44745
- * declares `actionIcons: false` and the degrade engine strips the field.
44746
- *
44747
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44748
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44749
- * differently.
44750
- *
44751
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44752
- *
44753
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44754
- * the whole set onto its own renderer's vocabulary through a
44755
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44756
- * fallback, so adding a member here fails every adapter's build until someone
44757
- * decides its glyph, which is the only place that decision can be made
44758
- * honestly.
44759
- *
44760
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44761
- * `disarm` straight through; iOS feeds that string to
44762
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44763
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44764
- * mapping, and "the field is documented" is not "the value renders".
44765
- *
44766
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44767
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44768
- * so an addon that emits a token the running hub does not know does not lose an
44769
- * icon — its whole `send` fails Zod validation and the notification never
44770
- * arrives. Never emit a new token from an addon before the train carrying it.
44771
- */
44772
- var NotificationActionIconSchema = _enum([
44773
- "acknowledge",
44774
- "dismiss",
44775
- "silence",
44776
- "snooze",
44777
- "view",
44778
- "play",
44779
- "open",
44780
- "close",
44781
- "lock",
44782
- "unlock",
44783
- "arm",
44784
- "arm-home",
44785
- "arm-away",
44786
- "arm-night",
44787
- "disarm",
44788
- "light",
44789
- "alert",
44790
- "camera"
44791
- ]);
44792
- /** A single tap-through action button. */
44793
- var NotificationActionSchema = object({
44794
- id: string(),
44795
- label: string(),
44796
- url: string().optional(),
44797
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44798
- icon: NotificationActionIconSchema.optional(),
44799
- /**
44800
- * Renders in a warning style where the notifier supports it.
44801
- *
44802
- * A HINT, never a gate. The callback's authority is its token and nothing
44803
- * else — see `notification-center/action-token.ts` for what that does and
44804
- * does not buy.
44805
- */
44806
- destructive: boolean().optional(),
44807
- /**
44808
- * How the tap should REACH the url.
44809
- *
44810
- * `navigate` (absent, and every button authored before this field) opens it:
44811
- * the phone leaves the notification and shows whatever the callback returns.
44812
- * That is right for a button whose answer the operator wants to read.
44813
- *
44814
- * `background` fires it as a POST and stays put. It exists for the buttons
44815
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44816
- * an answer to the notification, and being thrown into a browser tab to
44817
- * confirm it costs more attention than the notification did. A backend that
44818
- * cannot do a background call renders it as an ordinary link (the adapters
44819
- * fall back rather than dropping the button), so this is a preference, never
44820
- * a requirement.
44821
- */
44822
- mode: _enum(["navigate", "background"]).optional()
44823
- });
44824
- /**
44825
- * The canonical notification. `body` is the only hard field (Apprise model).
44826
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44827
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44828
- * the adapter maps this ordinal onto its native level. `level?` is an
44829
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44830
- * `priority` for that one target.
44831
- */
44832
- var NotificationSchema = object({
44833
- body: string(),
44834
- title: string().optional(),
44835
- format: NotificationFormatSchema.default("text"),
44836
- priority: number().int().min(1).max(5).default(3),
44837
- level: string().optional(),
44838
- attachments: array(AttachmentSchema).optional(),
44839
- clickUrl: string().optional(),
44840
- actions: array(NotificationActionSchema).optional(),
44841
- sound: string().optional(),
44842
- ttl: number().optional(),
44843
- tag: string().optional(),
44844
- deviceId: number().optional(),
44845
- eventId: string().optional(),
44846
- metadata: record(string(), unknown()).optional()
44847
- });
44848
- /** One declared native severity/priority level for a kind. */
44849
- var TargetKindLevelSchema = object({
44850
- id: string(),
44851
- label: string(),
44852
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44853
- ordinal: number().int().min(1).max(5).nullable(),
44854
- flags: object({
44855
- critical: boolean().optional(),
44856
- silent: boolean().optional(),
44857
- noPush: boolean().optional()
44858
- }).optional(),
44859
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44860
- requires: array(string()).optional(),
44861
- description: string().optional()
44862
- });
44863
- /** The full capability block consulted before dispatch. */
44864
- var TargetKindCapsSchema = object({
44865
- attachments: object({
44866
- mediaTypes: array(AttachmentMediaTypeSchema),
44867
- mode: _enum([
44868
- "url",
44869
- "bytes",
44870
- "both"
44871
- ]),
44872
- max: number().int().nonnegative(),
44873
- maxBytes: number().int().positive().optional()
44874
- }),
44875
- /** Max action buttons (0 = none). */
44876
- actions: number().int().nonnegative(),
44877
- /**
44878
- * Whether this kind renders a per-action ICON.
44879
- *
44880
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44881
- * run on the addon cap path — three production failures in one day taught
44882
- * this repo that once. Absent is read as false by the degrade engine, which
44883
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44884
- * assumed and dropped costs the operator's trust in the field.
44885
- */
44886
- actionIcons: boolean().optional(),
44887
- levels: array(TargetKindLevelSchema),
44888
- format: array(NotificationFormatSchema),
44889
- clickUrl: boolean(),
44890
- sound: boolean(),
44891
- ttl: boolean(),
44892
- bodyMaxLen: number().int().positive()
44893
- });
44894
- /**
44895
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44896
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44897
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44898
- * the union is large and not meant for runtime validation here; the exported
44899
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44900
- */
44901
- var ConfigSchemaPassthrough$2 = unknown();
44902
- var TargetKindSchema = object({
44903
- kind: string(),
44904
- label: string(),
44905
- icon: string(),
44906
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44907
- addonId: string(),
44908
- /**
44909
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44910
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44911
- * when the addon bundles no icon for that kind — the client then falls back
44912
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44913
- *
44914
- * Root-relative on purpose: it resolves against whatever origin serves a web
44915
- * client, and a native client joins it onto its own hub base.
44916
- *
44917
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44918
- * field that survived only because the runtime cap-router forwards provider
44919
- * output verbatim — so every consumer had to re-declare it by hand to stop
44920
- * its own Zod parse from stripping it, and the whole arrangement would have
44921
- * broken silently the moment output validation was tightened anywhere.
44922
- */
44923
- iconUrl: string().optional(),
44924
- /**
44925
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44926
- *
44927
- * The server knows this and therefore says it, because the client cannot
44928
- * safely guess: a React-Native client renders SVG and raster through two
44929
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44930
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44931
- * placeholder glyph for every vector icon while the web build looked fine.
44932
- *
44933
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44934
- * not been updated — a client that cannot determine the type should prefer
44935
- * its raster path, which is the safe default for an unknown image.
44936
- */
44937
- iconMediaType: string().optional(),
44938
- configSchema: ConfigSchemaPassthrough$2,
44939
- /**
44940
- * The config keys that decide WHERE this kind's secrets are sent (server,
44941
- * base URL, instance, chat, recipient). A save that changes any of them
44942
- * while leaving a secret redacted is refused by the provider (D634), so an
44943
- * editor uses this to ask for the secret on exactly those edits instead of
44944
- * on every edit.
44945
- *
44946
- * Optional: absent from a provider that holds no secret (the Home Assistant
44947
- * kinds) and from a provider older than this field — an editor that finds
44948
- * it absent must assume ANY edit may need the secret.
44949
- */
44950
- destinationKeys: array(string()).optional(),
44951
- supportsDiscovery: boolean(),
44952
- caps: TargetKindCapsSchema
44953
- });
44954
- /**
44955
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44956
- * (return a presence marker only) when serving `listTargets` — never
44957
- * round-trip a stored secret to the UI.
44958
- */
44959
- var TargetSchema = object({
44960
- id: string(),
44961
- name: string(),
44962
- kind: string(),
44963
- addonId: string(),
44964
- enabled: boolean(),
44965
- config: record(string(), unknown())
44966
- });
44967
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44968
- var DiscoveredTargetSchema = object({
44969
- kind: string(),
44970
- suggestedName: string(),
44971
- config: record(string(), unknown())
44972
- });
44973
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44974
- var RenderedAsSchema = object({
44975
- level: string(),
44976
- format: NotificationFormatSchema,
44977
- attachmentsSent: number().int().nonnegative(),
44978
- actionsSent: number().int().nonnegative(),
44979
- truncated: boolean(),
44980
- dropped: array(string())
44981
- });
44982
- var SendResultSchema = object({
44983
- success: boolean(),
44984
- error: string().optional(),
44985
- renderedAs: RenderedAsSchema.optional()
44986
- });
44987
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44988
- var TestResultSchema = SendResultSchema;
44989
- /**
44990
- * Pre-save credential probe against a partial (unsaved) target config.
44991
- * `resolvedUrl` never includes secrets (token stripped from path).
44992
- */
44993
- var ProbeTargetConfigResultSchema = object({
44994
- ok: boolean(),
44995
- resolvedUrl: string(),
44996
- httpStatus: number().int().optional(),
44997
- stateInstance: string().optional(),
44998
- error: string().optional()
44999
- });
45000
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
45001
- kind: string(),
45002
- config: record(string(), unknown()).optional(),
45003
- /**
45004
- * When editing / duplicating, the blank password field never round-trips
45005
- * the stored token. Pass the source target id so the provider can restore
45006
- * secrets server-side before dialling (same merge as upsert).
45007
- */
45008
- targetId: string().optional()
45009
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
45010
- kind: string(),
45011
- config: record(string(), unknown()),
45012
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
45013
- targetId: string().optional()
45014
- }), ProbeTargetConfigResultSchema, {
45015
- kind: "mutation",
45016
- auth: "admin"
45017
- }), method(object({
45018
- targetId: string(),
45019
- notification: NotificationSchema
45020
- }), SendResultSchema, {
45021
- kind: "mutation",
45022
- auth: "admin"
45023
- }), method(object({
45024
- targetId: string(),
45025
- sample: NotificationSchema.optional()
45026
- }), TestResultSchema, {
45027
- kind: "mutation",
45028
- auth: "admin"
45029
- }), method(object({
45030
- target: TargetSchema,
45031
- /**
45032
- * Duplicate flow: create a NEW target id while copying secrets from an
45033
- * existing row. The UI never holds the stored token; blank / redacted
45034
- * password fields are restored from this source (D634 still applies if
45035
- * destinations diverge without a re-typed secret).
45036
- */
45037
- cloneSecretsFrom: string().optional()
45038
- }), TargetSchema, {
45039
- kind: "mutation",
45040
- auth: "admin"
45041
- }), method(object({ targetId: string() }), _void(), {
45042
- kind: "mutation",
45043
- auth: "admin"
45044
- }), method(object({
45045
- targetId: string(),
45046
- enabled: boolean()
45047
- }), _void(), {
45048
- kind: "mutation",
45049
- auth: "admin"
45050
- });
45051
- new Set([
45052
- {
45053
- id: "person",
45054
- name: "Person"
45055
- },
45056
- {
45057
- id: "vehicle",
45058
- name: "Vehicle"
45059
- },
45060
- {
45061
- id: "animal",
45062
- name: "Animal"
45063
- },
45064
- {
45065
- id: "package",
45066
- name: "Package"
45067
- }
45068
- ].map((l) => l.id));
45069
- var COCO_TO_MACRO = {
45070
- mapping: {
45071
- person: "person",
45072
- bicycle: "vehicle",
45073
- car: "vehicle",
45074
- motorcycle: "vehicle",
45075
- airplane: "vehicle",
45076
- bus: "vehicle",
45077
- train: "vehicle",
45078
- truck: "vehicle",
45079
- boat: "vehicle",
45080
- bird: "animal",
45081
- cat: "animal",
45082
- dog: "animal",
45083
- horse: "animal",
45084
- sheep: "animal",
45085
- cow: "animal",
45086
- elephant: "animal",
45087
- bear: "animal",
45088
- zebra: "animal",
45089
- giraffe: "animal",
45090
- suitcase: "package",
45091
- backpack: "package",
45092
- handbag: "package"
45093
- },
45094
- preserveOriginal: false
45095
- };
45096
45840
  var AUDIO_MACRO_LABELS = [
45097
45841
  {
45098
45842
  id: "speech",
@@ -51493,14 +52237,6 @@ var EngineProvisioningSchema = object({
51493
52237
  */
51494
52238
  configIssues: array(string()).optional()
51495
52239
  });
51496
- var PipelineStepInputSchema = lazy(() => object({
51497
- addonId: string(),
51498
- modelId: string().optional(),
51499
- enabled: boolean().default(true),
51500
- children: array(PipelineStepInputSchema).optional(),
51501
- settings: record(string(), unknown()).optional(),
51502
- jumpDeviceKey: string().optional()
51503
- }));
51504
52240
  var ModelSubstitutionSchema = object({
51505
52241
  addonId: string(),
51506
52242
  chosen: string(),
@@ -51579,7 +52315,6 @@ var ConfigUISchemaBridge = custom();
51579
52315
  var ConfigUISchemaNullableBridge = custom();
51580
52316
  var InferenceCapabilitiesBridge = custom();
51581
52317
  var ModelAvailabilityListBridge = custom();
51582
- var PipelineRunResultBridge = custom();
51583
52318
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
51584
52319
  modelId: string(),
51585
52320
  settings: record(string(), unknown()).readonly()
@@ -57357,7 +58092,9 @@ var ManifestShapeSchema = object({
57357
58092
  icon: string().optional()
57358
58093
  }).optional(),
57359
58094
  protected: boolean().optional(),
57360
- removable: boolean().optional()
58095
+ removable: boolean().optional(),
58096
+ /** Declared Integrations-page block (mirror of `AddonDeclaration.integrationSection`). */
58097
+ integrationSection: _enum(["system", "providers"]).optional()
57361
58098
  });
57362
58099
  var AddonProcessSchema = object({
57363
58100
  pid: number().optional(),
@@ -57722,9 +58459,9 @@ method(object({ nodeId: string().optional() }).optional(), array(AddonListItemSc
57722
58459
  }), LogStreamEntrySchema, { kind: "subscription" });
57723
58460
  object({
57724
58461
  /** Carbon dioxide concentration in ppm. */
57725
- co2Ppm: number().min(0).optional().meta(readingMeta("concentration-volume")),
58462
+ co2: number().min(0).optional().meta(readingMeta("concentration-volume")),
57726
58463
  /** Total volatile organic compounds in ppb. */
57727
- vocPpb: number().min(0).optional().meta(readingMeta("concentration-ppb")),
58464
+ voc: number().min(0).optional().meta(readingMeta("concentration-ppb")),
57728
58465
  /** Particulate matter ≤ 2.5 μm in µg/m³. */
57729
58466
  pm25: number().min(0).optional().meta(readingMeta("concentration-mass")),
57730
58467
  /** Particulate matter ≤ 10 μm in µg/m³. */
@@ -57741,7 +58478,7 @@ DeviceType.Sensor;
57741
58478
  */
57742
58479
  var AmbientLightSensorStatusSchema = object({
57743
58480
  /** Current illuminance in lux (lx). `null` when the sample was refused (D393). */
57744
- lux: number().min(0).nullable().meta(readingMeta("illuminance", {
58481
+ illuminance: number().min(0).nullable().meta(readingMeta("illuminance", {
57745
58482
  precision: 0,
57746
58483
  label: "Illuminance"
57747
58484
  })),
@@ -57838,6 +58575,84 @@ DeviceType.Camera, method(object({ deviceId: number() }), AudioMetricsSnapshotSc
57838
58575
  * would produce more than `maxPoints` samples. */
57839
58576
  sampleEveryMs: number().int().positive().optional()
57840
58577
  }), AudioMetricsHistorySchema);
58578
+ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
58579
+ actionId: string().min(1),
58580
+ variables: record(string(), ActionVariableValueSchema).optional()
58581
+ }), _void(), {
58582
+ kind: "mutation",
58583
+ auth: "admin"
58584
+ }), method(object({ actionId: string().min(1) }), _void(), {
58585
+ kind: "mutation",
58586
+ auth: "admin"
58587
+ });
58588
+ /**
58589
+ * actions — the ONE surface for runnable actions, for the UI and for
58590
+ * automations. Provided by the core-blocks builtin on the hub.
58591
+ *
58592
+ * An action is a LIST ENTRY, not a device (D883): either internal (cap and wait
58593
+ * steps, kept in the hub's `actions` record kind) or declared by an addon over
58594
+ * `action-source`. `list` asks every `action-source` provider LIVE and overlays
58595
+ * the run status from the hub's `runs` ledger; there is no catalog here to
58596
+ * drift (D3).
58597
+ *
58598
+ * **Permissions follow the camera, as linked devices do.** An action is linked
58599
+ * to cameras by the operator (`setLinks`, D356: nothing links itself). A
58600
+ * non-admin may `get` / `run` an action only through a camera they may see that
58601
+ * links it: they name the camera (`deviceId`, a top-level field so the scope
58602
+ * gate sees it) and the provider refuses an action that camera does not link.
58603
+ * An admin, and an in-process caller (an automation block), may run any action.
58604
+ * Every refusal is typed (`[not-linked] …`) and logged.
58605
+ *
58606
+ * A second `run` of an action that is already running is REFUSED — traced and
58607
+ * logged — never queued.
58608
+ */
58609
+ var ActionIdInput = object({ actionId: string().min(1) });
58610
+ var ActionLinksSchema = object({
58611
+ deviceId: number().int().nonnegative(),
58612
+ actionIds: array(string().min(1)).max(100)
58613
+ });
58614
+ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
58615
+ actionId: string().min(1),
58616
+ deviceId: number().int().nonnegative().optional()
58617
+ }), object({ action: ActionEntrySchema.nullable() }), {
58618
+ role: "viewer",
58619
+ auth: "protected",
58620
+ kind: "query",
58621
+ caller: "required"
58622
+ }), method(object({
58623
+ actionId: string().min(1),
58624
+ variables: record(string(), ActionVariableValueSchema).optional(),
58625
+ wait: boolean().optional(),
58626
+ origin: ActionRunOriginSchema.optional(),
58627
+ deviceId: number().int().nonnegative().optional()
58628
+ }), ActionRunResultSchema, {
58629
+ role: "viewer",
58630
+ auth: "protected",
58631
+ kind: "mutation",
58632
+ caller: "required"
58633
+ }), method(ActionIdInput, _void(), {
58634
+ kind: "mutation",
58635
+ auth: "admin"
58636
+ }), method(ActionIdInput, object({ traces: array(AutomationRunTraceSchema) }), { auth: "admin" }), method(object({ action: ActionInputSchema }), object({ action: ActionEntrySchema }), {
58637
+ kind: "mutation",
58638
+ auth: "admin"
58639
+ }), method(object({
58640
+ actionId: string().min(1),
58641
+ action: ActionInputSchema.partial()
58642
+ }), object({ action: ActionEntrySchema }), {
58643
+ kind: "mutation",
58644
+ auth: "admin"
58645
+ }), method(ActionIdInput, _void(), {
58646
+ kind: "mutation",
58647
+ auth: "admin"
58648
+ }), method(object({ deviceId: number().int().nonnegative() }), array(ActionEntrySchema), {
58649
+ role: "viewer",
58650
+ auth: "protected",
58651
+ kind: "query"
58652
+ }), method(object({ deviceId: number().int().nonnegative() }), ActionLinksSchema, { auth: "admin" }), method(ActionLinksSchema, ActionLinksSchema, {
58653
+ kind: "mutation",
58654
+ auth: "admin"
58655
+ });
57841
58656
  object({
57842
58657
  /** Whether the automation is currently enabled. Disabled automations
57843
58658
  * ignore their trigger block — manual `trigger` still works. */
@@ -57891,7 +58706,7 @@ var BatteryStatusSchema = object({
57891
58706
  * Consumers must SKIP a null rather than coerce it — `battery-band` already
57892
58707
  * declines to band a non-finite reading, which is the correct shape.
57893
58708
  */
57894
- percentage: number().min(0).max(100).nullable().meta(readingMeta("percentage", { label: "Charge" })),
58709
+ level: number().min(0).max(100).nullable().meta(readingMeta("percentage", { label: "Charge" })),
57895
58710
  /**
57896
58711
  * Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
57897
58712
  * Reolink-specific for the Solar Panel 2 accessory (will become
@@ -57901,7 +58716,7 @@ var BatteryStatusSchema = object({
57901
58716
  * `'unknown'` is the absence of an answer: the provider has not read the
57902
58717
  * power fields yet, or the firmware reported neither. Before it existed,
57903
58718
  * two unreadable fields produced `'none'`, and a camera nobody had reached
57904
- * was drawn "on battery alone" — the same D315 defect `percentage` closed
58719
+ * was drawn "on battery alone" — the same D315 defect `level` closed
57905
58720
  * by going nullable. Consumers SKIP it (no charger state published, no
57906
58721
  * glyph, no HomeKit ChargingState) rather than coerce it either way.
57907
58722
  */
@@ -57925,7 +58740,7 @@ var BatteryStatusSchema = object({
57925
58740
  * that only report charge. A second reading on this cap, not a second
57926
58741
  * `numeric-sensor` on the same device.
57927
58742
  */
57928
- volts: number().nullable().optional().meta(readingMeta("voltage", { label: "Voltage" })),
58743
+ voltage: number().nullable().optional().meta(readingMeta("voltage", { label: "Voltage" })),
57929
58744
  /**
57930
58745
  * Ms epoch of the last time the device PROVED it was reachable — a
57931
58746
  * completed firmware round-trip, an observed wake, or an inbound push
@@ -57959,7 +58774,7 @@ var BatteryStatusSchema = object({
57959
58774
  /**
57960
58775
  * True when the source is a BINARY low-battery indicator (HA
57961
58776
  * `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
57962
- * charge level — `percentage` is then a coarse stand-in (100 = normal,
58777
+ * charge level — `level` is then a coarse stand-in (100 = normal,
57963
58778
  * sub-threshold = low). UI MUST render "Normal"/"Low" instead of a
57964
58779
  * misleading exact percentage. Absent/false → genuine 0–100 % reading.
57965
58780
  */
@@ -57985,26 +58800,388 @@ object({
57985
58800
  DeviceType.Sensor;
57986
58801
  object({
57987
58802
  /** Current level as 0..100 inclusive. Firmware-reported. */
57988
- percentage: number().min(0).max(100).meta(readingMeta("percentage")),
58803
+ level: number().min(0).max(100).meta(readingMeta("percentage")),
57989
58804
  /** Ms epoch of the last operator-driven change. Useful for UI freshness. */
57990
58805
  lastChangedAt: number()
57991
58806
  });
57992
58807
  DeviceType.Light, method(object({
57993
58808
  deviceId: number().int().nonnegative(),
57994
- percentage: number().min(0).max(100)
58809
+ level: number().min(0).max(100)
57995
58810
  }), _void(), {
57996
58811
  kind: "mutation",
57997
58812
  auth: "protected"
57998
58813
  }), object({
57999
58814
  deviceId: number(),
58000
- percentage: number().min(0).max(100),
58815
+ level: number().min(0).max(100),
58001
58816
  lastChangedAt: number()
58002
58817
  });
58818
+ /**
58819
+ * The role vocabulary of a remote (D963): what a button MEANS, independent of
58820
+ * how it is wired. A layout template places buttons by role; a device binds a
58821
+ * role to an action; an exporter asks for a role by name. Roles are shared so
58822
+ * one layout fits every appliance and one voice command fits every binding.
58823
+ *
58824
+ * A role outside this list is `custom:<key>` — the operator's own button (a
58825
+ * SmartIR source, a channel preset). The key is a lowercase slug.
58826
+ */
58827
+ var REMOTE_KNOWN_ROLES = [
58828
+ "power",
58829
+ "power_on",
58830
+ "power_off",
58831
+ "volume_up",
58832
+ "volume_down",
58833
+ "mute",
58834
+ "channel_up",
58835
+ "channel_down",
58836
+ "up",
58837
+ "down",
58838
+ "left",
58839
+ "right",
58840
+ "ok",
58841
+ "back",
58842
+ "home",
58843
+ "menu",
58844
+ "info",
58845
+ "guide",
58846
+ "exit",
58847
+ "input",
58848
+ "play",
58849
+ "pause",
58850
+ "play_pause",
58851
+ "stop",
58852
+ "next",
58853
+ "previous",
58854
+ "fast_forward",
58855
+ "rewind",
58856
+ "digit_0",
58857
+ "digit_1",
58858
+ "digit_2",
58859
+ "digit_3",
58860
+ "digit_4",
58861
+ "digit_5",
58862
+ "digit_6",
58863
+ "digit_7",
58864
+ "digit_8",
58865
+ "digit_9"
58866
+ ];
58867
+ var CUSTOM_KEY_RE = /^[a-z0-9][a-z0-9_]{0,47}$/;
58868
+ var KNOWN_ROLES = new Set(REMOTE_KNOWN_ROLES);
58869
+ function isRemoteKnownRole(value) {
58870
+ return KNOWN_ROLES.has(value);
58871
+ }
58872
+ function isRemoteCustomKey(key) {
58873
+ return CUSTOM_KEY_RE.test(key);
58874
+ }
58875
+ /** The key of a `custom:<key>` role, or null for any other string. */
58876
+ function customKeyOfRole(role) {
58877
+ if (!role.startsWith("custom:")) return null;
58878
+ const key = role.slice(7);
58879
+ return isRemoteCustomKey(key) ? key : null;
58880
+ }
58881
+ function isRemoteRole(value) {
58882
+ return isRemoteKnownRole(value) || customKeyOfRole(value) !== null;
58883
+ }
58884
+ var RemoteRoleSchema = string().refine(isRemoteRole, { message: "a role is one of the known roles or custom:<key> (lowercase letters, digits, _)" });
58885
+ var RemoteBindingSchema = object({ action: AutomationCapStepSchema.extend({ deviceId: number().int().nonnegative() }) });
58886
+ var RemoteCustomButtonSchema = object({
58887
+ /** The slug after `custom:` in the role. */
58888
+ key: string().refine(isRemoteCustomKey, { message: "a lowercase slug" }),
58889
+ /** What the operator calls it, and what a voice command may name. */
58890
+ name: string().min(1).max(60)
58891
+ });
58892
+ var RemotePowerModeSchema = _enum(["toggle", "discrete"]);
58893
+ var RemoteConfigSchema = object({
58894
+ layoutTemplateId: string().min(1).nullable(),
58895
+ /**
58896
+ * The transmitter device new bindings and an import send through. A binding
58897
+ * names its own device, so one command may override it.
58898
+ */
58899
+ defaultTransmitterId: number().int().nonnegative().nullable().default(null),
58900
+ /** Keyed by role. A role with no entry falls back to the native cap. */
58901
+ bindings: record(string(), RemoteBindingSchema),
58902
+ customButtons: array(RemoteCustomButtonSchema).max(100),
58903
+ power: object({ mode: RemotePowerModeSchema })
58904
+ }).superRefine((config, ctx) => {
58905
+ const roles = Object.keys(config.bindings);
58906
+ if (roles.length > 200) ctx.addIssue({
58907
+ code: "custom",
58908
+ message: "too many bindings",
58909
+ path: ["bindings"]
58910
+ });
58911
+ for (const role of roles) if (!isRemoteRole(role)) ctx.addIssue({
58912
+ code: "custom",
58913
+ message: `"${role}" is not a role`,
58914
+ path: ["bindings", role]
58915
+ });
58916
+ const keys = /* @__PURE__ */ new Set();
58917
+ config.customButtons.forEach((button, index) => {
58918
+ if (keys.has(button.key)) ctx.addIssue({
58919
+ code: "custom",
58920
+ message: `custom button "${button.key}" is listed twice`,
58921
+ path: [
58922
+ "customButtons",
58923
+ index,
58924
+ "key"
58925
+ ]
58926
+ });
58927
+ keys.add(button.key);
58928
+ });
58929
+ for (const role of roles) {
58930
+ const key = customKeyOfRole(role);
58931
+ if (key !== null && !keys.has(key)) ctx.addIssue({
58932
+ code: "custom",
58933
+ message: `${role} is bound but has no entry in customButtons`,
58934
+ path: ["bindings", role]
58935
+ });
58936
+ }
58937
+ });
58938
+ object({
58939
+ power: object({
58940
+ state: _enum(["on", "off"]),
58941
+ at: number()
58942
+ }).nullable(),
58943
+ muted: object({
58944
+ value: boolean(),
58945
+ at: number()
58946
+ }).nullable()
58947
+ });
58948
+ var RemoteLayoutButtonSchema = object({
58949
+ id: string().min(1).max(40),
58950
+ /** 0-based grid position. */
58951
+ row: number().int().min(0).max(24),
58952
+ col: number().int().min(0).max(24),
58953
+ rowSpan: number().int().min(1).max(24),
58954
+ colSpan: number().int().min(1).max(24),
58955
+ icon: string().min(1).max(60).optional(),
58956
+ label: string().min(1).max(40).optional(),
58957
+ role: RemoteRoleSchema
58958
+ });
58959
+ object({
58960
+ columns: number().int().min(1).max(24),
58961
+ rows: number().int().min(1).max(24),
58962
+ buttons: array(RemoteLayoutButtonSchema).max(200)
58963
+ }).superRefine((grid, ctx) => {
58964
+ const ids = /* @__PURE__ */ new Set();
58965
+ const taken = /* @__PURE__ */ new Map();
58966
+ grid.buttons.forEach((button, index) => {
58967
+ if (ids.has(button.id)) ctx.addIssue({
58968
+ code: "custom",
58969
+ message: `button id "${button.id}" is used twice`,
58970
+ path: [
58971
+ "buttons",
58972
+ index,
58973
+ "id"
58974
+ ]
58975
+ });
58976
+ ids.add(button.id);
58977
+ if (button.row + button.rowSpan > grid.rows || button.col + button.colSpan > grid.columns) {
58978
+ ctx.addIssue({
58979
+ code: "custom",
58980
+ message: `button "${button.id}" leaves the grid`,
58981
+ path: ["buttons", index]
58982
+ });
58983
+ return;
58984
+ }
58985
+ for (let r = button.row; r < button.row + button.rowSpan; r += 1) for (let c = button.col; c < button.col + button.colSpan; c += 1) {
58986
+ const cell = `${r}:${c}`;
58987
+ const other = taken.get(cell);
58988
+ if (other !== void 0) {
58989
+ ctx.addIssue({
58990
+ code: "custom",
58991
+ message: `buttons "${other}" and "${button.id}" overlap`,
58992
+ path: ["buttons", index]
58993
+ });
58994
+ return;
58995
+ }
58996
+ taken.set(cell, button.id);
58997
+ }
58998
+ });
58999
+ });
59000
+ var RemoteBoundCommandSchema = object({
59001
+ role: RemoteRoleSchema,
59002
+ /** The operator's name for a custom button; absent for a known role. */
59003
+ label: string().optional(),
59004
+ custom: boolean()
59005
+ });
59006
+ var RemoteCommandListSchema = object({
59007
+ layoutTemplateId: string().nullable(),
59008
+ power: object({ mode: RemotePowerModeSchema }),
59009
+ /** Only the roles that are BOUND — the ones a press can reach. */
59010
+ commands: array(RemoteBoundCommandSchema)
59011
+ });
59012
+ var RemoteRefusalReasonSchema = _enum([
59013
+ "no-remote",
59014
+ "unbound-role",
59015
+ "action-failed"
59016
+ ]);
59017
+ var RemoteSendResultSchema = discriminatedUnion("status", [
59018
+ object({
59019
+ status: literal("sent"),
59020
+ /** How many times the action ran. */
59021
+ sends: number().int().min(1)
59022
+ }),
59023
+ object({
59024
+ status: literal("skipped"),
59025
+ reason: literal("already-in-state")
59026
+ }),
59027
+ object({
59028
+ status: literal("refused"),
59029
+ reason: RemoteRefusalReasonSchema,
59030
+ detail: string().optional()
59031
+ })
59032
+ ]);
59033
+ var RemoteMediaCommandSchema = _enum([
59034
+ "play",
59035
+ "pause",
59036
+ "stop",
59037
+ "next",
59038
+ "previous",
59039
+ "setMute",
59040
+ "selectSource"
59041
+ ]);
59042
+ /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
59043
+ var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
59044
+ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status: literal("saved") }), object({
59045
+ status: literal("refused"),
59046
+ reason: _enum(["unknown-template", "not-a-media-player"]),
59047
+ detail: string()
59048
+ })]);
59049
+ var deviceInput = object({ deviceId: number().int().nonnegative() });
59050
+ DeviceType.MediaPlayer;
59051
+ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
59052
+ kind: "mutation",
59053
+ auth: "admin"
59054
+ }), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
59055
+ role: RemoteRoleSchema,
59056
+ /** Sends in a row (volume steps). */
59057
+ repeat: number().int().min(1).max(50).default(1)
59058
+ }), RemoteSendResultSchema, {
59059
+ kind: "mutation",
59060
+ auth: "protected"
59061
+ }), method(deviceInput.extend({
59062
+ command: RemoteMediaCommandSchema,
59063
+ muted: boolean().optional(),
59064
+ source: string().optional(),
59065
+ repeat: number().int().min(1).max(50).default(1)
59066
+ }), RemoteMediaCommandResultSchema, {
59067
+ kind: "mutation",
59068
+ auth: "protected"
59069
+ });
59070
+ var TemplateKindSchema = _enum(["remote"]);
59071
+ /**
59072
+ * template — the generic store of reusable, named operator data (D963). A
59073
+ * record is `{ id, kind, name, payload }`; the kinds (today only `remote`, the
59074
+ * button grid of a remote) and the schema each payload must satisfy are
59075
+ * declared by the system in `template-kinds.ts`. Nothing here is specific to a
59076
+ * kind: the engine validates a payload against its kind's schema and, on a
59077
+ * delete, asks the kind's owner whether anything still points at the record.
59078
+ *
59079
+ * Every refusal is a typed result — a UI says "unknown kind" or names the
59080
+ * devices that still use a template, without parsing text.
59081
+ */
59082
+ var TemplateRecordSchema = object({
59083
+ id: string().min(1),
59084
+ kind: TemplateKindSchema,
59085
+ name: string().min(1).max(120),
59086
+ /** Shaped by the kind; `checkTemplatePayload(kind, payload)` reads it. */
59087
+ payload: unknown(),
59088
+ createdAt: number(),
59089
+ updatedAt: number()
59090
+ });
59091
+ var TemplateWriteResultSchema = discriminatedUnion("status", [object({
59092
+ status: literal("saved"),
59093
+ template: TemplateRecordSchema
59094
+ }), object({
59095
+ status: literal("refused"),
59096
+ reason: _enum(["invalid-payload", "not-found"]),
59097
+ detail: string()
59098
+ })]);
59099
+ /** A device still pointing at a template. */
59100
+ var TemplateUserSchema = object({
59101
+ deviceId: number().int().nonnegative(),
59102
+ name: string()
59103
+ });
59104
+ var TemplateDeleteResultSchema = discriminatedUnion("status", [
59105
+ object({ status: literal("deleted") }),
59106
+ object({ status: literal("not-found") }),
59107
+ object({
59108
+ status: literal("in-use"),
59109
+ devices: array(TemplateUserSchema).min(1)
59110
+ })
59111
+ ]);
59112
+ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSchema), { auth: "protected" }), method(object({ id: string().min(1) }), TemplateRecordSchema.nullable(), { auth: "protected" }), method(object({
59113
+ kind: TemplateKindSchema,
59114
+ name: string().min(1).max(120),
59115
+ payload: unknown()
59116
+ }), TemplateWriteResultSchema, {
59117
+ kind: "mutation",
59118
+ auth: "admin"
59119
+ }), method(object({
59120
+ id: string().min(1),
59121
+ name: string().min(1).max(120).optional(),
59122
+ payload: unknown().optional()
59123
+ }), TemplateWriteResultSchema, {
59124
+ kind: "mutation",
59125
+ auth: "admin"
59126
+ }), method(object({ id: string().min(1) }), TemplateDeleteResultSchema, {
59127
+ kind: "mutation",
59128
+ auth: "admin"
59129
+ });
58003
59130
  DeviceType.Button, method(object({ deviceId: number().int().nonnegative() }), _void(), {
58004
59131
  kind: "mutation",
58005
59132
  auth: "protected"
58006
59133
  });
58007
59134
  /**
59135
+ * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
59136
+ * alternating, no zeros, 2..1024 entries.
59137
+ */
59138
+ var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
59139
+ timings.forEach((value, index) => {
59140
+ const expectMark = index % 2 === 0;
59141
+ if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
59142
+ code: "custom",
59143
+ message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
59144
+ path: [index]
59145
+ });
59146
+ });
59147
+ });
59148
+ /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
59149
+ var TransmitSettingsSchema = object({
59150
+ carrierHz: number().int().positive().optional(),
59151
+ dutyCyclePercent: number().int().min(1).max(100).optional(),
59152
+ repeat: number().int().min(0).max(20).optional(),
59153
+ repeatDelayMs: number().int().min(0).optional()
59154
+ });
59155
+ /** The setting keys a transmitter may declare as settable (`getInfo.settable`). */
59156
+ var TransmitSettingKeySchema = _enum([
59157
+ "carrierHz",
59158
+ "dutyCyclePercent",
59159
+ "repeat",
59160
+ "repeatDelayMs"
59161
+ ]);
59162
+ var IrMediumSchema = _enum(["ir", "rf"]);
59163
+ var IrSendResultSchema = object({
59164
+ ok: literal(true),
59165
+ /** Settings the transmitter could not apply; the train was still sent. */
59166
+ ignoredSettings: array(string())
59167
+ });
59168
+ var IrTransmitterInfoSchema = object({
59169
+ media: array(IrMediumSchema),
59170
+ settable: array(TransmitSettingKeySchema),
59171
+ maxTimings: number().int().positive()
59172
+ });
59173
+ DeviceType.Generic, method(object({
59174
+ deviceId: number().int().nonnegative(),
59175
+ timings: IrTimingsSchema,
59176
+ settings: TransmitSettingsSchema.optional()
59177
+ }), IrSendResultSchema, {
59178
+ kind: "mutation",
59179
+ auth: "protected"
59180
+ }), method(object({ deviceId: number().int().nonnegative() }), IrTransmitterInfoSchema, {
59181
+ kind: "query",
59182
+ auth: "protected"
59183
+ });
59184
+ /**
58008
59185
  * `calendar-source` — collection cap exposing per-provider calendars and
58009
59186
  * their events. Every addon that contributes calendars (Home Assistant,
58010
59187
  * a future Google Calendar addon, …) registers a provider here. The hub
@@ -58502,11 +59679,11 @@ var ColorInputSchema = discriminatedUnion("mode", [
58502
59679
  }),
58503
59680
  object({
58504
59681
  mode: literal("mired"),
58505
- mireds: number().int().min(50).max(1e3)
59682
+ colorTemperature: number().int().min(50).max(1e3)
58506
59683
  })
58507
59684
  ]);
58508
59685
  object({
58509
- /** Active color mode — which of `rgb` / `hsv` / `mireds` reflects
59686
+ /** Active color mode — which of `rgb` / `hsv` / `colorTemperature` reflects
58510
59687
  * the bulb's current state. */
58511
59688
  mode: _enum([
58512
59689
  "rgb",
@@ -58518,7 +59695,7 @@ object({
58518
59695
  /** Populated when `mode === 'hsv'`. */
58519
59696
  hsv: HsvTripletSchema.optional(),
58520
59697
  /** Populated when `mode === 'mired'`. */
58521
- mireds: number().int().optional().meta(readingMeta("colour-temperature")),
59698
+ colorTemperature: number().int().optional().meta(readingMeta("colour-temperature")),
58522
59699
  /** Ms epoch of the last operator-driven change. */
58523
59700
  lastChangedAt: number()
58524
59701
  });
@@ -58537,7 +59714,7 @@ DeviceType.Light, method(object({
58537
59714
  ]),
58538
59715
  rgb: RgbTripletSchema.optional(),
58539
59716
  hsv: HsvTripletSchema.optional(),
58540
- mireds: number().int().optional(),
59717
+ colorTemperature: number().int().optional(),
58541
59718
  lastChangedAt: number()
58542
59719
  });
58543
59720
  var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
@@ -58975,11 +60152,11 @@ object({
58975
60152
  /** Feature keys of the programs the appliance currently offers — drives the UI selector. */
58976
60153
  availablePrograms: array(string()),
58977
60154
  /** Seconds remaining on the active cycle, or null when not running / not known. */
58978
- remainingSeconds: number().int().nonnegative().nullable().meta(readingMeta("duration")),
60155
+ remaining: number().int().nonnegative().nullable().meta(readingMeta("duration")),
58979
60156
  /** Seconds the delayed start is set to (time until the cycle starts), or null. */
58980
- delayedStartSeconds: number().int().nonnegative().nullable().meta(readingMeta("duration")),
60157
+ delayedStart: number().int().nonnegative().nullable().meta(readingMeta("duration")),
58981
60158
  /** Cycle completion 0..100, or null when not applicable. */
58982
- progressPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
60159
+ progress: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
58983
60160
  /** True when the door is reported open; null when the door state is not known. */
58984
60161
  doorOpen: boolean().nullable(),
58985
60162
  /** True when the door is latched (locked) during a cycle; null when not reported. */
@@ -59024,7 +60201,7 @@ object({
59024
60201
  /** Ms epoch of the last value received from the appliance; 0 = never. */
59025
60202
  lastFetchedAt: number()
59026
60203
  });
59027
- var DeviceIdSchema = number().int().nonnegative();
60204
+ var DeviceIdSchema$1 = number().int().nonnegative();
59028
60205
  /** A value a program option or setting can take. */
59029
60206
  var DishwasherValueSchema = union([
59030
60207
  boolean(),
@@ -59088,77 +60265,77 @@ var DishwasherOptionsSchema = object({
59088
60265
  options: array(DishwasherOptionDescriptorSchema)
59089
60266
  });
59090
60267
  DeviceType.Dishwasher, method(object({
59091
- deviceId: DeviceIdSchema,
60268
+ deviceId: DeviceIdSchema$1,
59092
60269
  program: string().min(1).optional(),
59093
60270
  options: record(string(), DishwasherValueSchema).optional()
59094
60271
  }), _void(), {
59095
60272
  kind: "mutation",
59096
60273
  auth: "protected"
59097
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
60274
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59098
60275
  kind: "mutation",
59099
60276
  auth: "protected"
59100
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
60277
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59101
60278
  kind: "mutation",
59102
60279
  auth: "protected"
59103
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
60280
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59104
60281
  kind: "mutation",
59105
60282
  auth: "protected"
59106
60283
  }), method(object({
59107
- deviceId: DeviceIdSchema,
60284
+ deviceId: DeviceIdSchema$1,
59108
60285
  program: string().min(1)
59109
60286
  }), _void(), {
59110
60287
  kind: "mutation",
59111
60288
  auth: "protected"
59112
60289
  }), method(object({
59113
- deviceId: DeviceIdSchema,
60290
+ deviceId: DeviceIdSchema$1,
59114
60291
  on: boolean()
59115
60292
  }), _void(), {
59116
60293
  kind: "mutation",
59117
60294
  auth: "protected"
59118
60295
  }), method(object({
59119
- deviceId: DeviceIdSchema,
60296
+ deviceId: DeviceIdSchema$1,
59120
60297
  on: boolean()
59121
60298
  }), _void(), {
59122
60299
  kind: "mutation",
59123
60300
  auth: "protected"
59124
60301
  }), method(object({
59125
- deviceId: DeviceIdSchema,
60302
+ deviceId: DeviceIdSchema$1,
59126
60303
  on: boolean()
59127
60304
  }), _void(), {
59128
60305
  kind: "mutation",
59129
60306
  auth: "protected"
59130
60307
  }), method(object({
59131
- deviceId: DeviceIdSchema,
60308
+ deviceId: DeviceIdSchema$1,
59132
60309
  on: boolean()
59133
60310
  }), _void(), {
59134
60311
  kind: "mutation",
59135
60312
  auth: "protected"
59136
60313
  }), method(object({
59137
- deviceId: DeviceIdSchema,
60314
+ deviceId: DeviceIdSchema$1,
59138
60315
  on: boolean()
59139
60316
  }), _void(), {
59140
60317
  kind: "mutation",
59141
60318
  auth: "protected"
59142
60319
  }), method(object({
59143
- deviceId: DeviceIdSchema,
60320
+ deviceId: DeviceIdSchema$1,
59144
60321
  on: boolean()
59145
60322
  }), _void(), {
59146
60323
  kind: "mutation",
59147
60324
  auth: "protected"
59148
60325
  }), method(object({
59149
- deviceId: DeviceIdSchema,
60326
+ deviceId: DeviceIdSchema$1,
59150
60327
  on: boolean()
59151
60328
  }), _void(), {
59152
60329
  kind: "mutation",
59153
60330
  auth: "protected"
59154
60331
  }), method(object({
59155
- deviceId: DeviceIdSchema,
60332
+ deviceId: DeviceIdSchema$1,
59156
60333
  key: string().min(1),
59157
60334
  value: DishwasherValueSchema
59158
60335
  }), _void(), {
59159
60336
  kind: "mutation",
59160
60337
  auth: "protected"
59161
- }), method(object({ deviceId: DeviceIdSchema }), DishwasherOptionsSchema, { auth: "protected" });
60338
+ }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
59162
60339
  DeviceType.Camera;
59163
60340
  object({
59164
60341
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -59597,7 +60774,7 @@ var FanDirectionSchema = _enum(["forward", "reverse"]);
59597
60774
  object({
59598
60775
  /** Active speed as 0..100 inclusive. Null when the device has no
59599
60776
  * speed surface (single-speed fan). */
59600
- percentage: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
60777
+ speed: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
59601
60778
  /** Speed granularity the device accepts (HA `percentage_step`, e.g. 25 for
59602
60779
  * a 4-speed fan). Absent when unknown — the UI then falls back to step 1. */
59603
60780
  percentageStep: number().positive().optional().meta(readingMeta("percentage")),
@@ -59617,7 +60794,7 @@ object({
59617
60794
  });
59618
60795
  DeviceType.Fan, method(object({
59619
60796
  deviceId: number().int().nonnegative(),
59620
- percentage: number().min(0).max(100)
60797
+ speed: number().min(0).max(100)
59621
60798
  }), _void(), {
59622
60799
  kind: "mutation",
59623
60800
  auth: "protected"
@@ -59816,7 +60993,7 @@ DeviceType.Humidifier, method(object({
59816
60993
  */
59817
60994
  var HumiditySensorStatusSchema = object({
59818
60995
  /** Current relative humidity, 0..100. `null` when the sample was refused (D393). */
59819
- percent: number().min(0).max(100).nullable().meta(readingMeta("humidity", {
60996
+ humidity: number().min(0).max(100).nullable().meta(readingMeta("humidity", {
59820
60997
  precision: 0,
59821
60998
  label: "Humidity"
59822
60999
  })),
@@ -60259,7 +61436,7 @@ object({
60259
61436
  batteryLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
60260
61437
  /** 0..100 mowing-completion percentage of the current task, or null when no
60261
61438
  * task is active / progress is unavailable. */
60262
- progressPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
61439
+ progress: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
60263
61440
  /** Current device/event code (dynamic — mostly status, sometimes an error),
60264
61441
  * or null when unknown. */
60265
61442
  currentCode: number().nullable().meta(readingMeta("none")),
@@ -60731,9 +61908,35 @@ var MediaInfoSchema = object({
60731
61908
  /** Optional cover-art / thumbnail URL. */
60732
61909
  imageUrl: string().optional()
60733
61910
  });
61911
+ /**
61912
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
61913
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
61914
+ * tracks what it last SENT; it moves only after a send was accepted, and a
61915
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
61916
+ * guess, never as a reading.
61917
+ */
61918
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
61919
+ /** The fields of a media-player status a driver can only guess. */
61920
+ var MediaPlayerAssumedFieldSchema = _enum([
61921
+ "state",
61922
+ "volumeLevel",
61923
+ "isMuted",
61924
+ "source"
61925
+ ]);
60734
61926
  object({
60735
61927
  /** Playback lifecycle state. */
60736
61928
  state: MediaPlayerStateSchema,
61929
+ /**
61930
+ * Whether the state fields are readings or the driver's own bookkeeping.
61931
+ * A slice written before this field existed parses as `reported`.
61932
+ */
61933
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
61934
+ /**
61935
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
61936
+ * this is not empty; a field not listed here is a reading even then (power
61937
+ * from a running-state source, mute guessed from the last send).
61938
+ */
61939
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
60737
61940
  /** Volume as 0..100 inclusive. Null when the device has no volume
60738
61941
  * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
60739
61942
  volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
@@ -60749,10 +61952,10 @@ object({
60749
61952
  currentMedia: MediaInfoSchema.nullable(),
60750
61953
  /** Current playback position in ms. Null when not seekable or
60751
61954
  * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
60752
- positionMs: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
61955
+ position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
60753
61956
  /** Total duration of the current media in ms. Null when unknown
60754
61957
  * (live stream) or nothing is playing. */
60755
- durationMs: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
61958
+ duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
60756
61959
  /** Shuffle toggle. Null when no shuffle surface.
60757
61960
  * Pair with `DeviceFeature.MediaPlayerShuffle`. */
60758
61961
  shuffle: boolean().nullable(),
@@ -60779,7 +61982,7 @@ DeviceType.MediaPlayer, method(object({ deviceId: number().int().nonnegative() }
60779
61982
  auth: "protected"
60780
61983
  }), method(object({
60781
61984
  deviceId: number().int().nonnegative(),
60782
- positionMs: number().int().nonnegative()
61985
+ position: number().int().nonnegative()
60783
61986
  }), _void(), {
60784
61987
  kind: "mutation",
60785
61988
  auth: "protected"
@@ -61452,9 +62655,9 @@ var NetworkLinkStatusSchema = object({
61452
62655
  * one whose reading has not landed must not be drawn at 0 %. Consumers
61453
62656
  * SKIP a null rather than coerce it.
61454
62657
  */
61455
- signalPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62658
+ signal: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
61456
62659
  /** Raw received signal strength in dBm, when the firmware reports one. */
61457
- rssiDbm: number().optional().meta(readingMeta("signal-level")),
62660
+ rssi: number().optional().meta(readingMeta("signal-level")),
61458
62661
  /** Network name of a wireless link, when the firmware reports it. */
61459
62662
  ssid: string().optional(),
61460
62663
  /** Ms epoch of the last observation. Lets consumers reason about freshness. */
@@ -61586,7 +62789,8 @@ var TopologyNodeSchema = object({
61586
62789
  isHub: boolean(),
61587
62790
  isOnline: boolean(),
61588
62791
  cpuPercent: number(),
61589
- memoryPercent: number(),
62792
+ /** `null` when the node's memory read failed or it has not reported one (D393). */
62793
+ memoryPercent: number().nullable(),
61590
62794
  uptime: number(),
61591
62795
  lastSeen: string(),
61592
62796
  localIps: array(string()).readonly(),
@@ -62115,10 +63319,21 @@ var PetFeederDeviceStatusSchema = _enum([
62115
63319
  ]);
62116
63320
  var gramsPortion = number().int().min(4).max(200);
62117
63321
  object({
62118
- /** Food currently in the bowl (grams). Null when the device has not
62119
- * reported a reading yet. On dual-hopper models this is the combined
62120
- * bowl reading; per-hopper levels live in `food1`/`food2`. */
63322
+ /** Food in the TANK (hopper), as the feeder's own sensor reports it
63323
+ * (`state.food`). A coarse level code, not grams — `0` is empty. The
63324
+ * amount in the bowl is `bowlFood`. On dual-hopper models this is the
63325
+ * combined reading; per-hopper levels live in `food1`/`food2`. Null when
63326
+ * the device has not reported yet. */
62121
63327
  foodLevel: number().nullable().meta(readingMeta("none")),
63328
+ /** Food in the BOWL, a mass (stored in kilograms, D944). Reported only by a
63329
+ * feeder with a bowl scale; null when the model has none or its reading is
63330
+ * of an unproven unit. */
63331
+ bowlFood: number().nullable().meta(readingMeta("mass")),
63332
+ /** True while the pet is eating (`state.eating`). */
63333
+ eating: boolean(),
63334
+ /** Whether `markFoodReplenished` does anything on this model. When false
63335
+ * the client must not offer it. */
63336
+ supportsMarkRefilled: boolean(),
62122
63337
  /** Hopper-1 food level (grams) on dual-hopper feeders; null on
62123
63338
  * single-hopper models. */
62124
63339
  food1: number().nullable().meta(readingMeta("none")),
@@ -62126,12 +63341,17 @@ object({
62126
63341
  * single-hopper models. */
62127
63342
  food2: number().nullable().meta(readingMeta("none")),
62128
63343
  /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
62129
- * (`device_class: problem`, on = low). True when the bowl is empty /
62130
- * below the feeder's low threshold. */
63344
+ * (`device_class: problem`, on = low). True when the tank reports empty,
63345
+ * or, on a dual-hopper model, when EITHER hopper is empty. */
62131
63346
  lowFood: boolean(),
62132
- /** Battery charge 0..100 (%). Null on mains-powered models or when the
62133
- * device has no battery reading. */
63347
+ /** Battery charge 0..100 (%). On a feeder running on `mains` this is the
63348
+ * BACKUP battery's charge, not the power source. Null when the device has
63349
+ * no battery reading. */
62134
63350
  batteryPower: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
63351
+ /** What the feeder is powered from right now: `mains` (plugged in, the
63352
+ * battery is only a backup) or `battery`. Null when the device does not
63353
+ * report it. */
63354
+ powerSource: _enum(["mains", "battery"]).nullable(),
62135
63355
  /**
62136
63356
  * Desiccant life remaining, stored in seconds (duration base, D944).
62137
63357
  * Providers convert from the days the feeder reports. Null when the
@@ -62159,6 +63379,14 @@ object({
62159
63379
  feedSound: boolean(),
62160
63380
  /** Speaker / prompt volume level (device-scaled integer). */
62161
63381
  volume: number().meta(readingMeta("none")),
63382
+ /** Portion (grams) of the last manual feed sent from a single-hopper
63383
+ * stepper — the default the next manual feed starts from. Persisted per
63384
+ * device by the provider; null until a manual feed has been sent. */
63385
+ lastFeedGrams: gramsPortion.nullable(),
63386
+ /** Hopper-1 portion of the last manual feed (dual-hopper); null until sent. */
63387
+ lastFeedHopper1: gramsPortion.nullable(),
63388
+ /** Hopper-2 portion of the last manual feed (dual-hopper); null until sent. */
63389
+ lastFeedHopper2: gramsPortion.nullable(),
62162
63390
  /** Ms epoch when the slice was last refreshed from the cloud. */
62163
63391
  lastFetchedAt: number()
62164
63392
  });
@@ -62213,6 +63441,64 @@ DeviceType.PetFeeder, method(object({
62213
63441
  kind: "mutation",
62214
63442
  auth: "protected"
62215
63443
  });
63444
+ object({
63445
+ /** Water in the tank, 0..100 (%). Null while the source has not reported. */
63446
+ waterLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
63447
+ /** Water in the tank, in litres. Null while the source has not reported. */
63448
+ waterVolume: number().min(0).nullable().meta(readingMeta("volume")),
63449
+ /** True when the tank is empty. Null while unknown. */
63450
+ empty: boolean().nullable(),
63451
+ /** True while the pump is running. Null while unknown. */
63452
+ pumpRunning: boolean().nullable(),
63453
+ /** True when the pump works on an on/off duty cycle rather than continuously. */
63454
+ pumpIntervalEnabled: boolean().nullable(),
63455
+ /** How long the pump runs per cycle, in seconds. */
63456
+ pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
63457
+ /** How long the pump rests per cycle, in seconds. */
63458
+ pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
63459
+ /** Water drunk in the last drink, in litres. */
63460
+ lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
63461
+ /** Water drunk in the current hour, in litres. */
63462
+ currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
63463
+ /** Water drunk over the last 24 hours (rolling), in litres. */
63464
+ last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
63465
+ /** Water drunk since local midnight, in litres. */
63466
+ todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
63467
+ /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
63468
+ error: string().nullable(),
63469
+ /** Ms epoch when the slice was last refreshed. */
63470
+ lastFetchedAt: number()
63471
+ });
63472
+ var DeviceIdSchema = number().int().nonnegative();
63473
+ var MinutesSchema = number().int().min(0);
63474
+ DeviceType.PetFountain, method(object({
63475
+ deviceId: DeviceIdSchema,
63476
+ on: boolean()
63477
+ }), _void(), {
63478
+ kind: "mutation",
63479
+ auth: "protected"
63480
+ }), method(object({
63481
+ deviceId: DeviceIdSchema,
63482
+ on: boolean()
63483
+ }), _void(), {
63484
+ kind: "mutation",
63485
+ auth: "protected"
63486
+ }), method(object({
63487
+ deviceId: DeviceIdSchema,
63488
+ minutes: MinutesSchema
63489
+ }), _void(), {
63490
+ kind: "mutation",
63491
+ auth: "protected"
63492
+ }), method(object({
63493
+ deviceId: DeviceIdSchema,
63494
+ minutes: MinutesSchema
63495
+ }), _void(), {
63496
+ kind: "mutation",
63497
+ auth: "protected"
63498
+ }), method(object({ deviceId: DeviceIdSchema }), _void(), {
63499
+ kind: "mutation",
63500
+ auth: "protected"
63501
+ });
62216
63502
  var VehicleSchema = object({
62217
63503
  id: string(),
62218
63504
  name: string(),
@@ -62594,16 +63880,16 @@ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema)
62594
63880
  auth: "admin"
62595
63881
  });
62596
63882
  object({
62597
- /** Instantaneous power draw in watts. */
62598
- watts: number().optional().meta(readingMeta("power", { label: "Power" })),
63883
+ /** Instantaneous power draw (watts). */
63884
+ power: number().optional().meta(readingMeta("power", { label: "Power" })),
62599
63885
  /** Cumulative energy in kilowatt-hours since the meter was reset. */
62600
- kwhTotal: number().optional().meta(readingMeta("energy", { label: "Energy" })),
62601
- /** Voltage in volts. */
62602
- volts: number().optional().meta(readingMeta("voltage", { label: "Voltage" })),
63886
+ energy: number().optional().meta(readingMeta("energy", { label: "Energy" })),
63887
+ /** Voltage (volts). */
63888
+ voltage: number().optional().meta(readingMeta("voltage", { label: "Voltage" })),
62603
63889
  /** Current in amperes. */
62604
- amps: number().optional().meta(readingMeta("current", { label: "Current" })),
63890
+ current: number().optional().meta(readingMeta("current", { label: "Current" })),
62605
63891
  /** Apparent power in volt-amperes. */
62606
- va: number().optional().meta(readingMeta("apparent-power")),
63892
+ apparentPower: number().optional().meta(readingMeta("apparent-power")),
62607
63893
  /** Power factor (0..1) if reported. */
62608
63894
  powerFactor: number().min(0).max(1).optional().meta(readingMeta("ratio")),
62609
63895
  /** Ms epoch when the slice was last updated. */
@@ -62658,16 +63944,13 @@ var PresenceStatusSchema = object({
62658
63944
  location: string().nullable(),
62659
63945
  /** GPS coordinates when available. Null otherwise. */
62660
63946
  gps: GpsLocationSchema.nullable(),
62661
- /** Optional battery level of the tracking device (0..100). Null
62662
- * when not reported. */
62663
- batteryPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62664
63947
  /** Ms epoch when the slice was last updated. */
62665
63948
  lastChangedAt: number()
62666
63949
  });
62667
63950
  DeviceType.Presence;
62668
63951
  object({
62669
63952
  /** Current pressure in hPa. `null` when the sample was refused (D393). */
62670
- hpa: number().nullable().meta(readingMeta("pressure", { precision: 0 })),
63953
+ pressure: number().nullable().meta(readingMeta("pressure", { precision: 0 })),
62671
63954
  /** Ms epoch when the slice was last updated. */
62672
63955
  lastFetchedAt: number()
62673
63956
  });
@@ -65691,7 +66974,7 @@ DeviceType.Sensor;
65691
66974
  */
65692
66975
  var TemperatureSensorStatusSchema = object({
65693
66976
  /** Current temperature in Celsius. `null` when the sample was refused (D393). */
65694
- celsius: number().nullable().meta(readingMeta("temperature", {
66977
+ temperature: number().nullable().meta(readingMeta("temperature", {
65695
66978
  precision: 1,
65696
66979
  label: "Temperature"
65697
66980
  })),
@@ -65955,7 +67238,7 @@ object({
65955
67238
  /** Speed tokens the hardware accepts — drives the UI selector. */
65956
67239
  availableFanSpeeds: array(string()),
65957
67240
  /** 0..100 cleaning-completion percentage of the current task, or null. */
65958
- progressPercent: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
67241
+ progress: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
65959
67242
  /** Current error code (0 / null = no error). */
65960
67243
  errorCode: number().nullable().meta(readingMeta("none")),
65961
67244
  /** Human label for {@link errorCode}, or null when none / undecodable. */
@@ -66824,9 +68107,17 @@ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" })
66824
68107
  kind: "mutation",
66825
68108
  auth: "admin"
66826
68109
  });
68110
+ discriminatedUnion("kind", [object({
68111
+ kind: literal("raw"),
68112
+ timings: array(number().int()),
68113
+ settings: TransmitSettingsSchema.optional()
68114
+ }), object({
68115
+ kind: literal("pronto"),
68116
+ code: string()
68117
+ })]);
66827
68118
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
66828
68119
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
66829
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
68120
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
66830
68121
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
66831
68122
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
66832
68123
  new Set(CAP_NAMES);
@@ -66879,7 +68170,7 @@ var AccessoryKind = {
66879
68170
  PrivacyMask: DeviceRole.PrivacyMask
66880
68171
  };
66881
68172
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
66882
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
68173
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
66883
68174
  new Set(Object.values(DeviceType));
66884
68175
  Object.freeze({
66885
68176
  "accessories.getStatus": {
@@ -66896,6 +68187,104 @@ Object.freeze({
66896
68187
  access: "create",
66897
68188
  role: "admin"
66898
68189
  },
68190
+ "actions.create": {
68191
+ capName: "actions",
68192
+ capScope: "system",
68193
+ addonId: null,
68194
+ access: "create",
68195
+ role: "admin"
68196
+ },
68197
+ "actions.delete": {
68198
+ capName: "actions",
68199
+ capScope: "system",
68200
+ addonId: null,
68201
+ access: "delete",
68202
+ role: "admin"
68203
+ },
68204
+ "actions.get": {
68205
+ capName: "actions",
68206
+ capScope: "system",
68207
+ addonId: null,
68208
+ access: "view",
68209
+ role: "viewer"
68210
+ },
68211
+ "actions.getLinks": {
68212
+ capName: "actions",
68213
+ capScope: "system",
68214
+ addonId: null,
68215
+ access: "view",
68216
+ role: "admin"
68217
+ },
68218
+ "actions.getTraces": {
68219
+ capName: "actions",
68220
+ capScope: "system",
68221
+ addonId: null,
68222
+ access: "view",
68223
+ role: "admin"
68224
+ },
68225
+ "actions.list": {
68226
+ capName: "actions",
68227
+ capScope: "system",
68228
+ addonId: null,
68229
+ access: "view",
68230
+ role: "admin"
68231
+ },
68232
+ "actions.listForCamera": {
68233
+ capName: "actions",
68234
+ capScope: "system",
68235
+ addonId: null,
68236
+ access: "view",
68237
+ role: "viewer"
68238
+ },
68239
+ "actions.run": {
68240
+ capName: "actions",
68241
+ capScope: "system",
68242
+ addonId: null,
68243
+ access: "create",
68244
+ role: "viewer"
68245
+ },
68246
+ "actions.setLinks": {
68247
+ capName: "actions",
68248
+ capScope: "system",
68249
+ addonId: null,
68250
+ access: "create",
68251
+ role: "admin"
68252
+ },
68253
+ "actions.stop": {
68254
+ capName: "actions",
68255
+ capScope: "system",
68256
+ addonId: null,
68257
+ access: "create",
68258
+ role: "admin"
68259
+ },
68260
+ "actions.update": {
68261
+ capName: "actions",
68262
+ capScope: "system",
68263
+ addonId: null,
68264
+ access: "create",
68265
+ role: "admin"
68266
+ },
68267
+ "actionSource.listActions": {
68268
+ capName: "action-source",
68269
+ capScope: "system",
68270
+ addonId: null,
68271
+ access: "view",
68272
+ role: "admin"
68273
+ },
68274
+ "actionSource.runAction": {
68275
+ capName: "action-source",
68276
+ capScope: "system",
68277
+ addonId: null,
68278
+ access: "create",
68279
+ role: "admin"
68280
+ },
68281
+ "actionSource.stopAction": {
68282
+ capName: "action-source",
68283
+ capScope: "system",
68284
+ addonId: null,
68285
+ access: "create",
68286
+ role: "admin"
68287
+ },
66899
68288
  "addonPages.listPages": {
66900
68289
  capName: "addon-pages",
66901
68290
  capScope: "system",
@@ -68177,6 +69566,13 @@ Object.freeze({
68177
69566
  access: "view",
68178
69567
  role: "admin"
68179
69568
  },
69569
+ "coreBlocks.getAutomationRunState": {
69570
+ capName: "core-blocks",
69571
+ capScope: "system",
69572
+ addonId: null,
69573
+ access: "view",
69574
+ role: "admin"
69575
+ },
68180
69576
  "coreBlocks.getBlockSettings": {
68181
69577
  capName: "core-blocks",
68182
69578
  capScope: "system",
@@ -68198,6 +69594,13 @@ Object.freeze({
68198
69594
  access: "view",
68199
69595
  role: "admin"
68200
69596
  },
69597
+ "coreBlocks.getTraces": {
69598
+ capName: "core-blocks",
69599
+ capScope: "system",
69600
+ addonId: null,
69601
+ access: "view",
69602
+ role: "admin"
69603
+ },
68201
69604
  "coreBlocks.getTypeDefs": {
68202
69605
  capName: "core-blocks",
68203
69606
  capScope: "system",
@@ -68233,6 +69636,13 @@ Object.freeze({
68233
69636
  access: "create",
68234
69637
  role: "admin"
68235
69638
  },
69639
+ "coreBlocks.reportAutomationRun": {
69640
+ capName: "core-blocks",
69641
+ capScope: "system",
69642
+ addonId: null,
69643
+ access: "create",
69644
+ role: "admin"
69645
+ },
68236
69646
  "coreBlocks.restart": {
68237
69647
  capName: "core-blocks",
68238
69648
  capScope: "system",
@@ -68695,6 +70105,13 @@ Object.freeze({
68695
70105
  access: "create",
68696
70106
  role: "admin"
68697
70107
  },
70108
+ "deviceExport.exposeEntity": {
70109
+ capName: "device-export",
70110
+ capScope: "system",
70111
+ addonId: null,
70112
+ access: "create",
70113
+ role: "admin"
70114
+ },
68698
70115
  "deviceExport.getDeviceLiveContribution": {
68699
70116
  capName: "device-export",
68700
70117
  capScope: "system",
@@ -68723,6 +70140,13 @@ Object.freeze({
68723
70140
  access: "view",
68724
70141
  role: "admin"
68725
70142
  },
70143
+ "deviceExport.listExposedEntities": {
70144
+ capName: "device-export",
70145
+ capScope: "system",
70146
+ addonId: null,
70147
+ access: "view",
70148
+ role: "admin"
70149
+ },
68726
70150
  "deviceExport.listSupportedDeviceKinds": {
68727
70151
  capName: "device-export",
68728
70152
  capScope: "system",
@@ -68730,6 +70154,13 @@ Object.freeze({
68730
70154
  access: "view",
68731
70155
  role: "admin"
68732
70156
  },
70157
+ "deviceExport.listSupportedEntityKinds": {
70158
+ capName: "device-export",
70159
+ capScope: "system",
70160
+ addonId: null,
70161
+ access: "view",
70162
+ role: "admin"
70163
+ },
68733
70164
  "deviceExport.unexposeDevice": {
68734
70165
  capName: "device-export",
68735
70166
  capScope: "system",
@@ -68737,6 +70168,13 @@ Object.freeze({
68737
70168
  access: "create",
68738
70169
  role: "admin"
68739
70170
  },
70171
+ "deviceExport.unexposeEntity": {
70172
+ capName: "device-export",
70173
+ capScope: "system",
70174
+ addonId: null,
70175
+ access: "create",
70176
+ role: "admin"
70177
+ },
68740
70178
  "deviceExtension.listCandidates": {
68741
70179
  capName: "device-extension",
68742
70180
  capScope: "device",
@@ -70312,6 +71750,20 @@ Object.freeze({
70312
71750
  access: "create",
70313
71751
  role: "viewer"
70314
71752
  },
71753
+ "irTransmitter.getInfo": {
71754
+ capName: "ir-transmitter",
71755
+ capScope: "device",
71756
+ addonId: null,
71757
+ access: "view",
71758
+ role: "viewer"
71759
+ },
71760
+ "irTransmitter.send": {
71761
+ capName: "ir-transmitter",
71762
+ capScope: "device",
71763
+ addonId: null,
71764
+ access: "create",
71765
+ role: "viewer"
71766
+ },
70315
71767
  "keychain.delete": {
70316
71768
  capName: "keychain",
70317
71769
  capScope: "system",
@@ -71544,6 +72996,13 @@ Object.freeze({
71544
72996
  access: "create",
71545
72997
  role: "admin"
71546
72998
  },
72999
+ "nodeRemovalHook.onNodeRemoved": {
73000
+ capName: "node-removal-hook",
73001
+ capScope: "system",
73002
+ addonId: null,
73003
+ access: "create",
73004
+ role: "admin"
73005
+ },
71547
73006
  "nodes.clusterAddonStatus": {
71548
73007
  capName: "nodes",
71549
73008
  capScope: "system",
@@ -72181,6 +73640,48 @@ Object.freeze({
72181
73640
  access: "create",
72182
73641
  role: "viewer"
72183
73642
  },
73643
+ "petFountain.getStatus": {
73644
+ capName: "pet-fountain",
73645
+ capScope: "device",
73646
+ addonId: null,
73647
+ access: "view",
73648
+ role: "viewer"
73649
+ },
73650
+ "petFountain.resetDailyConsumption": {
73651
+ capName: "pet-fountain",
73652
+ capScope: "device",
73653
+ addonId: null,
73654
+ access: "delete",
73655
+ role: "viewer"
73656
+ },
73657
+ "petFountain.setPump": {
73658
+ capName: "pet-fountain",
73659
+ capScope: "device",
73660
+ addonId: null,
73661
+ access: "create",
73662
+ role: "viewer"
73663
+ },
73664
+ "petFountain.setPumpInterval": {
73665
+ capName: "pet-fountain",
73666
+ capScope: "device",
73667
+ addonId: null,
73668
+ access: "create",
73669
+ role: "viewer"
73670
+ },
73671
+ "petFountain.setPumpOffMinutes": {
73672
+ capName: "pet-fountain",
73673
+ capScope: "device",
73674
+ addonId: null,
73675
+ access: "create",
73676
+ role: "viewer"
73677
+ },
73678
+ "petFountain.setPumpOnMinutes": {
73679
+ capName: "pet-fountain",
73680
+ capScope: "device",
73681
+ addonId: null,
73682
+ access: "create",
73683
+ role: "viewer"
73684
+ },
72184
73685
  "pipelineAnalytics.addRetrainFrameFromRecording": {
72185
73686
  capName: "pipeline-analytics",
72186
73687
  capScope: "device",
@@ -74435,6 +75936,41 @@ Object.freeze({
74435
75936
  access: "create",
74436
75937
  role: "admin"
74437
75938
  },
75939
+ "remote.getConfig": {
75940
+ capName: "remote",
75941
+ capScope: "system",
75942
+ addonId: null,
75943
+ access: "view",
75944
+ role: "admin"
75945
+ },
75946
+ "remote.listCommands": {
75947
+ capName: "remote",
75948
+ capScope: "system",
75949
+ addonId: null,
75950
+ access: "view",
75951
+ role: "admin"
75952
+ },
75953
+ "remote.sendCommand": {
75954
+ capName: "remote",
75955
+ capScope: "system",
75956
+ addonId: null,
75957
+ access: "create",
75958
+ role: "admin"
75959
+ },
75960
+ "remote.sendMediaCommand": {
75961
+ capName: "remote",
75962
+ capScope: "system",
75963
+ addonId: null,
75964
+ access: "create",
75965
+ role: "admin"
75966
+ },
75967
+ "remote.setConfig": {
75968
+ capName: "remote",
75969
+ capScope: "system",
75970
+ addonId: null,
75971
+ access: "create",
75972
+ role: "admin"
75973
+ },
74438
75974
  "runningState.getStatus": {
74439
75975
  capName: "running-state",
74440
75976
  capScope: "device",
@@ -75625,6 +77161,41 @@ Object.freeze({
75625
77161
  access: "view",
75626
77162
  role: "viewer"
75627
77163
  },
77164
+ "template.create": {
77165
+ capName: "template",
77166
+ capScope: "system",
77167
+ addonId: null,
77168
+ access: "create",
77169
+ role: "admin"
77170
+ },
77171
+ "template.delete": {
77172
+ capName: "template",
77173
+ capScope: "system",
77174
+ addonId: null,
77175
+ access: "delete",
77176
+ role: "admin"
77177
+ },
77178
+ "template.get": {
77179
+ capName: "template",
77180
+ capScope: "system",
77181
+ addonId: null,
77182
+ access: "view",
77183
+ role: "admin"
77184
+ },
77185
+ "template.list": {
77186
+ capName: "template",
77187
+ capScope: "system",
77188
+ addonId: null,
77189
+ access: "view",
77190
+ role: "admin"
77191
+ },
77192
+ "template.update": {
77193
+ capName: "template",
77194
+ capScope: "system",
77195
+ addonId: null,
77196
+ access: "create",
77197
+ role: "admin"
77198
+ },
75628
77199
  "terminalSession.adoptLegacyMonitor": {
75629
77200
  capName: "terminal-session",
75630
77201
  capScope: "system",
@@ -76806,7 +78377,7 @@ var ACTUATOR_CAP_VOCABULARY = {
76806
78377
  label: t("Full brightness", "Luminosità massima"),
76807
78378
  phrase: t("Set {device} to full brightness", "Porta {device} alla massima luminosità"),
76808
78379
  icon: "sun",
76809
- args: { percentage: 100 }
78380
+ args: { level: 100 }
76810
78381
  },
76811
78382
  {
76812
78383
  id: "brightness.half",
@@ -76814,7 +78385,7 @@ var ACTUATOR_CAP_VOCABULARY = {
76814
78385
  label: t("Half brightness", "Luminosità a metà"),
76815
78386
  phrase: t("Dim {device} to half", "Abbassa {device} a metà luminosità"),
76816
78387
  icon: "sun-dim",
76817
- args: { percentage: 50 }
78388
+ args: { level: 50 }
76818
78389
  },
76819
78390
  {
76820
78391
  id: "brightness.off",
@@ -76822,16 +78393,16 @@ var ACTUATOR_CAP_VOCABULARY = {
76822
78393
  label: t("Brightness off", "Luminosità a zero"),
76823
78394
  phrase: t("Dim {device} to zero", "Abbassa {device} a zero"),
76824
78395
  icon: "lightbulb-off",
76825
- args: { percentage: 0 }
78396
+ args: { level: 0 }
76826
78397
  },
76827
78398
  {
76828
78399
  id: "brightness.set",
76829
78400
  method: "setBrightness",
76830
78401
  label: t("Set brightness", "Imposta la luminosità"),
76831
- phrase: t("Set the brightness of {device} to {percentage}", "Imposta la luminosità di {device} a {percentage}"),
78402
+ phrase: t("Set the brightness of {device} to {level}", "Imposta la luminosità di {device} a {level}"),
76832
78403
  icon: "sun-medium",
76833
78404
  openArgs: [{
76834
- key: "percentage",
78405
+ key: "level",
76835
78406
  label: PERCENT,
76836
78407
  offer: {
76837
78408
  kind: "number",
@@ -76845,13 +78416,13 @@ var ACTUATOR_CAP_VOCABULARY = {
76845
78416
  ],
76846
78417
  state: [{
76847
78418
  kind: "numeric",
76848
- field: "percentage",
78419
+ field: "level",
76849
78420
  quantity: t("the brightness", "la luminosità"),
76850
78421
  label: t("Brightness", "Luminosità"),
76851
78422
  unit: "%",
76852
78423
  icon: "sun"
76853
78424
  }],
76854
- events: { onBrightnessChanged: { notOperatorFacing: "the `percentage` state trigger reads the same change" } }
78425
+ events: { onBrightnessChanged: { notOperatorFacing: "the `level` state trigger reads the same change" } }
76855
78426
  },
76856
78427
  color: {
76857
78428
  scope: "device",
@@ -76865,7 +78436,7 @@ var ACTUATOR_CAP_VOCABULARY = {
76865
78436
  icon: "sun",
76866
78437
  args: { color: {
76867
78438
  mode: "mired",
76868
- mireds: 370
78439
+ colorTemperature: 370
76869
78440
  } }
76870
78441
  },
76871
78442
  {
@@ -76876,7 +78447,7 @@ var ACTUATOR_CAP_VOCABULARY = {
76876
78447
  icon: "snowflake",
76877
78448
  args: { color: {
76878
78449
  mode: "mired",
76879
- mireds: 200
78450
+ colorTemperature: 200
76880
78451
  } }
76881
78452
  },
76882
78453
  {
@@ -77490,7 +79061,7 @@ var ACTUATOR_CAP_VOCABULARY = {
77490
79061
  label: t("Fan off", "Ventilatore spento"),
77491
79062
  phrase: t("Stop {device}", "Ferma {device}"),
77492
79063
  icon: "power-off",
77493
- args: { percentage: 0 }
79064
+ args: { speed: 0 }
77494
79065
  },
77495
79066
  {
77496
79067
  id: "fan.full",
@@ -77498,16 +79069,16 @@ var ACTUATOR_CAP_VOCABULARY = {
77498
79069
  label: t("Fan full", "Ventilatore al massimo"),
77499
79070
  phrase: t("Run {device} at full speed", "Porta {device} alla massima velocità"),
77500
79071
  icon: "fan",
77501
- args: { percentage: 100 }
79072
+ args: { speed: 100 }
77502
79073
  },
77503
79074
  {
77504
79075
  id: "fan.speed",
77505
79076
  method: "setPercentage",
77506
79077
  label: t("Set speed", "Imposta la velocità"),
77507
- phrase: t("Set the speed of {device} to {percentage}", "Imposta la velocità di {device} al {percentage}"),
79078
+ phrase: t("Set the speed of {device} to {speed}", "Imposta la velocità di {device} al {speed}"),
77508
79079
  icon: "fan",
77509
79080
  openArgs: [{
77510
- key: "percentage",
79081
+ key: "speed",
77511
79082
  label: t("Speed", "Velocità"),
77512
79083
  offer: {
77513
79084
  kind: "number",
@@ -77569,7 +79140,7 @@ var ACTUATOR_CAP_VOCABULARY = {
77569
79140
  ],
77570
79141
  state: [{
77571
79142
  kind: "numeric",
77572
- field: "percentage",
79143
+ field: "speed",
77573
79144
  quantity: t("the speed", "la velocità"),
77574
79145
  label: t("Speed", "Velocità"),
77575
79146
  unit: "%",
@@ -77935,6 +79506,11 @@ var ACTUATOR_CAP_VOCABULARY = {
77935
79506
  icon: "circle-dot"
77936
79507
  }]
77937
79508
  },
79509
+ "ir-transmitter": {
79510
+ scope: "device",
79511
+ noun: t("IR / RF transmitter", "Trasmettitore IR / RF"),
79512
+ notOperatorFacing: { send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it" }
79513
+ },
77938
79514
  control: {
77939
79515
  scope: "device",
77940
79516
  noun: t("Control", "Controllo"),
@@ -78367,7 +79943,7 @@ var APPLIANCE_CAP_VOCABULARY = {
78367
79943
  },
78368
79944
  {
78369
79945
  kind: "numeric",
78370
- field: "progressPercent",
79946
+ field: "progress",
78371
79947
  quantity: t("the cycle progress", "l’avanzamento del lavaggio"),
78372
79948
  label: t("Progress", "Avanzamento"),
78373
79949
  unit: "%",
@@ -78588,6 +80164,100 @@ var APPLIANCE_CAP_VOCABULARY = {
78588
80164
  }
78589
80165
  ]
78590
80166
  },
80167
+ "pet-fountain": {
80168
+ scope: "device",
80169
+ noun: t("Pet fountain", "Fontana per animali"),
80170
+ actions: [
80171
+ {
80172
+ id: "petFountain.pumpOn",
80173
+ method: "setPump",
80174
+ label: t("Pump on", "Pompa accesa"),
80175
+ phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
80176
+ icon: "play",
80177
+ args: { on: true }
80178
+ },
80179
+ {
80180
+ id: "petFountain.pumpOff",
80181
+ method: "setPump",
80182
+ label: t("Pump off", "Pompa spenta"),
80183
+ phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
80184
+ icon: "square",
80185
+ args: { on: false }
80186
+ },
80187
+ {
80188
+ id: "petFountain.intervalOn",
80189
+ method: "setPumpInterval",
80190
+ label: t("Pump cycle on", "Ciclo pompa attivo"),
80191
+ phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
80192
+ icon: "timer",
80193
+ args: { on: true }
80194
+ },
80195
+ {
80196
+ id: "petFountain.intervalOff",
80197
+ method: "setPumpInterval",
80198
+ label: t("Pump cycle off", "Ciclo pompa spento"),
80199
+ phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
80200
+ icon: "timer-off",
80201
+ args: { on: false }
80202
+ },
80203
+ {
80204
+ id: "petFountain.pumpOnMinutes",
80205
+ method: "setPumpOnMinutes",
80206
+ label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
80207
+ phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
80208
+ icon: "timer",
80209
+ openArgs: [{
80210
+ key: "minutes",
80211
+ label: t("Minutes", "Minuti"),
80212
+ offer: {
80213
+ kind: "number",
80214
+ min: 0,
80215
+ step: 1,
80216
+ unit: "min"
80217
+ }
80218
+ }]
80219
+ },
80220
+ {
80221
+ id: "petFountain.pumpOffMinutes",
80222
+ method: "setPumpOffMinutes",
80223
+ label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
80224
+ phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
80225
+ icon: "timer-off",
80226
+ openArgs: [{
80227
+ key: "minutes",
80228
+ label: t("Minutes", "Minuti"),
80229
+ offer: {
80230
+ kind: "number",
80231
+ min: 0,
80232
+ step: 1,
80233
+ unit: "min"
80234
+ }
80235
+ }]
80236
+ },
80237
+ {
80238
+ id: "petFountain.resetDailyConsumption",
80239
+ method: "resetDailyConsumption",
80240
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
80241
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
80242
+ icon: "rotate-ccw"
80243
+ }
80244
+ ],
80245
+ state: [{
80246
+ kind: "boolean",
80247
+ field: "empty",
80248
+ label: t("Tank empty", "Serbatoio vuoto"),
80249
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
80250
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
80251
+ icon: "droplet"
80252
+ }, {
80253
+ kind: "numeric",
80254
+ field: "waterLevel",
80255
+ quantity: t("the water level", "il livello dell’acqua"),
80256
+ label: t("Water level", "Livello dell’acqua"),
80257
+ unit: "%",
80258
+ icon: "droplets"
80259
+ }]
80260
+ },
78591
80261
  "media-player": {
78592
80262
  scope: "device",
78593
80263
  noun: t("Media player", "Lettore multimediale"),
@@ -78725,10 +80395,10 @@ var APPLIANCE_CAP_VOCABULARY = {
78725
80395
  id: "media.seek",
78726
80396
  method: "seek",
78727
80397
  label: t("Seek", "Vai al punto"),
78728
- phrase: t("Move {device} to {positionMs}", "Porta {device} al punto {positionMs}"),
80398
+ phrase: t("Move {device} to {position}", "Porta {device} al punto {position}"),
78729
80399
  icon: "fast-forward",
78730
80400
  openArgs: [{
78731
- key: "positionMs",
80401
+ key: "position",
78732
80402
  label: t("Position", "Posizione"),
78733
80403
  offer: {
78734
80404
  kind: "number",
@@ -79777,7 +81447,7 @@ var SENSOR_CAP_VOCABULARY = {
79777
81447
  state: [
79778
81448
  {
79779
81449
  kind: "numeric",
79780
- field: "co2Ppm",
81450
+ field: "co2",
79781
81451
  quantity: t("the CO₂", "la CO₂"),
79782
81452
  label: t("CO₂", "CO₂"),
79783
81453
  unit: "ppm",
@@ -79785,7 +81455,7 @@ var SENSOR_CAP_VOCABULARY = {
79785
81455
  },
79786
81456
  {
79787
81457
  kind: "numeric",
79788
- field: "vocPpb",
81458
+ field: "voc",
79789
81459
  quantity: t("the VOC level", "il livello di COV"),
79790
81460
  label: t("VOC", "COV"),
79791
81461
  unit: "ppb",
@@ -79821,7 +81491,7 @@ var SENSOR_CAP_VOCABULARY = {
79821
81491
  noun: t("Light level", "Luminosità ambiente"),
79822
81492
  state: [{
79823
81493
  kind: "numeric",
79824
- field: "lux",
81494
+ field: "illuminance",
79825
81495
  quantity: t("the light level", "la luminosità"),
79826
81496
  label: t("Illuminance", "Illuminamento"),
79827
81497
  unit: "lx",
@@ -80024,7 +81694,7 @@ var SENSOR_CAP_VOCABULARY = {
80024
81694
  noun: t("Humidity", "Umidità"),
80025
81695
  state: [{
80026
81696
  kind: "numeric",
80027
- field: "percent",
81697
+ field: "humidity",
80028
81698
  quantity: t("the humidity", "l’umidità"),
80029
81699
  label: t("Humidity", "Umidità"),
80030
81700
  unit: "%",
@@ -80072,7 +81742,7 @@ var SENSOR_CAP_VOCABULARY = {
80072
81742
  state: [
80073
81743
  {
80074
81744
  kind: "numeric",
80075
- field: "watts",
81745
+ field: "power",
80076
81746
  quantity: t("the power draw", "il consumo"),
80077
81747
  label: t("Power", "Potenza"),
80078
81748
  unit: "W",
@@ -80080,7 +81750,7 @@ var SENSOR_CAP_VOCABULARY = {
80080
81750
  },
80081
81751
  {
80082
81752
  kind: "numeric",
80083
- field: "kwhTotal",
81753
+ field: "energy",
80084
81754
  quantity: t("the energy used", "l’energia consumata"),
80085
81755
  label: t("Energy", "Energia"),
80086
81756
  unit: "kWh",
@@ -80088,7 +81758,7 @@ var SENSOR_CAP_VOCABULARY = {
80088
81758
  },
80089
81759
  {
80090
81760
  kind: "numeric",
80091
- field: "volts",
81761
+ field: "voltage",
80092
81762
  quantity: t("the voltage", "la tensione"),
80093
81763
  label: t("Voltage", "Tensione"),
80094
81764
  unit: "V",
@@ -80096,7 +81766,7 @@ var SENSOR_CAP_VOCABULARY = {
80096
81766
  },
80097
81767
  {
80098
81768
  kind: "numeric",
80099
- field: "amps",
81769
+ field: "current",
80100
81770
  quantity: t("the current", "la corrente"),
80101
81771
  label: t("Current", "Corrente"),
80102
81772
  unit: "A",
@@ -80113,13 +81783,6 @@ var SENSOR_CAP_VOCABULARY = {
80113
81783
  label: t("Where", "Posizione"),
80114
81784
  phrase: t("When {device} is at {value}", "Quando {device} è in {value}"),
80115
81785
  icon: "map-pin"
80116
- }, {
80117
- kind: "numeric",
80118
- field: "batteryPercent",
80119
- quantity: t("the phone battery", "la batteria del telefono"),
80120
- label: t("Battery", "Batteria"),
80121
- unit: "%",
80122
- icon: "battery"
80123
81786
  }]
80124
81787
  },
80125
81788
  "pressure-sensor": {
@@ -80127,7 +81790,7 @@ var SENSOR_CAP_VOCABULARY = {
80127
81790
  noun: t("Pressure", "Pressione"),
80128
81791
  state: [{
80129
81792
  kind: "numeric",
80130
- field: "hpa",
81793
+ field: "pressure",
80131
81794
  quantity: t("the pressure", "la pressione"),
80132
81795
  label: t("Pressure", "Pressione"),
80133
81796
  unit: "hPa",
@@ -80163,7 +81826,7 @@ var SENSOR_CAP_VOCABULARY = {
80163
81826
  noun: t("Temperature", "Temperatura"),
80164
81827
  state: [{
80165
81828
  kind: "numeric",
80166
- field: "celsius",
81829
+ field: "temperature",
80167
81830
  quantity: t("the temperature", "la temperatura"),
80168
81831
  label: t("Temperature", "Temperatura"),
80169
81832
  unit: "°C",
@@ -80234,7 +81897,7 @@ var SENSOR_CAP_VOCABULARY = {
80234
81897
  state: [
80235
81898
  {
80236
81899
  kind: "numeric",
80237
- field: "percentage",
81900
+ field: "level",
80238
81901
  quantity: t("the battery level", "il livello della batteria"),
80239
81902
  label: t("Battery", "Batteria"),
80240
81903
  unit: "%",
@@ -80276,7 +81939,7 @@ var SENSOR_CAP_VOCABULARY = {
80276
81939
  icon: "battery-charging"
80277
81940
  }
80278
81941
  ],
80279
- events: { onStatusChanged: { notOperatorFacing: "the percentage / sleeping / charging state triggers each read one field of this change" } },
81942
+ events: { onStatusChanged: { notOperatorFacing: "the level / sleeping / charging state triggers each read one field of this change" } },
80280
81943
  extraEvents: [{
80281
81944
  category: EventCategory.DeviceAwake,
80282
81945
  label: t("Woke up", "Risvegliato"),
@@ -80294,7 +81957,7 @@ var SENSOR_CAP_VOCABULARY = {
80294
81957
  noun: t("Network link", "Collegamento di rete"),
80295
81958
  state: [{
80296
81959
  kind: "numeric",
80297
- field: "signalPercent",
81960
+ field: "signal",
80298
81961
  quantity: t("the signal strength", "l’intensità del segnale"),
80299
81962
  label: t("Signal", "Segnale"),
80300
81963
  unit: "%",
@@ -80387,6 +82050,8 @@ var ML = "model and training machinery — no device action";
80387
82050
  var INTERNAL = "internal plumbing between addons — never operator-facing";
80388
82051
  /** Every system-scoped cap, with why it is not a device's vocabulary. */
80389
82052
  var SYSTEM_CAP_VOCABULARY = {
82053
+ "action-source": system(INTERNAL),
82054
+ actions: system("declared actions — run from the Actions page and from the cameras that link them"),
80390
82055
  "addon-pages": system(UI_PLUMBING),
80391
82056
  "addon-pages-source": system(UI_PLUMBING),
80392
82057
  "addon-routes": system(UI_PLUMBING),
@@ -80417,6 +82082,7 @@ var SYSTEM_CAP_VOCABULARY = {
80417
82082
  "device-manager": system("the device registry itself — rename, move and remove are administration"),
80418
82083
  "device-provider": system(INTERNAL),
80419
82084
  "device-removal-hook": system(INTERNAL),
82085
+ "node-removal-hook": system(INTERNAL),
80420
82086
  "device-state": system("the runtime-state mirror every trigger already reads through"),
80421
82087
  "display-palette": system("the cluster display palette — one colour table for every client, not a device action"),
80422
82088
  "embedding-encoder": system(ML),
@@ -80456,6 +82122,7 @@ var SYSTEM_CAP_VOCABULARY = {
80456
82122
  "recording-archive": system(STORAGE),
80457
82123
  "recording-export": system("recording exports — requested from the timeline, not an automation step"),
80458
82124
  records: system(INTERNAL),
82125
+ remote: system("the per-device remote setup — authored in the Customize remote editor, sent through the remote UI"),
80459
82126
  "server-management": system(CLUSTER),
80460
82127
  "settings-store": system(INTERNAL),
80461
82128
  "smtp-provider": system(INTERNAL),
@@ -80468,6 +82135,7 @@ var SYSTEM_CAP_VOCABULARY = {
80468
82135
  "storage-provider": system(STORAGE),
80469
82136
  "stream-broker": system(PIPELINE),
80470
82137
  system: system(CLUSTER),
82138
+ template: system("operator-authored templates — edited in their own editor, never actuated"),
80471
82139
  "terminal-session": system(CLUSTER),
80472
82140
  toast: system(UI_PLUMBING),
80473
82141
  training: system(ML),
@@ -80527,7 +82195,7 @@ function projectAction(cap, action) {
80527
82195
  };
80528
82196
  }
80529
82197
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
80530
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
82198
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
80531
82199
  DeviceFeature.BatteryOperated;
80532
82200
  /**
80533
82201
  * How a washer, dryer or dishwasher leaves CamStack.
@@ -80608,6 +82276,31 @@ Object.freeze({
80608
82276
  form: "single",
80609
82277
  optional: false
80610
82278
  }],
82279
+ "actions.get": [{
82280
+ name: "deviceId",
82281
+ form: "single",
82282
+ optional: true
82283
+ }],
82284
+ "actions.getLinks": [{
82285
+ name: "deviceId",
82286
+ form: "single",
82287
+ optional: false
82288
+ }],
82289
+ "actions.listForCamera": [{
82290
+ name: "deviceId",
82291
+ form: "single",
82292
+ optional: false
82293
+ }],
82294
+ "actions.run": [{
82295
+ name: "deviceId",
82296
+ form: "single",
82297
+ optional: true
82298
+ }],
82299
+ "actions.setLinks": [{
82300
+ name: "deviceId",
82301
+ form: "single",
82302
+ optional: false
82303
+ }],
80611
82304
  "addonSettings.getDeviceSettings": [{
80612
82305
  name: "deviceId",
80613
82306
  form: "single",
@@ -81659,6 +83352,16 @@ Object.freeze({
81659
83352
  form: "single",
81660
83353
  optional: false
81661
83354
  }],
83355
+ "irTransmitter.getInfo": [{
83356
+ name: "deviceId",
83357
+ form: "single",
83358
+ optional: false
83359
+ }],
83360
+ "irTransmitter.send": [{
83361
+ name: "deviceId",
83362
+ form: "single",
83363
+ optional: false
83364
+ }],
81662
83365
  "keychain.deleteDeviceScope": [{
81663
83366
  name: "deviceId",
81664
83367
  form: "single",
@@ -82068,6 +83771,36 @@ Object.freeze({
82068
83771
  form: "single",
82069
83772
  optional: false
82070
83773
  }],
83774
+ "petFountain.getStatus": [{
83775
+ name: "deviceId",
83776
+ form: "single",
83777
+ optional: false
83778
+ }],
83779
+ "petFountain.resetDailyConsumption": [{
83780
+ name: "deviceId",
83781
+ form: "single",
83782
+ optional: false
83783
+ }],
83784
+ "petFountain.setPump": [{
83785
+ name: "deviceId",
83786
+ form: "single",
83787
+ optional: false
83788
+ }],
83789
+ "petFountain.setPumpInterval": [{
83790
+ name: "deviceId",
83791
+ form: "single",
83792
+ optional: false
83793
+ }],
83794
+ "petFountain.setPumpOffMinutes": [{
83795
+ name: "deviceId",
83796
+ form: "single",
83797
+ optional: false
83798
+ }],
83799
+ "petFountain.setPumpOnMinutes": [{
83800
+ name: "deviceId",
83801
+ form: "single",
83802
+ optional: false
83803
+ }],
82071
83804
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
82072
83805
  name: "deviceId",
82073
83806
  form: "single",
@@ -82884,6 +84617,31 @@ Object.freeze({
82884
84617
  form: "single",
82885
84618
  optional: true
82886
84619
  }],
84620
+ "remote.getConfig": [{
84621
+ name: "deviceId",
84622
+ form: "single",
84623
+ optional: false
84624
+ }],
84625
+ "remote.listCommands": [{
84626
+ name: "deviceId",
84627
+ form: "single",
84628
+ optional: false
84629
+ }],
84630
+ "remote.sendCommand": [{
84631
+ name: "deviceId",
84632
+ form: "single",
84633
+ optional: false
84634
+ }],
84635
+ "remote.sendMediaCommand": [{
84636
+ name: "deviceId",
84637
+ form: "single",
84638
+ optional: false
84639
+ }],
84640
+ "remote.setConfig": [{
84641
+ name: "deviceId",
84642
+ form: "single",
84643
+ optional: false
84644
+ }],
82887
84645
  "runningState.getStatus": [{
82888
84646
  name: "deviceId",
82889
84647
  form: "single",
@@ -84689,8 +86447,17 @@ DEFAULT_NATIVE_LEASE_SETTINGS.activityMs;
84689
86447
  DEFAULT_NATIVE_LEASE_SETTINGS.tileBudgetMb;
84690
86448
  DEFAULT_NATIVE_LEASE_SETTINGS.sceneBudgetMb;
84691
86449
  DEFAULT_NATIVE_LEASE_SETTINGS.admission;
86450
+ String.raw`(?<=^|["'(\s>,\[{])`;
84692
86451
  var MB = 1024 * 1024;
84693
86452
  1024 * MB, 3072 * MB;
86453
+ object({
86454
+ manufacturer: string().optional(),
86455
+ supportedModels: array(string()).optional(),
86456
+ supportedController: string().optional(),
86457
+ commandsEncoding: string(),
86458
+ delay: number().nonnegative().optional(),
86459
+ commands: record(string(), unknown())
86460
+ });
84694
86461
  process.platform, process.env["SystemRoot"];
84695
86462
  var DEFAULT_FIRST_UNIT_TIMEOUT_MS = 12e3;
84696
86463
  /** Heartbeat cadence — ~2 minutes of 4 s fragments. */
@@ -84722,7 +86489,7 @@ var Fmp4FragmentChild = class {
84722
86489
  meta: {
84723
86490
  sourceId: this.args.sourceId,
84724
86491
  decodeHwAccel: requested,
84725
- error: errMsg$16(err)
86492
+ error: errMsg$17(err)
84726
86493
  }
84727
86494
  });
84728
86495
  this.killChild();
@@ -84901,7 +86668,7 @@ var Fmp4FragmentChild = class {
84901
86668
  tags: { deviceId: this.args.deviceId },
84902
86669
  meta: {
84903
86670
  sourceId: this.args.sourceId,
84904
- error: errMsg$16(err)
86671
+ error: errMsg$17(err)
84905
86672
  }
84906
86673
  });
84907
86674
  }
@@ -131590,6 +133357,176 @@ function clearPairingFiles(accessoryUuid, logger) {
131590
133357
  } });
131591
133358
  }
131592
133359
  }
133360
+ /** Deterministic and distinct from every device accessory uuid. */
133361
+ function actionSwitchUuid(actionId) {
133362
+ return import_dist.uuid.generate(`camstack:hap:action:${actionId}`);
133363
+ }
133364
+ function buildActionSwitch(input) {
133365
+ const { actionId, displayName, run } = input;
133366
+ const autoOffMs = input.autoOffMs ?? 1e3;
133367
+ const accessory = new import_dist.Accessory(displayName, actionSwitchUuid(actionId));
133368
+ accessory.category = import_dist.Categories.SWITCH;
133369
+ const info = accessory.getService(import_dist.Service.AccessoryInformation);
133370
+ info?.setCharacteristic(import_dist.Characteristic.Manufacturer, "CamStack");
133371
+ info?.setCharacteristic(import_dist.Characteristic.Model, "Action");
133372
+ info?.setCharacteristic(import_dist.Characteristic.SerialNumber, `camstack-action-${actionId}`);
133373
+ const service = accessory.addService(import_dist.Service.Switch, displayName);
133374
+ const on = service.getCharacteristic(import_dist.Characteristic.On);
133375
+ let timer = null;
133376
+ const clearTimer = () => {
133377
+ if (timer !== null) clearTimeout(timer);
133378
+ timer = null;
133379
+ };
133380
+ on.onSet(async (value) => {
133381
+ if (value !== true) {
133382
+ clearTimer();
133383
+ return;
133384
+ }
133385
+ if (timer !== null) return;
133386
+ timer = setTimeout(() => {
133387
+ timer = null;
133388
+ service.updateCharacteristic(import_dist.Characteristic.On, false);
133389
+ }, autoOffMs);
133390
+ try {
133391
+ await run();
133392
+ } catch {}
133393
+ });
133394
+ on.onGet(() => false);
133395
+ return {
133396
+ accessory,
133397
+ accessories: [accessory],
133398
+ async dispose() {
133399
+ clearTimer();
133400
+ }
133401
+ };
133402
+ }
133403
+ //#endregion
133404
+ //#region src/action-exports.ts
133405
+ /**
133406
+ * The actions this bridge exposes (D968): the persisted selection and the
133407
+ * switch each entry is published as.
133408
+ *
133409
+ * Kept apart from the addon class so the lifecycle can be proved without a
133410
+ * HAP server: the addon supplies `publish` / `unpublish` (bridge first,
133411
+ * standalone as the fallback, exactly as for a device) and `persist` (its own
133412
+ * settings), and this class owns the rest — the lookup of the action's name,
133413
+ * the press that runs it, the refusal that is logged, the pruning of an action
133414
+ * the operator deleted.
133415
+ *
133416
+ * Actions are list entries, not devices (D954): nothing here touches the
133417
+ * device registry, and the log tag is `actionId`.
133418
+ */
133419
+ var EXPORTER = "export-hap";
133420
+ function errMsg$16(err) {
133421
+ return err instanceof Error ? err.message : String(err);
133422
+ }
133423
+ var ActionExports = class {
133424
+ ports;
133425
+ entries;
133426
+ mappers = /* @__PURE__ */ new Map();
133427
+ constructor(ports, initial) {
133428
+ this.ports = ports;
133429
+ this.entries = initial;
133430
+ }
133431
+ /** The cap's `listExposedEntities` rows for actions. */
133432
+ list() {
133433
+ return this.entries.map((e) => ({
133434
+ entity: {
133435
+ kind: "action",
133436
+ actionId: e.actionId
133437
+ },
133438
+ exposedAs: e.displayName
133439
+ }));
133440
+ }
133441
+ /** Re-publish the persisted selection (boot). One failure does not stop the rest. */
133442
+ async attachAll() {
133443
+ for (const entry of this.entries) try {
133444
+ await this.attach(entry);
133445
+ } catch (err) {
133446
+ this.ports.logger.warn("export-hap: failed to re-attach exported action on boot", {
133447
+ tags: { actionId: entry.actionId },
133448
+ meta: { error: errMsg$16(err) }
133449
+ });
133450
+ }
133451
+ }
133452
+ async expose(actionId) {
133453
+ const action = (await this.ports.api.actions.list.query({})).find((a) => a.id === actionId);
133454
+ if (action === void 0) throw new Error(`export-hap: action '${actionId}' does not exist`);
133455
+ const previous = this.entries.find((e) => e.actionId === actionId);
133456
+ const entry = {
133457
+ actionId,
133458
+ displayName: action.name,
133459
+ addedAt: previous?.addedAt ?? Date.now()
133460
+ };
133461
+ await this.detach(actionId);
133462
+ await this.attach(entry);
133463
+ await this.save([...this.entries.filter((e) => e.actionId !== actionId), entry]);
133464
+ this.ports.logger.info("export-hap: exposed action", {
133465
+ tags: { actionId },
133466
+ meta: { displayName: action.name }
133467
+ });
133468
+ }
133469
+ async unexpose(actionId) {
133470
+ await this.detach(actionId);
133471
+ if (this.entries.some((e) => e.actionId === actionId)) await this.save(this.entries.filter((e) => e.actionId !== actionId));
133472
+ this.ports.logger.info("export-hap: unexposed action", { tags: { actionId } });
133473
+ }
133474
+ /**
133475
+ * Drop what the operator deleted. An action list that could not be read
133476
+ * changes nothing (D49): a failed read must never destroy the selection.
133477
+ */
133478
+ async reconcile() {
133479
+ if (this.entries.length === 0) return;
133480
+ let live;
133481
+ try {
133482
+ const actions = await this.ports.api.actions.list.query({});
133483
+ live = new Set(actions.map((a) => a.id));
133484
+ } catch (err) {
133485
+ this.ports.logger.warn("export-hap: exported actions not reconciled — list unanswered", { meta: { error: errMsg$16(err) } });
133486
+ return;
133487
+ }
133488
+ const { dropped } = pruneDeletedEntities(this.entries.map((e) => ({
133489
+ kind: "action",
133490
+ actionId: e.actionId
133491
+ })), {
133492
+ actionIds: live,
133493
+ targetIds: /* @__PURE__ */ new Set()
133494
+ }, this.ports.logger, EXPORTER);
133495
+ if (dropped.length === 0) return;
133496
+ for (const ref of dropped) if (ref.kind === "action") await this.detach(ref.actionId);
133497
+ const gone = new Set(dropped.flatMap((r) => r.kind === "action" ? [r.actionId] : []));
133498
+ await this.save(this.entries.filter((e) => !gone.has(e.actionId)));
133499
+ }
133500
+ async dispose() {
133501
+ for (const mapper of this.mappers.values()) await mapper.dispose();
133502
+ this.mappers.clear();
133503
+ }
133504
+ async attach(entry) {
133505
+ const mapper = buildActionSwitch({
133506
+ actionId: entry.actionId,
133507
+ displayName: entry.displayName,
133508
+ run: async () => {
133509
+ await runExportedAction(this.ports.api, this.ports.logger, {
133510
+ exporter: EXPORTER,
133511
+ actionId: entry.actionId
133512
+ });
133513
+ }
133514
+ });
133515
+ for (const accessory of mapper.accessories) await this.ports.publish(accessory);
133516
+ this.mappers.set(entry.actionId, mapper);
133517
+ }
133518
+ async detach(actionId) {
133519
+ const mapper = this.mappers.get(actionId);
133520
+ if (mapper === void 0) return;
133521
+ this.mappers.delete(actionId);
133522
+ for (const accessory of mapper.accessories) await this.ports.unpublish(accessory);
133523
+ await mapper.dispose();
133524
+ }
133525
+ async save(next) {
133526
+ this.entries = next;
133527
+ await this.ports.persist(next);
133528
+ }
133529
+ };
131593
133530
  /**
131594
133531
  * Whether this device's accessory belongs on the bridge.
131595
133532
  *
@@ -133988,7 +135925,7 @@ function applyServiceLabel(service, name) {
133988
135925
  var LOW_BATTERY_THRESHOLD_PCT = 20;
133989
135926
  /**
133990
135927
  * Mapping:
133991
- * - `BatteryStatus.percentage` (0..100) → `Characteristic.BatteryLevel`
135928
+ * - `BatteryStatus.level` (0..100) → `Characteristic.BatteryLevel`
133992
135929
  * - `BatteryStatus.charging`:
133993
135930
  * `'none'` → `ChargingState.NOT_CHARGING`
133994
135931
  * `'dc' | 'solar'` → `ChargingState.CHARGING`
@@ -133996,12 +135933,12 @@ var LOW_BATTERY_THRESHOLD_PCT = 20;
133996
135933
  * either value would be a claim
133997
135934
  * - `percentage <= LOW_BATTERY_THRESHOLD_PCT` → `StatusLowBattery.LOW`
133998
135935
  */
133999
- var batteryCharacteristicUpdates = reader(BatteryStatusSchema.pick({ percentage: true }).extend({ charging: BatteryStatusSchema.shape.charging.optional() }), (status) => {
134000
- if (status.percentage === null) return status.charging === void 0 || status.charging === "unknown" ? [] : [{
135936
+ var batteryCharacteristicUpdates = reader(BatteryStatusSchema.pick({ level: true }).extend({ charging: BatteryStatusSchema.shape.charging.optional() }), (status) => {
135937
+ if (status.level === null) return status.charging === void 0 || status.charging === "unknown" ? [] : [{
134001
135938
  characteristic: import_dist.Characteristic.ChargingState,
134002
135939
  value: status.charging === "none" ? import_dist.Characteristic.ChargingState.NOT_CHARGING : import_dist.Characteristic.ChargingState.CHARGING
134003
135940
  }];
134004
- const pct = Math.max(0, Math.min(100, Math.round(status.percentage)));
135941
+ const pct = Math.max(0, Math.min(100, Math.round(status.level)));
134005
135942
  return [
134006
135943
  {
134007
135944
  characteristic: import_dist.Characteristic.BatteryLevel,
@@ -134103,7 +136040,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
134103
136040
  }
134104
136041
  if (useLightbulb) try {
134105
136042
  const status = await proxy.brightness?.getStatus({});
134106
- if (status && typeof status.percentage === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.percentage);
136043
+ if (status && typeof status.level === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, status.level);
134107
136044
  } catch (err) {
134108
136045
  log.debug("export-hap: child brightness.getStatus failed (non-fatal)", { meta: { error: errMsg$13(err) } });
134109
136046
  }
@@ -134122,7 +136059,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
134122
136059
  const percentage = typeof value === "number" ? value : Number(value);
134123
136060
  if (!Number.isFinite(percentage)) return;
134124
136061
  try {
134125
- await proxy.brightness?.setBrightness({ percentage });
136062
+ await proxy.brightness?.setBrightness({ level: percentage });
134126
136063
  } catch (err) {
134127
136064
  log.warn("export-hap: child brightness.setBrightness failed", { meta: {
134128
136065
  percentage,
@@ -134139,7 +136076,7 @@ async function buildChildSwitch(bctx, subtype, deviceType) {
134139
136076
  }
134140
136077
  if (useLightbulb && proxy.state.brightness) {
134141
136078
  const unsubBrightness = proxy.state.brightness.subscribe((value) => {
134142
- if (value && typeof value.percentage === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, value.percentage);
136079
+ if (value && typeof value.level === "number") service.updateCharacteristic(import_dist.Characteristic.Brightness, value.level);
134143
136080
  });
134144
136081
  unsubscribes.push(unsubBrightness);
134145
136082
  }
@@ -134685,9 +136622,9 @@ var SENSOR_SPECS = {
134685
136622
  addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.TemperatureSensor, name, subtype),
134686
136623
  getStatus: (proxy) => proxy.temperatureSensor?.getStatus({}),
134687
136624
  subscribe: (proxy, onValue) => proxy.state.temperatureSensor?.subscribe(onValue) ?? null,
134688
- read: reader(TemperatureSensorStatusSchema.pick({ celsius: true }), (status) => status.celsius === null ? [] : [{
136625
+ read: reader(TemperatureSensorStatusSchema.pick({ temperature: true }), (status) => status.temperature === null ? [] : [{
134689
136626
  characteristic: import_dist.Characteristic.CurrentTemperature,
134690
- value: status.celsius
136627
+ value: status.temperature
134691
136628
  }])
134692
136629
  },
134693
136630
  "humidity-sensor": {
@@ -134695,9 +136632,9 @@ var SENSOR_SPECS = {
134695
136632
  addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.HumiditySensor, name, subtype),
134696
136633
  getStatus: (proxy) => proxy.humiditySensor?.getStatus({}),
134697
136634
  subscribe: (proxy, onValue) => proxy.state.humiditySensor?.subscribe(onValue) ?? null,
134698
- read: reader(HumiditySensorStatusSchema.pick({ percent: true }), (status) => status.percent === null ? [] : [{
136635
+ read: reader(HumiditySensorStatusSchema.pick({ humidity: true }), (status) => status.humidity === null ? [] : [{
134699
136636
  characteristic: import_dist.Characteristic.CurrentRelativeHumidity,
134700
- value: status.percent
136637
+ value: status.humidity
134701
136638
  }])
134702
136639
  },
134703
136640
  "ambient-light-sensor": {
@@ -134705,9 +136642,9 @@ var SENSOR_SPECS = {
134705
136642
  addService: (accessory, name, subtype) => accessory.addService(import_dist.Service.LightSensor, name, subtype),
134706
136643
  getStatus: (proxy) => proxy.ambientLightSensor?.getStatus({}),
134707
136644
  subscribe: (proxy, onValue) => proxy.state.ambientLightSensor?.subscribe(onValue) ?? null,
134708
- read: reader(AmbientLightSensorStatusSchema.pick({ lux: true }), (status) => status.lux === null ? [] : [{
136645
+ read: reader(AmbientLightSensorStatusSchema.pick({ illuminance: true }), (status) => status.illuminance === null ? [] : [{
134709
136646
  characteristic: import_dist.Characteristic.CurrentAmbientLightLevel,
134710
- value: Math.max(MIN_LUX, status.lux)
136647
+ value: Math.max(MIN_LUX, status.illuminance)
134711
136648
  }])
134712
136649
  }
134713
136650
  };
@@ -151090,6 +153027,7 @@ var DEFAULT_CONFIG = {
151090
153027
  uuid: ""
151091
153028
  },
151092
153029
  exposed: [],
153030
+ exposedActions: [],
151093
153031
  exportSyncState: {}
151094
153032
  };
151095
153033
  var BANNED_PINCODES = new Set([
@@ -151131,6 +153069,8 @@ var ExportHapAddon = class extends BaseAddon {
151131
153069
  /** The bridge setup code pairs a controller: a credential, kept in the keychain (D787). */
151132
153070
  secretStatePaths = ["identity.pincode"];
151133
153071
  exposed = /* @__PURE__ */ new Map();
153072
+ /** The exported actions — switches beside the devices (D968). */
153073
+ actionExports = null;
151134
153074
  lastError;
151135
153075
  /** Shared HAP setup code applied to every published accessory. */
151136
153076
  pincode = "";
@@ -151243,7 +153183,31 @@ var ExportHapAddon = class extends BaseAddon {
151243
153183
  log.warn("export-hap: failed to re-attach mapper on boot", { meta: { error: errMsg(err) } });
151244
153184
  }
151245
153185
  }
153186
+ this.actionExports = new ActionExports({
153187
+ api: this.ctx.api,
153188
+ logger: this.ctx.logger,
153189
+ publish: async (accessory) => {
153190
+ if (this.bridgeHost !== null && await this.bridgeHost.add(accessory)) return;
153191
+ await publishStandalone(accessory, {
153192
+ pincode: this.pincode,
153193
+ port: 0,
153194
+ bind: this.bind,
153195
+ logger: this.ctx.logger
153196
+ });
153197
+ },
153198
+ unpublish: async (accessory) => {
153199
+ if (this.bridgeHost?.holds(accessory) === true) {
153200
+ this.bridgeHost.remove(accessory);
153201
+ return;
153202
+ }
153203
+ await unpublishAccessory(accessory, this.ctx.logger);
153204
+ },
153205
+ persist: (entries) => this.updateGlobalSettings({ exposedActions: [...entries] })
153206
+ }, this.config.exposedActions ?? []);
153207
+ await this.actionExports.attachAll();
153208
+ await this.actionExports.reconcile();
151246
153209
  this.ctx.addDisposer(async () => {
153210
+ await this.actionExports?.dispose();
151247
153211
  await this.detachAll();
151248
153212
  await this.bridgeHost?.dispose();
151249
153213
  });
@@ -151274,6 +153238,27 @@ var ExportHapAddon = class extends BaseAddon {
151274
153238
  }),
151275
153239
  exposeDevice: async ({ deviceId, capabilities }) => this.exposeDevice(deviceId, capabilities),
151276
153240
  unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
153241
+ listSupportedEntityKinds: async () => ["device", "action"],
153242
+ listExposedEntities: async () => {
153243
+ await this.actionExports?.reconcile();
153244
+ return [...Array.from(this.exposed.entries()).map(([deviceId, m]) => ({
153245
+ entity: {
153246
+ kind: "device",
153247
+ deviceId
153248
+ },
153249
+ exposedAs: m.accessory.displayName
153250
+ })), ...this.actionExports?.list() ?? []];
153251
+ },
153252
+ exposeEntity: async ({ entity }) => {
153253
+ if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
153254
+ if (entity.kind === "action") return this.requireActionExports().expose(entity.actionId);
153255
+ throw new Error("export-hap: a notification target cannot be exported to HomeKit");
153256
+ },
153257
+ unexposeEntity: async ({ entity }) => {
153258
+ if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
153259
+ if (entity.kind === "action") return this.requireActionExports().unexpose(entity.actionId);
153260
+ throw new Error("export-hap: a notification target cannot be exported to HomeKit");
153261
+ },
151277
153262
  getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(input.deviceId),
151278
153263
  getDeviceLiveContribution: async () => null,
151279
153264
  applyDeviceSettingsPatch: (input) => this.applyDeviceSettingsPatch(input.deviceId, input.patch)
@@ -151479,6 +153464,10 @@ var ExportHapAddon = class extends BaseAddon {
151479
153464
  this.ctx.logger.withTags({ deviceId: Number.parseInt(deviceId, 10) }).warn("export-hap: mapper dispose failed", { meta: { error: errMsg(err) } });
151480
153465
  });
151481
153466
  }
153467
+ requireActionExports() {
153468
+ if (this.actionExports === null) throw new Error("export-hap: addon is not initialised");
153469
+ return this.actionExports;
153470
+ }
151482
153471
  async detachAll() {
151483
153472
  const ids = Array.from(this.exposed.keys());
151484
153473
  for (const id of ids) await this.detachMapper(id);