@camstack/addon-pipeline 1.2.298 → 1.2.300

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 (36) hide show
  1. package/THIRD_PARTY_MODELS.md +126 -123
  2. package/dist/audio-analyzer/index.js +2 -2
  3. package/dist/audio-analyzer/index.mjs +2 -2
  4. package/dist/{default-detection-model-Bim_g_Ui.mjs → default-detection-model-DX-p9O91.mjs} +391 -170
  5. package/dist/{default-detection-model-BTJZvSr_.js → default-detection-model-nKzvW7BX.js} +391 -170
  6. package/dist/detection-pipeline/index.js +4 -4
  7. package/dist/detection-pipeline/index.mjs +4 -4
  8. package/dist/{dist-L_HlB0At.js → dist-C2WOjQsy.js} +471 -26
  9. package/dist/{dist-DVz_88D_.mjs → dist-CqhrlD0m.mjs} +471 -26
  10. package/dist/motion-wasm/index.js +1 -1
  11. package/dist/motion-wasm/index.mjs +1 -1
  12. package/dist/{node-Cr8Ch1ZN.mjs → node-CZ1Z3f6z.mjs} +1 -1
  13. package/dist/{node-CmzZ_-zB.js → node-CiWM78Ze.js} +1 -1
  14. package/dist/pipeline-runner/index.js +3 -3
  15. package/dist/pipeline-runner/index.mjs +3 -3
  16. package/dist/{process-memory-FfRDGu11.js → process-memory-C0a37mXF.js} +1 -1
  17. package/dist/{process-memory-DO7La1yB.mjs → process-memory-taq9GnsO.mjs} +1 -1
  18. package/dist/recorder/index.js +15 -2
  19. package/dist/recorder/index.mjs +15 -2
  20. package/dist/{segment-demux-js-Cd7btWna.js → segment-demux-js-5Xcu3sTI.js} +1 -1
  21. package/dist/{segment-demux-js-BuioTwCh.mjs → segment-demux-js-Cydmp9fc.mjs} +1 -1
  22. package/dist/stream-broker/_stub.js +2 -2
  23. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CsbrrsyY.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-C7I6DjP3.mjs} +2 -2
  24. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-vnc0r4NV.mjs +26 -0
  25. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CUFWg1jj.mjs +26 -0
  26. package/dist/stream-broker/demux-worker-child.js +1 -1
  27. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  28. package/dist/stream-broker/{hostInit-NCsHzij7.mjs → hostInit-DyrGVuyu.mjs} +2 -2
  29. package/dist/stream-broker/index.js +3 -3
  30. package/dist/stream-broker/index.mjs +3 -3
  31. package/dist/stream-broker/remoteEntry.js +1 -1
  32. package/package.json +1 -1
  33. package/python/postprocessors/softmax.py +2 -1
  34. package/python/postprocessors/testdata/ssdlite_mobiledet_outputs.json +289 -1
  35. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DisouA2F.mjs +0 -26
  36. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Dti8Ex88.mjs +0 -26
@@ -3,11 +3,11 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-L_HlB0At.js");
7
- const require_node = require("../node-CmzZ_-zB.js");
8
- const require_default_detection_model = require("../default-detection-model-BTJZvSr_.js");
6
+ const require_dist = require("../dist-C2WOjQsy.js");
7
+ const require_node = require("../node-CiWM78Ze.js");
8
+ const require_default_detection_model = require("../default-detection-model-nKzvW7BX.js");
9
9
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
10
- const require_process_memory = require("../process-memory-FfRDGu11.js");
10
+ const require_process_memory = require("../process-memory-C0a37mXF.js");
11
11
  let node_os = require("node:os");
12
12
  node_os = require_chunk.__toESM(node_os);
13
13
  let node_fs = require("node:fs");
@@ -1,9 +1,9 @@
1
1
  import { n as __require } from "../chunk-DnnnRqeS.mjs";
2
- import { Dn as array, Dt as overlayClusterStepSettings, Gt as runtimeDevices$1, H as YAMNET_TO_MACRO, In as string, Kt as stepModelRunsOnFormat, Ln as union, Mt as pipelineExecutorCapability, Nn as object, Rn as EventCategory, Sn as parseJsonUnknown, Tn as sleep, Ut as resolvePoolMemoryPolicy, Zt as supportedRuntimes$1, _n as hydrateSchema, en as errMsg, et as defaultDeviceFor$1, it as detectionPipelineCapability, j as PoolMemoryWatchdog, kt as pickClusterStepSettings, lt as evaluateZoneRules, m as DEFAULT_CLUSTER_STEP_SETTINGS, pn as createEvent, sn as BaseAddon, st as enumerateInferenceDevices, t as APPLE_SA_TO_MACRO, u as CLUSTER_MODEL_SCOPED_STEPS, vt as loadContributionCapability, xn as nodePin, y as DEVICE_BACKEND_TO_FORMAT, zt as resolveClusterStepModelId } from "../dist-DVz_88D_.mjs";
3
- import { s as readProcessCost } from "../node-Cr8Ch1ZN.mjs";
4
- import { _ as resolveModelForFormat, a as buildSubtreeCanRun, c as macroGateVerdict, f as ALL_PIPELINE_STEPS, g as getStepDefinition, h as getStep, i as mergeCustomModels, m as getDefaultModelForFormat, n as resolveDefaultDetectionModel, p as ALL_STEPS, r as CustomModelCatalog, u as localFrameRegistry, y as landmarkPrecisionVerdict } from "../default-detection-model-Bim_g_Ui.mjs";
2
+ import { Dn as array, Dt as overlayClusterStepSettings, Gt as runtimeDevices$1, H as YAMNET_TO_MACRO, In as string, Kt as stepModelRunsOnFormat, Ln as union, Mt as pipelineExecutorCapability, Nn as object, Rn as EventCategory, Sn as parseJsonUnknown, Tn as sleep, Ut as resolvePoolMemoryPolicy, Zt as supportedRuntimes$1, _n as hydrateSchema, en as errMsg, et as defaultDeviceFor$1, it as detectionPipelineCapability, j as PoolMemoryWatchdog, kt as pickClusterStepSettings, lt as evaluateZoneRules, m as DEFAULT_CLUSTER_STEP_SETTINGS, pn as createEvent, sn as BaseAddon, st as enumerateInferenceDevices, t as APPLE_SA_TO_MACRO, u as CLUSTER_MODEL_SCOPED_STEPS, vt as loadContributionCapability, xn as nodePin, y as DEVICE_BACKEND_TO_FORMAT, zt as resolveClusterStepModelId } from "../dist-CqhrlD0m.mjs";
3
+ import { s as readProcessCost } from "../node-CZ1Z3f6z.mjs";
4
+ import { _ as resolveModelForFormat, a as buildSubtreeCanRun, c as macroGateVerdict, f as ALL_PIPELINE_STEPS, g as getStepDefinition, h as getStep, i as mergeCustomModels, m as getDefaultModelForFormat, n as resolveDefaultDetectionModel, p as ALL_STEPS, r as CustomModelCatalog, u as localFrameRegistry, y as landmarkPrecisionVerdict } from "../default-detection-model-DX-p9O91.mjs";
5
5
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
6
- import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-DO7La1yB.mjs";
6
+ import { n as pickNodePlatformArch, t as readProcessMemory } from "../process-memory-taq9GnsO.mjs";
7
7
  import * as os from "node:os";
8
8
  import * as fs from "node:fs";
9
9
  import * as path$1 from "node:path";
@@ -11472,6 +11472,48 @@ function inferModelProvider(entry) {
11472
11472
  if (/frigate/i.test(haystack)) return "frigate";
11473
11473
  return "custom";
11474
11474
  }
11475
+ /**
11476
+ * The licence of a model, as a record rather than a bare SPDX string: a
11477
+ * permissive CODE licence routinely sits on top of restrictive WEIGHTS or
11478
+ * DATA, and the obligations (attribution, modification notices, source offers)
11479
+ * are per upstream. A persisted custom-model row written when this field was a
11480
+ * string still parses — the string is lifted into `{ weights }`.
11481
+ *
11482
+ * Every licence surface (the admin "Models and licenses" page,
11483
+ * `THIRD_PARTY_MODELS.md`, the Hugging Face model table) is GENERATED from
11484
+ * these records by `scripts/gen-model-licenses.ts` (D661).
11485
+ */
11486
+ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { weights: value } : value, object({
11487
+ /** SPDX id of the WEIGHTS' terms, a `LicenseRef-*` for non-SPDX terms, or `UNKNOWN`. */
11488
+ weights: string().min(1),
11489
+ /** SPDX id of the upstream code that defines / trained the network. */
11490
+ code: string().min(1).optional(),
11491
+ /** Training data whose terms add obligations (attribution, non-commercial). */
11492
+ data: object({
11493
+ name: string().min(1),
11494
+ terms: string().min(1),
11495
+ url: string().url().optional()
11496
+ }).optional(),
11497
+ /** The project the weights come from. Required on built-in entries (guard). */
11498
+ upstream: object({
11499
+ name: string().min(1),
11500
+ url: string().url()
11501
+ }).optional(),
11502
+ /** Where the licence text governing the weights is published. */
11503
+ url: string().url().optional(),
11504
+ /** Attribution the licence REQUIRES, verbatim. */
11505
+ attribution: string().min(1).optional(),
11506
+ /** What CamStack changed. Required when `hosting` is `camstack-hf` (guard). */
11507
+ modifications: string().min(1).optional(),
11508
+ /** Who serves the file a node downloads. */
11509
+ hosting: _enum([
11510
+ "camstack-hf",
11511
+ "third-party",
11512
+ "built-in"
11513
+ ]).optional(),
11514
+ /** True when the weights or their data forbid commercial use. */
11515
+ nonCommercial: boolean().optional()
11516
+ }));
11475
11517
  var ModelCatalogEntrySchema = object({
11476
11518
  id: string(),
11477
11519
  name: string(),
@@ -11560,11 +11602,11 @@ var ModelCatalogEntrySchema = object({
11560
11602
  p95LatencyMs: record(string(), number()).optional()
11561
11603
  }).optional(),
11562
11604
  /**
11563
- * SPDX-ish license id of the model weights (e.g. `AGPL-3.0` for Ultralytics
11564
- * YOLO26, `GPL-3.0` for YOLOv9, `Apache-2.0` for D-FINE/RF-DETR). Matters for
11565
- * the retraining addon and any future commercial distribution.
11605
+ * The model's licence record — see {@link ModelLicenseSchema}. Optional in
11606
+ * the schema (a custom model's author may state none); REQUIRED and complete
11607
+ * on every built-in catalog entry (`scripts/check-catalog-licence.ts`).
11566
11608
  */
11567
- license: string().optional(),
11609
+ license: ModelLicenseSchema.optional(),
11568
11610
  /**
11569
11611
  * Variant-selector grouping. The UI groups models by `family` + `tier` and
11570
11612
  * offers `precision` / `optimization` as variant axes WITHIN a tier — so all
@@ -11659,23 +11701,6 @@ var ExpressionEvalError = class extends Error {
11659
11701
  this.name = "ExpressionEvalError";
11660
11702
  }
11661
11703
  };
11662
- /**
11663
- * Frozen, null-prototype builtin function table for the expression engine
11664
- * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
11665
- * parser rejects any callee not in it, and the evaluator gates each call on an
11666
- * own-property check against it.
11667
- *
11668
- * Because the object has a NULL prototype AND is `Object.freeze`d:
11669
- * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
11670
- * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
11671
- * (there is no `Object.prototype` in the chain), so those names are not
11672
- * callable — they are simply "unknown function" at parse time.
11673
- *
11674
- * Every numeric argument is validated as a finite number and every numeric
11675
- * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
11676
- * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
11677
- * closed rather than emitting a garbage value.
11678
- */
11679
11704
  function asFiniteNumber(value, name, index) {
11680
11705
  if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
11681
11706
  return value;
@@ -11691,6 +11716,10 @@ function finiteResult(value, name) {
11691
11716
  function allFiniteNumbers(args, name) {
11692
11717
  return args.map((a, idx) => asFiniteNumber(a, name, idx));
11693
11718
  }
11719
+ function asBoolean$1(value, name, index) {
11720
+ if (typeof value !== "boolean") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a boolean`);
11721
+ return value;
11722
+ }
11694
11723
  var INF = Number.POSITIVE_INFINITY;
11695
11724
  var table = {
11696
11725
  min: {
@@ -11791,6 +11820,40 @@ var table = {
11791
11820
  if (from === to) return x;
11792
11821
  throw new ExpressionEvalError("convert: unit conversion table not installed");
11793
11822
  }
11823
+ },
11824
+ any: {
11825
+ minArgs: 1,
11826
+ maxArgs: INF,
11827
+ apply: (args) => args.map((a, i) => asBoolean$1(a, "any", i)).some((b) => b)
11828
+ },
11829
+ all: {
11830
+ minArgs: 1,
11831
+ maxArgs: INF,
11832
+ apply: (args) => args.map((a, i) => asBoolean$1(a, "all", i)).every((b) => b)
11833
+ },
11834
+ within: {
11835
+ minArgs: 2,
11836
+ maxArgs: 2,
11837
+ apply: (args, hooks) => {
11838
+ const windowMs = asFiniteNumber(args[1], "within", 1);
11839
+ if (windowMs < 0) throw new ExpressionEvalError("within: the window must not be negative");
11840
+ const at = args[0];
11841
+ if (at === null) return false;
11842
+ const ts = asFiniteNumber(at, "within", 0);
11843
+ const now = hooks.now;
11844
+ if (now === void 0 || !Number.isFinite(now)) throw new ExpressionEvalError("within: no clock was supplied to this evaluation");
11845
+ const inside = now - ts <= windowMs;
11846
+ if (inside) hooks.noteDeadline?.(ts + windowMs + 1);
11847
+ return inside;
11848
+ }
11849
+ },
11850
+ latest: {
11851
+ minArgs: 1,
11852
+ maxArgs: INF,
11853
+ apply: (args) => {
11854
+ const present = args.flatMap((a, i) => a === null ? [] : [asFiniteNumber(a, "latest", i)]);
11855
+ return present.length === 0 ? null : finiteResult(Math.max(...present), "latest");
11856
+ }
11794
11857
  }
11795
11858
  };
11796
11859
  Object.freeze(Object.assign(Object.create(null), table));
@@ -12405,7 +12468,7 @@ var AutomationActionSchema = discriminatedUnion("kind", [
12405
12468
  code: string().min(1).max(2e4)
12406
12469
  })
12407
12470
  ]);
12408
- object({
12471
+ var AutomationRecipeSchema = object({
12409
12472
  triggers: array(AutomationTriggerSchema),
12410
12473
  conditions: AutomationConditionSchema.optional(),
12411
12474
  actions: array(AutomationActionSchema)
@@ -14928,6 +14991,195 @@ var cameraStreamsCapability = {
14928
14991
  */
14929
14992
  durability: "session"
14930
14993
  };
14994
+ /** A composed device's stableId is this prefix plus the block id. */
14995
+ var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
14996
+ /** Longest snippet a `code` source may carry (slice 4). */
14997
+ var MAX_COMPOSITION_CODE_LENGTH = 2e4;
14998
+ var CompositionSourceRefSchema = object({
14999
+ /** The owning addon; `stableId` is unique only within it. */
15000
+ addonId: string().min(1),
15001
+ stableId: string().min(1)
15002
+ });
15003
+ /** One field of one capability of one source device. */
15004
+ var CompositionFieldReadSchema = object({
15005
+ source: CompositionSourceRefSchema,
15006
+ cap: string().min(1),
15007
+ /** Dotted path into the source cap's runtime-state slice. */
15008
+ fieldPath: string().min(1)
15009
+ });
15010
+ /** `from`: copy one source field verbatim. It is also an expression's `from` binding. */
15011
+ var CompositionFromSourceSchema = CompositionFieldReadSchema.extend({ kind: literal("from") });
15012
+ var CompositionBindingSchema = discriminatedUnion("kind", [CompositionFromSourceSchema, object({
15013
+ kind: literal("literal"),
15014
+ value: union([
15015
+ string(),
15016
+ number(),
15017
+ boolean(),
15018
+ _null()
15019
+ ])
15020
+ })]);
15021
+ /**
15022
+ * `expression`: a formula over named bindings, in the salvaged expression
15023
+ * engine. Validated at parse by the SAME function every other consumer runs,
15024
+ * so the editor and the store cannot disagree.
15025
+ */
15026
+ var CompositionExpressionSourceSchema = object({
15027
+ kind: literal("expression"),
15028
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
15029
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), CompositionBindingSchema)
15030
+ }).superRefine((src, ctx) => {
15031
+ const err = validateExpressionSource(src);
15032
+ if (err !== null) ctx.addIssue({
15033
+ code: "custom",
15034
+ message: err,
15035
+ path: ["expr"]
15036
+ });
15037
+ });
15038
+ /** `code`: RESERVED for slice 4 (own runner, one-way eject). */
15039
+ var CompositionCodeSourceSchema = object({
15040
+ kind: literal("code"),
15041
+ code: string().min(1).max(MAX_COMPOSITION_CODE_LENGTH)
15042
+ });
15043
+ var CompositionFieldSourceSchema = discriminatedUnion("kind", [
15044
+ CompositionFromSourceSchema,
15045
+ CompositionExpressionSourceSchema,
15046
+ CompositionCodeSourceSchema
15047
+ ]);
15048
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [object({
15049
+ kind: literal("forward"),
15050
+ source: CompositionSourceRefSchema,
15051
+ cap: string().min(1),
15052
+ method: string().min(1)
15053
+ }), CompositionCodeSourceSchema]);
15054
+ var CompositionFeatureSchema = discriminatedUnion("kind", [object({
15055
+ kind: literal("fields"),
15056
+ cap: string().min(1),
15057
+ fields: record(string().min(1), CompositionFieldSourceSchema).refine((fields) => Object.keys(fields).length <= 32, { message: `at most 32 fields per capability` }),
15058
+ /** RESERVED for slice 3; refused by the validator when non-empty. */
15059
+ commands: record(string().min(1), CompositionCommandTargetSchema).optional()
15060
+ }), object({
15061
+ kind: literal("passthrough"),
15062
+ cap: string().min(1),
15063
+ source: CompositionSourceRefSchema
15064
+ })]);
15065
+ var CompositionSchema = object({
15066
+ target: discriminatedUnion("kind", [object({
15067
+ kind: literal("new"),
15068
+ type: _enum(DeviceType),
15069
+ role: _enum(DeviceRole).optional()
15070
+ }), object({
15071
+ kind: literal("existing"),
15072
+ device: CompositionSourceRefSchema
15073
+ })]),
15074
+ features: array(CompositionFeatureSchema).min(1).max(16)
15075
+ }).superRefine((composition, ctx) => {
15076
+ const seen = /* @__PURE__ */ new Set();
15077
+ composition.features.forEach((feature, index) => {
15078
+ if (seen.has(feature.cap)) ctx.addIssue({
15079
+ code: "custom",
15080
+ message: `capability \`${feature.cap}\` is composed twice — one feature per capability`,
15081
+ path: [
15082
+ "features",
15083
+ index,
15084
+ "cap"
15085
+ ]
15086
+ });
15087
+ seen.add(feature.cap);
15088
+ });
15089
+ });
15090
+ /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.celsius`. */
15091
+ var CompositionProblemSchema = object({
15092
+ code: _enum([
15093
+ "reserved-variant",
15094
+ "unknown-capability",
15095
+ "not-composable",
15096
+ "wrong-device-type",
15097
+ "has-commands",
15098
+ "unknown-field",
15099
+ "nested-field",
15100
+ "missing-field",
15101
+ "kind-mismatch",
15102
+ "may-be-null",
15103
+ "source-missing",
15104
+ "source-unreadable",
15105
+ "source-capability-missing",
15106
+ "source-field-unknown",
15107
+ "expression-invalid",
15108
+ "cycle",
15109
+ "duplicate-target"
15110
+ ]),
15111
+ path: string(),
15112
+ message: string()
15113
+ });
15114
+ var CompositionFieldKindSchema = _enum([
15115
+ "string",
15116
+ "number",
15117
+ "boolean",
15118
+ "enum"
15119
+ ]);
15120
+ /** How a field says "unavailable": `null` when its schema allows it, else the device goes offline (D393). */
15121
+ var CompositionUnavailableModeSchema = _enum(["null", "offline"]);
15122
+ /**
15123
+ * `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
15124
+ * field of its cap changes value · `constant` reads nothing, computed once.
15125
+ */
15126
+ var CompositionFieldRoleSchema = _enum([
15127
+ "derived",
15128
+ "clock",
15129
+ "constant"
15130
+ ]);
15131
+ var CompositionFieldPlanSchema = object({
15132
+ cap: string(),
15133
+ path: string(),
15134
+ /** Index into `composition.features` this field's capability came from —
15135
+ * lets a source/cycle problem name its path as `features[N].fields.<path>`
15136
+ * (the same convention `planComposition`'s own problems already use). */
15137
+ featureIndex: number().int().nonnegative(),
15138
+ kind: CompositionFieldKindSchema,
15139
+ nullable: boolean(),
15140
+ required: boolean(),
15141
+ unavailable: CompositionUnavailableModeSchema,
15142
+ role: CompositionFieldRoleSchema,
15143
+ source: CompositionFieldSourceSchema,
15144
+ reads: array(CompositionFieldReadSchema)
15145
+ });
15146
+ var CompositionValidationSchema = object({
15147
+ ok: boolean(),
15148
+ problems: array(CompositionProblemSchema),
15149
+ fields: array(CompositionFieldPlanSchema)
15150
+ });
15151
+ /** Mirrors `CoreBlockStatus`, pinned by `core-blocks-source.spec.ts` (Task 11). */
15152
+ var CompositionRunStatusSchema = _enum([
15153
+ "stopped",
15154
+ "starting",
15155
+ "running",
15156
+ "failed"
15157
+ ]);
15158
+ var CompositionFieldStateKindSchema = _enum([
15159
+ "fresh",
15160
+ "stale",
15161
+ "unavailable"
15162
+ ]);
15163
+ var CompositionFieldStateSchema = object({
15164
+ cap: string(),
15165
+ path: string(),
15166
+ state: CompositionFieldStateKindSchema,
15167
+ /** `null` whenever `state === 'unavailable'`; never a plausible stand-in (D393). */
15168
+ value: union([
15169
+ string(),
15170
+ number(),
15171
+ boolean(),
15172
+ _null()
15173
+ ]),
15174
+ reason: string().optional()
15175
+ });
15176
+ var CompositionBlockStateSchema = object({
15177
+ blockId: string(),
15178
+ deviceId: number().nullable(),
15179
+ status: CompositionRunStatusSchema,
15180
+ reason: string().optional(),
15181
+ fields: array(CompositionFieldStateSchema)
15182
+ });
14931
15183
  /** Where a block runs. The operator chooses — a block driving a device on an
14932
15184
  * agent is the reason placement is not fixed to the hub. */
14933
15185
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -14954,6 +15206,30 @@ var CoreBlockInputSchema = object({
14954
15206
  */
14955
15207
  integrationId: string().optional()
14956
15208
  });
15209
+ /**
15210
+ * What a block IS (D659). Absent means `code` — every row stored before this
15211
+ * union keeps working unchanged.
15212
+ * - `code`: the TypeScript in `code`, compiled and run in its own runner;
15213
+ * - `recipe`: RESERVED (automations), stored shape only; refused at run by name;
15214
+ * - `composition`: declarative, run by the shared `composer`; `code` is `''`.
15215
+ */
15216
+ var CoreBlockSourceSchema = discriminatedUnion("kind", [
15217
+ object({ kind: literal("code") }),
15218
+ object({
15219
+ kind: literal("recipe"),
15220
+ recipe: AutomationRecipeSchema
15221
+ }),
15222
+ object({
15223
+ kind: literal("composition"),
15224
+ composition: CompositionSchema
15225
+ })
15226
+ ]);
15227
+ /** The client-authored half of a composition block. No `code`, no placement (hub-only; Phase 7). */
15228
+ var CompositionBlockInputSchema = object({
15229
+ name: string().min(1).max(120),
15230
+ enabled: boolean(),
15231
+ composition: CompositionSchema
15232
+ });
14957
15233
  /** A stored block. */
14958
15234
  var CoreBlockSchema = CoreBlockInputSchema.extend({
14959
15235
  id: string(),
@@ -14969,8 +15245,38 @@ var CoreBlockSchema = CoreBlockInputSchema.extend({
14969
15245
  */
14970
15246
  lastError: string().optional(),
14971
15247
  /** Ms epoch of the last state change. */
14972
- lastChangedAt: number()
15248
+ lastChangedAt: number(),
15249
+ /** What the block is. Absent means `code` (D659). */
15250
+ source: CoreBlockSourceSchema.optional()
15251
+ });
15252
+ /** A stored composition block and what the composer says about it. */
15253
+ var CompositionViewSchema = object({
15254
+ block: CoreBlockSchema,
15255
+ state: discriminatedUnion("kind", [object({
15256
+ kind: literal("answered"),
15257
+ state: CompositionBlockStateSchema.nullable()
15258
+ }), object({
15259
+ kind: literal("unreachable"),
15260
+ error: string()
15261
+ })])
15262
+ });
15263
+ /**
15264
+ * A read of the stored compositions. `not-loaded` while the `core_blocks`
15265
+ * table has not been READ: an empty answer then would make "not yet known"
15266
+ * look like "none", and invite the operator to recreate what exists (D315).
15267
+ */
15268
+ var CompositionsNotLoadedSchema = object({
15269
+ state: literal("not-loaded"),
15270
+ reason: string()
14973
15271
  });
15272
+ var CompositionListReadSchema = discriminatedUnion("state", [object({
15273
+ state: literal("loaded"),
15274
+ views: array(CompositionViewSchema)
15275
+ }), CompositionsNotLoadedSchema]);
15276
+ var CompositionGetReadSchema = discriminatedUnion("state", [object({
15277
+ state: literal("loaded"),
15278
+ view: CompositionViewSchema.nullable()
15279
+ }), CompositionsNotLoadedSchema]);
14974
15280
  /** What a compile attempt produced. */
14975
15281
  var CoreBlockCompileResultSchema = object({
14976
15282
  ok: boolean(),
@@ -15008,7 +15314,72 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15008
15314
  }), method(object({}), object({ libs: array(object({
15009
15315
  filePath: string(),
15010
15316
  content: string()
15011
- })) }), { auth: "admin" });
15317
+ })) }), { auth: "admin" }), method(object({ block: CompositionBlockInputSchema }), object({ block: CoreBlockSchema }), {
15318
+ kind: "mutation",
15319
+ auth: "admin",
15320
+ caller: "required"
15321
+ }), method(object({
15322
+ blockId: string(),
15323
+ expectedUpdatedAt: number(),
15324
+ block: CompositionBlockInputSchema.partial()
15325
+ }), object({ block: CoreBlockSchema }), {
15326
+ kind: "mutation",
15327
+ auth: "admin",
15328
+ caller: "required"
15329
+ }), method(object({ blockId: string() }), CompositionGetReadSchema, { auth: "admin" }), method(object({}), CompositionListReadSchema, { auth: "admin" }), method(object({
15330
+ composition: CompositionSchema,
15331
+ blockId: string().optional()
15332
+ }), CompositionValidationSchema, {
15333
+ kind: "mutation",
15334
+ auth: "admin",
15335
+ access: "view"
15336
+ });
15337
+ var ComposerBlockSchema = object({
15338
+ id: string().min(1),
15339
+ name: string().min(1).max(120),
15340
+ enabled: boolean(),
15341
+ updatedAt: number(),
15342
+ composition: CompositionSchema
15343
+ });
15344
+ /**
15345
+ * A stored composition row that no longer PARSES — a schema a release
15346
+ * tightened, a row written by a newer build. Sent by id so the composer keeps
15347
+ * its device as a placeholder and reports the block `failed` naming the parse
15348
+ * error. Leaving it out would read, twice, exactly like a delete (D49).
15349
+ */
15350
+ var ComposerUnreadableBlockSchema = object({
15351
+ id: string().min(1),
15352
+ /** The row's stored name column; null when even that is unreadable (the device keeps the name it has). */
15353
+ name: string().nullable(),
15354
+ /** The parse error, in the operator's words. */
15355
+ error: string()
15356
+ });
15357
+ method(object({
15358
+ /** The shared Blocks integration; null until `core-blocks` has reconciled it. */
15359
+ integrationId: string().nullable(),
15360
+ /** False when the `core_blocks` read failed: then nothing may be withdrawn (D49). */
15361
+ storeLoaded: boolean(),
15362
+ blocks: array(ComposerBlockSchema),
15363
+ /** Operator restarts: rebuild these runtimes and re-resolve their sources. Stores nothing (D62). */
15364
+ restartBlockIds: array(string()),
15365
+ /** Composition rows that exist but do not parse: held, never withdrawn, reported failed. */
15366
+ unreadableBlocks: array(ComposerUnreadableBlockSchema)
15367
+ }), object({
15368
+ blocks: array(object({
15369
+ blockId: string(),
15370
+ status: CompositionRunStatusSchema,
15371
+ reason: string().optional()
15372
+ })),
15373
+ /**
15374
+ * False when the composer declared and withdrew NOTHING (store not loaded,
15375
+ * integration unknown, its own rows unread or read empty once). An empty
15376
+ * apply the caller owes is paid off only by one the composer acted on (D49).
15377
+ */
15378
+ acted: boolean()
15379
+ }), {
15380
+ kind: "mutation",
15381
+ auth: "admin"
15382
+ }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
15012
15383
  /**
15013
15384
  * `custom-model-registry` — collection cap exposing operator-registered
15014
15385
  * custom detection models. Each provider (today: `addon-model-studio`)
@@ -21181,8 +21552,8 @@ var NcTestResultSchema = object({
21181
21552
  className: string().optional(),
21182
21553
  label: string().optional()
21183
21554
  });
21184
- /** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is the
21185
- * same union; the template-vars spec pins the two together. `mixed` is DERIVED
21555
+ /** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is
21556
+ * `z.infer` of this schema — one shape, no twin. `mixed` is DERIVED
21186
21557
  * (a stored system rule whose kinds span families, D637) and never authored. */
21187
21558
  var NcRuleKindSchema = _enum([
21188
21559
  "detection",
@@ -38796,6 +39167,38 @@ DeviceType.Camera, method(object({
38796
39167
  detection: array(ZoneRuleSchema).readonly(),
38797
39168
  package: array(ZoneRuleSchema).readonly()
38798
39169
  });
39170
+ var NUMBER = {
39171
+ kind: "fixed",
39172
+ result: ["number"]
39173
+ };
39174
+ var BOOLEAN = {
39175
+ kind: "fixed",
39176
+ result: ["boolean"]
39177
+ };
39178
+ Object.freeze({
39179
+ min: NUMBER,
39180
+ max: NUMBER,
39181
+ abs: NUMBER,
39182
+ floor: NUMBER,
39183
+ ceil: NUMBER,
39184
+ sqrt: NUMBER,
39185
+ round: NUMBER,
39186
+ pow: NUMBER,
39187
+ clamp: NUMBER,
39188
+ avg: NUMBER,
39189
+ sum: NUMBER,
39190
+ age: NUMBER,
39191
+ convert: NUMBER,
39192
+ coalesce: { kind: "coalesce" },
39193
+ any: BOOLEAN,
39194
+ all: BOOLEAN,
39195
+ within: BOOLEAN,
39196
+ latest: {
39197
+ kind: "fixed",
39198
+ result: ["number", "null"]
39199
+ }
39200
+ });
39201
+ `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
38799
39202
  var HF_BASE_URL = `https://huggingface.co/camstack/camstack-models/resolve/main`;
38800
39203
  /**
38801
39204
  * Accessory device helpers — shared across drivers.
@@ -41123,6 +41526,18 @@ Object.freeze({
41123
41526
  addonId: null,
41124
41527
  access: "create"
41125
41528
  },
41529
+ "composer.applyBlocks": {
41530
+ capName: "composer",
41531
+ capScope: "system",
41532
+ addonId: null,
41533
+ access: "create"
41534
+ },
41535
+ "composer.getStates": {
41536
+ capName: "composer",
41537
+ capScope: "system",
41538
+ addonId: null,
41539
+ access: "view"
41540
+ },
41126
41541
  "connectionTest.describeTest": {
41127
41542
  capName: "connection-test",
41128
41543
  capScope: "system",
@@ -41183,6 +41598,12 @@ Object.freeze({
41183
41598
  addonId: null,
41184
41599
  access: "create"
41185
41600
  },
41601
+ "coreBlocks.createComposition": {
41602
+ capName: "core-blocks",
41603
+ capScope: "system",
41604
+ addonId: null,
41605
+ access: "create"
41606
+ },
41186
41607
  "coreBlocks.delete": {
41187
41608
  capName: "core-blocks",
41188
41609
  capScope: "system",
@@ -41195,6 +41616,12 @@ Object.freeze({
41195
41616
  addonId: null,
41196
41617
  access: "view"
41197
41618
  },
41619
+ "coreBlocks.getComposition": {
41620
+ capName: "core-blocks",
41621
+ capScope: "system",
41622
+ addonId: null,
41623
+ access: "view"
41624
+ },
41198
41625
  "coreBlocks.getTypeDefs": {
41199
41626
  capName: "core-blocks",
41200
41627
  capScope: "system",
@@ -41207,6 +41634,12 @@ Object.freeze({
41207
41634
  addonId: null,
41208
41635
  access: "view"
41209
41636
  },
41637
+ "coreBlocks.listCompositions": {
41638
+ capName: "core-blocks",
41639
+ capScope: "system",
41640
+ addonId: null,
41641
+ access: "view"
41642
+ },
41210
41643
  "coreBlocks.restart": {
41211
41644
  capName: "core-blocks",
41212
41645
  capScope: "system",
@@ -41225,6 +41658,18 @@ Object.freeze({
41225
41658
  addonId: null,
41226
41659
  access: "create"
41227
41660
  },
41661
+ "coreBlocks.updateComposition": {
41662
+ capName: "core-blocks",
41663
+ capScope: "system",
41664
+ addonId: null,
41665
+ access: "create"
41666
+ },
41667
+ "coreBlocks.validateComposition": {
41668
+ capName: "core-blocks",
41669
+ capScope: "system",
41670
+ addonId: null,
41671
+ access: "view"
41672
+ },
41228
41673
  "cover.close": {
41229
41674
  capName: "cover",
41230
41675
  capScope: "device",