@camstack/addon-osd-manager 0.1.142 → 0.1.143

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.
Files changed (18) hide show
  1. package/dist/{MotionZonesSettings-CLoGx9rM.mjs → MotionZonesSettings-D_u2HAV8.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-BZiL6_bt.mjs → PrivacyMaskSettings-BWo2Poz3.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-C4XOkOxm.mjs → SceneMonitorEditor-lkaFmEgy.mjs} +3 -3
  4. package/dist/_stub.js +137 -137
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BA2LcfhK.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BNPWHRDn.mjs} +3 -3
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Bj2dTNd0.mjs +26 -0
  7. package/dist/{hostInit-BXqW88VO.mjs → hostInit-aLPXTY6c.mjs} +2 -2
  8. package/dist/index.js +532 -26
  9. package/dist/index.mjs +532 -26
  10. package/dist/{player-overlays-QdIhVJJ9.mjs → player-overlays-BLFv1a4b.mjs} +1 -1
  11. package/dist/remoteEntry.js +1 -1
  12. package/dist/{responsive-BaAG2IvP.mjs → responsive-CRQJLpxM.mjs} +1 -1
  13. package/dist/{scene-monitor-copy-DViLoo13.mjs → scene-monitor-copy-Uvp-WnB0.mjs} +1 -1
  14. package/dist/{square-DwPV8oay.mjs → square-UutiR2vl.mjs} +1 -1
  15. package/dist/{trash-2-C1AFBh3V.mjs → trash-2-CQR67Ytv.mjs} +1 -1
  16. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-J30N4Tun.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-DqdShEJ5.mjs} +1 -1
  17. package/package.json +1 -1
  18. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CWTKCd56.mjs +0 -26
package/dist/index.mjs CHANGED
@@ -9658,6 +9658,48 @@ var ModelProviderIdSchema = _enum([
9658
9658
  "scrypted",
9659
9659
  "custom"
9660
9660
  ]);
9661
+ /**
9662
+ * The licence of a model, as a record rather than a bare SPDX string: a
9663
+ * permissive CODE licence routinely sits on top of restrictive WEIGHTS or
9664
+ * DATA, and the obligations (attribution, modification notices, source offers)
9665
+ * are per upstream. A persisted custom-model row written when this field was a
9666
+ * string still parses — the string is lifted into `{ weights }`.
9667
+ *
9668
+ * Every licence surface (the admin "Models and licenses" page,
9669
+ * `THIRD_PARTY_MODELS.md`, the Hugging Face model table) is GENERATED from
9670
+ * these records by `scripts/gen-model-licenses.ts` (D661).
9671
+ */
9672
+ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { weights: value } : value, object({
9673
+ /** SPDX id of the WEIGHTS' terms, a `LicenseRef-*` for non-SPDX terms, or `UNKNOWN`. */
9674
+ weights: string().min(1),
9675
+ /** SPDX id of the upstream code that defines / trained the network. */
9676
+ code: string().min(1).optional(),
9677
+ /** Training data whose terms add obligations (attribution, non-commercial). */
9678
+ data: object({
9679
+ name: string().min(1),
9680
+ terms: string().min(1),
9681
+ url: string().url().optional()
9682
+ }).optional(),
9683
+ /** The project the weights come from. Required on built-in entries (guard). */
9684
+ upstream: object({
9685
+ name: string().min(1),
9686
+ url: string().url()
9687
+ }).optional(),
9688
+ /** Where the licence text governing the weights is published. */
9689
+ url: string().url().optional(),
9690
+ /** Attribution the licence REQUIRES, verbatim. */
9691
+ attribution: string().min(1).optional(),
9692
+ /** What CamStack changed. Required when `hosting` is `camstack-hf` (guard). */
9693
+ modifications: string().min(1).optional(),
9694
+ /** Who serves the file a node downloads. */
9695
+ hosting: _enum([
9696
+ "camstack-hf",
9697
+ "third-party",
9698
+ "built-in"
9699
+ ]).optional(),
9700
+ /** True when the weights or their data forbid commercial use. */
9701
+ nonCommercial: boolean().optional()
9702
+ }));
9661
9703
  var ModelCatalogEntrySchema = object({
9662
9704
  id: string(),
9663
9705
  name: string(),
@@ -9746,11 +9788,11 @@ var ModelCatalogEntrySchema = object({
9746
9788
  p95LatencyMs: record(string(), number()).optional()
9747
9789
  }).optional(),
9748
9790
  /**
9749
- * SPDX-ish license id of the model weights (e.g. `AGPL-3.0` for Ultralytics
9750
- * YOLO26, `GPL-3.0` for YOLOv9, `Apache-2.0` for D-FINE/RF-DETR). Matters for
9751
- * the retraining addon and any future commercial distribution.
9791
+ * The model's licence record — see {@link ModelLicenseSchema}. Optional in
9792
+ * the schema (a custom model's author may state none); REQUIRED and complete
9793
+ * on every built-in catalog entry (`scripts/check-catalog-licence.ts`).
9752
9794
  */
9753
- license: string().optional(),
9795
+ license: ModelLicenseSchema.optional(),
9754
9796
  /**
9755
9797
  * Variant-selector grouping. The UI groups models by `family` + `tier` and
9756
9798
  * offers `precision` / `optimization` as variant axes WITHIN a tier — so all
@@ -9845,23 +9887,6 @@ var ExpressionEvalError = class extends Error {
9845
9887
  this.name = "ExpressionEvalError";
9846
9888
  }
9847
9889
  };
9848
- /**
9849
- * Frozen, null-prototype builtin function table for the expression engine
9850
- * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
9851
- * parser rejects any callee not in it, and the evaluator gates each call on an
9852
- * own-property check against it.
9853
- *
9854
- * Because the object has a NULL prototype AND is `Object.freeze`d:
9855
- * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
9856
- * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
9857
- * (there is no `Object.prototype` in the chain), so those names are not
9858
- * callable — they are simply "unknown function" at parse time.
9859
- *
9860
- * Every numeric argument is validated as a finite number and every numeric
9861
- * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
9862
- * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
9863
- * closed rather than emitting a garbage value.
9864
- */
9865
9890
  function asFiniteNumber(value, name, index) {
9866
9891
  if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
9867
9892
  return value;
@@ -9877,6 +9902,10 @@ function finiteResult(value, name) {
9877
9902
  function allFiniteNumbers(args, name) {
9878
9903
  return args.map((a, idx) => asFiniteNumber(a, name, idx));
9879
9904
  }
9905
+ function asBoolean$1(value, name, index) {
9906
+ if (typeof value !== "boolean") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a boolean`);
9907
+ return value;
9908
+ }
9880
9909
  var INF = Number.POSITIVE_INFINITY;
9881
9910
  var table = {
9882
9911
  min: {
@@ -9977,6 +10006,40 @@ var table = {
9977
10006
  if (from === to) return x;
9978
10007
  throw new ExpressionEvalError("convert: unit conversion table not installed");
9979
10008
  }
10009
+ },
10010
+ any: {
10011
+ minArgs: 1,
10012
+ maxArgs: INF,
10013
+ apply: (args) => args.map((a, i) => asBoolean$1(a, "any", i)).some((b) => b)
10014
+ },
10015
+ all: {
10016
+ minArgs: 1,
10017
+ maxArgs: INF,
10018
+ apply: (args) => args.map((a, i) => asBoolean$1(a, "all", i)).every((b) => b)
10019
+ },
10020
+ within: {
10021
+ minArgs: 2,
10022
+ maxArgs: 2,
10023
+ apply: (args, hooks) => {
10024
+ const windowMs = asFiniteNumber(args[1], "within", 1);
10025
+ if (windowMs < 0) throw new ExpressionEvalError("within: the window must not be negative");
10026
+ const at = args[0];
10027
+ if (at === null) return false;
10028
+ const ts = asFiniteNumber(at, "within", 0);
10029
+ const now = hooks.now;
10030
+ if (now === void 0 || !Number.isFinite(now)) throw new ExpressionEvalError("within: no clock was supplied to this evaluation");
10031
+ const inside = now - ts <= windowMs;
10032
+ if (inside) hooks.noteDeadline?.(ts + windowMs + 1);
10033
+ return inside;
10034
+ }
10035
+ },
10036
+ latest: {
10037
+ minArgs: 1,
10038
+ maxArgs: INF,
10039
+ apply: (args) => {
10040
+ const present = args.flatMap((a, i) => a === null ? [] : [asFiniteNumber(a, "latest", i)]);
10041
+ return present.length === 0 ? null : finiteResult(Math.max(...present), "latest");
10042
+ }
9980
10043
  }
9981
10044
  };
9982
10045
  Object.freeze(Object.assign(Object.create(null), table));
@@ -10591,7 +10654,7 @@ var AutomationActionSchema = discriminatedUnion("kind", [
10591
10654
  code: string().min(1).max(2e4)
10592
10655
  })
10593
10656
  ]);
10594
- object({
10657
+ var AutomationRecipeSchema = object({
10595
10658
  triggers: array(AutomationTriggerSchema),
10596
10659
  conditions: AutomationConditionSchema.optional(),
10597
10660
  actions: array(AutomationActionSchema)
@@ -11208,12 +11271,32 @@ var AudioClassificationLabelSchema = object({
11208
11271
  originalClass: string().optional(),
11209
11272
  score: number()
11210
11273
  });
11274
+ /**
11275
+ * Did the classifier RUN on this window? (D660)
11276
+ *
11277
+ * `classified` with no labels means the model heard nothing above the
11278
+ * camera's floor. `not-classified` means nobody listened — and until D660 the
11279
+ * two were the same shape (`classification` absent), so a window the global
11280
+ * busy gate threw away read downstream exactly like a quiet one (D393).
11281
+ */
11282
+ var AudioClassifyOutcomeSchema = discriminatedUnion("state", [object({ state: literal("classified") }), object({
11283
+ state: literal("not-classified"),
11284
+ reason: _enum([
11285
+ "superseded",
11286
+ "error",
11287
+ "timeout",
11288
+ "disposed"
11289
+ ])
11290
+ })]);
11211
11291
  var AudioAnalysisResultSchema = object({
11212
11292
  level: AudioLevelSchema,
11293
+ /** Labels at or above the camera's floor. Absent = none — read `classifyOutcome` to know whether the model ran at all. */
11213
11294
  classification: object({
11214
11295
  labels: array(AudioClassificationLabelSchema).readonly(),
11215
11296
  inferenceMs: number()
11216
11297
  }).optional(),
11298
+ /** Whether the classifier ran on this window (D660). */
11299
+ classifyOutcome: AudioClassifyOutcomeSchema,
11217
11300
  timestamp: number()
11218
11301
  });
11219
11302
  var AudioAnalysisSettingsSchema = object({
@@ -13398,6 +13481,195 @@ var cameraStreamsCapability = {
13398
13481
  */
13399
13482
  durability: "session"
13400
13483
  };
13484
+ /** A composed device's stableId is this prefix plus the block id. */
13485
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
13486
+ /** Longest snippet a `code` source may carry (slice 4). */
13487
+ var MAX_COMPOSITION_CODE_LENGTH = 2e4;
13488
+ var CompositionSourceRefSchema = object({
13489
+ /** The owning addon; `stableId` is unique only within it. */
13490
+ addonId: string().min(1),
13491
+ stableId: string().min(1)
13492
+ });
13493
+ /** One field of one capability of one source device. */
13494
+ var CompositionFieldReadSchema = object({
13495
+ source: CompositionSourceRefSchema,
13496
+ cap: string().min(1),
13497
+ /** Dotted path into the source cap's runtime-state slice. */
13498
+ fieldPath: string().min(1)
13499
+ });
13500
+ /** `from`: copy one source field verbatim. It is also an expression's `from` binding. */
13501
+ var CompositionFromSourceSchema = CompositionFieldReadSchema.extend({ kind: literal("from") });
13502
+ var CompositionBindingSchema = discriminatedUnion("kind", [CompositionFromSourceSchema, object({
13503
+ kind: literal("literal"),
13504
+ value: union([
13505
+ string(),
13506
+ number(),
13507
+ boolean(),
13508
+ _null()
13509
+ ])
13510
+ })]);
13511
+ /**
13512
+ * `expression`: a formula over named bindings, in the salvaged expression
13513
+ * engine. Validated at parse by the SAME function every other consumer runs,
13514
+ * so the editor and the store cannot disagree.
13515
+ */
13516
+ var CompositionExpressionSourceSchema = object({
13517
+ kind: literal("expression"),
13518
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13519
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), CompositionBindingSchema)
13520
+ }).superRefine((src, ctx) => {
13521
+ const err = validateExpressionSource(src);
13522
+ if (err !== null) ctx.addIssue({
13523
+ code: "custom",
13524
+ message: err,
13525
+ path: ["expr"]
13526
+ });
13527
+ });
13528
+ /** `code`: RESERVED for slice 4 (own runner, one-way eject). */
13529
+ var CompositionCodeSourceSchema = object({
13530
+ kind: literal("code"),
13531
+ code: string().min(1).max(MAX_COMPOSITION_CODE_LENGTH)
13532
+ });
13533
+ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
13534
+ CompositionFromSourceSchema,
13535
+ CompositionExpressionSourceSchema,
13536
+ CompositionCodeSourceSchema
13537
+ ]);
13538
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
13539
+ kind: literal("forward"),
13540
+ source: CompositionSourceRefSchema,
13541
+ cap: string().min(1),
13542
+ method: string().min(1)
13543
+ }), CompositionCodeSourceSchema]);
13544
+ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
13545
+ kind: literal("fields"),
13546
+ cap: string().min(1),
13547
+ fields: record(string().min(1), CompositionFieldSourceSchema).refine((fields) => Object.keys(fields).length <= 32, { message: `at most 32 fields per capability` }),
13548
+ /** RESERVED for slice 3; refused by the validator when non-empty. */
13549
+ commands: record(string().min(1), CompositionCommandTargetSchema).optional()
13550
+ }), object({
13551
+ kind: literal("passthrough"),
13552
+ cap: string().min(1),
13553
+ source: CompositionSourceRefSchema
13554
+ })]);
13555
+ var CompositionSchema = object({
13556
+ target: discriminatedUnion("kind", [object({
13557
+ kind: literal("new"),
13558
+ type: _enum(DeviceType),
13559
+ role: _enum(DeviceRole).optional()
13560
+ }), object({
13561
+ kind: literal("existing"),
13562
+ device: CompositionSourceRefSchema
13563
+ })]),
13564
+ features: array(CompositionFeatureSchema).min(1).max(16)
13565
+ }).superRefine((composition, ctx) => {
13566
+ const seen = /* @__PURE__ */ new Set();
13567
+ composition.features.forEach((feature, index) => {
13568
+ if (seen.has(feature.cap)) ctx.addIssue({
13569
+ code: "custom",
13570
+ message: `capability \`${feature.cap}\` is composed twice — one feature per capability`,
13571
+ path: [
13572
+ "features",
13573
+ index,
13574
+ "cap"
13575
+ ]
13576
+ });
13577
+ seen.add(feature.cap);
13578
+ });
13579
+ });
13580
+ /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.celsius`. */
13581
+ var CompositionProblemSchema = object({
13582
+ code: _enum([
13583
+ "reserved-variant",
13584
+ "unknown-capability",
13585
+ "not-composable",
13586
+ "wrong-device-type",
13587
+ "has-commands",
13588
+ "unknown-field",
13589
+ "nested-field",
13590
+ "missing-field",
13591
+ "kind-mismatch",
13592
+ "may-be-null",
13593
+ "source-missing",
13594
+ "source-unreadable",
13595
+ "source-capability-missing",
13596
+ "source-field-unknown",
13597
+ "expression-invalid",
13598
+ "cycle",
13599
+ "duplicate-target"
13600
+ ]),
13601
+ path: string(),
13602
+ message: string()
13603
+ });
13604
+ var CompositionFieldKindSchema = _enum([
13605
+ "string",
13606
+ "number",
13607
+ "boolean",
13608
+ "enum"
13609
+ ]);
13610
+ /** How a field says "unavailable": `null` when its schema allows it, else the device goes offline (D393). */
13611
+ var CompositionUnavailableModeSchema = _enum(["null", "offline"]);
13612
+ /**
13613
+ * `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
13614
+ * field of its cap changes value · `constant` reads nothing, computed once.
13615
+ */
13616
+ var CompositionFieldRoleSchema = _enum([
13617
+ "derived",
13618
+ "clock",
13619
+ "constant"
13620
+ ]);
13621
+ var CompositionFieldPlanSchema = object({
13622
+ cap: string(),
13623
+ path: string(),
13624
+ /** Index into `composition.features` this field's capability came from —
13625
+ * lets a source/cycle problem name its path as `features[N].fields.<path>`
13626
+ * (the same convention `planComposition`'s own problems already use). */
13627
+ featureIndex: number().int().nonnegative(),
13628
+ kind: CompositionFieldKindSchema,
13629
+ nullable: boolean(),
13630
+ required: boolean(),
13631
+ unavailable: CompositionUnavailableModeSchema,
13632
+ role: CompositionFieldRoleSchema,
13633
+ source: CompositionFieldSourceSchema,
13634
+ reads: array(CompositionFieldReadSchema)
13635
+ });
13636
+ var CompositionValidationSchema = object({
13637
+ ok: boolean(),
13638
+ problems: array(CompositionProblemSchema),
13639
+ fields: array(CompositionFieldPlanSchema)
13640
+ });
13641
+ /** Mirrors `CoreBlockStatus`, pinned by `core-blocks-source.spec.ts` (Task 11). */
13642
+ var CompositionRunStatusSchema = _enum([
13643
+ "stopped",
13644
+ "starting",
13645
+ "running",
13646
+ "failed"
13647
+ ]);
13648
+ var CompositionFieldStateKindSchema = _enum([
13649
+ "fresh",
13650
+ "stale",
13651
+ "unavailable"
13652
+ ]);
13653
+ var CompositionFieldStateSchema = object({
13654
+ cap: string(),
13655
+ path: string(),
13656
+ state: CompositionFieldStateKindSchema,
13657
+ /** `null` whenever `state === 'unavailable'`; never a plausible stand-in (D393). */
13658
+ value: union([
13659
+ string(),
13660
+ number(),
13661
+ boolean(),
13662
+ _null()
13663
+ ]),
13664
+ reason: string().optional()
13665
+ });
13666
+ var CompositionBlockStateSchema = object({
13667
+ blockId: string(),
13668
+ deviceId: number().nullable(),
13669
+ status: CompositionRunStatusSchema,
13670
+ reason: string().optional(),
13671
+ fields: array(CompositionFieldStateSchema)
13672
+ });
13401
13673
  /** Where a block runs. The operator chooses — a block driving a device on an
13402
13674
  * agent is the reason placement is not fixed to the hub. */
13403
13675
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -13424,6 +13696,30 @@ var CoreBlockInputSchema = object({
13424
13696
  */
13425
13697
  integrationId: string().optional()
13426
13698
  });
13699
+ /**
13700
+ * What a block IS (D659). Absent means `code` — every row stored before this
13701
+ * union keeps working unchanged.
13702
+ * - `code`: the TypeScript in `code`, compiled and run in its own runner;
13703
+ * - `recipe`: RESERVED (automations), stored shape only; refused at run by name;
13704
+ * - `composition`: declarative, run by the shared `composer`; `code` is `''`.
13705
+ */
13706
+ var CoreBlockSourceSchema = discriminatedUnion("kind", [
13707
+ object({ kind: literal("code") }),
13708
+ object({
13709
+ kind: literal("recipe"),
13710
+ recipe: AutomationRecipeSchema
13711
+ }),
13712
+ object({
13713
+ kind: literal("composition"),
13714
+ composition: CompositionSchema
13715
+ })
13716
+ ]);
13717
+ /** The client-authored half of a composition block. No `code`, no placement (hub-only; Phase 7). */
13718
+ var CompositionBlockInputSchema = object({
13719
+ name: string().min(1).max(120),
13720
+ enabled: boolean(),
13721
+ composition: CompositionSchema
13722
+ });
13427
13723
  /** A stored block. */
13428
13724
  var CoreBlockSchema = CoreBlockInputSchema.extend({
13429
13725
  id: string(),
@@ -13439,8 +13735,38 @@ var CoreBlockSchema = CoreBlockInputSchema.extend({
13439
13735
  */
13440
13736
  lastError: string().optional(),
13441
13737
  /** Ms epoch of the last state change. */
13442
- lastChangedAt: number()
13738
+ lastChangedAt: number(),
13739
+ /** What the block is. Absent means `code` (D659). */
13740
+ source: CoreBlockSourceSchema.optional()
13741
+ });
13742
+ /** A stored composition block and what the composer says about it. */
13743
+ var CompositionViewSchema = object({
13744
+ block: CoreBlockSchema,
13745
+ state: discriminatedUnion("kind", [object({
13746
+ kind: literal("answered"),
13747
+ state: CompositionBlockStateSchema.nullable()
13748
+ }), object({
13749
+ kind: literal("unreachable"),
13750
+ error: string()
13751
+ })])
13443
13752
  });
13753
+ /**
13754
+ * A read of the stored compositions. `not-loaded` while the `core_blocks`
13755
+ * table has not been READ: an empty answer then would make "not yet known"
13756
+ * look like "none", and invite the operator to recreate what exists (D315).
13757
+ */
13758
+ var CompositionsNotLoadedSchema = object({
13759
+ state: literal("not-loaded"),
13760
+ reason: string()
13761
+ });
13762
+ var CompositionListReadSchema = discriminatedUnion("state", [object({
13763
+ state: literal("loaded"),
13764
+ views: array(CompositionViewSchema)
13765
+ }), CompositionsNotLoadedSchema]);
13766
+ var CompositionGetReadSchema = discriminatedUnion("state", [object({
13767
+ state: literal("loaded"),
13768
+ view: CompositionViewSchema.nullable()
13769
+ }), CompositionsNotLoadedSchema]);
13444
13770
  /** What a compile attempt produced. */
13445
13771
  var CoreBlockCompileResultSchema = object({
13446
13772
  ok: boolean(),
@@ -13522,7 +13848,105 @@ var coreBlocksCapability = {
13522
13848
  getTypeDefs: method(object({}), object({ libs: array(object({
13523
13849
  filePath: string(),
13524
13850
  content: string()
13525
- })) }), { auth: "admin" })
13851
+ })) }), { auth: "admin" }),
13852
+ /**
13853
+ * Create a composition block (D659). VALIDATED first against the live
13854
+ * sources and every stored composition; a refusal names every problem by
13855
+ * path and reason (D391) and stores nothing.
13856
+ */
13857
+ createComposition: method(object({ block: CompositionBlockInputSchema }), object({ block: CoreBlockSchema }), {
13858
+ kind: "mutation",
13859
+ auth: "admin",
13860
+ caller: "required"
13861
+ }),
13862
+ /**
13863
+ * Patch a composition block. A changed `composition` is validated exactly
13864
+ * as on create. `expectedUpdatedAt` is the `updatedAt` the caller READ: a
13865
+ * block changed since is refused by name, never silently overwritten.
13866
+ */
13867
+ updateComposition: method(object({
13868
+ blockId: string(),
13869
+ expectedUpdatedAt: number(),
13870
+ block: CompositionBlockInputSchema.partial()
13871
+ }), object({ block: CoreBlockSchema }), {
13872
+ kind: "mutation",
13873
+ auth: "admin",
13874
+ caller: "required"
13875
+ }),
13876
+ /** One composition and the composer's state for it, or `not-loaded` (D315). */
13877
+ getComposition: method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }),
13878
+ listCompositions: method(object({}), CompositionListReadSchema, { auth: "admin" }),
13879
+ /**
13880
+ * Validate without saving — the same verdict the save reaches. A mutation
13881
+ * for its body size; it writes nothing, so its access is `view`.
13882
+ */
13883
+ validateComposition: method(object({
13884
+ composition: CompositionSchema,
13885
+ blockId: string().optional()
13886
+ }), CompositionValidationSchema, {
13887
+ kind: "mutation",
13888
+ auth: "admin",
13889
+ access: "view"
13890
+ })
13891
+ }
13892
+ };
13893
+ var ComposerBlockSchema = object({
13894
+ id: string().min(1),
13895
+ name: string().min(1).max(120),
13896
+ enabled: boolean(),
13897
+ updatedAt: number(),
13898
+ composition: CompositionSchema
13899
+ });
13900
+ /**
13901
+ * A stored composition row that no longer PARSES — a schema a release
13902
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
13903
+ * its device as a placeholder and reports the block `failed` naming the parse
13904
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
13905
+ */
13906
+ var ComposerUnreadableBlockSchema = object({
13907
+ id: string().min(1),
13908
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
13909
+ name: string().nullable(),
13910
+ /** The parse error, in the operator's words. */
13911
+ error: string()
13912
+ });
13913
+ var composerCapability = {
13914
+ name: "composer",
13915
+ scope: "system",
13916
+ mode: "singleton",
13917
+ internal: true,
13918
+ methods: {
13919
+ /**
13920
+ * Not `apply`: tRPC reserves `apply`, `call` and `then` as router keys, and
13921
+ * `router({})` throws on one — every cap router is built at boot.
13922
+ */
13923
+ applyBlocks: method(object({
13924
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
13925
+ integrationId: string().nullable(),
13926
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
13927
+ storeLoaded: boolean(),
13928
+ blocks: array(ComposerBlockSchema),
13929
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
13930
+ restartBlockIds: array(string()),
13931
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
13932
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
13933
+ }), object({
13934
+ blocks: array(object({
13935
+ blockId: string(),
13936
+ status: CompositionRunStatusSchema,
13937
+ reason: string().optional()
13938
+ })),
13939
+ /**
13940
+ * False when the composer declared and withdrew NOTHING (store not loaded,
13941
+ * integration unknown, its own rows unread or read empty once). An empty
13942
+ * apply the caller owes is paid off only by one the composer acted on (D49).
13943
+ */
13944
+ acted: boolean()
13945
+ }), {
13946
+ kind: "mutation",
13947
+ auth: "admin"
13948
+ }),
13949
+ getStates: method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" })
13526
13950
  }
13527
13951
  };
13528
13952
  /**
@@ -20924,8 +21348,8 @@ var NcTestResultSchema = object({
20924
21348
  className: string().optional(),
20925
21349
  label: string().optional()
20926
21350
  });
20927
- /** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is the
20928
- * same union; the template-vars spec pins the two together. `mixed` is DERIVED
21351
+ /** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is
21352
+ * `z.infer` of this schema — one shape, no twin. `mixed` is DERIVED
20929
21353
  * (a stored system rule whose kinds span families, D637) and never authored. */
20930
21354
  var NcRuleKindSchema = _enum([
20931
21355
  "detection",
@@ -23544,6 +23968,13 @@ var AudioEventSchema = object({
23544
23968
  originalClass: string().optional(),
23545
23969
  score: number()
23546
23970
  }).optional(),
23971
+ /**
23972
+ * Whether the classifier RAN on the window behind this row (D660). Absent
23973
+ * on rows written before D660 — unknown, NOT classified: until then a
23974
+ * window the analyzer's busy gate threw away was stored exactly like one
23975
+ * that heard nothing above the floor.
23976
+ */
23977
+ classifyOutcome: AudioClassifyOutcomeSchema.optional(),
23547
23978
  /** Populated by B5 (recording playback URL for this event). */
23548
23979
  mediaUrl: string().optional()
23549
23980
  });
@@ -43928,6 +44359,38 @@ var zoneRulesCapability = {
43928
44359
  */
43929
44360
  durability: "restored"
43930
44361
  };
44362
+ var NUMBER = {
44363
+ kind: "fixed",
44364
+ result: ["number"]
44365
+ };
44366
+ var BOOLEAN = {
44367
+ kind: "fixed",
44368
+ result: ["boolean"]
44369
+ };
44370
+ Object.freeze({
44371
+ min: NUMBER,
44372
+ max: NUMBER,
44373
+ abs: NUMBER,
44374
+ floor: NUMBER,
44375
+ ceil: NUMBER,
44376
+ sqrt: NUMBER,
44377
+ round: NUMBER,
44378
+ pow: NUMBER,
44379
+ clamp: NUMBER,
44380
+ avg: NUMBER,
44381
+ sum: NUMBER,
44382
+ age: NUMBER,
44383
+ convert: NUMBER,
44384
+ coalesce: { kind: "coalesce" },
44385
+ any: BOOLEAN,
44386
+ all: BOOLEAN,
44387
+ within: BOOLEAN,
44388
+ latest: {
44389
+ kind: "fixed",
44390
+ result: ["number", "null"]
44391
+ }
44392
+ });
44393
+ `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
43931
44394
  /**
43932
44395
  * Most specific first. Extending this list is how a new device kind becomes
43933
44396
  * gateable; nothing else needs to change.
@@ -45388,6 +45851,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
45388
45851
  carbonMonoxideCapability,
45389
45852
  climateControlCapability,
45390
45853
  colorCapability,
45854
+ composerCapability,
45391
45855
  connectionTestCapability,
45392
45856
  connectivityCapability,
45393
45857
  consumablesCapability,
@@ -46461,6 +46925,18 @@ Object.freeze({
46461
46925
  addonId: null,
46462
46926
  access: "create"
46463
46927
  },
46928
+ "composer.applyBlocks": {
46929
+ capName: "composer",
46930
+ capScope: "system",
46931
+ addonId: null,
46932
+ access: "create"
46933
+ },
46934
+ "composer.getStates": {
46935
+ capName: "composer",
46936
+ capScope: "system",
46937
+ addonId: null,
46938
+ access: "view"
46939
+ },
46464
46940
  "connectionTest.describeTest": {
46465
46941
  capName: "connection-test",
46466
46942
  capScope: "system",
@@ -46521,6 +46997,12 @@ Object.freeze({
46521
46997
  addonId: null,
46522
46998
  access: "create"
46523
46999
  },
47000
+ "coreBlocks.createComposition": {
47001
+ capName: "core-blocks",
47002
+ capScope: "system",
47003
+ addonId: null,
47004
+ access: "create"
47005
+ },
46524
47006
  "coreBlocks.delete": {
46525
47007
  capName: "core-blocks",
46526
47008
  capScope: "system",
@@ -46533,6 +47015,12 @@ Object.freeze({
46533
47015
  addonId: null,
46534
47016
  access: "view"
46535
47017
  },
47018
+ "coreBlocks.getComposition": {
47019
+ capName: "core-blocks",
47020
+ capScope: "system",
47021
+ addonId: null,
47022
+ access: "view"
47023
+ },
46536
47024
  "coreBlocks.getTypeDefs": {
46537
47025
  capName: "core-blocks",
46538
47026
  capScope: "system",
@@ -46545,6 +47033,12 @@ Object.freeze({
46545
47033
  addonId: null,
46546
47034
  access: "view"
46547
47035
  },
47036
+ "coreBlocks.listCompositions": {
47037
+ capName: "core-blocks",
47038
+ capScope: "system",
47039
+ addonId: null,
47040
+ access: "view"
47041
+ },
46548
47042
  "coreBlocks.restart": {
46549
47043
  capName: "core-blocks",
46550
47044
  capScope: "system",
@@ -46563,6 +47057,18 @@ Object.freeze({
46563
47057
  addonId: null,
46564
47058
  access: "create"
46565
47059
  },
47060
+ "coreBlocks.updateComposition": {
47061
+ capName: "core-blocks",
47062
+ capScope: "system",
47063
+ addonId: null,
47064
+ access: "create"
47065
+ },
47066
+ "coreBlocks.validateComposition": {
47067
+ capName: "core-blocks",
47068
+ capScope: "system",
47069
+ addonId: null,
47070
+ access: "view"
47071
+ },
46566
47072
  "cover.close": {
46567
47073
  capName: "cover",
46568
47074
  capScope: "device",