@camstack/addon-cloudflare 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.
@@ -4627,7 +4627,7 @@ function _instanceof(cls, params = {}) {
4627
4627
  return inst;
4628
4628
  }
4629
4629
  //#endregion
4630
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4630
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4631
4631
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4632
4632
  EventCategory["SystemBoot"] = "system.boot";
4633
4633
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5440,6 +5440,100 @@ function createDurableState(deps) {
5440
5440
  };
5441
5441
  }
5442
5442
  /**
5443
+ * Per-node scoping for the shared addon-settings blob.
5444
+ *
5445
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5446
+ * hub-routed — the hub instance answers for every node), so fields whose
5447
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5448
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5449
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5450
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5451
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5452
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5453
+ *
5454
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5455
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5456
+ * schema and routes reads/writes through these helpers.
5457
+ *
5458
+ * ## No bare-key fallback — deliberate
5459
+ *
5460
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5461
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5462
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5463
+ * the store is invisible to every node, hub included, so one node's
5464
+ * selection can never leak onto another. (This generalizes the
5465
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5466
+ * arbitrary set of per-node field keys.)
5467
+ *
5468
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5469
+ * LEAF module: import it via its deep path, never from the root barrel.
5470
+ */
5471
+ /**
5472
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5473
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5474
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5475
+ * `undefined` / `null` / empty falls back to `'hub'`.
5476
+ */
5477
+ function normalizeNodeId(raw) {
5478
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5479
+ const slashIdx = raw.indexOf("/");
5480
+ if (slashIdx < 0) return raw;
5481
+ const bare = raw.slice(0, slashIdx);
5482
+ return bare === "" ? "hub" : bare;
5483
+ }
5484
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5485
+ function nodeScopedKey(base, nodeId) {
5486
+ return `${base}@${normalizeNodeId(nodeId)}`;
5487
+ }
5488
+ /**
5489
+ * Read a node's value for a per-node field from the raw shared store:
5490
+ * the node-scoped key when present, otherwise `undefined`.
5491
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5492
+ * schema `default` win on `undefined`.
5493
+ */
5494
+ function readNodeValue(store, base, nodeId) {
5495
+ return store[nodeScopedKey(base, nodeId)];
5496
+ }
5497
+ /**
5498
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5499
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5500
+ * the write path so a save for one node never clobbers another node's value
5501
+ * (and the bare key is never written). Returns a new object — the input
5502
+ * patch is not mutated.
5503
+ */
5504
+ function scopePatch(patch, perNodeKeys, nodeId) {
5505
+ const out = {};
5506
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5507
+ return out;
5508
+ }
5509
+ /**
5510
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5511
+ * UI schema (whose field keys are bare) hydrates from that node's own
5512
+ * values:
5513
+ *
5514
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5515
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5516
+ * legacy key must never hydrate any node — no bare fallback).
5517
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5518
+ * each bare perNode key; when the node has no scoped key the bare key is
5519
+ * left ABSENT so the field's schema `default` wins.
5520
+ *
5521
+ * Returns a new object — the input store is not mutated.
5522
+ */
5523
+ function projectStore(store, perNodeKeys, nodeId) {
5524
+ const out = {};
5525
+ for (const [key, value] of Object.entries(store)) {
5526
+ if (key.includes("@")) continue;
5527
+ if (perNodeKeys.has(key)) continue;
5528
+ out[key] = value;
5529
+ }
5530
+ for (const base of perNodeKeys) {
5531
+ const value = readNodeValue(store, base, nodeId);
5532
+ if (value !== void 0) out[base] = value;
5533
+ }
5534
+ return out;
5535
+ }
5536
+ /**
5443
5537
  * Base class for CamStack addons. Eliminates settings boilerplate:
5444
5538
  *
5445
5539
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5607,23 +5701,63 @@ var BaseAddon = class {
5607
5701
  deviceSettingsSchema() {
5608
5702
  return null;
5609
5703
  }
5610
- async getGlobalSettings(overlay, cap, _nodeId) {
5704
+ async getGlobalSettings(overlay, cap, nodeId) {
5611
5705
  const schema = this.globalSettingsSchema(cap);
5612
5706
  if (!schema) return { sections: [] };
5613
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5707
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5614
5708
  return hydrateSchema(schema, overlay ? {
5615
- ...raw,
5709
+ ...projected,
5616
5710
  ...overlay
5617
- } : raw);
5711
+ } : projected);
5712
+ }
5713
+ /**
5714
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5715
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5716
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5717
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5718
+ * A no-op passthrough when the schema declares no `perNode` field.
5719
+ *
5720
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5721
+ * the store for custom option logic (option narrowing, value snapping) to
5722
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5723
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5724
+ */
5725
+ async resolveGlobalStore(nodeId, cap) {
5726
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5727
+ const keys = this.perNodeKeys(cap);
5728
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5729
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5618
5730
  }
5619
- async updateGlobalSettings(patch, _nodeId) {
5620
- await this._ctx?.settings?.writeAddonStore(patch);
5731
+ async updateGlobalSettings(patch, nodeId) {
5732
+ const keys = this.perNodeKeys();
5733
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5734
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5735
+ const barePatch = patch;
5736
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5737
+ await this._ctx?.settings?.writeAddonStore(scoped);
5738
+ if (target !== localNode) return;
5621
5739
  await this.resolveConfig();
5622
5740
  await this.onConfigChanged();
5623
5741
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5624
5742
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5625
5743
  }
5626
5744
  /**
5745
+ * The set of field keys the global settings schema declares `perNode: true`
5746
+ * — derived once per `cap` argument and memoized (schemas are static
5747
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5748
+ * settings API behaves exactly like the legacy node-agnostic one.
5749
+ */
5750
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5751
+ perNodeKeys(cap) {
5752
+ const cacheKey = cap ?? "";
5753
+ const cached = this._perNodeKeysCache.get(cacheKey);
5754
+ if (cached) return cached;
5755
+ const schema = this.globalSettingsSchema(cap);
5756
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5757
+ this._perNodeKeysCache.set(cacheKey, keys);
5758
+ return keys;
5759
+ }
5760
+ /**
5627
5761
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5628
5762
  * schedule an addon restart for the next tick. Deferred via
5629
5763
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5776,12 +5910,19 @@ var BaseAddon = class {
5776
5910
  * The merge is shallow: each key in `defaults` is checked against the store.
5777
5911
  * Only keys present in defaults are read — the store can contain extra keys
5778
5912
  * (e.g. from older versions) without polluting the typed config.
5913
+ *
5914
+ * Keys the global settings schema declares `perNode: true` resolve from
5915
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5916
+ * from the bare key — so a per-node field resolves to this node's own
5917
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5779
5918
  */
5780
5919
  async resolveConfig() {
5781
5920
  const stored = await this.readAddonStoreWithRetry();
5921
+ const perNode = this.perNodeKeys();
5922
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5782
5923
  const resolved = { ...this.defaults };
5783
5924
  for (const key of Object.keys(this.defaults)) {
5784
- const storedValue = stored[key];
5925
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5785
5926
  if (storedValue !== void 0 && storedValue !== null) {
5786
5927
  const defaultType = typeof this.defaults[key];
5787
5928
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5865,6 +6006,27 @@ var BaseAddon = class {
5865
6006
  }
5866
6007
  };
5867
6008
  /**
6009
+ * Collect the keys of every field marked `perNode: true`, recursing into
6010
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6011
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6012
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6013
+ */
6014
+ function collectPerNodeFieldKeys(fields) {
6015
+ const collected = [];
6016
+ for (const field of fields) {
6017
+ if (field.type === "group") {
6018
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6019
+ continue;
6020
+ }
6021
+ if (field.type === "sub-tabs") {
6022
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6023
+ continue;
6024
+ }
6025
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6026
+ }
6027
+ return collected;
6028
+ }
6029
+ /**
5868
6030
  * Normalize an `ICamstackAddon.initialize()` return value into the
5869
6031
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5870
6032
  * envelopes pass through; void stays void.
@@ -5889,6 +6051,7 @@ var CamStreamKindSchema = _enum([
5889
6051
  "pull-rtsp",
5890
6052
  "pull-rtmp",
5891
6053
  "pull-http",
6054
+ "pull-flv",
5892
6055
  "pull-rfc4571",
5893
6056
  "push-annexb",
5894
6057
  "derived"
@@ -6271,6 +6434,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6271
6434
  /** Single still-image entity (HA `image.*`). Read-only display of an
6272
6435
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6273
6436
  DeviceType["Image"] = "image";
6437
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6438
+ * level, battery, desiccant life, feeding state and manual-feed /
6439
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6440
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6441
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6442
+ * integrations sharing the same food/desiccant/hopper surface. */
6443
+ DeviceType["PetFeeder"] = "pet-feeder";
6274
6444
  return DeviceType;
6275
6445
  }({});
6276
6446
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7419,6 +7589,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7419
7589
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7420
7590
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7421
7591
  /**
7592
+ * Error types for the safe expression engine. Two distinct classes so callers
7593
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7594
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7595
+ */
7596
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7597
+ * the failure is anchored to a character (author-facing inline feedback). */
7598
+ var ExpressionParseError = class extends Error {
7599
+ position;
7600
+ constructor(message, position) {
7601
+ super(message);
7602
+ this.name = "ExpressionParseError";
7603
+ this.position = position;
7604
+ }
7605
+ };
7606
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7607
+ * result, unknown builtin, step-budget exceeded). */
7608
+ var ExpressionEvalError = class extends Error {
7609
+ constructor(message) {
7610
+ super(message);
7611
+ this.name = "ExpressionEvalError";
7612
+ }
7613
+ };
7614
+ /**
7615
+ * Resource-bound constants for the safe expression engine.
7616
+ *
7617
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7618
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7619
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7620
+ * work a single author-supplied expression can request, so a hostile or
7621
+ * accidental pathological string can never spend unbounded CPU/memory.
7622
+ */
7623
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7624
+ * rejected without allocation. */
7625
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7626
+ /** A legal binding / identifier name. */
7627
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7628
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7629
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7630
+ var RESERVED_BINDING_NAMES = new Set([
7631
+ "now",
7632
+ "true",
7633
+ "false",
7634
+ "null"
7635
+ ]);
7636
+ /**
7637
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7638
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7639
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7640
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7641
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7642
+ * is a parse error with a source position, so member access / assignment /
7643
+ * template literals are lexically impossible.
7644
+ */
7645
+ var KEYWORDS = new Set([
7646
+ "true",
7647
+ "false",
7648
+ "null"
7649
+ ]);
7650
+ function isDigit(ch) {
7651
+ return ch >= "0" && ch <= "9";
7652
+ }
7653
+ function isIdentStart(ch) {
7654
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7655
+ }
7656
+ function isIdentPart(ch) {
7657
+ return isIdentStart(ch) || isDigit(ch);
7658
+ }
7659
+ function isWhitespace(ch) {
7660
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7661
+ }
7662
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7663
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7664
+ * string. */
7665
+ function tokenize(source) {
7666
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7667
+ const tokens = [];
7668
+ let i = 0;
7669
+ const n = source.length;
7670
+ while (i < n) {
7671
+ const ch = source[i];
7672
+ if (isWhitespace(ch)) {
7673
+ i += 1;
7674
+ continue;
7675
+ }
7676
+ if (isDigit(ch)) {
7677
+ const start = i;
7678
+ while (i < n && isDigit(source[i])) i += 1;
7679
+ if (i < n && source[i] === ".") {
7680
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7681
+ i += 1;
7682
+ while (i < n && isDigit(source[i])) i += 1;
7683
+ }
7684
+ const text = source.slice(start, i);
7685
+ const value = Number(text);
7686
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7687
+ tokens.push({
7688
+ type: "number",
7689
+ value,
7690
+ pos: start
7691
+ });
7692
+ continue;
7693
+ }
7694
+ if (ch === "'" || ch === "\"") {
7695
+ const quote = ch;
7696
+ const start = i;
7697
+ i += 1;
7698
+ let out = "";
7699
+ let closed = false;
7700
+ while (i < n) {
7701
+ const c = source[i];
7702
+ if (c === "\\") {
7703
+ const next = i + 1 < n ? source[i + 1] : "";
7704
+ if (next === "\\" || next === "'" || next === "\"") {
7705
+ out += next;
7706
+ i += 2;
7707
+ continue;
7708
+ }
7709
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7710
+ }
7711
+ if (c === quote) {
7712
+ closed = true;
7713
+ i += 1;
7714
+ break;
7715
+ }
7716
+ out += c;
7717
+ i += 1;
7718
+ }
7719
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7720
+ tokens.push({
7721
+ type: "string",
7722
+ value: out,
7723
+ pos: start
7724
+ });
7725
+ continue;
7726
+ }
7727
+ if (isIdentStart(ch)) {
7728
+ const start = i;
7729
+ while (i < n && isIdentPart(source[i])) i += 1;
7730
+ const text = source.slice(start, i);
7731
+ if (KEYWORDS.has(text)) tokens.push({
7732
+ type: "keyword",
7733
+ keyword: keywordOf(text),
7734
+ pos: start
7735
+ });
7736
+ else tokens.push({
7737
+ type: "identifier",
7738
+ name: text,
7739
+ pos: start
7740
+ });
7741
+ continue;
7742
+ }
7743
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7744
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7745
+ tokens.push({
7746
+ type: "punct",
7747
+ punct: two,
7748
+ pos: i
7749
+ });
7750
+ i += 2;
7751
+ continue;
7752
+ }
7753
+ if (isSinglePunct(ch)) {
7754
+ tokens.push({
7755
+ type: "punct",
7756
+ punct: ch,
7757
+ pos: i
7758
+ });
7759
+ i += 1;
7760
+ continue;
7761
+ }
7762
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7763
+ }
7764
+ tokens.push({
7765
+ type: "eof",
7766
+ pos: n
7767
+ });
7768
+ return tokens;
7769
+ }
7770
+ function keywordOf(text) {
7771
+ if (text === "true") return "true";
7772
+ if (text === "false") return "false";
7773
+ return "null";
7774
+ }
7775
+ function isSinglePunct(ch) {
7776
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7777
+ }
7778
+ /**
7779
+ * Frozen, null-prototype builtin function table for the expression engine
7780
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7781
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7782
+ * own-property check against it.
7783
+ *
7784
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7785
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7786
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7787
+ * (there is no `Object.prototype` in the chain), so those names are not
7788
+ * callable — they are simply "unknown function" at parse time.
7789
+ *
7790
+ * Every numeric argument is validated as a finite number and every numeric
7791
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7792
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7793
+ * closed rather than emitting a garbage value.
7794
+ */
7795
+ function asFiniteNumber(value, name, index) {
7796
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7797
+ return value;
7798
+ }
7799
+ function asString$1(value, name, index) {
7800
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7801
+ return value;
7802
+ }
7803
+ function finiteResult(value, name) {
7804
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7805
+ return value;
7806
+ }
7807
+ function allFiniteNumbers(args, name) {
7808
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7809
+ }
7810
+ var INF = Number.POSITIVE_INFINITY;
7811
+ var table = {
7812
+ min: {
7813
+ minArgs: 1,
7814
+ maxArgs: INF,
7815
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7816
+ },
7817
+ max: {
7818
+ minArgs: 1,
7819
+ maxArgs: INF,
7820
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7821
+ },
7822
+ abs: {
7823
+ minArgs: 1,
7824
+ maxArgs: 1,
7825
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7826
+ },
7827
+ floor: {
7828
+ minArgs: 1,
7829
+ maxArgs: 1,
7830
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7831
+ },
7832
+ ceil: {
7833
+ minArgs: 1,
7834
+ maxArgs: 1,
7835
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7836
+ },
7837
+ sqrt: {
7838
+ minArgs: 1,
7839
+ maxArgs: 1,
7840
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7841
+ },
7842
+ round: {
7843
+ minArgs: 1,
7844
+ maxArgs: 2,
7845
+ apply: (args) => {
7846
+ const x = asFiniteNumber(args[0], "round", 0);
7847
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7848
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7849
+ const factor = 10 ** digits;
7850
+ return finiteResult(Math.round(x * factor) / factor, "round");
7851
+ }
7852
+ },
7853
+ pow: {
7854
+ minArgs: 2,
7855
+ maxArgs: 2,
7856
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7857
+ },
7858
+ clamp: {
7859
+ minArgs: 3,
7860
+ maxArgs: 3,
7861
+ apply: (args) => {
7862
+ const x = asFiniteNumber(args[0], "clamp", 0);
7863
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7864
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7865
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7866
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7867
+ }
7868
+ },
7869
+ avg: {
7870
+ minArgs: 1,
7871
+ maxArgs: INF,
7872
+ apply: (args) => {
7873
+ const nums = allFiniteNumbers(args, "avg");
7874
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7875
+ }
7876
+ },
7877
+ sum: {
7878
+ minArgs: 1,
7879
+ maxArgs: INF,
7880
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7881
+ },
7882
+ coalesce: {
7883
+ minArgs: 1,
7884
+ maxArgs: INF,
7885
+ apply: (args) => {
7886
+ for (const a of args) if (a !== null) return a;
7887
+ return null;
7888
+ }
7889
+ },
7890
+ age: {
7891
+ minArgs: 2,
7892
+ maxArgs: 2,
7893
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7894
+ },
7895
+ convert: {
7896
+ minArgs: 3,
7897
+ maxArgs: 3,
7898
+ apply: (args, hooks) => {
7899
+ const x = asFiniteNumber(args[0], "convert", 0);
7900
+ const from = asString$1(args[1], "convert", 1).trim();
7901
+ const to = asString$1(args[2], "convert", 2).trim();
7902
+ if (hooks.convert) {
7903
+ const out = hooks.convert(x, from, to);
7904
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7905
+ return finiteResult(out, "convert");
7906
+ }
7907
+ if (from === to) return x;
7908
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7909
+ }
7910
+ }
7911
+ };
7912
+ Object.freeze(Object.assign(Object.create(null), table));
7913
+ /** The set of valid builtin names — used by the parser to reject unknown
7914
+ * callees at parse time (immediate author feedback). */
7915
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7916
+ /**
7917
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7918
+ *
7919
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7920
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7921
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7922
+ * string validated against the builtin table at parse time, so an unknown
7923
+ * function is rejected immediately (author feedback) and a persisted expression
7924
+ * that references a since-removed builtin degrades at read.
7925
+ *
7926
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7927
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7928
+ */
7929
+ /** Binary/logical operator precedence (higher binds tighter). */
7930
+ var BINARY_PRECEDENCE = {
7931
+ "||": 1,
7932
+ "&&": 2,
7933
+ "==": 3,
7934
+ "!=": 3,
7935
+ "<": 4,
7936
+ "<=": 4,
7937
+ ">": 4,
7938
+ ">=": 4,
7939
+ "+": 5,
7940
+ "-": 5,
7941
+ "*": 6,
7942
+ "/": 6,
7943
+ "%": 6
7944
+ };
7945
+ function isLogicalOp(op) {
7946
+ return op === "&&" || op === "||";
7947
+ }
7948
+ function isBinaryOp(op) {
7949
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
7950
+ }
7951
+ var Parser = class {
7952
+ tokens;
7953
+ pos = 0;
7954
+ nodeCount = 0;
7955
+ identifiers = /* @__PURE__ */ new Set();
7956
+ callees = /* @__PURE__ */ new Set();
7957
+ constructor(tokens) {
7958
+ this.tokens = tokens;
7959
+ }
7960
+ parse() {
7961
+ const ast = this.parseTernary();
7962
+ const tok = this.peek();
7963
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
7964
+ return {
7965
+ ast,
7966
+ identifiers: this.identifiers,
7967
+ callees: this.callees,
7968
+ nodeCount: this.nodeCount
7969
+ };
7970
+ }
7971
+ peek() {
7972
+ return this.tokens[this.pos];
7973
+ }
7974
+ next() {
7975
+ return this.tokens[this.pos++];
7976
+ }
7977
+ /** Consume a punctuator token, erroring if the next token isn't it. */
7978
+ expectPunct(punct) {
7979
+ const tok = this.peek();
7980
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
7981
+ this.pos += 1;
7982
+ }
7983
+ matchPunct(punct) {
7984
+ const tok = this.peek();
7985
+ if (tok.type === "punct" && tok.punct === punct) {
7986
+ this.pos += 1;
7987
+ return true;
7988
+ }
7989
+ return false;
7990
+ }
7991
+ countNode() {
7992
+ this.nodeCount += 1;
7993
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
7994
+ }
7995
+ parseTernary() {
7996
+ const test = this.parseBinary(1);
7997
+ if (this.matchPunct("?")) {
7998
+ const consequent = this.parseTernary();
7999
+ this.expectPunct(":");
8000
+ const alternate = this.parseTernary();
8001
+ this.countNode();
8002
+ return {
8003
+ kind: "conditional",
8004
+ test,
8005
+ consequent,
8006
+ alternate
8007
+ };
8008
+ }
8009
+ return test;
8010
+ }
8011
+ parseBinary(minPrec) {
8012
+ let left = this.parseUnary();
8013
+ for (;;) {
8014
+ const tok = this.peek();
8015
+ if (tok.type !== "punct") break;
8016
+ const prec = BINARY_PRECEDENCE[tok.punct];
8017
+ if (prec === void 0 || prec < minPrec) break;
8018
+ const op = tok.punct;
8019
+ this.pos += 1;
8020
+ const right = this.parseBinary(prec + 1);
8021
+ this.countNode();
8022
+ if (isLogicalOp(op)) left = {
8023
+ kind: "logical",
8024
+ op,
8025
+ left,
8026
+ right
8027
+ };
8028
+ else if (isBinaryOp(op)) left = {
8029
+ kind: "binary",
8030
+ op,
8031
+ left,
8032
+ right
8033
+ };
8034
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8035
+ }
8036
+ return left;
8037
+ }
8038
+ parseUnary() {
8039
+ const tok = this.peek();
8040
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8041
+ const op = tok.punct;
8042
+ this.pos += 1;
8043
+ const operand = this.parseUnary();
8044
+ this.countNode();
8045
+ return {
8046
+ kind: "unary",
8047
+ op,
8048
+ operand
8049
+ };
8050
+ }
8051
+ return this.parsePrimary();
8052
+ }
8053
+ parsePrimary() {
8054
+ const tok = this.next();
8055
+ switch (tok.type) {
8056
+ case "number":
8057
+ this.countNode();
8058
+ return {
8059
+ kind: "literal",
8060
+ value: tok.value
8061
+ };
8062
+ case "string":
8063
+ this.countNode();
8064
+ return {
8065
+ kind: "literal",
8066
+ value: tok.value
8067
+ };
8068
+ case "keyword":
8069
+ this.countNode();
8070
+ return {
8071
+ kind: "literal",
8072
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8073
+ };
8074
+ case "identifier": {
8075
+ const nextTok = this.peek();
8076
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8077
+ this.identifiers.add(tok.name);
8078
+ this.countNode();
8079
+ return {
8080
+ kind: "identifier",
8081
+ name: tok.name
8082
+ };
8083
+ }
8084
+ case "punct":
8085
+ if (tok.punct === "(") {
8086
+ const inner = this.parseTernary();
8087
+ this.expectPunct(")");
8088
+ return inner;
8089
+ }
8090
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8091
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8092
+ }
8093
+ }
8094
+ parseCall(callee, pos) {
8095
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8096
+ this.expectPunct("(");
8097
+ const args = [];
8098
+ if (!this.matchPunct(")")) for (;;) {
8099
+ args.push(this.parseTernary());
8100
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8101
+ if (this.matchPunct(",")) continue;
8102
+ this.expectPunct(")");
8103
+ break;
8104
+ }
8105
+ this.callees.add(callee);
8106
+ this.countNode();
8107
+ return {
8108
+ kind: "call",
8109
+ callee,
8110
+ args
8111
+ };
8112
+ }
8113
+ };
8114
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8115
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8116
+ function parseExpression(source) {
8117
+ return new Parser(tokenize(source)).parse();
8118
+ }
8119
+ Object.freeze({});
8120
+ /**
8121
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8122
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8123
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8124
+ * one per read on a hot resolve path.
8125
+ *
8126
+ * The cache is a module-level singleton: entries are pure, content-addressed
8127
+ * ASTs keyed by the raw source string, so sharing one instance across all
8128
+ * callers is safe and maximises hit rate.
8129
+ */
8130
+ var cache = /* @__PURE__ */ new Map();
8131
+ function getCached(source) {
8132
+ const hit = cache.get(source);
8133
+ if (hit !== void 0) {
8134
+ cache.delete(source);
8135
+ cache.set(source, hit);
8136
+ return hit;
8137
+ }
8138
+ let result;
8139
+ try {
8140
+ result = {
8141
+ ok: true,
8142
+ parsed: parseExpression(source)
8143
+ };
8144
+ } catch (err) {
8145
+ result = {
8146
+ ok: false,
8147
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8148
+ };
8149
+ }
8150
+ cache.set(source, result);
8151
+ if (cache.size > 256) {
8152
+ const oldest = cache.keys().next().value;
8153
+ if (oldest !== void 0) cache.delete(oldest);
8154
+ }
8155
+ return result;
8156
+ }
8157
+ /** Compile `source`, returning a discriminated result instead of throwing.
8158
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8159
+ function compileExpressionSafe(source) {
8160
+ return getCached(source);
8161
+ }
8162
+ /**
8163
+ * Author-time validation. Returns `null` when the source is valid, else a
8164
+ * human-readable error message. Checks: the expression compiles; binding count
8165
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8166
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8167
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8168
+ */
8169
+ function validateExpressionSource(src) {
8170
+ const names = Object.keys(src.bindings);
8171
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8172
+ for (const name of names) {
8173
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8174
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8175
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8176
+ }
8177
+ const compiled = compileExpressionSafe(src.expr);
8178
+ if (!compiled.ok) return compiled.error;
8179
+ const bound = new Set(names);
8180
+ for (const id of compiled.parsed.identifiers) {
8181
+ if (id === "now") continue;
8182
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8183
+ }
8184
+ return null;
8185
+ }
8186
+ /**
7422
8187
  * Accessory device helpers — shared across drivers.
7423
8188
  *
7424
8189
  * Many vendor-specific drivers register accessory child devices on
@@ -9321,7 +10086,8 @@ var MotionAnalysisResultSchema = object({
9321
10086
  });
9322
10087
  method(object({
9323
10088
  deviceId: number(),
9324
- frame: FrameInputSchema
10089
+ frame: FrameInputSchema.optional(),
10090
+ frameHandle: FrameHandleSchema.optional()
9325
10091
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9326
10092
  deviceId: number(),
9327
10093
  detected: boolean(),
@@ -9568,6 +10334,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9568
10334
  engine: PipelineEngineChoiceSchema.optional(),
9569
10335
  steps: array(PipelineStepInputSchema).min(1),
9570
10336
  frame: FrameInputSchema.optional(),
10337
+ /**
10338
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10339
+ * the decoded pixels live in. One more member of the one-of
10340
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10341
+ */
10342
+ frameHandle: FrameHandleSchema.optional(),
9571
10343
  imageBase64: string().optional(),
9572
10344
  /**
9573
10345
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9777,6 +10549,31 @@ var ReportMotionInputSchema = object({
9777
10549
  regions: array(MotionRegionSchema).readonly().optional()
9778
10550
  });
9779
10551
  /**
10552
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10553
+ * restream-owner model — P2c).
10554
+ *
10555
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10556
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10557
+ * `frameSource` key) parses to this, so the field is additive with zero
10558
+ * behavior change.
10559
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10560
+ * The runner acquires the owner's COMPRESSED passthrough restream
10561
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10562
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10563
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10564
+ * node-local; only H.264/H.265 packets cross the wire.
10565
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10566
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10567
+ * dials for the owner's restream.
10568
+ */
10569
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10570
+ kind: literal("remote-restream"),
10571
+ /** The camera's source-owner node (slice 1: always the hub). */
10572
+ ownerNodeId: string(),
10573
+ /** Operator override for the owner host the runner dials. */
10574
+ hubHostnameOverride: string().optional()
10575
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10576
+ /**
9780
10577
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9781
10578
  * specific runner instance via `attachCamera`. Carries everything the
9782
10579
  * runner needs to subscribe to the local broker and execute inference.
@@ -9874,7 +10671,15 @@ var RunnerCameraConfigSchema = object({
9874
10671
  */
9875
10672
  onboardMotionDrivesAnalyzer: boolean().default(true),
9876
10673
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9877
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10674
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10675
+ /**
10676
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10677
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10678
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10679
+ * camera's detect node differs from its source-owner (P2d, gated by the
10680
+ * `remoteSourcingNodes` rollout setting).
10681
+ */
10682
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9878
10683
  });
9879
10684
  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;
9880
10685
  /**
@@ -10239,6 +11044,113 @@ object({
10239
11044
  lastFetchedAt: number()
10240
11045
  });
10241
11046
  DeviceType.Sensor;
11047
+ /**
11048
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11049
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11050
+ * `on_batteries` (running on battery backup). `null` until first reported.
11051
+ */
11052
+ var PetFeederDeviceStatusSchema = _enum([
11053
+ "normal",
11054
+ "offline",
11055
+ "on_batteries"
11056
+ ]);
11057
+ var gramsPortion = number().int().min(4).max(200);
11058
+ object({
11059
+ /** Food currently in the bowl (grams). Null when the device has not
11060
+ * reported a reading yet. On dual-hopper models this is the combined
11061
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11062
+ foodLevel: number().nullable(),
11063
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11064
+ * single-hopper models. */
11065
+ food1: number().nullable(),
11066
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11067
+ * single-hopper models. */
11068
+ food2: number().nullable(),
11069
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11070
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11071
+ * below the feeder's low threshold. */
11072
+ lowFood: boolean(),
11073
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11074
+ * device has no battery reading. */
11075
+ batteryPower: number().min(0).max(100).nullable(),
11076
+ /** Days of desiccant life remaining. Null when the model has no
11077
+ * desiccant sensor. */
11078
+ desiccantLeftDays: number().nullable(),
11079
+ /** True while a feed is in progress. */
11080
+ feeding: boolean(),
11081
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11082
+ * Null until the device has reported a status. */
11083
+ status: PetFeederDeviceStatusSchema.nullable(),
11084
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11085
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11086
+ * with `errorCode` for consumers that want the raw integer. */
11087
+ error: string().nullable(),
11088
+ /** Raw device error code (0 / null = no error). */
11089
+ errorCode: number().nullable(),
11090
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11091
+ isDualHopper: boolean(),
11092
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11093
+ childLock: boolean(),
11094
+ /** Front indicator-light setting. */
11095
+ indicatorLight: boolean(),
11096
+ /** Play a chime when dispensing. */
11097
+ feedSound: boolean(),
11098
+ /** Speaker / prompt volume level (device-scaled integer). */
11099
+ volume: number(),
11100
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11101
+ lastFetchedAt: number()
11102
+ });
11103
+ DeviceType.PetFeeder, method(object({
11104
+ deviceId: number().int().nonnegative(),
11105
+ grams: gramsPortion.optional(),
11106
+ hopper1: gramsPortion.optional(),
11107
+ hopper2: gramsPortion.optional()
11108
+ }), _void(), {
11109
+ kind: "mutation",
11110
+ auth: "admin"
11111
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11112
+ kind: "mutation",
11113
+ auth: "admin"
11114
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11115
+ kind: "mutation",
11116
+ auth: "admin"
11117
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11118
+ kind: "mutation",
11119
+ auth: "admin"
11120
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11121
+ kind: "mutation",
11122
+ auth: "admin"
11123
+ }), method(object({
11124
+ deviceId: number().int().nonnegative(),
11125
+ soundId: number().int().nonnegative()
11126
+ }), _void(), {
11127
+ kind: "mutation",
11128
+ auth: "admin"
11129
+ }), method(object({
11130
+ deviceId: number().int().nonnegative(),
11131
+ on: boolean()
11132
+ }), _void(), {
11133
+ kind: "mutation",
11134
+ auth: "admin"
11135
+ }), method(object({
11136
+ deviceId: number().int().nonnegative(),
11137
+ on: boolean()
11138
+ }), _void(), {
11139
+ kind: "mutation",
11140
+ auth: "admin"
11141
+ }), method(object({
11142
+ deviceId: number().int().nonnegative(),
11143
+ on: boolean()
11144
+ }), _void(), {
11145
+ kind: "mutation",
11146
+ auth: "admin"
11147
+ }), method(object({
11148
+ deviceId: number().int().nonnegative(),
11149
+ level: number().int().nonnegative()
11150
+ }), _void(), {
11151
+ kind: "mutation",
11152
+ auth: "admin"
11153
+ });
10242
11154
  object({
10243
11155
  /** Instantaneous power draw in watts. */
10244
11156
  watts: number().optional(),
@@ -12087,10 +12999,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12087
12999
  url: string()
12088
13000
  }), _void()), method(object({
12089
13001
  sessionId: string(),
12090
- maxCount: number().default(1)
13002
+ maxCount: number().default(1),
13003
+ waitMs: number().optional()
12091
13004
  }), array(DecodedFrameSchema)), method(object({
12092
13005
  sessionId: string(),
12093
- maxCount: number().default(1)
13006
+ maxCount: number().default(1),
13007
+ waitMs: number().optional()
12094
13008
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12095
13009
  sessionId: string(),
12096
13010
  config: DecoderSessionConfigSchema.partial()
@@ -12377,14 +13291,63 @@ var ChildLayoutEntrySchema = object({
12377
13291
  collapsed: boolean().optional()
12378
13292
  });
12379
13293
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12380
- * `device-management.ts`. */
13294
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13295
+ * accessory's status field (`kind` optional/absent for wire compat); a
13296
+ * LITERAL source carries a per-device constant (no sibling is read); a
13297
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13298
+ * source device's full re-sync-stable `stableId`. */
13299
+ var DeviceLinkFieldSourceSchema = object({
13300
+ kind: literal("field").optional(),
13301
+ sourceKey: string(),
13302
+ cap: string(),
13303
+ fieldPath: string()
13304
+ });
13305
+ var DeviceLinkLiteralSourceSchema = object({
13306
+ kind: literal("literal"),
13307
+ value: union([
13308
+ string(),
13309
+ number(),
13310
+ boolean(),
13311
+ _null()
13312
+ ])
13313
+ });
13314
+ var DeviceLinkGlobalSourceSchema = object({
13315
+ kind: literal("global"),
13316
+ sourceStableId: string(),
13317
+ cap: string(),
13318
+ fieldPath: string()
13319
+ });
13320
+ /** Expression source (Stage X): compute the target field from N named bindings
13321
+ * via the safe expression engine. Bindings are field | literal | global — never
13322
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13323
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13324
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13325
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13326
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13327
+ var DeviceLinkExpressionSourceSchema = object({
13328
+ kind: literal("expression"),
13329
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13330
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13331
+ DeviceLinkFieldSourceSchema,
13332
+ DeviceLinkLiteralSourceSchema,
13333
+ DeviceLinkGlobalSourceSchema
13334
+ ]))
13335
+ }).superRefine((src, ctx) => {
13336
+ const err = validateExpressionSource(src);
13337
+ if (err !== null) ctx.addIssue({
13338
+ code: "custom",
13339
+ message: err,
13340
+ path: ["expr"]
13341
+ });
13342
+ });
12381
13343
  var DeviceLinkSchema = object({
12382
13344
  id: string(),
12383
- source: object({
12384
- sourceKey: string(),
12385
- cap: string(),
12386
- fieldPath: string()
12387
- }),
13345
+ source: union([
13346
+ DeviceLinkFieldSourceSchema,
13347
+ DeviceLinkLiteralSourceSchema,
13348
+ DeviceLinkGlobalSourceSchema,
13349
+ DeviceLinkExpressionSourceSchema
13350
+ ]),
12388
13351
  target: object({
12389
13352
  cap: string(),
12390
13353
  fieldPath: string(),
@@ -12413,6 +13376,31 @@ var DeviceLinkSchema = object({
12413
13376
  })
12414
13377
  ]).optional()
12415
13378
  });
13379
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13380
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13381
+ var DeviceCapDisplayOverrideSchema = object({
13382
+ unit: string().min(1).optional(),
13383
+ precision: number().int().min(0).max(10).optional()
13384
+ });
13385
+ /** Cap-wire shape of an operator-authored per-device display override —
13386
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13387
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13388
+ var DeviceDisplayOverrideSchema = object({
13389
+ icon: string().min(1).optional(),
13390
+ label: string().min(1).optional(),
13391
+ unit: string().min(1).optional(),
13392
+ precision: number().int().min(0).max(10).optional(),
13393
+ hidden: boolean().optional(),
13394
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13395
+ });
13396
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13397
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13398
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13399
+ var RoleDisplayDefaultSchema = object({
13400
+ unit: string().min(1).optional(),
13401
+ precision: number().int().min(0).max(10).optional(),
13402
+ icon: string().min(1).optional()
13403
+ });
12416
13404
  /**
12417
13405
  * Serializable projection of a live IDevice.
12418
13406
  * Returned by listAll, getDevice, getChildren.
@@ -12468,7 +13456,9 @@ var DeviceInfoSchema = object({
12468
13456
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12469
13457
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12470
13458
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12471
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13459
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13460
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13461
+ display: DeviceDisplayOverrideSchema.optional()
12472
13462
  });
12473
13463
  var ConfigEntrySchema = object({
12474
13464
  key: string(),
@@ -12533,7 +13523,9 @@ var DeviceMetaSchema = object({
12533
13523
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12534
13524
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12535
13525
  * Optional: only present for accessory children that carry a known role. */
12536
- role: string().nullable().optional()
13526
+ role: string().nullable().optional(),
13527
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13528
+ display: DeviceDisplayOverrideSchema.optional()
12537
13529
  });
12538
13530
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12539
13531
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12627,7 +13619,19 @@ method(object({
12627
13619
  }), _void(), {
12628
13620
  kind: "mutation",
12629
13621
  auth: "admin"
12630
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13622
+ }), method(object({
13623
+ deviceId: number(),
13624
+ display: DeviceDisplayOverrideSchema.nullable()
13625
+ }), _void(), {
13626
+ kind: "mutation",
13627
+ auth: "admin"
13628
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13629
+ kind: "mutation",
13630
+ auth: "admin"
13631
+ }), method(object({
13632
+ deviceId: number(),
13633
+ includeSynthesizable: boolean().optional()
13634
+ }), object({ caps: array(object({
12631
13635
  cap: string(),
12632
13636
  fields: array(object({
12633
13637
  path: string(),
@@ -12637,8 +13641,13 @@ method(object({
12637
13641
  "boolean",
12638
13642
  "enum"
12639
13643
  ]),
12640
- enumValues: array(string()).optional()
12641
- })).readonly()
13644
+ enumValues: array(string()).optional(),
13645
+ item: boolean().optional()
13646
+ })).readonly(),
13647
+ itemArray: object({
13648
+ path: string(),
13649
+ keyField: string()
13650
+ }).optional()
12642
13651
  })).readonly() }), { kind: "query" }), method(object({
12643
13652
  deviceId: number(),
12644
13653
  role: string().nullable()
@@ -12708,7 +13717,11 @@ method(object({
12708
13717
  deviceId: number(),
12709
13718
  entries: array(object({
12710
13719
  capName: string(),
12711
- kind: _enum(["native", "wrapped"]),
13720
+ kind: _enum([
13721
+ "native",
13722
+ "wrapped",
13723
+ "linked"
13724
+ ]),
12712
13725
  providerAddonId: string(),
12713
13726
  providerNodeId: string(),
12714
13727
  nativeAddonId: string()
@@ -12717,7 +13730,11 @@ method(object({
12717
13730
  deviceId: number(),
12718
13731
  entries: array(object({
12719
13732
  capName: string(),
12720
- kind: _enum(["native", "wrapped"]),
13733
+ kind: _enum([
13734
+ "native",
13735
+ "wrapped",
13736
+ "linked"
13737
+ ]),
12721
13738
  providerAddonId: string(),
12722
13739
  providerNodeId: string(),
12723
13740
  nativeAddonId: string()
@@ -13207,7 +14224,7 @@ var AddBrokerInputSchema = object({
13207
14224
  });
13208
14225
  var AddBrokerResultSchema = object({ id: string() });
13209
14226
  var IdInputSchema = object({ id: string() });
13210
- var TestResultSchema = discriminatedUnion("ok", [object({
14227
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13211
14228
  ok: literal(true),
13212
14229
  latencyMs: number()
13213
14230
  }), object({
@@ -13230,7 +14247,7 @@ var StatusSchema = object({
13230
14247
  brokerCount: number(),
13231
14248
  embeddedRunning: boolean()
13232
14249
  });
13233
- 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);
14250
+ 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);
13234
14251
  var NetworkEndpointSchema = object({
13235
14252
  url: string(),
13236
14253
  hostname: string(),
@@ -13281,23 +14298,198 @@ var networkAccessCapability = {
13281
14298
  listEndpoints: method(_void(), array(NetworkEndpointEntrySchema).readonly())
13282
14299
  }
13283
14300
  };
13284
- method(object({
13285
- title: string(),
14301
+ /**
14302
+ * notification-output — canonical, capability-gated notification delivery.
14303
+ *
14304
+ * Apprise-derived model (see
14305
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14306
+ * callers emit ONE canonical `Notification`; each provider declares a
14307
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14308
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14309
+ * message to what the kind supports — callers never special-case a service.
14310
+ *
14311
+ * DESIGN DECISIONS (locked):
14312
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14313
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14314
+ * cap. Rationale: the admin UI needs one uniform surface across the
14315
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14316
+ * alternative would fork the UI per addon and cannot host the
14317
+ * discovery→adopt flow.
14318
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14319
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14320
+ * registered provider (notifiers addon + HA addon) so one catalog is
14321
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14322
+ * `addonId` the generated collection router extracts from the call input.
14323
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14324
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14325
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14326
+ * base64 fallback needed.
14327
+ *
14328
+ * TODO (deferred, closed-set change — separate decision): add
14329
+ * `providerKind: 'notify'` so notification providers surface on the unified
14330
+ * admin "Integrations" page.
14331
+ */
14332
+ /**
14333
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14334
+ * adapter picks what it supports and the degrade engine filters the rest.
14335
+ */
14336
+ var AttachmentMediaTypeSchema = _enum([
14337
+ "image",
14338
+ "video",
14339
+ "gif",
14340
+ "audio",
14341
+ "icon"
14342
+ ]);
14343
+ /**
14344
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14345
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14346
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14347
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14348
+ */
14349
+ var AttachmentSchema = object({
14350
+ mediaType: AttachmentMediaTypeSchema,
14351
+ url: string().optional(),
14352
+ bytes: _instanceof(Uint8Array).optional(),
14353
+ mime: string().optional(),
14354
+ name: string().optional()
14355
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14356
+ var NotificationFormatSchema = _enum([
14357
+ "text",
14358
+ "markdown",
14359
+ "html"
14360
+ ]);
14361
+ /** A single tap-through action button. */
14362
+ var NotificationActionSchema = object({
14363
+ id: string(),
14364
+ label: string(),
14365
+ url: string().optional()
14366
+ });
14367
+ /**
14368
+ * The canonical notification. `body` is the only hard field (Apprise model).
14369
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14370
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14371
+ * the adapter maps this ordinal onto its native level. `level?` is an
14372
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14373
+ * `priority` for that one target.
14374
+ */
14375
+ var NotificationSchema = object({
13286
14376
  body: string(),
13287
- imageUrl: string().optional(),
14377
+ title: string().optional(),
14378
+ format: NotificationFormatSchema.default("text"),
14379
+ priority: number().int().min(1).max(5).default(3),
14380
+ level: string().optional(),
14381
+ attachments: array(AttachmentSchema).optional(),
14382
+ clickUrl: string().optional(),
14383
+ actions: array(NotificationActionSchema).optional(),
14384
+ sound: string().optional(),
14385
+ ttl: number().optional(),
14386
+ tag: string().optional(),
13288
14387
  deviceId: number().optional(),
13289
14388
  eventId: string().optional(),
13290
- priority: _enum([
13291
- "low",
13292
- "normal",
13293
- "high",
13294
- "critical"
13295
- ]).default("normal"),
13296
14389
  metadata: record(string(), unknown()).optional()
13297
- }), _void(), { kind: "mutation" }), method(_void(), object({
14390
+ });
14391
+ /** One declared native severity/priority level for a kind. */
14392
+ var TargetKindLevelSchema = object({
14393
+ id: string(),
14394
+ label: string(),
14395
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14396
+ ordinal: number().int().min(1).max(5).nullable(),
14397
+ flags: object({
14398
+ critical: boolean().optional(),
14399
+ silent: boolean().optional(),
14400
+ noPush: boolean().optional()
14401
+ }).optional(),
14402
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14403
+ requires: array(string()).optional(),
14404
+ description: string().optional()
14405
+ });
14406
+ /** The full capability block consulted before dispatch. */
14407
+ var TargetKindCapsSchema = object({
14408
+ attachments: object({
14409
+ mediaTypes: array(AttachmentMediaTypeSchema),
14410
+ mode: _enum([
14411
+ "url",
14412
+ "bytes",
14413
+ "both"
14414
+ ]),
14415
+ max: number().int().nonnegative(),
14416
+ maxBytes: number().int().positive().optional()
14417
+ }),
14418
+ /** Max action buttons (0 = none). */
14419
+ actions: number().int().nonnegative(),
14420
+ levels: array(TargetKindLevelSchema),
14421
+ format: array(NotificationFormatSchema),
14422
+ clickUrl: boolean(),
14423
+ sound: boolean(),
14424
+ ttl: boolean(),
14425
+ bodyMaxLen: number().int().positive()
14426
+ });
14427
+ /**
14428
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14429
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14430
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14431
+ * the union is large and not meant for runtime validation here; the exported
14432
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14433
+ */
14434
+ var ConfigSchemaPassthrough = unknown();
14435
+ var TargetKindSchema = object({
14436
+ kind: string(),
14437
+ label: string(),
14438
+ icon: string(),
14439
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14440
+ addonId: string(),
14441
+ configSchema: ConfigSchemaPassthrough,
14442
+ supportsDiscovery: boolean(),
14443
+ caps: TargetKindCapsSchema
14444
+ });
14445
+ /**
14446
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14447
+ * (return a presence marker only) when serving `listTargets` — never
14448
+ * round-trip a stored secret to the UI.
14449
+ */
14450
+ var TargetSchema = object({
14451
+ id: string(),
14452
+ name: string(),
14453
+ kind: string(),
14454
+ addonId: string(),
14455
+ enabled: boolean(),
14456
+ config: record(string(), unknown())
14457
+ });
14458
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14459
+ var DiscoveredTargetSchema = object({
14460
+ kind: string(),
14461
+ suggestedName: string(),
14462
+ config: record(string(), unknown())
14463
+ });
14464
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14465
+ var RenderedAsSchema = object({
14466
+ level: string(),
14467
+ format: NotificationFormatSchema,
14468
+ attachmentsSent: number().int().nonnegative(),
14469
+ actionsSent: number().int().nonnegative(),
14470
+ truncated: boolean(),
14471
+ dropped: array(string())
14472
+ });
14473
+ var SendResultSchema = object({
13298
14474
  success: boolean(),
13299
- error: string().optional()
13300
- }), { kind: "mutation" });
14475
+ error: string().optional(),
14476
+ renderedAs: RenderedAsSchema.optional()
14477
+ });
14478
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14479
+ var TestResultSchema = SendResultSchema;
14480
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14481
+ kind: string(),
14482
+ config: record(string(), unknown()).optional()
14483
+ }), array(DiscoveredTargetSchema)), method(object({
14484
+ targetId: string(),
14485
+ notification: NotificationSchema
14486
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14487
+ targetId: string(),
14488
+ sample: NotificationSchema.optional()
14489
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14490
+ targetId: string(),
14491
+ enabled: boolean()
14492
+ }), _void(), { kind: "mutation" });
13301
14493
  /**
13302
14494
  * Zod schemas for persisted record types.
13303
14495
  *
@@ -16342,7 +17534,10 @@ var HwAccelBackendInputSchema = _enum([
16342
17534
  "webgpu",
16343
17535
  "none"
16344
17536
  ]).nullable().optional();
16345
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17537
+ var HwAccelResolutionSchema = object({
17538
+ preferred: array(string()).readonly(),
17539
+ rationale: string()
17540
+ });
16346
17541
  var HardwareEncoderIdSchema = _enum([
16347
17542
  "h264_videotoolbox",
16348
17543
  "hevc_videotoolbox",
@@ -16447,10 +17642,7 @@ var ResolvedInferenceConfigSchema = object({
16447
17642
  format: ModelFormatSchema,
16448
17643
  reason: string()
16449
17644
  });
16450
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16451
- prefer: HwAccelBackendInputSchema,
16452
- nodeId: string().optional()
16453
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17645
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16454
17646
  kind: "mutation",
16455
17647
  auth: "admin"
16456
17648
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16509,6 +17701,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16509
17701
  kind: "mutation",
16510
17702
  auth: "admin"
16511
17703
  });
17704
+ /**
17705
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17706
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17707
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17708
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17709
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17710
+ * annotations that are not exposed here and must not be treated as an event
17711
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17712
+ * (`interfaces/recording-config.ts`).
17713
+ */
16512
17714
  var RecordingStatusSchema = object({
16513
17715
  deviceId: number(),
16514
17716
  enabled: boolean(),
@@ -18145,6 +19347,12 @@ Object.freeze({
18145
19347
  addonId: null,
18146
19348
  access: "view"
18147
19349
  },
19350
+ "deviceManager.getRoleDisplayDefaults": {
19351
+ capName: "device-manager",
19352
+ capScope: "system",
19353
+ addonId: null,
19354
+ access: "view"
19355
+ },
18148
19356
  "deviceManager.getSettingsSchema": {
18149
19357
  capName: "device-manager",
18150
19358
  capScope: "system",
@@ -18295,6 +19503,12 @@ Object.freeze({
18295
19503
  addonId: null,
18296
19504
  access: "create"
18297
19505
  },
19506
+ "deviceManager.setDisplay": {
19507
+ capName: "device-manager",
19508
+ capScope: "system",
19509
+ addonId: null,
19510
+ access: "create"
19511
+ },
18298
19512
  "deviceManager.setIntegrationId": {
18299
19513
  capName: "device-manager",
18300
19514
  capScope: "system",
@@ -18337,6 +19551,12 @@ Object.freeze({
18337
19551
  addonId: null,
18338
19552
  access: "create"
18339
19553
  },
19554
+ "deviceManager.setRoleDisplayDefaults": {
19555
+ capName: "device-manager",
19556
+ capScope: "system",
19557
+ addonId: null,
19558
+ access: "create"
19559
+ },
18340
19560
  "deviceManager.setStreamProfileMap": {
18341
19561
  capName: "device-manager",
18342
19562
  capScope: "system",
@@ -19315,13 +20535,49 @@ Object.freeze({
19315
20535
  addonId: null,
19316
20536
  access: "create"
19317
20537
  },
20538
+ "notificationOutput.deleteTarget": {
20539
+ capName: "notification-output",
20540
+ capScope: "system",
20541
+ addonId: null,
20542
+ access: "delete"
20543
+ },
20544
+ "notificationOutput.discoverTargets": {
20545
+ capName: "notification-output",
20546
+ capScope: "system",
20547
+ addonId: null,
20548
+ access: "view"
20549
+ },
20550
+ "notificationOutput.listTargetKinds": {
20551
+ capName: "notification-output",
20552
+ capScope: "system",
20553
+ addonId: null,
20554
+ access: "view"
20555
+ },
20556
+ "notificationOutput.listTargets": {
20557
+ capName: "notification-output",
20558
+ capScope: "system",
20559
+ addonId: null,
20560
+ access: "view"
20561
+ },
19318
20562
  "notificationOutput.send": {
19319
20563
  capName: "notification-output",
19320
20564
  capScope: "system",
19321
20565
  addonId: null,
19322
20566
  access: "create"
19323
20567
  },
19324
- "notificationOutput.sendTest": {
20568
+ "notificationOutput.setTargetEnabled": {
20569
+ capName: "notification-output",
20570
+ capScope: "system",
20571
+ addonId: null,
20572
+ access: "create"
20573
+ },
20574
+ "notificationOutput.testTarget": {
20575
+ capName: "notification-output",
20576
+ capScope: "system",
20577
+ addonId: null,
20578
+ access: "create"
20579
+ },
20580
+ "notificationOutput.upsertTarget": {
19325
20581
  capName: "notification-output",
19326
20582
  capScope: "system",
19327
20583
  addonId: null,
@@ -19351,6 +20607,66 @@ Object.freeze({
19351
20607
  addonId: null,
19352
20608
  access: "create"
19353
20609
  },
20610
+ "petFeeder.callPet": {
20611
+ capName: "pet-feeder",
20612
+ capScope: "device",
20613
+ addonId: null,
20614
+ access: "create"
20615
+ },
20616
+ "petFeeder.cancelFeed": {
20617
+ capName: "pet-feeder",
20618
+ capScope: "device",
20619
+ addonId: null,
20620
+ access: "create"
20621
+ },
20622
+ "petFeeder.feed": {
20623
+ capName: "pet-feeder",
20624
+ capScope: "device",
20625
+ addonId: null,
20626
+ access: "create"
20627
+ },
20628
+ "petFeeder.markFoodReplenished": {
20629
+ capName: "pet-feeder",
20630
+ capScope: "device",
20631
+ addonId: null,
20632
+ access: "create"
20633
+ },
20634
+ "petFeeder.playSound": {
20635
+ capName: "pet-feeder",
20636
+ capScope: "device",
20637
+ addonId: null,
20638
+ access: "create"
20639
+ },
20640
+ "petFeeder.resetDesiccant": {
20641
+ capName: "pet-feeder",
20642
+ capScope: "device",
20643
+ addonId: null,
20644
+ access: "delete"
20645
+ },
20646
+ "petFeeder.setChildLock": {
20647
+ capName: "pet-feeder",
20648
+ capScope: "device",
20649
+ addonId: null,
20650
+ access: "create"
20651
+ },
20652
+ "petFeeder.setFeedSound": {
20653
+ capName: "pet-feeder",
20654
+ capScope: "device",
20655
+ addonId: null,
20656
+ access: "create"
20657
+ },
20658
+ "petFeeder.setIndicatorLight": {
20659
+ capName: "pet-feeder",
20660
+ capScope: "device",
20661
+ addonId: null,
20662
+ access: "create"
20663
+ },
20664
+ "petFeeder.setVolume": {
20665
+ capName: "pet-feeder",
20666
+ capScope: "device",
20667
+ addonId: null,
20668
+ access: "create"
20669
+ },
19354
20670
  "pipelineAnalytics.clearTracks": {
19355
20671
  capName: "pipeline-analytics",
19356
20672
  capScope: "device",