@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.
@@ -5074,6 +5074,14 @@ function object(shape, params) {
5074
5074
  ...normalizeParams(params)
5075
5075
  });
5076
5076
  }
5077
+ function strictObject(shape, params) {
5078
+ return new ZodObject({
5079
+ type: "object",
5080
+ shape,
5081
+ catchall: never(),
5082
+ ...normalizeParams(params)
5083
+ });
5084
+ }
5077
5085
  function looseObject(shape, params) {
5078
5086
  return new ZodObject({
5079
5087
  type: "object",
@@ -5453,7 +5461,7 @@ var ZodIssueCode = {
5453
5461
  var ZodFirstPartyTypeKind;
5454
5462
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5455
5463
  //#endregion
5456
- //#region ../types/dist/sleep-Crlmu_tO.mjs
5464
+ //#region ../types/dist/sleep-6eG9C8Xl.mjs
5457
5465
  /**
5458
5466
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5459
5467
  * window to float samples (D455).
@@ -8429,6 +8437,52 @@ function optionalMethod(input, output, options) {
8429
8437
  providerOptional: true
8430
8438
  };
8431
8439
  }
8440
+ /**
8441
+ * `addon-pages-source` — collection cap exposing per-provider raw page
8442
+ * declarations. Every addon that contributes a UI page registers a
8443
+ * provider here. The hub-side singleton aggregator (`addon-pages` cap,
8444
+ * see `addon-pages.cap.ts`) walks this collection, stamps versioned
8445
+ * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
8446
+ * that admin-ui consumes.
8447
+ *
8448
+ * The split exists because the public listing has a different output
8449
+ * shape than the per-provider raw declarations, and we want both ends
8450
+ * to flow through codegen instead of relying on a hand-written wrapper.
8451
+ */
8452
+ var AddonPageDeclarationSchema = object({
8453
+ id: string(),
8454
+ label: string(),
8455
+ icon: string(),
8456
+ path: string(),
8457
+ /**
8458
+ * Module Federation remote name — must match the `name` field on the
8459
+ * page addon's `federation()` plugin config. Used by admin-ui's
8460
+ * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
8461
+ * Conventionally `addon_<id>_page` (snake_case; MF names cannot
8462
+ * contain hyphens).
8463
+ */
8464
+ remoteName: string(),
8465
+ /**
8466
+ * Bundle filename inside the addon's `dist/` dir served at
8467
+ * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
8468
+ * is always `'remoteEntry.js'`; the value is kept on the metadata so
8469
+ * the static-file route can compute an mtime-based cache-buster URL
8470
+ * without a separate filesystem stat.
8471
+ */
8472
+ bundle: string(),
8473
+ /**
8474
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
8475
+ * `'cluster'`, `'administration'` — the page renders inside that group.
8476
+ * Any OTHER string creates (or joins) a custom section rendered after
8477
+ * the built-in groups; its label comes from `sectionLabel` (first
8478
+ * declaration wins), falling back to the id. Absent → the legacy
8479
+ * "Addon Pages" group.
8480
+ */
8481
+ section: string().optional(),
8482
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
8483
+ sectionLabel: string().optional()
8484
+ });
8485
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
8432
8486
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
8433
8487
  var VersionOutputSchema$1 = object({ version: string() });
8434
8488
  method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
@@ -8454,6 +8508,27 @@ function customAction(input, output, options) {
8454
8508
  ...options?.caller ? { caller: "required" } : {}
8455
8509
  };
8456
8510
  }
8511
+ /**
8512
+ * The pipeline step-input shape and the run-result bridge, in a module that
8513
+ * imports nothing but zod and types.
8514
+ *
8515
+ * WHY A SEPARATE FILE (addon footprint, D28): both were declared in
8516
+ * `pipeline-executor.cap.ts`, whose import evaluates the whole executor schema
8517
+ * graph. An addon that only needs these two (the benchmark's `runPipelineTest`
8518
+ * action) paid ~130 MB of heap at load. `pipeline-executor.cap.ts` re-exports
8519
+ * them, so every existing import keeps working; addon server code takes them
8520
+ * from `@camstack/types/addon`.
8521
+ */
8522
+ var PipelineStepInputSchema = lazy(() => object({
8523
+ addonId: string(),
8524
+ modelId: string().optional(),
8525
+ enabled: boolean().default(true),
8526
+ children: array(PipelineStepInputSchema).optional(),
8527
+ settings: record(string(), unknown()).optional(),
8528
+ jumpDeviceKey: string().optional()
8529
+ }));
8530
+ /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
8531
+ var PipelineRunResultBridge = custom();
8457
8532
  var StaticDirOutputSchema = object({ staticDir: string() });
8458
8533
  var VersionOutputSchema = object({ version: string() });
8459
8534
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
@@ -8609,6 +8684,7 @@ var CAP_NAMES = Object.freeze([
8609
8684
  "image-settings",
8610
8685
  "integrations",
8611
8686
  "intercom",
8687
+ "ir-transmitter",
8612
8688
  "keychain",
8613
8689
  "keychain-admin",
8614
8690
  "lawn-mower-control",
@@ -8637,6 +8713,7 @@ var CAP_NAMES = Object.freeze([
8637
8713
  "network-link",
8638
8714
  "network-quality",
8639
8715
  "node-certificates",
8716
+ "node-removal-hook",
8640
8717
  "nodes",
8641
8718
  "notification-output",
8642
8719
  "notification-rules",
@@ -8647,6 +8724,7 @@ var CAP_NAMES = Object.freeze([
8647
8724
  "osd",
8648
8725
  "osd-manager",
8649
8726
  "pet-feeder",
8727
+ "pet-fountain",
8650
8728
  "pipeline-analytics",
8651
8729
  "pipeline-executor",
8652
8730
  "pipeline-orchestrator",
@@ -8667,6 +8745,7 @@ var CAP_NAMES = Object.freeze([
8667
8745
  "recording-onboard",
8668
8746
  "recording-signal",
8669
8747
  "records",
8748
+ "remote",
8670
8749
  "running-state",
8671
8750
  "scene-monitor",
8672
8751
  "script-runner",
@@ -8690,6 +8769,7 @@ var CAP_NAMES = Object.freeze([
8690
8769
  "system",
8691
8770
  "tamper",
8692
8771
  "temperature-sensor",
8772
+ "template",
8693
8773
  "terminal-session",
8694
8774
  "toast",
8695
8775
  "training",
@@ -9630,6 +9710,11 @@ Object.freeze({
9630
9710
  "standby"
9631
9711
  ]
9632
9712
  },
9713
+ {
9714
+ "path": "stateSource",
9715
+ "valueType": "enum",
9716
+ "enumValues": ["reported", "assumed"]
9717
+ },
9633
9718
  {
9634
9719
  "path": "volumeLevel",
9635
9720
  "valueType": "number"
@@ -9856,6 +9941,11 @@ Object.freeze({
9856
9941
  "path": "batteryPower",
9857
9942
  "valueType": "number"
9858
9943
  },
9944
+ {
9945
+ "path": "powerSource",
9946
+ "valueType": "enum",
9947
+ "enumValues": ["mains", "battery"]
9948
+ },
9859
9949
  {
9860
9950
  "path": "desiccantLeftDays",
9861
9951
  "valueType": "number"
@@ -9900,6 +9990,68 @@ Object.freeze({
9900
9990
  {
9901
9991
  "path": "volume",
9902
9992
  "valueType": "number"
9993
+ },
9994
+ {
9995
+ "path": "lastFeedGrams",
9996
+ "valueType": "number"
9997
+ },
9998
+ {
9999
+ "path": "lastFeedHopper1",
10000
+ "valueType": "number"
10001
+ },
10002
+ {
10003
+ "path": "lastFeedHopper2",
10004
+ "valueType": "number"
10005
+ }
10006
+ ],
10007
+ "pet-fountain": [
10008
+ {
10009
+ "path": "waterLevel",
10010
+ "valueType": "number"
10011
+ },
10012
+ {
10013
+ "path": "waterVolume",
10014
+ "valueType": "number"
10015
+ },
10016
+ {
10017
+ "path": "empty",
10018
+ "valueType": "boolean"
10019
+ },
10020
+ {
10021
+ "path": "pumpRunning",
10022
+ "valueType": "boolean"
10023
+ },
10024
+ {
10025
+ "path": "pumpIntervalEnabled",
10026
+ "valueType": "boolean"
10027
+ },
10028
+ {
10029
+ "path": "pumpOnTime",
10030
+ "valueType": "number"
10031
+ },
10032
+ {
10033
+ "path": "pumpOffTime",
10034
+ "valueType": "number"
10035
+ },
10036
+ {
10037
+ "path": "lastDrink",
10038
+ "valueType": "number"
10039
+ },
10040
+ {
10041
+ "path": "currentHourDrink",
10042
+ "valueType": "number"
10043
+ },
10044
+ {
10045
+ "path": "last24hDrink",
10046
+ "valueType": "number"
10047
+ },
10048
+ {
10049
+ "path": "todayDrink",
10050
+ "valueType": "number"
10051
+ },
10052
+ {
10053
+ "path": "error",
10054
+ "valueType": "string"
9903
10055
  }
9904
10056
  ],
9905
10057
  "power-meter": [
@@ -10439,7 +10591,7 @@ object({
10439
10591
  params: record(string(), union([string(), number()])).optional()
10440
10592
  });
10441
10593
  //#endregion
10442
- //#region ../types/dist/err-msg-DIorGYeC.mjs
10594
+ //#region ../types/dist/err-msg-DWXWc0Di.mjs
10443
10595
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10444
10596
  DeviceType["Camera"] = "camera";
10445
10597
  DeviceType["Hub"] = "hub";
@@ -10531,6 +10683,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10531
10683
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10532
10684
  * integrations sharing the same food/desiccant/hopper surface. */
10533
10685
  DeviceType["PetFeeder"] = "pet-feeder";
10686
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
10687
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
10688
+ * of a container and is BUILT as a composed device (D967). */
10689
+ DeviceType["PetFountain"] = "pet-fountain";
10534
10690
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10535
10691
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10536
10692
  * Sources: native Bosch Home Connect, reusable by similar integrations.
@@ -10785,6 +10941,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10785
10941
  /** Fallback when the notifier service name doesn't match a known
10786
10942
  * pattern. */
10787
10943
  DeviceRole["GenericNotifier"] = "generic-notifier";
10944
+ /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
10945
+ * cap. A `DeviceType.Generic` device. */
10946
+ DeviceRole["IrTransmitter"] = "ir-transmitter";
10788
10947
  return DeviceRole;
10789
10948
  }({});
10790
10949
  /**
@@ -10792,13 +10951,13 @@ import { errMsg } from '@camstack/types'
10792
10951
  * Extract a human-readable message from an unknown error value.
10793
10952
  * Replaces the ubiquitous `errMsg(err)` pattern.
10794
10953
  */
10795
- function errMsg(err) {
10954
+ function errMsg$1(err) {
10796
10955
  if (err instanceof Error) return err.message;
10797
10956
  if (typeof err === "string") return err;
10798
10957
  return String(err);
10799
10958
  }
10800
10959
  //#endregion
10801
- //#region ../types/dist/composition-CZImLpOI.mjs
10960
+ //#region ../types/dist/composition-kSuOifuG.mjs
10802
10961
  /**
10803
10962
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10804
10963
  *
@@ -11883,12 +12042,28 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11883
12042
  ])
11884
12043
  })
11885
12044
  ]);
11886
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
12045
+ var forwardArgUnion = union([
12046
+ string(),
12047
+ number(),
12048
+ boolean(),
12049
+ strictObject({ ["$input"]: string().min(1) }),
12050
+ record(string().min(1), lazy(() => forwardArgUnion))
12051
+ ]);
12052
+ var CompositionForwardArgSchema = forwardArgUnion;
12053
+ /**
12054
+ * `forward` (D659, amended by D967): one method of a BUILT capability is one
12055
+ * call of `cap.method` on `source`. Without `args` the built method's input
12056
+ * passes through minus `deviceId`; with `args` the template IS the source's
12057
+ * whole input. `deviceId` is always the source's own, never an argument.
12058
+ */
12059
+ var CompositionForwardCommandSchema = object({
11887
12060
  kind: literal("forward"),
11888
12061
  source: CompositionSourceRefSchema,
11889
12062
  cap: string().min(1),
11890
- method: string().min(1)
11891
- }), CompositionCodeSourceSchema]);
12063
+ method: string().min(1),
12064
+ args: record(string().min(1), CompositionForwardArgSchema).optional()
12065
+ });
12066
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
11892
12067
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
11893
12068
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11894
12069
  /**
@@ -11898,7 +12073,13 @@ var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11898
12073
  */
11899
12074
  var CompositionItemEntrySchema = object({
11900
12075
  label: string().min(1).max(80),
11901
- fields: record(string().min(1), CompositionFieldSourceSchema)
12076
+ fields: record(string().min(1), CompositionFieldSourceSchema),
12077
+ /**
12078
+ * What the cap's `reset` does for THIS item (consumables). Present = the item
12079
+ * is resettable and a `reset` call naming its key forwards here. The item key
12080
+ * selects the command, so it is never an argument: there is no pass-through.
12081
+ */
12082
+ reset: CompositionForwardCommandSchema.optional()
11902
12083
  });
11903
12084
  var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11904
12085
  kind: literal("fields"),
@@ -11910,7 +12091,7 @@ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11910
12091
  * owns the WHOLE array field: the composed value holds exactly these items.
11911
12092
  */
11912
12093
  items: record(string().regex(COMPOSITION_ITEM_KEY_RE), CompositionItemEntrySchema).refine((items) => Object.keys(items).length <= 16, { message: `at most 16 items` }).optional(),
11913
- /** RESERVED for slice 3; refused by the validator when non-empty. */
12094
+ /** Method name → what serves it. Only a BUILT capability takes commands (D967). */
11914
12095
  commands: record(string().min(1), CompositionCommandTargetSchema).optional()
11915
12096
  }), object({
11916
12097
  kind: literal("passthrough"),
@@ -16137,6 +16318,510 @@ object({
16137
16318
  lastError: string().nullable()
16138
16319
  });
16139
16320
  /**
16321
+ * notification-output — canonical, capability-gated notification delivery.
16322
+ *
16323
+ * Apprise-derived model (see
16324
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
16325
+ * callers emit ONE canonical `Notification`; each provider declares a
16326
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
16327
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
16328
+ * message to what the kind supports — callers never special-case a service.
16329
+ *
16330
+ * DESIGN DECISIONS (locked):
16331
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
16332
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
16333
+ * cap. Rationale: the admin UI needs one uniform surface across the
16334
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
16335
+ * alternative would fork the UI per addon and cannot host the
16336
+ * discovery→adopt flow.
16337
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
16338
+ * the generated cap-mount auto-`concatCollection`-fans them across every
16339
+ * registered provider (notifiers addon + HA addon) so one catalog is
16340
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
16341
+ * `addonId` the generated collection router extracts from the call input.
16342
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
16343
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
16344
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
16345
+ * base64 fallback needed.
16346
+ *
16347
+ * TODO (deferred, closed-set change — separate decision): add
16348
+ * `providerKind: 'notify'` so notification providers surface on the unified
16349
+ * admin "Integrations" page.
16350
+ */
16351
+ /**
16352
+ * Zentik-derived typed-media enum — the superset across every kind. Each
16353
+ * adapter picks what it supports and the degrade engine filters the rest.
16354
+ */
16355
+ var AttachmentMediaTypeSchema = _enum([
16356
+ "image",
16357
+ "video",
16358
+ "gif",
16359
+ "audio",
16360
+ "icon"
16361
+ ]);
16362
+ /**
16363
+ * A single attachment. Exactly one of `url` (remote source, most adapters
16364
+ * prefer this) or `bytes` (inline source; required for Pushover-style
16365
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
16366
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
16367
+ */
16368
+ var AttachmentSchema = object({
16369
+ mediaType: AttachmentMediaTypeSchema,
16370
+ url: string().optional(),
16371
+ bytes: _instanceof(Uint8Array).optional(),
16372
+ mime: string().optional(),
16373
+ name: string().optional()
16374
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
16375
+ var NotificationFormatSchema = _enum([
16376
+ "text",
16377
+ "markdown",
16378
+ "html"
16379
+ ]);
16380
+ /**
16381
+ * The CLOSED icon vocabulary an action button may use.
16382
+ *
16383
+ * A closed set, not a free string, and that is the whole point: an arbitrary
16384
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
16385
+ * notices — the same class of gap as a zone vocabulary nothing produced
16386
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
16387
+ * declares `actionIcons: false` and the degrade engine strips the field.
16388
+ *
16389
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
16390
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
16391
+ * differently.
16392
+ *
16393
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
16394
+ *
16395
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
16396
+ * the whole set onto its own renderer's vocabulary through a
16397
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
16398
+ * fallback, so adding a member here fails every adapter's build until someone
16399
+ * decides its glyph, which is the only place that decision can be made
16400
+ * honestly.
16401
+ *
16402
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
16403
+ * `disarm` straight through; iOS feeds that string to
16404
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
16405
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
16406
+ * mapping, and "the field is documented" is not "the value renders".
16407
+ *
16408
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
16409
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
16410
+ * so an addon that emits a token the running hub does not know does not lose an
16411
+ * icon — its whole `send` fails Zod validation and the notification never
16412
+ * arrives. Never emit a new token from an addon before the train carrying it.
16413
+ */
16414
+ var NotificationActionIconSchema = _enum([
16415
+ "acknowledge",
16416
+ "dismiss",
16417
+ "silence",
16418
+ "snooze",
16419
+ "view",
16420
+ "play",
16421
+ "open",
16422
+ "close",
16423
+ "lock",
16424
+ "unlock",
16425
+ "arm",
16426
+ "arm-home",
16427
+ "arm-away",
16428
+ "arm-night",
16429
+ "disarm",
16430
+ "light",
16431
+ "alert",
16432
+ "camera"
16433
+ ]);
16434
+ /** A single tap-through action button. */
16435
+ var NotificationActionSchema = object({
16436
+ id: string(),
16437
+ label: string(),
16438
+ url: string().optional(),
16439
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
16440
+ icon: NotificationActionIconSchema.optional(),
16441
+ /**
16442
+ * Renders in a warning style where the notifier supports it.
16443
+ *
16444
+ * A HINT, never a gate. The callback's authority is its token and nothing
16445
+ * else — see `notification-center/action-token.ts` for what that does and
16446
+ * does not buy.
16447
+ */
16448
+ destructive: boolean().optional(),
16449
+ /**
16450
+ * How the tap should REACH the url.
16451
+ *
16452
+ * `navigate` (absent, and every button authored before this field) opens it:
16453
+ * the phone leaves the notification and shows whatever the callback returns.
16454
+ * That is right for a button whose answer the operator wants to read.
16455
+ *
16456
+ * `background` fires it as a POST and stays put. It exists for the buttons
16457
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
16458
+ * an answer to the notification, and being thrown into a browser tab to
16459
+ * confirm it costs more attention than the notification did. A backend that
16460
+ * cannot do a background call renders it as an ordinary link (the adapters
16461
+ * fall back rather than dropping the button), so this is a preference, never
16462
+ * a requirement.
16463
+ */
16464
+ mode: _enum(["navigate", "background"]).optional()
16465
+ });
16466
+ /** A delivery parameter value: what a notifier declared it takes. */
16467
+ var DeliveryParamValueSchema = union([
16468
+ string(),
16469
+ number(),
16470
+ boolean()
16471
+ ]);
16472
+ /**
16473
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
16474
+ * addresses a target of that kind may set it; a kind that declares nothing is
16475
+ * never handed one. The admin UI derives its control from this descriptor —
16476
+ * no editor knows a service by name.
16477
+ *
16478
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
16479
+ * run on the addon cap path).
16480
+ */
16481
+ var DeliveryParamSchema = object({
16482
+ key: string().min(1),
16483
+ label: string(),
16484
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
16485
+ labelKey: string().optional(),
16486
+ type: _enum([
16487
+ "enum",
16488
+ "number",
16489
+ "boolean",
16490
+ "string"
16491
+ ]),
16492
+ /** `enum` only: the closed set of accepted values. */
16493
+ options: array(object({
16494
+ value: string(),
16495
+ label: string()
16496
+ })).optional(),
16497
+ /** `number` only. */
16498
+ min: number().optional(),
16499
+ max: number().optional(),
16500
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
16501
+ default: DeliveryParamValueSchema.optional()
16502
+ });
16503
+ /**
16504
+ * The canonical notification. `body` is the only hard field (Apprise model).
16505
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
16506
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
16507
+ * the adapter maps this ordinal onto its native level. `level?` is an
16508
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
16509
+ * `priority` for that one target.
16510
+ */
16511
+ var NotificationSchema = object({
16512
+ body: string(),
16513
+ title: string().optional(),
16514
+ format: NotificationFormatSchema.default("text"),
16515
+ priority: number().int().min(1).max(5).default(3),
16516
+ level: string().optional(),
16517
+ attachments: array(AttachmentSchema).optional(),
16518
+ clickUrl: string().optional(),
16519
+ actions: array(NotificationActionSchema).optional(),
16520
+ sound: string().optional(),
16521
+ ttl: number().optional(),
16522
+ tag: string().optional(),
16523
+ deviceId: number().optional(),
16524
+ eventId: string().optional(),
16525
+ metadata: record(string(), unknown()).optional(),
16526
+ /**
16527
+ * Values for the parameters the target's kind DECLARES in
16528
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
16529
+ * declaration by the sender; a notifier reads only the keys it declared.
16530
+ */
16531
+ delivery: record(string(), DeliveryParamValueSchema).optional()
16532
+ });
16533
+ /** One declared native severity/priority level for a kind. */
16534
+ var TargetKindLevelSchema = object({
16535
+ id: string(),
16536
+ label: string(),
16537
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
16538
+ ordinal: number().int().min(1).max(5).nullable(),
16539
+ flags: object({
16540
+ critical: boolean().optional(),
16541
+ silent: boolean().optional(),
16542
+ noPush: boolean().optional()
16543
+ }).optional(),
16544
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
16545
+ requires: array(string()).optional(),
16546
+ description: string().optional()
16547
+ });
16548
+ /** The full capability block consulted before dispatch. */
16549
+ var TargetKindCapsSchema = object({
16550
+ attachments: object({
16551
+ mediaTypes: array(AttachmentMediaTypeSchema),
16552
+ mode: _enum([
16553
+ "url",
16554
+ "bytes",
16555
+ "both"
16556
+ ]),
16557
+ max: number().int().nonnegative(),
16558
+ maxBytes: number().int().positive().optional()
16559
+ }),
16560
+ /** Max action buttons (0 = none). */
16561
+ actions: number().int().nonnegative(),
16562
+ /**
16563
+ * Whether this kind renders a per-action ICON.
16564
+ *
16565
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
16566
+ * run on the addon cap path — three production failures in one day taught
16567
+ * this repo that once. Absent is read as false by the degrade engine, which
16568
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
16569
+ * assumed and dropped costs the operator's trust in the field.
16570
+ */
16571
+ actionIcons: boolean().optional(),
16572
+ levels: array(TargetKindLevelSchema),
16573
+ format: array(NotificationFormatSchema),
16574
+ clickUrl: boolean(),
16575
+ sound: boolean(),
16576
+ ttl: boolean(),
16577
+ bodyMaxLen: number().int().positive()
16578
+ });
16579
+ /**
16580
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
16581
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
16582
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
16583
+ * the union is large and not meant for runtime validation here; the exported
16584
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
16585
+ */
16586
+ var ConfigSchemaPassthrough$3 = unknown();
16587
+ var TargetKindSchema = object({
16588
+ kind: string(),
16589
+ label: string(),
16590
+ icon: string(),
16591
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
16592
+ addonId: string(),
16593
+ /**
16594
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
16595
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
16596
+ * when the addon bundles no icon for that kind — the client then falls back
16597
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
16598
+ *
16599
+ * Root-relative on purpose: it resolves against whatever origin serves a web
16600
+ * client, and a native client joins it onto its own hub base.
16601
+ *
16602
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
16603
+ * field that survived only because the runtime cap-router forwards provider
16604
+ * output verbatim — so every consumer had to re-declare it by hand to stop
16605
+ * its own Zod parse from stripping it, and the whole arrangement would have
16606
+ * broken silently the moment output validation was tightened anywhere.
16607
+ */
16608
+ iconUrl: string().optional(),
16609
+ /**
16610
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
16611
+ *
16612
+ * The server knows this and therefore says it, because the client cannot
16613
+ * safely guess: a React-Native client renders SVG and raster through two
16614
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
16615
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
16616
+ * placeholder glyph for every vector icon while the web build looked fine.
16617
+ *
16618
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
16619
+ * not been updated — a client that cannot determine the type should prefer
16620
+ * its raster path, which is the safe default for an unknown image.
16621
+ */
16622
+ iconMediaType: string().optional(),
16623
+ configSchema: ConfigSchemaPassthrough$3,
16624
+ /**
16625
+ * The config keys that decide WHERE this kind's secrets are sent (server,
16626
+ * base URL, instance, chat, recipient). A save that changes any of them
16627
+ * while leaving a secret redacted is refused by the provider (D634), so an
16628
+ * editor uses this to ask for the secret on exactly those edits instead of
16629
+ * on every edit.
16630
+ *
16631
+ * Optional: absent from a provider that holds no secret (the Home Assistant
16632
+ * kinds) and from a provider older than this field — an editor that finds
16633
+ * it absent must assume ANY edit may need the secret.
16634
+ */
16635
+ destinationKeys: array(string()).optional(),
16636
+ supportsDiscovery: boolean(),
16637
+ /**
16638
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
16639
+ * Absent = none; the rule editor then offers nothing.
16640
+ */
16641
+ deliveryParams: array(DeliveryParamSchema).optional(),
16642
+ caps: TargetKindCapsSchema
16643
+ });
16644
+ /**
16645
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
16646
+ * (return a presence marker only) when serving `listTargets` — never
16647
+ * round-trip a stored secret to the UI.
16648
+ */
16649
+ var TargetSchema = object({
16650
+ id: string(),
16651
+ name: string(),
16652
+ kind: string(),
16653
+ addonId: string(),
16654
+ enabled: boolean(),
16655
+ config: record(string(), unknown())
16656
+ });
16657
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
16658
+ var DiscoveredTargetSchema = object({
16659
+ kind: string(),
16660
+ suggestedName: string(),
16661
+ config: record(string(), unknown())
16662
+ });
16663
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
16664
+ var RenderedAsSchema = object({
16665
+ level: string(),
16666
+ format: NotificationFormatSchema,
16667
+ attachmentsSent: number().int().nonnegative(),
16668
+ actionsSent: number().int().nonnegative(),
16669
+ truncated: boolean(),
16670
+ dropped: array(string())
16671
+ });
16672
+ var SendResultSchema = object({
16673
+ success: boolean(),
16674
+ error: string().optional(),
16675
+ renderedAs: RenderedAsSchema.optional()
16676
+ });
16677
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
16678
+ var TestResultSchema = SendResultSchema;
16679
+ /**
16680
+ * Pre-save credential probe against a partial (unsaved) target config.
16681
+ * `resolvedUrl` never includes secrets (token stripped from path).
16682
+ */
16683
+ var ProbeTargetConfigResultSchema = object({
16684
+ ok: boolean(),
16685
+ resolvedUrl: string(),
16686
+ httpStatus: number().int().optional(),
16687
+ stateInstance: string().optional(),
16688
+ error: string().optional()
16689
+ });
16690
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
16691
+ kind: string(),
16692
+ config: record(string(), unknown()).optional(),
16693
+ /**
16694
+ * When editing / duplicating, the blank password field never round-trips
16695
+ * the stored token. Pass the source target id so the provider can restore
16696
+ * secrets server-side before dialling (same merge as upsert).
16697
+ */
16698
+ targetId: string().optional()
16699
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
16700
+ kind: string(),
16701
+ config: record(string(), unknown()),
16702
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
16703
+ targetId: string().optional()
16704
+ }), ProbeTargetConfigResultSchema, {
16705
+ kind: "mutation",
16706
+ auth: "admin"
16707
+ }), method(object({
16708
+ targetId: string(),
16709
+ notification: NotificationSchema
16710
+ }), SendResultSchema, {
16711
+ kind: "mutation",
16712
+ auth: "admin"
16713
+ }), method(object({
16714
+ targetId: string(),
16715
+ sample: NotificationSchema.optional()
16716
+ }), TestResultSchema, {
16717
+ kind: "mutation",
16718
+ auth: "admin"
16719
+ }), method(object({
16720
+ target: TargetSchema,
16721
+ /**
16722
+ * Duplicate flow: create a NEW target id while copying secrets from an
16723
+ * existing row. The UI never holds the stored token; blank / redacted
16724
+ * password fields are restored from this source (D634 still applies if
16725
+ * destinations diverge without a re-typed secret).
16726
+ */
16727
+ cloneSecretsFrom: string().optional()
16728
+ }), TargetSchema, {
16729
+ kind: "mutation",
16730
+ auth: "admin"
16731
+ }), method(object({ targetId: string() }), _void(), {
16732
+ kind: "mutation",
16733
+ auth: "admin"
16734
+ }), method(object({
16735
+ targetId: string(),
16736
+ enabled: boolean()
16737
+ }), _void(), {
16738
+ kind: "mutation",
16739
+ auth: "admin"
16740
+ });
16741
+ function errorText(err) {
16742
+ return err instanceof Error ? err.message : String(err);
16743
+ }
16744
+ /** `actions.run` flattens a refusal to `[code] text`; the code leads. */
16745
+ function refusalFromThrown(message) {
16746
+ if (message.startsWith("[busy]")) return "already-running";
16747
+ if (message.startsWith("[not-found]")) return "not-found";
16748
+ return null;
16749
+ }
16750
+ async function runExportedAction(api, log, input) {
16751
+ const { exporter, actionId } = input;
16752
+ const tags = { actionId };
16753
+ const refuse = (reason, detail) => {
16754
+ log.warn(`${exporter}: exported action not run — ${reason}`, {
16755
+ tags,
16756
+ meta: {
16757
+ reason,
16758
+ ...detail ? { detail } : {}
16759
+ }
16760
+ });
16761
+ return {
16762
+ status: "refused",
16763
+ reason
16764
+ };
16765
+ };
16766
+ try {
16767
+ const result = await api.actions.run.mutate({ actionId });
16768
+ if (result.outcome === "skipped-overlap") return refuse("already-running", result.message);
16769
+ if (result.outcome === "skipped-cooldown") return refuse("cooldown", result.message);
16770
+ if (result.outcome === "failed" || result.outcome === "aborted") {
16771
+ const message = result.message ?? result.outcome;
16772
+ log.warn(`${exporter}: exported action failed`, {
16773
+ tags,
16774
+ meta: {
16775
+ outcome: result.outcome,
16776
+ message
16777
+ }
16778
+ });
16779
+ return {
16780
+ status: "failed",
16781
+ message
16782
+ };
16783
+ }
16784
+ log.info(`${exporter}: exported action ran`, {
16785
+ tags,
16786
+ meta: { outcome: result.outcome }
16787
+ });
16788
+ return { status: "started" };
16789
+ } catch (err) {
16790
+ const message = errorText(err);
16791
+ const reason = refusalFromThrown(message);
16792
+ if (reason !== null) return refuse(reason, message);
16793
+ log.warn(`${exporter}: exported action failed`, {
16794
+ tags,
16795
+ meta: { message }
16796
+ });
16797
+ return {
16798
+ status: "failed",
16799
+ message
16800
+ };
16801
+ }
16802
+ }
16803
+ /**
16804
+ * Split an exporter's selection into what still exists and what was deleted.
16805
+ * Devices are never judged here (their lifecycle is the tombstone, D865).
16806
+ * Callers pass ids from a query that ANSWERED — an unanswered list must not
16807
+ * reach this function (D49: a failed read changes nothing).
16808
+ */
16809
+ function pruneDeletedEntities(selection, live, log, exporter) {
16810
+ const kept = [];
16811
+ const dropped = [];
16812
+ for (const ref of selection) if (ref.kind === "action" && !live.actionIds.has(ref.actionId)) {
16813
+ dropped.push(ref);
16814
+ log.warn(`${exporter}: exported action was deleted — dropped from the export`, { tags: { actionId: ref.actionId } });
16815
+ } else if (ref.kind === "notifier" && !live.targetIds.has(ref.targetId)) {
16816
+ dropped.push(ref);
16817
+ log.warn(`${exporter}: exported notifier target was deleted — dropped from the export`, { tags: { targetId: ref.targetId } });
16818
+ } else kept.push(ref);
16819
+ return {
16820
+ kept,
16821
+ dropped
16822
+ };
16823
+ }
16824
+ /**
16140
16825
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16141
16826
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
16142
16827
  *
@@ -16168,52 +16853,6 @@ var AddonPageInfoSchema = object({
16168
16853
  bundleUrl: string()
16169
16854
  });
16170
16855
  method(_void(), array(AddonPageInfoSchema).readonly());
16171
- /**
16172
- * `addon-pages-source` — collection cap exposing per-provider raw page
16173
- * declarations. Every addon that contributes a UI page registers a
16174
- * provider here. The hub-side singleton aggregator (`addon-pages` cap,
16175
- * see `addon-pages.cap.ts`) walks this collection, stamps versioned
16176
- * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
16177
- * that admin-ui consumes.
16178
- *
16179
- * The split exists because the public listing has a different output
16180
- * shape than the per-provider raw declarations, and we want both ends
16181
- * to flow through codegen instead of relying on a hand-written wrapper.
16182
- */
16183
- var AddonPageDeclarationSchema = object({
16184
- id: string(),
16185
- label: string(),
16186
- icon: string(),
16187
- path: string(),
16188
- /**
16189
- * Module Federation remote name — must match the `name` field on the
16190
- * page addon's `federation()` plugin config. Used by admin-ui's
16191
- * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
16192
- * Conventionally `addon_<id>_page` (snake_case; MF names cannot
16193
- * contain hyphens).
16194
- */
16195
- remoteName: string(),
16196
- /**
16197
- * Bundle filename inside the addon's `dist/` dir served at
16198
- * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
16199
- * is always `'remoteEntry.js'`; the value is kept on the metadata so
16200
- * the static-file route can compute an mtime-based cache-buster URL
16201
- * without a separate filesystem stat.
16202
- */
16203
- bundle: string(),
16204
- /**
16205
- * Sidebar section this page docks into. Well-known ids: `'detection'`,
16206
- * `'cluster'`, `'administration'` — the page renders inside that group.
16207
- * Any OTHER string creates (or joins) a custom section rendered after
16208
- * the built-in groups; its label comes from `sectionLabel` (first
16209
- * declaration wins), falling back to the id. Absent → the legacy
16210
- * "Addon Pages" group.
16211
- */
16212
- section: string().optional(),
16213
- /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
16214
- sectionLabel: string().optional()
16215
- });
16216
- method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
16217
16856
  var AddonHttpRouteSchema = object({
16218
16857
  method: _enum([
16219
16858
  "GET",
@@ -16514,9 +17153,21 @@ var AlertSeveritySchema = _enum([
16514
17153
  "error",
16515
17154
  "critical"
16516
17155
  ]);
17156
+ /**
17157
+ * An action that RUNS something instead of going somewhere: the admin UI calls
17158
+ * the addon's custom action (`addons.custom`) with exactly these fields. The
17159
+ * producer owns the meaning; the UI knows nothing about the addon or the kind.
17160
+ */
17161
+ var AlertActionInvokeSchema = object({
17162
+ addonId: string().min(1),
17163
+ action: string().min(1),
17164
+ input: record(string(), unknown()).optional()
17165
+ });
17166
+ /** An action has `href` (a link) OR `invoke` (a button that runs a custom action). */
16517
17167
  var AlertActionSchema = object({
16518
17168
  label: string(),
16519
17169
  href: string().optional(),
17170
+ invoke: AlertActionInvokeSchema.optional(),
16520
17171
  /**
16521
17172
  * How `href` is followed. Absent / `app`: an admin-ui route (client-side).
16522
17173
  * `server`: a route the HUB serves (an addon HTTP route such as an OAuth
@@ -18763,7 +19414,11 @@ var CompositionProblemSchema = object({
18763
19414
  "mixed-quantity",
18764
19415
  "helper-mismatch",
18765
19416
  "member-constraint",
18766
- "retention"
19417
+ "retention",
19418
+ "command-method-unknown",
19419
+ "command-source-unknown",
19420
+ "command-input-unknown",
19421
+ "command-input-missing"
18767
19422
  ]),
18768
19423
  path: string(),
18769
19424
  message: string()
@@ -18802,7 +19457,9 @@ var CompositionFieldRoleSchema = _enum([
18802
19457
  var CompositionFieldItemSchema = object({
18803
19458
  arrayPath: string(),
18804
19459
  key: string(),
18805
- label: string()
19460
+ label: string(),
19461
+ /** True when the item carries a `reset` forward: the composer writes `resettable` from this (D967). */
19462
+ resettable: boolean().optional()
18806
19463
  });
18807
19464
  var CompositionFieldPlanSchema = object({
18808
19465
  cap: string(),
@@ -19007,7 +19664,7 @@ Object.freeze({
19007
19664
  * One catalog row per base reading a group helper can build (D944 §3).
19008
19665
  * Data, not a form default written into the block.
19009
19666
  */
19010
- var NOW$2 = {
19667
+ var NOW$3 = {
19011
19668
  fieldPath: "lastFetchedAt",
19012
19669
  expr: "now"
19013
19670
  };
@@ -19016,12 +19673,13 @@ var CHANGED = {
19016
19673
  expr: "now"
19017
19674
  };
19018
19675
  function numeric(input) {
19676
+ const { alsoFrom, ...base } = input;
19019
19677
  return {
19020
- ...input,
19678
+ ...base,
19021
19679
  family: "numeric",
19022
19680
  deviceType: DeviceType.Sensor,
19023
19681
  memberDeviceType: DeviceType.Sensor,
19024
- memberDeviceTypes: [DeviceType.Sensor],
19682
+ memberDeviceTypes: [DeviceType.Sensor, ...alsoFrom?.deviceTypes ?? []],
19025
19683
  activeWhen: void 0,
19026
19684
  commandCaps: [],
19027
19685
  baseUnit: baseUnitOf(input.quantity),
@@ -19029,9 +19687,10 @@ function numeric(input) {
19029
19687
  accept: [{
19030
19688
  cap: input.outputCap,
19031
19689
  fieldPath: input.outputField
19032
- }]
19690
+ }, ...alsoFrom === void 0 ? [] : [alsoFrom.accept]]
19033
19691
  };
19034
19692
  }
19693
+ var CLIMATE_DEVICES = [DeviceType.Thermostat, DeviceType.Climate];
19035
19694
  function binary(input) {
19036
19695
  return {
19037
19696
  ...input,
@@ -19057,7 +19716,14 @@ var GROUP_TEMPLATES = [
19057
19716
  quantity: "temperature",
19058
19717
  defaultAggregate: "mean",
19059
19718
  empty: "null",
19060
- companions: [NOW$2]
19719
+ companions: [NOW$3],
19720
+ alsoFrom: {
19721
+ deviceTypes: CLIMATE_DEVICES,
19722
+ accept: {
19723
+ cap: "climate-control",
19724
+ fieldPath: "currentTemp"
19725
+ }
19726
+ }
19061
19727
  }),
19062
19728
  numeric({
19063
19729
  id: "humidity",
@@ -19068,7 +19734,14 @@ var GROUP_TEMPLATES = [
19068
19734
  quantity: "humidity",
19069
19735
  defaultAggregate: "mean",
19070
19736
  empty: "null",
19071
- companions: [NOW$2]
19737
+ companions: [NOW$3],
19738
+ alsoFrom: {
19739
+ deviceTypes: CLIMATE_DEVICES,
19740
+ accept: {
19741
+ cap: "climate-control",
19742
+ fieldPath: "currentHumidity"
19743
+ }
19744
+ }
19072
19745
  }),
19073
19746
  numeric({
19074
19747
  id: "pressure",
@@ -19079,7 +19752,7 @@ var GROUP_TEMPLATES = [
19079
19752
  quantity: "pressure",
19080
19753
  defaultAggregate: "mean",
19081
19754
  empty: "null",
19082
- companions: [NOW$2]
19755
+ companions: [NOW$3]
19083
19756
  }),
19084
19757
  numeric({
19085
19758
  id: "illuminance",
@@ -19090,7 +19763,7 @@ var GROUP_TEMPLATES = [
19090
19763
  quantity: "illuminance",
19091
19764
  defaultAggregate: "mean",
19092
19765
  empty: "null",
19093
- companions: [NOW$2]
19766
+ companions: [NOW$3]
19094
19767
  }),
19095
19768
  numeric({
19096
19769
  id: "power",
@@ -19101,7 +19774,7 @@ var GROUP_TEMPLATES = [
19101
19774
  quantity: "power",
19102
19775
  defaultAggregate: "sum",
19103
19776
  empty: "omit",
19104
- companions: [NOW$2]
19777
+ companions: [NOW$3]
19105
19778
  }),
19106
19779
  numeric({
19107
19780
  id: "energy",
@@ -19112,7 +19785,7 @@ var GROUP_TEMPLATES = [
19112
19785
  quantity: "energy",
19113
19786
  defaultAggregate: "sum",
19114
19787
  empty: "omit",
19115
- companions: [NOW$2]
19788
+ companions: [NOW$3]
19116
19789
  }),
19117
19790
  numeric({
19118
19791
  id: "battery",
@@ -19147,7 +19820,7 @@ var GROUP_TEMPLATES = [
19147
19820
  quantity: "device",
19148
19821
  defaultAggregate: "mean",
19149
19822
  empty: "null",
19150
- companions: [NOW$2]
19823
+ companions: [NOW$3]
19151
19824
  }),
19152
19825
  binary({
19153
19826
  id: "motion",
@@ -21493,6 +22166,36 @@ var ExposeInputSchema = object({
21493
22166
  capabilities: array(string()).optional()
21494
22167
  });
21495
22168
  var UnexposeInputSchema = object({ deviceId: string() });
22169
+ /**
22170
+ * What an exporter may expose besides devices (D968). An action and a
22171
+ * notification target are LIST ENTRIES, never devices (D954): they enter an
22172
+ * exporter's own selection, not the device registry.
22173
+ */
22174
+ var ExportEntityKindSchema = _enum([
22175
+ "device",
22176
+ "action",
22177
+ "notifier"
22178
+ ]);
22179
+ var ExportEntityRefSchema = discriminatedUnion("kind", [
22180
+ object({
22181
+ kind: literal("device"),
22182
+ deviceId: string()
22183
+ }),
22184
+ object({
22185
+ kind: literal("action"),
22186
+ actionId: string().min(1)
22187
+ }),
22188
+ object({
22189
+ kind: literal("notifier"),
22190
+ targetId: string().min(1)
22191
+ })
22192
+ ]);
22193
+ var ExposedEntitySchema = object({
22194
+ entity: ExportEntityRefSchema,
22195
+ exposedAs: string().optional()
22196
+ });
22197
+ var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
22198
+ var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
21496
22199
  var deviceExportCapability = {
21497
22200
  name: "device-export",
21498
22201
  scope: "system",
@@ -21522,6 +22225,16 @@ var deviceExportCapability = {
21522
22225
  unexposeDevice: method(UnexposeInputSchema, _void(), {
21523
22226
  kind: "mutation",
21524
22227
  auth: "admin"
22228
+ }),
22229
+ listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
22230
+ listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
22231
+ exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
22232
+ kind: "mutation",
22233
+ auth: "admin"
22234
+ }),
22235
+ unexposeEntity: optionalMethod(UnexposeEntityInputSchema, _void(), {
22236
+ kind: "mutation",
22237
+ auth: "admin"
21525
22238
  })
21526
22239
  }
21527
22240
  };
@@ -42664,6 +43377,14 @@ method(object({
42664
43377
  kind: "mutation",
42665
43378
  auth: "admin"
42666
43379
  });
43380
+ method(object({
43381
+ nodeId: string().min(1),
43382
+ /** Epoch ms the node was forgotten (the tombstone's `removedAt`). */
43383
+ removedAt: number()
43384
+ }), object({ counts: record(string(), number().int().nonnegative()) }), {
43385
+ kind: "mutation",
43386
+ auth: "admin"
43387
+ });
42667
43388
  /**
42668
43389
  * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
42669
43390
  * so it can delete what it keeps for that device (D865).
@@ -43311,6 +44032,17 @@ var LlmProfileSchema = object({
43311
44032
  * field in its editor only when its descriptor lists it in `profileFields`. */
43312
44033
  topK: number().int().positive().optional(),
43313
44034
  maxTokens: number().int().positive().optional(),
44035
+ /** How hard the model "thinks" before it answers. Omitted = the model's own
44036
+ * default. `off` matters for structured output: a thinking model can spend
44037
+ * the whole completion on reasoning and return an empty `content`. Carried
44038
+ * only by the wires that have it — a kind offers the field in its editor
44039
+ * only when its descriptor lists it in `profileFields`. */
44040
+ reasoningEffort: _enum([
44041
+ "off",
44042
+ "low",
44043
+ "medium",
44044
+ "high"
44045
+ ]).optional(),
43314
44046
  /** Prompt context window. Advisory for cloud kinds (they enforce their own). */
43315
44047
  contextLength: number().int().positive().optional(),
43316
44048
  /** Default system prompt. A caller's `system` REPLACES it (never appends —
@@ -43349,6 +44081,7 @@ var LlmProfileFieldSchema = _enum([
43349
44081
  "topP",
43350
44082
  "topK",
43351
44083
  "maxTokens",
44084
+ "reasoningEffort",
43352
44085
  "contextLength",
43353
44086
  "systemPrompt",
43354
44087
  "timeoutMs",
@@ -43372,7 +44105,7 @@ var LlmProviderWidgetSchema = object({
43372
44105
  /** ConfigUISchema tree passed through untyped on the wire (the
43373
44106
  * notification-output `ConfigSchemaPassthrough` precedent at
43374
44107
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
43375
- var ConfigSchemaPassthrough$3 = unknown();
44108
+ var ConfigSchemaPassthrough$2 = unknown();
43376
44109
  var LlmProfileKindDescriptorSchema = object({
43377
44110
  kind: LlmProfileKindSchema,
43378
44111
  label: string(),
@@ -43381,9 +44114,9 @@ var LlmProfileKindDescriptorSchema = object({
43381
44114
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
43382
44115
  addonId: string(),
43383
44116
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
43384
- connectionSchema: ConfigSchemaPassthrough$3,
44117
+ connectionSchema: ConfigSchemaPassthrough$2,
43385
44118
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
43386
- advancedSchema: ConfigSchemaPassthrough$3.optional(),
44119
+ advancedSchema: ConfigSchemaPassthrough$2.optional(),
43387
44120
  /** The kind's defaults; a model from `listModels` may override any of them. */
43388
44121
  features: LlmModelFeaturesSchema,
43389
44122
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -43909,10 +44642,10 @@ var CpuBreakdownSchema = object({
43909
44642
  cores: number()
43910
44643
  });
43911
44644
  var MemoryInfoSchema = object({
43912
- percent: number(),
44645
+ percent: number().nullable(),
43913
44646
  totalBytes: number(),
43914
- usedBytes: number(),
43915
- availableBytes: number(),
44647
+ usedBytes: number().nullable(),
44648
+ availableBytes: number().nullable(),
43916
44649
  swapUsedBytes: number(),
43917
44650
  swapTotalBytes: number()
43918
44651
  });
@@ -44216,8 +44949,9 @@ var GetLoadSeriesInputSchema = object({
44216
44949
  });
44217
44950
  var SystemMetricsSchema = object({
44218
44951
  cpuPercent: number(),
44219
- memoryPercent: number(),
44220
- memoryUsedMB: number(),
44952
+ /** `null` when the memory sample failed or was not taken yet (D393). */
44953
+ memoryPercent: number().nullable(),
44954
+ memoryUsedMB: number().nullable(),
44221
44955
  memoryTotalMB: number(),
44222
44956
  diskPercent: number().optional(),
44223
44957
  temperature: number().optional(),
@@ -44453,379 +45187,6 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
44453
45187
  sourcePort: number().optional()
44454
45188
  });
44455
45189
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
44456
- /**
44457
- * notification-output — canonical, capability-gated notification delivery.
44458
- *
44459
- * Apprise-derived model (see
44460
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44461
- * callers emit ONE canonical `Notification`; each provider declares a
44462
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44463
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44464
- * message to what the kind supports — callers never special-case a service.
44465
- *
44466
- * DESIGN DECISIONS (locked):
44467
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44468
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44469
- * cap. Rationale: the admin UI needs one uniform surface across the
44470
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44471
- * alternative would fork the UI per addon and cannot host the
44472
- * discovery→adopt flow.
44473
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44474
- * the generated cap-mount auto-`concatCollection`-fans them across every
44475
- * registered provider (notifiers addon + HA addon) so one catalog is
44476
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44477
- * `addonId` the generated collection router extracts from the call input.
44478
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44479
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44480
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44481
- * base64 fallback needed.
44482
- *
44483
- * TODO (deferred, closed-set change — separate decision): add
44484
- * `providerKind: 'notify'` so notification providers surface on the unified
44485
- * admin "Integrations" page.
44486
- */
44487
- /**
44488
- * Zentik-derived typed-media enum — the superset across every kind. Each
44489
- * adapter picks what it supports and the degrade engine filters the rest.
44490
- */
44491
- var AttachmentMediaTypeSchema = _enum([
44492
- "image",
44493
- "video",
44494
- "gif",
44495
- "audio",
44496
- "icon"
44497
- ]);
44498
- /**
44499
- * A single attachment. Exactly one of `url` (remote source, most adapters
44500
- * prefer this) or `bytes` (inline source; required for Pushover-style
44501
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44502
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44503
- */
44504
- var AttachmentSchema = object({
44505
- mediaType: AttachmentMediaTypeSchema,
44506
- url: string().optional(),
44507
- bytes: _instanceof(Uint8Array).optional(),
44508
- mime: string().optional(),
44509
- name: string().optional()
44510
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44511
- var NotificationFormatSchema = _enum([
44512
- "text",
44513
- "markdown",
44514
- "html"
44515
- ]);
44516
- /**
44517
- * The CLOSED icon vocabulary an action button may use.
44518
- *
44519
- * A closed set, not a free string, and that is the whole point: an arbitrary
44520
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44521
- * notices — the same class of gap as a zone vocabulary nothing produced
44522
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44523
- * declares `actionIcons: false` and the degrade engine strips the field.
44524
- *
44525
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44526
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44527
- * differently.
44528
- *
44529
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44530
- *
44531
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44532
- * the whole set onto its own renderer's vocabulary through a
44533
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44534
- * fallback, so adding a member here fails every adapter's build until someone
44535
- * decides its glyph, which is the only place that decision can be made
44536
- * honestly.
44537
- *
44538
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44539
- * `disarm` straight through; iOS feeds that string to
44540
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44541
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44542
- * mapping, and "the field is documented" is not "the value renders".
44543
- *
44544
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44545
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44546
- * so an addon that emits a token the running hub does not know does not lose an
44547
- * icon — its whole `send` fails Zod validation and the notification never
44548
- * arrives. Never emit a new token from an addon before the train carrying it.
44549
- */
44550
- var NotificationActionIconSchema = _enum([
44551
- "acknowledge",
44552
- "dismiss",
44553
- "silence",
44554
- "snooze",
44555
- "view",
44556
- "play",
44557
- "open",
44558
- "close",
44559
- "lock",
44560
- "unlock",
44561
- "arm",
44562
- "arm-home",
44563
- "arm-away",
44564
- "arm-night",
44565
- "disarm",
44566
- "light",
44567
- "alert",
44568
- "camera"
44569
- ]);
44570
- /** A single tap-through action button. */
44571
- var NotificationActionSchema = object({
44572
- id: string(),
44573
- label: string(),
44574
- url: string().optional(),
44575
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44576
- icon: NotificationActionIconSchema.optional(),
44577
- /**
44578
- * Renders in a warning style where the notifier supports it.
44579
- *
44580
- * A HINT, never a gate. The callback's authority is its token and nothing
44581
- * else — see `notification-center/action-token.ts` for what that does and
44582
- * does not buy.
44583
- */
44584
- destructive: boolean().optional(),
44585
- /**
44586
- * How the tap should REACH the url.
44587
- *
44588
- * `navigate` (absent, and every button authored before this field) opens it:
44589
- * the phone leaves the notification and shows whatever the callback returns.
44590
- * That is right for a button whose answer the operator wants to read.
44591
- *
44592
- * `background` fires it as a POST and stays put. It exists for the buttons
44593
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44594
- * an answer to the notification, and being thrown into a browser tab to
44595
- * confirm it costs more attention than the notification did. A backend that
44596
- * cannot do a background call renders it as an ordinary link (the adapters
44597
- * fall back rather than dropping the button), so this is a preference, never
44598
- * a requirement.
44599
- */
44600
- mode: _enum(["navigate", "background"]).optional()
44601
- });
44602
- /**
44603
- * The canonical notification. `body` is the only hard field (Apprise model).
44604
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44605
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44606
- * the adapter maps this ordinal onto its native level. `level?` is an
44607
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44608
- * `priority` for that one target.
44609
- */
44610
- var NotificationSchema = object({
44611
- body: string(),
44612
- title: string().optional(),
44613
- format: NotificationFormatSchema.default("text"),
44614
- priority: number().int().min(1).max(5).default(3),
44615
- level: string().optional(),
44616
- attachments: array(AttachmentSchema).optional(),
44617
- clickUrl: string().optional(),
44618
- actions: array(NotificationActionSchema).optional(),
44619
- sound: string().optional(),
44620
- ttl: number().optional(),
44621
- tag: string().optional(),
44622
- deviceId: number().optional(),
44623
- eventId: string().optional(),
44624
- metadata: record(string(), unknown()).optional()
44625
- });
44626
- /** One declared native severity/priority level for a kind. */
44627
- var TargetKindLevelSchema = object({
44628
- id: string(),
44629
- label: string(),
44630
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44631
- ordinal: number().int().min(1).max(5).nullable(),
44632
- flags: object({
44633
- critical: boolean().optional(),
44634
- silent: boolean().optional(),
44635
- noPush: boolean().optional()
44636
- }).optional(),
44637
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44638
- requires: array(string()).optional(),
44639
- description: string().optional()
44640
- });
44641
- /** The full capability block consulted before dispatch. */
44642
- var TargetKindCapsSchema = object({
44643
- attachments: object({
44644
- mediaTypes: array(AttachmentMediaTypeSchema),
44645
- mode: _enum([
44646
- "url",
44647
- "bytes",
44648
- "both"
44649
- ]),
44650
- max: number().int().nonnegative(),
44651
- maxBytes: number().int().positive().optional()
44652
- }),
44653
- /** Max action buttons (0 = none). */
44654
- actions: number().int().nonnegative(),
44655
- /**
44656
- * Whether this kind renders a per-action ICON.
44657
- *
44658
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44659
- * run on the addon cap path — three production failures in one day taught
44660
- * this repo that once. Absent is read as false by the degrade engine, which
44661
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44662
- * assumed and dropped costs the operator's trust in the field.
44663
- */
44664
- actionIcons: boolean().optional(),
44665
- levels: array(TargetKindLevelSchema),
44666
- format: array(NotificationFormatSchema),
44667
- clickUrl: boolean(),
44668
- sound: boolean(),
44669
- ttl: boolean(),
44670
- bodyMaxLen: number().int().positive()
44671
- });
44672
- /**
44673
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44674
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44675
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44676
- * the union is large and not meant for runtime validation here; the exported
44677
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44678
- */
44679
- var ConfigSchemaPassthrough$2 = unknown();
44680
- var TargetKindSchema = object({
44681
- kind: string(),
44682
- label: string(),
44683
- icon: string(),
44684
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44685
- addonId: string(),
44686
- /**
44687
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44688
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44689
- * when the addon bundles no icon for that kind — the client then falls back
44690
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44691
- *
44692
- * Root-relative on purpose: it resolves against whatever origin serves a web
44693
- * client, and a native client joins it onto its own hub base.
44694
- *
44695
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44696
- * field that survived only because the runtime cap-router forwards provider
44697
- * output verbatim — so every consumer had to re-declare it by hand to stop
44698
- * its own Zod parse from stripping it, and the whole arrangement would have
44699
- * broken silently the moment output validation was tightened anywhere.
44700
- */
44701
- iconUrl: string().optional(),
44702
- /**
44703
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44704
- *
44705
- * The server knows this and therefore says it, because the client cannot
44706
- * safely guess: a React-Native client renders SVG and raster through two
44707
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44708
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44709
- * placeholder glyph for every vector icon while the web build looked fine.
44710
- *
44711
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44712
- * not been updated — a client that cannot determine the type should prefer
44713
- * its raster path, which is the safe default for an unknown image.
44714
- */
44715
- iconMediaType: string().optional(),
44716
- configSchema: ConfigSchemaPassthrough$2,
44717
- /**
44718
- * The config keys that decide WHERE this kind's secrets are sent (server,
44719
- * base URL, instance, chat, recipient). A save that changes any of them
44720
- * while leaving a secret redacted is refused by the provider (D634), so an
44721
- * editor uses this to ask for the secret on exactly those edits instead of
44722
- * on every edit.
44723
- *
44724
- * Optional: absent from a provider that holds no secret (the Home Assistant
44725
- * kinds) and from a provider older than this field — an editor that finds
44726
- * it absent must assume ANY edit may need the secret.
44727
- */
44728
- destinationKeys: array(string()).optional(),
44729
- supportsDiscovery: boolean(),
44730
- caps: TargetKindCapsSchema
44731
- });
44732
- /**
44733
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44734
- * (return a presence marker only) when serving `listTargets` — never
44735
- * round-trip a stored secret to the UI.
44736
- */
44737
- var TargetSchema = object({
44738
- id: string(),
44739
- name: string(),
44740
- kind: string(),
44741
- addonId: string(),
44742
- enabled: boolean(),
44743
- config: record(string(), unknown())
44744
- });
44745
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44746
- var DiscoveredTargetSchema = object({
44747
- kind: string(),
44748
- suggestedName: string(),
44749
- config: record(string(), unknown())
44750
- });
44751
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44752
- var RenderedAsSchema = object({
44753
- level: string(),
44754
- format: NotificationFormatSchema,
44755
- attachmentsSent: number().int().nonnegative(),
44756
- actionsSent: number().int().nonnegative(),
44757
- truncated: boolean(),
44758
- dropped: array(string())
44759
- });
44760
- var SendResultSchema = object({
44761
- success: boolean(),
44762
- error: string().optional(),
44763
- renderedAs: RenderedAsSchema.optional()
44764
- });
44765
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44766
- var TestResultSchema = SendResultSchema;
44767
- /**
44768
- * Pre-save credential probe against a partial (unsaved) target config.
44769
- * `resolvedUrl` never includes secrets (token stripped from path).
44770
- */
44771
- var ProbeTargetConfigResultSchema = object({
44772
- ok: boolean(),
44773
- resolvedUrl: string(),
44774
- httpStatus: number().int().optional(),
44775
- stateInstance: string().optional(),
44776
- error: string().optional()
44777
- });
44778
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44779
- kind: string(),
44780
- config: record(string(), unknown()).optional(),
44781
- /**
44782
- * When editing / duplicating, the blank password field never round-trips
44783
- * the stored token. Pass the source target id so the provider can restore
44784
- * secrets server-side before dialling (same merge as upsert).
44785
- */
44786
- targetId: string().optional()
44787
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44788
- kind: string(),
44789
- config: record(string(), unknown()),
44790
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44791
- targetId: string().optional()
44792
- }), ProbeTargetConfigResultSchema, {
44793
- kind: "mutation",
44794
- auth: "admin"
44795
- }), method(object({
44796
- targetId: string(),
44797
- notification: NotificationSchema
44798
- }), SendResultSchema, {
44799
- kind: "mutation",
44800
- auth: "admin"
44801
- }), method(object({
44802
- targetId: string(),
44803
- sample: NotificationSchema.optional()
44804
- }), TestResultSchema, {
44805
- kind: "mutation",
44806
- auth: "admin"
44807
- }), method(object({
44808
- target: TargetSchema,
44809
- /**
44810
- * Duplicate flow: create a NEW target id while copying secrets from an
44811
- * existing row. The UI never holds the stored token; blank / redacted
44812
- * password fields are restored from this source (D634 still applies if
44813
- * destinations diverge without a re-typed secret).
44814
- */
44815
- cloneSecretsFrom: string().optional()
44816
- }), TargetSchema, {
44817
- kind: "mutation",
44818
- auth: "admin"
44819
- }), method(object({ targetId: string() }), _void(), {
44820
- kind: "mutation",
44821
- auth: "admin"
44822
- }), method(object({
44823
- targetId: string(),
44824
- enabled: boolean()
44825
- }), _void(), {
44826
- kind: "mutation",
44827
- auth: "admin"
44828
- });
44829
45190
  var AUDIO_MACRO_LABELS = [
44830
45191
  {
44831
45192
  id: "speech",
@@ -51242,14 +51603,6 @@ var EngineProvisioningSchema = object({
51242
51603
  */
51243
51604
  configIssues: array(string()).optional()
51244
51605
  });
51245
- var PipelineStepInputSchema = lazy(() => object({
51246
- addonId: string(),
51247
- modelId: string().optional(),
51248
- enabled: boolean().default(true),
51249
- children: array(PipelineStepInputSchema).optional(),
51250
- settings: record(string(), unknown()).optional(),
51251
- jumpDeviceKey: string().optional()
51252
- }));
51253
51606
  var ModelSubstitutionSchema = object({
51254
51607
  addonId: string(),
51255
51608
  chosen: string(),
@@ -51328,7 +51681,6 @@ var ConfigUISchemaBridge = custom();
51328
51681
  var ConfigUISchemaNullableBridge = custom();
51329
51682
  var InferenceCapabilitiesBridge = custom();
51330
51683
  var ModelAvailabilityListBridge = custom();
51331
- var PipelineRunResultBridge = custom();
51332
51684
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
51333
51685
  modelId: string(),
51334
51686
  settings: record(string(), unknown()).readonly()
@@ -56913,7 +57265,9 @@ var ManifestShapeSchema = object({
56913
57265
  icon: string().optional()
56914
57266
  }).optional(),
56915
57267
  protected: boolean().optional(),
56916
- removable: boolean().optional()
57268
+ removable: boolean().optional(),
57269
+ /** Declared Integrations-page block (mirror of `AddonDeclaration.integrationSection`). */
57270
+ integrationSection: _enum(["system", "providers"]).optional()
56917
57271
  });
56918
57272
  var AddonProcessSchema = object({
56919
57273
  pid: number().optional(),
@@ -57642,11 +57996,373 @@ DeviceType.Light, method(object({
57642
57996
  level: number().min(0).max(100),
57643
57997
  lastChangedAt: number()
57644
57998
  });
57999
+ /**
58000
+ * The role vocabulary of a remote (D963): what a button MEANS, independent of
58001
+ * how it is wired. A layout template places buttons by role; a device binds a
58002
+ * role to an action; an exporter asks for a role by name. Roles are shared so
58003
+ * one layout fits every appliance and one voice command fits every binding.
58004
+ *
58005
+ * A role outside this list is `custom:<key>` — the operator's own button (a
58006
+ * SmartIR source, a channel preset). The key is a lowercase slug.
58007
+ */
58008
+ var REMOTE_KNOWN_ROLES = [
58009
+ "power",
58010
+ "power_on",
58011
+ "power_off",
58012
+ "volume_up",
58013
+ "volume_down",
58014
+ "mute",
58015
+ "channel_up",
58016
+ "channel_down",
58017
+ "up",
58018
+ "down",
58019
+ "left",
58020
+ "right",
58021
+ "ok",
58022
+ "back",
58023
+ "home",
58024
+ "menu",
58025
+ "info",
58026
+ "guide",
58027
+ "exit",
58028
+ "input",
58029
+ "play",
58030
+ "pause",
58031
+ "play_pause",
58032
+ "stop",
58033
+ "next",
58034
+ "previous",
58035
+ "fast_forward",
58036
+ "rewind",
58037
+ "digit_0",
58038
+ "digit_1",
58039
+ "digit_2",
58040
+ "digit_3",
58041
+ "digit_4",
58042
+ "digit_5",
58043
+ "digit_6",
58044
+ "digit_7",
58045
+ "digit_8",
58046
+ "digit_9"
58047
+ ];
58048
+ var CUSTOM_KEY_RE = /^[a-z0-9][a-z0-9_]{0,47}$/;
58049
+ var KNOWN_ROLES = new Set(REMOTE_KNOWN_ROLES);
58050
+ function isRemoteKnownRole(value) {
58051
+ return KNOWN_ROLES.has(value);
58052
+ }
58053
+ function isRemoteCustomKey(key) {
58054
+ return CUSTOM_KEY_RE.test(key);
58055
+ }
58056
+ /** The key of a `custom:<key>` role, or null for any other string. */
58057
+ function customKeyOfRole(role) {
58058
+ if (!role.startsWith("custom:")) return null;
58059
+ const key = role.slice(7);
58060
+ return isRemoteCustomKey(key) ? key : null;
58061
+ }
58062
+ function isRemoteRole(value) {
58063
+ return isRemoteKnownRole(value) || customKeyOfRole(value) !== null;
58064
+ }
58065
+ var RemoteRoleSchema = string().refine(isRemoteRole, { message: "a role is one of the known roles or custom:<key> (lowercase letters, digits, _)" });
58066
+ var RemoteBindingSchema = object({ action: AutomationCapStepSchema.extend({ deviceId: number().int().nonnegative() }) });
58067
+ var RemoteCustomButtonSchema = object({
58068
+ /** The slug after `custom:` in the role. */
58069
+ key: string().refine(isRemoteCustomKey, { message: "a lowercase slug" }),
58070
+ /** What the operator calls it, and what a voice command may name. */
58071
+ name: string().min(1).max(60)
58072
+ });
58073
+ var RemotePowerModeSchema = _enum(["toggle", "discrete"]);
58074
+ var RemoteConfigSchema = object({
58075
+ layoutTemplateId: string().min(1).nullable(),
58076
+ /**
58077
+ * The transmitter device new bindings and an import send through. A binding
58078
+ * names its own device, so one command may override it.
58079
+ */
58080
+ defaultTransmitterId: number().int().nonnegative().nullable().default(null),
58081
+ /** Keyed by role. A role with no entry falls back to the native cap. */
58082
+ bindings: record(string(), RemoteBindingSchema),
58083
+ customButtons: array(RemoteCustomButtonSchema).max(100),
58084
+ power: object({ mode: RemotePowerModeSchema })
58085
+ }).superRefine((config, ctx) => {
58086
+ const roles = Object.keys(config.bindings);
58087
+ if (roles.length > 200) ctx.addIssue({
58088
+ code: "custom",
58089
+ message: "too many bindings",
58090
+ path: ["bindings"]
58091
+ });
58092
+ for (const role of roles) if (!isRemoteRole(role)) ctx.addIssue({
58093
+ code: "custom",
58094
+ message: `"${role}" is not a role`,
58095
+ path: ["bindings", role]
58096
+ });
58097
+ const keys = /* @__PURE__ */ new Set();
58098
+ config.customButtons.forEach((button, index) => {
58099
+ if (keys.has(button.key)) ctx.addIssue({
58100
+ code: "custom",
58101
+ message: `custom button "${button.key}" is listed twice`,
58102
+ path: [
58103
+ "customButtons",
58104
+ index,
58105
+ "key"
58106
+ ]
58107
+ });
58108
+ keys.add(button.key);
58109
+ });
58110
+ for (const role of roles) {
58111
+ const key = customKeyOfRole(role);
58112
+ if (key !== null && !keys.has(key)) ctx.addIssue({
58113
+ code: "custom",
58114
+ message: `${role} is bound but has no entry in customButtons`,
58115
+ path: ["bindings", role]
58116
+ });
58117
+ }
58118
+ });
58119
+ object({
58120
+ power: object({
58121
+ state: _enum(["on", "off"]),
58122
+ at: number()
58123
+ }).nullable(),
58124
+ muted: object({
58125
+ value: boolean(),
58126
+ at: number()
58127
+ }).nullable()
58128
+ });
58129
+ var RemoteLayoutButtonSchema = object({
58130
+ id: string().min(1).max(40),
58131
+ /** 0-based grid position. */
58132
+ row: number().int().min(0).max(24),
58133
+ col: number().int().min(0).max(24),
58134
+ rowSpan: number().int().min(1).max(24),
58135
+ colSpan: number().int().min(1).max(24),
58136
+ icon: string().min(1).max(60).optional(),
58137
+ label: string().min(1).max(40).optional(),
58138
+ role: RemoteRoleSchema
58139
+ });
58140
+ object({
58141
+ columns: number().int().min(1).max(24),
58142
+ rows: number().int().min(1).max(24),
58143
+ buttons: array(RemoteLayoutButtonSchema).max(200)
58144
+ }).superRefine((grid, ctx) => {
58145
+ const ids = /* @__PURE__ */ new Set();
58146
+ const taken = /* @__PURE__ */ new Map();
58147
+ grid.buttons.forEach((button, index) => {
58148
+ if (ids.has(button.id)) ctx.addIssue({
58149
+ code: "custom",
58150
+ message: `button id "${button.id}" is used twice`,
58151
+ path: [
58152
+ "buttons",
58153
+ index,
58154
+ "id"
58155
+ ]
58156
+ });
58157
+ ids.add(button.id);
58158
+ if (button.row + button.rowSpan > grid.rows || button.col + button.colSpan > grid.columns) {
58159
+ ctx.addIssue({
58160
+ code: "custom",
58161
+ message: `button "${button.id}" leaves the grid`,
58162
+ path: ["buttons", index]
58163
+ });
58164
+ return;
58165
+ }
58166
+ for (let r = button.row; r < button.row + button.rowSpan; r += 1) for (let c = button.col; c < button.col + button.colSpan; c += 1) {
58167
+ const cell = `${r}:${c}`;
58168
+ const other = taken.get(cell);
58169
+ if (other !== void 0) {
58170
+ ctx.addIssue({
58171
+ code: "custom",
58172
+ message: `buttons "${other}" and "${button.id}" overlap`,
58173
+ path: ["buttons", index]
58174
+ });
58175
+ return;
58176
+ }
58177
+ taken.set(cell, button.id);
58178
+ }
58179
+ });
58180
+ });
58181
+ var RemoteBoundCommandSchema = object({
58182
+ role: RemoteRoleSchema,
58183
+ /** The operator's name for a custom button; absent for a known role. */
58184
+ label: string().optional(),
58185
+ custom: boolean()
58186
+ });
58187
+ var RemoteCommandListSchema = object({
58188
+ layoutTemplateId: string().nullable(),
58189
+ power: object({ mode: RemotePowerModeSchema }),
58190
+ /** Only the roles that are BOUND — the ones a press can reach. */
58191
+ commands: array(RemoteBoundCommandSchema)
58192
+ });
58193
+ var RemoteRefusalReasonSchema = _enum([
58194
+ "no-remote",
58195
+ "unbound-role",
58196
+ "action-failed"
58197
+ ]);
58198
+ var RemoteSendResultSchema = discriminatedUnion("status", [
58199
+ object({
58200
+ status: literal("sent"),
58201
+ /** How many times the action ran. */
58202
+ sends: number().int().min(1)
58203
+ }),
58204
+ object({
58205
+ status: literal("skipped"),
58206
+ reason: literal("already-in-state")
58207
+ }),
58208
+ object({
58209
+ status: literal("refused"),
58210
+ reason: RemoteRefusalReasonSchema,
58211
+ detail: string().optional()
58212
+ })
58213
+ ]);
58214
+ var RemoteMediaCommandSchema = _enum([
58215
+ "play",
58216
+ "pause",
58217
+ "stop",
58218
+ "next",
58219
+ "previous",
58220
+ "setMute",
58221
+ "selectSource"
58222
+ ]);
58223
+ /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
58224
+ var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
58225
+ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status: literal("saved") }), object({
58226
+ status: literal("refused"),
58227
+ reason: _enum(["unknown-template", "not-a-media-player"]),
58228
+ detail: string()
58229
+ })]);
58230
+ var deviceInput = object({ deviceId: number().int().nonnegative() });
58231
+ DeviceType.MediaPlayer;
58232
+ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
58233
+ kind: "mutation",
58234
+ auth: "admin"
58235
+ }), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
58236
+ role: RemoteRoleSchema,
58237
+ /** Sends in a row (volume steps). */
58238
+ repeat: number().int().min(1).max(50).default(1)
58239
+ }), RemoteSendResultSchema, {
58240
+ kind: "mutation",
58241
+ auth: "protected"
58242
+ }), method(deviceInput.extend({
58243
+ command: RemoteMediaCommandSchema,
58244
+ muted: boolean().optional(),
58245
+ source: string().optional(),
58246
+ repeat: number().int().min(1).max(50).default(1)
58247
+ }), RemoteMediaCommandResultSchema, {
58248
+ kind: "mutation",
58249
+ auth: "protected"
58250
+ });
58251
+ var TemplateKindSchema = _enum(["remote"]);
58252
+ /**
58253
+ * template — the generic store of reusable, named operator data (D963). A
58254
+ * record is `{ id, kind, name, payload }`; the kinds (today only `remote`, the
58255
+ * button grid of a remote) and the schema each payload must satisfy are
58256
+ * declared by the system in `template-kinds.ts`. Nothing here is specific to a
58257
+ * kind: the engine validates a payload against its kind's schema and, on a
58258
+ * delete, asks the kind's owner whether anything still points at the record.
58259
+ *
58260
+ * Every refusal is a typed result — a UI says "unknown kind" or names the
58261
+ * devices that still use a template, without parsing text.
58262
+ */
58263
+ var TemplateRecordSchema = object({
58264
+ id: string().min(1),
58265
+ kind: TemplateKindSchema,
58266
+ name: string().min(1).max(120),
58267
+ /** Shaped by the kind; `checkTemplatePayload(kind, payload)` reads it. */
58268
+ payload: unknown(),
58269
+ createdAt: number(),
58270
+ updatedAt: number()
58271
+ });
58272
+ var TemplateWriteResultSchema = discriminatedUnion("status", [object({
58273
+ status: literal("saved"),
58274
+ template: TemplateRecordSchema
58275
+ }), object({
58276
+ status: literal("refused"),
58277
+ reason: _enum(["invalid-payload", "not-found"]),
58278
+ detail: string()
58279
+ })]);
58280
+ /** A device still pointing at a template. */
58281
+ var TemplateUserSchema = object({
58282
+ deviceId: number().int().nonnegative(),
58283
+ name: string()
58284
+ });
58285
+ var TemplateDeleteResultSchema = discriminatedUnion("status", [
58286
+ object({ status: literal("deleted") }),
58287
+ object({ status: literal("not-found") }),
58288
+ object({
58289
+ status: literal("in-use"),
58290
+ devices: array(TemplateUserSchema).min(1)
58291
+ })
58292
+ ]);
58293
+ method(object({ kind: TemplateKindSchema.optional() }), array(TemplateRecordSchema), { auth: "protected" }), method(object({ id: string().min(1) }), TemplateRecordSchema.nullable(), { auth: "protected" }), method(object({
58294
+ kind: TemplateKindSchema,
58295
+ name: string().min(1).max(120),
58296
+ payload: unknown()
58297
+ }), TemplateWriteResultSchema, {
58298
+ kind: "mutation",
58299
+ auth: "admin"
58300
+ }), method(object({
58301
+ id: string().min(1),
58302
+ name: string().min(1).max(120).optional(),
58303
+ payload: unknown().optional()
58304
+ }), TemplateWriteResultSchema, {
58305
+ kind: "mutation",
58306
+ auth: "admin"
58307
+ }), method(object({ id: string().min(1) }), TemplateDeleteResultSchema, {
58308
+ kind: "mutation",
58309
+ auth: "admin"
58310
+ });
57645
58311
  DeviceType.Button, method(object({ deviceId: number().int().nonnegative() }), _void(), {
57646
58312
  kind: "mutation",
57647
58313
  auth: "protected"
57648
58314
  });
57649
58315
  /**
58316
+ * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
58317
+ * alternating, no zeros, 2..1024 entries.
58318
+ */
58319
+ var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
58320
+ timings.forEach((value, index) => {
58321
+ const expectMark = index % 2 === 0;
58322
+ if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
58323
+ code: "custom",
58324
+ message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
58325
+ path: [index]
58326
+ });
58327
+ });
58328
+ });
58329
+ /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
58330
+ var TransmitSettingsSchema = object({
58331
+ carrierHz: number().int().positive().optional(),
58332
+ dutyCyclePercent: number().int().min(1).max(100).optional(),
58333
+ repeat: number().int().min(0).max(20).optional(),
58334
+ repeatDelayMs: number().int().min(0).optional()
58335
+ });
58336
+ /** The setting keys a transmitter may declare as settable (`getInfo.settable`). */
58337
+ var TransmitSettingKeySchema = _enum([
58338
+ "carrierHz",
58339
+ "dutyCyclePercent",
58340
+ "repeat",
58341
+ "repeatDelayMs"
58342
+ ]);
58343
+ var IrMediumSchema = _enum(["ir", "rf"]);
58344
+ var IrSendResultSchema = object({
58345
+ ok: literal(true),
58346
+ /** Settings the transmitter could not apply; the train was still sent. */
58347
+ ignoredSettings: array(string())
58348
+ });
58349
+ var IrTransmitterInfoSchema = object({
58350
+ media: array(IrMediumSchema),
58351
+ settable: array(TransmitSettingKeySchema),
58352
+ maxTimings: number().int().positive()
58353
+ });
58354
+ DeviceType.Generic, method(object({
58355
+ deviceId: number().int().nonnegative(),
58356
+ timings: IrTimingsSchema,
58357
+ settings: TransmitSettingsSchema.optional()
58358
+ }), IrSendResultSchema, {
58359
+ kind: "mutation",
58360
+ auth: "protected"
58361
+ }), method(object({ deviceId: number().int().nonnegative() }), IrTransmitterInfoSchema, {
58362
+ kind: "query",
58363
+ auth: "protected"
58364
+ });
58365
+ /**
57650
58366
  * `calendar-source` — collection cap exposing per-provider calendars and
57651
58367
  * their events. Every addon that contributes calendars (Home Assistant,
57652
58368
  * a future Google Calendar addon, …) registers a provider here. The hub
@@ -58662,7 +59378,7 @@ object({
58662
59378
  /** Ms epoch of the last value received from the appliance; 0 = never. */
58663
59379
  lastFetchedAt: number()
58664
59380
  });
58665
- var DeviceIdSchema = number().int().nonnegative();
59381
+ var DeviceIdSchema$1 = number().int().nonnegative();
58666
59382
  /** A value a program option or setting can take. */
58667
59383
  var DishwasherValueSchema = union([
58668
59384
  boolean(),
@@ -58726,77 +59442,77 @@ var DishwasherOptionsSchema = object({
58726
59442
  options: array(DishwasherOptionDescriptorSchema)
58727
59443
  });
58728
59444
  DeviceType.Dishwasher, method(object({
58729
- deviceId: DeviceIdSchema,
59445
+ deviceId: DeviceIdSchema$1,
58730
59446
  program: string().min(1).optional(),
58731
59447
  options: record(string(), DishwasherValueSchema).optional()
58732
59448
  }), _void(), {
58733
59449
  kind: "mutation",
58734
59450
  auth: "protected"
58735
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59451
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
58736
59452
  kind: "mutation",
58737
59453
  auth: "protected"
58738
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59454
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
58739
59455
  kind: "mutation",
58740
59456
  auth: "protected"
58741
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59457
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
58742
59458
  kind: "mutation",
58743
59459
  auth: "protected"
58744
59460
  }), method(object({
58745
- deviceId: DeviceIdSchema,
59461
+ deviceId: DeviceIdSchema$1,
58746
59462
  program: string().min(1)
58747
59463
  }), _void(), {
58748
59464
  kind: "mutation",
58749
59465
  auth: "protected"
58750
59466
  }), method(object({
58751
- deviceId: DeviceIdSchema,
59467
+ deviceId: DeviceIdSchema$1,
58752
59468
  on: boolean()
58753
59469
  }), _void(), {
58754
59470
  kind: "mutation",
58755
59471
  auth: "protected"
58756
59472
  }), method(object({
58757
- deviceId: DeviceIdSchema,
59473
+ deviceId: DeviceIdSchema$1,
58758
59474
  on: boolean()
58759
59475
  }), _void(), {
58760
59476
  kind: "mutation",
58761
59477
  auth: "protected"
58762
59478
  }), method(object({
58763
- deviceId: DeviceIdSchema,
59479
+ deviceId: DeviceIdSchema$1,
58764
59480
  on: boolean()
58765
59481
  }), _void(), {
58766
59482
  kind: "mutation",
58767
59483
  auth: "protected"
58768
59484
  }), method(object({
58769
- deviceId: DeviceIdSchema,
59485
+ deviceId: DeviceIdSchema$1,
58770
59486
  on: boolean()
58771
59487
  }), _void(), {
58772
59488
  kind: "mutation",
58773
59489
  auth: "protected"
58774
59490
  }), method(object({
58775
- deviceId: DeviceIdSchema,
59491
+ deviceId: DeviceIdSchema$1,
58776
59492
  on: boolean()
58777
59493
  }), _void(), {
58778
59494
  kind: "mutation",
58779
59495
  auth: "protected"
58780
59496
  }), method(object({
58781
- deviceId: DeviceIdSchema,
59497
+ deviceId: DeviceIdSchema$1,
58782
59498
  on: boolean()
58783
59499
  }), _void(), {
58784
59500
  kind: "mutation",
58785
59501
  auth: "protected"
58786
59502
  }), method(object({
58787
- deviceId: DeviceIdSchema,
59503
+ deviceId: DeviceIdSchema$1,
58788
59504
  on: boolean()
58789
59505
  }), _void(), {
58790
59506
  kind: "mutation",
58791
59507
  auth: "protected"
58792
59508
  }), method(object({
58793
- deviceId: DeviceIdSchema,
59509
+ deviceId: DeviceIdSchema$1,
58794
59510
  key: string().min(1),
58795
59511
  value: DishwasherValueSchema
58796
59512
  }), _void(), {
58797
59513
  kind: "mutation",
58798
59514
  auth: "protected"
58799
- }), method(object({ deviceId: DeviceIdSchema }), DishwasherOptionsSchema, { auth: "protected" });
59515
+ }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
58800
59516
  DeviceType.Camera;
58801
59517
  object({
58802
59518
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -60361,9 +61077,35 @@ var MediaInfoSchema = object({
60361
61077
  /** Optional cover-art / thumbnail URL. */
60362
61078
  imageUrl: string().optional()
60363
61079
  });
61080
+ /**
61081
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
61082
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
61083
+ * tracks what it last SENT; it moves only after a send was accepted, and a
61084
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
61085
+ * guess, never as a reading.
61086
+ */
61087
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
61088
+ /** The fields of a media-player status a driver can only guess. */
61089
+ var MediaPlayerAssumedFieldSchema = _enum([
61090
+ "state",
61091
+ "volumeLevel",
61092
+ "isMuted",
61093
+ "source"
61094
+ ]);
60364
61095
  object({
60365
61096
  /** Playback lifecycle state. */
60366
61097
  state: MediaPlayerStateSchema,
61098
+ /**
61099
+ * Whether the state fields are readings or the driver's own bookkeeping.
61100
+ * A slice written before this field existed parses as `reported`.
61101
+ */
61102
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
61103
+ /**
61104
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
61105
+ * this is not empty; a field not listed here is a reading even then (power
61106
+ * from a running-state source, mute guessed from the last send).
61107
+ */
61108
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
60367
61109
  /** Volume as 0..100 inclusive. Null when the device has no volume
60368
61110
  * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
60369
61111
  volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
@@ -61216,7 +61958,8 @@ var TopologyNodeSchema = object({
61216
61958
  isHub: boolean(),
61217
61959
  isOnline: boolean(),
61218
61960
  cpuPercent: number(),
61219
- memoryPercent: number(),
61961
+ /** `null` when the node's memory read failed or it has not reported one (D393). */
61962
+ memoryPercent: number().nullable(),
61220
61963
  uptime: number(),
61221
61964
  lastSeen: string(),
61222
61965
  localIps: array(string()).readonly(),
@@ -61751,9 +62494,10 @@ object({
61751
62494
  * combined reading; per-hopper levels live in `food1`/`food2`. Null when
61752
62495
  * the device has not reported yet. */
61753
62496
  foodLevel: number().nullable().meta(readingMeta("none")),
61754
- /** Food in the BOWL as the feeder reports it (`state.bowl`), in the
61755
- * feeder's own units. Null when the model reports none. */
61756
- bowlFood: number().nullable().meta(readingMeta("none")),
62497
+ /** Food in the BOWL, a mass (stored in kilograms, D944). Reported only by a
62498
+ * feeder with a bowl scale; null when the model has none or its reading is
62499
+ * of an unproven unit. */
62500
+ bowlFood: number().nullable().meta(readingMeta("mass")),
61757
62501
  /** True while the pet is eating (`state.eating`). */
61758
62502
  eating: boolean(),
61759
62503
  /** Whether `markFoodReplenished` does anything on this model. When false
@@ -61769,9 +62513,14 @@ object({
61769
62513
  * (`device_class: problem`, on = low). True when the tank reports empty,
61770
62514
  * or, on a dual-hopper model, when EITHER hopper is empty. */
61771
62515
  lowFood: boolean(),
61772
- /** Battery charge 0..100 (%). Null on mains-powered models or when the
61773
- * device has no battery reading. */
62516
+ /** Battery charge 0..100 (%). On a feeder running on `mains` this is the
62517
+ * BACKUP battery's charge, not the power source. Null when the device has
62518
+ * no battery reading. */
61774
62519
  batteryPower: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62520
+ /** What the feeder is powered from right now: `mains` (plugged in, the
62521
+ * battery is only a backup) or `battery`. Null when the device does not
62522
+ * report it. */
62523
+ powerSource: _enum(["mains", "battery"]).nullable(),
61775
62524
  /**
61776
62525
  * Desiccant life remaining, stored in seconds (duration base, D944).
61777
62526
  * Providers convert from the days the feeder reports. Null when the
@@ -61799,6 +62548,14 @@ object({
61799
62548
  feedSound: boolean(),
61800
62549
  /** Speaker / prompt volume level (device-scaled integer). */
61801
62550
  volume: number().meta(readingMeta("none")),
62551
+ /** Portion (grams) of the last manual feed sent from a single-hopper
62552
+ * stepper — the default the next manual feed starts from. Persisted per
62553
+ * device by the provider; null until a manual feed has been sent. */
62554
+ lastFeedGrams: gramsPortion.nullable(),
62555
+ /** Hopper-1 portion of the last manual feed (dual-hopper); null until sent. */
62556
+ lastFeedHopper1: gramsPortion.nullable(),
62557
+ /** Hopper-2 portion of the last manual feed (dual-hopper); null until sent. */
62558
+ lastFeedHopper2: gramsPortion.nullable(),
61802
62559
  /** Ms epoch when the slice was last refreshed from the cloud. */
61803
62560
  lastFetchedAt: number()
61804
62561
  });
@@ -61853,6 +62610,64 @@ DeviceType.PetFeeder, method(object({
61853
62610
  kind: "mutation",
61854
62611
  auth: "protected"
61855
62612
  });
62613
+ object({
62614
+ /** Water in the tank, 0..100 (%). Null while the source has not reported. */
62615
+ waterLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62616
+ /** Water in the tank, in litres. Null while the source has not reported. */
62617
+ waterVolume: number().min(0).nullable().meta(readingMeta("volume")),
62618
+ /** True when the tank is empty. Null while unknown. */
62619
+ empty: boolean().nullable(),
62620
+ /** True while the pump is running. Null while unknown. */
62621
+ pumpRunning: boolean().nullable(),
62622
+ /** True when the pump works on an on/off duty cycle rather than continuously. */
62623
+ pumpIntervalEnabled: boolean().nullable(),
62624
+ /** How long the pump runs per cycle, in seconds. */
62625
+ pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
62626
+ /** How long the pump rests per cycle, in seconds. */
62627
+ pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
62628
+ /** Water drunk in the last drink, in litres. */
62629
+ lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
62630
+ /** Water drunk in the current hour, in litres. */
62631
+ currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
62632
+ /** Water drunk over the last 24 hours (rolling), in litres. */
62633
+ last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
62634
+ /** Water drunk since local midnight, in litres. */
62635
+ todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
62636
+ /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
62637
+ error: string().nullable(),
62638
+ /** Ms epoch when the slice was last refreshed. */
62639
+ lastFetchedAt: number()
62640
+ });
62641
+ var DeviceIdSchema = number().int().nonnegative();
62642
+ var MinutesSchema = number().int().min(0);
62643
+ DeviceType.PetFountain, method(object({
62644
+ deviceId: DeviceIdSchema,
62645
+ on: boolean()
62646
+ }), _void(), {
62647
+ kind: "mutation",
62648
+ auth: "protected"
62649
+ }), method(object({
62650
+ deviceId: DeviceIdSchema,
62651
+ on: boolean()
62652
+ }), _void(), {
62653
+ kind: "mutation",
62654
+ auth: "protected"
62655
+ }), method(object({
62656
+ deviceId: DeviceIdSchema,
62657
+ minutes: MinutesSchema
62658
+ }), _void(), {
62659
+ kind: "mutation",
62660
+ auth: "protected"
62661
+ }), method(object({
62662
+ deviceId: DeviceIdSchema,
62663
+ minutes: MinutesSchema
62664
+ }), _void(), {
62665
+ kind: "mutation",
62666
+ auth: "protected"
62667
+ }), method(object({ deviceId: DeviceIdSchema }), _void(), {
62668
+ kind: "mutation",
62669
+ auth: "protected"
62670
+ });
61856
62671
  var VehicleSchema = object({
61857
62672
  id: string(),
61858
62673
  name: string(),
@@ -66459,9 +67274,17 @@ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" })
66459
67274
  kind: "mutation",
66460
67275
  auth: "admin"
66461
67276
  });
67277
+ discriminatedUnion("kind", [object({
67278
+ kind: literal("raw"),
67279
+ timings: array(number().int()),
67280
+ settings: TransmitSettingsSchema.optional()
67281
+ }), object({
67282
+ kind: literal("pronto"),
67283
+ code: string()
67284
+ })]);
66462
67285
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
66463
67286
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
66464
- 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;
67287
+ 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;
66465
67288
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
66466
67289
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
66467
67290
  new Set(CAP_NAMES);
@@ -66514,7 +67337,7 @@ var AccessoryKind = {
66514
67337
  PrivacyMask: DeviceRole.PrivacyMask
66515
67338
  };
66516
67339
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
66517
- 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;
67340
+ 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;
66518
67341
  new Set(Object.values(DeviceType));
66519
67342
  Object.freeze({
66520
67343
  "accessories.getStatus": {
@@ -68449,6 +69272,13 @@ Object.freeze({
68449
69272
  access: "create",
68450
69273
  role: "admin"
68451
69274
  },
69275
+ "deviceExport.exposeEntity": {
69276
+ capName: "device-export",
69277
+ capScope: "system",
69278
+ addonId: null,
69279
+ access: "create",
69280
+ role: "admin"
69281
+ },
68452
69282
  "deviceExport.getDeviceLiveContribution": {
68453
69283
  capName: "device-export",
68454
69284
  capScope: "system",
@@ -68477,6 +69307,13 @@ Object.freeze({
68477
69307
  access: "view",
68478
69308
  role: "admin"
68479
69309
  },
69310
+ "deviceExport.listExposedEntities": {
69311
+ capName: "device-export",
69312
+ capScope: "system",
69313
+ addonId: null,
69314
+ access: "view",
69315
+ role: "admin"
69316
+ },
68480
69317
  "deviceExport.listSupportedDeviceKinds": {
68481
69318
  capName: "device-export",
68482
69319
  capScope: "system",
@@ -68484,6 +69321,13 @@ Object.freeze({
68484
69321
  access: "view",
68485
69322
  role: "admin"
68486
69323
  },
69324
+ "deviceExport.listSupportedEntityKinds": {
69325
+ capName: "device-export",
69326
+ capScope: "system",
69327
+ addonId: null,
69328
+ access: "view",
69329
+ role: "admin"
69330
+ },
68487
69331
  "deviceExport.unexposeDevice": {
68488
69332
  capName: "device-export",
68489
69333
  capScope: "system",
@@ -68491,6 +69335,13 @@ Object.freeze({
68491
69335
  access: "create",
68492
69336
  role: "admin"
68493
69337
  },
69338
+ "deviceExport.unexposeEntity": {
69339
+ capName: "device-export",
69340
+ capScope: "system",
69341
+ addonId: null,
69342
+ access: "create",
69343
+ role: "admin"
69344
+ },
68494
69345
  "deviceExtension.listCandidates": {
68495
69346
  capName: "device-extension",
68496
69347
  capScope: "device",
@@ -70066,6 +70917,20 @@ Object.freeze({
70066
70917
  access: "create",
70067
70918
  role: "viewer"
70068
70919
  },
70920
+ "irTransmitter.getInfo": {
70921
+ capName: "ir-transmitter",
70922
+ capScope: "device",
70923
+ addonId: null,
70924
+ access: "view",
70925
+ role: "viewer"
70926
+ },
70927
+ "irTransmitter.send": {
70928
+ capName: "ir-transmitter",
70929
+ capScope: "device",
70930
+ addonId: null,
70931
+ access: "create",
70932
+ role: "viewer"
70933
+ },
70069
70934
  "keychain.delete": {
70070
70935
  capName: "keychain",
70071
70936
  capScope: "system",
@@ -71298,6 +72163,13 @@ Object.freeze({
71298
72163
  access: "create",
71299
72164
  role: "admin"
71300
72165
  },
72166
+ "nodeRemovalHook.onNodeRemoved": {
72167
+ capName: "node-removal-hook",
72168
+ capScope: "system",
72169
+ addonId: null,
72170
+ access: "create",
72171
+ role: "admin"
72172
+ },
71301
72173
  "nodes.clusterAddonStatus": {
71302
72174
  capName: "nodes",
71303
72175
  capScope: "system",
@@ -71935,6 +72807,48 @@ Object.freeze({
71935
72807
  access: "create",
71936
72808
  role: "viewer"
71937
72809
  },
72810
+ "petFountain.getStatus": {
72811
+ capName: "pet-fountain",
72812
+ capScope: "device",
72813
+ addonId: null,
72814
+ access: "view",
72815
+ role: "viewer"
72816
+ },
72817
+ "petFountain.resetDailyConsumption": {
72818
+ capName: "pet-fountain",
72819
+ capScope: "device",
72820
+ addonId: null,
72821
+ access: "delete",
72822
+ role: "viewer"
72823
+ },
72824
+ "petFountain.setPump": {
72825
+ capName: "pet-fountain",
72826
+ capScope: "device",
72827
+ addonId: null,
72828
+ access: "create",
72829
+ role: "viewer"
72830
+ },
72831
+ "petFountain.setPumpInterval": {
72832
+ capName: "pet-fountain",
72833
+ capScope: "device",
72834
+ addonId: null,
72835
+ access: "create",
72836
+ role: "viewer"
72837
+ },
72838
+ "petFountain.setPumpOffMinutes": {
72839
+ capName: "pet-fountain",
72840
+ capScope: "device",
72841
+ addonId: null,
72842
+ access: "create",
72843
+ role: "viewer"
72844
+ },
72845
+ "petFountain.setPumpOnMinutes": {
72846
+ capName: "pet-fountain",
72847
+ capScope: "device",
72848
+ addonId: null,
72849
+ access: "create",
72850
+ role: "viewer"
72851
+ },
71938
72852
  "pipelineAnalytics.addRetrainFrameFromRecording": {
71939
72853
  capName: "pipeline-analytics",
71940
72854
  capScope: "device",
@@ -74189,6 +75103,41 @@ Object.freeze({
74189
75103
  access: "create",
74190
75104
  role: "admin"
74191
75105
  },
75106
+ "remote.getConfig": {
75107
+ capName: "remote",
75108
+ capScope: "system",
75109
+ addonId: null,
75110
+ access: "view",
75111
+ role: "admin"
75112
+ },
75113
+ "remote.listCommands": {
75114
+ capName: "remote",
75115
+ capScope: "system",
75116
+ addonId: null,
75117
+ access: "view",
75118
+ role: "admin"
75119
+ },
75120
+ "remote.sendCommand": {
75121
+ capName: "remote",
75122
+ capScope: "system",
75123
+ addonId: null,
75124
+ access: "create",
75125
+ role: "admin"
75126
+ },
75127
+ "remote.sendMediaCommand": {
75128
+ capName: "remote",
75129
+ capScope: "system",
75130
+ addonId: null,
75131
+ access: "create",
75132
+ role: "admin"
75133
+ },
75134
+ "remote.setConfig": {
75135
+ capName: "remote",
75136
+ capScope: "system",
75137
+ addonId: null,
75138
+ access: "create",
75139
+ role: "admin"
75140
+ },
74192
75141
  "runningState.getStatus": {
74193
75142
  capName: "running-state",
74194
75143
  capScope: "device",
@@ -75379,6 +76328,41 @@ Object.freeze({
75379
76328
  access: "view",
75380
76329
  role: "viewer"
75381
76330
  },
76331
+ "template.create": {
76332
+ capName: "template",
76333
+ capScope: "system",
76334
+ addonId: null,
76335
+ access: "create",
76336
+ role: "admin"
76337
+ },
76338
+ "template.delete": {
76339
+ capName: "template",
76340
+ capScope: "system",
76341
+ addonId: null,
76342
+ access: "delete",
76343
+ role: "admin"
76344
+ },
76345
+ "template.get": {
76346
+ capName: "template",
76347
+ capScope: "system",
76348
+ addonId: null,
76349
+ access: "view",
76350
+ role: "admin"
76351
+ },
76352
+ "template.list": {
76353
+ capName: "template",
76354
+ capScope: "system",
76355
+ addonId: null,
76356
+ access: "view",
76357
+ role: "admin"
76358
+ },
76359
+ "template.update": {
76360
+ capName: "template",
76361
+ capScope: "system",
76362
+ addonId: null,
76363
+ access: "create",
76364
+ role: "admin"
76365
+ },
75382
76366
  "terminalSession.adoptLegacyMonitor": {
75383
76367
  capName: "terminal-session",
75384
76368
  capScope: "system",
@@ -77689,6 +78673,11 @@ var ACTUATOR_CAP_VOCABULARY = {
77689
78673
  icon: "circle-dot"
77690
78674
  }]
77691
78675
  },
78676
+ "ir-transmitter": {
78677
+ scope: "device",
78678
+ noun: t("IR / RF transmitter", "Trasmettitore IR / RF"),
78679
+ notOperatorFacing: { send: "a raw pulse train is not something an operator composes in an automation; the remote that owns the command table sends it" }
78680
+ },
77692
78681
  control: {
77693
78682
  scope: "device",
77694
78683
  noun: t("Control", "Controllo"),
@@ -78342,6 +79331,100 @@ var APPLIANCE_CAP_VOCABULARY = {
78342
79331
  }
78343
79332
  ]
78344
79333
  },
79334
+ "pet-fountain": {
79335
+ scope: "device",
79336
+ noun: t("Pet fountain", "Fontana per animali"),
79337
+ actions: [
79338
+ {
79339
+ id: "petFountain.pumpOn",
79340
+ method: "setPump",
79341
+ label: t("Pump on", "Pompa accesa"),
79342
+ phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
79343
+ icon: "play",
79344
+ args: { on: true }
79345
+ },
79346
+ {
79347
+ id: "petFountain.pumpOff",
79348
+ method: "setPump",
79349
+ label: t("Pump off", "Pompa spenta"),
79350
+ phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
79351
+ icon: "square",
79352
+ args: { on: false }
79353
+ },
79354
+ {
79355
+ id: "petFountain.intervalOn",
79356
+ method: "setPumpInterval",
79357
+ label: t("Pump cycle on", "Ciclo pompa attivo"),
79358
+ phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
79359
+ icon: "timer",
79360
+ args: { on: true }
79361
+ },
79362
+ {
79363
+ id: "petFountain.intervalOff",
79364
+ method: "setPumpInterval",
79365
+ label: t("Pump cycle off", "Ciclo pompa spento"),
79366
+ phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
79367
+ icon: "timer-off",
79368
+ args: { on: false }
79369
+ },
79370
+ {
79371
+ id: "petFountain.pumpOnMinutes",
79372
+ method: "setPumpOnMinutes",
79373
+ label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
79374
+ phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
79375
+ icon: "timer",
79376
+ openArgs: [{
79377
+ key: "minutes",
79378
+ label: t("Minutes", "Minuti"),
79379
+ offer: {
79380
+ kind: "number",
79381
+ min: 0,
79382
+ step: 1,
79383
+ unit: "min"
79384
+ }
79385
+ }]
79386
+ },
79387
+ {
79388
+ id: "petFountain.pumpOffMinutes",
79389
+ method: "setPumpOffMinutes",
79390
+ label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
79391
+ phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
79392
+ icon: "timer-off",
79393
+ openArgs: [{
79394
+ key: "minutes",
79395
+ label: t("Minutes", "Minuti"),
79396
+ offer: {
79397
+ kind: "number",
79398
+ min: 0,
79399
+ step: 1,
79400
+ unit: "min"
79401
+ }
79402
+ }]
79403
+ },
79404
+ {
79405
+ id: "petFountain.resetDailyConsumption",
79406
+ method: "resetDailyConsumption",
79407
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
79408
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
79409
+ icon: "rotate-ccw"
79410
+ }
79411
+ ],
79412
+ state: [{
79413
+ kind: "boolean",
79414
+ field: "empty",
79415
+ label: t("Tank empty", "Serbatoio vuoto"),
79416
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
79417
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
79418
+ icon: "droplet"
79419
+ }, {
79420
+ kind: "numeric",
79421
+ field: "waterLevel",
79422
+ quantity: t("the water level", "il livello dell’acqua"),
79423
+ label: t("Water level", "Livello dell’acqua"),
79424
+ unit: "%",
79425
+ icon: "droplets"
79426
+ }]
79427
+ },
78345
79428
  "media-player": {
78346
79429
  scope: "device",
78347
79430
  noun: t("Media player", "Lettore multimediale"),
@@ -80166,6 +81249,7 @@ var SYSTEM_CAP_VOCABULARY = {
80166
81249
  "device-manager": system("the device registry itself — rename, move and remove are administration"),
80167
81250
  "device-provider": system(INTERNAL),
80168
81251
  "device-removal-hook": system(INTERNAL),
81252
+ "node-removal-hook": system(INTERNAL),
80169
81253
  "device-state": system("the runtime-state mirror every trigger already reads through"),
80170
81254
  "display-palette": system("the cluster display palette — one colour table for every client, not a device action"),
80171
81255
  "embedding-encoder": system(ML),
@@ -80205,6 +81289,7 @@ var SYSTEM_CAP_VOCABULARY = {
80205
81289
  "recording-archive": system(STORAGE),
80206
81290
  "recording-export": system("recording exports — requested from the timeline, not an automation step"),
80207
81291
  records: system(INTERNAL),
81292
+ remote: system("the per-device remote setup — authored in the Customize remote editor, sent through the remote UI"),
80208
81293
  "server-management": system(CLUSTER),
80209
81294
  "settings-store": system(INTERNAL),
80210
81295
  "smtp-provider": system(INTERNAL),
@@ -80217,6 +81302,7 @@ var SYSTEM_CAP_VOCABULARY = {
80217
81302
  "storage-provider": system(STORAGE),
80218
81303
  "stream-broker": system(PIPELINE),
80219
81304
  system: system(CLUSTER),
81305
+ template: system("operator-authored templates — edited in their own editor, never actuated"),
80220
81306
  "terminal-session": system(CLUSTER),
80221
81307
  toast: system(UI_PLUMBING),
80222
81308
  training: system(ML),
@@ -80276,7 +81362,7 @@ function projectAction(cap, action) {
80276
81362
  };
80277
81363
  }
80278
81364
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
80279
- 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;
81365
+ 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;
80280
81366
  DeviceFeature.BatteryOperated;
80281
81367
  /**
80282
81368
  * How a washer, dryer or dishwasher leaves CamStack.
@@ -81433,6 +82519,16 @@ Object.freeze({
81433
82519
  form: "single",
81434
82520
  optional: false
81435
82521
  }],
82522
+ "irTransmitter.getInfo": [{
82523
+ name: "deviceId",
82524
+ form: "single",
82525
+ optional: false
82526
+ }],
82527
+ "irTransmitter.send": [{
82528
+ name: "deviceId",
82529
+ form: "single",
82530
+ optional: false
82531
+ }],
81436
82532
  "keychain.deleteDeviceScope": [{
81437
82533
  name: "deviceId",
81438
82534
  form: "single",
@@ -81842,6 +82938,36 @@ Object.freeze({
81842
82938
  form: "single",
81843
82939
  optional: false
81844
82940
  }],
82941
+ "petFountain.getStatus": [{
82942
+ name: "deviceId",
82943
+ form: "single",
82944
+ optional: false
82945
+ }],
82946
+ "petFountain.resetDailyConsumption": [{
82947
+ name: "deviceId",
82948
+ form: "single",
82949
+ optional: false
82950
+ }],
82951
+ "petFountain.setPump": [{
82952
+ name: "deviceId",
82953
+ form: "single",
82954
+ optional: false
82955
+ }],
82956
+ "petFountain.setPumpInterval": [{
82957
+ name: "deviceId",
82958
+ form: "single",
82959
+ optional: false
82960
+ }],
82961
+ "petFountain.setPumpOffMinutes": [{
82962
+ name: "deviceId",
82963
+ form: "single",
82964
+ optional: false
82965
+ }],
82966
+ "petFountain.setPumpOnMinutes": [{
82967
+ name: "deviceId",
82968
+ form: "single",
82969
+ optional: false
82970
+ }],
81845
82971
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
81846
82972
  name: "deviceId",
81847
82973
  form: "single",
@@ -82658,6 +83784,31 @@ Object.freeze({
82658
83784
  form: "single",
82659
83785
  optional: true
82660
83786
  }],
83787
+ "remote.getConfig": [{
83788
+ name: "deviceId",
83789
+ form: "single",
83790
+ optional: false
83791
+ }],
83792
+ "remote.listCommands": [{
83793
+ name: "deviceId",
83794
+ form: "single",
83795
+ optional: false
83796
+ }],
83797
+ "remote.sendCommand": [{
83798
+ name: "deviceId",
83799
+ form: "single",
83800
+ optional: false
83801
+ }],
83802
+ "remote.sendMediaCommand": [{
83803
+ name: "deviceId",
83804
+ form: "single",
83805
+ optional: false
83806
+ }],
83807
+ "remote.setConfig": [{
83808
+ name: "deviceId",
83809
+ form: "single",
83810
+ optional: false
83811
+ }],
82661
83812
  "runningState.getStatus": [{
82662
83813
  name: "deviceId",
82663
83814
  form: "single",
@@ -84567,6 +85718,14 @@ function resolveGrantDeviceIds(scopes, fleet, access) {
84567
85718
  String.raw`(?<=^|["'(\s>,\[{])`;
84568
85719
  var MB = 1024 * 1024;
84569
85720
  1024 * MB, 3072 * MB;
85721
+ object({
85722
+ manufacturer: string().optional(),
85723
+ supportedModels: array(string()).optional(),
85724
+ supportedController: string().optional(),
85725
+ commandsEncoding: string(),
85726
+ delay: number().nonnegative().optional(),
85727
+ commands: record(string(), unknown())
85728
+ });
84570
85729
  //#endregion
84571
85730
  //#region src/custom-actions.ts
84572
85731
  /**
@@ -84753,7 +85912,7 @@ async function releaseAlexaEgress(input) {
84753
85912
  tags: { deviceId },
84754
85913
  meta: {
84755
85914
  pipelineKey,
84756
- error: errMsg(err)
85915
+ error: errMsg$1(err)
84757
85916
  }
84758
85917
  });
84759
85918
  }
@@ -84807,12 +85966,154 @@ async function profileForCamStream(input) {
84807
85966
  } catch (err) {
84808
85967
  input.logger?.warn("alexa rtc-session: could not read the profile slots", {
84809
85968
  tags: { deviceId: input.deviceId },
84810
- meta: { error: errMsg(err) }
85969
+ meta: { error: errMsg$1(err) }
84811
85970
  });
84812
85971
  return null;
84813
85972
  }
84814
85973
  }
84815
85974
  //#endregion
85975
+ //#region src/egress/alexa-source-profile.ts
85976
+ async function resolveAlexaSourceProfile(input) {
85977
+ const { api, deviceId, exposedEntry } = input;
85978
+ const log = input.logger;
85979
+ const pinnedProfile = (() => {
85980
+ const pref = exposedEntry?.settings?.streamPreference;
85981
+ if (pref === "low" || pref === "mid" || pref === "high") return pref;
85982
+ })();
85983
+ const allowTranscode = exposedEntry?.settings?.allowTranscode !== false;
85984
+ const scored = pinnedProfile === void 0 ? await api.cameraStreams.pickStream.query({
85985
+ deviceId,
85986
+ requirements: {
85987
+ acceptCodecs: ["h264"],
85988
+ minHeight: 480,
85989
+ maxHeight: ALEXA_MAX_LINES,
85990
+ excludeDerived: true,
85991
+ allowTranscode
85992
+ },
85993
+ preferences: { targetHeight: 720 }
85994
+ }).catch((err) => {
85995
+ log.warn("alexa rtc-session: pickStream threw — falling back to the high slot", {
85996
+ tags: { deviceId },
85997
+ meta: { error: err instanceof Error ? err.message : String(err) }
85998
+ });
85999
+ return null;
86000
+ }) : null;
86001
+ const scoredProfile = scored === null ? null : await profileForCamStream({
86002
+ api,
86003
+ deviceId,
86004
+ camStreamId: scored.camStreamId,
86005
+ logger: log
86006
+ });
86007
+ const sourceProfile = pinnedProfile ?? scoredProfile ?? "high";
86008
+ if (pinnedProfile === void 0) log.info("alexa rtc-session: source scored against the Echo requirements", {
86009
+ tags: { deviceId },
86010
+ meta: {
86011
+ chosen: sourceProfile,
86012
+ scored: scored === null ? "none-eligible" : scored.reason,
86013
+ camStreamId: scored?.camStreamId ?? null,
86014
+ slot: scoredProfile ?? (scored === null ? null : "no-slot"),
86015
+ height: scored?.resolution?.height ?? null,
86016
+ transcodes: scored?.transcodes ?? null,
86017
+ allowTranscode
86018
+ }
86019
+ });
86020
+ return sourceProfile;
86021
+ }
86022
+ var AlexaEgressPrewarm = class {
86023
+ deps;
86024
+ holds = /* @__PURE__ */ new Map();
86025
+ holdMs;
86026
+ disposed = false;
86027
+ constructor(deps) {
86028
+ this.deps = deps;
86029
+ this.holdMs = deps.holdMs ?? 3e4;
86030
+ }
86031
+ /** A doorbell press for `deviceId`. Never throws. */
86032
+ async onPress(deviceId) {
86033
+ const { api, logger } = this.deps;
86034
+ if (this.disposed) return;
86035
+ if (this.holds.has(deviceId)) {
86036
+ logger.debug("alexa egress prewarm: a hold is already pending, press ignored", { tags: { deviceId } });
86037
+ return;
86038
+ }
86039
+ if (this.deps.hasLiveSession(deviceId)) {
86040
+ logger.info("alexa egress prewarm: an Alexa session is already live, nothing to warm", { tags: { deviceId } });
86041
+ return;
86042
+ }
86043
+ const hold = {
86044
+ pipelineKey: null,
86045
+ timer: null
86046
+ };
86047
+ this.holds.set(deviceId, hold);
86048
+ const sessionId = `prewarm-${deviceId}-${Date.now()}`;
86049
+ try {
86050
+ const sourceProfile = await resolveAlexaSourceProfile({
86051
+ api,
86052
+ deviceId,
86053
+ exposedEntry: this.deps.listExposed().find((e) => e.deviceId === deviceId),
86054
+ logger
86055
+ });
86056
+ const acquired = await acquireAlexaEgress({
86057
+ api,
86058
+ deviceId,
86059
+ sourceProfile,
86060
+ sessionId,
86061
+ logger
86062
+ });
86063
+ hold.pipelineKey = acquired.pipelineKey;
86064
+ if (this.disposed || this.holds.get(deviceId) !== hold) {
86065
+ await this.release(deviceId, hold, "disposed before the hold was armed");
86066
+ return;
86067
+ }
86068
+ hold.timer = setTimeout(() => {
86069
+ this.release(deviceId, hold, "no session arrived");
86070
+ }, this.holdMs);
86071
+ hold.timer.unref?.();
86072
+ logger.info("alexa egress prewarm: transcode held for the coming session", {
86073
+ tags: { deviceId },
86074
+ meta: {
86075
+ pipelineKey: acquired.pipelineKey,
86076
+ sourceProfile,
86077
+ holdMs: this.holdMs
86078
+ }
86079
+ });
86080
+ } catch (err) {
86081
+ this.holds.delete(deviceId);
86082
+ logger.warn("alexa egress prewarm: acquire failed, the session will start the transcode", {
86083
+ tags: { deviceId },
86084
+ meta: { error: err instanceof Error ? err.message : String(err) }
86085
+ });
86086
+ }
86087
+ }
86088
+ /** Release every pending hold (addon shutdown). */
86089
+ async dispose() {
86090
+ this.disposed = true;
86091
+ const pending = [...this.holds.entries()];
86092
+ await Promise.all(pending.map(([deviceId, hold]) => this.release(deviceId, hold, "shutdown")));
86093
+ }
86094
+ async release(deviceId, hold, reason) {
86095
+ if (hold.timer) clearTimeout(hold.timer);
86096
+ hold.timer = null;
86097
+ if (this.holds.get(deviceId) === hold) this.holds.delete(deviceId);
86098
+ const pipelineKey = hold.pipelineKey;
86099
+ hold.pipelineKey = null;
86100
+ if (pipelineKey === null) return;
86101
+ await releaseAlexaEgress({
86102
+ api: this.deps.api,
86103
+ deviceId,
86104
+ pipelineKey,
86105
+ logger: this.deps.logger
86106
+ });
86107
+ this.deps.logger.info("alexa egress prewarm: hold released", {
86108
+ tags: { deviceId },
86109
+ meta: {
86110
+ pipelineKey,
86111
+ reason
86112
+ }
86113
+ });
86114
+ }
86115
+ };
86116
+ //#endregion
84816
86117
  //#region src/handlers/endpoint-id.ts
84817
86118
  /** The classes a camera publishes a detection sensor for (R1). */
84818
86119
  var DETECTION_SENSOR_CLASSES = [
@@ -85089,47 +86390,12 @@ async function handleInitiateSessionWithOffer(header, endpointRaw, payloadRaw, d
85089
86390
  if (sdpOffer.length === 0) return errorEnvelope(header, "INVALID_DIRECTIVE", "offer.value is empty");
85090
86391
  const api = deps.ctx.api;
85091
86392
  const exposedEntry = deps.listExposed().find((e) => e.deviceId === deviceId);
85092
- const pinnedProfile = (() => {
85093
- const pref = exposedEntry?.settings?.streamPreference;
85094
- if (pref === "low" || pref === "mid" || pref === "high") return pref;
85095
- })();
85096
- const allowTranscode = exposedEntry?.settings?.allowTranscode !== false;
85097
- const scored = pinnedProfile === void 0 ? await api.cameraStreams.pickStream.query({
85098
- deviceId,
85099
- requirements: {
85100
- acceptCodecs: ["h264"],
85101
- minHeight: 480,
85102
- maxHeight: ALEXA_MAX_LINES,
85103
- excludeDerived: true,
85104
- allowTranscode
85105
- },
85106
- preferences: { targetHeight: 720 }
85107
- }).catch((err) => {
85108
- log.warn("alexa rtc-session: pickStream threw — falling back to the high slot", {
85109
- tags: { deviceId },
85110
- meta: { error: err instanceof Error ? err.message : String(err) }
85111
- });
85112
- return null;
85113
- }) : null;
85114
- const scoredProfile = scored === null ? null : await profileForCamStream({
86393
+ const sourceProfile = await resolveAlexaSourceProfile({
85115
86394
  api,
85116
86395
  deviceId,
85117
- camStreamId: scored.camStreamId,
86396
+ exposedEntry,
85118
86397
  logger: log
85119
86398
  });
85120
- const sourceProfile = pinnedProfile ?? scoredProfile ?? "high";
85121
- if (pinnedProfile === void 0) log.info("alexa rtc-session: source scored against the Echo requirements", {
85122
- tags: { deviceId },
85123
- meta: {
85124
- chosen: sourceProfile,
85125
- scored: scored === null ? "none-eligible" : scored.reason,
85126
- camStreamId: scored?.camStreamId ?? null,
85127
- slot: scoredProfile ?? (scored === null ? null : "no-slot"),
85128
- height: scored?.resolution?.height ?? null,
85129
- transcodes: scored?.transcodes ?? null,
85130
- allowTranscode
85131
- }
85132
- });
85133
86399
  let derivedTarget;
85134
86400
  /**
85135
86401
  * The primitive's release handle, when this session acquired one. Recorded so
@@ -86772,7 +88038,7 @@ async function pollUntilReached(plan, deps, untilMs) {
86772
88038
  const read = await plan.read().catch((err) => {
86773
88039
  deps.logger.debug("alexa deferred directive: read-back failed — polling on", {
86774
88040
  tags: { deviceId: plan.deviceId },
86775
- meta: { error: errMsg(err) }
88041
+ meta: { error: errMsg$1(err) }
86776
88042
  });
86777
88043
  return null;
86778
88044
  });
@@ -86820,7 +88086,7 @@ async function runWithDeferral(plan, deps) {
86820
88086
  try {
86821
88087
  await plan.command();
86822
88088
  } catch (err) {
86823
- const message = errMsg(err);
88089
+ const message = errMsg$1(err);
86824
88090
  deps.logger.warn(`alexa deferred directive: ${plan.header.name} command failed`, {
86825
88091
  tags: { deviceId: plan.deviceId },
86826
88092
  meta: { error: message }
@@ -86838,7 +88104,7 @@ async function runWithDeferral(plan, deps) {
86838
88104
  const settled = settleInBackground(plan, deps).catch((err) => {
86839
88105
  deps.logger.warn("alexa deferred directive: settling failed", {
86840
88106
  tags: { deviceId: plan.deviceId },
86841
- meta: { error: errMsg(err) }
88107
+ meta: { error: errMsg$1(err) }
86842
88108
  });
86843
88109
  });
86844
88110
  return {
@@ -88586,13 +89852,13 @@ var AlexaAccessGate = class {
88586
89852
  if (!this.warnedStale) {
88587
89853
  this.warnedStale = true;
88588
89854
  this.deps.logger.warn("alexa access: the hub user store could not be re-read — keeping the last good grants", { meta: {
88589
- error: errMsg(err),
89855
+ error: errMsg$1(err),
88590
89856
  ageMs: this.now() - cached.at
88591
89857
  } });
88592
89858
  }
88593
89859
  return cached;
88594
89860
  }
88595
- this.deps.logger.warn("alexa access: the hub user store could not be read — refusing Alexa access until it can", { meta: { error: errMsg(err) } });
89861
+ 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) } });
88596
89862
  return null;
88597
89863
  }
88598
89864
  }
@@ -88609,7 +89875,7 @@ var AlexaAccessGate = class {
88609
89875
  } catch (err) {
88610
89876
  this.deps.logger.debug("alexa access: device metadata read failed", {
88611
89877
  tags: { deviceId },
88612
- meta: { error: errMsg(err) }
89878
+ meta: { error: errMsg$1(err) }
88613
89879
  });
88614
89880
  return cached?.meta ?? null;
88615
89881
  }
@@ -88644,12 +89910,209 @@ async function readConnectivity(api, deviceId, logger) {
88644
89910
  } catch (err) {
88645
89911
  logger.debug("alexa: device-status unreadable — reporting connectivity OK", {
88646
89912
  tags: { deviceId },
88647
- meta: { error: errMsg(err) }
89913
+ meta: { error: errMsg$1(err) }
88648
89914
  });
88649
89915
  return "OK";
88650
89916
  }
88651
89917
  }
88652
89918
  //#endregion
89919
+ //#region src/action-scenes.ts
89920
+ /**
89921
+ * Actions exported to Alexa as SCENES (D968).
89922
+ *
89923
+ * Alexa has no "run" verb for an arbitrary automation, but it has a scene: an
89924
+ * endpoint with `Alexa.SceneController` whose Activate directive fires
89925
+ * something. An action is exactly that, so it is exported as a scene trigger
89926
+ * and Activate runs `actions.run`.
89927
+ *
89928
+ * An action is a list entry, never a device (D954), so its endpoint id lives
89929
+ * outside the numeric device id space (`action:<id>`, which the device id
89930
+ * parser rejects) and nothing here touches the device registry or the
89931
+ * per-device sync engine.
89932
+ *
89933
+ * `actions.run` is an admin act, so only an ADMIN link sees or fires a scene.
89934
+ * A scoped (non-admin) link is told the endpoint does not exist.
89935
+ *
89936
+ * Whether the run is accepted is decided by `actions.run`: an action that is
89937
+ * already running or in cooldown is refused with a named reason (logged by
89938
+ * `runExportedAction`) and answered `ENDPOINT_BUSY` — never queued.
89939
+ */
89940
+ var EXPORTER = "export-alexa";
89941
+ var PREFIX = "action:";
89942
+ var SCENE_INTERFACE = "Alexa.SceneController";
89943
+ function actionEndpointId(actionId) {
89944
+ return `${PREFIX}${actionId}`;
89945
+ }
89946
+ /** The action id an endpoint id names, or null when it is not an action endpoint. */
89947
+ function parseActionEndpointId(endpointId) {
89948
+ if (!endpointId.startsWith(PREFIX)) return null;
89949
+ const id = endpointId.slice(7);
89950
+ return id.length === 0 ? null : id;
89951
+ }
89952
+ function buildActionSceneEndpoint(entry) {
89953
+ return {
89954
+ endpointId: actionEndpointId(entry.actionId),
89955
+ manufacturerName: "CamStack",
89956
+ description: "CamStack action",
89957
+ friendlyName: entry.displayName,
89958
+ displayCategories: ["SCENE_TRIGGER"],
89959
+ capabilities: [{
89960
+ type: "AlexaInterface",
89961
+ interface: "Alexa",
89962
+ version: "3"
89963
+ }, {
89964
+ type: "AlexaInterface",
89965
+ interface: SCENE_INTERFACE,
89966
+ version: "3",
89967
+ supportsDeactivation: false,
89968
+ proactivelyReported: false
89969
+ }]
89970
+ };
89971
+ }
89972
+ function sceneResponse(header, endpointId) {
89973
+ return { event: {
89974
+ header: {
89975
+ namespace: SCENE_INTERFACE,
89976
+ name: "ActivationStarted",
89977
+ messageId: header.messageId,
89978
+ ...header.correlationToken !== void 0 ? { correlationToken: header.correlationToken } : {},
89979
+ payloadVersion: "3"
89980
+ },
89981
+ endpoint: { endpointId },
89982
+ payload: {
89983
+ cause: { type: "VOICE_INTERACTION" },
89984
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
89985
+ }
89986
+ } };
89987
+ }
89988
+ /** Answer a directive addressed to an action endpoint. */
89989
+ async function handleActionSceneDirective(header, endpoint, principal, deps) {
89990
+ const actionId = parseActionEndpointId(endpoint.endpointId);
89991
+ if (actionId === null) return errorEnvelope(header, "NO_SUCH_ENDPOINT", "not an action endpoint");
89992
+ if (principal.kind !== "admin" || !deps.isExposed(actionId)) {
89993
+ deps.logger.warn("alexa action-scene: directive refused — endpoint not visible to this link", {
89994
+ tags: { actionId },
89995
+ meta: { reason: principal.kind !== "admin" ? "not-admin" : "not-exported" }
89996
+ });
89997
+ return errorEnvelope(header, "NO_SUCH_ENDPOINT", "unknown endpoint");
89998
+ }
89999
+ if (header.namespace !== SCENE_INTERFACE || header.name !== "Activate") return errorEnvelope(header, "INVALID_DIRECTIVE", "an action endpoint only supports Activate");
90000
+ const result = await runExportedAction(deps.api, deps.logger, {
90001
+ exporter: EXPORTER,
90002
+ actionId
90003
+ });
90004
+ switch (result.status) {
90005
+ case "started": return sceneResponse(header, endpoint.endpointId);
90006
+ 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})`);
90007
+ case "failed": return errorEnvelope(header, "ENDPOINT_UNREACHABLE", result.message);
90008
+ }
90009
+ }
90010
+ function errMsg(err) {
90011
+ return err instanceof Error ? err.message : String(err);
90012
+ }
90013
+ var ActionSceneExports = class {
90014
+ ports;
90015
+ entries;
90016
+ constructor(ports, initial) {
90017
+ this.ports = ports;
90018
+ this.entries = initial;
90019
+ }
90020
+ isExposed(actionId) {
90021
+ return this.entries.some((e) => e.actionId === actionId);
90022
+ }
90023
+ list() {
90024
+ return this.entries.map((e) => ({
90025
+ entity: {
90026
+ kind: "action",
90027
+ actionId: e.actionId
90028
+ },
90029
+ exposedAs: e.displayName
90030
+ }));
90031
+ }
90032
+ /** The scenes Discovery adds for this link: admins only. */
90033
+ endpointsFor(principal) {
90034
+ if (principal.kind !== "admin") return [];
90035
+ return this.entries.map(buildActionSceneEndpoint);
90036
+ }
90037
+ async expose(actionId) {
90038
+ const action = (await this.ports.api.actions.list.query({})).find((a) => a.id === actionId);
90039
+ if (action === void 0) throw new Error(`export-alexa: action '${actionId}' does not exist`);
90040
+ const entry = {
90041
+ actionId,
90042
+ displayName: action.name,
90043
+ addedAt: this.entries.find((e) => e.actionId === actionId)?.addedAt ?? Date.now()
90044
+ };
90045
+ await this.save([...this.entries.filter((e) => e.actionId !== actionId), entry]);
90046
+ await this.pushToAdmins([buildActionSceneEndpoint(entry)]);
90047
+ this.ports.logger.info("export-alexa: exposed action as a scene", {
90048
+ tags: { actionId },
90049
+ meta: { displayName: action.name }
90050
+ });
90051
+ }
90052
+ async unexpose(actionId) {
90053
+ if (this.isExposed(actionId)) await this.save(this.entries.filter((e) => e.actionId !== actionId));
90054
+ await this.deleteFromAll([actionEndpointId(actionId)]);
90055
+ this.ports.logger.info("export-alexa: unexposed action scene", { tags: { actionId } });
90056
+ }
90057
+ /** Push every scene (boot, relink). */
90058
+ async pushAll() {
90059
+ await this.pushToAdmins(this.entries.map(buildActionSceneEndpoint));
90060
+ }
90061
+ /**
90062
+ * Drop what the operator deleted. An action list that could not be read
90063
+ * changes nothing (D49).
90064
+ */
90065
+ async reconcile() {
90066
+ if (this.entries.length === 0) return;
90067
+ let live;
90068
+ try {
90069
+ const actions = await this.ports.api.actions.list.query({});
90070
+ live = new Set(actions.map((a) => a.id));
90071
+ } catch (err) {
90072
+ this.ports.logger.warn("export-alexa: action scenes not reconciled — list unanswered", { meta: { error: errMsg(err) } });
90073
+ return;
90074
+ }
90075
+ const { dropped } = pruneDeletedEntities(this.entries.map((e) => ({
90076
+ kind: "action",
90077
+ actionId: e.actionId
90078
+ })), {
90079
+ actionIds: live,
90080
+ targetIds: /* @__PURE__ */ new Set()
90081
+ }, this.ports.logger, EXPORTER);
90082
+ if (dropped.length === 0) return;
90083
+ const gone = new Set(dropped.flatMap((r) => r.kind === "action" ? [r.actionId] : []));
90084
+ await this.save(this.entries.filter((e) => !gone.has(e.actionId)));
90085
+ await this.deleteFromAll([...gone].map(actionEndpointId));
90086
+ }
90087
+ async save(next) {
90088
+ this.entries = next;
90089
+ await this.ports.persist(next);
90090
+ }
90091
+ async pushToAdmins(endpoints) {
90092
+ if (endpoints.length === 0 || !this.ports.canPush()) return;
90093
+ for (const userId of this.ports.linkedUserIds()) try {
90094
+ if (!await this.ports.isAdminUser(userId)) continue;
90095
+ await this.ports.postAddOrUpdate(userId, endpoints);
90096
+ } catch (err) {
90097
+ this.ports.logger.warn("export-alexa: action scene push failed", { meta: {
90098
+ userId,
90099
+ error: errMsg(err)
90100
+ } });
90101
+ }
90102
+ }
90103
+ async deleteFromAll(ids) {
90104
+ if (ids.length === 0 || !this.ports.canPush()) return;
90105
+ for (const userId of this.ports.linkedUserIds()) try {
90106
+ await this.ports.postDelete(userId, ids);
90107
+ } catch (err) {
90108
+ this.ports.logger.warn("export-alexa: action scene delete failed", { meta: {
90109
+ userId,
90110
+ error: errMsg(err)
90111
+ } });
90112
+ }
90113
+ }
90114
+ };
90115
+ //#endregion
88653
90116
  //#region src/endpoints/validate-instanced.ts
88654
90117
  /**
88655
90118
  * Amazon's rules for the INSTANCED interfaces' extra fields (D869), the ones a
@@ -88873,7 +90336,8 @@ var ALLOWED_INTERFACE_VERSIONS = {
88873
90336
  "Alexa.ThermostatController": "3.1",
88874
90337
  "Alexa.SmartVision.SnapshotProvider": "1.1",
88875
90338
  "Alexa.SmartVision.ObjectDetectionSensor": "1.0",
88876
- "Alexa.DataController": "1.0"
90339
+ "Alexa.DataController": "1.0",
90340
+ "Alexa.SceneController": "3"
88877
90341
  };
88878
90342
  /** `imageNetClass` values Amazon accepts (alexa-smartvision-objectdetectionsensor). */
88879
90343
  var SMART_VISION_CLASSES = new Set(["person", "package"]);
@@ -88915,6 +90379,7 @@ var DISPLAY_CATEGORIES = new Set([
88915
90379
  "DOOR",
88916
90380
  "GATE",
88917
90381
  "GARAGE_DOOR",
90382
+ "SCENE_TRIGGER",
88918
90383
  "OTHER"
88919
90384
  ]);
88920
90385
  var ENDPOINT_ID_PATTERN = /^[A-Za-z0-9 _\-=#;:?@&]{1,256}$/;
@@ -90810,6 +92275,7 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
90810
92275
  "Alexa.DataController/DeleteData": "view",
90811
92276
  "Alexa.LockController/Lock": "create",
90812
92277
  "Alexa.LockController/Unlock": "create",
92278
+ "Alexa.SceneController/Activate": "create",
90813
92279
  ...Object.fromEntries(GENERIC_DIRECTIVE_KEYS.map((k) => [k, "create"]))
90814
92280
  };
90815
92281
  try {
@@ -90841,6 +92307,17 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
90841
92307
  body: errorEnvelope(header, "INTERNAL_ERROR", lookup.error)
90842
92308
  };
90843
92309
  principal = lookup.principal;
92310
+ if (endpoint !== void 0 && deps.actionScenes !== void 0 && parseActionEndpointId(endpoint.endpointId) !== null) {
92311
+ const scenes = deps.actionScenes;
92312
+ return {
92313
+ status: 200,
92314
+ body: await handleActionSceneDirective(header, endpoint, principal, {
92315
+ api: scenes.api,
92316
+ logger: scenes.logger,
92317
+ isExposed: (actionId) => scenes.exports.isExposed(actionId)
92318
+ })
92319
+ };
92320
+ }
90844
92321
  if (key !== "Alexa.Discovery/Discover") {
90845
92322
  if (endpoint === void 0) return {
90846
92323
  status: 200,
@@ -90893,7 +92370,8 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
90893
92370
  reason: describeRefusal(r.refusal)
90894
92371
  }))
90895
92372
  } });
90896
- const valid = withholdInvalidEndpoints(filtered.kept, (message, violations) => {
92373
+ const scenes = deps.actionScenes?.exports.endpointsFor(who) ?? [];
92374
+ const valid = withholdInvalidEndpoints([...filtered.kept, ...scenes], (message, violations) => {
90897
92375
  deps.discovery.logger.warn(message, { meta: {
90898
92376
  userId: callerIdentity.userId,
90899
92377
  violations
@@ -91942,6 +93420,7 @@ var LwaEventGateway = class {
91942
93420
  return;
91943
93421
  }
91944
93422
  if (!this.hasProactiveCredentials()) return;
93423
+ this.deps.onExposedDoorbellPress?.(parentDeviceId);
91945
93424
  for (const account of linked) {
91946
93425
  if (!this.mayPush(account.userId, parentDeviceId, "doorbell press")) continue;
91947
93426
  if (!this.findToken(account.userId)) {
@@ -93165,7 +94644,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93165
94644
  tags: { deviceId },
93166
94645
  meta: {
93167
94646
  userId: change.userId,
93168
- error: errMsg(err)
94647
+ error: errMsg$1(err)
93169
94648
  }
93170
94649
  });
93171
94650
  return false;
@@ -93184,7 +94663,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93184
94663
  tags: { deviceId },
93185
94664
  meta: {
93186
94665
  userId: change.userId,
93187
- error: errMsg(err)
94666
+ error: errMsg$1(err)
93188
94667
  }
93189
94668
  });
93190
94669
  return false;
@@ -93238,7 +94717,7 @@ var DetectionClassSource = class {
93238
94717
  } catch (err) {
93239
94718
  this.deps.logger.debug("alexa detection sensors: class read failed — keeping the last answer", {
93240
94719
  tags: { deviceId },
93241
- meta: { error: errMsg(err) }
94720
+ meta: { error: errMsg$1(err) }
93242
94721
  });
93243
94722
  return prev?.classes ?? [];
93244
94723
  }
@@ -93331,7 +94810,7 @@ var DetectionSensorFeed = class {
93331
94810
  } catch (err) {
93332
94811
  this.deps.logger.debug("alexa detection sensors: active-track read failed — kept as is", {
93333
94812
  tags: { deviceId },
93334
- meta: { error: errMsg(err) }
94813
+ meta: { error: errMsg$1(err) }
93335
94814
  });
93336
94815
  }
93337
94816
  }
@@ -93343,7 +94822,7 @@ var DetectionSensorFeed = class {
93343
94822
  meta: {
93344
94823
  detectionClass: cls,
93345
94824
  present,
93346
- error: errMsg(err)
94825
+ error: errMsg$1(err)
93347
94826
  }
93348
94827
  });
93349
94828
  });
@@ -93462,7 +94941,7 @@ var ObjectDetectionFeed = class {
93462
94941
  tags: { deviceId: parsed.data.deviceId },
93463
94942
  meta: {
93464
94943
  trackId: parsed.data.trackId,
93465
- error: errMsg(err)
94944
+ error: errMsg$1(err)
93466
94945
  }
93467
94946
  });
93468
94947
  });
@@ -93652,7 +95131,7 @@ var AlexaVisionRuntime = class {
93652
95131
  } catch (err) {
93653
95132
  this.deps.logger.debug("alexa: per-device settings unreadable — using defaults", {
93654
95133
  tags: { deviceId },
93655
- meta: { error: errMsg(err) }
95134
+ meta: { error: errMsg$1(err) }
93656
95135
  });
93657
95136
  return {};
93658
95137
  }
@@ -93750,7 +95229,7 @@ var AlexaVisionRuntime = class {
93750
95229
  tags: { deviceId },
93751
95230
  meta: {
93752
95231
  trackId,
93753
- error: errMsg(err)
95232
+ error: errMsg$1(err)
93754
95233
  }
93755
95234
  });
93756
95235
  return null;
@@ -94420,7 +95899,7 @@ var StateChangeReporter = class {
94420
95899
  shaper;
94421
95900
  constructor(deps) {
94422
95901
  this.deps = deps;
94423
- this.shaper = new ReportShaper((err) => this.deps.logger.warn("alexa state reports: a shaped report failed", { meta: { error: errMsg(err) } }), this.deps.clock);
95902
+ this.shaper = new ReportShaper((err) => this.deps.logger.warn("alexa state reports: a shaped report failed", { meta: { error: errMsg$1(err) } }), this.deps.clock);
94424
95903
  }
94425
95904
  start() {
94426
95905
  this.off = this.deps.eventBus.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
@@ -94457,7 +95936,7 @@ var StateChangeReporter = class {
94457
95936
  tags: { deviceId: change.deviceId },
94458
95937
  meta: {
94459
95938
  capName: change.capName,
94460
- error: errMsg(err)
95939
+ error: errMsg$1(err)
94461
95940
  }
94462
95941
  });
94463
95942
  }
@@ -94491,7 +95970,7 @@ var StateChangeReporter = class {
94491
95970
  tags: { deviceId: change.deviceId },
94492
95971
  meta: {
94493
95972
  capName: change.capName,
94494
- error: errMsg(err)
95973
+ error: errMsg$1(err)
94495
95974
  }
94496
95975
  });
94497
95976
  }
@@ -94580,7 +96059,7 @@ var StateReconciler = class {
94580
96059
  });
94581
96060
  }
94582
96061
  } catch (err) {
94583
- this.deps.logger.warn("alexa state reconcile: a pass failed", { meta: { error: errMsg(err) } });
96062
+ this.deps.logger.warn("alexa state reconcile: a pass failed", { meta: { error: errMsg$1(err) } });
94584
96063
  } finally {
94585
96064
  this.running = false;
94586
96065
  }
@@ -95044,6 +96523,7 @@ var DEFAULT_CONFIG = {
95044
96523
  advertisedBrokerUrl: "",
95045
96524
  region: "NA",
95046
96525
  exposed: [],
96526
+ exposedActions: [],
95047
96527
  linkedAccounts: [],
95048
96528
  tokens: [],
95049
96529
  exportedEndpoints: {},
@@ -95105,7 +96585,10 @@ var ExportAlexaAddon = class extends BaseAddon {
95105
96585
  "tokens[userId].brokerCredential"
95106
96586
  ];
95107
96587
  lwaGateway = null;
96588
+ egressPrewarm = null;
95108
96589
  syncEngine = null;
96590
+ /** D968: exported actions, answered as Alexa scenes. */
96591
+ actionScenes = null;
95109
96592
  /** S1 (D767): the linking user's live grants. Built in `onInitialize`, the
95110
96593
  * first point `ctx` exists. */
95111
96594
  accessGateRef = null;
@@ -95137,7 +96620,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95137
96620
  }
95138
96621
  await this.backfillLinkedAccounts();
95139
96622
  this.autoDetectPublicHubUrl().catch((err) => {
95140
- this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg(err) } });
96623
+ this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg$1(err) } });
95141
96624
  });
95142
96625
  this.accessGateRef = createHubAccessGate(this.ctx);
95143
96626
  this.detectionClassSource = new DetectionClassSource({
@@ -95166,6 +96649,23 @@ var ExportAlexaAddon = class extends BaseAddon {
95166
96649
  store: this.snapshotStore,
95167
96650
  post: (opts) => this.requireGateway().postObjectDetection(opts)
95168
96651
  });
96652
+ this.actionScenes = new ActionSceneExports({
96653
+ api: this.ctx.api,
96654
+ logger: this.ctx.logger,
96655
+ linkedUserIds: () => this.config.linkedAccounts.map((a) => a.userId),
96656
+ isAdminUser: async (userId) => {
96657
+ const lookup = await this.accessGate.principal(userId);
96658
+ return lookup.kind === "found" && lookup.principal.kind === "admin";
96659
+ },
96660
+ canPush: () => this.config.tokens.length > 0,
96661
+ postAddOrUpdate: (userId, endpoints) => this.requireGateway().postReport(userId, (accessToken) => buildAddOrUpdateReportPayload(userId, endpoints, accessToken), `action scenes add/update (${endpoints.length})`),
96662
+ postDelete: (userId, ids) => this.requireGateway().postReport(userId, (accessToken) => buildDeleteReportPayload(userId, ids, accessToken), `action scenes delete (${ids.length})`),
96663
+ persist: (entries) => this.updateGlobalSettings({ exposedActions: [...entries] })
96664
+ }, this.config.exposedActions ?? []);
96665
+ const actionScenes = this.actionScenes;
96666
+ actionScenes.reconcile().catch((err) => {
96667
+ this.ctx.logger.warn("export-alexa: action scene reconcile at boot failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
96668
+ });
95169
96669
  const deviceExportProvider = {
95170
96670
  getStatus: async () => ({
95171
96671
  linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
@@ -95176,6 +96676,24 @@ var ExportAlexaAddon = class extends BaseAddon {
95176
96676
  listExposedDevices: async () => this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) })),
95177
96677
  exposeDevice: async ({ deviceId }) => this.exposeDevice(deviceId),
95178
96678
  unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
96679
+ listSupportedEntityKinds: async () => ["device", "action"],
96680
+ listExposedEntities: async () => {
96681
+ await actionScenes.reconcile();
96682
+ return [...this.config.exposed.map((e) => ({ entity: {
96683
+ kind: "device",
96684
+ deviceId: String(e.deviceId)
96685
+ } })), ...actionScenes.list()];
96686
+ },
96687
+ exposeEntity: async ({ entity }) => {
96688
+ if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
96689
+ if (entity.kind === "action") return actionScenes.expose(entity.actionId);
96690
+ throw new Error("export-alexa: a notification target cannot be exported to Alexa");
96691
+ },
96692
+ unexposeEntity: async ({ entity }) => {
96693
+ if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
96694
+ if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
96695
+ throw new Error("export-alexa: a notification target cannot be exported to Alexa");
96696
+ },
95179
96697
  getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(Number(input.deviceId)),
95180
96698
  getDeviceLiveContribution: async () => null,
95181
96699
  applyDeviceSettingsPatch: (input) => this.applyDeviceSettingsPatch(Number(input.deviceId), input.patch)
@@ -95248,6 +96766,11 @@ var ExportAlexaAddon = class extends BaseAddon {
95248
96766
  },
95249
96767
  vision: this.vision.context(),
95250
96768
  access: this.endpointAccess,
96769
+ actionScenes: {
96770
+ exports: actionScenes,
96771
+ api: this.ctx.api,
96772
+ logger: this.ctx.logger
96773
+ },
95251
96774
  afterDiscovery: (userId, endpoints) => this.requireGateway().scheduleInitialConnectivity(userId, endpoints)
95252
96775
  },
95253
96776
  lwaTokensCallbackDeps: {
@@ -95271,10 +96794,19 @@ var ExportAlexaAddon = class extends BaseAddon {
95271
96794
  }
95272
96795
  }));
95273
96796
  const oauthIntegrationProvider = { getDescriptor: async () => buildAlexaOauthIntegration(this.config.publicHubUrl) };
96797
+ this.egressPrewarm = new AlexaEgressPrewarm({
96798
+ api: this.ctx.api,
96799
+ logger: this.ctx.logger,
96800
+ listExposed: () => this.config.exposed,
96801
+ hasLiveSession: (deviceId) => heldEgressHandles().some((h) => h.deviceId === deviceId)
96802
+ });
95274
96803
  this.lwaGateway = new LwaEventGateway({
95275
96804
  ctx: this.ctx,
95276
96805
  logger: this.ctx.logger,
95277
96806
  listExposed: () => this.config.exposed,
96807
+ onExposedDoorbellPress: (deviceId) => {
96808
+ this.egressPrewarm?.onPress(deviceId);
96809
+ },
95278
96810
  listLinkedAccounts: () => this.config.linkedAccounts,
95279
96811
  listTokens: () => this.config.tokens,
95280
96812
  upsertToken: (input) => this.upsertToken(input),
@@ -95363,7 +96895,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95363
96895
  this.redetectPublicHubUrl().then(({ publicHubUrl }) => {
95364
96896
  this.ctx.logger.info("export-alexa: re-detected public hub URL after tunnel connect", { meta: { publicHubUrl } });
95365
96897
  }).catch((err) => {
95366
- this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg(err) } });
96898
+ this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg$1(err) } });
95367
96899
  });
95368
96900
  });
95369
96901
  this.ctx.addDisposer(async () => offTunnelStarted());
@@ -95428,17 +96960,22 @@ var ExportAlexaAddon = class extends BaseAddon {
95428
96960
  this.stateReconciler = null;
95429
96961
  this.stateReporter?.stop();
95430
96962
  this.stateReporter = null;
96963
+ if (this.egressPrewarm) {
96964
+ await this.egressPrewarm.dispose();
96965
+ this.egressPrewarm = null;
96966
+ }
95431
96967
  if (this.lwaGateway) {
95432
96968
  this.lwaGateway.stop();
95433
96969
  this.lwaGateway = null;
95434
96970
  }
95435
96971
  this.syncEngine = null;
96972
+ this.actionScenes = null;
95436
96973
  }
95437
96974
  async exposeDevice(deviceIdRaw) {
95438
96975
  const deviceId = Number.parseInt(deviceIdRaw, 10);
95439
96976
  if (!Number.isFinite(deviceId)) throw new Error(`export-alexa: deviceId must be numeric — got "${deviceIdRaw}"`);
95440
96977
  if (!await this.ctx.api.deviceManager.getDevice.query({ deviceId }).catch((err) => {
95441
- throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg(err)}`);
96978
+ throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg$1(err)}`);
95442
96979
  })) throw new Error(`export-alexa: device ${deviceId} not found`);
95443
96980
  const next = this.config.exposed.filter((e) => e.deviceId !== deviceId);
95444
96981
  next.push({
@@ -95454,7 +96991,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95454
96991
  }).catch((err) => {
95455
96992
  this.ctx.logger.warn("export-alexa: expose sync failed", { meta: {
95456
96993
  deviceId,
95457
- error: errMsg(err)
96994
+ error: errMsg$1(err)
95458
96995
  } });
95459
96996
  });
95460
96997
  }
@@ -95468,7 +97005,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95468
97005
  this.requireSyncEngine().removeDevice(deviceId).catch((err) => {
95469
97006
  this.ctx.logger.warn("export-alexa: unexpose delete failed", { meta: {
95470
97007
  deviceId,
95471
- error: errMsg(err)
97008
+ error: errMsg$1(err)
95472
97009
  } });
95473
97010
  });
95474
97011
  }
@@ -95516,14 +97053,14 @@ var ExportAlexaAddon = class extends BaseAddon {
95516
97053
  const engine = this.syncEngine;
95517
97054
  if (engine === null) return;
95518
97055
  engine.reconcileAllExposed().catch((err) => {
95519
- this.ctx.logger.warn("export-alexa: re-sync after a switch change failed", { meta: { error: errMsg(err) } });
97056
+ this.ctx.logger.warn("export-alexa: re-sync after a switch change failed", { meta: { error: errMsg$1(err) } });
95520
97057
  });
95521
97058
  }
95522
97059
  scheduleDetectionClassRefresh() {
95523
97060
  const timer = setInterval(() => {
95524
97061
  if (!this.config.detectionSensors && !this.config.objectDetection) return;
95525
97062
  this.requireSyncEngine().reconcileAllExposed().catch((err) => {
95526
- this.ctx.logger.warn("export-alexa: detection-class refresh failed", { meta: { error: errMsg(err) } });
97063
+ this.ctx.logger.warn("export-alexa: detection-class refresh failed", { meta: { error: errMsg$1(err) } });
95527
97064
  });
95528
97065
  }, DETECTION_CLASS_REFRESH_MS);
95529
97066
  timer.unref?.();
@@ -95550,7 +97087,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95550
97087
  try {
95551
97088
  await applyVisibilityChanges(await this.visibility.refresh(), this.requireSyncEngine(), this.ctx.logger);
95552
97089
  } catch (err) {
95553
- this.ctx.logger.warn("export-alexa: visibility refresh failed", { meta: { error: errMsg(err) } });
97090
+ this.ctx.logger.warn("export-alexa: visibility refresh failed", { meta: { error: errMsg$1(err) } });
95554
97091
  }
95555
97092
  }
95556
97093
  scheduleVisibilityRefresh() {
@@ -95640,7 +97177,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95640
97177
  pushed: r.pushedDeviceIds
95641
97178
  } });
95642
97179
  }).catch((err) => {
95643
- this.ctx.logger.warn("export-alexa: boot discovery reconcile failed", { meta: { error: errMsg(err) } });
97180
+ this.ctx.logger.warn("export-alexa: boot discovery reconcile failed", { meta: { error: errMsg$1(err) } });
95644
97181
  });
95645
97182
  }, BOOT_RECONCILE_DELAY_MS);
95646
97183
  if (typeof timer.unref === "function") timer.unref();
@@ -95653,7 +97190,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95653
97190
  } catch (err) {
95654
97191
  this.ctx.logger.warn("export-alexa: bindings-change discovery reconcile failed", {
95655
97192
  tags: { deviceId },
95656
- meta: { error: errMsg(err) }
97193
+ meta: { error: errMsg$1(err) }
95657
97194
  });
95658
97195
  }
95659
97196
  }
@@ -95769,7 +97306,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95769
97306
  }).catch((err) => {
95770
97307
  this.ctx.logger.warn("export-alexa: new-account push failed", { meta: {
95771
97308
  userId: input.userId,
95772
- error: errMsg(err)
97309
+ error: errMsg$1(err)
95773
97310
  } });
95774
97311
  });
95775
97312
  }
@@ -95802,7 +97339,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95802
97339
  this.updateGlobalSettings({ advertisedBrokerUrl: url }).then(() => {
95803
97340
  this.ctx.logger.info("export-alexa: the skill Lambda advertised its token broker", { meta: { brokerUrl: url } });
95804
97341
  }).catch((err) => {
95805
- this.ctx.logger.warn("export-alexa: could not store the advertised broker URL", { meta: { error: errMsg(err) } });
97342
+ this.ctx.logger.warn("export-alexa: could not store the advertised broker URL", { meta: { error: errMsg$1(err) } });
95806
97343
  });
95807
97344
  }
95808
97345
  async revokeAtBroker(tokens) {
@@ -95811,7 +97348,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95811
97348
  await revokeBrokerCredential(fetch, t.brokerUrl, t.brokerCredential).catch((err) => {
95812
97349
  this.ctx.logger.warn("export-alexa: could not delete the link at the skill broker — it expires there on its own", { meta: {
95813
97350
  userId: t.userId,
95814
- error: errMsg(err)
97351
+ error: errMsg$1(err)
95815
97352
  } });
95816
97353
  });
95817
97354
  }
@@ -95842,7 +97379,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95842
97379
  this.ctx.logger.warn("export-alexa: broker credential rotation failed", { meta: {
95843
97380
  userId: t.userId,
95844
97381
  kind: err instanceof BrokerError ? err.kind : "unavailable",
95845
- error: errMsg(err)
97382
+ error: errMsg$1(err)
95846
97383
  } });
95847
97384
  }
95848
97385
  }
@@ -95888,7 +97425,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95888
97425
  const urls = (await this.ctx.api.networkAccess.listEndpoints.query({})).filter((e) => e.protocol === "https" && e.url.length > 0).map((e) => this.normaliseHubUrl(e.url));
95889
97426
  return [...new Set(urls)];
95890
97427
  } catch (err) {
95891
- this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg(err) } });
97428
+ this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg$1(err) } });
95892
97429
  return [];
95893
97430
  }
95894
97431
  }
@@ -95902,7 +97439,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95902
97439
  if (!status?.connected || !endpoint || endpoint.protocol !== "https" || endpoint.url.length === 0) return "";
95903
97440
  return this.normaliseHubUrl(endpoint.url);
95904
97441
  } catch (err) {
95905
- this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg(err) } });
97442
+ this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg$1(err) } });
95906
97443
  return "";
95907
97444
  }
95908
97445
  }
@@ -96212,13 +97749,13 @@ var ExportAlexaAddon = class extends BaseAddon {
96212
97749
  if (nameChanged && !sourceChanged) this.requireSyncEngine().pushDevice(deviceId).catch((err) => {
96213
97750
  this.ctx.logger.warn("export-alexa: push after an Alexa name change failed", {
96214
97751
  tags: { deviceId },
96215
- meta: { error: errMsg(err) }
97752
+ meta: { error: errMsg$1(err) }
96216
97753
  });
96217
97754
  });
96218
97755
  if (prefsChanged && !sourceChanged) this.requireSyncEngine().reconcileDevice(deviceId).catch((err) => {
96219
97756
  this.ctx.logger.warn("export-alexa: re-sync after a detection preference change failed", {
96220
97757
  tags: { deviceId },
96221
- meta: { error: errMsg(err) }
97758
+ meta: { error: errMsg$1(err) }
96222
97759
  });
96223
97760
  });
96224
97761
  if (sourceChanged) {
@@ -96242,7 +97779,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96242
97779
  } catch (err) {
96243
97780
  this.ctx.logger.warn("export-alexa: failed to refresh after streamPreference change", { meta: {
96244
97781
  deviceId,
96245
- error: errMsg(err)
97782
+ error: errMsg$1(err)
96246
97783
  } });
96247
97784
  }
96248
97785
  }