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