@camstack/addon-osd-manager 0.1.140 → 0.1.142

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 (19) hide show
  1. package/dist/{MotionZonesSettings-C80efbgF.mjs → MotionZonesSettings-CLoGx9rM.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-CvVdYFwr.mjs → PrivacyMaskSettings-BZiL6_bt.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-CkIz3-13.mjs → SceneMonitorEditor-C4XOkOxm.mjs} +3 -3
  4. package/dist/_stub.js +29 -29
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-DaUqGaKC.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BA2LcfhK.mjs} +3 -3
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CWTKCd56.mjs +26 -0
  7. package/dist/addon-osd-manager.css +1 -1
  8. package/dist/{hostInit-Bkk-9STE.mjs → hostInit-BXqW88VO.mjs} +2 -2
  9. package/dist/index.js +840 -227
  10. package/dist/index.mjs +840 -227
  11. package/dist/{player-overlays-CbLYEs-S.mjs → player-overlays-QdIhVJJ9.mjs} +1 -1
  12. package/dist/remoteEntry.js +1 -1
  13. package/dist/{responsive-BghmipTp.mjs → responsive-BaAG2IvP.mjs} +1 -1
  14. package/dist/{scene-monitor-copy-Cpz17vjT.mjs → scene-monitor-copy-DViLoo13.mjs} +1 -1
  15. package/dist/{square-D-Qx_njd.mjs → square-DwPV8oay.mjs} +1 -1
  16. package/dist/{trash-2-cC4gYobQ.mjs → trash-2-C1AFBh3V.mjs} +1 -1
  17. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-Dao979S_.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-J30N4Tun.mjs} +1 -1
  18. package/package.json +1 -1
  19. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DG3UFggb.mjs +0 -26
package/dist/index.js CHANGED
@@ -5363,7 +5363,7 @@ var ZodIssueCode = {
5363
5363
  var ZodFirstPartyTypeKind;
5364
5364
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5365
5365
  //#endregion
5366
- //#region ../types/dist/sleep-BaRu0bS5.mjs
5366
+ //#region ../types/dist/sleep-DC-wdyeS.mjs
5367
5367
  /**
5368
5368
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5369
5369
  * window to float samples (D455).
@@ -6148,6 +6148,40 @@ var BaseAddon = class {
6148
6148
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6149
6149
  return keys.size > 0 ? projectStore(raw, keys, node) : raw;
6150
6150
  }
6151
+ /**
6152
+ * Whether ONE global key of this addon's store was written, read three-way
6153
+ * (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
6154
+ * reports `value ?? default`, so "the operator chose the default" and "nobody
6155
+ * chose" look the same, and a failed read looks like both. A `perNode` key is
6156
+ * not supported here: its stored name is scoped.
6157
+ */
6158
+ async readStoredGlobalKey(key) {
6159
+ const read = this._ctx?.settings?.readAddonStoreResult;
6160
+ if (read === void 0) return {
6161
+ kind: "unreadable",
6162
+ reason: "three-way-read-unavailable"
6163
+ };
6164
+ let result;
6165
+ try {
6166
+ result = await read.call(this._ctx?.settings);
6167
+ } catch (err) {
6168
+ return {
6169
+ kind: "unreadable",
6170
+ reason: "store-read-failed",
6171
+ error: err instanceof Error ? err.message : String(err)
6172
+ };
6173
+ }
6174
+ if (result.kind === "failed") return {
6175
+ kind: "unreadable",
6176
+ reason: "store-read-failed",
6177
+ error: result.error
6178
+ };
6179
+ if (result.kind === "missing" || !Object.prototype.hasOwnProperty.call(result.value, key)) return { kind: "absent" };
6180
+ return {
6181
+ kind: "present",
6182
+ value: result.value[key]
6183
+ };
6184
+ }
6151
6185
  async updateGlobalSettings(patch, nodeId) {
6152
6186
  const keys = this.perNodeKeys();
6153
6187
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
@@ -9502,6 +9536,43 @@ var LogChannelWindowSchema = object({
9502
9536
  /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9503
9537
  deviceIds: array(number().int()).readonly().nullable()
9504
9538
  });
9539
+ var ClipModelMetaSchema = object({
9540
+ /** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
9541
+ textModelId: string().min(1),
9542
+ /** Output dimension of BOTH towers. A vector of any other length is refused. */
9543
+ embeddingDim: number().int().positive(),
9544
+ /**
9545
+ * The `vector-store` index this model's vectors live in. ONE feature space
9546
+ * per index: two models share an index only when their vectors are ranked
9547
+ * against each other, which for CLIP means never across families. MobileCLIP
9548
+ * S1 and S2 share `object-clip` for history (separated by the row's
9549
+ * `modelId`); any other model gets its own.
9550
+ */
9551
+ vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
9552
+ /**
9553
+ * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
9554
+ * must be unique per tokenizer: every model's siblings land in ONE flat
9555
+ * models directory, so two different tokenizers under the same name would
9556
+ * silently overwrite each other (whichever model downloaded last wins, and
9557
+ * the other one tokenises with the wrong vocabulary).
9558
+ */
9559
+ tokenizerFile: string().min(1),
9560
+ /** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
9561
+ contextLength: number().int().positive(),
9562
+ /** Id the tokenizer pads with. */
9563
+ padId: number().int().nonnegative(),
9564
+ /**
9565
+ * The search cosine floor at `strictness: 'loose'` — calibrated per model,
9566
+ * because cosine bands are a property of the model: 0.2 keeps 96% of matched
9567
+ * COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
9568
+ */
9569
+ searchMinScore: number().min(0).max(1)
9570
+ });
9571
+ var ClipSearchStrictnessSchema = _enum([
9572
+ "loose",
9573
+ "balanced",
9574
+ "strict"
9575
+ ]);
9505
9576
  var MODEL_FORMATS = [
9506
9577
  "onnx",
9507
9578
  "coreml",
@@ -9705,7 +9776,14 @@ var ModelCatalogEntrySchema = object({
9705
9776
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
9706
9777
  * labels already ARE the CamStack macros (Scrypted identity map).
9707
9778
  */
9708
- classMap: DetectionCatalogClassMapSchema.optional()
9779
+ classMap: DetectionCatalogClassMapSchema.optional(),
9780
+ /**
9781
+ * The model's CLIP feature-space contract (text encoder, dimension, vector
9782
+ * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
9783
+ * CLIP image encoder; its absence is what "not a CLIP model" means to the
9784
+ * embedding encoder and the semantic-search store (D649).
9785
+ */
9786
+ clip: ClipModelMetaSchema.optional()
9709
9787
  });
9710
9788
  var ConvertTargetSchema = discriminatedUnion("format", [object({
9711
9789
  format: literal("openvino"),
@@ -15307,6 +15385,42 @@ var LinkedDeviceSchema = object({
15307
15385
  features: array(string()),
15308
15386
  producesTrackedEvents: boolean().optional()
15309
15387
  });
15388
+ /**
15389
+ * The `linked-devices` extension slot's editable value (D648): the operator's
15390
+ * pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
15391
+ * in it — they are always linked and are not a pick.
15392
+ *
15393
+ * `trackedDeviceIds` (D655) is the tracked-event opt-in, exactly what
15394
+ * `_linkedDeviceTrackedIds` persists: which linked devices materialize a
15395
+ * synthetic tracked event on the camera. A read always carries it AS STORED
15396
+ * (an absent key reads as `[]`, which is what the resolver makes of it —
15397
+ * NONE). On a write it is optional: absent leaves the opt-in untouched, so a
15398
+ * card built before D655 cannot erase it by saving the pick list. A present
15399
+ * list REPLACES the opt-in; each id must be a pick, a device the camera links
15400
+ * by structure (the row's `impliedSources`: tree children, a picked
15401
+ * container's child) or already stored — so what was read can always be
15402
+ * written back unchanged, and a NEW opt-in outside the linked set is refused.
15403
+ */
15404
+ var LinkedDevicesSlotValueSchema = object({
15405
+ deviceIds: array(number().int().positive()),
15406
+ trackedDeviceIds: array(number().int().positive()).optional()
15407
+ });
15408
+ /**
15409
+ * The `linked-devices` slot — a camera's companion devices, owned by the
15410
+ * device manager over `_linkedDeviceIds` (D648, D356). Any device may be a
15411
+ * source except a container (its children are picked in its place) and the
15412
+ * camera itself.
15413
+ */
15414
+ var LINKED_DEVICES_SLOT = {
15415
+ id: "linked-devices",
15416
+ label: "Linked devices",
15417
+ description: "Companion devices of this camera: their controls appear with it, and the ones you opt in produce tracked events on it.",
15418
+ shape: "association",
15419
+ hostDeviceTypes: [DeviceType.Camera],
15420
+ sourceCaps: "any",
15421
+ cardinality: "many",
15422
+ value: LinkedDevicesSlotValueSchema
15423
+ };
15310
15424
  /** One camera's resolved linked set, tagged with the camera it belongs to.
15311
15425
  * The batch answer needs the tag; the single-device answer already has it
15312
15426
  * from the input, which is why `getLinkedDevices` keeps the untagged shape. */
@@ -15456,7 +15570,7 @@ var deviceManagerCapability = {
15456
15570
  name: "device-manager",
15457
15571
  scope: "system",
15458
15572
  mode: "singleton",
15459
- exposesDeviceSettings: true,
15573
+ extensionSlots: [LINKED_DEVICES_SLOT],
15460
15574
  methods: {
15461
15575
  /** Reserve (or re-resolve) a progressive numeric id for `(addonId, stableId)`.
15462
15576
  * Idempotent: returns the existing id if one is already persisted for the
@@ -15959,11 +16073,12 @@ var deviceManagerCapability = {
15959
16073
  /**
15960
16074
  * Resolve the devices LINKED to a camera — the single policy authority
15961
16075
  * both consumers call (viewer devices panel + pipeline-analytics event
15962
- * kinds/ingest). Device-tree children are ALWAYS included; mode 'auto'
15963
- * (default) adds every device sharing the camera's non-null `location`,
15964
- * mode 'manual' adds the persisted manual list instead. Excludes the
15965
- * camera itself; deduped. Configuration is standard per-device settings
15966
- * (see the module docblock) — there are no bespoke link mutations.
16076
+ * kinds/ingest). Device-tree children are ALWAYS included, plus the
16077
+ * operator's persisted pick list (`mode` is always `manual` since D356:
16078
+ * same-location devices are suggested by the picker, never linked on
16079
+ * their own). Excludes the camera itself; deduped. The list is written by
16080
+ * the `linked-devices` extension slot over `_linkedDeviceIds` (see the
16081
+ * module docblock).
15967
16082
  */
15968
16083
  getLinkedDevices: method(object({ deviceId: number() }), object({
15969
16084
  mode: LinkedDevicesModeSchema,
@@ -16508,11 +16623,98 @@ var EmbeddingResultSchema = object({
16508
16623
  embedding: array(number()),
16509
16624
  inferenceMs: number()
16510
16625
  });
16626
+ /** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
16627
+ var EmbeddingTowerSchema = _enum(["image", "text"]);
16628
+ /**
16629
+ * A tower in the terminal `failed` state (D649, D6): it crashed or failed to
16630
+ * load `crashes` times within `windowMs`, and is refused by name until an
16631
+ * operator `resetFailedModels` or a model change — never on a timer.
16632
+ *
16633
+ * `nodeId` is the node whose tower failed. The state lives in THAT node's
16634
+ * encoder process (in memory — a runner respawn clears it), and one node's
16635
+ * answer says nothing about another's.
16636
+ */
16637
+ var EmbeddingFailedModelSchema = object({
16638
+ modelId: string(),
16639
+ tower: EmbeddingTowerSchema,
16640
+ nodeId: string(),
16641
+ crashes: number(),
16642
+ windowMs: number(),
16643
+ sinceMs: number(),
16644
+ lastReason: string()
16645
+ });
16646
+ /**
16647
+ * A model whose REQUIREMENTS can never be met on this node (D649 round 5):
16648
+ * an id the catalog does not know, a model URL answering 404/410, a declared
16649
+ * sibling (the tokenizer) that is not there. After `attempts` failed builds
16650
+ * it is terminally `requirements-failed`, refused by name until an operator
16651
+ * `resetFailedModels` or a model change — the same exits as a crashed tower.
16652
+ */
16653
+ var EmbeddingFailedRequirementSchema = object({
16654
+ modelId: string(),
16655
+ tower: EmbeddingTowerSchema,
16656
+ nodeId: string(),
16657
+ attempts: number(),
16658
+ sinceMs: number(),
16659
+ lastReason: string()
16660
+ });
16511
16661
  var EmbeddingInfoSchema = object({
16512
16662
  modelId: string(),
16513
16663
  embeddingDim: number(),
16514
- ready: boolean()
16515
- });
16664
+ ready: boolean(),
16665
+ /**
16666
+ * The node that answered. Absent only from an encoder older than D649's
16667
+ * crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
16668
+ */
16669
+ nodeId: string().optional(),
16670
+ /**
16671
+ * Towers in `failed` on the answering node, each row naming it. `undefined`
16672
+ * means the node could not say (pre-budget encoder); a node that has the
16673
+ * budget always answers an array, empty included.
16674
+ */
16675
+ failedModels: array(EmbeddingFailedModelSchema).optional(),
16676
+ /** Models terminally `requirements-failed` on the answering node; same reading as above. */
16677
+ failedRequirements: array(EmbeddingFailedRequirementSchema).optional()
16678
+ });
16679
+ /**
16680
+ * The THREE codes an encoder refusal can carry (D649, D6). Same shape as
16681
+ * `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
16682
+ * Error's own properties do not survive the UDS/tRPC hop and its message does,
16683
+ * and both sides go through the helpers below — the encoder builds the
16684
+ * refusal, the live detail plane classifies on it to count refusals per
16685
+ * camera instead of logging one warning per track. The bracketed token
16686
+ * carries the code, the model, the tower and the node so a consumer never
16687
+ * parses prose.
16688
+ *
16689
+ * - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
16690
+ * budget — terminal until `resetFailedModels` or a model change.
16691
+ * - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
16692
+ * (a download or Python that failed, or the cooldown after one) — the next
16693
+ * request past the cooldown tries again.
16694
+ * - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
16695
+ * id, 404/410, missing sibling) and the bounded attempts are spent —
16696
+ * terminal, same exits as a crashed tower.
16697
+ */
16698
+ var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
16699
+ var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
16700
+ var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
16701
+ _enum([
16702
+ EMBEDDING_MODEL_FAILED,
16703
+ EMBEDDING_REQUIREMENTS_UNAVAILABLE,
16704
+ EMBEDDING_REQUIREMENTS_FAILED
16705
+ ]);
16706
+ new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
16707
+ /**
16708
+ * ONE provider per node (`placement: any-node`), addressed like every global
16709
+ * collection: the codegen injects a `{ nodeId?, addonId? }` selector on the
16710
+ * void methods and lifts a top-level `nodeId` off the object ones. A call
16711
+ * that names no node is answered by the HUB's provider — never by a merge
16712
+ * across nodes, because no global collection fans out across nodes (only the
16713
+ * providers of one node are `concatCollection`-fanned). So a fleet view of
16714
+ * `failedModels` is one `getInfo({ nodeId })` per node, and every answer
16715
+ * names the node it came from (D649 round 4); a node that cannot be asked is
16716
+ * UNKNOWN to the reader, never "no failures" (D315).
16717
+ */
16516
16718
  var embeddingEncoderCapability = {
16517
16719
  name: "embedding-encoder",
16518
16720
  scope: "system",
@@ -16531,8 +16733,30 @@ var embeddingEncoderCapability = {
16531
16733
  width: number(),
16532
16734
  height: number()
16533
16735
  }), EmbeddingResultSchema, { auth: "admin" }),
16534
- encodeText: method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }),
16535
- getInfo: method(_void(), EmbeddingInfoSchema, { auth: "admin" })
16736
+ /**
16737
+ * `modelId` (a CLIP IMAGE model id, whose catalog `clip.textModelId` names
16738
+ * the text tower) encodes in that model's space; absent, the cluster row's
16739
+ * `clip-embedding` model — the space every writer is in (D649).
16740
+ */
16741
+ encodeText: method(object({
16742
+ text: string(),
16743
+ modelId: string().min(1).optional()
16744
+ }), EmbeddingResultSchema, { auth: "admin" }),
16745
+ /** Answers for ONE node — the `nodeId` selector's, else the hub's. */
16746
+ getInfo: method(_void(), EmbeddingInfoSchema, { auth: "admin" }),
16747
+ /**
16748
+ * The operator's explicit clear of the `failed` state (one model, or all)
16749
+ * on ONE node — pass `nodeId` for an agent; the result names the node it
16750
+ * cleared. The only way out besides a model change: a crashing tower is
16751
+ * not retried on a timer.
16752
+ */
16753
+ resetFailedModels: method(object({ modelId: string().min(1).optional() }), object({
16754
+ cleared: array(string()),
16755
+ nodeId: string()
16756
+ }), {
16757
+ kind: "mutation",
16758
+ auth: "admin"
16759
+ })
16536
16760
  }
16537
16761
  };
16538
16762
  /**
@@ -20300,7 +20524,12 @@ var NcMediaPolicySchema = object({
20300
20524
  * the degrade engine, which drops the video and keeps the still.
20301
20525
  */
20302
20526
  clip: boolean().optional(),
20303
- /** Seconds of footage BEFORE / AFTER the event instant. Defaults 3 / 7. */
20527
+ /**
20528
+ * Seconds of footage BEFORE / AFTER the event instant. Absent =
20529
+ * {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
20530
+ * (4 / 6), resolved by the Notification Center at dispatch — deliberately not
20531
+ * a Zod default, so a rule that never chose keeps following the hub's.
20532
+ */
20304
20533
  clipPreRollSec: number().int().min(0).max(30).optional(),
20305
20534
  clipPostRollSec: number().int().min(0).max(30).optional(),
20306
20535
  /**
@@ -22398,6 +22627,130 @@ var oauthIntegrationCapability = {
22398
22627
  getDescriptor: method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
22399
22628
  };
22400
22629
  /**
22630
+ * A model choice has a SCOPE, and a scope change has a workflow.
22631
+ *
22632
+ * ## The two scopes
22633
+ *
22634
+ * Almost every pipeline step's model is a **node** question: which build runs
22635
+ * fastest on THIS accelerator. Two nodes may legitimately answer differently —
22636
+ * a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
22637
+ * are compared against nothing. They produce boxes, and a box is a box.
22638
+ *
22639
+ * Two steps are not like that. `face-embedding` and `clip-embedding` produce
22640
+ * **vectors that land in ONE shared index** (`identity_samples`,
22641
+ * `vec_object_clip`) and are ranked against each other by cosine similarity.
22642
+ * Cosine similarity between two encoders is not a weak signal, it is a
22643
+ * meaningless number — and nothing inside a vector can tell you it happened.
22644
+ * So for those two steps the model is a **cluster** question with exactly one
22645
+ * answer, stored in exactly one row.
22646
+ *
22647
+ * That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
22648
+ * for the crop convention (`detail-crop.ts`), one level up: the crop decides
22649
+ * WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
22650
+ * cluster-wide for the same reason and neither may become per-node.
22651
+ *
22652
+ * ## Why the registry lives here and not in the step catalog
22653
+ *
22654
+ * The scope itself is declared on the step, in
22655
+ * `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
22656
+ * — that is where a new step declares what kind of choice its model is. But the
22657
+ * catalog lives inside `addon-pipeline`, and three packages that must NOT
22658
+ * import an addon need to know the set: the orchestrator (which renders and
22659
+ * stores the row), post-analysis (which pins the row for a re-embed pass) and
22660
+ * admin-ui (which mirrors it). So the set is mirrored here, and
22661
+ * `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
22662
+ * A hand-copied key that stops matching is exactly how a setting silently stops
22663
+ * arriving while both sides still look correct.
22664
+ *
22665
+ * ## The defaults ARE today's behaviour
22666
+ *
22667
+ * {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
22668
+ * of both steps. Declaring the scope therefore changes nothing on the day it
22669
+ * ships: the cluster row starts out saying what every node was already doing.
22670
+ * Changing it is legitimate — that is what the knob is for — but it invalidates
22671
+ * the stored vectors of that surface, and must be followed by a re-embed pass
22672
+ * (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
22673
+ */
22674
+ /**
22675
+ * Why the orchestrator cannot say which model the operator chose for a
22676
+ * cluster-scoped step (D651).
22677
+ */
22678
+ var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
22679
+ "owner-not-ready",
22680
+ "store-read-failed",
22681
+ "three-way-read-unavailable",
22682
+ "invalid-stored",
22683
+ "not-cluster-scoped"
22684
+ ];
22685
+ Object.freeze(Object.fromEntries([{
22686
+ stepId: "face-embedding",
22687
+ label: "Face recognition model",
22688
+ defaultModelId: "auraface-r100",
22689
+ indexName: "the enrolled face gallery",
22690
+ options: [
22691
+ {
22692
+ id: "auraface-r100",
22693
+ label: "AuraFace R100"
22694
+ },
22695
+ {
22696
+ id: "arcface-r100",
22697
+ label: "ArcFace (ResNet34)"
22698
+ },
22699
+ {
22700
+ id: "inception-resnet-v1",
22701
+ label: "Inception ResNet V1"
22702
+ }
22703
+ ]
22704
+ }, {
22705
+ stepId: "clip-embedding",
22706
+ label: "Semantic search model",
22707
+ defaultModelId: "mobileclip-s1",
22708
+ indexName: "the object semantic-search index",
22709
+ options: [
22710
+ {
22711
+ id: "mobileclip-s1",
22712
+ label: "MobileCLIP S1"
22713
+ },
22714
+ {
22715
+ id: "mobileclip-s2",
22716
+ label: "MobileCLIP S2"
22717
+ },
22718
+ {
22719
+ id: "siglip2-b16-224",
22720
+ label: "SigLIP2 B/16 (Apache-2.0)"
22721
+ }
22722
+ ]
22723
+ }].map((s) => [s.stepId, s.defaultModelId])));
22724
+ var CLUSTER_STEP_SETTING_FIELDS = [{
22725
+ stepId: "face-embedding",
22726
+ key: "minLandmarkFaceSize",
22727
+ label: "Min face size for recognition (detection px)",
22728
+ 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.",
22729
+ type: "slider",
22730
+ min: 0,
22731
+ max: 64,
22732
+ step: 2,
22733
+ default: 24
22734
+ }];
22735
+ function clusterStepSettingKey(stepId, fieldKey) {
22736
+ return `clusterStepSetting:${stepId}:${fieldKey}`;
22737
+ }
22738
+ var ClusterSettingNumberSchema = number().finite();
22739
+ function readClusterStepSettings(config) {
22740
+ const out = {};
22741
+ for (const field of CLUSTER_STEP_SETTING_FIELDS) {
22742
+ const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
22743
+ const value = parsed.success ? parsed.data : field.default;
22744
+ const existing = out[field.stepId] ?? {};
22745
+ out[field.stepId] = {
22746
+ ...existing,
22747
+ [field.key]: value
22748
+ };
22749
+ }
22750
+ return out;
22751
+ }
22752
+ readClusterStepSettings({});
22753
+ /**
22401
22754
  * pipeline-analytics — device-scoped wrapper cap. Refines raw
22402
22755
  * per-frame detections emitted by the pipeline runner into tracked
22403
22756
  * objects, per-kind event collections (motion / object / audio), and
@@ -23213,7 +23566,8 @@ var MediaFileKindEnum = _enum([
23213
23566
  "thumbnailSmall",
23214
23567
  "confirmationCrop",
23215
23568
  "debugCrop",
23216
- "sceneFrame"
23569
+ "sceneFrame",
23570
+ "lastSceneFrame"
23217
23571
  ]);
23218
23572
  /**
23219
23573
  * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
@@ -23765,7 +24119,23 @@ var SearchObjectEventsInput = object({
23765
24119
  until: number().optional(),
23766
24120
  classFilter: string().optional(),
23767
24121
  limit: number().default(50),
23768
- minScore: number().min(0).max(1).default(.2)
24122
+ /**
24123
+ * An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
24124
+ * model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
24125
+ * so an absent one resolves to the searched model's own `searchMinScore`
24126
+ * scaled by `strictness`. A number sent here is honoured verbatim.
24127
+ */
24128
+ minScore: number().min(0).max(1).optional(),
24129
+ /** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
24130
+ strictness: ClipSearchStrictnessSchema.optional(),
24131
+ /**
24132
+ * Search THIS CLIP model's index instead of the cluster row's. Every index a
24133
+ * model ever wrote stays searchable until it is wiped (the MobileCLIP index
24134
+ * through a SigLIP2 cutover and its rollback window). An id with no CLIP
24135
+ * metadata is refused; an id other than the cluster row's is ADMIN-only
24136
+ * (`model-override-requires-admin`).
24137
+ */
24138
+ modelId: string().min(1).optional()
23769
24139
  });
23770
24140
  var TrackCascadeCountsSchema = object({
23771
24141
  /** Persisted track roots deleted (authoritative). */
@@ -23900,7 +24270,41 @@ var RebuildObjectEmbeddingsInput = object({
23900
24270
  * comparable, so wiping and rebuilding is the only way to be sure every vector
23901
24271
  * means the same thing.
23902
24272
  */
23903
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
24273
+ var WipeObjectEmbeddingsResultSchema = object({
24274
+ deleted: number(),
24275
+ /**
24276
+ * CLIP indexes that could NOT be emptied (unreachable, or refused at their
24277
+ * dimension) — not a clean slate. Additive and optional (D649).
24278
+ */
24279
+ failedIndexes: array(string()).optional()
24280
+ });
24281
+ /**
24282
+ * Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
24283
+ * of a pass (D649 over D651). A bare `started: false` read the same for "the
24284
+ * stores are booting" and "the cluster row names a model with no CLIP
24285
+ * metadata", which need different fixes.
24286
+ * - `stores-unavailable` — the analytics stores or the API are not up yet.
24287
+ * - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
24288
+ * a pass that rewrites an index needs two agreeing reads of the OWNER's
24289
+ * answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
24290
+ * name its model does not run (D54):
24291
+ * - the owner's own `unreadable` reasons (`owner-not-ready`,
24292
+ * `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
24293
+ * `not-cluster-scoped`);
24294
+ * - `method-unavailable` — the orchestrator predates the method;
24295
+ * - `read-failed` — the call failed or answered something unparseable;
24296
+ * - `reads-disagree` — the two reads named different choices.
24297
+ * - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
24298
+ * index to fill and no dimension to check against (D649).
24299
+ */
24300
+ var RebuildObjectEmbeddingsRefusalSchema = _enum([
24301
+ "stores-unavailable",
24302
+ ...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
24303
+ "method-unavailable",
24304
+ "read-failed",
24305
+ "reads-disagree",
24306
+ "not-a-clip-model"
24307
+ ]);
23904
24308
  /**
23905
24309
  * Acknowledgement that a rebuild STARTED.
23906
24310
  *
@@ -23913,7 +24317,12 @@ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
23913
24317
  var RebuildObjectEmbeddingsResultSchema = object({
23914
24318
  started: boolean(),
23915
24319
  /** True when a pass was already running; the new request is ignored. */
23916
- alreadyRunning: boolean()
24320
+ alreadyRunning: boolean(),
24321
+ /** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
24322
+ refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
24323
+ /** The CLIP model the pass pinned, and the index it fills (when it started). */
24324
+ modelId: string().optional(),
24325
+ index: string().optional()
23917
24326
  });
23918
24327
  var RebuildStatusSchema = object({
23919
24328
  running: boolean(),
@@ -23947,7 +24356,11 @@ var RebuildStatusSchema = object({
23947
24356
  startedAtMs: number().nullable(),
23948
24357
  finishedAtMs: number().nullable(),
23949
24358
  /** Present when the pass ended by throwing. */
23950
- error: string().nullable()
24359
+ error: string().nullable(),
24360
+ /** The CLIP model the current / last pass pinned (D54), `null` before any. */
24361
+ modelId: string().nullable(),
24362
+ /** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
24363
+ index: string().nullable()
23951
24364
  });
23952
24365
  /**
23953
24366
  * Acknowledgement that a debug-media reclaim STARTED.
@@ -24891,7 +25304,7 @@ var pipelineAnalyticsCapability = {
24891
25304
  * ObjectEvents by trackId. Returns up to `limit` events scored ≥
24892
25305
  * `minScore`, sorted descending by score.
24893
25306
  */
24894
- searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()),
25307
+ searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly(), { caller: "required" }),
24895
25308
  wipeObjectEmbeddings: method(object({}), WipeObjectEmbeddingsResultSchema, {
24896
25309
  kind: "mutation",
24897
25310
  auth: "admin"
@@ -25532,7 +25945,14 @@ var pipelineExecutorCapability = {
25532
25945
  */
25533
25946
  inferCached: method(object({
25534
25947
  stepId: string(),
25535
- frameId: number().int()
25948
+ frameId: number().int(),
25949
+ /**
25950
+ * The model to time — REQUIRED (D658). Without it the pool answered the
25951
+ * step's ACTIVE variant (the first loaded after boot), so a benchmark
25952
+ * of model B silently timed model A. Callers pass the `rootModelId`
25953
+ * their warmup `runPipeline` reported: the model that actually ran.
25954
+ */
25955
+ modelId: string().min(1)
25536
25956
  }), record(string(), unknown()), { kind: "mutation" }),
25537
25957
  /**
25538
25958
  * Release a cached frame from the Python pool's memory.
@@ -26184,6 +26604,17 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
26184
26604
  hubHostnameOverride: string().optional()
26185
26605
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
26186
26606
  /**
26607
+ * What ONE step runs with on ONE roster device for THIS camera (D650): the
26608
+ * device's per-(node,device) base with the camera's override for that device
26609
+ * on top — the same `override ?? base` merge the orchestrator applies to the
26610
+ * elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
26611
+ * resolves the device format's default, exactly as on the elected device.
26612
+ */
26613
+ var RunnerJumpStepProvisioningSchema = object({
26614
+ modelId: string().optional(),
26615
+ settings: record(string(), unknown()).optional()
26616
+ });
26617
+ /**
26187
26618
  * One ENABLED inference device on the runner's node, as the step-tree
26188
26619
  * device-jump resolver sees it (phase 1). The orchestrator populates this
26189
26620
  * roster on the attach payload whenever the camera is elected onto a specific
@@ -26195,7 +26626,16 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
26195
26626
  var RunnerInferenceDeviceSchema = object({
26196
26627
  deviceKey: string(),
26197
26628
  weight: number().positive().default(1),
26198
- maxSessions: number().int().positive().nullable().default(null)
26629
+ maxSessions: number().int().positive().nullable().default(null),
26630
+ /**
26631
+ * Per-step provisioning for this camera on THIS device (D650), keyed by step
26632
+ * id. A step the runner jumps here runs with these fields, never with the
26633
+ * elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
26634
+ * (a step absent from the map runs with neither — the target format default).
26635
+ * Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
26636
+ * the elected device's provisioning, as before.
26637
+ */
26638
+ steps: record(string(), RunnerJumpStepProvisioningSchema).optional()
26199
26639
  });
26200
26640
  /**
26201
26641
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
@@ -27262,6 +27702,28 @@ var NodeInferenceDeviceSchema = object({
27262
27702
  */
27263
27703
  exclusion: InferenceDeviceExclusionReasonSchema.nullable()
27264
27704
  });
27705
+ /**
27706
+ * The operator's model choice for one cluster-scoped step, answered by the
27707
+ * addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
27708
+ * folded: a written choice, a key nobody wrote (the cluster runs the default
27709
+ * BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
27710
+ * first two, read twice and agreeing.
27711
+ */
27712
+ var ClusterModelChoiceSchema = discriminatedUnion("kind", [
27713
+ object({
27714
+ kind: literal("stored"),
27715
+ modelId: string()
27716
+ }),
27717
+ object({
27718
+ kind: literal("absent"),
27719
+ defaultModelId: string()
27720
+ }),
27721
+ object({
27722
+ kind: literal("unreadable"),
27723
+ reason: _enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
27724
+ error: string().optional()
27725
+ })
27726
+ ]);
27265
27727
  var NodeInferenceDevicesSchema = object({
27266
27728
  nodeId: string(),
27267
27729
  /** False when the node's platform-probe was unreachable (no live device set). */
@@ -27358,9 +27820,19 @@ var pipelineOrchestratorCapability = {
27358
27820
  * Trigger a full rebalance pass. Iterates over all assigned cameras,
27359
27821
  * recomputes the optimal agent for each one based on current load +
27360
27822
  * hardware affinity, and migrates cameras whose current agent is no
27361
- * longer optimal. Pinned cameras are never migrated.
27362
- */
27363
- rebalance: method(_void(), object({ migrated: number() }), {
27823
+ * longer optimal. Pinned cameras are never migrated. `skipped` names the
27824
+ * cameras the pass wanted to move and could not, with why — a target node
27825
+ * that has not answered its catalog / device health yet, or a device that
27826
+ * cannot run the camera's root (D650).
27827
+ */
27828
+ rebalance: method(_void(), object({
27829
+ migrated: number(),
27830
+ skipped: array(object({
27831
+ deviceId: number(),
27832
+ targetNodeId: string(),
27833
+ reason: string()
27834
+ })).default([])
27835
+ }), {
27364
27836
  kind: "mutation",
27365
27837
  auth: "admin"
27366
27838
  }),
@@ -27370,6 +27842,13 @@ var pipelineOrchestratorCapability = {
27370
27842
  getPipelineAssignment: method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()),
27371
27843
  /** Get per-agent load summaries used by the load balancer + dashboards. */
27372
27844
  getAgentLoad: method(_void(), array(AgentLoadSummarySchema).readonly()),
27845
+ /**
27846
+ * The operator's STORED model choice for one cluster-scoped step (D651).
27847
+ * Read three-way from this addon's own store, only once its boot has
27848
+ * settled. Unlike `addonSettings.getGlobalSettings`, it never answers a
27849
+ * default as though someone chose it.
27850
+ */
27851
+ getClusterModelChoice: method(object({ stepId: string() }), ClusterModelChoiceSchema),
27373
27852
  /** Aggregate global metrics across the whole detection cluster. */
27374
27853
  getGlobalMetrics: method(_void(), GlobalMetricsSchema),
27375
27854
  /**
@@ -30630,6 +31109,286 @@ var videoclipsCapability = {
30630
31109
  }
30631
31110
  };
30632
31111
  /**
31112
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
31113
+ * valutatore puro del suo FRONTE.
31114
+ *
31115
+ * Viveva dentro il builtin virtual-doorbell
31116
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
31117
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
31118
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
31119
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
31120
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
31121
+ * SPOSTA qui e il doorbell la ri-esporta.
31122
+ *
31123
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
31124
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
31125
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
31126
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
31127
+ */
31128
+ /**
31129
+ * Known binary / switch source caps → the boolean slice field whose
31130
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
31131
+ * Sensors whose "active" reading is not a plain boolean (presence's string
31132
+ * state, connectivity's connected flag) are deliberately excluded — a
31133
+ * reconnect is not a doorbell press, and it is not a recording either.
31134
+ */
31135
+ var SOURCE_CAP_ACTIVE_FIELD = {
31136
+ contact: "entryOpen",
31137
+ binary: "on",
31138
+ switch: "on",
31139
+ motion: "detected",
31140
+ flood: "flooded",
31141
+ gas: "detected",
31142
+ smoke: "detected",
31143
+ "carbon-monoxide": "detected",
31144
+ vibration: "detected",
31145
+ tamper: "tampered"
31146
+ };
31147
+ /** Cap names whose presence in a device's bindings qualify it as a source. */
31148
+ var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
31149
+ /**
31150
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
31151
+ * name (same pattern as `snapshot`):
31152
+ *
31153
+ * - **Native** providers: registered per-device by device-driver
31154
+ * addons via `ctx.registerNativeCap` — either on a
31155
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
31156
+ * or directly on the camera (Reolink registers at camera level).
31157
+ * Emits an `onPressed` event every time the firmware pushes a
31158
+ * ring; status tracks the last press and a pressCount since start
31159
+ * (diagnostic).
31160
+ *
31161
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
31162
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
31163
+ * device (contact / switch / event-emitter …) into a doorbell for
31164
+ * a camera. `defaultActive: false` — the operator explicitly binds
31165
+ * it per camera in the device-bindings UI, then picks the source
31166
+ * device + trigger in the per-device settings.
31167
+ *
31168
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent
31169
+ * — subscribers listening at the camera level receive ring events
31170
+ * with `via[]` populated. No code on the parent needed.
31171
+ */
31172
+ var DoorbellStatusSchema = object({
31173
+ /** Ms epoch of the last press. null = never observed since this provider started. */
31174
+ lastPressedAt: number().nullable(),
31175
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
31176
+ pressCountSinceStart: number()
31177
+ });
31178
+ var DoorbellPressEventSchema = object({
31179
+ deviceId: number(),
31180
+ timestamp: number()
31181
+ });
31182
+ /**
31183
+ * The `doorbell-source` extension slot's editable value (D648): the camera's
31184
+ * virtual-doorbell trigger devices, exactly what the wrapper's
31185
+ * `doorbellSources` persists (as `{ deviceId }` records).
31186
+ */
31187
+ var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
31188
+ /**
31189
+ * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
31190
+ * doorbell, owned by the `virtual-doorbell` wrapper over its
31191
+ * `doorbellSources` store (D648). A source rings when one of its
31192
+ * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
31193
+ * different authority (`deviceManager.setWrapperActive`, D62) — the slot
31194
+ * reports it, it never writes it.
31195
+ */
31196
+ var DOORBELL_SOURCE_SLOT = {
31197
+ id: "doorbell-source",
31198
+ label: "Doorbell trigger devices",
31199
+ description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
31200
+ shape: "association",
31201
+ hostDeviceTypes: [DeviceType.Camera],
31202
+ sourceCaps: SOURCE_CAPS,
31203
+ cardinality: "many",
31204
+ value: DoorbellSourceSlotValueSchema
31205
+ };
31206
+ var doorbellCapability = {
31207
+ name: "doorbell",
31208
+ scope: "device",
31209
+ deviceNative: true,
31210
+ mode: "singleton",
31211
+ kind: "wrapper",
31212
+ defaultActive: false,
31213
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
31214
+ extensionSlots: [DOORBELL_SOURCE_SLOT],
31215
+ methods: {},
31216
+ events: {
31217
+ /**
31218
+ * Fires once per physical press. Reolink delivers via Baichuan
31219
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
31220
+ * release/duration — it's a pulse.
31221
+ */
31222
+ onPressed: { data: DoorbellPressEventSchema } },
31223
+ status: {
31224
+ schema: DoorbellStatusSchema,
31225
+ kind: "push"
31226
+ },
31227
+ /**
31228
+ * Runtime-state slice — last press timestamp + lifetime press count.
31229
+ * Mirrored by the kernel and readable via
31230
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
31231
+ * without subscribing.
31232
+ */
31233
+ runtimeState: DoorbellStatusSchema,
31234
+ /**
31235
+ * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
31236
+ *
31237
+ * See `RuntimeStateDurability`. Enforced by
31238
+ * `scripts/check-runtime-state-durability.ts`.
31239
+ */
31240
+ durability: "restored"
31241
+ };
31242
+ var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
31243
+ DeviceType.Camera, DeviceType.Camera;
31244
+ /** A slot's editable value, discriminated on `slot`. */
31245
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
31246
+ /** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
31247
+ var EXTENSION_HOST_DEVICE_TYPES = [DeviceType.Camera];
31248
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
31249
+ state: literal("unreachable"),
31250
+ reason: string()
31251
+ })]);
31252
+ /** One provider of slots — the D554 source-listing row. */
31253
+ var ExtensionSourceSchema = object({
31254
+ /** The routing prefix of every `slotRef` this provider serves. */
31255
+ source: string(),
31256
+ label: string(),
31257
+ /** Stamped by the dispatcher from the registry (D557). */
31258
+ addonId: string().optional(),
31259
+ availability: ExtensionSourceAvailabilitySchema
31260
+ });
31261
+ /**
31262
+ * How one picked source stands. `missing` — no such device (deleted, or an id
31263
+ * that never existed); `foreign` — a device the slot's owner cannot read from
31264
+ * (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
31265
+ * valid source now (a container, which is never a pick). A source in any of
31266
+ * these states is SHOWN, never silently dropped or re-pointed.
31267
+ */
31268
+ var ExtensionSourceHealthSchema = _enum([
31269
+ "ok",
31270
+ "missing",
31271
+ "foreign",
31272
+ "unavailable"
31273
+ ]);
31274
+ var ExtensionSlotSourceSchema = object({
31275
+ deviceId: number().int(),
31276
+ /** The device's name, or null when it could not be resolved (`missing`). */
31277
+ name: string().nullable(),
31278
+ health: ExtensionSourceHealthSchema,
31279
+ detail: string().optional()
31280
+ });
31281
+ /**
31282
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
31283
+ * reported read-only, named, never written through this contract (D62). The
31284
+ * virtual doorbell's sources ring only while the wrapper is bound to the
31285
+ * camera, and that binding belongs to `deviceManager.setWrapperActive`.
31286
+ * `unknown` means the gate could not be read; it is not "inactive" (D315).
31287
+ */
31288
+ var ExtensionSlotActivationSchema = object({
31289
+ state: _enum([
31290
+ "active",
31291
+ "inactive",
31292
+ "unknown"
31293
+ ]),
31294
+ authority: string(),
31295
+ detail: string().optional()
31296
+ });
31297
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
31298
+ state: literal("ok"),
31299
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
31300
+ slotRef: string(),
31301
+ slot: ExtensionSlotIdSchema,
31302
+ /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
31303
+ authority: string(),
31304
+ /** graft: its switch. association: null — removing every source is "off". */
31305
+ enabled: boolean().nullable(),
31306
+ /** graft: the cap registered on the host. association: null. */
31307
+ projects: string().nullable(),
31308
+ activation: ExtensionSlotActivationSchema.nullable(),
31309
+ value: ExtensionSlotValueSchema,
31310
+ sources: array(ExtensionSlotSourceSchema),
31311
+ /**
31312
+ * Devices the owner links to the host ON ITS OWN, by structure, and that
31313
+ * are therefore not in `value` (D655): a camera's device-tree children, and
31314
+ * the child a picked container stands for (D356 — a container is never a
31315
+ * pick, its children are). Read-only; the editor shows them and may offer
31316
+ * per-device options on them (the linked-devices tracked-event opt-in).
31317
+ * Absent when the owner links nothing beyond the picks, and from an owner
31318
+ * older than D655.
31319
+ */
31320
+ impliedSources: array(ExtensionSlotSourceSchema).optional()
31321
+ }), object({
31322
+ state: literal("unreachable"),
31323
+ addonId: string(),
31324
+ reason: string()
31325
+ })]);
31326
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
31327
+ deviceId: number().int(),
31328
+ name: string(),
31329
+ type: string(),
31330
+ location: string().nullable(),
31331
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
31332
+ parentName: string().nullable(),
31333
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
31334
+ suggested: boolean(),
31335
+ /** Why it is suggested ("same location"), null when it is not. */
31336
+ reason: string().nullable()
31337
+ })) });
31338
+ /**
31339
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
31340
+ * reloaded the host (or, for an accessory child, its parent) because the
31341
+ * write changed what the host REGISTERS (a graft switched on or off, slice 2).
31342
+ */
31343
+ var ExtensionSetResultSchema = object({
31344
+ applied: literal(true),
31345
+ reload: _enum([
31346
+ "none",
31347
+ "host",
31348
+ "parent"
31349
+ ])
31350
+ });
31351
+ var ExtensionSlotRefInputSchema = object({
31352
+ deviceId: number().int(),
31353
+ slotRef: string().min(1)
31354
+ });
31355
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
31356
+ var deviceExtensionCapability = {
31357
+ name: "device-extension",
31358
+ scope: "device",
31359
+ mode: "collection",
31360
+ kind: "wrapper",
31361
+ defaultActive: true,
31362
+ deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
31363
+ deviceConfig: { ui: {
31364
+ kind: "widget",
31365
+ widgetId: "host/extensions-panel",
31366
+ tab: "general",
31367
+ label: "Extensions",
31368
+ order: 72
31369
+ } },
31370
+ methods: {
31371
+ /** One row per slot owner — the D554 source listing `slotRef` routes by. */
31372
+ listSources: method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)),
31373
+ /**
31374
+ * Every slot this device is offered, read by each owner from its own
31375
+ * store. A provider that throws is ONE `unreachable` row (D554.4).
31376
+ */
31377
+ listSlots: method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)),
31378
+ /** The devices the slot's editor may offer, suggestions pre-marked (D356). */
31379
+ listCandidates: method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
31380
+ /**
31381
+ * Write one slot through its owner's EXISTING write path. The owner
31382
+ * validates (a container is never a linked device, a camera is never its
31383
+ * own source) and refuses by name before persisting.
31384
+ */
31385
+ setSlot: method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
31386
+ kind: "mutation",
31387
+ auth: "admin"
31388
+ })
31389
+ }
31390
+ };
31391
+ /**
30633
31392
  * Optional client-side hints sent at session creation to help the provider
30634
31393
  * pick the best native source. All fields optional — a viewer that knows
30635
31394
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -33475,75 +34234,6 @@ onStatusChanged: { data: object({
33475
34234
  volatileStateFields: ["lastChangedAt"]
33476
34235
  };
33477
34236
  /**
33478
- * Doorbell button cap. Two kinds of providers coexist behind this cap
33479
- * name (same pattern as `snapshot`):
33480
- *
33481
- * - **Native** providers: registered per-device by device-driver
33482
- * addons via `ctx.registerNativeCap` — either on a
33483
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
33484
- * or directly on the camera (Reolink registers at camera level).
33485
- * Emits an `onPressed` event every time the firmware pushes a
33486
- * ring; status tracks the last press and a pressCount since start
33487
- * (diagnostic).
33488
- *
33489
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
33490
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
33491
- * device (contact / switch / event-emitter …) into a doorbell for
33492
- * a camera. `defaultActive: false` — the operator explicitly binds
33493
- * it per camera in the device-bindings UI, then picks the source
33494
- * device + trigger in the per-device settings.
33495
- *
33496
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
33497
- * — subscribers listening at the camera level receive ring events
33498
- * with `via[]` populated. No code on the parent needed.
33499
- */
33500
- var DoorbellStatusSchema = object({
33501
- /** Ms epoch of the last press. null = never observed since this provider started. */
33502
- lastPressedAt: number().nullable(),
33503
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
33504
- pressCountSinceStart: number()
33505
- });
33506
- var DoorbellPressEventSchema = object({
33507
- deviceId: number(),
33508
- timestamp: number()
33509
- });
33510
- var doorbellCapability = {
33511
- name: "doorbell",
33512
- scope: "device",
33513
- deviceNative: true,
33514
- mode: "singleton",
33515
- kind: "wrapper",
33516
- defaultActive: false,
33517
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
33518
- exposesDeviceSettings: true,
33519
- methods: {},
33520
- events: {
33521
- /**
33522
- * Fires once per physical press. Reolink delivers via Baichuan
33523
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
33524
- * release/duration — it's a pulse.
33525
- */
33526
- onPressed: { data: DoorbellPressEventSchema } },
33527
- status: {
33528
- schema: DoorbellStatusSchema,
33529
- kind: "push"
33530
- },
33531
- /**
33532
- * Runtime-state slice — last press timestamp + lifetime press count.
33533
- * Mirrored by the kernel and readable via
33534
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
33535
- * without subscribing.
33536
- */
33537
- runtimeState: DoorbellStatusSchema,
33538
- /**
33539
- * Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
33540
- *
33541
- * See `RuntimeStateDurability`. Enforced by
33542
- * `scripts/check-runtime-state-durability.ts`.
33543
- */
33544
- durability: "restored"
33545
- };
33546
- /**
33547
34237
  * Enum-state sensor — a string value picked from a finite option set.
33548
34238
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
33549
34239
  * states, weather conditions, contact-source channels, mode strings).
@@ -43296,42 +43986,6 @@ function readDeviceStateFrom(runtimeState) {
43296
43986
  }
43297
43987
  }
43298
43988
  /**
43299
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
43300
- * valutatore puro del suo FRONTE.
43301
- *
43302
- * Viveva dentro il builtin virtual-doorbell
43303
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
43304
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
43305
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
43306
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
43307
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
43308
- * SPOSTA qui e il doorbell la ri-esporta.
43309
- *
43310
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
43311
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
43312
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
43313
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
43314
- */
43315
- /**
43316
- * Known binary / switch source caps → the boolean slice field whose
43317
- * false→true rise counts as ACTIVE. Every entry is "fire on active".
43318
- * Sensors whose "active" reading is not a plain boolean (presence's string
43319
- * state, connectivity's connected flag) are deliberately excluded — a
43320
- * reconnect is not a doorbell press, and it is not a recording either.
43321
- */
43322
- var SOURCE_CAP_ACTIVE_FIELD = {
43323
- contact: "entryOpen",
43324
- binary: "on",
43325
- switch: "on",
43326
- motion: "detected",
43327
- flood: "flooded",
43328
- gas: "detected",
43329
- smoke: "detected",
43330
- "carbon-monoxide": "detected",
43331
- vibration: "detected",
43332
- tamper: "tampered"
43333
- };
43334
- /**
43335
43989
  * Accessory device helpers — shared across drivers.
43336
43990
  *
43337
43991
  * Many vendor-specific drivers register accessory child devices on
@@ -44754,6 +45408,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
44754
45408
  deviceAdoptionCapability,
44755
45409
  deviceDiscoveryCapability,
44756
45410
  deviceExportCapability,
45411
+ deviceExtensionCapability,
44757
45412
  deviceManagerCapability,
44758
45413
  deviceOpsCapability,
44759
45414
  deviceProviderCapability,
@@ -46302,6 +46957,30 @@ Object.freeze({
46302
46957
  addonId: null,
46303
46958
  access: "create"
46304
46959
  },
46960
+ "deviceExtension.listCandidates": {
46961
+ capName: "device-extension",
46962
+ capScope: "device",
46963
+ addonId: null,
46964
+ access: "view"
46965
+ },
46966
+ "deviceExtension.listSlots": {
46967
+ capName: "device-extension",
46968
+ capScope: "device",
46969
+ addonId: null,
46970
+ access: "view"
46971
+ },
46972
+ "deviceExtension.listSources": {
46973
+ capName: "device-extension",
46974
+ capScope: "device",
46975
+ addonId: null,
46976
+ access: "view"
46977
+ },
46978
+ "deviceExtension.setSlot": {
46979
+ capName: "device-extension",
46980
+ capScope: "device",
46981
+ addonId: null,
46982
+ access: "create"
46983
+ },
46305
46984
  "deviceManager.addLocation": {
46306
46985
  capName: "device-manager",
46307
46986
  capScope: "system",
@@ -46374,12 +47053,6 @@ Object.freeze({
46374
47053
  addonId: null,
46375
47054
  access: "create"
46376
47055
  },
46377
- "deviceManager.applyDeviceSettingsPatch": {
46378
- capName: "device-manager",
46379
- capScope: "system",
46380
- addonId: null,
46381
- access: "create"
46382
- },
46383
47056
  "deviceManager.applyInitialMeta": {
46384
47057
  capName: "device-manager",
46385
47058
  capScope: "system",
@@ -46482,12 +47155,6 @@ Object.freeze({
46482
47155
  addonId: null,
46483
47156
  access: "view"
46484
47157
  },
46485
- "deviceManager.getDeviceLiveContribution": {
46486
- capName: "device-manager",
46487
- capScope: "system",
46488
- addonId: null,
46489
- access: "view"
46490
- },
46491
47158
  "deviceManager.getDeviceLiveInfoAggregate": {
46492
47159
  capName: "device-manager",
46493
47160
  capScope: "system",
@@ -46500,12 +47167,6 @@ Object.freeze({
46500
47167
  addonId: null,
46501
47168
  access: "view"
46502
47169
  },
46503
- "deviceManager.getDeviceSettingsContribution": {
46504
- capName: "device-manager",
46505
- capScope: "system",
46506
- addonId: null,
46507
- access: "view"
46508
- },
46509
47170
  "deviceManager.getDeviceStatusAggregate": {
46510
47171
  capName: "device-manager",
46511
47172
  capScope: "system",
@@ -47010,24 +47671,6 @@ Object.freeze({
47010
47671
  addonId: null,
47011
47672
  access: "view"
47012
47673
  },
47013
- "doorbell.applyDeviceSettingsPatch": {
47014
- capName: "doorbell",
47015
- capScope: "device",
47016
- addonId: null,
47017
- access: "create"
47018
- },
47019
- "doorbell.getDeviceLiveContribution": {
47020
- capName: "doorbell",
47021
- capScope: "device",
47022
- addonId: null,
47023
- access: "view"
47024
- },
47025
- "doorbell.getDeviceSettingsContribution": {
47026
- capName: "doorbell",
47027
- capScope: "device",
47028
- addonId: null,
47029
- access: "view"
47030
- },
47031
47674
  "doorbell.getStatus": {
47032
47675
  capName: "doorbell",
47033
47676
  capScope: "device",
@@ -47052,6 +47695,12 @@ Object.freeze({
47052
47695
  addonId: null,
47053
47696
  access: "view"
47054
47697
  },
47698
+ "embeddingEncoder.resetFailedModels": {
47699
+ capName: "embedding-encoder",
47700
+ capScope: "system",
47701
+ addonId: null,
47702
+ access: "delete"
47703
+ },
47055
47704
  "enumSensor.getStatus": {
47056
47705
  capName: "enum-sensor",
47057
47706
  capScope: "device",
@@ -49386,6 +50035,12 @@ Object.freeze({
49386
50035
  addonId: null,
49387
50036
  access: "view"
49388
50037
  },
50038
+ "pipelineOrchestrator.getClusterModelChoice": {
50039
+ capName: "pipeline-orchestrator",
50040
+ capScope: "system",
50041
+ addonId: null,
50042
+ access: "view"
50043
+ },
49389
50044
  "pipelineOrchestrator.getDeviceLiveContribution": {
49390
50045
  capName: "pipeline-orchestrator",
49391
50046
  capScope: "system",
@@ -52211,6 +52866,26 @@ Object.freeze({
52211
52866
  form: "single",
52212
52867
  optional: false
52213
52868
  }],
52869
+ "deviceExtension.listCandidates": [{
52870
+ name: "deviceId",
52871
+ form: "single",
52872
+ optional: false
52873
+ }],
52874
+ "deviceExtension.listSlots": [{
52875
+ name: "deviceId",
52876
+ form: "single",
52877
+ optional: false
52878
+ }],
52879
+ "deviceExtension.listSources": [{
52880
+ name: "deviceId",
52881
+ form: "single",
52882
+ optional: false
52883
+ }],
52884
+ "deviceExtension.setSlot": [{
52885
+ name: "deviceId",
52886
+ form: "single",
52887
+ optional: false
52888
+ }],
52214
52889
  "deviceManager.adoptionRelease": [{
52215
52890
  name: "camDeviceId",
52216
52891
  form: "single",
@@ -54750,68 +55425,6 @@ TimelapseRuleInputSchema.extend({
54750
55425
  createdAt: number(),
54751
55426
  updatedAt: number()
54752
55427
  });
54753
- Object.freeze(Object.fromEntries([{
54754
- stepId: "face-embedding",
54755
- label: "Face recognition model",
54756
- defaultModelId: "arcface-r100",
54757
- indexName: "the enrolled face gallery",
54758
- options: [
54759
- {
54760
- id: "arcface-r100",
54761
- label: "ArcFace (ResNet34)"
54762
- },
54763
- {
54764
- id: "auraface-r100",
54765
- label: "AuraFace R100"
54766
- },
54767
- {
54768
- id: "inception-resnet-v1",
54769
- label: "Inception ResNet V1"
54770
- }
54771
- ]
54772
- }, {
54773
- stepId: "clip-embedding",
54774
- label: "Semantic search model",
54775
- defaultModelId: "mobileclip-s1",
54776
- indexName: "the object semantic-search index",
54777
- options: [{
54778
- id: "mobileclip-s1",
54779
- label: "MobileCLIP S1"
54780
- }, {
54781
- id: "mobileclip-s2",
54782
- label: "MobileCLIP S2"
54783
- }]
54784
- }].map((s) => [s.stepId, s.defaultModelId])));
54785
- string().min(1);
54786
- var CLUSTER_STEP_SETTING_FIELDS = [{
54787
- stepId: "face-embedding",
54788
- key: "minLandmarkFaceSize",
54789
- label: "Min face size for recognition (detection px)",
54790
- 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.",
54791
- type: "slider",
54792
- min: 0,
54793
- max: 64,
54794
- step: 2,
54795
- default: 24
54796
- }];
54797
- function clusterStepSettingKey(stepId, fieldKey) {
54798
- return `clusterStepSetting:${stepId}:${fieldKey}`;
54799
- }
54800
- var ClusterSettingNumberSchema = number().finite();
54801
- function readClusterStepSettings(config) {
54802
- const out = {};
54803
- for (const field of CLUSTER_STEP_SETTING_FIELDS) {
54804
- const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
54805
- const value = parsed.success ? parsed.data : field.default;
54806
- const existing = out[field.stepId] ?? {};
54807
- out[field.stepId] = {
54808
- ...existing,
54809
- [field.key]: value
54810
- };
54811
- }
54812
- return out;
54813
- }
54814
- readClusterStepSettings({});
54815
55428
  object({
54816
55429
  /**
54817
55430
  * Fraction of the box's own size added on EACH side before cutting.