@camstack/addon-export-alexa 1.2.174 → 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-DJws6ho7.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" });
@@ -8638,6 +8713,7 @@ var CAP_NAMES = Object.freeze([
8638
8713
  "network-link",
8639
8714
  "network-quality",
8640
8715
  "node-certificates",
8716
+ "node-removal-hook",
8641
8717
  "nodes",
8642
8718
  "notification-output",
8643
8719
  "notification-rules",
@@ -8648,6 +8724,7 @@ var CAP_NAMES = Object.freeze([
8648
8724
  "osd",
8649
8725
  "osd-manager",
8650
8726
  "pet-feeder",
8727
+ "pet-fountain",
8651
8728
  "pipeline-analytics",
8652
8729
  "pipeline-executor",
8653
8730
  "pipeline-orchestrator",
@@ -9927,6 +10004,56 @@ Object.freeze({
9927
10004
  "valueType": "number"
9928
10005
  }
9929
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"
10055
+ }
10056
+ ],
9930
10057
  "power-meter": [
9931
10058
  {
9932
10059
  "path": "power",
@@ -10464,7 +10591,7 @@ object({
10464
10591
  params: record(string(), union([string(), number()])).optional()
10465
10592
  });
10466
10593
  //#endregion
10467
- //#region ../types/dist/err-msg-BCdlR2Li.mjs
10594
+ //#region ../types/dist/err-msg-DWXWc0Di.mjs
10468
10595
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10469
10596
  DeviceType["Camera"] = "camera";
10470
10597
  DeviceType["Hub"] = "hub";
@@ -10556,6 +10683,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10556
10683
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10557
10684
  * integrations sharing the same food/desiccant/hopper surface. */
10558
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";
10559
10690
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10560
10691
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10561
10692
  * Sources: native Bosch Home Connect, reusable by similar integrations.
@@ -10820,13 +10951,13 @@ import { errMsg } from '@camstack/types'
10820
10951
  * Extract a human-readable message from an unknown error value.
10821
10952
  * Replaces the ubiquitous `errMsg(err)` pattern.
10822
10953
  */
10823
- function errMsg(err) {
10954
+ function errMsg$1(err) {
10824
10955
  if (err instanceof Error) return err.message;
10825
10956
  if (typeof err === "string") return err;
10826
10957
  return String(err);
10827
10958
  }
10828
10959
  //#endregion
10829
- //#region ../types/dist/composition-bIBW5_13.mjs
10960
+ //#region ../types/dist/composition-kSuOifuG.mjs
10830
10961
  /**
10831
10962
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10832
10963
  *
@@ -11911,12 +12042,28 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11911
12042
  ])
11912
12043
  })
11913
12044
  ]);
11914
- 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({
11915
12060
  kind: literal("forward"),
11916
12061
  source: CompositionSourceRefSchema,
11917
12062
  cap: string().min(1),
11918
- method: string().min(1)
11919
- }), CompositionCodeSourceSchema]);
12063
+ method: string().min(1),
12064
+ args: record(string().min(1), CompositionForwardArgSchema).optional()
12065
+ });
12066
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
11920
12067
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
11921
12068
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11922
12069
  /**
@@ -11926,7 +12073,13 @@ var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11926
12073
  */
11927
12074
  var CompositionItemEntrySchema = object({
11928
12075
  label: string().min(1).max(80),
11929
- 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()
11930
12083
  });
11931
12084
  var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11932
12085
  kind: literal("fields"),
@@ -11938,7 +12091,7 @@ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11938
12091
  * owns the WHOLE array field: the composed value holds exactly these items.
11939
12092
  */
11940
12093
  items: record(string().regex(COMPOSITION_ITEM_KEY_RE), CompositionItemEntrySchema).refine((items) => Object.keys(items).length <= 16, { message: `at most 16 items` }).optional(),
11941
- /** RESERVED for slice 3; refused by the validator when non-empty. */
12094
+ /** Method name → what serves it. Only a BUILT capability takes commands (D967). */
11942
12095
  commands: record(string().min(1), CompositionCommandTargetSchema).optional()
11943
12096
  }), object({
11944
12097
  kind: literal("passthrough"),
@@ -16165,6 +16318,510 @@ object({
16165
16318
  lastError: string().nullable()
16166
16319
  });
16167
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
+ /**
16168
16825
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16169
16826
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
16170
16827
  *
@@ -16196,52 +16853,6 @@ var AddonPageInfoSchema = object({
16196
16853
  bundleUrl: string()
16197
16854
  });
16198
16855
  method(_void(), array(AddonPageInfoSchema).readonly());
16199
- /**
16200
- * `addon-pages-source` — collection cap exposing per-provider raw page
16201
- * declarations. Every addon that contributes a UI page registers a
16202
- * provider here. The hub-side singleton aggregator (`addon-pages` cap,
16203
- * see `addon-pages.cap.ts`) walks this collection, stamps versioned
16204
- * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
16205
- * that admin-ui consumes.
16206
- *
16207
- * The split exists because the public listing has a different output
16208
- * shape than the per-provider raw declarations, and we want both ends
16209
- * to flow through codegen instead of relying on a hand-written wrapper.
16210
- */
16211
- var AddonPageDeclarationSchema = object({
16212
- id: string(),
16213
- label: string(),
16214
- icon: string(),
16215
- path: string(),
16216
- /**
16217
- * Module Federation remote name — must match the `name` field on the
16218
- * page addon's `federation()` plugin config. Used by admin-ui's
16219
- * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
16220
- * Conventionally `addon_<id>_page` (snake_case; MF names cannot
16221
- * contain hyphens).
16222
- */
16223
- remoteName: string(),
16224
- /**
16225
- * Bundle filename inside the addon's `dist/` dir served at
16226
- * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
16227
- * is always `'remoteEntry.js'`; the value is kept on the metadata so
16228
- * the static-file route can compute an mtime-based cache-buster URL
16229
- * without a separate filesystem stat.
16230
- */
16231
- bundle: string(),
16232
- /**
16233
- * Sidebar section this page docks into. Well-known ids: `'detection'`,
16234
- * `'cluster'`, `'administration'` — the page renders inside that group.
16235
- * Any OTHER string creates (or joins) a custom section rendered after
16236
- * the built-in groups; its label comes from `sectionLabel` (first
16237
- * declaration wins), falling back to the id. Absent → the legacy
16238
- * "Addon Pages" group.
16239
- */
16240
- section: string().optional(),
16241
- /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
16242
- sectionLabel: string().optional()
16243
- });
16244
- method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
16245
16856
  var AddonHttpRouteSchema = object({
16246
16857
  method: _enum([
16247
16858
  "GET",
@@ -18803,7 +19414,11 @@ var CompositionProblemSchema = object({
18803
19414
  "mixed-quantity",
18804
19415
  "helper-mismatch",
18805
19416
  "member-constraint",
18806
- "retention"
19417
+ "retention",
19418
+ "command-method-unknown",
19419
+ "command-source-unknown",
19420
+ "command-input-unknown",
19421
+ "command-input-missing"
18807
19422
  ]),
18808
19423
  path: string(),
18809
19424
  message: string()
@@ -18842,7 +19457,9 @@ var CompositionFieldRoleSchema = _enum([
18842
19457
  var CompositionFieldItemSchema = object({
18843
19458
  arrayPath: string(),
18844
19459
  key: string(),
18845
- 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()
18846
19463
  });
18847
19464
  var CompositionFieldPlanSchema = object({
18848
19465
  cap: string(),
@@ -19047,7 +19664,7 @@ Object.freeze({
19047
19664
  * One catalog row per base reading a group helper can build (D944 §3).
19048
19665
  * Data, not a form default written into the block.
19049
19666
  */
19050
- var NOW$2 = {
19667
+ var NOW$3 = {
19051
19668
  fieldPath: "lastFetchedAt",
19052
19669
  expr: "now"
19053
19670
  };
@@ -19099,7 +19716,7 @@ var GROUP_TEMPLATES = [
19099
19716
  quantity: "temperature",
19100
19717
  defaultAggregate: "mean",
19101
19718
  empty: "null",
19102
- companions: [NOW$2],
19719
+ companions: [NOW$3],
19103
19720
  alsoFrom: {
19104
19721
  deviceTypes: CLIMATE_DEVICES,
19105
19722
  accept: {
@@ -19117,7 +19734,7 @@ var GROUP_TEMPLATES = [
19117
19734
  quantity: "humidity",
19118
19735
  defaultAggregate: "mean",
19119
19736
  empty: "null",
19120
- companions: [NOW$2],
19737
+ companions: [NOW$3],
19121
19738
  alsoFrom: {
19122
19739
  deviceTypes: CLIMATE_DEVICES,
19123
19740
  accept: {
@@ -19135,7 +19752,7 @@ var GROUP_TEMPLATES = [
19135
19752
  quantity: "pressure",
19136
19753
  defaultAggregate: "mean",
19137
19754
  empty: "null",
19138
- companions: [NOW$2]
19755
+ companions: [NOW$3]
19139
19756
  }),
19140
19757
  numeric({
19141
19758
  id: "illuminance",
@@ -19146,7 +19763,7 @@ var GROUP_TEMPLATES = [
19146
19763
  quantity: "illuminance",
19147
19764
  defaultAggregate: "mean",
19148
19765
  empty: "null",
19149
- companions: [NOW$2]
19766
+ companions: [NOW$3]
19150
19767
  }),
19151
19768
  numeric({
19152
19769
  id: "power",
@@ -19157,7 +19774,7 @@ var GROUP_TEMPLATES = [
19157
19774
  quantity: "power",
19158
19775
  defaultAggregate: "sum",
19159
19776
  empty: "omit",
19160
- companions: [NOW$2]
19777
+ companions: [NOW$3]
19161
19778
  }),
19162
19779
  numeric({
19163
19780
  id: "energy",
@@ -19168,7 +19785,7 @@ var GROUP_TEMPLATES = [
19168
19785
  quantity: "energy",
19169
19786
  defaultAggregate: "sum",
19170
19787
  empty: "omit",
19171
- companions: [NOW$2]
19788
+ companions: [NOW$3]
19172
19789
  }),
19173
19790
  numeric({
19174
19791
  id: "battery",
@@ -19203,7 +19820,7 @@ var GROUP_TEMPLATES = [
19203
19820
  quantity: "device",
19204
19821
  defaultAggregate: "mean",
19205
19822
  empty: "null",
19206
- companions: [NOW$2]
19823
+ companions: [NOW$3]
19207
19824
  }),
19208
19825
  binary({
19209
19826
  id: "motion",
@@ -21549,6 +22166,36 @@ var ExposeInputSchema = object({
21549
22166
  capabilities: array(string()).optional()
21550
22167
  });
21551
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 });
21552
22199
  var deviceExportCapability = {
21553
22200
  name: "device-export",
21554
22201
  scope: "system",
@@ -21578,6 +22225,16 @@ var deviceExportCapability = {
21578
22225
  unexposeDevice: method(UnexposeInputSchema, _void(), {
21579
22226
  kind: "mutation",
21580
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"
21581
22238
  })
21582
22239
  }
21583
22240
  };
@@ -42720,6 +43377,14 @@ method(object({
42720
43377
  kind: "mutation",
42721
43378
  auth: "admin"
42722
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
+ });
42723
43388
  /**
42724
43389
  * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
42725
43390
  * so it can delete what it keeps for that device (D865).
@@ -43440,7 +44105,7 @@ var LlmProviderWidgetSchema = object({
43440
44105
  /** ConfigUISchema tree passed through untyped on the wire (the
43441
44106
  * notification-output `ConfigSchemaPassthrough` precedent at
43442
44107
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
43443
- var ConfigSchemaPassthrough$3 = unknown();
44108
+ var ConfigSchemaPassthrough$2 = unknown();
43444
44109
  var LlmProfileKindDescriptorSchema = object({
43445
44110
  kind: LlmProfileKindSchema,
43446
44111
  label: string(),
@@ -43449,9 +44114,9 @@ var LlmProfileKindDescriptorSchema = object({
43449
44114
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
43450
44115
  addonId: string(),
43451
44116
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
43452
- connectionSchema: ConfigSchemaPassthrough$3,
44117
+ connectionSchema: ConfigSchemaPassthrough$2,
43453
44118
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
43454
- advancedSchema: ConfigSchemaPassthrough$3.optional(),
44119
+ advancedSchema: ConfigSchemaPassthrough$2.optional(),
43455
44120
  /** The kind's defaults; a model from `listModels` may override any of them. */
43456
44121
  features: LlmModelFeaturesSchema,
43457
44122
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -43977,10 +44642,10 @@ var CpuBreakdownSchema = object({
43977
44642
  cores: number()
43978
44643
  });
43979
44644
  var MemoryInfoSchema = object({
43980
- percent: number(),
44645
+ percent: number().nullable(),
43981
44646
  totalBytes: number(),
43982
- usedBytes: number(),
43983
- availableBytes: number(),
44647
+ usedBytes: number().nullable(),
44648
+ availableBytes: number().nullable(),
43984
44649
  swapUsedBytes: number(),
43985
44650
  swapTotalBytes: number()
43986
44651
  });
@@ -44284,8 +44949,9 @@ var GetLoadSeriesInputSchema = object({
44284
44949
  });
44285
44950
  var SystemMetricsSchema = object({
44286
44951
  cpuPercent: number(),
44287
- memoryPercent: number(),
44288
- memoryUsedMB: number(),
44952
+ /** `null` when the memory sample failed or was not taken yet (D393). */
44953
+ memoryPercent: number().nullable(),
44954
+ memoryUsedMB: number().nullable(),
44289
44955
  memoryTotalMB: number(),
44290
44956
  diskPercent: number().optional(),
44291
44957
  temperature: number().optional(),
@@ -44521,427 +45187,6 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
44521
45187
  sourcePort: number().optional()
44522
45188
  });
44523
45189
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
44524
- /**
44525
- * notification-output — canonical, capability-gated notification delivery.
44526
- *
44527
- * Apprise-derived model (see
44528
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44529
- * callers emit ONE canonical `Notification`; each provider declares a
44530
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44531
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44532
- * message to what the kind supports — callers never special-case a service.
44533
- *
44534
- * DESIGN DECISIONS (locked):
44535
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44536
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44537
- * cap. Rationale: the admin UI needs one uniform surface across the
44538
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44539
- * alternative would fork the UI per addon and cannot host the
44540
- * discovery→adopt flow.
44541
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44542
- * the generated cap-mount auto-`concatCollection`-fans them across every
44543
- * registered provider (notifiers addon + HA addon) so one catalog is
44544
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44545
- * `addonId` the generated collection router extracts from the call input.
44546
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44547
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44548
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44549
- * base64 fallback needed.
44550
- *
44551
- * TODO (deferred, closed-set change — separate decision): add
44552
- * `providerKind: 'notify'` so notification providers surface on the unified
44553
- * admin "Integrations" page.
44554
- */
44555
- /**
44556
- * Zentik-derived typed-media enum — the superset across every kind. Each
44557
- * adapter picks what it supports and the degrade engine filters the rest.
44558
- */
44559
- var AttachmentMediaTypeSchema = _enum([
44560
- "image",
44561
- "video",
44562
- "gif",
44563
- "audio",
44564
- "icon"
44565
- ]);
44566
- /**
44567
- * A single attachment. Exactly one of `url` (remote source, most adapters
44568
- * prefer this) or `bytes` (inline source; required for Pushover-style
44569
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44570
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44571
- */
44572
- var AttachmentSchema = object({
44573
- mediaType: AttachmentMediaTypeSchema,
44574
- url: string().optional(),
44575
- bytes: _instanceof(Uint8Array).optional(),
44576
- mime: string().optional(),
44577
- name: string().optional()
44578
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44579
- var NotificationFormatSchema = _enum([
44580
- "text",
44581
- "markdown",
44582
- "html"
44583
- ]);
44584
- /**
44585
- * The CLOSED icon vocabulary an action button may use.
44586
- *
44587
- * A closed set, not a free string, and that is the whole point: an arbitrary
44588
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44589
- * notices — the same class of gap as a zone vocabulary nothing produced
44590
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44591
- * declares `actionIcons: false` and the degrade engine strips the field.
44592
- *
44593
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44594
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44595
- * differently.
44596
- *
44597
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44598
- *
44599
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44600
- * the whole set onto its own renderer's vocabulary through a
44601
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44602
- * fallback, so adding a member here fails every adapter's build until someone
44603
- * decides its glyph, which is the only place that decision can be made
44604
- * honestly.
44605
- *
44606
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44607
- * `disarm` straight through; iOS feeds that string to
44608
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44609
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44610
- * mapping, and "the field is documented" is not "the value renders".
44611
- *
44612
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44613
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44614
- * so an addon that emits a token the running hub does not know does not lose an
44615
- * icon — its whole `send` fails Zod validation and the notification never
44616
- * arrives. Never emit a new token from an addon before the train carrying it.
44617
- */
44618
- var NotificationActionIconSchema = _enum([
44619
- "acknowledge",
44620
- "dismiss",
44621
- "silence",
44622
- "snooze",
44623
- "view",
44624
- "play",
44625
- "open",
44626
- "close",
44627
- "lock",
44628
- "unlock",
44629
- "arm",
44630
- "arm-home",
44631
- "arm-away",
44632
- "arm-night",
44633
- "disarm",
44634
- "light",
44635
- "alert",
44636
- "camera"
44637
- ]);
44638
- /** A single tap-through action button. */
44639
- var NotificationActionSchema = object({
44640
- id: string(),
44641
- label: string(),
44642
- url: string().optional(),
44643
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44644
- icon: NotificationActionIconSchema.optional(),
44645
- /**
44646
- * Renders in a warning style where the notifier supports it.
44647
- *
44648
- * A HINT, never a gate. The callback's authority is its token and nothing
44649
- * else — see `notification-center/action-token.ts` for what that does and
44650
- * does not buy.
44651
- */
44652
- destructive: boolean().optional(),
44653
- /**
44654
- * How the tap should REACH the url.
44655
- *
44656
- * `navigate` (absent, and every button authored before this field) opens it:
44657
- * the phone leaves the notification and shows whatever the callback returns.
44658
- * That is right for a button whose answer the operator wants to read.
44659
- *
44660
- * `background` fires it as a POST and stays put. It exists for the buttons
44661
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44662
- * an answer to the notification, and being thrown into a browser tab to
44663
- * confirm it costs more attention than the notification did. A backend that
44664
- * cannot do a background call renders it as an ordinary link (the adapters
44665
- * fall back rather than dropping the button), so this is a preference, never
44666
- * a requirement.
44667
- */
44668
- mode: _enum(["navigate", "background"]).optional()
44669
- });
44670
- /** A delivery parameter value: what a notifier declared it takes. */
44671
- var DeliveryParamValueSchema = union([
44672
- string(),
44673
- number(),
44674
- boolean()
44675
- ]);
44676
- /**
44677
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44678
- * addresses a target of that kind may set it; a kind that declares nothing is
44679
- * never handed one. The admin UI derives its control from this descriptor —
44680
- * no editor knows a service by name.
44681
- *
44682
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44683
- * run on the addon cap path).
44684
- */
44685
- var DeliveryParamSchema = object({
44686
- key: string().min(1),
44687
- label: string(),
44688
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44689
- labelKey: string().optional(),
44690
- type: _enum([
44691
- "enum",
44692
- "number",
44693
- "boolean",
44694
- "string"
44695
- ]),
44696
- /** `enum` only: the closed set of accepted values. */
44697
- options: array(object({
44698
- value: string(),
44699
- label: string()
44700
- })).optional(),
44701
- /** `number` only. */
44702
- min: number().optional(),
44703
- max: number().optional(),
44704
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44705
- default: DeliveryParamValueSchema.optional()
44706
- });
44707
- /**
44708
- * The canonical notification. `body` is the only hard field (Apprise model).
44709
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44710
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44711
- * the adapter maps this ordinal onto its native level. `level?` is an
44712
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44713
- * `priority` for that one target.
44714
- */
44715
- var NotificationSchema = object({
44716
- body: string(),
44717
- title: string().optional(),
44718
- format: NotificationFormatSchema.default("text"),
44719
- priority: number().int().min(1).max(5).default(3),
44720
- level: string().optional(),
44721
- attachments: array(AttachmentSchema).optional(),
44722
- clickUrl: string().optional(),
44723
- actions: array(NotificationActionSchema).optional(),
44724
- sound: string().optional(),
44725
- ttl: number().optional(),
44726
- tag: string().optional(),
44727
- deviceId: number().optional(),
44728
- eventId: string().optional(),
44729
- metadata: record(string(), unknown()).optional(),
44730
- /**
44731
- * Values for the parameters the target's kind DECLARES in
44732
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44733
- * declaration by the sender; a notifier reads only the keys it declared.
44734
- */
44735
- delivery: record(string(), DeliveryParamValueSchema).optional()
44736
- });
44737
- /** One declared native severity/priority level for a kind. */
44738
- var TargetKindLevelSchema = object({
44739
- id: string(),
44740
- label: string(),
44741
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44742
- ordinal: number().int().min(1).max(5).nullable(),
44743
- flags: object({
44744
- critical: boolean().optional(),
44745
- silent: boolean().optional(),
44746
- noPush: boolean().optional()
44747
- }).optional(),
44748
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44749
- requires: array(string()).optional(),
44750
- description: string().optional()
44751
- });
44752
- /** The full capability block consulted before dispatch. */
44753
- var TargetKindCapsSchema = object({
44754
- attachments: object({
44755
- mediaTypes: array(AttachmentMediaTypeSchema),
44756
- mode: _enum([
44757
- "url",
44758
- "bytes",
44759
- "both"
44760
- ]),
44761
- max: number().int().nonnegative(),
44762
- maxBytes: number().int().positive().optional()
44763
- }),
44764
- /** Max action buttons (0 = none). */
44765
- actions: number().int().nonnegative(),
44766
- /**
44767
- * Whether this kind renders a per-action ICON.
44768
- *
44769
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44770
- * run on the addon cap path — three production failures in one day taught
44771
- * this repo that once. Absent is read as false by the degrade engine, which
44772
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44773
- * assumed and dropped costs the operator's trust in the field.
44774
- */
44775
- actionIcons: boolean().optional(),
44776
- levels: array(TargetKindLevelSchema),
44777
- format: array(NotificationFormatSchema),
44778
- clickUrl: boolean(),
44779
- sound: boolean(),
44780
- ttl: boolean(),
44781
- bodyMaxLen: number().int().positive()
44782
- });
44783
- /**
44784
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44785
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44786
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44787
- * the union is large and not meant for runtime validation here; the exported
44788
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44789
- */
44790
- var ConfigSchemaPassthrough$2 = unknown();
44791
- var TargetKindSchema = object({
44792
- kind: string(),
44793
- label: string(),
44794
- icon: string(),
44795
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44796
- addonId: string(),
44797
- /**
44798
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44799
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44800
- * when the addon bundles no icon for that kind — the client then falls back
44801
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44802
- *
44803
- * Root-relative on purpose: it resolves against whatever origin serves a web
44804
- * client, and a native client joins it onto its own hub base.
44805
- *
44806
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44807
- * field that survived only because the runtime cap-router forwards provider
44808
- * output verbatim — so every consumer had to re-declare it by hand to stop
44809
- * its own Zod parse from stripping it, and the whole arrangement would have
44810
- * broken silently the moment output validation was tightened anywhere.
44811
- */
44812
- iconUrl: string().optional(),
44813
- /**
44814
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44815
- *
44816
- * The server knows this and therefore says it, because the client cannot
44817
- * safely guess: a React-Native client renders SVG and raster through two
44818
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44819
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44820
- * placeholder glyph for every vector icon while the web build looked fine.
44821
- *
44822
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44823
- * not been updated — a client that cannot determine the type should prefer
44824
- * its raster path, which is the safe default for an unknown image.
44825
- */
44826
- iconMediaType: string().optional(),
44827
- configSchema: ConfigSchemaPassthrough$2,
44828
- /**
44829
- * The config keys that decide WHERE this kind's secrets are sent (server,
44830
- * base URL, instance, chat, recipient). A save that changes any of them
44831
- * while leaving a secret redacted is refused by the provider (D634), so an
44832
- * editor uses this to ask for the secret on exactly those edits instead of
44833
- * on every edit.
44834
- *
44835
- * Optional: absent from a provider that holds no secret (the Home Assistant
44836
- * kinds) and from a provider older than this field — an editor that finds
44837
- * it absent must assume ANY edit may need the secret.
44838
- */
44839
- destinationKeys: array(string()).optional(),
44840
- supportsDiscovery: boolean(),
44841
- /**
44842
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44843
- * Absent = none; the rule editor then offers nothing.
44844
- */
44845
- deliveryParams: array(DeliveryParamSchema).optional(),
44846
- caps: TargetKindCapsSchema
44847
- });
44848
- /**
44849
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44850
- * (return a presence marker only) when serving `listTargets` — never
44851
- * round-trip a stored secret to the UI.
44852
- */
44853
- var TargetSchema = object({
44854
- id: string(),
44855
- name: string(),
44856
- kind: string(),
44857
- addonId: string(),
44858
- enabled: boolean(),
44859
- config: record(string(), unknown())
44860
- });
44861
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44862
- var DiscoveredTargetSchema = object({
44863
- kind: string(),
44864
- suggestedName: string(),
44865
- config: record(string(), unknown())
44866
- });
44867
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44868
- var RenderedAsSchema = object({
44869
- level: string(),
44870
- format: NotificationFormatSchema,
44871
- attachmentsSent: number().int().nonnegative(),
44872
- actionsSent: number().int().nonnegative(),
44873
- truncated: boolean(),
44874
- dropped: array(string())
44875
- });
44876
- var SendResultSchema = object({
44877
- success: boolean(),
44878
- error: string().optional(),
44879
- renderedAs: RenderedAsSchema.optional()
44880
- });
44881
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44882
- var TestResultSchema = SendResultSchema;
44883
- /**
44884
- * Pre-save credential probe against a partial (unsaved) target config.
44885
- * `resolvedUrl` never includes secrets (token stripped from path).
44886
- */
44887
- var ProbeTargetConfigResultSchema = object({
44888
- ok: boolean(),
44889
- resolvedUrl: string(),
44890
- httpStatus: number().int().optional(),
44891
- stateInstance: string().optional(),
44892
- error: string().optional()
44893
- });
44894
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44895
- kind: string(),
44896
- config: record(string(), unknown()).optional(),
44897
- /**
44898
- * When editing / duplicating, the blank password field never round-trips
44899
- * the stored token. Pass the source target id so the provider can restore
44900
- * secrets server-side before dialling (same merge as upsert).
44901
- */
44902
- targetId: string().optional()
44903
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44904
- kind: string(),
44905
- config: record(string(), unknown()),
44906
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44907
- targetId: string().optional()
44908
- }), ProbeTargetConfigResultSchema, {
44909
- kind: "mutation",
44910
- auth: "admin"
44911
- }), method(object({
44912
- targetId: string(),
44913
- notification: NotificationSchema
44914
- }), SendResultSchema, {
44915
- kind: "mutation",
44916
- auth: "admin"
44917
- }), method(object({
44918
- targetId: string(),
44919
- sample: NotificationSchema.optional()
44920
- }), TestResultSchema, {
44921
- kind: "mutation",
44922
- auth: "admin"
44923
- }), method(object({
44924
- target: TargetSchema,
44925
- /**
44926
- * Duplicate flow: create a NEW target id while copying secrets from an
44927
- * existing row. The UI never holds the stored token; blank / redacted
44928
- * password fields are restored from this source (D634 still applies if
44929
- * destinations diverge without a re-typed secret).
44930
- */
44931
- cloneSecretsFrom: string().optional()
44932
- }), TargetSchema, {
44933
- kind: "mutation",
44934
- auth: "admin"
44935
- }), method(object({ targetId: string() }), _void(), {
44936
- kind: "mutation",
44937
- auth: "admin"
44938
- }), method(object({
44939
- targetId: string(),
44940
- enabled: boolean()
44941
- }), _void(), {
44942
- kind: "mutation",
44943
- auth: "admin"
44944
- });
44945
45190
  var AUDIO_MACRO_LABELS = [
44946
45191
  {
44947
45192
  id: "speech",
@@ -51358,14 +51603,6 @@ var EngineProvisioningSchema = object({
51358
51603
  */
51359
51604
  configIssues: array(string()).optional()
51360
51605
  });
51361
- var PipelineStepInputSchema = lazy(() => object({
51362
- addonId: string(),
51363
- modelId: string().optional(),
51364
- enabled: boolean().default(true),
51365
- children: array(PipelineStepInputSchema).optional(),
51366
- settings: record(string(), unknown()).optional(),
51367
- jumpDeviceKey: string().optional()
51368
- }));
51369
51606
  var ModelSubstitutionSchema = object({
51370
51607
  addonId: string(),
51371
51608
  chosen: string(),
@@ -51444,7 +51681,6 @@ var ConfigUISchemaBridge = custom();
51444
51681
  var ConfigUISchemaNullableBridge = custom();
51445
51682
  var InferenceCapabilitiesBridge = custom();
51446
51683
  var ModelAvailabilityListBridge = custom();
51447
- var PipelineRunResultBridge = custom();
51448
51684
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
51449
51685
  modelId: string(),
51450
51686
  settings: record(string(), unknown()).readonly()
@@ -59142,7 +59378,7 @@ object({
59142
59378
  /** Ms epoch of the last value received from the appliance; 0 = never. */
59143
59379
  lastFetchedAt: number()
59144
59380
  });
59145
- var DeviceIdSchema = number().int().nonnegative();
59381
+ var DeviceIdSchema$1 = number().int().nonnegative();
59146
59382
  /** A value a program option or setting can take. */
59147
59383
  var DishwasherValueSchema = union([
59148
59384
  boolean(),
@@ -59206,77 +59442,77 @@ var DishwasherOptionsSchema = object({
59206
59442
  options: array(DishwasherOptionDescriptorSchema)
59207
59443
  });
59208
59444
  DeviceType.Dishwasher, method(object({
59209
- deviceId: DeviceIdSchema,
59445
+ deviceId: DeviceIdSchema$1,
59210
59446
  program: string().min(1).optional(),
59211
59447
  options: record(string(), DishwasherValueSchema).optional()
59212
59448
  }), _void(), {
59213
59449
  kind: "mutation",
59214
59450
  auth: "protected"
59215
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59451
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59216
59452
  kind: "mutation",
59217
59453
  auth: "protected"
59218
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59454
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59219
59455
  kind: "mutation",
59220
59456
  auth: "protected"
59221
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59457
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59222
59458
  kind: "mutation",
59223
59459
  auth: "protected"
59224
59460
  }), method(object({
59225
- deviceId: DeviceIdSchema,
59461
+ deviceId: DeviceIdSchema$1,
59226
59462
  program: string().min(1)
59227
59463
  }), _void(), {
59228
59464
  kind: "mutation",
59229
59465
  auth: "protected"
59230
59466
  }), method(object({
59231
- deviceId: DeviceIdSchema,
59467
+ deviceId: DeviceIdSchema$1,
59232
59468
  on: boolean()
59233
59469
  }), _void(), {
59234
59470
  kind: "mutation",
59235
59471
  auth: "protected"
59236
59472
  }), method(object({
59237
- deviceId: DeviceIdSchema,
59473
+ deviceId: DeviceIdSchema$1,
59238
59474
  on: boolean()
59239
59475
  }), _void(), {
59240
59476
  kind: "mutation",
59241
59477
  auth: "protected"
59242
59478
  }), method(object({
59243
- deviceId: DeviceIdSchema,
59479
+ deviceId: DeviceIdSchema$1,
59244
59480
  on: boolean()
59245
59481
  }), _void(), {
59246
59482
  kind: "mutation",
59247
59483
  auth: "protected"
59248
59484
  }), method(object({
59249
- deviceId: DeviceIdSchema,
59485
+ deviceId: DeviceIdSchema$1,
59250
59486
  on: boolean()
59251
59487
  }), _void(), {
59252
59488
  kind: "mutation",
59253
59489
  auth: "protected"
59254
59490
  }), method(object({
59255
- deviceId: DeviceIdSchema,
59491
+ deviceId: DeviceIdSchema$1,
59256
59492
  on: boolean()
59257
59493
  }), _void(), {
59258
59494
  kind: "mutation",
59259
59495
  auth: "protected"
59260
59496
  }), method(object({
59261
- deviceId: DeviceIdSchema,
59497
+ deviceId: DeviceIdSchema$1,
59262
59498
  on: boolean()
59263
59499
  }), _void(), {
59264
59500
  kind: "mutation",
59265
59501
  auth: "protected"
59266
59502
  }), method(object({
59267
- deviceId: DeviceIdSchema,
59503
+ deviceId: DeviceIdSchema$1,
59268
59504
  on: boolean()
59269
59505
  }), _void(), {
59270
59506
  kind: "mutation",
59271
59507
  auth: "protected"
59272
59508
  }), method(object({
59273
- deviceId: DeviceIdSchema,
59509
+ deviceId: DeviceIdSchema$1,
59274
59510
  key: string().min(1),
59275
59511
  value: DishwasherValueSchema
59276
59512
  }), _void(), {
59277
59513
  kind: "mutation",
59278
59514
  auth: "protected"
59279
- }), method(object({ deviceId: DeviceIdSchema }), DishwasherOptionsSchema, { auth: "protected" });
59515
+ }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
59280
59516
  DeviceType.Camera;
59281
59517
  object({
59282
59518
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -61722,7 +61958,8 @@ var TopologyNodeSchema = object({
61722
61958
  isHub: boolean(),
61723
61959
  isOnline: boolean(),
61724
61960
  cpuPercent: number(),
61725
- memoryPercent: number(),
61961
+ /** `null` when the node's memory read failed or it has not reported one (D393). */
61962
+ memoryPercent: number().nullable(),
61726
61963
  uptime: number(),
61727
61964
  lastSeen: string(),
61728
61965
  localIps: array(string()).readonly(),
@@ -62257,9 +62494,10 @@ object({
62257
62494
  * combined reading; per-hopper levels live in `food1`/`food2`. Null when
62258
62495
  * the device has not reported yet. */
62259
62496
  foodLevel: number().nullable().meta(readingMeta("none")),
62260
- /** Food in the BOWL as the feeder reports it (`state.bowl`), in the
62261
- * feeder's own units. Null when the model reports none. */
62262
- 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")),
62263
62501
  /** True while the pet is eating (`state.eating`). */
62264
62502
  eating: boolean(),
62265
62503
  /** Whether `markFoodReplenished` does anything on this model. When false
@@ -62372,6 +62610,64 @@ DeviceType.PetFeeder, method(object({
62372
62610
  kind: "mutation",
62373
62611
  auth: "protected"
62374
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
+ });
62375
62671
  var VehicleSchema = object({
62376
62672
  id: string(),
62377
62673
  name: string(),
@@ -66988,7 +67284,7 @@ discriminatedUnion("kind", [object({
66988
67284
  })]);
66989
67285
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
66990
67286
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
66991
- 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.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;
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;
66992
67288
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
66993
67289
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
66994
67290
  new Set(CAP_NAMES);
@@ -67041,7 +67337,7 @@ var AccessoryKind = {
67041
67337
  PrivacyMask: DeviceRole.PrivacyMask
67042
67338
  };
67043
67339
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
67044
- 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;
67045
67341
  new Set(Object.values(DeviceType));
67046
67342
  Object.freeze({
67047
67343
  "accessories.getStatus": {
@@ -68976,6 +69272,13 @@ Object.freeze({
68976
69272
  access: "create",
68977
69273
  role: "admin"
68978
69274
  },
69275
+ "deviceExport.exposeEntity": {
69276
+ capName: "device-export",
69277
+ capScope: "system",
69278
+ addonId: null,
69279
+ access: "create",
69280
+ role: "admin"
69281
+ },
68979
69282
  "deviceExport.getDeviceLiveContribution": {
68980
69283
  capName: "device-export",
68981
69284
  capScope: "system",
@@ -69004,6 +69307,13 @@ Object.freeze({
69004
69307
  access: "view",
69005
69308
  role: "admin"
69006
69309
  },
69310
+ "deviceExport.listExposedEntities": {
69311
+ capName: "device-export",
69312
+ capScope: "system",
69313
+ addonId: null,
69314
+ access: "view",
69315
+ role: "admin"
69316
+ },
69007
69317
  "deviceExport.listSupportedDeviceKinds": {
69008
69318
  capName: "device-export",
69009
69319
  capScope: "system",
@@ -69011,6 +69321,13 @@ Object.freeze({
69011
69321
  access: "view",
69012
69322
  role: "admin"
69013
69323
  },
69324
+ "deviceExport.listSupportedEntityKinds": {
69325
+ capName: "device-export",
69326
+ capScope: "system",
69327
+ addonId: null,
69328
+ access: "view",
69329
+ role: "admin"
69330
+ },
69014
69331
  "deviceExport.unexposeDevice": {
69015
69332
  capName: "device-export",
69016
69333
  capScope: "system",
@@ -69018,6 +69335,13 @@ Object.freeze({
69018
69335
  access: "create",
69019
69336
  role: "admin"
69020
69337
  },
69338
+ "deviceExport.unexposeEntity": {
69339
+ capName: "device-export",
69340
+ capScope: "system",
69341
+ addonId: null,
69342
+ access: "create",
69343
+ role: "admin"
69344
+ },
69021
69345
  "deviceExtension.listCandidates": {
69022
69346
  capName: "device-extension",
69023
69347
  capScope: "device",
@@ -71839,6 +72163,13 @@ Object.freeze({
71839
72163
  access: "create",
71840
72164
  role: "admin"
71841
72165
  },
72166
+ "nodeRemovalHook.onNodeRemoved": {
72167
+ capName: "node-removal-hook",
72168
+ capScope: "system",
72169
+ addonId: null,
72170
+ access: "create",
72171
+ role: "admin"
72172
+ },
71842
72173
  "nodes.clusterAddonStatus": {
71843
72174
  capName: "nodes",
71844
72175
  capScope: "system",
@@ -72476,6 +72807,48 @@ Object.freeze({
72476
72807
  access: "create",
72477
72808
  role: "viewer"
72478
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
+ },
72479
72852
  "pipelineAnalytics.addRetrainFrameFromRecording": {
72480
72853
  capName: "pipeline-analytics",
72481
72854
  capScope: "device",
@@ -78958,6 +79331,100 @@ var APPLIANCE_CAP_VOCABULARY = {
78958
79331
  }
78959
79332
  ]
78960
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
+ },
78961
79428
  "media-player": {
78962
79429
  scope: "device",
78963
79430
  noun: t("Media player", "Lettore multimediale"),
@@ -80782,6 +81249,7 @@ var SYSTEM_CAP_VOCABULARY = {
80782
81249
  "device-manager": system("the device registry itself — rename, move and remove are administration"),
80783
81250
  "device-provider": system(INTERNAL),
80784
81251
  "device-removal-hook": system(INTERNAL),
81252
+ "node-removal-hook": system(INTERNAL),
80785
81253
  "device-state": system("the runtime-state mirror every trigger already reads through"),
80786
81254
  "display-palette": system("the cluster display palette — one colour table for every client, not a device action"),
80787
81255
  "embedding-encoder": system(ML),
@@ -80894,7 +81362,7 @@ function projectAction(cap, action) {
80894
81362
  };
80895
81363
  }
80896
81364
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
80897
- 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;
80898
81366
  DeviceFeature.BatteryOperated;
80899
81367
  /**
80900
81368
  * How a washer, dryer or dishwasher leaves CamStack.
@@ -82470,6 +82938,36 @@ Object.freeze({
82470
82938
  form: "single",
82471
82939
  optional: false
82472
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
+ }],
82473
82971
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
82474
82972
  name: "deviceId",
82475
82973
  form: "single",
@@ -85414,7 +85912,7 @@ async function releaseAlexaEgress(input) {
85414
85912
  tags: { deviceId },
85415
85913
  meta: {
85416
85914
  pipelineKey,
85417
- error: errMsg(err)
85915
+ error: errMsg$1(err)
85418
85916
  }
85419
85917
  });
85420
85918
  }
@@ -85468,7 +85966,7 @@ async function profileForCamStream(input) {
85468
85966
  } catch (err) {
85469
85967
  input.logger?.warn("alexa rtc-session: could not read the profile slots", {
85470
85968
  tags: { deviceId: input.deviceId },
85471
- meta: { error: errMsg(err) }
85969
+ meta: { error: errMsg$1(err) }
85472
85970
  });
85473
85971
  return null;
85474
85972
  }
@@ -87540,7 +88038,7 @@ async function pollUntilReached(plan, deps, untilMs) {
87540
88038
  const read = await plan.read().catch((err) => {
87541
88039
  deps.logger.debug("alexa deferred directive: read-back failed — polling on", {
87542
88040
  tags: { deviceId: plan.deviceId },
87543
- meta: { error: errMsg(err) }
88041
+ meta: { error: errMsg$1(err) }
87544
88042
  });
87545
88043
  return null;
87546
88044
  });
@@ -87588,7 +88086,7 @@ async function runWithDeferral(plan, deps) {
87588
88086
  try {
87589
88087
  await plan.command();
87590
88088
  } catch (err) {
87591
- const message = errMsg(err);
88089
+ const message = errMsg$1(err);
87592
88090
  deps.logger.warn(`alexa deferred directive: ${plan.header.name} command failed`, {
87593
88091
  tags: { deviceId: plan.deviceId },
87594
88092
  meta: { error: message }
@@ -87606,7 +88104,7 @@ async function runWithDeferral(plan, deps) {
87606
88104
  const settled = settleInBackground(plan, deps).catch((err) => {
87607
88105
  deps.logger.warn("alexa deferred directive: settling failed", {
87608
88106
  tags: { deviceId: plan.deviceId },
87609
- meta: { error: errMsg(err) }
88107
+ meta: { error: errMsg$1(err) }
87610
88108
  });
87611
88109
  });
87612
88110
  return {
@@ -89354,13 +89852,13 @@ var AlexaAccessGate = class {
89354
89852
  if (!this.warnedStale) {
89355
89853
  this.warnedStale = true;
89356
89854
  this.deps.logger.warn("alexa access: the hub user store could not be re-read — keeping the last good grants", { meta: {
89357
- error: errMsg(err),
89855
+ error: errMsg$1(err),
89358
89856
  ageMs: this.now() - cached.at
89359
89857
  } });
89360
89858
  }
89361
89859
  return cached;
89362
89860
  }
89363
- 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) } });
89364
89862
  return null;
89365
89863
  }
89366
89864
  }
@@ -89377,7 +89875,7 @@ var AlexaAccessGate = class {
89377
89875
  } catch (err) {
89378
89876
  this.deps.logger.debug("alexa access: device metadata read failed", {
89379
89877
  tags: { deviceId },
89380
- meta: { error: errMsg(err) }
89878
+ meta: { error: errMsg$1(err) }
89381
89879
  });
89382
89880
  return cached?.meta ?? null;
89383
89881
  }
@@ -89412,12 +89910,209 @@ async function readConnectivity(api, deviceId, logger) {
89412
89910
  } catch (err) {
89413
89911
  logger.debug("alexa: device-status unreadable — reporting connectivity OK", {
89414
89912
  tags: { deviceId },
89415
- meta: { error: errMsg(err) }
89913
+ meta: { error: errMsg$1(err) }
89416
89914
  });
89417
89915
  return "OK";
89418
89916
  }
89419
89917
  }
89420
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
89421
90116
  //#region src/endpoints/validate-instanced.ts
89422
90117
  /**
89423
90118
  * Amazon's rules for the INSTANCED interfaces' extra fields (D869), the ones a
@@ -89641,7 +90336,8 @@ var ALLOWED_INTERFACE_VERSIONS = {
89641
90336
  "Alexa.ThermostatController": "3.1",
89642
90337
  "Alexa.SmartVision.SnapshotProvider": "1.1",
89643
90338
  "Alexa.SmartVision.ObjectDetectionSensor": "1.0",
89644
- "Alexa.DataController": "1.0"
90339
+ "Alexa.DataController": "1.0",
90340
+ "Alexa.SceneController": "3"
89645
90341
  };
89646
90342
  /** `imageNetClass` values Amazon accepts (alexa-smartvision-objectdetectionsensor). */
89647
90343
  var SMART_VISION_CLASSES = new Set(["person", "package"]);
@@ -89683,6 +90379,7 @@ var DISPLAY_CATEGORIES = new Set([
89683
90379
  "DOOR",
89684
90380
  "GATE",
89685
90381
  "GARAGE_DOOR",
90382
+ "SCENE_TRIGGER",
89686
90383
  "OTHER"
89687
90384
  ]);
89688
90385
  var ENDPOINT_ID_PATTERN = /^[A-Za-z0-9 _\-=#;:?@&]{1,256}$/;
@@ -91578,6 +92275,7 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
91578
92275
  "Alexa.DataController/DeleteData": "view",
91579
92276
  "Alexa.LockController/Lock": "create",
91580
92277
  "Alexa.LockController/Unlock": "create",
92278
+ "Alexa.SceneController/Activate": "create",
91581
92279
  ...Object.fromEntries(GENERIC_DIRECTIVE_KEYS.map((k) => [k, "create"]))
91582
92280
  };
91583
92281
  try {
@@ -91609,6 +92307,17 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
91609
92307
  body: errorEnvelope(header, "INTERNAL_ERROR", lookup.error)
91610
92308
  };
91611
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
+ }
91612
92321
  if (key !== "Alexa.Discovery/Discover") {
91613
92322
  if (endpoint === void 0) return {
91614
92323
  status: 200,
@@ -91661,7 +92370,8 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
91661
92370
  reason: describeRefusal(r.refusal)
91662
92371
  }))
91663
92372
  } });
91664
- const valid = withholdInvalidEndpoints(filtered.kept, (message, violations) => {
92373
+ const scenes = deps.actionScenes?.exports.endpointsFor(who) ?? [];
92374
+ const valid = withholdInvalidEndpoints([...filtered.kept, ...scenes], (message, violations) => {
91665
92375
  deps.discovery.logger.warn(message, { meta: {
91666
92376
  userId: callerIdentity.userId,
91667
92377
  violations
@@ -93934,7 +94644,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93934
94644
  tags: { deviceId },
93935
94645
  meta: {
93936
94646
  userId: change.userId,
93937
- error: errMsg(err)
94647
+ error: errMsg$1(err)
93938
94648
  }
93939
94649
  });
93940
94650
  return false;
@@ -93953,7 +94663,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93953
94663
  tags: { deviceId },
93954
94664
  meta: {
93955
94665
  userId: change.userId,
93956
- error: errMsg(err)
94666
+ error: errMsg$1(err)
93957
94667
  }
93958
94668
  });
93959
94669
  return false;
@@ -94007,7 +94717,7 @@ var DetectionClassSource = class {
94007
94717
  } catch (err) {
94008
94718
  this.deps.logger.debug("alexa detection sensors: class read failed — keeping the last answer", {
94009
94719
  tags: { deviceId },
94010
- meta: { error: errMsg(err) }
94720
+ meta: { error: errMsg$1(err) }
94011
94721
  });
94012
94722
  return prev?.classes ?? [];
94013
94723
  }
@@ -94100,7 +94810,7 @@ var DetectionSensorFeed = class {
94100
94810
  } catch (err) {
94101
94811
  this.deps.logger.debug("alexa detection sensors: active-track read failed — kept as is", {
94102
94812
  tags: { deviceId },
94103
- meta: { error: errMsg(err) }
94813
+ meta: { error: errMsg$1(err) }
94104
94814
  });
94105
94815
  }
94106
94816
  }
@@ -94112,7 +94822,7 @@ var DetectionSensorFeed = class {
94112
94822
  meta: {
94113
94823
  detectionClass: cls,
94114
94824
  present,
94115
- error: errMsg(err)
94825
+ error: errMsg$1(err)
94116
94826
  }
94117
94827
  });
94118
94828
  });
@@ -94231,7 +94941,7 @@ var ObjectDetectionFeed = class {
94231
94941
  tags: { deviceId: parsed.data.deviceId },
94232
94942
  meta: {
94233
94943
  trackId: parsed.data.trackId,
94234
- error: errMsg(err)
94944
+ error: errMsg$1(err)
94235
94945
  }
94236
94946
  });
94237
94947
  });
@@ -94421,7 +95131,7 @@ var AlexaVisionRuntime = class {
94421
95131
  } catch (err) {
94422
95132
  this.deps.logger.debug("alexa: per-device settings unreadable — using defaults", {
94423
95133
  tags: { deviceId },
94424
- meta: { error: errMsg(err) }
95134
+ meta: { error: errMsg$1(err) }
94425
95135
  });
94426
95136
  return {};
94427
95137
  }
@@ -94519,7 +95229,7 @@ var AlexaVisionRuntime = class {
94519
95229
  tags: { deviceId },
94520
95230
  meta: {
94521
95231
  trackId,
94522
- error: errMsg(err)
95232
+ error: errMsg$1(err)
94523
95233
  }
94524
95234
  });
94525
95235
  return null;
@@ -95189,7 +95899,7 @@ var StateChangeReporter = class {
95189
95899
  shaper;
95190
95900
  constructor(deps) {
95191
95901
  this.deps = deps;
95192
- 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);
95193
95903
  }
95194
95904
  start() {
95195
95905
  this.off = this.deps.eventBus.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
@@ -95226,7 +95936,7 @@ var StateChangeReporter = class {
95226
95936
  tags: { deviceId: change.deviceId },
95227
95937
  meta: {
95228
95938
  capName: change.capName,
95229
- error: errMsg(err)
95939
+ error: errMsg$1(err)
95230
95940
  }
95231
95941
  });
95232
95942
  }
@@ -95260,7 +95970,7 @@ var StateChangeReporter = class {
95260
95970
  tags: { deviceId: change.deviceId },
95261
95971
  meta: {
95262
95972
  capName: change.capName,
95263
- error: errMsg(err)
95973
+ error: errMsg$1(err)
95264
95974
  }
95265
95975
  });
95266
95976
  }
@@ -95349,7 +96059,7 @@ var StateReconciler = class {
95349
96059
  });
95350
96060
  }
95351
96061
  } catch (err) {
95352
- 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) } });
95353
96063
  } finally {
95354
96064
  this.running = false;
95355
96065
  }
@@ -95813,6 +96523,7 @@ var DEFAULT_CONFIG = {
95813
96523
  advertisedBrokerUrl: "",
95814
96524
  region: "NA",
95815
96525
  exposed: [],
96526
+ exposedActions: [],
95816
96527
  linkedAccounts: [],
95817
96528
  tokens: [],
95818
96529
  exportedEndpoints: {},
@@ -95876,6 +96587,8 @@ var ExportAlexaAddon = class extends BaseAddon {
95876
96587
  lwaGateway = null;
95877
96588
  egressPrewarm = null;
95878
96589
  syncEngine = null;
96590
+ /** D968: exported actions, answered as Alexa scenes. */
96591
+ actionScenes = null;
95879
96592
  /** S1 (D767): the linking user's live grants. Built in `onInitialize`, the
95880
96593
  * first point `ctx` exists. */
95881
96594
  accessGateRef = null;
@@ -95907,7 +96620,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95907
96620
  }
95908
96621
  await this.backfillLinkedAccounts();
95909
96622
  this.autoDetectPublicHubUrl().catch((err) => {
95910
- 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) } });
95911
96624
  });
95912
96625
  this.accessGateRef = createHubAccessGate(this.ctx);
95913
96626
  this.detectionClassSource = new DetectionClassSource({
@@ -95936,6 +96649,23 @@ var ExportAlexaAddon = class extends BaseAddon {
95936
96649
  store: this.snapshotStore,
95937
96650
  post: (opts) => this.requireGateway().postObjectDetection(opts)
95938
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
+ });
95939
96669
  const deviceExportProvider = {
95940
96670
  getStatus: async () => ({
95941
96671
  linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
@@ -95946,6 +96676,24 @@ var ExportAlexaAddon = class extends BaseAddon {
95946
96676
  listExposedDevices: async () => this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) })),
95947
96677
  exposeDevice: async ({ deviceId }) => this.exposeDevice(deviceId),
95948
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
+ },
95949
96697
  getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(Number(input.deviceId)),
95950
96698
  getDeviceLiveContribution: async () => null,
95951
96699
  applyDeviceSettingsPatch: (input) => this.applyDeviceSettingsPatch(Number(input.deviceId), input.patch)
@@ -96018,6 +96766,11 @@ var ExportAlexaAddon = class extends BaseAddon {
96018
96766
  },
96019
96767
  vision: this.vision.context(),
96020
96768
  access: this.endpointAccess,
96769
+ actionScenes: {
96770
+ exports: actionScenes,
96771
+ api: this.ctx.api,
96772
+ logger: this.ctx.logger
96773
+ },
96021
96774
  afterDiscovery: (userId, endpoints) => this.requireGateway().scheduleInitialConnectivity(userId, endpoints)
96022
96775
  },
96023
96776
  lwaTokensCallbackDeps: {
@@ -96142,7 +96895,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96142
96895
  this.redetectPublicHubUrl().then(({ publicHubUrl }) => {
96143
96896
  this.ctx.logger.info("export-alexa: re-detected public hub URL after tunnel connect", { meta: { publicHubUrl } });
96144
96897
  }).catch((err) => {
96145
- 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) } });
96146
96899
  });
96147
96900
  });
96148
96901
  this.ctx.addDisposer(async () => offTunnelStarted());
@@ -96216,12 +96969,13 @@ var ExportAlexaAddon = class extends BaseAddon {
96216
96969
  this.lwaGateway = null;
96217
96970
  }
96218
96971
  this.syncEngine = null;
96972
+ this.actionScenes = null;
96219
96973
  }
96220
96974
  async exposeDevice(deviceIdRaw) {
96221
96975
  const deviceId = Number.parseInt(deviceIdRaw, 10);
96222
96976
  if (!Number.isFinite(deviceId)) throw new Error(`export-alexa: deviceId must be numeric — got "${deviceIdRaw}"`);
96223
96977
  if (!await this.ctx.api.deviceManager.getDevice.query({ deviceId }).catch((err) => {
96224
- throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg(err)}`);
96978
+ throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg$1(err)}`);
96225
96979
  })) throw new Error(`export-alexa: device ${deviceId} not found`);
96226
96980
  const next = this.config.exposed.filter((e) => e.deviceId !== deviceId);
96227
96981
  next.push({
@@ -96237,7 +96991,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96237
96991
  }).catch((err) => {
96238
96992
  this.ctx.logger.warn("export-alexa: expose sync failed", { meta: {
96239
96993
  deviceId,
96240
- error: errMsg(err)
96994
+ error: errMsg$1(err)
96241
96995
  } });
96242
96996
  });
96243
96997
  }
@@ -96251,7 +97005,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96251
97005
  this.requireSyncEngine().removeDevice(deviceId).catch((err) => {
96252
97006
  this.ctx.logger.warn("export-alexa: unexpose delete failed", { meta: {
96253
97007
  deviceId,
96254
- error: errMsg(err)
97008
+ error: errMsg$1(err)
96255
97009
  } });
96256
97010
  });
96257
97011
  }
@@ -96299,14 +97053,14 @@ var ExportAlexaAddon = class extends BaseAddon {
96299
97053
  const engine = this.syncEngine;
96300
97054
  if (engine === null) return;
96301
97055
  engine.reconcileAllExposed().catch((err) => {
96302
- 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) } });
96303
97057
  });
96304
97058
  }
96305
97059
  scheduleDetectionClassRefresh() {
96306
97060
  const timer = setInterval(() => {
96307
97061
  if (!this.config.detectionSensors && !this.config.objectDetection) return;
96308
97062
  this.requireSyncEngine().reconcileAllExposed().catch((err) => {
96309
- 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) } });
96310
97064
  });
96311
97065
  }, DETECTION_CLASS_REFRESH_MS);
96312
97066
  timer.unref?.();
@@ -96333,7 +97087,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96333
97087
  try {
96334
97088
  await applyVisibilityChanges(await this.visibility.refresh(), this.requireSyncEngine(), this.ctx.logger);
96335
97089
  } catch (err) {
96336
- 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) } });
96337
97091
  }
96338
97092
  }
96339
97093
  scheduleVisibilityRefresh() {
@@ -96423,7 +97177,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96423
97177
  pushed: r.pushedDeviceIds
96424
97178
  } });
96425
97179
  }).catch((err) => {
96426
- 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) } });
96427
97181
  });
96428
97182
  }, BOOT_RECONCILE_DELAY_MS);
96429
97183
  if (typeof timer.unref === "function") timer.unref();
@@ -96436,7 +97190,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96436
97190
  } catch (err) {
96437
97191
  this.ctx.logger.warn("export-alexa: bindings-change discovery reconcile failed", {
96438
97192
  tags: { deviceId },
96439
- meta: { error: errMsg(err) }
97193
+ meta: { error: errMsg$1(err) }
96440
97194
  });
96441
97195
  }
96442
97196
  }
@@ -96552,7 +97306,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96552
97306
  }).catch((err) => {
96553
97307
  this.ctx.logger.warn("export-alexa: new-account push failed", { meta: {
96554
97308
  userId: input.userId,
96555
- error: errMsg(err)
97309
+ error: errMsg$1(err)
96556
97310
  } });
96557
97311
  });
96558
97312
  }
@@ -96585,7 +97339,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96585
97339
  this.updateGlobalSettings({ advertisedBrokerUrl: url }).then(() => {
96586
97340
  this.ctx.logger.info("export-alexa: the skill Lambda advertised its token broker", { meta: { brokerUrl: url } });
96587
97341
  }).catch((err) => {
96588
- 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) } });
96589
97343
  });
96590
97344
  }
96591
97345
  async revokeAtBroker(tokens) {
@@ -96594,7 +97348,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96594
97348
  await revokeBrokerCredential(fetch, t.brokerUrl, t.brokerCredential).catch((err) => {
96595
97349
  this.ctx.logger.warn("export-alexa: could not delete the link at the skill broker — it expires there on its own", { meta: {
96596
97350
  userId: t.userId,
96597
- error: errMsg(err)
97351
+ error: errMsg$1(err)
96598
97352
  } });
96599
97353
  });
96600
97354
  }
@@ -96625,7 +97379,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96625
97379
  this.ctx.logger.warn("export-alexa: broker credential rotation failed", { meta: {
96626
97380
  userId: t.userId,
96627
97381
  kind: err instanceof BrokerError ? err.kind : "unavailable",
96628
- error: errMsg(err)
97382
+ error: errMsg$1(err)
96629
97383
  } });
96630
97384
  }
96631
97385
  }
@@ -96671,7 +97425,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96671
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));
96672
97426
  return [...new Set(urls)];
96673
97427
  } catch (err) {
96674
- 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) } });
96675
97429
  return [];
96676
97430
  }
96677
97431
  }
@@ -96685,7 +97439,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96685
97439
  if (!status?.connected || !endpoint || endpoint.protocol !== "https" || endpoint.url.length === 0) return "";
96686
97440
  return this.normaliseHubUrl(endpoint.url);
96687
97441
  } catch (err) {
96688
- 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) } });
96689
97443
  return "";
96690
97444
  }
96691
97445
  }
@@ -96995,13 +97749,13 @@ var ExportAlexaAddon = class extends BaseAddon {
96995
97749
  if (nameChanged && !sourceChanged) this.requireSyncEngine().pushDevice(deviceId).catch((err) => {
96996
97750
  this.ctx.logger.warn("export-alexa: push after an Alexa name change failed", {
96997
97751
  tags: { deviceId },
96998
- meta: { error: errMsg(err) }
97752
+ meta: { error: errMsg$1(err) }
96999
97753
  });
97000
97754
  });
97001
97755
  if (prefsChanged && !sourceChanged) this.requireSyncEngine().reconcileDevice(deviceId).catch((err) => {
97002
97756
  this.ctx.logger.warn("export-alexa: re-sync after a detection preference change failed", {
97003
97757
  tags: { deviceId },
97004
- meta: { error: errMsg(err) }
97758
+ meta: { error: errMsg$1(err) }
97005
97759
  });
97006
97760
  });
97007
97761
  if (sourceChanged) {
@@ -97025,7 +97779,7 @@ var ExportAlexaAddon = class extends BaseAddon {
97025
97779
  } catch (err) {
97026
97780
  this.ctx.logger.warn("export-alexa: failed to refresh after streamPreference change", { meta: {
97027
97781
  deviceId,
97028
- error: errMsg(err)
97782
+ error: errMsg$1(err)
97029
97783
  } });
97030
97784
  }
97031
97785
  }