@camstack/addon-post-analysis 1.2.284 → 1.2.286

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 (18) hide show
  1. package/THIRD_PARTY_MODELS.md +241 -0
  2. package/dist/{dist-Bpx5JMso.js → clip-model-registry-CY0FGcpQ.js} +2661 -1244
  3. package/dist/{dist-C770IfQJ.mjs → clip-model-registry-D4mC2M7F.mjs} +2516 -1231
  4. package/dist/embedding-encoder/index.js +962 -428
  5. package/dist/embedding-encoder/index.mjs +952 -418
  6. package/dist/pipeline-analytics/_stub.js +2 -2
  7. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-Cc4KIQdo.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-CkfvSztj.mjs} +2 -2
  8. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-NKbCrEkH.mjs +26 -0
  9. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BAYoLHsN.mjs +26 -0
  10. package/dist/pipeline-analytics/{hostInit-BzoLW-k9.mjs → hostInit-CelYj4QN.mjs} +2 -2
  11. package/dist/pipeline-analytics/index.js +10273 -7693
  12. package/dist/pipeline-analytics/index.mjs +7707 -5127
  13. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  14. package/package.json +3 -2
  15. package/python/test_text_encoder.py +49 -2
  16. package/python/text_encoder_inference.py +31 -14
  17. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CZkZhroP.mjs +0 -26
  18. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DWPDYuJS.mjs +0 -26
@@ -5391,7 +5391,7 @@ var ZodIssueCode = {
5391
5391
  var ZodFirstPartyTypeKind;
5392
5392
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5393
5393
  //#endregion
5394
- //#region ../types/dist/sleep-DU7mu4wb.mjs
5394
+ //#region ../types/dist/sleep-BXv0ZcRa.mjs
5395
5395
  /**
5396
5396
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5397
5397
  * window to float samples (D455).
@@ -6176,6 +6176,40 @@ var BaseAddon = class {
6176
6176
  const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
6177
6177
  return keys.size > 0 ? projectStore(raw, keys, node) : raw;
6178
6178
  }
6179
+ /**
6180
+ * Whether ONE global key of this addon's store was written, read three-way
6181
+ * (D651). For a question a hydrated view cannot answer: `getGlobalSettings`
6182
+ * reports `value ?? default`, so "the operator chose the default" and "nobody
6183
+ * chose" look the same, and a failed read looks like both. A `perNode` key is
6184
+ * not supported here: its stored name is scoped.
6185
+ */
6186
+ async readStoredGlobalKey(key) {
6187
+ const read = this._ctx?.settings?.readAddonStoreResult;
6188
+ if (read === void 0) return {
6189
+ kind: "unreadable",
6190
+ reason: "three-way-read-unavailable"
6191
+ };
6192
+ let result;
6193
+ try {
6194
+ result = await read.call(this._ctx?.settings);
6195
+ } catch (err) {
6196
+ return {
6197
+ kind: "unreadable",
6198
+ reason: "store-read-failed",
6199
+ error: err instanceof Error ? err.message : String(err)
6200
+ };
6201
+ }
6202
+ if (result.kind === "failed") return {
6203
+ kind: "unreadable",
6204
+ reason: "store-read-failed",
6205
+ error: result.error
6206
+ };
6207
+ if (result.kind === "missing" || !Object.prototype.hasOwnProperty.call(result.value, key)) return { kind: "absent" };
6208
+ return {
6209
+ kind: "present",
6210
+ value: result.value[key]
6211
+ };
6212
+ }
6179
6213
  async updateGlobalSettings(patch, nodeId) {
6180
6214
  const keys = this.perNodeKeys();
6181
6215
  const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
@@ -7471,7 +7505,7 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
7471
7505
  * can answer "may a rule actuate this?" without importing the schema barrel
7472
7506
  * (~144MB RSS per runner, D28).
7473
7507
  *
7474
- * Coverage: 87 device-scoped capabilities.
7508
+ * Coverage: 88 device-scoped capabilities.
7475
7509
  */
7476
7510
  var DEVICE_SCOPED_CAPS = new Set([
7477
7511
  "accessories",
@@ -7501,6 +7535,7 @@ var DEVICE_SCOPED_CAPS = new Set([
7501
7535
  "detection-pipeline",
7502
7536
  "device-admin-link",
7503
7537
  "device-discovery",
7538
+ "device-extension",
7504
7539
  "device-ops",
7505
7540
  "device-status",
7506
7541
  "doorbell",
@@ -10027,6 +10062,60 @@ var FailureCounters = class {
10027
10062
  this.counters.clear();
10028
10063
  }
10029
10064
  };
10065
+ var ClipModelMetaSchema = object({
10066
+ /** The paired text encoder's catalog id (the embedding-encoder's text catalog). */
10067
+ textModelId: string().min(1),
10068
+ /** Output dimension of BOTH towers. A vector of any other length is refused. */
10069
+ embeddingDim: number().int().positive(),
10070
+ /**
10071
+ * The `vector-store` index this model's vectors live in. ONE feature space
10072
+ * per index: two models share an index only when their vectors are ranked
10073
+ * against each other, which for CLIP means never across families. MobileCLIP
10074
+ * S1 and S2 share `object-clip` for history (separated by the row's
10075
+ * `modelId`); any other model gets its own.
10076
+ */
10077
+ vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
10078
+ /**
10079
+ * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
10080
+ * must be unique per tokenizer: every model's siblings land in ONE flat
10081
+ * models directory, so two different tokenizers under the same name would
10082
+ * silently overwrite each other (whichever model downloaded last wins, and
10083
+ * the other one tokenises with the wrong vocabulary).
10084
+ */
10085
+ tokenizerFile: string().min(1),
10086
+ /** Token window the text graph takes (SigLIP2: 64; CLIP BPE: 77). */
10087
+ contextLength: number().int().positive(),
10088
+ /** Id the tokenizer pads with. */
10089
+ padId: number().int().nonnegative(),
10090
+ /**
10091
+ * The search cosine floor at `strictness: 'loose'` — calibrated per model,
10092
+ * because cosine bands are a property of the model: 0.2 keeps 96% of matched
10093
+ * COCO caption-image pairs on MobileCLIP S1 and 2.7% on SigLIP2.
10094
+ */
10095
+ searchMinScore: number().min(0).max(1)
10096
+ });
10097
+ var ClipSearchStrictnessSchema = _enum([
10098
+ "loose",
10099
+ "balanced",
10100
+ "strict"
10101
+ ]);
10102
+ var CLIP_STRICTNESS_FACTOR = {
10103
+ loose: 1,
10104
+ balanced: 1.25,
10105
+ strict: 1.5
10106
+ };
10107
+ /**
10108
+ * The cosine floor a search runs with.
10109
+ *
10110
+ * An explicit `minScore` is honoured verbatim: it is a number a caller chose,
10111
+ * and silently rescaling it would make the same URL mean different things on
10112
+ * two installs. Everything else is relative to the model.
10113
+ */
10114
+ function resolveClipSearchMinScore(meta, request) {
10115
+ if (request.minScore !== void 0) return request.minScore;
10116
+ const factor = CLIP_STRICTNESS_FACTOR[request.strictness ?? "loose"];
10117
+ return Math.min(1, Math.round(meta.searchMinScore * factor * 1e3) / 1e3);
10118
+ }
10030
10119
  var MODEL_FORMATS = [
10031
10120
  "onnx",
10032
10121
  "coreml",
@@ -10055,7 +10144,7 @@ var ModelFormatEntrySchema = object({
10055
10144
  /** Multi-file payload (directory members or sibling files). */
10056
10145
  files: array(string()).readonly().optional(),
10057
10146
  /** Runtime(s) that can use this format. If omitted, inferred from ModelFormat key */
10058
- runtimes: array(_enum(["node", "python"])).readonly().optional()
10147
+ runtimes: array(_enum(["python"])).readonly().optional()
10059
10148
  });
10060
10149
  /**
10061
10150
  * Extra file that must be downloaded alongside the model (e.g., labels JSON, dict.txt).
@@ -10230,7 +10319,14 @@ var ModelCatalogEntrySchema = object({
10230
10319
  * applies (Frigate / COCO public catalog). Set on a custom model whose raw
10231
10320
  * labels already ARE the CamStack macros (Scrypted identity map).
10232
10321
  */
10233
- classMap: DetectionCatalogClassMapSchema.optional()
10322
+ classMap: DetectionCatalogClassMapSchema.optional(),
10323
+ /**
10324
+ * The model's CLIP feature-space contract (text encoder, dimension, vector
10325
+ * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
10326
+ * CLIP image encoder; its absence is what "not a CLIP model" means to the
10327
+ * embedding encoder and the semantic-search store (D649).
10328
+ */
10329
+ clip: ClipModelMetaSchema.optional()
10234
10330
  });
10235
10331
  var ConvertTargetSchema = discriminatedUnion("format", [object({
10236
10332
  format: literal("openvino"),
@@ -14680,6 +14776,13 @@ var LinkedDeviceSchema = object({
14680
14776
  features: array(string()),
14681
14777
  producesTrackedEvents: boolean().optional()
14682
14778
  });
14779
+ /**
14780
+ * The `linked-devices` extension slot's editable value (D648): the operator's
14781
+ * pick list, exactly what `_linkedDeviceIds` persists. Tree children are NOT
14782
+ * in it — they are always linked and are not a pick.
14783
+ */
14784
+ var LinkedDevicesSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
14785
+ DeviceType.Camera;
14683
14786
  /** One camera's resolved linked set, tagged with the camera it belongs to.
14684
14787
  * The batch answer needs the tag; the single-device answer already has it
14685
14788
  * from the input, which is why `getLinkedDevices` keeps the untagged shape. */
@@ -15205,11 +15308,128 @@ var EmbeddingResultSchema = object({
15205
15308
  embedding: array(number()),
15206
15309
  inferenceMs: number()
15207
15310
  });
15311
+ /** The two CLIP towers the encoder runs; a crash budget is kept per tower. */
15312
+ var EmbeddingTowerSchema = _enum(["image", "text"]);
15313
+ /**
15314
+ * A tower in the terminal `failed` state (D649, D6): it crashed or failed to
15315
+ * load `crashes` times within `windowMs`, and is refused by name until an
15316
+ * operator `resetFailedModels` or a model change — never on a timer.
15317
+ *
15318
+ * `nodeId` is the node whose tower failed. The state lives in THAT node's
15319
+ * encoder process (in memory — a runner respawn clears it), and one node's
15320
+ * answer says nothing about another's.
15321
+ */
15322
+ var EmbeddingFailedModelSchema = object({
15323
+ modelId: string(),
15324
+ tower: EmbeddingTowerSchema,
15325
+ nodeId: string(),
15326
+ crashes: number(),
15327
+ windowMs: number(),
15328
+ sinceMs: number(),
15329
+ lastReason: string()
15330
+ });
15331
+ /**
15332
+ * A model whose REQUIREMENTS can never be met on this node (D649 round 5):
15333
+ * an id the catalog does not know, a model URL answering 404/410, a declared
15334
+ * sibling (the tokenizer) that is not there. After `attempts` failed builds
15335
+ * it is terminally `requirements-failed`, refused by name until an operator
15336
+ * `resetFailedModels` or a model change — the same exits as a crashed tower.
15337
+ */
15338
+ var EmbeddingFailedRequirementSchema = object({
15339
+ modelId: string(),
15340
+ tower: EmbeddingTowerSchema,
15341
+ nodeId: string(),
15342
+ attempts: number(),
15343
+ sinceMs: number(),
15344
+ lastReason: string()
15345
+ });
15208
15346
  var EmbeddingInfoSchema = object({
15209
15347
  modelId: string(),
15210
15348
  embeddingDim: number(),
15211
- ready: boolean()
15212
- });
15349
+ ready: boolean(),
15350
+ /**
15351
+ * The node that answered. Absent only from an encoder older than D649's
15352
+ * crash budget — whose `failedModels` is then UNKNOWN (D315), never "none".
15353
+ */
15354
+ nodeId: string().optional(),
15355
+ /**
15356
+ * Towers in `failed` on the answering node, each row naming it. `undefined`
15357
+ * means the node could not say (pre-budget encoder); a node that has the
15358
+ * budget always answers an array, empty included.
15359
+ */
15360
+ failedModels: array(EmbeddingFailedModelSchema).optional(),
15361
+ /** Models terminally `requirements-failed` on the answering node; same reading as above. */
15362
+ failedRequirements: array(EmbeddingFailedRequirementSchema).optional()
15363
+ });
15364
+ /**
15365
+ * The THREE codes an encoder refusal can carry (D649, D6). Same shape as
15366
+ * `VECTOR_INDEX_DIM_CONFLICT`: the code rides in the MESSAGE, because an
15367
+ * Error's own properties do not survive the UDS/tRPC hop and its message does,
15368
+ * and both sides go through the helpers below — the encoder builds the
15369
+ * refusal, the live detail plane classifies on it to count refusals per
15370
+ * camera instead of logging one warning per track. The bracketed token
15371
+ * carries the code, the model, the tower and the node so a consumer never
15372
+ * parses prose.
15373
+ *
15374
+ * - `EMBEDDING_MODEL_FAILED`: the tower crashed / failed to load past the crash
15375
+ * budget — terminal until `resetFailedModels` or a model change.
15376
+ * - `EMBEDDING_REQUIREMENTS_UNAVAILABLE`: files or runtime not there right now
15377
+ * (a download or Python that failed, or the cooldown after one) — the next
15378
+ * request past the cooldown tries again.
15379
+ * - `EMBEDDING_REQUIREMENTS_FAILED`: the requirements can never be met (unknown
15380
+ * id, 404/410, missing sibling) and the bounded attempts are spent —
15381
+ * terminal, same exits as a crashed tower.
15382
+ */
15383
+ var EMBEDDING_MODEL_FAILED = "embedding-model-failed";
15384
+ var EMBEDDING_REQUIREMENTS_UNAVAILABLE = "embedding-requirements-unavailable";
15385
+ var EMBEDDING_REQUIREMENTS_FAILED = "embedding-requirements-failed";
15386
+ var EmbeddingRefusalCodeSchema = _enum([
15387
+ EMBEDDING_MODEL_FAILED,
15388
+ EMBEDDING_REQUIREMENTS_UNAVAILABLE,
15389
+ EMBEDDING_REQUIREMENTS_FAILED
15390
+ ]);
15391
+ function embeddingRefusalToken(code, on) {
15392
+ return `[${code} model=${on.modelId} tower=${on.tower} node=${on.nodeId}]`;
15393
+ }
15394
+ /** The encoder's refusal for a crashed tower, carrying {@link EMBEDDING_MODEL_FAILED}. */
15395
+ function embeddingModelFailedError(row) {
15396
+ 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.`);
15397
+ }
15398
+ /** The requirements refusal for THIS request, carrying {@link EMBEDDING_REQUIREMENTS_UNAVAILABLE}. */
15399
+ function embeddingRequirementsUnavailableError(on, reason) {
15400
+ return /* @__PURE__ */ new Error(`${embeddingRefusalToken(EMBEDDING_REQUIREMENTS_UNAVAILABLE, on)} ${on.modelId} (${on.tower} tower) on ${on.nodeId}: ${reason}`);
15401
+ }
15402
+ /** The terminal requirements refusal, carrying {@link EMBEDDING_REQUIREMENTS_FAILED}. */
15403
+ function embeddingRequirementsFailedError(row) {
15404
+ 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.`);
15405
+ }
15406
+ var EMBEDDING_REFUSAL_TOKEN = new RegExp(`\\[(${EMBEDDING_MODEL_FAILED}|${EMBEDDING_REQUIREMENTS_UNAVAILABLE}|${EMBEDDING_REQUIREMENTS_FAILED}) model=([^\\s\\]]+) tower=(image|text) node=([^\\s\\]]+)\\]`);
15407
+ /** The refusal `err` (possibly re-wrapped by a transport) carries, or `null` for any other error. */
15408
+ function embeddingRefusalOf(err) {
15409
+ const message = err instanceof Error ? err.message : String(err);
15410
+ const match = EMBEDDING_REFUSAL_TOKEN.exec(message);
15411
+ if (match === null) return null;
15412
+ const code = EmbeddingRefusalCodeSchema.safeParse(match[1]);
15413
+ const tower = EmbeddingTowerSchema.safeParse(match[3]);
15414
+ if (!code.success || !tower.success || match[2] === void 0 || match[4] === void 0) return null;
15415
+ return {
15416
+ code: code.data,
15417
+ modelId: match[2],
15418
+ tower: tower.data,
15419
+ nodeId: match[4]
15420
+ };
15421
+ }
15422
+ /**
15423
+ * ONE provider per node (`placement: any-node`), addressed like every global
15424
+ * collection: the codegen injects a `{ nodeId?, addonId? }` selector on the
15425
+ * void methods and lifts a top-level `nodeId` off the object ones. A call
15426
+ * that names no node is answered by the HUB's provider — never by a merge
15427
+ * across nodes, because no global collection fans out across nodes (only the
15428
+ * providers of one node are `concatCollection`-fanned). So a fleet view of
15429
+ * `failedModels` is one `getInfo({ nodeId })` per node, and every answer
15430
+ * names the node it came from (D649 round 4); a node that cannot be asked is
15431
+ * UNKNOWN to the reader, never "no failures" (D315).
15432
+ */
15213
15433
  var embeddingEncoderCapability = {
15214
15434
  name: "embedding-encoder",
15215
15435
  scope: "system",
@@ -15228,8 +15448,30 @@ var embeddingEncoderCapability = {
15228
15448
  width: number(),
15229
15449
  height: number()
15230
15450
  }), EmbeddingResultSchema, { auth: "admin" }),
15231
- encodeText: method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }),
15232
- getInfo: method(_void(), EmbeddingInfoSchema, { auth: "admin" })
15451
+ /**
15452
+ * `modelId` (a CLIP IMAGE model id, whose catalog `clip.textModelId` names
15453
+ * the text tower) encodes in that model's space; absent, the cluster row's
15454
+ * `clip-embedding` model — the space every writer is in (D649).
15455
+ */
15456
+ encodeText: method(object({
15457
+ text: string(),
15458
+ modelId: string().min(1).optional()
15459
+ }), EmbeddingResultSchema, { auth: "admin" }),
15460
+ /** Answers for ONE node — the `nodeId` selector's, else the hub's. */
15461
+ getInfo: method(_void(), EmbeddingInfoSchema, { auth: "admin" }),
15462
+ /**
15463
+ * The operator's explicit clear of the `failed` state (one model, or all)
15464
+ * on ONE node — pass `nodeId` for an agent; the result names the node it
15465
+ * cleared. The only way out besides a model change: a crashing tower is
15466
+ * not retried on a timer.
15467
+ */
15468
+ resetFailedModels: method(object({ modelId: string().min(1).optional() }), object({
15469
+ cleared: array(string()),
15470
+ nodeId: string()
15471
+ }), {
15472
+ kind: "mutation",
15473
+ auth: "admin"
15474
+ })
15233
15475
  }
15234
15476
  };
15235
15477
  /**
@@ -18126,6 +18368,25 @@ var NcScheduleSchema = object({
18126
18368
  /** Active OUTSIDE the windows (e.g. "only outside business hours"). */
18127
18369
  invert: boolean().optional()
18128
18370
  });
18371
+ /**
18372
+ * How a system-event rule of the `device-events` or `system` family speaks
18373
+ * (D647): at once, per event (`instant`, the only behaviour before D647), or
18374
+ * as a STATE SUMMARY at the end of each window of `schedule`.
18375
+ */
18376
+ var NcSystemEventDeliveryModeSchema = _enum(["instant", "summary"]);
18377
+ /**
18378
+ * `summary`: the rule sends NOTHING per event. When a window of `schedule`
18379
+ * CLOSES, it sends one notification with the current state of its kinds
18380
+ * (low batteries, consumables to replace, devices offline, updates
18381
+ * available, ...), after its own filters. Nothing to report sends nothing.
18382
+ * The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
18383
+ * midnight crossing); the send time is each window's END. Refused on the
18384
+ * `alarm` family, which stays instant (`systemEventDeliveryProblems`).
18385
+ */
18386
+ var NcSystemEventDeliverySchema = discriminatedUnion("mode", [object({ mode: literal("instant") }), object({
18387
+ mode: literal("summary"),
18388
+ schedule: NcScheduleSchema
18389
+ })]);
18129
18390
  /** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
18130
18391
  var NcPlateMatcherSchema = object({
18131
18392
  /**
@@ -18739,7 +19000,12 @@ var NcMediaPolicySchema = object({
18739
19000
  * the degrade engine, which drops the video and keeps the still.
18740
19001
  */
18741
19002
  clip: boolean().optional(),
18742
- /** Seconds of footage BEFORE / AFTER the event instant. Defaults 3 / 7. */
19003
+ /**
19004
+ * Seconds of footage BEFORE / AFTER the event instant. Absent =
19005
+ * {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
19006
+ * (4 / 6), resolved by the Notification Center at dispatch — deliberately not
19007
+ * a Zod default, so a rule that never chose keeps following the hub's.
19008
+ */
18743
19009
  clipPreRollSec: number().int().min(0).max(30).optional(),
18744
19010
  clipPostRollSec: number().int().min(0).max(30).optional(),
18745
19011
  /**
@@ -18861,6 +19127,16 @@ var NcRuleInputSchema = object({
18861
19127
  delivery: NcDeliverySchema,
18862
19128
  conditions: NcConditionsSchema.default({}),
18863
19129
  schedule: NcScheduleSchema.optional(),
19130
+ /**
19131
+ * A `device-events` / `system` rule's delivery (D647): absent or `instant`
19132
+ * is a notification per event; `summary` is one state summary per closed
19133
+ * window of its schedule. `.optional()` and never defaulted: absent must
19134
+ * keep meaning what every rule authored before D647 meant, with no
19135
+ * migration. Top-level rather than inside `conditions.systemEvent`, so a
19136
+ * client that does not know it (an older viewer re-sending `conditions`
19137
+ * whole) leaves it standing through the store's patch merge.
19138
+ */
19139
+ systemEventDelivery: NcSystemEventDeliverySchema.optional(),
18864
19140
  /** May be empty when `targetUsers` addresses at least one user — the
18865
19141
  * "at least one addressee" invariant is enforced by the provider, because
18866
19142
  * a cross-field refine here would break `NcRulePatchSchema.partial()`. */
@@ -19089,6 +19365,28 @@ var NcRuleSchema = NcRuleInputSchema.extend({
19089
19365
  */
19090
19366
  disabledTargetIds: array(string()).default([])
19091
19367
  });
19368
+ /** One section of a previewed state summary. `unavailable` = its state could not be read. */
19369
+ var NcStateSummaryPreviewSectionSchema = object({
19370
+ id: string(),
19371
+ status: _enum(["read", "unavailable"]),
19372
+ items: number().int().nonnegative(),
19373
+ reason: string().optional()
19374
+ });
19375
+ /**
19376
+ * The summary a rule would send now. `empty` = nothing to report and every
19377
+ * section read: such a summary is NOT sent. `dropped` counts the open states
19378
+ * the rule's own filters (or a camera mute) left out, by reason.
19379
+ * `excludedGroups` names the kind groups selected that have no state to report
19380
+ * (backups & exports).
19381
+ */
19382
+ var NcStateSummaryPreviewSchema = object({
19383
+ empty: boolean(),
19384
+ count: number().int().nonnegative(),
19385
+ text: string(),
19386
+ sections: array(NcStateSummaryPreviewSectionSchema),
19387
+ dropped: record(string(), number().int().nonnegative()),
19388
+ excludedGroups: array(string())
19389
+ });
19092
19390
  var NcTestResultSchema = object({
19093
19391
  recordId: string(),
19094
19392
  recordKind: _enum([
@@ -19180,6 +19478,13 @@ var NcTemplateVarDescriptorSchema = object({
19180
19478
  kinds: array(NcTemplateVarKindSchema).optional(),
19181
19479
  deliveries: array(NcDeliverySchema).optional(),
19182
19480
  systemEventKinds: array(NcSystemEventKindSchema).optional(),
19481
+ /**
19482
+ * Which system-event DELIVERY has a value for it (D647). Absent = an
19483
+ * instant row only when the descriptor names `systemEventKinds` (a
19484
+ * per-event fact: a summary row has no single device), and both otherwise.
19485
+ * `['summary']` marks the state-summary vocabulary (`{{summaryText}}`, ...).
19486
+ */
19487
+ systemEventDeliveries: array(NcSystemEventDeliveryModeSchema).optional(),
19183
19488
  dynamic: object({
19184
19489
  prefix: literal("count_"),
19185
19490
  from: literal("classes")
@@ -19192,7 +19497,9 @@ var NcTemplatePreviewInputSchema = object({
19192
19497
  field: NcTemplateFieldSchema,
19193
19498
  kind: NcRuleKindSchema.optional(),
19194
19499
  delivery: NcDeliverySchema.optional(),
19195
- systemEventKinds: array(NcSystemEventKindSchema).optional()
19500
+ systemEventKinds: array(NcSystemEventKindSchema).optional(),
19501
+ /** The rule's system-event delivery (D647); absent = instant. */
19502
+ systemEventDelivery: NcSystemEventDeliveryModeSchema.optional()
19196
19503
  }),
19197
19504
  template: object({
19198
19505
  title: string().max(500).optional(),
@@ -20326,6 +20633,17 @@ var notificationRulesCapability = {
20326
20633
  auth: "admin"
20327
20634
  }),
20328
20635
  /**
20636
+ * The STATE SUMMARY a system rule would send now (D647) — for a saved rule
20637
+ * or an unsaved draft. Pure: sends nothing, stamps nothing. A MUTATION
20638
+ * only for transport (a whole rule does not belong in a GET URL). Admin,
20639
+ * like `testRule`: it names devices and nodes across the installation.
20640
+ */
20641
+ previewStateSummary: method(object({ rule: NcRuleInputSchema }), NcStateSummaryPreviewSchema, {
20642
+ kind: "mutation",
20643
+ auth: "admin",
20644
+ access: "view"
20645
+ }),
20646
+ /**
20329
20647
  * The machine-readable condition surface a rule editor renders from, plus
20330
20648
  * the picker VOCABULARY those conditions draw on.
20331
20649
  *
@@ -20770,786 +21088,342 @@ var OauthIntegrationDescriptorSchema = object({
20770
21088
  });
20771
21089
  method(_void(), OauthIntegrationDescriptorSchema, { auth: "admin" });
20772
21090
  /**
20773
- * Reference to the frame's retained NATIVE surface + the parent crop's placement
20774
- * within the frame, so the executor can re-cut a leaf child ROI at native
20775
- * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
21091
+ * A model choice has a SCOPE, and a scope change has a workflow.
21092
+ *
21093
+ * ## The two scopes
21094
+ *
21095
+ * Almost every pipeline step's model is a **node** question: which build runs
21096
+ * fastest on THIS accelerator. Two nodes may legitimately answer differently —
21097
+ * a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
21098
+ * are compared against nothing. They produce boxes, and a box is a box.
21099
+ *
21100
+ * Two steps are not like that. `face-embedding` and `clip-embedding` produce
21101
+ * **vectors that land in ONE shared index** (`identity_samples`,
21102
+ * `vec_object_clip`) and are ranked against each other by cosine similarity.
21103
+ * Cosine similarity between two encoders is not a weak signal, it is a
21104
+ * meaningless number — and nothing inside a vector can tell you it happened.
21105
+ * So for those two steps the model is a **cluster** question with exactly one
21106
+ * answer, stored in exactly one row.
21107
+ *
21108
+ * That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
21109
+ * for the crop convention (`detail-crop.ts`), one level up: the crop decides
21110
+ * WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
21111
+ * cluster-wide for the same reason and neither may become per-node.
21112
+ *
21113
+ * ## Why the registry lives here and not in the step catalog
21114
+ *
21115
+ * The scope itself is declared on the step, in
21116
+ * `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
21117
+ * — that is where a new step declares what kind of choice its model is. But the
21118
+ * catalog lives inside `addon-pipeline`, and three packages that must NOT
21119
+ * import an addon need to know the set: the orchestrator (which renders and
21120
+ * stores the row), post-analysis (which pins the row for a re-embed pass) and
21121
+ * admin-ui (which mirrors it). So the set is mirrored here, and
21122
+ * `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
21123
+ * A hand-copied key that stops matching is exactly how a setting silently stops
21124
+ * arriving while both sides still look correct.
21125
+ *
21126
+ * ## The defaults ARE today's behaviour
21127
+ *
21128
+ * {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
21129
+ * of both steps. Declaring the scope therefore changes nothing on the day it
21130
+ * ships: the cluster row starts out saying what every node was already doing.
21131
+ * Changing it is legitimate — that is what the knob is for — but it invalidates
21132
+ * the stored vectors of that surface, and must be followed by a re-embed pass
21133
+ * (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
20776
21134
  */
20777
- var NativeCropRefSchema = object({
20778
- /** Handle keying the retained native surface (node-pinned to its owner). */
20779
- handle: FrameHandleSchema,
20780
- /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
20781
- cropFrameSpace: object({
20782
- x: number(),
20783
- y: number(),
20784
- w: number(),
20785
- h: number()
20786
- })
20787
- });
20788
- object({
20789
- crop: object({
20790
- left: number(),
20791
- top: number(),
20792
- width: number().positive(),
20793
- height: number().positive()
20794
- }).optional(),
20795
- content: object({
20796
- width: number().int().positive(),
20797
- height: number().int().positive()
20798
- }),
20799
- fit: _enum(["stretch", "contain"]),
20800
- format: _enum([
20801
- "rgb",
20802
- "gray",
20803
- "jpeg"
20804
- ])
20805
- });
20806
21135
  /**
20807
- * Process-local frame identity. It is serializable so it can ride an in-process
20808
- * capability call, but `registryId` deliberately prevents resolution in any
20809
- * other process or execution group.
21136
+ * Why the orchestrator cannot say which model the operator chose for a
21137
+ * cluster-scoped step (D651).
20810
21138
  */
20811
- var FrameRefSchema = object({
20812
- registryId: string().min(1),
20813
- id: string().min(1),
20814
- width: number().int().positive(),
20815
- height: number().int().positive(),
20816
- format: _enum(["rgb", "gray"]),
20817
- timestamp: number(),
20818
- capturedAt: number().optional()
20819
- });
20820
- var ModelFormatSchema$1 = _enum([
20821
- "onnx",
20822
- "coreml",
20823
- "openvino",
20824
- "tflite",
20825
- "pt",
20826
- "gguf"
21139
+ var CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS = [
21140
+ "owner-not-ready",
21141
+ "store-read-failed",
21142
+ "three-way-read-unavailable",
21143
+ "invalid-stored",
21144
+ "not-cluster-scoped"
21145
+ ];
21146
+ /**
21147
+ * The cluster-scoped steps. Mirrored from the catalog's `modelScope: 'cluster'`
21148
+ * declarations and guarded by `scripts/check-cluster-model-scope.ts`.
21149
+ */
21150
+ var CLUSTER_MODEL_SCOPED_STEPS = [{
21151
+ stepId: "face-embedding",
21152
+ label: "Face recognition model",
21153
+ defaultModelId: "auraface-r100",
21154
+ indexName: "the enrolled face gallery",
21155
+ options: [
21156
+ {
21157
+ id: "auraface-r100",
21158
+ label: "AuraFace R100"
21159
+ },
21160
+ {
21161
+ id: "arcface-r100",
21162
+ label: "ArcFace (ResNet34)"
21163
+ },
21164
+ {
21165
+ id: "inception-resnet-v1",
21166
+ label: "Inception ResNet V1"
21167
+ }
21168
+ ]
21169
+ }, {
21170
+ stepId: "clip-embedding",
21171
+ label: "Semantic search model",
21172
+ defaultModelId: "mobileclip-s1",
21173
+ indexName: "the object semantic-search index",
21174
+ options: [
21175
+ {
21176
+ id: "mobileclip-s1",
21177
+ label: "MobileCLIP S1"
21178
+ },
21179
+ {
21180
+ id: "mobileclip-s2",
21181
+ label: "MobileCLIP S2"
21182
+ },
21183
+ {
21184
+ id: "siglip2-b16-224",
21185
+ label: "SigLIP2 B/16 (Apache-2.0)"
21186
+ }
21187
+ ]
21188
+ }];
21189
+ /**
21190
+ * The settings key holding one step's cluster model choice.
21191
+ *
21192
+ * Step-qualified so the keys stay unique across the addon's whole schema, which
21193
+ * is what lets {@link pickClusterStepModels} walk every section instead of
21194
+ * trusting the section id.
21195
+ */
21196
+ function clusterModelSettingKey(stepId) {
21197
+ return `clusterModel:${stepId}`;
21198
+ }
21199
+ /** The cluster row when nobody has configured one — today's catalog defaults. */
21200
+ var DEFAULT_CLUSTER_STEP_MODELS = Object.freeze(Object.fromEntries(CLUSTER_MODEL_SCOPED_STEPS.map((s) => [s.stepId, s.defaultModelId])));
21201
+ function interpretStoredClusterModel(raw) {
21202
+ if (raw === void 0 || raw === null || raw === "") return { kind: "absent" };
21203
+ if (typeof raw === "string") return {
21204
+ kind: "chosen",
21205
+ modelId: raw
21206
+ };
21207
+ return {
21208
+ kind: "invalid",
21209
+ value: raw
21210
+ };
21211
+ }
21212
+ /**
21213
+ * Narrow a FLAT settings record to the cluster row.
21214
+ *
21215
+ * Per-FIELD fallback, deliberately (same rule as `readDetailCropConvention`): a
21216
+ * junk face model must not also discard a valid clip model. An `absent` or
21217
+ * `invalid` value ({@link interpretStoredClusterModel}) resolves to the step's
21218
+ * catalog default — never to a blank id, because a blank id downstream becomes
21219
+ * "substitute the format default", which is precisely the substitution this
21220
+ * scope exists to forbid.
21221
+ */
21222
+ function readClusterStepModels(config) {
21223
+ const out = {};
21224
+ for (const step of CLUSTER_MODEL_SCOPED_STEPS) {
21225
+ const read = interpretStoredClusterModel(config[clusterModelSettingKey(step.stepId)]);
21226
+ out[step.stepId] = read.kind === "chosen" ? read.modelId : step.defaultModelId;
21227
+ }
21228
+ return out;
21229
+ }
21230
+ function isHydratedField$2(entry) {
21231
+ return typeof entry === "object" && entry !== null && "key" in entry;
21232
+ }
21233
+ /**
21234
+ * Extract the cluster row from an `addon-settings.getGlobalSettings` payload.
21235
+ *
21236
+ * Walks EVERY section rather than looking inside {@link CLUSTER_MODEL_SECTION_ID}
21237
+ * alone: the keys are unique across the addon's schema, and a section rename
21238
+ * must not silently revert the whole cluster to the defaults. A `null` payload
21239
+ * (addon mid-boot) is the defaults.
21240
+ */
21241
+ function pickClusterStepModels(view) {
21242
+ if (view === null) return DEFAULT_CLUSTER_STEP_MODELS;
21243
+ return readClusterStepModels(flattenHydratedView(view, clusterModelKeys()));
21244
+ }
21245
+ function clusterModelKeys() {
21246
+ return new Set(CLUSTER_MODEL_SCOPED_STEPS.map((s) => clusterModelSettingKey(s.stepId)));
21247
+ }
21248
+ /** The `wanted` keys of a hydrated view as one flat record, every section walked. */
21249
+ function flattenHydratedView(view, wanted) {
21250
+ const flat = {};
21251
+ for (const section of view.sections) for (const entry of section.fields) {
21252
+ if (!isHydratedField$2(entry) || typeof entry.key !== "string") continue;
21253
+ if (wanted.has(entry.key)) flat[entry.key] = entry.value;
21254
+ }
21255
+ return flat;
21256
+ }
21257
+ var CLUSTER_STEP_SETTING_FIELDS = [{
21258
+ stepId: "face-embedding",
21259
+ key: "minLandmarkFaceSize",
21260
+ label: "Min face size for recognition (detection px)",
21261
+ 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.",
21262
+ type: "slider",
21263
+ min: 0,
21264
+ max: 64,
21265
+ step: 2,
21266
+ default: 24
21267
+ }];
21268
+ function clusterStepSettingKey(stepId, fieldKey) {
21269
+ return `clusterStepSetting:${stepId}:${fieldKey}`;
21270
+ }
21271
+ var ClusterSettingNumberSchema = number().finite();
21272
+ function readClusterStepSettings(config) {
21273
+ const out = {};
21274
+ for (const field of CLUSTER_STEP_SETTING_FIELDS) {
21275
+ const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
21276
+ const value = parsed.success ? parsed.data : field.default;
21277
+ const existing = out[field.stepId] ?? {};
21278
+ out[field.stepId] = {
21279
+ ...existing,
21280
+ [field.key]: value
21281
+ };
21282
+ }
21283
+ return out;
21284
+ }
21285
+ readClusterStepSettings({});
21286
+ /**
21287
+ * pipeline-analytics — device-scoped wrapper cap. Refines raw
21288
+ * per-frame detections emitted by the pipeline runner into tracked
21289
+ * objects, per-kind event collections (motion / object / audio), and
21290
+ * persisted media. Owns the post-detection domain end-to-end:
21291
+ *
21292
+ * runner emits PipelineInferenceResult
21293
+ * ↓ (event bus)
21294
+ * pipeline-analytics subscriber
21295
+ * ↓ SORT tracker + zone engine + state analyzer + event emitter
21296
+ * → three DB collections (one per kind), one FS media tree, one
21297
+ * unified event emitter (FrameTracked + TrackStarted/Ended +
21298
+ * DetectionEvent on bus)
21299
+ *
21300
+ * Pure subscriber model. No `processFrame` cap method — the runner
21301
+ * already publishes the raw frame on the bus. The cap surface is
21302
+ * only QUERIES + per-device settings, bound on/off via
21303
+ * `device-manager.setWrapperActive`. `defaultActive: true` because
21304
+ * every camera with a detection pipeline wants its raw detections
21305
+ * refined; operators opt out per-device via BindingsTab when needed.
21306
+ *
21307
+ * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
21308
+ * (per-device surface) and `track-trail` caps — see P11 cleanup.
21309
+ */
21310
+ var TrackStateSchema = _enum([
21311
+ "new",
21312
+ "entered",
21313
+ "left",
21314
+ "moving",
21315
+ "idle"
20827
21316
  ]);
20828
- var PipelineSlotSchema = _enum([
20829
- "detector",
20830
- "cropper",
20831
- "classifier",
20832
- "refiner",
20833
- "audio-classifier"
21317
+ var EventKindSchema = _enum([
21318
+ "motion",
21319
+ "object",
21320
+ "audio"
20834
21321
  ]);
20835
- var PipelineEngineChoiceSchema = object({
20836
- runtime: _enum(["node", "python"]),
20837
- backend: string(),
20838
- format: ModelFormatSchema$1,
20839
- device: string().optional()
20840
- });
20841
- var AvailableEngineSchema = object({
20842
- engine: PipelineEngineChoiceSchema,
20843
- devices: array(object({
20844
- id: string(),
20845
- label: string(),
20846
- description: string().optional()
20847
- })).readonly(),
20848
- defaultDevice: string()
20849
- });
20850
- var PipelineDefaultStepSchema = lazy(() => object({
20851
- addonId: string(),
20852
- addonName: string(),
20853
- slot: PipelineSlotSchema,
20854
- inputClasses: array(string()).readonly(),
20855
- outputClasses: array(string()).readonly(),
20856
- enabled: boolean(),
20857
- modelId: string(),
20858
- children: array(PipelineDefaultStepSchema).readonly(),
20859
- group: string().optional(),
20860
- settings: record(string(), unknown()).optional()
20861
- }));
20862
- var PipelineTemplateStepSchema = lazy(() => object({
20863
- addonId: string(),
20864
- enabled: boolean(),
20865
- modelId: string(),
20866
- children: array(PipelineTemplateStepSchema).readonly(),
20867
- settings: record(string(), unknown()).optional()
20868
- }));
20869
- var PipelineTemplateSchema$1 = object({
20870
- id: string(),
20871
- name: string(),
20872
- createdAt: string(),
20873
- updatedAt: string(),
20874
- engine: PipelineEngineChoiceSchema,
20875
- steps: array(PipelineTemplateStepSchema).readonly()
21322
+ /**
21323
+ * Spatial filter for `listTracks` — the rect + polygon variants of the shared
21324
+ * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
21325
+ * of the camera frame (top-left origin), matching the drawing-plane editor.
21326
+ */
21327
+ var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
21328
+ /** Closed icon vocabulary so clients render a known glyph per kind. */
21329
+ var EventKindIconSchema = _enum([
21330
+ "motion",
21331
+ "audio",
21332
+ "person",
21333
+ "vehicle",
21334
+ "animal",
21335
+ "door",
21336
+ "pir",
21337
+ "smoke",
21338
+ "water",
21339
+ "button",
21340
+ "package",
21341
+ "generic"
21342
+ ]);
21343
+ var EventKindCategorySchema = _enum([
21344
+ "motion",
21345
+ "audio",
21346
+ "detection",
21347
+ "sensor",
21348
+ "control",
21349
+ "custom",
21350
+ "package"
21351
+ ]);
21352
+ /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
21353
+ var EventKindLevelSchema = _enum(["macro", "sub"]);
21354
+ var EventKindDescriptorSchema = object({
21355
+ /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
21356
+ kind: string(),
21357
+ /** i18n key resolved on the UI side; `label` is the English fallback. */
21358
+ labelKey: string(),
21359
+ /** English fallback label (kept for clients that don't translate). */
21360
+ label: string(),
21361
+ /** Hex color for timeline/legend rendering. */
21362
+ color: string(),
21363
+ /** Dictionary id → lucide component on the UI side. */
21364
+ iconId: string(),
21365
+ /** Legacy closed-vocab glyph — fallback for `iconId`. */
21366
+ icon: EventKindIconSchema,
21367
+ category: EventKindCategorySchema,
21368
+ /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
21369
+ parentKind: string().nullable(),
21370
+ /** Derived from `parentKind`, explicit for the client tree. */
21371
+ level: EventKindLevelSchema,
21372
+ /** Which cap + device contributes this kind. For built-ins the camera
21373
+ * itself; for sensor kinds the LINKED source device. */
21374
+ source: object({
21375
+ capName: string(),
21376
+ deviceId: number()
21377
+ })
20876
21378
  });
20877
- var PipelineModelOptionSchema = object({
20878
- id: string(),
20879
- name: string(),
20880
- formats: record(string(), object({
20881
- downloaded: boolean(),
20882
- sizeMB: number()
20883
- })),
20884
- group: ModelVariantGroupSchema.optional(),
20885
- legacy: boolean().optional(),
20886
- provider: ModelProviderIdSchema.optional()
21379
+ /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
21380
+ var EventKindsForDeviceSchema = object({
21381
+ deviceId: number(),
21382
+ kinds: array(EventKindDescriptorSchema).readonly()
20887
21383
  });
20888
- var ConfigFieldBridge = custom();
20889
- var PipelineAddonSchemaSchema = object({
21384
+ var SensorEventSchema = object({
20890
21385
  id: string(),
20891
- name: string(),
20892
- slot: PipelineSlotSchema,
20893
- inputClasses: array(string()).readonly(),
20894
- outputClasses: array(string()).readonly(),
20895
- childSlots: array(PipelineSlotSchema).readonly(),
20896
- models: array(PipelineModelOptionSchema).readonly(),
20897
- defaultModelId: string(),
20898
- defaultModelIdByFormat: record(string(), string()).optional(),
20899
- enabledByDefault: boolean().optional(),
20900
- backfillIntoExistingOverrides: boolean().optional(),
20901
- defaultConfidence: number(),
20902
- group: string().optional(),
20903
- configSchema: array(ConfigFieldBridge).readonly().optional()
21386
+ /** The CAMERA the event is attributed to (a sensor linked to N cameras
21387
+ * yields N rows, one per camera). */
21388
+ deviceId: number(),
21389
+ /** The linked sensor device whose state changed. */
21390
+ sourceDeviceId: number(),
21391
+ /** Event kind id — matches an `EventKindDescriptor.kind`. */
21392
+ kind: string(),
21393
+ /** Snapshot of the sensor cap's runtime-state slice at the change. */
21394
+ value: record(string(), unknown()).nullable(),
21395
+ timestamp: number()
20904
21396
  });
20905
- var PipelineSlotSchemaSchema = object({
20906
- id: PipelineSlotSchema,
20907
- label: string(),
20908
- priority: number(),
20909
- parentSlot: PipelineSlotSchema.nullable(),
20910
- addons: array(PipelineAddonSchemaSchema).readonly()
21397
+ /**
21398
+ * One stored sighting on a track's trajectory.
21399
+ *
21400
+ * The array these live in is returned in TIME order (D399) — it is APPENDED in
21401
+ * arrival order, and the two detector passes interleave, so a consumer must not
21402
+ * assume the two are the same on a row written by an older build.
21403
+ */
21404
+ var TrackPositionSchema = object({
21405
+ x: number(),
21406
+ y: number(),
21407
+ timestamp: number(),
21408
+ bbox: BoundingBoxSchema,
21409
+ /**
21410
+ * Which detector pass measured this box (D399): `frame` is the full-frame
21411
+ * pass on the analysis raster, `recovery` is the native-resolution
21412
+ * small-subject second pass (D377/D378). Both write into one array, and until
21413
+ * this field existed the only way to tell them apart was that full-frame boxes
21414
+ * are exact multiples of 1.2 while recovery boxes are full-precision floats.
21415
+ * Absent on rows written before D399.
21416
+ */
21417
+ source: _enum(["frame", "recovery"]).optional(),
21418
+ /** Detection score of this box, so a position can be weighed and not only
21419
+ * plotted. Absent on rows written before D399. */
21420
+ score: number().optional()
20911
21421
  });
20912
- var PipelineSchemaSchema = object({
20913
- availableEngines: array(AvailableEngineSchema).readonly(),
20914
- selectedEngine: PipelineEngineChoiceSchema,
20915
- slots: array(PipelineSlotSchemaSchema).readonly()
20916
- });
20917
- var EngineProvisioningSchema = object({
20918
- runtimeId: _enum([
20919
- "onnx",
20920
- "openvino",
20921
- "coreml",
20922
- "edgetpu"
20923
- ]).nullable(),
20924
- device: string().nullable(),
20925
- state: _enum([
20926
- "idle",
20927
- "installing",
20928
- "verifying",
20929
- "ready",
20930
- "failed"
20931
- ]),
20932
- progress: number().optional(),
20933
- error: string().optional(),
20934
- nextRetryAt: number().optional(),
20935
- /**
20936
- * Gate A (config-correctness gate at engine change): human-readable
20937
- * config issues surfaced EAGERLY when the node's engine changes — model
20938
- * substitutions ("chose X, running Y") and zero-build steps ("no model
20939
- * has a <format> build"). Additive/optional: informational only, never
20940
- * enforced here — `assertEngineReady` (readiness) still gates inference.
20941
- * Absent/empty when the node-default tree resolves cleanly.
20942
- */
20943
- configIssues: array(string()).optional()
20944
- });
20945
- var PipelineStepInputSchema = lazy(() => object({
20946
- addonId: string(),
20947
- modelId: string().optional(),
20948
- enabled: boolean().default(true),
20949
- children: array(PipelineStepInputSchema).optional(),
20950
- settings: record(string(), unknown()).optional(),
20951
- jumpDeviceKey: string().optional()
20952
- }));
20953
- var ModelSubstitutionSchema = object({
20954
- addonId: string(),
20955
- chosen: string(),
20956
- running: string(),
20957
- format: string()
20958
- });
20959
- var PipelineValidationIssueSchema = object({
20960
- addonId: string(),
20961
- kind: _enum(["unknown-addon", "no-format-build"]),
20962
- detail: string()
20963
- });
20964
- var PipelineValidationResultSchema = object({
20965
- ok: boolean(),
20966
- issues: array(PipelineValidationIssueSchema).readonly(),
20967
- substitutions: array(ModelSubstitutionSchema).readonly(),
20968
- /** The node's `currentEngine.format` this validation ran against. */
20969
- format: string()
20970
- });
20971
- var ReferenceImageEntrySchema = object({
20972
- filename: string(),
20973
- stepIds: array(string()).readonly().optional()
20974
- });
20975
- var ReferenceImageBodySchema = object({
20976
- base64: string(),
20977
- filename: string()
20978
- });
20979
- var ReferenceAudioEntrySchema = object({
20980
- filename: string(),
20981
- sizeKb: number()
20982
- });
20983
- var ReferenceAudioBodySchema = object({ base64: string() });
20984
- var AudioBackendSchema = object({
20985
- id: string(),
20986
- name: string(),
20987
- description: string(),
20988
- available: boolean(),
20989
- /**
20990
- * Raw classifier labels this backend can emit (e.g. YAMNet's
20991
- * 521-class set or Apple SoundAnalysis's 303-class set). Used by
20992
- * the benchmark UI to populate the `enabledMicroClasses` filter
20993
- * specific to the selected backend without a separate fetch.
20994
- */
20995
- rawLabels: array(string()).readonly().optional()
20996
- });
20997
- var AudioCapabilitiesSchema = object({
20998
- activeBackend: string(),
20999
- availableBackends: array(AudioBackendSchema).readonly(),
21000
- sampleRate: number(),
21001
- chunkDurationMs: number()
21002
- });
21003
- var DownloadModelResultSchema = object({
21004
- filePath: string(),
21005
- sizeMB: number(),
21006
- durationMs: number()
21007
- });
21008
- /**
21009
- * Wrapper carrying a single test run's result. Replaces the legacy
21010
- * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
21011
- * canonical `AudioResult` from the Phase 6 output rework: one
21012
- * `AudioDetection` per class above `minScore`, top-N candidates in
21013
- * `debug.alternateLabels['audio-classifier']`, per-source timings in
21014
- * `debug.stepTimings`. The outer `success`/`error` fields stay so the
21015
- * benchmark UI can still report a clean failure when the classifier
21016
- * cap isn't available.
21017
- */
21018
- var AudioTestResultSchema = object({
21019
- success: boolean(),
21020
- error: string().optional(),
21021
- frame: custom().optional()
21022
- });
21023
- var PipelineConfigBridge = custom();
21024
- var ConfigUISchemaBridge = custom();
21025
- var ConfigUISchemaNullableBridge = custom();
21026
- var InferenceCapabilitiesBridge = custom();
21027
- var ModelAvailabilityListBridge = custom();
21028
- var PipelineRunResultBridge = custom();
21029
- method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
21030
- modelId: string(),
21031
- settings: record(string(), unknown()).readonly()
21032
- }))), method(object({ steps: record(string(), object({
21033
- modelId: string(),
21034
- settings: record(string(), unknown()).readonly()
21035
- })) }), object({ success: literal(true) }), {
21036
- kind: "mutation",
21037
- auth: "admin"
21038
- }), method(object({ nodeId: string() }), object({
21039
- success: literal(true),
21040
- clearedDevices: number()
21041
- }), {
21042
- kind: "mutation",
21043
- auth: "admin"
21044
- }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
21045
- /** `<backend>:<device>`, e.g. `openvino:gpu`. */
21046
- deviceKey: string(),
21047
- /**
21048
- * `failed` — the per-device restart budget is exhausted; no pool
21049
- * will be spawned until an operator re-arms it or the runner
21050
- * respawns. `backoff` — under budget, waiting out the backoff (or
21051
- * a cached pool observed dead and not yet condemned).
21052
- */
21053
- state: _enum(["failed", "backoff"]),
21054
- /** Epoch ms of the death that produced this state. */
21055
- since: number(),
21056
- /** Pool deaths inside the current window. */
21057
- deaths: number(),
21058
- /** The last death's message. */
21059
- lastError: string()
21060
- })).readonly() })), method(object({
21061
- nodeId: string(),
21062
- deviceKey: string()
21063
- }), object({ rearmed: boolean() }), {
21064
- kind: "mutation",
21065
- auth: "admin"
21066
- }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({ steps: array(PipelineStepInputSchema) }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
21067
- name: string(),
21068
- steps: array(PipelineTemplateStepSchema).readonly(),
21069
- engine: PipelineEngineChoiceSchema
21070
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
21071
- id: string(),
21072
- name: string().optional(),
21073
- steps: array(PipelineTemplateStepSchema).readonly().optional()
21074
- }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
21075
- addonId: string(),
21076
- modelId: string(),
21077
- format: ModelFormatSchema$1
21078
- }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
21079
- addonId: string(),
21080
- modelId: string(),
21081
- format: ModelFormatSchema$1
21082
- }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
21083
- engine: PipelineEngineChoiceSchema.optional(),
21084
- steps: array(PipelineStepInputSchema).min(1),
21085
- frame: FrameInputSchema.optional(),
21086
- /**
21087
- * Process-local lazy frame. Valid only when caller and provider resolve
21088
- * in the same execution-group process; split/cross-node callers use
21089
- * `frame`/`image` inline compatibility instead.
21090
- */
21091
- frameRef: FrameRefSchema.optional(),
21092
- /**
21093
- * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
21094
- * the decoded pixels live in. One more member of the one-of
21095
- * frame/frameHandle/image/imageBase64/referenceImage group.
21096
- */
21097
- frameHandle: FrameHandleSchema.optional(),
21098
- imageBase64: string().optional(),
21099
- /**
21100
- * Binary JPEG bytes — preferred over `imageBase64` on internal
21101
- * hops (hub → forked worker via Moleculer MsgPack) because it
21102
- * skips the 33% base64 overhead + the per-call base64 decode on
21103
- * the detection-pipeline worker. Callers can pass either; exactly
21104
- * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
21105
- */
21106
- image: _instanceof(Uint8Array).optional(),
21107
- referenceImage: string().optional(),
21108
- deviceId: number().optional(),
21109
- sessionId: string().optional(),
21110
- /**
21111
- * Execution plane. 'full' (default) runs the whole tree — benchmark,
21112
- * reference-image, and detail-subtree calls. 'frame' is the live
21113
- * per-frame dispatch: ONLY root-plane steps run; crop children
21114
- * (inputClasses ≠ null) are skipped and served per-track via
21115
- * pipelineRunner.runDetailSubtree (two-plane design).
21116
- */
21117
- plane: _enum(["full", "frame"]).optional(),
21118
- /**
21119
- * Inference-device selector (Phase 2 multi-device). Format
21120
- * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
21121
- * Omitted ⇒ the runner's default device (current single-engine
21122
- * behaviour). Selects WHICH device pool of the node runs the call.
21123
- */
21124
- deviceKey: string().optional(),
21125
- /**
21126
- * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
21127
- * when the parent crop was resolved from the frame's retained NATIVE
21128
- * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
21129
- * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
21130
- * resolution from that surface — the SAME quality path faces already
21131
- * had — instead of the downscaled parent tile. `handle` keys the native
21132
- * surface (node-pinned to its owner); `cropFrameSpace` is the parent
21133
- * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
21134
- * the executor's crop-normalized child ROI back into frame-normalized
21135
- * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
21136
- * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
21137
- * (today's behaviour on the fallback path).
21138
- */
21139
- nativeCropRef: NativeCropRefSchema.optional()
21140
- }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
21141
- engine: PipelineEngineChoiceSchema.optional(),
21142
- steps: array(PipelineStepInputSchema).min(1),
21143
- frames: array(FrameInputSchema).min(1).max(255),
21144
- deviceId: number().optional(),
21145
- sessionId: string().optional(),
21146
- /**
21147
- * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
21148
- * the batch to the Python pool's bench preprocess cache
21149
- * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
21150
- * preprocessed ONCE and every later inference is a pure-inference cache
21151
- * hit — the sustained-throughput run measures inference, not
21152
- * decode+preprocess+infer. Omitted/0 for live frames (all different →
21153
- * full preprocess every call, correct). Fresh per sustained run;
21154
- * released via `uncacheFrame`.
21155
- */
21156
- frameId: number().int().nonnegative().optional(),
21157
- /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
21158
- deviceKey: string().optional()
21159
- }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
21160
- data: _instanceof(Uint8Array),
21161
- width: number().int().positive(),
21162
- height: number().int().positive(),
21163
- format: _enum([
21164
- "rgb",
21165
- "bgr",
21166
- "gray"
21167
- ])
21168
- }), object({
21169
- frameId: number(),
21170
- width: number(),
21171
- height: number()
21172
- }), { kind: "mutation" }), method(object({
21173
- stepId: string(),
21174
- frameId: number().int()
21175
- }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(_void(), object({
21176
- batchMode: string(),
21177
- windowMs: number(),
21178
- maxBatchSize: number(),
21179
- concurrency: number()
21180
- })), method(_void(), array(object({
21181
- engineKey: string(),
21182
- engine: PipelineEngineChoiceSchema,
21183
- modelsLoaded: array(string()).readonly(),
21184
- inUseByCameras: array(number()).readonly(),
21185
- /**
21186
- * Origin of this resident factory.
21187
- * - `runtime` — main camera-serving engine (no idle TTL).
21188
- * - `warm-override` — benchmark/test override held in the warm
21189
- * cache; auto-disposed after the idle TTL.
21190
- * - `device-pool` — a concurrent per-device pool (Phase 2
21191
- * multi-device, keyed by `deviceKey`) resolved
21192
- * via `resolveDeviceFactory`. Runs alongside the
21193
- * `runtime` engine on a DIFFERENT accelerator
21194
- * (NPU / iGPU / Coral) — this is how the
21195
- * Engines tab shows all pools running at once.
21196
- */
21197
- kind: _enum([
21198
- "runtime",
21199
- "warm-override",
21200
- "device-pool"
21201
- ]),
21202
- /** Native pid of the underlying Python pool (null when no pool). */
21203
- poolPid: number().nullable(),
21204
- /** ms since this factory was last used (null when not warm-tracked). */
21205
- idleMs: number().nullable(),
21206
- /** Idle TTL after which `warm-override` factories self-evict (null when not applicable). */
21207
- idleTtlMs: number().nullable()
21208
- })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
21209
- kind: "mutation",
21210
- auth: "admin"
21211
- }), method(object({
21212
- engine: PipelineEngineChoiceSchema,
21213
- force: boolean().optional()
21214
- }), object({
21215
- success: boolean(),
21216
- reason: string().optional()
21217
- }), {
21218
- kind: "mutation",
21219
- auth: "admin"
21220
- }), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
21221
- addonId: string(),
21222
- modelId: string(),
21223
- filename: string().optional(),
21224
- settings: record(string(), unknown()).optional()
21225
- }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
21226
- /**
21227
- * Per-stage gating mode applied to the zones a rule references.
21228
- *
21229
- * - `include`: the rule contributes to a **whitelist** for its stage.
21230
- * When at least one `include` rule fires for a stage, only entities
21231
- * inside one of those zones pass that stage.
21232
- * - `exclude`: the rule contributes to a **blacklist** for its stage.
21233
- * Entities inside one of those zones are dropped at that stage.
21234
- *
21235
- * `monitor`-style observation (count without filtering) is not a rule
21236
- * mode — zones without any matching rule are observed naturally by
21237
- * `zone-analytics` (live snapshot + history), so an "I just want to
21238
- * count, not filter" use case needs no rule at all.
21239
- */
21240
- var ZoneRuleModeEnum = _enum(["include", "exclude"]);
21241
- /**
21242
- * Per-consumer rule that references existing zones (geometry) and
21243
- * defines how a specific pipeline stage should treat them. Each
21244
- * consumer addon owns its own `ZoneRule[]` array in its per-device
21245
- * settings:
21246
- *
21247
- * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
21248
- * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
21249
- * - future: notification rules, audio gating, etc.
21250
- *
21251
- * One rule applies to N zones (`zoneIds[]`) so the operator can
21252
- * express "ignore motion in ALL of {garden, street}" with a single
21253
- * rule. `classFilter` narrows the rule to specific object classes —
21254
- * "drop person detections in the street, but keep cars" is one
21255
- * `exclude` rule with `classFilter: ['person']`.
21256
- *
21257
- * `enabled` is a soft toggle — the operator can keep the rule
21258
- * configured but inert without deleting it.
21259
- */
21260
- var ZoneRuleSchema = object({
21261
- /** Stable rule id — survives edits, used by the UI for diffing. */
21262
- id: string(),
21263
- /** Optional human-readable label rendered in the rule editor. */
21264
- name: string().optional(),
21265
- /** Zones this rule targets. The rule's `mode` applies to ALL
21266
- * listed zones (OR-set: a detection in any one of them counts).
21267
- * At least one zone id required — a rule with no targets is a
21268
- * configuration mistake and the form validator rejects it. */
21269
- zoneIds: array(string()).min(1).readonly(),
21270
- mode: ZoneRuleModeEnum,
21271
- /**
21272
- * Class names this rule applies to. Empty / undefined ⇒ rule
21273
- * applies to every class. Class strings match the `macroClass`
21274
- * field on detections (e.g. `person`, `car`, `dog`).
21275
- */
21276
- classFilter: array(string()).readonly().optional(),
21277
- /**
21278
- * Minimum bbox/mask overlap (0–1) with any of the rule's zones
21279
- * required to consider an entity "in the zone". Defaults to the
21280
- * consumer's stage default when omitted. Kept for back-compat with
21281
- * existing per-rule overrides; new operators pick the value via
21282
- * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
21283
- * set, the lower-level engine reads it as a 0–1 fraction.
21284
- */
21285
- overlapThreshold: number().min(0).max(1).optional(),
21286
- /**
21287
- * Operator-friendly version of `overlapThreshold` — the percentage
21288
- * of the detection's bbox that must lie inside the zone for the
21289
- * rule to match. Documented default is 85%; the engine substitutes
21290
- * that when the field is omitted (kept optional so existing rules
21291
- * stored without it stay valid).
21292
- *
21293
- * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
21294
- * rule, the engine prefers `bboxInclusionPct` because it's the
21295
- * field exposed in the UI. Internally both feed the same gate.
21296
- */
21297
- bboxInclusionPct: number().min(0).max(100).optional(),
21298
- /**
21299
- * When `true` and a detection has a segmentation mask, use the
21300
- * mask for overlap instead of the bbox. Detection-stage only;
21301
- * motion rules ignore this field.
21302
- */
21303
- preferMask: boolean().optional(),
21304
- /**
21305
- * Soft-toggle: `false` disables the rule without deleting it.
21306
- * Defaults to `true` so operators creating a rule via the UI
21307
- * see it active immediately.
21308
- */
21309
- enabled: boolean().default(true)
21310
- });
21311
- array(ZoneRuleSchema).readonly();
21312
- /**
21313
- * Zone — pure geometry + identity. NO filtering behaviour.
21314
- *
21315
- * Zones describe **where** in the frame the operator wants to flag
21316
- * something; consumer-owned {@link ZoneRule} arrays describe **how**
21317
- * each pipeline stage uses them. Splitting the two means a single
21318
- * polygon "Driveway" can simultaneously back a motion-exclude rule,
21319
- * a detection-include rule on `['car']`, and an occupancy aggregate
21320
- * — without three duplicated polygons.
21321
- *
21322
- * Owned by the orchestrator addon (provider) and mirrored into the
21323
- * `zones` device-state slice on every mutation. Consumers
21324
- * (motion-wasm, pipeline-executor, analytics, admin UI) read either
21325
- * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
21326
- * mirror with `onChanged`).
21327
- *
21328
- * Coordinates are normalised fractions of the frame (0–1) so zones
21329
- * survive resolution changes and stream profile switches.
21330
- *
21331
- * `kind` discriminates between full polygons (closed regions used
21332
- * for intrusion / occupancy filters) and tripwires (open 2-point
21333
- * line segments used for cross events). Onboard / firmware-reported
21334
- * zones (Reolink, ONVIF) are out of scope for now — see the deferred
21335
- * task list.
21336
- */
21337
- var ZoneKindEnum = _enum(["polygon", "tripwire"]);
21338
- /** Polygon vertex in fraction-of-frame coordinates (0–1). */
21339
- var PolygonPointSchema = object({
21340
- x: number(),
21341
- y: number()
21342
- });
21343
- /** A camera detection zone — pure geometry/identity. */
21344
- var ZoneSchema = object({
21345
- id: string(),
21346
- name: string(),
21347
- kind: ZoneKindEnum.default("polygon"),
21348
- /** Polygon vertices, fraction of frame (0–1). */
21349
- polygon: array(PolygonPointSchema).readonly(),
21350
- /** Visual color for UI rendering. */
21351
- color: string().default("#3b82f6")
21352
- });
21353
- /**
21354
- * Zones capability — per-camera CRUD over polygon detection zones.
21355
- *
21356
- * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
21357
- * to per-device settings and mirrors into the `zones` device-state
21358
- * slice on every mutation, so downstream consumers can subscribe via
21359
- * `dev.state.zones.onChanged`.
21360
- *
21361
- * The cap surface only handles geometry + identity; filtering
21362
- * behaviour (per-class, include/exclude, threshold) lives in the
21363
- * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
21364
- * `capabilities/schemas/zone-rule.js`.
21365
- */
21366
- var zonesCapability = {
21367
- name: "zones",
21368
- scope: "device",
21369
- mode: "singleton",
21370
- deviceTypes: [DeviceType.Camera],
21371
- methods: {
21372
- listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
21373
- addZone: method(object({
21374
- deviceId: number(),
21375
- zone: ZoneSchema
21376
- }), _void(), {
21377
- kind: "mutation",
21378
- auth: "admin"
21379
- }),
21380
- removeZone: method(object({
21381
- deviceId: number(),
21382
- zoneId: string()
21383
- }), _void(), {
21384
- kind: "mutation",
21385
- auth: "admin"
21386
- }),
21387
- updateZone: method(object({
21388
- deviceId: number(),
21389
- zone: ZoneSchema
21390
- }), _void(), {
21391
- kind: "mutation",
21392
- auth: "admin"
21393
- })
21394
- },
21395
- /**
21396
- * Runtime-state slice — the live zone catalogue mirrored by the
21397
- * orchestrator on every CRUD mutation. Consumers read via
21398
- * `device.state.zones.value` / `.watch(...)` without round-tripping
21399
- * the cap, and the codegen DeviceProxy auto-wires the reactive
21400
- * handle. Slice shape is `{ zones: Zone[] }` so future extensions
21401
- * (e.g. zone groupings) can sit alongside the polygon list.
21402
- */
21403
- runtimeState: object({ zones: array(ZoneSchema).readonly() }),
21404
- /**
21405
- * Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
21406
- *
21407
- * See `RuntimeStateDurability`. Enforced by
21408
- * `scripts/check-runtime-state-durability.ts`.
21409
- */
21410
- durability: "restored"
21411
- };
21412
- /**
21413
- * pipeline-analytics — device-scoped wrapper cap. Refines raw
21414
- * per-frame detections emitted by the pipeline runner into tracked
21415
- * objects, per-kind event collections (motion / object / audio), and
21416
- * persisted media. Owns the post-detection domain end-to-end:
21417
- *
21418
- * runner emits PipelineInferenceResult
21419
- * ↓ (event bus)
21420
- * pipeline-analytics subscriber
21421
- * ↓ SORT tracker + zone engine + state analyzer + event emitter
21422
- * → three DB collections (one per kind), one FS media tree, one
21423
- * unified event emitter (FrameTracked + TrackStarted/Ended +
21424
- * DetectionEvent on bus)
21425
- *
21426
- * Pure subscriber model. No `processFrame` cap method — the runner
21427
- * already publishes the raw frame on the bus. The cap surface is
21428
- * only QUERIES + per-device settings, bound on/off via
21429
- * `device-manager.setWrapperActive`. `defaultActive: true` because
21430
- * every camera with a detection pipeline wants its raw detections
21431
- * refined; operators opt out per-device via BindingsTab when needed.
21432
- *
21433
- * Replaces the legacy `analysis-pipeline`, `analysis-data-persistence`
21434
- * (per-device surface) and `track-trail` caps — see P11 cleanup.
21435
- */
21436
- var TrackStateSchema = _enum([
21437
- "new",
21438
- "entered",
21439
- "left",
21440
- "moving",
21441
- "idle"
21442
- ]);
21443
- var EventKindSchema = _enum([
21444
- "motion",
21445
- "object",
21446
- "audio"
21447
- ]);
21448
- /**
21449
- * Spatial filter for `listTracks` — the rect + polygon variants of the shared
21450
- * MaskShape vocabulary (see `mask-shape.ts`). Coordinates are NORMALIZED 0..1
21451
- * of the camera frame (top-left origin), matching the drawing-plane editor.
21452
- */
21453
- var TrackZoneFilterSchema = discriminatedUnion("kind", [MaskRectShapeSchema, MaskPolygonShapeSchema]);
21454
- /** Closed icon vocabulary so clients render a known glyph per kind. */
21455
- var EventKindIconSchema = _enum([
21456
- "motion",
21457
- "audio",
21458
- "person",
21459
- "vehicle",
21460
- "animal",
21461
- "door",
21462
- "pir",
21463
- "smoke",
21464
- "water",
21465
- "button",
21466
- "package",
21467
- "generic"
21468
- ]);
21469
- var EventKindCategorySchema = _enum([
21470
- "motion",
21471
- "audio",
21472
- "detection",
21473
- "sensor",
21474
- "control",
21475
- "custom",
21476
- "package"
21477
- ]);
21478
- /** Taxonomy level — macro (timeline lane) vs sub (events-page leaf). */
21479
- var EventKindLevelSchema = _enum(["macro", "sub"]);
21480
- var EventKindDescriptorSchema = object({
21481
- /** Stable kind id (e.g. 'motion', 'vehicle', 'car', 'lock'). */
21482
- kind: string(),
21483
- /** i18n key resolved on the UI side; `label` is the English fallback. */
21484
- labelKey: string(),
21485
- /** English fallback label (kept for clients that don't translate). */
21486
- label: string(),
21487
- /** Hex color for timeline/legend rendering. */
21488
- color: string(),
21489
- /** Dictionary id → lucide component on the UI side. */
21490
- iconId: string(),
21491
- /** Legacy closed-vocab glyph — fallback for `iconId`. */
21492
- icon: EventKindIconSchema,
21493
- category: EventKindCategorySchema,
21494
- /** Macro parent for this kind ('car' → 'vehicle'); null for a macro. */
21495
- parentKind: string().nullable(),
21496
- /** Derived from `parentKind`, explicit for the client tree. */
21497
- level: EventKindLevelSchema,
21498
- /** Which cap + device contributes this kind. For built-ins the camera
21499
- * itself; for sensor kinds the LINKED source device. */
21500
- source: object({
21501
- capName: string(),
21502
- deviceId: number()
21503
- })
21504
- });
21505
- /** One camera's event vocabulary, as returned by `listEventKindsBatch`. */
21506
- var EventKindsForDeviceSchema = object({
21507
- deviceId: number(),
21508
- kinds: array(EventKindDescriptorSchema).readonly()
21509
- });
21510
- var SensorEventSchema = object({
21511
- id: string(),
21512
- /** The CAMERA the event is attributed to (a sensor linked to N cameras
21513
- * yields N rows, one per camera). */
21514
- deviceId: number(),
21515
- /** The linked sensor device whose state changed. */
21516
- sourceDeviceId: number(),
21517
- /** Event kind id — matches an `EventKindDescriptor.kind`. */
21518
- kind: string(),
21519
- /** Snapshot of the sensor cap's runtime-state slice at the change. */
21520
- value: record(string(), unknown()).nullable(),
21521
- timestamp: number()
21522
- });
21523
- /**
21524
- * One stored sighting on a track's trajectory.
21525
- *
21526
- * The array these live in is returned in TIME order (D399) — it is APPENDED in
21527
- * arrival order, and the two detector passes interleave, so a consumer must not
21528
- * assume the two are the same on a row written by an older build.
21529
- */
21530
- var TrackPositionSchema = object({
21531
- x: number(),
21532
- y: number(),
21533
- timestamp: number(),
21534
- bbox: BoundingBoxSchema,
21535
- /**
21536
- * Which detector pass measured this box (D399): `frame` is the full-frame
21537
- * pass on the analysis raster, `recovery` is the native-resolution
21538
- * small-subject second pass (D377/D378). Both write into one array, and until
21539
- * this field existed the only way to tell them apart was that full-frame boxes
21540
- * are exact multiples of 1.2 while recovery boxes are full-precision floats.
21541
- * Absent on rows written before D399.
21542
- */
21543
- source: _enum(["frame", "recovery"]).optional(),
21544
- /** Detection score of this box, so a position can be weighed and not only
21545
- * plotted. Absent on rows written before D399. */
21546
- score: number().optional()
21547
- });
21548
- var TrackSnapshotSchema = object({
21549
- timestamp: number(),
21550
- position: TrackPositionSchema,
21551
- /** The snapshot's media row id (D482); resolve via `listTrackMedia({ trackId })`. */
21552
- mediaId: number().int()
21422
+ var TrackSnapshotSchema = object({
21423
+ timestamp: number(),
21424
+ position: TrackPositionSchema,
21425
+ /** The snapshot's media row id (D482); resolve via `listTrackMedia({ trackId })`. */
21426
+ mediaId: number().int()
21553
21427
  });
21554
21428
  /**
21555
21429
  * Normalized 0..1 trajectory envelope (min/max over every position bbox,
@@ -21980,6 +21854,22 @@ var TrackSchema = object({
21980
21854
  * omit it. Render nothing when absent.
21981
21855
  */
21982
21856
  previewMissReason: string().optional(),
21857
+ /**
21858
+ * The ROOT model that produced this track — the `FrameResult.rootModelId` of
21859
+ * the frame it was BORN on (D646). What a later replay compares against, so
21860
+ * "the original model" is named rather than assumed. A birth fact: never
21861
+ * rewritten by a later frame. **Absent ≠ unknown-model**: a row from before
21862
+ * the column, and a track the camera's own detector produced, carry none.
21863
+ */
21864
+ modelId: string().optional(),
21865
+ /**
21866
+ * Size (px) of the detection frame this track's `positions[].bbox` live in —
21867
+ * the frame it was born on, else the camera's latest analysis frame at
21868
+ * persist time. Divide a position by these to normalise it. Absent when the
21869
+ * size was never known.
21870
+ */
21871
+ frameWidth: number().optional(),
21872
+ frameHeight: number().optional(),
21983
21873
  ...TrackFlagFields,
21984
21874
  ...TrackRetrainFields
21985
21875
  });
@@ -22209,7 +22099,8 @@ var MediaFileKindEnum = _enum([
22209
22099
  "thumbnailSmall",
22210
22100
  "confirmationCrop",
22211
22101
  "debugCrop",
22212
- "sceneFrame"
22102
+ "sceneFrame",
22103
+ "lastSceneFrame"
22213
22104
  ]);
22214
22105
  /**
22215
22106
  * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
@@ -22761,7 +22652,23 @@ var SearchObjectEventsInput = object({
22761
22652
  until: number().optional(),
22762
22653
  classFilter: string().optional(),
22763
22654
  limit: number().default(50),
22764
- minScore: number().min(0).max(1).default(.2)
22655
+ /**
22656
+ * An ABSOLUTE cosine floor. Optional since D649: a floor is a property of the
22657
+ * model (0.2 kept 96% of matched pairs on MobileCLIP S1 and 2.7% on SigLIP2),
22658
+ * so an absent one resolves to the searched model's own `searchMinScore`
22659
+ * scaled by `strictness`. A number sent here is honoured verbatim.
22660
+ */
22661
+ minScore: number().min(0).max(1).optional(),
22662
+ /** Model-relative floor — see `resolveClipSearchMinScore`. Default `loose`. */
22663
+ strictness: ClipSearchStrictnessSchema.optional(),
22664
+ /**
22665
+ * Search THIS CLIP model's index instead of the cluster row's. Every index a
22666
+ * model ever wrote stays searchable until it is wiped (the MobileCLIP index
22667
+ * through a SigLIP2 cutover and its rollback window). An id with no CLIP
22668
+ * metadata is refused; an id other than the cluster row's is ADMIN-only
22669
+ * (`model-override-requires-admin`).
22670
+ */
22671
+ modelId: string().min(1).optional()
22765
22672
  });
22766
22673
  var TrackCascadeCountsSchema = object({
22767
22674
  /** Persisted track roots deleted (authoritative). */
@@ -22896,7 +22803,41 @@ var RebuildObjectEmbeddingsInput = object({
22896
22803
  * comparable, so wiping and rebuilding is the only way to be sure every vector
22897
22804
  * means the same thing.
22898
22805
  */
22899
- var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
22806
+ var WipeObjectEmbeddingsResultSchema = object({
22807
+ deleted: number(),
22808
+ /**
22809
+ * CLIP indexes that could NOT be emptied (unreachable, or refused at their
22810
+ * dimension) — not a clean slate. Additive and optional (D649).
22811
+ */
22812
+ failedIndexes: array(string()).optional()
22813
+ });
22814
+ /**
22815
+ * Why a rebuild did not start, BY NAME — ONE vocabulary for both gates in front
22816
+ * of a pass (D649 over D651). A bare `started: false` read the same for "the
22817
+ * stores are booting" and "the cluster row names a model with no CLIP
22818
+ * metadata", which need different fixes.
22819
+ * - `stores-unavailable` — the analytics stores or the API are not up yet.
22820
+ * - the owner's confirmation of the cluster model (D651, `ClusterPinConfirmer`):
22821
+ * a pass that rewrites an index needs two agreeing reads of the OWNER's
22822
+ * answer (`pipelineOrchestrator.getClusterModelChoice`) — a pass that cannot
22823
+ * name its model does not run (D54):
22824
+ * - the owner's own `unreadable` reasons (`owner-not-ready`,
22825
+ * `store-read-failed`, `three-way-read-unavailable`, `invalid-stored`,
22826
+ * `not-cluster-scoped`);
22827
+ * - `method-unavailable` — the orchestrator predates the method;
22828
+ * - `read-failed` — the call failed or answered something unparseable;
22829
+ * - `reads-disagree` — the two reads named different choices.
22830
+ * - `not-a-clip-model` — the CONFIRMED id has no CLIP metadata, so there is no
22831
+ * index to fill and no dimension to check against (D649).
22832
+ */
22833
+ var RebuildObjectEmbeddingsRefusalSchema = _enum([
22834
+ "stores-unavailable",
22835
+ ...CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS,
22836
+ "method-unavailable",
22837
+ "read-failed",
22838
+ "reads-disagree",
22839
+ "not-a-clip-model"
22840
+ ]);
22900
22841
  /**
22901
22842
  * Acknowledgement that a rebuild STARTED.
22902
22843
  *
@@ -22909,7 +22850,12 @@ var WipeObjectEmbeddingsResultSchema = object({ deleted: number() });
22909
22850
  var RebuildObjectEmbeddingsResultSchema = object({
22910
22851
  started: boolean(),
22911
22852
  /** True when a pass was already running; the new request is ignored. */
22912
- alreadyRunning: boolean()
22853
+ alreadyRunning: boolean(),
22854
+ /** Present when the pass refused to start — see `RebuildObjectEmbeddingsRefusalSchema`. */
22855
+ refusal: RebuildObjectEmbeddingsRefusalSchema.optional(),
22856
+ /** The CLIP model the pass pinned, and the index it fills (when it started). */
22857
+ modelId: string().optional(),
22858
+ index: string().optional()
22913
22859
  });
22914
22860
  var RebuildStatusSchema = object({
22915
22861
  running: boolean(),
@@ -22943,7 +22889,11 @@ var RebuildStatusSchema = object({
22943
22889
  startedAtMs: number().nullable(),
22944
22890
  finishedAtMs: number().nullable(),
22945
22891
  /** Present when the pass ended by throwing. */
22946
- error: string().nullable()
22892
+ error: string().nullable(),
22893
+ /** The CLIP model the current / last pass pinned (D54), `null` before any. */
22894
+ modelId: string().nullable(),
22895
+ /** The index that pass fills — `ClipModelMeta.vectorIndex` of `modelId` (D649). */
22896
+ index: string().nullable()
22947
22897
  });
22948
22898
  /**
22949
22899
  * Acknowledgement that a debug-media reclaim STARTED.
@@ -22986,24 +22936,6 @@ var MediaReclaimStatusSchema = object({
22986
22936
  finishedAtMs: number().nullable(),
22987
22937
  error: string().nullable()
22988
22938
  });
22989
- var ReplayFrameInputSchema = object({
22990
- timestamp: number(),
22991
- frame: PipelineRunResultBridge
22992
- });
22993
- var RunReplayFrameProcessorResultSchema = object({ tracks: array(object({
22994
- className: string(),
22995
- firstSeenMs: number(),
22996
- lastSeenMs: number(),
22997
- /** Bbox of the track's FIRST matched detection, pixel-space in the clip's
22998
- * frame — a representative box for the diff's `(className, window, IoU)`
22999
- * pairing (`replay-diff.ts`). A replay does not need the full per-frame
23000
- * trajectory production's `Track.positions` keeps. */
23001
- bbox: BoundingBoxSchema,
23002
- /** How many of the input frames this track matched a real detection on
23003
- * (never a coasted/extrapolated frame) — the replay's own signal for "how
23004
- * solid is this track", cheaper than re-deriving it from a trajectory. */
23005
- framesMatched: number().int()
23006
- })).readonly() });
23007
22939
  /**
23008
22940
  * The long-term series a camera produces. A closed union so a typo cannot
23009
22941
  * invent one, and the ONE declaration of it — the addon's `AnalyticsLtsSeries`
@@ -23730,32 +23662,6 @@ var pipelineAnalyticsCapability = {
23730
23662
  kind: "mutation",
23731
23663
  auth: "admin"
23732
23664
  }),
23733
- /**
23734
- * The FrameProcessor pass of a replay run — see the `Replay` section
23735
- * above this capability's definition for why this is not the
23736
- * `processFrame` method this file's header says pipeline-analytics does
23737
- * not have.
23738
- *
23739
- * Constructs a FRESH `FrameProcessor` for `(deviceId, source)`, feeds it
23740
- * `frames` IN THE ORDER GIVEN (the caller is responsible for time
23741
- * ordering — this method does not sort), and returns the tracks it
23742
- * produced. Zero persistence: no `TrackStore`, no event bus, no media
23743
- * capture. `zones` / `detectionRules` are the run's OWN zone set —
23744
- * typically the camera's real zones plus an ephemeral overlay
23745
- * (`addon-benchmark`'s `replay-plan.ts`), never read from or written to
23746
- * the `zones` capability by this method itself.
23747
- */
23748
- runReplayFrameProcessor: method(object({
23749
- deviceId: number(),
23750
- source: DetectionSourceSchema,
23751
- zones: array(ZoneSchema).readonly().optional(),
23752
- detectionRules: array(ZoneRuleSchema).readonly().optional(),
23753
- zoneMembershipMinOverlap: number().min(0).max(1).optional(),
23754
- frames: array(ReplayFrameInputSchema).min(1)
23755
- }), RunReplayFrameProcessorResultSchema, {
23756
- kind: "mutation",
23757
- auth: "admin"
23758
- }),
23759
23665
  /** Every annotation on a track, oldest first. */
23760
23666
  listRetrainAnnotations: method(object({ trackId: string() }), array(RetrainAnnotationSchema).readonly(), {
23761
23667
  kind: "query",
@@ -23946,7 +23852,7 @@ var pipelineAnalyticsCapability = {
23946
23852
  * ObjectEvents by trackId. Returns up to `limit` events scored ≥
23947
23853
  * `minScore`, sorted descending by score.
23948
23854
  */
23949
- searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()),
23855
+ searchObjectEvents: method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly(), { caller: "required" }),
23950
23856
  wipeObjectEmbeddings: method(object({}), WipeObjectEmbeddingsResultSchema, {
23951
23857
  kind: "mutation",
23952
23858
  auth: "admin"
@@ -23995,6 +23901,478 @@ var pipelineAnalyticsCapability = {
23995
23901
  }) }
23996
23902
  }
23997
23903
  };
23904
+ /**
23905
+ * Reference to the frame's retained NATIVE surface + the parent crop's placement
23906
+ * within the frame, so the executor can re-cut a leaf child ROI at native
23907
+ * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
23908
+ */
23909
+ var NativeCropRefSchema = object({
23910
+ /** Handle keying the retained native surface (node-pinned to its owner). */
23911
+ handle: FrameHandleSchema,
23912
+ /** The parent crop's padded/clamped rectangle in FRAME-space pixels. */
23913
+ cropFrameSpace: object({
23914
+ x: number(),
23915
+ y: number(),
23916
+ w: number(),
23917
+ h: number()
23918
+ })
23919
+ });
23920
+ object({
23921
+ crop: object({
23922
+ left: number(),
23923
+ top: number(),
23924
+ width: number().positive(),
23925
+ height: number().positive()
23926
+ }).optional(),
23927
+ content: object({
23928
+ width: number().int().positive(),
23929
+ height: number().int().positive()
23930
+ }),
23931
+ fit: _enum(["stretch", "contain"]),
23932
+ format: _enum([
23933
+ "rgb",
23934
+ "gray",
23935
+ "jpeg"
23936
+ ])
23937
+ });
23938
+ /**
23939
+ * Process-local frame identity. It is serializable so it can ride an in-process
23940
+ * capability call, but `registryId` deliberately prevents resolution in any
23941
+ * other process or execution group.
23942
+ */
23943
+ var FrameRefSchema = object({
23944
+ registryId: string().min(1),
23945
+ id: string().min(1),
23946
+ width: number().int().positive(),
23947
+ height: number().int().positive(),
23948
+ format: _enum(["rgb", "gray"]),
23949
+ timestamp: number(),
23950
+ capturedAt: number().optional()
23951
+ });
23952
+ var ModelFormatSchema$1 = _enum([
23953
+ "onnx",
23954
+ "coreml",
23955
+ "openvino",
23956
+ "tflite",
23957
+ "pt",
23958
+ "gguf"
23959
+ ]);
23960
+ var PipelineSlotSchema = _enum([
23961
+ "detector",
23962
+ "cropper",
23963
+ "classifier",
23964
+ "refiner",
23965
+ "audio-classifier"
23966
+ ]);
23967
+ var PipelineEngineChoiceSchema = object({
23968
+ runtime: literal("python"),
23969
+ backend: string(),
23970
+ format: ModelFormatSchema$1,
23971
+ device: string().optional()
23972
+ });
23973
+ /**
23974
+ * One pool's resolved provisioning (`getEffectiveTuning`). `numWorkers` is the
23975
+ * knob that lifts a saturated pool (`inference-devices.md`); `concurrency` is
23976
+ * per-worker in-flight requests. `deviceKey` echoes the pool asked about —
23977
+ * `null` for the node-default pool.
23978
+ */
23979
+ var EffectiveTuningSchema = object({
23980
+ deviceKey: string().nullable(),
23981
+ runtime: string(),
23982
+ batchMode: string(),
23983
+ windowMs: number(),
23984
+ maxBatchSize: number(),
23985
+ concurrency: number(),
23986
+ numWorkers: number()
23987
+ });
23988
+ var AvailableEngineSchema = object({
23989
+ engine: PipelineEngineChoiceSchema,
23990
+ devices: array(object({
23991
+ id: string(),
23992
+ label: string(),
23993
+ description: string().optional()
23994
+ })).readonly(),
23995
+ defaultDevice: string()
23996
+ });
23997
+ var PipelineDefaultStepSchema = lazy(() => object({
23998
+ addonId: string(),
23999
+ addonName: string(),
24000
+ slot: PipelineSlotSchema,
24001
+ inputClasses: array(string()).readonly(),
24002
+ outputClasses: array(string()).readonly(),
24003
+ enabled: boolean(),
24004
+ modelId: string(),
24005
+ children: array(PipelineDefaultStepSchema).readonly(),
24006
+ group: string().optional(),
24007
+ settings: record(string(), unknown()).optional()
24008
+ }));
24009
+ var PipelineTemplateStepSchema = lazy(() => object({
24010
+ addonId: string(),
24011
+ enabled: boolean(),
24012
+ modelId: string(),
24013
+ children: array(PipelineTemplateStepSchema).readonly(),
24014
+ settings: record(string(), unknown()).optional()
24015
+ }));
24016
+ var PipelineTemplateSchema$1 = object({
24017
+ id: string(),
24018
+ name: string(),
24019
+ createdAt: string(),
24020
+ updatedAt: string(),
24021
+ engine: PipelineEngineChoiceSchema,
24022
+ steps: array(PipelineTemplateStepSchema).readonly()
24023
+ });
24024
+ var PipelineModelOptionSchema = object({
24025
+ id: string(),
24026
+ name: string(),
24027
+ formats: record(string(), object({
24028
+ downloaded: boolean(),
24029
+ sizeMB: number()
24030
+ })),
24031
+ group: ModelVariantGroupSchema.optional(),
24032
+ legacy: boolean().optional(),
24033
+ provider: ModelProviderIdSchema.optional()
24034
+ });
24035
+ var ConfigFieldBridge = custom();
24036
+ var PipelineAddonSchemaSchema = object({
24037
+ id: string(),
24038
+ name: string(),
24039
+ slot: PipelineSlotSchema,
24040
+ inputClasses: array(string()).readonly(),
24041
+ outputClasses: array(string()).readonly(),
24042
+ childSlots: array(PipelineSlotSchema).readonly(),
24043
+ models: array(PipelineModelOptionSchema).readonly(),
24044
+ defaultModelId: string(),
24045
+ defaultModelIdByFormat: record(string(), string()).optional(),
24046
+ enabledByDefault: boolean().optional(),
24047
+ backfillIntoExistingOverrides: boolean().optional(),
24048
+ defaultConfidence: number(),
24049
+ group: string().optional(),
24050
+ configSchema: array(ConfigFieldBridge).readonly().optional()
24051
+ });
24052
+ var PipelineSlotSchemaSchema = object({
24053
+ id: PipelineSlotSchema,
24054
+ label: string(),
24055
+ priority: number(),
24056
+ parentSlot: PipelineSlotSchema.nullable(),
24057
+ addons: array(PipelineAddonSchemaSchema).readonly()
24058
+ });
24059
+ var PipelineSchemaSchema = object({
24060
+ availableEngines: array(AvailableEngineSchema).readonly(),
24061
+ selectedEngine: PipelineEngineChoiceSchema,
24062
+ slots: array(PipelineSlotSchemaSchema).readonly()
24063
+ });
24064
+ var EngineProvisioningSchema = object({
24065
+ runtimeId: _enum([
24066
+ "onnx",
24067
+ "openvino",
24068
+ "coreml",
24069
+ "edgetpu"
24070
+ ]).nullable(),
24071
+ device: string().nullable(),
24072
+ state: _enum([
24073
+ "idle",
24074
+ "installing",
24075
+ "verifying",
24076
+ "ready",
24077
+ "failed"
24078
+ ]),
24079
+ progress: number().optional(),
24080
+ error: string().optional(),
24081
+ nextRetryAt: number().optional(),
24082
+ /**
24083
+ * Gate A (config-correctness gate at engine change): human-readable
24084
+ * config issues surfaced EAGERLY when the node's engine changes — model
24085
+ * substitutions ("chose X, running Y") and zero-build steps ("no model
24086
+ * has a <format> build"). Additive/optional: informational only, never
24087
+ * enforced here — `assertEngineReady` (readiness) still gates inference.
24088
+ * Absent/empty when the node-default tree resolves cleanly.
24089
+ */
24090
+ configIssues: array(string()).optional()
24091
+ });
24092
+ var PipelineStepInputSchema = lazy(() => object({
24093
+ addonId: string(),
24094
+ modelId: string().optional(),
24095
+ enabled: boolean().default(true),
24096
+ children: array(PipelineStepInputSchema).optional(),
24097
+ settings: record(string(), unknown()).optional(),
24098
+ jumpDeviceKey: string().optional()
24099
+ }));
24100
+ var ModelSubstitutionSchema = object({
24101
+ addonId: string(),
24102
+ chosen: string(),
24103
+ running: string(),
24104
+ format: string()
24105
+ });
24106
+ var PipelineValidationIssueSchema = object({
24107
+ addonId: string(),
24108
+ kind: _enum([
24109
+ "unknown-addon",
24110
+ "no-format-build",
24111
+ "unknown-device"
24112
+ ]),
24113
+ detail: string()
24114
+ });
24115
+ var PipelineValidationResultSchema = object({
24116
+ ok: boolean(),
24117
+ issues: array(PipelineValidationIssueSchema).readonly(),
24118
+ substitutions: array(ModelSubstitutionSchema).readonly(),
24119
+ /** The node's `currentEngine.format` this validation ran against. */
24120
+ format: string()
24121
+ });
24122
+ var ReferenceImageEntrySchema = object({
24123
+ filename: string(),
24124
+ stepIds: array(string()).readonly().optional()
24125
+ });
24126
+ var ReferenceImageBodySchema = object({
24127
+ base64: string(),
24128
+ filename: string()
24129
+ });
24130
+ var ReferenceAudioEntrySchema = object({
24131
+ filename: string(),
24132
+ sizeKb: number()
24133
+ });
24134
+ var ReferenceAudioBodySchema = object({ base64: string() });
24135
+ var AudioBackendSchema = object({
24136
+ id: string(),
24137
+ name: string(),
24138
+ description: string(),
24139
+ available: boolean(),
24140
+ /**
24141
+ * Raw classifier labels this backend can emit (e.g. YAMNet's
24142
+ * 521-class set or Apple SoundAnalysis's 303-class set). Used by
24143
+ * the benchmark UI to populate the `enabledMicroClasses` filter
24144
+ * specific to the selected backend without a separate fetch.
24145
+ */
24146
+ rawLabels: array(string()).readonly().optional()
24147
+ });
24148
+ var AudioCapabilitiesSchema = object({
24149
+ activeBackend: string(),
24150
+ availableBackends: array(AudioBackendSchema).readonly(),
24151
+ sampleRate: number(),
24152
+ chunkDurationMs: number()
24153
+ });
24154
+ var DownloadModelResultSchema = object({
24155
+ filePath: string(),
24156
+ sizeMB: number(),
24157
+ durationMs: number()
24158
+ });
24159
+ /**
24160
+ * Wrapper carrying a single test run's result. Replaces the legacy
24161
+ * ad-hoc `{labels: [{className, originalClass, score}]}` shape with the
24162
+ * canonical `AudioResult` from the Phase 6 output rework: one
24163
+ * `AudioDetection` per class above `minScore`, top-N candidates in
24164
+ * `debug.alternateLabels['audio-classifier']`, per-source timings in
24165
+ * `debug.stepTimings`. The outer `success`/`error` fields stay so the
24166
+ * benchmark UI can still report a clean failure when the classifier
24167
+ * cap isn't available.
24168
+ */
24169
+ var AudioTestResultSchema = object({
24170
+ success: boolean(),
24171
+ error: string().optional(),
24172
+ frame: custom().optional()
24173
+ });
24174
+ var PipelineConfigBridge = custom();
24175
+ var ConfigUISchemaBridge = custom();
24176
+ var ConfigUISchemaNullableBridge = custom();
24177
+ var InferenceCapabilitiesBridge = custom();
24178
+ var ModelAvailabilityListBridge = custom();
24179
+ var PipelineRunResultBridge = custom();
24180
+ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
24181
+ modelId: string(),
24182
+ settings: record(string(), unknown()).readonly()
24183
+ }))), method(object({ steps: record(string(), object({
24184
+ modelId: string(),
24185
+ settings: record(string(), unknown()).readonly()
24186
+ })) }), object({ success: literal(true) }), {
24187
+ kind: "mutation",
24188
+ auth: "admin"
24189
+ }), method(object({ nodeId: string() }), object({
24190
+ success: literal(true),
24191
+ clearedDevices: number()
24192
+ }), {
24193
+ kind: "mutation",
24194
+ auth: "admin"
24195
+ }), method(object({ nodeId: string() }), object({ unhealthy: array(object({
24196
+ /** `<backend>:<device>`, e.g. `openvino:gpu`. */
24197
+ deviceKey: string(),
24198
+ /**
24199
+ * `failed` — the per-device restart budget is exhausted; no pool
24200
+ * will be spawned until an operator re-arms it or the runner
24201
+ * respawns. `backoff` — under budget, waiting out the backoff (or
24202
+ * a cached pool observed dead and not yet condemned).
24203
+ */
24204
+ state: _enum(["failed", "backoff"]),
24205
+ /** Epoch ms of the death that produced this state. */
24206
+ since: number(),
24207
+ /** Pool deaths inside the current window. */
24208
+ deaths: number(),
24209
+ /** The last death's message. */
24210
+ lastError: string()
24211
+ })).readonly() })), method(object({
24212
+ nodeId: string(),
24213
+ deviceKey: string()
24214
+ }), object({ rearmed: boolean() }), {
24215
+ kind: "mutation",
24216
+ auth: "admin"
24217
+ }), method(_void(), PipelineSchemaSchema), method(_void(), array(PipelineDefaultStepSchema).readonly().nullable()), method(_void(), PipelineConfigBridge), method(_void(), ConfigUISchemaBridge), method(object({
24218
+ steps: array(PipelineStepInputSchema),
24219
+ deviceKey: string().optional()
24220
+ }), PipelineValidationResultSchema), method(_void(), array(PipelineTemplateSchema$1).readonly()), method(object({
24221
+ name: string(),
24222
+ steps: array(PipelineTemplateStepSchema).readonly(),
24223
+ engine: PipelineEngineChoiceSchema
24224
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({
24225
+ id: string(),
24226
+ name: string().optional(),
24227
+ steps: array(PipelineTemplateStepSchema).readonly().optional()
24228
+ }), PipelineTemplateSchema$1, { kind: "mutation" }), method(object({ id: string() }), _void(), { kind: "mutation" }), method(_void(), InferenceCapabilitiesBridge), method(object({ addonId: string() }), ModelAvailabilityListBridge), method(object({
24229
+ addonId: string(),
24230
+ modelId: string(),
24231
+ format: ModelFormatSchema$1
24232
+ }), DownloadModelResultSchema, { kind: "mutation" }), method(object({
24233
+ addonId: string(),
24234
+ modelId: string(),
24235
+ format: ModelFormatSchema$1
24236
+ }), object({ success: literal(true) }), { kind: "mutation" }), method(object({
24237
+ steps: array(PipelineStepInputSchema).min(1),
24238
+ frame: FrameInputSchema.optional(),
24239
+ /**
24240
+ * Process-local lazy frame. Valid only when caller and provider resolve
24241
+ * in the same execution-group process; split/cross-node callers use
24242
+ * `frame`/`image` inline compatibility instead.
24243
+ */
24244
+ frameRef: FrameRefSchema.optional(),
24245
+ /**
24246
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
24247
+ * the decoded pixels live in. One more member of the one-of
24248
+ * frame/frameHandle/image/imageBase64/referenceImage group.
24249
+ */
24250
+ frameHandle: FrameHandleSchema.optional(),
24251
+ imageBase64: string().optional(),
24252
+ /**
24253
+ * Binary JPEG bytes — preferred over `imageBase64` on internal
24254
+ * hops (hub → forked worker via Moleculer MsgPack) because it
24255
+ * skips the 33% base64 overhead + the per-call base64 decode on
24256
+ * the detection-pipeline worker. Callers can pass either; exactly
24257
+ * one of `frame`/`image`/`imageBase64`/`referenceImage` is required.
24258
+ */
24259
+ image: _instanceof(Uint8Array).optional(),
24260
+ referenceImage: string().optional(),
24261
+ deviceId: number().optional(),
24262
+ sessionId: string().optional(),
24263
+ /**
24264
+ * Execution plane. 'full' (default) runs the whole tree — benchmark,
24265
+ * reference-image, and detail-subtree calls. 'frame' is the live
24266
+ * per-frame dispatch: ONLY root-plane steps run; crop children
24267
+ * (inputClasses ≠ null) are skipped and served per-track via
24268
+ * pipelineRunner.runDetailSubtree (two-plane design).
24269
+ */
24270
+ plane: _enum(["full", "frame"]).optional(),
24271
+ /**
24272
+ * Inference-device selector (Phase 2 multi-device). Format
24273
+ * `<backend>:<device>` (e.g. `openvino:gpu`, `edgetpu:usb`, `cpu`).
24274
+ * Omitted ⇒ the runner's default device (current single-engine
24275
+ * behaviour). Selects WHICH device pool of the node runs the call.
24276
+ */
24277
+ deviceKey: string().optional(),
24278
+ /**
24279
+ * Two-plane NATIVE child-crop reference. Set by `runDetailSubtree` ONLY
24280
+ * when the parent crop was resolved from the frame's retained NATIVE
24281
+ * surface (a frameHandle HIT). Lets the executor re-cut a LEAF crop
24282
+ * child's ROI (plate-ocr, face-embedding, leaf classifiers) at native
24283
+ * resolution from that surface — the SAME quality path faces already
24284
+ * had — instead of the downscaled parent tile. `handle` keys the native
24285
+ * surface (node-pinned to its owner); `cropFrameSpace` is the parent
24286
+ * crop's padded/clamped rectangle in FRAME-space pixels, used to compose
24287
+ * the executor's crop-normalized child ROI back into frame-normalized
24288
+ * coordinates. Auxiliary to the image source (`image`/`frame`/…), NOT one
24289
+ * of the mutually-exclusive image inputs. Absent ⇒ tile-crop children
24290
+ * (today's behaviour on the fallback path).
24291
+ */
24292
+ nativeCropRef: NativeCropRefSchema.optional(),
24293
+ /**
24294
+ * Offline REPLAY of stored media for `deviceId` (D56, D646): the
24295
+ * camera's zone gate and overrides apply as live, every executing
24296
+ * step runs EXACTLY the model it names on the `deviceKey` pool it
24297
+ * names or the call refuses (`model-not-servable` /
24298
+ * `device-not-servable`), and nothing reaches the camera's live
24299
+ * trace stream. Absent ⇒ unchanged behaviour.
24300
+ */
24301
+ replay: literal(true).optional()
24302
+ }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
24303
+ steps: array(PipelineStepInputSchema).min(1),
24304
+ frames: array(FrameInputSchema).min(1).max(255),
24305
+ deviceId: number().optional(),
24306
+ sessionId: string().optional(),
24307
+ /**
24308
+ * Pure-inference benchmark hint. A NONZERO uint32 pins every frame in
24309
+ * the batch to the Python pool's bench preprocess cache
24310
+ * (`_bench_frame_id`) so a REPEATED benchmark frame is decoded +
24311
+ * preprocessed ONCE and every later inference is a pure-inference cache
24312
+ * hit — the sustained-throughput run measures inference, not
24313
+ * decode+preprocess+infer. Omitted/0 for live frames (all different →
24314
+ * full preprocess every call, correct). Fresh per sustained run;
24315
+ * released via `uncacheFrame`.
24316
+ */
24317
+ frameId: number().int().nonnegative().optional(),
24318
+ /** Inference-device selector (Phase 2 multi-device); see runPipeline. */
24319
+ deviceKey: string().optional()
24320
+ }), object({ results: array(PipelineRunResultBridge).readonly() }), { kind: "mutation" }), method(object({
24321
+ data: _instanceof(Uint8Array),
24322
+ width: number().int().positive(),
24323
+ height: number().int().positive(),
24324
+ format: _enum([
24325
+ "rgb",
24326
+ "bgr",
24327
+ "gray"
24328
+ ])
24329
+ }), object({
24330
+ frameId: number(),
24331
+ width: number(),
24332
+ height: number()
24333
+ }), { kind: "mutation" }), method(object({
24334
+ stepId: string(),
24335
+ frameId: number().int()
24336
+ }), record(string(), unknown()), { kind: "mutation" }), method(object({ frameId: number().int() }), _void(), { kind: "mutation" }), method(object({ deviceKey: string().optional() }), EffectiveTuningSchema), method(_void(), array(object({
24337
+ engineKey: string(),
24338
+ engine: PipelineEngineChoiceSchema,
24339
+ modelsLoaded: array(string()).readonly(),
24340
+ inUseByCameras: array(number()).readonly(),
24341
+ /**
24342
+ * Origin of this resident factory.
24343
+ * - `runtime` — main camera-serving engine (no idle TTL).
24344
+ * - `device-pool` — a concurrent per-device pool (Phase 2
24345
+ * multi-device, keyed by `deviceKey`) resolved
24346
+ * via `resolveDeviceFactory`. Runs alongside the
24347
+ * `runtime` engine on a DIFFERENT accelerator
24348
+ * (NPU / iGPU / Coral) — this is how the
24349
+ * Engines tab shows all pools running at once.
24350
+ */
24351
+ kind: _enum(["runtime", "device-pool"]),
24352
+ /** Native pid of the underlying Python pool (null when no pool). */
24353
+ poolPid: number().nullable(),
24354
+ /** ms since this factory was last used (null when not warm-tracked). */
24355
+ idleMs: number().nullable(),
24356
+ /** Idle TTL after which the factory self-evicts (null when not applicable). */
24357
+ idleTtlMs: number().nullable()
24358
+ })).readonly()), method(object({ engine: PipelineEngineChoiceSchema }), object({ success: literal(true) }), {
24359
+ kind: "mutation",
24360
+ auth: "admin"
24361
+ }), method(object({
24362
+ engine: PipelineEngineChoiceSchema,
24363
+ force: boolean().optional()
24364
+ }), object({
24365
+ success: boolean(),
24366
+ reason: string().optional()
24367
+ }), {
24368
+ kind: "mutation",
24369
+ auth: "admin"
24370
+ }), method(_void(), array(ReferenceImageEntrySchema).readonly()), method(object({ filename: string() }), ReferenceImageBodySchema.nullable()), method(_void(), array(ReferenceAudioEntrySchema).readonly()), method(object({ filename: string() }), ReferenceAudioBodySchema.nullable()), method(_void(), AudioCapabilitiesSchema), method(object({
24371
+ addonId: string(),
24372
+ modelId: string(),
24373
+ filename: string().optional(),
24374
+ settings: record(string(), unknown()).optional()
24375
+ }), AudioTestResultSchema, { kind: "mutation" }), method(_void(), ConfigUISchemaNullableBridge);
23998
24376
  object({
23999
24377
  activeCameras: number(),
24000
24378
  throttledCameras: number(),
@@ -24020,6 +24398,106 @@ var CameraMetricsSchema = object({
24020
24398
  });
24021
24399
  var CameraMetricsWithDeviceIdSchema = CameraMetricsSchema.extend({ deviceId: number() });
24022
24400
  /**
24401
+ * Zone — pure geometry + identity. NO filtering behaviour.
24402
+ *
24403
+ * Zones describe **where** in the frame the operator wants to flag
24404
+ * something; consumer-owned {@link ZoneRule} arrays describe **how**
24405
+ * each pipeline stage uses them. Splitting the two means a single
24406
+ * polygon "Driveway" can simultaneously back a motion-exclude rule,
24407
+ * a detection-include rule on `['car']`, and an occupancy aggregate
24408
+ * — without three duplicated polygons.
24409
+ *
24410
+ * Owned by the orchestrator addon (provider) and mirrored into the
24411
+ * `zones` device-state slice on every mutation. Consumers
24412
+ * (motion-wasm, pipeline-executor, analytics, admin UI) read either
24413
+ * via `api.zones.listZones` (one-shot) or via `dev.state.zones` (live
24414
+ * mirror with `onChanged`).
24415
+ *
24416
+ * Coordinates are normalised fractions of the frame (0–1) so zones
24417
+ * survive resolution changes and stream profile switches.
24418
+ *
24419
+ * `kind` discriminates between full polygons (closed regions used
24420
+ * for intrusion / occupancy filters) and tripwires (open 2-point
24421
+ * line segments used for cross events). Onboard / firmware-reported
24422
+ * zones (Reolink, ONVIF) are out of scope for now — see the deferred
24423
+ * task list.
24424
+ */
24425
+ var ZoneKindEnum = _enum(["polygon", "tripwire"]);
24426
+ /** Polygon vertex in fraction-of-frame coordinates (0–1). */
24427
+ var PolygonPointSchema = object({
24428
+ x: number(),
24429
+ y: number()
24430
+ });
24431
+ /** A camera detection zone — pure geometry/identity. */
24432
+ var ZoneSchema = object({
24433
+ id: string(),
24434
+ name: string(),
24435
+ kind: ZoneKindEnum.default("polygon"),
24436
+ /** Polygon vertices, fraction of frame (0–1). */
24437
+ polygon: array(PolygonPointSchema).readonly(),
24438
+ /** Visual color for UI rendering. */
24439
+ color: string().default("#3b82f6")
24440
+ });
24441
+ /**
24442
+ * Zones capability — per-camera CRUD over polygon detection zones.
24443
+ *
24444
+ * Provider lives in `addon-pipeline-orchestrator` (hub-only). Persists
24445
+ * to per-device settings and mirrors into the `zones` device-state
24446
+ * slice on every mutation, so downstream consumers can subscribe via
24447
+ * `dev.state.zones.onChanged`.
24448
+ *
24449
+ * The cap surface only handles geometry + identity; filtering
24450
+ * behaviour (per-class, include/exclude, threshold) lives in the
24451
+ * consumer addons' rule arrays — see `ZoneRuleSchema` exported from
24452
+ * `capabilities/schemas/zone-rule.js`.
24453
+ */
24454
+ var zonesCapability = {
24455
+ name: "zones",
24456
+ scope: "device",
24457
+ mode: "singleton",
24458
+ deviceTypes: [DeviceType.Camera],
24459
+ methods: {
24460
+ listZones: method(object({ deviceId: number() }), array(ZoneSchema).readonly()),
24461
+ addZone: method(object({
24462
+ deviceId: number(),
24463
+ zone: ZoneSchema
24464
+ }), _void(), {
24465
+ kind: "mutation",
24466
+ auth: "admin"
24467
+ }),
24468
+ removeZone: method(object({
24469
+ deviceId: number(),
24470
+ zoneId: string()
24471
+ }), _void(), {
24472
+ kind: "mutation",
24473
+ auth: "admin"
24474
+ }),
24475
+ updateZone: method(object({
24476
+ deviceId: number(),
24477
+ zone: ZoneSchema
24478
+ }), _void(), {
24479
+ kind: "mutation",
24480
+ auth: "admin"
24481
+ })
24482
+ },
24483
+ /**
24484
+ * Runtime-state slice — the live zone catalogue mirrored by the
24485
+ * orchestrator on every CRUD mutation. Consumers read via
24486
+ * `device.state.zones.value` / `.watch(...)` without round-tripping
24487
+ * the cap, and the codegen DeviceProxy auto-wires the reactive
24488
+ * handle. Slice shape is `{ zones: Zone[] }` so future extensions
24489
+ * (e.g. zone groupings) can sit alongside the polygon list.
24490
+ */
24491
+ runtimeState: object({ zones: array(ZoneSchema).readonly() }),
24492
+ /**
24493
+ * Runtime-state durability: **restored** — written only on operator mutation, so a camera that never had one has nothing to re-derive from. This is the slice `zone-mirror-hydration.ts` exists to paper over.
24494
+ *
24495
+ * See `RuntimeStateDurability`. Enforced by
24496
+ * `scripts/check-runtime-state-durability.ts`.
24497
+ */
24498
+ durability: "restored"
24499
+ };
24500
+ /**
24023
24501
  * A bounding box in NORMALIZED [0,1] frame coordinates for `getNativeCrop`. The
24024
24502
  * decode worker resolves it against the RETAINED native frame's real pixel dims,
24025
24503
  * so the caller supplies only the detection-res bbox divided by the detection
@@ -24471,6 +24949,17 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
24471
24949
  hubHostnameOverride: string().optional()
24472
24950
  })]).describe("Per-camera frame-source mode for the runner (P2c)");
24473
24951
  /**
24952
+ * What ONE step runs with on ONE roster device for THIS camera (D650): the
24953
+ * device's per-(node,device) base with the camera's override for that device
24954
+ * on top — the same `override ?? base` merge the orchestrator applies to the
24955
+ * elected device (`applyDeviceProvisioning`). Absent `modelId` ⇒ the executor
24956
+ * resolves the device format's default, exactly as on the elected device.
24957
+ */
24958
+ var RunnerJumpStepProvisioningSchema = object({
24959
+ modelId: string().optional(),
24960
+ settings: record(string(), unknown()).optional()
24961
+ });
24962
+ /**
24474
24963
  * One ENABLED inference device on the runner's node, as the step-tree
24475
24964
  * device-jump resolver sees it (phase 1). The orchestrator populates this
24476
24965
  * roster on the attach payload whenever the camera is elected onto a specific
@@ -24482,7 +24971,16 @@ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal
24482
24971
  var RunnerInferenceDeviceSchema = object({
24483
24972
  deviceKey: string(),
24484
24973
  weight: number().positive().default(1),
24485
- maxSessions: number().int().positive().nullable().default(null)
24974
+ maxSessions: number().int().positive().nullable().default(null),
24975
+ /**
24976
+ * Per-step provisioning for this camera on THIS device (D650), keyed by step
24977
+ * id. A step the runner jumps here runs with these fields, never with the
24978
+ * elected device's: `modelId` / `settings` are REPLACED on the jumped subtree
24979
+ * (a step absent from the map runs with neither — the target format default).
24980
+ * Absent field ⇒ an orchestrator that predates D650: the jumped step keeps
24981
+ * the elected device's provisioning, as before.
24982
+ */
24983
+ steps: record(string(), RunnerJumpStepProvisioningSchema).optional()
24486
24984
  });
24487
24985
  /**
24488
24986
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
@@ -25357,6 +25855,28 @@ var NodeInferenceDeviceSchema = object({
25357
25855
  */
25358
25856
  exclusion: InferenceDeviceExclusionReasonSchema.nullable()
25359
25857
  });
25858
+ /**
25859
+ * The operator's model choice for one cluster-scoped step, answered by the
25860
+ * addon that OWNS the `clusterModel:*` settings (D651). Three answers, never
25861
+ * folded: a written choice, a key nobody wrote (the cluster runs the default
25862
+ * BY ABSENCE), or no answer. A caller that rewrites an index acts only on the
25863
+ * first two, read twice and agreeing.
25864
+ */
25865
+ var ClusterModelChoiceSchema = discriminatedUnion("kind", [
25866
+ object({
25867
+ kind: literal("stored"),
25868
+ modelId: string()
25869
+ }),
25870
+ object({
25871
+ kind: literal("absent"),
25872
+ defaultModelId: string()
25873
+ }),
25874
+ object({
25875
+ kind: literal("unreadable"),
25876
+ reason: _enum(CLUSTER_MODEL_CHOICE_UNREADABLE_REASONS),
25877
+ error: string().optional()
25878
+ })
25879
+ ]);
25360
25880
  var NodeInferenceDevicesSchema = object({
25361
25881
  nodeId: string(),
25362
25882
  /** False when the node's platform-probe was unreachable (no live device set). */
@@ -25384,10 +25904,17 @@ method(StorageMigrationLeaseInputSchema, object({ paused: literal(true) }), {
25384
25904
  }), object({ success: literal(true) }), {
25385
25905
  kind: "mutation",
25386
25906
  auth: "admin"
25387
- }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({ migrated: number() }), {
25907
+ }), method(object({ deviceId: number() }), object({ deviceKey: string().nullable() })), method(_void(), object({
25908
+ migrated: number(),
25909
+ skipped: array(object({
25910
+ deviceId: number(),
25911
+ targetNodeId: string(),
25912
+ reason: string()
25913
+ })).default([])
25914
+ }), {
25388
25915
  kind: "mutation",
25389
25916
  auth: "admin"
25390
- }), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
25917
+ }), method(_void(), array(PipelineAssignmentSchema).readonly()), method(object({ deviceId: number() }), PipelineAssignmentSchema.nullable()), method(_void(), array(AgentLoadSummarySchema).readonly()), method(object({ stepId: string() }), ClusterModelChoiceSchema), method(_void(), GlobalMetricsSchema), method(object({ deviceId: number() }), CameraMetricsSchema.nullable()), method(object({ nodeId: string() }), CapabilityBindingsSchema), method(object({
25391
25918
  nodeId: string(),
25392
25919
  capName: string(),
25393
25920
  addonId: string()
@@ -27103,6 +27630,20 @@ var VectorScanResultSchema = object({
27103
27630
  */
27104
27631
  nextCursor: number().int().nonnegative().nullable()
27105
27632
  });
27633
+ /**
27634
+ * The ONE error code for "this index exists at another dimension; refusing to
27635
+ * redeclare it" (D649). It rides in the MESSAGE — an Error's own properties do
27636
+ * not survive the UDS/tRPC hop, its message does — and both sides go through
27637
+ * the helpers below, never a copied phrase: a consumer that must tell "this
27638
+ * index can never hold my vectors" from "the provider is unreachable" (a
27639
+ * delete counts the first as nothing-to-delete and the second as still
27640
+ * present) otherwise breaks silently the day the wording changes.
27641
+ */
27642
+ var VECTOR_INDEX_DIM_CONFLICT = "vector-index-dim-conflict";
27643
+ /** True when `err` (possibly re-wrapped by a transport) is that refusal. */
27644
+ function isVectorIndexDimConflict(err) {
27645
+ return (err instanceof Error ? err.message : String(err)).includes(`[${VECTOR_INDEX_DIM_CONFLICT}]`);
27646
+ }
27106
27647
  var VectorStatsInputSchema = object({ index: string() });
27107
27648
  var VectorStatsResultSchema = object({
27108
27649
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -27762,6 +28303,349 @@ DeviceType.Camera, method(object({
27762
28303
  auth: "protected"
27763
28304
  });
27764
28305
  /**
28306
+ * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
28307
+ * valutatore puro del suo FRONTE.
28308
+ *
28309
+ * Viveva dentro il builtin virtual-doorbell
28310
+ * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
28311
+ * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
28312
+ * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
28313
+ * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
28314
+ * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
28315
+ * SPOSTA qui e il doorbell la ri-esporta.
28316
+ *
28317
+ * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
28318
+ * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
28319
+ * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
28320
+ * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
28321
+ */
28322
+ /**
28323
+ * Known binary / switch source caps → the boolean slice field whose
28324
+ * false→true rise counts as ACTIVE. Every entry is "fire on active".
28325
+ * Sensors whose "active" reading is not a plain boolean (presence's string
28326
+ * state, connectivity's connected flag) are deliberately excluded — a
28327
+ * reconnect is not a doorbell press, and it is not a recording either.
28328
+ */
28329
+ var SOURCE_CAP_ACTIVE_FIELD = {
28330
+ contact: "entryOpen",
28331
+ binary: "on",
28332
+ switch: "on",
28333
+ motion: "detected",
28334
+ flood: "flooded",
28335
+ gas: "detected",
28336
+ smoke: "detected",
28337
+ "carbon-monoxide": "detected",
28338
+ vibration: "detected",
28339
+ tamper: "tampered"
28340
+ };
28341
+ /**
28342
+ * The same caps → the slice field carrying the ms-epoch timestamp of the
28343
+ * last transition. Every source cap MUST appear here (guarded by a spec):
28344
+ * without a transition timestamp the evaluator cannot tell a genuine rise
28345
+ * from a boot-time hydration when the FIRST slice it ever sees is already
28346
+ * active, and errs towards silence — swallowing the rise.
28347
+ *
28348
+ * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
28349
+ * provider derives them from `state.last_changed`, so they survive our own
28350
+ * restarts and correctly read as "hours ago" for a state that has been
28351
+ * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
28352
+ */
28353
+ var SOURCE_CAP_CHANGED_AT_FIELD = {
28354
+ contact: "lastChangedAt",
28355
+ binary: "lastChangedAt",
28356
+ switch: "lastChangedAt",
28357
+ motion: "lastDetectedAt",
28358
+ flood: "lastChangedAt",
28359
+ gas: "lastChangedAt",
28360
+ smoke: "lastChangedAt",
28361
+ "carbon-monoxide": "lastChangedAt",
28362
+ vibration: "lastChangedAt",
28363
+ tamper: "lastChangedAt"
28364
+ };
28365
+ /** Cap names whose presence in a device's bindings qualify it as a source. */
28366
+ var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
28367
+ /** True when a cap is a recognised binary/switch source. */
28368
+ function isSourceCap(capName) {
28369
+ return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
28370
+ }
28371
+ /** Extract the "active" boolean a source cap's slice carries, or null when
28372
+ * the cap is unknown or the field is missing / non-boolean. */
28373
+ function sliceActiveValue(capName, slice) {
28374
+ const field = SOURCE_CAP_ACTIVE_FIELD[capName];
28375
+ if (field === void 0) return null;
28376
+ const raw = slice[field];
28377
+ return typeof raw === "boolean" ? raw : null;
28378
+ }
28379
+ /** Ms-epoch transition timestamp a source cap's slice carries, or null when
28380
+ * it is absent, non-numeric or the zero "never observed" sentinel. */
28381
+ function sliceChangedAt(capName, slice) {
28382
+ const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
28383
+ if (field === void 0) return null;
28384
+ const raw = slice[field];
28385
+ if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
28386
+ return raw;
28387
+ }
28388
+ /**
28389
+ * How recent a source's own transition timestamp must be for a FIRST
28390
+ * sighting that is already active to count as a genuine rise rather than a
28391
+ * hydration of long-standing state.
28392
+ */
28393
+ var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
28394
+ /**
28395
+ * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
28396
+ * porta `prior`, `nowMs` e il proprio `startedAtMs`.
28397
+ *
28398
+ * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
28399
+ * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
28400
+ * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
28401
+ * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
28402
+ * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
28403
+ * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
28404
+ * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
28405
+ * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
28406
+ */
28407
+ function evaluateSensorEdge(input) {
28408
+ const value = sliceActiveValue(input.capName, input.slice);
28409
+ if (value === null) return {
28410
+ edge: "none",
28411
+ value: null,
28412
+ reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
28413
+ };
28414
+ if (input.prior === void 0) {
28415
+ if (!value) return {
28416
+ edge: "none",
28417
+ value,
28418
+ reason: "baseline-seeded-inactive"
28419
+ };
28420
+ const changedAt = sliceChangedAt(input.capName, input.slice);
28421
+ const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
28422
+ if (changedAt === null || changedAt < floor) return {
28423
+ edge: "none",
28424
+ value,
28425
+ reason: "baseline-seeded-stale-active"
28426
+ };
28427
+ return {
28428
+ edge: "rising",
28429
+ value: true
28430
+ };
28431
+ }
28432
+ if (input.prior === value) return {
28433
+ edge: "none",
28434
+ value,
28435
+ reason: "no-change"
28436
+ };
28437
+ if (!value) return {
28438
+ edge: "none",
28439
+ value,
28440
+ reason: "falling-edge"
28441
+ };
28442
+ return {
28443
+ edge: "rising",
28444
+ value: true
28445
+ };
28446
+ }
28447
+ /**
28448
+ * Doorbell button cap. Two kinds of providers coexist behind this cap
28449
+ * name (same pattern as `snapshot`):
28450
+ *
28451
+ * - **Native** providers: registered per-device by device-driver
28452
+ * addons via `ctx.registerNativeCap` — either on a
28453
+ * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
28454
+ * or directly on the camera (Reolink registers at camera level).
28455
+ * Emits an `onPressed` event every time the firmware pushes a
28456
+ * ring; status tracks the last press and a pressCount since start
28457
+ * (diagnostic).
28458
+ *
28459
+ * - **Wrapper** provider: the `virtual-doorbell` system builtin
28460
+ * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
28461
+ * device (contact / switch / event-emitter …) into a doorbell for
28462
+ * a camera. `defaultActive: false` — the operator explicitly binds
28463
+ * it per camera in the device-bindings UI, then picks the source
28464
+ * device + trigger in the per-device settings.
28465
+ *
28466
+ * The DeviceEventPropagator re-emits `onPressed` on the camera parent
28467
+ * — subscribers listening at the camera level receive ring events
28468
+ * with `via[]` populated. No code on the parent needed.
28469
+ */
28470
+ var DoorbellStatusSchema = object({
28471
+ /** Ms epoch of the last press. null = never observed since this provider started. */
28472
+ lastPressedAt: number().nullable(),
28473
+ /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
28474
+ pressCountSinceStart: number()
28475
+ });
28476
+ var DoorbellPressEventSchema = object({
28477
+ deviceId: number(),
28478
+ timestamp: number()
28479
+ });
28480
+ /**
28481
+ * The `doorbell-source` extension slot's editable value (D648): the camera's
28482
+ * virtual-doorbell trigger devices, exactly what the wrapper's
28483
+ * `doorbellSources` persists (as `{ deviceId }` records).
28484
+ */
28485
+ var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
28486
+ /**
28487
+ * The `doorbell-source` slot — which devices ring this camera's VIRTUAL
28488
+ * doorbell, owned by the `virtual-doorbell` wrapper over its
28489
+ * `doorbellSources` store (D648). A source rings when one of its
28490
+ * `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
28491
+ * different authority (`deviceManager.setWrapperActive`, D62) — the slot
28492
+ * reports it, it never writes it.
28493
+ */
28494
+ var DOORBELL_SOURCE_SLOT = {
28495
+ id: "doorbell-source",
28496
+ label: "Doorbell trigger devices",
28497
+ 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.",
28498
+ shape: "association",
28499
+ hostDeviceTypes: [DeviceType.Camera],
28500
+ sourceCaps: SOURCE_CAPS,
28501
+ cardinality: "many",
28502
+ value: DoorbellSourceSlotValueSchema
28503
+ };
28504
+ var doorbellCapability = {
28505
+ name: "doorbell",
28506
+ scope: "device",
28507
+ deviceNative: true,
28508
+ mode: "singleton",
28509
+ kind: "wrapper",
28510
+ defaultActive: false,
28511
+ deviceTypes: [DeviceType.Button, DeviceType.Camera],
28512
+ exposesDeviceSettings: true,
28513
+ extensionSlots: [DOORBELL_SOURCE_SLOT],
28514
+ methods: {},
28515
+ events: {
28516
+ /**
28517
+ * Fires once per physical press. Reolink delivers via Baichuan
28518
+ * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
28519
+ * release/duration — it's a pulse.
28520
+ */
28521
+ onPressed: { data: DoorbellPressEventSchema } },
28522
+ status: {
28523
+ schema: DoorbellStatusSchema,
28524
+ kind: "push"
28525
+ },
28526
+ /**
28527
+ * Runtime-state slice — last press timestamp + lifetime press count.
28528
+ * Mirrored by the kernel and readable via
28529
+ * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
28530
+ * without subscribing.
28531
+ */
28532
+ runtimeState: DoorbellStatusSchema,
28533
+ /**
28534
+ * 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.
28535
+ *
28536
+ * See `RuntimeStateDurability`. Enforced by
28537
+ * `scripts/check-runtime-state-durability.ts`.
28538
+ */
28539
+ durability: "restored"
28540
+ };
28541
+ var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
28542
+ DeviceType.Camera, DeviceType.Camera;
28543
+ /** A slot's editable value, discriminated on `slot`. */
28544
+ var ExtensionSlotValueSchema = discriminatedUnion("slot", [DoorbellSourceSlotValueSchema.extend({ slot: literal("doorbell-source") }), LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
28545
+ DeviceType.Camera;
28546
+ var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
28547
+ state: literal("unreachable"),
28548
+ reason: string()
28549
+ })]);
28550
+ /** One provider of slots — the D554 source-listing row. */
28551
+ var ExtensionSourceSchema = object({
28552
+ /** The routing prefix of every `slotRef` this provider serves. */
28553
+ source: string(),
28554
+ label: string(),
28555
+ /** Stamped by the dispatcher from the registry (D557). */
28556
+ addonId: string().optional(),
28557
+ availability: ExtensionSourceAvailabilitySchema
28558
+ });
28559
+ /**
28560
+ * How one picked source stands. `missing` — no such device (deleted, or an id
28561
+ * that never existed); `foreign` — a device the slot's owner cannot read from
28562
+ * (slice 2's cross-owner graft source); `unavailable` — it exists but is not a
28563
+ * valid source now (a container, which is never a pick). A source in any of
28564
+ * these states is SHOWN, never silently dropped or re-pointed.
28565
+ */
28566
+ var ExtensionSourceHealthSchema = _enum([
28567
+ "ok",
28568
+ "missing",
28569
+ "foreign",
28570
+ "unavailable"
28571
+ ]);
28572
+ var ExtensionSlotSourceSchema = object({
28573
+ deviceId: number().int(),
28574
+ /** The device's name, or null when it could not be resolved (`missing`). */
28575
+ name: string().nullable(),
28576
+ health: ExtensionSourceHealthSchema,
28577
+ detail: string().optional()
28578
+ });
28579
+ /**
28580
+ * A DIFFERENT authority that gates whether the slot's sources do anything —
28581
+ * reported read-only, named, never written through this contract (D62). The
28582
+ * virtual doorbell's sources ring only while the wrapper is bound to the
28583
+ * camera, and that binding belongs to `deviceManager.setWrapperActive`.
28584
+ * `unknown` means the gate could not be read; it is not "inactive" (D315).
28585
+ */
28586
+ var ExtensionSlotActivationSchema = object({
28587
+ state: _enum([
28588
+ "active",
28589
+ "inactive",
28590
+ "unknown"
28591
+ ]),
28592
+ authority: string(),
28593
+ detail: string().optional()
28594
+ });
28595
+ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
28596
+ state: literal("ok"),
28597
+ /** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
28598
+ slotRef: string(),
28599
+ slot: ExtensionSlotIdSchema,
28600
+ /** Names the store written (D62), e.g. `virtual-doorbell:doorbellSources`. */
28601
+ authority: string(),
28602
+ /** graft: its switch. association: null — removing every source is "off". */
28603
+ enabled: boolean().nullable(),
28604
+ /** graft: the cap registered on the host. association: null. */
28605
+ projects: string().nullable(),
28606
+ activation: ExtensionSlotActivationSchema.nullable(),
28607
+ value: ExtensionSlotValueSchema,
28608
+ sources: array(ExtensionSlotSourceSchema)
28609
+ }), object({
28610
+ state: literal("unreachable"),
28611
+ addonId: string(),
28612
+ reason: string()
28613
+ })]);
28614
+ var ExtensionCandidatesSchema = object({ candidates: array(object({
28615
+ deviceId: number().int(),
28616
+ name: string(),
28617
+ type: string(),
28618
+ location: string().nullable(),
28619
+ /** The container a child belongs to — "Spotlight 2" alone does not say which. */
28620
+ parentName: string().nullable(),
28621
+ /** Pre-marked by the owner's suggestion rule. NEVER saved on its own (D356). */
28622
+ suggested: boolean(),
28623
+ /** Why it is suggested ("same location"), null when it is not. */
28624
+ reason: string().nullable()
28625
+ })) });
28626
+ /**
28627
+ * What a write did. `none` — applied in place. `host` / `parent` — the owner
28628
+ * reloaded the host (or, for an accessory child, its parent) because the
28629
+ * write changed what the host REGISTERS (a graft switched on or off, slice 2).
28630
+ */
28631
+ var ExtensionSetResultSchema = object({
28632
+ applied: literal(true),
28633
+ reload: _enum([
28634
+ "none",
28635
+ "host",
28636
+ "parent"
28637
+ ])
28638
+ });
28639
+ var ExtensionSlotRefInputSchema = object({
28640
+ deviceId: number().int(),
28641
+ slotRef: string().min(1)
28642
+ });
28643
+ var ExtensionSetSlotInputSchema = ExtensionSlotRefInputSchema.extend({ value: ExtensionSlotValueSchema });
28644
+ method(object({ deviceId: number().int() }), array(ExtensionSourceSchema)), method(object({ deviceId: number().int() }), array(ExtensionSlotRowSchema)), method(ExtensionSlotRefInputSchema, ExtensionCandidatesSchema), method(ExtensionSetSlotInputSchema, ExtensionSetResultSchema, {
28645
+ kind: "mutation",
28646
+ auth: "admin"
28647
+ });
28648
+ /**
27765
28649
  * Optional client-side hints sent at session creation to help the provider
27766
28650
  * pick the best native source. All fields optional — a viewer that knows
27767
28651
  * nothing still gets a sane default. (Relocated from the retired `webrtc`
@@ -30211,75 +31095,6 @@ onStatusChanged: { data: object({
30211
31095
  volatileStateFields: ["lastChangedAt"]
30212
31096
  };
30213
31097
  /**
30214
- * Doorbell button cap. Two kinds of providers coexist behind this cap
30215
- * name (same pattern as `snapshot`):
30216
- *
30217
- * - **Native** providers: registered per-device by device-driver
30218
- * addons via `ctx.registerNativeCap` — either on a
30219
- * `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
30220
- * or directly on the camera (Reolink registers at camera level).
30221
- * Emits an `onPressed` event every time the firmware pushes a
30222
- * ring; status tracks the last press and a pressCount since start
30223
- * (diagnostic).
30224
- *
30225
- * - **Wrapper** provider: the `virtual-doorbell` system builtin
30226
- * (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
30227
- * device (contact / switch / event-emitter …) into a doorbell for
30228
- * a camera. `defaultActive: false` — the operator explicitly binds
30229
- * it per camera in the device-bindings UI, then picks the source
30230
- * device + trigger in the per-device settings.
30231
- *
30232
- * The DeviceEventPropagator re-emits `onPressed` on the camera parent
30233
- * — subscribers listening at the camera level receive ring events
30234
- * with `via[]` populated. No code on the parent needed.
30235
- */
30236
- var DoorbellStatusSchema = object({
30237
- /** Ms epoch of the last press. null = never observed since this provider started. */
30238
- lastPressedAt: number().nullable(),
30239
- /** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
30240
- pressCountSinceStart: number()
30241
- });
30242
- var DoorbellPressEventSchema = object({
30243
- deviceId: number(),
30244
- timestamp: number()
30245
- });
30246
- var doorbellCapability = {
30247
- name: "doorbell",
30248
- scope: "device",
30249
- deviceNative: true,
30250
- mode: "singleton",
30251
- kind: "wrapper",
30252
- defaultActive: false,
30253
- deviceTypes: [DeviceType.Button, DeviceType.Camera],
30254
- exposesDeviceSettings: true,
30255
- methods: {},
30256
- events: {
30257
- /**
30258
- * Fires once per physical press. Reolink delivers via Baichuan
30259
- * push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
30260
- * release/duration — it's a pulse.
30261
- */
30262
- onPressed: { data: DoorbellPressEventSchema } },
30263
- status: {
30264
- schema: DoorbellStatusSchema,
30265
- kind: "push"
30266
- },
30267
- /**
30268
- * Runtime-state slice — last press timestamp + lifetime press count.
30269
- * Mirrored by the kernel and readable via
30270
- * `device.state.doorbell.value`. UIs can show "last ring 5m ago"
30271
- * without subscribing.
30272
- */
30273
- runtimeState: DoorbellStatusSchema,
30274
- /**
30275
- * 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.
30276
- *
30277
- * See `RuntimeStateDurability`. Enforced by
30278
- * `scripts/check-runtime-state-durability.ts`.
30279
- */
30280
- durability: "restored"
30281
- };
30282
- /**
30283
31098
  * Enum-state sensor — a string value picked from a finite option set.
30284
31099
  * Drives HA `sensor` entries with `state_class: enum` (HVAC action
30285
31100
  * states, weather conditions, contact-source channels, mode strings).
@@ -34393,7 +35208,7 @@ var HardwareInfoSchema = object({
34393
35208
  coral: CoralInfoSchema.nullable().optional()
34394
35209
  });
34395
35210
  var PlatformScoreSchema = object({
34396
- runtime: _enum(["node", "python"]),
35211
+ runtime: literal("python"),
34397
35212
  backend: string(),
34398
35213
  format: _enum([
34399
35214
  "onnx",
@@ -34430,7 +35245,7 @@ var ModelRequirementSchema = object({
34430
35245
  });
34431
35246
  var ResolvedInferenceConfigSchema = object({
34432
35247
  modelId: string(),
34433
- runtime: _enum(["node", "python"]),
35248
+ runtime: literal("python"),
34434
35249
  backend: string(),
34435
35250
  format: ModelFormatSchema,
34436
35251
  reason: string()
@@ -37025,6 +37840,92 @@ var sceneMonitorCapability = {
37025
37840
  durability: "session"
37026
37841
  };
37027
37842
  /**
37843
+ * Per-stage gating mode applied to the zones a rule references.
37844
+ *
37845
+ * - `include`: the rule contributes to a **whitelist** for its stage.
37846
+ * When at least one `include` rule fires for a stage, only entities
37847
+ * inside one of those zones pass that stage.
37848
+ * - `exclude`: the rule contributes to a **blacklist** for its stage.
37849
+ * Entities inside one of those zones are dropped at that stage.
37850
+ *
37851
+ * `monitor`-style observation (count without filtering) is not a rule
37852
+ * mode — zones without any matching rule are observed naturally by
37853
+ * `zone-analytics` (live snapshot + history), so an "I just want to
37854
+ * count, not filter" use case needs no rule at all.
37855
+ */
37856
+ var ZoneRuleModeEnum = _enum(["include", "exclude"]);
37857
+ /**
37858
+ * Per-consumer rule that references existing zones (geometry) and
37859
+ * defines how a specific pipeline stage should treat them. Each
37860
+ * consumer addon owns its own `ZoneRule[]` array in its per-device
37861
+ * settings:
37862
+ *
37863
+ * - `addon-motion-wasm` → `motionZoneRules: ZoneRule[]` (motion stage)
37864
+ * - `addon-detection-pipeline` → `detectionZoneRules: ZoneRule[]` (detection stage)
37865
+ * - future: notification rules, audio gating, etc.
37866
+ *
37867
+ * One rule applies to N zones (`zoneIds[]`) so the operator can
37868
+ * express "ignore motion in ALL of {garden, street}" with a single
37869
+ * rule. `classFilter` narrows the rule to specific object classes —
37870
+ * "drop person detections in the street, but keep cars" is one
37871
+ * `exclude` rule with `classFilter: ['person']`.
37872
+ *
37873
+ * `enabled` is a soft toggle — the operator can keep the rule
37874
+ * configured but inert without deleting it.
37875
+ */
37876
+ var ZoneRuleSchema = object({
37877
+ /** Stable rule id — survives edits, used by the UI for diffing. */
37878
+ id: string(),
37879
+ /** Optional human-readable label rendered in the rule editor. */
37880
+ name: string().optional(),
37881
+ /** Zones this rule targets. The rule's `mode` applies to ALL
37882
+ * listed zones (OR-set: a detection in any one of them counts).
37883
+ * At least one zone id required — a rule with no targets is a
37884
+ * configuration mistake and the form validator rejects it. */
37885
+ zoneIds: array(string()).min(1).readonly(),
37886
+ mode: ZoneRuleModeEnum,
37887
+ /**
37888
+ * Class names this rule applies to. Empty / undefined ⇒ rule
37889
+ * applies to every class. Class strings match the `macroClass`
37890
+ * field on detections (e.g. `person`, `car`, `dog`).
37891
+ */
37892
+ classFilter: array(string()).readonly().optional(),
37893
+ /**
37894
+ * Minimum bbox/mask overlap (0–1) with any of the rule's zones
37895
+ * required to consider an entity "in the zone". Defaults to the
37896
+ * consumer's stage default when omitted. Kept for back-compat with
37897
+ * existing per-rule overrides; new operators pick the value via
37898
+ * `bboxInclusionPct` (operator-friendly 0–100). Whichever field is
37899
+ * set, the lower-level engine reads it as a 0–1 fraction.
37900
+ */
37901
+ overlapThreshold: number().min(0).max(1).optional(),
37902
+ /**
37903
+ * Operator-friendly version of `overlapThreshold` — the percentage
37904
+ * of the detection's bbox that must lie inside the zone for the
37905
+ * rule to match. Documented default is 85%; the engine substitutes
37906
+ * that when the field is omitted (kept optional so existing rules
37907
+ * stored without it stay valid).
37908
+ *
37909
+ * When BOTH `overlapThreshold` and `bboxInclusionPct` are set on a
37910
+ * rule, the engine prefers `bboxInclusionPct` because it's the
37911
+ * field exposed in the UI. Internally both feed the same gate.
37912
+ */
37913
+ bboxInclusionPct: number().min(0).max(100).optional(),
37914
+ /**
37915
+ * When `true` and a detection has a segmentation mask, use the
37916
+ * mask for overlap instead of the bbox. Detection-stage only;
37917
+ * motion rules ignore this field.
37918
+ */
37919
+ preferMask: boolean().optional(),
37920
+ /**
37921
+ * Soft-toggle: `false` disables the rule without deleting it.
37922
+ * Defaults to `true` so operators creating a rule via the UI
37923
+ * see it active immediately.
37924
+ */
37925
+ enabled: boolean().default(true)
37926
+ });
37927
+ array(ZoneRuleSchema).readonly();
37928
+ /**
37028
37929
  * Script-runner cap. Models HA `script.*` entities on
37029
37930
  * `DeviceType.Script`. A Script is a pre-recorded action sequence
37030
37931
  * that can be invoked imperatively — optionally with a variables
@@ -39081,146 +39982,6 @@ function readDeviceStateFrom(runtimeState) {
39081
39982
  }
39082
39983
  }
39083
39984
  /**
39084
- * LA tabella "quale booleano di questo tipo di device conta come ALTO", e il
39085
- * valutatore puro del suo FRONTE.
39086
- *
39087
- * Viveva dentro il builtin virtual-doorbell
39088
- * (`@camstack/system` — `builtins/doorbell/trigger-engine.ts`) e i suoi
39089
- * predicati erano privati al modulo. Il recorder ne ha bisogno per il trigger
39090
- * `RecordingTriggers.sensorDeviceIds`: copiarla avrebbe creato la SECONDA
39091
- * tabella, che diverge alla prima cap aggiunta e il cui sintomo — "il sensore
39092
- * fa suonare il campanello ma non registra" — è esattamente D62. Quindi si
39093
- * SPOSTA qui e il doorbell la ri-esporta.
39094
- *
39095
- * ⚠ NON è `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), e le
39096
- * due non vanno unificate: quella risponde a "qual è la PAROLA di stato per una
39097
- * regola" (e include `presence`, `cover`, `alarm-panel`), questa a "qual è il
39098
- * booleano il cui FRONTE conta". Vocabolari deliberatamente diversi.
39099
- */
39100
- /**
39101
- * Known binary / switch source caps → the boolean slice field whose
39102
- * false→true rise counts as ACTIVE. Every entry is "fire on active".
39103
- * Sensors whose "active" reading is not a plain boolean (presence's string
39104
- * state, connectivity's connected flag) are deliberately excluded — a
39105
- * reconnect is not a doorbell press, and it is not a recording either.
39106
- */
39107
- var SOURCE_CAP_ACTIVE_FIELD = {
39108
- contact: "entryOpen",
39109
- binary: "on",
39110
- switch: "on",
39111
- motion: "detected",
39112
- flood: "flooded",
39113
- gas: "detected",
39114
- smoke: "detected",
39115
- "carbon-monoxide": "detected",
39116
- vibration: "detected",
39117
- tamper: "tampered"
39118
- };
39119
- /**
39120
- * The same caps → the slice field carrying the ms-epoch timestamp of the
39121
- * last transition. Every source cap MUST appear here (guarded by a spec):
39122
- * without a transition timestamp the evaluator cannot tell a genuine rise
39123
- * from a boot-time hydration when the FIRST slice it ever sees is already
39124
- * active, and errs towards silence — swallowing the rise.
39125
- *
39126
- * These timestamps are UPSTREAM ones, not ingest ones: the Home Assistant
39127
- * provider derives them from `state.last_changed`, so they survive our own
39128
- * restarts and correctly read as "hours ago" for a state that has been
39129
- * active for hours. `motion` names its rise timestamp `lastDetectedAt`.
39130
- */
39131
- var SOURCE_CAP_CHANGED_AT_FIELD = {
39132
- contact: "lastChangedAt",
39133
- binary: "lastChangedAt",
39134
- switch: "lastChangedAt",
39135
- motion: "lastDetectedAt",
39136
- flood: "lastChangedAt",
39137
- gas: "lastChangedAt",
39138
- smoke: "lastChangedAt",
39139
- "carbon-monoxide": "lastChangedAt",
39140
- vibration: "lastChangedAt",
39141
- tamper: "lastChangedAt"
39142
- };
39143
- /** True when a cap is a recognised binary/switch source. */
39144
- function isSourceCap(capName) {
39145
- return Object.prototype.hasOwnProperty.call(SOURCE_CAP_ACTIVE_FIELD, capName);
39146
- }
39147
- /** Extract the "active" boolean a source cap's slice carries, or null when
39148
- * the cap is unknown or the field is missing / non-boolean. */
39149
- function sliceActiveValue(capName, slice) {
39150
- const field = SOURCE_CAP_ACTIVE_FIELD[capName];
39151
- if (field === void 0) return null;
39152
- const raw = slice[field];
39153
- return typeof raw === "boolean" ? raw : null;
39154
- }
39155
- /** Ms-epoch transition timestamp a source cap's slice carries, or null when
39156
- * it is absent, non-numeric or the zero "never observed" sentinel. */
39157
- function sliceChangedAt(capName, slice) {
39158
- const field = SOURCE_CAP_CHANGED_AT_FIELD[capName];
39159
- if (field === void 0) return null;
39160
- const raw = slice[field];
39161
- if (typeof raw !== "number" || !Number.isFinite(raw) || raw <= 0) return null;
39162
- return raw;
39163
- }
39164
- /**
39165
- * How recent a source's own transition timestamp must be for a FIRST
39166
- * sighting that is already active to count as a genuine rise rather than a
39167
- * hydration of long-standing state.
39168
- */
39169
- var DEFAULT_FIRST_SIGHTING_FRESHNESS_MS = 3e4;
39170
- /**
39171
- * IL fronte. Puro: nessun orologio proprio, nessuna memoria — il chiamante
39172
- * porta `prior`, `nowMs` e il proprio `startedAtMs`.
39173
- *
39174
- * Il caso della PRIMA slice già attiva è trattato esplicitamente e vale come
39175
- * fronte solo se il timestamp UPSTREAM della transizione è posteriore a
39176
- * `startedAtMs` **e** entro `firstSightingFreshnessMs`. Entrambe le metà
39177
- * servono: la sola freschezza scatterebbe su un'idratazione al boot di uno
39178
- * stato flippato pochi secondi prima del riavvio, e il solo "dopo che abbiamo
39179
- * iniziato" scatterebbe, su un processo di lunga vita, per una sorgente
39180
- * adottata oggi il cui stato è cambiato ieri. Il caso ambiguo ERRA VERSO IL
39181
- * SILENZIO e lo dichiara (`baseline-seeded-stale-active`).
39182
- */
39183
- function evaluateSensorEdge(input) {
39184
- const value = sliceActiveValue(input.capName, input.slice);
39185
- if (value === null) return {
39186
- edge: "none",
39187
- value: null,
39188
- reason: isSourceCap(input.capName) ? "non-boolean-value" : "unknown-cap"
39189
- };
39190
- if (input.prior === void 0) {
39191
- if (!value) return {
39192
- edge: "none",
39193
- value,
39194
- reason: "baseline-seeded-inactive"
39195
- };
39196
- const changedAt = sliceChangedAt(input.capName, input.slice);
39197
- const floor = Math.max(input.startedAtMs, input.nowMs - input.firstSightingFreshnessMs);
39198
- if (changedAt === null || changedAt < floor) return {
39199
- edge: "none",
39200
- value,
39201
- reason: "baseline-seeded-stale-active"
39202
- };
39203
- return {
39204
- edge: "rising",
39205
- value: true
39206
- };
39207
- }
39208
- if (input.prior === value) return {
39209
- edge: "none",
39210
- value,
39211
- reason: "no-change"
39212
- };
39213
- if (!value) return {
39214
- edge: "none",
39215
- value,
39216
- reason: "falling-edge"
39217
- };
39218
- return {
39219
- edge: "rising",
39220
- value: true
39221
- };
39222
- }
39223
- /**
39224
39985
  * Accessory device helpers — shared across drivers.
39225
39986
  *
39226
39987
  * Many vendor-specific drivers register accessory child devices on
@@ -43060,6 +43821,30 @@ Object.freeze({
43060
43821
  addonId: null,
43061
43822
  access: "create"
43062
43823
  },
43824
+ "deviceExtension.listCandidates": {
43825
+ capName: "device-extension",
43826
+ capScope: "device",
43827
+ addonId: null,
43828
+ access: "view"
43829
+ },
43830
+ "deviceExtension.listSlots": {
43831
+ capName: "device-extension",
43832
+ capScope: "device",
43833
+ addonId: null,
43834
+ access: "view"
43835
+ },
43836
+ "deviceExtension.listSources": {
43837
+ capName: "device-extension",
43838
+ capScope: "device",
43839
+ addonId: null,
43840
+ access: "view"
43841
+ },
43842
+ "deviceExtension.setSlot": {
43843
+ capName: "device-extension",
43844
+ capScope: "device",
43845
+ addonId: null,
43846
+ access: "create"
43847
+ },
43063
43848
  "deviceManager.addLocation": {
43064
43849
  capName: "device-manager",
43065
43850
  capScope: "system",
@@ -43810,6 +44595,12 @@ Object.freeze({
43810
44595
  addonId: null,
43811
44596
  access: "view"
43812
44597
  },
44598
+ "embeddingEncoder.resetFailedModels": {
44599
+ capName: "embedding-encoder",
44600
+ capScope: "system",
44601
+ addonId: null,
44602
+ access: "delete"
44603
+ },
43813
44604
  "enumSensor.getStatus": {
43814
44605
  capName: "enum-sensor",
43815
44606
  capScope: "device",
@@ -45196,6 +45987,12 @@ Object.freeze({
45196
45987
  addonId: null,
45197
45988
  access: "view"
45198
45989
  },
45990
+ "notificationRules.previewStateSummary": {
45991
+ capName: "notification-rules",
45992
+ capScope: "system",
45993
+ addonId: null,
45994
+ access: "view"
45995
+ },
45199
45996
  "notificationRules.previewTemplate": {
45200
45997
  capName: "notification-rules",
45201
45998
  capScope: "system",
@@ -45772,12 +46569,6 @@ Object.freeze({
45772
46569
  addonId: null,
45773
46570
  access: "create"
45774
46571
  },
45775
- "pipelineAnalytics.runReplayFrameProcessor": {
45776
- capName: "pipeline-analytics",
45777
- capScope: "device",
45778
- addonId: null,
45779
- access: "create"
45780
- },
45781
46572
  "pipelineAnalytics.saveRetrainAnnotations": {
45782
46573
  capName: "pipeline-analytics",
45783
46574
  capScope: "device",
@@ -46144,6 +46935,12 @@ Object.freeze({
46144
46935
  addonId: null,
46145
46936
  access: "view"
46146
46937
  },
46938
+ "pipelineOrchestrator.getClusterModelChoice": {
46939
+ capName: "pipeline-orchestrator",
46940
+ capScope: "system",
46941
+ addonId: null,
46942
+ access: "view"
46943
+ },
46147
46944
  "pipelineOrchestrator.getDeviceLiveContribution": {
46148
46945
  capName: "pipeline-orchestrator",
46149
46946
  capScope: "system",
@@ -48969,6 +49766,26 @@ Object.freeze({
48969
49766
  form: "single",
48970
49767
  optional: false
48971
49768
  }],
49769
+ "deviceExtension.listCandidates": [{
49770
+ name: "deviceId",
49771
+ form: "single",
49772
+ optional: false
49773
+ }],
49774
+ "deviceExtension.listSlots": [{
49775
+ name: "deviceId",
49776
+ form: "single",
49777
+ optional: false
49778
+ }],
49779
+ "deviceExtension.listSources": [{
49780
+ name: "deviceId",
49781
+ form: "single",
49782
+ optional: false
49783
+ }],
49784
+ "deviceExtension.setSlot": [{
49785
+ name: "deviceId",
49786
+ form: "single",
49787
+ optional: false
49788
+ }],
48972
49789
  "deviceManager.adoptionRelease": [{
48973
49790
  name: "camDeviceId",
48974
49791
  form: "single",
@@ -49875,11 +50692,6 @@ Object.freeze({
49875
50692
  form: "single",
49876
50693
  optional: false
49877
50694
  }],
49878
- "pipelineAnalytics.runReplayFrameProcessor": [{
49879
- name: "deviceId",
49880
- form: "single",
49881
- optional: false
49882
- }],
49883
50695
  "pipelineAnalytics.saveRetrainAnnotations": [{
49884
50696
  name: "deviceId",
49885
50697
  form: "single",
@@ -50917,7 +51729,8 @@ var NC_SYSTEM_EVENT_FAMILY = {
50917
51729
  "camera-disabled": null,
50918
51730
  "camera-enabled": null
50919
51731
  };
50920
- new Map(Object.entries(NC_SYSTEM_EVENT_FAMILY));
51732
+ /** Read by NAME, for kinds that arrive as plain strings (a newer hub, the viewer's mirror). */
51733
+ var FAMILY_BY_NAME = new Map(Object.entries(NC_SYSTEM_EVENT_FAMILY));
50921
51734
  var NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS = [...NC_SYSTEM_EVENT_FILTER_KEYS, "excludeDeviceIds"];
50922
51735
  /**
50923
51736
  * The filters a family may carry. The base filters are the union of
@@ -51028,6 +51841,24 @@ function systemEventKindsOfFamily(family) {
51028
51841
  return NC_SYSTEM_EVENT_KIND_GROUP_SPECS.filter((g) => g.family === family).flatMap((g) => g.kinds);
51029
51842
  }
51030
51843
  /**
51844
+ * One family, or `mixed`. Mixed covers kinds that span families, a legacy kind,
51845
+ * a kind this build does not know (it fails toward read-only and never toward
51846
+ * editable), and an empty selection (nothing to decide on).
51847
+ */
51848
+ function systemEventFamilyOf(kindNames) {
51849
+ const families = /* @__PURE__ */ new Set();
51850
+ for (const name of kindNames) {
51851
+ const family = FAMILY_BY_NAME.get(name);
51852
+ if (family === void 0 || family === null) return { kind: "mixed" };
51853
+ families.add(family);
51854
+ }
51855
+ const [only] = [...families];
51856
+ return families.size === 1 && only !== void 0 ? {
51857
+ kind: "family",
51858
+ family: only
51859
+ } : { kind: "mixed" };
51860
+ }
51861
+ /**
51031
51862
  * Why the hub refuses this condition on a new or updated rule. Empty = accepted.
51032
51863
  * Families are reported in `NC_SYSTEM_EVENT_FAMILIES` order, and filters in
51033
51864
  * `NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS` order, so a refusal reads the same
@@ -51103,18 +51934,38 @@ var WEEKDAY_TO_DAY = {
51103
51934
  Fri: 5,
51104
51935
  Sat: 6
51105
51936
  };
51106
- /** Resolve (weekday, minute-of-day) of `atMs` in the schedule's timezone.
51107
- * An invalid/unknown IANA name falls back to the host timezone. */
51108
- function localDayMinute(atMs, timezone) {
51109
- const d = new Date(atMs);
51110
- if (timezone !== void 0) try {
51111
- const parts = new Intl.DateTimeFormat("en-US", {
51937
+ /**
51938
+ * One formatter per timezone, built once (D647 review I4). Constructing an
51939
+ * `Intl.DateTimeFormat` is the expensive part of this function, and a caller
51940
+ * that asks about many instants — a window scan — used to build one per
51941
+ * instant. `null` = an invalid IANA name (the host timezone is used).
51942
+ */
51943
+ var FORMATTERS = /* @__PURE__ */ new Map();
51944
+ function formatterFor(timezone) {
51945
+ const held = FORMATTERS.get(timezone);
51946
+ if (held !== void 0) return held;
51947
+ let made;
51948
+ try {
51949
+ made = new Intl.DateTimeFormat("en-US", {
51112
51950
  timeZone: timezone,
51113
51951
  weekday: "short",
51114
51952
  hour: "numeric",
51115
51953
  minute: "numeric",
51116
51954
  hourCycle: "h23"
51117
- }).formatToParts(d);
51955
+ });
51956
+ } catch {
51957
+ made = null;
51958
+ }
51959
+ FORMATTERS.set(timezone, made);
51960
+ return made;
51961
+ }
51962
+ /** Resolve (weekday, minute-of-day) of `atMs` in the schedule's timezone.
51963
+ * An invalid/unknown IANA name falls back to the host timezone. */
51964
+ function localDayMinute(atMs, timezone) {
51965
+ const d = new Date(atMs);
51966
+ const formatter = timezone !== void 0 ? formatterFor(timezone) : null;
51967
+ if (formatter !== null) try {
51968
+ const parts = formatter.formatToParts(d);
51118
51969
  let weekday;
51119
51970
  let hour;
51120
51971
  let minute;
@@ -51254,6 +52105,119 @@ var DEVICE_EVENTS = [
51254
52105
  "detection-blind",
51255
52106
  ...ALARM
51256
52107
  ];
52108
+ /** Every kind a summary may speak about — the two summarisable families. */
52109
+ var SUMMARISABLE = [...systemEventKindsOfFamily("device-events"), ...systemEventKindsOfFamily("system")];
52110
+ /** One per summary SECTION (`NC_STATE_SUMMARY_SECTIONS` in the notification
52111
+ * centre): the section's lines, offered when one of its kinds is selected. */
52112
+ var STATE_SUMMARY_SECTION_VARS = [
52113
+ {
52114
+ name: "summaryDevices",
52115
+ label: "Summary: devices offline / switched off",
52116
+ example: "Garage — offline since 07:12",
52117
+ kinds: [
52118
+ "device-offline",
52119
+ "device-online",
52120
+ "device-disabled",
52121
+ "device-enabled"
52122
+ ]
52123
+ },
52124
+ {
52125
+ name: "summaryStreams",
52126
+ label: "Summary: streams offline",
52127
+ example: "Ingresso (high) — since 06:40",
52128
+ kinds: ["stream-offline", "stream-online"]
52129
+ },
52130
+ {
52131
+ name: "summaryBattery",
52132
+ label: "Summary: low batteries",
52133
+ example: "Sensore porta — 8 %",
52134
+ kinds: BATTERY
52135
+ },
52136
+ {
52137
+ name: "summaryConsumables",
52138
+ label: "Summary: consumables",
52139
+ example: "Robot — filter 10 %",
52140
+ kinds: CONSUMABLE
52141
+ },
52142
+ {
52143
+ name: "summaryTanks",
52144
+ label: "Summary: tanks",
52145
+ example: "Robot — clean water low",
52146
+ kinds: TANK
52147
+ },
52148
+ {
52149
+ name: "summaryDetection",
52150
+ label: "Summary: cameras detecting nothing",
52151
+ example: "Ingresso — since 05:10",
52152
+ kinds: ["detection-blind"]
52153
+ },
52154
+ {
52155
+ name: "summaryNodes",
52156
+ label: "Summary: nodes",
52157
+ example: "little-unraid — offline since 03:00",
52158
+ kinds: [
52159
+ "node-offline",
52160
+ "node-online",
52161
+ "node-inference-unavailable"
52162
+ ]
52163
+ },
52164
+ {
52165
+ name: "summaryAddons",
52166
+ label: "Summary: addons",
52167
+ example: "@camstack/addon-recorder 1.2.3 → 1.2.4",
52168
+ kinds: [
52169
+ "addon-crash-loop",
52170
+ "addon-update-available",
52171
+ "addon-updated"
52172
+ ]
52173
+ },
52174
+ {
52175
+ name: "summaryUpdates",
52176
+ label: "Summary: server & container updates",
52177
+ example: "server 1.2.377 → 1.2.378",
52178
+ kinds: [
52179
+ "server-update-available",
52180
+ "server-updated",
52181
+ "wrapper-update-available"
52182
+ ]
52183
+ }
52184
+ ];
52185
+ var STATE_SUMMARY_VARS = [
52186
+ {
52187
+ name: "summaryText",
52188
+ label: "Summary: every section",
52189
+ description: "One block per section with something to report, one line per item.",
52190
+ example: "Batterie scariche: Sensore porta — 8 %",
52191
+ group: "system",
52192
+ families: ["rule"],
52193
+ fields: [...RULE_TEXT],
52194
+ kinds: ["system"],
52195
+ systemEventKinds: [...SUMMARISABLE],
52196
+ systemEventDeliveries: ["summary"]
52197
+ },
52198
+ {
52199
+ name: "summaryCount",
52200
+ label: "Summary: items reported",
52201
+ example: "3",
52202
+ group: "system",
52203
+ families: ["rule"],
52204
+ fields: [...RULE_TEXT],
52205
+ kinds: ["system"],
52206
+ systemEventKinds: [...SUMMARISABLE],
52207
+ systemEventDeliveries: ["summary"]
52208
+ },
52209
+ ...STATE_SUMMARY_SECTION_VARS.map((v) => ({
52210
+ name: v.name,
52211
+ label: v.label,
52212
+ example: v.example,
52213
+ group: "system",
52214
+ families: ["rule"],
52215
+ fields: [...RULE_TEXT],
52216
+ kinds: ["system"],
52217
+ systemEventKinds: [...v.kinds],
52218
+ systemEventDeliveries: ["summary"]
52219
+ }))
52220
+ ];
51257
52221
  var NC_TEMPLATE_VARS = [
51258
52222
  {
51259
52223
  name: "camera",
@@ -51504,7 +52468,8 @@ var NC_TEMPLATE_VARS = [
51504
52468
  group: "system",
51505
52469
  families: ["rule"],
51506
52470
  fields: [...RULE_TEXT],
51507
- kinds: ["system"]
52471
+ kinds: ["system"],
52472
+ systemEventDeliveries: ["instant"]
51508
52473
  },
51509
52474
  {
51510
52475
  name: "deviceName",
@@ -51947,7 +52912,8 @@ var NC_TEMPLATE_VARS = [
51947
52912
  group: "digest",
51948
52913
  families: ["summary"],
51949
52914
  fields: [...RULE_TEXT]
51950
- }
52915
+ },
52916
+ ...STATE_SUMMARY_VARS
51951
52917
  ];
51952
52918
  /**
51953
52919
  * System-event kinds the SERVED catalog holds back (D642): the kinds the hub
@@ -51976,11 +52942,32 @@ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
51976
52942
  * rule an installed viewer can author, which is exactly true.
51977
52943
  */
51978
52944
  function servedTemplateVars() {
51979
- return NC_TEMPLATE_VARS.map((d) => d.systemEventKinds === void 0 ? d : {
52945
+ return NC_TEMPLATE_VARS.filter((d) => !isHeldBackTemplateVar(d)).map((d) => d.systemEventKinds === void 0 ? d : {
51980
52946
  ...d,
51981
52947
  systemEventKinds: d.systemEventKinds.filter((kind) => !NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS.includes(kind))
51982
52948
  });
51983
52949
  }
52950
+ /**
52951
+ * Is this descriptor held back from the SERVED catalog as a whole (D647)?
52952
+ * A summary-only variable is: an installed viewer does not read the delivery
52953
+ * axis, and would offer it on every instant system rule. The admin, built
52954
+ * from the workspace, restores it from its own `NC_TEMPLATE_VARS`.
52955
+ */
52956
+ function isHeldBackTemplateVar(d) {
52957
+ return d.systemEventDeliveries !== void 0 && !d.systemEventDeliveries.includes("instant");
52958
+ }
52959
+ /**
52960
+ * Does a descriptor have a value on a system rule of this DELIVERY (D647)?
52961
+ * Read only for a system rule kind. An absent axis is `instant` for a
52962
+ * descriptor that names `systemEventKinds` (a per-event fact: a summary row
52963
+ * has no one device, node or package) and BOTH for one that does not
52964
+ * (`{{rule}}`, `{{time}}`).
52965
+ */
52966
+ function templateVarDeliveryApplies(d, ctx) {
52967
+ if (!isSystemRuleKind(ctx.kind)) return true;
52968
+ const mode = ctx.systemEventDelivery ?? "instant";
52969
+ return (d.systemEventDeliveries ?? (d.systemEventKinds !== void 0 ? ["instant"] : [mode])).includes(mode);
52970
+ }
51984
52971
  /** The caption fields see a fixed, smaller vocabulary (`timelapsePreviewText`,
51985
52972
  * `summaryCaptionText`). Declared here rather than as `fields` on every
51986
52973
  * descriptor so the whole rule stays in one line of code. */
@@ -52045,12 +53032,82 @@ function templateVarsFor(ctx) {
52045
53032
  const allowed = CAPTION_VARS[ctx.field];
52046
53033
  return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && allowed.includes(d.name) && d.dynamic === void 0);
52047
53034
  }
52048
- return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && onAxis(d.fields, ctx.field) && templateVarKindApplies(d.kinds, ctx.kind) && onAxis(d.deliveries, ctx.delivery) && templateVarSystemEventApplies(d, ctx));
53035
+ return NC_TEMPLATE_VARS.filter((d) => d.families.includes(ctx.family) && onAxis(d.fields, ctx.field) && templateVarKindApplies(d.kinds, ctx.kind) && onAxis(d.deliveries, ctx.delivery) && templateVarSystemEventApplies(d, ctx) && templateVarDeliveryApplies(d, ctx));
52049
53036
  }
52050
53037
  /** True when `name` is supplied in `ctx`, dynamic families (`count_<class>`) included. */
52051
53038
  function isKnownTemplateVar(name, ctx) {
52052
53039
  return templateVarsFor(ctx).some((d) => d.dynamic !== void 0 ? name.startsWith(d.dynamic.prefix) && name.length > d.dynamic.prefix.length : d.name === name);
52053
53040
  }
53041
+ /** The families a rule may summarise. The alarm is not one of them. */
53042
+ var NC_SYSTEM_EVENT_SUMMARY_FAMILIES = ["device-events", "system"];
53043
+ /** The summary's schedule, or `null` for any rule that is not a summary system rule. */
53044
+ function systemEventSummaryScheduleOf(rule) {
53045
+ if (!isSystemDelivery(rule.delivery)) return null;
53046
+ const delivery = rule.systemEventDelivery;
53047
+ return delivery?.mode === "summary" ? delivery.schedule : null;
53048
+ }
53049
+ /** Absent and `instant` are the same answer: a notification per event. */
53050
+ function isSystemEventSummaryRule(rule) {
53051
+ return systemEventSummaryScheduleOf(rule) !== null;
53052
+ }
53053
+ function actionsAreSet(actions) {
53054
+ return (actions?.onTrigger?.length ?? 0) > 0 || (actions?.buttons?.length ?? 0) > 0;
53055
+ }
53056
+ /**
53057
+ * Why the hub refuses this rule's delivery. Empty = accepted. An instant rule
53058
+ * (absent or `{ mode: 'instant' }`) is never refused here.
53059
+ *
53060
+ * Beside a summary, two fields are refused because they would do nothing:
53061
+ * the rule's own `schedule` (the summary's schedule is the send time; a second
53062
+ * active-hours gate would silently empty it) and `actions` (a summary is not a
53063
+ * match, so nothing would ever run them).
53064
+ */
53065
+ function systemEventDeliveryProblems(rule) {
53066
+ if (rule.systemEventDelivery?.mode !== "summary") return [];
53067
+ if (!isSystemDelivery(rule.delivery)) return [{
53068
+ code: "not-a-system-rule",
53069
+ delivery: rule.delivery
53070
+ }];
53071
+ const problems = [];
53072
+ const verdict = systemEventFamilyOf(rule.conditions.systemEvent?.kinds ?? []);
53073
+ const family = verdict.kind === "family" ? verdict.family : "mixed";
53074
+ if (family === "mixed" || !NC_SYSTEM_EVENT_SUMMARY_FAMILIES.includes(family)) problems.push({
53075
+ code: "family-not-summarisable",
53076
+ family
53077
+ });
53078
+ const windows = rule.systemEventDelivery.schedule.windows;
53079
+ if (windows.length === 0) problems.push({ code: "empty-schedule" });
53080
+ windows.forEach((window, index) => {
53081
+ if (window.days.length === 0 || window.startMinute === window.endMinute) problems.push({
53082
+ code: "degenerate-window",
53083
+ index
53084
+ });
53085
+ });
53086
+ if (rule.schedule !== void 0) problems.push({ code: "schedule-beside-summary" });
53087
+ if (actionsAreSet(rule.actions)) problems.push({ code: "actions-beside-summary" });
53088
+ return problems;
53089
+ }
53090
+ function describeSystemEventDeliveryProblem(problem) {
53091
+ switch (problem.code) {
53092
+ case "not-a-system-rule": return `a '${problem.delivery}' rule has no summary delivery — only device-events and system rules do`;
53093
+ case "family-not-summarisable": return problem.family === "alarm" ? "an alarm rule cannot be a scheduled summary — the alarm stays instant" : `a ${problem.family} rule cannot be a scheduled summary — only device-events and system rules`;
53094
+ case "degenerate-window": return `send time ${String(problem.index + 1)} has no day, or starts and ends on the same minute — it never closes, so nothing would be sent`;
53095
+ case "empty-schedule": return "a summary rule needs at least one send time — its schedule has no window";
53096
+ case "schedule-beside-summary": return "a summary rule is sent on its summary schedule — remove the active-hours schedule";
53097
+ case "actions-beside-summary": return "a summary rule never matches an event, so its actions would never run — remove them";
53098
+ }
53099
+ }
53100
+ var SUMMARY_CONTENT_VAR = /\{\{\s*summary(?:Text|Devices|Streams|Battery|Consumables|Tanks|Detection|Nodes|Addons|Updates)\s*\}\}/;
53101
+ /**
53102
+ * Does a custom BODY carry the summary's content (`{{summaryText}}` or a
53103
+ * section variable)? A body that does not would send a summary with nothing
53104
+ * in it; the hub then appends `{{summaryText}}` and the admin warns (review
53105
+ * M3). An absent or blank body uses the hub's own wording, which does.
53106
+ */
53107
+ function templateCarriesSummary(body) {
53108
+ if (body === void 0 || body.trim().length === 0) return true;
53109
+ return SUMMARY_CONTENT_VAR.test(body);
53110
+ }
52054
53111
  /**
52055
53112
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
52056
53113
  *
@@ -52351,169 +53408,6 @@ function readTimelapseGeneratedAt(rule, deviceId) {
52351
53408
  if (map !== void 0) return map[String(deviceId)] ?? 0;
52352
53409
  return rule.lastGeneratedAt ?? 0;
52353
53410
  }
52354
- /**
52355
- * A model choice has a SCOPE, and a scope change has a workflow.
52356
- *
52357
- * ## The two scopes
52358
- *
52359
- * Almost every pipeline step's model is a **node** question: which build runs
52360
- * fastest on THIS accelerator. Two nodes may legitimately answer differently —
52361
- * a Coral runs the tflite SSD, a Mac runs the coreml YOLO — because the answers
52362
- * are compared against nothing. They produce boxes, and a box is a box.
52363
- *
52364
- * Two steps are not like that. `face-embedding` and `clip-embedding` produce
52365
- * **vectors that land in ONE shared index** (`identity_samples`,
52366
- * `vec_object_clip`) and are ranked against each other by cosine similarity.
52367
- * Cosine similarity between two encoders is not a weak signal, it is a
52368
- * meaningless number — and nothing inside a vector can tell you it happened.
52369
- * So for those two steps the model is a **cluster** question with exactly one
52370
- * answer, stored in exactly one row.
52371
- *
52372
- * That is the same argument [D52](../../../../docs/decisions/adr-0052.md) makes
52373
- * for the crop convention (`detail-crop.ts`), one level up: the crop decides
52374
- * WHAT pixels the encoder sees, this decides WHICH encoder sees them. Both are
52375
- * cluster-wide for the same reason and neither may become per-node.
52376
- *
52377
- * ## Why the registry lives here and not in the step catalog
52378
- *
52379
- * The scope itself is declared on the step, in
52380
- * `detection-pipeline/registry/step-definitions.ts` (`StepDefinition.modelScope`)
52381
- * — that is where a new step declares what kind of choice its model is. But the
52382
- * catalog lives inside `addon-pipeline`, and three packages that must NOT
52383
- * import an addon need to know the set: the orchestrator (which renders and
52384
- * stores the row), post-analysis (which pins the row for a re-embed pass) and
52385
- * admin-ui (which mirrors it). So the set is mirrored here, and
52386
- * `scripts/check-cluster-model-scope.ts` fails the build when the two disagree.
52387
- * A hand-copied key that stops matching is exactly how a setting silently stops
52388
- * arriving while both sides still look correct.
52389
- *
52390
- * ## The defaults ARE today's behaviour
52391
- *
52392
- * {@link DEFAULT_CLUSTER_STEP_MODELS} reproduces the catalog `defaultModelId`
52393
- * of both steps. Declaring the scope therefore changes nothing on the day it
52394
- * ships: the cluster row starts out saying what every node was already doing.
52395
- * Changing it is legitimate — that is what the knob is for — but it invalidates
52396
- * the stored vectors of that surface, and must be followed by a re-embed pass
52397
- * (`face-reembed-pass.ts`, `embedding-rebuild.ts`).
52398
- */
52399
- /**
52400
- * The cluster-scoped steps. Mirrored from the catalog's `modelScope: 'cluster'`
52401
- * declarations and guarded by `scripts/check-cluster-model-scope.ts`.
52402
- */
52403
- var CLUSTER_MODEL_SCOPED_STEPS = [{
52404
- stepId: "face-embedding",
52405
- label: "Face recognition model",
52406
- defaultModelId: "arcface-r100",
52407
- indexName: "the enrolled face gallery",
52408
- options: [
52409
- {
52410
- id: "arcface-r100",
52411
- label: "ArcFace (ResNet34)"
52412
- },
52413
- {
52414
- id: "auraface-r100",
52415
- label: "AuraFace R100"
52416
- },
52417
- {
52418
- id: "inception-resnet-v1",
52419
- label: "Inception ResNet V1"
52420
- }
52421
- ]
52422
- }, {
52423
- stepId: "clip-embedding",
52424
- label: "Semantic search model",
52425
- defaultModelId: "mobileclip-s1",
52426
- indexName: "the object semantic-search index",
52427
- options: [{
52428
- id: "mobileclip-s1",
52429
- label: "MobileCLIP S1"
52430
- }, {
52431
- id: "mobileclip-s2",
52432
- label: "MobileCLIP S2"
52433
- }]
52434
- }];
52435
- /**
52436
- * The settings key holding one step's cluster model choice.
52437
- *
52438
- * Step-qualified so the keys stay unique across the addon's whole schema, which
52439
- * is what lets {@link pickClusterStepModels} walk every section instead of
52440
- * trusting the section id.
52441
- */
52442
- function clusterModelSettingKey(stepId) {
52443
- return `clusterModel:${stepId}`;
52444
- }
52445
- /** The cluster row when nobody has configured one — today's catalog defaults. */
52446
- var DEFAULT_CLUSTER_STEP_MODELS = Object.freeze(Object.fromEntries(CLUSTER_MODEL_SCOPED_STEPS.map((s) => [s.stepId, s.defaultModelId])));
52447
- /** A stored choice is a non-empty model id, or it is not a choice. */
52448
- var ChosenModelIdSchema = string().min(1);
52449
- /**
52450
- * Narrow a FLAT settings record to the cluster row.
52451
- *
52452
- * Per-FIELD fallback, deliberately (same rule as `readDetailCropConvention`): a
52453
- * junk face model must not also discard a valid clip model. An absent, empty or
52454
- * non-string value resolves to the step's catalog default — the historical
52455
- * behaviour — never to a blank id, because a blank id downstream becomes
52456
- * "substitute the format default", which is precisely the substitution this
52457
- * scope exists to forbid.
52458
- */
52459
- function readClusterStepModels(config) {
52460
- const out = {};
52461
- for (const step of CLUSTER_MODEL_SCOPED_STEPS) {
52462
- const parsed = ChosenModelIdSchema.safeParse(config[clusterModelSettingKey(step.stepId)]);
52463
- out[step.stepId] = parsed.success ? parsed.data : step.defaultModelId;
52464
- }
52465
- return out;
52466
- }
52467
- function isHydratedField$2(entry) {
52468
- return typeof entry === "object" && entry !== null && "key" in entry;
52469
- }
52470
- /**
52471
- * Extract the cluster row from an `addon-settings.getGlobalSettings` payload.
52472
- *
52473
- * Walks EVERY section rather than looking inside {@link CLUSTER_MODEL_SECTION_ID}
52474
- * alone: the keys are unique across the addon's schema, and a section rename
52475
- * must not silently revert the whole cluster to the defaults. A `null` payload
52476
- * (addon mid-boot) is the defaults.
52477
- */
52478
- function pickClusterStepModels(view) {
52479
- if (view === null) return DEFAULT_CLUSTER_STEP_MODELS;
52480
- const flat = {};
52481
- const wanted = new Set(CLUSTER_MODEL_SCOPED_STEPS.map((s) => clusterModelSettingKey(s.stepId)));
52482
- for (const section of view.sections) for (const entry of section.fields) {
52483
- if (!isHydratedField$2(entry) || typeof entry.key !== "string") continue;
52484
- if (wanted.has(entry.key)) flat[entry.key] = entry.value;
52485
- }
52486
- return readClusterStepModels(flat);
52487
- }
52488
- var CLUSTER_STEP_SETTING_FIELDS = [{
52489
- stepId: "face-embedding",
52490
- key: "minLandmarkFaceSize",
52491
- label: "Min face size for recognition (detection px)",
52492
- 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.",
52493
- type: "slider",
52494
- min: 0,
52495
- max: 64,
52496
- step: 2,
52497
- default: 24
52498
- }];
52499
- function clusterStepSettingKey(stepId, fieldKey) {
52500
- return `clusterStepSetting:${stepId}:${fieldKey}`;
52501
- }
52502
- var ClusterSettingNumberSchema = number().finite();
52503
- function readClusterStepSettings(config) {
52504
- const out = {};
52505
- for (const field of CLUSTER_STEP_SETTING_FIELDS) {
52506
- const parsed = ClusterSettingNumberSchema.safeParse(config[clusterStepSettingKey(field.stepId, field.key)]);
52507
- const value = parsed.success ? parsed.data : field.default;
52508
- const existing = out[field.stepId] ?? {};
52509
- out[field.stepId] = {
52510
- ...existing,
52511
- [field.key]: value
52512
- };
52513
- }
52514
- return out;
52515
- }
52516
- readClusterStepSettings({});
52517
53411
  object({
52518
53412
  /**
52519
53413
  * Fraction of the box's own size added on EACH side before cutting.
@@ -53055,6 +53949,397 @@ function vectorDimFromBase64(encoded) {
53055
53949
  return Math.floor(Buffer.from(encoded, "base64").byteLength / 4);
53056
53950
  }
53057
53951
  //#endregion
53952
+ //#region src/pipeline-analytics/cluster-model-pin.ts
53953
+ /**
53954
+ * Where a re-embed pass gets the model it pins.
53955
+ *
53956
+ * ## Why not `embeddingEncoder.getInfo`
53957
+ *
53958
+ * That is what the CLIP rebuild used, and it answers a subtly different
53959
+ * question: "which model is the encoder addon currently holding", not "which
53960
+ * model has the operator chosen for the cluster". The two agree until they do
53961
+ * not — an encoder mid-reload, a node that never picked up a change — and when
53962
+ * they disagree the pass writes a whole index in the wrong space with a status
53963
+ * line that looks fine. Since `face-embedding` and `clip-embedding` declare
53964
+ * `modelScope: 'cluster'`, there is now exactly one authority for each, and it
53965
+ * is a stored row rather than a live process's opinion.
53966
+ *
53967
+ * ## Why the read is not cached here
53968
+ *
53969
+ * A pass reads it ONCE, at the start, and pins that value for its whole run
53970
+ * (D54). A cache would only matter for a caller that re-read it mid-pass, which
53971
+ * is precisely the thing the pin exists to prevent — so there is nothing to
53972
+ * cache and the absence is deliberate.
53973
+ *
53974
+ * ## Why a failed read refuses instead of defaulting
53975
+ *
53976
+ * A pass that cannot name its model must not run. The previous CLIP path's
53977
+ * `?? 'unknown'` is the shipped version of the alternative: rows stamped with an
53978
+ * id nothing ran, in an index whose same-model gate then has nothing to reason
53979
+ * about.
53980
+ */
53981
+ /** The addon whose GLOBAL settings hold the cluster row. */
53982
+ var CLUSTER_MODEL_OWNER_ADDON_ID = "pipeline-orchestrator";
53983
+ /** The step ids this module can pin — the same two the catalog declares. */
53984
+ var FACE_EMBEDDING_STEP_ID = "face-embedding";
53985
+ var CLIP_EMBEDDING_STEP_ID = "clip-embedding";
53986
+ /**
53987
+ * The cluster row, or `null` when it could not be read.
53988
+ *
53989
+ * `null` and not "the defaults": a caller that cannot distinguish "the operator
53990
+ * chose arcface" from "I could not ask" will run a pass on a guess. The one
53991
+ * production caller turns `null` into a refusal to start.
53992
+ */
53993
+ async function readClusterModelRow(api, logger) {
53994
+ try {
53995
+ return pickClusterStepModels(await api.addonSettings.getGlobalSettings.query({ addonId: CLUSTER_MODEL_OWNER_ADDON_ID }));
53996
+ } catch (err) {
53997
+ logger.warn("cluster model row unreadable — a re-embed pass must not guess which encoder the operator chose", { meta: {
53998
+ owner: CLUSTER_MODEL_OWNER_ADDON_ID,
53999
+ error: err instanceof Error ? err.message : String(err)
54000
+ } });
54001
+ return null;
54002
+ }
54003
+ }
54004
+ /**
54005
+ * Pin one cluster-scoped step's model for a whole pass.
54006
+ *
54007
+ * Returns `null` on an unreadable row OR an unknown step id — both mean the
54008
+ * caller must not start, and folding them together is safe because the caller's
54009
+ * move is identical: refuse, loudly.
54010
+ */
54011
+ async function resolveClusterModelPin(api, stepId, logger) {
54012
+ if (!CLUSTER_MODEL_SCOPED_STEPS.some((s) => s.stepId === stepId)) {
54013
+ logger.warn("cluster model pin requested for a step that is not cluster-scoped", { meta: {
54014
+ stepId,
54015
+ clusterScoped: CLUSTER_MODEL_SCOPED_STEPS.map((s) => s.stepId)
54016
+ } });
54017
+ return null;
54018
+ }
54019
+ const row = await readClusterModelRow(api, logger);
54020
+ if (row === null) return null;
54021
+ const modelId = row[stepId];
54022
+ return modelId !== void 0 && modelId !== "" ? modelId : null;
54023
+ }
54024
+ /**
54025
+ * The error texts a cap call carries when the provider or the router has no
54026
+ * such method: the kernel's `Capability "…" has no method "…"`, tRPC's
54027
+ * `No procedure found on path`, and the forked-child hop's
54028
+ * `method '…' not found on provider '…'` (child-cap-dispatch.ts). NOT `is not a function`: that is any
54029
+ * `TypeError` thrown INSIDE the owner while it answers, and reading it as
54030
+ * "the owner predates the method" would file a bug in the owner under a
54031
+ * rolling-release reason nobody investigates.
54032
+ */
54033
+ var METHOD_UNAVAILABLE_FINGERPRINTS = [
54034
+ /has no method/i,
54035
+ /no procedure found/i,
54036
+ /method not found/i,
54037
+ /method '[^']*' not found on provider/i
54038
+ ];
54039
+ /**
54040
+ * The pin read for a pass that REWRITES an index (D651 fix rounds 1–3).
54041
+ *
54042
+ * Asks the OWNER. The orchestrator owns `clusterModel:*` and answers from a
54043
+ * three-way read of its own store, once its boot has settled
54044
+ * (`pipelineOrchestrator.getClusterModelChoice`). Never the hydrated view,
54045
+ * which answers `value ?? default`, and never the owner's private store
54046
+ * layout. Silent on purpose: the callers log state CHANGES.
54047
+ */
54048
+ async function readClusterModelPinStrict(api, stepId) {
54049
+ const method = api.pipelineOrchestrator?.getClusterModelChoice;
54050
+ if (method === void 0) return {
54051
+ kind: "unknown",
54052
+ reason: "method-unavailable"
54053
+ };
54054
+ let raw;
54055
+ try {
54056
+ raw = await method.query({ stepId });
54057
+ } catch (err) {
54058
+ const error = err instanceof Error ? err.message : String(err);
54059
+ return METHOD_UNAVAILABLE_FINGERPRINTS.some((re) => re.test(error)) ? {
54060
+ kind: "unknown",
54061
+ reason: "method-unavailable",
54062
+ error
54063
+ } : {
54064
+ kind: "unknown",
54065
+ reason: "read-failed",
54066
+ error
54067
+ };
54068
+ }
54069
+ if (raw === void 0) return {
54070
+ kind: "unknown",
54071
+ reason: "method-unavailable"
54072
+ };
54073
+ const parsed = ClusterModelChoiceSchema.safeParse(raw);
54074
+ if (!parsed.success) return {
54075
+ kind: "unknown",
54076
+ reason: "read-failed",
54077
+ error: "unparseable owner answer"
54078
+ };
54079
+ const choice = parsed.data;
54080
+ if (choice.kind === "stored") return {
54081
+ kind: "known",
54082
+ modelId: choice.modelId
54083
+ };
54084
+ if (choice.kind === "absent") return {
54085
+ kind: "not-stored",
54086
+ defaultModelId: choice.defaultModelId
54087
+ };
54088
+ return choice.error !== void 0 ? {
54089
+ kind: "unknown",
54090
+ reason: choice.reason,
54091
+ error: choice.error
54092
+ } : {
54093
+ kind: "unknown",
54094
+ reason: choice.reason
54095
+ };
54096
+ }
54097
+ //#endregion
54098
+ //#region src/embedding-encoder/catalogs/embedding-models.ts
54099
+ var HF_REPO = "camstack/camstack-models";
54100
+ var hf = (path) => hfModelUrl(HF_REPO, path);
54101
+ /**
54102
+ * The text tower's tokenizer, in HF `tokenizers` format, hosted next to every
54103
+ * text-encoder onnx (`.../onnx/tokenizer.json`) and fetched as a sibling file so
54104
+ * it lands beside the model. Each model folder hosts ITS OWN (MobileCLIP: the
54105
+ * CLIP BPE, vocab 49408; SigLIP2: Gemma SentencePiece, 256k, lower-casing).
54106
+ */
54107
+ var TOKENIZER_FILE = "tokenizer.json";
54108
+ /** SigLIP2's tokenizer — a DIFFERENT file name on purpose: see `ClipModelMeta.tokenizerFile`. */
54109
+ var SIGLIP2_TOKENIZER_FILE = "camstack-siglip2-b16-224-tokenizer.json";
54110
+ var ovFormat = (url, sizeMB) => {
54111
+ const base = url.split("/").pop() ?? "";
54112
+ const files = base.endsWith(".xml") ? [base.replace(/\.xml$/, ".bin")] : void 0;
54113
+ return {
54114
+ url,
54115
+ sizeMB,
54116
+ runtimes: ["python"],
54117
+ ...files ? { files } : {}
54118
+ };
54119
+ };
54120
+ /**
54121
+ * Files inside an .mlpackage directory bundle.
54122
+ * Must be fetched alongside the package root when isDirectory is true.
54123
+ */
54124
+ var MLPACKAGE_FILES = [
54125
+ "Manifest.json",
54126
+ "Data/com.apple.CoreML/model.mlmodel",
54127
+ "Data/com.apple.CoreML/weights/weight.bin"
54128
+ ];
54129
+ /**
54130
+ * The MobileCLIP feature-space contract (D649 — see `clip-model.ts` in
54131
+ * `@camstack/types`). S1 and S2 share the historical 512-d `object-clip` index,
54132
+ * separated by each row's `modelId`; the CLIP BPE window is 77 tokens padded
54133
+ * with 0; 0.2 is the floor the search always shipped with, measured to keep 96%
54134
+ * of matched COCO caption-image pairs on S1.
54135
+ */
54136
+ var mobileclipMeta = (textModelId) => ({
54137
+ textModelId,
54138
+ embeddingDim: 512,
54139
+ vectorIndex: "object-clip",
54140
+ tokenizerFile: TOKENIZER_FILE,
54141
+ contextLength: 77,
54142
+ padId: 0,
54143
+ searchMinScore: .2
54144
+ });
54145
+ /**
54146
+ * SigLIP2 B/16-224 (D649). 768-d, so its OWN index; a 64-token Gemma
54147
+ * SentencePiece window padded with 0 (the hosted `tokenizer.json` lower-cases,
54148
+ * see `scripts/build-siglip2-model.py`). The floor is SIGLIP2_SEARCH_MIN_SCORE.
54149
+ */
54150
+ var SIGLIP2_META = {
54151
+ textModelId: "siglip2-b16-224-text",
54152
+ embeddingDim: 768,
54153
+ vectorIndex: "object-clip-siglip2-b16-224",
54154
+ tokenizerFile: SIGLIP2_TOKENIZER_FILE,
54155
+ contextLength: 64,
54156
+ padId: 0,
54157
+ searchMinScore: .1
54158
+ };
54159
+ /**
54160
+ * NO onnx vision builds, deliberately (2026-08-21). The int8 ONNX vision
54161
+ * exports were measured misaligned with the text encoders (matched image↔text
54162
+ * cosine ≈ 0.01 vs ≈ 0.22 for the fp16 openvino/coreml builds) — see the
54163
+ * catalog note in `addon-pipeline/.../model-catalogs.ts`. The image-encode leg
54164
+ * that consumed them here (`embeddingEncoder.encode` → PythonRawTensorEngine)
54165
+ * is retired with them: its only caller discarded the vector, and its
54166
+ * `preprocessForClip` applied OpenAI mean/std that MobileCLIP never used.
54167
+ * S0 was retired the same day (measured worst of the family on fleet crops).
54168
+ */
54169
+ var CLIP_IMAGE_MODELS = [
54170
+ {
54171
+ id: "mobileclip-s1",
54172
+ name: "MobileCLIP S1",
54173
+ description: "Apple MobileCLIP S1 — balanced vision encoder, 512-dim, 256×256 (fp16 OpenVINO/CoreML)",
54174
+ inputSize: {
54175
+ width: 256,
54176
+ height: 256
54177
+ },
54178
+ labels: [],
54179
+ inputNormalization: "none",
54180
+ clip: mobileclipMeta("mobileclip-s1-text"),
54181
+ formats: {
54182
+ openvino: ovFormat(hf("clip/mobileclip-s1/openvino/camstack-mobileclip-s1-vision.xml"), 55),
54183
+ coreml: {
54184
+ url: hf("clip/mobileclip-s1/coreml/camstack-mobileclip-s1-vision.mlpackage"),
54185
+ sizeMB: 65,
54186
+ isDirectory: true,
54187
+ files: [...MLPACKAGE_FILES],
54188
+ runtimes: ["python"]
54189
+ }
54190
+ }
54191
+ },
54192
+ {
54193
+ id: "mobileclip-s2",
54194
+ name: "MobileCLIP S2",
54195
+ description: "Apple MobileCLIP S2 — high-accuracy vision encoder, 512-dim, 256×256 (fp16 OpenVINO/CoreML)",
54196
+ inputSize: {
54197
+ width: 256,
54198
+ height: 256
54199
+ },
54200
+ labels: [],
54201
+ inputNormalization: "none",
54202
+ clip: mobileclipMeta("mobileclip-s2-text"),
54203
+ formats: {
54204
+ openvino: ovFormat(hf("clip/mobileclip-s2/openvino/camstack-mobileclip-s2-vision.xml"), 90),
54205
+ coreml: {
54206
+ url: hf("clip/mobileclip-s2/coreml/camstack-mobileclip-s2-vision.mlpackage"),
54207
+ sizeMB: 110,
54208
+ isDirectory: true,
54209
+ files: [...MLPACKAGE_FILES],
54210
+ runtimes: ["python"]
54211
+ }
54212
+ }
54213
+ },
54214
+ {
54215
+ id: "siglip2-b16-224",
54216
+ name: "SigLIP2 B/16",
54217
+ description: "Google SigLIP2 base, patch 16, 224×224 — Apache-2.0 vision encoder, 768-dim (fp16 OpenVINO/CoreML)",
54218
+ inputSize: {
54219
+ width: 224,
54220
+ height: 224
54221
+ },
54222
+ labels: [],
54223
+ inputNormalization: "none",
54224
+ license: "Apache-2.0",
54225
+ clip: SIGLIP2_META,
54226
+ formats: {
54227
+ openvino: ovFormat(hf("clip/siglip2/openvino/camstack-siglip2-b16-224-vision.xml"), 186),
54228
+ coreml: {
54229
+ url: hf("clip/siglip2/coreml/camstack-siglip2-b16-224-vision.mlpackage"),
54230
+ sizeMB: 185,
54231
+ isDirectory: true,
54232
+ files: [...MLPACKAGE_FILES],
54233
+ runtimes: ["python"]
54234
+ }
54235
+ }
54236
+ }
54237
+ ];
54238
+ /**
54239
+ * The int8 TEXT onnx encoders are healthy — unlike the retired int8 vision
54240
+ * exports. Verified 2026-08-21: the live search path (fp16 openvino vision
54241
+ * vectors ⋅ int8 onnx text queries) ranks correctly on the real index, and the
54242
+ * local cross-check aligns them with the fp16 vision space (cos ≈ 0.22 on
54243
+ * matched pairs).
54244
+ */
54245
+ var CLIP_TEXT_MODELS = [
54246
+ {
54247
+ id: "mobileclip-s1-text",
54248
+ name: "MobileCLIP S1 Text Encoder",
54249
+ description: "Text encoder for MobileCLIP S1, 512-dim, int8 quantized (61 MB)",
54250
+ inputSize: {
54251
+ width: 0,
54252
+ height: 0
54253
+ },
54254
+ labels: [],
54255
+ formats: {
54256
+ onnx: {
54257
+ url: hf("clip/mobileclip-s1/onnx/camstack-mobileclip-s1-text.onnx"),
54258
+ sizeMB: 61,
54259
+ files: [TOKENIZER_FILE]
54260
+ },
54261
+ openvino: ovFormat(hf("clip/mobileclip-s1/openvino/camstack-mobileclip-s1-text.xml"), 121)
54262
+ }
54263
+ },
54264
+ {
54265
+ id: "mobileclip-s2-text",
54266
+ name: "MobileCLIP S2 Text Encoder",
54267
+ description: "Text encoder for MobileCLIP S2, 512-dim, int8 quantized (61 MB)",
54268
+ inputSize: {
54269
+ width: 0,
54270
+ height: 0
54271
+ },
54272
+ labels: [],
54273
+ formats: {
54274
+ onnx: {
54275
+ url: hf("clip/mobileclip-s2/onnx/camstack-mobileclip-s2-text.onnx"),
54276
+ sizeMB: 61,
54277
+ files: [TOKENIZER_FILE]
54278
+ },
54279
+ openvino: ovFormat(hf("clip/mobileclip-s2/openvino/camstack-mobileclip-s2-text.xml"), 121)
54280
+ }
54281
+ },
54282
+ {
54283
+ id: "siglip2-b16-224-text",
54284
+ name: "SigLIP2 B/16 Text Encoder",
54285
+ description: "Text encoder for SigLIP2 B/16, 768-dim, fp16 (565 MB)",
54286
+ inputSize: {
54287
+ width: 0,
54288
+ height: 0
54289
+ },
54290
+ labels: [],
54291
+ license: "Apache-2.0",
54292
+ formats: {
54293
+ onnx: {
54294
+ url: hf("clip/siglip2/onnx/camstack-siglip2-b16-224-text.onnx"),
54295
+ sizeMB: 565,
54296
+ files: [SIGLIP2_TOKENIZER_FILE]
54297
+ },
54298
+ openvino: ovFormat(hf("clip/siglip2/openvino/camstack-siglip2-b16-224-text.xml"), 565)
54299
+ }
54300
+ }
54301
+ ];
54302
+ //#endregion
54303
+ //#region src/shared/clip/clip-model-registry.ts
54304
+ /** The model in force when nobody has chosen — the cluster row's default. */
54305
+ var DEFAULT_CLIP_MODEL = "mobileclip-s1";
54306
+ /**
54307
+ * Build a registry from catalog entries. Throws when two models share an index
54308
+ * at different dimensions: that is a catalog defect, and the vector store would
54309
+ * refuse the second model's writes one at a time, forever, at runtime.
54310
+ */
54311
+ function buildClipModelRegistry(entries) {
54312
+ const models = /* @__PURE__ */ new Map();
54313
+ const spaces = /* @__PURE__ */ new Map();
54314
+ for (const entry of entries) {
54315
+ const meta = entry.clip;
54316
+ if (meta === void 0) continue;
54317
+ models.set(entry.id, {
54318
+ modelId: entry.id,
54319
+ inputSize: entry.inputSize.width,
54320
+ meta
54321
+ });
54322
+ const existing = spaces.get(meta.vectorIndex);
54323
+ if (existing !== void 0 && existing.dim !== meta.embeddingDim) throw new Error(`CLIP index "${meta.vectorIndex}" declared at ${String(existing.dim)} dims by ${existing.modelIds.join(", ")} and at ${String(meta.embeddingDim)} by ${entry.id}`);
54324
+ spaces.set(meta.vectorIndex, {
54325
+ index: meta.vectorIndex,
54326
+ dim: meta.embeddingDim,
54327
+ modelIds: [...existing?.modelIds ?? [], entry.id]
54328
+ });
54329
+ }
54330
+ const all = [...spaces.values()];
54331
+ return {
54332
+ resolve: (modelId) => models.get(modelId) ?? null,
54333
+ spaceFor: (modelId) => {
54334
+ const model = models.get(modelId);
54335
+ return model === void 0 ? null : spaces.get(model.meta.vectorIndex) ?? null;
54336
+ },
54337
+ spaces: () => all
54338
+ };
54339
+ }
54340
+ /** The built-in catalog's registry. */
54341
+ var BUILTIN_CLIP_MODELS = buildClipModelRegistry(CLIP_IMAGE_MODELS);
54342
+ //#endregion
53058
54343
  Object.defineProperty(exports, "AUDIO_MACRO_LABELS", {
53059
54344
  enumerable: true,
53060
54345
  get: function() {
@@ -53073,6 +54358,12 @@ Object.defineProperty(exports, "ArchivedDebugNoteSchema", {
53073
54358
  return ArchivedDebugNoteSchema;
53074
54359
  }
53075
54360
  });
54361
+ Object.defineProperty(exports, "BUILTIN_CLIP_MODELS", {
54362
+ enumerable: true,
54363
+ get: function() {
54364
+ return BUILTIN_CLIP_MODELS;
54365
+ }
54366
+ });
53076
54367
  Object.defineProperty(exports, "BaseAddon", {
53077
54368
  enumerable: true,
53078
54369
  get: function() {
@@ -53091,10 +54382,22 @@ Object.defineProperty(exports, "BirthDecisionRecordSchema", {
53091
54382
  return BirthDecisionRecordSchema;
53092
54383
  }
53093
54384
  });
53094
- Object.defineProperty(exports, "CLUSTER_MODEL_SCOPED_STEPS", {
54385
+ Object.defineProperty(exports, "CLIP_EMBEDDING_STEP_ID", {
53095
54386
  enumerable: true,
53096
54387
  get: function() {
53097
- return CLUSTER_MODEL_SCOPED_STEPS;
54388
+ return CLIP_EMBEDDING_STEP_ID;
54389
+ }
54390
+ });
54391
+ Object.defineProperty(exports, "CLIP_IMAGE_MODELS", {
54392
+ enumerable: true,
54393
+ get: function() {
54394
+ return CLIP_IMAGE_MODELS;
54395
+ }
54396
+ });
54397
+ Object.defineProperty(exports, "CLIP_TEXT_MODELS", {
54398
+ enumerable: true,
54399
+ get: function() {
54400
+ return CLIP_TEXT_MODELS;
53098
54401
  }
53099
54402
  });
53100
54403
  Object.defineProperty(exports, "COCO_TO_MACRO", {
@@ -53115,6 +54418,12 @@ Object.defineProperty(exports, "CoverStateSchema", {
53115
54418
  return CoverStateSchema;
53116
54419
  }
53117
54420
  });
54421
+ Object.defineProperty(exports, "DEFAULT_CLIP_MODEL", {
54422
+ enumerable: true,
54423
+ get: function() {
54424
+ return DEFAULT_CLIP_MODEL;
54425
+ }
54426
+ });
53118
54427
  Object.defineProperty(exports, "DEFAULT_EVENT_COLOR", {
53119
54428
  enumerable: true,
53120
54429
  get: function() {
@@ -53157,6 +54466,24 @@ Object.defineProperty(exports, "DeviceType", {
53157
54466
  return DeviceType;
53158
54467
  }
53159
54468
  });
54469
+ Object.defineProperty(exports, "EMBEDDING_MODEL_FAILED", {
54470
+ enumerable: true,
54471
+ get: function() {
54472
+ return EMBEDDING_MODEL_FAILED;
54473
+ }
54474
+ });
54475
+ Object.defineProperty(exports, "EMBEDDING_REQUIREMENTS_FAILED", {
54476
+ enumerable: true,
54477
+ get: function() {
54478
+ return EMBEDDING_REQUIREMENTS_FAILED;
54479
+ }
54480
+ });
54481
+ Object.defineProperty(exports, "EMBEDDING_REQUIREMENTS_UNAVAILABLE", {
54482
+ enumerable: true,
54483
+ get: function() {
54484
+ return EMBEDDING_REQUIREMENTS_UNAVAILABLE;
54485
+ }
54486
+ });
53160
54487
  Object.defineProperty(exports, "EVENT_KIND_BY_CAP", {
53161
54488
  enumerable: true,
53162
54489
  get: function() {
@@ -53175,6 +54502,12 @@ Object.defineProperty(exports, "EventCategory", {
53175
54502
  return EventCategory;
53176
54503
  }
53177
54504
  });
54505
+ Object.defineProperty(exports, "FACE_EMBEDDING_STEP_ID", {
54506
+ enumerable: true,
54507
+ get: function() {
54508
+ return FACE_EMBEDDING_STEP_ID;
54509
+ }
54510
+ });
53178
54511
  Object.defineProperty(exports, "FIRST_LEVEL_MACRO_CLASSES", {
53179
54512
  enumerable: true,
53180
54513
  get: function() {
@@ -53271,6 +54604,12 @@ Object.defineProperty(exports, "NC_SNOOZE_MAX_MINUTES", {
53271
54604
  return NC_SNOOZE_MAX_MINUTES;
53272
54605
  }
53273
54606
  });
54607
+ Object.defineProperty(exports, "NC_SYSTEM_EVENT_KIND_GROUP_SPECS", {
54608
+ enumerable: true,
54609
+ get: function() {
54610
+ return NC_SYSTEM_EVENT_KIND_GROUP_SPECS;
54611
+ }
54612
+ });
53274
54613
  Object.defineProperty(exports, "NC_TANK_SYSTEM_EVENT_KINDS", {
53275
54614
  enumerable: true,
53276
54615
  get: function() {
@@ -53421,6 +54760,12 @@ Object.defineProperty(exports, "RECORDING_SOURCE_CAMSTACK_ADDON", {
53421
54760
  return RECORDING_SOURCE_CAMSTACK_ADDON;
53422
54761
  }
53423
54762
  });
54763
+ Object.defineProperty(exports, "RebuildObjectEmbeddingsRefusalSchema", {
54764
+ enumerable: true,
54765
+ get: function() {
54766
+ return RebuildObjectEmbeddingsRefusalSchema;
54767
+ }
54768
+ });
53424
54769
  Object.defineProperty(exports, "RetrainStatusSchema", {
53425
54770
  enumerable: true,
53426
54771
  get: function() {
@@ -53595,6 +54940,12 @@ Object.defineProperty(exports, "deriveRecordingMode", {
53595
54940
  return deriveRecordingMode;
53596
54941
  }
53597
54942
  });
54943
+ Object.defineProperty(exports, "describeSystemEventDeliveryProblem", {
54944
+ enumerable: true,
54945
+ get: function() {
54946
+ return describeSystemEventDeliveryProblem;
54947
+ }
54948
+ });
53598
54949
  Object.defineProperty(exports, "describeSystemEventFamilyProblem", {
53599
54950
  enumerable: true,
53600
54951
  get: function() {
@@ -53613,6 +54964,30 @@ Object.defineProperty(exports, "embeddingEncoderCapability", {
53613
54964
  return embeddingEncoderCapability;
53614
54965
  }
53615
54966
  });
54967
+ Object.defineProperty(exports, "embeddingModelFailedError", {
54968
+ enumerable: true,
54969
+ get: function() {
54970
+ return embeddingModelFailedError;
54971
+ }
54972
+ });
54973
+ Object.defineProperty(exports, "embeddingRefusalOf", {
54974
+ enumerable: true,
54975
+ get: function() {
54976
+ return embeddingRefusalOf;
54977
+ }
54978
+ });
54979
+ Object.defineProperty(exports, "embeddingRequirementsFailedError", {
54980
+ enumerable: true,
54981
+ get: function() {
54982
+ return embeddingRequirementsFailedError;
54983
+ }
54984
+ });
54985
+ Object.defineProperty(exports, "embeddingRequirementsUnavailableError", {
54986
+ enumerable: true,
54987
+ get: function() {
54988
+ return embeddingRequirementsUnavailableError;
54989
+ }
54990
+ });
53616
54991
  Object.defineProperty(exports, "encodeVectorBase64", {
53617
54992
  enumerable: true,
53618
54993
  get: function() {
@@ -53649,12 +55024,6 @@ Object.defineProperty(exports, "failureContributionCapability", {
53649
55024
  return failureContributionCapability;
53650
55025
  }
53651
55026
  });
53652
- Object.defineProperty(exports, "hfModelUrl", {
53653
- enumerable: true,
53654
- get: function() {
53655
- return hfModelUrl;
53656
- }
53657
- });
53658
55027
  Object.defineProperty(exports, "hydrateSchema", {
53659
55028
  enumerable: true,
53660
55029
  get: function() {
@@ -53709,6 +55078,18 @@ Object.defineProperty(exports, "isSystemDelivery", {
53709
55078
  return isSystemDelivery;
53710
55079
  }
53711
55080
  });
55081
+ Object.defineProperty(exports, "isSystemEventSummaryRule", {
55082
+ enumerable: true,
55083
+ get: function() {
55084
+ return isSystemEventSummaryRule;
55085
+ }
55086
+ });
55087
+ Object.defineProperty(exports, "isVectorIndexDimConflict", {
55088
+ enumerable: true,
55089
+ get: function() {
55090
+ return isVectorIndexDimConflict;
55091
+ }
55092
+ });
53712
55093
  Object.defineProperty(exports, "kebabToCamel", {
53713
55094
  enumerable: true,
53714
55095
  get: function() {
@@ -53733,6 +55114,12 @@ Object.defineProperty(exports, "nodePin", {
53733
55114
  return nodePin;
53734
55115
  }
53735
55116
  });
55117
+ Object.defineProperty(exports, "normalizeNodeId", {
55118
+ enumerable: true,
55119
+ get: function() {
55120
+ return normalizeNodeId;
55121
+ }
55122
+ });
53736
55123
  Object.defineProperty(exports, "notificationRulesCapability", {
53737
55124
  enumerable: true,
53738
55125
  get: function() {
@@ -53769,12 +55156,6 @@ Object.defineProperty(exports, "partialRecord", {
53769
55156
  return partialRecord;
53770
55157
  }
53771
55158
  });
53772
- Object.defineProperty(exports, "pickClusterStepModels", {
53773
- enumerable: true,
53774
- get: function() {
53775
- return pickClusterStepModels;
53776
- }
53777
- });
53778
55159
  Object.defineProperty(exports, "pipelineAnalyticsCapability", {
53779
55160
  enumerable: true,
53780
55161
  get: function() {
@@ -53787,6 +55168,12 @@ Object.defineProperty(exports, "plateGalleryCapability", {
53787
55168
  return plateGalleryCapability;
53788
55169
  }
53789
55170
  });
55171
+ Object.defineProperty(exports, "readClusterModelPinStrict", {
55172
+ enumerable: true,
55173
+ get: function() {
55174
+ return readClusterModelPinStrict;
55175
+ }
55176
+ });
53790
55177
  Object.defineProperty(exports, "readDeviceStateFrom", {
53791
55178
  enumerable: true,
53792
55179
  get: function() {
@@ -53805,6 +55192,18 @@ Object.defineProperty(exports, "record", {
53805
55192
  return record;
53806
55193
  }
53807
55194
  });
55195
+ Object.defineProperty(exports, "resolveClipSearchMinScore", {
55196
+ enumerable: true,
55197
+ get: function() {
55198
+ return resolveClipSearchMinScore;
55199
+ }
55200
+ });
55201
+ Object.defineProperty(exports, "resolveClusterModelPin", {
55202
+ enumerable: true,
55203
+ get: function() {
55204
+ return resolveClusterModelPin;
55205
+ }
55206
+ });
53808
55207
  Object.defineProperty(exports, "resolveLocationMode", {
53809
55208
  enumerable: true,
53810
55209
  get: function() {
@@ -53865,6 +55264,12 @@ Object.defineProperty(exports, "subKindsOf", {
53865
55264
  return subKindsOf;
53866
55265
  }
53867
55266
  });
55267
+ Object.defineProperty(exports, "systemEventDeliveryProblems", {
55268
+ enumerable: true,
55269
+ get: function() {
55270
+ return systemEventDeliveryProblems;
55271
+ }
55272
+ });
53868
55273
  Object.defineProperty(exports, "systemEventFamilyProblems", {
53869
55274
  enumerable: true,
53870
55275
  get: function() {
@@ -53877,6 +55282,18 @@ Object.defineProperty(exports, "systemEventFilterApplies", {
53877
55282
  return systemEventFilterApplies;
53878
55283
  }
53879
55284
  });
55285
+ Object.defineProperty(exports, "systemEventSummaryScheduleOf", {
55286
+ enumerable: true,
55287
+ get: function() {
55288
+ return systemEventSummaryScheduleOf;
55289
+ }
55290
+ });
55291
+ Object.defineProperty(exports, "templateCarriesSummary", {
55292
+ enumerable: true,
55293
+ get: function() {
55294
+ return templateCarriesSummary;
55295
+ }
55296
+ });
53880
55297
  Object.defineProperty(exports, "templateVarsFor", {
53881
55298
  enumerable: true,
53882
55299
  get: function() {