@camstack/addon-export-alexa 1.1.13 → 1.1.15

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.
@@ -4629,7 +4629,7 @@ function _instanceof(cls, params = {}) {
4629
4629
  return inst;
4630
4630
  }
4631
4631
  //#endregion
4632
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4632
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4633
4633
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4634
4634
  EventCategory["SystemBoot"] = "system.boot";
4635
4635
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5442,6 +5442,100 @@ function createDurableState(deps) {
5442
5442
  };
5443
5443
  }
5444
5444
  /**
5445
+ * Per-node scoping for the shared addon-settings blob.
5446
+ *
5447
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5448
+ * hub-routed — the hub instance answers for every node), so fields whose
5449
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5450
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5451
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5452
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5453
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5454
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5455
+ *
5456
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5457
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5458
+ * schema and routes reads/writes through these helpers.
5459
+ *
5460
+ * ## No bare-key fallback — deliberate
5461
+ *
5462
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5463
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5464
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5465
+ * the store is invisible to every node, hub included, so one node's
5466
+ * selection can never leak onto another. (This generalizes the
5467
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5468
+ * arbitrary set of per-node field keys.)
5469
+ *
5470
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5471
+ * LEAF module: import it via its deep path, never from the root barrel.
5472
+ */
5473
+ /**
5474
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5475
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5476
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5477
+ * `undefined` / `null` / empty falls back to `'hub'`.
5478
+ */
5479
+ function normalizeNodeId(raw) {
5480
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5481
+ const slashIdx = raw.indexOf("/");
5482
+ if (slashIdx < 0) return raw;
5483
+ const bare = raw.slice(0, slashIdx);
5484
+ return bare === "" ? "hub" : bare;
5485
+ }
5486
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5487
+ function nodeScopedKey(base, nodeId) {
5488
+ return `${base}@${normalizeNodeId(nodeId)}`;
5489
+ }
5490
+ /**
5491
+ * Read a node's value for a per-node field from the raw shared store:
5492
+ * the node-scoped key when present, otherwise `undefined`.
5493
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5494
+ * schema `default` win on `undefined`.
5495
+ */
5496
+ function readNodeValue(store, base, nodeId) {
5497
+ return store[nodeScopedKey(base, nodeId)];
5498
+ }
5499
+ /**
5500
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5501
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5502
+ * the write path so a save for one node never clobbers another node's value
5503
+ * (and the bare key is never written). Returns a new object — the input
5504
+ * patch is not mutated.
5505
+ */
5506
+ function scopePatch(patch, perNodeKeys, nodeId) {
5507
+ const out = {};
5508
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5509
+ return out;
5510
+ }
5511
+ /**
5512
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5513
+ * UI schema (whose field keys are bare) hydrates from that node's own
5514
+ * values:
5515
+ *
5516
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5517
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5518
+ * legacy key must never hydrate any node — no bare fallback).
5519
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5520
+ * each bare perNode key; when the node has no scoped key the bare key is
5521
+ * left ABSENT so the field's schema `default` wins.
5522
+ *
5523
+ * Returns a new object — the input store is not mutated.
5524
+ */
5525
+ function projectStore(store, perNodeKeys, nodeId) {
5526
+ const out = {};
5527
+ for (const [key, value] of Object.entries(store)) {
5528
+ if (key.includes("@")) continue;
5529
+ if (perNodeKeys.has(key)) continue;
5530
+ out[key] = value;
5531
+ }
5532
+ for (const base of perNodeKeys) {
5533
+ const value = readNodeValue(store, base, nodeId);
5534
+ if (value !== void 0) out[base] = value;
5535
+ }
5536
+ return out;
5537
+ }
5538
+ /**
5445
5539
  * Base class for CamStack addons. Eliminates settings boilerplate:
5446
5540
  *
5447
5541
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5609,23 +5703,63 @@ var BaseAddon = class {
5609
5703
  deviceSettingsSchema() {
5610
5704
  return null;
5611
5705
  }
5612
- async getGlobalSettings(overlay, cap, _nodeId) {
5706
+ async getGlobalSettings(overlay, cap, nodeId) {
5613
5707
  const schema = this.globalSettingsSchema(cap);
5614
5708
  if (!schema) return { sections: [] };
5615
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5709
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5616
5710
  return hydrateSchema(schema, overlay ? {
5617
- ...raw,
5711
+ ...projected,
5618
5712
  ...overlay
5619
- } : raw);
5713
+ } : projected);
5714
+ }
5715
+ /**
5716
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5717
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5718
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5719
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5720
+ * A no-op passthrough when the schema declares no `perNode` field.
5721
+ *
5722
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5723
+ * the store for custom option logic (option narrowing, value snapping) to
5724
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5725
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5726
+ */
5727
+ async resolveGlobalStore(nodeId, cap) {
5728
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5729
+ const keys = this.perNodeKeys(cap);
5730
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5731
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5620
5732
  }
5621
- async updateGlobalSettings(patch, _nodeId) {
5622
- await this._ctx?.settings?.writeAddonStore(patch);
5733
+ async updateGlobalSettings(patch, nodeId) {
5734
+ const keys = this.perNodeKeys();
5735
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5736
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5737
+ const barePatch = patch;
5738
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5739
+ await this._ctx?.settings?.writeAddonStore(scoped);
5740
+ if (target !== localNode) return;
5623
5741
  await this.resolveConfig();
5624
5742
  await this.onConfigChanged();
5625
5743
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5626
5744
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5627
5745
  }
5628
5746
  /**
5747
+ * The set of field keys the global settings schema declares `perNode: true`
5748
+ * — derived once per `cap` argument and memoized (schemas are static
5749
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5750
+ * settings API behaves exactly like the legacy node-agnostic one.
5751
+ */
5752
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5753
+ perNodeKeys(cap) {
5754
+ const cacheKey = cap ?? "";
5755
+ const cached = this._perNodeKeysCache.get(cacheKey);
5756
+ if (cached) return cached;
5757
+ const schema = this.globalSettingsSchema(cap);
5758
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5759
+ this._perNodeKeysCache.set(cacheKey, keys);
5760
+ return keys;
5761
+ }
5762
+ /**
5629
5763
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5630
5764
  * schedule an addon restart for the next tick. Deferred via
5631
5765
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5778,12 +5912,19 @@ var BaseAddon = class {
5778
5912
  * The merge is shallow: each key in `defaults` is checked against the store.
5779
5913
  * Only keys present in defaults are read — the store can contain extra keys
5780
5914
  * (e.g. from older versions) without polluting the typed config.
5915
+ *
5916
+ * Keys the global settings schema declares `perNode: true` resolve from
5917
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5918
+ * from the bare key — so a per-node field resolves to this node's own
5919
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5781
5920
  */
5782
5921
  async resolveConfig() {
5783
5922
  const stored = await this.readAddonStoreWithRetry();
5923
+ const perNode = this.perNodeKeys();
5924
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5784
5925
  const resolved = { ...this.defaults };
5785
5926
  for (const key of Object.keys(this.defaults)) {
5786
- const storedValue = stored[key];
5927
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5787
5928
  if (storedValue !== void 0 && storedValue !== null) {
5788
5929
  const defaultType = typeof this.defaults[key];
5789
5930
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5867,6 +6008,27 @@ var BaseAddon = class {
5867
6008
  }
5868
6009
  };
5869
6010
  /**
6011
+ * Collect the keys of every field marked `perNode: true`, recursing into
6012
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6013
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6014
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6015
+ */
6016
+ function collectPerNodeFieldKeys(fields) {
6017
+ const collected = [];
6018
+ for (const field of fields) {
6019
+ if (field.type === "group") {
6020
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6021
+ continue;
6022
+ }
6023
+ if (field.type === "sub-tabs") {
6024
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6025
+ continue;
6026
+ }
6027
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6028
+ }
6029
+ return collected;
6030
+ }
6031
+ /**
5870
6032
  * Normalize an `ICamstackAddon.initialize()` return value into the
5871
6033
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5872
6034
  * envelopes pass through; void stays void.
@@ -5891,6 +6053,7 @@ var CamStreamKindSchema = _enum([
5891
6053
  "pull-rtsp",
5892
6054
  "pull-rtmp",
5893
6055
  "pull-http",
6056
+ "pull-flv",
5894
6057
  "pull-rfc4571",
5895
6058
  "push-annexb",
5896
6059
  "derived"
@@ -6284,6 +6447,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6284
6447
  /** Single still-image entity (HA `image.*`). Read-only display of an
6285
6448
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6286
6449
  DeviceType["Image"] = "image";
6450
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6451
+ * level, battery, desiccant life, feeding state and manual-feed /
6452
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6453
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6454
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6455
+ * integrations sharing the same food/desiccant/hopper surface. */
6456
+ DeviceType["PetFeeder"] = "pet-feeder";
6287
6457
  return DeviceType;
6288
6458
  }({});
6289
6459
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7615,6 +7785,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7615
7785
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7616
7786
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7617
7787
  /**
7788
+ * Error types for the safe expression engine. Two distinct classes so callers
7789
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7790
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7791
+ */
7792
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7793
+ * the failure is anchored to a character (author-facing inline feedback). */
7794
+ var ExpressionParseError = class extends Error {
7795
+ position;
7796
+ constructor(message, position) {
7797
+ super(message);
7798
+ this.name = "ExpressionParseError";
7799
+ this.position = position;
7800
+ }
7801
+ };
7802
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7803
+ * result, unknown builtin, step-budget exceeded). */
7804
+ var ExpressionEvalError = class extends Error {
7805
+ constructor(message) {
7806
+ super(message);
7807
+ this.name = "ExpressionEvalError";
7808
+ }
7809
+ };
7810
+ /**
7811
+ * Resource-bound constants for the safe expression engine.
7812
+ *
7813
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7814
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7815
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7816
+ * work a single author-supplied expression can request, so a hostile or
7817
+ * accidental pathological string can never spend unbounded CPU/memory.
7818
+ */
7819
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7820
+ * rejected without allocation. */
7821
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7822
+ /** A legal binding / identifier name. */
7823
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7824
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7825
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7826
+ var RESERVED_BINDING_NAMES = new Set([
7827
+ "now",
7828
+ "true",
7829
+ "false",
7830
+ "null"
7831
+ ]);
7832
+ /**
7833
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7834
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7835
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7836
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7837
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7838
+ * is a parse error with a source position, so member access / assignment /
7839
+ * template literals are lexically impossible.
7840
+ */
7841
+ var KEYWORDS = new Set([
7842
+ "true",
7843
+ "false",
7844
+ "null"
7845
+ ]);
7846
+ function isDigit(ch) {
7847
+ return ch >= "0" && ch <= "9";
7848
+ }
7849
+ function isIdentStart(ch) {
7850
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7851
+ }
7852
+ function isIdentPart(ch) {
7853
+ return isIdentStart(ch) || isDigit(ch);
7854
+ }
7855
+ function isWhitespace(ch) {
7856
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7857
+ }
7858
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7859
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7860
+ * string. */
7861
+ function tokenize(source) {
7862
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7863
+ const tokens = [];
7864
+ let i = 0;
7865
+ const n = source.length;
7866
+ while (i < n) {
7867
+ const ch = source[i];
7868
+ if (isWhitespace(ch)) {
7869
+ i += 1;
7870
+ continue;
7871
+ }
7872
+ if (isDigit(ch)) {
7873
+ const start = i;
7874
+ while (i < n && isDigit(source[i])) i += 1;
7875
+ if (i < n && source[i] === ".") {
7876
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7877
+ i += 1;
7878
+ while (i < n && isDigit(source[i])) i += 1;
7879
+ }
7880
+ const text = source.slice(start, i);
7881
+ const value = Number(text);
7882
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7883
+ tokens.push({
7884
+ type: "number",
7885
+ value,
7886
+ pos: start
7887
+ });
7888
+ continue;
7889
+ }
7890
+ if (ch === "'" || ch === "\"") {
7891
+ const quote = ch;
7892
+ const start = i;
7893
+ i += 1;
7894
+ let out = "";
7895
+ let closed = false;
7896
+ while (i < n) {
7897
+ const c = source[i];
7898
+ if (c === "\\") {
7899
+ const next = i + 1 < n ? source[i + 1] : "";
7900
+ if (next === "\\" || next === "'" || next === "\"") {
7901
+ out += next;
7902
+ i += 2;
7903
+ continue;
7904
+ }
7905
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7906
+ }
7907
+ if (c === quote) {
7908
+ closed = true;
7909
+ i += 1;
7910
+ break;
7911
+ }
7912
+ out += c;
7913
+ i += 1;
7914
+ }
7915
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7916
+ tokens.push({
7917
+ type: "string",
7918
+ value: out,
7919
+ pos: start
7920
+ });
7921
+ continue;
7922
+ }
7923
+ if (isIdentStart(ch)) {
7924
+ const start = i;
7925
+ while (i < n && isIdentPart(source[i])) i += 1;
7926
+ const text = source.slice(start, i);
7927
+ if (KEYWORDS.has(text)) tokens.push({
7928
+ type: "keyword",
7929
+ keyword: keywordOf(text),
7930
+ pos: start
7931
+ });
7932
+ else tokens.push({
7933
+ type: "identifier",
7934
+ name: text,
7935
+ pos: start
7936
+ });
7937
+ continue;
7938
+ }
7939
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7940
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7941
+ tokens.push({
7942
+ type: "punct",
7943
+ punct: two,
7944
+ pos: i
7945
+ });
7946
+ i += 2;
7947
+ continue;
7948
+ }
7949
+ if (isSinglePunct(ch)) {
7950
+ tokens.push({
7951
+ type: "punct",
7952
+ punct: ch,
7953
+ pos: i
7954
+ });
7955
+ i += 1;
7956
+ continue;
7957
+ }
7958
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7959
+ }
7960
+ tokens.push({
7961
+ type: "eof",
7962
+ pos: n
7963
+ });
7964
+ return tokens;
7965
+ }
7966
+ function keywordOf(text) {
7967
+ if (text === "true") return "true";
7968
+ if (text === "false") return "false";
7969
+ return "null";
7970
+ }
7971
+ function isSinglePunct(ch) {
7972
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7973
+ }
7974
+ /**
7975
+ * Frozen, null-prototype builtin function table for the expression engine
7976
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7977
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7978
+ * own-property check against it.
7979
+ *
7980
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7981
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7982
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7983
+ * (there is no `Object.prototype` in the chain), so those names are not
7984
+ * callable — they are simply "unknown function" at parse time.
7985
+ *
7986
+ * Every numeric argument is validated as a finite number and every numeric
7987
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7988
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7989
+ * closed rather than emitting a garbage value.
7990
+ */
7991
+ function asFiniteNumber(value, name, index) {
7992
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7993
+ return value;
7994
+ }
7995
+ function asString$1(value, name, index) {
7996
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7997
+ return value;
7998
+ }
7999
+ function finiteResult(value, name) {
8000
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
8001
+ return value;
8002
+ }
8003
+ function allFiniteNumbers(args, name) {
8004
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
8005
+ }
8006
+ var INF = Number.POSITIVE_INFINITY;
8007
+ var table = {
8008
+ min: {
8009
+ minArgs: 1,
8010
+ maxArgs: INF,
8011
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
8012
+ },
8013
+ max: {
8014
+ minArgs: 1,
8015
+ maxArgs: INF,
8016
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
8017
+ },
8018
+ abs: {
8019
+ minArgs: 1,
8020
+ maxArgs: 1,
8021
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
8022
+ },
8023
+ floor: {
8024
+ minArgs: 1,
8025
+ maxArgs: 1,
8026
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
8027
+ },
8028
+ ceil: {
8029
+ minArgs: 1,
8030
+ maxArgs: 1,
8031
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
8032
+ },
8033
+ sqrt: {
8034
+ minArgs: 1,
8035
+ maxArgs: 1,
8036
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
8037
+ },
8038
+ round: {
8039
+ minArgs: 1,
8040
+ maxArgs: 2,
8041
+ apply: (args) => {
8042
+ const x = asFiniteNumber(args[0], "round", 0);
8043
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
8044
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
8045
+ const factor = 10 ** digits;
8046
+ return finiteResult(Math.round(x * factor) / factor, "round");
8047
+ }
8048
+ },
8049
+ pow: {
8050
+ minArgs: 2,
8051
+ maxArgs: 2,
8052
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
8053
+ },
8054
+ clamp: {
8055
+ minArgs: 3,
8056
+ maxArgs: 3,
8057
+ apply: (args) => {
8058
+ const x = asFiniteNumber(args[0], "clamp", 0);
8059
+ const lo = asFiniteNumber(args[1], "clamp", 1);
8060
+ const hi = asFiniteNumber(args[2], "clamp", 2);
8061
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
8062
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
8063
+ }
8064
+ },
8065
+ avg: {
8066
+ minArgs: 1,
8067
+ maxArgs: INF,
8068
+ apply: (args) => {
8069
+ const nums = allFiniteNumbers(args, "avg");
8070
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
8071
+ }
8072
+ },
8073
+ sum: {
8074
+ minArgs: 1,
8075
+ maxArgs: INF,
8076
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
8077
+ },
8078
+ coalesce: {
8079
+ minArgs: 1,
8080
+ maxArgs: INF,
8081
+ apply: (args) => {
8082
+ for (const a of args) if (a !== null) return a;
8083
+ return null;
8084
+ }
8085
+ },
8086
+ age: {
8087
+ minArgs: 2,
8088
+ maxArgs: 2,
8089
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
8090
+ },
8091
+ convert: {
8092
+ minArgs: 3,
8093
+ maxArgs: 3,
8094
+ apply: (args, hooks) => {
8095
+ const x = asFiniteNumber(args[0], "convert", 0);
8096
+ const from = asString$1(args[1], "convert", 1).trim();
8097
+ const to = asString$1(args[2], "convert", 2).trim();
8098
+ if (hooks.convert) {
8099
+ const out = hooks.convert(x, from, to);
8100
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
8101
+ return finiteResult(out, "convert");
8102
+ }
8103
+ if (from === to) return x;
8104
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
8105
+ }
8106
+ }
8107
+ };
8108
+ Object.freeze(Object.assign(Object.create(null), table));
8109
+ /** The set of valid builtin names — used by the parser to reject unknown
8110
+ * callees at parse time (immediate author feedback). */
8111
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
8112
+ /**
8113
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
8114
+ *
8115
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
8116
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
8117
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
8118
+ * string validated against the builtin table at parse time, so an unknown
8119
+ * function is rejected immediately (author feedback) and a persisted expression
8120
+ * that references a since-removed builtin degrades at read.
8121
+ *
8122
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
8123
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
8124
+ */
8125
+ /** Binary/logical operator precedence (higher binds tighter). */
8126
+ var BINARY_PRECEDENCE = {
8127
+ "||": 1,
8128
+ "&&": 2,
8129
+ "==": 3,
8130
+ "!=": 3,
8131
+ "<": 4,
8132
+ "<=": 4,
8133
+ ">": 4,
8134
+ ">=": 4,
8135
+ "+": 5,
8136
+ "-": 5,
8137
+ "*": 6,
8138
+ "/": 6,
8139
+ "%": 6
8140
+ };
8141
+ function isLogicalOp(op) {
8142
+ return op === "&&" || op === "||";
8143
+ }
8144
+ function isBinaryOp(op) {
8145
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
8146
+ }
8147
+ var Parser = class {
8148
+ tokens;
8149
+ pos = 0;
8150
+ nodeCount = 0;
8151
+ identifiers = /* @__PURE__ */ new Set();
8152
+ callees = /* @__PURE__ */ new Set();
8153
+ constructor(tokens) {
8154
+ this.tokens = tokens;
8155
+ }
8156
+ parse() {
8157
+ const ast = this.parseTernary();
8158
+ const tok = this.peek();
8159
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8160
+ return {
8161
+ ast,
8162
+ identifiers: this.identifiers,
8163
+ callees: this.callees,
8164
+ nodeCount: this.nodeCount
8165
+ };
8166
+ }
8167
+ peek() {
8168
+ return this.tokens[this.pos];
8169
+ }
8170
+ next() {
8171
+ return this.tokens[this.pos++];
8172
+ }
8173
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8174
+ expectPunct(punct) {
8175
+ const tok = this.peek();
8176
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8177
+ this.pos += 1;
8178
+ }
8179
+ matchPunct(punct) {
8180
+ const tok = this.peek();
8181
+ if (tok.type === "punct" && tok.punct === punct) {
8182
+ this.pos += 1;
8183
+ return true;
8184
+ }
8185
+ return false;
8186
+ }
8187
+ countNode() {
8188
+ this.nodeCount += 1;
8189
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8190
+ }
8191
+ parseTernary() {
8192
+ const test = this.parseBinary(1);
8193
+ if (this.matchPunct("?")) {
8194
+ const consequent = this.parseTernary();
8195
+ this.expectPunct(":");
8196
+ const alternate = this.parseTernary();
8197
+ this.countNode();
8198
+ return {
8199
+ kind: "conditional",
8200
+ test,
8201
+ consequent,
8202
+ alternate
8203
+ };
8204
+ }
8205
+ return test;
8206
+ }
8207
+ parseBinary(minPrec) {
8208
+ let left = this.parseUnary();
8209
+ for (;;) {
8210
+ const tok = this.peek();
8211
+ if (tok.type !== "punct") break;
8212
+ const prec = BINARY_PRECEDENCE[tok.punct];
8213
+ if (prec === void 0 || prec < minPrec) break;
8214
+ const op = tok.punct;
8215
+ this.pos += 1;
8216
+ const right = this.parseBinary(prec + 1);
8217
+ this.countNode();
8218
+ if (isLogicalOp(op)) left = {
8219
+ kind: "logical",
8220
+ op,
8221
+ left,
8222
+ right
8223
+ };
8224
+ else if (isBinaryOp(op)) left = {
8225
+ kind: "binary",
8226
+ op,
8227
+ left,
8228
+ right
8229
+ };
8230
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8231
+ }
8232
+ return left;
8233
+ }
8234
+ parseUnary() {
8235
+ const tok = this.peek();
8236
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8237
+ const op = tok.punct;
8238
+ this.pos += 1;
8239
+ const operand = this.parseUnary();
8240
+ this.countNode();
8241
+ return {
8242
+ kind: "unary",
8243
+ op,
8244
+ operand
8245
+ };
8246
+ }
8247
+ return this.parsePrimary();
8248
+ }
8249
+ parsePrimary() {
8250
+ const tok = this.next();
8251
+ switch (tok.type) {
8252
+ case "number":
8253
+ this.countNode();
8254
+ return {
8255
+ kind: "literal",
8256
+ value: tok.value
8257
+ };
8258
+ case "string":
8259
+ this.countNode();
8260
+ return {
8261
+ kind: "literal",
8262
+ value: tok.value
8263
+ };
8264
+ case "keyword":
8265
+ this.countNode();
8266
+ return {
8267
+ kind: "literal",
8268
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8269
+ };
8270
+ case "identifier": {
8271
+ const nextTok = this.peek();
8272
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8273
+ this.identifiers.add(tok.name);
8274
+ this.countNode();
8275
+ return {
8276
+ kind: "identifier",
8277
+ name: tok.name
8278
+ };
8279
+ }
8280
+ case "punct":
8281
+ if (tok.punct === "(") {
8282
+ const inner = this.parseTernary();
8283
+ this.expectPunct(")");
8284
+ return inner;
8285
+ }
8286
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8287
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8288
+ }
8289
+ }
8290
+ parseCall(callee, pos) {
8291
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8292
+ this.expectPunct("(");
8293
+ const args = [];
8294
+ if (!this.matchPunct(")")) for (;;) {
8295
+ args.push(this.parseTernary());
8296
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8297
+ if (this.matchPunct(",")) continue;
8298
+ this.expectPunct(")");
8299
+ break;
8300
+ }
8301
+ this.callees.add(callee);
8302
+ this.countNode();
8303
+ return {
8304
+ kind: "call",
8305
+ callee,
8306
+ args
8307
+ };
8308
+ }
8309
+ };
8310
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8311
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8312
+ function parseExpression(source) {
8313
+ return new Parser(tokenize(source)).parse();
8314
+ }
8315
+ Object.freeze({});
8316
+ /**
8317
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8318
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8319
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8320
+ * one per read on a hot resolve path.
8321
+ *
8322
+ * The cache is a module-level singleton: entries are pure, content-addressed
8323
+ * ASTs keyed by the raw source string, so sharing one instance across all
8324
+ * callers is safe and maximises hit rate.
8325
+ */
8326
+ var cache = /* @__PURE__ */ new Map();
8327
+ function getCached(source) {
8328
+ const hit = cache.get(source);
8329
+ if (hit !== void 0) {
8330
+ cache.delete(source);
8331
+ cache.set(source, hit);
8332
+ return hit;
8333
+ }
8334
+ let result;
8335
+ try {
8336
+ result = {
8337
+ ok: true,
8338
+ parsed: parseExpression(source)
8339
+ };
8340
+ } catch (err) {
8341
+ result = {
8342
+ ok: false,
8343
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8344
+ };
8345
+ }
8346
+ cache.set(source, result);
8347
+ if (cache.size > 256) {
8348
+ const oldest = cache.keys().next().value;
8349
+ if (oldest !== void 0) cache.delete(oldest);
8350
+ }
8351
+ return result;
8352
+ }
8353
+ /** Compile `source`, returning a discriminated result instead of throwing.
8354
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8355
+ function compileExpressionSafe(source) {
8356
+ return getCached(source);
8357
+ }
8358
+ /**
8359
+ * Author-time validation. Returns `null` when the source is valid, else a
8360
+ * human-readable error message. Checks: the expression compiles; binding count
8361
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8362
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8363
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8364
+ */
8365
+ function validateExpressionSource(src) {
8366
+ const names = Object.keys(src.bindings);
8367
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8368
+ for (const name of names) {
8369
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8370
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8371
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8372
+ }
8373
+ const compiled = compileExpressionSafe(src.expr);
8374
+ if (!compiled.ok) return compiled.error;
8375
+ const bound = new Set(names);
8376
+ for (const id of compiled.parsed.identifiers) {
8377
+ if (id === "now") continue;
8378
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8379
+ }
8380
+ return null;
8381
+ }
8382
+ /**
7618
8383
  * Accessory device helpers — shared across drivers.
7619
8384
  *
7620
8385
  * Many vendor-specific drivers register accessory child devices on
@@ -9517,7 +10282,8 @@ var MotionAnalysisResultSchema = object({
9517
10282
  });
9518
10283
  method(object({
9519
10284
  deviceId: number(),
9520
- frame: FrameInputSchema
10285
+ frame: FrameInputSchema.optional(),
10286
+ frameHandle: FrameHandleSchema.optional()
9521
10287
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9522
10288
  deviceId: number(),
9523
10289
  detected: boolean(),
@@ -9764,6 +10530,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9764
10530
  engine: PipelineEngineChoiceSchema.optional(),
9765
10531
  steps: array(PipelineStepInputSchema).min(1),
9766
10532
  frame: FrameInputSchema.optional(),
10533
+ /**
10534
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10535
+ * the decoded pixels live in. One more member of the one-of
10536
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10537
+ */
10538
+ frameHandle: FrameHandleSchema.optional(),
9767
10539
  imageBase64: string().optional(),
9768
10540
  /**
9769
10541
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9973,6 +10745,31 @@ var ReportMotionInputSchema = object({
9973
10745
  regions: array(MotionRegionSchema).readonly().optional()
9974
10746
  });
9975
10747
  /**
10748
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10749
+ * restream-owner model — P2c).
10750
+ *
10751
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10752
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10753
+ * `frameSource` key) parses to this, so the field is additive with zero
10754
+ * behavior change.
10755
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10756
+ * The runner acquires the owner's COMPRESSED passthrough restream
10757
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10758
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10759
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10760
+ * node-local; only H.264/H.265 packets cross the wire.
10761
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10762
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10763
+ * dials for the owner's restream.
10764
+ */
10765
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10766
+ kind: literal("remote-restream"),
10767
+ /** The camera's source-owner node (slice 1: always the hub). */
10768
+ ownerNodeId: string(),
10769
+ /** Operator override for the owner host the runner dials. */
10770
+ hubHostnameOverride: string().optional()
10771
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10772
+ /**
9976
10773
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9977
10774
  * specific runner instance via `attachCamera`. Carries everything the
9978
10775
  * runner needs to subscribe to the local broker and execute inference.
@@ -10070,7 +10867,15 @@ var RunnerCameraConfigSchema = object({
10070
10867
  */
10071
10868
  onboardMotionDrivesAnalyzer: boolean().default(true),
10072
10869
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
10073
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10870
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10871
+ /**
10872
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10873
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10874
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10875
+ * camera's detect node differs from its source-owner (P2d, gated by the
10876
+ * `remoteSourcingNodes` rollout setting).
10877
+ */
10878
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
10074
10879
  });
10075
10880
  motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
10076
10881
  /**
@@ -10435,6 +11240,113 @@ object({
10435
11240
  lastFetchedAt: number()
10436
11241
  });
10437
11242
  DeviceType.Sensor;
11243
+ /**
11244
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11245
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11246
+ * `on_batteries` (running on battery backup). `null` until first reported.
11247
+ */
11248
+ var PetFeederDeviceStatusSchema = _enum([
11249
+ "normal",
11250
+ "offline",
11251
+ "on_batteries"
11252
+ ]);
11253
+ var gramsPortion = number().int().min(4).max(200);
11254
+ object({
11255
+ /** Food currently in the bowl (grams). Null when the device has not
11256
+ * reported a reading yet. On dual-hopper models this is the combined
11257
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11258
+ foodLevel: number().nullable(),
11259
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11260
+ * single-hopper models. */
11261
+ food1: number().nullable(),
11262
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11263
+ * single-hopper models. */
11264
+ food2: number().nullable(),
11265
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11266
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11267
+ * below the feeder's low threshold. */
11268
+ lowFood: boolean(),
11269
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11270
+ * device has no battery reading. */
11271
+ batteryPower: number().min(0).max(100).nullable(),
11272
+ /** Days of desiccant life remaining. Null when the model has no
11273
+ * desiccant sensor. */
11274
+ desiccantLeftDays: number().nullable(),
11275
+ /** True while a feed is in progress. */
11276
+ feeding: boolean(),
11277
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11278
+ * Null until the device has reported a status. */
11279
+ status: PetFeederDeviceStatusSchema.nullable(),
11280
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11281
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11282
+ * with `errorCode` for consumers that want the raw integer. */
11283
+ error: string().nullable(),
11284
+ /** Raw device error code (0 / null = no error). */
11285
+ errorCode: number().nullable(),
11286
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11287
+ isDualHopper: boolean(),
11288
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11289
+ childLock: boolean(),
11290
+ /** Front indicator-light setting. */
11291
+ indicatorLight: boolean(),
11292
+ /** Play a chime when dispensing. */
11293
+ feedSound: boolean(),
11294
+ /** Speaker / prompt volume level (device-scaled integer). */
11295
+ volume: number(),
11296
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11297
+ lastFetchedAt: number()
11298
+ });
11299
+ DeviceType.PetFeeder, method(object({
11300
+ deviceId: number().int().nonnegative(),
11301
+ grams: gramsPortion.optional(),
11302
+ hopper1: gramsPortion.optional(),
11303
+ hopper2: gramsPortion.optional()
11304
+ }), _void(), {
11305
+ kind: "mutation",
11306
+ auth: "admin"
11307
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11308
+ kind: "mutation",
11309
+ auth: "admin"
11310
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11311
+ kind: "mutation",
11312
+ auth: "admin"
11313
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11314
+ kind: "mutation",
11315
+ auth: "admin"
11316
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11317
+ kind: "mutation",
11318
+ auth: "admin"
11319
+ }), method(object({
11320
+ deviceId: number().int().nonnegative(),
11321
+ soundId: number().int().nonnegative()
11322
+ }), _void(), {
11323
+ kind: "mutation",
11324
+ auth: "admin"
11325
+ }), method(object({
11326
+ deviceId: number().int().nonnegative(),
11327
+ on: boolean()
11328
+ }), _void(), {
11329
+ kind: "mutation",
11330
+ auth: "admin"
11331
+ }), method(object({
11332
+ deviceId: number().int().nonnegative(),
11333
+ on: boolean()
11334
+ }), _void(), {
11335
+ kind: "mutation",
11336
+ auth: "admin"
11337
+ }), method(object({
11338
+ deviceId: number().int().nonnegative(),
11339
+ on: boolean()
11340
+ }), _void(), {
11341
+ kind: "mutation",
11342
+ auth: "admin"
11343
+ }), method(object({
11344
+ deviceId: number().int().nonnegative(),
11345
+ level: number().int().nonnegative()
11346
+ }), _void(), {
11347
+ kind: "mutation",
11348
+ auth: "admin"
11349
+ });
10438
11350
  object({
10439
11351
  /** Instantaneous power draw in watts. */
10440
11352
  watts: number().optional(),
@@ -12302,10 +13214,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12302
13214
  url: string()
12303
13215
  }), _void()), method(object({
12304
13216
  sessionId: string(),
12305
- maxCount: number().default(1)
13217
+ maxCount: number().default(1),
13218
+ waitMs: number().optional()
12306
13219
  }), array(DecodedFrameSchema)), method(object({
12307
13220
  sessionId: string(),
12308
- maxCount: number().default(1)
13221
+ maxCount: number().default(1),
13222
+ waitMs: number().optional()
12309
13223
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12310
13224
  sessionId: string(),
12311
13225
  config: DecoderSessionConfigSchema.partial()
@@ -12617,14 +13531,63 @@ var ChildLayoutEntrySchema = object({
12617
13531
  collapsed: boolean().optional()
12618
13532
  });
12619
13533
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12620
- * `device-management.ts`. */
13534
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13535
+ * accessory's status field (`kind` optional/absent for wire compat); a
13536
+ * LITERAL source carries a per-device constant (no sibling is read); a
13537
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13538
+ * source device's full re-sync-stable `stableId`. */
13539
+ var DeviceLinkFieldSourceSchema = object({
13540
+ kind: literal("field").optional(),
13541
+ sourceKey: string(),
13542
+ cap: string(),
13543
+ fieldPath: string()
13544
+ });
13545
+ var DeviceLinkLiteralSourceSchema = object({
13546
+ kind: literal("literal"),
13547
+ value: union([
13548
+ string(),
13549
+ number(),
13550
+ boolean(),
13551
+ _null()
13552
+ ])
13553
+ });
13554
+ var DeviceLinkGlobalSourceSchema = object({
13555
+ kind: literal("global"),
13556
+ sourceStableId: string(),
13557
+ cap: string(),
13558
+ fieldPath: string()
13559
+ });
13560
+ /** Expression source (Stage X): compute the target field from N named bindings
13561
+ * via the safe expression engine. Bindings are field | literal | global — never
13562
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13563
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13564
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13565
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13566
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13567
+ var DeviceLinkExpressionSourceSchema = object({
13568
+ kind: literal("expression"),
13569
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13570
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13571
+ DeviceLinkFieldSourceSchema,
13572
+ DeviceLinkLiteralSourceSchema,
13573
+ DeviceLinkGlobalSourceSchema
13574
+ ]))
13575
+ }).superRefine((src, ctx) => {
13576
+ const err = validateExpressionSource(src);
13577
+ if (err !== null) ctx.addIssue({
13578
+ code: "custom",
13579
+ message: err,
13580
+ path: ["expr"]
13581
+ });
13582
+ });
12621
13583
  var DeviceLinkSchema = object({
12622
13584
  id: string(),
12623
- source: object({
12624
- sourceKey: string(),
12625
- cap: string(),
12626
- fieldPath: string()
12627
- }),
13585
+ source: union([
13586
+ DeviceLinkFieldSourceSchema,
13587
+ DeviceLinkLiteralSourceSchema,
13588
+ DeviceLinkGlobalSourceSchema,
13589
+ DeviceLinkExpressionSourceSchema
13590
+ ]),
12628
13591
  target: object({
12629
13592
  cap: string(),
12630
13593
  fieldPath: string(),
@@ -12653,6 +13616,31 @@ var DeviceLinkSchema = object({
12653
13616
  })
12654
13617
  ]).optional()
12655
13618
  });
13619
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13620
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13621
+ var DeviceCapDisplayOverrideSchema = object({
13622
+ unit: string().min(1).optional(),
13623
+ precision: number().int().min(0).max(10).optional()
13624
+ });
13625
+ /** Cap-wire shape of an operator-authored per-device display override —
13626
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13627
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13628
+ var DeviceDisplayOverrideSchema = object({
13629
+ icon: string().min(1).optional(),
13630
+ label: string().min(1).optional(),
13631
+ unit: string().min(1).optional(),
13632
+ precision: number().int().min(0).max(10).optional(),
13633
+ hidden: boolean().optional(),
13634
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13635
+ });
13636
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13637
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13638
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13639
+ var RoleDisplayDefaultSchema = object({
13640
+ unit: string().min(1).optional(),
13641
+ precision: number().int().min(0).max(10).optional(),
13642
+ icon: string().min(1).optional()
13643
+ });
12656
13644
  /**
12657
13645
  * Serializable projection of a live IDevice.
12658
13646
  * Returned by listAll, getDevice, getChildren.
@@ -12708,7 +13696,9 @@ var DeviceInfoSchema = object({
12708
13696
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12709
13697
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12710
13698
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12711
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13699
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13700
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13701
+ display: DeviceDisplayOverrideSchema.optional()
12712
13702
  });
12713
13703
  var ConfigEntrySchema = object({
12714
13704
  key: string(),
@@ -12773,7 +13763,9 @@ var DeviceMetaSchema = object({
12773
13763
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12774
13764
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12775
13765
  * Optional: only present for accessory children that carry a known role. */
12776
- role: string().nullable().optional()
13766
+ role: string().nullable().optional(),
13767
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13768
+ display: DeviceDisplayOverrideSchema.optional()
12777
13769
  });
12778
13770
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12779
13771
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12867,7 +13859,19 @@ method(object({
12867
13859
  }), _void(), {
12868
13860
  kind: "mutation",
12869
13861
  auth: "admin"
12870
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13862
+ }), method(object({
13863
+ deviceId: number(),
13864
+ display: DeviceDisplayOverrideSchema.nullable()
13865
+ }), _void(), {
13866
+ kind: "mutation",
13867
+ auth: "admin"
13868
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13869
+ kind: "mutation",
13870
+ auth: "admin"
13871
+ }), method(object({
13872
+ deviceId: number(),
13873
+ includeSynthesizable: boolean().optional()
13874
+ }), object({ caps: array(object({
12871
13875
  cap: string(),
12872
13876
  fields: array(object({
12873
13877
  path: string(),
@@ -12877,8 +13881,13 @@ method(object({
12877
13881
  "boolean",
12878
13882
  "enum"
12879
13883
  ]),
12880
- enumValues: array(string()).optional()
12881
- })).readonly()
13884
+ enumValues: array(string()).optional(),
13885
+ item: boolean().optional()
13886
+ })).readonly(),
13887
+ itemArray: object({
13888
+ path: string(),
13889
+ keyField: string()
13890
+ }).optional()
12882
13891
  })).readonly() }), { kind: "query" }), method(object({
12883
13892
  deviceId: number(),
12884
13893
  role: string().nullable()
@@ -12948,7 +13957,11 @@ method(object({
12948
13957
  deviceId: number(),
12949
13958
  entries: array(object({
12950
13959
  capName: string(),
12951
- kind: _enum(["native", "wrapped"]),
13960
+ kind: _enum([
13961
+ "native",
13962
+ "wrapped",
13963
+ "linked"
13964
+ ]),
12952
13965
  providerAddonId: string(),
12953
13966
  providerNodeId: string(),
12954
13967
  nativeAddonId: string()
@@ -12957,7 +13970,11 @@ method(object({
12957
13970
  deviceId: number(),
12958
13971
  entries: array(object({
12959
13972
  capName: string(),
12960
- kind: _enum(["native", "wrapped"]),
13973
+ kind: _enum([
13974
+ "native",
13975
+ "wrapped",
13976
+ "linked"
13977
+ ]),
12961
13978
  providerAddonId: string(),
12962
13979
  providerNodeId: string(),
12963
13980
  nativeAddonId: string()
@@ -13447,7 +14464,7 @@ var AddBrokerInputSchema = object({
13447
14464
  });
13448
14465
  var AddBrokerResultSchema = object({ id: string() });
13449
14466
  var IdInputSchema = object({ id: string() });
13450
- var TestResultSchema = discriminatedUnion("ok", [object({
14467
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13451
14468
  ok: literal(true),
13452
14469
  latencyMs: number()
13453
14470
  }), object({
@@ -13470,7 +14487,7 @@ var StatusSchema = object({
13470
14487
  brokerCount: number(),
13471
14488
  embeddedRunning: boolean()
13472
14489
  });
13473
- method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
14490
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
13474
14491
  var NetworkEndpointSchema = object({
13475
14492
  url: string(),
13476
14493
  hostname: string(),
@@ -13504,23 +14521,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13504
14521
  sourcePort: number().optional()
13505
14522
  });
13506
14523
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13507
- method(object({
13508
- title: string(),
14524
+ /**
14525
+ * notification-output — canonical, capability-gated notification delivery.
14526
+ *
14527
+ * Apprise-derived model (see
14528
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14529
+ * callers emit ONE canonical `Notification`; each provider declares a
14530
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14531
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14532
+ * message to what the kind supports — callers never special-case a service.
14533
+ *
14534
+ * DESIGN DECISIONS (locked):
14535
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14536
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14537
+ * cap. Rationale: the admin UI needs one uniform surface across the
14538
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14539
+ * alternative would fork the UI per addon and cannot host the
14540
+ * discovery→adopt flow.
14541
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14542
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14543
+ * registered provider (notifiers addon + HA addon) so one catalog is
14544
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14545
+ * `addonId` the generated collection router extracts from the call input.
14546
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14547
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14548
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14549
+ * base64 fallback needed.
14550
+ *
14551
+ * TODO (deferred, closed-set change — separate decision): add
14552
+ * `providerKind: 'notify'` so notification providers surface on the unified
14553
+ * admin "Integrations" page.
14554
+ */
14555
+ /**
14556
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14557
+ * adapter picks what it supports and the degrade engine filters the rest.
14558
+ */
14559
+ var AttachmentMediaTypeSchema = _enum([
14560
+ "image",
14561
+ "video",
14562
+ "gif",
14563
+ "audio",
14564
+ "icon"
14565
+ ]);
14566
+ /**
14567
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14568
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14569
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14570
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14571
+ */
14572
+ var AttachmentSchema = object({
14573
+ mediaType: AttachmentMediaTypeSchema,
14574
+ url: string().optional(),
14575
+ bytes: _instanceof(Uint8Array).optional(),
14576
+ mime: string().optional(),
14577
+ name: string().optional()
14578
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14579
+ var NotificationFormatSchema = _enum([
14580
+ "text",
14581
+ "markdown",
14582
+ "html"
14583
+ ]);
14584
+ /** A single tap-through action button. */
14585
+ var NotificationActionSchema = object({
14586
+ id: string(),
14587
+ label: string(),
14588
+ url: string().optional()
14589
+ });
14590
+ /**
14591
+ * The canonical notification. `body` is the only hard field (Apprise model).
14592
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14593
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14594
+ * the adapter maps this ordinal onto its native level. `level?` is an
14595
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14596
+ * `priority` for that one target.
14597
+ */
14598
+ var NotificationSchema = object({
13509
14599
  body: string(),
13510
- imageUrl: string().optional(),
14600
+ title: string().optional(),
14601
+ format: NotificationFormatSchema.default("text"),
14602
+ priority: number().int().min(1).max(5).default(3),
14603
+ level: string().optional(),
14604
+ attachments: array(AttachmentSchema).optional(),
14605
+ clickUrl: string().optional(),
14606
+ actions: array(NotificationActionSchema).optional(),
14607
+ sound: string().optional(),
14608
+ ttl: number().optional(),
14609
+ tag: string().optional(),
13511
14610
  deviceId: number().optional(),
13512
14611
  eventId: string().optional(),
13513
- priority: _enum([
13514
- "low",
13515
- "normal",
13516
- "high",
13517
- "critical"
13518
- ]).default("normal"),
13519
14612
  metadata: record(string(), unknown()).optional()
13520
- }), _void(), { kind: "mutation" }), method(_void(), object({
14613
+ });
14614
+ /** One declared native severity/priority level for a kind. */
14615
+ var TargetKindLevelSchema = object({
14616
+ id: string(),
14617
+ label: string(),
14618
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14619
+ ordinal: number().int().min(1).max(5).nullable(),
14620
+ flags: object({
14621
+ critical: boolean().optional(),
14622
+ silent: boolean().optional(),
14623
+ noPush: boolean().optional()
14624
+ }).optional(),
14625
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14626
+ requires: array(string()).optional(),
14627
+ description: string().optional()
14628
+ });
14629
+ /** The full capability block consulted before dispatch. */
14630
+ var TargetKindCapsSchema = object({
14631
+ attachments: object({
14632
+ mediaTypes: array(AttachmentMediaTypeSchema),
14633
+ mode: _enum([
14634
+ "url",
14635
+ "bytes",
14636
+ "both"
14637
+ ]),
14638
+ max: number().int().nonnegative(),
14639
+ maxBytes: number().int().positive().optional()
14640
+ }),
14641
+ /** Max action buttons (0 = none). */
14642
+ actions: number().int().nonnegative(),
14643
+ levels: array(TargetKindLevelSchema),
14644
+ format: array(NotificationFormatSchema),
14645
+ clickUrl: boolean(),
14646
+ sound: boolean(),
14647
+ ttl: boolean(),
14648
+ bodyMaxLen: number().int().positive()
14649
+ });
14650
+ /**
14651
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14652
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14653
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14654
+ * the union is large and not meant for runtime validation here; the exported
14655
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14656
+ */
14657
+ var ConfigSchemaPassthrough = unknown();
14658
+ var TargetKindSchema = object({
14659
+ kind: string(),
14660
+ label: string(),
14661
+ icon: string(),
14662
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14663
+ addonId: string(),
14664
+ configSchema: ConfigSchemaPassthrough,
14665
+ supportsDiscovery: boolean(),
14666
+ caps: TargetKindCapsSchema
14667
+ });
14668
+ /**
14669
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14670
+ * (return a presence marker only) when serving `listTargets` — never
14671
+ * round-trip a stored secret to the UI.
14672
+ */
14673
+ var TargetSchema = object({
14674
+ id: string(),
14675
+ name: string(),
14676
+ kind: string(),
14677
+ addonId: string(),
14678
+ enabled: boolean(),
14679
+ config: record(string(), unknown())
14680
+ });
14681
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14682
+ var DiscoveredTargetSchema = object({
14683
+ kind: string(),
14684
+ suggestedName: string(),
14685
+ config: record(string(), unknown())
14686
+ });
14687
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14688
+ var RenderedAsSchema = object({
14689
+ level: string(),
14690
+ format: NotificationFormatSchema,
14691
+ attachmentsSent: number().int().nonnegative(),
14692
+ actionsSent: number().int().nonnegative(),
14693
+ truncated: boolean(),
14694
+ dropped: array(string())
14695
+ });
14696
+ var SendResultSchema = object({
13521
14697
  success: boolean(),
13522
- error: string().optional()
13523
- }), { kind: "mutation" });
14698
+ error: string().optional(),
14699
+ renderedAs: RenderedAsSchema.optional()
14700
+ });
14701
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14702
+ var TestResultSchema = SendResultSchema;
14703
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14704
+ kind: string(),
14705
+ config: record(string(), unknown()).optional()
14706
+ }), array(DiscoveredTargetSchema)), method(object({
14707
+ targetId: string(),
14708
+ notification: NotificationSchema
14709
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14710
+ targetId: string(),
14711
+ sample: NotificationSchema.optional()
14712
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14713
+ targetId: string(),
14714
+ enabled: boolean()
14715
+ }), _void(), { kind: "mutation" });
13524
14716
  /**
13525
14717
  * Zod schemas for persisted record types.
13526
14718
  *
@@ -14030,7 +15222,10 @@ var AgentLoadSummarySchema = object({
14030
15222
  online: boolean(),
14031
15223
  load: RunnerLocalLoadSchema,
14032
15224
  /** Computed score used by the L2 capacity balancer (lower = less loaded). */
14033
- score: number()
15225
+ score: number(),
15226
+ /** This node's decode hwaccel backend (per-node `probedBestHwaccel`), or null
15227
+ * when not yet probed — for the cluster Pipeline table UI (P0.2). */
15228
+ decodeHwaccel: string().nullable()
14034
15229
  });
14035
15230
  /**
14036
15231
  * Aggregate metrics across the whole detection cluster. Replaces the legacy
@@ -16548,7 +17743,10 @@ var HwAccelBackendInputSchema = _enum([
16548
17743
  "webgpu",
16549
17744
  "none"
16550
17745
  ]).nullable().optional();
16551
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17746
+ var HwAccelResolutionSchema = object({
17747
+ preferred: array(string()).readonly(),
17748
+ rationale: string()
17749
+ });
16552
17750
  var HardwareEncoderIdSchema = _enum([
16553
17751
  "h264_videotoolbox",
16554
17752
  "hevc_videotoolbox",
@@ -16563,7 +17761,7 @@ var HardwareEncoderIdSchema = _enum([
16563
17761
  "libx264",
16564
17762
  "libx265"
16565
17763
  ]);
16566
- var HardwareEncodersSchema = object({
17764
+ object({
16567
17765
  encoders: array(object({
16568
17766
  encoder: HardwareEncoderIdSchema,
16569
17767
  codec: _enum(["H264", "H265"]),
@@ -16582,15 +17780,7 @@ var HardwareEncodersSchema = object({
16582
17780
  defaultH265: HardwareEncoderIdSchema,
16583
17781
  probedAt: number()
16584
17782
  });
16585
- /**
16586
- * Decode-side companion to {@link HardwareEncodersSchema}: the `-hwaccel`
16587
- * methods the configured ffmpeg binary actually supports (parsed from
16588
- * `ffmpeg -hwaccels`). Used to gate decode-hwaccel attempts so the transcode
16589
- * egress never spends a spawn on a backend this build cannot offer. Per-stream
16590
- * decode fragility (e.g. VideoToolbox HEVC) is still handled by the egress's
16591
- * software fallback — this only filters out wholly-unsupported backends.
16592
- */
16593
- var HardwareDecodeAccelsSchema = object({
17783
+ object({
16594
17784
  methods: array(string()).readonly(),
16595
17785
  probedAt: number()
16596
17786
  });
@@ -16653,16 +17843,7 @@ var ResolvedInferenceConfigSchema = object({
16653
17843
  format: ModelFormatSchema,
16654
17844
  reason: string()
16655
17845
  });
16656
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16657
- prefer: HwAccelBackendInputSchema,
16658
- nodeId: string().optional()
16659
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16660
- kind: "mutation",
16661
- auth: "admin"
16662
- }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
16663
- kind: "mutation",
16664
- auth: "admin"
16665
- });
17846
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema);
16666
17847
  var PtzPresetSchema = object({
16667
17848
  id: string(),
16668
17849
  name: string()
@@ -16715,6 +17896,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16715
17896
  kind: "mutation",
16716
17897
  auth: "admin"
16717
17898
  });
17899
+ /**
17900
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17901
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17902
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17903
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17904
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17905
+ * annotations that are not exposed here and must not be treated as an event
17906
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17907
+ * (`interfaces/recording-config.ts`).
17908
+ */
16718
17909
  var RecordingStatusSchema = object({
16719
17910
  deviceId: number(),
16720
17911
  enabled: boolean(),
@@ -18351,6 +19542,12 @@ Object.freeze({
18351
19542
  addonId: null,
18352
19543
  access: "view"
18353
19544
  },
19545
+ "deviceManager.getRoleDisplayDefaults": {
19546
+ capName: "device-manager",
19547
+ capScope: "system",
19548
+ addonId: null,
19549
+ access: "view"
19550
+ },
18354
19551
  "deviceManager.getSettingsSchema": {
18355
19552
  capName: "device-manager",
18356
19553
  capScope: "system",
@@ -18501,6 +19698,12 @@ Object.freeze({
18501
19698
  addonId: null,
18502
19699
  access: "create"
18503
19700
  },
19701
+ "deviceManager.setDisplay": {
19702
+ capName: "device-manager",
19703
+ capScope: "system",
19704
+ addonId: null,
19705
+ access: "create"
19706
+ },
18504
19707
  "deviceManager.setIntegrationId": {
18505
19708
  capName: "device-manager",
18506
19709
  capScope: "system",
@@ -18543,6 +19746,12 @@ Object.freeze({
18543
19746
  addonId: null,
18544
19747
  access: "create"
18545
19748
  },
19749
+ "deviceManager.setRoleDisplayDefaults": {
19750
+ capName: "device-manager",
19751
+ capScope: "system",
19752
+ addonId: null,
19753
+ access: "create"
19754
+ },
18546
19755
  "deviceManager.setStreamProfileMap": {
18547
19756
  capName: "device-manager",
18548
19757
  capScope: "system",
@@ -19521,13 +20730,49 @@ Object.freeze({
19521
20730
  addonId: null,
19522
20731
  access: "create"
19523
20732
  },
20733
+ "notificationOutput.deleteTarget": {
20734
+ capName: "notification-output",
20735
+ capScope: "system",
20736
+ addonId: null,
20737
+ access: "delete"
20738
+ },
20739
+ "notificationOutput.discoverTargets": {
20740
+ capName: "notification-output",
20741
+ capScope: "system",
20742
+ addonId: null,
20743
+ access: "view"
20744
+ },
20745
+ "notificationOutput.listTargetKinds": {
20746
+ capName: "notification-output",
20747
+ capScope: "system",
20748
+ addonId: null,
20749
+ access: "view"
20750
+ },
20751
+ "notificationOutput.listTargets": {
20752
+ capName: "notification-output",
20753
+ capScope: "system",
20754
+ addonId: null,
20755
+ access: "view"
20756
+ },
19524
20757
  "notificationOutput.send": {
19525
20758
  capName: "notification-output",
19526
20759
  capScope: "system",
19527
20760
  addonId: null,
19528
20761
  access: "create"
19529
20762
  },
19530
- "notificationOutput.sendTest": {
20763
+ "notificationOutput.setTargetEnabled": {
20764
+ capName: "notification-output",
20765
+ capScope: "system",
20766
+ addonId: null,
20767
+ access: "create"
20768
+ },
20769
+ "notificationOutput.testTarget": {
20770
+ capName: "notification-output",
20771
+ capScope: "system",
20772
+ addonId: null,
20773
+ access: "create"
20774
+ },
20775
+ "notificationOutput.upsertTarget": {
19531
20776
  capName: "notification-output",
19532
20777
  capScope: "system",
19533
20778
  addonId: null,
@@ -19557,6 +20802,66 @@ Object.freeze({
19557
20802
  addonId: null,
19558
20803
  access: "create"
19559
20804
  },
20805
+ "petFeeder.callPet": {
20806
+ capName: "pet-feeder",
20807
+ capScope: "device",
20808
+ addonId: null,
20809
+ access: "create"
20810
+ },
20811
+ "petFeeder.cancelFeed": {
20812
+ capName: "pet-feeder",
20813
+ capScope: "device",
20814
+ addonId: null,
20815
+ access: "create"
20816
+ },
20817
+ "petFeeder.feed": {
20818
+ capName: "pet-feeder",
20819
+ capScope: "device",
20820
+ addonId: null,
20821
+ access: "create"
20822
+ },
20823
+ "petFeeder.markFoodReplenished": {
20824
+ capName: "pet-feeder",
20825
+ capScope: "device",
20826
+ addonId: null,
20827
+ access: "create"
20828
+ },
20829
+ "petFeeder.playSound": {
20830
+ capName: "pet-feeder",
20831
+ capScope: "device",
20832
+ addonId: null,
20833
+ access: "create"
20834
+ },
20835
+ "petFeeder.resetDesiccant": {
20836
+ capName: "pet-feeder",
20837
+ capScope: "device",
20838
+ addonId: null,
20839
+ access: "delete"
20840
+ },
20841
+ "petFeeder.setChildLock": {
20842
+ capName: "pet-feeder",
20843
+ capScope: "device",
20844
+ addonId: null,
20845
+ access: "create"
20846
+ },
20847
+ "petFeeder.setFeedSound": {
20848
+ capName: "pet-feeder",
20849
+ capScope: "device",
20850
+ addonId: null,
20851
+ access: "create"
20852
+ },
20853
+ "petFeeder.setIndicatorLight": {
20854
+ capName: "pet-feeder",
20855
+ capScope: "device",
20856
+ addonId: null,
20857
+ access: "create"
20858
+ },
20859
+ "petFeeder.setVolume": {
20860
+ capName: "pet-feeder",
20861
+ capScope: "device",
20862
+ addonId: null,
20863
+ access: "create"
20864
+ },
19560
20865
  "pipelineAnalytics.clearTracks": {
19561
20866
  capName: "pipeline-analytics",
19562
20867
  capScope: "device",
@@ -20163,30 +21468,6 @@ Object.freeze({
20163
21468
  addonId: null,
20164
21469
  access: "view"
20165
21470
  },
20166
- "platformProbe.getHardwareDecodeAccels": {
20167
- capName: "platform-probe",
20168
- capScope: "system",
20169
- addonId: null,
20170
- access: "view"
20171
- },
20172
- "platformProbe.getHardwareEncoders": {
20173
- capName: "platform-probe",
20174
- capScope: "system",
20175
- addonId: null,
20176
- access: "view"
20177
- },
20178
- "platformProbe.refreshHardwareDecodeAccels": {
20179
- capName: "platform-probe",
20180
- capScope: "system",
20181
- addonId: null,
20182
- access: "create"
20183
- },
20184
- "platformProbe.refreshHardwareEncoders": {
20185
- capName: "platform-probe",
20186
- capScope: "system",
20187
- addonId: null,
20188
- access: "create"
20189
- },
20190
21471
  "platformProbe.resolveHwAccel": {
20191
21472
  capName: "platform-probe",
20192
21473
  capScope: "system",