@camstack/types 1.2.260 → 1.2.261

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 (48) hide show
  1. package/dist/addon/base-addon.d.ts +9 -1
  2. package/dist/addon.js +4 -6
  3. package/dist/addon.mjs +4 -6
  4. package/dist/capabilities/capability-definition.d.ts +9 -0
  5. package/dist/capabilities/custom-model-registry.cap.d.ts +18 -0
  6. package/dist/capabilities/device-extension.cap.d.ts +370 -0
  7. package/dist/capabilities/device-manager.cap.d.ts +45 -5
  8. package/dist/capabilities/doorbell.cap.d.ts +41 -0
  9. package/dist/capabilities/embedding-encoder.cap.d.ts +175 -0
  10. package/dist/capabilities/index.d.ts +15 -12
  11. package/dist/capabilities/llm-runtime.cap.d.ts +4 -4
  12. package/dist/capabilities/llm-shared.d.ts +6 -6
  13. package/dist/capabilities/llm.cap.d.ts +6 -6
  14. package/dist/capabilities/model-convert.cap.d.ts +9 -0
  15. package/dist/capabilities/model-distributor.cap.d.ts +18 -0
  16. package/dist/capabilities/notification-rules.cap.d.ts +32 -14
  17. package/dist/capabilities/osd-manager.cap.d.ts +6 -6
  18. package/dist/capabilities/pipeline-analytics.cap.d.ts +80 -2
  19. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +62 -1
  20. package/dist/capabilities/pipeline-runner.cap.d.ts +24 -0
  21. package/dist/capabilities/vector-store.cap.d.ts +14 -0
  22. package/dist/device-extension/index.d.ts +3 -0
  23. package/dist/device-extension/slot-descriptor.d.ts +62 -0
  24. package/dist/device-extension/slot-provider.d.ts +68 -0
  25. package/dist/generated/addon-api.d.ts +50 -0
  26. package/dist/generated/capability-router-map.d.ts +5 -2
  27. package/dist/generated/collection-array-methods.d.ts +1 -1
  28. package/dist/generated/device-proxy.d.ts +7 -7
  29. package/dist/generated/device-scoped-caps.d.ts +1 -1
  30. package/dist/generated/extension-slots.d.ts +39 -0
  31. package/dist/generated/method-access-map.d.ts +1 -1
  32. package/dist/generated/method-device-selectors.d.ts +1 -1
  33. package/dist/generated/system-proxy.d.ts +4 -2
  34. package/dist/index.d.ts +4 -1
  35. package/dist/index.js +1439 -475
  36. package/dist/index.mjs +1379 -476
  37. package/dist/interfaces/addon.d.ts +41 -0
  38. package/dist/interfaces/event-bus.d.ts +10 -0
  39. package/dist/node.d.ts +1 -0
  40. package/dist/node.js +73 -7
  41. package/dist/node.mjs +73 -8
  42. package/dist/pipeline/cluster-model-scope.d.ts +59 -3
  43. package/dist/{sleep-BaRu0bS5.mjs → sleep-BXv0ZcRa.mjs} +49 -33
  44. package/dist/{sleep-BDYxE1ax.js → sleep-QxyLiUId.js} +54 -32
  45. package/dist/storage/atomic-write.d.ts +25 -0
  46. package/dist/types/clip-model.d.ts +64 -0
  47. package/dist/types/models.d.ts +18 -0
  48. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BDYxE1ax.js");
2
+ const require_sleep = require("./sleep-QxyLiUId.js");
3
3
  const require_event_category = require("./event-category-BVfsrBYA.js");
4
4
  const require_canonical_hash = require("./canonical-hash-CSE4ioRi.js");
5
5
  const require_enums = require("./enums.js");
@@ -5017,6 +5017,94 @@ function describeModelVariant(models, modelId) {
5017
5017
  };
5018
5018
  }
5019
5019
  //#endregion
5020
+ //#region src/types/clip-model.ts
5021
+ /**
5022
+ * A CLIP model's feature-space contract — what every consumer of its vectors
5023
+ * must agree on, carried BY THE MODEL rather than re-derived by each consumer.
5024
+ *
5025
+ * ## Why this lives on the catalog entry
5026
+ *
5027
+ * Until 2026-09-26 each fact was hard-coded where it was used: the text window
5028
+ * (77) and pad id (0) in `text_encoder_inference.py`, the index name
5029
+ * (`object-clip`) in the object-embedding store, the "is this a CLIP vector"
5030
+ * test as `embeddingModelId.startsWith('mobileclip-')`, the search floor (0.2)
5031
+ * in the cap default, and the dimension (512) behind a `getModelMeta` that fell
5032
+ * back to MobileCLIP for any id it did not know. Every one of those is wrong for
5033
+ * the next model, and each one failed SILENTLY for SigLIP2 in the 2026-09-26
5034
+ * spike: vectors dropped before the store with no log, 768-d queries truncated
5035
+ * to 512 and ranked as garbage, 97% of true matches under the 0.2 floor (D649).
5036
+ *
5037
+ * A model now declares its own contract here, and a model with no `clip` block
5038
+ * is not a CLIP model to any consumer. That is also the seam Model Studio uses
5039
+ * for a user-supplied CLIP model: its registry row carries the same block.
5040
+ */
5041
+ /**
5042
+ * `object-clip` (the historical MobileCLIP index, 512-d) or
5043
+ * `object-clip-<model>`. Lower-case and dash-only so the sqlite-vec table name
5044
+ * derived from it (`vec_` + non-word → `_`) cannot collide with another index's.
5045
+ */
5046
+ var CLIP_VECTOR_INDEX_PATTERN = /^object-clip(-[a-z0-9][a-z0-9-]*)?$/;
5047
+ var ClipModelMetaSchema = zod.z.object({
5048
+ /** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
5049
+ textModelId: zod.z.string().min(1),
5050
+ /** Output dimension of BOTH towers. A vector of any other length is refused. */
5051
+ embeddingDim: zod.z.number().int().positive(),
5052
+ /**
5053
+ * The `vector-store` index this model's vectors live in. ONE feature space
5054
+ * per index: two models share an index only when their vectors are ranked
5055
+ * against each other, which for CLIP means never across families. MobileCLIP
5056
+ * S1 and S2 share `object-clip` for history (separated by the row's
5057
+ * `modelId`); any other model gets its own.
5058
+ */
5059
+ vectorIndex: zod.z.string().regex(CLIP_VECTOR_INDEX_PATTERN),
5060
+ /**
5061
+ * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
5062
+ * must be unique per tokenizer: every model's siblings land in ONE flat
5063
+ * models directory, so two different tokenizers under the same name would
5064
+ * silently overwrite each other (whichever model downloaded last wins, and
5065
+ * the other one tokenises with the wrong vocabulary).
5066
+ */
5067
+ tokenizerFile: zod.z.string().min(1),
5068
+ /** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
5069
+ contextLength: zod.z.number().int().positive(),
5070
+ /** Id the tokenizer pads with. */
5071
+ padId: zod.z.number().int().nonnegative(),
5072
+ /**
5073
+ * The search cosine floor at `strictness: 'loose'` — calibrated per model,
5074
+ * because cosine bands are a property of the model: 0.2 keeps 96% of matched
5075
+ * COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
5076
+ */
5077
+ searchMinScore: zod.z.number().min(0).max(1)
5078
+ });
5079
+ /**
5080
+ * Model-relative search strictness. The operator picks how picky, the model
5081
+ * says what that means in its own cosine band. On MobileCLIP (floor 0.2) these
5082
+ * reproduce the admin UI's historical absolute presets 0.20 / 0.25 / 0.30.
5083
+ */
5084
+ var CLIP_SEARCH_STRICTNESS = [
5085
+ "loose",
5086
+ "balanced",
5087
+ "strict"
5088
+ ];
5089
+ var ClipSearchStrictnessSchema = zod.z.enum(CLIP_SEARCH_STRICTNESS);
5090
+ var CLIP_STRICTNESS_FACTOR = {
5091
+ loose: 1,
5092
+ balanced: 1.25,
5093
+ strict: 1.5
5094
+ };
5095
+ /**
5096
+ * The cosine floor a search runs with.
5097
+ *
5098
+ * An explicit `minScore` is honoured verbatim: it is a number a caller chose,
5099
+ * and silently rescaling it would make the same URL mean different things on
5100
+ * two installs. Everything else is relative to the model.
5101
+ */
5102
+ function resolveClipSearchMinScore(meta, request) {
5103
+ if (request.minScore !== void 0) return request.minScore;
5104
+ const factor = CLIP_STRICTNESS_FACTOR[request.strictness ?? "loose"];
5105
+ return Math.min(1, Math.round(meta.searchMinScore * factor * 1e3) / 1e3);
5106
+ }
5107
+ //#endregion
5020
5108
  //#region src/types/models.ts
5021
5109
  var MODEL_FORMATS = [
5022
5110
  "onnx",
@@ -5241,7 +5329,14 @@ var ModelCatalogEntrySchema = zod.z.object({
5241
5329
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
5242
5330
  * labels already ARE the CamStack macros (Scrypted identity map).
5243
5331
  */
5244
- classMap: DetectionCatalogClassMapSchema.optional()
5332
+ classMap: DetectionCatalogClassMapSchema.optional(),
5333
+ /**
5334
+ * The model's CLIP feature-space contract (text encoder, dimension, vector
5335
+ * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
5336
+ * CLIP image encoder; its absence is what "not a CLIP model" means to the
5337
+ * embedding encoder and the semantic-search store (D649).
5338
+ */
5339
+ clip: ClipModelMetaSchema.optional()
5245
5340
  });
5246
5341
  var ConvertTargetSchema = zod.z.discriminatedUnion("format", [zod.z.object({
5247
5342
  format: zod.z.literal("openvino"),
@@ -12411,6 +12506,28 @@ var LinkedDeviceSchema = zod.z.object({
12411
12506
  features: zod.z.array(zod.z.string()),
12412
12507
  producesTrackedEvents: zod.z.boolean().optional()
12413
12508
  });
12509
+ /**
12510
+ * The `linked-devices` extension slot's editable value (D648): the operator's
12511
+ * pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
12512
+ * in it — they are always linked and are not a pick.
12513
+ */
12514
+ var LinkedDevicesSlotValueSchema = zod.z.object({ deviceIds: zod.z.array(zod.z.number().int().positive()) });
12515
+ /**
12516
+ * The `linked-devices` slot — a camera's companion devices, owned by the
12517
+ * device manager over `_linkedDeviceIds` (D648, D356). Any device may be a
12518
+ * source except a container (its children are picked in its place) and the
12519
+ * camera itself.
12520
+ */
12521
+ var LINKED_DEVICES_SLOT = {
12522
+ id: "linked-devices",
12523
+ label: "Linked devices",
12524
+ description: "Companion devices of this camera: their controls appear with it, and the ones you opt in produce tracked events on it.",
12525
+ shape: "association",
12526
+ hostDeviceTypes: [require_sleep.DeviceType.Camera],
12527
+ sourceCaps: "any",
12528
+ cardinality: "many",
12529
+ value: LinkedDevicesSlotValueSchema
12530
+ };
12414
12531
  /** One camera's resolved linked set, tagged with the camera it belongs to.
12415
12532
  * The batch answer needs the tag; the single-device answer already has it
12416
12533
  * from the input, which is why `getLinkedDevices` keeps the untagged shape. */
@@ -12560,6 +12677,7 @@ var deviceManagerCapability = {
12560
12677
  name: "device-manager",
12561
12678
  scope: "system",
12562
12679
  mode: "singleton",
12680
+ extensionSlots: [LINKED_DEVICES_SLOT],
12563
12681
  exposesDeviceSettings: true,
12564
12682
  methods: {
12565
12683
  /** Reserve (or re-resolve) a progressive numeric id for `(addonId, stableId)`.
@@ -13063,11 +13181,12 @@ var deviceManagerCapability = {
13063
13181
  /**
13064
13182
  * Resolve the devices LINKED to a camera — the single policy authority
13065
13183
  * both consumers call (viewer devices panel + pipeline-analytics event
13066
- * kinds/ingest). Device-tree children are ALWAYS included; mode 'auto'
13067
- * (default) adds every device sharing the camera's non-null `location`,
13068
- * mode 'manual' adds the persisted manual list instead. Excludes the
13069
- * camera itself; deduped. Configuration is standard per-device settings
13070
- * (see the module docblock) — there are no bespoke link mutations.
13184
+ * kinds/ingest). Device-tree children are ALWAYS included, plus the
13185
+ * operator's persisted pick list (`mode` is always `manual` since D356:
13186
+ * same-location devices are suggested by the picker, never linked on
13187
+ * their own). Excludes the camera itself; deduped. The list is written by
13188
+ * the settings section or the `linked-devices` extension slot, both over
13189
+ * `_linkedDeviceIds` (see the module docblock).
13071
13190
  */
13072
13191
  getLinkedDevices: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.object({
13073
13192
  mode: LinkedDevicesModeSchema,
@@ -13616,11 +13735,143 @@ var EmbeddingResultSchema = zod.z.object({
13616
13735
  embedding: zod.z.array(zod.z.number()),
13617
13736
  inferenceMs: zod.z.number()
13618
13737
  });
13738
+ /** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
13739
+ var EmbeddingTowerSchema = zod.z.enum(["image", "text"]);
13740
+ /**
13741
+ * A tower in the terminal `failed` state (D649, D6): it crashed or failed to
13742
+ * load `crashes` times within `windowMs`, and is refused by name until an
13743
+ * operator `resetFailedModels` or a model change — never on a timer.
13744
+ *
13745
+ * `nodeId` is the node whose tower failed. The state lives in THAT node's
13746
+ * encoder process (in memory — a runner respawn clears it), and one node's
13747
+ * answer says nothing about another's.
13748
+ */
13749
+ var EmbeddingFailedModelSchema = zod.z.object({
13750
+ modelId: zod.z.string(),
13751
+ tower: EmbeddingTowerSchema,
13752
+ nodeId: zod.z.string(),
13753
+ crashes: zod.z.number(),
13754
+ windowMs: zod.z.number(),
13755
+ sinceMs: zod.z.number(),
13756
+ lastReason: zod.z.string()
13757
+ });
13758
+ /**
13759
+ * A model whose REQUIREMENTS can never be met on this node (D649 round 5):
13760
+ * an id the catalog does not know, a model URL answering 404/410, a declared
13761
+ * sibling (the tokenizer) that is not there. After `attempts` failed builds
13762
+ * it is terminally `requirements-failed`, refused by name until an operator
13763
+ * `resetFailedModels` or a model change — the same exits as a crashed tower.
13764
+ */
13765
+ var EmbeddingFailedRequirementSchema = zod.z.object({
13766
+ modelId: zod.z.string(),
13767
+ tower: EmbeddingTowerSchema,
13768
+ nodeId: zod.z.string(),
13769
+ attempts: zod.z.number(),
13770
+ sinceMs: zod.z.number(),
13771
+ lastReason: zod.z.string()
13772
+ });
13619
13773
  var EmbeddingInfoSchema = zod.z.object({
13620
13774
  modelId: zod.z.string(),
13621
13775
  embeddingDim: zod.z.number(),
13622
- ready: zod.z.boolean()
13623
- });
13776
+ ready: zod.z.boolean(),
13777
+ /**
13778
+ * The node that answered. Absent only from an encoder older than D649's
13779
+ * crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
13780
+ */
13781
+ nodeId: zod.z.string().optional(),
13782
+ /**
13783
+ * Towers in `failed` on the answering node, each row naming it. `undefined`
13784
+ * means the node could not say (pre-budget encoder); a node that has the
13785
+ * budget always answers an array, empty included.
13786
+ */
13787
+ failedModels: zod.z.array(EmbeddingFailedModelSchema).optional(),
13788
+ /** Models terminally `requirements-failed` on the answering node; same reading as above. */
13789
+ failedRequirements: zod.z.array(EmbeddingFailedRequirementSchema).optional()
13790
+ });
13791
+ /**
13792
+ * The THREE codes an encoder refusal can carry (D649, D6). Same shape as
13793
+ * `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
13794
+ * Error's own properties do not survive the UDS/tRPC hop and its message does,
13795
+ * and both sides go through the helpers below — the encoder builds the
13796
+ * refusal, the live detail plane classifies on it to count refusals per
13797
+ * camera instead of logging one warning per track. The bracketed token
13798
+ * carries the code, the model, the tower and the node so a consumer never
13799
+ * parses prose.
13800
+ *
13801
+ * - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
13802
+ * budget — terminal until `resetFailedModels` or a model change.
13803
+ * - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
13804
+ * (a download or Python that failed, or the cooldown after one) — the next
13805
+ * request past the cooldown tries again.
13806
+ * - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
13807
+ * id, 404/410, missing sibling) and the bounded attempts are spent —
13808
+ * terminal, same exits as a crashed tower.
13809
+ */
13810
+ var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
13811
+ var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
13812
+ var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
13813
+ var EmbeddingRefusalCodeSchema = zod.z.enum([
13814
+ EMBEDDING_MODEL_FAILED,
13815
+ EMBEDDING_REQUIREMENTS_UNAVAILABLE,
13816
+ EMBEDDING_REQUIREMENTS_FAILED
13817
+ ]);
13818
+ function embeddingRefusalToken(code, on) {
13819
+ return `[${code} model=${on.modelId} tower=${on.tower} node=${on.nodeId}]`;
13820
+ }
13821
+ /** The encoder's refusal for a crashed tower, carrying {@link EMBEDDING_MODEL_FAILED}. */
13822
+ function embeddingModelFailedError(row) {
13823
+ return /* @__PURE__ */ new Error(`${embeddingRefusalToken(EMBEDDING_MODEL_FAILED, row)} ${row.modelId} (${row.tower} tower) crashed ${String(row.crashes)} times in ${String(Math.round(row.windowMs / 1e3))}s on ${row.nodeId} — ${row.lastReason}. Cleared by embeddingEncoder.resetFailedModels({ modelId: "${row.modelId}", nodeId: "${row.nodeId}" }) or a model change.`);
13824
+ }
13825
+ /** The requirements refusal for THIS request, carrying {@link EMBEDDING_REQUIREMENTS_UNAVAILABLE}. */
13826
+ function embeddingRequirementsUnavailableError(on, reason) {
13827
+ return /* @__PURE__ */ new Error(`${embeddingRefusalToken(EMBEDDING_REQUIREMENTS_UNAVAILABLE, on)} ${on.modelId} (${on.tower} tower) on ${on.nodeId}: ${reason}`);
13828
+ }
13829
+ /** The terminal requirements refusal, carrying {@link EMBEDDING_REQUIREMENTS_FAILED}. */
13830
+ function embeddingRequirementsFailedError(row) {
13831
+ return /* @__PURE__ */ new Error(`${embeddingRefusalToken(EMBEDDING_REQUIREMENTS_FAILED, row)} ${row.modelId} (${row.tower} tower) on ${row.nodeId}: requirements can never be met — ${String(row.attempts)} attempts, last: ${row.lastReason}. Cleared by embeddingEncoder.resetFailedModels({ modelId: "${row.modelId}", nodeId: "${row.nodeId}" }) or a model change.`);
13832
+ }
13833
+ var EMBEDDING_REFUSAL_TOKEN = new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
13834
+ /** The refusal `err` (possibly re-wrapped by a transport) carries, or `null` for any other error. */
13835
+ function embeddingRefusalOf(err) {
13836
+ const message = err instanceof Error ? err.message : String(err);
13837
+ const match = EMBEDDING_REFUSAL_TOKEN.exec(message);
13838
+ if (match === null) return null;
13839
+ const code = EmbeddingRefusalCodeSchema.safeParse(match[1]);
13840
+ const tower = EmbeddingTowerSchema.safeParse(match[3]);
13841
+ if (!code.success || !tower.success || match[2] === void 0 || match[4] === void 0) return null;
13842
+ return {
13843
+ code: code.data,
13844
+ modelId: match[2],
13845
+ tower: tower.data,
13846
+ nodeId: match[4]
13847
+ };
13848
+ }
13849
+ /** True when `err` is the crashed-tower refusal. */
13850
+ function isEmbeddingModelFailed(err) {
13851
+ return embeddingModelFailedOf(err) !== null;
13852
+ }
13853
+ /** The model, tower and node a crashed-tower refusal names, or `null` for any other error. */
13854
+ function embeddingModelFailedOf(err) {
13855
+ const refusal = embeddingRefusalOf(err);
13856
+ if (refusal === null || refusal.code !== "embedding-model-failed") return null;
13857
+ const { modelId, tower, nodeId } = refusal;
13858
+ return {
13859
+ modelId,
13860
+ tower,
13861
+ nodeId
13862
+ };
13863
+ }
13864
+ /**
13865
+ * ONE provider per node (`placement: any-node`), addressed like every global
13866
+ * collection: the codegen injects a `{ nodeId?, addonId? }` selector on the
13867
+ * void methods and lifts a top-level `nodeId` off the object ones. A call
13868
+ * that names no node is answered by the HUB's provider — never by a merge
13869
+ * across nodes, because no global collection fans out across nodes (only the
13870
+ * providers of one node are `concatCollection`-fanned). So a fleet view of
13871
+ * `failedModels` is one `getInfo({ nodeId })` per node, and every answer
13872
+ * names the node it came from (D649 round 4); a node that cannot be asked is
13873
+ * UNKNOWN to the reader, never "no failures" (D315).
13874
+ */
13624
13875
  var embeddingEncoderCapability = {
13625
13876
  name: "embedding-encoder",
13626
13877
  scope: "system",
@@ -13639,8 +13890,30 @@ var embeddingEncoderCapability = {
13639
13890
  width: zod.z.number(),
13640
13891
  height: zod.z.number()
13641
13892
  }), EmbeddingResultSchema, { auth: "admin" }),
13642
- encodeText: require_sleep.method(zod.z.object({ text: zod.z.string() }), EmbeddingResultSchema, { auth: "admin" }),
13643
- getInfo: require_sleep.method(zod.z.void(), EmbeddingInfoSchema, { auth: "admin" })
13893
+ /**
13894
+ * `modelId` (a CLIP IMAGE model id, whose catalog `clip.textModelId` names
13895
+ * the text tower) encodes in that model's space; absent, the cluster row's
13896
+ * `clip-embedding` model — the space every writer is in (D649).
13897
+ */
13898
+ encodeText: require_sleep.method(zod.z.object({
13899
+ text: zod.z.string(),
13900
+ modelId: zod.z.string().min(1).optional()
13901
+ }), EmbeddingResultSchema, { auth: "admin" }),
13902
+ /** Answers for ONE node — the `nodeId` selector's, else the hub's. */
13903
+ getInfo: require_sleep.method(zod.z.void(), EmbeddingInfoSchema, { auth: "admin" }),
13904
+ /**
13905
+ * The operator's explicit clear of the `failed` state (one model, or all)
13906
+ * on ONE node — pass `nodeId` for an agent; the result names the node it
13907
+ * cleared. The only way out besides a model change: a crashing tower is
13908
+ * not retried on a timer.
13909
+ */
13910
+ resetFailedModels: require_sleep.method(zod.z.object({ modelId: zod.z.string().min(1).optional() }), zod.z.object({
13911
+ cleared: zod.z.array(zod.z.string()),
13912
+ nodeId: zod.z.string()
13913
+ }), {
13914
+ kind: "mutation",
13915
+ auth: "admin"
13916
+ })
13644
13917
  }
13645
13918
  };
13646
13919
  //#endregion
@@ -18030,6 +18303,24 @@ var NcMediaFrameSchema = zod.z.enum([
18030
18303
  * sensor linked to one camera ships that camera's plain snapshot either way.
18031
18304
  */
18032
18305
  var NcLinkedCameraModeSchema = zod.z.enum(["mosaic", "each"]);
18306
+ /**
18307
+ * The clip window a rule gets when it stores no `clipPreRollSec` /
18308
+ * `clipPostRollSec` (D654): 4 s before the moment, 6 s after.
18309
+ *
18310
+ * THE one owner. The Notification Center resolves an absent roll to these at
18311
+ * dispatch and sizes the broker's clip ring from them (`clip-retention-ask`).
18312
+ * The admin editor does not author the roll; the viewer editor still keeps its
18313
+ * own 3 / 7 until it imports these (viewer follow-up). A second copy is how the
18314
+ * viewer came to display 3 / 7 — copied from a stale comment on the schema
18315
+ * below — while the hub cut 4 / 6, and to prune a typed 3 back to "absent",
18316
+ * which the hub then read as 4.
18317
+ *
18318
+ * A product decision of the notification, not the broker's history window
18319
+ * (D381/D382): the clip is cut from the broker's per-camera clip ring, which
18320
+ * the rules size, not from a pre-roll dial.
18321
+ */
18322
+ var NC_CLIP_PRE_ROLL_DEFAULT_SEC = 4;
18323
+ var NC_CLIP_POST_ROLL_DEFAULT_SEC = 6;
18033
18324
  var NcMediaPolicySchema = zod.z.object({
18034
18325
  attach: zod.z.enum([
18035
18326
  "best",
@@ -18057,7 +18348,12 @@ var NcMediaPolicySchema = zod.z.object({
18057
18348
  * the degrade engine, which drops the video and keeps the still.
18058
18349
  */
18059
18350
  clip: zod.z.boolean().optional(),
18060
- /** Seconds of footage BEFORE / AFTER the event instant. Defaults 3 / 7. */
18351
+ /**
18352
+ * Seconds of footage BEFORE / AFTER the event instant. Absent =
18353
+ * {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
18354
+ * (4 / 6), resolved by the Notification Center at dispatch — deliberately not
18355
+ * a Zod default, so a rule that never chose keeps following the hub's.
18356
+ */
18061
18357
  clipPreRollSec: zod.z.number().int().min(0).max(30).optional(),
18062
18358
  clipPostRollSec: zod.z.number().int().min(0).max(30).optional(),
18063
18359
  /**
@@ -20211,6 +20507,275 @@ var oauthIntegrationCapability = {
20211
20507
  getDescriptor: require_sleep.method(zod.z.void(), OauthIntegrationDescriptorSchema, { auth: "admin" }) }
20212
20508
  };
20213
20509
  //#endregion
20510
+ //#region src/pipeline/cluster-model-scope.ts
20511
+ /**
20512
+ * A model choice has a SCOPE, and a scope change has a workflow.
20513
+ *
20514
+ * ## The two scopes
20515
+ *
20516
+ * Almost every pipeline step's model is a **node** question: which build runs
20517
+ * fastest on THIS accelerator. Two nodes may legitimately answer differently —
20518
+ * a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
20519
+ * are compared against nothing. They produce boxes, and a box is a box.
20520
+ *
20521
+ * Two steps are not like that. `face-embedding` and `clip-embedding` produce
20522
+ * **vectors that land in ONE shared index** (`identity_samples`,
20523
+ * `vec_object_clip`) and are ranked against each other by cosine similarity.
20524
+ * Cosine similarity between two encoders is not a weak signal, it is a
20525
+ * meaningless number — and nothing inside a vector can tell you it happened.
20526
+ * So for those two steps the model is a **cluster** question with exactly one
20527
+ * answer, stored in exactly one row.
20528
+ *
20529
+ * That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
20530
+ * for the crop convention (`detail-crop.ts`), one level up: the crop decides
20531
+ * WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
20532
+ * cluster-wide for the same reason and neither may become per-node.
20533
+ *
20534
+ * ## Why the registry lives here and not in the step catalog
20535
+ *
20536
+ * The scope itself is declared on the step, in
20537
+ * `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
20538
+ * — that is where a new step declares what kind of choice its model is. But the
20539
+ * catalog lives inside `addon-pipeline`, and three packages that must NOT
20540
+ * import an addon need to know the set: the orchestrator (which renders and
20541
+ * stores the row), post-analysis (which pins the row for a re-embed pass) and
20542
+ * admin-ui (which mirrors it). So the set is mirrored here, and
20543
+ * `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
20544
+ * A hand-copied key that stops matching is exactly how a setting silently stops
20545
+ * arriving while both sides still look correct.
20546
+ *
20547
+ * ## The defaults ARE today's behaviour
20548
+ *
20549
+ * {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
20550
+ * of both steps. Declaring the scope therefore changes nothing on the day it
20551
+ * ships: the cluster row starts out saying what every node was already doing.
20552
+ * Changing it is legitimate — that is what the knob is for — but it invalidates
20553
+ * the stored vectors of that surface, and must be followed by a re-embed pass
20554
+ * (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
20555
+ */
20556
+ /**
20557
+ * Why the orchestrator cannot say which model the operator chose for a
20558
+ * cluster-scoped step (D651).
20559
+ */
20560
+ var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
20561
+ "owner-not-ready",
20562
+ "store-read-failed",
20563
+ "three-way-read-unavailable",
20564
+ "invalid-stored",
20565
+ "not-cluster-scoped"
20566
+ ];
20567
+ /**
20568
+ * The cluster-scoped steps. Mirrored from the catalog's `modelScope: 'cluster'`
20569
+ * declarations and guarded by `scripts/check-cluster-model-scope.ts`.
20570
+ */
20571
+ var CLUSTER_MODEL_SCOPED_STEPS = [{
20572
+ stepId: "face-embedding",
20573
+ label: "Face recognition model",
20574
+ defaultModelId: "auraface-r100",
20575
+ indexName: "the enrolled face gallery",
20576
+ options: [
20577
+ {
20578
+ id: "auraface-r100",
20579
+ label: "AuraFace R100"
20580
+ },
20581
+ {
20582
+ id: "arcface-r100",
20583
+ label: "ArcFace (ResNet34)"
20584
+ },
20585
+ {
20586
+ id: "inception-resnet-v1",
20587
+ label: "Inception ResNet V1"
20588
+ }
20589
+ ]
20590
+ }, {
20591
+ stepId: "clip-embedding",
20592
+ label: "Semantic search model",
20593
+ defaultModelId: "mobileclip-s1",
20594
+ indexName: "the object semantic-search index",
20595
+ options: [
20596
+ {
20597
+ id: "mobileclip-s1",
20598
+ label: "MobileCLIP S1"
20599
+ },
20600
+ {
20601
+ id: "mobileclip-s2",
20602
+ label: "MobileCLIP S2"
20603
+ },
20604
+ {
20605
+ id: "siglip2-b16-224",
20606
+ label: "SigLIP2 B/16 (Apache-2.0)"
20607
+ }
20608
+ ]
20609
+ }];
20610
+ /**
20611
+ * Store identity of the cluster row inside `pipeline-orchestrator`'s GLOBAL
20612
+ * (cluster-wide) settings — the same owner, and for the same reason, as the
20613
+ * detail-crop convention: hub-resident and neutral between the addons that
20614
+ * read it.
20615
+ */
20616
+ var CLUSTER_MODEL_SECTION_ID = "cluster-step-models";
20617
+ /**
20618
+ * The settings key holding one step's cluster model choice.
20619
+ *
20620
+ * Step-qualified so the keys stay unique across the addon's whole schema, which
20621
+ * is what lets {@link pickClusterStepModels} walk every section instead of
20622
+ * trusting the section id.
20623
+ */
20624
+ function clusterModelSettingKey(stepId) {
20625
+ return `clusterModel:${stepId}`;
20626
+ }
20627
+ /** True when this step's model is a cluster-wide choice rather than a per-node one. */
20628
+ function isClusterScopedStep(stepId) {
20629
+ return CLUSTER_MODEL_SCOPED_STEPS.some((s) => s.stepId === stepId);
20630
+ }
20631
+ /** The cluster row when nobody has configured one — today's catalog defaults. */
20632
+ var DEFAULT_CLUSTER_STEP_MODELS = Object.freeze(Object.fromEntries(CLUSTER_MODEL_SCOPED_STEPS.map((s) => [s.stepId, s.defaultModelId])));
20633
+ function interpretStoredClusterModel(raw) {
20634
+ if (raw === void 0 || raw === null || raw === "") return { kind: "absent" };
20635
+ if (typeof raw === "string") return {
20636
+ kind: "chosen",
20637
+ modelId: raw
20638
+ };
20639
+ return {
20640
+ kind: "invalid",
20641
+ value: raw
20642
+ };
20643
+ }
20644
+ /**
20645
+ * The cluster-scoped steps whose stored value is `invalid` under
20646
+ * {@link interpretStoredClusterModel} — for the runtime's log line, so the
20647
+ * default it runs on such a row is never run in silence.
20648
+ */
20649
+ function invalidClusterStepModelEntries(config) {
20650
+ const out = [];
20651
+ for (const step of CLUSTER_MODEL_SCOPED_STEPS) {
20652
+ const read = interpretStoredClusterModel(config[clusterModelSettingKey(step.stepId)]);
20653
+ if (read.kind === "invalid") out.push({
20654
+ stepId: step.stepId,
20655
+ value: read.value
20656
+ });
20657
+ }
20658
+ return out;
20659
+ }
20660
+ /**
20661
+ * Narrow a FLAT settings record to the cluster row.
20662
+ *
20663
+ * Per-FIELD fallback, deliberately (same rule as `readDetailCropConvention`): a
20664
+ * junk face model must not also discard a valid clip model. An `absent` or
20665
+ * `invalid` value ({@link interpretStoredClusterModel}) resolves to the step's
20666
+ * catalog default — never to a blank id, because a blank id downstream becomes
20667
+ * "substitute the format default", which is precisely the substitution this
20668
+ * scope exists to forbid.
20669
+ */
20670
+ function readClusterStepModels(config) {
20671
+ const out = {};
20672
+ for (const step of CLUSTER_MODEL_SCOPED_STEPS) {
20673
+ const read = interpretStoredClusterModel(config[clusterModelSettingKey(step.stepId)]);
20674
+ out[step.stepId] = read.kind === "chosen" ? read.modelId : step.defaultModelId;
20675
+ }
20676
+ return out;
20677
+ }
20678
+ function isHydratedField$2(entry) {
20679
+ return typeof entry === "object" && entry !== null && "key" in entry;
20680
+ }
20681
+ /**
20682
+ * Extract the cluster row from an `addon-settings.getGlobalSettings` payload.
20683
+ *
20684
+ * Walks EVERY section rather than looking inside {@link CLUSTER_MODEL_SECTION_ID}
20685
+ * alone: the keys are unique across the addon's schema, and a section rename
20686
+ * must not silently revert the whole cluster to the defaults. A `null` payload
20687
+ * (addon mid-boot) is the defaults.
20688
+ */
20689
+ function pickClusterStepModels(view) {
20690
+ if (view === null) return DEFAULT_CLUSTER_STEP_MODELS;
20691
+ return readClusterStepModels(flattenHydratedView(view, clusterModelKeys()));
20692
+ }
20693
+ /**
20694
+ * The `invalid` stored cluster model values a hydrated view carries — what the
20695
+ * runtime logs when it runs a default on a row it could not read as a choice.
20696
+ * A `null` view (owner mid-boot) carries nothing to judge.
20697
+ */
20698
+ function pickInvalidClusterStepModels(view) {
20699
+ if (view === null) return [];
20700
+ return invalidClusterStepModelEntries(flattenHydratedView(view, clusterModelKeys()));
20701
+ }
20702
+ function clusterModelKeys() {
20703
+ return new Set(CLUSTER_MODEL_SCOPED_STEPS.map((s) => clusterModelSettingKey(s.stepId)));
20704
+ }
20705
+ /** The `wanted` keys of a hydrated view as one flat record, every section walked. */
20706
+ function flattenHydratedView(view, wanted) {
20707
+ const flat = {};
20708
+ for (const section of view.sections) for (const entry of section.fields) {
20709
+ if (!isHydratedField$2(entry) || typeof entry.key !== "string") continue;
20710
+ if (wanted.has(entry.key)) flat[entry.key] = entry.value;
20711
+ }
20712
+ return flat;
20713
+ }
20714
+ /**
20715
+ * The cluster model for `stepId`, or `null` when the step is node-scoped.
20716
+ *
20717
+ * `null` is the signal to LEAVE THE CALLER'S RESOLUTION ALONE — it is not "no
20718
+ * model". Returning a default here for a node-scoped step would quietly
20719
+ * override every per-(node,device) selection in the fleet.
20720
+ */
20721
+ function resolveClusterStepModelId(stepId, models) {
20722
+ const step = CLUSTER_MODEL_SCOPED_STEPS.find((s) => s.stepId === stepId);
20723
+ if (step === void 0) return null;
20724
+ const chosen = models[stepId];
20725
+ return chosen !== void 0 && chosen !== "" ? chosen : step.defaultModelId;
20726
+ }
20727
+ /** Must match `DEFAULT_LANDMARK_PRECISION_FLOOR_PX` in the runner. */
20728
+ var DEFAULT_MIN_LANDMARK_FACE_SIZE_PX = 24;
20729
+ var CLUSTER_STEP_SETTING_FIELDS = [{
20730
+ stepId: "face-embedding",
20731
+ key: "minLandmarkFaceSize",
20732
+ label: "Min face size for recognition (detection px)",
20733
+ 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.",
20734
+ type: "slider",
20735
+ min: 0,
20736
+ max: 64,
20737
+ step: 2,
20738
+ default: 24
20739
+ }];
20740
+ function clusterStepSettingKey(stepId, fieldKey) {
20741
+ return `clusterStepSetting:${stepId}:${fieldKey}`;
20742
+ }
20743
+ function clusterStepSettingFieldsFor(stepId) {
20744
+ return CLUSTER_STEP_SETTING_FIELDS.filter((field) => field.stepId === stepId);
20745
+ }
20746
+ var ClusterSettingNumberSchema = zod.z.number().finite();
20747
+ function readClusterStepSettings(config) {
20748
+ const out = {};
20749
+ for (const field of CLUSTER_STEP_SETTING_FIELDS) {
20750
+ const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
20751
+ const value = parsed.success ? parsed.data : field.default;
20752
+ const existing = out[field.stepId] ?? {};
20753
+ out[field.stepId] = {
20754
+ ...existing,
20755
+ [field.key]: value
20756
+ };
20757
+ }
20758
+ return out;
20759
+ }
20760
+ var DEFAULT_CLUSTER_STEP_SETTINGS = readClusterStepSettings({});
20761
+ function pickClusterStepSettings(view) {
20762
+ if (view === null) return DEFAULT_CLUSTER_STEP_SETTINGS;
20763
+ return readClusterStepSettings(flattenHydratedView(view, new Set(CLUSTER_STEP_SETTING_FIELDS.map((field) => clusterStepSettingKey(field.stepId, field.key)))));
20764
+ }
20765
+ /**
20766
+ * Cluster knobs win over leftover per-device values. The cluster row is the
20767
+ * authority; a device-local copy is a leftover of the old per-node editor.
20768
+ */
20769
+ function overlayClusterStepSettings(stepId, deviceSettings, cluster) {
20770
+ const overlay = cluster[stepId];
20771
+ if (overlay === void 0 || Object.keys(overlay).length === 0) return deviceSettings === void 0 ? void 0 : { ...deviceSettings };
20772
+ if (deviceSettings === void 0) return { ...overlay };
20773
+ return {
20774
+ ...deviceSettings,
20775
+ ...overlay
20776
+ };
20777
+ }
20778
+ //#endregion
20214
20779
  //#region src/capabilities/pipeline-analytics.cap.ts
20215
20780
  /**
20216
20781
  * pipeline-analytics — device-scoped wrapper cap. Refines raw
@@ -21063,7 +21628,8 @@ var MediaFileKindEnum = zod.z.enum([
21063
21628
  "thumbnailSmall",
21064
21629
  "confirmationCrop",
21065
21630
  "debugCrop",
21066
- "sceneFrame"
21631
+ "sceneFrame",
21632
+ "lastSceneFrame"
21067
21633
  ]);
21068
21634
  /**
21069
21635
  * One media row's IDENTITY and shape, with no representation of its bytes.
@@ -21652,7 +22218,23 @@ var SearchObjectEventsInput = zod.z.object({
21652
22218
  until: zod.z.number().optional(),
21653
22219
  classFilter: zod.z.string().optional(),
21654
22220
  limit: zod.z.number().default(50),
21655
- minScore: zod.z.number().min(0).max(1).default(.2)
22221
+ /**
22222
+ * An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
22223
+ * model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
22224
+ * so an absent one resolves to the searched model's own `searchMinScore`
22225
+ * scaled by `strictness`. A number sent here is honoured verbatim.
22226
+ */
22227
+ minScore: zod.z.number().min(0).max(1).optional(),
22228
+ /** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
22229
+ strictness: ClipSearchStrictnessSchema.optional(),
22230
+ /**
22231
+ * Search THIS CLIP model's index instead of the cluster row's. Every index a
22232
+ * model ever wrote stays searchable until it is wiped (the MobileCLIP index
22233
+ * through a SigLIP2 cutover and its rollback window). An id with no CLIP
22234
+ * metadata is refused; an id other than the cluster row's is ADMIN-only
22235
+ * (`model-override-requires-admin`).
22236
+ */
22237
+ modelId: zod.z.string().min(1).optional()
21656
22238
  });
21657
22239
  var TrackCascadeCountsSchema = zod.z.object({
21658
22240
  /** Persisted track roots deleted (authoritative). */
@@ -21787,7 +22369,41 @@ var RebuildObjectEmbeddingsInput = zod.z.object({
21787
22369
  * comparable, so wiping and rebuilding is the only way to be sure every vector
21788
22370
  * means the same thing.
21789
22371
  */
21790
- var WipeObjectEmbeddingsResultSchema = zod.z.object({ deleted: zod.z.number() });
22372
+ var WipeObjectEmbeddingsResultSchema = zod.z.object({
22373
+ deleted: zod.z.number(),
22374
+ /**
22375
+ * CLIP indexes that could NOT be emptied (unreachable, or refused at their
22376
+ * dimension) — not a clean slate. Additive and optional (D649).
22377
+ */
22378
+ failedIndexes: zod.z.array(zod.z.string()).optional()
22379
+ });
22380
+ /**
22381
+ * Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
22382
+ * of a pass (D649 over D651). A bare `started: false` read the same for "the
22383
+ * stores are booting" and "the cluster row names a model with no CLIP
22384
+ * metadata", which need different fixes.
22385
+ * - `stores-unavailable` — the analytics stores or the API are not up yet.
22386
+ * - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
22387
+ * a pass that rewrites an index needs two agreeing reads of the OWNER's
22388
+ * answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
22389
+ * name its model does not run (D54):
22390
+ * - the owner's own `unreadable` reasons (`owner-not-ready`,
22391
+ * `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
22392
+ * `not-cluster-scoped`);
22393
+ * - `method-unavailable` — the orchestrator predates the method;
22394
+ * - `read-failed` — the call failed or answered something unparseable;
22395
+ * - `reads-disagree` — the two reads named different choices.
22396
+ * - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
22397
+ * index to fill and no dimension to check against (D649).
22398
+ */
22399
+ var RebuildObjectEmbeddingsRefusalSchema = zod.z.enum([
22400
+ "stores-unavailable",
22401
+ ...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
22402
+ "method-unavailable",
22403
+ "read-failed",
22404
+ "reads-disagree",
22405
+ "not-a-clip-model"
22406
+ ]);
21791
22407
  /**
21792
22408
  * Acknowledgement that a rebuild STARTED.
21793
22409
  *
@@ -21800,7 +22416,12 @@ var WipeObjectEmbeddingsResultSchema = zod.z.object({ deleted: zod.z.number() })
21800
22416
  var RebuildObjectEmbeddingsResultSchema = zod.z.object({
21801
22417
  started: zod.z.boolean(),
21802
22418
  /** True when a pass was already running; the new request is ignored. */
21803
- alreadyRunning: zod.z.boolean()
22419
+ alreadyRunning: zod.z.boolean(),
22420
+ /** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
22421
+ refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
22422
+ /** The CLIP model the pass pinned, and the index it fills (when it started). */
22423
+ modelId: zod.z.string().optional(),
22424
+ index: zod.z.string().optional()
21804
22425
  });
21805
22426
  var RebuildStatusSchema = zod.z.object({
21806
22427
  running: zod.z.boolean(),
@@ -21834,7 +22455,11 @@ var RebuildStatusSchema = zod.z.object({
21834
22455
  startedAtMs: zod.z.number().nullable(),
21835
22456
  finishedAtMs: zod.z.number().nullable(),
21836
22457
  /** Present when the pass ended by throwing. */
21837
- error: zod.z.string().nullable()
22458
+ error: zod.z.string().nullable(),
22459
+ /** The CLIP model the current / last pass pinned (D54), `null` before any. */
22460
+ modelId: zod.z.string().nullable(),
22461
+ /** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
22462
+ index: zod.z.string().nullable()
21838
22463
  });
21839
22464
  /**
21840
22465
  * Acknowledgement that a debug-media reclaim STARTED.
@@ -22812,7 +23437,7 @@ var pipelineAnalyticsCapability = {
22812
23437
  * ObjectEvents by trackId. Returns up to `limit` events scored ≥
22813
23438
  * `minScore`, sorted descending by score.
22814
23439
  */
22815
- searchObjectEvents: require_sleep.method(SearchObjectEventsInput, zod.z.array(ScoredObjectEventSchema).readonly()),
23440
+ searchObjectEvents: require_sleep.method(SearchObjectEventsInput, zod.z.array(ScoredObjectEventSchema).readonly(), { caller: "required" }),
22816
23441
  wipeObjectEmbeddings: require_sleep.method(zod.z.object({}), WipeObjectEmbeddingsResultSchema, {
22817
23442
  kind: "mutation",
22818
23443
  auth: "admin"
@@ -24115,6 +24740,17 @@ var RunnerFrameSourceSchema = zod.z.discriminatedUnion("kind", [zod.z.object({ k
24115
24740
  hubHostnameOverride: zod.z.string().optional()
24116
24741
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
24117
24742
  /**
24743
+ * What ONE step runs with on ONE roster device for THIS camera (D650): the
24744
+ * device's per-(node,device) base with the camera's override for that device
24745
+ * on top — the same `override ?? base` merge the orchestrator applies to the
24746
+ * elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
24747
+ * resolves the device format's default, exactly as on the elected device.
24748
+ */
24749
+ var RunnerJumpStepProvisioningSchema = zod.z.object({
24750
+ modelId: zod.z.string().optional(),
24751
+ settings: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
24752
+ });
24753
+ /**
24118
24754
  * One ENABLED inference device on the runner's node, as the step-tree
24119
24755
  * device-jump resolver sees it (phase 1). The orchestrator populates this
24120
24756
  * roster on the attach payload whenever the camera is elected onto a specific
@@ -24126,7 +24762,16 @@ var RunnerFrameSourceSchema = zod.z.discriminatedUnion("kind", [zod.z.object({ k
24126
24762
  var RunnerInferenceDeviceSchema = zod.z.object({
24127
24763
  deviceKey: zod.z.string(),
24128
24764
  weight: zod.z.number().positive().default(1),
24129
- maxSessions: zod.z.number().int().positive().nullable().default(null)
24765
+ maxSessions: zod.z.number().int().positive().nullable().default(null),
24766
+ /**
24767
+ * Per-step provisioning for this camera on THIS device (D650), keyed by step
24768
+ * id. A step the runner jumps here runs with these fields, never with the
24769
+ * elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
24770
+ * (a step absent from the map runs with neither — the target format default).
24771
+ * Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
24772
+ * the elected device's provisioning, as before.
24773
+ */
24774
+ steps: zod.z.record(zod.z.string(), RunnerJumpStepProvisioningSchema).optional()
24130
24775
  });
24131
24776
  /**
24132
24777
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
@@ -25438,6 +26083,28 @@ var NodeInferenceDeviceSchema = zod.z.object({
25438
26083
  */
25439
26084
  exclusion: InferenceDeviceExclusionReasonSchema.nullable()
25440
26085
  });
26086
+ /**
26087
+ * The operator's model choice for one cluster-scoped step, answered by the
26088
+ * addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
26089
+ * folded: a written choice, a key nobody wrote (the cluster runs the default
26090
+ * BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
26091
+ * first two, read twice and agreeing.
26092
+ */
26093
+ var ClusterModelChoiceSchema = zod.z.discriminatedUnion("kind", [
26094
+ zod.z.object({
26095
+ kind: zod.z.literal("stored"),
26096
+ modelId: zod.z.string()
26097
+ }),
26098
+ zod.z.object({
26099
+ kind: zod.z.literal("absent"),
26100
+ defaultModelId: zod.z.string()
26101
+ }),
26102
+ zod.z.object({
26103
+ kind: zod.z.literal("unreadable"),
26104
+ reason: zod.z.enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
26105
+ error: zod.z.string().optional()
26106
+ })
26107
+ ]);
25441
26108
  var NodeInferenceDevicesSchema = zod.z.object({
25442
26109
  nodeId: zod.z.string(),
25443
26110
  /** False when the node's platform-probe was unreachable (no live device set). */
@@ -25534,9 +26201,19 @@ var pipelineOrchestratorCapability = {
25534
26201
  * Trigger a full rebalance pass. Iterates over all assigned cameras,
25535
26202
  * recomputes the optimal agent for each one based on current load +
25536
26203
  * hardware affinity, and migrates cameras whose current agent is no
25537
- * longer optimal. Pinned cameras are never migrated.
26204
+ * longer optimal. Pinned cameras are never migrated. `skipped` names the
26205
+ * cameras the pass wanted to move and could not, with why — a target node
26206
+ * that has not answered its catalog / device health yet, or a device that
26207
+ * cannot run the camera's root (D650).
25538
26208
  */
25539
- rebalance: require_sleep.method(zod.z.void(), zod.z.object({ migrated: zod.z.number() }), {
26209
+ rebalance: require_sleep.method(zod.z.void(), zod.z.object({
26210
+ migrated: zod.z.number(),
26211
+ skipped: zod.z.array(zod.z.object({
26212
+ deviceId: zod.z.number(),
26213
+ targetNodeId: zod.z.string(),
26214
+ reason: zod.z.string()
26215
+ })).default([])
26216
+ }), {
25540
26217
  kind: "mutation",
25541
26218
  auth: "admin"
25542
26219
  }),
@@ -25546,6 +26223,13 @@ var pipelineOrchestratorCapability = {
25546
26223
  getPipelineAssignment: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), PipelineAssignmentSchema.nullable()),
25547
26224
  /** Get per-agent load summaries used by the load balancer + dashboards. */
25548
26225
  getAgentLoad: require_sleep.method(zod.z.void(), zod.z.array(AgentLoadSummarySchema).readonly()),
26226
+ /**
26227
+ * The operator's STORED model choice for one cluster-scoped step (D651).
26228
+ * Read three-way from this addon's own store, only once its boot has
26229
+ * settled. Unlike `addonSettings.getGlobalSettings`, it never answers a
26230
+ * default as though someone chose it.
26231
+ */
26232
+ getClusterModelChoice: require_sleep.method(zod.z.object({ stepId: zod.z.string() }), ClusterModelChoiceSchema),
25549
26233
  /** Aggregate global metrics across the whole detection cluster. */
25550
26234
  getGlobalMetrics: require_sleep.method(zod.z.void(), GlobalMetricsSchema),
25551
26235
  /**
@@ -28074,6 +28758,24 @@ var VectorScanResultSchema = zod.z.object({
28074
28758
  */
28075
28759
  nextCursor: zod.z.number().int().nonnegative().nullable()
28076
28760
  });
28761
+ /**
28762
+ * The ONE error code for "this index exists at another dimension; refusing to
28763
+ * redeclare it" (D649). It rides in the MESSAGE — an Error's own properties do
28764
+ * not survive the UDS/tRPC hop, its message does — and both sides go through
28765
+ * the helpers below, never a copied phrase: a consumer that must tell "this
28766
+ * index can never hold my vectors" from "the provider is unreachable" (a
28767
+ * delete counts the first as nothing-to-delete and the second as still
28768
+ * present) otherwise breaks silently the day the wording changes.
28769
+ */
28770
+ var VECTOR_INDEX_DIM_CONFLICT = "vector-index-dim-conflict";
28771
+ /** The provider's refusal, carrying {@link VECTOR_INDEX_DIM_CONFLICT}. */
28772
+ function vectorIndexDimConflictError(index, declaredDim, requestedDim) {
28773
+ return /* @__PURE__ */ new Error(`[${VECTOR_INDEX_DIM_CONFLICT}] vector-store: index "${index}" is declared with dim ${String(declaredDim)}; refusing to redeclare as ${String(requestedDim)}`);
28774
+ }
28775
+ /** True when `err` (possibly re-wrapped by a transport) is that refusal. */
28776
+ function isVectorIndexDimConflict(err) {
28777
+ return (err instanceof Error ? err.message : String(err)).includes(`[${VECTOR_INDEX_DIM_CONFLICT}]`);
28778
+ }
28077
28779
  var VectorStatsInputSchema = zod.z.object({ index: zod.z.string() });
28078
28780
  var VectorStatsResultSchema = zod.z.object({
28079
28781
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -29254,6 +29956,487 @@ var CLIP_PLAYBACK_OPTIONS = {
29254
29956
  }
29255
29957
  };
29256
29958
  //#endregion
29959
+ //#region src/catalogs/sensor-active-state.ts
29960
+ /**
29961
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
29962
+ * valutatore puro del suo FRONTE.
29963
+ *
29964
+ * Viveva dentro il builtin virtual-doorbell
29965
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
29966
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
29967
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
29968
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
29969
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
29970
+ * SPOSTA qui e il doorbell la ri-esporta.
29971
+ *
29972
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
29973
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
29974
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
29975
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
29976
+ */
29977
+ /**
29978
+ * Known binary / switch source caps → the boolean slice field whose
29979
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
29980
+ * Sensors whose "active" reading is not a plain boolean (presence's string
29981
+ * state, connectivity's connected flag) are deliberately excluded — a
29982
+ * reconnect is not a doorbell press, and it is not a recording either.
29983
+ */
29984
+ var SOURCE_CAP_ACTIVE_FIELD = {
29985
+ contact: "entryOpen",
29986
+ binary: "on",
29987
+ switch: "on",
29988
+ motion: "detected",
29989
+ flood: "flooded",
29990
+ gas: "detected",
29991
+ smoke: "detected",
29992
+ "carbon-monoxide": "detected",
29993
+ vibration: "detected",
29994
+ tamper: "tampered"
29995
+ };
29996
+ /**
29997
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
29998
+ * last transition. Every source cap MUST appear here (guarded by a spec):
29999
+ * without a transition timestamp the evaluator cannot tell a genuine rise
30000
+ * from a boot-time hydration when the FIRST slice it ever sees is already
30001
+ * active, and errs towards silence — swallowing the rise.
30002
+ *
30003
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
30004
+ * provider derives them from `state.last_changed`, so they survive our own
30005
+ * restarts and correctly read as "hours ago" for a state that has been
30006
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
30007
+ */
30008
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
30009
+ contact: "lastChangedAt",
30010
+ binary: "lastChangedAt",
30011
+ switch: "lastChangedAt",
30012
+ motion: "lastDetectedAt",
30013
+ flood: "lastChangedAt",
30014
+ gas: "lastChangedAt",
30015
+ smoke: "lastChangedAt",
30016
+ "carbon-monoxide": "lastChangedAt",
30017
+ vibration: "lastChangedAt",
30018
+ tamper: "lastChangedAt"
30019
+ };
30020
+ /** Cap names whose presence in a device's bindings qualify it as a source. */
30021
+ var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
30022
+ /**
30023
+ * Device `type` values (from `DeviceType`) that can host a binary/switch
30024
+ * source cap. Used by the camera's `device-multiselect` picker as the
30025
+ * CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
30026
+ *
30027
+ * Why types and not caps alone: the shared picker filters
30028
+ * `deviceManager.listAll` rows client-side, and those rows carry only the
30029
+ * device's advertised `features` — NOT its registered cap list. On the live
30030
+ * cluster binary sensors and switches advertise EMPTY features (features
30031
+ * mirror only a handful of caps like `motion-trigger`), so a caps-only
30032
+ * filter matched against `features` would list nothing (the very bug this
30033
+ * replaced, which relied on the now-empty `getAllBindings`). Matching by
30034
+ * `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
30035
+ * still captures any device that DOES advertise a source-cap feature.
30036
+ * `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
30037
+ * `switch` covers switches, `control` covers generic binary actuators.
30038
+ */
30039
+ var SOURCE_DEVICE_TYPES = [
30040
+ "sensor",
30041
+ "switch",
30042
+ "control"
30043
+ ];
30044
+ /** True when a cap is a recognised binary/switch source. */
30045
+ function isSourceCap(capName) {
30046
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
30047
+ }
30048
+ /** Extract the "active" boolean a source cap's slice carries, or null when
30049
+ * the cap is unknown or the field is missing / non-boolean. */
30050
+ function sliceActiveValue(capName, slice) {
30051
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
30052
+ if (field === void 0) return null;
30053
+ const raw = slice[field];
30054
+ return typeof raw === "boolean" ? raw : null;
30055
+ }
30056
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
30057
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
30058
+ function sliceChangedAt(capName, slice) {
30059
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
30060
+ if (field === void 0) return null;
30061
+ const raw = slice[field];
30062
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
30063
+ return raw;
30064
+ }
30065
+ /**
30066
+ * How recent a source's own transition timestamp must be for a FIRST
30067
+ * sighting that is already active to count as a genuine rise rather than a
30068
+ * hydration of long-standing state.
30069
+ */
30070
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
30071
+ /**
30072
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
30073
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
30074
+ *
30075
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
30076
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
30077
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
30078
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
30079
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
30080
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
30081
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
30082
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
30083
+ */
30084
+ function evaluateSensorEdge(input) {
30085
+ const value = sliceActiveValue(input.capName, input.slice);
30086
+ if (value === null) return {
30087
+ edge: "none",
30088
+ value: null,
30089
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
30090
+ };
30091
+ if (input.prior === void 0) {
30092
+ if (!value) return {
30093
+ edge: "none",
30094
+ value,
30095
+ reason: "baseline-seeded-inactive"
30096
+ };
30097
+ const changedAt = sliceChangedAt(input.capName, input.slice);
30098
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
30099
+ if (changedAt === null || changedAt < floor) return {
30100
+ edge: "none",
30101
+ value,
30102
+ reason: "baseline-seeded-stale-active"
30103
+ };
30104
+ return {
30105
+ edge: "rising",
30106
+ value: true
30107
+ };
30108
+ }
30109
+ if (input.prior === value) return {
30110
+ edge: "none",
30111
+ value,
30112
+ reason: "no-change"
30113
+ };
30114
+ if (!value) return {
30115
+ edge: "none",
30116
+ value,
30117
+ reason: "falling-edge"
30118
+ };
30119
+ return {
30120
+ edge: "rising",
30121
+ value: true
30122
+ };
30123
+ }
30124
+ //#endregion
30125
+ //#region src/capabilities/doorbell.cap.ts
30126
+ /**
30127
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
30128
+ * name (same pattern as `snapshot`):
30129
+ *
30130
+ * - **Native** providers: registered per-device by device-driver
30131
+ * addons via `ctx.registerNativeCap` — either on a
30132
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
30133
+ * or directly on the camera (Reolink registers at camera level).
30134
+ * Emits an `onPressed` event every time the firmware pushes a
30135
+ * ring; status tracks the last press and a pressCount since start
30136
+ * (diagnostic).
30137
+ *
30138
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
30139
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
30140
+ * device (contact / switch / event-emitter …) into a doorbell for
30141
+ * a camera. `defaultActive: false` — the operator explicitly binds
30142
+ * it per camera in the device-bindings UI, then picks the source
30143
+ * device + trigger in the per-device settings.
30144
+ *
30145
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent
30146
+ * — subscribers listening at the camera level receive ring events
30147
+ * with `via[]` populated. No code on the parent needed.
30148
+ */
30149
+ var DoorbellStatusSchema = zod.z.object({
30150
+ /** Ms epoch of the last press. null = never observed since this provider started. */
30151
+ lastPressedAt: zod.z.number().nullable(),
30152
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
30153
+ pressCountSinceStart: zod.z.number()
30154
+ });
30155
+ var DoorbellPressEventSchema = zod.z.object({
30156
+ deviceId: zod.z.number(),
30157
+ timestamp: zod.z.number()
30158
+ });
30159
+ /**
30160
+ * The `doorbell-source` extension slot's editable value (D648): the camera's
30161
+ * virtual-doorbell trigger devices, exactly what the wrapper's
30162
+ * `doorbellSources` persists (as `{ deviceId }` records).
30163
+ */
30164
+ var DoorbellSourceSlotValueSchema = zod.z.object({ deviceIds: zod.z.array(zod.z.number().int().positive()) });
30165
+ /**
30166
+ * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
30167
+ * doorbell, owned by the `virtual-doorbell` wrapper over its
30168
+ * `doorbellSources` store (D648). A source rings when one of its
30169
+ * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
30170
+ * different authority (`deviceManager.setWrapperActive`, D62) — the slot
30171
+ * reports it, it never writes it.
30172
+ */
30173
+ var DOORBELL_SOURCE_SLOT = {
30174
+ id: "doorbell-source",
30175
+ label: "Doorbell trigger devices",
30176
+ 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.",
30177
+ shape: "association",
30178
+ hostDeviceTypes: [require_sleep.DeviceType.Camera],
30179
+ sourceCaps: SOURCE_CAPS,
30180
+ cardinality: "many",
30181
+ value: DoorbellSourceSlotValueSchema
30182
+ };
30183
+ var doorbellCapability = {
30184
+ name: "doorbell",
30185
+ scope: "device",
30186
+ deviceNative: true,
30187
+ mode: "singleton",
30188
+ kind: "wrapper",
30189
+ defaultActive: false,
30190
+ deviceTypes: [require_sleep.DeviceType.Button, require_sleep.DeviceType.Camera],
30191
+ exposesDeviceSettings: true,
30192
+ extensionSlots: [DOORBELL_SOURCE_SLOT],
30193
+ methods: {},
30194
+ events: {
30195
+ /**
30196
+ * Fires once per physical press. Reolink delivers via Baichuan
30197
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
30198
+ * release/duration — it's a pulse.
30199
+ */
30200
+ onPressed: { data: DoorbellPressEventSchema } },
30201
+ status: {
30202
+ schema: DoorbellStatusSchema,
30203
+ kind: "push"
30204
+ },
30205
+ /**
30206
+ * Runtime-state slice — last press timestamp + lifetime press count.
30207
+ * Mirrored by the kernel and readable via
30208
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
30209
+ * without subscribing.
30210
+ */
30211
+ runtimeState: DoorbellStatusSchema,
30212
+ /**
30213
+ * 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.
30214
+ *
30215
+ * See `RuntimeStateDurability`. Enforced by
30216
+ * `scripts/check-runtime-state-durability.ts`.
30217
+ */
30218
+ durability: "restored"
30219
+ };
30220
+ //#endregion
30221
+ //#region src/generated/extension-slots.ts
30222
+ /**
30223
+ * AUTO-GENERATED by scripts/generate-extension-slots.ts — DO NOT EDIT.
30224
+ *
30225
+ * Every extension slot declared by a capability (`extensionSlots` in its
30226
+ * `*.cap.ts`, D648), folded into one typed table. Imports ONLY the declaring
30227
+ * caps' descriptors and value schemas — never the caps barrel — so
30228
+ * `device-extension.cap.ts` can import this module without a cycle.
30229
+ *
30230
+ * Coverage: 2 slot(s).
30231
+ */
30232
+ /** Every declared slot id, in table order. */
30233
+ var EXTENSION_SLOT_IDS = ["doorbell-source", "linked-devices"];
30234
+ var ExtensionSlotIdSchema = zod.z.enum(EXTENSION_SLOT_IDS);
30235
+ var EXTENSION_SLOTS = {
30236
+ "doorbell-source": {
30237
+ descriptor: DOORBELL_SOURCE_SLOT,
30238
+ declaringCap: "doorbell",
30239
+ hostDeviceTypes: [require_sleep.DeviceType.Camera]
30240
+ },
30241
+ "linked-devices": {
30242
+ descriptor: LINKED_DEVICES_SLOT,
30243
+ declaringCap: "device-manager",
30244
+ hostDeviceTypes: [require_sleep.DeviceType.Camera]
30245
+ }
30246
+ };
30247
+ /** A slot's editable value, discriminated on `slot`. */
30248
+ var ExtensionSlotValueSchema = zod.z.discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: zod.z.literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: zod.z.literal("linked-devices") })]);
30249
+ /** Every device type at least one slot is offered on — `device-extension`'s `deviceTypes`. */
30250
+ var EXTENSION_HOST_DEVICE_TYPES = [require_sleep.DeviceType.Camera];
30251
+ //#endregion
30252
+ //#region src/capabilities/device-extension.cap.ts
30253
+ /**
30254
+ * `device-extension` — ONE place to see and author what a device is extended
30255
+ * with by OTHER devices (D648).
30256
+ *
30257
+ * **A contract, not a store.** Every slot (`linked-devices`,
30258
+ * `doorbell-source`, later `consumables-graft`) is declared by the cap that
30259
+ * owns the function (`extensionSlots` in its `*.cap.ts`, D4) and SERVED by the
30260
+ * addon that already owns its store, over that store and its existing write
30261
+ * path. This cap persists nothing and has no config method (guarded by
30262
+ * `scripts/check-extension-slots.ts`): D62 applied to the whole feature, and
30263
+ * D3 — no shadow registry.
30264
+ *
30265
+ * **Shape.** A device-scoped wrapper COLLECTION, the D554 shape `videoclips`
30266
+ * uses: `resolveCapMount` gives it the `device-scoped` mount and
30267
+ * `requireDeviceCollection` dispatches it. Its providers are the slot owners
30268
+ * (device-manager, virtual-doorbell, …), and a device's sources are its
30269
+ * bindings (step 0 of `getBindings`, derived, persisted nowhere).
30270
+ *
30271
+ * - `listSources` — one row per provider, the D554 source-listing convention
30272
+ * that lets a scalar call be routed by the prefix of its `slotRef`.
30273
+ * - `listSlots` — fan-out, concatenated. A provider that throws becomes ONE
30274
+ * `unreachable` row naming it, never an absence (D554.4, D315): "no
30275
+ * extensions" is claimed only from an answer.
30276
+ * - `listCandidates` / `setSlot` — scalar, routed by `slotRef`
30277
+ * (`<source>:<slotId>`). An unclaimed ref is refused by name (D554.5).
30278
+ *
30279
+ * The slot's value travels as the generated discriminated union
30280
+ * (`ExtensionSlotValue`, keyed on `slot`), so a value under the wrong slot is
30281
+ * a schema error before it reaches any owner.
30282
+ */
30283
+ /** Separator between the source and the slot id in a `slotRef`. It is the
30284
+ * D554 routing separator: the dispatcher matches `<source>:` prefixes. */
30285
+ var EXTENSION_SLOT_REF_SEPARATOR = ":";
30286
+ /** The contract method whose failure BECOMES a row, like `listSources`'s. */
30287
+ var EXTENSION_SLOT_LISTING_METHOD = "listSlots";
30288
+ var ExtensionSourceAvailabilitySchema = zod.z.discriminatedUnion("state", [zod.z.object({ state: zod.z.literal("ok") }), zod.z.object({
30289
+ state: zod.z.literal("unreachable"),
30290
+ reason: zod.z.string()
30291
+ })]);
30292
+ /** One provider of slots — the D554 source-listing row. */
30293
+ var ExtensionSourceSchema = zod.z.object({
30294
+ /** The routing prefix of every `slotRef` this provider serves. */
30295
+ source: zod.z.string(),
30296
+ label: zod.z.string(),
30297
+ /** Stamped by the dispatcher from the registry (D557). */
30298
+ addonId: zod.z.string().optional(),
30299
+ availability: ExtensionSourceAvailabilitySchema
30300
+ });
30301
+ /**
30302
+ * How one picked source stands. `missing` — no such device (deleted, or an id
30303
+ * that never existed); `foreign` — a device the slot's owner cannot read from
30304
+ * (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
30305
+ * valid source now (a container, which is never a pick). A source in any of
30306
+ * these states is SHOWN, never silently dropped or re-pointed.
30307
+ */
30308
+ var ExtensionSourceHealthSchema = zod.z.enum([
30309
+ "ok",
30310
+ "missing",
30311
+ "foreign",
30312
+ "unavailable"
30313
+ ]);
30314
+ var ExtensionSlotSourceSchema = zod.z.object({
30315
+ deviceId: zod.z.number().int(),
30316
+ /** The device's name, or null when it could not be resolved (`missing`). */
30317
+ name: zod.z.string().nullable(),
30318
+ health: ExtensionSourceHealthSchema,
30319
+ detail: zod.z.string().optional()
30320
+ });
30321
+ /**
30322
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
30323
+ * reported read-only, named, never written through this contract (D62). The
30324
+ * virtual doorbell's sources ring only while the wrapper is bound to the
30325
+ * camera, and that binding belongs to `deviceManager.setWrapperActive`.
30326
+ * `unknown` means the gate could not be read; it is not "inactive" (D315).
30327
+ */
30328
+ var ExtensionSlotActivationSchema = zod.z.object({
30329
+ state: zod.z.enum([
30330
+ "active",
30331
+ "inactive",
30332
+ "unknown"
30333
+ ]),
30334
+ authority: zod.z.string(),
30335
+ detail: zod.z.string().optional()
30336
+ });
30337
+ /** One slot of one device, as its owner reads it from its own store. */
30338
+ var ExtensionSlotStateSchema = zod.z.object({
30339
+ state: zod.z.literal("ok"),
30340
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
30341
+ slotRef: zod.z.string(),
30342
+ slot: ExtensionSlotIdSchema,
30343
+ /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
30344
+ authority: zod.z.string(),
30345
+ /** graft: its switch. association: null — removing every source is "off". */
30346
+ enabled: zod.z.boolean().nullable(),
30347
+ /** graft: the cap registered on the host. association: null. */
30348
+ projects: zod.z.string().nullable(),
30349
+ activation: ExtensionSlotActivationSchema.nullable(),
30350
+ value: ExtensionSlotValueSchema,
30351
+ sources: zod.z.array(ExtensionSlotSourceSchema)
30352
+ });
30353
+ /**
30354
+ * A provider that could not answer `listSlots` at all. It could not name its
30355
+ * own slots, so the row names the ADDON and carries the refusal verbatim.
30356
+ * Written by the dispatcher, never by a provider.
30357
+ */
30358
+ var ExtensionSlotUnreachableSchema = zod.z.object({
30359
+ state: zod.z.literal("unreachable"),
30360
+ addonId: zod.z.string(),
30361
+ reason: zod.z.string()
30362
+ });
30363
+ var ExtensionSlotRowSchema = zod.z.discriminatedUnion("state", [ExtensionSlotStateSchema, ExtensionSlotUnreachableSchema]);
30364
+ /** The row the dispatcher writes for a provider whose `listSlots` threw. */
30365
+ function unreachableExtensionSlotRow(addonId, reason) {
30366
+ return {
30367
+ state: "unreachable",
30368
+ addonId,
30369
+ reason
30370
+ };
30371
+ }
30372
+ /** One device the slot's editor may offer as a source. */
30373
+ var ExtensionCandidateSchema = zod.z.object({
30374
+ deviceId: zod.z.number().int(),
30375
+ name: zod.z.string(),
30376
+ type: zod.z.string(),
30377
+ location: zod.z.string().nullable(),
30378
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
30379
+ parentName: zod.z.string().nullable(),
30380
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
30381
+ suggested: zod.z.boolean(),
30382
+ /** Why it is suggested ("same location"), null when it is not. */
30383
+ reason: zod.z.string().nullable()
30384
+ });
30385
+ var ExtensionCandidatesSchema = zod.z.object({ candidates: zod.z.array(ExtensionCandidateSchema) });
30386
+ /**
30387
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
30388
+ * reloaded the host (or, for an accessory child, its parent) because the
30389
+ * write changed what the host REGISTERS (a graft switched on or off, slice 2).
30390
+ */
30391
+ var ExtensionSetResultSchema = zod.z.object({
30392
+ applied: zod.z.literal(true),
30393
+ reload: zod.z.enum([
30394
+ "none",
30395
+ "host",
30396
+ "parent"
30397
+ ])
30398
+ });
30399
+ var ExtensionSlotRefInputSchema = zod.z.object({
30400
+ deviceId: zod.z.number().int(),
30401
+ slotRef: zod.z.string().min(1)
30402
+ });
30403
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
30404
+ var deviceExtensionCapability = {
30405
+ name: "device-extension",
30406
+ scope: "device",
30407
+ mode: "collection",
30408
+ kind: "wrapper",
30409
+ defaultActive: true,
30410
+ deviceTypes: EXTENSION_HOST_DEVICE_TYPES,
30411
+ deviceConfig: { ui: {
30412
+ kind: "widget",
30413
+ widgetId: "host/extensions-panel",
30414
+ tab: "general",
30415
+ label: "Extensions",
30416
+ order: 72
30417
+ } },
30418
+ methods: {
30419
+ /** One row per slot owner — the D554 source listing `slotRef` routes by. */
30420
+ listSources: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSourceSchema)),
30421
+ /**
30422
+ * Every slot this device is offered, read by each owner from its own
30423
+ * store. A provider that throws is ONE `unreachable` row (D554.4).
30424
+ */
30425
+ listSlots: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int() }), zod.z.array(ExtensionSlotRowSchema)),
30426
+ /** The devices the slot's editor may offer, suggestions pre-marked (D356). */
30427
+ listCandidates: require_sleep.method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema),
30428
+ /**
30429
+ * Write one slot through its owner's EXISTING write path. The owner
30430
+ * validates (a container is never a linked device, a camera is never its
30431
+ * own source) and refuses by name before persisting.
30432
+ */
30433
+ setSlot: require_sleep.method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
30434
+ kind: "mutation",
30435
+ auth: "admin"
30436
+ })
30437
+ }
30438
+ };
30439
+ //#endregion
29257
30440
  //#region src/capabilities/webrtc-session.cap.ts
29258
30441
  /**
29259
30442
  * Optional client-side hints sent at session creation to help the provider
@@ -32289,77 +33472,6 @@ onStatusChanged: { data: zod.z.object({
32289
33472
  volatileStateFields: ["lastChangedAt"]
32290
33473
  };
32291
33474
  //#endregion
32292
- //#region src/capabilities/doorbell.cap.ts
32293
- /**
32294
- * Doorbell button cap. Two kinds of providers coexist behind this cap
32295
- * name (same pattern as `snapshot`):
32296
- *
32297
- * - **Native** providers: registered per-device by device-driver
32298
- * addons via `ctx.registerNativeCap` — either on a
32299
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
32300
- * or directly on the camera (Reolink registers at camera level).
32301
- * Emits an `onPressed` event every time the firmware pushes a
32302
- * ring; status tracks the last press and a pressCount since start
32303
- * (diagnostic).
32304
- *
32305
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
32306
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
32307
- * device (contact / switch / event-emitter …) into a doorbell for
32308
- * a camera. `defaultActive: false` — the operator explicitly binds
32309
- * it per camera in the device-bindings UI, then picks the source
32310
- * device + trigger in the per-device settings.
32311
- *
32312
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
32313
- * — subscribers listening at the camera level receive ring events
32314
- * with `via[]` populated. No code on the parent needed.
32315
- */
32316
- var DoorbellStatusSchema = zod.z.object({
32317
- /** Ms epoch of the last press. null = never observed since this provider started. */
32318
- lastPressedAt: zod.z.number().nullable(),
32319
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
32320
- pressCountSinceStart: zod.z.number()
32321
- });
32322
- var DoorbellPressEventSchema = zod.z.object({
32323
- deviceId: zod.z.number(),
32324
- timestamp: zod.z.number()
32325
- });
32326
- var doorbellCapability = {
32327
- name: "doorbell",
32328
- scope: "device",
32329
- deviceNative: true,
32330
- mode: "singleton",
32331
- kind: "wrapper",
32332
- defaultActive: false,
32333
- deviceTypes: [require_sleep.DeviceType.Button, require_sleep.DeviceType.Camera],
32334
- exposesDeviceSettings: true,
32335
- methods: {},
32336
- events: {
32337
- /**
32338
- * Fires once per physical press. Reolink delivers via Baichuan
32339
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
32340
- * release/duration — it's a pulse.
32341
- */
32342
- onPressed: { data: DoorbellPressEventSchema } },
32343
- status: {
32344
- schema: DoorbellStatusSchema,
32345
- kind: "push"
32346
- },
32347
- /**
32348
- * Runtime-state slice — last press timestamp + lifetime press count.
32349
- * Mirrored by the kernel and readable via
32350
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
32351
- * without subscribing.
32352
- */
32353
- runtimeState: DoorbellStatusSchema,
32354
- /**
32355
- * 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.
32356
- *
32357
- * See `RuntimeStateDurability`. Enforced by
32358
- * `scripts/check-runtime-state-durability.ts`.
32359
- */
32360
- durability: "restored"
32361
- };
32362
- //#endregion
32363
33475
  //#region src/capabilities/enum-sensor.cap.ts
32364
33476
  /**
32365
33477
  * Enum-state sensor — a string value picked from a finite option set.
@@ -43396,6 +44508,90 @@ var PIPELINE_OWNER_CAPABILITY_NAMES = [
43396
44508
  "pipeline-runner"
43397
44509
  ];
43398
44510
  //#endregion
44511
+ //#region src/device-extension/slot-provider.ts
44512
+ function isValueOf(slot, value) {
44513
+ return value.slot === slot;
44514
+ }
44515
+ /** Bind slot `slot` to its owner's functions. See the module docblock. */
44516
+ function defineExtensionSlotProvider(slot, impl) {
44517
+ return {
44518
+ slot,
44519
+ list: async (deviceId) => {
44520
+ const listing = await impl.list(deviceId);
44521
+ if (listing === null) return null;
44522
+ const value = listing.value;
44523
+ return {
44524
+ ...listing,
44525
+ value
44526
+ };
44527
+ },
44528
+ set: async (deviceId, value) => {
44529
+ if (!isValueOf(slot, value)) throw new Error(`device-extension: a "${value.slot}" value was sent to slot "${slot}" — refused`);
44530
+ return await impl.set(deviceId, value);
44531
+ },
44532
+ candidates: (deviceId) => impl.candidates(deviceId)
44533
+ };
44534
+ }
44535
+ /** `<source>:<slotId>`. */
44536
+ function extensionSlotRef(source, slot) {
44537
+ return `${source}:${slot}`;
44538
+ }
44539
+ /** Build the `device-extension` provider one owner registers. */
44540
+ function createDeviceExtensionProvider(options) {
44541
+ const { source, label, slots, hostTypeOf, logger } = options;
44542
+ const offered = (slot, hostType) => hostType !== null && EXTENSION_SLOTS[slot].hostDeviceTypes.some((t) => t === hostType);
44543
+ const resolve = async (deviceId, slotRef) => {
44544
+ const prefix = `${source}:`;
44545
+ const slot = slotRef.startsWith(prefix) ? slots.find((s) => s.slot === slotRef.slice(prefix.length)) : void 0;
44546
+ if (slot === void 0) throw new Error(`device-extension: "${slotRef}" is not a slot of "${source}" — it serves ${slots.map((s) => extensionSlotRef(source, s.slot)).join(", ") || "(none)"}`);
44547
+ const hostType = await hostTypeOf(deviceId);
44548
+ if (!offered(slot.slot, hostType)) throw new Error(`device-extension: slot "${slot.slot}" is not offered on device ${deviceId} (type ${hostType ?? "unknown"}; offered on ${EXTENSION_SLOTS[slot.slot].hostDeviceTypes.join(", ")})`);
44549
+ return slot;
44550
+ };
44551
+ return {
44552
+ listSources: async () => [{
44553
+ source,
44554
+ label,
44555
+ availability: { state: "ok" }
44556
+ }],
44557
+ listSlots: async (input) => {
44558
+ const hostType = await hostTypeOf(input.deviceId);
44559
+ const rows = [];
44560
+ for (const slot of slots) {
44561
+ if (!offered(slot.slot, hostType)) continue;
44562
+ const listing = await slot.list(input.deviceId);
44563
+ if (listing === null) continue;
44564
+ rows.push({
44565
+ state: "ok",
44566
+ slotRef: extensionSlotRef(source, slot.slot),
44567
+ slot: slot.slot,
44568
+ authority: listing.authority,
44569
+ enabled: listing.enabled,
44570
+ projects: EXTENSION_SLOTS[slot.slot].descriptor.projects ?? null,
44571
+ activation: listing.activation,
44572
+ value: listing.value,
44573
+ sources: [...listing.sources]
44574
+ });
44575
+ }
44576
+ return rows;
44577
+ },
44578
+ listCandidates: async (input) => {
44579
+ return { candidates: [...await (await resolve(input.deviceId, input.slotRef)).candidates(input.deviceId)] };
44580
+ },
44581
+ setSlot: async (input) => {
44582
+ const result = await (await resolve(input.deviceId, input.slotRef)).set(input.deviceId, input.value);
44583
+ logger.info("device-extension: slot written", {
44584
+ tags: { deviceId: input.deviceId },
44585
+ meta: {
44586
+ slotRef: input.slotRef,
44587
+ reload: result.reload
44588
+ }
44589
+ });
44590
+ return result;
44591
+ }
44592
+ };
44593
+ }
44594
+ //#endregion
43399
44595
  //#region src/catalogs/device-state-vocabulary.ts
43400
44596
  /**
43401
44597
  * Most specific first. Extending this list is how a new device kind becomes
@@ -43467,172 +44663,6 @@ function stateVocabularyFor(runtimeState, alarmStates = []) {
43467
44663
  return [];
43468
44664
  }
43469
44665
  //#endregion
43470
- //#region src/catalogs/sensor-active-state.ts
43471
- /**
43472
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
43473
- * valutatore puro del suo FRONTE.
43474
- *
43475
- * Viveva dentro il builtin virtual-doorbell
43476
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
43477
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
43478
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
43479
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
43480
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
43481
- * SPOSTA qui e il doorbell la ri-esporta.
43482
- *
43483
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
43484
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
43485
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
43486
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
43487
- */
43488
- /**
43489
- * Known binary / switch source caps → the boolean slice field whose
43490
- * false→true rise counts as ACTIVE. Every entry is "fire on active".
43491
- * Sensors whose "active" reading is not a plain boolean (presence's string
43492
- * state, connectivity's connected flag) are deliberately excluded — a
43493
- * reconnect is not a doorbell press, and it is not a recording either.
43494
- */
43495
- var SOURCE_CAP_ACTIVE_FIELD = {
43496
- contact: "entryOpen",
43497
- binary: "on",
43498
- switch: "on",
43499
- motion: "detected",
43500
- flood: "flooded",
43501
- gas: "detected",
43502
- smoke: "detected",
43503
- "carbon-monoxide": "detected",
43504
- vibration: "detected",
43505
- tamper: "tampered"
43506
- };
43507
- /**
43508
- * The same caps → the slice field carrying the ms-epoch timestamp of the
43509
- * last transition. Every source cap MUST appear here (guarded by a spec):
43510
- * without a transition timestamp the evaluator cannot tell a genuine rise
43511
- * from a boot-time hydration when the FIRST slice it ever sees is already
43512
- * active, and errs towards silence — swallowing the rise.
43513
- *
43514
- * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
43515
- * provider derives them from `state.last_changed`, so they survive our own
43516
- * restarts and correctly read as "hours ago" for a state that has been
43517
- * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
43518
- */
43519
- var SOURCE_CAP_CHANGED_AT_FIELD = {
43520
- contact: "lastChangedAt",
43521
- binary: "lastChangedAt",
43522
- switch: "lastChangedAt",
43523
- motion: "lastDetectedAt",
43524
- flood: "lastChangedAt",
43525
- gas: "lastChangedAt",
43526
- smoke: "lastChangedAt",
43527
- "carbon-monoxide": "lastChangedAt",
43528
- vibration: "lastChangedAt",
43529
- tamper: "lastChangedAt"
43530
- };
43531
- /** Cap names whose presence in a device's bindings qualify it as a source. */
43532
- var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
43533
- /**
43534
- * Device `type` values (from `DeviceType`) that can host a binary/switch
43535
- * source cap. Used by the camera's `device-multiselect` picker as the
43536
- * CLIENT-SIDE filter, alongside `SOURCE_CAPS`.
43537
- *
43538
- * Why types and not caps alone: the shared picker filters
43539
- * `deviceManager.listAll` rows client-side, and those rows carry only the
43540
- * device's advertised `features` — NOT its registered cap list. On the live
43541
- * cluster binary sensors and switches advertise EMPTY features (features
43542
- * mirror only a handful of caps like `motion-trigger`), so a caps-only
43543
- * filter matched against `features` would list nothing (the very bug this
43544
- * replaced, which relied on the now-empty `getAllBindings`). Matching by
43545
- * `type` is the reliable client-side signal; the union with `SOURCE_CAPS`
43546
- * still captures any device that DOES advertise a source-cap feature.
43547
- * `sensor` covers contact/motion/flood/gas/smoke/CO/vibration/tamper,
43548
- * `switch` covers switches, `control` covers generic binary actuators.
43549
- */
43550
- var SOURCE_DEVICE_TYPES = [
43551
- "sensor",
43552
- "switch",
43553
- "control"
43554
- ];
43555
- /** True when a cap is a recognised binary/switch source. */
43556
- function isSourceCap(capName) {
43557
- return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
43558
- }
43559
- /** Extract the "active" boolean a source cap's slice carries, or null when
43560
- * the cap is unknown or the field is missing / non-boolean. */
43561
- function sliceActiveValue(capName, slice) {
43562
- const field = SOURCE_CAP_ACTIVE_FIELD[capName];
43563
- if (field === void 0) return null;
43564
- const raw = slice[field];
43565
- return typeof raw === "boolean" ? raw : null;
43566
- }
43567
- /** Ms-epoch transition timestamp a source cap's slice carries, or null when
43568
- * it is absent, non-numeric or the zero "never observed" sentinel. */
43569
- function sliceChangedAt(capName, slice) {
43570
- const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
43571
- if (field === void 0) return null;
43572
- const raw = slice[field];
43573
- if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
43574
- return raw;
43575
- }
43576
- /**
43577
- * How recent a source's own transition timestamp must be for a FIRST
43578
- * sighting that is already active to count as a genuine rise rather than a
43579
- * hydration of long-standing state.
43580
- */
43581
- var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
43582
- /**
43583
- * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
43584
- * porta `prior`, `nowMs` e il proprio `startedAtMs`.
43585
- *
43586
- * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
43587
- * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
43588
- * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
43589
- * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
43590
- * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
43591
- * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
43592
- * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
43593
- * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
43594
- */
43595
- function evaluateSensorEdge(input) {
43596
- const value = sliceActiveValue(input.capName, input.slice);
43597
- if (value === null) return {
43598
- edge: "none",
43599
- value: null,
43600
- reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
43601
- };
43602
- if (input.prior === void 0) {
43603
- if (!value) return {
43604
- edge: "none",
43605
- value,
43606
- reason: "baseline-seeded-inactive"
43607
- };
43608
- const changedAt = sliceChangedAt(input.capName, input.slice);
43609
- const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
43610
- if (changedAt === null || changedAt < floor) return {
43611
- edge: "none",
43612
- value,
43613
- reason: "baseline-seeded-stale-active"
43614
- };
43615
- return {
43616
- edge: "rising",
43617
- value: true
43618
- };
43619
- }
43620
- if (input.prior === value) return {
43621
- edge: "none",
43622
- value,
43623
- reason: "no-change"
43624
- };
43625
- if (!value) return {
43626
- edge: "none",
43627
- value,
43628
- reason: "falling-edge"
43629
- };
43630
- return {
43631
- edge: "rising",
43632
- value: true
43633
- };
43634
- }
43635
- //#endregion
43636
44666
  //#region src/constants.ts
43637
44667
  var HF_REPO = "camstack/camstack-models";
43638
44668
  var HF_BASE_URL = `https://huggingface.co/${HF_REPO}/resolve/main`;
@@ -48678,6 +49708,7 @@ var CAPABILITY_NAMES = {
48678
49708
  deviceAdoption: "device-adoption",
48679
49709
  deviceDiscovery: "device-discovery",
48680
49710
  deviceExport: "device-export",
49711
+ deviceExtension: "device-extension",
48681
49712
  deviceManager: "device-manager",
48682
49713
  deviceOps: "device-ops",
48683
49714
  deviceProvider: "device-provider",
@@ -48985,6 +50016,10 @@ var CAPABILITY_ROUTER_KEYS = [
48985
50016
  key: "deviceExport",
48986
50017
  name: "device-export"
48987
50018
  },
50019
+ {
50020
+ key: "deviceExtension",
50021
+ name: "device-extension"
50022
+ },
48988
50023
  {
48989
50024
  key: "deviceManager",
48990
50025
  name: "device-manager"
@@ -49492,6 +50527,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
49492
50527
  deviceAdoptionCapability,
49493
50528
  deviceDiscoveryCapability,
49494
50529
  deviceExportCapability,
50530
+ deviceExtensionCapability,
49495
50531
  deviceManagerCapability,
49496
50532
  require_sleep.deviceOpsCapability,
49497
50533
  deviceProviderCapability,
@@ -51042,6 +52078,30 @@ var METHOD_ACCESS_MAP = Object.freeze({
51042
52078
  addonId: null,
51043
52079
  access: "create"
51044
52080
  },
52081
+ "deviceExtension.listCandidates": {
52082
+ capName: "device-extension",
52083
+ capScope: "device",
52084
+ addonId: null,
52085
+ access: "view"
52086
+ },
52087
+ "deviceExtension.listSlots": {
52088
+ capName: "device-extension",
52089
+ capScope: "device",
52090
+ addonId: null,
52091
+ access: "view"
52092
+ },
52093
+ "deviceExtension.listSources": {
52094
+ capName: "device-extension",
52095
+ capScope: "device",
52096
+ addonId: null,
52097
+ access: "view"
52098
+ },
52099
+ "deviceExtension.setSlot": {
52100
+ capName: "device-extension",
52101
+ capScope: "device",
52102
+ addonId: null,
52103
+ access: "create"
52104
+ },
51045
52105
  "deviceManager.addLocation": {
51046
52106
  capName: "device-manager",
51047
52107
  capScope: "system",
@@ -51792,6 +52852,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
51792
52852
  addonId: null,
51793
52853
  access: "view"
51794
52854
  },
52855
+ "embeddingEncoder.resetFailedModels": {
52856
+ capName: "embedding-encoder",
52857
+ capScope: "system",
52858
+ addonId: null,
52859
+ access: "delete"
52860
+ },
51795
52861
  "enumSensor.getStatus": {
51796
52862
  capName: "enum-sensor",
51797
52863
  capScope: "device",
@@ -54126,6 +55192,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
54126
55192
  addonId: null,
54127
55193
  access: "view"
54128
55194
  },
55195
+ "pipelineOrchestrator.getClusterModelChoice": {
55196
+ capName: "pipeline-orchestrator",
55197
+ capScope: "system",
55198
+ addonId: null,
55199
+ access: "view"
55200
+ },
54129
55201
  "pipelineOrchestrator.getDeviceLiveContribution": {
54130
55202
  capName: "pipeline-orchestrator",
54131
55203
  capScope: "system",
@@ -56727,6 +57799,7 @@ var KNOWN_CAP_NAMES = [
56727
57799
  "device-adoption",
56728
57800
  "device-discovery",
56729
57801
  "device-export",
57802
+ "device-extension",
56730
57803
  "device-manager",
56731
57804
  "device-ops",
56732
57805
  "device-provider",
@@ -56869,6 +57942,7 @@ var DEVICE_CAP_NAMES = [
56869
57942
  "detection-pipeline",
56870
57943
  "device-admin-link",
56871
57944
  "device-discovery",
57945
+ "device-extension",
56872
57946
  "device-ops",
56873
57947
  "device-status",
56874
57948
  "doorbell",
@@ -57282,6 +58356,26 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
57282
58356
  form: "single",
57283
58357
  optional: false
57284
58358
  }],
58359
+ "deviceExtension.listCandidates": [{
58360
+ name: "deviceId",
58361
+ form: "single",
58362
+ optional: false
58363
+ }],
58364
+ "deviceExtension.listSlots": [{
58365
+ name: "deviceId",
58366
+ form: "single",
58367
+ optional: false
58368
+ }],
58369
+ "deviceExtension.listSources": [{
58370
+ name: "deviceId",
58371
+ form: "single",
58372
+ optional: false
58373
+ }],
58374
+ "deviceExtension.setSlot": [{
58375
+ name: "deviceId",
58376
+ form: "single",
58377
+ optional: false
58378
+ }],
57285
58379
  "deviceManager.adoptionRelease": [{
57286
58380
  name: "camDeviceId",
57287
58381
  form: "single",
@@ -59843,6 +60937,7 @@ function createSystemProxy(api) {
59843
60937
  stop: (input) => dispatch("deviceProvider", "stop", "mutation", input),
59844
60938
  getStatus: (input) => dispatch("deviceProvider", "getStatus", "query", input),
59845
60939
  getDevices: (input) => dispatch("deviceProvider", "getDevices", "query", input),
60940
+ reloadDevice: (input) => dispatch("deviceProvider", "reloadDevice", "mutation", input),
59846
60941
  supportsDiscovery: (input) => dispatch("deviceProvider", "supportsDiscovery", "query", input),
59847
60942
  discoverDevices: (input) => dispatch("deviceProvider", "discoverDevices", "mutation", input),
59848
60943
  getDiscoveryParamsSchema: (input) => dispatch("deviceProvider", "getDiscoveryParamsSchema", "query", input),
@@ -59988,6 +61083,29 @@ function createSystemProxy(api) {
59988
61083
  deleteTarget: (input) => dispatch("notificationOutput", "deleteTarget", "mutation", input),
59989
61084
  setTargetEnabled: (input) => dispatch("notificationOutput", "setTargetEnabled", "mutation", input)
59990
61085
  },
61086
+ notificationRules: {
61087
+ listRules: (input) => dispatch("notificationRules", "listRules", "query", input),
61088
+ getRule: (input) => dispatch("notificationRules", "getRule", "query", input),
61089
+ createRule: (input) => dispatch("notificationRules", "createRule", "mutation", input),
61090
+ updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
61091
+ deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
61092
+ setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
61093
+ getClipRetentionAsks: (input) => dispatch("notificationRules", "getClipRetentionAsks", "query", input),
61094
+ listDeviceMutes: (input) => dispatch("notificationRules", "listDeviceMutes", "query", input),
61095
+ testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
61096
+ previewStateSummary: (input) => dispatch("notificationRules", "previewStateSummary", "mutation", input),
61097
+ getConditionCatalog: (input) => dispatch("notificationRules", "getConditionCatalog", "query", input),
61098
+ getTemplateCatalog: (input) => dispatch("notificationRules", "getTemplateCatalog", "query", input),
61099
+ previewTemplate: (input) => dispatch("notificationRules", "previewTemplate", "mutation", input),
61100
+ getHistory: (input) => dispatch("notificationRules", "getHistory", "query", input),
61101
+ getRuleLastRuns: (input) => dispatch("notificationRules", "getRuleLastRuns", "query", input),
61102
+ resolveArtifactUrl: (input) => dispatch("notificationRules", "resolveArtifactUrl", "query", input),
61103
+ listSnoozes: (input) => dispatch("notificationRules", "listSnoozes", "query", input),
61104
+ createSnooze: (input) => dispatch("notificationRules", "createSnooze", "mutation", input),
61105
+ cancelSnooze: (input) => dispatch("notificationRules", "cancelSnooze", "mutation", input),
61106
+ getAlarmConfig: (input) => dispatch("notificationRules", "getAlarmConfig", "query", input),
61107
+ setAlarmConfig: (input) => dispatch("notificationRules", "setAlarmConfig", "mutation", input)
61108
+ },
59991
61109
  osdManager: {
59992
61110
  getConditionSupport: (input) => dispatch("osdManager", "getConditionSupport", "query", input),
59993
61111
  copyDeviceConfiguration: (input) => dispatch("osdManager", "copyDeviceConfiguration", "mutation", input)
@@ -60036,11 +61154,13 @@ function createSystemProxy(api) {
60036
61154
  rebalance: (input) => dispatch("pipelineOrchestrator", "rebalance", "mutation", input),
60037
61155
  getPipelineAssignments: (input) => dispatch("pipelineOrchestrator", "getPipelineAssignments", "query", input),
60038
61156
  getAgentLoad: (input) => dispatch("pipelineOrchestrator", "getAgentLoad", "query", input),
61157
+ getClusterModelChoice: (input) => dispatch("pipelineOrchestrator", "getClusterModelChoice", "query", input),
60039
61158
  getGlobalMetrics: (input) => dispatch("pipelineOrchestrator", "getGlobalMetrics", "query", input),
60040
61159
  getCapabilityBindings: (input) => dispatch("pipelineOrchestrator", "getCapabilityBindings", "query", input),
60041
61160
  setCapabilityBinding: (input) => dispatch("pipelineOrchestrator", "setCapabilityBinding", "mutation", input),
60042
61161
  getIngestOwner: (input) => dispatch("pipelineOrchestrator", "getIngestOwner", "query", input),
60043
61162
  getAudioNodeLoad: (input) => dispatch("pipelineOrchestrator", "getAudioNodeLoad", "query", input),
61163
+ getAudioAssignments: (input) => dispatch("pipelineOrchestrator", "getAudioAssignments", "query", input),
60044
61164
  getAgentSettings: (input) => dispatch("pipelineOrchestrator", "getAgentSettings", "query", input),
60045
61165
  listAgentSettings: (input) => dispatch("pipelineOrchestrator", "listAgentSettings", "query", input),
60046
61166
  removeAgentSettings: (input) => dispatch("pipelineOrchestrator", "removeAgentSettings", "mutation", input),
@@ -63432,223 +64552,6 @@ function readTimelapseGeneratedAt(rule, deviceId) {
63432
64552
  return rule.lastGeneratedAt ?? 0;
63433
64553
  }
63434
64554
  //#endregion
63435
- //#region src/pipeline/cluster-model-scope.ts
63436
- /**
63437
- * A model choice has a SCOPE, and a scope change has a workflow.
63438
- *
63439
- * ## The two scopes
63440
- *
63441
- * Almost every pipeline step's model is a **node** question: which build runs
63442
- * fastest on THIS accelerator. Two nodes may legitimately answer differently —
63443
- * a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
63444
- * are compared against nothing. They produce boxes, and a box is a box.
63445
- *
63446
- * Two steps are not like that. `face-embedding` and `clip-embedding` produce
63447
- * **vectors that land in ONE shared index** (`identity_samples`,
63448
- * `vec_object_clip`) and are ranked against each other by cosine similarity.
63449
- * Cosine similarity between two encoders is not a weak signal, it is a
63450
- * meaningless number — and nothing inside a vector can tell you it happened.
63451
- * So for those two steps the model is a **cluster** question with exactly one
63452
- * answer, stored in exactly one row.
63453
- *
63454
- * That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
63455
- * for the crop convention (`detail-crop.ts`), one level up: the crop decides
63456
- * WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
63457
- * cluster-wide for the same reason and neither may become per-node.
63458
- *
63459
- * ## Why the registry lives here and not in the step catalog
63460
- *
63461
- * The scope itself is declared on the step, in
63462
- * `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
63463
- * — that is where a new step declares what kind of choice its model is. But the
63464
- * catalog lives inside `addon-pipeline`, and three packages that must NOT
63465
- * import an addon need to know the set: the orchestrator (which renders and
63466
- * stores the row), post-analysis (which pins the row for a re-embed pass) and
63467
- * admin-ui (which mirrors it). So the set is mirrored here, and
63468
- * `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
63469
- * A hand-copied key that stops matching is exactly how a setting silently stops
63470
- * arriving while both sides still look correct.
63471
- *
63472
- * ## The defaults ARE today's behaviour
63473
- *
63474
- * {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
63475
- * of both steps. Declaring the scope therefore changes nothing on the day it
63476
- * ships: the cluster row starts out saying what every node was already doing.
63477
- * Changing it is legitimate — that is what the knob is for — but it invalidates
63478
- * the stored vectors of that surface, and must be followed by a re-embed pass
63479
- * (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
63480
- */
63481
- /**
63482
- * The cluster-scoped steps. Mirrored from the catalog's `modelScope: 'cluster'`
63483
- * declarations and guarded by `scripts/check-cluster-model-scope.ts`.
63484
- */
63485
- var CLUSTER_MODEL_SCOPED_STEPS = [{
63486
- stepId: "face-embedding",
63487
- label: "Face recognition model",
63488
- defaultModelId: "arcface-r100",
63489
- indexName: "the enrolled face gallery",
63490
- options: [
63491
- {
63492
- id: "arcface-r100",
63493
- label: "ArcFace (ResNet34)"
63494
- },
63495
- {
63496
- id: "auraface-r100",
63497
- label: "AuraFace R100"
63498
- },
63499
- {
63500
- id: "inception-resnet-v1",
63501
- label: "Inception ResNet V1"
63502
- }
63503
- ]
63504
- }, {
63505
- stepId: "clip-embedding",
63506
- label: "Semantic search model",
63507
- defaultModelId: "mobileclip-s1",
63508
- indexName: "the object semantic-search index",
63509
- options: [{
63510
- id: "mobileclip-s1",
63511
- label: "MobileCLIP S1"
63512
- }, {
63513
- id: "mobileclip-s2",
63514
- label: "MobileCLIP S2"
63515
- }]
63516
- }];
63517
- /**
63518
- * Store identity of the cluster row inside `pipeline-orchestrator`'s GLOBAL
63519
- * (cluster-wide) settings — the same owner, and for the same reason, as the
63520
- * detail-crop convention: hub-resident and neutral between the addons that
63521
- * read it.
63522
- */
63523
- var CLUSTER_MODEL_SECTION_ID = "cluster-step-models";
63524
- /**
63525
- * The settings key holding one step's cluster model choice.
63526
- *
63527
- * Step-qualified so the keys stay unique across the addon's whole schema, which
63528
- * is what lets {@link pickClusterStepModels} walk every section instead of
63529
- * trusting the section id.
63530
- */
63531
- function clusterModelSettingKey(stepId) {
63532
- return `clusterModel:${stepId}`;
63533
- }
63534
- /** True when this step's model is a cluster-wide choice rather than a per-node one. */
63535
- function isClusterScopedStep(stepId) {
63536
- return CLUSTER_MODEL_SCOPED_STEPS.some((s) => s.stepId === stepId);
63537
- }
63538
- /** The cluster row when nobody has configured one — today's catalog defaults. */
63539
- var DEFAULT_CLUSTER_STEP_MODELS = Object.freeze(Object.fromEntries(CLUSTER_MODEL_SCOPED_STEPS.map((s) => [s.stepId, s.defaultModelId])));
63540
- /** A stored choice is a non-empty model id, or it is not a choice. */
63541
- var ChosenModelIdSchema = zod.z.string().min(1);
63542
- /**
63543
- * Narrow a FLAT settings record to the cluster row.
63544
- *
63545
- * Per-FIELD fallback, deliberately (same rule as `readDetailCropConvention`): a
63546
- * junk face model must not also discard a valid clip model. An absent, empty or
63547
- * non-string value resolves to the step's catalog default — the historical
63548
- * behaviour — never to a blank id, because a blank id downstream becomes
63549
- * "substitute the format default", which is precisely the substitution this
63550
- * scope exists to forbid.
63551
- */
63552
- function readClusterStepModels(config) {
63553
- const out = {};
63554
- for (const step of CLUSTER_MODEL_SCOPED_STEPS) {
63555
- const parsed = ChosenModelIdSchema.safeParse(config[clusterModelSettingKey(step.stepId)]);
63556
- out[step.stepId] = parsed.success ? parsed.data : step.defaultModelId;
63557
- }
63558
- return out;
63559
- }
63560
- function isHydratedField$2(entry) {
63561
- return typeof entry === "object" && entry !== null && "key" in entry;
63562
- }
63563
- /**
63564
- * Extract the cluster row from an `addon-settings.getGlobalSettings` payload.
63565
- *
63566
- * Walks EVERY section rather than looking inside {@link CLUSTER_MODEL_SECTION_ID}
63567
- * alone: the keys are unique across the addon's schema, and a section rename
63568
- * must not silently revert the whole cluster to the defaults. A `null` payload
63569
- * (addon mid-boot) is the defaults.
63570
- */
63571
- function pickClusterStepModels(view) {
63572
- if (view === null) return DEFAULT_CLUSTER_STEP_MODELS;
63573
- const flat = {};
63574
- const wanted = new Set(CLUSTER_MODEL_SCOPED_STEPS.map((s) => clusterModelSettingKey(s.stepId)));
63575
- for (const section of view.sections) for (const entry of section.fields) {
63576
- if (!isHydratedField$2(entry) || typeof entry.key !== "string") continue;
63577
- if (wanted.has(entry.key)) flat[entry.key] = entry.value;
63578
- }
63579
- return readClusterStepModels(flat);
63580
- }
63581
- /**
63582
- * The cluster model for `stepId`, or `null` when the step is node-scoped.
63583
- *
63584
- * `null` is the signal to LEAVE THE CALLER'S RESOLUTION ALONE — it is not "no
63585
- * model". Returning a default here for a node-scoped step would quietly
63586
- * override every per-(node,device) selection in the fleet.
63587
- */
63588
- function resolveClusterStepModelId(stepId, models) {
63589
- const step = CLUSTER_MODEL_SCOPED_STEPS.find((s) => s.stepId === stepId);
63590
- if (step === void 0) return null;
63591
- const chosen = models[stepId];
63592
- return chosen !== void 0 && chosen !== "" ? chosen : step.defaultModelId;
63593
- }
63594
- /** Must match `DEFAULT_LANDMARK_PRECISION_FLOOR_PX` in the runner. */
63595
- var DEFAULT_MIN_LANDMARK_FACE_SIZE_PX = 24;
63596
- var CLUSTER_STEP_SETTING_FIELDS = [{
63597
- stepId: "face-embedding",
63598
- key: "minLandmarkFaceSize",
63599
- label: "Min face size for recognition (detection px)",
63600
- 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.",
63601
- type: "slider",
63602
- min: 0,
63603
- max: 64,
63604
- step: 2,
63605
- default: 24
63606
- }];
63607
- function clusterStepSettingKey(stepId, fieldKey) {
63608
- return `clusterStepSetting:${stepId}:${fieldKey}`;
63609
- }
63610
- function clusterStepSettingFieldsFor(stepId) {
63611
- return CLUSTER_STEP_SETTING_FIELDS.filter((field) => field.stepId === stepId);
63612
- }
63613
- var ClusterSettingNumberSchema = zod.z.number().finite();
63614
- function readClusterStepSettings(config) {
63615
- const out = {};
63616
- for (const field of CLUSTER_STEP_SETTING_FIELDS) {
63617
- const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
63618
- const value = parsed.success ? parsed.data : field.default;
63619
- const existing = out[field.stepId] ?? {};
63620
- out[field.stepId] = {
63621
- ...existing,
63622
- [field.key]: value
63623
- };
63624
- }
63625
- return out;
63626
- }
63627
- var DEFAULT_CLUSTER_STEP_SETTINGS = readClusterStepSettings({});
63628
- function pickClusterStepSettings(view) {
63629
- if (view === null) return DEFAULT_CLUSTER_STEP_SETTINGS;
63630
- const flat = {};
63631
- const wanted = new Set(CLUSTER_STEP_SETTING_FIELDS.map((field) => clusterStepSettingKey(field.stepId, field.key)));
63632
- for (const section of view.sections) for (const entry of section.fields) {
63633
- if (!isHydratedField$2(entry) || typeof entry.key !== "string") continue;
63634
- if (wanted.has(entry.key)) flat[entry.key] = entry.value;
63635
- }
63636
- return readClusterStepSettings(flat);
63637
- }
63638
- /**
63639
- * Cluster knobs win over leftover per-device values. The cluster row is the
63640
- * authority; a device-local copy is a leftover of the old per-node editor.
63641
- */
63642
- function overlayClusterStepSettings(stepId, deviceSettings, cluster) {
63643
- const overlay = cluster[stepId];
63644
- if (overlay === void 0 || Object.keys(overlay).length === 0) return deviceSettings === void 0 ? void 0 : { ...deviceSettings };
63645
- if (deviceSettings === void 0) return { ...overlay };
63646
- return {
63647
- ...deviceSettings,
63648
- ...overlay
63649
- };
63650
- }
63651
- //#endregion
63652
64555
  //#region src/pipeline/detail-crop.ts
63653
64556
  /**
63654
64557
  * THE detail-crop convention — the single derivation of the rectangle a
@@ -66218,11 +67121,15 @@ exports.CLIP_BROKER_PACED_RATES = CLIP_BROKER_PACED_RATES;
66218
67121
  exports.CLIP_PLAYBACK_OPTIONS = CLIP_PLAYBACK_OPTIONS;
66219
67122
  exports.CLIP_REALTIME_SOURCE_RATES = CLIP_REALTIME_SOURCE_RATES;
66220
67123
  exports.CLIP_REASON_HEADER_MAX = CLIP_REASON_HEADER_MAX;
67124
+ exports.CLIP_SEARCH_STRICTNESS = CLIP_SEARCH_STRICTNESS;
66221
67125
  exports.CLIP_STILL_DISPOSITION_HEADER = CLIP_STILL_DISPOSITION_HEADER;
66222
67126
  exports.CLIP_STILL_REASON_CODE_HEADER = CLIP_STILL_REASON_CODE_HEADER;
66223
67127
  exports.CLIP_STILL_REASON_HEADER = CLIP_STILL_REASON_HEADER;
66224
67128
  exports.CLIP_STREAM_SOURCE_RATES = CLIP_STREAM_SOURCE_RATES;
66225
67129
  exports.CLIP_STREAM_TRANSPORT_HEADER = CLIP_STREAM_TRANSPORT_HEADER;
67130
+ exports.CLIP_STRICTNESS_FACTOR = CLIP_STRICTNESS_FACTOR;
67131
+ exports.CLIP_VECTOR_INDEX_PATTERN = CLIP_VECTOR_INDEX_PATTERN;
67132
+ exports.CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS;
66226
67133
  exports.CLUSTER_MODEL_SCOPED_STEPS = CLUSTER_MODEL_SCOPED_STEPS;
66227
67134
  exports.CLUSTER_MODEL_SECTION_ID = CLUSTER_MODEL_SECTION_ID;
66228
67135
  exports.CLUSTER_STEP_SETTING_FIELDS = CLUSTER_STEP_SETTING_FIELDS;
@@ -66277,9 +67184,11 @@ exports.ClimateControlStatusSchema = ClimateControlStatusSchema;
66277
67184
  exports.ClipBytesOfferSchema = ClipBytesOfferSchema;
66278
67185
  exports.ClipBytesSchema = ClipBytesSchema;
66279
67186
  exports.ClipExportFailureSchema = ClipExportFailureSchema;
67187
+ exports.ClipModelMetaSchema = ClipModelMetaSchema;
66280
67188
  exports.ClipPlaybackOptionsSchema = ClipPlaybackOptionsSchema;
66281
67189
  exports.ClipPlaybackSchema = ClipPlaybackSchema;
66282
67190
  exports.ClipSchema = ClipSchema;
67191
+ exports.ClipSearchStrictnessSchema = ClipSearchStrictnessSchema;
66283
67192
  exports.ClipSourceAvailabilitySchema = ClipSourceAvailabilitySchema;
66284
67193
  exports.ClipSourceSchema = ClipSourceSchema;
66285
67194
  exports.ClipStillDispositionSchema = ClipStillDispositionSchema;
@@ -66290,6 +67199,7 @@ exports.ClipStreamDialSchema = ClipStreamDialSchema;
66290
67199
  exports.ClipWakeSchema = ClipWakeSchema;
66291
67200
  exports.ClusterAddonNodeDeploymentSchema = ClusterAddonNodeDeploymentSchema;
66292
67201
  exports.ClusterAddonStatusEntrySchema = ClusterAddonStatusEntrySchema;
67202
+ exports.ClusterModelChoiceSchema = ClusterModelChoiceSchema;
66293
67203
  exports.CollectionColumnSchema = CollectionColumnSchema;
66294
67204
  exports.CollectionIndexSchema = CollectionIndexSchema;
66295
67205
  exports.ColorStatusSchema = ColorStatusSchema;
@@ -66370,6 +67280,7 @@ exports.DISPLAY_ICON_GROUPS = DISPLAY_ICON_GROUPS;
66370
67280
  exports.DISPLAY_ICON_KEYS = DISPLAY_ICON_KEYS;
66371
67281
  exports.DISPLAY_ICON_OFFERED_KEYS = DISPLAY_ICON_OFFERED_KEYS;
66372
67282
  exports.DISPLAY_ICON_VOCABULARY = DISPLAY_ICON_VOCABULARY;
67283
+ exports.DOORBELL_SOURCE_SLOT = DOORBELL_SOURCE_SLOT;
66373
67284
  exports.DataStoreEngineInfoSchema = EngineInfoSchema;
66374
67285
  exports.DayNightModeSchema = DayNightModeSchema;
66375
67286
  exports.DayNightOptionsSchema = DayNightOptionsSchema;
@@ -66411,7 +67322,11 @@ exports.DiscoveredTargetSchema = DiscoveredTargetSchema;
66411
67322
  exports.DiskReconcileJobSchema = DiskReconcileJobSchema;
66412
67323
  exports.DisposerChain = require_sleep.DisposerChain;
66413
67324
  exports.DoorbellPressEventSchema = DoorbellPressEventSchema;
67325
+ exports.DoorbellSourceSlotValueSchema = DoorbellSourceSlotValueSchema;
66414
67326
  exports.DoorbellStatusSchema = DoorbellStatusSchema;
67327
+ exports.EMBEDDING_MODEL_FAILED = EMBEDDING_MODEL_FAILED;
67328
+ exports.EMBEDDING_REQUIREMENTS_FAILED = EMBEDDING_REQUIREMENTS_FAILED;
67329
+ exports.EMBEDDING_REQUIREMENTS_UNAVAILABLE = EMBEDDING_REQUIREMENTS_UNAVAILABLE;
66415
67330
  exports.EVENTFUL_CAP_NAMES = EVENTFUL_CAP_NAMES;
66416
67331
  exports.EVENT_DENSITY_BATCH_MAX = EVENT_DENSITY_BATCH_MAX;
66417
67332
  exports.EVENT_KIND_BY_CAP = EVENT_KIND_BY_CAP;
@@ -66424,14 +67339,23 @@ exports.EXPRESSION_BUILTIN_NAMES = EXPRESSION_BUILTIN_NAMES;
66424
67339
  exports.EXPRESSION_COMPILE_CACHE_CAPACITY = EXPRESSION_COMPILE_CACHE_CAPACITY;
66425
67340
  exports.EXPRESSION_IDENTIFIER_RE = EXPRESSION_IDENTIFIER_RE;
66426
67341
  exports.EXPRESSION_INJECTED_NOW = EXPRESSION_INJECTED_NOW;
67342
+ exports.EXTENSION_HOST_DEVICE_TYPES = EXTENSION_HOST_DEVICE_TYPES;
67343
+ exports.EXTENSION_SLOTS = EXTENSION_SLOTS;
67344
+ exports.EXTENSION_SLOT_IDS = EXTENSION_SLOT_IDS;
67345
+ exports.EXTENSION_SLOT_LISTING_METHOD = EXTENSION_SLOT_LISTING_METHOD;
67346
+ exports.EXTENSION_SLOT_REF_SEPARATOR = EXTENSION_SLOT_REF_SEPARATOR;
66427
67347
  exports.EffectiveTuningSchema = EffectiveTuningSchema;
66428
67348
  exports.EgressEncodeSchema = EgressEncodeSchema;
66429
67349
  exports.EgressRateControlSchema = EgressRateControlSchema;
66430
67350
  exports.EgressTranscodeRequestSchema = EgressTranscodeRequestSchema;
66431
67351
  exports.EgressTranscodeSchema = EgressTranscodeSchema;
66432
67352
  exports.ElementConfigStore = ElementConfigStore;
67353
+ exports.EmbeddingFailedModelSchema = EmbeddingFailedModelSchema;
67354
+ exports.EmbeddingFailedRequirementSchema = EmbeddingFailedRequirementSchema;
66433
67355
  exports.EmbeddingInfoSchema = EmbeddingInfoSchema;
67356
+ exports.EmbeddingRefusalCodeSchema = EmbeddingRefusalCodeSchema;
66434
67357
  exports.EmbeddingResultSchema = EmbeddingResultSchema;
67358
+ exports.EmbeddingTowerSchema = EmbeddingTowerSchema;
66435
67359
  exports.EncodeProfileSchema = EncodeProfileSchema;
66436
67360
  exports.EncodedPacketSchema = require_sleep.EncodedPacketSchema;
66437
67361
  exports.EnrichedWidgetMetadataSchema = EnrichedWidgetMetadataSchema;
@@ -66476,6 +67400,21 @@ exports.ExpressionGlobalBindingSchema = ExpressionGlobalBindingSchema;
66476
67400
  exports.ExpressionLiteralBindingSchema = ExpressionLiteralBindingSchema;
66477
67401
  exports.ExpressionParseError = ExpressionParseError;
66478
67402
  exports.ExpressionSourceSchema = ExpressionSourceSchema;
67403
+ exports.ExtensionCandidateSchema = ExtensionCandidateSchema;
67404
+ exports.ExtensionCandidatesSchema = ExtensionCandidatesSchema;
67405
+ exports.ExtensionSetResultSchema = ExtensionSetResultSchema;
67406
+ exports.ExtensionSetSlotInputSchema = ExtensionSetSlotInputSchema;
67407
+ exports.ExtensionSlotActivationSchema = ExtensionSlotActivationSchema;
67408
+ exports.ExtensionSlotIdSchema = ExtensionSlotIdSchema;
67409
+ exports.ExtensionSlotRefInputSchema = ExtensionSlotRefInputSchema;
67410
+ exports.ExtensionSlotRowSchema = ExtensionSlotRowSchema;
67411
+ exports.ExtensionSlotSourceSchema = ExtensionSlotSourceSchema;
67412
+ exports.ExtensionSlotStateSchema = ExtensionSlotStateSchema;
67413
+ exports.ExtensionSlotUnreachableSchema = ExtensionSlotUnreachableSchema;
67414
+ exports.ExtensionSlotValueSchema = ExtensionSlotValueSchema;
67415
+ exports.ExtensionSourceAvailabilitySchema = ExtensionSourceAvailabilitySchema;
67416
+ exports.ExtensionSourceHealthSchema = ExtensionSourceHealthSchema;
67417
+ exports.ExtensionSourceSchema = ExtensionSourceSchema;
66479
67418
  exports.FIRST_LEVEL_MACRO_CLASSES = FIRST_LEVEL_MACRO_CLASSES;
66480
67419
  exports.FULL_IMAGE_BBOX = FULL_IMAGE_BBOX;
66481
67420
  exports.FailureContributionSchema = FailureContributionSchema;
@@ -66532,6 +67471,7 @@ exports.IntercomStatusSchema = IntercomStatusSchema;
66532
67471
  exports.KNOWN_CAP_NAMES = KNOWN_CAP_NAMES;
66533
67472
  exports.KeyEventSchema = KeyEventSchema;
66534
67473
  exports.LEGACY_READ_ONLY_CONFIG_KEY = LEGACY_READ_ONLY_CONFIG_KEY;
67474
+ exports.LINKED_DEVICES_SLOT = LINKED_DEVICES_SLOT;
66535
67475
  exports.LOAD_CONTRIBUTION_ATTRIBUTIONS = LOAD_CONTRIBUTION_ATTRIBUTIONS;
66536
67476
  exports.LOAD_CONTRIBUTION_ROLES = LOAD_CONTRIBUTION_ROLES;
66537
67477
  exports.LOCATION_DESCRIPTION_MAX = LOCATION_DESCRIPTION_MAX;
@@ -66554,6 +67494,7 @@ exports.LedgerWalkSkipReasonSchema = LedgerWalkSkipReasonSchema;
66554
67494
  exports.LegacyStorageLocationDefaultSchema = LegacyStorageLocationDefaultSchema;
66555
67495
  exports.LinkedDeviceSchema = LinkedDeviceSchema;
66556
67496
  exports.LinkedDevicesModeSchema = LinkedDevicesModeSchema;
67497
+ exports.LinkedDevicesSlotValueSchema = LinkedDevicesSlotValueSchema;
66557
67498
  exports.LlmDefaultSchema = LlmDefaultSchema;
66558
67499
  exports.LlmDefaultSelectorSchema = LlmDefaultSelectorSchema;
66559
67500
  exports.LlmDownloadProgressSchema = LlmDownloadProgressSchema;
@@ -66725,6 +67666,8 @@ exports.NC_AUDIO_SEED = NC_AUDIO_SEED;
66725
67666
  exports.NC_AUTHORABLE_SYSTEM_EVENT_KINDS = NC_AUTHORABLE_SYSTEM_EVENT_KINDS;
66726
67667
  exports.NC_BASE_CONDITION_KEYS = NC_BASE_CONDITION_KEYS;
66727
67668
  exports.NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS = NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS;
67669
+ exports.NC_CLIP_POST_ROLL_DEFAULT_SEC = NC_CLIP_POST_ROLL_DEFAULT_SEC;
67670
+ exports.NC_CLIP_PRE_ROLL_DEFAULT_SEC = NC_CLIP_PRE_ROLL_DEFAULT_SEC;
66728
67671
  exports.NC_CLIP_RETENTION_MAX_SEC = NC_CLIP_RETENTION_MAX_SEC;
66729
67672
  exports.NC_CONDITION_CATALOG = NC_CONDITION_CATALOG;
66730
67673
  exports.NC_CONFIRM_DEFAULT_MAX_IMAGE_PX = NC_CONFIRM_DEFAULT_MAX_IMAGE_PX;
@@ -66986,6 +67929,7 @@ exports.ReadSegmentBytesResultSchema = ReadSegmentBytesResultSchema;
66986
67929
  exports.ReadWindowBytesResultSchema = ReadWindowBytesResultSchema;
66987
67930
  exports.ReadinessRegistry = require_sleep.ReadinessRegistry;
66988
67931
  exports.ReadinessTimeoutError = require_sleep.ReadinessTimeoutError;
67932
+ exports.RebuildObjectEmbeddingsRefusalSchema = RebuildObjectEmbeddingsRefusalSchema;
66989
67933
  exports.RecentTracksPageSchema = RecentTracksPageSchema;
66990
67934
  exports.RecentTracksQueryInput = RecentTracksQueryInput;
66991
67935
  exports.RecordTriggerSchema = RecordTriggerSchema;
@@ -67065,6 +68009,7 @@ exports.RunnerCameraConfigSchema = RunnerCameraConfigSchema;
67065
68009
  exports.RunnerCameraDeviceUIFields = RunnerCameraDeviceUIFields;
67066
68010
  exports.RunnerFrameSourceSchema = RunnerFrameSourceSchema;
67067
68011
  exports.RunnerInferenceDeviceSchema = RunnerInferenceDeviceSchema;
68012
+ exports.RunnerJumpStepProvisioningSchema = RunnerJumpStepProvisioningSchema;
67068
68013
  exports.RunnerLocalLoadSchema = RunnerLocalLoadSchema;
67069
68014
  exports.RunnerLocalMetricsSchema = RunnerLocalMetricsSchema;
67070
68015
  exports.SCENE_CONDITIONS = SCENE_CONDITIONS;
@@ -67264,6 +68209,7 @@ exports.UpdateStatusSchema = UpdateStatusSchema;
67264
68209
  exports.UpdateUserInputSchema = UpdateUserInputSchema;
67265
68210
  exports.UserRecordSchema = UserRecordSchema;
67266
68211
  exports.UserSummarySchema = UserSummarySchema;
68212
+ exports.VECTOR_INDEX_DIM_CONFLICT = VECTOR_INDEX_DIM_CONFLICT;
67267
68213
  exports.VIDEOCLIPS_MAX_OFFER_BYTES = VIDEOCLIPS_MAX_OFFER_BYTES;
67268
68214
  exports.VIDEOCLIPS_MAX_READ_BYTES = VIDEOCLIPS_MAX_READ_BYTES;
67269
68215
  exports.VISIT_MERGE_GAP_MS = VISIT_MERGE_GAP_MS;
@@ -67424,6 +68370,7 @@ exports.coreBlocksCapability = coreBlocksCapability;
67424
68370
  exports.cosineSimilarity = cosineSimilarity;
67425
68371
  exports.countConditionLeaves = countConditionLeaves;
67426
68372
  exports.coverCapability = coverCapability;
68373
+ exports.createDeviceExtensionProvider = createDeviceExtensionProvider;
67427
68374
  exports.createDeviceProxy = require_sleep.createDeviceProxy;
67428
68375
  exports.createDurableState = require_sleep.createDurableState;
67429
68376
  exports.createEvent = require_sleep.createEvent;
@@ -67448,6 +68395,7 @@ exports.decoderCapability = decoderCapability;
67448
68395
  exports.defaultDeliveryForSection = defaultDeliveryForSection;
67449
68396
  exports.defaultDeviceFor = defaultDeviceFor;
67450
68397
  exports.defineCustomActions = require_sleep.defineCustomActions;
68398
+ exports.defineExtensionSlotProvider = defineExtensionSlotProvider;
67451
68399
  exports.deriveBatteryPresence = deriveBatteryPresence;
67452
68400
  exports.deriveCameraSwitches = deriveCameraSwitches;
67453
68401
  exports.deriveDetailCropRect = deriveDetailCropRect;
@@ -67466,6 +68414,7 @@ exports.deviceBackendToFormat = deviceBackendToFormat;
67466
68414
  exports.deviceCustomAction = require_sleep.deviceCustomAction;
67467
68415
  exports.deviceDiscoveryCapability = deviceDiscoveryCapability;
67468
68416
  exports.deviceExportCapability = deviceExportCapability;
68417
+ exports.deviceExtensionCapability = deviceExtensionCapability;
67469
68418
  exports.deviceManagerCapability = deviceManagerCapability;
67470
68419
  exports.deviceMatchesProfile = deviceMatchesProfile;
67471
68420
  exports.deviceOpsCapability = require_sleep.deviceOpsCapability;
@@ -67480,6 +68429,11 @@ exports.droppedConditionsForKind = droppedConditionsForKind;
67480
68429
  exports.egressTranscodeSharingKey = egressTranscodeSharingKey;
67481
68430
  exports.egressTransportFromRequest = egressTransportFromRequest;
67482
68431
  exports.embeddingEncoderCapability = embeddingEncoderCapability;
68432
+ exports.embeddingModelFailedError = embeddingModelFailedError;
68433
+ exports.embeddingModelFailedOf = embeddingModelFailedOf;
68434
+ exports.embeddingRefusalOf = embeddingRefusalOf;
68435
+ exports.embeddingRequirementsFailedError = embeddingRequirementsFailedError;
68436
+ exports.embeddingRequirementsUnavailableError = embeddingRequirementsUnavailableError;
67483
68437
  exports.emitDownForOwnedCaps = require_sleep.emitDownForOwnedCaps;
67484
68438
  exports.emitReadiness = require_sleep.emitReadiness;
67485
68439
  exports.emitsCollectionSelector = emitsCollectionSelector;
@@ -67503,6 +68457,7 @@ exports.expandAudioChunkToF32le = require_sleep.expandAudioChunkToF32le;
67503
68457
  exports.expandCapMethods = require_sleep.expandCapMethods;
67504
68458
  exports.expandContainer = expandContainer;
67505
68459
  exports.exportSubjectOf = exportSubjectOf;
68460
+ exports.extensionSlotRef = extensionSlotRef;
67506
68461
  exports.extractNestedAddonId = extractNestedAddonId;
67507
68462
  exports.extractSourceInfoFromMetadata = extractSourceInfoFromMetadata;
67508
68463
  exports.faceGalleryCapability = faceGalleryCapability;
@@ -67538,6 +68493,8 @@ exports.inferModelProvider = inferModelProvider;
67538
68493
  exports.initialPoolMemoryState = initialPoolMemoryState;
67539
68494
  exports.integrationsCapability = integrationsCapability;
67540
68495
  exports.intercomCapability = intercomCapability;
68496
+ exports.interpretStoredClusterModel = interpretStoredClusterModel;
68497
+ exports.invalidClusterStepModelEntries = invalidClusterStepModelEntries;
67541
68498
  exports.invocationFromEncodeProfile = require_canonical_hash.invocationFromEncodeProfile;
67542
68499
  exports.isAgentOnlyPlacement = isAgentOnlyPlacement;
67543
68500
  exports.isArrayOutputSchema = isArrayOutputSchema;
@@ -67553,6 +68510,7 @@ exports.isDetectionMacroClass = isDetectionMacroClass;
67553
68510
  exports.isDeviceConfigCap = require_sleep.isDeviceConfigCap;
67554
68511
  exports.isDeviceScopedCap = require_sleep.isDeviceScopedCap;
67555
68512
  exports.isDisplayIconKey = isDisplayIconKey;
68513
+ exports.isEmbeddingModelFailed = isEmbeddingModelFailed;
67556
68514
  exports.isEvent = require_sleep.isEvent;
67557
68515
  exports.isEventOwnerType = isEventOwnerType;
67558
68516
  exports.isFirstLevelMacroClass = isFirstLevelMacroClass;
@@ -67575,6 +68533,7 @@ exports.isSystemDelivery = isSystemDelivery;
67575
68533
  exports.isSystemEventFamily = isSystemEventFamily;
67576
68534
  exports.isSystemEventSummaryRule = isSystemEventSummaryRule;
67577
68535
  exports.isSystemRuleKind = isSystemRuleKind;
68536
+ exports.isVectorIndexDimConflict = isVectorIndexDimConflict;
67578
68537
  exports.isVoidInput = isVoidInput;
67579
68538
  exports.ituDbfsFromPreEpoch = ituDbfsFromPreEpoch;
67580
68539
  exports.jobKindSchema = jobKindSchema;
@@ -67637,6 +68596,7 @@ exports.nodePin = require_sleep.nodePin;
67637
68596
  exports.nodesCapability = nodesCapability;
67638
68597
  exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
67639
68598
  exports.normalizeAudioLabel = normalizeAudioLabel;
68599
+ exports.normalizeNodeId = require_sleep.normalizeNodeId;
67640
68600
  exports.normalizeTokenScopes = normalizeTokenScopes;
67641
68601
  exports.normalizeUnit = normalizeUnit;
67642
68602
  exports.notificationOutputCapability = notificationOutputCapability;
@@ -67670,6 +68630,7 @@ exports.pickAccessoryControl = pickAccessoryControl;
67670
68630
  exports.pickClusterStepModels = pickClusterStepModels;
67671
68631
  exports.pickClusterStepSettings = pickClusterStepSettings;
67672
68632
  exports.pickDetailCropConvention = pickDetailCropConvention;
68633
+ exports.pickInvalidClusterStepModels = pickInvalidClusterStepModels;
67673
68634
  exports.pickNativeLeaseOverride = pickNativeLeaseOverride;
67674
68635
  exports.pickPreferredRtspEntry = pickPreferredRtspEntry;
67675
68636
  exports.pickRestartCandidate = pickRestartCandidate;
@@ -67717,6 +68678,7 @@ exports.resolveAddonGroup = resolveAddonGroup;
67717
68678
  exports.resolveAddonPlacement = resolveAddonPlacement;
67718
68679
  exports.resolveBucketMs = resolveBucketMs;
67719
68680
  exports.resolveCapMount = require_sleep.resolveCapMount;
68681
+ exports.resolveClipSearchMinScore = resolveClipSearchMinScore;
67720
68682
  exports.resolveClusterStepModelId = resolveClusterStepModelId;
67721
68683
  exports.resolveContainerPrimaryChild = resolveContainerPrimaryChild;
67722
68684
  exports.resolveCreateExportSubject = resolveCreateExportSubject;
@@ -67836,6 +68798,7 @@ exports.tryConvertUnit = tryConvertUnit;
67836
68798
  exports.turnProviderCapability = turnProviderCapability;
67837
68799
  exports.unitDimension = unitDimension;
67838
68800
  exports.unitsForDimension = unitsForDimension;
68801
+ exports.unreachableExtensionSlotRow = unreachableExtensionSlotRow;
67839
68802
  exports.updateCapability = updateCapability;
67840
68803
  exports.userManagementCapability = userManagementCapability;
67841
68804
  exports.userPasskeysCapability = userPasskeysCapability;
@@ -67844,6 +68807,7 @@ exports.validateExpressionSource = validateExpressionSource;
67844
68807
  exports.validateRecipeBounds = validateRecipeBounds;
67845
68808
  exports.valveCapability = valveCapability;
67846
68809
  exports.vectorDimFromBase64 = vectorDimFromBase64;
68810
+ exports.vectorIndexDimConflictError = vectorIndexDimConflictError;
67847
68811
  exports.vectorStoreCapability = vectorStoreCapability;
67848
68812
  exports.vibrationCapability = vibrationCapability;
67849
68813
  exports.videoclipsCapability = videoclipsCapability;