@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.
- package/dist/{MotionZonesSettings-CENkUGkD.mjs → MotionZonesSettings-CBIzICaF.mjs} +1 -1
- package/dist/{PrivacyMaskSettings-CHEVFI1U.mjs → PrivacyMaskSettings-DOJx8_wS.mjs} +2 -2
- package/dist/_stub.js +1967 -1857
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-BjAlK1T1.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_model_studio_page-Dc00LZPR.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B2wIUCRf.mjs +26 -0
- package/dist/addon-model-studio.css +1 -1
- package/dist/{hostInit-L1RICcUd.mjs → hostInit-CluisAzj.mjs} +3 -3
- package/dist/model-studio.addon.js +1361 -45
- package/dist/model-studio.addon.mjs +1361 -45
- package/dist/{player-overlays-CWreMmrl.mjs → player-overlays-VyAYk-Z7.mjs} +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{trash-2-CjlgC1Z0.mjs → trash-2-Cm9XGCye.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-CqfX1MWB.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_model_studio_page__remoteEntry_js-BhJhmuL0.mjs} +1 -1
- package/package.json +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_model_studio_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-yyk8hJb9.mjs +0 -26
|
@@ -4638,7 +4638,7 @@ function _instanceof(cls, params = {}) {
|
|
|
4638
4638
|
return inst;
|
|
4639
4639
|
}
|
|
4640
4640
|
//#endregion
|
|
4641
|
-
//#region ../types/dist/sleep-
|
|
4641
|
+
//#region ../types/dist/sleep-BiDFW0E7.mjs
|
|
4642
4642
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4643
4643
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4644
4644
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -5451,6 +5451,100 @@ function createDurableState(deps) {
|
|
|
5451
5451
|
};
|
|
5452
5452
|
}
|
|
5453
5453
|
/**
|
|
5454
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
5455
|
+
*
|
|
5456
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
5457
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
5458
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
5459
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
5460
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
5461
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
5462
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
5463
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
5464
|
+
*
|
|
5465
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
5466
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
5467
|
+
* schema and routes reads/writes through these helpers.
|
|
5468
|
+
*
|
|
5469
|
+
* ## No bare-key fallback — deliberate
|
|
5470
|
+
*
|
|
5471
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
5472
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
5473
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
5474
|
+
* the store is invisible to every node, hub included, so one node's
|
|
5475
|
+
* selection can never leak onto another. (This generalizes the
|
|
5476
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
5477
|
+
* arbitrary set of per-node field keys.)
|
|
5478
|
+
*
|
|
5479
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
5480
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
5481
|
+
*/
|
|
5482
|
+
/**
|
|
5483
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
5484
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
5485
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
5486
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
5487
|
+
*/
|
|
5488
|
+
function normalizeNodeId(raw) {
|
|
5489
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
5490
|
+
const slashIdx = raw.indexOf("/");
|
|
5491
|
+
if (slashIdx < 0) return raw;
|
|
5492
|
+
const bare = raw.slice(0, slashIdx);
|
|
5493
|
+
return bare === "" ? "hub" : bare;
|
|
5494
|
+
}
|
|
5495
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
5496
|
+
function nodeScopedKey(base, nodeId) {
|
|
5497
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
5498
|
+
}
|
|
5499
|
+
/**
|
|
5500
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
5501
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
5502
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
5503
|
+
* schema `default` win on `undefined`.
|
|
5504
|
+
*/
|
|
5505
|
+
function readNodeValue(store, base, nodeId) {
|
|
5506
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
5507
|
+
}
|
|
5508
|
+
/**
|
|
5509
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
5510
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
5511
|
+
* the write path so a save for one node never clobbers another node's value
|
|
5512
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
5513
|
+
* patch is not mutated.
|
|
5514
|
+
*/
|
|
5515
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
5516
|
+
const out = {};
|
|
5517
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
5518
|
+
return out;
|
|
5519
|
+
}
|
|
5520
|
+
/**
|
|
5521
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
5522
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
5523
|
+
* values:
|
|
5524
|
+
*
|
|
5525
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
5526
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
5527
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
5528
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
5529
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
5530
|
+
* left ABSENT so the field's schema `default` wins.
|
|
5531
|
+
*
|
|
5532
|
+
* Returns a new object — the input store is not mutated.
|
|
5533
|
+
*/
|
|
5534
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
5535
|
+
const out = {};
|
|
5536
|
+
for (const [key, value] of Object.entries(store)) {
|
|
5537
|
+
if (key.includes("@")) continue;
|
|
5538
|
+
if (perNodeKeys.has(key)) continue;
|
|
5539
|
+
out[key] = value;
|
|
5540
|
+
}
|
|
5541
|
+
for (const base of perNodeKeys) {
|
|
5542
|
+
const value = readNodeValue(store, base, nodeId);
|
|
5543
|
+
if (value !== void 0) out[base] = value;
|
|
5544
|
+
}
|
|
5545
|
+
return out;
|
|
5546
|
+
}
|
|
5547
|
+
/**
|
|
5454
5548
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5455
5549
|
*
|
|
5456
5550
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -5618,23 +5712,63 @@ var BaseAddon = class {
|
|
|
5618
5712
|
deviceSettingsSchema() {
|
|
5619
5713
|
return null;
|
|
5620
5714
|
}
|
|
5621
|
-
async getGlobalSettings(overlay, cap,
|
|
5715
|
+
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5622
5716
|
const schema = this.globalSettingsSchema(cap);
|
|
5623
5717
|
if (!schema) return { sections: [] };
|
|
5624
|
-
const
|
|
5718
|
+
const projected = await this.resolveGlobalStore(nodeId, cap);
|
|
5625
5719
|
return hydrateSchema(schema, overlay ? {
|
|
5626
|
-
...
|
|
5720
|
+
...projected,
|
|
5627
5721
|
...overlay
|
|
5628
|
-
} :
|
|
5722
|
+
} : projected);
|
|
5723
|
+
}
|
|
5724
|
+
/**
|
|
5725
|
+
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5726
|
+
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5727
|
+
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
5728
|
+
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
5729
|
+
* A no-op passthrough when the schema declares no `perNode` field.
|
|
5730
|
+
*
|
|
5731
|
+
* This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
|
|
5732
|
+
* the store for custom option logic (option narrowing, value snapping) to
|
|
5733
|
+
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
5734
|
+
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
5735
|
+
*/
|
|
5736
|
+
async resolveGlobalStore(nodeId, cap) {
|
|
5737
|
+
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
5738
|
+
const keys = this.perNodeKeys(cap);
|
|
5739
|
+
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5740
|
+
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
5629
5741
|
}
|
|
5630
|
-
async updateGlobalSettings(patch,
|
|
5631
|
-
|
|
5742
|
+
async updateGlobalSettings(patch, nodeId) {
|
|
5743
|
+
const keys = this.perNodeKeys();
|
|
5744
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5745
|
+
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5746
|
+
const barePatch = patch;
|
|
5747
|
+
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
5748
|
+
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
5749
|
+
if (target !== localNode) return;
|
|
5632
5750
|
await this.resolveConfig();
|
|
5633
5751
|
await this.onConfigChanged();
|
|
5634
5752
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
5635
5753
|
this.maybeAutoRestart(patch, this.globalSettingsSchema());
|
|
5636
5754
|
}
|
|
5637
5755
|
/**
|
|
5756
|
+
* The set of field keys the global settings schema declares `perNode: true`
|
|
5757
|
+
* — derived once per `cap` argument and memoized (schemas are static
|
|
5758
|
+
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
5759
|
+
* settings API behaves exactly like the legacy node-agnostic one.
|
|
5760
|
+
*/
|
|
5761
|
+
_perNodeKeysCache = /* @__PURE__ */ new Map();
|
|
5762
|
+
perNodeKeys(cap) {
|
|
5763
|
+
const cacheKey = cap ?? "";
|
|
5764
|
+
const cached = this._perNodeKeysCache.get(cacheKey);
|
|
5765
|
+
if (cached) return cached;
|
|
5766
|
+
const schema = this.globalSettingsSchema(cap);
|
|
5767
|
+
const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
5768
|
+
this._perNodeKeysCache.set(cacheKey, keys);
|
|
5769
|
+
return keys;
|
|
5770
|
+
}
|
|
5771
|
+
/**
|
|
5638
5772
|
* If any field in `patch` is marked `requiresRestart` in `schema`,
|
|
5639
5773
|
* schedule an addon restart for the next tick. Deferred via
|
|
5640
5774
|
* `setImmediate` so the tRPC mutation that triggered the write has
|
|
@@ -5787,12 +5921,19 @@ var BaseAddon = class {
|
|
|
5787
5921
|
* The merge is shallow: each key in `defaults` is checked against the store.
|
|
5788
5922
|
* Only keys present in defaults are read — the store can contain extra keys
|
|
5789
5923
|
* (e.g. from older versions) without polluting the typed config.
|
|
5924
|
+
*
|
|
5925
|
+
* Keys the global settings schema declares `perNode: true` resolve from
|
|
5926
|
+
* THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
|
|
5927
|
+
* from the bare key — so a per-node field resolves to this node's own
|
|
5928
|
+
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
5790
5929
|
*/
|
|
5791
5930
|
async resolveConfig() {
|
|
5792
5931
|
const stored = await this.readAddonStoreWithRetry();
|
|
5932
|
+
const perNode = this.perNodeKeys();
|
|
5933
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5793
5934
|
const resolved = { ...this.defaults };
|
|
5794
5935
|
for (const key of Object.keys(this.defaults)) {
|
|
5795
|
-
const storedValue = stored[key];
|
|
5936
|
+
const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
|
|
5796
5937
|
if (storedValue !== void 0 && storedValue !== null) {
|
|
5797
5938
|
const defaultType = typeof this.defaults[key];
|
|
5798
5939
|
if (typeof storedValue === defaultType) resolved[key] = storedValue;
|
|
@@ -5876,6 +6017,27 @@ var BaseAddon = class {
|
|
|
5876
6017
|
}
|
|
5877
6018
|
};
|
|
5878
6019
|
/**
|
|
6020
|
+
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
6021
|
+
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
6022
|
+
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6023
|
+
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6024
|
+
*/
|
|
6025
|
+
function collectPerNodeFieldKeys(fields) {
|
|
6026
|
+
const collected = [];
|
|
6027
|
+
for (const field of fields) {
|
|
6028
|
+
if (field.type === "group") {
|
|
6029
|
+
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
6030
|
+
continue;
|
|
6031
|
+
}
|
|
6032
|
+
if (field.type === "sub-tabs") {
|
|
6033
|
+
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
6034
|
+
continue;
|
|
6035
|
+
}
|
|
6036
|
+
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
6037
|
+
}
|
|
6038
|
+
return collected;
|
|
6039
|
+
}
|
|
6040
|
+
/**
|
|
5879
6041
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
5880
6042
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
5881
6043
|
* envelopes pass through; void stays void.
|
|
@@ -5900,6 +6062,7 @@ var CamStreamKindSchema = _enum([
|
|
|
5900
6062
|
"pull-rtsp",
|
|
5901
6063
|
"pull-rtmp",
|
|
5902
6064
|
"pull-http",
|
|
6065
|
+
"pull-flv",
|
|
5903
6066
|
"pull-rfc4571",
|
|
5904
6067
|
"push-annexb",
|
|
5905
6068
|
"derived"
|
|
@@ -6282,6 +6445,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
6282
6445
|
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
6283
6446
|
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
6284
6447
|
DeviceType["Image"] = "image";
|
|
6448
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
6449
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
6450
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
6451
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
6452
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
6453
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
6454
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
6285
6455
|
return DeviceType;
|
|
6286
6456
|
}({});
|
|
6287
6457
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -7461,6 +7631,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7461
7631
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7462
7632
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7463
7633
|
/**
|
|
7634
|
+
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7635
|
+
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7636
|
+
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
7637
|
+
*/
|
|
7638
|
+
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
7639
|
+
* the failure is anchored to a character (author-facing inline feedback). */
|
|
7640
|
+
var ExpressionParseError = class extends Error {
|
|
7641
|
+
position;
|
|
7642
|
+
constructor(message, position) {
|
|
7643
|
+
super(message);
|
|
7644
|
+
this.name = "ExpressionParseError";
|
|
7645
|
+
this.position = position;
|
|
7646
|
+
}
|
|
7647
|
+
};
|
|
7648
|
+
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
7649
|
+
* result, unknown builtin, step-budget exceeded). */
|
|
7650
|
+
var ExpressionEvalError = class extends Error {
|
|
7651
|
+
constructor(message) {
|
|
7652
|
+
super(message);
|
|
7653
|
+
this.name = "ExpressionEvalError";
|
|
7654
|
+
}
|
|
7655
|
+
};
|
|
7656
|
+
/**
|
|
7657
|
+
* Resource-bound constants for the safe expression engine.
|
|
7658
|
+
*
|
|
7659
|
+
* Every bound is defense-in-depth: the grammar is non-Turing-complete (no
|
|
7660
|
+
* loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
|
|
7661
|
+
* O(nodeCount) by construction. These caps merely put a hard ceiling on the
|
|
7662
|
+
* work a single author-supplied expression can request, so a hostile or
|
|
7663
|
+
* accidental pathological string can never spend unbounded CPU/memory.
|
|
7664
|
+
*/
|
|
7665
|
+
/** Max source length (chars) — checked BEFORE tokenizing so a huge string is
|
|
7666
|
+
* rejected without allocation. */
|
|
7667
|
+
var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
|
|
7668
|
+
/** A legal binding / identifier name. */
|
|
7669
|
+
var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7670
|
+
/** Binding names an author may NOT use: `now` is auto-injected; the literal
|
|
7671
|
+
* keywords lex as values, not identifiers, so binding to them is meaningless. */
|
|
7672
|
+
var RESERVED_BINDING_NAMES = new Set([
|
|
7673
|
+
"now",
|
|
7674
|
+
"true",
|
|
7675
|
+
"false",
|
|
7676
|
+
"null"
|
|
7677
|
+
]);
|
|
7678
|
+
/**
|
|
7679
|
+
* Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
|
|
7680
|
+
* zero-dependency. The grammar is deliberately boring: decimal numbers,
|
|
7681
|
+
* single/double-quoted strings with a tiny escape set, identifiers, the three
|
|
7682
|
+
* value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
|
|
7683
|
+
* outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
|
|
7684
|
+
* is a parse error with a source position, so member access / assignment /
|
|
7685
|
+
* template literals are lexically impossible.
|
|
7686
|
+
*/
|
|
7687
|
+
var KEYWORDS = new Set([
|
|
7688
|
+
"true",
|
|
7689
|
+
"false",
|
|
7690
|
+
"null"
|
|
7691
|
+
]);
|
|
7692
|
+
function isDigit(ch) {
|
|
7693
|
+
return ch >= "0" && ch <= "9";
|
|
7694
|
+
}
|
|
7695
|
+
function isIdentStart(ch) {
|
|
7696
|
+
return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
|
|
7697
|
+
}
|
|
7698
|
+
function isIdentPart(ch) {
|
|
7699
|
+
return isIdentStart(ch) || isDigit(ch);
|
|
7700
|
+
}
|
|
7701
|
+
function isWhitespace(ch) {
|
|
7702
|
+
return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
|
|
7703
|
+
}
|
|
7704
|
+
/** Tokenize `source` into a flat token list ending with a single `eof` token.
|
|
7705
|
+
* Throws `ExpressionParseError` on any illegal character or unterminated
|
|
7706
|
+
* string. */
|
|
7707
|
+
function tokenize(source) {
|
|
7708
|
+
if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
|
|
7709
|
+
const tokens = [];
|
|
7710
|
+
let i = 0;
|
|
7711
|
+
const n = source.length;
|
|
7712
|
+
while (i < n) {
|
|
7713
|
+
const ch = source[i];
|
|
7714
|
+
if (isWhitespace(ch)) {
|
|
7715
|
+
i += 1;
|
|
7716
|
+
continue;
|
|
7717
|
+
}
|
|
7718
|
+
if (isDigit(ch)) {
|
|
7719
|
+
const start = i;
|
|
7720
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7721
|
+
if (i < n && source[i] === ".") {
|
|
7722
|
+
if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
|
|
7723
|
+
i += 1;
|
|
7724
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7725
|
+
}
|
|
7726
|
+
const text = source.slice(start, i);
|
|
7727
|
+
const value = Number(text);
|
|
7728
|
+
if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
|
|
7729
|
+
tokens.push({
|
|
7730
|
+
type: "number",
|
|
7731
|
+
value,
|
|
7732
|
+
pos: start
|
|
7733
|
+
});
|
|
7734
|
+
continue;
|
|
7735
|
+
}
|
|
7736
|
+
if (ch === "'" || ch === "\"") {
|
|
7737
|
+
const quote = ch;
|
|
7738
|
+
const start = i;
|
|
7739
|
+
i += 1;
|
|
7740
|
+
let out = "";
|
|
7741
|
+
let closed = false;
|
|
7742
|
+
while (i < n) {
|
|
7743
|
+
const c = source[i];
|
|
7744
|
+
if (c === "\\") {
|
|
7745
|
+
const next = i + 1 < n ? source[i + 1] : "";
|
|
7746
|
+
if (next === "\\" || next === "'" || next === "\"") {
|
|
7747
|
+
out += next;
|
|
7748
|
+
i += 2;
|
|
7749
|
+
continue;
|
|
7750
|
+
}
|
|
7751
|
+
throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
|
|
7752
|
+
}
|
|
7753
|
+
if (c === quote) {
|
|
7754
|
+
closed = true;
|
|
7755
|
+
i += 1;
|
|
7756
|
+
break;
|
|
7757
|
+
}
|
|
7758
|
+
out += c;
|
|
7759
|
+
i += 1;
|
|
7760
|
+
}
|
|
7761
|
+
if (!closed) throw new ExpressionParseError("unterminated string literal", start);
|
|
7762
|
+
tokens.push({
|
|
7763
|
+
type: "string",
|
|
7764
|
+
value: out,
|
|
7765
|
+
pos: start
|
|
7766
|
+
});
|
|
7767
|
+
continue;
|
|
7768
|
+
}
|
|
7769
|
+
if (isIdentStart(ch)) {
|
|
7770
|
+
const start = i;
|
|
7771
|
+
while (i < n && isIdentPart(source[i])) i += 1;
|
|
7772
|
+
const text = source.slice(start, i);
|
|
7773
|
+
if (KEYWORDS.has(text)) tokens.push({
|
|
7774
|
+
type: "keyword",
|
|
7775
|
+
keyword: keywordOf(text),
|
|
7776
|
+
pos: start
|
|
7777
|
+
});
|
|
7778
|
+
else tokens.push({
|
|
7779
|
+
type: "identifier",
|
|
7780
|
+
name: text,
|
|
7781
|
+
pos: start
|
|
7782
|
+
});
|
|
7783
|
+
continue;
|
|
7784
|
+
}
|
|
7785
|
+
const two = i + 1 < n ? source.slice(i, i + 2) : "";
|
|
7786
|
+
if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
|
|
7787
|
+
tokens.push({
|
|
7788
|
+
type: "punct",
|
|
7789
|
+
punct: two,
|
|
7790
|
+
pos: i
|
|
7791
|
+
});
|
|
7792
|
+
i += 2;
|
|
7793
|
+
continue;
|
|
7794
|
+
}
|
|
7795
|
+
if (isSinglePunct(ch)) {
|
|
7796
|
+
tokens.push({
|
|
7797
|
+
type: "punct",
|
|
7798
|
+
punct: ch,
|
|
7799
|
+
pos: i
|
|
7800
|
+
});
|
|
7801
|
+
i += 1;
|
|
7802
|
+
continue;
|
|
7803
|
+
}
|
|
7804
|
+
throw new ExpressionParseError(`unexpected character '${ch}'`, i);
|
|
7805
|
+
}
|
|
7806
|
+
tokens.push({
|
|
7807
|
+
type: "eof",
|
|
7808
|
+
pos: n
|
|
7809
|
+
});
|
|
7810
|
+
return tokens;
|
|
7811
|
+
}
|
|
7812
|
+
function keywordOf(text) {
|
|
7813
|
+
if (text === "true") return "true";
|
|
7814
|
+
if (text === "false") return "false";
|
|
7815
|
+
return "null";
|
|
7816
|
+
}
|
|
7817
|
+
function isSinglePunct(ch) {
|
|
7818
|
+
return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
|
|
7819
|
+
}
|
|
7820
|
+
/**
|
|
7821
|
+
* Frozen, null-prototype builtin function table for the expression engine
|
|
7822
|
+
* (spec §4 rule 4). The table is the SOLE surface of callable functions: the
|
|
7823
|
+
* parser rejects any callee not in it, and the evaluator gates each call on an
|
|
7824
|
+
* own-property check against it.
|
|
7825
|
+
*
|
|
7826
|
+
* Because the object has a NULL prototype AND is `Object.freeze`d:
|
|
7827
|
+
* - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
|
|
7828
|
+
* - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
|
|
7829
|
+
* (there is no `Object.prototype` in the chain), so those names are not
|
|
7830
|
+
* callable — they are simply "unknown function" at parse time.
|
|
7831
|
+
*
|
|
7832
|
+
* Every numeric argument is validated as a finite number and every numeric
|
|
7833
|
+
* RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
|
|
7834
|
+
* (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
|
|
7835
|
+
* closed rather than emitting a garbage value.
|
|
7836
|
+
*/
|
|
7837
|
+
function asFiniteNumber(value, name, index) {
|
|
7838
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
7839
|
+
return value;
|
|
7840
|
+
}
|
|
7841
|
+
function asString$1(value, name, index) {
|
|
7842
|
+
if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
|
|
7843
|
+
return value;
|
|
7844
|
+
}
|
|
7845
|
+
function finiteResult(value, name) {
|
|
7846
|
+
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
|
|
7847
|
+
return value;
|
|
7848
|
+
}
|
|
7849
|
+
function allFiniteNumbers(args, name) {
|
|
7850
|
+
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
7851
|
+
}
|
|
7852
|
+
var INF = Number.POSITIVE_INFINITY;
|
|
7853
|
+
var table = {
|
|
7854
|
+
min: {
|
|
7855
|
+
minArgs: 1,
|
|
7856
|
+
maxArgs: INF,
|
|
7857
|
+
apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
|
|
7858
|
+
},
|
|
7859
|
+
max: {
|
|
7860
|
+
minArgs: 1,
|
|
7861
|
+
maxArgs: INF,
|
|
7862
|
+
apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
|
|
7863
|
+
},
|
|
7864
|
+
abs: {
|
|
7865
|
+
minArgs: 1,
|
|
7866
|
+
maxArgs: 1,
|
|
7867
|
+
apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
|
|
7868
|
+
},
|
|
7869
|
+
floor: {
|
|
7870
|
+
minArgs: 1,
|
|
7871
|
+
maxArgs: 1,
|
|
7872
|
+
apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
|
|
7873
|
+
},
|
|
7874
|
+
ceil: {
|
|
7875
|
+
minArgs: 1,
|
|
7876
|
+
maxArgs: 1,
|
|
7877
|
+
apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
|
|
7878
|
+
},
|
|
7879
|
+
sqrt: {
|
|
7880
|
+
minArgs: 1,
|
|
7881
|
+
maxArgs: 1,
|
|
7882
|
+
apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
|
|
7883
|
+
},
|
|
7884
|
+
round: {
|
|
7885
|
+
minArgs: 1,
|
|
7886
|
+
maxArgs: 2,
|
|
7887
|
+
apply: (args) => {
|
|
7888
|
+
const x = asFiniteNumber(args[0], "round", 0);
|
|
7889
|
+
const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
|
|
7890
|
+
if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
|
|
7891
|
+
const factor = 10 ** digits;
|
|
7892
|
+
return finiteResult(Math.round(x * factor) / factor, "round");
|
|
7893
|
+
}
|
|
7894
|
+
},
|
|
7895
|
+
pow: {
|
|
7896
|
+
minArgs: 2,
|
|
7897
|
+
maxArgs: 2,
|
|
7898
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
|
|
7899
|
+
},
|
|
7900
|
+
clamp: {
|
|
7901
|
+
minArgs: 3,
|
|
7902
|
+
maxArgs: 3,
|
|
7903
|
+
apply: (args) => {
|
|
7904
|
+
const x = asFiniteNumber(args[0], "clamp", 0);
|
|
7905
|
+
const lo = asFiniteNumber(args[1], "clamp", 1);
|
|
7906
|
+
const hi = asFiniteNumber(args[2], "clamp", 2);
|
|
7907
|
+
if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
|
|
7908
|
+
return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
|
|
7909
|
+
}
|
|
7910
|
+
},
|
|
7911
|
+
avg: {
|
|
7912
|
+
minArgs: 1,
|
|
7913
|
+
maxArgs: INF,
|
|
7914
|
+
apply: (args) => {
|
|
7915
|
+
const nums = allFiniteNumbers(args, "avg");
|
|
7916
|
+
return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
|
|
7917
|
+
}
|
|
7918
|
+
},
|
|
7919
|
+
sum: {
|
|
7920
|
+
minArgs: 1,
|
|
7921
|
+
maxArgs: INF,
|
|
7922
|
+
apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
|
|
7923
|
+
},
|
|
7924
|
+
coalesce: {
|
|
7925
|
+
minArgs: 1,
|
|
7926
|
+
maxArgs: INF,
|
|
7927
|
+
apply: (args) => {
|
|
7928
|
+
for (const a of args) if (a !== null) return a;
|
|
7929
|
+
return null;
|
|
7930
|
+
}
|
|
7931
|
+
},
|
|
7932
|
+
age: {
|
|
7933
|
+
minArgs: 2,
|
|
7934
|
+
maxArgs: 2,
|
|
7935
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
|
|
7936
|
+
},
|
|
7937
|
+
convert: {
|
|
7938
|
+
minArgs: 3,
|
|
7939
|
+
maxArgs: 3,
|
|
7940
|
+
apply: (args, hooks) => {
|
|
7941
|
+
const x = asFiniteNumber(args[0], "convert", 0);
|
|
7942
|
+
const from = asString$1(args[1], "convert", 1).trim();
|
|
7943
|
+
const to = asString$1(args[2], "convert", 2).trim();
|
|
7944
|
+
if (hooks.convert) {
|
|
7945
|
+
const out = hooks.convert(x, from, to);
|
|
7946
|
+
if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
|
|
7947
|
+
return finiteResult(out, "convert");
|
|
7948
|
+
}
|
|
7949
|
+
if (from === to) return x;
|
|
7950
|
+
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
7951
|
+
}
|
|
7952
|
+
}
|
|
7953
|
+
};
|
|
7954
|
+
Object.freeze(Object.assign(Object.create(null), table));
|
|
7955
|
+
/** The set of valid builtin names — used by the parser to reject unknown
|
|
7956
|
+
* callees at parse time (immediate author feedback). */
|
|
7957
|
+
var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
|
|
7958
|
+
/**
|
|
7959
|
+
* Pratt (precedence-climbing) parser for the safe expression mini-language.
|
|
7960
|
+
*
|
|
7961
|
+
* Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
|
|
7962
|
+
* → relational → additive → multiplicative → unary `! -` → call / primary.
|
|
7963
|
+
* Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
|
|
7964
|
+
* string validated against the builtin table at parse time, so an unknown
|
|
7965
|
+
* function is rejected immediately (author feedback) and a persisted expression
|
|
7966
|
+
* that references a since-removed builtin degrades at read.
|
|
7967
|
+
*
|
|
7968
|
+
* A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
|
|
7969
|
+
* arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
|
|
7970
|
+
*/
|
|
7971
|
+
/** Binary/logical operator precedence (higher binds tighter). */
|
|
7972
|
+
var BINARY_PRECEDENCE = {
|
|
7973
|
+
"||": 1,
|
|
7974
|
+
"&&": 2,
|
|
7975
|
+
"==": 3,
|
|
7976
|
+
"!=": 3,
|
|
7977
|
+
"<": 4,
|
|
7978
|
+
"<=": 4,
|
|
7979
|
+
">": 4,
|
|
7980
|
+
">=": 4,
|
|
7981
|
+
"+": 5,
|
|
7982
|
+
"-": 5,
|
|
7983
|
+
"*": 6,
|
|
7984
|
+
"/": 6,
|
|
7985
|
+
"%": 6
|
|
7986
|
+
};
|
|
7987
|
+
function isLogicalOp(op) {
|
|
7988
|
+
return op === "&&" || op === "||";
|
|
7989
|
+
}
|
|
7990
|
+
function isBinaryOp(op) {
|
|
7991
|
+
return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
|
|
7992
|
+
}
|
|
7993
|
+
var Parser = class {
|
|
7994
|
+
tokens;
|
|
7995
|
+
pos = 0;
|
|
7996
|
+
nodeCount = 0;
|
|
7997
|
+
identifiers = /* @__PURE__ */ new Set();
|
|
7998
|
+
callees = /* @__PURE__ */ new Set();
|
|
7999
|
+
constructor(tokens) {
|
|
8000
|
+
this.tokens = tokens;
|
|
8001
|
+
}
|
|
8002
|
+
parse() {
|
|
8003
|
+
const ast = this.parseTernary();
|
|
8004
|
+
const tok = this.peek();
|
|
8005
|
+
if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
|
|
8006
|
+
return {
|
|
8007
|
+
ast,
|
|
8008
|
+
identifiers: this.identifiers,
|
|
8009
|
+
callees: this.callees,
|
|
8010
|
+
nodeCount: this.nodeCount
|
|
8011
|
+
};
|
|
8012
|
+
}
|
|
8013
|
+
peek() {
|
|
8014
|
+
return this.tokens[this.pos];
|
|
8015
|
+
}
|
|
8016
|
+
next() {
|
|
8017
|
+
return this.tokens[this.pos++];
|
|
8018
|
+
}
|
|
8019
|
+
/** Consume a punctuator token, erroring if the next token isn't it. */
|
|
8020
|
+
expectPunct(punct) {
|
|
8021
|
+
const tok = this.peek();
|
|
8022
|
+
if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
|
|
8023
|
+
this.pos += 1;
|
|
8024
|
+
}
|
|
8025
|
+
matchPunct(punct) {
|
|
8026
|
+
const tok = this.peek();
|
|
8027
|
+
if (tok.type === "punct" && tok.punct === punct) {
|
|
8028
|
+
this.pos += 1;
|
|
8029
|
+
return true;
|
|
8030
|
+
}
|
|
8031
|
+
return false;
|
|
8032
|
+
}
|
|
8033
|
+
countNode() {
|
|
8034
|
+
this.nodeCount += 1;
|
|
8035
|
+
if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
|
|
8036
|
+
}
|
|
8037
|
+
parseTernary() {
|
|
8038
|
+
const test = this.parseBinary(1);
|
|
8039
|
+
if (this.matchPunct("?")) {
|
|
8040
|
+
const consequent = this.parseTernary();
|
|
8041
|
+
this.expectPunct(":");
|
|
8042
|
+
const alternate = this.parseTernary();
|
|
8043
|
+
this.countNode();
|
|
8044
|
+
return {
|
|
8045
|
+
kind: "conditional",
|
|
8046
|
+
test,
|
|
8047
|
+
consequent,
|
|
8048
|
+
alternate
|
|
8049
|
+
};
|
|
8050
|
+
}
|
|
8051
|
+
return test;
|
|
8052
|
+
}
|
|
8053
|
+
parseBinary(minPrec) {
|
|
8054
|
+
let left = this.parseUnary();
|
|
8055
|
+
for (;;) {
|
|
8056
|
+
const tok = this.peek();
|
|
8057
|
+
if (tok.type !== "punct") break;
|
|
8058
|
+
const prec = BINARY_PRECEDENCE[tok.punct];
|
|
8059
|
+
if (prec === void 0 || prec < minPrec) break;
|
|
8060
|
+
const op = tok.punct;
|
|
8061
|
+
this.pos += 1;
|
|
8062
|
+
const right = this.parseBinary(prec + 1);
|
|
8063
|
+
this.countNode();
|
|
8064
|
+
if (isLogicalOp(op)) left = {
|
|
8065
|
+
kind: "logical",
|
|
8066
|
+
op,
|
|
8067
|
+
left,
|
|
8068
|
+
right
|
|
8069
|
+
};
|
|
8070
|
+
else if (isBinaryOp(op)) left = {
|
|
8071
|
+
kind: "binary",
|
|
8072
|
+
op,
|
|
8073
|
+
left,
|
|
8074
|
+
right
|
|
8075
|
+
};
|
|
8076
|
+
else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
|
|
8077
|
+
}
|
|
8078
|
+
return left;
|
|
8079
|
+
}
|
|
8080
|
+
parseUnary() {
|
|
8081
|
+
const tok = this.peek();
|
|
8082
|
+
if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
|
|
8083
|
+
const op = tok.punct;
|
|
8084
|
+
this.pos += 1;
|
|
8085
|
+
const operand = this.parseUnary();
|
|
8086
|
+
this.countNode();
|
|
8087
|
+
return {
|
|
8088
|
+
kind: "unary",
|
|
8089
|
+
op,
|
|
8090
|
+
operand
|
|
8091
|
+
};
|
|
8092
|
+
}
|
|
8093
|
+
return this.parsePrimary();
|
|
8094
|
+
}
|
|
8095
|
+
parsePrimary() {
|
|
8096
|
+
const tok = this.next();
|
|
8097
|
+
switch (tok.type) {
|
|
8098
|
+
case "number":
|
|
8099
|
+
this.countNode();
|
|
8100
|
+
return {
|
|
8101
|
+
kind: "literal",
|
|
8102
|
+
value: tok.value
|
|
8103
|
+
};
|
|
8104
|
+
case "string":
|
|
8105
|
+
this.countNode();
|
|
8106
|
+
return {
|
|
8107
|
+
kind: "literal",
|
|
8108
|
+
value: tok.value
|
|
8109
|
+
};
|
|
8110
|
+
case "keyword":
|
|
8111
|
+
this.countNode();
|
|
8112
|
+
return {
|
|
8113
|
+
kind: "literal",
|
|
8114
|
+
value: tok.keyword === "null" ? null : tok.keyword === "true"
|
|
8115
|
+
};
|
|
8116
|
+
case "identifier": {
|
|
8117
|
+
const nextTok = this.peek();
|
|
8118
|
+
if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
|
|
8119
|
+
this.identifiers.add(tok.name);
|
|
8120
|
+
this.countNode();
|
|
8121
|
+
return {
|
|
8122
|
+
kind: "identifier",
|
|
8123
|
+
name: tok.name
|
|
8124
|
+
};
|
|
8125
|
+
}
|
|
8126
|
+
case "punct":
|
|
8127
|
+
if (tok.punct === "(") {
|
|
8128
|
+
const inner = this.parseTernary();
|
|
8129
|
+
this.expectPunct(")");
|
|
8130
|
+
return inner;
|
|
8131
|
+
}
|
|
8132
|
+
throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
|
|
8133
|
+
case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
|
|
8134
|
+
}
|
|
8135
|
+
}
|
|
8136
|
+
parseCall(callee, pos) {
|
|
8137
|
+
if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
|
|
8138
|
+
this.expectPunct("(");
|
|
8139
|
+
const args = [];
|
|
8140
|
+
if (!this.matchPunct(")")) for (;;) {
|
|
8141
|
+
args.push(this.parseTernary());
|
|
8142
|
+
if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
|
|
8143
|
+
if (this.matchPunct(",")) continue;
|
|
8144
|
+
this.expectPunct(")");
|
|
8145
|
+
break;
|
|
8146
|
+
}
|
|
8147
|
+
this.callees.add(callee);
|
|
8148
|
+
this.countNode();
|
|
8149
|
+
return {
|
|
8150
|
+
kind: "call",
|
|
8151
|
+
callee,
|
|
8152
|
+
args
|
|
8153
|
+
};
|
|
8154
|
+
}
|
|
8155
|
+
};
|
|
8156
|
+
/** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
|
|
8157
|
+
* `ExpressionParseError` on any lexical or grammatical failure. */
|
|
8158
|
+
function parseExpression(source) {
|
|
8159
|
+
return new Parser(tokenize(source)).parse();
|
|
8160
|
+
}
|
|
8161
|
+
Object.freeze({});
|
|
8162
|
+
/**
|
|
8163
|
+
* LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
|
|
8164
|
+
* by expr"). The cache stores BOTH successes and failures (negative caching),
|
|
8165
|
+
* so a corrupt persisted string costs exactly one tokenize+parse total — not
|
|
8166
|
+
* one per read on a hot resolve path.
|
|
8167
|
+
*
|
|
8168
|
+
* The cache is a module-level singleton: entries are pure, content-addressed
|
|
8169
|
+
* ASTs keyed by the raw source string, so sharing one instance across all
|
|
8170
|
+
* callers is safe and maximises hit rate.
|
|
8171
|
+
*/
|
|
8172
|
+
var cache = /* @__PURE__ */ new Map();
|
|
8173
|
+
function getCached(source) {
|
|
8174
|
+
const hit = cache.get(source);
|
|
8175
|
+
if (hit !== void 0) {
|
|
8176
|
+
cache.delete(source);
|
|
8177
|
+
cache.set(source, hit);
|
|
8178
|
+
return hit;
|
|
8179
|
+
}
|
|
8180
|
+
let result;
|
|
8181
|
+
try {
|
|
8182
|
+
result = {
|
|
8183
|
+
ok: true,
|
|
8184
|
+
parsed: parseExpression(source)
|
|
8185
|
+
};
|
|
8186
|
+
} catch (err) {
|
|
8187
|
+
result = {
|
|
8188
|
+
ok: false,
|
|
8189
|
+
error: err instanceof ExpressionParseError ? err.message : String(err)
|
|
8190
|
+
};
|
|
8191
|
+
}
|
|
8192
|
+
cache.set(source, result);
|
|
8193
|
+
if (cache.size > 256) {
|
|
8194
|
+
const oldest = cache.keys().next().value;
|
|
8195
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
8196
|
+
}
|
|
8197
|
+
return result;
|
|
8198
|
+
}
|
|
8199
|
+
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
8200
|
+
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
8201
|
+
function compileExpressionSafe(source) {
|
|
8202
|
+
return getCached(source);
|
|
8203
|
+
}
|
|
8204
|
+
/**
|
|
8205
|
+
* Author-time validation. Returns `null` when the source is valid, else a
|
|
8206
|
+
* human-readable error message. Checks: the expression compiles; binding count
|
|
8207
|
+
* is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
|
|
8208
|
+
* is not reserved (`now`/keywords) and does not shadow a builtin; and every
|
|
8209
|
+
* FREE identifier of the AST is covered by a binding or the injected `now`.
|
|
8210
|
+
*/
|
|
8211
|
+
function validateExpressionSource(src) {
|
|
8212
|
+
const names = Object.keys(src.bindings);
|
|
8213
|
+
if (names.length > 32) return `too many bindings (${names.length} > 32)`;
|
|
8214
|
+
for (const name of names) {
|
|
8215
|
+
if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
|
|
8216
|
+
if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
|
|
8217
|
+
if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
|
|
8218
|
+
}
|
|
8219
|
+
const compiled = compileExpressionSafe(src.expr);
|
|
8220
|
+
if (!compiled.ok) return compiled.error;
|
|
8221
|
+
const bound = new Set(names);
|
|
8222
|
+
for (const id of compiled.parsed.identifiers) {
|
|
8223
|
+
if (id === "now") continue;
|
|
8224
|
+
if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
|
|
8225
|
+
}
|
|
8226
|
+
return null;
|
|
8227
|
+
}
|
|
8228
|
+
/**
|
|
7464
8229
|
* Accessory device helpers — shared across drivers.
|
|
7465
8230
|
*
|
|
7466
8231
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -9363,7 +10128,8 @@ var MotionAnalysisResultSchema = object({
|
|
|
9363
10128
|
});
|
|
9364
10129
|
method(object({
|
|
9365
10130
|
deviceId: number(),
|
|
9366
|
-
frame: FrameInputSchema
|
|
10131
|
+
frame: FrameInputSchema.optional(),
|
|
10132
|
+
frameHandle: FrameHandleSchema.optional()
|
|
9367
10133
|
}), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
|
|
9368
10134
|
deviceId: number(),
|
|
9369
10135
|
detected: boolean(),
|
|
@@ -9610,6 +10376,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
9610
10376
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
9611
10377
|
steps: array(PipelineStepInputSchema).min(1),
|
|
9612
10378
|
frame: FrameInputSchema.optional(),
|
|
10379
|
+
/**
|
|
10380
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
10381
|
+
* the decoded pixels live in. One more member of the one-of
|
|
10382
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
10383
|
+
*/
|
|
10384
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
9613
10385
|
imageBase64: string().optional(),
|
|
9614
10386
|
/**
|
|
9615
10387
|
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
@@ -9819,6 +10591,31 @@ var ReportMotionInputSchema = object({
|
|
|
9819
10591
|
regions: array(MotionRegionSchema).readonly().optional()
|
|
9820
10592
|
});
|
|
9821
10593
|
/**
|
|
10594
|
+
* Where a runner gets a camera's decoded frames (cross-node Phase 2,
|
|
10595
|
+
* restream-owner model — P2c).
|
|
10596
|
+
*
|
|
10597
|
+
* - `local-broker` (DEFAULT): today's path — subscribe to the co-located
|
|
10598
|
+
* stream-broker's shm frame plane. Every pre-P2c attach payload (no
|
|
10599
|
+
* `frameSource` key) parses to this, so the field is additive with zero
|
|
10600
|
+
* behavior change.
|
|
10601
|
+
* - `remote-restream`: the detect node is NOT the camera's source-owner.
|
|
10602
|
+
* The runner acquires the owner's COMPRESSED passthrough restream
|
|
10603
|
+
* (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
|
|
10604
|
+
* double-pull guard) and decodes LOCALLY via a satellite frame plane +
|
|
10605
|
+
* pull-mode decoder session pinned to its own node. The shm ring stays
|
|
10606
|
+
* node-local; only H.264/H.265 packets cross the wire.
|
|
10607
|
+
* `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
|
|
10608
|
+
* when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
|
|
10609
|
+
* dials for the owner's restream.
|
|
10610
|
+
*/
|
|
10611
|
+
var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
|
|
10612
|
+
kind: literal("remote-restream"),
|
|
10613
|
+
/** The camera's source-owner node (slice 1: always the hub). */
|
|
10614
|
+
ownerNodeId: string(),
|
|
10615
|
+
/** Operator override for the owner host the runner dials. */
|
|
10616
|
+
hubHostnameOverride: string().optional()
|
|
10617
|
+
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
10618
|
+
/**
|
|
9822
10619
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
9823
10620
|
* specific runner instance via `attachCamera`. Carries everything the
|
|
9824
10621
|
* runner needs to subscribe to the local broker and execute inference.
|
|
@@ -9916,7 +10713,15 @@ var RunnerCameraConfigSchema = object({
|
|
|
9916
10713
|
*/
|
|
9917
10714
|
onboardMotionDrivesAnalyzer: boolean().default(true),
|
|
9918
10715
|
occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
|
|
9919
|
-
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
|
|
10716
|
+
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
|
|
10717
|
+
/**
|
|
10718
|
+
* Where this runner gets the camera's decoded frames (P2c). Defaulted so
|
|
10719
|
+
* every existing payload behaves as `local-broker` — the pre-Phase-2 path.
|
|
10720
|
+
* Populated with `remote-restream` by the orchestrator ONLY when the
|
|
10721
|
+
* camera's detect node differs from its source-owner (P2d, gated by the
|
|
10722
|
+
* `remoteSourcingNodes` rollout setting).
|
|
10723
|
+
*/
|
|
10724
|
+
frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
|
|
9920
10725
|
});
|
|
9921
10726
|
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;
|
|
9922
10727
|
/**
|
|
@@ -10281,6 +11086,113 @@ object({
|
|
|
10281
11086
|
lastFetchedAt: number()
|
|
10282
11087
|
});
|
|
10283
11088
|
DeviceType.Sensor;
|
|
11089
|
+
/**
|
|
11090
|
+
* Feeder connectivity / power status — mirrors the HA petkit device-status
|
|
11091
|
+
* enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
|
|
11092
|
+
* `on_batteries` (running on battery backup). `null` until first reported.
|
|
11093
|
+
*/
|
|
11094
|
+
var PetFeederDeviceStatusSchema = _enum([
|
|
11095
|
+
"normal",
|
|
11096
|
+
"offline",
|
|
11097
|
+
"on_batteries"
|
|
11098
|
+
]);
|
|
11099
|
+
var gramsPortion = number().int().min(4).max(200);
|
|
11100
|
+
object({
|
|
11101
|
+
/** Food currently in the bowl (grams). Null when the device has not
|
|
11102
|
+
* reported a reading yet. On dual-hopper models this is the combined
|
|
11103
|
+
* bowl reading; per-hopper levels live in `food1`/`food2`. */
|
|
11104
|
+
foodLevel: number().nullable(),
|
|
11105
|
+
/** Hopper-1 food level (grams) on dual-hopper feeders; null on
|
|
11106
|
+
* single-hopper models. */
|
|
11107
|
+
food1: number().nullable(),
|
|
11108
|
+
/** Hopper-2 food level (grams) on dual-hopper feeders; null on
|
|
11109
|
+
* single-hopper models. */
|
|
11110
|
+
food2: number().nullable(),
|
|
11111
|
+
/** Derived low-food flag — mirrors the HA `food_level` binary_sensor
|
|
11112
|
+
* (`device_class: problem`, on = low). True when the bowl is empty /
|
|
11113
|
+
* below the feeder's low threshold. */
|
|
11114
|
+
lowFood: boolean(),
|
|
11115
|
+
/** Battery charge 0..100 (%). Null on mains-powered models or when the
|
|
11116
|
+
* device has no battery reading. */
|
|
11117
|
+
batteryPower: number().min(0).max(100).nullable(),
|
|
11118
|
+
/** Days of desiccant life remaining. Null when the model has no
|
|
11119
|
+
* desiccant sensor. */
|
|
11120
|
+
desiccantLeftDays: number().nullable(),
|
|
11121
|
+
/** True while a feed is in progress. */
|
|
11122
|
+
feeding: boolean(),
|
|
11123
|
+
/** Decoded connectivity / power status (HA petkit device-status enum).
|
|
11124
|
+
* Null until the device has reported a status. */
|
|
11125
|
+
status: PetFeederDeviceStatusSchema.nullable(),
|
|
11126
|
+
/** Decoded human-readable fault message. Null (or the device's `no_error`
|
|
11127
|
+
* sentinel) means healthy; a non-null string is an active fault. Pairs
|
|
11128
|
+
* with `errorCode` for consumers that want the raw integer. */
|
|
11129
|
+
error: string().nullable(),
|
|
11130
|
+
/** Raw device error code (0 / null = no error). */
|
|
11131
|
+
errorCode: number().nullable(),
|
|
11132
|
+
/** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
|
|
11133
|
+
isDualHopper: boolean(),
|
|
11134
|
+
/** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
|
|
11135
|
+
childLock: boolean(),
|
|
11136
|
+
/** Front indicator-light setting. */
|
|
11137
|
+
indicatorLight: boolean(),
|
|
11138
|
+
/** Play a chime when dispensing. */
|
|
11139
|
+
feedSound: boolean(),
|
|
11140
|
+
/** Speaker / prompt volume level (device-scaled integer). */
|
|
11141
|
+
volume: number(),
|
|
11142
|
+
/** Ms epoch when the slice was last refreshed from the cloud. */
|
|
11143
|
+
lastFetchedAt: number()
|
|
11144
|
+
});
|
|
11145
|
+
DeviceType.PetFeeder, method(object({
|
|
11146
|
+
deviceId: number().int().nonnegative(),
|
|
11147
|
+
grams: gramsPortion.optional(),
|
|
11148
|
+
hopper1: gramsPortion.optional(),
|
|
11149
|
+
hopper2: gramsPortion.optional()
|
|
11150
|
+
}), _void(), {
|
|
11151
|
+
kind: "mutation",
|
|
11152
|
+
auth: "admin"
|
|
11153
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11154
|
+
kind: "mutation",
|
|
11155
|
+
auth: "admin"
|
|
11156
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11157
|
+
kind: "mutation",
|
|
11158
|
+
auth: "admin"
|
|
11159
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11160
|
+
kind: "mutation",
|
|
11161
|
+
auth: "admin"
|
|
11162
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11163
|
+
kind: "mutation",
|
|
11164
|
+
auth: "admin"
|
|
11165
|
+
}), method(object({
|
|
11166
|
+
deviceId: number().int().nonnegative(),
|
|
11167
|
+
soundId: number().int().nonnegative()
|
|
11168
|
+
}), _void(), {
|
|
11169
|
+
kind: "mutation",
|
|
11170
|
+
auth: "admin"
|
|
11171
|
+
}), method(object({
|
|
11172
|
+
deviceId: number().int().nonnegative(),
|
|
11173
|
+
on: boolean()
|
|
11174
|
+
}), _void(), {
|
|
11175
|
+
kind: "mutation",
|
|
11176
|
+
auth: "admin"
|
|
11177
|
+
}), method(object({
|
|
11178
|
+
deviceId: number().int().nonnegative(),
|
|
11179
|
+
on: boolean()
|
|
11180
|
+
}), _void(), {
|
|
11181
|
+
kind: "mutation",
|
|
11182
|
+
auth: "admin"
|
|
11183
|
+
}), method(object({
|
|
11184
|
+
deviceId: number().int().nonnegative(),
|
|
11185
|
+
on: boolean()
|
|
11186
|
+
}), _void(), {
|
|
11187
|
+
kind: "mutation",
|
|
11188
|
+
auth: "admin"
|
|
11189
|
+
}), method(object({
|
|
11190
|
+
deviceId: number().int().nonnegative(),
|
|
11191
|
+
level: number().int().nonnegative()
|
|
11192
|
+
}), _void(), {
|
|
11193
|
+
kind: "mutation",
|
|
11194
|
+
auth: "admin"
|
|
11195
|
+
});
|
|
10284
11196
|
object({
|
|
10285
11197
|
/** Instantaneous power draw in watts. */
|
|
10286
11198
|
watts: number().optional(),
|
|
@@ -12141,10 +13053,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
|
|
|
12141
13053
|
url: string()
|
|
12142
13054
|
}), _void()), method(object({
|
|
12143
13055
|
sessionId: string(),
|
|
12144
|
-
maxCount: number().default(1)
|
|
13056
|
+
maxCount: number().default(1),
|
|
13057
|
+
waitMs: number().optional()
|
|
12145
13058
|
}), array(DecodedFrameSchema)), method(object({
|
|
12146
13059
|
sessionId: string(),
|
|
12147
|
-
maxCount: number().default(1)
|
|
13060
|
+
maxCount: number().default(1),
|
|
13061
|
+
waitMs: number().optional()
|
|
12148
13062
|
}), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
|
|
12149
13063
|
sessionId: string(),
|
|
12150
13064
|
config: DecoderSessionConfigSchema.partial()
|
|
@@ -12431,14 +13345,63 @@ var ChildLayoutEntrySchema = object({
|
|
|
12431
13345
|
collapsed: boolean().optional()
|
|
12432
13346
|
});
|
|
12433
13347
|
/** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
|
|
12434
|
-
* `device-management.ts`.
|
|
13348
|
+
* `device-management.ts`. Source is a union: a FIELD source copies a sibling
|
|
13349
|
+
* accessory's status field (`kind` optional/absent for wire compat); a
|
|
13350
|
+
* LITERAL source carries a per-device constant (no sibling is read); a
|
|
13351
|
+
* GLOBAL source (P2e) copies ANY device's status field, addressed by the
|
|
13352
|
+
* source device's full re-sync-stable `stableId`. */
|
|
13353
|
+
var DeviceLinkFieldSourceSchema = object({
|
|
13354
|
+
kind: literal("field").optional(),
|
|
13355
|
+
sourceKey: string(),
|
|
13356
|
+
cap: string(),
|
|
13357
|
+
fieldPath: string()
|
|
13358
|
+
});
|
|
13359
|
+
var DeviceLinkLiteralSourceSchema = object({
|
|
13360
|
+
kind: literal("literal"),
|
|
13361
|
+
value: union([
|
|
13362
|
+
string(),
|
|
13363
|
+
number(),
|
|
13364
|
+
boolean(),
|
|
13365
|
+
_null()
|
|
13366
|
+
])
|
|
13367
|
+
});
|
|
13368
|
+
var DeviceLinkGlobalSourceSchema = object({
|
|
13369
|
+
kind: literal("global"),
|
|
13370
|
+
sourceStableId: string(),
|
|
13371
|
+
cap: string(),
|
|
13372
|
+
fieldPath: string()
|
|
13373
|
+
});
|
|
13374
|
+
/** Expression source (Stage X): compute the target field from N named bindings
|
|
13375
|
+
* via the safe expression engine. Bindings are field | literal | global — never
|
|
13376
|
+
* another expression (no nesting). The `superRefine` runs the SAME author-time
|
|
13377
|
+
* validation as `validateExpressionSource` (compiles the expr, checks binding
|
|
13378
|
+
* names + identifier coverage) so every wire boundary that parses a DeviceLink
|
|
13379
|
+
* (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
|
|
13380
|
+
* Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
|
|
13381
|
+
var DeviceLinkExpressionSourceSchema = object({
|
|
13382
|
+
kind: literal("expression"),
|
|
13383
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
13384
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
|
|
13385
|
+
DeviceLinkFieldSourceSchema,
|
|
13386
|
+
DeviceLinkLiteralSourceSchema,
|
|
13387
|
+
DeviceLinkGlobalSourceSchema
|
|
13388
|
+
]))
|
|
13389
|
+
}).superRefine((src, ctx) => {
|
|
13390
|
+
const err = validateExpressionSource(src);
|
|
13391
|
+
if (err !== null) ctx.addIssue({
|
|
13392
|
+
code: "custom",
|
|
13393
|
+
message: err,
|
|
13394
|
+
path: ["expr"]
|
|
13395
|
+
});
|
|
13396
|
+
});
|
|
12435
13397
|
var DeviceLinkSchema = object({
|
|
12436
13398
|
id: string(),
|
|
12437
|
-
source:
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
13399
|
+
source: union([
|
|
13400
|
+
DeviceLinkFieldSourceSchema,
|
|
13401
|
+
DeviceLinkLiteralSourceSchema,
|
|
13402
|
+
DeviceLinkGlobalSourceSchema,
|
|
13403
|
+
DeviceLinkExpressionSourceSchema
|
|
13404
|
+
]),
|
|
12442
13405
|
target: object({
|
|
12443
13406
|
cap: string(),
|
|
12444
13407
|
fieldPath: string(),
|
|
@@ -12467,6 +13430,31 @@ var DeviceLinkSchema = object({
|
|
|
12467
13430
|
})
|
|
12468
13431
|
]).optional()
|
|
12469
13432
|
});
|
|
13433
|
+
/** Cap-wire shape of a per-cap display refinement — mirrors
|
|
13434
|
+
* `DeviceCapDisplayOverride` in `device-management.ts`. */
|
|
13435
|
+
var DeviceCapDisplayOverrideSchema = object({
|
|
13436
|
+
unit: string().min(1).optional(),
|
|
13437
|
+
precision: number().int().min(0).max(10).optional()
|
|
13438
|
+
});
|
|
13439
|
+
/** Cap-wire shape of an operator-authored per-device display override —
|
|
13440
|
+
* mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
|
|
13441
|
+
* bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
|
|
13442
|
+
var DeviceDisplayOverrideSchema = object({
|
|
13443
|
+
icon: string().min(1).optional(),
|
|
13444
|
+
label: string().min(1).optional(),
|
|
13445
|
+
unit: string().min(1).optional(),
|
|
13446
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13447
|
+
hidden: boolean().optional(),
|
|
13448
|
+
perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
|
|
13449
|
+
});
|
|
13450
|
+
/** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
|
|
13451
|
+
* in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
|
|
13452
|
+
* the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
|
|
13453
|
+
var RoleDisplayDefaultSchema = object({
|
|
13454
|
+
unit: string().min(1).optional(),
|
|
13455
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13456
|
+
icon: string().min(1).optional()
|
|
13457
|
+
});
|
|
12470
13458
|
/**
|
|
12471
13459
|
* Serializable projection of a live IDevice.
|
|
12472
13460
|
* Returned by listAll, getDevice, getChildren.
|
|
@@ -12522,7 +13510,9 @@ var DeviceInfoSchema = object({
|
|
|
12522
13510
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
12523
13511
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
12524
13512
|
/** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
|
|
12525
|
-
deviceLinks: array(DeviceLinkSchema).readonly().optional()
|
|
13513
|
+
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
13514
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13515
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12526
13516
|
});
|
|
12527
13517
|
var ConfigEntrySchema = object({
|
|
12528
13518
|
key: string(),
|
|
@@ -12587,7 +13577,9 @@ var DeviceMetaSchema = object({
|
|
|
12587
13577
|
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
12588
13578
|
/** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
|
|
12589
13579
|
* Optional: only present for accessory children that carry a known role. */
|
|
12590
|
-
role: string().nullable().optional()
|
|
13580
|
+
role: string().nullable().optional(),
|
|
13581
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13582
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12591
13583
|
});
|
|
12592
13584
|
/** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
|
|
12593
13585
|
var ConfigUISchemaOutput = unknown().nullable();
|
|
@@ -12681,7 +13673,19 @@ method(object({
|
|
|
12681
13673
|
}), _void(), {
|
|
12682
13674
|
kind: "mutation",
|
|
12683
13675
|
auth: "admin"
|
|
12684
|
-
}), method(object({
|
|
13676
|
+
}), method(object({
|
|
13677
|
+
deviceId: number(),
|
|
13678
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
13679
|
+
}), _void(), {
|
|
13680
|
+
kind: "mutation",
|
|
13681
|
+
auth: "admin"
|
|
13682
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
13683
|
+
kind: "mutation",
|
|
13684
|
+
auth: "admin"
|
|
13685
|
+
}), method(object({
|
|
13686
|
+
deviceId: number(),
|
|
13687
|
+
includeSynthesizable: boolean().optional()
|
|
13688
|
+
}), object({ caps: array(object({
|
|
12685
13689
|
cap: string(),
|
|
12686
13690
|
fields: array(object({
|
|
12687
13691
|
path: string(),
|
|
@@ -12691,8 +13695,13 @@ method(object({
|
|
|
12691
13695
|
"boolean",
|
|
12692
13696
|
"enum"
|
|
12693
13697
|
]),
|
|
12694
|
-
enumValues: array(string()).optional()
|
|
12695
|
-
|
|
13698
|
+
enumValues: array(string()).optional(),
|
|
13699
|
+
item: boolean().optional()
|
|
13700
|
+
})).readonly(),
|
|
13701
|
+
itemArray: object({
|
|
13702
|
+
path: string(),
|
|
13703
|
+
keyField: string()
|
|
13704
|
+
}).optional()
|
|
12696
13705
|
})).readonly() }), { kind: "query" }), method(object({
|
|
12697
13706
|
deviceId: number(),
|
|
12698
13707
|
role: string().nullable()
|
|
@@ -12762,7 +13771,11 @@ method(object({
|
|
|
12762
13771
|
deviceId: number(),
|
|
12763
13772
|
entries: array(object({
|
|
12764
13773
|
capName: string(),
|
|
12765
|
-
kind: _enum([
|
|
13774
|
+
kind: _enum([
|
|
13775
|
+
"native",
|
|
13776
|
+
"wrapped",
|
|
13777
|
+
"linked"
|
|
13778
|
+
]),
|
|
12766
13779
|
providerAddonId: string(),
|
|
12767
13780
|
providerNodeId: string(),
|
|
12768
13781
|
nativeAddonId: string()
|
|
@@ -12771,7 +13784,11 @@ method(object({
|
|
|
12771
13784
|
deviceId: number(),
|
|
12772
13785
|
entries: array(object({
|
|
12773
13786
|
capName: string(),
|
|
12774
|
-
kind: _enum([
|
|
13787
|
+
kind: _enum([
|
|
13788
|
+
"native",
|
|
13789
|
+
"wrapped",
|
|
13790
|
+
"linked"
|
|
13791
|
+
]),
|
|
12775
13792
|
providerAddonId: string(),
|
|
12776
13793
|
providerNodeId: string(),
|
|
12777
13794
|
nativeAddonId: string()
|
|
@@ -13267,7 +14284,7 @@ var AddBrokerInputSchema = object({
|
|
|
13267
14284
|
});
|
|
13268
14285
|
var AddBrokerResultSchema = object({ id: string() });
|
|
13269
14286
|
var IdInputSchema = object({ id: string() });
|
|
13270
|
-
var TestResultSchema = discriminatedUnion("ok", [object({
|
|
14287
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
13271
14288
|
ok: literal(true),
|
|
13272
14289
|
latencyMs: number()
|
|
13273
14290
|
}), object({
|
|
@@ -13290,7 +14307,7 @@ var StatusSchema = object({
|
|
|
13290
14307
|
brokerCount: number(),
|
|
13291
14308
|
embeddedRunning: boolean()
|
|
13292
14309
|
});
|
|
13293
|
-
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);
|
|
14310
|
+
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);
|
|
13294
14311
|
var NetworkEndpointSchema = object({
|
|
13295
14312
|
url: string(),
|
|
13296
14313
|
hostname: string(),
|
|
@@ -13324,23 +14341,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
|
13324
14341
|
sourcePort: number().optional()
|
|
13325
14342
|
});
|
|
13326
14343
|
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
13327
|
-
|
|
13328
|
-
|
|
14344
|
+
/**
|
|
14345
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14346
|
+
*
|
|
14347
|
+
* Apprise-derived model (see
|
|
14348
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14349
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14350
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14351
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14352
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14353
|
+
*
|
|
14354
|
+
* DESIGN DECISIONS (locked):
|
|
14355
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14356
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14357
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14358
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14359
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14360
|
+
* discovery→adopt flow.
|
|
14361
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14362
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14363
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14364
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14365
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14366
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14367
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14368
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14369
|
+
* base64 fallback needed.
|
|
14370
|
+
*
|
|
14371
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14372
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14373
|
+
* admin "Integrations" page.
|
|
14374
|
+
*/
|
|
14375
|
+
/**
|
|
14376
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14377
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14378
|
+
*/
|
|
14379
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14380
|
+
"image",
|
|
14381
|
+
"video",
|
|
14382
|
+
"gif",
|
|
14383
|
+
"audio",
|
|
14384
|
+
"icon"
|
|
14385
|
+
]);
|
|
14386
|
+
/**
|
|
14387
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14388
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14389
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14390
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14391
|
+
*/
|
|
14392
|
+
var AttachmentSchema = object({
|
|
14393
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14394
|
+
url: string().optional(),
|
|
14395
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14396
|
+
mime: string().optional(),
|
|
14397
|
+
name: string().optional()
|
|
14398
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14399
|
+
var NotificationFormatSchema = _enum([
|
|
14400
|
+
"text",
|
|
14401
|
+
"markdown",
|
|
14402
|
+
"html"
|
|
14403
|
+
]);
|
|
14404
|
+
/** A single tap-through action button. */
|
|
14405
|
+
var NotificationActionSchema = object({
|
|
14406
|
+
id: string(),
|
|
14407
|
+
label: string(),
|
|
14408
|
+
url: string().optional()
|
|
14409
|
+
});
|
|
14410
|
+
/**
|
|
14411
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14412
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14413
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14414
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14415
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14416
|
+
* `priority` for that one target.
|
|
14417
|
+
*/
|
|
14418
|
+
var NotificationSchema = object({
|
|
13329
14419
|
body: string(),
|
|
13330
|
-
|
|
14420
|
+
title: string().optional(),
|
|
14421
|
+
format: NotificationFormatSchema.default("text"),
|
|
14422
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14423
|
+
level: string().optional(),
|
|
14424
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14425
|
+
clickUrl: string().optional(),
|
|
14426
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14427
|
+
sound: string().optional(),
|
|
14428
|
+
ttl: number().optional(),
|
|
14429
|
+
tag: string().optional(),
|
|
13331
14430
|
deviceId: number().optional(),
|
|
13332
14431
|
eventId: string().optional(),
|
|
13333
|
-
priority: _enum([
|
|
13334
|
-
"low",
|
|
13335
|
-
"normal",
|
|
13336
|
-
"high",
|
|
13337
|
-
"critical"
|
|
13338
|
-
]).default("normal"),
|
|
13339
14432
|
metadata: record(string(), unknown()).optional()
|
|
13340
|
-
})
|
|
14433
|
+
});
|
|
14434
|
+
/** One declared native severity/priority level for a kind. */
|
|
14435
|
+
var TargetKindLevelSchema = object({
|
|
14436
|
+
id: string(),
|
|
14437
|
+
label: string(),
|
|
14438
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14439
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14440
|
+
flags: object({
|
|
14441
|
+
critical: boolean().optional(),
|
|
14442
|
+
silent: boolean().optional(),
|
|
14443
|
+
noPush: boolean().optional()
|
|
14444
|
+
}).optional(),
|
|
14445
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14446
|
+
requires: array(string()).optional(),
|
|
14447
|
+
description: string().optional()
|
|
14448
|
+
});
|
|
14449
|
+
/** The full capability block consulted before dispatch. */
|
|
14450
|
+
var TargetKindCapsSchema = object({
|
|
14451
|
+
attachments: object({
|
|
14452
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14453
|
+
mode: _enum([
|
|
14454
|
+
"url",
|
|
14455
|
+
"bytes",
|
|
14456
|
+
"both"
|
|
14457
|
+
]),
|
|
14458
|
+
max: number().int().nonnegative(),
|
|
14459
|
+
maxBytes: number().int().positive().optional()
|
|
14460
|
+
}),
|
|
14461
|
+
/** Max action buttons (0 = none). */
|
|
14462
|
+
actions: number().int().nonnegative(),
|
|
14463
|
+
levels: array(TargetKindLevelSchema),
|
|
14464
|
+
format: array(NotificationFormatSchema),
|
|
14465
|
+
clickUrl: boolean(),
|
|
14466
|
+
sound: boolean(),
|
|
14467
|
+
ttl: boolean(),
|
|
14468
|
+
bodyMaxLen: number().int().positive()
|
|
14469
|
+
});
|
|
14470
|
+
/**
|
|
14471
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14472
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14473
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14474
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14475
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14476
|
+
*/
|
|
14477
|
+
var ConfigSchemaPassthrough = unknown();
|
|
14478
|
+
var TargetKindSchema = object({
|
|
14479
|
+
kind: string(),
|
|
14480
|
+
label: string(),
|
|
14481
|
+
icon: string(),
|
|
14482
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14483
|
+
addonId: string(),
|
|
14484
|
+
configSchema: ConfigSchemaPassthrough,
|
|
14485
|
+
supportsDiscovery: boolean(),
|
|
14486
|
+
caps: TargetKindCapsSchema
|
|
14487
|
+
});
|
|
14488
|
+
/**
|
|
14489
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14490
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14491
|
+
* round-trip a stored secret to the UI.
|
|
14492
|
+
*/
|
|
14493
|
+
var TargetSchema = object({
|
|
14494
|
+
id: string(),
|
|
14495
|
+
name: string(),
|
|
14496
|
+
kind: string(),
|
|
14497
|
+
addonId: string(),
|
|
14498
|
+
enabled: boolean(),
|
|
14499
|
+
config: record(string(), unknown())
|
|
14500
|
+
});
|
|
14501
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14502
|
+
var DiscoveredTargetSchema = object({
|
|
14503
|
+
kind: string(),
|
|
14504
|
+
suggestedName: string(),
|
|
14505
|
+
config: record(string(), unknown())
|
|
14506
|
+
});
|
|
14507
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14508
|
+
var RenderedAsSchema = object({
|
|
14509
|
+
level: string(),
|
|
14510
|
+
format: NotificationFormatSchema,
|
|
14511
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14512
|
+
actionsSent: number().int().nonnegative(),
|
|
14513
|
+
truncated: boolean(),
|
|
14514
|
+
dropped: array(string())
|
|
14515
|
+
});
|
|
14516
|
+
var SendResultSchema = object({
|
|
13341
14517
|
success: boolean(),
|
|
13342
|
-
error: string().optional()
|
|
13343
|
-
|
|
14518
|
+
error: string().optional(),
|
|
14519
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14520
|
+
});
|
|
14521
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14522
|
+
var TestResultSchema = SendResultSchema;
|
|
14523
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
14524
|
+
kind: string(),
|
|
14525
|
+
config: record(string(), unknown()).optional()
|
|
14526
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
14527
|
+
targetId: string(),
|
|
14528
|
+
notification: NotificationSchema
|
|
14529
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
14530
|
+
targetId: string(),
|
|
14531
|
+
sample: NotificationSchema.optional()
|
|
14532
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
14533
|
+
targetId: string(),
|
|
14534
|
+
enabled: boolean()
|
|
14535
|
+
}), _void(), { kind: "mutation" });
|
|
13344
14536
|
/**
|
|
13345
14537
|
* Zod schemas for persisted record types.
|
|
13346
14538
|
*
|
|
@@ -16362,7 +17554,10 @@ var HwAccelBackendInputSchema = _enum([
|
|
|
16362
17554
|
"webgpu",
|
|
16363
17555
|
"none"
|
|
16364
17556
|
]).nullable().optional();
|
|
16365
|
-
var HwAccelResolutionSchema = object({
|
|
17557
|
+
var HwAccelResolutionSchema = object({
|
|
17558
|
+
preferred: array(string()).readonly(),
|
|
17559
|
+
rationale: string()
|
|
17560
|
+
});
|
|
16366
17561
|
var HardwareEncoderIdSchema = _enum([
|
|
16367
17562
|
"h264_videotoolbox",
|
|
16368
17563
|
"hevc_videotoolbox",
|
|
@@ -16467,10 +17662,7 @@ var ResolvedInferenceConfigSchema = object({
|
|
|
16467
17662
|
format: ModelFormatSchema,
|
|
16468
17663
|
reason: string()
|
|
16469
17664
|
});
|
|
16470
|
-
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
|
|
16471
|
-
prefer: HwAccelBackendInputSchema,
|
|
16472
|
-
nodeId: string().optional()
|
|
16473
|
-
}), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
17665
|
+
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
16474
17666
|
kind: "mutation",
|
|
16475
17667
|
auth: "admin"
|
|
16476
17668
|
}), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
|
|
@@ -16529,6 +17721,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
|
|
|
16529
17721
|
kind: "mutation",
|
|
16530
17722
|
auth: "admin"
|
|
16531
17723
|
});
|
|
17724
|
+
/**
|
|
17725
|
+
* `recording` cap — footage availability + HLS playback manifests + per-device
|
|
17726
|
+
* recording config. NOTE on events (source of truth, R5/C3): this cap carries
|
|
17727
|
+
* NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
|
|
17728
|
+
* events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
|
|
17729
|
+
* rows); the recorder's internal EventMap markers are ephemeral in-RAM
|
|
17730
|
+
* annotations that are not exposed here and must not be treated as an event
|
|
17731
|
+
* feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
|
|
17732
|
+
* (`interfaces/recording-config.ts`).
|
|
17733
|
+
*/
|
|
16532
17734
|
var RecordingStatusSchema = object({
|
|
16533
17735
|
deviceId: number(),
|
|
16534
17736
|
enabled: boolean(),
|
|
@@ -18165,6 +19367,12 @@ Object.freeze({
|
|
|
18165
19367
|
addonId: null,
|
|
18166
19368
|
access: "view"
|
|
18167
19369
|
},
|
|
19370
|
+
"deviceManager.getRoleDisplayDefaults": {
|
|
19371
|
+
capName: "device-manager",
|
|
19372
|
+
capScope: "system",
|
|
19373
|
+
addonId: null,
|
|
19374
|
+
access: "view"
|
|
19375
|
+
},
|
|
18168
19376
|
"deviceManager.getSettingsSchema": {
|
|
18169
19377
|
capName: "device-manager",
|
|
18170
19378
|
capScope: "system",
|
|
@@ -18315,6 +19523,12 @@ Object.freeze({
|
|
|
18315
19523
|
addonId: null,
|
|
18316
19524
|
access: "create"
|
|
18317
19525
|
},
|
|
19526
|
+
"deviceManager.setDisplay": {
|
|
19527
|
+
capName: "device-manager",
|
|
19528
|
+
capScope: "system",
|
|
19529
|
+
addonId: null,
|
|
19530
|
+
access: "create"
|
|
19531
|
+
},
|
|
18318
19532
|
"deviceManager.setIntegrationId": {
|
|
18319
19533
|
capName: "device-manager",
|
|
18320
19534
|
capScope: "system",
|
|
@@ -18357,6 +19571,12 @@ Object.freeze({
|
|
|
18357
19571
|
addonId: null,
|
|
18358
19572
|
access: "create"
|
|
18359
19573
|
},
|
|
19574
|
+
"deviceManager.setRoleDisplayDefaults": {
|
|
19575
|
+
capName: "device-manager",
|
|
19576
|
+
capScope: "system",
|
|
19577
|
+
addonId: null,
|
|
19578
|
+
access: "create"
|
|
19579
|
+
},
|
|
18360
19580
|
"deviceManager.setStreamProfileMap": {
|
|
18361
19581
|
capName: "device-manager",
|
|
18362
19582
|
capScope: "system",
|
|
@@ -19335,13 +20555,49 @@ Object.freeze({
|
|
|
19335
20555
|
addonId: null,
|
|
19336
20556
|
access: "create"
|
|
19337
20557
|
},
|
|
20558
|
+
"notificationOutput.deleteTarget": {
|
|
20559
|
+
capName: "notification-output",
|
|
20560
|
+
capScope: "system",
|
|
20561
|
+
addonId: null,
|
|
20562
|
+
access: "delete"
|
|
20563
|
+
},
|
|
20564
|
+
"notificationOutput.discoverTargets": {
|
|
20565
|
+
capName: "notification-output",
|
|
20566
|
+
capScope: "system",
|
|
20567
|
+
addonId: null,
|
|
20568
|
+
access: "view"
|
|
20569
|
+
},
|
|
20570
|
+
"notificationOutput.listTargetKinds": {
|
|
20571
|
+
capName: "notification-output",
|
|
20572
|
+
capScope: "system",
|
|
20573
|
+
addonId: null,
|
|
20574
|
+
access: "view"
|
|
20575
|
+
},
|
|
20576
|
+
"notificationOutput.listTargets": {
|
|
20577
|
+
capName: "notification-output",
|
|
20578
|
+
capScope: "system",
|
|
20579
|
+
addonId: null,
|
|
20580
|
+
access: "view"
|
|
20581
|
+
},
|
|
19338
20582
|
"notificationOutput.send": {
|
|
19339
20583
|
capName: "notification-output",
|
|
19340
20584
|
capScope: "system",
|
|
19341
20585
|
addonId: null,
|
|
19342
20586
|
access: "create"
|
|
19343
20587
|
},
|
|
19344
|
-
"notificationOutput.
|
|
20588
|
+
"notificationOutput.setTargetEnabled": {
|
|
20589
|
+
capName: "notification-output",
|
|
20590
|
+
capScope: "system",
|
|
20591
|
+
addonId: null,
|
|
20592
|
+
access: "create"
|
|
20593
|
+
},
|
|
20594
|
+
"notificationOutput.testTarget": {
|
|
20595
|
+
capName: "notification-output",
|
|
20596
|
+
capScope: "system",
|
|
20597
|
+
addonId: null,
|
|
20598
|
+
access: "create"
|
|
20599
|
+
},
|
|
20600
|
+
"notificationOutput.upsertTarget": {
|
|
19345
20601
|
capName: "notification-output",
|
|
19346
20602
|
capScope: "system",
|
|
19347
20603
|
addonId: null,
|
|
@@ -19371,6 +20627,66 @@ Object.freeze({
|
|
|
19371
20627
|
addonId: null,
|
|
19372
20628
|
access: "create"
|
|
19373
20629
|
},
|
|
20630
|
+
"petFeeder.callPet": {
|
|
20631
|
+
capName: "pet-feeder",
|
|
20632
|
+
capScope: "device",
|
|
20633
|
+
addonId: null,
|
|
20634
|
+
access: "create"
|
|
20635
|
+
},
|
|
20636
|
+
"petFeeder.cancelFeed": {
|
|
20637
|
+
capName: "pet-feeder",
|
|
20638
|
+
capScope: "device",
|
|
20639
|
+
addonId: null,
|
|
20640
|
+
access: "create"
|
|
20641
|
+
},
|
|
20642
|
+
"petFeeder.feed": {
|
|
20643
|
+
capName: "pet-feeder",
|
|
20644
|
+
capScope: "device",
|
|
20645
|
+
addonId: null,
|
|
20646
|
+
access: "create"
|
|
20647
|
+
},
|
|
20648
|
+
"petFeeder.markFoodReplenished": {
|
|
20649
|
+
capName: "pet-feeder",
|
|
20650
|
+
capScope: "device",
|
|
20651
|
+
addonId: null,
|
|
20652
|
+
access: "create"
|
|
20653
|
+
},
|
|
20654
|
+
"petFeeder.playSound": {
|
|
20655
|
+
capName: "pet-feeder",
|
|
20656
|
+
capScope: "device",
|
|
20657
|
+
addonId: null,
|
|
20658
|
+
access: "create"
|
|
20659
|
+
},
|
|
20660
|
+
"petFeeder.resetDesiccant": {
|
|
20661
|
+
capName: "pet-feeder",
|
|
20662
|
+
capScope: "device",
|
|
20663
|
+
addonId: null,
|
|
20664
|
+
access: "delete"
|
|
20665
|
+
},
|
|
20666
|
+
"petFeeder.setChildLock": {
|
|
20667
|
+
capName: "pet-feeder",
|
|
20668
|
+
capScope: "device",
|
|
20669
|
+
addonId: null,
|
|
20670
|
+
access: "create"
|
|
20671
|
+
},
|
|
20672
|
+
"petFeeder.setFeedSound": {
|
|
20673
|
+
capName: "pet-feeder",
|
|
20674
|
+
capScope: "device",
|
|
20675
|
+
addonId: null,
|
|
20676
|
+
access: "create"
|
|
20677
|
+
},
|
|
20678
|
+
"petFeeder.setIndicatorLight": {
|
|
20679
|
+
capName: "pet-feeder",
|
|
20680
|
+
capScope: "device",
|
|
20681
|
+
addonId: null,
|
|
20682
|
+
access: "create"
|
|
20683
|
+
},
|
|
20684
|
+
"petFeeder.setVolume": {
|
|
20685
|
+
capName: "pet-feeder",
|
|
20686
|
+
capScope: "device",
|
|
20687
|
+
addonId: null,
|
|
20688
|
+
access: "create"
|
|
20689
|
+
},
|
|
19374
20690
|
"pipelineAnalytics.clearTracks": {
|
|
19375
20691
|
capName: "pipeline-analytics",
|
|
19376
20692
|
capScope: "device",
|