@camstack/addon-ai 0.4.124 → 0.4.126

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.mjs CHANGED
@@ -5551,7 +5551,7 @@ function number(params) {
5551
5551
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
5552
5552
  }
5553
5553
  //#endregion
5554
- //#region ../types/dist/sleep-BaRu0bS5.mjs
5554
+ //#region ../types/dist/sleep-DC-wdyeS.mjs
5555
5555
  /**
5556
5556
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5557
5557
  * window to float samples (D455).
@@ -6336,6 +6336,40 @@ var BaseAddon = class {
6336
6336
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6337
6337
  return keys.size > 0 ? projectStore(raw, keys, node) : raw;
6338
6338
  }
6339
+ /**
6340
+ * Whether ONE global key of this addon's store was written, read three-way
6341
+ * (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
6342
+ * reports `value ?? default`, so "the operator chose the default" and "nobody
6343
+ * chose" look the same, and a failed read looks like both. A `perNode` key is
6344
+ * not supported here: its stored name is scoped.
6345
+ */
6346
+ async readStoredGlobalKey(key) {
6347
+ const read = this._ctx?.settings?.readAddonStoreResult;
6348
+ if (read === void 0) return {
6349
+ kind: "unreadable",
6350
+ reason: "three-way-read-unavailable"
6351
+ };
6352
+ let result;
6353
+ try {
6354
+ result = await read.call(this._ctx?.settings);
6355
+ } catch (err) {
6356
+ return {
6357
+ kind: "unreadable",
6358
+ reason: "store-read-failed",
6359
+ error: err instanceof Error ? err.message : String(err)
6360
+ };
6361
+ }
6362
+ if (result.kind === "failed") return {
6363
+ kind: "unreadable",
6364
+ reason: "store-read-failed",
6365
+ error: result.error
6366
+ };
6367
+ if (result.kind === "missing" || !Object.prototype.hasOwnProperty.call(result.value, key)) return { kind: "absent" };
6368
+ return {
6369
+ kind: "present",
6370
+ value: result.value[key]
6371
+ };
6372
+ }
6339
6373
  async updateGlobalSettings(patch, nodeId) {
6340
6374
  const keys = this.perNodeKeys();
6341
6375
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
@@ -9637,6 +9671,43 @@ var LogChannelWindowSchema = object({
9637
9671
  /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9638
9672
  deviceIds: array(number$1().int()).readonly().nullable()
9639
9673
  });
9674
+ var ClipModelMetaSchema = object({
9675
+ /** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
9676
+ textModelId: string().min(1),
9677
+ /** Output dimension of BOTH towers. A vector of any other length is refused. */
9678
+ embeddingDim: number$1().int().positive(),
9679
+ /**
9680
+ * The `vector-store` index this model's vectors live in. ONE feature space
9681
+ * per index: two models share an index only when their vectors are ranked
9682
+ * against each other, which for CLIP means never across families. MobileCLIP
9683
+ * S1 and S2 share `object-clip` for history (separated by the row's
9684
+ * `modelId`); any other model gets its own.
9685
+ */
9686
+ vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
9687
+ /**
9688
+ * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
9689
+ * must be unique per tokenizer: every model's siblings land in ONE flat
9690
+ * models directory, so two different tokenizers under the same name would
9691
+ * silently overwrite each other (whichever model downloaded last wins, and
9692
+ * the other one tokenises with the wrong vocabulary).
9693
+ */
9694
+ tokenizerFile: string().min(1),
9695
+ /** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
9696
+ contextLength: number$1().int().positive(),
9697
+ /** Id the tokenizer pads with. */
9698
+ padId: number$1().int().nonnegative(),
9699
+ /**
9700
+ * The search cosine floor at `strictness: 'loose'` — calibrated per model,
9701
+ * because cosine bands are a property of the model: 0.2 keeps 96% of matched
9702
+ * COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
9703
+ */
9704
+ searchMinScore: number$1().min(0).max(1)
9705
+ });
9706
+ var ClipSearchStrictnessSchema = _enum([
9707
+ "loose",
9708
+ "balanced",
9709
+ "strict"
9710
+ ]);
9640
9711
  var MODEL_FORMATS = [
9641
9712
  "onnx",
9642
9713
  "coreml",
@@ -9726,6 +9797,48 @@ var ModelProviderIdSchema = _enum([
9726
9797
  "scrypted",
9727
9798
  "custom"
9728
9799
  ]);
9800
+ /**
9801
+ * The licence of a model, as a record rather than a bare SPDX string: a
9802
+ * permissive CODE licence routinely sits on top of restrictive WEIGHTS or
9803
+ * DATA, and the obligations (attribution, modification notices, source offers)
9804
+ * are per upstream. A persisted custom-model row written when this field was a
9805
+ * string still parses — the string is lifted into `{ weights }`.
9806
+ *
9807
+ * Every licence surface (the admin "Models and licenses" page,
9808
+ * `THIRD_PARTY_MODELS.md`, the Hugging Face model table) is GENERATED from
9809
+ * these records by `scripts/gen-model-licenses.ts` (D661).
9810
+ */
9811
+ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { weights: value } : value, object({
9812
+ /** SPDX id of the WEIGHTS' terms, a `LicenseRef-*` for non-SPDX terms, or `UNKNOWN`. */
9813
+ weights: string().min(1),
9814
+ /** SPDX id of the upstream code that defines / trained the network. */
9815
+ code: string().min(1).optional(),
9816
+ /** Training data whose terms add obligations (attribution, non-commercial). */
9817
+ data: object({
9818
+ name: string().min(1),
9819
+ terms: string().min(1),
9820
+ url: string().url().optional()
9821
+ }).optional(),
9822
+ /** The project the weights come from. Required on built-in entries (guard). */
9823
+ upstream: object({
9824
+ name: string().min(1),
9825
+ url: string().url()
9826
+ }).optional(),
9827
+ /** Where the licence text governing the weights is published. */
9828
+ url: string().url().optional(),
9829
+ /** Attribution the licence REQUIRES, verbatim. */
9830
+ attribution: string().min(1).optional(),
9831
+ /** What CamStack changed. Required when `hosting` is `camstack-hf` (guard). */
9832
+ modifications: string().min(1).optional(),
9833
+ /** Who serves the file a node downloads. */
9834
+ hosting: _enum([
9835
+ "camstack-hf",
9836
+ "third-party",
9837
+ "built-in"
9838
+ ]).optional(),
9839
+ /** True when the weights or their data forbid commercial use. */
9840
+ nonCommercial: boolean().optional()
9841
+ }));
9729
9842
  var ModelCatalogEntrySchema = object({
9730
9843
  id: string(),
9731
9844
  name: string(),
@@ -9814,11 +9927,11 @@ var ModelCatalogEntrySchema = object({
9814
9927
  p95LatencyMs: record(string(), number$1()).optional()
9815
9928
  }).optional(),
9816
9929
  /**
9817
- * SPDX-ish license id of the model weights (e.g. `AGPL-3.0` for Ultralytics
9818
- * YOLO26, `GPL-3.0` for YOLOv9, `Apache-2.0` for D-FINE/RF-DETR). Matters for
9819
- * the retraining addon and any future commercial distribution.
9930
+ * The model's licence record — see {@link ModelLicenseSchema}. Optional in
9931
+ * the schema (a custom model's author may state none); REQUIRED and complete
9932
+ * on every built-in catalog entry (`scripts/check-catalog-licence.ts`).
9820
9933
  */
9821
- license: string().optional(),
9934
+ license: ModelLicenseSchema.optional(),
9822
9935
  /**
9823
9936
  * Variant-selector grouping. The UI groups models by `family` + `tier` and
9824
9937
  * offers `precision` / `optimization` as variant axes WITHIN a tier — so all
@@ -9840,7 +9953,14 @@ var ModelCatalogEntrySchema = object({
9840
9953
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
9841
9954
  * labels already ARE the CamStack macros (Scrypted identity map).
9842
9955
  */
9843
- classMap: DetectionCatalogClassMapSchema.optional()
9956
+ classMap: DetectionCatalogClassMapSchema.optional(),
9957
+ /**
9958
+ * The model's CLIP feature-space contract (text encoder, dimension, vector
9959
+ * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
9960
+ * CLIP image encoder; its absence is what "not a CLIP model" means to the
9961
+ * embedding encoder and the semantic-search store (D649).
9962
+ */
9963
+ clip: ClipModelMetaSchema.optional()
9844
9964
  });
9845
9965
  var ConvertTargetSchema = discriminatedUnion("format", [object({
9846
9966
  format: literal("openvino"),
@@ -11120,12 +11240,32 @@ var AudioClassificationLabelSchema = object({
11120
11240
  originalClass: string().optional(),
11121
11241
  score: number$1()
11122
11242
  });
11243
+ /**
11244
+ * Did the classifier RUN on this window? (D660)
11245
+ *
11246
+ * `classified` with no labels means the model heard nothing above the
11247
+ * camera's floor. `not-classified` means nobody listened — and until D660 the
11248
+ * two were the same shape (`classification` absent), so a window the global
11249
+ * busy gate threw away read downstream exactly like a quiet one (D393).
11250
+ */
11251
+ var AudioClassifyOutcomeSchema = discriminatedUnion("state", [object({ state: literal("classified") }), object({
11252
+ state: literal("not-classified"),
11253
+ reason: _enum([
11254
+ "superseded",
11255
+ "error",
11256
+ "timeout",
11257
+ "disposed"
11258
+ ])
11259
+ })]);
11123
11260
  var AudioAnalysisResultSchema = object({
11124
11261
  level: AudioLevelSchema,
11262
+ /** Labels at or above the camera's floor. Absent = none — read `classifyOutcome` to know whether the model ran at all. */
11125
11263
  classification: object({
11126
11264
  labels: array(AudioClassificationLabelSchema).readonly(),
11127
11265
  inferenceMs: number$1()
11128
11266
  }).optional(),
11267
+ /** Whether the classifier ran on this window (D660). */
11268
+ classifyOutcome: AudioClassifyOutcomeSchema,
11129
11269
  timestamp: number$1()
11130
11270
  });
11131
11271
  var AudioAnalysisSettingsSchema = object({
@@ -14058,6 +14198,27 @@ var LinkedDeviceSchema = object({
14058
14198
  features: array(string()),
14059
14199
  producesTrackedEvents: boolean().optional()
14060
14200
  });
14201
+ /**
14202
+ * The `linked-devices` extension slot's editable value (D648): the operator's
14203
+ * pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
14204
+ * in it — they are always linked and are not a pick.
14205
+ *
14206
+ * `trackedDeviceIds` (D655) is the tracked-event opt-in, exactly what
14207
+ * `_linkedDeviceTrackedIds` persists: which linked devices materialize a
14208
+ * synthetic tracked event on the camera. A read always carries it AS STORED
14209
+ * (an absent key reads as `[]`, which is what the resolver makes of it —
14210
+ * NONE). On a write it is optional: absent leaves the opt-in untouched, so a
14211
+ * card built before D655 cannot erase it by saving the pick list. A present
14212
+ * list REPLACES the opt-in; each id must be a pick, a device the camera links
14213
+ * by structure (the row's `impliedSources`: tree children, a picked
14214
+ * container's child) or already stored — so what was read can always be
14215
+ * written back unchanged, and a NEW opt-in outside the linked set is refused.
14216
+ */
14217
+ var LinkedDevicesSlotValueSchema = object({
14218
+ deviceIds: array(number$1().int().positive()),
14219
+ trackedDeviceIds: array(number$1().int().positive()).optional()
14220
+ });
14221
+ DeviceType.Camera;
14061
14222
  /** One camera's resolved linked set, tagged with the camera it belongs to.
14062
14223
  * The batch answer needs the tag; the single-device answer already has it
14063
14224
  * from the input, which is why `getLinkedDevices` keeps the untagged shape. */
@@ -14583,16 +14744,101 @@ var EmbeddingResultSchema = object({
14583
14744
  embedding: array(number$1()),
14584
14745
  inferenceMs: number$1()
14585
14746
  });
14747
+ /** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
14748
+ var EmbeddingTowerSchema = _enum(["image", "text"]);
14749
+ /**
14750
+ * A tower in the terminal `failed` state (D649, D6): it crashed or failed to
14751
+ * load `crashes` times within `windowMs`, and is refused by name until an
14752
+ * operator `resetFailedModels` or a model change — never on a timer.
14753
+ *
14754
+ * `nodeId` is the node whose tower failed. The state lives in THAT node's
14755
+ * encoder process (in memory — a runner respawn clears it), and one node's
14756
+ * answer says nothing about another's.
14757
+ */
14758
+ var EmbeddingFailedModelSchema = object({
14759
+ modelId: string(),
14760
+ tower: EmbeddingTowerSchema,
14761
+ nodeId: string(),
14762
+ crashes: number$1(),
14763
+ windowMs: number$1(),
14764
+ sinceMs: number$1(),
14765
+ lastReason: string()
14766
+ });
14767
+ /**
14768
+ * A model whose REQUIREMENTS can never be met on this node (D649 round 5):
14769
+ * an id the catalog does not know, a model URL answering 404/410, a declared
14770
+ * sibling (the tokenizer) that is not there. After `attempts` failed builds
14771
+ * it is terminally `requirements-failed`, refused by name until an operator
14772
+ * `resetFailedModels` or a model change — the same exits as a crashed tower.
14773
+ */
14774
+ var EmbeddingFailedRequirementSchema = object({
14775
+ modelId: string(),
14776
+ tower: EmbeddingTowerSchema,
14777
+ nodeId: string(),
14778
+ attempts: number$1(),
14779
+ sinceMs: number$1(),
14780
+ lastReason: string()
14781
+ });
14586
14782
  var EmbeddingInfoSchema = object({
14587
14783
  modelId: string(),
14588
14784
  embeddingDim: number$1(),
14589
- ready: boolean()
14590
- });
14785
+ ready: boolean(),
14786
+ /**
14787
+ * The node that answered. Absent only from an encoder older than D649's
14788
+ * crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
14789
+ */
14790
+ nodeId: string().optional(),
14791
+ /**
14792
+ * Towers in `failed` on the answering node, each row naming it. `undefined`
14793
+ * means the node could not say (pre-budget encoder); a node that has the
14794
+ * budget always answers an array, empty included.
14795
+ */
14796
+ failedModels: array(EmbeddingFailedModelSchema).optional(),
14797
+ /** Models terminally `requirements-failed` on the answering node; same reading as above. */
14798
+ failedRequirements: array(EmbeddingFailedRequirementSchema).optional()
14799
+ });
14800
+ /**
14801
+ * The THREE codes an encoder refusal can carry (D649, D6). Same shape as
14802
+ * `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
14803
+ * Error's own properties do not survive the UDS/tRPC hop and its message does,
14804
+ * and both sides go through the helpers below — the encoder builds the
14805
+ * refusal, the live detail plane classifies on it to count refusals per
14806
+ * camera instead of logging one warning per track. The bracketed token
14807
+ * carries the code, the model, the tower and the node so a consumer never
14808
+ * parses prose.
14809
+ *
14810
+ * - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
14811
+ * budget — terminal until `resetFailedModels` or a model change.
14812
+ * - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
14813
+ * (a download or Python that failed, or the cooldown after one) — the next
14814
+ * request past the cooldown tries again.
14815
+ * - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
14816
+ * id, 404/410, missing sibling) and the bounded attempts are spent —
14817
+ * terminal, same exits as a crashed tower.
14818
+ */
14819
+ var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
14820
+ var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
14821
+ var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
14822
+ _enum([
14823
+ EMBEDDING_MODEL_FAILED,
14824
+ EMBEDDING_REQUIREMENTS_UNAVAILABLE,
14825
+ EMBEDDING_REQUIREMENTS_FAILED
14826
+ ]);
14827
+ new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
14591
14828
  method(object({
14592
14829
  crop: _instanceof(Uint8Array),
14593
14830
  width: number$1(),
14594
14831
  height: number$1()
14595
- }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
14832
+ }), EmbeddingResultSchema, { auth: "admin" }), method(object({
14833
+ text: string(),
14834
+ modelId: string().min(1).optional()
14835
+ }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" }), method(object({ modelId: string().min(1).optional() }), object({
14836
+ cleared: array(string()),
14837
+ nodeId: string()
14838
+ }), {
14839
+ kind: "mutation",
14840
+ auth: "admin"
14841
+ });
14596
14842
  /**
14597
14843
  * `failure-contribution` — the capability an addon reports its OWN losses
14598
14844
  * through, per camera, with the denominator attached. It stores nothing.
@@ -18106,7 +18352,12 @@ var NcMediaPolicySchema = object({
18106
18352
  * the degrade engine, which drops the video and keeps the still.
18107
18353
  */
18108
18354
  clip: boolean().optional(),
18109
- /** Seconds of footage BEFORE / AFTER the event instant. Defaults 3 / 7. */
18355
+ /**
18356
+ * Seconds of footage BEFORE / AFTER the event instant. Absent =
18357
+ * {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
18358
+ * (4 / 6), resolved by the Notification Center at dispatch — deliberately not
18359
+ * a Zod default, so a rule that never chose keeps following the hub's.
18360
+ */
18110
18361
  clipPreRollSec: number$1().int().min(0).max(30).optional(),
18111
18362
  clipPostRollSec: number$1().int().min(0).max(30).optional(),
18112
18363
  /**
@@ -19484,6 +19735,130 @@ var OauthIntegrationDescriptorSchema = object({
19484
19735
  });
19485
19736
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
19486
19737
  /**
19738
+ * A model choice has a SCOPE, and a scope change has a workflow.
19739
+ *
19740
+ * ## The two scopes
19741
+ *
19742
+ * Almost every pipeline step's model is a **node** question: which build runs
19743
+ * fastest on THIS accelerator. Two nodes may legitimately answer differently —
19744
+ * a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
19745
+ * are compared against nothing. They produce boxes, and a box is a box.
19746
+ *
19747
+ * Two steps are not like that. `face-embedding` and `clip-embedding` produce
19748
+ * **vectors that land in ONE shared index** (`identity_samples`,
19749
+ * `vec_object_clip`) and are ranked against each other by cosine similarity.
19750
+ * Cosine similarity between two encoders is not a weak signal, it is a
19751
+ * meaningless number — and nothing inside a vector can tell you it happened.
19752
+ * So for those two steps the model is a **cluster** question with exactly one
19753
+ * answer, stored in exactly one row.
19754
+ *
19755
+ * That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
19756
+ * for the crop convention (`detail-crop.ts`), one level up: the crop decides
19757
+ * WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
19758
+ * cluster-wide for the same reason and neither may become per-node.
19759
+ *
19760
+ * ## Why the registry lives here and not in the step catalog
19761
+ *
19762
+ * The scope itself is declared on the step, in
19763
+ * `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
19764
+ * — that is where a new step declares what kind of choice its model is. But the
19765
+ * catalog lives inside `addon-pipeline`, and three packages that must NOT
19766
+ * import an addon need to know the set: the orchestrator (which renders and
19767
+ * stores the row), post-analysis (which pins the row for a re-embed pass) and
19768
+ * admin-ui (which mirrors it). So the set is mirrored here, and
19769
+ * `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
19770
+ * A hand-copied key that stops matching is exactly how a setting silently stops
19771
+ * arriving while both sides still look correct.
19772
+ *
19773
+ * ## The defaults ARE today's behaviour
19774
+ *
19775
+ * {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
19776
+ * of both steps. Declaring the scope therefore changes nothing on the day it
19777
+ * ships: the cluster row starts out saying what every node was already doing.
19778
+ * Changing it is legitimate — that is what the knob is for — but it invalidates
19779
+ * the stored vectors of that surface, and must be followed by a re-embed pass
19780
+ * (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
19781
+ */
19782
+ /**
19783
+ * Why the orchestrator cannot say which model the operator chose for a
19784
+ * cluster-scoped step (D651).
19785
+ */
19786
+ var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
19787
+ "owner-not-ready",
19788
+ "store-read-failed",
19789
+ "three-way-read-unavailable",
19790
+ "invalid-stored",
19791
+ "not-cluster-scoped"
19792
+ ];
19793
+ Object.freeze(Object.fromEntries([{
19794
+ stepId: "face-embedding",
19795
+ label: "Face recognition model",
19796
+ defaultModelId: "auraface-r100",
19797
+ indexName: "the enrolled face gallery",
19798
+ options: [
19799
+ {
19800
+ id: "auraface-r100",
19801
+ label: "AuraFace R100"
19802
+ },
19803
+ {
19804
+ id: "arcface-r100",
19805
+ label: "ArcFace (ResNet34)"
19806
+ },
19807
+ {
19808
+ id: "inception-resnet-v1",
19809
+ label: "Inception ResNet V1"
19810
+ }
19811
+ ]
19812
+ }, {
19813
+ stepId: "clip-embedding",
19814
+ label: "Semantic search model",
19815
+ defaultModelId: "mobileclip-s1",
19816
+ indexName: "the object semantic-search index",
19817
+ options: [
19818
+ {
19819
+ id: "mobileclip-s1",
19820
+ label: "MobileCLIP S1"
19821
+ },
19822
+ {
19823
+ id: "mobileclip-s2",
19824
+ label: "MobileCLIP S2"
19825
+ },
19826
+ {
19827
+ id: "siglip2-b16-224",
19828
+ label: "SigLIP2 B/16 (Apache-2.0)"
19829
+ }
19830
+ ]
19831
+ }].map((s) => [s.stepId, s.defaultModelId])));
19832
+ var CLUSTER_STEP_SETTING_FIELDS = [{
19833
+ stepId: "face-embedding",
19834
+ key: "minLandmarkFaceSize",
19835
+ label: "Min face size for recognition (detection px)",
19836
+ description: "Refuse to embed a face smaller than this IN THE DETECTION FRAME. Applies to every node — the enrolled gallery is one index, and two admission floors would fill it from two policies. 0 disables the gate.",
19837
+ type: "slider",
19838
+ min: 0,
19839
+ max: 64,
19840
+ step: 2,
19841
+ default: 24
19842
+ }];
19843
+ function clusterStepSettingKey(stepId, fieldKey) {
19844
+ return `clusterStepSetting:${stepId}:${fieldKey}`;
19845
+ }
19846
+ var ClusterSettingNumberSchema = number$1().finite();
19847
+ function readClusterStepSettings(config) {
19848
+ const out = {};
19849
+ for (const field of CLUSTER_STEP_SETTING_FIELDS) {
19850
+ const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
19851
+ const value = parsed.success ? parsed.data : field.default;
19852
+ const existing = out[field.stepId] ?? {};
19853
+ out[field.stepId] = {
19854
+ ...existing,
19855
+ [field.key]: value
19856
+ };
19857
+ }
19858
+ return out;
19859
+ }
19860
+ readClusterStepSettings({});
19861
+ /**
19487
19862
  * pipeline-analytics — device-scoped wrapper cap. Refines raw
19488
19863
  * per-frame detections emitted by the pipeline runner into tracked
19489
19864
  * objects, per-kind event collections (motion / object / audio), and
@@ -20281,6 +20656,13 @@ var AudioEventSchema = object({
20281
20656
  originalClass: string().optional(),
20282
20657
  score: number$1()
20283
20658
  }).optional(),
20659
+ /**
20660
+ * Whether the classifier RAN on the window behind this row (D660). Absent
20661
+ * on rows written before D660 — unknown, NOT classified: until then a
20662
+ * window the analyzer's busy gate threw away was stored exactly like one
20663
+ * that heard nothing above the floor.
20664
+ */
20665
+ classifyOutcome: AudioClassifyOutcomeSchema.optional(),
20284
20666
  /** Populated by B5 (recording playback URL for this event). */
20285
20667
  mediaUrl: string().optional()
20286
20668
  });
@@ -20299,7 +20681,8 @@ var MediaFileKindEnum = _enum([
20299
20681
  "thumbnailSmall",
20300
20682
  "confirmationCrop",
20301
20683
  "debugCrop",
20302
- "sceneFrame"
20684
+ "sceneFrame",
20685
+ "lastSceneFrame"
20303
20686
  ]);
20304
20687
  /**
20305
20688
  * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
@@ -20851,7 +21234,23 @@ var SearchObjectEventsInput = object({
20851
21234
  until: number$1().optional(),
20852
21235
  classFilter: string().optional(),
20853
21236
  limit: number$1().default(50),
20854
- minScore: number$1().min(0).max(1).default(.2)
21237
+ /**
21238
+ * An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
21239
+ * model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
21240
+ * so an absent one resolves to the searched model's own `searchMinScore`
21241
+ * scaled by `strictness`. A number sent here is honoured verbatim.
21242
+ */
21243
+ minScore: number$1().min(0).max(1).optional(),
21244
+ /** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
21245
+ strictness: ClipSearchStrictnessSchema.optional(),
21246
+ /**
21247
+ * Search THIS CLIP model's index instead of the cluster row's. Every index a
21248
+ * model ever wrote stays searchable until it is wiped (the MobileCLIP index
21249
+ * through a SigLIP2 cutover and its rollback window). An id with no CLIP
21250
+ * metadata is refused; an id other than the cluster row's is ADMIN-only
21251
+ * (`model-override-requires-admin`).
21252
+ */
21253
+ modelId: string().min(1).optional()
20855
21254
  });
20856
21255
  var TrackCascadeCountsSchema = object({
20857
21256
  /** Persisted track roots deleted (authoritative). */
@@ -20986,7 +21385,41 @@ var RebuildObjectEmbeddingsInput = object({
20986
21385
  * comparable, so wiping and rebuilding is the only way to be sure every vector
20987
21386
  * means the same thing.
20988
21387
  */
20989
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number$1() });
21388
+ var WipeObjectEmbeddingsResultSchema = object({
21389
+ deleted: number$1(),
21390
+ /**
21391
+ * CLIP indexes that could NOT be emptied (unreachable, or refused at their
21392
+ * dimension) — not a clean slate. Additive and optional (D649).
21393
+ */
21394
+ failedIndexes: array(string()).optional()
21395
+ });
21396
+ /**
21397
+ * Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
21398
+ * of a pass (D649 over D651). A bare `started: false` read the same for "the
21399
+ * stores are booting" and "the cluster row names a model with no CLIP
21400
+ * metadata", which need different fixes.
21401
+ * - `stores-unavailable` — the analytics stores or the API are not up yet.
21402
+ * - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
21403
+ * a pass that rewrites an index needs two agreeing reads of the OWNER's
21404
+ * answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
21405
+ * name its model does not run (D54):
21406
+ * - the owner's own `unreadable` reasons (`owner-not-ready`,
21407
+ * `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
21408
+ * `not-cluster-scoped`);
21409
+ * - `method-unavailable` — the orchestrator predates the method;
21410
+ * - `read-failed` — the call failed or answered something unparseable;
21411
+ * - `reads-disagree` — the two reads named different choices.
21412
+ * - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
21413
+ * index to fill and no dimension to check against (D649).
21414
+ */
21415
+ var RebuildObjectEmbeddingsRefusalSchema = _enum([
21416
+ "stores-unavailable",
21417
+ ...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
21418
+ "method-unavailable",
21419
+ "read-failed",
21420
+ "reads-disagree",
21421
+ "not-a-clip-model"
21422
+ ]);
20990
21423
  /**
20991
21424
  * Acknowledgement that a rebuild STARTED.
20992
21425
  *
@@ -20999,7 +21432,12 @@ var WipeObjectEmbeddingsResultSchema = object({ deleted: number$1() });
20999
21432
  var RebuildObjectEmbeddingsResultSchema = object({
21000
21433
  started: boolean(),
21001
21434
  /** True when a pass was already running; the new request is ignored. */
21002
- alreadyRunning: boolean()
21435
+ alreadyRunning: boolean(),
21436
+ /** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
21437
+ refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
21438
+ /** The CLIP model the pass pinned, and the index it fills (when it started). */
21439
+ modelId: string().optional(),
21440
+ index: string().optional()
21003
21441
  });
21004
21442
  var RebuildStatusSchema = object({
21005
21443
  running: boolean(),
@@ -21033,7 +21471,11 @@ var RebuildStatusSchema = object({
21033
21471
  startedAtMs: number$1().nullable(),
21034
21472
  finishedAtMs: number$1().nullable(),
21035
21473
  /** Present when the pass ended by throwing. */
21036
- error: string().nullable()
21474
+ error: string().nullable(),
21475
+ /** The CLIP model the current / last pass pinned (D54), `null` before any. */
21476
+ modelId: string().nullable(),
21477
+ /** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
21478
+ index: string().nullable()
21037
21479
  });
21038
21480
  /**
21039
21481
  * Acknowledgement that a debug-media reclaim STARTED.
@@ -21354,7 +21796,7 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
21354
21796
  deviceId: number$1(),
21355
21797
  ownerKind: MediaPresenceOwnerKindSchema,
21356
21798
  ownerIds: array(string()).max(5e3)
21357
- }), array(string()).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
21799
+ }), array(string()).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly(), { caller: "required" }), method(object({}), WipeObjectEmbeddingsResultSchema, {
21358
21800
  kind: "mutation",
21359
21801
  auth: "admin"
21360
21802
  }), method(RebuildObjectEmbeddingsInput, RebuildObjectEmbeddingsResultSchema, {
@@ -21812,7 +22254,14 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
21812
22254
  height: number$1()
21813
22255
  }), { kind: "mutation" }), method(object({
21814
22256
  stepId: string(),
21815
- frameId: number$1().int()
22257
+ frameId: number$1().int(),
22258
+ /**
22259
+ * The model to time — REQUIRED (D658). Without it the pool answered the
22260
+ * step's ACTIVE variant (the first loaded after boot), so a benchmark
22261
+ * of model B silently timed model A. Callers pass the `rootModelId`
22262
+ * their warmup `runPipeline` reported: the model that actually ran.
22263
+ */
22264
+ modelId: string().min(1)
21816
22265
  }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number$1().int() }), _void(), { kind: "mutation" }), method(object({ deviceKey: string().optional() }), EffectiveTuningSchema), method(_void(), array(object({
21817
22266
  engineKey: string(),
21818
22267
  engine: PipelineEngineChoiceSchema,
@@ -22389,6 +22838,17 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
22389
22838
  hubHostnameOverride: string().optional()
22390
22839
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
22391
22840
  /**
22841
+ * What ONE step runs with on ONE roster device for THIS camera (D650): the
22842
+ * device's per-(node,device) base with the camera's override for that device
22843
+ * on top — the same `override ?? base` merge the orchestrator applies to the
22844
+ * elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
22845
+ * resolves the device format's default, exactly as on the elected device.
22846
+ */
22847
+ var RunnerJumpStepProvisioningSchema = object({
22848
+ modelId: string().optional(),
22849
+ settings: record(string(), unknown()).optional()
22850
+ });
22851
+ /**
22392
22852
  * One ENABLED inference device on the runner's node, as the step-tree
22393
22853
  * device-jump resolver sees it (phase 1). The orchestrator populates this
22394
22854
  * roster on the attach payload whenever the camera is elected onto a specific
@@ -22400,7 +22860,16 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
22400
22860
  var RunnerInferenceDeviceSchema = object({
22401
22861
  deviceKey: string(),
22402
22862
  weight: number$1().positive().default(1),
22403
- maxSessions: number$1().int().positive().nullable().default(null)
22863
+ maxSessions: number$1().int().positive().nullable().default(null),
22864
+ /**
22865
+ * Per-step provisioning for this camera on THIS device (D650), keyed by step
22866
+ * id. A step the runner jumps here runs with these fields, never with the
22867
+ * elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
22868
+ * (a step absent from the map runs with neither — the target format default).
22869
+ * Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
22870
+ * the elected device's provisioning, as before.
22871
+ */
22872
+ steps: record(string(), RunnerJumpStepProvisioningSchema).optional()
22404
22873
  });
22405
22874
  /**
22406
22875
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
@@ -23275,6 +23744,28 @@ var NodeInferenceDeviceSchema = object({
23275
23744
  */
23276
23745
  exclusion: InferenceDeviceExclusionReasonSchema.nullable()
23277
23746
  });
23747
+ /**
23748
+ * The operator's model choice for one cluster-scoped step, answered by the
23749
+ * addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
23750
+ * folded: a written choice, a key nobody wrote (the cluster runs the default
23751
+ * BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
23752
+ * first two, read twice and agreeing.
23753
+ */
23754
+ var ClusterModelChoiceSchema = discriminatedUnion("kind", [
23755
+ object({
23756
+ kind: literal("stored"),
23757
+ modelId: string()
23758
+ }),
23759
+ object({
23760
+ kind: literal("absent"),
23761
+ defaultModelId: string()
23762
+ }),
23763
+ object({
23764
+ kind: literal("unreadable"),
23765
+ reason: _enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
23766
+ error: string().optional()
23767
+ })
23768
+ ]);
23278
23769
  var NodeInferenceDevicesSchema = object({
23279
23770
  nodeId: string(),
23280
23771
  /** False when the node's platform-probe was unreachable (no live device set). */
@@ -23302,10 +23793,17 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
23302
23793
  }), object({ success: literal(true) }), {
23303
23794
  kind: "mutation",
23304
23795
  auth: "admin"
23305
- }), method(object({ deviceId: number$1() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number$1() }), {
23796
+ }), method(object({ deviceId: number$1() }), object({ deviceKey: string().nullable() })), method(_void(), object({
23797
+ migrated: number$1(),
23798
+ skipped: array(object({
23799
+ deviceId: number$1(),
23800
+ targetNodeId: string(),
23801
+ reason: string()
23802
+ })).default([])
23803
+ }), {
23306
23804
  kind: "mutation",
23307
23805
  auth: "admin"
23308
- }), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number$1() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number$1() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
23806
+ }), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number$1() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(object({ stepId: string() }), ClusterModelChoiceSchema), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number$1() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
23309
23807
  nodeId: string(),
23310
23808
  capName: string(),
23311
23809
  addonId: string()
@@ -25605,6 +26103,177 @@ DeviceType.Camera, method(object({
25605
26103
  auth: "protected"
25606
26104
  });
25607
26105
  /**
26106
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
26107
+ * valutatore puro del suo FRONTE.
26108
+ *
26109
+ * Viveva dentro il builtin virtual-doorbell
26110
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
26111
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
26112
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
26113
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
26114
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
26115
+ * SPOSTA qui e il doorbell la ri-esporta.
26116
+ *
26117
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
26118
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
26119
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
26120
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
26121
+ */
26122
+ /**
26123
+ * Known binary / switch source caps → the boolean slice field whose
26124
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
26125
+ * Sensors whose "active" reading is not a plain boolean (presence's string
26126
+ * state, connectivity's connected flag) are deliberately excluded — a
26127
+ * reconnect is not a doorbell press, and it is not a recording either.
26128
+ */
26129
+ var SOURCE_CAP_ACTIVE_FIELD = {
26130
+ contact: "entryOpen",
26131
+ binary: "on",
26132
+ switch: "on",
26133
+ motion: "detected",
26134
+ flood: "flooded",
26135
+ gas: "detected",
26136
+ smoke: "detected",
26137
+ "carbon-monoxide": "detected",
26138
+ vibration: "detected",
26139
+ tamper: "tampered"
26140
+ };
26141
+ object({
26142
+ /** Ms epoch of the last press. null = never observed since this provider started. */
26143
+ lastPressedAt: number$1().nullable(),
26144
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
26145
+ pressCountSinceStart: number$1()
26146
+ });
26147
+ object({
26148
+ deviceId: number$1(),
26149
+ timestamp: number$1()
26150
+ });
26151
+ /**
26152
+ * The `doorbell-source` extension slot's editable value (D648): the camera's
26153
+ * virtual-doorbell trigger devices, exactly what the wrapper's
26154
+ * `doorbellSources` persists (as `{ deviceId }` records).
26155
+ */
26156
+ var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number$1().int().positive()) });
26157
+ DeviceType.Camera;
26158
+ DeviceType.Button, DeviceType.Camera;
26159
+ var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
26160
+ DeviceType.Camera, DeviceType.Camera;
26161
+ /** A slot's editable value, discriminated on `slot`. */
26162
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
26163
+ DeviceType.Camera;
26164
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
26165
+ state: literal("unreachable"),
26166
+ reason: string()
26167
+ })]);
26168
+ /** One provider of slots — the D554 source-listing row. */
26169
+ var ExtensionSourceSchema = object({
26170
+ /** The routing prefix of every `slotRef` this provider serves. */
26171
+ source: string(),
26172
+ label: string(),
26173
+ /** Stamped by the dispatcher from the registry (D557). */
26174
+ addonId: string().optional(),
26175
+ availability: ExtensionSourceAvailabilitySchema
26176
+ });
26177
+ /**
26178
+ * How one picked source stands. `missing` — no such device (deleted, or an id
26179
+ * that never existed); `foreign` — a device the slot's owner cannot read from
26180
+ * (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
26181
+ * valid source now (a container, which is never a pick). A source in any of
26182
+ * these states is SHOWN, never silently dropped or re-pointed.
26183
+ */
26184
+ var ExtensionSourceHealthSchema = _enum([
26185
+ "ok",
26186
+ "missing",
26187
+ "foreign",
26188
+ "unavailable"
26189
+ ]);
26190
+ var ExtensionSlotSourceSchema = object({
26191
+ deviceId: number$1().int(),
26192
+ /** The device's name, or null when it could not be resolved (`missing`). */
26193
+ name: string().nullable(),
26194
+ health: ExtensionSourceHealthSchema,
26195
+ detail: string().optional()
26196
+ });
26197
+ /**
26198
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
26199
+ * reported read-only, named, never written through this contract (D62). The
26200
+ * virtual doorbell's sources ring only while the wrapper is bound to the
26201
+ * camera, and that binding belongs to `deviceManager.setWrapperActive`.
26202
+ * `unknown` means the gate could not be read; it is not "inactive" (D315).
26203
+ */
26204
+ var ExtensionSlotActivationSchema = object({
26205
+ state: _enum([
26206
+ "active",
26207
+ "inactive",
26208
+ "unknown"
26209
+ ]),
26210
+ authority: string(),
26211
+ detail: string().optional()
26212
+ });
26213
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
26214
+ state: literal("ok"),
26215
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
26216
+ slotRef: string(),
26217
+ slot: ExtensionSlotIdSchema,
26218
+ /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
26219
+ authority: string(),
26220
+ /** graft: its switch. association: null — removing every source is "off". */
26221
+ enabled: boolean().nullable(),
26222
+ /** graft: the cap registered on the host. association: null. */
26223
+ projects: string().nullable(),
26224
+ activation: ExtensionSlotActivationSchema.nullable(),
26225
+ value: ExtensionSlotValueSchema,
26226
+ sources: array(ExtensionSlotSourceSchema),
26227
+ /**
26228
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
26229
+ * are therefore not in `value` (D655): a camera's device-tree children, and
26230
+ * the child a picked container stands for (D356 — a container is never a
26231
+ * pick, its children are). Read-only; the editor shows them and may offer
26232
+ * per-device options on them (the linked-devices tracked-event opt-in).
26233
+ * Absent when the owner links nothing beyond the picks, and from an owner
26234
+ * older than D655.
26235
+ */
26236
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
26237
+ }), object({
26238
+ state: literal("unreachable"),
26239
+ addonId: string(),
26240
+ reason: string()
26241
+ })]);
26242
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
26243
+ deviceId: number$1().int(),
26244
+ name: string(),
26245
+ type: string(),
26246
+ location: string().nullable(),
26247
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
26248
+ parentName: string().nullable(),
26249
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
26250
+ suggested: boolean(),
26251
+ /** Why it is suggested ("same location"), null when it is not. */
26252
+ reason: string().nullable()
26253
+ })) });
26254
+ /**
26255
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
26256
+ * reloaded the host (or, for an accessory child, its parent) because the
26257
+ * write changed what the host REGISTERS (a graft switched on or off, slice 2).
26258
+ */
26259
+ var ExtensionSetResultSchema = object({
26260
+ applied: literal(true),
26261
+ reload: _enum([
26262
+ "none",
26263
+ "host",
26264
+ "parent"
26265
+ ])
26266
+ });
26267
+ var ExtensionSlotRefInputSchema = object({
26268
+ deviceId: number$1().int(),
26269
+ slotRef: string().min(1)
26270
+ });
26271
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
26272
+ method(object({ deviceId: number$1().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number$1().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
26273
+ kind: "mutation",
26274
+ auth: "admin"
26275
+ });
26276
+ /**
25608
26277
  * Optional client-side hints sent at session creation to help the provider
25609
26278
  * pick the best native source. All fields optional — a viewer that knows
25610
26279
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -27393,17 +28062,6 @@ object({
27393
28062
  deviceId: number$1(),
27394
28063
  status: DeviceStatusSchema
27395
28064
  });
27396
- object({
27397
- /** Ms epoch of the last press. null = never observed since this provider started. */
27398
- lastPressedAt: number$1().nullable(),
27399
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
27400
- pressCountSinceStart: number$1()
27401
- });
27402
- object({
27403
- deviceId: number$1(),
27404
- timestamp: number$1()
27405
- });
27406
- DeviceType.Button, DeviceType.Camera;
27407
28065
  /**
27408
28066
  * Enum-state sensor — a string value picked from a finite option set.
27409
28067
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
@@ -34170,42 +34828,6 @@ DeviceType.Camera, method(object({
34170
34828
  package: array(ZoneRuleSchema).readonly()
34171
34829
  });
34172
34830
  /**
34173
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
34174
- * valutatore puro del suo FRONTE.
34175
- *
34176
- * Viveva dentro il builtin virtual-doorbell
34177
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
34178
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
34179
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
34180
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
34181
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
34182
- * SPOSTA qui e il doorbell la ri-esporta.
34183
- *
34184
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
34185
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
34186
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
34187
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
34188
- */
34189
- /**
34190
- * Known binary / switch source caps → the boolean slice field whose
34191
- * false→true rise counts as ACTIVE. Every entry is "fire on active".
34192
- * Sensors whose "active" reading is not a plain boolean (presence's string
34193
- * state, connectivity's connected flag) are deliberately excluded — a
34194
- * reconnect is not a doorbell press, and it is not a recording either.
34195
- */
34196
- var SOURCE_CAP_ACTIVE_FIELD = {
34197
- contact: "entryOpen",
34198
- binary: "on",
34199
- switch: "on",
34200
- motion: "detected",
34201
- flood: "flooded",
34202
- gas: "detected",
34203
- smoke: "detected",
34204
- "carbon-monoxide": "detected",
34205
- vibration: "detected",
34206
- tamper: "tampered"
34207
- };
34208
- /**
34209
34831
  * Accessory device helpers — shared across drivers.
34210
34832
  *
34211
34833
  * Many vendor-specific drivers register accessory child devices on
@@ -37005,6 +37627,30 @@ Object.freeze({
37005
37627
  addonId: null,
37006
37628
  access: "create"
37007
37629
  },
37630
+ "deviceExtension.listCandidates": {
37631
+ capName: "device-extension",
37632
+ capScope: "device",
37633
+ addonId: null,
37634
+ access: "view"
37635
+ },
37636
+ "deviceExtension.listSlots": {
37637
+ capName: "device-extension",
37638
+ capScope: "device",
37639
+ addonId: null,
37640
+ access: "view"
37641
+ },
37642
+ "deviceExtension.listSources": {
37643
+ capName: "device-extension",
37644
+ capScope: "device",
37645
+ addonId: null,
37646
+ access: "view"
37647
+ },
37648
+ "deviceExtension.setSlot": {
37649
+ capName: "device-extension",
37650
+ capScope: "device",
37651
+ addonId: null,
37652
+ access: "create"
37653
+ },
37008
37654
  "deviceManager.addLocation": {
37009
37655
  capName: "device-manager",
37010
37656
  capScope: "system",
@@ -37077,12 +37723,6 @@ Object.freeze({
37077
37723
  addonId: null,
37078
37724
  access: "create"
37079
37725
  },
37080
- "deviceManager.applyDeviceSettingsPatch": {
37081
- capName: "device-manager",
37082
- capScope: "system",
37083
- addonId: null,
37084
- access: "create"
37085
- },
37086
37726
  "deviceManager.applyInitialMeta": {
37087
37727
  capName: "device-manager",
37088
37728
  capScope: "system",
@@ -37185,12 +37825,6 @@ Object.freeze({
37185
37825
  addonId: null,
37186
37826
  access: "view"
37187
37827
  },
37188
- "deviceManager.getDeviceLiveContribution": {
37189
- capName: "device-manager",
37190
- capScope: "system",
37191
- addonId: null,
37192
- access: "view"
37193
- },
37194
37828
  "deviceManager.getDeviceLiveInfoAggregate": {
37195
37829
  capName: "device-manager",
37196
37830
  capScope: "system",
@@ -37203,12 +37837,6 @@ Object.freeze({
37203
37837
  addonId: null,
37204
37838
  access: "view"
37205
37839
  },
37206
- "deviceManager.getDeviceSettingsContribution": {
37207
- capName: "device-manager",
37208
- capScope: "system",
37209
- addonId: null,
37210
- access: "view"
37211
- },
37212
37840
  "deviceManager.getDeviceStatusAggregate": {
37213
37841
  capName: "device-manager",
37214
37842
  capScope: "system",
@@ -37713,24 +38341,6 @@ Object.freeze({
37713
38341
  addonId: null,
37714
38342
  access: "view"
37715
38343
  },
37716
- "doorbell.applyDeviceSettingsPatch": {
37717
- capName: "doorbell",
37718
- capScope: "device",
37719
- addonId: null,
37720
- access: "create"
37721
- },
37722
- "doorbell.getDeviceLiveContribution": {
37723
- capName: "doorbell",
37724
- capScope: "device",
37725
- addonId: null,
37726
- access: "view"
37727
- },
37728
- "doorbell.getDeviceSettingsContribution": {
37729
- capName: "doorbell",
37730
- capScope: "device",
37731
- addonId: null,
37732
- access: "view"
37733
- },
37734
38344
  "doorbell.getStatus": {
37735
38345
  capName: "doorbell",
37736
38346
  capScope: "device",
@@ -37755,6 +38365,12 @@ Object.freeze({
37755
38365
  addonId: null,
37756
38366
  access: "view"
37757
38367
  },
38368
+ "embeddingEncoder.resetFailedModels": {
38369
+ capName: "embedding-encoder",
38370
+ capScope: "system",
38371
+ addonId: null,
38372
+ access: "delete"
38373
+ },
37758
38374
  "enumSensor.getStatus": {
37759
38375
  capName: "enum-sensor",
37760
38376
  capScope: "device",
@@ -40089,6 +40705,12 @@ Object.freeze({
40089
40705
  addonId: null,
40090
40706
  access: "view"
40091
40707
  },
40708
+ "pipelineOrchestrator.getClusterModelChoice": {
40709
+ capName: "pipeline-orchestrator",
40710
+ capScope: "system",
40711
+ addonId: null,
40712
+ access: "view"
40713
+ },
40092
40714
  "pipelineOrchestrator.getDeviceLiveContribution": {
40093
40715
  capName: "pipeline-orchestrator",
40094
40716
  capScope: "system",
@@ -42914,6 +43536,26 @@ Object.freeze({
42914
43536
  form: "single",
42915
43537
  optional: false
42916
43538
  }],
43539
+ "deviceExtension.listCandidates": [{
43540
+ name: "deviceId",
43541
+ form: "single",
43542
+ optional: false
43543
+ }],
43544
+ "deviceExtension.listSlots": [{
43545
+ name: "deviceId",
43546
+ form: "single",
43547
+ optional: false
43548
+ }],
43549
+ "deviceExtension.listSources": [{
43550
+ name: "deviceId",
43551
+ form: "single",
43552
+ optional: false
43553
+ }],
43554
+ "deviceExtension.setSlot": [{
43555
+ name: "deviceId",
43556
+ form: "single",
43557
+ optional: false
43558
+ }],
42917
43559
  "deviceManager.adoptionRelease": [{
42918
43560
  name: "camDeviceId",
42919
43561
  form: "single",
@@ -45373,68 +46015,6 @@ TimelapseRuleInputSchema.extend({
45373
46015
  createdAt: number$1(),
45374
46016
  updatedAt: number$1()
45375
46017
  });
45376
- Object.freeze(Object.fromEntries([{
45377
- stepId: "face-embedding",
45378
- label: "Face recognition model",
45379
- defaultModelId: "arcface-r100",
45380
- indexName: "the enrolled face gallery",
45381
- options: [
45382
- {
45383
- id: "arcface-r100",
45384
- label: "ArcFace (ResNet34)"
45385
- },
45386
- {
45387
- id: "auraface-r100",
45388
- label: "AuraFace R100"
45389
- },
45390
- {
45391
- id: "inception-resnet-v1",
45392
- label: "Inception ResNet V1"
45393
- }
45394
- ]
45395
- }, {
45396
- stepId: "clip-embedding",
45397
- label: "Semantic search model",
45398
- defaultModelId: "mobileclip-s1",
45399
- indexName: "the object semantic-search index",
45400
- options: [{
45401
- id: "mobileclip-s1",
45402
- label: "MobileCLIP S1"
45403
- }, {
45404
- id: "mobileclip-s2",
45405
- label: "MobileCLIP S2"
45406
- }]
45407
- }].map((s) => [s.stepId, s.defaultModelId])));
45408
- string().min(1);
45409
- var CLUSTER_STEP_SETTING_FIELDS = [{
45410
- stepId: "face-embedding",
45411
- key: "minLandmarkFaceSize",
45412
- label: "Min face size for recognition (detection px)",
45413
- description: "Refuse to embed a face smaller than this IN THE DETECTION FRAME. Applies to every node — the enrolled gallery is one index, and two admission floors would fill it from two policies. 0 disables the gate.",
45414
- type: "slider",
45415
- min: 0,
45416
- max: 64,
45417
- step: 2,
45418
- default: 24
45419
- }];
45420
- function clusterStepSettingKey(stepId, fieldKey) {
45421
- return `clusterStepSetting:${stepId}:${fieldKey}`;
45422
- }
45423
- var ClusterSettingNumberSchema = number$1().finite();
45424
- function readClusterStepSettings(config) {
45425
- const out = {};
45426
- for (const field of CLUSTER_STEP_SETTING_FIELDS) {
45427
- const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
45428
- const value = parsed.success ? parsed.data : field.default;
45429
- const existing = out[field.stepId] ?? {};
45430
- out[field.stepId] = {
45431
- ...existing,
45432
- [field.key]: value
45433
- };
45434
- }
45435
- return out;
45436
- }
45437
- readClusterStepSettings({});
45438
46018
  object({
45439
46019
  /**
45440
46020
  * Fraction of the box's own size added on EACH side before cutting.
@@ -83327,6 +83907,53 @@ function createLlmProvider(deps) {
83327
83907
  };
83328
83908
  }
83329
83909
  //#endregion
83910
+ //#region src/runtime/llm-model-licenses.ts
83911
+ var QWEN_ATTRIBUTION = "Qwen models © Alibaba Cloud, Apache-2.0.";
83912
+ var QWEN_APACHE = {
83913
+ weights: "Apache-2.0",
83914
+ upstream: {
83915
+ name: "Qwen (Alibaba Cloud)",
83916
+ url: "https://huggingface.co/Qwen"
83917
+ },
83918
+ url: "https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct-GGUF",
83919
+ attribution: QWEN_ATTRIBUTION,
83920
+ modifications: "none (GGUF Q4_K_M published by Qwen; not re-hosted by CamStack)",
83921
+ hosting: "third-party"
83922
+ };
83923
+ var LLAMA_32_COMMUNITY = {
83924
+ weights: "LicenseRef-Llama-3.2-Community",
83925
+ upstream: {
83926
+ name: "Meta Llama 3.2 (GGUF by bartowski)",
83927
+ url: "https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF"
83928
+ },
83929
+ url: "https://github.com/meta-llama/llama-models/blob/main/models/llama3_2/LICENSE",
83930
+ attribution: "Built with Llama. Llama 3.2 is licensed under the Llama 3.2 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.",
83931
+ modifications: "Q4_K_M GGUF quantisation by bartowski (not re-hosted by CamStack)",
83932
+ hosting: "third-party"
83933
+ };
83934
+ var QWEN_VL_APACHE = {
83935
+ weights: "Apache-2.0",
83936
+ upstream: {
83937
+ name: "Qwen3-VL (GGUF by unsloth)",
83938
+ url: "https://huggingface.co/unsloth"
83939
+ },
83940
+ url: "https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct",
83941
+ attribution: QWEN_ATTRIBUTION,
83942
+ modifications: "Q4_K_M GGUF quantisation by unsloth (not re-hosted by CamStack)",
83943
+ hosting: "third-party"
83944
+ };
83945
+ var QWEN36_APACHE = {
83946
+ weights: "Apache-2.0",
83947
+ upstream: {
83948
+ name: "Qwen3.6-35B-A3B (GGUF by unsloth)",
83949
+ url: "https://huggingface.co/unsloth/Qwen3.6-35B-A3B-GGUF"
83950
+ },
83951
+ url: "https://huggingface.co/Qwen/Qwen3.6-35B-A3B/blob/main/LICENSE",
83952
+ attribution: QWEN_ATTRIBUTION,
83953
+ modifications: "UD-Q4_K_M GGUF quantisation by unsloth (not re-hosted by CamStack)",
83954
+ hosting: "third-party"
83955
+ };
83956
+ //#endregion
83330
83957
  //#region src/runtime/llm-model-catalog.ts
83331
83958
  /**
83332
83959
  * Curated managed-model catalog (operator decision #4). Each entry carries BOTH
@@ -83357,7 +83984,7 @@ var GIB = 1024 * 1024 * 1024;
83357
83984
  function mb(bytes) {
83358
83985
  return Math.round(bytes / (1024 * 1024));
83359
83986
  }
83360
- function textEntry(meta) {
83987
+ function textEntry(meta, license) {
83361
83988
  return {
83362
83989
  meta,
83363
83990
  entry: {
@@ -83372,7 +83999,8 @@ function textEntry(meta) {
83372
83999
  width: 0,
83373
84000
  height: 0
83374
84001
  },
83375
- labels: []
84002
+ labels: [],
84003
+ license
83376
84004
  }
83377
84005
  };
83378
84006
  }
@@ -83387,7 +84015,7 @@ var QWEN = textEntry({
83387
84015
  quantization: "Q4_K_M",
83388
84016
  minRamBytes: 2 * GIB,
83389
84017
  contextSizeDefault: 4096
83390
- });
84018
+ }, QWEN_APACHE);
83391
84019
  var LLAMA = textEntry({
83392
84020
  id: "llm-llama3.2-3b-instruct-q4",
83393
84021
  label: "Llama 3.2 3B Instruct",
@@ -83399,7 +84027,7 @@ var LLAMA = textEntry({
83399
84027
  quantization: "Q4_K_M",
83400
84028
  minRamBytes: Math.round(3.5 * GIB),
83401
84029
  contextSizeDefault: 4096
83402
- });
84030
+ }, LLAMA_32_COMMUNITY);
83403
84031
  var QWEN3VL2B_MODEL_BYTES = 1107410624;
83404
84032
  var QWEN3VL2B_MMPROJ_BYTES = 819395232;
83405
84033
  var QWEN3VL2B_BASE = "https://huggingface.co/unsloth/Qwen3-VL-2B-Instruct-GGUF/resolve/main";
@@ -83428,6 +84056,7 @@ var QWEN3VL_2B = {
83428
84056
  },
83429
84057
  entry: {
83430
84058
  id: "llm-qwen3-vl-2b-instruct-q4",
84059
+ license: QWEN_VL_APACHE,
83431
84060
  name: "Qwen3-VL 2B Instruct (vision, light)",
83432
84061
  description: "qwen3-vl · Q4_K_M · +mmproj",
83433
84062
  formats: { gguf: {
@@ -83482,6 +84111,7 @@ var QWEN3VL_4B = {
83482
84111
  },
83483
84112
  entry: {
83484
84113
  id: "llm-qwen3-vl-4b-instruct-q4",
84114
+ license: QWEN_VL_APACHE,
83485
84115
  name: "Qwen3-VL 4B Instruct (vision)",
83486
84116
  description: "qwen3-vl · Q4_K_M · +mmproj",
83487
84117
  formats: { gguf: {
@@ -83533,6 +84163,7 @@ var QWEN3VL_8B = {
83533
84163
  },
83534
84164
  entry: {
83535
84165
  id: "llm-qwen3-vl-8b-instruct-q4",
84166
+ license: QWEN_VL_APACHE,
83536
84167
  name: "Qwen3-VL 8B Instruct (vision)",
83537
84168
  description: "qwen3-vl · Q4_K_M · +mmproj",
83538
84169
  formats: { gguf: {
@@ -83578,6 +84209,7 @@ var LLM_MODEL_CATALOG = [
83578
84209
  },
83579
84210
  entry: {
83580
84211
  id: "llm-qwen3.6-35b-a3b-ud-q4",
84212
+ license: QWEN36_APACHE,
83581
84213
  name: "Qwen3.6 35B-A3B (vision)",
83582
84214
  description: "qwen3.6 · UD-Q4_K_M · +mmproj",
83583
84215
  formats: { gguf: {