@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.
@@ -5103,6 +5103,14 @@ function object(shape, params) {
5103
5103
  ...normalizeParams(params)
5104
5104
  });
5105
5105
  }
5106
+ function strictObject(shape, params) {
5107
+ return new ZodObject({
5108
+ type: "object",
5109
+ shape,
5110
+ catchall: never(),
5111
+ ...normalizeParams(params)
5112
+ });
5113
+ }
5106
5114
  function looseObject(shape, params) {
5107
5115
  return new ZodObject({
5108
5116
  type: "object",
@@ -5482,7 +5490,7 @@ var ZodIssueCode = {
5482
5490
  var ZodFirstPartyTypeKind;
5483
5491
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5484
5492
  //#endregion
5485
- //#region ../types/dist/sleep-DJws6ho7.mjs
5493
+ //#region ../types/dist/sleep-6eG9C8Xl.mjs
5486
5494
  /**
5487
5495
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5488
5496
  * window to float samples (D455).
@@ -8458,6 +8466,52 @@ function optionalMethod(input, output, options) {
8458
8466
  providerOptional: true
8459
8467
  };
8460
8468
  }
8469
+ /**
8470
+ * `addon-pages-source` — collection cap exposing per-provider raw page
8471
+ * declarations. Every addon that contributes a UI page registers a
8472
+ * provider here. The hub-side singleton aggregator (`addon-pages` cap,
8473
+ * see `addon-pages.cap.ts`) walks this collection, stamps versioned
8474
+ * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
8475
+ * that admin-ui consumes.
8476
+ *
8477
+ * The split exists because the public listing has a different output
8478
+ * shape than the per-provider raw declarations, and we want both ends
8479
+ * to flow through codegen instead of relying on a hand-written wrapper.
8480
+ */
8481
+ var AddonPageDeclarationSchema = object({
8482
+ id: string(),
8483
+ label: string(),
8484
+ icon: string(),
8485
+ path: string(),
8486
+ /**
8487
+ * Module Federation remote name — must match the `name` field on the
8488
+ * page addon's `federation()` plugin config. Used by admin-ui's
8489
+ * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
8490
+ * Conventionally `addon_<id>_page` (snake_case; MF names cannot
8491
+ * contain hyphens).
8492
+ */
8493
+ remoteName: string(),
8494
+ /**
8495
+ * Bundle filename inside the addon's `dist/` dir served at
8496
+ * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
8497
+ * is always `'remoteEntry.js'`; the value is kept on the metadata so
8498
+ * the static-file route can compute an mtime-based cache-buster URL
8499
+ * without a separate filesystem stat.
8500
+ */
8501
+ bundle: string(),
8502
+ /**
8503
+ * Sidebar section this page docks into. Well-known ids: `'detection'`,
8504
+ * `'cluster'`, `'administration'` — the page renders inside that group.
8505
+ * Any OTHER string creates (or joins) a custom section rendered after
8506
+ * the built-in groups; its label comes from `sectionLabel` (first
8507
+ * declaration wins), falling back to the id. Absent → the legacy
8508
+ * "Addon Pages" group.
8509
+ */
8510
+ section: string().optional(),
8511
+ /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
8512
+ sectionLabel: string().optional()
8513
+ });
8514
+ method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
8461
8515
  var StaticDirOutputSchema$1 = object({ staticDir: string() });
8462
8516
  var VersionOutputSchema$1 = object({ version: string() });
8463
8517
  method(_void(), StaticDirOutputSchema$1, { auth: "admin" }), method(_void(), VersionOutputSchema$1, { auth: "admin" });
@@ -8483,6 +8537,27 @@ function customAction(input, output, options) {
8483
8537
  ...options?.caller ? { caller: "required" } : {}
8484
8538
  };
8485
8539
  }
8540
+ /**
8541
+ * The pipeline step-input shape and the run-result bridge, in a module that
8542
+ * imports nothing but zod and types.
8543
+ *
8544
+ * WHY A SEPARATE FILE (addon footprint, D28): both were declared in
8545
+ * `pipeline-executor.cap.ts`, whose import evaluates the whole executor schema
8546
+ * graph. An addon that only needs these two (the benchmark's `runPipelineTest`
8547
+ * action) paid ~130 MB of heap at load. `pipeline-executor.cap.ts` re-exports
8548
+ * them, so every existing import keeps working; addon server code takes them
8549
+ * from `@camstack/types/addon`.
8550
+ */
8551
+ var PipelineStepInputSchema = lazy(() => object({
8552
+ addonId: string(),
8553
+ modelId: string().optional(),
8554
+ enabled: boolean().default(true),
8555
+ children: array(PipelineStepInputSchema).optional(),
8556
+ settings: record(string(), unknown()).optional(),
8557
+ jumpDeviceKey: string().optional()
8558
+ }));
8559
+ /** Typed bridge to the recursive `FrameResult` graph; validation is structural. */
8560
+ var PipelineRunResultBridge = custom();
8486
8561
  var StaticDirOutputSchema = object({ staticDir: string() });
8487
8562
  var VersionOutputSchema = object({ version: string() });
8488
8563
  method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
@@ -8667,6 +8742,7 @@ var CAP_NAMES = Object.freeze([
8667
8742
  "network-link",
8668
8743
  "network-quality",
8669
8744
  "node-certificates",
8745
+ "node-removal-hook",
8670
8746
  "nodes",
8671
8747
  "notification-output",
8672
8748
  "notification-rules",
@@ -8677,6 +8753,7 @@ var CAP_NAMES = Object.freeze([
8677
8753
  "osd",
8678
8754
  "osd-manager",
8679
8755
  "pet-feeder",
8756
+ "pet-fountain",
8680
8757
  "pipeline-analytics",
8681
8758
  "pipeline-executor",
8682
8759
  "pipeline-orchestrator",
@@ -9956,6 +10033,56 @@ Object.freeze({
9956
10033
  "valueType": "number"
9957
10034
  }
9958
10035
  ],
10036
+ "pet-fountain": [
10037
+ {
10038
+ "path": "waterLevel",
10039
+ "valueType": "number"
10040
+ },
10041
+ {
10042
+ "path": "waterVolume",
10043
+ "valueType": "number"
10044
+ },
10045
+ {
10046
+ "path": "empty",
10047
+ "valueType": "boolean"
10048
+ },
10049
+ {
10050
+ "path": "pumpRunning",
10051
+ "valueType": "boolean"
10052
+ },
10053
+ {
10054
+ "path": "pumpIntervalEnabled",
10055
+ "valueType": "boolean"
10056
+ },
10057
+ {
10058
+ "path": "pumpOnTime",
10059
+ "valueType": "number"
10060
+ },
10061
+ {
10062
+ "path": "pumpOffTime",
10063
+ "valueType": "number"
10064
+ },
10065
+ {
10066
+ "path": "lastDrink",
10067
+ "valueType": "number"
10068
+ },
10069
+ {
10070
+ "path": "currentHourDrink",
10071
+ "valueType": "number"
10072
+ },
10073
+ {
10074
+ "path": "last24hDrink",
10075
+ "valueType": "number"
10076
+ },
10077
+ {
10078
+ "path": "todayDrink",
10079
+ "valueType": "number"
10080
+ },
10081
+ {
10082
+ "path": "error",
10083
+ "valueType": "string"
10084
+ }
10085
+ ],
9959
10086
  "power-meter": [
9960
10087
  {
9961
10088
  "path": "power",
@@ -10493,7 +10620,7 @@ object({
10493
10620
  params: record(string(), union([string(), number()])).optional()
10494
10621
  });
10495
10622
  //#endregion
10496
- //#region ../types/dist/err-msg-BCdlR2Li.mjs
10623
+ //#region ../types/dist/err-msg-DWXWc0Di.mjs
10497
10624
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
10498
10625
  DeviceType["Camera"] = "camera";
10499
10626
  DeviceType["Hub"] = "hub";
@@ -10585,6 +10712,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
10585
10712
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10586
10713
  * integrations sharing the same food/desiccant/hopper surface. */
10587
10714
  DeviceType["PetFeeder"] = "pet-feeder";
10715
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
10716
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
10717
+ * of a container and is BUILT as a composed device (D967). */
10718
+ DeviceType["PetFountain"] = "pet-fountain";
10588
10719
  /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10589
10720
  * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10590
10721
  * Sources: native Bosch Home Connect, reusable by similar integrations.
@@ -10849,13 +10980,13 @@ import { errMsg } from '@camstack/types'
10849
10980
  * Extract a human-readable message from an unknown error value.
10850
10981
  * Replaces the ubiquitous `errMsg(err)` pattern.
10851
10982
  */
10852
- function errMsg(err) {
10983
+ function errMsg$1(err) {
10853
10984
  if (err instanceof Error) return err.message;
10854
10985
  if (typeof err === "string") return err;
10855
10986
  return String(err);
10856
10987
  }
10857
10988
  //#endregion
10858
- //#region ../types/dist/composition-bIBW5_13.mjs
10989
+ //#region ../types/dist/composition-kSuOifuG.mjs
10859
10990
  /**
10860
10991
  * The ffmpeg build every CamStack node downloads, per platform and arch.
10861
10992
  *
@@ -11940,12 +12071,28 @@ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
11940
12071
  ])
11941
12072
  })
11942
12073
  ]);
11943
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
12074
+ var forwardArgUnion = union([
12075
+ string(),
12076
+ number(),
12077
+ boolean(),
12078
+ strictObject({ ["$input"]: string().min(1) }),
12079
+ record(string().min(1), lazy(() => forwardArgUnion))
12080
+ ]);
12081
+ var CompositionForwardArgSchema = forwardArgUnion;
12082
+ /**
12083
+ * `forward` (D659, amended by D967): one method of a BUILT capability is one
12084
+ * call of `cap.method` on `source`. Without `args` the built method's input
12085
+ * passes through minus `deviceId`; with `args` the template IS the source's
12086
+ * whole input. `deviceId` is always the source's own, never an argument.
12087
+ */
12088
+ var CompositionForwardCommandSchema = object({
11944
12089
  kind: literal("forward"),
11945
12090
  source: CompositionSourceRefSchema,
11946
12091
  cap: string().min(1),
11947
- method: string().min(1)
11948
- }), CompositionCodeSourceSchema]);
12092
+ method: string().min(1),
12093
+ args: record(string().min(1), CompositionForwardArgSchema).optional()
12094
+ });
12095
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
11949
12096
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
11950
12097
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11951
12098
  /**
@@ -11955,7 +12102,13 @@ var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
11955
12102
  */
11956
12103
  var CompositionItemEntrySchema = object({
11957
12104
  label: string().min(1).max(80),
11958
- fields: record(string().min(1), CompositionFieldSourceSchema)
12105
+ fields: record(string().min(1), CompositionFieldSourceSchema),
12106
+ /**
12107
+ * What the cap's `reset` does for THIS item (consumables). Present = the item
12108
+ * is resettable and a `reset` call naming its key forwards here. The item key
12109
+ * selects the command, so it is never an argument: there is no pass-through.
12110
+ */
12111
+ reset: CompositionForwardCommandSchema.optional()
11959
12112
  });
11960
12113
  var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11961
12114
  kind: literal("fields"),
@@ -11967,7 +12120,7 @@ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
11967
12120
  * owns the WHOLE array field: the composed value holds exactly these items.
11968
12121
  */
11969
12122
  items: record(string().regex(COMPOSITION_ITEM_KEY_RE), CompositionItemEntrySchema).refine((items) => Object.keys(items).length <= 16, { message: `at most 16 items` }).optional(),
11970
- /** RESERVED for slice 3; refused by the validator when non-empty. */
12123
+ /** Method name → what serves it. Only a BUILT capability takes commands (D967). */
11971
12124
  commands: record(string().min(1), CompositionCommandTargetSchema).optional()
11972
12125
  }), object({
11973
12126
  kind: literal("passthrough"),
@@ -16194,6 +16347,510 @@ object({
16194
16347
  lastError: string().nullable()
16195
16348
  });
16196
16349
  /**
16350
+ * notification-output — canonical, capability-gated notification delivery.
16351
+ *
16352
+ * Apprise-derived model (see
16353
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
16354
+ * callers emit ONE canonical `Notification`; each provider declares a
16355
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
16356
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
16357
+ * message to what the kind supports — callers never special-case a service.
16358
+ *
16359
+ * DESIGN DECISIONS (locked):
16360
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
16361
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
16362
+ * cap. Rationale: the admin UI needs one uniform surface across the
16363
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
16364
+ * alternative would fork the UI per addon and cannot host the
16365
+ * discovery→adopt flow.
16366
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
16367
+ * the generated cap-mount auto-`concatCollection`-fans them across every
16368
+ * registered provider (notifiers addon + HA addon) so one catalog is
16369
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
16370
+ * `addonId` the generated collection router extracts from the call input.
16371
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
16372
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
16373
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
16374
+ * base64 fallback needed.
16375
+ *
16376
+ * TODO (deferred, closed-set change — separate decision): add
16377
+ * `providerKind: 'notify'` so notification providers surface on the unified
16378
+ * admin "Integrations" page.
16379
+ */
16380
+ /**
16381
+ * Zentik-derived typed-media enum — the superset across every kind. Each
16382
+ * adapter picks what it supports and the degrade engine filters the rest.
16383
+ */
16384
+ var AttachmentMediaTypeSchema = _enum([
16385
+ "image",
16386
+ "video",
16387
+ "gif",
16388
+ "audio",
16389
+ "icon"
16390
+ ]);
16391
+ /**
16392
+ * A single attachment. Exactly one of `url` (remote source, most adapters
16393
+ * prefer this) or `bytes` (inline source; required for Pushover-style
16394
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
16395
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
16396
+ */
16397
+ var AttachmentSchema = object({
16398
+ mediaType: AttachmentMediaTypeSchema,
16399
+ url: string().optional(),
16400
+ bytes: _instanceof(Uint8Array).optional(),
16401
+ mime: string().optional(),
16402
+ name: string().optional()
16403
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
16404
+ var NotificationFormatSchema = _enum([
16405
+ "text",
16406
+ "markdown",
16407
+ "html"
16408
+ ]);
16409
+ /**
16410
+ * The CLOSED icon vocabulary an action button may use.
16411
+ *
16412
+ * A closed set, not a free string, and that is the whole point: an arbitrary
16413
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
16414
+ * notices — the same class of gap as a zone vocabulary nothing produced
16415
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
16416
+ * declares `actionIcons: false` and the degrade engine strips the field.
16417
+ *
16418
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
16419
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
16420
+ * differently.
16421
+ *
16422
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
16423
+ *
16424
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
16425
+ * the whole set onto its own renderer's vocabulary through a
16426
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
16427
+ * fallback, so adding a member here fails every adapter's build until someone
16428
+ * decides its glyph, which is the only place that decision can be made
16429
+ * honestly.
16430
+ *
16431
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
16432
+ * `disarm` straight through; iOS feeds that string to
16433
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
16434
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
16435
+ * mapping, and "the field is documented" is not "the value renders".
16436
+ *
16437
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
16438
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
16439
+ * so an addon that emits a token the running hub does not know does not lose an
16440
+ * icon — its whole `send` fails Zod validation and the notification never
16441
+ * arrives. Never emit a new token from an addon before the train carrying it.
16442
+ */
16443
+ var NotificationActionIconSchema = _enum([
16444
+ "acknowledge",
16445
+ "dismiss",
16446
+ "silence",
16447
+ "snooze",
16448
+ "view",
16449
+ "play",
16450
+ "open",
16451
+ "close",
16452
+ "lock",
16453
+ "unlock",
16454
+ "arm",
16455
+ "arm-home",
16456
+ "arm-away",
16457
+ "arm-night",
16458
+ "disarm",
16459
+ "light",
16460
+ "alert",
16461
+ "camera"
16462
+ ]);
16463
+ /** A single tap-through action button. */
16464
+ var NotificationActionSchema = object({
16465
+ id: string(),
16466
+ label: string(),
16467
+ url: string().optional(),
16468
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
16469
+ icon: NotificationActionIconSchema.optional(),
16470
+ /**
16471
+ * Renders in a warning style where the notifier supports it.
16472
+ *
16473
+ * A HINT, never a gate. The callback's authority is its token and nothing
16474
+ * else — see `notification-center/action-token.ts` for what that does and
16475
+ * does not buy.
16476
+ */
16477
+ destructive: boolean().optional(),
16478
+ /**
16479
+ * How the tap should REACH the url.
16480
+ *
16481
+ * `navigate` (absent, and every button authored before this field) opens it:
16482
+ * the phone leaves the notification and shows whatever the callback returns.
16483
+ * That is right for a button whose answer the operator wants to read.
16484
+ *
16485
+ * `background` fires it as a POST and stays put. It exists for the buttons
16486
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
16487
+ * an answer to the notification, and being thrown into a browser tab to
16488
+ * confirm it costs more attention than the notification did. A backend that
16489
+ * cannot do a background call renders it as an ordinary link (the adapters
16490
+ * fall back rather than dropping the button), so this is a preference, never
16491
+ * a requirement.
16492
+ */
16493
+ mode: _enum(["navigate", "background"]).optional()
16494
+ });
16495
+ /** A delivery parameter value: what a notifier declared it takes. */
16496
+ var DeliveryParamValueSchema = union([
16497
+ string(),
16498
+ number(),
16499
+ boolean()
16500
+ ]);
16501
+ /**
16502
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
16503
+ * addresses a target of that kind may set it; a kind that declares nothing is
16504
+ * never handed one. The admin UI derives its control from this descriptor —
16505
+ * no editor knows a service by name.
16506
+ *
16507
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
16508
+ * run on the addon cap path).
16509
+ */
16510
+ var DeliveryParamSchema = object({
16511
+ key: string().min(1),
16512
+ label: string(),
16513
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
16514
+ labelKey: string().optional(),
16515
+ type: _enum([
16516
+ "enum",
16517
+ "number",
16518
+ "boolean",
16519
+ "string"
16520
+ ]),
16521
+ /** `enum` only: the closed set of accepted values. */
16522
+ options: array(object({
16523
+ value: string(),
16524
+ label: string()
16525
+ })).optional(),
16526
+ /** `number` only. */
16527
+ min: number().optional(),
16528
+ max: number().optional(),
16529
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
16530
+ default: DeliveryParamValueSchema.optional()
16531
+ });
16532
+ /**
16533
+ * The canonical notification. `body` is the only hard field (Apprise model).
16534
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
16535
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
16536
+ * the adapter maps this ordinal onto its native level. `level?` is an
16537
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
16538
+ * `priority` for that one target.
16539
+ */
16540
+ var NotificationSchema = object({
16541
+ body: string(),
16542
+ title: string().optional(),
16543
+ format: NotificationFormatSchema.default("text"),
16544
+ priority: number().int().min(1).max(5).default(3),
16545
+ level: string().optional(),
16546
+ attachments: array(AttachmentSchema).optional(),
16547
+ clickUrl: string().optional(),
16548
+ actions: array(NotificationActionSchema).optional(),
16549
+ sound: string().optional(),
16550
+ ttl: number().optional(),
16551
+ tag: string().optional(),
16552
+ deviceId: number().optional(),
16553
+ eventId: string().optional(),
16554
+ metadata: record(string(), unknown()).optional(),
16555
+ /**
16556
+ * Values for the parameters the target's kind DECLARES in
16557
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
16558
+ * declaration by the sender; a notifier reads only the keys it declared.
16559
+ */
16560
+ delivery: record(string(), DeliveryParamValueSchema).optional()
16561
+ });
16562
+ /** One declared native severity/priority level for a kind. */
16563
+ var TargetKindLevelSchema = object({
16564
+ id: string(),
16565
+ label: string(),
16566
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
16567
+ ordinal: number().int().min(1).max(5).nullable(),
16568
+ flags: object({
16569
+ critical: boolean().optional(),
16570
+ silent: boolean().optional(),
16571
+ noPush: boolean().optional()
16572
+ }).optional(),
16573
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
16574
+ requires: array(string()).optional(),
16575
+ description: string().optional()
16576
+ });
16577
+ /** The full capability block consulted before dispatch. */
16578
+ var TargetKindCapsSchema = object({
16579
+ attachments: object({
16580
+ mediaTypes: array(AttachmentMediaTypeSchema),
16581
+ mode: _enum([
16582
+ "url",
16583
+ "bytes",
16584
+ "both"
16585
+ ]),
16586
+ max: number().int().nonnegative(),
16587
+ maxBytes: number().int().positive().optional()
16588
+ }),
16589
+ /** Max action buttons (0 = none). */
16590
+ actions: number().int().nonnegative(),
16591
+ /**
16592
+ * Whether this kind renders a per-action ICON.
16593
+ *
16594
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
16595
+ * run on the addon cap path — three production failures in one day taught
16596
+ * this repo that once. Absent is read as false by the degrade engine, which
16597
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
16598
+ * assumed and dropped costs the operator's trust in the field.
16599
+ */
16600
+ actionIcons: boolean().optional(),
16601
+ levels: array(TargetKindLevelSchema),
16602
+ format: array(NotificationFormatSchema),
16603
+ clickUrl: boolean(),
16604
+ sound: boolean(),
16605
+ ttl: boolean(),
16606
+ bodyMaxLen: number().int().positive()
16607
+ });
16608
+ /**
16609
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
16610
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
16611
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
16612
+ * the union is large and not meant for runtime validation here; the exported
16613
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
16614
+ */
16615
+ var ConfigSchemaPassthrough$3 = unknown();
16616
+ var TargetKindSchema = object({
16617
+ kind: string(),
16618
+ label: string(),
16619
+ icon: string(),
16620
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
16621
+ addonId: string(),
16622
+ /**
16623
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
16624
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
16625
+ * when the addon bundles no icon for that kind — the client then falls back
16626
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
16627
+ *
16628
+ * Root-relative on purpose: it resolves against whatever origin serves a web
16629
+ * client, and a native client joins it onto its own hub base.
16630
+ *
16631
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
16632
+ * field that survived only because the runtime cap-router forwards provider
16633
+ * output verbatim — so every consumer had to re-declare it by hand to stop
16634
+ * its own Zod parse from stripping it, and the whole arrangement would have
16635
+ * broken silently the moment output validation was tightened anywhere.
16636
+ */
16637
+ iconUrl: string().optional(),
16638
+ /**
16639
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
16640
+ *
16641
+ * The server knows this and therefore says it, because the client cannot
16642
+ * safely guess: a React-Native client renders SVG and raster through two
16643
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
16644
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
16645
+ * placeholder glyph for every vector icon while the web build looked fine.
16646
+ *
16647
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
16648
+ * not been updated — a client that cannot determine the type should prefer
16649
+ * its raster path, which is the safe default for an unknown image.
16650
+ */
16651
+ iconMediaType: string().optional(),
16652
+ configSchema: ConfigSchemaPassthrough$3,
16653
+ /**
16654
+ * The config keys that decide WHERE this kind's secrets are sent (server,
16655
+ * base URL, instance, chat, recipient). A save that changes any of them
16656
+ * while leaving a secret redacted is refused by the provider (D634), so an
16657
+ * editor uses this to ask for the secret on exactly those edits instead of
16658
+ * on every edit.
16659
+ *
16660
+ * Optional: absent from a provider that holds no secret (the Home Assistant
16661
+ * kinds) and from a provider older than this field — an editor that finds
16662
+ * it absent must assume ANY edit may need the secret.
16663
+ */
16664
+ destinationKeys: array(string()).optional(),
16665
+ supportsDiscovery: boolean(),
16666
+ /**
16667
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
16668
+ * Absent = none; the rule editor then offers nothing.
16669
+ */
16670
+ deliveryParams: array(DeliveryParamSchema).optional(),
16671
+ caps: TargetKindCapsSchema
16672
+ });
16673
+ /**
16674
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
16675
+ * (return a presence marker only) when serving `listTargets` — never
16676
+ * round-trip a stored secret to the UI.
16677
+ */
16678
+ var TargetSchema = object({
16679
+ id: string(),
16680
+ name: string(),
16681
+ kind: string(),
16682
+ addonId: string(),
16683
+ enabled: boolean(),
16684
+ config: record(string(), unknown())
16685
+ });
16686
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
16687
+ var DiscoveredTargetSchema = object({
16688
+ kind: string(),
16689
+ suggestedName: string(),
16690
+ config: record(string(), unknown())
16691
+ });
16692
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
16693
+ var RenderedAsSchema = object({
16694
+ level: string(),
16695
+ format: NotificationFormatSchema,
16696
+ attachmentsSent: number().int().nonnegative(),
16697
+ actionsSent: number().int().nonnegative(),
16698
+ truncated: boolean(),
16699
+ dropped: array(string())
16700
+ });
16701
+ var SendResultSchema = object({
16702
+ success: boolean(),
16703
+ error: string().optional(),
16704
+ renderedAs: RenderedAsSchema.optional()
16705
+ });
16706
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
16707
+ var TestResultSchema = SendResultSchema;
16708
+ /**
16709
+ * Pre-save credential probe against a partial (unsaved) target config.
16710
+ * `resolvedUrl` never includes secrets (token stripped from path).
16711
+ */
16712
+ var ProbeTargetConfigResultSchema = object({
16713
+ ok: boolean(),
16714
+ resolvedUrl: string(),
16715
+ httpStatus: number().int().optional(),
16716
+ stateInstance: string().optional(),
16717
+ error: string().optional()
16718
+ });
16719
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
16720
+ kind: string(),
16721
+ config: record(string(), unknown()).optional(),
16722
+ /**
16723
+ * When editing / duplicating, the blank password field never round-trips
16724
+ * the stored token. Pass the source target id so the provider can restore
16725
+ * secrets server-side before dialling (same merge as upsert).
16726
+ */
16727
+ targetId: string().optional()
16728
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
16729
+ kind: string(),
16730
+ config: record(string(), unknown()),
16731
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
16732
+ targetId: string().optional()
16733
+ }), ProbeTargetConfigResultSchema, {
16734
+ kind: "mutation",
16735
+ auth: "admin"
16736
+ }), method(object({
16737
+ targetId: string(),
16738
+ notification: NotificationSchema
16739
+ }), SendResultSchema, {
16740
+ kind: "mutation",
16741
+ auth: "admin"
16742
+ }), method(object({
16743
+ targetId: string(),
16744
+ sample: NotificationSchema.optional()
16745
+ }), TestResultSchema, {
16746
+ kind: "mutation",
16747
+ auth: "admin"
16748
+ }), method(object({
16749
+ target: TargetSchema,
16750
+ /**
16751
+ * Duplicate flow: create a NEW target id while copying secrets from an
16752
+ * existing row. The UI never holds the stored token; blank / redacted
16753
+ * password fields are restored from this source (D634 still applies if
16754
+ * destinations diverge without a re-typed secret).
16755
+ */
16756
+ cloneSecretsFrom: string().optional()
16757
+ }), TargetSchema, {
16758
+ kind: "mutation",
16759
+ auth: "admin"
16760
+ }), method(object({ targetId: string() }), _void(), {
16761
+ kind: "mutation",
16762
+ auth: "admin"
16763
+ }), method(object({
16764
+ targetId: string(),
16765
+ enabled: boolean()
16766
+ }), _void(), {
16767
+ kind: "mutation",
16768
+ auth: "admin"
16769
+ });
16770
+ function errorText(err) {
16771
+ return err instanceof Error ? err.message : String(err);
16772
+ }
16773
+ /** `actions.run` flattens a refusal to `[code] text`; the code leads. */
16774
+ function refusalFromThrown(message) {
16775
+ if (message.startsWith("[busy]")) return "already-running";
16776
+ if (message.startsWith("[not-found]")) return "not-found";
16777
+ return null;
16778
+ }
16779
+ async function runExportedAction(api, log, input) {
16780
+ const { exporter, actionId } = input;
16781
+ const tags = { actionId };
16782
+ const refuse = (reason, detail) => {
16783
+ log.warn(`${exporter}: exported action not run — ${reason}`, {
16784
+ tags,
16785
+ meta: {
16786
+ reason,
16787
+ ...detail ? { detail } : {}
16788
+ }
16789
+ });
16790
+ return {
16791
+ status: "refused",
16792
+ reason
16793
+ };
16794
+ };
16795
+ try {
16796
+ const result = await api.actions.run.mutate({ actionId });
16797
+ if (result.outcome === "skipped-overlap") return refuse("already-running", result.message);
16798
+ if (result.outcome === "skipped-cooldown") return refuse("cooldown", result.message);
16799
+ if (result.outcome === "failed" || result.outcome === "aborted") {
16800
+ const message = result.message ?? result.outcome;
16801
+ log.warn(`${exporter}: exported action failed`, {
16802
+ tags,
16803
+ meta: {
16804
+ outcome: result.outcome,
16805
+ message
16806
+ }
16807
+ });
16808
+ return {
16809
+ status: "failed",
16810
+ message
16811
+ };
16812
+ }
16813
+ log.info(`${exporter}: exported action ran`, {
16814
+ tags,
16815
+ meta: { outcome: result.outcome }
16816
+ });
16817
+ return { status: "started" };
16818
+ } catch (err) {
16819
+ const message = errorText(err);
16820
+ const reason = refusalFromThrown(message);
16821
+ if (reason !== null) return refuse(reason, message);
16822
+ log.warn(`${exporter}: exported action failed`, {
16823
+ tags,
16824
+ meta: { message }
16825
+ });
16826
+ return {
16827
+ status: "failed",
16828
+ message
16829
+ };
16830
+ }
16831
+ }
16832
+ /**
16833
+ * Split an exporter's selection into what still exists and what was deleted.
16834
+ * Devices are never judged here (their lifecycle is the tombstone, D865).
16835
+ * Callers pass ids from a query that ANSWERED — an unanswered list must not
16836
+ * reach this function (D49: a failed read changes nothing).
16837
+ */
16838
+ function pruneDeletedEntities(selection, live, log, exporter) {
16839
+ const kept = [];
16840
+ const dropped = [];
16841
+ for (const ref of selection) if (ref.kind === "action" && !live.actionIds.has(ref.actionId)) {
16842
+ dropped.push(ref);
16843
+ log.warn(`${exporter}: exported action was deleted — dropped from the export`, { tags: { actionId: ref.actionId } });
16844
+ } else if (ref.kind === "notifier" && !live.targetIds.has(ref.targetId)) {
16845
+ dropped.push(ref);
16846
+ log.warn(`${exporter}: exported notifier target was deleted — dropped from the export`, { tags: { targetId: ref.targetId } });
16847
+ } else kept.push(ref);
16848
+ return {
16849
+ kept,
16850
+ dropped
16851
+ };
16852
+ }
16853
+ /**
16197
16854
  * `addon-pages` — system-scoped singleton aggregator cap. Public-facing
16198
16855
  * surface that admin-ui consumes through `useAddonPagesListPages()`.
16199
16856
  *
@@ -16225,52 +16882,6 @@ var AddonPageInfoSchema = object({
16225
16882
  bundleUrl: string()
16226
16883
  });
16227
16884
  method(_void(), array(AddonPageInfoSchema).readonly());
16228
- /**
16229
- * `addon-pages-source` — collection cap exposing per-provider raw page
16230
- * declarations. Every addon that contributes a UI page registers a
16231
- * provider here. The hub-side singleton aggregator (`addon-pages` cap,
16232
- * see `addon-pages.cap.ts`) walks this collection, stamps versioned
16233
- * `bundleUrl` values, and returns the enriched `AddonPageInfo[]` list
16234
- * that admin-ui consumes.
16235
- *
16236
- * The split exists because the public listing has a different output
16237
- * shape than the per-provider raw declarations, and we want both ends
16238
- * to flow through codegen instead of relying on a hand-written wrapper.
16239
- */
16240
- var AddonPageDeclarationSchema = object({
16241
- id: string(),
16242
- label: string(),
16243
- icon: string(),
16244
- path: string(),
16245
- /**
16246
- * Module Federation remote name — must match the `name` field on the
16247
- * page addon's `federation()` plugin config. Used by admin-ui's
16248
- * `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
16249
- * Conventionally `addon_<id>_page` (snake_case; MF names cannot
16250
- * contain hyphens).
16251
- */
16252
- remoteName: string(),
16253
- /**
16254
- * Bundle filename inside the addon's `dist/` dir served at
16255
- * `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
16256
- * is always `'remoteEntry.js'`; the value is kept on the metadata so
16257
- * the static-file route can compute an mtime-based cache-buster URL
16258
- * without a separate filesystem stat.
16259
- */
16260
- bundle: string(),
16261
- /**
16262
- * Sidebar section this page docks into. Well-known ids: `'detection'`,
16263
- * `'cluster'`, `'administration'` — the page renders inside that group.
16264
- * Any OTHER string creates (or joins) a custom section rendered after
16265
- * the built-in groups; its label comes from `sectionLabel` (first
16266
- * declaration wins), falling back to the id. Absent → the legacy
16267
- * "Addon Pages" group.
16268
- */
16269
- section: string().optional(),
16270
- /** Display label for a CUSTOM `section` id (ignored for well-known ids). */
16271
- sectionLabel: string().optional()
16272
- });
16273
- method(_void(), array(AddonPageDeclarationSchema).readonly(), { auth: "admin" });
16274
16885
  var AddonHttpRouteSchema = object({
16275
16886
  method: _enum([
16276
16887
  "GET",
@@ -18832,7 +19443,11 @@ var CompositionProblemSchema = object({
18832
19443
  "mixed-quantity",
18833
19444
  "helper-mismatch",
18834
19445
  "member-constraint",
18835
- "retention"
19446
+ "retention",
19447
+ "command-method-unknown",
19448
+ "command-source-unknown",
19449
+ "command-input-unknown",
19450
+ "command-input-missing"
18836
19451
  ]),
18837
19452
  path: string(),
18838
19453
  message: string()
@@ -18871,7 +19486,9 @@ var CompositionFieldRoleSchema = _enum([
18871
19486
  var CompositionFieldItemSchema = object({
18872
19487
  arrayPath: string(),
18873
19488
  key: string(),
18874
- label: string()
19489
+ label: string(),
19490
+ /** True when the item carries a `reset` forward: the composer writes `resettable` from this (D967). */
19491
+ resettable: boolean().optional()
18875
19492
  });
18876
19493
  var CompositionFieldPlanSchema = object({
18877
19494
  cap: string(),
@@ -19076,7 +19693,7 @@ Object.freeze({
19076
19693
  * One catalog row per base reading a group helper can build (D944 §3).
19077
19694
  * Data, not a form default written into the block.
19078
19695
  */
19079
- var NOW$2 = {
19696
+ var NOW$3 = {
19080
19697
  fieldPath: "lastFetchedAt",
19081
19698
  expr: "now"
19082
19699
  };
@@ -19128,7 +19745,7 @@ var GROUP_TEMPLATES = [
19128
19745
  quantity: "temperature",
19129
19746
  defaultAggregate: "mean",
19130
19747
  empty: "null",
19131
- companions: [NOW$2],
19748
+ companions: [NOW$3],
19132
19749
  alsoFrom: {
19133
19750
  deviceTypes: CLIMATE_DEVICES,
19134
19751
  accept: {
@@ -19146,7 +19763,7 @@ var GROUP_TEMPLATES = [
19146
19763
  quantity: "humidity",
19147
19764
  defaultAggregate: "mean",
19148
19765
  empty: "null",
19149
- companions: [NOW$2],
19766
+ companions: [NOW$3],
19150
19767
  alsoFrom: {
19151
19768
  deviceTypes: CLIMATE_DEVICES,
19152
19769
  accept: {
@@ -19164,7 +19781,7 @@ var GROUP_TEMPLATES = [
19164
19781
  quantity: "pressure",
19165
19782
  defaultAggregate: "mean",
19166
19783
  empty: "null",
19167
- companions: [NOW$2]
19784
+ companions: [NOW$3]
19168
19785
  }),
19169
19786
  numeric({
19170
19787
  id: "illuminance",
@@ -19175,7 +19792,7 @@ var GROUP_TEMPLATES = [
19175
19792
  quantity: "illuminance",
19176
19793
  defaultAggregate: "mean",
19177
19794
  empty: "null",
19178
- companions: [NOW$2]
19795
+ companions: [NOW$3]
19179
19796
  }),
19180
19797
  numeric({
19181
19798
  id: "power",
@@ -19186,7 +19803,7 @@ var GROUP_TEMPLATES = [
19186
19803
  quantity: "power",
19187
19804
  defaultAggregate: "sum",
19188
19805
  empty: "omit",
19189
- companions: [NOW$2]
19806
+ companions: [NOW$3]
19190
19807
  }),
19191
19808
  numeric({
19192
19809
  id: "energy",
@@ -19197,7 +19814,7 @@ var GROUP_TEMPLATES = [
19197
19814
  quantity: "energy",
19198
19815
  defaultAggregate: "sum",
19199
19816
  empty: "omit",
19200
- companions: [NOW$2]
19817
+ companions: [NOW$3]
19201
19818
  }),
19202
19819
  numeric({
19203
19820
  id: "battery",
@@ -19232,7 +19849,7 @@ var GROUP_TEMPLATES = [
19232
19849
  quantity: "device",
19233
19850
  defaultAggregate: "mean",
19234
19851
  empty: "null",
19235
- companions: [NOW$2]
19852
+ companions: [NOW$3]
19236
19853
  }),
19237
19854
  binary({
19238
19855
  id: "motion",
@@ -21578,6 +22195,36 @@ var ExposeInputSchema = object({
21578
22195
  capabilities: array(string()).optional()
21579
22196
  });
21580
22197
  var UnexposeInputSchema = object({ deviceId: string() });
22198
+ /**
22199
+ * What an exporter may expose besides devices (D968). An action and a
22200
+ * notification target are LIST ENTRIES, never devices (D954): they enter an
22201
+ * exporter's own selection, not the device registry.
22202
+ */
22203
+ var ExportEntityKindSchema = _enum([
22204
+ "device",
22205
+ "action",
22206
+ "notifier"
22207
+ ]);
22208
+ var ExportEntityRefSchema = discriminatedUnion("kind", [
22209
+ object({
22210
+ kind: literal("device"),
22211
+ deviceId: string()
22212
+ }),
22213
+ object({
22214
+ kind: literal("action"),
22215
+ actionId: string().min(1)
22216
+ }),
22217
+ object({
22218
+ kind: literal("notifier"),
22219
+ targetId: string().min(1)
22220
+ })
22221
+ ]);
22222
+ var ExposedEntitySchema = object({
22223
+ entity: ExportEntityRefSchema,
22224
+ exposedAs: string().optional()
22225
+ });
22226
+ var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
22227
+ var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
21581
22228
  var deviceExportCapability = {
21582
22229
  name: "device-export",
21583
22230
  scope: "system",
@@ -21607,6 +22254,16 @@ var deviceExportCapability = {
21607
22254
  unexposeDevice: method(UnexposeInputSchema, _void(), {
21608
22255
  kind: "mutation",
21609
22256
  auth: "admin"
22257
+ }),
22258
+ listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
22259
+ listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
22260
+ exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
22261
+ kind: "mutation",
22262
+ auth: "admin"
22263
+ }),
22264
+ unexposeEntity: optionalMethod(UnexposeEntityInputSchema, _void(), {
22265
+ kind: "mutation",
22266
+ auth: "admin"
21610
22267
  })
21611
22268
  }
21612
22269
  };
@@ -42749,6 +43406,14 @@ method(object({
42749
43406
  kind: "mutation",
42750
43407
  auth: "admin"
42751
43408
  });
43409
+ method(object({
43410
+ nodeId: string().min(1),
43411
+ /** Epoch ms the node was forgotten (the tombstone's `removedAt`). */
43412
+ removedAt: number()
43413
+ }), object({ counts: record(string(), number().int().nonnegative()) }), {
43414
+ kind: "mutation",
43415
+ auth: "admin"
43416
+ });
42752
43417
  /**
42753
43418
  * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
42754
43419
  * so it can delete what it keeps for that device (D865).
@@ -43469,7 +44134,7 @@ var LlmProviderWidgetSchema = object({
43469
44134
  /** ConfigUISchema tree passed through untyped on the wire (the
43470
44135
  * notification-output `ConfigSchemaPassthrough` precedent at
43471
44136
  * notification-output.cap.ts:151); the exported TS type re-tightens it. */
43472
- var ConfigSchemaPassthrough$3 = unknown();
44137
+ var ConfigSchemaPassthrough$2 = unknown();
43473
44138
  var LlmProfileKindDescriptorSchema = object({
43474
44139
  kind: LlmProfileKindSchema,
43475
44140
  label: string(),
@@ -43478,9 +44143,9 @@ var LlmProfileKindDescriptorSchema = object({
43478
44143
  /** Stamped by each provider so the concat-fanned catalog stays routable. */
43479
44144
  addonId: string(),
43480
44145
  /** The provider's own fields (`providerConfig`); `password` fields are keychain-held. */
43481
- connectionSchema: ConfigSchemaPassthrough$3,
44146
+ connectionSchema: ConfigSchemaPassthrough$2,
43482
44147
  /** Provider fields that belong under "Advanced" (extra headers, runtime tuning). */
43483
- advancedSchema: ConfigSchemaPassthrough$3.optional(),
44148
+ advancedSchema: ConfigSchemaPassthrough$2.optional(),
43484
44149
  /** The kind's defaults; a model from `listModels` may override any of them. */
43485
44150
  features: LlmModelFeaturesSchema,
43486
44151
  /** `false` = the provider stamps `supportsVision` itself (from what a node reports). */
@@ -44006,10 +44671,10 @@ var CpuBreakdownSchema = object({
44006
44671
  cores: number()
44007
44672
  });
44008
44673
  var MemoryInfoSchema = object({
44009
- percent: number(),
44674
+ percent: number().nullable(),
44010
44675
  totalBytes: number(),
44011
- usedBytes: number(),
44012
- availableBytes: number(),
44676
+ usedBytes: number().nullable(),
44677
+ availableBytes: number().nullable(),
44013
44678
  swapUsedBytes: number(),
44014
44679
  swapTotalBytes: number()
44015
44680
  });
@@ -44313,8 +44978,9 @@ var GetLoadSeriesInputSchema = object({
44313
44978
  });
44314
44979
  var SystemMetricsSchema = object({
44315
44980
  cpuPercent: number(),
44316
- memoryPercent: number(),
44317
- memoryUsedMB: number(),
44981
+ /** `null` when the memory sample failed or was not taken yet (D393). */
44982
+ memoryPercent: number().nullable(),
44983
+ memoryUsedMB: number().nullable(),
44318
44984
  memoryTotalMB: number(),
44319
44985
  diskPercent: number().optional(),
44320
44986
  temperature: number().optional(),
@@ -44550,427 +45216,6 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
44550
45216
  sourcePort: number().optional()
44551
45217
  });
44552
45218
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
44553
- /**
44554
- * notification-output — canonical, capability-gated notification delivery.
44555
- *
44556
- * Apprise-derived model (see
44557
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44558
- * callers emit ONE canonical `Notification`; each provider declares a
44559
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44560
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44561
- * message to what the kind supports — callers never special-case a service.
44562
- *
44563
- * DESIGN DECISIONS (locked):
44564
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44565
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44566
- * cap. Rationale: the admin UI needs one uniform surface across the
44567
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44568
- * alternative would fork the UI per addon and cannot host the
44569
- * discovery→adopt flow.
44570
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44571
- * the generated cap-mount auto-`concatCollection`-fans them across every
44572
- * registered provider (notifiers addon + HA addon) so one catalog is
44573
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44574
- * `addonId` the generated collection router extracts from the call input.
44575
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44576
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44577
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44578
- * base64 fallback needed.
44579
- *
44580
- * TODO (deferred, closed-set change — separate decision): add
44581
- * `providerKind: 'notify'` so notification providers surface on the unified
44582
- * admin "Integrations" page.
44583
- */
44584
- /**
44585
- * Zentik-derived typed-media enum — the superset across every kind. Each
44586
- * adapter picks what it supports and the degrade engine filters the rest.
44587
- */
44588
- var AttachmentMediaTypeSchema = _enum([
44589
- "image",
44590
- "video",
44591
- "gif",
44592
- "audio",
44593
- "icon"
44594
- ]);
44595
- /**
44596
- * A single attachment. Exactly one of `url` (remote source, most adapters
44597
- * prefer this) or `bytes` (inline source; required for Pushover-style
44598
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44599
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44600
- */
44601
- var AttachmentSchema = object({
44602
- mediaType: AttachmentMediaTypeSchema,
44603
- url: string().optional(),
44604
- bytes: _instanceof(Uint8Array).optional(),
44605
- mime: string().optional(),
44606
- name: string().optional()
44607
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44608
- var NotificationFormatSchema = _enum([
44609
- "text",
44610
- "markdown",
44611
- "html"
44612
- ]);
44613
- /**
44614
- * The CLOSED icon vocabulary an action button may use.
44615
- *
44616
- * A closed set, not a free string, and that is the whole point: an arbitrary
44617
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44618
- * notices — the same class of gap as a zone vocabulary nothing produced
44619
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44620
- * declares `actionIcons: false` and the degrade engine strips the field.
44621
- *
44622
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44623
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44624
- * differently.
44625
- *
44626
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44627
- *
44628
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44629
- * the whole set onto its own renderer's vocabulary through a
44630
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44631
- * fallback, so adding a member here fails every adapter's build until someone
44632
- * decides its glyph, which is the only place that decision can be made
44633
- * honestly.
44634
- *
44635
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44636
- * `disarm` straight through; iOS feeds that string to
44637
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44638
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44639
- * mapping, and "the field is documented" is not "the value renders".
44640
- *
44641
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44642
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44643
- * so an addon that emits a token the running hub does not know does not lose an
44644
- * icon — its whole `send` fails Zod validation and the notification never
44645
- * arrives. Never emit a new token from an addon before the train carrying it.
44646
- */
44647
- var NotificationActionIconSchema = _enum([
44648
- "acknowledge",
44649
- "dismiss",
44650
- "silence",
44651
- "snooze",
44652
- "view",
44653
- "play",
44654
- "open",
44655
- "close",
44656
- "lock",
44657
- "unlock",
44658
- "arm",
44659
- "arm-home",
44660
- "arm-away",
44661
- "arm-night",
44662
- "disarm",
44663
- "light",
44664
- "alert",
44665
- "camera"
44666
- ]);
44667
- /** A single tap-through action button. */
44668
- var NotificationActionSchema = object({
44669
- id: string(),
44670
- label: string(),
44671
- url: string().optional(),
44672
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44673
- icon: NotificationActionIconSchema.optional(),
44674
- /**
44675
- * Renders in a warning style where the notifier supports it.
44676
- *
44677
- * A HINT, never a gate. The callback's authority is its token and nothing
44678
- * else — see `notification-center/action-token.ts` for what that does and
44679
- * does not buy.
44680
- */
44681
- destructive: boolean().optional(),
44682
- /**
44683
- * How the tap should REACH the url.
44684
- *
44685
- * `navigate` (absent, and every button authored before this field) opens it:
44686
- * the phone leaves the notification and shows whatever the callback returns.
44687
- * That is right for a button whose answer the operator wants to read.
44688
- *
44689
- * `background` fires it as a POST and stays put. It exists for the buttons
44690
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44691
- * an answer to the notification, and being thrown into a browser tab to
44692
- * confirm it costs more attention than the notification did. A backend that
44693
- * cannot do a background call renders it as an ordinary link (the adapters
44694
- * fall back rather than dropping the button), so this is a preference, never
44695
- * a requirement.
44696
- */
44697
- mode: _enum(["navigate", "background"]).optional()
44698
- });
44699
- /** A delivery parameter value: what a notifier declared it takes. */
44700
- var DeliveryParamValueSchema = union([
44701
- string(),
44702
- number(),
44703
- boolean()
44704
- ]);
44705
- /**
44706
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44707
- * addresses a target of that kind may set it; a kind that declares nothing is
44708
- * never handed one. The admin UI derives its control from this descriptor —
44709
- * no editor knows a service by name.
44710
- *
44711
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44712
- * run on the addon cap path).
44713
- */
44714
- var DeliveryParamSchema = object({
44715
- key: string().min(1),
44716
- label: string(),
44717
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44718
- labelKey: string().optional(),
44719
- type: _enum([
44720
- "enum",
44721
- "number",
44722
- "boolean",
44723
- "string"
44724
- ]),
44725
- /** `enum` only: the closed set of accepted values. */
44726
- options: array(object({
44727
- value: string(),
44728
- label: string()
44729
- })).optional(),
44730
- /** `number` only. */
44731
- min: number().optional(),
44732
- max: number().optional(),
44733
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44734
- default: DeliveryParamValueSchema.optional()
44735
- });
44736
- /**
44737
- * The canonical notification. `body` is the only hard field (Apprise model).
44738
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44739
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44740
- * the adapter maps this ordinal onto its native level. `level?` is an
44741
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44742
- * `priority` for that one target.
44743
- */
44744
- var NotificationSchema = object({
44745
- body: string(),
44746
- title: string().optional(),
44747
- format: NotificationFormatSchema.default("text"),
44748
- priority: number().int().min(1).max(5).default(3),
44749
- level: string().optional(),
44750
- attachments: array(AttachmentSchema).optional(),
44751
- clickUrl: string().optional(),
44752
- actions: array(NotificationActionSchema).optional(),
44753
- sound: string().optional(),
44754
- ttl: number().optional(),
44755
- tag: string().optional(),
44756
- deviceId: number().optional(),
44757
- eventId: string().optional(),
44758
- metadata: record(string(), unknown()).optional(),
44759
- /**
44760
- * Values for the parameters the target's kind DECLARES in
44761
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44762
- * declaration by the sender; a notifier reads only the keys it declared.
44763
- */
44764
- delivery: record(string(), DeliveryParamValueSchema).optional()
44765
- });
44766
- /** One declared native severity/priority level for a kind. */
44767
- var TargetKindLevelSchema = object({
44768
- id: string(),
44769
- label: string(),
44770
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44771
- ordinal: number().int().min(1).max(5).nullable(),
44772
- flags: object({
44773
- critical: boolean().optional(),
44774
- silent: boolean().optional(),
44775
- noPush: boolean().optional()
44776
- }).optional(),
44777
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44778
- requires: array(string()).optional(),
44779
- description: string().optional()
44780
- });
44781
- /** The full capability block consulted before dispatch. */
44782
- var TargetKindCapsSchema = object({
44783
- attachments: object({
44784
- mediaTypes: array(AttachmentMediaTypeSchema),
44785
- mode: _enum([
44786
- "url",
44787
- "bytes",
44788
- "both"
44789
- ]),
44790
- max: number().int().nonnegative(),
44791
- maxBytes: number().int().positive().optional()
44792
- }),
44793
- /** Max action buttons (0 = none). */
44794
- actions: number().int().nonnegative(),
44795
- /**
44796
- * Whether this kind renders a per-action ICON.
44797
- *
44798
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44799
- * run on the addon cap path — three production failures in one day taught
44800
- * this repo that once. Absent is read as false by the degrade engine, which
44801
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44802
- * assumed and dropped costs the operator's trust in the field.
44803
- */
44804
- actionIcons: boolean().optional(),
44805
- levels: array(TargetKindLevelSchema),
44806
- format: array(NotificationFormatSchema),
44807
- clickUrl: boolean(),
44808
- sound: boolean(),
44809
- ttl: boolean(),
44810
- bodyMaxLen: number().int().positive()
44811
- });
44812
- /**
44813
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44814
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44815
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44816
- * the union is large and not meant for runtime validation here; the exported
44817
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44818
- */
44819
- var ConfigSchemaPassthrough$2 = unknown();
44820
- var TargetKindSchema = object({
44821
- kind: string(),
44822
- label: string(),
44823
- icon: string(),
44824
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44825
- addonId: string(),
44826
- /**
44827
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44828
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44829
- * when the addon bundles no icon for that kind — the client then falls back
44830
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44831
- *
44832
- * Root-relative on purpose: it resolves against whatever origin serves a web
44833
- * client, and a native client joins it onto its own hub base.
44834
- *
44835
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44836
- * field that survived only because the runtime cap-router forwards provider
44837
- * output verbatim — so every consumer had to re-declare it by hand to stop
44838
- * its own Zod parse from stripping it, and the whole arrangement would have
44839
- * broken silently the moment output validation was tightened anywhere.
44840
- */
44841
- iconUrl: string().optional(),
44842
- /**
44843
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44844
- *
44845
- * The server knows this and therefore says it, because the client cannot
44846
- * safely guess: a React-Native client renders SVG and raster through two
44847
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44848
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44849
- * placeholder glyph for every vector icon while the web build looked fine.
44850
- *
44851
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44852
- * not been updated — a client that cannot determine the type should prefer
44853
- * its raster path, which is the safe default for an unknown image.
44854
- */
44855
- iconMediaType: string().optional(),
44856
- configSchema: ConfigSchemaPassthrough$2,
44857
- /**
44858
- * The config keys that decide WHERE this kind's secrets are sent (server,
44859
- * base URL, instance, chat, recipient). A save that changes any of them
44860
- * while leaving a secret redacted is refused by the provider (D634), so an
44861
- * editor uses this to ask for the secret on exactly those edits instead of
44862
- * on every edit.
44863
- *
44864
- * Optional: absent from a provider that holds no secret (the Home Assistant
44865
- * kinds) and from a provider older than this field — an editor that finds
44866
- * it absent must assume ANY edit may need the secret.
44867
- */
44868
- destinationKeys: array(string()).optional(),
44869
- supportsDiscovery: boolean(),
44870
- /**
44871
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44872
- * Absent = none; the rule editor then offers nothing.
44873
- */
44874
- deliveryParams: array(DeliveryParamSchema).optional(),
44875
- caps: TargetKindCapsSchema
44876
- });
44877
- /**
44878
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44879
- * (return a presence marker only) when serving `listTargets` — never
44880
- * round-trip a stored secret to the UI.
44881
- */
44882
- var TargetSchema = object({
44883
- id: string(),
44884
- name: string(),
44885
- kind: string(),
44886
- addonId: string(),
44887
- enabled: boolean(),
44888
- config: record(string(), unknown())
44889
- });
44890
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44891
- var DiscoveredTargetSchema = object({
44892
- kind: string(),
44893
- suggestedName: string(),
44894
- config: record(string(), unknown())
44895
- });
44896
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44897
- var RenderedAsSchema = object({
44898
- level: string(),
44899
- format: NotificationFormatSchema,
44900
- attachmentsSent: number().int().nonnegative(),
44901
- actionsSent: number().int().nonnegative(),
44902
- truncated: boolean(),
44903
- dropped: array(string())
44904
- });
44905
- var SendResultSchema = object({
44906
- success: boolean(),
44907
- error: string().optional(),
44908
- renderedAs: RenderedAsSchema.optional()
44909
- });
44910
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44911
- var TestResultSchema = SendResultSchema;
44912
- /**
44913
- * Pre-save credential probe against a partial (unsaved) target config.
44914
- * `resolvedUrl` never includes secrets (token stripped from path).
44915
- */
44916
- var ProbeTargetConfigResultSchema = object({
44917
- ok: boolean(),
44918
- resolvedUrl: string(),
44919
- httpStatus: number().int().optional(),
44920
- stateInstance: string().optional(),
44921
- error: string().optional()
44922
- });
44923
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44924
- kind: string(),
44925
- config: record(string(), unknown()).optional(),
44926
- /**
44927
- * When editing / duplicating, the blank password field never round-trips
44928
- * the stored token. Pass the source target id so the provider can restore
44929
- * secrets server-side before dialling (same merge as upsert).
44930
- */
44931
- targetId: string().optional()
44932
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44933
- kind: string(),
44934
- config: record(string(), unknown()),
44935
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44936
- targetId: string().optional()
44937
- }), ProbeTargetConfigResultSchema, {
44938
- kind: "mutation",
44939
- auth: "admin"
44940
- }), method(object({
44941
- targetId: string(),
44942
- notification: NotificationSchema
44943
- }), SendResultSchema, {
44944
- kind: "mutation",
44945
- auth: "admin"
44946
- }), method(object({
44947
- targetId: string(),
44948
- sample: NotificationSchema.optional()
44949
- }), TestResultSchema, {
44950
- kind: "mutation",
44951
- auth: "admin"
44952
- }), method(object({
44953
- target: TargetSchema,
44954
- /**
44955
- * Duplicate flow: create a NEW target id while copying secrets from an
44956
- * existing row. The UI never holds the stored token; blank / redacted
44957
- * password fields are restored from this source (D634 still applies if
44958
- * destinations diverge without a re-typed secret).
44959
- */
44960
- cloneSecretsFrom: string().optional()
44961
- }), TargetSchema, {
44962
- kind: "mutation",
44963
- auth: "admin"
44964
- }), method(object({ targetId: string() }), _void(), {
44965
- kind: "mutation",
44966
- auth: "admin"
44967
- }), method(object({
44968
- targetId: string(),
44969
- enabled: boolean()
44970
- }), _void(), {
44971
- kind: "mutation",
44972
- auth: "admin"
44973
- });
44974
45219
  var AUDIO_MACRO_LABELS = [
44975
45220
  {
44976
45221
  id: "speech",
@@ -51387,14 +51632,6 @@ var EngineProvisioningSchema = object({
51387
51632
  */
51388
51633
  configIssues: array(string()).optional()
51389
51634
  });
51390
- var PipelineStepInputSchema = lazy(() => object({
51391
- addonId: string(),
51392
- modelId: string().optional(),
51393
- enabled: boolean().default(true),
51394
- children: array(PipelineStepInputSchema).optional(),
51395
- settings: record(string(), unknown()).optional(),
51396
- jumpDeviceKey: string().optional()
51397
- }));
51398
51635
  var ModelSubstitutionSchema = object({
51399
51636
  addonId: string(),
51400
51637
  chosen: string(),
@@ -51473,7 +51710,6 @@ var ConfigUISchemaBridge = custom();
51473
51710
  var ConfigUISchemaNullableBridge = custom();
51474
51711
  var InferenceCapabilitiesBridge = custom();
51475
51712
  var ModelAvailabilityListBridge = custom();
51476
- var PipelineRunResultBridge = custom();
51477
51713
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
51478
51714
  modelId: string(),
51479
51715
  settings: record(string(), unknown()).readonly()
@@ -59171,7 +59407,7 @@ object({
59171
59407
  /** Ms epoch of the last value received from the appliance; 0 = never. */
59172
59408
  lastFetchedAt: number()
59173
59409
  });
59174
- var DeviceIdSchema = number().int().nonnegative();
59410
+ var DeviceIdSchema$1 = number().int().nonnegative();
59175
59411
  /** A value a program option or setting can take. */
59176
59412
  var DishwasherValueSchema = union([
59177
59413
  boolean(),
@@ -59235,77 +59471,77 @@ var DishwasherOptionsSchema = object({
59235
59471
  options: array(DishwasherOptionDescriptorSchema)
59236
59472
  });
59237
59473
  DeviceType.Dishwasher, method(object({
59238
- deviceId: DeviceIdSchema,
59474
+ deviceId: DeviceIdSchema$1,
59239
59475
  program: string().min(1).optional(),
59240
59476
  options: record(string(), DishwasherValueSchema).optional()
59241
59477
  }), _void(), {
59242
59478
  kind: "mutation",
59243
59479
  auth: "protected"
59244
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59480
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59245
59481
  kind: "mutation",
59246
59482
  auth: "protected"
59247
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59483
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59248
59484
  kind: "mutation",
59249
59485
  auth: "protected"
59250
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
59486
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
59251
59487
  kind: "mutation",
59252
59488
  auth: "protected"
59253
59489
  }), method(object({
59254
- deviceId: DeviceIdSchema,
59490
+ deviceId: DeviceIdSchema$1,
59255
59491
  program: string().min(1)
59256
59492
  }), _void(), {
59257
59493
  kind: "mutation",
59258
59494
  auth: "protected"
59259
59495
  }), method(object({
59260
- deviceId: DeviceIdSchema,
59496
+ deviceId: DeviceIdSchema$1,
59261
59497
  on: boolean()
59262
59498
  }), _void(), {
59263
59499
  kind: "mutation",
59264
59500
  auth: "protected"
59265
59501
  }), method(object({
59266
- deviceId: DeviceIdSchema,
59502
+ deviceId: DeviceIdSchema$1,
59267
59503
  on: boolean()
59268
59504
  }), _void(), {
59269
59505
  kind: "mutation",
59270
59506
  auth: "protected"
59271
59507
  }), method(object({
59272
- deviceId: DeviceIdSchema,
59508
+ deviceId: DeviceIdSchema$1,
59273
59509
  on: boolean()
59274
59510
  }), _void(), {
59275
59511
  kind: "mutation",
59276
59512
  auth: "protected"
59277
59513
  }), method(object({
59278
- deviceId: DeviceIdSchema,
59514
+ deviceId: DeviceIdSchema$1,
59279
59515
  on: boolean()
59280
59516
  }), _void(), {
59281
59517
  kind: "mutation",
59282
59518
  auth: "protected"
59283
59519
  }), method(object({
59284
- deviceId: DeviceIdSchema,
59520
+ deviceId: DeviceIdSchema$1,
59285
59521
  on: boolean()
59286
59522
  }), _void(), {
59287
59523
  kind: "mutation",
59288
59524
  auth: "protected"
59289
59525
  }), method(object({
59290
- deviceId: DeviceIdSchema,
59526
+ deviceId: DeviceIdSchema$1,
59291
59527
  on: boolean()
59292
59528
  }), _void(), {
59293
59529
  kind: "mutation",
59294
59530
  auth: "protected"
59295
59531
  }), method(object({
59296
- deviceId: DeviceIdSchema,
59532
+ deviceId: DeviceIdSchema$1,
59297
59533
  on: boolean()
59298
59534
  }), _void(), {
59299
59535
  kind: "mutation",
59300
59536
  auth: "protected"
59301
59537
  }), method(object({
59302
- deviceId: DeviceIdSchema,
59538
+ deviceId: DeviceIdSchema$1,
59303
59539
  key: string().min(1),
59304
59540
  value: DishwasherValueSchema
59305
59541
  }), _void(), {
59306
59542
  kind: "mutation",
59307
59543
  auth: "protected"
59308
- }), method(object({ deviceId: DeviceIdSchema }), DishwasherOptionsSchema, { auth: "protected" });
59544
+ }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
59309
59545
  DeviceType.Camera;
59310
59546
  object({
59311
59547
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -61751,7 +61987,8 @@ var TopologyNodeSchema = object({
61751
61987
  isHub: boolean(),
61752
61988
  isOnline: boolean(),
61753
61989
  cpuPercent: number(),
61754
- memoryPercent: number(),
61990
+ /** `null` when the node's memory read failed or it has not reported one (D393). */
61991
+ memoryPercent: number().nullable(),
61755
61992
  uptime: number(),
61756
61993
  lastSeen: string(),
61757
61994
  localIps: array(string()).readonly(),
@@ -62286,9 +62523,10 @@ object({
62286
62523
  * combined reading; per-hopper levels live in `food1`/`food2`. Null when
62287
62524
  * the device has not reported yet. */
62288
62525
  foodLevel: number().nullable().meta(readingMeta("none")),
62289
- /** Food in the BOWL as the feeder reports it (`state.bowl`), in the
62290
- * feeder's own units. Null when the model reports none. */
62291
- bowlFood: number().nullable().meta(readingMeta("none")),
62526
+ /** Food in the BOWL, a mass (stored in kilograms, D944). Reported only by a
62527
+ * feeder with a bowl scale; null when the model has none or its reading is
62528
+ * of an unproven unit. */
62529
+ bowlFood: number().nullable().meta(readingMeta("mass")),
62292
62530
  /** True while the pet is eating (`state.eating`). */
62293
62531
  eating: boolean(),
62294
62532
  /** Whether `markFoodReplenished` does anything on this model. When false
@@ -62401,6 +62639,64 @@ DeviceType.PetFeeder, method(object({
62401
62639
  kind: "mutation",
62402
62640
  auth: "protected"
62403
62641
  });
62642
+ object({
62643
+ /** Water in the tank, 0..100 (%). Null while the source has not reported. */
62644
+ waterLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
62645
+ /** Water in the tank, in litres. Null while the source has not reported. */
62646
+ waterVolume: number().min(0).nullable().meta(readingMeta("volume")),
62647
+ /** True when the tank is empty. Null while unknown. */
62648
+ empty: boolean().nullable(),
62649
+ /** True while the pump is running. Null while unknown. */
62650
+ pumpRunning: boolean().nullable(),
62651
+ /** True when the pump works on an on/off duty cycle rather than continuously. */
62652
+ pumpIntervalEnabled: boolean().nullable(),
62653
+ /** How long the pump runs per cycle, in seconds. */
62654
+ pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
62655
+ /** How long the pump rests per cycle, in seconds. */
62656
+ pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
62657
+ /** Water drunk in the last drink, in litres. */
62658
+ lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
62659
+ /** Water drunk in the current hour, in litres. */
62660
+ currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
62661
+ /** Water drunk over the last 24 hours (rolling), in litres. */
62662
+ last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
62663
+ /** Water drunk since local midnight, in litres. */
62664
+ todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
62665
+ /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
62666
+ error: string().nullable(),
62667
+ /** Ms epoch when the slice was last refreshed. */
62668
+ lastFetchedAt: number()
62669
+ });
62670
+ var DeviceIdSchema = number().int().nonnegative();
62671
+ var MinutesSchema = number().int().min(0);
62672
+ DeviceType.PetFountain, method(object({
62673
+ deviceId: DeviceIdSchema,
62674
+ on: boolean()
62675
+ }), _void(), {
62676
+ kind: "mutation",
62677
+ auth: "protected"
62678
+ }), method(object({
62679
+ deviceId: DeviceIdSchema,
62680
+ on: boolean()
62681
+ }), _void(), {
62682
+ kind: "mutation",
62683
+ auth: "protected"
62684
+ }), method(object({
62685
+ deviceId: DeviceIdSchema,
62686
+ minutes: MinutesSchema
62687
+ }), _void(), {
62688
+ kind: "mutation",
62689
+ auth: "protected"
62690
+ }), method(object({
62691
+ deviceId: DeviceIdSchema,
62692
+ minutes: MinutesSchema
62693
+ }), _void(), {
62694
+ kind: "mutation",
62695
+ auth: "protected"
62696
+ }), method(object({ deviceId: DeviceIdSchema }), _void(), {
62697
+ kind: "mutation",
62698
+ auth: "protected"
62699
+ });
62404
62700
  var VehicleSchema = object({
62405
62701
  id: string(),
62406
62702
  name: string(),
@@ -67017,7 +67313,7 @@ discriminatedUnion("kind", [object({
67017
67313
  })]);
67018
67314
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
67019
67315
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
67020
- 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;
67316
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
67021
67317
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
67022
67318
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
67023
67319
  new Set(CAP_NAMES);
@@ -67070,7 +67366,7 @@ var AccessoryKind = {
67070
67366
  PrivacyMask: DeviceRole.PrivacyMask
67071
67367
  };
67072
67368
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
67073
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
67369
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
67074
67370
  new Set(Object.values(DeviceType));
67075
67371
  Object.freeze({
67076
67372
  "accessories.getStatus": {
@@ -69005,6 +69301,13 @@ Object.freeze({
69005
69301
  access: "create",
69006
69302
  role: "admin"
69007
69303
  },
69304
+ "deviceExport.exposeEntity": {
69305
+ capName: "device-export",
69306
+ capScope: "system",
69307
+ addonId: null,
69308
+ access: "create",
69309
+ role: "admin"
69310
+ },
69008
69311
  "deviceExport.getDeviceLiveContribution": {
69009
69312
  capName: "device-export",
69010
69313
  capScope: "system",
@@ -69033,6 +69336,13 @@ Object.freeze({
69033
69336
  access: "view",
69034
69337
  role: "admin"
69035
69338
  },
69339
+ "deviceExport.listExposedEntities": {
69340
+ capName: "device-export",
69341
+ capScope: "system",
69342
+ addonId: null,
69343
+ access: "view",
69344
+ role: "admin"
69345
+ },
69036
69346
  "deviceExport.listSupportedDeviceKinds": {
69037
69347
  capName: "device-export",
69038
69348
  capScope: "system",
@@ -69040,6 +69350,13 @@ Object.freeze({
69040
69350
  access: "view",
69041
69351
  role: "admin"
69042
69352
  },
69353
+ "deviceExport.listSupportedEntityKinds": {
69354
+ capName: "device-export",
69355
+ capScope: "system",
69356
+ addonId: null,
69357
+ access: "view",
69358
+ role: "admin"
69359
+ },
69043
69360
  "deviceExport.unexposeDevice": {
69044
69361
  capName: "device-export",
69045
69362
  capScope: "system",
@@ -69047,6 +69364,13 @@ Object.freeze({
69047
69364
  access: "create",
69048
69365
  role: "admin"
69049
69366
  },
69367
+ "deviceExport.unexposeEntity": {
69368
+ capName: "device-export",
69369
+ capScope: "system",
69370
+ addonId: null,
69371
+ access: "create",
69372
+ role: "admin"
69373
+ },
69050
69374
  "deviceExtension.listCandidates": {
69051
69375
  capName: "device-extension",
69052
69376
  capScope: "device",
@@ -71868,6 +72192,13 @@ Object.freeze({
71868
72192
  access: "create",
71869
72193
  role: "admin"
71870
72194
  },
72195
+ "nodeRemovalHook.onNodeRemoved": {
72196
+ capName: "node-removal-hook",
72197
+ capScope: "system",
72198
+ addonId: null,
72199
+ access: "create",
72200
+ role: "admin"
72201
+ },
71871
72202
  "nodes.clusterAddonStatus": {
71872
72203
  capName: "nodes",
71873
72204
  capScope: "system",
@@ -72505,6 +72836,48 @@ Object.freeze({
72505
72836
  access: "create",
72506
72837
  role: "viewer"
72507
72838
  },
72839
+ "petFountain.getStatus": {
72840
+ capName: "pet-fountain",
72841
+ capScope: "device",
72842
+ addonId: null,
72843
+ access: "view",
72844
+ role: "viewer"
72845
+ },
72846
+ "petFountain.resetDailyConsumption": {
72847
+ capName: "pet-fountain",
72848
+ capScope: "device",
72849
+ addonId: null,
72850
+ access: "delete",
72851
+ role: "viewer"
72852
+ },
72853
+ "petFountain.setPump": {
72854
+ capName: "pet-fountain",
72855
+ capScope: "device",
72856
+ addonId: null,
72857
+ access: "create",
72858
+ role: "viewer"
72859
+ },
72860
+ "petFountain.setPumpInterval": {
72861
+ capName: "pet-fountain",
72862
+ capScope: "device",
72863
+ addonId: null,
72864
+ access: "create",
72865
+ role: "viewer"
72866
+ },
72867
+ "petFountain.setPumpOffMinutes": {
72868
+ capName: "pet-fountain",
72869
+ capScope: "device",
72870
+ addonId: null,
72871
+ access: "create",
72872
+ role: "viewer"
72873
+ },
72874
+ "petFountain.setPumpOnMinutes": {
72875
+ capName: "pet-fountain",
72876
+ capScope: "device",
72877
+ addonId: null,
72878
+ access: "create",
72879
+ role: "viewer"
72880
+ },
72508
72881
  "pipelineAnalytics.addRetrainFrameFromRecording": {
72509
72882
  capName: "pipeline-analytics",
72510
72883
  capScope: "device",
@@ -78987,6 +79360,100 @@ var APPLIANCE_CAP_VOCABULARY = {
78987
79360
  }
78988
79361
  ]
78989
79362
  },
79363
+ "pet-fountain": {
79364
+ scope: "device",
79365
+ noun: t("Pet fountain", "Fontana per animali"),
79366
+ actions: [
79367
+ {
79368
+ id: "petFountain.pumpOn",
79369
+ method: "setPump",
79370
+ label: t("Pump on", "Pompa accesa"),
79371
+ phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
79372
+ icon: "play",
79373
+ args: { on: true }
79374
+ },
79375
+ {
79376
+ id: "petFountain.pumpOff",
79377
+ method: "setPump",
79378
+ label: t("Pump off", "Pompa spenta"),
79379
+ phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
79380
+ icon: "square",
79381
+ args: { on: false }
79382
+ },
79383
+ {
79384
+ id: "petFountain.intervalOn",
79385
+ method: "setPumpInterval",
79386
+ label: t("Pump cycle on", "Ciclo pompa attivo"),
79387
+ phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
79388
+ icon: "timer",
79389
+ args: { on: true }
79390
+ },
79391
+ {
79392
+ id: "petFountain.intervalOff",
79393
+ method: "setPumpInterval",
79394
+ label: t("Pump cycle off", "Ciclo pompa spento"),
79395
+ phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
79396
+ icon: "timer-off",
79397
+ args: { on: false }
79398
+ },
79399
+ {
79400
+ id: "petFountain.pumpOnMinutes",
79401
+ method: "setPumpOnMinutes",
79402
+ label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
79403
+ phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
79404
+ icon: "timer",
79405
+ openArgs: [{
79406
+ key: "minutes",
79407
+ label: t("Minutes", "Minuti"),
79408
+ offer: {
79409
+ kind: "number",
79410
+ min: 0,
79411
+ step: 1,
79412
+ unit: "min"
79413
+ }
79414
+ }]
79415
+ },
79416
+ {
79417
+ id: "petFountain.pumpOffMinutes",
79418
+ method: "setPumpOffMinutes",
79419
+ label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
79420
+ phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
79421
+ icon: "timer-off",
79422
+ openArgs: [{
79423
+ key: "minutes",
79424
+ label: t("Minutes", "Minuti"),
79425
+ offer: {
79426
+ kind: "number",
79427
+ min: 0,
79428
+ step: 1,
79429
+ unit: "min"
79430
+ }
79431
+ }]
79432
+ },
79433
+ {
79434
+ id: "petFountain.resetDailyConsumption",
79435
+ method: "resetDailyConsumption",
79436
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
79437
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
79438
+ icon: "rotate-ccw"
79439
+ }
79440
+ ],
79441
+ state: [{
79442
+ kind: "boolean",
79443
+ field: "empty",
79444
+ label: t("Tank empty", "Serbatoio vuoto"),
79445
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
79446
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
79447
+ icon: "droplet"
79448
+ }, {
79449
+ kind: "numeric",
79450
+ field: "waterLevel",
79451
+ quantity: t("the water level", "il livello dell’acqua"),
79452
+ label: t("Water level", "Livello dell’acqua"),
79453
+ unit: "%",
79454
+ icon: "droplets"
79455
+ }]
79456
+ },
78990
79457
  "media-player": {
78991
79458
  scope: "device",
78992
79459
  noun: t("Media player", "Lettore multimediale"),
@@ -80811,6 +81278,7 @@ var SYSTEM_CAP_VOCABULARY = {
80811
81278
  "device-manager": system("the device registry itself — rename, move and remove are administration"),
80812
81279
  "device-provider": system(INTERNAL),
80813
81280
  "device-removal-hook": system(INTERNAL),
81281
+ "node-removal-hook": system(INTERNAL),
80814
81282
  "device-state": system("the runtime-state mirror every trigger already reads through"),
80815
81283
  "display-palette": system("the cluster display palette — one colour table for every client, not a device action"),
80816
81284
  "embedding-encoder": system(ML),
@@ -80923,7 +81391,7 @@ function projectAction(cap, action) {
80923
81391
  };
80924
81392
  }
80925
81393
  Object.entries(CAP_VOCABULARY_BY_NAME).flatMap(([cap, entry]) => entry.scope === "device" ? (entry.actions ?? []).map((a) => projectAction(cap, a)) : []);
80926
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
81394
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer;
80927
81395
  DeviceFeature.BatteryOperated;
80928
81396
  /**
80929
81397
  * How a washer, dryer or dishwasher leaves CamStack.
@@ -82499,6 +82967,36 @@ Object.freeze({
82499
82967
  form: "single",
82500
82968
  optional: false
82501
82969
  }],
82970
+ "petFountain.getStatus": [{
82971
+ name: "deviceId",
82972
+ form: "single",
82973
+ optional: false
82974
+ }],
82975
+ "petFountain.resetDailyConsumption": [{
82976
+ name: "deviceId",
82977
+ form: "single",
82978
+ optional: false
82979
+ }],
82980
+ "petFountain.setPump": [{
82981
+ name: "deviceId",
82982
+ form: "single",
82983
+ optional: false
82984
+ }],
82985
+ "petFountain.setPumpInterval": [{
82986
+ name: "deviceId",
82987
+ form: "single",
82988
+ optional: false
82989
+ }],
82990
+ "petFountain.setPumpOffMinutes": [{
82991
+ name: "deviceId",
82992
+ form: "single",
82993
+ optional: false
82994
+ }],
82995
+ "petFountain.setPumpOnMinutes": [{
82996
+ name: "deviceId",
82997
+ form: "single",
82998
+ optional: false
82999
+ }],
82502
83000
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
82503
83001
  name: "deviceId",
82504
83002
  form: "single",
@@ -85443,7 +85941,7 @@ async function releaseAlexaEgress(input) {
85443
85941
  tags: { deviceId },
85444
85942
  meta: {
85445
85943
  pipelineKey,
85446
- error: errMsg(err)
85944
+ error: errMsg$1(err)
85447
85945
  }
85448
85946
  });
85449
85947
  }
@@ -85497,7 +85995,7 @@ async function profileForCamStream(input) {
85497
85995
  } catch (err) {
85498
85996
  input.logger?.warn("alexa rtc-session: could not read the profile slots", {
85499
85997
  tags: { deviceId: input.deviceId },
85500
- meta: { error: errMsg(err) }
85998
+ meta: { error: errMsg$1(err) }
85501
85999
  });
85502
86000
  return null;
85503
86001
  }
@@ -87569,7 +88067,7 @@ async function pollUntilReached(plan, deps, untilMs) {
87569
88067
  const read = await plan.read().catch((err) => {
87570
88068
  deps.logger.debug("alexa deferred directive: read-back failed — polling on", {
87571
88069
  tags: { deviceId: plan.deviceId },
87572
- meta: { error: errMsg(err) }
88070
+ meta: { error: errMsg$1(err) }
87573
88071
  });
87574
88072
  return null;
87575
88073
  });
@@ -87617,7 +88115,7 @@ async function runWithDeferral(plan, deps) {
87617
88115
  try {
87618
88116
  await plan.command();
87619
88117
  } catch (err) {
87620
- const message = errMsg(err);
88118
+ const message = errMsg$1(err);
87621
88119
  deps.logger.warn(`alexa deferred directive: ${plan.header.name} command failed`, {
87622
88120
  tags: { deviceId: plan.deviceId },
87623
88121
  meta: { error: message }
@@ -87635,7 +88133,7 @@ async function runWithDeferral(plan, deps) {
87635
88133
  const settled = settleInBackground(plan, deps).catch((err) => {
87636
88134
  deps.logger.warn("alexa deferred directive: settling failed", {
87637
88135
  tags: { deviceId: plan.deviceId },
87638
- meta: { error: errMsg(err) }
88136
+ meta: { error: errMsg$1(err) }
87639
88137
  });
87640
88138
  });
87641
88139
  return {
@@ -89383,13 +89881,13 @@ var AlexaAccessGate = class {
89383
89881
  if (!this.warnedStale) {
89384
89882
  this.warnedStale = true;
89385
89883
  this.deps.logger.warn("alexa access: the hub user store could not be re-read — keeping the last good grants", { meta: {
89386
- error: errMsg(err),
89884
+ error: errMsg$1(err),
89387
89885
  ageMs: this.now() - cached.at
89388
89886
  } });
89389
89887
  }
89390
89888
  return cached;
89391
89889
  }
89392
- this.deps.logger.warn("alexa access: the hub user store could not be read — refusing Alexa access until it can", { meta: { error: errMsg(err) } });
89890
+ this.deps.logger.warn("alexa access: the hub user store could not be read — refusing Alexa access until it can", { meta: { error: errMsg$1(err) } });
89393
89891
  return null;
89394
89892
  }
89395
89893
  }
@@ -89406,7 +89904,7 @@ var AlexaAccessGate = class {
89406
89904
  } catch (err) {
89407
89905
  this.deps.logger.debug("alexa access: device metadata read failed", {
89408
89906
  tags: { deviceId },
89409
- meta: { error: errMsg(err) }
89907
+ meta: { error: errMsg$1(err) }
89410
89908
  });
89411
89909
  return cached?.meta ?? null;
89412
89910
  }
@@ -89441,12 +89939,209 @@ async function readConnectivity(api, deviceId, logger) {
89441
89939
  } catch (err) {
89442
89940
  logger.debug("alexa: device-status unreadable — reporting connectivity OK", {
89443
89941
  tags: { deviceId },
89444
- meta: { error: errMsg(err) }
89942
+ meta: { error: errMsg$1(err) }
89445
89943
  });
89446
89944
  return "OK";
89447
89945
  }
89448
89946
  }
89449
89947
  //#endregion
89948
+ //#region src/action-scenes.ts
89949
+ /**
89950
+ * Actions exported to Alexa as SCENES (D968).
89951
+ *
89952
+ * Alexa has no "run" verb for an arbitrary automation, but it has a scene: an
89953
+ * endpoint with `Alexa.SceneController` whose Activate directive fires
89954
+ * something. An action is exactly that, so it is exported as a scene trigger
89955
+ * and Activate runs `actions.run`.
89956
+ *
89957
+ * An action is a list entry, never a device (D954), so its endpoint id lives
89958
+ * outside the numeric device id space (`action:<id>`, which the device id
89959
+ * parser rejects) and nothing here touches the device registry or the
89960
+ * per-device sync engine.
89961
+ *
89962
+ * `actions.run` is an admin act, so only an ADMIN link sees or fires a scene.
89963
+ * A scoped (non-admin) link is told the endpoint does not exist.
89964
+ *
89965
+ * Whether the run is accepted is decided by `actions.run`: an action that is
89966
+ * already running or in cooldown is refused with a named reason (logged by
89967
+ * `runExportedAction`) and answered `ENDPOINT_BUSY` — never queued.
89968
+ */
89969
+ var EXPORTER = "export-alexa";
89970
+ var PREFIX = "action:";
89971
+ var SCENE_INTERFACE = "Alexa.SceneController";
89972
+ function actionEndpointId(actionId) {
89973
+ return `${PREFIX}${actionId}`;
89974
+ }
89975
+ /** The action id an endpoint id names, or null when it is not an action endpoint. */
89976
+ function parseActionEndpointId(endpointId) {
89977
+ if (!endpointId.startsWith(PREFIX)) return null;
89978
+ const id = endpointId.slice(7);
89979
+ return id.length === 0 ? null : id;
89980
+ }
89981
+ function buildActionSceneEndpoint(entry) {
89982
+ return {
89983
+ endpointId: actionEndpointId(entry.actionId),
89984
+ manufacturerName: "CamStack",
89985
+ description: "CamStack action",
89986
+ friendlyName: entry.displayName,
89987
+ displayCategories: ["SCENE_TRIGGER"],
89988
+ capabilities: [{
89989
+ type: "AlexaInterface",
89990
+ interface: "Alexa",
89991
+ version: "3"
89992
+ }, {
89993
+ type: "AlexaInterface",
89994
+ interface: SCENE_INTERFACE,
89995
+ version: "3",
89996
+ supportsDeactivation: false,
89997
+ proactivelyReported: false
89998
+ }]
89999
+ };
90000
+ }
90001
+ function sceneResponse(header, endpointId) {
90002
+ return { event: {
90003
+ header: {
90004
+ namespace: SCENE_INTERFACE,
90005
+ name: "ActivationStarted",
90006
+ messageId: header.messageId,
90007
+ ...header.correlationToken !== void 0 ? { correlationToken: header.correlationToken } : {},
90008
+ payloadVersion: "3"
90009
+ },
90010
+ endpoint: { endpointId },
90011
+ payload: {
90012
+ cause: { type: "VOICE_INTERACTION" },
90013
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
90014
+ }
90015
+ } };
90016
+ }
90017
+ /** Answer a directive addressed to an action endpoint. */
90018
+ async function handleActionSceneDirective(header, endpoint, principal, deps) {
90019
+ const actionId = parseActionEndpointId(endpoint.endpointId);
90020
+ if (actionId === null) return errorEnvelope(header, "NO_SUCH_ENDPOINT", "not an action endpoint");
90021
+ if (principal.kind !== "admin" || !deps.isExposed(actionId)) {
90022
+ deps.logger.warn("alexa action-scene: directive refused — endpoint not visible to this link", {
90023
+ tags: { actionId },
90024
+ meta: { reason: principal.kind !== "admin" ? "not-admin" : "not-exported" }
90025
+ });
90026
+ return errorEnvelope(header, "NO_SUCH_ENDPOINT", "unknown endpoint");
90027
+ }
90028
+ if (header.namespace !== SCENE_INTERFACE || header.name !== "Activate") return errorEnvelope(header, "INVALID_DIRECTIVE", "an action endpoint only supports Activate");
90029
+ const result = await runExportedAction(deps.api, deps.logger, {
90030
+ exporter: EXPORTER,
90031
+ actionId
90032
+ });
90033
+ switch (result.status) {
90034
+ case "started": return sceneResponse(header, endpoint.endpointId);
90035
+ case "refused": return result.reason === "not-found" ? errorEnvelope(header, "NO_SUCH_ENDPOINT", "the action no longer exists") : errorEnvelope(header, "ENDPOINT_BUSY", `the action cannot run now (${result.reason})`);
90036
+ case "failed": return errorEnvelope(header, "ENDPOINT_UNREACHABLE", result.message);
90037
+ }
90038
+ }
90039
+ function errMsg(err) {
90040
+ return err instanceof Error ? err.message : String(err);
90041
+ }
90042
+ var ActionSceneExports = class {
90043
+ ports;
90044
+ entries;
90045
+ constructor(ports, initial) {
90046
+ this.ports = ports;
90047
+ this.entries = initial;
90048
+ }
90049
+ isExposed(actionId) {
90050
+ return this.entries.some((e) => e.actionId === actionId);
90051
+ }
90052
+ list() {
90053
+ return this.entries.map((e) => ({
90054
+ entity: {
90055
+ kind: "action",
90056
+ actionId: e.actionId
90057
+ },
90058
+ exposedAs: e.displayName
90059
+ }));
90060
+ }
90061
+ /** The scenes Discovery adds for this link: admins only. */
90062
+ endpointsFor(principal) {
90063
+ if (principal.kind !== "admin") return [];
90064
+ return this.entries.map(buildActionSceneEndpoint);
90065
+ }
90066
+ async expose(actionId) {
90067
+ const action = (await this.ports.api.actions.list.query({})).find((a) => a.id === actionId);
90068
+ if (action === void 0) throw new Error(`export-alexa: action '${actionId}' does not exist`);
90069
+ const entry = {
90070
+ actionId,
90071
+ displayName: action.name,
90072
+ addedAt: this.entries.find((e) => e.actionId === actionId)?.addedAt ?? Date.now()
90073
+ };
90074
+ await this.save([...this.entries.filter((e) => e.actionId !== actionId), entry]);
90075
+ await this.pushToAdmins([buildActionSceneEndpoint(entry)]);
90076
+ this.ports.logger.info("export-alexa: exposed action as a scene", {
90077
+ tags: { actionId },
90078
+ meta: { displayName: action.name }
90079
+ });
90080
+ }
90081
+ async unexpose(actionId) {
90082
+ if (this.isExposed(actionId)) await this.save(this.entries.filter((e) => e.actionId !== actionId));
90083
+ await this.deleteFromAll([actionEndpointId(actionId)]);
90084
+ this.ports.logger.info("export-alexa: unexposed action scene", { tags: { actionId } });
90085
+ }
90086
+ /** Push every scene (boot, relink). */
90087
+ async pushAll() {
90088
+ await this.pushToAdmins(this.entries.map(buildActionSceneEndpoint));
90089
+ }
90090
+ /**
90091
+ * Drop what the operator deleted. An action list that could not be read
90092
+ * changes nothing (D49).
90093
+ */
90094
+ async reconcile() {
90095
+ if (this.entries.length === 0) return;
90096
+ let live;
90097
+ try {
90098
+ const actions = await this.ports.api.actions.list.query({});
90099
+ live = new Set(actions.map((a) => a.id));
90100
+ } catch (err) {
90101
+ this.ports.logger.warn("export-alexa: action scenes not reconciled — list unanswered", { meta: { error: errMsg(err) } });
90102
+ return;
90103
+ }
90104
+ const { dropped } = pruneDeletedEntities(this.entries.map((e) => ({
90105
+ kind: "action",
90106
+ actionId: e.actionId
90107
+ })), {
90108
+ actionIds: live,
90109
+ targetIds: /* @__PURE__ */ new Set()
90110
+ }, this.ports.logger, EXPORTER);
90111
+ if (dropped.length === 0) return;
90112
+ const gone = new Set(dropped.flatMap((r) => r.kind === "action" ? [r.actionId] : []));
90113
+ await this.save(this.entries.filter((e) => !gone.has(e.actionId)));
90114
+ await this.deleteFromAll([...gone].map(actionEndpointId));
90115
+ }
90116
+ async save(next) {
90117
+ this.entries = next;
90118
+ await this.ports.persist(next);
90119
+ }
90120
+ async pushToAdmins(endpoints) {
90121
+ if (endpoints.length === 0 || !this.ports.canPush()) return;
90122
+ for (const userId of this.ports.linkedUserIds()) try {
90123
+ if (!await this.ports.isAdminUser(userId)) continue;
90124
+ await this.ports.postAddOrUpdate(userId, endpoints);
90125
+ } catch (err) {
90126
+ this.ports.logger.warn("export-alexa: action scene push failed", { meta: {
90127
+ userId,
90128
+ error: errMsg(err)
90129
+ } });
90130
+ }
90131
+ }
90132
+ async deleteFromAll(ids) {
90133
+ if (ids.length === 0 || !this.ports.canPush()) return;
90134
+ for (const userId of this.ports.linkedUserIds()) try {
90135
+ await this.ports.postDelete(userId, ids);
90136
+ } catch (err) {
90137
+ this.ports.logger.warn("export-alexa: action scene delete failed", { meta: {
90138
+ userId,
90139
+ error: errMsg(err)
90140
+ } });
90141
+ }
90142
+ }
90143
+ };
90144
+ //#endregion
89450
90145
  //#region src/endpoints/validate-instanced.ts
89451
90146
  /**
89452
90147
  * Amazon's rules for the INSTANCED interfaces' extra fields (D869), the ones a
@@ -89670,7 +90365,8 @@ var ALLOWED_INTERFACE_VERSIONS = {
89670
90365
  "Alexa.ThermostatController": "3.1",
89671
90366
  "Alexa.SmartVision.SnapshotProvider": "1.1",
89672
90367
  "Alexa.SmartVision.ObjectDetectionSensor": "1.0",
89673
- "Alexa.DataController": "1.0"
90368
+ "Alexa.DataController": "1.0",
90369
+ "Alexa.SceneController": "3"
89674
90370
  };
89675
90371
  /** `imageNetClass` values Amazon accepts (alexa-smartvision-objectdetectionsensor). */
89676
90372
  var SMART_VISION_CLASSES = new Set(["person", "package"]);
@@ -89712,6 +90408,7 @@ var DISPLAY_CATEGORIES = new Set([
89712
90408
  "DOOR",
89713
90409
  "GATE",
89714
90410
  "GARAGE_DOOR",
90411
+ "SCENE_TRIGGER",
89715
90412
  "OTHER"
89716
90413
  ]);
89717
90414
  var ENDPOINT_ID_PATTERN = /^[A-Za-z0-9 _\-=#;:?@&]{1,256}$/;
@@ -91607,6 +92304,7 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
91607
92304
  "Alexa.DataController/DeleteData": "view",
91608
92305
  "Alexa.LockController/Lock": "create",
91609
92306
  "Alexa.LockController/Unlock": "create",
92307
+ "Alexa.SceneController/Activate": "create",
91610
92308
  ...Object.fromEntries(GENERIC_DIRECTIVE_KEYS.map((k) => [k, "create"]))
91611
92309
  };
91612
92310
  try {
@@ -91638,6 +92336,17 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
91638
92336
  body: errorEnvelope(header, "INTERNAL_ERROR", lookup.error)
91639
92337
  };
91640
92338
  principal = lookup.principal;
92339
+ if (endpoint !== void 0 && deps.actionScenes !== void 0 && parseActionEndpointId(endpoint.endpointId) !== null) {
92340
+ const scenes = deps.actionScenes;
92341
+ return {
92342
+ status: 200,
92343
+ body: await handleActionSceneDirective(header, endpoint, principal, {
92344
+ api: scenes.api,
92345
+ logger: scenes.logger,
92346
+ isExposed: (actionId) => scenes.exports.isExposed(actionId)
92347
+ })
92348
+ };
92349
+ }
91641
92350
  if (key !== "Alexa.Discovery/Discover") {
91642
92351
  if (endpoint === void 0) return {
91643
92352
  status: 200,
@@ -91690,7 +92399,8 @@ async function dispatchParsedDirective(rawBody, deps, callerIdentity) {
91690
92399
  reason: describeRefusal(r.refusal)
91691
92400
  }))
91692
92401
  } });
91693
- const valid = withholdInvalidEndpoints(filtered.kept, (message, violations) => {
92402
+ const scenes = deps.actionScenes?.exports.endpointsFor(who) ?? [];
92403
+ const valid = withholdInvalidEndpoints([...filtered.kept, ...scenes], (message, violations) => {
91694
92404
  deps.discovery.logger.warn(message, { meta: {
91695
92405
  userId: callerIdentity.userId,
91696
92406
  violations
@@ -93963,7 +94673,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93963
94673
  tags: { deviceId },
93964
94674
  meta: {
93965
94675
  userId: change.userId,
93966
- error: errMsg(err)
94676
+ error: errMsg$1(err)
93967
94677
  }
93968
94678
  });
93969
94679
  return false;
@@ -93982,7 +94692,7 @@ async function applyVisibilityChanges(changes, target, logger) {
93982
94692
  tags: { deviceId },
93983
94693
  meta: {
93984
94694
  userId: change.userId,
93985
- error: errMsg(err)
94695
+ error: errMsg$1(err)
93986
94696
  }
93987
94697
  });
93988
94698
  return false;
@@ -94036,7 +94746,7 @@ var DetectionClassSource = class {
94036
94746
  } catch (err) {
94037
94747
  this.deps.logger.debug("alexa detection sensors: class read failed — keeping the last answer", {
94038
94748
  tags: { deviceId },
94039
- meta: { error: errMsg(err) }
94749
+ meta: { error: errMsg$1(err) }
94040
94750
  });
94041
94751
  return prev?.classes ?? [];
94042
94752
  }
@@ -94129,7 +94839,7 @@ var DetectionSensorFeed = class {
94129
94839
  } catch (err) {
94130
94840
  this.deps.logger.debug("alexa detection sensors: active-track read failed — kept as is", {
94131
94841
  tags: { deviceId },
94132
- meta: { error: errMsg(err) }
94842
+ meta: { error: errMsg$1(err) }
94133
94843
  });
94134
94844
  }
94135
94845
  }
@@ -94141,7 +94851,7 @@ var DetectionSensorFeed = class {
94141
94851
  meta: {
94142
94852
  detectionClass: cls,
94143
94853
  present,
94144
- error: errMsg(err)
94854
+ error: errMsg$1(err)
94145
94855
  }
94146
94856
  });
94147
94857
  });
@@ -94260,7 +94970,7 @@ var ObjectDetectionFeed = class {
94260
94970
  tags: { deviceId: parsed.data.deviceId },
94261
94971
  meta: {
94262
94972
  trackId: parsed.data.trackId,
94263
- error: errMsg(err)
94973
+ error: errMsg$1(err)
94264
94974
  }
94265
94975
  });
94266
94976
  });
@@ -94450,7 +95160,7 @@ var AlexaVisionRuntime = class {
94450
95160
  } catch (err) {
94451
95161
  this.deps.logger.debug("alexa: per-device settings unreadable — using defaults", {
94452
95162
  tags: { deviceId },
94453
- meta: { error: errMsg(err) }
95163
+ meta: { error: errMsg$1(err) }
94454
95164
  });
94455
95165
  return {};
94456
95166
  }
@@ -94548,7 +95258,7 @@ var AlexaVisionRuntime = class {
94548
95258
  tags: { deviceId },
94549
95259
  meta: {
94550
95260
  trackId,
94551
- error: errMsg(err)
95261
+ error: errMsg$1(err)
94552
95262
  }
94553
95263
  });
94554
95264
  return null;
@@ -95218,7 +95928,7 @@ var StateChangeReporter = class {
95218
95928
  shaper;
95219
95929
  constructor(deps) {
95220
95930
  this.deps = deps;
95221
- this.shaper = new ReportShaper((err) => this.deps.logger.warn("alexa state reports: a shaped report failed", { meta: { error: errMsg(err) } }), this.deps.clock);
95931
+ this.shaper = new ReportShaper((err) => this.deps.logger.warn("alexa state reports: a shaped report failed", { meta: { error: errMsg$1(err) } }), this.deps.clock);
95222
95932
  }
95223
95933
  start() {
95224
95934
  this.off = this.deps.eventBus.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
@@ -95255,7 +95965,7 @@ var StateChangeReporter = class {
95255
95965
  tags: { deviceId: change.deviceId },
95256
95966
  meta: {
95257
95967
  capName: change.capName,
95258
- error: errMsg(err)
95968
+ error: errMsg$1(err)
95259
95969
  }
95260
95970
  });
95261
95971
  }
@@ -95289,7 +95999,7 @@ var StateChangeReporter = class {
95289
95999
  tags: { deviceId: change.deviceId },
95290
96000
  meta: {
95291
96001
  capName: change.capName,
95292
- error: errMsg(err)
96002
+ error: errMsg$1(err)
95293
96003
  }
95294
96004
  });
95295
96005
  }
@@ -95378,7 +96088,7 @@ var StateReconciler = class {
95378
96088
  });
95379
96089
  }
95380
96090
  } catch (err) {
95381
- this.deps.logger.warn("alexa state reconcile: a pass failed", { meta: { error: errMsg(err) } });
96091
+ this.deps.logger.warn("alexa state reconcile: a pass failed", { meta: { error: errMsg$1(err) } });
95382
96092
  } finally {
95383
96093
  this.running = false;
95384
96094
  }
@@ -95842,6 +96552,7 @@ var DEFAULT_CONFIG = {
95842
96552
  advertisedBrokerUrl: "",
95843
96553
  region: "NA",
95844
96554
  exposed: [],
96555
+ exposedActions: [],
95845
96556
  linkedAccounts: [],
95846
96557
  tokens: [],
95847
96558
  exportedEndpoints: {},
@@ -95905,6 +96616,8 @@ var ExportAlexaAddon = class extends BaseAddon {
95905
96616
  lwaGateway = null;
95906
96617
  egressPrewarm = null;
95907
96618
  syncEngine = null;
96619
+ /** D968: exported actions, answered as Alexa scenes. */
96620
+ actionScenes = null;
95908
96621
  /** S1 (D767): the linking user's live grants. Built in `onInitialize`, the
95909
96622
  * first point `ctx` exists. */
95910
96623
  accessGateRef = null;
@@ -95936,7 +96649,7 @@ var ExportAlexaAddon = class extends BaseAddon {
95936
96649
  }
95937
96650
  await this.backfillLinkedAccounts();
95938
96651
  this.autoDetectPublicHubUrl().catch((err) => {
95939
- this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg(err) } });
96652
+ this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg$1(err) } });
95940
96653
  });
95941
96654
  this.accessGateRef = createHubAccessGate(this.ctx);
95942
96655
  this.detectionClassSource = new DetectionClassSource({
@@ -95965,6 +96678,23 @@ var ExportAlexaAddon = class extends BaseAddon {
95965
96678
  store: this.snapshotStore,
95966
96679
  post: (opts) => this.requireGateway().postObjectDetection(opts)
95967
96680
  });
96681
+ this.actionScenes = new ActionSceneExports({
96682
+ api: this.ctx.api,
96683
+ logger: this.ctx.logger,
96684
+ linkedUserIds: () => this.config.linkedAccounts.map((a) => a.userId),
96685
+ isAdminUser: async (userId) => {
96686
+ const lookup = await this.accessGate.principal(userId);
96687
+ return lookup.kind === "found" && lookup.principal.kind === "admin";
96688
+ },
96689
+ canPush: () => this.config.tokens.length > 0,
96690
+ postAddOrUpdate: (userId, endpoints) => this.requireGateway().postReport(userId, (accessToken) => buildAddOrUpdateReportPayload(userId, endpoints, accessToken), `action scenes add/update (${endpoints.length})`),
96691
+ postDelete: (userId, ids) => this.requireGateway().postReport(userId, (accessToken) => buildDeleteReportPayload(userId, ids, accessToken), `action scenes delete (${ids.length})`),
96692
+ persist: (entries) => this.updateGlobalSettings({ exposedActions: [...entries] })
96693
+ }, this.config.exposedActions ?? []);
96694
+ const actionScenes = this.actionScenes;
96695
+ actionScenes.reconcile().catch((err) => {
96696
+ this.ctx.logger.warn("export-alexa: action scene reconcile at boot failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
96697
+ });
95968
96698
  const deviceExportProvider = {
95969
96699
  getStatus: async () => ({
95970
96700
  linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
@@ -95975,6 +96705,24 @@ var ExportAlexaAddon = class extends BaseAddon {
95975
96705
  listExposedDevices: async () => this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) })),
95976
96706
  exposeDevice: async ({ deviceId }) => this.exposeDevice(deviceId),
95977
96707
  unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
96708
+ listSupportedEntityKinds: async () => ["device", "action"],
96709
+ listExposedEntities: async () => {
96710
+ await actionScenes.reconcile();
96711
+ return [...this.config.exposed.map((e) => ({ entity: {
96712
+ kind: "device",
96713
+ deviceId: String(e.deviceId)
96714
+ } })), ...actionScenes.list()];
96715
+ },
96716
+ exposeEntity: async ({ entity }) => {
96717
+ if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
96718
+ if (entity.kind === "action") return actionScenes.expose(entity.actionId);
96719
+ throw new Error("export-alexa: a notification target cannot be exported to Alexa");
96720
+ },
96721
+ unexposeEntity: async ({ entity }) => {
96722
+ if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
96723
+ if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
96724
+ throw new Error("export-alexa: a notification target cannot be exported to Alexa");
96725
+ },
95978
96726
  getDeviceSettingsContribution: (input) => this.buildDeviceSettingsContribution(Number(input.deviceId)),
95979
96727
  getDeviceLiveContribution: async () => null,
95980
96728
  applyDeviceSettingsPatch: (input) => this.applyDeviceSettingsPatch(Number(input.deviceId), input.patch)
@@ -96047,6 +96795,11 @@ var ExportAlexaAddon = class extends BaseAddon {
96047
96795
  },
96048
96796
  vision: this.vision.context(),
96049
96797
  access: this.endpointAccess,
96798
+ actionScenes: {
96799
+ exports: actionScenes,
96800
+ api: this.ctx.api,
96801
+ logger: this.ctx.logger
96802
+ },
96050
96803
  afterDiscovery: (userId, endpoints) => this.requireGateway().scheduleInitialConnectivity(userId, endpoints)
96051
96804
  },
96052
96805
  lwaTokensCallbackDeps: {
@@ -96171,7 +96924,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96171
96924
  this.redetectPublicHubUrl().then(({ publicHubUrl }) => {
96172
96925
  this.ctx.logger.info("export-alexa: re-detected public hub URL after tunnel connect", { meta: { publicHubUrl } });
96173
96926
  }).catch((err) => {
96174
- this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg(err) } });
96927
+ this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg$1(err) } });
96175
96928
  });
96176
96929
  });
96177
96930
  this.ctx.addDisposer(async () => offTunnelStarted());
@@ -96245,12 +96998,13 @@ var ExportAlexaAddon = class extends BaseAddon {
96245
96998
  this.lwaGateway = null;
96246
96999
  }
96247
97000
  this.syncEngine = null;
97001
+ this.actionScenes = null;
96248
97002
  }
96249
97003
  async exposeDevice(deviceIdRaw) {
96250
97004
  const deviceId = Number.parseInt(deviceIdRaw, 10);
96251
97005
  if (!Number.isFinite(deviceId)) throw new Error(`export-alexa: deviceId must be numeric — got "${deviceIdRaw}"`);
96252
97006
  if (!await this.ctx.api.deviceManager.getDevice.query({ deviceId }).catch((err) => {
96253
- throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg(err)}`);
97007
+ throw new Error(`export-alexa: deviceManager.getDevice failed: ${errMsg$1(err)}`);
96254
97008
  })) throw new Error(`export-alexa: device ${deviceId} not found`);
96255
97009
  const next = this.config.exposed.filter((e) => e.deviceId !== deviceId);
96256
97010
  next.push({
@@ -96266,7 +97020,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96266
97020
  }).catch((err) => {
96267
97021
  this.ctx.logger.warn("export-alexa: expose sync failed", { meta: {
96268
97022
  deviceId,
96269
- error: errMsg(err)
97023
+ error: errMsg$1(err)
96270
97024
  } });
96271
97025
  });
96272
97026
  }
@@ -96280,7 +97034,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96280
97034
  this.requireSyncEngine().removeDevice(deviceId).catch((err) => {
96281
97035
  this.ctx.logger.warn("export-alexa: unexpose delete failed", { meta: {
96282
97036
  deviceId,
96283
- error: errMsg(err)
97037
+ error: errMsg$1(err)
96284
97038
  } });
96285
97039
  });
96286
97040
  }
@@ -96328,14 +97082,14 @@ var ExportAlexaAddon = class extends BaseAddon {
96328
97082
  const engine = this.syncEngine;
96329
97083
  if (engine === null) return;
96330
97084
  engine.reconcileAllExposed().catch((err) => {
96331
- this.ctx.logger.warn("export-alexa: re-sync after a switch change failed", { meta: { error: errMsg(err) } });
97085
+ this.ctx.logger.warn("export-alexa: re-sync after a switch change failed", { meta: { error: errMsg$1(err) } });
96332
97086
  });
96333
97087
  }
96334
97088
  scheduleDetectionClassRefresh() {
96335
97089
  const timer = setInterval(() => {
96336
97090
  if (!this.config.detectionSensors && !this.config.objectDetection) return;
96337
97091
  this.requireSyncEngine().reconcileAllExposed().catch((err) => {
96338
- this.ctx.logger.warn("export-alexa: detection-class refresh failed", { meta: { error: errMsg(err) } });
97092
+ this.ctx.logger.warn("export-alexa: detection-class refresh failed", { meta: { error: errMsg$1(err) } });
96339
97093
  });
96340
97094
  }, DETECTION_CLASS_REFRESH_MS);
96341
97095
  timer.unref?.();
@@ -96362,7 +97116,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96362
97116
  try {
96363
97117
  await applyVisibilityChanges(await this.visibility.refresh(), this.requireSyncEngine(), this.ctx.logger);
96364
97118
  } catch (err) {
96365
- this.ctx.logger.warn("export-alexa: visibility refresh failed", { meta: { error: errMsg(err) } });
97119
+ this.ctx.logger.warn("export-alexa: visibility refresh failed", { meta: { error: errMsg$1(err) } });
96366
97120
  }
96367
97121
  }
96368
97122
  scheduleVisibilityRefresh() {
@@ -96452,7 +97206,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96452
97206
  pushed: r.pushedDeviceIds
96453
97207
  } });
96454
97208
  }).catch((err) => {
96455
- this.ctx.logger.warn("export-alexa: boot discovery reconcile failed", { meta: { error: errMsg(err) } });
97209
+ this.ctx.logger.warn("export-alexa: boot discovery reconcile failed", { meta: { error: errMsg$1(err) } });
96456
97210
  });
96457
97211
  }, BOOT_RECONCILE_DELAY_MS);
96458
97212
  if (typeof timer.unref === "function") timer.unref();
@@ -96465,7 +97219,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96465
97219
  } catch (err) {
96466
97220
  this.ctx.logger.warn("export-alexa: bindings-change discovery reconcile failed", {
96467
97221
  tags: { deviceId },
96468
- meta: { error: errMsg(err) }
97222
+ meta: { error: errMsg$1(err) }
96469
97223
  });
96470
97224
  }
96471
97225
  }
@@ -96581,7 +97335,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96581
97335
  }).catch((err) => {
96582
97336
  this.ctx.logger.warn("export-alexa: new-account push failed", { meta: {
96583
97337
  userId: input.userId,
96584
- error: errMsg(err)
97338
+ error: errMsg$1(err)
96585
97339
  } });
96586
97340
  });
96587
97341
  }
@@ -96614,7 +97368,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96614
97368
  this.updateGlobalSettings({ advertisedBrokerUrl: url }).then(() => {
96615
97369
  this.ctx.logger.info("export-alexa: the skill Lambda advertised its token broker", { meta: { brokerUrl: url } });
96616
97370
  }).catch((err) => {
96617
- this.ctx.logger.warn("export-alexa: could not store the advertised broker URL", { meta: { error: errMsg(err) } });
97371
+ this.ctx.logger.warn("export-alexa: could not store the advertised broker URL", { meta: { error: errMsg$1(err) } });
96618
97372
  });
96619
97373
  }
96620
97374
  async revokeAtBroker(tokens) {
@@ -96623,7 +97377,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96623
97377
  await revokeBrokerCredential(fetch, t.brokerUrl, t.brokerCredential).catch((err) => {
96624
97378
  this.ctx.logger.warn("export-alexa: could not delete the link at the skill broker — it expires there on its own", { meta: {
96625
97379
  userId: t.userId,
96626
- error: errMsg(err)
97380
+ error: errMsg$1(err)
96627
97381
  } });
96628
97382
  });
96629
97383
  }
@@ -96654,7 +97408,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96654
97408
  this.ctx.logger.warn("export-alexa: broker credential rotation failed", { meta: {
96655
97409
  userId: t.userId,
96656
97410
  kind: err instanceof BrokerError ? err.kind : "unavailable",
96657
- error: errMsg(err)
97411
+ error: errMsg$1(err)
96658
97412
  } });
96659
97413
  }
96660
97414
  }
@@ -96700,7 +97454,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96700
97454
  const urls = (await this.ctx.api.networkAccess.listEndpoints.query({})).filter((e) => e.protocol === "https" && e.url.length > 0).map((e) => this.normaliseHubUrl(e.url));
96701
97455
  return [...new Set(urls)];
96702
97456
  } catch (err) {
96703
- this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg(err) } });
97457
+ this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg$1(err) } });
96704
97458
  return [];
96705
97459
  }
96706
97460
  }
@@ -96714,7 +97468,7 @@ var ExportAlexaAddon = class extends BaseAddon {
96714
97468
  if (!status?.connected || !endpoint || endpoint.protocol !== "https" || endpoint.url.length === 0) return "";
96715
97469
  return this.normaliseHubUrl(endpoint.url);
96716
97470
  } catch (err) {
96717
- this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg(err) } });
97471
+ this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg$1(err) } });
96718
97472
  return "";
96719
97473
  }
96720
97474
  }
@@ -97024,13 +97778,13 @@ var ExportAlexaAddon = class extends BaseAddon {
97024
97778
  if (nameChanged && !sourceChanged) this.requireSyncEngine().pushDevice(deviceId).catch((err) => {
97025
97779
  this.ctx.logger.warn("export-alexa: push after an Alexa name change failed", {
97026
97780
  tags: { deviceId },
97027
- meta: { error: errMsg(err) }
97781
+ meta: { error: errMsg$1(err) }
97028
97782
  });
97029
97783
  });
97030
97784
  if (prefsChanged && !sourceChanged) this.requireSyncEngine().reconcileDevice(deviceId).catch((err) => {
97031
97785
  this.ctx.logger.warn("export-alexa: re-sync after a detection preference change failed", {
97032
97786
  tags: { deviceId },
97033
- meta: { error: errMsg(err) }
97787
+ meta: { error: errMsg$1(err) }
97034
97788
  });
97035
97789
  });
97036
97790
  if (sourceChanged) {
@@ -97054,7 +97808,7 @@ var ExportAlexaAddon = class extends BaseAddon {
97054
97808
  } catch (err) {
97055
97809
  this.ctx.logger.warn("export-alexa: failed to refresh after streamPreference change", { meta: {
97056
97810
  deviceId,
97057
- error: errMsg(err)
97811
+ error: errMsg$1(err)
97058
97812
  } });
97059
97813
  }
97060
97814
  }