@camstack/addon-export-alexa 1.2.173 → 1.2.175

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.
@@ -5103,6 +5103,14 @@ function object(shape, params) {
5103
5103
  ...normalizeParams(params)
5104
5104
  });
5105
5105
  }
5106
+ function strictObject(shape, params) {
5107
+ return new ZodObject({
5108
+ type: "object",
5109
+ shape,
5110
+ catchall: never(),
5111
+ ...normalizeParams(params)
5112
+ });
5113
+ }
5106
5114
  function looseObject(shape, params) {
5107
5115
  return new ZodObject({
5108
5116
  type: "object",
@@ -5482,7 +5490,7 @@ var ZodIssueCode = {
5482
5490
  var ZodFirstPartyTypeKind;
5483
5491
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5484
5492
  //#endregion
5485
- //#region ../types/dist/sleep-Crlmu_tO.mjs
5493
+ //#region ../types/dist/sleep-6eG9C8Xl.mjs
5486
5494
  /**
5487
5495
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5488
5496
  * window to float samples (D455).
@@ -8458,6 +8466,52 @@ function optionalMethod(input, output, options) {
8458
8466
  providerOptional: true
8459
8467
  };
8460
8468
  }
8469
+ /**
8470
+ * `addon-pages-source` — collection cap exposing per-provider raw page
8471
+ * declarations. Every addon that contributes a UI page registers a
8472
+ * provider here. The hub-side singleton aggregator (`addon-pages` cap,
8473
+ * see `addon-pages.cap.ts`) walks this collection, stamps versioned
8474
+ * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
8475
+ * that admin-ui consumes.
8476
+ *
8477
+ * The split exists because the public listing has a different output
8478
+ * shape than the per-provider raw declarations, and we want both ends
8479
+ * to flow through codegen instead of relying on a hand-written wrapper.
8480
+ */
8481
+ var AddonPageDeclarationSchema = object({
8482
+ id: string(),
8483
+ label: string(),
8484
+ icon: string(),
8485
+ path: string(),
8486
+ /**
8487
+ * Module Federation remote name — must match the `name` field on the
8488
+ * page addon's `federation()` plugin config. Used by admin-ui's
8489
+ * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
8490
+ * Conventionally `addon_<id>_page` (snake_case; MF names cannot
8491
+ * contain hyphens).
8492
+ */
8493
+ remoteName: string(),
8494
+ /**
8495
+ * Bundle filename inside the addon's `dist/` dir served at
8496
+ * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
8497
+ * is always `'remoteEntry.js'`; the value is kept on the metadata so
8498
+ * the static-file route can compute an mtime-based cache-buster URL
8499
+ * without a separate filesystem stat.
8500
+ */
8501
+ bundle: string(),
8502
+ /**
8503
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
8504
+ * `'cluster'`, `'administration'` — the page renders inside that group.
8505
+ * Any OTHER string creates (or joins) a custom section rendered after
8506
+ * the built-in groups; its label comes from `sectionLabel` (first
8507
+ * declaration wins), falling back to the id. Absent → the legacy
8508
+ * "Addon Pages" group.
8509
+ */
8510
+ section: string().optional(),
8511
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
8512
+ sectionLabel: string().optional()
8513
+ });
8514
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
8461
8515
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
8462
8516
  var VersionOutputSchema$1 = object({ version: string() });
8463
8517
  method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
@@ -8483,6 +8537,27 @@ function customAction(input, output, options) {
8483
8537
  ...options?.caller ? { caller: "required" } : {}
8484
8538
  };
8485
8539
  }
8540
+ /**
8541
+ * The pipeline step-input shape and the run-result bridge, in a module that
8542
+ * imports nothing but zod and types.
8543
+ *
8544
+ * WHY A SEPARATE FILE (addon footprint, D28): both were declared in
8545
+ * `pipeline-executor.cap.ts`, whose import evaluates the whole executor schema
8546
+ * graph. An addon that only needs these two (the benchmark's `runPipelineTest`
8547
+ * action) paid ~130 MB of heap at load. `pipeline-executor.cap.ts` re-exports
8548
+ * them, so every existing import keeps working; addon server code takes them
8549
+ * from `@camstack/types/addon`.
8550
+ */
8551
+ var PipelineStepInputSchema = lazy(() => object({
8552
+ addonId: string(),
8553
+ modelId: string().optional(),
8554
+ enabled: boolean().default(true),
8555
+ children: array(PipelineStepInputSchema).optional(),
8556
+ settings: record(string(), unknown()).optional(),
8557
+ jumpDeviceKey: string().optional()
8558
+ }));
8559
+ /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
8560
+ var PipelineRunResultBridge = custom();
8486
8561
  var StaticDirOutputSchema = object({ staticDir: string() });
8487
8562
  var VersionOutputSchema = object({ version: string() });
8488
8563
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
@@ -8638,6 +8713,7 @@ var CAP_NAMES = Object.freeze([
8638
8713
  "image-settings",
8639
8714
  "integrations",
8640
8715
  "intercom",
8716
+ "ir-transmitter",
8641
8717
  "keychain",
8642
8718
  "keychain-admin",
8643
8719
  "lawn-mower-control",
@@ -8666,6 +8742,7 @@ var CAP_NAMES = Object.freeze([
8666
8742
  "network-link",
8667
8743
  "network-quality",
8668
8744
  "node-certificates",
8745
+ "node-removal-hook",
8669
8746
  "nodes",
8670
8747
  "notification-output",
8671
8748
  "notification-rules",
@@ -8676,6 +8753,7 @@ var CAP_NAMES = Object.freeze([
8676
8753
  "osd",
8677
8754
  "osd-manager",
8678
8755
  "pet-feeder",
8756
+ "pet-fountain",
8679
8757
  "pipeline-analytics",
8680
8758
  "pipeline-executor",
8681
8759
  "pipeline-orchestrator",
@@ -8696,6 +8774,7 @@ var CAP_NAMES = Object.freeze([
8696
8774
  "recording-onboard",
8697
8775
  "recording-signal",
8698
8776
  "records",
8777
+ "remote",
8699
8778
  "running-state",
8700
8779
  "scene-monitor",
8701
8780
  "script-runner",
@@ -8719,6 +8798,7 @@ var CAP_NAMES = Object.freeze([
8719
8798
  "system",
8720
8799
  "tamper",
8721
8800
  "temperature-sensor",
8801
+ "template",
8722
8802
  "terminal-session",
8723
8803
  "toast",
8724
8804
  "training",
@@ -9659,6 +9739,11 @@ Object.freeze({
9659
9739
  "standby"
9660
9740
  ]
9661
9741
  },
9742
+ {
9743
+ "path": "stateSource",
9744
+ "valueType": "enum",
9745
+ "enumValues": ["reported", "assumed"]
9746
+ },
9662
9747
  {
9663
9748
  "path": "volumeLevel",
9664
9749
  "valueType": "number"
@@ -9885,6 +9970,11 @@ Object.freeze({
9885
9970
  "path": "batteryPower",
9886
9971
  "valueType": "number"
9887
9972
  },
9973
+ {
9974
+ "path": "powerSource",
9975
+ "valueType": "enum",
9976
+ "enumValues": ["mains", "battery"]
9977
+ },
9888
9978
  {
9889
9979
  "path": "desiccantLeftDays",
9890
9980
  "valueType": "number"
@@ -9929,6 +10019,68 @@ Object.freeze({
9929
10019
  {
9930
10020
  "path": "volume",
9931
10021
  "valueType": "number"
10022
+ },
10023
+ {
10024
+ "path": "lastFeedGrams",
10025
+ "valueType": "number"
10026
+ },
10027
+ {
10028
+ "path": "lastFeedHopper1",
10029
+ "valueType": "number"
10030
+ },
10031
+ {
10032
+ "path": "lastFeedHopper2",
10033
+ "valueType": "number"
10034
+ }
10035
+ ],
10036
+ "pet-fountain": [
10037
+ {
10038
+ "path": "waterLevel",
10039
+ "valueType": "number"
10040
+ },
10041
+ {
10042
+ "path": "waterVolume",
10043
+ "valueType": "number"
10044
+ },
10045
+ {
10046
+ "path": "empty",
10047
+ "valueType": "boolean"
10048
+ },
10049
+ {
10050
+ "path": "pumpRunning",
10051
+ "valueType": "boolean"
10052
+ },
10053
+ {
10054
+ "path": "pumpIntervalEnabled",
10055
+ "valueType": "boolean"
10056
+ },
10057
+ {
10058
+ "path": "pumpOnTime",
10059
+ "valueType": "number"
10060
+ },
10061
+ {
10062
+ "path": "pumpOffTime",
10063
+ "valueType": "number"
10064
+ },
10065
+ {
10066
+ "path": "lastDrink",
10067
+ "valueType": "number"
10068
+ },
10069
+ {
10070
+ "path": "currentHourDrink",
10071
+ "valueType": "number"
10072
+ },
10073
+ {
10074
+ "path": "last24hDrink",
10075
+ "valueType": "number"
10076
+ },
10077
+ {
10078
+ "path": "todayDrink",
10079
+ "valueType": "number"
10080
+ },
10081
+ {
10082
+ "path": "error",
10083
+ "valueType": "string"
9932
10084
  }
9933
10085
  ],
9934
10086
  "power-meter": [
@@ -10468,7 +10620,7 @@ object({
10468
10620
  params: record(string(), union([string(), number()])).optional()
10469
10621
  });
10470
10622
  //#endregion
10471
- //#region ../types/dist/err-msg-DIorGYeC.mjs
10623
+ //#region ../types/dist/err-msg-DWXWc0Di.mjs
10472
10624
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10473
10625
  DeviceType["Camera"] = "camera";
10474
10626
  DeviceType["Hub"] = "hub";
@@ -10560,6 +10712,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10560
10712
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10561
10713
  * integrations sharing the same food/desiccant/hopper surface. */
10562
10714
  DeviceType["PetFeeder"] = "pet-feeder";
10715
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
10716
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
10717
+ * of a container and is BUILT as a composed device (D967). */
10718
+ DeviceType["PetFountain"] = "pet-fountain";
10563
10719
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10564
10720
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10565
10721
  * Sources: native Bosch Home Connect, reusable by similar integrations.
@@ -10814,6 +10970,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10814
10970
  /** Fallback when the notifier service name doesn't match a known
10815
10971
  * pattern. */
10816
10972
  DeviceRole["GenericNotifier"] = "generic-notifier";
10973
+ /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
10974
+ * cap. A `DeviceType.Generic` device. */
10975
+ DeviceRole["IrTransmitter"] = "ir-transmitter";
10817
10976
  return DeviceRole;
10818
10977
  }({});
10819
10978
  /**
@@ -10821,13 +10980,13 @@ import { errMsg } from '@camstack/types'
10821
10980
  * Extract a human-readable message from an unknown error value.
10822
10981
  * Replaces the ubiquitous `errMsg(err)` pattern.
10823
10982
  */
10824
- function errMsg(err) {
10983
+ function errMsg$1(err) {
10825
10984
  if (err instanceof Error) return err.message;
10826
10985
  if (typeof err === "string") return err;
10827
10986
  return String(err);
10828
10987
  }
10829
10988
  //#endregion
10830
- //#region ../types/dist/composition-CZImLpOI.mjs
10989
+ //#region ../types/dist/composition-kSuOifuG.mjs
10831
10990
  /**
10832
10991
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10833
10992
  *
@@ -11912,12 +12071,28 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11912
12071
  ])
11913
12072
  })
11914
12073
  ]);
11915
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
12074
+ var forwardArgUnion = union([
12075
+ string(),
12076
+ number(),
12077
+ boolean(),
12078
+ strictObject({ ["$input"]: string().min(1) }),
12079
+ record(string().min(1), lazy(() => forwardArgUnion))
12080
+ ]);
12081
+ var CompositionForwardArgSchema = forwardArgUnion;
12082
+ /**
12083
+ * `forward` (D659, amended by D967): one method of a BUILT capability is one
12084
+ * call of `cap.method` on `source`. Without `args` the built method's input
12085
+ * passes through minus `deviceId`; with `args` the template IS the source's
12086
+ * whole input. `deviceId` is always the source's own, never an argument.
12087
+ */
12088
+ var CompositionForwardCommandSchema = object({
11916
12089
  kind: literal("forward"),
11917
12090
  source: CompositionSourceRefSchema,
11918
12091
  cap: string().min(1),
11919
- method: string().min(1)
11920
- }), CompositionCodeSourceSchema]);
12092
+ method: string().min(1),
12093
+ args: record(string().min(1), CompositionForwardArgSchema).optional()
12094
+ });
12095
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
11921
12096
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
11922
12097
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11923
12098
  /**
@@ -11927,7 +12102,13 @@ var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11927
12102
  */
11928
12103
  var CompositionItemEntrySchema = object({
11929
12104
  label: string().min(1).max(80),
11930
- fields: record(string().min(1), CompositionFieldSourceSchema)
12105
+ fields: record(string().min(1), CompositionFieldSourceSchema),
12106
+ /**
12107
+ * What the cap's `reset` does for THIS item (consumables). Present = the item
12108
+ * is resettable and a `reset` call naming its key forwards here. The item key
12109
+ * selects the command, so it is never an argument: there is no pass-through.
12110
+ */
12111
+ reset: CompositionForwardCommandSchema.optional()
11931
12112
  });
11932
12113
  var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11933
12114
  kind: literal("fields"),
@@ -11939,7 +12120,7 @@ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11939
12120
  * owns the WHOLE array field: the composed value holds exactly these items.
11940
12121
  */
11941
12122
  items: record(string().regex(COMPOSITION_ITEM_KEY_RE), CompositionItemEntrySchema).refine((items) => Object.keys(items).length <= 16, { message: `at most 16 items` }).optional(),
11942
- /** RESERVED for slice 3; refused by the validator when non-empty. */
12123
+ /** Method name → what serves it. Only a BUILT capability takes commands (D967). */
11943
12124
  commands: record(string().min(1), CompositionCommandTargetSchema).optional()
11944
12125
  }), object({
11945
12126
  kind: literal("passthrough"),
@@ -16166,6 +16347,510 @@ object({
16166
16347
  lastError: string().nullable()
16167
16348
  });
16168
16349
  /**
16350
+ * notification-output — canonical, capability-gated notification delivery.
16351
+ *
16352
+ * Apprise-derived model (see
16353
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
16354
+ * callers emit ONE canonical `Notification`; each provider declares a
16355
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
16356
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
16357
+ * message to what the kind supports — callers never special-case a service.
16358
+ *
16359
+ * DESIGN DECISIONS (locked):
16360
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
16361
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
16362
+ * cap. Rationale: the admin UI needs one uniform surface across the
16363
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
16364
+ * alternative would fork the UI per addon and cannot host the
16365
+ * discovery→adopt flow.
16366
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
16367
+ * the generated cap-mount auto-`concatCollection`-fans them across every
16368
+ * registered provider (notifiers addon + HA addon) so one catalog is
16369
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
16370
+ * `addonId` the generated collection router extracts from the call input.
16371
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
16372
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
16373
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
16374
+ * base64 fallback needed.
16375
+ *
16376
+ * TODO (deferred, closed-set change — separate decision): add
16377
+ * `providerKind: 'notify'` so notification providers surface on the unified
16378
+ * admin "Integrations" page.
16379
+ */
16380
+ /**
16381
+ * Zentik-derived typed-media enum — the superset across every kind. Each
16382
+ * adapter picks what it supports and the degrade engine filters the rest.
16383
+ */
16384
+ var AttachmentMediaTypeSchema = _enum([
16385
+ "image",
16386
+ "video",
16387
+ "gif",
16388
+ "audio",
16389
+ "icon"
16390
+ ]);
16391
+ /**
16392
+ * A single attachment. Exactly one of `url` (remote source, most adapters
16393
+ * prefer this) or `bytes` (inline source; required for Pushover-style
16394
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
16395
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
16396
+ */
16397
+ var AttachmentSchema = object({
16398
+ mediaType: AttachmentMediaTypeSchema,
16399
+ url: string().optional(),
16400
+ bytes: _instanceof(Uint8Array).optional(),
16401
+ mime: string().optional(),
16402
+ name: string().optional()
16403
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
16404
+ var NotificationFormatSchema = _enum([
16405
+ "text",
16406
+ "markdown",
16407
+ "html"
16408
+ ]);
16409
+ /**
16410
+ * The CLOSED icon vocabulary an action button may use.
16411
+ *
16412
+ * A closed set, not a free string, and that is the whole point: an arbitrary
16413
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
16414
+ * notices — the same class of gap as a zone vocabulary nothing produced
16415
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
16416
+ * declares `actionIcons: false` and the degrade engine strips the field.
16417
+ *
16418
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
16419
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
16420
+ * differently.
16421
+ *
16422
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
16423
+ *
16424
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
16425
+ * the whole set onto its own renderer's vocabulary through a
16426
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
16427
+ * fallback, so adding a member here fails every adapter's build until someone
16428
+ * decides its glyph, which is the only place that decision can be made
16429
+ * honestly.
16430
+ *
16431
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
16432
+ * `disarm` straight through; iOS feeds that string to
16433
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
16434
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
16435
+ * mapping, and "the field is documented" is not "the value renders".
16436
+ *
16437
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
16438
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
16439
+ * so an addon that emits a token the running hub does not know does not lose an
16440
+ * icon — its whole `send` fails Zod validation and the notification never
16441
+ * arrives. Never emit a new token from an addon before the train carrying it.
16442
+ */
16443
+ var NotificationActionIconSchema = _enum([
16444
+ "acknowledge",
16445
+ "dismiss",
16446
+ "silence",
16447
+ "snooze",
16448
+ "view",
16449
+ "play",
16450
+ "open",
16451
+ "close",
16452
+ "lock",
16453
+ "unlock",
16454
+ "arm",
16455
+ "arm-home",
16456
+ "arm-away",
16457
+ "arm-night",
16458
+ "disarm",
16459
+ "light",
16460
+ "alert",
16461
+ "camera"
16462
+ ]);
16463
+ /** A single tap-through action button. */
16464
+ var NotificationActionSchema = object({
16465
+ id: string(),
16466
+ label: string(),
16467
+ url: string().optional(),
16468
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
16469
+ icon: NotificationActionIconSchema.optional(),
16470
+ /**
16471
+ * Renders in a warning style where the notifier supports it.
16472
+ *
16473
+ * A HINT, never a gate. The callback's authority is its token and nothing
16474
+ * else — see `notification-center/action-token.ts` for what that does and
16475
+ * does not buy.
16476
+ */
16477
+ destructive: boolean().optional(),
16478
+ /**
16479
+ * How the tap should REACH the url.
16480
+ *
16481
+ * `navigate` (absent, and every button authored before this field) opens it:
16482
+ * the phone leaves the notification and shows whatever the callback returns.
16483
+ * That is right for a button whose answer the operator wants to read.
16484
+ *
16485
+ * `background` fires it as a POST and stays put. It exists for the buttons
16486
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
16487
+ * an answer to the notification, and being thrown into a browser tab to
16488
+ * confirm it costs more attention than the notification did. A backend that
16489
+ * cannot do a background call renders it as an ordinary link (the adapters
16490
+ * fall back rather than dropping the button), so this is a preference, never
16491
+ * a requirement.
16492
+ */
16493
+ mode: _enum(["navigate", "background"]).optional()
16494
+ });
16495
+ /** A delivery parameter value: what a notifier declared it takes. */
16496
+ var DeliveryParamValueSchema = union([
16497
+ string(),
16498
+ number(),
16499
+ boolean()
16500
+ ]);
16501
+ /**
16502
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
16503
+ * addresses a target of that kind may set it; a kind that declares nothing is
16504
+ * never handed one. The admin UI derives its control from this descriptor —
16505
+ * no editor knows a service by name.
16506
+ *
16507
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
16508
+ * run on the addon cap path).
16509
+ */
16510
+ var DeliveryParamSchema = object({
16511
+ key: string().min(1),
16512
+ label: string(),
16513
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
16514
+ labelKey: string().optional(),
16515
+ type: _enum([
16516
+ "enum",
16517
+ "number",
16518
+ "boolean",
16519
+ "string"
16520
+ ]),
16521
+ /** `enum` only: the closed set of accepted values. */
16522
+ options: array(object({
16523
+ value: string(),
16524
+ label: string()
16525
+ })).optional(),
16526
+ /** `number` only. */
16527
+ min: number().optional(),
16528
+ max: number().optional(),
16529
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
16530
+ default: DeliveryParamValueSchema.optional()
16531
+ });
16532
+ /**
16533
+ * The canonical notification. `body` is the only hard field (Apprise model).
16534
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
16535
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
16536
+ * the adapter maps this ordinal onto its native level. `level?` is an
16537
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
16538
+ * `priority` for that one target.
16539
+ */
16540
+ var NotificationSchema = object({
16541
+ body: string(),
16542
+ title: string().optional(),
16543
+ format: NotificationFormatSchema.default("text"),
16544
+ priority: number().int().min(1).max(5).default(3),
16545
+ level: string().optional(),
16546
+ attachments: array(AttachmentSchema).optional(),
16547
+ clickUrl: string().optional(),
16548
+ actions: array(NotificationActionSchema).optional(),
16549
+ sound: string().optional(),
16550
+ ttl: number().optional(),
16551
+ tag: string().optional(),
16552
+ deviceId: number().optional(),
16553
+ eventId: string().optional(),
16554
+ metadata: record(string(), unknown()).optional(),
16555
+ /**
16556
+ * Values for the parameters the target's kind DECLARES in
16557
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
16558
+ * declaration by the sender; a notifier reads only the keys it declared.
16559
+ */
16560
+ delivery: record(string(), DeliveryParamValueSchema).optional()
16561
+ });
16562
+ /** One declared native severity/priority level for a kind. */
16563
+ var TargetKindLevelSchema = object({
16564
+ id: string(),
16565
+ label: string(),
16566
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
16567
+ ordinal: number().int().min(1).max(5).nullable(),
16568
+ flags: object({
16569
+ critical: boolean().optional(),
16570
+ silent: boolean().optional(),
16571
+ noPush: boolean().optional()
16572
+ }).optional(),
16573
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
16574
+ requires: array(string()).optional(),
16575
+ description: string().optional()
16576
+ });
16577
+ /** The full capability block consulted before dispatch. */
16578
+ var TargetKindCapsSchema = object({
16579
+ attachments: object({
16580
+ mediaTypes: array(AttachmentMediaTypeSchema),
16581
+ mode: _enum([
16582
+ "url",
16583
+ "bytes",
16584
+ "both"
16585
+ ]),
16586
+ max: number().int().nonnegative(),
16587
+ maxBytes: number().int().positive().optional()
16588
+ }),
16589
+ /** Max action buttons (0 = none). */
16590
+ actions: number().int().nonnegative(),
16591
+ /**
16592
+ * Whether this kind renders a per-action ICON.
16593
+ *
16594
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
16595
+ * run on the addon cap path — three production failures in one day taught
16596
+ * this repo that once. Absent is read as false by the degrade engine, which
16597
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
16598
+ * assumed and dropped costs the operator's trust in the field.
16599
+ */
16600
+ actionIcons: boolean().optional(),
16601
+ levels: array(TargetKindLevelSchema),
16602
+ format: array(NotificationFormatSchema),
16603
+ clickUrl: boolean(),
16604
+ sound: boolean(),
16605
+ ttl: boolean(),
16606
+ bodyMaxLen: number().int().positive()
16607
+ });
16608
+ /**
16609
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
16610
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
16611
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
16612
+ * the union is large and not meant for runtime validation here; the exported
16613
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
16614
+ */
16615
+ var ConfigSchemaPassthrough$3 = unknown();
16616
+ var TargetKindSchema = object({
16617
+ kind: string(),
16618
+ label: string(),
16619
+ icon: string(),
16620
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
16621
+ addonId: string(),
16622
+ /**
16623
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
16624
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
16625
+ * when the addon bundles no icon for that kind — the client then falls back
16626
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
16627
+ *
16628
+ * Root-relative on purpose: it resolves against whatever origin serves a web
16629
+ * client, and a native client joins it onto its own hub base.
16630
+ *
16631
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
16632
+ * field that survived only because the runtime cap-router forwards provider
16633
+ * output verbatim — so every consumer had to re-declare it by hand to stop
16634
+ * its own Zod parse from stripping it, and the whole arrangement would have
16635
+ * broken silently the moment output validation was tightened anywhere.
16636
+ */
16637
+ iconUrl: string().optional(),
16638
+ /**
16639
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
16640
+ *
16641
+ * The server knows this and therefore says it, because the client cannot
16642
+ * safely guess: a React-Native client renders SVG and raster through two
16643
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
16644
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
16645
+ * placeholder glyph for every vector icon while the web build looked fine.
16646
+ *
16647
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
16648
+ * not been updated — a client that cannot determine the type should prefer
16649
+ * its raster path, which is the safe default for an unknown image.
16650
+ */
16651
+ iconMediaType: string().optional(),
16652
+ configSchema: ConfigSchemaPassthrough$3,
16653
+ /**
16654
+ * The config keys that decide WHERE this kind's secrets are sent (server,
16655
+ * base URL, instance, chat, recipient). A save that changes any of them
16656
+ * while leaving a secret redacted is refused by the provider (D634), so an
16657
+ * editor uses this to ask for the secret on exactly those edits instead of
16658
+ * on every edit.
16659
+ *
16660
+ * Optional: absent from a provider that holds no secret (the Home Assistant
16661
+ * kinds) and from a provider older than this field — an editor that finds
16662
+ * it absent must assume ANY edit may need the secret.
16663
+ */
16664
+ destinationKeys: array(string()).optional(),
16665
+ supportsDiscovery: boolean(),
16666
+ /**
16667
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
16668
+ * Absent = none; the rule editor then offers nothing.
16669
+ */
16670
+ deliveryParams: array(DeliveryParamSchema).optional(),
16671
+ caps: TargetKindCapsSchema
16672
+ });
16673
+ /**
16674
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
16675
+ * (return a presence marker only) when serving `listTargets` — never
16676
+ * round-trip a stored secret to the UI.
16677
+ */
16678
+ var TargetSchema = object({
16679
+ id: string(),
16680
+ name: string(),
16681
+ kind: string(),
16682
+ addonId: string(),
16683
+ enabled: boolean(),
16684
+ config: record(string(), unknown())
16685
+ });
16686
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
16687
+ var DiscoveredTargetSchema = object({
16688
+ kind: string(),
16689
+ suggestedName: string(),
16690
+ config: record(string(), unknown())
16691
+ });
16692
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
16693
+ var RenderedAsSchema = object({
16694
+ level: string(),
16695
+ format: NotificationFormatSchema,
16696
+ attachmentsSent: number().int().nonnegative(),
16697
+ actionsSent: number().int().nonnegative(),
16698
+ truncated: boolean(),
16699
+ dropped: array(string())
16700
+ });
16701
+ var SendResultSchema = object({
16702
+ success: boolean(),
16703
+ error: string().optional(),
16704
+ renderedAs: RenderedAsSchema.optional()
16705
+ });
16706
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
16707
+ var TestResultSchema = SendResultSchema;
16708
+ /**
16709
+ * Pre-save credential probe against a partial (unsaved) target config.
16710
+ * `resolvedUrl` never includes secrets (token stripped from path).
16711
+ */
16712
+ var ProbeTargetConfigResultSchema = object({
16713
+ ok: boolean(),
16714
+ resolvedUrl: string(),
16715
+ httpStatus: number().int().optional(),
16716
+ stateInstance: string().optional(),
16717
+ error: string().optional()
16718
+ });
16719
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
16720
+ kind: string(),
16721
+ config: record(string(), unknown()).optional(),
16722
+ /**
16723
+ * When editing / duplicating, the blank password field never round-trips
16724
+ * the stored token. Pass the source target id so the provider can restore
16725
+ * secrets server-side before dialling (same merge as upsert).
16726
+ */
16727
+ targetId: string().optional()
16728
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
16729
+ kind: string(),
16730
+ config: record(string(), unknown()),
16731
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
16732
+ targetId: string().optional()
16733
+ }), ProbeTargetConfigResultSchema, {
16734
+ kind: "mutation",
16735
+ auth: "admin"
16736
+ }), method(object({
16737
+ targetId: string(),
16738
+ notification: NotificationSchema
16739
+ }), SendResultSchema, {
16740
+ kind: "mutation",
16741
+ auth: "admin"
16742
+ }), method(object({
16743
+ targetId: string(),
16744
+ sample: NotificationSchema.optional()
16745
+ }), TestResultSchema, {
16746
+ kind: "mutation",
16747
+ auth: "admin"
16748
+ }), method(object({
16749
+ target: TargetSchema,
16750
+ /**
16751
+ * Duplicate flow: create a NEW target id while copying secrets from an
16752
+ * existing row. The UI never holds the stored token; blank / redacted
16753
+ * password fields are restored from this source (D634 still applies if
16754
+ * destinations diverge without a re-typed secret).
16755
+ */
16756
+ cloneSecretsFrom: string().optional()
16757
+ }), TargetSchema, {
16758
+ kind: "mutation",
16759
+ auth: "admin"
16760
+ }), method(object({ targetId: string() }), _void(), {
16761
+ kind: "mutation",
16762
+ auth: "admin"
16763
+ }), method(object({
16764
+ targetId: string(),
16765
+ enabled: boolean()
16766
+ }), _void(), {
16767
+ kind: "mutation",
16768
+ auth: "admin"
16769
+ });
16770
+ function errorText(err) {
16771
+ return err instanceof Error ? err.message : String(err);
16772
+ }
16773
+ /** `actions.run` flattens a refusal to `[code] text`; the code leads. */
16774
+ function refusalFromThrown(message) {
16775
+ if (message.startsWith("[busy]")) return "already-running";
16776
+ if (message.startsWith("[not-found]")) return "not-found";
16777
+ return null;
16778
+ }
16779
+ async function runExportedAction(api, log, input) {
16780
+ const { exporter, actionId } = input;
16781
+ const tags = { actionId };
16782
+ const refuse = (reason, detail) => {
16783
+ log.warn(`${exporter}: exported action not run — ${reason}`, {
16784
+ tags,
16785
+ meta: {
16786
+ reason,
16787
+ ...detail ? { detail } : {}
16788
+ }
16789
+ });
16790
+ return {
16791
+ status: "refused",
16792
+ reason
16793
+ };
16794
+ };
16795
+ try {
16796
+ const result = await api.actions.run.mutate({ actionId });
16797
+ if (result.outcome === "skipped-overlap") return refuse("already-running", result.message);
16798
+ if (result.outcome === "skipped-cooldown") return refuse("cooldown", result.message);
16799
+ if (result.outcome === "failed" || result.outcome === "aborted") {
16800
+ const message = result.message ?? result.outcome;
16801
+ log.warn(`${exporter}: exported action failed`, {
16802
+ tags,
16803
+ meta: {
16804
+ outcome: result.outcome,
16805
+ message
16806
+ }
16807
+ });
16808
+ return {
16809
+ status: "failed",
16810
+ message
16811
+ };
16812
+ }
16813
+ log.info(`${exporter}: exported action ran`, {
16814
+ tags,
16815
+ meta: { outcome: result.outcome }
16816
+ });
16817
+ return { status: "started" };
16818
+ } catch (err) {
16819
+ const message = errorText(err);
16820
+ const reason = refusalFromThrown(message);
16821
+ if (reason !== null) return refuse(reason, message);
16822
+ log.warn(`${exporter}: exported action failed`, {
16823
+ tags,
16824
+ meta: { message }
16825
+ });
16826
+ return {
16827
+ status: "failed",
16828
+ message
16829
+ };
16830
+ }
16831
+ }
16832
+ /**
16833
+ * Split an exporter's selection into what still exists and what was deleted.
16834
+ * Devices are never judged here (their lifecycle is the tombstone, D865).
16835
+ * Callers pass ids from a query that ANSWERED — an unanswered list must not
16836
+ * reach this function (D49: a failed read changes nothing).
16837
+ */
16838
+ function pruneDeletedEntities(selection, live, log, exporter) {
16839
+ const kept = [];
16840
+ const dropped = [];
16841
+ for (const ref of selection) if (ref.kind === "action" && !live.actionIds.has(ref.actionId)) {
16842
+ dropped.push(ref);
16843
+ log.warn(`${exporter}: exported action was deleted — dropped from the export`, { tags: { actionId: ref.actionId } });
16844
+ } else if (ref.kind === "notifier" && !live.targetIds.has(ref.targetId)) {
16845
+ dropped.push(ref);
16846
+ log.warn(`${exporter}: exported notifier target was deleted — dropped from the export`, { tags: { targetId: ref.targetId } });
16847
+ } else kept.push(ref);
16848
+ return {
16849
+ kept,
16850
+ dropped
16851
+ };
16852
+ }
16853
+ /**
16169
16854
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16170
16855
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
16171
16856
  *
@@ -16197,52 +16882,6 @@ var AddonPageInfoSchema = object({
16197
16882
  bundleUrl: string()
16198
16883
  });
16199
16884
  method(_void(), array(AddonPageInfoSchema).readonly());
16200
- /**
16201
- * `addon-pages-source` — collection cap exposing per-provider raw page
16202
- * declarations. Every addon that contributes a UI page registers a
16203
- * provider here. The hub-side singleton aggregator (`addon-pages` cap,
16204
- * see `addon-pages.cap.ts`) walks this collection, stamps versioned
16205
- * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
16206
- * that admin-ui consumes.
16207
- *
16208
- * The split exists because the public listing has a different output
16209
- * shape than the per-provider raw declarations, and we want both ends
16210
- * to flow through codegen instead of relying on a hand-written wrapper.
16211
- */
16212
- var AddonPageDeclarationSchema = object({
16213
- id: string(),
16214
- label: string(),
16215
- icon: string(),
16216
- path: string(),
16217
- /**
16218
- * Module Federation remote name — must match the `name` field on the
16219
- * page addon's `federation()` plugin config. Used by admin-ui's
16220
- * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
16221
- * Conventionally `addon_<id>_page` (snake_case; MF names cannot
16222
- * contain hyphens).
16223
- */
16224
- remoteName: string(),
16225
- /**
16226
- * Bundle filename inside the addon's `dist/` dir served at
16227
- * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
16228
- * is always `'remoteEntry.js'`; the value is kept on the metadata so
16229
- * the static-file route can compute an mtime-based cache-buster URL
16230
- * without a separate filesystem stat.
16231
- */
16232
- bundle: string(),
16233
- /**
16234
- * Sidebar section this page docks into. Well-known ids: `'detection'`,
16235
- * `'cluster'`, `'administration'` — the page renders inside that group.
16236
- * Any OTHER string creates (or joins) a custom section rendered after
16237
- * the built-in groups; its label comes from `sectionLabel` (first
16238
- * declaration wins), falling back to the id. Absent → the legacy
16239
- * "Addon Pages" group.
16240
- */
16241
- section: string().optional(),
16242
- /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
16243
- sectionLabel: string().optional()
16244
- });
16245
- method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
16246
16885
  var AddonHttpRouteSchema = object({
16247
16886
  method: _enum([
16248
16887
  "GET",
@@ -16543,9 +17182,21 @@ var AlertSeveritySchema = _enum([
16543
17182
  "error",
16544
17183
  "critical"
16545
17184
  ]);
17185
+ /**
17186
+ * An action that RUNS something instead of going somewhere: the admin UI calls
17187
+ * the addon's custom action (`addons.custom`) with exactly these fields. The
17188
+ * producer owns the meaning; the UI knows nothing about the addon or the kind.
17189
+ */
17190
+ var AlertActionInvokeSchema = object({
17191
+ addonId: string().min(1),
17192
+ action: string().min(1),
17193
+ input: record(string(), unknown()).optional()
17194
+ });
17195
+ /** An action has `href` (a link) OR `invoke` (a button that runs a custom action). */
16546
17196
  var AlertActionSchema = object({
16547
17197
  label: string(),
16548
17198
  href: string().optional(),
17199
+ invoke: AlertActionInvokeSchema.optional(),
16549
17200
  /**
16550
17201
  * How `href` is followed. Absent / `app`: an admin-ui route (client-side).
16551
17202
  * `server`: a route the HUB serves (an addon HTTP route such as an OAuth
@@ -18792,7 +19443,11 @@ var CompositionProblemSchema = object({
18792
19443
  "mixed-quantity",
18793
19444
  "helper-mismatch",
18794
19445
  "member-constraint",
18795
- "retention"
19446
+ "retention",
19447
+ "command-method-unknown",
19448
+ "command-source-unknown",
19449
+ "command-input-unknown",
19450
+ "command-input-missing"
18796
19451
  ]),
18797
19452
  path: string(),
18798
19453
  message: string()
@@ -18831,7 +19486,9 @@ var CompositionFieldRoleSchema = _enum([
18831
19486
  var CompositionFieldItemSchema = object({
18832
19487
  arrayPath: string(),
18833
19488
  key: string(),
18834
- label: string()
19489
+ label: string(),
19490
+ /** True when the item carries a `reset` forward: the composer writes `resettable` from this (D967). */
19491
+ resettable: boolean().optional()
18835
19492
  });
18836
19493
  var CompositionFieldPlanSchema = object({
18837
19494
  cap: string(),
@@ -19036,7 +19693,7 @@ Object.freeze({
19036
19693
  * One catalog row per base reading a group helper can build (D944 §3).
19037
19694
  * Data, not a form default written into the block.
19038
19695
  */
19039
- var NOW$2 = {
19696
+ var NOW$3 = {
19040
19697
  fieldPath: "lastFetchedAt",
19041
19698
  expr: "now"
19042
19699
  };
@@ -19045,12 +19702,13 @@ var CHANGED = {
19045
19702
  expr: "now"
19046
19703
  };
19047
19704
  function numeric(input) {
19705
+ const { alsoFrom, ...base } = input;
19048
19706
  return {
19049
- ...input,
19707
+ ...base,
19050
19708
  family: "numeric",
19051
19709
  deviceType: DeviceType.Sensor,
19052
19710
  memberDeviceType: DeviceType.Sensor,
19053
- memberDeviceTypes: [DeviceType.Sensor],
19711
+ memberDeviceTypes: [DeviceType.Sensor, ...alsoFrom?.deviceTypes ?? []],
19054
19712
  activeWhen: void 0,
19055
19713
  commandCaps: [],
19056
19714
  baseUnit: baseUnitOf(input.quantity),
@@ -19058,9 +19716,10 @@ function numeric(input) {
19058
19716
  accept: [{
19059
19717
  cap: input.outputCap,
19060
19718
  fieldPath: input.outputField
19061
- }]
19719
+ }, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
19062
19720
  };
19063
19721
  }
19722
+ var CLIMATE_DEVICES = [DeviceType.Thermostat, DeviceType.Climate];
19064
19723
  function binary(input) {
19065
19724
  return {
19066
19725
  ...input,
@@ -19086,7 +19745,14 @@ var GROUP_TEMPLATES = [
19086
19745
  quantity: "temperature",
19087
19746
  defaultAggregate: "mean",
19088
19747
  empty: "null",
19089
- companions: [NOW$2]
19748
+ companions: [NOW$3],
19749
+ alsoFrom: {
19750
+ deviceTypes: CLIMATE_DEVICES,
19751
+ accept: {
19752
+ cap: "climate-control",
19753
+ fieldPath: "currentTemp"
19754
+ }
19755
+ }
19090
19756
  }),
19091
19757
  numeric({
19092
19758
  id: "humidity",
@@ -19097,7 +19763,14 @@ var GROUP_TEMPLATES = [
19097
19763
  quantity: "humidity",
19098
19764
  defaultAggregate: "mean",
19099
19765
  empty: "null",
19100
- companions: [NOW$2]
19766
+ companions: [NOW$3],
19767
+ alsoFrom: {
19768
+ deviceTypes: CLIMATE_DEVICES,
19769
+ accept: {
19770
+ cap: "climate-control",
19771
+ fieldPath: "currentHumidity"
19772
+ }
19773
+ }
19101
19774
  }),
19102
19775
  numeric({
19103
19776
  id: "pressure",
@@ -19108,7 +19781,7 @@ var GROUP_TEMPLATES = [
19108
19781
  quantity: "pressure",
19109
19782
  defaultAggregate: "mean",
19110
19783
  empty: "null",
19111
- companions: [NOW$2]
19784
+ companions: [NOW$3]
19112
19785
  }),
19113
19786
  numeric({
19114
19787
  id: "illuminance",
@@ -19119,7 +19792,7 @@ var GROUP_TEMPLATES = [
19119
19792
  quantity: "illuminance",
19120
19793
  defaultAggregate: "mean",
19121
19794
  empty: "null",
19122
- companions: [NOW$2]
19795
+ companions: [NOW$3]
19123
19796
  }),
19124
19797
  numeric({
19125
19798
  id: "power",
@@ -19130,7 +19803,7 @@ var GROUP_TEMPLATES = [
19130
19803
  quantity: "power",
19131
19804
  defaultAggregate: "sum",
19132
19805
  empty: "omit",
19133
- companions: [NOW$2]
19806
+ companions: [NOW$3]
19134
19807
  }),
19135
19808
  numeric({
19136
19809
  id: "energy",
@@ -19141,7 +19814,7 @@ var GROUP_TEMPLATES = [
19141
19814
  quantity: "energy",
19142
19815
  defaultAggregate: "sum",
19143
19816
  empty: "omit",
19144
- companions: [NOW$2]
19817
+ companions: [NOW$3]
19145
19818
  }),
19146
19819
  numeric({
19147
19820
  id: "battery",
@@ -19176,7 +19849,7 @@ var GROUP_TEMPLATES = [
19176
19849
  quantity: "device",
19177
19850
  defaultAggregate: "mean",
19178
19851
  empty: "null",
19179
- companions: [NOW$2]
19852
+ companions: [NOW$3]
19180
19853
  }),
19181
19854
  binary({
19182
19855
  id: "motion",
@@ -21522,6 +22195,36 @@ var ExposeInputSchema = object({
21522
22195
  capabilities: array(string()).optional()
21523
22196
  });
21524
22197
  var UnexposeInputSchema = object({ deviceId: string() });
22198
+ /**
22199
+ * What an exporter may expose besides devices (D968). An action and a
22200
+ * notification target are LIST ENTRIES, never devices (D954): they enter an
22201
+ * exporter's own selection, not the device registry.
22202
+ */
22203
+ var ExportEntityKindSchema = _enum([
22204
+ "device",
22205
+ "action",
22206
+ "notifier"
22207
+ ]);
22208
+ var ExportEntityRefSchema = discriminatedUnion("kind", [
22209
+ object({
22210
+ kind: literal("device"),
22211
+ deviceId: string()
22212
+ }),
22213
+ object({
22214
+ kind: literal("action"),
22215
+ actionId: string().min(1)
22216
+ }),
22217
+ object({
22218
+ kind: literal("notifier"),
22219
+ targetId: string().min(1)
22220
+ })
22221
+ ]);
22222
+ var ExposedEntitySchema = object({
22223
+ entity: ExportEntityRefSchema,
22224
+ exposedAs: string().optional()
22225
+ });
22226
+ var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
22227
+ var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
21525
22228
  var deviceExportCapability = {
21526
22229
  name: "device-export",
21527
22230
  scope: "system",
@@ -21551,6 +22254,16 @@ var deviceExportCapability = {
21551
22254
  unexposeDevice: method(UnexposeInputSchema, _void(), {
21552
22255
  kind: "mutation",
21553
22256
  auth: "admin"
22257
+ }),
22258
+ listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
22259
+ listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
22260
+ exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
22261
+ kind: "mutation",
22262
+ auth: "admin"
22263
+ }),
22264
+ unexposeEntity: optionalMethod(UnexposeEntityInputSchema, _void(), {
22265
+ kind: "mutation",
22266
+ auth: "admin"
21554
22267
  })
21555
22268
  }
21556
22269
  };
@@ -42693,6 +43406,14 @@ method(object({
42693
43406
  kind: "mutation",
42694
43407
  auth: "admin"
42695
43408
  });
43409
+ method(object({
43410
+ nodeId: string().min(1),
43411
+ /** Epoch ms the node was forgotten (the tombstone's `removedAt`). */
43412
+ removedAt: number()
43413
+ }), object({ counts: record(string(), number().int().nonnegative()) }), {
43414
+ kind: "mutation",
43415
+ auth: "admin"
43416
+ });
42696
43417
  /**
42697
43418
  * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
42698
43419
  * so it can delete what it keeps for that device (D865).
@@ -43340,6 +44061,17 @@ var LlmProfileSchema = object({
43340
44061
  * field in its editor only when its descriptor lists it in `profileFields`. */
43341
44062
  topK: number().int().positive().optional(),
43342
44063
  maxTokens: number().int().positive().optional(),
44064
+ /** How hard the model "thinks" before it answers. Omitted = the model's own
44065
+ * default. `off` matters for structured output: a thinking model can spend
44066
+ * the whole completion on reasoning and return an empty `content`. Carried
44067
+ * only by the wires that have it — a kind offers the field in its editor
44068
+ * only when its descriptor lists it in `profileFields`. */
44069
+ reasoningEffort: _enum([
44070
+ "off",
44071
+ "low",
44072
+ "medium",
44073
+ "high"
44074
+ ]).optional(),
43343
44075
  /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
43344
44076
  contextLength: number().int().positive().optional(),
43345
44077
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
@@ -43378,6 +44110,7 @@ var LlmProfileFieldSchema = _enum([
43378
44110
  "topP",
43379
44111
  "topK",
43380
44112
  "maxTokens",
44113
+ "reasoningEffort",
43381
44114
  "contextLength",
43382
44115
  "systemPrompt",
43383
44116
  "timeoutMs",
@@ -43401,7 +44134,7 @@ var LlmProviderWidgetSchema = object({
43401
44134
  /** ConfigUISchema tree passed through untyped on the wire (the
43402
44135
  * notification-output `ConfigSchemaPassthrough` precedent at
43403
44136
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
43404
- var ConfigSchemaPassthrough$3 = unknown();
44137
+ var ConfigSchemaPassthrough$2 = unknown();
43405
44138
  var LlmProfileKindDescriptorSchema = object({
43406
44139
  kind: LlmProfileKindSchema,
43407
44140
  label: string(),
@@ -43410,9 +44143,9 @@ var LlmProfileKindDescriptorSchema = object({
43410
44143
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
43411
44144
  addonId: string(),
43412
44145
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
43413
- connectionSchema: ConfigSchemaPassthrough$3,
44146
+ connectionSchema: ConfigSchemaPassthrough$2,
43414
44147
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
43415
- advancedSchema: ConfigSchemaPassthrough$3.optional(),
44148
+ advancedSchema: ConfigSchemaPassthrough$2.optional(),
43416
44149
  /** The kind's defaults; a model from `listModels` may override any of them. */
43417
44150
  features: LlmModelFeaturesSchema,
43418
44151
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -43938,10 +44671,10 @@ var CpuBreakdownSchema = object({
43938
44671
  cores: number()
43939
44672
  });
43940
44673
  var MemoryInfoSchema = object({
43941
- percent: number(),
44674
+ percent: number().nullable(),
43942
44675
  totalBytes: number(),
43943
- usedBytes: number(),
43944
- availableBytes: number(),
44676
+ usedBytes: number().nullable(),
44677
+ availableBytes: number().nullable(),
43945
44678
  swapUsedBytes: number(),
43946
44679
  swapTotalBytes: number()
43947
44680
  });
@@ -44245,8 +44978,9 @@ var GetLoadSeriesInputSchema = object({
44245
44978
  });
44246
44979
  var SystemMetricsSchema = object({
44247
44980
  cpuPercent: number(),
44248
- memoryPercent: number(),
44249
- memoryUsedMB: number(),
44981
+ /** `null` when the memory sample failed or was not taken yet (D393). */
44982
+ memoryPercent: number().nullable(),
44983
+ memoryUsedMB: number().nullable(),
44250
44984
  memoryTotalMB: number(),
44251
44985
  diskPercent: number().optional(),
44252
44986
  temperature: number().optional(),
@@ -44482,379 +45216,6 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
44482
45216
  sourcePort: number().optional()
44483
45217
  });
44484
45218
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
44485
- /**
44486
- * notification-output — canonical, capability-gated notification delivery.
44487
- *
44488
- * Apprise-derived model (see
44489
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44490
- * callers emit ONE canonical `Notification`; each provider declares a
44491
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44492
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44493
- * message to what the kind supports — callers never special-case a service.
44494
- *
44495
- * DESIGN DECISIONS (locked):
44496
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44497
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44498
- * cap. Rationale: the admin UI needs one uniform surface across the
44499
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44500
- * alternative would fork the UI per addon and cannot host the
44501
- * discovery→adopt flow.
44502
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44503
- * the generated cap-mount auto-`concatCollection`-fans them across every
44504
- * registered provider (notifiers addon + HA addon) so one catalog is
44505
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44506
- * `addonId` the generated collection router extracts from the call input.
44507
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44508
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44509
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44510
- * base64 fallback needed.
44511
- *
44512
- * TODO (deferred, closed-set change — separate decision): add
44513
- * `providerKind: 'notify'` so notification providers surface on the unified
44514
- * admin "Integrations" page.
44515
- */
44516
- /**
44517
- * Zentik-derived typed-media enum — the superset across every kind. Each
44518
- * adapter picks what it supports and the degrade engine filters the rest.
44519
- */
44520
- var AttachmentMediaTypeSchema = _enum([
44521
- "image",
44522
- "video",
44523
- "gif",
44524
- "audio",
44525
- "icon"
44526
- ]);
44527
- /**
44528
- * A single attachment. Exactly one of `url` (remote source, most adapters
44529
- * prefer this) or `bytes` (inline source; required for Pushover-style
44530
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44531
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44532
- */
44533
- var AttachmentSchema = object({
44534
- mediaType: AttachmentMediaTypeSchema,
44535
- url: string().optional(),
44536
- bytes: _instanceof(Uint8Array).optional(),
44537
- mime: string().optional(),
44538
- name: string().optional()
44539
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44540
- var NotificationFormatSchema = _enum([
44541
- "text",
44542
- "markdown",
44543
- "html"
44544
- ]);
44545
- /**
44546
- * The CLOSED icon vocabulary an action button may use.
44547
- *
44548
- * A closed set, not a free string, and that is the whole point: an arbitrary
44549
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44550
- * notices — the same class of gap as a zone vocabulary nothing produced
44551
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44552
- * declares `actionIcons: false` and the degrade engine strips the field.
44553
- *
44554
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44555
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44556
- * differently.
44557
- *
44558
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44559
- *
44560
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44561
- * the whole set onto its own renderer's vocabulary through a
44562
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44563
- * fallback, so adding a member here fails every adapter's build until someone
44564
- * decides its glyph, which is the only place that decision can be made
44565
- * honestly.
44566
- *
44567
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44568
- * `disarm` straight through; iOS feeds that string to
44569
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44570
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44571
- * mapping, and "the field is documented" is not "the value renders".
44572
- *
44573
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44574
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44575
- * so an addon that emits a token the running hub does not know does not lose an
44576
- * icon — its whole `send` fails Zod validation and the notification never
44577
- * arrives. Never emit a new token from an addon before the train carrying it.
44578
- */
44579
- var NotificationActionIconSchema = _enum([
44580
- "acknowledge",
44581
- "dismiss",
44582
- "silence",
44583
- "snooze",
44584
- "view",
44585
- "play",
44586
- "open",
44587
- "close",
44588
- "lock",
44589
- "unlock",
44590
- "arm",
44591
- "arm-home",
44592
- "arm-away",
44593
- "arm-night",
44594
- "disarm",
44595
- "light",
44596
- "alert",
44597
- "camera"
44598
- ]);
44599
- /** A single tap-through action button. */
44600
- var NotificationActionSchema = object({
44601
- id: string(),
44602
- label: string(),
44603
- url: string().optional(),
44604
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44605
- icon: NotificationActionIconSchema.optional(),
44606
- /**
44607
- * Renders in a warning style where the notifier supports it.
44608
- *
44609
- * A HINT, never a gate. The callback's authority is its token and nothing
44610
- * else — see `notification-center/action-token.ts` for what that does and
44611
- * does not buy.
44612
- */
44613
- destructive: boolean().optional(),
44614
- /**
44615
- * How the tap should REACH the url.
44616
- *
44617
- * `navigate` (absent, and every button authored before this field) opens it:
44618
- * the phone leaves the notification and shows whatever the callback returns.
44619
- * That is right for a button whose answer the operator wants to read.
44620
- *
44621
- * `background` fires it as a POST and stays put. It exists for the buttons
44622
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44623
- * an answer to the notification, and being thrown into a browser tab to
44624
- * confirm it costs more attention than the notification did. A backend that
44625
- * cannot do a background call renders it as an ordinary link (the adapters
44626
- * fall back rather than dropping the button), so this is a preference, never
44627
- * a requirement.
44628
- */
44629
- mode: _enum(["navigate", "background"]).optional()
44630
- });
44631
- /**
44632
- * The canonical notification. `body` is the only hard field (Apprise model).
44633
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44634
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44635
- * the adapter maps this ordinal onto its native level. `level?` is an
44636
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44637
- * `priority` for that one target.
44638
- */
44639
- var NotificationSchema = object({
44640
- body: string(),
44641
- title: string().optional(),
44642
- format: NotificationFormatSchema.default("text"),
44643
- priority: number().int().min(1).max(5).default(3),
44644
- level: string().optional(),
44645
- attachments: array(AttachmentSchema).optional(),
44646
- clickUrl: string().optional(),
44647
- actions: array(NotificationActionSchema).optional(),
44648
- sound: string().optional(),
44649
- ttl: number().optional(),
44650
- tag: string().optional(),
44651
- deviceId: number().optional(),
44652
- eventId: string().optional(),
44653
- metadata: record(string(), unknown()).optional()
44654
- });
44655
- /** One declared native severity/priority level for a kind. */
44656
- var TargetKindLevelSchema = object({
44657
- id: string(),
44658
- label: string(),
44659
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44660
- ordinal: number().int().min(1).max(5).nullable(),
44661
- flags: object({
44662
- critical: boolean().optional(),
44663
- silent: boolean().optional(),
44664
- noPush: boolean().optional()
44665
- }).optional(),
44666
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44667
- requires: array(string()).optional(),
44668
- description: string().optional()
44669
- });
44670
- /** The full capability block consulted before dispatch. */
44671
- var TargetKindCapsSchema = object({
44672
- attachments: object({
44673
- mediaTypes: array(AttachmentMediaTypeSchema),
44674
- mode: _enum([
44675
- "url",
44676
- "bytes",
44677
- "both"
44678
- ]),
44679
- max: number().int().nonnegative(),
44680
- maxBytes: number().int().positive().optional()
44681
- }),
44682
- /** Max action buttons (0 = none). */
44683
- actions: number().int().nonnegative(),
44684
- /**
44685
- * Whether this kind renders a per-action ICON.
44686
- *
44687
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44688
- * run on the addon cap path — three production failures in one day taught
44689
- * this repo that once. Absent is read as false by the degrade engine, which
44690
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44691
- * assumed and dropped costs the operator's trust in the field.
44692
- */
44693
- actionIcons: boolean().optional(),
44694
- levels: array(TargetKindLevelSchema),
44695
- format: array(NotificationFormatSchema),
44696
- clickUrl: boolean(),
44697
- sound: boolean(),
44698
- ttl: boolean(),
44699
- bodyMaxLen: number().int().positive()
44700
- });
44701
- /**
44702
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44703
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44704
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44705
- * the union is large and not meant for runtime validation here; the exported
44706
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44707
- */
44708
- var ConfigSchemaPassthrough$2 = unknown();
44709
- var TargetKindSchema = object({
44710
- kind: string(),
44711
- label: string(),
44712
- icon: string(),
44713
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44714
- addonId: string(),
44715
- /**
44716
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44717
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44718
- * when the addon bundles no icon for that kind — the client then falls back
44719
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44720
- *
44721
- * Root-relative on purpose: it resolves against whatever origin serves a web
44722
- * client, and a native client joins it onto its own hub base.
44723
- *
44724
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44725
- * field that survived only because the runtime cap-router forwards provider
44726
- * output verbatim — so every consumer had to re-declare it by hand to stop
44727
- * its own Zod parse from stripping it, and the whole arrangement would have
44728
- * broken silently the moment output validation was tightened anywhere.
44729
- */
44730
- iconUrl: string().optional(),
44731
- /**
44732
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44733
- *
44734
- * The server knows this and therefore says it, because the client cannot
44735
- * safely guess: a React-Native client renders SVG and raster through two
44736
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44737
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44738
- * placeholder glyph for every vector icon while the web build looked fine.
44739
- *
44740
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44741
- * not been updated — a client that cannot determine the type should prefer
44742
- * its raster path, which is the safe default for an unknown image.
44743
- */
44744
- iconMediaType: string().optional(),
44745
- configSchema: ConfigSchemaPassthrough$2,
44746
- /**
44747
- * The config keys that decide WHERE this kind's secrets are sent (server,
44748
- * base URL, instance, chat, recipient). A save that changes any of them
44749
- * while leaving a secret redacted is refused by the provider (D634), so an
44750
- * editor uses this to ask for the secret on exactly those edits instead of
44751
- * on every edit.
44752
- *
44753
- * Optional: absent from a provider that holds no secret (the Home Assistant
44754
- * kinds) and from a provider older than this field — an editor that finds
44755
- * it absent must assume ANY edit may need the secret.
44756
- */
44757
- destinationKeys: array(string()).optional(),
44758
- supportsDiscovery: boolean(),
44759
- caps: TargetKindCapsSchema
44760
- });
44761
- /**
44762
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44763
- * (return a presence marker only) when serving `listTargets` — never
44764
- * round-trip a stored secret to the UI.
44765
- */
44766
- var TargetSchema = object({
44767
- id: string(),
44768
- name: string(),
44769
- kind: string(),
44770
- addonId: string(),
44771
- enabled: boolean(),
44772
- config: record(string(), unknown())
44773
- });
44774
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44775
- var DiscoveredTargetSchema = object({
44776
- kind: string(),
44777
- suggestedName: string(),
44778
- config: record(string(), unknown())
44779
- });
44780
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44781
- var RenderedAsSchema = object({
44782
- level: string(),
44783
- format: NotificationFormatSchema,
44784
- attachmentsSent: number().int().nonnegative(),
44785
- actionsSent: number().int().nonnegative(),
44786
- truncated: boolean(),
44787
- dropped: array(string())
44788
- });
44789
- var SendResultSchema = object({
44790
- success: boolean(),
44791
- error: string().optional(),
44792
- renderedAs: RenderedAsSchema.optional()
44793
- });
44794
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44795
- var TestResultSchema = SendResultSchema;
44796
- /**
44797
- * Pre-save credential probe against a partial (unsaved) target config.
44798
- * `resolvedUrl` never includes secrets (token stripped from path).
44799
- */
44800
- var ProbeTargetConfigResultSchema = object({
44801
- ok: boolean(),
44802
- resolvedUrl: string(),
44803
- httpStatus: number().int().optional(),
44804
- stateInstance: string().optional(),
44805
- error: string().optional()
44806
- });
44807
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44808
- kind: string(),
44809
- config: record(string(), unknown()).optional(),
44810
- /**
44811
- * When editing / duplicating, the blank password field never round-trips
44812
- * the stored token. Pass the source target id so the provider can restore
44813
- * secrets server-side before dialling (same merge as upsert).
44814
- */
44815
- targetId: string().optional()
44816
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44817
- kind: string(),
44818
- config: record(string(), unknown()),
44819
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44820
- targetId: string().optional()
44821
- }), ProbeTargetConfigResultSchema, {
44822
- kind: "mutation",
44823
- auth: "admin"
44824
- }), method(object({
44825
- targetId: string(),
44826
- notification: NotificationSchema
44827
- }), SendResultSchema, {
44828
- kind: "mutation",
44829
- auth: "admin"
44830
- }), method(object({
44831
- targetId: string(),
44832
- sample: NotificationSchema.optional()
44833
- }), TestResultSchema, {
44834
- kind: "mutation",
44835
- auth: "admin"
44836
- }), method(object({
44837
- target: TargetSchema,
44838
- /**
44839
- * Duplicate flow: create a NEW target id while copying secrets from an
44840
- * existing row. The UI never holds the stored token; blank / redacted
44841
- * password fields are restored from this source (D634 still applies if
44842
- * destinations diverge without a re-typed secret).
44843
- */
44844
- cloneSecretsFrom: string().optional()
44845
- }), TargetSchema, {
44846
- kind: "mutation",
44847
- auth: "admin"
44848
- }), method(object({ targetId: string() }), _void(), {
44849
- kind: "mutation",
44850
- auth: "admin"
44851
- }), method(object({
44852
- targetId: string(),
44853
- enabled: boolean()
44854
- }), _void(), {
44855
- kind: "mutation",
44856
- auth: "admin"
44857
- });
44858
45219
  var AUDIO_MACRO_LABELS = [
44859
45220
  {
44860
45221
  id: "speech",
@@ -51271,14 +51632,6 @@ var EngineProvisioningSchema = object({
51271
51632
  */
51272
51633
  configIssues: array(string()).optional()
51273
51634
  });
51274
- var PipelineStepInputSchema = lazy(() => object({
51275
- addonId: string(),
51276
- modelId: string().optional(),
51277
- enabled: boolean().default(true),
51278
- children: array(PipelineStepInputSchema).optional(),
51279
- settings: record(string(), unknown()).optional(),
51280
- jumpDeviceKey: string().optional()
51281
- }));
51282
51635
  var ModelSubstitutionSchema = object({
51283
51636
  addonId: string(),
51284
51637
  chosen: string(),
@@ -51357,7 +51710,6 @@ var ConfigUISchemaBridge = custom();
51357
51710
  var ConfigUISchemaNullableBridge = custom();
51358
51711
  var InferenceCapabilitiesBridge = custom();
51359
51712
  var ModelAvailabilityListBridge = custom();
51360
- var PipelineRunResultBridge = custom();
51361
51713
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
51362
51714
  modelId: string(),
51363
51715
  settings: record(string(), unknown()).readonly()
@@ -56942,7 +57294,9 @@ var ManifestShapeSchema = object({
56942
57294
  icon: string().optional()
56943
57295
  }).optional(),
56944
57296
  protected: boolean().optional(),
56945
- removable: boolean().optional()
57297
+ removable: boolean().optional(),
57298
+ /** Declared Integrations-page block (mirror of `AddonDeclaration.integrationSection`). */
57299
+ integrationSection: _enum(["system", "providers"]).optional()
56946
57300
  });
56947
57301
  var AddonProcessSchema = object({
56948
57302
  pid: number().optional(),
@@ -57671,11 +58025,373 @@ DeviceType.Light, method(object({
57671
58025
  level: number().min(0).max(100),
57672
58026
  lastChangedAt: number()
57673
58027
  });
58028
+ /**
58029
+ * The role vocabulary of a remote (D963): what a button MEANS, independent of
58030
+ * how it is wired. A layout template places buttons by role; a device binds a
58031
+ * role to an action; an exporter asks for a role by name. Roles are shared so
58032
+ * one layout fits every appliance and one voice command fits every binding.
58033
+ *
58034
+ * A role outside this list is `custom:<key>` — the operator's own button (a
58035
+ * SmartIR source, a channel preset). The key is a lowercase slug.
58036
+ */
58037
+ var REMOTE_KNOWN_ROLES = [
58038
+ "power",
58039
+ "power_on",
58040
+ "power_off",
58041
+ "volume_up",
58042
+ "volume_down",
58043
+ "mute",
58044
+ "channel_up",
58045
+ "channel_down",
58046
+ "up",
58047
+ "down",
58048
+ "left",
58049
+ "right",
58050
+ "ok",
58051
+ "back",
58052
+ "home",
58053
+ "menu",
58054
+ "info",
58055
+ "guide",
58056
+ "exit",
58057
+ "input",
58058
+ "play",
58059
+ "pause",
58060
+ "play_pause",
58061
+ "stop",
58062
+ "next",
58063
+ "previous",
58064
+ "fast_forward",
58065
+ "rewind",
58066
+ "digit_0",
58067
+ "digit_1",
58068
+ "digit_2",
58069
+ "digit_3",
58070
+ "digit_4",
58071
+ "digit_5",
58072
+ "digit_6",
58073
+ "digit_7",
58074
+ "digit_8",
58075
+ "digit_9"
58076
+ ];
58077
+ var CUSTOM_KEY_RE = /^[a-z0-9][a-z0-9_]{0,47}$/;
58078
+ var KNOWN_ROLES = new Set(REMOTE_KNOWN_ROLES);
58079
+ function isRemoteKnownRole(value) {
58080
+ return KNOWN_ROLES.has(value);
58081
+ }
58082
+ function isRemoteCustomKey(key) {
58083
+ return CUSTOM_KEY_RE.test(key);
58084
+ }
58085
+ /** The key of a `custom:<key>` role, or null for any other string. */
58086
+ function customKeyOfRole(role) {
58087
+ if (!role.startsWith("custom:")) return null;
58088
+ const key = role.slice(7);
58089
+ return isRemoteCustomKey(key) ? key : null;
58090
+ }
58091
+ function isRemoteRole(value) {
58092
+ return isRemoteKnownRole(value) || customKeyOfRole(value) !== null;
58093
+ }
58094
+ var RemoteRoleSchema = string().refine(isRemoteRole, { message: "a role is one of the known roles or custom:<key> (lowercase letters, digits, _)" });
58095
+ var RemoteBindingSchema = object({ action: AutomationCapStepSchema.extend({ deviceId: number().int().nonnegative() }) });
58096
+ var RemoteCustomButtonSchema = object({
58097
+ /** The slug after `custom:` in the role. */
58098
+ key: string().refine(isRemoteCustomKey, { message: "a lowercase slug" }),
58099
+ /** What the operator calls it, and what a voice command may name. */
58100
+ name: string().min(1).max(60)
58101
+ });
58102
+ var RemotePowerModeSchema = _enum(["toggle", "discrete"]);
58103
+ var RemoteConfigSchema = object({
58104
+ layoutTemplateId: string().min(1).nullable(),
58105
+ /**
58106
+ * The transmitter device new bindings and an import send through. A binding
58107
+ * names its own device, so one command may override it.
58108
+ */
58109
+ defaultTransmitterId: number().int().nonnegative().nullable().default(null),
58110
+ /** Keyed by role. A role with no entry falls back to the native cap. */
58111
+ bindings: record(string(), RemoteBindingSchema),
58112
+ customButtons: array(RemoteCustomButtonSchema).max(100),
58113
+ power: object({ mode: RemotePowerModeSchema })
58114
+ }).superRefine((config, ctx) => {
58115
+ const roles = Object.keys(config.bindings);
58116
+ if (roles.length > 200) ctx.addIssue({
58117
+ code: "custom",
58118
+ message: "too many bindings",
58119
+ path: ["bindings"]
58120
+ });
58121
+ for (const role of roles) if (!isRemoteRole(role)) ctx.addIssue({
58122
+ code: "custom",
58123
+ message: `"${role}" is not a role`,
58124
+ path: ["bindings", role]
58125
+ });
58126
+ const keys = /* @__PURE__ */ new Set();
58127
+ config.customButtons.forEach((button, index) => {
58128
+ if (keys.has(button.key)) ctx.addIssue({
58129
+ code: "custom",
58130
+ message: `custom button "${button.key}" is listed twice`,
58131
+ path: [
58132
+ "customButtons",
58133
+ index,
58134
+ "key"
58135
+ ]
58136
+ });
58137
+ keys.add(button.key);
58138
+ });
58139
+ for (const role of roles) {
58140
+ const key = customKeyOfRole(role);
58141
+ if (key !== null && !keys.has(key)) ctx.addIssue({
58142
+ code: "custom",
58143
+ message: `${role} is bound but has no entry in customButtons`,
58144
+ path: ["bindings", role]
58145
+ });
58146
+ }
58147
+ });
58148
+ object({
58149
+ power: object({
58150
+ state: _enum(["on", "off"]),
58151
+ at: number()
58152
+ }).nullable(),
58153
+ muted: object({
58154
+ value: boolean(),
58155
+ at: number()
58156
+ }).nullable()
58157
+ });
58158
+ var RemoteLayoutButtonSchema = object({
58159
+ id: string().min(1).max(40),
58160
+ /** 0-based grid position. */
58161
+ row: number().int().min(0).max(24),
58162
+ col: number().int().min(0).max(24),
58163
+ rowSpan: number().int().min(1).max(24),
58164
+ colSpan: number().int().min(1).max(24),
58165
+ icon: string().min(1).max(60).optional(),
58166
+ label: string().min(1).max(40).optional(),
58167
+ role: RemoteRoleSchema
58168
+ });
58169
+ object({
58170
+ columns: number().int().min(1).max(24),
58171
+ rows: number().int().min(1).max(24),
58172
+ buttons: array(RemoteLayoutButtonSchema).max(200)
58173
+ }).superRefine((grid, ctx) => {
58174
+ const ids = /* @__PURE__ */ new Set();
58175
+ const taken = /* @__PURE__ */ new Map();
58176
+ grid.buttons.forEach((button, index) => {
58177
+ if (ids.has(button.id)) ctx.addIssue({
58178
+ code: "custom",
58179
+ message: `button id "${button.id}" is used twice`,
58180
+ path: [
58181
+ "buttons",
58182
+ index,
58183
+ "id"
58184
+ ]
58185
+ });
58186
+ ids.add(button.id);
58187
+ if (button.row + button.rowSpan > grid.rows || button.col + button.colSpan > grid.columns) {
58188
+ ctx.addIssue({
58189
+ code: "custom",
58190
+ message: `button "${button.id}" leaves the grid`,
58191
+ path: ["buttons", index]
58192
+ });
58193
+ return;
58194
+ }
58195
+ for (let r = button.row; r < button.row + button.rowSpan; r += 1) for (let c = button.col; c < button.col + button.colSpan; c += 1) {
58196
+ const cell = `${r}:${c}`;
58197
+ const other = taken.get(cell);
58198
+ if (other !== void 0) {
58199
+ ctx.addIssue({
58200
+ code: "custom",
58201
+ message: `buttons "${other}" and "${button.id}" overlap`,
58202
+ path: ["buttons", index]
58203
+ });
58204
+ return;
58205
+ }
58206
+ taken.set(cell, button.id);
58207
+ }
58208
+ });
58209
+ });
58210
+ var RemoteBoundCommandSchema = object({
58211
+ role: RemoteRoleSchema,
58212
+ /** The operator's name for a custom button; absent for a known role. */
58213
+ label: string().optional(),
58214
+ custom: boolean()
58215
+ });
58216
+ var RemoteCommandListSchema = object({
58217
+ layoutTemplateId: string().nullable(),
58218
+ power: object({ mode: RemotePowerModeSchema }),
58219
+ /** Only the roles that are BOUND — the ones a press can reach. */
58220
+ commands: array(RemoteBoundCommandSchema)
58221
+ });
58222
+ var RemoteRefusalReasonSchema = _enum([
58223
+ "no-remote",
58224
+ "unbound-role",
58225
+ "action-failed"
58226
+ ]);
58227
+ var RemoteSendResultSchema = discriminatedUnion("status", [
58228
+ object({
58229
+ status: literal("sent"),
58230
+ /** How many times the action ran. */
58231
+ sends: number().int().min(1)
58232
+ }),
58233
+ object({
58234
+ status: literal("skipped"),
58235
+ reason: literal("already-in-state")
58236
+ }),
58237
+ object({
58238
+ status: literal("refused"),
58239
+ reason: RemoteRefusalReasonSchema,
58240
+ detail: string().optional()
58241
+ })
58242
+ ]);
58243
+ var RemoteMediaCommandSchema = _enum([
58244
+ "play",
58245
+ "pause",
58246
+ "stop",
58247
+ "next",
58248
+ "previous",
58249
+ "setMute",
58250
+ "selectSource"
58251
+ ]);
58252
+ /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
58253
+ var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
58254
+ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status: literal("saved") }), object({
58255
+ status: literal("refused"),
58256
+ reason: _enum(["unknown-template", "not-a-media-player"]),
58257
+ detail: string()
58258
+ })]);
58259
+ var deviceInput = object({ deviceId: number().int().nonnegative() });
58260
+ DeviceType.MediaPlayer;
58261
+ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
58262
+ kind: "mutation",
58263
+ auth: "admin"
58264
+ }), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
58265
+ role: RemoteRoleSchema,
58266
+ /** Sends in a row (volume steps). */
58267
+ repeat: number().int().min(1).max(50).default(1)
58268
+ }), RemoteSendResultSchema, {
58269
+ kind: "mutation",
58270
+ auth: "protected"
58271
+ }), method(deviceInput.extend({
58272
+ command: RemoteMediaCommandSchema,
58273
+ muted: boolean().optional(),
58274
+ source: string().optional(),
58275
+ repeat: number().int().min(1).max(50).default(1)
58276
+ }), RemoteMediaCommandResultSchema, {
58277
+ kind: "mutation",
58278
+ auth: "protected"
58279
+ });
58280
+ var TemplateKindSchema = _enum(["remote"]);
58281
+ /**
58282
+ * template — the generic store of reusable, named operator data (D963). A
58283
+ * record is `{ id, kind, name, payload }`; the kinds (today only `remote`, the
58284
+ * button grid of a remote) and the schema each payload must satisfy are
58285
+ * declared by the system in `template-kinds.ts`. Nothing here is specific to a
58286
+ * kind: the engine validates a payload against its kind's schema and, on a
58287
+ * delete, asks the kind's owner whether anything still points at the record.
58288
+ *
58289
+ * Every refusal is a typed result — a UI says "unknown kind" or names the
58290
+ * devices that still use a template, without parsing text.
58291
+ */
58292
+ var TemplateRecordSchema = object({
58293
+ id: string().min(1),
58294
+ kind: TemplateKindSchema,
58295
+ name: string().min(1).max(120),
58296
+ /** Shaped by the kind; `checkTemplatePayload(kind, payload)` reads it. */
58297
+ payload: unknown(),
58298
+ createdAt: number(),
58299
+ updatedAt: number()
58300
+ });
58301
+ var TemplateWriteResultSchema = discriminatedUnion("status", [object({
58302
+ status: literal("saved"),
58303
+ template: TemplateRecordSchema
58304
+ }), object({
58305
+ status: literal("refused"),
58306
+ reason: _enum(["invalid-payload", "not-found"]),
58307
+ detail: string()
58308
+ })]);
58309
+ /** A device still pointing at a template. */
58310
+ var TemplateUserSchema = object({
58311
+ deviceId: number().int().nonnegative(),
58312
+ name: string()
58313
+ });
58314
+ var TemplateDeleteResultSchema = discriminatedUnion("status", [
58315
+ object({ status: literal("deleted") }),
58316
+ object({ status: literal("not-found") }),
58317
+ object({
58318
+ status: literal("in-use"),
58319
+ devices: array(TemplateUserSchema).min(1)
58320
+ })
58321
+ ]);
58322
+ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSchema), { auth: "protected" }), method(object({ id: string().min(1) }), TemplateRecordSchema.nullable(), { auth: "protected" }), method(object({
58323
+ kind: TemplateKindSchema,
58324
+ name: string().min(1).max(120),
58325
+ payload: unknown()
58326
+ }), TemplateWriteResultSchema, {
58327
+ kind: "mutation",
58328
+ auth: "admin"
58329
+ }), method(object({
58330
+ id: string().min(1),
58331
+ name: string().min(1).max(120).optional(),
58332
+ payload: unknown().optional()
58333
+ }), TemplateWriteResultSchema, {
58334
+ kind: "mutation",
58335
+ auth: "admin"
58336
+ }), method(object({ id: string().min(1) }), TemplateDeleteResultSchema, {
58337
+ kind: "mutation",
58338
+ auth: "admin"
58339
+ });
57674
58340
  DeviceType.Button, method(object({ deviceId: number().int().nonnegative() }), _void(), {
57675
58341
  kind: "mutation",
57676
58342
  auth: "protected"
57677
58343
  });
57678
58344
  /**
58345
+ * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
58346
+ * alternating, no zeros, 2..1024 entries.
58347
+ */
58348
+ var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
58349
+ timings.forEach((value, index) => {
58350
+ const expectMark = index % 2 === 0;
58351
+ if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
58352
+ code: "custom",
58353
+ message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
58354
+ path: [index]
58355
+ });
58356
+ });
58357
+ });
58358
+ /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
58359
+ var TransmitSettingsSchema = object({
58360
+ carrierHz: number().int().positive().optional(),
58361
+ dutyCyclePercent: number().int().min(1).max(100).optional(),
58362
+ repeat: number().int().min(0).max(20).optional(),
58363
+ repeatDelayMs: number().int().min(0).optional()
58364
+ });
58365
+ /** The setting keys a transmitter may declare as settable (`getInfo.settable`). */
58366
+ var TransmitSettingKeySchema = _enum([
58367
+ "carrierHz",
58368
+ "dutyCyclePercent",
58369
+ "repeat",
58370
+ "repeatDelayMs"
58371
+ ]);
58372
+ var IrMediumSchema = _enum(["ir", "rf"]);
58373
+ var IrSendResultSchema = object({
58374
+ ok: literal(true),
58375
+ /** Settings the transmitter could not apply; the train was still sent. */
58376
+ ignoredSettings: array(string())
58377
+ });
58378
+ var IrTransmitterInfoSchema = object({
58379
+ media: array(IrMediumSchema),
58380
+ settable: array(TransmitSettingKeySchema),
58381
+ maxTimings: number().int().positive()
58382
+ });
58383
+ DeviceType.Generic, method(object({
58384
+ deviceId: number().int().nonnegative(),
58385
+ timings: IrTimingsSchema,
58386
+ settings: TransmitSettingsSchema.optional()
58387
+ }), IrSendResultSchema, {
58388
+ kind: "mutation",
58389
+ auth: "protected"
58390
+ }), method(object({ deviceId: number().int().nonnegative() }), IrTransmitterInfoSchema, {
58391
+ kind: "query",
58392
+ auth: "protected"
58393
+ });
58394
+ /**
57679
58395
  * `calendar-source` — collection cap exposing per-provider calendars and
57680
58396
  * their events. Every addon that contributes calendars (Home Assistant,
57681
58397
  * a future Google Calendar addon, …) registers a provider here. The hub
@@ -58691,7 +59407,7 @@ object({
58691
59407
  /** Ms epoch of the last value received from the appliance; 0 = never. */
58692
59408
  lastFetchedAt: number()
58693
59409
  });
58694
- var DeviceIdSchema = number().int().nonnegative();
59410
+ var DeviceIdSchema$1 = number().int().nonnegative();
58695
59411
  /** A value a program option or setting can take. */
58696
59412
  var DishwasherValueSchema = union([
58697
59413
  boolean(),
@@ -58755,77 +59471,77 @@ var DishwasherOptionsSchema = object({
58755
59471
  options: array(DishwasherOptionDescriptorSchema)
58756
59472
  });
58757
59473
  DeviceType.Dishwasher, method(object({
58758
- deviceId: DeviceIdSchema,
59474
+ deviceId: DeviceIdSchema$1,
58759
59475
  program: string().min(1).optional(),
58760
59476
  options: record(string(), DishwasherValueSchema).optional()
58761
59477
  }), _void(), {
58762
59478
  kind: "mutation",
58763
59479
  auth: "protected"
58764
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59480
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
58765
59481
  kind: "mutation",
58766
59482
  auth: "protected"
58767
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59483
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
58768
59484
  kind: "mutation",
58769
59485
  auth: "protected"
58770
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59486
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
58771
59487
  kind: "mutation",
58772
59488
  auth: "protected"
58773
59489
  }), method(object({
58774
- deviceId: DeviceIdSchema,
59490
+ deviceId: DeviceIdSchema$1,
58775
59491
  program: string().min(1)
58776
59492
  }), _void(), {
58777
59493
  kind: "mutation",
58778
59494
  auth: "protected"
58779
59495
  }), method(object({
58780
- deviceId: DeviceIdSchema,
59496
+ deviceId: DeviceIdSchema$1,
58781
59497
  on: boolean()
58782
59498
  }), _void(), {
58783
59499
  kind: "mutation",
58784
59500
  auth: "protected"
58785
59501
  }), method(object({
58786
- deviceId: DeviceIdSchema,
59502
+ deviceId: DeviceIdSchema$1,
58787
59503
  on: boolean()
58788
59504
  }), _void(), {
58789
59505
  kind: "mutation",
58790
59506
  auth: "protected"
58791
59507
  }), method(object({
58792
- deviceId: DeviceIdSchema,
59508
+ deviceId: DeviceIdSchema$1,
58793
59509
  on: boolean()
58794
59510
  }), _void(), {
58795
59511
  kind: "mutation",
58796
59512
  auth: "protected"
58797
59513
  }), method(object({
58798
- deviceId: DeviceIdSchema,
59514
+ deviceId: DeviceIdSchema$1,
58799
59515
  on: boolean()
58800
59516
  }), _void(), {
58801
59517
  kind: "mutation",
58802
59518
  auth: "protected"
58803
59519
  }), method(object({
58804
- deviceId: DeviceIdSchema,
59520
+ deviceId: DeviceIdSchema$1,
58805
59521
  on: boolean()
58806
59522
  }), _void(), {
58807
59523
  kind: "mutation",
58808
59524
  auth: "protected"
58809
59525
  }), method(object({
58810
- deviceId: DeviceIdSchema,
59526
+ deviceId: DeviceIdSchema$1,
58811
59527
  on: boolean()
58812
59528
  }), _void(), {
58813
59529
  kind: "mutation",
58814
59530
  auth: "protected"
58815
59531
  }), method(object({
58816
- deviceId: DeviceIdSchema,
59532
+ deviceId: DeviceIdSchema$1,
58817
59533
  on: boolean()
58818
59534
  }), _void(), {
58819
59535
  kind: "mutation",
58820
59536
  auth: "protected"
58821
59537
  }), method(object({
58822
- deviceId: DeviceIdSchema,
59538
+ deviceId: DeviceIdSchema$1,
58823
59539
  key: string().min(1),
58824
59540
  value: DishwasherValueSchema
58825
59541
  }), _void(), {
58826
59542
  kind: "mutation",
58827
59543
  auth: "protected"
58828
- }), method(object({ deviceId: DeviceIdSchema }), DishwasherOptionsSchema, { auth: "protected" });
59544
+ }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
58829
59545
  DeviceType.Camera;
58830
59546
  object({
58831
59547
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -60390,9 +61106,35 @@ var MediaInfoSchema = object({
60390
61106
  /** Optional cover-art / thumbnail URL. */
60391
61107
  imageUrl: string().optional()
60392
61108
  });
61109
+ /**
61110
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
61111
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
61112
+ * tracks what it last SENT; it moves only after a send was accepted, and a
61113
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
61114
+ * guess, never as a reading.
61115
+ */
61116
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
61117
+ /** The fields of a media-player status a driver can only guess. */
61118
+ var MediaPlayerAssumedFieldSchema = _enum([
61119
+ "state",
61120
+ "volumeLevel",
61121
+ "isMuted",
61122
+ "source"
61123
+ ]);
60393
61124
  object({
60394
61125
  /** Playback lifecycle state. */
60395
61126
  state: MediaPlayerStateSchema,
61127
+ /**
61128
+ * Whether the state fields are readings or the driver's own bookkeeping.
61129
+ * A slice written before this field existed parses as `reported`.
61130
+ */
61131
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
61132
+ /**
61133
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
61134
+ * this is not empty; a field not listed here is a reading even then (power
61135
+ * from a running-state source, mute guessed from the last send).
61136
+ */
61137
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
60396
61138
  /** Volume as 0..100 inclusive. Null when the device has no volume
60397
61139
  * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
60398
61140
  volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
@@ -61245,7 +61987,8 @@ var TopologyNodeSchema = object({
61245
61987
  isHub: boolean(),
61246
61988
  isOnline: boolean(),
61247
61989
  cpuPercent: number(),
61248
- memoryPercent: number(),
61990
+ /** `null` when the node's memory read failed or it has not reported one (D393). */
61991
+ memoryPercent: number().nullable(),
61249
61992
  uptime: number(),
61250
61993
  lastSeen: string(),
61251
61994
  localIps: array(string()).readonly(),
@@ -61780,9 +62523,10 @@ object({
61780
62523
  * combined reading; per-hopper levels live in `food1`/`food2`. Null when
61781
62524
  * the device has not reported yet. */
61782
62525
  foodLevel: number().nullable().meta(readingMeta("none")),
61783
- /** Food in the BOWL as the feeder reports it (`state.bowl`), in the
61784
- * feeder's own units. Null when the model reports none. */
61785
- bowlFood: number().nullable().meta(readingMeta("none")),
62526
+ /** Food in the BOWL, a mass (stored in kilograms, D944). Reported only by a
62527
+ * feeder with a bowl scale; null when the model has none or its reading is
62528
+ * of an unproven unit. */
62529
+ bowlFood: number().nullable().meta(readingMeta("mass")),
61786
62530
  /** True while the pet is eating (`state.eating`). */
61787
62531
  eating: boolean(),
61788
62532
  /** Whether `markFoodReplenished` does anything on this model. When false
@@ -61798,9 +62542,14 @@ object({
61798
62542
  * (`device_class: problem`, on = low). True when the tank reports empty,
61799
62543
  * or, on a dual-hopper model, when EITHER hopper is empty. */
61800
62544
  lowFood: boolean(),
61801
- /** Battery charge 0..100 (%). Null on mains-powered models or when the
61802
- * device has no battery reading. */
62545
+ /** Battery charge 0..100 (%). On a feeder running on `mains` this is the
62546
+ * BACKUP battery's charge, not the power source. Null when the device has
62547
+ * no battery reading. */
61803
62548
  batteryPower: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62549
+ /** What the feeder is powered from right now: `mains` (plugged in, the
62550
+ * battery is only a backup) or `battery`. Null when the device does not
62551
+ * report it. */
62552
+ powerSource: _enum(["mains", "battery"]).nullable(),
61804
62553
  /**
61805
62554
  * Desiccant life remaining, stored in seconds (duration base, D944).
61806
62555
  * Providers convert from the days the feeder reports. Null when the
@@ -61828,6 +62577,14 @@ object({
61828
62577
  feedSound: boolean(),
61829
62578
  /** Speaker / prompt volume level (device-scaled integer). */
61830
62579
  volume: number().meta(readingMeta("none")),
62580
+ /** Portion (grams) of the last manual feed sent from a single-hopper
62581
+ * stepper — the default the next manual feed starts from. Persisted per
62582
+ * device by the provider; null until a manual feed has been sent. */
62583
+ lastFeedGrams: gramsPortion.nullable(),
62584
+ /** Hopper-1 portion of the last manual feed (dual-hopper); null until sent. */
62585
+ lastFeedHopper1: gramsPortion.nullable(),
62586
+ /** Hopper-2 portion of the last manual feed (dual-hopper); null until sent. */
62587
+ lastFeedHopper2: gramsPortion.nullable(),
61831
62588
  /** Ms epoch when the slice was last refreshed from the cloud. */
61832
62589
  lastFetchedAt: number()
61833
62590
  });
@@ -61882,6 +62639,64 @@ DeviceType.PetFeeder, method(object({
61882
62639
  kind: "mutation",
61883
62640
  auth: "protected"
61884
62641
  });
62642
+ object({
62643
+ /** Water in the tank, 0..100 (%). Null while the source has not reported. */
62644
+ waterLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62645
+ /** Water in the tank, in litres. Null while the source has not reported. */
62646
+ waterVolume: number().min(0).nullable().meta(readingMeta("volume")),
62647
+ /** True when the tank is empty. Null while unknown. */
62648
+ empty: boolean().nullable(),
62649
+ /** True while the pump is running. Null while unknown. */
62650
+ pumpRunning: boolean().nullable(),
62651
+ /** True when the pump works on an on/off duty cycle rather than continuously. */
62652
+ pumpIntervalEnabled: boolean().nullable(),
62653
+ /** How long the pump runs per cycle, in seconds. */
62654
+ pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
62655
+ /** How long the pump rests per cycle, in seconds. */
62656
+ pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
62657
+ /** Water drunk in the last drink, in litres. */
62658
+ lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
62659
+ /** Water drunk in the current hour, in litres. */
62660
+ currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
62661
+ /** Water drunk over the last 24 hours (rolling), in litres. */
62662
+ last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
62663
+ /** Water drunk since local midnight, in litres. */
62664
+ todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
62665
+ /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
62666
+ error: string().nullable(),
62667
+ /** Ms epoch when the slice was last refreshed. */
62668
+ lastFetchedAt: number()
62669
+ });
62670
+ var DeviceIdSchema = number().int().nonnegative();
62671
+ var MinutesSchema = number().int().min(0);
62672
+ DeviceType.PetFountain, method(object({
62673
+ deviceId: DeviceIdSchema,
62674
+ on: boolean()
62675
+ }), _void(), {
62676
+ kind: "mutation",
62677
+ auth: "protected"
62678
+ }), method(object({
62679
+ deviceId: DeviceIdSchema,
62680
+ on: boolean()
62681
+ }), _void(), {
62682
+ kind: "mutation",
62683
+ auth: "protected"
62684
+ }), method(object({
62685
+ deviceId: DeviceIdSchema,
62686
+ minutes: MinutesSchema
62687
+ }), _void(), {
62688
+ kind: "mutation",
62689
+ auth: "protected"
62690
+ }), method(object({
62691
+ deviceId: DeviceIdSchema,
62692
+ minutes: MinutesSchema
62693
+ }), _void(), {
62694
+ kind: "mutation",
62695
+ auth: "protected"
62696
+ }), method(object({ deviceId: DeviceIdSchema }), _void(), {
62697
+ kind: "mutation",
62698
+ auth: "protected"
62699
+ });
61885
62700
  var VehicleSchema = object({
61886
62701
  id: string(),
61887
62702
  name: string(),
@@ -66488,9 +67303,17 @@ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" })
66488
67303
  kind: "mutation",
66489
67304
  auth: "admin"
66490
67305
  });
67306
+ discriminatedUnion("kind", [object({
67307
+ kind: literal("raw"),
67308
+ timings: array(number().int()),
67309
+ settings: TransmitSettingsSchema.optional()
67310
+ }), object({
67311
+ kind: literal("pronto"),
67312
+ code: string()
67313
+ })]);
66491
67314
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
66492
67315
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
66493
- 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;
67316
+ 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;
66494
67317
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
66495
67318
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
66496
67319
  new Set(CAP_NAMES);
@@ -66543,7 +67366,7 @@ var AccessoryKind = {
66543
67366
  PrivacyMask: DeviceRole.PrivacyMask
66544
67367
  };
66545
67368
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
66546
- 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;
67369
+ 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;
66547
67370
  new Set(Object.values(DeviceType));
66548
67371
  Object.freeze({
66549
67372
  "accessories.getStatus": {
@@ -68478,6 +69301,13 @@ Object.freeze({
68478
69301
  access: "create",
68479
69302
  role: "admin"
68480
69303
  },
69304
+ "deviceExport.exposeEntity": {
69305
+ capName: "device-export",
69306
+ capScope: "system",
69307
+ addonId: null,
69308
+ access: "create",
69309
+ role: "admin"
69310
+ },
68481
69311
  "deviceExport.getDeviceLiveContribution": {
68482
69312
  capName: "device-export",
68483
69313
  capScope: "system",
@@ -68506,6 +69336,13 @@ Object.freeze({
68506
69336
  access: "view",
68507
69337
  role: "admin"
68508
69338
  },
69339
+ "deviceExport.listExposedEntities": {
69340
+ capName: "device-export",
69341
+ capScope: "system",
69342
+ addonId: null,
69343
+ access: "view",
69344
+ role: "admin"
69345
+ },
68509
69346
  "deviceExport.listSupportedDeviceKinds": {
68510
69347
  capName: "device-export",
68511
69348
  capScope: "system",
@@ -68513,6 +69350,13 @@ Object.freeze({
68513
69350
  access: "view",
68514
69351
  role: "admin"
68515
69352
  },
69353
+ "deviceExport.listSupportedEntityKinds": {
69354
+ capName: "device-export",
69355
+ capScope: "system",
69356
+ addonId: null,
69357
+ access: "view",
69358
+ role: "admin"
69359
+ },
68516
69360
  "deviceExport.unexposeDevice": {
68517
69361
  capName: "device-export",
68518
69362
  capScope: "system",
@@ -68520,6 +69364,13 @@ Object.freeze({
68520
69364
  access: "create",
68521
69365
  role: "admin"
68522
69366
  },
69367
+ "deviceExport.unexposeEntity": {
69368
+ capName: "device-export",
69369
+ capScope: "system",
69370
+ addonId: null,
69371
+ access: "create",
69372
+ role: "admin"
69373
+ },
68523
69374
  "deviceExtension.listCandidates": {
68524
69375
  capName: "device-extension",
68525
69376
  capScope: "device",
@@ -70095,6 +70946,20 @@ Object.freeze({
70095
70946
  access: "create",
70096
70947
  role: "viewer"
70097
70948
  },
70949
+ "irTransmitter.getInfo": {
70950
+ capName: "ir-transmitter",
70951
+ capScope: "device",
70952
+ addonId: null,
70953
+ access: "view",
70954
+ role: "viewer"
70955
+ },
70956
+ "irTransmitter.send": {
70957
+ capName: "ir-transmitter",
70958
+ capScope: "device",
70959
+ addonId: null,
70960
+ access: "create",
70961
+ role: "viewer"
70962
+ },
70098
70963
  "keychain.delete": {
70099
70964
  capName: "keychain",
70100
70965
  capScope: "system",
@@ -71327,6 +72192,13 @@ Object.freeze({
71327
72192
  access: "create",
71328
72193
  role: "admin"
71329
72194
  },
72195
+ "nodeRemovalHook.onNodeRemoved": {
72196
+ capName: "node-removal-hook",
72197
+ capScope: "system",
72198
+ addonId: null,
72199
+ access: "create",
72200
+ role: "admin"
72201
+ },
71330
72202
  "nodes.clusterAddonStatus": {
71331
72203
  capName: "nodes",
71332
72204
  capScope: "system",
@@ -71964,6 +72836,48 @@ Object.freeze({
71964
72836
  access: "create",
71965
72837
  role: "viewer"
71966
72838
  },
72839
+ "petFountain.getStatus": {
72840
+ capName: "pet-fountain",
72841
+ capScope: "device",
72842
+ addonId: null,
72843
+ access: "view",
72844
+ role: "viewer"
72845
+ },
72846
+ "petFountain.resetDailyConsumption": {
72847
+ capName: "pet-fountain",
72848
+ capScope: "device",
72849
+ addonId: null,
72850
+ access: "delete",
72851
+ role: "viewer"
72852
+ },
72853
+ "petFountain.setPump": {
72854
+ capName: "pet-fountain",
72855
+ capScope: "device",
72856
+ addonId: null,
72857
+ access: "create",
72858
+ role: "viewer"
72859
+ },
72860
+ "petFountain.setPumpInterval": {
72861
+ capName: "pet-fountain",
72862
+ capScope: "device",
72863
+ addonId: null,
72864
+ access: "create",
72865
+ role: "viewer"
72866
+ },
72867
+ "petFountain.setPumpOffMinutes": {
72868
+ capName: "pet-fountain",
72869
+ capScope: "device",
72870
+ addonId: null,
72871
+ access: "create",
72872
+ role: "viewer"
72873
+ },
72874
+ "petFountain.setPumpOnMinutes": {
72875
+ capName: "pet-fountain",
72876
+ capScope: "device",
72877
+ addonId: null,
72878
+ access: "create",
72879
+ role: "viewer"
72880
+ },
71967
72881
  "pipelineAnalytics.addRetrainFrameFromRecording": {
71968
72882
  capName: "pipeline-analytics",
71969
72883
  capScope: "device",
@@ -74218,6 +75132,41 @@ Object.freeze({
74218
75132
  access: "create",
74219
75133
  role: "admin"
74220
75134
  },
75135
+ "remote.getConfig": {
75136
+ capName: "remote",
75137
+ capScope: "system",
75138
+ addonId: null,
75139
+ access: "view",
75140
+ role: "admin"
75141
+ },
75142
+ "remote.listCommands": {
75143
+ capName: "remote",
75144
+ capScope: "system",
75145
+ addonId: null,
75146
+ access: "view",
75147
+ role: "admin"
75148
+ },
75149
+ "remote.sendCommand": {
75150
+ capName: "remote",
75151
+ capScope: "system",
75152
+ addonId: null,
75153
+ access: "create",
75154
+ role: "admin"
75155
+ },
75156
+ "remote.sendMediaCommand": {
75157
+ capName: "remote",
75158
+ capScope: "system",
75159
+ addonId: null,
75160
+ access: "create",
75161
+ role: "admin"
75162
+ },
75163
+ "remote.setConfig": {
75164
+ capName: "remote",
75165
+ capScope: "system",
75166
+ addonId: null,
75167
+ access: "create",
75168
+ role: "admin"
75169
+ },
74221
75170
  "runningState.getStatus": {
74222
75171
  capName: "running-state",
74223
75172
  capScope: "device",
@@ -75408,6 +76357,41 @@ Object.freeze({
75408
76357
  access: "view",
75409
76358
  role: "viewer"
75410
76359
  },
76360
+ "template.create": {
76361
+ capName: "template",
76362
+ capScope: "system",
76363
+ addonId: null,
76364
+ access: "create",
76365
+ role: "admin"
76366
+ },
76367
+ "template.delete": {
76368
+ capName: "template",
76369
+ capScope: "system",
76370
+ addonId: null,
76371
+ access: "delete",
76372
+ role: "admin"
76373
+ },
76374
+ "template.get": {
76375
+ capName: "template",
76376
+ capScope: "system",
76377
+ addonId: null,
76378
+ access: "view",
76379
+ role: "admin"
76380
+ },
76381
+ "template.list": {
76382
+ capName: "template",
76383
+ capScope: "system",
76384
+ addonId: null,
76385
+ access: "view",
76386
+ role: "admin"
76387
+ },
76388
+ "template.update": {
76389
+ capName: "template",
76390
+ capScope: "system",
76391
+ addonId: null,
76392
+ access: "create",
76393
+ role: "admin"
76394
+ },
75411
76395
  "terminalSession.adoptLegacyMonitor": {
75412
76396
  capName: "terminal-session",
75413
76397
  capScope: "system",
@@ -77718,6 +78702,11 @@ var ACTUATOR_CAP_VOCABULARY = {
77718
78702
  icon: "circle-dot"
77719
78703
  }]
77720
78704
  },
78705
+ "ir-transmitter": {
78706
+ scope: "device",
78707
+ noun: t("IR / RF transmitter", "Trasmettitore IR / RF"),
78708
+ notOperatorFacing: { send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it" }
78709
+ },
77721
78710
  control: {
77722
78711
  scope: "device",
77723
78712
  noun: t("Control", "Controllo"),
@@ -78371,6 +79360,100 @@ var APPLIANCE_CAP_VOCABULARY = {
78371
79360
  }
78372
79361
  ]
78373
79362
  },
79363
+ "pet-fountain": {
79364
+ scope: "device",
79365
+ noun: t("Pet fountain", "Fontana per animali"),
79366
+ actions: [
79367
+ {
79368
+ id: "petFountain.pumpOn",
79369
+ method: "setPump",
79370
+ label: t("Pump on", "Pompa accesa"),
79371
+ phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
79372
+ icon: "play",
79373
+ args: { on: true }
79374
+ },
79375
+ {
79376
+ id: "petFountain.pumpOff",
79377
+ method: "setPump",
79378
+ label: t("Pump off", "Pompa spenta"),
79379
+ phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
79380
+ icon: "square",
79381
+ args: { on: false }
79382
+ },
79383
+ {
79384
+ id: "petFountain.intervalOn",
79385
+ method: "setPumpInterval",
79386
+ label: t("Pump cycle on", "Ciclo pompa attivo"),
79387
+ phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
79388
+ icon: "timer",
79389
+ args: { on: true }
79390
+ },
79391
+ {
79392
+ id: "petFountain.intervalOff",
79393
+ method: "setPumpInterval",
79394
+ label: t("Pump cycle off", "Ciclo pompa spento"),
79395
+ phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
79396
+ icon: "timer-off",
79397
+ args: { on: false }
79398
+ },
79399
+ {
79400
+ id: "petFountain.pumpOnMinutes",
79401
+ method: "setPumpOnMinutes",
79402
+ label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
79403
+ phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
79404
+ icon: "timer",
79405
+ openArgs: [{
79406
+ key: "minutes",
79407
+ label: t("Minutes", "Minuti"),
79408
+ offer: {
79409
+ kind: "number",
79410
+ min: 0,
79411
+ step: 1,
79412
+ unit: "min"
79413
+ }
79414
+ }]
79415
+ },
79416
+ {
79417
+ id: "petFountain.pumpOffMinutes",
79418
+ method: "setPumpOffMinutes",
79419
+ label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
79420
+ phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
79421
+ icon: "timer-off",
79422
+ openArgs: [{
79423
+ key: "minutes",
79424
+ label: t("Minutes", "Minuti"),
79425
+ offer: {
79426
+ kind: "number",
79427
+ min: 0,
79428
+ step: 1,
79429
+ unit: "min"
79430
+ }
79431
+ }]
79432
+ },
79433
+ {
79434
+ id: "petFountain.resetDailyConsumption",
79435
+ method: "resetDailyConsumption",
79436
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
79437
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
79438
+ icon: "rotate-ccw"
79439
+ }
79440
+ ],
79441
+ state: [{
79442
+ kind: "boolean",
79443
+ field: "empty",
79444
+ label: t("Tank empty", "Serbatoio vuoto"),
79445
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
79446
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
79447
+ icon: "droplet"
79448
+ }, {
79449
+ kind: "numeric",
79450
+ field: "waterLevel",
79451
+ quantity: t("the water level", "il livello dell’acqua"),
79452
+ label: t("Water level", "Livello dell’acqua"),
79453
+ unit: "%",
79454
+ icon: "droplets"
79455
+ }]
79456
+ },
78374
79457
  "media-player": {
78375
79458
  scope: "device",
78376
79459
  noun: t("Media player", "Lettore multimediale"),
@@ -80195,6 +81278,7 @@ var SYSTEM_CAP_VOCABULARY = {
80195
81278
  "device-manager": system("the device registry itself — rename, move and remove are administration"),
80196
81279
  "device-provider": system(INTERNAL),
80197
81280
  "device-removal-hook": system(INTERNAL),
81281
+ "node-removal-hook": system(INTERNAL),
80198
81282
  "device-state": system("the runtime-state mirror every trigger already reads through"),
80199
81283
  "display-palette": system("the cluster display palette — one colour table for every client, not a device action"),
80200
81284
  "embedding-encoder": system(ML),
@@ -80234,6 +81318,7 @@ var SYSTEM_CAP_VOCABULARY = {
80234
81318
  "recording-archive": system(STORAGE),
80235
81319
  "recording-export": system("recording exports — requested from the timeline, not an automation step"),
80236
81320
  records: system(INTERNAL),
81321
+ remote: system("the per-device remote setup — authored in the Customize remote editor, sent through the remote UI"),
80237
81322
  "server-management": system(CLUSTER),
80238
81323
  "settings-store": system(INTERNAL),
80239
81324
  "smtp-provider": system(INTERNAL),
@@ -80246,6 +81331,7 @@ var SYSTEM_CAP_VOCABULARY = {
80246
81331
  "storage-provider": system(STORAGE),
80247
81332
  "stream-broker": system(PIPELINE),
80248
81333
  system: system(CLUSTER),
81334
+ template: system("operator-authored templates — edited in their own editor, never actuated"),
80249
81335
  "terminal-session": system(CLUSTER),
80250
81336
  toast: system(UI_PLUMBING),
80251
81337
  training: system(ML),
@@ -80305,7 +81391,7 @@ function projectAction(cap, action) {
80305
81391
  };
80306
81392
  }
80307
81393
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
80308
- 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;
81394
+ 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;
80309
81395
  DeviceFeature.BatteryOperated;
80310
81396
  /**
80311
81397
  * How a washer, dryer or dishwasher leaves CamStack.
@@ -81462,6 +82548,16 @@ Object.freeze({
81462
82548
  form: "single",
81463
82549
  optional: false
81464
82550
  }],
82551
+ "irTransmitter.getInfo": [{
82552
+ name: "deviceId",
82553
+ form: "single",
82554
+ optional: false
82555
+ }],
82556
+ "irTransmitter.send": [{
82557
+ name: "deviceId",
82558
+ form: "single",
82559
+ optional: false
82560
+ }],
81465
82561
  "keychain.deleteDeviceScope": [{
81466
82562
  name: "deviceId",
81467
82563
  form: "single",
@@ -81871,6 +82967,36 @@ Object.freeze({
81871
82967
  form: "single",
81872
82968
  optional: false
81873
82969
  }],
82970
+ "petFountain.getStatus": [{
82971
+ name: "deviceId",
82972
+ form: "single",
82973
+ optional: false
82974
+ }],
82975
+ "petFountain.resetDailyConsumption": [{
82976
+ name: "deviceId",
82977
+ form: "single",
82978
+ optional: false
82979
+ }],
82980
+ "petFountain.setPump": [{
82981
+ name: "deviceId",
82982
+ form: "single",
82983
+ optional: false
82984
+ }],
82985
+ "petFountain.setPumpInterval": [{
82986
+ name: "deviceId",
82987
+ form: "single",
82988
+ optional: false
82989
+ }],
82990
+ "petFountain.setPumpOffMinutes": [{
82991
+ name: "deviceId",
82992
+ form: "single",
82993
+ optional: false
82994
+ }],
82995
+ "petFountain.setPumpOnMinutes": [{
82996
+ name: "deviceId",
82997
+ form: "single",
82998
+ optional: false
82999
+ }],
81874
83000
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
81875
83001
  name: "deviceId",
81876
83002
  form: "single",
@@ -82687,6 +83813,31 @@ Object.freeze({
82687
83813
  form: "single",
82688
83814
  optional: true
82689
83815
  }],
83816
+ "remote.getConfig": [{
83817
+ name: "deviceId",
83818
+ form: "single",
83819
+ optional: false
83820
+ }],
83821
+ "remote.listCommands": [{
83822
+ name: "deviceId",
83823
+ form: "single",
83824
+ optional: false
83825
+ }],
83826
+ "remote.sendCommand": [{
83827
+ name: "deviceId",
83828
+ form: "single",
83829
+ optional: false
83830
+ }],
83831
+ "remote.sendMediaCommand": [{
83832
+ name: "deviceId",
83833
+ form: "single",
83834
+ optional: false
83835
+ }],
83836
+ "remote.setConfig": [{
83837
+ name: "deviceId",
83838
+ form: "single",
83839
+ optional: false
83840
+ }],
82690
83841
  "runningState.getStatus": [{
82691
83842
  name: "deviceId",
82692
83843
  form: "single",
@@ -84596,6 +85747,14 @@ function resolveGrantDeviceIds(scopes, fleet, access) {
84596
85747
  String.raw`(?<=^|["'(\s>,\[{])`;
84597
85748
  var MB = 1024 * 1024;
84598
85749
  1024 * MB, 3072 * MB;
85750
+ object({
85751
+ manufacturer: string().optional(),
85752
+ supportedModels: array(string()).optional(),
85753
+ supportedController: string().optional(),
85754
+ commandsEncoding: string(),
85755
+ delay: number().nonnegative().optional(),
85756
+ commands: record(string(), unknown())
85757
+ });
84599
85758
  //#endregion
84600
85759
  //#region src/custom-actions.ts
84601
85760
  /**
@@ -84782,7 +85941,7 @@ async function releaseAlexaEgress(input) {
84782
85941
  tags: { deviceId },
84783
85942
  meta: {
84784
85943
  pipelineKey,
84785
- error: errMsg(err)
85944
+ error: errMsg$1(err)
84786
85945
  }
84787
85946
  });
84788
85947
  }
@@ -84836,12 +85995,154 @@ async function profileForCamStream(input) {
84836
85995
  } catch (err) {
84837
85996
  input.logger?.warn("alexa rtc-session: could not read the profile slots", {
84838
85997
  tags: { deviceId: input.deviceId },
84839
- meta: { error: errMsg(err) }
85998
+ meta: { error: errMsg$1(err) }
84840
85999
  });
84841
86000
  return null;
84842
86001
  }
84843
86002
  }
84844
86003
  //#endregion
86004
+ //#region src/egress/alexa-source-profile.ts
86005
+ async function resolveAlexaSourceProfile(input) {
86006
+ const { api, deviceId, exposedEntry } = input;
86007
+ const log = input.logger;
86008
+ const pinnedProfile = (() => {
86009
+ const pref = exposedEntry?.settings?.streamPreference;
86010
+ if (pref === "low" || pref === "mid" || pref === "high") return pref;
86011
+ })();
86012
+ const allowTranscode = exposedEntry?.settings?.allowTranscode !== false;
86013
+ const scored = pinnedProfile === void 0 ? await api.cameraStreams.pickStream.query({
86014
+ deviceId,
86015
+ requirements: {
86016
+ acceptCodecs: ["h264"],
86017
+ minHeight: 480,
86018
+ maxHeight: ALEXA_MAX_LINES,
86019
+ excludeDerived: true,
86020
+ allowTranscode
86021
+ },
86022
+ preferences: { targetHeight: 720 }
86023
+ }).catch((err) => {
86024
+ log.warn("alexa rtc-session: pickStream threw — falling back to the high slot", {
86025
+ tags: { deviceId },
86026
+ meta: { error: err instanceof Error ? err.message : String(err) }
86027
+ });
86028
+ return null;
86029
+ }) : null;
86030
+ const scoredProfile = scored === null ? null : await profileForCamStream({
86031
+ api,
86032
+ deviceId,
86033
+ camStreamId: scored.camStreamId,
86034
+ logger: log
86035
+ });
86036
+ const sourceProfile = pinnedProfile ?? scoredProfile ?? "high";
86037
+ if (pinnedProfile === void 0) log.info("alexa rtc-session: source scored against the Echo requirements", {
86038
+ tags: { deviceId },
86039
+ meta: {
86040
+ chosen: sourceProfile,
86041
+ scored: scored === null ? "none-eligible" : scored.reason,
86042
+ camStreamId: scored?.camStreamId ?? null,
86043
+ slot: scoredProfile ?? (scored === null ? null : "no-slot"),
86044
+ height: scored?.resolution?.height ?? null,
86045
+ transcodes: scored?.transcodes ?? null,
86046
+ allowTranscode
86047
+ }
86048
+ });
86049
+ return sourceProfile;
86050
+ }
86051
+ var AlexaEgressPrewarm = class {
86052
+ deps;
86053
+ holds = /* @__PURE__ */ new Map();
86054
+ holdMs;
86055
+ disposed = false;
86056
+ constructor(deps) {
86057
+ this.deps = deps;
86058
+ this.holdMs = deps.holdMs ?? 3e4;
86059
+ }
86060
+ /** A doorbell press for `deviceId`. Never throws. */
86061
+ async onPress(deviceId) {
86062
+ const { api, logger } = this.deps;
86063
+ if (this.disposed) return;
86064
+ if (this.holds.has(deviceId)) {
86065
+ logger.debug("alexa egress prewarm: a hold is already pending, press ignored", { tags: { deviceId } });
86066
+ return;
86067
+ }
86068
+ if (this.deps.hasLiveSession(deviceId)) {
86069
+ logger.info("alexa egress prewarm: an Alexa session is already live, nothing to warm", { tags: { deviceId } });
86070
+ return;
86071
+ }
86072
+ const hold = {
86073
+ pipelineKey: null,
86074
+ timer: null
86075
+ };
86076
+ this.holds.set(deviceId, hold);
86077
+ const sessionId = `prewarm-${deviceId}-${Date.now()}`;
86078
+ try {
86079
+ const sourceProfile = await resolveAlexaSourceProfile({
86080
+ api,
86081
+ deviceId,
86082
+ exposedEntry: this.deps.listExposed().find((e) => e.deviceId === deviceId),
86083
+ logger
86084
+ });
86085
+ const acquired = await acquireAlexaEgress({
86086
+ api,
86087
+ deviceId,
86088
+ sourceProfile,
86089
+ sessionId,
86090
+ logger
86091
+ });
86092
+ hold.pipelineKey = acquired.pipelineKey;
86093
+ if (this.disposed || this.holds.get(deviceId) !== hold) {
86094
+ await this.release(deviceId, hold, "disposed before the hold was armed");
86095
+ return;
86096
+ }
86097
+ hold.timer = setTimeout(() => {
86098
+ this.release(deviceId, hold, "no session arrived");
86099
+ }, this.holdMs);
86100
+ hold.timer.unref?.();
86101
+ logger.info("alexa egress prewarm: transcode held for the coming session", {
86102
+ tags: { deviceId },
86103
+ meta: {
86104
+ pipelineKey: acquired.pipelineKey,
86105
+ sourceProfile,
86106
+ holdMs: this.holdMs
86107
+ }
86108
+ });
86109
+ } catch (err) {
86110
+ this.holds.delete(deviceId);
86111
+ logger.warn("alexa egress prewarm: acquire failed, the session will start the transcode", {
86112
+ tags: { deviceId },
86113
+ meta: { error: err instanceof Error ? err.message : String(err) }
86114
+ });
86115
+ }
86116
+ }
86117
+ /** Release every pending hold (addon shutdown). */
86118
+ async dispose() {
86119
+ this.disposed = true;
86120
+ const pending = [...this.holds.entries()];
86121
+ await Promise.all(pending.map(([deviceId, hold]) => this.release(deviceId, hold, "shutdown")));
86122
+ }
86123
+ async release(deviceId, hold, reason) {
86124
+ if (hold.timer) clearTimeout(hold.timer);
86125
+ hold.timer = null;
86126
+ if (this.holds.get(deviceId) === hold) this.holds.delete(deviceId);
86127
+ const pipelineKey = hold.pipelineKey;
86128
+ hold.pipelineKey = null;
86129
+ if (pipelineKey === null) return;
86130
+ await releaseAlexaEgress({
86131
+ api: this.deps.api,
86132
+ deviceId,
86133
+ pipelineKey,
86134
+ logger: this.deps.logger
86135
+ });
86136
+ this.deps.logger.info("alexa egress prewarm: hold released", {
86137
+ tags: { deviceId },
86138
+ meta: {
86139
+ pipelineKey,
86140
+ reason
86141
+ }
86142
+ });
86143
+ }
86144
+ };
86145
+ //#endregion
84845
86146
  //#region src/handlers/endpoint-id.ts
84846
86147
  /** The classes a camera publishes a detection sensor for (R1). */
84847
86148
  var DETECTION_SENSOR_CLASSES = [
@@ -85118,47 +86419,12 @@ async function handleInitiateSessionWithOffer(header, endpointRaw, payloadRaw, d
85118
86419
  if (sdpOffer.length === 0) return errorEnvelope(header, "INVALID_DIRECTIVE", "offer.value is empty");
85119
86420
  const api = deps.ctx.api;
85120
86421
  const exposedEntry = deps.listExposed().find((e) => e.deviceId === deviceId);
85121
- const pinnedProfile = (() => {
85122
- const pref = exposedEntry?.settings?.streamPreference;
85123
- if (pref === "low" || pref === "mid" || pref === "high") return pref;
85124
- })();
85125
- const allowTranscode = exposedEntry?.settings?.allowTranscode !== false;
85126
- const scored = pinnedProfile === void 0 ? await api.cameraStreams.pickStream.query({
85127
- deviceId,
85128
- requirements: {
85129
- acceptCodecs: ["h264"],
85130
- minHeight: 480,
85131
- maxHeight: ALEXA_MAX_LINES,
85132
- excludeDerived: true,
85133
- allowTranscode
85134
- },
85135
- preferences: { targetHeight: 720 }
85136
- }).catch((err) => {
85137
- log.warn("alexa rtc-session: pickStream threw — falling back to the high slot", {
85138
- tags: { deviceId },
85139
- meta: { error: err instanceof Error ? err.message : String(err) }
85140
- });
85141
- return null;
85142
- }) : null;
85143
- const scoredProfile = scored === null ? null : await profileForCamStream({
86422
+ const sourceProfile = await resolveAlexaSourceProfile({
85144
86423
  api,
85145
86424
  deviceId,
85146
- camStreamId: scored.camStreamId,
86425
+ exposedEntry,
85147
86426
  logger: log
85148
86427
  });
85149
- const sourceProfile = pinnedProfile ?? scoredProfile ?? "high";
85150
- if (pinnedProfile === void 0) log.info("alexa rtc-session: source scored against the Echo requirements", {
85151
- tags: { deviceId },
85152
- meta: {
85153
- chosen: sourceProfile,
85154
- scored: scored === null ? "none-eligible" : scored.reason,
85155
- camStreamId: scored?.camStreamId ?? null,
85156
- slot: scoredProfile ?? (scored === null ? null : "no-slot"),
85157
- height: scored?.resolution?.height ?? null,
85158
- transcodes: scored?.transcodes ?? null,
85159
- allowTranscode
85160
- }
85161
- });
85162
86428
  let derivedTarget;
85163
86429
  /**
85164
86430
  * The primitive's release handle, when this session acquired one. Recorded so
@@ -86801,7 +88067,7 @@ async function pollUntilReached(plan, deps, untilMs) {
86801
88067
  const read = await plan.read().catch((err) => {
86802
88068
  deps.logger.debug("alexa deferred directive: read-back failed — polling on", {
86803
88069
  tags: { deviceId: plan.deviceId },
86804
- meta: { error: errMsg(err) }
88070
+ meta: { error: errMsg$1(err) }
86805
88071
  });
86806
88072
  return null;
86807
88073
  });
@@ -86849,7 +88115,7 @@ async function runWithDeferral(plan, deps) {
86849
88115
  try {
86850
88116
  await plan.command();
86851
88117
  } catch (err) {
86852
- const message = errMsg(err);
88118
+ const message = errMsg$1(err);
86853
88119
  deps.logger.warn(`alexa deferred directive: ${plan.header.name} command failed`, {
86854
88120
  tags: { deviceId: plan.deviceId },
86855
88121
  meta: { error: message }
@@ -86867,7 +88133,7 @@ async function runWithDeferral(plan, deps) {
86867
88133
  const settled = settleInBackground(plan, deps).catch((err) => {
86868
88134
  deps.logger.warn("alexa deferred directive: settling failed", {
86869
88135
  tags: { deviceId: plan.deviceId },
86870
- meta: { error: errMsg(err) }
88136
+ meta: { error: errMsg$1(err) }
86871
88137
  });
86872
88138
  });
86873
88139
  return {
@@ -88615,13 +89881,13 @@ var AlexaAccessGate = class {
88615
89881
  if (!this.warnedStale) {
88616
89882
  this.warnedStale = true;
88617
89883
  this.deps.logger.warn("alexa access: the hub user store could not be re-read — keeping the last good grants", { meta: {
88618
- error: errMsg(err),
89884
+ error: errMsg$1(err),
88619
89885
  ageMs: this.now() - cached.at
88620
89886
  } });
88621
89887
  }
88622
89888
  return cached;
88623
89889
  }
88624
- this.deps.logger.warn("alexa access: the hub user store could not be read — refusing Alexa access until it can", { meta: { error: errMsg(err) } });
89890
+ this.deps.logger.warn("alexa access: the hub user store could not be read — refusing Alexa access until it can", { meta: { error: errMsg$1(err) } });
88625
89891
  return null;
88626
89892
  }
88627
89893
  }
@@ -88638,7 +89904,7 @@ var AlexaAccessGate = class {
88638
89904
  } catch (err) {
88639
89905
  this.deps.logger.debug("alexa access: device metadata read failed", {
88640
89906
  tags: { deviceId },
88641
- meta: { error: errMsg(err) }
89907
+ meta: { error: errMsg$1(err) }
88642
89908
  });
88643
89909
  return cached?.meta ?? null;
88644
89910
  }
@@ -88673,12 +89939,209 @@ async function readConnectivity(api, deviceId, logger) {
88673
89939
  } catch (err) {
88674
89940
  logger.debug("alexa: device-status unreadable — reporting connectivity OK", {
88675
89941
  tags: { deviceId },
88676
- meta: { error: errMsg(err) }
89942
+ meta: { error: errMsg$1(err) }
88677
89943
  });
88678
89944
  return "OK";
88679
89945
  }
88680
89946
  }
88681
89947
  //#endregion
89948
+ //#region src/action-scenes.ts
89949
+ /**
89950
+ * Actions exported to Alexa as SCENES (D968).
89951
+ *
89952
+ * Alexa has no "run" verb for an arbitrary automation, but it has a scene: an
89953
+ * endpoint with `Alexa.SceneController` whose Activate directive fires
89954
+ * something. An action is exactly that, so it is exported as a scene trigger
89955
+ * and Activate runs `actions.run`.
89956
+ *
89957
+ * An action is a list entry, never a device (D954), so its endpoint id lives
89958
+ * outside the numeric device id space (`action:<id>`, which the device id
89959
+ * parser rejects) and nothing here touches the device registry or the
89960
+ * per-device sync engine.
89961
+ *
89962
+ * `actions.run` is an admin act, so only an ADMIN link sees or fires a scene.
89963
+ * A scoped (non-admin) link is told the endpoint does not exist.
89964
+ *
89965
+ * Whether the run is accepted is decided by `actions.run`: an action that is
89966
+ * already running or in cooldown is refused with a named reason (logged by
89967
+ * `runExportedAction`) and answered `ENDPOINT_BUSY` — never queued.
89968
+ */
89969
+ var EXPORTER = "export-alexa";
89970
+ var PREFIX = "action:";
89971
+ var SCENE_INTERFACE = "Alexa.SceneController";
89972
+ function actionEndpointId(actionId) {
89973
+ return `${PREFIX}${actionId}`;
89974
+ }
89975
+ /** The action id an endpoint id names, or null when it is not an action endpoint. */
89976
+ function parseActionEndpointId(endpointId) {
89977
+ if (!endpointId.startsWith(PREFIX)) return null;
89978
+ const id = endpointId.slice(7);
89979
+ return id.length === 0 ? null : id;
89980
+ }
89981
+ function buildActionSceneEndpoint(entry) {
89982
+ return {
89983
+ endpointId: actionEndpointId(entry.actionId),
89984
+ manufacturerName: "CamStack",
89985
+ description: "CamStack action",
89986
+ friendlyName: entry.displayName,
89987
+ displayCategories: ["SCENE_TRIGGER"],
89988
+ capabilities: [{
89989
+ type: "AlexaInterface",
89990
+ interface: "Alexa",
89991
+ version: "3"
89992
+ }, {
89993
+ type: "AlexaInterface",
89994
+ interface: SCENE_INTERFACE,
89995
+ version: "3",
89996
+ supportsDeactivation: false,
89997
+ proactivelyReported: false
89998
+ }]
89999
+ };
90000
+ }
90001
+ function sceneResponse(header, endpointId) {
90002
+ return { event: {
90003
+ header: {
90004
+ namespace: SCENE_INTERFACE,
90005
+ name: "ActivationStarted",
90006
+ messageId: header.messageId,
90007
+ ...header.correlationToken !== void 0 ? { correlationToken: header.correlationToken } : {},
90008
+ payloadVersion: "3"
90009
+ },
90010
+ endpoint: { endpointId },
90011
+ payload: {
90012
+ cause: { type: "VOICE_INTERACTION" },
90013
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
90014
+ }
90015
+ } };
90016
+ }
90017
+ /** Answer a directive addressed to an action endpoint. */
90018
+ async function handleActionSceneDirective(header, endpoint, principal, deps) {
90019
+ const actionId = parseActionEndpointId(endpoint.endpointId);
90020
+ if (actionId === null) return errorEnvelope(header, "NO_SUCH_ENDPOINT", "not an action endpoint");
90021
+ if (principal.kind !== "admin" || !deps.isExposed(actionId)) {
90022
+ deps.logger.warn("alexa action-scene: directive refused — endpoint not visible to this link", {
90023
+ tags: { actionId },
90024
+ meta: { reason: principal.kind !== "admin" ? "not-admin" : "not-exported" }
90025
+ });
90026
+ return errorEnvelope(header, "NO_SUCH_ENDPOINT", "unknown endpoint");
90027
+ }
90028
+ if (header.namespace !== SCENE_INTERFACE || header.name !== "Activate") return errorEnvelope(header, "INVALID_DIRECTIVE", "an action endpoint only supports Activate");
90029
+ const result = await runExportedAction(deps.api, deps.logger, {
90030
+ exporter: EXPORTER,
90031
+ actionId
90032
+ });
90033
+ switch (result.status) {
90034
+ case "started": return sceneResponse(header, endpoint.endpointId);
90035
+ case "refused": return result.reason === "not-found" ? errorEnvelope(header, "NO_SUCH_ENDPOINT", "the action no longer exists") : errorEnvelope(header, "ENDPOINT_BUSY", `the action cannot run now (${result.reason})`);
90036
+ case "failed": return errorEnvelope(header, "ENDPOINT_UNREACHABLE", result.message);
90037
+ }
90038
+ }
90039
+ function errMsg(err) {
90040
+ return err instanceof Error ? err.message : String(err);
90041
+ }
90042
+ var ActionSceneExports = class {
90043
+ ports;
90044
+ entries;
90045
+ constructor(ports, initial) {
90046
+ this.ports = ports;
90047
+ this.entries = initial;
90048
+ }
90049
+ isExposed(actionId) {
90050
+ return this.entries.some((e) => e.actionId === actionId);
90051
+ }
90052
+ list() {
90053
+ return this.entries.map((e) => ({
90054
+ entity: {
90055
+ kind: "action",
90056
+ actionId: e.actionId
90057
+ },
90058
+ exposedAs: e.displayName
90059
+ }));
90060
+ }
90061
+ /** The scenes Discovery adds for this link: admins only. */
90062
+ endpointsFor(principal) {
90063
+ if (principal.kind !== "admin") return [];
90064
+ return this.entries.map(buildActionSceneEndpoint);
90065
+ }
90066
+ async expose(actionId) {
90067
+ const action = (await this.ports.api.actions.list.query({})).find((a) => a.id === actionId);
90068
+ if (action === void 0) throw new Error(`export-alexa: action '${actionId}' does not exist`);
90069
+ const entry = {
90070
+ actionId,
90071
+ displayName: action.name,
90072
+ addedAt: this.entries.find((e) => e.actionId === actionId)?.addedAt ?? Date.now()
90073
+ };
90074
+ await this.save([...this.entries.filter((e) => e.actionId !== actionId), entry]);
90075
+ await this.pushToAdmins([buildActionSceneEndpoint(entry)]);
90076
+ this.ports.logger.info("export-alexa: exposed action as a scene", {
90077
+ tags: { actionId },
90078
+ meta: { displayName: action.name }
90079
+ });
90080
+ }
90081
+ async unexpose(actionId) {
90082
+ if (this.isExposed(actionId)) await this.save(this.entries.filter((e) => e.actionId !== actionId));
90083
+ await this.deleteFromAll([actionEndpointId(actionId)]);
90084
+ this.ports.logger.info("export-alexa: unexposed action scene", { tags: { actionId } });
90085
+ }
90086
+ /** Push every scene (boot, relink). */
90087
+ async pushAll() {
90088
+ await this.pushToAdmins(this.entries.map(buildActionSceneEndpoint));
90089
+ }
90090
+ /**
90091
+ * Drop what the operator deleted. An action list that could not be read
90092
+ * changes nothing (D49).
90093
+ */
90094
+ async reconcile() {
90095
+ if (this.entries.length === 0) return;
90096
+ let live;
90097
+ try {
90098
+ const actions = await this.ports.api.actions.list.query({});
90099
+ live = new Set(actions.map((a) => a.id));
90100
+ } catch (err) {
90101
+ this.ports.logger.warn("export-alexa: action scenes not reconciled — list unanswered", { meta: { error: errMsg(err) } });
90102
+ return;
90103
+ }
90104
+ const { dropped } = pruneDeletedEntities(this.entries.map((e) => ({
90105
+ kind: "action",
90106
+ actionId: e.actionId
90107
+ })), {
90108
+ actionIds: live,
90109
+ targetIds: /* @__PURE__ */ new Set()
90110
+ }, this.ports.logger, EXPORTER);
90111
+ if (dropped.length === 0) return;
90112
+ const gone = new Set(dropped.flatMap((r) => r.kind === "action" ? [r.actionId] : []));
90113
+ await this.save(this.entries.filter((e) => !gone.has(e.actionId)));
90114
+ await this.deleteFromAll([...gone].map(actionEndpointId));
90115
+ }
90116
+ async save(next) {
90117
+ this.entries = next;
90118
+ await this.ports.persist(next);
90119
+ }
90120
+ async pushToAdmins(endpoints) {
90121
+ if (endpoints.length === 0 || !this.ports.canPush()) return;
90122
+ for (const userId of this.ports.linkedUserIds()) try {
90123
+ if (!await this.ports.isAdminUser(userId)) continue;
90124
+ await this.ports.postAddOrUpdate(userId, endpoints);
90125
+ } catch (err) {
90126
+ this.ports.logger.warn("export-alexa: action scene push failed", { meta: {
90127
+ userId,
90128
+ error: errMsg(err)
90129
+ } });
90130
+ }
90131
+ }
90132
+ async deleteFromAll(ids) {
90133
+ if (ids.length === 0 || !this.ports.canPush()) return;
90134
+ for (const userId of this.ports.linkedUserIds()) try {
90135
+ await this.ports.postDelete(userId, ids);
90136
+ } catch (err) {
90137
+ this.ports.logger.warn("export-alexa: action scene delete failed", { meta: {
90138
+ userId,
90139
+ error: errMsg(err)
90140
+ } });
90141
+ }
90142
+ }
90143
+ };
90144
+ //#endregion
88682
90145
  //#region src/endpoints/validate-instanced.ts
88683
90146
  /**
88684
90147
  * Amazon's rules for the INSTANCED interfaces' extra fields (D869), the ones a
@@ -88902,7 +90365,8 @@ var ALLOWED_INTERFACE_VERSIONS = {
88902
90365
  "Alexa.ThermostatController": "3.1",
88903
90366
  "Alexa.SmartVision.SnapshotProvider": "1.1",
88904
90367
  "Alexa.SmartVision.ObjectDetectionSensor": "1.0",
88905
- "Alexa.DataController": "1.0"
90368
+ "Alexa.DataController": "1.0",
90369
+ "Alexa.SceneController": "3"
88906
90370
  };
88907
90371
  /** `imageNetClass` values Amazon accepts (alexa-smartvision-objectdetectionsensor). */
88908
90372
  var SMART_VISION_CLASSES = new Set(["person", "package"]);
@@ -88944,6 +90408,7 @@ var DISPLAY_CATEGORIES = new Set([
88944
90408
  "DOOR",
88945
90409
  "GATE",
88946
90410
  "GARAGE_DOOR",
90411
+ "SCENE_TRIGGER",
88947
90412
  "OTHER"
88948
90413
  ]);
88949
90414
  var ENDPOINT_ID_PATTERN = /^[A-Za-z0-9 _\-=#;:?@&]{1,256}$/;
@@ -90839,6 +92304,7 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
90839
92304
  "Alexa.DataController/DeleteData": "view",
90840
92305
  "Alexa.LockController/Lock": "create",
90841
92306
  "Alexa.LockController/Unlock": "create",
92307
+ "Alexa.SceneController/Activate": "create",
90842
92308
  ...Object.fromEntries(GENERIC_DIRECTIVE_KEYS.map((k) => [k, "create"]))
90843
92309
  };
90844
92310
  try {
@@ -90870,6 +92336,17 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
90870
92336
  body: errorEnvelope(header, "INTERNAL_ERROR", lookup.error)
90871
92337
  };
90872
92338
  principal = lookup.principal;
92339
+ if (endpoint !== void 0 && deps.actionScenes !== void 0 && parseActionEndpointId(endpoint.endpointId) !== null) {
92340
+ const scenes = deps.actionScenes;
92341
+ return {
92342
+ status: 200,
92343
+ body: await handleActionSceneDirective(header, endpoint, principal, {
92344
+ api: scenes.api,
92345
+ logger: scenes.logger,
92346
+ isExposed: (actionId) => scenes.exports.isExposed(actionId)
92347
+ })
92348
+ };
92349
+ }
90873
92350
  if (key !== "Alexa.Discovery/Discover") {
90874
92351
  if (endpoint === void 0) return {
90875
92352
  status: 200,
@@ -90922,7 +92399,8 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
90922
92399
  reason: describeRefusal(r.refusal)
90923
92400
  }))
90924
92401
  } });
90925
- const valid = withholdInvalidEndpoints(filtered.kept, (message, violations) => {
92402
+ const scenes = deps.actionScenes?.exports.endpointsFor(who) ?? [];
92403
+ const valid = withholdInvalidEndpoints([...filtered.kept, ...scenes], (message, violations) => {
90926
92404
  deps.discovery.logger.warn(message, { meta: {
90927
92405
  userId: callerIdentity.userId,
90928
92406
  violations
@@ -91971,6 +93449,7 @@ var LwaEventGateway = class {
91971
93449
  return;
91972
93450
  }
91973
93451
  if (!this.hasProactiveCredentials()) return;
93452
+ this.deps.onExposedDoorbellPress?.(parentDeviceId);
91974
93453
  for (const account of linked) {
91975
93454
  if (!this.mayPush(account.userId, parentDeviceId, "doorbell press")) continue;
91976
93455
  if (!this.findToken(account.userId)) {
@@ -93194,7 +94673,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93194
94673
  tags: { deviceId },
93195
94674
  meta: {
93196
94675
  userId: change.userId,
93197
- error: errMsg(err)
94676
+ error: errMsg$1(err)
93198
94677
  }
93199
94678
  });
93200
94679
  return false;
@@ -93213,7 +94692,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93213
94692
  tags: { deviceId },
93214
94693
  meta: {
93215
94694
  userId: change.userId,
93216
- error: errMsg(err)
94695
+ error: errMsg$1(err)
93217
94696
  }
93218
94697
  });
93219
94698
  return false;
@@ -93267,7 +94746,7 @@ var DetectionClassSource = class {
93267
94746
  } catch (err) {
93268
94747
  this.deps.logger.debug("alexa detection sensors: class read failed — keeping the last answer", {
93269
94748
  tags: { deviceId },
93270
- meta: { error: errMsg(err) }
94749
+ meta: { error: errMsg$1(err) }
93271
94750
  });
93272
94751
  return prev?.classes ?? [];
93273
94752
  }
@@ -93360,7 +94839,7 @@ var DetectionSensorFeed = class {
93360
94839
  } catch (err) {
93361
94840
  this.deps.logger.debug("alexa detection sensors: active-track read failed — kept as is", {
93362
94841
  tags: { deviceId },
93363
- meta: { error: errMsg(err) }
94842
+ meta: { error: errMsg$1(err) }
93364
94843
  });
93365
94844
  }
93366
94845
  }
@@ -93372,7 +94851,7 @@ var DetectionSensorFeed = class {
93372
94851
  meta: {
93373
94852
  detectionClass: cls,
93374
94853
  present,
93375
- error: errMsg(err)
94854
+ error: errMsg$1(err)
93376
94855
  }
93377
94856
  });
93378
94857
  });
@@ -93491,7 +94970,7 @@ var ObjectDetectionFeed = class {
93491
94970
  tags: { deviceId: parsed.data.deviceId },
93492
94971
  meta: {
93493
94972
  trackId: parsed.data.trackId,
93494
- error: errMsg(err)
94973
+ error: errMsg$1(err)
93495
94974
  }
93496
94975
  });
93497
94976
  });
@@ -93681,7 +95160,7 @@ var AlexaVisionRuntime = class {
93681
95160
  } catch (err) {
93682
95161
  this.deps.logger.debug("alexa: per-device settings unreadable — using defaults", {
93683
95162
  tags: { deviceId },
93684
- meta: { error: errMsg(err) }
95163
+ meta: { error: errMsg$1(err) }
93685
95164
  });
93686
95165
  return {};
93687
95166
  }
@@ -93779,7 +95258,7 @@ var AlexaVisionRuntime = class {
93779
95258
  tags: { deviceId },
93780
95259
  meta: {
93781
95260
  trackId,
93782
- error: errMsg(err)
95261
+ error: errMsg$1(err)
93783
95262
  }
93784
95263
  });
93785
95264
  return null;
@@ -94449,7 +95928,7 @@ var StateChangeReporter = class {
94449
95928
  shaper;
94450
95929
  constructor(deps) {
94451
95930
  this.deps = deps;
94452
- this.shaper = new ReportShaper((err) => this.deps.logger.warn("alexa state reports: a shaped report failed", { meta: { error: errMsg(err) } }), this.deps.clock);
95931
+ this.shaper = new ReportShaper((err) => this.deps.logger.warn("alexa state reports: a shaped report failed", { meta: { error: errMsg$1(err) } }), this.deps.clock);
94453
95932
  }
94454
95933
  start() {
94455
95934
  this.off = this.deps.eventBus.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
@@ -94486,7 +95965,7 @@ var StateChangeReporter = class {
94486
95965
  tags: { deviceId: change.deviceId },
94487
95966
  meta: {
94488
95967
  capName: change.capName,
94489
- error: errMsg(err)
95968
+ error: errMsg$1(err)
94490
95969
  }
94491
95970
  });
94492
95971
  }
@@ -94520,7 +95999,7 @@ var StateChangeReporter = class {
94520
95999
  tags: { deviceId: change.deviceId },
94521
96000
  meta: {
94522
96001
  capName: change.capName,
94523
- error: errMsg(err)
96002
+ error: errMsg$1(err)
94524
96003
  }
94525
96004
  });
94526
96005
  }
@@ -94609,7 +96088,7 @@ var StateReconciler = class {
94609
96088
  });
94610
96089
  }
94611
96090
  } catch (err) {
94612
- this.deps.logger.warn("alexa state reconcile: a pass failed", { meta: { error: errMsg(err) } });
96091
+ this.deps.logger.warn("alexa state reconcile: a pass failed", { meta: { error: errMsg$1(err) } });
94613
96092
  } finally {
94614
96093
  this.running = false;
94615
96094
  }
@@ -95073,6 +96552,7 @@ var DEFAULT_CONFIG = {
95073
96552
  advertisedBrokerUrl: "",
95074
96553
  region: "NA",
95075
96554
  exposed: [],
96555
+ exposedActions: [],
95076
96556
  linkedAccounts: [],
95077
96557
  tokens: [],
95078
96558
  exportedEndpoints: {},
@@ -95134,7 +96614,10 @@ var ExportAlexaAddon = class extends BaseAddon {
95134
96614
  "tokens[userId].brokerCredential"
95135
96615
  ];
95136
96616
  lwaGateway = null;
96617
+ egressPrewarm = null;
95137
96618
  syncEngine = null;
96619
+ /** D968: exported actions, answered as Alexa scenes. */
96620
+ actionScenes = null;
95138
96621
  /** S1 (D767): the linking user's live grants. Built in `onInitialize`, the
95139
96622
  * first point `ctx` exists. */
95140
96623
  accessGateRef = null;
@@ -95166,7 +96649,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95166
96649
  }
95167
96650
  await this.backfillLinkedAccounts();
95168
96651
  this.autoDetectPublicHubUrl().catch((err) => {
95169
- this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg(err) } });
96652
+ this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg$1(err) } });
95170
96653
  });
95171
96654
  this.accessGateRef = createHubAccessGate(this.ctx);
95172
96655
  this.detectionClassSource = new DetectionClassSource({
@@ -95195,6 +96678,23 @@ var ExportAlexaAddon = class extends BaseAddon {
95195
96678
  store: this.snapshotStore,
95196
96679
  post: (opts) => this.requireGateway().postObjectDetection(opts)
95197
96680
  });
96681
+ this.actionScenes = new ActionSceneExports({
96682
+ api: this.ctx.api,
96683
+ logger: this.ctx.logger,
96684
+ linkedUserIds: () => this.config.linkedAccounts.map((a) => a.userId),
96685
+ isAdminUser: async (userId) => {
96686
+ const lookup = await this.accessGate.principal(userId);
96687
+ return lookup.kind === "found" && lookup.principal.kind === "admin";
96688
+ },
96689
+ canPush: () => this.config.tokens.length > 0,
96690
+ postAddOrUpdate: (userId, endpoints) => this.requireGateway().postReport(userId, (accessToken) => buildAddOrUpdateReportPayload(userId, endpoints, accessToken), `action scenes add/update (${endpoints.length})`),
96691
+ postDelete: (userId, ids) => this.requireGateway().postReport(userId, (accessToken) => buildDeleteReportPayload(userId, ids, accessToken), `action scenes delete (${ids.length})`),
96692
+ persist: (entries) => this.updateGlobalSettings({ exposedActions: [...entries] })
96693
+ }, this.config.exposedActions ?? []);
96694
+ const actionScenes = this.actionScenes;
96695
+ actionScenes.reconcile().catch((err) => {
96696
+ this.ctx.logger.warn("export-alexa: action scene reconcile at boot failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
96697
+ });
95198
96698
  const deviceExportProvider = {
95199
96699
  getStatus: async () => ({
95200
96700
  linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
@@ -95205,6 +96705,24 @@ var ExportAlexaAddon = class extends BaseAddon {
95205
96705
  listExposedDevices: async () => this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) })),
95206
96706
  exposeDevice: async ({ deviceId }) => this.exposeDevice(deviceId),
95207
96707
  unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
96708
+ listSupportedEntityKinds: async () => ["device", "action"],
96709
+ listExposedEntities: async () => {
96710
+ await actionScenes.reconcile();
96711
+ return [...this.config.exposed.map((e) => ({ entity: {
96712
+ kind: "device",
96713
+ deviceId: String(e.deviceId)
96714
+ } })), ...actionScenes.list()];
96715
+ },
96716
+ exposeEntity: async ({ entity }) => {
96717
+ if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
96718
+ if (entity.kind === "action") return actionScenes.expose(entity.actionId);
96719
+ throw new Error("export-alexa: a notification target cannot be exported to Alexa");
96720
+ },
96721
+ unexposeEntity: async ({ entity }) => {
96722
+ if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
96723
+ if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
96724
+ throw new Error("export-alexa: a notification target cannot be exported to Alexa");
96725
+ },
95208
96726
  getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(Number(input.deviceId)),
95209
96727
  getDeviceLiveContribution: async () => null,
95210
96728
  applyDeviceSettingsPatch: (input) => this.applyDeviceSettingsPatch(Number(input.deviceId), input.patch)
@@ -95277,6 +96795,11 @@ var ExportAlexaAddon = class extends BaseAddon {
95277
96795
  },
95278
96796
  vision: this.vision.context(),
95279
96797
  access: this.endpointAccess,
96798
+ actionScenes: {
96799
+ exports: actionScenes,
96800
+ api: this.ctx.api,
96801
+ logger: this.ctx.logger
96802
+ },
95280
96803
  afterDiscovery: (userId, endpoints) => this.requireGateway().scheduleInitialConnectivity(userId, endpoints)
95281
96804
  },
95282
96805
  lwaTokensCallbackDeps: {
@@ -95300,10 +96823,19 @@ var ExportAlexaAddon = class extends BaseAddon {
95300
96823
  }
95301
96824
  }));
95302
96825
  const oauthIntegrationProvider = { getDescriptor: async () => buildAlexaOauthIntegration(this.config.publicHubUrl) };
96826
+ this.egressPrewarm = new AlexaEgressPrewarm({
96827
+ api: this.ctx.api,
96828
+ logger: this.ctx.logger,
96829
+ listExposed: () => this.config.exposed,
96830
+ hasLiveSession: (deviceId) => heldEgressHandles().some((h) => h.deviceId === deviceId)
96831
+ });
95303
96832
  this.lwaGateway = new LwaEventGateway({
95304
96833
  ctx: this.ctx,
95305
96834
  logger: this.ctx.logger,
95306
96835
  listExposed: () => this.config.exposed,
96836
+ onExposedDoorbellPress: (deviceId) => {
96837
+ this.egressPrewarm?.onPress(deviceId);
96838
+ },
95307
96839
  listLinkedAccounts: () => this.config.linkedAccounts,
95308
96840
  listTokens: () => this.config.tokens,
95309
96841
  upsertToken: (input) => this.upsertToken(input),
@@ -95392,7 +96924,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95392
96924
  this.redetectPublicHubUrl().then(({ publicHubUrl }) => {
95393
96925
  this.ctx.logger.info("export-alexa: re-detected public hub URL after tunnel connect", { meta: { publicHubUrl } });
95394
96926
  }).catch((err) => {
95395
- this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg(err) } });
96927
+ this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg$1(err) } });
95396
96928
  });
95397
96929
  });
95398
96930
  this.ctx.addDisposer(async () => offTunnelStarted());
@@ -95457,17 +96989,22 @@ var ExportAlexaAddon = class extends BaseAddon {
95457
96989
  this.stateReconciler = null;
95458
96990
  this.stateReporter?.stop();
95459
96991
  this.stateReporter = null;
96992
+ if (this.egressPrewarm) {
96993
+ await this.egressPrewarm.dispose();
96994
+ this.egressPrewarm = null;
96995
+ }
95460
96996
  if (this.lwaGateway) {
95461
96997
  this.lwaGateway.stop();
95462
96998
  this.lwaGateway = null;
95463
96999
  }
95464
97000
  this.syncEngine = null;
97001
+ this.actionScenes = null;
95465
97002
  }
95466
97003
  async exposeDevice(deviceIdRaw) {
95467
97004
  const deviceId = Number.parseInt(deviceIdRaw, 10);
95468
97005
  if (!Number.isFinite(deviceId)) throw new Error(`export-alexa: deviceId must be numeric — got "${deviceIdRaw}"`);
95469
97006
  if (!await this.ctx.api.deviceManager.getDevice.query({ deviceId }).catch((err) => {
95470
- throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg(err)}`);
97007
+ throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg$1(err)}`);
95471
97008
  })) throw new Error(`export-alexa: device ${deviceId} not found`);
95472
97009
  const next = this.config.exposed.filter((e) => e.deviceId !== deviceId);
95473
97010
  next.push({
@@ -95483,7 +97020,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95483
97020
  }).catch((err) => {
95484
97021
  this.ctx.logger.warn("export-alexa: expose sync failed", { meta: {
95485
97022
  deviceId,
95486
- error: errMsg(err)
97023
+ error: errMsg$1(err)
95487
97024
  } });
95488
97025
  });
95489
97026
  }
@@ -95497,7 +97034,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95497
97034
  this.requireSyncEngine().removeDevice(deviceId).catch((err) => {
95498
97035
  this.ctx.logger.warn("export-alexa: unexpose delete failed", { meta: {
95499
97036
  deviceId,
95500
- error: errMsg(err)
97037
+ error: errMsg$1(err)
95501
97038
  } });
95502
97039
  });
95503
97040
  }
@@ -95545,14 +97082,14 @@ var ExportAlexaAddon = class extends BaseAddon {
95545
97082
  const engine = this.syncEngine;
95546
97083
  if (engine === null) return;
95547
97084
  engine.reconcileAllExposed().catch((err) => {
95548
- this.ctx.logger.warn("export-alexa: re-sync after a switch change failed", { meta: { error: errMsg(err) } });
97085
+ this.ctx.logger.warn("export-alexa: re-sync after a switch change failed", { meta: { error: errMsg$1(err) } });
95549
97086
  });
95550
97087
  }
95551
97088
  scheduleDetectionClassRefresh() {
95552
97089
  const timer = setInterval(() => {
95553
97090
  if (!this.config.detectionSensors && !this.config.objectDetection) return;
95554
97091
  this.requireSyncEngine().reconcileAllExposed().catch((err) => {
95555
- this.ctx.logger.warn("export-alexa: detection-class refresh failed", { meta: { error: errMsg(err) } });
97092
+ this.ctx.logger.warn("export-alexa: detection-class refresh failed", { meta: { error: errMsg$1(err) } });
95556
97093
  });
95557
97094
  }, DETECTION_CLASS_REFRESH_MS);
95558
97095
  timer.unref?.();
@@ -95579,7 +97116,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95579
97116
  try {
95580
97117
  await applyVisibilityChanges(await this.visibility.refresh(), this.requireSyncEngine(), this.ctx.logger);
95581
97118
  } catch (err) {
95582
- this.ctx.logger.warn("export-alexa: visibility refresh failed", { meta: { error: errMsg(err) } });
97119
+ this.ctx.logger.warn("export-alexa: visibility refresh failed", { meta: { error: errMsg$1(err) } });
95583
97120
  }
95584
97121
  }
95585
97122
  scheduleVisibilityRefresh() {
@@ -95669,7 +97206,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95669
97206
  pushed: r.pushedDeviceIds
95670
97207
  } });
95671
97208
  }).catch((err) => {
95672
- this.ctx.logger.warn("export-alexa: boot discovery reconcile failed", { meta: { error: errMsg(err) } });
97209
+ this.ctx.logger.warn("export-alexa: boot discovery reconcile failed", { meta: { error: errMsg$1(err) } });
95673
97210
  });
95674
97211
  }, BOOT_RECONCILE_DELAY_MS);
95675
97212
  if (typeof timer.unref === "function") timer.unref();
@@ -95682,7 +97219,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95682
97219
  } catch (err) {
95683
97220
  this.ctx.logger.warn("export-alexa: bindings-change discovery reconcile failed", {
95684
97221
  tags: { deviceId },
95685
- meta: { error: errMsg(err) }
97222
+ meta: { error: errMsg$1(err) }
95686
97223
  });
95687
97224
  }
95688
97225
  }
@@ -95798,7 +97335,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95798
97335
  }).catch((err) => {
95799
97336
  this.ctx.logger.warn("export-alexa: new-account push failed", { meta: {
95800
97337
  userId: input.userId,
95801
- error: errMsg(err)
97338
+ error: errMsg$1(err)
95802
97339
  } });
95803
97340
  });
95804
97341
  }
@@ -95831,7 +97368,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95831
97368
  this.updateGlobalSettings({ advertisedBrokerUrl: url }).then(() => {
95832
97369
  this.ctx.logger.info("export-alexa: the skill Lambda advertised its token broker", { meta: { brokerUrl: url } });
95833
97370
  }).catch((err) => {
95834
- this.ctx.logger.warn("export-alexa: could not store the advertised broker URL", { meta: { error: errMsg(err) } });
97371
+ this.ctx.logger.warn("export-alexa: could not store the advertised broker URL", { meta: { error: errMsg$1(err) } });
95835
97372
  });
95836
97373
  }
95837
97374
  async revokeAtBroker(tokens) {
@@ -95840,7 +97377,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95840
97377
  await revokeBrokerCredential(fetch, t.brokerUrl, t.brokerCredential).catch((err) => {
95841
97378
  this.ctx.logger.warn("export-alexa: could not delete the link at the skill broker — it expires there on its own", { meta: {
95842
97379
  userId: t.userId,
95843
- error: errMsg(err)
97380
+ error: errMsg$1(err)
95844
97381
  } });
95845
97382
  });
95846
97383
  }
@@ -95871,7 +97408,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95871
97408
  this.ctx.logger.warn("export-alexa: broker credential rotation failed", { meta: {
95872
97409
  userId: t.userId,
95873
97410
  kind: err instanceof BrokerError ? err.kind : "unavailable",
95874
- error: errMsg(err)
97411
+ error: errMsg$1(err)
95875
97412
  } });
95876
97413
  }
95877
97414
  }
@@ -95917,7 +97454,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95917
97454
  const urls = (await this.ctx.api.networkAccess.listEndpoints.query({})).filter((e) => e.protocol === "https" && e.url.length > 0).map((e) => this.normaliseHubUrl(e.url));
95918
97455
  return [...new Set(urls)];
95919
97456
  } catch (err) {
95920
- this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg(err) } });
97457
+ this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg$1(err) } });
95921
97458
  return [];
95922
97459
  }
95923
97460
  }
@@ -95931,7 +97468,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95931
97468
  if (!status?.connected || !endpoint || endpoint.protocol !== "https" || endpoint.url.length === 0) return "";
95932
97469
  return this.normaliseHubUrl(endpoint.url);
95933
97470
  } catch (err) {
95934
- this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg(err) } });
97471
+ this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg$1(err) } });
95935
97472
  return "";
95936
97473
  }
95937
97474
  }
@@ -96241,13 +97778,13 @@ var ExportAlexaAddon = class extends BaseAddon {
96241
97778
  if (nameChanged && !sourceChanged) this.requireSyncEngine().pushDevice(deviceId).catch((err) => {
96242
97779
  this.ctx.logger.warn("export-alexa: push after an Alexa name change failed", {
96243
97780
  tags: { deviceId },
96244
- meta: { error: errMsg(err) }
97781
+ meta: { error: errMsg$1(err) }
96245
97782
  });
96246
97783
  });
96247
97784
  if (prefsChanged && !sourceChanged) this.requireSyncEngine().reconcileDevice(deviceId).catch((err) => {
96248
97785
  this.ctx.logger.warn("export-alexa: re-sync after a detection preference change failed", {
96249
97786
  tags: { deviceId },
96250
- meta: { error: errMsg(err) }
97787
+ meta: { error: errMsg$1(err) }
96251
97788
  });
96252
97789
  });
96253
97790
  if (sourceChanged) {
@@ -96271,7 +97808,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96271
97808
  } catch (err) {
96272
97809
  this.ctx.logger.warn("export-alexa: failed to refresh after streamPreference change", { meta: {
96273
97810
  deviceId,
96274
- error: errMsg(err)
97811
+ error: errMsg$1(err)
96275
97812
  } });
96276
97813
  }
96277
97814
  }