@camstack/types 1.2.267 → 1.2.269
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/addon.js +4 -4
- package/dist/addon.mjs +3 -3
- package/dist/capabilities/battery.cap.d.ts +17 -2
- package/dist/capabilities/capability-definition.d.ts +30 -1
- package/dist/capabilities/composer.cap.d.ts +105 -0
- package/dist/capabilities/consumables.cap.d.ts +79 -0
- package/dist/capabilities/core-blocks.cap.d.ts +1213 -104
- package/dist/capabilities/device-extension.cap.d.ts +12 -13
- package/dist/capabilities/device-manager.cap.d.ts +4 -4
- package/dist/capabilities/device-state.cap.d.ts +186 -2
- package/dist/capabilities/doorbell.cap.d.ts +4 -0
- package/dist/capabilities/index.d.ts +3 -3
- package/dist/capabilities/media-player.cap.d.ts +4 -4
- package/dist/capabilities/recording-archive.cap.d.ts +3 -3
- package/dist/catalogs/sensor-active-state.d.ts +25 -1
- package/dist/composition/composition-events.d.ts +42 -0
- package/dist/composition/composition-graph.d.ts +42 -9
- package/dist/composition/composition-items.d.ts +25 -0
- package/dist/composition/composition-report.d.ts +115 -12
- package/dist/composition/composition.d.ts +162 -3
- package/dist/composition/customization-name.d.ts +6 -0
- package/dist/composition/evaluate-field.d.ts +20 -0
- package/dist/composition/examples.d.ts +33 -0
- package/dist/composition/expression-kinds.d.ts +1 -0
- package/dist/composition/field-kinds.d.ts +42 -0
- package/dist/composition/index.d.ts +2 -0
- package/dist/composition/plan-result.d.ts +18 -0
- package/dist/composition/state-fields.d.ts +6 -0
- package/dist/composition/validate-composition.d.ts +44 -9
- package/dist/composition-BAH3n-zq.js +2582 -0
- package/dist/composition-D5BQywfe.mjs +2055 -0
- package/dist/device/device-context.d.ts +9 -0
- package/dist/device/device-runtime-state.d.ts +15 -1
- package/dist/device/index.d.ts +1 -1
- package/dist/device-extension/slot-descriptor.d.ts +8 -11
- package/dist/device-extension/slot-provider.d.ts +0 -2
- package/dist/enums/event-category.d.ts +25 -0
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/err-msg-DX6i_MY4.mjs +339 -0
- package/dist/err-msg-Dx2Kor0g.js +368 -0
- package/dist/{event-category-BVDXG4tB.mjs → event-category-C5xZWqz6.mjs} +31 -1
- package/dist/{event-category-BVfsrBYA.js → event-category-MbnB-6AN.js} +48 -0
- package/dist/expression/ast.d.ts +2 -0
- package/dist/expression/builtins.d.ts +9 -0
- package/dist/expression/evaluator.d.ts +8 -2
- package/dist/expression/expression-source.d.ts +26 -4
- package/dist/expression/index.d.ts +6 -6
- package/dist/generated/addon-api.d.ts +42 -0
- package/dist/generated/device-proxy.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +2 -2
- package/dist/generated/system-proxy.d.ts +2 -2
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1687 -1833
- package/dist/index.mjs +1359 -1550
- package/dist/interfaces/kernel-abstractions.d.ts +16 -0
- package/dist/interfaces/recording-config.d.ts +3 -3
- package/dist/interfaces/status-overlay.d.ts +42 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.js +29 -8
- package/dist/node.mjs +23 -3
- package/dist/{sleep-8K9gue-H.js → sleep-Bg0IB7gg.js} +10 -367
- package/dist/{sleep-DC-wdyeS.mjs → sleep-E6eD4yQS.mjs} +11 -344
- package/package.json +1 -1
- package/dist/canonical-hash-CPK2Dy60.mjs +0 -715
- package/dist/canonical-hash-CSE4ioRi.js +0 -792
- package/dist/err-msg-COpsHMw2.js +0 -18
- package/dist/err-msg-IQTHeDzc.mjs +0 -13
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { t as EventCategory } from "./event-category-
|
|
3
|
-
import {
|
|
1
|
+
import { $ as CamProfileSchema, A as DEVICE_STATUS_METHOD, At as normalizeAddonInitResult, B as nodePin, Bt as hydrateSchema, C as customAction, Ct as PEER_BYTES_STALL_MS, D as adminUiCapability, Dt as SHARE_VIEW_KINDS, E as deviceCustomAction, Et as DATAPLANE_SECRET_HEADER, F as method, Ft as isEvent, G as emitDownForOwnedCaps, Gt as isAudioChunkFormat, H as toNodeId, Ht as AUDIO_CHUNK_FORMATS, I as optionalMethod, It as WELL_KNOWN_TABS, J as AudioChunkFormatSchema, K as readinessKey, L as resolveCapMount, Lt as WELL_KNOWN_TAB_MAP, M as event, Mt as createDurableState, N as expandCapMethods, Nt as createEvent, O as DEFAULT_RUNTIME_STATE_DURABILITY, Ot as DisposerChain, P as isDeviceConfigCap, Pt as emitReadiness, Q as CAM_PROFILE_ORDER, R as systemMethod, Rt as collectHydratedFieldEntries, S as DEVICE_CHILDREN_BATCH_MAX, St as PEER_BYTES_MAX_OUTSTANDING, T as describeCustomActions, Tt as PeerBytesTicketSchema, U as ReadinessRegistry, Ut as audioChunkBytesPerSample, V as readNodePin, Vt as resolveHydratedFieldValue, W as ReadinessTimeoutError, Wt as expandAudioChunkToF32le, X as BrokerStatsSchema, Y as AudioStreamPickSchema, Z as BrokerStatusSchema, _ as createMirrorSource, _t as makeProfileBrokerId, a as asJsonObject, at as EncodedPacketSchema, b as deviceOpsCapability, bt as selectAssignedProfileSlots, c as parseJsonArray, ct as ProfileRtspEntrySchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as StreamSourceEntrySchema, et as CamStreamKindSchema, f as DEVICE_SCOPED_CAPS, ft as StreamSourceSchema, g as createLazyTrpcSource, gt as SubscribeFramesResultSchema, h as createEventBusSliceSource, ht as SubscribeFramesInputSchema, i as asJsonArray, it as DecodedFrameSchema, j as PROVIDER_PIN_FIELD, jt as normalizeNodeId, k as DEVICE_SETTINGS_CONTRIBUTION_METHODS, kt as BaseAddon, l as parseJsonObject, lt as ProfileSlotSchema, m as createDeviceProxy, mt as SubscribeAudioChunksResultSchema, n as sleepCancellable, nt as CameraStreamSchema, o as asNumber, ot as FrameHandleFormatSchema, p as isDeviceScopedCap, pt as SubscribeAudioChunksInputSchema, q as scopeKey, r as asBoolean, rt as DecodedAudioChunkSchema, s as asString, st as FrameHandleSchema, t as sleep, tt as CamStreamResolutionSchema, u as parseJsonUnknown, ut as ProfileSlotStatusSchema, v as createSliceHandle, vt as makeSourceBrokerId, w as defineCustomActions, wt as PEER_BYTES_TICKET_TTL_MS, x as viewerUiCapability, xt as PEER_BYTES_CHUNK_BYTES, y as RawStateResultSchema, yt as parseProfileBrokerId, z as CAP_NODE_PIN_CONTEXT_KEY, zt as collectHydratedFieldValues } from "./sleep-E6eD4yQS.mjs";
|
|
2
|
+
import { i as publicEventCategories, n as OWNER_ONLY_EVENT_CATEGORIES, r as isOwnerOnlyEventCategory, t as EventCategory } from "./event-category-C5xZWqz6.mjs";
|
|
3
|
+
import { $ as MAX_EXPRESSION_AST_NODES, A as compositionFeatureEnabled, At as invocationFromEncodeProfile, B as createStatefulExpressionMemory, C as CompositionTargetSchema, Ct as Fmp4BoxSplitter, D as MAX_COMPOSITION_ITEMS, Dt as buildFfmpegArgs, E as MAX_COMPOSITION_FIELDS_PER_FEATURE, Et as buildAudioArgs, F as featureFieldEntries, G as createExpressionScope, H as evaluateStatefulExpressionCall, I as featureSources, J as compileExpressionSafe, K as evaluateAst, L as fieldReads, M as compositionReadKey, Mt as logBannerArgs, N as compositionSliceKey, Nt as pickVideoEncoder, O as composedDeviceRef, Ot as buildInputArgs, P as compositionSourceKey, Pt as resolveStreamMaps, Q as EXPRESSION_IDENTIFIER_RE, R as EXPRESSION_INJECTED_NOW, S as CompositionSourceRefSchema, St as canonicalHash, T as MAX_COMPOSITION_FEATURES, Tt as audioPlanFromEncodeProfile, U as toExpressionValue, V as evaluateExpressionSource, W as validateExpressionSource, X as tokenize, Y as parseExpression, Z as EXPRESSION_COMPILE_CACHE_CAPACITY, _ as CompositionItemEntrySchema, _t as evaluateSensorEdge, a as CUSTOMIZATION_BLOCK_NAME_PREFIX, at as EXPRESSION_BUILTINS, b as CompositionPassthroughFeatureSchema, bt as sliceActiveValue, c as CompositionCommandTargetSchema, ct as evaluateRose, d as CompositionFeatureSchema, dt as ExpressionParseError, et as MAX_EXPRESSION_BINDINGS, f as CompositionFieldReadSchema, ft as DEFAULT_FIRST_SIGHTING_FRESHNESS_MS, g as CompositionFromSourceSchema, gt as SOURCE_DEVICE_TYPES, h as CompositionForwardCommandSchema, ht as SOURCE_CAP_CHANGED_AT_FIELD, i as COMPOSITION_ITEM_KEY_RE, it as RESERVED_BINDING_NAMES, j as compositionItemFieldPath, jt as isSoftwareDecode, k as composedDeviceStableId, kt as buildVideoArgs, l as CompositionExistingTargetSchema, lt as isStatefulBuiltin, m as CompositionFieldsFeatureSchema, mt as SOURCE_CAP_ACTIVE_FIELD, n as COMPOSER_ADDON_ID, nt as MAX_EXPRESSION_EVAL_STEPS, o as CompositionBindingSchema, ot as EXPRESSION_BUILTIN_NAMES, p as CompositionFieldSourceSchema, pt as SOURCE_CAPS, q as compileExpression, r as COMPOSITION_ITEM_ARRAY_PATH, rt as MAX_EXPRESSION_SOURCE_LENGTH, s as CompositionCodeSourceSchema, st as evaluateCount, t as COMPOSED_DEVICE_STABLE_ID_PREFIX, tt as MAX_EXPRESSION_CALL_ARGS, u as CompositionExpressionSourceSchema, ut as ExpressionEvalError, v as CompositionLiteralBindingSchema, vt as evaluateSensorLevelEdge, w as MAX_COMPOSITION_CODE_LENGTH, wt as AUDIO_PRESETS, x as CompositionSchema, xt as sliceChangedAt, y as CompositionNewTargetSchema, yt as isSourceCap, z as cloneStatefulExpressionMemory } from "./composition-D5BQywfe.mjs";
|
|
4
|
+
import { a as DeviceType, i as DeviceRole, n as ChargingStatus, r as DeviceFeature, t as errMsg } from "./err-msg-DX6i_MY4.mjs";
|
|
4
5
|
import { EventSourceType } from "./enums.mjs";
|
|
5
|
-
import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/media/media-owner-key.ts
|
|
8
8
|
/**
|
|
@@ -5530,809 +5530,6 @@ function principalMayReachAddon(input) {
|
|
|
5530
5530
|
};
|
|
5531
5531
|
}
|
|
5532
5532
|
//#endregion
|
|
5533
|
-
//#region src/expression/errors.ts
|
|
5534
|
-
/**
|
|
5535
|
-
* Error types for the safe expression engine. Two distinct classes so callers
|
|
5536
|
-
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
5537
|
-
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
5538
|
-
*/
|
|
5539
|
-
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
5540
|
-
* the failure is anchored to a character (author-facing inline feedback). */
|
|
5541
|
-
var ExpressionParseError = class extends Error {
|
|
5542
|
-
position;
|
|
5543
|
-
constructor(message, position) {
|
|
5544
|
-
super(message);
|
|
5545
|
-
this.name = "ExpressionParseError";
|
|
5546
|
-
this.position = position;
|
|
5547
|
-
}
|
|
5548
|
-
};
|
|
5549
|
-
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
5550
|
-
* result, unknown builtin, step-budget exceeded). */
|
|
5551
|
-
var ExpressionEvalError = class extends Error {
|
|
5552
|
-
constructor(message) {
|
|
5553
|
-
super(message);
|
|
5554
|
-
this.name = "ExpressionEvalError";
|
|
5555
|
-
}
|
|
5556
|
-
};
|
|
5557
|
-
//#endregion
|
|
5558
|
-
//#region src/expression/builtins.ts
|
|
5559
|
-
function asFiniteNumber(value, name, index) {
|
|
5560
|
-
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
5561
|
-
return value;
|
|
5562
|
-
}
|
|
5563
|
-
function asString$1(value, name, index) {
|
|
5564
|
-
if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
|
|
5565
|
-
return value;
|
|
5566
|
-
}
|
|
5567
|
-
function finiteResult(value, name) {
|
|
5568
|
-
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
|
|
5569
|
-
return value;
|
|
5570
|
-
}
|
|
5571
|
-
function allFiniteNumbers(args, name) {
|
|
5572
|
-
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
5573
|
-
}
|
|
5574
|
-
function asBoolean$1(value, name, index) {
|
|
5575
|
-
if (typeof value !== "boolean") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a boolean`);
|
|
5576
|
-
return value;
|
|
5577
|
-
}
|
|
5578
|
-
var INF = Number.POSITIVE_INFINITY;
|
|
5579
|
-
var table = {
|
|
5580
|
-
min: {
|
|
5581
|
-
minArgs: 1,
|
|
5582
|
-
maxArgs: INF,
|
|
5583
|
-
apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
|
|
5584
|
-
},
|
|
5585
|
-
max: {
|
|
5586
|
-
minArgs: 1,
|
|
5587
|
-
maxArgs: INF,
|
|
5588
|
-
apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
|
|
5589
|
-
},
|
|
5590
|
-
abs: {
|
|
5591
|
-
minArgs: 1,
|
|
5592
|
-
maxArgs: 1,
|
|
5593
|
-
apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
|
|
5594
|
-
},
|
|
5595
|
-
floor: {
|
|
5596
|
-
minArgs: 1,
|
|
5597
|
-
maxArgs: 1,
|
|
5598
|
-
apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
|
|
5599
|
-
},
|
|
5600
|
-
ceil: {
|
|
5601
|
-
minArgs: 1,
|
|
5602
|
-
maxArgs: 1,
|
|
5603
|
-
apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
|
|
5604
|
-
},
|
|
5605
|
-
sqrt: {
|
|
5606
|
-
minArgs: 1,
|
|
5607
|
-
maxArgs: 1,
|
|
5608
|
-
apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
|
|
5609
|
-
},
|
|
5610
|
-
round: {
|
|
5611
|
-
minArgs: 1,
|
|
5612
|
-
maxArgs: 2,
|
|
5613
|
-
apply: (args) => {
|
|
5614
|
-
const x = asFiniteNumber(args[0], "round", 0);
|
|
5615
|
-
const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
|
|
5616
|
-
if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
|
|
5617
|
-
const factor = 10 ** digits;
|
|
5618
|
-
return finiteResult(Math.round(x * factor) / factor, "round");
|
|
5619
|
-
}
|
|
5620
|
-
},
|
|
5621
|
-
pow: {
|
|
5622
|
-
minArgs: 2,
|
|
5623
|
-
maxArgs: 2,
|
|
5624
|
-
apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
|
|
5625
|
-
},
|
|
5626
|
-
clamp: {
|
|
5627
|
-
minArgs: 3,
|
|
5628
|
-
maxArgs: 3,
|
|
5629
|
-
apply: (args) => {
|
|
5630
|
-
const x = asFiniteNumber(args[0], "clamp", 0);
|
|
5631
|
-
const lo = asFiniteNumber(args[1], "clamp", 1);
|
|
5632
|
-
const hi = asFiniteNumber(args[2], "clamp", 2);
|
|
5633
|
-
if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
|
|
5634
|
-
return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
|
|
5635
|
-
}
|
|
5636
|
-
},
|
|
5637
|
-
avg: {
|
|
5638
|
-
minArgs: 1,
|
|
5639
|
-
maxArgs: INF,
|
|
5640
|
-
apply: (args) => {
|
|
5641
|
-
const nums = allFiniteNumbers(args, "avg");
|
|
5642
|
-
return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
|
|
5643
|
-
}
|
|
5644
|
-
},
|
|
5645
|
-
sum: {
|
|
5646
|
-
minArgs: 1,
|
|
5647
|
-
maxArgs: INF,
|
|
5648
|
-
apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
|
|
5649
|
-
},
|
|
5650
|
-
coalesce: {
|
|
5651
|
-
minArgs: 1,
|
|
5652
|
-
maxArgs: INF,
|
|
5653
|
-
apply: (args) => {
|
|
5654
|
-
for (const a of args) if (a !== null) return a;
|
|
5655
|
-
return null;
|
|
5656
|
-
}
|
|
5657
|
-
},
|
|
5658
|
-
age: {
|
|
5659
|
-
minArgs: 2,
|
|
5660
|
-
maxArgs: 2,
|
|
5661
|
-
apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
|
|
5662
|
-
},
|
|
5663
|
-
convert: {
|
|
5664
|
-
minArgs: 3,
|
|
5665
|
-
maxArgs: 3,
|
|
5666
|
-
apply: (args, hooks) => {
|
|
5667
|
-
const x = asFiniteNumber(args[0], "convert", 0);
|
|
5668
|
-
const from = asString$1(args[1], "convert", 1).trim();
|
|
5669
|
-
const to = asString$1(args[2], "convert", 2).trim();
|
|
5670
|
-
if (hooks.convert) {
|
|
5671
|
-
const out = hooks.convert(x, from, to);
|
|
5672
|
-
if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
|
|
5673
|
-
return finiteResult(out, "convert");
|
|
5674
|
-
}
|
|
5675
|
-
if (from === to) return x;
|
|
5676
|
-
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
5677
|
-
}
|
|
5678
|
-
},
|
|
5679
|
-
any: {
|
|
5680
|
-
minArgs: 1,
|
|
5681
|
-
maxArgs: INF,
|
|
5682
|
-
apply: (args) => args.map((a, i) => asBoolean$1(a, "any", i)).some((b) => b)
|
|
5683
|
-
},
|
|
5684
|
-
all: {
|
|
5685
|
-
minArgs: 1,
|
|
5686
|
-
maxArgs: INF,
|
|
5687
|
-
apply: (args) => args.map((a, i) => asBoolean$1(a, "all", i)).every((b) => b)
|
|
5688
|
-
},
|
|
5689
|
-
within: {
|
|
5690
|
-
minArgs: 2,
|
|
5691
|
-
maxArgs: 2,
|
|
5692
|
-
apply: (args, hooks) => {
|
|
5693
|
-
const windowMs = asFiniteNumber(args[1], "within", 1);
|
|
5694
|
-
if (windowMs < 0) throw new ExpressionEvalError("within: the window must not be negative");
|
|
5695
|
-
const at = args[0];
|
|
5696
|
-
if (at === null) return false;
|
|
5697
|
-
const ts = asFiniteNumber(at, "within", 0);
|
|
5698
|
-
const now = hooks.now;
|
|
5699
|
-
if (now === void 0 || !Number.isFinite(now)) throw new ExpressionEvalError("within: no clock was supplied to this evaluation");
|
|
5700
|
-
const inside = now - ts <= windowMs;
|
|
5701
|
-
if (inside) hooks.noteDeadline?.(ts + windowMs + 1);
|
|
5702
|
-
return inside;
|
|
5703
|
-
}
|
|
5704
|
-
},
|
|
5705
|
-
latest: {
|
|
5706
|
-
minArgs: 1,
|
|
5707
|
-
maxArgs: INF,
|
|
5708
|
-
apply: (args) => {
|
|
5709
|
-
const present = args.flatMap((a, i) => a === null ? [] : [asFiniteNumber(a, "latest", i)]);
|
|
5710
|
-
return present.length === 0 ? null : finiteResult(Math.max(...present), "latest");
|
|
5711
|
-
}
|
|
5712
|
-
}
|
|
5713
|
-
};
|
|
5714
|
-
/** Frozen, null-prototype builtin table. */
|
|
5715
|
-
var EXPRESSION_BUILTINS = Object.freeze(Object.assign(Object.create(null), table));
|
|
5716
|
-
/** The set of valid builtin names — used by the parser to reject unknown
|
|
5717
|
-
* callees at parse time (immediate author feedback). */
|
|
5718
|
-
var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
|
|
5719
|
-
//#endregion
|
|
5720
|
-
//#region src/expression/limits.ts
|
|
5721
|
-
/**
|
|
5722
|
-
* Resource-bound constants for the safe expression engine.
|
|
5723
|
-
*
|
|
5724
|
-
* Every bound is defense-in-depth: the grammar is non-Turing-complete (no
|
|
5725
|
-
* loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
|
|
5726
|
-
* O(nodeCount) by construction. These caps merely put a hard ceiling on the
|
|
5727
|
-
* work a single author-supplied expression can request, so a hostile or
|
|
5728
|
-
* accidental pathological string can never spend unbounded CPU/memory.
|
|
5729
|
-
*/
|
|
5730
|
-
/** Max source length (chars) — checked BEFORE tokenizing so a huge string is
|
|
5731
|
-
* rejected without allocation. */
|
|
5732
|
-
var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
|
|
5733
|
-
/** Max AST nodes — checked during parse; a deeply nested grouping that exceeds
|
|
5734
|
-
* this is rejected as "expression too complex". */
|
|
5735
|
-
var MAX_EXPRESSION_AST_NODES = 256;
|
|
5736
|
-
/** Defense-in-depth walker step budget — one increment per node visit during
|
|
5737
|
-
* evaluation. The grammar guarantees O(nodeCount) walks, so this can only trip
|
|
5738
|
-
* on a crafted maximum-size AST. */
|
|
5739
|
-
var MAX_EXPRESSION_EVAL_STEPS = 4096;
|
|
5740
|
-
/** Max named bindings on one {@link ExpressionSource}. */
|
|
5741
|
-
var MAX_EXPRESSION_BINDINGS = 32;
|
|
5742
|
-
/** Max positional arguments to any builtin call. */
|
|
5743
|
-
var MAX_EXPRESSION_CALL_ARGS = 16;
|
|
5744
|
-
/** LRU compile-cache capacity (parsed ASTs keyed by raw source string). */
|
|
5745
|
-
var EXPRESSION_COMPILE_CACHE_CAPACITY = 256;
|
|
5746
|
-
/** A legal binding / identifier name. */
|
|
5747
|
-
var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
5748
|
-
/** Binding names an author may NOT use: `now` is auto-injected; the literal
|
|
5749
|
-
* keywords lex as values, not identifiers, so binding to them is meaningless. */
|
|
5750
|
-
var RESERVED_BINDING_NAMES = new Set([
|
|
5751
|
-
"now",
|
|
5752
|
-
"true",
|
|
5753
|
-
"false",
|
|
5754
|
-
"null"
|
|
5755
|
-
]);
|
|
5756
|
-
//#endregion
|
|
5757
|
-
//#region src/expression/tokenizer.ts
|
|
5758
|
-
/**
|
|
5759
|
-
* Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
|
|
5760
|
-
* zero-dependency. The grammar is deliberately boring: decimal numbers,
|
|
5761
|
-
* single/double-quoted strings with a tiny escape set, identifiers, the three
|
|
5762
|
-
* value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
|
|
5763
|
-
* outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
|
|
5764
|
-
* is a parse error with a source position, so member access / assignment /
|
|
5765
|
-
* template literals are lexically impossible.
|
|
5766
|
-
*/
|
|
5767
|
-
var KEYWORDS = new Set([
|
|
5768
|
-
"true",
|
|
5769
|
-
"false",
|
|
5770
|
-
"null"
|
|
5771
|
-
]);
|
|
5772
|
-
function isDigit(ch) {
|
|
5773
|
-
return ch >= "0" && ch <= "9";
|
|
5774
|
-
}
|
|
5775
|
-
function isIdentStart(ch) {
|
|
5776
|
-
return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
|
|
5777
|
-
}
|
|
5778
|
-
function isIdentPart(ch) {
|
|
5779
|
-
return isIdentStart(ch) || isDigit(ch);
|
|
5780
|
-
}
|
|
5781
|
-
function isWhitespace(ch) {
|
|
5782
|
-
return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
|
|
5783
|
-
}
|
|
5784
|
-
/** Tokenize `source` into a flat token list ending with a single `eof` token.
|
|
5785
|
-
* Throws `ExpressionParseError` on any illegal character or unterminated
|
|
5786
|
-
* string. */
|
|
5787
|
-
function tokenize(source) {
|
|
5788
|
-
if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
|
|
5789
|
-
const tokens = [];
|
|
5790
|
-
let i = 0;
|
|
5791
|
-
const n = source.length;
|
|
5792
|
-
while (i < n) {
|
|
5793
|
-
const ch = source[i];
|
|
5794
|
-
if (isWhitespace(ch)) {
|
|
5795
|
-
i += 1;
|
|
5796
|
-
continue;
|
|
5797
|
-
}
|
|
5798
|
-
if (isDigit(ch)) {
|
|
5799
|
-
const start = i;
|
|
5800
|
-
while (i < n && isDigit(source[i])) i += 1;
|
|
5801
|
-
if (i < n && source[i] === ".") {
|
|
5802
|
-
if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
|
|
5803
|
-
i += 1;
|
|
5804
|
-
while (i < n && isDigit(source[i])) i += 1;
|
|
5805
|
-
}
|
|
5806
|
-
const text = source.slice(start, i);
|
|
5807
|
-
const value = Number(text);
|
|
5808
|
-
if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
|
|
5809
|
-
tokens.push({
|
|
5810
|
-
type: "number",
|
|
5811
|
-
value,
|
|
5812
|
-
pos: start
|
|
5813
|
-
});
|
|
5814
|
-
continue;
|
|
5815
|
-
}
|
|
5816
|
-
if (ch === "'" || ch === "\"") {
|
|
5817
|
-
const quote = ch;
|
|
5818
|
-
const start = i;
|
|
5819
|
-
i += 1;
|
|
5820
|
-
let out = "";
|
|
5821
|
-
let closed = false;
|
|
5822
|
-
while (i < n) {
|
|
5823
|
-
const c = source[i];
|
|
5824
|
-
if (c === "\\") {
|
|
5825
|
-
const next = i + 1 < n ? source[i + 1] : "";
|
|
5826
|
-
if (next === "\\" || next === "'" || next === "\"") {
|
|
5827
|
-
out += next;
|
|
5828
|
-
i += 2;
|
|
5829
|
-
continue;
|
|
5830
|
-
}
|
|
5831
|
-
throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
|
|
5832
|
-
}
|
|
5833
|
-
if (c === quote) {
|
|
5834
|
-
closed = true;
|
|
5835
|
-
i += 1;
|
|
5836
|
-
break;
|
|
5837
|
-
}
|
|
5838
|
-
out += c;
|
|
5839
|
-
i += 1;
|
|
5840
|
-
}
|
|
5841
|
-
if (!closed) throw new ExpressionParseError("unterminated string literal", start);
|
|
5842
|
-
tokens.push({
|
|
5843
|
-
type: "string",
|
|
5844
|
-
value: out,
|
|
5845
|
-
pos: start
|
|
5846
|
-
});
|
|
5847
|
-
continue;
|
|
5848
|
-
}
|
|
5849
|
-
if (isIdentStart(ch)) {
|
|
5850
|
-
const start = i;
|
|
5851
|
-
while (i < n && isIdentPart(source[i])) i += 1;
|
|
5852
|
-
const text = source.slice(start, i);
|
|
5853
|
-
if (KEYWORDS.has(text)) tokens.push({
|
|
5854
|
-
type: "keyword",
|
|
5855
|
-
keyword: keywordOf(text),
|
|
5856
|
-
pos: start
|
|
5857
|
-
});
|
|
5858
|
-
else tokens.push({
|
|
5859
|
-
type: "identifier",
|
|
5860
|
-
name: text,
|
|
5861
|
-
pos: start
|
|
5862
|
-
});
|
|
5863
|
-
continue;
|
|
5864
|
-
}
|
|
5865
|
-
const two = i + 1 < n ? source.slice(i, i + 2) : "";
|
|
5866
|
-
if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
|
|
5867
|
-
tokens.push({
|
|
5868
|
-
type: "punct",
|
|
5869
|
-
punct: two,
|
|
5870
|
-
pos: i
|
|
5871
|
-
});
|
|
5872
|
-
i += 2;
|
|
5873
|
-
continue;
|
|
5874
|
-
}
|
|
5875
|
-
if (isSinglePunct(ch)) {
|
|
5876
|
-
tokens.push({
|
|
5877
|
-
type: "punct",
|
|
5878
|
-
punct: ch,
|
|
5879
|
-
pos: i
|
|
5880
|
-
});
|
|
5881
|
-
i += 1;
|
|
5882
|
-
continue;
|
|
5883
|
-
}
|
|
5884
|
-
throw new ExpressionParseError(`unexpected character '${ch}'`, i);
|
|
5885
|
-
}
|
|
5886
|
-
tokens.push({
|
|
5887
|
-
type: "eof",
|
|
5888
|
-
pos: n
|
|
5889
|
-
});
|
|
5890
|
-
return tokens;
|
|
5891
|
-
}
|
|
5892
|
-
function keywordOf(text) {
|
|
5893
|
-
if (text === "true") return "true";
|
|
5894
|
-
if (text === "false") return "false";
|
|
5895
|
-
return "null";
|
|
5896
|
-
}
|
|
5897
|
-
function isSinglePunct(ch) {
|
|
5898
|
-
return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
|
|
5899
|
-
}
|
|
5900
|
-
//#endregion
|
|
5901
|
-
//#region src/expression/parser.ts
|
|
5902
|
-
/**
|
|
5903
|
-
* Pratt (precedence-climbing) parser for the safe expression mini-language.
|
|
5904
|
-
*
|
|
5905
|
-
* Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
|
|
5906
|
-
* → relational → additive → multiplicative → unary `! -` → call / primary.
|
|
5907
|
-
* Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
|
|
5908
|
-
* string validated against the builtin table at parse time, so an unknown
|
|
5909
|
-
* function is rejected immediately (author feedback) and a persisted expression
|
|
5910
|
-
* that references a since-removed builtin degrades at read.
|
|
5911
|
-
*
|
|
5912
|
-
* A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
|
|
5913
|
-
* arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
|
|
5914
|
-
*/
|
|
5915
|
-
/** Binary/logical operator precedence (higher binds tighter). */
|
|
5916
|
-
var BINARY_PRECEDENCE = {
|
|
5917
|
-
"||": 1,
|
|
5918
|
-
"&&": 2,
|
|
5919
|
-
"==": 3,
|
|
5920
|
-
"!=": 3,
|
|
5921
|
-
"<": 4,
|
|
5922
|
-
"<=": 4,
|
|
5923
|
-
">": 4,
|
|
5924
|
-
">=": 4,
|
|
5925
|
-
"+": 5,
|
|
5926
|
-
"-": 5,
|
|
5927
|
-
"*": 6,
|
|
5928
|
-
"/": 6,
|
|
5929
|
-
"%": 6
|
|
5930
|
-
};
|
|
5931
|
-
function isLogicalOp(op) {
|
|
5932
|
-
return op === "&&" || op === "||";
|
|
5933
|
-
}
|
|
5934
|
-
function isBinaryOp(op) {
|
|
5935
|
-
return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
|
|
5936
|
-
}
|
|
5937
|
-
var Parser = class {
|
|
5938
|
-
tokens;
|
|
5939
|
-
pos = 0;
|
|
5940
|
-
nodeCount = 0;
|
|
5941
|
-
identifiers = /* @__PURE__ */ new Set();
|
|
5942
|
-
callees = /* @__PURE__ */ new Set();
|
|
5943
|
-
constructor(tokens) {
|
|
5944
|
-
this.tokens = tokens;
|
|
5945
|
-
}
|
|
5946
|
-
parse() {
|
|
5947
|
-
const ast = this.parseTernary();
|
|
5948
|
-
const tok = this.peek();
|
|
5949
|
-
if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
|
|
5950
|
-
return {
|
|
5951
|
-
ast,
|
|
5952
|
-
identifiers: this.identifiers,
|
|
5953
|
-
callees: this.callees,
|
|
5954
|
-
nodeCount: this.nodeCount
|
|
5955
|
-
};
|
|
5956
|
-
}
|
|
5957
|
-
peek() {
|
|
5958
|
-
return this.tokens[this.pos];
|
|
5959
|
-
}
|
|
5960
|
-
next() {
|
|
5961
|
-
return this.tokens[this.pos++];
|
|
5962
|
-
}
|
|
5963
|
-
/** Consume a punctuator token, erroring if the next token isn't it. */
|
|
5964
|
-
expectPunct(punct) {
|
|
5965
|
-
const tok = this.peek();
|
|
5966
|
-
if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
|
|
5967
|
-
this.pos += 1;
|
|
5968
|
-
}
|
|
5969
|
-
matchPunct(punct) {
|
|
5970
|
-
const tok = this.peek();
|
|
5971
|
-
if (tok.type === "punct" && tok.punct === punct) {
|
|
5972
|
-
this.pos += 1;
|
|
5973
|
-
return true;
|
|
5974
|
-
}
|
|
5975
|
-
return false;
|
|
5976
|
-
}
|
|
5977
|
-
countNode() {
|
|
5978
|
-
this.nodeCount += 1;
|
|
5979
|
-
if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
|
|
5980
|
-
}
|
|
5981
|
-
parseTernary() {
|
|
5982
|
-
const test = this.parseBinary(1);
|
|
5983
|
-
if (this.matchPunct("?")) {
|
|
5984
|
-
const consequent = this.parseTernary();
|
|
5985
|
-
this.expectPunct(":");
|
|
5986
|
-
const alternate = this.parseTernary();
|
|
5987
|
-
this.countNode();
|
|
5988
|
-
return {
|
|
5989
|
-
kind: "conditional",
|
|
5990
|
-
test,
|
|
5991
|
-
consequent,
|
|
5992
|
-
alternate
|
|
5993
|
-
};
|
|
5994
|
-
}
|
|
5995
|
-
return test;
|
|
5996
|
-
}
|
|
5997
|
-
parseBinary(minPrec) {
|
|
5998
|
-
let left = this.parseUnary();
|
|
5999
|
-
for (;;) {
|
|
6000
|
-
const tok = this.peek();
|
|
6001
|
-
if (tok.type !== "punct") break;
|
|
6002
|
-
const prec = BINARY_PRECEDENCE[tok.punct];
|
|
6003
|
-
if (prec === void 0 || prec < minPrec) break;
|
|
6004
|
-
const op = tok.punct;
|
|
6005
|
-
this.pos += 1;
|
|
6006
|
-
const right = this.parseBinary(prec + 1);
|
|
6007
|
-
this.countNode();
|
|
6008
|
-
if (isLogicalOp(op)) left = {
|
|
6009
|
-
kind: "logical",
|
|
6010
|
-
op,
|
|
6011
|
-
left,
|
|
6012
|
-
right
|
|
6013
|
-
};
|
|
6014
|
-
else if (isBinaryOp(op)) left = {
|
|
6015
|
-
kind: "binary",
|
|
6016
|
-
op,
|
|
6017
|
-
left,
|
|
6018
|
-
right
|
|
6019
|
-
};
|
|
6020
|
-
else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
|
|
6021
|
-
}
|
|
6022
|
-
return left;
|
|
6023
|
-
}
|
|
6024
|
-
parseUnary() {
|
|
6025
|
-
const tok = this.peek();
|
|
6026
|
-
if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
|
|
6027
|
-
const op = tok.punct;
|
|
6028
|
-
this.pos += 1;
|
|
6029
|
-
const operand = this.parseUnary();
|
|
6030
|
-
this.countNode();
|
|
6031
|
-
return {
|
|
6032
|
-
kind: "unary",
|
|
6033
|
-
op,
|
|
6034
|
-
operand
|
|
6035
|
-
};
|
|
6036
|
-
}
|
|
6037
|
-
return this.parsePrimary();
|
|
6038
|
-
}
|
|
6039
|
-
parsePrimary() {
|
|
6040
|
-
const tok = this.next();
|
|
6041
|
-
switch (tok.type) {
|
|
6042
|
-
case "number":
|
|
6043
|
-
this.countNode();
|
|
6044
|
-
return {
|
|
6045
|
-
kind: "literal",
|
|
6046
|
-
value: tok.value
|
|
6047
|
-
};
|
|
6048
|
-
case "string":
|
|
6049
|
-
this.countNode();
|
|
6050
|
-
return {
|
|
6051
|
-
kind: "literal",
|
|
6052
|
-
value: tok.value
|
|
6053
|
-
};
|
|
6054
|
-
case "keyword":
|
|
6055
|
-
this.countNode();
|
|
6056
|
-
return {
|
|
6057
|
-
kind: "literal",
|
|
6058
|
-
value: tok.keyword === "null" ? null : tok.keyword === "true"
|
|
6059
|
-
};
|
|
6060
|
-
case "identifier": {
|
|
6061
|
-
const nextTok = this.peek();
|
|
6062
|
-
if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
|
|
6063
|
-
this.identifiers.add(tok.name);
|
|
6064
|
-
this.countNode();
|
|
6065
|
-
return {
|
|
6066
|
-
kind: "identifier",
|
|
6067
|
-
name: tok.name
|
|
6068
|
-
};
|
|
6069
|
-
}
|
|
6070
|
-
case "punct":
|
|
6071
|
-
if (tok.punct === "(") {
|
|
6072
|
-
const inner = this.parseTernary();
|
|
6073
|
-
this.expectPunct(")");
|
|
6074
|
-
return inner;
|
|
6075
|
-
}
|
|
6076
|
-
throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
|
|
6077
|
-
case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
|
|
6078
|
-
}
|
|
6079
|
-
}
|
|
6080
|
-
parseCall(callee, pos) {
|
|
6081
|
-
if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
|
|
6082
|
-
this.expectPunct("(");
|
|
6083
|
-
const args = [];
|
|
6084
|
-
if (!this.matchPunct(")")) for (;;) {
|
|
6085
|
-
args.push(this.parseTernary());
|
|
6086
|
-
if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
|
|
6087
|
-
if (this.matchPunct(",")) continue;
|
|
6088
|
-
this.expectPunct(")");
|
|
6089
|
-
break;
|
|
6090
|
-
}
|
|
6091
|
-
this.callees.add(callee);
|
|
6092
|
-
this.countNode();
|
|
6093
|
-
return {
|
|
6094
|
-
kind: "call",
|
|
6095
|
-
callee,
|
|
6096
|
-
args
|
|
6097
|
-
};
|
|
6098
|
-
}
|
|
6099
|
-
};
|
|
6100
|
-
/** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
|
|
6101
|
-
* `ExpressionParseError` on any lexical or grammatical failure. */
|
|
6102
|
-
function parseExpression(source) {
|
|
6103
|
-
return new Parser(tokenize(source)).parse();
|
|
6104
|
-
}
|
|
6105
|
-
//#endregion
|
|
6106
|
-
//#region src/expression/compile.ts
|
|
6107
|
-
/**
|
|
6108
|
-
* LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
|
|
6109
|
-
* by expr"). The cache stores BOTH successes and failures (negative caching),
|
|
6110
|
-
* so a corrupt persisted string costs exactly one tokenize+parse total — not
|
|
6111
|
-
* one per read on a hot resolve path.
|
|
6112
|
-
*
|
|
6113
|
-
* The cache is a module-level singleton: entries are pure, content-addressed
|
|
6114
|
-
* ASTs keyed by the raw source string, so sharing one instance across all
|
|
6115
|
-
* callers is safe and maximises hit rate.
|
|
6116
|
-
*/
|
|
6117
|
-
var cache = /* @__PURE__ */ new Map();
|
|
6118
|
-
function getCached(source) {
|
|
6119
|
-
const hit = cache.get(source);
|
|
6120
|
-
if (hit !== void 0) {
|
|
6121
|
-
cache.delete(source);
|
|
6122
|
-
cache.set(source, hit);
|
|
6123
|
-
return hit;
|
|
6124
|
-
}
|
|
6125
|
-
let result;
|
|
6126
|
-
try {
|
|
6127
|
-
result = {
|
|
6128
|
-
ok: true,
|
|
6129
|
-
parsed: parseExpression(source)
|
|
6130
|
-
};
|
|
6131
|
-
} catch (err) {
|
|
6132
|
-
result = {
|
|
6133
|
-
ok: false,
|
|
6134
|
-
error: err instanceof ExpressionParseError ? err.message : String(err)
|
|
6135
|
-
};
|
|
6136
|
-
}
|
|
6137
|
-
cache.set(source, result);
|
|
6138
|
-
if (cache.size > 256) {
|
|
6139
|
-
const oldest = cache.keys().next().value;
|
|
6140
|
-
if (oldest !== void 0) cache.delete(oldest);
|
|
6141
|
-
}
|
|
6142
|
-
return result;
|
|
6143
|
-
}
|
|
6144
|
-
/** Compile `source` to a `ParsedExpression`, throwing `ExpressionParseError`
|
|
6145
|
-
* on failure. LRU/negative-cached. */
|
|
6146
|
-
function compileExpression(source) {
|
|
6147
|
-
const result = getCached(source);
|
|
6148
|
-
if (result.ok) return result.parsed;
|
|
6149
|
-
throw new ExpressionParseError(result.error);
|
|
6150
|
-
}
|
|
6151
|
-
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
6152
|
-
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
6153
|
-
function compileExpressionSafe(source) {
|
|
6154
|
-
return getCached(source);
|
|
6155
|
-
}
|
|
6156
|
-
//#endregion
|
|
6157
|
-
//#region src/expression/evaluator.ts
|
|
6158
|
-
/**
|
|
6159
|
-
* Tree-walking evaluator for the safe expression mini-language.
|
|
6160
|
-
*
|
|
6161
|
-
* SECURITY (spec §4 rule 2/5):
|
|
6162
|
-
* - The scope is an `Object.create(null)` copy of ONLY the caller's own
|
|
6163
|
-
* enumerable binding entries, so `name in scope` is a pure own-key check and
|
|
6164
|
-
* `constructor` / `__proto__` / `toString` are plain unknown identifiers.
|
|
6165
|
-
* - Performs ZERO I/O and never touches `globalThis` / `Date` / `Math`
|
|
6166
|
-
* directly — the only external calls are into the frozen builtin table.
|
|
6167
|
-
* - The grammar has no loops/recursion/lambdas, so a walk is O(nodeCount) by
|
|
6168
|
-
* construction; the step counter is defense-in-depth for a crafted max-size
|
|
6169
|
-
* AST. Nothing blocks: there are no timers, awaits or unbounded loops.
|
|
6170
|
-
*/
|
|
6171
|
-
var EMPTY_HOOKS = Object.freeze({});
|
|
6172
|
-
/** Build a null-prototype scope from own-enumerable binding entries. Inherited
|
|
6173
|
-
* keys of the input (e.g. from a `{__proto__: {...}}` payload) are NOT copied,
|
|
6174
|
-
* so nothing smuggles in via the prototype chain. */
|
|
6175
|
-
function createExpressionScope(bindings) {
|
|
6176
|
-
const scope = Object.create(null);
|
|
6177
|
-
for (const key of Object.keys(bindings)) if (Object.prototype.hasOwnProperty.call(bindings, key)) scope[key] = bindings[key];
|
|
6178
|
-
return scope;
|
|
6179
|
-
}
|
|
6180
|
-
function isFiniteNumber(value) {
|
|
6181
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
6182
|
-
}
|
|
6183
|
-
/** JS truthiness of a primitive value. */
|
|
6184
|
-
function truthy(value) {
|
|
6185
|
-
return Boolean(value);
|
|
6186
|
-
}
|
|
6187
|
-
function requireFinite(value, context) {
|
|
6188
|
-
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${context} produced a non-finite result`);
|
|
6189
|
-
return value;
|
|
6190
|
-
}
|
|
6191
|
-
function step(ctx) {
|
|
6192
|
-
ctx.steps += 1;
|
|
6193
|
-
if (ctx.steps > ctx.maxSteps) throw new ExpressionEvalError("expression evaluation step budget exceeded");
|
|
6194
|
-
}
|
|
6195
|
-
function evalNode(node, ctx) {
|
|
6196
|
-
step(ctx);
|
|
6197
|
-
switch (node.kind) {
|
|
6198
|
-
case "literal": return node.value;
|
|
6199
|
-
case "identifier":
|
|
6200
|
-
if (!(node.name in ctx.scope)) throw new ExpressionEvalError(`unknown identifier: ${node.name}`);
|
|
6201
|
-
return ctx.scope[node.name];
|
|
6202
|
-
case "unary": return evalUnary(node.op, evalNode(node.operand, ctx));
|
|
6203
|
-
case "binary": return evalBinary(node.op, evalNode(node.left, ctx), evalNode(node.right, ctx));
|
|
6204
|
-
case "logical": {
|
|
6205
|
-
const left = evalNode(node.left, ctx);
|
|
6206
|
-
if (node.op === "&&") return truthy(left) ? evalNode(node.right, ctx) : left;
|
|
6207
|
-
return truthy(left) ? left : evalNode(node.right, ctx);
|
|
6208
|
-
}
|
|
6209
|
-
case "conditional": return truthy(evalNode(node.test, ctx)) ? evalNode(node.consequent, ctx) : evalNode(node.alternate, ctx);
|
|
6210
|
-
case "call": return evalCall(node.callee, node.args.map((a) => evalNode(a, ctx)), ctx.hooks);
|
|
6211
|
-
}
|
|
6212
|
-
}
|
|
6213
|
-
function evalUnary(op, operand) {
|
|
6214
|
-
if (op === "!") return !truthy(operand);
|
|
6215
|
-
if (!isFiniteNumber(operand)) throw new ExpressionEvalError("unary \"-\" requires a finite number");
|
|
6216
|
-
return requireFinite(-operand, "unary \"-\"");
|
|
6217
|
-
}
|
|
6218
|
-
function evalBinary(op, left, right) {
|
|
6219
|
-
switch (op) {
|
|
6220
|
-
case "==": return left === right;
|
|
6221
|
-
case "!=": return left !== right;
|
|
6222
|
-
case "+":
|
|
6223
|
-
if (typeof left === "string" && typeof right === "string") return left + right;
|
|
6224
|
-
if (isFiniteNumber(left) && isFiniteNumber(right)) return requireFinite(left + right, "\"+\"");
|
|
6225
|
-
throw new ExpressionEvalError("\"+\" requires two numbers or two strings");
|
|
6226
|
-
case "-":
|
|
6227
|
-
case "*":
|
|
6228
|
-
case "/":
|
|
6229
|
-
case "%":
|
|
6230
|
-
if (!isFiniteNumber(left) || !isFiniteNumber(right)) throw new ExpressionEvalError(`"${op}" requires two finite numbers`);
|
|
6231
|
-
return requireFinite(op === "-" ? left - right : op === "*" ? left * right : op === "/" ? left / right : left % right, `"${op}"`);
|
|
6232
|
-
case "<":
|
|
6233
|
-
case "<=":
|
|
6234
|
-
case ">":
|
|
6235
|
-
case ">=":
|
|
6236
|
-
if (isFiniteNumber(left) && isFiniteNumber(right)) return op === "<" ? left < right : op === "<=" ? left <= right : op === ">" ? left > right : left >= right;
|
|
6237
|
-
if (typeof left === "string" && typeof right === "string") return op === "<" ? left < right : op === "<=" ? left <= right : op === ">" ? left > right : left >= right;
|
|
6238
|
-
throw new ExpressionEvalError(`"${op}" requires two numbers or two strings`);
|
|
6239
|
-
}
|
|
6240
|
-
}
|
|
6241
|
-
function evalCall(callee, args, hooks) {
|
|
6242
|
-
if (!Object.prototype.hasOwnProperty.call(EXPRESSION_BUILTINS, callee)) throw new ExpressionEvalError(`unknown function: ${callee}`);
|
|
6243
|
-
const builtin = EXPRESSION_BUILTINS[callee];
|
|
6244
|
-
if (args.length < builtin.minArgs || args.length > builtin.maxArgs) throw new ExpressionEvalError(`${callee}: wrong number of arguments (${args.length})`);
|
|
6245
|
-
return builtin.apply(args, hooks);
|
|
6246
|
-
}
|
|
6247
|
-
/** Evaluate an AST node against a scope. Throws `ExpressionEvalError` on any
|
|
6248
|
-
* runtime failure (unknown identifier, type mismatch, non-finite result,
|
|
6249
|
-
* step-budget exhaustion). */
|
|
6250
|
-
function evaluateAst(node, scope, opts) {
|
|
6251
|
-
return evalNode(node, {
|
|
6252
|
-
scope,
|
|
6253
|
-
hooks: opts?.hooks ?? EMPTY_HOOKS,
|
|
6254
|
-
maxSteps: opts?.maxSteps ?? 4096,
|
|
6255
|
-
steps: 0
|
|
6256
|
-
});
|
|
6257
|
-
}
|
|
6258
|
-
//#endregion
|
|
6259
|
-
//#region src/expression/expression-source.ts
|
|
6260
|
-
/** The `now` epoch-ms binding is auto-injected into every evaluation and is a
|
|
6261
|
-
* reserved binding name (authors may not rebind it). */
|
|
6262
|
-
var EXPRESSION_INJECTED_NOW = "now";
|
|
6263
|
-
/**
|
|
6264
|
-
* Coerce an untrusted `getByPath` / mirror read to an `ExpressionValue`.
|
|
6265
|
-
* Non-primitive values (objects, arrays, `undefined`, functions, bigint,
|
|
6266
|
-
* symbol) and non-finite numbers become `undefined` so the caller can apply
|
|
6267
|
-
* its binding-miss policy (→ `null`). `null` itself is a valid value.
|
|
6268
|
-
*/
|
|
6269
|
-
function toExpressionValue(raw) {
|
|
6270
|
-
if (raw === null) return null;
|
|
6271
|
-
if (typeof raw === "string") return raw;
|
|
6272
|
-
if (typeof raw === "boolean") return raw;
|
|
6273
|
-
if (typeof raw === "number") return Number.isFinite(raw) ? raw : void 0;
|
|
6274
|
-
}
|
|
6275
|
-
/**
|
|
6276
|
-
* Author-time validation. Returns `null` when the source is valid, else a
|
|
6277
|
-
* human-readable error message. Checks: the expression compiles; binding count
|
|
6278
|
-
* is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
|
|
6279
|
-
* is not reserved (`now`/keywords) and does not shadow a builtin; and every
|
|
6280
|
-
* FREE identifier of the AST is covered by a binding or the injected `now`.
|
|
6281
|
-
*/
|
|
6282
|
-
function validateExpressionSource(src) {
|
|
6283
|
-
const names = Object.keys(src.bindings);
|
|
6284
|
-
if (names.length > 32) return `too many bindings (${names.length} > 32)`;
|
|
6285
|
-
for (const name of names) {
|
|
6286
|
-
if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
|
|
6287
|
-
if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
|
|
6288
|
-
if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
|
|
6289
|
-
}
|
|
6290
|
-
const compiled = compileExpressionSafe(src.expr);
|
|
6291
|
-
if (!compiled.ok) return compiled.error;
|
|
6292
|
-
const bound = new Set(names);
|
|
6293
|
-
for (const id of compiled.parsed.identifiers) {
|
|
6294
|
-
if (id === "now") continue;
|
|
6295
|
-
if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
|
|
6296
|
-
}
|
|
6297
|
-
return null;
|
|
6298
|
-
}
|
|
6299
|
-
/**
|
|
6300
|
-
* Shared read-path evaluation. Builds a null-proto scope from `bindingValues`
|
|
6301
|
-
* plus the injected `now` (supplied by the caller for determinism and
|
|
6302
|
-
* testability), compiles via the LRU, and evaluates. Any failure (parse or
|
|
6303
|
-
* eval) returns `{ ok: false }` — the caller treats that as "skip this
|
|
6304
|
-
* derivation", never as a throw that takes the pass down.
|
|
6305
|
-
*/
|
|
6306
|
-
function evaluateExpressionSource(expr, bindingValues, now, opts) {
|
|
6307
|
-
const compiled = compileExpressionSafe(expr);
|
|
6308
|
-
if (!compiled.ok) return {
|
|
6309
|
-
ok: false,
|
|
6310
|
-
error: compiled.error
|
|
6311
|
-
};
|
|
6312
|
-
const scope = createExpressionScope({
|
|
6313
|
-
...bindingValues,
|
|
6314
|
-
["now"]: now
|
|
6315
|
-
});
|
|
6316
|
-
const hooks = {
|
|
6317
|
-
...opts?.hooks,
|
|
6318
|
-
now
|
|
6319
|
-
};
|
|
6320
|
-
try {
|
|
6321
|
-
return {
|
|
6322
|
-
ok: true,
|
|
6323
|
-
value: evaluateAst(compiled.parsed.ast, scope, {
|
|
6324
|
-
...opts,
|
|
6325
|
-
hooks
|
|
6326
|
-
})
|
|
6327
|
-
};
|
|
6328
|
-
} catch (err) {
|
|
6329
|
-
return {
|
|
6330
|
-
ok: false,
|
|
6331
|
-
error: err instanceof ExpressionEvalError ? err.message : String(err)
|
|
6332
|
-
};
|
|
6333
|
-
}
|
|
6334
|
-
}
|
|
6335
|
-
//#endregion
|
|
6336
5533
|
//#region src/expression/binding-source.ts
|
|
6337
5534
|
/**
|
|
6338
5535
|
* What an expression's named bindings READ from.
|
|
@@ -10135,175 +9332,195 @@ function kebabToCamel(s) {
|
|
|
10135
9332
|
return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
10136
9333
|
}
|
|
10137
9334
|
//#endregion
|
|
10138
|
-
//#region src/
|
|
10139
|
-
/**
|
|
10140
|
-
*
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
});
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
* so the editor and the store cannot disagree.
|
|
10196
|
-
*/
|
|
10197
|
-
var CompositionExpressionSourceSchema = z.object({
|
|
10198
|
-
kind: z.literal("expression"),
|
|
10199
|
-
expr: z.string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
10200
|
-
bindings: z.record(z.string().regex(EXPRESSION_IDENTIFIER_RE), CompositionBindingSchema)
|
|
10201
|
-
}).superRefine((src, ctx) => {
|
|
10202
|
-
const err = validateExpressionSource(src);
|
|
10203
|
-
if (err !== null) ctx.addIssue({
|
|
10204
|
-
code: "custom",
|
|
10205
|
-
message: err,
|
|
10206
|
-
path: ["expr"]
|
|
10207
|
-
});
|
|
10208
|
-
});
|
|
10209
|
-
/** `code`: RESERVED for slice 4 (own runner, one-way eject). */
|
|
10210
|
-
var CompositionCodeSourceSchema = z.object({
|
|
10211
|
-
kind: z.literal("code"),
|
|
10212
|
-
code: z.string().min(1).max(MAX_COMPOSITION_CODE_LENGTH)
|
|
10213
|
-
});
|
|
10214
|
-
var CompositionFieldSourceSchema = z.discriminatedUnion("kind", [
|
|
10215
|
-
CompositionFromSourceSchema,
|
|
10216
|
-
CompositionExpressionSourceSchema,
|
|
10217
|
-
CompositionCodeSourceSchema
|
|
10218
|
-
]);
|
|
10219
|
-
/** `forward`: RESERVED for slice 3. Argument mapping arrives there as an additive optional `args`. */
|
|
10220
|
-
var CompositionForwardCommandSchema = z.object({
|
|
10221
|
-
kind: z.literal("forward"),
|
|
10222
|
-
source: CompositionSourceRefSchema,
|
|
10223
|
-
cap: z.string().min(1),
|
|
10224
|
-
method: z.string().min(1)
|
|
10225
|
-
});
|
|
10226
|
-
var CompositionCommandTargetSchema = z.discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
|
|
10227
|
-
var CompositionFieldsFeatureSchema = z.object({
|
|
10228
|
-
kind: z.literal("fields"),
|
|
10229
|
-
cap: z.string().min(1),
|
|
10230
|
-
fields: z.record(z.string().min(1), CompositionFieldSourceSchema).refine((fields) => Object.keys(fields).length <= 32, { message: `at most 32 fields per capability` }),
|
|
10231
|
-
/** RESERVED for slice 3; refused by the validator when non-empty. */
|
|
10232
|
-
commands: z.record(z.string().min(1), CompositionCommandTargetSchema).optional()
|
|
10233
|
-
});
|
|
10234
|
-
/** RESERVED for slice 3: a media / data-plane cap, whole, from one source. */
|
|
10235
|
-
var CompositionPassthroughFeatureSchema = z.object({
|
|
10236
|
-
kind: z.literal("passthrough"),
|
|
10237
|
-
cap: z.string().min(1),
|
|
10238
|
-
source: CompositionSourceRefSchema
|
|
10239
|
-
});
|
|
10240
|
-
var CompositionFeatureSchema = z.discriminatedUnion("kind", [CompositionFieldsFeatureSchema, CompositionPassthroughFeatureSchema]);
|
|
9335
|
+
//#region src/device/schema-fields.ts
|
|
9336
|
+
/** Unwrap ZodNullable / ZodOptional / ZodDefault wrappers to reach the inner type.
|
|
9337
|
+
* Zod v4 exposes `.unwrap()` on all three wrapper classes. */
|
|
9338
|
+
function unwrapSchema(schema) {
|
|
9339
|
+
let s = schema;
|
|
9340
|
+
while (s instanceof z.ZodNullable || s instanceof z.ZodOptional || s instanceof z.ZodDefault) s = s.unwrap();
|
|
9341
|
+
return s;
|
|
9342
|
+
}
|
|
9343
|
+
function leafKind(schema) {
|
|
9344
|
+
const s = unwrapSchema(schema);
|
|
9345
|
+
if (s instanceof z.ZodEnum) return {
|
|
9346
|
+
kind: "enum",
|
|
9347
|
+
enumValues: s.options
|
|
9348
|
+
};
|
|
9349
|
+
if (s instanceof z.ZodNumber) return { kind: "number" };
|
|
9350
|
+
if (s instanceof z.ZodString) return { kind: "string" };
|
|
9351
|
+
if (s instanceof z.ZodBoolean) return { kind: "boolean" };
|
|
9352
|
+
return null;
|
|
9353
|
+
}
|
|
9354
|
+
/** Walk a cap status schema into flat wireable leaf fields (dotted paths).
|
|
9355
|
+
* Recurses into nested ZodObject (unwrapping nullable/optional/default first),
|
|
9356
|
+
* so fields with null live values are still offered. Arrays / unknown shapes
|
|
9357
|
+
* are skipped — never throws. */
|
|
9358
|
+
function enumerateSchemaFields(schema, prefix = "") {
|
|
9359
|
+
const root = unwrapSchema(schema);
|
|
9360
|
+
if (!(root instanceof z.ZodObject)) return [];
|
|
9361
|
+
const out = [];
|
|
9362
|
+
const shape = root.shape;
|
|
9363
|
+
for (const [key, field] of Object.entries(shape)) {
|
|
9364
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
9365
|
+
const inner = unwrapSchema(field);
|
|
9366
|
+
if (inner instanceof z.ZodObject) {
|
|
9367
|
+
out.push(...enumerateSchemaFields(inner, path));
|
|
9368
|
+
continue;
|
|
9369
|
+
}
|
|
9370
|
+
const leaf = leafKind(field);
|
|
9371
|
+
if (leaf) out.push({
|
|
9372
|
+
path,
|
|
9373
|
+
kind: leaf.kind,
|
|
9374
|
+
...leaf.enumValues ? { enumValues: leaf.enumValues } : {}
|
|
9375
|
+
});
|
|
9376
|
+
}
|
|
9377
|
+
return out;
|
|
9378
|
+
}
|
|
9379
|
+
/** Enumerate the per-item wireable fields of an item-array cap (see
|
|
9380
|
+
* `CapabilityStatusItemArray`): the item schema's leaf fields, minus the
|
|
9381
|
+
* `keyField` (the key comes from the link's `itemKey`, never from a wired
|
|
9382
|
+
* source), each tagged `item: true` so the authoring UI collects an
|
|
9383
|
+
* `itemKey` alongside the field. Never throws. */
|
|
9384
|
+
function enumerateItemArrayFields(itemArray) {
|
|
9385
|
+
return enumerateSchemaFields(itemArray.itemSchema).filter((f) => f.path !== itemArray.keyField).map((f) => ({
|
|
9386
|
+
...f,
|
|
9387
|
+
item: true
|
|
9388
|
+
}));
|
|
9389
|
+
}
|
|
9390
|
+
//#endregion
|
|
9391
|
+
//#region src/composition/state-fields.ts
|
|
10241
9392
|
/**
|
|
10242
|
-
*
|
|
10243
|
-
*
|
|
9393
|
+
* What a capability's state field IS: kind, nullability, whether required. The
|
|
9394
|
+
* validator needs nullability, which `enumerateSchemaFields` does not report,
|
|
9395
|
+
* and that decides a field's unavailable mode (D393).
|
|
10244
9396
|
*/
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
var CompositionTargetSchema = z.discriminatedUnion("kind", [CompositionNewTargetSchema, CompositionExistingTargetSchema]);
|
|
10256
|
-
var CompositionSchema = z.object({
|
|
10257
|
-
target: CompositionTargetSchema,
|
|
10258
|
-
features: z.array(CompositionFeatureSchema).min(1).max(16)
|
|
10259
|
-
}).superRefine((composition, ctx) => {
|
|
10260
|
-
const seen = /* @__PURE__ */ new Set();
|
|
10261
|
-
composition.features.forEach((feature, index) => {
|
|
10262
|
-
if (seen.has(feature.cap)) ctx.addIssue({
|
|
10263
|
-
code: "custom",
|
|
10264
|
-
message: `capability \`${feature.cap}\` is composed twice — one feature per capability`,
|
|
10265
|
-
path: [
|
|
10266
|
-
"features",
|
|
10267
|
-
index,
|
|
10268
|
-
"cap"
|
|
10269
|
-
]
|
|
10270
|
-
});
|
|
10271
|
-
seen.add(feature.cap);
|
|
10272
|
-
});
|
|
10273
|
-
});
|
|
10274
|
-
function compositionSourceKey(ref) {
|
|
10275
|
-
return `${ref.addonId}/${ref.stableId}`;
|
|
9397
|
+
function fieldAt(schema, path) {
|
|
9398
|
+
let current = schema;
|
|
9399
|
+
for (const segment of path.split(".")) {
|
|
9400
|
+
const container = unwrapSchema(current);
|
|
9401
|
+
if (!(container instanceof z.ZodObject)) return null;
|
|
9402
|
+
const next = container.shape[segment];
|
|
9403
|
+
if (!(next instanceof z.ZodType)) return null;
|
|
9404
|
+
current = next;
|
|
9405
|
+
}
|
|
9406
|
+
return current;
|
|
10276
9407
|
}
|
|
10277
|
-
function
|
|
10278
|
-
|
|
9408
|
+
function describeStateField(schema, path) {
|
|
9409
|
+
const leaf = enumerateSchemaFields(schema).find((f) => f.path === path);
|
|
9410
|
+
if (leaf === void 0) return null;
|
|
9411
|
+
const field = fieldAt(schema, path);
|
|
9412
|
+
if (field === null) return null;
|
|
9413
|
+
return {
|
|
9414
|
+
path,
|
|
9415
|
+
kind: leaf.kind,
|
|
9416
|
+
nullable: field.safeParse(null).success,
|
|
9417
|
+
required: !field.safeParse(void 0).success,
|
|
9418
|
+
...leaf.enumValues === void 0 ? {} : { enumValues: leaf.enumValues }
|
|
9419
|
+
};
|
|
10279
9420
|
}
|
|
10280
|
-
function
|
|
10281
|
-
return
|
|
9421
|
+
function describeTopLevelStateFields(schema) {
|
|
9422
|
+
return new Map(enumerateSchemaFields(schema).filter((f) => !f.path.includes(".")).flatMap((f) => {
|
|
9423
|
+
const described = describeStateField(schema, f.path);
|
|
9424
|
+
return described === null ? [] : [[f.path, described]];
|
|
9425
|
+
}));
|
|
10282
9426
|
}
|
|
10283
|
-
|
|
10284
|
-
|
|
9427
|
+
/** Top-level keys a value MUST carry: those whose schema refuses `undefined`. */
|
|
9428
|
+
function requiredTopLevelKeys(schema) {
|
|
9429
|
+
const root = unwrapSchema(schema);
|
|
9430
|
+
if (!(root instanceof z.ZodObject)) return [];
|
|
9431
|
+
return Object.entries(root.shape).flatMap(([key, field]) => field instanceof z.ZodType && !field.safeParse(void 0).success ? [key] : []);
|
|
10285
9432
|
}
|
|
10286
|
-
|
|
9433
|
+
/**
|
|
9434
|
+
* The proper prefixes of `path` whose schema accepts `undefined`: a required
|
|
9435
|
+
* leaf under one of them is required only once something writes that parent
|
|
9436
|
+
* (`remaining.unit` is required only when `remaining` is present).
|
|
9437
|
+
*/
|
|
9438
|
+
function optionalAncestors(schema, path) {
|
|
9439
|
+
const segments = path.split(".");
|
|
9440
|
+
return segments.slice(0, -1).flatMap((_, i) => {
|
|
9441
|
+
const prefix = segments.slice(0, i + 1).join(".");
|
|
9442
|
+
const field = fieldAt(schema, prefix);
|
|
9443
|
+
return field !== null && field.safeParse(void 0).success ? [prefix] : [];
|
|
9444
|
+
});
|
|
9445
|
+
}
|
|
9446
|
+
//#endregion
|
|
9447
|
+
//#region src/composition/composition-events.ts
|
|
9448
|
+
var COMPOSITION_EVENT_CATEGORY = { "doorbell.onPressed": EventCategory.DoorbellOnPressed };
|
|
9449
|
+
var EVENT_CATEGORIES = COMPOSITION_EVENT_CATEGORY;
|
|
9450
|
+
var CompositionEventPlanSchema = z.object({
|
|
9451
|
+
featureIndex: z.number().int().nonnegative(),
|
|
9452
|
+
cap: z.string(),
|
|
9453
|
+
eventName: z.string(),
|
|
9454
|
+
category: z.enum(EventCategory),
|
|
9455
|
+
stateField: z.string(),
|
|
9456
|
+
fieldKey: z.string()
|
|
9457
|
+
});
|
|
9458
|
+
function eventProblem(code, path, message) {
|
|
10287
9459
|
return {
|
|
10288
|
-
|
|
10289
|
-
|
|
9460
|
+
code,
|
|
9461
|
+
path,
|
|
9462
|
+
message
|
|
10290
9463
|
};
|
|
10291
9464
|
}
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
9465
|
+
function payloadReason(error) {
|
|
9466
|
+
return error.issues.map((issue) => `${issue.path.length === 0 ? "payload" : issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
9467
|
+
}
|
|
9468
|
+
/**
|
|
9469
|
+
* Plan one capability's state-derived events after its feature mode and fields
|
|
9470
|
+
* are known. A native replacement never becomes a second event authority.
|
|
9471
|
+
*/
|
|
9472
|
+
function planCompositionEvents(def, feature, fields) {
|
|
9473
|
+
if (feature.mode === "replace") return {
|
|
9474
|
+
problems: [],
|
|
9475
|
+
events: []
|
|
9476
|
+
};
|
|
9477
|
+
const problems = [];
|
|
9478
|
+
const events = [];
|
|
9479
|
+
for (const [eventName, declaration] of Object.entries(def.events ?? {})) {
|
|
9480
|
+
const fromState = declaration.fromState;
|
|
9481
|
+
if (fromState === void 0) continue;
|
|
9482
|
+
const statePath = `features[${feature.featureIndex}].fields.${fromState.field}`;
|
|
9483
|
+
const state = def.runtimeState ? describeStateField(def.runtimeState, fromState.field) : null;
|
|
9484
|
+
if (state === null) {
|
|
9485
|
+
problems.push(eventProblem("unknown-field", statePath, `\`${def.name}.${eventName}\` derives from missing state field \`${fromState.field}\``));
|
|
9486
|
+
continue;
|
|
9487
|
+
}
|
|
9488
|
+
if (state.kind !== "number") {
|
|
9489
|
+
problems.push(eventProblem("kind-mismatch", statePath, `\`${def.name}.${eventName}\` needs a numeric state field; \`${fromState.field}\` is ${state.kind}`));
|
|
9490
|
+
continue;
|
|
9491
|
+
}
|
|
9492
|
+
const eventKey = `${def.name}.${eventName}`;
|
|
9493
|
+
const category = EVENT_CATEGORIES[eventKey];
|
|
9494
|
+
if (category === void 0) {
|
|
9495
|
+
problems.push(eventProblem("not-composable", `features[${feature.featureIndex}].cap`, `\`${eventKey}\` has no explicit composition event-category mapping`));
|
|
9496
|
+
continue;
|
|
9497
|
+
}
|
|
9498
|
+
const payload = declaration.data.safeParse({
|
|
9499
|
+
deviceId: 1,
|
|
9500
|
+
timestamp: 1
|
|
9501
|
+
});
|
|
9502
|
+
if (!payload.success) {
|
|
9503
|
+
problems.push(eventProblem("not-composable", `features[${feature.featureIndex}].cap`, `\`${eventKey}\` cannot be derived from { deviceId, timestamp }: ${payloadReason(payload.error)}`));
|
|
9504
|
+
continue;
|
|
9505
|
+
}
|
|
9506
|
+
const field = fields.find((candidate) => candidate.featureIndex === feature.featureIndex && candidate.cap === def.name && candidate.path === fromState.field && candidate.item === void 0);
|
|
9507
|
+
if (field === void 0) {
|
|
9508
|
+
problems.push(eventProblem("unknown-field", statePath, `\`${eventKey}\` derives from \`${fromState.field}\`, but that field is not composed`));
|
|
9509
|
+
continue;
|
|
9510
|
+
}
|
|
9511
|
+
events.push({
|
|
9512
|
+
featureIndex: feature.featureIndex,
|
|
9513
|
+
cap: def.name,
|
|
9514
|
+
eventName,
|
|
9515
|
+
category,
|
|
9516
|
+
stateField: fromState.field,
|
|
9517
|
+
fieldKey: `${field.cap}.${field.path}`
|
|
9518
|
+
});
|
|
10306
9519
|
}
|
|
9520
|
+
return {
|
|
9521
|
+
problems,
|
|
9522
|
+
events
|
|
9523
|
+
};
|
|
10307
9524
|
}
|
|
10308
9525
|
//#endregion
|
|
10309
9526
|
//#region src/composition/composition-report.ts
|
|
@@ -10328,7 +9545,12 @@ var CompositionProblemCodeSchema = z.enum([
|
|
|
10328
9545
|
"source-field-unknown",
|
|
10329
9546
|
"expression-invalid",
|
|
10330
9547
|
"cycle",
|
|
10331
|
-
"duplicate-target"
|
|
9548
|
+
"duplicate-target",
|
|
9549
|
+
"not-item-array",
|
|
9550
|
+
"item-field-reserved",
|
|
9551
|
+
"target-missing",
|
|
9552
|
+
"target-unreadable",
|
|
9553
|
+
"not-replaceable"
|
|
10332
9554
|
]);
|
|
10333
9555
|
/** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.celsius`. */
|
|
10334
9556
|
var CompositionProblemSchema = z.object({
|
|
@@ -10342,20 +9564,40 @@ var CompositionFieldKindSchema = z.enum([
|
|
|
10342
9564
|
"boolean",
|
|
10343
9565
|
"enum"
|
|
10344
9566
|
]);
|
|
10345
|
-
/**
|
|
10346
|
-
|
|
9567
|
+
/**
|
|
9568
|
+
* How a field says "unavailable" (D393, D663): `null` when its schema allows it;
|
|
9569
|
+
* `unknown` — the enum's own word — for an ADDED field that has one; `release`
|
|
9570
|
+
* for a REPLACED field of an existing device, whose claim is released so the
|
|
9571
|
+
* native provider's reading shows again; else the (composed) device goes offline.
|
|
9572
|
+
*/
|
|
9573
|
+
var CompositionUnavailableModeSchema = z.enum([
|
|
9574
|
+
"null",
|
|
9575
|
+
"offline",
|
|
9576
|
+
"unknown",
|
|
9577
|
+
"release"
|
|
9578
|
+
]);
|
|
10347
9579
|
/**
|
|
10348
9580
|
* `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
|
|
10349
|
-
* field of its cap changes value · `constant` reads nothing, computed once
|
|
9581
|
+
* field of its cap changes value · `constant` reads nothing, computed once ·
|
|
9582
|
+
* `accumulator` advances from the target's seed/current output.
|
|
10350
9583
|
*/
|
|
10351
9584
|
var CompositionFieldRoleSchema = z.enum([
|
|
10352
9585
|
"derived",
|
|
10353
9586
|
"clock",
|
|
10354
|
-
"constant"
|
|
9587
|
+
"constant",
|
|
9588
|
+
"accumulator"
|
|
10355
9589
|
]);
|
|
9590
|
+
/** The item a planned field belongs to; its `path` is then the dotted path INSIDE the item. */
|
|
9591
|
+
var CompositionFieldItemSchema = z.object({
|
|
9592
|
+
arrayPath: z.string(),
|
|
9593
|
+
key: z.string(),
|
|
9594
|
+
label: z.string()
|
|
9595
|
+
});
|
|
10356
9596
|
var CompositionFieldPlanSchema = z.object({
|
|
10357
9597
|
cap: z.string(),
|
|
9598
|
+
/** Top-level field, or — when `item` is set — the dotted path inside that item. */
|
|
10358
9599
|
path: z.string(),
|
|
9600
|
+
item: CompositionFieldItemSchema.optional(),
|
|
10359
9601
|
/** Index into `composition.features` this field's capability came from —
|
|
10360
9602
|
* lets a source/cycle problem name its path as `features[N].fields.<path>`
|
|
10361
9603
|
* (the same convention `planComposition`'s own problems already use). */
|
|
@@ -10368,16 +9610,44 @@ var CompositionFieldPlanSchema = z.object({
|
|
|
10368
9610
|
source: CompositionFieldSourceSchema,
|
|
10369
9611
|
reads: z.array(CompositionFieldReadSchema)
|
|
10370
9612
|
});
|
|
9613
|
+
/** The key every record map, log line and graph node uses for a planned field. Two items' `status` are two keys. */
|
|
9614
|
+
function compositionFieldKey(plan) {
|
|
9615
|
+
const path = plan.item === void 0 ? plan.path : compositionItemFieldPath(plan.item.arrayPath, plan.item.key, plan.path);
|
|
9616
|
+
return `${plan.cap}.${path}`;
|
|
9617
|
+
}
|
|
9618
|
+
/**
|
|
9619
|
+
* What a feature does to its target (D663): `new` builds a capability on a new
|
|
9620
|
+
* device; on an existing device it `add`s a capability the device lacks, or
|
|
9621
|
+
* `replace`s named fields of one it has natively.
|
|
9622
|
+
*/
|
|
9623
|
+
var CompositionFeatureModeSchema = z.enum([
|
|
9624
|
+
"new",
|
|
9625
|
+
"add",
|
|
9626
|
+
"replace"
|
|
9627
|
+
]);
|
|
9628
|
+
var CompositionFeaturePlanSchema = z.object({
|
|
9629
|
+
/** Index in the stored feature array; disabled features are omitted rather than re-indexed. */
|
|
9630
|
+
featureIndex: z.number().int().nonnegative(),
|
|
9631
|
+
cap: z.string(),
|
|
9632
|
+
mode: CompositionFeatureModeSchema
|
|
9633
|
+
});
|
|
10371
9634
|
var CompositionValidationSchema = z.object({
|
|
10372
9635
|
ok: z.boolean(),
|
|
10373
9636
|
problems: z.array(CompositionProblemSchema),
|
|
10374
|
-
fields: z.array(CompositionFieldPlanSchema)
|
|
9637
|
+
fields: z.array(CompositionFieldPlanSchema),
|
|
9638
|
+
features: z.array(CompositionFeaturePlanSchema),
|
|
9639
|
+
events: z.array(CompositionEventPlanSchema)
|
|
10375
9640
|
});
|
|
10376
|
-
/**
|
|
9641
|
+
/**
|
|
9642
|
+
* Mirrors `CoreBlockStatus`, pinned by `core-blocks-source.spec.ts`. `degraded`:
|
|
9643
|
+
* running, but a replaced field is released to the native provider while its
|
|
9644
|
+
* source is unavailable (ruling S1b, D663) — the reason names each such field.
|
|
9645
|
+
*/
|
|
10377
9646
|
var CompositionRunStatusSchema = z.enum([
|
|
10378
9647
|
"stopped",
|
|
10379
9648
|
"starting",
|
|
10380
9649
|
"running",
|
|
9650
|
+
"degraded",
|
|
10381
9651
|
"failed"
|
|
10382
9652
|
]);
|
|
10383
9653
|
var CompositionFieldStateKindSchema = z.enum([
|
|
@@ -10388,6 +9658,8 @@ var CompositionFieldStateKindSchema = z.enum([
|
|
|
10388
9658
|
var CompositionFieldStateSchema = z.object({
|
|
10389
9659
|
cap: z.string(),
|
|
10390
9660
|
path: z.string(),
|
|
9661
|
+
/** Same as the plan's: two items' `status` are told apart by it. */
|
|
9662
|
+
item: CompositionFieldItemSchema.optional(),
|
|
10391
9663
|
state: CompositionFieldStateKindSchema,
|
|
10392
9664
|
/** `null` whenever `state === 'unavailable'`; never a plausible stand-in (D393). */
|
|
10393
9665
|
value: z.union([
|
|
@@ -10469,11 +9741,14 @@ function coreBlockIdFromAddonId(addonId) {
|
|
|
10469
9741
|
* agent is the reason placement is not fixed to the hub. */
|
|
10470
9742
|
var CoreBlockPlacementSchema = z.union([z.literal("hub"), z.string().min(1)]);
|
|
10471
9743
|
/** What a block's process is doing. Mirrors the addon runner's own lifecycle so
|
|
10472
|
-
* a failing block reads the same way a failing addon does.
|
|
9744
|
+
* a failing block reads the same way a failing addon does. `degraded` is a
|
|
9745
|
+
* composition on an existing device with a field handed back to the native
|
|
9746
|
+
* provider while its source is unavailable (S1b, D663); the error names it. */
|
|
10473
9747
|
var CoreBlockStatusSchema = z.enum([
|
|
10474
9748
|
"stopped",
|
|
10475
9749
|
"starting",
|
|
10476
9750
|
"running",
|
|
9751
|
+
"degraded",
|
|
10477
9752
|
"failed"
|
|
10478
9753
|
]);
|
|
10479
9754
|
/** Client-authored fields. */
|
|
@@ -10509,9 +9784,16 @@ var CoreBlockSourceSchema = z.discriminatedUnion("kind", [
|
|
|
10509
9784
|
composition: CompositionSchema
|
|
10510
9785
|
})
|
|
10511
9786
|
]);
|
|
10512
|
-
/**
|
|
9787
|
+
/**
|
|
9788
|
+
* The client-authored half of a composition block. No `code`, no placement (hub-only; Phase 7).
|
|
9789
|
+
*
|
|
9790
|
+
* `name`: REQUIRED for a `new` target — the block's name IS the device's name
|
|
9791
|
+
* (D659). ABSENT for an `existing` target — a customization has no name of its
|
|
9792
|
+
* own; the server derives one (`customizationBlockName`, D663) and refuses a
|
|
9793
|
+
* client-sent name by name.
|
|
9794
|
+
*/
|
|
10513
9795
|
var CompositionBlockInputSchema = z.object({
|
|
10514
|
-
name: z.string().min(1).max(120),
|
|
9796
|
+
name: z.string().min(1).max(120).optional(),
|
|
10515
9797
|
enabled: z.boolean(),
|
|
10516
9798
|
composition: CompositionSchema
|
|
10517
9799
|
});
|
|
@@ -10570,6 +9852,11 @@ var CompositionGetReadSchema = z.discriminatedUnion("state", [z.object({
|
|
|
10570
9852
|
state: z.literal("loaded"),
|
|
10571
9853
|
view: CompositionViewSchema.nullable()
|
|
10572
9854
|
}), CompositionsNotLoadedSchema]);
|
|
9855
|
+
/** The customization of one existing device, found by its TARGET, or `not-loaded` (D315). */
|
|
9856
|
+
var CompositionCustomizationReadSchema = z.discriminatedUnion("state", [z.object({
|
|
9857
|
+
state: z.literal("loaded"),
|
|
9858
|
+
view: CompositionViewSchema.nullable()
|
|
9859
|
+
}), CompositionsNotLoadedSchema]);
|
|
10573
9860
|
/** What a compile attempt produced. */
|
|
10574
9861
|
var CoreBlockCompileResultSchema = z.object({
|
|
10575
9862
|
ok: z.boolean(),
|
|
@@ -10680,6 +9967,14 @@ var coreBlocksCapability = {
|
|
|
10680
9967
|
getComposition: method(z.object({ blockId: z.string() }), CompositionGetReadSchema, { auth: "admin" }),
|
|
10681
9968
|
listCompositions: method(z.object({}), CompositionListReadSchema, { auth: "admin" }),
|
|
10682
9969
|
/**
|
|
9970
|
+
* The composition that customizes an existing device (D663), found by its
|
|
9971
|
+
* TARGET — never by the block's derived name. One per device at most.
|
|
9972
|
+
*/
|
|
9973
|
+
getCustomization: method(z.object({
|
|
9974
|
+
addonId: z.string().min(1),
|
|
9975
|
+
stableId: z.string().min(1)
|
|
9976
|
+
}), CompositionCustomizationReadSchema, { auth: "admin" }),
|
|
9977
|
+
/**
|
|
10683
9978
|
* Validate without saving — the same verdict the save reaches. A mutation
|
|
10684
9979
|
* for its body size; it writes nothing, so its access is `view`.
|
|
10685
9980
|
*/
|
|
@@ -14200,6 +13495,52 @@ var deviceManagerCapability = {
|
|
|
14200
13495
|
//#endregion
|
|
14201
13496
|
//#region src/capabilities/device-state.cap.ts
|
|
14202
13497
|
/**
|
|
13498
|
+
* Per-field ownership (D663). A composition may CLAIM fields of a native
|
|
13499
|
+
* cap's runtime-state slice on an existing device: `replace` overlays the
|
|
13500
|
+
* claimed fields on the native slice, `add` builds a slice the device does
|
|
13501
|
+
* not natively have. Declared here — once — so the hub mirror (Task 5) and
|
|
13502
|
+
* the claim methods (Task 6) share one union.
|
|
13503
|
+
*/
|
|
13504
|
+
var FieldClaimModeSchema = z.enum(["replace", "add"]);
|
|
13505
|
+
/** What a claim, patch or release answers. A refusal always names its reason. */
|
|
13506
|
+
var ClaimOutcomeSchema = z.discriminatedUnion("ok", [z.object({
|
|
13507
|
+
ok: z.literal(true),
|
|
13508
|
+
changed: z.boolean()
|
|
13509
|
+
}), z.object({
|
|
13510
|
+
ok: z.literal(false),
|
|
13511
|
+
code: z.enum([
|
|
13512
|
+
"owned-by-other",
|
|
13513
|
+
"not-claimed",
|
|
13514
|
+
"field-not-claimed",
|
|
13515
|
+
"invalid-slice",
|
|
13516
|
+
"unknown-device",
|
|
13517
|
+
"row-unreadable",
|
|
13518
|
+
"migration-in-flight"
|
|
13519
|
+
]),
|
|
13520
|
+
message: z.string()
|
|
13521
|
+
})]);
|
|
13522
|
+
/** One claim as `listClaims` reports it. `fields` is the PLANNED set, explicit (ruling S5). */
|
|
13523
|
+
var FieldClaimSchema = z.object({
|
|
13524
|
+
deviceId: z.number(),
|
|
13525
|
+
capName: z.string(),
|
|
13526
|
+
owner: z.string().min(1),
|
|
13527
|
+
mode: FieldClaimModeSchema,
|
|
13528
|
+
fields: z.array(z.string().min(1)).min(1)
|
|
13529
|
+
});
|
|
13530
|
+
/**
|
|
13531
|
+
* What `listClaims` answers. The claims INDEX is a listing projection loaded
|
|
13532
|
+
* from the settings store at boot; until a load has succeeded it is
|
|
13533
|
+
* `not-loaded`, never `[]` — an unanswered question must not look like an
|
|
13534
|
+
* empty answer (D315).
|
|
13535
|
+
*/
|
|
13536
|
+
var ClaimsListingSchema = z.discriminatedUnion("state", [z.object({
|
|
13537
|
+
state: z.literal("loaded"),
|
|
13538
|
+
claims: z.array(FieldClaimSchema)
|
|
13539
|
+
}), z.object({
|
|
13540
|
+
state: z.literal("not-loaded"),
|
|
13541
|
+
reason: z.string()
|
|
13542
|
+
})]);
|
|
13543
|
+
/**
|
|
14203
13544
|
* `deviceState` — generic, cap-agnostic surface for cross-process
|
|
14204
13545
|
* access to per-device runtime state. Read pendant for every cap's
|
|
14205
13546
|
* runtime-state slice + the canonical write entrypoint. Mirrors the
|
|
@@ -14230,8 +13571,12 @@ var deviceStateCapability = {
|
|
|
14230
13571
|
/** Full state snapshot for one device. Empty object if no
|
|
14231
13572
|
* cap-keyed slice has been written yet. */
|
|
14232
13573
|
getSnapshot: method(z.object({ deviceId: z.number() }), z.record(z.string(), z.record(z.string(), z.unknown()))),
|
|
14233
|
-
/**
|
|
14234
|
-
*
|
|
13574
|
+
/**
|
|
13575
|
+
* Single cap slice — the EFFECTIVE one: the merge every consumer sees, null
|
|
13576
|
+
* when the slice hasn't been written, the device isn't registered, or a
|
|
13577
|
+
* claim HOLDS the cap (D663). Never the native shadow — that is
|
|
13578
|
+
* `getNativeCapSlice`, admin-only.
|
|
13579
|
+
*/
|
|
14235
13580
|
getCapSlice: method(z.object({
|
|
14236
13581
|
deviceId: z.number(),
|
|
14237
13582
|
capName: z.string()
|
|
@@ -14276,7 +13621,66 @@ var deviceStateCapability = {
|
|
|
14276
13621
|
deviceId: z.number(),
|
|
14277
13622
|
capName: z.string(),
|
|
14278
13623
|
slice: z.record(z.string(), z.unknown())
|
|
14279
|
-
}), z.void(), { kind: "mutation" })
|
|
13624
|
+
}), z.void(), { kind: "mutation" }),
|
|
13625
|
+
/**
|
|
13626
|
+
* Claim `fields` of `capName` on a device for `owner`. The PLANNED field set
|
|
13627
|
+
* is explicit (ruling S5): `values` may be partial and MUST be a subset of
|
|
13628
|
+
* `fields` (else `field-not-claimed`); a claimed field with no value is HELD,
|
|
13629
|
+
* never answered from the native. A re-claim by the same owner REPLACES
|
|
13630
|
+
* `fields` and MERGES `values` — a field dropped from `fields` loses its
|
|
13631
|
+
* value. Another owner's claim → `owned-by-other`.
|
|
13632
|
+
*/
|
|
13633
|
+
claimFields: method(z.object({
|
|
13634
|
+
deviceId: z.number(),
|
|
13635
|
+
capName: z.string(),
|
|
13636
|
+
owner: z.string().min(1),
|
|
13637
|
+
mode: FieldClaimModeSchema,
|
|
13638
|
+
fields: z.array(z.string().min(1)).min(1),
|
|
13639
|
+
values: z.record(z.string(), z.unknown())
|
|
13640
|
+
}), ClaimOutcomeSchema, {
|
|
13641
|
+
kind: "mutation",
|
|
13642
|
+
auth: "admin"
|
|
13643
|
+
}),
|
|
13644
|
+
/**
|
|
13645
|
+
* Write owned values. Every key of `values` must be in the claim's `fields`
|
|
13646
|
+
* (`field-not-claimed`); no claim → `not-claimed`; another owner's →
|
|
13647
|
+
* `owned-by-other`. Partial patches merge (S5); debounced like a native slice.
|
|
13648
|
+
*/
|
|
13649
|
+
patchOwnedFields: method(z.object({
|
|
13650
|
+
deviceId: z.number(),
|
|
13651
|
+
capName: z.string(),
|
|
13652
|
+
owner: z.string().min(1),
|
|
13653
|
+
values: z.record(z.string(), z.unknown())
|
|
13654
|
+
}), ClaimOutcomeSchema, {
|
|
13655
|
+
kind: "mutation",
|
|
13656
|
+
auth: "admin"
|
|
13657
|
+
}),
|
|
13658
|
+
/**
|
|
13659
|
+
* Hand the cap back. A `replace` re-emits the native slice exactly as last
|
|
13660
|
+
* written; an `add` leaves the mirror. `not-claimed` also removes a stale
|
|
13661
|
+
* index entry — the index self-heals through this method.
|
|
13662
|
+
*/
|
|
13663
|
+
releaseClaim: method(z.object({
|
|
13664
|
+
deviceId: z.number(),
|
|
13665
|
+
capName: z.string(),
|
|
13666
|
+
owner: z.string().min(1)
|
|
13667
|
+
}), ClaimOutcomeSchema, {
|
|
13668
|
+
kind: "mutation",
|
|
13669
|
+
auth: "admin"
|
|
13670
|
+
}),
|
|
13671
|
+
/** Every claim the index lists, optionally those whose owner starts with `ownerPrefix`. */
|
|
13672
|
+
listClaims: method(z.object({ ownerPrefix: z.string().optional() }), ClaimsListingSchema, { auth: "admin" }),
|
|
13673
|
+
/**
|
|
13674
|
+
* The NATIVE slice — what the provider wrote, the shadow under a `replace`
|
|
13675
|
+
* claim — for the owner's derived reads. Admin-only (D224, ruled in the
|
|
13676
|
+
* Task 6 review): the shadow is a second truth beside the merge, and the
|
|
13677
|
+
* event channel already refuses it to everyone but the composer; a
|
|
13678
|
+
* protected read of it would hand out what the events withhold.
|
|
13679
|
+
*/
|
|
13680
|
+
getNativeCapSlice: method(z.object({
|
|
13681
|
+
deviceId: z.number(),
|
|
13682
|
+
capName: z.string()
|
|
13683
|
+
}), z.record(z.string(), z.unknown()).nullable(), { auth: "admin" })
|
|
14280
13684
|
},
|
|
14281
13685
|
events: {
|
|
14282
13686
|
/**
|
|
@@ -30571,172 +29975,6 @@ var CLIP_PLAYBACK_OPTIONS = {
|
|
|
30571
29975
|
}
|
|
30572
29976
|
};
|
|
30573
29977
|
//#endregion
|
|
30574
|
-
//#region src/catalogs/sensor-active-state.ts
|
|
30575
|
-
/**
|
|
30576
|
-
* LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
|
|
30577
|
-
* valutatore puro del suo FRONTE.
|
|
30578
|
-
*
|
|
30579
|
-
* Viveva dentro il builtin virtual-doorbell
|
|
30580
|
-
* (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
|
|
30581
|
-
* predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
|
|
30582
|
-
* `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
|
|
30583
|
-
* tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
|
|
30584
|
-
* fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
|
|
30585
|
-
* SPOSTA qui e il doorbell la ri-esporta.
|
|
30586
|
-
*
|
|
30587
|
-
* ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
|
|
30588
|
-
* due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
|
|
30589
|
-
* regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
|
|
30590
|
-
* booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
|
|
30591
|
-
*/
|
|
30592
|
-
/**
|
|
30593
|
-
* Known binary / switch source caps → the boolean slice field whose
|
|
30594
|
-
* false→true rise counts as ACTIVE. Every entry is "fire on active".
|
|
30595
|
-
* Sensors whose "active" reading is not a plain boolean (presence's string
|
|
30596
|
-
* state, connectivity's connected flag) are deliberately excluded — a
|
|
30597
|
-
* reconnect is not a doorbell press, and it is not a recording either.
|
|
30598
|
-
*/
|
|
30599
|
-
var SOURCE_CAP_ACTIVE_FIELD = {
|
|
30600
|
-
contact: "entryOpen",
|
|
30601
|
-
binary: "on",
|
|
30602
|
-
switch: "on",
|
|
30603
|
-
motion: "detected",
|
|
30604
|
-
flood: "flooded",
|
|
30605
|
-
gas: "detected",
|
|
30606
|
-
smoke: "detected",
|
|
30607
|
-
"carbon-monoxide": "detected",
|
|
30608
|
-
vibration: "detected",
|
|
30609
|
-
tamper: "tampered"
|
|
30610
|
-
};
|
|
30611
|
-
/**
|
|
30612
|
-
* The same caps → the slice field carrying the ms-epoch timestamp of the
|
|
30613
|
-
* last transition. Every source cap MUST appear here (guarded by a spec):
|
|
30614
|
-
* without a transition timestamp the evaluator cannot tell a genuine rise
|
|
30615
|
-
* from a boot-time hydration when the FIRST slice it ever sees is already
|
|
30616
|
-
* active, and errs towards silence — swallowing the rise.
|
|
30617
|
-
*
|
|
30618
|
-
* These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
|
|
30619
|
-
* provider derives them from `state.last_changed`, so they survive our own
|
|
30620
|
-
* restarts and correctly read as "hours ago" for a state that has been
|
|
30621
|
-
* active for hours. `motion` names its rise timestamp `lastDetectedAt`.
|
|
30622
|
-
*/
|
|
30623
|
-
var SOURCE_CAP_CHANGED_AT_FIELD = {
|
|
30624
|
-
contact: "lastChangedAt",
|
|
30625
|
-
binary: "lastChangedAt",
|
|
30626
|
-
switch: "lastChangedAt",
|
|
30627
|
-
motion: "lastDetectedAt",
|
|
30628
|
-
flood: "lastChangedAt",
|
|
30629
|
-
gas: "lastChangedAt",
|
|
30630
|
-
smoke: "lastChangedAt",
|
|
30631
|
-
"carbon-monoxide": "lastChangedAt",
|
|
30632
|
-
vibration: "lastChangedAt",
|
|
30633
|
-
tamper: "lastChangedAt"
|
|
30634
|
-
};
|
|
30635
|
-
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
30636
|
-
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
30637
|
-
/**
|
|
30638
|
-
* Device `type` values (from `DeviceType`) that can host a binary/switch
|
|
30639
|
-
* source cap. Used by the camera's `device-multiselect` picker as the
|
|
30640
|
-
* CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
|
|
30641
|
-
*
|
|
30642
|
-
* Why types and not caps alone: the shared picker filters
|
|
30643
|
-
* `deviceManager.listAll` rows client-side, and those rows carry only the
|
|
30644
|
-
* device's advertised `features` — NOT its registered cap list. On the live
|
|
30645
|
-
* cluster binary sensors and switches advertise EMPTY features (features
|
|
30646
|
-
* mirror only a handful of caps like `motion-trigger`), so a caps-only
|
|
30647
|
-
* filter matched against `features` would list nothing (the very bug this
|
|
30648
|
-
* replaced, which relied on the now-empty `getAllBindings`). Matching by
|
|
30649
|
-
* `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
|
|
30650
|
-
* still captures any device that DOES advertise a source-cap feature.
|
|
30651
|
-
* `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
|
|
30652
|
-
* `switch` covers switches, `control` covers generic binary actuators.
|
|
30653
|
-
*/
|
|
30654
|
-
var SOURCE_DEVICE_TYPES = [
|
|
30655
|
-
"sensor",
|
|
30656
|
-
"switch",
|
|
30657
|
-
"control"
|
|
30658
|
-
];
|
|
30659
|
-
/** True when a cap is a recognised binary/switch source. */
|
|
30660
|
-
function isSourceCap(capName) {
|
|
30661
|
-
return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
|
|
30662
|
-
}
|
|
30663
|
-
/** Extract the "active" boolean a source cap's slice carries, or null when
|
|
30664
|
-
* the cap is unknown or the field is missing / non-boolean. */
|
|
30665
|
-
function sliceActiveValue(capName, slice) {
|
|
30666
|
-
const field = SOURCE_CAP_ACTIVE_FIELD[capName];
|
|
30667
|
-
if (field === void 0) return null;
|
|
30668
|
-
const raw = slice[field];
|
|
30669
|
-
return typeof raw === "boolean" ? raw : null;
|
|
30670
|
-
}
|
|
30671
|
-
/** Ms-epoch transition timestamp a source cap's slice carries, or null when
|
|
30672
|
-
* it is absent, non-numeric or the zero "never observed" sentinel. */
|
|
30673
|
-
function sliceChangedAt(capName, slice) {
|
|
30674
|
-
const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
|
|
30675
|
-
if (field === void 0) return null;
|
|
30676
|
-
const raw = slice[field];
|
|
30677
|
-
if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
|
|
30678
|
-
return raw;
|
|
30679
|
-
}
|
|
30680
|
-
/**
|
|
30681
|
-
* How recent a source's own transition timestamp must be for a FIRST
|
|
30682
|
-
* sighting that is already active to count as a genuine rise rather than a
|
|
30683
|
-
* hydration of long-standing state.
|
|
30684
|
-
*/
|
|
30685
|
-
var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
|
|
30686
|
-
/**
|
|
30687
|
-
* IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
|
|
30688
|
-
* porta `prior`, `nowMs` e il proprio `startedAtMs`.
|
|
30689
|
-
*
|
|
30690
|
-
* Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
|
|
30691
|
-
* fronte solo se il timestamp UPSTREAM della transizione è posteriore a
|
|
30692
|
-
* `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
|
|
30693
|
-
* servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
|
|
30694
|
-
* stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
|
|
30695
|
-
* iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
|
|
30696
|
-
* adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
|
|
30697
|
-
* SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
|
|
30698
|
-
*/
|
|
30699
|
-
function evaluateSensorEdge(input) {
|
|
30700
|
-
const value = sliceActiveValue(input.capName, input.slice);
|
|
30701
|
-
if (value === null) return {
|
|
30702
|
-
edge: "none",
|
|
30703
|
-
value: null,
|
|
30704
|
-
reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
|
|
30705
|
-
};
|
|
30706
|
-
if (input.prior === void 0) {
|
|
30707
|
-
if (!value) return {
|
|
30708
|
-
edge: "none",
|
|
30709
|
-
value,
|
|
30710
|
-
reason: "baseline-seeded-inactive"
|
|
30711
|
-
};
|
|
30712
|
-
const changedAt = sliceChangedAt(input.capName, input.slice);
|
|
30713
|
-
const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
|
|
30714
|
-
if (changedAt === null || changedAt < floor) return {
|
|
30715
|
-
edge: "none",
|
|
30716
|
-
value,
|
|
30717
|
-
reason: "baseline-seeded-stale-active"
|
|
30718
|
-
};
|
|
30719
|
-
return {
|
|
30720
|
-
edge: "rising",
|
|
30721
|
-
value: true
|
|
30722
|
-
};
|
|
30723
|
-
}
|
|
30724
|
-
if (input.prior === value) return {
|
|
30725
|
-
edge: "none",
|
|
30726
|
-
value,
|
|
30727
|
-
reason: "no-change"
|
|
30728
|
-
};
|
|
30729
|
-
if (!value) return {
|
|
30730
|
-
edge: "none",
|
|
30731
|
-
value,
|
|
30732
|
-
reason: "falling-edge"
|
|
30733
|
-
};
|
|
30734
|
-
return {
|
|
30735
|
-
edge: "rising",
|
|
30736
|
-
value: true
|
|
30737
|
-
};
|
|
30738
|
-
}
|
|
30739
|
-
//#endregion
|
|
30740
29978
|
//#region src/capabilities/doorbell.cap.ts
|
|
30741
29979
|
/**
|
|
30742
29980
|
* Doorbell button cap. Two kinds of providers coexist behind this cap
|
|
@@ -30811,7 +30049,13 @@ var doorbellCapability = {
|
|
|
30811
30049
|
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
30812
30050
|
* release/duration — it's a pulse.
|
|
30813
30051
|
*/
|
|
30814
|
-
onPressed: {
|
|
30052
|
+
onPressed: {
|
|
30053
|
+
data: DoorbellPressEventSchema,
|
|
30054
|
+
fromState: {
|
|
30055
|
+
field: "lastPressedAt",
|
|
30056
|
+
on: "advance"
|
|
30057
|
+
}
|
|
30058
|
+
} },
|
|
30815
30059
|
status: {
|
|
30816
30060
|
schema: DoorbellStatusSchema,
|
|
30817
30061
|
kind: "push"
|
|
@@ -30868,11 +30112,10 @@ var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
|
|
|
30868
30112
|
* `device-extension` — ONE place to see and author what a device is extended
|
|
30869
30113
|
* with by OTHER devices (D648).
|
|
30870
30114
|
*
|
|
30871
|
-
* **A contract, not a store.** Every slot (`linked-devices`,
|
|
30872
|
-
*
|
|
30873
|
-
*
|
|
30874
|
-
*
|
|
30875
|
-
* path. This cap persists nothing and has no config method (guarded by
|
|
30115
|
+
* **A contract, not a store.** Every slot (`linked-devices`, `doorbell-source`)
|
|
30116
|
+
* is declared by the cap that owns the function (`extensionSlots` in its
|
|
30117
|
+
* `*.cap.ts`, D4) and SERVED by the addon that already owns its store, over
|
|
30118
|
+
* that store and its existing write path. This cap persists nothing and has no config method (guarded by
|
|
30876
30119
|
* `scripts/check-extension-slots.ts`): D62 applied to the whole feature, and
|
|
30877
30120
|
* D3 — no shadow registry.
|
|
30878
30121
|
*
|
|
@@ -30893,6 +30136,11 @@ var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
|
|
|
30893
30136
|
* The slot's value travels as the generated discriminated union
|
|
30894
30137
|
* (`ExtensionSlotValue`, keyed on `slot`), so a value under the wrong slot is
|
|
30895
30138
|
* a schema error before it reaches any owner.
|
|
30139
|
+
*
|
|
30140
|
+
* **Associations only.** A slot LISTS other devices on its host. A host that
|
|
30141
|
+
* GAINS a capability from other devices is a composition (D663, amends D648:
|
|
30142
|
+
* the reserved `graft` shape, its `projects` and its `enabled` switch were
|
|
30143
|
+
* retired unimplemented).
|
|
30896
30144
|
*/
|
|
30897
30145
|
/** Separator between the source and the slot id in a `slotRef`. It is the
|
|
30898
30146
|
* D554 routing separator: the dispatcher matches `<source>:` prefixes. */
|
|
@@ -30915,7 +30163,7 @@ var ExtensionSourceSchema = z.object({
|
|
|
30915
30163
|
/**
|
|
30916
30164
|
* How one picked source stands. `missing` — no such device (deleted, or an id
|
|
30917
30165
|
* that never existed); `foreign` — a device the slot's owner cannot read from
|
|
30918
|
-
* (
|
|
30166
|
+
* (a source owned by another addon); `unavailable` — it exists but is not a
|
|
30919
30167
|
* valid source now (a container, which is never a pick). A source in any of
|
|
30920
30168
|
* these states is SHOWN, never silently dropped or re-pointed.
|
|
30921
30169
|
*/
|
|
@@ -30956,10 +30204,6 @@ var ExtensionSlotStateSchema = z.object({
|
|
|
30956
30204
|
slot: ExtensionSlotIdSchema,
|
|
30957
30205
|
/** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
|
|
30958
30206
|
authority: z.string(),
|
|
30959
|
-
/** graft: its switch. association: null — removing every source is "off". */
|
|
30960
|
-
enabled: z.boolean().nullable(),
|
|
30961
|
-
/** graft: the cap registered on the host. association: null. */
|
|
30962
|
-
projects: z.string().nullable(),
|
|
30963
30207
|
activation: ExtensionSlotActivationSchema.nullable(),
|
|
30964
30208
|
value: ExtensionSlotValueSchema,
|
|
30965
30209
|
sources: z.array(ExtensionSlotSourceSchema),
|
|
@@ -31010,7 +30254,8 @@ var ExtensionCandidatesSchema = z.object({ candidates: z.array(ExtensionCandidat
|
|
|
31010
30254
|
/**
|
|
31011
30255
|
* What a write did. `none` — applied in place. `host` / `parent` — the owner
|
|
31012
30256
|
* reloaded the host (or, for an accessory child, its parent) because the
|
|
31013
|
-
* write changed what the host REGISTERS
|
|
30257
|
+
* write changed what the host REGISTERS. A slot never adds a capability to its
|
|
30258
|
+
* host — that is a composition (D663) — so today's owners answer `none`.
|
|
31014
30259
|
*/
|
|
31015
30260
|
var ExtensionSetResultSchema = z.object({
|
|
31016
30261
|
applied: z.literal(true),
|
|
@@ -32640,7 +31885,9 @@ var batteryCapability = {
|
|
|
32640
31885
|
DeviceType.Camera,
|
|
32641
31886
|
DeviceType.Sensor,
|
|
32642
31887
|
DeviceType.Button,
|
|
32643
|
-
DeviceType.Switch
|
|
31888
|
+
DeviceType.Switch,
|
|
31889
|
+
DeviceType.PetFeeder,
|
|
31890
|
+
DeviceType.Container
|
|
32644
31891
|
],
|
|
32645
31892
|
methods: {
|
|
32646
31893
|
/**
|
|
@@ -32667,6 +31914,19 @@ wakeForStream: method(z.object({
|
|
|
32667
31914
|
awoke: z.boolean(),
|
|
32668
31915
|
durationMs: z.number()
|
|
32669
31916
|
}), { kind: "mutation" }) },
|
|
31917
|
+
/**
|
|
31918
|
+
* A composed provider (battery ADDED to a pet feeder or container that has
|
|
31919
|
+
* no wake surface) answers `wakeForStream` with the same "unavailable"
|
|
31920
|
+
* result the contract already defines above: "Returns `awoke: false` when
|
|
31921
|
+
* … the cap surface is unavailable." (D663).
|
|
31922
|
+
*/
|
|
31923
|
+
composedMethods: { wakeForStream: {
|
|
31924
|
+
kind: "answer",
|
|
31925
|
+
value: {
|
|
31926
|
+
awoke: false,
|
|
31927
|
+
durationMs: 0
|
|
31928
|
+
}
|
|
31929
|
+
} },
|
|
32670
31930
|
events: {
|
|
32671
31931
|
/**
|
|
32672
31932
|
* Emitted whenever the cached status changes (firmware push OR
|
|
@@ -32682,7 +31942,7 @@ onStatusChanged: { data: z.object({
|
|
|
32682
31942
|
schema: BatteryStatusSchema,
|
|
32683
31943
|
kind: "push",
|
|
32684
31944
|
empty: {
|
|
32685
|
-
percentage:
|
|
31945
|
+
percentage: null,
|
|
32686
31946
|
charging: "unknown",
|
|
32687
31947
|
sleeping: false,
|
|
32688
31948
|
lastUpdated: 0
|
|
@@ -33568,6 +32828,19 @@ var connectivityCapability = {
|
|
|
33568
32828
|
* provider populates it by guessing (no HA inference). The UI renders a
|
|
33569
32829
|
* "No consumables reported" placeholder when `items` is empty.
|
|
33570
32830
|
*/
|
|
32831
|
+
/** Units a remaining-life counter is reported in. Closed: the panel renders
|
|
32832
|
+
* each. */
|
|
32833
|
+
var ConsumableRemainingUnitSchema = z.enum([
|
|
32834
|
+
"days",
|
|
32835
|
+
"hours",
|
|
32836
|
+
"cycles"
|
|
32837
|
+
]);
|
|
32838
|
+
/** Remaining life as a COUNT, not a percentage (the PetKit desiccant reports
|
|
32839
|
+
* days). `value` null = unknown (D393). */
|
|
32840
|
+
var ConsumableRemainingSchema = z.object({
|
|
32841
|
+
value: z.number().min(0).nullable(),
|
|
32842
|
+
unit: ConsumableRemainingUnitSchema
|
|
32843
|
+
});
|
|
33571
32844
|
/** A single consumable item. Either a continuous `level` (remaining
|
|
33572
32845
|
* life %) or a discrete `status` may be known — both may be null when a
|
|
33573
32846
|
* provider only knows the item exists. `level` and `status` are not
|
|
@@ -33584,7 +32857,10 @@ var ConsumableItemSchema = z.object({
|
|
|
33584
32857
|
/** Ms epoch of the last replace, when known. */
|
|
33585
32858
|
lastResetAt: z.number().nullable(),
|
|
33586
32859
|
/** Whether `reset()` is meaningful for this item. */
|
|
33587
|
-
resettable: z.boolean()
|
|
32860
|
+
resettable: z.boolean(),
|
|
32861
|
+
/** Remaining life as a count (days/hours/cycles), when a provider reports
|
|
32862
|
+
* it that way instead of — or alongside — `level`. Absent = not reported. */
|
|
32863
|
+
remaining: ConsumableRemainingSchema.optional()
|
|
33588
32864
|
});
|
|
33589
32865
|
var ConsumablesStatusSchema = z.object({
|
|
33590
32866
|
items: z.array(ConsumableItemSchema),
|
|
@@ -33614,6 +32890,16 @@ reset: method(z.object({
|
|
|
33614
32890
|
kind: "mutation",
|
|
33615
32891
|
auth: "admin"
|
|
33616
32892
|
}) },
|
|
32893
|
+
/**
|
|
32894
|
+
* A composed consumable (item added to a device with no native consumables
|
|
32895
|
+
* provider) refuses `reset` by name: "Only meaningful when the item's
|
|
32896
|
+
* `resettable` is true" — a composed item is never resettable until
|
|
32897
|
+
* commands (`forward`) arrive in slice 3 (D663).
|
|
32898
|
+
*/
|
|
32899
|
+
composedMethods: { reset: {
|
|
32900
|
+
kind: "refuse",
|
|
32901
|
+
reason: "a composed consumable is not resettable until commands (forward) arrive — slice 3"
|
|
32902
|
+
} },
|
|
33617
32903
|
status: {
|
|
33618
32904
|
schema: ConsumablesStatusSchema,
|
|
33619
32905
|
kind: "push",
|
|
@@ -45190,8 +44476,6 @@ function createDeviceExtensionProvider(options) {
|
|
|
45190
44476
|
slotRef: extensionSlotRef(source, slot.slot),
|
|
45191
44477
|
slot: slot.slot,
|
|
45192
44478
|
authority: listing.authority,
|
|
45193
|
-
enabled: listing.enabled,
|
|
45194
|
-
projects: EXTENSION_SLOTS[slot.slot].descriptor.projects ?? null,
|
|
45195
44479
|
activation: listing.activation,
|
|
45196
44480
|
value: listing.value,
|
|
45197
44481
|
sources: [...listing.sources],
|
|
@@ -45226,44 +44510,68 @@ function createDeviceExtensionProvider(options) {
|
|
|
45226
44510
|
* through another composition, is refused at save by name (spec §2).
|
|
45227
44511
|
*
|
|
45228
44512
|
* The graph is built for ONE save: the CANDIDATE composition (the one being
|
|
45229
|
-
* validated) plus every STORED composition. The candidate
|
|
45230
|
-
*
|
|
45231
|
-
*
|
|
45232
|
-
*
|
|
45233
|
-
*
|
|
45234
|
-
*
|
|
44513
|
+
* validated) plus every STORED composition. The candidate replaces its own old
|
|
44514
|
+
* version, identified BY BLOCK ID wherever it sits in `stored` — whether a save
|
|
44515
|
+
* introduces or removes a cycle must never depend on array order. A DIFFERENT
|
|
44516
|
+
* block targeting the candidate's device is refused by name: one composition
|
|
44517
|
+
* per device (D663). Two different stored peers that (wrongly) target the same
|
|
44518
|
+
* device are corrupted state, not a cycle to resolve by picking one silently;
|
|
44519
|
+
* that is refused by name too (D391).
|
|
44520
|
+
*
|
|
44521
|
+
* A customization of an EXISTING device reads that device's NATIVE value for a
|
|
44522
|
+
* field it replaces or does not write ("Invert state" reads the `on` it
|
|
44523
|
+
* replaces): such a self-read is no edge, so it is never a cycle (D663).
|
|
44524
|
+
* Another composition reading that field reads the customizer's output.
|
|
45235
44525
|
*
|
|
45236
44526
|
* `findCompositionCycles` reports at least one cycle per cycle-SET (the DFS
|
|
45237
|
-
* marks a node `done` after its first expansion) —
|
|
45238
|
-
*
|
|
44527
|
+
* marks a node `done` after its first expansion) — not every elementary cycle
|
|
44528
|
+
* through a shared node, so the path it names may AVOID the candidate while
|
|
44529
|
+
* one through it goes unreported. What a save refuses is therefore decided per
|
|
44530
|
+
* strongly connected component (`findCandidateCycles`, C-1). A dotted
|
|
45239
44531
|
* `fieldPath` is matched only as an exact string: a write to `state.value` and
|
|
45240
44532
|
* a read of `state` would not connect (no nested field writes exist yet).
|
|
44533
|
+
*
|
|
44534
|
+
* An item leaf is its own node, `…#consumables.items[desiccant].status`
|
|
44535
|
+
* (`featureFieldEntries`), so two items sharing an inner path never merge. No
|
|
44536
|
+
* READ can name an array element (`describeStateField` never describes one),
|
|
44537
|
+
* so an item node is write-only: its edges to sources are what the check needs.
|
|
45241
44538
|
*/
|
|
45242
|
-
/** Two
|
|
44539
|
+
/** Two blocks' compositions target the same device — refused by name, never silently resolved. */
|
|
45243
44540
|
var CompositionGraphError = class extends Error {};
|
|
44541
|
+
/** `"cap.field"` of every field a peer writes — the same spelling as `compositionFieldKey`. */
|
|
44542
|
+
function writtenFields(peer) {
|
|
44543
|
+
return new Set(peer.composition.features.flatMap((feature) => !compositionFeatureEnabled(feature) || feature.kind !== "fields" ? [] : featureFieldEntries(feature).map(({ fieldPath }) => `${feature.cap}.${fieldPath}`)));
|
|
44544
|
+
}
|
|
44545
|
+
/** A read of the peer's OWN device is an edge only when it reads the peer's own output (rule 5, D663). */
|
|
44546
|
+
function readsComposedValue(peer, written, read) {
|
|
44547
|
+
if (compositionSourceKey(read.source) !== compositionSourceKey(peer.target)) return true;
|
|
44548
|
+
const field = `${read.cap}.${read.fieldPath}`;
|
|
44549
|
+
return written.has(field) && peer.replaced?.has(field) !== true;
|
|
44550
|
+
}
|
|
45244
44551
|
function peerEdges(peer) {
|
|
45245
|
-
|
|
44552
|
+
const written = writtenFields(peer);
|
|
44553
|
+
return peer.composition.features.flatMap((feature) => !compositionFeatureEnabled(feature) || feature.kind !== "fields" ? [] : featureFieldEntries(feature).map(({ fieldPath, source }) => [compositionReadKey({
|
|
45246
44554
|
source: peer.target,
|
|
45247
44555
|
cap: feature.cap,
|
|
45248
|
-
fieldPath
|
|
45249
|
-
}), fieldReads(source).map(compositionReadKey)]));
|
|
44556
|
+
fieldPath
|
|
44557
|
+
}), fieldReads(source).filter((read) => readsComposedValue(peer, written, read)).map(compositionReadKey)]));
|
|
45250
44558
|
}
|
|
45251
44559
|
/**
|
|
45252
|
-
* Every peer that actually takes part in the graph: each stored peer minus
|
|
45253
|
-
*
|
|
45254
|
-
*
|
|
45255
|
-
*
|
|
45256
|
-
* candidate
|
|
45257
|
-
* DIFFERENT stored peers (neither of them the candidate's own old version)
|
|
45258
|
-
* target the same device.
|
|
44560
|
+
* Every peer that actually takes part in the graph: each stored peer minus the
|
|
44561
|
+
* candidate's own old version (same block id — the drop happens before any
|
|
44562
|
+
* edge is built, so its old edges never enter the map), plus the candidate
|
|
44563
|
+
* itself, exactly once. Throws {@link CompositionGraphError} when a DIFFERENT
|
|
44564
|
+
* block targets the candidate's device, or two stored peers share a device.
|
|
45259
44565
|
*/
|
|
45260
44566
|
function resolvedPeers(candidate, stored) {
|
|
45261
44567
|
const candidateKey = compositionSourceKey(candidate.target);
|
|
45262
44568
|
const survivors = /* @__PURE__ */ new Map();
|
|
45263
44569
|
for (const peer of stored) {
|
|
44570
|
+
if (peer.blockId === candidate.blockId) continue;
|
|
45264
44571
|
const key = compositionSourceKey(peer.target);
|
|
45265
|
-
if (key === candidateKey)
|
|
45266
|
-
|
|
44572
|
+
if (key === candidateKey) throw new CompositionGraphError(`block \`${peer.blockId}\` and block \`${candidate.blockId}\` both target device \`${key}\` — one composition per device; delete or edit the existing one`);
|
|
44573
|
+
const clash = survivors.get(key);
|
|
44574
|
+
if (clash !== void 0) throw new CompositionGraphError(`two stored compositions (\`${clash.blockId}\`, \`${peer.blockId}\`) both target device \`${key}\` — refusing to build the field graph`);
|
|
45267
44575
|
survivors.set(key, peer);
|
|
45268
44576
|
}
|
|
45269
44577
|
return [...survivors.values(), candidate];
|
|
@@ -45292,170 +44600,102 @@ function findCompositionCycles(candidate, stored) {
|
|
|
45292
44600
|
for (const node of edges.keys()) visit(node, []);
|
|
45293
44601
|
return [...found.values()];
|
|
45294
44602
|
}
|
|
45295
|
-
|
|
45296
|
-
|
|
45297
|
-
|
|
45298
|
-
|
|
45299
|
-
|
|
45300
|
-
|
|
45301
|
-
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
|
|
45305
|
-
|
|
45306
|
-
|
|
45307
|
-
|
|
45308
|
-
|
|
45309
|
-
|
|
45310
|
-
|
|
45311
|
-
|
|
45312
|
-
|
|
45313
|
-
|
|
45314
|
-
|
|
45315
|
-
|
|
45316
|
-
|
|
45317
|
-
let fatalUnavailable = null;
|
|
45318
|
-
let nonFatalUnavailable = null;
|
|
45319
|
-
for (const [name, binding] of Object.entries(source.bindings)) {
|
|
45320
|
-
if (binding.kind === "literal") {
|
|
45321
|
-
values[name] = binding.value;
|
|
45322
|
-
continue;
|
|
44603
|
+
/** Tarjan's strongly connected components over every node of the graph (sources included). */
|
|
44604
|
+
function stronglyConnected(edges) {
|
|
44605
|
+
const index = /* @__PURE__ */ new Map();
|
|
44606
|
+
const low = /* @__PURE__ */ new Map();
|
|
44607
|
+
const onStack = /* @__PURE__ */ new Set();
|
|
44608
|
+
const stack = [];
|
|
44609
|
+
const components = [];
|
|
44610
|
+
const connect = (node) => {
|
|
44611
|
+
index.set(node, index.size);
|
|
44612
|
+
low.set(node, index.get(node) ?? 0);
|
|
44613
|
+
stack.push(node);
|
|
44614
|
+
onStack.add(node);
|
|
44615
|
+
for (const next of edges.get(node) ?? []) if (!index.has(next)) {
|
|
44616
|
+
connect(next);
|
|
44617
|
+
low.set(node, Math.min(low.get(node) ?? 0, low.get(next) ?? 0));
|
|
44618
|
+
} else if (onStack.has(next)) low.set(node, Math.min(low.get(node) ?? 0, index.get(next) ?? 0));
|
|
44619
|
+
if (low.get(node) !== index.get(node)) return;
|
|
44620
|
+
const component = [];
|
|
44621
|
+
for (let member = stack.pop(); member !== void 0; member = stack.pop()) {
|
|
44622
|
+
onStack.delete(member);
|
|
44623
|
+
component.push(member);
|
|
44624
|
+
if (member === node) break;
|
|
45323
44625
|
}
|
|
45324
|
-
|
|
45325
|
-
|
|
45326
|
-
|
|
45327
|
-
|
|
45328
|
-
|
|
45329
|
-
|
|
45330
|
-
|
|
45331
|
-
|
|
45332
|
-
|
|
45333
|
-
|
|
45334
|
-
|
|
44626
|
+
components.push(component);
|
|
44627
|
+
};
|
|
44628
|
+
for (const node of edges.keys()) if (!index.has(node)) connect(node);
|
|
44629
|
+
return components;
|
|
44630
|
+
}
|
|
44631
|
+
/** The shortest walk from `start` back to itself inside `component` (one exists: the component has a cycle). */
|
|
44632
|
+
function cycleThrough(start, component, edges) {
|
|
44633
|
+
const parent = /* @__PURE__ */ new Map();
|
|
44634
|
+
const queue = [start];
|
|
44635
|
+
for (let head = 0; head < queue.length; head += 1) {
|
|
44636
|
+
const node = queue[head];
|
|
44637
|
+
if (node === void 0) break;
|
|
44638
|
+
for (const next of edges.get(node) ?? []) {
|
|
44639
|
+
if (next === start) {
|
|
44640
|
+
const chain = [];
|
|
44641
|
+
for (let at = node; at !== void 0 && at !== start; at = parent.get(at)) chain.push(at);
|
|
44642
|
+
return [
|
|
44643
|
+
start,
|
|
44644
|
+
...chain.reverse(),
|
|
44645
|
+
start
|
|
44646
|
+
];
|
|
45335
44647
|
}
|
|
45336
|
-
if (
|
|
45337
|
-
|
|
44648
|
+
if (!component.has(next) || parent.has(next)) continue;
|
|
44649
|
+
parent.set(next, node);
|
|
44650
|
+
queue.push(next);
|
|
45338
44651
|
}
|
|
45339
|
-
values[name] = reading.value;
|
|
45340
|
-
if (reading.state === "stale") staleReasons.push(`\`${name}\`: ${reading.reason}`);
|
|
45341
44652
|
}
|
|
45342
|
-
|
|
45343
|
-
if (nonFatalUnavailable !== null) return nonFatalUnavailable;
|
|
45344
|
-
const deadlines = [];
|
|
45345
|
-
const result = evaluateExpressionSource(source.expr, values, now, { hooks: { noteDeadline: (at) => deadlines.push(at) } });
|
|
45346
|
-
if (!result.ok) return {
|
|
45347
|
-
state: "unavailable",
|
|
45348
|
-
value: null,
|
|
45349
|
-
reason: `the expression failed: ${result.error}`,
|
|
45350
|
-
fatal: false
|
|
45351
|
-
};
|
|
45352
|
-
return {
|
|
45353
|
-
state: staleReasons.length > 0 ? "stale" : "fresh",
|
|
45354
|
-
value: result.value,
|
|
45355
|
-
reason: staleReasons.length > 0 ? staleReasons.join("; ") : null,
|
|
45356
|
-
deadline: deadlines.length > 0 ? Math.min(...deadlines) : null
|
|
45357
|
-
};
|
|
44653
|
+
return [start, start];
|
|
45358
44654
|
}
|
|
45359
|
-
function evaluateCompositionField(input) {
|
|
45360
|
-
const { source } = input;
|
|
45361
|
-
switch (source.kind) {
|
|
45362
|
-
case "from": return fromReading(input.read(source), source);
|
|
45363
|
-
case "expression": return expressionOutcome(source, input.read, input.now);
|
|
45364
|
-
case "code": return {
|
|
45365
|
-
state: "unavailable",
|
|
45366
|
-
value: null,
|
|
45367
|
-
reason: "code fields are not runnable in the composer — they arrive in slice 4",
|
|
45368
|
-
fatal: true
|
|
45369
|
-
};
|
|
45370
|
-
}
|
|
45371
|
-
}
|
|
45372
|
-
//#endregion
|
|
45373
|
-
//#region src/composition/examples.ts
|
|
45374
44655
|
/**
|
|
45375
|
-
* The
|
|
45376
|
-
*
|
|
45377
|
-
*
|
|
45378
|
-
*
|
|
44656
|
+
* The cycles THIS save closes, decided per strongly connected component — never
|
|
44657
|
+
* per reported DFS path, which names one back-edge per revisit and can report a
|
|
44658
|
+
* component's cycle by a path that avoids the candidate while the one through it
|
|
44659
|
+
* goes unreported. A component refuses when it holds a candidate node and a
|
|
44660
|
+
* cycle (more than one node, or a self-loop). Components without a candidate
|
|
44661
|
+
* node are not this save's cycles.
|
|
45379
44662
|
*/
|
|
45380
|
-
|
|
45381
|
-
|
|
45382
|
-
{
|
|
45383
|
-
|
|
45384
|
-
|
|
45385
|
-
|
|
45386
|
-
|
|
45387
|
-
|
|
45388
|
-
|
|
45389
|
-
|
|
45390
|
-
|
|
45391
|
-
|
|
45392
|
-
|
|
45393
|
-
}
|
|
45394
|
-
|
|
45395
|
-
|
|
45396
|
-
|
|
45397
|
-
|
|
45398
|
-
}, {
|
|
45399
|
-
addonId: "provider-homeassistant",
|
|
45400
|
-
stableId: "binary_sensor.living_room_presence"
|
|
45401
|
-
}];
|
|
45402
|
-
function from(source, cap, fieldPath) {
|
|
44663
|
+
function findCandidateCycles(candidate, stored) {
|
|
44664
|
+
const edges = compositionEdges(candidate, stored);
|
|
44665
|
+
const prefix = `${compositionSourceKey(candidate.target)}#`;
|
|
44666
|
+
return stronglyConnected(edges).flatMap((members) => {
|
|
44667
|
+
const start = members.find((n) => n.startsWith(prefix));
|
|
44668
|
+
if (start === void 0) return [];
|
|
44669
|
+
const component = new Set(members);
|
|
44670
|
+
const selfLoop = members.length === 1 && (edges.get(start) ?? []).includes(start);
|
|
44671
|
+
if (members.length === 1 && !selfLoop) return [];
|
|
44672
|
+
return [{
|
|
44673
|
+
path: cycleThrough(start, component, edges),
|
|
44674
|
+
component
|
|
44675
|
+
}];
|
|
44676
|
+
});
|
|
44677
|
+
}
|
|
44678
|
+
//#endregion
|
|
44679
|
+
//#region src/composition/plan-result.ts
|
|
44680
|
+
function problem(code, path, message) {
|
|
45403
44681
|
return {
|
|
45404
|
-
|
|
45405
|
-
|
|
45406
|
-
|
|
45407
|
-
fieldPath
|
|
44682
|
+
code,
|
|
44683
|
+
path,
|
|
44684
|
+
message
|
|
45408
44685
|
};
|
|
45409
44686
|
}
|
|
45410
|
-
function
|
|
45411
|
-
return
|
|
44687
|
+
function refused(...problems) {
|
|
44688
|
+
return {
|
|
44689
|
+
problems,
|
|
44690
|
+
fields: [],
|
|
44691
|
+
features: [],
|
|
44692
|
+
events: []
|
|
44693
|
+
};
|
|
45412
44694
|
}
|
|
45413
|
-
|
|
45414
|
-
|
|
45415
|
-
const
|
|
45416
|
-
|
|
45417
|
-
const m = named("m", input.motionSources, "motion", "lastDetectedAt");
|
|
45418
|
-
const windows = Object.keys(m).map((name) => `within(${name}, ${input.occupancyWindowMs})`);
|
|
45419
|
-
return CompositionSchema.parse({
|
|
45420
|
-
target: {
|
|
45421
|
-
kind: "new",
|
|
45422
|
-
type: DeviceType.Sensor
|
|
45423
|
-
},
|
|
45424
|
-
features: [{
|
|
45425
|
-
kind: "fields",
|
|
45426
|
-
cap: "temperature-sensor",
|
|
45427
|
-
fields: {
|
|
45428
|
-
celsius: {
|
|
45429
|
-
kind: "expression",
|
|
45430
|
-
expr: `round(avg(${Object.keys(t).join(", ")}), 1)`,
|
|
45431
|
-
bindings: t
|
|
45432
|
-
},
|
|
45433
|
-
lastFetchedAt: {
|
|
45434
|
-
kind: "expression",
|
|
45435
|
-
expr: `max(${Object.keys(f).join(", ")})`,
|
|
45436
|
-
bindings: f
|
|
45437
|
-
}
|
|
45438
|
-
}
|
|
45439
|
-
}, {
|
|
45440
|
-
kind: "fields",
|
|
45441
|
-
cap: "binary",
|
|
45442
|
-
fields: {
|
|
45443
|
-
on: {
|
|
45444
|
-
kind: "expression",
|
|
45445
|
-
expr: `any(${[...Object.keys(d), ...windows].join(", ")})`,
|
|
45446
|
-
bindings: {
|
|
45447
|
-
...d,
|
|
45448
|
-
...m
|
|
45449
|
-
}
|
|
45450
|
-
},
|
|
45451
|
-
lastChangedAt: {
|
|
45452
|
-
kind: "expression",
|
|
45453
|
-
expr: "now",
|
|
45454
|
-
bindings: {}
|
|
45455
|
-
}
|
|
45456
|
-
}
|
|
45457
|
-
}]
|
|
45458
|
-
});
|
|
44695
|
+
/** Where a planned field sits in the composition: `features[N].fields.<path>` or `features[N].items.<key>.fields.<path>`. */
|
|
44696
|
+
function compositionFieldAt(field) {
|
|
44697
|
+
const inner = field.item === void 0 ? "fields" : `items.${field.item.key}.fields`;
|
|
44698
|
+
return `features[${field.featureIndex}].${inner}.${field.path}`;
|
|
45459
44699
|
}
|
|
45460
44700
|
//#endregion
|
|
45461
44701
|
//#region src/composition/expression-kinds.ts
|
|
@@ -45489,7 +44729,16 @@ var BUILTIN_RESULT_KINDS = Object.freeze({
|
|
|
45489
44729
|
latest: {
|
|
45490
44730
|
kind: "fixed",
|
|
45491
44731
|
result: ["number", "null"]
|
|
45492
|
-
}
|
|
44732
|
+
},
|
|
44733
|
+
number: {
|
|
44734
|
+
kind: "fixed",
|
|
44735
|
+
result: ["number", "null"]
|
|
44736
|
+
},
|
|
44737
|
+
rose: {
|
|
44738
|
+
kind: "fixed",
|
|
44739
|
+
result: ["number", "null"]
|
|
44740
|
+
},
|
|
44741
|
+
count: NUMBER
|
|
45493
44742
|
});
|
|
45494
44743
|
var KindInferenceError = class extends Error {};
|
|
45495
44744
|
function kindOfValue(value) {
|
|
@@ -45548,6 +44797,21 @@ function kindsOf(node, bindings) {
|
|
|
45548
44797
|
case "call": return callKinds(node.callee, node.args.map((a) => kindsOf(a, bindings)));
|
|
45549
44798
|
}
|
|
45550
44799
|
}
|
|
44800
|
+
function nodeContainsCall(node, callee) {
|
|
44801
|
+
switch (node.kind) {
|
|
44802
|
+
case "literal":
|
|
44803
|
+
case "identifier": return false;
|
|
44804
|
+
case "unary": return nodeContainsCall(node.operand, callee);
|
|
44805
|
+
case "binary":
|
|
44806
|
+
case "logical": return nodeContainsCall(node.left, callee) || nodeContainsCall(node.right, callee);
|
|
44807
|
+
case "conditional": return nodeContainsCall(node.test, callee) || nodeContainsCall(node.consequent, callee) || nodeContainsCall(node.alternate, callee);
|
|
44808
|
+
case "call": return node.callee === callee || node.args.some((arg) => nodeContainsCall(arg, callee));
|
|
44809
|
+
}
|
|
44810
|
+
}
|
|
44811
|
+
function expressionContainsBuiltinCall(expr, callee) {
|
|
44812
|
+
const compiled = compileExpressionSafe(expr);
|
|
44813
|
+
return compiled.ok && nodeContainsCall(compiled.parsed.ast, callee);
|
|
44814
|
+
}
|
|
45551
44815
|
function inferExpressionKinds(input) {
|
|
45552
44816
|
const compiled = compileExpressionSafe(input.expr);
|
|
45553
44817
|
if (!compiled.ok) return {
|
|
@@ -45568,129 +44832,14 @@ function inferExpressionKinds(input) {
|
|
|
45568
44832
|
}
|
|
45569
44833
|
}
|
|
45570
44834
|
//#endregion
|
|
45571
|
-
//#region src/
|
|
45572
|
-
/** Unwrap ZodNullable / ZodOptional / ZodDefault wrappers to reach the inner type.
|
|
45573
|
-
* Zod v4 exposes `.unwrap()` on all three wrapper classes. */
|
|
45574
|
-
function unwrapSchema(schema) {
|
|
45575
|
-
let s = schema;
|
|
45576
|
-
while (s instanceof z.ZodNullable || s instanceof z.ZodOptional || s instanceof z.ZodDefault) s = s.unwrap();
|
|
45577
|
-
return s;
|
|
45578
|
-
}
|
|
45579
|
-
function leafKind(schema) {
|
|
45580
|
-
const s = unwrapSchema(schema);
|
|
45581
|
-
if (s instanceof z.ZodEnum) return {
|
|
45582
|
-
kind: "enum",
|
|
45583
|
-
enumValues: s.options
|
|
45584
|
-
};
|
|
45585
|
-
if (s instanceof z.ZodNumber) return { kind: "number" };
|
|
45586
|
-
if (s instanceof z.ZodString) return { kind: "string" };
|
|
45587
|
-
if (s instanceof z.ZodBoolean) return { kind: "boolean" };
|
|
45588
|
-
return null;
|
|
45589
|
-
}
|
|
45590
|
-
/** Walk a cap status schema into flat wireable leaf fields (dotted paths).
|
|
45591
|
-
* Recurses into nested ZodObject (unwrapping nullable/optional/default first),
|
|
45592
|
-
* so fields with null live values are still offered. Arrays / unknown shapes
|
|
45593
|
-
* are skipped — never throws. */
|
|
45594
|
-
function enumerateSchemaFields(schema, prefix = "") {
|
|
45595
|
-
const root = unwrapSchema(schema);
|
|
45596
|
-
if (!(root instanceof z.ZodObject)) return [];
|
|
45597
|
-
const out = [];
|
|
45598
|
-
const shape = root.shape;
|
|
45599
|
-
for (const [key, field] of Object.entries(shape)) {
|
|
45600
|
-
const path = prefix ? `${prefix}.${key}` : key;
|
|
45601
|
-
const inner = unwrapSchema(field);
|
|
45602
|
-
if (inner instanceof z.ZodObject) {
|
|
45603
|
-
out.push(...enumerateSchemaFields(inner, path));
|
|
45604
|
-
continue;
|
|
45605
|
-
}
|
|
45606
|
-
const leaf = leafKind(field);
|
|
45607
|
-
if (leaf) out.push({
|
|
45608
|
-
path,
|
|
45609
|
-
kind: leaf.kind,
|
|
45610
|
-
...leaf.enumValues ? { enumValues: leaf.enumValues } : {}
|
|
45611
|
-
});
|
|
45612
|
-
}
|
|
45613
|
-
return out;
|
|
45614
|
-
}
|
|
45615
|
-
/** Enumerate the per-item wireable fields of an item-array cap (see
|
|
45616
|
-
* `CapabilityStatusItemArray`): the item schema's leaf fields, minus the
|
|
45617
|
-
* `keyField` (the key comes from the link's `itemKey`, never from a wired
|
|
45618
|
-
* source), each tagged `item: true` so the authoring UI collects an
|
|
45619
|
-
* `itemKey` alongside the field. Never throws. */
|
|
45620
|
-
function enumerateItemArrayFields(itemArray) {
|
|
45621
|
-
return enumerateSchemaFields(itemArray.itemSchema).filter((f) => f.path !== itemArray.keyField).map((f) => ({
|
|
45622
|
-
...f,
|
|
45623
|
-
item: true
|
|
45624
|
-
}));
|
|
45625
|
-
}
|
|
45626
|
-
//#endregion
|
|
45627
|
-
//#region src/composition/state-fields.ts
|
|
44835
|
+
//#region src/composition/field-kinds.ts
|
|
45628
44836
|
/**
|
|
45629
|
-
*
|
|
45630
|
-
*
|
|
45631
|
-
*
|
|
44837
|
+
* The kind half of planning a composition field (D659): which kinds a source
|
|
44838
|
+
* can produce, whether they fit a target field, and the field's role.
|
|
44839
|
+
* Shared by the top-level planner (`validate-composition.ts`) and the item
|
|
44840
|
+
* planner (`composition-items.ts`). Internal to the composition module — NOT
|
|
44841
|
+
* in the barrel: these are planner internals, not a published contract.
|
|
45632
44842
|
*/
|
|
45633
|
-
function fieldAt(schema, path) {
|
|
45634
|
-
let current = schema;
|
|
45635
|
-
for (const segment of path.split(".")) {
|
|
45636
|
-
const container = unwrapSchema(current);
|
|
45637
|
-
if (!(container instanceof z.ZodObject)) return null;
|
|
45638
|
-
const next = container.shape[segment];
|
|
45639
|
-
if (!(next instanceof z.ZodType)) return null;
|
|
45640
|
-
current = next;
|
|
45641
|
-
}
|
|
45642
|
-
return current;
|
|
45643
|
-
}
|
|
45644
|
-
function describeStateField(schema, path) {
|
|
45645
|
-
const leaf = enumerateSchemaFields(schema).find((f) => f.path === path);
|
|
45646
|
-
if (leaf === void 0) return null;
|
|
45647
|
-
const field = fieldAt(schema, path);
|
|
45648
|
-
if (field === null) return null;
|
|
45649
|
-
return {
|
|
45650
|
-
path,
|
|
45651
|
-
kind: leaf.kind,
|
|
45652
|
-
nullable: field.safeParse(null).success,
|
|
45653
|
-
required: !field.safeParse(void 0).success,
|
|
45654
|
-
...leaf.enumValues === void 0 ? {} : { enumValues: leaf.enumValues }
|
|
45655
|
-
};
|
|
45656
|
-
}
|
|
45657
|
-
function describeTopLevelStateFields(schema) {
|
|
45658
|
-
return new Map(enumerateSchemaFields(schema).filter((f) => !f.path.includes(".")).flatMap((f) => {
|
|
45659
|
-
const described = describeStateField(schema, f.path);
|
|
45660
|
-
return described === null ? [] : [[f.path, described]];
|
|
45661
|
-
}));
|
|
45662
|
-
}
|
|
45663
|
-
/** Top-level keys a value MUST carry: those whose schema refuses `undefined`. */
|
|
45664
|
-
function requiredTopLevelKeys(schema) {
|
|
45665
|
-
const root = unwrapSchema(schema);
|
|
45666
|
-
if (!(root instanceof z.ZodObject)) return [];
|
|
45667
|
-
return Object.entries(root.shape).flatMap(([key, field]) => field instanceof z.ZodType && !field.safeParse(void 0).success ? [key] : []);
|
|
45668
|
-
}
|
|
45669
|
-
//#endregion
|
|
45670
|
-
//#region src/composition/validate-composition.ts
|
|
45671
|
-
function buildCapabilityLookup(defs) {
|
|
45672
|
-
const byName = new Map(defs.map((d) => [d.name, d]));
|
|
45673
|
-
return (capName) => byName.get(capName) ?? null;
|
|
45674
|
-
}
|
|
45675
|
-
/** Caps every `BaseDevice` registers on itself; a second registration throws. */
|
|
45676
|
-
var BASE_DEVICE_CAPS = new Set(["device-status", "feature-probe"]);
|
|
45677
|
-
var PENDING_SELF = {
|
|
45678
|
-
addonId: COMPOSER_ADDON_ID,
|
|
45679
|
-
stableId: `${COMPOSED_DEVICE_STABLE_ID_PREFIX}(unsaved)`
|
|
45680
|
-
};
|
|
45681
|
-
function problem(code, path, message) {
|
|
45682
|
-
return {
|
|
45683
|
-
code,
|
|
45684
|
-
path,
|
|
45685
|
-
message
|
|
45686
|
-
};
|
|
45687
|
-
}
|
|
45688
|
-
function refused(...problems) {
|
|
45689
|
-
return {
|
|
45690
|
-
problems,
|
|
45691
|
-
fields: []
|
|
45692
|
-
};
|
|
45693
|
-
}
|
|
45694
44843
|
function readKinds(read, lookupCap) {
|
|
45695
44844
|
const def = lookupCap(read.cap);
|
|
45696
44845
|
const schema = def?.runtimeState ?? def?.status?.schema;
|
|
@@ -45785,78 +44934,644 @@ function enumLiteralProblem(cap, target, source, at) {
|
|
|
45785
44934
|
}
|
|
45786
44935
|
function roleOf(source) {
|
|
45787
44936
|
if (source.kind !== "expression") return "derived";
|
|
44937
|
+
if (expressionContainsBuiltinCall(source.expr, "count")) return "accumulator";
|
|
45788
44938
|
if (fieldReads(source).length > 0) return "derived";
|
|
45789
44939
|
const compiled = compileExpressionSafe(source.expr);
|
|
45790
44940
|
return compiled.ok && compiled.parsed.identifiers.has("now") ? "clock" : "constant";
|
|
45791
44941
|
}
|
|
45792
|
-
|
|
45793
|
-
|
|
45794
|
-
|
|
45795
|
-
|
|
45796
|
-
|
|
45797
|
-
|
|
45798
|
-
|
|
45799
|
-
|
|
45800
|
-
|
|
45801
|
-
|
|
45802
|
-
|
|
45803
|
-
if (
|
|
45804
|
-
|
|
45805
|
-
|
|
45806
|
-
|
|
45807
|
-
|
|
45808
|
-
|
|
45809
|
-
|
|
45810
|
-
|
|
45811
|
-
|
|
45812
|
-
|
|
45813
|
-
|
|
45814
|
-
|
|
45815
|
-
|
|
45816
|
-
|
|
45817
|
-
|
|
45818
|
-
|
|
45819
|
-
|
|
45820
|
-
|
|
45821
|
-
|
|
45822
|
-
|
|
45823
|
-
|
|
45824
|
-
|
|
44942
|
+
/**
|
|
44943
|
+
* How a planned field says "unavailable", per feature mode and AFTER `roleOf`
|
|
44944
|
+
* (D393, D663 rulings S1 + S1b). The composer cannot take a device it does not
|
|
44945
|
+
* own offline, and D393 forbids a stale number, so on an existing target a
|
|
44946
|
+
* field that READS a source never gets `offline`.
|
|
44947
|
+
*/
|
|
44948
|
+
function unavailableFor(tf, role, mode, cap, at) {
|
|
44949
|
+
if (mode === "replace" && (role === "derived" || role === "accumulator")) return {
|
|
44950
|
+
ok: true,
|
|
44951
|
+
unavailable: "release"
|
|
44952
|
+
};
|
|
44953
|
+
if (mode === "new" || role !== "derived") return {
|
|
44954
|
+
ok: true,
|
|
44955
|
+
unavailable: tf.nullable ? "null" : "offline"
|
|
44956
|
+
};
|
|
44957
|
+
if (tf.nullable) return {
|
|
44958
|
+
ok: true,
|
|
44959
|
+
unavailable: "null"
|
|
44960
|
+
};
|
|
44961
|
+
if (tf.enumValues?.includes("unknown") === true) return {
|
|
44962
|
+
ok: true,
|
|
44963
|
+
unavailable: "unknown"
|
|
44964
|
+
};
|
|
44965
|
+
return {
|
|
44966
|
+
ok: false,
|
|
44967
|
+
problem: problem("not-replaceable", at, `\`${cap}.${tf.path}\` reads a source but can say neither null nor 'unknown', and an ADDED capability has no native reading to fall back to (D393, D663)`)
|
|
44968
|
+
};
|
|
44969
|
+
}
|
|
44970
|
+
//#endregion
|
|
44971
|
+
//#region src/composition/composition-items.ts
|
|
44972
|
+
/** Item fields the composer writes itself, with the value it writes. */
|
|
44973
|
+
var COMPOSED_ITEM_FIXED_FIELDS = { resettable: false };
|
|
44974
|
+
function reservedItemFields(itemArray) {
|
|
44975
|
+
return new Set([
|
|
44976
|
+
itemArray.keyField,
|
|
44977
|
+
...itemArray.labelField === void 0 ? [] : [itemArray.labelField],
|
|
44978
|
+
...Object.keys(COMPOSED_ITEM_FIXED_FIELDS)
|
|
44979
|
+
]);
|
|
44980
|
+
}
|
|
44981
|
+
/** A required leaf under an optional parent is required only once something writes that parent. */
|
|
44982
|
+
function leafRequired(itemArray, path, written) {
|
|
44983
|
+
const described = describeStateField(itemArray.itemSchema, path);
|
|
44984
|
+
if (described === null || !described.required) return false;
|
|
44985
|
+
return optionalAncestors(itemArray.itemSchema, path).every((parent) => written.some((w) => w.startsWith(`${parent}.`)));
|
|
44986
|
+
}
|
|
44987
|
+
function missingLeaves({ capName, itemArray, reserved }, item, at) {
|
|
44988
|
+
const written = Object.keys(item.fields);
|
|
44989
|
+
return enumerateSchemaFields(itemArray.itemSchema).flatMap((leaf) => {
|
|
44990
|
+
if (reserved.has(leaf.path) || leaf.path in item.fields) return [];
|
|
44991
|
+
if (!leafRequired(itemArray, leaf.path, written)) return [];
|
|
44992
|
+
const described = describeStateField(itemArray.itemSchema, leaf.path);
|
|
44993
|
+
if (described === null || described.nullable) return [];
|
|
44994
|
+
return [problem("missing-field", `${at}.fields.${leaf.path}`, `\`${capName}.${itemArray.path}[].${leaf.path}\` is required and has no source`)];
|
|
44995
|
+
});
|
|
44996
|
+
}
|
|
44997
|
+
function planItemField(ctx, leaf) {
|
|
44998
|
+
const { capName, itemArray, featureIndex, lookupCap } = ctx;
|
|
44999
|
+
const { key, label, path, source } = leaf;
|
|
45000
|
+
const at = `features[${featureIndex}].items.${key}.fields.${path}`;
|
|
45001
|
+
if (ctx.reserved.has(path)) return refused(problem("item-field-reserved", at, `\`${capName}.${itemArray.path}[].${path}\` is set by the composer itself — it takes no source`));
|
|
45002
|
+
const tf = describeStateField(itemArray.itemSchema, path);
|
|
45003
|
+
if (tf === null) return refused(problem("unknown-field", at, `a \`${capName}\` item has no field \`${path}\``));
|
|
45004
|
+
const kinds = sourceKinds(source, lookupCap);
|
|
45005
|
+
if (!kinds.ok) return refused(problem(kinds.code, at, kinds.message));
|
|
45006
|
+
const role = roleOf(source);
|
|
45007
|
+
const unavailable = unavailableFor(tf, role, ctx.mode, capName, at);
|
|
45008
|
+
if (!unavailable.ok) return refused(unavailable.problem);
|
|
45009
|
+
const plan = {
|
|
45010
|
+
cap: capName,
|
|
45011
|
+
path,
|
|
45012
|
+
item: {
|
|
45013
|
+
arrayPath: itemArray.path,
|
|
45014
|
+
key,
|
|
45015
|
+
label
|
|
45016
|
+
},
|
|
45017
|
+
featureIndex,
|
|
45018
|
+
kind: tf.kind,
|
|
45019
|
+
nullable: tf.nullable,
|
|
45020
|
+
required: tf.required,
|
|
45021
|
+
unavailable: unavailable.unavailable,
|
|
45022
|
+
role,
|
|
45023
|
+
source,
|
|
45024
|
+
reads: [...fieldReads(source)]
|
|
45025
|
+
};
|
|
45026
|
+
const enumProblem = enumLiteralProblem(capName, tf, source, at);
|
|
45027
|
+
return {
|
|
45028
|
+
problems: [...compatibility(capName, tf, kinds.kinds, at), ...enumProblem === null ? [] : [enumProblem]],
|
|
45029
|
+
fields: [plan],
|
|
45030
|
+
features: [],
|
|
45031
|
+
events: []
|
|
45032
|
+
};
|
|
45033
|
+
}
|
|
45034
|
+
function planItems(def, feature, featureIndex, lookupCap, mode = "new") {
|
|
45035
|
+
const at = `features[${featureIndex}].items`;
|
|
45036
|
+
const itemArray = def.status?.itemArray;
|
|
45037
|
+
if (itemArray === void 0) return refused(problem("not-item-array", at, `\`${def.name}\` has no item array — it takes no \`items\``));
|
|
45038
|
+
if (itemArray.path !== "items") return refused(problem("not-item-array", at, `\`${def.name}\`'s item array is at \`${itemArray.path}\`, not \`${COMPOSITION_ITEM_ARRAY_PATH}\` — not composable yet`));
|
|
45039
|
+
const ctx = {
|
|
45040
|
+
capName: def.name,
|
|
45041
|
+
itemArray,
|
|
45042
|
+
reserved: reservedItemFields(itemArray),
|
|
45043
|
+
featureIndex,
|
|
45044
|
+
lookupCap,
|
|
45045
|
+
mode
|
|
45046
|
+
};
|
|
45047
|
+
const results = Object.entries(feature.items ?? {}).flatMap(([key, item]) => [{
|
|
45048
|
+
problems: missingLeaves(ctx, item, `${at}.${key}`),
|
|
45049
|
+
fields: [],
|
|
45050
|
+
features: [],
|
|
45051
|
+
events: []
|
|
45052
|
+
}, ...Object.entries(item.fields).map(([path, source]) => planItemField(ctx, {
|
|
45053
|
+
key,
|
|
45054
|
+
label: item.label,
|
|
45055
|
+
path,
|
|
45056
|
+
source
|
|
45057
|
+
}))]);
|
|
45058
|
+
return {
|
|
45059
|
+
problems: results.flatMap((r) => r.problems),
|
|
45060
|
+
fields: results.flatMap((r) => r.fields),
|
|
45061
|
+
features: [],
|
|
45062
|
+
events: []
|
|
45063
|
+
};
|
|
45064
|
+
}
|
|
45065
|
+
//#endregion
|
|
45066
|
+
//#region src/composition/evaluate-field.ts
|
|
45067
|
+
function describeRead(read) {
|
|
45068
|
+
return `${compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
|
|
45069
|
+
}
|
|
45070
|
+
function isConfirmed(reading) {
|
|
45071
|
+
return reading.fatal || reading.confirmed === true;
|
|
45072
|
+
}
|
|
45073
|
+
function fromReading(reading, read) {
|
|
45074
|
+
if (reading.state === "unavailable") return {
|
|
45075
|
+
state: "unavailable",
|
|
45076
|
+
value: null,
|
|
45077
|
+
reason: `${describeRead(read)}: ${reading.reason}`,
|
|
45078
|
+
fatal: reading.fatal,
|
|
45079
|
+
confirmed: isConfirmed(reading)
|
|
45080
|
+
};
|
|
45081
|
+
return {
|
|
45082
|
+
state: reading.state,
|
|
45083
|
+
value: reading.value,
|
|
45084
|
+
reason: reading.state === "stale" ? `${describeRead(read)}: ${reading.reason}` : null,
|
|
45085
|
+
deadline: null
|
|
45086
|
+
};
|
|
45087
|
+
}
|
|
45088
|
+
function expressionOutcome(source, read, now, stateful) {
|
|
45089
|
+
const values = {};
|
|
45090
|
+
const staleReasons = [];
|
|
45091
|
+
let fatalUnavailable = null;
|
|
45092
|
+
let nonFatalUnavailable = null;
|
|
45093
|
+
for (const [name, binding] of Object.entries(source.bindings)) {
|
|
45094
|
+
if (binding.kind === "literal") {
|
|
45095
|
+
values[name] = binding.value;
|
|
45096
|
+
continue;
|
|
45097
|
+
}
|
|
45098
|
+
const reading = read(binding);
|
|
45099
|
+
if (reading.state === "unavailable") {
|
|
45100
|
+
const outcome = {
|
|
45101
|
+
state: "unavailable",
|
|
45102
|
+
value: null,
|
|
45103
|
+
reason: `binding \`${name}\` (${describeRead(binding)}): ${reading.reason}`,
|
|
45104
|
+
fatal: reading.fatal,
|
|
45105
|
+
confirmed: isConfirmed(reading)
|
|
45106
|
+
};
|
|
45107
|
+
if (reading.fatal) {
|
|
45108
|
+
fatalUnavailable = outcome;
|
|
45109
|
+
break;
|
|
45110
|
+
}
|
|
45111
|
+
if (nonFatalUnavailable === null || outcome.confirmed && !nonFatalUnavailable.confirmed) nonFatalUnavailable = outcome;
|
|
45112
|
+
continue;
|
|
45113
|
+
}
|
|
45114
|
+
values[name] = reading.value;
|
|
45115
|
+
if (reading.state === "stale") staleReasons.push(`\`${name}\`: ${reading.reason}`);
|
|
45116
|
+
}
|
|
45117
|
+
const unavailable = fatalUnavailable ?? nonFatalUnavailable;
|
|
45118
|
+
if (unavailable !== null) {
|
|
45119
|
+
if (stateful !== void 0 && stateful.currentOutput !== void 0 && expressionContainsBuiltinCall(source.expr, "count")) return {
|
|
45120
|
+
state: "stale",
|
|
45121
|
+
value: evaluateCount(null, {
|
|
45122
|
+
kind: "count",
|
|
45123
|
+
highWater: null
|
|
45124
|
+
}, stateful.currentOutput),
|
|
45125
|
+
reason: `${unavailable.reason}; holding the last accumulator value`,
|
|
45126
|
+
deadline: null
|
|
45825
45127
|
};
|
|
45826
|
-
|
|
45827
|
-
|
|
45828
|
-
|
|
45829
|
-
|
|
45128
|
+
return unavailable;
|
|
45129
|
+
}
|
|
45130
|
+
const deadlines = [];
|
|
45131
|
+
const result = evaluateExpressionSource(source.expr, values, now, {
|
|
45132
|
+
hooks: { noteDeadline: (at) => deadlines.push(at) },
|
|
45133
|
+
...stateful === void 0 ? {} : { invokeStateful: (invocation) => evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
|
|
45134
|
+
...invocation,
|
|
45135
|
+
path: `${stateful.callPathPrefix}@${invocation.path}`
|
|
45136
|
+
}, stateful.expressionMemory, {
|
|
45137
|
+
currentOutput: stateful.currentOutput,
|
|
45138
|
+
startedAtMs: stateful.startedAtMs,
|
|
45139
|
+
nowMs: now
|
|
45140
|
+
}) }
|
|
45141
|
+
});
|
|
45142
|
+
if (!result.ok) return {
|
|
45143
|
+
state: "unavailable",
|
|
45144
|
+
value: null,
|
|
45145
|
+
reason: `the expression failed: ${result.error}`,
|
|
45146
|
+
fatal: false,
|
|
45147
|
+
confirmed: true
|
|
45148
|
+
};
|
|
45149
|
+
return {
|
|
45150
|
+
state: staleReasons.length > 0 ? "stale" : "fresh",
|
|
45151
|
+
value: result.value,
|
|
45152
|
+
reason: staleReasons.length > 0 ? staleReasons.join("; ") : null,
|
|
45153
|
+
deadline: deadlines.length > 0 ? Math.min(...deadlines) : null
|
|
45154
|
+
};
|
|
45155
|
+
}
|
|
45156
|
+
function evaluateCompositionField(input) {
|
|
45157
|
+
const { source } = input;
|
|
45158
|
+
switch (source.kind) {
|
|
45159
|
+
case "from": return fromReading(input.read(source), source);
|
|
45160
|
+
case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
|
|
45161
|
+
case "code": return {
|
|
45162
|
+
state: "unavailable",
|
|
45163
|
+
value: null,
|
|
45164
|
+
reason: "code fields are not runnable in the composer — they arrive in slice 4",
|
|
45165
|
+
fatal: true,
|
|
45166
|
+
confirmed: true
|
|
45830
45167
|
};
|
|
45168
|
+
}
|
|
45169
|
+
}
|
|
45170
|
+
//#endregion
|
|
45171
|
+
//#region src/composition/examples.ts
|
|
45172
|
+
/**
|
|
45173
|
+
* The worked composed-device example: a ROOM. Temperature is the average of N
|
|
45174
|
+
* sensors, and occupancy is any motion within the last five minutes. It is the
|
|
45175
|
+
* slice-1 acceptance case and the template an author starts from (Phase 4
|
|
45176
|
+
* §4 item 4 asked for one).
|
|
45177
|
+
*/
|
|
45178
|
+
var ROOM_OCCUPANCY_WINDOW_MS = 3e5;
|
|
45179
|
+
var ROOM_EXAMPLE_TEMPERATURE_SOURCES = [
|
|
45180
|
+
{
|
|
45181
|
+
addonId: "provider-homeassistant",
|
|
45182
|
+
stableId: "sensor.living_room_temperature"
|
|
45183
|
+
},
|
|
45184
|
+
{
|
|
45185
|
+
addonId: "provider-homeassistant",
|
|
45186
|
+
stableId: "sensor.sofa_temperature"
|
|
45187
|
+
},
|
|
45188
|
+
{
|
|
45189
|
+
addonId: "provider-homeassistant",
|
|
45190
|
+
stableId: "sensor.window_temperature"
|
|
45191
|
+
}
|
|
45192
|
+
];
|
|
45193
|
+
var ROOM_EXAMPLE_MOTION_SOURCES = [{
|
|
45194
|
+
addonId: "provider-homeassistant",
|
|
45195
|
+
stableId: "binary_sensor.living_room_motion"
|
|
45196
|
+
}, {
|
|
45197
|
+
addonId: "provider-homeassistant",
|
|
45198
|
+
stableId: "binary_sensor.living_room_presence"
|
|
45199
|
+
}];
|
|
45200
|
+
function from(source, cap, fieldPath) {
|
|
45201
|
+
return {
|
|
45202
|
+
kind: "from",
|
|
45203
|
+
source,
|
|
45204
|
+
cap,
|
|
45205
|
+
fieldPath
|
|
45206
|
+
};
|
|
45207
|
+
}
|
|
45208
|
+
function named(prefix, sources, cap, fieldPath) {
|
|
45209
|
+
return Object.fromEntries(sources.map((s, i) => [`${prefix}${i + 1}`, from(s, cap, fieldPath)]));
|
|
45210
|
+
}
|
|
45211
|
+
function roomCompositionExample(input) {
|
|
45212
|
+
const t = named("t", input.temperatureSources, "temperature-sensor", "celsius");
|
|
45213
|
+
const f = named("f", input.temperatureSources, "temperature-sensor", "lastFetchedAt");
|
|
45214
|
+
const d = named("d", input.motionSources, "motion", "detected");
|
|
45215
|
+
const m = named("m", input.motionSources, "motion", "lastDetectedAt");
|
|
45216
|
+
const windows = Object.keys(m).map((name) => `within(${name}, ${input.occupancyWindowMs})`);
|
|
45217
|
+
return CompositionSchema.parse({
|
|
45218
|
+
target: {
|
|
45219
|
+
kind: "new",
|
|
45220
|
+
type: DeviceType.Sensor
|
|
45221
|
+
},
|
|
45222
|
+
features: [{
|
|
45223
|
+
kind: "fields",
|
|
45224
|
+
cap: "temperature-sensor",
|
|
45225
|
+
fields: {
|
|
45226
|
+
celsius: {
|
|
45227
|
+
kind: "expression",
|
|
45228
|
+
expr: `round(avg(${Object.keys(t).join(", ")}), 1)`,
|
|
45229
|
+
bindings: t
|
|
45230
|
+
},
|
|
45231
|
+
lastFetchedAt: {
|
|
45232
|
+
kind: "expression",
|
|
45233
|
+
expr: `max(${Object.keys(f).join(", ")})`,
|
|
45234
|
+
bindings: f
|
|
45235
|
+
}
|
|
45236
|
+
}
|
|
45237
|
+
}, {
|
|
45238
|
+
kind: "fields",
|
|
45239
|
+
cap: "binary",
|
|
45240
|
+
fields: {
|
|
45241
|
+
on: {
|
|
45242
|
+
kind: "expression",
|
|
45243
|
+
expr: `any(${[...Object.keys(d), ...windows].join(", ")})`,
|
|
45244
|
+
bindings: {
|
|
45245
|
+
...d,
|
|
45246
|
+
...m
|
|
45247
|
+
}
|
|
45248
|
+
},
|
|
45249
|
+
lastChangedAt: {
|
|
45250
|
+
kind: "expression",
|
|
45251
|
+
expr: "now",
|
|
45252
|
+
bindings: {}
|
|
45253
|
+
}
|
|
45254
|
+
}
|
|
45255
|
+
}]
|
|
45256
|
+
});
|
|
45257
|
+
}
|
|
45258
|
+
/**
|
|
45259
|
+
* The slice-2 worked customization (D663): the PetKit "Fresh Element Infinity"
|
|
45260
|
+
* feeder as Home Assistant imports it — ONE `Container` with a child per entity
|
|
45261
|
+
* (`<container stableId>-<entityId>`), and NO native battery (its
|
|
45262
|
+
* `binary_sensor.*_battery` is `battery_charging`, which `isBatteryEntity` does
|
|
45263
|
+
* not match). The customization ADDS `consumables` (the desiccant) and
|
|
45264
|
+
* `battery`. It is the Task 14 acceptance case and the template slice 5's
|
|
45265
|
+
* presets start from.
|
|
45266
|
+
*
|
|
45267
|
+
* Every read names what the HA provider REALLY registers (read 2026-09-28):
|
|
45268
|
+
* the desiccant sensor has a unit (`d`) but no device_class, so HA hosts it as
|
|
45269
|
+
* an `enum-sensor` whose `value` is the raw STRING state — `number(d)` reads it,
|
|
45270
|
+
* and anything that is not a number is `null`, never 0 (D393). The battery
|
|
45271
|
+
* status sensor is an `enum-sensor` too (`unavailable` keeps its cold `''`, so
|
|
45272
|
+
* `percentage` is `null`). `charging` maps `battery_charging` off to
|
|
45273
|
+
* `'unknown'`, never `'none'`: off does not prove "on battery alone" (the
|
|
45274
|
+
* operator confirms the real semantics live).
|
|
45275
|
+
*/
|
|
45276
|
+
var FEEDER_EXAMPLE_HA_DEVICE_ID = "8dec3b512fda40cbb8cd121c7a99f890";
|
|
45277
|
+
var FEEDER_EXAMPLE_ADDON_ID = "provider-homeassistant";
|
|
45278
|
+
/** The HA container's stableId (`ha-discovery.ts`) and a child's (`<container>-<entityId>`). */
|
|
45279
|
+
function feederExampleSources(brokerId) {
|
|
45280
|
+
const feeder = {
|
|
45281
|
+
addonId: FEEDER_EXAMPLE_ADDON_ID,
|
|
45282
|
+
stableId: `ha:${brokerId}:dev:${FEEDER_EXAMPLE_HA_DEVICE_ID}`
|
|
45283
|
+
};
|
|
45284
|
+
const child = (entityId) => ({
|
|
45285
|
+
addonId: FEEDER_EXAMPLE_ADDON_ID,
|
|
45286
|
+
stableId: `${feeder.stableId}-${entityId}`
|
|
45287
|
+
});
|
|
45288
|
+
return {
|
|
45289
|
+
feeder,
|
|
45290
|
+
desiccantDays: child("sensor.freshelement_3_desiccant_days_remaining"),
|
|
45291
|
+
batteryStatus: child("sensor.freshelement_3_battery_status"),
|
|
45292
|
+
batteryCharging: child("binary_sensor.freshelement_3_battery")
|
|
45293
|
+
};
|
|
45294
|
+
}
|
|
45295
|
+
function feederCustomizationExample(sources) {
|
|
45296
|
+
const days = { d: from(sources.desiccantDays, "enum-sensor", "value") };
|
|
45297
|
+
return CompositionSchema.parse({
|
|
45298
|
+
target: {
|
|
45299
|
+
kind: "existing",
|
|
45300
|
+
device: sources.feeder
|
|
45301
|
+
},
|
|
45302
|
+
features: [{
|
|
45303
|
+
kind: "fields",
|
|
45304
|
+
cap: "consumables",
|
|
45305
|
+
fields: {
|
|
45306
|
+
lastChangedAt: {
|
|
45307
|
+
kind: "expression",
|
|
45308
|
+
expr: "now",
|
|
45309
|
+
bindings: {}
|
|
45310
|
+
},
|
|
45311
|
+
lastFetchedAt: {
|
|
45312
|
+
kind: "expression",
|
|
45313
|
+
expr: "now",
|
|
45314
|
+
bindings: {}
|
|
45315
|
+
}
|
|
45316
|
+
},
|
|
45317
|
+
items: { desiccant: {
|
|
45318
|
+
label: "Desiccant",
|
|
45319
|
+
fields: {
|
|
45320
|
+
"remaining.value": {
|
|
45321
|
+
kind: "expression",
|
|
45322
|
+
expr: "number(d)",
|
|
45323
|
+
bindings: days
|
|
45324
|
+
},
|
|
45325
|
+
"remaining.unit": {
|
|
45326
|
+
kind: "expression",
|
|
45327
|
+
expr: "\"days\"",
|
|
45328
|
+
bindings: {}
|
|
45329
|
+
},
|
|
45330
|
+
status: {
|
|
45331
|
+
kind: "expression",
|
|
45332
|
+
expr: "number(d) == null ? null : (number(d) <= 0 ? \"replace\" : \"ok\")",
|
|
45333
|
+
bindings: days
|
|
45334
|
+
}
|
|
45335
|
+
}
|
|
45336
|
+
} }
|
|
45337
|
+
}, {
|
|
45338
|
+
kind: "fields",
|
|
45339
|
+
cap: "battery",
|
|
45340
|
+
fields: {
|
|
45341
|
+
percentage: {
|
|
45342
|
+
kind: "expression",
|
|
45343
|
+
expr: "s == \"low\" ? 15 : (s == \"normal\" ? 100 : null)",
|
|
45344
|
+
bindings: { s: from(sources.batteryStatus, "enum-sensor", "value") }
|
|
45345
|
+
},
|
|
45346
|
+
binary: {
|
|
45347
|
+
kind: "expression",
|
|
45348
|
+
expr: "true",
|
|
45349
|
+
bindings: {}
|
|
45350
|
+
},
|
|
45351
|
+
charging: {
|
|
45352
|
+
kind: "expression",
|
|
45353
|
+
expr: "c ? \"dc\" : \"unknown\"",
|
|
45354
|
+
bindings: { c: from(sources.batteryCharging, "binary", "on") }
|
|
45355
|
+
},
|
|
45356
|
+
sleeping: {
|
|
45357
|
+
kind: "expression",
|
|
45358
|
+
expr: "false",
|
|
45359
|
+
bindings: {}
|
|
45360
|
+
},
|
|
45361
|
+
lastUpdated: {
|
|
45362
|
+
kind: "expression",
|
|
45363
|
+
expr: "now",
|
|
45364
|
+
bindings: {}
|
|
45365
|
+
}
|
|
45366
|
+
}
|
|
45367
|
+
}]
|
|
45831
45368
|
});
|
|
45369
|
+
}
|
|
45370
|
+
//#endregion
|
|
45371
|
+
//#region src/composition/validate-composition.ts
|
|
45372
|
+
function buildCapabilityLookup(defs) {
|
|
45373
|
+
const byName = new Map(defs.map((d) => [d.name, d]));
|
|
45374
|
+
return (capName) => byName.get(capName) ?? null;
|
|
45375
|
+
}
|
|
45376
|
+
/** Caps every `BaseDevice` registers on itself; a second registration throws. */
|
|
45377
|
+
var BASE_DEVICE_CAPS = new Set(["device-status", "feature-probe"]);
|
|
45378
|
+
var PENDING_SELF = {
|
|
45379
|
+
addonId: COMPOSER_ADDON_ID,
|
|
45380
|
+
stableId: `${COMPOSED_DEVICE_STABLE_ID_PREFIX}(unsaved)`
|
|
45381
|
+
};
|
|
45382
|
+
/** The candidate's block id before its first save. Stored block ids are `randomUUID()`, so none can carry it. */
|
|
45383
|
+
var PENDING_BLOCK_ID = "(unsaved)";
|
|
45384
|
+
function composableCap(feature, at, lookupCap) {
|
|
45385
|
+
const def = lookupCap(feature.cap);
|
|
45386
|
+
if (def === null) return problem("unknown-capability", `${at}.cap`, `no capability is named \`${feature.cap}\``);
|
|
45387
|
+
if (BASE_DEVICE_CAPS.has(def.name)) return problem("not-composable", `${at}.cap`, `\`${def.name}\` is registered by every device itself — it cannot be composed`);
|
|
45388
|
+
const state = def.runtimeState;
|
|
45389
|
+
if (def.scope !== "device" || state === void 0) return problem("not-composable", `${at}.cap`, `\`${def.name}\` has no per-device state to compose`);
|
|
45390
|
+
return {
|
|
45391
|
+
def,
|
|
45392
|
+
state,
|
|
45393
|
+
fields: describeTopLevelStateFields(state)
|
|
45394
|
+
};
|
|
45395
|
+
}
|
|
45396
|
+
/**
|
|
45397
|
+
* A capability BUILT by the composition (a new device, or one ADDED to an
|
|
45398
|
+
* existing device) must fit the device type, serve no command, and have every
|
|
45399
|
+
* required field. A REPLACE needs none of it: the cap is bound (a fact), the
|
|
45400
|
+
* native keeps serving its methods, and only the named fields are owned (D663).
|
|
45401
|
+
*/
|
|
45402
|
+
function builtCapProblems({ def, state, fields: targetFields }, feature, at, deviceType) {
|
|
45403
|
+
const problems = [];
|
|
45404
|
+
if (def.deviceTypes !== void 0 && !def.deviceTypes.includes(deviceType)) problems.push(problem("wrong-device-type", `${at}.cap`, `\`${def.name}\` is not offered on a \`${deviceType}\` device (it allows ${def.deviceTypes.join(", ")})`));
|
|
45405
|
+
const served = Object.entries(def.methods).filter(([name, m]) => m.systemOnly !== true && def.composedMethods?.[name] === void 0).map(([name]) => `\`${name}\``);
|
|
45406
|
+
if (served.length > 0) problems.push(problem("has-commands", `${at}.cap`, `\`${def.name}\` has ${served.join(", ")}, which a composed device cannot serve until commands arrive (slice 3)`));
|
|
45407
|
+
const itemArrayPath = feature.items === void 0 ? null : def.status?.itemArray?.path ?? null;
|
|
45408
|
+
for (const key of requiredTopLevelKeys(state)) {
|
|
45409
|
+
if (key === itemArrayPath) continue;
|
|
45410
|
+
if (!targetFields.has(key)) problems.push(problem("not-composable", `${at}.fields`, `\`${def.name}.${key}\` is not a scalar — nested fields arrive in a later slice`));
|
|
45411
|
+
else if (!(key in feature.fields)) problems.push(problem("missing-field", `${at}.fields.${key}`, `\`${def.name}.${key}\` is required and has no source`));
|
|
45412
|
+
}
|
|
45413
|
+
return problems;
|
|
45414
|
+
}
|
|
45415
|
+
function planTopLevelField({ def, fields }, field, mode, lookupCap) {
|
|
45416
|
+
const { featureIndex, path, source } = field;
|
|
45417
|
+
const fieldAt = `features[${featureIndex}].fields.${path}`;
|
|
45418
|
+
if (path.includes(".")) return refused(problem("nested-field", fieldAt, `\`${path}\` is nested — nested fields arrive in a later slice`));
|
|
45419
|
+
const tf = fields.get(path);
|
|
45420
|
+
if (tf === void 0) return refused(problem("unknown-field", fieldAt, `\`${def.name}\` has no field \`${path}\``));
|
|
45421
|
+
const kinds = sourceKinds(source, lookupCap);
|
|
45422
|
+
if (!kinds.ok) return refused(problem(kinds.code, fieldAt, kinds.message));
|
|
45423
|
+
const role = roleOf(source);
|
|
45424
|
+
const unavailable = unavailableFor(tf, role, mode, def.name, fieldAt);
|
|
45425
|
+
if (!unavailable.ok) return refused(unavailable.problem);
|
|
45426
|
+
const plan = {
|
|
45427
|
+
cap: def.name,
|
|
45428
|
+
path,
|
|
45429
|
+
featureIndex,
|
|
45430
|
+
kind: tf.kind,
|
|
45431
|
+
nullable: tf.nullable,
|
|
45432
|
+
required: tf.required,
|
|
45433
|
+
unavailable: unavailable.unavailable,
|
|
45434
|
+
role,
|
|
45435
|
+
source,
|
|
45436
|
+
reads: [...fieldReads(source)]
|
|
45437
|
+
};
|
|
45438
|
+
const enumProblem = enumLiteralProblem(def.name, tf, source, fieldAt);
|
|
45832
45439
|
return {
|
|
45833
|
-
problems: [...
|
|
45834
|
-
fields:
|
|
45440
|
+
problems: [...compatibility(def.name, tf, kinds.kinds, fieldAt), ...enumProblem === null ? [] : [enumProblem]],
|
|
45441
|
+
fields: [plan],
|
|
45442
|
+
features: [],
|
|
45443
|
+
events: []
|
|
45835
45444
|
};
|
|
45836
45445
|
}
|
|
45837
|
-
function
|
|
45838
|
-
const
|
|
45839
|
-
|
|
45446
|
+
function planFeature(feature, featureIndex, target, lookupCap) {
|
|
45447
|
+
const at = `features[${featureIndex}]`;
|
|
45448
|
+
const cap = composableCap(feature, at, lookupCap);
|
|
45449
|
+
if ("code" in cap) return refused(cap);
|
|
45450
|
+
const capProblems = target.mode === "replace" ? [] : [...builtCapProblems(cap, feature, at, target.deviceType)];
|
|
45451
|
+
if (feature.commands !== void 0 && Object.keys(feature.commands).length > 0) capProblems.push(problem("reserved-variant", `${at}.commands`, "commands (`forward`) arrive in slice 3"));
|
|
45452
|
+
const perField = Object.entries(feature.fields).map(([path, source]) => planTopLevelField(cap, {
|
|
45453
|
+
featureIndex,
|
|
45454
|
+
path,
|
|
45455
|
+
source
|
|
45456
|
+
}, target.mode, lookupCap));
|
|
45457
|
+
const items = feature.items === void 0 ? [] : [planItems(cap.def, feature, featureIndex, lookupCap, target.mode)];
|
|
45458
|
+
const all = [...perField, ...items];
|
|
45459
|
+
const fields = all.flatMap((result) => result.fields);
|
|
45460
|
+
const featurePlan = {
|
|
45461
|
+
featureIndex,
|
|
45462
|
+
cap: cap.def.name,
|
|
45463
|
+
mode: target.mode
|
|
45464
|
+
};
|
|
45465
|
+
const eventPlan = planCompositionEvents(cap.def, featurePlan, fields);
|
|
45466
|
+
return {
|
|
45467
|
+
problems: [
|
|
45468
|
+
...capProblems,
|
|
45469
|
+
...all.flatMap((r) => r.problems),
|
|
45470
|
+
...eventPlan.problems
|
|
45471
|
+
],
|
|
45472
|
+
fields,
|
|
45473
|
+
features: [featurePlan],
|
|
45474
|
+
events: eventPlan.events
|
|
45475
|
+
};
|
|
45476
|
+
}
|
|
45477
|
+
/** A cap the device serves itself; one the composer grafted (an earlier ADD) is not native. */
|
|
45478
|
+
function isNativeCap(target, cap) {
|
|
45479
|
+
const owner = target.nativeCaps.get(cap);
|
|
45480
|
+
return owner !== void 0 && owner !== "composer";
|
|
45481
|
+
}
|
|
45482
|
+
/** The target read, or the refusal that replaces the whole plan when it could not be (D391). */
|
|
45483
|
+
function planTargetOf(composition, target) {
|
|
45484
|
+
if (composition.target.kind === "new") return {
|
|
45485
|
+
kind: "new",
|
|
45486
|
+
type: composition.target.type
|
|
45487
|
+
};
|
|
45488
|
+
const key = compositionSourceKey(composition.target.device);
|
|
45489
|
+
if (target === void 0) return problem("target-unreadable", "target", `target device \`${key}\` was not read — the save is refused rather than stored unchecked`);
|
|
45490
|
+
if (target.kind === "absent") return problem("target-missing", "target", `target device \`${key}\` does not exist`);
|
|
45491
|
+
if (target.kind === "unreadable") return problem("target-unreadable", "target", `could not read target device \`${key}\` (${target.error}) — the save is refused rather than stored unchecked`);
|
|
45492
|
+
return {
|
|
45493
|
+
kind: "existing",
|
|
45494
|
+
found: target
|
|
45495
|
+
};
|
|
45496
|
+
}
|
|
45497
|
+
function featureTargetOf(target, cap) {
|
|
45498
|
+
if (target.kind === "new") return {
|
|
45499
|
+
mode: "new",
|
|
45500
|
+
deviceType: target.type
|
|
45501
|
+
};
|
|
45502
|
+
return {
|
|
45503
|
+
mode: isNativeCap(target.found, cap) ? "replace" : "add",
|
|
45504
|
+
deviceType: target.found.type
|
|
45505
|
+
};
|
|
45506
|
+
}
|
|
45507
|
+
/**
|
|
45508
|
+
* The static plan. `target` describes an EXISTING target device (one read);
|
|
45509
|
+
* it is ignored for a new one. On an existing target each feature REPLACES a
|
|
45510
|
+
* cap the device has natively, else ADDS it (D663).
|
|
45511
|
+
*/
|
|
45512
|
+
function planComposition(composition, lookupCap, target) {
|
|
45513
|
+
const planTarget = planTargetOf(composition, target);
|
|
45514
|
+
if ("code" in planTarget) return refused(planTarget);
|
|
45840
45515
|
const results = composition.features.map((feature, index) => {
|
|
45841
|
-
const
|
|
45842
|
-
|
|
45843
|
-
|
|
45516
|
+
const result = feature.kind === "passthrough" ? refused(problem("reserved-variant", `features[${index}]`, `whole-capability passthrough of \`${feature.cap}\` arrives in slice 3`)) : planFeature(feature, index, featureTargetOf(planTarget, feature.cap), lookupCap);
|
|
45517
|
+
return compositionFeatureEnabled(feature) ? result : {
|
|
45518
|
+
problems: result.problems,
|
|
45519
|
+
fields: [],
|
|
45520
|
+
features: [],
|
|
45521
|
+
events: []
|
|
45522
|
+
};
|
|
45844
45523
|
});
|
|
45845
45524
|
return {
|
|
45846
45525
|
problems: results.flatMap((r) => r.problems),
|
|
45847
|
-
fields: results.flatMap((r) => r.fields)
|
|
45526
|
+
fields: results.flatMap((r) => r.fields),
|
|
45527
|
+
features: results.flatMap((r) => r.features),
|
|
45528
|
+
events: results.flatMap((r) => r.events)
|
|
45848
45529
|
};
|
|
45849
45530
|
}
|
|
45850
45531
|
function compositionSourceRefs(composition) {
|
|
45851
|
-
const refs = composition.features.flatMap((f) => f.kind === "fields" ?
|
|
45532
|
+
const refs = composition.features.flatMap((f) => compositionFeatureEnabled(f) && f.kind === "fields" ? featureSources(f).flatMap(fieldReads).map((r) => r.source) : []);
|
|
45852
45533
|
return [...new Map(refs.map((r) => [compositionSourceKey(r), r])).values()];
|
|
45853
45534
|
}
|
|
45854
|
-
|
|
45855
|
-
|
|
45535
|
+
/**
|
|
45536
|
+
* The candidate's device: the existing target itself, else `self`, else a
|
|
45537
|
+
* placeholder that cannot collide with a stored target. An existing target is
|
|
45538
|
+
* known even on create, so a second customization of it is refused on create too.
|
|
45539
|
+
*/
|
|
45540
|
+
function candidateSelf(composition, ctx, plan) {
|
|
45541
|
+
return {
|
|
45542
|
+
ref: composition.target.kind === "existing" ? composition.target.device : ctx.self ?? PENDING_SELF,
|
|
45543
|
+
native: composition.target.kind === "existing" && ctx.target?.kind === "found" ? ctx.target : null,
|
|
45544
|
+
replaced: replacedFieldKeys(plan)
|
|
45545
|
+
};
|
|
45546
|
+
}
|
|
45547
|
+
/**
|
|
45548
|
+
* `compositionFieldKey` of every field a REPLACE feature of `plan` owns — the
|
|
45549
|
+
* candidate's own, and a stored peer's `CompositionPeer.replaced` (D663): one
|
|
45550
|
+
* derivation, so the graph reads both the same way.
|
|
45551
|
+
*/
|
|
45552
|
+
function replacedFieldKeys(plan) {
|
|
45553
|
+
const replacing = new Set(plan.features.filter((f) => f.mode === "replace").map((f) => f.featureIndex));
|
|
45554
|
+
return new Set(plan.fields.filter((f) => replacing.has(f.featureIndex)).map(compositionFieldKey));
|
|
45555
|
+
}
|
|
45556
|
+
/**
|
|
45557
|
+
* A read of the candidate's own device. Its own composed output (a new device's
|
|
45558
|
+
* field, an ADDED field) is the slice-1 own-field rule; on an existing target
|
|
45559
|
+
* every other field — replaced, or not composed at all — is the NATIVE value,
|
|
45560
|
+
* valid when the device serves that cap natively (D663, rule 5).
|
|
45561
|
+
*/
|
|
45562
|
+
function selfReadProblems(read, at, fields, self) {
|
|
45563
|
+
const readKey = `${read.cap}.${read.fieldPath}`;
|
|
45564
|
+
if (fields.some((f) => compositionFieldKey(f) === readKey && !self.replaced.has(readKey))) return [];
|
|
45565
|
+
if (self.native === null) return [problem("source-field-unknown", at, `this device has no composed field \`${read.cap}.${read.fieldPath}\``)];
|
|
45566
|
+
if (isNativeCap(self.native, read.cap)) return [];
|
|
45567
|
+
return [problem("source-capability-missing", at, `the target device (device ${self.native.deviceId}) has no native \`${read.cap}\``)];
|
|
45568
|
+
}
|
|
45569
|
+
function sourceProblems(fields, ctx, self) {
|
|
45570
|
+
const selfKey = compositionSourceKey(self.ref);
|
|
45856
45571
|
return fields.flatMap((field) => field.reads.flatMap((read) => {
|
|
45857
|
-
const at =
|
|
45572
|
+
const at = compositionFieldAt(field);
|
|
45858
45573
|
const key = compositionSourceKey(read.source);
|
|
45859
|
-
if (key === selfKey) return
|
|
45574
|
+
if (key === selfKey) return selfReadProblems(read, at, fields, self);
|
|
45860
45575
|
const desc = ctx.sources.get(key);
|
|
45861
45576
|
if (desc === void 0 || desc.kind === "unreadable") return [problem("source-unreadable", at, `could not read source \`${key}\` (${desc === void 0 ? "it was not read" : desc.error}) — the save is refused rather than stored unchecked`)];
|
|
45862
45577
|
if (desc.kind === "absent") return [problem("source-missing", at, `source \`${key}\` does not exist`)];
|
|
@@ -45869,8 +45584,9 @@ function sourceProblems(fields, ctx) {
|
|
|
45869
45584
|
* `<addonId>/<stableId>#<cap>.<fieldPath>`. When a node belongs to the
|
|
45870
45585
|
* CANDIDATE itself (this composition being saved), pull its `cap`/`fieldPath`
|
|
45871
45586
|
* back out so the refusal can point at that exact field, matching the
|
|
45872
|
-
* documented `features[N].fields.<path>` convention
|
|
45873
|
-
*
|
|
45587
|
+
* documented `features[N].fields.<path>` convention. A cap name has no `.`,
|
|
45588
|
+
* so splitting `rest` on the FIRST `.` is exact; an item leaf's remainder
|
|
45589
|
+
* (`items[desiccant].status`) is matched through `compositionFieldKey`.
|
|
45874
45590
|
*/
|
|
45875
45591
|
function candidateFieldOfNode(nodeKey, candidateKey) {
|
|
45876
45592
|
const prefix = `${candidateKey}#`;
|
|
@@ -45890,44 +45606,66 @@ function cyclePath(nodePath, candidateKey, fields) {
|
|
|
45890
45606
|
for (const nodeKey of nodePath) {
|
|
45891
45607
|
const hit = candidateFieldOfNode(nodeKey, candidateKey);
|
|
45892
45608
|
if (hit === null) continue;
|
|
45893
|
-
const
|
|
45894
|
-
|
|
45609
|
+
const hitKey = `${hit.cap}.${hit.fieldPath}`;
|
|
45610
|
+
const field = fields.find((f) => compositionFieldKey(f) === hitKey);
|
|
45611
|
+
if (field !== void 0) return compositionFieldAt(field);
|
|
45895
45612
|
}
|
|
45896
45613
|
return "features";
|
|
45897
45614
|
}
|
|
45615
|
+
/** The first unread device any of `nodes` belongs to; null when none does. */
|
|
45616
|
+
function unreadDeviceOf(nodes, unread) {
|
|
45617
|
+
for (const [key, error] of unread) if (nodes.some((node) => node.startsWith(`${key}#`))) return {
|
|
45618
|
+
key,
|
|
45619
|
+
error
|
|
45620
|
+
};
|
|
45621
|
+
return null;
|
|
45622
|
+
}
|
|
45898
45623
|
/**
|
|
45899
|
-
* Cycle check runs against the CANDIDATE (this composition,
|
|
45900
|
-
*
|
|
45901
|
-
*
|
|
45902
|
-
*
|
|
45903
|
-
*
|
|
45904
|
-
*
|
|
45624
|
+
* Cycle check runs against the CANDIDATE (this composition, as block
|
|
45625
|
+
* `ctx.blockId`, writing `self.ref`) plus every OTHER stored composition,
|
|
45626
|
+
* decided per strongly connected component (`findCandidateCycles`): a cyclic
|
|
45627
|
+
* component holding a candidate node refuses, with one representative cycle
|
|
45628
|
+
* through it; one without is not this save's cycle. A
|
|
45629
|
+
* stored composition of the same block is its old version; another block on
|
|
45630
|
+
* the same device, or two stored peers sharing a device, make
|
|
45631
|
+
* `compositionEdges` throw `CompositionGraphError` — refused BY NAME as
|
|
45632
|
+
* `duplicate-target` (D391, D663) instead of escaping as an uncaught throw.
|
|
45905
45633
|
*/
|
|
45906
|
-
function cycleProblems(composition, ctx, fields) {
|
|
45634
|
+
function cycleProblems(composition, ctx, fields, self) {
|
|
45907
45635
|
const candidate = {
|
|
45908
|
-
|
|
45909
|
-
|
|
45636
|
+
blockId: ctx.blockId ?? "(unsaved)",
|
|
45637
|
+
target: self.ref,
|
|
45638
|
+
composition,
|
|
45639
|
+
replaced: self.replaced
|
|
45910
45640
|
};
|
|
45911
45641
|
const candidateKey = compositionSourceKey(candidate.target);
|
|
45642
|
+
const unread = ctx.unreadTargets ?? /* @__PURE__ */ new Map();
|
|
45912
45643
|
try {
|
|
45913
|
-
return
|
|
45644
|
+
return findCandidateCycles(candidate, ctx.peers).map((c) => {
|
|
45645
|
+
const at = cyclePath(c.path, candidateKey, fields);
|
|
45646
|
+
const through = unreadDeviceOf([...c.component], unread);
|
|
45647
|
+
return through === null ? problem("cycle", at, `a field reads itself: ${c.path.join(" → ")}`) : problem("cycle", at, `possible cycle through \`${through.key}\` — its state could not be read (${through.error}): ${c.path.join(" → ")}`);
|
|
45648
|
+
});
|
|
45914
45649
|
} catch (err) {
|
|
45915
45650
|
if (err instanceof CompositionGraphError) return [problem("duplicate-target", "features", err.message)];
|
|
45916
45651
|
throw err;
|
|
45917
45652
|
}
|
|
45918
45653
|
}
|
|
45919
45654
|
function validateComposition(composition, ctx) {
|
|
45920
|
-
const plan = planComposition(composition, ctx.lookupCap);
|
|
45921
|
-
const
|
|
45655
|
+
const plan = planComposition(composition, ctx.lookupCap, ctx.target ?? void 0);
|
|
45656
|
+
const self = candidateSelf(composition, ctx, plan);
|
|
45657
|
+
const cycles = cycleProblems(composition, ctx, plan.fields, self);
|
|
45922
45658
|
const problems = [
|
|
45923
45659
|
...plan.problems,
|
|
45924
|
-
...sourceProblems(plan.fields, ctx),
|
|
45660
|
+
...sourceProblems(plan.fields, ctx, self),
|
|
45925
45661
|
...cycles
|
|
45926
45662
|
];
|
|
45927
45663
|
return {
|
|
45928
45664
|
ok: problems.length === 0,
|
|
45929
45665
|
problems,
|
|
45930
|
-
fields: [...plan.fields]
|
|
45666
|
+
fields: [...plan.fields],
|
|
45667
|
+
features: [...plan.features],
|
|
45668
|
+
events: [...plan.events]
|
|
45931
45669
|
};
|
|
45932
45670
|
}
|
|
45933
45671
|
//#endregion
|
|
@@ -46242,38 +45980,31 @@ var DeviceConfig = class DeviceConfig {
|
|
|
46242
45980
|
};
|
|
46243
45981
|
//#endregion
|
|
46244
45982
|
//#region src/device/device-runtime-state.ts
|
|
46245
|
-
/**
|
|
46246
|
-
* Concrete implementation. Routes every successful write through
|
|
46247
|
-
* `writer(capName, slice)` — the kernel hooks this up to
|
|
46248
|
-
* `device-state.setCapSlice`, the canonical cross-layer write
|
|
46249
|
-
* entrypoint, which handles disk persistence (debounced on the hub)
|
|
46250
|
-
* and mirror updates.
|
|
46251
|
-
*
|
|
46252
|
-
* Schema validation runs in-process before the writer is called —
|
|
46253
|
-
* the round-trip should never carry an invalid slice. `flush()`
|
|
46254
|
-
* awaits any in-flight writer promises so shutdown is lossless.
|
|
46255
|
-
*
|
|
46256
|
-
* `initial` is the persisted blob loaded at boot. Slices for caps
|
|
46257
|
-
* whose schema hasn't been installed yet are kept in-memory verbatim
|
|
46258
|
-
* and validated when the cap registers later.
|
|
46259
|
-
*/
|
|
46260
45983
|
var DeviceRuntimeState = class DeviceRuntimeState {
|
|
46261
45984
|
writer;
|
|
45985
|
+
onWriteFailed;
|
|
46262
45986
|
/** In-flight writer promises tracked so `flush()` can await them. */
|
|
46263
45987
|
pendingWrites = /* @__PURE__ */ new Set();
|
|
45988
|
+
/**
|
|
45989
|
+
* Caps whose last write the hub refused. The equality gate in
|
|
45990
|
+
* `applyCapWrite` is bypassed for these, so the SAME value is re-sent on the
|
|
45991
|
+
* next write instead of being swallowed forever; a landing write clears it.
|
|
45992
|
+
*/
|
|
45993
|
+
failedWrites = /* @__PURE__ */ new Set();
|
|
46264
45994
|
/** Per-cap committed slice — after schema validation when known. */
|
|
46265
45995
|
slices;
|
|
46266
45996
|
/** Per-cap registered schema (set by `installCapSchema`). */
|
|
46267
45997
|
schemas = /* @__PURE__ */ new Map();
|
|
46268
45998
|
listeners = /* @__PURE__ */ new Set();
|
|
46269
45999
|
capListeners = /* @__PURE__ */ new Map();
|
|
46270
|
-
constructor(initial, writer) {
|
|
46000
|
+
constructor(initial, writer, onWriteFailed) {
|
|
46271
46001
|
this.writer = writer;
|
|
46002
|
+
this.onWriteFailed = onWriteFailed;
|
|
46272
46003
|
this.slices = /* @__PURE__ */ new Map();
|
|
46273
46004
|
for (const [k, v] of Object.entries(initial)) if (v && typeof v === "object" && !Array.isArray(v)) this.slices.set(k, { ...v });
|
|
46274
46005
|
}
|
|
46275
|
-
static fromInitial(initial, writer) {
|
|
46276
|
-
return new DeviceRuntimeState(initial, writer);
|
|
46006
|
+
static fromInitial(initial, writer, onWriteFailed) {
|
|
46007
|
+
return new DeviceRuntimeState(initial, writer, onWriteFailed);
|
|
46277
46008
|
}
|
|
46278
46009
|
installCapSchema(capName, schema) {
|
|
46279
46010
|
const existing = this.schemas.get(capName);
|
|
@@ -46317,10 +46048,15 @@ var DeviceRuntimeState = class DeviceRuntimeState {
|
|
|
46317
46048
|
...value
|
|
46318
46049
|
} : { ...value };
|
|
46319
46050
|
const parsed = schema.parse(next);
|
|
46320
|
-
if (shallowEqual(current, parsed)) return;
|
|
46051
|
+
if (shallowEqual(current, parsed) && !this.failedWrites.has(capName)) return;
|
|
46321
46052
|
this.slices.set(capName, parsed);
|
|
46322
46053
|
this.fireListeners([capName]);
|
|
46323
|
-
const writePromise = this.writer(capName, { ...parsed }).
|
|
46054
|
+
const writePromise = this.writer(capName, { ...parsed }).then(() => {
|
|
46055
|
+
this.failedWrites.delete(capName);
|
|
46056
|
+
}).catch((err) => {
|
|
46057
|
+
this.failedWrites.add(capName);
|
|
46058
|
+
this.onWriteFailed?.(capName, err instanceof Error ? err.message : String(err));
|
|
46059
|
+
});
|
|
46324
46060
|
this.pendingWrites.add(writePromise);
|
|
46325
46061
|
writePromise.finally(() => {
|
|
46326
46062
|
this.pendingWrites.delete(writePromise);
|
|
@@ -46601,7 +46337,16 @@ var BaseDevice = class {
|
|
|
46601
46337
|
});
|
|
46602
46338
|
};
|
|
46603
46339
|
const initial = ctx.initialRuntimeState ?? {};
|
|
46604
|
-
|
|
46340
|
+
const onWriteFailed = (cap, error) => {
|
|
46341
|
+
ctx.logger.warn("runtime-state write refused by the hub — the slice is not mirrored; it is re-sent on the next write", {
|
|
46342
|
+
tags: { deviceId: ctx.id },
|
|
46343
|
+
meta: {
|
|
46344
|
+
cap,
|
|
46345
|
+
error
|
|
46346
|
+
}
|
|
46347
|
+
});
|
|
46348
|
+
};
|
|
46349
|
+
this.runtimeState = DeviceRuntimeState.fromInitial(initial, writer, onWriteFailed);
|
|
46605
46350
|
ctx.bindRuntimeState?.(this.runtimeState);
|
|
46606
46351
|
ctx.registerNativeCap?.(deviceStatusCapability, {});
|
|
46607
46352
|
const seed = {
|
|
@@ -52971,6 +52716,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
52971
52716
|
addonId: null,
|
|
52972
52717
|
access: "view"
|
|
52973
52718
|
},
|
|
52719
|
+
"coreBlocks.getCustomization": {
|
|
52720
|
+
capName: "core-blocks",
|
|
52721
|
+
capScope: "system",
|
|
52722
|
+
addonId: null,
|
|
52723
|
+
access: "view"
|
|
52724
|
+
},
|
|
52974
52725
|
"coreBlocks.getTypeDefs": {
|
|
52975
52726
|
capName: "core-blocks",
|
|
52976
52727
|
capScope: "system",
|
|
@@ -54093,6 +53844,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
54093
53844
|
addonId: null,
|
|
54094
53845
|
access: "create"
|
|
54095
53846
|
},
|
|
53847
|
+
"deviceState.claimFields": {
|
|
53848
|
+
capName: "device-state",
|
|
53849
|
+
capScope: "system",
|
|
53850
|
+
addonId: null,
|
|
53851
|
+
access: "create"
|
|
53852
|
+
},
|
|
54096
53853
|
"deviceState.getAllSnapshots": {
|
|
54097
53854
|
capName: "device-state",
|
|
54098
53855
|
capScope: "system",
|
|
@@ -54105,12 +53862,36 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
54105
53862
|
addonId: null,
|
|
54106
53863
|
access: "view"
|
|
54107
53864
|
},
|
|
53865
|
+
"deviceState.getNativeCapSlice": {
|
|
53866
|
+
capName: "device-state",
|
|
53867
|
+
capScope: "system",
|
|
53868
|
+
addonId: null,
|
|
53869
|
+
access: "view"
|
|
53870
|
+
},
|
|
54108
53871
|
"deviceState.getSnapshot": {
|
|
54109
53872
|
capName: "device-state",
|
|
54110
53873
|
capScope: "system",
|
|
54111
53874
|
addonId: null,
|
|
54112
53875
|
access: "view"
|
|
54113
53876
|
},
|
|
53877
|
+
"deviceState.listClaims": {
|
|
53878
|
+
capName: "device-state",
|
|
53879
|
+
capScope: "system",
|
|
53880
|
+
addonId: null,
|
|
53881
|
+
access: "view"
|
|
53882
|
+
},
|
|
53883
|
+
"deviceState.patchOwnedFields": {
|
|
53884
|
+
capName: "device-state",
|
|
53885
|
+
capScope: "system",
|
|
53886
|
+
addonId: null,
|
|
53887
|
+
access: "create"
|
|
53888
|
+
},
|
|
53889
|
+
"deviceState.releaseClaim": {
|
|
53890
|
+
capName: "device-state",
|
|
53891
|
+
capScope: "system",
|
|
53892
|
+
addonId: null,
|
|
53893
|
+
access: "create"
|
|
53894
|
+
},
|
|
54114
53895
|
"deviceState.setCapSlice": {
|
|
54115
53896
|
capName: "device-state",
|
|
54116
53897
|
capScope: "system",
|
|
@@ -59961,16 +59742,36 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
|
|
|
59961
59742
|
form: "single",
|
|
59962
59743
|
optional: false
|
|
59963
59744
|
}],
|
|
59745
|
+
"deviceState.claimFields": [{
|
|
59746
|
+
name: "deviceId",
|
|
59747
|
+
form: "single",
|
|
59748
|
+
optional: false
|
|
59749
|
+
}],
|
|
59964
59750
|
"deviceState.getCapSlice": [{
|
|
59965
59751
|
name: "deviceId",
|
|
59966
59752
|
form: "single",
|
|
59967
59753
|
optional: false
|
|
59968
59754
|
}],
|
|
59755
|
+
"deviceState.getNativeCapSlice": [{
|
|
59756
|
+
name: "deviceId",
|
|
59757
|
+
form: "single",
|
|
59758
|
+
optional: false
|
|
59759
|
+
}],
|
|
59969
59760
|
"deviceState.getSnapshot": [{
|
|
59970
59761
|
name: "deviceId",
|
|
59971
59762
|
form: "single",
|
|
59972
59763
|
optional: false
|
|
59973
59764
|
}],
|
|
59765
|
+
"deviceState.patchOwnedFields": [{
|
|
59766
|
+
name: "deviceId",
|
|
59767
|
+
form: "single",
|
|
59768
|
+
optional: false
|
|
59769
|
+
}],
|
|
59770
|
+
"deviceState.releaseClaim": [{
|
|
59771
|
+
name: "deviceId",
|
|
59772
|
+
form: "single",
|
|
59773
|
+
optional: false
|
|
59774
|
+
}],
|
|
59974
59775
|
"deviceState.setCapSlice": [{
|
|
59975
59776
|
name: "deviceId",
|
|
59976
59777
|
form: "single",
|
|
@@ -61466,8 +61267,12 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
|
|
|
61466
61267
|
"deviceManager.updateConfig",
|
|
61467
61268
|
"deviceManager.updateDeviceField",
|
|
61468
61269
|
"deviceManager.updateDeviceFieldsBatch",
|
|
61270
|
+
"deviceState.claimFields",
|
|
61469
61271
|
"deviceState.getCapSlice",
|
|
61272
|
+
"deviceState.getNativeCapSlice",
|
|
61470
61273
|
"deviceState.getSnapshot",
|
|
61274
|
+
"deviceState.patchOwnedFields",
|
|
61275
|
+
"deviceState.releaseClaim",
|
|
61471
61276
|
"deviceState.setCapSlice",
|
|
61472
61277
|
"faceGallery.getFaceByTrack",
|
|
61473
61278
|
"faceGallery.listRecentFaces",
|
|
@@ -62147,6 +61952,7 @@ function createSystemProxy(api) {
|
|
|
62147
61952
|
updateComposition: (input) => dispatch("coreBlocks", "updateComposition", "mutation", input),
|
|
62148
61953
|
getComposition: (input) => dispatch("coreBlocks", "getComposition", "query", input),
|
|
62149
61954
|
listCompositions: (input) => dispatch("coreBlocks", "listCompositions", "query", input),
|
|
61955
|
+
getCustomization: (input) => dispatch("coreBlocks", "getCustomization", "query", input),
|
|
62150
61956
|
validateComposition: (input) => dispatch("coreBlocks", "validateComposition", "mutation", input)
|
|
62151
61957
|
},
|
|
62152
61958
|
decoder: {
|
|
@@ -62250,7 +62056,10 @@ function createSystemProxy(api) {
|
|
|
62250
62056
|
createDevice: (input) => dispatch("deviceProvider", "createDevice", "mutation", input),
|
|
62251
62057
|
testCreationField: (input) => dispatch("deviceProvider", "testCreationField", "mutation", input)
|
|
62252
62058
|
},
|
|
62253
|
-
deviceState: {
|
|
62059
|
+
deviceState: {
|
|
62060
|
+
getAllSnapshots: (input) => dispatch("deviceState", "getAllSnapshots", "query", input),
|
|
62061
|
+
listClaims: (input) => dispatch("deviceState", "listClaims", "query", input)
|
|
62062
|
+
},
|
|
62254
62063
|
faceGallery: {
|
|
62255
62064
|
listIdentities: (input) => dispatch("faceGallery", "listIdentities", "query", input),
|
|
62256
62065
|
createIdentity: (input) => dispatch("faceGallery", "createIdentity", "mutation", input),
|
|
@@ -68297,4 +68106,4 @@ function enumerateInferenceDevices(hw) {
|
|
|
68297
68106
|
return out;
|
|
68298
68107
|
}
|
|
68299
68108
|
//#endregion
|
|
68300
|
-
export { ACCESSORY_LABEL, ACCESS_ROLES, ALEXA_EGRESS_PROFILE, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT, AUDIO_ANALYSIS_CAP_NAME, AUDIO_BACKEND_CHOICES, AUDIO_CHUNK_FORMATS, AUDIO_MACRO_LABELS, AUDIO_NOT_CLASSIFIED_REASONS, AUDIO_PRESETS, AUDIO_SCALE_EPOCH_ISO, AUDIO_SCALE_EPOCH_MS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdminLinkTargetEnum, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionCandidateResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, AdoptionJobSchema, AdoptionJobStateSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, AdoptionOutcomeSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, AnalyticsLtsSeriesSchema, ApiKeyRecordSchema, ApiKeySummarySchema, AppleFmAvailabilitySchema, AppleFmUnavailableReasonSchema, ArchiveEntrySchema, ArchiveManifestSchema, ArchivedDebugNoteQueryInputSchema, ArchivedDebugNoteSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, AudioChunkFormatSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioClassifyOutcomeSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioDetachDeviceResultSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AudioStreamPickSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationControlStatusSchema, AutomationRecipeSchema, AutomationTriggerSchema, AvailableIntegrationTypeSchema, BASE_DEVICE_CAPS, BASE_LIVE_EGRESS_PROFILE, BATTERY_DEVICE_PROFILE, BATTERY_UNREACHABLE_AFTER_MS, BIRTH_DECISION_DEFAULT_LIMIT, BOOT_RECOVERY_BACKOFF_MS, BUILTIN_RESULT_KINDS, BackgroundRunRegistry, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BackupRunPhaseSchema, BackupRunSchema, BackupRunStateSchema, BackupTriggerResultSchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BirthDecisionQueryInputSchema, BirthDecisionRecordSchema, BirthDecisionVerdictSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, BulkRecordSchema, CAMERA_SWITCH_CATALOG, CAMERA_SWITCH_ORDER, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, CLASS_MAP_MACRO_TARGETS, CLIP_BROKER_PACED_RATES, CLIP_PLAYBACK_OPTIONS, CLIP_REALTIME_SOURCE_RATES, CLIP_REASON_HEADER_MAX, CLIP_SEARCH_STRICTNESS, CLIP_STILL_DISPOSITION_HEADER, CLIP_STILL_REASON_CODE_HEADER, CLIP_STILL_REASON_HEADER, CLIP_STREAM_SOURCE_RATES, CLIP_STREAM_TRANSPORT_HEADER, CLIP_STRICTNESS_FACTOR, CLIP_VECTOR_INDEX_PATTERN, CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS, CLUSTER_MODEL_SCOPED_STEPS, CLUSTER_MODEL_SECTION_ID, CLUSTER_STEP_SETTING_FIELDS, COCO_80_LABELS, COCO_TO_MACRO, COMPOSED_DEVICE_STABLE_ID_PREFIX, COMPOSER_ADDON_ID, COMPOSER_RUNNER_ID, CONNECTION_TEST_TIMEOUT_MS, CONTAINER_CHILD_PRIORITY, CORE_BLOCKS_ADDON_ID, CORE_BLOCK_ADDON_PREFIX, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraOccupancySnapshotForDeviceSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusDegradationReasonSchema, CameraStatusDegradationSchema, CameraStatusSchema, CameraStatusStageSchema, CameraStreamSchema, CameraSwitchAuthoritySchema, CameraSwitchGroupSchema, CameraSwitchIdSchema, CameraSwitchSchema, CameraSwitchUnavailableReasonSchema, CameraSwitchWarningSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipBytesOfferSchema, ClipBytesSchema, ClipExportFailureSchema, ClipModelMetaSchema, ClipPlaybackOptionsSchema, ClipPlaybackSchema, ClipSchema, ClipSearchStrictnessSchema, ClipSourceAvailabilitySchema, ClipSourceSchema, ClipStillDispositionSchema, ClipStillRefusalCodeSchema, ClipStreamAudioReasonSchema, ClipStreamAudioSchema, ClipStreamDialSchema, ClipWakeSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, ClusterModelChoiceSchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ComposerApplyInputSchema, ComposerApplyResultSchema, ComposerBlockSchema, ComposerBlockVerdictSchema, ComposerUnreadableBlockSchema, CompositionBindingSchema, CompositionBlockInputSchema, CompositionBlockStateSchema, CompositionCodeSourceSchema, CompositionCommandTargetSchema, CompositionExistingTargetSchema, CompositionExpressionSourceSchema, CompositionFeatureSchema, CompositionFieldKindSchema, CompositionFieldPlanSchema, CompositionFieldReadSchema, CompositionFieldRoleSchema, CompositionFieldSourceSchema, CompositionFieldStateKindSchema, CompositionFieldStateSchema, CompositionFieldsFeatureSchema, CompositionForwardCommandSchema, CompositionFromSourceSchema, CompositionGetReadSchema, CompositionGraphError, CompositionListReadSchema, CompositionLiteralBindingSchema, CompositionNewTargetSchema, CompositionPassthroughFeatureSchema, CompositionProblemCodeSchema, CompositionProblemSchema, CompositionRunStatusSchema, CompositionSchema, CompositionSourceRefSchema, CompositionStateReadSchema, CompositionTargetSchema, CompositionUnavailableModeSchema, CompositionValidationSchema, CompositionViewSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectionTestDescriptorSchema, ConnectionTestInputSchema, ConnectionTestOutcomeSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoreBlockCompileResultSchema, CoreBlockInputSchema, CoreBlockPlacementSchema, CoreBlockSchema, CoreBlockSourceSchema, CoreBlockStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DAYS_PER_WEEK, DAY_NAMES, DECLARED_DEVICE_SWEEP_LIMIT, DECLARED_INTEGRATION_FIXED_KEY, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_CLUSTER_STEP_MODELS, DEFAULT_CLUSTER_STEP_SETTINGS, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_DETAIL_CROP_CONVENTION, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS, DEFAULT_MIN_LANDMARK_FACE_SIZE_PX, DEFAULT_NATIVE_LEASE_SETTINGS, DEFAULT_OVERLAY_LAYERS, DEFAULT_POOL_MEMORY_POLICY, DEFAULT_RECORDING_PROFILES, DEFAULT_RETENTION, DEFAULT_RUNTIME_STATE_DURABILITY, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFAULT_TOKEN_EXPIRY, DERIVED_CAMERA_SILENCED_CAP_NAMES, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, DETECTION_MACRO_CLASSES, DETECTION_PIPELINE_CAP_NAME, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_CHILDREN_BATCH_MAX, DEVICE_PROFILES, DEVICE_RESTORE_RETRY_CONCURRENCY, DEVICE_RESTORE_RETRY_DELAYS_MS, DEVICE_SCOPED_CAPS, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATE_READERS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, DISPLAY_ICON_GROUPS, DISPLAY_ICON_KEYS, DISPLAY_ICON_OFFERED_KEYS, DISPLAY_ICON_VOCABULARY, DOORBELL_SOURCE_SLOT, EngineInfoSchema as DataStoreEngineInfoSchema, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DeclaredDevices, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetailCropConventionSchema, DetectionCatalogClassMapSchema, DetectionSourceSchema, DetectionSourcesSchema, DeviceAdminLinkSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRestoreRetryScheduler, DeviceRole, DeviceRuntimeState, DeviceSelectorSchema, DeviceStatusSchema, DeviceType, DiagnosticIdSchema, DiagnosticWindowPatchSchema, DiagnosticWindowSchema, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DiskReconcileJobSchema, DisposerChain, DoorbellPressEventSchema, DoorbellSourceSlotValueSchema, DoorbellStatusSchema, EMBEDDING_MODEL_FAILED, EMBEDDING_REQUIREMENTS_FAILED, EMBEDDING_REQUIREMENTS_UNAVAILABLE, EVENTFUL_CAP_NAMES, EVENT_DENSITY_BATCH_MAX, EVENT_KIND_BY_CAP, EVENT_OWNER_TYPES, EVENT_PAD_MS, EVENT_TAXONOMY, EXPORT_DENSE_MAX_RANGES, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, EXTENSION_HOST_DEVICE_TYPES, EXTENSION_SLOTS, EXTENSION_SLOT_IDS, EXTENSION_SLOT_LISTING_METHOD, EXTENSION_SLOT_REF_SEPARATOR, EffectiveTuningSchema, EgressEncodeSchema, EgressRateControlSchema, EgressTranscodeRequestSchema, EgressTranscodeSchema, ElementConfigStore, EmbeddingFailedModelSchema, EmbeddingFailedRequirementSchema, EmbeddingInfoSchema, EmbeddingRefusalCodeSchema, EmbeddingResultSchema, EmbeddingTowerSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventDensityBucketSchema, EventDensityForDeviceSchema, EventEmitterStatusSchema, EventFireSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventKindsForDeviceSchema, EventMediaArtifactSchema, EventMediaCoverageSchema, EventMediaKindSchema, EventMediaProductionSchema, EventOwnerTypeSchema, EventSourceType, ExportBytesSchema, ExportClipSubjectSchema, ExportDenseRangeSchema, ExportDenseSchema, ExportDownloadSchema, ExportFootageSubjectSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportSubjectSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, ExtensionCandidateSchema, ExtensionCandidatesSchema, ExtensionSetResultSchema, ExtensionSetSlotInputSchema, ExtensionSlotActivationSchema, ExtensionSlotIdSchema, ExtensionSlotRefInputSchema, ExtensionSlotRowSchema, ExtensionSlotSourceSchema, ExtensionSlotStateSchema, ExtensionSlotUnreachableSchema, ExtensionSlotValueSchema, ExtensionSourceAvailabilitySchema, ExtensionSourceHealthSchema, ExtensionSourceSchema, FIRST_LEVEL_MACRO_CLASSES, FULL_IMAGE_BBOX, FailureContributionSchema, FailureCounters, FailureReasonCountSchema, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FloodStatusSchema, Fmp4BoxSplitter, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, FrameLazyCountersSchema, FrameLazyMetricsSchema, G711_SCALE_CORRECTION_DB, GasStatusSchema, GetLoggingSettingsInputSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, GridLayoutPatchSchema, GridLayoutViewSchema, HAP_AUDIO_BASE, HAP_AUDIO_BITRATE_KBPS, HAP_AUDIO_VBV_KBITS, HAP_KEYFRAME_INTERVAL_SEC, HF_BASE_URL, HF_REPO, HOURS_PER_DAY, HWACCEL_OPTIONS, HealthStatusSchema, HfModelResolutionSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, INFERENCE_DEVICE_EXCLUSION_REASONS, ImageContractSchema, ImageContractStateSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, InferenceDeviceExclusionReasonSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LEGACY_READ_ONLY_CONFIG_KEY, LINKED_DEVICES_SLOT, LOAD_CONTRIBUTION_ATTRIBUTIONS, LOAD_CONTRIBUTION_ROLES, LOCATION_DESCRIPTION_MAX, LOCATION_ICON_FALLBACK, LOCATION_ICON_IDS, LOG_CHANNEL_TICK_MS, LOG_LEVEL_RANK, LTS_SCOPE_CLASS_SEPARATOR, LabelAttributionSchema, LabelDefinitionSchema, LabelTierSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LedgerWalkDeviceReportSchema, LedgerWalkInputSchema, LedgerWalkRefusalSchema, LedgerWalkReportSchema, LedgerWalkSkipCountsSchema, LedgerWalkSkipReasonSchema, LegacyStorageLocationDefaultSchema, LinkedDeviceSchema, LinkedDevicesModeSchema, LinkedDevicesSlotValueSchema, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmDownloadProgressSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRefusalSourceSchema, LlmRetryPolicySchema, LlmRuntimeAppleCompleteInputSchema, LlmRuntimeCancelInputSchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmTimeoutDefaults, LlmUsageRollupSchema, LlmUsageSchema, LoadContributionSchema, LocateSegmentResultSchema, LocationDescriptionAssignmentSchema, LocationIconAssignmentSchema, LocationIconIdSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogChannelApplyResultSchema, LogChannelDescriptorSchema, LogChannelGate, LogChannelLevelSchema, LogChannelRegistry, LogChannelWindowPatchSchema, LogChannelWindowSchema, LogChannelWindowStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoggingEffectiveSchema, LoggingExplicitSchema, LoggingLevelLayerSchema, LoggingLevelSourceSchema, LoggingScopeKindSchema, LoggingSettingsPatchSchema, LoggingSettingsStateSchema, LoginMethodContributionSchema, LoginStageEnum, LtsBucketSchema, MACRO_LABELS, MAX_ARCHIVED_DEBUG_NOTES, MAX_BIRTH_DECISION_RECORDS, MAX_BIRTH_LATENCY_PROXY_MS, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, MAX_COMPOSITION_CODE_LENGTH, MAX_COMPOSITION_FEATURES, MAX_COMPOSITION_FIELDS_PER_FEATURE, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, MAX_KEYS, MAX_REASONS_PER_KEY, MAX_SENSOR_TRIGGER_DEVICES, MAX_TRACK_DEBUG_NOTE_LEN, MEDIA_OWNER_TYPES, MEDIA_PRESENCE_OWNER_KINDS, METHOD_ACCESS_MAP, METHOD_DEVICE_SELECTORS, MINUTES_PER_DAY, MODEL_FORMATS, MODEL_HOSTING, MODEL_PROVIDER_IDS, MOTION_CLOSE_AFTER_MS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelExtraFileSchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileInfoSchema, MediaFileKindEnum, MediaFileRefSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MediaPresenceOwnerKindSchema, MediaRelocateModeSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, MigrateDeviceResultSchema, MigrateSwitchOutcomeSchema, MigrateSwitchReportSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelLicenseSchema, ModelProviderIdSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, MutationFilterSchema, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SCENE_BUDGET_FIELD, NATIVE_LEASE_SCENE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, NAVIGATION_ACTION_CATALOG, NAVIGATION_LIGHT_LEVEL_MAX, NAVIGATION_LIGHT_LEVEL_MIN, NC_ALARM_OPENING_EVENT_KINDS, NC_ALARM_SYSTEM_EVENT_KINDS, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DBFS_FLOOR, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, NC_AUDIO_SEED, NC_AUTHORABLE_SYSTEM_EVENT_KINDS, NC_BASE_CONDITION_KEYS, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CLIP_POST_ROLL_DEFAULT_SEC, NC_CLIP_PRE_ROLL_DEFAULT_SEC, NC_CLIP_RETENTION_MAX_SEC, NC_CONDITION_CATALOG, NC_CONFIRM_DEFAULT_MAX_IMAGE_PX, NC_CONFIRM_DEFAULT_TIMEOUT_MS, NC_CONFIRM_MAX_TIMEOUT_MS, NC_CONFIRM_MIN_TIMEOUT_MS, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_DEFAULT_SNOOZE_MINUTES, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_OCCUPANCY_DEFAULTS, NC_RULE_CLEARABLE_KEYS, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_RULE_SECTIONS, NC_SENSOR_RAISED_FIELD_BY_KIND, NC_SENSOR_TRANSITION_KINDS, NC_SENSOR_TRANSITION_NEVER_FIRES_WARNING, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SERVER_PACKAGE_NAME, NC_SNOOZE_MAX_MINUTES, NC_SYSTEM_DELIVERY, NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS, NC_SYSTEM_EVENT_FAMILIES, NC_SYSTEM_EVENT_FAMILY, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_FILTER_KEYS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_SYSTEM_RULE_KINDS, NC_TANK_SYSTEM_EVENT_KINDS, NC_TAXONOMY, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NC_UPDATE_EVENT_PACKAGE_NAMES, NETWORK_LINK_TYPES, NETWORK_LINK_UNKNOWN, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeLeaseAdmissionSchema, NativeLeaseSettingsSchema, NativeObjectClassEnum, NativeObjectDetectionOptionsSchema, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionSettingsPatchSchema, NativeObjectDetectionStatusSchema, NativeObjectGeometryEnum, NavigationActionEntrySchema, NavigationActionIdSchema, NavigationEntryKindSchema, NavigationFeaturesSchema, NavigationLightModeSchema, NavigationModeSchema, NavigationMoveCommandSchema, NavigationPointSchema, NavigationRuntimeStateSchema, NavigationStatusSchema, NcAlarmConfigSchema, NcAlarmModeCoverageSchema, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, NcAlarmSkipReasonSchema, NcAlarmSkippedDeviceSchema, NcAudioConditionSchema, NcClipRetentionAskSchema, NcClipRetentionPlanSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcConfirmExpectSchema, NcConfirmSchema, NcCrossingSchema, NcDeliverySchema, NcDeviceStateConditionSchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcLinkedCameraModeSchema, NcMediaFrameSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleActionSchema, NcRuleActionSequenceSchema, NcRuleActionsSchema, NcRuleClearableKeySchema, NcRuleInputSchema, NcRuleKindSchema, NcRuleLastRunSchema, NcRuleLastRunsSchema, NcRuleNotificationButtonSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcRuleUpdateInputSchema, NcSceneConditionSchema, NcScheduleSchema, NcScheduleWindowSchema, NcSensorTransitionSchema, NcSnoozeInputSchema, NcSnoozeSchema, NcSnoozeScopeSchema, NcSnoozeSuppressedSchema, NcStateSummaryPreviewSchema, NcStateSummaryPreviewSectionSchema, NcSystemEventConditionSchema, NcSystemEventDeliveryModeSchema, NcSystemEventDeliverySchema, NcSystemEventKindSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTemplateFamilySchema, NcTemplateFieldSchema, NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, NcTemplateVarContextSchema, NcTemplateVarDescriptorSchema, NcTemplateVarGroupSchema, NcTemplateVarKindSchema, NcTestResultSchema, NcThrottleGranularitySchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NetworkLinkStatusSchema, NodeDirectoryEntrySchema, NodeDirectorySchema, NotificationActionIconSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPERATOR_WRITTEN_STALE_MS, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OVERFLOW_REASON, OVERLAY_LAYERS, OauthIntegrationDescriptorSchema, ObjectEventSchema, OccupancyBurstRefusalSchema, OnboardFieldSupportSchema, OnboardRecordTrackSchema, OnboardScheduleSupportSchema, OnboardStorageSchema, OnboardStorageVolumeSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdRenderOutcomeEnum, OsdRenderResultSchema, OsdSlotBindingSchema, OsdSlotViewSchema, OsdSourceOptionSchema, OsdSourceSchema, OsdSourceValueTypeEnum, OsdStatusSchema, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_ANALYTICS_CAP_NAME, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PRIVACY_MASK_CAP_NAME, PROVIDER_KIND_CAP_NAMES, PROVIDER_PIN_FIELD, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, ParkRefusalSchema, ParkTrackFrameResultSchema, ParkedFrameKindSchema, ParkedTrackFrameSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PeerBytesTicketSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PoolMemoryWatchdog, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzHomePresetSchema, PtzHomeReturnSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetFunctionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RATE_CONTROL_RELAXED, RATE_CONTROL_TIGHT, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RECORDING_AUDIO_TRIGGER_OFFERED_DBFS, RECORDING_EXPORT_MAX_READ_BYTES, RECORDING_SOURCE_CAMSTACK, RECORDING_SOURCE_CAMSTACK_ADDON, RECORDING_TIMELINE_BATCH_MAX, REDACTED_SECRET, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_SOURCES, RESTORED_CAP_NAMES, ROOM_EXAMPLE_MOTION_SOURCES, ROOM_EXAMPLE_TEMPERATURE_SOURCES, ROOM_OCCUPANCY_WINDOW_MS, ROOT_BUCKET_KEY, RUNTIME_DEFAULTS, RUNTIME_STATE_POLICY, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadGopBytesResultSchema, ReadSegmentBytesResultSchema, ReadWindowBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RebuildObjectEmbeddingsRefusalSchema, RecentTracksPageSchema, RecentTracksQueryInput, RecordTriggerSchema, RecordWindowSchema, RecordingAvailabilityForDeviceSchema, RecordingAvailabilitySchema, RecordingBandAudioSchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysForDeviceSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingObjectTriggerClassSchema, RecordingOnboardOptionsSchema, RecordingOnboardPatchSchema, RecordingOnboardStatusSchema, RecordingPlaybackSchema, RecordingRangeSchema, RecordingReadSchema, RecordingRebalanceInputSchema, RecordingRebalanceMoveSchema, RecordingRebalancePlanSchema, RecordingRebalanceSkipReasonSchema, RecordingRebalanceSkipSchema, RecordingRetentionSchema, RecordingSignalRuntimeStateSchema, RecordingSignalStatusSchema, RecordingSourceAvailabilitySchema, RecordingSourceOptionsSchema, RecordingSourceSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, RelocateFootageClassSchema, RelocateFootageInputSchema, RelocateJobSchema, RelocateJobStateSchema, RelocateMediaInputSchema, RelocateResidueInputSchema, RelocateResidueSchema, RenderedAsSchema, ReportMotionInputSchema, ReportedFailureContributionSchema, ReportedLoadContributionSchema, RequestCensusGroupSchema, RequestCensusProcedureSchema, RequestCensusSnapshotSchema, RequestCensusStatusSchema, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, RetrainFrameCandidateSchema, RetrainFrameListSchema, RetrainFrameSchema, RetrainFrameSelectionSchema, RetrainMacroClassSchema, RetrainStatusSchema, RetrainTrackSchema, RetrainTransitionResultSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerJumpStepProvisioningSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCENE_CONDITIONS, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS, SCENE_DEFAULT_ANCHOR_THRESHOLD, SCENE_DEFAULT_CHECK_INTERVAL_SEC, SCENE_DEFAULT_OBSERVATION_SPACING_SEC, SCENE_DEFAULT_QUIET_SECONDS, SCENE_DEFAULT_UNCOVERED_POLICY, SCENE_DIVERGED, SCENE_RESET_RECAPTURES, SCOPE_PRESETS, SENSOR_FEATURES, SENSOR_MAP, SHARE_VIEW_KINDS, SOURCE_CAPS, SOURCE_CAP_ACTIVE_FIELD, SOURCE_CAP_CHANGED_AT_FIELD, SOURCE_DEVICE_TYPES, SOURCE_INFO_METADATA_KEY, STATIONARY_OVERLAY_STYLE, STORAGE_ACCESS_FALLBACK, STORAGE_BYTES_PER_GB, STORAGE_LOCATION_MODES, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SUMMARIES_DEFAULT_LIMIT, SUMMARIES_MAX_LIMIT, SYSTEM_CAP_NAMES, SYSTEM_SCOPE_DEVICE_METHODS, SceneCheckSchema, SceneConditionSchema, SceneConfirmSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusForDeviceSchema, SceneMonitorStatusSchema, SceneReferenceSchema, SceneUnavailableSchema, SceneUncoveredPolicySchema, SceneVerdictSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateOutcomeSchema, ServerUpdateStateSchema, SetLoggingSettingsInputSchema, SetSiteLocationInputSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, SiteZoneSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, StorageAccessSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, StorageCleanupInputSchema, StorageCleanupJobSchema, StorageCleanupPhaseSchema, StorageCleanupStatusInputSchema, StorageDrainProgressSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, StorageEvictionPolicySchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationModeSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, StorageMigrationClassSchema, StorageMigrationDestinationsSchema, StorageMigrationDrainInputSchema, StorageMigrationFindingCodeSchema, StorageMigrationFindingSchema, StorageMigrationFootageMoveInputSchema, StorageMigrationInputSchema, StorageMigrationJobSchema, StorageMigrationLaneSchema, StorageMigrationLeaseInputSchema, StorageMigrationMediaMoveInputSchema, StorageMigrationModeSchema, StorageMigrationMoveProgressSchema, StorageMigrationMoveSchema, StorageMigrationMoverSchema, StorageMigrationParticipantSchema, StorageMigrationPhaseSchema, StorageMigrationPlanSchema, StorageMigrationResidueSchema, StorageMigrationSourcesSchema, StorageOccupancyReportSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSignalSchema, StreamSignalsStatusSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SummarySchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMELAPSE_DENSE_FLOOR_SEC, TIMEZONES, TRANSCODE_DOWN_MAX_BITRATE_KBPS, TRANSCODE_DOWN_MAX_HEIGHT, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TerminalInstanceInfoSchema, TerminalLegacyCameraSchema, TerminalOutputBatchSchema, TerminalOutputEventSchema, TerminalProfileInfoSchema, TerminalSessionInfoSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestConnectionStatusEnum, TestResultSchema, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackFlagsPatchSchema, TrackFlagsSchema, TrackProjectionSchema, TrackSchema, TrackSourceSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TrainingExportDeviceTotalsSchema, TrainingExportSummarySchema, TransportPlaneCountsSchema, TransportPlaneSchema, TurnServerSchema, UNATTRIBUTED_BUCKET_KEY, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UnstampedEventMediaCountSchema, UnstampedRowsSchema, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VECTOR_INDEX_DIM_CONFLICT, VIDEOCLIPS_MAX_OFFER_BYTES, VIDEOCLIPS_MAX_READ_BYTES, VISIT_MERGE_GAP_MS, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, VectorItemSchema, VectorMatchSchema, VectorMetadataSchema, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, VibrationStatusSchema, VideoEncodeSchema, WEBRTC_CLIMB_HOLD_CODES, WEBRTC_EGRESS_PROFILE, WEBRTC_TRY_BLOCKERS, WEEKLY_MASK_LENGTH, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcClimbHoldSchema, WebrtcLadderDecisionSchema, WebrtcSessionDebugSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WebrtcTierFailureSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, WrapperEvidenceSchema, WrapperIdentitySchema, WrapperKindSchema, YAMNET_TO_MACRO, ZoneCrossingDirectionSchema, ZoneCrossingSchema, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, __resetLogChannelRegistryForTests, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, asBoolean, asJsonArray, asJsonObject, asNumber, asString, assertTimelapseCadences, audioAnalysisCapability, audioAnalyzerCapability, audioChunkBytesPerSample, audioCodecCapability, audioIsFailClosed, audioKindId, audioLabelChoices, audioMetricsCapability, audioModeOf, audioOrDefaults, audioPlanFromEncodeProfile, audioScaleEraOf, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, bareAddonId, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildAudioArgs, buildCapabilityLookup, buildDeviceAdminUrl, buildEventKindDescriptor, buildFfmpegArgs, buildInputArgs, buildModelVariantGroups, buildNcTaxonomy, buildRoleScopes, buildStreamParamsConfigSchema, buildVideoArgs, buttonCapability, cameraCredentialsCapability, cameraGridLayoutCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, canonicalEgressPlan, carbonMonoxideCapability, cellsToRects, classifyBearerPrincipal, classifyStream, classifyStreams, climateControlCapability, clipExportFailure, clipExportFailureOf, clipReasonHeaderValue, clusterModelSettingKey, clusterStepSettingFieldsFor, clusterStepSettingKey, codecIsAccepted, collectHydratedFieldEntries, collectHydratedFieldValues, collectSecretConfigKeys, colorCapability, colorForKind, commitWatchdogRestart, compareToTarget, compileExpression, compileExpressionSafe, composeSwitchedOff, composedDeviceRef, composedDeviceStableId, composerCapability, compositionEdges, compositionReadKey, compositionSliceKey, compositionSourceKey, compositionSourceRefs, conditionDepth, conditionExclusionReason, conditionVisibleForKind, connectionTestCapability, connectivityCapability, consumableLowPercentOf, consumablesCapability, contactCapability, controlCapability, convertUnit, coreBlockAddonId, coreBlockComposition, coreBlockIdFromAddonId, coreBlockSourceKind, coreBlocksCapability, cosineSimilarity, countConditionLeaves, coverCapability, createDeviceExtensionProvider, createDeviceProxy, createDurableState, createEvent, createEventBusSliceSource, createExpressionScope, createHwAccelCache, createLazyTrpcSource, createLogChannelsProvider, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createSystemProxy, customAction, customModelRegistryCapability, dataStoreProviderCapability, dayNightCapability, dayOfWeekToIndex, declarationOwnerNodeId, declareLogChannel, decodeVectorBase64, decoderCapability, defaultDeliveryForSection, defaultDeviceFor, defineCustomActions, defineExtensionSlotProvider, deriveBatteryPresence, deriveCameraSwitches, deriveDetailCropRect, deriveRecordingMode, describeCustomActions, describeModelVariant, describeOnboardClamp, describeOnboardRefusal, describeStateField, describeSystemEventDeliveryProblem, describeSystemEventFamilyProblem, describeTopLevelStateFields, detectAccessRole, detectionPipelineCapability, deviceAdminLinkCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceExtensionCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceSelectorMatches, deviceStateCapability, deviceStatusCapability, displayIconEntry, displayIconsInGroup, doorbellCapability, droppedConditionsForKind, egressTranscodeSharingKey, egressTransportFromRequest, embeddingEncoderCapability, embeddingModelFailedError, embeddingModelFailedOf, embeddingRefusalOf, embeddingRequirementsFailedError, embeddingRequirementsUnavailableError, emitDownForOwnedCaps, emitReadiness, emitsCollectionSelector, encodeProfileFromStreamShape, encodeVectorBase64, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateCompositionField, evaluateExpressionSource, evaluatePoolMemory, evaluateSensorEdge, evaluateZoneRules, event, eventEmitterCapability, evictionPolicyForMode, evictionPolicyOfLocation, expandAudioChunkToF32le, expandCapMethods, expandContainer, exportSubjectOf, extensionSlotRef, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, failureContributionCapability, failureRate, fanControlCapability, featureProbeCapability, fieldReads, filesystemBrowseCapability, findCompositionCycles, findTimezone, floodCapability, foldSnapshotByFunction, formatForRuntime, formatMediaOwnerKey, formatMinutes, formatParkedFor, gasCapability, gbToBytes, generateAutomationBlock, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getLogChannelRegistry, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, inferExpressionKinds, inferModelProvider, initialPoolMemoryState, integrationsCapability, intercomCapability, interpretStoredClusterModel, invalidClusterStepModelEntries, invocationFromEncodeProfile, isAgentOnlyPlacement, isArrayOutputSchema, isAudioChunkFormat, isAudioLabelSelected, isAudioRule, isBaseConditionKey, isBatteryPresenceFault, isClusterScopedStep, isCollectionArrayMethod, isDeployableToAgent, isDetectionMacroClass, isDeviceConfigCap, isDeviceScopedCap, isDisplayIconKey, isEmbeddingModelFailed, isEvent, isEventOwnerType, isFirstLevelMacroClass, isHeldBackTemplateVar, isIsolatedBuiltin, isKnownTemplateVar, isLocationEnabled, isMediaOwnerType, isNode, isObjectInput, isOccupancyRule, isRestoredCap, isSameAddonId, isScheduleActive, isSecretConfigField, isSoftwareDecode, isSourceCap, isStorageLocationMode, isSystemDelivery, isSystemEventFamily, isSystemEventSummaryRule, isSystemRuleKind, isVectorIndexDimConflict, isVoidInput, ituDbfsFromPreEpoch, jobKindSchema, kebabToCamel, kindOfValue, kindsForDiscriminator, knownValues, lawnMowerControlCapability, legacyAutoLinkIds, legacyModeOf, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, loadContributionCapability, localNetworkCapability, locationIconKey, locationSimilarity, lockControlCapability, logBannerArgs, logChannelsCapability, logDestinationCapability, logLevelAtMost, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mayReadLocation, mayWriteToLocation, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, methodAccessForHttpMethod, metricsProviderCapability, migrateLegacyDeviceSignalConfig, minutesToTimeOfDay, modeMayRead, modeMayWrite, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, navigationCapability, networkAccessCapability, networkLinkCapability, networkQualityCapability, nodePickerItems, nodePin, nodesCapability, normalizeAddonInitResult, normalizeAudioLabel, normalizeNodeId, normalizeTokenScopes, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, objectInputDeclaresRequiredDeviceId, occupancyScope, optionalMethod, osdCapability, osdManagerCapability, overlayClusterStepSettings, packagePickerItems, parseAdminBase, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseMediaOwnerKey, parseOccupancyScope, parseProcStatus, parseProfileBrokerId, parseRuleSection, parseStreamParamsFormPatch, patchAudio, petFeederCapability, pickAccessoryControl, pickClusterStepModels, pickClusterStepSettings, pickDetailCropConvention, pickInvalidClusterStepModels, pickNativeLeaseOverride, pickPreferredRtspEntry, pickRestartCandidate, pickVideoEncoder, pickerForCondition, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, planComposition, plateGalleryCapability, platformProbeCapability, poolMemoryThreshold, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, principalMayReachAddon, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, pythonScriptForBackend, rankStreams, readClusterStepModels, readClusterStepSettings, readDetailCropConvention, readDeviceStateFrom, readNativeLeaseOverride, readNodePin, readTimelapseGeneratedAt, readinessKey, rebootCapability, recordingArchiveCapability, recordingCapability, recordingExportCapability, recordingOnboardCapability, recordingSignalCapability, rectsToCells, reducePoints, requiredTopLevelKeys, requiresPython, reservedSourceOwner, resetPoolBaseline, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveBucketMs, resolveCapMount, resolveClipSearchMinScore, resolveClusterStepModelId, resolveContainerPrimaryChild, resolveCreateExportSubject, resolveDeviceControlKind, resolveDeviceProfile, resolveEgressDecodeHwAccel, resolveExportProfiles, resolveFormat, resolveHydratedFieldValue, resolveLocationIcon, resolveLocationMode, resolveMethodAuth, resolveMutate, resolvePoolMemoryPolicy, resolveRecordingProfiles, resolveRunnerId, resolveStreamMaps, resolveVariantModelId, resolveViewableDeviceIds, roleSpec, roomCompositionExample, ruleBelongsToAlarm, ruleEditorSectionsForKind, ruleKindOf, ruleKindSpec, ruleMatchesSection, ruleSection, ruleSectionOf, ruleSeedForSection, runInferenceStep, runtimeDevices, runtimeStatePolicyFor, sceneMonitorCapability, scheduleForSendTimes, schemaDeclaresAnyField, scopeInherits, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, scoreRuntimes, scriptRunnerCapability, searchDisplayIcons, selectAssignedProfileSlots, sendTimesOfSchedule, sensorRaisedOf, sensorTransitionNeverFires, sensorTransitionOffered, servedTemplateVars, serverManagementCapability, setByPath, settingsStoreCapability, signalPercentFromBars, signalPercentFromRssi, siteZoneKey, sleep, sleepCancellable, sliceActiveValue, sliceChangedAt, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, stateVocabularyFor, stepModelRunsOnFormat, storageCapability, storageEvictableCapability, storageMigrationCapability, storageOccupancyCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, streamSignalsCapability, stripRetiredBandPreBufferSec, strippedOfLegacyReadOnly, subKindsOf, summarisePrivacyAudio, summarizeEffectiveScope, supportedRuntimes, switchCapability, switchedOffIds, synthesizeSourceInfo, systemCapability, systemEventDeliveryProblems, systemEventFamilyOf, systemEventFamilyProblems, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, systemEventKindNamesOf, systemEventKindsOfFamily, systemEventSummaryScheduleOf, systemFamilyOfKind, systemRuleKindOf, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, templateVarsFor, terminalSessionCapability, textToHtml, timeOfDayToMinutes, toDeviceSummary, toExpressionValue, toNodeId, toStreamSourceEntry, toastCapability, toggleAudioLabel, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, unreachableExtensionSlotRow, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateComposition, validateExpressionSource, validateRecipeBounds, valveCapability, vectorDimFromBase64, vectorIndexDimConflictError, vectorStoreCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, weeklyMaskIndex, weeklyMaskIsUniform, weeklyMaskToWindows, windowsToWeeklyMask, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, withLocationMode, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
|
|
68109
|
+
export { ACCESSORY_LABEL, ACCESS_ROLES, ALEXA_EGRESS_PROFILE, ALL_CAPABILITY_DEFINITIONS, APPLE_SA_TO_MACRO, ARCHIVED_DEBUG_NOTES_DEFAULT_LIMIT, AUDIO_ANALYSIS_CAP_NAME, AUDIO_BACKEND_CHOICES, AUDIO_CHUNK_FORMATS, AUDIO_MACRO_LABELS, AUDIO_NOT_CLASSIFIED_REASONS, AUDIO_PRESETS, AUDIO_SCALE_EPOCH_ISO, AUDIO_SCALE_EPOCH_MS, AccessoriesStatusSchema, AccessoryKind, AddBrokerInputSchema, AddonAutoUpdateSchema, AddonListItemSchema, AddonPageDeclarationSchema, AddonPageInfoSchema, AdminLinkTargetEnum, AdoptInputSchema as AdoptionAdoptInputSchema, AdoptResultSchema as AdoptionAdoptResultSchema, AdoptionCandidateResultSchema, AdoptionFilterSchema, GetCandidateInputSchema as AdoptionGetCandidateInputSchema, AdoptionJobSchema, AdoptionJobStateSchema, ListCandidatesInputSchema as AdoptionListCandidatesInputSchema, ListCandidatesOutputSchema as AdoptionListCandidatesOutputSchema, AdoptionOutcomeSchema, ReleaseInputSchema as AdoptionReleaseInputSchema, AdoptionStatusSchema, AgentLoadSummarySchema, AirQualitySensorStatusSchema, AlarmArmModeSchema, AlarmPanelStatusSchema, AlarmStateSchema, AlertSchema, AlertSeveritySchema, AlertSourceSchema, AlertStatusSchema, AmbientLightSensorStatusSchema, AnalyticsLtsSeriesSchema, ApiKeyRecordSchema, ApiKeySummarySchema, AppleFmAvailabilitySchema, AppleFmUnavailableReasonSchema, ArchiveEntrySchema, ArchiveManifestSchema, ArchivedDebugNoteQueryInputSchema, ArchivedDebugNoteSchema, AttachmentMediaTypeSchema, AttachmentSchema, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioAttachDeviceInputSchema, AudioAttachDeviceResultSchema, AudioChunkFormatSchema, AudioChunkInputSchema, AudioClassSummarySchema, AudioClassificationLabelSchema, AudioClassificationResultSchema, AudioClassifyOutcomeSchema, AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioDetachDeviceResultSchema, AudioEncodeSchema, AudioEncodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEventSchema, AudioLevelSchema, AudioMetricsHistoryPointSchema, AudioMetricsHistorySchema, AudioMetricsSnapshotSchema, AudioPcmChunkSchema, AudioStreamPickSchema, AuthResultSchema, AutoUpdateSettingsSchema, AutomationActionSchema, AutomationConditionOperatorSchema, AutomationConditionSchema, AutomationControlStatusSchema, AutomationRecipeSchema, AutomationTriggerSchema, AvailableIntegrationTypeSchema, BASE_DEVICE_CAPS, BASE_LIVE_EGRESS_PROFILE, BATTERY_DEVICE_PROFILE, BATTERY_UNREACHABLE_AFTER_MS, BIRTH_DECISION_DEFAULT_LIMIT, BOOT_RECOVERY_BACKOFF_MS, BUILTIN_RESULT_KINDS, BackgroundRunRegistry, BacklightModeSchema, BackupDestinationInfoSchema, BackupEntrySchema, BackupRunPhaseSchema, BackupRunSchema, BackupRunStateSchema, BackupTriggerResultSchema, BaseAddon, BaseDevice, BaseDeviceProvider, BatteryStatusSchema, BinaryStatusSchema, BirthDecisionQueryInputSchema, BirthDecisionRecordSchema, BirthDecisionVerdictSchema, BoundingBoxSchema, BrightnessStatusSchema, AddInputSchema as BrokerAddInputSchema, BrokerAudioClientSchema, BrokerClientsSchema, BrokerConnectionDetailsSchema, BrokerConsumerAttributionSchema, BrokerConsumerKindSchema, BrokerDecodedClientSchema, BrokerEncodedClientSchema, GetStateInputSchema as BrokerGetStateInputSchema, BrokerInfoSchema, BrokerProviderInfoSchema, PublishInputSchema as BrokerPublishInputSchema, RegistryStatusSchema as BrokerRegistryStatusSchema, BrokerRtspClientSchema, BrokerStatsSchema, BrokerStatusEnum, BrokerStatusSchema, SubscribeInputSchema as BrokerSubscribeInputSchema, SubscribeResultSchema as BrokerSubscribeResultSchema, TestConnectionResultSchema as BrokerTestConnectionResultSchema, UnsubscribeInputSchema as BrokerUnsubscribeInputSchema, BulkRecordSchema, CAMERA_SWITCH_CATALOG, CAMERA_SWITCH_ORDER, CAM_PROFILE_ORDER, CAPABILITY_NAMES, CAPABILITY_ROUTER_KEYS, CAP_NAMES_WITH_STATUS, CAP_NODE_PIN_CONTEXT_KEY, CAP_PROVIDER_KIND_MAP, CLASS_MAP_MACRO_TARGETS, CLIP_BROKER_PACED_RATES, CLIP_PLAYBACK_OPTIONS, CLIP_REALTIME_SOURCE_RATES, CLIP_REASON_HEADER_MAX, CLIP_SEARCH_STRICTNESS, CLIP_STILL_DISPOSITION_HEADER, CLIP_STILL_REASON_CODE_HEADER, CLIP_STILL_REASON_HEADER, CLIP_STREAM_SOURCE_RATES, CLIP_STREAM_TRANSPORT_HEADER, CLIP_STRICTNESS_FACTOR, CLIP_VECTOR_INDEX_PATTERN, CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS, CLUSTER_MODEL_SCOPED_STEPS, CLUSTER_MODEL_SECTION_ID, CLUSTER_STEP_SETTING_FIELDS, COCO_80_LABELS, COCO_TO_MACRO, COMPOSED_DEVICE_STABLE_ID_PREFIX, COMPOSED_ITEM_FIXED_FIELDS, COMPOSER_ADDON_ID, COMPOSER_RUNNER_ID, COMPOSITION_EVENT_CATEGORY, COMPOSITION_ITEM_ARRAY_PATH, COMPOSITION_ITEM_KEY_RE, CONNECTION_TEST_TIMEOUT_MS, CONTAINER_CHILD_PRIORITY, CORE_BLOCKS_ADDON_ID, CORE_BLOCK_ADDON_PREFIX, CUSTOMIZATION_BLOCK_NAME_PREFIX, CamProfileSchema, CamStreamDescriptorSchema, CamStreamKindSchema, CamStreamResolutionSchema, CameraAssignmentStatusSchema, CameraAudioStatusSchema, CameraBrokerProfileSchema, CameraBrokerStatusSchema, CameraCredentialsSchema, CameraCredentialsStatusSchema, CameraDecoderShmSchema, CameraDecoderStatusSchema, CameraDetectionPhaseSchema, CameraDetectionProvisioningSchema, CameraDetectionProvisioningStateSchema, CameraDetectionStatusSchema, CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, CameraMotionStatusSchema, CameraOccupancySnapshotForDeviceSchema, CameraRecordingModeSchema, CameraRecordingStatusSchema, CameraSourceStatusSchema, CameraSourceStreamSchema, CameraStatusDegradationReasonSchema, CameraStatusDegradationSchema, CameraStatusSchema, CameraStatusStageSchema, CameraStreamSchema, CameraSwitchAuthoritySchema, CameraSwitchGroupSchema, CameraSwitchIdSchema, CameraSwitchSchema, CameraSwitchUnavailableReasonSchema, CameraSwitchWarningSchema, CandidateQueryFilterSchema, CapScopeSchema, CapabilityBindingsSchema, CarbonMonoxideStatusSchema, ChargingStatus, ClaimOutcomeSchema, ClaimsListingSchema, ClientNetworkStatsSchema, ClimateControlStatusSchema, ClipBytesOfferSchema, ClipBytesSchema, ClipExportFailureSchema, ClipModelMetaSchema, ClipPlaybackOptionsSchema, ClipPlaybackSchema, ClipSchema, ClipSearchStrictnessSchema, ClipSourceAvailabilitySchema, ClipSourceSchema, ClipStillDispositionSchema, ClipStillRefusalCodeSchema, ClipStreamAudioReasonSchema, ClipStreamAudioSchema, ClipStreamDialSchema, ClipWakeSchema, ClusterAddonNodeDeploymentSchema, ClusterAddonStatusEntrySchema, ClusterModelChoiceSchema, CollectionColumnSchema, CollectionIndexSchema, ColorStatusSchema, ComposerApplyInputSchema, ComposerApplyResultSchema, ComposerBlockSchema, ComposerBlockVerdictSchema, ComposerUnreadableBlockSchema, CompositionBindingSchema, CompositionBlockInputSchema, CompositionBlockStateSchema, CompositionCodeSourceSchema, CompositionCommandTargetSchema, CompositionCustomizationReadSchema, CompositionEventPlanSchema, CompositionExistingTargetSchema, CompositionExpressionSourceSchema, CompositionFeatureModeSchema, CompositionFeaturePlanSchema, CompositionFeatureSchema, CompositionFieldItemSchema, CompositionFieldKindSchema, CompositionFieldPlanSchema, CompositionFieldReadSchema, CompositionFieldRoleSchema, CompositionFieldSourceSchema, CompositionFieldStateKindSchema, CompositionFieldStateSchema, CompositionFieldsFeatureSchema, CompositionForwardCommandSchema, CompositionFromSourceSchema, CompositionGetReadSchema, CompositionGraphError, CompositionItemEntrySchema, CompositionListReadSchema, CompositionLiteralBindingSchema, CompositionNewTargetSchema, CompositionPassthroughFeatureSchema, CompositionProblemCodeSchema, CompositionProblemSchema, CompositionRunStatusSchema, CompositionSchema, CompositionSourceRefSchema, CompositionStateReadSchema, CompositionTargetSchema, CompositionUnavailableModeSchema, CompositionValidationSchema, CompositionViewSchema, ConfigEntrySchema, ConfigSectionWithValuesSchema, ConfigTabDeclarationSchema, ConnectionTestDescriptorSchema, ConnectionTestInputSchema, ConnectionTestOutcomeSchema, ConnectivityStatusSchema, ConsumableItemSchema, ConsumableRemainingSchema, ConsumableRemainingUnitSchema, ConsumablesStatusSchema, ContactStatusSchema, ControlKindSchema, ControlStatusSchema, ConvertArtifactSchema, ConvertResultSchema, ConvertTargetSchema, CoreBlockCompileResultSchema, CoreBlockInputSchema, CoreBlockPlacementSchema, CoreBlockSchema, CoreBlockSourceSchema, CoreBlockStatusSchema, CoverStateSchema, CoverStatusSchema, CreateApiKeyInputSchema, CreateApiKeyResultSchema, CreateIntegrationInputSchema, CreateScopedTokenInputSchema, CreateScopedTokenResultSchema, CreateUserInputSchema, CustomActionInputSchema, CustomModelDescriptorSchema, DATAPLANE_SECRET_HEADER, DAYS_PER_WEEK, DAY_NAMES, DECLARED_DEVICE_SWEEP_LIMIT, DECLARED_INTEGRATION_FIXED_KEY, DEFAULT_ADDON_PLACEMENT, DEFAULT_AUDIO_ANALYZER_CONFIG, DEFAULT_CLUSTER_STEP_MODELS, DEFAULT_CLUSTER_STEP_SETTINGS, DEFAULT_DECODER_HWACCEL_CONFIG, DEFAULT_DETAIL_CROP_CONVENTION, DEFAULT_EVENTS_BAND_BUFFER_SEC, DEFAULT_EVENT_COLOR, DEFAULT_FEATURES, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS, DEFAULT_MIN_LANDMARK_FACE_SIZE_PX, DEFAULT_NATIVE_LEASE_SETTINGS, DEFAULT_OVERLAY_LAYERS, DEFAULT_POOL_MEMORY_POLICY, DEFAULT_RECORDING_PROFILES, DEFAULT_RETENTION, DEFAULT_RUNTIME_STATE_DURABILITY, DEFAULT_TIMELAPSE_PREVIEW_TEXT, DEFAULT_TOKEN_EXPIRY, DERIVED_CAMERA_SILENCED_CAP_NAMES, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, DETECTION_MACRO_CLASSES, DETECTION_PIPELINE_CAP_NAME, DEVICE_BACKEND_TO_FORMAT, DEVICE_CAP_NAMES, DEVICE_CHILDREN_BATCH_MAX, DEVICE_PROFILES, DEVICE_RESTORE_RETRY_CONCURRENCY, DEVICE_RESTORE_RETRY_DELAYS_MS, DEVICE_SCOPED_CAPS, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATE_READERS, DEVICE_STATUS_METHOD, DEVICE_TYPE_CONTROL_KIND, DEVICE_TYPE_INFO, DISPLAY_ICON_GROUPS, DISPLAY_ICON_KEYS, DISPLAY_ICON_OFFERED_KEYS, DISPLAY_ICON_VOCABULARY, DOORBELL_SOURCE_SLOT, EngineInfoSchema as DataStoreEngineInfoSchema, DayNightModeSchema, DayNightOptionsSchema, DayNightSettingsPatchSchema, DayNightStatusSchema, DeclaredDevices, DecodedAudioChunkSchema, DecodedFrameSchema, DecoderSessionConfigSchema, DecoderStatsSchema, DeleteIntegrationResultSchema, DetailCropConventionSchema, DetectionCatalogClassMapSchema, DetectionSourceSchema, DetectionSourcesSchema, DeviceAdminLinkSchema, DeviceCodeSeveritySchema, DeviceConfig, DeviceDiscoveryStatusSchema, ExposeInputSchema as DeviceExportExposeInputSchema, DeviceExportStatusSchema, UnexposeInputSchema as DeviceExportUnexposeInputSchema, DeviceFeature, DeviceInfoSchema, DeviceNetworkStatsSchema, DeviceRestoreRetryScheduler, DeviceRole, DeviceRuntimeState, DeviceSelectorSchema, DeviceStatusSchema, DeviceType, DiagnosticIdSchema, DiagnosticWindowPatchSchema, DiagnosticWindowSchema, DiscoveredChildDeviceSchema, DiscoveredChildStatusSchema, DiscoveredDeviceSchema, DiscoveredTargetSchema, DiskReconcileJobSchema, DisposerChain, DoorbellPressEventSchema, DoorbellSourceSlotValueSchema, DoorbellStatusSchema, EMBEDDING_MODEL_FAILED, EMBEDDING_REQUIREMENTS_FAILED, EMBEDDING_REQUIREMENTS_UNAVAILABLE, EVENTFUL_CAP_NAMES, EVENT_DENSITY_BATCH_MAX, EVENT_KIND_BY_CAP, EVENT_OWNER_TYPES, EVENT_PAD_MS, EVENT_TAXONOMY, EXPORT_DENSE_MAX_RANGES, EXPRESSION_BUILTINS, EXPRESSION_BUILTIN_NAMES, EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, EXPRESSION_INJECTED_NOW, EXTENSION_HOST_DEVICE_TYPES, EXTENSION_SLOTS, EXTENSION_SLOT_IDS, EXTENSION_SLOT_LISTING_METHOD, EXTENSION_SLOT_REF_SEPARATOR, EffectiveTuningSchema, EgressEncodeSchema, EgressRateControlSchema, EgressTranscodeRequestSchema, EgressTranscodeSchema, ElementConfigStore, EmbeddingFailedModelSchema, EmbeddingFailedRequirementSchema, EmbeddingInfoSchema, EmbeddingRefusalCodeSchema, EmbeddingResultSchema, EmbeddingTowerSchema, EncodeProfileSchema, EncodedPacketSchema, EnrichedWidgetMetadataSchema, EnumSensorDateTimeFormatSchema, EnumSensorStatusSchema, EventCategory, EventDensityBucketSchema, EventDensityForDeviceSchema, EventEmitterStatusSchema, EventFireSchema, EventKindCategorySchema, EventKindDescriptorSchema, EventKindIconSchema, EventKindSchema, EventKindsForDeviceSchema, EventMediaArtifactSchema, EventMediaCoverageSchema, EventMediaKindSchema, EventMediaProductionSchema, EventOwnerTypeSchema, EventSourceType, ExportBytesSchema, ExportClipSubjectSchema, ExportDenseRangeSchema, ExportDenseSchema, ExportDownloadSchema, ExportFootageSubjectSchema, ExportOptionsSchema, ExportRecordSchema, ExportSetupFieldSchema, ExportSetupSchema, ExportSpeedSchema, ExportStateSchema, ExportSubjectSchema, ExportTimelapseSchema, ExposedDeviceSchema, ExposureModeSchema, ExpressionBindingSourceSchema, ExpressionEvalError, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionParseError, ExpressionSourceSchema, ExtensionCandidateSchema, ExtensionCandidatesSchema, ExtensionSetResultSchema, ExtensionSetSlotInputSchema, ExtensionSlotActivationSchema, ExtensionSlotIdSchema, ExtensionSlotRefInputSchema, ExtensionSlotRowSchema, ExtensionSlotSourceSchema, ExtensionSlotStateSchema, ExtensionSlotUnreachableSchema, ExtensionSlotValueSchema, ExtensionSourceAvailabilitySchema, ExtensionSourceHealthSchema, ExtensionSourceSchema, FEEDER_EXAMPLE_ADDON_ID, FEEDER_EXAMPLE_HA_DEVICE_ID, FIRST_LEVEL_MACRO_CLASSES, FULL_IMAGE_BBOX, FailureContributionSchema, FailureCounters, FailureReasonCountSchema, FanControlStatusSchema, FanDirectionSchema, FeatureManifestSchema, FeatureProbeStatusSchema, FieldClaimModeSchema, FieldClaimSchema, FloodStatusSchema, Fmp4BoxSplitter, FrameHandleFormatSchema, FrameHandleSchema, FrameInputSchema, FrameLazyCountersSchema, FrameLazyMetricsSchema, G711_SCALE_CORRECTION_DB, GasStatusSchema, GetLoggingSettingsInputSchema, GetStreamWithCodecInputSchema, GlobalMetricsSchema, GridLayoutPatchSchema, GridLayoutViewSchema, HAP_AUDIO_BASE, HAP_AUDIO_BITRATE_KBPS, HAP_AUDIO_VBV_KBITS, HAP_KEYFRAME_INTERVAL_SEC, HF_BASE_URL, HF_REPO, HOURS_PER_DAY, HWACCEL_OPTIONS, HealthStatusSchema, HfModelResolutionSchema, HistoryPointSchema, HistoryResolutionEnum, HumidifierStatusSchema, HumiditySensorStatusSchema, HvacModeSchema, INFERENCE_DEVICE_EXCLUSION_REASONS, ImageContractSchema, ImageContractStateSchema, ImageRotateSchema, ImageSettingsOptionsSchema, ImageSettingsPatchSchema, ImageSettingsStatusSchema, ImageStatusSchema, InferenceDeviceExclusionReasonSchema, IngestOwnerSchema, InstalledPackageSchema, IntegrationLiteSchema, IntegrationWithStateSchema, IntercomAbilitySchema, IntercomStatusSchema, KNOWN_CAP_NAMES, KeyEventSchema, LEGACY_READ_ONLY_CONFIG_KEY, LINKED_DEVICES_SLOT, LOAD_CONTRIBUTION_ATTRIBUTIONS, LOAD_CONTRIBUTION_ROLES, LOCATION_DESCRIPTION_MAX, LOCATION_ICON_FALLBACK, LOCATION_ICON_IDS, LOG_CHANNEL_TICK_MS, LOG_LEVEL_RANK, LTS_SCOPE_CLASS_SEPARATOR, LabelAttributionSchema, LabelDefinitionSchema, LabelTierSchema, LawnMowerActivitySchema, LawnMowerControlStatusSchema, LedgerWalkDeviceReportSchema, LedgerWalkInputSchema, LedgerWalkRefusalSchema, LedgerWalkReportSchema, LedgerWalkSkipCountsSchema, LedgerWalkSkipReasonSchema, LegacyStorageLocationDefaultSchema, LinkedDeviceSchema, LinkedDevicesModeSchema, LinkedDevicesSlotValueSchema, LlmDefaultSchema, LlmDefaultSelectorSchema, LlmDownloadProgressSchema, LlmErrorCodeSchema, LlmGenerateBaseInputSchema, LlmGenerateErrSchema, LlmGenerateOkSchema, LlmGenerateResultSchema, LlmImageSchema, LlmNodeModelSchema, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, LlmRefusalSourceSchema, LlmRetryPolicySchema, LlmRuntimeAppleCompleteInputSchema, LlmRuntimeCancelInputSchema, LlmRuntimeCompleteInputSchema, LlmRuntimeDiskUsageSchema, LlmRuntimeNodeSchema, LlmRuntimeStatusSchema, LlmTimeoutDefaults, LlmUsageRollupSchema, LlmUsageSchema, LoadContributionSchema, LocateSegmentResultSchema, LocationDescriptionAssignmentSchema, LocationIconAssignmentSchema, LocationIconIdSchema, LocationStatSchema, LockControlStatusSchema, LockStateSchema, LogChannelApplyResultSchema, LogChannelDescriptorSchema, LogChannelGate, LogChannelLevelSchema, LogChannelRegistry, LogChannelWindowPatchSchema, LogChannelWindowSchema, LogChannelWindowStateSchema, LogEntrySchema, LogLevelSchema, LogStreamEntrySchema, LoggingEffectiveSchema, LoggingExplicitSchema, LoggingLevelLayerSchema, LoggingLevelSourceSchema, LoggingScopeKindSchema, LoggingSettingsPatchSchema, LoggingSettingsStateSchema, LoginMethodContributionSchema, LoginStageEnum, LtsBucketSchema, MACRO_LABELS, MAX_ARCHIVED_DEBUG_NOTES, MAX_BIRTH_DECISION_RECORDS, MAX_BIRTH_LATENCY_PROXY_MS, MAX_CLIP_EVENT_IDS, MAX_CLIP_LABELS, MAX_COMPOSITION_CODE_LENGTH, MAX_COMPOSITION_FEATURES, MAX_COMPOSITION_FIELDS_PER_FEATURE, MAX_COMPOSITION_ITEMS, MAX_CONDITION_DEPTH, MAX_CONDITION_LEAVES, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, MAX_KEYS, MAX_REASONS_PER_KEY, MAX_SENSOR_TRIGGER_DEVICES, MAX_TRACK_DEBUG_NOTE_LEN, MEDIA_OWNER_TYPES, MEDIA_PRESENCE_OWNER_KINDS, METHOD_ACCESS_MAP, METHOD_DEVICE_SELECTORS, MINUTES_PER_DAY, MODEL_FORMATS, MODEL_HOSTING, MODEL_PROVIDER_IDS, MOTION_CLOSE_AFTER_MS, MOTION_TRIGGER_FEATURE, ManagedModelCatalogEntrySchema, ManagedModelExtraFileSchema, ManagedModelRefSchema, ManagedRuntimeConfigSchema, MaskGridDimsSchema, MaskGridShapeSchema, MaskLineShapeSchema, MaskPointSchema, MaskPolygonShapeSchema, MaskPolygonVerticesSchema, MaskRectShapeSchema, MaskShapeKindSchema, MaskShapeSchema, MediaFileInfoSchema, MediaFileKindEnum, MediaFileRefSchema, MediaFileSchema, MediaPlayerRepeatSchema, MediaPlayerStateSchema, MediaPlayerStatusSchema, MediaPresenceOwnerKindSchema, MediaRelocateModeSchema, MeshPeerSchema, MeshStatusSchema, MethodAccessSchema, MigrateDeviceResultSchema, MigrateSwitchOutcomeSchema, MigrateSwitchReportSchema, ModelCatalogEntrySchema, ModelConvertInputSchema, ModelConvertMetadataSchema, ModelDistributeInputSchema, ModelDistributeResultSchema, ModelExtraFileSchema, ModelFormatEntrySchema, ModelFormatsSchema, ModelLicenseSchema, ModelProviderIdSchema, ModelSubstitutionSchema, ModelVariantGroupSchema, MotionAnalysisResultSchema, MotionEventSchema, MotionOnMotionChangedDataSchema, MotionRegionSchema, MotionSourceEnum, MotionSourcesSchema, MotionStatusSchema, MotionTriggerRuntimeStateSchema, MotionTriggerStatusSchema, MotionZoneOptionsSchema, MotionZonePatchSchema, MotionZoneRegionSchema, MotionZoneStatusSchema, StatusSchema as MqttBrokerStatusSchema, MutationFilterSchema, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SCENE_BUDGET_FIELD, NATIVE_LEASE_SCENE_BUDGET_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, NAVIGATION_ACTION_CATALOG, NAVIGATION_LIGHT_LEVEL_MAX, NAVIGATION_LIGHT_LEVEL_MIN, NC_ALARM_OPENING_EVENT_KINDS, NC_ALARM_SYSTEM_EVENT_KINDS, NC_AUDIO_CONFIRM_HITS_DEFAULT, NC_AUDIO_CONFIRM_HITS_MAX, NC_AUDIO_CONFIRM_HITS_MIN, NC_AUDIO_CONFIRM_WINDOW_MAX_SEC, NC_AUDIO_CONFIRM_WINDOW_MIN_SEC, NC_AUDIO_CONFIRM_WINDOW_SEC_DEFAULT, NC_AUDIO_DBFS_FLOOR, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, NC_AUDIO_SEED, NC_AUTHORABLE_SYSTEM_EVENT_KINDS, NC_BASE_CONDITION_KEYS, NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_CLIP_POST_ROLL_DEFAULT_SEC, NC_CLIP_PRE_ROLL_DEFAULT_SEC, NC_CLIP_RETENTION_MAX_SEC, NC_CONDITION_CATALOG, NC_CONFIRM_DEFAULT_MAX_IMAGE_PX, NC_CONFIRM_DEFAULT_TIMEOUT_MS, NC_CONFIRM_MAX_TIMEOUT_MS, NC_CONFIRM_MIN_TIMEOUT_MS, NC_CONSUMABLE_LOW_PERCENT_DEFAULT, NC_CONSUMABLE_LOW_PERCENT_MAX, NC_CONSUMABLE_SYSTEM_EVENT_KINDS, NC_DEFAULT_SNOOZE_MINUTES, NC_HISTORY_LIMIT_DEFAULT, NC_HISTORY_LIMIT_MAX, NC_MAX_PER_TRACK_IMMEDIATE, NC_OCCUPANCY_DEFAULTS, NC_RULE_CLEARABLE_KEYS, NC_RULE_EDITOR_SECTION_ORDER, NC_RULE_KIND_SPECS, NC_RULE_SECTIONS, NC_SENSOR_RAISED_FIELD_BY_KIND, NC_SENSOR_TRANSITION_KINDS, NC_SENSOR_TRANSITION_NEVER_FIRES_WARNING, NC_SENSOR_TRANSITION_UNSUPPORTED_REASON, NC_SERVER_PACKAGE_NAME, NC_SNOOZE_MAX_MINUTES, NC_SYSTEM_DELIVERY, NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS, NC_SYSTEM_EVENT_FAMILIES, NC_SYSTEM_EVENT_FAMILY, NC_SYSTEM_EVENT_FAMILY_FILTERS, NC_SYSTEM_EVENT_FILTER_KEYS, NC_SYSTEM_EVENT_KIND_GROUP_SPECS, NC_SYSTEM_EVENT_SUMMARY_FAMILIES, NC_SYSTEM_RULE_KINDS, NC_TANK_SYSTEM_EVENT_KINDS, NC_TAXONOMY, NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS, NC_TEMPLATE_VARS, NC_UPDATE_EVENT_PACKAGE_NAMES, NETWORK_LINK_TYPES, NETWORK_LINK_UNKNOWN, NativeCropBboxSchema, NativeCropRefSchema, NativeCropResultSchema, NativeDetectionSchema, NativeLeaseAdmissionSchema, NativeLeaseSettingsSchema, NativeObjectClassEnum, NativeObjectDetectionOptionsSchema, NativeObjectDetectionRuntimeStateSchema, NativeObjectDetectionSettingsPatchSchema, NativeObjectDetectionStatusSchema, NativeObjectGeometryEnum, NavigationActionEntrySchema, NavigationActionIdSchema, NavigationEntryKindSchema, NavigationFeaturesSchema, NavigationLightModeSchema, NavigationModeSchema, NavigationMoveCommandSchema, NavigationPointSchema, NavigationRuntimeStateSchema, NavigationStatusSchema, NcAlarmConfigSchema, NcAlarmModeCoverageSchema, NcAlarmSettingsPatchSchema, NcAlarmSettingsSchema, NcAlarmSkipReasonSchema, NcAlarmSkippedDeviceSchema, NcAudioConditionSchema, NcClipRetentionAskSchema, NcClipRetentionPlanSchema, NcConditionDescriptorSchema, NcConditionsSchema, NcConfirmExpectSchema, NcConfirmSchema, NcCrossingSchema, NcDeliverySchema, NcDeviceStateConditionSchema, NcHistoryEntrySchema, NcHistoryFilterSchema, NcHistoryRecordKindSchema, NcHistoryStatusSchema, NcHistorySubjectSchema, NcLinkedCameraModeSchema, NcMediaFrameSchema, NcMediaPolicySchema, NcOccupancyConditionSchema, NcPlateMatcherSchema, NcRuleActionSchema, NcRuleActionSequenceSchema, NcRuleActionsSchema, NcRuleClearableKeySchema, NcRuleInputSchema, NcRuleKindSchema, NcRuleLastRunSchema, NcRuleLastRunsSchema, NcRuleNotificationButtonSchema, NcRulePatchSchema, NcRuleSchema, NcRuleTargetSchema, NcRuleUpdateInputSchema, NcSceneConditionSchema, NcScheduleSchema, NcScheduleWindowSchema, NcSensorTransitionSchema, NcSnoozeInputSchema, NcSnoozeSchema, NcSnoozeScopeSchema, NcSnoozeSuppressedSchema, NcStateSummaryPreviewSchema, NcStateSummaryPreviewSectionSchema, NcSystemEventConditionSchema, NcSystemEventDeliveryModeSchema, NcSystemEventDeliverySchema, NcSystemEventKindSchema, NcTaxonomyEntrySchema, NcTaxonomySchema, NcTemplateFamilySchema, NcTemplateFieldSchema, NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, NcTemplateVarContextSchema, NcTemplateVarDescriptorSchema, NcTemplateVarGroupSchema, NcTemplateVarKindSchema, NcTestResultSchema, NcThrottleGranularitySchema, NcThrottleSchema, NcZoneConditionSchema, NetworkAccessStatusSchema, NetworkAddressSchema, NetworkEndpointSchema, NetworkLinkStatusSchema, NodeDirectoryEntrySchema, NodeDirectorySchema, NotificationActionIconSchema, NotificationActionSchema, NotificationFormatSchema, NotificationSchema, NotifierStatusSchema, NumericSensorStatusSchema, OPERATOR_WRITTEN_STALE_MS, OPS_LOG_DEFAULT_LIMIT, OPS_LOG_RING_DEFAULT_MAX, OVERFLOW_REASON, OVERLAY_LAYERS, OWNER_ONLY_EVENT_CATEGORIES, OauthIntegrationDescriptorSchema, ObjectEventSchema, OccupancyBurstRefusalSchema, OnboardFieldSupportSchema, OnboardRecordTrackSchema, OnboardScheduleSupportSchema, OnboardStorageSchema, OnboardStorageVolumeSchema, OpsLogDomainSchema, OpsLogEntrySchema, OpsLogOpSchema, OpsLogQueryInputSchema, OpsLogReasonSchema, OrchestratorMetricsSchema, OsdOverlayKindEnum, OsdOverlayPatchSchema, OsdOverlaySchema, OsdPositionEnum, OsdRenderOutcomeEnum, OsdRenderResultSchema, OsdSlotBindingSchema, OsdSlotViewSchema, OsdSourceOptionSchema, OsdSourceSchema, OsdSourceValueTypeEnum, OsdStatusSchema, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, PENDING_BLOCK_ID, PET_FEEDER_MANUAL_FEED_MAX, PET_FEEDER_MANUAL_FEED_MIN, PIPELINE_ANALYTICS_CAP_NAME, PIPELINE_FLOW_CAPABILITY_NAMES, PIPELINE_OWNER_CAPABILITY_NAMES, PRIVACY_MASK_CAP_NAME, PROVIDER_KIND_CAP_NAMES, PROVIDER_PIN_FIELD, PYTHON_SCRIPT, PackageUpdateSchema, PackageVersionInfoSchema, ParkRefusalSchema, ParkTrackFrameResultSchema, ParkedFrameKindSchema, ParkedTrackFrameSchema, PasskeyLoginMethodSchema, PasskeySummarySchema, PcmSampleFormatSchema, PeerBytesTicketSchema, PerScopeBreakdownSchema, PetFeederStatusSchema, PickStreamPreferencesSchema, PickStreamRequirementsSchema, PickedCamStreamSchema, PipelineAssignmentSchema, PipelineDefaultStepSchema, PipelineEngineChoiceSchema, PipelineRunResultBridge, PipelineStepInputSchema, PipelineValidationIssueSchema, PipelineValidationResultSchema, PlaceholderReasonSchema, PolygonPointSchema, PoolMemoryWatchdog, PowerMeterStatusSchema, PresenceStatusSchema, PressureSensorStatusSchema, PrivacyMaskOptionsSchema, PrivacyMaskPatchSchema, PrivacyMaskRegionSchema, PrivacyMaskShapeSchema, PrivacyMaskStatusSchema, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, ProviderStatusSchema, PtzAutotrackRuntimeStateSchema, PtzAutotrackSettingsSchema, PtzAutotrackStatusSchema, PtzAutotrackTargetOptionSchema, PtzHomePresetSchema, PtzHomeReturnSchema, PtzMoveCommandSchema, PtzOptionsSchema, PtzPositionSchema, PtzPresetFunctionSchema, PtzPresetSchema, PtzStatusSchema, QueryFilterSchema, RATE_CONTROL_RELAXED, RATE_CONTROL_TIGHT, REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHABILITY_PROBE_TIMEOUT_MS, RECOGNITION_TYPES, RECORDING_AUDIO_TRIGGER_OFFERED_DBFS, RECORDING_EXPORT_MAX_READ_BYTES, RECORDING_SOURCE_CAMSTACK, RECORDING_SOURCE_CAMSTACK_ADDON, RECORDING_TIMELINE_BATCH_MAX, REDACTED_SECRET, RESERVED_BINDING_NAMES, RESERVED_COLLECTION_SOURCES, RESTORED_CAP_NAMES, ROOM_EXAMPLE_MOTION_SOURCES, ROOM_EXAMPLE_TEMPERATURE_SOURCES, ROOM_OCCUPANCY_WINDOW_MS, ROOT_BUCKET_KEY, RUNTIME_DEFAULTS, RUNTIME_STATE_POLICY, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, RUNTIME_TO_FORMAT, RawStateResultSchema, ReadGopBytesResultSchema, ReadSegmentBytesResultSchema, ReadWindowBytesResultSchema, ReadinessRegistry, ReadinessTimeoutError, RebuildObjectEmbeddingsRefusalSchema, RecentTracksPageSchema, RecentTracksQueryInput, RecordTriggerSchema, RecordWindowSchema, RecordingAvailabilityForDeviceSchema, RecordingAvailabilitySchema, RecordingBandAudioSchema, RecordingBandModeSchema, RecordingBandSchema, RecordingBandTriggersSchema, RecordingConfigSchema, RecordingDaysForDeviceSchema, RecordingDaysSchema, RecordingDeviceUsageSchema, RecordingLocationUsageSchema, RecordingManifestSchema, RecordingObjectTriggerClassSchema, RecordingOnboardOptionsSchema, RecordingOnboardPatchSchema, RecordingOnboardStatusSchema, RecordingPlaybackSchema, RecordingRangeSchema, RecordingReadSchema, RecordingRebalanceInputSchema, RecordingRebalanceMoveSchema, RecordingRebalancePlanSchema, RecordingRebalanceSkipReasonSchema, RecordingRebalanceSkipSchema, RecordingRetentionSchema, RecordingSignalRuntimeStateSchema, RecordingSignalStatusSchema, RecordingSourceAvailabilitySchema, RecordingSourceOptionsSchema, RecordingSourceSchema, RecordingStatusSchema, RecordingStorageModeSchema, RecordingStorageUsageSchema, RecordingTriggersSchema, RecordingWeekdaySchema, RedirectLoginMethodSchema, RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, RelocateFootageClassSchema, RelocateFootageInputSchema, RelocateJobSchema, RelocateJobStateSchema, RelocateMediaInputSchema, RelocateResidueInputSchema, RelocateResidueSchema, RenderedAsSchema, ReportMotionInputSchema, ReportedFailureContributionSchema, ReportedLoadContributionSchema, RequestCensusGroupSchema, RequestCensusProcedureSchema, RequestCensusSnapshotSchema, RequestCensusStatusSchema, RetrainAnnotationDraftSchema, RetrainAnnotationKindSchema, RetrainAnnotationSchema, RetrainAnnotationSourceSchema, RetrainAssistResultSchema, RetrainAssistSubjectSchema, RetrainCopyRefusalSchema, RetrainFrameCandidateSchema, RetrainFrameListSchema, RetrainFrameSchema, RetrainFrameSelectionSchema, RetrainMacroClassSchema, RetrainStatusSchema, RetrainTrackSchema, RetrainTransitionResultSchema, RingBuffer, RtpSourceSchema, RtspRestreamEntrySchema, RunnerCameraConfigSchema, RunnerCameraDeviceUIFields, RunnerFrameSourceSchema, RunnerInferenceDeviceSchema, RunnerJumpStepProvisioningSchema, RunnerLocalLoadSchema, RunnerLocalMetricsSchema, SCENE_CONDITIONS, SCENE_CONFIRM_DEFAULT_MAX_IMAGE_PX, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS, SCENE_DEFAULT_ANCHOR_THRESHOLD, SCENE_DEFAULT_CHECK_INTERVAL_SEC, SCENE_DEFAULT_OBSERVATION_SPACING_SEC, SCENE_DEFAULT_QUIET_SECONDS, SCENE_DEFAULT_UNCOVERED_POLICY, SCENE_DIVERGED, SCENE_RESET_RECAPTURES, SCOPE_PRESETS, SENSOR_FEATURES, SENSOR_MAP, SHARE_VIEW_KINDS, SOURCE_CAPS, SOURCE_CAP_ACTIVE_FIELD, SOURCE_CAP_CHANGED_AT_FIELD, SOURCE_DEVICE_TYPES, SOURCE_INFO_METADATA_KEY, STATIONARY_OVERLAY_STYLE, STORAGE_ACCESS_FALLBACK, STORAGE_BYTES_PER_GB, STORAGE_LOCATION_MODES, STREAM_PROFILE_META, STREAM_QUALITY_LABELS, SUB_DETECTION_TYPES, SUMMARIES_DEFAULT_LIMIT, SUMMARIES_MAX_LIMIT, SYSTEM_CAP_NAMES, SYSTEM_SCOPE_DEVICE_METHODS, SceneCheckSchema, SceneConditionSchema, SceneConfirmSchema, SceneMonitorSchema, SceneMonitorStateSchema, SceneMonitorStatusForDeviceSchema, SceneMonitorStatusSchema, SceneReferenceSchema, SceneUnavailableSchema, SceneUncoveredPolicySchema, SceneVerdictSchema, ScopedTokenSchema, ScopedTokenSummarySchema, ScoredObjectEventSchema, ScriptRunnerStatusSchema, SearchResultSchema, SendEmailInputSchema, SendEmailResultSchema, SendResultSchema, SensorEventSchema, ServerBootModeSchema, ServerPackageStatusSchema, ServerRollbackInfoSchema, ServerUpdateActionResultSchema, ServerUpdateCheckResultSchema, ServerUpdateOutcomeSchema, ServerUpdateStateSchema, SetLoggingSettingsInputSchema, SetSiteLocationInputSchema, SettingsPatchSchema, SettingsRecordSchema, SettingsSchemaWithValuesSchema, SettingsUpdateResultSchema, ShmRingStatsSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, SiteZoneSchema, SmokeStatusSchema, SmtpStatusSchema, SnapshotImageSchema, SourceInfoSchema, SpatialDetectionSchema, SsoBridgeClaimsSchema, StartEmbeddedInputSchema, StationaryObjectSchema, AbortUploadInputSchema as StorageAbortUploadInputSchema, StorageAccessSchema, BeginDownloadInputSchema as StorageBeginDownloadInputSchema, BeginDownloadResultSchema as StorageBeginDownloadResultSchema, BeginUploadInputSchema as StorageBeginUploadInputSchema, BeginUploadResultSchema as StorageBeginUploadResultSchema, StorageCleanupInputSchema, StorageCleanupJobSchema, StorageCleanupPhaseSchema, StorageCleanupStatusInputSchema, StorageDrainProgressSchema, EndDownloadInputSchema as StorageEndDownloadInputSchema, StorageEvictionPolicySchema, FinalizeUploadInputSchema as StorageFinalizeUploadInputSchema, StorageLocationDeclarationSchema, StorageLocationModeSchema, StorageLocationRefSchema, StorageLocationSchema, StorageLocationTypeSchema, StorageMigrationClassSchema, StorageMigrationDestinationsSchema, StorageMigrationDrainInputSchema, StorageMigrationFindingCodeSchema, StorageMigrationFindingSchema, StorageMigrationFootageMoveInputSchema, StorageMigrationInputSchema, StorageMigrationJobSchema, StorageMigrationLaneSchema, StorageMigrationLeaseInputSchema, StorageMigrationMediaMoveInputSchema, StorageMigrationModeSchema, StorageMigrationMoveProgressSchema, StorageMigrationMoveSchema, StorageMigrationMoverSchema, StorageMigrationParticipantSchema, StorageMigrationPhaseSchema, StorageMigrationPlanSchema, StorageMigrationResidueSchema, StorageMigrationSourcesSchema, StorageOccupancyReportSchema, ProviderInfoSchema as StorageProviderInfoSchema, ReadChunkInputSchema as StorageReadChunkInputSchema, TestLocationResultSchema as StorageTestLocationResultSchema, WriteChunkInputSchema as StorageWriteChunkInputSchema, StreamCodecSchema, StreamFormatSchema, StreamNetworkStatsSchema, StreamParamsOptionsSchema, StreamParamsStatusSchema, StreamProfileConfigSchema, StreamProfileOptionsSchema, StreamProfilePatchSchema, StreamProfileSchema, StreamSignalSchema, StreamSignalsStatusSchema, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, SummarySchema, SwitchStatusSchema, SystemMetricsSchema, SystemMirror, TAXONOMY_COLORS, TIMELAPSE_DENSE_FLOOR_SEC, TIMEZONES, TRANSCODE_DOWN_MAX_BITRATE_KBPS, TRANSCODE_DOWN_MAX_HEIGHT, TamperStatusSchema, TankStatusSchema, TargetKindCapsSchema, TargetKindLevelSchema, TargetKindSchema, TargetSchema, TemperatureSensorStatusSchema, TerminalInstanceInfoSchema, TerminalLegacyCameraSchema, TerminalOutputBatchSchema, TerminalOutputEventSchema, TerminalProfileInfoSchema, TerminalSessionInfoSchema, TestConnectionResultSchema$1 as TestConnectionResultSchema, TestConnectionStatusEnum, TestResultSchema, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, ToastSchema, TokenScopeSchema, TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, TrackCascadeCountsSchema, TrackEnvelopeSchema, TrackFlagsPatchSchema, TrackFlagsSchema, TrackProjectionSchema, TrackSchema, TrackSourceSchema, TrackStateSchema, TrackZoneFilterSchema, TrackedDetectionSchema, TrainingExportDeviceTotalsSchema, TrainingExportSummarySchema, TransportPlaneCountsSchema, TransportPlaneSchema, TurnServerSchema, UNATTRIBUTED_BUCKET_KEY, UNIT_TABLE, BrokerInfoSchema$1 as UnifiedBrokerInfoSchema, UnitConversionError, UnstampedEventMediaCountSchema, UnstampedRowsSchema, UpdateIntegrationInputSchema, UpdateStatusSchema, UpdateUserInputSchema, UserRecordSchema, UserSummarySchema, VECTOR_INDEX_DIM_CONFLICT, VIDEOCLIPS_MAX_OFFER_BYTES, VIDEOCLIPS_MAX_READ_BYTES, VISIT_MERGE_GAP_MS, VacuumControlStatusSchema, VacuumStateSchema, ValveStateSchema, ValveStatusSchema, VectorDeclareIndexInputSchema, VectorDeleteByFilterInputSchema, VectorDeleteInputSchema, VectorDeleteResultSchema, VectorFilterSchema, VectorGetInputSchema, VectorGetResultSchema, VectorItemSchema, VectorMatchSchema, VectorMetadataSchema, VectorMetricSchema, VectorQueryInputSchema, VectorQueryResultSchema, VectorStatsInputSchema, VectorStatsResultSchema, VectorUpsertInputSchema, VectorUpsertResultSchema, VibrationStatusSchema, VideoEncodeSchema, WEBRTC_CLIMB_HOLD_CODES, WEBRTC_EGRESS_PROFILE, WEBRTC_TRY_BLOCKERS, WEEKLY_MASK_LENGTH, WELL_KNOWN_TABS, WELL_KNOWN_TAB_MAP, WaterHeaterStatusSchema, WeatherStatusSchema, WebrtcClimbHoldSchema, WebrtcLadderDecisionSchema, WebrtcSessionDebugSchema, WebrtcStreamChoiceSchema, WebrtcStreamTargetSchema, WebrtcTierFailureSchema, WhiteBalanceModeSchema, WidgetHostEnum, WidgetLoginMethodSchema, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, WrapperEvidenceSchema, WrapperIdentitySchema, WrapperKindSchema, YAMNET_TO_MACRO, ZoneCrossingDirectionSchema, ZoneCrossingSchema, ZoneKindEnum, ZoneRuleModeEnum, ZoneRuleSchema, ZoneRuleStageEnum, ZoneRulesArraySchema, ZoneSchema, ZoneScopeBreakdownSchema, __resetLogChannelRegistryForTests, accessoriesCapability, accessoryStableId, addonPagesCapability, addonPagesSourceCapability, addonRoutesCapability, addonSettingsCapability, addonWidgetsCapability, addonWidgetsSourceCapability, addonsCapability, adminUiCapability, airQualitySensorCapability, alarmPanelCapability, alertsCapability, ambientLightSensorCapability, asBoolean, asJsonArray, asJsonObject, asNumber, asString, assertTimelapseCadences, audioAnalysisCapability, audioAnalyzerCapability, audioChunkBytesPerSample, audioCodecCapability, audioIsFailClosed, audioKindId, audioLabelChoices, audioMetricsCapability, audioModeOf, audioOrDefaults, audioPlanFromEncodeProfile, audioScaleEraOf, authProviderCapability, autoAssignProfiles, automationControlCapability, backupCapability, bareAddonId, batteryCapability, bestLocationMatch, binaryCapability, bindAddonActions, brightnessCapability, brokerCapability, buildAddonRouteProvider, buildAudioArgs, buildCapabilityLookup, buildDeviceAdminUrl, buildEventKindDescriptor, buildFfmpegArgs, buildInputArgs, buildModelVariantGroups, buildNcTaxonomy, buildRoleScopes, buildStreamParamsConfigSchema, buildVideoArgs, buttonCapability, cameraCredentialsCapability, cameraGridLayoutCapability, cameraPipelineConfigCapability, cameraStreamsCapability, canConvertUnit, canonicalEgressPlan, carbonMonoxideCapability, cellsToRects, classifyBearerPrincipal, classifyStream, classifyStreams, climateControlCapability, clipExportFailure, clipExportFailureOf, clipReasonHeaderValue, cloneStatefulExpressionMemory, clusterModelSettingKey, clusterStepSettingFieldsFor, clusterStepSettingKey, codecIsAccepted, collectHydratedFieldEntries, collectHydratedFieldValues, collectSecretConfigKeys, colorCapability, colorForKind, commitWatchdogRestart, compareToTarget, compileExpression, compileExpressionSafe, composeSwitchedOff, composedDeviceRef, composedDeviceStableId, composerCapability, compositionEdges, compositionFeatureEnabled, compositionFieldKey, compositionItemFieldPath, compositionReadKey, compositionSliceKey, compositionSourceKey, compositionSourceRefs, conditionDepth, conditionExclusionReason, conditionVisibleForKind, connectionTestCapability, connectivityCapability, consumableLowPercentOf, consumablesCapability, contactCapability, controlCapability, convertUnit, coreBlockAddonId, coreBlockComposition, coreBlockIdFromAddonId, coreBlockSourceKind, coreBlocksCapability, cosineSimilarity, countConditionLeaves, coverCapability, createDeviceExtensionProvider, createDeviceProxy, createDurableState, createEvent, createEventBusSliceSource, createExpressionScope, createHwAccelCache, createLazyTrpcSource, createLogChannelsProvider, createMirrorSource, createRuntimeStateBridge, createSliceHandle, createStatefulExpressionMemory, createSystemProxy, customAction, customModelRegistryCapability, dataStoreProviderCapability, dayNightCapability, dayOfWeekToIndex, declarationOwnerNodeId, declareLogChannel, decodeVectorBase64, decoderCapability, defaultDeliveryForSection, defaultDeviceFor, defineCustomActions, defineExtensionSlotProvider, deriveBatteryPresence, deriveCameraSwitches, deriveDetailCropRect, deriveRecordingMode, describeCustomActions, describeModelVariant, describeOnboardClamp, describeOnboardRefusal, describeStateField, describeSystemEventDeliveryProblem, describeSystemEventFamilyProblem, describeTopLevelStateFields, detectAccessRole, detectionPipelineCapability, deviceAdminLinkCapability, deviceAdoptionCapability, deviceBackendToFormat, deviceCustomAction, deviceDiscoveryCapability, deviceExportCapability, deviceExtensionCapability, deviceManagerCapability, deviceMatchesProfile, deviceOpsCapability, deviceProviderCapability, deviceSelectorMatches, deviceStateCapability, deviceStatusCapability, displayIconEntry, displayIconsInGroup, doorbellCapability, droppedConditionsForKind, egressTranscodeSharingKey, egressTransportFromRequest, embeddingEncoderCapability, embeddingModelFailedError, embeddingModelFailedOf, embeddingRefusalOf, embeddingRequirementsFailedError, embeddingRequirementsUnavailableError, emitDownForOwnedCaps, emitReadiness, emitsCollectionSelector, encodeProfileFromStreamShape, encodeVectorBase64, enumSensorCapability, enumerateInferenceDevices, enumerateItemArrayFields, enumerateSchemaFields, errMsg, evaluateAst, evaluateCompositionField, evaluateCount, evaluateExpressionSource, evaluatePoolMemory, evaluateRose, evaluateSensorEdge, evaluateSensorLevelEdge, evaluateStatefulExpressionCall, evaluateZoneRules, event, eventEmitterCapability, evictionPolicyForMode, evictionPolicyOfLocation, expandAudioChunkToF32le, expandCapMethods, expandContainer, exportSubjectOf, expressionContainsBuiltinCall, extensionSlotRef, extractNestedAddonId, extractSourceInfoFromMetadata, faceGalleryCapability, failureContributionCapability, failureRate, fanControlCapability, featureFieldEntries, featureProbeCapability, featureSources, feederCustomizationExample, feederExampleSources, fieldReads, filesystemBrowseCapability, findCandidateCycles, findCompositionCycles, findTimezone, floodCapability, foldSnapshotByFunction, formatForRuntime, formatMediaOwnerKey, formatMinutes, formatParkedFor, gasCapability, gbToBytes, generateAutomationBlock, getAudioMacroClassIds, getByPath, getCapsByProviderKind, getLogChannelRegistry, getTaxonomyEntry, hasMotionTrigger, hfModelUrl, htmlToText, humidifierCapability, humiditySensorCapability, hydrateSchema, imageCapability, imageSettingsCapability, inferExpressionKinds, inferModelProvider, initialPoolMemoryState, integrationsCapability, intercomCapability, interpretStoredClusterModel, invalidClusterStepModelEntries, invocationFromEncodeProfile, isAgentOnlyPlacement, isArrayOutputSchema, isAudioChunkFormat, isAudioLabelSelected, isAudioRule, isBaseConditionKey, isBatteryPresenceFault, isClusterScopedStep, isCollectionArrayMethod, isDeployableToAgent, isDetectionMacroClass, isDeviceConfigCap, isDeviceScopedCap, isDisplayIconKey, isEmbeddingModelFailed, isEvent, isEventOwnerType, isFirstLevelMacroClass, isHeldBackTemplateVar, isIsolatedBuiltin, isKnownTemplateVar, isLocationEnabled, isMediaOwnerType, isNode, isObjectInput, isOccupancyRule, isOwnerOnlyEventCategory, isRestoredCap, isSameAddonId, isScheduleActive, isSecretConfigField, isSoftwareDecode, isSourceCap, isStatefulBuiltin, isStorageLocationMode, isSystemDelivery, isSystemEventFamily, isSystemEventSummaryRule, isSystemRuleKind, isVectorIndexDimConflict, isVoidInput, ituDbfsFromPreEpoch, jobKindSchema, kebabToCamel, kindOfValue, kindsForDiscriminator, knownValues, lawnMowerControlCapability, legacyAutoLinkIds, legacyModeOf, lifecycleJobSchema, lifecycleJobScopeSchema, lifecycleJobStateSchema, lifecycleTaskSchema, llmCapability, llmRuntimeCapability, loadContributionCapability, localNetworkCapability, locationIconKey, locationSimilarity, lockControlCapability, logBannerArgs, logChannelsCapability, logDestinationCapability, logLevelAtMost, loginMethodCapability, looseSchema, makeProfileBrokerId, makeSourceBrokerId, mapAudioLabelToMacro, markdownToHtmlLite, markdownToText, maskUrlCredentials, mayReadLocation, mayWriteToLocation, mediaPlayerCapability, mergeSourceInfo, meshNetworkCapability, method, methodAccessForHttpMethod, metricsProviderCapability, migrateLegacyDeviceSignalConfig, minutesToTimeOfDay, modeMayRead, modeMayWrite, modelConvertCapability, modelDistributorCapability, modelFormatForRuntime, motionCapability, motionDetectionCapability, motionTriggerCapability, motionZonesCapability, mqttBrokerCapability, nativeObjectDetectionCapability, navigationCapability, networkAccessCapability, networkLinkCapability, networkQualityCapability, nodePickerItems, nodePin, nodesCapability, normalizeAddonInitResult, normalizeAudioLabel, normalizeNodeId, normalizeTokenScopes, normalizeUnit, notificationOutputCapability, notificationRulesCapability, notifierCapability, numericSensorCapability, oauthIntegrationCapability, objectInputDeclaresAddonId, objectInputDeclaresRequiredDeviceId, occupancyScope, optionalAncestors, optionalMethod, osdCapability, osdManagerCapability, overlayClusterStepSettings, packagePickerItems, parseAdminBase, parseCameraStreamConfig, parseExpression, parseJsonArray, parseJsonObject, parseJsonUnknown, parseMediaOwnerKey, parseOccupancyScope, parseProcStatus, parseProfileBrokerId, parseRuleSection, parseStreamParamsFormPatch, patchAudio, petFeederCapability, pickAccessoryControl, pickClusterStepModels, pickClusterStepSettings, pickDetailCropConvention, pickInvalidClusterStepModels, pickNativeLeaseOverride, pickPreferredRtspEntry, pickRestartCandidate, pickVideoEncoder, pickerForCondition, pipelineAnalyticsCapability, pipelineExecutorCapability, pipelineOrchestratorCapability, pipelineRunnerCapability, planComposition, planCompositionEvents, planItems, plateGalleryCapability, platformProbeCapability, poolMemoryThreshold, powerMeterCapability, prepareNotification, presenceCapability, pressureSensorCapability, principalMayReachAddon, privacyMaskCapability, procedureAuthKey, ptzAutotrackCapability, ptzCapability, publicEventCategories, pythonScriptForBackend, rankStreams, readClusterStepModels, readClusterStepSettings, readDetailCropConvention, readDeviceStateFrom, readNativeLeaseOverride, readNodePin, readTimelapseGeneratedAt, readinessKey, rebootCapability, recordingArchiveCapability, recordingCapability, recordingExportCapability, recordingOnboardCapability, recordingSignalCapability, rectsToCells, reducePoints, replacedFieldKeys, requiredTopLevelKeys, requiresPython, reservedSourceOwner, resetPoolBaseline, resolveAddonExecution, resolveAddonGroup, resolveAddonPlacement, resolveBucketMs, resolveCapMount, resolveClipSearchMinScore, resolveClusterStepModelId, resolveContainerPrimaryChild, resolveCreateExportSubject, resolveDeviceControlKind, resolveDeviceProfile, resolveEgressDecodeHwAccel, resolveExportProfiles, resolveFormat, resolveHydratedFieldValue, resolveLocationIcon, resolveLocationMode, resolveMethodAuth, resolveMutate, resolvePoolMemoryPolicy, resolveRecordingProfiles, resolveRunnerId, resolveStreamMaps, resolveVariantModelId, resolveViewableDeviceIds, roleSpec, roomCompositionExample, ruleBelongsToAlarm, ruleEditorSectionsForKind, ruleKindOf, ruleKindSpec, ruleMatchesSection, ruleSection, ruleSectionOf, ruleSeedForSection, runInferenceStep, runtimeDevices, runtimeStatePolicyFor, sceneMonitorCapability, scheduleForSendTimes, schemaDeclaresAnyField, scopeInherits, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, scoreRuntimes, scriptRunnerCapability, searchDisplayIcons, selectAssignedProfileSlots, sendTimesOfSchedule, sensorRaisedOf, sensorTransitionNeverFires, sensorTransitionOffered, servedTemplateVars, serverManagementCapability, setByPath, settingsStoreCapability, signalPercentFromBars, signalPercentFromRssi, siteZoneKey, sleep, sleepCancellable, sliceActiveValue, sliceChangedAt, smokeCapability, smtpProviderCapability, snapshotCapability, ssoBridgeCapability, startReachabilityPoll, stateVocabularyFor, stepModelRunsOnFormat, storageCapability, storageEvictableCapability, storageMigrationCapability, storageOccupancyCapability, storageProviderCapability, streamBrokerCapability, streamCatalogCapability, streamParamsCapability, streamPixels, streamQualityLabel, streamSignalsCapability, stripRetiredBandPreBufferSec, strippedOfLegacyReadOnly, subKindsOf, summarisePrivacyAudio, summarizeEffectiveScope, supportedRuntimes, switchCapability, switchedOffIds, synthesizeSourceInfo, systemCapability, systemEventDeliveryProblems, systemEventFamilyOf, systemEventFamilyProblems, systemEventFilterApplies, systemEventFilterAppliesToAnyKind, systemEventKindNamesOf, systemEventKindsOfFamily, systemEventSummaryScheduleOf, systemFamilyOfKind, systemRuleKindOf, tamperCapability, taskLogEntrySchema, taskPhaseSchema, taskTargetSchema, temperatureSensorCapability, templateCarriesSummary, templateVarDeliveryApplies, templateVarKindApplies, templateVarSystemEventApplies, templateVarsFor, terminalSessionCapability, textToHtml, timeOfDayToMinutes, toDeviceSummary, toExpressionValue, toNodeId, toStreamSourceEntry, toastCapability, toggleAudioLabel, tokenize, transcodeBody, tryConvertUnit, turnProviderCapability, unitDimension, unitsForDimension, unreachableExtensionSlotRow, unwrapSchema, updateCapability, userManagementCapability, userPasskeysCapability, vacuumControlCapability, validateComposition, validateExpressionSource, validateRecipeBounds, valveCapability, vectorDimFromBase64, vectorIndexDimConflictError, vectorStoreCapability, vibrationCapability, videoclipsCapability, viewerUiCapability, waterHeaterCapability, weatherCapability, webrtcClientHintsSchema, webrtcSessionCapability, weeklyMaskIndex, weeklyMaskIsUniform, weeklyMaskToWindows, windowsToWeeklyMask, wiringAddonHealthSchema, wiringHealthSnapshotSchema, wiringNodeHealthSchema, wiringProbeKindSchema, wiringProbeResultSchema, withLocationMode, zodEntriesToConfigUI, zoneAnalyticsCapability, zoneRulesCapability, zonesCapability };
|