@camstack/addon-model-studio 1.0.13 → 1.0.14

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.
@@ -4661,7 +4661,7 @@ function _instanceof(cls, params = {}) {
4661
4661
  return inst;
4662
4662
  }
4663
4663
  //#endregion
4664
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4664
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4665
4665
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4666
4666
  EventCategory["SystemBoot"] = "system.boot";
4667
4667
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5474,6 +5474,100 @@ function createDurableState(deps) {
5474
5474
  };
5475
5475
  }
5476
5476
  /**
5477
+ * Per-node scoping for the shared addon-settings blob.
5478
+ *
5479
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5480
+ * hub-routed — the hub instance answers for every node), so fields whose
5481
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5482
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5483
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5484
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5485
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5486
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5487
+ *
5488
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5489
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5490
+ * schema and routes reads/writes through these helpers.
5491
+ *
5492
+ * ## No bare-key fallback — deliberate
5493
+ *
5494
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5495
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5496
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5497
+ * the store is invisible to every node, hub included, so one node's
5498
+ * selection can never leak onto another. (This generalizes the
5499
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5500
+ * arbitrary set of per-node field keys.)
5501
+ *
5502
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5503
+ * LEAF module: import it via its deep path, never from the root barrel.
5504
+ */
5505
+ /**
5506
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5507
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5508
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5509
+ * `undefined` / `null` / empty falls back to `'hub'`.
5510
+ */
5511
+ function normalizeNodeId(raw) {
5512
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5513
+ const slashIdx = raw.indexOf("/");
5514
+ if (slashIdx < 0) return raw;
5515
+ const bare = raw.slice(0, slashIdx);
5516
+ return bare === "" ? "hub" : bare;
5517
+ }
5518
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5519
+ function nodeScopedKey(base, nodeId) {
5520
+ return `${base}@${normalizeNodeId(nodeId)}`;
5521
+ }
5522
+ /**
5523
+ * Read a node's value for a per-node field from the raw shared store:
5524
+ * the node-scoped key when present, otherwise `undefined`.
5525
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5526
+ * schema `default` win on `undefined`.
5527
+ */
5528
+ function readNodeValue(store, base, nodeId) {
5529
+ return store[nodeScopedKey(base, nodeId)];
5530
+ }
5531
+ /**
5532
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5533
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5534
+ * the write path so a save for one node never clobbers another node's value
5535
+ * (and the bare key is never written). Returns a new object — the input
5536
+ * patch is not mutated.
5537
+ */
5538
+ function scopePatch(patch, perNodeKeys, nodeId) {
5539
+ const out = {};
5540
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5541
+ return out;
5542
+ }
5543
+ /**
5544
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5545
+ * UI schema (whose field keys are bare) hydrates from that node's own
5546
+ * values:
5547
+ *
5548
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5549
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5550
+ * legacy key must never hydrate any node — no bare fallback).
5551
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5552
+ * each bare perNode key; when the node has no scoped key the bare key is
5553
+ * left ABSENT so the field's schema `default` wins.
5554
+ *
5555
+ * Returns a new object — the input store is not mutated.
5556
+ */
5557
+ function projectStore(store, perNodeKeys, nodeId) {
5558
+ const out = {};
5559
+ for (const [key, value] of Object.entries(store)) {
5560
+ if (key.includes("@")) continue;
5561
+ if (perNodeKeys.has(key)) continue;
5562
+ out[key] = value;
5563
+ }
5564
+ for (const base of perNodeKeys) {
5565
+ const value = readNodeValue(store, base, nodeId);
5566
+ if (value !== void 0) out[base] = value;
5567
+ }
5568
+ return out;
5569
+ }
5570
+ /**
5477
5571
  * Base class for CamStack addons. Eliminates settings boilerplate:
5478
5572
  *
5479
5573
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5641,23 +5735,63 @@ var BaseAddon = class {
5641
5735
  deviceSettingsSchema() {
5642
5736
  return null;
5643
5737
  }
5644
- async getGlobalSettings(overlay, cap, _nodeId) {
5738
+ async getGlobalSettings(overlay, cap, nodeId) {
5645
5739
  const schema = this.globalSettingsSchema(cap);
5646
5740
  if (!schema) return { sections: [] };
5647
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5741
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5648
5742
  return hydrateSchema(schema, overlay ? {
5649
- ...raw,
5743
+ ...projected,
5650
5744
  ...overlay
5651
- } : raw);
5745
+ } : projected);
5746
+ }
5747
+ /**
5748
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5749
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5750
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5751
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5752
+ * A no-op passthrough when the schema declares no `perNode` field.
5753
+ *
5754
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5755
+ * the store for custom option logic (option narrowing, value snapping) to
5756
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5757
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5758
+ */
5759
+ async resolveGlobalStore(nodeId, cap) {
5760
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5761
+ const keys = this.perNodeKeys(cap);
5762
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5763
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5652
5764
  }
5653
- async updateGlobalSettings(patch, _nodeId) {
5654
- await this._ctx?.settings?.writeAddonStore(patch);
5765
+ async updateGlobalSettings(patch, nodeId) {
5766
+ const keys = this.perNodeKeys();
5767
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5768
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5769
+ const barePatch = patch;
5770
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5771
+ await this._ctx?.settings?.writeAddonStore(scoped);
5772
+ if (target !== localNode) return;
5655
5773
  await this.resolveConfig();
5656
5774
  await this.onConfigChanged();
5657
5775
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5658
5776
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5659
5777
  }
5660
5778
  /**
5779
+ * The set of field keys the global settings schema declares `perNode: true`
5780
+ * — derived once per `cap` argument and memoized (schemas are static
5781
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5782
+ * settings API behaves exactly like the legacy node-agnostic one.
5783
+ */
5784
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5785
+ perNodeKeys(cap) {
5786
+ const cacheKey = cap ?? "";
5787
+ const cached = this._perNodeKeysCache.get(cacheKey);
5788
+ if (cached) return cached;
5789
+ const schema = this.globalSettingsSchema(cap);
5790
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5791
+ this._perNodeKeysCache.set(cacheKey, keys);
5792
+ return keys;
5793
+ }
5794
+ /**
5661
5795
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5662
5796
  * schedule an addon restart for the next tick. Deferred via
5663
5797
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5810,12 +5944,19 @@ var BaseAddon = class {
5810
5944
  * The merge is shallow: each key in `defaults` is checked against the store.
5811
5945
  * Only keys present in defaults are read — the store can contain extra keys
5812
5946
  * (e.g. from older versions) without polluting the typed config.
5947
+ *
5948
+ * Keys the global settings schema declares `perNode: true` resolve from
5949
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5950
+ * from the bare key — so a per-node field resolves to this node's own
5951
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5813
5952
  */
5814
5953
  async resolveConfig() {
5815
5954
  const stored = await this.readAddonStoreWithRetry();
5955
+ const perNode = this.perNodeKeys();
5956
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5816
5957
  const resolved = { ...this.defaults };
5817
5958
  for (const key of Object.keys(this.defaults)) {
5818
- const storedValue = stored[key];
5959
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5819
5960
  if (storedValue !== void 0 && storedValue !== null) {
5820
5961
  const defaultType = typeof this.defaults[key];
5821
5962
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5899,6 +6040,27 @@ var BaseAddon = class {
5899
6040
  }
5900
6041
  };
5901
6042
  /**
6043
+ * Collect the keys of every field marked `perNode: true`, recursing into
6044
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6045
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6046
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6047
+ */
6048
+ function collectPerNodeFieldKeys(fields) {
6049
+ const collected = [];
6050
+ for (const field of fields) {
6051
+ if (field.type === "group") {
6052
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6053
+ continue;
6054
+ }
6055
+ if (field.type === "sub-tabs") {
6056
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6057
+ continue;
6058
+ }
6059
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6060
+ }
6061
+ return collected;
6062
+ }
6063
+ /**
5902
6064
  * Normalize an `ICamstackAddon.initialize()` return value into the
5903
6065
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5904
6066
  * envelopes pass through; void stays void.
@@ -5923,6 +6085,7 @@ var CamStreamKindSchema = _enum([
5923
6085
  "pull-rtsp",
5924
6086
  "pull-rtmp",
5925
6087
  "pull-http",
6088
+ "pull-flv",
5926
6089
  "pull-rfc4571",
5927
6090
  "push-annexb",
5928
6091
  "derived"
@@ -6305,6 +6468,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6305
6468
  /** Single still-image entity (HA `image.*`). Read-only display of an
6306
6469
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6307
6470
  DeviceType["Image"] = "image";
6471
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6472
+ * level, battery, desiccant life, feeding state and manual-feed /
6473
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6474
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6475
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6476
+ * integrations sharing the same food/desiccant/hopper surface. */
6477
+ DeviceType["PetFeeder"] = "pet-feeder";
6308
6478
  return DeviceType;
6309
6479
  }({});
6310
6480
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7484,6 +7654,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7484
7654
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7485
7655
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7486
7656
  /**
7657
+ * Error types for the safe expression engine. Two distinct classes so callers
7658
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7659
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7660
+ */
7661
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7662
+ * the failure is anchored to a character (author-facing inline feedback). */
7663
+ var ExpressionParseError = class extends Error {
7664
+ position;
7665
+ constructor(message, position) {
7666
+ super(message);
7667
+ this.name = "ExpressionParseError";
7668
+ this.position = position;
7669
+ }
7670
+ };
7671
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7672
+ * result, unknown builtin, step-budget exceeded). */
7673
+ var ExpressionEvalError = class extends Error {
7674
+ constructor(message) {
7675
+ super(message);
7676
+ this.name = "ExpressionEvalError";
7677
+ }
7678
+ };
7679
+ /**
7680
+ * Resource-bound constants for the safe expression engine.
7681
+ *
7682
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7683
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7684
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7685
+ * work a single author-supplied expression can request, so a hostile or
7686
+ * accidental pathological string can never spend unbounded CPU/memory.
7687
+ */
7688
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7689
+ * rejected without allocation. */
7690
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7691
+ /** A legal binding / identifier name. */
7692
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7693
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7694
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7695
+ var RESERVED_BINDING_NAMES = new Set([
7696
+ "now",
7697
+ "true",
7698
+ "false",
7699
+ "null"
7700
+ ]);
7701
+ /**
7702
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7703
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7704
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7705
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7706
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7707
+ * is a parse error with a source position, so member access / assignment /
7708
+ * template literals are lexically impossible.
7709
+ */
7710
+ var KEYWORDS = new Set([
7711
+ "true",
7712
+ "false",
7713
+ "null"
7714
+ ]);
7715
+ function isDigit(ch) {
7716
+ return ch >= "0" && ch <= "9";
7717
+ }
7718
+ function isIdentStart(ch) {
7719
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7720
+ }
7721
+ function isIdentPart(ch) {
7722
+ return isIdentStart(ch) || isDigit(ch);
7723
+ }
7724
+ function isWhitespace(ch) {
7725
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7726
+ }
7727
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7728
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7729
+ * string. */
7730
+ function tokenize(source) {
7731
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7732
+ const tokens = [];
7733
+ let i = 0;
7734
+ const n = source.length;
7735
+ while (i < n) {
7736
+ const ch = source[i];
7737
+ if (isWhitespace(ch)) {
7738
+ i += 1;
7739
+ continue;
7740
+ }
7741
+ if (isDigit(ch)) {
7742
+ const start = i;
7743
+ while (i < n && isDigit(source[i])) i += 1;
7744
+ if (i < n && source[i] === ".") {
7745
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7746
+ i += 1;
7747
+ while (i < n && isDigit(source[i])) i += 1;
7748
+ }
7749
+ const text = source.slice(start, i);
7750
+ const value = Number(text);
7751
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7752
+ tokens.push({
7753
+ type: "number",
7754
+ value,
7755
+ pos: start
7756
+ });
7757
+ continue;
7758
+ }
7759
+ if (ch === "'" || ch === "\"") {
7760
+ const quote = ch;
7761
+ const start = i;
7762
+ i += 1;
7763
+ let out = "";
7764
+ let closed = false;
7765
+ while (i < n) {
7766
+ const c = source[i];
7767
+ if (c === "\\") {
7768
+ const next = i + 1 < n ? source[i + 1] : "";
7769
+ if (next === "\\" || next === "'" || next === "\"") {
7770
+ out += next;
7771
+ i += 2;
7772
+ continue;
7773
+ }
7774
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7775
+ }
7776
+ if (c === quote) {
7777
+ closed = true;
7778
+ i += 1;
7779
+ break;
7780
+ }
7781
+ out += c;
7782
+ i += 1;
7783
+ }
7784
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7785
+ tokens.push({
7786
+ type: "string",
7787
+ value: out,
7788
+ pos: start
7789
+ });
7790
+ continue;
7791
+ }
7792
+ if (isIdentStart(ch)) {
7793
+ const start = i;
7794
+ while (i < n && isIdentPart(source[i])) i += 1;
7795
+ const text = source.slice(start, i);
7796
+ if (KEYWORDS.has(text)) tokens.push({
7797
+ type: "keyword",
7798
+ keyword: keywordOf(text),
7799
+ pos: start
7800
+ });
7801
+ else tokens.push({
7802
+ type: "identifier",
7803
+ name: text,
7804
+ pos: start
7805
+ });
7806
+ continue;
7807
+ }
7808
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7809
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7810
+ tokens.push({
7811
+ type: "punct",
7812
+ punct: two,
7813
+ pos: i
7814
+ });
7815
+ i += 2;
7816
+ continue;
7817
+ }
7818
+ if (isSinglePunct(ch)) {
7819
+ tokens.push({
7820
+ type: "punct",
7821
+ punct: ch,
7822
+ pos: i
7823
+ });
7824
+ i += 1;
7825
+ continue;
7826
+ }
7827
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7828
+ }
7829
+ tokens.push({
7830
+ type: "eof",
7831
+ pos: n
7832
+ });
7833
+ return tokens;
7834
+ }
7835
+ function keywordOf(text) {
7836
+ if (text === "true") return "true";
7837
+ if (text === "false") return "false";
7838
+ return "null";
7839
+ }
7840
+ function isSinglePunct(ch) {
7841
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7842
+ }
7843
+ /**
7844
+ * Frozen, null-prototype builtin function table for the expression engine
7845
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7846
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7847
+ * own-property check against it.
7848
+ *
7849
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7850
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7851
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7852
+ * (there is no `Object.prototype` in the chain), so those names are not
7853
+ * callable — they are simply "unknown function" at parse time.
7854
+ *
7855
+ * Every numeric argument is validated as a finite number and every numeric
7856
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7857
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7858
+ * closed rather than emitting a garbage value.
7859
+ */
7860
+ function asFiniteNumber(value, name, index) {
7861
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7862
+ return value;
7863
+ }
7864
+ function asString$1(value, name, index) {
7865
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7866
+ return value;
7867
+ }
7868
+ function finiteResult(value, name) {
7869
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7870
+ return value;
7871
+ }
7872
+ function allFiniteNumbers(args, name) {
7873
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7874
+ }
7875
+ var INF = Number.POSITIVE_INFINITY;
7876
+ var table = {
7877
+ min: {
7878
+ minArgs: 1,
7879
+ maxArgs: INF,
7880
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7881
+ },
7882
+ max: {
7883
+ minArgs: 1,
7884
+ maxArgs: INF,
7885
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7886
+ },
7887
+ abs: {
7888
+ minArgs: 1,
7889
+ maxArgs: 1,
7890
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7891
+ },
7892
+ floor: {
7893
+ minArgs: 1,
7894
+ maxArgs: 1,
7895
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7896
+ },
7897
+ ceil: {
7898
+ minArgs: 1,
7899
+ maxArgs: 1,
7900
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7901
+ },
7902
+ sqrt: {
7903
+ minArgs: 1,
7904
+ maxArgs: 1,
7905
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7906
+ },
7907
+ round: {
7908
+ minArgs: 1,
7909
+ maxArgs: 2,
7910
+ apply: (args) => {
7911
+ const x = asFiniteNumber(args[0], "round", 0);
7912
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7913
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7914
+ const factor = 10 ** digits;
7915
+ return finiteResult(Math.round(x * factor) / factor, "round");
7916
+ }
7917
+ },
7918
+ pow: {
7919
+ minArgs: 2,
7920
+ maxArgs: 2,
7921
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7922
+ },
7923
+ clamp: {
7924
+ minArgs: 3,
7925
+ maxArgs: 3,
7926
+ apply: (args) => {
7927
+ const x = asFiniteNumber(args[0], "clamp", 0);
7928
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7929
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7930
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7931
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7932
+ }
7933
+ },
7934
+ avg: {
7935
+ minArgs: 1,
7936
+ maxArgs: INF,
7937
+ apply: (args) => {
7938
+ const nums = allFiniteNumbers(args, "avg");
7939
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7940
+ }
7941
+ },
7942
+ sum: {
7943
+ minArgs: 1,
7944
+ maxArgs: INF,
7945
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7946
+ },
7947
+ coalesce: {
7948
+ minArgs: 1,
7949
+ maxArgs: INF,
7950
+ apply: (args) => {
7951
+ for (const a of args) if (a !== null) return a;
7952
+ return null;
7953
+ }
7954
+ },
7955
+ age: {
7956
+ minArgs: 2,
7957
+ maxArgs: 2,
7958
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7959
+ },
7960
+ convert: {
7961
+ minArgs: 3,
7962
+ maxArgs: 3,
7963
+ apply: (args, hooks) => {
7964
+ const x = asFiniteNumber(args[0], "convert", 0);
7965
+ const from = asString$1(args[1], "convert", 1).trim();
7966
+ const to = asString$1(args[2], "convert", 2).trim();
7967
+ if (hooks.convert) {
7968
+ const out = hooks.convert(x, from, to);
7969
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7970
+ return finiteResult(out, "convert");
7971
+ }
7972
+ if (from === to) return x;
7973
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7974
+ }
7975
+ }
7976
+ };
7977
+ Object.freeze(Object.assign(Object.create(null), table));
7978
+ /** The set of valid builtin names — used by the parser to reject unknown
7979
+ * callees at parse time (immediate author feedback). */
7980
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7981
+ /**
7982
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7983
+ *
7984
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7985
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7986
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7987
+ * string validated against the builtin table at parse time, so an unknown
7988
+ * function is rejected immediately (author feedback) and a persisted expression
7989
+ * that references a since-removed builtin degrades at read.
7990
+ *
7991
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7992
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7993
+ */
7994
+ /** Binary/logical operator precedence (higher binds tighter). */
7995
+ var BINARY_PRECEDENCE = {
7996
+ "||": 1,
7997
+ "&&": 2,
7998
+ "==": 3,
7999
+ "!=": 3,
8000
+ "<": 4,
8001
+ "<=": 4,
8002
+ ">": 4,
8003
+ ">=": 4,
8004
+ "+": 5,
8005
+ "-": 5,
8006
+ "*": 6,
8007
+ "/": 6,
8008
+ "%": 6
8009
+ };
8010
+ function isLogicalOp(op) {
8011
+ return op === "&&" || op === "||";
8012
+ }
8013
+ function isBinaryOp(op) {
8014
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
8015
+ }
8016
+ var Parser = class {
8017
+ tokens;
8018
+ pos = 0;
8019
+ nodeCount = 0;
8020
+ identifiers = /* @__PURE__ */ new Set();
8021
+ callees = /* @__PURE__ */ new Set();
8022
+ constructor(tokens) {
8023
+ this.tokens = tokens;
8024
+ }
8025
+ parse() {
8026
+ const ast = this.parseTernary();
8027
+ const tok = this.peek();
8028
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8029
+ return {
8030
+ ast,
8031
+ identifiers: this.identifiers,
8032
+ callees: this.callees,
8033
+ nodeCount: this.nodeCount
8034
+ };
8035
+ }
8036
+ peek() {
8037
+ return this.tokens[this.pos];
8038
+ }
8039
+ next() {
8040
+ return this.tokens[this.pos++];
8041
+ }
8042
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8043
+ expectPunct(punct) {
8044
+ const tok = this.peek();
8045
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8046
+ this.pos += 1;
8047
+ }
8048
+ matchPunct(punct) {
8049
+ const tok = this.peek();
8050
+ if (tok.type === "punct" && tok.punct === punct) {
8051
+ this.pos += 1;
8052
+ return true;
8053
+ }
8054
+ return false;
8055
+ }
8056
+ countNode() {
8057
+ this.nodeCount += 1;
8058
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8059
+ }
8060
+ parseTernary() {
8061
+ const test = this.parseBinary(1);
8062
+ if (this.matchPunct("?")) {
8063
+ const consequent = this.parseTernary();
8064
+ this.expectPunct(":");
8065
+ const alternate = this.parseTernary();
8066
+ this.countNode();
8067
+ return {
8068
+ kind: "conditional",
8069
+ test,
8070
+ consequent,
8071
+ alternate
8072
+ };
8073
+ }
8074
+ return test;
8075
+ }
8076
+ parseBinary(minPrec) {
8077
+ let left = this.parseUnary();
8078
+ for (;;) {
8079
+ const tok = this.peek();
8080
+ if (tok.type !== "punct") break;
8081
+ const prec = BINARY_PRECEDENCE[tok.punct];
8082
+ if (prec === void 0 || prec < minPrec) break;
8083
+ const op = tok.punct;
8084
+ this.pos += 1;
8085
+ const right = this.parseBinary(prec + 1);
8086
+ this.countNode();
8087
+ if (isLogicalOp(op)) left = {
8088
+ kind: "logical",
8089
+ op,
8090
+ left,
8091
+ right
8092
+ };
8093
+ else if (isBinaryOp(op)) left = {
8094
+ kind: "binary",
8095
+ op,
8096
+ left,
8097
+ right
8098
+ };
8099
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8100
+ }
8101
+ return left;
8102
+ }
8103
+ parseUnary() {
8104
+ const tok = this.peek();
8105
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8106
+ const op = tok.punct;
8107
+ this.pos += 1;
8108
+ const operand = this.parseUnary();
8109
+ this.countNode();
8110
+ return {
8111
+ kind: "unary",
8112
+ op,
8113
+ operand
8114
+ };
8115
+ }
8116
+ return this.parsePrimary();
8117
+ }
8118
+ parsePrimary() {
8119
+ const tok = this.next();
8120
+ switch (tok.type) {
8121
+ case "number":
8122
+ this.countNode();
8123
+ return {
8124
+ kind: "literal",
8125
+ value: tok.value
8126
+ };
8127
+ case "string":
8128
+ this.countNode();
8129
+ return {
8130
+ kind: "literal",
8131
+ value: tok.value
8132
+ };
8133
+ case "keyword":
8134
+ this.countNode();
8135
+ return {
8136
+ kind: "literal",
8137
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8138
+ };
8139
+ case "identifier": {
8140
+ const nextTok = this.peek();
8141
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8142
+ this.identifiers.add(tok.name);
8143
+ this.countNode();
8144
+ return {
8145
+ kind: "identifier",
8146
+ name: tok.name
8147
+ };
8148
+ }
8149
+ case "punct":
8150
+ if (tok.punct === "(") {
8151
+ const inner = this.parseTernary();
8152
+ this.expectPunct(")");
8153
+ return inner;
8154
+ }
8155
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8156
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8157
+ }
8158
+ }
8159
+ parseCall(callee, pos) {
8160
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8161
+ this.expectPunct("(");
8162
+ const args = [];
8163
+ if (!this.matchPunct(")")) for (;;) {
8164
+ args.push(this.parseTernary());
8165
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8166
+ if (this.matchPunct(",")) continue;
8167
+ this.expectPunct(")");
8168
+ break;
8169
+ }
8170
+ this.callees.add(callee);
8171
+ this.countNode();
8172
+ return {
8173
+ kind: "call",
8174
+ callee,
8175
+ args
8176
+ };
8177
+ }
8178
+ };
8179
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8180
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8181
+ function parseExpression(source) {
8182
+ return new Parser(tokenize(source)).parse();
8183
+ }
8184
+ Object.freeze({});
8185
+ /**
8186
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8187
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8188
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8189
+ * one per read on a hot resolve path.
8190
+ *
8191
+ * The cache is a module-level singleton: entries are pure, content-addressed
8192
+ * ASTs keyed by the raw source string, so sharing one instance across all
8193
+ * callers is safe and maximises hit rate.
8194
+ */
8195
+ var cache = /* @__PURE__ */ new Map();
8196
+ function getCached(source) {
8197
+ const hit = cache.get(source);
8198
+ if (hit !== void 0) {
8199
+ cache.delete(source);
8200
+ cache.set(source, hit);
8201
+ return hit;
8202
+ }
8203
+ let result;
8204
+ try {
8205
+ result = {
8206
+ ok: true,
8207
+ parsed: parseExpression(source)
8208
+ };
8209
+ } catch (err) {
8210
+ result = {
8211
+ ok: false,
8212
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8213
+ };
8214
+ }
8215
+ cache.set(source, result);
8216
+ if (cache.size > 256) {
8217
+ const oldest = cache.keys().next().value;
8218
+ if (oldest !== void 0) cache.delete(oldest);
8219
+ }
8220
+ return result;
8221
+ }
8222
+ /** Compile `source`, returning a discriminated result instead of throwing.
8223
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8224
+ function compileExpressionSafe(source) {
8225
+ return getCached(source);
8226
+ }
8227
+ /**
8228
+ * Author-time validation. Returns `null` when the source is valid, else a
8229
+ * human-readable error message. Checks: the expression compiles; binding count
8230
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8231
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8232
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8233
+ */
8234
+ function validateExpressionSource(src) {
8235
+ const names = Object.keys(src.bindings);
8236
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8237
+ for (const name of names) {
8238
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8239
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8240
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8241
+ }
8242
+ const compiled = compileExpressionSafe(src.expr);
8243
+ if (!compiled.ok) return compiled.error;
8244
+ const bound = new Set(names);
8245
+ for (const id of compiled.parsed.identifiers) {
8246
+ if (id === "now") continue;
8247
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8248
+ }
8249
+ return null;
8250
+ }
8251
+ /**
7487
8252
  * Accessory device helpers — shared across drivers.
7488
8253
  *
7489
8254
  * Many vendor-specific drivers register accessory child devices on
@@ -9386,7 +10151,8 @@ var MotionAnalysisResultSchema = object({
9386
10151
  });
9387
10152
  method(object({
9388
10153
  deviceId: number(),
9389
- frame: FrameInputSchema
10154
+ frame: FrameInputSchema.optional(),
10155
+ frameHandle: FrameHandleSchema.optional()
9390
10156
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9391
10157
  deviceId: number(),
9392
10158
  detected: boolean(),
@@ -9633,6 +10399,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9633
10399
  engine: PipelineEngineChoiceSchema.optional(),
9634
10400
  steps: array(PipelineStepInputSchema).min(1),
9635
10401
  frame: FrameInputSchema.optional(),
10402
+ /**
10403
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10404
+ * the decoded pixels live in. One more member of the one-of
10405
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10406
+ */
10407
+ frameHandle: FrameHandleSchema.optional(),
9636
10408
  imageBase64: string().optional(),
9637
10409
  /**
9638
10410
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9842,6 +10614,31 @@ var ReportMotionInputSchema = object({
9842
10614
  regions: array(MotionRegionSchema).readonly().optional()
9843
10615
  });
9844
10616
  /**
10617
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10618
+ * restream-owner model — P2c).
10619
+ *
10620
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10621
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10622
+ * `frameSource` key) parses to this, so the field is additive with zero
10623
+ * behavior change.
10624
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10625
+ * The runner acquires the owner's COMPRESSED passthrough restream
10626
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10627
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10628
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10629
+ * node-local; only H.264/H.265 packets cross the wire.
10630
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10631
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10632
+ * dials for the owner's restream.
10633
+ */
10634
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10635
+ kind: literal("remote-restream"),
10636
+ /** The camera's source-owner node (slice 1: always the hub). */
10637
+ ownerNodeId: string(),
10638
+ /** Operator override for the owner host the runner dials. */
10639
+ hubHostnameOverride: string().optional()
10640
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10641
+ /**
9845
10642
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9846
10643
  * specific runner instance via `attachCamera`. Carries everything the
9847
10644
  * runner needs to subscribe to the local broker and execute inference.
@@ -9939,7 +10736,15 @@ var RunnerCameraConfigSchema = object({
9939
10736
  */
9940
10737
  onboardMotionDrivesAnalyzer: boolean().default(true),
9941
10738
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9942
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10739
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10740
+ /**
10741
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10742
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10743
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10744
+ * camera's detect node differs from its source-owner (P2d, gated by the
10745
+ * `remoteSourcingNodes` rollout setting).
10746
+ */
10747
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9943
10748
  });
9944
10749
  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;
9945
10750
  /**
@@ -10304,6 +11109,113 @@ object({
10304
11109
  lastFetchedAt: number()
10305
11110
  });
10306
11111
  DeviceType.Sensor;
11112
+ /**
11113
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11114
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11115
+ * `on_batteries` (running on battery backup). `null` until first reported.
11116
+ */
11117
+ var PetFeederDeviceStatusSchema = _enum([
11118
+ "normal",
11119
+ "offline",
11120
+ "on_batteries"
11121
+ ]);
11122
+ var gramsPortion = number().int().min(4).max(200);
11123
+ object({
11124
+ /** Food currently in the bowl (grams). Null when the device has not
11125
+ * reported a reading yet. On dual-hopper models this is the combined
11126
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11127
+ foodLevel: number().nullable(),
11128
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11129
+ * single-hopper models. */
11130
+ food1: number().nullable(),
11131
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11132
+ * single-hopper models. */
11133
+ food2: number().nullable(),
11134
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11135
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11136
+ * below the feeder's low threshold. */
11137
+ lowFood: boolean(),
11138
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11139
+ * device has no battery reading. */
11140
+ batteryPower: number().min(0).max(100).nullable(),
11141
+ /** Days of desiccant life remaining. Null when the model has no
11142
+ * desiccant sensor. */
11143
+ desiccantLeftDays: number().nullable(),
11144
+ /** True while a feed is in progress. */
11145
+ feeding: boolean(),
11146
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11147
+ * Null until the device has reported a status. */
11148
+ status: PetFeederDeviceStatusSchema.nullable(),
11149
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11150
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11151
+ * with `errorCode` for consumers that want the raw integer. */
11152
+ error: string().nullable(),
11153
+ /** Raw device error code (0 / null = no error). */
11154
+ errorCode: number().nullable(),
11155
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11156
+ isDualHopper: boolean(),
11157
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11158
+ childLock: boolean(),
11159
+ /** Front indicator-light setting. */
11160
+ indicatorLight: boolean(),
11161
+ /** Play a chime when dispensing. */
11162
+ feedSound: boolean(),
11163
+ /** Speaker / prompt volume level (device-scaled integer). */
11164
+ volume: number(),
11165
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11166
+ lastFetchedAt: number()
11167
+ });
11168
+ DeviceType.PetFeeder, method(object({
11169
+ deviceId: number().int().nonnegative(),
11170
+ grams: gramsPortion.optional(),
11171
+ hopper1: gramsPortion.optional(),
11172
+ hopper2: gramsPortion.optional()
11173
+ }), _void(), {
11174
+ kind: "mutation",
11175
+ auth: "admin"
11176
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11177
+ kind: "mutation",
11178
+ auth: "admin"
11179
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11180
+ kind: "mutation",
11181
+ auth: "admin"
11182
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11183
+ kind: "mutation",
11184
+ auth: "admin"
11185
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11186
+ kind: "mutation",
11187
+ auth: "admin"
11188
+ }), method(object({
11189
+ deviceId: number().int().nonnegative(),
11190
+ soundId: number().int().nonnegative()
11191
+ }), _void(), {
11192
+ kind: "mutation",
11193
+ auth: "admin"
11194
+ }), method(object({
11195
+ deviceId: number().int().nonnegative(),
11196
+ on: boolean()
11197
+ }), _void(), {
11198
+ kind: "mutation",
11199
+ auth: "admin"
11200
+ }), method(object({
11201
+ deviceId: number().int().nonnegative(),
11202
+ on: boolean()
11203
+ }), _void(), {
11204
+ kind: "mutation",
11205
+ auth: "admin"
11206
+ }), method(object({
11207
+ deviceId: number().int().nonnegative(),
11208
+ on: boolean()
11209
+ }), _void(), {
11210
+ kind: "mutation",
11211
+ auth: "admin"
11212
+ }), method(object({
11213
+ deviceId: number().int().nonnegative(),
11214
+ level: number().int().nonnegative()
11215
+ }), _void(), {
11216
+ kind: "mutation",
11217
+ auth: "admin"
11218
+ });
10307
11219
  object({
10308
11220
  /** Instantaneous power draw in watts. */
10309
11221
  watts: number().optional(),
@@ -12164,10 +13076,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12164
13076
  url: string()
12165
13077
  }), _void()), method(object({
12166
13078
  sessionId: string(),
12167
- maxCount: number().default(1)
13079
+ maxCount: number().default(1),
13080
+ waitMs: number().optional()
12168
13081
  }), array(DecodedFrameSchema)), method(object({
12169
13082
  sessionId: string(),
12170
- maxCount: number().default(1)
13083
+ maxCount: number().default(1),
13084
+ waitMs: number().optional()
12171
13085
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12172
13086
  sessionId: string(),
12173
13087
  config: DecoderSessionConfigSchema.partial()
@@ -12454,14 +13368,63 @@ var ChildLayoutEntrySchema = object({
12454
13368
  collapsed: boolean().optional()
12455
13369
  });
12456
13370
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12457
- * `device-management.ts`. */
13371
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13372
+ * accessory's status field (`kind` optional/absent for wire compat); a
13373
+ * LITERAL source carries a per-device constant (no sibling is read); a
13374
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13375
+ * source device's full re-sync-stable `stableId`. */
13376
+ var DeviceLinkFieldSourceSchema = object({
13377
+ kind: literal("field").optional(),
13378
+ sourceKey: string(),
13379
+ cap: string(),
13380
+ fieldPath: string()
13381
+ });
13382
+ var DeviceLinkLiteralSourceSchema = object({
13383
+ kind: literal("literal"),
13384
+ value: union([
13385
+ string(),
13386
+ number(),
13387
+ boolean(),
13388
+ _null()
13389
+ ])
13390
+ });
13391
+ var DeviceLinkGlobalSourceSchema = object({
13392
+ kind: literal("global"),
13393
+ sourceStableId: string(),
13394
+ cap: string(),
13395
+ fieldPath: string()
13396
+ });
13397
+ /** Expression source (Stage X): compute the target field from N named bindings
13398
+ * via the safe expression engine. Bindings are field | literal | global — never
13399
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13400
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13401
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13402
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13403
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13404
+ var DeviceLinkExpressionSourceSchema = object({
13405
+ kind: literal("expression"),
13406
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13407
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13408
+ DeviceLinkFieldSourceSchema,
13409
+ DeviceLinkLiteralSourceSchema,
13410
+ DeviceLinkGlobalSourceSchema
13411
+ ]))
13412
+ }).superRefine((src, ctx) => {
13413
+ const err = validateExpressionSource(src);
13414
+ if (err !== null) ctx.addIssue({
13415
+ code: "custom",
13416
+ message: err,
13417
+ path: ["expr"]
13418
+ });
13419
+ });
12458
13420
  var DeviceLinkSchema = object({
12459
13421
  id: string(),
12460
- source: object({
12461
- sourceKey: string(),
12462
- cap: string(),
12463
- fieldPath: string()
12464
- }),
13422
+ source: union([
13423
+ DeviceLinkFieldSourceSchema,
13424
+ DeviceLinkLiteralSourceSchema,
13425
+ DeviceLinkGlobalSourceSchema,
13426
+ DeviceLinkExpressionSourceSchema
13427
+ ]),
12465
13428
  target: object({
12466
13429
  cap: string(),
12467
13430
  fieldPath: string(),
@@ -12490,6 +13453,31 @@ var DeviceLinkSchema = object({
12490
13453
  })
12491
13454
  ]).optional()
12492
13455
  });
13456
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13457
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13458
+ var DeviceCapDisplayOverrideSchema = object({
13459
+ unit: string().min(1).optional(),
13460
+ precision: number().int().min(0).max(10).optional()
13461
+ });
13462
+ /** Cap-wire shape of an operator-authored per-device display override —
13463
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13464
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13465
+ var DeviceDisplayOverrideSchema = object({
13466
+ icon: string().min(1).optional(),
13467
+ label: string().min(1).optional(),
13468
+ unit: string().min(1).optional(),
13469
+ precision: number().int().min(0).max(10).optional(),
13470
+ hidden: boolean().optional(),
13471
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13472
+ });
13473
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13474
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13475
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13476
+ var RoleDisplayDefaultSchema = object({
13477
+ unit: string().min(1).optional(),
13478
+ precision: number().int().min(0).max(10).optional(),
13479
+ icon: string().min(1).optional()
13480
+ });
12493
13481
  /**
12494
13482
  * Serializable projection of a live IDevice.
12495
13483
  * Returned by listAll, getDevice, getChildren.
@@ -12545,7 +13533,9 @@ var DeviceInfoSchema = object({
12545
13533
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12546
13534
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12547
13535
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12548
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13536
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13537
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13538
+ display: DeviceDisplayOverrideSchema.optional()
12549
13539
  });
12550
13540
  var ConfigEntrySchema = object({
12551
13541
  key: string(),
@@ -12610,7 +13600,9 @@ var DeviceMetaSchema = object({
12610
13600
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12611
13601
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12612
13602
  * Optional: only present for accessory children that carry a known role. */
12613
- role: string().nullable().optional()
13603
+ role: string().nullable().optional(),
13604
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13605
+ display: DeviceDisplayOverrideSchema.optional()
12614
13606
  });
12615
13607
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12616
13608
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12704,7 +13696,19 @@ method(object({
12704
13696
  }), _void(), {
12705
13697
  kind: "mutation",
12706
13698
  auth: "admin"
12707
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13699
+ }), method(object({
13700
+ deviceId: number(),
13701
+ display: DeviceDisplayOverrideSchema.nullable()
13702
+ }), _void(), {
13703
+ kind: "mutation",
13704
+ auth: "admin"
13705
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13706
+ kind: "mutation",
13707
+ auth: "admin"
13708
+ }), method(object({
13709
+ deviceId: number(),
13710
+ includeSynthesizable: boolean().optional()
13711
+ }), object({ caps: array(object({
12708
13712
  cap: string(),
12709
13713
  fields: array(object({
12710
13714
  path: string(),
@@ -12714,8 +13718,13 @@ method(object({
12714
13718
  "boolean",
12715
13719
  "enum"
12716
13720
  ]),
12717
- enumValues: array(string()).optional()
12718
- })).readonly()
13721
+ enumValues: array(string()).optional(),
13722
+ item: boolean().optional()
13723
+ })).readonly(),
13724
+ itemArray: object({
13725
+ path: string(),
13726
+ keyField: string()
13727
+ }).optional()
12719
13728
  })).readonly() }), { kind: "query" }), method(object({
12720
13729
  deviceId: number(),
12721
13730
  role: string().nullable()
@@ -12785,7 +13794,11 @@ method(object({
12785
13794
  deviceId: number(),
12786
13795
  entries: array(object({
12787
13796
  capName: string(),
12788
- kind: _enum(["native", "wrapped"]),
13797
+ kind: _enum([
13798
+ "native",
13799
+ "wrapped",
13800
+ "linked"
13801
+ ]),
12789
13802
  providerAddonId: string(),
12790
13803
  providerNodeId: string(),
12791
13804
  nativeAddonId: string()
@@ -12794,7 +13807,11 @@ method(object({
12794
13807
  deviceId: number(),
12795
13808
  entries: array(object({
12796
13809
  capName: string(),
12797
- kind: _enum(["native", "wrapped"]),
13810
+ kind: _enum([
13811
+ "native",
13812
+ "wrapped",
13813
+ "linked"
13814
+ ]),
12798
13815
  providerAddonId: string(),
12799
13816
  providerNodeId: string(),
12800
13817
  nativeAddonId: string()
@@ -13290,7 +14307,7 @@ var AddBrokerInputSchema = object({
13290
14307
  });
13291
14308
  var AddBrokerResultSchema = object({ id: string() });
13292
14309
  var IdInputSchema = object({ id: string() });
13293
- var TestResultSchema = discriminatedUnion("ok", [object({
14310
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13294
14311
  ok: literal(true),
13295
14312
  latencyMs: number()
13296
14313
  }), object({
@@ -13313,7 +14330,7 @@ var StatusSchema = object({
13313
14330
  brokerCount: number(),
13314
14331
  embeddedRunning: boolean()
13315
14332
  });
13316
- 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);
14333
+ 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);
13317
14334
  var NetworkEndpointSchema = object({
13318
14335
  url: string(),
13319
14336
  hostname: string(),
@@ -13347,23 +14364,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13347
14364
  sourcePort: number().optional()
13348
14365
  });
13349
14366
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13350
- method(object({
13351
- title: string(),
14367
+ /**
14368
+ * notification-output — canonical, capability-gated notification delivery.
14369
+ *
14370
+ * Apprise-derived model (see
14371
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14372
+ * callers emit ONE canonical `Notification`; each provider declares a
14373
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14374
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14375
+ * message to what the kind supports — callers never special-case a service.
14376
+ *
14377
+ * DESIGN DECISIONS (locked):
14378
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14379
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14380
+ * cap. Rationale: the admin UI needs one uniform surface across the
14381
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14382
+ * alternative would fork the UI per addon and cannot host the
14383
+ * discovery→adopt flow.
14384
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14385
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14386
+ * registered provider (notifiers addon + HA addon) so one catalog is
14387
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14388
+ * `addonId` the generated collection router extracts from the call input.
14389
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14390
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14391
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14392
+ * base64 fallback needed.
14393
+ *
14394
+ * TODO (deferred, closed-set change — separate decision): add
14395
+ * `providerKind: 'notify'` so notification providers surface on the unified
14396
+ * admin "Integrations" page.
14397
+ */
14398
+ /**
14399
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14400
+ * adapter picks what it supports and the degrade engine filters the rest.
14401
+ */
14402
+ var AttachmentMediaTypeSchema = _enum([
14403
+ "image",
14404
+ "video",
14405
+ "gif",
14406
+ "audio",
14407
+ "icon"
14408
+ ]);
14409
+ /**
14410
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14411
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14412
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14413
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14414
+ */
14415
+ var AttachmentSchema = object({
14416
+ mediaType: AttachmentMediaTypeSchema,
14417
+ url: string().optional(),
14418
+ bytes: _instanceof(Uint8Array).optional(),
14419
+ mime: string().optional(),
14420
+ name: string().optional()
14421
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14422
+ var NotificationFormatSchema = _enum([
14423
+ "text",
14424
+ "markdown",
14425
+ "html"
14426
+ ]);
14427
+ /** A single tap-through action button. */
14428
+ var NotificationActionSchema = object({
14429
+ id: string(),
14430
+ label: string(),
14431
+ url: string().optional()
14432
+ });
14433
+ /**
14434
+ * The canonical notification. `body` is the only hard field (Apprise model).
14435
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14436
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14437
+ * the adapter maps this ordinal onto its native level. `level?` is an
14438
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14439
+ * `priority` for that one target.
14440
+ */
14441
+ var NotificationSchema = object({
13352
14442
  body: string(),
13353
- imageUrl: string().optional(),
14443
+ title: string().optional(),
14444
+ format: NotificationFormatSchema.default("text"),
14445
+ priority: number().int().min(1).max(5).default(3),
14446
+ level: string().optional(),
14447
+ attachments: array(AttachmentSchema).optional(),
14448
+ clickUrl: string().optional(),
14449
+ actions: array(NotificationActionSchema).optional(),
14450
+ sound: string().optional(),
14451
+ ttl: number().optional(),
14452
+ tag: string().optional(),
13354
14453
  deviceId: number().optional(),
13355
14454
  eventId: string().optional(),
13356
- priority: _enum([
13357
- "low",
13358
- "normal",
13359
- "high",
13360
- "critical"
13361
- ]).default("normal"),
13362
14455
  metadata: record(string(), unknown()).optional()
13363
- }), _void(), { kind: "mutation" }), method(_void(), object({
14456
+ });
14457
+ /** One declared native severity/priority level for a kind. */
14458
+ var TargetKindLevelSchema = object({
14459
+ id: string(),
14460
+ label: string(),
14461
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14462
+ ordinal: number().int().min(1).max(5).nullable(),
14463
+ flags: object({
14464
+ critical: boolean().optional(),
14465
+ silent: boolean().optional(),
14466
+ noPush: boolean().optional()
14467
+ }).optional(),
14468
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14469
+ requires: array(string()).optional(),
14470
+ description: string().optional()
14471
+ });
14472
+ /** The full capability block consulted before dispatch. */
14473
+ var TargetKindCapsSchema = object({
14474
+ attachments: object({
14475
+ mediaTypes: array(AttachmentMediaTypeSchema),
14476
+ mode: _enum([
14477
+ "url",
14478
+ "bytes",
14479
+ "both"
14480
+ ]),
14481
+ max: number().int().nonnegative(),
14482
+ maxBytes: number().int().positive().optional()
14483
+ }),
14484
+ /** Max action buttons (0 = none). */
14485
+ actions: number().int().nonnegative(),
14486
+ levels: array(TargetKindLevelSchema),
14487
+ format: array(NotificationFormatSchema),
14488
+ clickUrl: boolean(),
14489
+ sound: boolean(),
14490
+ ttl: boolean(),
14491
+ bodyMaxLen: number().int().positive()
14492
+ });
14493
+ /**
14494
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14495
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14496
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14497
+ * the union is large and not meant for runtime validation here; the exported
14498
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14499
+ */
14500
+ var ConfigSchemaPassthrough = unknown();
14501
+ var TargetKindSchema = object({
14502
+ kind: string(),
14503
+ label: string(),
14504
+ icon: string(),
14505
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14506
+ addonId: string(),
14507
+ configSchema: ConfigSchemaPassthrough,
14508
+ supportsDiscovery: boolean(),
14509
+ caps: TargetKindCapsSchema
14510
+ });
14511
+ /**
14512
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14513
+ * (return a presence marker only) when serving `listTargets` — never
14514
+ * round-trip a stored secret to the UI.
14515
+ */
14516
+ var TargetSchema = object({
14517
+ id: string(),
14518
+ name: string(),
14519
+ kind: string(),
14520
+ addonId: string(),
14521
+ enabled: boolean(),
14522
+ config: record(string(), unknown())
14523
+ });
14524
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14525
+ var DiscoveredTargetSchema = object({
14526
+ kind: string(),
14527
+ suggestedName: string(),
14528
+ config: record(string(), unknown())
14529
+ });
14530
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14531
+ var RenderedAsSchema = object({
14532
+ level: string(),
14533
+ format: NotificationFormatSchema,
14534
+ attachmentsSent: number().int().nonnegative(),
14535
+ actionsSent: number().int().nonnegative(),
14536
+ truncated: boolean(),
14537
+ dropped: array(string())
14538
+ });
14539
+ var SendResultSchema = object({
13364
14540
  success: boolean(),
13365
- error: string().optional()
13366
- }), { kind: "mutation" });
14541
+ error: string().optional(),
14542
+ renderedAs: RenderedAsSchema.optional()
14543
+ });
14544
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14545
+ var TestResultSchema = SendResultSchema;
14546
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14547
+ kind: string(),
14548
+ config: record(string(), unknown()).optional()
14549
+ }), array(DiscoveredTargetSchema)), method(object({
14550
+ targetId: string(),
14551
+ notification: NotificationSchema
14552
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14553
+ targetId: string(),
14554
+ sample: NotificationSchema.optional()
14555
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14556
+ targetId: string(),
14557
+ enabled: boolean()
14558
+ }), _void(), { kind: "mutation" });
13367
14559
  /**
13368
14560
  * Zod schemas for persisted record types.
13369
14561
  *
@@ -16385,7 +17577,10 @@ var HwAccelBackendInputSchema = _enum([
16385
17577
  "webgpu",
16386
17578
  "none"
16387
17579
  ]).nullable().optional();
16388
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17580
+ var HwAccelResolutionSchema = object({
17581
+ preferred: array(string()).readonly(),
17582
+ rationale: string()
17583
+ });
16389
17584
  var HardwareEncoderIdSchema = _enum([
16390
17585
  "h264_videotoolbox",
16391
17586
  "hevc_videotoolbox",
@@ -16490,10 +17685,7 @@ var ResolvedInferenceConfigSchema = object({
16490
17685
  format: ModelFormatSchema,
16491
17686
  reason: string()
16492
17687
  });
16493
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16494
- prefer: HwAccelBackendInputSchema,
16495
- nodeId: string().optional()
16496
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17688
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16497
17689
  kind: "mutation",
16498
17690
  auth: "admin"
16499
17691
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16552,6 +17744,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16552
17744
  kind: "mutation",
16553
17745
  auth: "admin"
16554
17746
  });
17747
+ /**
17748
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17749
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17750
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17751
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17752
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17753
+ * annotations that are not exposed here and must not be treated as an event
17754
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17755
+ * (`interfaces/recording-config.ts`).
17756
+ */
16555
17757
  var RecordingStatusSchema = object({
16556
17758
  deviceId: number(),
16557
17759
  enabled: boolean(),
@@ -18188,6 +19390,12 @@ Object.freeze({
18188
19390
  addonId: null,
18189
19391
  access: "view"
18190
19392
  },
19393
+ "deviceManager.getRoleDisplayDefaults": {
19394
+ capName: "device-manager",
19395
+ capScope: "system",
19396
+ addonId: null,
19397
+ access: "view"
19398
+ },
18191
19399
  "deviceManager.getSettingsSchema": {
18192
19400
  capName: "device-manager",
18193
19401
  capScope: "system",
@@ -18338,6 +19546,12 @@ Object.freeze({
18338
19546
  addonId: null,
18339
19547
  access: "create"
18340
19548
  },
19549
+ "deviceManager.setDisplay": {
19550
+ capName: "device-manager",
19551
+ capScope: "system",
19552
+ addonId: null,
19553
+ access: "create"
19554
+ },
18341
19555
  "deviceManager.setIntegrationId": {
18342
19556
  capName: "device-manager",
18343
19557
  capScope: "system",
@@ -18380,6 +19594,12 @@ Object.freeze({
18380
19594
  addonId: null,
18381
19595
  access: "create"
18382
19596
  },
19597
+ "deviceManager.setRoleDisplayDefaults": {
19598
+ capName: "device-manager",
19599
+ capScope: "system",
19600
+ addonId: null,
19601
+ access: "create"
19602
+ },
18383
19603
  "deviceManager.setStreamProfileMap": {
18384
19604
  capName: "device-manager",
18385
19605
  capScope: "system",
@@ -19358,13 +20578,49 @@ Object.freeze({
19358
20578
  addonId: null,
19359
20579
  access: "create"
19360
20580
  },
20581
+ "notificationOutput.deleteTarget": {
20582
+ capName: "notification-output",
20583
+ capScope: "system",
20584
+ addonId: null,
20585
+ access: "delete"
20586
+ },
20587
+ "notificationOutput.discoverTargets": {
20588
+ capName: "notification-output",
20589
+ capScope: "system",
20590
+ addonId: null,
20591
+ access: "view"
20592
+ },
20593
+ "notificationOutput.listTargetKinds": {
20594
+ capName: "notification-output",
20595
+ capScope: "system",
20596
+ addonId: null,
20597
+ access: "view"
20598
+ },
20599
+ "notificationOutput.listTargets": {
20600
+ capName: "notification-output",
20601
+ capScope: "system",
20602
+ addonId: null,
20603
+ access: "view"
20604
+ },
19361
20605
  "notificationOutput.send": {
19362
20606
  capName: "notification-output",
19363
20607
  capScope: "system",
19364
20608
  addonId: null,
19365
20609
  access: "create"
19366
20610
  },
19367
- "notificationOutput.sendTest": {
20611
+ "notificationOutput.setTargetEnabled": {
20612
+ capName: "notification-output",
20613
+ capScope: "system",
20614
+ addonId: null,
20615
+ access: "create"
20616
+ },
20617
+ "notificationOutput.testTarget": {
20618
+ capName: "notification-output",
20619
+ capScope: "system",
20620
+ addonId: null,
20621
+ access: "create"
20622
+ },
20623
+ "notificationOutput.upsertTarget": {
19368
20624
  capName: "notification-output",
19369
20625
  capScope: "system",
19370
20626
  addonId: null,
@@ -19394,6 +20650,66 @@ Object.freeze({
19394
20650
  addonId: null,
19395
20651
  access: "create"
19396
20652
  },
20653
+ "petFeeder.callPet": {
20654
+ capName: "pet-feeder",
20655
+ capScope: "device",
20656
+ addonId: null,
20657
+ access: "create"
20658
+ },
20659
+ "petFeeder.cancelFeed": {
20660
+ capName: "pet-feeder",
20661
+ capScope: "device",
20662
+ addonId: null,
20663
+ access: "create"
20664
+ },
20665
+ "petFeeder.feed": {
20666
+ capName: "pet-feeder",
20667
+ capScope: "device",
20668
+ addonId: null,
20669
+ access: "create"
20670
+ },
20671
+ "petFeeder.markFoodReplenished": {
20672
+ capName: "pet-feeder",
20673
+ capScope: "device",
20674
+ addonId: null,
20675
+ access: "create"
20676
+ },
20677
+ "petFeeder.playSound": {
20678
+ capName: "pet-feeder",
20679
+ capScope: "device",
20680
+ addonId: null,
20681
+ access: "create"
20682
+ },
20683
+ "petFeeder.resetDesiccant": {
20684
+ capName: "pet-feeder",
20685
+ capScope: "device",
20686
+ addonId: null,
20687
+ access: "delete"
20688
+ },
20689
+ "petFeeder.setChildLock": {
20690
+ capName: "pet-feeder",
20691
+ capScope: "device",
20692
+ addonId: null,
20693
+ access: "create"
20694
+ },
20695
+ "petFeeder.setFeedSound": {
20696
+ capName: "pet-feeder",
20697
+ capScope: "device",
20698
+ addonId: null,
20699
+ access: "create"
20700
+ },
20701
+ "petFeeder.setIndicatorLight": {
20702
+ capName: "pet-feeder",
20703
+ capScope: "device",
20704
+ addonId: null,
20705
+ access: "create"
20706
+ },
20707
+ "petFeeder.setVolume": {
20708
+ capName: "pet-feeder",
20709
+ capScope: "device",
20710
+ addonId: null,
20711
+ access: "create"
20712
+ },
19397
20713
  "pipelineAnalytics.clearTracks": {
19398
20714
  capName: "pipeline-analytics",
19399
20715
  capScope: "device",