@camstack/addon-mqtt-broker 1.1.12 → 1.1.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/mqtt-broker.addon.js +1380 -46
- package/dist/mqtt-broker.addon.mjs +1380 -46
- package/package.json +1 -1
|
@@ -4668,7 +4668,7 @@ function _instanceof(cls, params = {}) {
|
|
|
4668
4668
|
return inst;
|
|
4669
4669
|
}
|
|
4670
4670
|
//#endregion
|
|
4671
|
-
//#region ../types/dist/sleep-
|
|
4671
|
+
//#region ../types/dist/sleep-BiDFW0E7.mjs
|
|
4672
4672
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4673
4673
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4674
4674
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -5481,6 +5481,100 @@ function createDurableState(deps) {
|
|
|
5481
5481
|
};
|
|
5482
5482
|
}
|
|
5483
5483
|
/**
|
|
5484
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
5485
|
+
*
|
|
5486
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
5487
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
5488
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
5489
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
5490
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
5491
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
5492
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
5493
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
5494
|
+
*
|
|
5495
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
5496
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
5497
|
+
* schema and routes reads/writes through these helpers.
|
|
5498
|
+
*
|
|
5499
|
+
* ## No bare-key fallback — deliberate
|
|
5500
|
+
*
|
|
5501
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
5502
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
5503
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
5504
|
+
* the store is invisible to every node, hub included, so one node's
|
|
5505
|
+
* selection can never leak onto another. (This generalizes the
|
|
5506
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
5507
|
+
* arbitrary set of per-node field keys.)
|
|
5508
|
+
*
|
|
5509
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
5510
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
5511
|
+
*/
|
|
5512
|
+
/**
|
|
5513
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
5514
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
5515
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
5516
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
5517
|
+
*/
|
|
5518
|
+
function normalizeNodeId(raw) {
|
|
5519
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
5520
|
+
const slashIdx = raw.indexOf("/");
|
|
5521
|
+
if (slashIdx < 0) return raw;
|
|
5522
|
+
const bare = raw.slice(0, slashIdx);
|
|
5523
|
+
return bare === "" ? "hub" : bare;
|
|
5524
|
+
}
|
|
5525
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
5526
|
+
function nodeScopedKey(base, nodeId) {
|
|
5527
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
5528
|
+
}
|
|
5529
|
+
/**
|
|
5530
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
5531
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
5532
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
5533
|
+
* schema `default` win on `undefined`.
|
|
5534
|
+
*/
|
|
5535
|
+
function readNodeValue(store, base, nodeId) {
|
|
5536
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
5537
|
+
}
|
|
5538
|
+
/**
|
|
5539
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
5540
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
5541
|
+
* the write path so a save for one node never clobbers another node's value
|
|
5542
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
5543
|
+
* patch is not mutated.
|
|
5544
|
+
*/
|
|
5545
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
5546
|
+
const out = {};
|
|
5547
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
5548
|
+
return out;
|
|
5549
|
+
}
|
|
5550
|
+
/**
|
|
5551
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
5552
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
5553
|
+
* values:
|
|
5554
|
+
*
|
|
5555
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
5556
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
5557
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
5558
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
5559
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
5560
|
+
* left ABSENT so the field's schema `default` wins.
|
|
5561
|
+
*
|
|
5562
|
+
* Returns a new object — the input store is not mutated.
|
|
5563
|
+
*/
|
|
5564
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
5565
|
+
const out = {};
|
|
5566
|
+
for (const [key, value] of Object.entries(store)) {
|
|
5567
|
+
if (key.includes("@")) continue;
|
|
5568
|
+
if (perNodeKeys.has(key)) continue;
|
|
5569
|
+
out[key] = value;
|
|
5570
|
+
}
|
|
5571
|
+
for (const base of perNodeKeys) {
|
|
5572
|
+
const value = readNodeValue(store, base, nodeId);
|
|
5573
|
+
if (value !== void 0) out[base] = value;
|
|
5574
|
+
}
|
|
5575
|
+
return out;
|
|
5576
|
+
}
|
|
5577
|
+
/**
|
|
5484
5578
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5485
5579
|
*
|
|
5486
5580
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -5648,23 +5742,63 @@ var BaseAddon = class {
|
|
|
5648
5742
|
deviceSettingsSchema() {
|
|
5649
5743
|
return null;
|
|
5650
5744
|
}
|
|
5651
|
-
async getGlobalSettings(overlay, cap,
|
|
5745
|
+
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5652
5746
|
const schema = this.globalSettingsSchema(cap);
|
|
5653
5747
|
if (!schema) return { sections: [] };
|
|
5654
|
-
const
|
|
5748
|
+
const projected = await this.resolveGlobalStore(nodeId, cap);
|
|
5655
5749
|
return hydrateSchema(schema, overlay ? {
|
|
5656
|
-
...
|
|
5750
|
+
...projected,
|
|
5657
5751
|
...overlay
|
|
5658
|
-
} :
|
|
5752
|
+
} : projected);
|
|
5659
5753
|
}
|
|
5660
|
-
|
|
5661
|
-
|
|
5754
|
+
/**
|
|
5755
|
+
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5756
|
+
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5757
|
+
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
5758
|
+
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
5759
|
+
* A no-op passthrough when the schema declares no `perNode` field.
|
|
5760
|
+
*
|
|
5761
|
+
* This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
|
|
5762
|
+
* the store for custom option logic (option narrowing, value snapping) to
|
|
5763
|
+
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
5764
|
+
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
5765
|
+
*/
|
|
5766
|
+
async resolveGlobalStore(nodeId, cap) {
|
|
5767
|
+
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
5768
|
+
const keys = this.perNodeKeys(cap);
|
|
5769
|
+
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5770
|
+
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
5771
|
+
}
|
|
5772
|
+
async updateGlobalSettings(patch, nodeId) {
|
|
5773
|
+
const keys = this.perNodeKeys();
|
|
5774
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5775
|
+
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5776
|
+
const barePatch = patch;
|
|
5777
|
+
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
5778
|
+
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
5779
|
+
if (target !== localNode) return;
|
|
5662
5780
|
await this.resolveConfig();
|
|
5663
5781
|
await this.onConfigChanged();
|
|
5664
5782
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
5665
5783
|
this.maybeAutoRestart(patch, this.globalSettingsSchema());
|
|
5666
5784
|
}
|
|
5667
5785
|
/**
|
|
5786
|
+
* The set of field keys the global settings schema declares `perNode: true`
|
|
5787
|
+
* — derived once per `cap` argument and memoized (schemas are static
|
|
5788
|
+
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
5789
|
+
* settings API behaves exactly like the legacy node-agnostic one.
|
|
5790
|
+
*/
|
|
5791
|
+
_perNodeKeysCache = /* @__PURE__ */ new Map();
|
|
5792
|
+
perNodeKeys(cap) {
|
|
5793
|
+
const cacheKey = cap ?? "";
|
|
5794
|
+
const cached = this._perNodeKeysCache.get(cacheKey);
|
|
5795
|
+
if (cached) return cached;
|
|
5796
|
+
const schema = this.globalSettingsSchema(cap);
|
|
5797
|
+
const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
5798
|
+
this._perNodeKeysCache.set(cacheKey, keys);
|
|
5799
|
+
return keys;
|
|
5800
|
+
}
|
|
5801
|
+
/**
|
|
5668
5802
|
* If any field in `patch` is marked `requiresRestart` in `schema`,
|
|
5669
5803
|
* schedule an addon restart for the next tick. Deferred via
|
|
5670
5804
|
* `setImmediate` so the tRPC mutation that triggered the write has
|
|
@@ -5817,12 +5951,19 @@ var BaseAddon = class {
|
|
|
5817
5951
|
* The merge is shallow: each key in `defaults` is checked against the store.
|
|
5818
5952
|
* Only keys present in defaults are read — the store can contain extra keys
|
|
5819
5953
|
* (e.g. from older versions) without polluting the typed config.
|
|
5954
|
+
*
|
|
5955
|
+
* Keys the global settings schema declares `perNode: true` resolve from
|
|
5956
|
+
* THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
|
|
5957
|
+
* from the bare key — so a per-node field resolves to this node's own
|
|
5958
|
+
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
5820
5959
|
*/
|
|
5821
5960
|
async resolveConfig() {
|
|
5822
5961
|
const stored = await this.readAddonStoreWithRetry();
|
|
5962
|
+
const perNode = this.perNodeKeys();
|
|
5963
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5823
5964
|
const resolved = { ...this.defaults };
|
|
5824
5965
|
for (const key of Object.keys(this.defaults)) {
|
|
5825
|
-
const storedValue = stored[key];
|
|
5966
|
+
const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
|
|
5826
5967
|
if (storedValue !== void 0 && storedValue !== null) {
|
|
5827
5968
|
const defaultType = typeof this.defaults[key];
|
|
5828
5969
|
if (typeof storedValue === defaultType) resolved[key] = storedValue;
|
|
@@ -5906,6 +6047,27 @@ var BaseAddon = class {
|
|
|
5906
6047
|
}
|
|
5907
6048
|
};
|
|
5908
6049
|
/**
|
|
6050
|
+
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
6051
|
+
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
6052
|
+
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6053
|
+
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6054
|
+
*/
|
|
6055
|
+
function collectPerNodeFieldKeys(fields) {
|
|
6056
|
+
const collected = [];
|
|
6057
|
+
for (const field of fields) {
|
|
6058
|
+
if (field.type === "group") {
|
|
6059
|
+
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
6060
|
+
continue;
|
|
6061
|
+
}
|
|
6062
|
+
if (field.type === "sub-tabs") {
|
|
6063
|
+
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
6064
|
+
continue;
|
|
6065
|
+
}
|
|
6066
|
+
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
6067
|
+
}
|
|
6068
|
+
return collected;
|
|
6069
|
+
}
|
|
6070
|
+
/**
|
|
5909
6071
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
5910
6072
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
5911
6073
|
* envelopes pass through; void stays void.
|
|
@@ -5930,6 +6092,7 @@ var CamStreamKindSchema = _enum([
|
|
|
5930
6092
|
"pull-rtsp",
|
|
5931
6093
|
"pull-rtmp",
|
|
5932
6094
|
"pull-http",
|
|
6095
|
+
"pull-flv",
|
|
5933
6096
|
"pull-rfc4571",
|
|
5934
6097
|
"push-annexb",
|
|
5935
6098
|
"derived"
|
|
@@ -6312,6 +6475,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
6312
6475
|
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
6313
6476
|
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
6314
6477
|
DeviceType["Image"] = "image";
|
|
6478
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
6479
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
6480
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
6481
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
6482
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
6483
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
6484
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
6315
6485
|
return DeviceType;
|
|
6316
6486
|
}({});
|
|
6317
6487
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -7073,7 +7243,21 @@ var StorageLocationDeclarationSchema = object({
|
|
|
7073
7243
|
* slots (e.g. `recordingsLow` → `recordings`) so operators only need to
|
|
7074
7244
|
* configure the primary location.
|
|
7075
7245
|
*/
|
|
7076
|
-
defaultsTo: string().optional()
|
|
7246
|
+
defaultsTo: string().optional(),
|
|
7247
|
+
/**
|
|
7248
|
+
* Which node root the seeded `<id>:default` instance is placed under on a
|
|
7249
|
+
* FRESH install:
|
|
7250
|
+
* - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
|
|
7251
|
+
* the appData volume. Right for small/durable data (backups, logs, models).
|
|
7252
|
+
* - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
|
|
7253
|
+
* env is set, else falls back to the data root. Right for bulky, hot media
|
|
7254
|
+
* (recordings, event media) that should stay off the appData disk.
|
|
7255
|
+
*
|
|
7256
|
+
* Only affects the seeded default's `basePath`; operators can repoint any
|
|
7257
|
+
* location afterwards, and a `defaultsTo` slot inherits its parent's root
|
|
7258
|
+
* regardless of this field. Absent (the common case) is treated as `'data'`.
|
|
7259
|
+
*/
|
|
7260
|
+
defaultRoot: _enum(["data", "media"]).optional()
|
|
7077
7261
|
});
|
|
7078
7262
|
var DecoderStatsSchema = object({
|
|
7079
7263
|
inputFps: number(),
|
|
@@ -7446,6 +7630,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7446
7630
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7447
7631
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7448
7632
|
/**
|
|
7633
|
+
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7634
|
+
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7635
|
+
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
7636
|
+
*/
|
|
7637
|
+
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
7638
|
+
* the failure is anchored to a character (author-facing inline feedback). */
|
|
7639
|
+
var ExpressionParseError = class extends Error {
|
|
7640
|
+
position;
|
|
7641
|
+
constructor(message, position) {
|
|
7642
|
+
super(message);
|
|
7643
|
+
this.name = "ExpressionParseError";
|
|
7644
|
+
this.position = position;
|
|
7645
|
+
}
|
|
7646
|
+
};
|
|
7647
|
+
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
7648
|
+
* result, unknown builtin, step-budget exceeded). */
|
|
7649
|
+
var ExpressionEvalError = class extends Error {
|
|
7650
|
+
constructor(message) {
|
|
7651
|
+
super(message);
|
|
7652
|
+
this.name = "ExpressionEvalError";
|
|
7653
|
+
}
|
|
7654
|
+
};
|
|
7655
|
+
/**
|
|
7656
|
+
* Resource-bound constants for the safe expression engine.
|
|
7657
|
+
*
|
|
7658
|
+
* Every bound is defense-in-depth: the grammar is non-Turing-complete (no
|
|
7659
|
+
* loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
|
|
7660
|
+
* O(nodeCount) by construction. These caps merely put a hard ceiling on the
|
|
7661
|
+
* work a single author-supplied expression can request, so a hostile or
|
|
7662
|
+
* accidental pathological string can never spend unbounded CPU/memory.
|
|
7663
|
+
*/
|
|
7664
|
+
/** Max source length (chars) — checked BEFORE tokenizing so a huge string is
|
|
7665
|
+
* rejected without allocation. */
|
|
7666
|
+
var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
|
|
7667
|
+
/** A legal binding / identifier name. */
|
|
7668
|
+
var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7669
|
+
/** Binding names an author may NOT use: `now` is auto-injected; the literal
|
|
7670
|
+
* keywords lex as values, not identifiers, so binding to them is meaningless. */
|
|
7671
|
+
var RESERVED_BINDING_NAMES = new Set([
|
|
7672
|
+
"now",
|
|
7673
|
+
"true",
|
|
7674
|
+
"false",
|
|
7675
|
+
"null"
|
|
7676
|
+
]);
|
|
7677
|
+
/**
|
|
7678
|
+
* Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
|
|
7679
|
+
* zero-dependency. The grammar is deliberately boring: decimal numbers,
|
|
7680
|
+
* single/double-quoted strings with a tiny escape set, identifiers, the three
|
|
7681
|
+
* value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
|
|
7682
|
+
* outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
|
|
7683
|
+
* is a parse error with a source position, so member access / assignment /
|
|
7684
|
+
* template literals are lexically impossible.
|
|
7685
|
+
*/
|
|
7686
|
+
var KEYWORDS = new Set([
|
|
7687
|
+
"true",
|
|
7688
|
+
"false",
|
|
7689
|
+
"null"
|
|
7690
|
+
]);
|
|
7691
|
+
function isDigit(ch) {
|
|
7692
|
+
return ch >= "0" && ch <= "9";
|
|
7693
|
+
}
|
|
7694
|
+
function isIdentStart(ch) {
|
|
7695
|
+
return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
|
|
7696
|
+
}
|
|
7697
|
+
function isIdentPart(ch) {
|
|
7698
|
+
return isIdentStart(ch) || isDigit(ch);
|
|
7699
|
+
}
|
|
7700
|
+
function isWhitespace(ch) {
|
|
7701
|
+
return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
|
|
7702
|
+
}
|
|
7703
|
+
/** Tokenize `source` into a flat token list ending with a single `eof` token.
|
|
7704
|
+
* Throws `ExpressionParseError` on any illegal character or unterminated
|
|
7705
|
+
* string. */
|
|
7706
|
+
function tokenize(source) {
|
|
7707
|
+
if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
|
|
7708
|
+
const tokens = [];
|
|
7709
|
+
let i = 0;
|
|
7710
|
+
const n = source.length;
|
|
7711
|
+
while (i < n) {
|
|
7712
|
+
const ch = source[i];
|
|
7713
|
+
if (isWhitespace(ch)) {
|
|
7714
|
+
i += 1;
|
|
7715
|
+
continue;
|
|
7716
|
+
}
|
|
7717
|
+
if (isDigit(ch)) {
|
|
7718
|
+
const start = i;
|
|
7719
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7720
|
+
if (i < n && source[i] === ".") {
|
|
7721
|
+
if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
|
|
7722
|
+
i += 1;
|
|
7723
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7724
|
+
}
|
|
7725
|
+
const text = source.slice(start, i);
|
|
7726
|
+
const value = Number(text);
|
|
7727
|
+
if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
|
|
7728
|
+
tokens.push({
|
|
7729
|
+
type: "number",
|
|
7730
|
+
value,
|
|
7731
|
+
pos: start
|
|
7732
|
+
});
|
|
7733
|
+
continue;
|
|
7734
|
+
}
|
|
7735
|
+
if (ch === "'" || ch === "\"") {
|
|
7736
|
+
const quote = ch;
|
|
7737
|
+
const start = i;
|
|
7738
|
+
i += 1;
|
|
7739
|
+
let out = "";
|
|
7740
|
+
let closed = false;
|
|
7741
|
+
while (i < n) {
|
|
7742
|
+
const c = source[i];
|
|
7743
|
+
if (c === "\\") {
|
|
7744
|
+
const next = i + 1 < n ? source[i + 1] : "";
|
|
7745
|
+
if (next === "\\" || next === "'" || next === "\"") {
|
|
7746
|
+
out += next;
|
|
7747
|
+
i += 2;
|
|
7748
|
+
continue;
|
|
7749
|
+
}
|
|
7750
|
+
throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
|
|
7751
|
+
}
|
|
7752
|
+
if (c === quote) {
|
|
7753
|
+
closed = true;
|
|
7754
|
+
i += 1;
|
|
7755
|
+
break;
|
|
7756
|
+
}
|
|
7757
|
+
out += c;
|
|
7758
|
+
i += 1;
|
|
7759
|
+
}
|
|
7760
|
+
if (!closed) throw new ExpressionParseError("unterminated string literal", start);
|
|
7761
|
+
tokens.push({
|
|
7762
|
+
type: "string",
|
|
7763
|
+
value: out,
|
|
7764
|
+
pos: start
|
|
7765
|
+
});
|
|
7766
|
+
continue;
|
|
7767
|
+
}
|
|
7768
|
+
if (isIdentStart(ch)) {
|
|
7769
|
+
const start = i;
|
|
7770
|
+
while (i < n && isIdentPart(source[i])) i += 1;
|
|
7771
|
+
const text = source.slice(start, i);
|
|
7772
|
+
if (KEYWORDS.has(text)) tokens.push({
|
|
7773
|
+
type: "keyword",
|
|
7774
|
+
keyword: keywordOf(text),
|
|
7775
|
+
pos: start
|
|
7776
|
+
});
|
|
7777
|
+
else tokens.push({
|
|
7778
|
+
type: "identifier",
|
|
7779
|
+
name: text,
|
|
7780
|
+
pos: start
|
|
7781
|
+
});
|
|
7782
|
+
continue;
|
|
7783
|
+
}
|
|
7784
|
+
const two = i + 1 < n ? source.slice(i, i + 2) : "";
|
|
7785
|
+
if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
|
|
7786
|
+
tokens.push({
|
|
7787
|
+
type: "punct",
|
|
7788
|
+
punct: two,
|
|
7789
|
+
pos: i
|
|
7790
|
+
});
|
|
7791
|
+
i += 2;
|
|
7792
|
+
continue;
|
|
7793
|
+
}
|
|
7794
|
+
if (isSinglePunct(ch)) {
|
|
7795
|
+
tokens.push({
|
|
7796
|
+
type: "punct",
|
|
7797
|
+
punct: ch,
|
|
7798
|
+
pos: i
|
|
7799
|
+
});
|
|
7800
|
+
i += 1;
|
|
7801
|
+
continue;
|
|
7802
|
+
}
|
|
7803
|
+
throw new ExpressionParseError(`unexpected character '${ch}'`, i);
|
|
7804
|
+
}
|
|
7805
|
+
tokens.push({
|
|
7806
|
+
type: "eof",
|
|
7807
|
+
pos: n
|
|
7808
|
+
});
|
|
7809
|
+
return tokens;
|
|
7810
|
+
}
|
|
7811
|
+
function keywordOf(text) {
|
|
7812
|
+
if (text === "true") return "true";
|
|
7813
|
+
if (text === "false") return "false";
|
|
7814
|
+
return "null";
|
|
7815
|
+
}
|
|
7816
|
+
function isSinglePunct(ch) {
|
|
7817
|
+
return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
|
|
7818
|
+
}
|
|
7819
|
+
/**
|
|
7820
|
+
* Frozen, null-prototype builtin function table for the expression engine
|
|
7821
|
+
* (spec §4 rule 4). The table is the SOLE surface of callable functions: the
|
|
7822
|
+
* parser rejects any callee not in it, and the evaluator gates each call on an
|
|
7823
|
+
* own-property check against it.
|
|
7824
|
+
*
|
|
7825
|
+
* Because the object has a NULL prototype AND is `Object.freeze`d:
|
|
7826
|
+
* - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
|
|
7827
|
+
* - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
|
|
7828
|
+
* (there is no `Object.prototype` in the chain), so those names are not
|
|
7829
|
+
* callable — they are simply "unknown function" at parse time.
|
|
7830
|
+
*
|
|
7831
|
+
* Every numeric argument is validated as a finite number and every numeric
|
|
7832
|
+
* RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
|
|
7833
|
+
* (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
|
|
7834
|
+
* closed rather than emitting a garbage value.
|
|
7835
|
+
*/
|
|
7836
|
+
function asFiniteNumber(value, name, index) {
|
|
7837
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
7838
|
+
return value;
|
|
7839
|
+
}
|
|
7840
|
+
function asString$1(value, name, index) {
|
|
7841
|
+
if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
|
|
7842
|
+
return value;
|
|
7843
|
+
}
|
|
7844
|
+
function finiteResult(value, name) {
|
|
7845
|
+
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
|
|
7846
|
+
return value;
|
|
7847
|
+
}
|
|
7848
|
+
function allFiniteNumbers(args, name) {
|
|
7849
|
+
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
7850
|
+
}
|
|
7851
|
+
var INF = Number.POSITIVE_INFINITY;
|
|
7852
|
+
var table = {
|
|
7853
|
+
min: {
|
|
7854
|
+
minArgs: 1,
|
|
7855
|
+
maxArgs: INF,
|
|
7856
|
+
apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
|
|
7857
|
+
},
|
|
7858
|
+
max: {
|
|
7859
|
+
minArgs: 1,
|
|
7860
|
+
maxArgs: INF,
|
|
7861
|
+
apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
|
|
7862
|
+
},
|
|
7863
|
+
abs: {
|
|
7864
|
+
minArgs: 1,
|
|
7865
|
+
maxArgs: 1,
|
|
7866
|
+
apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
|
|
7867
|
+
},
|
|
7868
|
+
floor: {
|
|
7869
|
+
minArgs: 1,
|
|
7870
|
+
maxArgs: 1,
|
|
7871
|
+
apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
|
|
7872
|
+
},
|
|
7873
|
+
ceil: {
|
|
7874
|
+
minArgs: 1,
|
|
7875
|
+
maxArgs: 1,
|
|
7876
|
+
apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
|
|
7877
|
+
},
|
|
7878
|
+
sqrt: {
|
|
7879
|
+
minArgs: 1,
|
|
7880
|
+
maxArgs: 1,
|
|
7881
|
+
apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
|
|
7882
|
+
},
|
|
7883
|
+
round: {
|
|
7884
|
+
minArgs: 1,
|
|
7885
|
+
maxArgs: 2,
|
|
7886
|
+
apply: (args) => {
|
|
7887
|
+
const x = asFiniteNumber(args[0], "round", 0);
|
|
7888
|
+
const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
|
|
7889
|
+
if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
|
|
7890
|
+
const factor = 10 ** digits;
|
|
7891
|
+
return finiteResult(Math.round(x * factor) / factor, "round");
|
|
7892
|
+
}
|
|
7893
|
+
},
|
|
7894
|
+
pow: {
|
|
7895
|
+
minArgs: 2,
|
|
7896
|
+
maxArgs: 2,
|
|
7897
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
|
|
7898
|
+
},
|
|
7899
|
+
clamp: {
|
|
7900
|
+
minArgs: 3,
|
|
7901
|
+
maxArgs: 3,
|
|
7902
|
+
apply: (args) => {
|
|
7903
|
+
const x = asFiniteNumber(args[0], "clamp", 0);
|
|
7904
|
+
const lo = asFiniteNumber(args[1], "clamp", 1);
|
|
7905
|
+
const hi = asFiniteNumber(args[2], "clamp", 2);
|
|
7906
|
+
if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
|
|
7907
|
+
return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
|
|
7908
|
+
}
|
|
7909
|
+
},
|
|
7910
|
+
avg: {
|
|
7911
|
+
minArgs: 1,
|
|
7912
|
+
maxArgs: INF,
|
|
7913
|
+
apply: (args) => {
|
|
7914
|
+
const nums = allFiniteNumbers(args, "avg");
|
|
7915
|
+
return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
|
|
7916
|
+
}
|
|
7917
|
+
},
|
|
7918
|
+
sum: {
|
|
7919
|
+
minArgs: 1,
|
|
7920
|
+
maxArgs: INF,
|
|
7921
|
+
apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
|
|
7922
|
+
},
|
|
7923
|
+
coalesce: {
|
|
7924
|
+
minArgs: 1,
|
|
7925
|
+
maxArgs: INF,
|
|
7926
|
+
apply: (args) => {
|
|
7927
|
+
for (const a of args) if (a !== null) return a;
|
|
7928
|
+
return null;
|
|
7929
|
+
}
|
|
7930
|
+
},
|
|
7931
|
+
age: {
|
|
7932
|
+
minArgs: 2,
|
|
7933
|
+
maxArgs: 2,
|
|
7934
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
|
|
7935
|
+
},
|
|
7936
|
+
convert: {
|
|
7937
|
+
minArgs: 3,
|
|
7938
|
+
maxArgs: 3,
|
|
7939
|
+
apply: (args, hooks) => {
|
|
7940
|
+
const x = asFiniteNumber(args[0], "convert", 0);
|
|
7941
|
+
const from = asString$1(args[1], "convert", 1).trim();
|
|
7942
|
+
const to = asString$1(args[2], "convert", 2).trim();
|
|
7943
|
+
if (hooks.convert) {
|
|
7944
|
+
const out = hooks.convert(x, from, to);
|
|
7945
|
+
if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
|
|
7946
|
+
return finiteResult(out, "convert");
|
|
7947
|
+
}
|
|
7948
|
+
if (from === to) return x;
|
|
7949
|
+
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
7950
|
+
}
|
|
7951
|
+
}
|
|
7952
|
+
};
|
|
7953
|
+
Object.freeze(Object.assign(Object.create(null), table));
|
|
7954
|
+
/** The set of valid builtin names — used by the parser to reject unknown
|
|
7955
|
+
* callees at parse time (immediate author feedback). */
|
|
7956
|
+
var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
|
|
7957
|
+
/**
|
|
7958
|
+
* Pratt (precedence-climbing) parser for the safe expression mini-language.
|
|
7959
|
+
*
|
|
7960
|
+
* Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
|
|
7961
|
+
* → relational → additive → multiplicative → unary `! -` → call / primary.
|
|
7962
|
+
* Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
|
|
7963
|
+
* string validated against the builtin table at parse time, so an unknown
|
|
7964
|
+
* function is rejected immediately (author feedback) and a persisted expression
|
|
7965
|
+
* that references a since-removed builtin degrades at read.
|
|
7966
|
+
*
|
|
7967
|
+
* A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
|
|
7968
|
+
* arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
|
|
7969
|
+
*/
|
|
7970
|
+
/** Binary/logical operator precedence (higher binds tighter). */
|
|
7971
|
+
var BINARY_PRECEDENCE = {
|
|
7972
|
+
"||": 1,
|
|
7973
|
+
"&&": 2,
|
|
7974
|
+
"==": 3,
|
|
7975
|
+
"!=": 3,
|
|
7976
|
+
"<": 4,
|
|
7977
|
+
"<=": 4,
|
|
7978
|
+
">": 4,
|
|
7979
|
+
">=": 4,
|
|
7980
|
+
"+": 5,
|
|
7981
|
+
"-": 5,
|
|
7982
|
+
"*": 6,
|
|
7983
|
+
"/": 6,
|
|
7984
|
+
"%": 6
|
|
7985
|
+
};
|
|
7986
|
+
function isLogicalOp(op) {
|
|
7987
|
+
return op === "&&" || op === "||";
|
|
7988
|
+
}
|
|
7989
|
+
function isBinaryOp(op) {
|
|
7990
|
+
return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
|
|
7991
|
+
}
|
|
7992
|
+
var Parser = class {
|
|
7993
|
+
tokens;
|
|
7994
|
+
pos = 0;
|
|
7995
|
+
nodeCount = 0;
|
|
7996
|
+
identifiers = /* @__PURE__ */ new Set();
|
|
7997
|
+
callees = /* @__PURE__ */ new Set();
|
|
7998
|
+
constructor(tokens) {
|
|
7999
|
+
this.tokens = tokens;
|
|
8000
|
+
}
|
|
8001
|
+
parse() {
|
|
8002
|
+
const ast = this.parseTernary();
|
|
8003
|
+
const tok = this.peek();
|
|
8004
|
+
if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
|
|
8005
|
+
return {
|
|
8006
|
+
ast,
|
|
8007
|
+
identifiers: this.identifiers,
|
|
8008
|
+
callees: this.callees,
|
|
8009
|
+
nodeCount: this.nodeCount
|
|
8010
|
+
};
|
|
8011
|
+
}
|
|
8012
|
+
peek() {
|
|
8013
|
+
return this.tokens[this.pos];
|
|
8014
|
+
}
|
|
8015
|
+
next() {
|
|
8016
|
+
return this.tokens[this.pos++];
|
|
8017
|
+
}
|
|
8018
|
+
/** Consume a punctuator token, erroring if the next token isn't it. */
|
|
8019
|
+
expectPunct(punct) {
|
|
8020
|
+
const tok = this.peek();
|
|
8021
|
+
if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
|
|
8022
|
+
this.pos += 1;
|
|
8023
|
+
}
|
|
8024
|
+
matchPunct(punct) {
|
|
8025
|
+
const tok = this.peek();
|
|
8026
|
+
if (tok.type === "punct" && tok.punct === punct) {
|
|
8027
|
+
this.pos += 1;
|
|
8028
|
+
return true;
|
|
8029
|
+
}
|
|
8030
|
+
return false;
|
|
8031
|
+
}
|
|
8032
|
+
countNode() {
|
|
8033
|
+
this.nodeCount += 1;
|
|
8034
|
+
if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
|
|
8035
|
+
}
|
|
8036
|
+
parseTernary() {
|
|
8037
|
+
const test = this.parseBinary(1);
|
|
8038
|
+
if (this.matchPunct("?")) {
|
|
8039
|
+
const consequent = this.parseTernary();
|
|
8040
|
+
this.expectPunct(":");
|
|
8041
|
+
const alternate = this.parseTernary();
|
|
8042
|
+
this.countNode();
|
|
8043
|
+
return {
|
|
8044
|
+
kind: "conditional",
|
|
8045
|
+
test,
|
|
8046
|
+
consequent,
|
|
8047
|
+
alternate
|
|
8048
|
+
};
|
|
8049
|
+
}
|
|
8050
|
+
return test;
|
|
8051
|
+
}
|
|
8052
|
+
parseBinary(minPrec) {
|
|
8053
|
+
let left = this.parseUnary();
|
|
8054
|
+
for (;;) {
|
|
8055
|
+
const tok = this.peek();
|
|
8056
|
+
if (tok.type !== "punct") break;
|
|
8057
|
+
const prec = BINARY_PRECEDENCE[tok.punct];
|
|
8058
|
+
if (prec === void 0 || prec < minPrec) break;
|
|
8059
|
+
const op = tok.punct;
|
|
8060
|
+
this.pos += 1;
|
|
8061
|
+
const right = this.parseBinary(prec + 1);
|
|
8062
|
+
this.countNode();
|
|
8063
|
+
if (isLogicalOp(op)) left = {
|
|
8064
|
+
kind: "logical",
|
|
8065
|
+
op,
|
|
8066
|
+
left,
|
|
8067
|
+
right
|
|
8068
|
+
};
|
|
8069
|
+
else if (isBinaryOp(op)) left = {
|
|
8070
|
+
kind: "binary",
|
|
8071
|
+
op,
|
|
8072
|
+
left,
|
|
8073
|
+
right
|
|
8074
|
+
};
|
|
8075
|
+
else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
|
|
8076
|
+
}
|
|
8077
|
+
return left;
|
|
8078
|
+
}
|
|
8079
|
+
parseUnary() {
|
|
8080
|
+
const tok = this.peek();
|
|
8081
|
+
if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
|
|
8082
|
+
const op = tok.punct;
|
|
8083
|
+
this.pos += 1;
|
|
8084
|
+
const operand = this.parseUnary();
|
|
8085
|
+
this.countNode();
|
|
8086
|
+
return {
|
|
8087
|
+
kind: "unary",
|
|
8088
|
+
op,
|
|
8089
|
+
operand
|
|
8090
|
+
};
|
|
8091
|
+
}
|
|
8092
|
+
return this.parsePrimary();
|
|
8093
|
+
}
|
|
8094
|
+
parsePrimary() {
|
|
8095
|
+
const tok = this.next();
|
|
8096
|
+
switch (tok.type) {
|
|
8097
|
+
case "number":
|
|
8098
|
+
this.countNode();
|
|
8099
|
+
return {
|
|
8100
|
+
kind: "literal",
|
|
8101
|
+
value: tok.value
|
|
8102
|
+
};
|
|
8103
|
+
case "string":
|
|
8104
|
+
this.countNode();
|
|
8105
|
+
return {
|
|
8106
|
+
kind: "literal",
|
|
8107
|
+
value: tok.value
|
|
8108
|
+
};
|
|
8109
|
+
case "keyword":
|
|
8110
|
+
this.countNode();
|
|
8111
|
+
return {
|
|
8112
|
+
kind: "literal",
|
|
8113
|
+
value: tok.keyword === "null" ? null : tok.keyword === "true"
|
|
8114
|
+
};
|
|
8115
|
+
case "identifier": {
|
|
8116
|
+
const nextTok = this.peek();
|
|
8117
|
+
if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
|
|
8118
|
+
this.identifiers.add(tok.name);
|
|
8119
|
+
this.countNode();
|
|
8120
|
+
return {
|
|
8121
|
+
kind: "identifier",
|
|
8122
|
+
name: tok.name
|
|
8123
|
+
};
|
|
8124
|
+
}
|
|
8125
|
+
case "punct":
|
|
8126
|
+
if (tok.punct === "(") {
|
|
8127
|
+
const inner = this.parseTernary();
|
|
8128
|
+
this.expectPunct(")");
|
|
8129
|
+
return inner;
|
|
8130
|
+
}
|
|
8131
|
+
throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
|
|
8132
|
+
case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
|
|
8133
|
+
}
|
|
8134
|
+
}
|
|
8135
|
+
parseCall(callee, pos) {
|
|
8136
|
+
if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
|
|
8137
|
+
this.expectPunct("(");
|
|
8138
|
+
const args = [];
|
|
8139
|
+
if (!this.matchPunct(")")) for (;;) {
|
|
8140
|
+
args.push(this.parseTernary());
|
|
8141
|
+
if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
|
|
8142
|
+
if (this.matchPunct(",")) continue;
|
|
8143
|
+
this.expectPunct(")");
|
|
8144
|
+
break;
|
|
8145
|
+
}
|
|
8146
|
+
this.callees.add(callee);
|
|
8147
|
+
this.countNode();
|
|
8148
|
+
return {
|
|
8149
|
+
kind: "call",
|
|
8150
|
+
callee,
|
|
8151
|
+
args
|
|
8152
|
+
};
|
|
8153
|
+
}
|
|
8154
|
+
};
|
|
8155
|
+
/** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
|
|
8156
|
+
* `ExpressionParseError` on any lexical or grammatical failure. */
|
|
8157
|
+
function parseExpression(source) {
|
|
8158
|
+
return new Parser(tokenize(source)).parse();
|
|
8159
|
+
}
|
|
8160
|
+
Object.freeze({});
|
|
8161
|
+
/**
|
|
8162
|
+
* LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
|
|
8163
|
+
* by expr"). The cache stores BOTH successes and failures (negative caching),
|
|
8164
|
+
* so a corrupt persisted string costs exactly one tokenize+parse total — not
|
|
8165
|
+
* one per read on a hot resolve path.
|
|
8166
|
+
*
|
|
8167
|
+
* The cache is a module-level singleton: entries are pure, content-addressed
|
|
8168
|
+
* ASTs keyed by the raw source string, so sharing one instance across all
|
|
8169
|
+
* callers is safe and maximises hit rate.
|
|
8170
|
+
*/
|
|
8171
|
+
var cache = /* @__PURE__ */ new Map();
|
|
8172
|
+
function getCached(source) {
|
|
8173
|
+
const hit = cache.get(source);
|
|
8174
|
+
if (hit !== void 0) {
|
|
8175
|
+
cache.delete(source);
|
|
8176
|
+
cache.set(source, hit);
|
|
8177
|
+
return hit;
|
|
8178
|
+
}
|
|
8179
|
+
let result;
|
|
8180
|
+
try {
|
|
8181
|
+
result = {
|
|
8182
|
+
ok: true,
|
|
8183
|
+
parsed: parseExpression(source)
|
|
8184
|
+
};
|
|
8185
|
+
} catch (err) {
|
|
8186
|
+
result = {
|
|
8187
|
+
ok: false,
|
|
8188
|
+
error: err instanceof ExpressionParseError ? err.message : String(err)
|
|
8189
|
+
};
|
|
8190
|
+
}
|
|
8191
|
+
cache.set(source, result);
|
|
8192
|
+
if (cache.size > 256) {
|
|
8193
|
+
const oldest = cache.keys().next().value;
|
|
8194
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
8195
|
+
}
|
|
8196
|
+
return result;
|
|
8197
|
+
}
|
|
8198
|
+
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
8199
|
+
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
8200
|
+
function compileExpressionSafe(source) {
|
|
8201
|
+
return getCached(source);
|
|
8202
|
+
}
|
|
8203
|
+
/**
|
|
8204
|
+
* Author-time validation. Returns `null` when the source is valid, else a
|
|
8205
|
+
* human-readable error message. Checks: the expression compiles; binding count
|
|
8206
|
+
* is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
|
|
8207
|
+
* is not reserved (`now`/keywords) and does not shadow a builtin; and every
|
|
8208
|
+
* FREE identifier of the AST is covered by a binding or the injected `now`.
|
|
8209
|
+
*/
|
|
8210
|
+
function validateExpressionSource(src) {
|
|
8211
|
+
const names = Object.keys(src.bindings);
|
|
8212
|
+
if (names.length > 32) return `too many bindings (${names.length} > 32)`;
|
|
8213
|
+
for (const name of names) {
|
|
8214
|
+
if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
|
|
8215
|
+
if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
|
|
8216
|
+
if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
|
|
8217
|
+
}
|
|
8218
|
+
const compiled = compileExpressionSafe(src.expr);
|
|
8219
|
+
if (!compiled.ok) return compiled.error;
|
|
8220
|
+
const bound = new Set(names);
|
|
8221
|
+
for (const id of compiled.parsed.identifiers) {
|
|
8222
|
+
if (id === "now") continue;
|
|
8223
|
+
if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
|
|
8224
|
+
}
|
|
8225
|
+
return null;
|
|
8226
|
+
}
|
|
8227
|
+
/**
|
|
7449
8228
|
* Accessory device helpers — shared across drivers.
|
|
7450
8229
|
*
|
|
7451
8230
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -7920,6 +8699,10 @@ var RtspRestreamEntrySchema = object({
|
|
|
7920
8699
|
var BrokerRtspClientSchema = object({
|
|
7921
8700
|
sessionId: string(),
|
|
7922
8701
|
remoteAddr: string(),
|
|
8702
|
+
/** Client `User-Agent` (e.g. `recorder` for the recorder's RTSP pull), or
|
|
8703
|
+
* null/absent when the client sent none. Lets the UI label a consumer by
|
|
8704
|
+
* purpose. Optional so a client built against an older schema stays valid. */
|
|
8705
|
+
userAgent: string().nullish(),
|
|
7923
8706
|
playing: boolean(),
|
|
7924
8707
|
muted: boolean(),
|
|
7925
8708
|
connectedAt: number(),
|
|
@@ -9344,7 +10127,8 @@ var MotionAnalysisResultSchema = object({
|
|
|
9344
10127
|
});
|
|
9345
10128
|
method(object({
|
|
9346
10129
|
deviceId: number(),
|
|
9347
|
-
frame: FrameInputSchema
|
|
10130
|
+
frame: FrameInputSchema.optional(),
|
|
10131
|
+
frameHandle: FrameHandleSchema.optional()
|
|
9348
10132
|
}), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
|
|
9349
10133
|
deviceId: number(),
|
|
9350
10134
|
detected: boolean(),
|
|
@@ -9591,6 +10375,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
9591
10375
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
9592
10376
|
steps: array(PipelineStepInputSchema).min(1),
|
|
9593
10377
|
frame: FrameInputSchema.optional(),
|
|
10378
|
+
/**
|
|
10379
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
10380
|
+
* the decoded pixels live in. One more member of the one-of
|
|
10381
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
10382
|
+
*/
|
|
10383
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
9594
10384
|
imageBase64: string().optional(),
|
|
9595
10385
|
/**
|
|
9596
10386
|
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
@@ -9800,6 +10590,31 @@ var ReportMotionInputSchema = object({
|
|
|
9800
10590
|
regions: array(MotionRegionSchema).readonly().optional()
|
|
9801
10591
|
});
|
|
9802
10592
|
/**
|
|
10593
|
+
* Where a runner gets a camera's decoded frames (cross-node Phase 2,
|
|
10594
|
+
* restream-owner model — P2c).
|
|
10595
|
+
*
|
|
10596
|
+
* - `local-broker` (DEFAULT): today's path — subscribe to the co-located
|
|
10597
|
+
* stream-broker's shm frame plane. Every pre-P2c attach payload (no
|
|
10598
|
+
* `frameSource` key) parses to this, so the field is additive with zero
|
|
10599
|
+
* behavior change.
|
|
10600
|
+
* - `remote-restream`: the detect node is NOT the camera's source-owner.
|
|
10601
|
+
* The runner acquires the owner's COMPRESSED passthrough restream
|
|
10602
|
+
* (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
|
|
10603
|
+
* double-pull guard) and decodes LOCALLY via a satellite frame plane +
|
|
10604
|
+
* pull-mode decoder session pinned to its own node. The shm ring stays
|
|
10605
|
+
* node-local; only H.264/H.265 packets cross the wire.
|
|
10606
|
+
* `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
|
|
10607
|
+
* when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
|
|
10608
|
+
* dials for the owner's restream.
|
|
10609
|
+
*/
|
|
10610
|
+
var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
|
|
10611
|
+
kind: literal("remote-restream"),
|
|
10612
|
+
/** The camera's source-owner node (slice 1: always the hub). */
|
|
10613
|
+
ownerNodeId: string(),
|
|
10614
|
+
/** Operator override for the owner host the runner dials. */
|
|
10615
|
+
hubHostnameOverride: string().optional()
|
|
10616
|
+
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
10617
|
+
/**
|
|
9803
10618
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
9804
10619
|
* specific runner instance via `attachCamera`. Carries everything the
|
|
9805
10620
|
* runner needs to subscribe to the local broker and execute inference.
|
|
@@ -9897,7 +10712,15 @@ var RunnerCameraConfigSchema = object({
|
|
|
9897
10712
|
*/
|
|
9898
10713
|
onboardMotionDrivesAnalyzer: boolean().default(true),
|
|
9899
10714
|
occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
|
|
9900
|
-
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
|
|
10715
|
+
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
|
|
10716
|
+
/**
|
|
10717
|
+
* Where this runner gets the camera's decoded frames (P2c). Defaulted so
|
|
10718
|
+
* every existing payload behaves as `local-broker` — the pre-Phase-2 path.
|
|
10719
|
+
* Populated with `remote-restream` by the orchestrator ONLY when the
|
|
10720
|
+
* camera's detect node differs from its source-owner (P2d, gated by the
|
|
10721
|
+
* `remoteSourcingNodes` rollout setting).
|
|
10722
|
+
*/
|
|
10723
|
+
frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
|
|
9901
10724
|
});
|
|
9902
10725
|
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;
|
|
9903
10726
|
/**
|
|
@@ -10262,6 +11085,113 @@ object({
|
|
|
10262
11085
|
lastFetchedAt: number()
|
|
10263
11086
|
});
|
|
10264
11087
|
DeviceType.Sensor;
|
|
11088
|
+
/**
|
|
11089
|
+
* Feeder connectivity / power status — mirrors the HA petkit device-status
|
|
11090
|
+
* enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
|
|
11091
|
+
* `on_batteries` (running on battery backup). `null` until first reported.
|
|
11092
|
+
*/
|
|
11093
|
+
var PetFeederDeviceStatusSchema = _enum([
|
|
11094
|
+
"normal",
|
|
11095
|
+
"offline",
|
|
11096
|
+
"on_batteries"
|
|
11097
|
+
]);
|
|
11098
|
+
var gramsPortion = number().int().min(4).max(200);
|
|
11099
|
+
object({
|
|
11100
|
+
/** Food currently in the bowl (grams). Null when the device has not
|
|
11101
|
+
* reported a reading yet. On dual-hopper models this is the combined
|
|
11102
|
+
* bowl reading; per-hopper levels live in `food1`/`food2`. */
|
|
11103
|
+
foodLevel: number().nullable(),
|
|
11104
|
+
/** Hopper-1 food level (grams) on dual-hopper feeders; null on
|
|
11105
|
+
* single-hopper models. */
|
|
11106
|
+
food1: number().nullable(),
|
|
11107
|
+
/** Hopper-2 food level (grams) on dual-hopper feeders; null on
|
|
11108
|
+
* single-hopper models. */
|
|
11109
|
+
food2: number().nullable(),
|
|
11110
|
+
/** Derived low-food flag — mirrors the HA `food_level` binary_sensor
|
|
11111
|
+
* (`device_class: problem`, on = low). True when the bowl is empty /
|
|
11112
|
+
* below the feeder's low threshold. */
|
|
11113
|
+
lowFood: boolean(),
|
|
11114
|
+
/** Battery charge 0..100 (%). Null on mains-powered models or when the
|
|
11115
|
+
* device has no battery reading. */
|
|
11116
|
+
batteryPower: number().min(0).max(100).nullable(),
|
|
11117
|
+
/** Days of desiccant life remaining. Null when the model has no
|
|
11118
|
+
* desiccant sensor. */
|
|
11119
|
+
desiccantLeftDays: number().nullable(),
|
|
11120
|
+
/** True while a feed is in progress. */
|
|
11121
|
+
feeding: boolean(),
|
|
11122
|
+
/** Decoded connectivity / power status (HA petkit device-status enum).
|
|
11123
|
+
* Null until the device has reported a status. */
|
|
11124
|
+
status: PetFeederDeviceStatusSchema.nullable(),
|
|
11125
|
+
/** Decoded human-readable fault message. Null (or the device's `no_error`
|
|
11126
|
+
* sentinel) means healthy; a non-null string is an active fault. Pairs
|
|
11127
|
+
* with `errorCode` for consumers that want the raw integer. */
|
|
11128
|
+
error: string().nullable(),
|
|
11129
|
+
/** Raw device error code (0 / null = no error). */
|
|
11130
|
+
errorCode: number().nullable(),
|
|
11131
|
+
/** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
|
|
11132
|
+
isDualHopper: boolean(),
|
|
11133
|
+
/** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
|
|
11134
|
+
childLock: boolean(),
|
|
11135
|
+
/** Front indicator-light setting. */
|
|
11136
|
+
indicatorLight: boolean(),
|
|
11137
|
+
/** Play a chime when dispensing. */
|
|
11138
|
+
feedSound: boolean(),
|
|
11139
|
+
/** Speaker / prompt volume level (device-scaled integer). */
|
|
11140
|
+
volume: number(),
|
|
11141
|
+
/** Ms epoch when the slice was last refreshed from the cloud. */
|
|
11142
|
+
lastFetchedAt: number()
|
|
11143
|
+
});
|
|
11144
|
+
DeviceType.PetFeeder, method(object({
|
|
11145
|
+
deviceId: number().int().nonnegative(),
|
|
11146
|
+
grams: gramsPortion.optional(),
|
|
11147
|
+
hopper1: gramsPortion.optional(),
|
|
11148
|
+
hopper2: gramsPortion.optional()
|
|
11149
|
+
}), _void(), {
|
|
11150
|
+
kind: "mutation",
|
|
11151
|
+
auth: "admin"
|
|
11152
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11153
|
+
kind: "mutation",
|
|
11154
|
+
auth: "admin"
|
|
11155
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11156
|
+
kind: "mutation",
|
|
11157
|
+
auth: "admin"
|
|
11158
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11159
|
+
kind: "mutation",
|
|
11160
|
+
auth: "admin"
|
|
11161
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11162
|
+
kind: "mutation",
|
|
11163
|
+
auth: "admin"
|
|
11164
|
+
}), method(object({
|
|
11165
|
+
deviceId: number().int().nonnegative(),
|
|
11166
|
+
soundId: number().int().nonnegative()
|
|
11167
|
+
}), _void(), {
|
|
11168
|
+
kind: "mutation",
|
|
11169
|
+
auth: "admin"
|
|
11170
|
+
}), method(object({
|
|
11171
|
+
deviceId: number().int().nonnegative(),
|
|
11172
|
+
on: boolean()
|
|
11173
|
+
}), _void(), {
|
|
11174
|
+
kind: "mutation",
|
|
11175
|
+
auth: "admin"
|
|
11176
|
+
}), method(object({
|
|
11177
|
+
deviceId: number().int().nonnegative(),
|
|
11178
|
+
on: boolean()
|
|
11179
|
+
}), _void(), {
|
|
11180
|
+
kind: "mutation",
|
|
11181
|
+
auth: "admin"
|
|
11182
|
+
}), method(object({
|
|
11183
|
+
deviceId: number().int().nonnegative(),
|
|
11184
|
+
on: boolean()
|
|
11185
|
+
}), _void(), {
|
|
11186
|
+
kind: "mutation",
|
|
11187
|
+
auth: "admin"
|
|
11188
|
+
}), method(object({
|
|
11189
|
+
deviceId: number().int().nonnegative(),
|
|
11190
|
+
level: number().int().nonnegative()
|
|
11191
|
+
}), _void(), {
|
|
11192
|
+
kind: "mutation",
|
|
11193
|
+
auth: "admin"
|
|
11194
|
+
});
|
|
10265
11195
|
object({
|
|
10266
11196
|
/** Instantaneous power draw in watts. */
|
|
10267
11197
|
watts: number().optional(),
|
|
@@ -12138,10 +13068,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
|
|
|
12138
13068
|
url: string()
|
|
12139
13069
|
}), _void()), method(object({
|
|
12140
13070
|
sessionId: string(),
|
|
12141
|
-
maxCount: number().default(1)
|
|
13071
|
+
maxCount: number().default(1),
|
|
13072
|
+
waitMs: number().optional()
|
|
12142
13073
|
}), array(DecodedFrameSchema)), method(object({
|
|
12143
13074
|
sessionId: string(),
|
|
12144
|
-
maxCount: number().default(1)
|
|
13075
|
+
maxCount: number().default(1),
|
|
13076
|
+
waitMs: number().optional()
|
|
12145
13077
|
}), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
|
|
12146
13078
|
sessionId: string(),
|
|
12147
13079
|
config: DecoderSessionConfigSchema.partial()
|
|
@@ -12428,14 +13360,63 @@ var ChildLayoutEntrySchema = object({
|
|
|
12428
13360
|
collapsed: boolean().optional()
|
|
12429
13361
|
});
|
|
12430
13362
|
/** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
|
|
12431
|
-
* `device-management.ts`.
|
|
13363
|
+
* `device-management.ts`. Source is a union: a FIELD source copies a sibling
|
|
13364
|
+
* accessory's status field (`kind` optional/absent for wire compat); a
|
|
13365
|
+
* LITERAL source carries a per-device constant (no sibling is read); a
|
|
13366
|
+
* GLOBAL source (P2e) copies ANY device's status field, addressed by the
|
|
13367
|
+
* source device's full re-sync-stable `stableId`. */
|
|
13368
|
+
var DeviceLinkFieldSourceSchema = object({
|
|
13369
|
+
kind: literal("field").optional(),
|
|
13370
|
+
sourceKey: string(),
|
|
13371
|
+
cap: string(),
|
|
13372
|
+
fieldPath: string()
|
|
13373
|
+
});
|
|
13374
|
+
var DeviceLinkLiteralSourceSchema = object({
|
|
13375
|
+
kind: literal("literal"),
|
|
13376
|
+
value: union([
|
|
13377
|
+
string(),
|
|
13378
|
+
number(),
|
|
13379
|
+
boolean(),
|
|
13380
|
+
_null()
|
|
13381
|
+
])
|
|
13382
|
+
});
|
|
13383
|
+
var DeviceLinkGlobalSourceSchema = object({
|
|
13384
|
+
kind: literal("global"),
|
|
13385
|
+
sourceStableId: string(),
|
|
13386
|
+
cap: string(),
|
|
13387
|
+
fieldPath: string()
|
|
13388
|
+
});
|
|
13389
|
+
/** Expression source (Stage X): compute the target field from N named bindings
|
|
13390
|
+
* via the safe expression engine. Bindings are field | literal | global — never
|
|
13391
|
+
* another expression (no nesting). The `superRefine` runs the SAME author-time
|
|
13392
|
+
* validation as `validateExpressionSource` (compiles the expr, checks binding
|
|
13393
|
+
* names + identifier coverage) so every wire boundary that parses a DeviceLink
|
|
13394
|
+
* (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
|
|
13395
|
+
* Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
|
|
13396
|
+
var DeviceLinkExpressionSourceSchema = object({
|
|
13397
|
+
kind: literal("expression"),
|
|
13398
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
13399
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
|
|
13400
|
+
DeviceLinkFieldSourceSchema,
|
|
13401
|
+
DeviceLinkLiteralSourceSchema,
|
|
13402
|
+
DeviceLinkGlobalSourceSchema
|
|
13403
|
+
]))
|
|
13404
|
+
}).superRefine((src, ctx) => {
|
|
13405
|
+
const err = validateExpressionSource(src);
|
|
13406
|
+
if (err !== null) ctx.addIssue({
|
|
13407
|
+
code: "custom",
|
|
13408
|
+
message: err,
|
|
13409
|
+
path: ["expr"]
|
|
13410
|
+
});
|
|
13411
|
+
});
|
|
12432
13412
|
var DeviceLinkSchema = object({
|
|
12433
13413
|
id: string(),
|
|
12434
|
-
source:
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
13414
|
+
source: union([
|
|
13415
|
+
DeviceLinkFieldSourceSchema,
|
|
13416
|
+
DeviceLinkLiteralSourceSchema,
|
|
13417
|
+
DeviceLinkGlobalSourceSchema,
|
|
13418
|
+
DeviceLinkExpressionSourceSchema
|
|
13419
|
+
]),
|
|
12439
13420
|
target: object({
|
|
12440
13421
|
cap: string(),
|
|
12441
13422
|
fieldPath: string(),
|
|
@@ -12464,6 +13445,31 @@ var DeviceLinkSchema = object({
|
|
|
12464
13445
|
})
|
|
12465
13446
|
]).optional()
|
|
12466
13447
|
});
|
|
13448
|
+
/** Cap-wire shape of a per-cap display refinement — mirrors
|
|
13449
|
+
* `DeviceCapDisplayOverride` in `device-management.ts`. */
|
|
13450
|
+
var DeviceCapDisplayOverrideSchema = object({
|
|
13451
|
+
unit: string().min(1).optional(),
|
|
13452
|
+
precision: number().int().min(0).max(10).optional()
|
|
13453
|
+
});
|
|
13454
|
+
/** Cap-wire shape of an operator-authored per-device display override —
|
|
13455
|
+
* mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
|
|
13456
|
+
* bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
|
|
13457
|
+
var DeviceDisplayOverrideSchema = object({
|
|
13458
|
+
icon: string().min(1).optional(),
|
|
13459
|
+
label: string().min(1).optional(),
|
|
13460
|
+
unit: string().min(1).optional(),
|
|
13461
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13462
|
+
hidden: boolean().optional(),
|
|
13463
|
+
perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
|
|
13464
|
+
});
|
|
13465
|
+
/** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
|
|
13466
|
+
* in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
|
|
13467
|
+
* the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
|
|
13468
|
+
var RoleDisplayDefaultSchema = object({
|
|
13469
|
+
unit: string().min(1).optional(),
|
|
13470
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13471
|
+
icon: string().min(1).optional()
|
|
13472
|
+
});
|
|
12467
13473
|
/**
|
|
12468
13474
|
* Serializable projection of a live IDevice.
|
|
12469
13475
|
* Returned by listAll, getDevice, getChildren.
|
|
@@ -12519,7 +13525,9 @@ var DeviceInfoSchema = object({
|
|
|
12519
13525
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
12520
13526
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
12521
13527
|
/** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
|
|
12522
|
-
deviceLinks: array(DeviceLinkSchema).readonly().optional()
|
|
13528
|
+
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
13529
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13530
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12523
13531
|
});
|
|
12524
13532
|
var ConfigEntrySchema = object({
|
|
12525
13533
|
key: string(),
|
|
@@ -12584,7 +13592,9 @@ var DeviceMetaSchema = object({
|
|
|
12584
13592
|
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
12585
13593
|
/** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
|
|
12586
13594
|
* Optional: only present for accessory children that carry a known role. */
|
|
12587
|
-
role: string().nullable().optional()
|
|
13595
|
+
role: string().nullable().optional(),
|
|
13596
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13597
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12588
13598
|
});
|
|
12589
13599
|
/** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
|
|
12590
13600
|
var ConfigUISchemaOutput = unknown().nullable();
|
|
@@ -12678,7 +13688,19 @@ method(object({
|
|
|
12678
13688
|
}), _void(), {
|
|
12679
13689
|
kind: "mutation",
|
|
12680
13690
|
auth: "admin"
|
|
12681
|
-
}), method(object({
|
|
13691
|
+
}), method(object({
|
|
13692
|
+
deviceId: number(),
|
|
13693
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
13694
|
+
}), _void(), {
|
|
13695
|
+
kind: "mutation",
|
|
13696
|
+
auth: "admin"
|
|
13697
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
13698
|
+
kind: "mutation",
|
|
13699
|
+
auth: "admin"
|
|
13700
|
+
}), method(object({
|
|
13701
|
+
deviceId: number(),
|
|
13702
|
+
includeSynthesizable: boolean().optional()
|
|
13703
|
+
}), object({ caps: array(object({
|
|
12682
13704
|
cap: string(),
|
|
12683
13705
|
fields: array(object({
|
|
12684
13706
|
path: string(),
|
|
@@ -12688,8 +13710,13 @@ method(object({
|
|
|
12688
13710
|
"boolean",
|
|
12689
13711
|
"enum"
|
|
12690
13712
|
]),
|
|
12691
|
-
enumValues: array(string()).optional()
|
|
12692
|
-
|
|
13713
|
+
enumValues: array(string()).optional(),
|
|
13714
|
+
item: boolean().optional()
|
|
13715
|
+
})).readonly(),
|
|
13716
|
+
itemArray: object({
|
|
13717
|
+
path: string(),
|
|
13718
|
+
keyField: string()
|
|
13719
|
+
}).optional()
|
|
12693
13720
|
})).readonly() }), { kind: "query" }), method(object({
|
|
12694
13721
|
deviceId: number(),
|
|
12695
13722
|
role: string().nullable()
|
|
@@ -12759,7 +13786,11 @@ method(object({
|
|
|
12759
13786
|
deviceId: number(),
|
|
12760
13787
|
entries: array(object({
|
|
12761
13788
|
capName: string(),
|
|
12762
|
-
kind: _enum([
|
|
13789
|
+
kind: _enum([
|
|
13790
|
+
"native",
|
|
13791
|
+
"wrapped",
|
|
13792
|
+
"linked"
|
|
13793
|
+
]),
|
|
12763
13794
|
providerAddonId: string(),
|
|
12764
13795
|
providerNodeId: string(),
|
|
12765
13796
|
nativeAddonId: string()
|
|
@@ -12768,7 +13799,11 @@ method(object({
|
|
|
12768
13799
|
deviceId: number(),
|
|
12769
13800
|
entries: array(object({
|
|
12770
13801
|
capName: string(),
|
|
12771
|
-
kind: _enum([
|
|
13802
|
+
kind: _enum([
|
|
13803
|
+
"native",
|
|
13804
|
+
"wrapped",
|
|
13805
|
+
"linked"
|
|
13806
|
+
]),
|
|
12772
13807
|
providerAddonId: string(),
|
|
12773
13808
|
providerNodeId: string(),
|
|
12774
13809
|
nativeAddonId: string()
|
|
@@ -13258,7 +14293,7 @@ var AddBrokerInputSchema = object({
|
|
|
13258
14293
|
});
|
|
13259
14294
|
var AddBrokerResultSchema = object({ id: string() });
|
|
13260
14295
|
var IdInputSchema = object({ id: string() });
|
|
13261
|
-
var TestResultSchema = discriminatedUnion("ok", [object({
|
|
14296
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
13262
14297
|
ok: literal(true),
|
|
13263
14298
|
latencyMs: number()
|
|
13264
14299
|
}), object({
|
|
@@ -13295,7 +14330,7 @@ var mqttBrokerCapability = {
|
|
|
13295
14330
|
getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
|
|
13296
14331
|
addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
|
|
13297
14332
|
removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
|
|
13298
|
-
testConnection: method(IdInputSchema, TestResultSchema, { kind: "mutation" }),
|
|
14333
|
+
testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
|
|
13299
14334
|
startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
|
|
13300
14335
|
stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
|
|
13301
14336
|
getStatus: method(_void(), StatusSchema)
|
|
@@ -13334,23 +14369,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
|
13334
14369
|
sourcePort: number().optional()
|
|
13335
14370
|
});
|
|
13336
14371
|
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
13337
|
-
|
|
13338
|
-
|
|
14372
|
+
/**
|
|
14373
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14374
|
+
*
|
|
14375
|
+
* Apprise-derived model (see
|
|
14376
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14377
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14378
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14379
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14380
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14381
|
+
*
|
|
14382
|
+
* DESIGN DECISIONS (locked):
|
|
14383
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14384
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14385
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14386
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14387
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14388
|
+
* discovery→adopt flow.
|
|
14389
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14390
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14391
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14392
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14393
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14394
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14395
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14396
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14397
|
+
* base64 fallback needed.
|
|
14398
|
+
*
|
|
14399
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14400
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14401
|
+
* admin "Integrations" page.
|
|
14402
|
+
*/
|
|
14403
|
+
/**
|
|
14404
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14405
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14406
|
+
*/
|
|
14407
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14408
|
+
"image",
|
|
14409
|
+
"video",
|
|
14410
|
+
"gif",
|
|
14411
|
+
"audio",
|
|
14412
|
+
"icon"
|
|
14413
|
+
]);
|
|
14414
|
+
/**
|
|
14415
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14416
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14417
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14418
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14419
|
+
*/
|
|
14420
|
+
var AttachmentSchema = object({
|
|
14421
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14422
|
+
url: string().optional(),
|
|
14423
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14424
|
+
mime: string().optional(),
|
|
14425
|
+
name: string().optional()
|
|
14426
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14427
|
+
var NotificationFormatSchema = _enum([
|
|
14428
|
+
"text",
|
|
14429
|
+
"markdown",
|
|
14430
|
+
"html"
|
|
14431
|
+
]);
|
|
14432
|
+
/** A single tap-through action button. */
|
|
14433
|
+
var NotificationActionSchema = object({
|
|
14434
|
+
id: string(),
|
|
14435
|
+
label: string(),
|
|
14436
|
+
url: string().optional()
|
|
14437
|
+
});
|
|
14438
|
+
/**
|
|
14439
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14440
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14441
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14442
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14443
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14444
|
+
* `priority` for that one target.
|
|
14445
|
+
*/
|
|
14446
|
+
var NotificationSchema = object({
|
|
13339
14447
|
body: string(),
|
|
13340
|
-
|
|
14448
|
+
title: string().optional(),
|
|
14449
|
+
format: NotificationFormatSchema.default("text"),
|
|
14450
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14451
|
+
level: string().optional(),
|
|
14452
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14453
|
+
clickUrl: string().optional(),
|
|
14454
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14455
|
+
sound: string().optional(),
|
|
14456
|
+
ttl: number().optional(),
|
|
14457
|
+
tag: string().optional(),
|
|
13341
14458
|
deviceId: number().optional(),
|
|
13342
14459
|
eventId: string().optional(),
|
|
13343
|
-
priority: _enum([
|
|
13344
|
-
"low",
|
|
13345
|
-
"normal",
|
|
13346
|
-
"high",
|
|
13347
|
-
"critical"
|
|
13348
|
-
]).default("normal"),
|
|
13349
14460
|
metadata: record(string(), unknown()).optional()
|
|
13350
|
-
})
|
|
14461
|
+
});
|
|
14462
|
+
/** One declared native severity/priority level for a kind. */
|
|
14463
|
+
var TargetKindLevelSchema = object({
|
|
14464
|
+
id: string(),
|
|
14465
|
+
label: string(),
|
|
14466
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14467
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14468
|
+
flags: object({
|
|
14469
|
+
critical: boolean().optional(),
|
|
14470
|
+
silent: boolean().optional(),
|
|
14471
|
+
noPush: boolean().optional()
|
|
14472
|
+
}).optional(),
|
|
14473
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14474
|
+
requires: array(string()).optional(),
|
|
14475
|
+
description: string().optional()
|
|
14476
|
+
});
|
|
14477
|
+
/** The full capability block consulted before dispatch. */
|
|
14478
|
+
var TargetKindCapsSchema = object({
|
|
14479
|
+
attachments: object({
|
|
14480
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14481
|
+
mode: _enum([
|
|
14482
|
+
"url",
|
|
14483
|
+
"bytes",
|
|
14484
|
+
"both"
|
|
14485
|
+
]),
|
|
14486
|
+
max: number().int().nonnegative(),
|
|
14487
|
+
maxBytes: number().int().positive().optional()
|
|
14488
|
+
}),
|
|
14489
|
+
/** Max action buttons (0 = none). */
|
|
14490
|
+
actions: number().int().nonnegative(),
|
|
14491
|
+
levels: array(TargetKindLevelSchema),
|
|
14492
|
+
format: array(NotificationFormatSchema),
|
|
14493
|
+
clickUrl: boolean(),
|
|
14494
|
+
sound: boolean(),
|
|
14495
|
+
ttl: boolean(),
|
|
14496
|
+
bodyMaxLen: number().int().positive()
|
|
14497
|
+
});
|
|
14498
|
+
/**
|
|
14499
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14500
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14501
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14502
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14503
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14504
|
+
*/
|
|
14505
|
+
var ConfigSchemaPassthrough = unknown();
|
|
14506
|
+
var TargetKindSchema = object({
|
|
14507
|
+
kind: string(),
|
|
14508
|
+
label: string(),
|
|
14509
|
+
icon: string(),
|
|
14510
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14511
|
+
addonId: string(),
|
|
14512
|
+
configSchema: ConfigSchemaPassthrough,
|
|
14513
|
+
supportsDiscovery: boolean(),
|
|
14514
|
+
caps: TargetKindCapsSchema
|
|
14515
|
+
});
|
|
14516
|
+
/**
|
|
14517
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14518
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14519
|
+
* round-trip a stored secret to the UI.
|
|
14520
|
+
*/
|
|
14521
|
+
var TargetSchema = object({
|
|
14522
|
+
id: string(),
|
|
14523
|
+
name: string(),
|
|
14524
|
+
kind: string(),
|
|
14525
|
+
addonId: string(),
|
|
14526
|
+
enabled: boolean(),
|
|
14527
|
+
config: record(string(), unknown())
|
|
14528
|
+
});
|
|
14529
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14530
|
+
var DiscoveredTargetSchema = object({
|
|
14531
|
+
kind: string(),
|
|
14532
|
+
suggestedName: string(),
|
|
14533
|
+
config: record(string(), unknown())
|
|
14534
|
+
});
|
|
14535
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14536
|
+
var RenderedAsSchema = object({
|
|
14537
|
+
level: string(),
|
|
14538
|
+
format: NotificationFormatSchema,
|
|
14539
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14540
|
+
actionsSent: number().int().nonnegative(),
|
|
14541
|
+
truncated: boolean(),
|
|
14542
|
+
dropped: array(string())
|
|
14543
|
+
});
|
|
14544
|
+
var SendResultSchema = object({
|
|
13351
14545
|
success: boolean(),
|
|
13352
|
-
error: string().optional()
|
|
13353
|
-
|
|
14546
|
+
error: string().optional(),
|
|
14547
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14548
|
+
});
|
|
14549
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14550
|
+
var TestResultSchema = SendResultSchema;
|
|
14551
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
14552
|
+
kind: string(),
|
|
14553
|
+
config: record(string(), unknown()).optional()
|
|
14554
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
14555
|
+
targetId: string(),
|
|
14556
|
+
notification: NotificationSchema
|
|
14557
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
14558
|
+
targetId: string(),
|
|
14559
|
+
sample: NotificationSchema.optional()
|
|
14560
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
14561
|
+
targetId: string(),
|
|
14562
|
+
enabled: boolean()
|
|
14563
|
+
}), _void(), { kind: "mutation" });
|
|
13354
14564
|
/**
|
|
13355
14565
|
* Zod schemas for persisted record types.
|
|
13356
14566
|
*
|
|
@@ -16372,7 +17582,10 @@ var HwAccelBackendInputSchema = _enum([
|
|
|
16372
17582
|
"webgpu",
|
|
16373
17583
|
"none"
|
|
16374
17584
|
]).nullable().optional();
|
|
16375
|
-
var HwAccelResolutionSchema = object({
|
|
17585
|
+
var HwAccelResolutionSchema = object({
|
|
17586
|
+
preferred: array(string()).readonly(),
|
|
17587
|
+
rationale: string()
|
|
17588
|
+
});
|
|
16376
17589
|
var HardwareEncoderIdSchema = _enum([
|
|
16377
17590
|
"h264_videotoolbox",
|
|
16378
17591
|
"hevc_videotoolbox",
|
|
@@ -16477,10 +17690,7 @@ var ResolvedInferenceConfigSchema = object({
|
|
|
16477
17690
|
format: ModelFormatSchema,
|
|
16478
17691
|
reason: string()
|
|
16479
17692
|
});
|
|
16480
|
-
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
|
|
16481
|
-
prefer: HwAccelBackendInputSchema,
|
|
16482
|
-
nodeId: string().optional()
|
|
16483
|
-
}), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
17693
|
+
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
16484
17694
|
kind: "mutation",
|
|
16485
17695
|
auth: "admin"
|
|
16486
17696
|
}), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
|
|
@@ -16539,6 +17749,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
|
|
|
16539
17749
|
kind: "mutation",
|
|
16540
17750
|
auth: "admin"
|
|
16541
17751
|
});
|
|
17752
|
+
/**
|
|
17753
|
+
* `recording` cap — footage availability + HLS playback manifests + per-device
|
|
17754
|
+
* recording config. NOTE on events (source of truth, R5/C3): this cap carries
|
|
17755
|
+
* NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
|
|
17756
|
+
* events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
|
|
17757
|
+
* rows); the recorder's internal EventMap markers are ephemeral in-RAM
|
|
17758
|
+
* annotations that are not exposed here and must not be treated as an event
|
|
17759
|
+
* feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
|
|
17760
|
+
* (`interfaces/recording-config.ts`).
|
|
17761
|
+
*/
|
|
16542
17762
|
var RecordingStatusSchema = object({
|
|
16543
17763
|
deviceId: number(),
|
|
16544
17764
|
enabled: boolean(),
|
|
@@ -18175,6 +19395,12 @@ Object.freeze({
|
|
|
18175
19395
|
addonId: null,
|
|
18176
19396
|
access: "view"
|
|
18177
19397
|
},
|
|
19398
|
+
"deviceManager.getRoleDisplayDefaults": {
|
|
19399
|
+
capName: "device-manager",
|
|
19400
|
+
capScope: "system",
|
|
19401
|
+
addonId: null,
|
|
19402
|
+
access: "view"
|
|
19403
|
+
},
|
|
18178
19404
|
"deviceManager.getSettingsSchema": {
|
|
18179
19405
|
capName: "device-manager",
|
|
18180
19406
|
capScope: "system",
|
|
@@ -18325,6 +19551,12 @@ Object.freeze({
|
|
|
18325
19551
|
addonId: null,
|
|
18326
19552
|
access: "create"
|
|
18327
19553
|
},
|
|
19554
|
+
"deviceManager.setDisplay": {
|
|
19555
|
+
capName: "device-manager",
|
|
19556
|
+
capScope: "system",
|
|
19557
|
+
addonId: null,
|
|
19558
|
+
access: "create"
|
|
19559
|
+
},
|
|
18328
19560
|
"deviceManager.setIntegrationId": {
|
|
18329
19561
|
capName: "device-manager",
|
|
18330
19562
|
capScope: "system",
|
|
@@ -18367,6 +19599,12 @@ Object.freeze({
|
|
|
18367
19599
|
addonId: null,
|
|
18368
19600
|
access: "create"
|
|
18369
19601
|
},
|
|
19602
|
+
"deviceManager.setRoleDisplayDefaults": {
|
|
19603
|
+
capName: "device-manager",
|
|
19604
|
+
capScope: "system",
|
|
19605
|
+
addonId: null,
|
|
19606
|
+
access: "create"
|
|
19607
|
+
},
|
|
18370
19608
|
"deviceManager.setStreamProfileMap": {
|
|
18371
19609
|
capName: "device-manager",
|
|
18372
19610
|
capScope: "system",
|
|
@@ -19345,13 +20583,49 @@ Object.freeze({
|
|
|
19345
20583
|
addonId: null,
|
|
19346
20584
|
access: "create"
|
|
19347
20585
|
},
|
|
20586
|
+
"notificationOutput.deleteTarget": {
|
|
20587
|
+
capName: "notification-output",
|
|
20588
|
+
capScope: "system",
|
|
20589
|
+
addonId: null,
|
|
20590
|
+
access: "delete"
|
|
20591
|
+
},
|
|
20592
|
+
"notificationOutput.discoverTargets": {
|
|
20593
|
+
capName: "notification-output",
|
|
20594
|
+
capScope: "system",
|
|
20595
|
+
addonId: null,
|
|
20596
|
+
access: "view"
|
|
20597
|
+
},
|
|
20598
|
+
"notificationOutput.listTargetKinds": {
|
|
20599
|
+
capName: "notification-output",
|
|
20600
|
+
capScope: "system",
|
|
20601
|
+
addonId: null,
|
|
20602
|
+
access: "view"
|
|
20603
|
+
},
|
|
20604
|
+
"notificationOutput.listTargets": {
|
|
20605
|
+
capName: "notification-output",
|
|
20606
|
+
capScope: "system",
|
|
20607
|
+
addonId: null,
|
|
20608
|
+
access: "view"
|
|
20609
|
+
},
|
|
19348
20610
|
"notificationOutput.send": {
|
|
19349
20611
|
capName: "notification-output",
|
|
19350
20612
|
capScope: "system",
|
|
19351
20613
|
addonId: null,
|
|
19352
20614
|
access: "create"
|
|
19353
20615
|
},
|
|
19354
|
-
"notificationOutput.
|
|
20616
|
+
"notificationOutput.setTargetEnabled": {
|
|
20617
|
+
capName: "notification-output",
|
|
20618
|
+
capScope: "system",
|
|
20619
|
+
addonId: null,
|
|
20620
|
+
access: "create"
|
|
20621
|
+
},
|
|
20622
|
+
"notificationOutput.testTarget": {
|
|
20623
|
+
capName: "notification-output",
|
|
20624
|
+
capScope: "system",
|
|
20625
|
+
addonId: null,
|
|
20626
|
+
access: "create"
|
|
20627
|
+
},
|
|
20628
|
+
"notificationOutput.upsertTarget": {
|
|
19355
20629
|
capName: "notification-output",
|
|
19356
20630
|
capScope: "system",
|
|
19357
20631
|
addonId: null,
|
|
@@ -19381,6 +20655,66 @@ Object.freeze({
|
|
|
19381
20655
|
addonId: null,
|
|
19382
20656
|
access: "create"
|
|
19383
20657
|
},
|
|
20658
|
+
"petFeeder.callPet": {
|
|
20659
|
+
capName: "pet-feeder",
|
|
20660
|
+
capScope: "device",
|
|
20661
|
+
addonId: null,
|
|
20662
|
+
access: "create"
|
|
20663
|
+
},
|
|
20664
|
+
"petFeeder.cancelFeed": {
|
|
20665
|
+
capName: "pet-feeder",
|
|
20666
|
+
capScope: "device",
|
|
20667
|
+
addonId: null,
|
|
20668
|
+
access: "create"
|
|
20669
|
+
},
|
|
20670
|
+
"petFeeder.feed": {
|
|
20671
|
+
capName: "pet-feeder",
|
|
20672
|
+
capScope: "device",
|
|
20673
|
+
addonId: null,
|
|
20674
|
+
access: "create"
|
|
20675
|
+
},
|
|
20676
|
+
"petFeeder.markFoodReplenished": {
|
|
20677
|
+
capName: "pet-feeder",
|
|
20678
|
+
capScope: "device",
|
|
20679
|
+
addonId: null,
|
|
20680
|
+
access: "create"
|
|
20681
|
+
},
|
|
20682
|
+
"petFeeder.playSound": {
|
|
20683
|
+
capName: "pet-feeder",
|
|
20684
|
+
capScope: "device",
|
|
20685
|
+
addonId: null,
|
|
20686
|
+
access: "create"
|
|
20687
|
+
},
|
|
20688
|
+
"petFeeder.resetDesiccant": {
|
|
20689
|
+
capName: "pet-feeder",
|
|
20690
|
+
capScope: "device",
|
|
20691
|
+
addonId: null,
|
|
20692
|
+
access: "delete"
|
|
20693
|
+
},
|
|
20694
|
+
"petFeeder.setChildLock": {
|
|
20695
|
+
capName: "pet-feeder",
|
|
20696
|
+
capScope: "device",
|
|
20697
|
+
addonId: null,
|
|
20698
|
+
access: "create"
|
|
20699
|
+
},
|
|
20700
|
+
"petFeeder.setFeedSound": {
|
|
20701
|
+
capName: "pet-feeder",
|
|
20702
|
+
capScope: "device",
|
|
20703
|
+
addonId: null,
|
|
20704
|
+
access: "create"
|
|
20705
|
+
},
|
|
20706
|
+
"petFeeder.setIndicatorLight": {
|
|
20707
|
+
capName: "pet-feeder",
|
|
20708
|
+
capScope: "device",
|
|
20709
|
+
addonId: null,
|
|
20710
|
+
access: "create"
|
|
20711
|
+
},
|
|
20712
|
+
"petFeeder.setVolume": {
|
|
20713
|
+
capName: "pet-feeder",
|
|
20714
|
+
capScope: "device",
|
|
20715
|
+
addonId: null,
|
|
20716
|
+
access: "create"
|
|
20717
|
+
},
|
|
19384
20718
|
"pipelineAnalytics.clearTracks": {
|
|
19385
20719
|
capName: "pipeline-analytics",
|
|
19386
20720
|
capScope: "device",
|